@deuna/react-native-sdk 1.0.3 → 1.0.6
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/lib/module/DeunaSDK.js +87 -78
- package/lib/module/DeunaSDK.js.map +1 -1
- package/lib/module/components/DeunaWidget.js +27 -25
- package/lib/module/components/DeunaWidget.js.map +1 -1
- package/lib/module/components/ExternalUrlWebView.js +56 -0
- package/lib/module/components/ExternalUrlWebView.js.map +1 -0
- package/lib/module/controllers/BaseWebViewController.js +59 -23
- package/lib/module/controllers/BaseWebViewController.js.map +1 -1
- package/lib/module/controllers/ElementsWidgetController.js +2 -3
- package/lib/module/controllers/ElementsWidgetController.js.map +1 -1
- package/lib/module/controllers/{OpenInNewTabController.js → ExternalUrlController.js} +4 -4
- package/lib/module/controllers/ExternalUrlController.js.map +1 -0
- package/lib/module/controllers/PaymentWidgetController.js +2 -2
- package/lib/module/controllers/PaymentWidgetController.js.map +1 -1
- package/lib/module/helpers/Completer.js +2 -2
- package/lib/module/helpers/Completer.js.map +1 -1
- package/lib/module/helpers/CrossPlatformBrowser.js +51 -0
- package/lib/module/helpers/CrossPlatformBrowser.js.map +1 -0
- package/lib/module/helpers/ExternalUrlHelper.js +96 -0
- package/lib/module/helpers/ExternalUrlHelper.js.map +1 -0
- package/lib/module/helpers/ViewManager.js +32 -0
- package/lib/module/helpers/ViewManager.js.map +1 -0
- package/lib/module/helpers/{getController.js → buildDeunaWidgetController.js} +20 -10
- package/lib/module/helpers/buildDeunaWidgetController.js.map +1 -0
- package/lib/module/helpers/getSubmitStrategy.js +1 -1
- package/lib/module/helpers/getSubmitStrategy.js.map +1 -1
- package/lib/module/interfaces/constants.js +1 -0
- package/lib/module/interfaces/constants.js.map +1 -1
- package/lib/module/interfaces/types.js.map +1 -1
- package/lib/module/types/base.js.map +1 -1
- package/lib/module/types/envs.js +48 -0
- package/lib/module/types/envs.js.map +1 -0
- package/lib/module/types/fraudProviders.js +4 -0
- package/lib/module/types/fraudProviders.js.map +1 -0
- package/lib/module/types/helpers/buildElementsLink.js +15 -6
- package/lib/module/types/helpers/buildElementsLink.js.map +1 -1
- package/lib/module/types/helpers/buildPaymentLink.js +7 -3
- package/lib/module/types/helpers/buildPaymentLink.js.map +1 -1
- package/lib/module/types/helpers/buildVoucherLink.js +3 -1
- package/lib/module/types/helpers/buildVoucherLink.js.map +1 -1
- package/lib/module/types/helpers/constants.js +4 -0
- package/lib/module/types/helpers/constants.js.map +1 -0
- package/lib/module/types/helpers/urlConfig.js +1 -1
- package/lib/module/types/helpers/urlConfig.js.map +1 -1
- package/lib/module/types/utils/addSearchParamWhen.js +8 -0
- package/lib/module/types/utils/addSearchParamWhen.js.map +1 -0
- package/lib/typescript/deuna-sdk-react-native/src/DeunaSDK.d.ts +9 -11
- package/lib/typescript/deuna-sdk-react-native/src/DeunaSDK.d.ts.map +1 -1
- package/lib/typescript/deuna-sdk-react-native/src/components/DeunaWidget.d.ts.map +1 -1
- package/lib/typescript/deuna-sdk-react-native/src/components/ExternalUrlWebView.d.ts +7 -0
- package/lib/typescript/deuna-sdk-react-native/src/components/ExternalUrlWebView.d.ts.map +1 -0
- package/lib/typescript/deuna-sdk-react-native/src/controllers/BaseWebViewController.d.ts +9 -7
- package/lib/typescript/deuna-sdk-react-native/src/controllers/BaseWebViewController.d.ts.map +1 -1
- package/lib/typescript/deuna-sdk-react-native/src/controllers/ElementsWidgetController.d.ts.map +1 -1
- package/lib/typescript/deuna-sdk-react-native/src/controllers/{OpenInNewTabController.d.ts → ExternalUrlController.d.ts} +2 -2
- package/lib/typescript/deuna-sdk-react-native/src/controllers/ExternalUrlController.d.ts.map +1 -0
- package/lib/typescript/deuna-sdk-react-native/src/helpers/CrossPlatformBrowser.d.ts +25 -0
- package/lib/typescript/deuna-sdk-react-native/src/helpers/CrossPlatformBrowser.d.ts.map +1 -0
- package/lib/typescript/deuna-sdk-react-native/src/helpers/ExternalUrlHelper.d.ts +48 -0
- package/lib/typescript/deuna-sdk-react-native/src/helpers/ExternalUrlHelper.d.ts.map +1 -0
- package/lib/typescript/deuna-sdk-react-native/src/helpers/ViewManager.d.ts +19 -0
- package/lib/typescript/deuna-sdk-react-native/src/helpers/ViewManager.d.ts.map +1 -0
- package/lib/typescript/deuna-sdk-react-native/src/helpers/{getController.d.ts → buildDeunaWidgetController.d.ts} +4 -2
- package/lib/typescript/deuna-sdk-react-native/src/helpers/buildDeunaWidgetController.d.ts.map +1 -0
- package/lib/typescript/deuna-sdk-react-native/src/interfaces/constants.d.ts +1 -0
- package/lib/typescript/deuna-sdk-react-native/src/interfaces/constants.d.ts.map +1 -1
- package/lib/typescript/deuna-sdk-react-native/src/interfaces/types.d.ts +4 -0
- package/lib/typescript/deuna-sdk-react-native/src/interfaces/types.d.ts.map +1 -1
- package/lib/typescript/deuna-sdk-react-native/src/types/base.d.ts +2 -0
- package/lib/typescript/deuna-sdk-react-native/src/types/base.d.ts.map +1 -1
- package/lib/typescript/deuna-sdk-react-native/src/types/envs.d.ts +45 -0
- package/lib/typescript/deuna-sdk-react-native/src/types/envs.d.ts.map +1 -0
- package/lib/typescript/deuna-sdk-react-native/src/types/fraudProviders.d.ts +68 -0
- package/lib/typescript/deuna-sdk-react-native/src/types/fraudProviders.d.ts.map +1 -0
- package/lib/typescript/deuna-sdk-react-native/src/types/helpers/buildElementsLink.d.ts +15 -0
- package/lib/typescript/deuna-sdk-react-native/src/types/helpers/buildElementsLink.d.ts.map +1 -1
- package/lib/typescript/deuna-sdk-react-native/src/types/helpers/buildPaymentLink.d.ts.map +1 -1
- package/lib/typescript/deuna-sdk-react-native/src/types/helpers/buildVoucherLink.d.ts.map +1 -1
- package/lib/typescript/deuna-sdk-react-native/src/types/helpers/constants.d.ts +2 -0
- package/lib/typescript/deuna-sdk-react-native/src/types/helpers/constants.d.ts.map +1 -0
- package/lib/typescript/deuna-sdk-react-native/src/types/helpers/urlConfig.d.ts +1 -0
- package/lib/typescript/deuna-sdk-react-native/src/types/helpers/urlConfig.d.ts.map +1 -1
- package/lib/typescript/deuna-sdk-react-native/src/types/interfaces/callbacks.d.ts +8 -0
- package/lib/typescript/deuna-sdk-react-native/src/types/interfaces/callbacks.d.ts.map +1 -1
- package/lib/typescript/deuna-sdk-react-native/src/types/interfaces/initWidgetBase.d.ts +2 -0
- package/lib/typescript/deuna-sdk-react-native/src/types/interfaces/initWidgetBase.d.ts.map +1 -1
- package/lib/typescript/deuna-sdk-react-native/src/types/utils/addSearchParamWhen.d.ts +3 -0
- package/lib/typescript/deuna-sdk-react-native/src/types/utils/addSearchParamWhen.d.ts.map +1 -0
- package/package.json +3 -1
- package/src/DeunaSDK.ts +103 -90
- package/src/components/DeunaWidget.tsx +38 -35
- package/src/components/ExternalUrlWebView.tsx +65 -0
- package/src/controllers/BaseWebViewController.ts +70 -29
- package/src/controllers/ElementsWidgetController.ts +2 -3
- package/src/controllers/{OpenInNewTabController.ts → ExternalUrlController.ts} +3 -3
- package/src/controllers/PaymentWidgetController.ts +2 -2
- package/src/helpers/Completer.ts +2 -2
- package/src/helpers/CrossPlatformBrowser.ts +49 -0
- package/src/helpers/ExternalUrlHelper.ts +118 -0
- package/src/helpers/ViewManager.ts +45 -0
- package/src/helpers/{getController.ts → buildDeunaWidgetController.ts} +41 -12
- package/src/helpers/getSubmitStrategy.ts +1 -1
- package/src/interfaces/constants.ts +2 -0
- package/src/interfaces/types.ts +4 -0
- package/src/types/base.ts +2 -0
- package/src/types/envs.ts +50 -0
- package/src/types/fraudProviders.ts +98 -0
- package/src/types/helpers/buildElementsLink.ts +19 -11
- package/src/types/helpers/buildPaymentLink.ts +7 -2
- package/src/types/helpers/buildVoucherLink.ts +2 -0
- package/src/types/helpers/constants.ts +1 -0
- package/src/types/helpers/urlConfig.ts +3 -1
- package/src/types/interfaces/callbacks.ts +10 -1
- package/src/types/interfaces/initWidgetBase.ts +2 -0
- package/src/types/utils/addSearchParamWhen.ts +11 -0
- package/lib/module/components/NewTabWebView.js +0 -56
- package/lib/module/components/NewTabWebView.js.map +0 -1
- package/lib/module/controllers/OpenInNewTabController.js.map +0 -1
- package/lib/module/helpers/getController.js.map +0 -1
- package/lib/typescript/deuna-sdk-react-native/src/components/NewTabWebView.d.ts +0 -7
- package/lib/typescript/deuna-sdk-react-native/src/components/NewTabWebView.d.ts.map +0 -1
- package/lib/typescript/deuna-sdk-react-native/src/controllers/OpenInNewTabController.d.ts.map +0 -1
- package/lib/typescript/deuna-sdk-react-native/src/helpers/getController.d.ts.map +0 -1
- package/src/components/NewTabWebView.tsx +0 -64
|
@@ -11,6 +11,9 @@ import {
|
|
|
11
11
|
import { linkBuilders } from '../types/helpers';
|
|
12
12
|
import { Mode } from '../interfaces/types';
|
|
13
13
|
import { DeunaLogs } from '../DeunaLogs';
|
|
14
|
+
import { InitFraudProvidersProps } from '../types/fraudProviders';
|
|
15
|
+
import { Environment } from '../types';
|
|
16
|
+
import { DeunaSDK } from '../DeunaSDK';
|
|
14
17
|
|
|
15
18
|
type PaymentWidgetControllerProps = InitPaymentWidgetParams & {
|
|
16
19
|
widget: 'payment';
|
|
@@ -34,13 +37,29 @@ type ControllerProps =
|
|
|
34
37
|
| VoucherWidgetControllerProps
|
|
35
38
|
| ElementsWidgetControllerProps;
|
|
36
39
|
|
|
37
|
-
|
|
40
|
+
interface BaseParams {
|
|
41
|
+
env: Environment;
|
|
42
|
+
publicApiKey: string;
|
|
43
|
+
orderToken: string;
|
|
44
|
+
userToken: string;
|
|
45
|
+
language: string;
|
|
46
|
+
sessionId: string;
|
|
47
|
+
mode: string;
|
|
48
|
+
domain?: string;
|
|
49
|
+
fraudCredentials?: Partial<InitFraudProvidersProps>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const buildDeunaWidgetController = (
|
|
38
53
|
config: InitializeParams,
|
|
39
|
-
props: ControllerProps & {
|
|
54
|
+
props: ControllerProps & {
|
|
55
|
+
mode?: Mode;
|
|
56
|
+
sessionId?: string;
|
|
57
|
+
sdkInstance?: DeunaSDK;
|
|
58
|
+
}
|
|
40
59
|
): DeunaWebViewController => {
|
|
41
|
-
const { widget, mode, callbacks, ...rest } = props;
|
|
60
|
+
const { widget, mode, callbacks, sdkInstance, ...rest } = props;
|
|
42
61
|
|
|
43
|
-
const baseParams = {
|
|
62
|
+
const baseParams: BaseParams = {
|
|
44
63
|
env: config.environment!,
|
|
45
64
|
publicApiKey: config.publicApiKey,
|
|
46
65
|
orderToken: rest.orderToken ?? '',
|
|
@@ -60,12 +79,16 @@ export const getWidgetController = (
|
|
|
60
79
|
widgetExperience: rest.widgetExperience,
|
|
61
80
|
types: (props as ElementsWidgetControllerProps).types,
|
|
62
81
|
}),
|
|
63
|
-
payment: () =>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
82
|
+
payment: () => {
|
|
83
|
+
const paymentWidgetProps = props as PaymentWidgetControllerProps;
|
|
84
|
+
return {
|
|
85
|
+
...baseParams,
|
|
86
|
+
behavior: rest.behavior,
|
|
87
|
+
paymentMethods: paymentWidgetProps.paymentMethods,
|
|
88
|
+
styleFile: rest.styleFile,
|
|
89
|
+
fraudCredentials: paymentWidgetProps.fraudCredentials,
|
|
90
|
+
};
|
|
91
|
+
},
|
|
69
92
|
nextAction: () => baseParams,
|
|
70
93
|
voucher: () => baseParams,
|
|
71
94
|
};
|
|
@@ -76,12 +99,18 @@ export const getWidgetController = (
|
|
|
76
99
|
userToken: rest.userToken,
|
|
77
100
|
};
|
|
78
101
|
|
|
102
|
+
const widgetParams = widgetMappers[widget]();
|
|
103
|
+
|
|
79
104
|
const controller =
|
|
80
105
|
widget === 'elements'
|
|
81
106
|
? new ElementsWidgetController(callbacks, widgetConfig)
|
|
82
|
-
: new PaymentWidgetController(callbacks,
|
|
107
|
+
: new PaymentWidgetController(callbacks, {
|
|
108
|
+
...widgetConfig,
|
|
109
|
+
sdkInstance,
|
|
110
|
+
fraudCredentials: widgetParams.fraudCredentials,
|
|
111
|
+
});
|
|
83
112
|
|
|
84
|
-
controller.url = linkBuilders[widget](
|
|
113
|
+
controller.url = linkBuilders[widget](baseParams);
|
|
85
114
|
controller.hidePayButton = rest.hidePayButton ?? false;
|
|
86
115
|
|
|
87
116
|
DeunaLogs.info('👀 loading link', controller.url);
|
|
@@ -10,7 +10,7 @@ export const getSubmitStrategy = async (
|
|
|
10
10
|
return null;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const { widgetConfig } = deunaSDK.
|
|
13
|
+
const { widgetConfig } = deunaSDK.deunaWidgetManager.controller;
|
|
14
14
|
|
|
15
15
|
const processorName = selectedPaymentMethod.processor_name as string;
|
|
16
16
|
|
package/src/interfaces/types.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { DeunaSDK } from '../DeunaSDK';
|
|
1
2
|
import { BehaviorWidget } from '../types';
|
|
3
|
+
import { InitFraudProvidersProps } from '../types/fraudProviders';
|
|
2
4
|
|
|
3
5
|
export interface WidgetConfig {
|
|
4
6
|
behavior?: BehaviorWidget;
|
|
5
7
|
orderToken?: string;
|
|
6
8
|
userToken?: string;
|
|
9
|
+
sdkInstance?: DeunaSDK;
|
|
10
|
+
fraudCredentials?: Partial<InitFraudProvidersProps>;
|
|
7
11
|
}
|
|
8
12
|
|
|
9
13
|
export enum Mode {
|
package/src/types/base.ts
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
} from './interfaces/merchant';
|
|
18
18
|
import { Order } from './interfaces/order';
|
|
19
19
|
import { User } from './interfaces/user';
|
|
20
|
+
import { InitFraudProvidersProps } from './fraudProviders';
|
|
20
21
|
|
|
21
22
|
export type Environment = 'production' | 'sandbox' | 'develop' | 'staging';
|
|
22
23
|
|
|
@@ -65,6 +66,7 @@ export type InitPaymentWidgetParams = Omit<InitWidgetBase, 'callbacks'> & {
|
|
|
65
66
|
flowType?: PaymentMethodConfigurationFlow;
|
|
66
67
|
};
|
|
67
68
|
}[];
|
|
69
|
+
fraudCredentials?: Partial<InitFraudProvidersProps>;
|
|
68
70
|
sessionId?: string;
|
|
69
71
|
};
|
|
70
72
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export enum Env {
|
|
2
|
+
Production = 'production',
|
|
3
|
+
Staging = 'staging',
|
|
4
|
+
Develop = 'develop',
|
|
5
|
+
Sandbox = 'sandbox',
|
|
6
|
+
local = 'local'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const env = {
|
|
10
|
+
[Env.Production]: 'https://apigw.getduna.com/',
|
|
11
|
+
[Env.Staging]: 'https://api.stg.deuna.io/',
|
|
12
|
+
[Env.Develop]: 'https://api.dev.deuna.io/',
|
|
13
|
+
[Env.Sandbox]: 'https://api.sandbox.deuna.io/'
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const checkout = {
|
|
17
|
+
[Env.Production]: 'https://checkout-ux.deuna.com/',
|
|
18
|
+
[Env.Staging]: 'https://checkout.stg.deuna.io/',
|
|
19
|
+
[Env.Develop]: 'https://checkout.dev.deuna.io/',
|
|
20
|
+
[Env.Sandbox]: 'https://checkout.sandbox.deuna.io/'
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const fingerprintjsEnv = {
|
|
24
|
+
[Env.Production]: 'PczoxhUz1RUyPv5Ih7nM',
|
|
25
|
+
[Env.Staging]: 'sB9jPdnpvLP3FkjjUPi3',
|
|
26
|
+
[Env.Develop]: 'sB9jPdnpvLP3FkjjUPi3',
|
|
27
|
+
[Env.Sandbox]: 'sB9jPdnpvLP3FkjjUPi3'
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const storageSite = {
|
|
31
|
+
[Env.Production]: 'https://cdn.getduna.com/cdl/storageSite/index.html',
|
|
32
|
+
[Env.Staging]: 'https://cdn.stg.deuna.io/cdl/storageSite/index.html',
|
|
33
|
+
[Env.Develop]: 'https://cdn.dev.deuna.io/cdl/storageSite/index.html',
|
|
34
|
+
[Env.Sandbox]: 'https://cdn.stg.deuna.io/cdl/storageSite/index.html',
|
|
35
|
+
[Env.local]: 'http://localhost:3005/'
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const siftCred = {
|
|
39
|
+
[Env.Production]: 'ab8ca5421b',
|
|
40
|
+
[Env.Staging]: 'b267dfc8a5',
|
|
41
|
+
[Env.Develop]: 'b267dfc8a5',
|
|
42
|
+
[Env.Sandbox]: 'b267dfc8a5'
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const proxyUrls = {
|
|
46
|
+
URL: 'mimos.vendodeuna.com',
|
|
47
|
+
FPJS_BEHAVIOR_PATH: 'thomas',
|
|
48
|
+
FPJS_AGENT_DOWNLOAD_PATH: 'tommy',
|
|
49
|
+
FPJS_GET_RESULT_PATH: 'pabloinvita'
|
|
50
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Env } from "./envs";
|
|
2
|
+
|
|
3
|
+
export type Providers =
|
|
4
|
+
| "CLEARSALE"
|
|
5
|
+
| "CLEARSALE-BRASIL"
|
|
6
|
+
| "CYBERSOURCE"
|
|
7
|
+
| "MERCADOPAGO"
|
|
8
|
+
| "SIFT"
|
|
9
|
+
| "SIGNIFYD"
|
|
10
|
+
| "STRIPE"
|
|
11
|
+
| "KOUNT"
|
|
12
|
+
| "KONDUTO"
|
|
13
|
+
| "OPENPAY"
|
|
14
|
+
| "RISKIFIED";
|
|
15
|
+
|
|
16
|
+
export interface FraudProviderParams<T> {
|
|
17
|
+
sessionId: string;
|
|
18
|
+
env: Env;
|
|
19
|
+
params: T;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type FraudProvider<T, Provider extends Providers> = (
|
|
23
|
+
params: FraudProviderParams<T>
|
|
24
|
+
) => Promise<
|
|
25
|
+
| {
|
|
26
|
+
[key in Provider]?: string | string[];
|
|
27
|
+
}
|
|
28
|
+
| undefined
|
|
29
|
+
>;
|
|
30
|
+
|
|
31
|
+
export interface RiskifiedParams {
|
|
32
|
+
storeDomain: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface CyberSourceParams {
|
|
36
|
+
orgId: string;
|
|
37
|
+
merchantId: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface SignifydParams {
|
|
41
|
+
account: string;
|
|
42
|
+
email: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface SiftParams {
|
|
46
|
+
accountId: string;
|
|
47
|
+
restApiKey: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface ClearSaleParams {
|
|
51
|
+
clientId: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface StripeParams {
|
|
55
|
+
apiKey: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface KountParams {
|
|
59
|
+
dataCollectorUrl: string;
|
|
60
|
+
merchantId: string; // m = six digit Merchant ID number issued by Kount
|
|
61
|
+
clientId: string;
|
|
62
|
+
environment: string;
|
|
63
|
+
version: string;
|
|
64
|
+
isSinglePageApp: boolean;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface KoinParams {
|
|
68
|
+
id: string;
|
|
69
|
+
orgId: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface KondutoParams {
|
|
73
|
+
publicKey: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface OpenPayParams {
|
|
77
|
+
merchantId: string;
|
|
78
|
+
publicApiKey: string;
|
|
79
|
+
sandboxMode?: boolean;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export type FraudProvidersObject = {
|
|
83
|
+
[key in Providers]: FraudProvider<any, key>;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export type InitFraudProvidersProps = {
|
|
87
|
+
CLEARSALE: ClearSaleParams;
|
|
88
|
+
"CLEARSALE-BRASIL": ClearSaleParams;
|
|
89
|
+
OPENPAY: OpenPayParams;
|
|
90
|
+
CYBERSOURCE: CyberSourceParams;
|
|
91
|
+
MERCADOPAGO: {};
|
|
92
|
+
SIFT: SiftParams;
|
|
93
|
+
SIGNIFYD: SignifydParams;
|
|
94
|
+
STRIPE: StripeParams;
|
|
95
|
+
KOUNT: KountParams;
|
|
96
|
+
KONDUTO: KondutoParams;
|
|
97
|
+
RISKIFIED: RiskifiedParams;
|
|
98
|
+
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Environment } from "../base";
|
|
2
2
|
import { hasKey } from "../utils/hasKey";
|
|
3
3
|
import { getIntegrationType, UrlConfig } from "./urlConfig";
|
|
4
|
+
import { PLATFORM_DEFAULT } from "./constants";
|
|
5
|
+
import { addSearchParamWhen } from "../utils/addSearchParamWhen";
|
|
4
6
|
|
|
5
7
|
const ELEMENTS_URLS: Record<Environment, string> = {
|
|
6
|
-
production: "https://elements.deuna.
|
|
8
|
+
production: "https://elements.deuna.com",
|
|
7
9
|
sandbox: "https://elements.sandbox.deuna.io",
|
|
8
10
|
staging: "https://elements.stg.deuna.io",
|
|
9
11
|
develop: "https://elements.dev.deuna.io",
|
|
@@ -16,7 +18,7 @@ const WIDGET_PATHS = {
|
|
|
16
18
|
|
|
17
19
|
type WidgetPath = keyof typeof WIDGET_PATHS;
|
|
18
20
|
|
|
19
|
-
interface SearchParams {
|
|
21
|
+
export interface SearchParams {
|
|
20
22
|
publicApiKey: string;
|
|
21
23
|
orderToken: string;
|
|
22
24
|
email: string;
|
|
@@ -28,6 +30,8 @@ interface SearchParams {
|
|
|
28
30
|
userToken?: string;
|
|
29
31
|
showSavedCardsFlow?: string;
|
|
30
32
|
showDefaultCardFlow?: string;
|
|
33
|
+
disableInstallments?: string;
|
|
34
|
+
platform?: string;
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
/**
|
|
@@ -50,6 +54,7 @@ const buildSearchParams = (config: UrlConfig): URLSearchParams => {
|
|
|
50
54
|
const searchParams: SearchParams = {
|
|
51
55
|
publicApiKey: config.publicApiKey,
|
|
52
56
|
orderToken: config.orderToken,
|
|
57
|
+
platform: config.platform || PLATFORM_DEFAULT,
|
|
53
58
|
email: userInfo?.email || "",
|
|
54
59
|
firstName: userInfo?.firstName || "",
|
|
55
60
|
lastName: userInfo?.lastName || "",
|
|
@@ -65,16 +70,19 @@ const buildSearchParams = (config: UrlConfig): URLSearchParams => {
|
|
|
65
70
|
searchParams.userToken = userToken;
|
|
66
71
|
}
|
|
67
72
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
const ux = widgetExperience?.userExperience;
|
|
74
|
+
|
|
75
|
+
if (ux) {
|
|
76
|
+
const userExpParams: Record<keyof typeof ux, keyof SearchParams> = {
|
|
77
|
+
showSavedCardsFlow: "showSavedCardsFlow",
|
|
78
|
+
defaultCardFlow: "showDefaultCardFlow",
|
|
79
|
+
disableInstallments: "disableInstallments",
|
|
80
|
+
};
|
|
73
81
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
);
|
|
82
|
+
Object.entries(userExpParams).forEach(([sourceKey, targetKey]) => {
|
|
83
|
+
const value = ux[sourceKey as keyof typeof ux];
|
|
84
|
+
addSearchParamWhen(value, targetKey, searchParams);
|
|
85
|
+
});
|
|
78
86
|
}
|
|
79
87
|
|
|
80
88
|
return new URLSearchParams(searchParams as unknown as Record<string, string>);
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
getIntegrationType,
|
|
11
11
|
UrlConfig,
|
|
12
12
|
} from "./urlConfig";
|
|
13
|
+
import { PLATFORM_DEFAULT } from "./constants";
|
|
13
14
|
|
|
14
15
|
const urls: Record<Environment, string> = {
|
|
15
16
|
production: "https://pay.deuna.io",
|
|
@@ -19,7 +20,7 @@ const urls: Record<Environment, string> = {
|
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
export const buildPaymentLink = (config: UrlConfig): string => {
|
|
22
|
-
const { env, orderToken } = config;
|
|
23
|
+
const { env, orderToken, widgetExperience } = config;
|
|
23
24
|
|
|
24
25
|
let baseUrl = urls.production;
|
|
25
26
|
|
|
@@ -31,6 +32,7 @@ export const buildPaymentLink = (config: UrlConfig): string => {
|
|
|
31
32
|
mode: "widget",
|
|
32
33
|
int: getIntegrationType(config.mode),
|
|
33
34
|
language: config.language,
|
|
35
|
+
platform: config.platform || PLATFORM_DEFAULT,
|
|
34
36
|
});
|
|
35
37
|
|
|
36
38
|
// config.
|
|
@@ -43,6 +45,7 @@ export const buildPaymentLink = (config: UrlConfig): string => {
|
|
|
43
45
|
cdl: {
|
|
44
46
|
sessionId: config.sessionId,
|
|
45
47
|
},
|
|
48
|
+
widgetExperience,
|
|
46
49
|
};
|
|
47
50
|
|
|
48
51
|
configToQueryParams(config, searchParams);
|
|
@@ -54,7 +57,9 @@ export const buildPaymentLink = (config: UrlConfig): string => {
|
|
|
54
57
|
//encode to base64
|
|
55
58
|
searchParams.append("xpropsB64", btoa(JSON.stringify(xpropsB64)));
|
|
56
59
|
|
|
57
|
-
const url = new URL(
|
|
60
|
+
const url = new URL(
|
|
61
|
+
`${baseUrl}/now/${orderToken}?${searchParams.toString()}`
|
|
62
|
+
);
|
|
58
63
|
|
|
59
64
|
return url.toString();
|
|
60
65
|
};
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { Environment } from "../base";
|
|
8
|
+
import { PLATFORM_DEFAULT } from "./constants";
|
|
8
9
|
import { getIntegrationType, UrlConfig } from "./urlConfig";
|
|
9
10
|
|
|
10
11
|
const urls: Record<Environment, string> = {
|
|
@@ -28,6 +29,7 @@ export const buildVoucherLink = (config: UrlConfig): string => {
|
|
|
28
29
|
int: getIntegrationType(config.mode),
|
|
29
30
|
language: config.language,
|
|
30
31
|
orderToken,
|
|
32
|
+
platform: config.platform || PLATFORM_DEFAULT,
|
|
31
33
|
});
|
|
32
34
|
|
|
33
35
|
const xpropsB64 = {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const PLATFORM_DEFAULT = "custom";
|
|
@@ -23,7 +23,7 @@ export const getIntegrationType = (mode?: string) => {
|
|
|
23
23
|
target: "embedded",
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
return modeMap[mode || ""] || "
|
|
26
|
+
return modeMap[mode || ""] || "link";
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
interface PaymentMethods {
|
|
@@ -71,6 +71,8 @@ export interface UrlConfig {
|
|
|
71
71
|
sessionId: string;
|
|
72
72
|
|
|
73
73
|
types?: ElementWidgetType[];
|
|
74
|
+
|
|
75
|
+
platform?: string;
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
export interface ElementWidgetType {
|
|
@@ -20,11 +20,16 @@ interface OnInstallmentSelectedPayload {
|
|
|
20
20
|
installmentPlanOptionId: string;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
interface Dimensions {
|
|
24
|
+
height: number;
|
|
25
|
+
width: number;
|
|
26
|
+
}
|
|
23
27
|
interface BaseCallbacks {
|
|
24
28
|
onSuccess?: (data: Json) => void;
|
|
25
29
|
onError?: (data: OnError) => void;
|
|
26
30
|
onClosed?: (action: ClosedAction) => void;
|
|
27
31
|
onEventDispatch?: (event: string, payload: Json) => void;
|
|
32
|
+
onResize?: (dimensions: Dimensions) => void;
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
export interface PaymentWidgetCallbacks extends BaseCallbacks {
|
|
@@ -40,4 +45,8 @@ export interface ElementsWidgetCallbacks extends BaseCallbacks {
|
|
|
40
45
|
|
|
41
46
|
export interface NextActionWidgetCallbacks extends BaseCallbacks {}
|
|
42
47
|
|
|
43
|
-
export interface VoucherWidgetCallbacks extends BaseCallbacks {
|
|
48
|
+
export interface VoucherWidgetCallbacks extends BaseCallbacks {
|
|
49
|
+
onCardBinDetected?: (data: OnCardBinDetected) => void;
|
|
50
|
+
onInstallmentSelected?: (data: OnInstallmentSelectedPayload) => void;
|
|
51
|
+
onPaymentProcessing?: () => void;
|
|
52
|
+
}
|
|
@@ -30,6 +30,7 @@ interface WidgetExperience {
|
|
|
30
30
|
userExperience: {
|
|
31
31
|
showSavedCardsFlow: boolean;
|
|
32
32
|
defaultCardFlow: boolean;
|
|
33
|
+
disableInstallments?: boolean;
|
|
33
34
|
};
|
|
34
35
|
flags: {
|
|
35
36
|
allowSaveUserInfo: boolean;
|
|
@@ -83,6 +84,7 @@ export interface InitWidgetBase {
|
|
|
83
84
|
userInfo?: Partial<UserInfo>;
|
|
84
85
|
behavior?: BehaviorWidget;
|
|
85
86
|
domain?: string;
|
|
87
|
+
platform?: string;
|
|
86
88
|
hidePayButton?: boolean;
|
|
87
89
|
callbacks?: PaymentWidgetCallbacks &
|
|
88
90
|
ElementsWidgetCallbacks &
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SearchParams } from "../helpers/buildElementsLink";
|
|
2
|
+
|
|
3
|
+
export const addSearchParamWhen = (
|
|
4
|
+
condition: boolean | undefined,
|
|
5
|
+
paramName: keyof SearchParams,
|
|
6
|
+
searchParams: SearchParams
|
|
7
|
+
) => {
|
|
8
|
+
if (condition) {
|
|
9
|
+
searchParams[paramName] = String(condition);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { useEffect, useRef, useState } from 'react';
|
|
4
|
-
import { Modal, SafeAreaView, StyleSheet } from 'react-native';
|
|
5
|
-
import { DeunaWebView } from "./DeunaWebView.js";
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
export const NewTabWebView = props => {
|
|
8
|
-
const {
|
|
9
|
-
instance
|
|
10
|
-
} = props;
|
|
11
|
-
const instanceRef = useRef(instance);
|
|
12
|
-
const [visible, setVisible] = useState(false);
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
instanceRef.current = instance;
|
|
15
|
-
}, [instance]);
|
|
16
|
-
|
|
17
|
-
// Listen when the DeunaSDK instance configuration
|
|
18
|
-
// has changed
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
const ref = instanceRef.current;
|
|
21
|
-
const listener = () => {
|
|
22
|
-
const isVisible = !!ref.newTabWebViewController;
|
|
23
|
-
setVisible(isVisible);
|
|
24
|
-
};
|
|
25
|
-
instanceRef.current.addListener(listener);
|
|
26
|
-
return () => {
|
|
27
|
-
ref.removeListener(listener);
|
|
28
|
-
ref.newTabWebViewController?.dispose();
|
|
29
|
-
};
|
|
30
|
-
}, []);
|
|
31
|
-
const newTabController = instanceRef.current.newTabWebViewController;
|
|
32
|
-
return /*#__PURE__*/_jsx(Modal, {
|
|
33
|
-
presentationStyle: "pageSheet",
|
|
34
|
-
visible: visible,
|
|
35
|
-
animationType: "slide",
|
|
36
|
-
onRequestClose: instanceRef.current.onCloseNewTab,
|
|
37
|
-
onDismiss: instanceRef.current.onNewTabDismissed,
|
|
38
|
-
children: visible && /*#__PURE__*/_jsx(SafeAreaView, {
|
|
39
|
-
style: styles.container,
|
|
40
|
-
children: /*#__PURE__*/_jsx(DeunaWebView, {
|
|
41
|
-
url: newTabController?.url ?? '',
|
|
42
|
-
onWebView: newTabController?.setWebView,
|
|
43
|
-
onMessage: newTabController?.onMessage,
|
|
44
|
-
onLoad: newTabController?.onLoad,
|
|
45
|
-
onError: newTabController?.onError,
|
|
46
|
-
onShouldStartLoadWithRequest: newTabController?.onShouldStartLoadWithRequest
|
|
47
|
-
})
|
|
48
|
-
})
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
const styles = StyleSheet.create({
|
|
52
|
-
container: {
|
|
53
|
-
flex: 1
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
//# sourceMappingURL=NewTabWebView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useRef","useState","Modal","SafeAreaView","StyleSheet","DeunaWebView","jsx","_jsx","NewTabWebView","props","instance","instanceRef","visible","setVisible","current","ref","listener","isVisible","newTabWebViewController","addListener","removeListener","dispose","newTabController","presentationStyle","animationType","onRequestClose","onCloseNewTab","onDismiss","onNewTabDismissed","children","style","styles","container","url","onWebView","setWebView","onMessage","onLoad","onError","onShouldStartLoadWithRequest","create","flex"],"sourceRoot":"../../../src","sources":["components/NewTabWebView.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAEnD,SAASC,KAAK,EAAEC,YAAY,EAAEC,UAAU,QAAQ,cAAc;AAC9D,SAASC,YAAY,QAAQ,mBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAM9C,OAAO,MAAMC,aAAa,GAAIC,KAAyB,IAAK;EAC1D,MAAM;IAAEC;EAAS,CAAC,GAAGD,KAAK;EAC1B,MAAME,WAAW,GAAGX,MAAM,CAAWU,QAAQ,CAAC;EAC9C,MAAM,CAACE,OAAO,EAAEC,UAAU,CAAC,GAAGZ,QAAQ,CAAC,KAAK,CAAC;EAE7CF,SAAS,CAAC,MAAM;IACdY,WAAW,CAACG,OAAO,GAAGJ,QAAQ;EAChC,CAAC,EAAE,CAACA,QAAQ,CAAC,CAAC;;EAEd;EACA;EACAX,SAAS,CAAC,MAAM;IACd,MAAMgB,GAAG,GAAGJ,WAAW,CAACG,OAAO;IAC/B,MAAME,QAAQ,GAAGA,CAAA,KAAM;MACrB,MAAMC,SAAS,GAAG,CAAC,CAACF,GAAG,CAACG,uBAAuB;MAC/CL,UAAU,CAACI,SAAS,CAAC;IACvB,CAAC;IAEDN,WAAW,CAACG,OAAO,CAACK,WAAW,CAACH,QAAQ,CAAC;IAEzC,OAAO,MAAM;MACXD,GAAG,CAACK,cAAc,CAACJ,QAAQ,CAAC;MAC5BD,GAAG,CAACG,uBAAuB,EAAEG,OAAO,CAAC,CAAC;IACxC,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMC,gBAAgB,GAAGX,WAAW,CAACG,OAAO,CAACI,uBAAuB;EAEpE,oBACEX,IAAA,CAACL,KAAK;IACJqB,iBAAiB,EAAC,WAAW;IAC7BX,OAAO,EAAEA,OAAQ;IACjBY,aAAa,EAAC,OAAO;IACrBC,cAAc,EAAEd,WAAW,CAACG,OAAO,CAACY,aAAc;IAClDC,SAAS,EAAEhB,WAAW,CAACG,OAAO,CAACc,iBAAkB;IAAAC,QAAA,EAEhDjB,OAAO,iBACNL,IAAA,CAACJ,YAAY;MAAC2B,KAAK,EAAEC,MAAM,CAACC,SAAU;MAAAH,QAAA,eACpCtB,IAAA,CAACF,YAAY;QACX4B,GAAG,EAAEX,gBAAgB,EAAEW,GAAG,IAAI,EAAG;QACjCC,SAAS,EAAEZ,gBAAgB,EAAEa,UAAW;QACxCC,SAAS,EAAEd,gBAAgB,EAAEc,SAAU;QACvCC,MAAM,EAAEf,gBAAgB,EAAEe,MAAO;QACjCC,OAAO,EAAEhB,gBAAgB,EAAEgB,OAAQ;QACnCC,4BAA4B,EAC1BjB,gBAAgB,EAAEiB;MACnB,CACF;IAAC,CACU;EACf,CACI,CAAC;AAEZ,CAAC;AAED,MAAMR,MAAM,GAAG3B,UAAU,CAACoC,MAAM,CAAC;EAAER,SAAS,EAAE;IAAES,IAAI,EAAE;EAAE;AAAE,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["BaseWebViewController","WebViewEventType","DeunaLogs","OpenInNewTabController","constructor","url","onLoad","setXprops","onError","event","console","warn","urlMustBeLoadedInTheSameWebView","isDownloadUrl","delegate","onFileDownload","onMessage","eventData","JSON","parse","nativeEvent","data","type","info","message","webView","injectJavaScript","consoleLog","newTabWindowClose"],"sourceRoot":"../../../src","sources":["controllers/OpenInNewTabController.ts"],"mappings":";;AACA,SACEA,qBAAqB,EACrBC,gBAAgB,QACX,4BAAyB;AAChC,SAASC,SAAS,QAAQ,iBAAc;AAExC,OAAO,MAAMC,sBAAsB,SAASH,qBAAqB,CAAC;EAChEI,WAAWA,CAAUC,GAAW,EAAE;IAChC,KAAK,CAAC,CAAC;IAAC,KADWA,GAAW,GAAXA,GAAW;IAE9B,IAAI,CAACA,GAAG,GAAGA,GAAG;EAChB;EAEAC,MAAM,GAAGA,CAAA,KAAM;IACb,IAAI,CAACC,SAAS,CAAC,CAAC;EAClB,CAAC;EAEDC,OAAO,GAAIC,KAAU,IAAK;IACxBC,OAAO,CAACC,IAAI,CAACF,KAAK,CAAC;EACrB,CAAC;EAEDG,+BAA+B,GAAIP,GAAW,IAAK;IACjD,IAAI,IAAI,CAACQ,aAAa,CAACR,GAAG,CAAC,EAAE;MAC3B,IAAI,CAACS,QAAQ,EAAEC,cAAc,GAAGV,GAAG,CAAC;MACpC,OAAO,KAAK;IACd;IACA,OAAO,IAAI;EACb,CAAC;EAEDW,SAAS,GAAIP,KAA0B,IAAK;IAC1C,MAAMQ,SAAS,GAAGC,IAAI,CAACC,KAAK,CAACV,KAAK,CAACW,WAAW,CAACC,IAAI,CAAC;IACpD,IAAIJ,SAAS,CAACK,IAAI,KAAK,aAAa,EAAE;MACpCpB,SAAS,CAACqB,IAAI,CAAC,aAAa,EAAEN,SAAS,CAACO,OAAO,CAAC;IAClD;EACF,CAAC;EAEDjB,SAAS,GAAGA,CAAA,KAAM;IAChB;IACA,IAAI,CAACkB,OAAO,EAAEC,gBAAgB,CAAC;AACnC;AACA,wEAAwEzB,gBAAgB,CAAC0B,UAAU;AACnG;AACA;AACA,wEAAwE1B,gBAAgB,CAAC2B,iBAAiB;AAC1G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["PaymentWidgetController","ElementsWidgetController","linkBuilders","Mode","DeunaLogs","getWidgetController","config","props","widget","mode","callbacks","rest","baseParams","env","environment","publicApiKey","orderToken","userToken","language","sessionId","MODAL","domain","widgetMappers","elements","userInfo","styleFile","behavior","widgetExperience","types","payment","paymentMethods","nextAction","voucher","widgetConfig","controller","url","hidePayButton","info"],"sourceRoot":"../../../src","sources":["helpers/getController.ts"],"mappings":";;AACA,SAASA,uBAAuB,QAAQ,2CAAwC;AAChF,SAASC,wBAAwB,QAAQ,4CAAyC;AAQlF,SAASC,YAAY,QAAQ,2BAAkB;AAC/C,SAASC,IAAI,QAAQ,wBAAqB;AAC1C,SAASC,SAAS,QAAQ,iBAAc;AAwBxC,OAAO,MAAMC,mBAAmB,GAAGA,CACjCC,MAAwB,EACxBC,KAA4D,KACjC;EAC3B,MAAM;IAAEC,MAAM;IAAEC,IAAI;IAAEC,SAAS;IAAE,GAAGC;EAAK,CAAC,GAAGJ,KAAK;EAElD,MAAMK,UAAU,GAAG;IACjBC,GAAG,EAAEP,MAAM,CAACQ,WAAY;IACxBC,YAAY,EAAET,MAAM,CAACS,YAAY;IACjCC,UAAU,EAAEL,IAAI,CAACK,UAAU,IAAI,EAAE;IACjCC,SAAS,EAAEN,IAAI,CAACM,SAAS,IAAI,EAAE;IAC/BC,QAAQ,EAAEP,IAAI,CAACO,QAAQ,IAAI,IAAI;IAC/BC,SAAS,EAAER,IAAI,CAACQ,SAAS,IAAI,EAAE;IAC/BV,IAAI,EAAEA,IAAI,KAAKN,IAAI,CAACiB,KAAK,GAAG,OAAO,GAAG,QAAQ;IAC9C,IAAIT,IAAI,CAACU,MAAM,IAAI;MAAEA,MAAM,EAAEV,IAAI,CAACU;IAAO,CAAC;EAC5C,CAAC;EAED,MAAMC,aAAa,GAAG;IACpBC,QAAQ,EAAEA,CAAA,MAAO;MACf,GAAGX,UAAU;MACbY,QAAQ,EAAEb,IAAI,CAACa,QAAQ;MACvBC,SAAS,EAAEd,IAAI,CAACc,SAAS;MACzBC,QAAQ,EAAEf,IAAI,CAACe,QAAQ;MACvBC,gBAAgB,EAAEhB,IAAI,CAACgB,gBAAgB;MACvCC,KAAK,EAAGrB,KAAK,CAAmCqB;IAClD,CAAC,CAAC;IACFC,OAAO,EAAEA,CAAA,MAAO;MACd,GAAGjB,UAAU;MACbc,QAAQ,EAAEf,IAAI,CAACe,QAAQ;MACvBI,cAAc,EAAGvB,KAAK,CAAkCuB,cAAc;MACtEL,SAAS,EAAEd,IAAI,CAACc;IAClB,CAAC,CAAC;IACFM,UAAU,EAAEA,CAAA,KAAMnB,UAAU;IAC5BoB,OAAO,EAAEA,CAAA,KAAMpB;EACjB,CAAC;EAED,MAAMqB,YAAY,GAAG;IACnBjB,UAAU,EAAEL,IAAI,CAACK,UAAU;IAC3BU,QAAQ,EAAEf,IAAI,CAACe,QAAQ;IACvBT,SAAS,EAAEN,IAAI,CAACM;EAClB,CAAC;EAED,MAAMiB,UAAU,GACd1B,MAAM,KAAK,UAAU,GACjB,IAAIP,wBAAwB,CAACS,SAAS,EAAEuB,YAAY,CAAC,GACrD,IAAIjC,uBAAuB,CAACU,SAAS,EAAEuB,YAAY,CAAC;EAE1DC,UAAU,CAACC,GAAG,GAAGjC,YAAY,CAACM,MAAM,CAAC,CAACc,aAAa,CAACd,MAAM,CAAC,CAAC,CAAC,CAAC;EAC9D0B,UAAU,CAACE,aAAa,GAAGzB,IAAI,CAACyB,aAAa,IAAI,KAAK;EAEtDhC,SAAS,CAACiC,IAAI,CAAC,iBAAiB,EAAEH,UAAU,CAACC,GAAG,CAAC;EAEjD,OAAOD,UAAU;AACnB,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NewTabWebView.d.ts","sourceRoot":"","sources":["../../../../../src/components/NewTabWebView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAIvC,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,eAAO,MAAM,aAAa,GAAI,OAAO,kBAAkB,4CAoDtD,CAAC"}
|
package/lib/typescript/deuna-sdk-react-native/src/controllers/OpenInNewTabController.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OpenInNewTabController.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/OpenInNewTabController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EACL,qBAAqB,EAEtB,MAAM,yBAAyB,CAAC;AAGjC,qBAAa,sBAAuB,SAAQ,qBAAqB;IACnD,QAAQ,CAAC,GAAG,EAAE,MAAM;gBAAX,GAAG,EAAE,MAAM;IAKhC,MAAM,aAEJ;IAEF,OAAO,GAAI,OAAO,GAAG,UAEnB;IAEF,+BAA+B,GAAI,KAAK,MAAM,aAM5C;IAEF,SAAS,GAAI,OAAO,mBAAmB,UAKrC;IAEF,SAAS,aAkBP;CACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getController.d.ts","sourceRoot":"","sources":["../../../../../src/helpers/getController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAG9E,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAG3C,KAAK,4BAA4B,GAAG,uBAAuB,GAAG;IAC5D,MAAM,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF,KAAK,+BAA+B,GAAG,0BAA0B,GAAG;IAClE,MAAM,EAAE,YAAY,CAAC;CACtB,CAAC;AAEF,KAAK,4BAA4B,GAAG,uBAAuB,GAAG;IAC5D,MAAM,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF,KAAK,6BAA6B,GAAG,wBAAwB,GAAG;IAC9D,MAAM,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF,KAAK,eAAe,GAChB,4BAA4B,GAC5B,+BAA+B,GAC/B,4BAA4B,GAC5B,6BAA6B,CAAC;AAElC,eAAO,MAAM,mBAAmB,GAC9B,QAAQ,gBAAgB,EACxB,OAAO,eAAe,GAAG;IAAE,IAAI,CAAC,EAAE,IAAI,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,KAC3D,sBAkDF,CAAC"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { DeunaSDK } from '../DeunaSDK';
|
|
3
|
-
import { Modal, SafeAreaView, StyleSheet } from 'react-native';
|
|
4
|
-
import { DeunaWebView } from './DeunaWebView';
|
|
5
|
-
|
|
6
|
-
interface NewTabWebViewProps {
|
|
7
|
-
instance: DeunaSDK;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const NewTabWebView = (props: NewTabWebViewProps) => {
|
|
11
|
-
const { instance } = props;
|
|
12
|
-
const instanceRef = useRef<DeunaSDK>(instance);
|
|
13
|
-
const [visible, setVisible] = useState(false);
|
|
14
|
-
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
instanceRef.current = instance;
|
|
17
|
-
}, [instance]);
|
|
18
|
-
|
|
19
|
-
// Listen when the DeunaSDK instance configuration
|
|
20
|
-
// has changed
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
const ref = instanceRef.current;
|
|
23
|
-
const listener = () => {
|
|
24
|
-
const isVisible = !!ref.newTabWebViewController;
|
|
25
|
-
setVisible(isVisible);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
instanceRef.current.addListener(listener);
|
|
29
|
-
|
|
30
|
-
return () => {
|
|
31
|
-
ref.removeListener(listener);
|
|
32
|
-
ref.newTabWebViewController?.dispose();
|
|
33
|
-
};
|
|
34
|
-
}, []);
|
|
35
|
-
|
|
36
|
-
const newTabController = instanceRef.current.newTabWebViewController;
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<Modal
|
|
40
|
-
presentationStyle="pageSheet"
|
|
41
|
-
visible={visible}
|
|
42
|
-
animationType="slide"
|
|
43
|
-
onRequestClose={instanceRef.current.onCloseNewTab}
|
|
44
|
-
onDismiss={instanceRef.current.onNewTabDismissed}
|
|
45
|
-
>
|
|
46
|
-
{visible && (
|
|
47
|
-
<SafeAreaView style={styles.container}>
|
|
48
|
-
<DeunaWebView
|
|
49
|
-
url={newTabController?.url ?? ''}
|
|
50
|
-
onWebView={newTabController?.setWebView}
|
|
51
|
-
onMessage={newTabController?.onMessage}
|
|
52
|
-
onLoad={newTabController?.onLoad}
|
|
53
|
-
onError={newTabController?.onError}
|
|
54
|
-
onShouldStartLoadWithRequest={
|
|
55
|
-
newTabController?.onShouldStartLoadWithRequest
|
|
56
|
-
}
|
|
57
|
-
/>
|
|
58
|
-
</SafeAreaView>
|
|
59
|
-
)}
|
|
60
|
-
</Modal>
|
|
61
|
-
);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const styles = StyleSheet.create({ container: { flex: 1 } });
|