@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.
- package/dist/chunk-3L6EZQ6P.js +135 -0
- package/dist/chunk-5WPFHQZN.js +388 -0
- package/dist/chunk-BMDNY67T.js +22547 -0
- package/dist/{chunk-JAVEZY3Q.js → chunk-BOMSMJF2.js} +17 -5
- package/dist/{chunk-2RTX42IE.js → chunk-E77YIMGR.js} +2 -2
- package/dist/{chunk-XHOCXPD5.js → chunk-F6LBNV3H.js} +1 -1
- package/dist/chunk-FDHXLNZQ.js +44 -0
- package/dist/{chunk-XJBPMIC4.js → chunk-HERLM47Z.js} +81 -56
- package/dist/{chunk-MSPWYMDY.js → chunk-HJKRGBDG.js} +87 -58
- package/dist/{chunk-7PPOGX7R.js → chunk-I64TXIE7.js} +48 -11
- package/dist/chunk-ICJH36K4.js +326 -0
- package/dist/chunk-IWKDBADX.js +73 -0
- package/dist/{chunk-QNLGYFV7.js → chunk-IYKPRAWC.js} +4 -0
- package/dist/chunk-J23QSWDL.js +8 -0
- package/dist/chunk-KRIRF7F6.js +76 -0
- package/dist/chunk-OTXM2UCD.js +19 -0
- package/dist/chunk-PJLYVMUM.js +3308 -0
- package/dist/{chunk-SRAAKMWY.js → chunk-PUI5BIKO.js} +4 -2
- package/dist/chunk-QHR23GVH.js +1099 -0
- package/dist/chunk-VBO377AY.js +14 -0
- package/dist/chunk-VYEXPG3M.js +107 -0
- package/dist/{chunk-4VNS5WPM.js → chunk-WPLOTFGW.js} +7 -8
- package/dist/{chunk-VDKQGOMV.js → chunk-ZUOVKRKC.js} +118 -1
- package/dist/components/ui/Badge.d.ts.map +1 -1
- package/dist/components/ui/BreadCrumbs.d.ts.map +1 -1
- package/dist/components/ui/Pagination.d.ts.map +1 -1
- package/dist/components/ui/form/ChoicesField.d.ts.map +1 -1
- package/dist/components/ui/form/Combobox.d.ts.map +1 -1
- package/dist/components/ui/form/TextField.d.ts.map +1 -1
- package/dist/components/ui/form/index.d.ts +1 -0
- package/dist/components/ui/form/index.d.ts.map +1 -1
- package/dist/components/ui/index.d.ts +5 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/form.js +1808 -27501
- package/dist/gql/operation-types.d.ts +201 -5
- package/dist/gql/operation-types.d.ts.map +1 -1
- package/dist/gql/schema-types.d.ts +63 -7
- package/dist/gql/schema-types.d.ts.map +1 -1
- package/dist/hooks.js +13 -6
- package/dist/modal.js +11 -78
- package/dist/modules/Auth/AuthContext.d.ts +9 -0
- package/dist/modules/Auth/AuthContext.d.ts.map +1 -0
- package/dist/modules/Auth/useAuth.d.ts +6 -0
- package/dist/modules/Auth/useAuth.d.ts.map +1 -0
- package/dist/modules/accounts.js +183 -3
- package/dist/modules/assortment.js +83 -4
- package/dist/modules/common/components/AppContext.d.ts.map +1 -1
- package/dist/modules/common/components/FormWrapper.d.ts.map +1 -1
- package/dist/modules/common/components/LocaleWrapper.d.ts +7 -0
- package/dist/modules/common/components/LocaleWrapper.d.ts.map +1 -0
- package/dist/modules/common/components/MediaAvatar.d.ts +6 -0
- package/dist/modules/common/components/MediaAvatar.d.ts.map +1 -0
- package/dist/modules/common/components/SelectOptions.d.ts +17 -0
- package/dist/modules/common/components/SelectOptions.d.ts.map +1 -0
- package/dist/modules/common/components/Table.d.ts +25 -0
- package/dist/modules/common/components/Table.d.ts.map +1 -0
- package/dist/modules/common/components/TableCell.d.ts +12 -0
- package/dist/modules/common/components/TableCell.d.ts.map +1 -0
- package/dist/modules/common/components/TableRow.d.ts +10 -0
- package/dist/modules/common/components/TableRow.d.ts.map +1 -0
- package/dist/modules/common/components/ThemeWrapper.d.ts.map +1 -1
- package/dist/modules/common/data/miscellaneous.d.ts +1 -0
- package/dist/modules/common/data/miscellaneous.d.ts.map +1 -1
- package/dist/modules/common/utils/sharedContext.d.ts +9 -0
- package/dist/modules/common/utils/sharedContext.d.ts.map +1 -0
- package/dist/modules/country.js +1 -1
- package/dist/modules/currency.js +1 -1
- package/dist/modules/delivery-provider.js +1 -1
- package/dist/modules/enrollment.js +66 -9
- package/dist/modules/event.js +1 -1
- package/dist/modules/filter.js +52 -3
- package/dist/modules/forms/lib/FormContext.d.ts.map +1 -1
- package/dist/modules/language.js +1 -1
- package/dist/modules/modal/hooks/useModal.d.ts.map +1 -1
- package/dist/modules/modal/utils/ModalContext.d.ts.map +1 -1
- package/dist/modules/order.js +2 -2
- package/dist/modules/payment-providers.js +1 -1
- package/dist/modules/product-review.js +4 -4
- package/dist/modules/product.js +5000 -11
- package/dist/modules/quotation.js +8 -1
- package/dist/modules/token.js +3 -3
- package/dist/modules/warehousing-providers.js +1 -1
- package/dist/modules/work.js +23 -111
- package/dist/plugins.js +1 -1
- package/dist/providers.js +8 -5
- package/dist/sdk/hooks.d.ts +3 -0
- package/dist/sdk/hooks.d.ts.map +1 -1
- package/dist/shims/admin-ui-plugins.js +1 -1
- package/dist/shims/apollo-client-react.js +1 -1
- package/dist/shims/apollo-client.js +1 -1
- package/dist/shims/next-head.js +1 -1
- package/dist/shims/next-image.js +1 -1
- package/dist/shims/next-link.js +1 -1
- package/dist/shims/next-router.js +1 -1
- package/dist/shims/react-dom-client.js +1 -1
- package/dist/shims/react-dom.js +1 -1
- package/dist/shims/react-hook-form.js +1 -1
- package/dist/shims/react-intl.js +1 -1
- package/dist/shims/react-jsx-runtime.js +1 -1
- package/dist/shims/react-toastify.js +1 -1
- package/dist/shims/react.js +1 -1
- package/dist/theme.js +1 -1
- package/dist/ui.js +3476 -3103
- package/out/403/index.html +2 -2
- package/out/404/index.html +2 -2
- package/out/404.html +2 -2
- package/out/423/index.html +2 -2
- package/out/500/index.html +2 -2
- package/out/_next/static/{4-xf4wPkZc5rcBq3jUTDg → F8ReqaxPvLqFJ2DaPfMdn}/_buildManifest.js +1 -1
- package/out/_next/static/chunks/{2we4fnghpvprw.js → 217_5onj-woma.js} +1 -1
- package/out/_next/static/chunks/{1wvicoevgxhkk.js → 2jjgby8cd1gdj.js} +2 -2
- package/out/_next/static/chunks/{turbopack-1zn9gl4fpayoc.js → turbopack-0ptvhnhsw0_c7.js} +1 -1
- package/out/_offline/index.html +2 -2
- package/out/account/forgot-password/index.html +2 -2
- package/out/account/index.html +2 -2
- package/out/assortments/AssortmentDetailPage/index.html +2 -2
- package/out/assortments/index.html +2 -2
- package/out/assortments/new/index.html +2 -2
- package/out/copilot/index.html +2 -2
- package/out/country/CountryDetailPage/index.html +2 -2
- package/out/country/index.html +2 -2
- package/out/country/new/index.html +2 -2
- package/out/currency/CurrencyDetailPage/index.html +2 -2
- package/out/currency/index.html +2 -2
- package/out/currency/new/index.html +2 -2
- package/out/delivery-provider/DeliveryProviderDetailPage/index.html +2 -2
- package/out/delivery-provider/index.html +2 -2
- package/out/delivery-provider/new/index.html +2 -2
- package/out/enrollments/EnrollmentDetailPage/index.html +2 -2
- package/out/enrollments/index.html +2 -2
- package/out/events/EventDetailPage/index.html +2 -2
- package/out/events/index.html +2 -2
- package/out/exports/index.html +2 -2
- package/out/external/index.html +2 -2
- package/out/filters/FilterDetailPage/index.html +2 -2
- package/out/filters/index.html +2 -2
- package/out/filters/new/index.html +2 -2
- package/out/index.html +2 -2
- package/out/install/index.html +2 -2
- package/out/language/LanguageDetailPage/index.html +2 -2
- package/out/language/index.html +2 -2
- package/out/language/new/index.html +2 -2
- package/out/log-in/index.html +2 -2
- package/out/orders/OrderDetailPage/index.html +2 -2
- package/out/orders/index.html +2 -2
- package/out/payment-provider/PaymentProviderDetailPage/index.html +2 -2
- package/out/payment-provider/index.html +2 -2
- package/out/payment-provider/new/index.html +2 -2
- package/out/products/ProductDetailPage/index.html +2 -2
- package/out/products/index.html +2 -2
- package/out/products/new/index.html +2 -2
- package/out/quotations/QuotationDetailPage/index.html +2 -2
- package/out/quotations/index.html +2 -2
- package/out/reset-password/index.html +2 -2
- package/out/sign-up/index.html +2 -2
- package/out/styleguide/index.html +2 -2
- package/out/tokens/TokenDetailPage/index.html +2 -2
- package/out/tokens/index.html +2 -2
- package/out/users/UserDetailPage/index.html +2 -2
- package/out/users/index.html +2 -2
- package/out/users/new/index.html +2 -2
- package/out/verify-email/index.html +2 -2
- package/out/warehousing-provider/WarehousingProviderDetailPage/index.html +2 -2
- package/out/warehousing-provider/index.html +2 -2
- package/out/warehousing-provider/new/index.html +2 -2
- package/out/works/WorkDetailPage/index.html +2 -2
- package/out/works/WorkQueueListView/index.html +2 -2
- package/out/works/index.html +2 -2
- package/out/works/management/index.html +2 -2
- package/package.json +1 -1
- package/dist/chunk-F2TCVEQX.js +0 -514
- package/dist/chunk-KCN7DDPH.js +0 -1116
- package/dist/chunk-RORNAN2J.js +0 -12
- package/dist/chunk-RVG6IOFC.js +0 -11
- package/dist/chunk-YZGQJJCD.js +0 -37
- /package/out/_next/static/{4-xf4wPkZc5rcBq3jUTDg → F8ReqaxPvLqFJ2DaPfMdn}/_clientMiddlewareManifest.js +0 -0
- /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 };
|
|
@@ -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 };
|