@starfish-codes/hellgate 2.0.0-beta.4 → 2.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -59
- package/dist/card/card-handler.d.ts +4 -4
- package/dist/card/typings.d.ts +11 -9
- package/dist/card/ui/elements/base-element.d.ts +3 -3
- package/dist/card/ui/elements/card-expiration-date.d.ts +0 -2
- package/dist/card/ui/elements/index.d.ts +1 -0
- package/dist/card/ui/elements/utils.d.ts +2 -1
- package/dist/card/ui/typings.d.ts +1 -1
- package/dist/hellgate-sdk.mjs +1052 -1039
- package/dist/hellgate-sdk.umd.js +5 -5
- package/package.json +2 -2
- /package/dist/card/ui/iframe/__tests__/{iframe-elements.spec.d.ts → utils.spec.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -3,66 +3,12 @@
|
|
|
3
3
|
[](https://github.com/starfish-codes/hgate2-headless-web-sdk/actions/workflows/ci.yml?query=branch%3Amain)
|
|
4
4
|
[](https://codecov.io/gh/starfish-codes/hgate2-headless-web-sdk)
|
|
5
5
|
|
|
6
|
-
##
|
|
6
|
+
## Communication Channels
|
|
7
7
|
|
|
8
|
-
https://
|
|
8
|
+
- **Hellgate:** https://hellgate.io/
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
- **Developer Documentation:** https://developer.hellgate.io/sdks/web-sdk
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
- **API Reference:** https://api-reference.hellgate.io/
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
yarn
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
### Start Iframe App in dev mode
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
yarn iframe
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Should be available on http://localhost:4044
|
|
25
|
-
|
|
26
|
-
### Start Demo App in dev mode (Iframe app running is required)
|
|
27
|
-
|
|
28
|
-
1. Create `demo/.env.dev` by copying `demo/.env.dev.example` (VITE_API_KEY is optional)
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
cp demo/.env.dev.example demo/.env.dev
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
2. Run demo app
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
yarn demo
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Open http://localhost:4040
|
|
41
|
-
|
|
42
|
-
### Run tests locally in dev mode (Iframe app running is required)
|
|
43
|
-
|
|
44
|
-
1. Create `.env.test` by copying `.env.test.example`. (VITE_BT_API_KEY is required)
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
cp .env.test.example .env.test
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
2. Run tests
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
yarn test
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Run linter
|
|
57
|
-
|
|
58
|
-
```
|
|
59
|
-
yarn lint
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Production build
|
|
63
|
-
|
|
64
|
-
```
|
|
65
|
-
yarn build
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Check `dist` folder
|
|
14
|
+
- **Support contact:** hellgate.products@starfish.team.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BasisTheory as IBasisTheory } from '@basis-theory/basis-theory-js/types/sdk';
|
|
2
2
|
import { HellgateSession } from '../session';
|
|
3
3
|
import { CreateCardFieldsOptions, CreateCardFormOptions, PaymentAdditionalData, TokenizedData } from './typings';
|
|
4
|
-
import { CardElement, CardExpirationDateElement, CardNumberElement, CardVerificationCodeElement } from './ui/elements';
|
|
5
|
-
import {
|
|
6
|
-
export type FormFieldState = Omit<ChangeEvent<
|
|
4
|
+
import { CardElement, CardExpirationDateElement, CardNumberElement, CardVerificationCodeElement, TextElement } from './ui/elements';
|
|
5
|
+
import { ChangeEvent, ElementBaseOptions } from './ui/typings';
|
|
6
|
+
export type FormFieldState = Omit<ChangeEvent<never>['data'], 'type'>;
|
|
7
7
|
export declare class HellgateCardHandler {
|
|
8
8
|
session: HellgateSession;
|
|
9
9
|
private bt;
|
|
@@ -18,7 +18,7 @@ export declare class HellgateCardHandler {
|
|
|
18
18
|
expiryDate: CardExpirationDateElement;
|
|
19
19
|
securityCode: CardVerificationCodeElement;
|
|
20
20
|
};
|
|
21
|
-
createTextField: (options?: ElementBaseOptions) =>
|
|
21
|
+
createTextField: (options?: ElementBaseOptions) => TextElement;
|
|
22
22
|
tokenize: () => Promise<TokenizedData>;
|
|
23
23
|
onStateChange: (fn: (state: FormFieldState) => void) => void;
|
|
24
24
|
clear: () => void;
|
package/dist/card/typings.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TextElement } from './ui/';
|
|
1
2
|
import { ElementBaseOptions } from './ui/typings';
|
|
2
3
|
export type CreateCardFormOptions = Pick<ElementBaseOptions, 'style' | 'disabled' | 'autocomplete' | 'placeholder' | 'ariaLabel'> & {
|
|
3
4
|
icon?: 'left' | 'right' | 'none';
|
|
@@ -7,16 +8,17 @@ export type CreateCardFieldsOptions = Pick<ElementBaseOptions, 'style' | 'disabl
|
|
|
7
8
|
expiryDate?: ElementBaseOptions;
|
|
8
9
|
securityCode?: ElementBaseOptions;
|
|
9
10
|
};
|
|
10
|
-
export type
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
export type AdditionalDataValue = string | TextElement;
|
|
12
|
+
export type PaymentAdditionalData<FieldValue = AdditionalDataValue> = {
|
|
13
|
+
cardholder_name?: FieldValue;
|
|
14
|
+
email?: FieldValue;
|
|
13
15
|
billing_address?: {
|
|
14
|
-
line1?:
|
|
15
|
-
line2?:
|
|
16
|
-
line3?:
|
|
17
|
-
postal_code?:
|
|
18
|
-
city?:
|
|
19
|
-
country?:
|
|
16
|
+
line1?: FieldValue;
|
|
17
|
+
line2?: FieldValue;
|
|
18
|
+
line3?: FieldValue;
|
|
19
|
+
postal_code?: FieldValue;
|
|
20
|
+
city?: FieldValue;
|
|
21
|
+
country?: FieldValue;
|
|
20
22
|
};
|
|
21
23
|
};
|
|
22
24
|
export type TokenizeData = Record<string, unknown>;
|
|
@@ -4,18 +4,18 @@ export declare abstract class CardElementBase<Value, IframeValue = string> {
|
|
|
4
4
|
readonly options: ElementBaseOptions<Value>;
|
|
5
5
|
private iframe;
|
|
6
6
|
private subscriptions;
|
|
7
|
-
value: Value | null;
|
|
8
7
|
protected abstract type: ElementType;
|
|
9
8
|
protected abstract extractValue: (rawValue: IframeValue | null) => Value | null;
|
|
10
9
|
protected abstract putValue: (rawValue: Value | null) => IframeValue | null;
|
|
11
|
-
constructor(options: ElementBaseOptions<Value
|
|
10
|
+
constructor(options: ElementBaseOptions<Value>, key?: string);
|
|
12
11
|
mount(selector: string | Element): Promise<void>;
|
|
13
12
|
update: ({ ...data }: ElementBaseOptions<Value>) => Promise<void>;
|
|
14
13
|
clear: () => void;
|
|
15
14
|
focus: () => void;
|
|
16
15
|
blur: () => void;
|
|
17
16
|
unmount: () => void;
|
|
18
|
-
on<T extends EventType>(eventType: T, listener: (event: FindByType<Explicit<CardElementEvents<
|
|
17
|
+
on<T extends EventType>(eventType: T, listener: (event: FindByType<Explicit<CardElementEvents<never>>, T>['data']) => void): Subscription;
|
|
18
|
+
secureValue(key: string): Value | null;
|
|
19
19
|
private emitEvent;
|
|
20
20
|
private iframePostMessage;
|
|
21
21
|
}
|
|
@@ -9,6 +9,4 @@ export declare class CardExpirationDateElement extends CardElementBase<CardExpir
|
|
|
9
9
|
protected type: ElementType;
|
|
10
10
|
protected extractValue: typeof extractExpiryDateValue;
|
|
11
11
|
protected putValue: typeof putExpiryDateValue;
|
|
12
|
-
month: () => number | null;
|
|
13
|
-
year: () => number | null;
|
|
14
12
|
}
|
|
@@ -11,5 +11,6 @@ type Elements = {
|
|
|
11
11
|
cardVerificationCode: CardVerificationCodeElement;
|
|
12
12
|
text: TextElement;
|
|
13
13
|
};
|
|
14
|
-
export declare function createElement<T extends keyof Elements>(type: T, options: ElementBaseOptions): Elements[T];
|
|
14
|
+
export declare function createElement<T extends keyof Elements>(type: T, options: ElementBaseOptions, key?: string): Elements[T];
|
|
15
|
+
export declare function uid(): string;
|
|
15
16
|
export {};
|
|
@@ -16,7 +16,7 @@ type ChangeEvent<Value> = BaseEvent<'change', {
|
|
|
16
16
|
complete: boolean;
|
|
17
17
|
valid?: boolean;
|
|
18
18
|
error?: string;
|
|
19
|
-
value: Value | null;
|
|
19
|
+
value: Value extends never ? never : Value | null;
|
|
20
20
|
}>;
|
|
21
21
|
type InputFocusEvent = BaseEvent<'focus'>;
|
|
22
22
|
type InputBlurEvent = BaseEvent<'blur'>;
|