@infuro/cms-core 1.0.33 → 1.0.35

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 (164) hide show
  1. package/README.md +22 -6
  2. package/dist/OrderTrackPage-W3J6WIG2.js +426 -0
  3. package/dist/OrderTrackPage-Z6FCJQYY.cjs +428 -0
  4. package/dist/admin.cjs +34072 -20487
  5. package/dist/admin.d.cts +191 -9
  6. package/dist/admin.d.ts +191 -9
  7. package/dist/admin.js +33913 -20423
  8. package/dist/api.cjs +123 -16508
  9. package/dist/api.d.cts +633 -3
  10. package/dist/api.d.ts +633 -3
  11. package/dist/api.js +14 -16519
  12. package/dist/auth.cjs +196 -955
  13. package/dist/auth.d.cts +201 -42
  14. package/dist/auth.d.ts +201 -42
  15. package/dist/auth.js +4 -888
  16. package/dist/chunk-2XE4X74C.js +29602 -0
  17. package/dist/chunk-3DZRIZOD.cjs +52 -0
  18. package/dist/chunk-3KPNTQBV.cjs +620 -0
  19. package/dist/chunk-46GKADYE.cjs +84 -0
  20. package/dist/chunk-4TRPKBKO.js +589 -0
  21. package/dist/chunk-5ELSW2UP.js +150 -0
  22. package/dist/chunk-6KPQWRFW.js +171 -0
  23. package/dist/chunk-7NMT3GBR.cjs +29 -0
  24. package/dist/chunk-7YIBMQDR.cjs +86 -0
  25. package/dist/chunk-BGJAV67S.cjs +29710 -0
  26. package/dist/chunk-CNTSLED2.cjs +559 -0
  27. package/dist/chunk-CRFV5WJK.js +16 -0
  28. package/dist/chunk-D5FBNKQM.cjs +104 -0
  29. package/dist/chunk-EF2JBPDM.js +114 -0
  30. package/dist/chunk-EQPITOP6.js +543 -0
  31. package/dist/chunk-GO7PPYNU.js +76 -0
  32. package/dist/chunk-HF3L2GIT.cjs +194 -0
  33. package/dist/chunk-J7XHLOLO.js +830 -0
  34. package/dist/chunk-JBRR5UYL.js +87 -0
  35. package/dist/chunk-JC6DLWTE.js +21 -0
  36. package/dist/chunk-JHF4YYRC.cjs +188 -0
  37. package/dist/chunk-JXF23MPG.js +25 -0
  38. package/dist/chunk-MQBT33IV.js +48 -0
  39. package/dist/chunk-N44BJZ4C.cjs +123 -0
  40. package/dist/chunk-OOTLNH63.cjs +18 -0
  41. package/dist/chunk-PAMVINEX.cjs +577 -0
  42. package/dist/chunk-PNOKNSG2.cjs +222 -0
  43. package/dist/chunk-QM733NUK.js +186 -0
  44. package/dist/chunk-R73BKDRO.cjs +90 -0
  45. package/dist/chunk-SHUYVCID.js +4 -0
  46. package/dist/chunk-SYBOCAWB.js +97 -0
  47. package/dist/chunk-TDV6EJHV.js +192 -0
  48. package/dist/chunk-TFUOHI37.cjs +839 -0
  49. package/dist/chunk-TIAEXJLI.cjs +182 -0
  50. package/dist/chunk-UPLVMVRX.cjs +23 -0
  51. package/dist/chunk-USNT2KNT.cjs +6 -0
  52. package/dist/chunk-WEMDMVHQ.js +216 -0
  53. package/dist/chunk-XDSNZUW7.js +564 -0
  54. package/dist/chunk-XQ3QUHWR.cjs +83 -0
  55. package/dist/chunk-XW5ATPRW.cjs +155 -0
  56. package/dist/chunk-ZQ4X6OAU.js +82 -0
  57. package/dist/chunk-ZSVCP6N3.js +83 -0
  58. package/dist/cli.cjs +142 -84
  59. package/dist/cli.js +101 -27
  60. package/dist/email-FKR4FXFI.js +5 -0
  61. package/dist/email-KVKVPNCL.cjs +58 -0
  62. package/dist/email-queue-CGZBVVAS.js +2 -0
  63. package/dist/email-queue-TPZWLTIV.cjs +23 -0
  64. package/dist/erp-config-enabled-CUMQ6N2V.cjs +11 -0
  65. package/dist/erp-config-enabled-T37X7T34.js +2 -0
  66. package/dist/erp-order-invoice-3YISSOWW.js +3 -0
  67. package/dist/erp-order-invoice-ZR5F2KTA.cjs +12 -0
  68. package/dist/event-order-defaults-6E543227.js +2 -0
  69. package/dist/event-order-defaults-DUGDVGJI.cjs +39 -0
  70. package/dist/event-order-notifications-5GSAOYVS.cjs +27 -0
  71. package/dist/event-order-notifications-IIIF23D5.js +10 -0
  72. package/dist/hooks.cjs +259 -132
  73. package/dist/hooks.d.cts +42 -1
  74. package/dist/hooks.d.ts +42 -1
  75. package/dist/hooks.js +234 -91
  76. package/dist/index.cjs +3884 -21070
  77. package/dist/index.d.cts +2255 -749
  78. package/dist/index.d.ts +2255 -749
  79. package/dist/index.js +1925 -19891
  80. package/dist/interpolate-WAKPN56R.cjs +11 -0
  81. package/dist/interpolate-WDUWDF3I.js +2 -0
  82. package/dist/layout-36UFTHC5.cjs +11 -0
  83. package/dist/layout-AOBN26XG.js +2 -0
  84. package/dist/migrations/1778660000004-CreateCustomerAndCustomerContacts.ts +99 -0
  85. package/dist/migrations/1778660000005-AddCustomerIdToVendorCustomers.ts +39 -0
  86. package/dist/migrations/1778660000006-UpdateVendorCustomersContactNullable.ts +36 -0
  87. package/dist/migrations/1778660000007-VendorOwnerCustomerContactsPermission.ts +39 -0
  88. package/dist/migrations/1779300000000-VendorOwnerContactsPermission.ts +39 -0
  89. package/dist/migrations/1779400000000-AddCustomerContactIdToOrders.ts +33 -0
  90. package/dist/migrations/1779400000000-ConvertStatusToEnum.ts +142 -0
  91. package/dist/migrations/1779400000000-SeedDefaultCurrencies.ts +33 -0
  92. package/dist/migrations/1779500000000-VendorRolesAndPermissions.ts +102 -0
  93. package/dist/migrations/1779600000000-VendorRegistrationProfile.ts +52 -0
  94. package/dist/migrations/1779700000000-CollectionIsCatalog.ts +22 -0
  95. package/dist/migrations/1779710000000-CollectionPlatformCatalog.ts +60 -0
  96. package/dist/migrations/1779720000000-ProductCategoryPlatformCatalog.ts +157 -0
  97. package/dist/migrations/1779800000000-EventsAndEventProducts.ts +173 -0
  98. package/dist/migrations/1779810000000-BackfillVendorRoleEventsPermissions.ts +38 -0
  99. package/dist/migrations/1779820000000-FixProductsCategoryForeignKey.ts +70 -0
  100. package/dist/migrations/1779830000000-ProductTitleColumn.ts +32 -0
  101. package/dist/migrations/1779840000000-EventAboutAndVisibilityFields.ts +34 -0
  102. package/dist/migrations/1779850000000-EventCityCountrySplit.ts +43 -0
  103. package/dist/migrations/1779860000000-CreateCombos.ts +140 -0
  104. package/dist/migrations/1780100000000-OrderAttendeesEventId.ts +55 -0
  105. package/dist/migrations/1780110000000-EventContactFormId.ts +49 -0
  106. package/dist/migrations/1780130000000-ProductVariants.ts +54 -0
  107. package/dist/migrations/1780140000000-EventManagementEnhancements.ts +44 -0
  108. package/dist/migrations/1780160000000-EventRegistrationGstProductContactForm.ts +79 -0
  109. package/dist/migrations/1780170000000-ComboCurrencyPrices.ts +20 -0
  110. package/dist/migrations/1781110000000-VendorOwnerCombosPermission.ts +38 -0
  111. package/dist/migrations/1781120000000-RefundPoliciesAndRequests.ts +225 -0
  112. package/dist/migrations/1781130000000-CreateAttendees.ts +44 -0
  113. package/dist/migrations/1781140000000-EventOrderNotifications.ts +29 -0
  114. package/dist/migrations/1781150000000-EventNamedLists.ts +28 -0
  115. package/dist/migrations/1781160000000-RefundPolicyEventTiers.ts +27 -0
  116. package/dist/migrations/1781170000000-EventRefundPolicy.ts +42 -0
  117. package/dist/migrations/1781180000000-RemoveCartItemsUniqueConstraint.ts +15 -0
  118. package/dist/migrations/1781190000000-RenameProductTaxesToProductConfig.ts +84 -0
  119. package/dist/migrations/1781200000000-VendorOwnerProductConfigPermissions.ts +51 -0
  120. package/dist/migrations/1781210000000-VendorRoleProductConfigPermissions.ts +46 -0
  121. package/dist/migrations/helpers/vendor-role-seed.ts +243 -0
  122. package/dist/paid-order-erp-3USEG6WL.js +3 -0
  123. package/dist/paid-order-erp-FSQ3GSXE.cjs +12 -0
  124. package/dist/pg-boss-service-4XF2TQ2E.js +2 -0
  125. package/dist/pg-boss-service-L6MTF4EQ.cjs +15 -0
  126. package/dist/razorpay-KLO2KNCB.js +49 -0
  127. package/dist/razorpay-U23LGY72.cjs +56 -0
  128. package/dist/rbac-debug-db-D7ME7QUY.cjs +35 -0
  129. package/dist/rbac-debug-db-MTCTVNNM.js +33 -0
  130. package/dist/sms-defaults-2NL24H57.js +2 -0
  131. package/dist/sms-defaults-KCOPKQBA.cjs +19 -0
  132. package/dist/stripe-4FD27QVJ.js +51 -0
  133. package/dist/stripe-VU6OEG2D.cjs +57 -0
  134. package/dist/theme.cjs +31 -59
  135. package/dist/theme.d.cts +78 -3
  136. package/dist/theme.d.ts +78 -3
  137. package/dist/theme.js +23 -20
  138. package/dist/vendor-invite-status-77O7ZQ3U.cjs +19 -0
  139. package/dist/vendor-invite-status-PWJ3DE76.js +2 -0
  140. package/dist/whatsapp-queue-3DXA4MXU.js +2 -0
  141. package/dist/whatsapp-queue-KG65MXD5.cjs +15 -0
  142. package/package.json +147 -141
  143. package/dist/admin.cjs.map +0 -1
  144. package/dist/admin.js.map +0 -1
  145. package/dist/api.cjs.map +0 -1
  146. package/dist/api.js.map +0 -1
  147. package/dist/auth.cjs.map +0 -1
  148. package/dist/auth.js.map +0 -1
  149. package/dist/cli.cjs.map +0 -1
  150. package/dist/cli.js.map +0 -1
  151. package/dist/config-DJ5CmQvS.d.cts +0 -8
  152. package/dist/config-DJ5CmQvS.d.ts +0 -8
  153. package/dist/hooks.cjs.map +0 -1
  154. package/dist/hooks.js.map +0 -1
  155. package/dist/index-DWd5Gjc4.d.ts +0 -582
  156. package/dist/index-rZTnpK7y.d.cts +0 -582
  157. package/dist/index.cjs.map +0 -1
  158. package/dist/index.js.map +0 -1
  159. package/dist/theme.cjs.map +0 -1
  160. package/dist/theme.js.map +0 -1
  161. package/dist/types-DCVaXlPV.d.cts +0 -78
  162. package/dist/types-DCVaXlPV.d.ts +0 -78
  163. package/dist/vendor-scope-DTYhJk_I.d.cts +0 -129
  164. package/dist/vendor-scope-DTYhJk_I.d.ts +0 -129
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ var chunkXW5ATPRW_cjs = require('./chunk-XW5ATPRW.cjs');
4
+ require('./chunk-USNT2KNT.cjs');
5
+
6
+
7
+
8
+ Object.defineProperty(exports, "queueEmail", {
9
+ enumerable: true,
10
+ get: function () { return chunkXW5ATPRW_cjs.queueEmail; }
11
+ });
12
+ Object.defineProperty(exports, "queueOrderPlacedEmails", {
13
+ enumerable: true,
14
+ get: function () { return chunkXW5ATPRW_cjs.queueOrderPlacedEmails; }
15
+ });
16
+ Object.defineProperty(exports, "queueVendorOnboardEmails", {
17
+ enumerable: true,
18
+ get: function () { return chunkXW5ATPRW_cjs.queueVendorOnboardEmails; }
19
+ });
20
+ Object.defineProperty(exports, "registerEmailQueueProcessor", {
21
+ enumerable: true,
22
+ get: function () { return chunkXW5ATPRW_cjs.registerEmailQueueProcessor; }
23
+ });
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ var chunkUPLVMVRX_cjs = require('./chunk-UPLVMVRX.cjs');
4
+ require('./chunk-USNT2KNT.cjs');
5
+
6
+
7
+
8
+ Object.defineProperty(exports, "isErpIntegrationEnabled", {
9
+ enumerable: true,
10
+ get: function () { return chunkUPLVMVRX_cjs.isErpIntegrationEnabled; }
11
+ });
@@ -0,0 +1,2 @@
1
+ export { isErpIntegrationEnabled } from './chunk-JC6DLWTE.js';
2
+ import './chunk-SHUYVCID.js';
@@ -0,0 +1,3 @@
1
+ export { streamOrderInvoicePdf } from './chunk-WEMDMVHQ.js';
2
+ import './chunk-JC6DLWTE.js';
3
+ import './chunk-SHUYVCID.js';
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var chunkPNOKNSG2_cjs = require('./chunk-PNOKNSG2.cjs');
4
+ require('./chunk-UPLVMVRX.cjs');
5
+ require('./chunk-USNT2KNT.cjs');
6
+
7
+
8
+
9
+ Object.defineProperty(exports, "streamOrderInvoicePdf", {
10
+ enumerable: true,
11
+ get: function () { return chunkPNOKNSG2_cjs.streamOrderInvoicePdf; }
12
+ });
@@ -0,0 +1,2 @@
1
+ export { EVENT_ORDER_MESSAGE_TEMPLATE_DEFAULTS, EVENT_ORDER_TEMPLATE_KEY, EVENT_ORDER_TEMPLATE_VARIABLES, EVENT_ORDER_TEMPLATE_VARIABLE_HINTS, EVENT_ORDER_WHATSAPP_PARAM_KEYS, getEventOrderTemplateDefault, pickWhatsAppTemplateParams, resolveEventOrderTemplate } from './chunk-EF2JBPDM.js';
2
+ import './chunk-SHUYVCID.js';
@@ -0,0 +1,39 @@
1
+ 'use strict';
2
+
3
+ var chunkN44BJZ4C_cjs = require('./chunk-N44BJZ4C.cjs');
4
+ require('./chunk-USNT2KNT.cjs');
5
+
6
+
7
+
8
+ Object.defineProperty(exports, "EVENT_ORDER_MESSAGE_TEMPLATE_DEFAULTS", {
9
+ enumerable: true,
10
+ get: function () { return chunkN44BJZ4C_cjs.EVENT_ORDER_MESSAGE_TEMPLATE_DEFAULTS; }
11
+ });
12
+ Object.defineProperty(exports, "EVENT_ORDER_TEMPLATE_KEY", {
13
+ enumerable: true,
14
+ get: function () { return chunkN44BJZ4C_cjs.EVENT_ORDER_TEMPLATE_KEY; }
15
+ });
16
+ Object.defineProperty(exports, "EVENT_ORDER_TEMPLATE_VARIABLES", {
17
+ enumerable: true,
18
+ get: function () { return chunkN44BJZ4C_cjs.EVENT_ORDER_TEMPLATE_VARIABLES; }
19
+ });
20
+ Object.defineProperty(exports, "EVENT_ORDER_TEMPLATE_VARIABLE_HINTS", {
21
+ enumerable: true,
22
+ get: function () { return chunkN44BJZ4C_cjs.EVENT_ORDER_TEMPLATE_VARIABLE_HINTS; }
23
+ });
24
+ Object.defineProperty(exports, "EVENT_ORDER_WHATSAPP_PARAM_KEYS", {
25
+ enumerable: true,
26
+ get: function () { return chunkN44BJZ4C_cjs.EVENT_ORDER_WHATSAPP_PARAM_KEYS; }
27
+ });
28
+ Object.defineProperty(exports, "getEventOrderTemplateDefault", {
29
+ enumerable: true,
30
+ get: function () { return chunkN44BJZ4C_cjs.getEventOrderTemplateDefault; }
31
+ });
32
+ Object.defineProperty(exports, "pickWhatsAppTemplateParams", {
33
+ enumerable: true,
34
+ get: function () { return chunkN44BJZ4C_cjs.pickWhatsAppTemplateParams; }
35
+ });
36
+ Object.defineProperty(exports, "resolveEventOrderTemplate", {
37
+ enumerable: true,
38
+ get: function () { return chunkN44BJZ4C_cjs.resolveEventOrderTemplate; }
39
+ });
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ var chunkJHF4YYRC_cjs = require('./chunk-JHF4YYRC.cjs');
4
+ require('./chunk-TFUOHI37.cjs');
5
+ require('./chunk-46GKADYE.cjs');
6
+ require('./chunk-OOTLNH63.cjs');
7
+ require('./chunk-7YIBMQDR.cjs');
8
+ var chunkR73BKDRO_cjs = require('./chunk-R73BKDRO.cjs');
9
+ require('./chunk-PAMVINEX.cjs');
10
+ require('./chunk-XW5ATPRW.cjs');
11
+ var chunkN44BJZ4C_cjs = require('./chunk-N44BJZ4C.cjs');
12
+ require('./chunk-USNT2KNT.cjs');
13
+
14
+
15
+
16
+ Object.defineProperty(exports, "dispatchEventOrderNotifications", {
17
+ enumerable: true,
18
+ get: function () { return chunkJHF4YYRC_cjs.dispatchEventOrderNotifications; }
19
+ });
20
+ Object.defineProperty(exports, "buildEventOrderTemplateVariables", {
21
+ enumerable: true,
22
+ get: function () { return chunkR73BKDRO_cjs.buildEventOrderTemplateVariables; }
23
+ });
24
+ Object.defineProperty(exports, "EVENT_ORDER_TEMPLATE_VARIABLES", {
25
+ enumerable: true,
26
+ get: function () { return chunkN44BJZ4C_cjs.EVENT_ORDER_TEMPLATE_VARIABLES; }
27
+ });
@@ -0,0 +1,10 @@
1
+ export { dispatchEventOrderNotifications } from './chunk-QM733NUK.js';
2
+ import './chunk-J7XHLOLO.js';
3
+ import './chunk-ZQ4X6OAU.js';
4
+ import './chunk-CRFV5WJK.js';
5
+ import './chunk-ZSVCP6N3.js';
6
+ export { buildEventOrderTemplateVariables } from './chunk-JBRR5UYL.js';
7
+ import './chunk-XDSNZUW7.js';
8
+ import './chunk-5ELSW2UP.js';
9
+ export { EVENT_ORDER_TEMPLATE_VARIABLES } from './chunk-EF2JBPDM.js';
10
+ import './chunk-SHUYVCID.js';
package/dist/hooks.cjs CHANGED
@@ -1,64 +1,162 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ 'use strict';
2
+
3
+ var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
4
+ var React2 = require('react');
29
5
 
30
- // src/hooks/index.ts
31
- var hooks_exports = {};
32
- __export(hooks_exports, {
33
- CaptchaProvider: () => CaptchaProvider,
34
- PluginProvider: () => PluginProvider,
35
- useAnalytics: () => useAnalytics,
36
- useCaptchaPayload: () => useCaptchaPayload,
37
- useIsMobile: () => useIsMobile,
38
- usePlugin: () => usePlugin
39
- });
40
- module.exports = __toCommonJS(hooks_exports);
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var React2__default = /*#__PURE__*/_interopDefault(React2);
41
9
 
42
- // src/hooks/use-mobile.ts
43
- var import_react = require("react");
44
10
  var MOBILE_BREAKPOINT = 768;
45
11
  function useIsMobile() {
46
- const [isMobile, setIsMobile] = (0, import_react.useState)(void 0);
47
- (0, import_react.useEffect)(() => {
12
+ const [isMobile, setIsMobile] = React2.useState(void 0);
13
+ React2.useEffect(() => {
48
14
  const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
49
- const onChange = () => setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
15
+ const onChange = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(() => setIsMobile(window.innerWidth < MOBILE_BREAKPOINT), "onChange");
50
16
  mql.addEventListener("change", onChange);
51
17
  setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
52
18
  return () => mql.removeEventListener("change", onChange);
53
19
  }, []);
54
20
  return !!isMobile;
55
21
  }
56
-
57
- // src/hooks/use-analytics.ts
58
- var import_react2 = require("react");
22
+ chunkUSNT2KNT_cjs.__name(useIsMobile, "useIsMobile");
23
+ function useCatalogCategories(enabled = true) {
24
+ const [categories, setCategories] = React2.useState([]);
25
+ const [loading, setLoading] = React2.useState(enabled);
26
+ const [error, setError] = React2.useState(null);
27
+ React2.useEffect(() => {
28
+ if (!enabled) {
29
+ setLoading(false);
30
+ return;
31
+ }
32
+ let cancelled = false;
33
+ setLoading(true);
34
+ (async () => {
35
+ try {
36
+ const res = await fetch("/api/product_categories?limit=500&sortField=sortOrder&sortOrder=asc&active=true&isCatalog=true");
37
+ const data = await res.json().catch(() => ({}));
38
+ if (!res.ok) {
39
+ const msg = typeof data.error === "string" ? data.error : "Failed to load categories";
40
+ throw new Error(msg);
41
+ }
42
+ if (cancelled) return;
43
+ const rows = Array.isArray(data.data) ? data.data : [];
44
+ setCategories(rows.filter((c) => c.active !== false));
45
+ } catch (e) {
46
+ if (!cancelled) {
47
+ setError(e instanceof Error ? e.message : "Could not load categories");
48
+ }
49
+ } finally {
50
+ if (!cancelled) setLoading(false);
51
+ }
52
+ })();
53
+ return () => {
54
+ cancelled = true;
55
+ };
56
+ }, [
57
+ enabled
58
+ ]);
59
+ return {
60
+ categories,
61
+ loading,
62
+ error
63
+ };
64
+ }
65
+ chunkUSNT2KNT_cjs.__name(useCatalogCategories, "useCatalogCategories");
66
+ function vendorCategoryWorkspaceUrl(categoryId, collectionId) {
67
+ const params = new URLSearchParams({
68
+ categoryId: String(categoryId)
69
+ });
70
+ if (collectionId != null && String(collectionId).trim() !== "") {
71
+ params.set("collectionId", String(collectionId));
72
+ }
73
+ return `/admin/products?${params.toString()}`;
74
+ }
75
+ chunkUSNT2KNT_cjs.__name(vendorCategoryWorkspaceUrl, "vendorCategoryWorkspaceUrl");
76
+ function vendorCollectionCreateUrl(categoryId, from, options) {
77
+ const params = new URLSearchParams({
78
+ categoryId: String(categoryId)
79
+ });
80
+ if (options?.isCatalog) params.set("isCatalog", "true");
81
+ const base = `/admin/collections/create?${params.toString()}`;
82
+ return from ? `${base}&from=${encodeURIComponent(from)}` : base;
83
+ }
84
+ chunkUSNT2KNT_cjs.__name(vendorCollectionCreateUrl, "vendorCollectionCreateUrl");
85
+ function vendorProductCreateUrl(categoryId, options) {
86
+ const params = new URLSearchParams({
87
+ categoryId: String(categoryId)
88
+ });
89
+ if (options?.collectionId != null && String(options.collectionId).trim() !== "") {
90
+ params.set("collectionId", String(options.collectionId));
91
+ }
92
+ if (options?.eventId != null && String(options.eventId).trim() !== "") {
93
+ params.set("eventId", String(options.eventId));
94
+ }
95
+ const base = `/admin/products/create?${params.toString()}`;
96
+ return options?.from ? `${base}&from=${encodeURIComponent(options.from)}` : base;
97
+ }
98
+ chunkUSNT2KNT_cjs.__name(vendorProductCreateUrl, "vendorProductCreateUrl");
99
+ function vendorEventProductCreateUrl(eventId, options) {
100
+ const params = new URLSearchParams({
101
+ eventId: String(eventId)
102
+ });
103
+ if (options?.categoryId != null && String(options.categoryId).trim() !== "") {
104
+ params.set("categoryId", String(options.categoryId));
105
+ }
106
+ const base = `/admin/products/create?${params.toString()}`;
107
+ return options?.from ? `${base}&from=${encodeURIComponent(options.from)}` : base;
108
+ }
109
+ chunkUSNT2KNT_cjs.__name(vendorEventProductCreateUrl, "vendorEventProductCreateUrl");
110
+ function useCatalogCollections(enabled = true) {
111
+ const [collections, setCollections] = React2.useState([]);
112
+ const [loading, setLoading] = React2.useState(enabled);
113
+ const [error, setError] = React2.useState(null);
114
+ React2.useEffect(() => {
115
+ if (!enabled) {
116
+ setLoading(false);
117
+ return;
118
+ }
119
+ let cancelled = false;
120
+ setLoading(true);
121
+ (async () => {
122
+ try {
123
+ const res = await fetch("/api/collections?limit=500&sortField=sortOrder&sortOrder=asc&active=true&isCatalog=true");
124
+ const data = await res.json().catch(() => ({}));
125
+ if (!res.ok) {
126
+ const msg = typeof data.error === "string" ? data.error : "Failed to load collections";
127
+ throw new Error(msg);
128
+ }
129
+ if (cancelled) return;
130
+ const rows = Array.isArray(data.data) ? data.data : [];
131
+ setCollections(rows.filter((c) => c.active !== false));
132
+ } catch (e) {
133
+ if (!cancelled) {
134
+ setError(e instanceof Error ? e.message : "Could not load collections");
135
+ }
136
+ } finally {
137
+ if (!cancelled) setLoading(false);
138
+ }
139
+ })();
140
+ return () => {
141
+ cancelled = true;
142
+ };
143
+ }, [
144
+ enabled
145
+ ]);
146
+ return {
147
+ collections,
148
+ loading,
149
+ error
150
+ };
151
+ }
152
+ chunkUSNT2KNT_cjs.__name(useCatalogCollections, "useCatalogCollections");
153
+ function vendorCollectionProductsUrl(collectionId) {
154
+ return `/admin/products?collectionId=${collectionId}`;
155
+ }
156
+ chunkUSNT2KNT_cjs.__name(vendorCollectionProductsUrl, "vendorCollectionProductsUrl");
59
157
  function useAnalytics(pathname) {
60
158
  const isAdminRoute = pathname != null && pathname.startsWith("/admin");
61
- (0, import_react2.useEffect)(() => {
159
+ React2.useEffect(() => {
62
160
  if (isAdminRoute && typeof window !== "undefined") {
63
161
  if (typeof window.gtag === "function") {
64
162
  window.gtag = () => {
@@ -68,35 +166,35 @@ function useAnalytics(pathname) {
68
166
  window.dataLayer = [];
69
167
  }
70
168
  }
71
- }, [isAdminRoute]);
72
- return { isAdminRoute, shouldTrack: !isAdminRoute };
169
+ }, [
170
+ isAdminRoute
171
+ ]);
172
+ return {
173
+ isAdminRoute,
174
+ shouldTrack: !isAdminRoute
175
+ };
73
176
  }
74
-
75
- // src/hooks/use-plugin.ts
76
- var import_react3 = __toESM(require("react"), 1);
77
- var PluginContext = (0, import_react3.createContext)(null);
78
- function PluginProvider({
79
- getPlugin,
80
- children
81
- }) {
82
- return import_react3.default.createElement(PluginContext.Provider, { value: { getPlugin } }, children);
177
+ chunkUSNT2KNT_cjs.__name(useAnalytics, "useAnalytics");
178
+ var PluginContext = React2.createContext(null);
179
+ function PluginProvider({ getPlugin, children }) {
180
+ return React2__default.default.createElement(PluginContext.Provider, {
181
+ value: {
182
+ getPlugin
183
+ }
184
+ }, children);
83
185
  }
186
+ chunkUSNT2KNT_cjs.__name(PluginProvider, "PluginProvider");
84
187
  function usePlugin(name) {
85
- const ctx = (0, import_react3.useContext)(PluginContext);
188
+ const ctx = React2.useContext(PluginContext);
86
189
  if (!ctx) return void 0;
87
190
  return ctx.getPlugin(name);
88
191
  }
89
-
90
- // src/components/CaptchaProvider.tsx
91
- var import_react4 = require("react");
92
- var import_jsx_runtime = require("react/jsx-runtime");
93
- var CaptchaReactContext = (0, import_react4.createContext)(null);
192
+ chunkUSNT2KNT_cjs.__name(usePlugin, "usePlugin");
193
+ var CaptchaReactContext = /* @__PURE__ */ React2.createContext(null);
94
194
  function loadScript(src) {
95
195
  return new Promise((resolve, reject) => {
96
196
  const base = src.split("?")[0] ?? src;
97
- const existing = Array.from(document.querySelectorAll("script[src]")).some(
98
- (el) => el.src.startsWith(base)
99
- );
197
+ const existing = Array.from(document.querySelectorAll("script[src]")).some((el) => el.src.startsWith(base));
100
198
  if (existing) {
101
199
  resolve();
102
200
  return;
@@ -109,14 +207,15 @@ function loadScript(src) {
109
207
  document.head.appendChild(s);
110
208
  });
111
209
  }
210
+ chunkUSNT2KNT_cjs.__name(loadScript, "loadScript");
112
211
  function CaptchaProvider({ children }) {
113
- const [config, setConfig] = (0, import_react4.useState)(null);
114
- const [selectedProvider, setSelectedProvider] = (0, import_react4.useState)(null);
115
- const [ready, setReady] = (0, import_react4.useState)(false);
116
- const turnstileWidgetIdRef = (0, import_react4.useRef)(null);
117
- const turnstileContainerRef = (0, import_react4.useRef)(null);
118
- const turnstileTokenRef = (0, import_react4.useRef)(null);
119
- (0, import_react4.useEffect)(() => {
212
+ const [config, setConfig] = React2.useState(null);
213
+ const [selectedProvider, setSelectedProvider] = React2.useState(null);
214
+ const [ready, setReady] = React2.useState(false);
215
+ const turnstileWidgetIdRef = React2.useRef(null);
216
+ const turnstileContainerRef = React2.useRef(null);
217
+ const turnstileTokenRef = React2.useRef(null);
218
+ React2.useEffect(() => {
120
219
  let cancelled = false;
121
220
  fetch("/api/public/captcha-config").then((r) => r.ok ? r.json() : null).then((c) => {
122
221
  if (cancelled || !c) return;
@@ -130,7 +229,7 @@ function CaptchaProvider({ children }) {
130
229
  cancelled = true;
131
230
  };
132
231
  }, []);
133
- (0, import_react4.useEffect)(() => {
232
+ React2.useEffect(() => {
134
233
  if (!config?.enabled || !selectedProvider) return;
135
234
  const siteKeyFor = config.availableProviders.find((p) => p.id === selectedProvider)?.siteKey;
136
235
  if (!siteKeyFor) return;
@@ -138,9 +237,7 @@ function CaptchaProvider({ children }) {
138
237
  (async () => {
139
238
  try {
140
239
  if (selectedProvider === "recaptcha_v3") {
141
- await loadScript(
142
- `https://www.google.com/recaptcha/api.js?render=${encodeURIComponent(siteKeyFor)}`
143
- );
240
+ await loadScript(`https://www.google.com/recaptcha/api.js?render=${encodeURIComponent(siteKeyFor)}`);
144
241
  } else {
145
242
  await loadScript("https://challenges.cloudflare.com/turnstile/v0/api.js");
146
243
  if (cancelled || !turnstileContainerRef.current || !window.turnstile) return;
@@ -154,21 +251,21 @@ function CaptchaProvider({ children }) {
154
251
  const wid = window.turnstile.render(turnstileContainerRef.current, {
155
252
  sitekey: siteKeyFor,
156
253
  execution: "execute",
157
- callback: (token) => {
254
+ callback: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((token) => {
158
255
  const p = turnstileTokenRef.current;
159
256
  turnstileTokenRef.current = null;
160
257
  p?.resolve(token);
161
- },
162
- "error-callback": () => {
258
+ }, "callback"),
259
+ "error-callback": /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(() => {
163
260
  const p = turnstileTokenRef.current;
164
261
  turnstileTokenRef.current = null;
165
262
  p?.reject(new Error("Turnstile error"));
166
- },
167
- "expired-callback": () => {
263
+ }, "error-callback"),
264
+ "expired-callback": /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(() => {
168
265
  const p = turnstileTokenRef.current;
169
266
  turnstileTokenRef.current = null;
170
267
  p?.reject(new Error("Turnstile expired"));
171
- }
268
+ }, "expired-callback")
172
269
  });
173
270
  turnstileWidgetIdRef.current = wid;
174
271
  }
@@ -178,8 +275,11 @@ function CaptchaProvider({ children }) {
178
275
  return () => {
179
276
  cancelled = true;
180
277
  };
181
- }, [config, selectedProvider]);
182
- const getCaptchaPayload = (0, import_react4.useCallback)(async () => {
278
+ }, [
279
+ config,
280
+ selectedProvider
281
+ ]);
282
+ const getCaptchaPayload = React2.useCallback(async () => {
183
283
  if (!config?.enabled || !selectedProvider) return {};
184
284
  const siteKeyFor = config.availableProviders.find((p) => p.id === selectedProvider)?.siteKey;
185
285
  if (!siteKeyFor) return {};
@@ -187,15 +287,23 @@ function CaptchaProvider({ children }) {
187
287
  if (!window.grecaptcha) return {};
188
288
  const token2 = await new Promise((resolve, reject) => {
189
289
  window.grecaptcha.ready(() => {
190
- window.grecaptcha.execute(siteKeyFor, { action: "submit" }).then(resolve).catch(reject);
290
+ window.grecaptcha.execute(siteKeyFor, {
291
+ action: "submit"
292
+ }).then(resolve).catch(reject);
191
293
  });
192
294
  });
193
- return { captchaToken: token2, captchaProvider: "recaptcha_v3" };
295
+ return {
296
+ captchaToken: token2,
297
+ captchaProvider: "recaptcha_v3"
298
+ };
194
299
  }
195
300
  const wid = turnstileWidgetIdRef.current;
196
301
  if (!wid || !window.turnstile) return {};
197
302
  const token = await new Promise((resolve, reject) => {
198
- turnstileTokenRef.current = { resolve, reject };
303
+ turnstileTokenRef.current = {
304
+ resolve,
305
+ reject
306
+ };
199
307
  try {
200
308
  window.turnstile.reset(wid);
201
309
  window.turnstile.execute(wid);
@@ -204,50 +312,69 @@ function CaptchaProvider({ children }) {
204
312
  reject(e instanceof Error ? e : new Error("Turnstile execute failed"));
205
313
  }
206
314
  });
207
- return { captchaToken: token, captchaProvider: "turnstile" };
208
- }, [config, selectedProvider]);
209
- const ctx = (0, import_react4.useMemo)(
210
- () => ({
211
- config,
212
- ready,
213
- selectedProvider,
214
- setSelectedProvider,
215
- getCaptchaPayload
216
- }),
217
- [config, ready, selectedProvider, getCaptchaPayload]
218
- );
219
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CaptchaReactContext.Provider, { value: ctx, children: [
220
- config?.enabled && config.multipleProviders ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mb-2 text-sm text-muted-foreground max-w-md", children: [
221
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: "mr-2", htmlFor: "captcha-provider-select", children: "Verification" }),
222
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
223
- "select",
224
- {
225
- id: "captcha-provider-select",
226
- className: "border rounded px-2 py-1 bg-background",
227
- value: selectedProvider ?? "",
228
- onChange: (e) => setSelectedProvider(e.target.value),
229
- children: config.availableProviders.map((p) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: p.id, children: p.id === "turnstile" ? "Cloudflare Turnstile" : "Google reCAPTCHA v3" }, p.id))
230
- }
231
- )
232
- ] }) : null,
233
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: turnstileContainerRef, className: "hidden", "aria-hidden": true }),
234
- children
235
- ] });
315
+ return {
316
+ captchaToken: token,
317
+ captchaProvider: "turnstile"
318
+ };
319
+ }, [
320
+ config,
321
+ selectedProvider
322
+ ]);
323
+ const ctx = React2.useMemo(() => ({
324
+ config,
325
+ ready,
326
+ selectedProvider,
327
+ setSelectedProvider,
328
+ getCaptchaPayload
329
+ }), [
330
+ config,
331
+ ready,
332
+ selectedProvider,
333
+ getCaptchaPayload
334
+ ]);
335
+ return /* @__PURE__ */ React2__default.default.createElement(CaptchaReactContext.Provider, {
336
+ value: ctx
337
+ }, config?.enabled && config.multipleProviders ? /* @__PURE__ */ React2__default.default.createElement("div", {
338
+ className: "mb-2 text-sm text-muted-foreground max-w-md"
339
+ }, /* @__PURE__ */ React2__default.default.createElement("label", {
340
+ className: "mr-2",
341
+ htmlFor: "captcha-provider-select"
342
+ }, "Verification"), /* @__PURE__ */ React2__default.default.createElement("select", {
343
+ id: "captcha-provider-select",
344
+ className: "border rounded px-2 py-1 bg-background",
345
+ value: selectedProvider ?? "",
346
+ onChange: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((e) => setSelectedProvider(e.target.value), "onChange")
347
+ }, config.availableProviders.map((p) => /* @__PURE__ */ React2__default.default.createElement("option", {
348
+ key: p.id,
349
+ value: p.id
350
+ }, p.id === "turnstile" ? "Cloudflare Turnstile" : "Google reCAPTCHA v3")))) : null, /* @__PURE__ */ React2__default.default.createElement("div", {
351
+ ref: turnstileContainerRef,
352
+ className: "hidden",
353
+ "aria-hidden": true
354
+ }), children);
236
355
  }
356
+ chunkUSNT2KNT_cjs.__name(CaptchaProvider, "CaptchaProvider");
237
357
  function useCaptchaPayload() {
238
- const ctx = (0, import_react4.useContext)(CaptchaReactContext);
239
- return (0, import_react4.useCallback)(async () => {
358
+ const ctx = React2.useContext(CaptchaReactContext);
359
+ return React2.useCallback(async () => {
240
360
  if (!ctx?.config?.enabled || !ctx.ready) return {};
241
361
  return ctx.getCaptchaPayload();
242
- }, [ctx]);
362
+ }, [
363
+ ctx
364
+ ]);
243
365
  }
244
- // Annotate the CommonJS export names for ESM import in node:
245
- 0 && (module.exports = {
246
- CaptchaProvider,
247
- PluginProvider,
248
- useAnalytics,
249
- useCaptchaPayload,
250
- useIsMobile,
251
- usePlugin
252
- });
253
- //# sourceMappingURL=hooks.cjs.map
366
+ chunkUSNT2KNT_cjs.__name(useCaptchaPayload, "useCaptchaPayload");
367
+
368
+ exports.CaptchaProvider = CaptchaProvider;
369
+ exports.PluginProvider = PluginProvider;
370
+ exports.useAnalytics = useAnalytics;
371
+ exports.useCaptchaPayload = useCaptchaPayload;
372
+ exports.useCatalogCategories = useCatalogCategories;
373
+ exports.useCatalogCollections = useCatalogCollections;
374
+ exports.useIsMobile = useIsMobile;
375
+ exports.usePlugin = usePlugin;
376
+ exports.vendorCategoryWorkspaceUrl = vendorCategoryWorkspaceUrl;
377
+ exports.vendorCollectionCreateUrl = vendorCollectionCreateUrl;
378
+ exports.vendorCollectionProductsUrl = vendorCollectionProductsUrl;
379
+ exports.vendorEventProductCreateUrl = vendorEventProductCreateUrl;
380
+ exports.vendorProductCreateUrl = vendorProductCreateUrl;