@medusajs/loyalty-plugin 2.21.2 → 2.22.0-preview-20261002101246
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.
|
@@ -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;
|
|
@@ -5778,7 +5778,7 @@ adminSdk.defineWidgetConfig({
|
|
|
5778
5778
|
zone: "sales_channel.details.after",
|
|
5779
5779
|
id: "medusa:sales-channel-gift-cards-widget"
|
|
5780
5780
|
});
|
|
5781
|
-
const
|
|
5781
|
+
const StoreCreditIcon = (props) => {
|
|
5782
5782
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5783
5783
|
"svg",
|
|
5784
5784
|
{
|
|
@@ -5789,197 +5789,49 @@ const GiftCardIcon = (props) => {
|
|
|
5789
5789
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5790
5790
|
...props,
|
|
5791
5791
|
children: [
|
|
5792
|
-
/* @__PURE__ */ jsxRuntime.jsx("rect", { width: "15", height: "15", fill: "#
|
|
5792
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { width: "15", height: "15", fill: "#8B5CF6" }),
|
|
5793
5793
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5794
5794
|
"rect",
|
|
5795
5795
|
{
|
|
5796
5796
|
width: "15",
|
|
5797
5797
|
height: "15",
|
|
5798
|
-
fill: "url(#
|
|
5798
|
+
fill: "url(#paint0_linear_29181_44790)",
|
|
5799
5799
|
fillOpacity: "0.2"
|
|
5800
5800
|
}
|
|
5801
5801
|
),
|
|
5802
|
-
/* @__PURE__ */ jsxRuntime.
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5832
|
-
"path",
|
|
5833
|
-
{
|
|
5834
|
-
d: "M8.063 7.5V11.625H9.188C10.325 11.625 11.25 10.7 11.25 9.563V7.5H8.063Z",
|
|
5835
|
-
fill: "white"
|
|
5836
|
-
}
|
|
5837
|
-
)
|
|
5838
|
-
] }),
|
|
5839
|
-
/* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
|
|
5840
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
5841
|
-
"linearGradient",
|
|
5842
|
-
{
|
|
5843
|
-
id: "paint0_linear_28788_25808",
|
|
5844
|
-
x1: "7.5",
|
|
5845
|
-
y1: "0",
|
|
5846
|
-
x2: "7.5",
|
|
5847
|
-
y2: "15",
|
|
5848
|
-
gradientUnits: "userSpaceOnUse",
|
|
5849
|
-
children: [
|
|
5850
|
-
/* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "white" }),
|
|
5851
|
-
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })
|
|
5852
|
-
]
|
|
5853
|
-
}
|
|
5854
|
-
),
|
|
5855
|
-
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_28788_25808", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "9", height: "9", fill: "white", transform: "translate(3 3)" }) })
|
|
5856
|
-
] })
|
|
5802
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5803
|
+
"path",
|
|
5804
|
+
{
|
|
5805
|
+
d: "M12 6V5.813C12 4.675 11.075 3.75 9.938 3.75H5.063C3.925 3.75 3 4.675 3 5.813V6H12Z",
|
|
5806
|
+
fill: "white"
|
|
5807
|
+
}
|
|
5808
|
+
),
|
|
5809
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5810
|
+
"path",
|
|
5811
|
+
{
|
|
5812
|
+
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",
|
|
5813
|
+
fill: "white"
|
|
5814
|
+
}
|
|
5815
|
+
),
|
|
5816
|
+
/* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5817
|
+
"linearGradient",
|
|
5818
|
+
{
|
|
5819
|
+
id: "paint0_linear_29181_44790",
|
|
5820
|
+
x1: "7.5",
|
|
5821
|
+
y1: "0",
|
|
5822
|
+
x2: "7.5",
|
|
5823
|
+
y2: "15",
|
|
5824
|
+
gradientUnits: "userSpaceOnUse",
|
|
5825
|
+
children: [
|
|
5826
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "white" }),
|
|
5827
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })
|
|
5828
|
+
]
|
|
5829
|
+
}
|
|
5830
|
+
) })
|
|
5857
5831
|
]
|
|
5858
5832
|
}
|
|
5859
5833
|
);
|
|
5860
5834
|
};
|
|
5861
|
-
const GiftCardProductsSection = () => {
|
|
5862
|
-
const { products: giftCardProducts, count: count2 = 0 } = useProducts({
|
|
5863
|
-
is_giftcard: true
|
|
5864
|
-
});
|
|
5865
|
-
const slicedProducts = giftCardProducts?.slice(0, 3) ?? [];
|
|
5866
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0", children: [
|
|
5867
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
5868
|
-
/* @__PURE__ */ jsxRuntime.jsx(Header$5, { title: "Gift Card Products" }),
|
|
5869
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5870
|
-
reactRouterDom.Link,
|
|
5871
|
-
{
|
|
5872
|
-
to: `/gift-cards/gift-card-products/create`,
|
|
5873
|
-
className: "text-ui-fg-muted text-sm px-6",
|
|
5874
|
-
children: "Create"
|
|
5875
|
-
}
|
|
5876
|
-
)
|
|
5877
|
-
] }),
|
|
5878
|
-
giftCardProducts?.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5879
|
-
NoRecords,
|
|
5880
|
-
{
|
|
5881
|
-
className: "px-10 py-4 h-[200px]",
|
|
5882
|
-
title: "No gift card products",
|
|
5883
|
-
message: "There are no gift card products to show. Create one to get started.",
|
|
5884
|
-
action: {
|
|
5885
|
-
to: "/gift-cards/gift-card-products/create",
|
|
5886
|
-
label: "Create gift card product"
|
|
5887
|
-
}
|
|
5888
|
-
}
|
|
5889
|
-
),
|
|
5890
|
-
slicedProducts.map((giftCardProduct) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5891
|
-
SidebarLink,
|
|
5892
|
-
{
|
|
5893
|
-
to: `/gift-cards/gift-card-products/${giftCardProduct.id}`,
|
|
5894
|
-
labelKey: giftCardProduct.title,
|
|
5895
|
-
descriptionKey: giftCardProduct.title,
|
|
5896
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Tag, {})
|
|
5897
|
-
}
|
|
5898
|
-
)),
|
|
5899
|
-
count2 > 3 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5900
|
-
reactRouterDom.Link,
|
|
5901
|
-
{
|
|
5902
|
-
to: "/gift-cards/gift-card-products",
|
|
5903
|
-
className: "text-ui-fg-muted text-sm px-6 py-4 flex items-center justify-center",
|
|
5904
|
-
children: "View more"
|
|
5905
|
-
}
|
|
5906
|
-
)
|
|
5907
|
-
] });
|
|
5908
|
-
};
|
|
5909
|
-
const _giftCardQueryKey = queryKeysFactory("gift-card");
|
|
5910
|
-
const giftCardQueryKey = {
|
|
5911
|
-
..._giftCardQueryKey,
|
|
5912
|
-
orders: (id) => [..._giftCardQueryKey.detail(id), "orders"]
|
|
5913
|
-
};
|
|
5914
|
-
const useGiftCards = (query, options) => {
|
|
5915
|
-
const fetchGiftCards = (query2, headers) => sdk.client.fetch(`/admin/gift-cards`, {
|
|
5916
|
-
query: query2,
|
|
5917
|
-
headers
|
|
5918
|
-
});
|
|
5919
|
-
const { data, ...rest } = reactQuery.useQuery({
|
|
5920
|
-
...options,
|
|
5921
|
-
queryFn: () => fetchGiftCards(query),
|
|
5922
|
-
queryKey: giftCardQueryKey.list(query)
|
|
5923
|
-
});
|
|
5924
|
-
return { ...data, ...rest };
|
|
5925
|
-
};
|
|
5926
|
-
const useGiftCard = (id, query, options) => {
|
|
5927
|
-
const fetchGiftCard = (id2, query2, headers) => sdk.client.fetch(`/admin/gift-cards/${id2}`, {
|
|
5928
|
-
query: query2,
|
|
5929
|
-
headers
|
|
5930
|
-
});
|
|
5931
|
-
const { data, ...rest } = reactQuery.useQuery({
|
|
5932
|
-
queryFn: () => fetchGiftCard(id, query),
|
|
5933
|
-
queryKey: giftCardQueryKey.detail(id, query),
|
|
5934
|
-
...options
|
|
5935
|
-
});
|
|
5936
|
-
return { ...data, ...rest };
|
|
5937
|
-
};
|
|
5938
|
-
const useGiftCardOrders = (id, options) => {
|
|
5939
|
-
const fetchGiftCardOrders = (id2, query, headers) => sdk.client.fetch(`/admin/gift-cards/${id2}/orders`, {
|
|
5940
|
-
query,
|
|
5941
|
-
headers
|
|
5942
|
-
});
|
|
5943
|
-
const { data, ...rest } = reactQuery.useQuery({
|
|
5944
|
-
queryFn: () => fetchGiftCardOrders(id),
|
|
5945
|
-
queryKey: giftCardQueryKey.orders(id),
|
|
5946
|
-
...options
|
|
5947
|
-
});
|
|
5948
|
-
return { ...data, ...rest };
|
|
5949
|
-
};
|
|
5950
|
-
const useUpdateGiftCard = (id, options) => {
|
|
5951
|
-
const queryClient = reactQuery.useQueryClient();
|
|
5952
|
-
const updateGiftCard = async (id2, body) => sdk.client.fetch(`/admin/gift-cards/${id2}`, {
|
|
5953
|
-
body,
|
|
5954
|
-
method: "POST"
|
|
5955
|
-
});
|
|
5956
|
-
return reactQuery.useMutation({
|
|
5957
|
-
mutationFn: async (payload) => updateGiftCard(id, payload),
|
|
5958
|
-
onSuccess: (data, variables, context) => {
|
|
5959
|
-
queryClient.invalidateQueries({
|
|
5960
|
-
queryKey: giftCardQueryKey.detail(id)
|
|
5961
|
-
});
|
|
5962
|
-
queryClient.invalidateQueries({
|
|
5963
|
-
queryKey: giftCardQueryKey.lists()
|
|
5964
|
-
});
|
|
5965
|
-
},
|
|
5966
|
-
...options
|
|
5967
|
-
});
|
|
5968
|
-
};
|
|
5969
|
-
const useCreateGiftCard = (options) => {
|
|
5970
|
-
const queryClient = reactQuery.useQueryClient();
|
|
5971
|
-
const createGiftCard = async (body) => sdk.client.fetch(`/admin/gift-cards`, {
|
|
5972
|
-
body,
|
|
5973
|
-
method: "POST"
|
|
5974
|
-
});
|
|
5975
|
-
return reactQuery.useMutation({
|
|
5976
|
-
mutationFn: (body) => createGiftCard(body),
|
|
5977
|
-
onSuccess: (data, variables, context) => {
|
|
5978
|
-
queryClient.invalidateQueries({ queryKey: giftCardQueryKey.lists() });
|
|
5979
|
-
},
|
|
5980
|
-
...options
|
|
5981
|
-
});
|
|
5982
|
-
};
|
|
5983
5835
|
function getRelativeDate(date2) {
|
|
5984
5836
|
const now = /* @__PURE__ */ new Date();
|
|
5985
5837
|
return formatDistance(sub(new Date(date2), { minutes: 0 }), now, {
|
|
@@ -5997,30 +5849,51 @@ function formatDate(date2, withTime = true) {
|
|
|
5997
5849
|
return format(new Date(date2), "dd MMM, yyyy");
|
|
5998
5850
|
}
|
|
5999
5851
|
const columnHelper$a = ui.createDataTableColumnHelper();
|
|
6000
|
-
const
|
|
5852
|
+
const useStoreCreditAccountTableColumns = () => {
|
|
6001
5853
|
return React.useMemo(() => {
|
|
6002
5854
|
return [
|
|
6003
|
-
columnHelper$a.accessor("
|
|
6004
|
-
header: "
|
|
5855
|
+
columnHelper$a.accessor("currency_code", {
|
|
5856
|
+
header: "Currency",
|
|
6005
5857
|
cell: ({ row }) => {
|
|
6006
|
-
return row.original.
|
|
5858
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { size: "2xsmall", children: row.original.currency_code.toUpperCase() });
|
|
6007
5859
|
}
|
|
6008
5860
|
}),
|
|
6009
|
-
columnHelper$a.accessor("
|
|
6010
|
-
header: "
|
|
5861
|
+
columnHelper$a.accessor("customer.email", {
|
|
5862
|
+
header: "Customer",
|
|
6011
5863
|
cell: ({ row }) => {
|
|
6012
|
-
return row.original.
|
|
5864
|
+
return row.original.customer?.email ?? "N/A";
|
|
6013
5865
|
}
|
|
6014
5866
|
}),
|
|
6015
|
-
columnHelper$a.accessor("
|
|
6016
|
-
header: "
|
|
6017
|
-
cell: ({ row }) =>
|
|
5867
|
+
columnHelper$a.accessor("balance", {
|
|
5868
|
+
header: "Balance",
|
|
5869
|
+
cell: ({ row }) => {
|
|
5870
|
+
return formatAmount(
|
|
5871
|
+
row.original.balance,
|
|
5872
|
+
row.original.currency_code
|
|
5873
|
+
);
|
|
5874
|
+
}
|
|
6018
5875
|
}),
|
|
6019
|
-
columnHelper$a.accessor("
|
|
6020
|
-
header: "
|
|
5876
|
+
columnHelper$a.accessor("credits", {
|
|
5877
|
+
header: "Credits",
|
|
6021
5878
|
cell: ({ row }) => {
|
|
6022
|
-
return formatAmount(
|
|
5879
|
+
return formatAmount(
|
|
5880
|
+
row.original.credits,
|
|
5881
|
+
row.original.currency_code
|
|
5882
|
+
);
|
|
5883
|
+
}
|
|
5884
|
+
}),
|
|
5885
|
+
columnHelper$a.accessor("debits", {
|
|
5886
|
+
header: "Debits",
|
|
5887
|
+
cell: ({ row }) => {
|
|
5888
|
+
return formatAmount(
|
|
5889
|
+
row.original.debits,
|
|
5890
|
+
row.original.currency_code
|
|
5891
|
+
);
|
|
6023
5892
|
}
|
|
5893
|
+
}),
|
|
5894
|
+
columnHelper$a.accessor("created_at", {
|
|
5895
|
+
header: "Created at",
|
|
5896
|
+
cell: ({ row }) => getRelativeDate(row.original.created_at)
|
|
6024
5897
|
})
|
|
6025
5898
|
];
|
|
6026
5899
|
}, []);
|
|
@@ -6067,75 +5940,83 @@ const useCustomerFilters = () => {
|
|
|
6067
5940
|
];
|
|
6068
5941
|
}, [customerFilterOptions]);
|
|
6069
5942
|
};
|
|
6070
|
-
const
|
|
5943
|
+
const useStoreCreditAccountFilters = () => {
|
|
6071
5944
|
const dateFilterOptions = useDataTableDateFilters$1();
|
|
6072
5945
|
const customerFilterOptions = useCustomerFilters();
|
|
6073
5946
|
return React.useMemo(() => {
|
|
6074
5947
|
return [...dateFilterOptions, ...customerFilterOptions];
|
|
6075
5948
|
}, [dateFilterOptions, customerFilterOptions]);
|
|
6076
5949
|
};
|
|
6077
|
-
const
|
|
5950
|
+
const useStoreCreditAccountsTableQuery = ({
|
|
6078
5951
|
prefix,
|
|
6079
5952
|
pageSize = 20
|
|
6080
5953
|
}) => {
|
|
6081
5954
|
const queryObject = useQueryParams(
|
|
6082
|
-
["
|
|
5955
|
+
["offset", "customer_id", "currency_code", "created_at", "updated_at"],
|
|
6083
5956
|
prefix
|
|
6084
5957
|
);
|
|
6085
|
-
const {
|
|
5958
|
+
const {
|
|
5959
|
+
offset: offset2,
|
|
5960
|
+
created_at,
|
|
5961
|
+
updated_at,
|
|
5962
|
+
customer_id,
|
|
5963
|
+
currency_code,
|
|
5964
|
+
...rest
|
|
5965
|
+
} = queryObject;
|
|
6086
5966
|
const searchParams = {
|
|
6087
5967
|
limit: pageSize,
|
|
6088
5968
|
offset: offset2 ? Number(offset2) : 0,
|
|
6089
5969
|
created_at: created_at ? JSON.parse(created_at) : void 0,
|
|
6090
5970
|
updated_at: updated_at ? JSON.parse(updated_at) : void 0,
|
|
6091
5971
|
customer_id: customer_id ? JSON.parse(customer_id) : void 0,
|
|
5972
|
+
currency_code: currency_code ? JSON.parse(currency_code) : void 0,
|
|
6092
5973
|
...rest
|
|
6093
5974
|
};
|
|
6094
5975
|
return searchParams;
|
|
6095
5976
|
};
|
|
6096
5977
|
const PAGE_SIZE$6 = 10;
|
|
6097
|
-
function
|
|
6098
|
-
const queryParams =
|
|
5978
|
+
function StoreCreditAccountsTable() {
|
|
5979
|
+
const queryParams = useStoreCreditAccountsTableQuery({
|
|
6099
5980
|
pageSize: PAGE_SIZE$6
|
|
6100
5981
|
});
|
|
6101
5982
|
const {
|
|
6102
|
-
|
|
5983
|
+
store_credit_accounts: storeCreditAccounts,
|
|
6103
5984
|
isPending,
|
|
6104
5985
|
count: count2
|
|
6105
|
-
} =
|
|
5986
|
+
} = useStoreCreditAccounts({
|
|
6106
5987
|
...queryParams,
|
|
6107
|
-
order: queryParams.order ?? "-created_at"
|
|
6108
|
-
fields: "+line_item.product.title"
|
|
5988
|
+
order: queryParams.order ?? "-created_at"
|
|
6109
5989
|
});
|
|
6110
|
-
const columns =
|
|
6111
|
-
const filters =
|
|
5990
|
+
const columns = useStoreCreditAccountTableColumns();
|
|
5991
|
+
const filters = useStoreCreditAccountFilters();
|
|
6112
5992
|
return /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
6113
5993
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6114
5994
|
DataTable,
|
|
6115
5995
|
{
|
|
6116
|
-
data:
|
|
5996
|
+
data: storeCreditAccounts ?? [],
|
|
6117
5997
|
getRowId: (row) => row.id,
|
|
6118
5998
|
columns,
|
|
6119
5999
|
filters,
|
|
6120
6000
|
isLoading: isPending,
|
|
6121
6001
|
pageSize: PAGE_SIZE$6,
|
|
6122
6002
|
rowCount: count2,
|
|
6123
|
-
|
|
6003
|
+
enableSearch: false,
|
|
6004
|
+
heading: "Store Credit Accounts",
|
|
6124
6005
|
rowHref: (row) => `${row.id}`,
|
|
6125
6006
|
emptyState: {
|
|
6126
6007
|
empty: {
|
|
6127
|
-
heading: "No
|
|
6128
|
-
description: "Create a
|
|
6008
|
+
heading: "No store credit accounts found",
|
|
6009
|
+
description: "Create a new store credit account to get started."
|
|
6129
6010
|
},
|
|
6130
6011
|
filtered: {
|
|
6131
6012
|
heading: "No results found",
|
|
6132
|
-
description: "No
|
|
6013
|
+
description: "No store credit accounts match your filter criteria."
|
|
6133
6014
|
}
|
|
6134
6015
|
},
|
|
6135
6016
|
actions: [
|
|
6136
6017
|
{
|
|
6137
6018
|
label: "Create",
|
|
6138
|
-
to: "create"
|
|
6019
|
+
to: "/store-credit-accounts/create"
|
|
6139
6020
|
}
|
|
6140
6021
|
]
|
|
6141
6022
|
}
|
|
@@ -6143,16 +6024,15 @@ function GiftCardsTable() {
|
|
|
6143
6024
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
6144
6025
|
] });
|
|
6145
6026
|
}
|
|
6146
|
-
const
|
|
6027
|
+
const StoreCreditAccountsPage = () => {
|
|
6147
6028
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6148
6029
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6149
6030
|
components.LayoutComposer,
|
|
6150
6031
|
{
|
|
6151
|
-
widgetsZonePrefix: "
|
|
6152
|
-
preferredLayoutId: "core:
|
|
6032
|
+
widgetsZonePrefix: "store_credit_account.list",
|
|
6033
|
+
preferredLayoutId: "core:single-column",
|
|
6153
6034
|
sections: {
|
|
6154
|
-
main: /* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "
|
|
6155
|
-
side: /* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "GiftCardProductsSection", children: /* @__PURE__ */ jsxRuntime.jsx(GiftCardProductsSection, {}) })
|
|
6035
|
+
main: /* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountsTable", children: /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountsTable, {}) })
|
|
6156
6036
|
}
|
|
6157
6037
|
}
|
|
6158
6038
|
),
|
|
@@ -6160,8 +6040,8 @@ const GiftCardsPage = () => {
|
|
|
6160
6040
|
] });
|
|
6161
6041
|
};
|
|
6162
6042
|
const config$3 = adminSdk.defineRouteConfig({
|
|
6163
|
-
label: "
|
|
6164
|
-
icon:
|
|
6043
|
+
label: "Store Credits",
|
|
6044
|
+
icon: StoreCreditIcon
|
|
6165
6045
|
});
|
|
6166
6046
|
function setRef$2(ref, value) {
|
|
6167
6047
|
if (typeof ref === "function") {
|
|
@@ -10856,27 +10736,6 @@ const StackedFocusModal = Object.assign(Root, {
|
|
|
10856
10736
|
Description,
|
|
10857
10737
|
Title
|
|
10858
10738
|
});
|
|
10859
|
-
const STORE_QUERY_KEY = "store";
|
|
10860
|
-
const storeQueryKeys = queryKeysFactory(STORE_QUERY_KEY);
|
|
10861
|
-
async function retrieveActiveStore(query) {
|
|
10862
|
-
const response = await sdk.admin.store.list(query);
|
|
10863
|
-
const activeStore = response.stores?.[0];
|
|
10864
|
-
if (!activeStore) {
|
|
10865
|
-
throw new Medusa.FetchError("No active store found", "Not Found", 404);
|
|
10866
|
-
}
|
|
10867
|
-
return { store: activeStore };
|
|
10868
|
-
}
|
|
10869
|
-
const useStore$2 = (query, options) => {
|
|
10870
|
-
const { data, ...rest } = reactQuery.useQuery({
|
|
10871
|
-
queryFn: () => retrieveActiveStore(query),
|
|
10872
|
-
queryKey: storeQueryKeys.details(),
|
|
10873
|
-
...options
|
|
10874
|
-
});
|
|
10875
|
-
return {
|
|
10876
|
-
...data,
|
|
10877
|
-
...rest
|
|
10878
|
-
};
|
|
10879
|
-
};
|
|
10880
10739
|
const t$1 = (r, t2, s2) => {
|
|
10881
10740
|
if (r && "reportValidity" in r) {
|
|
10882
10741
|
const o2 = get$2(s2, t2);
|
|
@@ -12776,7 +12635,7 @@ function useStoreProps(store, props, key2, setKey) {
|
|
|
12776
12635
|
});
|
|
12777
12636
|
});
|
|
12778
12637
|
}
|
|
12779
|
-
function useStore$
|
|
12638
|
+
function useStore$2(createStore2, props) {
|
|
12780
12639
|
const [store, setStore] = React__namespace.useState(() => createStore2(props));
|
|
12781
12640
|
useSafeLayoutEffect(() => init(store), [store]);
|
|
12782
12641
|
const useState2 = React__namespace.useCallback(
|
|
@@ -13598,7 +13457,7 @@ function useDisclosureStoreProps(store, update, props) {
|
|
|
13598
13457
|
return Object.assign(store, { disclosure: props.disclosure });
|
|
13599
13458
|
}
|
|
13600
13459
|
function useDisclosureStore(props = {}) {
|
|
13601
|
-
const [store, update] = useStore$
|
|
13460
|
+
const [store, update] = useStore$2(createDisclosureStore, props);
|
|
13602
13461
|
return useDisclosureStoreProps(store, update, props);
|
|
13603
13462
|
}
|
|
13604
13463
|
var ctx$2 = createStoreContext(
|
|
@@ -14987,7 +14846,7 @@ function useDialogStoreProps(store, update, props) {
|
|
|
14987
14846
|
return useDisclosureStoreProps(store, update, props);
|
|
14988
14847
|
}
|
|
14989
14848
|
function useDialogStore(props = {}) {
|
|
14990
|
-
const [store, update] = useStore$
|
|
14849
|
+
const [store, update] = useStore$2(createDialogStore, props);
|
|
14991
14850
|
return useDialogStoreProps(store, update, props);
|
|
14992
14851
|
}
|
|
14993
14852
|
var TagName$e = "div";
|
|
@@ -17033,7 +16892,7 @@ function useComboboxStoreProps(store, update, props) {
|
|
|
17033
16892
|
}
|
|
17034
16893
|
function useComboboxStore(props = {}) {
|
|
17035
16894
|
props = useComboboxStoreOptions(props);
|
|
17036
|
-
const [store, update] = useStore$
|
|
16895
|
+
const [store, update] = useStore$2(createComboboxStore, props);
|
|
17037
16896
|
return useComboboxStoreProps(store, update, props);
|
|
17038
16897
|
}
|
|
17039
16898
|
function ComboboxProvider(props = {}) {
|
|
@@ -18138,6 +17997,369 @@ const ComboboxImpl = ({
|
|
|
18138
17997
|
);
|
|
18139
17998
|
};
|
|
18140
17999
|
const Combobox = genericForwardRef(ComboboxImpl);
|
|
18000
|
+
var isObject_1;
|
|
18001
|
+
var hasRequiredIsObject;
|
|
18002
|
+
function requireIsObject() {
|
|
18003
|
+
if (hasRequiredIsObject) return isObject_1;
|
|
18004
|
+
hasRequiredIsObject = 1;
|
|
18005
|
+
function isObject2(value) {
|
|
18006
|
+
var type = typeof value;
|
|
18007
|
+
return value != null && (type == "object" || type == "function");
|
|
18008
|
+
}
|
|
18009
|
+
isObject_1 = isObject2;
|
|
18010
|
+
return isObject_1;
|
|
18011
|
+
}
|
|
18012
|
+
var _freeGlobal;
|
|
18013
|
+
var hasRequired_freeGlobal;
|
|
18014
|
+
function require_freeGlobal() {
|
|
18015
|
+
if (hasRequired_freeGlobal) return _freeGlobal;
|
|
18016
|
+
hasRequired_freeGlobal = 1;
|
|
18017
|
+
var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
18018
|
+
_freeGlobal = freeGlobal;
|
|
18019
|
+
return _freeGlobal;
|
|
18020
|
+
}
|
|
18021
|
+
var _root;
|
|
18022
|
+
var hasRequired_root;
|
|
18023
|
+
function require_root() {
|
|
18024
|
+
if (hasRequired_root) return _root;
|
|
18025
|
+
hasRequired_root = 1;
|
|
18026
|
+
var freeGlobal = require_freeGlobal();
|
|
18027
|
+
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
18028
|
+
var root = freeGlobal || freeSelf || Function("return this")();
|
|
18029
|
+
_root = root;
|
|
18030
|
+
return _root;
|
|
18031
|
+
}
|
|
18032
|
+
var now_1;
|
|
18033
|
+
var hasRequiredNow;
|
|
18034
|
+
function requireNow() {
|
|
18035
|
+
if (hasRequiredNow) return now_1;
|
|
18036
|
+
hasRequiredNow = 1;
|
|
18037
|
+
var root = require_root();
|
|
18038
|
+
var now = function() {
|
|
18039
|
+
return root.Date.now();
|
|
18040
|
+
};
|
|
18041
|
+
now_1 = now;
|
|
18042
|
+
return now_1;
|
|
18043
|
+
}
|
|
18044
|
+
var _trimmedEndIndex;
|
|
18045
|
+
var hasRequired_trimmedEndIndex;
|
|
18046
|
+
function require_trimmedEndIndex() {
|
|
18047
|
+
if (hasRequired_trimmedEndIndex) return _trimmedEndIndex;
|
|
18048
|
+
hasRequired_trimmedEndIndex = 1;
|
|
18049
|
+
var reWhitespace = /\s/;
|
|
18050
|
+
function trimmedEndIndex(string2) {
|
|
18051
|
+
var index = string2.length;
|
|
18052
|
+
while (index-- && reWhitespace.test(string2.charAt(index))) {
|
|
18053
|
+
}
|
|
18054
|
+
return index;
|
|
18055
|
+
}
|
|
18056
|
+
_trimmedEndIndex = trimmedEndIndex;
|
|
18057
|
+
return _trimmedEndIndex;
|
|
18058
|
+
}
|
|
18059
|
+
var _baseTrim;
|
|
18060
|
+
var hasRequired_baseTrim;
|
|
18061
|
+
function require_baseTrim() {
|
|
18062
|
+
if (hasRequired_baseTrim) return _baseTrim;
|
|
18063
|
+
hasRequired_baseTrim = 1;
|
|
18064
|
+
var trimmedEndIndex = require_trimmedEndIndex();
|
|
18065
|
+
var reTrimStart = /^\s+/;
|
|
18066
|
+
function baseTrim(string2) {
|
|
18067
|
+
return string2 ? string2.slice(0, trimmedEndIndex(string2) + 1).replace(reTrimStart, "") : string2;
|
|
18068
|
+
}
|
|
18069
|
+
_baseTrim = baseTrim;
|
|
18070
|
+
return _baseTrim;
|
|
18071
|
+
}
|
|
18072
|
+
var _Symbol;
|
|
18073
|
+
var hasRequired_Symbol;
|
|
18074
|
+
function require_Symbol() {
|
|
18075
|
+
if (hasRequired_Symbol) return _Symbol;
|
|
18076
|
+
hasRequired_Symbol = 1;
|
|
18077
|
+
var root = require_root();
|
|
18078
|
+
var Symbol2 = root.Symbol;
|
|
18079
|
+
_Symbol = Symbol2;
|
|
18080
|
+
return _Symbol;
|
|
18081
|
+
}
|
|
18082
|
+
var _getRawTag;
|
|
18083
|
+
var hasRequired_getRawTag;
|
|
18084
|
+
function require_getRawTag() {
|
|
18085
|
+
if (hasRequired_getRawTag) return _getRawTag;
|
|
18086
|
+
hasRequired_getRawTag = 1;
|
|
18087
|
+
var Symbol2 = require_Symbol();
|
|
18088
|
+
var objectProto = Object.prototype;
|
|
18089
|
+
var hasOwnProperty2 = objectProto.hasOwnProperty;
|
|
18090
|
+
var nativeObjectToString = objectProto.toString;
|
|
18091
|
+
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
|
|
18092
|
+
function getRawTag(value) {
|
|
18093
|
+
var isOwn = hasOwnProperty2.call(value, symToStringTag), tag = value[symToStringTag];
|
|
18094
|
+
try {
|
|
18095
|
+
value[symToStringTag] = void 0;
|
|
18096
|
+
var unmasked = true;
|
|
18097
|
+
} catch (e) {
|
|
18098
|
+
}
|
|
18099
|
+
var result = nativeObjectToString.call(value);
|
|
18100
|
+
if (unmasked) {
|
|
18101
|
+
if (isOwn) {
|
|
18102
|
+
value[symToStringTag] = tag;
|
|
18103
|
+
} else {
|
|
18104
|
+
delete value[symToStringTag];
|
|
18105
|
+
}
|
|
18106
|
+
}
|
|
18107
|
+
return result;
|
|
18108
|
+
}
|
|
18109
|
+
_getRawTag = getRawTag;
|
|
18110
|
+
return _getRawTag;
|
|
18111
|
+
}
|
|
18112
|
+
var _objectToString;
|
|
18113
|
+
var hasRequired_objectToString;
|
|
18114
|
+
function require_objectToString() {
|
|
18115
|
+
if (hasRequired_objectToString) return _objectToString;
|
|
18116
|
+
hasRequired_objectToString = 1;
|
|
18117
|
+
var objectProto = Object.prototype;
|
|
18118
|
+
var nativeObjectToString = objectProto.toString;
|
|
18119
|
+
function objectToString(value) {
|
|
18120
|
+
return nativeObjectToString.call(value);
|
|
18121
|
+
}
|
|
18122
|
+
_objectToString = objectToString;
|
|
18123
|
+
return _objectToString;
|
|
18124
|
+
}
|
|
18125
|
+
var _baseGetTag;
|
|
18126
|
+
var hasRequired_baseGetTag;
|
|
18127
|
+
function require_baseGetTag() {
|
|
18128
|
+
if (hasRequired_baseGetTag) return _baseGetTag;
|
|
18129
|
+
hasRequired_baseGetTag = 1;
|
|
18130
|
+
var Symbol2 = require_Symbol(), getRawTag = require_getRawTag(), objectToString = require_objectToString();
|
|
18131
|
+
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
|
|
18132
|
+
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
|
|
18133
|
+
function baseGetTag(value) {
|
|
18134
|
+
if (value == null) {
|
|
18135
|
+
return value === void 0 ? undefinedTag : nullTag;
|
|
18136
|
+
}
|
|
18137
|
+
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
18138
|
+
}
|
|
18139
|
+
_baseGetTag = baseGetTag;
|
|
18140
|
+
return _baseGetTag;
|
|
18141
|
+
}
|
|
18142
|
+
var isObjectLike_1;
|
|
18143
|
+
var hasRequiredIsObjectLike;
|
|
18144
|
+
function requireIsObjectLike() {
|
|
18145
|
+
if (hasRequiredIsObjectLike) return isObjectLike_1;
|
|
18146
|
+
hasRequiredIsObjectLike = 1;
|
|
18147
|
+
function isObjectLike(value) {
|
|
18148
|
+
return value != null && typeof value == "object";
|
|
18149
|
+
}
|
|
18150
|
+
isObjectLike_1 = isObjectLike;
|
|
18151
|
+
return isObjectLike_1;
|
|
18152
|
+
}
|
|
18153
|
+
var isSymbol_1;
|
|
18154
|
+
var hasRequiredIsSymbol;
|
|
18155
|
+
function requireIsSymbol() {
|
|
18156
|
+
if (hasRequiredIsSymbol) return isSymbol_1;
|
|
18157
|
+
hasRequiredIsSymbol = 1;
|
|
18158
|
+
var baseGetTag = require_baseGetTag(), isObjectLike = requireIsObjectLike();
|
|
18159
|
+
var symbolTag = "[object Symbol]";
|
|
18160
|
+
function isSymbol(value) {
|
|
18161
|
+
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
18162
|
+
}
|
|
18163
|
+
isSymbol_1 = isSymbol;
|
|
18164
|
+
return isSymbol_1;
|
|
18165
|
+
}
|
|
18166
|
+
var toNumber_1;
|
|
18167
|
+
var hasRequiredToNumber;
|
|
18168
|
+
function requireToNumber() {
|
|
18169
|
+
if (hasRequiredToNumber) return toNumber_1;
|
|
18170
|
+
hasRequiredToNumber = 1;
|
|
18171
|
+
var baseTrim = require_baseTrim(), isObject2 = requireIsObject(), isSymbol = requireIsSymbol();
|
|
18172
|
+
var NAN = 0 / 0;
|
|
18173
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
18174
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
18175
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
18176
|
+
var freeParseInt = parseInt;
|
|
18177
|
+
function toNumber(value) {
|
|
18178
|
+
if (typeof value == "number") {
|
|
18179
|
+
return value;
|
|
18180
|
+
}
|
|
18181
|
+
if (isSymbol(value)) {
|
|
18182
|
+
return NAN;
|
|
18183
|
+
}
|
|
18184
|
+
if (isObject2(value)) {
|
|
18185
|
+
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
18186
|
+
value = isObject2(other) ? other + "" : other;
|
|
18187
|
+
}
|
|
18188
|
+
if (typeof value != "string") {
|
|
18189
|
+
return value === 0 ? value : +value;
|
|
18190
|
+
}
|
|
18191
|
+
value = baseTrim(value);
|
|
18192
|
+
var isBinary = reIsBinary.test(value);
|
|
18193
|
+
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
18194
|
+
}
|
|
18195
|
+
toNumber_1 = toNumber;
|
|
18196
|
+
return toNumber_1;
|
|
18197
|
+
}
|
|
18198
|
+
var debounce_1;
|
|
18199
|
+
var hasRequiredDebounce;
|
|
18200
|
+
function requireDebounce() {
|
|
18201
|
+
if (hasRequiredDebounce) return debounce_1;
|
|
18202
|
+
hasRequiredDebounce = 1;
|
|
18203
|
+
var isObject2 = requireIsObject(), now = requireNow(), toNumber = requireToNumber();
|
|
18204
|
+
var FUNC_ERROR_TEXT = "Expected a function";
|
|
18205
|
+
var nativeMax = Math.max, nativeMin = Math.min;
|
|
18206
|
+
function debounce2(func, wait, options) {
|
|
18207
|
+
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
18208
|
+
if (typeof func != "function") {
|
|
18209
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
18210
|
+
}
|
|
18211
|
+
wait = toNumber(wait) || 0;
|
|
18212
|
+
if (isObject2(options)) {
|
|
18213
|
+
leading = !!options.leading;
|
|
18214
|
+
maxing = "maxWait" in options;
|
|
18215
|
+
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
18216
|
+
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
18217
|
+
}
|
|
18218
|
+
function invokeFunc(time2) {
|
|
18219
|
+
var args = lastArgs, thisArg = lastThis;
|
|
18220
|
+
lastArgs = lastThis = void 0;
|
|
18221
|
+
lastInvokeTime = time2;
|
|
18222
|
+
result = func.apply(thisArg, args);
|
|
18223
|
+
return result;
|
|
18224
|
+
}
|
|
18225
|
+
function leadingEdge(time2) {
|
|
18226
|
+
lastInvokeTime = time2;
|
|
18227
|
+
timerId = setTimeout(timerExpired, wait);
|
|
18228
|
+
return leading ? invokeFunc(time2) : result;
|
|
18229
|
+
}
|
|
18230
|
+
function remainingWait(time2) {
|
|
18231
|
+
var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
|
|
18232
|
+
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
|
|
18233
|
+
}
|
|
18234
|
+
function shouldInvoke(time2) {
|
|
18235
|
+
var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime;
|
|
18236
|
+
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
|
|
18237
|
+
}
|
|
18238
|
+
function timerExpired() {
|
|
18239
|
+
var time2 = now();
|
|
18240
|
+
if (shouldInvoke(time2)) {
|
|
18241
|
+
return trailingEdge(time2);
|
|
18242
|
+
}
|
|
18243
|
+
timerId = setTimeout(timerExpired, remainingWait(time2));
|
|
18244
|
+
}
|
|
18245
|
+
function trailingEdge(time2) {
|
|
18246
|
+
timerId = void 0;
|
|
18247
|
+
if (trailing && lastArgs) {
|
|
18248
|
+
return invokeFunc(time2);
|
|
18249
|
+
}
|
|
18250
|
+
lastArgs = lastThis = void 0;
|
|
18251
|
+
return result;
|
|
18252
|
+
}
|
|
18253
|
+
function cancel() {
|
|
18254
|
+
if (timerId !== void 0) {
|
|
18255
|
+
clearTimeout(timerId);
|
|
18256
|
+
}
|
|
18257
|
+
lastInvokeTime = 0;
|
|
18258
|
+
lastArgs = lastCallTime = lastThis = timerId = void 0;
|
|
18259
|
+
}
|
|
18260
|
+
function flush() {
|
|
18261
|
+
return timerId === void 0 ? result : trailingEdge(now());
|
|
18262
|
+
}
|
|
18263
|
+
function debounced() {
|
|
18264
|
+
var time2 = now(), isInvoking = shouldInvoke(time2);
|
|
18265
|
+
lastArgs = arguments;
|
|
18266
|
+
lastThis = this;
|
|
18267
|
+
lastCallTime = time2;
|
|
18268
|
+
if (isInvoking) {
|
|
18269
|
+
if (timerId === void 0) {
|
|
18270
|
+
return leadingEdge(lastCallTime);
|
|
18271
|
+
}
|
|
18272
|
+
if (maxing) {
|
|
18273
|
+
clearTimeout(timerId);
|
|
18274
|
+
timerId = setTimeout(timerExpired, wait);
|
|
18275
|
+
return invokeFunc(lastCallTime);
|
|
18276
|
+
}
|
|
18277
|
+
}
|
|
18278
|
+
if (timerId === void 0) {
|
|
18279
|
+
timerId = setTimeout(timerExpired, wait);
|
|
18280
|
+
}
|
|
18281
|
+
return result;
|
|
18282
|
+
}
|
|
18283
|
+
debounced.cancel = cancel;
|
|
18284
|
+
debounced.flush = flush;
|
|
18285
|
+
return debounced;
|
|
18286
|
+
}
|
|
18287
|
+
debounce_1 = debounce2;
|
|
18288
|
+
return debounce_1;
|
|
18289
|
+
}
|
|
18290
|
+
var debounceExports = requireDebounce();
|
|
18291
|
+
const debounce$1 = /* @__PURE__ */ getDefaultExportFromCjs(debounceExports);
|
|
18292
|
+
const useDebouncedSearch = () => {
|
|
18293
|
+
const [searchValue, onSearchValueChange] = React.useState("");
|
|
18294
|
+
const [debouncedQuery, setDebouncedQuery] = React.useState("");
|
|
18295
|
+
const debouncedUpdate = React.useCallback(
|
|
18296
|
+
debounce$1((query) => setDebouncedQuery(query), 300),
|
|
18297
|
+
[]
|
|
18298
|
+
);
|
|
18299
|
+
React.useEffect(() => {
|
|
18300
|
+
debouncedUpdate(searchValue);
|
|
18301
|
+
return () => debouncedUpdate.cancel();
|
|
18302
|
+
}, [searchValue, debouncedUpdate]);
|
|
18303
|
+
return {
|
|
18304
|
+
searchValue,
|
|
18305
|
+
onSearchValueChange,
|
|
18306
|
+
query: debouncedQuery || void 0
|
|
18307
|
+
};
|
|
18308
|
+
};
|
|
18309
|
+
const useComboboxData = ({
|
|
18310
|
+
queryKey,
|
|
18311
|
+
queryFn,
|
|
18312
|
+
getOptions,
|
|
18313
|
+
defaultValue: defaultValue2,
|
|
18314
|
+
defaultValueKey,
|
|
18315
|
+
pageSize = 10
|
|
18316
|
+
}) => {
|
|
18317
|
+
const { searchValue, onSearchValueChange, query } = useDebouncedSearch();
|
|
18318
|
+
const queryInitialDataBy = defaultValueKey || "id";
|
|
18319
|
+
const { data: initialData } = reactQuery.useQuery({
|
|
18320
|
+
queryKey,
|
|
18321
|
+
queryFn: async () => {
|
|
18322
|
+
return queryFn({
|
|
18323
|
+
[queryInitialDataBy]: defaultValue2,
|
|
18324
|
+
limit: Array.isArray(defaultValue2) ? defaultValue2.length : 1
|
|
18325
|
+
});
|
|
18326
|
+
},
|
|
18327
|
+
enabled: !!defaultValue2
|
|
18328
|
+
});
|
|
18329
|
+
const { data, ...rest } = reactQuery.useInfiniteQuery({
|
|
18330
|
+
queryKey: [...queryKey, query],
|
|
18331
|
+
queryFn: async ({ pageParam = 0 }) => {
|
|
18332
|
+
return await queryFn({
|
|
18333
|
+
q: query,
|
|
18334
|
+
limit: pageSize,
|
|
18335
|
+
offset: pageParam
|
|
18336
|
+
});
|
|
18337
|
+
},
|
|
18338
|
+
initialPageParam: 0,
|
|
18339
|
+
getNextPageParam: (lastPage) => {
|
|
18340
|
+
const moreItemsExist = lastPage.count > lastPage.offset + lastPage.limit;
|
|
18341
|
+
return moreItemsExist ? lastPage.offset + lastPage.limit : void 0;
|
|
18342
|
+
},
|
|
18343
|
+
placeholderData: reactQuery.keepPreviousData
|
|
18344
|
+
});
|
|
18345
|
+
const options = data?.pages.flatMap((page) => getOptions(page)) ?? [];
|
|
18346
|
+
const defaultOptions2 = initialData ? getOptions(initialData) : [];
|
|
18347
|
+
const disabled = !rest.isPending && !options.length && !searchValue;
|
|
18348
|
+
if (defaultValue2 && defaultOptions2.length && !searchValue) {
|
|
18349
|
+
defaultOptions2.forEach((option) => {
|
|
18350
|
+
if (!options.find((o2) => o2.value === option.value)) {
|
|
18351
|
+
options.unshift(option);
|
|
18352
|
+
}
|
|
18353
|
+
});
|
|
18354
|
+
}
|
|
18355
|
+
return {
|
|
18356
|
+
options,
|
|
18357
|
+
searchValue,
|
|
18358
|
+
onSearchValueChange,
|
|
18359
|
+
disabled,
|
|
18360
|
+
...rest
|
|
18361
|
+
};
|
|
18362
|
+
};
|
|
18141
18363
|
const currencies = {
|
|
18142
18364
|
USD: {
|
|
18143
18365
|
code: "USD",
|
|
@@ -18878,6 +19100,504 @@ const currencies = {
|
|
|
18878
19100
|
decimal_digits: 0
|
|
18879
19101
|
}
|
|
18880
19102
|
};
|
|
19103
|
+
const formSchema = zod.z.object({
|
|
19104
|
+
currency_code: zod.z.string().min(1, "Please select a currency"),
|
|
19105
|
+
customer_id: zod.z.string().optional()
|
|
19106
|
+
});
|
|
19107
|
+
const StoreCreditAccountCreateForm = () => {
|
|
19108
|
+
const { handleSuccess } = useRouteModal();
|
|
19109
|
+
const [searchParams] = reactRouterDom.useSearchParams();
|
|
19110
|
+
const prefilledCustomerId = searchParams.get("prefill_customer_id") ?? "";
|
|
19111
|
+
const form = useForm({
|
|
19112
|
+
defaultValues: {
|
|
19113
|
+
currency_code: "",
|
|
19114
|
+
customer_id: prefilledCustomerId
|
|
19115
|
+
},
|
|
19116
|
+
resolver: u(formSchema)
|
|
19117
|
+
});
|
|
19118
|
+
const { mutateAsync: createStoreCreditAccount, isPending } = useCreateStoreCreditAccount();
|
|
19119
|
+
const handleSubmit = form.handleSubmit(async (data) => {
|
|
19120
|
+
if (!data.customer_id) {
|
|
19121
|
+
delete data.customer_id;
|
|
19122
|
+
}
|
|
19123
|
+
await createStoreCreditAccount(data, {
|
|
19124
|
+
onSuccess: (data2) => {
|
|
19125
|
+
ui.toast.success(`Store credit account was successfully created.`);
|
|
19126
|
+
handleSuccess(`../${data2.store_credit_account.id}`);
|
|
19127
|
+
},
|
|
19128
|
+
onError: (error) => {
|
|
19129
|
+
ui.toast.error(error.message);
|
|
19130
|
+
}
|
|
19131
|
+
});
|
|
19132
|
+
});
|
|
19133
|
+
const [currencySearchValue, setCurrencySearchValue] = React.useState("");
|
|
19134
|
+
const currencyOptions = React.useMemo(() => {
|
|
19135
|
+
const options = Object.values(currencies).map((currency) => ({
|
|
19136
|
+
label: `${currency.code} - ${currency.name} (${currency.symbol_native})`,
|
|
19137
|
+
value: currency.code.toLowerCase()
|
|
19138
|
+
}));
|
|
19139
|
+
if (!currencySearchValue) {
|
|
19140
|
+
return options;
|
|
19141
|
+
}
|
|
19142
|
+
return options.filter(
|
|
19143
|
+
(option) => option.label.toLowerCase().includes(currencySearchValue.toLowerCase())
|
|
19144
|
+
);
|
|
19145
|
+
}, [currencySearchValue]);
|
|
19146
|
+
const {
|
|
19147
|
+
options: customerOptions,
|
|
19148
|
+
fetchNextPage,
|
|
19149
|
+
isFetchingNextPage,
|
|
19150
|
+
searchValue,
|
|
19151
|
+
onSearchValueChange,
|
|
19152
|
+
isLoading
|
|
19153
|
+
} = useComboboxData({
|
|
19154
|
+
queryKey: customersQueryKeys.list(),
|
|
19155
|
+
defaultValue: prefilledCustomerId || void 0,
|
|
19156
|
+
queryFn: async (params) => {
|
|
19157
|
+
return sdk.admin.customer.list(params);
|
|
19158
|
+
},
|
|
19159
|
+
getOptions: (data) => {
|
|
19160
|
+
return data.customers?.map((customer) => {
|
|
19161
|
+
const fullName = [customer.first_name, customer.last_name].filter(Boolean).join(" ");
|
|
19162
|
+
const label = fullName ? `${customer.email} (${fullName})` : customer.email;
|
|
19163
|
+
return {
|
|
19164
|
+
label,
|
|
19165
|
+
value: customer.id
|
|
19166
|
+
};
|
|
19167
|
+
}) || [];
|
|
19168
|
+
}
|
|
19169
|
+
});
|
|
19170
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteFocusModal.Form, { form, children: [
|
|
19171
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Header, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "-my-2 w-full border-l" }) }),
|
|
19172
|
+
/* @__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: [
|
|
19173
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
19174
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Create Store Credit Account" }),
|
|
19175
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-ui-fg-subtle", size: "small", children: "Create a new store credit account for a customer" })
|
|
19176
|
+
] }),
|
|
19177
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-x-4", children: [
|
|
19178
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19179
|
+
Form$2.Field,
|
|
19180
|
+
{
|
|
19181
|
+
control: form.control,
|
|
19182
|
+
name: "currency_code",
|
|
19183
|
+
render: ({ field }) => {
|
|
19184
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { className: "w-full", children: [
|
|
19185
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { className: "font-normal", children: "Currency" }),
|
|
19186
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
19187
|
+
Combobox,
|
|
19188
|
+
{
|
|
19189
|
+
value: field.value,
|
|
19190
|
+
onChange: field.onChange,
|
|
19191
|
+
searchValue: currencySearchValue,
|
|
19192
|
+
onSearchValueChange: setCurrencySearchValue,
|
|
19193
|
+
options: currencyOptions,
|
|
19194
|
+
placeholder: "Search for a currency..."
|
|
19195
|
+
}
|
|
19196
|
+
) }),
|
|
19197
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
19198
|
+
] });
|
|
19199
|
+
}
|
|
19200
|
+
}
|
|
19201
|
+
),
|
|
19202
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19203
|
+
Form$2.Field,
|
|
19204
|
+
{
|
|
19205
|
+
control: form.control,
|
|
19206
|
+
name: "customer_id",
|
|
19207
|
+
render: ({ field }) => {
|
|
19208
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { className: "w-full", children: [
|
|
19209
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { className: "font-normal", children: "Customer" }),
|
|
19210
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
19211
|
+
Combobox,
|
|
19212
|
+
{
|
|
19213
|
+
value: field.value,
|
|
19214
|
+
onChange: field.onChange,
|
|
19215
|
+
searchValue,
|
|
19216
|
+
onSearchValueChange,
|
|
19217
|
+
options: customerOptions,
|
|
19218
|
+
placeholder: "Search for a customer...",
|
|
19219
|
+
fetchNextPage,
|
|
19220
|
+
isFetchingNextPage,
|
|
19221
|
+
noResultsPlaceholder: isLoading ? "Loading customers..." : "No customers found"
|
|
19222
|
+
}
|
|
19223
|
+
) }),
|
|
19224
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
19225
|
+
] });
|
|
19226
|
+
}
|
|
19227
|
+
}
|
|
19228
|
+
)
|
|
19229
|
+
] })
|
|
19230
|
+
] }) }) }),
|
|
19231
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteFocusModal.Footer, { children: [
|
|
19232
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Close, { asChild: true, disabled: isPending, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", size: "small", disabled: isPending, children: "Cancel" }) }),
|
|
19233
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19234
|
+
ui.Button,
|
|
19235
|
+
{
|
|
19236
|
+
variant: "primary",
|
|
19237
|
+
size: "small",
|
|
19238
|
+
onClick: handleSubmit,
|
|
19239
|
+
disabled: isPending,
|
|
19240
|
+
children: "Create"
|
|
19241
|
+
}
|
|
19242
|
+
)
|
|
19243
|
+
] })
|
|
19244
|
+
] });
|
|
19245
|
+
};
|
|
19246
|
+
const StoreCreditAccountCreate = () => {
|
|
19247
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteFocusModal, { children: [
|
|
19248
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Create Store Credit Account" }) }),
|
|
19249
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Create a new store credit account" }) }),
|
|
19250
|
+
/* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountCreateForm, {})
|
|
19251
|
+
] });
|
|
19252
|
+
};
|
|
19253
|
+
const GiftCardIcon = (props) => {
|
|
19254
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19255
|
+
"svg",
|
|
19256
|
+
{
|
|
19257
|
+
width: "15",
|
|
19258
|
+
height: "15",
|
|
19259
|
+
viewBox: "0 0 15 15",
|
|
19260
|
+
fill: "none",
|
|
19261
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
19262
|
+
...props,
|
|
19263
|
+
children: [
|
|
19264
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { width: "15", height: "15", fill: "#F97316" }),
|
|
19265
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19266
|
+
"rect",
|
|
19267
|
+
{
|
|
19268
|
+
width: "15",
|
|
19269
|
+
height: "15",
|
|
19270
|
+
fill: "url(#paint0_linear_28788_25808)",
|
|
19271
|
+
fillOpacity: "0.2"
|
|
19272
|
+
}
|
|
19273
|
+
),
|
|
19274
|
+
/* @__PURE__ */ jsxRuntime.jsxs("g", { clipPath: "url(#clip0_28788_25808)", children: [
|
|
19275
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19276
|
+
"path",
|
|
19277
|
+
{
|
|
19278
|
+
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",
|
|
19279
|
+
fill: "white"
|
|
19280
|
+
}
|
|
19281
|
+
),
|
|
19282
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19283
|
+
"path",
|
|
19284
|
+
{
|
|
19285
|
+
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",
|
|
19286
|
+
fill: "white"
|
|
19287
|
+
}
|
|
19288
|
+
),
|
|
19289
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19290
|
+
"path",
|
|
19291
|
+
{
|
|
19292
|
+
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",
|
|
19293
|
+
fill: "white"
|
|
19294
|
+
}
|
|
19295
|
+
),
|
|
19296
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19297
|
+
"path",
|
|
19298
|
+
{
|
|
19299
|
+
d: "M6.938 7.5H3.75V9.563C3.75 10.7 4.675 11.625 5.813 11.625H6.938V7.5Z",
|
|
19300
|
+
fill: "white"
|
|
19301
|
+
}
|
|
19302
|
+
),
|
|
19303
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19304
|
+
"path",
|
|
19305
|
+
{
|
|
19306
|
+
d: "M8.063 7.5V11.625H9.188C10.325 11.625 11.25 10.7 11.25 9.563V7.5H8.063Z",
|
|
19307
|
+
fill: "white"
|
|
19308
|
+
}
|
|
19309
|
+
)
|
|
19310
|
+
] }),
|
|
19311
|
+
/* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
|
|
19312
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
19313
|
+
"linearGradient",
|
|
19314
|
+
{
|
|
19315
|
+
id: "paint0_linear_28788_25808",
|
|
19316
|
+
x1: "7.5",
|
|
19317
|
+
y1: "0",
|
|
19318
|
+
x2: "7.5",
|
|
19319
|
+
y2: "15",
|
|
19320
|
+
gradientUnits: "userSpaceOnUse",
|
|
19321
|
+
children: [
|
|
19322
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "white" }),
|
|
19323
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })
|
|
19324
|
+
]
|
|
19325
|
+
}
|
|
19326
|
+
),
|
|
19327
|
+
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_28788_25808", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "9", height: "9", fill: "white", transform: "translate(3 3)" }) })
|
|
19328
|
+
] })
|
|
19329
|
+
]
|
|
19330
|
+
}
|
|
19331
|
+
);
|
|
19332
|
+
};
|
|
19333
|
+
const GiftCardProductsSection = () => {
|
|
19334
|
+
const { products: giftCardProducts, count: count2 = 0 } = useProducts({
|
|
19335
|
+
is_giftcard: true
|
|
19336
|
+
});
|
|
19337
|
+
const slicedProducts = giftCardProducts?.slice(0, 3) ?? [];
|
|
19338
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0", children: [
|
|
19339
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
19340
|
+
/* @__PURE__ */ jsxRuntime.jsx(Header$5, { title: "Gift Card Products" }),
|
|
19341
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19342
|
+
reactRouterDom.Link,
|
|
19343
|
+
{
|
|
19344
|
+
to: `/gift-cards/gift-card-products/create`,
|
|
19345
|
+
className: "text-ui-fg-muted text-sm px-6",
|
|
19346
|
+
children: "Create"
|
|
19347
|
+
}
|
|
19348
|
+
)
|
|
19349
|
+
] }),
|
|
19350
|
+
giftCardProducts?.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
19351
|
+
NoRecords,
|
|
19352
|
+
{
|
|
19353
|
+
className: "px-10 py-4 h-[200px]",
|
|
19354
|
+
title: "No gift card products",
|
|
19355
|
+
message: "There are no gift card products to show. Create one to get started.",
|
|
19356
|
+
action: {
|
|
19357
|
+
to: "/gift-cards/gift-card-products/create",
|
|
19358
|
+
label: "Create gift card product"
|
|
19359
|
+
}
|
|
19360
|
+
}
|
|
19361
|
+
),
|
|
19362
|
+
slicedProducts.map((giftCardProduct) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
19363
|
+
SidebarLink,
|
|
19364
|
+
{
|
|
19365
|
+
to: `/gift-cards/gift-card-products/${giftCardProduct.id}`,
|
|
19366
|
+
labelKey: giftCardProduct.title,
|
|
19367
|
+
descriptionKey: giftCardProduct.title,
|
|
19368
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Tag, {})
|
|
19369
|
+
}
|
|
19370
|
+
)),
|
|
19371
|
+
count2 > 3 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
19372
|
+
reactRouterDom.Link,
|
|
19373
|
+
{
|
|
19374
|
+
to: "/gift-cards/gift-card-products",
|
|
19375
|
+
className: "text-ui-fg-muted text-sm px-6 py-4 flex items-center justify-center",
|
|
19376
|
+
children: "View more"
|
|
19377
|
+
}
|
|
19378
|
+
)
|
|
19379
|
+
] });
|
|
19380
|
+
};
|
|
19381
|
+
const _giftCardQueryKey = queryKeysFactory("gift-card");
|
|
19382
|
+
const giftCardQueryKey = {
|
|
19383
|
+
..._giftCardQueryKey,
|
|
19384
|
+
orders: (id) => [..._giftCardQueryKey.detail(id), "orders"]
|
|
19385
|
+
};
|
|
19386
|
+
const useGiftCards = (query, options) => {
|
|
19387
|
+
const fetchGiftCards = (query2, headers) => sdk.client.fetch(`/admin/gift-cards`, {
|
|
19388
|
+
query: query2,
|
|
19389
|
+
headers
|
|
19390
|
+
});
|
|
19391
|
+
const { data, ...rest } = reactQuery.useQuery({
|
|
19392
|
+
...options,
|
|
19393
|
+
queryFn: () => fetchGiftCards(query),
|
|
19394
|
+
queryKey: giftCardQueryKey.list(query)
|
|
19395
|
+
});
|
|
19396
|
+
return { ...data, ...rest };
|
|
19397
|
+
};
|
|
19398
|
+
const useGiftCard = (id, query, options) => {
|
|
19399
|
+
const fetchGiftCard = (id2, query2, headers) => sdk.client.fetch(`/admin/gift-cards/${id2}`, {
|
|
19400
|
+
query: query2,
|
|
19401
|
+
headers
|
|
19402
|
+
});
|
|
19403
|
+
const { data, ...rest } = reactQuery.useQuery({
|
|
19404
|
+
queryFn: () => fetchGiftCard(id, query),
|
|
19405
|
+
queryKey: giftCardQueryKey.detail(id, query),
|
|
19406
|
+
...options
|
|
19407
|
+
});
|
|
19408
|
+
return { ...data, ...rest };
|
|
19409
|
+
};
|
|
19410
|
+
const useGiftCardOrders = (id, options) => {
|
|
19411
|
+
const fetchGiftCardOrders = (id2, query, headers) => sdk.client.fetch(`/admin/gift-cards/${id2}/orders`, {
|
|
19412
|
+
query,
|
|
19413
|
+
headers
|
|
19414
|
+
});
|
|
19415
|
+
const { data, ...rest } = reactQuery.useQuery({
|
|
19416
|
+
queryFn: () => fetchGiftCardOrders(id),
|
|
19417
|
+
queryKey: giftCardQueryKey.orders(id),
|
|
19418
|
+
...options
|
|
19419
|
+
});
|
|
19420
|
+
return { ...data, ...rest };
|
|
19421
|
+
};
|
|
19422
|
+
const useUpdateGiftCard = (id, options) => {
|
|
19423
|
+
const queryClient = reactQuery.useQueryClient();
|
|
19424
|
+
const updateGiftCard = async (id2, body) => sdk.client.fetch(`/admin/gift-cards/${id2}`, {
|
|
19425
|
+
body,
|
|
19426
|
+
method: "POST"
|
|
19427
|
+
});
|
|
19428
|
+
return reactQuery.useMutation({
|
|
19429
|
+
mutationFn: async (payload) => updateGiftCard(id, payload),
|
|
19430
|
+
onSuccess: (data, variables, context) => {
|
|
19431
|
+
queryClient.invalidateQueries({
|
|
19432
|
+
queryKey: giftCardQueryKey.detail(id)
|
|
19433
|
+
});
|
|
19434
|
+
queryClient.invalidateQueries({
|
|
19435
|
+
queryKey: giftCardQueryKey.lists()
|
|
19436
|
+
});
|
|
19437
|
+
},
|
|
19438
|
+
...options
|
|
19439
|
+
});
|
|
19440
|
+
};
|
|
19441
|
+
const useCreateGiftCard = (options) => {
|
|
19442
|
+
const queryClient = reactQuery.useQueryClient();
|
|
19443
|
+
const createGiftCard = async (body) => sdk.client.fetch(`/admin/gift-cards`, {
|
|
19444
|
+
body,
|
|
19445
|
+
method: "POST"
|
|
19446
|
+
});
|
|
19447
|
+
return reactQuery.useMutation({
|
|
19448
|
+
mutationFn: (body) => createGiftCard(body),
|
|
19449
|
+
onSuccess: (data, variables, context) => {
|
|
19450
|
+
queryClient.invalidateQueries({ queryKey: giftCardQueryKey.lists() });
|
|
19451
|
+
},
|
|
19452
|
+
...options
|
|
19453
|
+
});
|
|
19454
|
+
};
|
|
19455
|
+
const columnHelper$9 = ui.createDataTableColumnHelper();
|
|
19456
|
+
const useGiftCardTableColumns = () => {
|
|
19457
|
+
return React.useMemo(() => {
|
|
19458
|
+
return [
|
|
19459
|
+
columnHelper$9.accessor("code", {
|
|
19460
|
+
header: "Code",
|
|
19461
|
+
cell: ({ row }) => {
|
|
19462
|
+
return row.original.code;
|
|
19463
|
+
}
|
|
19464
|
+
}),
|
|
19465
|
+
columnHelper$9.accessor("line_item.product.title", {
|
|
19466
|
+
header: "Product",
|
|
19467
|
+
cell: ({ row }) => {
|
|
19468
|
+
return row.original.line_item?.product?.title || "Custom Gift Card";
|
|
19469
|
+
}
|
|
19470
|
+
}),
|
|
19471
|
+
columnHelper$9.accessor("created_at", {
|
|
19472
|
+
header: "Date issued",
|
|
19473
|
+
cell: ({ row }) => getRelativeDate(row.original.created_at)
|
|
19474
|
+
}),
|
|
19475
|
+
columnHelper$9.accessor("value", {
|
|
19476
|
+
header: "Value",
|
|
19477
|
+
cell: ({ row }) => {
|
|
19478
|
+
return formatAmount(row.original.value, row.original.currency_code);
|
|
19479
|
+
}
|
|
19480
|
+
})
|
|
19481
|
+
];
|
|
19482
|
+
}, []);
|
|
19483
|
+
};
|
|
19484
|
+
const useGiftCardFilters = () => {
|
|
19485
|
+
const dateFilterOptions = useDataTableDateFilters$1();
|
|
19486
|
+
const customerFilterOptions = useCustomerFilters();
|
|
19487
|
+
return React.useMemo(() => {
|
|
19488
|
+
return [...dateFilterOptions, ...customerFilterOptions];
|
|
19489
|
+
}, [dateFilterOptions, customerFilterOptions]);
|
|
19490
|
+
};
|
|
19491
|
+
const useGiftCardTableQuery = ({
|
|
19492
|
+
prefix,
|
|
19493
|
+
pageSize = 20
|
|
19494
|
+
}) => {
|
|
19495
|
+
const queryObject = useQueryParams(
|
|
19496
|
+
["q", "offset", "customer_id", "created_at", "updated_at"],
|
|
19497
|
+
prefix
|
|
19498
|
+
);
|
|
19499
|
+
const { offset: offset2, created_at, updated_at, customer_id, ...rest } = queryObject;
|
|
19500
|
+
const searchParams = {
|
|
19501
|
+
limit: pageSize,
|
|
19502
|
+
offset: offset2 ? Number(offset2) : 0,
|
|
19503
|
+
created_at: created_at ? JSON.parse(created_at) : void 0,
|
|
19504
|
+
updated_at: updated_at ? JSON.parse(updated_at) : void 0,
|
|
19505
|
+
customer_id: customer_id ? JSON.parse(customer_id) : void 0,
|
|
19506
|
+
...rest
|
|
19507
|
+
};
|
|
19508
|
+
return searchParams;
|
|
19509
|
+
};
|
|
19510
|
+
const PAGE_SIZE$5 = 10;
|
|
19511
|
+
function GiftCardsTable() {
|
|
19512
|
+
const queryParams = useGiftCardTableQuery({
|
|
19513
|
+
pageSize: PAGE_SIZE$5
|
|
19514
|
+
});
|
|
19515
|
+
const {
|
|
19516
|
+
gift_cards: giftCards,
|
|
19517
|
+
isPending,
|
|
19518
|
+
count: count2
|
|
19519
|
+
} = useGiftCards({
|
|
19520
|
+
...queryParams,
|
|
19521
|
+
order: queryParams.order ?? "-created_at",
|
|
19522
|
+
fields: "+line_item.product.title"
|
|
19523
|
+
});
|
|
19524
|
+
const columns = useGiftCardTableColumns();
|
|
19525
|
+
const filters = useGiftCardFilters();
|
|
19526
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
19527
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
19528
|
+
DataTable,
|
|
19529
|
+
{
|
|
19530
|
+
data: giftCards,
|
|
19531
|
+
getRowId: (row) => row.id,
|
|
19532
|
+
columns,
|
|
19533
|
+
filters,
|
|
19534
|
+
isLoading: isPending,
|
|
19535
|
+
pageSize: PAGE_SIZE$5,
|
|
19536
|
+
rowCount: count2,
|
|
19537
|
+
heading: "Gift Cards",
|
|
19538
|
+
rowHref: (row) => `${row.id}`,
|
|
19539
|
+
emptyState: {
|
|
19540
|
+
empty: {
|
|
19541
|
+
heading: "No gift cards found",
|
|
19542
|
+
description: "Create a gift card to get started."
|
|
19543
|
+
},
|
|
19544
|
+
filtered: {
|
|
19545
|
+
heading: "No results found",
|
|
19546
|
+
description: "No gift cards match your filter criteria."
|
|
19547
|
+
}
|
|
19548
|
+
},
|
|
19549
|
+
actions: [
|
|
19550
|
+
{
|
|
19551
|
+
label: "Create",
|
|
19552
|
+
to: "create"
|
|
19553
|
+
}
|
|
19554
|
+
]
|
|
19555
|
+
}
|
|
19556
|
+
) }),
|
|
19557
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
19558
|
+
] });
|
|
19559
|
+
}
|
|
19560
|
+
const GiftCardsPage = () => {
|
|
19561
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
19562
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19563
|
+
components.LayoutComposer,
|
|
19564
|
+
{
|
|
19565
|
+
widgetsZonePrefix: "gift_card.list",
|
|
19566
|
+
preferredLayoutId: "core:two-column",
|
|
19567
|
+
sections: {
|
|
19568
|
+
main: /* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "GiftCardsTable", children: /* @__PURE__ */ jsxRuntime.jsx(GiftCardsTable, {}) }),
|
|
19569
|
+
side: /* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "GiftCardProductsSection", children: /* @__PURE__ */ jsxRuntime.jsx(GiftCardProductsSection, {}) })
|
|
19570
|
+
}
|
|
19571
|
+
}
|
|
19572
|
+
),
|
|
19573
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Toaster, {})
|
|
19574
|
+
] });
|
|
19575
|
+
};
|
|
19576
|
+
const config$2 = adminSdk.defineRouteConfig({
|
|
19577
|
+
label: "Gift Cards",
|
|
19578
|
+
icon: GiftCardIcon
|
|
19579
|
+
});
|
|
19580
|
+
const STORE_QUERY_KEY = "store";
|
|
19581
|
+
const storeQueryKeys = queryKeysFactory(STORE_QUERY_KEY);
|
|
19582
|
+
async function retrieveActiveStore(query) {
|
|
19583
|
+
const response = await sdk.admin.store.list(query);
|
|
19584
|
+
const activeStore = response.stores?.[0];
|
|
19585
|
+
if (!activeStore) {
|
|
19586
|
+
throw new Medusa.FetchError("No active store found", "Not Found", 404);
|
|
19587
|
+
}
|
|
19588
|
+
return { store: activeStore };
|
|
19589
|
+
}
|
|
19590
|
+
const useStore$1 = (query, options) => {
|
|
19591
|
+
const { data, ...rest } = reactQuery.useQuery({
|
|
19592
|
+
queryFn: () => retrieveActiveStore(query),
|
|
19593
|
+
queryKey: storeQueryKeys.details(),
|
|
19594
|
+
...options
|
|
19595
|
+
});
|
|
19596
|
+
return {
|
|
19597
|
+
...data,
|
|
19598
|
+
...rest
|
|
19599
|
+
};
|
|
19600
|
+
};
|
|
18881
19601
|
function $constructor(name, initializer2, params) {
|
|
18882
19602
|
function init2(inst, def) {
|
|
18883
19603
|
if (!inst._zod) {
|
|
@@ -18941,7 +19661,7 @@ class $ZodEncodeError extends Error {
|
|
|
18941
19661
|
}
|
|
18942
19662
|
}
|
|
18943
19663
|
const globalConfig = {};
|
|
18944
|
-
function config$
|
|
19664
|
+
function config$1(newConfig) {
|
|
18945
19665
|
return globalConfig;
|
|
18946
19666
|
}
|
|
18947
19667
|
function getEnumValues(entries) {
|
|
@@ -19388,7 +20108,7 @@ const _parse = (_Err) => (schema2, value, _ctx, _params) => {
|
|
|
19388
20108
|
throw new $ZodAsyncError();
|
|
19389
20109
|
}
|
|
19390
20110
|
if (result.issues.length) {
|
|
19391
|
-
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
20111
|
+
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx2, config$1())));
|
|
19392
20112
|
captureStackTrace(e, _params?.callee);
|
|
19393
20113
|
throw e;
|
|
19394
20114
|
}
|
|
@@ -19400,7 +20120,7 @@ const _parseAsync = (_Err) => async (schema2, value, _ctx, params) => {
|
|
|
19400
20120
|
if (result instanceof Promise)
|
|
19401
20121
|
result = await result;
|
|
19402
20122
|
if (result.issues.length) {
|
|
19403
|
-
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
20123
|
+
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx2, config$1())));
|
|
19404
20124
|
captureStackTrace(e, params?.callee);
|
|
19405
20125
|
throw e;
|
|
19406
20126
|
}
|
|
@@ -19414,7 +20134,7 @@ const _safeParse = (_Err) => (schema2, value, _ctx) => {
|
|
|
19414
20134
|
}
|
|
19415
20135
|
return result.issues.length ? {
|
|
19416
20136
|
success: false,
|
|
19417
|
-
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
20137
|
+
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx2, config$1())))
|
|
19418
20138
|
} : { success: true, data: result.value };
|
|
19419
20139
|
};
|
|
19420
20140
|
const safeParse$1 = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
@@ -19425,7 +20145,7 @@ const _safeParseAsync = (_Err) => async (schema2, value, _ctx) => {
|
|
|
19425
20145
|
result = await result;
|
|
19426
20146
|
return result.issues.length ? {
|
|
19427
20147
|
success: false,
|
|
19428
|
-
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
20148
|
+
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx2, config$1())))
|
|
19429
20149
|
} : { success: true, data: result.value };
|
|
19430
20150
|
};
|
|
19431
20151
|
const safeParseAsync$1 = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
@@ -20681,7 +21401,7 @@ function handleUnionResults(results, final, inst, ctx2) {
|
|
|
20681
21401
|
code: "invalid_union",
|
|
20682
21402
|
input: final.value,
|
|
20683
21403
|
inst,
|
|
20684
|
-
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
21404
|
+
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx2, config$1())))
|
|
20685
21405
|
});
|
|
20686
21406
|
return final;
|
|
20687
21407
|
}
|
|
@@ -20874,7 +21594,7 @@ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
20874
21594
|
payload.issues.push({
|
|
20875
21595
|
code: "invalid_key",
|
|
20876
21596
|
origin: "record",
|
|
20877
|
-
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
21597
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx2, config$1())),
|
|
20878
21598
|
input: key2,
|
|
20879
21599
|
path: [key2],
|
|
20880
21600
|
inst
|
|
@@ -21073,7 +21793,7 @@ const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
|
21073
21793
|
payload.value = def.catchValue({
|
|
21074
21794
|
...payload,
|
|
21075
21795
|
error: {
|
|
21076
|
-
issues: result2.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
21796
|
+
issues: result2.issues.map((iss) => finalizeIssue(iss, ctx2, config$1()))
|
|
21077
21797
|
},
|
|
21078
21798
|
input: payload.value
|
|
21079
21799
|
});
|
|
@@ -21087,7 +21807,7 @@ const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
|
21087
21807
|
payload.value = def.catchValue({
|
|
21088
21808
|
...payload,
|
|
21089
21809
|
error: {
|
|
21090
|
-
issues: result.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
21810
|
+
issues: result.issues.map((iss) => finalizeIssue(iss, ctx2, config$1()))
|
|
21091
21811
|
},
|
|
21092
21812
|
input: payload.value
|
|
21093
21813
|
});
|
|
@@ -23135,733 +23855,686 @@ const GiftCardCreateForm = ({
|
|
|
23135
23855
|
] });
|
|
23136
23856
|
};
|
|
23137
23857
|
const GiftCardCreate = () => {
|
|
23138
|
-
const { store, isLoading } = useStore$
|
|
23858
|
+
const { store, isLoading } = useStore$1({});
|
|
23139
23859
|
return /* @__PURE__ */ jsxRuntime.jsxs(RouteFocusModal, { children: [
|
|
23140
23860
|
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Create Gift Card" }) }),
|
|
23141
23861
|
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Create a new gift card" }) }),
|
|
23142
23862
|
!isLoading && /* @__PURE__ */ jsxRuntime.jsx(GiftCardCreateForm, { store })
|
|
23143
23863
|
] });
|
|
23144
23864
|
};
|
|
23145
|
-
const
|
|
23146
|
-
|
|
23147
|
-
|
|
23148
|
-
|
|
23149
|
-
|
|
23150
|
-
|
|
23151
|
-
|
|
23152
|
-
|
|
23153
|
-
|
|
23154
|
-
|
|
23155
|
-
|
|
23156
|
-
|
|
23157
|
-
|
|
23158
|
-
"
|
|
23159
|
-
|
|
23160
|
-
|
|
23161
|
-
|
|
23162
|
-
|
|
23163
|
-
|
|
23164
|
-
|
|
23165
|
-
|
|
23166
|
-
|
|
23167
|
-
|
|
23168
|
-
|
|
23169
|
-
|
|
23170
|
-
|
|
23171
|
-
|
|
23172
|
-
|
|
23173
|
-
|
|
23174
|
-
|
|
23175
|
-
|
|
23176
|
-
|
|
23177
|
-
|
|
23865
|
+
const StoreCreditAccountBalanceSection = ({
|
|
23866
|
+
storeCreditAccount
|
|
23867
|
+
}) => {
|
|
23868
|
+
if (!storeCreditAccount || typeof storeCreditAccount.balance === "undefined") {
|
|
23869
|
+
return;
|
|
23870
|
+
}
|
|
23871
|
+
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: [
|
|
23872
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-ui-tag-green-icon h-8 w-1 rounded-full" }),
|
|
23873
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
23874
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", size: "small", className: "text-ui-fg-subtle", children: "Current Balance" }),
|
|
23875
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
23876
|
+
ui.Text,
|
|
23877
|
+
{
|
|
23878
|
+
weight: "plus",
|
|
23879
|
+
size: "xlarge",
|
|
23880
|
+
className: "tabular-nums text-ui-fg-base",
|
|
23881
|
+
children: formatAmount(
|
|
23882
|
+
storeCreditAccount.balance,
|
|
23883
|
+
storeCreditAccount.currency_code
|
|
23884
|
+
)
|
|
23885
|
+
}
|
|
23886
|
+
)
|
|
23887
|
+
] })
|
|
23888
|
+
] }) });
|
|
23889
|
+
};
|
|
23890
|
+
var toggleSelection;
|
|
23891
|
+
var hasRequiredToggleSelection;
|
|
23892
|
+
function requireToggleSelection() {
|
|
23893
|
+
if (hasRequiredToggleSelection) return toggleSelection;
|
|
23894
|
+
hasRequiredToggleSelection = 1;
|
|
23895
|
+
toggleSelection = function() {
|
|
23896
|
+
var selection = document.getSelection();
|
|
23897
|
+
if (!selection.rangeCount) {
|
|
23898
|
+
return function() {
|
|
23899
|
+
};
|
|
23900
|
+
}
|
|
23901
|
+
var active = document.activeElement;
|
|
23902
|
+
var ranges = [];
|
|
23903
|
+
for (var i2 = 0; i2 < selection.rangeCount; i2++) {
|
|
23904
|
+
ranges.push(selection.getRangeAt(i2));
|
|
23905
|
+
}
|
|
23906
|
+
switch (active.tagName.toUpperCase()) {
|
|
23907
|
+
// .toUpperCase handles XHTML
|
|
23908
|
+
case "INPUT":
|
|
23909
|
+
case "TEXTAREA":
|
|
23910
|
+
active.blur();
|
|
23911
|
+
break;
|
|
23912
|
+
default:
|
|
23913
|
+
active = null;
|
|
23914
|
+
break;
|
|
23915
|
+
}
|
|
23916
|
+
selection.removeAllRanges();
|
|
23917
|
+
return function() {
|
|
23918
|
+
selection.type === "Caret" && selection.removeAllRanges();
|
|
23919
|
+
if (!selection.rangeCount) {
|
|
23920
|
+
ranges.forEach(function(range) {
|
|
23921
|
+
selection.addRange(range);
|
|
23922
|
+
});
|
|
23923
|
+
}
|
|
23924
|
+
active && active.focus();
|
|
23925
|
+
};
|
|
23926
|
+
};
|
|
23927
|
+
return toggleSelection;
|
|
23928
|
+
}
|
|
23929
|
+
var copyToClipboard;
|
|
23930
|
+
var hasRequiredCopyToClipboard;
|
|
23931
|
+
function requireCopyToClipboard() {
|
|
23932
|
+
if (hasRequiredCopyToClipboard) return copyToClipboard;
|
|
23933
|
+
hasRequiredCopyToClipboard = 1;
|
|
23934
|
+
var deselectCurrent = requireToggleSelection();
|
|
23935
|
+
var clipboardToIE11Formatting = {
|
|
23936
|
+
"text/plain": "Text",
|
|
23937
|
+
"text/html": "Url",
|
|
23938
|
+
"default": "Text"
|
|
23939
|
+
};
|
|
23940
|
+
var defaultMessage = "Copy to clipboard: #{key}, Enter";
|
|
23941
|
+
function format2(message2) {
|
|
23942
|
+
var copyKey = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C";
|
|
23943
|
+
return message2.replace(/#{\s*key\s*}/g, copyKey);
|
|
23944
|
+
}
|
|
23945
|
+
function copy2(text2, options) {
|
|
23946
|
+
var debug2, message2, reselectPrevious, range, selection, mark, success = false;
|
|
23947
|
+
if (!options) {
|
|
23948
|
+
options = {};
|
|
23949
|
+
}
|
|
23950
|
+
debug2 = options.debug || false;
|
|
23951
|
+
try {
|
|
23952
|
+
reselectPrevious = deselectCurrent();
|
|
23953
|
+
range = document.createRange();
|
|
23954
|
+
selection = document.getSelection();
|
|
23955
|
+
mark = document.createElement("span");
|
|
23956
|
+
mark.textContent = text2;
|
|
23957
|
+
mark.ariaHidden = "true";
|
|
23958
|
+
mark.style.all = "unset";
|
|
23959
|
+
mark.style.position = "fixed";
|
|
23960
|
+
mark.style.top = 0;
|
|
23961
|
+
mark.style.clip = "rect(0, 0, 0, 0)";
|
|
23962
|
+
mark.style.whiteSpace = "pre";
|
|
23963
|
+
mark.style.webkitUserSelect = "text";
|
|
23964
|
+
mark.style.MozUserSelect = "text";
|
|
23965
|
+
mark.style.msUserSelect = "text";
|
|
23966
|
+
mark.style.userSelect = "text";
|
|
23967
|
+
mark.addEventListener("copy", function(e) {
|
|
23968
|
+
e.stopPropagation();
|
|
23969
|
+
if (options.format) {
|
|
23970
|
+
e.preventDefault();
|
|
23971
|
+
if (typeof e.clipboardData === "undefined") {
|
|
23972
|
+
debug2 && console.warn("unable to use e.clipboardData");
|
|
23973
|
+
debug2 && console.warn("trying IE specific stuff");
|
|
23974
|
+
window.clipboardData.clearData();
|
|
23975
|
+
var format3 = clipboardToIE11Formatting[options.format] || clipboardToIE11Formatting["default"];
|
|
23976
|
+
window.clipboardData.setData(format3, text2);
|
|
23977
|
+
} else {
|
|
23978
|
+
e.clipboardData.clearData();
|
|
23979
|
+
e.clipboardData.setData(options.format, text2);
|
|
23178
23980
|
}
|
|
23179
|
-
|
|
23180
|
-
|
|
23181
|
-
|
|
23981
|
+
}
|
|
23982
|
+
if (options.onCopy) {
|
|
23983
|
+
e.preventDefault();
|
|
23984
|
+
options.onCopy(e.clipboardData);
|
|
23985
|
+
}
|
|
23986
|
+
});
|
|
23987
|
+
document.body.appendChild(mark);
|
|
23988
|
+
range.selectNodeContents(mark);
|
|
23989
|
+
selection.addRange(range);
|
|
23990
|
+
var successful = document.execCommand("copy");
|
|
23991
|
+
if (!successful) {
|
|
23992
|
+
throw new Error("copy command was unsuccessful");
|
|
23993
|
+
}
|
|
23994
|
+
success = true;
|
|
23995
|
+
} catch (err) {
|
|
23996
|
+
debug2 && console.error("unable to copy using execCommand: ", err);
|
|
23997
|
+
debug2 && console.warn("trying IE specific stuff");
|
|
23998
|
+
try {
|
|
23999
|
+
window.clipboardData.setData(options.format || "text", text2);
|
|
24000
|
+
options.onCopy && options.onCopy(window.clipboardData);
|
|
24001
|
+
success = true;
|
|
24002
|
+
} catch (err2) {
|
|
24003
|
+
debug2 && console.error("unable to copy using clipboardData: ", err2);
|
|
24004
|
+
debug2 && console.error("falling back to prompt");
|
|
24005
|
+
message2 = format2("message" in options ? options.message : defaultMessage);
|
|
24006
|
+
window.prompt(message2, text2);
|
|
24007
|
+
}
|
|
24008
|
+
} finally {
|
|
24009
|
+
if (selection) {
|
|
24010
|
+
if (typeof selection.removeRange == "function") {
|
|
24011
|
+
selection.removeRange(range);
|
|
24012
|
+
} else {
|
|
24013
|
+
selection.removeAllRanges();
|
|
24014
|
+
}
|
|
24015
|
+
}
|
|
24016
|
+
if (mark) {
|
|
24017
|
+
document.body.removeChild(mark);
|
|
24018
|
+
}
|
|
24019
|
+
reselectPrevious();
|
|
24020
|
+
}
|
|
24021
|
+
return success;
|
|
24022
|
+
}
|
|
24023
|
+
copyToClipboard = copy2;
|
|
24024
|
+
return copyToClipboard;
|
|
24025
|
+
}
|
|
24026
|
+
var copyToClipboardExports = requireCopyToClipboard();
|
|
24027
|
+
const copy$1 = /* @__PURE__ */ getDefaultExportFromCjs(copyToClipboardExports);
|
|
24028
|
+
function DisplayId({ id, className }) {
|
|
24029
|
+
const [open, setOpen] = React.useState(false);
|
|
24030
|
+
const onClick = () => {
|
|
24031
|
+
copy$1(id);
|
|
24032
|
+
ui.toast.success("Copied to clipboard");
|
|
24033
|
+
};
|
|
24034
|
+
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: [
|
|
24035
|
+
"#",
|
|
24036
|
+
id.slice(-7)
|
|
24037
|
+
] }) });
|
|
24038
|
+
}
|
|
24039
|
+
const StoreCreditAccountDetailsSection = ({
|
|
24040
|
+
storeCreditAccount
|
|
24041
|
+
}) => {
|
|
24042
|
+
if (!storeCreditAccount || typeof storeCreditAccount.balance === "undefined") {
|
|
24043
|
+
return;
|
|
24044
|
+
}
|
|
24045
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "flex justify-between gap-x-2 px-6 py-6", children: [
|
|
24046
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
24047
|
+
ui.Text,
|
|
24048
|
+
{
|
|
24049
|
+
weight: "plus",
|
|
24050
|
+
size: "xlarge",
|
|
24051
|
+
className: "text-ui-fg-base flex gap-x-4",
|
|
24052
|
+
children: [
|
|
24053
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
24054
|
+
/* @__PURE__ */ jsxRuntime.jsx(CreditCardIcon, { className: "inline" }),
|
|
24055
|
+
" "
|
|
24056
|
+
] }),
|
|
24057
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
24058
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-ui-fg-subtle", children: [
|
|
24059
|
+
storeCreditAccount.currency_code.toUpperCase(),
|
|
24060
|
+
" Account"
|
|
24061
|
+
] }),
|
|
24062
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-base", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
24063
|
+
ui.Text,
|
|
24064
|
+
{
|
|
24065
|
+
weight: "regular",
|
|
24066
|
+
size: "small",
|
|
24067
|
+
className: "text-ui-fg-base flex gap-x-4",
|
|
24068
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(DisplayId, { id: storeCreditAccount.id })
|
|
24069
|
+
}
|
|
24070
|
+
) })
|
|
24071
|
+
] })
|
|
24072
|
+
]
|
|
24073
|
+
}
|
|
24074
|
+
),
|
|
24075
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-x-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
24076
|
+
ActionMenu,
|
|
24077
|
+
{
|
|
24078
|
+
groups: [
|
|
23182
24079
|
{
|
|
23183
|
-
|
|
23184
|
-
|
|
23185
|
-
|
|
23186
|
-
|
|
23187
|
-
|
|
23188
|
-
|
|
23189
|
-
|
|
23190
|
-
|
|
23191
|
-
|
|
24080
|
+
actions: [
|
|
24081
|
+
{
|
|
24082
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CreditCard, {}),
|
|
24083
|
+
label: "Credit the account",
|
|
24084
|
+
to: "credit"
|
|
24085
|
+
},
|
|
24086
|
+
{
|
|
24087
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.MinusMini, {}),
|
|
24088
|
+
label: "Debit the account",
|
|
24089
|
+
to: "debit",
|
|
24090
|
+
disabled: !Number(storeCreditAccount.balance)
|
|
24091
|
+
}
|
|
23192
24092
|
]
|
|
23193
24093
|
}
|
|
23194
|
-
|
|
23195
|
-
|
|
23196
|
-
}
|
|
23197
|
-
);
|
|
24094
|
+
]
|
|
24095
|
+
}
|
|
24096
|
+
) })
|
|
24097
|
+
] });
|
|
23198
24098
|
};
|
|
23199
|
-
|
|
23200
|
-
|
|
24099
|
+
function StoreCreditAccountCustomerSection({
|
|
24100
|
+
customerId
|
|
24101
|
+
}) {
|
|
24102
|
+
const { customer, isPending } = useCustomer(customerId, void 0, {
|
|
24103
|
+
enabled: !!customerId
|
|
24104
|
+
});
|
|
24105
|
+
if (isPending || !customer) {
|
|
24106
|
+
return null;
|
|
24107
|
+
}
|
|
24108
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0", children: [
|
|
24109
|
+
/* @__PURE__ */ jsxRuntime.jsx(Header$5, { title: "Customer" }),
|
|
24110
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24111
|
+
SidebarLink,
|
|
24112
|
+
{
|
|
24113
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.User, {}),
|
|
24114
|
+
labelKey: customer.email || "N/A",
|
|
24115
|
+
descriptionKey: !customer.first_name && !customer.last_name ? "N/A" : `${customer.first_name} ${customer.last_name}`,
|
|
24116
|
+
to: `/customers/${customer.id}`
|
|
24117
|
+
},
|
|
24118
|
+
customer.id
|
|
24119
|
+
)
|
|
24120
|
+
] });
|
|
24121
|
+
}
|
|
24122
|
+
const columnHelper$8 = ui.createDataTableColumnHelper();
|
|
24123
|
+
const useTransactionsTableColumns = () => {
|
|
23201
24124
|
return React.useMemo(() => {
|
|
23202
24125
|
return [
|
|
23203
|
-
columnHelper$
|
|
23204
|
-
header: "
|
|
24126
|
+
columnHelper$8.accessor("id", {
|
|
24127
|
+
header: "ID",
|
|
23205
24128
|
cell: ({ row }) => {
|
|
23206
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
24129
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DisplayId, { id: row.original.id });
|
|
23207
24130
|
}
|
|
23208
24131
|
}),
|
|
23209
|
-
columnHelper$
|
|
23210
|
-
header: "
|
|
23211
|
-
cell: ({ row }) =>
|
|
23212
|
-
return row.original.customer?.email ?? "N/A";
|
|
23213
|
-
}
|
|
24132
|
+
columnHelper$8.accessor("created_at", {
|
|
24133
|
+
header: "Created At",
|
|
24134
|
+
cell: ({ row }) => formatDate(row.original.created_at, false)
|
|
23214
24135
|
}),
|
|
23215
|
-
columnHelper$
|
|
23216
|
-
header: "
|
|
23217
|
-
cell: ({ row }) =>
|
|
23218
|
-
return formatAmount(
|
|
23219
|
-
row.original.balance,
|
|
23220
|
-
row.original.currency_code
|
|
23221
|
-
);
|
|
23222
|
-
}
|
|
24136
|
+
columnHelper$8.accessor("note", {
|
|
24137
|
+
header: "Description",
|
|
24138
|
+
cell: ({ row }) => row.original.note
|
|
23223
24139
|
}),
|
|
23224
|
-
columnHelper$
|
|
23225
|
-
header: "
|
|
24140
|
+
columnHelper$8.accessor("note", {
|
|
24141
|
+
header: "Note",
|
|
23226
24142
|
cell: ({ row }) => {
|
|
23227
|
-
return
|
|
23228
|
-
row.original.credits,
|
|
23229
|
-
row.original.currency_code
|
|
23230
|
-
);
|
|
24143
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { title: row.original.note, className: "max-w-[300px] truncate", children: row.original.note || "-" });
|
|
23231
24144
|
}
|
|
23232
24145
|
}),
|
|
23233
|
-
columnHelper$
|
|
23234
|
-
header: "
|
|
24146
|
+
columnHelper$8.accessor("amount", {
|
|
24147
|
+
header: "Amount",
|
|
23235
24148
|
cell: ({ row }) => {
|
|
23236
|
-
|
|
23237
|
-
|
|
23238
|
-
row.original.
|
|
24149
|
+
const isDebit = row.original.type === "debit";
|
|
24150
|
+
return row.original.account.currency_code && formatAmount(
|
|
24151
|
+
row.original.amount * (isDebit ? -1 : 1),
|
|
24152
|
+
row.original.account.currency_code
|
|
23239
24153
|
);
|
|
23240
24154
|
}
|
|
23241
|
-
}),
|
|
23242
|
-
columnHelper$9.accessor("created_at", {
|
|
23243
|
-
header: "Created at",
|
|
23244
|
-
cell: ({ row }) => getRelativeDate(row.original.created_at)
|
|
23245
24155
|
})
|
|
23246
24156
|
];
|
|
23247
24157
|
}, []);
|
|
23248
24158
|
};
|
|
23249
|
-
const
|
|
24159
|
+
const useTransactionsTableFilters = ({}) => {
|
|
23250
24160
|
const dateFilterOptions = useDataTableDateFilters$1();
|
|
23251
|
-
const customerFilterOptions = useCustomerFilters();
|
|
23252
24161
|
return React.useMemo(() => {
|
|
23253
|
-
return [...dateFilterOptions
|
|
23254
|
-
}, [dateFilterOptions
|
|
24162
|
+
return [...dateFilterOptions];
|
|
24163
|
+
}, [dateFilterOptions]);
|
|
23255
24164
|
};
|
|
23256
|
-
const
|
|
24165
|
+
const useTransactionsTableQuery = ({
|
|
23257
24166
|
prefix,
|
|
23258
24167
|
pageSize = 20
|
|
23259
24168
|
}) => {
|
|
23260
24169
|
const queryObject = useQueryParams(
|
|
23261
|
-
["offset", "
|
|
24170
|
+
["offset", "limit", "currency_code", "created_at", "updated_at"],
|
|
23262
24171
|
prefix
|
|
23263
24172
|
);
|
|
23264
|
-
const {
|
|
23265
|
-
offset: offset2,
|
|
23266
|
-
created_at,
|
|
23267
|
-
updated_at,
|
|
23268
|
-
customer_id,
|
|
23269
|
-
currency_code,
|
|
23270
|
-
...rest
|
|
23271
|
-
} = queryObject;
|
|
24173
|
+
const { offset: offset2, limit, created_at, updated_at, ...rest } = queryObject;
|
|
23272
24174
|
const searchParams = {
|
|
23273
|
-
limit: pageSize,
|
|
24175
|
+
limit: limit ? Number(limit) : pageSize,
|
|
23274
24176
|
offset: offset2 ? Number(offset2) : 0,
|
|
23275
24177
|
created_at: created_at ? JSON.parse(created_at) : void 0,
|
|
23276
24178
|
updated_at: updated_at ? JSON.parse(updated_at) : void 0,
|
|
23277
|
-
customer_id: customer_id ? JSON.parse(customer_id) : void 0,
|
|
23278
|
-
currency_code: currency_code ? JSON.parse(currency_code) : void 0,
|
|
23279
24179
|
...rest
|
|
23280
24180
|
};
|
|
23281
24181
|
return searchParams;
|
|
23282
24182
|
};
|
|
23283
|
-
const PAGE_SIZE$
|
|
23284
|
-
function
|
|
23285
|
-
const queryParams =
|
|
23286
|
-
pageSize: PAGE_SIZE$
|
|
23287
|
-
});
|
|
23288
|
-
const {
|
|
23289
|
-
store_credit_accounts: storeCreditAccounts,
|
|
23290
|
-
isPending,
|
|
23291
|
-
count: count2
|
|
23292
|
-
} = useStoreCreditAccounts({
|
|
23293
|
-
...queryParams,
|
|
23294
|
-
order: queryParams.order ?? "-created_at"
|
|
24183
|
+
const PAGE_SIZE$4 = 10;
|
|
24184
|
+
function TransactionsTable({ id }) {
|
|
24185
|
+
const queryParams = useTransactionsTableQuery({
|
|
24186
|
+
pageSize: PAGE_SIZE$4
|
|
23295
24187
|
});
|
|
23296
|
-
const
|
|
23297
|
-
|
|
24188
|
+
const { transactions, isLoading, count: count2 } = useStoreCreditAccountTransactions(
|
|
24189
|
+
id,
|
|
24190
|
+
{
|
|
24191
|
+
...queryParams,
|
|
24192
|
+
order: queryParams.order ?? "-created_at",
|
|
24193
|
+
fields: "*account"
|
|
24194
|
+
}
|
|
24195
|
+
);
|
|
24196
|
+
const columns = useTransactionsTableColumns();
|
|
24197
|
+
const filters = useTransactionsTableFilters({});
|
|
23298
24198
|
return /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
23299
24199
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
23300
24200
|
DataTable,
|
|
23301
24201
|
{
|
|
23302
|
-
data:
|
|
24202
|
+
data: transactions ?? [],
|
|
23303
24203
|
getRowId: (row) => row.id,
|
|
23304
24204
|
columns,
|
|
23305
24205
|
filters,
|
|
23306
|
-
isLoading
|
|
23307
|
-
pageSize: PAGE_SIZE$
|
|
24206
|
+
isLoading,
|
|
24207
|
+
pageSize: PAGE_SIZE$4,
|
|
23308
24208
|
rowCount: count2,
|
|
23309
24209
|
enableSearch: false,
|
|
23310
|
-
heading: "
|
|
23311
|
-
rowHref: (row) => `${row.id}`,
|
|
24210
|
+
heading: "Transactions",
|
|
23312
24211
|
emptyState: {
|
|
23313
24212
|
empty: {
|
|
23314
|
-
heading: "No
|
|
23315
|
-
description: "Create a new store credit account to get started."
|
|
24213
|
+
heading: "No transactions found"
|
|
23316
24214
|
},
|
|
23317
24215
|
filtered: {
|
|
23318
24216
|
heading: "No results found",
|
|
23319
|
-
description: "No
|
|
23320
|
-
}
|
|
23321
|
-
},
|
|
23322
|
-
actions: [
|
|
23323
|
-
{
|
|
23324
|
-
label: "Create",
|
|
23325
|
-
to: "/store-credit-accounts/create"
|
|
24217
|
+
description: "No transactions match your filter criteria."
|
|
23326
24218
|
}
|
|
23327
|
-
|
|
24219
|
+
}
|
|
23328
24220
|
}
|
|
23329
24221
|
) }),
|
|
23330
24222
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
23331
24223
|
] });
|
|
23332
24224
|
}
|
|
23333
|
-
|
|
23334
|
-
|
|
23335
|
-
|
|
23336
|
-
components.LayoutComposer,
|
|
23337
|
-
{
|
|
23338
|
-
widgetsZonePrefix: "store_credit_account.list",
|
|
23339
|
-
preferredLayoutId: "core:single-column",
|
|
23340
|
-
sections: {
|
|
23341
|
-
main: /* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountsTable", children: /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountsTable, {}) })
|
|
23342
|
-
}
|
|
23343
|
-
}
|
|
23344
|
-
),
|
|
23345
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Toaster, {})
|
|
23346
|
-
] });
|
|
23347
|
-
};
|
|
23348
|
-
const config$1 = adminSdk.defineRouteConfig({
|
|
23349
|
-
label: "Store Credits",
|
|
23350
|
-
icon: StoreCreditIcon
|
|
23351
|
-
});
|
|
23352
|
-
var isObject_1;
|
|
23353
|
-
var hasRequiredIsObject;
|
|
23354
|
-
function requireIsObject() {
|
|
23355
|
-
if (hasRequiredIsObject) return isObject_1;
|
|
23356
|
-
hasRequiredIsObject = 1;
|
|
23357
|
-
function isObject2(value) {
|
|
23358
|
-
var type = typeof value;
|
|
23359
|
-
return value != null && (type == "object" || type == "function");
|
|
24225
|
+
function StoreCreditAccountCodeSection({ code }) {
|
|
24226
|
+
if (!code) {
|
|
24227
|
+
return null;
|
|
23360
24228
|
}
|
|
23361
|
-
|
|
23362
|
-
|
|
23363
|
-
|
|
23364
|
-
|
|
23365
|
-
|
|
23366
|
-
|
|
23367
|
-
|
|
23368
|
-
hasRequired_freeGlobal = 1;
|
|
23369
|
-
var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
23370
|
-
_freeGlobal = freeGlobal;
|
|
23371
|
-
return _freeGlobal;
|
|
23372
|
-
}
|
|
23373
|
-
var _root;
|
|
23374
|
-
var hasRequired_root;
|
|
23375
|
-
function require_root() {
|
|
23376
|
-
if (hasRequired_root) return _root;
|
|
23377
|
-
hasRequired_root = 1;
|
|
23378
|
-
var freeGlobal = require_freeGlobal();
|
|
23379
|
-
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
23380
|
-
var root = freeGlobal || freeSelf || Function("return this")();
|
|
23381
|
-
_root = root;
|
|
23382
|
-
return _root;
|
|
23383
|
-
}
|
|
23384
|
-
var now_1;
|
|
23385
|
-
var hasRequiredNow;
|
|
23386
|
-
function requireNow() {
|
|
23387
|
-
if (hasRequiredNow) return now_1;
|
|
23388
|
-
hasRequiredNow = 1;
|
|
23389
|
-
var root = require_root();
|
|
23390
|
-
var now = function() {
|
|
23391
|
-
return root.Date.now();
|
|
23392
|
-
};
|
|
23393
|
-
now_1 = now;
|
|
23394
|
-
return now_1;
|
|
24229
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0", children: [
|
|
24230
|
+
/* @__PURE__ */ jsxRuntime.jsx(Header$5, { title: "Account Code" }),
|
|
24231
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-4 px-6 mb-2", children: [
|
|
24232
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.Share, { className: "inline" }),
|
|
24233
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle text-sm", children: code })
|
|
24234
|
+
] })
|
|
24235
|
+
] });
|
|
23395
24236
|
}
|
|
23396
|
-
|
|
23397
|
-
|
|
23398
|
-
|
|
23399
|
-
|
|
23400
|
-
|
|
23401
|
-
|
|
23402
|
-
|
|
23403
|
-
var index = string2.length;
|
|
23404
|
-
while (index-- && reWhitespace.test(string2.charAt(index))) {
|
|
23405
|
-
}
|
|
23406
|
-
return index;
|
|
24237
|
+
const StoreCreditAccountPage = () => {
|
|
24238
|
+
const { id } = reactRouterDom.useParams();
|
|
24239
|
+
const { store_credit_account: storeCreditAccount } = useStoreCreditAccount(
|
|
24240
|
+
id
|
|
24241
|
+
);
|
|
24242
|
+
if (!storeCreditAccount) {
|
|
24243
|
+
return;
|
|
23407
24244
|
}
|
|
23408
|
-
|
|
23409
|
-
|
|
23410
|
-
|
|
23411
|
-
|
|
23412
|
-
|
|
23413
|
-
|
|
23414
|
-
|
|
23415
|
-
|
|
23416
|
-
|
|
23417
|
-
|
|
23418
|
-
|
|
23419
|
-
|
|
23420
|
-
|
|
23421
|
-
|
|
23422
|
-
|
|
23423
|
-
}
|
|
23424
|
-
|
|
23425
|
-
|
|
23426
|
-
|
|
23427
|
-
|
|
23428
|
-
|
|
23429
|
-
|
|
23430
|
-
|
|
23431
|
-
|
|
23432
|
-
|
|
23433
|
-
|
|
23434
|
-
|
|
23435
|
-
|
|
23436
|
-
|
|
23437
|
-
|
|
23438
|
-
|
|
23439
|
-
var Symbol2 = require_Symbol();
|
|
23440
|
-
var objectProto = Object.prototype;
|
|
23441
|
-
var hasOwnProperty2 = objectProto.hasOwnProperty;
|
|
23442
|
-
var nativeObjectToString = objectProto.toString;
|
|
23443
|
-
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
|
|
23444
|
-
function getRawTag(value) {
|
|
23445
|
-
var isOwn = hasOwnProperty2.call(value, symToStringTag), tag = value[symToStringTag];
|
|
23446
|
-
try {
|
|
23447
|
-
value[symToStringTag] = void 0;
|
|
23448
|
-
var unmasked = true;
|
|
23449
|
-
} catch (e) {
|
|
23450
|
-
}
|
|
23451
|
-
var result = nativeObjectToString.call(value);
|
|
23452
|
-
if (unmasked) {
|
|
23453
|
-
if (isOwn) {
|
|
23454
|
-
value[symToStringTag] = tag;
|
|
23455
|
-
} else {
|
|
23456
|
-
delete value[symToStringTag];
|
|
23457
|
-
}
|
|
23458
|
-
}
|
|
23459
|
-
return result;
|
|
23460
|
-
}
|
|
23461
|
-
_getRawTag = getRawTag;
|
|
23462
|
-
return _getRawTag;
|
|
23463
|
-
}
|
|
23464
|
-
var _objectToString;
|
|
23465
|
-
var hasRequired_objectToString;
|
|
23466
|
-
function require_objectToString() {
|
|
23467
|
-
if (hasRequired_objectToString) return _objectToString;
|
|
23468
|
-
hasRequired_objectToString = 1;
|
|
23469
|
-
var objectProto = Object.prototype;
|
|
23470
|
-
var nativeObjectToString = objectProto.toString;
|
|
23471
|
-
function objectToString(value) {
|
|
23472
|
-
return nativeObjectToString.call(value);
|
|
23473
|
-
}
|
|
23474
|
-
_objectToString = objectToString;
|
|
23475
|
-
return _objectToString;
|
|
23476
|
-
}
|
|
23477
|
-
var _baseGetTag;
|
|
23478
|
-
var hasRequired_baseGetTag;
|
|
23479
|
-
function require_baseGetTag() {
|
|
23480
|
-
if (hasRequired_baseGetTag) return _baseGetTag;
|
|
23481
|
-
hasRequired_baseGetTag = 1;
|
|
23482
|
-
var Symbol2 = require_Symbol(), getRawTag = require_getRawTag(), objectToString = require_objectToString();
|
|
23483
|
-
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
|
|
23484
|
-
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
|
|
23485
|
-
function baseGetTag(value) {
|
|
23486
|
-
if (value == null) {
|
|
23487
|
-
return value === void 0 ? undefinedTag : nullTag;
|
|
23488
|
-
}
|
|
23489
|
-
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
23490
|
-
}
|
|
23491
|
-
_baseGetTag = baseGetTag;
|
|
23492
|
-
return _baseGetTag;
|
|
23493
|
-
}
|
|
23494
|
-
var isObjectLike_1;
|
|
23495
|
-
var hasRequiredIsObjectLike;
|
|
23496
|
-
function requireIsObjectLike() {
|
|
23497
|
-
if (hasRequiredIsObjectLike) return isObjectLike_1;
|
|
23498
|
-
hasRequiredIsObjectLike = 1;
|
|
23499
|
-
function isObjectLike(value) {
|
|
23500
|
-
return value != null && typeof value == "object";
|
|
23501
|
-
}
|
|
23502
|
-
isObjectLike_1 = isObjectLike;
|
|
23503
|
-
return isObjectLike_1;
|
|
23504
|
-
}
|
|
23505
|
-
var isSymbol_1;
|
|
23506
|
-
var hasRequiredIsSymbol;
|
|
23507
|
-
function requireIsSymbol() {
|
|
23508
|
-
if (hasRequiredIsSymbol) return isSymbol_1;
|
|
23509
|
-
hasRequiredIsSymbol = 1;
|
|
23510
|
-
var baseGetTag = require_baseGetTag(), isObjectLike = requireIsObjectLike();
|
|
23511
|
-
var symbolTag = "[object Symbol]";
|
|
23512
|
-
function isSymbol(value) {
|
|
23513
|
-
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
23514
|
-
}
|
|
23515
|
-
isSymbol_1 = isSymbol;
|
|
23516
|
-
return isSymbol_1;
|
|
23517
|
-
}
|
|
23518
|
-
var toNumber_1;
|
|
23519
|
-
var hasRequiredToNumber;
|
|
23520
|
-
function requireToNumber() {
|
|
23521
|
-
if (hasRequiredToNumber) return toNumber_1;
|
|
23522
|
-
hasRequiredToNumber = 1;
|
|
23523
|
-
var baseTrim = require_baseTrim(), isObject2 = requireIsObject(), isSymbol = requireIsSymbol();
|
|
23524
|
-
var NAN = 0 / 0;
|
|
23525
|
-
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
23526
|
-
var reIsBinary = /^0b[01]+$/i;
|
|
23527
|
-
var reIsOctal = /^0o[0-7]+$/i;
|
|
23528
|
-
var freeParseInt = parseInt;
|
|
23529
|
-
function toNumber(value) {
|
|
23530
|
-
if (typeof value == "number") {
|
|
23531
|
-
return value;
|
|
23532
|
-
}
|
|
23533
|
-
if (isSymbol(value)) {
|
|
23534
|
-
return NAN;
|
|
23535
|
-
}
|
|
23536
|
-
if (isObject2(value)) {
|
|
23537
|
-
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
23538
|
-
value = isObject2(other) ? other + "" : other;
|
|
23539
|
-
}
|
|
23540
|
-
if (typeof value != "string") {
|
|
23541
|
-
return value === 0 ? value : +value;
|
|
23542
|
-
}
|
|
23543
|
-
value = baseTrim(value);
|
|
23544
|
-
var isBinary = reIsBinary.test(value);
|
|
23545
|
-
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
23546
|
-
}
|
|
23547
|
-
toNumber_1 = toNumber;
|
|
23548
|
-
return toNumber_1;
|
|
23549
|
-
}
|
|
23550
|
-
var debounce_1;
|
|
23551
|
-
var hasRequiredDebounce;
|
|
23552
|
-
function requireDebounce() {
|
|
23553
|
-
if (hasRequiredDebounce) return debounce_1;
|
|
23554
|
-
hasRequiredDebounce = 1;
|
|
23555
|
-
var isObject2 = requireIsObject(), now = requireNow(), toNumber = requireToNumber();
|
|
23556
|
-
var FUNC_ERROR_TEXT = "Expected a function";
|
|
23557
|
-
var nativeMax = Math.max, nativeMin = Math.min;
|
|
23558
|
-
function debounce2(func, wait, options) {
|
|
23559
|
-
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
23560
|
-
if (typeof func != "function") {
|
|
23561
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
23562
|
-
}
|
|
23563
|
-
wait = toNumber(wait) || 0;
|
|
23564
|
-
if (isObject2(options)) {
|
|
23565
|
-
leading = !!options.leading;
|
|
23566
|
-
maxing = "maxWait" in options;
|
|
23567
|
-
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
23568
|
-
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
23569
|
-
}
|
|
23570
|
-
function invokeFunc(time2) {
|
|
23571
|
-
var args = lastArgs, thisArg = lastThis;
|
|
23572
|
-
lastArgs = lastThis = void 0;
|
|
23573
|
-
lastInvokeTime = time2;
|
|
23574
|
-
result = func.apply(thisArg, args);
|
|
23575
|
-
return result;
|
|
23576
|
-
}
|
|
23577
|
-
function leadingEdge(time2) {
|
|
23578
|
-
lastInvokeTime = time2;
|
|
23579
|
-
timerId = setTimeout(timerExpired, wait);
|
|
23580
|
-
return leading ? invokeFunc(time2) : result;
|
|
23581
|
-
}
|
|
23582
|
-
function remainingWait(time2) {
|
|
23583
|
-
var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
|
|
23584
|
-
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
|
|
23585
|
-
}
|
|
23586
|
-
function shouldInvoke(time2) {
|
|
23587
|
-
var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime;
|
|
23588
|
-
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
|
|
23589
|
-
}
|
|
23590
|
-
function timerExpired() {
|
|
23591
|
-
var time2 = now();
|
|
23592
|
-
if (shouldInvoke(time2)) {
|
|
23593
|
-
return trailingEdge(time2);
|
|
24245
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
24246
|
+
components.LayoutComposer,
|
|
24247
|
+
{
|
|
24248
|
+
widgetsZonePrefix: "store_credit_account.details",
|
|
24249
|
+
preferredLayoutId: "core:two-column",
|
|
24250
|
+
data: storeCreditAccount,
|
|
24251
|
+
sections: {
|
|
24252
|
+
main: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
24253
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountDetailsSection", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
24254
|
+
StoreCreditAccountDetailsSection,
|
|
24255
|
+
{
|
|
24256
|
+
storeCreditAccount
|
|
24257
|
+
}
|
|
24258
|
+
) }),
|
|
24259
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "TransactionsTable", children: /* @__PURE__ */ jsxRuntime.jsx(TransactionsTable, { id: storeCreditAccount.id }) })
|
|
24260
|
+
] }),
|
|
24261
|
+
side: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
24262
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountBalanceSection", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
24263
|
+
StoreCreditAccountBalanceSection,
|
|
24264
|
+
{
|
|
24265
|
+
storeCreditAccount
|
|
24266
|
+
}
|
|
24267
|
+
) }),
|
|
24268
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountCodeSection", children: /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountCodeSection, { code: storeCreditAccount.code }) }),
|
|
24269
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountCustomerSection", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
24270
|
+
StoreCreditAccountCustomerSection,
|
|
24271
|
+
{
|
|
24272
|
+
customerId: storeCreditAccount.customer_id
|
|
24273
|
+
}
|
|
24274
|
+
) })
|
|
24275
|
+
] })
|
|
23594
24276
|
}
|
|
23595
|
-
timerId = setTimeout(timerExpired, remainingWait(time2));
|
|
23596
24277
|
}
|
|
23597
|
-
|
|
23598
|
-
|
|
23599
|
-
|
|
23600
|
-
|
|
24278
|
+
);
|
|
24279
|
+
};
|
|
24280
|
+
const KeyboundForm = React__namespace.default.forwardRef(({ onSubmit, onKeyDown, ...rest }, ref) => {
|
|
24281
|
+
const handleSubmit = (event) => {
|
|
24282
|
+
event.preventDefault();
|
|
24283
|
+
onSubmit?.(event);
|
|
24284
|
+
};
|
|
24285
|
+
const handleKeyDown = (event) => {
|
|
24286
|
+
if (event.key === "Enter") {
|
|
24287
|
+
if (event.target instanceof HTMLTextAreaElement && !(event.metaKey || event.ctrlKey)) {
|
|
24288
|
+
return;
|
|
23601
24289
|
}
|
|
23602
|
-
|
|
23603
|
-
|
|
23604
|
-
|
|
23605
|
-
function cancel() {
|
|
23606
|
-
if (timerId !== void 0) {
|
|
23607
|
-
clearTimeout(timerId);
|
|
24290
|
+
event.preventDefault();
|
|
24291
|
+
if (event.metaKey || event.ctrlKey) {
|
|
24292
|
+
handleSubmit(event);
|
|
23608
24293
|
}
|
|
23609
|
-
lastInvokeTime = 0;
|
|
23610
|
-
lastArgs = lastCallTime = lastThis = timerId = void 0;
|
|
23611
24294
|
}
|
|
23612
|
-
|
|
23613
|
-
|
|
23614
|
-
|
|
23615
|
-
|
|
23616
|
-
|
|
23617
|
-
|
|
23618
|
-
|
|
23619
|
-
|
|
23620
|
-
if (isInvoking) {
|
|
23621
|
-
if (timerId === void 0) {
|
|
23622
|
-
return leadingEdge(lastCallTime);
|
|
23623
|
-
}
|
|
23624
|
-
if (maxing) {
|
|
23625
|
-
clearTimeout(timerId);
|
|
23626
|
-
timerId = setTimeout(timerExpired, wait);
|
|
23627
|
-
return invokeFunc(lastCallTime);
|
|
23628
|
-
}
|
|
23629
|
-
}
|
|
23630
|
-
if (timerId === void 0) {
|
|
23631
|
-
timerId = setTimeout(timerExpired, wait);
|
|
23632
|
-
}
|
|
23633
|
-
return result;
|
|
24295
|
+
};
|
|
24296
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
24297
|
+
"form",
|
|
24298
|
+
{
|
|
24299
|
+
...rest,
|
|
24300
|
+
onSubmit: handleSubmit,
|
|
24301
|
+
onKeyDown: onKeyDown ?? handleKeyDown,
|
|
24302
|
+
ref
|
|
23634
24303
|
}
|
|
23635
|
-
debounced.cancel = cancel;
|
|
23636
|
-
debounced.flush = flush;
|
|
23637
|
-
return debounced;
|
|
23638
|
-
}
|
|
23639
|
-
debounce_1 = debounce2;
|
|
23640
|
-
return debounce_1;
|
|
23641
|
-
}
|
|
23642
|
-
var debounceExports = requireDebounce();
|
|
23643
|
-
const debounce$1 = /* @__PURE__ */ getDefaultExportFromCjs(debounceExports);
|
|
23644
|
-
const useDebouncedSearch = () => {
|
|
23645
|
-
const [searchValue, onSearchValueChange] = React.useState("");
|
|
23646
|
-
const [debouncedQuery, setDebouncedQuery] = React.useState("");
|
|
23647
|
-
const debouncedUpdate = React.useCallback(
|
|
23648
|
-
debounce$1((query) => setDebouncedQuery(query), 300),
|
|
23649
|
-
[]
|
|
23650
24304
|
);
|
|
23651
|
-
|
|
23652
|
-
|
|
23653
|
-
|
|
23654
|
-
}
|
|
23655
|
-
|
|
23656
|
-
|
|
23657
|
-
|
|
23658
|
-
|
|
23659
|
-
|
|
24305
|
+
});
|
|
24306
|
+
KeyboundForm.displayName = "KeyboundForm";
|
|
24307
|
+
const Note$1 = () => {
|
|
24308
|
+
const { id } = reactRouterDom.useParams();
|
|
24309
|
+
const {
|
|
24310
|
+
store_credit_account: storeCreditAccount,
|
|
24311
|
+
isPending,
|
|
24312
|
+
isError,
|
|
24313
|
+
error
|
|
24314
|
+
} = useStoreCreditAccount(id, {});
|
|
24315
|
+
if (isError) {
|
|
24316
|
+
throw error;
|
|
24317
|
+
}
|
|
24318
|
+
const isReady = !isPending && !!storeCreditAccount;
|
|
24319
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
24320
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
24321
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Credit store credit account" }) }),
|
|
24322
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Credit the store credit account" }) })
|
|
24323
|
+
] }),
|
|
24324
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountCreditForm, { storeCreditAccount })
|
|
24325
|
+
] });
|
|
23660
24326
|
};
|
|
23661
|
-
const
|
|
23662
|
-
|
|
23663
|
-
queryFn,
|
|
23664
|
-
getOptions,
|
|
23665
|
-
defaultValue: defaultValue2,
|
|
23666
|
-
defaultValueKey,
|
|
23667
|
-
pageSize = 10
|
|
24327
|
+
const StoreCreditAccountCreditForm = ({
|
|
24328
|
+
storeCreditAccount
|
|
23668
24329
|
}) => {
|
|
23669
|
-
const
|
|
23670
|
-
|
|
23671
|
-
|
|
23672
|
-
|
|
23673
|
-
|
|
23674
|
-
|
|
23675
|
-
|
|
23676
|
-
limit: Array.isArray(defaultValue2) ? defaultValue2.length : 1
|
|
23677
|
-
});
|
|
23678
|
-
},
|
|
23679
|
-
enabled: !!defaultValue2
|
|
23680
|
-
});
|
|
23681
|
-
const { data, ...rest } = reactQuery.useInfiniteQuery({
|
|
23682
|
-
queryKey: [...queryKey, query],
|
|
23683
|
-
queryFn: async ({ pageParam = 0 }) => {
|
|
23684
|
-
return await queryFn({
|
|
23685
|
-
q: query,
|
|
23686
|
-
limit: pageSize,
|
|
23687
|
-
offset: pageParam
|
|
23688
|
-
});
|
|
23689
|
-
},
|
|
23690
|
-
initialPageParam: 0,
|
|
23691
|
-
getNextPageParam: (lastPage) => {
|
|
23692
|
-
const moreItemsExist = lastPage.count > lastPage.offset + lastPage.limit;
|
|
23693
|
-
return moreItemsExist ? lastPage.offset + lastPage.limit : void 0;
|
|
24330
|
+
const form = useForm({
|
|
24331
|
+
defaultValues: {
|
|
24332
|
+
amount: {
|
|
24333
|
+
float: 0,
|
|
24334
|
+
value: ""
|
|
24335
|
+
},
|
|
24336
|
+
note: ""
|
|
23694
24337
|
},
|
|
23695
|
-
|
|
24338
|
+
resolver: u(schema$3)
|
|
23696
24339
|
});
|
|
23697
|
-
const
|
|
23698
|
-
|
|
23699
|
-
|
|
23700
|
-
|
|
23701
|
-
|
|
23702
|
-
|
|
23703
|
-
|
|
24340
|
+
const { mutateAsync, isPending } = useCreditStoreCreditAccount(
|
|
24341
|
+
storeCreditAccount.id
|
|
24342
|
+
);
|
|
24343
|
+
const { handleSuccess } = useRouteModal();
|
|
24344
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
24345
|
+
if (data.amount.float <= 0) {
|
|
24346
|
+
form.setError("amount", { message: "Amount must be greater than 0" });
|
|
24347
|
+
return;
|
|
24348
|
+
}
|
|
24349
|
+
await mutateAsync(
|
|
24350
|
+
{ amount: data.amount.float, note: data.note },
|
|
24351
|
+
{
|
|
24352
|
+
onSuccess: () => handleSuccess(),
|
|
24353
|
+
onError: (error) => ui.toast.error(error.message)
|
|
23704
24354
|
}
|
|
23705
|
-
|
|
23706
|
-
}
|
|
23707
|
-
return {
|
|
23708
|
-
|
|
23709
|
-
|
|
23710
|
-
|
|
23711
|
-
|
|
23712
|
-
|
|
23713
|
-
|
|
24355
|
+
);
|
|
24356
|
+
});
|
|
24357
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
24358
|
+
KeyboundForm,
|
|
24359
|
+
{
|
|
24360
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
24361
|
+
onSubmit,
|
|
24362
|
+
children: [
|
|
24363
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
|
|
24364
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24365
|
+
Form$2.Field,
|
|
24366
|
+
{
|
|
24367
|
+
control: form.control,
|
|
24368
|
+
name: "amount",
|
|
24369
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
24370
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Amount" }),
|
|
24371
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
24372
|
+
ui.CurrencyInput,
|
|
24373
|
+
{
|
|
24374
|
+
min: 0,
|
|
24375
|
+
placeholder: "0",
|
|
24376
|
+
value: field.value.value,
|
|
24377
|
+
onValueChange: (_value, _name, values) => {
|
|
24378
|
+
field.onChange({
|
|
24379
|
+
value: values?.value,
|
|
24380
|
+
float: values?.float || null
|
|
24381
|
+
});
|
|
24382
|
+
},
|
|
24383
|
+
symbol: currencies[storeCreditAccount.currency_code.toUpperCase()].symbol_native,
|
|
24384
|
+
code: storeCreditAccount.currency_code.toUpperCase()
|
|
24385
|
+
}
|
|
24386
|
+
) }),
|
|
24387
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
24388
|
+
] })
|
|
24389
|
+
}
|
|
24390
|
+
),
|
|
24391
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24392
|
+
Form$2.Field,
|
|
24393
|
+
{
|
|
24394
|
+
control: form.control,
|
|
24395
|
+
name: "note",
|
|
24396
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
24397
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Note" }),
|
|
24398
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Textarea, { ...field }) }),
|
|
24399
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
24400
|
+
] })
|
|
24401
|
+
}
|
|
24402
|
+
)
|
|
24403
|
+
] }),
|
|
24404
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
24405
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
24406
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
24407
|
+
] }) })
|
|
24408
|
+
]
|
|
24409
|
+
}
|
|
24410
|
+
) });
|
|
23714
24411
|
};
|
|
23715
|
-
const
|
|
23716
|
-
|
|
23717
|
-
|
|
24412
|
+
const schema$3 = zod.z.object({
|
|
24413
|
+
note: zod.z.string(),
|
|
24414
|
+
amount: zod.z.object({
|
|
24415
|
+
float: zod.z.number(),
|
|
24416
|
+
value: zod.z.string()
|
|
24417
|
+
})
|
|
23718
24418
|
});
|
|
23719
|
-
const
|
|
23720
|
-
const {
|
|
23721
|
-
const
|
|
23722
|
-
|
|
24419
|
+
const Debit = () => {
|
|
24420
|
+
const { id } = reactRouterDom.useParams();
|
|
24421
|
+
const {
|
|
24422
|
+
store_credit_account: storeCreditAccount,
|
|
24423
|
+
isPending,
|
|
24424
|
+
isError,
|
|
24425
|
+
error
|
|
24426
|
+
} = useStoreCreditAccount(id, {});
|
|
24427
|
+
if (isError) {
|
|
24428
|
+
throw error;
|
|
24429
|
+
}
|
|
24430
|
+
const isReady = !isPending && !!storeCreditAccount;
|
|
24431
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
24432
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
24433
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Debit store credit account" }) }),
|
|
24434
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Debit the store credit account" }) })
|
|
24435
|
+
] }),
|
|
24436
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountDebitForm, { storeCreditAccount })
|
|
24437
|
+
] });
|
|
24438
|
+
};
|
|
24439
|
+
const StoreCreditAccountDebitForm = ({
|
|
24440
|
+
storeCreditAccount
|
|
24441
|
+
}) => {
|
|
23723
24442
|
const form = useForm({
|
|
23724
24443
|
defaultValues: {
|
|
23725
|
-
|
|
23726
|
-
|
|
24444
|
+
amount: {
|
|
24445
|
+
float: 0,
|
|
24446
|
+
value: ""
|
|
24447
|
+
},
|
|
24448
|
+
note: ""
|
|
23727
24449
|
},
|
|
23728
|
-
resolver: u(
|
|
24450
|
+
resolver: u(schema$2)
|
|
23729
24451
|
});
|
|
23730
|
-
const { mutateAsync
|
|
23731
|
-
|
|
23732
|
-
|
|
23733
|
-
|
|
24452
|
+
const { mutateAsync, isPending } = useDebitStoreCreditAccount(
|
|
24453
|
+
storeCreditAccount.id
|
|
24454
|
+
);
|
|
24455
|
+
const { handleSuccess } = useRouteModal();
|
|
24456
|
+
const balance = storeCreditAccount.balance ?? 0;
|
|
24457
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
24458
|
+
if (data.amount.float <= 0) {
|
|
24459
|
+
form.setError("amount", { message: "Amount must be greater than 0" });
|
|
24460
|
+
return;
|
|
23734
24461
|
}
|
|
23735
|
-
|
|
23736
|
-
|
|
23737
|
-
|
|
23738
|
-
|
|
23739
|
-
|
|
23740
|
-
onError: (error) => {
|
|
23741
|
-
ui.toast.error(error.message);
|
|
23742
|
-
}
|
|
23743
|
-
});
|
|
23744
|
-
});
|
|
23745
|
-
const [currencySearchValue, setCurrencySearchValue] = React.useState("");
|
|
23746
|
-
const currencyOptions = React.useMemo(() => {
|
|
23747
|
-
const options = Object.values(currencies).map((currency) => ({
|
|
23748
|
-
label: `${currency.code} - ${currency.name} (${currency.symbol_native})`,
|
|
23749
|
-
value: currency.code.toLowerCase()
|
|
23750
|
-
}));
|
|
23751
|
-
if (!currencySearchValue) {
|
|
23752
|
-
return options;
|
|
24462
|
+
if (data.amount.float > balance) {
|
|
24463
|
+
form.setError("amount", {
|
|
24464
|
+
message: "Amount can't be greater than the current balance"
|
|
24465
|
+
});
|
|
24466
|
+
return;
|
|
23753
24467
|
}
|
|
23754
|
-
|
|
23755
|
-
|
|
24468
|
+
await mutateAsync(
|
|
24469
|
+
{ amount: data.amount.float, note: data.note },
|
|
24470
|
+
{
|
|
24471
|
+
onSuccess: () => handleSuccess(),
|
|
24472
|
+
onError: (error) => ui.toast.error(error.message)
|
|
24473
|
+
}
|
|
23756
24474
|
);
|
|
23757
|
-
}, [currencySearchValue]);
|
|
23758
|
-
const {
|
|
23759
|
-
options: customerOptions,
|
|
23760
|
-
fetchNextPage,
|
|
23761
|
-
isFetchingNextPage,
|
|
23762
|
-
searchValue,
|
|
23763
|
-
onSearchValueChange,
|
|
23764
|
-
isLoading
|
|
23765
|
-
} = useComboboxData({
|
|
23766
|
-
queryKey: customersQueryKeys.list(),
|
|
23767
|
-
defaultValue: prefilledCustomerId || void 0,
|
|
23768
|
-
queryFn: async (params) => {
|
|
23769
|
-
return sdk.admin.customer.list(params);
|
|
23770
|
-
},
|
|
23771
|
-
getOptions: (data) => {
|
|
23772
|
-
return data.customers?.map((customer) => {
|
|
23773
|
-
const fullName = [customer.first_name, customer.last_name].filter(Boolean).join(" ");
|
|
23774
|
-
const label = fullName ? `${customer.email} (${fullName})` : customer.email;
|
|
23775
|
-
return {
|
|
23776
|
-
label,
|
|
23777
|
-
value: customer.id
|
|
23778
|
-
};
|
|
23779
|
-
}) || [];
|
|
23780
|
-
}
|
|
23781
24475
|
});
|
|
23782
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
23783
|
-
|
|
23784
|
-
|
|
23785
|
-
|
|
23786
|
-
|
|
23787
|
-
|
|
23788
|
-
|
|
23789
|
-
|
|
23790
|
-
|
|
23791
|
-
|
|
23792
|
-
|
|
23793
|
-
|
|
23794
|
-
|
|
23795
|
-
|
|
23796
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { className: "w-full", children: [
|
|
23797
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { className: "font-normal", children: "Currency" }),
|
|
24476
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
24477
|
+
KeyboundForm,
|
|
24478
|
+
{
|
|
24479
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
24480
|
+
onSubmit,
|
|
24481
|
+
children: [
|
|
24482
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
|
|
24483
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24484
|
+
Form$2.Field,
|
|
24485
|
+
{
|
|
24486
|
+
control: form.control,
|
|
24487
|
+
name: "amount",
|
|
24488
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
24489
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Amount" }),
|
|
23798
24490
|
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
23799
|
-
|
|
24491
|
+
ui.CurrencyInput,
|
|
23800
24492
|
{
|
|
23801
|
-
|
|
23802
|
-
|
|
23803
|
-
|
|
23804
|
-
|
|
23805
|
-
|
|
23806
|
-
|
|
24493
|
+
min: 0,
|
|
24494
|
+
placeholder: "0",
|
|
24495
|
+
value: field.value.value,
|
|
24496
|
+
onValueChange: (_value, _name, values) => {
|
|
24497
|
+
field.onChange({
|
|
24498
|
+
value: values?.value,
|
|
24499
|
+
float: values?.float || null
|
|
24500
|
+
});
|
|
24501
|
+
},
|
|
24502
|
+
symbol: currencies[storeCreditAccount.currency_code.toUpperCase()].symbol_native,
|
|
24503
|
+
code: storeCreditAccount.currency_code.toUpperCase()
|
|
23807
24504
|
}
|
|
23808
24505
|
) }),
|
|
23809
24506
|
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
23810
|
-
] })
|
|
24507
|
+
] })
|
|
23811
24508
|
}
|
|
23812
|
-
|
|
23813
|
-
|
|
23814
|
-
|
|
23815
|
-
|
|
23816
|
-
|
|
23817
|
-
|
|
23818
|
-
|
|
23819
|
-
|
|
23820
|
-
|
|
23821
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { className: "font-normal", children: "Customer" }),
|
|
23822
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
23823
|
-
Combobox,
|
|
23824
|
-
{
|
|
23825
|
-
value: field.value,
|
|
23826
|
-
onChange: field.onChange,
|
|
23827
|
-
searchValue,
|
|
23828
|
-
onSearchValueChange,
|
|
23829
|
-
options: customerOptions,
|
|
23830
|
-
placeholder: "Search for a customer...",
|
|
23831
|
-
fetchNextPage,
|
|
23832
|
-
isFetchingNextPage,
|
|
23833
|
-
noResultsPlaceholder: isLoading ? "Loading customers..." : "No customers found"
|
|
23834
|
-
}
|
|
23835
|
-
) }),
|
|
24509
|
+
),
|
|
24510
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24511
|
+
Form$2.Field,
|
|
24512
|
+
{
|
|
24513
|
+
control: form.control,
|
|
24514
|
+
name: "note",
|
|
24515
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
24516
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Note" }),
|
|
24517
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Textarea, { ...field }) }),
|
|
23836
24518
|
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
23837
|
-
] })
|
|
24519
|
+
] })
|
|
23838
24520
|
}
|
|
23839
|
-
|
|
23840
|
-
)
|
|
23841
|
-
|
|
23842
|
-
|
|
23843
|
-
|
|
23844
|
-
|
|
23845
|
-
|
|
23846
|
-
|
|
23847
|
-
|
|
23848
|
-
variant: "primary",
|
|
23849
|
-
size: "small",
|
|
23850
|
-
onClick: handleSubmit,
|
|
23851
|
-
disabled: isPending,
|
|
23852
|
-
children: "Create"
|
|
23853
|
-
}
|
|
23854
|
-
)
|
|
23855
|
-
] })
|
|
23856
|
-
] });
|
|
23857
|
-
};
|
|
23858
|
-
const StoreCreditAccountCreate = () => {
|
|
23859
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteFocusModal, { children: [
|
|
23860
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Create Store Credit Account" }) }),
|
|
23861
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Create a new store credit account" }) }),
|
|
23862
|
-
/* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountCreateForm, {})
|
|
23863
|
-
] });
|
|
24521
|
+
)
|
|
24522
|
+
] }),
|
|
24523
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
24524
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
24525
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
24526
|
+
] }) })
|
|
24527
|
+
]
|
|
24528
|
+
}
|
|
24529
|
+
) });
|
|
23864
24530
|
};
|
|
24531
|
+
const schema$2 = zod.z.object({
|
|
24532
|
+
note: zod.z.string(),
|
|
24533
|
+
amount: zod.z.object({
|
|
24534
|
+
float: zod.z.number(),
|
|
24535
|
+
value: zod.z.string()
|
|
24536
|
+
})
|
|
24537
|
+
});
|
|
23865
24538
|
function _extends() {
|
|
23866
24539
|
return _extends = Object.assign ? Object.assign.bind() : function(n2) {
|
|
23867
24540
|
for (var e = 1; e < arguments.length; e++) {
|
|
@@ -26541,258 +27214,6 @@ const GiftCardOrderSection = ({ giftCard }) => {
|
|
|
26541
27214
|
))
|
|
26542
27215
|
] });
|
|
26543
27216
|
};
|
|
26544
|
-
var toggleSelection;
|
|
26545
|
-
var hasRequiredToggleSelection;
|
|
26546
|
-
function requireToggleSelection() {
|
|
26547
|
-
if (hasRequiredToggleSelection) return toggleSelection;
|
|
26548
|
-
hasRequiredToggleSelection = 1;
|
|
26549
|
-
toggleSelection = function() {
|
|
26550
|
-
var selection = document.getSelection();
|
|
26551
|
-
if (!selection.rangeCount) {
|
|
26552
|
-
return function() {
|
|
26553
|
-
};
|
|
26554
|
-
}
|
|
26555
|
-
var active = document.activeElement;
|
|
26556
|
-
var ranges = [];
|
|
26557
|
-
for (var i2 = 0; i2 < selection.rangeCount; i2++) {
|
|
26558
|
-
ranges.push(selection.getRangeAt(i2));
|
|
26559
|
-
}
|
|
26560
|
-
switch (active.tagName.toUpperCase()) {
|
|
26561
|
-
// .toUpperCase handles XHTML
|
|
26562
|
-
case "INPUT":
|
|
26563
|
-
case "TEXTAREA":
|
|
26564
|
-
active.blur();
|
|
26565
|
-
break;
|
|
26566
|
-
default:
|
|
26567
|
-
active = null;
|
|
26568
|
-
break;
|
|
26569
|
-
}
|
|
26570
|
-
selection.removeAllRanges();
|
|
26571
|
-
return function() {
|
|
26572
|
-
selection.type === "Caret" && selection.removeAllRanges();
|
|
26573
|
-
if (!selection.rangeCount) {
|
|
26574
|
-
ranges.forEach(function(range) {
|
|
26575
|
-
selection.addRange(range);
|
|
26576
|
-
});
|
|
26577
|
-
}
|
|
26578
|
-
active && active.focus();
|
|
26579
|
-
};
|
|
26580
|
-
};
|
|
26581
|
-
return toggleSelection;
|
|
26582
|
-
}
|
|
26583
|
-
var copyToClipboard;
|
|
26584
|
-
var hasRequiredCopyToClipboard;
|
|
26585
|
-
function requireCopyToClipboard() {
|
|
26586
|
-
if (hasRequiredCopyToClipboard) return copyToClipboard;
|
|
26587
|
-
hasRequiredCopyToClipboard = 1;
|
|
26588
|
-
var deselectCurrent = requireToggleSelection();
|
|
26589
|
-
var clipboardToIE11Formatting = {
|
|
26590
|
-
"text/plain": "Text",
|
|
26591
|
-
"text/html": "Url",
|
|
26592
|
-
"default": "Text"
|
|
26593
|
-
};
|
|
26594
|
-
var defaultMessage = "Copy to clipboard: #{key}, Enter";
|
|
26595
|
-
function format2(message2) {
|
|
26596
|
-
var copyKey = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C";
|
|
26597
|
-
return message2.replace(/#{\s*key\s*}/g, copyKey);
|
|
26598
|
-
}
|
|
26599
|
-
function copy2(text2, options) {
|
|
26600
|
-
var debug2, message2, reselectPrevious, range, selection, mark, success = false;
|
|
26601
|
-
if (!options) {
|
|
26602
|
-
options = {};
|
|
26603
|
-
}
|
|
26604
|
-
debug2 = options.debug || false;
|
|
26605
|
-
try {
|
|
26606
|
-
reselectPrevious = deselectCurrent();
|
|
26607
|
-
range = document.createRange();
|
|
26608
|
-
selection = document.getSelection();
|
|
26609
|
-
mark = document.createElement("span");
|
|
26610
|
-
mark.textContent = text2;
|
|
26611
|
-
mark.ariaHidden = "true";
|
|
26612
|
-
mark.style.all = "unset";
|
|
26613
|
-
mark.style.position = "fixed";
|
|
26614
|
-
mark.style.top = 0;
|
|
26615
|
-
mark.style.clip = "rect(0, 0, 0, 0)";
|
|
26616
|
-
mark.style.whiteSpace = "pre";
|
|
26617
|
-
mark.style.webkitUserSelect = "text";
|
|
26618
|
-
mark.style.MozUserSelect = "text";
|
|
26619
|
-
mark.style.msUserSelect = "text";
|
|
26620
|
-
mark.style.userSelect = "text";
|
|
26621
|
-
mark.addEventListener("copy", function(e) {
|
|
26622
|
-
e.stopPropagation();
|
|
26623
|
-
if (options.format) {
|
|
26624
|
-
e.preventDefault();
|
|
26625
|
-
if (typeof e.clipboardData === "undefined") {
|
|
26626
|
-
debug2 && console.warn("unable to use e.clipboardData");
|
|
26627
|
-
debug2 && console.warn("trying IE specific stuff");
|
|
26628
|
-
window.clipboardData.clearData();
|
|
26629
|
-
var format3 = clipboardToIE11Formatting[options.format] || clipboardToIE11Formatting["default"];
|
|
26630
|
-
window.clipboardData.setData(format3, text2);
|
|
26631
|
-
} else {
|
|
26632
|
-
e.clipboardData.clearData();
|
|
26633
|
-
e.clipboardData.setData(options.format, text2);
|
|
26634
|
-
}
|
|
26635
|
-
}
|
|
26636
|
-
if (options.onCopy) {
|
|
26637
|
-
e.preventDefault();
|
|
26638
|
-
options.onCopy(e.clipboardData);
|
|
26639
|
-
}
|
|
26640
|
-
});
|
|
26641
|
-
document.body.appendChild(mark);
|
|
26642
|
-
range.selectNodeContents(mark);
|
|
26643
|
-
selection.addRange(range);
|
|
26644
|
-
var successful = document.execCommand("copy");
|
|
26645
|
-
if (!successful) {
|
|
26646
|
-
throw new Error("copy command was unsuccessful");
|
|
26647
|
-
}
|
|
26648
|
-
success = true;
|
|
26649
|
-
} catch (err) {
|
|
26650
|
-
debug2 && console.error("unable to copy using execCommand: ", err);
|
|
26651
|
-
debug2 && console.warn("trying IE specific stuff");
|
|
26652
|
-
try {
|
|
26653
|
-
window.clipboardData.setData(options.format || "text", text2);
|
|
26654
|
-
options.onCopy && options.onCopy(window.clipboardData);
|
|
26655
|
-
success = true;
|
|
26656
|
-
} catch (err2) {
|
|
26657
|
-
debug2 && console.error("unable to copy using clipboardData: ", err2);
|
|
26658
|
-
debug2 && console.error("falling back to prompt");
|
|
26659
|
-
message2 = format2("message" in options ? options.message : defaultMessage);
|
|
26660
|
-
window.prompt(message2, text2);
|
|
26661
|
-
}
|
|
26662
|
-
} finally {
|
|
26663
|
-
if (selection) {
|
|
26664
|
-
if (typeof selection.removeRange == "function") {
|
|
26665
|
-
selection.removeRange(range);
|
|
26666
|
-
} else {
|
|
26667
|
-
selection.removeAllRanges();
|
|
26668
|
-
}
|
|
26669
|
-
}
|
|
26670
|
-
if (mark) {
|
|
26671
|
-
document.body.removeChild(mark);
|
|
26672
|
-
}
|
|
26673
|
-
reselectPrevious();
|
|
26674
|
-
}
|
|
26675
|
-
return success;
|
|
26676
|
-
}
|
|
26677
|
-
copyToClipboard = copy2;
|
|
26678
|
-
return copyToClipboard;
|
|
26679
|
-
}
|
|
26680
|
-
var copyToClipboardExports = requireCopyToClipboard();
|
|
26681
|
-
const copy$1 = /* @__PURE__ */ getDefaultExportFromCjs(copyToClipboardExports);
|
|
26682
|
-
function DisplayId({ id, className }) {
|
|
26683
|
-
const [open, setOpen] = React.useState(false);
|
|
26684
|
-
const onClick = () => {
|
|
26685
|
-
copy$1(id);
|
|
26686
|
-
ui.toast.success("Copied to clipboard");
|
|
26687
|
-
};
|
|
26688
|
-
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: [
|
|
26689
|
-
"#",
|
|
26690
|
-
id.slice(-7)
|
|
26691
|
-
] }) });
|
|
26692
|
-
}
|
|
26693
|
-
const columnHelper$8 = ui.createDataTableColumnHelper();
|
|
26694
|
-
const useTransactionsTableColumns = () => {
|
|
26695
|
-
return React.useMemo(() => {
|
|
26696
|
-
return [
|
|
26697
|
-
columnHelper$8.accessor("id", {
|
|
26698
|
-
header: "ID",
|
|
26699
|
-
cell: ({ row }) => {
|
|
26700
|
-
return /* @__PURE__ */ jsxRuntime.jsx(DisplayId, { id: row.original.id });
|
|
26701
|
-
}
|
|
26702
|
-
}),
|
|
26703
|
-
columnHelper$8.accessor("created_at", {
|
|
26704
|
-
header: "Created At",
|
|
26705
|
-
cell: ({ row }) => formatDate(row.original.created_at, false)
|
|
26706
|
-
}),
|
|
26707
|
-
columnHelper$8.accessor("note", {
|
|
26708
|
-
header: "Description",
|
|
26709
|
-
cell: ({ row }) => row.original.note
|
|
26710
|
-
}),
|
|
26711
|
-
columnHelper$8.accessor("note", {
|
|
26712
|
-
header: "Note",
|
|
26713
|
-
cell: ({ row }) => {
|
|
26714
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { title: row.original.note, className: "max-w-[300px] truncate", children: row.original.note || "-" });
|
|
26715
|
-
}
|
|
26716
|
-
}),
|
|
26717
|
-
columnHelper$8.accessor("amount", {
|
|
26718
|
-
header: "Amount",
|
|
26719
|
-
cell: ({ row }) => {
|
|
26720
|
-
const isDebit = row.original.type === "debit";
|
|
26721
|
-
return row.original.account.currency_code && formatAmount(
|
|
26722
|
-
row.original.amount * (isDebit ? -1 : 1),
|
|
26723
|
-
row.original.account.currency_code
|
|
26724
|
-
);
|
|
26725
|
-
}
|
|
26726
|
-
})
|
|
26727
|
-
];
|
|
26728
|
-
}, []);
|
|
26729
|
-
};
|
|
26730
|
-
const useTransactionsTableFilters = ({}) => {
|
|
26731
|
-
const dateFilterOptions = useDataTableDateFilters$1();
|
|
26732
|
-
return React.useMemo(() => {
|
|
26733
|
-
return [...dateFilterOptions];
|
|
26734
|
-
}, [dateFilterOptions]);
|
|
26735
|
-
};
|
|
26736
|
-
const useTransactionsTableQuery = ({
|
|
26737
|
-
prefix,
|
|
26738
|
-
pageSize = 20
|
|
26739
|
-
}) => {
|
|
26740
|
-
const queryObject = useQueryParams(
|
|
26741
|
-
["offset", "limit", "currency_code", "created_at", "updated_at"],
|
|
26742
|
-
prefix
|
|
26743
|
-
);
|
|
26744
|
-
const { offset: offset2, limit, created_at, updated_at, ...rest } = queryObject;
|
|
26745
|
-
const searchParams = {
|
|
26746
|
-
limit: limit ? Number(limit) : pageSize,
|
|
26747
|
-
offset: offset2 ? Number(offset2) : 0,
|
|
26748
|
-
created_at: created_at ? JSON.parse(created_at) : void 0,
|
|
26749
|
-
updated_at: updated_at ? JSON.parse(updated_at) : void 0,
|
|
26750
|
-
...rest
|
|
26751
|
-
};
|
|
26752
|
-
return searchParams;
|
|
26753
|
-
};
|
|
26754
|
-
const PAGE_SIZE$4 = 10;
|
|
26755
|
-
function TransactionsTable({ id }) {
|
|
26756
|
-
const queryParams = useTransactionsTableQuery({
|
|
26757
|
-
pageSize: PAGE_SIZE$4
|
|
26758
|
-
});
|
|
26759
|
-
const { transactions, isLoading, count: count2 } = useStoreCreditAccountTransactions(
|
|
26760
|
-
id,
|
|
26761
|
-
{
|
|
26762
|
-
...queryParams,
|
|
26763
|
-
order: queryParams.order ?? "-created_at",
|
|
26764
|
-
fields: "*account"
|
|
26765
|
-
}
|
|
26766
|
-
);
|
|
26767
|
-
const columns = useTransactionsTableColumns();
|
|
26768
|
-
const filters = useTransactionsTableFilters({});
|
|
26769
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
26770
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
26771
|
-
DataTable,
|
|
26772
|
-
{
|
|
26773
|
-
data: transactions ?? [],
|
|
26774
|
-
getRowId: (row) => row.id,
|
|
26775
|
-
columns,
|
|
26776
|
-
filters,
|
|
26777
|
-
isLoading,
|
|
26778
|
-
pageSize: PAGE_SIZE$4,
|
|
26779
|
-
rowCount: count2,
|
|
26780
|
-
enableSearch: false,
|
|
26781
|
-
heading: "Transactions",
|
|
26782
|
-
emptyState: {
|
|
26783
|
-
empty: {
|
|
26784
|
-
heading: "No transactions found"
|
|
26785
|
-
},
|
|
26786
|
-
filtered: {
|
|
26787
|
-
heading: "No results found",
|
|
26788
|
-
description: "No transactions match your filter criteria."
|
|
26789
|
-
}
|
|
26790
|
-
}
|
|
26791
|
-
}
|
|
26792
|
-
) }),
|
|
26793
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
26794
|
-
] });
|
|
26795
|
-
}
|
|
26796
27217
|
const GiftCardTransactionsSection = ({
|
|
26797
27218
|
storeCreditAccount
|
|
26798
27219
|
}) => {
|
|
@@ -26842,33 +27263,73 @@ const GiftCardDetailsPage = () => {
|
|
|
26842
27263
|
}
|
|
26843
27264
|
);
|
|
26844
27265
|
};
|
|
26845
|
-
const
|
|
26846
|
-
const
|
|
26847
|
-
|
|
26848
|
-
|
|
26849
|
-
|
|
26850
|
-
|
|
26851
|
-
|
|
26852
|
-
|
|
26853
|
-
|
|
26854
|
-
|
|
26855
|
-
|
|
26856
|
-
|
|
26857
|
-
|
|
27266
|
+
const Note = () => {
|
|
27267
|
+
const { id } = reactRouterDom.useParams();
|
|
27268
|
+
const {
|
|
27269
|
+
gift_card: giftCard,
|
|
27270
|
+
isPending,
|
|
27271
|
+
isError,
|
|
27272
|
+
error
|
|
27273
|
+
} = useGiftCard(id, {});
|
|
27274
|
+
if (isError) {
|
|
27275
|
+
throw error;
|
|
27276
|
+
}
|
|
27277
|
+
const isReady = !isPending && !!giftCard;
|
|
27278
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
27279
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
27280
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit note" }) }),
|
|
27281
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the note for the gift card" }) })
|
|
27282
|
+
] }),
|
|
27283
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(GiftCardNoteForm, { giftCard })
|
|
27284
|
+
] });
|
|
27285
|
+
};
|
|
27286
|
+
const GiftCardNoteForm = ({ giftCard }) => {
|
|
27287
|
+
const form = useForm({
|
|
27288
|
+
defaultValues: {
|
|
27289
|
+
note: giftCard.note ?? ""
|
|
27290
|
+
},
|
|
27291
|
+
resolver: u(schema$1)
|
|
27292
|
+
});
|
|
27293
|
+
const { mutateAsync, isPending } = useUpdateGiftCard(giftCard.id);
|
|
27294
|
+
const { handleSuccess } = useRouteModal();
|
|
27295
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
27296
|
+
await mutateAsync(
|
|
27297
|
+
{ note: data.note },
|
|
27298
|
+
{
|
|
27299
|
+
onSuccess: () => handleSuccess(),
|
|
27300
|
+
onError: (error) => ui.toast.error(error.message)
|
|
26858
27301
|
}
|
|
26859
|
-
|
|
26860
|
-
};
|
|
26861
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
26862
|
-
|
|
27302
|
+
);
|
|
27303
|
+
});
|
|
27304
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
27305
|
+
KeyboundForm,
|
|
26863
27306
|
{
|
|
26864
|
-
|
|
26865
|
-
onSubmit
|
|
26866
|
-
|
|
26867
|
-
|
|
27307
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
27308
|
+
onSubmit,
|
|
27309
|
+
children: [
|
|
27310
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
27311
|
+
Form$2.Field,
|
|
27312
|
+
{
|
|
27313
|
+
control: form.control,
|
|
27314
|
+
name: "note",
|
|
27315
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
27316
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Note" }),
|
|
27317
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Textarea, { ...field }) }),
|
|
27318
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
27319
|
+
] })
|
|
27320
|
+
}
|
|
27321
|
+
) }),
|
|
27322
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
27323
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
27324
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
27325
|
+
] }) })
|
|
27326
|
+
]
|
|
26868
27327
|
}
|
|
26869
|
-
);
|
|
27328
|
+
) });
|
|
27329
|
+
};
|
|
27330
|
+
const schema$1 = zod.z.object({
|
|
27331
|
+
note: zod.z.string().optional()
|
|
26870
27332
|
});
|
|
26871
|
-
KeyboundForm.displayName = "KeyboundForm";
|
|
26872
27333
|
const GiftCardExpiration = () => {
|
|
26873
27334
|
const { id } = reactRouterDom.useParams();
|
|
26874
27335
|
const { gift_card: giftCard, isPending, isError, error } = useGiftCard(id);
|
|
@@ -26889,7 +27350,7 @@ const GiftCardExpirationForm = ({ giftCard }) => {
|
|
|
26889
27350
|
defaultValues: {
|
|
26890
27351
|
expires_at: giftCard.expires_at ? new Date(giftCard.expires_at) : null
|
|
26891
27352
|
},
|
|
26892
|
-
resolver: u(schema
|
|
27353
|
+
resolver: u(schema)
|
|
26893
27354
|
});
|
|
26894
27355
|
const { mutateAsync, isPending } = useUpdateGiftCard(giftCard.id);
|
|
26895
27356
|
const { handleSuccess } = useRouteModal();
|
|
@@ -26984,76 +27445,9 @@ const GiftCardExpirationForm = ({ giftCard }) => {
|
|
|
26984
27445
|
}
|
|
26985
27446
|
) });
|
|
26986
27447
|
};
|
|
26987
|
-
const schema
|
|
27448
|
+
const schema = zod.z.object({
|
|
26988
27449
|
expires_at: zod.z.date().nullish()
|
|
26989
27450
|
});
|
|
26990
|
-
const Note$1 = () => {
|
|
26991
|
-
const { id } = reactRouterDom.useParams();
|
|
26992
|
-
const {
|
|
26993
|
-
gift_card: giftCard,
|
|
26994
|
-
isPending,
|
|
26995
|
-
isError,
|
|
26996
|
-
error
|
|
26997
|
-
} = useGiftCard(id, {});
|
|
26998
|
-
if (isError) {
|
|
26999
|
-
throw error;
|
|
27000
|
-
}
|
|
27001
|
-
const isReady = !isPending && !!giftCard;
|
|
27002
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
27003
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
27004
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit note" }) }),
|
|
27005
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Edit the note for the gift card" }) })
|
|
27006
|
-
] }),
|
|
27007
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(GiftCardNoteForm, { giftCard })
|
|
27008
|
-
] });
|
|
27009
|
-
};
|
|
27010
|
-
const GiftCardNoteForm = ({ giftCard }) => {
|
|
27011
|
-
const form = useForm({
|
|
27012
|
-
defaultValues: {
|
|
27013
|
-
note: giftCard.note ?? ""
|
|
27014
|
-
},
|
|
27015
|
-
resolver: u(schema$2)
|
|
27016
|
-
});
|
|
27017
|
-
const { mutateAsync, isPending } = useUpdateGiftCard(giftCard.id);
|
|
27018
|
-
const { handleSuccess } = useRouteModal();
|
|
27019
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
27020
|
-
await mutateAsync(
|
|
27021
|
-
{ note: data.note },
|
|
27022
|
-
{
|
|
27023
|
-
onSuccess: () => handleSuccess(),
|
|
27024
|
-
onError: (error) => ui.toast.error(error.message)
|
|
27025
|
-
}
|
|
27026
|
-
);
|
|
27027
|
-
});
|
|
27028
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
27029
|
-
KeyboundForm,
|
|
27030
|
-
{
|
|
27031
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
27032
|
-
onSubmit,
|
|
27033
|
-
children: [
|
|
27034
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
27035
|
-
Form$2.Field,
|
|
27036
|
-
{
|
|
27037
|
-
control: form.control,
|
|
27038
|
-
name: "note",
|
|
27039
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
27040
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Note" }),
|
|
27041
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Textarea, { ...field }) }),
|
|
27042
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
27043
|
-
] })
|
|
27044
|
-
}
|
|
27045
|
-
) }),
|
|
27046
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
27047
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
27048
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
27049
|
-
] }) })
|
|
27050
|
-
]
|
|
27051
|
-
}
|
|
27052
|
-
) });
|
|
27053
|
-
};
|
|
27054
|
-
const schema$2 = zod.z.object({
|
|
27055
|
-
note: zod.z.string().optional()
|
|
27056
|
-
});
|
|
27057
27451
|
const columnHelper$7 = createColumnHelper();
|
|
27058
27452
|
const useGiftCardProductsTableColumns = () => {
|
|
27059
27453
|
return React.useMemo(
|
|
@@ -40711,7 +41105,7 @@ const GiftCardProductCreate = () => {
|
|
|
40711
41105
|
isPending: isStorePending,
|
|
40712
41106
|
isError: isStoreError,
|
|
40713
41107
|
error: storeError
|
|
40714
|
-
} = useStore$
|
|
41108
|
+
} = useStore$1({
|
|
40715
41109
|
fields: "+default_sales_channel"
|
|
40716
41110
|
});
|
|
40717
41111
|
const {
|
|
@@ -40763,400 +41157,6 @@ const GiftCardProductCreate = () => {
|
|
|
40763
41157
|
)
|
|
40764
41158
|
] });
|
|
40765
41159
|
};
|
|
40766
|
-
const StoreCreditAccountBalanceSection = ({
|
|
40767
|
-
storeCreditAccount
|
|
40768
|
-
}) => {
|
|
40769
|
-
if (!storeCreditAccount || typeof storeCreditAccount.balance === "undefined") {
|
|
40770
|
-
return;
|
|
40771
|
-
}
|
|
40772
|
-
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: [
|
|
40773
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-ui-tag-green-icon h-8 w-1 rounded-full" }),
|
|
40774
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
40775
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", size: "small", className: "text-ui-fg-subtle", children: "Current Balance" }),
|
|
40776
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
40777
|
-
ui.Text,
|
|
40778
|
-
{
|
|
40779
|
-
weight: "plus",
|
|
40780
|
-
size: "xlarge",
|
|
40781
|
-
className: "tabular-nums text-ui-fg-base",
|
|
40782
|
-
children: formatAmount(
|
|
40783
|
-
storeCreditAccount.balance,
|
|
40784
|
-
storeCreditAccount.currency_code
|
|
40785
|
-
)
|
|
40786
|
-
}
|
|
40787
|
-
)
|
|
40788
|
-
] })
|
|
40789
|
-
] }) });
|
|
40790
|
-
};
|
|
40791
|
-
const StoreCreditAccountDetailsSection = ({
|
|
40792
|
-
storeCreditAccount
|
|
40793
|
-
}) => {
|
|
40794
|
-
if (!storeCreditAccount || typeof storeCreditAccount.balance === "undefined") {
|
|
40795
|
-
return;
|
|
40796
|
-
}
|
|
40797
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "flex justify-between gap-x-2 px-6 py-6", children: [
|
|
40798
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
40799
|
-
ui.Text,
|
|
40800
|
-
{
|
|
40801
|
-
weight: "plus",
|
|
40802
|
-
size: "xlarge",
|
|
40803
|
-
className: "text-ui-fg-base flex gap-x-4",
|
|
40804
|
-
children: [
|
|
40805
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
40806
|
-
/* @__PURE__ */ jsxRuntime.jsx(CreditCardIcon, { className: "inline" }),
|
|
40807
|
-
" "
|
|
40808
|
-
] }),
|
|
40809
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
40810
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-ui-fg-subtle", children: [
|
|
40811
|
-
storeCreditAccount.currency_code.toUpperCase(),
|
|
40812
|
-
" Account"
|
|
40813
|
-
] }),
|
|
40814
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-base", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
40815
|
-
ui.Text,
|
|
40816
|
-
{
|
|
40817
|
-
weight: "regular",
|
|
40818
|
-
size: "small",
|
|
40819
|
-
className: "text-ui-fg-base flex gap-x-4",
|
|
40820
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(DisplayId, { id: storeCreditAccount.id })
|
|
40821
|
-
}
|
|
40822
|
-
) })
|
|
40823
|
-
] })
|
|
40824
|
-
]
|
|
40825
|
-
}
|
|
40826
|
-
),
|
|
40827
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-x-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
40828
|
-
ActionMenu,
|
|
40829
|
-
{
|
|
40830
|
-
groups: [
|
|
40831
|
-
{
|
|
40832
|
-
actions: [
|
|
40833
|
-
{
|
|
40834
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CreditCard, {}),
|
|
40835
|
-
label: "Credit the account",
|
|
40836
|
-
to: "credit"
|
|
40837
|
-
},
|
|
40838
|
-
{
|
|
40839
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.MinusMini, {}),
|
|
40840
|
-
label: "Debit the account",
|
|
40841
|
-
to: "debit",
|
|
40842
|
-
disabled: !Number(storeCreditAccount.balance)
|
|
40843
|
-
}
|
|
40844
|
-
]
|
|
40845
|
-
}
|
|
40846
|
-
]
|
|
40847
|
-
}
|
|
40848
|
-
) })
|
|
40849
|
-
] });
|
|
40850
|
-
};
|
|
40851
|
-
function StoreCreditAccountCustomerSection({
|
|
40852
|
-
customerId
|
|
40853
|
-
}) {
|
|
40854
|
-
const { customer, isPending } = useCustomer(customerId, void 0, {
|
|
40855
|
-
enabled: !!customerId
|
|
40856
|
-
});
|
|
40857
|
-
if (isPending || !customer) {
|
|
40858
|
-
return null;
|
|
40859
|
-
}
|
|
40860
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0", children: [
|
|
40861
|
-
/* @__PURE__ */ jsxRuntime.jsx(Header$5, { title: "Customer" }),
|
|
40862
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
40863
|
-
SidebarLink,
|
|
40864
|
-
{
|
|
40865
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.User, {}),
|
|
40866
|
-
labelKey: customer.email || "N/A",
|
|
40867
|
-
descriptionKey: !customer.first_name && !customer.last_name ? "N/A" : `${customer.first_name} ${customer.last_name}`,
|
|
40868
|
-
to: `/customers/${customer.id}`
|
|
40869
|
-
},
|
|
40870
|
-
customer.id
|
|
40871
|
-
)
|
|
40872
|
-
] });
|
|
40873
|
-
}
|
|
40874
|
-
function StoreCreditAccountCodeSection({ code }) {
|
|
40875
|
-
if (!code) {
|
|
40876
|
-
return null;
|
|
40877
|
-
}
|
|
40878
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0", children: [
|
|
40879
|
-
/* @__PURE__ */ jsxRuntime.jsx(Header$5, { title: "Account Code" }),
|
|
40880
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-4 px-6 mb-2", children: [
|
|
40881
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.Share, { className: "inline" }),
|
|
40882
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle text-sm", children: code })
|
|
40883
|
-
] })
|
|
40884
|
-
] });
|
|
40885
|
-
}
|
|
40886
|
-
const StoreCreditAccountPage = () => {
|
|
40887
|
-
const { id } = reactRouterDom.useParams();
|
|
40888
|
-
const { store_credit_account: storeCreditAccount } = useStoreCreditAccount(
|
|
40889
|
-
id
|
|
40890
|
-
);
|
|
40891
|
-
if (!storeCreditAccount) {
|
|
40892
|
-
return;
|
|
40893
|
-
}
|
|
40894
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
40895
|
-
components.LayoutComposer,
|
|
40896
|
-
{
|
|
40897
|
-
widgetsZonePrefix: "store_credit_account.details",
|
|
40898
|
-
preferredLayoutId: "core:two-column",
|
|
40899
|
-
data: storeCreditAccount,
|
|
40900
|
-
sections: {
|
|
40901
|
-
main: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
40902
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountDetailsSection", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
40903
|
-
StoreCreditAccountDetailsSection,
|
|
40904
|
-
{
|
|
40905
|
-
storeCreditAccount
|
|
40906
|
-
}
|
|
40907
|
-
) }),
|
|
40908
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "TransactionsTable", children: /* @__PURE__ */ jsxRuntime.jsx(TransactionsTable, { id: storeCreditAccount.id }) })
|
|
40909
|
-
] }),
|
|
40910
|
-
side: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
40911
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountBalanceSection", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
40912
|
-
StoreCreditAccountBalanceSection,
|
|
40913
|
-
{
|
|
40914
|
-
storeCreditAccount
|
|
40915
|
-
}
|
|
40916
|
-
) }),
|
|
40917
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountCodeSection", children: /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountCodeSection, { code: storeCreditAccount.code }) }),
|
|
40918
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountCustomerSection", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
40919
|
-
StoreCreditAccountCustomerSection,
|
|
40920
|
-
{
|
|
40921
|
-
customerId: storeCreditAccount.customer_id
|
|
40922
|
-
}
|
|
40923
|
-
) })
|
|
40924
|
-
] })
|
|
40925
|
-
}
|
|
40926
|
-
}
|
|
40927
|
-
);
|
|
40928
|
-
};
|
|
40929
|
-
const Note = () => {
|
|
40930
|
-
const { id } = reactRouterDom.useParams();
|
|
40931
|
-
const {
|
|
40932
|
-
store_credit_account: storeCreditAccount,
|
|
40933
|
-
isPending,
|
|
40934
|
-
isError,
|
|
40935
|
-
error
|
|
40936
|
-
} = useStoreCreditAccount(id, {});
|
|
40937
|
-
if (isError) {
|
|
40938
|
-
throw error;
|
|
40939
|
-
}
|
|
40940
|
-
const isReady = !isPending && !!storeCreditAccount;
|
|
40941
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
40942
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
40943
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Credit store credit account" }) }),
|
|
40944
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Credit the store credit account" }) })
|
|
40945
|
-
] }),
|
|
40946
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountCreditForm, { storeCreditAccount })
|
|
40947
|
-
] });
|
|
40948
|
-
};
|
|
40949
|
-
const StoreCreditAccountCreditForm = ({
|
|
40950
|
-
storeCreditAccount
|
|
40951
|
-
}) => {
|
|
40952
|
-
const form = useForm({
|
|
40953
|
-
defaultValues: {
|
|
40954
|
-
amount: {
|
|
40955
|
-
float: 0,
|
|
40956
|
-
value: ""
|
|
40957
|
-
},
|
|
40958
|
-
note: ""
|
|
40959
|
-
},
|
|
40960
|
-
resolver: u(schema$1)
|
|
40961
|
-
});
|
|
40962
|
-
const { mutateAsync, isPending } = useCreditStoreCreditAccount(
|
|
40963
|
-
storeCreditAccount.id
|
|
40964
|
-
);
|
|
40965
|
-
const { handleSuccess } = useRouteModal();
|
|
40966
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
40967
|
-
if (data.amount.float <= 0) {
|
|
40968
|
-
form.setError("amount", { message: "Amount must be greater than 0" });
|
|
40969
|
-
return;
|
|
40970
|
-
}
|
|
40971
|
-
await mutateAsync(
|
|
40972
|
-
{ amount: data.amount.float, note: data.note },
|
|
40973
|
-
{
|
|
40974
|
-
onSuccess: () => handleSuccess(),
|
|
40975
|
-
onError: (error) => ui.toast.error(error.message)
|
|
40976
|
-
}
|
|
40977
|
-
);
|
|
40978
|
-
});
|
|
40979
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
40980
|
-
KeyboundForm,
|
|
40981
|
-
{
|
|
40982
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
40983
|
-
onSubmit,
|
|
40984
|
-
children: [
|
|
40985
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
|
|
40986
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
40987
|
-
Form$2.Field,
|
|
40988
|
-
{
|
|
40989
|
-
control: form.control,
|
|
40990
|
-
name: "amount",
|
|
40991
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
40992
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Amount" }),
|
|
40993
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
40994
|
-
ui.CurrencyInput,
|
|
40995
|
-
{
|
|
40996
|
-
min: 0,
|
|
40997
|
-
placeholder: "0",
|
|
40998
|
-
value: field.value.value,
|
|
40999
|
-
onValueChange: (_value, _name, values) => {
|
|
41000
|
-
field.onChange({
|
|
41001
|
-
value: values?.value,
|
|
41002
|
-
float: values?.float || null
|
|
41003
|
-
});
|
|
41004
|
-
},
|
|
41005
|
-
symbol: currencies[storeCreditAccount.currency_code.toUpperCase()].symbol_native,
|
|
41006
|
-
code: storeCreditAccount.currency_code.toUpperCase()
|
|
41007
|
-
}
|
|
41008
|
-
) }),
|
|
41009
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
41010
|
-
] })
|
|
41011
|
-
}
|
|
41012
|
-
),
|
|
41013
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
41014
|
-
Form$2.Field,
|
|
41015
|
-
{
|
|
41016
|
-
control: form.control,
|
|
41017
|
-
name: "note",
|
|
41018
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
41019
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Note" }),
|
|
41020
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Textarea, { ...field }) }),
|
|
41021
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
41022
|
-
] })
|
|
41023
|
-
}
|
|
41024
|
-
)
|
|
41025
|
-
] }),
|
|
41026
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
41027
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
41028
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
41029
|
-
] }) })
|
|
41030
|
-
]
|
|
41031
|
-
}
|
|
41032
|
-
) });
|
|
41033
|
-
};
|
|
41034
|
-
const schema$1 = zod.z.object({
|
|
41035
|
-
note: zod.z.string(),
|
|
41036
|
-
amount: zod.z.object({
|
|
41037
|
-
float: zod.z.number(),
|
|
41038
|
-
value: zod.z.string()
|
|
41039
|
-
})
|
|
41040
|
-
});
|
|
41041
|
-
const Debit = () => {
|
|
41042
|
-
const { id } = reactRouterDom.useParams();
|
|
41043
|
-
const {
|
|
41044
|
-
store_credit_account: storeCreditAccount,
|
|
41045
|
-
isPending,
|
|
41046
|
-
isError,
|
|
41047
|
-
error
|
|
41048
|
-
} = useStoreCreditAccount(id, {});
|
|
41049
|
-
if (isError) {
|
|
41050
|
-
throw error;
|
|
41051
|
-
}
|
|
41052
|
-
const isReady = !isPending && !!storeCreditAccount;
|
|
41053
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
41054
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
41055
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Debit store credit account" }) }),
|
|
41056
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Debit the store credit account" }) })
|
|
41057
|
-
] }),
|
|
41058
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountDebitForm, { storeCreditAccount })
|
|
41059
|
-
] });
|
|
41060
|
-
};
|
|
41061
|
-
const StoreCreditAccountDebitForm = ({
|
|
41062
|
-
storeCreditAccount
|
|
41063
|
-
}) => {
|
|
41064
|
-
const form = useForm({
|
|
41065
|
-
defaultValues: {
|
|
41066
|
-
amount: {
|
|
41067
|
-
float: 0,
|
|
41068
|
-
value: ""
|
|
41069
|
-
},
|
|
41070
|
-
note: ""
|
|
41071
|
-
},
|
|
41072
|
-
resolver: u(schema)
|
|
41073
|
-
});
|
|
41074
|
-
const { mutateAsync, isPending } = useDebitStoreCreditAccount(
|
|
41075
|
-
storeCreditAccount.id
|
|
41076
|
-
);
|
|
41077
|
-
const { handleSuccess } = useRouteModal();
|
|
41078
|
-
const balance = storeCreditAccount.balance ?? 0;
|
|
41079
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
41080
|
-
if (data.amount.float <= 0) {
|
|
41081
|
-
form.setError("amount", { message: "Amount must be greater than 0" });
|
|
41082
|
-
return;
|
|
41083
|
-
}
|
|
41084
|
-
if (data.amount.float > balance) {
|
|
41085
|
-
form.setError("amount", {
|
|
41086
|
-
message: "Amount can't be greater than the current balance"
|
|
41087
|
-
});
|
|
41088
|
-
return;
|
|
41089
|
-
}
|
|
41090
|
-
await mutateAsync(
|
|
41091
|
-
{ amount: data.amount.float, note: data.note },
|
|
41092
|
-
{
|
|
41093
|
-
onSuccess: () => handleSuccess(),
|
|
41094
|
-
onError: (error) => ui.toast.error(error.message)
|
|
41095
|
-
}
|
|
41096
|
-
);
|
|
41097
|
-
});
|
|
41098
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
41099
|
-
KeyboundForm,
|
|
41100
|
-
{
|
|
41101
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
41102
|
-
onSubmit,
|
|
41103
|
-
children: [
|
|
41104
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
|
|
41105
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
41106
|
-
Form$2.Field,
|
|
41107
|
-
{
|
|
41108
|
-
control: form.control,
|
|
41109
|
-
name: "amount",
|
|
41110
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
41111
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Amount" }),
|
|
41112
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
41113
|
-
ui.CurrencyInput,
|
|
41114
|
-
{
|
|
41115
|
-
min: 0,
|
|
41116
|
-
placeholder: "0",
|
|
41117
|
-
value: field.value.value,
|
|
41118
|
-
onValueChange: (_value, _name, values) => {
|
|
41119
|
-
field.onChange({
|
|
41120
|
-
value: values?.value,
|
|
41121
|
-
float: values?.float || null
|
|
41122
|
-
});
|
|
41123
|
-
},
|
|
41124
|
-
symbol: currencies[storeCreditAccount.currency_code.toUpperCase()].symbol_native,
|
|
41125
|
-
code: storeCreditAccount.currency_code.toUpperCase()
|
|
41126
|
-
}
|
|
41127
|
-
) }),
|
|
41128
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
41129
|
-
] })
|
|
41130
|
-
}
|
|
41131
|
-
),
|
|
41132
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
41133
|
-
Form$2.Field,
|
|
41134
|
-
{
|
|
41135
|
-
control: form.control,
|
|
41136
|
-
name: "note",
|
|
41137
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
41138
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Note" }),
|
|
41139
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Textarea, { ...field }) }),
|
|
41140
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
41141
|
-
] })
|
|
41142
|
-
}
|
|
41143
|
-
)
|
|
41144
|
-
] }),
|
|
41145
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
41146
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
41147
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
41148
|
-
] }) })
|
|
41149
|
-
]
|
|
41150
|
-
}
|
|
41151
|
-
) });
|
|
41152
|
-
};
|
|
41153
|
-
const schema = zod.z.object({
|
|
41154
|
-
note: zod.z.string(),
|
|
41155
|
-
amount: zod.z.object({
|
|
41156
|
-
float: zod.z.number(),
|
|
41157
|
-
value: zod.z.string()
|
|
41158
|
-
})
|
|
41159
|
-
});
|
|
41160
41160
|
const productStatusColor = (status) => {
|
|
41161
41161
|
switch (status) {
|
|
41162
41162
|
case "draft":
|
|
@@ -42590,7 +42590,7 @@ const ProductMedia = () => {
|
|
|
42590
42590
|
] });
|
|
42591
42591
|
};
|
|
42592
42592
|
const VariantPricingForm = ({ form }) => {
|
|
42593
|
-
const { store } = useStore$
|
|
42593
|
+
const { store } = useStore$1();
|
|
42594
42594
|
const { regions } = useRegions({ limit: 9999 });
|
|
42595
42595
|
const { price_preferences: pricePreferences } = usePricePreferences({});
|
|
42596
42596
|
const { setCloseOnEscape } = useRouteModal();
|
|
@@ -42865,10 +42865,21 @@ const widgetModule = { widgets: [
|
|
|
42865
42865
|
] };
|
|
42866
42866
|
const routeModule = {
|
|
42867
42867
|
routes: [
|
|
42868
|
+
{
|
|
42869
|
+
Component: StoreCreditAccountsPage,
|
|
42870
|
+
path: "/store-credit-accounts",
|
|
42871
|
+
handle: { label: config$3.label, translationNs: config$3.translationNs },
|
|
42872
|
+
children: [
|
|
42873
|
+
{
|
|
42874
|
+
Component: StoreCreditAccountCreate,
|
|
42875
|
+
path: "/store-credit-accounts/create"
|
|
42876
|
+
}
|
|
42877
|
+
]
|
|
42878
|
+
},
|
|
42868
42879
|
{
|
|
42869
42880
|
Component: GiftCardsPage,
|
|
42870
42881
|
path: "/gift-cards",
|
|
42871
|
-
handle: { label: config$
|
|
42882
|
+
handle: { label: config$2.label, translationNs: config$2.translationNs },
|
|
42872
42883
|
children: [
|
|
42873
42884
|
{
|
|
42874
42885
|
Component: GiftCardCreate,
|
|
@@ -42877,13 +42888,16 @@ const routeModule = {
|
|
|
42877
42888
|
]
|
|
42878
42889
|
},
|
|
42879
42890
|
{
|
|
42880
|
-
Component:
|
|
42881
|
-
path: "/store-credit-accounts",
|
|
42882
|
-
handle: { label: config$1.label, translationNs: config$1.translationNs },
|
|
42891
|
+
Component: StoreCreditAccountPage,
|
|
42892
|
+
path: "/store-credit-accounts/:id",
|
|
42883
42893
|
children: [
|
|
42884
42894
|
{
|
|
42885
|
-
Component:
|
|
42886
|
-
path: "/store-credit-accounts/
|
|
42895
|
+
Component: Note$1,
|
|
42896
|
+
path: "/store-credit-accounts/:id/credit"
|
|
42897
|
+
},
|
|
42898
|
+
{
|
|
42899
|
+
Component: Debit,
|
|
42900
|
+
path: "/store-credit-accounts/:id/debit"
|
|
42887
42901
|
}
|
|
42888
42902
|
]
|
|
42889
42903
|
},
|
|
@@ -42892,12 +42906,12 @@ const routeModule = {
|
|
|
42892
42906
|
path: "/gift-cards/:id",
|
|
42893
42907
|
children: [
|
|
42894
42908
|
{
|
|
42895
|
-
Component:
|
|
42896
|
-
path: "/gift-cards/:id/
|
|
42909
|
+
Component: Note,
|
|
42910
|
+
path: "/gift-cards/:id/note"
|
|
42897
42911
|
},
|
|
42898
42912
|
{
|
|
42899
|
-
Component:
|
|
42900
|
-
path: "/gift-cards/:id/
|
|
42913
|
+
Component: GiftCardExpiration,
|
|
42914
|
+
path: "/gift-cards/:id/expiration"
|
|
42901
42915
|
}
|
|
42902
42916
|
]
|
|
42903
42917
|
},
|
|
@@ -42912,20 +42926,6 @@ const routeModule = {
|
|
|
42912
42926
|
}
|
|
42913
42927
|
]
|
|
42914
42928
|
},
|
|
42915
|
-
{
|
|
42916
|
-
Component: StoreCreditAccountPage,
|
|
42917
|
-
path: "/store-credit-accounts/:id",
|
|
42918
|
-
children: [
|
|
42919
|
-
{
|
|
42920
|
-
Component: Note,
|
|
42921
|
-
path: "/store-credit-accounts/:id/credit"
|
|
42922
|
-
},
|
|
42923
|
-
{
|
|
42924
|
-
Component: Debit,
|
|
42925
|
-
path: "/store-credit-accounts/:id/debit"
|
|
42926
|
-
}
|
|
42927
|
-
]
|
|
42928
|
-
},
|
|
42929
42929
|
{
|
|
42930
42930
|
Component: ProductDetail,
|
|
42931
42931
|
path: "/gift-cards/gift-card-products/:id",
|
|
@@ -42959,15 +42959,15 @@ const menuItemModule = {
|
|
|
42959
42959
|
{
|
|
42960
42960
|
label: config$3.label,
|
|
42961
42961
|
icon: config$3.icon,
|
|
42962
|
-
path: "/
|
|
42962
|
+
path: "/store-credit-accounts",
|
|
42963
42963
|
nested: void 0,
|
|
42964
42964
|
rank: void 0,
|
|
42965
42965
|
translationNs: void 0
|
|
42966
42966
|
},
|
|
42967
42967
|
{
|
|
42968
|
-
label: config$
|
|
42969
|
-
icon: config$
|
|
42970
|
-
path: "/
|
|
42968
|
+
label: config$2.label,
|
|
42969
|
+
icon: config$2.icon,
|
|
42970
|
+
path: "/gift-cards",
|
|
42971
42971
|
nested: void 0,
|
|
42972
42972
|
rank: void 0,
|
|
42973
42973
|
translationNs: void 0
|