@medusajs/loyalty-plugin 2.21.0 → 2.21.1-preview-20260916094546
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/.medusa/server/src/admin/index.js +1458 -1458
- package/.medusa/server/src/admin/index.mjs +1460 -1460
- package/package.json +19 -19
|
@@ -8,8 +8,8 @@ const icons = require("@medusajs/icons");
|
|
|
8
8
|
const reactQuery = require("@tanstack/react-query");
|
|
9
9
|
const Medusa = require("@medusajs/js-sdk");
|
|
10
10
|
const components = require("@medusajs/dashboard/components");
|
|
11
|
-
const ReactDOM = require("react-dom");
|
|
12
11
|
const zod = require("@medusajs/framework/zod");
|
|
12
|
+
const ReactDOM = require("react-dom");
|
|
13
13
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
14
14
|
function _interopNamespace(e) {
|
|
15
15
|
if (e && e.__esModule) return e;
|
|
@@ -5748,7 +5748,7 @@ adminSdk.defineWidgetConfig({
|
|
|
5748
5748
|
zone: "sales_channel.details.after",
|
|
5749
5749
|
id: "medusa:sales-channel-gift-cards-widget"
|
|
5750
5750
|
});
|
|
5751
|
-
const
|
|
5751
|
+
const StoreCreditIcon = (props) => {
|
|
5752
5752
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5753
5753
|
"svg",
|
|
5754
5754
|
{
|
|
@@ -5759,197 +5759,49 @@ const GiftCardIcon = (props) => {
|
|
|
5759
5759
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5760
5760
|
...props,
|
|
5761
5761
|
children: [
|
|
5762
|
-
/* @__PURE__ */ jsxRuntime.jsx("rect", { width: "15", height: "15", fill: "#
|
|
5762
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { width: "15", height: "15", fill: "#8B5CF6" }),
|
|
5763
5763
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5764
5764
|
"rect",
|
|
5765
5765
|
{
|
|
5766
5766
|
width: "15",
|
|
5767
5767
|
height: "15",
|
|
5768
|
-
fill: "url(#
|
|
5768
|
+
fill: "url(#paint0_linear_29181_44790)",
|
|
5769
5769
|
fillOpacity: "0.2"
|
|
5770
5770
|
}
|
|
5771
5771
|
),
|
|
5772
|
-
/* @__PURE__ */ jsxRuntime.
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5802
|
-
"path",
|
|
5803
|
-
{
|
|
5804
|
-
d: "M8.063 7.5V11.625H9.188C10.325 11.625 11.25 10.7 11.25 9.563V7.5H8.063Z",
|
|
5805
|
-
fill: "white"
|
|
5806
|
-
}
|
|
5807
|
-
)
|
|
5808
|
-
] }),
|
|
5809
|
-
/* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
|
|
5810
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
5811
|
-
"linearGradient",
|
|
5812
|
-
{
|
|
5813
|
-
id: "paint0_linear_28788_25808",
|
|
5814
|
-
x1: "7.5",
|
|
5815
|
-
y1: "0",
|
|
5816
|
-
x2: "7.5",
|
|
5817
|
-
y2: "15",
|
|
5818
|
-
gradientUnits: "userSpaceOnUse",
|
|
5819
|
-
children: [
|
|
5820
|
-
/* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "white" }),
|
|
5821
|
-
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })
|
|
5822
|
-
]
|
|
5823
|
-
}
|
|
5824
|
-
),
|
|
5825
|
-
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_28788_25808", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "9", height: "9", fill: "white", transform: "translate(3 3)" }) })
|
|
5826
|
-
] })
|
|
5772
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5773
|
+
"path",
|
|
5774
|
+
{
|
|
5775
|
+
d: "M12 6V5.813C12 4.675 11.075 3.75 9.938 3.75H5.063C3.925 3.75 3 4.675 3 5.813V6H12Z",
|
|
5776
|
+
fill: "white"
|
|
5777
|
+
}
|
|
5778
|
+
),
|
|
5779
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5780
|
+
"path",
|
|
5781
|
+
{
|
|
5782
|
+
d: "M3 7.125V9.188C3 10.325 3.925 11.25 5.063 11.25H9.938C11.075 11.25 12 10.325 12 9.188V7.125H3ZM9.938 9.75H8.438C8.127 9.75 7.875 9.498 7.875 9.188C7.875 8.877 8.127 8.625 8.438 8.625H9.938C10.248 8.625 10.5 8.877 10.5 9.188C10.5 9.498 10.248 9.75 9.938 9.75Z",
|
|
5783
|
+
fill: "white"
|
|
5784
|
+
}
|
|
5785
|
+
),
|
|
5786
|
+
/* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5787
|
+
"linearGradient",
|
|
5788
|
+
{
|
|
5789
|
+
id: "paint0_linear_29181_44790",
|
|
5790
|
+
x1: "7.5",
|
|
5791
|
+
y1: "0",
|
|
5792
|
+
x2: "7.5",
|
|
5793
|
+
y2: "15",
|
|
5794
|
+
gradientUnits: "userSpaceOnUse",
|
|
5795
|
+
children: [
|
|
5796
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "white" }),
|
|
5797
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })
|
|
5798
|
+
]
|
|
5799
|
+
}
|
|
5800
|
+
) })
|
|
5827
5801
|
]
|
|
5828
5802
|
}
|
|
5829
5803
|
);
|
|
5830
5804
|
};
|
|
5831
|
-
const GiftCardProductsSection = () => {
|
|
5832
|
-
const { products: giftCardProducts, count: count2 = 0 } = useProducts({
|
|
5833
|
-
is_giftcard: true
|
|
5834
|
-
});
|
|
5835
|
-
const slicedProducts = giftCardProducts?.slice(0, 3) ?? [];
|
|
5836
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0", children: [
|
|
5837
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
5838
|
-
/* @__PURE__ */ jsxRuntime.jsx(Header$5, { title: "Gift Card Products" }),
|
|
5839
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5840
|
-
reactRouterDom.Link,
|
|
5841
|
-
{
|
|
5842
|
-
to: `/gift-cards/gift-card-products/create`,
|
|
5843
|
-
className: "text-ui-fg-muted text-sm px-6",
|
|
5844
|
-
children: "Create"
|
|
5845
|
-
}
|
|
5846
|
-
)
|
|
5847
|
-
] }),
|
|
5848
|
-
giftCardProducts?.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5849
|
-
NoRecords,
|
|
5850
|
-
{
|
|
5851
|
-
className: "px-10 py-4 h-[200px]",
|
|
5852
|
-
title: "No gift card products",
|
|
5853
|
-
message: "There are no gift card products to show. Create one to get started.",
|
|
5854
|
-
action: {
|
|
5855
|
-
to: "/gift-cards/gift-card-products/create",
|
|
5856
|
-
label: "Create gift card product"
|
|
5857
|
-
}
|
|
5858
|
-
}
|
|
5859
|
-
),
|
|
5860
|
-
slicedProducts.map((giftCardProduct) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5861
|
-
SidebarLink,
|
|
5862
|
-
{
|
|
5863
|
-
to: `/gift-cards/gift-card-products/${giftCardProduct.id}`,
|
|
5864
|
-
labelKey: giftCardProduct.title,
|
|
5865
|
-
descriptionKey: giftCardProduct.title,
|
|
5866
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Tag, {})
|
|
5867
|
-
}
|
|
5868
|
-
)),
|
|
5869
|
-
count2 > 3 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5870
|
-
reactRouterDom.Link,
|
|
5871
|
-
{
|
|
5872
|
-
to: "/gift-cards/gift-card-products",
|
|
5873
|
-
className: "text-ui-fg-muted text-sm px-6 py-4 flex items-center justify-center",
|
|
5874
|
-
children: "View more"
|
|
5875
|
-
}
|
|
5876
|
-
)
|
|
5877
|
-
] });
|
|
5878
|
-
};
|
|
5879
|
-
const _giftCardQueryKey = queryKeysFactory("gift-card");
|
|
5880
|
-
const giftCardQueryKey = {
|
|
5881
|
-
..._giftCardQueryKey,
|
|
5882
|
-
orders: (id) => [..._giftCardQueryKey.detail(id), "orders"]
|
|
5883
|
-
};
|
|
5884
|
-
const useGiftCards = (query, options) => {
|
|
5885
|
-
const fetchGiftCards = (query2, headers) => sdk.client.fetch(`/admin/gift-cards`, {
|
|
5886
|
-
query: query2,
|
|
5887
|
-
headers
|
|
5888
|
-
});
|
|
5889
|
-
const { data, ...rest } = reactQuery.useQuery({
|
|
5890
|
-
...options,
|
|
5891
|
-
queryFn: () => fetchGiftCards(query),
|
|
5892
|
-
queryKey: giftCardQueryKey.list(query)
|
|
5893
|
-
});
|
|
5894
|
-
return { ...data, ...rest };
|
|
5895
|
-
};
|
|
5896
|
-
const useGiftCard = (id, query, options) => {
|
|
5897
|
-
const fetchGiftCard = (id2, query2, headers) => sdk.client.fetch(`/admin/gift-cards/${id2}`, {
|
|
5898
|
-
query: query2,
|
|
5899
|
-
headers
|
|
5900
|
-
});
|
|
5901
|
-
const { data, ...rest } = reactQuery.useQuery({
|
|
5902
|
-
queryFn: () => fetchGiftCard(id, query),
|
|
5903
|
-
queryKey: giftCardQueryKey.detail(id, query),
|
|
5904
|
-
...options
|
|
5905
|
-
});
|
|
5906
|
-
return { ...data, ...rest };
|
|
5907
|
-
};
|
|
5908
|
-
const useGiftCardOrders = (id, options) => {
|
|
5909
|
-
const fetchGiftCardOrders = (id2, query, headers) => sdk.client.fetch(`/admin/gift-cards/${id2}/orders`, {
|
|
5910
|
-
query,
|
|
5911
|
-
headers
|
|
5912
|
-
});
|
|
5913
|
-
const { data, ...rest } = reactQuery.useQuery({
|
|
5914
|
-
queryFn: () => fetchGiftCardOrders(id),
|
|
5915
|
-
queryKey: giftCardQueryKey.orders(id),
|
|
5916
|
-
...options
|
|
5917
|
-
});
|
|
5918
|
-
return { ...data, ...rest };
|
|
5919
|
-
};
|
|
5920
|
-
const useUpdateGiftCard = (id, options) => {
|
|
5921
|
-
const queryClient = reactQuery.useQueryClient();
|
|
5922
|
-
const updateGiftCard = async (id2, body) => sdk.client.fetch(`/admin/gift-cards/${id2}`, {
|
|
5923
|
-
body,
|
|
5924
|
-
method: "POST"
|
|
5925
|
-
});
|
|
5926
|
-
return reactQuery.useMutation({
|
|
5927
|
-
mutationFn: async (payload) => updateGiftCard(id, payload),
|
|
5928
|
-
onSuccess: (data, variables, context) => {
|
|
5929
|
-
queryClient.invalidateQueries({
|
|
5930
|
-
queryKey: giftCardQueryKey.detail(id)
|
|
5931
|
-
});
|
|
5932
|
-
queryClient.invalidateQueries({
|
|
5933
|
-
queryKey: giftCardQueryKey.lists()
|
|
5934
|
-
});
|
|
5935
|
-
},
|
|
5936
|
-
...options
|
|
5937
|
-
});
|
|
5938
|
-
};
|
|
5939
|
-
const useCreateGiftCard = (options) => {
|
|
5940
|
-
const queryClient = reactQuery.useQueryClient();
|
|
5941
|
-
const createGiftCard = async (body) => sdk.client.fetch(`/admin/gift-cards`, {
|
|
5942
|
-
body,
|
|
5943
|
-
method: "POST"
|
|
5944
|
-
});
|
|
5945
|
-
return reactQuery.useMutation({
|
|
5946
|
-
mutationFn: (body) => createGiftCard(body),
|
|
5947
|
-
onSuccess: (data, variables, context) => {
|
|
5948
|
-
queryClient.invalidateQueries({ queryKey: giftCardQueryKey.lists() });
|
|
5949
|
-
},
|
|
5950
|
-
...options
|
|
5951
|
-
});
|
|
5952
|
-
};
|
|
5953
5805
|
function getRelativeDate(date2) {
|
|
5954
5806
|
const now = /* @__PURE__ */ new Date();
|
|
5955
5807
|
return formatDistance(sub(new Date(date2), { minutes: 0 }), now, {
|
|
@@ -5967,30 +5819,51 @@ function formatDate(date2, withTime = true) {
|
|
|
5967
5819
|
return format(new Date(date2), "dd MMM, yyyy");
|
|
5968
5820
|
}
|
|
5969
5821
|
const columnHelper$a = ui.createDataTableColumnHelper();
|
|
5970
|
-
const
|
|
5822
|
+
const useStoreCreditAccountTableColumns = () => {
|
|
5971
5823
|
return React.useMemo(() => {
|
|
5972
5824
|
return [
|
|
5973
|
-
columnHelper$a.accessor("
|
|
5974
|
-
header: "
|
|
5825
|
+
columnHelper$a.accessor("currency_code", {
|
|
5826
|
+
header: "Currency",
|
|
5975
5827
|
cell: ({ row }) => {
|
|
5976
|
-
return row.original.
|
|
5828
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { size: "2xsmall", children: row.original.currency_code.toUpperCase() });
|
|
5977
5829
|
}
|
|
5978
5830
|
}),
|
|
5979
|
-
columnHelper$a.accessor("
|
|
5980
|
-
header: "
|
|
5831
|
+
columnHelper$a.accessor("customer.email", {
|
|
5832
|
+
header: "Customer",
|
|
5981
5833
|
cell: ({ row }) => {
|
|
5982
|
-
return row.original.
|
|
5834
|
+
return row.original.customer?.email ?? "N/A";
|
|
5983
5835
|
}
|
|
5984
5836
|
}),
|
|
5985
|
-
columnHelper$a.accessor("
|
|
5986
|
-
header: "
|
|
5987
|
-
cell: ({ row }) =>
|
|
5837
|
+
columnHelper$a.accessor("balance", {
|
|
5838
|
+
header: "Balance",
|
|
5839
|
+
cell: ({ row }) => {
|
|
5840
|
+
return formatAmount(
|
|
5841
|
+
row.original.balance,
|
|
5842
|
+
row.original.currency_code
|
|
5843
|
+
);
|
|
5844
|
+
}
|
|
5988
5845
|
}),
|
|
5989
|
-
columnHelper$a.accessor("
|
|
5990
|
-
header: "
|
|
5846
|
+
columnHelper$a.accessor("credits", {
|
|
5847
|
+
header: "Credits",
|
|
5991
5848
|
cell: ({ row }) => {
|
|
5992
|
-
return formatAmount(
|
|
5849
|
+
return formatAmount(
|
|
5850
|
+
row.original.credits,
|
|
5851
|
+
row.original.currency_code
|
|
5852
|
+
);
|
|
5853
|
+
}
|
|
5854
|
+
}),
|
|
5855
|
+
columnHelper$a.accessor("debits", {
|
|
5856
|
+
header: "Debits",
|
|
5857
|
+
cell: ({ row }) => {
|
|
5858
|
+
return formatAmount(
|
|
5859
|
+
row.original.debits,
|
|
5860
|
+
row.original.currency_code
|
|
5861
|
+
);
|
|
5993
5862
|
}
|
|
5863
|
+
}),
|
|
5864
|
+
columnHelper$a.accessor("created_at", {
|
|
5865
|
+
header: "Created at",
|
|
5866
|
+
cell: ({ row }) => getRelativeDate(row.original.created_at)
|
|
5994
5867
|
})
|
|
5995
5868
|
];
|
|
5996
5869
|
}, []);
|
|
@@ -6037,75 +5910,83 @@ const useCustomerFilters = () => {
|
|
|
6037
5910
|
];
|
|
6038
5911
|
}, [customerFilterOptions]);
|
|
6039
5912
|
};
|
|
6040
|
-
const
|
|
5913
|
+
const useStoreCreditAccountFilters = () => {
|
|
6041
5914
|
const dateFilterOptions = useDataTableDateFilters$1();
|
|
6042
5915
|
const customerFilterOptions = useCustomerFilters();
|
|
6043
5916
|
return React.useMemo(() => {
|
|
6044
5917
|
return [...dateFilterOptions, ...customerFilterOptions];
|
|
6045
5918
|
}, [dateFilterOptions, customerFilterOptions]);
|
|
6046
5919
|
};
|
|
6047
|
-
const
|
|
5920
|
+
const useStoreCreditAccountsTableQuery = ({
|
|
6048
5921
|
prefix,
|
|
6049
5922
|
pageSize = 20
|
|
6050
5923
|
}) => {
|
|
6051
5924
|
const queryObject = useQueryParams(
|
|
6052
|
-
["
|
|
5925
|
+
["offset", "customer_id", "currency_code", "created_at", "updated_at"],
|
|
6053
5926
|
prefix
|
|
6054
5927
|
);
|
|
6055
|
-
const {
|
|
5928
|
+
const {
|
|
5929
|
+
offset: offset2,
|
|
5930
|
+
created_at,
|
|
5931
|
+
updated_at,
|
|
5932
|
+
customer_id,
|
|
5933
|
+
currency_code,
|
|
5934
|
+
...rest
|
|
5935
|
+
} = queryObject;
|
|
6056
5936
|
const searchParams = {
|
|
6057
5937
|
limit: pageSize,
|
|
6058
5938
|
offset: offset2 ? Number(offset2) : 0,
|
|
6059
5939
|
created_at: created_at ? JSON.parse(created_at) : void 0,
|
|
6060
5940
|
updated_at: updated_at ? JSON.parse(updated_at) : void 0,
|
|
6061
5941
|
customer_id: customer_id ? JSON.parse(customer_id) : void 0,
|
|
5942
|
+
currency_code: currency_code ? JSON.parse(currency_code) : void 0,
|
|
6062
5943
|
...rest
|
|
6063
5944
|
};
|
|
6064
5945
|
return searchParams;
|
|
6065
5946
|
};
|
|
6066
5947
|
const PAGE_SIZE$6 = 10;
|
|
6067
|
-
function
|
|
6068
|
-
const queryParams =
|
|
5948
|
+
function StoreCreditAccountsTable() {
|
|
5949
|
+
const queryParams = useStoreCreditAccountsTableQuery({
|
|
6069
5950
|
pageSize: PAGE_SIZE$6
|
|
6070
5951
|
});
|
|
6071
5952
|
const {
|
|
6072
|
-
|
|
5953
|
+
store_credit_accounts: storeCreditAccounts,
|
|
6073
5954
|
isPending,
|
|
6074
5955
|
count: count2
|
|
6075
|
-
} =
|
|
5956
|
+
} = useStoreCreditAccounts({
|
|
6076
5957
|
...queryParams,
|
|
6077
|
-
order: queryParams.order ?? "-created_at"
|
|
6078
|
-
fields: "+line_item.product.title"
|
|
5958
|
+
order: queryParams.order ?? "-created_at"
|
|
6079
5959
|
});
|
|
6080
|
-
const columns =
|
|
6081
|
-
const filters =
|
|
5960
|
+
const columns = useStoreCreditAccountTableColumns();
|
|
5961
|
+
const filters = useStoreCreditAccountFilters();
|
|
6082
5962
|
return /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
6083
5963
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6084
5964
|
DataTable,
|
|
6085
5965
|
{
|
|
6086
|
-
data:
|
|
5966
|
+
data: storeCreditAccounts ?? [],
|
|
6087
5967
|
getRowId: (row) => row.id,
|
|
6088
5968
|
columns,
|
|
6089
5969
|
filters,
|
|
6090
5970
|
isLoading: isPending,
|
|
6091
5971
|
pageSize: PAGE_SIZE$6,
|
|
6092
5972
|
rowCount: count2,
|
|
6093
|
-
|
|
5973
|
+
enableSearch: false,
|
|
5974
|
+
heading: "Store Credit Accounts",
|
|
6094
5975
|
rowHref: (row) => `${row.id}`,
|
|
6095
5976
|
emptyState: {
|
|
6096
5977
|
empty: {
|
|
6097
|
-
heading: "No
|
|
6098
|
-
description: "Create a
|
|
5978
|
+
heading: "No store credit accounts found",
|
|
5979
|
+
description: "Create a new store credit account to get started."
|
|
6099
5980
|
},
|
|
6100
5981
|
filtered: {
|
|
6101
5982
|
heading: "No results found",
|
|
6102
|
-
description: "No
|
|
5983
|
+
description: "No store credit accounts match your filter criteria."
|
|
6103
5984
|
}
|
|
6104
5985
|
},
|
|
6105
5986
|
actions: [
|
|
6106
5987
|
{
|
|
6107
5988
|
label: "Create",
|
|
6108
|
-
to: "create"
|
|
5989
|
+
to: "/store-credit-accounts/create"
|
|
6109
5990
|
}
|
|
6110
5991
|
]
|
|
6111
5992
|
}
|
|
@@ -6113,16 +5994,15 @@ function GiftCardsTable() {
|
|
|
6113
5994
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
6114
5995
|
] });
|
|
6115
5996
|
}
|
|
6116
|
-
const
|
|
5997
|
+
const StoreCreditAccountsPage = () => {
|
|
6117
5998
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6118
5999
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6119
6000
|
components.LayoutComposer,
|
|
6120
6001
|
{
|
|
6121
|
-
widgetsZonePrefix: "
|
|
6122
|
-
preferredLayoutId: "core:
|
|
6002
|
+
widgetsZonePrefix: "store_credit_account.list",
|
|
6003
|
+
preferredLayoutId: "core:single-column",
|
|
6123
6004
|
sections: {
|
|
6124
|
-
main: /* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "
|
|
6125
|
-
side: /* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "GiftCardProductsSection", children: /* @__PURE__ */ jsxRuntime.jsx(GiftCardProductsSection, {}) })
|
|
6005
|
+
main: /* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountsTable", children: /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountsTable, {}) })
|
|
6126
6006
|
}
|
|
6127
6007
|
}
|
|
6128
6008
|
),
|
|
@@ -6130,8 +6010,8 @@ const GiftCardsPage = () => {
|
|
|
6130
6010
|
] });
|
|
6131
6011
|
};
|
|
6132
6012
|
const config$3 = adminSdk.defineRouteConfig({
|
|
6133
|
-
label: "
|
|
6134
|
-
icon:
|
|
6013
|
+
label: "Store Credits",
|
|
6014
|
+
icon: StoreCreditIcon
|
|
6135
6015
|
});
|
|
6136
6016
|
function setRef$2(ref, value) {
|
|
6137
6017
|
if (typeof ref === "function") {
|
|
@@ -10826,27 +10706,6 @@ const StackedFocusModal = Object.assign(Root, {
|
|
|
10826
10706
|
Description,
|
|
10827
10707
|
Title
|
|
10828
10708
|
});
|
|
10829
|
-
const STORE_QUERY_KEY = "store";
|
|
10830
|
-
const storeQueryKeys = queryKeysFactory(STORE_QUERY_KEY);
|
|
10831
|
-
async function retrieveActiveStore(query) {
|
|
10832
|
-
const response = await sdk.admin.store.list(query);
|
|
10833
|
-
const activeStore = response.stores?.[0];
|
|
10834
|
-
if (!activeStore) {
|
|
10835
|
-
throw new Medusa.FetchError("No active store found", "Not Found", 404);
|
|
10836
|
-
}
|
|
10837
|
-
return { store: activeStore };
|
|
10838
|
-
}
|
|
10839
|
-
const useStore$2 = (query, options) => {
|
|
10840
|
-
const { data, ...rest } = reactQuery.useQuery({
|
|
10841
|
-
queryFn: () => retrieveActiveStore(query),
|
|
10842
|
-
queryKey: storeQueryKeys.details(),
|
|
10843
|
-
...options
|
|
10844
|
-
});
|
|
10845
|
-
return {
|
|
10846
|
-
...data,
|
|
10847
|
-
...rest
|
|
10848
|
-
};
|
|
10849
|
-
};
|
|
10850
10709
|
const t$1 = (r, t2, s2) => {
|
|
10851
10710
|
if (r && "reportValidity" in r) {
|
|
10852
10711
|
const o2 = get$2(s2, t2);
|
|
@@ -12746,7 +12605,7 @@ function useStoreProps(store, props, key2, setKey) {
|
|
|
12746
12605
|
});
|
|
12747
12606
|
});
|
|
12748
12607
|
}
|
|
12749
|
-
function useStore$
|
|
12608
|
+
function useStore$2(createStore2, props) {
|
|
12750
12609
|
const [store, setStore] = React__namespace.useState(() => createStore2(props));
|
|
12751
12610
|
useSafeLayoutEffect(() => init(store), [store]);
|
|
12752
12611
|
const useState2 = React__namespace.useCallback(
|
|
@@ -13568,7 +13427,7 @@ function useDisclosureStoreProps(store, update, props) {
|
|
|
13568
13427
|
return Object.assign(store, { disclosure: props.disclosure });
|
|
13569
13428
|
}
|
|
13570
13429
|
function useDisclosureStore(props = {}) {
|
|
13571
|
-
const [store, update] = useStore$
|
|
13430
|
+
const [store, update] = useStore$2(createDisclosureStore, props);
|
|
13572
13431
|
return useDisclosureStoreProps(store, update, props);
|
|
13573
13432
|
}
|
|
13574
13433
|
var ctx$2 = createStoreContext(
|
|
@@ -14957,7 +14816,7 @@ function useDialogStoreProps(store, update, props) {
|
|
|
14957
14816
|
return useDisclosureStoreProps(store, update, props);
|
|
14958
14817
|
}
|
|
14959
14818
|
function useDialogStore(props = {}) {
|
|
14960
|
-
const [store, update] = useStore$
|
|
14819
|
+
const [store, update] = useStore$2(createDialogStore, props);
|
|
14961
14820
|
return useDialogStoreProps(store, update, props);
|
|
14962
14821
|
}
|
|
14963
14822
|
var TagName$e = "div";
|
|
@@ -17003,7 +16862,7 @@ function useComboboxStoreProps(store, update, props) {
|
|
|
17003
16862
|
}
|
|
17004
16863
|
function useComboboxStore(props = {}) {
|
|
17005
16864
|
props = useComboboxStoreOptions(props);
|
|
17006
|
-
const [store, update] = useStore$
|
|
16865
|
+
const [store, update] = useStore$2(createComboboxStore, props);
|
|
17007
16866
|
return useComboboxStoreProps(store, update, props);
|
|
17008
16867
|
}
|
|
17009
16868
|
function ComboboxProvider(props = {}) {
|
|
@@ -18108,6 +17967,369 @@ const ComboboxImpl = ({
|
|
|
18108
17967
|
);
|
|
18109
17968
|
};
|
|
18110
17969
|
const Combobox = genericForwardRef(ComboboxImpl);
|
|
17970
|
+
var isObject_1;
|
|
17971
|
+
var hasRequiredIsObject;
|
|
17972
|
+
function requireIsObject() {
|
|
17973
|
+
if (hasRequiredIsObject) return isObject_1;
|
|
17974
|
+
hasRequiredIsObject = 1;
|
|
17975
|
+
function isObject2(value) {
|
|
17976
|
+
var type = typeof value;
|
|
17977
|
+
return value != null && (type == "object" || type == "function");
|
|
17978
|
+
}
|
|
17979
|
+
isObject_1 = isObject2;
|
|
17980
|
+
return isObject_1;
|
|
17981
|
+
}
|
|
17982
|
+
var _freeGlobal;
|
|
17983
|
+
var hasRequired_freeGlobal;
|
|
17984
|
+
function require_freeGlobal() {
|
|
17985
|
+
if (hasRequired_freeGlobal) return _freeGlobal;
|
|
17986
|
+
hasRequired_freeGlobal = 1;
|
|
17987
|
+
var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
17988
|
+
_freeGlobal = freeGlobal;
|
|
17989
|
+
return _freeGlobal;
|
|
17990
|
+
}
|
|
17991
|
+
var _root;
|
|
17992
|
+
var hasRequired_root;
|
|
17993
|
+
function require_root() {
|
|
17994
|
+
if (hasRequired_root) return _root;
|
|
17995
|
+
hasRequired_root = 1;
|
|
17996
|
+
var freeGlobal = require_freeGlobal();
|
|
17997
|
+
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
17998
|
+
var root = freeGlobal || freeSelf || Function("return this")();
|
|
17999
|
+
_root = root;
|
|
18000
|
+
return _root;
|
|
18001
|
+
}
|
|
18002
|
+
var now_1;
|
|
18003
|
+
var hasRequiredNow;
|
|
18004
|
+
function requireNow() {
|
|
18005
|
+
if (hasRequiredNow) return now_1;
|
|
18006
|
+
hasRequiredNow = 1;
|
|
18007
|
+
var root = require_root();
|
|
18008
|
+
var now = function() {
|
|
18009
|
+
return root.Date.now();
|
|
18010
|
+
};
|
|
18011
|
+
now_1 = now;
|
|
18012
|
+
return now_1;
|
|
18013
|
+
}
|
|
18014
|
+
var _trimmedEndIndex;
|
|
18015
|
+
var hasRequired_trimmedEndIndex;
|
|
18016
|
+
function require_trimmedEndIndex() {
|
|
18017
|
+
if (hasRequired_trimmedEndIndex) return _trimmedEndIndex;
|
|
18018
|
+
hasRequired_trimmedEndIndex = 1;
|
|
18019
|
+
var reWhitespace = /\s/;
|
|
18020
|
+
function trimmedEndIndex(string2) {
|
|
18021
|
+
var index = string2.length;
|
|
18022
|
+
while (index-- && reWhitespace.test(string2.charAt(index))) {
|
|
18023
|
+
}
|
|
18024
|
+
return index;
|
|
18025
|
+
}
|
|
18026
|
+
_trimmedEndIndex = trimmedEndIndex;
|
|
18027
|
+
return _trimmedEndIndex;
|
|
18028
|
+
}
|
|
18029
|
+
var _baseTrim;
|
|
18030
|
+
var hasRequired_baseTrim;
|
|
18031
|
+
function require_baseTrim() {
|
|
18032
|
+
if (hasRequired_baseTrim) return _baseTrim;
|
|
18033
|
+
hasRequired_baseTrim = 1;
|
|
18034
|
+
var trimmedEndIndex = require_trimmedEndIndex();
|
|
18035
|
+
var reTrimStart = /^\s+/;
|
|
18036
|
+
function baseTrim(string2) {
|
|
18037
|
+
return string2 ? string2.slice(0, trimmedEndIndex(string2) + 1).replace(reTrimStart, "") : string2;
|
|
18038
|
+
}
|
|
18039
|
+
_baseTrim = baseTrim;
|
|
18040
|
+
return _baseTrim;
|
|
18041
|
+
}
|
|
18042
|
+
var _Symbol;
|
|
18043
|
+
var hasRequired_Symbol;
|
|
18044
|
+
function require_Symbol() {
|
|
18045
|
+
if (hasRequired_Symbol) return _Symbol;
|
|
18046
|
+
hasRequired_Symbol = 1;
|
|
18047
|
+
var root = require_root();
|
|
18048
|
+
var Symbol2 = root.Symbol;
|
|
18049
|
+
_Symbol = Symbol2;
|
|
18050
|
+
return _Symbol;
|
|
18051
|
+
}
|
|
18052
|
+
var _getRawTag;
|
|
18053
|
+
var hasRequired_getRawTag;
|
|
18054
|
+
function require_getRawTag() {
|
|
18055
|
+
if (hasRequired_getRawTag) return _getRawTag;
|
|
18056
|
+
hasRequired_getRawTag = 1;
|
|
18057
|
+
var Symbol2 = require_Symbol();
|
|
18058
|
+
var objectProto = Object.prototype;
|
|
18059
|
+
var hasOwnProperty2 = objectProto.hasOwnProperty;
|
|
18060
|
+
var nativeObjectToString = objectProto.toString;
|
|
18061
|
+
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
|
|
18062
|
+
function getRawTag(value) {
|
|
18063
|
+
var isOwn = hasOwnProperty2.call(value, symToStringTag), tag = value[symToStringTag];
|
|
18064
|
+
try {
|
|
18065
|
+
value[symToStringTag] = void 0;
|
|
18066
|
+
var unmasked = true;
|
|
18067
|
+
} catch (e) {
|
|
18068
|
+
}
|
|
18069
|
+
var result = nativeObjectToString.call(value);
|
|
18070
|
+
if (unmasked) {
|
|
18071
|
+
if (isOwn) {
|
|
18072
|
+
value[symToStringTag] = tag;
|
|
18073
|
+
} else {
|
|
18074
|
+
delete value[symToStringTag];
|
|
18075
|
+
}
|
|
18076
|
+
}
|
|
18077
|
+
return result;
|
|
18078
|
+
}
|
|
18079
|
+
_getRawTag = getRawTag;
|
|
18080
|
+
return _getRawTag;
|
|
18081
|
+
}
|
|
18082
|
+
var _objectToString;
|
|
18083
|
+
var hasRequired_objectToString;
|
|
18084
|
+
function require_objectToString() {
|
|
18085
|
+
if (hasRequired_objectToString) return _objectToString;
|
|
18086
|
+
hasRequired_objectToString = 1;
|
|
18087
|
+
var objectProto = Object.prototype;
|
|
18088
|
+
var nativeObjectToString = objectProto.toString;
|
|
18089
|
+
function objectToString(value) {
|
|
18090
|
+
return nativeObjectToString.call(value);
|
|
18091
|
+
}
|
|
18092
|
+
_objectToString = objectToString;
|
|
18093
|
+
return _objectToString;
|
|
18094
|
+
}
|
|
18095
|
+
var _baseGetTag;
|
|
18096
|
+
var hasRequired_baseGetTag;
|
|
18097
|
+
function require_baseGetTag() {
|
|
18098
|
+
if (hasRequired_baseGetTag) return _baseGetTag;
|
|
18099
|
+
hasRequired_baseGetTag = 1;
|
|
18100
|
+
var Symbol2 = require_Symbol(), getRawTag = require_getRawTag(), objectToString = require_objectToString();
|
|
18101
|
+
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
|
|
18102
|
+
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
|
|
18103
|
+
function baseGetTag(value) {
|
|
18104
|
+
if (value == null) {
|
|
18105
|
+
return value === void 0 ? undefinedTag : nullTag;
|
|
18106
|
+
}
|
|
18107
|
+
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
18108
|
+
}
|
|
18109
|
+
_baseGetTag = baseGetTag;
|
|
18110
|
+
return _baseGetTag;
|
|
18111
|
+
}
|
|
18112
|
+
var isObjectLike_1;
|
|
18113
|
+
var hasRequiredIsObjectLike;
|
|
18114
|
+
function requireIsObjectLike() {
|
|
18115
|
+
if (hasRequiredIsObjectLike) return isObjectLike_1;
|
|
18116
|
+
hasRequiredIsObjectLike = 1;
|
|
18117
|
+
function isObjectLike(value) {
|
|
18118
|
+
return value != null && typeof value == "object";
|
|
18119
|
+
}
|
|
18120
|
+
isObjectLike_1 = isObjectLike;
|
|
18121
|
+
return isObjectLike_1;
|
|
18122
|
+
}
|
|
18123
|
+
var isSymbol_1;
|
|
18124
|
+
var hasRequiredIsSymbol;
|
|
18125
|
+
function requireIsSymbol() {
|
|
18126
|
+
if (hasRequiredIsSymbol) return isSymbol_1;
|
|
18127
|
+
hasRequiredIsSymbol = 1;
|
|
18128
|
+
var baseGetTag = require_baseGetTag(), isObjectLike = requireIsObjectLike();
|
|
18129
|
+
var symbolTag = "[object Symbol]";
|
|
18130
|
+
function isSymbol(value) {
|
|
18131
|
+
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
18132
|
+
}
|
|
18133
|
+
isSymbol_1 = isSymbol;
|
|
18134
|
+
return isSymbol_1;
|
|
18135
|
+
}
|
|
18136
|
+
var toNumber_1;
|
|
18137
|
+
var hasRequiredToNumber;
|
|
18138
|
+
function requireToNumber() {
|
|
18139
|
+
if (hasRequiredToNumber) return toNumber_1;
|
|
18140
|
+
hasRequiredToNumber = 1;
|
|
18141
|
+
var baseTrim = require_baseTrim(), isObject2 = requireIsObject(), isSymbol = requireIsSymbol();
|
|
18142
|
+
var NAN = 0 / 0;
|
|
18143
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
18144
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
18145
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
18146
|
+
var freeParseInt = parseInt;
|
|
18147
|
+
function toNumber(value) {
|
|
18148
|
+
if (typeof value == "number") {
|
|
18149
|
+
return value;
|
|
18150
|
+
}
|
|
18151
|
+
if (isSymbol(value)) {
|
|
18152
|
+
return NAN;
|
|
18153
|
+
}
|
|
18154
|
+
if (isObject2(value)) {
|
|
18155
|
+
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
18156
|
+
value = isObject2(other) ? other + "" : other;
|
|
18157
|
+
}
|
|
18158
|
+
if (typeof value != "string") {
|
|
18159
|
+
return value === 0 ? value : +value;
|
|
18160
|
+
}
|
|
18161
|
+
value = baseTrim(value);
|
|
18162
|
+
var isBinary = reIsBinary.test(value);
|
|
18163
|
+
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
18164
|
+
}
|
|
18165
|
+
toNumber_1 = toNumber;
|
|
18166
|
+
return toNumber_1;
|
|
18167
|
+
}
|
|
18168
|
+
var debounce_1;
|
|
18169
|
+
var hasRequiredDebounce;
|
|
18170
|
+
function requireDebounce() {
|
|
18171
|
+
if (hasRequiredDebounce) return debounce_1;
|
|
18172
|
+
hasRequiredDebounce = 1;
|
|
18173
|
+
var isObject2 = requireIsObject(), now = requireNow(), toNumber = requireToNumber();
|
|
18174
|
+
var FUNC_ERROR_TEXT = "Expected a function";
|
|
18175
|
+
var nativeMax = Math.max, nativeMin = Math.min;
|
|
18176
|
+
function debounce2(func, wait, options) {
|
|
18177
|
+
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
18178
|
+
if (typeof func != "function") {
|
|
18179
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
18180
|
+
}
|
|
18181
|
+
wait = toNumber(wait) || 0;
|
|
18182
|
+
if (isObject2(options)) {
|
|
18183
|
+
leading = !!options.leading;
|
|
18184
|
+
maxing = "maxWait" in options;
|
|
18185
|
+
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
18186
|
+
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
18187
|
+
}
|
|
18188
|
+
function invokeFunc(time2) {
|
|
18189
|
+
var args = lastArgs, thisArg = lastThis;
|
|
18190
|
+
lastArgs = lastThis = void 0;
|
|
18191
|
+
lastInvokeTime = time2;
|
|
18192
|
+
result = func.apply(thisArg, args);
|
|
18193
|
+
return result;
|
|
18194
|
+
}
|
|
18195
|
+
function leadingEdge(time2) {
|
|
18196
|
+
lastInvokeTime = time2;
|
|
18197
|
+
timerId = setTimeout(timerExpired, wait);
|
|
18198
|
+
return leading ? invokeFunc(time2) : result;
|
|
18199
|
+
}
|
|
18200
|
+
function remainingWait(time2) {
|
|
18201
|
+
var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
|
|
18202
|
+
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
|
|
18203
|
+
}
|
|
18204
|
+
function shouldInvoke(time2) {
|
|
18205
|
+
var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime;
|
|
18206
|
+
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
|
|
18207
|
+
}
|
|
18208
|
+
function timerExpired() {
|
|
18209
|
+
var time2 = now();
|
|
18210
|
+
if (shouldInvoke(time2)) {
|
|
18211
|
+
return trailingEdge(time2);
|
|
18212
|
+
}
|
|
18213
|
+
timerId = setTimeout(timerExpired, remainingWait(time2));
|
|
18214
|
+
}
|
|
18215
|
+
function trailingEdge(time2) {
|
|
18216
|
+
timerId = void 0;
|
|
18217
|
+
if (trailing && lastArgs) {
|
|
18218
|
+
return invokeFunc(time2);
|
|
18219
|
+
}
|
|
18220
|
+
lastArgs = lastThis = void 0;
|
|
18221
|
+
return result;
|
|
18222
|
+
}
|
|
18223
|
+
function cancel() {
|
|
18224
|
+
if (timerId !== void 0) {
|
|
18225
|
+
clearTimeout(timerId);
|
|
18226
|
+
}
|
|
18227
|
+
lastInvokeTime = 0;
|
|
18228
|
+
lastArgs = lastCallTime = lastThis = timerId = void 0;
|
|
18229
|
+
}
|
|
18230
|
+
function flush() {
|
|
18231
|
+
return timerId === void 0 ? result : trailingEdge(now());
|
|
18232
|
+
}
|
|
18233
|
+
function debounced() {
|
|
18234
|
+
var time2 = now(), isInvoking = shouldInvoke(time2);
|
|
18235
|
+
lastArgs = arguments;
|
|
18236
|
+
lastThis = this;
|
|
18237
|
+
lastCallTime = time2;
|
|
18238
|
+
if (isInvoking) {
|
|
18239
|
+
if (timerId === void 0) {
|
|
18240
|
+
return leadingEdge(lastCallTime);
|
|
18241
|
+
}
|
|
18242
|
+
if (maxing) {
|
|
18243
|
+
clearTimeout(timerId);
|
|
18244
|
+
timerId = setTimeout(timerExpired, wait);
|
|
18245
|
+
return invokeFunc(lastCallTime);
|
|
18246
|
+
}
|
|
18247
|
+
}
|
|
18248
|
+
if (timerId === void 0) {
|
|
18249
|
+
timerId = setTimeout(timerExpired, wait);
|
|
18250
|
+
}
|
|
18251
|
+
return result;
|
|
18252
|
+
}
|
|
18253
|
+
debounced.cancel = cancel;
|
|
18254
|
+
debounced.flush = flush;
|
|
18255
|
+
return debounced;
|
|
18256
|
+
}
|
|
18257
|
+
debounce_1 = debounce2;
|
|
18258
|
+
return debounce_1;
|
|
18259
|
+
}
|
|
18260
|
+
var debounceExports = requireDebounce();
|
|
18261
|
+
const debounce$1 = /* @__PURE__ */ getDefaultExportFromCjs(debounceExports);
|
|
18262
|
+
const useDebouncedSearch = () => {
|
|
18263
|
+
const [searchValue, onSearchValueChange] = React.useState("");
|
|
18264
|
+
const [debouncedQuery, setDebouncedQuery] = React.useState("");
|
|
18265
|
+
const debouncedUpdate = React.useCallback(
|
|
18266
|
+
debounce$1((query) => setDebouncedQuery(query), 300),
|
|
18267
|
+
[]
|
|
18268
|
+
);
|
|
18269
|
+
React.useEffect(() => {
|
|
18270
|
+
debouncedUpdate(searchValue);
|
|
18271
|
+
return () => debouncedUpdate.cancel();
|
|
18272
|
+
}, [searchValue, debouncedUpdate]);
|
|
18273
|
+
return {
|
|
18274
|
+
searchValue,
|
|
18275
|
+
onSearchValueChange,
|
|
18276
|
+
query: debouncedQuery || void 0
|
|
18277
|
+
};
|
|
18278
|
+
};
|
|
18279
|
+
const useComboboxData = ({
|
|
18280
|
+
queryKey,
|
|
18281
|
+
queryFn,
|
|
18282
|
+
getOptions,
|
|
18283
|
+
defaultValue: defaultValue2,
|
|
18284
|
+
defaultValueKey,
|
|
18285
|
+
pageSize = 10
|
|
18286
|
+
}) => {
|
|
18287
|
+
const { searchValue, onSearchValueChange, query } = useDebouncedSearch();
|
|
18288
|
+
const queryInitialDataBy = defaultValueKey || "id";
|
|
18289
|
+
const { data: initialData } = reactQuery.useQuery({
|
|
18290
|
+
queryKey,
|
|
18291
|
+
queryFn: async () => {
|
|
18292
|
+
return queryFn({
|
|
18293
|
+
[queryInitialDataBy]: defaultValue2,
|
|
18294
|
+
limit: Array.isArray(defaultValue2) ? defaultValue2.length : 1
|
|
18295
|
+
});
|
|
18296
|
+
},
|
|
18297
|
+
enabled: !!defaultValue2
|
|
18298
|
+
});
|
|
18299
|
+
const { data, ...rest } = reactQuery.useInfiniteQuery({
|
|
18300
|
+
queryKey: [...queryKey, query],
|
|
18301
|
+
queryFn: async ({ pageParam = 0 }) => {
|
|
18302
|
+
return await queryFn({
|
|
18303
|
+
q: query,
|
|
18304
|
+
limit: pageSize,
|
|
18305
|
+
offset: pageParam
|
|
18306
|
+
});
|
|
18307
|
+
},
|
|
18308
|
+
initialPageParam: 0,
|
|
18309
|
+
getNextPageParam: (lastPage) => {
|
|
18310
|
+
const moreItemsExist = lastPage.count > lastPage.offset + lastPage.limit;
|
|
18311
|
+
return moreItemsExist ? lastPage.offset + lastPage.limit : void 0;
|
|
18312
|
+
},
|
|
18313
|
+
placeholderData: reactQuery.keepPreviousData
|
|
18314
|
+
});
|
|
18315
|
+
const options = data?.pages.flatMap((page) => getOptions(page)) ?? [];
|
|
18316
|
+
const defaultOptions2 = initialData ? getOptions(initialData) : [];
|
|
18317
|
+
const disabled = !rest.isPending && !options.length && !searchValue;
|
|
18318
|
+
if (defaultValue2 && defaultOptions2.length && !searchValue) {
|
|
18319
|
+
defaultOptions2.forEach((option) => {
|
|
18320
|
+
if (!options.find((o2) => o2.value === option.value)) {
|
|
18321
|
+
options.unshift(option);
|
|
18322
|
+
}
|
|
18323
|
+
});
|
|
18324
|
+
}
|
|
18325
|
+
return {
|
|
18326
|
+
options,
|
|
18327
|
+
searchValue,
|
|
18328
|
+
onSearchValueChange,
|
|
18329
|
+
disabled,
|
|
18330
|
+
...rest
|
|
18331
|
+
};
|
|
18332
|
+
};
|
|
18111
18333
|
const currencies = {
|
|
18112
18334
|
USD: {
|
|
18113
18335
|
code: "USD",
|
|
@@ -18848,6 +19070,501 @@ const currencies = {
|
|
|
18848
19070
|
decimal_digits: 0
|
|
18849
19071
|
}
|
|
18850
19072
|
};
|
|
19073
|
+
const formSchema = zod.z.object({
|
|
19074
|
+
currency_code: zod.z.string().min(1, "Please select a currency"),
|
|
19075
|
+
customer_id: zod.z.string().optional()
|
|
19076
|
+
});
|
|
19077
|
+
const StoreCreditAccountCreateForm = () => {
|
|
19078
|
+
const { handleSuccess } = useRouteModal();
|
|
19079
|
+
const form = useForm({
|
|
19080
|
+
defaultValues: {
|
|
19081
|
+
currency_code: "",
|
|
19082
|
+
customer_id: ""
|
|
19083
|
+
},
|
|
19084
|
+
resolver: u(formSchema)
|
|
19085
|
+
});
|
|
19086
|
+
const { mutateAsync: createStoreCreditAccount, isPending } = useCreateStoreCreditAccount();
|
|
19087
|
+
const handleSubmit = form.handleSubmit(async (data) => {
|
|
19088
|
+
if (!data.customer_id) {
|
|
19089
|
+
delete data.customer_id;
|
|
19090
|
+
}
|
|
19091
|
+
await createStoreCreditAccount(data, {
|
|
19092
|
+
onSuccess: (data2) => {
|
|
19093
|
+
ui.toast.success(`Store credit account was successfully created.`);
|
|
19094
|
+
handleSuccess(`../${data2.store_credit_account.id}`);
|
|
19095
|
+
},
|
|
19096
|
+
onError: (error) => {
|
|
19097
|
+
ui.toast.error(error.message);
|
|
19098
|
+
}
|
|
19099
|
+
});
|
|
19100
|
+
});
|
|
19101
|
+
const [currencySearchValue, setCurrencySearchValue] = React.useState("");
|
|
19102
|
+
const currencyOptions = React.useMemo(() => {
|
|
19103
|
+
const options = Object.values(currencies).map((currency) => ({
|
|
19104
|
+
label: `${currency.code} - ${currency.name} (${currency.symbol_native})`,
|
|
19105
|
+
value: currency.code.toLowerCase()
|
|
19106
|
+
}));
|
|
19107
|
+
if (!currencySearchValue) {
|
|
19108
|
+
return options;
|
|
19109
|
+
}
|
|
19110
|
+
return options.filter(
|
|
19111
|
+
(option) => option.label.toLowerCase().includes(currencySearchValue.toLowerCase())
|
|
19112
|
+
);
|
|
19113
|
+
}, [currencySearchValue]);
|
|
19114
|
+
const {
|
|
19115
|
+
options: customerOptions,
|
|
19116
|
+
fetchNextPage,
|
|
19117
|
+
isFetchingNextPage,
|
|
19118
|
+
searchValue,
|
|
19119
|
+
onSearchValueChange,
|
|
19120
|
+
isLoading
|
|
19121
|
+
} = useComboboxData({
|
|
19122
|
+
queryKey: customersQueryKeys.list(),
|
|
19123
|
+
queryFn: async (params) => {
|
|
19124
|
+
return sdk.admin.customer.list(params);
|
|
19125
|
+
},
|
|
19126
|
+
getOptions: (data) => {
|
|
19127
|
+
return data.customers?.map((customer) => {
|
|
19128
|
+
const fullName = [customer.first_name, customer.last_name].filter(Boolean).join(" ");
|
|
19129
|
+
const label = fullName ? `${customer.email} (${fullName})` : customer.email;
|
|
19130
|
+
return {
|
|
19131
|
+
label,
|
|
19132
|
+
value: customer.id
|
|
19133
|
+
};
|
|
19134
|
+
}) || [];
|
|
19135
|
+
}
|
|
19136
|
+
});
|
|
19137
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteFocusModal.Form, { form, children: [
|
|
19138
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Header, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "-my-2 w-full border-l" }) }),
|
|
19139
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Body, { className: "size-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-center p-16", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full max-w-[720px] flex-col gap-y-8", children: [
|
|
19140
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
19141
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Create Store Credit Account" }),
|
|
19142
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-ui-fg-subtle", size: "small", children: "Create a new store credit account for a customer" })
|
|
19143
|
+
] }),
|
|
19144
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-x-4", children: [
|
|
19145
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19146
|
+
Form$2.Field,
|
|
19147
|
+
{
|
|
19148
|
+
control: form.control,
|
|
19149
|
+
name: "currency_code",
|
|
19150
|
+
render: ({ field }) => {
|
|
19151
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { className: "w-full", children: [
|
|
19152
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { className: "font-normal", children: "Currency" }),
|
|
19153
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
19154
|
+
Combobox,
|
|
19155
|
+
{
|
|
19156
|
+
value: field.value,
|
|
19157
|
+
onChange: field.onChange,
|
|
19158
|
+
searchValue: currencySearchValue,
|
|
19159
|
+
onSearchValueChange: setCurrencySearchValue,
|
|
19160
|
+
options: currencyOptions,
|
|
19161
|
+
placeholder: "Search for a currency..."
|
|
19162
|
+
}
|
|
19163
|
+
) }),
|
|
19164
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
19165
|
+
] });
|
|
19166
|
+
}
|
|
19167
|
+
}
|
|
19168
|
+
),
|
|
19169
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19170
|
+
Form$2.Field,
|
|
19171
|
+
{
|
|
19172
|
+
control: form.control,
|
|
19173
|
+
name: "customer_id",
|
|
19174
|
+
render: ({ field }) => {
|
|
19175
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { className: "w-full", children: [
|
|
19176
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { className: "font-normal", children: "Customer" }),
|
|
19177
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
19178
|
+
Combobox,
|
|
19179
|
+
{
|
|
19180
|
+
value: field.value,
|
|
19181
|
+
onChange: field.onChange,
|
|
19182
|
+
searchValue,
|
|
19183
|
+
onSearchValueChange,
|
|
19184
|
+
options: customerOptions,
|
|
19185
|
+
placeholder: "Search for a customer...",
|
|
19186
|
+
fetchNextPage,
|
|
19187
|
+
isFetchingNextPage,
|
|
19188
|
+
noResultsPlaceholder: isLoading ? "Loading customers..." : "No customers found"
|
|
19189
|
+
}
|
|
19190
|
+
) }),
|
|
19191
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
19192
|
+
] });
|
|
19193
|
+
}
|
|
19194
|
+
}
|
|
19195
|
+
)
|
|
19196
|
+
] })
|
|
19197
|
+
] }) }) }),
|
|
19198
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteFocusModal.Footer, { children: [
|
|
19199
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Close, { asChild: true, disabled: isPending, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", size: "small", disabled: isPending, children: "Cancel" }) }),
|
|
19200
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19201
|
+
ui.Button,
|
|
19202
|
+
{
|
|
19203
|
+
variant: "primary",
|
|
19204
|
+
size: "small",
|
|
19205
|
+
onClick: handleSubmit,
|
|
19206
|
+
disabled: isPending,
|
|
19207
|
+
children: "Create"
|
|
19208
|
+
}
|
|
19209
|
+
)
|
|
19210
|
+
] })
|
|
19211
|
+
] });
|
|
19212
|
+
};
|
|
19213
|
+
const StoreCreditAccountCreate = () => {
|
|
19214
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteFocusModal, { children: [
|
|
19215
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Create Store Credit Account" }) }),
|
|
19216
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Create a new store credit account" }) }),
|
|
19217
|
+
/* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountCreateForm, {})
|
|
19218
|
+
] });
|
|
19219
|
+
};
|
|
19220
|
+
const GiftCardIcon = (props) => {
|
|
19221
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19222
|
+
"svg",
|
|
19223
|
+
{
|
|
19224
|
+
width: "15",
|
|
19225
|
+
height: "15",
|
|
19226
|
+
viewBox: "0 0 15 15",
|
|
19227
|
+
fill: "none",
|
|
19228
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
19229
|
+
...props,
|
|
19230
|
+
children: [
|
|
19231
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { width: "15", height: "15", fill: "#F97316" }),
|
|
19232
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19233
|
+
"rect",
|
|
19234
|
+
{
|
|
19235
|
+
width: "15",
|
|
19236
|
+
height: "15",
|
|
19237
|
+
fill: "url(#paint0_linear_28788_25808)",
|
|
19238
|
+
fillOpacity: "0.2"
|
|
19239
|
+
}
|
|
19240
|
+
),
|
|
19241
|
+
/* @__PURE__ */ jsxRuntime.jsxs("g", { clipPath: "url(#clip0_28788_25808)", children: [
|
|
19242
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19243
|
+
"path",
|
|
19244
|
+
{
|
|
19245
|
+
d: "M7.5 6.375H5.375C4.479 6.375 3.75 5.618 3.75 4.688C3.75 3.757 4.479 3 5.375 3C7.365 3 8.019 5.569 8.047 5.678C8.088 5.846 8.05 6.023 7.943 6.16C7.836 6.296 7.673 6.375 7.5 6.375ZM5.375 4.125C5.099 4.125 4.875 4.377 4.875 4.688C4.875 4.998 5.099 5.25 5.375 5.25H6.688C6.439 4.736 6.011 4.125 5.375 4.125Z",
|
|
19246
|
+
fill: "white"
|
|
19247
|
+
}
|
|
19248
|
+
),
|
|
19249
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19250
|
+
"path",
|
|
19251
|
+
{
|
|
19252
|
+
d: "M9.625 6.375H7.5C7.328 6.375 7.164 6.296 7.058 6.16C6.95 6.023 6.913 5.846 6.953 5.678C6.98 5.569 7.634 3 9.625 3C10.521 3 11.25 3.757 11.25 4.688C11.25 5.618 10.521 6.375 9.625 6.375ZM8.312 5.25H9.625C9.901 5.25 10.125 4.998 10.125 4.688C10.125 4.377 9.901 4.125 9.625 4.125C8.99 4.125 8.561 4.736 8.312 5.25Z",
|
|
19253
|
+
fill: "white"
|
|
19254
|
+
}
|
|
19255
|
+
),
|
|
19256
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19257
|
+
"path",
|
|
19258
|
+
{
|
|
19259
|
+
d: "M11.438 6.375H3.562C3.252 6.375 3 6.123 3 5.813C3 5.502 3.252 5.25 3.562 5.25H11.438C11.748 5.25 12 5.502 12 5.813C12 6.123 11.748 6.375 11.438 6.375Z",
|
|
19260
|
+
fill: "white"
|
|
19261
|
+
}
|
|
19262
|
+
),
|
|
19263
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19264
|
+
"path",
|
|
19265
|
+
{
|
|
19266
|
+
d: "M6.938 7.5H3.75V9.563C3.75 10.7 4.675 11.625 5.813 11.625H6.938V7.5Z",
|
|
19267
|
+
fill: "white"
|
|
19268
|
+
}
|
|
19269
|
+
),
|
|
19270
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19271
|
+
"path",
|
|
19272
|
+
{
|
|
19273
|
+
d: "M8.063 7.5V11.625H9.188C10.325 11.625 11.25 10.7 11.25 9.563V7.5H8.063Z",
|
|
19274
|
+
fill: "white"
|
|
19275
|
+
}
|
|
19276
|
+
)
|
|
19277
|
+
] }),
|
|
19278
|
+
/* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
|
|
19279
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
19280
|
+
"linearGradient",
|
|
19281
|
+
{
|
|
19282
|
+
id: "paint0_linear_28788_25808",
|
|
19283
|
+
x1: "7.5",
|
|
19284
|
+
y1: "0",
|
|
19285
|
+
x2: "7.5",
|
|
19286
|
+
y2: "15",
|
|
19287
|
+
gradientUnits: "userSpaceOnUse",
|
|
19288
|
+
children: [
|
|
19289
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "white" }),
|
|
19290
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })
|
|
19291
|
+
]
|
|
19292
|
+
}
|
|
19293
|
+
),
|
|
19294
|
+
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_28788_25808", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "9", height: "9", fill: "white", transform: "translate(3 3)" }) })
|
|
19295
|
+
] })
|
|
19296
|
+
]
|
|
19297
|
+
}
|
|
19298
|
+
);
|
|
19299
|
+
};
|
|
19300
|
+
const GiftCardProductsSection = () => {
|
|
19301
|
+
const { products: giftCardProducts, count: count2 = 0 } = useProducts({
|
|
19302
|
+
is_giftcard: true
|
|
19303
|
+
});
|
|
19304
|
+
const slicedProducts = giftCardProducts?.slice(0, 3) ?? [];
|
|
19305
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0", children: [
|
|
19306
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
19307
|
+
/* @__PURE__ */ jsxRuntime.jsx(Header$5, { title: "Gift Card Products" }),
|
|
19308
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19309
|
+
reactRouterDom.Link,
|
|
19310
|
+
{
|
|
19311
|
+
to: `/gift-cards/gift-card-products/create`,
|
|
19312
|
+
className: "text-ui-fg-muted text-sm px-6",
|
|
19313
|
+
children: "Create"
|
|
19314
|
+
}
|
|
19315
|
+
)
|
|
19316
|
+
] }),
|
|
19317
|
+
giftCardProducts?.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
19318
|
+
NoRecords,
|
|
19319
|
+
{
|
|
19320
|
+
className: "px-10 py-4 h-[200px]",
|
|
19321
|
+
title: "No gift card products",
|
|
19322
|
+
message: "There are no gift card products to show. Create one to get started.",
|
|
19323
|
+
action: {
|
|
19324
|
+
to: "/gift-cards/gift-card-products/create",
|
|
19325
|
+
label: "Create gift card product"
|
|
19326
|
+
}
|
|
19327
|
+
}
|
|
19328
|
+
),
|
|
19329
|
+
slicedProducts.map((giftCardProduct) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
19330
|
+
SidebarLink,
|
|
19331
|
+
{
|
|
19332
|
+
to: `/gift-cards/gift-card-products/${giftCardProduct.id}`,
|
|
19333
|
+
labelKey: giftCardProduct.title,
|
|
19334
|
+
descriptionKey: giftCardProduct.title,
|
|
19335
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Tag, {})
|
|
19336
|
+
}
|
|
19337
|
+
)),
|
|
19338
|
+
count2 > 3 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
19339
|
+
reactRouterDom.Link,
|
|
19340
|
+
{
|
|
19341
|
+
to: "/gift-cards/gift-card-products",
|
|
19342
|
+
className: "text-ui-fg-muted text-sm px-6 py-4 flex items-center justify-center",
|
|
19343
|
+
children: "View more"
|
|
19344
|
+
}
|
|
19345
|
+
)
|
|
19346
|
+
] });
|
|
19347
|
+
};
|
|
19348
|
+
const _giftCardQueryKey = queryKeysFactory("gift-card");
|
|
19349
|
+
const giftCardQueryKey = {
|
|
19350
|
+
..._giftCardQueryKey,
|
|
19351
|
+
orders: (id) => [..._giftCardQueryKey.detail(id), "orders"]
|
|
19352
|
+
};
|
|
19353
|
+
const useGiftCards = (query, options) => {
|
|
19354
|
+
const fetchGiftCards = (query2, headers) => sdk.client.fetch(`/admin/gift-cards`, {
|
|
19355
|
+
query: query2,
|
|
19356
|
+
headers
|
|
19357
|
+
});
|
|
19358
|
+
const { data, ...rest } = reactQuery.useQuery({
|
|
19359
|
+
...options,
|
|
19360
|
+
queryFn: () => fetchGiftCards(query),
|
|
19361
|
+
queryKey: giftCardQueryKey.list(query)
|
|
19362
|
+
});
|
|
19363
|
+
return { ...data, ...rest };
|
|
19364
|
+
};
|
|
19365
|
+
const useGiftCard = (id, query, options) => {
|
|
19366
|
+
const fetchGiftCard = (id2, query2, headers) => sdk.client.fetch(`/admin/gift-cards/${id2}`, {
|
|
19367
|
+
query: query2,
|
|
19368
|
+
headers
|
|
19369
|
+
});
|
|
19370
|
+
const { data, ...rest } = reactQuery.useQuery({
|
|
19371
|
+
queryFn: () => fetchGiftCard(id, query),
|
|
19372
|
+
queryKey: giftCardQueryKey.detail(id, query),
|
|
19373
|
+
...options
|
|
19374
|
+
});
|
|
19375
|
+
return { ...data, ...rest };
|
|
19376
|
+
};
|
|
19377
|
+
const useGiftCardOrders = (id, options) => {
|
|
19378
|
+
const fetchGiftCardOrders = (id2, query, headers) => sdk.client.fetch(`/admin/gift-cards/${id2}/orders`, {
|
|
19379
|
+
query,
|
|
19380
|
+
headers
|
|
19381
|
+
});
|
|
19382
|
+
const { data, ...rest } = reactQuery.useQuery({
|
|
19383
|
+
queryFn: () => fetchGiftCardOrders(id),
|
|
19384
|
+
queryKey: giftCardQueryKey.orders(id),
|
|
19385
|
+
...options
|
|
19386
|
+
});
|
|
19387
|
+
return { ...data, ...rest };
|
|
19388
|
+
};
|
|
19389
|
+
const useUpdateGiftCard = (id, options) => {
|
|
19390
|
+
const queryClient = reactQuery.useQueryClient();
|
|
19391
|
+
const updateGiftCard = async (id2, body) => sdk.client.fetch(`/admin/gift-cards/${id2}`, {
|
|
19392
|
+
body,
|
|
19393
|
+
method: "POST"
|
|
19394
|
+
});
|
|
19395
|
+
return reactQuery.useMutation({
|
|
19396
|
+
mutationFn: async (payload) => updateGiftCard(id, payload),
|
|
19397
|
+
onSuccess: (data, variables, context) => {
|
|
19398
|
+
queryClient.invalidateQueries({
|
|
19399
|
+
queryKey: giftCardQueryKey.detail(id)
|
|
19400
|
+
});
|
|
19401
|
+
queryClient.invalidateQueries({
|
|
19402
|
+
queryKey: giftCardQueryKey.lists()
|
|
19403
|
+
});
|
|
19404
|
+
},
|
|
19405
|
+
...options
|
|
19406
|
+
});
|
|
19407
|
+
};
|
|
19408
|
+
const useCreateGiftCard = (options) => {
|
|
19409
|
+
const queryClient = reactQuery.useQueryClient();
|
|
19410
|
+
const createGiftCard = async (body) => sdk.client.fetch(`/admin/gift-cards`, {
|
|
19411
|
+
body,
|
|
19412
|
+
method: "POST"
|
|
19413
|
+
});
|
|
19414
|
+
return reactQuery.useMutation({
|
|
19415
|
+
mutationFn: (body) => createGiftCard(body),
|
|
19416
|
+
onSuccess: (data, variables, context) => {
|
|
19417
|
+
queryClient.invalidateQueries({ queryKey: giftCardQueryKey.lists() });
|
|
19418
|
+
},
|
|
19419
|
+
...options
|
|
19420
|
+
});
|
|
19421
|
+
};
|
|
19422
|
+
const columnHelper$9 = ui.createDataTableColumnHelper();
|
|
19423
|
+
const useGiftCardTableColumns = () => {
|
|
19424
|
+
return React.useMemo(() => {
|
|
19425
|
+
return [
|
|
19426
|
+
columnHelper$9.accessor("code", {
|
|
19427
|
+
header: "Code",
|
|
19428
|
+
cell: ({ row }) => {
|
|
19429
|
+
return row.original.code;
|
|
19430
|
+
}
|
|
19431
|
+
}),
|
|
19432
|
+
columnHelper$9.accessor("line_item.product.title", {
|
|
19433
|
+
header: "Product",
|
|
19434
|
+
cell: ({ row }) => {
|
|
19435
|
+
return row.original.line_item?.product?.title || "Custom Gift Card";
|
|
19436
|
+
}
|
|
19437
|
+
}),
|
|
19438
|
+
columnHelper$9.accessor("created_at", {
|
|
19439
|
+
header: "Date issued",
|
|
19440
|
+
cell: ({ row }) => getRelativeDate(row.original.created_at)
|
|
19441
|
+
}),
|
|
19442
|
+
columnHelper$9.accessor("value", {
|
|
19443
|
+
header: "Value",
|
|
19444
|
+
cell: ({ row }) => {
|
|
19445
|
+
return formatAmount(row.original.value, row.original.currency_code);
|
|
19446
|
+
}
|
|
19447
|
+
})
|
|
19448
|
+
];
|
|
19449
|
+
}, []);
|
|
19450
|
+
};
|
|
19451
|
+
const useGiftCardFilters = () => {
|
|
19452
|
+
const dateFilterOptions = useDataTableDateFilters$1();
|
|
19453
|
+
const customerFilterOptions = useCustomerFilters();
|
|
19454
|
+
return React.useMemo(() => {
|
|
19455
|
+
return [...dateFilterOptions, ...customerFilterOptions];
|
|
19456
|
+
}, [dateFilterOptions, customerFilterOptions]);
|
|
19457
|
+
};
|
|
19458
|
+
const useGiftCardTableQuery = ({
|
|
19459
|
+
prefix,
|
|
19460
|
+
pageSize = 20
|
|
19461
|
+
}) => {
|
|
19462
|
+
const queryObject = useQueryParams(
|
|
19463
|
+
["q", "offset", "customer_id", "created_at", "updated_at"],
|
|
19464
|
+
prefix
|
|
19465
|
+
);
|
|
19466
|
+
const { offset: offset2, created_at, updated_at, customer_id, ...rest } = queryObject;
|
|
19467
|
+
const searchParams = {
|
|
19468
|
+
limit: pageSize,
|
|
19469
|
+
offset: offset2 ? Number(offset2) : 0,
|
|
19470
|
+
created_at: created_at ? JSON.parse(created_at) : void 0,
|
|
19471
|
+
updated_at: updated_at ? JSON.parse(updated_at) : void 0,
|
|
19472
|
+
customer_id: customer_id ? JSON.parse(customer_id) : void 0,
|
|
19473
|
+
...rest
|
|
19474
|
+
};
|
|
19475
|
+
return searchParams;
|
|
19476
|
+
};
|
|
19477
|
+
const PAGE_SIZE$5 = 10;
|
|
19478
|
+
function GiftCardsTable() {
|
|
19479
|
+
const queryParams = useGiftCardTableQuery({
|
|
19480
|
+
pageSize: PAGE_SIZE$5
|
|
19481
|
+
});
|
|
19482
|
+
const {
|
|
19483
|
+
gift_cards: giftCards,
|
|
19484
|
+
isPending,
|
|
19485
|
+
count: count2
|
|
19486
|
+
} = useGiftCards({
|
|
19487
|
+
...queryParams,
|
|
19488
|
+
order: queryParams.order ?? "-created_at",
|
|
19489
|
+
fields: "+line_item.product.title"
|
|
19490
|
+
});
|
|
19491
|
+
const columns = useGiftCardTableColumns();
|
|
19492
|
+
const filters = useGiftCardFilters();
|
|
19493
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
19494
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
19495
|
+
DataTable,
|
|
19496
|
+
{
|
|
19497
|
+
data: giftCards,
|
|
19498
|
+
getRowId: (row) => row.id,
|
|
19499
|
+
columns,
|
|
19500
|
+
filters,
|
|
19501
|
+
isLoading: isPending,
|
|
19502
|
+
pageSize: PAGE_SIZE$5,
|
|
19503
|
+
rowCount: count2,
|
|
19504
|
+
heading: "Gift Cards",
|
|
19505
|
+
rowHref: (row) => `${row.id}`,
|
|
19506
|
+
emptyState: {
|
|
19507
|
+
empty: {
|
|
19508
|
+
heading: "No gift cards found",
|
|
19509
|
+
description: "Create a gift card to get started."
|
|
19510
|
+
},
|
|
19511
|
+
filtered: {
|
|
19512
|
+
heading: "No results found",
|
|
19513
|
+
description: "No gift cards match your filter criteria."
|
|
19514
|
+
}
|
|
19515
|
+
},
|
|
19516
|
+
actions: [
|
|
19517
|
+
{
|
|
19518
|
+
label: "Create",
|
|
19519
|
+
to: "create"
|
|
19520
|
+
}
|
|
19521
|
+
]
|
|
19522
|
+
}
|
|
19523
|
+
) }),
|
|
19524
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
19525
|
+
] });
|
|
19526
|
+
}
|
|
19527
|
+
const GiftCardsPage = () => {
|
|
19528
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
19529
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19530
|
+
components.LayoutComposer,
|
|
19531
|
+
{
|
|
19532
|
+
widgetsZonePrefix: "gift_card.list",
|
|
19533
|
+
preferredLayoutId: "core:two-column",
|
|
19534
|
+
sections: {
|
|
19535
|
+
main: /* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "GiftCardsTable", children: /* @__PURE__ */ jsxRuntime.jsx(GiftCardsTable, {}) }),
|
|
19536
|
+
side: /* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "GiftCardProductsSection", children: /* @__PURE__ */ jsxRuntime.jsx(GiftCardProductsSection, {}) })
|
|
19537
|
+
}
|
|
19538
|
+
}
|
|
19539
|
+
),
|
|
19540
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Toaster, {})
|
|
19541
|
+
] });
|
|
19542
|
+
};
|
|
19543
|
+
const config$2 = adminSdk.defineRouteConfig({
|
|
19544
|
+
label: "Gift Cards",
|
|
19545
|
+
icon: GiftCardIcon
|
|
19546
|
+
});
|
|
19547
|
+
const STORE_QUERY_KEY = "store";
|
|
19548
|
+
const storeQueryKeys = queryKeysFactory(STORE_QUERY_KEY);
|
|
19549
|
+
async function retrieveActiveStore(query) {
|
|
19550
|
+
const response = await sdk.admin.store.list(query);
|
|
19551
|
+
const activeStore = response.stores?.[0];
|
|
19552
|
+
if (!activeStore) {
|
|
19553
|
+
throw new Medusa.FetchError("No active store found", "Not Found", 404);
|
|
19554
|
+
}
|
|
19555
|
+
return { store: activeStore };
|
|
19556
|
+
}
|
|
19557
|
+
const useStore$1 = (query, options) => {
|
|
19558
|
+
const { data, ...rest } = reactQuery.useQuery({
|
|
19559
|
+
queryFn: () => retrieveActiveStore(query),
|
|
19560
|
+
queryKey: storeQueryKeys.details(),
|
|
19561
|
+
...options
|
|
19562
|
+
});
|
|
19563
|
+
return {
|
|
19564
|
+
...data,
|
|
19565
|
+
...rest
|
|
19566
|
+
};
|
|
19567
|
+
};
|
|
18851
19568
|
function $constructor(name, initializer2, params) {
|
|
18852
19569
|
function init2(inst, def) {
|
|
18853
19570
|
if (!inst._zod) {
|
|
@@ -18911,7 +19628,7 @@ class $ZodEncodeError extends Error {
|
|
|
18911
19628
|
}
|
|
18912
19629
|
}
|
|
18913
19630
|
const globalConfig = {};
|
|
18914
|
-
function config$
|
|
19631
|
+
function config$1(newConfig) {
|
|
18915
19632
|
return globalConfig;
|
|
18916
19633
|
}
|
|
18917
19634
|
function getEnumValues(entries) {
|
|
@@ -19358,7 +20075,7 @@ const _parse = (_Err) => (schema2, value, _ctx, _params) => {
|
|
|
19358
20075
|
throw new $ZodAsyncError();
|
|
19359
20076
|
}
|
|
19360
20077
|
if (result.issues.length) {
|
|
19361
|
-
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
20078
|
+
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx2, config$1())));
|
|
19362
20079
|
captureStackTrace(e, _params?.callee);
|
|
19363
20080
|
throw e;
|
|
19364
20081
|
}
|
|
@@ -19370,7 +20087,7 @@ const _parseAsync = (_Err) => async (schema2, value, _ctx, params) => {
|
|
|
19370
20087
|
if (result instanceof Promise)
|
|
19371
20088
|
result = await result;
|
|
19372
20089
|
if (result.issues.length) {
|
|
19373
|
-
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
20090
|
+
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx2, config$1())));
|
|
19374
20091
|
captureStackTrace(e, params?.callee);
|
|
19375
20092
|
throw e;
|
|
19376
20093
|
}
|
|
@@ -19384,7 +20101,7 @@ const _safeParse = (_Err) => (schema2, value, _ctx) => {
|
|
|
19384
20101
|
}
|
|
19385
20102
|
return result.issues.length ? {
|
|
19386
20103
|
success: false,
|
|
19387
|
-
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
20104
|
+
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx2, config$1())))
|
|
19388
20105
|
} : { success: true, data: result.value };
|
|
19389
20106
|
};
|
|
19390
20107
|
const safeParse$1 = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
@@ -19395,7 +20112,7 @@ const _safeParseAsync = (_Err) => async (schema2, value, _ctx) => {
|
|
|
19395
20112
|
result = await result;
|
|
19396
20113
|
return result.issues.length ? {
|
|
19397
20114
|
success: false,
|
|
19398
|
-
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
20115
|
+
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx2, config$1())))
|
|
19399
20116
|
} : { success: true, data: result.value };
|
|
19400
20117
|
};
|
|
19401
20118
|
const safeParseAsync$1 = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
@@ -20651,7 +21368,7 @@ function handleUnionResults(results, final, inst, ctx2) {
|
|
|
20651
21368
|
code: "invalid_union",
|
|
20652
21369
|
input: final.value,
|
|
20653
21370
|
inst,
|
|
20654
|
-
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
21371
|
+
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx2, config$1())))
|
|
20655
21372
|
});
|
|
20656
21373
|
return final;
|
|
20657
21374
|
}
|
|
@@ -20844,7 +21561,7 @@ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
20844
21561
|
payload.issues.push({
|
|
20845
21562
|
code: "invalid_key",
|
|
20846
21563
|
origin: "record",
|
|
20847
|
-
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
21564
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx2, config$1())),
|
|
20848
21565
|
input: key2,
|
|
20849
21566
|
path: [key2],
|
|
20850
21567
|
inst
|
|
@@ -21043,7 +21760,7 @@ const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
|
21043
21760
|
payload.value = def.catchValue({
|
|
21044
21761
|
...payload,
|
|
21045
21762
|
error: {
|
|
21046
|
-
issues: result2.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
21763
|
+
issues: result2.issues.map((iss) => finalizeIssue(iss, ctx2, config$1()))
|
|
21047
21764
|
},
|
|
21048
21765
|
input: payload.value
|
|
21049
21766
|
});
|
|
@@ -21057,7 +21774,7 @@ const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
|
21057
21774
|
payload.value = def.catchValue({
|
|
21058
21775
|
...payload,
|
|
21059
21776
|
error: {
|
|
21060
|
-
issues: result.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
21777
|
+
issues: result.issues.map((iss) => finalizeIssue(iss, ctx2, config$1()))
|
|
21061
21778
|
},
|
|
21062
21779
|
input: payload.value
|
|
21063
21780
|
});
|
|
@@ -23105,730 +23822,561 @@ const GiftCardCreateForm = ({
|
|
|
23105
23822
|
] });
|
|
23106
23823
|
};
|
|
23107
23824
|
const GiftCardCreate = () => {
|
|
23108
|
-
const { store, isLoading } = useStore$
|
|
23825
|
+
const { store, isLoading } = useStore$1({});
|
|
23109
23826
|
return /* @__PURE__ */ jsxRuntime.jsxs(RouteFocusModal, { children: [
|
|
23110
23827
|
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Create Gift Card" }) }),
|
|
23111
23828
|
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Create a new gift card" }) }),
|
|
23112
23829
|
!isLoading && /* @__PURE__ */ jsxRuntime.jsx(GiftCardCreateForm, { store })
|
|
23113
23830
|
] });
|
|
23114
23831
|
};
|
|
23115
|
-
const
|
|
23116
|
-
|
|
23117
|
-
|
|
23118
|
-
|
|
23119
|
-
|
|
23120
|
-
|
|
23121
|
-
|
|
23122
|
-
|
|
23123
|
-
|
|
23124
|
-
|
|
23125
|
-
|
|
23126
|
-
|
|
23127
|
-
|
|
23128
|
-
"
|
|
23129
|
-
|
|
23130
|
-
|
|
23131
|
-
|
|
23132
|
-
|
|
23133
|
-
|
|
23134
|
-
|
|
23135
|
-
|
|
23136
|
-
|
|
23137
|
-
|
|
23138
|
-
|
|
23139
|
-
|
|
23140
|
-
|
|
23141
|
-
|
|
23142
|
-
|
|
23143
|
-
|
|
23144
|
-
|
|
23145
|
-
|
|
23146
|
-
|
|
23147
|
-
|
|
23832
|
+
const StoreCreditAccountBalanceSection = ({
|
|
23833
|
+
storeCreditAccount
|
|
23834
|
+
}) => {
|
|
23835
|
+
if (!storeCreditAccount || typeof storeCreditAccount.balance === "undefined") {
|
|
23836
|
+
return;
|
|
23837
|
+
}
|
|
23838
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "grid grid-cols-2 gap-x-2 px-6 py-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-ui-fg-subtle flex items-center gap-x-3", children: [
|
|
23839
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-ui-tag-green-icon h-8 w-1 rounded-full" }),
|
|
23840
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
23841
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", size: "small", className: "text-ui-fg-subtle", children: "Current Balance" }),
|
|
23842
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
23843
|
+
ui.Text,
|
|
23844
|
+
{
|
|
23845
|
+
weight: "plus",
|
|
23846
|
+
size: "xlarge",
|
|
23847
|
+
className: "tabular-nums text-ui-fg-base",
|
|
23848
|
+
children: formatAmount(
|
|
23849
|
+
storeCreditAccount.balance,
|
|
23850
|
+
storeCreditAccount.currency_code
|
|
23851
|
+
)
|
|
23852
|
+
}
|
|
23853
|
+
)
|
|
23854
|
+
] })
|
|
23855
|
+
] }) });
|
|
23856
|
+
};
|
|
23857
|
+
var toggleSelection;
|
|
23858
|
+
var hasRequiredToggleSelection;
|
|
23859
|
+
function requireToggleSelection() {
|
|
23860
|
+
if (hasRequiredToggleSelection) return toggleSelection;
|
|
23861
|
+
hasRequiredToggleSelection = 1;
|
|
23862
|
+
toggleSelection = function() {
|
|
23863
|
+
var selection = document.getSelection();
|
|
23864
|
+
if (!selection.rangeCount) {
|
|
23865
|
+
return function() {
|
|
23866
|
+
};
|
|
23867
|
+
}
|
|
23868
|
+
var active = document.activeElement;
|
|
23869
|
+
var ranges = [];
|
|
23870
|
+
for (var i2 = 0; i2 < selection.rangeCount; i2++) {
|
|
23871
|
+
ranges.push(selection.getRangeAt(i2));
|
|
23872
|
+
}
|
|
23873
|
+
switch (active.tagName.toUpperCase()) {
|
|
23874
|
+
// .toUpperCase handles XHTML
|
|
23875
|
+
case "INPUT":
|
|
23876
|
+
case "TEXTAREA":
|
|
23877
|
+
active.blur();
|
|
23878
|
+
break;
|
|
23879
|
+
default:
|
|
23880
|
+
active = null;
|
|
23881
|
+
break;
|
|
23882
|
+
}
|
|
23883
|
+
selection.removeAllRanges();
|
|
23884
|
+
return function() {
|
|
23885
|
+
selection.type === "Caret" && selection.removeAllRanges();
|
|
23886
|
+
if (!selection.rangeCount) {
|
|
23887
|
+
ranges.forEach(function(range) {
|
|
23888
|
+
selection.addRange(range);
|
|
23889
|
+
});
|
|
23890
|
+
}
|
|
23891
|
+
active && active.focus();
|
|
23892
|
+
};
|
|
23893
|
+
};
|
|
23894
|
+
return toggleSelection;
|
|
23895
|
+
}
|
|
23896
|
+
var copyToClipboard;
|
|
23897
|
+
var hasRequiredCopyToClipboard;
|
|
23898
|
+
function requireCopyToClipboard() {
|
|
23899
|
+
if (hasRequiredCopyToClipboard) return copyToClipboard;
|
|
23900
|
+
hasRequiredCopyToClipboard = 1;
|
|
23901
|
+
var deselectCurrent = requireToggleSelection();
|
|
23902
|
+
var clipboardToIE11Formatting = {
|
|
23903
|
+
"text/plain": "Text",
|
|
23904
|
+
"text/html": "Url",
|
|
23905
|
+
"default": "Text"
|
|
23906
|
+
};
|
|
23907
|
+
var defaultMessage = "Copy to clipboard: #{key}, Enter";
|
|
23908
|
+
function format2(message2) {
|
|
23909
|
+
var copyKey = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C";
|
|
23910
|
+
return message2.replace(/#{\s*key\s*}/g, copyKey);
|
|
23911
|
+
}
|
|
23912
|
+
function copy2(text2, options) {
|
|
23913
|
+
var debug2, message2, reselectPrevious, range, selection, mark, success = false;
|
|
23914
|
+
if (!options) {
|
|
23915
|
+
options = {};
|
|
23916
|
+
}
|
|
23917
|
+
debug2 = options.debug || false;
|
|
23918
|
+
try {
|
|
23919
|
+
reselectPrevious = deselectCurrent();
|
|
23920
|
+
range = document.createRange();
|
|
23921
|
+
selection = document.getSelection();
|
|
23922
|
+
mark = document.createElement("span");
|
|
23923
|
+
mark.textContent = text2;
|
|
23924
|
+
mark.ariaHidden = "true";
|
|
23925
|
+
mark.style.all = "unset";
|
|
23926
|
+
mark.style.position = "fixed";
|
|
23927
|
+
mark.style.top = 0;
|
|
23928
|
+
mark.style.clip = "rect(0, 0, 0, 0)";
|
|
23929
|
+
mark.style.whiteSpace = "pre";
|
|
23930
|
+
mark.style.webkitUserSelect = "text";
|
|
23931
|
+
mark.style.MozUserSelect = "text";
|
|
23932
|
+
mark.style.msUserSelect = "text";
|
|
23933
|
+
mark.style.userSelect = "text";
|
|
23934
|
+
mark.addEventListener("copy", function(e) {
|
|
23935
|
+
e.stopPropagation();
|
|
23936
|
+
if (options.format) {
|
|
23937
|
+
e.preventDefault();
|
|
23938
|
+
if (typeof e.clipboardData === "undefined") {
|
|
23939
|
+
debug2 && console.warn("unable to use e.clipboardData");
|
|
23940
|
+
debug2 && console.warn("trying IE specific stuff");
|
|
23941
|
+
window.clipboardData.clearData();
|
|
23942
|
+
var format3 = clipboardToIE11Formatting[options.format] || clipboardToIE11Formatting["default"];
|
|
23943
|
+
window.clipboardData.setData(format3, text2);
|
|
23944
|
+
} else {
|
|
23945
|
+
e.clipboardData.clearData();
|
|
23946
|
+
e.clipboardData.setData(options.format, text2);
|
|
23148
23947
|
}
|
|
23149
|
-
|
|
23150
|
-
|
|
23151
|
-
|
|
23948
|
+
}
|
|
23949
|
+
if (options.onCopy) {
|
|
23950
|
+
e.preventDefault();
|
|
23951
|
+
options.onCopy(e.clipboardData);
|
|
23952
|
+
}
|
|
23953
|
+
});
|
|
23954
|
+
document.body.appendChild(mark);
|
|
23955
|
+
range.selectNodeContents(mark);
|
|
23956
|
+
selection.addRange(range);
|
|
23957
|
+
var successful = document.execCommand("copy");
|
|
23958
|
+
if (!successful) {
|
|
23959
|
+
throw new Error("copy command was unsuccessful");
|
|
23960
|
+
}
|
|
23961
|
+
success = true;
|
|
23962
|
+
} catch (err) {
|
|
23963
|
+
debug2 && console.error("unable to copy using execCommand: ", err);
|
|
23964
|
+
debug2 && console.warn("trying IE specific stuff");
|
|
23965
|
+
try {
|
|
23966
|
+
window.clipboardData.setData(options.format || "text", text2);
|
|
23967
|
+
options.onCopy && options.onCopy(window.clipboardData);
|
|
23968
|
+
success = true;
|
|
23969
|
+
} catch (err2) {
|
|
23970
|
+
debug2 && console.error("unable to copy using clipboardData: ", err2);
|
|
23971
|
+
debug2 && console.error("falling back to prompt");
|
|
23972
|
+
message2 = format2("message" in options ? options.message : defaultMessage);
|
|
23973
|
+
window.prompt(message2, text2);
|
|
23974
|
+
}
|
|
23975
|
+
} finally {
|
|
23976
|
+
if (selection) {
|
|
23977
|
+
if (typeof selection.removeRange == "function") {
|
|
23978
|
+
selection.removeRange(range);
|
|
23979
|
+
} else {
|
|
23980
|
+
selection.removeAllRanges();
|
|
23981
|
+
}
|
|
23982
|
+
}
|
|
23983
|
+
if (mark) {
|
|
23984
|
+
document.body.removeChild(mark);
|
|
23985
|
+
}
|
|
23986
|
+
reselectPrevious();
|
|
23987
|
+
}
|
|
23988
|
+
return success;
|
|
23989
|
+
}
|
|
23990
|
+
copyToClipboard = copy2;
|
|
23991
|
+
return copyToClipboard;
|
|
23992
|
+
}
|
|
23993
|
+
var copyToClipboardExports = requireCopyToClipboard();
|
|
23994
|
+
const copy$1 = /* @__PURE__ */ getDefaultExportFromCjs(copyToClipboardExports);
|
|
23995
|
+
function DisplayId({ id, className }) {
|
|
23996
|
+
const [open, setOpen] = React.useState(false);
|
|
23997
|
+
const onClick = () => {
|
|
23998
|
+
copy$1(id);
|
|
23999
|
+
ui.toast.success("Copied to clipboard");
|
|
24000
|
+
};
|
|
24001
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { maxWidth: 260, content: id, open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { onClick, className: ui.clx("cursor-pointer", className), children: [
|
|
24002
|
+
"#",
|
|
24003
|
+
id.slice(-7)
|
|
24004
|
+
] }) });
|
|
24005
|
+
}
|
|
24006
|
+
const StoreCreditAccountDetailsSection = ({
|
|
24007
|
+
storeCreditAccount
|
|
24008
|
+
}) => {
|
|
24009
|
+
if (!storeCreditAccount || typeof storeCreditAccount.balance === "undefined") {
|
|
24010
|
+
return;
|
|
24011
|
+
}
|
|
24012
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "flex justify-between gap-x-2 px-6 py-6", children: [
|
|
24013
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
24014
|
+
ui.Text,
|
|
24015
|
+
{
|
|
24016
|
+
weight: "plus",
|
|
24017
|
+
size: "xlarge",
|
|
24018
|
+
className: "text-ui-fg-base flex gap-x-4",
|
|
24019
|
+
children: [
|
|
24020
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
24021
|
+
/* @__PURE__ */ jsxRuntime.jsx(CreditCardIcon, { className: "inline" }),
|
|
24022
|
+
" "
|
|
24023
|
+
] }),
|
|
24024
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
24025
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-ui-fg-subtle", children: [
|
|
24026
|
+
storeCreditAccount.currency_code.toUpperCase(),
|
|
24027
|
+
" Account"
|
|
24028
|
+
] }),
|
|
24029
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-base", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
24030
|
+
ui.Text,
|
|
24031
|
+
{
|
|
24032
|
+
weight: "regular",
|
|
24033
|
+
size: "small",
|
|
24034
|
+
className: "text-ui-fg-base flex gap-x-4",
|
|
24035
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(DisplayId, { id: storeCreditAccount.id })
|
|
24036
|
+
}
|
|
24037
|
+
) })
|
|
24038
|
+
] })
|
|
24039
|
+
]
|
|
24040
|
+
}
|
|
24041
|
+
),
|
|
24042
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-x-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
24043
|
+
ActionMenu,
|
|
24044
|
+
{
|
|
24045
|
+
groups: [
|
|
23152
24046
|
{
|
|
23153
|
-
|
|
23154
|
-
|
|
23155
|
-
|
|
23156
|
-
|
|
23157
|
-
|
|
23158
|
-
|
|
23159
|
-
children: [
|
|
23160
|
-
/* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "white" }),
|
|
23161
|
-
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })
|
|
24047
|
+
actions: [
|
|
24048
|
+
{
|
|
24049
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CreditCard, {}),
|
|
24050
|
+
label: "Credit the account",
|
|
24051
|
+
to: "credit"
|
|
24052
|
+
}
|
|
23162
24053
|
]
|
|
23163
24054
|
}
|
|
23164
|
-
|
|
23165
|
-
|
|
23166
|
-
}
|
|
23167
|
-
);
|
|
24055
|
+
]
|
|
24056
|
+
}
|
|
24057
|
+
) })
|
|
24058
|
+
] });
|
|
23168
24059
|
};
|
|
23169
|
-
|
|
23170
|
-
|
|
24060
|
+
function StoreCreditAccountCustomerSection({
|
|
24061
|
+
customerId
|
|
24062
|
+
}) {
|
|
24063
|
+
const { customer, isPending } = useCustomer(customerId, void 0, {
|
|
24064
|
+
enabled: !!customerId
|
|
24065
|
+
});
|
|
24066
|
+
if (isPending || !customer) {
|
|
24067
|
+
return null;
|
|
24068
|
+
}
|
|
24069
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0", children: [
|
|
24070
|
+
/* @__PURE__ */ jsxRuntime.jsx(Header$5, { title: "Customer" }),
|
|
24071
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24072
|
+
SidebarLink,
|
|
24073
|
+
{
|
|
24074
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.User, {}),
|
|
24075
|
+
labelKey: customer.email || "N/A",
|
|
24076
|
+
descriptionKey: !customer.first_name && !customer.last_name ? "N/A" : `${customer.first_name} ${customer.last_name}`,
|
|
24077
|
+
to: `/customers/${customer.id}`
|
|
24078
|
+
},
|
|
24079
|
+
customer.id
|
|
24080
|
+
)
|
|
24081
|
+
] });
|
|
24082
|
+
}
|
|
24083
|
+
const columnHelper$8 = ui.createDataTableColumnHelper();
|
|
24084
|
+
const useTransactionsTableColumns = () => {
|
|
23171
24085
|
return React.useMemo(() => {
|
|
23172
24086
|
return [
|
|
23173
|
-
columnHelper$
|
|
23174
|
-
header: "
|
|
24087
|
+
columnHelper$8.accessor("id", {
|
|
24088
|
+
header: "ID",
|
|
23175
24089
|
cell: ({ row }) => {
|
|
23176
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
24090
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DisplayId, { id: row.original.id });
|
|
23177
24091
|
}
|
|
23178
24092
|
}),
|
|
23179
|
-
columnHelper$
|
|
23180
|
-
header: "
|
|
23181
|
-
cell: ({ row }) =>
|
|
23182
|
-
return row.original.customer?.email ?? "N/A";
|
|
23183
|
-
}
|
|
24093
|
+
columnHelper$8.accessor("created_at", {
|
|
24094
|
+
header: "Created At",
|
|
24095
|
+
cell: ({ row }) => formatDate(row.original.created_at, false)
|
|
23184
24096
|
}),
|
|
23185
|
-
columnHelper$
|
|
23186
|
-
header: "
|
|
23187
|
-
cell: ({ row }) =>
|
|
23188
|
-
return formatAmount(
|
|
23189
|
-
row.original.balance,
|
|
23190
|
-
row.original.currency_code
|
|
23191
|
-
);
|
|
23192
|
-
}
|
|
24097
|
+
columnHelper$8.accessor("note", {
|
|
24098
|
+
header: "Description",
|
|
24099
|
+
cell: ({ row }) => row.original.note
|
|
23193
24100
|
}),
|
|
23194
|
-
columnHelper$
|
|
23195
|
-
header: "
|
|
24101
|
+
columnHelper$8.accessor("note", {
|
|
24102
|
+
header: "Note",
|
|
23196
24103
|
cell: ({ row }) => {
|
|
23197
|
-
return
|
|
23198
|
-
row.original.credits,
|
|
23199
|
-
row.original.currency_code
|
|
23200
|
-
);
|
|
24104
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { title: row.original.note, className: "max-w-[300px] truncate", children: row.original.note || "-" });
|
|
23201
24105
|
}
|
|
23202
24106
|
}),
|
|
23203
|
-
columnHelper$
|
|
23204
|
-
header: "
|
|
24107
|
+
columnHelper$8.accessor("amount", {
|
|
24108
|
+
header: "Amount",
|
|
23205
24109
|
cell: ({ row }) => {
|
|
23206
|
-
|
|
23207
|
-
|
|
23208
|
-
row.original.
|
|
24110
|
+
const isDebit = row.original.type === "debit";
|
|
24111
|
+
return row.original.account.currency_code && formatAmount(
|
|
24112
|
+
row.original.amount * (isDebit ? -1 : 1),
|
|
24113
|
+
row.original.account.currency_code
|
|
23209
24114
|
);
|
|
23210
24115
|
}
|
|
23211
|
-
}),
|
|
23212
|
-
columnHelper$9.accessor("created_at", {
|
|
23213
|
-
header: "Created at",
|
|
23214
|
-
cell: ({ row }) => getRelativeDate(row.original.created_at)
|
|
23215
24116
|
})
|
|
23216
24117
|
];
|
|
23217
24118
|
}, []);
|
|
23218
24119
|
};
|
|
23219
|
-
const
|
|
24120
|
+
const useTransactionsTableFilters = ({}) => {
|
|
23220
24121
|
const dateFilterOptions = useDataTableDateFilters$1();
|
|
23221
|
-
const customerFilterOptions = useCustomerFilters();
|
|
23222
24122
|
return React.useMemo(() => {
|
|
23223
|
-
return [...dateFilterOptions
|
|
23224
|
-
}, [dateFilterOptions
|
|
24123
|
+
return [...dateFilterOptions];
|
|
24124
|
+
}, [dateFilterOptions]);
|
|
23225
24125
|
};
|
|
23226
|
-
const
|
|
24126
|
+
const useTransactionsTableQuery = ({
|
|
23227
24127
|
prefix,
|
|
23228
24128
|
pageSize = 20
|
|
23229
24129
|
}) => {
|
|
23230
24130
|
const queryObject = useQueryParams(
|
|
23231
|
-
["offset", "
|
|
24131
|
+
["offset", "limit", "currency_code", "created_at", "updated_at"],
|
|
23232
24132
|
prefix
|
|
23233
24133
|
);
|
|
23234
|
-
const {
|
|
23235
|
-
offset: offset2,
|
|
23236
|
-
created_at,
|
|
23237
|
-
updated_at,
|
|
23238
|
-
customer_id,
|
|
23239
|
-
currency_code,
|
|
23240
|
-
...rest
|
|
23241
|
-
} = queryObject;
|
|
24134
|
+
const { offset: offset2, limit, created_at, updated_at, ...rest } = queryObject;
|
|
23242
24135
|
const searchParams = {
|
|
23243
|
-
limit: pageSize,
|
|
24136
|
+
limit: limit ? Number(limit) : pageSize,
|
|
23244
24137
|
offset: offset2 ? Number(offset2) : 0,
|
|
23245
24138
|
created_at: created_at ? JSON.parse(created_at) : void 0,
|
|
23246
24139
|
updated_at: updated_at ? JSON.parse(updated_at) : void 0,
|
|
23247
|
-
customer_id: customer_id ? JSON.parse(customer_id) : void 0,
|
|
23248
|
-
currency_code: currency_code ? JSON.parse(currency_code) : void 0,
|
|
23249
24140
|
...rest
|
|
23250
24141
|
};
|
|
23251
24142
|
return searchParams;
|
|
23252
24143
|
};
|
|
23253
|
-
const PAGE_SIZE$
|
|
23254
|
-
function
|
|
23255
|
-
const queryParams =
|
|
23256
|
-
pageSize: PAGE_SIZE$
|
|
23257
|
-
});
|
|
23258
|
-
const {
|
|
23259
|
-
store_credit_accounts: storeCreditAccounts,
|
|
23260
|
-
isPending,
|
|
23261
|
-
count: count2
|
|
23262
|
-
} = useStoreCreditAccounts({
|
|
23263
|
-
...queryParams,
|
|
23264
|
-
order: queryParams.order ?? "-created_at"
|
|
24144
|
+
const PAGE_SIZE$4 = 10;
|
|
24145
|
+
function TransactionsTable({ id }) {
|
|
24146
|
+
const queryParams = useTransactionsTableQuery({
|
|
24147
|
+
pageSize: PAGE_SIZE$4
|
|
23265
24148
|
});
|
|
23266
|
-
const
|
|
23267
|
-
|
|
24149
|
+
const { transactions, isLoading, count: count2 } = useStoreCreditAccountTransactions(
|
|
24150
|
+
id,
|
|
24151
|
+
{
|
|
24152
|
+
...queryParams,
|
|
24153
|
+
order: queryParams.order ?? "-created_at",
|
|
24154
|
+
fields: "*account"
|
|
24155
|
+
}
|
|
24156
|
+
);
|
|
24157
|
+
const columns = useTransactionsTableColumns();
|
|
24158
|
+
const filters = useTransactionsTableFilters({});
|
|
23268
24159
|
return /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
23269
24160
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
23270
24161
|
DataTable,
|
|
23271
24162
|
{
|
|
23272
|
-
data:
|
|
24163
|
+
data: transactions ?? [],
|
|
23273
24164
|
getRowId: (row) => row.id,
|
|
23274
24165
|
columns,
|
|
23275
24166
|
filters,
|
|
23276
|
-
isLoading
|
|
23277
|
-
pageSize: PAGE_SIZE$
|
|
24167
|
+
isLoading,
|
|
24168
|
+
pageSize: PAGE_SIZE$4,
|
|
23278
24169
|
rowCount: count2,
|
|
23279
24170
|
enableSearch: false,
|
|
23280
|
-
heading: "
|
|
23281
|
-
rowHref: (row) => `${row.id}`,
|
|
24171
|
+
heading: "Transactions",
|
|
23282
24172
|
emptyState: {
|
|
23283
24173
|
empty: {
|
|
23284
|
-
heading: "No
|
|
23285
|
-
description: "Create a new store credit account to get started."
|
|
24174
|
+
heading: "No transactions found"
|
|
23286
24175
|
},
|
|
23287
24176
|
filtered: {
|
|
23288
24177
|
heading: "No results found",
|
|
23289
|
-
description: "No
|
|
23290
|
-
}
|
|
23291
|
-
},
|
|
23292
|
-
actions: [
|
|
23293
|
-
{
|
|
23294
|
-
label: "Create",
|
|
23295
|
-
to: "/store-credit-accounts/create"
|
|
24178
|
+
description: "No transactions match your filter criteria."
|
|
23296
24179
|
}
|
|
23297
|
-
|
|
24180
|
+
}
|
|
23298
24181
|
}
|
|
23299
24182
|
) }),
|
|
23300
24183
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
23301
24184
|
] });
|
|
23302
24185
|
}
|
|
23303
|
-
|
|
23304
|
-
|
|
23305
|
-
|
|
23306
|
-
components.LayoutComposer,
|
|
23307
|
-
{
|
|
23308
|
-
widgetsZonePrefix: "store_credit_account.list",
|
|
23309
|
-
preferredLayoutId: "core:single-column",
|
|
23310
|
-
sections: {
|
|
23311
|
-
main: /* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountsTable", children: /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountsTable, {}) })
|
|
23312
|
-
}
|
|
23313
|
-
}
|
|
23314
|
-
),
|
|
23315
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Toaster, {})
|
|
23316
|
-
] });
|
|
23317
|
-
};
|
|
23318
|
-
const config$1 = adminSdk.defineRouteConfig({
|
|
23319
|
-
label: "Store Credits",
|
|
23320
|
-
icon: StoreCreditIcon
|
|
23321
|
-
});
|
|
23322
|
-
var isObject_1;
|
|
23323
|
-
var hasRequiredIsObject;
|
|
23324
|
-
function requireIsObject() {
|
|
23325
|
-
if (hasRequiredIsObject) return isObject_1;
|
|
23326
|
-
hasRequiredIsObject = 1;
|
|
23327
|
-
function isObject2(value) {
|
|
23328
|
-
var type = typeof value;
|
|
23329
|
-
return value != null && (type == "object" || type == "function");
|
|
24186
|
+
function StoreCreditAccountCodeSection({ code }) {
|
|
24187
|
+
if (!code) {
|
|
24188
|
+
return null;
|
|
23330
24189
|
}
|
|
23331
|
-
|
|
23332
|
-
|
|
23333
|
-
|
|
23334
|
-
|
|
23335
|
-
|
|
23336
|
-
|
|
23337
|
-
|
|
23338
|
-
hasRequired_freeGlobal = 1;
|
|
23339
|
-
var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
23340
|
-
_freeGlobal = freeGlobal;
|
|
23341
|
-
return _freeGlobal;
|
|
23342
|
-
}
|
|
23343
|
-
var _root;
|
|
23344
|
-
var hasRequired_root;
|
|
23345
|
-
function require_root() {
|
|
23346
|
-
if (hasRequired_root) return _root;
|
|
23347
|
-
hasRequired_root = 1;
|
|
23348
|
-
var freeGlobal = require_freeGlobal();
|
|
23349
|
-
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
23350
|
-
var root = freeGlobal || freeSelf || Function("return this")();
|
|
23351
|
-
_root = root;
|
|
23352
|
-
return _root;
|
|
23353
|
-
}
|
|
23354
|
-
var now_1;
|
|
23355
|
-
var hasRequiredNow;
|
|
23356
|
-
function requireNow() {
|
|
23357
|
-
if (hasRequiredNow) return now_1;
|
|
23358
|
-
hasRequiredNow = 1;
|
|
23359
|
-
var root = require_root();
|
|
23360
|
-
var now = function() {
|
|
23361
|
-
return root.Date.now();
|
|
23362
|
-
};
|
|
23363
|
-
now_1 = now;
|
|
23364
|
-
return now_1;
|
|
24190
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0", children: [
|
|
24191
|
+
/* @__PURE__ */ jsxRuntime.jsx(Header$5, { title: "Account Code" }),
|
|
24192
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-4 px-6 mb-2", children: [
|
|
24193
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.Share, { className: "inline" }),
|
|
24194
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle text-sm", children: code })
|
|
24195
|
+
] })
|
|
24196
|
+
] });
|
|
23365
24197
|
}
|
|
23366
|
-
|
|
23367
|
-
|
|
23368
|
-
|
|
23369
|
-
|
|
23370
|
-
|
|
23371
|
-
|
|
23372
|
-
|
|
23373
|
-
var index = string2.length;
|
|
23374
|
-
while (index-- && reWhitespace.test(string2.charAt(index))) {
|
|
23375
|
-
}
|
|
23376
|
-
return index;
|
|
24198
|
+
const StoreCreditAccountPage = () => {
|
|
24199
|
+
const { id } = reactRouterDom.useParams();
|
|
24200
|
+
const { store_credit_account: storeCreditAccount } = useStoreCreditAccount(
|
|
24201
|
+
id
|
|
24202
|
+
);
|
|
24203
|
+
if (!storeCreditAccount) {
|
|
24204
|
+
return;
|
|
23377
24205
|
}
|
|
23378
|
-
|
|
23379
|
-
|
|
23380
|
-
|
|
23381
|
-
|
|
23382
|
-
|
|
23383
|
-
|
|
23384
|
-
|
|
23385
|
-
|
|
23386
|
-
|
|
23387
|
-
|
|
23388
|
-
|
|
23389
|
-
|
|
23390
|
-
|
|
23391
|
-
|
|
23392
|
-
|
|
23393
|
-
}
|
|
23394
|
-
|
|
23395
|
-
|
|
23396
|
-
|
|
23397
|
-
|
|
23398
|
-
|
|
23399
|
-
|
|
23400
|
-
|
|
23401
|
-
|
|
23402
|
-
|
|
23403
|
-
|
|
23404
|
-
|
|
23405
|
-
|
|
23406
|
-
|
|
23407
|
-
|
|
23408
|
-
|
|
23409
|
-
var Symbol2 = require_Symbol();
|
|
23410
|
-
var objectProto = Object.prototype;
|
|
23411
|
-
var hasOwnProperty2 = objectProto.hasOwnProperty;
|
|
23412
|
-
var nativeObjectToString = objectProto.toString;
|
|
23413
|
-
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
|
|
23414
|
-
function getRawTag(value) {
|
|
23415
|
-
var isOwn = hasOwnProperty2.call(value, symToStringTag), tag = value[symToStringTag];
|
|
23416
|
-
try {
|
|
23417
|
-
value[symToStringTag] = void 0;
|
|
23418
|
-
var unmasked = true;
|
|
23419
|
-
} catch (e) {
|
|
23420
|
-
}
|
|
23421
|
-
var result = nativeObjectToString.call(value);
|
|
23422
|
-
if (unmasked) {
|
|
23423
|
-
if (isOwn) {
|
|
23424
|
-
value[symToStringTag] = tag;
|
|
23425
|
-
} else {
|
|
23426
|
-
delete value[symToStringTag];
|
|
23427
|
-
}
|
|
23428
|
-
}
|
|
23429
|
-
return result;
|
|
23430
|
-
}
|
|
23431
|
-
_getRawTag = getRawTag;
|
|
23432
|
-
return _getRawTag;
|
|
23433
|
-
}
|
|
23434
|
-
var _objectToString;
|
|
23435
|
-
var hasRequired_objectToString;
|
|
23436
|
-
function require_objectToString() {
|
|
23437
|
-
if (hasRequired_objectToString) return _objectToString;
|
|
23438
|
-
hasRequired_objectToString = 1;
|
|
23439
|
-
var objectProto = Object.prototype;
|
|
23440
|
-
var nativeObjectToString = objectProto.toString;
|
|
23441
|
-
function objectToString(value) {
|
|
23442
|
-
return nativeObjectToString.call(value);
|
|
23443
|
-
}
|
|
23444
|
-
_objectToString = objectToString;
|
|
23445
|
-
return _objectToString;
|
|
23446
|
-
}
|
|
23447
|
-
var _baseGetTag;
|
|
23448
|
-
var hasRequired_baseGetTag;
|
|
23449
|
-
function require_baseGetTag() {
|
|
23450
|
-
if (hasRequired_baseGetTag) return _baseGetTag;
|
|
23451
|
-
hasRequired_baseGetTag = 1;
|
|
23452
|
-
var Symbol2 = require_Symbol(), getRawTag = require_getRawTag(), objectToString = require_objectToString();
|
|
23453
|
-
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
|
|
23454
|
-
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
|
|
23455
|
-
function baseGetTag(value) {
|
|
23456
|
-
if (value == null) {
|
|
23457
|
-
return value === void 0 ? undefinedTag : nullTag;
|
|
23458
|
-
}
|
|
23459
|
-
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
23460
|
-
}
|
|
23461
|
-
_baseGetTag = baseGetTag;
|
|
23462
|
-
return _baseGetTag;
|
|
23463
|
-
}
|
|
23464
|
-
var isObjectLike_1;
|
|
23465
|
-
var hasRequiredIsObjectLike;
|
|
23466
|
-
function requireIsObjectLike() {
|
|
23467
|
-
if (hasRequiredIsObjectLike) return isObjectLike_1;
|
|
23468
|
-
hasRequiredIsObjectLike = 1;
|
|
23469
|
-
function isObjectLike(value) {
|
|
23470
|
-
return value != null && typeof value == "object";
|
|
23471
|
-
}
|
|
23472
|
-
isObjectLike_1 = isObjectLike;
|
|
23473
|
-
return isObjectLike_1;
|
|
23474
|
-
}
|
|
23475
|
-
var isSymbol_1;
|
|
23476
|
-
var hasRequiredIsSymbol;
|
|
23477
|
-
function requireIsSymbol() {
|
|
23478
|
-
if (hasRequiredIsSymbol) return isSymbol_1;
|
|
23479
|
-
hasRequiredIsSymbol = 1;
|
|
23480
|
-
var baseGetTag = require_baseGetTag(), isObjectLike = requireIsObjectLike();
|
|
23481
|
-
var symbolTag = "[object Symbol]";
|
|
23482
|
-
function isSymbol(value) {
|
|
23483
|
-
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
23484
|
-
}
|
|
23485
|
-
isSymbol_1 = isSymbol;
|
|
23486
|
-
return isSymbol_1;
|
|
23487
|
-
}
|
|
23488
|
-
var toNumber_1;
|
|
23489
|
-
var hasRequiredToNumber;
|
|
23490
|
-
function requireToNumber() {
|
|
23491
|
-
if (hasRequiredToNumber) return toNumber_1;
|
|
23492
|
-
hasRequiredToNumber = 1;
|
|
23493
|
-
var baseTrim = require_baseTrim(), isObject2 = requireIsObject(), isSymbol = requireIsSymbol();
|
|
23494
|
-
var NAN = 0 / 0;
|
|
23495
|
-
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
23496
|
-
var reIsBinary = /^0b[01]+$/i;
|
|
23497
|
-
var reIsOctal = /^0o[0-7]+$/i;
|
|
23498
|
-
var freeParseInt = parseInt;
|
|
23499
|
-
function toNumber(value) {
|
|
23500
|
-
if (typeof value == "number") {
|
|
23501
|
-
return value;
|
|
23502
|
-
}
|
|
23503
|
-
if (isSymbol(value)) {
|
|
23504
|
-
return NAN;
|
|
23505
|
-
}
|
|
23506
|
-
if (isObject2(value)) {
|
|
23507
|
-
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
23508
|
-
value = isObject2(other) ? other + "" : other;
|
|
23509
|
-
}
|
|
23510
|
-
if (typeof value != "string") {
|
|
23511
|
-
return value === 0 ? value : +value;
|
|
23512
|
-
}
|
|
23513
|
-
value = baseTrim(value);
|
|
23514
|
-
var isBinary = reIsBinary.test(value);
|
|
23515
|
-
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
23516
|
-
}
|
|
23517
|
-
toNumber_1 = toNumber;
|
|
23518
|
-
return toNumber_1;
|
|
23519
|
-
}
|
|
23520
|
-
var debounce_1;
|
|
23521
|
-
var hasRequiredDebounce;
|
|
23522
|
-
function requireDebounce() {
|
|
23523
|
-
if (hasRequiredDebounce) return debounce_1;
|
|
23524
|
-
hasRequiredDebounce = 1;
|
|
23525
|
-
var isObject2 = requireIsObject(), now = requireNow(), toNumber = requireToNumber();
|
|
23526
|
-
var FUNC_ERROR_TEXT = "Expected a function";
|
|
23527
|
-
var nativeMax = Math.max, nativeMin = Math.min;
|
|
23528
|
-
function debounce2(func, wait, options) {
|
|
23529
|
-
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
23530
|
-
if (typeof func != "function") {
|
|
23531
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
23532
|
-
}
|
|
23533
|
-
wait = toNumber(wait) || 0;
|
|
23534
|
-
if (isObject2(options)) {
|
|
23535
|
-
leading = !!options.leading;
|
|
23536
|
-
maxing = "maxWait" in options;
|
|
23537
|
-
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
23538
|
-
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
23539
|
-
}
|
|
23540
|
-
function invokeFunc(time2) {
|
|
23541
|
-
var args = lastArgs, thisArg = lastThis;
|
|
23542
|
-
lastArgs = lastThis = void 0;
|
|
23543
|
-
lastInvokeTime = time2;
|
|
23544
|
-
result = func.apply(thisArg, args);
|
|
23545
|
-
return result;
|
|
23546
|
-
}
|
|
23547
|
-
function leadingEdge(time2) {
|
|
23548
|
-
lastInvokeTime = time2;
|
|
23549
|
-
timerId = setTimeout(timerExpired, wait);
|
|
23550
|
-
return leading ? invokeFunc(time2) : result;
|
|
23551
|
-
}
|
|
23552
|
-
function remainingWait(time2) {
|
|
23553
|
-
var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
|
|
23554
|
-
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
|
|
23555
|
-
}
|
|
23556
|
-
function shouldInvoke(time2) {
|
|
23557
|
-
var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime;
|
|
23558
|
-
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
|
|
23559
|
-
}
|
|
23560
|
-
function timerExpired() {
|
|
23561
|
-
var time2 = now();
|
|
23562
|
-
if (shouldInvoke(time2)) {
|
|
23563
|
-
return trailingEdge(time2);
|
|
24206
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
24207
|
+
components.LayoutComposer,
|
|
24208
|
+
{
|
|
24209
|
+
widgetsZonePrefix: "store_credit_account.details",
|
|
24210
|
+
preferredLayoutId: "core:two-column",
|
|
24211
|
+
data: storeCreditAccount,
|
|
24212
|
+
sections: {
|
|
24213
|
+
main: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
24214
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountDetailsSection", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
24215
|
+
StoreCreditAccountDetailsSection,
|
|
24216
|
+
{
|
|
24217
|
+
storeCreditAccount
|
|
24218
|
+
}
|
|
24219
|
+
) }),
|
|
24220
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "TransactionsTable", children: /* @__PURE__ */ jsxRuntime.jsx(TransactionsTable, { id: storeCreditAccount.id }) })
|
|
24221
|
+
] }),
|
|
24222
|
+
side: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
24223
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountBalanceSection", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
24224
|
+
StoreCreditAccountBalanceSection,
|
|
24225
|
+
{
|
|
24226
|
+
storeCreditAccount
|
|
24227
|
+
}
|
|
24228
|
+
) }),
|
|
24229
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountCodeSection", children: /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountCodeSection, { code: storeCreditAccount.code }) }),
|
|
24230
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountCustomerSection", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
24231
|
+
StoreCreditAccountCustomerSection,
|
|
24232
|
+
{
|
|
24233
|
+
customerId: storeCreditAccount.customer_id
|
|
24234
|
+
}
|
|
24235
|
+
) })
|
|
24236
|
+
] })
|
|
23564
24237
|
}
|
|
23565
|
-
timerId = setTimeout(timerExpired, remainingWait(time2));
|
|
23566
24238
|
}
|
|
23567
|
-
|
|
23568
|
-
|
|
23569
|
-
|
|
23570
|
-
|
|
24239
|
+
);
|
|
24240
|
+
};
|
|
24241
|
+
const KeyboundForm = React__namespace.default.forwardRef(({ onSubmit, onKeyDown, ...rest }, ref) => {
|
|
24242
|
+
const handleSubmit = (event) => {
|
|
24243
|
+
event.preventDefault();
|
|
24244
|
+
onSubmit?.(event);
|
|
24245
|
+
};
|
|
24246
|
+
const handleKeyDown = (event) => {
|
|
24247
|
+
if (event.key === "Enter") {
|
|
24248
|
+
if (event.target instanceof HTMLTextAreaElement && !(event.metaKey || event.ctrlKey)) {
|
|
24249
|
+
return;
|
|
23571
24250
|
}
|
|
23572
|
-
|
|
23573
|
-
|
|
23574
|
-
|
|
23575
|
-
function cancel() {
|
|
23576
|
-
if (timerId !== void 0) {
|
|
23577
|
-
clearTimeout(timerId);
|
|
24251
|
+
event.preventDefault();
|
|
24252
|
+
if (event.metaKey || event.ctrlKey) {
|
|
24253
|
+
handleSubmit(event);
|
|
23578
24254
|
}
|
|
23579
|
-
lastInvokeTime = 0;
|
|
23580
|
-
lastArgs = lastCallTime = lastThis = timerId = void 0;
|
|
23581
24255
|
}
|
|
23582
|
-
|
|
23583
|
-
|
|
23584
|
-
|
|
23585
|
-
|
|
23586
|
-
|
|
23587
|
-
|
|
23588
|
-
|
|
23589
|
-
|
|
23590
|
-
if (isInvoking) {
|
|
23591
|
-
if (timerId === void 0) {
|
|
23592
|
-
return leadingEdge(lastCallTime);
|
|
23593
|
-
}
|
|
23594
|
-
if (maxing) {
|
|
23595
|
-
clearTimeout(timerId);
|
|
23596
|
-
timerId = setTimeout(timerExpired, wait);
|
|
23597
|
-
return invokeFunc(lastCallTime);
|
|
23598
|
-
}
|
|
23599
|
-
}
|
|
23600
|
-
if (timerId === void 0) {
|
|
23601
|
-
timerId = setTimeout(timerExpired, wait);
|
|
23602
|
-
}
|
|
23603
|
-
return result;
|
|
24256
|
+
};
|
|
24257
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
24258
|
+
"form",
|
|
24259
|
+
{
|
|
24260
|
+
...rest,
|
|
24261
|
+
onSubmit: handleSubmit,
|
|
24262
|
+
onKeyDown: onKeyDown ?? handleKeyDown,
|
|
24263
|
+
ref
|
|
23604
24264
|
}
|
|
23605
|
-
debounced.cancel = cancel;
|
|
23606
|
-
debounced.flush = flush;
|
|
23607
|
-
return debounced;
|
|
23608
|
-
}
|
|
23609
|
-
debounce_1 = debounce2;
|
|
23610
|
-
return debounce_1;
|
|
23611
|
-
}
|
|
23612
|
-
var debounceExports = requireDebounce();
|
|
23613
|
-
const debounce$1 = /* @__PURE__ */ getDefaultExportFromCjs(debounceExports);
|
|
23614
|
-
const useDebouncedSearch = () => {
|
|
23615
|
-
const [searchValue, onSearchValueChange] = React.useState("");
|
|
23616
|
-
const [debouncedQuery, setDebouncedQuery] = React.useState("");
|
|
23617
|
-
const debouncedUpdate = React.useCallback(
|
|
23618
|
-
debounce$1((query) => setDebouncedQuery(query), 300),
|
|
23619
|
-
[]
|
|
23620
24265
|
);
|
|
23621
|
-
|
|
23622
|
-
|
|
23623
|
-
|
|
23624
|
-
}
|
|
23625
|
-
|
|
23626
|
-
|
|
23627
|
-
|
|
23628
|
-
|
|
23629
|
-
|
|
23630
|
-
};
|
|
23631
|
-
|
|
23632
|
-
|
|
23633
|
-
queryFn,
|
|
23634
|
-
getOptions,
|
|
23635
|
-
defaultValue: defaultValue2,
|
|
23636
|
-
defaultValueKey,
|
|
23637
|
-
pageSize = 10
|
|
23638
|
-
}) => {
|
|
23639
|
-
const { searchValue, onSearchValueChange, query } = useDebouncedSearch();
|
|
23640
|
-
const queryInitialDataBy = defaultValueKey || "id";
|
|
23641
|
-
const { data: initialData } = reactQuery.useQuery({
|
|
23642
|
-
queryKey,
|
|
23643
|
-
queryFn: async () => {
|
|
23644
|
-
return queryFn({
|
|
23645
|
-
[queryInitialDataBy]: defaultValue2,
|
|
23646
|
-
limit: Array.isArray(defaultValue2) ? defaultValue2.length : 1
|
|
23647
|
-
});
|
|
23648
|
-
},
|
|
23649
|
-
enabled: !!defaultValue2
|
|
23650
|
-
});
|
|
23651
|
-
const { data, ...rest } = reactQuery.useInfiniteQuery({
|
|
23652
|
-
queryKey: [...queryKey, query],
|
|
23653
|
-
queryFn: async ({ pageParam = 0 }) => {
|
|
23654
|
-
return await queryFn({
|
|
23655
|
-
q: query,
|
|
23656
|
-
limit: pageSize,
|
|
23657
|
-
offset: pageParam
|
|
23658
|
-
});
|
|
23659
|
-
},
|
|
23660
|
-
initialPageParam: 0,
|
|
23661
|
-
getNextPageParam: (lastPage) => {
|
|
23662
|
-
const moreItemsExist = lastPage.count > lastPage.offset + lastPage.limit;
|
|
23663
|
-
return moreItemsExist ? lastPage.offset + lastPage.limit : void 0;
|
|
23664
|
-
},
|
|
23665
|
-
placeholderData: reactQuery.keepPreviousData
|
|
23666
|
-
});
|
|
23667
|
-
const options = data?.pages.flatMap((page) => getOptions(page)) ?? [];
|
|
23668
|
-
const defaultOptions2 = initialData ? getOptions(initialData) : [];
|
|
23669
|
-
const disabled = !rest.isPending && !options.length && !searchValue;
|
|
23670
|
-
if (defaultValue2 && defaultOptions2.length && !searchValue) {
|
|
23671
|
-
defaultOptions2.forEach((option) => {
|
|
23672
|
-
if (!options.find((o2) => o2.value === option.value)) {
|
|
23673
|
-
options.unshift(option);
|
|
23674
|
-
}
|
|
23675
|
-
});
|
|
24266
|
+
});
|
|
24267
|
+
KeyboundForm.displayName = "KeyboundForm";
|
|
24268
|
+
const Note$1 = () => {
|
|
24269
|
+
const { id } = reactRouterDom.useParams();
|
|
24270
|
+
const {
|
|
24271
|
+
store_credit_account: storeCreditAccount,
|
|
24272
|
+
isPending,
|
|
24273
|
+
isError,
|
|
24274
|
+
error
|
|
24275
|
+
} = useStoreCreditAccount(id, {});
|
|
24276
|
+
if (isError) {
|
|
24277
|
+
throw error;
|
|
23676
24278
|
}
|
|
23677
|
-
|
|
23678
|
-
|
|
23679
|
-
|
|
23680
|
-
|
|
23681
|
-
|
|
23682
|
-
|
|
23683
|
-
|
|
24279
|
+
const isReady = !isPending && !!storeCreditAccount;
|
|
24280
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
24281
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
24282
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Credit store credit account" }) }),
|
|
24283
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Credit the store credit account" }) })
|
|
24284
|
+
] }),
|
|
24285
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountCreditForm, { storeCreditAccount })
|
|
24286
|
+
] });
|
|
23684
24287
|
};
|
|
23685
|
-
const
|
|
23686
|
-
|
|
23687
|
-
|
|
23688
|
-
});
|
|
23689
|
-
const StoreCreditAccountCreateForm = () => {
|
|
23690
|
-
const { handleSuccess } = useRouteModal();
|
|
24288
|
+
const StoreCreditAccountCreditForm = ({
|
|
24289
|
+
storeCreditAccount
|
|
24290
|
+
}) => {
|
|
23691
24291
|
const form = useForm({
|
|
23692
24292
|
defaultValues: {
|
|
23693
|
-
|
|
23694
|
-
|
|
24293
|
+
amount: {
|
|
24294
|
+
float: 0,
|
|
24295
|
+
value: ""
|
|
24296
|
+
},
|
|
24297
|
+
note: ""
|
|
23695
24298
|
},
|
|
23696
|
-
resolver: u(
|
|
24299
|
+
resolver: u(schema$2)
|
|
23697
24300
|
});
|
|
23698
|
-
const { mutateAsync
|
|
23699
|
-
|
|
23700
|
-
|
|
23701
|
-
|
|
24301
|
+
const { mutateAsync, isPending } = useCreditStoreCreditAccount(
|
|
24302
|
+
storeCreditAccount.id
|
|
24303
|
+
);
|
|
24304
|
+
const { handleSuccess } = useRouteModal();
|
|
24305
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
24306
|
+
if (data.amount.float <= 0) {
|
|
24307
|
+
form.setError("amount", { message: "Amount must be greater than 0" });
|
|
24308
|
+
return;
|
|
23702
24309
|
}
|
|
23703
|
-
await
|
|
23704
|
-
|
|
23705
|
-
|
|
23706
|
-
handleSuccess(
|
|
23707
|
-
|
|
23708
|
-
onError: (error) => {
|
|
23709
|
-
ui.toast.error(error.message);
|
|
24310
|
+
await mutateAsync(
|
|
24311
|
+
{ amount: data.amount.float, note: data.note },
|
|
24312
|
+
{
|
|
24313
|
+
onSuccess: () => handleSuccess(),
|
|
24314
|
+
onError: (error) => ui.toast.error(error.message)
|
|
23710
24315
|
}
|
|
23711
|
-
});
|
|
23712
|
-
});
|
|
23713
|
-
const [currencySearchValue, setCurrencySearchValue] = React.useState("");
|
|
23714
|
-
const currencyOptions = React.useMemo(() => {
|
|
23715
|
-
const options = Object.values(currencies).map((currency) => ({
|
|
23716
|
-
label: `${currency.code} - ${currency.name} (${currency.symbol_native})`,
|
|
23717
|
-
value: currency.code.toLowerCase()
|
|
23718
|
-
}));
|
|
23719
|
-
if (!currencySearchValue) {
|
|
23720
|
-
return options;
|
|
23721
|
-
}
|
|
23722
|
-
return options.filter(
|
|
23723
|
-
(option) => option.label.toLowerCase().includes(currencySearchValue.toLowerCase())
|
|
23724
24316
|
);
|
|
23725
|
-
}, [currencySearchValue]);
|
|
23726
|
-
const {
|
|
23727
|
-
options: customerOptions,
|
|
23728
|
-
fetchNextPage,
|
|
23729
|
-
isFetchingNextPage,
|
|
23730
|
-
searchValue,
|
|
23731
|
-
onSearchValueChange,
|
|
23732
|
-
isLoading
|
|
23733
|
-
} = useComboboxData({
|
|
23734
|
-
queryKey: customersQueryKeys.list(),
|
|
23735
|
-
queryFn: async (params) => {
|
|
23736
|
-
return sdk.admin.customer.list(params);
|
|
23737
|
-
},
|
|
23738
|
-
getOptions: (data) => {
|
|
23739
|
-
return data.customers?.map((customer) => {
|
|
23740
|
-
const fullName = [customer.first_name, customer.last_name].filter(Boolean).join(" ");
|
|
23741
|
-
const label = fullName ? `${customer.email} (${fullName})` : customer.email;
|
|
23742
|
-
return {
|
|
23743
|
-
label,
|
|
23744
|
-
value: customer.id
|
|
23745
|
-
};
|
|
23746
|
-
}) || [];
|
|
23747
|
-
}
|
|
23748
24317
|
});
|
|
23749
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
23750
|
-
|
|
23751
|
-
|
|
23752
|
-
|
|
23753
|
-
|
|
23754
|
-
|
|
23755
|
-
|
|
23756
|
-
|
|
23757
|
-
|
|
23758
|
-
|
|
23759
|
-
|
|
23760
|
-
|
|
23761
|
-
|
|
23762
|
-
|
|
23763
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { className: "w-full", children: [
|
|
23764
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { className: "font-normal", children: "Currency" }),
|
|
24318
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
24319
|
+
KeyboundForm,
|
|
24320
|
+
{
|
|
24321
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
24322
|
+
onSubmit,
|
|
24323
|
+
children: [
|
|
24324
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
|
|
24325
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24326
|
+
Form$2.Field,
|
|
24327
|
+
{
|
|
24328
|
+
control: form.control,
|
|
24329
|
+
name: "amount",
|
|
24330
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
24331
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Amount" }),
|
|
23765
24332
|
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
23766
|
-
|
|
24333
|
+
ui.CurrencyInput,
|
|
23767
24334
|
{
|
|
23768
|
-
|
|
23769
|
-
|
|
23770
|
-
|
|
23771
|
-
|
|
23772
|
-
|
|
23773
|
-
|
|
24335
|
+
min: 0,
|
|
24336
|
+
placeholder: "0",
|
|
24337
|
+
value: field.value.value,
|
|
24338
|
+
onValueChange: (_value, _name, values) => {
|
|
24339
|
+
field.onChange({
|
|
24340
|
+
value: values?.value,
|
|
24341
|
+
float: values?.float || null
|
|
24342
|
+
});
|
|
24343
|
+
},
|
|
24344
|
+
symbol: currencies[storeCreditAccount.currency_code.toUpperCase()].symbol_native,
|
|
24345
|
+
code: storeCreditAccount.currency_code.toUpperCase()
|
|
23774
24346
|
}
|
|
23775
24347
|
) }),
|
|
23776
24348
|
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
23777
|
-
] })
|
|
24349
|
+
] })
|
|
23778
24350
|
}
|
|
23779
|
-
|
|
23780
|
-
|
|
23781
|
-
|
|
23782
|
-
|
|
23783
|
-
|
|
23784
|
-
|
|
23785
|
-
|
|
23786
|
-
|
|
23787
|
-
|
|
23788
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { className: "font-normal", children: "Customer" }),
|
|
23789
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
23790
|
-
Combobox,
|
|
23791
|
-
{
|
|
23792
|
-
value: field.value,
|
|
23793
|
-
onChange: field.onChange,
|
|
23794
|
-
searchValue,
|
|
23795
|
-
onSearchValueChange,
|
|
23796
|
-
options: customerOptions,
|
|
23797
|
-
placeholder: "Search for a customer...",
|
|
23798
|
-
fetchNextPage,
|
|
23799
|
-
isFetchingNextPage,
|
|
23800
|
-
noResultsPlaceholder: isLoading ? "Loading customers..." : "No customers found"
|
|
23801
|
-
}
|
|
23802
|
-
) }),
|
|
24351
|
+
),
|
|
24352
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24353
|
+
Form$2.Field,
|
|
24354
|
+
{
|
|
24355
|
+
control: form.control,
|
|
24356
|
+
name: "note",
|
|
24357
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
24358
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Note" }),
|
|
24359
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Textarea, { ...field }) }),
|
|
23803
24360
|
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
23804
|
-
] })
|
|
24361
|
+
] })
|
|
23805
24362
|
}
|
|
23806
|
-
|
|
23807
|
-
)
|
|
23808
|
-
|
|
23809
|
-
|
|
23810
|
-
|
|
23811
|
-
|
|
23812
|
-
|
|
23813
|
-
|
|
23814
|
-
|
|
23815
|
-
variant: "primary",
|
|
23816
|
-
size: "small",
|
|
23817
|
-
onClick: handleSubmit,
|
|
23818
|
-
disabled: isPending,
|
|
23819
|
-
children: "Create"
|
|
23820
|
-
}
|
|
23821
|
-
)
|
|
23822
|
-
] })
|
|
23823
|
-
] });
|
|
23824
|
-
};
|
|
23825
|
-
const StoreCreditAccountCreate = () => {
|
|
23826
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteFocusModal, { children: [
|
|
23827
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Create Store Credit Account" }) }),
|
|
23828
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Create a new store credit account" }) }),
|
|
23829
|
-
/* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountCreateForm, {})
|
|
23830
|
-
] });
|
|
24363
|
+
)
|
|
24364
|
+
] }),
|
|
24365
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
24366
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
24367
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
24368
|
+
] }) })
|
|
24369
|
+
]
|
|
24370
|
+
}
|
|
24371
|
+
) });
|
|
23831
24372
|
};
|
|
24373
|
+
const schema$2 = zod.z.object({
|
|
24374
|
+
note: zod.z.string(),
|
|
24375
|
+
amount: zod.z.object({
|
|
24376
|
+
float: zod.z.number(),
|
|
24377
|
+
value: zod.z.string()
|
|
24378
|
+
})
|
|
24379
|
+
});
|
|
23832
24380
|
function _extends() {
|
|
23833
24381
|
return _extends = Object.assign ? Object.assign.bind() : function(n2) {
|
|
23834
24382
|
for (var e = 1; e < arguments.length; e++) {
|
|
@@ -26508,258 +27056,6 @@ const GiftCardOrderSection = ({ giftCard }) => {
|
|
|
26508
27056
|
))
|
|
26509
27057
|
] });
|
|
26510
27058
|
};
|
|
26511
|
-
var toggleSelection;
|
|
26512
|
-
var hasRequiredToggleSelection;
|
|
26513
|
-
function requireToggleSelection() {
|
|
26514
|
-
if (hasRequiredToggleSelection) return toggleSelection;
|
|
26515
|
-
hasRequiredToggleSelection = 1;
|
|
26516
|
-
toggleSelection = function() {
|
|
26517
|
-
var selection = document.getSelection();
|
|
26518
|
-
if (!selection.rangeCount) {
|
|
26519
|
-
return function() {
|
|
26520
|
-
};
|
|
26521
|
-
}
|
|
26522
|
-
var active = document.activeElement;
|
|
26523
|
-
var ranges = [];
|
|
26524
|
-
for (var i2 = 0; i2 < selection.rangeCount; i2++) {
|
|
26525
|
-
ranges.push(selection.getRangeAt(i2));
|
|
26526
|
-
}
|
|
26527
|
-
switch (active.tagName.toUpperCase()) {
|
|
26528
|
-
// .toUpperCase handles XHTML
|
|
26529
|
-
case "INPUT":
|
|
26530
|
-
case "TEXTAREA":
|
|
26531
|
-
active.blur();
|
|
26532
|
-
break;
|
|
26533
|
-
default:
|
|
26534
|
-
active = null;
|
|
26535
|
-
break;
|
|
26536
|
-
}
|
|
26537
|
-
selection.removeAllRanges();
|
|
26538
|
-
return function() {
|
|
26539
|
-
selection.type === "Caret" && selection.removeAllRanges();
|
|
26540
|
-
if (!selection.rangeCount) {
|
|
26541
|
-
ranges.forEach(function(range) {
|
|
26542
|
-
selection.addRange(range);
|
|
26543
|
-
});
|
|
26544
|
-
}
|
|
26545
|
-
active && active.focus();
|
|
26546
|
-
};
|
|
26547
|
-
};
|
|
26548
|
-
return toggleSelection;
|
|
26549
|
-
}
|
|
26550
|
-
var copyToClipboard;
|
|
26551
|
-
var hasRequiredCopyToClipboard;
|
|
26552
|
-
function requireCopyToClipboard() {
|
|
26553
|
-
if (hasRequiredCopyToClipboard) return copyToClipboard;
|
|
26554
|
-
hasRequiredCopyToClipboard = 1;
|
|
26555
|
-
var deselectCurrent = requireToggleSelection();
|
|
26556
|
-
var clipboardToIE11Formatting = {
|
|
26557
|
-
"text/plain": "Text",
|
|
26558
|
-
"text/html": "Url",
|
|
26559
|
-
"default": "Text"
|
|
26560
|
-
};
|
|
26561
|
-
var defaultMessage = "Copy to clipboard: #{key}, Enter";
|
|
26562
|
-
function format2(message2) {
|
|
26563
|
-
var copyKey = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C";
|
|
26564
|
-
return message2.replace(/#{\s*key\s*}/g, copyKey);
|
|
26565
|
-
}
|
|
26566
|
-
function copy2(text2, options) {
|
|
26567
|
-
var debug2, message2, reselectPrevious, range, selection, mark, success = false;
|
|
26568
|
-
if (!options) {
|
|
26569
|
-
options = {};
|
|
26570
|
-
}
|
|
26571
|
-
debug2 = options.debug || false;
|
|
26572
|
-
try {
|
|
26573
|
-
reselectPrevious = deselectCurrent();
|
|
26574
|
-
range = document.createRange();
|
|
26575
|
-
selection = document.getSelection();
|
|
26576
|
-
mark = document.createElement("span");
|
|
26577
|
-
mark.textContent = text2;
|
|
26578
|
-
mark.ariaHidden = "true";
|
|
26579
|
-
mark.style.all = "unset";
|
|
26580
|
-
mark.style.position = "fixed";
|
|
26581
|
-
mark.style.top = 0;
|
|
26582
|
-
mark.style.clip = "rect(0, 0, 0, 0)";
|
|
26583
|
-
mark.style.whiteSpace = "pre";
|
|
26584
|
-
mark.style.webkitUserSelect = "text";
|
|
26585
|
-
mark.style.MozUserSelect = "text";
|
|
26586
|
-
mark.style.msUserSelect = "text";
|
|
26587
|
-
mark.style.userSelect = "text";
|
|
26588
|
-
mark.addEventListener("copy", function(e) {
|
|
26589
|
-
e.stopPropagation();
|
|
26590
|
-
if (options.format) {
|
|
26591
|
-
e.preventDefault();
|
|
26592
|
-
if (typeof e.clipboardData === "undefined") {
|
|
26593
|
-
debug2 && console.warn("unable to use e.clipboardData");
|
|
26594
|
-
debug2 && console.warn("trying IE specific stuff");
|
|
26595
|
-
window.clipboardData.clearData();
|
|
26596
|
-
var format3 = clipboardToIE11Formatting[options.format] || clipboardToIE11Formatting["default"];
|
|
26597
|
-
window.clipboardData.setData(format3, text2);
|
|
26598
|
-
} else {
|
|
26599
|
-
e.clipboardData.clearData();
|
|
26600
|
-
e.clipboardData.setData(options.format, text2);
|
|
26601
|
-
}
|
|
26602
|
-
}
|
|
26603
|
-
if (options.onCopy) {
|
|
26604
|
-
e.preventDefault();
|
|
26605
|
-
options.onCopy(e.clipboardData);
|
|
26606
|
-
}
|
|
26607
|
-
});
|
|
26608
|
-
document.body.appendChild(mark);
|
|
26609
|
-
range.selectNodeContents(mark);
|
|
26610
|
-
selection.addRange(range);
|
|
26611
|
-
var successful = document.execCommand("copy");
|
|
26612
|
-
if (!successful) {
|
|
26613
|
-
throw new Error("copy command was unsuccessful");
|
|
26614
|
-
}
|
|
26615
|
-
success = true;
|
|
26616
|
-
} catch (err) {
|
|
26617
|
-
debug2 && console.error("unable to copy using execCommand: ", err);
|
|
26618
|
-
debug2 && console.warn("trying IE specific stuff");
|
|
26619
|
-
try {
|
|
26620
|
-
window.clipboardData.setData(options.format || "text", text2);
|
|
26621
|
-
options.onCopy && options.onCopy(window.clipboardData);
|
|
26622
|
-
success = true;
|
|
26623
|
-
} catch (err2) {
|
|
26624
|
-
debug2 && console.error("unable to copy using clipboardData: ", err2);
|
|
26625
|
-
debug2 && console.error("falling back to prompt");
|
|
26626
|
-
message2 = format2("message" in options ? options.message : defaultMessage);
|
|
26627
|
-
window.prompt(message2, text2);
|
|
26628
|
-
}
|
|
26629
|
-
} finally {
|
|
26630
|
-
if (selection) {
|
|
26631
|
-
if (typeof selection.removeRange == "function") {
|
|
26632
|
-
selection.removeRange(range);
|
|
26633
|
-
} else {
|
|
26634
|
-
selection.removeAllRanges();
|
|
26635
|
-
}
|
|
26636
|
-
}
|
|
26637
|
-
if (mark) {
|
|
26638
|
-
document.body.removeChild(mark);
|
|
26639
|
-
}
|
|
26640
|
-
reselectPrevious();
|
|
26641
|
-
}
|
|
26642
|
-
return success;
|
|
26643
|
-
}
|
|
26644
|
-
copyToClipboard = copy2;
|
|
26645
|
-
return copyToClipboard;
|
|
26646
|
-
}
|
|
26647
|
-
var copyToClipboardExports = requireCopyToClipboard();
|
|
26648
|
-
const copy$1 = /* @__PURE__ */ getDefaultExportFromCjs(copyToClipboardExports);
|
|
26649
|
-
function DisplayId({ id, className }) {
|
|
26650
|
-
const [open, setOpen] = React.useState(false);
|
|
26651
|
-
const onClick = () => {
|
|
26652
|
-
copy$1(id);
|
|
26653
|
-
ui.toast.success("Copied to clipboard");
|
|
26654
|
-
};
|
|
26655
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { maxWidth: 260, content: id, open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { onClick, className: ui.clx("cursor-pointer", className), children: [
|
|
26656
|
-
"#",
|
|
26657
|
-
id.slice(-7)
|
|
26658
|
-
] }) });
|
|
26659
|
-
}
|
|
26660
|
-
const columnHelper$8 = ui.createDataTableColumnHelper();
|
|
26661
|
-
const useTransactionsTableColumns = () => {
|
|
26662
|
-
return React.useMemo(() => {
|
|
26663
|
-
return [
|
|
26664
|
-
columnHelper$8.accessor("id", {
|
|
26665
|
-
header: "ID",
|
|
26666
|
-
cell: ({ row }) => {
|
|
26667
|
-
return /* @__PURE__ */ jsxRuntime.jsx(DisplayId, { id: row.original.id });
|
|
26668
|
-
}
|
|
26669
|
-
}),
|
|
26670
|
-
columnHelper$8.accessor("created_at", {
|
|
26671
|
-
header: "Created At",
|
|
26672
|
-
cell: ({ row }) => formatDate(row.original.created_at, false)
|
|
26673
|
-
}),
|
|
26674
|
-
columnHelper$8.accessor("note", {
|
|
26675
|
-
header: "Description",
|
|
26676
|
-
cell: ({ row }) => row.original.note
|
|
26677
|
-
}),
|
|
26678
|
-
columnHelper$8.accessor("note", {
|
|
26679
|
-
header: "Note",
|
|
26680
|
-
cell: ({ row }) => {
|
|
26681
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { title: row.original.note, className: "max-w-[300px] truncate", children: row.original.note || "-" });
|
|
26682
|
-
}
|
|
26683
|
-
}),
|
|
26684
|
-
columnHelper$8.accessor("amount", {
|
|
26685
|
-
header: "Amount",
|
|
26686
|
-
cell: ({ row }) => {
|
|
26687
|
-
const isDebit = row.original.type === "debit";
|
|
26688
|
-
return row.original.account.currency_code && formatAmount(
|
|
26689
|
-
row.original.amount * (isDebit ? -1 : 1),
|
|
26690
|
-
row.original.account.currency_code
|
|
26691
|
-
);
|
|
26692
|
-
}
|
|
26693
|
-
})
|
|
26694
|
-
];
|
|
26695
|
-
}, []);
|
|
26696
|
-
};
|
|
26697
|
-
const useTransactionsTableFilters = ({}) => {
|
|
26698
|
-
const dateFilterOptions = useDataTableDateFilters$1();
|
|
26699
|
-
return React.useMemo(() => {
|
|
26700
|
-
return [...dateFilterOptions];
|
|
26701
|
-
}, [dateFilterOptions]);
|
|
26702
|
-
};
|
|
26703
|
-
const useTransactionsTableQuery = ({
|
|
26704
|
-
prefix,
|
|
26705
|
-
pageSize = 20
|
|
26706
|
-
}) => {
|
|
26707
|
-
const queryObject = useQueryParams(
|
|
26708
|
-
["offset", "limit", "currency_code", "created_at", "updated_at"],
|
|
26709
|
-
prefix
|
|
26710
|
-
);
|
|
26711
|
-
const { offset: offset2, limit, created_at, updated_at, ...rest } = queryObject;
|
|
26712
|
-
const searchParams = {
|
|
26713
|
-
limit: limit ? Number(limit) : pageSize,
|
|
26714
|
-
offset: offset2 ? Number(offset2) : 0,
|
|
26715
|
-
created_at: created_at ? JSON.parse(created_at) : void 0,
|
|
26716
|
-
updated_at: updated_at ? JSON.parse(updated_at) : void 0,
|
|
26717
|
-
...rest
|
|
26718
|
-
};
|
|
26719
|
-
return searchParams;
|
|
26720
|
-
};
|
|
26721
|
-
const PAGE_SIZE$4 = 10;
|
|
26722
|
-
function TransactionsTable({ id }) {
|
|
26723
|
-
const queryParams = useTransactionsTableQuery({
|
|
26724
|
-
pageSize: PAGE_SIZE$4
|
|
26725
|
-
});
|
|
26726
|
-
const { transactions, isLoading, count: count2 } = useStoreCreditAccountTransactions(
|
|
26727
|
-
id,
|
|
26728
|
-
{
|
|
26729
|
-
...queryParams,
|
|
26730
|
-
order: queryParams.order ?? "-created_at",
|
|
26731
|
-
fields: "*account"
|
|
26732
|
-
}
|
|
26733
|
-
);
|
|
26734
|
-
const columns = useTransactionsTableColumns();
|
|
26735
|
-
const filters = useTransactionsTableFilters({});
|
|
26736
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
26737
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
26738
|
-
DataTable,
|
|
26739
|
-
{
|
|
26740
|
-
data: transactions ?? [],
|
|
26741
|
-
getRowId: (row) => row.id,
|
|
26742
|
-
columns,
|
|
26743
|
-
filters,
|
|
26744
|
-
isLoading,
|
|
26745
|
-
pageSize: PAGE_SIZE$4,
|
|
26746
|
-
rowCount: count2,
|
|
26747
|
-
enableSearch: false,
|
|
26748
|
-
heading: "Transactions",
|
|
26749
|
-
emptyState: {
|
|
26750
|
-
empty: {
|
|
26751
|
-
heading: "No transactions found"
|
|
26752
|
-
},
|
|
26753
|
-
filtered: {
|
|
26754
|
-
heading: "No results found",
|
|
26755
|
-
description: "No transactions match your filter criteria."
|
|
26756
|
-
}
|
|
26757
|
-
}
|
|
26758
|
-
}
|
|
26759
|
-
) }),
|
|
26760
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
26761
|
-
] });
|
|
26762
|
-
}
|
|
26763
27059
|
const GiftCardTransactionsSection = ({
|
|
26764
27060
|
storeCreditAccount
|
|
26765
27061
|
}) => {
|
|
@@ -26809,33 +27105,6 @@ const GiftCardDetailsPage = () => {
|
|
|
26809
27105
|
}
|
|
26810
27106
|
);
|
|
26811
27107
|
};
|
|
26812
|
-
const KeyboundForm = React__namespace.default.forwardRef(({ onSubmit, onKeyDown, ...rest }, ref) => {
|
|
26813
|
-
const handleSubmit = (event) => {
|
|
26814
|
-
event.preventDefault();
|
|
26815
|
-
onSubmit?.(event);
|
|
26816
|
-
};
|
|
26817
|
-
const handleKeyDown = (event) => {
|
|
26818
|
-
if (event.key === "Enter") {
|
|
26819
|
-
if (event.target instanceof HTMLTextAreaElement && !(event.metaKey || event.ctrlKey)) {
|
|
26820
|
-
return;
|
|
26821
|
-
}
|
|
26822
|
-
event.preventDefault();
|
|
26823
|
-
if (event.metaKey || event.ctrlKey) {
|
|
26824
|
-
handleSubmit(event);
|
|
26825
|
-
}
|
|
26826
|
-
}
|
|
26827
|
-
};
|
|
26828
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
26829
|
-
"form",
|
|
26830
|
-
{
|
|
26831
|
-
...rest,
|
|
26832
|
-
onSubmit: handleSubmit,
|
|
26833
|
-
onKeyDown: onKeyDown ?? handleKeyDown,
|
|
26834
|
-
ref
|
|
26835
|
-
}
|
|
26836
|
-
);
|
|
26837
|
-
});
|
|
26838
|
-
KeyboundForm.displayName = "KeyboundForm";
|
|
26839
27108
|
const GiftCardExpiration = () => {
|
|
26840
27109
|
const { id } = reactRouterDom.useParams();
|
|
26841
27110
|
const { gift_card: giftCard, isPending, isError, error } = useGiftCard(id);
|
|
@@ -26856,7 +27125,7 @@ const GiftCardExpirationForm = ({ giftCard }) => {
|
|
|
26856
27125
|
defaultValues: {
|
|
26857
27126
|
expires_at: giftCard.expires_at ? new Date(giftCard.expires_at) : null
|
|
26858
27127
|
},
|
|
26859
|
-
resolver: u(schema$
|
|
27128
|
+
resolver: u(schema$1)
|
|
26860
27129
|
});
|
|
26861
27130
|
const { mutateAsync, isPending } = useUpdateGiftCard(giftCard.id);
|
|
26862
27131
|
const { handleSuccess } = useRouteModal();
|
|
@@ -26951,10 +27220,10 @@ const GiftCardExpirationForm = ({ giftCard }) => {
|
|
|
26951
27220
|
}
|
|
26952
27221
|
) });
|
|
26953
27222
|
};
|
|
26954
|
-
const schema$
|
|
27223
|
+
const schema$1 = zod.z.object({
|
|
26955
27224
|
expires_at: zod.z.date().nullish()
|
|
26956
27225
|
});
|
|
26957
|
-
const Note
|
|
27226
|
+
const Note = () => {
|
|
26958
27227
|
const { id } = reactRouterDom.useParams();
|
|
26959
27228
|
const {
|
|
26960
27229
|
gift_card: giftCard,
|
|
@@ -26979,7 +27248,7 @@ const GiftCardNoteForm = ({ giftCard }) => {
|
|
|
26979
27248
|
defaultValues: {
|
|
26980
27249
|
note: giftCard.note ?? ""
|
|
26981
27250
|
},
|
|
26982
|
-
resolver: u(schema
|
|
27251
|
+
resolver: u(schema)
|
|
26983
27252
|
});
|
|
26984
27253
|
const { mutateAsync, isPending } = useUpdateGiftCard(giftCard.id);
|
|
26985
27254
|
const { handleSuccess } = useRouteModal();
|
|
@@ -27018,7 +27287,7 @@ const GiftCardNoteForm = ({ giftCard }) => {
|
|
|
27018
27287
|
}
|
|
27019
27288
|
) });
|
|
27020
27289
|
};
|
|
27021
|
-
const schema
|
|
27290
|
+
const schema = zod.z.object({
|
|
27022
27291
|
note: zod.z.string().optional()
|
|
27023
27292
|
});
|
|
27024
27293
|
const columnHelper$7 = createColumnHelper();
|
|
@@ -40678,7 +40947,7 @@ const GiftCardProductCreate = () => {
|
|
|
40678
40947
|
isPending: isStorePending,
|
|
40679
40948
|
isError: isStoreError,
|
|
40680
40949
|
error: storeError
|
|
40681
|
-
} = useStore$
|
|
40950
|
+
} = useStore$1({
|
|
40682
40951
|
fields: "+default_sales_channel"
|
|
40683
40952
|
});
|
|
40684
40953
|
const {
|
|
@@ -40730,275 +40999,6 @@ const GiftCardProductCreate = () => {
|
|
|
40730
40999
|
)
|
|
40731
41000
|
] });
|
|
40732
41001
|
};
|
|
40733
|
-
const StoreCreditAccountBalanceSection = ({
|
|
40734
|
-
storeCreditAccount
|
|
40735
|
-
}) => {
|
|
40736
|
-
if (!storeCreditAccount || typeof storeCreditAccount.balance === "undefined") {
|
|
40737
|
-
return;
|
|
40738
|
-
}
|
|
40739
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "grid grid-cols-2 gap-x-2 px-6 py-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-ui-fg-subtle flex items-center gap-x-3", children: [
|
|
40740
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-ui-tag-green-icon h-8 w-1 rounded-full" }),
|
|
40741
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
40742
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", size: "small", className: "text-ui-fg-subtle", children: "Current Balance" }),
|
|
40743
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
40744
|
-
ui.Text,
|
|
40745
|
-
{
|
|
40746
|
-
weight: "plus",
|
|
40747
|
-
size: "xlarge",
|
|
40748
|
-
className: "tabular-nums text-ui-fg-base",
|
|
40749
|
-
children: formatAmount(
|
|
40750
|
-
storeCreditAccount.balance,
|
|
40751
|
-
storeCreditAccount.currency_code
|
|
40752
|
-
)
|
|
40753
|
-
}
|
|
40754
|
-
)
|
|
40755
|
-
] })
|
|
40756
|
-
] }) });
|
|
40757
|
-
};
|
|
40758
|
-
const StoreCreditAccountDetailsSection = ({
|
|
40759
|
-
storeCreditAccount
|
|
40760
|
-
}) => {
|
|
40761
|
-
if (!storeCreditAccount || typeof storeCreditAccount.balance === "undefined") {
|
|
40762
|
-
return;
|
|
40763
|
-
}
|
|
40764
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "flex justify-between gap-x-2 px-6 py-6", children: [
|
|
40765
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
40766
|
-
ui.Text,
|
|
40767
|
-
{
|
|
40768
|
-
weight: "plus",
|
|
40769
|
-
size: "xlarge",
|
|
40770
|
-
className: "text-ui-fg-base flex gap-x-4",
|
|
40771
|
-
children: [
|
|
40772
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
40773
|
-
/* @__PURE__ */ jsxRuntime.jsx(CreditCardIcon, { className: "inline" }),
|
|
40774
|
-
" "
|
|
40775
|
-
] }),
|
|
40776
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
40777
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-ui-fg-subtle", children: [
|
|
40778
|
-
storeCreditAccount.currency_code.toUpperCase(),
|
|
40779
|
-
" Account"
|
|
40780
|
-
] }),
|
|
40781
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-base", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
40782
|
-
ui.Text,
|
|
40783
|
-
{
|
|
40784
|
-
weight: "regular",
|
|
40785
|
-
size: "small",
|
|
40786
|
-
className: "text-ui-fg-base flex gap-x-4",
|
|
40787
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(DisplayId, { id: storeCreditAccount.id })
|
|
40788
|
-
}
|
|
40789
|
-
) })
|
|
40790
|
-
] })
|
|
40791
|
-
]
|
|
40792
|
-
}
|
|
40793
|
-
),
|
|
40794
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-x-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
40795
|
-
ActionMenu,
|
|
40796
|
-
{
|
|
40797
|
-
groups: [
|
|
40798
|
-
{
|
|
40799
|
-
actions: [
|
|
40800
|
-
{
|
|
40801
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CreditCard, {}),
|
|
40802
|
-
label: "Credit the account",
|
|
40803
|
-
to: "credit"
|
|
40804
|
-
}
|
|
40805
|
-
]
|
|
40806
|
-
}
|
|
40807
|
-
]
|
|
40808
|
-
}
|
|
40809
|
-
) })
|
|
40810
|
-
] });
|
|
40811
|
-
};
|
|
40812
|
-
function StoreCreditAccountCustomerSection({
|
|
40813
|
-
customerId
|
|
40814
|
-
}) {
|
|
40815
|
-
const { customer, isPending } = useCustomer(customerId, void 0, {
|
|
40816
|
-
enabled: !!customerId
|
|
40817
|
-
});
|
|
40818
|
-
if (isPending || !customer) {
|
|
40819
|
-
return null;
|
|
40820
|
-
}
|
|
40821
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0", children: [
|
|
40822
|
-
/* @__PURE__ */ jsxRuntime.jsx(Header$5, { title: "Customer" }),
|
|
40823
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
40824
|
-
SidebarLink,
|
|
40825
|
-
{
|
|
40826
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.User, {}),
|
|
40827
|
-
labelKey: customer.email || "N/A",
|
|
40828
|
-
descriptionKey: !customer.first_name && !customer.last_name ? "N/A" : `${customer.first_name} ${customer.last_name}`,
|
|
40829
|
-
to: `/customers/${customer.id}`
|
|
40830
|
-
},
|
|
40831
|
-
customer.id
|
|
40832
|
-
)
|
|
40833
|
-
] });
|
|
40834
|
-
}
|
|
40835
|
-
function StoreCreditAccountCodeSection({ code }) {
|
|
40836
|
-
if (!code) {
|
|
40837
|
-
return null;
|
|
40838
|
-
}
|
|
40839
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0", children: [
|
|
40840
|
-
/* @__PURE__ */ jsxRuntime.jsx(Header$5, { title: "Account Code" }),
|
|
40841
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-4 px-6 mb-2", children: [
|
|
40842
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.Share, { className: "inline" }),
|
|
40843
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle text-sm", children: code })
|
|
40844
|
-
] })
|
|
40845
|
-
] });
|
|
40846
|
-
}
|
|
40847
|
-
const StoreCreditAccountPage = () => {
|
|
40848
|
-
const { id } = reactRouterDom.useParams();
|
|
40849
|
-
const { store_credit_account: storeCreditAccount } = useStoreCreditAccount(
|
|
40850
|
-
id
|
|
40851
|
-
);
|
|
40852
|
-
if (!storeCreditAccount) {
|
|
40853
|
-
return;
|
|
40854
|
-
}
|
|
40855
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
40856
|
-
components.LayoutComposer,
|
|
40857
|
-
{
|
|
40858
|
-
widgetsZonePrefix: "store_credit_account.details",
|
|
40859
|
-
preferredLayoutId: "core:two-column",
|
|
40860
|
-
data: storeCreditAccount,
|
|
40861
|
-
sections: {
|
|
40862
|
-
main: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
40863
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountDetailsSection", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
40864
|
-
StoreCreditAccountDetailsSection,
|
|
40865
|
-
{
|
|
40866
|
-
storeCreditAccount
|
|
40867
|
-
}
|
|
40868
|
-
) }),
|
|
40869
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "TransactionsTable", children: /* @__PURE__ */ jsxRuntime.jsx(TransactionsTable, { id: storeCreditAccount.id }) })
|
|
40870
|
-
] }),
|
|
40871
|
-
side: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
40872
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountBalanceSection", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
40873
|
-
StoreCreditAccountBalanceSection,
|
|
40874
|
-
{
|
|
40875
|
-
storeCreditAccount
|
|
40876
|
-
}
|
|
40877
|
-
) }),
|
|
40878
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountCodeSection", children: /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountCodeSection, { code: storeCreditAccount.code }) }),
|
|
40879
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountCustomerSection", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
40880
|
-
StoreCreditAccountCustomerSection,
|
|
40881
|
-
{
|
|
40882
|
-
customerId: storeCreditAccount.customer_id
|
|
40883
|
-
}
|
|
40884
|
-
) })
|
|
40885
|
-
] })
|
|
40886
|
-
}
|
|
40887
|
-
}
|
|
40888
|
-
);
|
|
40889
|
-
};
|
|
40890
|
-
const Note = () => {
|
|
40891
|
-
const { id } = reactRouterDom.useParams();
|
|
40892
|
-
const {
|
|
40893
|
-
store_credit_account: storeCreditAccount,
|
|
40894
|
-
isPending,
|
|
40895
|
-
isError,
|
|
40896
|
-
error
|
|
40897
|
-
} = useStoreCreditAccount(id, {});
|
|
40898
|
-
if (isError) {
|
|
40899
|
-
throw error;
|
|
40900
|
-
}
|
|
40901
|
-
const isReady = !isPending && !!storeCreditAccount;
|
|
40902
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
40903
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
40904
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Credit store credit account" }) }),
|
|
40905
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Credit the store credit account" }) })
|
|
40906
|
-
] }),
|
|
40907
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountCreditForm, { storeCreditAccount })
|
|
40908
|
-
] });
|
|
40909
|
-
};
|
|
40910
|
-
const StoreCreditAccountCreditForm = ({
|
|
40911
|
-
storeCreditAccount
|
|
40912
|
-
}) => {
|
|
40913
|
-
const form = useForm({
|
|
40914
|
-
defaultValues: {
|
|
40915
|
-
amount: {
|
|
40916
|
-
float: 0,
|
|
40917
|
-
value: ""
|
|
40918
|
-
},
|
|
40919
|
-
note: ""
|
|
40920
|
-
},
|
|
40921
|
-
resolver: u(schema)
|
|
40922
|
-
});
|
|
40923
|
-
const { mutateAsync, isPending } = useCreditStoreCreditAccount(
|
|
40924
|
-
storeCreditAccount.id
|
|
40925
|
-
);
|
|
40926
|
-
const { handleSuccess } = useRouteModal();
|
|
40927
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
40928
|
-
if (data.amount.float <= 0) {
|
|
40929
|
-
form.setError("amount", { message: "Amount must be greater than 0" });
|
|
40930
|
-
return;
|
|
40931
|
-
}
|
|
40932
|
-
await mutateAsync(
|
|
40933
|
-
{ amount: data.amount.float, note: data.note },
|
|
40934
|
-
{
|
|
40935
|
-
onSuccess: () => handleSuccess(),
|
|
40936
|
-
onError: (error) => ui.toast.error(error.message)
|
|
40937
|
-
}
|
|
40938
|
-
);
|
|
40939
|
-
});
|
|
40940
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
40941
|
-
KeyboundForm,
|
|
40942
|
-
{
|
|
40943
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
40944
|
-
onSubmit,
|
|
40945
|
-
children: [
|
|
40946
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
|
|
40947
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
40948
|
-
Form$2.Field,
|
|
40949
|
-
{
|
|
40950
|
-
control: form.control,
|
|
40951
|
-
name: "amount",
|
|
40952
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
40953
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Amount" }),
|
|
40954
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
40955
|
-
ui.CurrencyInput,
|
|
40956
|
-
{
|
|
40957
|
-
min: 0,
|
|
40958
|
-
placeholder: "0",
|
|
40959
|
-
value: field.value.value,
|
|
40960
|
-
onValueChange: (_value, _name, values) => {
|
|
40961
|
-
field.onChange({
|
|
40962
|
-
value: values?.value,
|
|
40963
|
-
float: values?.float || null
|
|
40964
|
-
});
|
|
40965
|
-
},
|
|
40966
|
-
symbol: currencies[storeCreditAccount.currency_code.toUpperCase()].symbol_native,
|
|
40967
|
-
code: storeCreditAccount.currency_code.toUpperCase()
|
|
40968
|
-
}
|
|
40969
|
-
) }),
|
|
40970
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
40971
|
-
] })
|
|
40972
|
-
}
|
|
40973
|
-
),
|
|
40974
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
40975
|
-
Form$2.Field,
|
|
40976
|
-
{
|
|
40977
|
-
control: form.control,
|
|
40978
|
-
name: "note",
|
|
40979
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
40980
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Note" }),
|
|
40981
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Textarea, { ...field }) }),
|
|
40982
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
40983
|
-
] })
|
|
40984
|
-
}
|
|
40985
|
-
)
|
|
40986
|
-
] }),
|
|
40987
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
40988
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
40989
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
40990
|
-
] }) })
|
|
40991
|
-
]
|
|
40992
|
-
}
|
|
40993
|
-
) });
|
|
40994
|
-
};
|
|
40995
|
-
const schema = zod.z.object({
|
|
40996
|
-
note: zod.z.string(),
|
|
40997
|
-
amount: zod.z.object({
|
|
40998
|
-
float: zod.z.number(),
|
|
40999
|
-
value: zod.z.string()
|
|
41000
|
-
})
|
|
41001
|
-
});
|
|
41002
41002
|
const productStatusColor = (status) => {
|
|
41003
41003
|
switch (status) {
|
|
41004
41004
|
case "draft":
|
|
@@ -42432,7 +42432,7 @@ const ProductMedia = () => {
|
|
|
42432
42432
|
] });
|
|
42433
42433
|
};
|
|
42434
42434
|
const VariantPricingForm = ({ form }) => {
|
|
42435
|
-
const { store } = useStore$
|
|
42435
|
+
const { store } = useStore$1();
|
|
42436
42436
|
const { regions } = useRegions({ limit: 9999 });
|
|
42437
42437
|
const { price_preferences: pricePreferences } = usePricePreferences({});
|
|
42438
42438
|
const { setCloseOnEscape } = useRouteModal();
|
|
@@ -42707,10 +42707,21 @@ const widgetModule = { widgets: [
|
|
|
42707
42707
|
] };
|
|
42708
42708
|
const routeModule = {
|
|
42709
42709
|
routes: [
|
|
42710
|
+
{
|
|
42711
|
+
Component: StoreCreditAccountsPage,
|
|
42712
|
+
path: "/store-credit-accounts",
|
|
42713
|
+
handle: { label: config$3.label, translationNs: config$3.translationNs },
|
|
42714
|
+
children: [
|
|
42715
|
+
{
|
|
42716
|
+
Component: StoreCreditAccountCreate,
|
|
42717
|
+
path: "/store-credit-accounts/create"
|
|
42718
|
+
}
|
|
42719
|
+
]
|
|
42720
|
+
},
|
|
42710
42721
|
{
|
|
42711
42722
|
Component: GiftCardsPage,
|
|
42712
42723
|
path: "/gift-cards",
|
|
42713
|
-
handle: { label: config$
|
|
42724
|
+
handle: { label: config$2.label, translationNs: config$2.translationNs },
|
|
42714
42725
|
children: [
|
|
42715
42726
|
{
|
|
42716
42727
|
Component: GiftCardCreate,
|
|
@@ -42719,13 +42730,12 @@ const routeModule = {
|
|
|
42719
42730
|
]
|
|
42720
42731
|
},
|
|
42721
42732
|
{
|
|
42722
|
-
Component:
|
|
42723
|
-
path: "/store-credit-accounts",
|
|
42724
|
-
handle: { label: config$1.label, translationNs: config$1.translationNs },
|
|
42733
|
+
Component: StoreCreditAccountPage,
|
|
42734
|
+
path: "/store-credit-accounts/:id",
|
|
42725
42735
|
children: [
|
|
42726
42736
|
{
|
|
42727
|
-
Component:
|
|
42728
|
-
path: "/store-credit-accounts/
|
|
42737
|
+
Component: Note$1,
|
|
42738
|
+
path: "/store-credit-accounts/:id/credit"
|
|
42729
42739
|
}
|
|
42730
42740
|
]
|
|
42731
42741
|
},
|
|
@@ -42738,7 +42748,7 @@ const routeModule = {
|
|
|
42738
42748
|
path: "/gift-cards/:id/expiration"
|
|
42739
42749
|
},
|
|
42740
42750
|
{
|
|
42741
|
-
Component: Note
|
|
42751
|
+
Component: Note,
|
|
42742
42752
|
path: "/gift-cards/:id/note"
|
|
42743
42753
|
}
|
|
42744
42754
|
]
|
|
@@ -42754,16 +42764,6 @@ const routeModule = {
|
|
|
42754
42764
|
}
|
|
42755
42765
|
]
|
|
42756
42766
|
},
|
|
42757
|
-
{
|
|
42758
|
-
Component: StoreCreditAccountPage,
|
|
42759
|
-
path: "/store-credit-accounts/:id",
|
|
42760
|
-
children: [
|
|
42761
|
-
{
|
|
42762
|
-
Component: Note,
|
|
42763
|
-
path: "/store-credit-accounts/:id/credit"
|
|
42764
|
-
}
|
|
42765
|
-
]
|
|
42766
|
-
},
|
|
42767
42767
|
{
|
|
42768
42768
|
Component: ProductDetail,
|
|
42769
42769
|
path: "/gift-cards/gift-card-products/:id",
|
|
@@ -42795,16 +42795,16 @@ const routeModule = {
|
|
|
42795
42795
|
const menuItemModule = {
|
|
42796
42796
|
menuItems: [
|
|
42797
42797
|
{
|
|
42798
|
-
label: config$
|
|
42799
|
-
icon: config$
|
|
42798
|
+
label: config$2.label,
|
|
42799
|
+
icon: config$2.icon,
|
|
42800
42800
|
path: "/gift-cards",
|
|
42801
42801
|
nested: void 0,
|
|
42802
42802
|
rank: void 0,
|
|
42803
42803
|
translationNs: void 0
|
|
42804
42804
|
},
|
|
42805
42805
|
{
|
|
42806
|
-
label: config$
|
|
42807
|
-
icon: config$
|
|
42806
|
+
label: config$3.label,
|
|
42807
|
+
icon: config$3.icon,
|
|
42808
42808
|
path: "/store-credit-accounts",
|
|
42809
42809
|
nested: void 0,
|
|
42810
42810
|
rank: void 0,
|