@coinflowlabs/react 4.1.3 → 4.2.2

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 (44) hide show
  1. package/build/cjs/card-form/CoinflowCardForm.d.ts +138 -0
  2. package/build/cjs/card-form/CoinflowCardForm.js +177 -0
  3. package/build/cjs/card-form/CoinflowCardForm.js.map +1 -0
  4. package/build/cjs/card-form/TokenEx.d.ts +106 -0
  5. package/build/cjs/card-form/TokenEx.js +4 -0
  6. package/build/cjs/card-form/TokenEx.js.map +1 -0
  7. package/build/cjs/card-form/useCardFormIframe.d.ts +99 -0
  8. package/build/cjs/card-form/useCardFormIframe.js +191 -0
  9. package/build/cjs/card-form/useCardFormIframe.js.map +1 -0
  10. package/build/cjs/common/CoinflowTypes.d.ts +25 -1
  11. package/build/cjs/common/CoinflowTypes.js +8 -1
  12. package/build/cjs/common/CoinflowTypes.js.map +1 -1
  13. package/build/cjs/common/CoinflowUtils.d.ts +1 -1
  14. package/build/cjs/common/CoinflowUtils.js +3 -1
  15. package/build/cjs/common/CoinflowUtils.js.map +1 -1
  16. package/build/cjs/index.d.ts +1 -1
  17. package/build/cjs/index.js +1 -1
  18. package/build/cjs/index.js.map +1 -1
  19. package/build/esm/card-form/CoinflowCardForm.d.ts +138 -0
  20. package/build/esm/card-form/CoinflowCardForm.js +173 -0
  21. package/build/esm/card-form/CoinflowCardForm.js.map +1 -0
  22. package/build/esm/card-form/TokenEx.d.ts +106 -0
  23. package/build/esm/card-form/TokenEx.js +3 -0
  24. package/build/esm/card-form/TokenEx.js.map +1 -0
  25. package/build/esm/card-form/useCardFormIframe.d.ts +99 -0
  26. package/build/esm/card-form/useCardFormIframe.js +187 -0
  27. package/build/esm/card-form/useCardFormIframe.js.map +1 -0
  28. package/build/esm/common/CoinflowTypes.d.ts +25 -1
  29. package/build/esm/common/CoinflowTypes.js +7 -0
  30. package/build/esm/common/CoinflowTypes.js.map +1 -1
  31. package/build/esm/common/CoinflowUtils.d.ts +1 -1
  32. package/build/esm/common/CoinflowUtils.js +3 -1
  33. package/build/esm/common/CoinflowUtils.js.map +1 -1
  34. package/build/esm/index.d.ts +1 -1
  35. package/build/esm/index.js +1 -1
  36. package/build/esm/index.js.map +1 -1
  37. package/build/tsconfig.tsbuildinfo +1 -1
  38. package/package.json +1 -1
  39. package/build/cjs/CoinflowCardForm.d.ts +0 -39
  40. package/build/cjs/CoinflowCardForm.js +0 -100
  41. package/build/cjs/CoinflowCardForm.js.map +0 -1
  42. package/build/esm/CoinflowCardForm.d.ts +0 -39
  43. package/build/esm/CoinflowCardForm.js +0 -97
  44. package/build/esm/CoinflowCardForm.js.map +0 -1
@@ -0,0 +1,173 @@
1
+ import { __awaiter, __generator } from "tslib";
2
+ import React, { forwardRef, useEffect, useImperativeHandle } from 'react';
3
+ import { TokenExCardNumberIframeId, TokenExCvvContainerID, useCardFormIframe, } from './useCardFormIframe';
4
+ /**
5
+ * Allows merchants to collect card information from their customers in a PCI-compliant way and receive the tokenized card number.
6
+ *
7
+ * Usage:
8
+ * ```tsx
9
+ * const ref = useRef<{getToken(): Promise<{token: string}>}>();
10
+ *
11
+ * <CoinflowCardNumberInput
12
+ * ref={ref}
13
+ * env={'sandbox'}
14
+ * debug={true}
15
+ * css={{
16
+ * base: 'font-family: Arial, sans-serif;padding: 0 8px;border: 1px solid rgba(0, 0, 0, 0.2);margin: 0;width: 100%;font-size: 13px;line-height: 30px;height: 32px;box-sizing: border-box;-moz-box-sizing: border-box;',
17
+ * focus:
18
+ * 'box-shadow: 0 0 6px 0 rgba(0, 132, 255, 0.5);border: 1px solid rgba(0, 132, 255, 0.5);outline: 0;',
19
+ * error:
20
+ * 'box-shadow: 0 0 6px 0 rgba(224, 57, 57, 0.5);border: 1px solid rgba(224, 57, 57, 0.5);',
21
+ * cvv: {
22
+ * base: 'font-family: Arial, sans-serif;padding: 0 8px;border: 1px solid rgba(0, 0, 0, 0.2);margin: 0;width: 100%;font-size: 13px;line-height: 30px;height: 32px;box-sizing: border-box;-moz-box-sizing: border-box;',
23
+ * focus:
24
+ * 'box-shadow: 0 0 6px 0 rgba(0, 132, 255, 0.5);border: 1px solid rgba(0, 132, 255, 0.5);outline: 0;',
25
+ * error:
26
+ * 'box-shadow: 0 0 6px 0 rgba(224, 57, 57, 0.5);border: 1px solid rgba(224, 57, 57, 0.5);',
27
+ * },
28
+ * }}
29
+ * />
30
+ * <CoinflowCvvInput />
31
+ *
32
+ * <button onClick={() => {
33
+ * ref.current?.getToken()
34
+ * .then(({token}) => console.log(token))
35
+ * .catch(e => console.error('GET TOKEN ERROR', e))
36
+ * }}>Get Token</button>
37
+ *
38
+ * ```
39
+ */
40
+ export var CoinflowCardNumberInput = forwardRef(function (props, ref) {
41
+ var _a = useCardFormIframe(props.env), tokenExIframe = _a.tokenExIframe, initializeTokenExIframe = _a.initializeTokenExIframe;
42
+ useImperativeHandle(ref, function () { return ({
43
+ getToken: function () {
44
+ return __awaiter(this, void 0, void 0, function () {
45
+ return __generator(this, function (_a) {
46
+ if (!tokenExIframe)
47
+ throw new Error('Unable to get token');
48
+ return [2 /*return*/, tokenExIframe.tokenize()];
49
+ });
50
+ });
51
+ },
52
+ }); });
53
+ useEffect(function () {
54
+ initializeTokenExIframe(props);
55
+ }, [initializeTokenExIframe, props]);
56
+ return React.createElement("div", { id: TokenExCardNumberIframeId });
57
+ });
58
+ /**
59
+ * The CVV number input for creating a new tokenized card
60
+ */
61
+ export function CoinflowCvvInput() {
62
+ return React.createElement("div", { id: TokenExCvvContainerID });
63
+ }
64
+ /**
65
+ * Allows merchants to collect the CVV for an already tokenized card in a PCI-compliant way and receive the token with the CVV linked.
66
+ *
67
+ * Usage:
68
+ * ```tsx
69
+ * const ref = useRef<{getToken(): Promise<{token: string}>}>();
70
+ *
71
+ * <CoinflowCvvOnlyInput
72
+ * ref={ref}
73
+ * cardType={'visa'}
74
+ * token={'411111YJM5TX1111'}
75
+ * env={'sandbox'}
76
+ * debug={true}
77
+ * css={{
78
+ * base: 'font-family: Arial, sans-serif;padding: 0 8px;border: 1px solid rgba(0, 0, 0, 0.2);margin: 0;width: 100%;font-size: 13px;line-height: 30px;height: 32px;box-sizing: border-box;-moz-box-sizing: border-box;',
79
+ * focus:
80
+ * 'box-shadow: 0 0 6px 0 rgba(0, 132, 255, 0.5);border: 1px solid rgba(0, 132, 255, 0.5);outline: 0;',
81
+ * error:
82
+ * 'box-shadow: 0 0 6px 0 rgba(224, 57, 57, 0.5);border: 1px solid rgba(224, 57, 57, 0.5);',
83
+ * cvv: {
84
+ * base: 'font-family: Arial, sans-serif;padding: 0 8px;border: 1px solid rgba(0, 0, 0, 0.2);margin: 0;width: 100%;font-size: 13px;line-height: 30px;height: 32px;box-sizing: border-box;-moz-box-sizing: border-box;',
85
+ * focus:
86
+ * 'box-shadow: 0 0 6px 0 rgba(0, 132, 255, 0.5);border: 1px solid rgba(0, 132, 255, 0.5);outline: 0;',
87
+ * error:
88
+ * 'box-shadow: 0 0 6px 0 rgba(224, 57, 57, 0.5);border: 1px solid rgba(224, 57, 57, 0.5);',
89
+ * },
90
+ * }}
91
+ * />
92
+ *
93
+ * <button onClick={() => {
94
+ * ref.current?.getToken()
95
+ * .then(({token}) => console.log(token))
96
+ * .catch(e => console.error('GET TOKEN ERROR', e))
97
+ * }}>Get Token</button>
98
+ *
99
+ * ```
100
+ */
101
+ export var CoinflowCvvOnlyInput = forwardRef(function (props, ref) {
102
+ var _a = useCardFormIframe(props.env), tokenExIframe = _a.tokenExIframe, initializeCvvOnlyTokenExIframe = _a.initializeCvvOnlyTokenExIframe;
103
+ useImperativeHandle(ref, function () { return ({
104
+ getToken: function () {
105
+ return __awaiter(this, void 0, void 0, function () {
106
+ return __generator(this, function (_a) {
107
+ if (!tokenExIframe)
108
+ throw new Error('Unable to get token');
109
+ return [2 /*return*/, tokenExIframe.tokenize()];
110
+ });
111
+ });
112
+ },
113
+ }); });
114
+ useEffect(function () {
115
+ initializeCvvOnlyTokenExIframe(props);
116
+ }, [initializeCvvOnlyTokenExIframe, props]);
117
+ return React.createElement("div", { id: TokenExCvvContainerID });
118
+ });
119
+ /**
120
+ * Allows merchants to collect card information from their customers in a PCI-compliant way and receive the tokenized card number.
121
+ * The `CoinflowCardOnlyInput` is used for collecting a debit card for users to be able to withdraw their funds directly to.
122
+ *
123
+ * Usage:
124
+ * ```tsx
125
+ * const ref = useRef<{getToken(): Promise<{token: string}>}>();
126
+ *
127
+ * <CoinflowCardOnlyInput
128
+ * ref={ref}
129
+ * env={'sandbox'}
130
+ * debug={true}
131
+ * css={{
132
+ * base: 'font-family: Arial, sans-serif;padding: 0 8px;border: 1px solid rgba(0, 0, 0, 0.2);margin: 0;width: 100%;font-size: 13px;line-height: 30px;height: 32px;box-sizing: border-box;-moz-box-sizing: border-box;',
133
+ * focus:
134
+ * 'box-shadow: 0 0 6px 0 rgba(0, 132, 255, 0.5);border: 1px solid rgba(0, 132, 255, 0.5);outline: 0;',
135
+ * error:
136
+ * 'box-shadow: 0 0 6px 0 rgba(224, 57, 57, 0.5);border: 1px solid rgba(224, 57, 57, 0.5);',
137
+ * cvv: {
138
+ * base: 'font-family: Arial, sans-serif;padding: 0 8px;border: 1px solid rgba(0, 0, 0, 0.2);margin: 0;width: 100%;font-size: 13px;line-height: 30px;height: 32px;box-sizing: border-box;-moz-box-sizing: border-box;',
139
+ * focus:
140
+ * 'box-shadow: 0 0 6px 0 rgba(0, 132, 255, 0.5);border: 1px solid rgba(0, 132, 255, 0.5);outline: 0;',
141
+ * error:
142
+ * 'box-shadow: 0 0 6px 0 rgba(224, 57, 57, 0.5);border: 1px solid rgba(224, 57, 57, 0.5);',
143
+ * },
144
+ * }}
145
+ * />
146
+ *
147
+ * <button onClick={() => {
148
+ * ref.current?.getToken()
149
+ * .then(({token}) => console.log(token))
150
+ * .catch(e => console.error('GET TOKEN ERROR', e))
151
+ * }}>Get Token</button>
152
+ *
153
+ * ```
154
+ */
155
+ export var CoinflowCardOnlyInput = forwardRef(function (props, ref) {
156
+ var _a = useCardFormIframe(props.env), tokenExIframe = _a.tokenExIframe, initializeTokenExCardOnlyIframe = _a.initializeTokenExCardOnlyIframe;
157
+ useImperativeHandle(ref, function () { return ({
158
+ getToken: function () {
159
+ return __awaiter(this, void 0, void 0, function () {
160
+ return __generator(this, function (_a) {
161
+ if (!tokenExIframe)
162
+ throw new Error('Unable to get token');
163
+ return [2 /*return*/, tokenExIframe.tokenize()];
164
+ });
165
+ });
166
+ },
167
+ }); });
168
+ useEffect(function () {
169
+ initializeTokenExCardOnlyIframe(props);
170
+ }, [initializeTokenExCardOnlyIframe, props]);
171
+ return React.createElement("div", { id: TokenExCardNumberIframeId });
172
+ });
173
+ //# sourceMappingURL=CoinflowCardForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CoinflowCardForm.js","sourceRoot":"","sources":["../../../src/card-form/CoinflowCardForm.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAC,UAAU,EAAE,SAAS,EAAE,mBAAmB,EAAC,MAAM,OAAO,CAAC;AAExE,OAAO,EAEL,yBAAyB,EACzB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,qBAAqB,CAAC;AAoB7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,CAAC,IAAM,uBAAuB,GAAG,UAAU,CAC/C,UAAC,KAAmC,EAAE,GAAG;IACjC,IAAA,KAA2C,iBAAiB,CAChE,KAAK,CAAC,GAAG,CACV,EAFM,aAAa,mBAAA,EAAE,uBAAuB,6BAE5C,CAAC;IAEF,mBAAmB,CAAC,GAAG,EAAE,cAAM,OAAA,CAAC;QACxB,QAAQ;;;oBACZ,IAAI,CAAC,aAAa;wBAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;oBAC3D,sBAAO,aAAa,CAAC,QAAQ,EAAE,EAAC;;;SACjC;KACF,CAAC,EAL6B,CAK7B,CAAC,CAAC;IAEJ,SAAS,CAAC;QACR,uBAAuB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Q;;;oBACZ,IAAI,CAAC,aAAa;wBAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;oBAC3D,sBAAO,aAAa,CAAC,QAAQ,EAAE,EAAC;;;SACjC;KACF,CAAC,EAL6B,CAK7B,CAAC,CAAC;IAEJ,SAAS,CAAC;QACR,+BAA+B,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC,EAAE,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC,CAAC;IAE7C,OAAO,6BAAK,EAAE,EAAE,yBAAyB,GAAQ,CAAC;AACpD,CAAC,CACF,CAAC"}
@@ -0,0 +1,106 @@
1
+ export interface TokenizationResponse {
2
+ cardType: string;
3
+ cvvIncluded: true;
4
+ firstSix: string;
5
+ lastFour: string;
6
+ referenceNumber: string;
7
+ token: string;
8
+ tokenHMAC: string;
9
+ }
10
+ declare global {
11
+ namespace TokenEx {
12
+ interface FraudServicesConfig {
13
+ useKount?: boolean;
14
+ kount?: {
15
+ merchantId?: string;
16
+ mode?: string;
17
+ anId?: string;
18
+ };
19
+ }
20
+ interface Config {
21
+ debug?: boolean;
22
+ enablePrettyFormat?: boolean;
23
+ maskInput?: boolean;
24
+ enableValidateOnBlur?: boolean;
25
+ enableAriaRequired?: boolean;
26
+ pci?: boolean;
27
+ cvvOnly?: boolean;
28
+ allowUnknownCardTypes?: boolean;
29
+ enableAutoComplete?: boolean;
30
+ returnAutoCompleteValues?: boolean;
31
+ returnKhash?: boolean;
32
+ returnWhash?: boolean;
33
+ enforceLuhnCompliance?: boolean;
34
+ use3DS?: boolean;
35
+ validateOnKeyUp?: boolean;
36
+ validateOnCvvKeyUp?: boolean;
37
+ expiresInSeconds?: number;
38
+ useExtendedBIN?: boolean;
39
+ inlineIframeJavaScript?: boolean;
40
+ iframeVersion?: number;
41
+ authenticationKey?: string;
42
+ origin?: string;
43
+ tokenExID?: string;
44
+ timestamp?: string;
45
+ tokenScheme?: string;
46
+ token?: string;
47
+ customDataLabel?: string;
48
+ customCvvDataLabel?: string;
49
+ title?: string;
50
+ cvvTitle?: string;
51
+ inputTitle?: string;
52
+ cvvInputTitle?: string;
53
+ cardMaxLengths?: {
54
+ visa?: number;
55
+ mastercard?: number;
56
+ americanExpress?: number;
57
+ discover?: number;
58
+ jcb?: number;
59
+ diners?: number;
60
+ };
61
+ fraudServices?: FraudServicesConfig;
62
+ threeDSMethodNotificationUrl?: string;
63
+ customDataTypes?: string | object;
64
+ cvvContainerID?: string;
65
+ cvvPlaceholder?: string;
66
+ cardType?: string;
67
+ forterSiteId?: string;
68
+ forterUsername?: string;
69
+ customRegEx?: string;
70
+ placeholder?: string;
71
+ inputType?: string;
72
+ inputMode?: string;
73
+ font?: string;
74
+ cvv?: boolean;
75
+ styles: {
76
+ base: string;
77
+ focus: string;
78
+ error: string;
79
+ cvv: {
80
+ base: string;
81
+ focus: string;
82
+ error: string;
83
+ };
84
+ };
85
+ }
86
+ interface IframeAPI {
87
+ load(): void;
88
+ on: (event: string, callback: (data?: any) => void) => void;
89
+ tokenize(): void;
90
+ validate(): void;
91
+ reset(): void;
92
+ blur(): void;
93
+ cvvBlur(): void;
94
+ focus(): void;
95
+ cvvFocus(): void;
96
+ remove(): void;
97
+ toggleMask(): void;
98
+ toggleCvvMask(): void;
99
+ setPAN(pan: string): void;
100
+ binLookup(): void;
101
+ validateConfig(): void;
102
+ setFraudServicesRequestDetails(data: string): void;
103
+ }
104
+ function Iframe(containerID: string, configuration: Config): IframeAPI;
105
+ }
106
+ }
@@ -0,0 +1,3 @@
1
+ // Type definitions for TokenEx iframe integration
2
+ export {};
3
+ //# sourceMappingURL=TokenEx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TokenEx.js","sourceRoot":"","sources":["../../../src/card-form/TokenEx.ts"],"names":[],"mappings":"AAAA,kDAAkD"}
@@ -0,0 +1,99 @@
1
+ import { CSSProperties } from 'react';
2
+ import { CardType, CoinflowEnvs } from '../common';
3
+ import { TokenizationResponse } from './TokenEx';
4
+ export declare const TokenExCardNumberIframeId = "tokenExCardNumber";
5
+ export declare const TokenExCvvContainerID = "tokenExCardCvv";
6
+ export interface TokenExIframe extends ReturnType<typeof TokenEx.Iframe> {
7
+ tokenize: () => Promise<TokenizationResponse>;
8
+ }
9
+ export interface TokenExIFrameConfiguration {
10
+ origin: string;
11
+ timestamp: string;
12
+ tokenExID: string;
13
+ tokenScheme: string;
14
+ authenticationKey: string;
15
+ pci: true;
16
+ token?: string;
17
+ }
18
+ export interface CardFormInputStyles {
19
+ base: CSSProperties | string;
20
+ focus?: CSSProperties | string;
21
+ error?: CSSProperties | string;
22
+ }
23
+ export declare function useCardFormIframe(env: CoinflowEnvs): {
24
+ tokenExIframe: TokenExIframe | undefined;
25
+ initializeTokenExIframe: ({ css, fontFamily, debug, }: {
26
+ css: CardFormInputStyles & {
27
+ cvv: CardFormInputStyles;
28
+ };
29
+ fontFamily?: string;
30
+ debug?: boolean;
31
+ }) => Promise<{
32
+ tokenize: () => Promise<TokenizationResponse>;
33
+ load(): void;
34
+ on: (event: string, callback: (data?: any) => void) => void;
35
+ validate(): void;
36
+ reset(): void;
37
+ blur(): void;
38
+ cvvBlur(): void;
39
+ focus(): void;
40
+ cvvFocus(): void;
41
+ remove(): void;
42
+ toggleMask(): void;
43
+ toggleCvvMask(): void;
44
+ setPAN(pan: string): void;
45
+ binLookup(): void;
46
+ validateConfig(): void;
47
+ setFraudServicesRequestDetails(data: string): void;
48
+ }>;
49
+ initializeCvvOnlyTokenExIframe: ({ token, cardType, css, debug, fontFamily, }: {
50
+ token: string;
51
+ cardType: CardType;
52
+ css: CardFormInputStyles & {
53
+ cvv: CardFormInputStyles;
54
+ };
55
+ debug?: boolean;
56
+ fontFamily?: string;
57
+ }) => Promise<{
58
+ tokenize: () => Promise<TokenizationResponse>;
59
+ load(): void;
60
+ on: (event: string, callback: (data?: any) => void) => void;
61
+ validate(): void;
62
+ reset(): void;
63
+ blur(): void;
64
+ cvvBlur(): void;
65
+ focus(): void;
66
+ cvvFocus(): void;
67
+ remove(): void;
68
+ toggleMask(): void;
69
+ toggleCvvMask(): void;
70
+ setPAN(pan: string): void;
71
+ binLookup(): void;
72
+ validateConfig(): void;
73
+ setFraudServicesRequestDetails(data: string): void;
74
+ }>;
75
+ initializeTokenExCardOnlyIframe: ({ css, fontFamily, debug, }: {
76
+ css: CardFormInputStyles;
77
+ fontFamily?: string;
78
+ debug?: boolean;
79
+ }) => Promise<{
80
+ tokenize: () => Promise<TokenizationResponse>;
81
+ load(): void;
82
+ on: (event: string, callback: (data?: any) => void) => void;
83
+ validate(): void;
84
+ reset(): void;
85
+ blur(): void;
86
+ cvvBlur(): void;
87
+ focus(): void;
88
+ cvvFocus(): void;
89
+ remove(): void;
90
+ toggleMask(): void;
91
+ toggleCvvMask(): void;
92
+ setPAN(pan: string): void;
93
+ binLookup(): void;
94
+ validateConfig(): void;
95
+ setFraudServicesRequestDetails(data: string): void;
96
+ }>;
97
+ loaded: boolean;
98
+ cachedToken: string | undefined;
99
+ };
@@ -0,0 +1,187 @@
1
+ var _a;
2
+ import { __assign, __awaiter, __generator } from "tslib";
3
+ import { useCallback, useEffect, useState } from 'react';
4
+ import { CardType, CoinflowUtils } from '../common';
5
+ export var TokenExCardNumberIframeId = 'tokenExCardNumber';
6
+ export var TokenExCvvContainerID = 'tokenExCardCvv';
7
+ var CARD_TYPE_MAPPING = (_a = {},
8
+ _a[CardType.VISA] = 'visa',
9
+ _a[CardType.MASTERCARD] = 'masterCard',
10
+ _a[CardType.AMEX] = 'americanExpress',
11
+ _a[CardType.DISCOVER] = 'discover',
12
+ _a);
13
+ export function useCardFormIframe(env) {
14
+ var _this = this;
15
+ var _a = useState(false), loaded = _a[0], setLoaded = _a[1];
16
+ var _b = useState(undefined), tokenExIframe = _b[0], setTokenExIframe = _b[1];
17
+ var _c = useState(undefined), cachedToken = _c[0], setCachedToken = _c[1];
18
+ var getIframeConfig = useCallback(function (_a) {
19
+ var token = _a.token;
20
+ return fetch(new CoinflowUtils(env).url + '/api/checkout/authentication-key', {
21
+ method: 'POST',
22
+ headers: {
23
+ 'Content-Type': 'application/json',
24
+ },
25
+ body: JSON.stringify({
26
+ origins: [window.location.origin],
27
+ token: token,
28
+ }),
29
+ }).then(function (res) { return __awaiter(_this, void 0, void 0, function () {
30
+ return __generator(this, function (_a) {
31
+ switch (_a.label) {
32
+ case 0: return [4 /*yield*/, res.json()];
33
+ case 1: return [2 /*return*/, (_a.sent())];
34
+ }
35
+ });
36
+ }); });
37
+ }, [env]);
38
+ var getStylesAndFont = useCallback(function (css) {
39
+ var _a, _b, _c;
40
+ var styles = {
41
+ base: CSSPropertiesToComponent(css.base),
42
+ focus: CSSPropertiesToComponent(css.focus),
43
+ error: CSSPropertiesToComponent(css.error),
44
+ cvv: {
45
+ base: CSSPropertiesToComponent((_a = css.cvv) === null || _a === void 0 ? void 0 : _a.base),
46
+ focus: CSSPropertiesToComponent((_b = css.cvv) === null || _b === void 0 ? void 0 : _b.focus),
47
+ error: CSSPropertiesToComponent((_c = css.cvv) === null || _c === void 0 ? void 0 : _c.error),
48
+ },
49
+ };
50
+ return { styles: styles };
51
+ }, []);
52
+ var setTokenExScriptTag = useCallback(function () {
53
+ var scriptTagId = 'tokenex-script';
54
+ if (document.head.querySelector("#".concat(scriptTagId)))
55
+ return;
56
+ var sdkScriptTag = document.createElement('script');
57
+ sdkScriptTag.src =
58
+ env === 'prod'
59
+ ? 'https://htp.tokenex.com/iframe/iframe-v3.min.js'
60
+ : 'https://test-htp.tokenex.com/iframe/iframe-v3.min.js';
61
+ sdkScriptTag.id = scriptTagId;
62
+ document.head.appendChild(sdkScriptTag);
63
+ }, [env]);
64
+ useEffect(function () {
65
+ setTokenExScriptTag();
66
+ }, [setTokenExScriptTag]);
67
+ var loadIframe = useCallback(function (iframe) {
68
+ var tokenize = function () { return __awaiter(_this, void 0, void 0, function () {
69
+ return __generator(this, function (_a) {
70
+ switch (_a.label) {
71
+ case 0:
72
+ iframe.tokenize();
73
+ return [4 /*yield*/, new Promise(function (resolve, reject) {
74
+ iframe.on('tokenize', function (data) {
75
+ setCachedToken(data.token);
76
+ resolve(data);
77
+ });
78
+ iframe.on('validate', function (data) {
79
+ // noinspection PointlessBooleanExpressionJS
80
+ var isInvalid = !data.isValid || data.isCvvValid === false;
81
+ if (isInvalid)
82
+ reject(data);
83
+ });
84
+ })];
85
+ case 1: return [2 /*return*/, _a.sent()];
86
+ }
87
+ });
88
+ }); };
89
+ iframe.on('change', function () { return setCachedToken(undefined); });
90
+ iframe.on('cvvChange', function () { return setCachedToken(undefined); });
91
+ iframe.on('load', function () {
92
+ setTimeout(function () { return setLoaded(true); }, 350);
93
+ var el = document.querySelector('#tx_iframe_tokenExCardNumber');
94
+ if (el)
95
+ el.scrolling = 'no';
96
+ });
97
+ setLoaded(false);
98
+ iframe.load();
99
+ var overriden = __assign(__assign({}, iframe), { tokenize: tokenize });
100
+ setTokenExIframe(overriden);
101
+ return overriden;
102
+ }, []);
103
+ var initializeCvvOnlyTokenExIframe = useCallback(function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
104
+ var type, iframeConfig, styles, config, iframe;
105
+ var token = _b.token, cardType = _b.cardType, css = _b.css, debug = _b.debug, fontFamily = _b.fontFamily;
106
+ return __generator(this, function (_c) {
107
+ switch (_c.label) {
108
+ case 0:
109
+ type = CARD_TYPE_MAPPING[cardType];
110
+ return [4 /*yield*/, getIframeConfig({ token: token })];
111
+ case 1:
112
+ iframeConfig = _c.sent();
113
+ styles = getStylesAndFont(css).styles;
114
+ config = __assign(__assign({}, iframeConfig), { placeholder: 'CVV', enablePrettyFormat: true, styles: styles, token: token, cvvOnly: true, cvv: true, cvvContainerID: TokenExCvvContainerID, cardType: type, debug: debug !== null && debug !== void 0 ? debug : false, font: fontFamily });
115
+ iframe = TokenEx.Iframe(TokenExCvvContainerID, config);
116
+ return [2 /*return*/, loadIframe(iframe)];
117
+ }
118
+ });
119
+ }); }, [getIframeConfig, getStylesAndFont, loadIframe]);
120
+ var initializeTokenExIframe = useCallback(function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
121
+ var iframeConfig, styles, iframe;
122
+ var css = _b.css, fontFamily = _b.fontFamily, debug = _b.debug;
123
+ return __generator(this, function (_c) {
124
+ switch (_c.label) {
125
+ case 0: return [4 /*yield*/, getIframeConfig({})];
126
+ case 1:
127
+ iframeConfig = _c.sent();
128
+ styles = getStylesAndFont(css).styles;
129
+ iframe = TokenEx.Iframe(TokenExCardNumberIframeId, __assign(__assign({}, iframeConfig), { placeholder: '0000 0000 0000 0000', cvvPlaceholder: 'CVV', enablePrettyFormat: true, cvv: true, cvvContainerID: TokenExCvvContainerID, styles: styles, font: fontFamily, debug: debug !== null && debug !== void 0 ? debug : false }));
130
+ return [2 /*return*/, loadIframe(iframe)];
131
+ }
132
+ });
133
+ }); }, [getIframeConfig, getStylesAndFont, loadIframe]);
134
+ var initializeTokenExCardOnlyIframe = useCallback(function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
135
+ var iframeConfig, styles, iframe;
136
+ var css = _b.css, fontFamily = _b.fontFamily, debug = _b.debug;
137
+ return __generator(this, function (_c) {
138
+ switch (_c.label) {
139
+ case 0: return [4 /*yield*/, getIframeConfig({})];
140
+ case 1:
141
+ iframeConfig = _c.sent();
142
+ styles = getStylesAndFont(css).styles;
143
+ iframe = TokenEx.Iframe(TokenExCardNumberIframeId, __assign(__assign({}, iframeConfig), { placeholder: '0000 0000 0000 0000', enablePrettyFormat: true, cvv: false, styles: styles, font: fontFamily, debug: debug !== null && debug !== void 0 ? debug : false }));
144
+ return [2 /*return*/, loadIframe(iframe)];
145
+ }
146
+ });
147
+ }); }, [getIframeConfig, getStylesAndFont, loadIframe]);
148
+ useEffect(function () {
149
+ if (!tokenExIframe)
150
+ return;
151
+ tokenExIframe.load();
152
+ return function () { return tokenExIframe.remove(); };
153
+ }, [tokenExIframe]);
154
+ return {
155
+ tokenExIframe: tokenExIframe,
156
+ initializeTokenExIframe: initializeTokenExIframe,
157
+ initializeCvvOnlyTokenExIframe: initializeCvvOnlyTokenExIframe,
158
+ initializeTokenExCardOnlyIframe: initializeTokenExCardOnlyIframe,
159
+ loaded: loaded,
160
+ cachedToken: cachedToken,
161
+ };
162
+ }
163
+ function CSSPropertiesToComponent(dict) {
164
+ if (!dict)
165
+ return '';
166
+ if (typeof dict === 'string')
167
+ return dict;
168
+ var str = '';
169
+ var _loop_1 = function (key, value) {
170
+ var clo = '';
171
+ key.split('').forEach(function (lt) {
172
+ if (lt.toUpperCase() === lt) {
173
+ clo += '-' + lt.toLowerCase();
174
+ }
175
+ else {
176
+ clo += lt;
177
+ }
178
+ });
179
+ str += clo + ':' + value + ';';
180
+ };
181
+ for (var _i = 0, _a = Object.entries(dict); _i < _a.length; _i++) {
182
+ var _b = _a[_i], key = _b[0], value = _b[1];
183
+ _loop_1(key, value);
184
+ }
185
+ return str;
186
+ }
187
+ //# sourceMappingURL=useCardFormIframe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCardFormIframe.js","sourceRoot":"","sources":["../../../src/card-form/useCardFormIframe.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAgB,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AACtE,OAAO,EAAC,QAAQ,EAAgB,aAAa,EAAC,MAAM,WAAW,CAAC;AAGhE,MAAM,CAAC,IAAM,yBAAyB,GAAG,mBAAmB,CAAC;AAC7D,MAAM,CAAC,IAAM,qBAAqB,GAAG,gBAAgB,CAAC;AAqBtD,IAAM,iBAAiB;IACrB,GAAC,QAAQ,CAAC,IAAI,IAAG,MAAM;IACvB,GAAC,QAAQ,CAAC,UAAU,IAAG,YAAY;IACnC,GAAC,QAAQ,CAAC,IAAI,IAAG,iBAAiB;IAClC,GAAC,QAAQ,CAAC,QAAQ,IAAG,UAAU;OAChC,CAAC;AAEF,MAAM,UAAU,iBAAiB,CAAC,GAAiB;IAAnD,iBA2NC;IA1NO,IAAA,KAAsB,QAAQ,CAAU,KAAK,CAAC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AAE,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE,CAAC;gBAC5B,GAAG,IAAI,GAAG,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC;YAChC,CAAC;iBAAM,CAAC;gBACN,GAAG,IAAI,EAAE,CAAC;YACZ,CAAC;QACH,CAAC,CAAC,CAAC;QACH,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,KAAK,GAAG,GAAG,CAAC;;IATjC,KAA2B,UAAoB,EAApB,KAAA,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAApB,cAAoB,EAApB,IAAoB;QAApC,IAAA,WAAY,EAAX,GAAG,QAAA,EAAE,KAAK,QAAA;gBAAV,GAAG,EAAE,KAAK;KAUrB;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -162,6 +162,15 @@ export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
162
162
  authOnly?: boolean;
163
163
  deviceId?: string;
164
164
  jwtToken?: string;
165
+ /**
166
+ * If rendering the Coinflow component within multiple nested iframes, all ancestors in the chain must be provided as a comma-separated list.
167
+ *
168
+ * Example:
169
+ * Primary origin that will be interacting with the Coinflow iFrame: foo.com
170
+ * Subsequent origins that will render foo.com: bar.com
171
+ * The origin array would then be: [https://foo.com,https://bar.com]
172
+ */
173
+ origins?: string[];
165
174
  }
166
175
  export interface CoinflowSolanaPurchaseProps extends CoinflowCommonPurchaseProps {
167
176
  wallet: SolanaWallet;
@@ -215,6 +224,15 @@ export interface CoinflowCommonWithdrawProps extends CoinflowTypes {
215
224
  supportsVersionedTransactions?: boolean;
216
225
  lockAmount?: boolean;
217
226
  transactionSigner?: string;
227
+ /**
228
+ * If rendering the Coinflow component within multiple nested iframes, all ancestors in the chain must be provided as a comma-separated list.
229
+ *
230
+ * Example:
231
+ * Primary origin that will be interacting with the Coinflow iFrame: foo.com
232
+ * Subsequent origins that will render foo.com: bar.com
233
+ * The origin array would then be: [https://foo.com,https://bar.com]
234
+ */
235
+ origins?: string[];
218
236
  }
219
237
  export interface CoinflowSolanaWithdrawProps extends CoinflowCommonWithdrawProps {
220
238
  wallet: SolanaWallet;
@@ -272,7 +290,7 @@ export interface ReservoirRedeem extends CommonEvmRedeem {
272
290
  items: ReservoirItems;
273
291
  }
274
292
  export type EvmTransactionData = SafeMintRedeem | ReturnedTokenIdRedeem | ReservoirRedeem | KnownTokenIdRedeem | NormalRedeem;
275
- export interface CoinflowIFrameProps extends Omit<CoinflowTypes, 'merchantId'>, Pick<CoinflowCommonPurchaseProps, 'chargebackProtectionData' | 'webhookInfo' | 'amount' | 'customerInfo' | 'settlementType' | 'email' | 'planCode' | 'deviceId' | 'jwtToken'>, Pick<CoinflowCommonWithdrawProps, 'bankAccountLinkRedirect' | 'additionalWallets' | 'transactionSigner' | 'lockAmount' | 'lockDefaultToken'>, Pick<CoinflowEvmPurchaseProps, 'authOnly'>, Pick<CoinflowSolanaPurchaseProps, 'rent' | 'nativeSolToConvert' | 'token'> {
293
+ export interface CoinflowIFrameProps extends Omit<CoinflowTypes, 'merchantId'>, Pick<CoinflowCommonPurchaseProps, 'chargebackProtectionData' | 'webhookInfo' | 'amount' | 'customerInfo' | 'settlementType' | 'email' | 'planCode' | 'deviceId' | 'jwtToken' | 'origins'>, Pick<CoinflowCommonWithdrawProps, 'bankAccountLinkRedirect' | 'additionalWallets' | 'transactionSigner' | 'lockAmount' | 'lockDefaultToken' | 'origins'>, Pick<CoinflowEvmPurchaseProps, 'authOnly'>, Pick<CoinflowSolanaPurchaseProps, 'rent' | 'nativeSolToConvert' | 'token'> {
276
294
  walletPubkey: string | null | undefined;
277
295
  route: string;
278
296
  routePrefix?: string;
@@ -287,4 +305,10 @@ export interface CoinflowIFrameProps extends Omit<CoinflowTypes, 'merchantId'>,
287
305
  theme?: MerchantTheme;
288
306
  usePermit?: boolean;
289
307
  }
308
+ export declare enum CardType {
309
+ VISA = "VISA",
310
+ MASTERCARD = "MSTR",
311
+ AMEX = "AMEX",
312
+ DISCOVER = "DISC"
313
+ }
290
314
  export {};
@@ -10,4 +10,11 @@ export var MerchantStyle;
10
10
  MerchantStyle["Sharp"] = "sharp";
11
11
  MerchantStyle["Pill"] = "pill";
12
12
  })(MerchantStyle || (MerchantStyle = {}));
13
+ export var CardType;
14
+ (function (CardType) {
15
+ CardType["VISA"] = "VISA";
16
+ CardType["MASTERCARD"] = "MSTR";
17
+ CardType["AMEX"] = "AMEX";
18
+ CardType["DISCOVER"] = "DISC";
19
+ })(CardType || (CardType = {}));
13
20
  //# sourceMappingURL=CoinflowTypes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CoinflowTypes.js","sourceRoot":"","sources":["../../../src/common/CoinflowTypes.ts"],"names":[],"mappings":"AAQA,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,+BAAa,CAAA;IACb,+BAAa,CAAA;AACf,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB;AAED,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,gCAAe,CAAA;IACf,8BAAa,CAAA;AACf,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB"}
1
+ {"version":3,"file":"CoinflowTypes.js","sourceRoot":"","sources":["../../../src/common/CoinflowTypes.ts"],"names":[],"mappings":"AAQA,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,+BAAa,CAAA;IACb,+BAAa,CAAA;AACf,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB;AAED,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,gCAAe,CAAA;IACf,8BAAa,CAAA;AACf,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AA+ZD,MAAM,CAAN,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,yBAAa,CAAA;IACb,+BAAmB,CAAA;IACnB,yBAAa,CAAA;IACb,6BAAiB,CAAA;AACnB,CAAC,EALW,QAAQ,KAAR,QAAQ,QAKnB"}