@starfish-codes/hellgate 2.0.0-beta.5 → 2.0.0

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 CHANGED
@@ -3,66 +3,10 @@
3
3
  [![CI](https://github.com/starfish-codes/hgate2-headless-web-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/starfish-codes/hgate2-headless-web-sdk/actions/workflows/ci.yml?query=branch%3Amain)
4
4
  [![codecov](https://codecov.io/gh/starfish-codes/hgate2-headless-web-sdk/graph/badge.svg?token=bw5V0iIWHe)](https://codecov.io/gh/starfish-codes/hgate2-headless-web-sdk)
5
5
 
6
- ## Documentation
6
+ ## Communication Channels
7
7
 
8
- https://developer.hellgate.dev
8
+ - **Hellgate:** https://hellgate.io/
9
9
 
10
- ## Development
10
+ - **Developer Documentation:** https://developer.hellgate.io/sdks/web-sdk
11
11
 
12
- ### Install Dependencies
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
12
+ - **API Reference:** https://api-reference.hellgate.io/
@@ -1,2 +1,2 @@
1
- export declare function wait(milliseconds: number): Promise<unknown>;
1
+ export declare function wait(milliseconds: number): Promise<void>;
2
2
  export declare function fill(input: HTMLInputElement, value: string): void;
@@ -1,17 +1,18 @@
1
1
  import { BasisTheory as IBasisTheory } from '@basis-theory/basis-theory-js/types/sdk';
2
2
  import { HellgateSession } from '../session';
3
- import { CreateCardFieldsOptions, CreateCardFormOptions, PaymentAdditionalData, TokenizedData } from './typings';
3
+ import { CreateCardFieldsOptions, CreateCardFormOptions, PaymentAdditionalData, TokenizeCardConfig, TokenizedData } from './typings';
4
4
  import { CardElement, CardExpirationDateElement, CardNumberElement, CardVerificationCodeElement, TextElement } from './ui/elements';
5
5
  import { ChangeEvent, ElementBaseOptions } from './ui/typings';
6
6
  export type FormFieldState = Omit<ChangeEvent<never>['data'], 'type'>;
7
7
  export declare class HellgateCardHandler {
8
8
  session: HellgateSession;
9
- private bt;
9
+ private tokenizeConfig;
10
+ private bt?;
10
11
  state: FormFieldState;
11
12
  private cardElements;
12
13
  private stateChangeHandlers;
13
- static init(session: HellgateSession, bt_api_key: string): Promise<HellgateCardHandler>;
14
- constructor(session: HellgateSession, bt: IBasisTheory);
14
+ static init(session: HellgateSession, tokenizeConfig: TokenizeCardConfig): Promise<HellgateCardHandler>;
15
+ constructor(session: HellgateSession, tokenizeConfig: TokenizeCardConfig, bt?: IBasisTheory | undefined);
15
16
  createForm: (options?: CreateCardFormOptions) => CardElement;
16
17
  createFormFields: (options?: CreateCardFieldsOptions) => {
17
18
  cardNumber: CardNumberElement;
@@ -0,0 +1,2 @@
1
+ import { BTTokenizeData } from './typings';
2
+ export declare const BT_TOKENIZE_PARAMS: BTTokenizeData;
@@ -0,0 +1,2 @@
1
+ export * from './constants';
2
+ export * from './typings';
@@ -0,0 +1 @@
1
+ export type BTTokenizeData = Record<string, unknown>;
@@ -0,0 +1,18 @@
1
+ type GuardianCardTokenizeData = {
2
+ account_number: string;
3
+ expiry_month: number;
4
+ expiry_year: number;
5
+ security_code: string;
6
+ cardholder_name?: string;
7
+ };
8
+ export declare class GuardianAPIClient {
9
+ private apiKey;
10
+ private abortCtrl;
11
+ private baseUrl;
12
+ constructor(baseUrl: string, apiKey: string, abortCtrl?: AbortController);
13
+ tokenize(data: GuardianCardTokenizeData): Promise<{
14
+ id: string;
15
+ }>;
16
+ cancelAll(): void;
17
+ }
18
+ export {};
@@ -0,0 +1 @@
1
+ export * from './guardian.api';
@@ -21,20 +21,31 @@ export type PaymentAdditionalData<FieldValue = AdditionalDataValue> = {
21
21
  country?: FieldValue;
22
22
  };
23
23
  };
24
- export type TokenizeData = Record<string, unknown>;
24
+ export type ElementsCardData = {
25
+ number: string | null;
26
+ expiration_month: number | null;
27
+ expiration_year: number | null;
28
+ cvc: string | null;
29
+ };
25
30
  export type TokenizedData = {
26
31
  id: string;
27
32
  };
28
33
  export type TokenizeCardActionDTO = {
29
34
  action: 'tokenize_card';
30
35
  result: {
31
- bt_token_id: string;
36
+ token_id: string;
32
37
  additional_data?: PaymentAdditionalData;
33
38
  };
34
39
  };
40
+ export type TokenizeCardConfig = {
41
+ provider: 'guardian';
42
+ api_key: string;
43
+ base_url: string;
44
+ } | {
45
+ provider: 'basis_theory';
46
+ api_key: string;
47
+ };
35
48
  export type TokenizeCardSessionStateDTO = {
36
49
  next_action: 'tokenize_card';
37
- data: {
38
- bt_api_key: string;
39
- };
50
+ data: TokenizeCardConfig;
40
51
  };