@deuna/react-native-sdk 1.0.0 → 1.0.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.
- package/lib/module/DeunaSDK.js +37 -14
- package/lib/module/DeunaSDK.js.map +1 -1
- package/lib/module/components/DeunaWebView.js +2 -1
- package/lib/module/components/DeunaWebView.js.map +1 -1
- package/lib/module/components/DeunaWidget.js +7 -2
- package/lib/module/components/DeunaWidget.js.map +1 -1
- package/lib/module/components/DeviceFingerprintWebView.js +44 -0
- package/lib/module/components/DeviceFingerprintWebView.js.map +1 -0
- package/lib/module/components/NewTabWebView.js +2 -1
- package/lib/module/components/NewTabWebView.js.map +1 -1
- package/lib/module/controllers/BaseWebViewController.js +59 -17
- package/lib/module/controllers/BaseWebViewController.js.map +1 -1
- package/lib/module/controllers/DeviceFingerprintController.js +69 -0
- package/lib/module/controllers/DeviceFingerprintController.js.map +1 -0
- package/lib/module/controllers/OpenInNewTabController.js +24 -8
- package/lib/module/controllers/OpenInNewTabController.js.map +1 -1
- package/lib/module/interfaces/constants.js +1 -0
- package/lib/module/interfaces/constants.js.map +1 -1
- package/lib/module/types/helpers/buildElementsLink.js +63 -48
- package/lib/module/types/helpers/buildElementsLink.js.map +1 -1
- package/lib/module/types/helpers/buildNextActionLink.js +7 -3
- package/lib/module/types/helpers/buildNextActionLink.js.map +1 -1
- package/lib/module/types/helpers/buildPaymentLink.js +1 -3
- package/lib/module/types/helpers/buildPaymentLink.js.map +1 -1
- package/lib/module/types/helpers/buildVoucherLink.js +1 -3
- package/lib/module/types/helpers/buildVoucherLink.js.map +1 -1
- package/lib/typescript/deuna-sdk-react-native/src/DeunaSDK.d.ts +9 -1
- package/lib/typescript/deuna-sdk-react-native/src/DeunaSDK.d.ts.map +1 -1
- package/lib/typescript/deuna-sdk-react-native/src/components/DeunaWebView.d.ts +1 -0
- package/lib/typescript/deuna-sdk-react-native/src/components/DeunaWebView.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/DeviceFingerprintWebView.d.ts +7 -0
- package/lib/typescript/deuna-sdk-react-native/src/components/DeviceFingerprintWebView.d.ts.map +1 -0
- package/lib/typescript/deuna-sdk-react-native/src/components/NewTabWebView.d.ts.map +1 -1
- package/lib/typescript/deuna-sdk-react-native/src/controllers/BaseWebViewController.d.ts +26 -4
- package/lib/typescript/deuna-sdk-react-native/src/controllers/BaseWebViewController.d.ts.map +1 -1
- package/lib/typescript/deuna-sdk-react-native/src/controllers/DeviceFingerprintController.d.ts +15 -0
- package/lib/typescript/deuna-sdk-react-native/src/controllers/DeviceFingerprintController.d.ts.map +1 -0
- package/lib/typescript/deuna-sdk-react-native/src/controllers/OpenInNewTabController.d.ts +2 -2
- package/lib/typescript/deuna-sdk-react-native/src/controllers/OpenInNewTabController.d.ts.map +1 -1
- 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/types/helpers/buildElementsLink.d.ts +5 -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/buildNextActionLink.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/package.json +1 -1
- package/src/DeunaSDK.ts +42 -14
- package/src/components/DeunaWebView.tsx +2 -0
- package/src/components/DeunaWidget.tsx +9 -0
- package/src/components/DeviceFingerprintWebView.tsx +58 -0
- package/src/components/NewTabWebView.tsx +3 -0
- package/src/controllers/BaseWebViewController.ts +76 -19
- package/src/controllers/DeviceFingerprintController.ts +86 -0
- package/src/controllers/OpenInNewTabController.ts +30 -13
- package/src/interfaces/constants.ts +3 -0
- package/src/types/helpers/buildElementsLink.ts +89 -56
- package/src/types/helpers/buildNextActionLink.ts +8 -4
- package/src/types/helpers/buildPaymentLink.ts +1 -4
- package/src/types/helpers/buildVoucherLink.ts +1 -4
|
@@ -2,74 +2,89 @@
|
|
|
2
2
|
|
|
3
3
|
import { hasKey } from "../utils/hasKey.js";
|
|
4
4
|
import { getIntegrationType } from "./urlConfig.js";
|
|
5
|
-
const
|
|
5
|
+
const ELEMENTS_URLS = {
|
|
6
6
|
production: "https://elements.deuna.io",
|
|
7
7
|
sandbox: "https://elements.sandbox.deuna.io",
|
|
8
8
|
staging: "https://elements.stg.deuna.io",
|
|
9
9
|
develop: "https://elements.dev.deuna.io"
|
|
10
10
|
};
|
|
11
|
-
const
|
|
11
|
+
const WIDGET_PATHS = {
|
|
12
12
|
click_to_pay: "/click_to_pay",
|
|
13
13
|
vault: "/vault"
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Builds the base URL for the Elements widget based on environment and domain configuration
|
|
17
|
+
*/
|
|
18
|
+
const buildBaseUrl = config => {
|
|
19
|
+
if (config.domain) {
|
|
20
|
+
return config.domain;
|
|
21
|
+
}
|
|
22
|
+
return config.env ? ELEMENTS_URLS[config.env] : ELEMENTS_URLS.production;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Builds the search parameters for the Elements widget URL
|
|
27
|
+
*/
|
|
28
|
+
const buildSearchParams = config => {
|
|
16
29
|
const {
|
|
17
|
-
env,
|
|
18
|
-
orderToken,
|
|
19
30
|
userInfo,
|
|
20
31
|
userToken,
|
|
21
32
|
widgetExperience,
|
|
22
|
-
|
|
33
|
+
styleFile,
|
|
34
|
+
mode,
|
|
35
|
+
language
|
|
23
36
|
} = config;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
37
|
+
const searchParams = {
|
|
38
|
+
publicApiKey: config.publicApiKey,
|
|
39
|
+
orderToken: config.orderToken,
|
|
40
|
+
email: userInfo?.email || "",
|
|
41
|
+
firstName: userInfo?.firstName || "",
|
|
42
|
+
lastName: userInfo?.lastName || "",
|
|
43
|
+
int: getIntegrationType(mode),
|
|
44
|
+
language
|
|
45
|
+
};
|
|
46
|
+
if (styleFile) {
|
|
47
|
+
searchParams.cssFile = styleFile;
|
|
27
48
|
}
|
|
28
|
-
if (
|
|
29
|
-
|
|
49
|
+
if (userToken) {
|
|
50
|
+
searchParams.userToken = userToken;
|
|
51
|
+
}
|
|
52
|
+
if (widgetExperience?.userExperience?.showSavedCardsFlow) {
|
|
53
|
+
searchParams.showSavedCardsFlow = String(widgetExperience.userExperience.showSavedCardsFlow);
|
|
30
54
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
});
|
|
55
|
+
if (widgetExperience?.userExperience?.defaultCardFlow) {
|
|
56
|
+
searchParams.showDefaultCardFlow = String(widgetExperience.userExperience.defaultCardFlow);
|
|
57
|
+
}
|
|
58
|
+
return new URLSearchParams(searchParams);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Determines the widget path based on the provided types
|
|
63
|
+
*/
|
|
64
|
+
const getWidgetPath = types => {
|
|
65
|
+
if (types && types.length > 0) {
|
|
66
|
+
const firstPath = types[0]?.name;
|
|
67
|
+
return hasKey(WIDGET_PATHS, firstPath) ? WIDGET_PATHS[firstPath] : WIDGET_PATHS.vault;
|
|
68
|
+
}
|
|
69
|
+
return WIDGET_PATHS.vault;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Builds a complete Elements widget URL with all necessary parameters
|
|
74
|
+
* @param config - Configuration object for building the Elements URL
|
|
75
|
+
* @returns The complete Elements widget URL as a string
|
|
76
|
+
*/
|
|
77
|
+
export const buildElementsLink = config => {
|
|
78
|
+
const baseUrl = buildBaseUrl(config);
|
|
79
|
+
const searchParams = buildSearchParams(config);
|
|
57
80
|
const xpropsB64 = {
|
|
58
81
|
id: config.id,
|
|
59
82
|
behavior: config.behavior || {}
|
|
60
83
|
};
|
|
61
|
-
const getWidgetPath = () => {
|
|
62
|
-
if (types && types.length > 0) {
|
|
63
|
-
const firstPath = types[0].name;
|
|
64
|
-
if (hasKey(pathsMapper, firstPath)) {
|
|
65
|
-
return pathsMapper[firstPath];
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return pathsMapper.vault;
|
|
69
|
-
};
|
|
70
84
|
searchParams.append("xpropsB64", btoa(JSON.stringify(xpropsB64)));
|
|
71
|
-
|
|
72
|
-
|
|
85
|
+
const widgetPath = getWidgetPath(config.types);
|
|
86
|
+
const normalizedPath = widgetPath.startsWith("/") ? widgetPath : `/${widgetPath}`;
|
|
87
|
+
const url = new URL(`${baseUrl}${normalizedPath}?${searchParams.toString()}`);
|
|
73
88
|
return url.toString();
|
|
74
89
|
};
|
|
75
90
|
//# sourceMappingURL=buildElementsLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["hasKey","getIntegrationType","
|
|
1
|
+
{"version":3,"names":["hasKey","getIntegrationType","ELEMENTS_URLS","production","sandbox","staging","develop","WIDGET_PATHS","click_to_pay","vault","buildBaseUrl","config","domain","env","buildSearchParams","userInfo","userToken","widgetExperience","styleFile","mode","language","searchParams","publicApiKey","orderToken","email","firstName","lastName","int","cssFile","userExperience","showSavedCardsFlow","String","defaultCardFlow","showDefaultCardFlow","URLSearchParams","getWidgetPath","types","length","firstPath","name","buildElementsLink","baseUrl","xpropsB64","id","behavior","append","btoa","JSON","stringify","widgetPath","normalizedPath","startsWith","url","URL","toString"],"sourceRoot":"../../../../src","sources":["types/helpers/buildElementsLink.ts"],"mappings":";;AACA,SAASA,MAAM,QAAQ,oBAAiB;AACxC,SAASC,kBAAkB,QAAmB,gBAAa;AAE3D,MAAMC,aAA0C,GAAG;EACjDC,UAAU,EAAE,2BAA2B;EACvCC,OAAO,EAAE,mCAAmC;EAC5CC,OAAO,EAAE,+BAA+B;EACxCC,OAAO,EAAE;AACX,CAAU;AAEV,MAAMC,YAAY,GAAG;EACnBC,YAAY,EAAE,eAAe;EAC7BC,KAAK,EAAE;AACT,CAAU;AAkBV;AACA;AACA;AACA,MAAMC,YAAY,GAAIC,MAAiB,IAAa;EAClD,IAAIA,MAAM,CAACC,MAAM,EAAE;IACjB,OAAOD,MAAM,CAACC,MAAM;EACtB;EACA,OAAOD,MAAM,CAACE,GAAG,GAAGX,aAAa,CAACS,MAAM,CAACE,GAAG,CAAC,GAAGX,aAAa,CAACC,UAAU;AAC1E,CAAC;;AAED;AACA;AACA;AACA,MAAMW,iBAAiB,GAAIH,MAAiB,IAAsB;EAChE,MAAM;IAAEI,QAAQ;IAAEC,SAAS;IAAEC,gBAAgB;IAAEC,SAAS;IAAEC,IAAI;IAAEC;EAAS,CAAC,GACxET,MAAM;EAER,MAAMU,YAA0B,GAAG;IACjCC,YAAY,EAAEX,MAAM,CAACW,YAAY;IACjCC,UAAU,EAAEZ,MAAM,CAACY,UAAU;IAC7BC,KAAK,EAAET,QAAQ,EAAES,KAAK,IAAI,EAAE;IAC5BC,SAAS,EAAEV,QAAQ,EAAEU,SAAS,IAAI,EAAE;IACpCC,QAAQ,EAAEX,QAAQ,EAAEW,QAAQ,IAAI,EAAE;IAClCC,GAAG,EAAE1B,kBAAkB,CAACkB,IAAI,CAAC;IAC7BC;EACF,CAAC;EAED,IAAIF,SAAS,EAAE;IACbG,YAAY,CAACO,OAAO,GAAGV,SAAS;EAClC;EAEA,IAAIF,SAAS,EAAE;IACbK,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C,MAAMc,cAAc,GAAGD,UAAU,CAACE,UAAU,CAAC,GAAG,CAAC,GAC7CF,UAAU,GACV,IAAIA,UAAU,EAAE;EAEpB,MAAMG,GAAG,GAAG,IAAIC,GAAG,CAAC,GAAGZ,OAAO,GAAGS,cAAc,IAAI7B,YAAY,CAACiC,QAAQ,CAAC,CAAC,EAAE,CAAC;EAE7E,OAAOF,GAAG,CAACE,QAAQ,CAAC,CAAC;AACvB,CAAC","ignoreList":[]}
|
|
@@ -16,18 +16,22 @@ export const buildNextActionLink = config => {
|
|
|
16
16
|
if (env) {
|
|
17
17
|
baseUrl = urls[env];
|
|
18
18
|
}
|
|
19
|
+
const xpropsB64 = {
|
|
20
|
+
id: config.id
|
|
21
|
+
};
|
|
19
22
|
const searchParams = new URLSearchParams({
|
|
20
23
|
mode: "widget",
|
|
21
24
|
int: getIntegrationType(config.mode),
|
|
22
25
|
language: config.language
|
|
23
26
|
});
|
|
27
|
+
|
|
28
|
+
//encode to base64
|
|
29
|
+
searchParams.append("xpropsB64", btoa(JSON.stringify(xpropsB64)));
|
|
24
30
|
configToQueryParams(config, searchParams);
|
|
25
31
|
if (config.domain) {
|
|
26
32
|
baseUrl = config.domain;
|
|
27
33
|
}
|
|
28
|
-
const url = new URL(baseUrl);
|
|
29
|
-
url.pathname = `/next-action-purchase/${orderToken}`;
|
|
30
|
-
url.search = searchParams.toString();
|
|
34
|
+
const url = new URL(`${baseUrl}/next-action-purchase/${orderToken}?${searchParams.toString()}`);
|
|
31
35
|
return url.toString();
|
|
32
36
|
};
|
|
33
37
|
//# sourceMappingURL=buildNextActionLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["configToQueryParams","getIntegrationType","urls","production","sandbox","staging","develop","buildNextActionLink","config","env","orderToken","baseUrl","searchParams","URLSearchParams","mode","int","language","
|
|
1
|
+
{"version":3,"names":["configToQueryParams","getIntegrationType","urls","production","sandbox","staging","develop","buildNextActionLink","config","env","orderToken","baseUrl","xpropsB64","id","searchParams","URLSearchParams","mode","int","language","append","btoa","JSON","stringify","domain","url","URL","toString"],"sourceRoot":"../../../../src","sources":["types/helpers/buildNextActionLink.ts"],"mappings":";;AACA,SACEA,mBAAmB,EACnBC,kBAAkB,QAEb,gBAAa;AAEpB,MAAMC,IAAiC,GAAG;EACxCC,UAAU,EAAE,sBAAsB;EAClCC,OAAO,EAAE,8BAA8B;EACvCC,OAAO,EAAE,2BAA2B;EACpCC,OAAO,EAAE;AACX,CAAC;AAED,OAAO,MAAMC,mBAAmB,GAAIC,MAAiB,IAAa;EAChE,MAAM;IAAEC,GAAG;IAAEC;EAAW,CAAC,GAAGF,MAAM;EAElC,IAAIG,OAAO,GAAGT,IAAI,CAACC,UAAU;EAE7B,IAAIM,GAAG,EAAE;IACPE,OAAO,GAAGT,IAAI,CAACO,GAAG,CAAC;EACrB;EAEA,MAAMG,SAAS,GAAG;IAChBC,EAAE,EAAEL,MAAM,CAACK;EACb,CAAC;EAED,MAAMC,YAAY,GAAG,IAAIC,eAAe,CAAC;IACvCC,IAAI,EAAE,QAAQ;IACdC,GAAG,EAAEhB,kBAAkB,CAACO,MAAM,CAACQ,IAAI,CAAC;IACpCE,QAAQ,EAAEV,MAAM,CAACU;EACnB,CAAC,CAAC;;EAEF;EACAJ,YAAY,CAACK,MAAM,CAAC,WAAW,EAAEC,IAAI,CAACC,IAAI,CAACC,SAAS,CAACV,SAAS,CAAC,CAAC,CAAC;EAEjEZ,mBAAmB,CAACQ,MAAM,EAAEM,YAAY,CAAC;EAEzC,IAAIN,MAAM,CAACe,MAAM,EAAE;IACjBZ,OAAO,GAAGH,MAAM,CAACe,MAAM;EACzB;EAEA,MAAMC,GAAG,GAAG,IAAIC,GAAG,CAAC,GAAGd,OAAO,yBAAyBD,UAAU,IAAII,YAAY,CAACY,QAAQ,CAAC,CAAC,EAAE,CAAC;EAE/F,OAAOF,GAAG,CAACE,QAAQ,CAAC,CAAC;AACvB,CAAC","ignoreList":[]}
|
|
@@ -46,9 +46,7 @@ export const buildPaymentLink = config => {
|
|
|
46
46
|
|
|
47
47
|
//encode to base64
|
|
48
48
|
searchParams.append("xpropsB64", btoa(JSON.stringify(xpropsB64)));
|
|
49
|
-
const url = new URL(baseUrl);
|
|
50
|
-
url.pathname = `/now/${orderToken}`;
|
|
51
|
-
url.search = searchParams.toString();
|
|
49
|
+
const url = new URL(`${baseUrl}/now/${orderToken}?${searchParams.toString()}`);
|
|
52
50
|
return url.toString();
|
|
53
51
|
};
|
|
54
52
|
//# sourceMappingURL=buildPaymentLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["configToQueryParams","getIntegrationType","urls","production","sandbox","staging","develop","buildPaymentLink","config","env","orderToken","baseUrl","searchParams","URLSearchParams","mode","int","language","xpropsB64","id","paymentMethods","publicApiKey","behavior","cdl","sessionId","domain","append","btoa","JSON","stringify","url","URL","
|
|
1
|
+
{"version":3,"names":["configToQueryParams","getIntegrationType","urls","production","sandbox","staging","develop","buildPaymentLink","config","env","orderToken","baseUrl","searchParams","URLSearchParams","mode","int","language","xpropsB64","id","paymentMethods","publicApiKey","behavior","cdl","sessionId","domain","append","btoa","JSON","stringify","url","URL","toString"],"sourceRoot":"../../../../src","sources":["types/helpers/buildPaymentLink.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAGA,SACEA,mBAAmB,EACnBC,kBAAkB,QAEb,gBAAa;AAEpB,MAAMC,IAAiC,GAAG;EACxCC,UAAU,EAAE,sBAAsB;EAClCC,OAAO,EAAE,8BAA8B;EACvCC,OAAO,EAAE,2BAA2B;EACpCC,OAAO,EAAE;AACX,CAAC;AAED,OAAO,MAAMC,gBAAgB,GAAIC,MAAiB,IAAa;EAC7D,MAAM;IAAEC,GAAG;IAAEC;EAAW,CAAC,GAAGF,MAAM;EAElC,IAAIG,OAAO,GAAGT,IAAI,CAACC,UAAU;EAE7B,IAAIM,GAAG,EAAE;IACPE,OAAO,GAAGT,IAAI,CAACO,GAAG,CAAC;EACrB;EAEA,MAAMG,YAAY,GAAG,IAAIC,eAAe,CAAC;IACvCC,IAAI,EAAE,QAAQ;IACdC,GAAG,EAAEd,kBAAkB,CAACO,MAAM,CAACM,IAAI,CAAC;IACpCE,QAAQ,EAAER,MAAM,CAACQ;EACnB,CAAC,CAAC;;EAEF;;EAEA,MAAMC,SAAS,GAAG;IAChBC,EAAE,EAAEV,MAAM,CAACU,EAAE;IACbC,cAAc,EAAEX,MAAM,CAACW,cAAc;IACrCC,YAAY,EAAEZ,MAAM,CAACY,YAAY;IACjCC,QAAQ,EAAEb,MAAM,CAACa,QAAQ;IACzBC,GAAG,EAAE;MACHC,SAAS,EAAEf,MAAM,CAACe;IACpB;EACF,CAAC;EAEDvB,mBAAmB,CAACQ,MAAM,EAAEI,YAAY,CAAC;EAEzC,IAAIJ,MAAM,CAACgB,MAAM,EAAE;IACjBb,OAAO,GAAGH,MAAM,CAACgB,MAAM;EACzB;;EAEA;EACAZ,YAAY,CAACa,MAAM,CAAC,WAAW,EAAEC,IAAI,CAACC,IAAI,CAACC,SAAS,CAACX,SAAS,CAAC,CAAC,CAAC;EAEjE,MAAMY,GAAG,GAAG,IAAIC,GAAG,CAAC,GAAGnB,OAAO,QAAQD,UAAU,IAAIE,YAAY,CAACmB,QAAQ,CAAC,CAAC,EAAE,CAAC;EAE9E,OAAOF,GAAG,CAACE,QAAQ,CAAC,CAAC;AACvB,CAAC","ignoreList":[]}
|
|
@@ -40,9 +40,7 @@ export const buildVoucherLink = config => {
|
|
|
40
40
|
|
|
41
41
|
//encode to base64
|
|
42
42
|
searchParams.append("xpropsB64", btoa(JSON.stringify(xpropsB64)));
|
|
43
|
-
const url = new URL(baseUrl);
|
|
44
|
-
url.pathname = `/voucher`;
|
|
45
|
-
url.search = searchParams.toString();
|
|
43
|
+
const url = new URL(`${baseUrl}/voucher?${searchParams.toString()}`);
|
|
46
44
|
return url.toString();
|
|
47
45
|
};
|
|
48
46
|
//# sourceMappingURL=buildVoucherLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getIntegrationType","urls","production","sandbox","staging","develop","buildVoucherLink","config","env","orderToken","baseUrl","searchParams","URLSearchParams","mode","int","language","xpropsB64","id","cdl","sessionId","domain","append","btoa","JSON","stringify","url","URL","
|
|
1
|
+
{"version":3,"names":["getIntegrationType","urls","production","sandbox","staging","develop","buildVoucherLink","config","env","orderToken","baseUrl","searchParams","URLSearchParams","mode","int","language","xpropsB64","id","cdl","sessionId","domain","append","btoa","JSON","stringify","url","URL","toString"],"sourceRoot":"../../../../src","sources":["types/helpers/buildVoucherLink.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAGA,SAASA,kBAAkB,QAAmB,gBAAa;AAE3D,MAAMC,IAAiC,GAAG;EACxCC,UAAU,EAAE,sBAAsB;EAClCC,OAAO,EAAE,8BAA8B;EACvCC,OAAO,EAAE,2BAA2B;EACpCC,OAAO,EAAE;AACX,CAAC;AAED,OAAO,MAAMC,gBAAgB,GAAIC,MAAiB,IAAa;EAC7D,MAAM;IAAEC,GAAG;IAAEC;EAAW,CAAC,GAAGF,MAAM;EAElC,IAAIG,OAAO,GAAGT,IAAI,CAACC,UAAU;EAE7B,IAAIM,GAAG,EAAE;IACPE,OAAO,GAAGT,IAAI,CAACO,GAAG,CAAC;EACrB;EAEA,MAAMG,YAAY,GAAG,IAAIC,eAAe,CAAC;IACvCC,IAAI,EAAE,QAAQ;IACdC,GAAG,EAAEd,kBAAkB,CAACO,MAAM,CAACM,IAAI,CAAC;IACpCE,QAAQ,EAAER,MAAM,CAACQ,QAAQ;IACzBN;EACF,CAAC,CAAC;EAEF,MAAMO,SAAS,GAAG;IAChBC,EAAE,EAAEV,MAAM,CAACU,EAAE;IACbC,GAAG,EAAE;MACHC,SAAS,EAAEZ,MAAM,CAACY;IACpB;EACF,CAAC;EAED,IAAIZ,MAAM,CAACa,MAAM,EAAE;IACjBV,OAAO,GAAGH,MAAM,CAACa,MAAM;EACzB;;EAEA;EACAT,YAAY,CAACU,MAAM,CAAC,WAAW,EAAEC,IAAI,CAACC,IAAI,CAACC,SAAS,CAACR,SAAS,CAAC,CAAC,CAAC;EAEjE,MAAMS,GAAG,GAAG,IAAIC,GAAG,CAAC,GAAGhB,OAAO,YAAYC,YAAY,CAACgB,QAAQ,CAAC,CAAC,EAAE,CAAC;EAEpE,OAAOF,GAAG,CAACE,QAAQ,CAAC,CAAC;AACvB,CAAC","ignoreList":[]}
|
|
@@ -2,6 +2,7 @@ import { BaseDeuna, CustomStyles, GetStateFn, InitElementsWidgetParams, Initiali
|
|
|
2
2
|
import { BaseWebViewController, DeunaWebViewController, WebViewDelegate } from './controllers/BaseWebViewController';
|
|
3
3
|
import { Completer } from './helpers/Completer';
|
|
4
4
|
import { Mode, OnDownloadFile } from './interfaces/types';
|
|
5
|
+
import { DeviceFingerprintController } from './controllers/DeviceFingerprintController';
|
|
5
6
|
export declare class DeunaSDK extends BaseDeuna {
|
|
6
7
|
private readonly config;
|
|
7
8
|
constructor(config: InitializeParams);
|
|
@@ -15,10 +16,16 @@ export declare class DeunaSDK extends BaseDeuna {
|
|
|
15
16
|
private listeners;
|
|
16
17
|
webViewController: DeunaWebViewController | null;
|
|
17
18
|
newTabWebViewController: BaseWebViewController | null;
|
|
19
|
+
deviceFingerprintController: DeviceFingerprintController | null;
|
|
18
20
|
modalDismissPromise: Completer<void> | null;
|
|
19
21
|
newTabModalDismissPromise: Completer<void> | null;
|
|
20
22
|
private get safeWebViewController();
|
|
21
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Generates a device fingerprint, creates a invisible webview to get the device fingerprint
|
|
25
|
+
* and returns the device fingerprint
|
|
26
|
+
* @returns The device fingerprint
|
|
27
|
+
*/
|
|
28
|
+
getSessionId: (params?: Record<string, any>) => Promise<string>;
|
|
22
29
|
static initialize(config: InitializeParams): DeunaSDK;
|
|
23
30
|
/**
|
|
24
31
|
* Sets the DEUNA widget controller
|
|
@@ -76,6 +83,7 @@ export declare class DeunaSDK extends BaseDeuna {
|
|
|
76
83
|
addListener: (listener: () => void) => void;
|
|
77
84
|
removeListener: (listener: () => void) => void;
|
|
78
85
|
notifyListeners: () => void;
|
|
86
|
+
private notifyDownloadFile;
|
|
79
87
|
onCloseNewTab: () => void;
|
|
80
88
|
/**
|
|
81
89
|
* Builds the delegate for the DEUNA widget to listen to the events
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeunaSDK.d.ts","sourceRoot":"","sources":["../../../../src/DeunaSDK.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,UAAU,EACV,wBAAwB,EACxB,gBAAgB,EAChB,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,EACvB,OAAO,EACP,IAAI,EACJ,sBAAsB,EACtB,YAAY,EACZ,cAAc,EACd,KAAK,EACL,MAAM,EACN,YAAY,EACZ,sBAAsB,EACvB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAI7C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,
|
|
1
|
+
{"version":3,"file":"DeunaSDK.d.ts","sourceRoot":"","sources":["../../../../src/DeunaSDK.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,UAAU,EACV,wBAAwB,EACxB,gBAAgB,EAChB,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,EACvB,OAAO,EACP,IAAI,EACJ,sBAAsB,EACtB,YAAY,EACZ,cAAc,EACd,KAAK,EACL,MAAM,EACN,YAAY,EACZ,sBAAsB,EACvB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAI7C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAgB,IAAI,EAAE,cAAc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;QACZ,SAAS,EAAE,sBAAsB,GAAG,cAAc,CAAC;KACpD;IAWH;;;;OAIG;IACG,YAAY,CAChB,KAAK,EAAE,wBAAwB,GAAG;QAAE,IAAI,CAAC,EAAE,IAAI,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE;IAWvE;;;;OAIG;IACG,cAAc,CAAC,KAAK,EAAE,0BAA0B,GAAG;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE;IAUvE;;;;OAIG;IACG,iBAAiB,CACrB,KAAK,EAAE,IAAI,CAAC,uBAAuB,EAAE,WAAW,CAAC,GAAG;QAClD,IAAI,EAAE,IAAI,CAAC;QACX,SAAS,EAAE,sBAAsB,GAAG,cAAc,CAAC;KACpD;IAWH,OAAO,QAAa,OAAO,CAAC,OAAO,CAAC,CAElC;IAEF,MAAM,QAAa,OAAO,CAAC,YAAY,CAAC,CAEtC;IAEF,cAAc,GAAU,OAAO,OAAO,CAAC,YAAY,CAAC,KAAG,OAAO,CAAC,IAAI,CAAC,CAElE;IAEF,YAAY,QAAa,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAE3C;IAEF,cAAc,QAAa,OAAO,CAAC,KAAK,CAAC,CAEvC;IAEF;;OAEG;IACH,KAAK,QAAa,OAAO,CAAC,IAAI,CAAC,CAwB7B;IAEF,gBAAgB,aAEd;IAEF,iBAAiB,aAEf;IAEF,WAAW,GAAI,UAAU,MAAM,IAAI,UAEjC;IAEF,cAAc,GAAI,UAAU,MAAM,IAAI,UAEpC;IAEF,eAAe,aAEb;IAEF,OAAO,CAAC,kBAAkB,CAOxB;IAEF,aAAa,aAOX;IAEF;;;;;OAKG;IACH,aAAa,QAAO,eAAe,CAiBjC;CACH"}
|
|
@@ -5,6 +5,7 @@ interface DeunaWebViewProps {
|
|
|
5
5
|
onMessage?: (event: any) => void;
|
|
6
6
|
onLoad?: () => void;
|
|
7
7
|
onError?: (error: any) => void;
|
|
8
|
+
onShouldStartLoadWithRequest?: (request: any) => boolean;
|
|
8
9
|
}
|
|
9
10
|
export declare const DeunaWebView: (props: DeunaWebViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeunaWebView.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeunaWebView.tsx"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,sBAAsB,CAAC;AAG3C,UAAU,iBAAiB;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"DeunaWebView.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeunaWebView.tsx"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,sBAAsB,CAAC;AAG3C,UAAU,iBAAiB;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IAC/B,4BAA4B,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC;CAC1D;AAED,eAAO,MAAM,YAAY,GAAI,OAAO,iBAAiB,4CAwBpD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeunaWidget.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeunaWidget.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"DeunaWidget.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeunaWidget.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAOvC,UAAU,gBAAgB;IACxB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,GAAI,OAAO,gBAAgB,4CAoFlD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DeunaSDK } from '../DeunaSDK';
|
|
2
|
+
interface DeviceFingerprintWebViewProps {
|
|
3
|
+
instance: DeunaSDK;
|
|
4
|
+
}
|
|
5
|
+
export declare const DeviceFingerprintWebView: (props: DeviceFingerprintWebViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=DeviceFingerprintWebView.d.ts.map
|
package/lib/typescript/deuna-sdk-react-native/src/components/DeviceFingerprintWebView.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeviceFingerprintWebView.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeviceFingerprintWebView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAIvC,UAAU,6BAA6B;IACrC,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,eAAO,MAAM,wBAAwB,GACnC,OAAO,6BAA6B,4CA+CrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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"}
|
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
import type WebView from 'react-native-webview';
|
|
2
2
|
import { WebViewMessageEvent } from 'react-native-webview';
|
|
3
3
|
import { ClosedAction, CustomStyles, Json, State, SubmitResult } from '../types';
|
|
4
|
+
import { ShouldStartLoadRequest } from 'react-native-webview/lib/WebViewTypes';
|
|
4
5
|
export interface WebViewDelegate {
|
|
5
6
|
onOpenInNewTab?: (url: string) => void;
|
|
6
7
|
onCloseButtonPressed?: () => void;
|
|
7
8
|
onCloseSubWebView?: () => void;
|
|
9
|
+
onFileDownload?: (url: string) => void;
|
|
10
|
+
onNewTabWindowClose?: () => void;
|
|
8
11
|
}
|
|
9
12
|
export declare enum WebViewEventType {
|
|
10
13
|
consoleLog = "consoleLog",
|
|
11
14
|
eventDispatch = "eventDispatch",
|
|
12
15
|
jsExecutor = "jsExecutor",
|
|
13
16
|
openInNewTab = "openInNewTab",
|
|
14
|
-
redirect = "redirect"
|
|
17
|
+
redirect = "redirect",
|
|
18
|
+
newTabWindowClose = "newTabWindowClose"
|
|
15
19
|
}
|
|
16
20
|
export declare abstract class BaseWebViewController {
|
|
21
|
+
initialized: boolean;
|
|
22
|
+
redirectUrl: string | null;
|
|
17
23
|
webView: WebView | null;
|
|
18
24
|
url: string | null;
|
|
19
25
|
delegate: WebViewDelegate | null;
|
|
20
|
-
|
|
26
|
+
jsExecutor: JsExecutor;
|
|
27
|
+
setWebView: (webView: WebView) => void;
|
|
21
28
|
abstract onMessage: (event: WebViewMessageEvent) => void;
|
|
22
29
|
/**
|
|
23
30
|
* Called when the web view url is loaded successfully
|
|
@@ -27,6 +34,22 @@ export declare abstract class BaseWebViewController {
|
|
|
27
34
|
* Called when the web view fails to load a URL
|
|
28
35
|
*/
|
|
29
36
|
abstract onError: (event: any) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Called when the web view should load a URL in the same web view
|
|
39
|
+
*/
|
|
40
|
+
abstract urlMustBeLoadedInTheSameWebView: (url: string) => boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Checks if the URL is a download URL
|
|
43
|
+
* @param url - The URL to check
|
|
44
|
+
* @returns True if the URL is a download URL, false otherwise
|
|
45
|
+
*/
|
|
46
|
+
isDownloadUrl: (url: string) => boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Determines if a URL should be loaded in the current WebView or opened in a new tab
|
|
49
|
+
* @param request The navigation request details
|
|
50
|
+
* @returns boolean indicating if the URL should be loaded in current WebView
|
|
51
|
+
*/
|
|
52
|
+
onShouldStartLoadWithRequest: (request: ShouldStartLoadRequest) => boolean;
|
|
30
53
|
/**
|
|
31
54
|
* Release the web view resources
|
|
32
55
|
*/
|
|
@@ -36,10 +59,9 @@ export declare abstract class DeunaWebViewController extends BaseWebViewControll
|
|
|
36
59
|
hidePayButton: boolean;
|
|
37
60
|
redirectUrl: string | null;
|
|
38
61
|
closedAction: ClosedAction;
|
|
39
|
-
jsExecutor: JsExecutor;
|
|
40
62
|
abstract onEventDispatch: (event: Record<string, any>) => void;
|
|
41
|
-
setWebView: (webView: WebView) => void;
|
|
42
63
|
onLoad: () => void;
|
|
64
|
+
urlMustBeLoadedInTheSameWebView: (url: string) => boolean;
|
|
43
65
|
onMessage: (event: WebViewMessageEvent) => void;
|
|
44
66
|
setXprops: () => void;
|
|
45
67
|
/**
|
package/lib/typescript/deuna-sdk-react-native/src/controllers/BaseWebViewController.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseWebViewController.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/BaseWebViewController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,IAAI,EACJ,KAAK,EACL,YAAY,EACb,MAAM,UAAU,CAAC;AAGlB,MAAM,WAAW,eAAe;IAC9B,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseWebViewController.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/BaseWebViewController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,IAAI,EACJ,KAAK,EACL,YAAY,EACb,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,MAAM,WAAW,eAAe;IAC9B,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;CAClC;AAED,oBAAY,gBAAgB;IAC1B,UAAU,eAAe;IACzB,aAAa,kBAAkB;IAC/B,UAAU,eAAe;IACzB,YAAY,iBAAiB;IAC7B,QAAQ,aAAa;IACrB,iBAAiB,sBAAsB;CACxC;AAKD,8BAAsB,qBAAqB;IACzC,WAAW,UA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,YAAY,CAAC,KAAG,OAAO,CAAC,IAAI,CAAC,CAIlE;IAEF;;OAEG;IACH,OAAO,QAAa,OAAO,CAAC,OAAO,CAAC,CAUlC;IAEF;;;OAGG;IACH,MAAM,QAAa,OAAO,CAAC,YAAY,CAAC,CAgBtC;IAEF,cAAc,QAAa,OAAO,CAAC,MAAM,CAAC,CA2BxC;CACH;AAED,cAAM,UAAU;IACd,SAAS,SAAK;IACd,OAAO,EAAE,OAAO,GAAG,IAAI,CAAQ;IAC/B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC,CAAa;IAE9E;;;;OAIG;IAEH,OAAO,GAAI,QAAQ,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,CAe7D;CACH"}
|
package/lib/typescript/deuna-sdk-react-native/src/controllers/DeviceFingerprintController.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { WebViewMessageEvent } from 'react-native-webview';
|
|
2
|
+
import { BaseWebViewController } from './BaseWebViewController';
|
|
3
|
+
import { Environment } from '../types';
|
|
4
|
+
export declare class DeviceFingerprintController extends BaseWebViewController {
|
|
5
|
+
private readonly publicApiKey;
|
|
6
|
+
private readonly environment;
|
|
7
|
+
constructor(publicApiKey: string, environment: Environment);
|
|
8
|
+
private completer;
|
|
9
|
+
onMessage: (event: WebViewMessageEvent) => void;
|
|
10
|
+
onLoad: () => void;
|
|
11
|
+
onError: (_: any) => void;
|
|
12
|
+
urlMustBeLoadedInTheSameWebView: (_: string) => boolean;
|
|
13
|
+
generateDeviceFingerprint: (params: Record<string, any>) => Promise<string | null>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=DeviceFingerprintController.d.ts.map
|
package/lib/typescript/deuna-sdk-react-native/src/controllers/DeviceFingerprintController.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeviceFingerprintController.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/DeviceFingerprintController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EACL,qBAAqB,EAEtB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC,qBAAa,2BAA4B,SAAQ,qBAAqB;IAElE,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,WAAW;gBADX,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,WAAW;IAK3C,OAAO,CAAC,SAAS,CAA4B;IAE7C,SAAS,GAAI,OAAO,mBAAmB,UAoBrC;IAEF,MAAM,aAOJ;IAEF,OAAO,GAAI,GAAG,GAAG,UAEf;IAEF,+BAA+B,GAAI,GAAG,MAAM,aAAU;IAEtD,yBAAyB,GACvB,QAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAC1B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA0BvB;CACH"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { WebViewMessageEvent } from 'react-native-webview';
|
|
2
2
|
import { BaseWebViewController } from './BaseWebViewController';
|
|
3
3
|
export declare class OpenInNewTabController extends BaseWebViewController {
|
|
4
4
|
readonly url: string;
|
|
5
5
|
constructor(url: string);
|
|
6
|
-
setWebView: (webView: WebView) => void;
|
|
7
6
|
onLoad: () => void;
|
|
8
7
|
onError: (event: any) => void;
|
|
8
|
+
urlMustBeLoadedInTheSameWebView: (url: string) => boolean;
|
|
9
9
|
onMessage: (event: WebViewMessageEvent) => void;
|
|
10
10
|
setXprops: () => void;
|
|
11
11
|
}
|
package/lib/typescript/deuna-sdk-react-native/src/controllers/OpenInNewTabController.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenInNewTabController.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/OpenInNewTabController.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/interfaces/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;CAIrB,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/interfaces/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;CAIrB,CAAC;AAGF,eAAO,MAAM,sBAAsB,2DAA2D,CAAC"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { UrlConfig } from "./urlConfig";
|
|
2
|
+
/**
|
|
3
|
+
* Builds a complete Elements widget URL with all necessary parameters
|
|
4
|
+
* @param config - Configuration object for building the Elements URL
|
|
5
|
+
* @returns The complete Elements widget URL as a string
|
|
6
|
+
*/
|
|
2
7
|
export declare const buildElementsLink: (config: UrlConfig) => string;
|
|
3
8
|
//# sourceMappingURL=buildElementsLink.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildElementsLink.d.ts","sourceRoot":"","sources":["../../../../../../src/types/helpers/buildElementsLink.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"buildElementsLink.d.ts","sourceRoot":"","sources":["../../../../../../src/types/helpers/buildElementsLink.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsB,SAAS,EAAE,MAAM,aAAa,CAAC;AA6F5D;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,QAAQ,SAAS,KAAG,MAmBrD,CAAC"}
|
package/lib/typescript/deuna-sdk-react-native/src/types/helpers/buildNextActionLink.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildNextActionLink.d.ts","sourceRoot":"","sources":["../../../../../../src/types/helpers/buildNextActionLink.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,SAAS,EACV,MAAM,aAAa,CAAC;AASrB,eAAO,MAAM,mBAAmB,GAAI,QAAQ,SAAS,KAAG,
|
|
1
|
+
{"version":3,"file":"buildNextActionLink.d.ts","sourceRoot":"","sources":["../../../../../../src/types/helpers/buildNextActionLink.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,SAAS,EACV,MAAM,aAAa,CAAC;AASrB,eAAO,MAAM,mBAAmB,GAAI,QAAQ,SAAS,KAAG,MA+BvD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildPaymentLink.d.ts","sourceRoot":"","sources":["../../../../../../src/types/helpers/buildPaymentLink.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAGL,SAAS,EACV,MAAM,aAAa,CAAC;AASrB,eAAO,MAAM,gBAAgB,GAAI,QAAQ,SAAS,KAAG,
|
|
1
|
+
{"version":3,"file":"buildPaymentLink.d.ts","sourceRoot":"","sources":["../../../../../../src/types/helpers/buildPaymentLink.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAGL,SAAS,EACV,MAAM,aAAa,CAAC;AASrB,eAAO,MAAM,gBAAgB,GAAI,QAAQ,SAAS,KAAG,MAuCpD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildVoucherLink.d.ts","sourceRoot":"","sources":["../../../../../../src/types/helpers/buildVoucherLink.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAsB,SAAS,EAAE,MAAM,aAAa,CAAC;AAS5D,eAAO,MAAM,gBAAgB,GAAI,QAAQ,SAAS,KAAG,
|
|
1
|
+
{"version":3,"file":"buildVoucherLink.d.ts","sourceRoot":"","sources":["../../../../../../src/types/helpers/buildVoucherLink.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAsB,SAAS,EAAE,MAAM,aAAa,CAAC;AAS5D,eAAO,MAAM,gBAAgB,GAAI,QAAQ,SAAS,KAAG,MAiCpD,CAAC"}
|
package/package.json
CHANGED
package/src/DeunaSDK.ts
CHANGED
|
@@ -27,8 +27,10 @@ import { OpenInNewTabController } from './controllers/OpenInNewTabController';
|
|
|
27
27
|
import { getWidgetController } from './helpers/getController';
|
|
28
28
|
import { Completer } from './helpers/Completer';
|
|
29
29
|
import { ElementsWidgetController } from './controllers/ElementsWidgetController';
|
|
30
|
-
import { Mode, OnDownloadFile } from './interfaces/types';
|
|
30
|
+
import { DownloadType, Mode, OnDownloadFile } from './interfaces/types';
|
|
31
31
|
import { Platform } from 'react-native';
|
|
32
|
+
import { DeviceFingerprintController } from './controllers/DeviceFingerprintController';
|
|
33
|
+
import { DEVICE_FINGERPRINT_URL } from './interfaces/constants';
|
|
32
34
|
|
|
33
35
|
export class DeunaSDK extends BaseDeuna {
|
|
34
36
|
constructor(private readonly config: InitializeParams) {
|
|
@@ -47,6 +49,7 @@ export class DeunaSDK extends BaseDeuna {
|
|
|
47
49
|
private listeners: Set<() => void> = new Set();
|
|
48
50
|
webViewController: DeunaWebViewController | null = null;
|
|
49
51
|
newTabWebViewController: BaseWebViewController | null = null;
|
|
52
|
+
deviceFingerprintController: DeviceFingerprintController | null = null;
|
|
50
53
|
|
|
51
54
|
modalDismissPromise: Completer<void> | null = null;
|
|
52
55
|
newTabModalDismissPromise: Completer<void> | null = null;
|
|
@@ -61,9 +64,28 @@ export class DeunaSDK extends BaseDeuna {
|
|
|
61
64
|
return this.webViewController;
|
|
62
65
|
}
|
|
63
66
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Generates a device fingerprint, creates a invisible webview to get the device fingerprint
|
|
69
|
+
* and returns the device fingerprint
|
|
70
|
+
* @returns The device fingerprint
|
|
71
|
+
*/
|
|
72
|
+
getSessionId = async (params?: Record<string, any>): Promise<string> => {
|
|
73
|
+
this.deviceFingerprintController = new DeviceFingerprintController(
|
|
74
|
+
this.config.publicApiKey,
|
|
75
|
+
this.config.environment ?? 'production'
|
|
76
|
+
);
|
|
77
|
+
this.deviceFingerprintController.url = DEVICE_FINGERPRINT_URL;
|
|
78
|
+
this.notifyListeners();
|
|
79
|
+
|
|
80
|
+
const deviceFingerprint =
|
|
81
|
+
await this.deviceFingerprintController.generateDeviceFingerprint(
|
|
82
|
+
params ?? {}
|
|
83
|
+
);
|
|
84
|
+
this.deviceFingerprintController?.dispose();
|
|
85
|
+
this.deviceFingerprintController = null;
|
|
86
|
+
this.notifyListeners();
|
|
87
|
+
return deviceFingerprint ?? '';
|
|
88
|
+
};
|
|
67
89
|
|
|
68
90
|
static initialize(config: InitializeParams): DeunaSDK {
|
|
69
91
|
return new DeunaSDK(config);
|
|
@@ -230,6 +252,15 @@ export class DeunaSDK extends BaseDeuna {
|
|
|
230
252
|
this.listeners.forEach((listener) => listener());
|
|
231
253
|
};
|
|
232
254
|
|
|
255
|
+
private notifyDownloadFile = (url: string) => {
|
|
256
|
+
if (this.safeWebViewController instanceof PaymentWidgetController) {
|
|
257
|
+
this.safeWebViewController.callbacks.onDownloadFile?.({
|
|
258
|
+
type: DownloadType.URL,
|
|
259
|
+
data: url,
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
|
|
233
264
|
onCloseNewTab = () => {
|
|
234
265
|
if (this.webViewController) {
|
|
235
266
|
this.webViewController.redirectUrl = null;
|
|
@@ -252,18 +283,15 @@ export class DeunaSDK extends BaseDeuna {
|
|
|
252
283
|
if (Platform.OS === 'ios') {
|
|
253
284
|
this.newTabModalDismissPromise = new Completer<void>();
|
|
254
285
|
}
|
|
286
|
+
this.newTabWebViewController.delegate = {
|
|
287
|
+
onFileDownload: this.notifyDownloadFile,
|
|
288
|
+
onNewTabWindowClose: this.onCloseNewTab,
|
|
289
|
+
};
|
|
255
290
|
this.notifyListeners();
|
|
256
291
|
},
|
|
257
|
-
onCloseButtonPressed:
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
this.close();
|
|
261
|
-
},
|
|
262
|
-
onCloseSubWebView: () => {
|
|
263
|
-
// Close the new tab web view when the DEUNA widget
|
|
264
|
-
// emits an error event or when the purchase is successful
|
|
265
|
-
this.onCloseNewTab();
|
|
266
|
-
},
|
|
292
|
+
onCloseButtonPressed: this.close, // Close the payment widget when the user presses the close button
|
|
293
|
+
onCloseSubWebView: this.onCloseNewTab, // Close the new tab web view when the DEUNA widget emits an error event or when the purchase is successful
|
|
294
|
+
onFileDownload: this.notifyDownloadFile, // Notify the user when a request to download a file is made
|
|
267
295
|
};
|
|
268
296
|
};
|
|
269
297
|
}
|