shopkit-analytics 1.0.13 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/adapters/index.js +11 -3
  2. package/dist/adapters/index.js.map +1 -1
  3. package/dist/adapters/index.mjs +3 -2
  4. package/dist/affiliate/index.mjs +1 -0
  5. package/dist/{chunk-VKBE75YB.mjs → chunk-BE3W2SD6.mjs} +2 -1
  6. package/dist/chunk-BE3W2SD6.mjs.map +1 -0
  7. package/dist/{chunk-OT32PIVB.mjs → chunk-CJ3NUEQH.mjs} +12 -4
  8. package/dist/chunk-CJ3NUEQH.mjs.map +1 -0
  9. package/dist/{chunk-DY7EQ7D2.mjs → chunk-FTZLYNBN.mjs} +3 -3
  10. package/dist/chunk-NIL3JVRZ.mjs +39 -0
  11. package/dist/events/index.d.mts +1 -1
  12. package/dist/events/index.d.ts +1 -1
  13. package/dist/events/index.js +10 -2
  14. package/dist/events/index.js.map +1 -1
  15. package/dist/events/index.mjs +4 -3
  16. package/dist/experiment/index.mjs +1 -0
  17. package/dist/index.d.mts +1 -1
  18. package/dist/index.d.ts +1 -1
  19. package/dist/index.js +774 -14
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +762 -9
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/services/index.mjs +2 -1
  24. package/dist/{subscriber-VF3IYUCU.mjs → subscriber-K6VCQXNV.mjs} +2 -1
  25. package/dist/subscriber-K6VCQXNV.mjs.map +1 -0
  26. package/dist/types.d.mts +8 -3
  27. package/dist/types.d.ts +8 -3
  28. package/dist/types.js +1 -0
  29. package/dist/types.js.map +1 -1
  30. package/dist/types.mjs +2 -1
  31. package/dist/utils/index.mjs +1 -0
  32. package/package.json +1 -1
  33. package/dist/chunk-OT32PIVB.mjs.map +0 -1
  34. package/dist/chunk-VKBE75YB.mjs.map +0 -1
  35. /package/dist/{chunk-DY7EQ7D2.mjs.map → chunk-FTZLYNBN.mjs.map} +0 -0
  36. /package/dist/{subscriber-VF3IYUCU.mjs.map → chunk-NIL3JVRZ.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  initTracking,
4
4
  initializeEventTracking
5
- } from "./chunk-DY7EQ7D2.mjs";
5
+ } from "./chunk-FTZLYNBN.mjs";
6
6
  import {
7
7
  eventPublisher,
8
8
  eventSubscriber,
@@ -33,7 +33,7 @@ import {
33
33
  createAdapterLogger,
34
34
  createLogger,
35
35
  logger
36
- } from "./chunk-OT32PIVB.mjs";
36
+ } from "./chunk-CJ3NUEQH.mjs";
37
37
  import {
38
38
  PRIMA_EXPERIMENT_COOKIES,
39
39
  PRIMA_EXPERIMENT_COOKIE_NAMES,
@@ -50,11 +50,767 @@ import {
50
50
  } from "./chunk-4RDPDMGW.mjs";
51
51
  import {
52
52
  EventType
53
- } from "./chunk-VKBE75YB.mjs";
53
+ } from "./chunk-BE3W2SD6.mjs";
54
+ import {
55
+ __commonJS,
56
+ __require,
57
+ __toESM
58
+ } from "./chunk-NIL3JVRZ.mjs";
59
+
60
+ // ../../node_modules/@swc/helpers/cjs/_interop_require_default.cjs
61
+ var require_interop_require_default = __commonJS({
62
+ "../../node_modules/@swc/helpers/cjs/_interop_require_default.cjs"(exports) {
63
+ "use strict";
64
+ exports._ = exports._interop_require_default = _interop_require_default;
65
+ function _interop_require_default(obj) {
66
+ return obj && obj.__esModule ? obj : { default: obj };
67
+ }
68
+ }
69
+ });
70
+
71
+ // ../../node_modules/next/dist/shared/lib/app-router-context.shared-runtime.js
72
+ var require_app_router_context_shared_runtime = __commonJS({
73
+ "../../node_modules/next/dist/shared/lib/app-router-context.shared-runtime.js"(exports) {
74
+ "use strict";
75
+ "use client";
76
+ Object.defineProperty(exports, "__esModule", {
77
+ value: true
78
+ });
79
+ function _export(target, all) {
80
+ for (var name in all) Object.defineProperty(target, name, {
81
+ enumerable: true,
82
+ get: all[name]
83
+ });
84
+ }
85
+ _export(exports, {
86
+ CacheStates: function() {
87
+ return CacheStates;
88
+ },
89
+ AppRouterContext: function() {
90
+ return AppRouterContext;
91
+ },
92
+ LayoutRouterContext: function() {
93
+ return LayoutRouterContext;
94
+ },
95
+ GlobalLayoutRouterContext: function() {
96
+ return GlobalLayoutRouterContext;
97
+ },
98
+ TemplateContext: function() {
99
+ return TemplateContext;
100
+ }
101
+ });
102
+ var _interop_require_default = require_interop_require_default();
103
+ var _react = /* @__PURE__ */ _interop_require_default._(__require("react"));
104
+ var CacheStates;
105
+ (function(CacheStates2) {
106
+ CacheStates2["LAZY_INITIALIZED"] = "LAZYINITIALIZED";
107
+ CacheStates2["DATA_FETCH"] = "DATAFETCH";
108
+ CacheStates2["READY"] = "READY";
109
+ })(CacheStates || (CacheStates = {}));
110
+ var AppRouterContext = _react.default.createContext(null);
111
+ var LayoutRouterContext = _react.default.createContext(null);
112
+ var GlobalLayoutRouterContext = _react.default.createContext(null);
113
+ var TemplateContext = _react.default.createContext(null);
114
+ if (process.env.NODE_ENV !== "production") {
115
+ AppRouterContext.displayName = "AppRouterContext";
116
+ LayoutRouterContext.displayName = "LayoutRouterContext";
117
+ GlobalLayoutRouterContext.displayName = "GlobalLayoutRouterContext";
118
+ TemplateContext.displayName = "TemplateContext";
119
+ }
120
+ }
121
+ });
122
+
123
+ // ../../node_modules/next/dist/shared/lib/hooks-client-context.shared-runtime.js
124
+ var require_hooks_client_context_shared_runtime = __commonJS({
125
+ "../../node_modules/next/dist/shared/lib/hooks-client-context.shared-runtime.js"(exports) {
126
+ "use strict";
127
+ "use client";
128
+ Object.defineProperty(exports, "__esModule", {
129
+ value: true
130
+ });
131
+ function _export(target, all) {
132
+ for (var name in all) Object.defineProperty(target, name, {
133
+ enumerable: true,
134
+ get: all[name]
135
+ });
136
+ }
137
+ _export(exports, {
138
+ SearchParamsContext: function() {
139
+ return SearchParamsContext;
140
+ },
141
+ PathnameContext: function() {
142
+ return PathnameContext;
143
+ },
144
+ PathParamsContext: function() {
145
+ return PathParamsContext;
146
+ }
147
+ });
148
+ var _react = __require("react");
149
+ var SearchParamsContext = (0, _react.createContext)(null);
150
+ var PathnameContext = (0, _react.createContext)(null);
151
+ var PathParamsContext = (0, _react.createContext)(null);
152
+ if (process.env.NODE_ENV !== "production") {
153
+ SearchParamsContext.displayName = "SearchParamsContext";
154
+ PathnameContext.displayName = "PathnameContext";
155
+ PathParamsContext.displayName = "PathParamsContext";
156
+ }
157
+ }
158
+ });
159
+
160
+ // ../../node_modules/next/dist/client/components/client-hook-in-server-component-error.js
161
+ var require_client_hook_in_server_component_error = __commonJS({
162
+ "../../node_modules/next/dist/client/components/client-hook-in-server-component-error.js"(exports, module) {
163
+ "use strict";
164
+ Object.defineProperty(exports, "__esModule", {
165
+ value: true
166
+ });
167
+ Object.defineProperty(exports, "clientHookInServerComponentError", {
168
+ enumerable: true,
169
+ get: function() {
170
+ return clientHookInServerComponentError;
171
+ }
172
+ });
173
+ var _interop_require_default = require_interop_require_default();
174
+ var _react = /* @__PURE__ */ _interop_require_default._(__require("react"));
175
+ function clientHookInServerComponentError(hookName) {
176
+ if (process.env.NODE_ENV !== "production") {
177
+ if (!_react.default.useState) {
178
+ throw new Error("" + hookName + ' only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/react-client-hook-in-server-component');
179
+ }
180
+ }
181
+ }
182
+ if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
183
+ Object.defineProperty(exports.default, "__esModule", { value: true });
184
+ Object.assign(exports.default, exports);
185
+ module.exports = exports.default;
186
+ }
187
+ }
188
+ });
189
+
190
+ // ../../node_modules/next/dist/client/components/router-reducer/reducers/get-segment-value.js
191
+ var require_get_segment_value = __commonJS({
192
+ "../../node_modules/next/dist/client/components/router-reducer/reducers/get-segment-value.js"(exports, module) {
193
+ "use strict";
194
+ Object.defineProperty(exports, "__esModule", {
195
+ value: true
196
+ });
197
+ Object.defineProperty(exports, "getSegmentValue", {
198
+ enumerable: true,
199
+ get: function() {
200
+ return getSegmentValue;
201
+ }
202
+ });
203
+ function getSegmentValue(segment) {
204
+ return Array.isArray(segment) ? segment[1] : segment;
205
+ }
206
+ if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
207
+ Object.defineProperty(exports.default, "__esModule", { value: true });
208
+ Object.assign(exports.default, exports);
209
+ module.exports = exports.default;
210
+ }
211
+ }
212
+ });
213
+
214
+ // ../../node_modules/@swc/helpers/cjs/_interop_require_wildcard.cjs
215
+ var require_interop_require_wildcard = __commonJS({
216
+ "../../node_modules/@swc/helpers/cjs/_interop_require_wildcard.cjs"(exports) {
217
+ "use strict";
218
+ function _getRequireWildcardCache(nodeInterop) {
219
+ if (typeof WeakMap !== "function") return null;
220
+ var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
221
+ var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
222
+ return (_getRequireWildcardCache = function(nodeInterop2) {
223
+ return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
224
+ })(nodeInterop);
225
+ }
226
+ exports._ = exports._interop_require_wildcard = _interop_require_wildcard;
227
+ function _interop_require_wildcard(obj, nodeInterop) {
228
+ if (!nodeInterop && obj && obj.__esModule) return obj;
229
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") return { default: obj };
230
+ var cache = _getRequireWildcardCache(nodeInterop);
231
+ if (cache && cache.has(obj)) return cache.get(obj);
232
+ var newObj = {};
233
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
234
+ for (var key in obj) {
235
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
236
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
237
+ if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
238
+ else newObj[key] = obj[key];
239
+ }
240
+ }
241
+ newObj.default = obj;
242
+ if (cache) cache.set(obj, newObj);
243
+ return newObj;
244
+ }
245
+ }
246
+ });
247
+
248
+ // ../../node_modules/next/dist/shared/lib/server-inserted-html.shared-runtime.js
249
+ var require_server_inserted_html_shared_runtime = __commonJS({
250
+ "../../node_modules/next/dist/shared/lib/server-inserted-html.shared-runtime.js"(exports) {
251
+ "use strict";
252
+ "use client";
253
+ Object.defineProperty(exports, "__esModule", {
254
+ value: true
255
+ });
256
+ function _export(target, all) {
257
+ for (var name in all) Object.defineProperty(target, name, {
258
+ enumerable: true,
259
+ get: all[name]
260
+ });
261
+ }
262
+ _export(exports, {
263
+ ServerInsertedHTMLContext: function() {
264
+ return ServerInsertedHTMLContext;
265
+ },
266
+ useServerInsertedHTML: function() {
267
+ return useServerInsertedHTML;
268
+ }
269
+ });
270
+ var _interop_require_wildcard = require_interop_require_wildcard();
271
+ var _react = /* @__PURE__ */ _interop_require_wildcard._(__require("react"));
272
+ var ServerInsertedHTMLContext = /* @__PURE__ */ _react.default.createContext(null);
273
+ function useServerInsertedHTML(callback) {
274
+ const addInsertedServerHTMLCallback = (0, _react.useContext)(ServerInsertedHTMLContext);
275
+ if (addInsertedServerHTMLCallback) {
276
+ addInsertedServerHTMLCallback(callback);
277
+ }
278
+ }
279
+ }
280
+ });
281
+
282
+ // ../../node_modules/next/dist/client/components/async-local-storage.js
283
+ var require_async_local_storage = __commonJS({
284
+ "../../node_modules/next/dist/client/components/async-local-storage.js"(exports, module) {
285
+ "use strict";
286
+ Object.defineProperty(exports, "__esModule", {
287
+ value: true
288
+ });
289
+ Object.defineProperty(exports, "createAsyncLocalStorage", {
290
+ enumerable: true,
291
+ get: function() {
292
+ return createAsyncLocalStorage;
293
+ }
294
+ });
295
+ var sharedAsyncLocalStorageNotAvailableError = new Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available");
296
+ var FakeAsyncLocalStorage = class {
297
+ disable() {
298
+ throw sharedAsyncLocalStorageNotAvailableError;
299
+ }
300
+ getStore() {
301
+ return void 0;
302
+ }
303
+ run() {
304
+ throw sharedAsyncLocalStorageNotAvailableError;
305
+ }
306
+ exit() {
307
+ throw sharedAsyncLocalStorageNotAvailableError;
308
+ }
309
+ enterWith() {
310
+ throw sharedAsyncLocalStorageNotAvailableError;
311
+ }
312
+ };
313
+ var maybeGlobalAsyncLocalStorage = globalThis.AsyncLocalStorage;
314
+ function createAsyncLocalStorage() {
315
+ if (maybeGlobalAsyncLocalStorage) {
316
+ return new maybeGlobalAsyncLocalStorage();
317
+ }
318
+ return new FakeAsyncLocalStorage();
319
+ }
320
+ if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
321
+ Object.defineProperty(exports.default, "__esModule", { value: true });
322
+ Object.assign(exports.default, exports);
323
+ module.exports = exports.default;
324
+ }
325
+ }
326
+ });
327
+
328
+ // ../../node_modules/next/dist/client/components/request-async-storage.external.js
329
+ var require_request_async_storage_external = __commonJS({
330
+ "../../node_modules/next/dist/client/components/request-async-storage.external.js"(exports, module) {
331
+ "use strict";
332
+ Object.defineProperty(exports, "__esModule", {
333
+ value: true
334
+ });
335
+ Object.defineProperty(exports, "requestAsyncStorage", {
336
+ enumerable: true,
337
+ get: function() {
338
+ return requestAsyncStorage;
339
+ }
340
+ });
341
+ var _asynclocalstorage = require_async_local_storage();
342
+ var requestAsyncStorage = (0, _asynclocalstorage.createAsyncLocalStorage)();
343
+ if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
344
+ Object.defineProperty(exports.default, "__esModule", { value: true });
345
+ Object.assign(exports.default, exports);
346
+ module.exports = exports.default;
347
+ }
348
+ }
349
+ });
350
+
351
+ // ../../node_modules/next/dist/client/components/redirect.js
352
+ var require_redirect = __commonJS({
353
+ "../../node_modules/next/dist/client/components/redirect.js"(exports, module) {
354
+ "use strict";
355
+ Object.defineProperty(exports, "__esModule", {
356
+ value: true
357
+ });
358
+ function _export(target, all) {
359
+ for (var name in all) Object.defineProperty(target, name, {
360
+ enumerable: true,
361
+ get: all[name]
362
+ });
363
+ }
364
+ _export(exports, {
365
+ RedirectType: function() {
366
+ return RedirectType;
367
+ },
368
+ getRedirectError: function() {
369
+ return getRedirectError;
370
+ },
371
+ redirect: function() {
372
+ return redirect;
373
+ },
374
+ permanentRedirect: function() {
375
+ return permanentRedirect;
376
+ },
377
+ isRedirectError: function() {
378
+ return isRedirectError;
379
+ },
380
+ getURLFromRedirectError: function() {
381
+ return getURLFromRedirectError;
382
+ },
383
+ getRedirectTypeFromError: function() {
384
+ return getRedirectTypeFromError;
385
+ }
386
+ });
387
+ var _requestasyncstorageexternal = require_request_async_storage_external();
388
+ var REDIRECT_ERROR_CODE = "NEXT_REDIRECT";
389
+ var RedirectType;
390
+ (function(RedirectType2) {
391
+ RedirectType2["push"] = "push";
392
+ RedirectType2["replace"] = "replace";
393
+ })(RedirectType || (RedirectType = {}));
394
+ function getRedirectError(url, type, permanent) {
395
+ if (permanent === void 0) permanent = false;
396
+ const error = new Error(REDIRECT_ERROR_CODE);
397
+ error.digest = REDIRECT_ERROR_CODE + ";" + type + ";" + url + ";" + permanent;
398
+ const requestStore = _requestasyncstorageexternal.requestAsyncStorage.getStore();
399
+ if (requestStore) {
400
+ error.mutableCookies = requestStore.mutableCookies;
401
+ }
402
+ return error;
403
+ }
404
+ function redirect(url, type) {
405
+ if (type === void 0) type = "replace";
406
+ throw getRedirectError(url, type, false);
407
+ }
408
+ function permanentRedirect(url, type) {
409
+ if (type === void 0) type = "replace";
410
+ throw getRedirectError(url, type, true);
411
+ }
412
+ function isRedirectError(error) {
413
+ if (typeof (error == null ? void 0 : error.digest) !== "string") return false;
414
+ const [errorCode, type, destination, permanent] = error.digest.split(";", 4);
415
+ return errorCode === REDIRECT_ERROR_CODE && (type === "replace" || type === "push") && typeof destination === "string" && (permanent === "true" || permanent === "false");
416
+ }
417
+ function getURLFromRedirectError(error) {
418
+ if (!isRedirectError(error)) return null;
419
+ return error.digest.split(";", 3)[2];
420
+ }
421
+ function getRedirectTypeFromError(error) {
422
+ if (!isRedirectError(error)) {
423
+ throw new Error("Not a redirect error");
424
+ }
425
+ return error.digest.split(";", 2)[1];
426
+ }
427
+ if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
428
+ Object.defineProperty(exports.default, "__esModule", { value: true });
429
+ Object.assign(exports.default, exports);
430
+ module.exports = exports.default;
431
+ }
432
+ }
433
+ });
434
+
435
+ // ../../node_modules/next/dist/client/components/not-found.js
436
+ var require_not_found = __commonJS({
437
+ "../../node_modules/next/dist/client/components/not-found.js"(exports, module) {
438
+ "use strict";
439
+ Object.defineProperty(exports, "__esModule", {
440
+ value: true
441
+ });
442
+ function _export(target, all) {
443
+ for (var name in all) Object.defineProperty(target, name, {
444
+ enumerable: true,
445
+ get: all[name]
446
+ });
447
+ }
448
+ _export(exports, {
449
+ notFound: function() {
450
+ return notFound;
451
+ },
452
+ isNotFoundError: function() {
453
+ return isNotFoundError;
454
+ }
455
+ });
456
+ var NOT_FOUND_ERROR_CODE = "NEXT_NOT_FOUND";
457
+ function notFound() {
458
+ const error = new Error(NOT_FOUND_ERROR_CODE);
459
+ error.digest = NOT_FOUND_ERROR_CODE;
460
+ throw error;
461
+ }
462
+ function isNotFoundError(error) {
463
+ return (error == null ? void 0 : error.digest) === NOT_FOUND_ERROR_CODE;
464
+ }
465
+ if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
466
+ Object.defineProperty(exports.default, "__esModule", { value: true });
467
+ Object.assign(exports.default, exports);
468
+ module.exports = exports.default;
469
+ }
470
+ }
471
+ });
472
+
473
+ // ../../node_modules/next/dist/shared/lib/lazy-dynamic/no-ssr-error.js
474
+ var require_no_ssr_error = __commonJS({
475
+ "../../node_modules/next/dist/shared/lib/lazy-dynamic/no-ssr-error.js"(exports) {
476
+ "use strict";
477
+ Object.defineProperty(exports, "__esModule", {
478
+ value: true
479
+ });
480
+ function _export(target, all) {
481
+ for (var name in all) Object.defineProperty(target, name, {
482
+ enumerable: true,
483
+ get: all[name]
484
+ });
485
+ }
486
+ _export(exports, {
487
+ NEXT_DYNAMIC_NO_SSR_CODE: function() {
488
+ return NEXT_DYNAMIC_NO_SSR_CODE;
489
+ },
490
+ throwWithNoSSR: function() {
491
+ return throwWithNoSSR;
492
+ }
493
+ });
494
+ var NEXT_DYNAMIC_NO_SSR_CODE = "NEXT_DYNAMIC_NO_SSR_CODE";
495
+ function throwWithNoSSR() {
496
+ const error = new Error(NEXT_DYNAMIC_NO_SSR_CODE);
497
+ error.digest = NEXT_DYNAMIC_NO_SSR_CODE;
498
+ throw error;
499
+ }
500
+ }
501
+ });
502
+
503
+ // ../../node_modules/next/dist/client/components/static-generation-async-storage.external.js
504
+ var require_static_generation_async_storage_external = __commonJS({
505
+ "../../node_modules/next/dist/client/components/static-generation-async-storage.external.js"(exports, module) {
506
+ "use strict";
507
+ Object.defineProperty(exports, "__esModule", {
508
+ value: true
509
+ });
510
+ Object.defineProperty(exports, "staticGenerationAsyncStorage", {
511
+ enumerable: true,
512
+ get: function() {
513
+ return staticGenerationAsyncStorage;
514
+ }
515
+ });
516
+ var _asynclocalstorage = require_async_local_storage();
517
+ var staticGenerationAsyncStorage = (0, _asynclocalstorage.createAsyncLocalStorage)();
518
+ if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
519
+ Object.defineProperty(exports.default, "__esModule", { value: true });
520
+ Object.assign(exports.default, exports);
521
+ module.exports = exports.default;
522
+ }
523
+ }
524
+ });
525
+
526
+ // ../../node_modules/next/dist/client/components/bailout-to-client-rendering.js
527
+ var require_bailout_to_client_rendering = __commonJS({
528
+ "../../node_modules/next/dist/client/components/bailout-to-client-rendering.js"(exports, module) {
529
+ "use strict";
530
+ Object.defineProperty(exports, "__esModule", {
531
+ value: true
532
+ });
533
+ Object.defineProperty(exports, "bailoutToClientRendering", {
534
+ enumerable: true,
535
+ get: function() {
536
+ return bailoutToClientRendering;
537
+ }
538
+ });
539
+ var _nossrerror = require_no_ssr_error();
540
+ var _staticgenerationasyncstorageexternal = require_static_generation_async_storage_external();
541
+ function bailoutToClientRendering() {
542
+ const staticGenerationStore = _staticgenerationasyncstorageexternal.staticGenerationAsyncStorage.getStore();
543
+ if (staticGenerationStore == null ? void 0 : staticGenerationStore.forceStatic) {
544
+ return true;
545
+ }
546
+ if (staticGenerationStore == null ? void 0 : staticGenerationStore.isStaticGeneration) {
547
+ (0, _nossrerror.throwWithNoSSR)();
548
+ }
549
+ return false;
550
+ }
551
+ if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
552
+ Object.defineProperty(exports.default, "__esModule", { value: true });
553
+ Object.assign(exports.default, exports);
554
+ module.exports = exports.default;
555
+ }
556
+ }
557
+ });
558
+
559
+ // ../../node_modules/next/dist/client/components/navigation.js
560
+ var require_navigation = __commonJS({
561
+ "../../node_modules/next/dist/client/components/navigation.js"(exports, module) {
562
+ "use strict";
563
+ Object.defineProperty(exports, "__esModule", {
564
+ value: true
565
+ });
566
+ function _export(target, all) {
567
+ for (var name in all) Object.defineProperty(target, name, {
568
+ enumerable: true,
569
+ get: all[name]
570
+ });
571
+ }
572
+ _export(exports, {
573
+ ReadonlyURLSearchParams: function() {
574
+ return ReadonlyURLSearchParams;
575
+ },
576
+ useSearchParams: function() {
577
+ return useSearchParams;
578
+ },
579
+ usePathname: function() {
580
+ return usePathname2;
581
+ },
582
+ ServerInsertedHTMLContext: function() {
583
+ return _serverinsertedhtmlsharedruntime.ServerInsertedHTMLContext;
584
+ },
585
+ useServerInsertedHTML: function() {
586
+ return _serverinsertedhtmlsharedruntime.useServerInsertedHTML;
587
+ },
588
+ useRouter: function() {
589
+ return useRouter;
590
+ },
591
+ useParams: function() {
592
+ return useParams;
593
+ },
594
+ useSelectedLayoutSegments: function() {
595
+ return useSelectedLayoutSegments;
596
+ },
597
+ useSelectedLayoutSegment: function() {
598
+ return useSelectedLayoutSegment;
599
+ },
600
+ redirect: function() {
601
+ return _redirect.redirect;
602
+ },
603
+ permanentRedirect: function() {
604
+ return _redirect.permanentRedirect;
605
+ },
606
+ RedirectType: function() {
607
+ return _redirect.RedirectType;
608
+ },
609
+ notFound: function() {
610
+ return _notfound.notFound;
611
+ }
612
+ });
613
+ var _react = __require("react");
614
+ var _approutercontextsharedruntime = require_app_router_context_shared_runtime();
615
+ var _hooksclientcontextsharedruntime = require_hooks_client_context_shared_runtime();
616
+ var _clienthookinservercomponenterror = require_client_hook_in_server_component_error();
617
+ var _getsegmentvalue = require_get_segment_value();
618
+ var _serverinsertedhtmlsharedruntime = require_server_inserted_html_shared_runtime();
619
+ var _redirect = require_redirect();
620
+ var _notfound = require_not_found();
621
+ var INTERNAL_URLSEARCHPARAMS_INSTANCE = Symbol("internal for urlsearchparams readonly");
622
+ function readonlyURLSearchParamsError() {
623
+ return new Error("ReadonlyURLSearchParams cannot be modified");
624
+ }
625
+ var ReadonlyURLSearchParams = class {
626
+ [Symbol.iterator]() {
627
+ return this[INTERNAL_URLSEARCHPARAMS_INSTANCE][Symbol.iterator]();
628
+ }
629
+ append() {
630
+ throw readonlyURLSearchParamsError();
631
+ }
632
+ delete() {
633
+ throw readonlyURLSearchParamsError();
634
+ }
635
+ set() {
636
+ throw readonlyURLSearchParamsError();
637
+ }
638
+ sort() {
639
+ throw readonlyURLSearchParamsError();
640
+ }
641
+ constructor(urlSearchParams) {
642
+ this[INTERNAL_URLSEARCHPARAMS_INSTANCE] = urlSearchParams;
643
+ this.entries = urlSearchParams.entries.bind(urlSearchParams);
644
+ this.forEach = urlSearchParams.forEach.bind(urlSearchParams);
645
+ this.get = urlSearchParams.get.bind(urlSearchParams);
646
+ this.getAll = urlSearchParams.getAll.bind(urlSearchParams);
647
+ this.has = urlSearchParams.has.bind(urlSearchParams);
648
+ this.keys = urlSearchParams.keys.bind(urlSearchParams);
649
+ this.values = urlSearchParams.values.bind(urlSearchParams);
650
+ this.toString = urlSearchParams.toString.bind(urlSearchParams);
651
+ this.size = urlSearchParams.size;
652
+ }
653
+ };
654
+ function useSearchParams() {
655
+ (0, _clienthookinservercomponenterror.clientHookInServerComponentError)("useSearchParams");
656
+ const searchParams = (0, _react.useContext)(_hooksclientcontextsharedruntime.SearchParamsContext);
657
+ const readonlySearchParams = (0, _react.useMemo)(() => {
658
+ if (!searchParams) {
659
+ return null;
660
+ }
661
+ return new ReadonlyURLSearchParams(searchParams);
662
+ }, [
663
+ searchParams
664
+ ]);
665
+ if (typeof window === "undefined") {
666
+ const { bailoutToClientRendering } = require_bailout_to_client_rendering();
667
+ if (bailoutToClientRendering()) {
668
+ return readonlySearchParams;
669
+ }
670
+ }
671
+ return readonlySearchParams;
672
+ }
673
+ function usePathname2() {
674
+ (0, _clienthookinservercomponenterror.clientHookInServerComponentError)("usePathname");
675
+ return (0, _react.useContext)(_hooksclientcontextsharedruntime.PathnameContext);
676
+ }
677
+ function useRouter() {
678
+ (0, _clienthookinservercomponenterror.clientHookInServerComponentError)("useRouter");
679
+ const router = (0, _react.useContext)(_approutercontextsharedruntime.AppRouterContext);
680
+ if (router === null) {
681
+ throw new Error("invariant expected app router to be mounted");
682
+ }
683
+ return router;
684
+ }
685
+ function getSelectedParams(tree, params) {
686
+ if (params === void 0) params = {};
687
+ const parallelRoutes = tree[1];
688
+ for (const parallelRoute of Object.values(parallelRoutes)) {
689
+ const segment = parallelRoute[0];
690
+ const isDynamicParameter = Array.isArray(segment);
691
+ const segmentValue = isDynamicParameter ? segment[1] : segment;
692
+ if (!segmentValue || segmentValue.startsWith("__PAGE__")) continue;
693
+ const isCatchAll = isDynamicParameter && (segment[2] === "c" || segment[2] === "oc");
694
+ if (isCatchAll) {
695
+ params[segment[0]] = segment[1].split("/");
696
+ } else if (isDynamicParameter) {
697
+ params[segment[0]] = segment[1];
698
+ }
699
+ params = getSelectedParams(parallelRoute, params);
700
+ }
701
+ return params;
702
+ }
703
+ function useParams() {
704
+ (0, _clienthookinservercomponenterror.clientHookInServerComponentError)("useParams");
705
+ const globalLayoutRouter = (0, _react.useContext)(_approutercontextsharedruntime.GlobalLayoutRouterContext);
706
+ const pathParams = (0, _react.useContext)(_hooksclientcontextsharedruntime.PathParamsContext);
707
+ return (0, _react.useMemo)(() => {
708
+ if (globalLayoutRouter == null ? void 0 : globalLayoutRouter.tree) {
709
+ return getSelectedParams(globalLayoutRouter.tree);
710
+ }
711
+ return pathParams;
712
+ }, [
713
+ globalLayoutRouter == null ? void 0 : globalLayoutRouter.tree,
714
+ pathParams
715
+ ]);
716
+ }
717
+ function getSelectedLayoutSegmentPath(tree, parallelRouteKey, first, segmentPath) {
718
+ if (first === void 0) first = true;
719
+ if (segmentPath === void 0) segmentPath = [];
720
+ let node;
721
+ if (first) {
722
+ node = tree[1][parallelRouteKey];
723
+ } else {
724
+ const parallelRoutes = tree[1];
725
+ var _parallelRoutes_children;
726
+ node = (_parallelRoutes_children = parallelRoutes.children) != null ? _parallelRoutes_children : Object.values(parallelRoutes)[0];
727
+ }
728
+ if (!node) return segmentPath;
729
+ const segment = node[0];
730
+ const segmentValue = (0, _getsegmentvalue.getSegmentValue)(segment);
731
+ if (!segmentValue || segmentValue.startsWith("__PAGE__")) return segmentPath;
732
+ segmentPath.push(segmentValue);
733
+ return getSelectedLayoutSegmentPath(node, parallelRouteKey, false, segmentPath);
734
+ }
735
+ function useSelectedLayoutSegments(parallelRouteKey) {
736
+ if (parallelRouteKey === void 0) parallelRouteKey = "children";
737
+ (0, _clienthookinservercomponenterror.clientHookInServerComponentError)("useSelectedLayoutSegments");
738
+ const { tree } = (0, _react.useContext)(_approutercontextsharedruntime.LayoutRouterContext);
739
+ return getSelectedLayoutSegmentPath(tree, parallelRouteKey);
740
+ }
741
+ function useSelectedLayoutSegment(parallelRouteKey) {
742
+ if (parallelRouteKey === void 0) parallelRouteKey = "children";
743
+ (0, _clienthookinservercomponenterror.clientHookInServerComponentError)("useSelectedLayoutSegment");
744
+ const selectedLayoutSegments = useSelectedLayoutSegments(parallelRouteKey);
745
+ if (selectedLayoutSegments.length === 0) {
746
+ return null;
747
+ }
748
+ return selectedLayoutSegments[0];
749
+ }
750
+ if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
751
+ Object.defineProperty(exports.default, "__esModule", { value: true });
752
+ Object.assign(exports.default, exports);
753
+ module.exports = exports.default;
754
+ }
755
+ }
756
+ });
757
+
758
+ // ../../node_modules/next/navigation.js
759
+ var require_navigation2 = __commonJS({
760
+ "../../node_modules/next/navigation.js"(exports, module) {
761
+ "use strict";
762
+ module.exports = require_navigation();
763
+ }
764
+ });
54
765
 
55
766
  // src/ShopkitAnalytics.tsx
56
- import { useEffect } from "react";
767
+ import { useEffect as useEffect2 } from "react";
768
+
769
+ // src/shopify/ShopifyAnalyticsScript.tsx
770
+ var import_navigation = __toESM(require_navigation2());
57
771
  import { useShopifyCookies } from "@shopify/hydrogen-react";
772
+ import { useEffect, useState } from "react";
773
+ function ShopifyAnalyticsScript({
774
+ domain
775
+ }) {
776
+ const pathname = (0, import_navigation.usePathname)();
777
+ const [sessionValid, setSessionValid] = useState(false);
778
+ useShopifyCookies({
779
+ hasUserConsent: true,
780
+ domain
781
+ });
782
+ useEffect(() => {
783
+ const validateSession = () => {
784
+ const shopifyY = document.cookie.includes("_shopify_y=");
785
+ const shopifyS = document.cookie.includes("_shopify_s=");
786
+ if (shopifyY && shopifyS) {
787
+ setSessionValid(true);
788
+ console.log("\u2705 Shopify Analytics session validated");
789
+ } else {
790
+ console.warn("\u26A0\uFE0F Shopify session cookies missing");
791
+ }
792
+ };
793
+ const timer = setTimeout(validateSession, 1e3);
794
+ return () => clearTimeout(timer);
795
+ }, []);
796
+ useEffect(() => {
797
+ if (typeof window !== "undefined") {
798
+ window.__shopifySessionValid = sessionValid;
799
+ }
800
+ }, [sessionValid]);
801
+ useEffect(() => {
802
+ const trackPageView = () => {
803
+ publishEvent({
804
+ type: "shopify_page_view" /* SHOPIFY_PAGE_VIEW */
805
+ });
806
+ };
807
+ const timer = setTimeout(trackPageView, 1500);
808
+ return () => clearTimeout(timer);
809
+ }, [pathname]);
810
+ return null;
811
+ }
812
+
813
+ // src/ShopkitAnalytics.tsx
58
814
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
59
815
  var ShopkitAnalytics = ({
60
816
  config,
@@ -62,11 +818,7 @@ var ShopkitAnalytics = ({
62
818
  onInitialized,
63
819
  onError
64
820
  }) => {
65
- useShopifyCookies({
66
- hasUserConsent: true,
67
- domain: config.shopify?.domain || ""
68
- });
69
- useEffect(() => {
821
+ useEffect2(() => {
70
822
  const initializeAnalytics = async () => {
71
823
  if (config.autoInitialize === false) return;
72
824
  const loggerConfig = {
@@ -163,6 +915,7 @@ var ShopkitAnalytics = ({
163
915
  autoCapture: config.affiliate?.autoCapture
164
916
  }
165
917
  ),
918
+ config.shopify?.domain && /* @__PURE__ */ jsx(ShopifyAnalyticsScript, { domain: config.shopify?.domain }),
166
919
  children ? /* @__PURE__ */ jsx(Fragment, { children }) : null
167
920
  ] });
168
921
  };