@starfish-codes/hellgate 3.0.0 → 3.1.1

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.
@@ -1,4 +1,8 @@
1
1
  import { HellgateSession } from '../session';
2
+ type Hellgate3DSOptions = {
3
+ domContainer?: HTMLElement;
4
+ labelText?: string;
5
+ };
2
6
  export declare class Hellgate3DSHandler {
3
7
  private session;
4
8
  private iframeId;
@@ -8,9 +12,10 @@ export declare class Hellgate3DSHandler {
8
12
  private disposers;
9
13
  private check3dsIframeDisposers;
10
14
  private domContainer;
15
+ private labelText?;
11
16
  private onStartHandler?;
12
17
  private onFinishHandler?;
13
- constructor(session: HellgateSession, domContainer?: HTMLElement);
18
+ constructor(session: HellgateSession, options: Hellgate3DSOptions);
14
19
  dispose(): void;
15
20
  onDecoupledAuth: (fn: (cardholderInfo: string) => void) => void;
16
21
  onStartChallenge: (fn: () => void) => void;
@@ -22,3 +27,4 @@ export declare class Hellgate3DSHandler {
22
27
  private startDecoupledAuth;
23
28
  private startAuthResultPolling;
24
29
  }
30
+ export {};
@@ -8,11 +8,12 @@ export declare class HellgateCardHandler {
8
8
  session: HellgateSession;
9
9
  private tokenizeConfig;
10
10
  private bt?;
11
+ private cardAdditionalData?;
11
12
  state: FormFieldState;
12
13
  private cardElements;
13
14
  private stateChangeHandlers;
14
15
  static init(session: HellgateSession, tokenizeConfig: TokenizeCardConfig): Promise<HellgateCardHandler>;
15
- constructor(session: HellgateSession, tokenizeConfig: TokenizeCardConfig, bt?: IBasisTheory | undefined);
16
+ constructor(session: HellgateSession, tokenizeConfig: TokenizeCardConfig, bt?: IBasisTheory | undefined, cardAdditionalData?: PaymentAdditionalData<string> | undefined);
16
17
  createForm: (options?: CreateCardFormOptions) => CardElement;
17
18
  createFormFields: (options?: CreateCardFieldsOptions) => {
18
19
  cardNumber: CardNumberElement;
@@ -20,7 +21,9 @@ export declare class HellgateCardHandler {
20
21
  securityCode: CardVerificationCodeElement;
21
22
  };
22
23
  createTextField: (options?: ElementBaseOptions) => TextElement;
23
- tokenize: () => Promise<TokenizedData>;
24
+ tokenize: () => Promise<TokenizedData | {
25
+ token_id: string;
26
+ } | null>;
24
27
  onStateChange: (fn: (state: FormFieldState) => void) => void;
25
28
  clear: () => void;
26
29
  reset: () => void;
@@ -29,6 +32,7 @@ export declare class HellgateCardHandler {
29
32
  private hasFormElements;
30
33
  private disableFormElements;
31
34
  private extractAdditionalData;
35
+ private encryptCardData;
32
36
  private addElementStateListener;
33
37
  updateFormState(): void;
34
38
  private createFieldDefaultState;
@@ -1,3 +1,4 @@
1
+ import { JWK } from 'jose';
1
2
  import { TextElement } from './ui/';
2
3
  import { ElementBaseOptions } from './ui/typings';
3
4
  export type CreateCardFormOptions = Pick<ElementBaseOptions, 'style' | 'disabled' | 'autocomplete' | 'placeholder' | 'ariaLabel'> & {
@@ -28,12 +29,13 @@ export type ElementsCardData = {
28
29
  cvc: string | null;
29
30
  };
30
31
  export type TokenizedData = {
31
- id: string;
32
+ enc_payload: string;
33
+ } | {
34
+ token_id: string;
32
35
  };
33
36
  export type TokenizeCardActionDTO = {
34
37
  action: 'tokenize_card';
35
- result: {
36
- token_id: string;
38
+ result: TokenizedData & {
37
39
  additional_data?: PaymentAdditionalData;
38
40
  };
39
41
  };
@@ -41,6 +43,7 @@ export type TokenizeCardConfig = {
41
43
  provider: 'guardian';
42
44
  api_key: string;
43
45
  base_url: string;
46
+ jwk: JWK;
44
47
  } | {
45
48
  provider: 'basis_theory';
46
49
  api_key: string;
@@ -49,3 +52,10 @@ export type TokenizeCardSessionStateDTO = {
49
52
  next_action: 'tokenize_card';
50
53
  data: TokenizeCardConfig;
51
54
  };
55
+ export type CardTokenizeData = {
56
+ account_number: string;
57
+ expiry_month: number;
58
+ expiry_year: number;
59
+ security_code: string;
60
+ cardholder_name?: string;
61
+ };
@@ -2,6 +2,7 @@ import { Explicit } from '../iframe/utils';
2
2
  import { CardElementEvents, ElementBaseOptions, ElementType, EventType, FindByType, Subscription } from '../typings';
3
3
  export declare abstract class CardElementBase<Value, IframeValue = string> {
4
4
  readonly options: ElementBaseOptions<Value>;
5
+ private IFRAME_BASE_URL;
5
6
  private iframe;
6
7
  private subscriptions;
7
8
  protected abstract type: ElementType;