@zonos/elements 1.3.291 → 1.3.293

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 (52) hide show
  1. package/dist/cjs/{collect-Oeo5tjN5.js → collect-DnrvaXUI.js} +24 -4
  2. package/dist/cjs/index.cjs.js +30 -8
  3. package/dist/cjs/zonos-address-completion-dialog_7.cjs.entry.js +1 -1
  4. package/dist/cjs/zonos-airwallex-payment.cjs.entry.js +1 -1
  5. package/dist/cjs/zonos-collect-finish_6.cjs.entry.js +1 -1
  6. package/dist/cjs/zonos-collect.cjs.entry.js +1 -1
  7. package/dist/cjs/zonos-controller.cjs.entry.js +9 -0
  8. package/dist/cjs/zonos-country-flag.cjs.entry.js +1 -1
  9. package/dist/collection/components/utils/checkout/injectDomesticElementHideStyle.js +9 -0
  10. package/dist/collection/scripts/_stripe.js +23 -1
  11. package/dist/esm/{collect-CdrR5OBy.js → collect-Eo4gtyql.js} +24 -4
  12. package/dist/esm/index.js +30 -8
  13. package/dist/esm/zonos-address-completion-dialog_7.entry.js +1 -1
  14. package/dist/esm/zonos-airwallex-payment.entry.js +1 -1
  15. package/dist/esm/zonos-collect-finish_6.entry.js +1 -1
  16. package/dist/esm/zonos-collect.entry.js +1 -1
  17. package/dist/esm/zonos-controller.entry.js +9 -0
  18. package/dist/esm/zonos-country-flag.entry.js +1 -1
  19. package/dist/esm-es5/{collect-CdrR5OBy.js → collect-Eo4gtyql.js} +4 -2
  20. package/dist/esm-es5/index.js +6 -6
  21. package/dist/esm-es5/zonos-address-completion-dialog_7.entry.js +1 -1
  22. package/dist/esm-es5/zonos-airwallex-payment.entry.js +1 -1
  23. package/dist/esm-es5/zonos-collect-finish_6.entry.js +1 -1
  24. package/dist/esm-es5/zonos-collect.entry.js +1 -1
  25. package/dist/esm-es5/zonos-controller.entry.js +6 -0
  26. package/dist/esm-es5/zonos-country-flag.entry.js +1 -1
  27. package/dist/scripts/index.d.ts +2 -0
  28. package/dist/scripts/index.js +1 -1
  29. package/dist/scripts/loadZonos.js +1 -1
  30. package/dist/scripts/zonos.js +1 -1
  31. package/dist/types/components/store/checkout/cart.d.ts +2 -0
  32. package/dist/zonos-elements/index.esm.js +1 -1
  33. package/dist/zonos-elements/{p-e0e9cff5.system.entry.js → p-06030d3b.system.entry.js} +6 -0
  34. package/dist/zonos-elements/{p-DzLNk-Pf.js → p-0mGRBGcf.js} +1 -1
  35. package/dist/zonos-elements/{p-552fbde1.system.entry.js → p-155ed3d3.system.entry.js} +6 -6
  36. package/dist/zonos-elements/{p-04bded81.system.entry.js → p-31043c2e.system.entry.js} +1 -1
  37. package/dist/zonos-elements/{p-938fc1e4.entry.js → p-3a2da031.entry.js} +1 -1
  38. package/dist/zonos-elements/p-4679f0ec.entry.js +1 -0
  39. package/dist/zonos-elements/{p-b2dd7f02.system.entry.js → p-5967a1c1.system.entry.js} +1 -1
  40. package/dist/zonos-elements/{p-c5bab786.entry.js → p-725e29bb.entry.js} +1 -1
  41. package/dist/zonos-elements/{p-c3646ae6.system.entry.js → p-7bd99479.system.entry.js} +3 -3
  42. package/dist/zonos-elements/{p-e005b6a5.system.entry.js → p-9c33f7ed.system.entry.js} +1 -1
  43. package/dist/zonos-elements/p-Bu9WCfUC.system.js +1 -1
  44. package/dist/zonos-elements/{p-DNc279vN.system.js → p-CZD8WvyY.system.js} +33 -31
  45. package/dist/zonos-elements/{p-DuufSrhH.system.js → p-D6qXIvFm.system.js} +52 -52
  46. package/dist/zonos-elements/{p-6e296228.entry.js → p-ad9ff14c.entry.js} +1 -1
  47. package/dist/zonos-elements/p-c9d5d8f1.entry.js +1 -0
  48. package/dist/zonos-elements/{p-550d4eea.entry.js → p-d8b312e5.entry.js} +1 -1
  49. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  50. package/package.json +6 -4
  51. package/dist/zonos-elements/p-82595838.entry.js +0 -1
  52. package/dist/zonos-elements/p-dea26048.entry.js +0 -1
@@ -1,12 +1,12 @@
1
1
  var __awaiter=this&&this.__awaiter||function(e,n,t,r){function i(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(t,o){function a(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){e.done?t(e.value):i(e.value).then(a,u)}s((r=r.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=u(0),a["throw"]=u(1),a["return"]=u(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(e){return function(n){return s([e,n])}}function s(u){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(t=0)),t)try{if(r=1,i&&(o=u[0]&2?i["return"]:u[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;if(i=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:t.label++;return{value:u[1],done:false};case 5:t.label++;i=u[1];u=[0];continue;case 7:u=t.ops.pop();t.trys.pop();continue;default:if(!(o=t.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1];o=u;break}if(o&&t.label<o[2]){t.label=o[2];t.ops.push(u);break}if(o[2])t.ops.pop();t.trys.pop();continue}u=n.call(e,t)}catch(e){u=[6,e];i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};System.register(["./p-BuU_p5DP.system.js","./p-DOD2I44l.system.js","./p-zVLAvre1.system.js","./p-BbgqQIHv.system.js","./p-DS-qw_qc.system.js"],(function(e){"use strict";var n,t,r,i,o,a,u,s,c,f,l,v,d,m;return{setters:[function(e){n=e.c;t=e.z},function(e){r=e.t;i=e.l;o=e.s},function(e){a=e.l;u=e.h;s=e.s},function(e){c=e.l;f=e.b},function(e){l=e.d;v=e.Y;d=e.b;m=e.a0}],execute:function(){var p=this;
2
2
  // src/constant/common.ts
3
- function h(e,n){if(n==null||n>e.length)n=e.length;for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function y(e){if(Array.isArray(e))return e}function w(e){if(Array.isArray(e))return h(e)}function g(e,n,t,r,i,o,a){try{var u=e[o](a);var s=u.value}catch(e){t(e);return}if(u.done){n(s)}else{Promise.resolve(s).then(r,i)}}function b(e){return function(){var n=this,t=arguments;return new Promise((function(r,i){var o=e.apply(n,t);function a(e){g(o,r,i,a,u,"next",e)}function u(e){g(o,r,i,a,u,"throw",e)}a(undefined)}))}}function k(e,n){if(!(e instanceof n)){throw new TypeError("Cannot call a class as a function")}}function x(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function E(e,n,t){if(n)x(e.prototype,n);return e}function I(e,n,t){if(n in e){Object.defineProperty(e,n,{value:t,enumerable:true,configurable:true,writable:true})}else{e[n]=t}return e}function S(e,n){if(n!=null&&typeof Symbol!=="undefined"&&n[Symbol.hasInstance]){return!!n[Symbol.hasInstance](e)}else{return e instanceof n}}function N(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function C(e,n){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var r=[];var i=true;var o=false;var a,u;try{for(t=t.call(e);!(i=(a=t.next()).done);i=true){r.push(a.value);if(r.length===n)break}}catch(e){o=true;u=e}finally{try{if(!i&&t["return"]!=null)t["return"]()}finally{if(o)throw u}}return r}function D(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function T(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function P(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};var r=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))}r.forEach((function(n){I(e,n,t[n])}))}return e}function O(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}function R(e,n){n=n!=null?n:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(n))}else{O(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function j(e,n){return y(e)||C(e,n)||L(e,n)||D()}function _(e){return w(e)||N(e)||L(e)||T()}function A(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function L(e,n){if(!e)return;if(typeof e==="string")return h(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor)t=e.constructor.name;if(t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return h(e,n)}function U(e,n){var t,r,i,o,a={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(e){return function(n){return s([e,n])}}function s(o){if(t)throw new TypeError("Generator is already executing.");while(a)try{if(t=1,r&&(i=o[0]&2?r["return"]:o[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;if(r=0,i)o=[o[0]&2,i.value];switch(o[0]){case 0:case 1:i=o;break;case 4:a.label++;return{value:o[1],done:false};case 5:a.label++;r=o[1];o=[0];continue;case 7:o=a.ops.pop();a.trys.pop();continue;default:if(!(i=a.trys,i=i.length>0&&i[i.length-1])&&(o[0]===6||o[0]===2)){a=0;continue}if(o[0]===3&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(o[0]===6&&a.label<i[1]){a.label=i[1];i=o;break}if(i&&a.label<i[2]){a.label=i[2];a.ops.push(o);break}if(i[2])a.ops.pop();a.trys.pop();continue}o=n.call(e,a)}catch(e){o=[6,e];r=0}finally{t=i=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}}var M=function(e){e["production"]="prod";e["demo"]="demo";e["staging"]="staging";return e}(M||{});
3
+ function h(e,n){if(n==null||n>e.length)n=e.length;for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function y(e){if(Array.isArray(e))return e}function w(e){if(Array.isArray(e))return h(e)}function b(e,n,t,r,i,o,a){try{var u=e[o](a);var s=u.value}catch(e){t(e);return}if(u.done){n(s)}else{Promise.resolve(s).then(r,i)}}function g(e){return function(){var n=this,t=arguments;return new Promise((function(r,i){var o=e.apply(n,t);function a(e){b(o,r,i,a,u,"next",e)}function u(e){b(o,r,i,a,u,"throw",e)}a(undefined)}))}}function k(e,n){if(!(e instanceof n)){throw new TypeError("Cannot call a class as a function")}}function x(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(e,r.key,r)}}function E(e,n,t){if(n)x(e.prototype,n);return e}function I(e,n,t){if(n in e){Object.defineProperty(e,n,{value:t,enumerable:true,configurable:true,writable:true})}else{e[n]=t}return e}function S(e,n){if(n!=null&&typeof Symbol!=="undefined"&&n[Symbol.hasInstance]){return!!n[Symbol.hasInstance](e)}else{return e instanceof n}}function N(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function C(e,n){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var r=[];var i=true;var o=false;var a,u;try{for(t=t.call(e);!(i=(a=t.next()).done);i=true){r.push(a.value);if(r.length===n)break}}catch(e){o=true;u=e}finally{try{if(!i&&t["return"]!=null)t["return"]()}finally{if(o)throw u}}return r}function D(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function T(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function O(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};var r=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))}r.forEach((function(n){I(e,n,t[n])}))}return e}function P(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}function R(e,n){n=n!=null?n:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(n))}else{P(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function j(e,n){return y(e)||C(e,n)||L(e,n)||D()}function _(e){return w(e)||N(e)||L(e)||T()}function A(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function L(e,n){if(!e)return;if(typeof e==="string")return h(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor)t=e.constructor.name;if(t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return h(e,n)}function U(e,n){var t,r,i,o,a={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(e){return function(n){return s([e,n])}}function s(o){if(t)throw new TypeError("Generator is already executing.");while(a)try{if(t=1,r&&(i=o[0]&2?r["return"]:o[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;if(r=0,i)o=[o[0]&2,i.value];switch(o[0]){case 0:case 1:i=o;break;case 4:a.label++;return{value:o[1],done:false};case 5:a.label++;r=o[1];o=[0];continue;case 7:o=a.ops.pop();a.trys.pop();continue;default:if(!(i=a.trys,i=i.length>0&&i[i.length-1])&&(o[0]===6||o[0]===2)){a=0;continue}if(o[0]===3&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(o[0]===6&&a.label<i[1]){a.label=i[1];i=o;break}if(i&&a.label<i[2]){a.label=i[2];a.ops.push(o);break}if(i[2])a.ops.pop();a.trys.pop();continue}o=n.call(e,a)}catch(e){o=[6,e];r=0}finally{t=i=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}}var M=function(e){e["production"]="prod";e["demo"]="demo";e["staging"]="staging";return e}(M||{});
4
4
  // src/constant/config.ts
5
- var F="airTracker_unknown";var K={appName:F,appVersion:F,env:"staging"/* staging */,isWebappContainer:false,delay:2e3,errorRepeatTime:3,enableErrorMonitoring:false,assetSpeedMonitoringWhiteList:[],enableDetectPageChange:false,enableRecordPageRetention:false,hideSearchParams:false,useSessionStorageForSessionId:false,assetSpeedMonitoringWhiteListByMFE:{}};var q={appName:F,env:"staging"/* staging */,sessionId:F,deviceId:F};
5
+ var F="airTracker_unknown";var K={appName:F,appVersion:F,env:"staging"/* staging */,isWebappContainer:false,delay:2e3,errorRepeatTime:3,enableErrorMonitoring:false,assetSpeedMonitoringWhiteList:[],enableDetectPageChange:false,enableRecordPageRetention:false,hideSearchParams:false,useSessionStorageForSessionId:false,assetSpeedMonitoringWhiteListByMFE:{}};var H={appName:F,env:"staging"/* staging */,sessionId:F,deviceId:F};
6
6
  // src/util/jsonHelper.ts
7
- var H=function(e){if(!e){return false}if(/^\s*$/.test(e))return false;e=e.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@");e=e.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");e=e.replace(/(?:^|:|,)(?:\s*\[)+/g,"");return/^[\],:{}\s]*$/.test(e)};var z=function(){var e=new WeakSet;return function(n,t){if(S(t,Error)){return"Error.message: ".concat(t.message," \n Error.stack: ").concat(t.stack)}if((typeof t==="undefined"?"undefined":A(t))==="object"&&t!==null){if(e.has(t)){return"[Circular ".concat(n||"root","]")}e.add(t)}if(typeof t==="function"){return"function"}if((typeof t==="undefined"?"undefined":A(t))==="symbol"){return"symbol"}if(typeof t==="undefined"){return null}return t}};var B=function(e){if(typeof e==="string"){return e}try{if(S(e,Error)){return(JSON.stringify(e,z())||"undefined").replace(/"/gim,"")}return JSON.stringify(e,z())}catch(e){return'{"error":"error happen when airTracker stringify"}'}};
7
+ var q=function(e){if(!e){return false}if(/^\s*$/.test(e))return false;e=e.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@");e=e.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");e=e.replace(/(?:^|:|,)(?:\s*\[)+/g,"");return/^[\],:{}\s]*$/.test(e)};var z=function(){var e=new WeakSet;return function(n,t){if(S(t,Error)){return"Error.message: ".concat(t.message," \n Error.stack: ").concat(t.stack)}if((typeof t==="undefined"?"undefined":A(t))==="object"&&t!==null){if(e.has(t)){return"[Circular ".concat(n||"root","]")}e.add(t)}if(typeof t==="function"){return"function"}if((typeof t==="undefined"?"undefined":A(t))==="symbol"){return"symbol"}if(typeof t==="undefined"){return null}return t}};var B=function(e){if(typeof e==="string"){return e}try{if(S(e,Error)){return(JSON.stringify(e,z())||"undefined").replace(/"/gim,"")}return JSON.stringify(e,z())}catch(e){return'{"error":"error happen when airTracker stringify"}'}};
8
8
  // src/util/http.ts
9
- var W=function(e){var n=e.method,t=n===void 0?"post":n,r=e.url,i=e.data,o=e.success,a=e.fail;if(!H(i)){return}var u=new XMLHttpRequest;u.addEventListener("readystatechange",(function(){if(u.readyState===4){if(u.status>=400||u.status===0){a===null||a===void 0?void 0:a(u.response)}else{o===null||o===void 0?void 0:o(u.response)}}}));u.open(t,r);u.setRequestHeader("Content-Type","application/json");u.send(i)};
9
+ var W=function(e){var n=e.method,t=n===void 0?"post":n,r=e.url,i=e.data,o=e.success,a=e.fail;if(!q(i)){return}var u=new XMLHttpRequest;u.addEventListener("readystatechange",(function(){if(u.readyState===4){if(u.status>=400||u.status===0){a===null||a===void 0?void 0:a(u.response)}else{o===null||o===void 0?void 0:o(u.response)}}}));u.open(t,r);u.setRequestHeader("Content-Type","application/json");u.send(i)};
10
10
  // src/constant/lifeCycleEventName.ts
11
11
  var V={onInit:"onInit",onConfigInit:"onConfigInit",onCommonDataInit:"onCommonDataInit",onCommonUpdated:"onCommonUpdated"};
12
12
  // src/constant/index.ts
@@ -14,7 +14,7 @@ var X="AIR_ANALYTICS_DEVICE_ID";var G="AIR_ANALYTICS_SESSION_ID";var $="AWX_RISK
14
14
  // src/util/index.ts
15
15
  var Y=function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var n=Math.random()*16|0;var t=e==="x"?n:n&3|8;return t.toString(16)}));return e};var Z=function(e){var n,t,r;if(e.config.getMFEName){return e.config.getMFEName()}return((r=location)===null||r===void 0?void 0:(t=r.pathname)===null||t===void 0?void 0:(n=t.split("/"))===null||n===void 0?void 0:n[2])||"unknown"};var ee=function(){try{var e=window.sessionStorage.getItem(G);if(!e){e=Y();window.sessionStorage.setItem(G,e)}return e}catch(e){return Y()}};var ne=function(){try{var e=window.localStorage.getItem(X);if(!e){e=Y();window.localStorage.setItem(X,e)}return e}catch(e){}};var te=function(){try{var e=window.localStorage.getItem($);return e||void 0}catch(e){}};var re=function(){var e;var n="";var t=navigator.userAgent.match(/NetType\/(\w+)/);if(t){var r;r=j(t,2),n=r[1]}else if((e=navigator)===null||e===void 0?void 0:e.connection){var i,o,a,u;n=((o=navigator)===null||o===void 0?void 0:(i=o.connection)===null||i===void 0?void 0:i.effectiveType)||((u=navigator)===null||u===void 0?void 0:(a=u.connection)===null||a===void 0?void 0:a.type)}if(!n){n="unknown"}return ie(n)};var ie=function(e){e=String(e).toLowerCase();if(e.indexOf("4g")>=0)return"net4g"/* net4g */;if(e.indexOf("wifi")>=0)return"wifi"/* wifi */;if(e.indexOf("5g")>=0)return"net5g"/* net5g */;if(e.indexOf("3g")>=0)return"net3g"/* net3g */;if(e.indexOf("2g")>=0)return"net2g"/* net2g */;return"unknown"/* unknown */};var oe=function e(){return typeof window.performance!=="undefined"&&typeof window.performance.clearResourceTimings==="function"&&typeof window.performance.getEntriesByType==="function"&&typeof window.performance.now==="function"};var ae=function(e){if(typeof e==="string"){var n=e.split("?")[0]||"";return n.slice(0,200)}return e};var ue=function(e){if(typeof e==="string"){return e.split("?")[1]||""}return e};var se=function(e){var n=typeof e==="string"&&e.startsWith("//");return n?typeof location!=="undefined"&&location.protocol==="https:":/^https/.test(e)};var ce=function(e,n){if(typeof e==="number"){return e}if(typeof e==="string"){return e}return-1/* number */};var fe=function(e,n){var t;var r=false;if(!n.config.isWebappContainer){r=le(e,n.config.assetSpeedMonitoringWhiteList);return r}var i=Z(n);return r||le(e,(t=n.config.assetSpeedMonitoringWhiteListByMFE)===null||t===void 0?void 0:t[i])};var le=function(e,n){if(!(n===null||n===void 0?void 0:n.length)){return false}for(var t=0;t<n.length;t++){var r=n[t];if(S(r,RegExp)&&r.test(e)){return true}if(typeof r=="string"&&e.includes(r)){return true}}return false};var ve=function(e,n){var t=100;return Math.round((e-n)*t)/t};
16
16
  // src/pipes/send.ts
17
- var de=function(e){return function(n){var t,r;var i=Z(e);var o=e.config.isWebappContainer?P({},e.commonData||{},((t=e.MFECommonDataMap)===null||t===void 0?void 0:t[i])||{}):e.commonData;var a=Array.isArray(n)?n:[n];if(a.length===0){return}var u={commonData:o,data:a};var s=B(u);var c={method:"post",url:J(e.commonData.env),data:s};if(typeof((r=navigator)===null||r===void 0?void 0:r.sendBeacon)==="function"){var f=navigator.sendBeacon(c.url,s);if(!f){W(c)}}else{W(c)}}};var me=function(e){return function(n){var t,r;var i=Z(e);var o=e.config.isWebappContainer?P({},e.commonData||{},((t=e.MFECommonDataMap)===null||t===void 0?void 0:t[i])||{}):e.commonData;var a={commonData:o,data:Array.isArray(n)?n:[n]};var u=B(a);var s={method:"post",url:Q(e.commonData.env),data:u};if(typeof((r=navigator)===null||r===void 0?void 0:r.sendBeacon)==="function"){var c=navigator.sendBeacon(s.url,u);if(!c){W(s)}}else{W(s)}}};
17
+ var de=function(e){return function(n){var t,r;var i=Z(e);var o=e.config.isWebappContainer?O({},e.commonData||{},((t=e.MFECommonDataMap)===null||t===void 0?void 0:t[i])||{}):e.commonData;var a=Array.isArray(n)?n:[n];if(a.length===0){return}var u={commonData:o,data:a};var s=B(u);var c={method:"post",url:J(e.commonData.env),data:s};if(typeof((r=navigator)===null||r===void 0?void 0:r.sendBeacon)==="function"){var f=navigator.sendBeacon(c.url,s);if(!f){W(c)}}else{W(c)}}};var me=function(e){return function(n){var t,r;var i=Z(e);var o=e.config.isWebappContainer?O({},e.commonData||{},((t=e.MFECommonDataMap)===null||t===void 0?void 0:t[i])||{}):e.commonData;var a={commonData:o,data:Array.isArray(n)?n:[n]};var u=B(a);var s={method:"post",url:Q(e.commonData.env),data:u};if(typeof((r=navigator)===null||r===void 0?void 0:r.sendBeacon)==="function"){var c=navigator.sendBeacon(s.url,u);if(!c){W(s)}}else{W(s)}}};
18
18
  // src/pipes/throttle.ts
19
19
  var pe=function(e,n){var t;var r=[];var i=e.config;window.addEventListener("beforeunload",(function(){if(r.length>0){e.immediateSendPipe(r.splice(0,r.length));t&&clearTimeout(t)}}));return function(o,a){r.push(o);e.lifeCycle.on(V.onCommonUpdated,(function(){if(r.length>0){a===null||a===void 0?void 0:a(r.splice(0,r.length));e.lifeCycle.remove(V.onCommonUpdated);t&&clearTimeout(t)}}));if(r.length>=n){a===null||a===void 0?void 0:a(r.splice(0,r.length));t&&clearTimeout(t);return}t&&clearTimeout(t);t=setTimeout((function(){t=null;if(r.length>0){a===null||a===void 0?void 0:a(r.splice(0,r.length));e.lifeCycle.remove(V.onCommonUpdated)}}),i.delay)}};
20
20
  // src/pipes/errorRepeatLimit.ts
@@ -22,25 +22,25 @@ var he=function(e){var n={};return function(t,r){var i=typeof e.config.errorRepe
22
22
  // src/pipes/index.ts
23
23
  var ye=function(){};var we=function(e){if(!e||!e.reduce||!e.length){throw new TypeError("createPipeline need at least one function param")}if(e.length===1){return function(n,t){e[0](n,t||ye)}}return e.reduce((function(e,n){return function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ye;return e(t,(function(e){return n===null||n===void 0?void 0:n(e,r)}))}}))};
24
24
  // src/util/eventEmitter.ts
25
- var ge=function(){function e(){var n=this;k(this,e);this.emit=function(e,t){if(!n)return;var r=n.eventsList[e];var i;if(r===null||r===void 0?void 0:r.length){r=r.slice();for(var o=0;o<r.length;o++){i=r[o];try{var a=i.callback.apply(n,[t]);if(1===i.type){n.remove(e,i.callback)}if(false===a){break}}catch(e){throw e}}}return n};this.eventsList={}}E(e,[{key:"indexOf",value:function e(n,t){for(var r=0;r<n.length;r++){if(n[r].callback===t){return r}}return-1}},{key:"on",value:function e(n,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(!this)return;var i=this.eventsList[n];if(!i){this.eventsList[n]=[];i=this.eventsList[n]}if(this.indexOf(i,t)===-1){var o={name:n,type:r||0,callback:t};i.push(o);return this}return this}},{key:"one",value:function e(n,t){this.on(n,t,1)}},{key:"remove",value:function e(n,t){if(!this)return;var r=this.eventsList[n];if(!r){return null}if(!t){try{delete this.eventsList[n]}catch(e){}return null}if(r.length){var i=this.indexOf(r,t);r.splice(i,1)}return this}},{key:"clear",value:function e(){this.eventsList={}}}]);return e}();
25
+ var be=function(){function e(){var n=this;k(this,e);this.emit=function(e,t){if(!n)return;var r=n.eventsList[e];var i;if(r===null||r===void 0?void 0:r.length){r=r.slice();for(var o=0;o<r.length;o++){i=r[o];try{var a=i.callback.apply(n,[t]);if(1===i.type){n.remove(e,i.callback)}if(false===a){break}}catch(e){throw e}}}return n};this.eventsList={}}E(e,[{key:"indexOf",value:function e(n,t){for(var r=0;r<n.length;r++){if(n[r].callback===t){return r}}return-1}},{key:"on",value:function e(n,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if(!this)return;var i=this.eventsList[n];if(!i){this.eventsList[n]=[];i=this.eventsList[n]}if(this.indexOf(i,t)===-1){var o={name:n,type:r||0,callback:t};i.push(o);return this}return this}},{key:"one",value:function e(n,t){this.on(n,t,1)}},{key:"remove",value:function e(n,t){if(!this)return;var r=this.eventsList[n];if(!r){return null}if(!t){try{delete this.eventsList[n]}catch(e){}return null}if(r.length){var i=this.indexOf(r,t);r.splice(i,1)}return this}},{key:"clear",value:function e(){this.eventsList={}}}]);return e}();
26
26
  // src/interface/plugins.ts
27
- var be=function(){function e(n){k(this,e);this.name="";
27
+ var ge=function(){function e(n){k(this,e);this.name="";
28
28
  // initiation flag
29
29
  this.isInit=false;this.name=n.name;this.option=n}E(e,[{key:"patch",value:function e(n){if(!this.isInit){var t,r;this.isInit=true;(r=this.option)===null||r===void 0?void 0:(t=r.setUp)===null||t===void 0?void 0:t.call(this.option,n)}}},{key:"uninstall",value:function e(){var n,t;(t=this.option)===null||t===void 0?void 0:(n=t.destroy)===null||n===void 0?void 0:n.apply(this);this.isInit=false}}]);return e}();
30
30
  // src/plugins/onErrorPlugin.ts
31
- var ke;var xe=function(e){var n="".concat(B(e.message)||""," @ (").concat(B(e.filename)||"",":").concat(e.lineno||0,":").concat(e.colno||0,")\n").concat(B(e.error||""));ke.normalLogPipeLine({severity:"autoDetectError"/* AUTO_DETECT_ERROR */,eventName:"windowOnError"/* windowOnError */,extraInfo:{error:n}})};var Ee=function(e){var n=e&&B(e.reason);ke.normalLogPipeLine({severity:"autoDetectError"/* AUTO_DETECT_ERROR */,eventName:"promiseError"/* promiseError */,extraInfo:{error:n}})};var Ie=function(e){var n=(e===null||e===void 0?void 0:e.target)||(e===null||e===void 0?void 0:e.srcElement);if(!n){return}var t=(n===null||n===void 0?void 0:n.src)||(n===null||n===void 0?void 0:n.href);var r=n.tagName;var i="unknown"/* unknown */;if(typeof t==="string"&&r){if(window.location.href.indexOf(t)>-1){return}if(/\.js$/.test(t)){i="script"/* script */}else if(/\.css$/.test(t)){i="css"/* css */}else{switch(r.toLowerCase()){case"script":i="script"/* script */;break;case"link":i="css"/* css */;break;case"img":i="image"/* img */;break;case"audio":case"video":i="media"/* media */;break;default:return}}ke.normalLogPipeLine({severity:"autoDetectError"/* AUTO_DETECT_ERROR */,eventName:"staticFileLoadError"/* staticFileLoadError */,extraInfo:{staticFileType:i,error:"".concat(r," load fail: ").concat(t)}})}};var Se=new be({name:"errorDetectionPlugin",setUp:function(e){ke=e;window.addEventListener("error",xe);window.addEventListener("unhandledrejection",Ee);window.document.addEventListener("error",Ie,true)},destroy:function(){window.removeEventListener("unhandledrejection",Ee);window.document.removeEventListener("error",Ie,true);window.removeEventListener("error",xe)}});
31
+ var ke;var xe=function(e){var n="".concat(B(e.message)||""," @ (").concat(B(e.filename)||"",":").concat(e.lineno||0,":").concat(e.colno||0,")\n").concat(B(e.error||""));ke.normalLogPipeLine({severity:"autoDetectError"/* AUTO_DETECT_ERROR */,eventName:"windowOnError"/* windowOnError */,extraInfo:{error:n}})};var Ee=function(e){var n=e&&B(e.reason);ke.normalLogPipeLine({severity:"autoDetectError"/* AUTO_DETECT_ERROR */,eventName:"promiseError"/* promiseError */,extraInfo:{error:n}})};var Ie=function(e){var n=(e===null||e===void 0?void 0:e.target)||(e===null||e===void 0?void 0:e.srcElement);if(!n){return}var t=(n===null||n===void 0?void 0:n.src)||(n===null||n===void 0?void 0:n.href);var r=n.tagName;var i="unknown"/* unknown */;if(typeof t==="string"&&r){if(window.location.href.indexOf(t)>-1){return}if(/\.js$/.test(t)){i="script"/* script */}else if(/\.css$/.test(t)){i="css"/* css */}else{switch(r.toLowerCase()){case"script":i="script"/* script */;break;case"link":i="css"/* css */;break;case"img":i="image"/* img */;break;case"audio":case"video":i="media"/* media */;break;default:return}}ke.normalLogPipeLine({severity:"autoDetectError"/* AUTO_DETECT_ERROR */,eventName:"staticFileLoadError"/* staticFileLoadError */,extraInfo:{staticFileType:i,error:"".concat(r," load fail: ").concat(t)}})}};var Se=new ge({name:"errorDetectionPlugin",setUp:function(e){ke=e;window.addEventListener("error",xe);window.addEventListener("unhandledrejection",Ee);window.document.addEventListener("error",Ie,true)},destroy:function(){window.removeEventListener("unhandledrejection",Ee);window.document.removeEventListener("error",Ie,true);window.removeEventListener("error",xe)}});
32
32
  // src/plugins/assetsSpeedPlugin.ts
33
33
  var Ne=["img","css","script","link","audio","video","iframe"];var Ce="resource";var De=function(e){var n=e.name;return{url:ae(n),method:"get",
34
34
  // duration = redirect + DNS + CONNECTION + request + response
35
35
  duration:Number(e.duration.toFixed(2)),
36
36
  // time it takes to load
37
- type:"static",isHttps:se(n),urlQuery:ue(n),domainLookup:ce(e.domainLookupEnd-e.domainLookupStart),connectTime:ce(e.connectEnd-e.connectStart)}};var Te=function(e,n){for(var t=0,r=e.length;t<r;t++){var i=e[t];if(Ne.indexOf(i.initiatorType)!==-1&&fe(i.name,n)){n.normalLogPipeLine({severity:"performance"/* PERFORMANCE */,eventName:"assets_speed"/* ASSETS_SPEED */,extraInfo:{log:De(i)}})}}};var Pe;var Oe;var Re=new be({name:"assetsSpeedPlugin",setUp:function(e){if(!oe())return;var n=0;window.performance.onresourcetimingbufferfull=function(){n=0;window.performance.clearResourceTimings()};if(typeof window.PerformanceObserver==="function"){Te(window.performance.getEntriesByType(Ce),e);Oe=new window.PerformanceObserver((function(n){Te(n.getEntries(),e)}));Oe.observe({entryTypes:[Ce]})}else{Pe=setInterval((function(){var t=window.performance.getEntriesByType(Ce);var r=t.slice(n);n=t.length;Te(r,e)}),3e3)}},destroy:function(){Oe===null||Oe===void 0?void 0:Oe.disconnect();Pe&&clearInterval(Pe)}});
37
+ type:"static",isHttps:se(n),urlQuery:ue(n),domainLookup:ce(e.domainLookupEnd-e.domainLookupStart),connectTime:ce(e.connectEnd-e.connectStart)}};var Te=function(e,n){for(var t=0,r=e.length;t<r;t++){var i=e[t];if(Ne.indexOf(i.initiatorType)!==-1&&fe(i.name,n)){n.normalLogPipeLine({severity:"performance"/* PERFORMANCE */,eventName:"assets_speed"/* ASSETS_SPEED */,extraInfo:{log:De(i)}})}}};var Oe;var Pe;var Re=new ge({name:"assetsSpeedPlugin",setUp:function(e){if(!oe())return;var n=0;window.performance.onresourcetimingbufferfull=function(){n=0;window.performance.clearResourceTimings()};if(typeof window.PerformanceObserver==="function"){Te(window.performance.getEntriesByType(Ce),e);Pe=new window.PerformanceObserver((function(n){Te(n.getEntries(),e)}));Pe.observe({entryTypes:[Ce]})}else{Oe=setInterval((function(){var t=window.performance.getEntriesByType(Ce);var r=t.slice(n);n=t.length;Te(r,e)}),3e3)}},destroy:function(){Pe===null||Pe===void 0?void 0:Pe.disconnect();Oe&&clearInterval(Oe)}});
38
38
  // src/plugins/onPageChangePlugin.ts
39
- var je;var _e=new be({name:"onPageChangePlugin",setUp:function(){var e=b((function(e){var n,t,r,i,o;return U(this,(function(a){t=(n=location)===null||n===void 0?void 0:n.href;r=document.querySelector("body");i=function(n){var t=n.prevHref;var r,i,o,a,u;e.normalLogPipeLine({severity:"autoDetectEvent"/* AUTO_DETECT_EVENT */,eventName:"onPageChange"/* onPageChange */,extraInfo:{prevHref:t,href:((r=location)===null||r===void 0?void 0:r.href)||"",hostname:(i=location)===null||i===void 0?void 0:i.hostname,pathName:(o=location)===null||o===void 0?void 0:o.pathname,protocol:(a=location)===null||a===void 0?void 0:a.protocol,search:(u=location)===null||u===void 0?void 0:u.search}})};i({prevHref:""});je=new MutationObserver((function(){if(location.href!==t){var e=t;t=location.href;i({prevHref:e})}}));o={subtree:true,childList:true};je.observe(r||document,o);return[2]}))}));return function(n){return e.apply(this,arguments)}}(),destroy:function(){je===null||je===void 0?void 0:je.disconnect()}});
39
+ var je;var _e=new ge({name:"onPageChangePlugin",setUp:function(){var e=g((function(e){var n,t,r,i,o;return U(this,(function(a){t=(n=location)===null||n===void 0?void 0:n.href;r=document.querySelector("body");i=function(n){var t=n.prevHref;var r,i,o,a,u;e.normalLogPipeLine({severity:"autoDetectEvent"/* AUTO_DETECT_EVENT */,eventName:"onPageChange"/* onPageChange */,extraInfo:{prevHref:t,href:((r=location)===null||r===void 0?void 0:r.href)||"",hostname:(i=location)===null||i===void 0?void 0:i.hostname,pathName:(o=location)===null||o===void 0?void 0:o.pathname,protocol:(a=location)===null||a===void 0?void 0:a.protocol,search:(u=location)===null||u===void 0?void 0:u.search}})};i({prevHref:""});je=new MutationObserver((function(){if(location.href!==t){var e=t;t=location.href;i({prevHref:e})}}));o={subtree:true,childList:true};je.observe(r||document,o);return[2]}))}));return function(n){return e.apply(this,arguments)}}(),destroy:function(){je===null||je===void 0?void 0:je.disconnect()}});
40
40
  // src/plugins/pageRetentionPlugin.ts
41
- var Ae;var Le=new be({name:"onPageRetentionPlugin",setUp:function(){var e=b((function(e){var n,t,r,i,o,a,u;return U(this,(function(s){if(typeof document.visibilityState==="undefined"){return[2]}t=(n=location)===null||n===void 0?void 0:n.href;r=document.querySelector("body");o=function(){i=Date.now()};o();document.addEventListener("visibilitychange",(function(){if(document.visibilityState==="hidden"){a({href:location.href,leftReason:"visibilityChange"/* visibilityChange */})}else if(document.visibilityState==="visible"){o()}}));window.addEventListener("beforeunload",(function(){a({href:location.href,sendImmediate:true,leftReason:"pageClose"/* pageClose */})}));a=function(n){var t=n.href,r=n.sendImmediate,o=n.leftReason;if(!i){return}var a=Date.now()-i;if(a===0){return}i=void 0;var u={severity:"autoDetectEvent"/* AUTO_DETECT_EVENT */,eventName:"onPageRetention"/* onPageRetention */,extraInfo:{href:t,duration:a,leftReason:o}};if(r){e.ImmediatePipeline(u);return}e.normalLogPipeLine(u)};Ae=new MutationObserver((function(){if(location.href!==t){var e=t;t=location.href;a({href:e,leftReason:"nextPage"/* nextPage */});o()}}));u={subtree:true,childList:true};Ae.observe(r||document,u);return[2]}))}));return function(n){return e.apply(this,arguments)}}(),destroy:function(){Ae===null||Ae===void 0?void 0:Ae.disconnect()}});
41
+ var Ae;var Le=new ge({name:"onPageRetentionPlugin",setUp:function(){var e=g((function(e){var n,t,r,i,o,a,u;return U(this,(function(s){if(typeof document.visibilityState==="undefined"){return[2]}t=(n=location)===null||n===void 0?void 0:n.href;r=document.querySelector("body");o=function(){i=Date.now()};o();document.addEventListener("visibilitychange",(function(){if(document.visibilityState==="hidden"){a({href:location.href,leftReason:"visibilityChange"/* visibilityChange */})}else if(document.visibilityState==="visible"){o()}}));window.addEventListener("beforeunload",(function(){a({href:location.href,sendImmediate:true,leftReason:"pageClose"/* pageClose */})}));a=function(n){var t=n.href,r=n.sendImmediate,o=n.leftReason;if(!i){return}var a=Date.now()-i;if(a===0){return}i=void 0;var u={severity:"autoDetectEvent"/* AUTO_DETECT_EVENT */,eventName:"onPageRetention"/* onPageRetention */,extraInfo:{href:t,duration:a,leftReason:o}};if(r){e.ImmediatePipeline(u);return}e.normalLogPipeLine(u)};Ae=new MutationObserver((function(){if(location.href!==t){var e=t;t=location.href;a({href:e,leftReason:"nextPage"/* nextPage */});o()}}));u={subtree:true,childList:true};Ae.observe(r||document,u);return[2]}))}));return function(n){return e.apply(this,arguments)}}(),destroy:function(){Ae===null||Ae===void 0?void 0:Ae.disconnect()}});
42
42
  // src/plugins/apiPerformancePlugin/utils.ts
43
- var Ue=function(){return Date.now().toString(36)+Math.random().toString(36).substring(2,15)};var Me=function(e,n){var t=[/^https?:\/\/[^\/]*\.airwallex\.com($|\/)/];var r=[/authenticate\/heartbeat/,/papluginlogs\/.*/,/airtracker\/.*/,/o11y(-staging|-demo)?\.airwallex\.com/,/\.(png|jpe?g|gif|svg|ico|webp|avif|css|js|json|woff2?|ttf|eot|map|txt|csv|xml)(\?.*)?(#.*)?$/i];if(r.some((function(n){return n.test(e)}))){return false}return le(e,n||t)};var Fe=function(e){var n=e.startTime,t=e.endTime,r=e.entries;if(r.length===0){return void 0}if(r.length===1){return r[0]}var i=r.filter((function(e){return e.startTime>=n&&t&&e.responseEnd<=t})).sort((function(e,n){return e.startTime-n.startTime}));return i===null||i===void 0?void 0:i[0]};var Ke=function(e){return Math.round(e*100)/100};var qe=function(e){var n=e.startTime,t=e.duration,r=e.responseStart,i=e.connectEnd,o=e.connectStart,a=e.domainLookupEnd,u=e.domainLookupStart,s=e.requestStart,c=e.secureConnectionStart,f=e.redirectEnd,l=e.redirectStart,v=e.responseStatus,d=e.responseEnd,m=e.encodedBodySize,p=e.decodedBodySize,h=e.transferSize,y=e.deliveryType,w=e.initiatorType;return{startTime:Ke(n),totalDuration:Ke(t),timeToFirstByte:ve(r,n),tcpDuration:ve(i,o),dnsDuration:ve(a,u),tlsDuration:ve(s,c),redirectDuration:ve(f,l),responseDuration:ve(d,r),encodeResponseSize:m,decodeResponseSize:p,transferSize:h,deliveryType:y,statusCode:v,initiatorType:w}};var He=function(e,n){var t=e.url,r=e.method,i=e.errorType,o=e.errorDetail;var a=Fe(e);var u=new URL(t,window.location.href),s=u.href,c=u.protocol;var f=a?qe(a):{};var l={severity:"autoDetectEvent"/* AUTO_DETECT_EVENT */,eventName:"httpClientMetrics"/* httpClientMetrics */,extraInfo:P(R(P({httpUrl:s,method:r,scheme:c},i&&{errorType:i},o&&{errorDetail:o},f),{
43
+ var Ue=function(){return Date.now().toString(36)+Math.random().toString(36).substring(2,15)};var Me=function(e,n){var t=[/^https?:\/\/[^\/]*\.airwallex\.com($|\/)/];var r=[/authenticate\/heartbeat/,/papluginlogs\/.*/,/airtracker\/.*/,/o11y(-staging|-demo)?\.airwallex\.com/,/\.(png|jpe?g|gif|svg|ico|webp|avif|css|js|json|woff2?|ttf|eot|map|txt|csv|xml)(\?.*)?(#.*)?$/i];if(r.some((function(n){return n.test(e)}))){return false}return le(e,n||t)};var Fe=function(e){var n=e.startTime,t=e.endTime,r=e.entries;if(r.length===0){return void 0}if(r.length===1){return r[0]}var i=r.filter((function(e){return e.startTime>=n&&t&&e.responseEnd<=t})).sort((function(e,n){return e.startTime-n.startTime}));return i===null||i===void 0?void 0:i[0]};var Ke=function(e){return Math.round(e*100)/100};var He=function(e){var n=e.startTime,t=e.duration,r=e.responseStart,i=e.connectEnd,o=e.connectStart,a=e.domainLookupEnd,u=e.domainLookupStart,s=e.requestStart,c=e.secureConnectionStart,f=e.redirectEnd,l=e.redirectStart,v=e.responseStatus,d=e.responseEnd,m=e.encodedBodySize,p=e.decodedBodySize,h=e.transferSize,y=e.deliveryType,w=e.initiatorType;return{startTime:Ke(n),totalDuration:Ke(t),timeToFirstByte:ve(r,n),tcpDuration:ve(i,o),dnsDuration:ve(a,u),tlsDuration:ve(s,c),redirectDuration:ve(f,l),responseDuration:ve(d,r),encodeResponseSize:m,decodeResponseSize:p,transferSize:h,deliveryType:y,statusCode:v,initiatorType:w}};var qe=function(e,n){var t=e.url,r=e.method,i=e.errorType,o=e.errorDetail;var a=Fe(e);var u=new URL(t,window.location.href),s=u.href,c=u.protocol;var f=a?He(a):{};var l={severity:"autoDetectEvent"/* AUTO_DETECT_EVENT */,eventName:"httpClientMetrics"/* httpClientMetrics */,extraInfo:O(R(O({httpUrl:s,method:r,scheme:c},i&&{errorType:i},o&&{errorDetail:o},f),{
44
44
  // use injected response as fallback
45
45
  statusCode:(f===null||f===void 0?void 0:f.statusCode)||(e===null||e===void 0?void 0:e.responseStatus),startTime:(f===null||f===void 0?void 0:f.startTime)||(e===null||e===void 0?void 0:e.startTime),initiatorType:(f===null||f===void 0?void 0:f.initiatorType)||(e===null||e===void 0?void 0:e.initiatorType)}),n)};return l};var ze=function(e){// Has data or errors at root level
46
46
  return e&&(typeof e==="undefined"?"undefined":A(e))==="object"&&"errors"in e&&// If errors exist, they should be an array with proper GraphQL error shape
@@ -48,17 +48,17 @@ Array.isArray(e.errors)&&e.errors.every((function(e){return e&&(typeof e==="unde
48
48
  // src/plugins/apiPerformancePlugin/type.ts
49
49
  var Be="awx_airtracker_api_performance_queue";var We="awx_airtracker_api_performance_plugin_loaded";
50
50
  // src/plugins/apiPerformancePlugin/index.ts
51
- var Ve=300;var Xe=1e4;var Ge=typeof window!=="undefined"?window:typeof global!=="undefined"?global:{};Ge[Be]=Ge[Be]||[];var $e=function(e,n,t){setTimeout((function(){var r=He(e,t);n.observerPipeline(r);Ge[Be]=Ge[Be].filter((function(n){return n.id!==e.id}))}),Ve)};var Je=function(e,n){setTimeout((function(){var t=Ge[Be].find((function(n){return n.id===e}));if(!t){return}var r=He(t,{exceptionType:"timeout-without-response"});n.observerPipeline(r);Ge[Be]=Ge[Be].filter((function(n){return n.id!==e}))}),Xe)};var Qe=function(e){var n=XMLHttpRequest.prototype.open;var t=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function t(r,i,o,a,u){try{var s;var c=Ue();this.__requestId=c;var f=S(i,URL)?i.href:new URL(i,window.location.href).href;if(!Me(f,(s=e.config)===null||s===void 0?void 0:s.enableRecordAPIPerformanceWhitelist)){return n.call(this,r,i,o!==null&&o!==void 0?o:true,a,u)}var l={id:c,startTime:performance.now(),method:r,url:f,entries:[],initiatorType:"xmlhttprequest"};Ge[Be].push(l);Je(c,e);return n.call(this,r,i,o!==null&&o!==void 0?o:true,a,u)}catch(t){e.normalLogPipeLine({severity:"warn"/* WARN */,eventName:"apiPerformancePluginError",extraInfo:{message:"Inject XHR open error",error:t}});return n.call(this,r,i,o!==null&&o!==void 0?o:true,a,u)}};XMLHttpRequest.prototype.send=function n(){var r=this;for(var i=arguments.length,o=new Array(i),a=0;a<i;a++){o[a]=arguments[a]}try{var u=Ge[Be].find((function(e){return e.id===r.__requestId}));if(!u){return t.apply(this,o)}var s=this;this.addEventListener("loadend",b((function(){var n,t,r,i,o,a,c;return U(this,(function(f){switch(f.label){case 0:n=performance.now();t=n-u.startTime;r=s.status;if(r===0){return[2]}u.endTime=n;u.duration=t;u.responseStatus=r;f.label=1;case 1:f.trys.push([1,6,,7]);if(!(s.responseType===""||s.responseType==="text"))return[3,2];i=s.responseText;return[3,5];case 2:if(!(s.responseType==="json"))return[3,3];i=s.response;return[3,5];case 3:if(!(s.responseType==="blob"))return[3,5];o=s.response;if(!((o===null||o===void 0?void 0:o.type)==="application/json"))return[3,5];return[4,o.text()];case 4:i=f.sent();f.label=5;case 5:a=i&&typeof i==="string"?JSON.parse(i):i;if(a&&ze(a)){u.errorType="graphqlError";u.errorDetail=a.errors}return[3,7];case 6:c=f.sent();e.normalLogPipeLine({severity:"warn"/* WARN */,eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in XHR",url:u===null||u===void 0?void 0:u.url,error:c}});return[3,7];case 7:$e(u,e);return[2]}}))})));this.addEventListener("error",(function(){$e(u,e,{exceptionType:"network-error"})}));this.addEventListener("abort",(function(){$e(u,e,{exceptionType:"abort-error"})}));this.addEventListener("timeout",(function(){$e(u,e,{exceptionType:"timeout-error"})}));return t.apply(this,o)}catch(n){e.normalLogPipeLine({severity:"warn"/* WARN */,eventName:"apiPerformancePluginError",extraInfo:{message:"InjectXHR send error",error:n}});throw n}}};var Ye=function(e){var n=window.fetch;window.fetch=b((function(){var t,r,i,o,a,u,s,c,f,l,v,d,m,p,h,y;var w=arguments;return U(this,(function(g){switch(g.label){case 0:for(t=w.length,r=new Array(t),i=0;i<t;i++){r[i]=w[i]}u=new URL(S(r[0],Request)?r[0].url:String(r[0]),window.location.href).href;if(!!Me(u,(o=e.config)===null||o===void 0?void 0:o.enableRecordAPIPerformanceWhitelist))return[3,2];return[4,n.apply(this,r)];case 1:return[2,g.sent()];case 2:g.trys.push([2,9,,10]);c=performance.now();f=Ue();a={id:f,startTime:c,method:((s=S(r[0],Request)?r[0]:r[1])===null||s===void 0?void 0:s.method)||"GET",url:u,entries:[],initiatorType:"fetch"};Ge[Be].push(a);Je(f,e);return[4,n.apply(this,r)];case 3:l=g.sent();v=performance.now();a.endTime=v;a.duration=v-c;a.responseStatus=l.status;d=l.clone();g.label=4;case 4:g.trys.push([4,7,,8]);if(!d.ok)return[3,6];return[4,d.json()];case 5:m=g.sent();if(m&&ze(m)){a.errorType="graphqlError";a.errorDetail=m.errors}g.label=6;case 6:return[3,8];case 7:p=g.sent();e.normalLogPipeLine({severity:"warn"/* WARN */,eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in fetch",url:a===null||a===void 0?void 0:a.url,error:p}});return[3,8];case 8:$e(a,e);return[2,l];case 9:h=g.sent();if(a&&a.id&&Ge[Be].find((function(e){return e.id===(a===null||a===void 0?void 0:a.id)}))){y="fetch-error";if(S(h,TypeError)){y="network-error"}else if(S(h,DOMException)&&h.name==="AbortError"){y="abort-error"}$e(a,e,{exceptionType:y})}else{e.normalLogPipeLine({severity:"warn"/* WARN */,eventName:"apiPerformancePluginError",extraInfo:{message:"Inject fetch error",error:h}})}throw h;case 10:return[2]}}))}))};var Ze=function(e){var n;Qe(e);Ye(e);if((n=window)===null||n===void 0?void 0:n.PerformanceObserver){var t=new window.PerformanceObserver((function(e){var n=e.getEntries();n.forEach((function(e){var n=e;if(n.initiatorType==="fetch"||n.initiatorType==="xmlhttprequest"){var t=Ge[Be].filter((function(e){return e.url===n.name}));t.forEach((function(e){e.entries.push(n)}))}}))}));t.observe({entryTypes:["resource"],buffered:true})}else{e.normalLogPipeLine({severity:"warn"/* WARN */,eventName:"apiPerformancePluginError",extraInfo:{error:"PerformanceObserver Not Supported"}})}};var en=new be({name:"apiPerformancePlugin",setUp:function(){var e=b((function(e){var n,t;return U(this,(function(r){if(Ge[We]){return[2]}if(((n=e.config)===null||n===void 0?void 0:n.enableRecordAPIPerformance)&&Math.random()<(((t=e.config)===null||t===void 0?void 0:t.enableRecordAPIPerformancePercentage)||0)){Ge[We]=true;Ze(e)}return[2]}))}));return function(n){return e.apply(this,arguments)}}()});
51
+ var Ve=300;var Xe=1e4;var Ge=typeof window!=="undefined"?window:typeof global!=="undefined"?global:{};Ge[Be]=Ge[Be]||[];var $e=function(e,n,t){setTimeout((function(){var r=qe(e,t);n.observerPipeline(r);Ge[Be]=Ge[Be].filter((function(n){return n.id!==e.id}))}),Ve)};var Je=function(e,n){setTimeout((function(){var t=Ge[Be].find((function(n){return n.id===e}));if(!t){return}var r=qe(t,{exceptionType:"timeout-without-response"});n.observerPipeline(r);Ge[Be]=Ge[Be].filter((function(n){return n.id!==e}))}),Xe)};var Qe=function(e){var n=XMLHttpRequest.prototype.open;var t=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function t(r,i,o,a,u){try{var s;var c=Ue();this.__requestId=c;var f=S(i,URL)?i.href:new URL(i,window.location.href).href;if(!Me(f,(s=e.config)===null||s===void 0?void 0:s.enableRecordAPIPerformanceWhitelist)){return n.call(this,r,i,o!==null&&o!==void 0?o:true,a,u)}var l={id:c,startTime:performance.now(),method:r,url:f,entries:[],initiatorType:"xmlhttprequest"};Ge[Be].push(l);Je(c,e);return n.call(this,r,i,o!==null&&o!==void 0?o:true,a,u)}catch(t){e.normalLogPipeLine({severity:"warn"/* WARN */,eventName:"apiPerformancePluginError",extraInfo:{message:"Inject XHR open error",error:t}});return n.call(this,r,i,o!==null&&o!==void 0?o:true,a,u)}};XMLHttpRequest.prototype.send=function n(){var r=this;for(var i=arguments.length,o=new Array(i),a=0;a<i;a++){o[a]=arguments[a]}try{var u=Ge[Be].find((function(e){return e.id===r.__requestId}));if(!u){return t.apply(this,o)}var s=this;this.addEventListener("loadend",g((function(){var n,t,r,i,o,a,c;return U(this,(function(f){switch(f.label){case 0:n=performance.now();t=n-u.startTime;r=s.status;if(r===0){return[2]}u.endTime=n;u.duration=t;u.responseStatus=r;f.label=1;case 1:f.trys.push([1,6,,7]);if(!(s.responseType===""||s.responseType==="text"))return[3,2];i=s.responseText;return[3,5];case 2:if(!(s.responseType==="json"))return[3,3];i=s.response;return[3,5];case 3:if(!(s.responseType==="blob"))return[3,5];o=s.response;if(!((o===null||o===void 0?void 0:o.type)==="application/json"))return[3,5];return[4,o.text()];case 4:i=f.sent();f.label=5;case 5:a=i&&typeof i==="string"?JSON.parse(i):i;if(a&&ze(a)){u.errorType="graphqlError";u.errorDetail=a.errors}return[3,7];case 6:c=f.sent();e.normalLogPipeLine({severity:"warn"/* WARN */,eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in XHR",url:u===null||u===void 0?void 0:u.url,error:c}});return[3,7];case 7:$e(u,e);return[2]}}))})));this.addEventListener("error",(function(){$e(u,e,{exceptionType:"network-error"})}));this.addEventListener("abort",(function(){$e(u,e,{exceptionType:"abort-error"})}));this.addEventListener("timeout",(function(){$e(u,e,{exceptionType:"timeout-error"})}));return t.apply(this,o)}catch(n){e.normalLogPipeLine({severity:"warn"/* WARN */,eventName:"apiPerformancePluginError",extraInfo:{message:"InjectXHR send error",error:n}});throw n}}};var Ye=function(e){var n=window.fetch;window.fetch=g((function(){var t,r,i,o,a,u,s,c,f,l,v,d,m,p,h,y;var w=arguments;return U(this,(function(b){switch(b.label){case 0:for(t=w.length,r=new Array(t),i=0;i<t;i++){r[i]=w[i]}u=new URL(S(r[0],Request)?r[0].url:String(r[0]),window.location.href).href;if(!!Me(u,(o=e.config)===null||o===void 0?void 0:o.enableRecordAPIPerformanceWhitelist))return[3,2];return[4,n.apply(this,r)];case 1:return[2,b.sent()];case 2:b.trys.push([2,9,,10]);c=performance.now();f=Ue();a={id:f,startTime:c,method:((s=S(r[0],Request)?r[0]:r[1])===null||s===void 0?void 0:s.method)||"GET",url:u,entries:[],initiatorType:"fetch"};Ge[Be].push(a);Je(f,e);return[4,n.apply(this,r)];case 3:l=b.sent();v=performance.now();a.endTime=v;a.duration=v-c;a.responseStatus=l.status;d=l.clone();b.label=4;case 4:b.trys.push([4,7,,8]);if(!d.ok)return[3,6];return[4,d.json()];case 5:m=b.sent();if(m&&ze(m)){a.errorType="graphqlError";a.errorDetail=m.errors}b.label=6;case 6:return[3,8];case 7:p=b.sent();e.normalLogPipeLine({severity:"warn"/* WARN */,eventName:"apiPerformancePluginError",extraInfo:{message:"Parse response body error in fetch",url:a===null||a===void 0?void 0:a.url,error:p}});return[3,8];case 8:$e(a,e);return[2,l];case 9:h=b.sent();if(a&&a.id&&Ge[Be].find((function(e){return e.id===(a===null||a===void 0?void 0:a.id)}))){y="fetch-error";if(S(h,TypeError)){y="network-error"}else if(S(h,DOMException)&&h.name==="AbortError"){y="abort-error"}$e(a,e,{exceptionType:y})}else{e.normalLogPipeLine({severity:"warn"/* WARN */,eventName:"apiPerformancePluginError",extraInfo:{message:"Inject fetch error",error:h}})}throw h;case 10:return[2]}}))}))};var Ze=function(e){var n;Qe(e);Ye(e);if((n=window)===null||n===void 0?void 0:n.PerformanceObserver){var t=new window.PerformanceObserver((function(e){var n=e.getEntries();n.forEach((function(e){var n=e;if(n.initiatorType==="fetch"||n.initiatorType==="xmlhttprequest"){var t=Ge[Be].filter((function(e){return e.url===n.name}));t.forEach((function(e){e.entries.push(n)}))}}))}));t.observe({entryTypes:["resource"],buffered:true})}else{e.normalLogPipeLine({severity:"warn"/* WARN */,eventName:"apiPerformancePluginError",extraInfo:{error:"PerformanceObserver Not Supported"}})}};var en=new ge({name:"apiPerformancePlugin",setUp:function(){var e=g((function(e){var n,t;return U(this,(function(r){if(Ge[We]){return[2]}if(((n=e.config)===null||n===void 0?void 0:n.enableRecordAPIPerformance)&&Math.random()<(((t=e.config)===null||t===void 0?void 0:t.enableRecordAPIPerformancePercentage)||0)){Ge[We]=true;Ze(e)}return[2]}))}));return function(n){return e.apply(this,arguments)}}()});
52
52
  // src/util/version.ts
53
53
  var nn="3.1.0";
54
54
  // src/airTracker.ts
55
- var tn=function(){function e(n){var t=this;var r=n.config,i=n.plugins,o=i===void 0?[]:i;k(this,e);this.config=K;this.lifeCycle=new ge;this.plugins=[];this._commonData=q;this._MFECommonDataMap={};
55
+ var tn=function(){function e(n){var t=this;var r=n.config,i=n.plugins,o=i===void 0?[]:i;k(this,e);this.config=K;this.lifeCycle=new be;this.plugins=[];this._commonData=H;this._MFECommonDataMap={};
56
56
  // customized speed log
57
- this.timeMap={};this.packedDataConvert=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o,a;var u=P({severity:n,eventName:r,currentHref:t.config.hideSearchParams?(((o=location)===null||o===void 0?void 0:o.href)||"").split("?")[0]||"":((a=location)===null||a===void 0?void 0:a.href)||""},i);if(t.config.isWebappContainer){u.MFEName=Z(t)}return u};this.normalPipelineObj=we([pe(this,8),he(this),de(this)]);this.observerPipelineObj=we([pe(this,8),me(this)]);this.immediateSendPipe=de(this);this.observerPipeline=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});return t.observerPipelineObj(o)};this.normalLogPipeLine=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});if(t.config.disableThrottle){return t.immediateSendPipe(o)}else{return t.normalPipelineObj(o)}};this.ImmediatePipeline=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});return t.immediateSendPipe(o)};this.plugins=_(o);this.setConfig(r);this.initCommonData(r);this.lifeCycle.emit(V.onInit);if(r.enableErrorMonitoring){this.plugins.push(Se)}if((r===null||r===void 0?void 0:r.assetSpeedMonitoringWhiteList)&&r.assetSpeedMonitoringWhiteList.length>0||r.isWebappContainer){this.plugins.push(Re)}if(r===null||r===void 0?void 0:r.enableDetectPageChange){this.plugins.push(_e)}if(r===null||r===void 0?void 0:r.enableRecordPageRetention){this.plugins.push(Le)}if((r===null||r===void 0?void 0:r.enableRecordAPIPerformance)&&(r===null||r===void 0?void 0:r.enableRecordAPIPerformancePercentage)&&r.enableRecordAPIPerformancePercentage>0&&r.enableRecordAPIPerformancePercentage<=1){this.plugins.push(en)}this.installPlugins()}E(e,[{key:"installPlugins",value:function e(){var n=this;this.plugins.forEach((function(e){e.patch(n)}))}},{key:"commonData",get:function e(){return this._commonData}},{key:"MFECommonDataMap",get:function e(){return this._MFECommonDataMap}},{key:"initCommonData",value:function e(n){this._commonData.sessionId=n.useSessionStorageForSessionId?ee():Y();this._commonData.deviceId=ne()||F;this._commonData.riskDeviceId=te();this._commonData.networkType=re()||"unknown"/* unknown */;this._commonData.env=n.env||this._commonData.env;this._commonData.accountId=n.accountId||F;this._commonData.appVersion=n.appVersion;this._commonData.appName=n.appName;this._commonData.sdkVersion=nn;this.lifeCycle.emit(V.onCommonDataInit,this.commonData)}},{key:"updateCommonDataBasedOnConfig",value:function e(n){this.lifeCycle.emit(V.onCommonUpdated,this._commonData);this._commonData.env=n.env||this._commonData.env;this._commonData.appName=n.appName||this._commonData.appName;this._commonData.env=n.env||this._commonData.env;this._commonData.accountId=n.accountId||this._commonData.accountId;this._commonData.appVersion=n.appVersion||this._commonData.appVersion}},{
57
+ this.timeMap={};this.packedDataConvert=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o,a;var u=O({severity:n,eventName:r,currentHref:t.config.hideSearchParams?(((o=location)===null||o===void 0?void 0:o.href)||"").split("?")[0]||"":((a=location)===null||a===void 0?void 0:a.href)||""},i);if(t.config.isWebappContainer){u.MFEName=Z(t)}return u};this.normalPipelineObj=we([pe(this,8),he(this),de(this)]);this.observerPipelineObj=we([pe(this,8),me(this)]);this.immediateSendPipe=de(this);this.observerPipeline=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});return t.observerPipelineObj(o)};this.normalLogPipeLine=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});if(t.config.disableThrottle){return t.immediateSendPipe(o)}else{return t.normalPipelineObj(o)}};this.ImmediatePipeline=function(e){var n=e.severity,r=e.eventName,i=e.extraInfo;var o=t.packedDataConvert({severity:n,eventName:r,extraInfo:i});return t.immediateSendPipe(o)};this.plugins=_(o);this.setConfig(r);this.initCommonData(r);this.lifeCycle.emit(V.onInit);if(r.enableErrorMonitoring){this.plugins.push(Se)}if((r===null||r===void 0?void 0:r.assetSpeedMonitoringWhiteList)&&r.assetSpeedMonitoringWhiteList.length>0||r.isWebappContainer){this.plugins.push(Re)}if(r===null||r===void 0?void 0:r.enableDetectPageChange){this.plugins.push(_e)}if(r===null||r===void 0?void 0:r.enableRecordPageRetention){this.plugins.push(Le)}if((r===null||r===void 0?void 0:r.enableRecordAPIPerformance)&&(r===null||r===void 0?void 0:r.enableRecordAPIPerformancePercentage)&&r.enableRecordAPIPerformancePercentage>0&&r.enableRecordAPIPerformancePercentage<=1){this.plugins.push(en)}this.installPlugins()}E(e,[{key:"installPlugins",value:function e(){var n=this;this.plugins.forEach((function(e){e.patch(n)}))}},{key:"commonData",get:function e(){return this._commonData}},{key:"MFECommonDataMap",get:function e(){return this._MFECommonDataMap}},{key:"initCommonData",value:function e(n){this._commonData.sessionId=n.useSessionStorageForSessionId?ee():Y();this._commonData.deviceId=ne()||F;this._commonData.riskDeviceId=te();this._commonData.networkType=re()||"unknown"/* unknown */;this._commonData.env=n.env||this._commonData.env;this._commonData.accountId=n.accountId||F;this._commonData.appVersion=n.appVersion;this._commonData.appName=n.appName;this._commonData.sdkVersion=nn;this.lifeCycle.emit(V.onCommonDataInit,this.commonData)}},{key:"updateCommonDataBasedOnConfig",value:function e(n){this.lifeCycle.emit(V.onCommonUpdated,this._commonData);this._commonData.env=n.env||this._commonData.env;this._commonData.appName=n.appName||this._commonData.appName;this._commonData.env=n.env||this._commonData.env;this._commonData.accountId=n.accountId||this._commonData.accountId;this._commonData.appVersion=n.appVersion||this._commonData.appVersion}},{
58
58
  // Can add extra common data based on developers' needs
59
- key:"updateCommonData",value:function e(n){this.lifeCycle.emit(V.onCommonUpdated,this._commonData);this._commonData=P({},this._commonData,n)}},{key:"removeCommonDataByKey",value:function e(n){var t=this;this.lifeCycle.emit(V.onCommonUpdated,this._commonData);setTimeout((function(){n.forEach((function(e){delete t._commonData[e]}))}),1e3)}},{
59
+ key:"updateCommonData",value:function e(n){this.lifeCycle.emit(V.onCommonUpdated,this._commonData);this._commonData=O({},this._commonData,n)}},{key:"removeCommonDataByKey",value:function e(n){var t=this;this.lifeCycle.emit(V.onCommonUpdated,this._commonData);setTimeout((function(){n.forEach((function(e){delete t._commonData[e]}))}),1e3)}},{
60
60
  // only worked if isWebappContainer is true
61
- key:"addToMFECommonData",value:function e(n){var t=n.MFEName,r=n.MFECommonData;var i;if(!this.config.isWebappContainer){return}if(!t||!r){return}this._MFECommonDataMap=R(P({},this._MFECommonDataMap||{}),I({},t,P({},((i=this._MFECommonDataMap)===null||i===void 0?void 0:i[t])||{},r)))}},{
61
+ key:"addToMFECommonData",value:function e(n){var t=n.MFEName,r=n.MFECommonData;var i;if(!this.config.isWebappContainer){return}if(!t||!r){return}this._MFECommonDataMap=R(O({},this._MFECommonDataMap||{}),I({},t,O({},((i=this._MFECommonDataMap)===null||i===void 0?void 0:i[t])||{},r)))}},{
62
62
  // support set config later
63
63
  key:"setConfig",value:function e(n){var t=this;if(this.config.isWebappContainer){return}var r=function(e,n){t.config[e]=n};Object.entries(n).forEach((function(e){var n=j(e,2),t=n[0],i=n[1];if((typeof i==="undefined"?"undefined":A(i))!==void 0){r(t,i)}}));this.lifeCycle.emit(V.onConfigInit,this.config);this.updateCommonDataBasedOnConfig(n)}},{
64
64
  // send verbose level log
@@ -73,11 +73,11 @@ key:"warn",value:function e(n,t){this.normalLogPipeLine({severity:"warn"/* WARN
73
73
  key:"error",value:function e(n,t){console.error("error",n);this.normalLogPipeLine({severity:"error"/* ERROR */,eventName:n,extraInfo:t})}},{
74
74
  // send business related log, usually used for data analysis
75
75
  // all the logs with isBusinessData == true, will be sync to bigQuery / looker
76
- key:"businessLog",value:function e(n,t){this.normalLogPipeLine({severity:"info"/* INFO */,eventName:n,extraInfo:R(P({},t),{isBusinessLog:true})})}},{
76
+ key:"businessLog",value:function e(n,t){this.normalLogPipeLine({severity:"info"/* INFO */,eventName:n,extraInfo:R(O({},t),{isBusinessLog:true})})}},{
77
77
  // duration: milliseconds
78
- key:"reportDuration",value:function e(n,t,r){if(typeof n!=="string"){console.warn("reportDuration: eventName (first param) must be a string");return}if(typeof t!=="number"){console.warn("reportDuration: duration (second param) must be number");return}if(t<0||t>6e4){console.warn("reportDuration: duration (second param) must between 0 and 60000");return}this.normalLogPipeLine({severity:"speed"/* SPEED */,eventName:n,extraInfo:P({duration:t},r)})}},{key:"getTimerKey",value:function e(n){var t=Z(this);return this.config.isWebappContainer?"".concat(t,"_").concat(n):n}},{key:"timeStart",value:function e(n){if(typeof n!=="string"){console.warn("time: first param must be a string");return}if(this.timeMap[this.getTimerKey(n)]){console.warn("Timer ".concat(n," already exists"))}this.timeMap[this.getTimerKey(n)]=Date.now()}},{key:"timeEnd",value:function e(n,t){if(typeof n!=="string"){console.warn("timeEnd: first param must be a string");return}if(this.timeMap[this.getTimerKey(n)]){var r=Date.now()-this.timeMap[this.getTimerKey(n)]+(t||0);this.normalLogPipeLine({severity:"speed"/* SPEED */,eventName:n,extraInfo:{duration:r}});delete this.timeMap[this.getTimerKey(n)]}else{console.warn("Timer key :".concat(n," does not exist"))}}},{
78
+ key:"reportDuration",value:function e(n,t,r){if(typeof n!=="string"){console.warn("reportDuration: eventName (first param) must be a string");return}if(typeof t!=="number"){console.warn("reportDuration: duration (second param) must be number");return}if(t<0||t>6e4){console.warn("reportDuration: duration (second param) must between 0 and 60000");return}this.normalLogPipeLine({severity:"speed"/* SPEED */,eventName:n,extraInfo:O({duration:t},r)})}},{key:"getTimerKey",value:function e(n){var t=Z(this);return this.config.isWebappContainer?"".concat(t,"_").concat(n):n}},{key:"timeStart",value:function e(n){if(typeof n!=="string"){console.warn("time: first param must be a string");return}if(this.timeMap[this.getTimerKey(n)]){console.warn("Timer ".concat(n," already exists"))}this.timeMap[this.getTimerKey(n)]=Date.now()}},{key:"timeEnd",value:function e(n,t){if(typeof n!=="string"){console.warn("timeEnd: first param must be a string");return}if(this.timeMap[this.getTimerKey(n)]){var r=Date.now()-this.timeMap[this.getTimerKey(n)]+(t||0);this.normalLogPipeLine({severity:"speed"/* SPEED */,eventName:n,extraInfo:{duration:r}});delete this.timeMap[this.getTimerKey(n)]}else{console.warn("Timer key :".concat(n," does not exist"))}}},{
79
79
  // only worked if isWebappContainer is true
80
- key:"addToAssetSpeedWhiteListByMFE",value:function e(n){var t=n.MFEName,r=n.whiteList;var i;if(!this.config.isWebappContainer){return}if(!t||!(r===null||r===void 0?void 0:r.length)){return}if(!this.config.assetSpeedMonitoringWhiteListByMFE){this.config.assetSpeedMonitoringWhiteListByMFE={}}if(!((i=this.config.assetSpeedMonitoringWhiteListByMFE)===null||i===void 0?void 0:i[t])){this.config.assetSpeedMonitoringWhiteListByMFE=R(P({},this.config.assetSpeedMonitoringWhiteListByMFE),I({},t,r))}else{var o;var a,u;(u=this.config.assetSpeedMonitoringWhiteListByMFE)===null||u===void 0?void 0:(a=u[t])===null||a===void 0?void 0:(o=a).push.apply(o,_(r))}}},{
80
+ key:"addToAssetSpeedWhiteListByMFE",value:function e(n){var t=n.MFEName,r=n.whiteList;var i;if(!this.config.isWebappContainer){return}if(!t||!(r===null||r===void 0?void 0:r.length)){return}if(!this.config.assetSpeedMonitoringWhiteListByMFE){this.config.assetSpeedMonitoringWhiteListByMFE={}}if(!((i=this.config.assetSpeedMonitoringWhiteListByMFE)===null||i===void 0?void 0:i[t])){this.config.assetSpeedMonitoringWhiteListByMFE=R(O({},this.config.assetSpeedMonitoringWhiteListByMFE),I({},t,r))}else{var o;var a,u;(u=this.config.assetSpeedMonitoringWhiteListByMFE)===null||u===void 0?void 0:(a=u[t])===null||a===void 0?void 0:(o=a).push.apply(o,_(r))}}},{
81
81
  // please call destroy from your app root component when your app unmount
82
82
  key:"destroy",value:function e(){if(this.config.isWebappContainer){return}this.plugins.forEach((function(e){e.uninstall()}))}}]);return e}();
83
83
  // src/index.ts
@@ -96,7 +96,7 @@ var rn=tn;
96
96
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
97
97
  PERFORMANCE OF THIS SOFTWARE.
98
98
  ***************************************************************************** */
99
- /* global Reflect, Promise, SuppressedError, Symbol */var on=function(e,n){on=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)if(Object.prototype.hasOwnProperty.call(n,t))e[t]=n[t]};return on(e,n)};function an(e,n){if(typeof n!=="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");on(e,n);function t(){this.constructor=e}e.prototype=n===null?Object.create(n):(t.prototype=n.prototype,new t)}var un=function(){un=Object.assign||function e(n){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o))n[o]=t[o]}return n};return un.apply(this,arguments)};function sn(e,n,t,r){function i(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(n,t){function o(e){try{u(r.next(e))}catch(e){t(e)}}function a(e){try{u(r["throw"](e))}catch(e){t(e)}}function u(e){e.done?n(e.value):i(e.value).then(o,a)}u((r=r.apply(e,[])).next())}))}function cn(e,n){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(e){return function(n){return s([e,n])}}function s(u){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(t=0)),t)try{if(r=1,i&&(o=u[0]&2?i["return"]:u[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;if(i=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:t.label++;return{value:u[1],done:false};case 5:t.label++;i=u[1];u=[0];continue;case 7:u=t.ops.pop();t.trys.pop();continue;default:if(!(o=t.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1];o=u;break}if(o&&t.label<o[2]){t.label=o[2];t.ops.push(u);break}if(o[2])t.ops.pop();t.trys.pop();continue}u=n.call(e,t)}catch(e){u=[6,e];i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}function fn(e,n,t){for(var r=0,i=n.length,o;r<i;r++){if(o||!(r in n)){if(!o)o=Array.prototype.slice.call(n,0,r);o[r]=n[r]}}return e.concat(o||Array.prototype.slice.call(n))}typeof SuppressedError==="function"?SuppressedError:function(e,n,t){var r=new Error(t);return r.name="SuppressedError",r.error=e,r.suppressed=n,r};var ln="1.35.0";var vn={version:ln};var dn={dev:M.staging,staging:M.staging,demo:M.demo,prod:M.production};var mn=function(e,n){if(e===void 0){e=M.production}if(!window._AirwallexSDKs.airTracker){window._AirwallexSDKs.airTracker=new rn({config:{appName:"components-sdk",appVersion:vn.version,env:dn[e]||M.production}});window._AirwallexSDKs.airTracker.updateCommonData({clientId:n})}return window._AirwallexSDKs.airTracker};var pn=function(e){if(typeof e!=="object"){return e}try{var n=JSON.parse(JSON.stringify(e));Object.keys(n).forEach((function(e){if(typeof e==="string"&&["auth","code"].some((function(n){return e.includes(n)}))){n[e]="***"}}));return n}catch(n){return e}};var hn=function(e,n){var t,r;(r=(t=window._AirwallexSDKs)===null||t===void 0?void 0:t.airTracker)===null||r===void 0?void 0:r.error(e,un(un({},n),{context:"components-sdk"}))};var yn=function(e,n){var t;(t=window._AirwallexSDKs.airTracker)===null||t===void 0?void 0:t.warn(e,un(un({},n),{context:"components-sdk"}))};var wn=function(e,n){var t;(t=window._AirwallexSDKs.airTracker)===null||t===void 0?void 0:t.info(e,un(un({},n),{context:"components-sdk"}))};var gn=/** @class */function(e){an(n,e);function n(n){var t=e.call(this,n)||this;t.code="LOAD_SCRIPT_ERROR";return t}return n}(Error);var bn,kn;var xn;(function(e){e["dev"]="dev";e["staging"]="staging";e["demo"]="demo";e["prod"]="prod";e["sandbox"]="sandbox"})(xn||(xn={}));var En=(bn={},bn[xn.dev]="https://checkout-staging.airwallex.com",bn[xn.staging]="https://checkout-staging.airwallex.com",bn[xn.demo]="https://checkout-demo.airwallex.com",bn[xn.prod]="https://checkout.airwallex.com",bn[xn.sandbox]="https://checkout.sandbox.airwallex.com",bn);var In=(kn={},kn[xn.dev]="https://static-staging.airwallex.com",kn[xn.staging]="https://static-staging.airwallex.com",kn[xn.demo]="https://static-demo.airwallex.com",kn[xn.prod]="https://static.airwallex.com",kn[xn.sandbox]="https://static.sandbox.airwallex.com",kn);var Sn="sdkController";var Nn="payments";var Cn={kyc:"/widgets/kyc/sdk/v1/index.js",rfi:"/widgets/kycRfi/sdk/v1/index.js",paymentsKyb:"/widgets/paymentsKyb/sdk/v1/index.js",sdkController:"/widgets/sdk-controller/sdk/v1/index.js",payouts:"/widgets/payouts/sdk/v1/index.js",payments:"/assets/elements.bundle.min.js",sca:"/hosted-sca/sdk/v1/index.js",taxForm:"/widgets/taxForm/sdk/v1/index.js",billing:"/widgets/checkout/sdk/v1/index.js"};var Dn={
99
+ /* global Reflect, Promise, SuppressedError, Symbol */var on=function(e,n){on=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)if(Object.prototype.hasOwnProperty.call(n,t))e[t]=n[t]};return on(e,n)};function an(e,n){if(typeof n!=="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");on(e,n);function t(){this.constructor=e}e.prototype=n===null?Object.create(n):(t.prototype=n.prototype,new t)}var un=function(){un=Object.assign||function e(n){for(var t,r=1,i=arguments.length;r<i;r++){t=arguments[r];for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o))n[o]=t[o]}return n};return un.apply(this,arguments)};function sn(e,n,t,r){function i(e){return e instanceof t?e:new t((function(n){n(e)}))}return new(t||(t=Promise))((function(n,t){function o(e){try{u(r.next(e))}catch(e){t(e)}}function a(e){try{u(r["throw"](e))}catch(e){t(e)}}function u(e){e.done?n(e.value):i(e.value).then(o,a)}u((r=r.apply(e,[])).next())}))}function cn(e,n){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(e){return function(n){return s([e,n])}}function s(u){if(r)throw new TypeError("Generator is already executing.");while(a&&(a=0,u[0]&&(t=0)),t)try{if(r=1,i&&(o=u[0]&2?i["return"]:u[0]?i["throw"]||((o=i["return"])&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;if(i=0,o)u=[u[0]&2,o.value];switch(u[0]){case 0:case 1:o=u;break;case 4:t.label++;return{value:u[1],done:false};case 5:t.label++;i=u[1];u=[0];continue;case 7:u=t.ops.pop();t.trys.pop();continue;default:if(!(o=t.trys,o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){t.label=u[1];break}if(u[0]===6&&t.label<o[1]){t.label=o[1];o=u;break}if(o&&t.label<o[2]){t.label=o[2];t.ops.push(u);break}if(o[2])t.ops.pop();t.trys.pop();continue}u=n.call(e,t)}catch(e){u=[6,e];i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}}function fn(e,n,t){for(var r=0,i=n.length,o;r<i;r++){if(o||!(r in n)){if(!o)o=Array.prototype.slice.call(n,0,r);o[r]=n[r]}}return e.concat(o||Array.prototype.slice.call(n))}typeof SuppressedError==="function"?SuppressedError:function(e,n,t){var r=new Error(t);return r.name="SuppressedError",r.error=e,r.suppressed=n,r};var ln="1.35.1";var vn={version:ln};var dn={dev:M.staging,staging:M.staging,demo:M.demo,prod:M.production};var mn=function(e,n){if(e===void 0){e=M.production}if(!window._AirwallexSDKs.airTracker){window._AirwallexSDKs.airTracker=new rn({config:{appName:"components-sdk",appVersion:vn.version,env:dn[e]||M.production}});window._AirwallexSDKs.airTracker.updateCommonData({clientId:n})}return window._AirwallexSDKs.airTracker};var pn=function(e){if(typeof e!=="object"){return e}try{var n=JSON.parse(JSON.stringify(e));Object.keys(n).forEach((function(e){if(typeof e==="string"&&["auth","code"].some((function(n){return e.includes(n)}))){n[e]="***"}}));return n}catch(n){return e}};var hn=function(e,n){var t,r;(r=(t=window._AirwallexSDKs)===null||t===void 0?void 0:t.airTracker)===null||r===void 0?void 0:r.error(e,un(un({},n),{context:"components-sdk"}))};var yn=function(e,n){var t;(t=window._AirwallexSDKs.airTracker)===null||t===void 0?void 0:t.warn(e,un(un({},n),{context:"components-sdk"}))};var wn=function(e,n){var t;(t=window._AirwallexSDKs.airTracker)===null||t===void 0?void 0:t.info(e,un(un({},n),{context:"components-sdk"}))};var bn=/** @class */function(e){an(n,e);function n(n){var t=e.call(this,n)||this;t.code="LOAD_SCRIPT_ERROR";return t}return n}(Error);var gn,kn;var xn;(function(e){e["dev"]="dev";e["staging"]="staging";e["demo"]="demo";e["prod"]="prod";e["sandbox"]="sandbox"})(xn||(xn={}));var En=(gn={},gn[xn.dev]="https://checkout-staging.airwallex.com",gn[xn.staging]="https://checkout-staging.airwallex.com",gn[xn.demo]="https://checkout-demo.airwallex.com",gn[xn.prod]="https://checkout.airwallex.com",gn[xn.sandbox]="https://checkout.sandbox.airwallex.com",gn);var In=(kn={},kn[xn.dev]="https://static-staging.airwallex.com",kn[xn.staging]="https://static-staging.airwallex.com",kn[xn.demo]="https://static-demo.airwallex.com",kn[xn.prod]="https://static.airwallex.com",kn[xn.sandbox]="https://static.sandbox.airwallex.com",kn);var Sn="sdkController";var Nn="payments";var Cn={kyc:"/widgets/kyc/sdk/v1/index.js",rfi:"/widgets/kycRfi/sdk/v1/index.js",paymentsKyb:"/widgets/paymentsKyb/sdk/v1/index.js",sdkController:"/widgets/sdk-controller/sdk/v1/index.js",payouts:"/widgets/payouts/sdk/v1/index.js",payments:"/assets/elements.bundle.min.js",sca:"/hosted-sca/sdk/v1/index.js",taxForm:"/widgets/taxForm/sdk/v1/index.js",billing:"/widgets/checkout/sdk/v1/index.js",balance:"/widgets/embedded-balance/sdk/v1/index.js"};var Dn={
100
100
  // legacy
101
101
  kyc:"kyc",paymentsKyb:"paymentsKyb",
102
102
  // rfi elements
@@ -108,20 +108,22 @@ hpp:"payments",cvc:"payments",card:"payments",expiry:"payments",dropIn:"payments
108
108
  // sca elements
109
109
  scaSetup:"sca",scaVerify:"sca",scaManagement:"sca",taxForm:"taxForm",
110
110
  // billing elements
111
- embeddedCheckout:"billing"};var Tn={payments:["hpp","cvc","card","expiry","dropIn","cardNumber","applePayButton","googlePayButton","krCardNumber","krCardIdentifier","krCardExpiry","krCardPswFirstTwo"],payouts:["payoutForm","beneficiaryForm"],onboarding:["kyc","paymentsKyb"],risk:["scaSetup","scaVerify","scaManagement","transactionRfi","kycRfi","paymentEnablementRfi","lendingRfi","mrmRfi"],billing:["embeddedCheckout"]};var Pn={billing:["payments"]};var On=["payments","sca","billing"];var Rn=/** @class */function(e){an(n,e);function n(n){var t=e.call(this,n)||this;t.code="INVALID_STATIC_RESOURCE_ERROR";return t}return n}(Error);var jn=Date.now();var _n=function(e){return Object.keys(Tn).includes(e)};var An=function(e){if(e===void 0){e=500}return new Promise((function(n){return window.setTimeout(n,e)}))};var Ln=function(e){return Dn[e]};var Un=function(e,n){var t=e===Nn?En:In;return t[n]||t.prod};
111
+ embeddedCheckout:"billing",
112
+ // balance elements
113
+ balanceOverview:"balance",balanceDetail:"balance",balanceActivities:"balance",balanceActivityDetails:"balance",balanceHistoryChart:"balance",balanceInfo:"balance",balanceScheduledTransactions:"balance",balanceList:"balance"};var Tn={payments:["hpp","cvc","card","expiry","dropIn","cardNumber","applePayButton","googlePayButton","krCardNumber","krCardIdentifier","krCardExpiry","krCardPswFirstTwo"],payouts:["payoutForm","beneficiaryForm"],onboarding:["kyc","paymentsKyb"],risk:["scaSetup","scaVerify","scaManagement","transactionRfi","kycRfi","paymentEnablementRfi","lendingRfi","mrmRfi"],billing:["embeddedCheckout"],balance:["balanceOverview","balanceDetail","balanceActivities","balanceHistoryChart","balanceInfo","balanceScheduledTransactions","balanceList","balanceActivityDetails"]};var On={billing:["payments"]};var Pn=["payments","sca","billing"];var Rn=/** @class */function(e){an(n,e);function n(n){var t=e.call(this,n)||this;t.code="INVALID_STATIC_RESOURCE_ERROR";return t}return n}(Error);var jn=Date.now();var _n=function(e){return Object.keys(Tn).includes(e)};var An=function(e){if(e===void 0){e=500}return new Promise((function(n){return window.setTimeout(n,e)}))};var Ln=function(e){return Dn[e]};var Un=function(e,n){var t=e===Nn?En:In;return t[n]||t.prod};
112
114
  /**
113
115
  * get the elements and sdks that need registry by controller
114
116
  * @param enabledElements the enabledElements passed in init params
115
117
  * @returns array of deduplicated elementName pair with sdkName
116
118
  */var Mn=function(e){
117
119
  // e.g., ['hpp', 'payoutForm', 'kyc', 'kyc']
118
- var n=e.reduce((function(e,n){return e.concat(_n(n)?Tn[n]:n)}),[]);return Array.from(new Set(n)).map((function(e){return{elementName:e,sdkName:Ln(e)}}))};var Fn=function(e){return Array.from(new Set(Mn(e).map((function(e){var n=e.sdkName;return n})).filter((function(e){return On.includes(e)}))))};var Kn=function(e){return e==="payments"?"payment":e};
120
+ var n=e.reduce((function(e,n){return e.concat(_n(n)?Tn[n]:n)}),[]);return Array.from(new Set(n)).map((function(e){return{elementName:e,sdkName:Ln(e)}}))};var Fn=function(e){return Array.from(new Set(Mn(e).map((function(e){var n=e.sdkName;return n})).filter((function(e){return Pn.includes(e)}))))};var Kn=function(e){return e==="payments"?"payment":e};
119
121
  /**
120
122
  * get the CDN url of a specific package
121
123
  * @param name declare the element name
122
124
  * @param env the environment of package
123
125
  * @returns string the CDN url
124
- */var qn=function(e){var n=e.name,t=e.env,r=t===void 0?xn.prod:t;var i=Un(n,r);var o=Cn[n];if(!o){hn("[components-sdk] Element static resource not found",{sdkName:n});throw new Rn("Element ".concat(n," static resource URL is invalid."))}return"".concat(i).concat(o,"?ts=").concat(jn)};var Hn=function(){return On.reduce((function(e,n){var t;return un(un({},e),(t={},t[n]=window._AirwallexSDKs.__controller__.internalSDKs[n],t))}),{})};var zn=function(e){return Pn[e]||[]};var Bn=function(){return Math.floor(performance.now())};var Wn=function(e){var n=document.createElement("script");n.src=e;n.type="module";var t=document.head||document.body;t.appendChild(n);return n};var Vn=3;var Xn=function(e){return sn(void 0,void 0,void 0,(function(){var n,t;return cn(this,(function(r){switch(r.label){case 0:if(typeof window==="undefined"){throw new Error("Please load script in browser environment")}n=0;t=function(){return sn(void 0,void 0,void 0,(function(){var t,r,i;return cn(this,(function(o){t=Bn();if(n>0&&e.includes("?ts=")){r=new URL(e,window.location.href);r.searchParams.set("ts","".concat(Date.now()));e=r.toString()}i=Wn(e);return[2/*return*/,new Promise((function(r,o){i.addEventListener("load",(function(){var i=Bn();wn("[components-sdk] SDK script loaded",{scriptUrl:e,start:t,latency:i-t,end:i,retryCount:n});r(true)}));i.addEventListener("error",(function(r){i.remove();console.error(r);var a=Bn();hn("[components-sdk] Failed to load script",{scriptUrl:e,error:r,start:t,latency:a-t,end:a,retryCount:n});o(new gn("Failed to load Airwallex SDK scripts: ".concat(e)))}))}))]}))}))};r.label=1;case 1:if(!(n<Vn))return[3/*break*/,7];r.label=2;case 2:r.trys.push([2,4,,6]);return[4/*yield*/,t()];case 3:return[2/*return*/,r.sent()];case 4:r.sent();n++;return[4/*yield*/,An()];case 5:r.sent();return[3/*break*/,6];case 6:return[3/*break*/,1];case 7:hn("[components-sdk] Failed to load script after retry",{scriptUrl:e,retryCount:n});throw new gn("Failed to load Airwallex SDK scripts: ".concat(e))}}))}))};var Gn=/** @class */function(e){an(n,e);function n(n){var t=e.call(this,n)||this;t.code="INSTANCE_NOT_FOUND_ERROR";return t}return n}(Error);var $n;
126
+ */var Hn=function(e){var n=e.name,t=e.env,r=t===void 0?xn.prod:t;var i=Un(n,r);var o=Cn[n];if(!o){hn("[components-sdk] Element static resource not found",{sdkName:n});throw new Rn("Element ".concat(n," static resource URL is invalid."))}return"".concat(i).concat(o,"?ts=").concat(jn)};var qn=function(){return Pn.reduce((function(e,n){var t;return un(un({},e),(t={},t[n]=window._AirwallexSDKs.__controller__.internalSDKs[n],t))}),{})};var zn=function(e){return On[e]||[]};var Bn=function(){return Math.floor(performance.now())};var Wn=function(e){var n=document.createElement("script");n.src=e;n.type="module";var t=document.head||document.body;t.appendChild(n);return n};var Vn=3;var Xn=function(e){return sn(void 0,void 0,void 0,(function(){var n,t;return cn(this,(function(r){switch(r.label){case 0:if(typeof window==="undefined"){throw new Error("Please load script in browser environment")}n=0;t=function(){return sn(void 0,void 0,void 0,(function(){var t,r,i;return cn(this,(function(o){t=Bn();if(n>0&&e.includes("?ts=")){r=new URL(e,window.location.href);r.searchParams.set("ts","".concat(Date.now()));e=r.toString()}i=Wn(e);return[2/*return*/,new Promise((function(r,o){i.addEventListener("load",(function(){var i=Bn();wn("[components-sdk] SDK script loaded",{scriptUrl:e,start:t,latency:i-t,end:i,retryCount:n});r(true)}));i.addEventListener("error",(function(r){i.remove();console.error(r);var a=Bn();hn("[components-sdk] Failed to load script",{scriptUrl:e,error:r,start:t,latency:a-t,end:a,retryCount:n});o(new bn("Failed to load Airwallex SDK scripts: ".concat(e)))}))}))]}))}))};r.label=1;case 1:if(!(n<Vn))return[3/*break*/,7];r.label=2;case 2:r.trys.push([2,4,,6]);return[4/*yield*/,t()];case 3:return[2/*return*/,r.sent()];case 4:r.sent();n++;return[4/*yield*/,An()];case 5:r.sent();return[3/*break*/,6];case 6:return[3/*break*/,1];case 7:hn("[components-sdk] Failed to load script after retry",{scriptUrl:e,retryCount:n});throw new bn("Failed to load Airwallex SDK scripts: ".concat(e))}}))}))};var Gn=/** @class */function(e){an(n,e);function n(n){var t=e.call(this,n)||this;t.code="INSTANCE_NOT_FOUND_ERROR";return t}return n}(Error);var $n;
125
127
  /**
126
128
  * ensure one script one promise
127
129
  */var Jn=new Map;
@@ -130,7 +132,7 @@ var n=e.reduce((function(e,n){return e.concat(_n(n)?Tn[n]:n)}),[]);return Array.
130
132
  * @param scriptName declare the SDK or Functions namespace
131
133
  * @param env the resource url
132
134
  * @returns Promise to load the script
133
- */var Qn=function(e){var n=e.env,t=e.scriptName;var r=qn({name:t,env:n});
135
+ */var Qn=function(e){var n=e.env,t=e.scriptName;var r=Hn({name:t,env:n});
134
136
  // if promise was made
135
137
  var i=Jn.get(t);if(i){return i}var o=Xn(r);Jn.set(t,o);return o};
136
138
  /**
@@ -153,7 +155,7 @@ var a=(r=e.enabledElements)!==null&&r!==void 0?r:[];var u=Fn(a);
153
155
  // load SDK functions scripts
154
156
  var s=u.map((function(e){return Yn({env:i.env,scriptName:e}).then((function(){return o})).then((function(){var n=window._AirwallexSDKs[Kn(e)];if(!n){hn("[components-sdk] SDK instance not found",{functionsNamespace:e,windowSDKInstanceName:Kn(e)});throw new Gn("SDK instance not found")}return window._AirwallexSDKs.__controller__.registerFunctions({functionsNamespace:e,instance:n})}))}));
155
157
  // load SDK elements scripts
156
- var c=Mn(a);var f=c.map((function(e){var n=e.sdkName,t=e.elementName;return Yn({scriptName:n,env:i.env}).then((function(){return o})).then((function(){var e=window._AirwallexSDKs[Kn(n)];if(!e){hn("[components-sdk] SDK instance not found",{sdkName:n,windowSDKInstanceName:Kn(n)});throw new Gn("SDK instance not found")}return window._AirwallexSDKs.__controller__.registerElement({sdkName:n,elementName:t,instance:e})}))}));Promise.all(fn(fn([o],s,true),f)).then((function(){wn("[components-sdk] SDK initialized",{options:pn(e),start:Bn()});n(Hn())}))["catch"]((function(e){if(!e.code){hn("[components-sdk] Unexpected errors when init",{error:e})}t(e)}))}));return[2/*return*/,$n]}))}))};
158
+ var c=Mn(a);var f=c.map((function(e){var n=e.sdkName,t=e.elementName;return Yn({scriptName:n,env:i.env}).then((function(){return o})).then((function(){var e=window._AirwallexSDKs[Kn(n)];if(!e){hn("[components-sdk] SDK instance not found",{sdkName:n,windowSDKInstanceName:Kn(n)});throw new Gn("SDK instance not found")}return window._AirwallexSDKs.__controller__.registerElement({sdkName:n,elementName:t,instance:e})}))}));Promise.all(fn(fn([o],s,true),f)).then((function(){wn("[components-sdk] SDK initialized",{options:pn(e),start:Bn()});n(qn())}))["catch"]((function(e){if(!e.code){hn("[components-sdk] Unexpected errors when init",{error:e})}t(e)}))}));return[2/*return*/,$n]}))}))};
157
159
  /**
158
160
  * load SDK element script and call SDK instance.createElement.
159
161
  * @param elementName the element name to create
@@ -165,7 +167,7 @@ var c=Mn(a);var f=c.map((function(e){var n=e.sdkName,t=e.elementName;return Yn({
165
167
  */var nt=[Sn,Nn];
166
168
  /**
167
169
  * Prefetch scripts by preload link, only for production as there's no environment context before SDK init
168
- */var tt=function(){nt.forEach((function(e){var n=qn({name:e,env:xn.prod});var t=document.createElement("link");t.href=n;t.rel="modulepreload";t.as="script";var r=document.head||document.body;r.appendChild(t)}))};
170
+ */var tt=function(){nt.forEach((function(e){var n=Hn({name:e,env:xn.prod});var t=document.createElement("link");t.href=n;t.rel="modulepreload";t.as="script";var r=document.head||document.body;r.appendChild(t)}))};
169
171
  /**
170
172
  * @airwallex/components-sdk may run in node environment, e.g., in Next.js
171
173
  * Prefetch scripts only in browser environment
@@ -224,17 +226,17 @@ case"CANCELLED":case"REQUIRES_PAYMENT_METHOD":{return{isError:true,messages:[r("
224
226
  * Retrieve the latest Airwallex payment intent status by id.
225
227
  *
226
228
  * @returns the status, or `null` when the lookup failed.
227
- */var ht=e("d",(function(e){return sn(p,void 0,void 0,(function(){var n,t,r;return cn(this,(function(i){switch(i.label){case 0:return[4/*yield*/,u("/api/zonos-elements/collect/airwallex-payment-intent",{body:{paymentIntentId:e},method:"POST"})];case 1:n=i.sent(),t=n.errors,r=n.json;if(t.length||!r){a("Failed to retrieve Airwallex payment intent",t);return[2/*return*/,{status:null}]}return[2/*return*/,{status:r.airwallexPaymentIntent.status}]}}))}))}));var yt=n((function(){return{amountDutyTaxFeeTotal:null,amountTotalPaid:null,collectLogoUrl:null,isFetchingShippingInfo:true,landedCostShortId:null,originCompanyName:null,partyBillingId:null,paymentProcessor:null,shippingAddress:null}})).state;e("c",yt);var wt=e("h",(function(e){return sn(p,[e],void 0,(function(e){var n,r,i,o,a,c,f,v,d,m,p,h,y,w;var g=e.landedCostId,b=e.retries,k=b===void 0?5:b;return cn(this,(function(e){switch(e.label){case 0:yt.isFetchingShippingInfo=true;return[4/*yield*/,u("/api/zonos-elements/collect/get-shipping-info-by-lc-id",{body:{landedCostId:g},method:"POST"})];case 1:p=e.sent();if(!p.errors.length)return[3/*break*/,4];if(!(k>0))return[3/*break*/,3];
229
+ */var ht=e("d",(function(e){return sn(p,void 0,void 0,(function(){var n,t,r;return cn(this,(function(i){switch(i.label){case 0:return[4/*yield*/,u("/api/zonos-elements/collect/airwallex-payment-intent",{body:{paymentIntentId:e},method:"POST"})];case 1:n=i.sent(),t=n.errors,r=n.json;if(t.length||!r){a("Failed to retrieve Airwallex payment intent",t);return[2/*return*/,{status:null}]}return[2/*return*/,{status:r.airwallexPaymentIntent.status}]}}))}))}));var yt=n((function(){return{amountDutyTaxFeeTotal:null,amountTotalPaid:null,collectLogoUrl:null,isFetchingShippingInfo:true,landedCostShortId:null,originCompanyName:null,partyBillingId:null,paymentProcessor:null,shippingAddress:null}})).state;e("c",yt);var wt=e("h",(function(e){return sn(p,[e],void 0,(function(e){var n,r,i,o,a,c,f,v,d,m,p,h,y,w;var b=e.landedCostId,g=e.retries,k=g===void 0?5:g;return cn(this,(function(e){switch(e.label){case 0:yt.isFetchingShippingInfo=true;return[4/*yield*/,u("/api/zonos-elements/collect/get-shipping-info-by-lc-id",{body:{landedCostId:b},method:"POST"})];case 1:p=e.sent();if(!p.errors.length)return[3/*break*/,4];if(!(k>0))return[3/*break*/,3];
228
230
  // Wait for 1 second before retrying
229
231
  return[4/*yield*/,new Promise((function(e){return setTimeout(e,1e3)}))];case 2:
230
232
  // Wait for 1 second before retrying
231
233
  e.sent();
232
234
  // Keep retrying until we get the shipping address or we run out of retries
233
- return[2/*return*/,wt({landedCostId:g,retries:k-1})];case 3:return[2/*return*/,null];case 4:yt.landedCostShortId=((n=p.json)===null||n===void 0?void 0:n.landedCostShortId)||null;yt.isFetchingShippingInfo=false;yt.shippingAddress=((r=p.json)===null||r===void 0?void 0:r.shipping)||null;h=(i=l.checkoutSession)===null||i===void 0?void 0:i.landedCost;y=(o=l.checkoutSession)===null||o===void 0?void 0:o.subtotals;w=(((a=h===null||h===void 0?void 0:h.amountSubtotals)===null||a===void 0?void 0:a.shipping)||0)+(((c=h===null||h===void 0?void 0:h.amountSubtotals)===null||c===void 0?void 0:c.items)||0);
235
+ return[2/*return*/,wt({landedCostId:b,retries:k-1})];case 3:return[2/*return*/,null];case 4:yt.landedCostShortId=((n=p.json)===null||n===void 0?void 0:n.landedCostShortId)||null;yt.isFetchingShippingInfo=false;yt.shippingAddress=((r=p.json)===null||r===void 0?void 0:r.shipping)||null;h=(i=l.checkoutSession)===null||i===void 0?void 0:i.landedCost;y=(o=l.checkoutSession)===null||o===void 0?void 0:o.subtotals;w=(((a=h===null||h===void 0?void 0:h.amountSubtotals)===null||a===void 0?void 0:a.shipping)||0)+(((c=h===null||h===void 0?void 0:h.amountSubtotals)===null||c===void 0?void 0:c.items)||0);
234
236
  // Convert the amount to the presentment currency
235
- yt.amountTotalPaid=w*(((f=y===null||y===void 0?void 0:y.exchangeRate)===null||f===void 0?void 0:f.rate)||1);yt.amountDutyTaxFeeTotal=((y===null||y===void 0?void 0:y.duties)||0)+((y===null||y===void 0?void 0:y.taxes)||0)+((y===null||y===void 0?void 0:y.fees)||0);yt.originCompanyName=((d=(v=p.json)===null||v===void 0?void 0:v.origin)===null||d===void 0?void 0:d.companyName)||null;yt.collectLogoUrl=((m=p.json)===null||m===void 0?void 0:m.collectLogoUrl)||null;if(yt.amountTotalPaid===0){void s({endpoint:"COLLECT_NO_TOTAL_PAID",errors:[],metadata:{landedCostId:g,organizationId:t.organizationId}})}return[2/*return*/]}}))}))}));var gt=e("i",(function(){return sn(p,void 0,void 0,(function(){var e,n,t,r,i,c,v,p,h,y;return cn(this,(function(w){switch(w.label){case 0:if(!((e=d.stripeBillingAddressEventData)===null||e===void 0?void 0:e.complete)){return[2/*return*/,{partiesCreated:false}]}i=(t=(n=l.checkoutSession)===null||n===void 0?void 0:n.landedCost)===null||t===void 0?void 0:t.rootId;if(!i){
237
+ yt.amountTotalPaid=w*(((f=y===null||y===void 0?void 0:y.exchangeRate)===null||f===void 0?void 0:f.rate)||1);yt.amountDutyTaxFeeTotal=((y===null||y===void 0?void 0:y.duties)||0)+((y===null||y===void 0?void 0:y.taxes)||0)+((y===null||y===void 0?void 0:y.fees)||0);yt.originCompanyName=((d=(v=p.json)===null||v===void 0?void 0:v.origin)===null||d===void 0?void 0:d.companyName)||null;yt.collectLogoUrl=((m=p.json)===null||m===void 0?void 0:m.collectLogoUrl)||null;if(yt.amountTotalPaid===0){void s({endpoint:"COLLECT_NO_TOTAL_PAID",errors:[],metadata:{landedCostId:b,organizationId:t.organizationId}})}return[2/*return*/]}}))}))}));var bt=e("i",(function(){return sn(p,void 0,void 0,(function(){var e,n,t,r,i,c,v,p,h,y;return cn(this,(function(w){switch(w.label){case 0:if(!((e=d.stripeBillingAddressEventData)===null||e===void 0?void 0:e.complete)){return[2/*return*/,{partiesCreated:false}]}i=(t=(n=l.checkoutSession)===null||n===void 0?void 0:n.landedCost)===null||t===void 0?void 0:t.rootId;if(!i){
236
238
  // do nothing if we don't have selected landed cost
237
- void s({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:f,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId}});return[2/*return*/,{partiesCreated:false}]}if(!o.checkoutSessionId){void s({endpoint:"COLLECT_NO_CHECKOUT_SESSION_ID",errors:["No checkout session id"],metadata:{allLogs:f,cartId:window.Zonos.cartId,landedCostRootId:i}});return[2/*return*/,{partiesCreated:false}]}c=m({address:d.stripeBillingAddressEventData.value.address,firstName:d.stripeBillingAddressEventData.value.firstName,lastName:d.stripeBillingAddressEventData.value.lastName,name:d.stripeBillingAddressEventData.value.name,phone:d.stripeBillingAddressEventData.value.phone});v=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4/*yield*/,u("/api/zonos-elements/create-billing-party",{body:{billingAddress:c,checkoutSessionId:o.checkoutSessionId,companyName:d.companyName,email:((r=d.stripeLinkEventData)===null||r===void 0?void 0:r.value.email)||"",isTest:v,rootId:i},method:"POST"})];case 1:p=w.sent(),h=p.errors,y=p.json;if(h.length||!y){a("Error occurs when creating billing party",JSON.stringify(h,null,2));void s({endpoint:"COLLECT_BILLING_PARTY_CREATE_FAILED",errors:["[COLLECT] Failed to create billing party"],metadata:{allLogs:f,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,errors:h,json:y}});return[2/*return*/,{partiesCreated:false}]}yt.partyBillingId=y.billToPartyId;return[2/*return*/,{partiesCreated:true}]}}))}))}));var bt=e("g",(function(e){return sn(p,void 0,void 0,(function(){var n;return cn(this,(function(t){n=e.landedCost;if(!n){return[2/*return*/,false]}
239
+ void s({endpoint:"PF_NO_SELECTED_LANDED_COST",errors:["No selected landed cost"],metadata:{allLogs:f,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId}});return[2/*return*/,{partiesCreated:false}]}if(!o.checkoutSessionId){void s({endpoint:"COLLECT_NO_CHECKOUT_SESSION_ID",errors:["No checkout session id"],metadata:{allLogs:f,cartId:window.Zonos.cartId,landedCostRootId:i}});return[2/*return*/,{partiesCreated:false}]}c=m({address:d.stripeBillingAddressEventData.value.address,firstName:d.stripeBillingAddressEventData.value.firstName,lastName:d.stripeBillingAddressEventData.value.lastName,name:d.stripeBillingAddressEventData.value.name,phone:d.stripeBillingAddressEventData.value.phone});v=new URLSearchParams(window.location.search).get("zonosE2ETest")==="1";return[4/*yield*/,u("/api/zonos-elements/create-billing-party",{body:{billingAddress:c,checkoutSessionId:o.checkoutSessionId,companyName:d.companyName,email:((r=d.stripeLinkEventData)===null||r===void 0?void 0:r.value.email)||"",isTest:v,rootId:i},method:"POST"})];case 1:p=w.sent(),h=p.errors,y=p.json;if(h.length||!y){a("Error occurs when creating billing party",JSON.stringify(h,null,2));void s({endpoint:"COLLECT_BILLING_PARTY_CREATE_FAILED",errors:["[COLLECT] Failed to create billing party"],metadata:{allLogs:f,cartId:window.Zonos.cartId,checkoutSessionId:o.checkoutSessionId,errors:h,json:y}});return[2/*return*/,{partiesCreated:false}]}yt.partyBillingId=y.billToPartyId;return[2/*return*/,{partiesCreated:true}]}}))}))}));var gt=e("g",(function(e){return sn(p,void 0,void 0,(function(){var n;return cn(this,(function(t){n=e.landedCost;if(!n){return[2/*return*/,false]}
238
240
  // Convert the landed cost to the format that cartStore expects
239
241
  l.landedCostData=[Object.assign(Object.assign({},e),{landedCost:Object.assign({},n),landedCostId:n.id})];return[2/*return*/,v({
240
242
  // No need to update checkout session again, we already called it when starting collect, only need to apply subtotals here to utilize the cart store