@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.
Files changed (212) hide show
  1. package/README.md +1 -1
  2. package/dist/commit.txt +2 -2
  3. package/dist/esm/modules/biometrics/{types/events.d.ts → events.d.ts} +2 -2
  4. package/dist/esm/modules/biometrics/events.js.map +1 -0
  5. package/dist/esm/modules/biometrics/index.d.ts +12 -3
  6. package/dist/esm/modules/biometrics/index.js +58 -75
  7. package/dist/esm/modules/biometrics/index.js.map +1 -1
  8. package/dist/esm/modules/biometrics/parseConfiguration.d.ts +2 -4
  9. package/dist/esm/modules/biometrics/parseConfiguration.js +0 -1
  10. package/dist/esm/modules/biometrics/parseConfiguration.js.map +1 -1
  11. package/dist/esm/modules/biometrics/vendors/OcrLabs/Liveness.js.map +1 -0
  12. package/dist/esm/modules/biometrics/vendors/OcrLabs/index.d.ts +4 -0
  13. package/dist/esm/modules/biometrics/{wrappers → vendors}/OcrLabs/index.js +15 -20
  14. package/dist/esm/modules/biometrics/vendors/OcrLabs/index.js.map +1 -0
  15. package/dist/esm/modules/biometrics/vendors/OcrLabs/nolint_liveness-v3.1.1.min.umd.js.map +1 -0
  16. package/dist/esm/modules/biometrics/vendors/dummy-biometrics/green-tick-svg.js.map +1 -0
  17. package/dist/esm/modules/biometrics/vendors/dummy-biometrics/index.d.ts +3 -0
  18. package/dist/esm/modules/biometrics/{wrappers → vendors}/dummy-biometrics/index.js +10 -16
  19. package/dist/esm/modules/biometrics/vendors/dummy-biometrics/index.js.map +1 -0
  20. package/dist/esm/modules/common/index.d.ts +4 -3
  21. package/dist/esm/modules/common/index.js +4 -3
  22. package/dist/esm/modules/common/index.js.map +1 -1
  23. package/dist/esm/modules/common/modules/HOF.d.ts +7 -18
  24. package/dist/esm/modules/common/modules/HOF.js +26 -9
  25. package/dist/esm/modules/common/modules/HOF.js.map +1 -1
  26. package/dist/esm/modules/common/modules/eventHub.d.ts +2 -2
  27. package/dist/esm/modules/common/modules/vendorLoading.d.ts +69 -45
  28. package/dist/esm/modules/common/modules/vendorLoading.js +134 -67
  29. package/dist/esm/modules/common/modules/vendorLoading.js.map +1 -1
  30. package/dist/esm/modules/common/types/Accessors.d.ts +3 -3
  31. package/dist/esm/modules/common/types/RecipeConfiguration.js +2 -0
  32. package/dist/esm/modules/common/types/RecipeConfiguration.js.map +1 -0
  33. package/dist/esm/modules/configuration.d.ts +18 -0
  34. package/dist/esm/modules/configuration.js +16 -0
  35. package/dist/esm/modules/configuration.js.map +1 -0
  36. package/dist/esm/modules/device/constants.d.ts +1 -1
  37. package/dist/esm/modules/device/constants.js +8 -1
  38. package/dist/esm/modules/device/constants.js.map +1 -1
  39. package/dist/esm/modules/device/{types/events.d.ts → events.d.ts} +3 -4
  40. package/dist/esm/modules/device/events.js.map +1 -0
  41. package/dist/esm/modules/device/index.d.ts +22 -3
  42. package/dist/esm/modules/device/index.js +64 -84
  43. package/dist/esm/modules/device/index.js.map +1 -1
  44. package/dist/esm/modules/device/parseConfiguration.d.ts +2 -5
  45. package/dist/esm/modules/device/parseConfiguration.js +3 -4
  46. package/dist/esm/modules/device/parseConfiguration.js.map +1 -1
  47. package/dist/esm/modules/device/vendors/Sardine.d.ts +3 -2
  48. package/dist/esm/modules/device/vendors/Sardine.js +36 -34
  49. package/dist/esm/modules/device/vendors/Sardine.js.map +1 -1
  50. package/dist/esm/modules/device/vendors/Threatmetrix/index.d.ts +3 -2
  51. package/dist/esm/modules/device/vendors/Threatmetrix/index.js +18 -30
  52. package/dist/esm/modules/device/vendors/Threatmetrix/index.js.map +1 -1
  53. package/dist/esm/modules/federation/events.js.map +1 -0
  54. package/dist/esm/modules/federation/index.d.ts +12 -3
  55. package/dist/esm/modules/federation/index.js +46 -65
  56. package/dist/esm/modules/federation/index.js.map +1 -1
  57. package/dist/esm/modules/federation/parseConfiguration.d.ts +2 -2
  58. package/dist/esm/modules/federation/parseConfiguration.js +9 -9
  59. package/dist/esm/modules/federation/parseConfiguration.js.map +1 -1
  60. package/dist/esm/modules/federation/vendors/Singpass.d.ts +4 -3
  61. package/dist/esm/modules/federation/vendors/Singpass.js +16 -23
  62. package/dist/esm/modules/federation/vendors/Singpass.js.map +1 -1
  63. package/dist/esm/modules/frankie-client/index.d.ts +2 -2
  64. package/dist/esm/modules/frankie-client/index.js +8 -4
  65. package/dist/esm/modules/frankie-client/index.js.map +1 -1
  66. package/dist/esm/modules/index.d.ts +8 -3
  67. package/dist/esm/modules/index.js +19 -1
  68. package/dist/esm/modules/index.js.map +1 -1
  69. package/dist/esm/modules/individual/actions/documents.d.ts +1 -1
  70. package/dist/esm/modules/individual/actions/emitEvents.d.ts +1 -1
  71. package/dist/esm/modules/individual/actions/search.d.ts +1 -1
  72. package/dist/esm/modules/individual/actions/search.js.map +1 -1
  73. package/dist/esm/modules/individual/actions/submit.d.ts +2 -2
  74. package/dist/esm/modules/individual/actions/submit.js.map +1 -1
  75. package/dist/esm/modules/individual/{types/events.d.ts → events.d.ts} +1 -1
  76. package/dist/esm/modules/individual/events.js.map +1 -0
  77. package/dist/esm/modules/individual/index.d.ts +29 -2
  78. package/dist/esm/modules/individual/index.js +66 -67
  79. package/dist/esm/modules/individual/index.js.map +1 -1
  80. package/dist/esm/modules/meta.json +1 -1
  81. package/dist/esm/modules/ocr/actions/start.d.ts +2 -2
  82. package/dist/esm/modules/ocr/{types/events.d.ts → events.d.ts} +2 -2
  83. package/dist/esm/modules/ocr/events.js.map +1 -0
  84. package/dist/esm/modules/ocr/index.d.ts +29 -8
  85. package/dist/esm/modules/ocr/index.js +45 -52
  86. package/dist/esm/modules/ocr/index.js.map +1 -1
  87. package/dist/esm/modules/sdk/index.d.ts +1 -1
  88. package/dist/esm/modules/sdk/index.js +11 -11
  89. package/dist/esm/modules/sdk/index.js.map +1 -1
  90. package/dist/esm/modules/sdk/initialisation/componentLoader.d.ts +1 -1
  91. package/dist/esm/modules/sdk/initialisation/componentLoader.js +24 -10
  92. package/dist/esm/modules/sdk/initialisation/componentLoader.js.map +1 -1
  93. package/dist/esm/modules/sdk/initialisation/configurationParser.d.ts +9 -10
  94. package/dist/esm/modules/sdk/initialisation/configurationParser.js +39 -20
  95. package/dist/esm/modules/sdk/initialisation/configurationParser.js.map +1 -1
  96. package/dist/esm/modules/sdk/initialisation/sharedDependencies.d.ts +2 -3
  97. package/dist/esm/modules/sdk/initialisation/sharedDependencies.js +6 -4
  98. package/dist/esm/modules/sdk/initialisation/sharedDependencies.js.map +1 -1
  99. package/dist/esm/modules/sdk/types/{events.d.ts → globalEvents.d.ts} +2 -2
  100. package/dist/esm/modules/sdk/types/globalEvents.js +2 -0
  101. package/dist/esm/modules/sdk/types/globalEvents.js.map +1 -0
  102. package/dist/esm/modules/sdk/types/index.d.ts +5 -4
  103. package/dist/esm/modules/sdk/types/index.js +5 -4
  104. package/dist/esm/modules/sdk/types/index.js.map +1 -1
  105. package/dist/esm/modules/sdk/types/oneSDK.d.ts +13 -0
  106. package/dist/esm/modules/sdk/types/oneSDK.js +2 -0
  107. package/dist/esm/modules/sdk/types/oneSDK.js.map +1 -0
  108. package/dist/esm/modules/sdk/types/oneSDKModules.d.ts +82 -0
  109. package/dist/esm/modules/sdk/types/oneSDKModules.js +2 -0
  110. package/dist/esm/modules/sdk/types/oneSDKModules.js.map +1 -0
  111. package/dist/esm/modules/sdk/types/{configuration.d.ts → oneSDKParameters.d.ts} +6 -20
  112. package/dist/esm/modules/sdk/types/oneSDKParameters.js +8 -0
  113. package/dist/esm/modules/sdk/types/oneSDKParameters.js.map +1 -0
  114. package/dist/esm/modules/sdk/types/oneSDKVendorWrappers.d.ts +11 -0
  115. package/dist/esm/modules/sdk/types/oneSDKVendorWrappers.js +2 -0
  116. package/dist/esm/modules/sdk/types/oneSDKVendorWrappers.js.map +1 -0
  117. package/dist/esm/modules/session/SessionContext.d.ts +4 -1
  118. package/dist/esm/modules/session/SessionContext.js +6 -0
  119. package/dist/esm/modules/session/SessionContext.js.map +1 -1
  120. package/dist/esm/modules/session/index.d.ts +4 -5
  121. package/dist/esm/modules/session/index.js +21 -23
  122. package/dist/esm/modules/session/index.js.map +1 -1
  123. package/dist/esm/types/Primitives.d.ts +9 -1
  124. package/dist/esm/types/Utilities.d.ts +12 -0
  125. package/dist/release.txt +2 -2
  126. package/dist/umd/biometrics-dummy.js +1 -1
  127. package/dist/umd/biometrics-dummy.js.map +1 -1
  128. package/dist/umd/biometrics-ocrlabs.js +1 -1
  129. package/dist/umd/biometrics-ocrlabs.js.map +1 -1
  130. package/dist/umd/device-sardine.js +1 -1
  131. package/dist/umd/device-sardine.js.map +1 -1
  132. package/dist/umd/device-threatmetrix.js +1 -1
  133. package/dist/umd/device-threatmetrix.js.map +1 -1
  134. package/dist/umd/oneSdk.umd.js +1 -1
  135. package/dist/umd/oneSdk.umd.js.map +1 -1
  136. package/dist/version.txt +2 -2
  137. package/package.json +147 -147
  138. package/dist/esm/modules/biometrics/types/events.js.map +0 -1
  139. package/dist/esm/modules/biometrics/types/index.d.ts +0 -3
  140. package/dist/esm/modules/biometrics/types/index.js +0 -4
  141. package/dist/esm/modules/biometrics/types/index.js.map +0 -1
  142. package/dist/esm/modules/biometrics/types/module.d.ts +0 -8
  143. package/dist/esm/modules/biometrics/types/module.js +0 -2
  144. package/dist/esm/modules/biometrics/types/module.js.map +0 -1
  145. package/dist/esm/modules/biometrics/types/wrapper.d.ts +0 -19
  146. package/dist/esm/modules/biometrics/types/wrapper.js +0 -2
  147. package/dist/esm/modules/biometrics/types/wrapper.js.map +0 -1
  148. package/dist/esm/modules/biometrics/wrappers/OcrLabs/Liveness.js.map +0 -1
  149. package/dist/esm/modules/biometrics/wrappers/OcrLabs/index.d.ts +0 -3
  150. package/dist/esm/modules/biometrics/wrappers/OcrLabs/index.js.map +0 -1
  151. package/dist/esm/modules/biometrics/wrappers/OcrLabs/nolint_liveness-v3.1.1.min.umd.js.map +0 -1
  152. package/dist/esm/modules/biometrics/wrappers/dummy-biometrics/green-tick-svg.js.map +0 -1
  153. package/dist/esm/modules/biometrics/wrappers/dummy-biometrics/index.d.ts +0 -2
  154. package/dist/esm/modules/biometrics/wrappers/dummy-biometrics/index.js.map +0 -1
  155. package/dist/esm/modules/common/constants.d.ts +0 -8
  156. package/dist/esm/modules/common/constants.js +0 -11
  157. package/dist/esm/modules/common/constants.js.map +0 -1
  158. package/dist/esm/modules/common/types/Configuration.js +0 -2
  159. package/dist/esm/modules/common/types/Configuration.js.map +0 -1
  160. package/dist/esm/modules/device/types/events.js.map +0 -1
  161. package/dist/esm/modules/device/types/index.d.ts +0 -3
  162. package/dist/esm/modules/device/types/index.js +0 -4
  163. package/dist/esm/modules/device/types/index.js.map +0 -1
  164. package/dist/esm/modules/device/types/module.d.ts +0 -13
  165. package/dist/esm/modules/device/types/module.js +0 -2
  166. package/dist/esm/modules/device/types/module.js.map +0 -1
  167. package/dist/esm/modules/device/types/wrapper.d.ts +0 -34
  168. package/dist/esm/modules/device/types/wrapper.js +0 -2
  169. package/dist/esm/modules/device/types/wrapper.js.map +0 -1
  170. package/dist/esm/modules/federation/types/events.js.map +0 -1
  171. package/dist/esm/modules/federation/types/module.d.ts +0 -8
  172. package/dist/esm/modules/federation/types/module.js +0 -2
  173. package/dist/esm/modules/federation/types/module.js.map +0 -1
  174. package/dist/esm/modules/federation/types/wrapper.d.ts +0 -18
  175. package/dist/esm/modules/federation/types/wrapper.js +0 -2
  176. package/dist/esm/modules/federation/types/wrapper.js.map +0 -1
  177. package/dist/esm/modules/individual/types/events.js.map +0 -1
  178. package/dist/esm/modules/individual/types/index.d.ts +0 -2
  179. package/dist/esm/modules/individual/types/index.js +0 -3
  180. package/dist/esm/modules/individual/types/index.js.map +0 -1
  181. package/dist/esm/modules/individual/types/module.d.ts +0 -31
  182. package/dist/esm/modules/individual/types/module.js +0 -2
  183. package/dist/esm/modules/individual/types/module.js.map +0 -1
  184. package/dist/esm/modules/ocr/types/events.js.map +0 -1
  185. package/dist/esm/modules/ocr/types/index.d.ts +0 -2
  186. package/dist/esm/modules/ocr/types/index.js +0 -3
  187. package/dist/esm/modules/ocr/types/index.js.map +0 -1
  188. package/dist/esm/modules/ocr/types/module.d.ts +0 -26
  189. package/dist/esm/modules/ocr/types/module.js +0 -2
  190. package/dist/esm/modules/ocr/types/module.js.map +0 -1
  191. package/dist/esm/modules/sdk/types/components.d.ts +0 -25
  192. package/dist/esm/modules/sdk/types/components.js +0 -2
  193. package/dist/esm/modules/sdk/types/components.js.map +0 -1
  194. package/dist/esm/modules/sdk/types/configuration.js +0 -38
  195. package/dist/esm/modules/sdk/types/configuration.js.map +0 -1
  196. package/dist/esm/modules/sdk/types/events.js +0 -2
  197. package/dist/esm/modules/sdk/types/events.js.map +0 -1
  198. package/dist/esm/modules/sdk/types/module.d.ts +0 -16
  199. package/dist/esm/modules/sdk/types/module.js +0 -2
  200. package/dist/esm/modules/sdk/types/module.js.map +0 -1
  201. /package/dist/esm/modules/biometrics/{types/events.js → events.js} +0 -0
  202. /package/dist/esm/modules/biometrics/{wrappers → vendors}/OcrLabs/Liveness.d.ts +0 -0
  203. /package/dist/esm/modules/biometrics/{wrappers → vendors}/OcrLabs/Liveness.js +0 -0
  204. /package/dist/esm/modules/biometrics/{wrappers → vendors}/OcrLabs/nolint_liveness-v3.1.1.min.umd.js +0 -0
  205. /package/dist/esm/modules/biometrics/{wrappers → vendors}/dummy-biometrics/green-tick-svg.d.ts +0 -0
  206. /package/dist/esm/modules/biometrics/{wrappers → vendors}/dummy-biometrics/green-tick-svg.js +0 -0
  207. /package/dist/esm/modules/common/types/{Configuration.d.ts → RecipeConfiguration.d.ts} +0 -0
  208. /package/dist/esm/modules/device/{types/events.js → events.js} +0 -0
  209. /package/dist/esm/modules/federation/{types/events.d.ts → events.d.ts} +0 -0
  210. /package/dist/esm/modules/federation/{types/events.js → events.js} +0 -0
  211. /package/dist/esm/modules/individual/{types/events.js → events.js} +0 -0
  212. /package/dist/esm/modules/ocr/{types/events.js → events.js} +0 -0
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunkOneSdk=self.webpackChunkOneSdk||[]).push([[513],{6661:(e,n,i)=>{i.r(n),i.d(n,{wrapper:()=>r});var t=i(6186),s=i(4586),o=function(e,n,i,t){return new(i||(i=Promise))((function(s,o){function r(e){try{a(t.next(e))}catch(e){o(e)}}function c(e){try{a(t.throw(e))}catch(e){o(e)}}function a(e){var n;e.done?s(e.value):(n=e.value,n instanceof i?n:new i((function(e){e(n)}))).then(r,c)}a((t=t.apply(e,n||[])).next())}))};const r={vendor:"sardine",initialise(e){return o(this,void 0,void 0,(function*(){const n=yield function(e){var n;return o(this,void 0,void 0,(function*(){return{customerID:null!==(n=e.session.customerChildID)&&void 0!==n?n:e.session.customerID,frankieClientID:e.recipe.deviceCharacteristics.provider.clientID,vendorSessionID:(0,s.Z)(),environment:e.recipe.deviceCharacteristics.provider.environment}}))}(e);e.eventHub.emit("session_data_generated",{session:n});const i=yield function(e){return o(this,void 0,void 0,(function*(){const n=e.session.environment,i=function(e){return"production"===e?"api.sardine.ai":"api.sandbox.sardine.ai"}(n),s=`https://${i}/assets/loader.min.js`;yield(0,t.loadAsyncAsset)(s);const o=window._Sardine.createContext({clientId:e.session.frankieClientID,sessionKey:e.session.vendorSessionID,environment:n,parentElement:document.body,flow:e.module.activityType,onDeviceResponse:function(n){e.module.eventHub.emit("device_characteristics_extracted",{deviceCharacteristics:n})}});return{vendor:"sardine",set(n,i){const t=c[n];t&&(o.updateConfig({[t]:i}),e.module.eventHub.emit("value_set",{key:n,value:i}))}}}))}({module:e,session:n});return i}))}},c={entityId:"userIdHash",activityType:"flow"}}}]);
1
+ "use strict";(self.webpackChunkOneSdk=self.webpackChunkOneSdk||[]).push([[513],{6661:(e,n,i)=>{i.r(n),i.d(n,{initialise:()=>a});var t=i(8845),s=i(1633),o=i(4586),r=i(1604),c=function(e,n,i,t){return new(i||(i=Promise))((function(s,o){function r(e){try{a(t.next(e))}catch(e){o(e)}}function c(e){try{a(t.throw(e))}catch(e){o(e)}}function a(e){var n;e.done?s(e.value):(n=e.value,n instanceof i?n:new i((function(e){e(n)}))).then(r,c)}a((t=t.apply(e,n||[])).next())}))};const a=(e,n)=>c(void 0,void 0,void 0,(function*(){const i=yield function(e){var n;return c(this,void 0,void 0,(function*(){return{customerID:null!==(n=e.session.customerChildID)&&void 0!==n?n:e.session.customerID,frankieClientID:e.recipe.deviceCharacteristics.provider.clientID,vendorSessionID:(0,o.Z)(),environment:e.recipe.deviceCharacteristics.provider.environment}}))}(e);n.eventHub.emit("session_data_generated",{session:i});const a=yield function(e,n,i){return c(this,void 0,void 0,(function*(){const e=i.environment,o=function(e){return"production"===e?"api.sardine.ai":"api.sandbox.sardine.ai"}(e),c=`https://${o}/assets/loader.min.js`;try{r.z.string().refine((e=>s.Z8.includes(e)),{message:`Activity Type should be one of the following: [${s.Z8.join(", ")}]`}).parse(n.activityType)}catch(e){throw new t.OneSDKError(e.issues[0].message,{receivedActivityType:n.activityType})}yield(0,t.loadAsyncAsset)(c);const a=window._Sardine.createContext({clientId:i.frankieClientID,sessionKey:i.vendorSessionID,environment:e,parentElement:document.body,flow:n.activityType,onDeviceResponse:function(e){n.eventHub.emit("device_characteristics_extracted",{deviceCharacteristics:e})}});return{set(e,i){const t=d[e];t&&(a.updateConfig({[t]:i}),n.eventHub.emit("value_set",{key:e,value:i}))}}}))}(0,n,i);return a})),d={entityId:"userIdHash",activityType:"flow"}}}]);
2
2
  //# sourceMappingURL=device-sardine.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"device-sardine.js","mappings":"2bAIO,MAAMA,EAAyB,CACpCC,OAAQ,UACFC,WAAWC,G,yCAEf,MAAMC,QAgBV,SAAwCD,G,+CACtC,MAAO,CACLE,WAA2C,QAA/B,EAAAF,EAAQG,QAAQC,uBAAe,QAAIJ,EAAQG,QAAQD,WAC/DG,gBAAiBL,EAAQM,OAAOC,sBAAsBC,SAASC,SAC/DC,iBAAiB,SACjBC,YAAaX,EAAQM,OAAOC,sBAAsBC,SAASG,Y,IArBjCC,CAAyBZ,GACnDA,EAAQa,SAASC,KAAK,yBAA0B,CAC9CX,QAASF,IAGX,MAAMc,QAuBV,SAAgCf,G,yCAC9B,MAAMW,EAAcX,EAAQG,QAAQQ,YAC9BK,EANR,SAA4BL,GAC1B,MAAoB,eAAhBA,EAAqC,iBAClC,wBACT,CAGsBM,CAAmBN,GACjCO,EAAM,WAAWF,+BACjB,IAAAG,gBAAeD,GACrB,MAAMH,EAAiBK,OAAOC,SAASC,cAAc,CACnDC,SAAUvB,EAAQG,QAAQE,gBAC1BmB,WAAYxB,EAAQG,QAAQO,gBAC5BC,cACAc,cAAeC,SAASC,KACxBC,KAAM5B,EAAQ6B,OAAOC,aACrBC,iBAAkB,SAAUC,GAC1BhC,EAAQ6B,OAAOhB,SAASC,KAAK,mCAAoC,CAC/DP,sBAAuByB,GAE3B,IAEF,MAAO,CACLlC,OAAQ,UACRmC,IAAIC,EAAKC,GACP,MAAMC,EAAYC,EAAOH,GACrBE,IACFrB,EAAeuB,aAAa,CAAE,CAACF,GAAYD,IAC3CnC,EAAQ6B,OAAOhB,SAASC,KAAK,YAAa,CAAEoB,MAAKC,UAErD,EAEJ,G,CAlDiCI,CAAiB,CAC5CV,OAAQ7B,EACRG,QAASF,IAIX,OAAOc,CACT,G,GA4CIsB,EAAS,CACbG,SAAU,aACVV,aAAc,O","sources":["webpack://OneSdk/./modules/device/vendors/Sardine.ts"],"sourcesContent":["import { loadAsyncAsset } from \"@module/common\";\nimport { v4 as uuid } from \"uuid\";\nimport { SessionData, VendorContext, VendorLoaderOptions, VendorOptions, VendorWrapper } from \"../types\";\n\nexport const wrapper: VendorWrapper = {\n vendor: \"sardine\",\n async initialise(options: VendorOptions): Promise<VendorContext> {\n // create session with backend\n const sessionData = await initialiseSardineSession(options);\n options.eventHub.emit(\"session_data_generated\", {\n session: sessionData,\n });\n // initialise sardine sdk\n const sardineContext = await asyncLoadSardine({\n module: options,\n session: sessionData,\n });\n // listen for events, if there are any in the frontend\n // maybe we should implement our own events by websockets, if no frontend events are emitted\n return sardineContext;\n },\n};\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nasync function initialiseSardineSession(options: VendorOptions): Promise<SessionData> {\n return {\n customerID: options.session.customerChildID ?? options.session.customerID,\n frankieClientID: options.recipe.deviceCharacteristics.provider.clientID,\n vendorSessionID: uuid(),\n environment: options.recipe.deviceCharacteristics.provider.environment,\n };\n}\nfunction resolveSardineHost(environment: SardineEnvironment) {\n if (environment === \"production\") return \"api.sardine.ai\";\n return \"api.sandbox.sardine.ai\";\n}\nasync function asyncLoadSardine(options: VendorLoaderOptions): Promise<VendorContext> {\n const environment = options.session.environment as SardineEnvironment;\n const sardineHost = resolveSardineHost(environment);\n const url = `https://${sardineHost}/assets/loader.min.js`;\n await loadAsyncAsset(url);\n const sardineContext = window._Sardine.createContext({\n clientId: options.session.frankieClientID,\n sessionKey: options.session.vendorSessionID,\n environment,\n parentElement: document.body,\n flow: options.module.activityType,\n onDeviceResponse: function (data: Record<string, string | number | object>) {\n options.module.eventHub.emit(\"device_characteristics_extracted\", {\n deviceCharacteristics: data,\n });\n },\n });\n return {\n vendor: \"sardine\",\n set(key, value) {\n const mappedKey = mapF2S[key];\n if (mappedKey) {\n sardineContext.updateConfig({ [mappedKey]: value });\n options.module.eventHub.emit(\"value_set\", { key, value });\n }\n },\n };\n}\nconst mapF2S = {\n entityId: \"userIdHash\",\n activityType: \"flow\",\n};\n\n// Sardine specific types\n// Initialisation options that Sardine SDK expects (not all required)\ninterface SardineSdkOptions {\n clientId: string;\n userIdHash: string;\n flow: string;\n partnerID: string;\n sessionKey: string;\n}\ninterface InitialisationOptions extends SardineSdkOptions {\n onDeviceResponse: (d: unknown) => void;\n environment: SardineEnvironment;\n parentElement: HTMLElement;\n}\nexport type SardineEnvironment = \"production\" | \"sandbox\";\ndeclare global {\n interface Window {\n _Sardine: {\n createContext(args: Partial<InitialisationOptions>): {\n updateConfig(config: Partial<SardineSdkOptions>): void;\n };\n };\n }\n}\n"],"names":["wrapper","vendor","initialise","options","sessionData","customerID","session","customerChildID","frankieClientID","recipe","deviceCharacteristics","provider","clientID","vendorSessionID","environment","initialiseSardineSession","eventHub","emit","sardineContext","sardineHost","resolveSardineHost","url","loadAsyncAsset","window","_Sardine","createContext","clientId","sessionKey","parentElement","document","body","flow","module","activityType","onDeviceResponse","data","set","key","value","mappedKey","mapF2S","updateConfig","asyncLoadSardine","entityId"],"sourceRoot":""}
1
+ {"version":3,"file":"device-sardine.js","mappings":"kdAMO,MAAMA,EAA6F,CACxGC,EACAC,IACG,OAAD,6BAEF,MAAMC,QAgBR,SAAwCF,G,+CACtC,MAAO,CACLG,WAA0C,QAA9B,EAAAH,EAAOI,QAAQC,uBAAe,QAAIL,EAAOI,QAAQD,WAC7DG,gBAAiBN,EAAOO,OAAOC,sBAAsBC,SAASC,SAC9DC,iBAAiB,SACjBC,YAAaZ,EAAOO,OAAOC,sBAAsBC,SAASG,Y,IArBlCC,CAAyBb,GACnDC,EAAQa,SAASC,KAAK,yBAA0B,CAC9CX,QAASF,IAGX,MAAMc,QAuBR,SACEhB,EACAC,EACAC,G,yCAEA,MAAMU,EAAkCV,EAAYU,YAC9CK,EAVR,SAA4BL,GAC1B,MAAoB,eAAhBA,EAAqC,iBAClC,wBACT,CAOsBM,CAAmBN,GACjCO,EAAM,WAAWF,yBAEvB,IACE,EAAAG,EAAA,SACGC,QAAQC,GAAsB,cAA0BA,IAAM,CAC7DC,QAAS,kDAAkD,UAAsB,WAElFC,MAAMvB,EAAQwB,a,CACjB,MAAOC,GACP,MAAM,IAAI,EAAAC,YAAYD,EAAEE,OAAO,GAAGL,QAAS,CAAEM,qBAAsB5B,EAAQwB,c,OAGvE,IAAAK,gBAAeX,GACrB,MAAMH,EAAiBe,OAAOC,SAASC,cAAc,CACnDC,SAAUhC,EAAYI,gBACtB6B,WAAYjC,EAAYS,gBACxBC,cACAwB,cAAeC,SAASC,KACxBC,KAAMtC,EAAQwB,aACde,iBAAkB,SAAUC,GAC1BxC,EAAQa,SAASC,KAAK,mCAAoC,CACxDP,sBAAuBiC,GAE3B,IAEF,MAAO,CACLC,IAAIC,EAAKC,GACP,MAAMC,EAAYC,EAAOH,GACrBE,IACF7B,EAAe+B,aAAa,CAAE,CAACF,GAAYD,IAC3C3C,EAAQa,SAASC,KAAK,YAAa,CAAE4B,MAAKC,UAE9C,EAEJ,G,CAhE+BI,CAAiBhD,EAAQC,EAASC,GAG/D,OAAOc,CACT,IA6DM8B,EAAS,CACbG,SAAU,aACVxB,aAAc,O","sources":["webpack://OneSdk/./modules/device/vendors/Sardine.ts"],"sourcesContent":["import { loadAsyncAsset, OneSDKError } from \"@module/common\";\nimport { ActivityType, ActivityTypeList, DeviceWrapperContext, DeviceWrapperOptions } from \"@module/device\";\nimport { v4 as uuid } from \"uuid\";\nimport { SharedConfiguration, WrapperInitialiseFunction } from \"../../sdk\";\nimport { z } from \"zod\";\n\nexport const initialise: WrapperInitialiseFunction<DeviceWrapperOptions, DeviceWrapperContext, \"async\"> = async (\n shared,\n options\n) => {\n // create session with backend\n const sessionData = await initialiseSardineSession(shared);\n options.eventHub.emit(\"session_data_generated\", {\n session: sessionData,\n });\n // initialise sardine sdk\n const sardineContext = await asyncLoadSardine(shared, options, sessionData);\n // listen for events, if there are any in the frontend\n // maybe we should implement our own events by websockets, if no frontend events are emitted\n return sardineContext;\n};\ntype SessionData = {\n frankieClientID: string;\n customerID: string;\n vendorSessionID: string;\n environment: string;\n};\nasync function initialiseSardineSession(shared: SharedConfiguration): Promise<SessionData> {\n return {\n customerID: shared.session.customerChildID ?? shared.session.customerID,\n frankieClientID: shared.recipe.deviceCharacteristics.provider.clientID,\n vendorSessionID: uuid(),\n environment: shared.recipe.deviceCharacteristics.provider.environment,\n };\n}\nfunction resolveSardineHost(environment: SardineEnvironment) {\n if (environment === \"production\") return \"api.sardine.ai\";\n return \"api.sandbox.sardine.ai\";\n}\nasync function asyncLoadSardine(\n shared: SharedConfiguration,\n options: DeviceWrapperOptions,\n sessionData: SessionData\n): Promise<DeviceWrapperContext> {\n const environment = <SardineEnvironment>sessionData.environment;\n const sardineHost = resolveSardineHost(environment);\n const url = `https://${sardineHost}/assets/loader.min.js`;\n\n try {\n z.string()\n .refine((val: ActivityType) => ActivityTypeList.includes(val), {\n message: `Activity Type should be one of the following: [${ActivityTypeList.join(\", \")}]`,\n })\n .parse(options.activityType);\n } catch (e) {\n throw new OneSDKError(e.issues[0].message, { receivedActivityType: options.activityType });\n }\n\n await loadAsyncAsset(url);\n const sardineContext = window._Sardine.createContext({\n clientId: sessionData.frankieClientID,\n sessionKey: sessionData.vendorSessionID,\n environment,\n parentElement: document.body,\n flow: options.activityType,\n onDeviceResponse: function (data: Record<string, string | number | object>) {\n options.eventHub.emit(\"device_characteristics_extracted\", {\n deviceCharacteristics: data,\n });\n },\n });\n return {\n set(key, value) {\n const mappedKey = mapF2S[key];\n if (mappedKey) {\n sardineContext.updateConfig({ [mappedKey]: value });\n options.eventHub.emit(\"value_set\", { key, value });\n }\n },\n };\n}\nconst mapF2S = {\n entityId: \"userIdHash\",\n activityType: \"flow\",\n};\n\n// Sardine specific types\n// Initialisation options that Sardine SDK expects (not all required)\ninterface SardineSdkOptions {\n clientId: string;\n userIdHash: string;\n flow: string;\n partnerID: string;\n sessionKey: string;\n}\ninterface InitialisationOptions extends SardineSdkOptions {\n onDeviceResponse: (d: unknown) => void;\n environment: SardineEnvironment;\n parentElement: HTMLElement;\n}\nexport type SardineEnvironment = \"production\" | \"sandbox\";\ndeclare global {\n interface Window {\n _Sardine: {\n createContext(args: Partial<InitialisationOptions>): {\n updateConfig(config: Partial<SardineSdkOptions>): void;\n };\n };\n }\n}\n"],"names":["initialise","shared","options","sessionData","customerID","session","customerChildID","frankieClientID","recipe","deviceCharacteristics","provider","clientID","vendorSessionID","environment","initialiseSardineSession","eventHub","emit","sardineContext","sardineHost","resolveSardineHost","url","z","refine","val","message","parse","activityType","e","OneSDKError","issues","receivedActivityType","loadAsyncAsset","window","_Sardine","createContext","clientId","sessionKey","parentElement","document","body","flow","onDeviceResponse","data","set","key","value","mappedKey","mapF2S","updateConfig","asyncLoadSardine","entityId"],"sourceRoot":""}
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunkOneSdk=self.webpackChunkOneSdk||[]).push([[632],{5269:(e,n,t)=>{t.r(n),t.d(n,{wrapper:()=>i});var r=t(4586),o=o||{};o.version=4,o.create_url=function(e,n,t,r,c){function i(){return Math.floor(2742745743359*Math.random())}function s(){return u(i())}function u(e){return(e+78364164096).toString(36)}var a=i(),l=i(),d=885187064159;l=((l=l-l%256+o.version)+a)%2742745743359,d=(d+a)%2742745743359;var p="https://"+e+"/"+(a=s()+u(a))+n,f=[(l=u(d)+u(l))+"="+t,s()+s()+"="+r];return void 0!==c&&c.length>0&&f.push(s()+s()+"="+c),p+"?"+f.join("&")},o.beacon=function(e,n,t){var r="turn:aa.online-metrix.net?transport=",o="1:"+n+":"+t,c={iceServers:[{urls:r+"tcp",username:o,credential:t},{urls:r+"udp",username:o,credential:t}]};try{var i=new RTCPeerConnection(c);i.createDataChannel(Math.random().toString());var s=function(){},u=function(e){i.setLocalDescription(e,s,s)};"undefined"==typeof Promise||i.createOffer.length>0?i.createOffer(u,s):i.createOffer().then(u,s),setInterval((function(){i.close()}),1e4)}catch(e){console.error(n)}},o.load_tags=function(e,n,t,r){o.beacon(e,n,t,r);var c=document.getElementsByTagName("head").item(0),i=document.createElement("script");i.id="tmx_tags_js",i.setAttribute("type","text/javascript");var s=o.create_url(e,".js",n,t,r);i.setAttribute("src",s),o.set_csp_nonce(i),c.appendChild(i)},o.csp_nonce=null,o.register_csp_nonce=function(e){if(void 0!==e.currentScript&&null!==e.currentScript){var n=e.currentScript.getAttribute("nonce");null!=n&&""!==n?o.csp_nonce=n:void 0!==e.currentScript.nonce&&null!==e.currentScript.nonce&&""!==e.currentScript.nonce&&(o.csp_nonce=e.currentScript.nonce)}},o.set_csp_nonce=function(e){null!==o.csp_nonce&&(e.setAttribute("nonce",o.csp_nonce),e.getAttribute("nonce")!==o.csp_nonce&&(e.nonce=o.csp_nonce))},o.cleanup=function(){let e,n,t;for(;null!==(e=document.getElementById("tdz_ifrm"));)e.parentElement.removeChild(e);for(;null!==(n=document.getElementById("tmx_tags_iframe"));)n.parentElement.removeChild(n);for(;null!==(t=document.getElementById("tmx_tags_js"));)t.parentElement.removeChild(t)},o.profile=function(e,n,t,r){void 0!==e&&void 0!==n&&void 0!==t&&8===n.length&&(o.cleanup(),o.register_csp_nonce(document),o.load_tags(e,n,t,r))};var c=function(e,n,t,r){return new(t||(t=Promise))((function(o,c){function i(e){try{u(r.next(e))}catch(e){c(e)}}function s(e){try{u(r.throw(e))}catch(e){c(e)}}function u(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,s)}u((r=r.apply(e,n||[])).next())}))};const i={vendor:"threatmetrix",initialise(e){return c(this,void 0,void 0,(function*(){const n=yield function(e){var n;return c(this,void 0,void 0,(function*(){return{customerID:null!==(n=e.session.customerChildID)&&void 0!==n?n:e.session.customerID,frankieClientID:e.recipe.deviceCharacteristics.provider.clientID,vendorSessionID:(0,r.Z)(),environment:"production"}}))}(e);e.eventHub.emit("session_data_generated",{session:n});const t=yield function(e){return c(this,void 0,void 0,(function*(){const{frankieClientID:n,vendorSessionID:t}=e.session;return o.profile("h.online-metrix.net",n,t),{vendor:"threatmetrix",set(e,n){}}}))}({module:e,session:n});return t}))}}}}]);
1
+ "use strict";(self.webpackChunkOneSdk=self.webpackChunkOneSdk||[]).push([[632],{5269:(e,n,t)=>{t.r(n),t.d(n,{initialise:()=>i});var r=t(4586),c=c||{};c.version=4,c.create_url=function(e,n,t,r,o){function i(){return Math.floor(2742745743359*Math.random())}function u(){return s(i())}function s(e){return(e+78364164096).toString(36)}var a=i(),l=i(),d=885187064159;l=((l=l-l%256+c.version)+a)%2742745743359,d=(d+a)%2742745743359;var f="https://"+e+"/"+(a=u()+s(a))+n,p=[(l=s(d)+s(l))+"="+t,u()+u()+"="+r];return void 0!==o&&o.length>0&&p.push(u()+u()+"="+o),f+"?"+p.join("&")},c.beacon=function(e,n,t){var r="turn:aa.online-metrix.net?transport=",c="1:"+n+":"+t,o={iceServers:[{urls:r+"tcp",username:c,credential:t},{urls:r+"udp",username:c,credential:t}]};try{var i=new RTCPeerConnection(o);i.createDataChannel(Math.random().toString());var u=function(){},s=function(e){i.setLocalDescription(e,u,u)};"undefined"==typeof Promise||i.createOffer.length>0?i.createOffer(s,u):i.createOffer().then(s,u),setInterval((function(){i.close()}),1e4)}catch(e){console.error(n)}},c.load_tags=function(e,n,t,r){c.beacon(e,n,t,r);var o=document.getElementsByTagName("head").item(0),i=document.createElement("script");i.id="tmx_tags_js",i.setAttribute("type","text/javascript");var u=c.create_url(e,".js",n,t,r);i.setAttribute("src",u),c.set_csp_nonce(i),o.appendChild(i)},c.csp_nonce=null,c.register_csp_nonce=function(e){if(void 0!==e.currentScript&&null!==e.currentScript){var n=e.currentScript.getAttribute("nonce");null!=n&&""!==n?c.csp_nonce=n:void 0!==e.currentScript.nonce&&null!==e.currentScript.nonce&&""!==e.currentScript.nonce&&(c.csp_nonce=e.currentScript.nonce)}},c.set_csp_nonce=function(e){null!==c.csp_nonce&&(e.setAttribute("nonce",c.csp_nonce),e.getAttribute("nonce")!==c.csp_nonce&&(e.nonce=c.csp_nonce))},c.cleanup=function(){let e,n,t;for(;null!==(e=document.getElementById("tdz_ifrm"));)e.parentElement.removeChild(e);for(;null!==(n=document.getElementById("tmx_tags_iframe"));)n.parentElement.removeChild(n);for(;null!==(t=document.getElementById("tmx_tags_js"));)t.parentElement.removeChild(t)},c.profile=function(e,n,t,r){void 0!==e&&void 0!==n&&void 0!==t&&8===n.length&&(c.cleanup(),c.register_csp_nonce(document),c.load_tags(e,n,t,r))};var o=function(e,n,t,r){return new(t||(t=Promise))((function(c,o){function i(e){try{s(r.next(e))}catch(e){o(e)}}function u(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var n;e.done?c(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,u)}s((r=r.apply(e,n||[])).next())}))};const i=(e,n)=>o(void 0,void 0,void 0,(function*(){const t=yield function(e){var n;return o(this,void 0,void 0,(function*(){return{customerID:null!==(n=e.session.customerChildID)&&void 0!==n?n:e.session.customerID,frankieClientID:e.recipe.deviceCharacteristics.provider.clientID,vendorSessionID:(0,r.Z)(),environment:"production"}}))}(e);n.eventHub.emit("session_data_generated",{session:t});const i=yield function(e,n,t){return o(this,void 0,void 0,(function*(){const{frankieClientID:e,vendorSessionID:n}=t;return c.profile("h.online-metrix.net",e,n),{set(){}}}))}(0,0,t);return i}))}}]);
2
2
  //# sourceMappingURL=device-threatmetrix.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"device-threatmetrix.js","mappings":"2IAOIA,EAAeA,GAAgB,CAAC,EACnCA,EAAaC,QAAU,EACrBD,EAAaE,WAAa,SAAUC,EAAGC,EAAGC,EAAGC,EAAGC,GAC/C,SAASC,IACP,OAAOC,KAAKC,MAAM,cAAgBD,KAAKE,SACzC,CACA,SAASC,IACP,OAAOC,EAAEL,IACX,CACA,SAASK,EAAEV,GACT,OAAQA,EAAI,aAAaW,SAAS,GACpC,CACA,IAAIC,EAAIP,IACNQ,EAAIR,IACJS,EAAI,aACLD,IAAMA,EAAIA,EAAKA,EAAI,IAAOhB,EAAaC,SAAWc,GAAK,cAAiBE,GAAKA,EAAIF,GAAK,cACvF,IAAIG,EAAI,WAAaf,EAAI,KAAOY,EAAIH,IAAMC,EAAEE,IAAMX,EAChDe,EAAI,EAAEH,EAAIH,EAAEI,GAAKJ,EAAEG,IAAM,IAAMX,EAAGO,IAAMA,IAAM,IAAMN,GACtD,YAAO,IAAWC,GAAKA,EAAEa,OAAS,GAAKD,EAAEE,KAAKT,IAAMA,IAAM,IAAML,GAAIW,EAAI,IAAMC,EAAEG,KAAK,IACvF,EACCtB,EAAauB,OAAS,SAAUpB,EA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KC,GAET,EAEJ,G,CA9BsCC,CAAsB,CACtDC,OAAQpB,EACRG,QAASF,IAIX,OAAOc,CACT,G","sources":["webpack://OneSdk/./modules/device/vendors/Threatmetrix/nolint_fp-clientlib-v4.js","webpack://OneSdk/./modules/device/vendors/Threatmetrix/index.ts"],"sourcesContent":["/**\n * We're advised to download and host this file ourselves.\n *\n * Docs: https://portal.threatmetrix.com/kb/index.htm#t=implementation%2Fprofiling%2Fprofiling%20introduction%20and%20integration%2Fadvanced_profiling_integration.htm&rhsearch=advanced&rhhlterm=advanced\n * From: https://portal.threatmetrix.com/kb/downloads/js/fp-clientlib-v4.js\n */\n\nvar threatmetrix = threatmetrix || {};\n(threatmetrix.version = 4),\n (threatmetrix.create_url = function (t, e, r, n, c) {\n function i() {\n return Math.floor(2742745743359 * Math.random());\n }\n function a() {\n return o(i());\n }\n function o(t) {\n return (t + 78364164096).toString(36);\n }\n var m = i(),\n u = i(),\n l = 885187064159;\n (u = ((u = u - (u % 256) + threatmetrix.version) + m) % 2742745743359), (l = (l + m) % 2742745743359);\n var s = \"https://\" + t + \"/\" + (m = a() + o(m)) + e,\n h = [(u = o(l) + o(u)) + \"=\" + r, a() + a() + \"=\" + n];\n return void 0 !== c && c.length > 0 && h.push(a() + a() + \"=\" + c), s + \"?\" + h.join(\"&\");\n }),\n (threatmetrix.beacon = function (t, e, r) {\n var c = \"turn:aa.online-metrix.net?transport=\",\n i = \"1:\" + e + \":\" + r,\n a = {\n iceServers: [\n { urls: c + \"tcp\", username: i, credential: r },\n { urls: c + \"udp\", username: i, credential: r },\n ],\n };\n try {\n var o = new RTCPeerConnection(a);\n o.createDataChannel(Math.random().toString());\n var m = function () {},\n u = function (t) {\n o.setLocalDescription(t, m, m);\n };\n \"undefined\" == typeof Promise || o.createOffer.length > 0 ? o.createOffer(u, m) : o.createOffer().then(u, m),\n setInterval(function () {\n o.close();\n }, 1e4);\n } catch (t) {\n console.error(e);\n }\n }),\n (threatmetrix.load_tags = function (t, e, r, n) {\n threatmetrix.beacon(t, e, r, n);\n var c = document.getElementsByTagName(\"head\").item(0),\n i = document.createElement(\"script\");\n (i.id = \"tmx_tags_js\"), i.setAttribute(\"type\", \"text/javascript\");\n var a = threatmetrix.create_url(t, \".js\", e, r, n);\n i.setAttribute(\"src\", a), threatmetrix.set_csp_nonce(i), c.appendChild(i);\n }),\n (threatmetrix.csp_nonce = null),\n (threatmetrix.register_csp_nonce = function (t) {\n if (void 0 !== t.currentScript && null !== t.currentScript) {\n var e = t.currentScript.getAttribute(\"nonce\");\n null != e && \"\" !== e\n ? (threatmetrix.csp_nonce = e)\n : void 0 !== t.currentScript.nonce &&\n null !== t.currentScript.nonce &&\n \"\" !== t.currentScript.nonce &&\n (threatmetrix.csp_nonce = t.currentScript.nonce);\n }\n }),\n (threatmetrix.set_csp_nonce = function (t) {\n null !== threatmetrix.csp_nonce &&\n (t.setAttribute(\"nonce\", threatmetrix.csp_nonce),\n t.getAttribute(\"nonce\") !== threatmetrix.csp_nonce && (t.nonce = threatmetrix.csp_nonce));\n }),\n (threatmetrix.cleanup = function () {\n let hp_frame, tmx_frame, tmx_script;\n for (; null !== (hp_frame = document.getElementById(\"tdz_ifrm\")); ) hp_frame.parentElement.removeChild(hp_frame);\n for (; null !== (tmx_frame = document.getElementById(\"tmx_tags_iframe\")); )\n tmx_frame.parentElement.removeChild(tmx_frame);\n for (; null !== (tmx_script = document.getElementById(\"tmx_tags_js\")); )\n tmx_script.parentElement.removeChild(tmx_script);\n }),\n (threatmetrix.profile = function (t, e, r, n) {\n void 0 !== t &&\n void 0 !== e &&\n void 0 !== r &&\n 8 === e.length &&\n (threatmetrix.cleanup(), threatmetrix.register_csp_nonce(document), threatmetrix.load_tags(t, e, r, n));\n });\n\nexport { threatmetrix };\n","import { v4 as uuid } from \"uuid\";\nimport { SessionData, SetOptions, VendorContext, VendorLoaderOptions, VendorOptions, VendorWrapper } from \"../../types\";\nimport { threatmetrix as threatmetrixSdk } from \"./nolint_fp-clientlib-v4.js\";\n\nexport const wrapper: VendorWrapper = {\n vendor: \"threatmetrix\",\n async initialise(options: VendorOptions): Promise<VendorContext> {\n // create session with backend\n const sessionData = await initialiseThreatMetrixSession(options);\n options.eventHub.emit(\"session_data_generated\", {\n session: sessionData,\n });\n // initialise threatMetrix sdk\n const threatmetrixContext = await asyncLoadThreatMetrix({\n module: options,\n session: sessionData,\n });\n // listen for events, if there are any in the frontend\n // maybe we should implement our own events by websockets, if no frontend events are emitted\n return threatmetrixContext;\n },\n};\n\nasync function initialiseThreatMetrixSession(options: VendorOptions): Promise<SessionData> {\n return {\n customerID: options.session.customerChildID ?? options.session.customerID,\n frankieClientID: options.recipe.deviceCharacteristics.provider.clientID,\n vendorSessionID: uuid(),\n environment: \"production\",\n };\n}\nasync function asyncLoadThreatMetrix(options: VendorLoaderOptions): Promise<VendorContext> {\n // threatmetrix prefers us to ugligy their interface\n // to hide the fact threatmetrix is being used\n // that means that we might need to convert the file below into a module and stactically import it\n const { frankieClientID, vendorSessionID } = options.session;\n threatmetrixSdk.profile(\"h.online-metrix.net\", frankieClientID, vendorSessionID);\n return {\n vendor: \"threatmetrix\",\n set(key, value) {\n // Not sure what goes here for threatmetrix\n },\n };\n}\nfunction emitEventForConfigurationUpdate<Key extends keyof SetOptions>(\n key: Key,\n value: SetOptions[Key] | \"NO_CHANGE\",\n { module: { eventHub } }: VendorLoaderOptions\n) {\n eventHub.emit(\"value_set\", { key, value });\n}\n"],"names":["threatmetrix","version","create_url","t","e","r","n","c","i","Math","floor","random","a","o","toString","m","u","l","s","h","length","push","join","beacon","iceServers","urls","username","credential","RTCPeerConnection","createDataChannel","setLocalDescription","Promise","createOffer","then","setInterval","close","console","error","load_tags","document","getElementsByTagName","item","createElement","id","setAttribute","set_csp_nonce","appendChild","csp_nonce","register_csp_nonce","currentScript","getAttribute","nonce","cleanup","hp_frame","tmx_frame","tmx_script","getElementById","parentElement","removeChild","profile","wrapper","vendor","initialise","options","sessionData","customerID","session","customerChildID","frankieClientID","recipe","deviceCharacteristics","provider","clientID","vendorSessionID","environment","initialiseThreatMetrixSession","eventHub","emit","threatmetrixContext","set","key","value","asyncLoadThreatMetrix","module"],"sourceRoot":""}
1
+ {"version":3,"file":"device-threatmetrix.js","mappings":"8IAOIA,EAAeA,GAAgB,CAAC,EACnCA,EAAaC,QAAU,EACrBD,EAAaE,WAAa,SAAUC,EAAGC,EAAGC,EAAGC,EAAGC,GAC/C,SAASC,IACP,OAAOC,KAAKC,MAAM,cAAgBD,KAAKE,SACzC,CACA,SAASC,IACP,OAAOC,EAAEL,IACX,CACA,SAASK,EAAEV,GACT,OAAQA,EAAI,aAAaW,SAAS,GACpC,CACA,IAAIC,EAAIP,IACNQ,EAAIR,IACJS,EAAI,aACLD,IAAMA,EAAIA,EAAKA,EAAI,IAAOhB,EAAaC,SAAWc,GAAK,cAAiBE,GAAKA,EAAIF,GAAK,cACvF,IAAIG,EAAI,WAAaf,EAAI,KAAOY,EAAIH,IAAMC,EAAEE,IAAMX,EAChDe,EAAI,EAAEH,EAAIH,EAAEI,GAAKJ,EAAEG,IAAM,IAAMX,EAAGO,IAAMA,IAAM,IAAMN,GACtD,YAAO,IAAWC,GAAKA,EAAEa,OAAS,GAAKD,EAAEE,KAAKT,IAAMA,IAAM,IAAML,GAAIW,EAAI,IAAMC,EAAEG,KAAK,IACvF,EACCtB,EAAauB,OAAS,SAAUpB,EAAGC,EAAGC,GACrC,IAAIE,EAAI,uCACNC,EAAI,KAAOJ,EAAI,IAAMC,EACrBO,EAAI,CACFY,WAAY,CACV,CAAEC,KAAMlB,EAAI,MAAOmB,SAAUlB,EAAGmB,WAAYtB,GAC5C,CAAEoB,KAAMlB,EAAI,MAAOmB,SAAUlB,EAAGmB,WAAYtB,KAGlD,IACE,IAAIQ,EAAI,IAAIe,kBAAkBhB,GAC9BC,EAAEgB,kBAAkBpB,KAAKE,SAASG,YAClC,IAAIC,EAAI,WAAa,EACnBC,EAAI,SAAUb,GACZU,EAAEiB,oBAAoB3B,EAAG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ASI,cAAcC,YAAYL,GACvG,KAAO,QAAUC,EAAYf,SAASiB,eAAe,qBACnDF,EAAUG,cAAcC,YAAYJ,GACtC,KAAO,QAAUC,EAAahB,SAASiB,eAAe,iBACpDD,EAAWE,cAAcC,YAAYH,EACzC,EACCvD,EAAa2D,QAAU,SAAUxD,EAAGC,EAAGC,EAAGC,QACzC,IAAWH,QACT,IAAWC,QACX,IAAWC,GACX,IAAMD,EAAEgB,SACPpB,EAAaoD,UAAWpD,EAAagD,mBAAmBT,UAAWvC,EAAasC,UAAUnC,EAAGC,EAAGC,EAAGC,GACxG,E,0SCrFK,MAAMsD,EAA6F,CACxGC,EACAC,IACG,OAAD,6BAEF,MAAMC,QAgBR,SAA6CF,G,+CAC3C,MAAO,CACLG,WAA0C,QAA9B,EAAAH,EAAOI,QAAQC,uBAAe,QAAIL,EAAOI,QAAQD,WAC7DG,gBAAiBN,EAAOO,OAAOC,sBAAsBC,SAASC,SAC9DC,iBAAiB,SACjBC,YAAa,a,IArBWC,CAA8Bb,GACxDC,EAAQa,SAASC,KAAK,yBAA0B,CAC9CX,QAASF,IAGX,MAAMc,QAmBR,SACEC,EACAC,EACAhB,G,yCAKA,MAAM,gBAAEI,EAAe,gBAAEK,GAAoBT,EAE7C,OADA/D,EAAA,QAAwB,sBAAuBmE,EAAiBK,GACzD,CACLQ,MAEA,EAEJ,G,CAlCoCC,CAAsBpB,EAAQC,EAASC,GAGzE,OAAOc,CACT,G","sources":["webpack://OneSdk/./modules/device/vendors/Threatmetrix/nolint_fp-clientlib-v4.js","webpack://OneSdk/./modules/device/vendors/Threatmetrix/index.ts"],"sourcesContent":["/**\n * We're advised to download and host this file ourselves.\n *\n * Docs: https://portal.threatmetrix.com/kb/index.htm#t=implementation%2Fprofiling%2Fprofiling%20introduction%20and%20integration%2Fadvanced_profiling_integration.htm&rhsearch=advanced&rhhlterm=advanced\n * From: https://portal.threatmetrix.com/kb/downloads/js/fp-clientlib-v4.js\n */\n\nvar threatmetrix = threatmetrix || {};\n(threatmetrix.version = 4),\n (threatmetrix.create_url = function (t, e, r, n, c) {\n function i() {\n return Math.floor(2742745743359 * Math.random());\n }\n function a() {\n return o(i());\n }\n function o(t) {\n return (t + 78364164096).toString(36);\n }\n var m = i(),\n u = i(),\n l = 885187064159;\n (u = ((u = u - (u % 256) + threatmetrix.version) + m) % 2742745743359), (l = (l + m) % 2742745743359);\n var s = \"https://\" + t + \"/\" + (m = a() + o(m)) + e,\n h = [(u = o(l) + o(u)) + \"=\" + r, a() + a() + \"=\" + n];\n return void 0 !== c && c.length > 0 && h.push(a() + a() + \"=\" + c), s + \"?\" + h.join(\"&\");\n }),\n (threatmetrix.beacon = function (t, e, r) {\n var c = \"turn:aa.online-metrix.net?transport=\",\n i = \"1:\" + e + \":\" + r,\n a = {\n iceServers: [\n { urls: c + \"tcp\", username: i, credential: r },\n { urls: c + \"udp\", username: i, credential: r },\n ],\n };\n try {\n var o = new RTCPeerConnection(a);\n o.createDataChannel(Math.random().toString());\n var m = function () {},\n u = function (t) {\n o.setLocalDescription(t, m, m);\n };\n \"undefined\" == typeof Promise || o.createOffer.length > 0 ? o.createOffer(u, m) : o.createOffer().then(u, m),\n setInterval(function () {\n o.close();\n }, 1e4);\n } catch (t) {\n console.error(e);\n }\n }),\n (threatmetrix.load_tags = function (t, e, r, n) {\n threatmetrix.beacon(t, e, r, n);\n var c = document.getElementsByTagName(\"head\").item(0),\n i = document.createElement(\"script\");\n (i.id = \"tmx_tags_js\"), i.setAttribute(\"type\", \"text/javascript\");\n var a = threatmetrix.create_url(t, \".js\", e, r, n);\n i.setAttribute(\"src\", a), threatmetrix.set_csp_nonce(i), c.appendChild(i);\n }),\n (threatmetrix.csp_nonce = null),\n (threatmetrix.register_csp_nonce = function (t) {\n if (void 0 !== t.currentScript && null !== t.currentScript) {\n var e = t.currentScript.getAttribute(\"nonce\");\n null != e && \"\" !== e\n ? (threatmetrix.csp_nonce = e)\n : void 0 !== t.currentScript.nonce &&\n null !== t.currentScript.nonce &&\n \"\" !== t.currentScript.nonce &&\n (threatmetrix.csp_nonce = t.currentScript.nonce);\n }\n }),\n (threatmetrix.set_csp_nonce = function (t) {\n null !== threatmetrix.csp_nonce &&\n (t.setAttribute(\"nonce\", threatmetrix.csp_nonce),\n t.getAttribute(\"nonce\") !== threatmetrix.csp_nonce && (t.nonce = threatmetrix.csp_nonce));\n }),\n (threatmetrix.cleanup = function () {\n let hp_frame, tmx_frame, tmx_script;\n for (; null !== (hp_frame = document.getElementById(\"tdz_ifrm\")); ) hp_frame.parentElement.removeChild(hp_frame);\n for (; null !== (tmx_frame = document.getElementById(\"tmx_tags_iframe\")); )\n tmx_frame.parentElement.removeChild(tmx_frame);\n for (; null !== (tmx_script = document.getElementById(\"tmx_tags_js\")); )\n tmx_script.parentElement.removeChild(tmx_script);\n }),\n (threatmetrix.profile = function (t, e, r, n) {\n void 0 !== t &&\n void 0 !== e &&\n void 0 !== r &&\n 8 === e.length &&\n (threatmetrix.cleanup(), threatmetrix.register_csp_nonce(document), threatmetrix.load_tags(t, e, r, n));\n });\n\nexport { threatmetrix };\n","import { DeviceWrapperContext, DeviceWrapperOptions } from \"@module/device\";\nimport { SharedConfiguration, WrapperInitialiseFunction } from \"@module/sdk\";\nimport { v4 as uuid } from \"uuid\";\nimport { threatmetrix as threatmetrixSdk } from \"./nolint_fp-clientlib-v4.js\";\n\nexport const initialise: WrapperInitialiseFunction<DeviceWrapperOptions, DeviceWrapperContext, \"async\"> = async (\n shared,\n options\n) => {\n // create session with backend\n const sessionData = await initialiseThreatMetrixSession(shared);\n options.eventHub.emit(\"session_data_generated\", {\n session: sessionData,\n });\n // initialise threatMetrix sdk\n const threatmetrixContext = await asyncLoadThreatMetrix(shared, options, sessionData);\n // listen for events, if there are any in the frontend\n // maybe we should implement our own events by websockets, if no frontend events are emitted\n return threatmetrixContext;\n};\ntype SessionData = {\n frankieClientID: string;\n customerID: string;\n vendorSessionID: string;\n environment: string;\n};\nasync function initialiseThreatMetrixSession(shared: SharedConfiguration): Promise<SessionData> {\n return {\n customerID: shared.session.customerChildID ?? shared.session.customerID,\n frankieClientID: shared.recipe.deviceCharacteristics.provider.clientID,\n vendorSessionID: uuid(),\n environment: \"production\",\n };\n}\nasync function asyncLoadThreatMetrix(\n _1: SharedConfiguration,\n _2: DeviceWrapperOptions,\n sessionData: SessionData\n): Promise<DeviceWrapperContext> {\n // threatmetrix prefers us to ugligy their interface\n // to hide the fact threatmetrix is being used\n // that means that we might need to convert the file below into a module and stactically import it\n const { frankieClientID, vendorSessionID } = sessionData;\n threatmetrixSdk.profile(\"h.online-metrix.net\", frankieClientID, vendorSessionID);\n return {\n set() {\n // Not sure what goes here for threatmetrix\n },\n };\n}\n"],"names":["threatmetrix","version","create_url","t","e","r","n","c","i","Math","floor","random","a","o","toString","m","u","l","s","h","length","push","join","beacon","iceServers","urls","username","credential","RTCPeerConnection","createDataChannel","setLocalDescription","Promise","createOffer","then","setInterval","close","console","error","load_tags","document","getElementsByTagName","item","createElement","id","setAttribute","set_csp_nonce","appendChild","csp_nonce","register_csp_nonce","currentScript","getAttribute","nonce","cleanup","hp_frame","tmx_frame","tmx_script","getElementById","parentElement","removeChild","profile","initialise","shared","options","sessionData","customerID","session","customerChildID","frankieClientID","recipe","deviceCharacteristics","provider","clientID","vendorSessionID","environment","initialiseThreatMetrixSession","eventHub","emit","threatmetrixContext","_1","_2","set","asyncLoadThreatMetrix"],"sourceRoot":""}