@medusajs/loyalty-plugin 2.22.2-preview-20261029142542 → 2.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.medusa/server/src/admin/index.js +1629 -1629
- package/.medusa/server/src/admin/index.mjs +1631 -1631
- package/package.json +19 -19
|
@@ -8,8 +8,8 @@ const icons = require("@medusajs/icons");
|
|
|
8
8
|
const reactQuery = require("@tanstack/react-query");
|
|
9
9
|
const Medusa = require("@medusajs/js-sdk");
|
|
10
10
|
const components = require("@medusajs/dashboard/components");
|
|
11
|
-
const ReactDOM = require("react-dom");
|
|
12
11
|
const zod = require("@medusajs/framework/zod");
|
|
12
|
+
const ReactDOM = require("react-dom");
|
|
13
13
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
14
14
|
function _interopNamespace(e) {
|
|
15
15
|
if (e && e.__esModule) return e;
|
|
@@ -5764,7 +5764,7 @@ adminSdk.defineWidgetConfig({
|
|
|
5764
5764
|
zone: "sales_channel.details.after",
|
|
5765
5765
|
id: "medusa:sales-channel-gift-cards-widget"
|
|
5766
5766
|
});
|
|
5767
|
-
const
|
|
5767
|
+
const StoreCreditIcon = (props) => {
|
|
5768
5768
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5769
5769
|
"svg",
|
|
5770
5770
|
{
|
|
@@ -5775,197 +5775,49 @@ const GiftCardIcon = (props) => {
|
|
|
5775
5775
|
xmlns: "http://www.w3.org/2000/svg",
|
|
5776
5776
|
...props,
|
|
5777
5777
|
children: [
|
|
5778
|
-
/* @__PURE__ */ jsxRuntime.jsx("rect", { width: "15", height: "15", fill: "#
|
|
5778
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { width: "15", height: "15", fill: "#8B5CF6" }),
|
|
5779
5779
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5780
5780
|
"rect",
|
|
5781
5781
|
{
|
|
5782
5782
|
width: "15",
|
|
5783
5783
|
height: "15",
|
|
5784
|
-
fill: "url(#
|
|
5784
|
+
fill: "url(#paint0_linear_29181_44790)",
|
|
5785
5785
|
fillOpacity: "0.2"
|
|
5786
5786
|
}
|
|
5787
5787
|
),
|
|
5788
|
-
/* @__PURE__ */ jsxRuntime.
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5818
|
-
"path",
|
|
5819
|
-
{
|
|
5820
|
-
d: "M8.063 7.5V11.625H9.188C10.325 11.625 11.25 10.7 11.25 9.563V7.5H8.063Z",
|
|
5821
|
-
fill: "white"
|
|
5822
|
-
}
|
|
5823
|
-
)
|
|
5824
|
-
] }),
|
|
5825
|
-
/* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
|
|
5826
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
5827
|
-
"linearGradient",
|
|
5828
|
-
{
|
|
5829
|
-
id: "paint0_linear_28788_25808",
|
|
5830
|
-
x1: "7.5",
|
|
5831
|
-
y1: "0",
|
|
5832
|
-
x2: "7.5",
|
|
5833
|
-
y2: "15",
|
|
5834
|
-
gradientUnits: "userSpaceOnUse",
|
|
5835
|
-
children: [
|
|
5836
|
-
/* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "white" }),
|
|
5837
|
-
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })
|
|
5838
|
-
]
|
|
5839
|
-
}
|
|
5840
|
-
),
|
|
5841
|
-
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_28788_25808", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "9", height: "9", fill: "white", transform: "translate(3 3)" }) })
|
|
5842
|
-
] })
|
|
5788
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5789
|
+
"path",
|
|
5790
|
+
{
|
|
5791
|
+
d: "M12 6V5.813C12 4.675 11.075 3.75 9.938 3.75H5.063C3.925 3.75 3 4.675 3 5.813V6H12Z",
|
|
5792
|
+
fill: "white"
|
|
5793
|
+
}
|
|
5794
|
+
),
|
|
5795
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5796
|
+
"path",
|
|
5797
|
+
{
|
|
5798
|
+
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",
|
|
5799
|
+
fill: "white"
|
|
5800
|
+
}
|
|
5801
|
+
),
|
|
5802
|
+
/* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5803
|
+
"linearGradient",
|
|
5804
|
+
{
|
|
5805
|
+
id: "paint0_linear_29181_44790",
|
|
5806
|
+
x1: "7.5",
|
|
5807
|
+
y1: "0",
|
|
5808
|
+
x2: "7.5",
|
|
5809
|
+
y2: "15",
|
|
5810
|
+
gradientUnits: "userSpaceOnUse",
|
|
5811
|
+
children: [
|
|
5812
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "white" }),
|
|
5813
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })
|
|
5814
|
+
]
|
|
5815
|
+
}
|
|
5816
|
+
) })
|
|
5843
5817
|
]
|
|
5844
5818
|
}
|
|
5845
5819
|
);
|
|
5846
5820
|
};
|
|
5847
|
-
const GiftCardProductsSection = () => {
|
|
5848
|
-
const { products: giftCardProducts, count: count2 = 0 } = useProducts({
|
|
5849
|
-
is_giftcard: true
|
|
5850
|
-
});
|
|
5851
|
-
const slicedProducts = giftCardProducts?.slice(0, 3) ?? [];
|
|
5852
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0", children: [
|
|
5853
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
5854
|
-
/* @__PURE__ */ jsxRuntime.jsx(Header$5, { title: "Gift Card Products" }),
|
|
5855
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5856
|
-
reactRouterDom.Link,
|
|
5857
|
-
{
|
|
5858
|
-
to: `/gift-cards/gift-card-products/create`,
|
|
5859
|
-
className: "text-ui-fg-muted text-sm px-6",
|
|
5860
|
-
children: "Create"
|
|
5861
|
-
}
|
|
5862
|
-
)
|
|
5863
|
-
] }),
|
|
5864
|
-
giftCardProducts?.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5865
|
-
NoRecords,
|
|
5866
|
-
{
|
|
5867
|
-
className: "px-10 py-4 h-[200px]",
|
|
5868
|
-
title: "No gift card products",
|
|
5869
|
-
message: "There are no gift card products to show. Create one to get started.",
|
|
5870
|
-
action: {
|
|
5871
|
-
to: "/gift-cards/gift-card-products/create",
|
|
5872
|
-
label: "Create gift card product"
|
|
5873
|
-
}
|
|
5874
|
-
}
|
|
5875
|
-
),
|
|
5876
|
-
slicedProducts.map((giftCardProduct) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5877
|
-
SidebarLink,
|
|
5878
|
-
{
|
|
5879
|
-
to: `/gift-cards/gift-card-products/${giftCardProduct.id}`,
|
|
5880
|
-
labelKey: giftCardProduct.title,
|
|
5881
|
-
descriptionKey: giftCardProduct.title,
|
|
5882
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Tag, {})
|
|
5883
|
-
}
|
|
5884
|
-
)),
|
|
5885
|
-
count2 > 3 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5886
|
-
reactRouterDom.Link,
|
|
5887
|
-
{
|
|
5888
|
-
to: "/gift-cards/gift-card-products",
|
|
5889
|
-
className: "text-ui-fg-muted text-sm px-6 py-4 flex items-center justify-center",
|
|
5890
|
-
children: "View more"
|
|
5891
|
-
}
|
|
5892
|
-
)
|
|
5893
|
-
] });
|
|
5894
|
-
};
|
|
5895
|
-
const _giftCardQueryKey = queryKeysFactory("gift-card");
|
|
5896
|
-
const giftCardQueryKey = {
|
|
5897
|
-
..._giftCardQueryKey,
|
|
5898
|
-
orders: (id) => [..._giftCardQueryKey.detail(id), "orders"]
|
|
5899
|
-
};
|
|
5900
|
-
const useGiftCards = (query, options) => {
|
|
5901
|
-
const fetchGiftCards = (query2, headers) => sdk.client.fetch(`/admin/gift-cards`, {
|
|
5902
|
-
query: query2,
|
|
5903
|
-
headers
|
|
5904
|
-
});
|
|
5905
|
-
const { data, ...rest } = reactQuery.useQuery({
|
|
5906
|
-
...options,
|
|
5907
|
-
queryFn: () => fetchGiftCards(query),
|
|
5908
|
-
queryKey: giftCardQueryKey.list(query)
|
|
5909
|
-
});
|
|
5910
|
-
return { ...data, ...rest };
|
|
5911
|
-
};
|
|
5912
|
-
const useGiftCard = (id, query, options) => {
|
|
5913
|
-
const fetchGiftCard = (id2, query2, headers) => sdk.client.fetch(`/admin/gift-cards/${id2}`, {
|
|
5914
|
-
query: query2,
|
|
5915
|
-
headers
|
|
5916
|
-
});
|
|
5917
|
-
const { data, ...rest } = reactQuery.useQuery({
|
|
5918
|
-
queryFn: () => fetchGiftCard(id, query),
|
|
5919
|
-
queryKey: giftCardQueryKey.detail(id, query),
|
|
5920
|
-
...options
|
|
5921
|
-
});
|
|
5922
|
-
return { ...data, ...rest };
|
|
5923
|
-
};
|
|
5924
|
-
const useGiftCardOrders = (id, options) => {
|
|
5925
|
-
const fetchGiftCardOrders = (id2, query, headers) => sdk.client.fetch(`/admin/gift-cards/${id2}/orders`, {
|
|
5926
|
-
query,
|
|
5927
|
-
headers
|
|
5928
|
-
});
|
|
5929
|
-
const { data, ...rest } = reactQuery.useQuery({
|
|
5930
|
-
queryFn: () => fetchGiftCardOrders(id),
|
|
5931
|
-
queryKey: giftCardQueryKey.orders(id),
|
|
5932
|
-
...options
|
|
5933
|
-
});
|
|
5934
|
-
return { ...data, ...rest };
|
|
5935
|
-
};
|
|
5936
|
-
const useUpdateGiftCard = (id, options) => {
|
|
5937
|
-
const queryClient = reactQuery.useQueryClient();
|
|
5938
|
-
const updateGiftCard = async (id2, body) => sdk.client.fetch(`/admin/gift-cards/${id2}`, {
|
|
5939
|
-
body,
|
|
5940
|
-
method: "POST"
|
|
5941
|
-
});
|
|
5942
|
-
return reactQuery.useMutation({
|
|
5943
|
-
mutationFn: async (payload) => updateGiftCard(id, payload),
|
|
5944
|
-
onSuccess: (data, variables, context) => {
|
|
5945
|
-
queryClient.invalidateQueries({
|
|
5946
|
-
queryKey: giftCardQueryKey.detail(id)
|
|
5947
|
-
});
|
|
5948
|
-
queryClient.invalidateQueries({
|
|
5949
|
-
queryKey: giftCardQueryKey.lists()
|
|
5950
|
-
});
|
|
5951
|
-
},
|
|
5952
|
-
...options
|
|
5953
|
-
});
|
|
5954
|
-
};
|
|
5955
|
-
const useCreateGiftCard = (options) => {
|
|
5956
|
-
const queryClient = reactQuery.useQueryClient();
|
|
5957
|
-
const createGiftCard = async (body) => sdk.client.fetch(`/admin/gift-cards`, {
|
|
5958
|
-
body,
|
|
5959
|
-
method: "POST"
|
|
5960
|
-
});
|
|
5961
|
-
return reactQuery.useMutation({
|
|
5962
|
-
mutationFn: (body) => createGiftCard(body),
|
|
5963
|
-
onSuccess: (data, variables, context) => {
|
|
5964
|
-
queryClient.invalidateQueries({ queryKey: giftCardQueryKey.lists() });
|
|
5965
|
-
},
|
|
5966
|
-
...options
|
|
5967
|
-
});
|
|
5968
|
-
};
|
|
5969
5821
|
function getRelativeDate(date2) {
|
|
5970
5822
|
const now = /* @__PURE__ */ new Date();
|
|
5971
5823
|
return formatDistance(sub(new Date(date2), { minutes: 0 }), now, {
|
|
@@ -5983,30 +5835,51 @@ function formatDate(date2, withTime = true) {
|
|
|
5983
5835
|
return format(new Date(date2), "dd MMM, yyyy");
|
|
5984
5836
|
}
|
|
5985
5837
|
const columnHelper$a = ui.createDataTableColumnHelper();
|
|
5986
|
-
const
|
|
5838
|
+
const useStoreCreditAccountTableColumns = () => {
|
|
5987
5839
|
return React.useMemo(() => {
|
|
5988
5840
|
return [
|
|
5989
|
-
columnHelper$a.accessor("
|
|
5990
|
-
header: "
|
|
5841
|
+
columnHelper$a.accessor("currency_code", {
|
|
5842
|
+
header: "Currency",
|
|
5991
5843
|
cell: ({ row }) => {
|
|
5992
|
-
return row.original.
|
|
5844
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { size: "2xsmall", children: row.original.currency_code.toUpperCase() });
|
|
5993
5845
|
}
|
|
5994
5846
|
}),
|
|
5995
|
-
columnHelper$a.accessor("
|
|
5996
|
-
header: "
|
|
5847
|
+
columnHelper$a.accessor("customer.email", {
|
|
5848
|
+
header: "Customer",
|
|
5997
5849
|
cell: ({ row }) => {
|
|
5998
|
-
return row.original.
|
|
5850
|
+
return row.original.customer?.email ?? "N/A";
|
|
5999
5851
|
}
|
|
6000
5852
|
}),
|
|
6001
|
-
columnHelper$a.accessor("
|
|
6002
|
-
header: "
|
|
6003
|
-
cell: ({ row }) =>
|
|
5853
|
+
columnHelper$a.accessor("balance", {
|
|
5854
|
+
header: "Balance",
|
|
5855
|
+
cell: ({ row }) => {
|
|
5856
|
+
return formatAmount(
|
|
5857
|
+
row.original.balance,
|
|
5858
|
+
row.original.currency_code
|
|
5859
|
+
);
|
|
5860
|
+
}
|
|
6004
5861
|
}),
|
|
6005
|
-
columnHelper$a.accessor("
|
|
6006
|
-
header: "
|
|
5862
|
+
columnHelper$a.accessor("credits", {
|
|
5863
|
+
header: "Credits",
|
|
6007
5864
|
cell: ({ row }) => {
|
|
6008
|
-
return formatAmount(
|
|
5865
|
+
return formatAmount(
|
|
5866
|
+
row.original.credits,
|
|
5867
|
+
row.original.currency_code
|
|
5868
|
+
);
|
|
5869
|
+
}
|
|
5870
|
+
}),
|
|
5871
|
+
columnHelper$a.accessor("debits", {
|
|
5872
|
+
header: "Debits",
|
|
5873
|
+
cell: ({ row }) => {
|
|
5874
|
+
return formatAmount(
|
|
5875
|
+
row.original.debits,
|
|
5876
|
+
row.original.currency_code
|
|
5877
|
+
);
|
|
6009
5878
|
}
|
|
5879
|
+
}),
|
|
5880
|
+
columnHelper$a.accessor("created_at", {
|
|
5881
|
+
header: "Created at",
|
|
5882
|
+
cell: ({ row }) => getRelativeDate(row.original.created_at)
|
|
6010
5883
|
})
|
|
6011
5884
|
];
|
|
6012
5885
|
}, []);
|
|
@@ -6053,75 +5926,83 @@ const useCustomerFilters = () => {
|
|
|
6053
5926
|
];
|
|
6054
5927
|
}, [customerFilterOptions]);
|
|
6055
5928
|
};
|
|
6056
|
-
const
|
|
5929
|
+
const useStoreCreditAccountFilters = () => {
|
|
6057
5930
|
const dateFilterOptions = useDataTableDateFilters$1();
|
|
6058
5931
|
const customerFilterOptions = useCustomerFilters();
|
|
6059
5932
|
return React.useMemo(() => {
|
|
6060
5933
|
return [...dateFilterOptions, ...customerFilterOptions];
|
|
6061
5934
|
}, [dateFilterOptions, customerFilterOptions]);
|
|
6062
5935
|
};
|
|
6063
|
-
const
|
|
5936
|
+
const useStoreCreditAccountsTableQuery = ({
|
|
6064
5937
|
prefix,
|
|
6065
5938
|
pageSize = 20
|
|
6066
5939
|
}) => {
|
|
6067
5940
|
const queryObject = useQueryParams(
|
|
6068
|
-
["
|
|
5941
|
+
["offset", "customer_id", "currency_code", "created_at", "updated_at"],
|
|
6069
5942
|
prefix
|
|
6070
5943
|
);
|
|
6071
|
-
const {
|
|
5944
|
+
const {
|
|
5945
|
+
offset: offset2,
|
|
5946
|
+
created_at,
|
|
5947
|
+
updated_at,
|
|
5948
|
+
customer_id,
|
|
5949
|
+
currency_code,
|
|
5950
|
+
...rest
|
|
5951
|
+
} = queryObject;
|
|
6072
5952
|
const searchParams = {
|
|
6073
5953
|
limit: pageSize,
|
|
6074
5954
|
offset: offset2 ? Number(offset2) : 0,
|
|
6075
5955
|
created_at: created_at ? JSON.parse(created_at) : void 0,
|
|
6076
5956
|
updated_at: updated_at ? JSON.parse(updated_at) : void 0,
|
|
6077
5957
|
customer_id: customer_id ? JSON.parse(customer_id) : void 0,
|
|
5958
|
+
currency_code: currency_code ? JSON.parse(currency_code) : void 0,
|
|
6078
5959
|
...rest
|
|
6079
5960
|
};
|
|
6080
5961
|
return searchParams;
|
|
6081
5962
|
};
|
|
6082
5963
|
const PAGE_SIZE$6 = 10;
|
|
6083
|
-
function
|
|
6084
|
-
const queryParams =
|
|
5964
|
+
function StoreCreditAccountsTable() {
|
|
5965
|
+
const queryParams = useStoreCreditAccountsTableQuery({
|
|
6085
5966
|
pageSize: PAGE_SIZE$6
|
|
6086
5967
|
});
|
|
6087
5968
|
const {
|
|
6088
|
-
|
|
5969
|
+
store_credit_accounts: storeCreditAccounts,
|
|
6089
5970
|
isPending,
|
|
6090
5971
|
count: count2
|
|
6091
|
-
} =
|
|
5972
|
+
} = useStoreCreditAccounts({
|
|
6092
5973
|
...queryParams,
|
|
6093
|
-
order: queryParams.order ?? "-created_at"
|
|
6094
|
-
fields: "+line_item.product.title"
|
|
5974
|
+
order: queryParams.order ?? "-created_at"
|
|
6095
5975
|
});
|
|
6096
|
-
const columns =
|
|
6097
|
-
const filters =
|
|
5976
|
+
const columns = useStoreCreditAccountTableColumns();
|
|
5977
|
+
const filters = useStoreCreditAccountFilters();
|
|
6098
5978
|
return /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
6099
5979
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6100
5980
|
DataTable,
|
|
6101
5981
|
{
|
|
6102
|
-
data:
|
|
5982
|
+
data: storeCreditAccounts ?? [],
|
|
6103
5983
|
getRowId: (row) => row.id,
|
|
6104
5984
|
columns,
|
|
6105
5985
|
filters,
|
|
6106
5986
|
isLoading: isPending,
|
|
6107
5987
|
pageSize: PAGE_SIZE$6,
|
|
6108
5988
|
rowCount: count2,
|
|
6109
|
-
|
|
5989
|
+
enableSearch: false,
|
|
5990
|
+
heading: "Store Credit Accounts",
|
|
6110
5991
|
rowHref: (row) => `${row.id}`,
|
|
6111
5992
|
emptyState: {
|
|
6112
5993
|
empty: {
|
|
6113
|
-
heading: "No
|
|
6114
|
-
description: "Create a
|
|
5994
|
+
heading: "No store credit accounts found",
|
|
5995
|
+
description: "Create a new store credit account to get started."
|
|
6115
5996
|
},
|
|
6116
5997
|
filtered: {
|
|
6117
5998
|
heading: "No results found",
|
|
6118
|
-
description: "No
|
|
5999
|
+
description: "No store credit accounts match your filter criteria."
|
|
6119
6000
|
}
|
|
6120
6001
|
},
|
|
6121
6002
|
actions: [
|
|
6122
6003
|
{
|
|
6123
6004
|
label: "Create",
|
|
6124
|
-
to: "create"
|
|
6005
|
+
to: "/store-credit-accounts/create"
|
|
6125
6006
|
}
|
|
6126
6007
|
]
|
|
6127
6008
|
}
|
|
@@ -6129,16 +6010,15 @@ function GiftCardsTable() {
|
|
|
6129
6010
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
6130
6011
|
] });
|
|
6131
6012
|
}
|
|
6132
|
-
const
|
|
6013
|
+
const StoreCreditAccountsPage = () => {
|
|
6133
6014
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6134
6015
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6135
6016
|
components.LayoutComposer,
|
|
6136
6017
|
{
|
|
6137
|
-
widgetsZonePrefix: "
|
|
6138
|
-
preferredLayoutId: "core:
|
|
6018
|
+
widgetsZonePrefix: "store_credit_account.list",
|
|
6019
|
+
preferredLayoutId: "core:single-column",
|
|
6139
6020
|
sections: {
|
|
6140
|
-
main: /* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "
|
|
6141
|
-
side: /* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "GiftCardProductsSection", children: /* @__PURE__ */ jsxRuntime.jsx(GiftCardProductsSection, {}) })
|
|
6021
|
+
main: /* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountsTable", children: /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountsTable, {}) })
|
|
6142
6022
|
}
|
|
6143
6023
|
}
|
|
6144
6024
|
),
|
|
@@ -6146,8 +6026,8 @@ const GiftCardsPage = () => {
|
|
|
6146
6026
|
] });
|
|
6147
6027
|
};
|
|
6148
6028
|
const config$3 = adminSdk.defineRouteConfig({
|
|
6149
|
-
label: "
|
|
6150
|
-
icon:
|
|
6029
|
+
label: "Store Credits",
|
|
6030
|
+
icon: StoreCreditIcon
|
|
6151
6031
|
});
|
|
6152
6032
|
function setRef$2(ref, value) {
|
|
6153
6033
|
if (typeof ref === "function") {
|
|
@@ -10842,27 +10722,6 @@ const StackedFocusModal = Object.assign(Root, {
|
|
|
10842
10722
|
Description,
|
|
10843
10723
|
Title
|
|
10844
10724
|
});
|
|
10845
|
-
const STORE_QUERY_KEY = "store";
|
|
10846
|
-
const storeQueryKeys = queryKeysFactory(STORE_QUERY_KEY);
|
|
10847
|
-
async function retrieveActiveStore(query) {
|
|
10848
|
-
const response = await sdk.admin.store.list(query);
|
|
10849
|
-
const activeStore = response.stores?.[0];
|
|
10850
|
-
if (!activeStore) {
|
|
10851
|
-
throw new Medusa.FetchError("No active store found", "Not Found", 404);
|
|
10852
|
-
}
|
|
10853
|
-
return { store: activeStore };
|
|
10854
|
-
}
|
|
10855
|
-
const useStore$2 = (query, options) => {
|
|
10856
|
-
const { data, ...rest } = reactQuery.useQuery({
|
|
10857
|
-
queryFn: () => retrieveActiveStore(query),
|
|
10858
|
-
queryKey: storeQueryKeys.details(),
|
|
10859
|
-
...options
|
|
10860
|
-
});
|
|
10861
|
-
return {
|
|
10862
|
-
...data,
|
|
10863
|
-
...rest
|
|
10864
|
-
};
|
|
10865
|
-
};
|
|
10866
10725
|
const t$1 = (r, t2, s2) => {
|
|
10867
10726
|
if (r && "reportValidity" in r) {
|
|
10868
10727
|
const o2 = get$2(s2, t2);
|
|
@@ -13908,7 +13767,7 @@ function useStoreProps(store, props, key2, setKey) {
|
|
|
13908
13767
|
});
|
|
13909
13768
|
});
|
|
13910
13769
|
}
|
|
13911
|
-
function useStore$
|
|
13770
|
+
function useStore$2(createStore2, props) {
|
|
13912
13771
|
const [store, setStore] = React__namespace.useState(() => createStore2(props));
|
|
13913
13772
|
useSafeLayoutEffect(() => init(store), [store]);
|
|
13914
13773
|
const useState = React__namespace.useCallback((keyOrSelector) => useStoreState(store, keyOrSelector), [store]);
|
|
@@ -14865,7 +14724,7 @@ function useDisclosureStoreProps(store, update, props) {
|
|
|
14865
14724
|
return Object.assign(store, { disclosure: props.disclosure });
|
|
14866
14725
|
}
|
|
14867
14726
|
function useDisclosureStore(props = {}) {
|
|
14868
|
-
const [store, update] = useStore$
|
|
14727
|
+
const [store, update] = useStore$2(createDisclosureStore, props);
|
|
14869
14728
|
return useDisclosureStoreProps(store, update, props);
|
|
14870
14729
|
}
|
|
14871
14730
|
const ctx$2 = createStoreContext([DialogContextProvider], [DialogScopedContextProvider]);
|
|
@@ -15674,7 +15533,7 @@ function useDialogStoreProps(store, update, props) {
|
|
|
15674
15533
|
return useDisclosureStoreProps(store, update, props);
|
|
15675
15534
|
}
|
|
15676
15535
|
function useDialogStore(props = {}) {
|
|
15677
|
-
const [store, update] = useStore$
|
|
15536
|
+
const [store, update] = useStore$2(createDialogStore, props);
|
|
15678
15537
|
return useDialogStoreProps(store, update, props);
|
|
15679
15538
|
}
|
|
15680
15539
|
function isHiddenDismiss(element, ...ids2) {
|
|
@@ -18990,7 +18849,7 @@ function useComboboxStoreProps(store, update, props) {
|
|
|
18990
18849
|
}
|
|
18991
18850
|
function useComboboxStore(props = {}) {
|
|
18992
18851
|
props = useComboboxStoreOptions(props);
|
|
18993
|
-
const [store, update] = useStore$
|
|
18852
|
+
const [store, update] = useStore$2(createComboboxStore, props);
|
|
18994
18853
|
return useComboboxStoreProps(store, update, props);
|
|
18995
18854
|
}
|
|
18996
18855
|
function ComboboxProvider(props = {}) {
|
|
@@ -20109,6 +19968,369 @@ const ComboboxImpl = ({
|
|
|
20109
19968
|
);
|
|
20110
19969
|
};
|
|
20111
19970
|
const Combobox2 = genericForwardRef(ComboboxImpl);
|
|
19971
|
+
var isObject_1;
|
|
19972
|
+
var hasRequiredIsObject;
|
|
19973
|
+
function requireIsObject() {
|
|
19974
|
+
if (hasRequiredIsObject) return isObject_1;
|
|
19975
|
+
hasRequiredIsObject = 1;
|
|
19976
|
+
function isObject2(value) {
|
|
19977
|
+
var type = typeof value;
|
|
19978
|
+
return value != null && (type == "object" || type == "function");
|
|
19979
|
+
}
|
|
19980
|
+
isObject_1 = isObject2;
|
|
19981
|
+
return isObject_1;
|
|
19982
|
+
}
|
|
19983
|
+
var _freeGlobal;
|
|
19984
|
+
var hasRequired_freeGlobal;
|
|
19985
|
+
function require_freeGlobal() {
|
|
19986
|
+
if (hasRequired_freeGlobal) return _freeGlobal;
|
|
19987
|
+
hasRequired_freeGlobal = 1;
|
|
19988
|
+
var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
19989
|
+
_freeGlobal = freeGlobal;
|
|
19990
|
+
return _freeGlobal;
|
|
19991
|
+
}
|
|
19992
|
+
var _root;
|
|
19993
|
+
var hasRequired_root;
|
|
19994
|
+
function require_root() {
|
|
19995
|
+
if (hasRequired_root) return _root;
|
|
19996
|
+
hasRequired_root = 1;
|
|
19997
|
+
var freeGlobal = require_freeGlobal();
|
|
19998
|
+
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
19999
|
+
var root = freeGlobal || freeSelf || Function("return this")();
|
|
20000
|
+
_root = root;
|
|
20001
|
+
return _root;
|
|
20002
|
+
}
|
|
20003
|
+
var now_1;
|
|
20004
|
+
var hasRequiredNow;
|
|
20005
|
+
function requireNow() {
|
|
20006
|
+
if (hasRequiredNow) return now_1;
|
|
20007
|
+
hasRequiredNow = 1;
|
|
20008
|
+
var root = require_root();
|
|
20009
|
+
var now = function() {
|
|
20010
|
+
return root.Date.now();
|
|
20011
|
+
};
|
|
20012
|
+
now_1 = now;
|
|
20013
|
+
return now_1;
|
|
20014
|
+
}
|
|
20015
|
+
var _trimmedEndIndex;
|
|
20016
|
+
var hasRequired_trimmedEndIndex;
|
|
20017
|
+
function require_trimmedEndIndex() {
|
|
20018
|
+
if (hasRequired_trimmedEndIndex) return _trimmedEndIndex;
|
|
20019
|
+
hasRequired_trimmedEndIndex = 1;
|
|
20020
|
+
var reWhitespace = /\s/;
|
|
20021
|
+
function trimmedEndIndex(string2) {
|
|
20022
|
+
var index = string2.length;
|
|
20023
|
+
while (index-- && reWhitespace.test(string2.charAt(index))) {
|
|
20024
|
+
}
|
|
20025
|
+
return index;
|
|
20026
|
+
}
|
|
20027
|
+
_trimmedEndIndex = trimmedEndIndex;
|
|
20028
|
+
return _trimmedEndIndex;
|
|
20029
|
+
}
|
|
20030
|
+
var _baseTrim;
|
|
20031
|
+
var hasRequired_baseTrim;
|
|
20032
|
+
function require_baseTrim() {
|
|
20033
|
+
if (hasRequired_baseTrim) return _baseTrim;
|
|
20034
|
+
hasRequired_baseTrim = 1;
|
|
20035
|
+
var trimmedEndIndex = require_trimmedEndIndex();
|
|
20036
|
+
var reTrimStart = /^\s+/;
|
|
20037
|
+
function baseTrim(string2) {
|
|
20038
|
+
return string2 ? string2.slice(0, trimmedEndIndex(string2) + 1).replace(reTrimStart, "") : string2;
|
|
20039
|
+
}
|
|
20040
|
+
_baseTrim = baseTrim;
|
|
20041
|
+
return _baseTrim;
|
|
20042
|
+
}
|
|
20043
|
+
var _Symbol;
|
|
20044
|
+
var hasRequired_Symbol;
|
|
20045
|
+
function require_Symbol() {
|
|
20046
|
+
if (hasRequired_Symbol) return _Symbol;
|
|
20047
|
+
hasRequired_Symbol = 1;
|
|
20048
|
+
var root = require_root();
|
|
20049
|
+
var Symbol2 = root.Symbol;
|
|
20050
|
+
_Symbol = Symbol2;
|
|
20051
|
+
return _Symbol;
|
|
20052
|
+
}
|
|
20053
|
+
var _getRawTag;
|
|
20054
|
+
var hasRequired_getRawTag;
|
|
20055
|
+
function require_getRawTag() {
|
|
20056
|
+
if (hasRequired_getRawTag) return _getRawTag;
|
|
20057
|
+
hasRequired_getRawTag = 1;
|
|
20058
|
+
var Symbol2 = require_Symbol();
|
|
20059
|
+
var objectProto = Object.prototype;
|
|
20060
|
+
var hasOwnProperty2 = objectProto.hasOwnProperty;
|
|
20061
|
+
var nativeObjectToString = objectProto.toString;
|
|
20062
|
+
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
|
|
20063
|
+
function getRawTag(value) {
|
|
20064
|
+
var isOwn = hasOwnProperty2.call(value, symToStringTag), tag = value[symToStringTag];
|
|
20065
|
+
try {
|
|
20066
|
+
value[symToStringTag] = void 0;
|
|
20067
|
+
var unmasked = true;
|
|
20068
|
+
} catch (e) {
|
|
20069
|
+
}
|
|
20070
|
+
var result = nativeObjectToString.call(value);
|
|
20071
|
+
if (unmasked) {
|
|
20072
|
+
if (isOwn) {
|
|
20073
|
+
value[symToStringTag] = tag;
|
|
20074
|
+
} else {
|
|
20075
|
+
delete value[symToStringTag];
|
|
20076
|
+
}
|
|
20077
|
+
}
|
|
20078
|
+
return result;
|
|
20079
|
+
}
|
|
20080
|
+
_getRawTag = getRawTag;
|
|
20081
|
+
return _getRawTag;
|
|
20082
|
+
}
|
|
20083
|
+
var _objectToString;
|
|
20084
|
+
var hasRequired_objectToString;
|
|
20085
|
+
function require_objectToString() {
|
|
20086
|
+
if (hasRequired_objectToString) return _objectToString;
|
|
20087
|
+
hasRequired_objectToString = 1;
|
|
20088
|
+
var objectProto = Object.prototype;
|
|
20089
|
+
var nativeObjectToString = objectProto.toString;
|
|
20090
|
+
function objectToString(value) {
|
|
20091
|
+
return nativeObjectToString.call(value);
|
|
20092
|
+
}
|
|
20093
|
+
_objectToString = objectToString;
|
|
20094
|
+
return _objectToString;
|
|
20095
|
+
}
|
|
20096
|
+
var _baseGetTag;
|
|
20097
|
+
var hasRequired_baseGetTag;
|
|
20098
|
+
function require_baseGetTag() {
|
|
20099
|
+
if (hasRequired_baseGetTag) return _baseGetTag;
|
|
20100
|
+
hasRequired_baseGetTag = 1;
|
|
20101
|
+
var Symbol2 = require_Symbol(), getRawTag = require_getRawTag(), objectToString = require_objectToString();
|
|
20102
|
+
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
|
|
20103
|
+
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
|
|
20104
|
+
function baseGetTag(value) {
|
|
20105
|
+
if (value == null) {
|
|
20106
|
+
return value === void 0 ? undefinedTag : nullTag;
|
|
20107
|
+
}
|
|
20108
|
+
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
20109
|
+
}
|
|
20110
|
+
_baseGetTag = baseGetTag;
|
|
20111
|
+
return _baseGetTag;
|
|
20112
|
+
}
|
|
20113
|
+
var isObjectLike_1;
|
|
20114
|
+
var hasRequiredIsObjectLike;
|
|
20115
|
+
function requireIsObjectLike() {
|
|
20116
|
+
if (hasRequiredIsObjectLike) return isObjectLike_1;
|
|
20117
|
+
hasRequiredIsObjectLike = 1;
|
|
20118
|
+
function isObjectLike(value) {
|
|
20119
|
+
return value != null && typeof value == "object";
|
|
20120
|
+
}
|
|
20121
|
+
isObjectLike_1 = isObjectLike;
|
|
20122
|
+
return isObjectLike_1;
|
|
20123
|
+
}
|
|
20124
|
+
var isSymbol_1;
|
|
20125
|
+
var hasRequiredIsSymbol;
|
|
20126
|
+
function requireIsSymbol() {
|
|
20127
|
+
if (hasRequiredIsSymbol) return isSymbol_1;
|
|
20128
|
+
hasRequiredIsSymbol = 1;
|
|
20129
|
+
var baseGetTag = require_baseGetTag(), isObjectLike = requireIsObjectLike();
|
|
20130
|
+
var symbolTag = "[object Symbol]";
|
|
20131
|
+
function isSymbol(value) {
|
|
20132
|
+
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
20133
|
+
}
|
|
20134
|
+
isSymbol_1 = isSymbol;
|
|
20135
|
+
return isSymbol_1;
|
|
20136
|
+
}
|
|
20137
|
+
var toNumber_1;
|
|
20138
|
+
var hasRequiredToNumber;
|
|
20139
|
+
function requireToNumber() {
|
|
20140
|
+
if (hasRequiredToNumber) return toNumber_1;
|
|
20141
|
+
hasRequiredToNumber = 1;
|
|
20142
|
+
var baseTrim = require_baseTrim(), isObject2 = requireIsObject(), isSymbol = requireIsSymbol();
|
|
20143
|
+
var NAN = 0 / 0;
|
|
20144
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
20145
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
20146
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
20147
|
+
var freeParseInt = parseInt;
|
|
20148
|
+
function toNumber(value) {
|
|
20149
|
+
if (typeof value == "number") {
|
|
20150
|
+
return value;
|
|
20151
|
+
}
|
|
20152
|
+
if (isSymbol(value)) {
|
|
20153
|
+
return NAN;
|
|
20154
|
+
}
|
|
20155
|
+
if (isObject2(value)) {
|
|
20156
|
+
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
20157
|
+
value = isObject2(other) ? other + "" : other;
|
|
20158
|
+
}
|
|
20159
|
+
if (typeof value != "string") {
|
|
20160
|
+
return value === 0 ? value : +value;
|
|
20161
|
+
}
|
|
20162
|
+
value = baseTrim(value);
|
|
20163
|
+
var isBinary = reIsBinary.test(value);
|
|
20164
|
+
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
20165
|
+
}
|
|
20166
|
+
toNumber_1 = toNumber;
|
|
20167
|
+
return toNumber_1;
|
|
20168
|
+
}
|
|
20169
|
+
var debounce_1;
|
|
20170
|
+
var hasRequiredDebounce;
|
|
20171
|
+
function requireDebounce() {
|
|
20172
|
+
if (hasRequiredDebounce) return debounce_1;
|
|
20173
|
+
hasRequiredDebounce = 1;
|
|
20174
|
+
var isObject2 = requireIsObject(), now = requireNow(), toNumber = requireToNumber();
|
|
20175
|
+
var FUNC_ERROR_TEXT = "Expected a function";
|
|
20176
|
+
var nativeMax = Math.max, nativeMin = Math.min;
|
|
20177
|
+
function debounce2(func, wait, options) {
|
|
20178
|
+
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
20179
|
+
if (typeof func != "function") {
|
|
20180
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
20181
|
+
}
|
|
20182
|
+
wait = toNumber(wait) || 0;
|
|
20183
|
+
if (isObject2(options)) {
|
|
20184
|
+
leading = !!options.leading;
|
|
20185
|
+
maxing = "maxWait" in options;
|
|
20186
|
+
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
20187
|
+
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
20188
|
+
}
|
|
20189
|
+
function invokeFunc(time2) {
|
|
20190
|
+
var args = lastArgs, thisArg = lastThis;
|
|
20191
|
+
lastArgs = lastThis = void 0;
|
|
20192
|
+
lastInvokeTime = time2;
|
|
20193
|
+
result = func.apply(thisArg, args);
|
|
20194
|
+
return result;
|
|
20195
|
+
}
|
|
20196
|
+
function leadingEdge(time2) {
|
|
20197
|
+
lastInvokeTime = time2;
|
|
20198
|
+
timerId = setTimeout(timerExpired, wait);
|
|
20199
|
+
return leading ? invokeFunc(time2) : result;
|
|
20200
|
+
}
|
|
20201
|
+
function remainingWait(time2) {
|
|
20202
|
+
var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
|
|
20203
|
+
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
|
|
20204
|
+
}
|
|
20205
|
+
function shouldInvoke(time2) {
|
|
20206
|
+
var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime;
|
|
20207
|
+
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
|
|
20208
|
+
}
|
|
20209
|
+
function timerExpired() {
|
|
20210
|
+
var time2 = now();
|
|
20211
|
+
if (shouldInvoke(time2)) {
|
|
20212
|
+
return trailingEdge(time2);
|
|
20213
|
+
}
|
|
20214
|
+
timerId = setTimeout(timerExpired, remainingWait(time2));
|
|
20215
|
+
}
|
|
20216
|
+
function trailingEdge(time2) {
|
|
20217
|
+
timerId = void 0;
|
|
20218
|
+
if (trailing && lastArgs) {
|
|
20219
|
+
return invokeFunc(time2);
|
|
20220
|
+
}
|
|
20221
|
+
lastArgs = lastThis = void 0;
|
|
20222
|
+
return result;
|
|
20223
|
+
}
|
|
20224
|
+
function cancel() {
|
|
20225
|
+
if (timerId !== void 0) {
|
|
20226
|
+
clearTimeout(timerId);
|
|
20227
|
+
}
|
|
20228
|
+
lastInvokeTime = 0;
|
|
20229
|
+
lastArgs = lastCallTime = lastThis = timerId = void 0;
|
|
20230
|
+
}
|
|
20231
|
+
function flush() {
|
|
20232
|
+
return timerId === void 0 ? result : trailingEdge(now());
|
|
20233
|
+
}
|
|
20234
|
+
function debounced() {
|
|
20235
|
+
var time2 = now(), isInvoking = shouldInvoke(time2);
|
|
20236
|
+
lastArgs = arguments;
|
|
20237
|
+
lastThis = this;
|
|
20238
|
+
lastCallTime = time2;
|
|
20239
|
+
if (isInvoking) {
|
|
20240
|
+
if (timerId === void 0) {
|
|
20241
|
+
return leadingEdge(lastCallTime);
|
|
20242
|
+
}
|
|
20243
|
+
if (maxing) {
|
|
20244
|
+
clearTimeout(timerId);
|
|
20245
|
+
timerId = setTimeout(timerExpired, wait);
|
|
20246
|
+
return invokeFunc(lastCallTime);
|
|
20247
|
+
}
|
|
20248
|
+
}
|
|
20249
|
+
if (timerId === void 0) {
|
|
20250
|
+
timerId = setTimeout(timerExpired, wait);
|
|
20251
|
+
}
|
|
20252
|
+
return result;
|
|
20253
|
+
}
|
|
20254
|
+
debounced.cancel = cancel;
|
|
20255
|
+
debounced.flush = flush;
|
|
20256
|
+
return debounced;
|
|
20257
|
+
}
|
|
20258
|
+
debounce_1 = debounce2;
|
|
20259
|
+
return debounce_1;
|
|
20260
|
+
}
|
|
20261
|
+
var debounceExports = requireDebounce();
|
|
20262
|
+
const debounce$1 = /* @__PURE__ */ getDefaultExportFromCjs(debounceExports);
|
|
20263
|
+
const useDebouncedSearch = () => {
|
|
20264
|
+
const [searchValue, onSearchValueChange] = React.useState("");
|
|
20265
|
+
const [debouncedQuery, setDebouncedQuery] = React.useState("");
|
|
20266
|
+
const debouncedUpdate = React.useCallback(
|
|
20267
|
+
debounce$1((query) => setDebouncedQuery(query), 300),
|
|
20268
|
+
[]
|
|
20269
|
+
);
|
|
20270
|
+
React.useEffect(() => {
|
|
20271
|
+
debouncedUpdate(searchValue);
|
|
20272
|
+
return () => debouncedUpdate.cancel();
|
|
20273
|
+
}, [searchValue, debouncedUpdate]);
|
|
20274
|
+
return {
|
|
20275
|
+
searchValue,
|
|
20276
|
+
onSearchValueChange,
|
|
20277
|
+
query: debouncedQuery || void 0
|
|
20278
|
+
};
|
|
20279
|
+
};
|
|
20280
|
+
const useComboboxData = ({
|
|
20281
|
+
queryKey,
|
|
20282
|
+
queryFn,
|
|
20283
|
+
getOptions,
|
|
20284
|
+
defaultValue: defaultValue2,
|
|
20285
|
+
defaultValueKey,
|
|
20286
|
+
pageSize = 10
|
|
20287
|
+
}) => {
|
|
20288
|
+
const { searchValue, onSearchValueChange, query } = useDebouncedSearch();
|
|
20289
|
+
const queryInitialDataBy = defaultValueKey || "id";
|
|
20290
|
+
const { data: initialData } = reactQuery.useQuery({
|
|
20291
|
+
queryKey,
|
|
20292
|
+
queryFn: async () => {
|
|
20293
|
+
return queryFn({
|
|
20294
|
+
[queryInitialDataBy]: defaultValue2,
|
|
20295
|
+
limit: Array.isArray(defaultValue2) ? defaultValue2.length : 1
|
|
20296
|
+
});
|
|
20297
|
+
},
|
|
20298
|
+
enabled: !!defaultValue2
|
|
20299
|
+
});
|
|
20300
|
+
const { data, ...rest } = reactQuery.useInfiniteQuery({
|
|
20301
|
+
queryKey: [...queryKey, query],
|
|
20302
|
+
queryFn: async ({ pageParam = 0 }) => {
|
|
20303
|
+
return await queryFn({
|
|
20304
|
+
q: query,
|
|
20305
|
+
limit: pageSize,
|
|
20306
|
+
offset: pageParam
|
|
20307
|
+
});
|
|
20308
|
+
},
|
|
20309
|
+
initialPageParam: 0,
|
|
20310
|
+
getNextPageParam: (lastPage) => {
|
|
20311
|
+
const moreItemsExist = lastPage.count > lastPage.offset + lastPage.limit;
|
|
20312
|
+
return moreItemsExist ? lastPage.offset + lastPage.limit : void 0;
|
|
20313
|
+
},
|
|
20314
|
+
placeholderData: reactQuery.keepPreviousData
|
|
20315
|
+
});
|
|
20316
|
+
const options = data?.pages.flatMap((page) => getOptions(page)) ?? [];
|
|
20317
|
+
const defaultOptions2 = initialData ? getOptions(initialData) : [];
|
|
20318
|
+
const disabled = !rest.isPending && !options.length && !searchValue;
|
|
20319
|
+
if (defaultValue2 && defaultOptions2.length && !searchValue) {
|
|
20320
|
+
defaultOptions2.forEach((option) => {
|
|
20321
|
+
if (!options.find((o2) => o2.value === option.value)) {
|
|
20322
|
+
options.unshift(option);
|
|
20323
|
+
}
|
|
20324
|
+
});
|
|
20325
|
+
}
|
|
20326
|
+
return {
|
|
20327
|
+
options,
|
|
20328
|
+
searchValue,
|
|
20329
|
+
onSearchValueChange,
|
|
20330
|
+
disabled,
|
|
20331
|
+
...rest
|
|
20332
|
+
};
|
|
20333
|
+
};
|
|
20112
20334
|
const currencies = {
|
|
20113
20335
|
USD: {
|
|
20114
20336
|
code: "USD",
|
|
@@ -20855,6 +21077,504 @@ const currencies = {
|
|
|
20855
21077
|
decimal_digits: 0
|
|
20856
21078
|
}
|
|
20857
21079
|
};
|
|
21080
|
+
const formSchema = zod.z.object({
|
|
21081
|
+
currency_code: zod.z.string().min(1, "Please select a currency"),
|
|
21082
|
+
customer_id: zod.z.string().optional()
|
|
21083
|
+
});
|
|
21084
|
+
const StoreCreditAccountCreateForm = () => {
|
|
21085
|
+
const { handleSuccess } = useRouteModal();
|
|
21086
|
+
const [searchParams] = reactRouterDom.useSearchParams();
|
|
21087
|
+
const prefilledCustomerId = searchParams.get("prefill_customer_id") ?? "";
|
|
21088
|
+
const form = useForm({
|
|
21089
|
+
defaultValues: {
|
|
21090
|
+
currency_code: "",
|
|
21091
|
+
customer_id: prefilledCustomerId
|
|
21092
|
+
},
|
|
21093
|
+
resolver: u(formSchema)
|
|
21094
|
+
});
|
|
21095
|
+
const { mutateAsync: createStoreCreditAccount, isPending } = useCreateStoreCreditAccount();
|
|
21096
|
+
const handleSubmit = form.handleSubmit(async (data) => {
|
|
21097
|
+
if (!data.customer_id) {
|
|
21098
|
+
delete data.customer_id;
|
|
21099
|
+
}
|
|
21100
|
+
await createStoreCreditAccount(data, {
|
|
21101
|
+
onSuccess: (data2) => {
|
|
21102
|
+
ui.toast.success(`Store credit account was successfully created.`);
|
|
21103
|
+
handleSuccess(`../${data2.store_credit_account.id}`);
|
|
21104
|
+
},
|
|
21105
|
+
onError: (error2) => {
|
|
21106
|
+
ui.toast.error(error2.message);
|
|
21107
|
+
}
|
|
21108
|
+
});
|
|
21109
|
+
});
|
|
21110
|
+
const [currencySearchValue, setCurrencySearchValue] = React.useState("");
|
|
21111
|
+
const currencyOptions = React.useMemo(() => {
|
|
21112
|
+
const options = Object.values(currencies).map((currency) => ({
|
|
21113
|
+
label: `${currency.code} - ${currency.name} (${currency.symbol_native})`,
|
|
21114
|
+
value: currency.code.toLowerCase()
|
|
21115
|
+
}));
|
|
21116
|
+
if (!currencySearchValue) {
|
|
21117
|
+
return options;
|
|
21118
|
+
}
|
|
21119
|
+
return options.filter(
|
|
21120
|
+
(option) => option.label.toLowerCase().includes(currencySearchValue.toLowerCase())
|
|
21121
|
+
);
|
|
21122
|
+
}, [currencySearchValue]);
|
|
21123
|
+
const {
|
|
21124
|
+
options: customerOptions,
|
|
21125
|
+
fetchNextPage,
|
|
21126
|
+
isFetchingNextPage,
|
|
21127
|
+
searchValue,
|
|
21128
|
+
onSearchValueChange,
|
|
21129
|
+
isLoading
|
|
21130
|
+
} = useComboboxData({
|
|
21131
|
+
queryKey: customersQueryKeys.list(),
|
|
21132
|
+
defaultValue: prefilledCustomerId || void 0,
|
|
21133
|
+
queryFn: async (params) => {
|
|
21134
|
+
return sdk.admin.customer.list(params);
|
|
21135
|
+
},
|
|
21136
|
+
getOptions: (data) => {
|
|
21137
|
+
return data.customers?.map((customer) => {
|
|
21138
|
+
const fullName = [customer.first_name, customer.last_name].filter(Boolean).join(" ");
|
|
21139
|
+
const label = fullName ? `${customer.email} (${fullName})` : customer.email;
|
|
21140
|
+
return {
|
|
21141
|
+
label,
|
|
21142
|
+
value: customer.id
|
|
21143
|
+
};
|
|
21144
|
+
}) || [];
|
|
21145
|
+
}
|
|
21146
|
+
});
|
|
21147
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteFocusModal.Form, { form, children: [
|
|
21148
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Header, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "-my-2 w-full border-l" }) }),
|
|
21149
|
+
/* @__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: [
|
|
21150
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
21151
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Create Store Credit Account" }),
|
|
21152
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-ui-fg-subtle", size: "small", children: "Create a new store credit account for a customer" })
|
|
21153
|
+
] }),
|
|
21154
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-x-4", children: [
|
|
21155
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21156
|
+
Form$2.Field,
|
|
21157
|
+
{
|
|
21158
|
+
control: form.control,
|
|
21159
|
+
name: "currency_code",
|
|
21160
|
+
render: ({ field }) => {
|
|
21161
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { className: "w-full", children: [
|
|
21162
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { className: "font-normal", children: "Currency" }),
|
|
21163
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
21164
|
+
Combobox2,
|
|
21165
|
+
{
|
|
21166
|
+
value: field.value,
|
|
21167
|
+
onChange: field.onChange,
|
|
21168
|
+
searchValue: currencySearchValue,
|
|
21169
|
+
onSearchValueChange: setCurrencySearchValue,
|
|
21170
|
+
options: currencyOptions,
|
|
21171
|
+
placeholder: "Search for a currency..."
|
|
21172
|
+
}
|
|
21173
|
+
) }),
|
|
21174
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
21175
|
+
] });
|
|
21176
|
+
}
|
|
21177
|
+
}
|
|
21178
|
+
),
|
|
21179
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21180
|
+
Form$2.Field,
|
|
21181
|
+
{
|
|
21182
|
+
control: form.control,
|
|
21183
|
+
name: "customer_id",
|
|
21184
|
+
render: ({ field }) => {
|
|
21185
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { className: "w-full", children: [
|
|
21186
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { className: "font-normal", children: "Customer" }),
|
|
21187
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
21188
|
+
Combobox2,
|
|
21189
|
+
{
|
|
21190
|
+
value: field.value,
|
|
21191
|
+
onChange: field.onChange,
|
|
21192
|
+
searchValue,
|
|
21193
|
+
onSearchValueChange,
|
|
21194
|
+
options: customerOptions,
|
|
21195
|
+
placeholder: "Search for a customer...",
|
|
21196
|
+
fetchNextPage,
|
|
21197
|
+
isFetchingNextPage,
|
|
21198
|
+
noResultsPlaceholder: isLoading ? "Loading customers..." : "No customers found"
|
|
21199
|
+
}
|
|
21200
|
+
) }),
|
|
21201
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
21202
|
+
] });
|
|
21203
|
+
}
|
|
21204
|
+
}
|
|
21205
|
+
)
|
|
21206
|
+
] })
|
|
21207
|
+
] }) }) }),
|
|
21208
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteFocusModal.Footer, { children: [
|
|
21209
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Close, { asChild: true, disabled: isPending, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", size: "small", disabled: isPending, children: "Cancel" }) }),
|
|
21210
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21211
|
+
ui.Button,
|
|
21212
|
+
{
|
|
21213
|
+
variant: "primary",
|
|
21214
|
+
size: "small",
|
|
21215
|
+
onClick: handleSubmit,
|
|
21216
|
+
disabled: isPending,
|
|
21217
|
+
children: "Create"
|
|
21218
|
+
}
|
|
21219
|
+
)
|
|
21220
|
+
] })
|
|
21221
|
+
] });
|
|
21222
|
+
};
|
|
21223
|
+
const StoreCreditAccountCreate = () => {
|
|
21224
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteFocusModal, { children: [
|
|
21225
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Create Store Credit Account" }) }),
|
|
21226
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Create a new store credit account" }) }),
|
|
21227
|
+
/* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountCreateForm, {})
|
|
21228
|
+
] });
|
|
21229
|
+
};
|
|
21230
|
+
const GiftCardIcon = (props) => {
|
|
21231
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21232
|
+
"svg",
|
|
21233
|
+
{
|
|
21234
|
+
width: "15",
|
|
21235
|
+
height: "15",
|
|
21236
|
+
viewBox: "0 0 15 15",
|
|
21237
|
+
fill: "none",
|
|
21238
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
21239
|
+
...props,
|
|
21240
|
+
children: [
|
|
21241
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { width: "15", height: "15", fill: "#F97316" }),
|
|
21242
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21243
|
+
"rect",
|
|
21244
|
+
{
|
|
21245
|
+
width: "15",
|
|
21246
|
+
height: "15",
|
|
21247
|
+
fill: "url(#paint0_linear_28788_25808)",
|
|
21248
|
+
fillOpacity: "0.2"
|
|
21249
|
+
}
|
|
21250
|
+
),
|
|
21251
|
+
/* @__PURE__ */ jsxRuntime.jsxs("g", { clipPath: "url(#clip0_28788_25808)", children: [
|
|
21252
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21253
|
+
"path",
|
|
21254
|
+
{
|
|
21255
|
+
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",
|
|
21256
|
+
fill: "white"
|
|
21257
|
+
}
|
|
21258
|
+
),
|
|
21259
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21260
|
+
"path",
|
|
21261
|
+
{
|
|
21262
|
+
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",
|
|
21263
|
+
fill: "white"
|
|
21264
|
+
}
|
|
21265
|
+
),
|
|
21266
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21267
|
+
"path",
|
|
21268
|
+
{
|
|
21269
|
+
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",
|
|
21270
|
+
fill: "white"
|
|
21271
|
+
}
|
|
21272
|
+
),
|
|
21273
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21274
|
+
"path",
|
|
21275
|
+
{
|
|
21276
|
+
d: "M6.938 7.5H3.75V9.563C3.75 10.7 4.675 11.625 5.813 11.625H6.938V7.5Z",
|
|
21277
|
+
fill: "white"
|
|
21278
|
+
}
|
|
21279
|
+
),
|
|
21280
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21281
|
+
"path",
|
|
21282
|
+
{
|
|
21283
|
+
d: "M8.063 7.5V11.625H9.188C10.325 11.625 11.25 10.7 11.25 9.563V7.5H8.063Z",
|
|
21284
|
+
fill: "white"
|
|
21285
|
+
}
|
|
21286
|
+
)
|
|
21287
|
+
] }),
|
|
21288
|
+
/* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
|
|
21289
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
21290
|
+
"linearGradient",
|
|
21291
|
+
{
|
|
21292
|
+
id: "paint0_linear_28788_25808",
|
|
21293
|
+
x1: "7.5",
|
|
21294
|
+
y1: "0",
|
|
21295
|
+
x2: "7.5",
|
|
21296
|
+
y2: "15",
|
|
21297
|
+
gradientUnits: "userSpaceOnUse",
|
|
21298
|
+
children: [
|
|
21299
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "white" }),
|
|
21300
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })
|
|
21301
|
+
]
|
|
21302
|
+
}
|
|
21303
|
+
),
|
|
21304
|
+
/* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_28788_25808", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "9", height: "9", fill: "white", transform: "translate(3 3)" }) })
|
|
21305
|
+
] })
|
|
21306
|
+
]
|
|
21307
|
+
}
|
|
21308
|
+
);
|
|
21309
|
+
};
|
|
21310
|
+
const GiftCardProductsSection = () => {
|
|
21311
|
+
const { products: giftCardProducts, count: count2 = 0 } = useProducts({
|
|
21312
|
+
is_giftcard: true
|
|
21313
|
+
});
|
|
21314
|
+
const slicedProducts = giftCardProducts?.slice(0, 3) ?? [];
|
|
21315
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0", children: [
|
|
21316
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
21317
|
+
/* @__PURE__ */ jsxRuntime.jsx(Header$5, { title: "Gift Card Products" }),
|
|
21318
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21319
|
+
reactRouterDom.Link,
|
|
21320
|
+
{
|
|
21321
|
+
to: `/gift-cards/gift-card-products/create`,
|
|
21322
|
+
className: "text-ui-fg-muted text-sm px-6",
|
|
21323
|
+
children: "Create"
|
|
21324
|
+
}
|
|
21325
|
+
)
|
|
21326
|
+
] }),
|
|
21327
|
+
giftCardProducts?.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
21328
|
+
NoRecords,
|
|
21329
|
+
{
|
|
21330
|
+
className: "px-10 py-4 h-[200px]",
|
|
21331
|
+
title: "No gift card products",
|
|
21332
|
+
message: "There are no gift card products to show. Create one to get started.",
|
|
21333
|
+
action: {
|
|
21334
|
+
to: "/gift-cards/gift-card-products/create",
|
|
21335
|
+
label: "Create gift card product"
|
|
21336
|
+
}
|
|
21337
|
+
}
|
|
21338
|
+
),
|
|
21339
|
+
slicedProducts.map((giftCardProduct) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
21340
|
+
SidebarLink,
|
|
21341
|
+
{
|
|
21342
|
+
to: `/gift-cards/gift-card-products/${giftCardProduct.id}`,
|
|
21343
|
+
labelKey: giftCardProduct.title,
|
|
21344
|
+
descriptionKey: giftCardProduct.title,
|
|
21345
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Tag, {})
|
|
21346
|
+
}
|
|
21347
|
+
)),
|
|
21348
|
+
count2 > 3 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
21349
|
+
reactRouterDom.Link,
|
|
21350
|
+
{
|
|
21351
|
+
to: "/gift-cards/gift-card-products",
|
|
21352
|
+
className: "text-ui-fg-muted text-sm px-6 py-4 flex items-center justify-center",
|
|
21353
|
+
children: "View more"
|
|
21354
|
+
}
|
|
21355
|
+
)
|
|
21356
|
+
] });
|
|
21357
|
+
};
|
|
21358
|
+
const _giftCardQueryKey = queryKeysFactory("gift-card");
|
|
21359
|
+
const giftCardQueryKey = {
|
|
21360
|
+
..._giftCardQueryKey,
|
|
21361
|
+
orders: (id) => [..._giftCardQueryKey.detail(id), "orders"]
|
|
21362
|
+
};
|
|
21363
|
+
const useGiftCards = (query, options) => {
|
|
21364
|
+
const fetchGiftCards = (query2, headers) => sdk.client.fetch(`/admin/gift-cards`, {
|
|
21365
|
+
query: query2,
|
|
21366
|
+
headers
|
|
21367
|
+
});
|
|
21368
|
+
const { data, ...rest } = reactQuery.useQuery({
|
|
21369
|
+
...options,
|
|
21370
|
+
queryFn: () => fetchGiftCards(query),
|
|
21371
|
+
queryKey: giftCardQueryKey.list(query)
|
|
21372
|
+
});
|
|
21373
|
+
return { ...data, ...rest };
|
|
21374
|
+
};
|
|
21375
|
+
const useGiftCard = (id, query, options) => {
|
|
21376
|
+
const fetchGiftCard = (id2, query2, headers) => sdk.client.fetch(`/admin/gift-cards/${id2}`, {
|
|
21377
|
+
query: query2,
|
|
21378
|
+
headers
|
|
21379
|
+
});
|
|
21380
|
+
const { data, ...rest } = reactQuery.useQuery({
|
|
21381
|
+
queryFn: () => fetchGiftCard(id, query),
|
|
21382
|
+
queryKey: giftCardQueryKey.detail(id, query),
|
|
21383
|
+
...options
|
|
21384
|
+
});
|
|
21385
|
+
return { ...data, ...rest };
|
|
21386
|
+
};
|
|
21387
|
+
const useGiftCardOrders = (id, options) => {
|
|
21388
|
+
const fetchGiftCardOrders = (id2, query, headers) => sdk.client.fetch(`/admin/gift-cards/${id2}/orders`, {
|
|
21389
|
+
query,
|
|
21390
|
+
headers
|
|
21391
|
+
});
|
|
21392
|
+
const { data, ...rest } = reactQuery.useQuery({
|
|
21393
|
+
queryFn: () => fetchGiftCardOrders(id),
|
|
21394
|
+
queryKey: giftCardQueryKey.orders(id),
|
|
21395
|
+
...options
|
|
21396
|
+
});
|
|
21397
|
+
return { ...data, ...rest };
|
|
21398
|
+
};
|
|
21399
|
+
const useUpdateGiftCard = (id, options) => {
|
|
21400
|
+
const queryClient = reactQuery.useQueryClient();
|
|
21401
|
+
const updateGiftCard = async (id2, body) => sdk.client.fetch(`/admin/gift-cards/${id2}`, {
|
|
21402
|
+
body,
|
|
21403
|
+
method: "POST"
|
|
21404
|
+
});
|
|
21405
|
+
return reactQuery.useMutation({
|
|
21406
|
+
mutationFn: async (payload) => updateGiftCard(id, payload),
|
|
21407
|
+
onSuccess: (data, variables, context) => {
|
|
21408
|
+
queryClient.invalidateQueries({
|
|
21409
|
+
queryKey: giftCardQueryKey.detail(id)
|
|
21410
|
+
});
|
|
21411
|
+
queryClient.invalidateQueries({
|
|
21412
|
+
queryKey: giftCardQueryKey.lists()
|
|
21413
|
+
});
|
|
21414
|
+
},
|
|
21415
|
+
...options
|
|
21416
|
+
});
|
|
21417
|
+
};
|
|
21418
|
+
const useCreateGiftCard = (options) => {
|
|
21419
|
+
const queryClient = reactQuery.useQueryClient();
|
|
21420
|
+
const createGiftCard = async (body) => sdk.client.fetch(`/admin/gift-cards`, {
|
|
21421
|
+
body,
|
|
21422
|
+
method: "POST"
|
|
21423
|
+
});
|
|
21424
|
+
return reactQuery.useMutation({
|
|
21425
|
+
mutationFn: (body) => createGiftCard(body),
|
|
21426
|
+
onSuccess: (data, variables, context) => {
|
|
21427
|
+
queryClient.invalidateQueries({ queryKey: giftCardQueryKey.lists() });
|
|
21428
|
+
},
|
|
21429
|
+
...options
|
|
21430
|
+
});
|
|
21431
|
+
};
|
|
21432
|
+
const columnHelper$9 = ui.createDataTableColumnHelper();
|
|
21433
|
+
const useGiftCardTableColumns = () => {
|
|
21434
|
+
return React.useMemo(() => {
|
|
21435
|
+
return [
|
|
21436
|
+
columnHelper$9.accessor("code", {
|
|
21437
|
+
header: "Code",
|
|
21438
|
+
cell: ({ row }) => {
|
|
21439
|
+
return row.original.code;
|
|
21440
|
+
}
|
|
21441
|
+
}),
|
|
21442
|
+
columnHelper$9.accessor("line_item.product.title", {
|
|
21443
|
+
header: "Product",
|
|
21444
|
+
cell: ({ row }) => {
|
|
21445
|
+
return row.original.line_item?.product?.title || "Custom Gift Card";
|
|
21446
|
+
}
|
|
21447
|
+
}),
|
|
21448
|
+
columnHelper$9.accessor("created_at", {
|
|
21449
|
+
header: "Date issued",
|
|
21450
|
+
cell: ({ row }) => getRelativeDate(row.original.created_at)
|
|
21451
|
+
}),
|
|
21452
|
+
columnHelper$9.accessor("value", {
|
|
21453
|
+
header: "Value",
|
|
21454
|
+
cell: ({ row }) => {
|
|
21455
|
+
return formatAmount(row.original.value, row.original.currency_code);
|
|
21456
|
+
}
|
|
21457
|
+
})
|
|
21458
|
+
];
|
|
21459
|
+
}, []);
|
|
21460
|
+
};
|
|
21461
|
+
const useGiftCardFilters = () => {
|
|
21462
|
+
const dateFilterOptions = useDataTableDateFilters$1();
|
|
21463
|
+
const customerFilterOptions = useCustomerFilters();
|
|
21464
|
+
return React.useMemo(() => {
|
|
21465
|
+
return [...dateFilterOptions, ...customerFilterOptions];
|
|
21466
|
+
}, [dateFilterOptions, customerFilterOptions]);
|
|
21467
|
+
};
|
|
21468
|
+
const useGiftCardTableQuery = ({
|
|
21469
|
+
prefix,
|
|
21470
|
+
pageSize = 20
|
|
21471
|
+
}) => {
|
|
21472
|
+
const queryObject = useQueryParams(
|
|
21473
|
+
["q", "offset", "customer_id", "created_at", "updated_at"],
|
|
21474
|
+
prefix
|
|
21475
|
+
);
|
|
21476
|
+
const { offset: offset2, created_at, updated_at, customer_id, ...rest } = queryObject;
|
|
21477
|
+
const searchParams = {
|
|
21478
|
+
limit: pageSize,
|
|
21479
|
+
offset: offset2 ? Number(offset2) : 0,
|
|
21480
|
+
created_at: created_at ? JSON.parse(created_at) : void 0,
|
|
21481
|
+
updated_at: updated_at ? JSON.parse(updated_at) : void 0,
|
|
21482
|
+
customer_id: customer_id ? JSON.parse(customer_id) : void 0,
|
|
21483
|
+
...rest
|
|
21484
|
+
};
|
|
21485
|
+
return searchParams;
|
|
21486
|
+
};
|
|
21487
|
+
const PAGE_SIZE$5 = 10;
|
|
21488
|
+
function GiftCardsTable() {
|
|
21489
|
+
const queryParams = useGiftCardTableQuery({
|
|
21490
|
+
pageSize: PAGE_SIZE$5
|
|
21491
|
+
});
|
|
21492
|
+
const {
|
|
21493
|
+
gift_cards: giftCards,
|
|
21494
|
+
isPending,
|
|
21495
|
+
count: count2
|
|
21496
|
+
} = useGiftCards({
|
|
21497
|
+
...queryParams,
|
|
21498
|
+
order: queryParams.order ?? "-created_at",
|
|
21499
|
+
fields: "+line_item.product.title"
|
|
21500
|
+
});
|
|
21501
|
+
const columns = useGiftCardTableColumns();
|
|
21502
|
+
const filters = useGiftCardFilters();
|
|
21503
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
21504
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
21505
|
+
DataTable,
|
|
21506
|
+
{
|
|
21507
|
+
data: giftCards,
|
|
21508
|
+
getRowId: (row) => row.id,
|
|
21509
|
+
columns,
|
|
21510
|
+
filters,
|
|
21511
|
+
isLoading: isPending,
|
|
21512
|
+
pageSize: PAGE_SIZE$5,
|
|
21513
|
+
rowCount: count2,
|
|
21514
|
+
heading: "Gift Cards",
|
|
21515
|
+
rowHref: (row) => `${row.id}`,
|
|
21516
|
+
emptyState: {
|
|
21517
|
+
empty: {
|
|
21518
|
+
heading: "No gift cards found",
|
|
21519
|
+
description: "Create a gift card to get started."
|
|
21520
|
+
},
|
|
21521
|
+
filtered: {
|
|
21522
|
+
heading: "No results found",
|
|
21523
|
+
description: "No gift cards match your filter criteria."
|
|
21524
|
+
}
|
|
21525
|
+
},
|
|
21526
|
+
actions: [
|
|
21527
|
+
{
|
|
21528
|
+
label: "Create",
|
|
21529
|
+
to: "create"
|
|
21530
|
+
}
|
|
21531
|
+
]
|
|
21532
|
+
}
|
|
21533
|
+
) }),
|
|
21534
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
21535
|
+
] });
|
|
21536
|
+
}
|
|
21537
|
+
const GiftCardsPage = () => {
|
|
21538
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
21539
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21540
|
+
components.LayoutComposer,
|
|
21541
|
+
{
|
|
21542
|
+
widgetsZonePrefix: "gift_card.list",
|
|
21543
|
+
preferredLayoutId: "core:two-column",
|
|
21544
|
+
sections: {
|
|
21545
|
+
main: /* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "GiftCardsTable", children: /* @__PURE__ */ jsxRuntime.jsx(GiftCardsTable, {}) }),
|
|
21546
|
+
side: /* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "GiftCardProductsSection", children: /* @__PURE__ */ jsxRuntime.jsx(GiftCardProductsSection, {}) })
|
|
21547
|
+
}
|
|
21548
|
+
}
|
|
21549
|
+
),
|
|
21550
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Toaster, {})
|
|
21551
|
+
] });
|
|
21552
|
+
};
|
|
21553
|
+
const config$2 = adminSdk.defineRouteConfig({
|
|
21554
|
+
label: "Gift Cards",
|
|
21555
|
+
icon: GiftCardIcon
|
|
21556
|
+
});
|
|
21557
|
+
const STORE_QUERY_KEY = "store";
|
|
21558
|
+
const storeQueryKeys = queryKeysFactory(STORE_QUERY_KEY);
|
|
21559
|
+
async function retrieveActiveStore(query) {
|
|
21560
|
+
const response = await sdk.admin.store.list(query);
|
|
21561
|
+
const activeStore = response.stores?.[0];
|
|
21562
|
+
if (!activeStore) {
|
|
21563
|
+
throw new Medusa.FetchError("No active store found", "Not Found", 404);
|
|
21564
|
+
}
|
|
21565
|
+
return { store: activeStore };
|
|
21566
|
+
}
|
|
21567
|
+
const useStore$1 = (query, options) => {
|
|
21568
|
+
const { data, ...rest } = reactQuery.useQuery({
|
|
21569
|
+
queryFn: () => retrieveActiveStore(query),
|
|
21570
|
+
queryKey: storeQueryKeys.details(),
|
|
21571
|
+
...options
|
|
21572
|
+
});
|
|
21573
|
+
return {
|
|
21574
|
+
...data,
|
|
21575
|
+
...rest
|
|
21576
|
+
};
|
|
21577
|
+
};
|
|
20858
21578
|
function getEnumValues(entries) {
|
|
20859
21579
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
20860
21580
|
const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
@@ -21521,7 +22241,7 @@ class $ZodEncodeError extends Error {
|
|
|
21521
22241
|
}
|
|
21522
22242
|
(_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
|
|
21523
22243
|
const globalConfig = globalThis.__zod_globalConfig;
|
|
21524
|
-
function config$
|
|
22244
|
+
function config$1(newConfig) {
|
|
21525
22245
|
if (newConfig)
|
|
21526
22246
|
Object.assign(globalConfig, newConfig);
|
|
21527
22247
|
return globalConfig;
|
|
@@ -21647,7 +22367,7 @@ const _parse = (_Err) => {
|
|
|
21647
22367
|
throw new $ZodAsyncError();
|
|
21648
22368
|
}
|
|
21649
22369
|
if (result.issues.length) {
|
|
21650
|
-
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
22370
|
+
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx2, config$1())));
|
|
21651
22371
|
captureStackTrace(e, _params?.callee ?? fn);
|
|
21652
22372
|
throw e;
|
|
21653
22373
|
}
|
|
@@ -21662,7 +22382,7 @@ const _parseAsync = (_Err) => {
|
|
|
21662
22382
|
if (result instanceof Promise)
|
|
21663
22383
|
result = await result;
|
|
21664
22384
|
if (result.issues.length) {
|
|
21665
|
-
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
22385
|
+
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx2, config$1())));
|
|
21666
22386
|
captureStackTrace(e, params?.callee ?? fn);
|
|
21667
22387
|
throw e;
|
|
21668
22388
|
}
|
|
@@ -21684,7 +22404,7 @@ function failure(Err, issues, ctx2) {
|
|
|
21684
22404
|
success: false,
|
|
21685
22405
|
get error() {
|
|
21686
22406
|
if (!error2) {
|
|
21687
|
-
error2 = new Err(issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
22407
|
+
error2 = new Err(issues.map((iss) => finalizeIssue(iss, ctx2, config$1())));
|
|
21688
22408
|
issues = void 0;
|
|
21689
22409
|
ctx2 = void 0;
|
|
21690
22410
|
}
|
|
@@ -22309,7 +23029,7 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
22309
23029
|
own(this, "~standard", value);
|
|
22310
23030
|
}
|
|
22311
23031
|
});
|
|
22312
|
-
const toStandardResult = (r, ctx2) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
23032
|
+
const toStandardResult = (r, ctx2) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx2, config$1())) } : { value: r.value };
|
|
22313
23033
|
async function validateAsync(inst, value) {
|
|
22314
23034
|
const ctx2 = { async: true };
|
|
22315
23035
|
return toStandardResult(await inst._zod.run({ value, issues: [] }, ctx2), ctx2);
|
|
@@ -23171,7 +23891,7 @@ function handleUnionResults(results, final, inst, ctx2) {
|
|
|
23171
23891
|
code: "invalid_union",
|
|
23172
23892
|
input: final.value,
|
|
23173
23893
|
inst,
|
|
23174
|
-
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
23894
|
+
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx2, config$1())))
|
|
23175
23895
|
});
|
|
23176
23896
|
return final;
|
|
23177
23897
|
}
|
|
@@ -23367,7 +24087,7 @@ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
23367
24087
|
payload.issues.push({
|
|
23368
24088
|
code: "invalid_key",
|
|
23369
24089
|
origin: "record",
|
|
23370
|
-
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
24090
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx2, config$1())),
|
|
23371
24091
|
input: key2,
|
|
23372
24092
|
path: [key2],
|
|
23373
24093
|
inst
|
|
@@ -23447,7 +24167,7 @@ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
23447
24167
|
payload.issues.push({
|
|
23448
24168
|
code: "invalid_key",
|
|
23449
24169
|
origin: "record",
|
|
23450
|
-
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
24170
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx2, config$1())),
|
|
23451
24171
|
input: key2,
|
|
23452
24172
|
path: [key2],
|
|
23453
24173
|
inst
|
|
@@ -23663,7 +24383,7 @@ function handleCatchResult(payload, result, def, ctx2) {
|
|
|
23663
24383
|
...result,
|
|
23664
24384
|
value: payload.value,
|
|
23665
24385
|
error: {
|
|
23666
|
-
issues: result.issues.map((iss) => finalizeIssue(iss, ctx2, config$
|
|
24386
|
+
issues: result.issues.map((iss) => finalizeIssue(iss, ctx2, config$1()))
|
|
23667
24387
|
},
|
|
23668
24388
|
input: payload.value
|
|
23669
24389
|
});
|
|
@@ -25807,11 +26527,11 @@ const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
|
25807
26527
|
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
25808
26528
|
function _ensureDefaultLocale() {
|
|
25809
26529
|
if (!globalConfig.localeError)
|
|
25810
|
-
config$
|
|
26530
|
+
config$1(en());
|
|
25811
26531
|
}
|
|
25812
26532
|
function _ensureDefaultMemoizer() {
|
|
25813
26533
|
if (!globalConfig.memoizer)
|
|
25814
|
-
config$
|
|
26534
|
+
config$1({ memoizer: memoizer() });
|
|
25815
26535
|
}
|
|
25816
26536
|
const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
25817
26537
|
_ensureDefaultLocale();
|
|
@@ -26915,733 +27635,727 @@ const GiftCardCreateForm = ({
|
|
|
26915
27635
|
] });
|
|
26916
27636
|
};
|
|
26917
27637
|
const GiftCardCreate = () => {
|
|
26918
|
-
const { store, isLoading } = useStore$
|
|
27638
|
+
const { store, isLoading } = useStore$1({});
|
|
26919
27639
|
return /* @__PURE__ */ jsxRuntime.jsxs(RouteFocusModal, { children: [
|
|
26920
27640
|
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Create Gift Card" }) }),
|
|
26921
27641
|
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Create a new gift card" }) }),
|
|
26922
27642
|
!isLoading && /* @__PURE__ */ jsxRuntime.jsx(GiftCardCreateForm, { store })
|
|
26923
27643
|
] });
|
|
26924
27644
|
};
|
|
26925
|
-
const
|
|
26926
|
-
|
|
26927
|
-
|
|
26928
|
-
|
|
26929
|
-
|
|
26930
|
-
|
|
26931
|
-
|
|
26932
|
-
|
|
26933
|
-
|
|
26934
|
-
|
|
26935
|
-
|
|
26936
|
-
|
|
26937
|
-
|
|
26938
|
-
"
|
|
26939
|
-
|
|
26940
|
-
|
|
26941
|
-
|
|
26942
|
-
|
|
26943
|
-
|
|
26944
|
-
|
|
26945
|
-
|
|
26946
|
-
|
|
26947
|
-
|
|
26948
|
-
|
|
26949
|
-
|
|
26950
|
-
|
|
26951
|
-
|
|
26952
|
-
|
|
26953
|
-
|
|
26954
|
-
|
|
26955
|
-
|
|
26956
|
-
|
|
26957
|
-
|
|
26958
|
-
|
|
26959
|
-
|
|
26960
|
-
|
|
26961
|
-
|
|
27645
|
+
const StoreCreditAccountBalanceSection = ({
|
|
27646
|
+
storeCreditAccount
|
|
27647
|
+
}) => {
|
|
27648
|
+
if (!storeCreditAccount || typeof storeCreditAccount.balance === "undefined") {
|
|
27649
|
+
return;
|
|
27650
|
+
}
|
|
27651
|
+
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: [
|
|
27652
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-ui-tag-green-icon h-8 w-1 rounded-full" }),
|
|
27653
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
27654
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", size: "small", className: "text-ui-fg-subtle", children: "Current Balance" }),
|
|
27655
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
27656
|
+
ui.Text,
|
|
27657
|
+
{
|
|
27658
|
+
weight: "plus",
|
|
27659
|
+
size: "xlarge",
|
|
27660
|
+
className: "tabular-nums text-ui-fg-base",
|
|
27661
|
+
children: formatAmount(
|
|
27662
|
+
storeCreditAccount.balance,
|
|
27663
|
+
storeCreditAccount.currency_code
|
|
27664
|
+
)
|
|
27665
|
+
}
|
|
27666
|
+
)
|
|
27667
|
+
] })
|
|
27668
|
+
] }) });
|
|
27669
|
+
};
|
|
27670
|
+
var __create = Object.create;
|
|
27671
|
+
var __defProp = Object.defineProperty;
|
|
27672
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
27673
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
27674
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
27675
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
27676
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
27677
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
27678
|
+
};
|
|
27679
|
+
var __copyProps = (to, from, except, desc) => {
|
|
27680
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
27681
|
+
for (let key2 of __getOwnPropNames(from))
|
|
27682
|
+
if (!__hasOwnProp.call(to, key2) && key2 !== except)
|
|
27683
|
+
__defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
|
|
27684
|
+
}
|
|
27685
|
+
return to;
|
|
27686
|
+
};
|
|
27687
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
27688
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
27689
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27690
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27691
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27692
|
+
__defProp(target, "default", { value: mod, enumerable: true }),
|
|
27693
|
+
mod
|
|
27694
|
+
));
|
|
27695
|
+
var require_toggle_selection = __commonJS({
|
|
27696
|
+
"node_modules/toggle-selection/index.js"(exports2, module2) {
|
|
27697
|
+
module2.exports = function() {
|
|
27698
|
+
var selection = document.getSelection();
|
|
27699
|
+
if (!selection.rangeCount) {
|
|
27700
|
+
return function() {
|
|
27701
|
+
};
|
|
27702
|
+
}
|
|
27703
|
+
var active = document.activeElement;
|
|
27704
|
+
var ranges = [];
|
|
27705
|
+
for (var i2 = 0; i2 < selection.rangeCount; i2++) {
|
|
27706
|
+
ranges.push(selection.getRangeAt(i2));
|
|
27707
|
+
}
|
|
27708
|
+
switch (active.tagName.toUpperCase()) {
|
|
27709
|
+
// .toUpperCase handles XHTML
|
|
27710
|
+
case "INPUT":
|
|
27711
|
+
case "TEXTAREA":
|
|
27712
|
+
active.blur();
|
|
27713
|
+
break;
|
|
27714
|
+
default:
|
|
27715
|
+
active = null;
|
|
27716
|
+
break;
|
|
27717
|
+
}
|
|
27718
|
+
selection.removeAllRanges();
|
|
27719
|
+
return function() {
|
|
27720
|
+
selection.type === "Caret" && selection.removeAllRanges();
|
|
27721
|
+
if (!selection.rangeCount) {
|
|
27722
|
+
ranges.forEach(function(range) {
|
|
27723
|
+
selection.addRange(range);
|
|
27724
|
+
});
|
|
27725
|
+
}
|
|
27726
|
+
active && active.focus();
|
|
27727
|
+
};
|
|
27728
|
+
};
|
|
27729
|
+
}
|
|
27730
|
+
});
|
|
27731
|
+
var import_index = __toESM(require_toggle_selection());
|
|
27732
|
+
var toggle_selection_default = import_index.default;
|
|
27733
|
+
var defaultMessage = "Copy to clipboard: #{key}, Enter";
|
|
27734
|
+
function formatPromptMessage(message2) {
|
|
27735
|
+
var isMac2 = navigator.userAgentData ? /mac/i.test(navigator.userAgentData.platform) : /mac os x/i.test(navigator.userAgent);
|
|
27736
|
+
var copyKey = (isMac2 ? "⌘" : "Ctrl") + "+C";
|
|
27737
|
+
return message2.replace(/#{\s*key\s*}/g, copyKey);
|
|
27738
|
+
}
|
|
27739
|
+
function buildClipboardItem(text2, format2) {
|
|
27740
|
+
var items = {};
|
|
27741
|
+
items["text/plain"] = new Blob([text2], { type: "text/plain" });
|
|
27742
|
+
if (format2 && format2 !== "text/plain") {
|
|
27743
|
+
items[format2] = new Blob([text2], { type: format2 });
|
|
27744
|
+
}
|
|
27745
|
+
return new ClipboardItem(items);
|
|
27746
|
+
}
|
|
27747
|
+
async function copyViaClipboardAPI(text2, options) {
|
|
27748
|
+
if (!options.format && !options.onCopy) {
|
|
27749
|
+
await navigator.clipboard.writeText(text2);
|
|
27750
|
+
return true;
|
|
27751
|
+
}
|
|
27752
|
+
var item = buildClipboardItem(text2, options.format);
|
|
27753
|
+
if (options.onCopy) {
|
|
27754
|
+
item = options.onCopy(item) || item;
|
|
27755
|
+
}
|
|
27756
|
+
await navigator.clipboard.write([item]);
|
|
27757
|
+
return true;
|
|
27758
|
+
}
|
|
27759
|
+
function createHiddenSpan(text2, options) {
|
|
27760
|
+
var mark = document.createElement("span");
|
|
27761
|
+
mark.textContent = text2;
|
|
27762
|
+
mark.ariaHidden = "true";
|
|
27763
|
+
mark.style.all = "unset";
|
|
27764
|
+
mark.style.position = "fixed";
|
|
27765
|
+
mark.style.top = "0";
|
|
27766
|
+
mark.style.clip = "rect(0, 0, 0, 0)";
|
|
27767
|
+
mark.style.whiteSpace = "pre";
|
|
27768
|
+
mark.style.webkitUserSelect = "text";
|
|
27769
|
+
mark.style.MozUserSelect = "text";
|
|
27770
|
+
mark.style.msUserSelect = "text";
|
|
27771
|
+
mark.style.userSelect = "text";
|
|
27772
|
+
mark.addEventListener("copy", function(e) {
|
|
27773
|
+
e.stopPropagation();
|
|
27774
|
+
if (options.format) {
|
|
27775
|
+
e.preventDefault();
|
|
27776
|
+
if (e.clipboardData) {
|
|
27777
|
+
e.clipboardData.setData(options.format, text2);
|
|
27778
|
+
}
|
|
27779
|
+
}
|
|
27780
|
+
if (options.onCopy && e.clipboardData) {
|
|
27781
|
+
options.onCopy(e.clipboardData);
|
|
27782
|
+
}
|
|
27783
|
+
});
|
|
27784
|
+
return mark;
|
|
27785
|
+
}
|
|
27786
|
+
function findOpenedModalDialog() {
|
|
27787
|
+
let element = document.activeElement;
|
|
27788
|
+
while (element) {
|
|
27789
|
+
if (element.tagName === "DIALOG" && element.open) {
|
|
27790
|
+
return element;
|
|
27791
|
+
}
|
|
27792
|
+
element = element.parentElement;
|
|
27793
|
+
}
|
|
27794
|
+
return null;
|
|
27795
|
+
}
|
|
27796
|
+
function copyViaExecCommand(text2, options) {
|
|
27797
|
+
var reselectPrevious = toggle_selection_default();
|
|
27798
|
+
var range = document.createRange();
|
|
27799
|
+
var selection = document.getSelection();
|
|
27800
|
+
var mark = createHiddenSpan(text2, options);
|
|
27801
|
+
var root = findOpenedModalDialog() || document.fullscreenElement || document.body;
|
|
27802
|
+
var success = false;
|
|
27803
|
+
try {
|
|
27804
|
+
root.appendChild(mark);
|
|
27805
|
+
range.selectNodeContents(mark);
|
|
27806
|
+
selection.removeAllRanges();
|
|
27807
|
+
selection.addRange(range);
|
|
27808
|
+
var successful = document.execCommand("copy");
|
|
27809
|
+
if (!successful) {
|
|
27810
|
+
throw new Error("copy command was unsuccessful");
|
|
27811
|
+
}
|
|
27812
|
+
success = true;
|
|
27813
|
+
} finally {
|
|
27814
|
+
if (typeof selection.removeRange == "function") {
|
|
27815
|
+
selection.removeRange(range);
|
|
27816
|
+
} else {
|
|
27817
|
+
selection.removeAllRanges();
|
|
27818
|
+
}
|
|
27819
|
+
root.removeChild(mark);
|
|
27820
|
+
reselectPrevious();
|
|
27821
|
+
}
|
|
27822
|
+
return success;
|
|
27823
|
+
}
|
|
27824
|
+
async function copy$1(text2, options = {}) {
|
|
27825
|
+
var debug2 = options.debug || false;
|
|
27826
|
+
if (window.isSecureContext && navigator.clipboard) {
|
|
27827
|
+
try {
|
|
27828
|
+
return await copyViaClipboardAPI(text2, options);
|
|
27829
|
+
} catch (err) {
|
|
27830
|
+
debug2 && console.error("unable to copy using navigator.clipboard: ", err);
|
|
27831
|
+
debug2 && console.warn("falling back to execCommand");
|
|
27832
|
+
}
|
|
27833
|
+
} else {
|
|
27834
|
+
debug2 && !window.isSecureContext && console.warn("copy-to-clipboard: navigator.clipboard requires a secure context (HTTPS/localhost). Falling back to execCommand.");
|
|
27835
|
+
}
|
|
27836
|
+
try {
|
|
27837
|
+
return copyViaExecCommand(text2, options);
|
|
27838
|
+
} catch (err) {
|
|
27839
|
+
debug2 && console.error("unable to copy using execCommand: ", err);
|
|
27840
|
+
debug2 && console.error("falling back to prompt");
|
|
27841
|
+
if (options.fallbackToPrompt) {
|
|
27842
|
+
var message2 = formatPromptMessage("message" in options ? options.message : defaultMessage);
|
|
27843
|
+
window.prompt(message2, text2);
|
|
27844
|
+
}
|
|
27845
|
+
}
|
|
27846
|
+
return false;
|
|
27847
|
+
}
|
|
27848
|
+
var index_default = copy$1;
|
|
27849
|
+
function DisplayId({ id, className }) {
|
|
27850
|
+
const [open2, setOpen] = React.useState(false);
|
|
27851
|
+
const onClick = () => {
|
|
27852
|
+
index_default(id);
|
|
27853
|
+
ui.toast.success("Copied to clipboard");
|
|
27854
|
+
};
|
|
27855
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { maxWidth: 260, content: id, open: open2, onOpenChange: setOpen, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { onClick, className: ui.clx("cursor-pointer", className), children: [
|
|
27856
|
+
"#",
|
|
27857
|
+
id.slice(-7)
|
|
27858
|
+
] }) });
|
|
27859
|
+
}
|
|
27860
|
+
const StoreCreditAccountDetailsSection = ({
|
|
27861
|
+
storeCreditAccount
|
|
27862
|
+
}) => {
|
|
27863
|
+
if (!storeCreditAccount || typeof storeCreditAccount.balance === "undefined") {
|
|
27864
|
+
return;
|
|
27865
|
+
}
|
|
27866
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "flex justify-between gap-x-2 px-6 py-6", children: [
|
|
27867
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
27868
|
+
ui.Text,
|
|
27869
|
+
{
|
|
27870
|
+
weight: "plus",
|
|
27871
|
+
size: "xlarge",
|
|
27872
|
+
className: "text-ui-fg-base flex gap-x-4",
|
|
27873
|
+
children: [
|
|
27874
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
27875
|
+
/* @__PURE__ */ jsxRuntime.jsx(CreditCardIcon, { className: "inline" }),
|
|
27876
|
+
" "
|
|
27877
|
+
] }),
|
|
27878
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
27879
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-ui-fg-subtle", children: [
|
|
27880
|
+
storeCreditAccount.currency_code.toUpperCase(),
|
|
27881
|
+
" Account"
|
|
27882
|
+
] }),
|
|
27883
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-base", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
27884
|
+
ui.Text,
|
|
27885
|
+
{
|
|
27886
|
+
weight: "regular",
|
|
27887
|
+
size: "small",
|
|
27888
|
+
className: "text-ui-fg-base flex gap-x-4",
|
|
27889
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(DisplayId, { id: storeCreditAccount.id })
|
|
27890
|
+
}
|
|
27891
|
+
) })
|
|
27892
|
+
] })
|
|
27893
|
+
]
|
|
27894
|
+
}
|
|
27895
|
+
),
|
|
27896
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-x-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
27897
|
+
ActionMenu,
|
|
27898
|
+
{
|
|
27899
|
+
groups: [
|
|
26962
27900
|
{
|
|
26963
|
-
|
|
26964
|
-
|
|
26965
|
-
|
|
26966
|
-
|
|
26967
|
-
|
|
26968
|
-
|
|
26969
|
-
|
|
26970
|
-
|
|
26971
|
-
|
|
27901
|
+
actions: [
|
|
27902
|
+
{
|
|
27903
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CreditCard, {}),
|
|
27904
|
+
label: "Credit the account",
|
|
27905
|
+
to: "credit"
|
|
27906
|
+
},
|
|
27907
|
+
{
|
|
27908
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.MinusMini, {}),
|
|
27909
|
+
label: "Debit the account",
|
|
27910
|
+
to: "debit",
|
|
27911
|
+
disabled: !Number(storeCreditAccount.balance)
|
|
27912
|
+
}
|
|
26972
27913
|
]
|
|
26973
27914
|
}
|
|
26974
|
-
|
|
26975
|
-
|
|
26976
|
-
}
|
|
26977
|
-
);
|
|
27915
|
+
]
|
|
27916
|
+
}
|
|
27917
|
+
) })
|
|
27918
|
+
] });
|
|
26978
27919
|
};
|
|
26979
|
-
|
|
26980
|
-
|
|
27920
|
+
function StoreCreditAccountCustomerSection({
|
|
27921
|
+
customerId
|
|
27922
|
+
}) {
|
|
27923
|
+
const { customer, isPending } = useCustomer(customerId, void 0, {
|
|
27924
|
+
enabled: !!customerId
|
|
27925
|
+
});
|
|
27926
|
+
if (isPending || !customer) {
|
|
27927
|
+
return null;
|
|
27928
|
+
}
|
|
27929
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0", children: [
|
|
27930
|
+
/* @__PURE__ */ jsxRuntime.jsx(Header$5, { title: "Customer" }),
|
|
27931
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
27932
|
+
SidebarLink,
|
|
27933
|
+
{
|
|
27934
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.User, {}),
|
|
27935
|
+
labelKey: customer.email || "N/A",
|
|
27936
|
+
descriptionKey: !customer.first_name && !customer.last_name ? "N/A" : `${customer.first_name} ${customer.last_name}`,
|
|
27937
|
+
to: `/customers/${customer.id}`
|
|
27938
|
+
},
|
|
27939
|
+
customer.id
|
|
27940
|
+
)
|
|
27941
|
+
] });
|
|
27942
|
+
}
|
|
27943
|
+
const columnHelper$8 = ui.createDataTableColumnHelper();
|
|
27944
|
+
const useTransactionsTableColumns = () => {
|
|
26981
27945
|
return React.useMemo(() => {
|
|
26982
27946
|
return [
|
|
26983
|
-
columnHelper$
|
|
26984
|
-
header: "
|
|
27947
|
+
columnHelper$8.accessor("id", {
|
|
27948
|
+
header: "ID",
|
|
26985
27949
|
cell: ({ row }) => {
|
|
26986
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
27950
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DisplayId, { id: row.original.id });
|
|
26987
27951
|
}
|
|
26988
27952
|
}),
|
|
26989
|
-
columnHelper$
|
|
26990
|
-
header: "
|
|
26991
|
-
cell: ({ row }) =>
|
|
26992
|
-
return row.original.customer?.email ?? "N/A";
|
|
26993
|
-
}
|
|
27953
|
+
columnHelper$8.accessor("created_at", {
|
|
27954
|
+
header: "Created At",
|
|
27955
|
+
cell: ({ row }) => formatDate(row.original.created_at, false)
|
|
26994
27956
|
}),
|
|
26995
|
-
columnHelper$
|
|
26996
|
-
header: "
|
|
26997
|
-
cell: ({ row }) =>
|
|
26998
|
-
return formatAmount(
|
|
26999
|
-
row.original.balance,
|
|
27000
|
-
row.original.currency_code
|
|
27001
|
-
);
|
|
27002
|
-
}
|
|
27957
|
+
columnHelper$8.accessor("note", {
|
|
27958
|
+
header: "Description",
|
|
27959
|
+
cell: ({ row }) => row.original.note
|
|
27003
27960
|
}),
|
|
27004
|
-
columnHelper$
|
|
27005
|
-
header: "
|
|
27961
|
+
columnHelper$8.accessor("note", {
|
|
27962
|
+
header: "Note",
|
|
27006
27963
|
cell: ({ row }) => {
|
|
27007
|
-
return
|
|
27008
|
-
row.original.credits,
|
|
27009
|
-
row.original.currency_code
|
|
27010
|
-
);
|
|
27964
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { title: row.original.note, className: "max-w-[300px] truncate", children: row.original.note || "-" });
|
|
27011
27965
|
}
|
|
27012
27966
|
}),
|
|
27013
|
-
columnHelper$
|
|
27014
|
-
header: "
|
|
27967
|
+
columnHelper$8.accessor("amount", {
|
|
27968
|
+
header: "Amount",
|
|
27015
27969
|
cell: ({ row }) => {
|
|
27016
|
-
|
|
27017
|
-
|
|
27018
|
-
row.original.
|
|
27970
|
+
const isDebit = row.original.type === "debit";
|
|
27971
|
+
return row.original.account.currency_code && formatAmount(
|
|
27972
|
+
row.original.amount * (isDebit ? -1 : 1),
|
|
27973
|
+
row.original.account.currency_code
|
|
27019
27974
|
);
|
|
27020
27975
|
}
|
|
27021
|
-
}),
|
|
27022
|
-
columnHelper$9.accessor("created_at", {
|
|
27023
|
-
header: "Created at",
|
|
27024
|
-
cell: ({ row }) => getRelativeDate(row.original.created_at)
|
|
27025
27976
|
})
|
|
27026
27977
|
];
|
|
27027
27978
|
}, []);
|
|
27028
27979
|
};
|
|
27029
|
-
const
|
|
27980
|
+
const useTransactionsTableFilters = ({}) => {
|
|
27030
27981
|
const dateFilterOptions = useDataTableDateFilters$1();
|
|
27031
|
-
const customerFilterOptions = useCustomerFilters();
|
|
27032
27982
|
return React.useMemo(() => {
|
|
27033
|
-
return [...dateFilterOptions
|
|
27034
|
-
}, [dateFilterOptions
|
|
27983
|
+
return [...dateFilterOptions];
|
|
27984
|
+
}, [dateFilterOptions]);
|
|
27035
27985
|
};
|
|
27036
|
-
const
|
|
27986
|
+
const useTransactionsTableQuery = ({
|
|
27037
27987
|
prefix,
|
|
27038
27988
|
pageSize = 20
|
|
27039
27989
|
}) => {
|
|
27040
27990
|
const queryObject = useQueryParams(
|
|
27041
|
-
["offset", "
|
|
27991
|
+
["offset", "limit", "currency_code", "created_at", "updated_at"],
|
|
27042
27992
|
prefix
|
|
27043
27993
|
);
|
|
27044
|
-
const {
|
|
27045
|
-
offset: offset2,
|
|
27046
|
-
created_at,
|
|
27047
|
-
updated_at,
|
|
27048
|
-
customer_id,
|
|
27049
|
-
currency_code,
|
|
27050
|
-
...rest
|
|
27051
|
-
} = queryObject;
|
|
27994
|
+
const { offset: offset2, limit, created_at, updated_at, ...rest } = queryObject;
|
|
27052
27995
|
const searchParams = {
|
|
27053
|
-
limit: pageSize,
|
|
27996
|
+
limit: limit ? Number(limit) : pageSize,
|
|
27054
27997
|
offset: offset2 ? Number(offset2) : 0,
|
|
27055
27998
|
created_at: created_at ? JSON.parse(created_at) : void 0,
|
|
27056
27999
|
updated_at: updated_at ? JSON.parse(updated_at) : void 0,
|
|
27057
|
-
customer_id: customer_id ? JSON.parse(customer_id) : void 0,
|
|
27058
|
-
currency_code: currency_code ? JSON.parse(currency_code) : void 0,
|
|
27059
28000
|
...rest
|
|
27060
28001
|
};
|
|
27061
28002
|
return searchParams;
|
|
27062
28003
|
};
|
|
27063
|
-
const PAGE_SIZE$
|
|
27064
|
-
function
|
|
27065
|
-
const queryParams =
|
|
27066
|
-
pageSize: PAGE_SIZE$
|
|
27067
|
-
});
|
|
27068
|
-
const {
|
|
27069
|
-
store_credit_accounts: storeCreditAccounts,
|
|
27070
|
-
isPending,
|
|
27071
|
-
count: count2
|
|
27072
|
-
} = useStoreCreditAccounts({
|
|
27073
|
-
...queryParams,
|
|
27074
|
-
order: queryParams.order ?? "-created_at"
|
|
28004
|
+
const PAGE_SIZE$4 = 10;
|
|
28005
|
+
function TransactionsTable({ id }) {
|
|
28006
|
+
const queryParams = useTransactionsTableQuery({
|
|
28007
|
+
pageSize: PAGE_SIZE$4
|
|
27075
28008
|
});
|
|
27076
|
-
const
|
|
27077
|
-
|
|
28009
|
+
const { transactions, isLoading, count: count2 } = useStoreCreditAccountTransactions(
|
|
28010
|
+
id,
|
|
28011
|
+
{
|
|
28012
|
+
...queryParams,
|
|
28013
|
+
order: queryParams.order ?? "-created_at",
|
|
28014
|
+
fields: "*account"
|
|
28015
|
+
}
|
|
28016
|
+
);
|
|
28017
|
+
const columns = useTransactionsTableColumns();
|
|
28018
|
+
const filters = useTransactionsTableFilters({});
|
|
27078
28019
|
return /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
27079
28020
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
27080
28021
|
DataTable,
|
|
27081
28022
|
{
|
|
27082
|
-
data:
|
|
28023
|
+
data: transactions ?? [],
|
|
27083
28024
|
getRowId: (row) => row.id,
|
|
27084
28025
|
columns,
|
|
27085
28026
|
filters,
|
|
27086
|
-
isLoading
|
|
27087
|
-
pageSize: PAGE_SIZE$
|
|
28027
|
+
isLoading,
|
|
28028
|
+
pageSize: PAGE_SIZE$4,
|
|
27088
28029
|
rowCount: count2,
|
|
27089
28030
|
enableSearch: false,
|
|
27090
|
-
heading: "
|
|
27091
|
-
rowHref: (row) => `${row.id}`,
|
|
28031
|
+
heading: "Transactions",
|
|
27092
28032
|
emptyState: {
|
|
27093
28033
|
empty: {
|
|
27094
|
-
heading: "No
|
|
27095
|
-
description: "Create a new store credit account to get started."
|
|
28034
|
+
heading: "No transactions found"
|
|
27096
28035
|
},
|
|
27097
28036
|
filtered: {
|
|
27098
28037
|
heading: "No results found",
|
|
27099
|
-
description: "No
|
|
27100
|
-
}
|
|
27101
|
-
},
|
|
27102
|
-
actions: [
|
|
27103
|
-
{
|
|
27104
|
-
label: "Create",
|
|
27105
|
-
to: "/store-credit-accounts/create"
|
|
28038
|
+
description: "No transactions match your filter criteria."
|
|
27106
28039
|
}
|
|
27107
|
-
|
|
28040
|
+
}
|
|
27108
28041
|
}
|
|
27109
28042
|
) }),
|
|
27110
28043
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
27111
28044
|
] });
|
|
27112
28045
|
}
|
|
27113
|
-
|
|
27114
|
-
|
|
27115
|
-
|
|
27116
|
-
components.LayoutComposer,
|
|
27117
|
-
{
|
|
27118
|
-
widgetsZonePrefix: "store_credit_account.list",
|
|
27119
|
-
preferredLayoutId: "core:single-column",
|
|
27120
|
-
sections: {
|
|
27121
|
-
main: /* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountsTable", children: /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountsTable, {}) })
|
|
27122
|
-
}
|
|
27123
|
-
}
|
|
27124
|
-
),
|
|
27125
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Toaster, {})
|
|
27126
|
-
] });
|
|
27127
|
-
};
|
|
27128
|
-
const config$1 = adminSdk.defineRouteConfig({
|
|
27129
|
-
label: "Store Credits",
|
|
27130
|
-
icon: StoreCreditIcon
|
|
27131
|
-
});
|
|
27132
|
-
var isObject_1;
|
|
27133
|
-
var hasRequiredIsObject;
|
|
27134
|
-
function requireIsObject() {
|
|
27135
|
-
if (hasRequiredIsObject) return isObject_1;
|
|
27136
|
-
hasRequiredIsObject = 1;
|
|
27137
|
-
function isObject2(value) {
|
|
27138
|
-
var type = typeof value;
|
|
27139
|
-
return value != null && (type == "object" || type == "function");
|
|
28046
|
+
function StoreCreditAccountCodeSection({ code }) {
|
|
28047
|
+
if (!code) {
|
|
28048
|
+
return null;
|
|
27140
28049
|
}
|
|
27141
|
-
|
|
27142
|
-
|
|
28050
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0", children: [
|
|
28051
|
+
/* @__PURE__ */ jsxRuntime.jsx(Header$5, { title: "Account Code" }),
|
|
28052
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-4 px-6 mb-2", children: [
|
|
28053
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.Share, { className: "inline" }),
|
|
28054
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle text-sm", children: code })
|
|
28055
|
+
] })
|
|
28056
|
+
] });
|
|
27143
28057
|
}
|
|
27144
|
-
|
|
27145
|
-
|
|
27146
|
-
|
|
27147
|
-
|
|
27148
|
-
|
|
27149
|
-
|
|
27150
|
-
|
|
27151
|
-
return _freeGlobal;
|
|
27152
|
-
}
|
|
27153
|
-
var _root;
|
|
27154
|
-
var hasRequired_root;
|
|
27155
|
-
function require_root() {
|
|
27156
|
-
if (hasRequired_root) return _root;
|
|
27157
|
-
hasRequired_root = 1;
|
|
27158
|
-
var freeGlobal = require_freeGlobal();
|
|
27159
|
-
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
27160
|
-
var root = freeGlobal || freeSelf || Function("return this")();
|
|
27161
|
-
_root = root;
|
|
27162
|
-
return _root;
|
|
27163
|
-
}
|
|
27164
|
-
var now_1;
|
|
27165
|
-
var hasRequiredNow;
|
|
27166
|
-
function requireNow() {
|
|
27167
|
-
if (hasRequiredNow) return now_1;
|
|
27168
|
-
hasRequiredNow = 1;
|
|
27169
|
-
var root = require_root();
|
|
27170
|
-
var now = function() {
|
|
27171
|
-
return root.Date.now();
|
|
27172
|
-
};
|
|
27173
|
-
now_1 = now;
|
|
27174
|
-
return now_1;
|
|
27175
|
-
}
|
|
27176
|
-
var _trimmedEndIndex;
|
|
27177
|
-
var hasRequired_trimmedEndIndex;
|
|
27178
|
-
function require_trimmedEndIndex() {
|
|
27179
|
-
if (hasRequired_trimmedEndIndex) return _trimmedEndIndex;
|
|
27180
|
-
hasRequired_trimmedEndIndex = 1;
|
|
27181
|
-
var reWhitespace = /\s/;
|
|
27182
|
-
function trimmedEndIndex(string2) {
|
|
27183
|
-
var index = string2.length;
|
|
27184
|
-
while (index-- && reWhitespace.test(string2.charAt(index))) {
|
|
27185
|
-
}
|
|
27186
|
-
return index;
|
|
27187
|
-
}
|
|
27188
|
-
_trimmedEndIndex = trimmedEndIndex;
|
|
27189
|
-
return _trimmedEndIndex;
|
|
27190
|
-
}
|
|
27191
|
-
var _baseTrim;
|
|
27192
|
-
var hasRequired_baseTrim;
|
|
27193
|
-
function require_baseTrim() {
|
|
27194
|
-
if (hasRequired_baseTrim) return _baseTrim;
|
|
27195
|
-
hasRequired_baseTrim = 1;
|
|
27196
|
-
var trimmedEndIndex = require_trimmedEndIndex();
|
|
27197
|
-
var reTrimStart = /^\s+/;
|
|
27198
|
-
function baseTrim(string2) {
|
|
27199
|
-
return string2 ? string2.slice(0, trimmedEndIndex(string2) + 1).replace(reTrimStart, "") : string2;
|
|
27200
|
-
}
|
|
27201
|
-
_baseTrim = baseTrim;
|
|
27202
|
-
return _baseTrim;
|
|
27203
|
-
}
|
|
27204
|
-
var _Symbol;
|
|
27205
|
-
var hasRequired_Symbol;
|
|
27206
|
-
function require_Symbol() {
|
|
27207
|
-
if (hasRequired_Symbol) return _Symbol;
|
|
27208
|
-
hasRequired_Symbol = 1;
|
|
27209
|
-
var root = require_root();
|
|
27210
|
-
var Symbol2 = root.Symbol;
|
|
27211
|
-
_Symbol = Symbol2;
|
|
27212
|
-
return _Symbol;
|
|
27213
|
-
}
|
|
27214
|
-
var _getRawTag;
|
|
27215
|
-
var hasRequired_getRawTag;
|
|
27216
|
-
function require_getRawTag() {
|
|
27217
|
-
if (hasRequired_getRawTag) return _getRawTag;
|
|
27218
|
-
hasRequired_getRawTag = 1;
|
|
27219
|
-
var Symbol2 = require_Symbol();
|
|
27220
|
-
var objectProto = Object.prototype;
|
|
27221
|
-
var hasOwnProperty2 = objectProto.hasOwnProperty;
|
|
27222
|
-
var nativeObjectToString = objectProto.toString;
|
|
27223
|
-
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
|
|
27224
|
-
function getRawTag(value) {
|
|
27225
|
-
var isOwn = hasOwnProperty2.call(value, symToStringTag), tag = value[symToStringTag];
|
|
27226
|
-
try {
|
|
27227
|
-
value[symToStringTag] = void 0;
|
|
27228
|
-
var unmasked = true;
|
|
27229
|
-
} catch (e) {
|
|
27230
|
-
}
|
|
27231
|
-
var result = nativeObjectToString.call(value);
|
|
27232
|
-
if (unmasked) {
|
|
27233
|
-
if (isOwn) {
|
|
27234
|
-
value[symToStringTag] = tag;
|
|
27235
|
-
} else {
|
|
27236
|
-
delete value[symToStringTag];
|
|
27237
|
-
}
|
|
27238
|
-
}
|
|
27239
|
-
return result;
|
|
27240
|
-
}
|
|
27241
|
-
_getRawTag = getRawTag;
|
|
27242
|
-
return _getRawTag;
|
|
27243
|
-
}
|
|
27244
|
-
var _objectToString;
|
|
27245
|
-
var hasRequired_objectToString;
|
|
27246
|
-
function require_objectToString() {
|
|
27247
|
-
if (hasRequired_objectToString) return _objectToString;
|
|
27248
|
-
hasRequired_objectToString = 1;
|
|
27249
|
-
var objectProto = Object.prototype;
|
|
27250
|
-
var nativeObjectToString = objectProto.toString;
|
|
27251
|
-
function objectToString(value) {
|
|
27252
|
-
return nativeObjectToString.call(value);
|
|
27253
|
-
}
|
|
27254
|
-
_objectToString = objectToString;
|
|
27255
|
-
return _objectToString;
|
|
27256
|
-
}
|
|
27257
|
-
var _baseGetTag;
|
|
27258
|
-
var hasRequired_baseGetTag;
|
|
27259
|
-
function require_baseGetTag() {
|
|
27260
|
-
if (hasRequired_baseGetTag) return _baseGetTag;
|
|
27261
|
-
hasRequired_baseGetTag = 1;
|
|
27262
|
-
var Symbol2 = require_Symbol(), getRawTag = require_getRawTag(), objectToString = require_objectToString();
|
|
27263
|
-
var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
|
|
27264
|
-
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
|
|
27265
|
-
function baseGetTag(value) {
|
|
27266
|
-
if (value == null) {
|
|
27267
|
-
return value === void 0 ? undefinedTag : nullTag;
|
|
27268
|
-
}
|
|
27269
|
-
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
|
27270
|
-
}
|
|
27271
|
-
_baseGetTag = baseGetTag;
|
|
27272
|
-
return _baseGetTag;
|
|
27273
|
-
}
|
|
27274
|
-
var isObjectLike_1;
|
|
27275
|
-
var hasRequiredIsObjectLike;
|
|
27276
|
-
function requireIsObjectLike() {
|
|
27277
|
-
if (hasRequiredIsObjectLike) return isObjectLike_1;
|
|
27278
|
-
hasRequiredIsObjectLike = 1;
|
|
27279
|
-
function isObjectLike(value) {
|
|
27280
|
-
return value != null && typeof value == "object";
|
|
27281
|
-
}
|
|
27282
|
-
isObjectLike_1 = isObjectLike;
|
|
27283
|
-
return isObjectLike_1;
|
|
27284
|
-
}
|
|
27285
|
-
var isSymbol_1;
|
|
27286
|
-
var hasRequiredIsSymbol;
|
|
27287
|
-
function requireIsSymbol() {
|
|
27288
|
-
if (hasRequiredIsSymbol) return isSymbol_1;
|
|
27289
|
-
hasRequiredIsSymbol = 1;
|
|
27290
|
-
var baseGetTag = require_baseGetTag(), isObjectLike = requireIsObjectLike();
|
|
27291
|
-
var symbolTag = "[object Symbol]";
|
|
27292
|
-
function isSymbol(value) {
|
|
27293
|
-
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
|
|
27294
|
-
}
|
|
27295
|
-
isSymbol_1 = isSymbol;
|
|
27296
|
-
return isSymbol_1;
|
|
27297
|
-
}
|
|
27298
|
-
var toNumber_1;
|
|
27299
|
-
var hasRequiredToNumber;
|
|
27300
|
-
function requireToNumber() {
|
|
27301
|
-
if (hasRequiredToNumber) return toNumber_1;
|
|
27302
|
-
hasRequiredToNumber = 1;
|
|
27303
|
-
var baseTrim = require_baseTrim(), isObject2 = requireIsObject(), isSymbol = requireIsSymbol();
|
|
27304
|
-
var NAN = 0 / 0;
|
|
27305
|
-
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
27306
|
-
var reIsBinary = /^0b[01]+$/i;
|
|
27307
|
-
var reIsOctal = /^0o[0-7]+$/i;
|
|
27308
|
-
var freeParseInt = parseInt;
|
|
27309
|
-
function toNumber(value) {
|
|
27310
|
-
if (typeof value == "number") {
|
|
27311
|
-
return value;
|
|
27312
|
-
}
|
|
27313
|
-
if (isSymbol(value)) {
|
|
27314
|
-
return NAN;
|
|
27315
|
-
}
|
|
27316
|
-
if (isObject2(value)) {
|
|
27317
|
-
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
27318
|
-
value = isObject2(other) ? other + "" : other;
|
|
27319
|
-
}
|
|
27320
|
-
if (typeof value != "string") {
|
|
27321
|
-
return value === 0 ? value : +value;
|
|
27322
|
-
}
|
|
27323
|
-
value = baseTrim(value);
|
|
27324
|
-
var isBinary = reIsBinary.test(value);
|
|
27325
|
-
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
28058
|
+
const StoreCreditAccountPage = () => {
|
|
28059
|
+
const { id } = reactRouterDom.useParams();
|
|
28060
|
+
const { store_credit_account: storeCreditAccount } = useStoreCreditAccount(
|
|
28061
|
+
id
|
|
28062
|
+
);
|
|
28063
|
+
if (!storeCreditAccount) {
|
|
28064
|
+
return;
|
|
27326
28065
|
}
|
|
27327
|
-
|
|
27328
|
-
|
|
27329
|
-
|
|
27330
|
-
|
|
27331
|
-
|
|
27332
|
-
|
|
27333
|
-
|
|
27334
|
-
|
|
27335
|
-
|
|
27336
|
-
|
|
27337
|
-
|
|
27338
|
-
|
|
27339
|
-
|
|
27340
|
-
|
|
27341
|
-
|
|
27342
|
-
|
|
27343
|
-
|
|
27344
|
-
|
|
27345
|
-
|
|
27346
|
-
|
|
27347
|
-
|
|
27348
|
-
|
|
27349
|
-
|
|
27350
|
-
|
|
27351
|
-
|
|
27352
|
-
|
|
27353
|
-
|
|
27354
|
-
|
|
27355
|
-
|
|
27356
|
-
|
|
27357
|
-
|
|
27358
|
-
lastInvokeTime = time2;
|
|
27359
|
-
timerId = setTimeout(timerExpired, wait);
|
|
27360
|
-
return leading ? invokeFunc(time2) : result;
|
|
27361
|
-
}
|
|
27362
|
-
function remainingWait(time2) {
|
|
27363
|
-
var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
|
|
27364
|
-
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
|
|
27365
|
-
}
|
|
27366
|
-
function shouldInvoke(time2) {
|
|
27367
|
-
var timeSinceLastCall = time2 - lastCallTime, timeSinceLastInvoke = time2 - lastInvokeTime;
|
|
27368
|
-
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
|
|
27369
|
-
}
|
|
27370
|
-
function timerExpired() {
|
|
27371
|
-
var time2 = now();
|
|
27372
|
-
if (shouldInvoke(time2)) {
|
|
27373
|
-
return trailingEdge(time2);
|
|
28066
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
28067
|
+
components.LayoutComposer,
|
|
28068
|
+
{
|
|
28069
|
+
widgetsZonePrefix: "store_credit_account.details",
|
|
28070
|
+
preferredLayoutId: "core:two-column",
|
|
28071
|
+
data: storeCreditAccount,
|
|
28072
|
+
sections: {
|
|
28073
|
+
main: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
28074
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountDetailsSection", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
28075
|
+
StoreCreditAccountDetailsSection,
|
|
28076
|
+
{
|
|
28077
|
+
storeCreditAccount
|
|
28078
|
+
}
|
|
28079
|
+
) }),
|
|
28080
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "TransactionsTable", children: /* @__PURE__ */ jsxRuntime.jsx(TransactionsTable, { id: storeCreditAccount.id }) })
|
|
28081
|
+
] }),
|
|
28082
|
+
side: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
28083
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountBalanceSection", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
28084
|
+
StoreCreditAccountBalanceSection,
|
|
28085
|
+
{
|
|
28086
|
+
storeCreditAccount
|
|
28087
|
+
}
|
|
28088
|
+
) }),
|
|
28089
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountCodeSection", children: /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountCodeSection, { code: storeCreditAccount.code }) }),
|
|
28090
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountCustomerSection", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
28091
|
+
StoreCreditAccountCustomerSection,
|
|
28092
|
+
{
|
|
28093
|
+
customerId: storeCreditAccount.customer_id
|
|
28094
|
+
}
|
|
28095
|
+
) })
|
|
28096
|
+
] })
|
|
27374
28097
|
}
|
|
27375
|
-
timerId = setTimeout(timerExpired, remainingWait(time2));
|
|
27376
28098
|
}
|
|
27377
|
-
|
|
27378
|
-
|
|
27379
|
-
|
|
27380
|
-
|
|
28099
|
+
);
|
|
28100
|
+
};
|
|
28101
|
+
const KeyboundForm = React__namespace.default.forwardRef(({ onSubmit, onKeyDown, ...rest }, ref) => {
|
|
28102
|
+
const handleSubmit = (event) => {
|
|
28103
|
+
event.preventDefault();
|
|
28104
|
+
onSubmit?.(event);
|
|
28105
|
+
};
|
|
28106
|
+
const handleKeyDown = (event) => {
|
|
28107
|
+
if (event.key === "Enter") {
|
|
28108
|
+
if (event.target instanceof HTMLTextAreaElement && !(event.metaKey || event.ctrlKey)) {
|
|
28109
|
+
return;
|
|
27381
28110
|
}
|
|
27382
|
-
|
|
27383
|
-
|
|
27384
|
-
|
|
27385
|
-
function cancel() {
|
|
27386
|
-
if (timerId !== void 0) {
|
|
27387
|
-
clearTimeout(timerId);
|
|
28111
|
+
event.preventDefault();
|
|
28112
|
+
if (event.metaKey || event.ctrlKey) {
|
|
28113
|
+
handleSubmit(event);
|
|
27388
28114
|
}
|
|
27389
|
-
lastInvokeTime = 0;
|
|
27390
|
-
lastArgs = lastCallTime = lastThis = timerId = void 0;
|
|
27391
28115
|
}
|
|
27392
|
-
|
|
27393
|
-
|
|
27394
|
-
|
|
27395
|
-
|
|
27396
|
-
|
|
27397
|
-
|
|
27398
|
-
|
|
27399
|
-
|
|
27400
|
-
if (isInvoking) {
|
|
27401
|
-
if (timerId === void 0) {
|
|
27402
|
-
return leadingEdge(lastCallTime);
|
|
27403
|
-
}
|
|
27404
|
-
if (maxing) {
|
|
27405
|
-
clearTimeout(timerId);
|
|
27406
|
-
timerId = setTimeout(timerExpired, wait);
|
|
27407
|
-
return invokeFunc(lastCallTime);
|
|
27408
|
-
}
|
|
27409
|
-
}
|
|
27410
|
-
if (timerId === void 0) {
|
|
27411
|
-
timerId = setTimeout(timerExpired, wait);
|
|
27412
|
-
}
|
|
27413
|
-
return result;
|
|
28116
|
+
};
|
|
28117
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
28118
|
+
"form",
|
|
28119
|
+
{
|
|
28120
|
+
...rest,
|
|
28121
|
+
onSubmit: handleSubmit,
|
|
28122
|
+
onKeyDown: onKeyDown ?? handleKeyDown,
|
|
28123
|
+
ref
|
|
27414
28124
|
}
|
|
27415
|
-
debounced.cancel = cancel;
|
|
27416
|
-
debounced.flush = flush;
|
|
27417
|
-
return debounced;
|
|
27418
|
-
}
|
|
27419
|
-
debounce_1 = debounce2;
|
|
27420
|
-
return debounce_1;
|
|
27421
|
-
}
|
|
27422
|
-
var debounceExports = requireDebounce();
|
|
27423
|
-
const debounce$1 = /* @__PURE__ */ getDefaultExportFromCjs(debounceExports);
|
|
27424
|
-
const useDebouncedSearch = () => {
|
|
27425
|
-
const [searchValue, onSearchValueChange] = React.useState("");
|
|
27426
|
-
const [debouncedQuery, setDebouncedQuery] = React.useState("");
|
|
27427
|
-
const debouncedUpdate = React.useCallback(
|
|
27428
|
-
debounce$1((query) => setDebouncedQuery(query), 300),
|
|
27429
|
-
[]
|
|
27430
28125
|
);
|
|
27431
|
-
|
|
27432
|
-
|
|
27433
|
-
|
|
27434
|
-
}
|
|
27435
|
-
|
|
27436
|
-
|
|
27437
|
-
|
|
27438
|
-
|
|
27439
|
-
|
|
28126
|
+
});
|
|
28127
|
+
KeyboundForm.displayName = "KeyboundForm";
|
|
28128
|
+
const Note$1 = () => {
|
|
28129
|
+
const { id } = reactRouterDom.useParams();
|
|
28130
|
+
const {
|
|
28131
|
+
store_credit_account: storeCreditAccount,
|
|
28132
|
+
isPending,
|
|
28133
|
+
isError,
|
|
28134
|
+
error: error2
|
|
28135
|
+
} = useStoreCreditAccount(id, {});
|
|
28136
|
+
if (isError) {
|
|
28137
|
+
throw error2;
|
|
28138
|
+
}
|
|
28139
|
+
const isReady = !isPending && !!storeCreditAccount;
|
|
28140
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
28141
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
28142
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Credit store credit account" }) }),
|
|
28143
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Credit the store credit account" }) })
|
|
28144
|
+
] }),
|
|
28145
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountCreditForm, { storeCreditAccount })
|
|
28146
|
+
] });
|
|
27440
28147
|
};
|
|
27441
|
-
const
|
|
27442
|
-
|
|
27443
|
-
queryFn,
|
|
27444
|
-
getOptions,
|
|
27445
|
-
defaultValue: defaultValue2,
|
|
27446
|
-
defaultValueKey,
|
|
27447
|
-
pageSize = 10
|
|
28148
|
+
const StoreCreditAccountCreditForm = ({
|
|
28149
|
+
storeCreditAccount
|
|
27448
28150
|
}) => {
|
|
27449
|
-
const
|
|
27450
|
-
|
|
27451
|
-
|
|
27452
|
-
|
|
27453
|
-
|
|
27454
|
-
|
|
27455
|
-
|
|
27456
|
-
limit: Array.isArray(defaultValue2) ? defaultValue2.length : 1
|
|
27457
|
-
});
|
|
27458
|
-
},
|
|
27459
|
-
enabled: !!defaultValue2
|
|
27460
|
-
});
|
|
27461
|
-
const { data, ...rest } = reactQuery.useInfiniteQuery({
|
|
27462
|
-
queryKey: [...queryKey, query],
|
|
27463
|
-
queryFn: async ({ pageParam = 0 }) => {
|
|
27464
|
-
return await queryFn({
|
|
27465
|
-
q: query,
|
|
27466
|
-
limit: pageSize,
|
|
27467
|
-
offset: pageParam
|
|
27468
|
-
});
|
|
27469
|
-
},
|
|
27470
|
-
initialPageParam: 0,
|
|
27471
|
-
getNextPageParam: (lastPage) => {
|
|
27472
|
-
const moreItemsExist = lastPage.count > lastPage.offset + lastPage.limit;
|
|
27473
|
-
return moreItemsExist ? lastPage.offset + lastPage.limit : void 0;
|
|
28151
|
+
const form = useForm({
|
|
28152
|
+
defaultValues: {
|
|
28153
|
+
amount: {
|
|
28154
|
+
float: 0,
|
|
28155
|
+
value: ""
|
|
28156
|
+
},
|
|
28157
|
+
note: ""
|
|
27474
28158
|
},
|
|
27475
|
-
|
|
28159
|
+
resolver: u(schema$3)
|
|
27476
28160
|
});
|
|
27477
|
-
const
|
|
27478
|
-
|
|
27479
|
-
|
|
27480
|
-
|
|
27481
|
-
|
|
27482
|
-
|
|
27483
|
-
|
|
28161
|
+
const { mutateAsync, isPending } = useCreditStoreCreditAccount(
|
|
28162
|
+
storeCreditAccount.id
|
|
28163
|
+
);
|
|
28164
|
+
const { handleSuccess } = useRouteModal();
|
|
28165
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
28166
|
+
if (data.amount.float <= 0) {
|
|
28167
|
+
form.setError("amount", { message: "Amount must be greater than 0" });
|
|
28168
|
+
return;
|
|
28169
|
+
}
|
|
28170
|
+
await mutateAsync(
|
|
28171
|
+
{ amount: data.amount.float, note: data.note },
|
|
28172
|
+
{
|
|
28173
|
+
onSuccess: () => handleSuccess(),
|
|
28174
|
+
onError: (error2) => ui.toast.error(error2.message)
|
|
27484
28175
|
}
|
|
27485
|
-
|
|
27486
|
-
}
|
|
27487
|
-
return {
|
|
27488
|
-
|
|
27489
|
-
|
|
27490
|
-
|
|
27491
|
-
|
|
27492
|
-
|
|
27493
|
-
|
|
28176
|
+
);
|
|
28177
|
+
});
|
|
28178
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
28179
|
+
KeyboundForm,
|
|
28180
|
+
{
|
|
28181
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
28182
|
+
onSubmit,
|
|
28183
|
+
children: [
|
|
28184
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
|
|
28185
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
28186
|
+
Form$2.Field,
|
|
28187
|
+
{
|
|
28188
|
+
control: form.control,
|
|
28189
|
+
name: "amount",
|
|
28190
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
28191
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Amount" }),
|
|
28192
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
28193
|
+
ui.CurrencyInput,
|
|
28194
|
+
{
|
|
28195
|
+
min: 0,
|
|
28196
|
+
placeholder: "0",
|
|
28197
|
+
value: field.value.value,
|
|
28198
|
+
onValueChange: (_value, _name, values) => {
|
|
28199
|
+
field.onChange({
|
|
28200
|
+
value: values?.value,
|
|
28201
|
+
float: values?.float || null
|
|
28202
|
+
});
|
|
28203
|
+
},
|
|
28204
|
+
symbol: currencies[storeCreditAccount.currency_code.toUpperCase()].symbol_native,
|
|
28205
|
+
code: storeCreditAccount.currency_code.toUpperCase()
|
|
28206
|
+
}
|
|
28207
|
+
) }),
|
|
28208
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
28209
|
+
] })
|
|
28210
|
+
}
|
|
28211
|
+
),
|
|
28212
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
28213
|
+
Form$2.Field,
|
|
28214
|
+
{
|
|
28215
|
+
control: form.control,
|
|
28216
|
+
name: "note",
|
|
28217
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
28218
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Note" }),
|
|
28219
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Textarea, { ...field }) }),
|
|
28220
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
28221
|
+
] })
|
|
28222
|
+
}
|
|
28223
|
+
)
|
|
28224
|
+
] }),
|
|
28225
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
28226
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
28227
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
28228
|
+
] }) })
|
|
28229
|
+
]
|
|
28230
|
+
}
|
|
28231
|
+
) });
|
|
27494
28232
|
};
|
|
27495
|
-
const
|
|
27496
|
-
|
|
27497
|
-
|
|
28233
|
+
const schema$3 = zod.z.object({
|
|
28234
|
+
note: zod.z.string(),
|
|
28235
|
+
amount: zod.z.object({
|
|
28236
|
+
float: zod.z.number(),
|
|
28237
|
+
value: zod.z.string()
|
|
28238
|
+
})
|
|
27498
28239
|
});
|
|
27499
|
-
const
|
|
27500
|
-
const {
|
|
27501
|
-
const
|
|
27502
|
-
|
|
28240
|
+
const Debit = () => {
|
|
28241
|
+
const { id } = reactRouterDom.useParams();
|
|
28242
|
+
const {
|
|
28243
|
+
store_credit_account: storeCreditAccount,
|
|
28244
|
+
isPending,
|
|
28245
|
+
isError,
|
|
28246
|
+
error: error2
|
|
28247
|
+
} = useStoreCreditAccount(id, {});
|
|
28248
|
+
if (isError) {
|
|
28249
|
+
throw error2;
|
|
28250
|
+
}
|
|
28251
|
+
const isReady = !isPending && !!storeCreditAccount;
|
|
28252
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
28253
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
28254
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Debit store credit account" }) }),
|
|
28255
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Debit the store credit account" }) })
|
|
28256
|
+
] }),
|
|
28257
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountDebitForm, { storeCreditAccount })
|
|
28258
|
+
] });
|
|
28259
|
+
};
|
|
28260
|
+
const StoreCreditAccountDebitForm = ({
|
|
28261
|
+
storeCreditAccount
|
|
28262
|
+
}) => {
|
|
27503
28263
|
const form = useForm({
|
|
27504
28264
|
defaultValues: {
|
|
27505
|
-
|
|
27506
|
-
|
|
28265
|
+
amount: {
|
|
28266
|
+
float: 0,
|
|
28267
|
+
value: ""
|
|
28268
|
+
},
|
|
28269
|
+
note: ""
|
|
27507
28270
|
},
|
|
27508
|
-
resolver: u(
|
|
28271
|
+
resolver: u(schema$2)
|
|
27509
28272
|
});
|
|
27510
|
-
const { mutateAsync
|
|
27511
|
-
|
|
27512
|
-
|
|
27513
|
-
|
|
28273
|
+
const { mutateAsync, isPending } = useDebitStoreCreditAccount(
|
|
28274
|
+
storeCreditAccount.id
|
|
28275
|
+
);
|
|
28276
|
+
const { handleSuccess } = useRouteModal();
|
|
28277
|
+
const balance = storeCreditAccount.balance ?? 0;
|
|
28278
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
28279
|
+
if (data.amount.float <= 0) {
|
|
28280
|
+
form.setError("amount", { message: "Amount must be greater than 0" });
|
|
28281
|
+
return;
|
|
27514
28282
|
}
|
|
27515
|
-
|
|
27516
|
-
|
|
27517
|
-
|
|
27518
|
-
|
|
27519
|
-
|
|
27520
|
-
onError: (error2) => {
|
|
27521
|
-
ui.toast.error(error2.message);
|
|
27522
|
-
}
|
|
27523
|
-
});
|
|
27524
|
-
});
|
|
27525
|
-
const [currencySearchValue, setCurrencySearchValue] = React.useState("");
|
|
27526
|
-
const currencyOptions = React.useMemo(() => {
|
|
27527
|
-
const options = Object.values(currencies).map((currency) => ({
|
|
27528
|
-
label: `${currency.code} - ${currency.name} (${currency.symbol_native})`,
|
|
27529
|
-
value: currency.code.toLowerCase()
|
|
27530
|
-
}));
|
|
27531
|
-
if (!currencySearchValue) {
|
|
27532
|
-
return options;
|
|
28283
|
+
if (data.amount.float > balance) {
|
|
28284
|
+
form.setError("amount", {
|
|
28285
|
+
message: "Amount can't be greater than the current balance"
|
|
28286
|
+
});
|
|
28287
|
+
return;
|
|
27533
28288
|
}
|
|
27534
|
-
|
|
27535
|
-
|
|
28289
|
+
await mutateAsync(
|
|
28290
|
+
{ amount: data.amount.float, note: data.note },
|
|
28291
|
+
{
|
|
28292
|
+
onSuccess: () => handleSuccess(),
|
|
28293
|
+
onError: (error2) => ui.toast.error(error2.message)
|
|
28294
|
+
}
|
|
27536
28295
|
);
|
|
27537
|
-
}, [currencySearchValue]);
|
|
27538
|
-
const {
|
|
27539
|
-
options: customerOptions,
|
|
27540
|
-
fetchNextPage,
|
|
27541
|
-
isFetchingNextPage,
|
|
27542
|
-
searchValue,
|
|
27543
|
-
onSearchValueChange,
|
|
27544
|
-
isLoading
|
|
27545
|
-
} = useComboboxData({
|
|
27546
|
-
queryKey: customersQueryKeys.list(),
|
|
27547
|
-
defaultValue: prefilledCustomerId || void 0,
|
|
27548
|
-
queryFn: async (params) => {
|
|
27549
|
-
return sdk.admin.customer.list(params);
|
|
27550
|
-
},
|
|
27551
|
-
getOptions: (data) => {
|
|
27552
|
-
return data.customers?.map((customer) => {
|
|
27553
|
-
const fullName = [customer.first_name, customer.last_name].filter(Boolean).join(" ");
|
|
27554
|
-
const label = fullName ? `${customer.email} (${fullName})` : customer.email;
|
|
27555
|
-
return {
|
|
27556
|
-
label,
|
|
27557
|
-
value: customer.id
|
|
27558
|
-
};
|
|
27559
|
-
}) || [];
|
|
27560
|
-
}
|
|
27561
28296
|
});
|
|
27562
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
27563
|
-
|
|
27564
|
-
|
|
27565
|
-
|
|
27566
|
-
|
|
27567
|
-
|
|
27568
|
-
|
|
27569
|
-
|
|
27570
|
-
|
|
27571
|
-
|
|
27572
|
-
|
|
27573
|
-
|
|
27574
|
-
|
|
27575
|
-
|
|
27576
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { className: "w-full", children: [
|
|
27577
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { className: "font-normal", children: "Currency" }),
|
|
28297
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
28298
|
+
KeyboundForm,
|
|
28299
|
+
{
|
|
28300
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
28301
|
+
onSubmit,
|
|
28302
|
+
children: [
|
|
28303
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
|
|
28304
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
28305
|
+
Form$2.Field,
|
|
28306
|
+
{
|
|
28307
|
+
control: form.control,
|
|
28308
|
+
name: "amount",
|
|
28309
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
28310
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Amount" }),
|
|
27578
28311
|
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
27579
|
-
|
|
28312
|
+
ui.CurrencyInput,
|
|
27580
28313
|
{
|
|
27581
|
-
|
|
27582
|
-
|
|
27583
|
-
|
|
27584
|
-
|
|
27585
|
-
|
|
27586
|
-
|
|
28314
|
+
min: 0,
|
|
28315
|
+
placeholder: "0",
|
|
28316
|
+
value: field.value.value,
|
|
28317
|
+
onValueChange: (_value, _name, values) => {
|
|
28318
|
+
field.onChange({
|
|
28319
|
+
value: values?.value,
|
|
28320
|
+
float: values?.float || null
|
|
28321
|
+
});
|
|
28322
|
+
},
|
|
28323
|
+
symbol: currencies[storeCreditAccount.currency_code.toUpperCase()].symbol_native,
|
|
28324
|
+
code: storeCreditAccount.currency_code.toUpperCase()
|
|
27587
28325
|
}
|
|
27588
28326
|
) }),
|
|
27589
28327
|
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
27590
|
-
] })
|
|
28328
|
+
] })
|
|
27591
28329
|
}
|
|
27592
|
-
|
|
27593
|
-
|
|
27594
|
-
|
|
27595
|
-
|
|
27596
|
-
|
|
27597
|
-
|
|
27598
|
-
|
|
27599
|
-
|
|
27600
|
-
|
|
27601
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { className: "font-normal", children: "Customer" }),
|
|
27602
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
27603
|
-
Combobox2,
|
|
27604
|
-
{
|
|
27605
|
-
value: field.value,
|
|
27606
|
-
onChange: field.onChange,
|
|
27607
|
-
searchValue,
|
|
27608
|
-
onSearchValueChange,
|
|
27609
|
-
options: customerOptions,
|
|
27610
|
-
placeholder: "Search for a customer...",
|
|
27611
|
-
fetchNextPage,
|
|
27612
|
-
isFetchingNextPage,
|
|
27613
|
-
noResultsPlaceholder: isLoading ? "Loading customers..." : "No customers found"
|
|
27614
|
-
}
|
|
27615
|
-
) }),
|
|
28330
|
+
),
|
|
28331
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
28332
|
+
Form$2.Field,
|
|
28333
|
+
{
|
|
28334
|
+
control: form.control,
|
|
28335
|
+
name: "note",
|
|
28336
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
28337
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Note" }),
|
|
28338
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Textarea, { ...field }) }),
|
|
27616
28339
|
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
27617
|
-
] })
|
|
28340
|
+
] })
|
|
27618
28341
|
}
|
|
27619
|
-
|
|
27620
|
-
)
|
|
27621
|
-
|
|
27622
|
-
|
|
27623
|
-
|
|
27624
|
-
|
|
27625
|
-
|
|
27626
|
-
|
|
27627
|
-
|
|
27628
|
-
variant: "primary",
|
|
27629
|
-
size: "small",
|
|
27630
|
-
onClick: handleSubmit,
|
|
27631
|
-
disabled: isPending,
|
|
27632
|
-
children: "Create"
|
|
27633
|
-
}
|
|
27634
|
-
)
|
|
27635
|
-
] })
|
|
27636
|
-
] });
|
|
27637
|
-
};
|
|
27638
|
-
const StoreCreditAccountCreate = () => {
|
|
27639
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteFocusModal, { children: [
|
|
27640
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Create Store Credit Account" }) }),
|
|
27641
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Create a new store credit account" }) }),
|
|
27642
|
-
/* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountCreateForm, {})
|
|
27643
|
-
] });
|
|
28342
|
+
)
|
|
28343
|
+
] }),
|
|
28344
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
28345
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
28346
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
28347
|
+
] }) })
|
|
28348
|
+
]
|
|
28349
|
+
}
|
|
28350
|
+
) });
|
|
27644
28351
|
};
|
|
28352
|
+
const schema$2 = zod.z.object({
|
|
28353
|
+
note: zod.z.string(),
|
|
28354
|
+
amount: zod.z.object({
|
|
28355
|
+
float: zod.z.number(),
|
|
28356
|
+
value: zod.z.string()
|
|
28357
|
+
})
|
|
28358
|
+
});
|
|
27645
28359
|
function _extends() {
|
|
27646
28360
|
return _extends = Object.assign ? Object.assign.bind() : function(n2) {
|
|
27647
28361
|
for (var e = 1; e < arguments.length; e++) {
|
|
@@ -30321,299 +31035,6 @@ const GiftCardOrderSection = ({ giftCard }) => {
|
|
|
30321
31035
|
))
|
|
30322
31036
|
] });
|
|
30323
31037
|
};
|
|
30324
|
-
var __create = Object.create;
|
|
30325
|
-
var __defProp = Object.defineProperty;
|
|
30326
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
30327
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
30328
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
30329
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
30330
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
30331
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
30332
|
-
};
|
|
30333
|
-
var __copyProps = (to, from, except, desc) => {
|
|
30334
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
30335
|
-
for (let key2 of __getOwnPropNames(from))
|
|
30336
|
-
if (!__hasOwnProp.call(to, key2) && key2 !== except)
|
|
30337
|
-
__defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
|
|
30338
|
-
}
|
|
30339
|
-
return to;
|
|
30340
|
-
};
|
|
30341
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30342
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
30343
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
30344
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
30345
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
30346
|
-
__defProp(target, "default", { value: mod, enumerable: true }),
|
|
30347
|
-
mod
|
|
30348
|
-
));
|
|
30349
|
-
var require_toggle_selection = __commonJS({
|
|
30350
|
-
"node_modules/toggle-selection/index.js"(exports2, module2) {
|
|
30351
|
-
module2.exports = function() {
|
|
30352
|
-
var selection = document.getSelection();
|
|
30353
|
-
if (!selection.rangeCount) {
|
|
30354
|
-
return function() {
|
|
30355
|
-
};
|
|
30356
|
-
}
|
|
30357
|
-
var active = document.activeElement;
|
|
30358
|
-
var ranges = [];
|
|
30359
|
-
for (var i2 = 0; i2 < selection.rangeCount; i2++) {
|
|
30360
|
-
ranges.push(selection.getRangeAt(i2));
|
|
30361
|
-
}
|
|
30362
|
-
switch (active.tagName.toUpperCase()) {
|
|
30363
|
-
// .toUpperCase handles XHTML
|
|
30364
|
-
case "INPUT":
|
|
30365
|
-
case "TEXTAREA":
|
|
30366
|
-
active.blur();
|
|
30367
|
-
break;
|
|
30368
|
-
default:
|
|
30369
|
-
active = null;
|
|
30370
|
-
break;
|
|
30371
|
-
}
|
|
30372
|
-
selection.removeAllRanges();
|
|
30373
|
-
return function() {
|
|
30374
|
-
selection.type === "Caret" && selection.removeAllRanges();
|
|
30375
|
-
if (!selection.rangeCount) {
|
|
30376
|
-
ranges.forEach(function(range) {
|
|
30377
|
-
selection.addRange(range);
|
|
30378
|
-
});
|
|
30379
|
-
}
|
|
30380
|
-
active && active.focus();
|
|
30381
|
-
};
|
|
30382
|
-
};
|
|
30383
|
-
}
|
|
30384
|
-
});
|
|
30385
|
-
var import_index = __toESM(require_toggle_selection());
|
|
30386
|
-
var toggle_selection_default = import_index.default;
|
|
30387
|
-
var defaultMessage = "Copy to clipboard: #{key}, Enter";
|
|
30388
|
-
function formatPromptMessage(message2) {
|
|
30389
|
-
var isMac2 = navigator.userAgentData ? /mac/i.test(navigator.userAgentData.platform) : /mac os x/i.test(navigator.userAgent);
|
|
30390
|
-
var copyKey = (isMac2 ? "⌘" : "Ctrl") + "+C";
|
|
30391
|
-
return message2.replace(/#{\s*key\s*}/g, copyKey);
|
|
30392
|
-
}
|
|
30393
|
-
function buildClipboardItem(text2, format2) {
|
|
30394
|
-
var items = {};
|
|
30395
|
-
items["text/plain"] = new Blob([text2], { type: "text/plain" });
|
|
30396
|
-
if (format2 && format2 !== "text/plain") {
|
|
30397
|
-
items[format2] = new Blob([text2], { type: format2 });
|
|
30398
|
-
}
|
|
30399
|
-
return new ClipboardItem(items);
|
|
30400
|
-
}
|
|
30401
|
-
async function copyViaClipboardAPI(text2, options) {
|
|
30402
|
-
if (!options.format && !options.onCopy) {
|
|
30403
|
-
await navigator.clipboard.writeText(text2);
|
|
30404
|
-
return true;
|
|
30405
|
-
}
|
|
30406
|
-
var item = buildClipboardItem(text2, options.format);
|
|
30407
|
-
if (options.onCopy) {
|
|
30408
|
-
item = options.onCopy(item) || item;
|
|
30409
|
-
}
|
|
30410
|
-
await navigator.clipboard.write([item]);
|
|
30411
|
-
return true;
|
|
30412
|
-
}
|
|
30413
|
-
function createHiddenSpan(text2, options) {
|
|
30414
|
-
var mark = document.createElement("span");
|
|
30415
|
-
mark.textContent = text2;
|
|
30416
|
-
mark.ariaHidden = "true";
|
|
30417
|
-
mark.style.all = "unset";
|
|
30418
|
-
mark.style.position = "fixed";
|
|
30419
|
-
mark.style.top = "0";
|
|
30420
|
-
mark.style.clip = "rect(0, 0, 0, 0)";
|
|
30421
|
-
mark.style.whiteSpace = "pre";
|
|
30422
|
-
mark.style.webkitUserSelect = "text";
|
|
30423
|
-
mark.style.MozUserSelect = "text";
|
|
30424
|
-
mark.style.msUserSelect = "text";
|
|
30425
|
-
mark.style.userSelect = "text";
|
|
30426
|
-
mark.addEventListener("copy", function(e) {
|
|
30427
|
-
e.stopPropagation();
|
|
30428
|
-
if (options.format) {
|
|
30429
|
-
e.preventDefault();
|
|
30430
|
-
if (e.clipboardData) {
|
|
30431
|
-
e.clipboardData.setData(options.format, text2);
|
|
30432
|
-
}
|
|
30433
|
-
}
|
|
30434
|
-
if (options.onCopy && e.clipboardData) {
|
|
30435
|
-
options.onCopy(e.clipboardData);
|
|
30436
|
-
}
|
|
30437
|
-
});
|
|
30438
|
-
return mark;
|
|
30439
|
-
}
|
|
30440
|
-
function findOpenedModalDialog() {
|
|
30441
|
-
let element = document.activeElement;
|
|
30442
|
-
while (element) {
|
|
30443
|
-
if (element.tagName === "DIALOG" && element.open) {
|
|
30444
|
-
return element;
|
|
30445
|
-
}
|
|
30446
|
-
element = element.parentElement;
|
|
30447
|
-
}
|
|
30448
|
-
return null;
|
|
30449
|
-
}
|
|
30450
|
-
function copyViaExecCommand(text2, options) {
|
|
30451
|
-
var reselectPrevious = toggle_selection_default();
|
|
30452
|
-
var range = document.createRange();
|
|
30453
|
-
var selection = document.getSelection();
|
|
30454
|
-
var mark = createHiddenSpan(text2, options);
|
|
30455
|
-
var root = findOpenedModalDialog() || document.fullscreenElement || document.body;
|
|
30456
|
-
var success = false;
|
|
30457
|
-
try {
|
|
30458
|
-
root.appendChild(mark);
|
|
30459
|
-
range.selectNodeContents(mark);
|
|
30460
|
-
selection.removeAllRanges();
|
|
30461
|
-
selection.addRange(range);
|
|
30462
|
-
var successful = document.execCommand("copy");
|
|
30463
|
-
if (!successful) {
|
|
30464
|
-
throw new Error("copy command was unsuccessful");
|
|
30465
|
-
}
|
|
30466
|
-
success = true;
|
|
30467
|
-
} finally {
|
|
30468
|
-
if (typeof selection.removeRange == "function") {
|
|
30469
|
-
selection.removeRange(range);
|
|
30470
|
-
} else {
|
|
30471
|
-
selection.removeAllRanges();
|
|
30472
|
-
}
|
|
30473
|
-
root.removeChild(mark);
|
|
30474
|
-
reselectPrevious();
|
|
30475
|
-
}
|
|
30476
|
-
return success;
|
|
30477
|
-
}
|
|
30478
|
-
async function copy$1(text2, options = {}) {
|
|
30479
|
-
var debug2 = options.debug || false;
|
|
30480
|
-
if (window.isSecureContext && navigator.clipboard) {
|
|
30481
|
-
try {
|
|
30482
|
-
return await copyViaClipboardAPI(text2, options);
|
|
30483
|
-
} catch (err) {
|
|
30484
|
-
debug2 && console.error("unable to copy using navigator.clipboard: ", err);
|
|
30485
|
-
debug2 && console.warn("falling back to execCommand");
|
|
30486
|
-
}
|
|
30487
|
-
} else {
|
|
30488
|
-
debug2 && !window.isSecureContext && console.warn("copy-to-clipboard: navigator.clipboard requires a secure context (HTTPS/localhost). Falling back to execCommand.");
|
|
30489
|
-
}
|
|
30490
|
-
try {
|
|
30491
|
-
return copyViaExecCommand(text2, options);
|
|
30492
|
-
} catch (err) {
|
|
30493
|
-
debug2 && console.error("unable to copy using execCommand: ", err);
|
|
30494
|
-
debug2 && console.error("falling back to prompt");
|
|
30495
|
-
if (options.fallbackToPrompt) {
|
|
30496
|
-
var message2 = formatPromptMessage("message" in options ? options.message : defaultMessage);
|
|
30497
|
-
window.prompt(message2, text2);
|
|
30498
|
-
}
|
|
30499
|
-
}
|
|
30500
|
-
return false;
|
|
30501
|
-
}
|
|
30502
|
-
var index_default = copy$1;
|
|
30503
|
-
function DisplayId({ id, className }) {
|
|
30504
|
-
const [open2, setOpen] = React.useState(false);
|
|
30505
|
-
const onClick = () => {
|
|
30506
|
-
index_default(id);
|
|
30507
|
-
ui.toast.success("Copied to clipboard");
|
|
30508
|
-
};
|
|
30509
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { maxWidth: 260, content: id, open: open2, onOpenChange: setOpen, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { onClick, className: ui.clx("cursor-pointer", className), children: [
|
|
30510
|
-
"#",
|
|
30511
|
-
id.slice(-7)
|
|
30512
|
-
] }) });
|
|
30513
|
-
}
|
|
30514
|
-
const columnHelper$8 = ui.createDataTableColumnHelper();
|
|
30515
|
-
const useTransactionsTableColumns = () => {
|
|
30516
|
-
return React.useMemo(() => {
|
|
30517
|
-
return [
|
|
30518
|
-
columnHelper$8.accessor("id", {
|
|
30519
|
-
header: "ID",
|
|
30520
|
-
cell: ({ row }) => {
|
|
30521
|
-
return /* @__PURE__ */ jsxRuntime.jsx(DisplayId, { id: row.original.id });
|
|
30522
|
-
}
|
|
30523
|
-
}),
|
|
30524
|
-
columnHelper$8.accessor("created_at", {
|
|
30525
|
-
header: "Created At",
|
|
30526
|
-
cell: ({ row }) => formatDate(row.original.created_at, false)
|
|
30527
|
-
}),
|
|
30528
|
-
columnHelper$8.accessor("note", {
|
|
30529
|
-
header: "Description",
|
|
30530
|
-
cell: ({ row }) => row.original.note
|
|
30531
|
-
}),
|
|
30532
|
-
columnHelper$8.accessor("note", {
|
|
30533
|
-
header: "Note",
|
|
30534
|
-
cell: ({ row }) => {
|
|
30535
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { title: row.original.note, className: "max-w-[300px] truncate", children: row.original.note || "-" });
|
|
30536
|
-
}
|
|
30537
|
-
}),
|
|
30538
|
-
columnHelper$8.accessor("amount", {
|
|
30539
|
-
header: "Amount",
|
|
30540
|
-
cell: ({ row }) => {
|
|
30541
|
-
const isDebit = row.original.type === "debit";
|
|
30542
|
-
return row.original.account.currency_code && formatAmount(
|
|
30543
|
-
row.original.amount * (isDebit ? -1 : 1),
|
|
30544
|
-
row.original.account.currency_code
|
|
30545
|
-
);
|
|
30546
|
-
}
|
|
30547
|
-
})
|
|
30548
|
-
];
|
|
30549
|
-
}, []);
|
|
30550
|
-
};
|
|
30551
|
-
const useTransactionsTableFilters = ({}) => {
|
|
30552
|
-
const dateFilterOptions = useDataTableDateFilters$1();
|
|
30553
|
-
return React.useMemo(() => {
|
|
30554
|
-
return [...dateFilterOptions];
|
|
30555
|
-
}, [dateFilterOptions]);
|
|
30556
|
-
};
|
|
30557
|
-
const useTransactionsTableQuery = ({
|
|
30558
|
-
prefix,
|
|
30559
|
-
pageSize = 20
|
|
30560
|
-
}) => {
|
|
30561
|
-
const queryObject = useQueryParams(
|
|
30562
|
-
["offset", "limit", "currency_code", "created_at", "updated_at"],
|
|
30563
|
-
prefix
|
|
30564
|
-
);
|
|
30565
|
-
const { offset: offset2, limit, created_at, updated_at, ...rest } = queryObject;
|
|
30566
|
-
const searchParams = {
|
|
30567
|
-
limit: limit ? Number(limit) : pageSize,
|
|
30568
|
-
offset: offset2 ? Number(offset2) : 0,
|
|
30569
|
-
created_at: created_at ? JSON.parse(created_at) : void 0,
|
|
30570
|
-
updated_at: updated_at ? JSON.parse(updated_at) : void 0,
|
|
30571
|
-
...rest
|
|
30572
|
-
};
|
|
30573
|
-
return searchParams;
|
|
30574
|
-
};
|
|
30575
|
-
const PAGE_SIZE$4 = 10;
|
|
30576
|
-
function TransactionsTable({ id }) {
|
|
30577
|
-
const queryParams = useTransactionsTableQuery({
|
|
30578
|
-
pageSize: PAGE_SIZE$4
|
|
30579
|
-
});
|
|
30580
|
-
const { transactions, isLoading, count: count2 } = useStoreCreditAccountTransactions(
|
|
30581
|
-
id,
|
|
30582
|
-
{
|
|
30583
|
-
...queryParams,
|
|
30584
|
-
order: queryParams.order ?? "-created_at",
|
|
30585
|
-
fields: "*account"
|
|
30586
|
-
}
|
|
30587
|
-
);
|
|
30588
|
-
const columns = useTransactionsTableColumns();
|
|
30589
|
-
const filters = useTransactionsTableFilters({});
|
|
30590
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
30591
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
30592
|
-
DataTable,
|
|
30593
|
-
{
|
|
30594
|
-
data: transactions ?? [],
|
|
30595
|
-
getRowId: (row) => row.id,
|
|
30596
|
-
columns,
|
|
30597
|
-
filters,
|
|
30598
|
-
isLoading,
|
|
30599
|
-
pageSize: PAGE_SIZE$4,
|
|
30600
|
-
rowCount: count2,
|
|
30601
|
-
enableSearch: false,
|
|
30602
|
-
heading: "Transactions",
|
|
30603
|
-
emptyState: {
|
|
30604
|
-
empty: {
|
|
30605
|
-
heading: "No transactions found"
|
|
30606
|
-
},
|
|
30607
|
-
filtered: {
|
|
30608
|
-
heading: "No results found",
|
|
30609
|
-
description: "No transactions match your filter criteria."
|
|
30610
|
-
}
|
|
30611
|
-
}
|
|
30612
|
-
}
|
|
30613
|
-
) }),
|
|
30614
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
30615
|
-
] });
|
|
30616
|
-
}
|
|
30617
31038
|
const GiftCardTransactionsSection = ({
|
|
30618
31039
|
storeCreditAccount
|
|
30619
31040
|
}) => {
|
|
@@ -30663,33 +31084,6 @@ const GiftCardDetailsPage = () => {
|
|
|
30663
31084
|
}
|
|
30664
31085
|
);
|
|
30665
31086
|
};
|
|
30666
|
-
const KeyboundForm = React__namespace.default.forwardRef(({ onSubmit, onKeyDown, ...rest }, ref) => {
|
|
30667
|
-
const handleSubmit = (event) => {
|
|
30668
|
-
event.preventDefault();
|
|
30669
|
-
onSubmit?.(event);
|
|
30670
|
-
};
|
|
30671
|
-
const handleKeyDown = (event) => {
|
|
30672
|
-
if (event.key === "Enter") {
|
|
30673
|
-
if (event.target instanceof HTMLTextAreaElement && !(event.metaKey || event.ctrlKey)) {
|
|
30674
|
-
return;
|
|
30675
|
-
}
|
|
30676
|
-
event.preventDefault();
|
|
30677
|
-
if (event.metaKey || event.ctrlKey) {
|
|
30678
|
-
handleSubmit(event);
|
|
30679
|
-
}
|
|
30680
|
-
}
|
|
30681
|
-
};
|
|
30682
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
30683
|
-
"form",
|
|
30684
|
-
{
|
|
30685
|
-
...rest,
|
|
30686
|
-
onSubmit: handleSubmit,
|
|
30687
|
-
onKeyDown: onKeyDown ?? handleKeyDown,
|
|
30688
|
-
ref
|
|
30689
|
-
}
|
|
30690
|
-
);
|
|
30691
|
-
});
|
|
30692
|
-
KeyboundForm.displayName = "KeyboundForm";
|
|
30693
31087
|
const GiftCardExpiration = () => {
|
|
30694
31088
|
const { id } = reactRouterDom.useParams();
|
|
30695
31089
|
const { gift_card: giftCard, isPending, isError, error: error2 } = useGiftCard(id);
|
|
@@ -30710,7 +31104,7 @@ const GiftCardExpirationForm = ({ giftCard }) => {
|
|
|
30710
31104
|
defaultValues: {
|
|
30711
31105
|
expires_at: giftCard.expires_at ? new Date(giftCard.expires_at) : null
|
|
30712
31106
|
},
|
|
30713
|
-
resolver: u(schema$
|
|
31107
|
+
resolver: u(schema$1)
|
|
30714
31108
|
});
|
|
30715
31109
|
const { mutateAsync, isPending } = useUpdateGiftCard(giftCard.id);
|
|
30716
31110
|
const { handleSuccess } = useRouteModal();
|
|
@@ -30805,10 +31199,10 @@ const GiftCardExpirationForm = ({ giftCard }) => {
|
|
|
30805
31199
|
}
|
|
30806
31200
|
) });
|
|
30807
31201
|
};
|
|
30808
|
-
const schema$
|
|
31202
|
+
const schema$1 = zod.z.object({
|
|
30809
31203
|
expires_at: zod.z.date().nullish()
|
|
30810
31204
|
});
|
|
30811
|
-
const Note
|
|
31205
|
+
const Note = () => {
|
|
30812
31206
|
const { id } = reactRouterDom.useParams();
|
|
30813
31207
|
const {
|
|
30814
31208
|
gift_card: giftCard,
|
|
@@ -30833,7 +31227,7 @@ const GiftCardNoteForm = ({ giftCard }) => {
|
|
|
30833
31227
|
defaultValues: {
|
|
30834
31228
|
note: giftCard.note ?? ""
|
|
30835
31229
|
},
|
|
30836
|
-
resolver: u(schema
|
|
31230
|
+
resolver: u(schema)
|
|
30837
31231
|
});
|
|
30838
31232
|
const { mutateAsync, isPending } = useUpdateGiftCard(giftCard.id);
|
|
30839
31233
|
const { handleSuccess } = useRouteModal();
|
|
@@ -30872,7 +31266,7 @@ const GiftCardNoteForm = ({ giftCard }) => {
|
|
|
30872
31266
|
}
|
|
30873
31267
|
) });
|
|
30874
31268
|
};
|
|
30875
|
-
const schema
|
|
31269
|
+
const schema = zod.z.object({
|
|
30876
31270
|
note: zod.z.string().optional()
|
|
30877
31271
|
});
|
|
30878
31272
|
const columnHelper$7 = createColumnHelper();
|
|
@@ -45363,7 +45757,7 @@ const GiftCardProductCreate = () => {
|
|
|
45363
45757
|
isPending: isStorePending,
|
|
45364
45758
|
isError: isStoreError,
|
|
45365
45759
|
error: storeError
|
|
45366
|
-
} = useStore$
|
|
45760
|
+
} = useStore$1({
|
|
45367
45761
|
fields: "+default_sales_channel"
|
|
45368
45762
|
});
|
|
45369
45763
|
const {
|
|
@@ -45415,400 +45809,6 @@ const GiftCardProductCreate = () => {
|
|
|
45415
45809
|
)
|
|
45416
45810
|
] });
|
|
45417
45811
|
};
|
|
45418
|
-
const StoreCreditAccountBalanceSection = ({
|
|
45419
|
-
storeCreditAccount
|
|
45420
|
-
}) => {
|
|
45421
|
-
if (!storeCreditAccount || typeof storeCreditAccount.balance === "undefined") {
|
|
45422
|
-
return;
|
|
45423
|
-
}
|
|
45424
|
-
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: [
|
|
45425
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-ui-tag-green-icon h-8 w-1 rounded-full" }),
|
|
45426
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
45427
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", size: "small", className: "text-ui-fg-subtle", children: "Current Balance" }),
|
|
45428
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
45429
|
-
ui.Text,
|
|
45430
|
-
{
|
|
45431
|
-
weight: "plus",
|
|
45432
|
-
size: "xlarge",
|
|
45433
|
-
className: "tabular-nums text-ui-fg-base",
|
|
45434
|
-
children: formatAmount(
|
|
45435
|
-
storeCreditAccount.balance,
|
|
45436
|
-
storeCreditAccount.currency_code
|
|
45437
|
-
)
|
|
45438
|
-
}
|
|
45439
|
-
)
|
|
45440
|
-
] })
|
|
45441
|
-
] }) });
|
|
45442
|
-
};
|
|
45443
|
-
const StoreCreditAccountDetailsSection = ({
|
|
45444
|
-
storeCreditAccount
|
|
45445
|
-
}) => {
|
|
45446
|
-
if (!storeCreditAccount || typeof storeCreditAccount.balance === "undefined") {
|
|
45447
|
-
return;
|
|
45448
|
-
}
|
|
45449
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "flex justify-between gap-x-2 px-6 py-6", children: [
|
|
45450
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
45451
|
-
ui.Text,
|
|
45452
|
-
{
|
|
45453
|
-
weight: "plus",
|
|
45454
|
-
size: "xlarge",
|
|
45455
|
-
className: "text-ui-fg-base flex gap-x-4",
|
|
45456
|
-
children: [
|
|
45457
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
45458
|
-
/* @__PURE__ */ jsxRuntime.jsx(CreditCardIcon, { className: "inline" }),
|
|
45459
|
-
" "
|
|
45460
|
-
] }),
|
|
45461
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
45462
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-ui-fg-subtle", children: [
|
|
45463
|
-
storeCreditAccount.currency_code.toUpperCase(),
|
|
45464
|
-
" Account"
|
|
45465
|
-
] }),
|
|
45466
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-base", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
45467
|
-
ui.Text,
|
|
45468
|
-
{
|
|
45469
|
-
weight: "regular",
|
|
45470
|
-
size: "small",
|
|
45471
|
-
className: "text-ui-fg-base flex gap-x-4",
|
|
45472
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(DisplayId, { id: storeCreditAccount.id })
|
|
45473
|
-
}
|
|
45474
|
-
) })
|
|
45475
|
-
] })
|
|
45476
|
-
]
|
|
45477
|
-
}
|
|
45478
|
-
),
|
|
45479
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-x-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
45480
|
-
ActionMenu,
|
|
45481
|
-
{
|
|
45482
|
-
groups: [
|
|
45483
|
-
{
|
|
45484
|
-
actions: [
|
|
45485
|
-
{
|
|
45486
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CreditCard, {}),
|
|
45487
|
-
label: "Credit the account",
|
|
45488
|
-
to: "credit"
|
|
45489
|
-
},
|
|
45490
|
-
{
|
|
45491
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.MinusMini, {}),
|
|
45492
|
-
label: "Debit the account",
|
|
45493
|
-
to: "debit",
|
|
45494
|
-
disabled: !Number(storeCreditAccount.balance)
|
|
45495
|
-
}
|
|
45496
|
-
]
|
|
45497
|
-
}
|
|
45498
|
-
]
|
|
45499
|
-
}
|
|
45500
|
-
) })
|
|
45501
|
-
] });
|
|
45502
|
-
};
|
|
45503
|
-
function StoreCreditAccountCustomerSection({
|
|
45504
|
-
customerId
|
|
45505
|
-
}) {
|
|
45506
|
-
const { customer, isPending } = useCustomer(customerId, void 0, {
|
|
45507
|
-
enabled: !!customerId
|
|
45508
|
-
});
|
|
45509
|
-
if (isPending || !customer) {
|
|
45510
|
-
return null;
|
|
45511
|
-
}
|
|
45512
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0", children: [
|
|
45513
|
-
/* @__PURE__ */ jsxRuntime.jsx(Header$5, { title: "Customer" }),
|
|
45514
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
45515
|
-
SidebarLink,
|
|
45516
|
-
{
|
|
45517
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.User, {}),
|
|
45518
|
-
labelKey: customer.email || "N/A",
|
|
45519
|
-
descriptionKey: !customer.first_name && !customer.last_name ? "N/A" : `${customer.first_name} ${customer.last_name}`,
|
|
45520
|
-
to: `/customers/${customer.id}`
|
|
45521
|
-
},
|
|
45522
|
-
customer.id
|
|
45523
|
-
)
|
|
45524
|
-
] });
|
|
45525
|
-
}
|
|
45526
|
-
function StoreCreditAccountCodeSection({ code }) {
|
|
45527
|
-
if (!code) {
|
|
45528
|
-
return null;
|
|
45529
|
-
}
|
|
45530
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0", children: [
|
|
45531
|
-
/* @__PURE__ */ jsxRuntime.jsx(Header$5, { title: "Account Code" }),
|
|
45532
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-4 px-6 mb-2", children: [
|
|
45533
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.Share, { className: "inline" }),
|
|
45534
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle text-sm", children: code })
|
|
45535
|
-
] })
|
|
45536
|
-
] });
|
|
45537
|
-
}
|
|
45538
|
-
const StoreCreditAccountPage = () => {
|
|
45539
|
-
const { id } = reactRouterDom.useParams();
|
|
45540
|
-
const { store_credit_account: storeCreditAccount } = useStoreCreditAccount(
|
|
45541
|
-
id
|
|
45542
|
-
);
|
|
45543
|
-
if (!storeCreditAccount) {
|
|
45544
|
-
return;
|
|
45545
|
-
}
|
|
45546
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
45547
|
-
components.LayoutComposer,
|
|
45548
|
-
{
|
|
45549
|
-
widgetsZonePrefix: "store_credit_account.details",
|
|
45550
|
-
preferredLayoutId: "core:two-column",
|
|
45551
|
-
data: storeCreditAccount,
|
|
45552
|
-
sections: {
|
|
45553
|
-
main: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
45554
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountDetailsSection", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
45555
|
-
StoreCreditAccountDetailsSection,
|
|
45556
|
-
{
|
|
45557
|
-
storeCreditAccount
|
|
45558
|
-
}
|
|
45559
|
-
) }),
|
|
45560
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "TransactionsTable", children: /* @__PURE__ */ jsxRuntime.jsx(TransactionsTable, { id: storeCreditAccount.id }) })
|
|
45561
|
-
] }),
|
|
45562
|
-
side: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
45563
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountBalanceSection", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
45564
|
-
StoreCreditAccountBalanceSection,
|
|
45565
|
-
{
|
|
45566
|
-
storeCreditAccount
|
|
45567
|
-
}
|
|
45568
|
-
) }),
|
|
45569
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountCodeSection", children: /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountCodeSection, { code: storeCreditAccount.code }) }),
|
|
45570
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.LayoutComposer.Entry, { id: "StoreCreditAccountCustomerSection", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
45571
|
-
StoreCreditAccountCustomerSection,
|
|
45572
|
-
{
|
|
45573
|
-
customerId: storeCreditAccount.customer_id
|
|
45574
|
-
}
|
|
45575
|
-
) })
|
|
45576
|
-
] })
|
|
45577
|
-
}
|
|
45578
|
-
}
|
|
45579
|
-
);
|
|
45580
|
-
};
|
|
45581
|
-
const Note = () => {
|
|
45582
|
-
const { id } = reactRouterDom.useParams();
|
|
45583
|
-
const {
|
|
45584
|
-
store_credit_account: storeCreditAccount,
|
|
45585
|
-
isPending,
|
|
45586
|
-
isError,
|
|
45587
|
-
error: error2
|
|
45588
|
-
} = useStoreCreditAccount(id, {});
|
|
45589
|
-
if (isError) {
|
|
45590
|
-
throw error2;
|
|
45591
|
-
}
|
|
45592
|
-
const isReady = !isPending && !!storeCreditAccount;
|
|
45593
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
45594
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
45595
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Credit store credit account" }) }),
|
|
45596
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Credit the store credit account" }) })
|
|
45597
|
-
] }),
|
|
45598
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountCreditForm, { storeCreditAccount })
|
|
45599
|
-
] });
|
|
45600
|
-
};
|
|
45601
|
-
const StoreCreditAccountCreditForm = ({
|
|
45602
|
-
storeCreditAccount
|
|
45603
|
-
}) => {
|
|
45604
|
-
const form = useForm({
|
|
45605
|
-
defaultValues: {
|
|
45606
|
-
amount: {
|
|
45607
|
-
float: 0,
|
|
45608
|
-
value: ""
|
|
45609
|
-
},
|
|
45610
|
-
note: ""
|
|
45611
|
-
},
|
|
45612
|
-
resolver: u(schema$1)
|
|
45613
|
-
});
|
|
45614
|
-
const { mutateAsync, isPending } = useCreditStoreCreditAccount(
|
|
45615
|
-
storeCreditAccount.id
|
|
45616
|
-
);
|
|
45617
|
-
const { handleSuccess } = useRouteModal();
|
|
45618
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
45619
|
-
if (data.amount.float <= 0) {
|
|
45620
|
-
form.setError("amount", { message: "Amount must be greater than 0" });
|
|
45621
|
-
return;
|
|
45622
|
-
}
|
|
45623
|
-
await mutateAsync(
|
|
45624
|
-
{ amount: data.amount.float, note: data.note },
|
|
45625
|
-
{
|
|
45626
|
-
onSuccess: () => handleSuccess(),
|
|
45627
|
-
onError: (error2) => ui.toast.error(error2.message)
|
|
45628
|
-
}
|
|
45629
|
-
);
|
|
45630
|
-
});
|
|
45631
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
45632
|
-
KeyboundForm,
|
|
45633
|
-
{
|
|
45634
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
45635
|
-
onSubmit,
|
|
45636
|
-
children: [
|
|
45637
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
|
|
45638
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
45639
|
-
Form$2.Field,
|
|
45640
|
-
{
|
|
45641
|
-
control: form.control,
|
|
45642
|
-
name: "amount",
|
|
45643
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
45644
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Amount" }),
|
|
45645
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
45646
|
-
ui.CurrencyInput,
|
|
45647
|
-
{
|
|
45648
|
-
min: 0,
|
|
45649
|
-
placeholder: "0",
|
|
45650
|
-
value: field.value.value,
|
|
45651
|
-
onValueChange: (_value, _name, values) => {
|
|
45652
|
-
field.onChange({
|
|
45653
|
-
value: values?.value,
|
|
45654
|
-
float: values?.float || null
|
|
45655
|
-
});
|
|
45656
|
-
},
|
|
45657
|
-
symbol: currencies[storeCreditAccount.currency_code.toUpperCase()].symbol_native,
|
|
45658
|
-
code: storeCreditAccount.currency_code.toUpperCase()
|
|
45659
|
-
}
|
|
45660
|
-
) }),
|
|
45661
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
45662
|
-
] })
|
|
45663
|
-
}
|
|
45664
|
-
),
|
|
45665
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
45666
|
-
Form$2.Field,
|
|
45667
|
-
{
|
|
45668
|
-
control: form.control,
|
|
45669
|
-
name: "note",
|
|
45670
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
45671
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Note" }),
|
|
45672
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Textarea, { ...field }) }),
|
|
45673
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
45674
|
-
] })
|
|
45675
|
-
}
|
|
45676
|
-
)
|
|
45677
|
-
] }),
|
|
45678
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
45679
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
45680
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
45681
|
-
] }) })
|
|
45682
|
-
]
|
|
45683
|
-
}
|
|
45684
|
-
) });
|
|
45685
|
-
};
|
|
45686
|
-
const schema$1 = zod.z.object({
|
|
45687
|
-
note: zod.z.string(),
|
|
45688
|
-
amount: zod.z.object({
|
|
45689
|
-
float: zod.z.number(),
|
|
45690
|
-
value: zod.z.string()
|
|
45691
|
-
})
|
|
45692
|
-
});
|
|
45693
|
-
const Debit = () => {
|
|
45694
|
-
const { id } = reactRouterDom.useParams();
|
|
45695
|
-
const {
|
|
45696
|
-
store_credit_account: storeCreditAccount,
|
|
45697
|
-
isPending,
|
|
45698
|
-
isError,
|
|
45699
|
-
error: error2
|
|
45700
|
-
} = useStoreCreditAccount(id, {});
|
|
45701
|
-
if (isError) {
|
|
45702
|
-
throw error2;
|
|
45703
|
-
}
|
|
45704
|
-
const isReady = !isPending && !!storeCreditAccount;
|
|
45705
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
45706
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
45707
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Debit store credit account" }) }),
|
|
45708
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Debit the store credit account" }) })
|
|
45709
|
-
] }),
|
|
45710
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountDebitForm, { storeCreditAccount })
|
|
45711
|
-
] });
|
|
45712
|
-
};
|
|
45713
|
-
const StoreCreditAccountDebitForm = ({
|
|
45714
|
-
storeCreditAccount
|
|
45715
|
-
}) => {
|
|
45716
|
-
const form = useForm({
|
|
45717
|
-
defaultValues: {
|
|
45718
|
-
amount: {
|
|
45719
|
-
float: 0,
|
|
45720
|
-
value: ""
|
|
45721
|
-
},
|
|
45722
|
-
note: ""
|
|
45723
|
-
},
|
|
45724
|
-
resolver: u(schema)
|
|
45725
|
-
});
|
|
45726
|
-
const { mutateAsync, isPending } = useDebitStoreCreditAccount(
|
|
45727
|
-
storeCreditAccount.id
|
|
45728
|
-
);
|
|
45729
|
-
const { handleSuccess } = useRouteModal();
|
|
45730
|
-
const balance = storeCreditAccount.balance ?? 0;
|
|
45731
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
45732
|
-
if (data.amount.float <= 0) {
|
|
45733
|
-
form.setError("amount", { message: "Amount must be greater than 0" });
|
|
45734
|
-
return;
|
|
45735
|
-
}
|
|
45736
|
-
if (data.amount.float > balance) {
|
|
45737
|
-
form.setError("amount", {
|
|
45738
|
-
message: "Amount can't be greater than the current balance"
|
|
45739
|
-
});
|
|
45740
|
-
return;
|
|
45741
|
-
}
|
|
45742
|
-
await mutateAsync(
|
|
45743
|
-
{ amount: data.amount.float, note: data.note },
|
|
45744
|
-
{
|
|
45745
|
-
onSuccess: () => handleSuccess(),
|
|
45746
|
-
onError: (error2) => ui.toast.error(error2.message)
|
|
45747
|
-
}
|
|
45748
|
-
);
|
|
45749
|
-
});
|
|
45750
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
45751
|
-
KeyboundForm,
|
|
45752
|
-
{
|
|
45753
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
45754
|
-
onSubmit,
|
|
45755
|
-
children: [
|
|
45756
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
|
|
45757
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
45758
|
-
Form$2.Field,
|
|
45759
|
-
{
|
|
45760
|
-
control: form.control,
|
|
45761
|
-
name: "amount",
|
|
45762
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
45763
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Amount" }),
|
|
45764
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
45765
|
-
ui.CurrencyInput,
|
|
45766
|
-
{
|
|
45767
|
-
min: 0,
|
|
45768
|
-
placeholder: "0",
|
|
45769
|
-
value: field.value.value,
|
|
45770
|
-
onValueChange: (_value, _name, values) => {
|
|
45771
|
-
field.onChange({
|
|
45772
|
-
value: values?.value,
|
|
45773
|
-
float: values?.float || null
|
|
45774
|
-
});
|
|
45775
|
-
},
|
|
45776
|
-
symbol: currencies[storeCreditAccount.currency_code.toUpperCase()].symbol_native,
|
|
45777
|
-
code: storeCreditAccount.currency_code.toUpperCase()
|
|
45778
|
-
}
|
|
45779
|
-
) }),
|
|
45780
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
45781
|
-
] })
|
|
45782
|
-
}
|
|
45783
|
-
),
|
|
45784
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
45785
|
-
Form$2.Field,
|
|
45786
|
-
{
|
|
45787
|
-
control: form.control,
|
|
45788
|
-
name: "note",
|
|
45789
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
45790
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Note" }),
|
|
45791
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Textarea, { ...field }) }),
|
|
45792
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
45793
|
-
] })
|
|
45794
|
-
}
|
|
45795
|
-
)
|
|
45796
|
-
] }),
|
|
45797
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
45798
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
45799
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
45800
|
-
] }) })
|
|
45801
|
-
]
|
|
45802
|
-
}
|
|
45803
|
-
) });
|
|
45804
|
-
};
|
|
45805
|
-
const schema = zod.z.object({
|
|
45806
|
-
note: zod.z.string(),
|
|
45807
|
-
amount: zod.z.object({
|
|
45808
|
-
float: zod.z.number(),
|
|
45809
|
-
value: zod.z.string()
|
|
45810
|
-
})
|
|
45811
|
-
});
|
|
45812
45812
|
const productStatusColor = (status) => {
|
|
45813
45813
|
switch (status) {
|
|
45814
45814
|
case "draft":
|
|
@@ -47242,7 +47242,7 @@ const ProductMedia = () => {
|
|
|
47242
47242
|
] });
|
|
47243
47243
|
};
|
|
47244
47244
|
const VariantPricingForm = ({ form }) => {
|
|
47245
|
-
const { store } = useStore$
|
|
47245
|
+
const { store } = useStore$1();
|
|
47246
47246
|
const { regions } = useRegions({ limit: 9999 });
|
|
47247
47247
|
const { price_preferences: pricePreferences } = usePricePreferences({});
|
|
47248
47248
|
const { setCloseOnEscape } = useRouteModal();
|
|
@@ -47517,10 +47517,21 @@ const widgetModule = { widgets: [
|
|
|
47517
47517
|
] };
|
|
47518
47518
|
const routeModule = {
|
|
47519
47519
|
routes: [
|
|
47520
|
+
{
|
|
47521
|
+
Component: StoreCreditAccountsPage,
|
|
47522
|
+
path: "/store-credit-accounts",
|
|
47523
|
+
handle: { label: config$3.label, translationNs: config$3.translationNs },
|
|
47524
|
+
children: [
|
|
47525
|
+
{
|
|
47526
|
+
Component: StoreCreditAccountCreate,
|
|
47527
|
+
path: "/store-credit-accounts/create"
|
|
47528
|
+
}
|
|
47529
|
+
]
|
|
47530
|
+
},
|
|
47520
47531
|
{
|
|
47521
47532
|
Component: GiftCardsPage,
|
|
47522
47533
|
path: "/gift-cards",
|
|
47523
|
-
handle: { label: config$
|
|
47534
|
+
handle: { label: config$2.label, translationNs: config$2.translationNs },
|
|
47524
47535
|
children: [
|
|
47525
47536
|
{
|
|
47526
47537
|
Component: GiftCardCreate,
|
|
@@ -47529,13 +47540,16 @@ const routeModule = {
|
|
|
47529
47540
|
]
|
|
47530
47541
|
},
|
|
47531
47542
|
{
|
|
47532
|
-
Component:
|
|
47533
|
-
path: "/store-credit-accounts",
|
|
47534
|
-
handle: { label: config$1.label, translationNs: config$1.translationNs },
|
|
47543
|
+
Component: StoreCreditAccountPage,
|
|
47544
|
+
path: "/store-credit-accounts/:id",
|
|
47535
47545
|
children: [
|
|
47536
47546
|
{
|
|
47537
|
-
Component:
|
|
47538
|
-
path: "/store-credit-accounts/
|
|
47547
|
+
Component: Note$1,
|
|
47548
|
+
path: "/store-credit-accounts/:id/credit"
|
|
47549
|
+
},
|
|
47550
|
+
{
|
|
47551
|
+
Component: Debit,
|
|
47552
|
+
path: "/store-credit-accounts/:id/debit"
|
|
47539
47553
|
}
|
|
47540
47554
|
]
|
|
47541
47555
|
},
|
|
@@ -47548,7 +47562,7 @@ const routeModule = {
|
|
|
47548
47562
|
path: "/gift-cards/:id/expiration"
|
|
47549
47563
|
},
|
|
47550
47564
|
{
|
|
47551
|
-
Component: Note
|
|
47565
|
+
Component: Note,
|
|
47552
47566
|
path: "/gift-cards/:id/note"
|
|
47553
47567
|
}
|
|
47554
47568
|
]
|
|
@@ -47564,20 +47578,6 @@ const routeModule = {
|
|
|
47564
47578
|
}
|
|
47565
47579
|
]
|
|
47566
47580
|
},
|
|
47567
|
-
{
|
|
47568
|
-
Component: StoreCreditAccountPage,
|
|
47569
|
-
path: "/store-credit-accounts/:id",
|
|
47570
|
-
children: [
|
|
47571
|
-
{
|
|
47572
|
-
Component: Note,
|
|
47573
|
-
path: "/store-credit-accounts/:id/credit"
|
|
47574
|
-
},
|
|
47575
|
-
{
|
|
47576
|
-
Component: Debit,
|
|
47577
|
-
path: "/store-credit-accounts/:id/debit"
|
|
47578
|
-
}
|
|
47579
|
-
]
|
|
47580
|
-
},
|
|
47581
47581
|
{
|
|
47582
47582
|
Component: ProductDetail,
|
|
47583
47583
|
path: "/gift-cards/gift-card-products/:id",
|
|
@@ -47611,15 +47611,15 @@ const menuItemModule = {
|
|
|
47611
47611
|
{
|
|
47612
47612
|
label: config$3.label,
|
|
47613
47613
|
icon: config$3.icon,
|
|
47614
|
-
path: "/
|
|
47614
|
+
path: "/store-credit-accounts",
|
|
47615
47615
|
nested: void 0,
|
|
47616
47616
|
rank: void 0,
|
|
47617
47617
|
translationNs: void 0
|
|
47618
47618
|
},
|
|
47619
47619
|
{
|
|
47620
|
-
label: config$
|
|
47621
|
-
icon: config$
|
|
47622
|
-
path: "/
|
|
47620
|
+
label: config$2.label,
|
|
47621
|
+
icon: config$2.icon,
|
|
47622
|
+
path: "/gift-cards",
|
|
47623
47623
|
nested: void 0,
|
|
47624
47624
|
rank: void 0,
|
|
47625
47625
|
translationNs: void 0
|