@frankieone/one-sdk 0.6.6-rc.7 → 0.7.0-alpha
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/README.md +1 -1
- package/dist/commit.txt +2 -2
- package/dist/esm/modules/biometrics/{types/events.d.ts → events.d.ts} +2 -2
- package/dist/esm/modules/biometrics/events.js.map +1 -0
- package/dist/esm/modules/biometrics/index.d.ts +12 -3
- package/dist/esm/modules/biometrics/index.js +58 -75
- package/dist/esm/modules/biometrics/index.js.map +1 -1
- package/dist/esm/modules/biometrics/parseConfiguration.d.ts +2 -4
- package/dist/esm/modules/biometrics/parseConfiguration.js +0 -1
- package/dist/esm/modules/biometrics/parseConfiguration.js.map +1 -1
- package/dist/esm/modules/biometrics/vendors/OcrLabs/Liveness.js.map +1 -0
- package/dist/esm/modules/biometrics/vendors/OcrLabs/index.d.ts +4 -0
- package/dist/esm/modules/biometrics/{wrappers → vendors}/OcrLabs/index.js +15 -20
- package/dist/esm/modules/biometrics/vendors/OcrLabs/index.js.map +1 -0
- package/dist/esm/modules/biometrics/vendors/OcrLabs/nolint_liveness-v3.1.1.min.umd.js.map +1 -0
- package/dist/esm/modules/biometrics/vendors/dummy-biometrics/green-tick-svg.js.map +1 -0
- package/dist/esm/modules/biometrics/vendors/dummy-biometrics/index.d.ts +3 -0
- package/dist/esm/modules/biometrics/{wrappers → vendors}/dummy-biometrics/index.js +10 -16
- package/dist/esm/modules/biometrics/vendors/dummy-biometrics/index.js.map +1 -0
- package/dist/esm/modules/common/index.d.ts +4 -3
- package/dist/esm/modules/common/index.js +4 -3
- package/dist/esm/modules/common/index.js.map +1 -1
- package/dist/esm/modules/common/modules/HOF.d.ts +7 -18
- package/dist/esm/modules/common/modules/HOF.js +26 -9
- package/dist/esm/modules/common/modules/HOF.js.map +1 -1
- package/dist/esm/modules/common/modules/eventHub.d.ts +2 -2
- package/dist/esm/modules/common/modules/vendorLoading.d.ts +69 -45
- package/dist/esm/modules/common/modules/vendorLoading.js +134 -67
- package/dist/esm/modules/common/modules/vendorLoading.js.map +1 -1
- package/dist/esm/modules/common/types/Accessors.d.ts +3 -3
- package/dist/esm/modules/common/types/RecipeConfiguration.js +2 -0
- package/dist/esm/modules/common/types/RecipeConfiguration.js.map +1 -0
- package/dist/esm/modules/configuration.d.ts +18 -0
- package/dist/esm/modules/configuration.js +16 -0
- package/dist/esm/modules/configuration.js.map +1 -0
- package/dist/esm/modules/device/constants.d.ts +1 -1
- package/dist/esm/modules/device/constants.js +8 -1
- package/dist/esm/modules/device/constants.js.map +1 -1
- package/dist/esm/modules/device/{types/events.d.ts → events.d.ts} +3 -4
- package/dist/esm/modules/device/events.js.map +1 -0
- package/dist/esm/modules/device/index.d.ts +22 -3
- package/dist/esm/modules/device/index.js +64 -84
- package/dist/esm/modules/device/index.js.map +1 -1
- package/dist/esm/modules/device/parseConfiguration.d.ts +2 -5
- package/dist/esm/modules/device/parseConfiguration.js +3 -4
- package/dist/esm/modules/device/parseConfiguration.js.map +1 -1
- package/dist/esm/modules/device/vendors/Sardine.d.ts +3 -2
- package/dist/esm/modules/device/vendors/Sardine.js +36 -34
- package/dist/esm/modules/device/vendors/Sardine.js.map +1 -1
- package/dist/esm/modules/device/vendors/Threatmetrix/index.d.ts +3 -2
- package/dist/esm/modules/device/vendors/Threatmetrix/index.js +18 -30
- package/dist/esm/modules/device/vendors/Threatmetrix/index.js.map +1 -1
- package/dist/esm/modules/federation/events.js.map +1 -0
- package/dist/esm/modules/federation/index.d.ts +12 -3
- package/dist/esm/modules/federation/index.js +46 -65
- package/dist/esm/modules/federation/index.js.map +1 -1
- package/dist/esm/modules/federation/parseConfiguration.d.ts +2 -2
- package/dist/esm/modules/federation/parseConfiguration.js +9 -9
- package/dist/esm/modules/federation/parseConfiguration.js.map +1 -1
- package/dist/esm/modules/federation/vendors/Singpass.d.ts +4 -3
- package/dist/esm/modules/federation/vendors/Singpass.js +16 -23
- package/dist/esm/modules/federation/vendors/Singpass.js.map +1 -1
- package/dist/esm/modules/frankie-client/index.d.ts +2 -2
- package/dist/esm/modules/frankie-client/index.js +8 -4
- package/dist/esm/modules/frankie-client/index.js.map +1 -1
- package/dist/esm/modules/index.d.ts +8 -3
- package/dist/esm/modules/index.js +19 -1
- package/dist/esm/modules/index.js.map +1 -1
- package/dist/esm/modules/individual/actions/documents.d.ts +1 -1
- package/dist/esm/modules/individual/actions/emitEvents.d.ts +1 -1
- package/dist/esm/modules/individual/actions/search.d.ts +1 -1
- package/dist/esm/modules/individual/actions/search.js.map +1 -1
- package/dist/esm/modules/individual/actions/submit.d.ts +2 -2
- package/dist/esm/modules/individual/actions/submit.js.map +1 -1
- package/dist/esm/modules/individual/{types/events.d.ts → events.d.ts} +1 -1
- package/dist/esm/modules/individual/events.js.map +1 -0
- package/dist/esm/modules/individual/index.d.ts +29 -2
- package/dist/esm/modules/individual/index.js +66 -67
- package/dist/esm/modules/individual/index.js.map +1 -1
- package/dist/esm/modules/meta.json +1 -1
- package/dist/esm/modules/ocr/actions/start.d.ts +2 -2
- package/dist/esm/modules/ocr/{types/events.d.ts → events.d.ts} +2 -2
- package/dist/esm/modules/ocr/events.js.map +1 -0
- package/dist/esm/modules/ocr/index.d.ts +29 -8
- package/dist/esm/modules/ocr/index.js +45 -52
- package/dist/esm/modules/ocr/index.js.map +1 -1
- package/dist/esm/modules/sdk/index.d.ts +1 -1
- package/dist/esm/modules/sdk/index.js +11 -11
- package/dist/esm/modules/sdk/index.js.map +1 -1
- package/dist/esm/modules/sdk/initialisation/componentLoader.d.ts +1 -1
- package/dist/esm/modules/sdk/initialisation/componentLoader.js +24 -10
- package/dist/esm/modules/sdk/initialisation/componentLoader.js.map +1 -1
- package/dist/esm/modules/sdk/initialisation/configurationParser.d.ts +9 -10
- package/dist/esm/modules/sdk/initialisation/configurationParser.js +39 -20
- package/dist/esm/modules/sdk/initialisation/configurationParser.js.map +1 -1
- package/dist/esm/modules/sdk/initialisation/sharedDependencies.d.ts +2 -3
- package/dist/esm/modules/sdk/initialisation/sharedDependencies.js +6 -4
- package/dist/esm/modules/sdk/initialisation/sharedDependencies.js.map +1 -1
- package/dist/esm/modules/sdk/types/{events.d.ts → globalEvents.d.ts} +2 -2
- package/dist/esm/modules/sdk/types/globalEvents.js +2 -0
- package/dist/esm/modules/sdk/types/globalEvents.js.map +1 -0
- package/dist/esm/modules/sdk/types/index.d.ts +5 -4
- package/dist/esm/modules/sdk/types/index.js +5 -4
- package/dist/esm/modules/sdk/types/index.js.map +1 -1
- package/dist/esm/modules/sdk/types/oneSDK.d.ts +13 -0
- package/dist/esm/modules/sdk/types/oneSDK.js +2 -0
- package/dist/esm/modules/sdk/types/oneSDK.js.map +1 -0
- package/dist/esm/modules/sdk/types/oneSDKModules.d.ts +82 -0
- package/dist/esm/modules/sdk/types/oneSDKModules.js +2 -0
- package/dist/esm/modules/sdk/types/oneSDKModules.js.map +1 -0
- package/dist/esm/modules/sdk/types/{configuration.d.ts → oneSDKParameters.d.ts} +6 -20
- package/dist/esm/modules/sdk/types/oneSDKParameters.js +8 -0
- package/dist/esm/modules/sdk/types/oneSDKParameters.js.map +1 -0
- package/dist/esm/modules/sdk/types/oneSDKVendorWrappers.d.ts +11 -0
- package/dist/esm/modules/sdk/types/oneSDKVendorWrappers.js +2 -0
- package/dist/esm/modules/sdk/types/oneSDKVendorWrappers.js.map +1 -0
- package/dist/esm/modules/session/SessionContext.d.ts +4 -1
- package/dist/esm/modules/session/SessionContext.js +6 -0
- package/dist/esm/modules/session/SessionContext.js.map +1 -1
- package/dist/esm/modules/session/index.d.ts +4 -5
- package/dist/esm/modules/session/index.js +21 -23
- package/dist/esm/modules/session/index.js.map +1 -1
- package/dist/esm/types/Primitives.d.ts +9 -1
- package/dist/esm/types/Utilities.d.ts +12 -0
- package/dist/release.txt +2 -2
- package/dist/umd/biometrics-dummy.js +1 -1
- package/dist/umd/biometrics-dummy.js.map +1 -1
- package/dist/umd/biometrics-ocrlabs.js +1 -1
- package/dist/umd/biometrics-ocrlabs.js.map +1 -1
- package/dist/umd/device-sardine.js +1 -1
- package/dist/umd/device-sardine.js.map +1 -1
- package/dist/umd/device-threatmetrix.js +1 -1
- package/dist/umd/device-threatmetrix.js.map +1 -1
- package/dist/umd/oneSdk.umd.js +1 -1
- package/dist/umd/oneSdk.umd.js.map +1 -1
- package/dist/version.txt +2 -2
- package/package.json +147 -147
- package/dist/esm/modules/biometrics/types/events.js.map +0 -1
- package/dist/esm/modules/biometrics/types/index.d.ts +0 -3
- package/dist/esm/modules/biometrics/types/index.js +0 -4
- package/dist/esm/modules/biometrics/types/index.js.map +0 -1
- package/dist/esm/modules/biometrics/types/module.d.ts +0 -8
- package/dist/esm/modules/biometrics/types/module.js +0 -2
- package/dist/esm/modules/biometrics/types/module.js.map +0 -1
- package/dist/esm/modules/biometrics/types/wrapper.d.ts +0 -19
- package/dist/esm/modules/biometrics/types/wrapper.js +0 -2
- package/dist/esm/modules/biometrics/types/wrapper.js.map +0 -1
- package/dist/esm/modules/biometrics/wrappers/OcrLabs/Liveness.js.map +0 -1
- package/dist/esm/modules/biometrics/wrappers/OcrLabs/index.d.ts +0 -3
- package/dist/esm/modules/biometrics/wrappers/OcrLabs/index.js.map +0 -1
- package/dist/esm/modules/biometrics/wrappers/OcrLabs/nolint_liveness-v3.1.1.min.umd.js.map +0 -1
- package/dist/esm/modules/biometrics/wrappers/dummy-biometrics/green-tick-svg.js.map +0 -1
- package/dist/esm/modules/biometrics/wrappers/dummy-biometrics/index.d.ts +0 -2
- package/dist/esm/modules/biometrics/wrappers/dummy-biometrics/index.js.map +0 -1
- package/dist/esm/modules/common/constants.d.ts +0 -8
- package/dist/esm/modules/common/constants.js +0 -11
- package/dist/esm/modules/common/constants.js.map +0 -1
- package/dist/esm/modules/common/types/Configuration.js +0 -2
- package/dist/esm/modules/common/types/Configuration.js.map +0 -1
- package/dist/esm/modules/device/types/events.js.map +0 -1
- package/dist/esm/modules/device/types/index.d.ts +0 -3
- package/dist/esm/modules/device/types/index.js +0 -4
- package/dist/esm/modules/device/types/index.js.map +0 -1
- package/dist/esm/modules/device/types/module.d.ts +0 -13
- package/dist/esm/modules/device/types/module.js +0 -2
- package/dist/esm/modules/device/types/module.js.map +0 -1
- package/dist/esm/modules/device/types/wrapper.d.ts +0 -34
- package/dist/esm/modules/device/types/wrapper.js +0 -2
- package/dist/esm/modules/device/types/wrapper.js.map +0 -1
- package/dist/esm/modules/federation/types/events.js.map +0 -1
- package/dist/esm/modules/federation/types/module.d.ts +0 -8
- package/dist/esm/modules/federation/types/module.js +0 -2
- package/dist/esm/modules/federation/types/module.js.map +0 -1
- package/dist/esm/modules/federation/types/wrapper.d.ts +0 -18
- package/dist/esm/modules/federation/types/wrapper.js +0 -2
- package/dist/esm/modules/federation/types/wrapper.js.map +0 -1
- package/dist/esm/modules/individual/types/events.js.map +0 -1
- package/dist/esm/modules/individual/types/index.d.ts +0 -2
- package/dist/esm/modules/individual/types/index.js +0 -3
- package/dist/esm/modules/individual/types/index.js.map +0 -1
- package/dist/esm/modules/individual/types/module.d.ts +0 -31
- package/dist/esm/modules/individual/types/module.js +0 -2
- package/dist/esm/modules/individual/types/module.js.map +0 -1
- package/dist/esm/modules/ocr/types/events.js.map +0 -1
- package/dist/esm/modules/ocr/types/index.d.ts +0 -2
- package/dist/esm/modules/ocr/types/index.js +0 -3
- package/dist/esm/modules/ocr/types/index.js.map +0 -1
- package/dist/esm/modules/ocr/types/module.d.ts +0 -26
- package/dist/esm/modules/ocr/types/module.js +0 -2
- package/dist/esm/modules/ocr/types/module.js.map +0 -1
- package/dist/esm/modules/sdk/types/components.d.ts +0 -25
- package/dist/esm/modules/sdk/types/components.js +0 -2
- package/dist/esm/modules/sdk/types/components.js.map +0 -1
- package/dist/esm/modules/sdk/types/configuration.js +0 -38
- package/dist/esm/modules/sdk/types/configuration.js.map +0 -1
- package/dist/esm/modules/sdk/types/events.js +0 -2
- package/dist/esm/modules/sdk/types/events.js.map +0 -1
- package/dist/esm/modules/sdk/types/module.d.ts +0 -16
- package/dist/esm/modules/sdk/types/module.js +0 -2
- package/dist/esm/modules/sdk/types/module.js.map +0 -1
- /package/dist/esm/modules/biometrics/{types/events.js → events.js} +0 -0
- /package/dist/esm/modules/biometrics/{wrappers → vendors}/OcrLabs/Liveness.d.ts +0 -0
- /package/dist/esm/modules/biometrics/{wrappers → vendors}/OcrLabs/Liveness.js +0 -0
- /package/dist/esm/modules/biometrics/{wrappers → vendors}/OcrLabs/nolint_liveness-v3.1.1.min.umd.js +0 -0
- /package/dist/esm/modules/biometrics/{wrappers → vendors}/dummy-biometrics/green-tick-svg.d.ts +0 -0
- /package/dist/esm/modules/biometrics/{wrappers → vendors}/dummy-biometrics/green-tick-svg.js +0 -0
- /package/dist/esm/modules/common/types/{Configuration.d.ts → RecipeConfiguration.d.ts} +0 -0
- /package/dist/esm/modules/device/{types/events.js → events.js} +0 -0
- /package/dist/esm/modules/federation/{types/events.d.ts → events.d.ts} +0 -0
- /package/dist/esm/modules/federation/{types/events.js → events.js} +0 -0
- /package/dist/esm/modules/individual/{types/events.js → events.js} +0 -0
- /package/dist/esm/modules/ocr/{types/events.js → events.js} +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** MODULE TYPES */
|
|
2
|
+
export declare type PublicModuleName = "biometrics" | "device" | "ocr" | "federation";
|
|
3
|
+
export declare type PrivateModuleName = "individual";
|
|
4
|
+
export declare type PreInitialisationModuleName = "session";
|
|
5
|
+
/** MODULES DICTIONARY */
|
|
6
|
+
export declare const ModulesDictionary: {
|
|
7
|
+
readonly biometrics: import("./sdk").ModuleInitialiseFunction<"biometrics", import("./biometrics").BiometricsModuleContext, void>;
|
|
8
|
+
readonly device: import("./sdk").ModuleInitialiseFunction<"device", import("./device").DeviceModuleContext, import("./device").DeviceModuleOptions>;
|
|
9
|
+
readonly ocr: import("./sdk").ModuleInitialiseFunction<"ocr", import("./ocr").OcrModuleContext, void>;
|
|
10
|
+
readonly federation: import("./sdk").ModuleInitialiseFunction<"federation", import("./federation").FederationModuleContext, void>;
|
|
11
|
+
readonly individual: import("./sdk").ModuleInitialiseFunction<"individual", import("./individual").IndividualModuleContext, void>;
|
|
12
|
+
readonly session: import("./sdk").ModuleInitialiseFunction<"session", import("./session/SessionContext").SessionContext, void>;
|
|
13
|
+
};
|
|
14
|
+
export declare type ModulesDictionary = typeof ModulesDictionary;
|
|
15
|
+
export declare type PublicModulesDictionary = Pick<ModulesDictionary, PublicModuleName>;
|
|
16
|
+
export declare type PrivateModulesDictionary = Pick<ModulesDictionary, PrivateModuleName>;
|
|
17
|
+
export declare type PreInitialisationModulesDictionary = Pick<ModulesDictionary, PreInitialisationModuleName>;
|
|
18
|
+
export declare type AllModules = PublicModuleName | PrivateModuleName | PreInitialisationModuleName;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { initialise as biometricsModule } from "./biometrics";
|
|
2
|
+
import { initialise as deviceModule } from "./device";
|
|
3
|
+
import { initialise as federationModule } from "./federation";
|
|
4
|
+
import { initialise as ocrModule } from "./ocr";
|
|
5
|
+
import { initialise as sessionModule } from "./session";
|
|
6
|
+
import { initialise as individualModule } from "./individual";
|
|
7
|
+
/** MODULES DICTIONARY */
|
|
8
|
+
export const ModulesDictionary = {
|
|
9
|
+
biometrics: biometricsModule,
|
|
10
|
+
device: deviceModule,
|
|
11
|
+
ocr: ocrModule,
|
|
12
|
+
federation: federationModule,
|
|
13
|
+
individual: individualModule,
|
|
14
|
+
session: sessionModule,
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../modules/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,UAAU,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,UAAU,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAapE,yBAAyB;AAEzB,MAAM,CAAC,MAAM,iBAAiB,GAAU;IACtC,UAAU,EAAE,gBAAgB;IAC5B,MAAM,EAAE,YAAY;IACpB,GAAG,EAAE,SAAS;IACd,UAAU,EAAE,gBAAgB;IAC5B,UAAU,EAAE,gBAAgB;IAC5B,OAAO,EAAE,aAAa;CACvB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const VendorList: readonly ["sardine", "threatmetrix"];
|
|
2
|
-
export declare const ActivityTypeList: readonly ["REGISTRATION", "LOGIN"];
|
|
2
|
+
export declare const ActivityTypeList: readonly ["REGISTRATION", "LOGIN", "CRYPTO_DEPOSIT", "CRYPTO_WITHDRAWAL", "FIAT_DEPOSIT", "FIAT_WITHDRAWAL"];
|
|
3
3
|
export declare type Vendor = typeof VendorList[number];
|
|
4
4
|
export declare type ActivityType = typeof ActivityTypeList[number];
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
// hard coded list of supported vendors which maps directly to a vendor wrapper
|
|
2
2
|
export const VendorList = ["sardine", "threatmetrix"];
|
|
3
|
-
export const ActivityTypeList = [
|
|
3
|
+
export const ActivityTypeList = [
|
|
4
|
+
"REGISTRATION",
|
|
5
|
+
"LOGIN",
|
|
6
|
+
"CRYPTO_DEPOSIT",
|
|
7
|
+
"CRYPTO_WITHDRAWAL",
|
|
8
|
+
"FIAT_DEPOSIT",
|
|
9
|
+
"FIAT_WITHDRAWAL",
|
|
10
|
+
];
|
|
4
11
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../modules/device/constants.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,MAAM,CAAC,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../modules/device/constants.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,MAAM,CAAC,MAAM,UAAU,GAAU,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;AAC7D,MAAM,CAAC,MAAM,gBAAgB,GAAU;IACrC,cAAc;IACd,OAAO;IACP,gBAAgB;IAChB,mBAAmB;IACnB,cAAc;IACd,iBAAiB;CAClB,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { RecipeConfiguration } from "
|
|
2
|
-
import { ActivityType, Vendor } from "
|
|
3
|
-
import { SessionData } from "./wrapper";
|
|
1
|
+
import { RecipeConfiguration } from "../common";
|
|
2
|
+
import { ActivityType, Vendor } from "./constants";
|
|
4
3
|
export declare type Events = {
|
|
5
4
|
configuration_loaded: [RecipeConfiguration];
|
|
6
5
|
activity_started: [{
|
|
@@ -18,7 +17,7 @@ export declare type Events = {
|
|
|
18
17
|
errorObject: unknown;
|
|
19
18
|
}];
|
|
20
19
|
session_data_generated: [{
|
|
21
|
-
session:
|
|
20
|
+
session: unknown;
|
|
22
21
|
}];
|
|
23
22
|
value_set: [{
|
|
24
23
|
key: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../../modules/device/events.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EventHub } from "../common";
|
|
2
|
+
import { ModuleContext, ModuleInitialiseFunction } from "../sdk";
|
|
3
|
+
import { ActivityType } from "./constants";
|
|
4
|
+
import { Events } from "./events";
|
|
2
5
|
export * from "./constants";
|
|
3
|
-
export * from "./
|
|
4
|
-
export declare const
|
|
6
|
+
export * from "./events";
|
|
7
|
+
export declare const initialise: ModuleInitialiseFunction<"device", DeviceModuleContext, DeviceModuleOptions>;
|
|
8
|
+
export declare type DeviceModuleOptions = {
|
|
9
|
+
activityType: ActivityType;
|
|
10
|
+
};
|
|
11
|
+
export declare type DeviceModuleContext = ModuleContext<{
|
|
12
|
+
start: () => void;
|
|
13
|
+
}, Events>;
|
|
14
|
+
export declare type DeviceWrapperOptions = DeviceModuleOptions & {
|
|
15
|
+
eventHub: EventHub<Events>;
|
|
16
|
+
};
|
|
17
|
+
export declare type DeviceWrapperContext = {
|
|
18
|
+
set<Key extends keyof SetOptions>(key: Key, value: SetOptions[Key]): void;
|
|
19
|
+
};
|
|
20
|
+
export declare type SetOptions = {
|
|
21
|
+
activityType: ActivityType;
|
|
22
|
+
entityId: string;
|
|
23
|
+
};
|
|
@@ -1,89 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { loadAndInitialiseVendor, mkEventHub, mkEventListener } from "../common";
|
|
1
|
+
import { mkEventHub, mkEventListener, mkVendorLoader } from "../common";
|
|
11
2
|
import { validateConfiguration } from "./parseConfiguration";
|
|
12
3
|
export * from "./constants";
|
|
13
|
-
export * from "./
|
|
14
|
-
export const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
65
|
-
vendorContext = context; // TODO: remove this type casting (doesn't work for ts@6.4)
|
|
66
|
-
},
|
|
67
|
-
onError: (error) => {
|
|
68
|
-
globalEventHub.emit("telemetry", {
|
|
69
|
-
eventName: "DEVICE:MOUNT:ERROR",
|
|
70
|
-
data: { vendor: vendorName },
|
|
71
|
-
error,
|
|
72
|
-
});
|
|
73
|
-
},
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
// const startActivity = async (activityType: ActivityType) => {
|
|
77
|
-
// vendorContext.set("activityType", activityType);
|
|
78
|
-
// };
|
|
79
|
-
/** reemit/map/transform events below */
|
|
80
|
-
// value_set: when the value for a field is confirmed by the vendor wrapper to be set
|
|
81
|
-
eventHub.on("value_set", ({ key, value }) => {
|
|
82
|
-
// When activityType is set, emit another more specific event "activity_started"
|
|
83
|
-
if (key === "activityType")
|
|
84
|
-
eventHub.emit("activity_started", { activityType: value });
|
|
4
|
+
export * from "./events";
|
|
5
|
+
export const initialise = (shared, options) => {
|
|
6
|
+
/**
|
|
7
|
+
* All the oneSdk components expose a synchronous "ModuleContext" object whose properties
|
|
8
|
+
* need to be declared outside the asynchronous "main" function. They are then "passed down" to be used by the main function.
|
|
9
|
+
*
|
|
10
|
+
* This keeps all modules initialisation signatures uniform.
|
|
11
|
+
* The "main" function is assynchronous and will return data in form of events.
|
|
12
|
+
*
|
|
13
|
+
* The set function allows customer to make "late" changes to internal module data (after initialisation options).
|
|
14
|
+
* Things such as set "username/email/applicant reference" as soon as they are discovered
|
|
15
|
+
* The on and off functions allow customers to listen for internal lifecycle events
|
|
16
|
+
*/
|
|
17
|
+
const { globalEventHub } = shared;
|
|
18
|
+
// Validate configuration or prevent module initialisation by throwing an exception
|
|
19
|
+
validateConfiguration(shared);
|
|
20
|
+
// Create a new event hub separated from the global event hub to be distributed across the modules's lifecycle
|
|
21
|
+
// Maybe we should just use the one event hub passed in the options object for all the modules of the one sdk?
|
|
22
|
+
const eventHub = mkEventHub();
|
|
23
|
+
const loadVendor = mkVendorLoader({
|
|
24
|
+
vendorName: shared.recipe.deviceCharacteristics.provider.name,
|
|
25
|
+
sharedConfiguration: shared,
|
|
26
|
+
vendorLoader: {
|
|
27
|
+
sardine: () => import(/* webpackChunkName: 'device-sardine' */ "./vendors/Sardine"),
|
|
28
|
+
threatmetrix: () => import(/* webpackChunkName: 'device-threatmetrix' */ "./vendors/Threatmetrix"),
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
/** Define context methods */
|
|
32
|
+
// main will trigger the following procedure
|
|
33
|
+
// - determine vendor from recipe configuration
|
|
34
|
+
// - load vendor sdk (async)
|
|
35
|
+
// - initialise vendor session (async)
|
|
36
|
+
// - initialise vendor sdk (async)
|
|
37
|
+
// - provide vendor context object as soon as sdk is initialised.
|
|
38
|
+
// - Vendor context API is the same for all vendors. All the particularities are implemented within the vendor wrapper
|
|
39
|
+
const start = () => {
|
|
40
|
+
loadVendor({
|
|
41
|
+
vendorWrapperOptions: Object.assign(Object.assign({}, options), { eventHub }),
|
|
42
|
+
onSuccess: (_, { vendorName }) => {
|
|
43
|
+
globalEventHub.emit("telemetry", {
|
|
44
|
+
eventName: "DEVICE:MOUNT",
|
|
45
|
+
data: { vendor: vendorName },
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
onError: (error, { vendorName }) => {
|
|
49
|
+
globalEventHub.emit("telemetry", {
|
|
50
|
+
eventName: "DEVICE:MOUNT:ERROR",
|
|
51
|
+
data: { vendor: vendorName },
|
|
52
|
+
error,
|
|
53
|
+
});
|
|
54
|
+
},
|
|
85
55
|
});
|
|
86
|
-
|
|
87
|
-
|
|
56
|
+
};
|
|
57
|
+
// const startActivity = async (activityType: ActivityType) => {
|
|
58
|
+
// vendorContext.set("activityType", activityType);
|
|
59
|
+
// };
|
|
60
|
+
/** reemit/map/transform events below */
|
|
61
|
+
// value_set: when the value for a field is confirmed by the vendor wrapper to be set
|
|
62
|
+
eventHub.on("value_set", ({ key, value }) => {
|
|
63
|
+
// When activityType is set, emit another more specific event "activity_started"
|
|
64
|
+
if (key === "activityType")
|
|
65
|
+
eventHub.emit("activity_started", { activityType: value });
|
|
66
|
+
});
|
|
67
|
+
return Object.assign(Object.assign({}, mkEventListener(eventHub)), { start });
|
|
88
68
|
};
|
|
89
69
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../modules/device/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../modules/device/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAIvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AAEzB,MAAM,CAAC,MAAM,UAAU,GAAiF,CACtG,MAAM,EACN,OAAO,EACP,EAAE;IACF;;;;;;;;;;OAUG;IACH,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;IAClC,mFAAmF;IACnF,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC9B,8GAA8G;IAC9G,8GAA8G;IAC9G,MAAM,QAAQ,GAAG,UAAU,EAAU,CAAC;IAEtC,MAAM,UAAU,GAAG,cAAc,CAAC;QAChC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,QAAQ,CAAC,IAAI;QAC7D,mBAAmB,EAAE,MAAM;QAC3B,YAAY,EAAE;YACZ,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,wCAAwC,CAAC,mBAAmB,CAAC;YACnF,YAAY,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,6CAA6C,CAAC,wBAAwB,CAAC;SACnG;KACF,CAAC,CAAC;IACH,6BAA6B;IAE7B,4CAA4C;IAC5C,+CAA+C;IAC/C,4BAA4B;IAC5B,yCAAyC;IACzC,kCAAkC;IAClC,oEAAoE;IACpE,sHAAsH;IACtH,MAAM,KAAK,GAAG,GAAG,EAAE;QACjB,UAAU,CAAC;YACT,oBAAoB,kCAAO,OAAO,KAAE,QAAQ,GAAE;YAC9C,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;gBAC/B,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE;oBAC/B,SAAS,EAAE,cAAc;oBACzB,IAAI,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE;iBAC7B,CAAC,CAAC;YACL,CAAC;YACD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;gBACjC,cAAc,CAAC,IAAI,CAAC,WAAW,EAAE;oBAC/B,SAAS,EAAE,oBAAoB;oBAC/B,IAAI,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE;oBAC5B,KAAK;iBACN,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC;IACF,gEAAgE;IAChE,qDAAqD;IACrD,KAAK;IAEL,wCAAwC;IAExC,qFAAqF;IACrF,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE;QAC1C,iFAAiF;QACjF,IAAI,GAAG,KAAK,cAAc;YAAE,QAAQ,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,YAAY,EAAE,KAAqB,EAAE,CAAC,CAAC;IACzG,CAAC,CAAC,CAAC;IAEH,uCACK,eAAe,CAAC,QAAQ,CAAC,KAC5B,KAAK,IACL;AACJ,CAAC,CAAC"}
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
declare type AllConfiguration = BaseModuleOptions & DeviceModuleOptions;
|
|
4
|
-
export declare function validateConfiguration(options: AllConfiguration): AllConfiguration;
|
|
5
|
-
export {};
|
|
1
|
+
import { SharedConfiguration } from "../sdk/types";
|
|
2
|
+
export declare function validateConfiguration(shared: SharedConfiguration): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SdkModes } from "../sdk/types";
|
|
2
|
-
export function validateConfiguration(
|
|
2
|
+
export function validateConfiguration(shared) {
|
|
3
3
|
var _a, _b, _c, _d;
|
|
4
|
-
const { recipe } =
|
|
5
|
-
if (
|
|
4
|
+
const { recipe } = shared;
|
|
5
|
+
if (shared.mode.modeName === SdkModes.DUMMY) {
|
|
6
6
|
throw new Error("There is no implementation for the device component in 'dummy' mode.");
|
|
7
7
|
}
|
|
8
8
|
if (!((_b = (_a = recipe.deviceCharacteristics) === null || _a === void 0 ? void 0 : _a.provider) === null || _b === void 0 ? void 0 : _b.name)) {
|
|
@@ -11,6 +11,5 @@ export function validateConfiguration(options) {
|
|
|
11
11
|
if (!((_d = (_c = recipe.deviceCharacteristics) === null || _c === void 0 ? void 0 : _c.provider) === null || _d === void 0 ? void 0 : _d.environment)) {
|
|
12
12
|
throw new Error(`Your account is missing the environment configuration for the device characteristics provider "${recipe.deviceCharacteristics.provider.name}". Please contact FrankieOne support.`);
|
|
13
13
|
}
|
|
14
|
-
return options;
|
|
15
14
|
}
|
|
16
15
|
//# sourceMappingURL=parseConfiguration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseConfiguration.js","sourceRoot":"","sources":["../../../../modules/device/parseConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"parseConfiguration.js","sourceRoot":"","sources":["../../../../modules/device/parseConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAuB,MAAM,mBAAmB,CAAC;AAElE,MAAM,UAAU,qBAAqB,CAAC,MAA2B;;IAC/D,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAE1B,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,KAAK,EAAE;QAC3C,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAC;KACzF;IACD,IAAI,CAAC,CAAA,MAAA,MAAA,MAAM,CAAC,qBAAqB,0CAAE,QAAQ,0CAAE,IAAI,CAAA,EAAE;QACjD,MAAM,IAAI,KAAK,CACb,+GAA+G,CAChH,CAAC;KACH;IACD,IAAI,CAAC,CAAA,MAAA,MAAA,MAAM,CAAC,qBAAqB,0CAAE,QAAQ,0CAAE,WAAW,CAAA,EAAE;QACxD,MAAM,IAAI,KAAK,CACb,kGAAkG,MAAM,CAAC,qBAAqB,CAAC,QAAQ,CAAC,IAAI,uCAAuC,CACpL,CAAC;KACH;AACH,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { DeviceWrapperContext, DeviceWrapperOptions } from "../../device";
|
|
2
|
+
import { WrapperInitialiseFunction } from "../../sdk";
|
|
3
|
+
export declare const initialise: WrapperInitialiseFunction<DeviceWrapperOptions, DeviceWrapperContext, "async">;
|
|
3
4
|
interface SardineSdkOptions {
|
|
4
5
|
clientId: string;
|
|
5
6
|
userIdHash: string;
|
|
@@ -7,37 +7,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { loadAsyncAsset } from "../../common";
|
|
10
|
+
import { loadAsyncAsset, OneSDKError } from "../../common";
|
|
11
|
+
import { ActivityTypeList } from "../../device";
|
|
11
12
|
import { v4 as uuid } from "uuid";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// listen for events, if there are any in the frontend
|
|
27
|
-
// maybe we should implement our own events by websockets, if no frontend events are emitted
|
|
28
|
-
return sardineContext;
|
|
29
|
-
});
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
33
|
-
function initialiseSardineSession(options) {
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
export const initialise = (shared, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
// create session with backend
|
|
16
|
+
const sessionData = yield initialiseSardineSession(shared);
|
|
17
|
+
options.eventHub.emit("session_data_generated", {
|
|
18
|
+
session: sessionData,
|
|
19
|
+
});
|
|
20
|
+
// initialise sardine sdk
|
|
21
|
+
const sardineContext = yield asyncLoadSardine(shared, options, sessionData);
|
|
22
|
+
// listen for events, if there are any in the frontend
|
|
23
|
+
// maybe we should implement our own events by websockets, if no frontend events are emitted
|
|
24
|
+
return sardineContext;
|
|
25
|
+
});
|
|
26
|
+
function initialiseSardineSession(shared) {
|
|
34
27
|
var _a;
|
|
35
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
29
|
return {
|
|
37
|
-
customerID: (_a =
|
|
38
|
-
frankieClientID:
|
|
30
|
+
customerID: (_a = shared.session.customerChildID) !== null && _a !== void 0 ? _a : shared.session.customerID,
|
|
31
|
+
frankieClientID: shared.recipe.deviceCharacteristics.provider.clientID,
|
|
39
32
|
vendorSessionID: uuid(),
|
|
40
|
-
environment:
|
|
33
|
+
environment: shared.recipe.deviceCharacteristics.provider.environment,
|
|
41
34
|
};
|
|
42
35
|
});
|
|
43
36
|
}
|
|
@@ -46,31 +39,40 @@ function resolveSardineHost(environment) {
|
|
|
46
39
|
return "api.sardine.ai";
|
|
47
40
|
return "api.sandbox.sardine.ai";
|
|
48
41
|
}
|
|
49
|
-
function asyncLoadSardine(options) {
|
|
42
|
+
function asyncLoadSardine(shared, options, sessionData) {
|
|
50
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
const environment =
|
|
44
|
+
const environment = sessionData.environment;
|
|
52
45
|
const sardineHost = resolveSardineHost(environment);
|
|
53
46
|
const url = `https://${sardineHost}/assets/loader.min.js`;
|
|
47
|
+
try {
|
|
48
|
+
z.string()
|
|
49
|
+
.refine((val) => ActivityTypeList.includes(val), {
|
|
50
|
+
message: `Activity Type should be one of the following: [${ActivityTypeList.join(", ")}]`,
|
|
51
|
+
})
|
|
52
|
+
.parse(options.activityType);
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
throw new OneSDKError(e.issues[0].message, { receivedActivityType: options.activityType });
|
|
56
|
+
}
|
|
54
57
|
yield loadAsyncAsset(url);
|
|
55
58
|
const sardineContext = window._Sardine.createContext({
|
|
56
|
-
clientId:
|
|
57
|
-
sessionKey:
|
|
59
|
+
clientId: sessionData.frankieClientID,
|
|
60
|
+
sessionKey: sessionData.vendorSessionID,
|
|
58
61
|
environment,
|
|
59
62
|
parentElement: document.body,
|
|
60
|
-
flow: options.
|
|
63
|
+
flow: options.activityType,
|
|
61
64
|
onDeviceResponse: function (data) {
|
|
62
|
-
options.
|
|
65
|
+
options.eventHub.emit("device_characteristics_extracted", {
|
|
63
66
|
deviceCharacteristics: data,
|
|
64
67
|
});
|
|
65
68
|
},
|
|
66
69
|
});
|
|
67
70
|
return {
|
|
68
|
-
vendor: "sardine",
|
|
69
71
|
set(key, value) {
|
|
70
72
|
const mappedKey = mapF2S[key];
|
|
71
73
|
if (mappedKey) {
|
|
72
74
|
sardineContext.updateConfig({ [mappedKey]: value });
|
|
73
|
-
options.
|
|
75
|
+
options.eventHub.emit("value_set", { key, value });
|
|
74
76
|
}
|
|
75
77
|
},
|
|
76
78
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sardine.js","sourceRoot":"","sources":["../../../../../modules/device/vendors/Sardine.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Sardine.js","sourceRoot":"","sources":["../../../../../modules/device/vendors/Sardine.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { DeviceWrapperContext, DeviceWrapperOptions } from "../../../device";
|
|
2
|
+
import { WrapperInitialiseFunction } from "../../../sdk";
|
|
3
|
+
export declare const initialise: WrapperInitialiseFunction<DeviceWrapperOptions, DeviceWrapperContext, "async">;
|
|
@@ -9,53 +9,41 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { v4 as uuid } from "uuid";
|
|
11
11
|
import { threatmetrix as threatmetrixSdk } from "./nolint_fp-clientlib-v4.js";
|
|
12
|
-
export const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
});
|
|
26
|
-
// listen for events, if there are any in the frontend
|
|
27
|
-
// maybe we should implement our own events by websockets, if no frontend events are emitted
|
|
28
|
-
return threatmetrixContext;
|
|
29
|
-
});
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
function initialiseThreatMetrixSession(options) {
|
|
12
|
+
export const initialise = (shared, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
+
// create session with backend
|
|
14
|
+
const sessionData = yield initialiseThreatMetrixSession(shared);
|
|
15
|
+
options.eventHub.emit("session_data_generated", {
|
|
16
|
+
session: sessionData,
|
|
17
|
+
});
|
|
18
|
+
// initialise threatMetrix sdk
|
|
19
|
+
const threatmetrixContext = yield asyncLoadThreatMetrix(shared, options, sessionData);
|
|
20
|
+
// listen for events, if there are any in the frontend
|
|
21
|
+
// maybe we should implement our own events by websockets, if no frontend events are emitted
|
|
22
|
+
return threatmetrixContext;
|
|
23
|
+
});
|
|
24
|
+
function initialiseThreatMetrixSession(shared) {
|
|
33
25
|
var _a;
|
|
34
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
27
|
return {
|
|
36
|
-
customerID: (_a =
|
|
37
|
-
frankieClientID:
|
|
28
|
+
customerID: (_a = shared.session.customerChildID) !== null && _a !== void 0 ? _a : shared.session.customerID,
|
|
29
|
+
frankieClientID: shared.recipe.deviceCharacteristics.provider.clientID,
|
|
38
30
|
vendorSessionID: uuid(),
|
|
39
31
|
environment: "production",
|
|
40
32
|
};
|
|
41
33
|
});
|
|
42
34
|
}
|
|
43
|
-
function asyncLoadThreatMetrix(
|
|
35
|
+
function asyncLoadThreatMetrix(_1, _2, sessionData) {
|
|
44
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
37
|
// threatmetrix prefers us to ugligy their interface
|
|
46
38
|
// to hide the fact threatmetrix is being used
|
|
47
39
|
// that means that we might need to convert the file below into a module and stactically import it
|
|
48
|
-
const { frankieClientID, vendorSessionID } =
|
|
40
|
+
const { frankieClientID, vendorSessionID } = sessionData;
|
|
49
41
|
threatmetrixSdk.profile("h.online-metrix.net", frankieClientID, vendorSessionID);
|
|
50
42
|
return {
|
|
51
|
-
|
|
52
|
-
set(key, value) {
|
|
43
|
+
set() {
|
|
53
44
|
// Not sure what goes here for threatmetrix
|
|
54
45
|
},
|
|
55
46
|
};
|
|
56
47
|
});
|
|
57
48
|
}
|
|
58
|
-
function emitEventForConfigurationUpdate(key, value, { module: { eventHub } }) {
|
|
59
|
-
eventHub.emit("value_set", { key, value });
|
|
60
|
-
}
|
|
61
49
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../modules/device/vendors/Threatmetrix/index.ts"],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../modules/device/vendors/Threatmetrix/index.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,YAAY,IAAI,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9E,MAAM,CAAC,MAAM,UAAU,GAAmF,CACxG,MAAM,EACN,OAAO,EACP,EAAE;IACF,8BAA8B;IAC9B,MAAM,WAAW,GAAG,MAAM,6BAA6B,CAAC,MAAM,CAAC,CAAC;IAChE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,wBAAwB,EAAE;QAC9C,OAAO,EAAE,WAAW;KACrB,CAAC,CAAC;IACH,8BAA8B;IAC9B,MAAM,mBAAmB,GAAG,MAAM,qBAAqB,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;IACtF,sDAAsD;IACtD,4FAA4F;IAC5F,OAAO,mBAAmB,CAAC;AAC7B,CAAC,CAAA,CAAC;AAOF,SAAe,6BAA6B,CAAC,MAA2B;;;QACtE,OAAO;YACL,UAAU,EAAE,MAAA,MAAM,CAAC,OAAO,CAAC,eAAe,mCAAI,MAAM,CAAC,OAAO,CAAC,UAAU;YACvE,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,QAAQ,CAAC,QAAQ;YACtE,eAAe,EAAE,IAAI,EAAE;YACvB,WAAW,EAAE,YAAY;SAC1B,CAAC;;CACH;AACD,SAAe,qBAAqB,CAClC,EAAuB,EACvB,EAAwB,EACxB,WAAwB;;QAExB,oDAAoD;QACpD,8CAA8C;QAC9C,kGAAkG;QAClG,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,GAAG,WAAW,CAAC;QACzD,eAAe,CAAC,OAAO,CAAC,qBAAqB,EAAE,eAAe,EAAE,eAAe,CAAC,CAAC;QACjF,OAAO;YACL,GAAG;gBACD,2CAA2C;YAC7C,CAAC;SACF,CAAC;IACJ,CAAC;CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../../modules/federation/events.ts"],"names":[],"mappings":""}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { EventHub } from "../common";
|
|
2
|
+
import { ModuleContext, ModuleInitialiseFunction } from "../sdk/types";
|
|
3
|
+
import { EmptyObject } from "../../types/index.js";
|
|
4
|
+
import { Events } from "./events";
|
|
5
|
+
export declare const initialise: ModuleInitialiseFunction<"federation", FederationModuleContext>;
|
|
6
|
+
export declare type FederationModuleContext = ModuleContext<{
|
|
7
|
+
start: () => void;
|
|
8
|
+
}, Events>;
|
|
9
|
+
export declare type FederationWrapperOptions = {
|
|
10
|
+
eventHub: EventHub<Events>;
|
|
11
|
+
};
|
|
12
|
+
export declare type FederationWrapperContext = EmptyObject;
|