@cimplify/sdk 0.108.0 → 0.110.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/advanced.d.mts +4 -3
- package/dist/advanced.d.ts +4 -3
- package/dist/advanced.js +24 -24
- package/dist/advanced.mjs +5 -5
- package/dist/animation-4EXBXRVX.js +27 -0
- package/dist/animation-6DICNWUP.mjs +6 -0
- package/dist/audio-DhvyjqdA.d.mts +249 -0
- package/dist/audio-m0w8cnxq.d.ts +249 -0
- package/dist/avatars.d.mts +110 -0
- package/dist/avatars.d.ts +110 -0
- package/dist/avatars.js +82 -0
- package/dist/avatars.mjs +5 -0
- package/dist/backend-gUCzs5Kg.d.mts +3866 -0
- package/dist/backend-gUCzs5Kg.d.ts +3866 -0
- package/dist/{catalogue-B4eLL8Mi.d.ts → catalogue-CPTMyBUz.d.mts} +109 -221
- package/dist/catalogue-DzrTXP3v.d.mts +541 -0
- package/dist/catalogue-DzrTXP3v.d.ts +541 -0
- package/dist/{catalogue-OT89_Ifs.d.mts → catalogue-OTuS5zp-.d.ts} +109 -221
- package/dist/chunk-22BD3RHN.mjs +1809 -0
- package/dist/chunk-25T4JHEA.mjs +21 -0
- package/dist/chunk-2AQ237Y4.js +508 -0
- package/dist/chunk-2IC4H6OV.mjs +48 -0
- package/dist/chunk-2LHLG4OB.mjs +71 -0
- package/dist/chunk-2O2CG465.js +1709 -0
- package/dist/chunk-2Q4DTHXK.js +316 -0
- package/dist/chunk-2QTQ6BUH.mjs +46 -0
- package/dist/chunk-2UN4SFLR.mjs +100 -0
- package/dist/chunk-2V75I7K3.js +454 -0
- package/dist/chunk-2V7IL4HC.js +10 -0
- package/dist/chunk-34XBXUMW.js +296 -0
- package/dist/chunk-3C4C654I.js +71 -0
- package/dist/chunk-3DAD2LDF.mjs +72 -0
- package/dist/chunk-3GXH2NFD.mjs +4 -0
- package/dist/chunk-3O47ZFW3.js +961 -0
- package/dist/chunk-3OY3VYNF.mjs +11 -0
- package/dist/chunk-3S6WPBZL.js +2936 -0
- package/dist/chunk-3TUOUP5T.js +399 -0
- package/dist/chunk-3VEH23I5.mjs +1380 -0
- package/dist/chunk-3ZYSAW2T.mjs +263 -0
- package/dist/chunk-4ANVF274.js +103 -0
- package/dist/chunk-4C7I3ELN.js +388 -0
- package/dist/chunk-4DYKAYFO.mjs +8 -0
- package/dist/chunk-4ZDR72SG.js +329 -0
- package/dist/chunk-52YS45RR.js +1066 -0
- package/dist/chunk-5325XSCH.js +107 -0
- package/dist/chunk-5AD5X6AV.js +13 -0
- package/dist/chunk-5BYDGGWO.mjs +197 -0
- package/dist/chunk-5C3C7VDM.mjs +55 -0
- package/dist/chunk-5HFMY3D7.js +660 -0
- package/dist/chunk-5LH2QN3T.js +1862 -0
- package/dist/chunk-5PJEXSOW.js +44 -0
- package/dist/chunk-5SXDH3Y7.js +90 -0
- package/dist/chunk-5YFBGGCK.mjs +502 -0
- package/dist/chunk-5YWN6H5Q.mjs +133 -0
- package/dist/chunk-66QP3SMN.js +402 -0
- package/dist/chunk-6DAEZKIG.mjs +385 -0
- package/dist/chunk-6DATW7TB.mjs +420 -0
- package/dist/{chunk-JRGK3NXR.mjs → chunk-6ETDAU62.mjs} +72 -212
- package/dist/chunk-6H254EVP.mjs +178 -0
- package/dist/chunk-6PFNJPBJ.mjs +820 -0
- package/dist/chunk-6PJWXIFX.mjs +357 -0
- package/dist/chunk-6SWKWCMS.js +80 -0
- package/dist/chunk-6VVXXX7S.js +808 -0
- package/dist/chunk-6WUBSMTX.js +1403 -0
- package/dist/chunk-73SGZLAQ.mjs +35 -0
- package/dist/chunk-76L2V6KD.mjs +4 -0
- package/dist/chunk-7AAIAVAA.js +1531 -0
- package/dist/chunk-7ARSJPV3.mjs +93 -0
- package/dist/chunk-7BHW5GTC.mjs +1234 -0
- package/dist/chunk-7DQSDKDU.js +6 -0
- package/dist/chunk-7IQQQENP.mjs +401 -0
- package/dist/chunk-7KFTYENS.js +11357 -0
- package/dist/chunk-7SM6XSPZ.js +3171 -0
- package/dist/chunk-7SXOHAIR.mjs +28 -0
- package/dist/chunk-A2MAX6S4.js +90 -0
- package/dist/chunk-A33OORT7.mjs +1530 -0
- package/dist/{chunk-U6ACF76H.mjs → chunk-A36JRXXH.mjs} +1075 -1845
- package/dist/chunk-A7BU3BK4.js +52 -0
- package/dist/chunk-A7MQSN2V.mjs +77 -0
- package/dist/chunk-A7V4L2IT.mjs +416 -0
- package/dist/chunk-AABEK6XU.js +226 -0
- package/dist/chunk-AGV33FWC.mjs +5005 -0
- package/dist/chunk-AHNR3BXI.js +108 -0
- package/dist/chunk-AQ5RLBU2.mjs +286 -0
- package/dist/chunk-AQOE6WCG.js +1270 -0
- package/dist/chunk-ATAWRACV.mjs +62 -0
- package/dist/chunk-ATCURNUV.js +14 -0
- package/dist/chunk-AWPV33OO.js +6 -0
- package/dist/chunk-AYJPHKYV.js +337 -0
- package/dist/chunk-AZ5BGWHB.js +162 -0
- package/dist/chunk-AZAXD44P.js +1373 -0
- package/dist/chunk-BBGKQIJJ.mjs +406 -0
- package/dist/chunk-BP4JLSUA.js +1453 -0
- package/dist/{chunk-SUCE7FWA.mjs → chunk-BTUSVHIE.mjs} +539 -978
- package/dist/chunk-BU6OK542.mjs +818 -0
- package/dist/chunk-CVSRWM6W.js +418 -0
- package/dist/chunk-CYBMFMJD.mjs +247 -0
- package/dist/chunk-DDJLDOUX.mjs +217 -0
- package/dist/{chunk-V32BCG7M.js → chunk-DFZWHNRG.js} +75 -215
- package/dist/chunk-DJ2C7AVG.js +644 -0
- package/dist/chunk-DS2VU4WW.mjs +102 -0
- package/dist/chunk-DSAG7T5P.js +7290 -0
- package/dist/chunk-E2QPPH7I.js +327 -0
- package/dist/chunk-E65WCTIG.mjs +1187 -0
- package/dist/{chunk-33VCYWVL.mjs → chunk-E6QQKDNE.mjs} +30 -42
- package/dist/chunk-ECDK6QBF.mjs +981 -0
- package/dist/chunk-EIB4OWVQ.mjs +620 -0
- package/dist/chunk-EQUZYCGO.js +250 -0
- package/dist/chunk-F3UJ6ZRM.mjs +313 -0
- package/dist/chunk-F63N2ZTQ.js +7023 -0
- package/dist/chunk-F6XRYEM3.mjs +26 -0
- package/dist/chunk-FE6VCE4K.js +5030 -0
- package/dist/chunk-FLWD6GRR.js +1372 -0
- package/dist/chunk-FQBFWJBS.mjs +110 -0
- package/dist/chunk-FXVJ2HFU.js +26 -0
- package/dist/chunk-FZMQMQBW.js +312 -0
- package/dist/chunk-G3EEC44R.js +53 -0
- package/dist/{chunk-KG3WT4PR.mjs → chunk-GCKWKLZF.mjs} +73 -104
- package/dist/chunk-GCX7TY4D.mjs +6826 -0
- package/dist/chunk-GDB6TCSD.js +450 -0
- package/dist/chunk-GDCV4IWO.mjs +21 -0
- package/dist/chunk-GDZT5LZ5.js +170 -0
- package/dist/chunk-GHPUYD4I.mjs +213 -0
- package/dist/chunk-GHS6MIL6.mjs +1432 -0
- package/dist/chunk-GPS2THCL.mjs +11 -0
- package/dist/{chunk-EV2EVOYS.js → chunk-GTJWQAGU.js} +31 -42
- package/dist/chunk-GVTI6UJQ.mjs +130 -0
- package/dist/chunk-GXKI64OT.mjs +1138 -0
- package/dist/chunk-GYDYF2WX.js +275 -0
- package/dist/chunk-GYLP6UG4.mjs +705 -0
- package/dist/chunk-H3OQKK6X.js +1158 -0
- package/dist/chunk-H5DFSCJ6.js +40 -0
- package/dist/chunk-HAGEIC2L.mjs +186 -0
- package/dist/chunk-HAJ4JRFO.js +293 -0
- package/dist/chunk-HDR72GB6.js +188 -0
- package/dist/chunk-HF5HPS4T.mjs +40 -0
- package/dist/chunk-HK6LOFDS.js +218 -0
- package/dist/chunk-HMWYTXCY.mjs +143 -0
- package/dist/chunk-HPCSRCMA.js +89 -0
- package/dist/chunk-HSEO6TPU.js +247 -0
- package/dist/chunk-I5FOHCLH.js +132 -0
- package/dist/chunk-IDLW4NWA.mjs +85 -0
- package/dist/chunk-IIDZ5WUX.js +61 -0
- package/dist/chunk-IR74FJHU.js +2332 -0
- package/dist/chunk-IRVFYAKP.mjs +100 -0
- package/dist/{chunk-XBL3TMPC.mjs → chunk-IZDWAL53.mjs} +1795 -3287
- package/dist/chunk-J2KZXIU3.js +51 -0
- package/dist/chunk-J2U6PJSO.js +91 -0
- package/dist/chunk-J5AJNY2N.js +283 -0
- package/dist/chunk-J6KQZ4FO.mjs +821 -0
- package/dist/{chunk-OWW5GUSB.js → chunk-JGBCIKJV.js} +7 -6
- package/dist/chunk-JKGTBMU7.mjs +25 -0
- package/dist/chunk-JR3TNEQC.js +422 -0
- package/dist/chunk-JURRXY2J.mjs +29 -0
- package/dist/chunk-K3HW5I2A.mjs +317 -0
- package/dist/chunk-K46SMZ66.mjs +103 -0
- package/dist/chunk-K4UDGE3Z.mjs +6 -0
- package/dist/chunk-KDQOR4QQ.mjs +350 -0
- package/dist/chunk-KDTVOLHI.mjs +288 -0
- package/dist/chunk-KGHJH5KJ.mjs +35 -0
- package/dist/chunk-KIZOA5LX.mjs +140 -0
- package/dist/chunk-KK6HYVBI.mjs +242 -0
- package/dist/chunk-KMKWGXMK.js +856 -0
- package/dist/chunk-KPA6K5IB.js +80 -0
- package/dist/chunk-KU7O4IXU.mjs +260 -0
- package/dist/chunk-KVFNRJOR.mjs +11142 -0
- package/dist/chunk-KZJRSXHK.js +2432 -0
- package/dist/chunk-LHWPRUJL.js +79 -0
- package/dist/chunk-LIV3KXJG.mjs +369 -0
- package/dist/chunk-LKV4LACG.js +21 -0
- package/dist/chunk-LUY45X3U.mjs +263 -0
- package/dist/chunk-LYEZZEEF.mjs +17 -0
- package/dist/chunk-M5EXQZYY.mjs +1519 -0
- package/dist/chunk-ME6HGG4I.mjs +1338 -0
- package/dist/chunk-MEXP6DA6.js +31 -0
- package/dist/chunk-MG52AW3H.js +902 -0
- package/dist/chunk-MIPO6F72.js +334 -0
- package/dist/{chunk-5QW7CQBA.js → chunk-MKIJQL5Q.js} +211 -321
- package/dist/chunk-MN3YETVN.mjs +17 -0
- package/dist/chunk-MOBSBXVE.mjs +2391 -0
- package/dist/chunk-MOMOZEUM.mjs +88 -0
- package/dist/chunk-MRFUNRAP.js +62 -0
- package/dist/chunk-MTIHEW2M.js +433 -0
- package/dist/chunk-N4RGGDEL.mjs +73 -0
- package/dist/chunk-NH654HAT.js +10 -0
- package/dist/chunk-NHJUGZUR.mjs +253 -0
- package/dist/chunk-NMQT4HG3.mjs +757 -0
- package/dist/chunk-NPSYB6DC.mjs +906 -0
- package/dist/chunk-NW2GPMSO.js +857 -0
- package/dist/chunk-NXKQOQ6L.js +76 -0
- package/dist/chunk-NXLAZIJZ.js +309 -0
- package/dist/chunk-NYWNA5CF.js +148 -0
- package/dist/chunk-NZTKLY2W.js +1442 -0
- package/dist/chunk-O2ICABUD.js +36 -0
- package/dist/chunk-OIVVQQ22.js +862 -0
- package/dist/chunk-OKC2B4O3.mjs +312 -0
- package/dist/chunk-OLWFPDBK.js +2220 -0
- package/dist/chunk-OMTVH334.js +3779 -0
- package/dist/chunk-OQRVEM56.mjs +362 -0
- package/dist/chunk-OXMIBOD4.js +337 -0
- package/dist/chunk-PBL6YL5L.mjs +288 -0
- package/dist/chunk-PDOELNNQ.js +97 -0
- package/dist/chunk-PDQJY2GZ.js +136 -0
- package/dist/chunk-PKOZXD2Q.js +1274 -0
- package/dist/chunk-PPF2BYFL.mjs +2191 -0
- package/dist/chunk-PQTQKNKD.js +539 -0
- package/dist/chunk-PRSR4FAV.mjs +81 -0
- package/dist/chunk-PTRNO5UD.js +95 -0
- package/dist/chunk-Q2Y3VMKH.js +2000 -0
- package/dist/chunk-QCZOE65N.js +96 -0
- package/dist/chunk-QDYFLATW.mjs +52 -0
- package/dist/chunk-QQABGCMM.js +22 -0
- package/dist/chunk-QS6TRHMR.js +345 -0
- package/dist/chunk-R56P64LB.mjs +208 -0
- package/dist/chunk-RCQ2MPBV.js +428 -0
- package/dist/chunk-RFVRPYR2.mjs +856 -0
- package/dist/chunk-RKBLPGPV.js +11521 -0
- package/dist/chunk-RM2V4IND.mjs +327 -0
- package/dist/chunk-RQXN5A34.mjs +613 -0
- package/dist/chunk-RUVGVNOF.mjs +2687 -0
- package/dist/chunk-SAFJIGYB.mjs +165 -0
- package/dist/chunk-SKQFLBDD.js +263 -0
- package/dist/chunk-SMK6JU2F.mjs +2092 -0
- package/dist/{chunk-UVRPC2P7.js → chunk-SNNEOS5Z.js} +1984 -3476
- package/dist/chunk-SPCRQ6NO.mjs +1246 -0
- package/dist/chunk-SWX4SALA.mjs +19 -0
- package/dist/{chunk-JVODCGFP.mjs → chunk-SYEO2WV4.mjs} +128 -238
- package/dist/chunk-T2QQMX2N.js +10 -0
- package/dist/chunk-T3AFF3L7.mjs +57 -0
- package/dist/chunk-T6Z2EXYL.js +712 -0
- package/dist/chunk-T7LOXGYX.js +118 -0
- package/dist/chunk-TJCAE7RC.mjs +1315 -0
- package/dist/chunk-TJI3K6RP.js +137 -0
- package/dist/chunk-TL2SVO4P.mjs +55 -0
- package/dist/chunk-TM63CYGN.mjs +399 -0
- package/dist/chunk-TU5RYTYU.mjs +13 -0
- package/dist/chunk-TVJZ4GPS.js +1553 -0
- package/dist/chunk-TWM6DLYF.js +371 -0
- package/dist/chunk-U63OC4TQ.js +30 -0
- package/dist/{chunk-L5GKVQVJ.js → chunk-U6BVSJZ6.js} +25 -57
- package/dist/chunk-U6UVWEAK.mjs +792 -0
- package/dist/chunk-UCEPNO6N.mjs +11048 -0
- package/dist/{chunk-ANT574FD.js → chunk-UCR5HRYM.js} +74 -105
- package/dist/chunk-UG5BTOTF.mjs +334 -0
- package/dist/chunk-UGH37BQW.mjs +157 -0
- package/dist/chunk-V7ZRH3PY.mjs +271 -0
- package/dist/chunk-VBGHBL3E.mjs +1394 -0
- package/dist/chunk-VRBDAS5I.js +920 -0
- package/dist/chunk-VVE3Y76O.js +230 -0
- package/dist/chunk-W65JIRI4.mjs +1182 -0
- package/dist/chunk-WHYKAT7G.js +62 -0
- package/dist/{chunk-YOIVZ6OA.mjs → chunk-WIZRUIZB.mjs} +25 -57
- package/dist/chunk-WKWTDZS7.js +385 -0
- package/dist/chunk-WLMINRC4.mjs +78 -0
- package/dist/chunk-WOF3AD3J.js +22 -0
- package/dist/chunk-WWKMOA76.js +1262 -0
- package/dist/chunk-X5A5FOWW.js +615 -0
- package/dist/chunk-X6CN6KQF.mjs +192 -0
- package/dist/chunk-XD2PMH46.mjs +517 -0
- package/dist/chunk-XJA2NGTI.mjs +88 -0
- package/dist/chunk-XJIHN3BY.mjs +8 -0
- package/dist/chunk-XK6UDWJS.js +203 -0
- package/dist/chunk-XPG3N5CF.mjs +415 -0
- package/dist/chunk-XVZ2NKSU.mjs +74 -0
- package/dist/chunk-XYP45OLE.js +117 -0
- package/dist/chunk-XZSDGZX6.mjs +301 -0
- package/dist/chunk-Y2EMGN4T.mjs +120 -0
- package/dist/chunk-Y3XWP5XW.mjs +298 -0
- package/dist/chunk-Y4K22JL6.js +228 -0
- package/dist/chunk-Y65LXQGA.mjs +3164 -0
- package/dist/chunk-Y66WVMO5.mjs +87 -0
- package/dist/chunk-Y7JWLB25.mjs +7280 -0
- package/dist/chunk-YCDXAJKU.js +175 -0
- package/dist/chunk-YRDQCCIS.js +152 -0
- package/dist/chunk-YV52DGSA.js +111 -0
- package/dist/chunk-YXGZQPUD.js +94 -0
- package/dist/chunk-Z3A3AFVU.mjs +102 -0
- package/dist/chunk-ZCY6YKKP.mjs +475 -0
- package/dist/chunk-ZEQHXVU5.js +215 -0
- package/dist/chunk-ZF7JCXCI.js +284 -0
- package/dist/chunk-ZJBRUH6V.js +29 -0
- package/dist/chunk-ZMIL4ZOA.js +365 -0
- package/dist/chunk-ZR5ULMN2.mjs +337 -0
- package/dist/chunk-ZXREOYOW.js +87 -0
- package/dist/{client-BSP9U1O1.d.mts → client-CX_WR0-J.d.mts} +2 -2
- package/dist/client-Dytx_ZTC.d.ts +230 -0
- package/dist/{client-B878xeAP.d.ts → client-dqOhP9Nc.d.ts} +2 -2
- package/dist/client-hTKbCuhG.d.mts +230 -0
- package/dist/clock-B-UAjkKa.d.mts +5 -0
- package/dist/clock-B-UAjkKa.d.ts +5 -0
- package/dist/config-BlXQluJR.d.mts +36 -0
- package/dist/config-BlXQluJR.d.ts +36 -0
- package/dist/courier-Cnn-edJ4.d.ts +95 -0
- package/dist/courier-FmGfkvIN.d.mts +95 -0
- package/dist/crowd-DdHFbqKK.d.ts +186 -0
- package/dist/crowd-hOVSAmA3.d.mts +186 -0
- package/dist/danfo-BEBapFlX.d.mts +146 -0
- package/dist/danfo-UQ_PTIIx.d.ts +146 -0
- package/dist/{elements-Bty6Qs_N.d.mts → elements-DdsRig-2.d.mts} +1548 -257
- package/dist/{elements-Bty6Qs_N.d.ts → elements-DdsRig-2.d.ts} +1548 -257
- package/dist/engines/godot.d.mts +56 -0
- package/dist/engines/godot.d.ts +56 -0
- package/dist/engines/godot.js +28 -0
- package/dist/engines/godot.mjs +3 -0
- package/dist/engines/wasm.d.mts +11 -0
- package/dist/engines/wasm.d.ts +11 -0
- package/dist/engines/wasm.js +178 -0
- package/dist/engines/wasm.mjs +176 -0
- package/dist/fallback-CrG_lTFk.d.mts +270 -0
- package/dist/fallback-CrG_lTFk.d.ts +270 -0
- package/dist/fallback-KDB4Y2CE.mjs +6 -0
- package/dist/fallback-Y26TQENE.js +19 -0
- package/dist/features-CZB4rmcD.d.mts +118 -0
- package/dist/features-CZB4rmcD.d.ts +118 -0
- package/dist/fit-BWiE7rgA.d.mts +44 -0
- package/dist/fit-DK0oT7zO.d.ts +44 -0
- package/dist/five-a-side-Bv1AOUy3.d.mts +115 -0
- package/dist/five-a-side-EC51SJY1.d.ts +115 -0
- package/dist/fluid-ARr0qUIL.d.ts +939 -0
- package/dist/fluid-DLlEj2cs.d.mts +939 -0
- package/dist/game/conformance.d.mts +84 -0
- package/dist/game/conformance.d.ts +84 -0
- package/dist/game/conformance.js +1025 -0
- package/dist/game/conformance.mjs +994 -0
- package/dist/game/heap.d.mts +40 -0
- package/dist/game/heap.d.ts +40 -0
- package/dist/game/heap.js +48 -0
- package/dist/game/heap.mjs +7 -0
- package/dist/game/kit/canvas.d.mts +240 -0
- package/dist/game/kit/canvas.d.ts +240 -0
- package/dist/game/kit/canvas.js +3566 -0
- package/dist/game/kit/canvas.mjs +1039 -0
- package/dist/game/kit/courier.d.mts +17 -0
- package/dist/game/kit/courier.d.ts +17 -0
- package/dist/game/kit/courier.js +66 -0
- package/dist/game/kit/courier.mjs +49 -0
- package/dist/game/kit/danfo.d.mts +11 -0
- package/dist/game/kit/danfo.d.ts +11 -0
- package/dist/game/kit/danfo.js +109 -0
- package/dist/game/kit/danfo.mjs +44 -0
- package/dist/game/kit/engine.d.mts +29 -0
- package/dist/game/kit/engine.d.ts +29 -0
- package/dist/game/kit/engine.js +183 -0
- package/dist/game/kit/engine.mjs +30 -0
- package/dist/game/kit/five-a-side.d.mts +11 -0
- package/dist/game/kit/five-a-side.d.ts +11 -0
- package/dist/game/kit/five-a-side.js +86 -0
- package/dist/game/kit/five-a-side.mjs +41 -0
- package/dist/game/kit/frontier.d.mts +344 -0
- package/dist/game/kit/frontier.d.ts +344 -0
- package/dist/game/kit/frontier.js +435 -0
- package/dist/game/kit/frontier.mjs +14 -0
- package/dist/game/kit/genesis.d.mts +752 -0
- package/dist/game/kit/genesis.d.ts +752 -0
- package/dist/game/kit/genesis.js +380 -0
- package/dist/game/kit/genesis.mjs +15 -0
- package/dist/game/kit/ludo.d.mts +15 -0
- package/dist/game/kit/ludo.d.ts +15 -0
- package/dist/game/kit/ludo.js +87 -0
- package/dist/game/kit/ludo.mjs +42 -0
- package/dist/game/kit/runner.d.mts +12 -0
- package/dist/game/kit/runner.d.ts +12 -0
- package/dist/game/kit/runner.js +83 -0
- package/dist/game/kit/runner.mjs +46 -0
- package/dist/game/kit/shootout.d.mts +13 -0
- package/dist/game/kit/shootout.d.ts +13 -0
- package/dist/game/kit/shootout.js +122 -0
- package/dist/game/kit/shootout.mjs +57 -0
- package/dist/game/kit/slots.d.mts +392 -0
- package/dist/game/kit/slots.d.ts +392 -0
- package/dist/game/kit/slots.js +215 -0
- package/dist/game/kit/slots.mjs +6 -0
- package/dist/game/kit/tycoon.d.mts +16 -0
- package/dist/game/kit/tycoon.d.ts +16 -0
- package/dist/game/kit/tycoon.js +145 -0
- package/dist/game/kit/tycoon.mjs +44 -0
- package/dist/game/kit/word.d.mts +11 -0
- package/dist/game/kit/word.d.ts +11 -0
- package/dist/game/kit/word.js +78 -0
- package/dist/game/kit/word.mjs +41 -0
- package/dist/game/kit/worlds.d.mts +18 -0
- package/dist/game/kit/worlds.d.ts +18 -0
- package/dist/game/kit/worlds.js +74 -0
- package/dist/game/kit/worlds.mjs +49 -0
- package/dist/game/kit.d.mts +53 -0
- package/dist/game/kit.d.ts +53 -0
- package/dist/game/kit.js +2610 -0
- package/dist/game/kit.mjs +101 -0
- package/dist/game/prepared.d.mts +14 -0
- package/dist/game/prepared.d.ts +14 -0
- package/dist/game/prepared.js +81 -0
- package/dist/game/prepared.mjs +32 -0
- package/dist/game-Bx8onkhX.d.mts +1451 -0
- package/dist/game-fgQy2YIm.d.ts +1451 -0
- package/dist/game-theme-CBTw1b_d.d.mts +35 -0
- package/dist/game-theme-Dg-ict5A.d.ts +35 -0
- package/dist/game.d.mts +3546 -0
- package/dist/game.d.ts +3546 -0
- package/dist/game.js +4455 -0
- package/dist/game.mjs +50 -0
- package/dist/graphics-C6YjWYvP.d.ts +5 -0
- package/dist/graphics-Dk2yQnYN.d.mts +5 -0
- package/dist/guest-DrsA00XD.d.mts +732 -0
- package/dist/guest-wIdfoT05.d.ts +732 -0
- package/dist/hit-stop-BKkVwTq7.d.mts +43 -0
- package/dist/hit-stop-D-8pPYnM.d.ts +43 -0
- package/dist/hot-Crn9XpHJ.d.ts +29 -0
- package/dist/hot-DH3nOhQD.d.mts +29 -0
- package/dist/{index-CQStGb3B.d.mts → index-6gkHMGAq.d.mts} +2 -2
- package/dist/index-B8ybCKJI.d.ts +41 -0
- package/dist/{index-DJwXmoaP.d.ts → index-B98Xac8e.d.ts} +2 -2
- package/dist/{index-B7oA_1XI.d.ts → index-B_ByTtIT.d.ts} +2 -2
- package/dist/index-DHjNHb1c.d.mts +41 -0
- package/dist/{index-DhUSTAhT.d.mts → index-DbAN_VQE.d.mts} +2 -2
- package/dist/index.d.mts +134 -24
- package/dist/index.d.ts +134 -24
- package/dist/index.js +407 -248
- package/dist/index.mjs +184 -58
- package/dist/interactives-authoring.d.mts +231 -0
- package/dist/interactives-authoring.d.ts +231 -0
- package/dist/interactives-authoring.js +1743 -0
- package/dist/interactives-authoring.mjs +1704 -0
- package/dist/interactives-canvas.global.js +148 -0
- package/dist/interactives-guest.d.mts +20 -0
- package/dist/interactives-guest.d.ts +20 -0
- package/dist/interactives-guest.js +63 -0
- package/dist/interactives-guest.json +1 -0
- package/dist/interactives-guest.mjs +61 -0
- package/dist/interactives-jsc.global.js +9357 -0
- package/dist/interactives-meters.d.mts +93 -0
- package/dist/interactives-meters.d.ts +93 -0
- package/dist/interactives-meters.js +252 -0
- package/dist/interactives-meters.mjs +68 -0
- package/dist/interactives-production.d.mts +430 -0
- package/dist/interactives-production.d.ts +430 -0
- package/dist/interactives-production.js +1231 -0
- package/dist/interactives-production.mjs +1170 -0
- package/dist/interactives-record.d.mts +112 -0
- package/dist/interactives-record.d.ts +112 -0
- package/dist/interactives-record.js +302 -0
- package/dist/interactives-record.mjs +295 -0
- package/dist/interactives-runtime.d.mts +61 -0
- package/dist/interactives-runtime.d.ts +61 -0
- package/dist/interactives-runtime.js +442 -0
- package/dist/interactives-runtime.mjs +25 -0
- package/dist/interactives-studio-kernel.global.js +1 -0
- package/dist/interactives-studio.d.mts +806 -0
- package/dist/interactives-studio.d.ts +806 -0
- package/dist/interactives-studio.js +5741 -0
- package/dist/interactives-studio.mjs +5651 -0
- package/dist/interactives-tick.d.mts +90 -0
- package/dist/interactives-tick.d.ts +90 -0
- package/dist/interactives-tick.js +203 -0
- package/dist/interactives-tick.mjs +6 -0
- package/dist/interactives-web.d.mts +762 -0
- package/dist/interactives-web.d.ts +762 -0
- package/dist/interactives-web.js +5000 -0
- package/dist/interactives-web.mjs +4628 -0
- package/dist/interactives.d.mts +2430 -0
- package/dist/interactives.d.ts +2430 -0
- package/dist/interactives.js +5723 -0
- package/dist/interactives.mjs +4333 -0
- package/dist/juice-CoHxlpKA.d.ts +42 -0
- package/dist/juice-DQztFS43.d.mts +42 -0
- package/dist/launch-T2f4_Di4.d.mts +151 -0
- package/dist/launch-d6oreMzR.d.ts +151 -0
- package/dist/library-DXYaMFhi.d.mts +69 -0
- package/dist/library-DXYaMFhi.d.ts +69 -0
- package/dist/link-BUTqGmyi.d.mts +38 -0
- package/dist/link-BUTqGmyi.d.ts +38 -0
- package/dist/lint.js +104 -204
- package/dist/lint.mjs +103 -203
- package/dist/local-D8_I6UeL.d.mts +6967 -0
- package/dist/local-VZkqsCzR.d.ts +6967 -0
- package/dist/lockstep-BLf6dglI.d.mts +321 -0
- package/dist/lockstep-D50Ia0JW.d.ts +321 -0
- package/dist/ludo-B8ClkDqr.d.ts +205 -0
- package/dist/ludo-BOuohQ-M.d.mts +205 -0
- package/dist/mock/cli.mjs +200 -56
- package/dist/mock/library.js +200 -56
- package/dist/mock/library.mjs +200 -56
- package/dist/mock/msw.js +200 -56
- package/dist/mock/msw.mjs +200 -56
- package/dist/native-BodxSh03.d.mts +16 -0
- package/dist/native-DUHMT8gA.d.ts +16 -0
- package/dist/network-ZXLD7l1b.d.mts +19 -0
- package/dist/network-ZXLD7l1b.d.ts +19 -0
- package/dist/online-XeymeM9s.d.ts +381 -0
- package/dist/online-d7W_Al9a.d.mts +381 -0
- package/dist/params-DxFb5G_U.d.mts +155 -0
- package/dist/params-DxFb5G_U.d.ts +155 -0
- package/dist/play-BRRlfLhX.d.ts +940 -0
- package/dist/play-ClrMd_e8.d.mts +940 -0
- package/dist/policy-CCw8tXLm.d.mts +3078 -0
- package/dist/policy-CMqOSQIu.d.ts +3078 -0
- package/dist/ports-B_0v_P3A.d.mts +13 -0
- package/dist/ports-CGU_3e_0.d.ts +13 -0
- package/dist/prefetch-BHnicOQj.d.ts +117 -0
- package/dist/prefetch-CBXgYacv.d.mts +117 -0
- package/dist/{price-CSztR02F.d.mts → price-BOzexBww.d.mts} +1 -1
- package/dist/{price-C_vasx9A.d.ts → price-C1h9sPxE.d.ts} +1 -1
- package/dist/protocol-C8qbpUbT.d.mts +242 -0
- package/dist/protocol-C8qbpUbT.d.ts +242 -0
- package/dist/rapier-AZHT4YI7.js +7886 -0
- package/dist/rapier-ODEPCQA6.mjs +7792 -0
- package/dist/react.d.mts +157 -15
- package/dist/react.d.ts +157 -15
- package/dist/react.js +5564 -5904
- package/dist/react.mjs +5451 -5808
- package/dist/runner-CQcLL7By.d.ts +189 -0
- package/dist/runner-D46Yj-wE.d.mts +189 -0
- package/dist/runtime-BRWfkf_q.d.mts +51 -0
- package/dist/runtime-DyuBMkKM.d.ts +51 -0
- package/dist/scheduling-D2ajXpMC.d.ts +224 -0
- package/dist/scheduling-DSRbbaZb.d.mts +224 -0
- package/dist/schema-BrWxzKp6.d.mts +63 -0
- package/dist/schema-BrWxzKp6.d.ts +63 -0
- package/dist/server/evict.js +34 -37
- package/dist/server/evict.mjs +34 -37
- package/dist/server/tanstack.d.mts +49 -3
- package/dist/server/tanstack.d.ts +49 -3
- package/dist/server/tanstack.js +169 -117
- package/dist/server/tanstack.mjs +166 -118
- package/dist/{server-Dckg4Vdr.d.ts → server-D29IIuDV.d.ts} +136 -130
- package/dist/{server-B6dW7-Lj.d.mts → server-DQMWPnc8.d.mts} +136 -130
- package/dist/server.d.mts +45 -5
- package/dist/server.d.ts +45 -5
- package/dist/server.js +171 -227
- package/dist/server.mjs +165 -225
- package/dist/session-grant-CJ27DwrT.d.mts +19 -0
- package/dist/session-grant-CJ27DwrT.d.ts +19 -0
- package/dist/shootout-BJZeX6FG.d.ts +140 -0
- package/dist/shootout-tcZd1Rxt.d.mts +140 -0
- package/dist/state-replica-stMtdkVD.d.mts +42 -0
- package/dist/state-replica-stMtdkVD.d.ts +42 -0
- package/dist/studio-CowqWqez.d.mts +14 -0
- package/dist/studio-CowqWqez.d.ts +14 -0
- package/dist/styles.css +1 -1
- package/dist/template-AhCdB1kW.d.mts +190 -0
- package/dist/template-BkEGVTQj.d.ts +190 -0
- package/dist/terrain-BMxEc6Oc.d.ts +429 -0
- package/dist/terrain-C-XC1Oui.d.mts +429 -0
- package/dist/testing/msw.d.mts +28 -4
- package/dist/testing/msw.d.ts +28 -4
- package/dist/testing/msw.js +15 -21
- package/dist/testing/msw.mjs +15 -21
- package/dist/testing/suite.d.mts +6 -5
- package/dist/testing/suite.d.ts +6 -5
- package/dist/testing/suite.js +89 -124
- package/dist/testing/suite.mjs +81 -116
- package/dist/testing.d.mts +27 -1227
- package/dist/testing.d.ts +27 -1227
- package/dist/testing.js +127 -131
- package/dist/testing.mjs +19 -23
- package/dist/tick-transport-C8QEh8Uw.d.mts +50 -0
- package/dist/tick-transport-UjHY3xK1.d.ts +50 -0
- package/dist/timeline-protocol-hp6e8zFB.d.mts +47 -0
- package/dist/timeline-protocol-hp6e8zFB.d.ts +47 -0
- package/dist/tokens-DhanQRQS.d.mts +21 -0
- package/dist/tokens-K8yxwd6G.d.ts +21 -0
- package/dist/tree-C-Io2Hbx.d.mts +35 -0
- package/dist/tree-CP_qSW4H.d.ts +35 -0
- package/dist/tycoon-B5KHk2Xx.d.mts +255 -0
- package/dist/tycoon-hmHo-3HX.d.ts +255 -0
- package/dist/types-BQkxPwZP.d.mts +219 -0
- package/dist/types-D_f6UUxM.d.ts +219 -0
- package/dist/ui-DwHicuFv.d.mts +563 -0
- package/dist/ui-hi7S2YcH.d.ts +563 -0
- package/dist/{sign-in-DQlIdqsi.d.mts → url-52ndUruG.d.mts} +15 -1
- package/dist/{sign-in-DQlIdqsi.d.ts → url-52ndUruG.d.ts} +15 -1
- package/dist/utils.d.mts +3 -3
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +37 -37
- package/dist/utils.mjs +4 -4
- package/dist/vars-Dc_PrhBK.d.mts +511 -0
- package/dist/vars-Dc_PrhBK.d.ts +511 -0
- package/dist/vm-IUARFFAI.mjs +63 -0
- package/dist/vm-N7L6MGGH.js +65 -0
- package/dist/weave-delivery-CW-Kstut.d.mts +360 -0
- package/dist/weave-delivery-CW-Kstut.d.ts +360 -0
- package/dist/web-Dss74a7v.d.ts +883 -0
- package/dist/web-f9ZQPoyw.d.mts +883 -0
- package/dist/web-transport-C7MkBL0a.d.ts +19 -0
- package/dist/web-transport-aYEqXMd9.d.mts +19 -0
- package/dist/weight-CPGjsgjV.d.ts +92 -0
- package/dist/weight-tF1ODR1p.d.mts +92 -0
- package/dist/word-BcX9Jcmv.d.mts +70 -0
- package/dist/word-C7sVPLHm.d.ts +70 -0
- package/dist/world-PvILHDR1.d.ts +2285 -0
- package/dist/world-qekkXjJv.d.mts +2285 -0
- package/dist/worlds-Br2Pb0Cs.d.ts +109 -0
- package/dist/worlds-D5ydYr7d.d.mts +109 -0
- package/engines/c/cimplify.h +108 -0
- package/engines/c/cimplify.lib.js +11 -0
- package/engines/godot/addons/cimplify/cimplify.gd +97 -0
- package/engines/rust/interactives-ctx/Cargo.toml +9 -0
- package/engines/rust/interactives-ctx/src/lib.rs +189 -0
- package/package.json +189 -3
- package/vendor/rapier3d-compat/LICENSE +201 -0
- package/vendor/rapier3d-compat/PATCHES.md +61 -0
- package/dist/chunk-2P4KXFB6.js +0 -274
- package/dist/chunk-3G6RQLXK.mjs +0 -21
- package/dist/chunk-3V4DVXV3.mjs +0 -254
- package/dist/chunk-EDK3LNM6.js +0 -2436
- package/dist/chunk-F7J3HK27.js +0 -4549
- package/dist/chunk-U4MW6PYU.mjs +0 -23
- package/dist/chunk-XREIZ56K.js +0 -26
|
@@ -0,0 +1,2000 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkWOF3AD3J_js = require('./chunk-WOF3AD3J.js');
|
|
4
|
+
var chunkOMTVH334_js = require('./chunk-OMTVH334.js');
|
|
5
|
+
var chunkUCR5HRYM_js = require('./chunk-UCR5HRYM.js');
|
|
6
|
+
var sha2_js = require('@noble/hashes/sha2.js');
|
|
7
|
+
|
|
8
|
+
// src/types/observability.ts
|
|
9
|
+
var SESSION_CHANGE_SOURCE = {
|
|
10
|
+
RESPONSE: "response",
|
|
11
|
+
MANUAL: "manual",
|
|
12
|
+
CLEAR: "clear"
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// src/utils/purchase-intent-resolver.ts
|
|
16
|
+
var DEFAULT_POLL_INTERVAL_MS = 3e3, DEFAULT_MAX_POLL_ATTEMPTS = 60, DEFAULT_MAX_ACTION_STEPS = 4, DEFAULT_MAX_TERMS_REVIEW_STEPS = 4, DEFAULT_DEADLINE_MS = (3e3) * (60), TRANSIENT_RETRY_BASE_MS = 1e3, TRANSIENT_RETRY_MAX_MS = 8e3, HTTP_SERVER_ERROR_PREFIX = "HTTP_5", TRANSIENT_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
17
|
+
chunkUCR5HRYM_js.ErrorCode.NETWORK_ERROR,
|
|
18
|
+
chunkUCR5HRYM_js.ErrorCode.TIMEOUT,
|
|
19
|
+
chunkUCR5HRYM_js.ErrorCode.SERVER_ERROR
|
|
20
|
+
]), PROVIDER_OWNED_ACTIONS = /* @__PURE__ */ new Set([
|
|
21
|
+
chunkUCR5HRYM_js.PURCHASE_INTENT_CONFIRM_STATUS.REDIRECT_REQUIRED,
|
|
22
|
+
chunkUCR5HRYM_js.PURCHASE_INTENT_CONFIRM_STATUS.CARD_POPUP_REQUIRED
|
|
23
|
+
]);
|
|
24
|
+
function nonnegativeInteger(value, fallback) {
|
|
25
|
+
return value === void 0 || !Number.isFinite(value) ? fallback : Math.max(0, Math.floor(value));
|
|
26
|
+
}
|
|
27
|
+
function isTransientPurchaseIntentError(error) {
|
|
28
|
+
return error.retryable || TRANSIENT_ERROR_CODES.has(error.code) || error.code.startsWith(HTTP_SERVER_ERROR_PREFIX);
|
|
29
|
+
}
|
|
30
|
+
function transientRetryDelay(attempt) {
|
|
31
|
+
return Math.min((1e3) * 2 ** Math.max(0, attempt - 1), (8e3));
|
|
32
|
+
}
|
|
33
|
+
function abortError() {
|
|
34
|
+
let error = new Error("Purchase-intent resolution was cancelled.");
|
|
35
|
+
return error.name = "AbortError", error;
|
|
36
|
+
}
|
|
37
|
+
async function abortableWait(milliseconds, signal) {
|
|
38
|
+
if (signal?.aborted) throw abortError();
|
|
39
|
+
milliseconds <= 0 || await new Promise((resolve, reject) => {
|
|
40
|
+
let timer = setTimeout(() => {
|
|
41
|
+
signal?.removeEventListener("abort", onAbort), resolve();
|
|
42
|
+
}, milliseconds), onAbort = () => {
|
|
43
|
+
clearTimeout(timer), reject(abortError());
|
|
44
|
+
};
|
|
45
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
var PurchaseIntentResolver = class {
|
|
49
|
+
constructor(dependencies) {
|
|
50
|
+
this.confirmation = dependencies.confirmation, this.wait = dependencies.wait ?? abortableWait, this.now = dependencies.now ?? Date.now;
|
|
51
|
+
}
|
|
52
|
+
async resolve(intentId, options) {
|
|
53
|
+
let pollIntervalMs = nonnegativeInteger(
|
|
54
|
+
options.pollIntervalMs,
|
|
55
|
+
(3e3)
|
|
56
|
+
), maxPollAttempts = nonnegativeInteger(
|
|
57
|
+
options.maxPollAttempts,
|
|
58
|
+
(60)
|
|
59
|
+
), maxActionSteps = nonnegativeInteger(options.maxActionSteps, (4)), maxTermsReviewSteps = nonnegativeInteger(
|
|
60
|
+
options.maxTermsReviewSteps,
|
|
61
|
+
(4)
|
|
62
|
+
), deadline = this.now() + nonnegativeInteger(options.deadlineMs, DEFAULT_DEADLINE_MS), request = options.confirmation, pollAttempts = 0, actionSteps = 0, termsReviewSteps = 0, transientAttempts = 0, lastResponse = null, handedOverAction = null, requestOptions = { signal: options.signal, timeoutMs: options.requestTimeoutMs };
|
|
63
|
+
this.ensureActive(options.signal), this.notify(options, chunkUCR5HRYM_js.PURCHASE_INTENT_RESOLVE_STATUS.CONFIRMING);
|
|
64
|
+
let responseResult = options.initialResponse ? chunkOMTVH334_js.ok(options.initialResponse) : await this.confirmation.confirm(intentId, request, requestOptions);
|
|
65
|
+
for (; ; ) {
|
|
66
|
+
if (this.ensureActive(options.signal), !responseResult.ok) {
|
|
67
|
+
let remaining = deadline - this.now();
|
|
68
|
+
if (!isTransientPurchaseIntentError(responseResult.error) || remaining <= 0)
|
|
69
|
+
return remaining <= 0 && lastResponse?.status === chunkUCR5HRYM_js.PURCHASE_INTENT_CONFIRM_STATUS.COLLECTION_PROCESSING ? chunkOMTVH334_js.ok({ kind: chunkUCR5HRYM_js.PURCHASE_INTENT_RESOLUTION_KIND.TIMED_OUT, response: lastResponse }) : responseResult;
|
|
70
|
+
transientAttempts += 1, this.notify(options, chunkUCR5HRYM_js.PURCHASE_INTENT_RESOLVE_STATUS.RECONNECTING, lastResponse ?? void 0), await this.wait(Math.min(transientRetryDelay(transientAttempts), remaining), options.signal), responseResult = await this.confirmation.confirm(intentId, request, requestOptions);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
transientAttempts = 0;
|
|
74
|
+
let response = responseResult.value;
|
|
75
|
+
switch (lastResponse = response, response.status) {
|
|
76
|
+
case chunkUCR5HRYM_js.PURCHASE_INTENT_CONFIRM_STATUS.ORDER_CREATED:
|
|
77
|
+
return this.notify(options, chunkUCR5HRYM_js.PURCHASE_INTENT_RESOLVE_STATUS.COMPLETED, response), chunkOMTVH334_js.ok({ kind: chunkUCR5HRYM_js.PURCHASE_INTENT_RESOLUTION_KIND.COMPLETED, response });
|
|
78
|
+
case chunkUCR5HRYM_js.PURCHASE_INTENT_CONFIRM_STATUS.PAYMENT_FAILED:
|
|
79
|
+
return this.notify(options, chunkUCR5HRYM_js.PURCHASE_INTENT_RESOLVE_STATUS.FAILED, response), chunkOMTVH334_js.ok({ kind: chunkUCR5HRYM_js.PURCHASE_INTENT_RESOLUTION_KIND.FAILED, response });
|
|
80
|
+
case chunkUCR5HRYM_js.PURCHASE_INTENT_CONFIRM_STATUS.PAYMENT_OUTCOME_UNKNOWN:
|
|
81
|
+
return this.notify(options, chunkUCR5HRYM_js.PURCHASE_INTENT_RESOLVE_STATUS.OUTCOME_UNKNOWN, response), chunkOMTVH334_js.ok({ kind: chunkUCR5HRYM_js.PURCHASE_INTENT_RESOLUTION_KIND.OUTCOME_UNKNOWN, response });
|
|
82
|
+
case chunkUCR5HRYM_js.PURCHASE_INTENT_CONFIRM_STATUS.COLLECTION_PROCESSING:
|
|
83
|
+
if (pollAttempts >= maxPollAttempts)
|
|
84
|
+
return chunkOMTVH334_js.ok({ kind: chunkUCR5HRYM_js.PURCHASE_INTENT_RESOLUTION_KIND.TIMED_OUT, response });
|
|
85
|
+
pollAttempts += 1, this.notify(options, chunkUCR5HRYM_js.PURCHASE_INTENT_RESOLVE_STATUS.POLLING, response), await this.wait(pollIntervalMs, options.signal), responseResult = await this.confirmation.confirm(intentId, request, requestOptions);
|
|
86
|
+
continue;
|
|
87
|
+
case chunkUCR5HRYM_js.PURCHASE_INTENT_CONFIRM_STATUS.REDIRECT_REQUIRED:
|
|
88
|
+
case chunkUCR5HRYM_js.PURCHASE_INTENT_CONFIRM_STATUS.CARD_POPUP_REQUIRED:
|
|
89
|
+
case chunkUCR5HRYM_js.PURCHASE_INTENT_CONFIRM_STATUS.AUTHORIZATION_REQUIRED: {
|
|
90
|
+
this.notify(options, chunkUCR5HRYM_js.PURCHASE_INTENT_RESOLVE_STATUS.AWAITING_ACTION, response);
|
|
91
|
+
let actionKey = `${response.attempt_id}:${response.status}`;
|
|
92
|
+
if (actionKey === handedOverAction) {
|
|
93
|
+
if (pollAttempts >= maxPollAttempts)
|
|
94
|
+
return chunkOMTVH334_js.ok({ kind: chunkUCR5HRYM_js.PURCHASE_INTENT_RESOLUTION_KIND.ACTION_REQUIRED, response });
|
|
95
|
+
pollAttempts += 1, await this.wait(pollIntervalMs, options.signal), responseResult = await this.confirmation.confirm(intentId, request, requestOptions);
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
if (!options.onActionRequired || actionSteps >= maxActionSteps)
|
|
99
|
+
return chunkOMTVH334_js.ok({ kind: chunkUCR5HRYM_js.PURCHASE_INTENT_RESOLUTION_KIND.ACTION_REQUIRED, response });
|
|
100
|
+
actionSteps += 1;
|
|
101
|
+
let decision = await options.onActionRequired(response);
|
|
102
|
+
if (decision === chunkUCR5HRYM_js.PURCHASE_INTENT_ACTION_DECISION.STOP)
|
|
103
|
+
return chunkOMTVH334_js.ok({ kind: chunkUCR5HRYM_js.PURCHASE_INTENT_RESOLUTION_KIND.ACTION_REQUIRED, response });
|
|
104
|
+
if (typeof decision == "object" && decision.kind === chunkUCR5HRYM_js.PURCHASE_INTENT_ACTION_DECISION.SUBMIT) {
|
|
105
|
+
if (!this.confirmation.submitAction)
|
|
106
|
+
return chunkOMTVH334_js.err(
|
|
107
|
+
new chunkUCR5HRYM_js.CimplifyError(
|
|
108
|
+
chunkUCR5HRYM_js.PURCHASE_INTENT_ERROR_CODE.ACTION_UNSUPPORTED,
|
|
109
|
+
"This confirmation transport cannot submit purchase-intent actions.",
|
|
110
|
+
false
|
|
111
|
+
)
|
|
112
|
+
);
|
|
113
|
+
responseResult = await this.confirmation.submitAction(
|
|
114
|
+
intentId,
|
|
115
|
+
response.attempt_id,
|
|
116
|
+
decision.request,
|
|
117
|
+
requestOptions
|
|
118
|
+
);
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
if (decision !== chunkUCR5HRYM_js.PURCHASE_INTENT_ACTION_DECISION.CONTINUE)
|
|
122
|
+
return chunkOMTVH334_js.err(
|
|
123
|
+
new chunkUCR5HRYM_js.CimplifyError(
|
|
124
|
+
chunkUCR5HRYM_js.PURCHASE_INTENT_ERROR_CODE.ACTION_UNSUPPORTED,
|
|
125
|
+
"The action callback returned an unsupported decision.",
|
|
126
|
+
false
|
|
127
|
+
)
|
|
128
|
+
);
|
|
129
|
+
PROVIDER_OWNED_ACTIONS.has(response.status) && (handedOverAction = actionKey), await this.wait(pollIntervalMs, options.signal), responseResult = await this.confirmation.confirm(intentId, request, requestOptions);
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
case chunkUCR5HRYM_js.PURCHASE_INTENT_CONFIRM_STATUS.TERMS_CHANGED: {
|
|
133
|
+
if (this.notify(options, chunkUCR5HRYM_js.PURCHASE_INTENT_RESOLVE_STATUS.REVIEWING_TERMS, response), !options.onTermsChanged || termsReviewSteps >= maxTermsReviewSteps)
|
|
134
|
+
return chunkOMTVH334_js.ok({ kind: chunkUCR5HRYM_js.PURCHASE_INTENT_RESOLUTION_KIND.REVIEW_REQUIRED, response });
|
|
135
|
+
termsReviewSteps += 1;
|
|
136
|
+
let replacementRequest = await options.onTermsChanged(response);
|
|
137
|
+
if (!replacementRequest)
|
|
138
|
+
return chunkOMTVH334_js.ok({ kind: chunkUCR5HRYM_js.PURCHASE_INTENT_RESOLUTION_KIND.REVIEW_REQUIRED, response });
|
|
139
|
+
request = replacementRequest, responseResult = await this.confirmation.confirm(intentId, request, requestOptions);
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
case chunkUCR5HRYM_js.PURCHASE_INTENT_CONFIRM_STATUS.SELECTION_UNAVAILABLE:
|
|
143
|
+
case chunkUCR5HRYM_js.PURCHASE_INTENT_CONFIRM_STATUS.OFFER_ENDED:
|
|
144
|
+
case chunkUCR5HRYM_js.PURCHASE_INTENT_CONFIRM_STATUS.SOURCE_UNAVAILABLE:
|
|
145
|
+
return chunkOMTVH334_js.ok({ kind: chunkUCR5HRYM_js.PURCHASE_INTENT_RESOLUTION_KIND.REVIEW_REQUIRED, response });
|
|
146
|
+
default:
|
|
147
|
+
return chunkOMTVH334_js.err(
|
|
148
|
+
new chunkUCR5HRYM_js.CimplifyError(
|
|
149
|
+
chunkUCR5HRYM_js.PURCHASE_INTENT_ERROR_CODE.ACTION_UNSUPPORTED,
|
|
150
|
+
"The payment returned a status this checkout does not understand.",
|
|
151
|
+
false
|
|
152
|
+
)
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
ensureActive(signal) {
|
|
158
|
+
if (signal?.aborted) throw abortError();
|
|
159
|
+
}
|
|
160
|
+
notify(options, status, response) {
|
|
161
|
+
try {
|
|
162
|
+
options.onStatusChange?.(status, response);
|
|
163
|
+
} catch {
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// src/purchase-intent.ts
|
|
169
|
+
var PURCHASE_INTENT_ROUTE = {
|
|
170
|
+
DIRECT_COLLECTION: "/api/v1/purchase-intents",
|
|
171
|
+
HOSTED_SESSION_COLLECTION: "/v1/checkout/sessions",
|
|
172
|
+
PREPARE: "prepare",
|
|
173
|
+
REFRESH: "refresh",
|
|
174
|
+
CONFIRM: "confirm",
|
|
175
|
+
REPLAY: "replay",
|
|
176
|
+
ATTEMPTS: "attempts",
|
|
177
|
+
ACTIONS: "actions"
|
|
178
|
+
};
|
|
179
|
+
function directIntentPath(intentId) {
|
|
180
|
+
let normalized = intentId.trim();
|
|
181
|
+
if (!normalized) throw new TypeError("intentId must not be empty");
|
|
182
|
+
return `${PURCHASE_INTENT_ROUTE.DIRECT_COLLECTION}/${encodeURIComponent(normalized)}`;
|
|
183
|
+
}
|
|
184
|
+
function hostedSessionPath(sessionId) {
|
|
185
|
+
let normalized = sessionId.trim();
|
|
186
|
+
if (!normalized) throw new TypeError("sessionId must not be empty");
|
|
187
|
+
return `${PURCHASE_INTENT_ROUTE.HOSTED_SESSION_COLLECTION}/${encodeURIComponent(normalized)}`;
|
|
188
|
+
}
|
|
189
|
+
var PurchaseIntentService = class {
|
|
190
|
+
constructor(transport) {
|
|
191
|
+
this.transport = transport;
|
|
192
|
+
this.resolver = new PurchaseIntentResolver({ confirmation: this });
|
|
193
|
+
}
|
|
194
|
+
mint(request, options) {
|
|
195
|
+
return chunkOMTVH334_js.safe(
|
|
196
|
+
this.transport.post(PURCHASE_INTENT_ROUTE.DIRECT_COLLECTION, request, {
|
|
197
|
+
idempotencyKey: request.client_intent_key,
|
|
198
|
+
signal: options?.signal,
|
|
199
|
+
timeoutMs: options?.timeoutMs
|
|
200
|
+
})
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
get(intentId, options) {
|
|
204
|
+
return chunkOMTVH334_js.safe(
|
|
205
|
+
this.transport.get(this.intentPath(intentId), {
|
|
206
|
+
signal: options?.signal,
|
|
207
|
+
timeoutMs: options?.timeoutMs
|
|
208
|
+
})
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
refresh(intentId, expectedRevision, options) {
|
|
212
|
+
let request = {
|
|
213
|
+
expected_intent_revision: expectedRevision
|
|
214
|
+
};
|
|
215
|
+
return chunkOMTVH334_js.safe(
|
|
216
|
+
this.transport.post(
|
|
217
|
+
`${this.intentPath(intentId)}/${PURCHASE_INTENT_ROUTE.REFRESH}`,
|
|
218
|
+
request,
|
|
219
|
+
{
|
|
220
|
+
signal: options?.signal,
|
|
221
|
+
timeoutMs: options?.timeoutMs
|
|
222
|
+
}
|
|
223
|
+
)
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
confirm(intentId, request, options) {
|
|
227
|
+
return chunkOMTVH334_js.safe(
|
|
228
|
+
this.transport.post(
|
|
229
|
+
`${this.intentPath(intentId)}/${PURCHASE_INTENT_ROUTE.CONFIRM}`,
|
|
230
|
+
request,
|
|
231
|
+
{
|
|
232
|
+
idempotencyKey: request.idempotency_key,
|
|
233
|
+
signal: options?.signal,
|
|
234
|
+
timeoutMs: options?.timeoutMs
|
|
235
|
+
}
|
|
236
|
+
)
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
submitAction(intentId, attemptId, request, options) {
|
|
240
|
+
let normalizedAttemptId = attemptId.trim();
|
|
241
|
+
if (!normalizedAttemptId) throw new TypeError("attemptId must not be empty");
|
|
242
|
+
return chunkOMTVH334_js.safe(
|
|
243
|
+
this.transport.post(
|
|
244
|
+
`${this.intentPath(intentId)}/${PURCHASE_INTENT_ROUTE.ATTEMPTS}/${encodeURIComponent(normalizedAttemptId)}/${PURCHASE_INTENT_ROUTE.ACTIONS}`,
|
|
245
|
+
request,
|
|
246
|
+
{
|
|
247
|
+
signal: options?.signal,
|
|
248
|
+
timeoutMs: options?.timeoutMs
|
|
249
|
+
}
|
|
250
|
+
)
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
resolve(intentId, options) {
|
|
254
|
+
return this.resolver.resolve(intentId, options);
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Bind subsequent preparation/confirmation to one hosted checkout-session
|
|
258
|
+
* owner. The session ID is a route authority, not an intent-owner rewrite.
|
|
259
|
+
*/
|
|
260
|
+
forHostedSession(sessionId) {
|
|
261
|
+
return new HostedPurchaseIntentService(this.transport, sessionId);
|
|
262
|
+
}
|
|
263
|
+
intentPath(intentId) {
|
|
264
|
+
return directIntentPath(intentId);
|
|
265
|
+
}
|
|
266
|
+
}, HostedPurchaseIntentService = class {
|
|
267
|
+
constructor(transport, sessionId) {
|
|
268
|
+
this.transport = transport;
|
|
269
|
+
this.sessionPath = hostedSessionPath(sessionId), this.resolver = new PurchaseIntentResolver({ confirmation: this });
|
|
270
|
+
}
|
|
271
|
+
prepare(request, options) {
|
|
272
|
+
return chunkOMTVH334_js.safe(
|
|
273
|
+
this.transport.post(
|
|
274
|
+
`${this.sessionPath}/${PURCHASE_INTENT_ROUTE.PREPARE}`,
|
|
275
|
+
request,
|
|
276
|
+
{
|
|
277
|
+
idempotencyKey: request.idempotency_key,
|
|
278
|
+
signal: options?.signal,
|
|
279
|
+
timeoutMs: options?.timeoutMs
|
|
280
|
+
}
|
|
281
|
+
)
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
confirm(_intentId, request, options) {
|
|
285
|
+
return chunkOMTVH334_js.safe(
|
|
286
|
+
this.transport.post(
|
|
287
|
+
`${this.sessionPath}/${PURCHASE_INTENT_ROUTE.CONFIRM}`,
|
|
288
|
+
request,
|
|
289
|
+
{
|
|
290
|
+
idempotencyKey: request.idempotency_key,
|
|
291
|
+
signal: options?.signal,
|
|
292
|
+
timeoutMs: options?.timeoutMs
|
|
293
|
+
}
|
|
294
|
+
)
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
replay(options) {
|
|
298
|
+
return chunkOMTVH334_js.safe(
|
|
299
|
+
this.transport.get(
|
|
300
|
+
`${this.sessionPath}/${PURCHASE_INTENT_ROUTE.REPLAY}`,
|
|
301
|
+
{
|
|
302
|
+
signal: options?.signal,
|
|
303
|
+
timeoutMs: options?.timeoutMs
|
|
304
|
+
}
|
|
305
|
+
)
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
submitAction(_intentId, attemptId, request, options) {
|
|
309
|
+
let normalized = attemptId.trim();
|
|
310
|
+
if (!normalized) throw new TypeError("attemptId must not be empty");
|
|
311
|
+
return chunkOMTVH334_js.safe(
|
|
312
|
+
this.transport.post(
|
|
313
|
+
`${this.sessionPath}/${PURCHASE_INTENT_ROUTE.ATTEMPTS}/${encodeURIComponent(normalized)}/${PURCHASE_INTENT_ROUTE.ACTIONS}`,
|
|
314
|
+
request,
|
|
315
|
+
{
|
|
316
|
+
signal: options?.signal,
|
|
317
|
+
timeoutMs: options?.timeoutMs
|
|
318
|
+
}
|
|
319
|
+
)
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
resolve(intentId, options) {
|
|
323
|
+
return this.resolver.resolve(intentId, options);
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
// src/store-credit.ts
|
|
328
|
+
var StoreCreditQueries = class {
|
|
329
|
+
constructor(client) {
|
|
330
|
+
this.client = client;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* The shopper's available store-credit balance, in the business's default
|
|
334
|
+
* currency. Requires a signed-in customer; returns an error otherwise.
|
|
335
|
+
*/
|
|
336
|
+
async balance() {
|
|
337
|
+
return chunkOMTVH334_js.safe(this.client.get("/api/v1/store-credit/balance"));
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
// src/internal/analytics-session.ts
|
|
342
|
+
var ANALYTICS_SESSION_STORAGE_KEY_PREFIX = "cimplify_analytics_session:v2:";
|
|
343
|
+
var AnalyticsSessionCoordinator = class {
|
|
344
|
+
constructor(identity) {
|
|
345
|
+
this.identity = identity;
|
|
346
|
+
this.fallbackState = null;
|
|
347
|
+
}
|
|
348
|
+
beginEvent(nowMs = Date.now()) {
|
|
349
|
+
let state = this.resolveActiveState(nowMs);
|
|
350
|
+
state.lastActivityAtMs = nowMs;
|
|
351
|
+
let occurredAt = reserveOccurredAt(state, nowMs, 1);
|
|
352
|
+
return this.write(state), toEventContext(state, occurredAt);
|
|
353
|
+
}
|
|
354
|
+
beginPage(path, nowMs = Date.now()) {
|
|
355
|
+
let existing = this.read(), expired = !existing || isExpired(existing, nowMs), state = expired ? newSession(nowMs) : existing, previousPage = expired ? void 0 : durationFor(state.activePage, nowMs);
|
|
356
|
+
state.lastActivityAtMs = nowMs, state.activePage = { path, enteredAtMs: nowMs };
|
|
357
|
+
let occurredAt = reserveOccurredAt(state, nowMs, previousPage ? 2 : 1);
|
|
358
|
+
return this.write(state), {
|
|
359
|
+
session: toEventContext(state, occurredAt),
|
|
360
|
+
previousPage
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
current() {
|
|
364
|
+
let state = this.read();
|
|
365
|
+
return !state || isExpired(state, Date.now()) ? null : toContext(state);
|
|
366
|
+
}
|
|
367
|
+
markBootstrapped(sessionId) {
|
|
368
|
+
let state = this.read();
|
|
369
|
+
!state || state.id !== sessionId || (state.bootstrapped = true, this.write(state));
|
|
370
|
+
}
|
|
371
|
+
reset() {
|
|
372
|
+
this.fallbackState = null;
|
|
373
|
+
try {
|
|
374
|
+
sessionStorage.removeItem(this.storageKey());
|
|
375
|
+
} catch {
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
resolveActiveState(nowMs) {
|
|
379
|
+
let state = this.read();
|
|
380
|
+
return !state || isExpired(state, nowMs) ? newSession(nowMs) : state;
|
|
381
|
+
}
|
|
382
|
+
read() {
|
|
383
|
+
try {
|
|
384
|
+
let serialized = sessionStorage.getItem(this.storageKey());
|
|
385
|
+
if (!serialized) return this.fallbackState;
|
|
386
|
+
let state = JSON.parse(serialized);
|
|
387
|
+
return isPersistedSession(state) ? (this.fallbackState = state, state) : (sessionStorage.removeItem(this.storageKey()), this.fallbackState);
|
|
388
|
+
} catch {
|
|
389
|
+
return this.fallbackState;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
write(state) {
|
|
393
|
+
this.fallbackState = state;
|
|
394
|
+
try {
|
|
395
|
+
sessionStorage.setItem(this.storageKey(), JSON.stringify(state));
|
|
396
|
+
} catch {
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
storageKey() {
|
|
400
|
+
return `${ANALYTICS_SESSION_STORAGE_KEY_PREFIX}${encodeURIComponent(this.identity)}`;
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
function newSession(nowMs) {
|
|
404
|
+
return {
|
|
405
|
+
version: 2,
|
|
406
|
+
id: generateSessionId(),
|
|
407
|
+
startedAtMs: nowMs,
|
|
408
|
+
lastActivityAtMs: nowMs,
|
|
409
|
+
bootstrapped: false
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
function toContext(state) {
|
|
413
|
+
return {
|
|
414
|
+
id: state.id,
|
|
415
|
+
startedAt: new Date(state.startedAtMs).toISOString(),
|
|
416
|
+
requiresBootstrap: !state.bootstrapped
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
function toEventContext(state, occurredAtMicros) {
|
|
420
|
+
return {
|
|
421
|
+
...toContext(state),
|
|
422
|
+
occurredAt: formatEpochMicros(occurredAtMicros)
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
function reserveOccurredAt(state, nowMs, eventCount) {
|
|
426
|
+
let wallClockMicros = Math.trunc(nowMs) * 1e3, occurredAtMicros = Math.max(
|
|
427
|
+
wallClockMicros,
|
|
428
|
+
(state.lastOccurredAtMicros ?? wallClockMicros - 1) + 1
|
|
429
|
+
);
|
|
430
|
+
return state.lastOccurredAtMicros = occurredAtMicros + eventCount - 1, occurredAtMicros;
|
|
431
|
+
}
|
|
432
|
+
function formatEpochMicros(epochMicros) {
|
|
433
|
+
let epochMillis = Math.floor(epochMicros / 1e3), microsWithinSecond = epochMicros % 1e6;
|
|
434
|
+
return `${new Date(epochMillis).toISOString().slice(0, -5)}.${String(microsWithinSecond).padStart(6, "0")}Z`;
|
|
435
|
+
}
|
|
436
|
+
function durationFor(activePage, nowMs) {
|
|
437
|
+
if (!(!activePage || nowMs < activePage.enteredAtMs))
|
|
438
|
+
return {
|
|
439
|
+
path: activePage.path,
|
|
440
|
+
timeOnPageSeconds: Math.floor((nowMs - activePage.enteredAtMs) / 1e3)
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
function isExpired(state, nowMs) {
|
|
444
|
+
return nowMs - state.lastActivityAtMs >= 18e5;
|
|
445
|
+
}
|
|
446
|
+
function isPersistedSession(value) {
|
|
447
|
+
if (!value || typeof value != "object") return false;
|
|
448
|
+
let state = value;
|
|
449
|
+
return state.version === 2 && typeof state.id == "string" && state.id.length > 0 && typeof state.startedAtMs == "number" && Number.isFinite(state.startedAtMs) && typeof state.lastActivityAtMs == "number" && Number.isFinite(state.lastActivityAtMs) && (state.lastOccurredAtMicros === void 0 || typeof state.lastOccurredAtMicros == "number" && Number.isSafeInteger(state.lastOccurredAtMicros)) && typeof state.bootstrapped == "boolean" && (!state.activePage || typeof state.activePage.path == "string" && typeof state.activePage.enteredAtMs == "number" && Number.isFinite(state.activePage.enteredAtMs));
|
|
450
|
+
}
|
|
451
|
+
function generateSessionId() {
|
|
452
|
+
return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (character) => {
|
|
453
|
+
let random = Math.random() * 16 | 0;
|
|
454
|
+
return (character === "x" ? random : random & 3 | 8).toString(16);
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// src/activity.ts
|
|
459
|
+
var VISITOR_ID_STORAGE_KEY = "cimplify_visitor_id", ACTIVITY_RETRY_POLICY = {
|
|
460
|
+
maxRetries: 1,
|
|
461
|
+
jitterRatio: 0.2
|
|
462
|
+
}, PAGE_VIEW_TRACKER_KEY = /* @__PURE__ */ Symbol.for("@cimplify/sdk.page-view-tracker-hub"), PAGE_VIEW_TRACKER_VERSION = 2;
|
|
463
|
+
function trackerHost() {
|
|
464
|
+
return window;
|
|
465
|
+
}
|
|
466
|
+
function currentWindowTrackerHub() {
|
|
467
|
+
let candidate = trackerHost()[PAGE_VIEW_TRACKER_KEY];
|
|
468
|
+
return candidate?.version === (2) && candidate.registrations instanceof Map && typeof candidate.recordAll == "function" ? candidate : null;
|
|
469
|
+
}
|
|
470
|
+
function weakReference(target) {
|
|
471
|
+
let WeakReference = globalThis.WeakRef;
|
|
472
|
+
return WeakReference ? new WeakReference(target) : { deref: () => target };
|
|
473
|
+
}
|
|
474
|
+
function latestLiveOwner(registration) {
|
|
475
|
+
let latest = null;
|
|
476
|
+
for (let [token, reference] of registration.owners) {
|
|
477
|
+
let owner = reference.deref();
|
|
478
|
+
!owner || owner.released ? registration.owners.delete(token) : latest = owner;
|
|
479
|
+
}
|
|
480
|
+
return latest;
|
|
481
|
+
}
|
|
482
|
+
function recordRegistration(registration, path) {
|
|
483
|
+
if (path === registration.lastPath) return;
|
|
484
|
+
let owner = registration.activeOwner && !registration.activeOwner.released ? registration.activeOwner : latestLiveOwner(registration);
|
|
485
|
+
owner && (registration.activeOwner = owner, registration.lastPath = path, owner.recorder(path));
|
|
486
|
+
}
|
|
487
|
+
function createWindowTrackerHub() {
|
|
488
|
+
let originalPushState = window.history.pushState, originalReplaceState = window.history.replaceState, hub = {
|
|
489
|
+
version: (2),
|
|
490
|
+
registrations: /* @__PURE__ */ new Map(),
|
|
491
|
+
originalPushState,
|
|
492
|
+
originalReplaceState
|
|
493
|
+
};
|
|
494
|
+
return hub.recordAll = () => {
|
|
495
|
+
let path = window.location.pathname;
|
|
496
|
+
for (let registration of hub.registrations.values())
|
|
497
|
+
recordRegistration(registration, path);
|
|
498
|
+
}, hub.patchedPushState = function(...args) {
|
|
499
|
+
originalPushState.apply(this, args), hub.recordAll();
|
|
500
|
+
}, hub.patchedReplaceState = function(...args) {
|
|
501
|
+
originalReplaceState.apply(this, args), hub.recordAll();
|
|
502
|
+
}, hub.popstateListener = () => hub.recordAll(), window.history.pushState = hub.patchedPushState, window.history.replaceState = hub.patchedReplaceState, window.addEventListener("popstate", hub.popstateListener), trackerHost()[PAGE_VIEW_TRACKER_KEY] = hub, hub;
|
|
503
|
+
}
|
|
504
|
+
function pageViewTrackerIdentity(client) {
|
|
505
|
+
return JSON.stringify([client.getBaseUrl(), client.getPublicKey().trim()]);
|
|
506
|
+
}
|
|
507
|
+
function acquireWindowPageViewTracker(identity, recorder) {
|
|
508
|
+
let hub = currentWindowTrackerHub() ?? createWindowTrackerHub(), registration = hub.registrations.get(identity), isNewIdentity = !registration;
|
|
509
|
+
registration || (registration = { owners: /* @__PURE__ */ new Map(), activeOwner: null, lastPath: null }, hub.registrations.set(identity, registration));
|
|
510
|
+
let owner = {
|
|
511
|
+
token: Symbol(identity),
|
|
512
|
+
recorder,
|
|
513
|
+
released: false
|
|
514
|
+
};
|
|
515
|
+
registration.owners.set(owner.token, weakReference(owner)), registration.activeOwner = owner, isNewIdentity && recordRegistration(registration, window.location.pathname);
|
|
516
|
+
let released = false;
|
|
517
|
+
return () => {
|
|
518
|
+
released || (released = true, owner.released = true, registration.owners.delete(owner.token), registration.activeOwner === owner && (registration.activeOwner = latestLiveOwner(registration)), !registration.activeOwner && (hub.registrations.get(identity) === registration && hub.registrations.delete(identity), hub.registrations.size === 0 && (window.removeEventListener("popstate", hub.popstateListener), window.history.pushState === hub.patchedPushState && (window.history.pushState = hub.originalPushState), window.history.replaceState === hub.patchedReplaceState && (window.history.replaceState = hub.originalReplaceState), currentWindowTrackerHub() === hub && delete trackerHost()[PAGE_VIEW_TRACKER_KEY])));
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
var ActivityService = class {
|
|
522
|
+
constructor(client) {
|
|
523
|
+
this.client = client;
|
|
524
|
+
this.localGeneration = 0;
|
|
525
|
+
this.bootstrapRequest = null;
|
|
526
|
+
this.sessions = this.createSessionCoordinator();
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Record session start (landing, referrer, UTM, device). Fire-and-forget,
|
|
530
|
+
* at most once per 30-minute-idle analytics session; called automatically
|
|
531
|
+
* by the track* methods.
|
|
532
|
+
*/
|
|
533
|
+
startSession() {
|
|
534
|
+
if (typeof window > "u") return;
|
|
535
|
+
let session = this.sessions.beginEvent();
|
|
536
|
+
this.bootstrapSession(session, false, this.captureGeneration()).catch(() => {
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
/** Rebind an existing analytics session after the server authenticates a customer. */
|
|
540
|
+
refreshIdentity() {
|
|
541
|
+
if (typeof window > "u") return;
|
|
542
|
+
let session = this.sessions.current();
|
|
543
|
+
session && this.bootstrapSession(session, true, this.captureGeneration()).catch(() => {
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
/** A signed-out browser starts a fresh anonymous analytics session. */
|
|
547
|
+
resetSession() {
|
|
548
|
+
this.invalidatePendingActivity(), this.sessions.reset();
|
|
549
|
+
}
|
|
550
|
+
/** Drop the old storefront's analytics state before binding this service to the new one. */
|
|
551
|
+
resetForStorefrontIdentityChange() {
|
|
552
|
+
this.invalidatePendingActivity(), this.sessions.reset(), this.sessions = this.createSessionCoordinator();
|
|
553
|
+
}
|
|
554
|
+
buildSessionPayload(session) {
|
|
555
|
+
let params = new URLSearchParams(window.location.search), utm = (key) => params.get(`utm_${key}`) || void 0, { visitorId, isNewVisitor } = resolveVisitor(), timezone;
|
|
556
|
+
try {
|
|
557
|
+
timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
558
|
+
} catch {
|
|
559
|
+
}
|
|
560
|
+
return {
|
|
561
|
+
analytics_session_id: session.id,
|
|
562
|
+
started_at: session.startedAt,
|
|
563
|
+
landing_page: window.location.pathname,
|
|
564
|
+
landing_url: window.location.href,
|
|
565
|
+
referrer_url: document.referrer || void 0,
|
|
566
|
+
utm_source: utm("source"),
|
|
567
|
+
utm_medium: utm("medium"),
|
|
568
|
+
utm_campaign: utm("campaign"),
|
|
569
|
+
utm_term: utm("term"),
|
|
570
|
+
utm_content: utm("content"),
|
|
571
|
+
social_commerce_ref: params.get("social_commerce_ref") || void 0,
|
|
572
|
+
screen_width: window.screen?.width,
|
|
573
|
+
screen_height: window.screen?.height,
|
|
574
|
+
viewport_width: window.innerWidth,
|
|
575
|
+
viewport_height: window.innerHeight,
|
|
576
|
+
pixel_density: window.devicePixelRatio,
|
|
577
|
+
language: navigator.language,
|
|
578
|
+
timezone,
|
|
579
|
+
fingerprint: visitorId,
|
|
580
|
+
is_new_visitor: isNewVisitor
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
/** Route-level page view. Product/category interactions are tracked separately. */
|
|
584
|
+
trackPageView(options = {}) {
|
|
585
|
+
if (typeof window > "u") return;
|
|
586
|
+
let pagePath = options.pagePath ?? currentPath() ?? "", transition = this.sessions.beginPage(pagePath), events = [];
|
|
587
|
+
transition.previousPage && events.push({
|
|
588
|
+
type: "page_duration",
|
|
589
|
+
page_path: transition.previousPage.path,
|
|
590
|
+
time_on_page: transition.previousPage.timeOnPageSeconds
|
|
591
|
+
}), events.push({
|
|
592
|
+
type: "page_view",
|
|
593
|
+
page_path: pagePath,
|
|
594
|
+
page_title: options.pageTitle ?? currentTitle()
|
|
595
|
+
}), this.sendEvents(events, transition.session);
|
|
596
|
+
}
|
|
597
|
+
trackProductView(productId, options = {}) {
|
|
598
|
+
if (typeof window > "u") return;
|
|
599
|
+
let event = {
|
|
600
|
+
type: "product_view",
|
|
601
|
+
product_id: productId,
|
|
602
|
+
product_name: options.productName,
|
|
603
|
+
category_id: options.categoryId,
|
|
604
|
+
price: options.price,
|
|
605
|
+
page_path: options.pagePath ?? currentPath()
|
|
606
|
+
};
|
|
607
|
+
this.sendEvents([event]);
|
|
608
|
+
}
|
|
609
|
+
trackCategoryView(categoryId, options = {}) {
|
|
610
|
+
if (typeof window > "u") return;
|
|
611
|
+
let event = {
|
|
612
|
+
type: "category_view",
|
|
613
|
+
category_id: categoryId,
|
|
614
|
+
category_name: options.categoryName,
|
|
615
|
+
page_path: options.pagePath ?? currentPath()
|
|
616
|
+
};
|
|
617
|
+
this.sendEvents([event]);
|
|
618
|
+
}
|
|
619
|
+
async getState() {
|
|
620
|
+
return chunkOMTVH334_js.safe(this.client.get("/api/v1/activity/state"));
|
|
621
|
+
}
|
|
622
|
+
async getRecommendations(options) {
|
|
623
|
+
let params = new URLSearchParams();
|
|
624
|
+
options?.location_id && params.set("location_id", options.location_id), options?.limit && params.set("limit", String(options.limit));
|
|
625
|
+
let query = params.toString(), path = query ? `/api/v1/activity/recommendations?${query}` : "/api/v1/activity/recommendations";
|
|
626
|
+
return chunkOMTVH334_js.safe(this.client.get(path));
|
|
627
|
+
}
|
|
628
|
+
async dismissMessage(code) {
|
|
629
|
+
return chunkOMTVH334_js.safe(
|
|
630
|
+
this.client.post("/api/v1/activity/messages/dismiss", { code })
|
|
631
|
+
);
|
|
632
|
+
}
|
|
633
|
+
/** Records a page view now and on every route change; returns a stop fn. */
|
|
634
|
+
autoTrackPageViews() {
|
|
635
|
+
return typeof window > "u" ? () => {
|
|
636
|
+
} : acquireWindowPageViewTracker(pageViewTrackerIdentity(this.client), (path) => {
|
|
637
|
+
try {
|
|
638
|
+
this.trackPageView({ pagePath: path });
|
|
639
|
+
} catch {
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
sendEvents(events, session) {
|
|
644
|
+
typeof window > "u" || this.postEvents(events, session ?? this.sessions.beginEvent()).catch(() => {
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
hasStorefrontIdentity() {
|
|
648
|
+
return this.client.getPublicKey().trim().length > 0;
|
|
649
|
+
}
|
|
650
|
+
async postEvents(events, session) {
|
|
651
|
+
if (!this.hasStorefrontIdentity()) return;
|
|
652
|
+
let generation = this.captureGeneration();
|
|
653
|
+
await this.bootstrapSession(session, false, generation), this.isCurrentGeneration(generation) && await this.client.post(
|
|
654
|
+
"/api/v1/activity/events",
|
|
655
|
+
{
|
|
656
|
+
analytics_session_id: session.id,
|
|
657
|
+
occurred_at: session.occurredAt,
|
|
658
|
+
events
|
|
659
|
+
},
|
|
660
|
+
{ retryPolicy: ACTIVITY_RETRY_POLICY }
|
|
661
|
+
);
|
|
662
|
+
}
|
|
663
|
+
bootstrapSession(session, force = false, generation = this.captureGeneration()) {
|
|
664
|
+
if (!this.hasStorefrontIdentity() || !force && !session.requiresBootstrap) return Promise.resolve();
|
|
665
|
+
if (!force && this.bootstrapRequest?.sessionId === session.id && sameActivityGeneration(this.bootstrapRequest.generation, generation))
|
|
666
|
+
return this.bootstrapRequest.promise;
|
|
667
|
+
let promise = this.client.post("/api/v1/activity/session", this.buildSessionPayload(session), {
|
|
668
|
+
retryPolicy: ACTIVITY_RETRY_POLICY
|
|
669
|
+
}).then(() => {
|
|
670
|
+
this.isCurrentGeneration(generation) && this.sessions.markBootstrapped(session.id);
|
|
671
|
+
}).finally(() => {
|
|
672
|
+
this.bootstrapRequest?.promise === promise && (this.bootstrapRequest = null);
|
|
673
|
+
});
|
|
674
|
+
return this.bootstrapRequest = { sessionId: session.id, generation, promise }, promise;
|
|
675
|
+
}
|
|
676
|
+
captureGeneration() {
|
|
677
|
+
return {
|
|
678
|
+
local: this.localGeneration,
|
|
679
|
+
publicKey: this.client.getPublicKeyEpoch(),
|
|
680
|
+
session: this.client.getSessionEpoch()
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
isCurrentGeneration(generation) {
|
|
684
|
+
return sameActivityGeneration(generation, this.captureGeneration());
|
|
685
|
+
}
|
|
686
|
+
invalidatePendingActivity() {
|
|
687
|
+
this.localGeneration += 1, this.bootstrapRequest = null;
|
|
688
|
+
}
|
|
689
|
+
createSessionCoordinator() {
|
|
690
|
+
return new AnalyticsSessionCoordinator(pageViewTrackerIdentity(this.client));
|
|
691
|
+
}
|
|
692
|
+
};
|
|
693
|
+
function sameActivityGeneration(left, right) {
|
|
694
|
+
return left.local === right.local && left.publicKey === right.publicKey && left.session === right.session;
|
|
695
|
+
}
|
|
696
|
+
function currentPath() {
|
|
697
|
+
if (typeof window < "u")
|
|
698
|
+
return window.location.pathname;
|
|
699
|
+
}
|
|
700
|
+
function currentTitle() {
|
|
701
|
+
if (typeof document < "u" && document.title)
|
|
702
|
+
return document.title;
|
|
703
|
+
}
|
|
704
|
+
function resolveVisitor() {
|
|
705
|
+
try {
|
|
706
|
+
let existing = localStorage.getItem(VISITOR_ID_STORAGE_KEY);
|
|
707
|
+
if (existing)
|
|
708
|
+
return { visitorId: existing, isNewVisitor: !1 };
|
|
709
|
+
let visitorId = typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `v_${Date.now().toString(36)}${Math.random().toString(36).slice(2)}`;
|
|
710
|
+
return localStorage.setItem(VISITOR_ID_STORAGE_KEY, visitorId), { visitorId, isNewVisitor: !0 };
|
|
711
|
+
} catch {
|
|
712
|
+
return {};
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
// src/subscriptions.ts
|
|
717
|
+
var SubscriptionService = class {
|
|
718
|
+
constructor(client) {
|
|
719
|
+
this.client = client;
|
|
720
|
+
}
|
|
721
|
+
async list() {
|
|
722
|
+
return chunkOMTVH334_js.safe(this.client.get("/api/v1/subscriptions"));
|
|
723
|
+
}
|
|
724
|
+
async get(id) {
|
|
725
|
+
let encodedId = encodeURIComponent(id);
|
|
726
|
+
return chunkOMTVH334_js.safe(this.client.get(`/api/v1/subscriptions/${encodedId}`));
|
|
727
|
+
}
|
|
728
|
+
async cancel(id, reason, opts) {
|
|
729
|
+
let encodedId = encodeURIComponent(id), idempotencyKey = opts?.idempotencyKey ?? chunkOMTVH334_js.generateIdempotencyKey();
|
|
730
|
+
return chunkOMTVH334_js.safe(
|
|
731
|
+
this.client.post(
|
|
732
|
+
`/api/v1/subscriptions/${encodedId}/cancel`,
|
|
733
|
+
{ reason },
|
|
734
|
+
{ idempotencyKey }
|
|
735
|
+
)
|
|
736
|
+
);
|
|
737
|
+
}
|
|
738
|
+
async pause(id) {
|
|
739
|
+
let encodedId = encodeURIComponent(id);
|
|
740
|
+
return chunkOMTVH334_js.safe(
|
|
741
|
+
this.client.post(`/api/v1/subscriptions/${encodedId}/pause`)
|
|
742
|
+
);
|
|
743
|
+
}
|
|
744
|
+
async resume(id) {
|
|
745
|
+
let encodedId = encodeURIComponent(id);
|
|
746
|
+
return chunkOMTVH334_js.safe(
|
|
747
|
+
this.client.post(`/api/v1/subscriptions/${encodedId}/resume`)
|
|
748
|
+
);
|
|
749
|
+
}
|
|
750
|
+
async skipNextRenewal(id, opts) {
|
|
751
|
+
let encodedId = encodeURIComponent(id), idempotencyKey = opts?.idempotencyKey ?? chunkOMTVH334_js.generateIdempotencyKey();
|
|
752
|
+
return chunkOMTVH334_js.safe(
|
|
753
|
+
this.client.post(
|
|
754
|
+
`/api/v1/subscriptions/${encodedId}/skip`,
|
|
755
|
+
void 0,
|
|
756
|
+
{ idempotencyKey }
|
|
757
|
+
)
|
|
758
|
+
);
|
|
759
|
+
}
|
|
760
|
+
};
|
|
761
|
+
var CONTENT_SHA256_HEADER = "x-amz-checksum-sha256", HASH_CHUNK_BYTES = 4 * 1024 * 1024, HEX_RADIX = 16, HEX_BYTE_WIDTH = 2;
|
|
762
|
+
async function contentSha256(blob) {
|
|
763
|
+
let hasher = sha2_js.sha256.create();
|
|
764
|
+
for (let offset = 0; offset < blob.size; offset += HASH_CHUNK_BYTES)
|
|
765
|
+
hasher.update(new Uint8Array(await blob.slice(offset, offset + HASH_CHUNK_BYTES).arrayBuffer()));
|
|
766
|
+
let digest = hasher.digest(), hex = "", binary = "";
|
|
767
|
+
for (let byte of digest)
|
|
768
|
+
hex += byte.toString((16)).padStart((2), "0"), binary += String.fromCharCode(byte);
|
|
769
|
+
return { hex, base64: btoa(binary) };
|
|
770
|
+
}
|
|
771
|
+
var UploadService = class {
|
|
772
|
+
constructor(client) {
|
|
773
|
+
this.client = client;
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* With `opts.digest` the PUT to `upload_url` must send `digest.base64` as
|
|
777
|
+
* `CONTENT_SHA256_HEADER`; without it the server hashes the stored bytes.
|
|
778
|
+
*/
|
|
779
|
+
async init(filename, contentType2, sizeBytes, opts) {
|
|
780
|
+
let idempotencyKey = opts?.idempotencyKey ?? chunkOMTVH334_js.generateIdempotencyKey();
|
|
781
|
+
return chunkOMTVH334_js.safe(
|
|
782
|
+
this.client.post(
|
|
783
|
+
"/api/v1/uploads/init",
|
|
784
|
+
{
|
|
785
|
+
filename,
|
|
786
|
+
content_type: contentType2,
|
|
787
|
+
size_bytes: sizeBytes,
|
|
788
|
+
content_sha256: opts?.digest?.hex
|
|
789
|
+
},
|
|
790
|
+
{ idempotencyKey }
|
|
791
|
+
)
|
|
792
|
+
);
|
|
793
|
+
}
|
|
794
|
+
async confirm(uploadId) {
|
|
795
|
+
return chunkOMTVH334_js.safe(
|
|
796
|
+
this.client.post("/api/v1/uploads/confirm", {
|
|
797
|
+
upload_id: uploadId
|
|
798
|
+
})
|
|
799
|
+
);
|
|
800
|
+
}
|
|
801
|
+
async upload(file) {
|
|
802
|
+
let digest = await contentSha256(file), initResult = await this.init(file.name, file.type, file.size, { digest });
|
|
803
|
+
if (!initResult.ok) return initResult;
|
|
804
|
+
let { upload_id, upload_url } = initResult.value;
|
|
805
|
+
try {
|
|
806
|
+
let uploadResponse = await fetch(upload_url, {
|
|
807
|
+
method: "PUT",
|
|
808
|
+
body: file,
|
|
809
|
+
headers: { "Content-Type": file.type, [CONTENT_SHA256_HEADER]: digest.base64 }
|
|
810
|
+
});
|
|
811
|
+
if (!uploadResponse.ok)
|
|
812
|
+
return {
|
|
813
|
+
ok: !1,
|
|
814
|
+
error: new chunkUCR5HRYM_js.CimplifyError(
|
|
815
|
+
"UPLOAD_FAILED",
|
|
816
|
+
`Upload failed with status ${uploadResponse.status}`,
|
|
817
|
+
!0
|
|
818
|
+
)
|
|
819
|
+
};
|
|
820
|
+
} catch (error) {
|
|
821
|
+
return {
|
|
822
|
+
ok: false,
|
|
823
|
+
error: new chunkUCR5HRYM_js.CimplifyError(
|
|
824
|
+
"UPLOAD_FAILED",
|
|
825
|
+
error instanceof Error ? error.message : "Upload failed",
|
|
826
|
+
true
|
|
827
|
+
)
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
return this.confirm(upload_id);
|
|
831
|
+
}
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
// src/places.ts
|
|
835
|
+
var PlacesService = class {
|
|
836
|
+
constructor(client) {
|
|
837
|
+
this.client = client;
|
|
838
|
+
}
|
|
839
|
+
/** `country` (ISO alpha-2) biases results; absent, the store's own country. */
|
|
840
|
+
async autocomplete(input, sessionToken, country) {
|
|
841
|
+
return chunkOMTVH334_js.safe(
|
|
842
|
+
this.client.post("/api/v1/places/autocomplete", {
|
|
843
|
+
input,
|
|
844
|
+
sessionToken,
|
|
845
|
+
...country ? { country } : {}
|
|
846
|
+
})
|
|
847
|
+
);
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* `country` (ISO alpha-2) is the country the place must lie in; pass the one
|
|
851
|
+
* the autocomplete used. Absent, the store's own country.
|
|
852
|
+
*/
|
|
853
|
+
async details(placeId, sessionToken, country) {
|
|
854
|
+
return chunkOMTVH334_js.safe(
|
|
855
|
+
this.client.post("/api/v1/places/details", {
|
|
856
|
+
place_id: placeId,
|
|
857
|
+
sessionToken,
|
|
858
|
+
...country ? { country } : {}
|
|
859
|
+
})
|
|
860
|
+
);
|
|
861
|
+
}
|
|
862
|
+
};
|
|
863
|
+
|
|
864
|
+
// src/delivery.ts
|
|
865
|
+
var DeliveryService = class {
|
|
866
|
+
constructor(client) {
|
|
867
|
+
this.client = client;
|
|
868
|
+
}
|
|
869
|
+
async getFee(dropoffLat, dropoffLng, country) {
|
|
870
|
+
let params = new URLSearchParams();
|
|
871
|
+
return params.set("dropoff_lat", String(dropoffLat)), params.set("dropoff_lng", String(dropoffLng)), country && params.set("country", country), chunkOMTVH334_js.safe(this.client.get(`/api/v1/delivery/fee?${params.toString()}`));
|
|
872
|
+
}
|
|
873
|
+
async getOptions(queryOrLatitude, longitude, legacyOptions) {
|
|
874
|
+
let query = typeof queryOrLatitude == "number" ? {
|
|
875
|
+
...legacyOptions,
|
|
876
|
+
dropoffLat: queryOrLatitude,
|
|
877
|
+
dropoffLng: longitude
|
|
878
|
+
} : queryOrLatitude ?? {}, params = new URLSearchParams();
|
|
879
|
+
return query.dropoffLat != null && params.set("dropoff_lat", String(query.dropoffLat)), query.dropoffLng != null && params.set("dropoff_lng", String(query.dropoffLng)), query.country && params.set("country", query.country), query.currency && params.set("currency", query.currency), query.orderValue != null && params.set("order_value", String(query.orderValue)), chunkOMTVH334_js.safe(
|
|
880
|
+
this.client.get(`/api/v1/delivery/options?${params.toString()}`)
|
|
881
|
+
);
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
|
|
885
|
+
// src/chat-wire.ts
|
|
886
|
+
function senderType(message) {
|
|
887
|
+
return message.sender_side === "account" ? "customer" : message.sender_side === "system" ? "system" : message.authorship === "ai" ? "bot" : "agent";
|
|
888
|
+
}
|
|
889
|
+
function contentType(message) {
|
|
890
|
+
if (message.content_type === "rich")
|
|
891
|
+
return message.structured_content?.kind === "reaction" ? "reaction" : "interactive";
|
|
892
|
+
if (message.content_type === "media") {
|
|
893
|
+
let mime = message.media[0]?.mime_type ?? "";
|
|
894
|
+
return mime.startsWith("image/") ? "image" : mime.startsWith("video/") ? "video" : mime.startsWith("audio/") ? "audio" : "document";
|
|
895
|
+
}
|
|
896
|
+
return "text";
|
|
897
|
+
}
|
|
898
|
+
function unresolvedReply(id) {
|
|
899
|
+
return { id, sender_type: "system", preview: "Earlier message" };
|
|
900
|
+
}
|
|
901
|
+
function chatMessagesFromWire(messages) {
|
|
902
|
+
let converted = messages.map((message) => ({
|
|
903
|
+
id: message.id,
|
|
904
|
+
sequence: message.sequence,
|
|
905
|
+
sender_type: senderType(message),
|
|
906
|
+
content: message.content,
|
|
907
|
+
content_type: contentType(message),
|
|
908
|
+
attachments: Array.isArray(message.media) ? message.media : [],
|
|
909
|
+
metadata: message.structured_content ?? {},
|
|
910
|
+
reply_to: message.reply_to_message_id ? unresolvedReply(message.reply_to_message_id) : void 0,
|
|
911
|
+
edited_at: message.edited_at,
|
|
912
|
+
deleted_at: message.deleted_at,
|
|
913
|
+
created_at: message.created_at
|
|
914
|
+
})), byId = new Map(converted.map((message) => [message.id, message]));
|
|
915
|
+
return converted.map((message) => {
|
|
916
|
+
let targetId = message.reply_to?.id, target = targetId ? byId.get(targetId) : void 0;
|
|
917
|
+
return !targetId || !target ? message : {
|
|
918
|
+
...message,
|
|
919
|
+
reply_to: {
|
|
920
|
+
id: targetId,
|
|
921
|
+
sender_type: target.sender_type,
|
|
922
|
+
preview: chunkWOF3AD3J_js.messagePreview(target.content)
|
|
923
|
+
}
|
|
924
|
+
};
|
|
925
|
+
});
|
|
926
|
+
}
|
|
927
|
+
function chatMessageFromWire(message) {
|
|
928
|
+
return chatMessagesFromWire([message])[0];
|
|
929
|
+
}
|
|
930
|
+
function chatRealtimeUpdateFromWire(envelope) {
|
|
931
|
+
if (envelope.type === "message_created" && envelope.data)
|
|
932
|
+
return {
|
|
933
|
+
kind: "message",
|
|
934
|
+
message: chatMessageFromWire(envelope.data)
|
|
935
|
+
};
|
|
936
|
+
if (envelope.type === "message_updated" && envelope.data)
|
|
937
|
+
return {
|
|
938
|
+
kind: "message_updated",
|
|
939
|
+
message: chatMessageFromWire(envelope.data)
|
|
940
|
+
};
|
|
941
|
+
if (envelope.type === "read" && envelope.data) {
|
|
942
|
+
let read = envelope.data;
|
|
943
|
+
return read.reader_side === "business" && typeof read.occurred_at == "string" ? { kind: "business_read", occurredAt: read.occurred_at } : { kind: "none" };
|
|
944
|
+
}
|
|
945
|
+
if (envelope.type === "history_imported")
|
|
946
|
+
return { kind: "reload" };
|
|
947
|
+
if (envelope.type === "ai_mode_changed" && envelope.data) {
|
|
948
|
+
let mode = envelope.data.mode;
|
|
949
|
+
return mode === "auto" || mode === "assist" || mode === "off" ? { kind: "ai_mode", mode } : { kind: "none" };
|
|
950
|
+
}
|
|
951
|
+
return envelope.type === "handoff_requested" ? { kind: "handoff" } : envelope.type === "resync" ? { kind: "resync", latestSequence: envelope.latest_sequence } : { kind: "none" };
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
// src/support.ts
|
|
955
|
+
var SupportService = class {
|
|
956
|
+
constructor(client) {
|
|
957
|
+
this.client = client;
|
|
958
|
+
}
|
|
959
|
+
/**
|
|
960
|
+
* Retry verified external-history discovery for the current storefront.
|
|
961
|
+
* Launch scope is intentionally WhatsApp-only because it is the registered
|
|
962
|
+
* bidirectional transport. Results are per envelope and omit provider ids,
|
|
963
|
+
* contact values, account ids, and message bodies.
|
|
964
|
+
*/
|
|
965
|
+
async claimExternalChats() {
|
|
966
|
+
return this.client.getAccessToken() ? chunkOMTVH334_js.safe(
|
|
967
|
+
(async () => {
|
|
968
|
+
let businessId = await this.client.resolveBusinessId();
|
|
969
|
+
return this.client.post("/v1/me/chats/external-claims", {
|
|
970
|
+
business_id: businessId
|
|
971
|
+
});
|
|
972
|
+
})()
|
|
973
|
+
) : chunkOMTVH334_js.err(new chunkUCR5HRYM_js.CimplifyError("not_authenticated", "No access token to claim with"));
|
|
974
|
+
}
|
|
975
|
+
/**
|
|
976
|
+
* Peek at the conversation without creating one: resolves the existing
|
|
977
|
+
* thread (or null) so a page load can hydrate history without littering
|
|
978
|
+
* the inbox with empty threads.
|
|
979
|
+
*/
|
|
980
|
+
async peekConversation() {
|
|
981
|
+
let result = await chunkOMTVH334_js.safe(
|
|
982
|
+
this.client.get("/api/v1/support/conversation")
|
|
983
|
+
);
|
|
984
|
+
return result.ok ? result.value.conversation ? chunkOMTVH334_js.ok({
|
|
985
|
+
conversation: result.value.conversation,
|
|
986
|
+
messages: chatMessagesFromWire(result.value.messages)
|
|
987
|
+
}) : chunkOMTVH334_js.ok(null) : result;
|
|
988
|
+
}
|
|
989
|
+
/** Open (or resume) the customer's widget conversation. */
|
|
990
|
+
async openConversation(opts) {
|
|
991
|
+
let idempotencyKey = opts?.idempotencyKey ?? chunkOMTVH334_js.generateIdempotencyKey(), result = await chunkOMTVH334_js.safe(
|
|
992
|
+
this.client.post("/api/v1/support/conversation", void 0, {
|
|
993
|
+
idempotencyKey
|
|
994
|
+
})
|
|
995
|
+
);
|
|
996
|
+
return result.ok ? chunkOMTVH334_js.ok({
|
|
997
|
+
conversation: result.value.conversation,
|
|
998
|
+
messages: chatMessagesFromWire(result.value.messages)
|
|
999
|
+
}) : result;
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* Send a message in the active conversation.
|
|
1003
|
+
*
|
|
1004
|
+
* The idempotency key doubles as the message `client_id`: the backend
|
|
1005
|
+
* dedupes on it, so client retries of the same send never insert twice.
|
|
1006
|
+
* `replyToMessageId` quotes another message by its `ChatMessage.id`; the
|
|
1007
|
+
* server resolves it thread-scoped and echoes the quote as `reply_to`.
|
|
1008
|
+
*/
|
|
1009
|
+
async sendMessage(content, opts) {
|
|
1010
|
+
let idempotencyKey = opts?.idempotencyKey ?? chunkOMTVH334_js.generateIdempotencyKey(), result = await chunkOMTVH334_js.safe(
|
|
1011
|
+
this.client.post(
|
|
1012
|
+
"/api/v1/support/conversation/messages",
|
|
1013
|
+
{
|
|
1014
|
+
content,
|
|
1015
|
+
client_id: idempotencyKey,
|
|
1016
|
+
reply_to_message_id: opts?.replyToMessageId,
|
|
1017
|
+
upload_ids: opts?.attachments?.map((a) => a.upload_id)
|
|
1018
|
+
},
|
|
1019
|
+
{ idempotencyKey }
|
|
1020
|
+
)
|
|
1021
|
+
);
|
|
1022
|
+
return result.ok ? chunkOMTVH334_js.ok(chatMessageFromWire(result.value.message)) : result;
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Poll for messages. `after` pages forward (live updates); `before` pages
|
|
1026
|
+
* backward for scrollback into older history.
|
|
1027
|
+
*/
|
|
1028
|
+
async getMessages(options = {}) {
|
|
1029
|
+
let params = new URLSearchParams();
|
|
1030
|
+
options.afterSequence !== void 0 && params.set("after_sequence", String(options.afterSequence)), options.beforeSequence !== void 0 && params.set("before_sequence", String(options.beforeSequence)), options.limit && params.set("limit", String(options.limit));
|
|
1031
|
+
let query = params.toString(), path = query ? `/api/v1/support/conversation/messages?${query}` : "/api/v1/support/conversation/messages", result = await chunkOMTVH334_js.safe(this.client.get(path));
|
|
1032
|
+
return result.ok ? chunkOMTVH334_js.ok(chatMessagesFromWire(result.value)) : result;
|
|
1033
|
+
}
|
|
1034
|
+
/** React to a message in the active conversation by its `ChatMessage.id`. */
|
|
1035
|
+
async reactToMessage(messageId, emoji) {
|
|
1036
|
+
let clientId = chunkOMTVH334_js.generateIdempotencyKey(), result = await chunkOMTVH334_js.safe(
|
|
1037
|
+
this.client.post(
|
|
1038
|
+
`/api/v1/support/conversation/messages/${messageId}/reactions`,
|
|
1039
|
+
{ emoji, client_id: clientId },
|
|
1040
|
+
{ idempotencyKey: clientId }
|
|
1041
|
+
)
|
|
1042
|
+
);
|
|
1043
|
+
return result.ok ? chunkOMTVH334_js.ok(chatMessageFromWire(result.value.message)) : result;
|
|
1044
|
+
}
|
|
1045
|
+
/** Ask for a person: flags the thread for the merchant's inbox. */
|
|
1046
|
+
async requestHuman(opts) {
|
|
1047
|
+
let idempotencyKey = opts?.idempotencyKey ?? chunkOMTVH334_js.generateIdempotencyKey();
|
|
1048
|
+
return chunkOMTVH334_js.safe(
|
|
1049
|
+
this.client.post(
|
|
1050
|
+
"/api/v1/support/conversation/handoff",
|
|
1051
|
+
void 0,
|
|
1052
|
+
{ idempotencyKey }
|
|
1053
|
+
)
|
|
1054
|
+
);
|
|
1055
|
+
}
|
|
1056
|
+
};
|
|
1057
|
+
|
|
1058
|
+
// src/session.ts
|
|
1059
|
+
var CLAIM_TIMEOUT_MS = 15e3, CLAIM_PATH = "/api/v1/auth/session/claim", SessionService = class {
|
|
1060
|
+
constructor(client) {
|
|
1061
|
+
this.client = client;
|
|
1062
|
+
this.claimInFlight = null;
|
|
1063
|
+
this.claimInFlightToken = null;
|
|
1064
|
+
this.lastClaimedAccessToken = null;
|
|
1065
|
+
this.claimedName = null;
|
|
1066
|
+
this.client.events.on(chunkOMTVH334_js.SESSION_CLEARED, () => {
|
|
1067
|
+
this.lastClaimedAccessToken = null, this.claimedName = null;
|
|
1068
|
+
}), this.client.events.on(chunkOMTVH334_js.SESSION_CLAIMED, (event) => {
|
|
1069
|
+
event.customerName && (this.claimedName = event.customerName);
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
/** The verified customer this session is bound to, null while anonymous. */
|
|
1073
|
+
get claimedCustomerName() {
|
|
1074
|
+
return this.claimedName;
|
|
1075
|
+
}
|
|
1076
|
+
/** Adopt a session another holder already bound, for this bearer or, with
|
|
1077
|
+
* `null`, for a bearer this client never holds (the checkout element). */
|
|
1078
|
+
adopt(accessToken, session) {
|
|
1079
|
+
this.lastClaimedAccessToken = accessToken, this.claimedName = session.customerName || null, this.client.adoptSessionToken(session.sessionToken), this.client.publishSessionClaimed(this.claimedName), this.client.events.emit(chunkOMTVH334_js.SESSION_CLAIMED, session);
|
|
1080
|
+
}
|
|
1081
|
+
/**
|
|
1082
|
+
* Bind the anonymous session to the verified Link identity in one server
|
|
1083
|
+
* transaction: verify the bearer, rotate the session token (adopted here),
|
|
1084
|
+
* fold the guest cart under the customer and re-price it. A repeat for the
|
|
1085
|
+
* same account and session returns the same session.
|
|
1086
|
+
*
|
|
1087
|
+
* Idempotent and single-flight: concurrent calls share one request, and a
|
|
1088
|
+
* token already claimed by this instance short-circuits without a network
|
|
1089
|
+
* round trip. A session already bound to another Link account is rejected
|
|
1090
|
+
* rather than transferring that account's cart. Emits `session:claimed` on
|
|
1091
|
+
* the client's event channel.
|
|
1092
|
+
*/
|
|
1093
|
+
async claim() {
|
|
1094
|
+
let accessToken = this.client.getAccessToken();
|
|
1095
|
+
if (!accessToken)
|
|
1096
|
+
return chunkOMTVH334_js.err(new chunkUCR5HRYM_js.CimplifyError("not_authenticated", "No access token to claim with"));
|
|
1097
|
+
if (this.claimInFlight)
|
|
1098
|
+
return this.claimInFlightToken === accessToken ? this.claimInFlight : (await this.claimInFlight, this.claim());
|
|
1099
|
+
if (this.lastClaimedAccessToken === accessToken)
|
|
1100
|
+
return chunkOMTVH334_js.err(new chunkUCR5HRYM_js.CimplifyError("already_claimed", "Session already claimed for this token"));
|
|
1101
|
+
let epoch = this.client.getSessionEpoch();
|
|
1102
|
+
this.claimInFlightToken = accessToken, this.claimInFlight = (async () => {
|
|
1103
|
+
let result = await chunkOMTVH334_js.safe(
|
|
1104
|
+
this.client.post(
|
|
1105
|
+
CLAIM_PATH,
|
|
1106
|
+
{ access_token: accessToken },
|
|
1107
|
+
{ timeoutMs: (15e3) }
|
|
1108
|
+
)
|
|
1109
|
+
);
|
|
1110
|
+
if (result.ok) {
|
|
1111
|
+
if (this.client.getSessionEpoch() !== epoch)
|
|
1112
|
+
return chunkOMTVH334_js.err(
|
|
1113
|
+
new chunkUCR5HRYM_js.CimplifyError("session_cleared", "Session was cleared during the claim")
|
|
1114
|
+
);
|
|
1115
|
+
this.adopt(accessToken, {
|
|
1116
|
+
sessionToken: result.value.session_token,
|
|
1117
|
+
customerName: result.value.customer.name,
|
|
1118
|
+
customer: result.value.customer,
|
|
1119
|
+
cart: result.value.cart
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
return result;
|
|
1123
|
+
})();
|
|
1124
|
+
try {
|
|
1125
|
+
return await this.claimInFlight;
|
|
1126
|
+
} finally {
|
|
1127
|
+
this.claimInFlight = null, this.claimInFlightToken = null;
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
};
|
|
1131
|
+
|
|
1132
|
+
// src/internal/cross-tab-session.ts
|
|
1133
|
+
var CROSS_TAB_SESSION_HUB_KEY = /* @__PURE__ */ Symbol.for("@cimplify/sdk.cross-tab-session-hub"), SESSION_SYNC_STORAGE_KEY = "cimplify_session_sync", MAX_RECENT_ENVELOPES = 64;
|
|
1134
|
+
function hubHost() {
|
|
1135
|
+
return window;
|
|
1136
|
+
}
|
|
1137
|
+
function currentHub() {
|
|
1138
|
+
let candidate = hubHost()[CROSS_TAB_SESSION_HUB_KEY];
|
|
1139
|
+
return candidate?.subscribers instanceof Map && candidate.recentEnvelopes instanceof Set && typeof candidate.storageListener == "function" && typeof candidate.dispatch == "function" ? candidate : null;
|
|
1140
|
+
}
|
|
1141
|
+
function subscriberReference(target) {
|
|
1142
|
+
let WeakReference = globalThis.WeakRef;
|
|
1143
|
+
return WeakReference ? new WeakReference(target) : { deref: () => target };
|
|
1144
|
+
}
|
|
1145
|
+
function pruneSubscribers(hub) {
|
|
1146
|
+
for (let [token, reference] of hub.subscribers)
|
|
1147
|
+
reference.deref() || hub.subscribers.delete(token);
|
|
1148
|
+
}
|
|
1149
|
+
function parseSessionSyncPayload(serialized) {
|
|
1150
|
+
if (!serialized) return null;
|
|
1151
|
+
try {
|
|
1152
|
+
let payload = JSON.parse(serialized);
|
|
1153
|
+
return (payload.type === "claimed" || payload.type === "cleared") && typeof payload.token == "string" && payload.token.length > 0 && typeof payload.at == "number" && Number.isFinite(payload.at) && (payload.name === void 0 || payload.name === null || typeof payload.name == "string") ? payload : null;
|
|
1154
|
+
} catch {
|
|
1155
|
+
return null;
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
function sessionSyncEnvelopeKey(payload) {
|
|
1159
|
+
let name = payload.name === void 0 ? ["missing"] : ["present", payload.name];
|
|
1160
|
+
return JSON.stringify([payload.type, payload.token, name, payload.at]);
|
|
1161
|
+
}
|
|
1162
|
+
function rememberEnvelope(hub, envelope) {
|
|
1163
|
+
if (hub.recentEnvelopes.has(envelope)) return false;
|
|
1164
|
+
if (hub.recentEnvelopes.add(envelope), hub.recentEnvelopes.size > (64)) {
|
|
1165
|
+
let oldest = hub.recentEnvelopes.values().next().value;
|
|
1166
|
+
oldest && hub.recentEnvelopes.delete(oldest);
|
|
1167
|
+
}
|
|
1168
|
+
return true;
|
|
1169
|
+
}
|
|
1170
|
+
function createHub() {
|
|
1171
|
+
let hub = {
|
|
1172
|
+
subscribers: /* @__PURE__ */ new Map(),
|
|
1173
|
+
recentEnvelopes: /* @__PURE__ */ new Set()
|
|
1174
|
+
};
|
|
1175
|
+
return hub.dispatch = (payload) => {
|
|
1176
|
+
if (rememberEnvelope(hub, sessionSyncEnvelopeKey(payload)))
|
|
1177
|
+
for (let [token, reference] of hub.subscribers) {
|
|
1178
|
+
let subscriber = reference.deref();
|
|
1179
|
+
if (!subscriber) {
|
|
1180
|
+
hub.subscribers.delete(token);
|
|
1181
|
+
continue;
|
|
1182
|
+
}
|
|
1183
|
+
try {
|
|
1184
|
+
subscriber.notify(payload);
|
|
1185
|
+
} catch {
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
}, hub.storageListener = (event) => {
|
|
1189
|
+
let storageEvent = event;
|
|
1190
|
+
if (storageEvent.key !== SESSION_SYNC_STORAGE_KEY) return;
|
|
1191
|
+
let payload = parseSessionSyncPayload(storageEvent.newValue);
|
|
1192
|
+
payload && hub.dispatch(payload);
|
|
1193
|
+
}, window.addEventListener("storage", hub.storageListener), hubHost()[CROSS_TAB_SESSION_HUB_KEY] = hub, hub;
|
|
1194
|
+
}
|
|
1195
|
+
function publishLocalSessionSync(payload) {
|
|
1196
|
+
typeof window > "u" || typeof window.addEventListener != "function" || (currentHub() ?? createHub()).dispatch(payload);
|
|
1197
|
+
}
|
|
1198
|
+
function subscribeCrossTabSession(notify) {
|
|
1199
|
+
if (typeof window > "u" || typeof window.addEventListener != "function")
|
|
1200
|
+
return () => {
|
|
1201
|
+
};
|
|
1202
|
+
let hub = currentHub() ?? createHub();
|
|
1203
|
+
pruneSubscribers(hub);
|
|
1204
|
+
let token = /* @__PURE__ */ Symbol("cross-tab-session-subscriber"), subscriber = { notify };
|
|
1205
|
+
hub.subscribers.set(token, subscriberReference(subscriber));
|
|
1206
|
+
let unsubscribed = false;
|
|
1207
|
+
return () => {
|
|
1208
|
+
unsubscribed || (unsubscribed = true, subscriber.notify = () => {
|
|
1209
|
+
}, hub.subscribers.delete(token), pruneSubscribers(hub), hub.subscribers.size === 0 && (window.removeEventListener("storage", hub.storageListener), currentHub() === hub && delete hubHost()[CROSS_TAB_SESSION_HUB_KEY]));
|
|
1210
|
+
};
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
// src/client.ts
|
|
1214
|
+
var SESSION_TOKEN_STORAGE_KEY = "cimplify_session_token", ORDER_TOKEN_PREFIX = "cimplify_ot_", SESSION_TOKEN_HEADER = "x-session-token", LOCATION_ID_QUERY_PARAMETER = "location_id", ORDER_TOKEN_TTL_MS = 1440 * 60 * 1e3, DEFAULT_TIMEOUT_MS = 5e3, HTTP_SERVER_ERROR_STATUS = 500, HTTP_TOO_MANY_REQUESTS = 429, HTTP_SERVICE_UNAVAILABLE = 503, RETRY_AFTER_HEADER = "Retry-After", DEFAULT_MAX_RETRIES = 3, DEFAULT_RETRY_DELAY_MS = 1e3, MAX_RETRY_AFTER_MS = 3e4;
|
|
1215
|
+
function sleep(ms, signal) {
|
|
1216
|
+
return signal?.aborted ? Promise.reject(new chunkUCR5HRYM_js.CimplifyError(chunkUCR5HRYM_js.ErrorCode.CANCELLED, "Request was cancelled.", true)) : new Promise((resolve, reject) => {
|
|
1217
|
+
let timer = setTimeout(() => {
|
|
1218
|
+
signal?.removeEventListener("abort", onAbort), resolve();
|
|
1219
|
+
}, ms), onAbort = () => {
|
|
1220
|
+
clearTimeout(timer), reject(new chunkUCR5HRYM_js.CimplifyError(chunkUCR5HRYM_js.ErrorCode.CANCELLED, "Request was cancelled.", true));
|
|
1221
|
+
};
|
|
1222
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
1223
|
+
});
|
|
1224
|
+
}
|
|
1225
|
+
var MS_PER_SECOND = 1e3;
|
|
1226
|
+
function retryAfterDelayMs(value) {
|
|
1227
|
+
if (!value) return null;
|
|
1228
|
+
let seconds = Number(value);
|
|
1229
|
+
if (Number.isFinite(seconds) && seconds >= 0)
|
|
1230
|
+
return seconds * (1e3);
|
|
1231
|
+
let retryAt = Date.parse(value);
|
|
1232
|
+
return Number.isFinite(retryAt) ? Math.max(0, retryAt - Date.now()) : null;
|
|
1233
|
+
}
|
|
1234
|
+
function parseRetryAfterMs(value) {
|
|
1235
|
+
let delayMs = retryAfterDelayMs(value);
|
|
1236
|
+
return delayMs === null ? null : Math.min(delayMs, (3e4));
|
|
1237
|
+
}
|
|
1238
|
+
function withPositiveJitter(delayMs, jitterRatio = 0) {
|
|
1239
|
+
let boundedRatio = Math.min(Math.max(jitterRatio, 0), 1);
|
|
1240
|
+
return boundedRatio === 0 || delayMs === 0 ? delayMs : Math.round(delayMs + delayMs * boundedRatio * Math.random());
|
|
1241
|
+
}
|
|
1242
|
+
function nextInit(cacheOptions) {
|
|
1243
|
+
if (!cacheOptions) return {};
|
|
1244
|
+
let next = {};
|
|
1245
|
+
return cacheOptions.revalidate !== void 0 && (next.revalidate = cacheOptions.revalidate), cacheOptions.tags && cacheOptions.tags.length > 0 && (next.tags = [...cacheOptions.tags]), next.revalidate === void 0 && !next.tags ? {} : { next };
|
|
1246
|
+
}
|
|
1247
|
+
function mergeOptionHeaders(base, opts) {
|
|
1248
|
+
if (!opts) return base;
|
|
1249
|
+
let merged = { ...base };
|
|
1250
|
+
if (opts.headers)
|
|
1251
|
+
for (let [k, v] of Object.entries(opts.headers))
|
|
1252
|
+
merged[k] = v;
|
|
1253
|
+
return opts.idempotencyKey && (merged["Idempotency-Key"] = opts.idempotencyKey), merged;
|
|
1254
|
+
}
|
|
1255
|
+
function generateSessionToken() {
|
|
1256
|
+
return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
1257
|
+
let r = Math.random() * 16 | 0;
|
|
1258
|
+
return (c === "x" ? r : r & 3 | 8).toString(16);
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1261
|
+
function isRetryable(error) {
|
|
1262
|
+
return error instanceof TypeError && error.message.includes("fetch") || error instanceof DOMException && error.name === "AbortError" ? true : error instanceof chunkUCR5HRYM_js.CimplifyError ? error.retryable : false;
|
|
1263
|
+
}
|
|
1264
|
+
function toNetworkError(error, isTestMode) {
|
|
1265
|
+
return error instanceof DOMException && error.name === "AbortError" ? chunkUCR5HRYM_js.enrichError(
|
|
1266
|
+
new chunkUCR5HRYM_js.CimplifyError(
|
|
1267
|
+
chunkUCR5HRYM_js.ErrorCode.TIMEOUT,
|
|
1268
|
+
"Request timed out. Please check your connection and try again.",
|
|
1269
|
+
true
|
|
1270
|
+
),
|
|
1271
|
+
{ isTestMode }
|
|
1272
|
+
) : error instanceof TypeError && error.message.includes("fetch") ? chunkUCR5HRYM_js.enrichError(
|
|
1273
|
+
new chunkUCR5HRYM_js.CimplifyError(
|
|
1274
|
+
chunkUCR5HRYM_js.ErrorCode.NETWORK_ERROR,
|
|
1275
|
+
"Network error. Please check your internet connection.",
|
|
1276
|
+
true
|
|
1277
|
+
),
|
|
1278
|
+
{ isTestMode }
|
|
1279
|
+
) : error instanceof chunkUCR5HRYM_js.CimplifyError ? chunkUCR5HRYM_js.enrichError(error, { isTestMode }) : chunkUCR5HRYM_js.enrichError(
|
|
1280
|
+
new chunkUCR5HRYM_js.CimplifyError(
|
|
1281
|
+
chunkUCR5HRYM_js.ErrorCode.UNKNOWN_ERROR,
|
|
1282
|
+
error instanceof Error ? error.message : "An unknown error occurred",
|
|
1283
|
+
false
|
|
1284
|
+
),
|
|
1285
|
+
{ isTestMode }
|
|
1286
|
+
);
|
|
1287
|
+
}
|
|
1288
|
+
function deriveUrls() {
|
|
1289
|
+
let hostname = typeof window < "u" ? window.location.hostname : "";
|
|
1290
|
+
if (hostname === "localhost" || hostname === "127.0.0.1") {
|
|
1291
|
+
let protocol = window.location.protocol;
|
|
1292
|
+
return {
|
|
1293
|
+
baseUrl: `${protocol}//${hostname}:8082`,
|
|
1294
|
+
linkApiUrl: `${protocol}//${hostname}:8080`
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1297
|
+
return {
|
|
1298
|
+
baseUrl: "https://storefronts.cimplify.io",
|
|
1299
|
+
linkApiUrl: "https://api.cimplify.io"
|
|
1300
|
+
};
|
|
1301
|
+
}
|
|
1302
|
+
function normalizeUrl(url) {
|
|
1303
|
+
let trimmed = url.trim();
|
|
1304
|
+
return trimmed && trimmed.replace(/\/+$/, "");
|
|
1305
|
+
}
|
|
1306
|
+
function getEnvPublicKey() {
|
|
1307
|
+
try {
|
|
1308
|
+
return globalThis.process?.env.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY || void 0;
|
|
1309
|
+
} catch {
|
|
1310
|
+
return;
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
var CimplifyClient = class {
|
|
1314
|
+
constructor(config = {}) {
|
|
1315
|
+
this.accessToken = null;
|
|
1316
|
+
this.sessionToken = null;
|
|
1317
|
+
this.sessionEpoch = 0;
|
|
1318
|
+
this.context = {};
|
|
1319
|
+
this.businessId = null;
|
|
1320
|
+
this.businessIdResolvePromise = null;
|
|
1321
|
+
this.publicKeyEpoch = 0;
|
|
1322
|
+
this.stopCrossTabSessionWatch = null;
|
|
1323
|
+
this.latestSessionSyncAt = Number.NEGATIVE_INFINITY;
|
|
1324
|
+
this.latestSessionSyncOrderKey = null;
|
|
1325
|
+
this.inflightRequests = /* @__PURE__ */ new Map();
|
|
1326
|
+
/**
|
|
1327
|
+
* App-level event channel. Subscribe to surface mutation rollbacks, outbox
|
|
1328
|
+
* activity, and dead-letter notifications to consumer code (toasts,
|
|
1329
|
+
* Sentry, analytics, etc.). The SDK emits but never auto-consumes — the
|
|
1330
|
+
* consumer decides how to react.
|
|
1331
|
+
*/
|
|
1332
|
+
this.events = chunkOMTVH334_js.createClientEvents();
|
|
1333
|
+
this.stopPageViewTracking = null;
|
|
1334
|
+
this.publicKey = config.publicKey || getEnvPublicKey() || "";
|
|
1335
|
+
let urls = deriveUrls();
|
|
1336
|
+
this.baseUrl = config.baseUrl ? normalizeUrl(config.baseUrl) : urls.baseUrl, this.linkApiUrl = config.linkApiUrl ? normalizeUrl(config.linkApiUrl) : urls.linkApiUrl, this.credentials = config.credentials || "include", this.timeout = config.timeout ?? (5e3), this.maxRetries = config.maxRetries ?? (3), this.retryDelay = config.retryDelay ?? (1e3), this.hooks = config.hooks ?? {}, this.authorizationAdapters = config.authorizationAdapterRegistry ?? chunkOMTVH334_js.createDefaultPaymentAuthorizationAdapterRegistry(), this.fetchImpl = (config.fetch ?? globalThis.fetch).bind(globalThis), this.sessionToken = this.loadSessionToken() ?? this.mintSessionToken();
|
|
1337
|
+
let persistedSessionSync = this.loadSessionSyncPayload();
|
|
1338
|
+
persistedSessionSync && this.observeSessionSync(persistedSessionSync), this.stopCrossTabSessionWatch = subscribeCrossTabSession((payload) => {
|
|
1339
|
+
this.applyCrossTabSession(payload);
|
|
1340
|
+
}), !this.publicKey && !config.suppressPublicKeyWarning && console.warn(
|
|
1341
|
+
'[Cimplify] No public key found. Set NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY in your environment, or pass { publicKey: "cpk_..." } to createCimplifyClient().'
|
|
1342
|
+
), config.trackPageViews !== false && (this.stopPageViewTracking = this.activity.autoTrackPageViews());
|
|
1343
|
+
}
|
|
1344
|
+
buildUrl(base, path) {
|
|
1345
|
+
let url = `${base}${path}`, locationId = this.context.location_id;
|
|
1346
|
+
if (!locationId) return url;
|
|
1347
|
+
let fragmentIndex = url.indexOf("#"), urlWithoutFragment = fragmentIndex === -1 ? url : url.slice(0, fragmentIndex), fragment = fragmentIndex === -1 ? "" : url.slice(fragmentIndex), queryIndex = urlWithoutFragment.indexOf("?"), query = queryIndex === -1 ? "" : urlWithoutFragment.slice(queryIndex + 1);
|
|
1348
|
+
return new URLSearchParams(query).has(LOCATION_ID_QUERY_PARAMETER) ? url : `${urlWithoutFragment}${queryIndex === -1 ? "?" : "&"}${LOCATION_ID_QUERY_PARAMETER}=${encodeURIComponent(locationId)}${fragment}`;
|
|
1349
|
+
}
|
|
1350
|
+
stopTrackingPageViews() {
|
|
1351
|
+
this.stopPageViewTracking?.(), this.stopPageViewTracking = null;
|
|
1352
|
+
}
|
|
1353
|
+
/** Release window-level subscriptions and automatic tracking owned by this client. */
|
|
1354
|
+
destroy() {
|
|
1355
|
+
this.stopTrackingPageViews(), this.stopCrossTabSessionWatch?.(), this.stopCrossTabSessionWatch = null;
|
|
1356
|
+
}
|
|
1357
|
+
getAccessToken() {
|
|
1358
|
+
return this.accessToken;
|
|
1359
|
+
}
|
|
1360
|
+
getPublicKey() {
|
|
1361
|
+
return this.publicKey;
|
|
1362
|
+
}
|
|
1363
|
+
getBaseUrl() {
|
|
1364
|
+
return this.baseUrl;
|
|
1365
|
+
}
|
|
1366
|
+
getLinkApiUrl() {
|
|
1367
|
+
return this.linkApiUrl;
|
|
1368
|
+
}
|
|
1369
|
+
getCredentialsMode() {
|
|
1370
|
+
return this.credentials;
|
|
1371
|
+
}
|
|
1372
|
+
isTestMode() {
|
|
1373
|
+
return this.publicKey.trim().startsWith("cpk_test_");
|
|
1374
|
+
}
|
|
1375
|
+
setAccessToken(token) {
|
|
1376
|
+
let previous = this.accessToken;
|
|
1377
|
+
this.accessToken = token, previous !== token && this.sessionEpoch++, this.hooks.onSessionChange?.({
|
|
1378
|
+
previousToken: previous,
|
|
1379
|
+
newToken: token,
|
|
1380
|
+
source: SESSION_CHANGE_SOURCE.MANUAL
|
|
1381
|
+
}), this.events.emit(chunkOMTVH334_js.AUTH_TOKEN_CHANGED, { token });
|
|
1382
|
+
}
|
|
1383
|
+
/**
|
|
1384
|
+
* Zero-UI claim: a freshly verified customer identity (OTP verify, silent
|
|
1385
|
+
* refresh restore) binds the anonymous session so the conversation, cart
|
|
1386
|
+
* and orders survive a cleared browser. Best-effort by design — a failed
|
|
1387
|
+
* claim leaves the session anonymous, exactly as it was. Called by the
|
|
1388
|
+
* merchant auth flows, never by the raw token setter. Global Link clients
|
|
1389
|
+
* have no storefront tenant and therefore activate without this step.
|
|
1390
|
+
*/
|
|
1391
|
+
autoClaimSession() {
|
|
1392
|
+
typeof window > "u" || !this.sessionToken || !this.accessToken || this.session.claim();
|
|
1393
|
+
}
|
|
1394
|
+
/**
|
|
1395
|
+
* Adopt a server-rotated session token (claim flow). The old token stays
|
|
1396
|
+
* in flight-safe use until the next request; the storage swap makes the
|
|
1397
|
+
* rotation durable across reloads.
|
|
1398
|
+
*/
|
|
1399
|
+
adoptSessionToken(token) {
|
|
1400
|
+
!token || token === this.sessionToken || (this.sessionToken = token, this.sessionEpoch++, this.saveSessionToken(token));
|
|
1401
|
+
}
|
|
1402
|
+
clearSession() {
|
|
1403
|
+
let previous = this.accessToken;
|
|
1404
|
+
this.accessToken = null, this._activity?.resetSession(), this.sessionToken = null, this.sessionEpoch++;
|
|
1405
|
+
try {
|
|
1406
|
+
this.safeStorage()?.removeItem(SESSION_TOKEN_STORAGE_KEY);
|
|
1407
|
+
} catch {
|
|
1408
|
+
}
|
|
1409
|
+
this.sessionToken = this.mintSessionToken(), this.sessionToken && this.broadcastSessionSync({ type: "cleared", token: this.sessionToken }), this.hooks.onSessionChange?.({
|
|
1410
|
+
previousToken: previous,
|
|
1411
|
+
newToken: null,
|
|
1412
|
+
source: SESSION_CHANGE_SOURCE.CLEAR
|
|
1413
|
+
}), this.events.emit(chunkOMTVH334_js.AUTH_TOKEN_CHANGED, { token: null }), this.events.emit(chunkOMTVH334_js.SESSION_CLEARED, {});
|
|
1414
|
+
}
|
|
1415
|
+
getSessionEpoch() {
|
|
1416
|
+
return this.sessionEpoch;
|
|
1417
|
+
}
|
|
1418
|
+
/** Monotonic fence for async work scoped to the current storefront tenant. */
|
|
1419
|
+
getPublicKeyEpoch() {
|
|
1420
|
+
return this.publicKeyEpoch;
|
|
1421
|
+
}
|
|
1422
|
+
getSessionToken() {
|
|
1423
|
+
return this.sessionToken;
|
|
1424
|
+
}
|
|
1425
|
+
/** Whether the current transport session is known to have been claimed for
|
|
1426
|
+
* a Link identity, even when its in-memory bearer is absent after reload or
|
|
1427
|
+
* a failed refresh. The sync marker is written only after canonical claim
|
|
1428
|
+
* rotation and is replaced with `cleared` when a fresh session is minted. */
|
|
1429
|
+
hasClaimedSessionAuthority() {
|
|
1430
|
+
if (!this.sessionToken) return false;
|
|
1431
|
+
try {
|
|
1432
|
+
let payload = parseSessionSyncPayload(
|
|
1433
|
+
this.safeStorage()?.getItem(SESSION_SYNC_STORAGE_KEY) ?? null
|
|
1434
|
+
);
|
|
1435
|
+
return payload ? payload.type === "claimed" && payload.token === this.sessionToken : !1;
|
|
1436
|
+
} catch {
|
|
1437
|
+
return false;
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
publishSessionClaimed(customerName) {
|
|
1441
|
+
this.sessionToken && this.broadcastSessionSync({
|
|
1442
|
+
type: "claimed",
|
|
1443
|
+
token: this.sessionToken,
|
|
1444
|
+
name: customerName
|
|
1445
|
+
});
|
|
1446
|
+
}
|
|
1447
|
+
broadcastSessionSync(payload) {
|
|
1448
|
+
let envelope = {
|
|
1449
|
+
...payload,
|
|
1450
|
+
at: this.nextSessionSyncTimestamp()
|
|
1451
|
+
};
|
|
1452
|
+
try {
|
|
1453
|
+
this.safeStorage()?.setItem(SESSION_SYNC_STORAGE_KEY, JSON.stringify(envelope));
|
|
1454
|
+
} catch {
|
|
1455
|
+
}
|
|
1456
|
+
publishLocalSessionSync(envelope);
|
|
1457
|
+
}
|
|
1458
|
+
applyCrossTabSession(payload) {
|
|
1459
|
+
this.observeSessionSync(payload) && payload.token !== this.sessionToken && (payload.type === "claimed" ? (this.sessionToken = payload.token, this.sessionEpoch++, this.events.emit(chunkOMTVH334_js.SESSION_CLAIMED, {
|
|
1460
|
+
sessionToken: payload.token,
|
|
1461
|
+
customerName: payload.name ?? "",
|
|
1462
|
+
customer: null,
|
|
1463
|
+
cart: null
|
|
1464
|
+
})) : (this.accessToken = null, this._activity?.resetSession(), this.sessionToken = payload.token, this.sessionEpoch++, this.events.emit(chunkOMTVH334_js.AUTH_TOKEN_CHANGED, { token: null }), this.events.emit(chunkOMTVH334_js.SESSION_CLEARED, {})));
|
|
1465
|
+
}
|
|
1466
|
+
observeSessionSync(payload) {
|
|
1467
|
+
if (payload.at < this.latestSessionSyncAt) return false;
|
|
1468
|
+
let envelope = sessionSyncEnvelopeKey(payload);
|
|
1469
|
+
return payload.at === this.latestSessionSyncAt && this.latestSessionSyncOrderKey !== null && envelope <= this.latestSessionSyncOrderKey ? false : (this.latestSessionSyncAt = payload.at, this.latestSessionSyncOrderKey = envelope, true);
|
|
1470
|
+
}
|
|
1471
|
+
nextSessionSyncTimestamp() {
|
|
1472
|
+
let now = Date.now();
|
|
1473
|
+
return Number.isFinite(this.latestSessionSyncAt) ? Math.max(now, this.latestSessionSyncAt + 1) : now;
|
|
1474
|
+
}
|
|
1475
|
+
setOrderToken(orderId, token) {
|
|
1476
|
+
try {
|
|
1477
|
+
let entry = JSON.stringify({ token, storedAt: Date.now() });
|
|
1478
|
+
this.safeStorage()?.setItem(`${ORDER_TOKEN_PREFIX}${orderId}`, entry);
|
|
1479
|
+
} catch {
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
getOrderToken(orderId) {
|
|
1483
|
+
try {
|
|
1484
|
+
let storage = this.safeStorage();
|
|
1485
|
+
if (!storage) return null;
|
|
1486
|
+
let raw = storage.getItem(`${ORDER_TOKEN_PREFIX}${orderId}`);
|
|
1487
|
+
if (!raw) return null;
|
|
1488
|
+
let entry = JSON.parse(raw);
|
|
1489
|
+
return Date.now() - entry.storedAt > ORDER_TOKEN_TTL_MS ? (storage.removeItem(`${ORDER_TOKEN_PREFIX}${orderId}`), null) : entry.token;
|
|
1490
|
+
} catch {
|
|
1491
|
+
return null;
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
clearOrderTokens() {
|
|
1495
|
+
try {
|
|
1496
|
+
let storage = this.safeStorage();
|
|
1497
|
+
if (!storage) return;
|
|
1498
|
+
let keysToRemove = [];
|
|
1499
|
+
for (let i = 0; i < storage.length; i++) {
|
|
1500
|
+
let key = storage.key(i);
|
|
1501
|
+
key?.startsWith(ORDER_TOKEN_PREFIX) && keysToRemove.push(key);
|
|
1502
|
+
}
|
|
1503
|
+
keysToRemove.forEach((k) => storage.removeItem(k));
|
|
1504
|
+
} catch {
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
setLocationId(locationId) {
|
|
1508
|
+
locationId ? this.context.location_id = locationId : delete this.context.location_id;
|
|
1509
|
+
}
|
|
1510
|
+
getLocationId() {
|
|
1511
|
+
return this.context.location_id ?? null;
|
|
1512
|
+
}
|
|
1513
|
+
setBusinessId(businessId) {
|
|
1514
|
+
let normalized = businessId.trim();
|
|
1515
|
+
normalized && (this.businessId = normalized);
|
|
1516
|
+
}
|
|
1517
|
+
// Set the storefront public key after construction. Needed by hosts that
|
|
1518
|
+
// create the client before they know the key (e.g. the Link element, which
|
|
1519
|
+
// receives it in its INIT message) — without it, storefront calls carry no
|
|
1520
|
+
// X-API-Key and the business can't be resolved.
|
|
1521
|
+
setPublicKey(publicKey) {
|
|
1522
|
+
let normalized = publicKey.trim();
|
|
1523
|
+
if (normalized === this.publicKey) return;
|
|
1524
|
+
let restartPageViewTracking = this.stopPageViewTracking !== null;
|
|
1525
|
+
restartPageViewTracking && this.stopTrackingPageViews(), this.publicKey = normalized, this.publicKeyEpoch += 1, this.businessId = null, this.businessIdResolvePromise = null, this.inflightRequests.clear(), this._activity?.resetForStorefrontIdentityChange(), delete this.context.location_id, this.accessToken !== null && this.setAccessToken(null), this.events.emit(chunkOMTVH334_js.SESSION_CLEARED, {}), restartPageViewTracking && (this.stopPageViewTracking = this.activity.autoTrackPageViews());
|
|
1526
|
+
}
|
|
1527
|
+
getBusinessId() {
|
|
1528
|
+
return this.businessId;
|
|
1529
|
+
}
|
|
1530
|
+
async resolveBusinessId() {
|
|
1531
|
+
if (this.businessId)
|
|
1532
|
+
return this.businessId;
|
|
1533
|
+
if (this.businessIdResolvePromise)
|
|
1534
|
+
return this.businessIdResolvePromise;
|
|
1535
|
+
let publicKeyEpoch = this.publicKeyEpoch, resolution = (async () => {
|
|
1536
|
+
let result = await this.business.getInfo();
|
|
1537
|
+
if (!result.ok || !result.value?.id)
|
|
1538
|
+
throw new chunkUCR5HRYM_js.CimplifyError(
|
|
1539
|
+
chunkUCR5HRYM_js.ErrorCode.NOT_FOUND,
|
|
1540
|
+
"Unable to resolve business ID from the current public key.",
|
|
1541
|
+
true
|
|
1542
|
+
);
|
|
1543
|
+
if (this.publicKeyEpoch !== publicKeyEpoch)
|
|
1544
|
+
throw new chunkUCR5HRYM_js.CimplifyError(
|
|
1545
|
+
chunkUCR5HRYM_js.ErrorCode.TENANT_CONTEXT_CHANGED,
|
|
1546
|
+
"The storefront tenant changed while resolving its business identity.",
|
|
1547
|
+
true
|
|
1548
|
+
);
|
|
1549
|
+
return this.businessId = result.value.id, result.value.id;
|
|
1550
|
+
})();
|
|
1551
|
+
this.businessIdResolvePromise = resolution;
|
|
1552
|
+
try {
|
|
1553
|
+
return await resolution;
|
|
1554
|
+
} finally {
|
|
1555
|
+
this.businessIdResolvePromise === resolution && (this.businessIdResolvePromise = null);
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
async authedFetch(url, options, timeoutMs, retryPolicy, signal) {
|
|
1559
|
+
return this.resilientFetch(url, options, timeoutMs, retryPolicy, signal);
|
|
1560
|
+
}
|
|
1561
|
+
// Storage guards: even the `window.localStorage` property access throws in
|
|
1562
|
+
// some sandboxed iframes and strict private-browsing modes. These run in the
|
|
1563
|
+
// constructor at module load, so a throw would white-screen the whole app —
|
|
1564
|
+
// fall back to an in-memory session token instead.
|
|
1565
|
+
safeStorage() {
|
|
1566
|
+
try {
|
|
1567
|
+
if (typeof window < "u" && window.localStorage)
|
|
1568
|
+
return window.localStorage;
|
|
1569
|
+
} catch {
|
|
1570
|
+
}
|
|
1571
|
+
return null;
|
|
1572
|
+
}
|
|
1573
|
+
loadSessionToken() {
|
|
1574
|
+
try {
|
|
1575
|
+
return this.safeStorage()?.getItem(SESSION_TOKEN_STORAGE_KEY) ?? null;
|
|
1576
|
+
} catch {
|
|
1577
|
+
return null;
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
loadSessionSyncPayload() {
|
|
1581
|
+
try {
|
|
1582
|
+
return parseSessionSyncPayload(this.safeStorage()?.getItem(SESSION_SYNC_STORAGE_KEY) ?? null);
|
|
1583
|
+
} catch {
|
|
1584
|
+
return null;
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
/**
|
|
1588
|
+
* Mint the session token client-side so the very first request already
|
|
1589
|
+
* carries it. Without this, parallel first-load requests each get a
|
|
1590
|
+
* different server-minted token and last-writer-wins splits the session
|
|
1591
|
+
* (cart writes and chat conversations land on dropped tokens).
|
|
1592
|
+
*
|
|
1593
|
+
* Browser-only: minting on a server-shared client instance would pin
|
|
1594
|
+
* every visitor to one session, so SSR keeps the lazy server-minted flow.
|
|
1595
|
+
*/
|
|
1596
|
+
mintSessionToken() {
|
|
1597
|
+
if (typeof window > "u")
|
|
1598
|
+
return null;
|
|
1599
|
+
let token = generateSessionToken();
|
|
1600
|
+
return this.saveSessionToken(token), token;
|
|
1601
|
+
}
|
|
1602
|
+
saveSessionToken(token) {
|
|
1603
|
+
try {
|
|
1604
|
+
this.safeStorage()?.setItem(SESSION_TOKEN_STORAGE_KEY, token);
|
|
1605
|
+
} catch {
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
captureSessionToken(response) {
|
|
1609
|
+
if (typeof window > "u" || this.sessionToken) return;
|
|
1610
|
+
let token = response.headers.get(SESSION_TOKEN_HEADER);
|
|
1611
|
+
token && (this.sessionToken = token, this.saveSessionToken(token));
|
|
1612
|
+
}
|
|
1613
|
+
getHeaders() {
|
|
1614
|
+
let headers = {
|
|
1615
|
+
"Content-Type": "application/json"
|
|
1616
|
+
}, trimmedPublicKey = this.publicKey.trim();
|
|
1617
|
+
if (trimmedPublicKey && (headers["X-API-Key"] = trimmedPublicKey), this.accessToken && (headers.Authorization = `Bearer ${this.accessToken}`), this.sessionToken && (headers[SESSION_TOKEN_HEADER] = this.sessionToken), typeof window < "u") {
|
|
1618
|
+
headers["X-Storefront-Host"] = window.location.host;
|
|
1619
|
+
let preview = new URLSearchParams(window.location.search).get("preview");
|
|
1620
|
+
preview && (headers["X-Storefront-Preview"] = preview);
|
|
1621
|
+
}
|
|
1622
|
+
return headers;
|
|
1623
|
+
}
|
|
1624
|
+
async resilientFetch(url, options, timeoutMs, retryPolicy, signal) {
|
|
1625
|
+
let method = options.method || "GET", path = url.replace(this.baseUrl, "").replace(this.linkApiUrl, ""), startTime = Date.now(), retryCount = 0, context = {
|
|
1626
|
+
method,
|
|
1627
|
+
path,
|
|
1628
|
+
url,
|
|
1629
|
+
body: options.body ? JSON.parse(options.body) : void 0,
|
|
1630
|
+
startTime
|
|
1631
|
+
};
|
|
1632
|
+
this.hooks.onRequestStart?.(context);
|
|
1633
|
+
let lastError, configuredMaxRetries = Math.max(0, Math.floor(this.maxRetries)), maxRetries = Math.min(
|
|
1634
|
+
configuredMaxRetries,
|
|
1635
|
+
Math.max(0, Math.floor(retryPolicy?.maxRetries ?? configuredMaxRetries))
|
|
1636
|
+
), jitterRatio = retryPolicy?.jitterRatio ?? 0;
|
|
1637
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++)
|
|
1638
|
+
try {
|
|
1639
|
+
if (signal?.aborted)
|
|
1640
|
+
throw new chunkUCR5HRYM_js.CimplifyError(chunkUCR5HRYM_js.ErrorCode.CANCELLED, "Request was cancelled.", !0);
|
|
1641
|
+
let controller = new AbortController(), timeoutId = setTimeout(() => controller.abort(), timeoutMs ?? this.timeout), onAbort = () => controller.abort();
|
|
1642
|
+
signal?.addEventListener("abort", onAbort, { once: !0 });
|
|
1643
|
+
let response;
|
|
1644
|
+
try {
|
|
1645
|
+
response = await this.fetchImpl(url, {
|
|
1646
|
+
...options,
|
|
1647
|
+
signal: controller.signal
|
|
1648
|
+
});
|
|
1649
|
+
} finally {
|
|
1650
|
+
clearTimeout(timeoutId), signal?.removeEventListener("abort", onAbort);
|
|
1651
|
+
}
|
|
1652
|
+
if (this.captureSessionToken(response), response.ok)
|
|
1653
|
+
return this.hooks.onRequestSuccess?.({
|
|
1654
|
+
...context,
|
|
1655
|
+
status: response.status,
|
|
1656
|
+
durationMs: Date.now() - startTime
|
|
1657
|
+
}), response;
|
|
1658
|
+
if (response.status === (503) && attempt < maxRetries) {
|
|
1659
|
+
retryCount++;
|
|
1660
|
+
let retryAfterMs = parseRetryAfterMs(response.headers.get(RETRY_AFTER_HEADER)), retryBaseMs = retryAfterMs ?? this.retryDelay * Math.pow(2, attempt), jitteredDelayMs = withPositiveJitter(retryBaseMs, jitterRatio), delay = retryAfterMs === null ? jitteredDelayMs : Math.min(jitteredDelayMs, (3e4));
|
|
1661
|
+
this.hooks.onRetry?.({
|
|
1662
|
+
...context,
|
|
1663
|
+
attempt: retryCount,
|
|
1664
|
+
delayMs: delay,
|
|
1665
|
+
error: new Error(`Retryable: ${response.status}`)
|
|
1666
|
+
}), await sleep(delay, signal);
|
|
1667
|
+
continue;
|
|
1668
|
+
}
|
|
1669
|
+
if (response.status >= 400 && response.status < 500)
|
|
1670
|
+
return this.hooks.onRequestError?.({
|
|
1671
|
+
...context,
|
|
1672
|
+
error: new chunkUCR5HRYM_js.CimplifyError(
|
|
1673
|
+
`HTTP_${response.status}`,
|
|
1674
|
+
`Request failed with status ${response.status}`,
|
|
1675
|
+
!1
|
|
1676
|
+
),
|
|
1677
|
+
status: response.status,
|
|
1678
|
+
durationMs: Date.now() - startTime,
|
|
1679
|
+
retryCount,
|
|
1680
|
+
retryable: !1
|
|
1681
|
+
}), response;
|
|
1682
|
+
if (response.status >= 500 && attempt < maxRetries) {
|
|
1683
|
+
retryCount++;
|
|
1684
|
+
let delay = withPositiveJitter(this.retryDelay * Math.pow(2, attempt), jitterRatio);
|
|
1685
|
+
this.hooks.onRetry?.({
|
|
1686
|
+
...context,
|
|
1687
|
+
attempt: retryCount,
|
|
1688
|
+
delayMs: delay,
|
|
1689
|
+
error: new Error(`Server error: ${response.status}`)
|
|
1690
|
+
}), await sleep(delay, signal);
|
|
1691
|
+
continue;
|
|
1692
|
+
}
|
|
1693
|
+
return this.hooks.onRequestError?.({
|
|
1694
|
+
...context,
|
|
1695
|
+
error: new chunkUCR5HRYM_js.CimplifyError(
|
|
1696
|
+
chunkUCR5HRYM_js.ErrorCode.SERVER_ERROR,
|
|
1697
|
+
`Server error ${response.status} after ${retryCount} retries`,
|
|
1698
|
+
!1
|
|
1699
|
+
),
|
|
1700
|
+
status: response.status,
|
|
1701
|
+
durationMs: Date.now() - startTime,
|
|
1702
|
+
retryCount,
|
|
1703
|
+
retryable: !1
|
|
1704
|
+
}), response;
|
|
1705
|
+
} catch (error) {
|
|
1706
|
+
if (lastError = error, signal?.aborted)
|
|
1707
|
+
throw new chunkUCR5HRYM_js.CimplifyError(chunkUCR5HRYM_js.ErrorCode.CANCELLED, "Request was cancelled.", true);
|
|
1708
|
+
let networkError = toNetworkError(error, this.isTestMode()), errorRetryable = isRetryable(error);
|
|
1709
|
+
if (!errorRetryable || attempt >= maxRetries)
|
|
1710
|
+
throw this.hooks.onRequestError?.({
|
|
1711
|
+
...context,
|
|
1712
|
+
error: networkError,
|
|
1713
|
+
durationMs: Date.now() - startTime,
|
|
1714
|
+
retryCount,
|
|
1715
|
+
retryable: errorRetryable
|
|
1716
|
+
}), networkError;
|
|
1717
|
+
retryCount++;
|
|
1718
|
+
let delay = withPositiveJitter(this.retryDelay * Math.pow(2, attempt), jitterRatio);
|
|
1719
|
+
this.hooks.onRetry?.({
|
|
1720
|
+
...context,
|
|
1721
|
+
attempt: retryCount,
|
|
1722
|
+
delayMs: delay,
|
|
1723
|
+
error: networkError
|
|
1724
|
+
}), await sleep(delay, signal);
|
|
1725
|
+
}
|
|
1726
|
+
let finalError = toNetworkError(lastError, this.isTestMode());
|
|
1727
|
+
throw this.hooks.onRequestError?.({
|
|
1728
|
+
...context,
|
|
1729
|
+
error: finalError,
|
|
1730
|
+
durationMs: Date.now() - startTime,
|
|
1731
|
+
retryCount,
|
|
1732
|
+
retryable: false
|
|
1733
|
+
}), finalError;
|
|
1734
|
+
}
|
|
1735
|
+
getDedupeKey(type, payload, cacheOptions) {
|
|
1736
|
+
let cacheKey = cacheOptions ? `|${JSON.stringify(cacheOptions)}` : "", identityKey = JSON.stringify([
|
|
1737
|
+
this.publicKey.trim(),
|
|
1738
|
+
this.publicKeyEpoch,
|
|
1739
|
+
this.sessionEpoch,
|
|
1740
|
+
this.context.location_id ?? null
|
|
1741
|
+
]);
|
|
1742
|
+
return `${type}:${identityKey}:${JSON.stringify(payload)}${cacheKey}`;
|
|
1743
|
+
}
|
|
1744
|
+
async deduplicatedRequest(key, requestFn) {
|
|
1745
|
+
let existing = this.inflightRequests.get(key);
|
|
1746
|
+
if (existing)
|
|
1747
|
+
return existing;
|
|
1748
|
+
let request = requestFn().finally(() => {
|
|
1749
|
+
this.inflightRequests.get(key) === request && this.inflightRequests.delete(key);
|
|
1750
|
+
});
|
|
1751
|
+
return this.inflightRequests.set(key, request), request;
|
|
1752
|
+
}
|
|
1753
|
+
async get(path, opts) {
|
|
1754
|
+
let request = async () => {
|
|
1755
|
+
let response = await this.authedFetch(
|
|
1756
|
+
this.buildUrl(this.baseUrl, path),
|
|
1757
|
+
{
|
|
1758
|
+
method: "GET",
|
|
1759
|
+
credentials: this.credentials,
|
|
1760
|
+
headers: this.getHeaders(),
|
|
1761
|
+
...nextInit(opts?.cacheOptions)
|
|
1762
|
+
},
|
|
1763
|
+
opts?.timeoutMs,
|
|
1764
|
+
opts?.retryPolicy,
|
|
1765
|
+
opts?.signal
|
|
1766
|
+
);
|
|
1767
|
+
return this.handleRestResponse(response);
|
|
1768
|
+
};
|
|
1769
|
+
if (opts?.signal) return request();
|
|
1770
|
+
let key = this.getDedupeKey("get", path, opts?.cacheOptions);
|
|
1771
|
+
return this.deduplicatedRequest(key, request);
|
|
1772
|
+
}
|
|
1773
|
+
async post(path, body, opts) {
|
|
1774
|
+
let response = await this.authedFetch(
|
|
1775
|
+
this.buildUrl(this.baseUrl, path),
|
|
1776
|
+
{
|
|
1777
|
+
method: "POST",
|
|
1778
|
+
credentials: this.credentials,
|
|
1779
|
+
headers: mergeOptionHeaders(this.getHeaders(), opts),
|
|
1780
|
+
body: body ? JSON.stringify(body) : void 0
|
|
1781
|
+
},
|
|
1782
|
+
opts?.timeoutMs,
|
|
1783
|
+
opts?.retryPolicy,
|
|
1784
|
+
opts?.signal
|
|
1785
|
+
);
|
|
1786
|
+
return this.handleRestResponse(response);
|
|
1787
|
+
}
|
|
1788
|
+
async patch(path, body, opts) {
|
|
1789
|
+
let response = await this.authedFetch(
|
|
1790
|
+
this.buildUrl(this.baseUrl, path),
|
|
1791
|
+
{
|
|
1792
|
+
method: "PATCH",
|
|
1793
|
+
credentials: this.credentials,
|
|
1794
|
+
headers: mergeOptionHeaders(this.getHeaders(), opts),
|
|
1795
|
+
body: body ? JSON.stringify(body) : void 0
|
|
1796
|
+
},
|
|
1797
|
+
opts?.timeoutMs,
|
|
1798
|
+
opts?.retryPolicy,
|
|
1799
|
+
opts?.signal
|
|
1800
|
+
);
|
|
1801
|
+
return this.handleRestResponse(response);
|
|
1802
|
+
}
|
|
1803
|
+
async delete(path, opts) {
|
|
1804
|
+
let response = await this.authedFetch(
|
|
1805
|
+
this.buildUrl(this.baseUrl, path),
|
|
1806
|
+
{
|
|
1807
|
+
method: "DELETE",
|
|
1808
|
+
credentials: this.credentials,
|
|
1809
|
+
headers: mergeOptionHeaders(this.getHeaders(), opts)
|
|
1810
|
+
},
|
|
1811
|
+
opts?.timeoutMs,
|
|
1812
|
+
opts?.retryPolicy,
|
|
1813
|
+
opts?.signal
|
|
1814
|
+
);
|
|
1815
|
+
return this.handleRestResponse(response);
|
|
1816
|
+
}
|
|
1817
|
+
async linkGet(path, opts) {
|
|
1818
|
+
let request = async () => {
|
|
1819
|
+
let response = await this.authedFetch(
|
|
1820
|
+
`${this.linkApiUrl}${path}`,
|
|
1821
|
+
{
|
|
1822
|
+
method: "GET",
|
|
1823
|
+
credentials: this.credentials,
|
|
1824
|
+
headers: this.getHeaders(),
|
|
1825
|
+
...nextInit(opts?.cacheOptions)
|
|
1826
|
+
},
|
|
1827
|
+
opts?.timeoutMs,
|
|
1828
|
+
opts?.retryPolicy,
|
|
1829
|
+
opts?.signal
|
|
1830
|
+
);
|
|
1831
|
+
return this.handleRestResponse(response);
|
|
1832
|
+
};
|
|
1833
|
+
if (opts?.signal) return request();
|
|
1834
|
+
let key = this.getDedupeKey("linkGet", path, opts?.cacheOptions);
|
|
1835
|
+
return this.deduplicatedRequest(key, request);
|
|
1836
|
+
}
|
|
1837
|
+
async linkPost(path, body, opts) {
|
|
1838
|
+
let response = await this.authedFetch(
|
|
1839
|
+
`${this.linkApiUrl}${path}`,
|
|
1840
|
+
{
|
|
1841
|
+
method: "POST",
|
|
1842
|
+
credentials: this.credentials,
|
|
1843
|
+
headers: mergeOptionHeaders(this.getHeaders(), opts),
|
|
1844
|
+
body: body ? JSON.stringify(body) : void 0
|
|
1845
|
+
},
|
|
1846
|
+
opts?.timeoutMs,
|
|
1847
|
+
opts?.retryPolicy,
|
|
1848
|
+
opts?.signal
|
|
1849
|
+
);
|
|
1850
|
+
return this.handleRestResponse(response);
|
|
1851
|
+
}
|
|
1852
|
+
async linkDelete(path, opts) {
|
|
1853
|
+
let response = await this.authedFetch(
|
|
1854
|
+
`${this.linkApiUrl}${path}`,
|
|
1855
|
+
{
|
|
1856
|
+
method: "DELETE",
|
|
1857
|
+
credentials: this.credentials,
|
|
1858
|
+
headers: mergeOptionHeaders(this.getHeaders(), opts)
|
|
1859
|
+
},
|
|
1860
|
+
opts?.timeoutMs,
|
|
1861
|
+
opts?.retryPolicy,
|
|
1862
|
+
opts?.signal
|
|
1863
|
+
);
|
|
1864
|
+
return this.handleRestResponse(response);
|
|
1865
|
+
}
|
|
1866
|
+
async handleRestResponse(response) {
|
|
1867
|
+
let serverFailure = response.status >= (500), json;
|
|
1868
|
+
try {
|
|
1869
|
+
json = await response.json();
|
|
1870
|
+
} catch {
|
|
1871
|
+
throw chunkUCR5HRYM_js.enrichError(
|
|
1872
|
+
new chunkUCR5HRYM_js.CimplifyError(
|
|
1873
|
+
serverFailure ? chunkUCR5HRYM_js.ErrorCode.SERVER_ERROR : chunkUCR5HRYM_js.ErrorCode.API_ERROR,
|
|
1874
|
+
serverFailure ? "The service is temporarily unavailable." : "The service returned an unreadable response.",
|
|
1875
|
+
serverFailure
|
|
1876
|
+
),
|
|
1877
|
+
{ isTestMode: this.isTestMode() }
|
|
1878
|
+
);
|
|
1879
|
+
}
|
|
1880
|
+
if (!response.ok) {
|
|
1881
|
+
let errorCode = typeof json.error == "object" && json.error?.error_code || typeof json.error == "object" && json.error?.code || chunkUCR5HRYM_js.ErrorCode.API_ERROR, errorMessage = typeof json.error == "object" && json.error?.error_message || typeof json.error == "object" && json.error?.message || typeof json.error == "string" && json.error || typeof json.message == "string" && json.message || "An error occurred", retryable = typeof json.error == "object" && typeof json.error?.retryable == "boolean" ? json.error.retryable : serverFailure;
|
|
1882
|
+
if (errorCode === chunkUCR5HRYM_js.ErrorCode.IDEMPOTENCY_MISMATCH) {
|
|
1883
|
+
let originalCreatedAt = typeof json.error == "object" && json.error?.original_created_at || "";
|
|
1884
|
+
throw new chunkUCR5HRYM_js.IdempotencyMismatchError(errorMessage, originalCreatedAt);
|
|
1885
|
+
}
|
|
1886
|
+
let error = chunkUCR5HRYM_js.enrichError(new chunkUCR5HRYM_js.CimplifyError(errorCode, errorMessage, retryable), {
|
|
1887
|
+
isTestMode: this.isTestMode()
|
|
1888
|
+
});
|
|
1889
|
+
if (response.status === (429)) {
|
|
1890
|
+
let retryAfterMs = retryAfterDelayMs(response.headers.get(RETRY_AFTER_HEADER));
|
|
1891
|
+
retryAfterMs !== null && (error.retryAfterMs = retryAfterMs);
|
|
1892
|
+
}
|
|
1893
|
+
throw (response.status === 401 || error.code === chunkUCR5HRYM_js.ErrorCode.UNAUTHORIZED) && this.accessToken && console.warn(
|
|
1894
|
+
"[Cimplify] Received 401 Unauthorized. Access token may be missing/expired. Refresh authentication and retry the request."
|
|
1895
|
+
), error;
|
|
1896
|
+
}
|
|
1897
|
+
if (json?.success === false || json?.error?.code || json?.error?.message)
|
|
1898
|
+
throw chunkUCR5HRYM_js.enrichError(
|
|
1899
|
+
new chunkUCR5HRYM_js.CimplifyError(
|
|
1900
|
+
json.error?.code || chunkUCR5HRYM_js.ErrorCode.API_ERROR,
|
|
1901
|
+
json.error?.message || "An error occurred",
|
|
1902
|
+
json.error?.retryable || false
|
|
1903
|
+
),
|
|
1904
|
+
{ isTestMode: this.isTestMode() }
|
|
1905
|
+
);
|
|
1906
|
+
return json?.data !== void 0 ? json.data : json;
|
|
1907
|
+
}
|
|
1908
|
+
get catalogue() {
|
|
1909
|
+
return this._catalogue || (this._catalogue = new chunkOMTVH334_js.CatalogueQueries(this)), this._catalogue;
|
|
1910
|
+
}
|
|
1911
|
+
get cart() {
|
|
1912
|
+
return this._cart || (this._cart = new chunkOMTVH334_js.CartOperations(this)), this._cart;
|
|
1913
|
+
}
|
|
1914
|
+
get checkout() {
|
|
1915
|
+
return this._checkout || (this._checkout = new chunkOMTVH334_js.CheckoutService(this)), this._checkout;
|
|
1916
|
+
}
|
|
1917
|
+
get purchaseIntents() {
|
|
1918
|
+
return this._purchaseIntents || (this._purchaseIntents = new PurchaseIntentService(this)), this._purchaseIntents;
|
|
1919
|
+
}
|
|
1920
|
+
get orders() {
|
|
1921
|
+
return this._orders || (this._orders = new chunkOMTVH334_js.OrderQueries(this)), this._orders;
|
|
1922
|
+
}
|
|
1923
|
+
get storeCredit() {
|
|
1924
|
+
return this._storeCredit || (this._storeCredit = new StoreCreditQueries(this)), this._storeCredit;
|
|
1925
|
+
}
|
|
1926
|
+
get subscriptions() {
|
|
1927
|
+
return this._subscriptions || (this._subscriptions = new SubscriptionService(this)), this._subscriptions;
|
|
1928
|
+
}
|
|
1929
|
+
get uploads() {
|
|
1930
|
+
return this._uploads || (this._uploads = new UploadService(this)), this._uploads;
|
|
1931
|
+
}
|
|
1932
|
+
get places() {
|
|
1933
|
+
return this._places || (this._places = new PlacesService(this)), this._places;
|
|
1934
|
+
}
|
|
1935
|
+
get link() {
|
|
1936
|
+
return this._link || (this._link = new chunkOMTVH334_js.LinkService(this)), this._link;
|
|
1937
|
+
}
|
|
1938
|
+
get auth() {
|
|
1939
|
+
return this._auth || (this._auth = new chunkOMTVH334_js.AuthService(this)), this._auth;
|
|
1940
|
+
}
|
|
1941
|
+
get business() {
|
|
1942
|
+
return this._business || (this._business = new chunkOMTVH334_js.BusinessService(this)), this._business;
|
|
1943
|
+
}
|
|
1944
|
+
get inventory() {
|
|
1945
|
+
return this._inventory || (this._inventory = new chunkOMTVH334_js.InventoryService(this)), this._inventory;
|
|
1946
|
+
}
|
|
1947
|
+
get scheduling() {
|
|
1948
|
+
return this._scheduling || (this._scheduling = new chunkOMTVH334_js.SchedulingService(this)), this._scheduling;
|
|
1949
|
+
}
|
|
1950
|
+
get lite() {
|
|
1951
|
+
return this._lite || (this._lite = new chunkOMTVH334_js.LiteService(this)), this._lite;
|
|
1952
|
+
}
|
|
1953
|
+
get fx() {
|
|
1954
|
+
return this._fx || (this._fx = new chunkOMTVH334_js.FxService(this)), this._fx;
|
|
1955
|
+
}
|
|
1956
|
+
get activity() {
|
|
1957
|
+
return this._activity || (this._activity = new ActivityService(this)), this._activity;
|
|
1958
|
+
}
|
|
1959
|
+
get delivery() {
|
|
1960
|
+
return this._delivery || (this._delivery = new DeliveryService(this)), this._delivery;
|
|
1961
|
+
}
|
|
1962
|
+
get support() {
|
|
1963
|
+
return this._support || (this._support = new SupportService(this)), this._support;
|
|
1964
|
+
}
|
|
1965
|
+
get session() {
|
|
1966
|
+
return this._session || (this._session = new SessionService(this)), this._session;
|
|
1967
|
+
}
|
|
1968
|
+
buildWsUrl(path) {
|
|
1969
|
+
let protocol = this.baseUrl.startsWith("https") ? "wss:" : "ws:", host = this.baseUrl.replace(/^https?:\/\//, ""), params = new URLSearchParams();
|
|
1970
|
+
this.publicKey && params.set("api_key", this.publicKey), this.sessionToken && params.set("session_token", this.sessionToken);
|
|
1971
|
+
let query = params.toString();
|
|
1972
|
+
return `${protocol}//${host}${path}${query ? `?${query}` : ""}`;
|
|
1973
|
+
}
|
|
1974
|
+
elements(businessId, options) {
|
|
1975
|
+
return businessId && this.setBusinessId(businessId), chunkOMTVH334_js.createElements(this, businessId ?? this.businessId ?? void 0, options);
|
|
1976
|
+
}
|
|
1977
|
+
};
|
|
1978
|
+
function createCimplifyClient(config = {}) {
|
|
1979
|
+
return new CimplifyClient(config);
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
exports.ActivityService = ActivityService;
|
|
1983
|
+
exports.CONTENT_SHA256_HEADER = CONTENT_SHA256_HEADER;
|
|
1984
|
+
exports.CimplifyClient = CimplifyClient;
|
|
1985
|
+
exports.DeliveryService = DeliveryService;
|
|
1986
|
+
exports.HostedPurchaseIntentService = HostedPurchaseIntentService;
|
|
1987
|
+
exports.PURCHASE_INTENT_ROUTE = PURCHASE_INTENT_ROUTE;
|
|
1988
|
+
exports.PlacesService = PlacesService;
|
|
1989
|
+
exports.PurchaseIntentResolver = PurchaseIntentResolver;
|
|
1990
|
+
exports.PurchaseIntentService = PurchaseIntentService;
|
|
1991
|
+
exports.SESSION_CHANGE_SOURCE = SESSION_CHANGE_SOURCE;
|
|
1992
|
+
exports.SessionService = SessionService;
|
|
1993
|
+
exports.StoreCreditQueries = StoreCreditQueries;
|
|
1994
|
+
exports.SubscriptionService = SubscriptionService;
|
|
1995
|
+
exports.SupportService = SupportService;
|
|
1996
|
+
exports.UploadService = UploadService;
|
|
1997
|
+
exports.chatRealtimeUpdateFromWire = chatRealtimeUpdateFromWire;
|
|
1998
|
+
exports.contentSha256 = contentSha256;
|
|
1999
|
+
exports.createCimplifyClient = createCimplifyClient;
|
|
2000
|
+
exports.isTransientPurchaseIntentError = isTransientPurchaseIntentError;
|