@spot-flow/checkout-inline-js 0.2.0 → 0.2.1-dev.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.
Files changed (33) hide show
  1. package/dist/api.d.ts +9 -1
  2. package/dist/checkout-class.d.ts +5 -1
  3. package/dist/checkout-inline.es.js +9527 -6898
  4. package/dist/checkout-inline.js +678 -291
  5. package/dist/constants.d.ts +130 -0
  6. package/dist/contexts/translate-context.d.ts +27 -0
  7. package/dist/controllers/LoadingStateManager.d.ts +96 -0
  8. package/dist/controllers/TranslationManager.d.ts +17 -0
  9. package/dist/data.d.ts +11 -26
  10. package/dist/index.css +1 -1
  11. package/dist/modules/Card.d.ts +11 -7
  12. package/dist/modules/EFT.d.ts +1 -1
  13. package/dist/modules/MobileMoney.d.ts +2 -1
  14. package/dist/modules/Opay.d.ts +68 -0
  15. package/dist/modules/Stablecoins.d.ts +62 -0
  16. package/dist/modules/Transfer.d.ts +1 -0
  17. package/dist/types/types.d.ts +29 -1
  18. package/dist/types.d.ts +2 -6
  19. package/dist/utils/appenum.d.ts +4 -1
  20. package/dist/utils/get-region-details.d.ts +4 -0
  21. package/dist/utils.d.ts +1 -0
  22. package/dist/views/card/avs-validation.d.ts +2 -0
  23. package/dist/views/opay/opay-authenticate.d.ts +22 -0
  24. package/dist/views/shared/main-footer.d.ts +3 -0
  25. package/dist/views/shared/main-header.d.ts +9 -1
  26. package/dist/views/shared/main-page.d.ts +10 -3
  27. package/dist/views/shared/test-card.d.ts +5 -1
  28. package/dist/views/stablecoins/stablecoin-confirmation-end.d.ts +28 -0
  29. package/dist/views/{card/confirmation-progress.d.ts → stablecoins/stablecoin-confirmation.d.ts} +2 -2
  30. package/dist/views/stablecoins/stablecoins-form.d.ts +74 -0
  31. package/package.json +1 -1
  32. package/dist/views/transfer/transfer-confirmation-one.d.ts +0 -13
  33. package/dist/views/transfer/transfer-confirmation-two.d.ts +0 -15
@@ -0,0 +1,62 @@
1
+ import { GetMerchantDetailsTax } from '../types/types';
2
+ import { CustomerDetails } from '../types';
3
+
4
+ type Props = {
5
+ container: HTMLElement;
6
+ closeModal: () => void;
7
+ onSuccess?: (_val?: any) => void;
8
+ restartTransactionProcess: () => void;
9
+ hidePaymentMethods: () => void;
10
+ showPaymentMethods: () => void;
11
+ customer: CustomerDetails;
12
+ amount: number;
13
+ totalAmount: number;
14
+ currency: string;
15
+ rdtCode?: string;
16
+ url?: string;
17
+ reference: string;
18
+ callBackUrl: string;
19
+ metadata: Record<string, unknown>;
20
+ retryingPayment: boolean;
21
+ token: string;
22
+ localCurrency: string;
23
+ };
24
+ declare class Stablecoins {
25
+ private contents;
26
+ private container;
27
+ private stableCoinsForm;
28
+ private successScreen;
29
+ private stablecoinConfirmationEnd;
30
+ private pageLoader;
31
+ private onSuccess;
32
+ private restartTransactionProcess;
33
+ private stablecoinsConfirmationProgress;
34
+ private _currentStep;
35
+ private customer;
36
+ private totalAmount;
37
+ private amount;
38
+ private currency;
39
+ private rdtCode?;
40
+ private url?;
41
+ private reference;
42
+ private callBackUrl;
43
+ private metadata;
44
+ private retryingPayment;
45
+ private warningScreen;
46
+ private transactionIssuesScreen;
47
+ private paymentResponse;
48
+ private paymentResponseHeaders;
49
+ isMaxRetriesReached: boolean;
50
+ private token;
51
+ private localCurrency;
52
+ errorText: string;
53
+ constructor({ container, restartTransactionProcess, amount, currency, customer, callBackUrl, metadata, reference, rdtCode, url, token, retryingPayment, totalAmount, localCurrency, onSuccess, }: Props);
54
+ get currentStep(): number;
55
+ set currentStep(step: number);
56
+ showLoader(): void;
57
+ setPaymentError(text: string): void;
58
+ goBackToMerchant(): void;
59
+ verifyPaymentProcess(): Promise<void>;
60
+ renderStablecoinsContent(values?: GetMerchantDetailsTax): void;
61
+ }
62
+ export default Stablecoins;
@@ -57,6 +57,7 @@ declare class Transfer {
57
57
  private retryingPayment;
58
58
  isMaxRetriesReached: boolean;
59
59
  isMobile: boolean;
60
+ errorText: string;
60
61
  constructor({ amount, totalAmount, closeModal, container, customer, token, currency, rdtCode, url, reference, callBackUrl, metadata, localCurrency, disablePaymentMethods, restartTransactionProcess, hidePaymentMethods, retryingPayment, }: Props);
61
62
  get currentStep(): number;
62
63
  set currentStep(step: number);
@@ -48,6 +48,12 @@ export type MobileMoneyPaymentRequestPayload = Prettify<PaymentRequestPayload &
48
48
  otp?: string;
49
49
  }>;
50
50
  }>;
51
+ export type StablecoinsPaymentRequestPayload = Prettify<PaymentRequestPayload & {
52
+ stablecoin: Partial<{
53
+ asset: string;
54
+ chain: string;
55
+ }>;
56
+ }>;
51
57
  export type AuthorizeCardPaymentRequestPayload = {
52
58
  authorization: {
53
59
  pin?: string;
@@ -102,6 +108,15 @@ export type PaymentResponseData = {
102
108
  firstSix: string;
103
109
  lastFour: string;
104
110
  };
111
+ stablecoin: {
112
+ asset: string;
113
+ chain: string;
114
+ depositAddress: string;
115
+ memo: string;
116
+ expiry: Date;
117
+ requiredConfirmations: number;
118
+ reference: string;
119
+ };
105
120
  ussd: {
106
121
  code: string;
107
122
  paymentCode: string;
@@ -141,6 +156,14 @@ export type BankOption = {
141
156
  name: string;
142
157
  code: string;
143
158
  };
159
+ export type Trial = {
160
+ id: string;
161
+ pricingList: Array<{
162
+ type: string;
163
+ amount: number;
164
+ currency: string;
165
+ }>;
166
+ };
144
167
  export type PlanDetailResponseData = {
145
168
  id: string;
146
169
  title: string;
@@ -155,6 +178,7 @@ export type PlanDetailResponseData = {
155
178
  }>;
156
179
  subscribers: number;
157
180
  subscriptions: number;
181
+ trial?: Trial;
158
182
  };
159
183
  export type GetMerchantPlanDetail = {
160
184
  merchantName: string;
@@ -199,6 +223,10 @@ export type RetryPaymentPayload = {
199
223
  code: string;
200
224
  phoneNumber: string;
201
225
  };
226
+ stablecoin?: {
227
+ asset: string;
228
+ chain: string;
229
+ };
202
230
  };
203
231
  export type PusherResponse = {
204
232
  amount: string;
@@ -208,7 +236,7 @@ export type PusherResponse = {
208
236
  spotflowReference: string;
209
237
  status: string;
210
238
  };
211
- export type PaymentChannel = "card" | "bank_transfer" | "ussd" | "mobile_money" | "eft";
239
+ export type PaymentChannel = "card" | "bank_transfer" | "ussd" | "mobile_money" | "eft" | "stablecoin";
212
240
  export type TaxQuoteResponse = {
213
241
  id: string;
214
242
  totalAmount: number;
package/dist/types.d.ts CHANGED
@@ -2,18 +2,13 @@ export type SpotflowProps = {
2
2
  rdtCode?: string;
3
3
  merchantKey: string;
4
4
  encryptionKey: string;
5
- planId: string;
6
- regionId?: string;
5
+ planId?: string;
7
6
  email: string;
8
7
  name?: string;
9
8
  phoneNumber?: string;
10
- code: string;
11
9
  amount?: number;
12
10
  currency?: string;
13
- onSuccess?: (_val?: any) => void;
14
- onClose?: () => void;
15
11
  reference?: string;
16
- onTransferConfirmationPending?: (_val?: any) => void;
17
12
  callBackUrl?: string;
18
13
  metadata?: Record<string, unknown>;
19
14
  localCurrency?: string;
@@ -28,6 +23,7 @@ export type RegionDetail = {
28
23
  cardTypes: string[];
29
24
  allowsZeros: boolean;
30
25
  icon: string;
26
+ language: string;
31
27
  };
32
28
  export type CustomerDetails = {
33
29
  email: string;
@@ -6,6 +6,7 @@ export declare const currencyNameMap: {
6
6
  ZAF: string;
7
7
  USDT: string;
8
8
  KSH: string;
9
+ EGP: string;
9
10
  };
10
11
  export declare enum CurrencyEnum {
11
12
  NGN = "NGN",
@@ -14,5 +15,7 @@ export declare enum CurrencyEnum {
14
15
  GBP = "GBP",
15
16
  ZAF = "ZAF",
16
17
  USDT = "USDT",
17
- KSH = "KSH"
18
+ KSH = "KSH",
19
+ EGP = "EGP"
18
20
  }
21
+ export declare const LANGUAGE_LABELS: Record<string, string>;
@@ -0,0 +1,4 @@
1
+ import { RegionDetail } from '../types';
2
+
3
+ export declare let currentRegion: RegionDetail;
4
+ export declare const getCurrentRegionDetails: (currency: string, countryCode?: string) => RegionDetail | undefined;
package/dist/utils.d.ts CHANGED
@@ -23,3 +23,4 @@ export declare class Toast {
23
23
  static removeToast: (toast: HTMLDivElement) => void;
24
24
  }
25
25
  export declare function getKeyEnvironment(apiKey: string): "test" | "live" | null;
26
+ export declare function hasDuplicates(arr: string[], item: string): boolean;
@@ -8,6 +8,7 @@ type ContactDetails = {
8
8
  type Props = {
9
9
  onAction: (_evt: Event) => (_val: ContactDetails) => void;
10
10
  container: HTMLDivElement;
11
+ translatedTexts: Record<string, string>;
11
12
  };
12
13
  export declare class AvsValidationForm {
13
14
  container: HTMLDivElement;
@@ -15,6 +16,7 @@ export declare class AvsValidationForm {
15
16
  contactDetails: ContactDetails;
16
17
  private countries;
17
18
  private states;
19
+ private translatedTexts;
18
20
  constructor(props: Props);
19
21
  attachListeners(): void;
20
22
  handleInputChange(event: Event, button: HTMLButtonElement | null, stateInput?: HTMLSelectElement): void;
@@ -0,0 +1,22 @@
1
+ import { PaymentResponseData } from '../../types/types';
2
+ import { PageLoader } from '../shared/page-loader';
3
+ import { PaymentWarning } from '../shared/payment-warning';
4
+
5
+ type Props = {
6
+ container: HTMLElement;
7
+ onAction: () => Promise<void>;
8
+ restartTransactionProcess: () => void;
9
+ };
10
+ export declare class OpayAuthenticate {
11
+ container: HTMLElement | Element;
12
+ payment: PaymentResponseData;
13
+ warningError: PaymentWarning;
14
+ pageLoader: PageLoader;
15
+ onAction: () => Promise<void>;
16
+ private restartTransactionProcess;
17
+ constructor(props: Props);
18
+ attachListener(): void;
19
+ renderComponent(): void;
20
+ render(): string;
21
+ }
22
+ export {};
@@ -1,4 +1,5 @@
1
1
  import { TestCard } from './test-card';
2
+ import { PageLoader } from './page-loader';
2
3
 
3
4
  type Props = {
4
5
  container: HTMLDivElement;
@@ -13,6 +14,8 @@ export declare class MainFooter {
13
14
  testCardInstance: TestCard | null;
14
15
  keyEnvironment: string | null;
15
16
  isVisible: boolean;
17
+ mainLoader: PageLoader;
18
+ testCardClicks: number;
16
19
  constructor({ container, testCardContainer, keyEnvironment }: Props);
17
20
  attachListener(): void;
18
21
  renderComponent(): void;
@@ -1,4 +1,5 @@
1
- import { GetMerchantDetailsTax } from '../../types/types';
1
+ import { GetMerchantDetailsTax, Trial } from '../../types/types';
2
+ import { PageLoader } from './page-loader';
2
3
 
3
4
  type Props = {
4
5
  container: HTMLDivElement;
@@ -12,6 +13,9 @@ type Props = {
12
13
  isMobile: boolean;
13
14
  onClose: (notClosePayment: boolean) => void;
14
15
  currentPaymentMethod: string;
16
+ trialAmount?: string;
17
+ trial?: Trial;
18
+ countryCode?: string;
15
19
  };
16
20
  export declare class MainHeader {
17
21
  container: HTMLDivElement;
@@ -20,11 +24,15 @@ export declare class MainHeader {
20
24
  metadata?: Record<string, unknown>;
21
25
  currency: string;
22
26
  localCurrency?: string;
27
+ mainLoader: PageLoader;
28
+ trialAmount?: string;
29
+ trial?: Trial;
23
30
  merchantDetail: GetMerchantDetailsTax;
24
31
  onAction: (_val: string) => void;
25
32
  isMobile: boolean;
26
33
  onClose: (notClosePayment: boolean) => void;
27
34
  currentPaymentMethod: string;
35
+ countryCode?: string;
28
36
  constructor(props: Props);
29
37
  attachListeners(): void;
30
38
  renderComponent(): void;
@@ -6,8 +6,11 @@ import { MainHeader } from './main-header';
6
6
  import { MainFooter } from './main-footer';
7
7
  import { default as MobileMoney } from '../../modules/MobileMoney';
8
8
  import { default as Eft } from '../../modules/EFT';
9
+ import { default as Stablecoins } from '../../modules/Stablecoins';
9
10
  import { TestCard } from './test-card';
10
11
  import { CustomerDetails } from '../../types';
12
+ import { PageLoader } from './page-loader';
13
+ import { default as Opay } from '../../modules/Opay';
11
14
 
12
15
  type Props = {
13
16
  container: HTMLDivElement;
@@ -18,7 +21,6 @@ type Props = {
18
21
  planId?: string;
19
22
  rdtCode?: string;
20
23
  url?: string;
21
- code: string;
22
24
  reference: string;
23
25
  callBackUrl: string;
24
26
  metadata: Record<string, unknown>;
@@ -46,11 +48,12 @@ export declare class MainPageScreen {
46
48
  ussd: Ussd;
47
49
  mobileMoney: MobileMoney;
48
50
  eft: Eft;
51
+ opay: Opay;
52
+ stablecoins: Stablecoins;
49
53
  encryption: string;
50
54
  merchantKey: string;
51
55
  planId: string;
52
56
  customerDetails: CustomerDetails;
53
- code: string;
54
57
  amount: number;
55
58
  rdtCode?: string;
56
59
  url?: string;
@@ -63,8 +66,10 @@ export declare class MainPageScreen {
63
66
  retryingPayment: boolean;
64
67
  totalAmount: number;
65
68
  countryCode?: string;
69
+ mainLoader: PageLoader;
66
70
  mode?: "test" | "live";
67
- constructor({ container, customerDetails, code, encryption, merchantKey, modalContainer, amount, planId, rdtCode, url, reference, callBackUrl, metadata, localCurrency, closePayment, countryCode, mode, }: Props);
71
+ selectedMethods: Array<string>;
72
+ constructor({ container, customerDetails, encryption, merchantKey, modalContainer, amount, planId, rdtCode, url, reference, callBackUrl, metadata, localCurrency, closePayment, countryCode, mode, }: Props);
68
73
  mountScreen(values: GetMerchantDetailsTax, currency: string, validChannels: Array<string>, disabledChannels: Array<string>): void;
69
74
  private setupPaymentMethodButtons;
70
75
  attachListeners(): void;
@@ -75,6 +80,8 @@ export declare class MainPageScreen {
75
80
  setToDefaultEmptyContainer(): void;
76
81
  defaultToEmptyContainer(): void;
77
82
  switchTab(tabName: string): void;
83
+ private renderingPaymentMethodDetails;
84
+ renderTranslatedText(tabName: string): Promise<void>;
78
85
  disablePaymentMethods(name: string): void;
79
86
  enablePaymentMethods(): void;
80
87
  hidePaymentMethods(): void;
@@ -1,3 +1,5 @@
1
+ import { PageLoader } from './page-loader';
2
+
1
3
  type Props = {
2
4
  container: HTMLDivElement;
3
5
  closeCallback: () => void;
@@ -5,9 +7,11 @@ type Props = {
5
7
  export declare class TestCard {
6
8
  container: HTMLDivElement;
7
9
  closeCallback: () => void;
10
+ mainLoader: PageLoader;
8
11
  constructor({ container, closeCallback }: Props);
9
12
  render(): string;
10
13
  attachListener(): void;
11
- renderComponent(): void;
14
+ renderComponent(clicks: number): void;
15
+ renderTranslatedText(): Promise<void>;
12
16
  }
13
17
  export {};
@@ -0,0 +1,28 @@
1
+ import { PaymentResponseData } from '../../types/types';
2
+
3
+ type Props = {
4
+ container: HTMLDivElement;
5
+ onAction: (_val: number) => void;
6
+ ref: string;
7
+ token: string;
8
+ rdtCode?: string;
9
+ url?: string;
10
+ onSuccess: (_val: any) => void;
11
+ callBackUrl: string;
12
+ paymentResponse: PaymentResponseData;
13
+ paymentResponseHeaders: Headers;
14
+ paymentMethod: string;
15
+ };
16
+ export declare class StablecoinsConfirmationEnd {
17
+ container: HTMLDivElement;
18
+ onAction: (_val: number) => void;
19
+ private callBackUrl;
20
+ private paymentResponse;
21
+ private paymentResponseHeaders;
22
+ paymentMethod: string;
23
+ constructor(props: Props);
24
+ attachListeners(): void;
25
+ renderComponent(): void;
26
+ render(): string;
27
+ }
28
+ export {};
@@ -12,7 +12,7 @@ type Props = {
12
12
  callBackUrl: string;
13
13
  setPaymentResponses: (data: PaymentResponseData, headers: Headers) => void;
14
14
  };
15
- export declare class ConfirmationProgress {
15
+ export declare class StablecoinsConfirmationProgress {
16
16
  container: HTMLDivElement;
17
17
  onAction: (_val: number) => void;
18
18
  private onSuccess;
@@ -29,7 +29,7 @@ export declare class ConfirmationProgress {
29
29
  setPaymentResponses: (data: PaymentResponseData, headers: Headers) => void;
30
30
  constructor(props: Props);
31
31
  attachListeners(): void;
32
- verifyCardPayment(token: string, initialInterval: number, onSuccess: (data: PaymentAPIResponse) => void, onError: (data: PaymentAPIResponse) => void): Promise<void>;
32
+ verifyStablecoins(token: string, initialInterval: number, onSuccess: (data: PaymentAPIResponse) => void, onError: (data: PaymentAPIResponse) => void): Promise<void>;
33
33
  private redirectTo;
34
34
  private startTimer;
35
35
  private stopTimer;
@@ -0,0 +1,74 @@
1
+ import { CustomerDetails } from '../../types';
2
+ import { PaymentResponseData } from '../../types/types';
3
+ import { PageLoader } from '../shared/page-loader';
4
+ import { PaymentWarning } from '../shared/payment-warning';
5
+
6
+ type Props = {
7
+ container: HTMLElement;
8
+ onAction: (value: {
9
+ chain: string;
10
+ asset: string;
11
+ }) => void;
12
+ onVerify: () => Promise<void>;
13
+ restartTransactionProcess: () => void;
14
+ merchantKey: string;
15
+ rdtCode?: string;
16
+ url?: string;
17
+ amount: number;
18
+ currency: string;
19
+ paymentResponse: PaymentResponseData;
20
+ customer: CustomerDetails;
21
+ totalAmount: number;
22
+ retryingPayment: boolean;
23
+ token: string;
24
+ reference: string;
25
+ metadata: Record<string, unknown>;
26
+ callBackUrl: string;
27
+ localCurrency: string;
28
+ onStepChange?: (step: number) => void;
29
+ };
30
+ export declare class StablecoinsForm {
31
+ container: HTMLElement | Element;
32
+ warningError: PaymentWarning;
33
+ pageLoader: PageLoader;
34
+ onAction: (value: {
35
+ chain: string;
36
+ asset: string;
37
+ }) => void;
38
+ onVerify: () => Promise<void>;
39
+ private restartTransactionProcess;
40
+ private chainsList;
41
+ private assetList;
42
+ private merchantKey;
43
+ private _currentStep;
44
+ private rdtCode?;
45
+ private url?;
46
+ private amount;
47
+ private customer;
48
+ private warningScreen;
49
+ private merchantPlanDetail;
50
+ private metadata;
51
+ private callBackUrl;
52
+ private reference;
53
+ private token;
54
+ private currency;
55
+ private paymentResponse;
56
+ private localCurrency;
57
+ private onStepChange?;
58
+ private retryingPayment;
59
+ isMaxRetriesReached: boolean;
60
+ errorText: string;
61
+ private populateSelect;
62
+ constructor(props: Props);
63
+ get currentStep(): number;
64
+ set currentStep(step: number);
65
+ copyToClipboard(text: string, element: Element): void;
66
+ attachListener(): void;
67
+ createStablecoinPayment(values: {
68
+ asset: string;
69
+ chain: string;
70
+ }): Promise<void>;
71
+ renderComponent(): void;
72
+ render(): string;
73
+ }
74
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spot-flow/checkout-inline-js",
3
- "version": "0.2.0",
3
+ "version": "0.2.1-dev.1",
4
4
  "description": "",
5
5
  "main": "dist/checkout-inline.js",
6
6
  "module": "dist/checkout-inline.es.js",
@@ -1,13 +0,0 @@
1
- type Props = {
2
- container: HTMLDivElement;
3
- onAction: (_val: number) => void;
4
- };
5
- export declare class TransferConfirmatioOne {
6
- container: HTMLDivElement;
7
- onAction: (_val: number) => void;
8
- constructor(props: Props);
9
- attachListeners(): void;
10
- renderComponent(): void;
11
- render(): string;
12
- }
13
- export {};
@@ -1,15 +0,0 @@
1
- type Props = {
2
- container: HTMLDivElement;
3
- onClose: () => void;
4
- onAction: (_val: number) => void;
5
- };
6
- export declare class TransferConfirmationTwo {
7
- container: HTMLDivElement;
8
- onClose: () => void;
9
- onAction: (_val: number) => void;
10
- constructor(props: Props);
11
- attachListeners(): void;
12
- renderComponent(): void;
13
- render(): string;
14
- }
15
- export {};