@starfish-codes/hellgate 2.0.0-beta.6 → 3.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
@@ -10,5 +10,3 @@
10
10
  - **Developer Documentation:** https://developer.hellgate.io/sdks/web-sdk
11
11
 
12
12
  - **API Reference:** https://api-reference.hellgate.io/
13
-
14
- - **Support contact:** hellgate.products@starfish.team.
@@ -8,9 +8,13 @@ export declare class Hellgate3DSHandler {
8
8
  private disposers;
9
9
  private check3dsIframeDisposers;
10
10
  private domContainer;
11
+ private onStartHandler?;
12
+ private onFinishHandler?;
11
13
  constructor(session: HellgateSession, domContainer?: HTMLElement);
12
14
  dispose(): void;
13
15
  onDecoupledAuth: (fn: (cardholderInfo: string) => void) => void;
16
+ onStartChallenge: (fn: () => void) => void;
17
+ onChallengeFinished: (fn: () => void) => void;
14
18
  private sessionStateHandle;
15
19
  private initCheck3DSIframes;
16
20
  private disposeCheck3DSIframe;
@@ -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
  };