@ordersune/crm-web-sdk 1.0.25 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -0
- package/dist/ordersune-crm-web-sdk-1.0.26.tgz +0 -0
- package/dist/ordersune-crm-web-sdk-1.0.27.tgz +0 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +10 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/web-sdk.d.ts +1 -0
- package/dist/web-sdk.d.ts.map +1 -0
- package/dist/web-sdk.js +604 -0
- package/dist/web-sdk.js.map +1 -0
- package/package.json +3 -11
- package/dist/ordersune-crm-web-sdk-1.0.21.tgz +0 -0
- package/dist/ordersune-crm-web-sdk-1.0.22.tgz +0 -0
- package/dist/ordersune-crm-web-sdk-1.0.23.tgz +0 -0
- package/dist/ordersune-crm-web-sdk-1.0.24.tgz +0 -0
- package/dist/ordersune-crm-web-sdk-1.0.25.tgz +0 -0
- package/dist/src/index.d.ts +0 -3
- package/dist/src/types/index.d.ts +0 -85
- package/dist/src/utils/index.d.ts +0 -1
- package/dist/src/web-sdk.d.ts +0 -51
package/dist/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9C,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
!function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("OrdersuneCRMWebSDK",[],t):"object"==typeof exports?exports.OrdersuneCRMWebSDK=t():e.OrdersuneCRMWebSDK=t()}(this,()=>(()=>{"use strict";var e={11:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.unsafeStringify=void 0;const s=i(746),n=[];for(let e=0;e<256;++e)n.push((e+256).toString(16).slice(1));function unsafeStringify(e,t=0){return(n[e[t+0]]+n[e[t+1]]+n[e[t+2]]+n[e[t+3]]+"-"+n[e[t+4]]+n[e[t+5]]+"-"+n[e[t+6]]+n[e[t+7]]+"-"+n[e[t+8]]+n[e[t+9]]+"-"+n[e[t+10]]+n[e[t+11]]+n[e[t+12]]+n[e[t+13]]+n[e[t+14]]+n[e[t+15]]).toLowerCase()}t.unsafeStringify=unsafeStringify,t.default=function stringify(e,t=0){const i=unsafeStringify(e,t);if(!(0,s.default)(i))throw TypeError("Stringified UUID is invalid");return i}},182:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.version=t.validate=t.v7=t.v6ToV1=t.v6=t.v5=t.v4=t.v3=t.v1ToV6=t.v1=t.stringify=t.parse=t.NIL=t.MAX=void 0;var s=i(196);Object.defineProperty(t,"MAX",{enumerable:!0,get:function(){return s.default}});var n=i(465);Object.defineProperty(t,"NIL",{enumerable:!0,get:function(){return n.default}});var r=i(797);Object.defineProperty(t,"parse",{enumerable:!0,get:function(){return r.default}});var o=i(11);Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return o.default}});var d=i(425);Object.defineProperty(t,"v1",{enumerable:!0,get:function(){return d.default}});var u=i(568);Object.defineProperty(t,"v1ToV6",{enumerable:!0,get:function(){return u.default}});var h=i(591);Object.defineProperty(t,"v3",{enumerable:!0,get:function(){return h.default}});var g=i(286);Object.defineProperty(t,"v4",{enumerable:!0,get:function(){return g.default}});var b=i(557);Object.defineProperty(t,"v5",{enumerable:!0,get:function(){return b.default}});var P=i(356);Object.defineProperty(t,"v6",{enumerable:!0,get:function(){return P.default}});var C=i(268);Object.defineProperty(t,"v6ToV1",{enumerable:!0,get:function(){return C.default}});var I=i(299);Object.defineProperty(t,"v7",{enumerable:!0,get:function(){return I.default}});var M=i(746);Object.defineProperty(t,"validate",{enumerable:!0,get:function(){return M.default}});var _=i(770);Object.defineProperty(t,"version",{enumerable:!0,get:function(){return _.default}})},196:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default="ffffffff-ffff-ffff-ffff-ffffffffffff"},266:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.log=void 0;t.log=(e,t,...i)=>{e&&console.log("[OrderSune CRM]",t,...i)}},268:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});const s=i(797),n=i(11);t.default=function v6ToV1(e){const t=function _v6ToV1(e){return Uint8Array.of((15&e[3])<<4|e[4]>>4&15,(15&e[4])<<4|(240&e[5])>>4,(15&e[5])<<4|15&e[6],e[7],(15&e[1])<<4|(240&e[2])>>4,(15&e[2])<<4|(240&e[3])>>4,16|(240&e[0])>>4,(15&e[0])<<4|(240&e[1])>>4,e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}("string"==typeof e?(0,s.default)(e):e);return"string"==typeof e?(0,n.unsafeStringify)(t):t}},286:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});const s=i(779),n=i(291),r=i(11);t.default=function v4(e,t,i){if(s.default.randomUUID&&!t&&!e)return s.default.randomUUID();const o=(e=e||{}).random??e.rng?.()??(0,n.default)();if(o.length<16)throw new Error("Random bytes length must be >= 16");if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t){if((i=i||0)<0||i+16>t.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[i+e]=o[e];return t}return(0,r.unsafeStringify)(o)}},291:(e,t)=>{let i;Object.defineProperty(t,"__esModule",{value:!0});const s=new Uint8Array(16);t.default=function rng(){if(!i){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");i=crypto.getRandomValues.bind(crypto)}return i(s)}},299:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateV7State=void 0;const s=i(291),n=i(11),r={};function updateV7State(e,t,i){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=i[6]<<23|i[7]<<16|i[8]<<8|i[9],e.msecs=t):(e.seq=e.seq+1|0,0===e.seq&&e.msecs++),e}function v7Bytes(e,t,i,s,n=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(s){if(n<0||n+16>s.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`)}else s=new Uint8Array(16),n=0;return t??=Date.now(),i??=127*e[6]<<24|e[7]<<16|e[8]<<8|e[9],s[n++]=t/1099511627776&255,s[n++]=t/4294967296&255,s[n++]=t/16777216&255,s[n++]=t/65536&255,s[n++]=t/256&255,s[n++]=255&t,s[n++]=112|i>>>28&15,s[n++]=i>>>20&255,s[n++]=128|i>>>14&63,s[n++]=i>>>6&255,s[n++]=i<<2&255|3&e[10],s[n++]=e[11],s[n++]=e[12],s[n++]=e[13],s[n++]=e[14],s[n++]=e[15],s}t.updateV7State=updateV7State,t.default=function v7(e,t,i){let o;if(e)o=v7Bytes(e.random??e.rng?.()??(0,s.default)(),e.msecs,e.seq,t,i);else{const e=Date.now(),n=(0,s.default)();updateV7State(r,e,n),o=v7Bytes(n,r.msecs,r.seq,t,i)}return t??(0,n.unsafeStringify)(o)}},330:e=>{e.exports=JSON.parse('{"name":"@ordersune/crm-web-sdk","version":"1.0.25","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"publishConfig":{"access":"public"},"scripts":{"build":"npm run build:bundle && npm run build:types","build:bundle":"webpack --config webpack.config.js","build:types":"tsc --emitDeclarationOnly --outDir dist","prepare":"npm run build && husky","release":"bash -c \'read -p \\"Enter OTP from authenticator: \\" OTP && GIT_AUTHOR_NAME=\\"$(git config user.name)\\" GIT_AUTHOR_EMAIL=\\"$(git config user.email)\\" GIT_COMMITTER_NAME=\\"$(git config user.name)\\" GIT_COMMITTER_EMAIL=\\"$(git config user.email)\\" NPM_CONFIG_OTP=$OTP semantic-release --no-ci\'","lint:commit":"commitlint --edit"},"files":["dist","README.md"],"dependencies":{"device-uuid":"^2.0.0","uuid":"^11.0.3"},"devDependencies":{"@commitlint/cli":"^20.1.0","@commitlint/config-conventional":"^20.0.0","@semantic-release/changelog":"^6.0.3","@semantic-release/git":"^10.0.1","@semantic-release/npm":"^13.1.2","@types/uuid":"^9.0.0","husky":"^9.1.7","javascript-obfuscator":"^4.1.1","semantic-release":"^25.0.2","terser-webpack-plugin":"^5.3.14","ts-loader":"^9.5.4","typescript":"^5.0.0","webpack":"^5.103.0","webpack-cli":"^6.0.1","webpack-obfuscator":"^3.5.1"}}')},338:(e,t)=>{function getOutputLength(e){return 14+(e+64>>>9<<4)+1}function safeAdd(e,t){const i=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(i>>16)<<16|65535&i}function md5cmn(e,t,i,s,n,r){return safeAdd(function bitRotateLeft(e,t){return e<<t|e>>>32-t}(safeAdd(safeAdd(t,e),safeAdd(s,r)),n),i)}function md5ff(e,t,i,s,n,r,o){return md5cmn(t&i|~t&s,e,t,n,r,o)}function md5gg(e,t,i,s,n,r,o){return md5cmn(t&s|i&~s,e,t,n,r,o)}function md5hh(e,t,i,s,n,r,o){return md5cmn(t^i^s,e,t,n,r,o)}function md5ii(e,t,i,s,n,r,o){return md5cmn(i^(t|~s),e,t,n,r,o)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function md5(e){return function uint32ToUint8(e){const t=new Uint8Array(4*e.length);for(let i=0;i<4*e.length;i++)t[i]=e[i>>2]>>>i%4*8&255;return t}(function wordsToMd5(e,t){const i=new Uint32Array(getOutputLength(t)).fill(0);i.set(e),i[t>>5]|=128<<t%32,i[i.length-1]=t,e=i;let s=1732584193,n=-271733879,r=-1732584194,o=271733878;for(let t=0;t<e.length;t+=16){const i=s,d=n,u=r,h=o;s=md5ff(s,n,r,o,e[t],7,-680876936),o=md5ff(o,s,n,r,e[t+1],12,-389564586),r=md5ff(r,o,s,n,e[t+2],17,606105819),n=md5ff(n,r,o,s,e[t+3],22,-1044525330),s=md5ff(s,n,r,o,e[t+4],7,-176418897),o=md5ff(o,s,n,r,e[t+5],12,1200080426),r=md5ff(r,o,s,n,e[t+6],17,-1473231341),n=md5ff(n,r,o,s,e[t+7],22,-45705983),s=md5ff(s,n,r,o,e[t+8],7,1770035416),o=md5ff(o,s,n,r,e[t+9],12,-1958414417),r=md5ff(r,o,s,n,e[t+10],17,-42063),n=md5ff(n,r,o,s,e[t+11],22,-1990404162),s=md5ff(s,n,r,o,e[t+12],7,1804603682),o=md5ff(o,s,n,r,e[t+13],12,-40341101),r=md5ff(r,o,s,n,e[t+14],17,-1502002290),n=md5ff(n,r,o,s,e[t+15],22,1236535329),s=md5gg(s,n,r,o,e[t+1],5,-165796510),o=md5gg(o,s,n,r,e[t+6],9,-1069501632),r=md5gg(r,o,s,n,e[t+11],14,643717713),n=md5gg(n,r,o,s,e[t],20,-373897302),s=md5gg(s,n,r,o,e[t+5],5,-701558691),o=md5gg(o,s,n,r,e[t+10],9,38016083),r=md5gg(r,o,s,n,e[t+15],14,-660478335),n=md5gg(n,r,o,s,e[t+4],20,-405537848),s=md5gg(s,n,r,o,e[t+9],5,568446438),o=md5gg(o,s,n,r,e[t+14],9,-1019803690),r=md5gg(r,o,s,n,e[t+3],14,-187363961),n=md5gg(n,r,o,s,e[t+8],20,1163531501),s=md5gg(s,n,r,o,e[t+13],5,-1444681467),o=md5gg(o,s,n,r,e[t+2],9,-51403784),r=md5gg(r,o,s,n,e[t+7],14,1735328473),n=md5gg(n,r,o,s,e[t+12],20,-1926607734),s=md5hh(s,n,r,o,e[t+5],4,-378558),o=md5hh(o,s,n,r,e[t+8],11,-2022574463),r=md5hh(r,o,s,n,e[t+11],16,1839030562),n=md5hh(n,r,o,s,e[t+14],23,-35309556),s=md5hh(s,n,r,o,e[t+1],4,-1530992060),o=md5hh(o,s,n,r,e[t+4],11,1272893353),r=md5hh(r,o,s,n,e[t+7],16,-155497632),n=md5hh(n,r,o,s,e[t+10],23,-1094730640),s=md5hh(s,n,r,o,e[t+13],4,681279174),o=md5hh(o,s,n,r,e[t],11,-358537222),r=md5hh(r,o,s,n,e[t+3],16,-722521979),n=md5hh(n,r,o,s,e[t+6],23,76029189),s=md5hh(s,n,r,o,e[t+9],4,-640364487),o=md5hh(o,s,n,r,e[t+12],11,-421815835),r=md5hh(r,o,s,n,e[t+15],16,530742520),n=md5hh(n,r,o,s,e[t+2],23,-995338651),s=md5ii(s,n,r,o,e[t],6,-198630844),o=md5ii(o,s,n,r,e[t+7],10,1126891415),r=md5ii(r,o,s,n,e[t+14],15,-1416354905),n=md5ii(n,r,o,s,e[t+5],21,-57434055),s=md5ii(s,n,r,o,e[t+12],6,1700485571),o=md5ii(o,s,n,r,e[t+3],10,-1894986606),r=md5ii(r,o,s,n,e[t+10],15,-1051523),n=md5ii(n,r,o,s,e[t+1],21,-2054922799),s=md5ii(s,n,r,o,e[t+8],6,1873313359),o=md5ii(o,s,n,r,e[t+15],10,-30611744),r=md5ii(r,o,s,n,e[t+6],15,-1560198380),n=md5ii(n,r,o,s,e[t+13],21,1309151649),s=md5ii(s,n,r,o,e[t+4],6,-145523070),o=md5ii(o,s,n,r,e[t+11],10,-1120210379),r=md5ii(r,o,s,n,e[t+2],15,718787259),n=md5ii(n,r,o,s,e[t+9],21,-343485551),s=safeAdd(s,i),n=safeAdd(n,d),r=safeAdd(r,u),o=safeAdd(o,h)}return Uint32Array.of(s,n,r,o)}(function uint8ToUint32(e){if(0===e.length)return new Uint32Array;const t=new Uint32Array(getOutputLength(8*e.length)).fill(0);for(let i=0;i<e.length;i++)t[i>>2]|=(255&e[i])<<i%4*8;return t}(e),8*e.length))}},356:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});const s=i(11),n=i(425),r=i(568);t.default=function v6(e,t,i){e??={},i??=0;let o=(0,n.default)({...e,_v6:!0},new Uint8Array(16));if(o=(0,r.default)(o),t){for(let e=0;e<16;e++)t[i+e]=o[e];return t}return(0,s.unsafeStringify)(o)}},383:()=>{!function(e){var t=["\\+https:\\/\\/developers.google.com\\/\\+\\/web\\/snippet\\/","googlebot","baiduspider","gurujibot","yandexbot","slurp","msnbot","bingbot","facebookexternalhit","linkedinbot","twitterbot","slackbot","telegrambot","applebot","pingdom","tumblr ","Embedly","spbot"],i=new RegExp(`^.*(${t.join("|")}).*$`),s={Edge:/(?:Edge|Edg)\/([\d\w.-]+)/i,Firefox:/firefox\/([\d\w.-]+)/i,IE:/msie\s([\d.]+[\d])|trident\/\d+\.\d+;.*[rv:]+(\d+\.\d)/i,Chrome:/chrome\/([\d\w.-]+)/i,Chromium:/(?:chromium|crios)\/([\d\w.-]+)/i,Safari:/version\/([\d\w.-]+)/i,Opera:/version\/([\d\w.-]+)|OPR\/([\d\w.-]+)/i,Ps3:/([\d\w.-]+)\)\s*$/i,Psp:/([\d\w.-]+)\)?\s*$/i,Amaya:/amaya\/([\d\w.-]+)/i,SeaMonkey:/seamonkey\/([\d\w.-]+)/i,OmniWeb:/omniweb\/v([\d\w.-]+)/i,Flock:/flock\/([\d\w.-]+)/i,Epiphany:/epiphany\/([\d\w.-]+)/i,WinJs:/msapphost\/([\d\w.-]+)/i,PhantomJS:/phantomjs\/([\d\w.-]+)/i,UC:/UCBrowser\/([\d\w.]+)/i},n={Edge:/edge|edg\//i,Amaya:/amaya/i,Konqueror:/konqueror/i,Epiphany:/epiphany/i,SeaMonkey:/seamonkey/i,Flock:/flock/i,OmniWeb:/omniweb/i,Chromium:/chromium|crios/i,Chrome:/chrome/i,Safari:/safari/i,IE:/msie|trident/i,Opera:/opera|OPR/i,PS3:/playstation 3/i,PSP:/playstation portable/i,Firefox:/firefox/i,WinJs:/msapphost/i,PhantomJS:/phantomjs/i,UC:/UCBrowser/i},r={Windows11:/windows nt 10\.0.*(?:; win64; x64|; wow64).*(?:rv:|edg\/|chrome\/).*?(\d+)/i,Windows10:/windows nt 10\.0/i,Windows81:/windows nt 6\.3/i,Windows8:/windows nt 6\.2/i,Windows7:/windows nt 6\.1/i,UnknownWindows:/windows nt 6\.\d+/i,WindowsVista:/windows nt 6\.0/i,Windows2003:/windows nt 5\.2/i,WindowsXP:/windows nt 5\.1/i,Windows2000:/windows nt 5\.0/i,WindowsPhone8:/windows phone 8\./,OSXCheetah:/os x 10[._]0/i,OSXPuma:/os x 10[._]1(\D|$)/i,OSXJaguar:/os x 10[._]2/i,OSXPanther:/os x 10[._]3/i,OSXTiger:/os x 10[._]4/i,OSXLeopard:/os x 10[._]5/i,OSXSnowLeopard:/os x 10[._]6/i,OSXLion:/os x 10[._]7/i,OSXMountainLion:/os x 10[._]8/i,OSXMavericks:/os x 10[._]9/i,OSXYosemite:/os x 10[._]10/i,OSXElCapitan:/os x 10[._]11/i,OSXSierra:/os x 10[._]12/i,OSXHighSierra:/os x 10[._]13/i,OSXMojave:/os x 10[._]14/i,OSXCatalina:/os x 10[._]15/i,MacOSBigSur:/mac os x 1[01][._](?:16|[6-9]|\d{2})|os x 10[._]16/i,MacOSMonterey:/mac os x 12[._]/i,MacOSVentura:/mac os x 13[._]/i,MacOSSonoma:/mac os x 14[._]/i,MacOSSequoia:/mac os x 15[._]/i,Mac:/os x|mac os/i,Linux:/linux/i,Linux64:/linux x86_64/i,ChromeOS:/cros/i,Wii:/wii/i,PS3:/playstation 3/i,PSP:/playstation portable/i,iPad:/\(iPad.*os (\d+)[._](\d+)/i,iPhone:/\(iPhone.*os (\d+)[._](\d+)/i,Bada:/Bada\/(\d+)\.(\d+)/i,Curl:/curl\/(\d+)\.(\d+)\.(\d+)/i},o={Windows:/windows nt/i,WindowsPhone:/windows phone/i,Mac:/macintosh/i,Linux:/linux/i,Wii:/wii/i,Playstation:/playstation/i,iPad:/ipad/i,iPod:/ipod/i,iPhone:/iphone/i,Android:/android/i,Blackberry:/blackberry/i,Samsung:/samsung/i,Curl:/curl/i},d={version:!1,language:!1,platform:!0,os:!0,pixelDepth:!0,colorDepth:!0,resolution:!1,isAuthoritative:!0,silkAccelerated:!0,isKindleFire:!0,isDesktop:!0,isMobile:!0,isTablet:!0,isWindows:!0,isLinux:!0,isLinux64:!0,isChromeOS:!0,isMac:!0,isiPad:!0,isiPhone:!0,isiPod:!0,isAndroid:!0,isSamsung:!0,isSmartTV:!0,isRaspberry:!0,isBlackberry:!0,isTouchScreen:!0,isOpera:!1,isIE:!1,isEdge:!1,isIECompatibilityMode:!1,isSafari:!1,isFirefox:!1,isWebkit:!1,isChrome:!1,isKonqueror:!1,isOmniWeb:!1,isSeaMonkey:!1,isFlock:!1,isAmaya:!1,isPhantomJS:!1,isEpiphany:!1,source:!1,cpuCores:!1},u={isAuthoritative:!0,isMobile:!1,isTablet:!1,isiPad:!1,isiPod:!1,isiPhone:!1,isAndroid:!1,isBlackberry:!1,isOpera:!1,isIE:!1,isEdge:!1,isIECompatibilityMode:!1,isSafari:!1,isFirefox:!1,isWebkit:!1,isChrome:!1,isKonqueror:!1,isOmniWeb:!1,isSeaMonkey:!1,isFlock:!1,isAmaya:!1,isPhantomJS:!1,isEpiphany:!1,isDesktop:!1,isWindows:!1,isLinux:!1,isLinux64:!1,isMac:!1,isChromeOS:!1,isBada:!1,isSamsung:!1,isRaspberry:!1,isBot:!1,isCurl:!1,isAndroidTablet:!1,isWinJs:!1,isKindleFire:!1,isSilk:!1,isCaptive:!1,isSmartTV:!1,isUC:!1,isTouchScreen:!1,silkAccelerated:!1,colorDepth:-1,pixelDepth:-1,resolution:[0,0],cpuCores:-1,language:"unknown",browser:"unknown",version:"unknown",os:"unknown",platform:"unknown",geoIp:{},source:""},O=(e,t)=>e<<t|e>>>32-t,l=(e,t)=>{let i=2147483648&e,s=2147483648&t,n=1073741824&e,r=1073741824&t,o=(1073741823&e)+(1073741823&t);return n&r?2147483648^o^i^s:n|r?1073741824&o?3221225472^o^i^s:1073741824^o^i^s:o^i^s},S=(e,t,i,s,n,r,o)=>(e=l(e,l(l(((e,t,i)=>e&t|~e&i)(t,i,s),n),o)),l(O(e,r),t)),p=(e,t,i,s,n,r,o)=>(e=l(e,l(l(((e,t,i)=>e&i|t&~i)(t,i,s),n),o)),l(O(e,r),t)),c=(e,t,i,s,n,r,o)=>(e=l(e,l(l(((e,t,i)=>e^t^i)(t,i,s),n),o)),l(O(e,r),t)),m=(e,t,i,s,n,r,o)=>(e=l(e,l(l(((e,t,i)=>t^(e|~i))(t,i,s),n),o)),l(O(e,r),t)),w=e=>{let t="",i="";for(let s=0;s<=3;s++)i="0"+(e>>>8*s&255).toString(16),t+=i.substr(i.length-2,2);return t},x=e=>{let t=(e=>{let t=e.length,i=t+8,s=16*((i-i%64)/64+1),n=new Array(s-1),r=0,o=0;for(;o<t;){let t=(o-o%4)/4;r=o%4*8,n[t]=n[t]|e.charCodeAt(o)<<r,o++}let d=(o-o%4)/4;return r=o%4*8,n[d]=n[d]|128<<r,n[s-2]=t<<3,n[s-1]=t>>>29,n})(e=(e=>{e=e.replace(/\r\n/g,"\n");let t="";for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);s<128?t+=String.fromCharCode(s):s>127&&s<2048?(t+=String.fromCharCode(s>>6|192),t+=String.fromCharCode(63&s|128)):(t+=String.fromCharCode(s>>12|224),t+=String.fromCharCode(s>>6&63|128),t+=String.fromCharCode(63&s|128))}return t})(e)),i=1732584193,s=4023233417,n=2562383102,r=271733878;for(let e=0;e<t.length;e+=16){let o=i,d=s,u=n,h=r;i=S(i,s,n,r,t[e+0],7,3614090360),r=S(r,i,s,n,t[e+1],12,3905402710),n=S(n,r,i,s,t[e+2],17,606105819),s=S(s,n,r,i,t[e+3],22,3250441966),i=S(i,s,n,r,t[e+4],7,4118548399),r=S(r,i,s,n,t[e+5],12,1200080426),n=S(n,r,i,s,t[e+6],17,2821735955),s=S(s,n,r,i,t[e+7],22,4249261313),i=S(i,s,n,r,t[e+8],7,1770035416),r=S(r,i,s,n,t[e+9],12,2336552879),n=S(n,r,i,s,t[e+10],17,4294925233),s=S(s,n,r,i,t[e+11],22,2304563134),i=S(i,s,n,r,t[e+12],7,1804603682),r=S(r,i,s,n,t[e+13],12,4254626195),n=S(n,r,i,s,t[e+14],17,2792965006),s=S(s,n,r,i,t[e+15],22,1236535329),i=p(i,s,n,r,t[e+1],5,4129170786),r=p(r,i,s,n,t[e+6],9,3225465664),n=p(n,r,i,s,t[e+11],14,643717713),s=p(s,n,r,i,t[e+0],20,3921069994),i=p(i,s,n,r,t[e+5],5,3593408605),r=p(r,i,s,n,t[e+10],9,38016083),n=p(n,r,i,s,t[e+15],14,3634488961),s=p(s,n,r,i,t[e+4],20,3889429448),i=p(i,s,n,r,t[e+9],5,568446438),r=p(r,i,s,n,t[e+14],9,3275163606),n=p(n,r,i,s,t[e+3],14,4107603335),s=p(s,n,r,i,t[e+8],20,1163531501),i=p(i,s,n,r,t[e+13],5,2850285829),r=p(r,i,s,n,t[e+2],9,4243563512),n=p(n,r,i,s,t[e+7],14,1735328473),s=p(s,n,r,i,t[e+12],20,2368359562),i=c(i,s,n,r,t[e+5],4,4294588738),r=c(r,i,s,n,t[e+8],11,2272392833),n=c(n,r,i,s,t[e+11],16,1839030562),s=c(s,n,r,i,t[e+14],23,4259657740),i=c(i,s,n,r,t[e+1],4,2763975236),r=c(r,i,s,n,t[e+4],11,1272893353),n=c(n,r,i,s,t[e+7],16,4139469664),s=c(s,n,r,i,t[e+10],23,3200236656),i=c(i,s,n,r,t[e+13],4,681279174),r=c(r,i,s,n,t[e+0],11,3936430074),n=c(n,r,i,s,t[e+3],16,3572445317),s=c(s,n,r,i,t[e+6],23,76029189),i=c(i,s,n,r,t[e+9],4,3654602809),r=c(r,i,s,n,t[e+12],11,3873151461),n=c(n,r,i,s,t[e+15],16,530742520),s=c(s,n,r,i,t[e+2],23,3299628645),i=m(i,s,n,r,t[e+0],6,4096336452),r=m(r,i,s,n,t[e+7],10,1126891415),n=m(n,r,i,s,t[e+14],15,2878612391),s=m(s,n,r,i,t[e+5],21,4237533241),i=m(i,s,n,r,t[e+12],6,1700485571),r=m(r,i,s,n,t[e+3],10,2399980690),n=m(n,r,i,s,t[e+10],15,4293915773),s=m(s,n,r,i,t[e+1],21,2240044497),i=m(i,s,n,r,t[e+8],6,1873313359),r=m(r,i,s,n,t[e+15],10,4264355552),n=m(n,r,i,s,t[e+6],15,2734768916),s=m(s,n,r,i,t[e+13],21,1309151649),i=m(i,s,n,r,t[e+4],6,4149444226),r=m(r,i,s,n,t[e+11],10,3174756917),n=m(n,r,i,s,t[e+2],15,718787259),s=m(s,n,r,i,t[e+9],21,3951481745),i=l(i,o),s=l(s,d),n=l(n,u),r=l(r,h)}return(w(i)+w(s)+w(n)+w(r)).toLowerCase()},v=e=>{let t=0;if(0===e.length)return t;for(let i=0;i<e.length;i++){t=(t<<5)-t+e.charCodeAt(i),t|=0}return t},D=()=>typeof window<"u"&&typeof window.document<"u",y=()=>{if(D()&&typeof navigator<"u")return navigator},F=()=>{if(D()&&typeof screen<"u")return screen},V=()=>{let e=(()=>{if(D()&&typeof window<"u")return window})(),t=y();return!(!e||!t)&&("ontouchstart"in e||void 0!==t.maxTouchPoints&&t.maxTouchPoints>0||void 0!==t.msMaxTouchPoints&&t.msMaxTouchPoints>0)},h=class a{constructor(e={}){this.versionPatterns=s,this.browserPatterns=n,this.osPatterns=r,this.platformPatterns=o,this.options={...d,...e},this.agent={...u,hashInt:v,hashMD5:x}}getBrowser(e){return this.browserPatterns.Edge.test(e)?(this.agent.isEdge=!0,"Edge"):this.browserPatterns.PhantomJS.test(e)?(this.agent.isPhantomJS=!0,"PhantomJS"):this.browserPatterns.Konqueror.test(e)?(this.agent.isKonqueror=!0,"Konqueror"):this.browserPatterns.Amaya.test(e)?(this.agent.isAmaya=!0,"Amaya"):this.browserPatterns.Epiphany.test(e)?(this.agent.isEpiphany=!0,"Epiphany"):this.browserPatterns.SeaMonkey.test(e)?(this.agent.isSeaMonkey=!0,"SeaMonkey"):this.browserPatterns.Flock.test(e)?(this.agent.isFlock=!0,"Flock"):this.browserPatterns.OmniWeb.test(e)?(this.agent.isOmniWeb=!0,"OmniWeb"):this.browserPatterns.Opera.test(e)?(this.agent.isOpera=!0,"Opera"):this.browserPatterns.Chromium.test(e)?(this.agent.isChrome=!0,"Chromium"):this.browserPatterns.Chrome.test(e)?(this.agent.isChrome=!0,"Chrome"):this.browserPatterns.Safari.test(e)?(this.agent.isSafari=!0,"Safari"):this.browserPatterns.WinJs.test(e)?(this.agent.isWinJs=!0,"WinJs"):this.browserPatterns.IE.test(e)?(this.agent.isIE=!0,"IE"):this.browserPatterns.PS3.test(e)?"ps3":this.browserPatterns.PSP.test(e)?"psp":this.browserPatterns.Firefox.test(e)?(this.agent.isFirefox=!0,"Firefox"):this.browserPatterns.UC.test(e)?(this.agent.isUC=!0,"UCBrowser"):0!==e.indexOf("Mozilla")&&/^([\d\w-.]+)\/[\d\w.-]+/i.test(e)?(this.agent.isAuthoritative=!1,RegExp.$1):"unknown"}getBrowserVersion(e){let t=this.agent.browser,i={Edge:this.versionPatterns.Edge,PhantomJS:this.versionPatterns.PhantomJS,Chrome:this.versionPatterns.Chrome,Chromium:this.versionPatterns.Chromium,Safari:this.versionPatterns.Safari,Opera:this.versionPatterns.Opera,Firefox:this.versionPatterns.Firefox,WinJs:this.versionPatterns.WinJs,IE:this.versionPatterns.IE,ps3:this.versionPatterns.Ps3,psp:this.versionPatterns.Psp,Amaya:this.versionPatterns.Amaya,Epiphany:this.versionPatterns.Epiphany,SeaMonkey:this.versionPatterns.SeaMonkey,Flock:this.versionPatterns.Flock,OmniWeb:this.versionPatterns.OmniWeb,UCBrowser:this.versionPatterns.UC}[t];return i&&i.test(e)?"IE"===t||"Opera"===t?RegExp.$2||RegExp.$1||"unknown":RegExp.$1||"unknown":"unknown"!==t&&new RegExp(`${t}[\\/ ]([\\d\\w.\\-]+)`,"i").test(e)&&RegExp.$1||"unknown"}getOS(e){if(this.osPatterns.Windows11.test(e)){let t=e.match(this.osPatterns.Windows11);if(t&&t[1]&&parseInt(t[1])>=96)return this.agent.isWindows=!0,"Windows 11"}return this.osPatterns.Windows10.test(e)?(this.agent.isWindows=!0,"Windows 10.0"):this.osPatterns.WindowsVista.test(e)?(this.agent.isWindows=!0,"Windows Vista"):this.osPatterns.Windows7.test(e)?(this.agent.isWindows=!0,"Windows 7"):this.osPatterns.Windows8.test(e)?(this.agent.isWindows=!0,"Windows 8"):this.osPatterns.Windows81.test(e)?(this.agent.isWindows=!0,"Windows 8.1"):this.osPatterns.Windows2003.test(e)?(this.agent.isWindows=!0,"Windows 2003"):this.osPatterns.WindowsXP.test(e)?(this.agent.isWindows=!0,"Windows XP"):this.osPatterns.Windows2000.test(e)?(this.agent.isWindows=!0,"Windows 2000"):this.osPatterns.WindowsPhone8.test(e)?"Windows Phone 8":this.osPatterns.Linux64.test(e)?(this.agent.isLinux=!0,this.agent.isLinux64=!0,"Linux 64"):this.osPatterns.Linux.test(e)?(this.agent.isLinux=!0,"Linux"):this.osPatterns.ChromeOS.test(e)?(this.agent.isChromeOS=!0,"Chrome OS"):this.osPatterns.Wii.test(e)?"Wii":this.osPatterns.PS3.test(e)||this.osPatterns.PSP.test(e)?"Playstation":this.osPatterns.OSXCheetah.test(e)?(this.agent.isMac=!0,"OS X Cheetah"):this.osPatterns.OSXPuma.test(e)?(this.agent.isMac=!0,"OS X Puma"):this.osPatterns.OSXJaguar.test(e)?(this.agent.isMac=!0,"OS X Jaguar"):this.osPatterns.OSXPanther.test(e)?(this.agent.isMac=!0,"OS X Panther"):this.osPatterns.OSXTiger.test(e)?(this.agent.isMac=!0,"OS X Tiger"):this.osPatterns.OSXLeopard.test(e)?(this.agent.isMac=!0,"OS X Leopard"):this.osPatterns.OSXSnowLeopard.test(e)?(this.agent.isMac=!0,"OS X Snow Leopard"):this.osPatterns.OSXLion.test(e)?(this.agent.isMac=!0,"OS X Lion"):this.osPatterns.OSXMountainLion.test(e)?(this.agent.isMac=!0,"OS X Mountain Lion"):this.osPatterns.OSXMavericks.test(e)?(this.agent.isMac=!0,"OS X Mavericks"):this.osPatterns.OSXYosemite.test(e)?(this.agent.isMac=!0,"OS X Yosemite"):this.osPatterns.OSXElCapitan.test(e)?(this.agent.isMac=!0,"OS X El Capitan"):this.osPatterns.OSXSierra.test(e)?(this.agent.isMac=!0,"macOS Sierra"):this.osPatterns.OSXHighSierra.test(e)?(this.agent.isMac=!0,"macOS High Sierra"):this.osPatterns.OSXMojave.test(e)?(this.agent.isMac=!0,"macOS Mojave"):this.osPatterns.OSXCatalina.test(e)?(this.agent.isMac=!0,"macOS Catalina"):this.osPatterns.MacOSBigSur.test(e)?(this.agent.isMac=!0,"macOS Big Sur"):this.osPatterns.MacOSMonterey.test(e)?(this.agent.isMac=!0,"macOS Monterey"):this.osPatterns.MacOSVentura.test(e)?(this.agent.isMac=!0,"macOS Ventura"):this.osPatterns.MacOSSonoma.test(e)?(this.agent.isMac=!0,"macOS Sonoma"):this.osPatterns.MacOSSequoia.test(e)?(this.agent.isMac=!0,"macOS Sequoia"):this.osPatterns.iPad.test(e)?(this.agent.isiPad=!0,"iOS"):this.osPatterns.iPhone.test(e)?(this.agent.isiPhone=!0,"iOS"):this.osPatterns.Mac.test(e)?(this.agent.isMac=!0,"Mac OS"):this.osPatterns.Bada.test(e)?(this.agent.isBada=!0,"Bada"):this.osPatterns.Curl.test(e)?(this.agent.isCurl=!0,"Curl"):"unknown"}getPlatform(e){return this.platformPatterns.Windows.test(e)?"Microsoft Windows":this.platformPatterns.WindowsPhone.test(e)?(this.agent.isWindowsPhone=!0,"Microsoft Windows Phone"):this.platformPatterns.Mac.test(e)?"Apple Mac":this.platformPatterns.Curl.test(e)?"Curl":this.platformPatterns.Android.test(e)?(this.agent.isAndroid=!0,"Android"):this.platformPatterns.Blackberry.test(e)?(this.agent.isBlackberry=!0,"Blackberry"):this.platformPatterns.Linux.test(e)?"Linux":this.platformPatterns.Wii.test(e)?"Wii":this.platformPatterns.Playstation.test(e)?"Playstation":this.platformPatterns.iPad.test(e)?(this.agent.isiPad=!0,"iPad"):this.platformPatterns.iPod.test(e)?(this.agent.isiPod=!0,"iPod"):this.platformPatterns.iPhone.test(e)?(this.agent.isiPhone=!0,"iPhone"):this.platformPatterns.Samsung.test(e)?(this.agent.isSamsung=!0,"Samsung"):"unknown"}testBot(){let e=i.exec(this.agent.source.toLowerCase());e?this.agent.isBot=e[1]:this.agent.isAuthoritative||(this.agent.isBot=/bot/i.test(this.agent.source))}testSmartTV(){let e=/smart-tv|smarttv|googletv|appletv|hbbtv|pov_tv|netcast.tv/gi.exec(this.agent.source.toLowerCase());e&&(this.agent.isSmartTV=e[1]||!0)}testMobile(){return this.agent.isSmartTV?(this.agent.isMobile=!1,void(this.agent.isDesktop=!1)):this.agent.isAndroid||this.agent.isSamsung||this.agent.isiPhone||this.agent.isiPod||this.agent.isBada||this.agent.isBlackberry||this.agent.isWindowsPhone?(this.agent.isMobile=!0,void(this.agent.isDesktop=!1)):this.agent.isiPad?(this.agent.isMobile=!1,void(this.agent.isDesktop=!1)):void(this.agent.isWindows||this.agent.isLinux||this.agent.isMac||this.agent.isChromeOS?this.agent.isDesktop=!0:/mobile/i.test(this.agent.source)&&(this.agent.isMobile=!0,this.agent.isDesktop=!1))}testAndroidTablet(){this.agent.isAndroid&&!/mobile/i.test(this.agent.source)&&(this.agent.isAndroidTablet=!0,this.agent.isMobile=!1)}testTablet(){(this.agent.isiPad||this.agent.isAndroidTablet||this.agent.isKindleFire)&&(this.agent.isTablet=!0),/tablet/i.test(this.agent.source)&&(this.agent.isTablet=!0)}testCompatibilityMode(){if(this.agent.isIE){let e=/Trident\/(\d)\.0/i.exec(this.agent.source);if(e){let t=parseInt(e[1],10),i=parseFloat(this.agent.version);7===i&&7===t?(this.agent.isIECompatibilityMode=!0,this.agent.version="11.0"):7===i&&6===t?(this.agent.isIECompatibilityMode=!0,this.agent.version="10.0"):7===i&&5===t?(this.agent.isIECompatibilityMode=!0,this.agent.version="9.0"):7===i&&4===t&&(this.agent.isIECompatibilityMode=!0,this.agent.version="8.0")}}}testSilk(){/silk/gi.test(this.agent.source)&&(this.agent.isSilk=!0),/Silk-Accelerated=true/gi.test(this.agent.source)&&(this.agent.silkAccelerated=!0)}testKindleFire(){let e=[[/KFOT/gi,"Kindle Fire"],[/KFTT/gi,"Kindle Fire HD"],[/KFJWI/gi,"Kindle Fire HD 8.9"],[/KFJWA/gi,"Kindle Fire HD 8.9 4G"],[/KFSOWI/gi,"Kindle Fire HD 7"],[/KFTHWI/gi,"Kindle Fire HDX 7"],[/KFTHWA/gi,"Kindle Fire HDX 7 4G"],[/KFAPWI/gi,"Kindle Fire HDX 8.9"],[/KFAPWA/gi,"Kindle Fire HDX 8.9 4G"],[/KFMAWI/gi,"Kindle Fire HD 10"]];for(let[t]of e)if(t.test(this.agent.source))return void(this.agent.isKindleFire=!0)}testCaptiveNetwork(){/CaptiveNetwork/gi.test(this.agent.source)&&(this.agent.isCaptive=!0,this.agent.isMac=!0,this.agent.platform="Apple Mac")}testTouchSupport(){this.agent.isTouchScreen=V()}getLanguageInfo(){this.agent.language=(()=>{let e=y();return e&&(e.language||e.userLanguage||e.browserLanguage||e.systemLanguage||"").toLowerCase()||"unknown"})()}getColorDepthInfo(){this.agent.colorDepth=F()?.colorDepth??-1}getPixelDepthInfo(){this.agent.pixelDepth=F()?.pixelDepth??-1}getScreenResolutionInfo(){this.agent.resolution=(()=>{let e=F();return e?[e.availWidth||0,e.availHeight||0]:[0,0]})()}getCPUInfo(){this.agent.cpuCores=y()?.hardwareConcurrency??-1}reset(){return this.agent={...u,hashInt:v,hashMD5:x},this}parse(e){let t=new a,i=e||y()?.userAgent||"";return t.agent.source=i.replace(/^\s*/,"").replace(/\s*$/,""),t.agent.os=t.getOS(t.agent.source),t.agent.platform=t.getPlatform(t.agent.source),t.agent.browser=t.getBrowser(t.agent.source),t.agent.version=t.getBrowserVersion(t.agent.source),t.testBot(),t.testSmartTV(),t.testMobile(),t.testAndroidTablet(),t.testTablet(),t.testCompatibilityMode(),t.testSilk(),t.testKindleFire(),t.testCaptiveNetwork(),t.testTouchSupport(),t.getLanguageInfo(),t.getColorDepthInfo(),t.getPixelDepthInfo(),t.getScreenResolutionInfo(),t.getCPUInfo(),t.agent}get(e){let t=this.parse(),i=[];for(let e in this.options)if(Object.prototype.hasOwnProperty.call(this.options,e)){let s=t[e];i.push(s)}e&&i.push(e),!this.options.resolution&&t.isMobile&&i.push(t.resolution);let s=x(i.join(":"));return[s.slice(0,8),s.slice(8,12),"4"+s.slice(12,15),"b"+s.slice(15,18),s.slice(20)].join("-")}};e.BOTS=t,e.BROWSER_PATTERNS=n,e.DEFAULT_OPTIONS=d,e.DeviceUUID=h,e.OS_PATTERNS=r,e.PLATFORM_PATTERNS=o,e.VERSION_PATTERNS=s,e.default=h,e.hashInt=v,e.hashMD5=x,Object.defineProperty(e,"__esModule",{value:!0})}({})},423:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WebSDK=void 0;const s=i(266),n=i(182),r=i(383).S,o=i(330),d="os.",u=o.version;t.WebSDK=class WebSDK{constructor(e){var t,i,o;if(this.maxBatchSize=10,this.batchInterval=1e4,this.sdkVersion=u,this.eventQueue=[],this.purchaseBatch=[],this.attributeQueue={},this.isProcessingQueue=!1,!e.apiKey||!e.endpoint)throw new Error("API key and endpoint are required");this.apiKey=e.apiKey,this.endpoint=e.endpoint,this.debug=null!==(t=e.debug)&&void 0!==t&&t,this.maxBatchSize=null!==(i=e.batchSize)&&void 0!==i?i:10,this.batchInterval=null!==(o=e.batchInterval)&&void 0!==o?o:1e4,this.deviceId=this.getStoredDeviceId()||(0,n.v4)();const d=new r;this.deviceIdentifier=d.get(),this.guestUserId=this.getGuestUserId(),this.initialize().catch(e=>{(0,s.log)(this.debug,"Async initialization failed",e)})}async initialize(){try{(0,s.log)(this.debug,"SDK Initialized"),this.storeDeviceId(),await this.initializeDeviceDetails(),await this.loadCustomAttributes();const e=this.getStoredUserProfile();e?(this.currentUser=e,(0,s.log)(this.debug,"Loaded user profile",this.currentUser)):this.identify("");try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;this.trackCustomAttribute("timezone",e)}catch(e){(0,s.log)(this.debug,"Failed to detect timezone",e)}this.startBatchProcessing(),this.trackEvent("app_started",{})}catch(e){throw(0,s.log)(this.debug,"Initialization failed",e),e}}identify(e){if("string"!=typeof e)throw new Error("User ID must be a string");const t=this.getStoredUserProfile();(null==t?void 0:t.id)!==e&&((0,s.log)(this.debug,"Identifying user",e),this.currentUser=e?{id:e,guestUserId:this.guestUserId}:{id:this.guestUserId,guestUserId:this.guestUserId},this.storeUserProfile())}clearUserData(){this.deviceId=(0,n.v4)();const e=new r;this.deviceIdentifier=e.get(),this.guestUserId=this.getGuestUserId(),this.initializeDeviceDetails(),this.currentUser={id:this.guestUserId,guestUserId:this.guestUserId},this.attributeQueue={},this.eventQueue=[],this.purchaseBatch=[],this.storeDeviceId(),sessionStorage.setItem(`${d}${this.apiKey}.current_user`,JSON.stringify(this.currentUser)),sessionStorage.removeItem(`${d}${this.apiKey}.custom_attributes`),this.debug&&(0,s.log)(this.debug,"User data cleared, new device ID generated")}trackEvent(e,t={},i={}){if(!e||"string"!=typeof e)throw new Error("Event name is required and must be a string");const s={deviceId:this.deviceId,eventName:e,timestamp:i.timestamp||Date.now(),requestId:i.requestId||(0,n.v4)(),properties:t};this.queueEvent(s)}setToken(e){this.deviceDetails&&(this.deviceDetails={...this.deviceDetails,pushToken:e})}trackCustomAttribute(e,t){if(!e||"string"!=typeof e)throw new Error("Attribute name is required and must be a string");this.attributeQueue={...this.attributeQueue,[e]:t},(0,s.log)(this.debug,"Custom attribute queued",e,t),this.storeCustomAttributes()}logProductPurchase(e,t,i,n,r,o,d,u){const h=this.buildPurchasePayload({externalId:e,itemId:t,itemName:i,unitPrice:n,quantity:r,source:o,channel:d,itemCategory:u});this.purchaseBatch.push(h),this.debug&&(0,s.log)(this.debug,"Purchase event queued",h)}getUserProfile(){return this.currentUser}async forceSend(){(this.eventQueue.length>0||this.purchaseBatch.length>0||this.attributeQueue.length>0)&&await this.processBatch()}dispose(){this.batchProcessingInterval&&clearInterval(this.batchProcessingInterval),(this.eventQueue.length>0||this.purchaseBatch.length>0||this.attributeQueue.length>0)&&this.processBatch().catch(e=>{(0,s.log)(this.debug,"Error during disposal",e)})}getStoredDeviceId(){return sessionStorage.getItem(`${d}${this.apiKey}.device_id`)}getStoredUserProfile(){const e=sessionStorage.getItem(`${d}${this.apiKey}.current_user`);return e?JSON.parse(e):null}storeDeviceId(){sessionStorage.setItem(`${d}${this.apiKey}.device_id`,this.deviceId)}storeUserProfile(){this.currentUser&&sessionStorage.setItem(`${d}${this.apiKey}.current_user`,JSON.stringify(this.currentUser))}storeCustomAttributes(){const e=sessionStorage.getItem(`${d}${this.apiKey}.custom_attributes`),t={...e?JSON.parse(e):{},...this.attributeQueue};sessionStorage.setItem(`${d}${this.apiKey}.custom_attributes`,JSON.stringify(t))}async loadCustomAttributes(){const e=sessionStorage.getItem(`${d}${this.apiKey}.custom_attributes`);e&&(this.attributeQueue={...this.attributeQueue,...JSON.parse(e)})}getGuestUserId(){return`guest_user_${this.deviceId}`}buildPurchasePayload({externalId:e,itemId:t,itemName:i,unitPrice:s,quantity:n,source:r,channel:o,itemCategory:d}){return{external_id:e,item_id:t,item_name:i,item_category:d,quantity:n,unit_price:s,total_price:s*n,source:r,channel:o,purchased_at:Date.now()}}async initializeDeviceDetails(){this.deviceDetails={deviceId:this.deviceId,deviceIdentifier:this.deviceIdentifier,platform:"web"}}startBatchProcessing(){this.batchProcessingInterval=setInterval(()=>{(this.eventQueue.length>0||this.purchaseBatch.length>0||this.attributeQueue.length>0)&&this.processBatch().catch(e=>{(0,s.log)(this.debug,"Batch processing failed",e)})},this.batchInterval)}queueEvent(e){this.eventQueue.push(e),(0,s.log)(this.debug,"Event queued",e),this.eventQueue.length>=this.maxBatchSize&&this.processBatch().catch(e=>{(0,s.log)(this.debug,"Batch processing failed",e)})}async processBatch(){if(this.isProcessingQueue)return;this.isProcessingQueue=!0;const e=[...this.eventQueue],t=[...this.purchaseBatch],i={...this.attributeQueue};this.eventQueue=[],this.purchaseBatch=[],this.attributeQueue={};try{await this.sendBatchToServer(e,t,i)}catch(n){throw this.eventQueue.unshift(...e),this.purchaseBatch.unshift(...t),this.attributeQueue={...this.attributeQueue,...i},(0,s.log)(this.debug,"Batch processing failed",n),n}finally{this.isProcessingQueue=!1}}async sendBatchToServer(e,t,i){var n,r;this.deviceDetails||await this.initializeDeviceDetails();const o={sdkVersion:this.sdkVersion,deviceInfo:this.deviceDetails,userId:null===(n=this.currentUser)||void 0===n?void 0:n.id,guestUserId:null===(r=this.currentUser)||void 0===r?void 0:r.guestUserId,time:Date.now(),events:e,purchases:t,userAttributes:i};(0,s.log)(this.debug,"Sending batch to server",o);try{const e=await fetch(`${this.endpoint}/analytics/data`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":this.apiKey},body:JSON.stringify(o)});if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);this.debug&&(0,s.log)(this.debug,`Batch dispatched successfully: ${o.events.length} events, ${o.purchases.length} purchases, ${Object.keys(o.userAttributes).length} attributes`),await e.json(),Object.keys(i).length>0&&(this.attributeQueue={},sessionStorage.removeItem(`${d}${this.apiKey}.custom_attributes`))}catch(e){throw(0,s.log)(this.debug,"Failed to send payload to server",e),e}}displayInAppMessage(e,t,i){const s=JSON.parse(e),n=s.header,r=s.message,o=s.modal.button1,d=s.modal.button2,u=o.type||"",h=d.type||"",g=s.mediaConfig.inAppImage;this.showInAppMessage({context:i,title:n,body:r,primaryButtonText:u,secondaryButtonText:h,imageUrl:g,buttonPropertiesPrimary:o,buttonPropertiesSecondary:d,dismissMessageAutomatically:s.modal.dismissMessageAutomatically,dismissMessageInSeconds:s.modal.dismissMessageInSeconds,headerColor:s.modal.headerColor,messageColor:s.modal.messageColor,closeColor:s.modal.closeColor,campaignId:t})}hexToColor(e){return 6===(e=e.toUpperCase().replace("#","")).length?`#${e}`:`#${e.substring(2)}`}openWebUrl(e){e&&window.open(e,"_blank")}showInAppMessage(e){const{title:t,body:i,primaryButtonText:s,secondaryButtonText:n,imageUrl:r,onClose:o,buttonPropertiesPrimary:d,buttonPropertiesSecondary:u,dismissMessageAutomatically:h,dismissMessageInSeconds:g,headerColor:b,messageColor:P,closeColor:C,campaignId:I}=e,M=document.createElement("div");M.style.position="fixed",M.style.top="0",M.style.left="0",M.style.width="100%",M.style.height="100%",M.style.backgroundColor="rgba(0, 0, 0, 0.5)",M.style.display="flex",M.style.justifyContent="center",M.style.alignItems="center",M.style.zIndex="9999";const _=document.createElement("div");_.style.backgroundColor="white",_.style.borderRadius="12px",_.style.padding="16px",_.style.maxWidth="400px",_.style.width="90%",_.style.boxShadow="0 4px 6px rgba(0, 0, 0, 0.1)",_.style.position="relative";const k=document.createElement("button");k.innerHTML="×",k.style.position="absolute",k.style.top="8px",k.style.right="8px",k.style.background="none",k.style.border="none",k.style.fontSize="20px",k.style.cursor="pointer",k.style.color=this.hexToColor(C),k.onclick=()=>{o&&o(),this.logInAppMessageClick(I,!1,!0,!0),document.body.removeChild(M)};const T=document.createElement("div");if(T.style.display="flex",T.style.flexDirection="column",T.style.alignItems="center",T.style.textAlign="center",r&&""!==r.trim()){const e=document.createElement("img");e.src=r,e.style.width="100px",e.style.height="100px",e.style.marginBottom="16px",e.style.marginTop="16px",e.onerror=()=>{e.style.display="none"},T.appendChild(e)}const U=document.createElement("h2");U.textContent=t,U.style.fontSize="22px",U.style.fontWeight="600",U.style.color=this.hexToColor(b),U.style.margin="8px 0",T.appendChild(U);const A=document.createElement("p");A.textContent=i,A.style.fontSize="14px",A.style.color=this.hexToColor(P),A.style.fontWeight="500",A.style.margin="8px 0 24px 0",T.appendChild(A);const onPrimaryButtonPress=()=>{"redirect_to_web_url"!==d.webOnClickValue&&"deeplink_into_app"!==d.webOnClickValue||this.openWebUrl(d.webOnClickAction||"")},onSecondaryButtonPress=()=>{"redirect_to_web_url"!==u.webOnClickValue&&"deeplink_into_app"!==u.webOnClickValue||this.openWebUrl(u.webOnClickAction||"")},W=document.createElement("div");if(W.style.display="flex",W.style.justifyContent="center",W.style.width="100%",W.style.gap="16px",n&&""!==n.trim()){const e=document.createElement("button");e.textContent=s,e.style.flex="1",e.style.maxWidth="140px",e.style.padding="12px",e.style.backgroundColor=this.hexToColor(d.backgroundColor),e.style.color=this.hexToColor(d.textColor),e.style.border=`2px solid ${this.hexToColor(d.borderColor)}`,e.style.borderRadius="8px",e.style.fontSize="16px",e.style.fontWeight="600",e.style.cursor="pointer",e.onclick=()=>{document.body.removeChild(M),onPrimaryButtonPress()},W.appendChild(e);const t=document.createElement("button");t.textContent=n,t.style.flex="1",t.style.maxWidth="140px",t.style.padding="12px",t.style.backgroundColor=this.hexToColor(u.backgroundColor),t.style.color=this.hexToColor(u.textColor),t.style.border=`2px solid ${this.hexToColor(u.borderColor)}`,t.style.borderRadius="8px",t.style.fontSize="16px",t.style.fontWeight="600",t.style.cursor="pointer",t.onclick=()=>{document.body.removeChild(M),this.logInAppMessageClick(I,!0,!0,!1),onSecondaryButtonPress()},W.appendChild(t)}else if(s&&""!==s.trim()){const e=document.createElement("button");e.textContent=s,e.style.width="100%",e.style.padding="12px",e.style.backgroundColor=this.hexToColor(d.backgroundColor),e.style.color=this.hexToColor(d.textColor),e.style.border=`2px solid ${this.hexToColor(d.borderColor)}`,e.style.borderRadius="8px",e.style.fontSize="16px",e.style.fontWeight="600",e.style.cursor="pointer",e.onclick=()=>{document.body.removeChild(M),this.logInAppMessageClick(I,!0,!0,!1),onPrimaryButtonPress()},W.appendChild(e)}_.appendChild(k),_.appendChild(T),T.appendChild(W),M.appendChild(_),document.body.appendChild(M),h&&setTimeout(()=>{document.body.contains(M)&&document.body.removeChild(M)},1e3*parseInt(g)),M.addEventListener("click",e=>{e.target===M&&document.body.removeChild(M)})}async logInAppMessageClick(e,t,i,s){const n=await this.buildCampaignPayload(e,i,t,s);await this.processCampaignClick(n)}async logClick(e){this.currentUser&&this.deviceDetails||((0,s.log)(this.debug,"SDK not fully initialized, waiting for initialization"),await this.initialize()),(this.eventQueue.length>0||this.purchaseBatch.length>0||Object.keys(this.attributeQueue).length>0)&&await this.forceSend();const t=await this.buildCampaignPayload(e,!0,!0);await this.processCampaignClick(t)}async processCampaignClick(e){try{const t=await fetch(`${this.endpoint}/analytics/clicks`,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":this.apiKey},body:JSON.stringify(e)});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);this.debug&&(0,s.log)(this.debug,`process campaign click dispatched successfully: ${e.campaignId}`)}catch(e){throw(0,s.log)(this.debug,"Error processing campaign click:",e),e}}async buildCampaignPayload(e,t,i,s){const n=Date.now(),r={campaignId:e,opened:t,clicked:i,deviceId:this.deviceId,timestamp:n};return void 0!==s&&(r.dismissed=s),r}}},425:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateV1State=void 0;const s=i(291),n=i(11),r={};function updateV1State(e,t,i){return e.msecs??=-1/0,e.nsecs??=0,t===e.msecs?(e.nsecs++,e.nsecs>=1e4&&(e.node=void 0,e.nsecs=0)):t>e.msecs?e.nsecs=0:t<e.msecs&&(e.node=void 0),e.node||(e.node=i.slice(10,16),e.node[0]|=1,e.clockseq=16383&(i[8]<<8|i[9])),e.msecs=t,e}function v1Bytes(e,t,i,s,n,r,o=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(r){if(o<0||o+16>r.length)throw new RangeError(`UUID byte range ${o}:${o+15} is out of buffer bounds`)}else r=new Uint8Array(16),o=0;t??=Date.now(),i??=0,s??=16383&(e[8]<<8|e[9]),n??=e.slice(10,16);const d=(1e4*(268435455&(t+=122192928e5))+i)%4294967296;r[o++]=d>>>24&255,r[o++]=d>>>16&255,r[o++]=d>>>8&255,r[o++]=255&d;const u=t/4294967296*1e4&268435455;r[o++]=u>>>8&255,r[o++]=255&u,r[o++]=u>>>24&15|16,r[o++]=u>>>16&255,r[o++]=s>>>8|128,r[o++]=255&s;for(let e=0;e<6;++e)r[o++]=n[e];return r}t.updateV1State=updateV1State,t.default=function v1(e,t,i){let o;const d=e?._v6??!1;if(e){const t=Object.keys(e);1===t.length&&"_v6"===t[0]&&(e=void 0)}if(e)o=v1Bytes(e.random??e.rng?.()??(0,s.default)(),e.msecs,e.nsecs,e.clockseq,e.node,t,i);else{const e=Date.now(),n=(0,s.default)();updateV1State(r,e,n),o=v1Bytes(n,r.msecs,r.nsecs,d?void 0:r.clockseq,d?void 0:r.node,t,i)}return t??(0,n.unsafeStringify)(o)}},465:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default="00000000-0000-0000-0000-000000000000"},557:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.URL=t.DNS=void 0;const s=i(829),n=i(988);var r=i(988);function v5(e,t,i,r){return(0,n.default)(80,s.default,e,t,i,r)}Object.defineProperty(t,"DNS",{enumerable:!0,get:function(){return r.DNS}}),Object.defineProperty(t,"URL",{enumerable:!0,get:function(){return r.URL}}),v5.DNS=n.DNS,v5.URL=n.URL,t.default=v5},568:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});const s=i(797),n=i(11);t.default=function v1ToV6(e){const t=function _v1ToV6(e){return Uint8Array.of((15&e[6])<<4|e[7]>>4&15,(15&e[7])<<4|(240&e[4])>>4,(15&e[4])<<4|(240&e[5])>>4,(15&e[5])<<4|(240&e[0])>>4,(15&e[0])<<4|(240&e[1])>>4,(15&e[1])<<4|(240&e[2])>>4,96|15&e[2],e[3],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}("string"==typeof e?(0,s.default)(e):e);return"string"==typeof e?(0,n.unsafeStringify)(t):t}},591:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.URL=t.DNS=void 0;const s=i(338),n=i(988);var r=i(988);function v3(e,t,i,r){return(0,n.default)(48,s.default,e,t,i,r)}Object.defineProperty(t,"DNS",{enumerable:!0,get:function(){return r.DNS}}),Object.defineProperty(t,"URL",{enumerable:!0,get:function(){return r.URL}}),v3.DNS=n.DNS,v3.URL=n.URL,t.default=v3},697:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i},746:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});const s=i(697);t.default=function validate(e){return"string"==typeof e&&s.default.test(e)}},770:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});const s=i(746);t.default=function version(e){if(!(0,s.default)(e))throw TypeError("Invalid UUID");return parseInt(e.slice(14,15),16)}},779:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});const i="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);t.default={randomUUID:i}},797:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});const s=i(746);t.default=function parse(e){if(!(0,s.default)(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,255&t,(t=parseInt(e.slice(9,13),16))>>>8,255&t,(t=parseInt(e.slice(14,18),16))>>>8,255&t,(t=parseInt(e.slice(19,23),16))>>>8,255&t,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,255&t)}},829:(e,t)=>{function f(e,t,i,s){switch(e){case 0:return t&i^~t&s;case 1:case 3:return t^i^s;case 2:return t&i^t&s^i&s}}function ROTL(e,t){return e<<t|e>>>32-t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function sha1(e){const t=[1518500249,1859775393,2400959708,3395469782],i=[1732584193,4023233417,2562383102,271733878,3285377520],s=new Uint8Array(e.length+1);s.set(e),s[e.length]=128;const n=(e=s).length/4+2,r=Math.ceil(n/16),o=new Array(r);for(let t=0;t<r;++t){const i=new Uint32Array(16);for(let s=0;s<16;++s)i[s]=e[64*t+4*s]<<24|e[64*t+4*s+1]<<16|e[64*t+4*s+2]<<8|e[64*t+4*s+3];o[t]=i}o[r-1][14]=8*(e.length-1)/Math.pow(2,32),o[r-1][14]=Math.floor(o[r-1][14]),o[r-1][15]=8*(e.length-1)&4294967295;for(let e=0;e<r;++e){const s=new Uint32Array(80);for(let t=0;t<16;++t)s[t]=o[e][t];for(let e=16;e<80;++e)s[e]=ROTL(s[e-3]^s[e-8]^s[e-14]^s[e-16],1);let n=i[0],r=i[1],d=i[2],u=i[3],h=i[4];for(let e=0;e<80;++e){const i=Math.floor(e/20),o=ROTL(n,5)+f(i,r,d,u)+h+t[i]+s[e]>>>0;h=u,u=d,d=ROTL(r,30)>>>0,r=n,n=o}i[0]=i[0]+n>>>0,i[1]=i[1]+r>>>0,i[2]=i[2]+d>>>0,i[3]=i[3]+u>>>0,i[4]=i[4]+h>>>0}return Uint8Array.of(i[0]>>24,i[0]>>16,i[0]>>8,i[0],i[1]>>24,i[1]>>16,i[1]>>8,i[1],i[2]>>24,i[2]>>16,i[2]>>8,i[2],i[3]>>24,i[3]>>16,i[3]>>8,i[3],i[4]>>24,i[4]>>16,i[4]>>8,i[4])}},988:(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.URL=t.DNS=t.stringToBytes=void 0;const s=i(797),n=i(11);function stringToBytes(e){e=unescape(encodeURIComponent(e));const t=new Uint8Array(e.length);for(let i=0;i<e.length;++i)t[i]=e.charCodeAt(i);return t}t.stringToBytes=stringToBytes,t.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",t.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",t.default=function v35(e,t,i,r,o,d){const u="string"==typeof i?stringToBytes(i):i,h="string"==typeof r?(0,s.default)(r):r;if("string"==typeof r&&(r=(0,s.default)(r)),16!==r?.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let g=new Uint8Array(16+u.length);if(g.set(h),g.set(u,h.length),g=t(g),g[6]=15&g[6]|e,g[8]=63&g[8]|128,o){d=d||0;for(let e=0;e<16;++e)o[d+e]=g[e];return o}return(0,n.unsafeStringify)(g)}}},t={};function __webpack_require__(i){var s=t[i];if(void 0!==s)return s.exports;var n=t[i]={exports:{}};return e[i](n,n.exports,__webpack_require__),n.exports}var i={};return(()=>{var e=i;Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.WebSDK=void 0;var t=__webpack_require__(423);Object.defineProperty(e,"WebSDK",{enumerable:!0,get:function(){return t.WebSDK}});var s=__webpack_require__(423);Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s.WebSDK}})})(),i})());
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = exports.WebSDK = void 0;
|
|
4
|
+
var web_sdk_1 = require("./web-sdk");
|
|
5
|
+
Object.defineProperty(exports, "WebSDK", { enumerable: true, get: function () { return web_sdk_1.WebSDK; } });
|
|
6
|
+
var web_sdk_2 = require("./web-sdk");
|
|
7
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return web_sdk_2.WebSDK; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qCAAmC;AAA1B,iGAAA,MAAM,OAAA;AACf,qCAA8C;AAArC,kGAAA,MAAM,OAAW"}
|
|
Binary file
|
|
Binary file
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":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|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;AA8FC,CAAC"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,GAAG,GAAI,OAAO,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,EAAE,SAIlE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.log = void 0;
|
|
4
|
+
const log = (debug, message, ...args) => {
|
|
5
|
+
if (debug) {
|
|
6
|
+
console.log(`[OrderSune CRM]`, message, ...args);
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
exports.log = log;
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAO,MAAM,GAAG,GAAG,CAAC,KAAc,EAAE,OAAe,EAAE,GAAG,IAAW,EAAE,EAAE;IACrE,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IACnD,CAAC;AACH,CAAC,CAAC;AAJW,QAAA,GAAG,OAId"}
|
package/dist/web-sdk.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-sdk.d.ts","sourceRoot":"","sources":["../src/web-sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,WAAW,EAMZ,MAAM,SAAS,CAAC;AAajB,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,Q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,IAAI;IAgBtB,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,qBAAqB;YAmBf,oBAAoB;IAYlC,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,oBAAoB;YAyBd,uBAAuB;IASrC,OAAO,CAAC,oBAAoB;IAc5B,OAAO,CAAC,UAAU;YAWJ,YAAY;YA6BZ,iBAAiB;IAwDxB,mBAAmB,CACxB,gBAAgB,EAAE,MAAM,EACxB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,GAAG,GACZ,IAAI;IA6BP,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,gBAAgB;YAsNV,oBAAoB;IAgBrB,QAAQ,CACnB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC;YAwBF,oBAAoB;YA2BpB,oBAAoB;CAuBnC"}
|
package/dist/web-sdk.js
ADDED
|
@@ -0,0 +1,604 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebSDK = void 0;
|
|
4
|
+
const utils_1 = require("./utils");
|
|
5
|
+
const uuid_1 = require("uuid");
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
const DeviceUUID = require("device-uuid").DeviceUUID;
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
const package_json_1 = require("../package.json");
|
|
10
|
+
const STORAGE_PREFIX = "os.";
|
|
11
|
+
const DEFAULT_BATCH_SIZE = 10;
|
|
12
|
+
const DEFAULT_BATCH_INTERVAL = 10000;
|
|
13
|
+
const SDK_VERSION = package_json_1.version;
|
|
14
|
+
class WebSDK {
|
|
15
|
+
constructor(config) {
|
|
16
|
+
this.maxBatchSize = DEFAULT_BATCH_SIZE;
|
|
17
|
+
this.batchInterval = DEFAULT_BATCH_INTERVAL;
|
|
18
|
+
this.sdkVersion = SDK_VERSION;
|
|
19
|
+
this.eventQueue = [];
|
|
20
|
+
this.purchaseBatch = [];
|
|
21
|
+
this.attributeQueue = {};
|
|
22
|
+
this.isProcessingQueue = false;
|
|
23
|
+
if (!config.apiKey || !config.endpoint) {
|
|
24
|
+
throw new Error("API key and endpoint are required");
|
|
25
|
+
}
|
|
26
|
+
this.apiKey = config.apiKey;
|
|
27
|
+
this.endpoint = config.endpoint;
|
|
28
|
+
this.debug = config.debug ?? false;
|
|
29
|
+
this.maxBatchSize = config.batchSize ?? DEFAULT_BATCH_SIZE;
|
|
30
|
+
this.batchInterval = config.batchInterval ?? DEFAULT_BATCH_INTERVAL;
|
|
31
|
+
this.deviceId = this.getStoredDeviceId() || (0, uuid_1.v4)();
|
|
32
|
+
const deviceUUID = new DeviceUUID();
|
|
33
|
+
this.deviceIdentifier = deviceUUID.get();
|
|
34
|
+
this.guestUserId = this.getGuestUserId();
|
|
35
|
+
// Initialize async
|
|
36
|
+
this.initialize().catch((error) => {
|
|
37
|
+
(0, utils_1.log)(this.debug, "Async initialization failed", error);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
async initialize() {
|
|
41
|
+
try {
|
|
42
|
+
(0, utils_1.log)(this.debug, "SDK Initialized");
|
|
43
|
+
this.storeDeviceId();
|
|
44
|
+
await this.initializeDeviceDetails();
|
|
45
|
+
await this.loadCustomAttributes();
|
|
46
|
+
const storedUser = this.getStoredUserProfile();
|
|
47
|
+
if (storedUser) {
|
|
48
|
+
this.currentUser = storedUser;
|
|
49
|
+
(0, utils_1.log)(this.debug, "Loaded user profile", this.currentUser);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
this.identify("");
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
56
|
+
this.trackCustomAttribute("timezone", timezone);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
(0, utils_1.log)(this.debug, "Failed to detect timezone", error);
|
|
60
|
+
}
|
|
61
|
+
this.startBatchProcessing();
|
|
62
|
+
this.trackEvent("app_started", {});
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
(0, utils_1.log)(this.debug, "Initialization failed", error);
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
identify(userId) {
|
|
70
|
+
if (typeof userId !== "string") {
|
|
71
|
+
throw new Error("User ID must be a string");
|
|
72
|
+
}
|
|
73
|
+
const storedUser = this.getStoredUserProfile();
|
|
74
|
+
if (storedUser?.id === userId)
|
|
75
|
+
return;
|
|
76
|
+
(0, utils_1.log)(this.debug, "Identifying user", userId);
|
|
77
|
+
// If userId is empty or matches guest pattern, use guest user
|
|
78
|
+
if (!userId) {
|
|
79
|
+
this.currentUser = {
|
|
80
|
+
id: this.guestUserId,
|
|
81
|
+
guestUserId: this.guestUserId
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
// Real user identification - include both userId and guestUserId
|
|
86
|
+
this.currentUser = {
|
|
87
|
+
id: userId,
|
|
88
|
+
guestUserId: this.guestUserId
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
this.storeUserProfile();
|
|
92
|
+
}
|
|
93
|
+
clearUserData() {
|
|
94
|
+
// Generate new device ID using uuid v4 (keep original behavior)
|
|
95
|
+
this.deviceId = (0, uuid_1.v4)();
|
|
96
|
+
// Also regenerate device_identifier
|
|
97
|
+
const deviceUUID = new DeviceUUID();
|
|
98
|
+
this.deviceIdentifier = deviceUUID.get();
|
|
99
|
+
this.guestUserId = this.getGuestUserId();
|
|
100
|
+
this.initializeDeviceDetails();
|
|
101
|
+
this.currentUser = {
|
|
102
|
+
id: this.guestUserId,
|
|
103
|
+
guestUserId: this.guestUserId
|
|
104
|
+
};
|
|
105
|
+
this.attributeQueue = {};
|
|
106
|
+
this.eventQueue = [];
|
|
107
|
+
this.purchaseBatch = [];
|
|
108
|
+
this.storeDeviceId();
|
|
109
|
+
sessionStorage.setItem(`${STORAGE_PREFIX}${this.apiKey}.current_user`, JSON.stringify(this.currentUser));
|
|
110
|
+
sessionStorage.removeItem(`${STORAGE_PREFIX}${this.apiKey}.custom_attributes`);
|
|
111
|
+
if (this.debug) {
|
|
112
|
+
(0, utils_1.log)(this.debug, "User data cleared, new device ID generated");
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
trackEvent(eventName, properties = {}, options = {}) {
|
|
116
|
+
if (!eventName || typeof eventName !== "string") {
|
|
117
|
+
throw new Error("Event name is required and must be a string");
|
|
118
|
+
}
|
|
119
|
+
const payload = {
|
|
120
|
+
deviceId: this.deviceId,
|
|
121
|
+
eventName,
|
|
122
|
+
timestamp: options.timestamp || Date.now(),
|
|
123
|
+
requestId: options.requestId || (0, uuid_1.v4)(),
|
|
124
|
+
properties: properties,
|
|
125
|
+
};
|
|
126
|
+
this.queueEvent(payload);
|
|
127
|
+
}
|
|
128
|
+
setToken(token) {
|
|
129
|
+
if (this.deviceDetails) {
|
|
130
|
+
this.deviceDetails = {
|
|
131
|
+
...this.deviceDetails,
|
|
132
|
+
pushToken: token,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
trackCustomAttribute(attributeName, attributeValue) {
|
|
137
|
+
if (!attributeName || typeof attributeName !== "string") {
|
|
138
|
+
throw new Error("Attribute name is required and must be a string");
|
|
139
|
+
}
|
|
140
|
+
this.attributeQueue = {
|
|
141
|
+
...this.attributeQueue,
|
|
142
|
+
[attributeName]: attributeValue,
|
|
143
|
+
};
|
|
144
|
+
(0, utils_1.log)(this.debug, "Custom attribute queued", attributeName, attributeValue);
|
|
145
|
+
this.storeCustomAttributes();
|
|
146
|
+
}
|
|
147
|
+
logProductPurchase(orderId, itemId, itemName, unitPrice, quantity, source, channel, itemCategory) {
|
|
148
|
+
const purchasePayload = this.buildPurchasePayload({
|
|
149
|
+
externalId: orderId,
|
|
150
|
+
itemId,
|
|
151
|
+
itemName,
|
|
152
|
+
unitPrice,
|
|
153
|
+
quantity,
|
|
154
|
+
source,
|
|
155
|
+
channel,
|
|
156
|
+
itemCategory,
|
|
157
|
+
});
|
|
158
|
+
this.purchaseBatch.push(purchasePayload);
|
|
159
|
+
if (this.debug) {
|
|
160
|
+
(0, utils_1.log)(this.debug, "Purchase event queued", purchasePayload);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
getUserProfile() {
|
|
164
|
+
return this.currentUser;
|
|
165
|
+
}
|
|
166
|
+
async forceSend() {
|
|
167
|
+
if (this.eventQueue.length > 0 ||
|
|
168
|
+
this.purchaseBatch.length > 0 ||
|
|
169
|
+
this.attributeQueue.length > 0) {
|
|
170
|
+
await this.processBatch();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
dispose() {
|
|
174
|
+
if (this.batchProcessingInterval) {
|
|
175
|
+
clearInterval(this.batchProcessingInterval);
|
|
176
|
+
}
|
|
177
|
+
if (this.eventQueue.length > 0 ||
|
|
178
|
+
this.purchaseBatch.length > 0 ||
|
|
179
|
+
this.attributeQueue.length > 0) {
|
|
180
|
+
this.processBatch().catch((error) => {
|
|
181
|
+
(0, utils_1.log)(this.debug, "Error during disposal", error);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
getStoredDeviceId() {
|
|
186
|
+
return sessionStorage.getItem(`${STORAGE_PREFIX}${this.apiKey}.device_id`);
|
|
187
|
+
}
|
|
188
|
+
getStoredUserProfile() {
|
|
189
|
+
const storedUser = sessionStorage.getItem(`${STORAGE_PREFIX}${this.apiKey}.current_user`);
|
|
190
|
+
return storedUser ? JSON.parse(storedUser) : null;
|
|
191
|
+
}
|
|
192
|
+
storeDeviceId() {
|
|
193
|
+
sessionStorage.setItem(`${STORAGE_PREFIX}${this.apiKey}.device_id`, this.deviceId);
|
|
194
|
+
}
|
|
195
|
+
storeUserProfile() {
|
|
196
|
+
if (this.currentUser) {
|
|
197
|
+
sessionStorage.setItem(`${STORAGE_PREFIX}${this.apiKey}.current_user`, JSON.stringify(this.currentUser));
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
storeCustomAttributes() {
|
|
201
|
+
const existingAttributes = sessionStorage.getItem(`${STORAGE_PREFIX}${this.apiKey}.custom_attributes`);
|
|
202
|
+
const existingParsed = existingAttributes
|
|
203
|
+
? JSON.parse(existingAttributes)
|
|
204
|
+
: {};
|
|
205
|
+
const mergedAttributes = {
|
|
206
|
+
...existingParsed,
|
|
207
|
+
...this.attributeQueue,
|
|
208
|
+
};
|
|
209
|
+
sessionStorage.setItem(`${STORAGE_PREFIX}${this.apiKey}.custom_attributes`, JSON.stringify(mergedAttributes));
|
|
210
|
+
}
|
|
211
|
+
async loadCustomAttributes() {
|
|
212
|
+
const stored = sessionStorage.getItem(`${STORAGE_PREFIX}${this.apiKey}.custom_attributes`);
|
|
213
|
+
if (stored) {
|
|
214
|
+
this.attributeQueue = {
|
|
215
|
+
...this.attributeQueue,
|
|
216
|
+
...JSON.parse(stored),
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
getGuestUserId() {
|
|
221
|
+
return `guest_user_${this.deviceId}`;
|
|
222
|
+
}
|
|
223
|
+
buildPurchasePayload({ externalId, itemId, itemName, unitPrice, quantity, source, channel, itemCategory, }) {
|
|
224
|
+
const timestamp = Date.now();
|
|
225
|
+
return {
|
|
226
|
+
external_id: externalId,
|
|
227
|
+
item_id: itemId,
|
|
228
|
+
item_name: itemName,
|
|
229
|
+
item_category: itemCategory,
|
|
230
|
+
quantity: quantity,
|
|
231
|
+
unit_price: unitPrice,
|
|
232
|
+
total_price: unitPrice * quantity,
|
|
233
|
+
source: source,
|
|
234
|
+
channel: channel,
|
|
235
|
+
purchased_at: timestamp,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
async initializeDeviceDetails() {
|
|
239
|
+
this.deviceDetails = {
|
|
240
|
+
deviceId: this.deviceId,
|
|
241
|
+
deviceIdentifier: this.deviceIdentifier,
|
|
242
|
+
platform: 'web',
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
startBatchProcessing() {
|
|
246
|
+
this.batchProcessingInterval = setInterval(() => {
|
|
247
|
+
if (this.eventQueue.length > 0 ||
|
|
248
|
+
this.purchaseBatch.length > 0 ||
|
|
249
|
+
this.attributeQueue.length > 0) {
|
|
250
|
+
this.processBatch().catch((error) => {
|
|
251
|
+
(0, utils_1.log)(this.debug, "Batch processing failed", error);
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}, this.batchInterval);
|
|
255
|
+
}
|
|
256
|
+
queueEvent(payload) {
|
|
257
|
+
this.eventQueue.push(payload);
|
|
258
|
+
(0, utils_1.log)(this.debug, "Event queued", payload);
|
|
259
|
+
if (this.eventQueue.length >= this.maxBatchSize) {
|
|
260
|
+
this.processBatch().catch((error) => {
|
|
261
|
+
(0, utils_1.log)(this.debug, "Batch processing failed", error);
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
async processBatch() {
|
|
266
|
+
if (this.isProcessingQueue)
|
|
267
|
+
return;
|
|
268
|
+
this.isProcessingQueue = true;
|
|
269
|
+
const eventsToSend = [...this.eventQueue];
|
|
270
|
+
const purchasesToSend = [...this.purchaseBatch];
|
|
271
|
+
const attributesToSend = { ...this.attributeQueue };
|
|
272
|
+
this.eventQueue = [];
|
|
273
|
+
this.purchaseBatch = [];
|
|
274
|
+
this.attributeQueue = {};
|
|
275
|
+
try {
|
|
276
|
+
await this.sendBatchToServer(eventsToSend, purchasesToSend, attributesToSend);
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
this.eventQueue.unshift(...eventsToSend);
|
|
280
|
+
this.purchaseBatch.unshift(...purchasesToSend);
|
|
281
|
+
this.attributeQueue = { ...this.attributeQueue, ...attributesToSend };
|
|
282
|
+
(0, utils_1.log)(this.debug, "Batch processing failed", error);
|
|
283
|
+
throw error;
|
|
284
|
+
}
|
|
285
|
+
finally {
|
|
286
|
+
this.isProcessingQueue = false;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
async sendBatchToServer(events, purchases, currentAttributes) {
|
|
290
|
+
if (!this.deviceDetails) {
|
|
291
|
+
await this.initializeDeviceDetails();
|
|
292
|
+
}
|
|
293
|
+
const payload = {
|
|
294
|
+
sdkVersion: this.sdkVersion,
|
|
295
|
+
deviceInfo: this.deviceDetails,
|
|
296
|
+
userId: this.currentUser?.id,
|
|
297
|
+
guestUserId: this.currentUser?.guestUserId,
|
|
298
|
+
time: Date.now(),
|
|
299
|
+
events: events,
|
|
300
|
+
purchases: purchases,
|
|
301
|
+
userAttributes: currentAttributes,
|
|
302
|
+
};
|
|
303
|
+
(0, utils_1.log)(this.debug, "Sending batch to server", payload);
|
|
304
|
+
try {
|
|
305
|
+
const response = await fetch(`${this.endpoint}/analytics/data`, {
|
|
306
|
+
method: "POST",
|
|
307
|
+
headers: {
|
|
308
|
+
"Content-Type": "application/json",
|
|
309
|
+
"x-api-key": this.apiKey,
|
|
310
|
+
},
|
|
311
|
+
body: JSON.stringify(payload),
|
|
312
|
+
});
|
|
313
|
+
if (!response.ok) {
|
|
314
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
315
|
+
}
|
|
316
|
+
if (this.debug) {
|
|
317
|
+
(0, utils_1.log)(this.debug, `Batch dispatched successfully: ${payload.events.length} events, ${payload.purchases.length} purchases, ${Object.keys(payload.userAttributes).length} attributes`);
|
|
318
|
+
}
|
|
319
|
+
await response.json();
|
|
320
|
+
if (Object.keys(currentAttributes).length > 0) {
|
|
321
|
+
this.attributeQueue = {};
|
|
322
|
+
sessionStorage.removeItem(`${STORAGE_PREFIX}${this.apiKey}.custom_attributes`);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
catch (error) {
|
|
326
|
+
(0, utils_1.log)(this.debug, "Failed to send payload to server", error);
|
|
327
|
+
throw error;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
displayInAppMessage(inAppMessageData, campaignId, context) {
|
|
331
|
+
const transformedData = JSON.parse(inAppMessageData);
|
|
332
|
+
const title = transformedData.header;
|
|
333
|
+
const body = transformedData.message;
|
|
334
|
+
const buttonDataPrimary = transformedData.modal.button1;
|
|
335
|
+
const buttonDataSecondary = transformedData.modal.button2;
|
|
336
|
+
const buttonTextPrimary = buttonDataPrimary.type || "";
|
|
337
|
+
const buttonTextSecondary = buttonDataSecondary.type || "";
|
|
338
|
+
const imageUrl = transformedData.mediaConfig.inAppImage;
|
|
339
|
+
this.showInAppMessage({
|
|
340
|
+
context,
|
|
341
|
+
title,
|
|
342
|
+
body,
|
|
343
|
+
primaryButtonText: buttonTextPrimary,
|
|
344
|
+
secondaryButtonText: buttonTextSecondary,
|
|
345
|
+
imageUrl,
|
|
346
|
+
buttonPropertiesPrimary: buttonDataPrimary,
|
|
347
|
+
buttonPropertiesSecondary: buttonDataSecondary,
|
|
348
|
+
dismissMessageAutomatically: transformedData.modal.dismissMessageAutomatically,
|
|
349
|
+
dismissMessageInSeconds: transformedData.modal.dismissMessageInSeconds,
|
|
350
|
+
headerColor: transformedData.modal.headerColor,
|
|
351
|
+
messageColor: transformedData.modal.messageColor,
|
|
352
|
+
closeColor: transformedData.modal.closeColor,
|
|
353
|
+
campaignId: campaignId,
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
hexToColor(hexColor) {
|
|
357
|
+
hexColor = hexColor.toUpperCase().replace("#", "");
|
|
358
|
+
if (hexColor.length === 6) {
|
|
359
|
+
return `#${hexColor}`;
|
|
360
|
+
}
|
|
361
|
+
return `#${hexColor.substring(2)}`;
|
|
362
|
+
}
|
|
363
|
+
openWebUrl(url) {
|
|
364
|
+
if (url) {
|
|
365
|
+
window.open(url, '_blank');
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
showInAppMessage(options) {
|
|
369
|
+
const { title, body, primaryButtonText, secondaryButtonText, imageUrl, onClose, buttonPropertiesPrimary, buttonPropertiesSecondary, dismissMessageAutomatically, dismissMessageInSeconds, headerColor, messageColor, closeColor, campaignId, } = options;
|
|
370
|
+
// Create modal container
|
|
371
|
+
const modalOverlay = document.createElement('div');
|
|
372
|
+
modalOverlay.style.position = 'fixed';
|
|
373
|
+
modalOverlay.style.top = '0';
|
|
374
|
+
modalOverlay.style.left = '0';
|
|
375
|
+
modalOverlay.style.width = '100%';
|
|
376
|
+
modalOverlay.style.height = '100%';
|
|
377
|
+
modalOverlay.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';
|
|
378
|
+
modalOverlay.style.display = 'flex';
|
|
379
|
+
modalOverlay.style.justifyContent = 'center';
|
|
380
|
+
modalOverlay.style.alignItems = 'center';
|
|
381
|
+
modalOverlay.style.zIndex = '9999';
|
|
382
|
+
// Create modal dialog
|
|
383
|
+
const modalDialog = document.createElement('div');
|
|
384
|
+
modalDialog.style.backgroundColor = 'white';
|
|
385
|
+
modalDialog.style.borderRadius = '12px';
|
|
386
|
+
modalDialog.style.padding = '16px';
|
|
387
|
+
modalDialog.style.maxWidth = '400px';
|
|
388
|
+
modalDialog.style.width = '90%';
|
|
389
|
+
modalDialog.style.boxShadow = '0 4px 6px rgba(0, 0, 0, 0.1)';
|
|
390
|
+
modalDialog.style.position = 'relative';
|
|
391
|
+
// Close button
|
|
392
|
+
const closeButton = document.createElement('button');
|
|
393
|
+
closeButton.innerHTML = '×';
|
|
394
|
+
closeButton.style.position = 'absolute';
|
|
395
|
+
closeButton.style.top = '8px';
|
|
396
|
+
closeButton.style.right = '8px';
|
|
397
|
+
closeButton.style.background = 'none';
|
|
398
|
+
closeButton.style.border = 'none';
|
|
399
|
+
closeButton.style.fontSize = '20px';
|
|
400
|
+
closeButton.style.cursor = 'pointer';
|
|
401
|
+
closeButton.style.color = this.hexToColor(closeColor);
|
|
402
|
+
closeButton.onclick = () => {
|
|
403
|
+
if (onClose) {
|
|
404
|
+
onClose();
|
|
405
|
+
}
|
|
406
|
+
this.logInAppMessageClick(campaignId, false, true, true);
|
|
407
|
+
document.body.removeChild(modalOverlay);
|
|
408
|
+
};
|
|
409
|
+
// Create content
|
|
410
|
+
const contentContainer = document.createElement('div');
|
|
411
|
+
contentContainer.style.display = 'flex';
|
|
412
|
+
contentContainer.style.flexDirection = 'column';
|
|
413
|
+
contentContainer.style.alignItems = 'center';
|
|
414
|
+
contentContainer.style.textAlign = 'center';
|
|
415
|
+
// Image
|
|
416
|
+
if (imageUrl && imageUrl.trim() !== '') {
|
|
417
|
+
const image = document.createElement('img');
|
|
418
|
+
image.src = imageUrl;
|
|
419
|
+
image.style.width = '100px';
|
|
420
|
+
image.style.height = '100px';
|
|
421
|
+
image.style.marginBottom = '16px';
|
|
422
|
+
image.style.marginTop = '16px';
|
|
423
|
+
image.onerror = () => {
|
|
424
|
+
image.style.display = 'none';
|
|
425
|
+
};
|
|
426
|
+
contentContainer.appendChild(image);
|
|
427
|
+
}
|
|
428
|
+
// Title
|
|
429
|
+
const titleElement = document.createElement('h2');
|
|
430
|
+
titleElement.textContent = title;
|
|
431
|
+
titleElement.style.fontSize = '22px';
|
|
432
|
+
titleElement.style.fontWeight = '600';
|
|
433
|
+
titleElement.style.color = this.hexToColor(headerColor);
|
|
434
|
+
titleElement.style.margin = '8px 0';
|
|
435
|
+
contentContainer.appendChild(titleElement);
|
|
436
|
+
// Body
|
|
437
|
+
const bodyElement = document.createElement('p');
|
|
438
|
+
bodyElement.textContent = body;
|
|
439
|
+
bodyElement.style.fontSize = '14px';
|
|
440
|
+
bodyElement.style.color = this.hexToColor(messageColor);
|
|
441
|
+
bodyElement.style.fontWeight = '500';
|
|
442
|
+
bodyElement.style.margin = '8px 0 24px 0';
|
|
443
|
+
contentContainer.appendChild(bodyElement);
|
|
444
|
+
// Button handlers
|
|
445
|
+
const onPrimaryButtonPress = () => {
|
|
446
|
+
if (buttonPropertiesPrimary.webOnClickValue === "redirect_to_web_url" ||
|
|
447
|
+
buttonPropertiesPrimary.webOnClickValue === "deeplink_into_app") {
|
|
448
|
+
this.openWebUrl(buttonPropertiesPrimary.webOnClickAction || '');
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
const onSecondaryButtonPress = () => {
|
|
452
|
+
if (buttonPropertiesSecondary.webOnClickValue === "redirect_to_web_url" ||
|
|
453
|
+
buttonPropertiesSecondary.webOnClickValue === "deeplink_into_app") {
|
|
454
|
+
this.openWebUrl(buttonPropertiesSecondary.webOnClickAction || '');
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
// Create buttons
|
|
458
|
+
const buttonsContainer = document.createElement('div');
|
|
459
|
+
buttonsContainer.style.display = 'flex';
|
|
460
|
+
buttonsContainer.style.justifyContent = 'center';
|
|
461
|
+
buttonsContainer.style.width = '100%';
|
|
462
|
+
buttonsContainer.style.gap = '16px';
|
|
463
|
+
if (secondaryButtonText && secondaryButtonText.trim() !== '') {
|
|
464
|
+
// Primary button
|
|
465
|
+
const primaryButton = document.createElement('button');
|
|
466
|
+
primaryButton.textContent = primaryButtonText;
|
|
467
|
+
primaryButton.style.flex = '1';
|
|
468
|
+
primaryButton.style.maxWidth = '140px';
|
|
469
|
+
primaryButton.style.padding = '12px';
|
|
470
|
+
primaryButton.style.backgroundColor = this.hexToColor(buttonPropertiesPrimary.backgroundColor);
|
|
471
|
+
primaryButton.style.color = this.hexToColor(buttonPropertiesPrimary.textColor);
|
|
472
|
+
primaryButton.style.border = `2px solid ${this.hexToColor(buttonPropertiesPrimary.borderColor)}`;
|
|
473
|
+
primaryButton.style.borderRadius = '8px';
|
|
474
|
+
primaryButton.style.fontSize = '16px';
|
|
475
|
+
primaryButton.style.fontWeight = '600';
|
|
476
|
+
primaryButton.style.cursor = 'pointer';
|
|
477
|
+
primaryButton.onclick = () => {
|
|
478
|
+
document.body.removeChild(modalOverlay);
|
|
479
|
+
onPrimaryButtonPress();
|
|
480
|
+
};
|
|
481
|
+
buttonsContainer.appendChild(primaryButton);
|
|
482
|
+
// Secondary button
|
|
483
|
+
const secondaryButton = document.createElement('button');
|
|
484
|
+
secondaryButton.textContent = secondaryButtonText;
|
|
485
|
+
secondaryButton.style.flex = '1';
|
|
486
|
+
secondaryButton.style.maxWidth = '140px';
|
|
487
|
+
secondaryButton.style.padding = '12px';
|
|
488
|
+
secondaryButton.style.backgroundColor = this.hexToColor(buttonPropertiesSecondary.backgroundColor);
|
|
489
|
+
secondaryButton.style.color = this.hexToColor(buttonPropertiesSecondary.textColor);
|
|
490
|
+
secondaryButton.style.border = `2px solid ${this.hexToColor(buttonPropertiesSecondary.borderColor)}`;
|
|
491
|
+
secondaryButton.style.borderRadius = '8px';
|
|
492
|
+
secondaryButton.style.fontSize = '16px';
|
|
493
|
+
secondaryButton.style.fontWeight = '600';
|
|
494
|
+
secondaryButton.style.cursor = 'pointer';
|
|
495
|
+
secondaryButton.onclick = () => {
|
|
496
|
+
document.body.removeChild(modalOverlay);
|
|
497
|
+
this.logInAppMessageClick(campaignId, true, true, false);
|
|
498
|
+
onSecondaryButtonPress();
|
|
499
|
+
};
|
|
500
|
+
buttonsContainer.appendChild(secondaryButton);
|
|
501
|
+
}
|
|
502
|
+
else {
|
|
503
|
+
// Single button
|
|
504
|
+
if (primaryButtonText && primaryButtonText.trim() !== '') {
|
|
505
|
+
const primaryButton = document.createElement('button');
|
|
506
|
+
primaryButton.textContent = primaryButtonText;
|
|
507
|
+
primaryButton.style.width = '100%';
|
|
508
|
+
primaryButton.style.padding = '12px';
|
|
509
|
+
primaryButton.style.backgroundColor = this.hexToColor(buttonPropertiesPrimary.backgroundColor);
|
|
510
|
+
primaryButton.style.color = this.hexToColor(buttonPropertiesPrimary.textColor);
|
|
511
|
+
primaryButton.style.border = `2px solid ${this.hexToColor(buttonPropertiesPrimary.borderColor)}`;
|
|
512
|
+
primaryButton.style.borderRadius = '8px';
|
|
513
|
+
primaryButton.style.fontSize = '16px';
|
|
514
|
+
primaryButton.style.fontWeight = '600';
|
|
515
|
+
primaryButton.style.cursor = 'pointer';
|
|
516
|
+
primaryButton.onclick = () => {
|
|
517
|
+
document.body.removeChild(modalOverlay);
|
|
518
|
+
this.logInAppMessageClick(campaignId, true, true, false);
|
|
519
|
+
onPrimaryButtonPress();
|
|
520
|
+
};
|
|
521
|
+
buttonsContainer.appendChild(primaryButton);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
// Add all elements to the modal
|
|
525
|
+
modalDialog.appendChild(closeButton);
|
|
526
|
+
modalDialog.appendChild(contentContainer);
|
|
527
|
+
contentContainer.appendChild(buttonsContainer);
|
|
528
|
+
modalOverlay.appendChild(modalDialog);
|
|
529
|
+
// Add to document
|
|
530
|
+
document.body.appendChild(modalOverlay);
|
|
531
|
+
// Auto dismiss if enabled
|
|
532
|
+
if (dismissMessageAutomatically) {
|
|
533
|
+
setTimeout(() => {
|
|
534
|
+
if (document.body.contains(modalOverlay)) {
|
|
535
|
+
document.body.removeChild(modalOverlay);
|
|
536
|
+
}
|
|
537
|
+
}, parseInt(dismissMessageInSeconds) * 1000);
|
|
538
|
+
}
|
|
539
|
+
// Add click event to close when clicking outside
|
|
540
|
+
modalOverlay.addEventListener('click', (event) => {
|
|
541
|
+
if (event.target === modalOverlay) {
|
|
542
|
+
document.body.removeChild(modalOverlay);
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
async logInAppMessageClick(campaignId, clicked, opened, dismissed) {
|
|
547
|
+
const campaignClickPayload = await this.buildCampaignPayload(campaignId, opened, clicked, dismissed);
|
|
548
|
+
await this.processCampaignClick(campaignClickPayload);
|
|
549
|
+
}
|
|
550
|
+
async logClick(campaignId) {
|
|
551
|
+
// Ensure SDK is initialized before processing click
|
|
552
|
+
if (!this.currentUser || !this.deviceDetails) {
|
|
553
|
+
(0, utils_1.log)(this.debug, "SDK not fully initialized, waiting for initialization");
|
|
554
|
+
await this.initialize();
|
|
555
|
+
}
|
|
556
|
+
// Force send any pending events/attributes before processing click
|
|
557
|
+
if (this.eventQueue.length > 0 ||
|
|
558
|
+
this.purchaseBatch.length > 0 ||
|
|
559
|
+
Object.keys(this.attributeQueue).length > 0) {
|
|
560
|
+
await this.forceSend();
|
|
561
|
+
}
|
|
562
|
+
const pushCampaignClickPayload = await this.buildCampaignPayload(campaignId, true, true);
|
|
563
|
+
await this.processCampaignClick(pushCampaignClickPayload);
|
|
564
|
+
}
|
|
565
|
+
async processCampaignClick(payload) {
|
|
566
|
+
try {
|
|
567
|
+
const response = await fetch(`${this.endpoint}/analytics/clicks`, {
|
|
568
|
+
method: "POST",
|
|
569
|
+
headers: {
|
|
570
|
+
"Content-Type": "application/json",
|
|
571
|
+
"x-api-key": this.apiKey,
|
|
572
|
+
},
|
|
573
|
+
body: JSON.stringify(payload),
|
|
574
|
+
});
|
|
575
|
+
if (!response.ok) {
|
|
576
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
577
|
+
}
|
|
578
|
+
if (this.debug) {
|
|
579
|
+
(0, utils_1.log)(this.debug, `process campaign click dispatched successfully: ${payload.campaignId}`);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
catch (error) {
|
|
583
|
+
(0, utils_1.log)(this.debug, "Error processing campaign click:", error);
|
|
584
|
+
throw error;
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
async buildCampaignPayload(campaignId, opened, clicked, dismissed) {
|
|
588
|
+
const timestamp = Date.now();
|
|
589
|
+
const deviceId = this.deviceId;
|
|
590
|
+
const payload = {
|
|
591
|
+
campaignId,
|
|
592
|
+
opened,
|
|
593
|
+
clicked,
|
|
594
|
+
deviceId,
|
|
595
|
+
timestamp,
|
|
596
|
+
};
|
|
597
|
+
if (dismissed !== undefined) {
|
|
598
|
+
payload.dismissed = dismissed;
|
|
599
|
+
}
|
|
600
|
+
return payload;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
exports.WebSDK = WebSDK;
|
|
604
|
+
//# sourceMappingURL=web-sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-sd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AO,KAAK,EAAE,CAAC;YACf,IAAA,WAAG,EAAC,IAAI,CAAC,KAAK,EAAE,kCAAkC,EAAE,KAAK,CAAC,CAAC;YAC3D,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,oBAAoB,CAChC,UAAkB,EAClB,MAAe,EACf,OAAgB,EAChB,SAAmB;QAEnB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,MAAM,OAAO,GAAoB;YAC/B,UAAU;YACV,MAAM;YACN,OAAO;YACP,QAAQ;YACR,SAAS;SACV,CAAC;QAEF,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;QAChC,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CAEF;AA5xBD,wBA4xBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ordersune/crm-web-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.27",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -13,9 +13,7 @@
|
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
|
-
"build": "
|
|
17
|
-
"build:bundle": "webpack --config webpack.config.js",
|
|
18
|
-
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
16
|
+
"build": "tsc",
|
|
19
17
|
"prepare": "npm run build && husky",
|
|
20
18
|
"release": "bash -c 'read -p \"Enter OTP from authenticator: \" OTP && GIT_AUTHOR_NAME=\"$(git config user.name)\" GIT_AUTHOR_EMAIL=\"$(git config user.email)\" GIT_COMMITTER_NAME=\"$(git config user.name)\" GIT_COMMITTER_EMAIL=\"$(git config user.email)\" NPM_CONFIG_OTP=$OTP semantic-release --no-ci'",
|
|
21
19
|
"lint:commit": "commitlint --edit"
|
|
@@ -36,13 +34,7 @@
|
|
|
36
34
|
"@semantic-release/npm": "^13.1.2",
|
|
37
35
|
"@types/uuid": "^9.0.0",
|
|
38
36
|
"husky": "^9.1.7",
|
|
39
|
-
"javascript-obfuscator": "^4.1.1",
|
|
40
37
|
"semantic-release": "^25.0.2",
|
|
41
|
-
"
|
|
42
|
-
"ts-loader": "^9.5.4",
|
|
43
|
-
"typescript": "^5.0.0",
|
|
44
|
-
"webpack": "^5.103.0",
|
|
45
|
-
"webpack-cli": "^6.0.1",
|
|
46
|
-
"webpack-obfuscator": "^3.5.1"
|
|
38
|
+
"typescript": "^5.0.0"
|
|
47
39
|
}
|
|
48
40
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
export interface UserProfile {
|
|
2
|
-
id: string;
|
|
3
|
-
guestUserId?: string;
|
|
4
|
-
}
|
|
5
|
-
export interface EventOptions {
|
|
6
|
-
timestamp?: string;
|
|
7
|
-
requestId?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface SDKConfig {
|
|
10
|
-
apiKey: string;
|
|
11
|
-
endpoint: string;
|
|
12
|
-
debug?: boolean;
|
|
13
|
-
batchSize?: number;
|
|
14
|
-
batchInterval?: number;
|
|
15
|
-
}
|
|
16
|
-
export interface PurchasePayload {
|
|
17
|
-
externalId: string;
|
|
18
|
-
itemId: string;
|
|
19
|
-
itemName: string;
|
|
20
|
-
unitPrice: number;
|
|
21
|
-
quantity: number;
|
|
22
|
-
source: string;
|
|
23
|
-
channel: string;
|
|
24
|
-
itemCategory?: string;
|
|
25
|
-
}
|
|
26
|
-
export interface DeviceDetails {
|
|
27
|
-
deviceId: string;
|
|
28
|
-
deviceIdentifier: string;
|
|
29
|
-
platform: string;
|
|
30
|
-
pushToken?: string;
|
|
31
|
-
}
|
|
32
|
-
export interface ButtonProperties {
|
|
33
|
-
backgroundColor: string;
|
|
34
|
-
borderColor: string;
|
|
35
|
-
textColor: string;
|
|
36
|
-
androidOnClickValue?: string;
|
|
37
|
-
androidOnClickAction?: string;
|
|
38
|
-
iOSOnClickValue?: string;
|
|
39
|
-
iOSOnClickAction?: string;
|
|
40
|
-
type?: string;
|
|
41
|
-
[key: string]: any;
|
|
42
|
-
}
|
|
43
|
-
export interface ModalConfig {
|
|
44
|
-
button1: ButtonProperties;
|
|
45
|
-
button2: ButtonProperties;
|
|
46
|
-
dismissMessageAutomatically: boolean;
|
|
47
|
-
dismissMessageInSeconds: string;
|
|
48
|
-
headerColor: string;
|
|
49
|
-
messageColor: string;
|
|
50
|
-
closeColor: string;
|
|
51
|
-
}
|
|
52
|
-
export interface MediaConfig {
|
|
53
|
-
inAppImage: string;
|
|
54
|
-
}
|
|
55
|
-
export interface InAppMessageData {
|
|
56
|
-
header: string;
|
|
57
|
-
message: string;
|
|
58
|
-
modal: ModalConfig;
|
|
59
|
-
mediaConfig: MediaConfig;
|
|
60
|
-
}
|
|
61
|
-
export interface ShowInAppMessageOptions {
|
|
62
|
-
context?: any;
|
|
63
|
-
title: string;
|
|
64
|
-
body: string;
|
|
65
|
-
primaryButtonText: string;
|
|
66
|
-
secondaryButtonText?: string;
|
|
67
|
-
imageUrl: string;
|
|
68
|
-
onClose?: () => void;
|
|
69
|
-
buttonPropertiesPrimary: ButtonProperties;
|
|
70
|
-
buttonPropertiesSecondary: ButtonProperties;
|
|
71
|
-
dismissMessageAutomatically: boolean;
|
|
72
|
-
dismissMessageInSeconds: string;
|
|
73
|
-
headerColor: string;
|
|
74
|
-
messageColor: string;
|
|
75
|
-
closeColor: string;
|
|
76
|
-
campaignId: string;
|
|
77
|
-
}
|
|
78
|
-
export interface CampaignPayload {
|
|
79
|
-
campaignId: string;
|
|
80
|
-
opened: boolean;
|
|
81
|
-
clicked: boolean;
|
|
82
|
-
deviceId: string;
|
|
83
|
-
timestamp: number;
|
|
84
|
-
dismissed?: boolean;
|
|
85
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const log: (debug: boolean, message: string, ...args: any[]) => void;
|
package/dist/src/web-sdk.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { SDKConfig, EventOptions, UserProfile } from "./types";
|
|
2
|
-
export declare class WebSDK {
|
|
3
|
-
private readonly apiKey;
|
|
4
|
-
private readonly endpoint;
|
|
5
|
-
private readonly debug;
|
|
6
|
-
private readonly maxBatchSize;
|
|
7
|
-
private readonly batchInterval;
|
|
8
|
-
private readonly sdkVersion;
|
|
9
|
-
private deviceId;
|
|
10
|
-
private deviceIdentifier;
|
|
11
|
-
private guestUserId;
|
|
12
|
-
private deviceDetails?;
|
|
13
|
-
private currentUser?;
|
|
14
|
-
private eventQueue;
|
|
15
|
-
private purchaseBatch;
|
|
16
|
-
private attributeQueue;
|
|
17
|
-
private isProcessingQueue;
|
|
18
|
-
private batchProcessingInterval?;
|
|
19
|
-
constructor(config: SDKConfig);
|
|
20
|
-
private initialize;
|
|
21
|
-
identify(userId: string): void;
|
|
22
|
-
clearUserData(): void;
|
|
23
|
-
trackEvent(eventName: string, properties?: Record<string, any>, options?: EventOptions): void;
|
|
24
|
-
setToken(token: string): void;
|
|
25
|
-
trackCustomAttribute(attributeName: string, attributeValue: any): void;
|
|
26
|
-
logProductPurchase(orderId: string, itemId: string, itemName: string, unitPrice: number, quantity: number, source: string, channel: string, itemCategory?: string): void;
|
|
27
|
-
getUserProfile(): UserProfile | undefined;
|
|
28
|
-
forceSend(): Promise<void>;
|
|
29
|
-
dispose(): void;
|
|
30
|
-
private getStoredDeviceId;
|
|
31
|
-
private getStoredUserProfile;
|
|
32
|
-
private storeDeviceId;
|
|
33
|
-
private storeUserProfile;
|
|
34
|
-
private storeCustomAttributes;
|
|
35
|
-
private loadCustomAttributes;
|
|
36
|
-
private getGuestUserId;
|
|
37
|
-
private buildPurchasePayload;
|
|
38
|
-
private initializeDeviceDetails;
|
|
39
|
-
private startBatchProcessing;
|
|
40
|
-
private queueEvent;
|
|
41
|
-
private processBatch;
|
|
42
|
-
private sendBatchToServer;
|
|
43
|
-
displayInAppMessage(inAppMessageData: string, campaignId: string, context?: any): void;
|
|
44
|
-
private hexToColor;
|
|
45
|
-
private openWebUrl;
|
|
46
|
-
private showInAppMessage;
|
|
47
|
-
private logInAppMessageClick;
|
|
48
|
-
logClick(campaignId: string): Promise<void>;
|
|
49
|
-
private processCampaignClick;
|
|
50
|
-
private buildCampaignPayload;
|
|
51
|
-
}
|