@unchainedshop/admin-ui 4.8.29 → 4.8.30

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 (177) hide show
  1. package/dist/chunk-3L6EZQ6P.js +135 -0
  2. package/dist/chunk-5WPFHQZN.js +388 -0
  3. package/dist/chunk-BMDNY67T.js +22547 -0
  4. package/dist/{chunk-JAVEZY3Q.js → chunk-BOMSMJF2.js} +17 -5
  5. package/dist/{chunk-2RTX42IE.js → chunk-E77YIMGR.js} +2 -2
  6. package/dist/{chunk-XHOCXPD5.js → chunk-F6LBNV3H.js} +1 -1
  7. package/dist/chunk-FDHXLNZQ.js +44 -0
  8. package/dist/{chunk-XJBPMIC4.js → chunk-HERLM47Z.js} +81 -56
  9. package/dist/{chunk-MSPWYMDY.js → chunk-HJKRGBDG.js} +87 -58
  10. package/dist/{chunk-7PPOGX7R.js → chunk-I64TXIE7.js} +48 -11
  11. package/dist/chunk-ICJH36K4.js +326 -0
  12. package/dist/chunk-IWKDBADX.js +73 -0
  13. package/dist/{chunk-QNLGYFV7.js → chunk-IYKPRAWC.js} +4 -0
  14. package/dist/chunk-J23QSWDL.js +8 -0
  15. package/dist/chunk-KRIRF7F6.js +76 -0
  16. package/dist/chunk-OTXM2UCD.js +19 -0
  17. package/dist/chunk-PJLYVMUM.js +3308 -0
  18. package/dist/{chunk-SRAAKMWY.js → chunk-PUI5BIKO.js} +4 -2
  19. package/dist/chunk-QHR23GVH.js +1099 -0
  20. package/dist/chunk-VBO377AY.js +14 -0
  21. package/dist/chunk-VYEXPG3M.js +107 -0
  22. package/dist/{chunk-4VNS5WPM.js → chunk-WPLOTFGW.js} +7 -8
  23. package/dist/{chunk-VDKQGOMV.js → chunk-ZUOVKRKC.js} +118 -1
  24. package/dist/components/ui/Badge.d.ts.map +1 -1
  25. package/dist/components/ui/BreadCrumbs.d.ts.map +1 -1
  26. package/dist/components/ui/Pagination.d.ts.map +1 -1
  27. package/dist/components/ui/form/ChoicesField.d.ts.map +1 -1
  28. package/dist/components/ui/form/Combobox.d.ts.map +1 -1
  29. package/dist/components/ui/form/TextField.d.ts.map +1 -1
  30. package/dist/components/ui/form/index.d.ts +1 -0
  31. package/dist/components/ui/form/index.d.ts.map +1 -1
  32. package/dist/components/ui/index.d.ts +5 -0
  33. package/dist/components/ui/index.d.ts.map +1 -1
  34. package/dist/form.js +1808 -27501
  35. package/dist/gql/operation-types.d.ts +201 -5
  36. package/dist/gql/operation-types.d.ts.map +1 -1
  37. package/dist/gql/schema-types.d.ts +63 -7
  38. package/dist/gql/schema-types.d.ts.map +1 -1
  39. package/dist/hooks.js +13 -6
  40. package/dist/modal.js +11 -78
  41. package/dist/modules/Auth/AuthContext.d.ts +9 -0
  42. package/dist/modules/Auth/AuthContext.d.ts.map +1 -0
  43. package/dist/modules/Auth/useAuth.d.ts +6 -0
  44. package/dist/modules/Auth/useAuth.d.ts.map +1 -0
  45. package/dist/modules/accounts.js +183 -3
  46. package/dist/modules/assortment.js +83 -4
  47. package/dist/modules/common/components/AppContext.d.ts.map +1 -1
  48. package/dist/modules/common/components/FormWrapper.d.ts.map +1 -1
  49. package/dist/modules/common/components/LocaleWrapper.d.ts +7 -0
  50. package/dist/modules/common/components/LocaleWrapper.d.ts.map +1 -0
  51. package/dist/modules/common/components/MediaAvatar.d.ts +6 -0
  52. package/dist/modules/common/components/MediaAvatar.d.ts.map +1 -0
  53. package/dist/modules/common/components/SelectOptions.d.ts +17 -0
  54. package/dist/modules/common/components/SelectOptions.d.ts.map +1 -0
  55. package/dist/modules/common/components/Table.d.ts +25 -0
  56. package/dist/modules/common/components/Table.d.ts.map +1 -0
  57. package/dist/modules/common/components/TableCell.d.ts +12 -0
  58. package/dist/modules/common/components/TableCell.d.ts.map +1 -0
  59. package/dist/modules/common/components/TableRow.d.ts +10 -0
  60. package/dist/modules/common/components/TableRow.d.ts.map +1 -0
  61. package/dist/modules/common/components/ThemeWrapper.d.ts.map +1 -1
  62. package/dist/modules/common/data/miscellaneous.d.ts +1 -0
  63. package/dist/modules/common/data/miscellaneous.d.ts.map +1 -1
  64. package/dist/modules/common/utils/sharedContext.d.ts +9 -0
  65. package/dist/modules/common/utils/sharedContext.d.ts.map +1 -0
  66. package/dist/modules/country.js +1 -1
  67. package/dist/modules/currency.js +1 -1
  68. package/dist/modules/delivery-provider.js +1 -1
  69. package/dist/modules/enrollment.js +66 -9
  70. package/dist/modules/event.js +1 -1
  71. package/dist/modules/filter.js +52 -3
  72. package/dist/modules/forms/lib/FormContext.d.ts.map +1 -1
  73. package/dist/modules/language.js +1 -1
  74. package/dist/modules/modal/hooks/useModal.d.ts.map +1 -1
  75. package/dist/modules/modal/utils/ModalContext.d.ts.map +1 -1
  76. package/dist/modules/order.js +2 -2
  77. package/dist/modules/payment-providers.js +1 -1
  78. package/dist/modules/product-review.js +4 -4
  79. package/dist/modules/product.js +5000 -11
  80. package/dist/modules/quotation.js +8 -1
  81. package/dist/modules/token.js +3 -3
  82. package/dist/modules/warehousing-providers.js +1 -1
  83. package/dist/modules/work.js +23 -111
  84. package/dist/plugins.js +1 -1
  85. package/dist/providers.js +8 -5
  86. package/dist/sdk/hooks.d.ts +3 -0
  87. package/dist/sdk/hooks.d.ts.map +1 -1
  88. package/dist/shims/admin-ui-plugins.js +1 -1
  89. package/dist/shims/apollo-client-react.js +1 -1
  90. package/dist/shims/apollo-client.js +1 -1
  91. package/dist/shims/next-head.js +1 -1
  92. package/dist/shims/next-image.js +1 -1
  93. package/dist/shims/next-link.js +1 -1
  94. package/dist/shims/next-router.js +1 -1
  95. package/dist/shims/react-dom-client.js +1 -1
  96. package/dist/shims/react-dom.js +1 -1
  97. package/dist/shims/react-hook-form.js +1 -1
  98. package/dist/shims/react-intl.js +1 -1
  99. package/dist/shims/react-jsx-runtime.js +1 -1
  100. package/dist/shims/react-toastify.js +1 -1
  101. package/dist/shims/react.js +1 -1
  102. package/dist/theme.js +1 -1
  103. package/dist/ui.js +3476 -3103
  104. package/out/403/index.html +2 -2
  105. package/out/404/index.html +2 -2
  106. package/out/404.html +2 -2
  107. package/out/423/index.html +2 -2
  108. package/out/500/index.html +2 -2
  109. package/out/_next/static/{4-xf4wPkZc5rcBq3jUTDg → F8ReqaxPvLqFJ2DaPfMdn}/_buildManifest.js +1 -1
  110. package/out/_next/static/chunks/{2we4fnghpvprw.js → 217_5onj-woma.js} +1 -1
  111. package/out/_next/static/chunks/{1wvicoevgxhkk.js → 2jjgby8cd1gdj.js} +2 -2
  112. package/out/_next/static/chunks/{turbopack-1zn9gl4fpayoc.js → turbopack-0ptvhnhsw0_c7.js} +1 -1
  113. package/out/_offline/index.html +2 -2
  114. package/out/account/forgot-password/index.html +2 -2
  115. package/out/account/index.html +2 -2
  116. package/out/assortments/AssortmentDetailPage/index.html +2 -2
  117. package/out/assortments/index.html +2 -2
  118. package/out/assortments/new/index.html +2 -2
  119. package/out/copilot/index.html +2 -2
  120. package/out/country/CountryDetailPage/index.html +2 -2
  121. package/out/country/index.html +2 -2
  122. package/out/country/new/index.html +2 -2
  123. package/out/currency/CurrencyDetailPage/index.html +2 -2
  124. package/out/currency/index.html +2 -2
  125. package/out/currency/new/index.html +2 -2
  126. package/out/delivery-provider/DeliveryProviderDetailPage/index.html +2 -2
  127. package/out/delivery-provider/index.html +2 -2
  128. package/out/delivery-provider/new/index.html +2 -2
  129. package/out/enrollments/EnrollmentDetailPage/index.html +2 -2
  130. package/out/enrollments/index.html +2 -2
  131. package/out/events/EventDetailPage/index.html +2 -2
  132. package/out/events/index.html +2 -2
  133. package/out/exports/index.html +2 -2
  134. package/out/external/index.html +2 -2
  135. package/out/filters/FilterDetailPage/index.html +2 -2
  136. package/out/filters/index.html +2 -2
  137. package/out/filters/new/index.html +2 -2
  138. package/out/index.html +2 -2
  139. package/out/install/index.html +2 -2
  140. package/out/language/LanguageDetailPage/index.html +2 -2
  141. package/out/language/index.html +2 -2
  142. package/out/language/new/index.html +2 -2
  143. package/out/log-in/index.html +2 -2
  144. package/out/orders/OrderDetailPage/index.html +2 -2
  145. package/out/orders/index.html +2 -2
  146. package/out/payment-provider/PaymentProviderDetailPage/index.html +2 -2
  147. package/out/payment-provider/index.html +2 -2
  148. package/out/payment-provider/new/index.html +2 -2
  149. package/out/products/ProductDetailPage/index.html +2 -2
  150. package/out/products/index.html +2 -2
  151. package/out/products/new/index.html +2 -2
  152. package/out/quotations/QuotationDetailPage/index.html +2 -2
  153. package/out/quotations/index.html +2 -2
  154. package/out/reset-password/index.html +2 -2
  155. package/out/sign-up/index.html +2 -2
  156. package/out/styleguide/index.html +2 -2
  157. package/out/tokens/TokenDetailPage/index.html +2 -2
  158. package/out/tokens/index.html +2 -2
  159. package/out/users/UserDetailPage/index.html +2 -2
  160. package/out/users/index.html +2 -2
  161. package/out/users/new/index.html +2 -2
  162. package/out/verify-email/index.html +2 -2
  163. package/out/warehousing-provider/WarehousingProviderDetailPage/index.html +2 -2
  164. package/out/warehousing-provider/index.html +2 -2
  165. package/out/warehousing-provider/new/index.html +2 -2
  166. package/out/works/WorkDetailPage/index.html +2 -2
  167. package/out/works/WorkQueueListView/index.html +2 -2
  168. package/out/works/index.html +2 -2
  169. package/out/works/management/index.html +2 -2
  170. package/package.json +1 -1
  171. package/dist/chunk-F2TCVEQX.js +0 -514
  172. package/dist/chunk-KCN7DDPH.js +0 -1116
  173. package/dist/chunk-RORNAN2J.js +0 -12
  174. package/dist/chunk-RVG6IOFC.js +0 -11
  175. package/dist/chunk-YZGQJJCD.js +0 -37
  176. /package/out/_next/static/{4-xf4wPkZc5rcBq3jUTDg → F8ReqaxPvLqFJ2DaPfMdn}/_clientMiddlewareManifest.js +0 -0
  177. /package/out/_next/static/{4-xf4wPkZc5rcBq3jUTDg → F8ReqaxPvLqFJ2DaPfMdn}/_ssgManifest.js +0 -0
@@ -0,0 +1,73 @@
1
+ import { useAddWork_default, GetWorkQuery } from './chunk-VYEXPG3M.js';
2
+ import { useState, useCallback } from 'react';
3
+ import { toast } from 'react-toastify';
4
+ import { useIntl } from 'react-intl';
5
+ import { useApolloClient } from '@apollo/client/react';
6
+ import { useRouter } from 'next/router';
7
+
8
+ var useCSVExport = () => {
9
+ const [isExporting, setIsExporting] = useState(false);
10
+ const client = useApolloClient();
11
+ const router = useRouter();
12
+ const { addWork } = useAddWork_default();
13
+ const { formatMessage } = useIntl();
14
+ const getWorkStatus = useCallback(
15
+ async (workId) => {
16
+ const { data } = await client.query({
17
+ query: GetWorkQuery(),
18
+ variables: { workId },
19
+ fetchPolicy: "network-only"
20
+ });
21
+ return data?.work ?? null;
22
+ },
23
+ [client]
24
+ );
25
+ const exportCSV = useCallback(
26
+ async ({ type, pollInterval = 2e3, ...params }) => {
27
+ setIsExporting(true);
28
+ try {
29
+ const worker = await addWork({
30
+ type: "BULK_EXPORT" /* BulkExport */,
31
+ input: { type, ...params }
32
+ });
33
+ const workId = worker?.data?.addWork?._id;
34
+ if (!workId) throw new Error("Failed to create export work");
35
+ await new Promise((resolve, reject) => {
36
+ const interval = setInterval(async () => {
37
+ try {
38
+ const work = await getWorkStatus(workId);
39
+ if (!work) throw new Error("Work not found");
40
+ if (work.status === "SUCCESS" /* Success */ || work.status === "FAILED" /* Failed */) {
41
+ clearInterval(interval);
42
+ if (work.status === "SUCCESS" /* Success */ && work.success) {
43
+ router.push(`/exports?workId=${work._id}`);
44
+ resolve(work);
45
+ } else {
46
+ reject(work.error || new Error("Export failed"));
47
+ }
48
+ }
49
+ } catch (err) {
50
+ clearInterval(interval);
51
+ reject(err);
52
+ }
53
+ }, pollInterval);
54
+ });
55
+ } catch (error) {
56
+ console.error("Export failed:", error);
57
+ toast.error(
58
+ formatMessage({
59
+ id: "export_failed",
60
+ defaultMessage: "Export failed. Please try again."
61
+ })
62
+ );
63
+ return null;
64
+ } finally {
65
+ setIsExporting(false);
66
+ }
67
+ },
68
+ [addWork, getWorkStatus, router, formatMessage]
69
+ );
70
+ return { isExporting, exportCSV };
71
+ };
72
+
73
+ export { useCSVExport };
@@ -13,6 +13,10 @@ var TokenFragment = gql`
13
13
  invalidatedDate
14
14
  expiryDate
15
15
  ercMetadata
16
+ order {
17
+ _id
18
+ orderNumber
19
+ }
16
20
  accessKey
17
21
  isInvalidateable
18
22
  }
@@ -0,0 +1,8 @@
1
+ // src/modules/common/utils/sharedContext.ts
2
+ function sharedContext(name, context) {
3
+ if (typeof window === "undefined") return context;
4
+ const registry = window.__UNCHAINED_SHARED_CONTEXTS__ ??= {};
5
+ return registry[name] ??= context;
6
+ }
7
+
8
+ export { sharedContext };
@@ -0,0 +1,76 @@
1
+ import { useIntl } from 'react-intl';
2
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
+
4
+ // src/modules/modal/components/DangerMessage.tsx
5
+ var DangerMessage = ({
6
+ onOkClick,
7
+ onCancelClick,
8
+ okText = null,
9
+ cancelText = null,
10
+ headerText = null,
11
+ message = null,
12
+ icon = null,
13
+ close = null,
14
+ loading = false
15
+ }) => {
16
+ const { formatMessage } = useIntl();
17
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
18
+ /* @__PURE__ */ jsxs("div", { className: "sm:flex sm:items-start", children: [
19
+ icon || /* @__PURE__ */ jsx("div", { className: "mx-auto flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-rose-100 dark:bg-rose-900/30 sm:mx-0 sm:h-10 sm:w-10", children: /* @__PURE__ */ jsx(
20
+ "svg",
21
+ {
22
+ className: "h-6 w-6 text-danger",
23
+ xmlns: "http://www.w3.org/2000/svg",
24
+ fill: "none",
25
+ viewBox: "0 0 24 24",
26
+ stroke: "currentColor",
27
+ "aria-hidden": "true",
28
+ children: /* @__PURE__ */ jsx(
29
+ "path",
30
+ {
31
+ strokeLinecap: "round",
32
+ strokeLinejoin: "round",
33
+ strokeWidth: "2",
34
+ d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
35
+ }
36
+ )
37
+ }
38
+ ) }),
39
+ /* @__PURE__ */ jsxs("div", { className: "mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left", children: [
40
+ /* @__PURE__ */ jsx("h3", { className: "text-lg text-text-primary", id: "modal-title", children: headerText || formatMessage({ id: "warning", defaultMessage: "Warning!" }) }),
41
+ /* @__PURE__ */ jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-text-muted", children: message || formatMessage({
42
+ id: "are_you_sure",
43
+ defaultMessage: "Are you sure?"
44
+ }) }) })
45
+ ] })
46
+ ] }),
47
+ /* @__PURE__ */ jsxs("div", { className: "mt-5 sm:mt-4 sm:flex sm:flex-row-reverse", children: [
48
+ /* @__PURE__ */ jsx(
49
+ "button",
50
+ {
51
+ id: "danger_continue",
52
+ onClick: onOkClick,
53
+ disabled: loading,
54
+ "aria-busy": loading,
55
+ type: "button",
56
+ className: "inline-flex w-full justify-center rounded-md border border-transparent bg-rose-600 px-4 py-2 text-base font-medium text-white shadow-xs hover:bg-rose-700 focus:outline-hidden focus:ring-2 focus:ring-rose-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 sm:ml-3 sm:w-auto sm:text-sm",
57
+ children: okText || formatMessage({ id: "continue", defaultMessage: "Continue" })
58
+ }
59
+ ),
60
+ /* @__PURE__ */ jsx(
61
+ "button",
62
+ {
63
+ id: "danger_cancel",
64
+ onClick: onCancelClick || close,
65
+ disabled: loading,
66
+ type: "button",
67
+ className: "mt-3 inline-flex w-full justify-center rounded-md border border-border-default bg-surface px-4 py-2 text-base font-medium text-text-secondary shadow-xs hover:bg-surface-raised focus:outline-hidden focus:ring-2 focus:ring-focus-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm",
68
+ children: cancelText || formatMessage({ id: "cancel", defaultMessage: "Cancel" })
69
+ }
70
+ )
71
+ ] })
72
+ ] });
73
+ };
74
+ var DangerMessage_default = DangerMessage;
75
+
76
+ export { DangerMessage_default };
@@ -0,0 +1,19 @@
1
+ import { sharedContext } from './chunk-J23QSWDL.js';
2
+ import React, { useContext } from 'react';
3
+
4
+ var AuthContext = sharedContext(
5
+ "AuthContext",
6
+ React.createContext({
7
+ isAdmin: () => false,
8
+ hasRole: () => false
9
+ })
10
+ );
11
+ var AuthContext_default = AuthContext;
12
+
13
+ // src/modules/Auth/useAuth.ts
14
+ var useAuth = () => {
15
+ return useContext(AuthContext_default);
16
+ };
17
+ var useAuth_default = useAuth;
18
+
19
+ export { useAuth_default };