@medusajs/loyalty-plugin 0.0.7-preview.5 → 0.0.7-preview.6
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 +1018 -1018
- package/.medusa/server/src/admin/index.mjs +430 -430
- package/package.json +5 -3
|
@@ -23874,421 +23874,157 @@ const GiftCardExpirationForm = ({ giftCard }) => {
|
|
|
23874
23874
|
const schema$1 = objectType({
|
|
23875
23875
|
expires_at: dateType().nullish()
|
|
23876
23876
|
});
|
|
23877
|
-
const
|
|
23878
|
-
|
|
23879
|
-
|
|
23880
|
-
|
|
23881
|
-
|
|
23882
|
-
|
|
23883
|
-
|
|
23884
|
-
|
|
23885
|
-
|
|
23886
|
-
|
|
23887
|
-
|
|
23888
|
-
|
|
23889
|
-
|
|
23890
|
-
|
|
23891
|
-
|
|
23892
|
-
|
|
23893
|
-
|
|
23894
|
-
|
|
23895
|
-
|
|
23896
|
-
|
|
23897
|
-
|
|
23898
|
-
|
|
23899
|
-
]
|
|
23900
|
-
|
|
23877
|
+
const columnHelper$7 = createColumnHelper();
|
|
23878
|
+
const useGiftCardProductsTableColumns = () => {
|
|
23879
|
+
return React.useMemo(
|
|
23880
|
+
() => [
|
|
23881
|
+
columnHelper$7.display({
|
|
23882
|
+
id: "product",
|
|
23883
|
+
header: () => /* @__PURE__ */ jsxRuntime.jsx(ProductHeader, {}),
|
|
23884
|
+
cell: ({ row }) => /* @__PURE__ */ jsxRuntime.jsx(ProductCell, { product: row.original })
|
|
23885
|
+
}),
|
|
23886
|
+
columnHelper$7.accessor("sales_channels", {
|
|
23887
|
+
header: () => /* @__PURE__ */ jsxRuntime.jsx(SalesChannelHeader, {}),
|
|
23888
|
+
cell: ({ row }) => /* @__PURE__ */ jsxRuntime.jsx(SalesChannelsCell, { salesChannels: row.original.sales_channels })
|
|
23889
|
+
}),
|
|
23890
|
+
columnHelper$7.accessor("variants", {
|
|
23891
|
+
header: () => /* @__PURE__ */ jsxRuntime.jsx(VariantHeader, {}),
|
|
23892
|
+
cell: ({ row }) => /* @__PURE__ */ jsxRuntime.jsx(VariantCell, { variants: row.original.variants })
|
|
23893
|
+
}),
|
|
23894
|
+
columnHelper$7.accessor("status", {
|
|
23895
|
+
header: () => /* @__PURE__ */ jsxRuntime.jsx(ProductStatusHeader, {}),
|
|
23896
|
+
cell: ({ row }) => /* @__PURE__ */ jsxRuntime.jsx(ProductStatusCell, { status: row.original.status })
|
|
23897
|
+
})
|
|
23898
|
+
],
|
|
23899
|
+
[]
|
|
23900
|
+
);
|
|
23901
23901
|
};
|
|
23902
|
-
const
|
|
23903
|
-
|
|
23902
|
+
const useGiftCardProductsFilters = () => {
|
|
23903
|
+
const dateFilterOptions = useDataTableDateFilters$1();
|
|
23904
|
+
return React.useMemo(() => {
|
|
23905
|
+
return [...dateFilterOptions];
|
|
23906
|
+
}, [dateFilterOptions]);
|
|
23907
|
+
};
|
|
23908
|
+
const useGiftCardProductsTableQuery = ({
|
|
23909
|
+
prefix,
|
|
23910
|
+
pageSize = 20
|
|
23904
23911
|
}) => {
|
|
23905
|
-
|
|
23906
|
-
|
|
23907
|
-
|
|
23908
|
-
|
|
23909
|
-
|
|
23910
|
-
|
|
23911
|
-
|
|
23912
|
-
|
|
23913
|
-
|
|
23914
|
-
|
|
23915
|
-
|
|
23916
|
-
|
|
23917
|
-
|
|
23918
|
-
|
|
23919
|
-
|
|
23920
|
-
|
|
23921
|
-
|
|
23922
|
-
|
|
23923
|
-
|
|
23924
|
-
|
|
23925
|
-
|
|
23926
|
-
|
|
23927
|
-
|
|
23928
|
-
|
|
23929
|
-
|
|
23930
|
-
|
|
23931
|
-
|
|
23932
|
-
|
|
23933
|
-
|
|
23934
|
-
|
|
23935
|
-
|
|
23936
|
-
|
|
23937
|
-
|
|
23938
|
-
|
|
23939
|
-
ActionMenu,
|
|
23912
|
+
const queryObject = useQueryParams(
|
|
23913
|
+
["offset", "customer_id", "created_at", "updated_at"],
|
|
23914
|
+
prefix
|
|
23915
|
+
);
|
|
23916
|
+
const { offset: offset2, created_at, updated_at, customer_id, ...rest } = queryObject;
|
|
23917
|
+
const searchParams = {
|
|
23918
|
+
limit: pageSize,
|
|
23919
|
+
offset: offset2 ? Number(offset2) : 0,
|
|
23920
|
+
created_at: created_at ? JSON.parse(created_at) : void 0,
|
|
23921
|
+
updated_at: updated_at ? JSON.parse(updated_at) : void 0,
|
|
23922
|
+
customer_id: customer_id ? JSON.parse(customer_id) : void 0,
|
|
23923
|
+
...rest
|
|
23924
|
+
};
|
|
23925
|
+
return searchParams;
|
|
23926
|
+
};
|
|
23927
|
+
const PAGE_SIZE$3 = 10;
|
|
23928
|
+
function GiftCardProductsTable() {
|
|
23929
|
+
const queryParams = useGiftCardProductsTableQuery({
|
|
23930
|
+
pageSize: PAGE_SIZE$3
|
|
23931
|
+
});
|
|
23932
|
+
const {
|
|
23933
|
+
products: giftCardProducts,
|
|
23934
|
+
isPending,
|
|
23935
|
+
count: count2
|
|
23936
|
+
} = useProducts({
|
|
23937
|
+
...queryParams,
|
|
23938
|
+
is_giftcard: true,
|
|
23939
|
+
order: queryParams.order ?? "-created_at"
|
|
23940
|
+
});
|
|
23941
|
+
const columns = useGiftCardProductsTableColumns();
|
|
23942
|
+
const filters = useGiftCardProductsFilters();
|
|
23943
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
23944
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
23945
|
+
DataTable,
|
|
23940
23946
|
{
|
|
23941
|
-
|
|
23947
|
+
data: giftCardProducts,
|
|
23948
|
+
getRowId: (row) => row.id,
|
|
23949
|
+
columns,
|
|
23950
|
+
filters,
|
|
23951
|
+
isLoading: isPending,
|
|
23952
|
+
pageSize: PAGE_SIZE$3,
|
|
23953
|
+
rowCount: count2,
|
|
23954
|
+
enableSearch: false,
|
|
23955
|
+
heading: "Gift Card Products",
|
|
23956
|
+
actions: [
|
|
23942
23957
|
{
|
|
23943
|
-
|
|
23944
|
-
|
|
23945
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CreditCard, {}),
|
|
23946
|
-
label: "Credit the account",
|
|
23947
|
-
to: "credit"
|
|
23948
|
-
}
|
|
23949
|
-
]
|
|
23958
|
+
label: "Create",
|
|
23959
|
+
to: "create"
|
|
23950
23960
|
}
|
|
23951
|
-
]
|
|
23961
|
+
],
|
|
23962
|
+
rowHref: (row) => `${row.id}`,
|
|
23963
|
+
emptyState: {
|
|
23964
|
+
empty: {
|
|
23965
|
+
heading: "No gift card products found",
|
|
23966
|
+
description: "Create a new gift card product to get started."
|
|
23967
|
+
},
|
|
23968
|
+
filtered: {
|
|
23969
|
+
heading: "No results found",
|
|
23970
|
+
description: "No gift card products match your filter criteria."
|
|
23971
|
+
}
|
|
23972
|
+
}
|
|
23952
23973
|
}
|
|
23953
|
-
) })
|
|
23974
|
+
) }),
|
|
23975
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
23976
|
+
] });
|
|
23977
|
+
}
|
|
23978
|
+
const GiftCardProductsPage = () => {
|
|
23979
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
23980
|
+
/* @__PURE__ */ jsxRuntime.jsx(GiftCardProductsTable, {}),
|
|
23981
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Toaster, {})
|
|
23954
23982
|
] });
|
|
23955
23983
|
};
|
|
23956
|
-
|
|
23957
|
-
|
|
23958
|
-
})
|
|
23959
|
-
|
|
23960
|
-
|
|
23984
|
+
const config = adminSdk.defineRouteConfig({
|
|
23985
|
+
label: "Gift Card Products"
|
|
23986
|
+
});
|
|
23987
|
+
const PRICE_PREFERENCES_QUERY_KEY = "price-preferences";
|
|
23988
|
+
const pricePreferencesQueryKeys = queryKeysFactory(
|
|
23989
|
+
PRICE_PREFERENCES_QUERY_KEY
|
|
23990
|
+
);
|
|
23991
|
+
const usePricePreferences = (query, options) => {
|
|
23992
|
+
const { data, ...rest } = reactQuery.useQuery({
|
|
23993
|
+
queryFn: () => sdk.admin.pricePreference.list(query),
|
|
23994
|
+
queryKey: pricePreferencesQueryKeys.list(query),
|
|
23995
|
+
...options
|
|
23961
23996
|
});
|
|
23962
|
-
|
|
23963
|
-
|
|
23964
|
-
|
|
23965
|
-
|
|
23966
|
-
|
|
23967
|
-
|
|
23968
|
-
|
|
23969
|
-
|
|
23970
|
-
|
|
23971
|
-
|
|
23972
|
-
|
|
23973
|
-
|
|
23974
|
-
|
|
23975
|
-
|
|
23976
|
-
|
|
23977
|
-
|
|
23978
|
-
}
|
|
23979
|
-
|
|
23980
|
-
|
|
23981
|
-
|
|
23997
|
+
return { ...data, ...rest };
|
|
23998
|
+
};
|
|
23999
|
+
const REGIONS_QUERY_KEY = "regions";
|
|
24000
|
+
const regionsQueryKeys = queryKeysFactory(REGIONS_QUERY_KEY);
|
|
24001
|
+
const useRegions = (query, options) => {
|
|
24002
|
+
const { data, ...rest } = reactQuery.useQuery({
|
|
24003
|
+
queryFn: () => sdk.admin.region.list(query),
|
|
24004
|
+
queryKey: regionsQueryKeys.list(query),
|
|
24005
|
+
...options
|
|
24006
|
+
});
|
|
24007
|
+
return { ...data, ...rest };
|
|
24008
|
+
};
|
|
24009
|
+
const consoleLogger = {
|
|
24010
|
+
type: "logger",
|
|
24011
|
+
log(args) {
|
|
24012
|
+
this.output("log", args);
|
|
24013
|
+
},
|
|
24014
|
+
warn(args) {
|
|
24015
|
+
this.output("warn", args);
|
|
24016
|
+
},
|
|
24017
|
+
error(args) {
|
|
24018
|
+
this.output("error", args);
|
|
24019
|
+
},
|
|
24020
|
+
output(type, args) {
|
|
24021
|
+
if (console && console[type]) console[type].apply(console, args);
|
|
23982
24022
|
}
|
|
23983
|
-
|
|
23984
|
-
|
|
23985
|
-
|
|
23986
|
-
|
|
23987
|
-
|
|
23988
|
-
] })
|
|
23989
|
-
] });
|
|
23990
|
-
}
|
|
23991
|
-
const StoreCreditAccountPage = () => {
|
|
23992
|
-
const { id } = reactRouterDom.useParams();
|
|
23993
|
-
const { store_credit_account: storeCreditAccount } = useStoreCreditAccount(
|
|
23994
|
-
id
|
|
23995
|
-
);
|
|
23996
|
-
if (!storeCreditAccount) {
|
|
23997
|
-
return;
|
|
23998
|
-
}
|
|
23999
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
24000
|
-
TwoColumnLayout,
|
|
24001
|
-
{
|
|
24002
|
-
firstCol: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
24003
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24004
|
-
StoreCreditAccountDetailsSection,
|
|
24005
|
-
{
|
|
24006
|
-
storeCreditAccount
|
|
24007
|
-
}
|
|
24008
|
-
),
|
|
24009
|
-
/* @__PURE__ */ jsxRuntime.jsx(TransactionsTable, { id: storeCreditAccount.id })
|
|
24010
|
-
] }),
|
|
24011
|
-
secondCol: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
24012
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24013
|
-
StoreCreditAccountBalanceSection,
|
|
24014
|
-
{
|
|
24015
|
-
storeCreditAccount
|
|
24016
|
-
}
|
|
24017
|
-
),
|
|
24018
|
-
/* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountCodeSection, { code: storeCreditAccount.code }),
|
|
24019
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24020
|
-
StoreCreditAccountCustomerSection,
|
|
24021
|
-
{
|
|
24022
|
-
customerId: storeCreditAccount.customer_id
|
|
24023
|
-
}
|
|
24024
|
-
)
|
|
24025
|
-
] })
|
|
24026
|
-
}
|
|
24027
|
-
) });
|
|
24028
|
-
};
|
|
24029
|
-
const Note = () => {
|
|
24030
|
-
const { id } = reactRouterDom.useParams();
|
|
24031
|
-
const {
|
|
24032
|
-
store_credit_account: storeCreditAccount,
|
|
24033
|
-
isPending,
|
|
24034
|
-
isError,
|
|
24035
|
-
error
|
|
24036
|
-
} = useStoreCreditAccount(id, {});
|
|
24037
|
-
if (isError) {
|
|
24038
|
-
throw error;
|
|
24039
|
-
}
|
|
24040
|
-
const isReady = !isPending && !!storeCreditAccount;
|
|
24041
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
24042
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
24043
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Credit store credit account" }) }),
|
|
24044
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Credit the store credit account" }) })
|
|
24045
|
-
] }),
|
|
24046
|
-
isReady && /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountCreditForm, { storeCreditAccount })
|
|
24047
|
-
] });
|
|
24048
|
-
};
|
|
24049
|
-
const StoreCreditAccountCreditForm = ({
|
|
24050
|
-
storeCreditAccount
|
|
24051
|
-
}) => {
|
|
24052
|
-
const form = useForm({
|
|
24053
|
-
defaultValues: {
|
|
24054
|
-
amount: {
|
|
24055
|
-
float: 0,
|
|
24056
|
-
value: ""
|
|
24057
|
-
},
|
|
24058
|
-
note: ""
|
|
24059
|
-
},
|
|
24060
|
-
resolver: t(schema)
|
|
24061
|
-
});
|
|
24062
|
-
const { mutateAsync, isPending } = useCreditStoreCreditAccount(
|
|
24063
|
-
storeCreditAccount.id
|
|
24064
|
-
);
|
|
24065
|
-
const { handleSuccess } = useRouteModal();
|
|
24066
|
-
const onSubmit = form.handleSubmit(async (data) => {
|
|
24067
|
-
if (data.amount.float <= 0) {
|
|
24068
|
-
form.setError("amount", { message: "Amount must be greater than 0" });
|
|
24069
|
-
return;
|
|
24070
|
-
}
|
|
24071
|
-
await mutateAsync(
|
|
24072
|
-
{ amount: data.amount.float, note: data.note },
|
|
24073
|
-
{
|
|
24074
|
-
onSuccess: () => handleSuccess(),
|
|
24075
|
-
onError: (error) => ui.toast.error(error.message)
|
|
24076
|
-
}
|
|
24077
|
-
);
|
|
24078
|
-
});
|
|
24079
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
24080
|
-
KeyboundForm,
|
|
24081
|
-
{
|
|
24082
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
24083
|
-
onSubmit,
|
|
24084
|
-
children: [
|
|
24085
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
|
|
24086
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24087
|
-
Form$2.Field,
|
|
24088
|
-
{
|
|
24089
|
-
control: form.control,
|
|
24090
|
-
name: "amount",
|
|
24091
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
24092
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Amount" }),
|
|
24093
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
24094
|
-
ui.CurrencyInput,
|
|
24095
|
-
{
|
|
24096
|
-
min: 0,
|
|
24097
|
-
placeholder: "0",
|
|
24098
|
-
value: field.value.value,
|
|
24099
|
-
onValueChange: (_value, _name, values) => {
|
|
24100
|
-
field.onChange({
|
|
24101
|
-
value: values == null ? void 0 : values.value,
|
|
24102
|
-
float: (values == null ? void 0 : values.float) || null
|
|
24103
|
-
});
|
|
24104
|
-
},
|
|
24105
|
-
symbol: currencies[storeCreditAccount.currency_code.toUpperCase()].symbol_native,
|
|
24106
|
-
code: storeCreditAccount.currency_code.toUpperCase()
|
|
24107
|
-
}
|
|
24108
|
-
) }),
|
|
24109
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
24110
|
-
] })
|
|
24111
|
-
}
|
|
24112
|
-
),
|
|
24113
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24114
|
-
Form$2.Field,
|
|
24115
|
-
{
|
|
24116
|
-
control: form.control,
|
|
24117
|
-
name: "note",
|
|
24118
|
-
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
24119
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Note" }),
|
|
24120
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Textarea, { ...field }) }),
|
|
24121
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
24122
|
-
] })
|
|
24123
|
-
}
|
|
24124
|
-
)
|
|
24125
|
-
] }),
|
|
24126
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
24127
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
24128
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
24129
|
-
] }) })
|
|
24130
|
-
]
|
|
24131
|
-
}
|
|
24132
|
-
) });
|
|
24133
|
-
};
|
|
24134
|
-
const schema = objectType({
|
|
24135
|
-
note: stringType(),
|
|
24136
|
-
amount: objectType({
|
|
24137
|
-
float: numberType(),
|
|
24138
|
-
value: stringType()
|
|
24139
|
-
})
|
|
24140
|
-
});
|
|
24141
|
-
const columnHelper$7 = createColumnHelper();
|
|
24142
|
-
const useGiftCardProductsTableColumns = () => {
|
|
24143
|
-
return React.useMemo(
|
|
24144
|
-
() => [
|
|
24145
|
-
columnHelper$7.display({
|
|
24146
|
-
id: "product",
|
|
24147
|
-
header: () => /* @__PURE__ */ jsxRuntime.jsx(ProductHeader, {}),
|
|
24148
|
-
cell: ({ row }) => /* @__PURE__ */ jsxRuntime.jsx(ProductCell, { product: row.original })
|
|
24149
|
-
}),
|
|
24150
|
-
columnHelper$7.accessor("sales_channels", {
|
|
24151
|
-
header: () => /* @__PURE__ */ jsxRuntime.jsx(SalesChannelHeader, {}),
|
|
24152
|
-
cell: ({ row }) => /* @__PURE__ */ jsxRuntime.jsx(SalesChannelsCell, { salesChannels: row.original.sales_channels })
|
|
24153
|
-
}),
|
|
24154
|
-
columnHelper$7.accessor("variants", {
|
|
24155
|
-
header: () => /* @__PURE__ */ jsxRuntime.jsx(VariantHeader, {}),
|
|
24156
|
-
cell: ({ row }) => /* @__PURE__ */ jsxRuntime.jsx(VariantCell, { variants: row.original.variants })
|
|
24157
|
-
}),
|
|
24158
|
-
columnHelper$7.accessor("status", {
|
|
24159
|
-
header: () => /* @__PURE__ */ jsxRuntime.jsx(ProductStatusHeader, {}),
|
|
24160
|
-
cell: ({ row }) => /* @__PURE__ */ jsxRuntime.jsx(ProductStatusCell, { status: row.original.status })
|
|
24161
|
-
})
|
|
24162
|
-
],
|
|
24163
|
-
[]
|
|
24164
|
-
);
|
|
24165
|
-
};
|
|
24166
|
-
const useGiftCardProductsFilters = () => {
|
|
24167
|
-
const dateFilterOptions = useDataTableDateFilters$1();
|
|
24168
|
-
return React.useMemo(() => {
|
|
24169
|
-
return [...dateFilterOptions];
|
|
24170
|
-
}, [dateFilterOptions]);
|
|
24171
|
-
};
|
|
24172
|
-
const useGiftCardProductsTableQuery = ({
|
|
24173
|
-
prefix,
|
|
24174
|
-
pageSize = 20
|
|
24175
|
-
}) => {
|
|
24176
|
-
const queryObject = useQueryParams(
|
|
24177
|
-
["offset", "customer_id", "created_at", "updated_at"],
|
|
24178
|
-
prefix
|
|
24179
|
-
);
|
|
24180
|
-
const { offset: offset2, created_at, updated_at, customer_id, ...rest } = queryObject;
|
|
24181
|
-
const searchParams = {
|
|
24182
|
-
limit: pageSize,
|
|
24183
|
-
offset: offset2 ? Number(offset2) : 0,
|
|
24184
|
-
created_at: created_at ? JSON.parse(created_at) : void 0,
|
|
24185
|
-
updated_at: updated_at ? JSON.parse(updated_at) : void 0,
|
|
24186
|
-
customer_id: customer_id ? JSON.parse(customer_id) : void 0,
|
|
24187
|
-
...rest
|
|
24188
|
-
};
|
|
24189
|
-
return searchParams;
|
|
24190
|
-
};
|
|
24191
|
-
const PAGE_SIZE$3 = 10;
|
|
24192
|
-
function GiftCardProductsTable() {
|
|
24193
|
-
const queryParams = useGiftCardProductsTableQuery({
|
|
24194
|
-
pageSize: PAGE_SIZE$3
|
|
24195
|
-
});
|
|
24196
|
-
const {
|
|
24197
|
-
products: giftCardProducts,
|
|
24198
|
-
isPending,
|
|
24199
|
-
count: count2
|
|
24200
|
-
} = useProducts({
|
|
24201
|
-
...queryParams,
|
|
24202
|
-
is_giftcard: true,
|
|
24203
|
-
order: queryParams.order ?? "-created_at"
|
|
24204
|
-
});
|
|
24205
|
-
const columns = useGiftCardProductsTableColumns();
|
|
24206
|
-
const filters = useGiftCardProductsFilters();
|
|
24207
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
24208
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
24209
|
-
DataTable,
|
|
24210
|
-
{
|
|
24211
|
-
data: giftCardProducts,
|
|
24212
|
-
getRowId: (row) => row.id,
|
|
24213
|
-
columns,
|
|
24214
|
-
filters,
|
|
24215
|
-
isLoading: isPending,
|
|
24216
|
-
pageSize: PAGE_SIZE$3,
|
|
24217
|
-
rowCount: count2,
|
|
24218
|
-
enableSearch: false,
|
|
24219
|
-
heading: "Gift Card Products",
|
|
24220
|
-
actions: [
|
|
24221
|
-
{
|
|
24222
|
-
label: "Create",
|
|
24223
|
-
to: "create"
|
|
24224
|
-
}
|
|
24225
|
-
],
|
|
24226
|
-
rowHref: (row) => `${row.id}`,
|
|
24227
|
-
emptyState: {
|
|
24228
|
-
empty: {
|
|
24229
|
-
heading: "No gift card products found",
|
|
24230
|
-
description: "Create a new gift card product to get started."
|
|
24231
|
-
},
|
|
24232
|
-
filtered: {
|
|
24233
|
-
heading: "No results found",
|
|
24234
|
-
description: "No gift card products match your filter criteria."
|
|
24235
|
-
}
|
|
24236
|
-
}
|
|
24237
|
-
}
|
|
24238
|
-
) }),
|
|
24239
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
24240
|
-
] });
|
|
24241
|
-
}
|
|
24242
|
-
const GiftCardProductsPage = () => {
|
|
24243
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
24244
|
-
/* @__PURE__ */ jsxRuntime.jsx(GiftCardProductsTable, {}),
|
|
24245
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Toaster, {})
|
|
24246
|
-
] });
|
|
24247
|
-
};
|
|
24248
|
-
const config = adminSdk.defineRouteConfig({
|
|
24249
|
-
label: "Gift Card Products"
|
|
24250
|
-
});
|
|
24251
|
-
const PRICE_PREFERENCES_QUERY_KEY = "price-preferences";
|
|
24252
|
-
const pricePreferencesQueryKeys = queryKeysFactory(
|
|
24253
|
-
PRICE_PREFERENCES_QUERY_KEY
|
|
24254
|
-
);
|
|
24255
|
-
const usePricePreferences = (query, options) => {
|
|
24256
|
-
const { data, ...rest } = reactQuery.useQuery({
|
|
24257
|
-
queryFn: () => sdk.admin.pricePreference.list(query),
|
|
24258
|
-
queryKey: pricePreferencesQueryKeys.list(query),
|
|
24259
|
-
...options
|
|
24260
|
-
});
|
|
24261
|
-
return { ...data, ...rest };
|
|
24262
|
-
};
|
|
24263
|
-
const REGIONS_QUERY_KEY = "regions";
|
|
24264
|
-
const regionsQueryKeys = queryKeysFactory(REGIONS_QUERY_KEY);
|
|
24265
|
-
const useRegions = (query, options) => {
|
|
24266
|
-
const { data, ...rest } = reactQuery.useQuery({
|
|
24267
|
-
queryFn: () => sdk.admin.region.list(query),
|
|
24268
|
-
queryKey: regionsQueryKeys.list(query),
|
|
24269
|
-
...options
|
|
24270
|
-
});
|
|
24271
|
-
return { ...data, ...rest };
|
|
24272
|
-
};
|
|
24273
|
-
const consoleLogger = {
|
|
24274
|
-
type: "logger",
|
|
24275
|
-
log(args) {
|
|
24276
|
-
this.output("log", args);
|
|
24277
|
-
},
|
|
24278
|
-
warn(args) {
|
|
24279
|
-
this.output("warn", args);
|
|
24280
|
-
},
|
|
24281
|
-
error(args) {
|
|
24282
|
-
this.output("error", args);
|
|
24283
|
-
},
|
|
24284
|
-
output(type, args) {
|
|
24285
|
-
if (console && console[type]) console[type].apply(console, args);
|
|
24286
|
-
}
|
|
24287
|
-
};
|
|
24288
|
-
class Logger {
|
|
24289
|
-
constructor(concreteLogger) {
|
|
24290
|
-
let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
24291
|
-
this.init(concreteLogger, options);
|
|
24023
|
+
};
|
|
24024
|
+
class Logger {
|
|
24025
|
+
constructor(concreteLogger) {
|
|
24026
|
+
let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
24027
|
+
this.init(concreteLogger, options);
|
|
24292
24028
|
}
|
|
24293
24029
|
init(concreteLogger) {
|
|
24294
24030
|
let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
@@ -36477,474 +36213,738 @@ const PRODUCT_CREATE_FORM_DEFAULTS = {
|
|
|
36477
36213
|
value: "100",
|
|
36478
36214
|
prices: {}
|
|
36479
36215
|
}
|
|
36480
|
-
],
|
|
36481
|
-
enable_variants: true,
|
|
36482
|
-
media: [],
|
|
36483
|
-
categories: [],
|
|
36484
|
-
collection_id: "",
|
|
36485
|
-
shipping_profile_id: "",
|
|
36486
|
-
description: "",
|
|
36487
|
-
handle: "",
|
|
36488
|
-
height: "",
|
|
36489
|
-
hs_code: "",
|
|
36490
|
-
length: "",
|
|
36491
|
-
material: "",
|
|
36492
|
-
mid_code: "",
|
|
36493
|
-
origin_country: "",
|
|
36494
|
-
subtitle: "",
|
|
36495
|
-
title: "",
|
|
36496
|
-
type_id: "",
|
|
36497
|
-
weight: "",
|
|
36498
|
-
width: ""
|
|
36499
|
-
};
|
|
36500
|
-
const PAGE_SIZE$2 = 50;
|
|
36501
|
-
const GiftCardProductSalesChannelStackedModal = ({
|
|
36502
|
-
form
|
|
36503
|
-
}) => {
|
|
36504
|
-
const { getValues, setValue: setValue2 } = form;
|
|
36505
|
-
const { setIsOpen, getIsOpen } = useStackedModal();
|
|
36506
|
-
const [rowSelection, setRowSelection] = React.useState(
|
|
36507
|
-
{}
|
|
36508
|
-
);
|
|
36509
|
-
const [state, setState] = React.useState([]);
|
|
36510
|
-
const searchParams = useSalesChannelTableQuery({
|
|
36511
|
-
pageSize: PAGE_SIZE$2,
|
|
36512
|
-
prefix: SC_STACKED_MODAL_ID
|
|
36216
|
+
],
|
|
36217
|
+
enable_variants: true,
|
|
36218
|
+
media: [],
|
|
36219
|
+
categories: [],
|
|
36220
|
+
collection_id: "",
|
|
36221
|
+
shipping_profile_id: "",
|
|
36222
|
+
description: "",
|
|
36223
|
+
handle: "",
|
|
36224
|
+
height: "",
|
|
36225
|
+
hs_code: "",
|
|
36226
|
+
length: "",
|
|
36227
|
+
material: "",
|
|
36228
|
+
mid_code: "",
|
|
36229
|
+
origin_country: "",
|
|
36230
|
+
subtitle: "",
|
|
36231
|
+
title: "",
|
|
36232
|
+
type_id: "",
|
|
36233
|
+
weight: "",
|
|
36234
|
+
width: ""
|
|
36235
|
+
};
|
|
36236
|
+
const PAGE_SIZE$2 = 50;
|
|
36237
|
+
const GiftCardProductSalesChannelStackedModal = ({
|
|
36238
|
+
form
|
|
36239
|
+
}) => {
|
|
36240
|
+
const { getValues, setValue: setValue2 } = form;
|
|
36241
|
+
const { setIsOpen, getIsOpen } = useStackedModal();
|
|
36242
|
+
const [rowSelection, setRowSelection] = React.useState(
|
|
36243
|
+
{}
|
|
36244
|
+
);
|
|
36245
|
+
const [state, setState] = React.useState([]);
|
|
36246
|
+
const searchParams = useSalesChannelTableQuery({
|
|
36247
|
+
pageSize: PAGE_SIZE$2,
|
|
36248
|
+
prefix: SC_STACKED_MODAL_ID
|
|
36249
|
+
});
|
|
36250
|
+
const { sales_channels, count: count2, isLoading, isError, error } = useSalesChannels(
|
|
36251
|
+
searchParams,
|
|
36252
|
+
{ placeholderData: reactQuery.keepPreviousData }
|
|
36253
|
+
);
|
|
36254
|
+
const open = getIsOpen(SC_STACKED_MODAL_ID);
|
|
36255
|
+
React.useEffect(() => {
|
|
36256
|
+
if (!open) {
|
|
36257
|
+
return;
|
|
36258
|
+
}
|
|
36259
|
+
const salesChannels = getValues("sales_channels");
|
|
36260
|
+
if (salesChannels) {
|
|
36261
|
+
setState(
|
|
36262
|
+
salesChannels.map((channel) => ({
|
|
36263
|
+
id: channel.id,
|
|
36264
|
+
name: channel.name
|
|
36265
|
+
}))
|
|
36266
|
+
);
|
|
36267
|
+
setRowSelection(
|
|
36268
|
+
salesChannels.reduce(
|
|
36269
|
+
(acc, channel) => ({
|
|
36270
|
+
...acc,
|
|
36271
|
+
[channel.id]: true
|
|
36272
|
+
}),
|
|
36273
|
+
{}
|
|
36274
|
+
)
|
|
36275
|
+
);
|
|
36276
|
+
}
|
|
36277
|
+
}, [open, getValues]);
|
|
36278
|
+
const onRowSelectionChange = (state2) => {
|
|
36279
|
+
const ids2 = Object.keys(state2);
|
|
36280
|
+
const addedIdsSet = new Set(
|
|
36281
|
+
ids2.filter((id) => state2[id] && !rowSelection[id])
|
|
36282
|
+
);
|
|
36283
|
+
let addedSalesChannels = [];
|
|
36284
|
+
if (addedIdsSet.size > 0) {
|
|
36285
|
+
addedSalesChannels = (sales_channels == null ? void 0 : sales_channels.filter((channel) => addedIdsSet.has(channel.id))) ?? [];
|
|
36286
|
+
}
|
|
36287
|
+
setState((prev) => {
|
|
36288
|
+
const filteredPrev = prev.filter((channel) => state2[channel.id]);
|
|
36289
|
+
return Array.from(/* @__PURE__ */ new Set([...filteredPrev, ...addedSalesChannels]));
|
|
36290
|
+
});
|
|
36291
|
+
setRowSelection(state2);
|
|
36292
|
+
};
|
|
36293
|
+
const handleAdd = () => {
|
|
36294
|
+
setValue2("sales_channels", state, {
|
|
36295
|
+
shouldDirty: true,
|
|
36296
|
+
shouldTouch: true
|
|
36297
|
+
});
|
|
36298
|
+
setIsOpen(SC_STACKED_MODAL_ID, false);
|
|
36299
|
+
};
|
|
36300
|
+
const filters = useSalesChannelTableFilters();
|
|
36301
|
+
const columns = useColumns$2();
|
|
36302
|
+
const emptyState = useSalesChannelTableEmptyState();
|
|
36303
|
+
if (isError) {
|
|
36304
|
+
throw error;
|
|
36305
|
+
}
|
|
36306
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(StackedFocusModal.Content, { className: "flex flex-col overflow-hidden", children: [
|
|
36307
|
+
/* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Header, {}),
|
|
36308
|
+
/* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Body, { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
36309
|
+
DataTable,
|
|
36310
|
+
{
|
|
36311
|
+
data: sales_channels,
|
|
36312
|
+
columns,
|
|
36313
|
+
filters,
|
|
36314
|
+
emptyState,
|
|
36315
|
+
rowCount: count2,
|
|
36316
|
+
pageSize: PAGE_SIZE$2,
|
|
36317
|
+
getRowId: (row) => row.id,
|
|
36318
|
+
rowSelection: {
|
|
36319
|
+
state: rowSelection,
|
|
36320
|
+
onRowSelectionChange
|
|
36321
|
+
},
|
|
36322
|
+
isLoading,
|
|
36323
|
+
layout: "fill",
|
|
36324
|
+
prefix: SC_STACKED_MODAL_ID
|
|
36325
|
+
}
|
|
36326
|
+
) }),
|
|
36327
|
+
/* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
36328
|
+
/* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
|
|
36329
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", onClick: handleAdd, type: "button", children: "Save" })
|
|
36330
|
+
] }) })
|
|
36331
|
+
] });
|
|
36332
|
+
};
|
|
36333
|
+
const columnHelper$3 = ui.createDataTableColumnHelper();
|
|
36334
|
+
const useColumns$2 = () => {
|
|
36335
|
+
const base = useSalesChannelTableColumns();
|
|
36336
|
+
return React.useMemo(() => [columnHelper$3.select(), ...base], [base]);
|
|
36337
|
+
};
|
|
36338
|
+
const GiftCardProductCreateOrganizeForm = ({
|
|
36339
|
+
form
|
|
36340
|
+
}) => {
|
|
36341
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(StackedFocusModal, { id: SC_STACKED_MODAL_ID, children: [
|
|
36342
|
+
/* @__PURE__ */ jsxRuntime.jsx(GiftCardProductCreateOrganizationSection, { form }),
|
|
36343
|
+
/* @__PURE__ */ jsxRuntime.jsx(GiftCardProductSalesChannelStackedModal, { form })
|
|
36344
|
+
] });
|
|
36345
|
+
};
|
|
36346
|
+
const GiftCardProductCreateDetailsForm = ({
|
|
36347
|
+
form
|
|
36348
|
+
}) => {
|
|
36349
|
+
return /* @__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: [
|
|
36350
|
+
/* @__PURE__ */ jsxRuntime.jsx(Header, {}),
|
|
36351
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
|
|
36352
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-8", children: [
|
|
36353
|
+
/* @__PURE__ */ jsxRuntime.jsx(GiftCardProductCreateFormGeneral, { form, children: /* @__PURE__ */ jsxRuntime.jsx(GiftCardProductCreateFormMedia, { form }) }),
|
|
36354
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
|
|
36355
|
+
/* @__PURE__ */ jsxRuntime.jsx(GiftCardProductCreateOrganizeForm, { form }),
|
|
36356
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { variant: "dashed" }),
|
|
36357
|
+
/* @__PURE__ */ jsxRuntime.jsx(GiftCardProductCreateFormDenominations, { form })
|
|
36358
|
+
] })
|
|
36359
|
+
] }) });
|
|
36360
|
+
};
|
|
36361
|
+
const Header = () => {
|
|
36362
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Create Gift Card Product" }) });
|
|
36363
|
+
};
|
|
36364
|
+
const SAVE_DRAFT_BUTTON = "save-draft-button";
|
|
36365
|
+
const GiftCardProductCreateForm = ({
|
|
36366
|
+
defaultChannel,
|
|
36367
|
+
regions,
|
|
36368
|
+
store,
|
|
36369
|
+
pricePreferences
|
|
36370
|
+
}) => {
|
|
36371
|
+
const [tab, setTab] = React.useState(
|
|
36372
|
+
"details"
|
|
36373
|
+
/* DETAILS */
|
|
36374
|
+
);
|
|
36375
|
+
const [tabState, setTabState] = React.useState({
|
|
36376
|
+
[
|
|
36377
|
+
"details"
|
|
36378
|
+
/* DETAILS */
|
|
36379
|
+
]: "in-progress",
|
|
36380
|
+
[
|
|
36381
|
+
"prices"
|
|
36382
|
+
/* PRICES */
|
|
36383
|
+
]: "not-started"
|
|
36384
|
+
});
|
|
36385
|
+
const { handleSuccess } = useRouteModal();
|
|
36386
|
+
const form = useForm({
|
|
36387
|
+
defaultValues: {
|
|
36388
|
+
...PRODUCT_CREATE_FORM_DEFAULTS,
|
|
36389
|
+
sales_channels: defaultChannel ? [{ id: defaultChannel.id, name: defaultChannel.name }] : []
|
|
36390
|
+
},
|
|
36391
|
+
resolver: t(ProductCreateSchema)
|
|
36392
|
+
});
|
|
36393
|
+
const { mutateAsync, isPending } = useCreateProduct();
|
|
36394
|
+
const regionsCurrencyMap = React.useMemo(() => {
|
|
36395
|
+
if (!(regions == null ? void 0 : regions.length)) {
|
|
36396
|
+
return {};
|
|
36397
|
+
}
|
|
36398
|
+
return regions.reduce((acc, reg) => {
|
|
36399
|
+
acc[reg.id] = reg.currency_code;
|
|
36400
|
+
return acc;
|
|
36401
|
+
}, {});
|
|
36402
|
+
}, [regions]);
|
|
36403
|
+
const handleSubmit = form.handleSubmit(async (values, e2) => {
|
|
36404
|
+
var _a;
|
|
36405
|
+
let isDraftSubmission = false;
|
|
36406
|
+
if ((e2 == null ? void 0 : e2.nativeEvent) instanceof SubmitEvent) {
|
|
36407
|
+
const submitter = (_a = e2 == null ? void 0 : e2.nativeEvent) == null ? void 0 : _a.submitter;
|
|
36408
|
+
isDraftSubmission = submitter.dataset.name === SAVE_DRAFT_BUTTON;
|
|
36409
|
+
}
|
|
36410
|
+
const media = values.media || [];
|
|
36411
|
+
const payload = { ...values, media: void 0 };
|
|
36412
|
+
let uploadedMedia = [];
|
|
36413
|
+
try {
|
|
36414
|
+
if (media.length) {
|
|
36415
|
+
const thumbnailReq = media.find((m) => m.isThumbnail);
|
|
36416
|
+
const otherMediaReq = media.filter((m) => !m.isThumbnail);
|
|
36417
|
+
const fileReqs = [];
|
|
36418
|
+
if (thumbnailReq) {
|
|
36419
|
+
fileReqs.push(
|
|
36420
|
+
sdk.admin.upload.create({ files: [thumbnailReq.file] }).then((r) => r.files.map((f2) => ({ ...f2, isThumbnail: true })))
|
|
36421
|
+
);
|
|
36422
|
+
}
|
|
36423
|
+
if (otherMediaReq == null ? void 0 : otherMediaReq.length) {
|
|
36424
|
+
fileReqs.push(
|
|
36425
|
+
sdk.admin.upload.create({
|
|
36426
|
+
files: otherMediaReq.map((m) => m.file)
|
|
36427
|
+
}).then((r) => r.files.map((f2) => ({ ...f2, isThumbnail: false })))
|
|
36428
|
+
);
|
|
36429
|
+
}
|
|
36430
|
+
uploadedMedia = (await Promise.all(fileReqs)).flat();
|
|
36431
|
+
}
|
|
36432
|
+
} catch (error) {
|
|
36433
|
+
if (error instanceof Error) {
|
|
36434
|
+
ui.toast.error(error.message);
|
|
36435
|
+
}
|
|
36436
|
+
}
|
|
36437
|
+
await mutateAsync(
|
|
36438
|
+
normalizeProductFormValues({
|
|
36439
|
+
...payload,
|
|
36440
|
+
media: uploadedMedia,
|
|
36441
|
+
status: isDraftSubmission ? "draft" : "published",
|
|
36442
|
+
regionsCurrencyMap
|
|
36443
|
+
}),
|
|
36444
|
+
{
|
|
36445
|
+
onSuccess: (data) => {
|
|
36446
|
+
ui.toast.success(
|
|
36447
|
+
`Product ${data.product.title} was successfully created.`
|
|
36448
|
+
);
|
|
36449
|
+
handleSuccess(`../${data.product.id}`);
|
|
36450
|
+
},
|
|
36451
|
+
onError: (error) => {
|
|
36452
|
+
ui.toast.error(error.message);
|
|
36453
|
+
}
|
|
36454
|
+
}
|
|
36455
|
+
);
|
|
36513
36456
|
});
|
|
36514
|
-
const
|
|
36515
|
-
|
|
36516
|
-
|
|
36517
|
-
);
|
|
36518
|
-
const open = getIsOpen(SC_STACKED_MODAL_ID);
|
|
36519
|
-
React.useEffect(() => {
|
|
36520
|
-
if (!open) {
|
|
36457
|
+
const onNext = async (currentTab) => {
|
|
36458
|
+
const valid = await form.trigger();
|
|
36459
|
+
if (!valid) {
|
|
36521
36460
|
return;
|
|
36522
36461
|
}
|
|
36523
|
-
|
|
36524
|
-
|
|
36525
|
-
|
|
36526
|
-
|
|
36527
|
-
id: channel.id,
|
|
36528
|
-
name: channel.name
|
|
36529
|
-
}))
|
|
36530
|
-
);
|
|
36531
|
-
setRowSelection(
|
|
36532
|
-
salesChannels.reduce(
|
|
36533
|
-
(acc, channel) => ({
|
|
36534
|
-
...acc,
|
|
36535
|
-
[channel.id]: true
|
|
36536
|
-
}),
|
|
36537
|
-
{}
|
|
36538
|
-
)
|
|
36462
|
+
if (currentTab === "details") {
|
|
36463
|
+
setTab(
|
|
36464
|
+
"prices"
|
|
36465
|
+
/* PRICES */
|
|
36539
36466
|
);
|
|
36540
36467
|
}
|
|
36541
|
-
}, [open, getValues]);
|
|
36542
|
-
const onRowSelectionChange = (state2) => {
|
|
36543
|
-
const ids2 = Object.keys(state2);
|
|
36544
|
-
const addedIdsSet = new Set(
|
|
36545
|
-
ids2.filter((id) => state2[id] && !rowSelection[id])
|
|
36546
|
-
);
|
|
36547
|
-
let addedSalesChannels = [];
|
|
36548
|
-
if (addedIdsSet.size > 0) {
|
|
36549
|
-
addedSalesChannels = (sales_channels == null ? void 0 : sales_channels.filter((channel) => addedIdsSet.has(channel.id))) ?? [];
|
|
36550
|
-
}
|
|
36551
|
-
setState((prev) => {
|
|
36552
|
-
const filteredPrev = prev.filter((channel) => state2[channel.id]);
|
|
36553
|
-
return Array.from(/* @__PURE__ */ new Set([...filteredPrev, ...addedSalesChannels]));
|
|
36554
|
-
});
|
|
36555
|
-
setRowSelection(state2);
|
|
36556
|
-
};
|
|
36557
|
-
const handleAdd = () => {
|
|
36558
|
-
setValue2("sales_channels", state, {
|
|
36559
|
-
shouldDirty: true,
|
|
36560
|
-
shouldTouch: true
|
|
36561
|
-
});
|
|
36562
|
-
setIsOpen(SC_STACKED_MODAL_ID, false);
|
|
36563
36468
|
};
|
|
36564
|
-
|
|
36565
|
-
|
|
36566
|
-
|
|
36567
|
-
|
|
36568
|
-
|
|
36569
|
-
|
|
36570
|
-
|
|
36571
|
-
|
|
36572
|
-
|
|
36573
|
-
|
|
36469
|
+
React.useEffect(() => {
|
|
36470
|
+
const currentState = { ...tabState };
|
|
36471
|
+
if (tab === "details") {
|
|
36472
|
+
currentState[
|
|
36473
|
+
"details"
|
|
36474
|
+
/* DETAILS */
|
|
36475
|
+
] = "in-progress";
|
|
36476
|
+
}
|
|
36477
|
+
if (tab === "prices") {
|
|
36478
|
+
currentState[
|
|
36479
|
+
"details"
|
|
36480
|
+
/* DETAILS */
|
|
36481
|
+
] = "completed";
|
|
36482
|
+
currentState[
|
|
36483
|
+
"prices"
|
|
36484
|
+
/* PRICES */
|
|
36485
|
+
] = "in-progress";
|
|
36486
|
+
}
|
|
36487
|
+
setTabState({ ...currentState });
|
|
36488
|
+
}, [tab]);
|
|
36489
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
36490
|
+
KeyboundForm,
|
|
36491
|
+
{
|
|
36492
|
+
onKeyDown: (e2) => {
|
|
36493
|
+
if (e2.key === "Enter") {
|
|
36494
|
+
if (e2.target instanceof HTMLTextAreaElement && !(e2.metaKey || e2.ctrlKey)) {
|
|
36495
|
+
return;
|
|
36496
|
+
}
|
|
36497
|
+
e2.preventDefault();
|
|
36498
|
+
if (e2.metaKey || e2.ctrlKey) {
|
|
36499
|
+
if (tab !== "prices") {
|
|
36500
|
+
e2.preventDefault();
|
|
36501
|
+
e2.stopPropagation();
|
|
36502
|
+
onNext(tab);
|
|
36503
|
+
return;
|
|
36504
|
+
}
|
|
36505
|
+
handleSubmit();
|
|
36506
|
+
}
|
|
36507
|
+
}
|
|
36508
|
+
},
|
|
36509
|
+
onSubmit: handleSubmit,
|
|
36510
|
+
className: "flex h-full flex-col",
|
|
36511
|
+
children: [
|
|
36512
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
36513
|
+
ui.ProgressTabs,
|
|
36514
|
+
{
|
|
36515
|
+
value: tab,
|
|
36516
|
+
onValueChange: async (tab2) => {
|
|
36517
|
+
const valid = await form.trigger();
|
|
36518
|
+
if (!valid) {
|
|
36519
|
+
return;
|
|
36520
|
+
}
|
|
36521
|
+
setTab(tab2);
|
|
36522
|
+
},
|
|
36523
|
+
className: "flex h-full flex-col overflow-hidden",
|
|
36524
|
+
children: [
|
|
36525
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Header, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "-my-2 w-full border-l", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.ProgressTabs.List, { className: "justify-start-start flex w-full items-center", children: [
|
|
36526
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
36527
|
+
ui.ProgressTabs.Trigger,
|
|
36528
|
+
{
|
|
36529
|
+
status: tabState[
|
|
36530
|
+
"details"
|
|
36531
|
+
/* DETAILS */
|
|
36532
|
+
],
|
|
36533
|
+
value: "details",
|
|
36534
|
+
className: "max-w-[200px] truncate",
|
|
36535
|
+
children: "Details"
|
|
36536
|
+
}
|
|
36537
|
+
),
|
|
36538
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
36539
|
+
ui.ProgressTabs.Trigger,
|
|
36540
|
+
{
|
|
36541
|
+
status: tabState[
|
|
36542
|
+
"prices"
|
|
36543
|
+
/* PRICES */
|
|
36544
|
+
],
|
|
36545
|
+
value: "prices",
|
|
36546
|
+
className: "max-w-[200px] truncate",
|
|
36547
|
+
children: "Prices"
|
|
36548
|
+
}
|
|
36549
|
+
)
|
|
36550
|
+
] }) }) }),
|
|
36551
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteFocusModal.Body, { className: "size-full overflow-hidden", children: [
|
|
36552
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
36553
|
+
ui.ProgressTabs.Content,
|
|
36554
|
+
{
|
|
36555
|
+
className: "size-full overflow-y-auto",
|
|
36556
|
+
value: "details",
|
|
36557
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(GiftCardProductCreateDetailsForm, { form })
|
|
36558
|
+
}
|
|
36559
|
+
),
|
|
36560
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
36561
|
+
ui.ProgressTabs.Content,
|
|
36562
|
+
{
|
|
36563
|
+
className: "size-full overflow-y-auto",
|
|
36564
|
+
value: "prices",
|
|
36565
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
36566
|
+
GiftCardProductCreateDenominationsForm,
|
|
36567
|
+
{
|
|
36568
|
+
form,
|
|
36569
|
+
store,
|
|
36570
|
+
regions,
|
|
36571
|
+
pricePreferences
|
|
36572
|
+
}
|
|
36573
|
+
)
|
|
36574
|
+
}
|
|
36575
|
+
)
|
|
36576
|
+
] })
|
|
36577
|
+
]
|
|
36578
|
+
}
|
|
36579
|
+
),
|
|
36580
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
36581
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", size: "small", children: "Cancel" }) }),
|
|
36582
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
36583
|
+
ui.Button,
|
|
36584
|
+
{
|
|
36585
|
+
"data-name": SAVE_DRAFT_BUTTON,
|
|
36586
|
+
size: "small",
|
|
36587
|
+
type: "submit",
|
|
36588
|
+
isLoading: isPending,
|
|
36589
|
+
className: "whitespace-nowrap",
|
|
36590
|
+
children: "Save as draft"
|
|
36591
|
+
}
|
|
36592
|
+
),
|
|
36593
|
+
/* @__PURE__ */ jsxRuntime.jsx(PrimaryButton, { tab, next: onNext, isLoading: isPending })
|
|
36594
|
+
] }) })
|
|
36595
|
+
]
|
|
36596
|
+
}
|
|
36597
|
+
) });
|
|
36598
|
+
};
|
|
36599
|
+
const PrimaryButton = ({ tab, next, isLoading }) => {
|
|
36600
|
+
if (tab === "prices") {
|
|
36601
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
36602
|
+
ui.Button,
|
|
36574
36603
|
{
|
|
36575
|
-
data:
|
|
36576
|
-
|
|
36577
|
-
|
|
36578
|
-
|
|
36579
|
-
rowCount: count2,
|
|
36580
|
-
pageSize: PAGE_SIZE$2,
|
|
36581
|
-
getRowId: (row) => row.id,
|
|
36582
|
-
rowSelection: {
|
|
36583
|
-
state: rowSelection,
|
|
36584
|
-
onRowSelectionChange
|
|
36585
|
-
},
|
|
36604
|
+
"data-name": "publish-button",
|
|
36605
|
+
type: "submit",
|
|
36606
|
+
variant: "primary",
|
|
36607
|
+
size: "small",
|
|
36586
36608
|
isLoading,
|
|
36587
|
-
|
|
36588
|
-
|
|
36609
|
+
children: "Publish"
|
|
36610
|
+
},
|
|
36611
|
+
"submit-button"
|
|
36612
|
+
);
|
|
36613
|
+
}
|
|
36614
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
36615
|
+
ui.Button,
|
|
36616
|
+
{
|
|
36617
|
+
type: "button",
|
|
36618
|
+
variant: "primary",
|
|
36619
|
+
size: "small",
|
|
36620
|
+
onClick: () => next(tab),
|
|
36621
|
+
children: "Continue"
|
|
36622
|
+
},
|
|
36623
|
+
"next-button"
|
|
36624
|
+
);
|
|
36625
|
+
};
|
|
36626
|
+
const GiftCardProductCreate = () => {
|
|
36627
|
+
const {
|
|
36628
|
+
store,
|
|
36629
|
+
isPending: isStorePending,
|
|
36630
|
+
isError: isStoreError,
|
|
36631
|
+
error: storeError
|
|
36632
|
+
} = useStore$2({
|
|
36633
|
+
fields: "+default_sales_channel"
|
|
36634
|
+
});
|
|
36635
|
+
const {
|
|
36636
|
+
sales_channel,
|
|
36637
|
+
isPending: isSalesChannelPending,
|
|
36638
|
+
isError: isSalesChannelError,
|
|
36639
|
+
error: salesChannelError
|
|
36640
|
+
} = useSalesChannel(store == null ? void 0 : store.default_sales_channel_id, {
|
|
36641
|
+
enabled: !!(store == null ? void 0 : store.default_sales_channel_id)
|
|
36642
|
+
});
|
|
36643
|
+
const {
|
|
36644
|
+
regions,
|
|
36645
|
+
isPending: isRegionsPending,
|
|
36646
|
+
isError: isRegionsError,
|
|
36647
|
+
error: regionsError
|
|
36648
|
+
} = useRegions({ limit: 9999 });
|
|
36649
|
+
const {
|
|
36650
|
+
price_preferences,
|
|
36651
|
+
isPending: isPricePreferencesPending,
|
|
36652
|
+
isError: isPricePreferencesError,
|
|
36653
|
+
error: pricePreferencesError
|
|
36654
|
+
} = usePricePreferences({
|
|
36655
|
+
limit: 9999
|
|
36656
|
+
});
|
|
36657
|
+
const ready = !!store && !isStorePending && !!regions && !isRegionsPending && !!sales_channel && !isSalesChannelPending && !!price_preferences && !isPricePreferencesPending;
|
|
36658
|
+
if (isStoreError) {
|
|
36659
|
+
throw storeError;
|
|
36660
|
+
}
|
|
36661
|
+
if (isRegionsError) {
|
|
36662
|
+
throw regionsError;
|
|
36663
|
+
}
|
|
36664
|
+
if (isSalesChannelError) {
|
|
36665
|
+
throw salesChannelError;
|
|
36666
|
+
}
|
|
36667
|
+
if (isPricePreferencesError) {
|
|
36668
|
+
throw pricePreferencesError;
|
|
36669
|
+
}
|
|
36670
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteFocusModal, { children: [
|
|
36671
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Create Gift Card Product" }) }),
|
|
36672
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Create a new gift card product" }) }),
|
|
36673
|
+
ready && /* @__PURE__ */ jsxRuntime.jsx(
|
|
36674
|
+
GiftCardProductCreateForm,
|
|
36675
|
+
{
|
|
36676
|
+
defaultChannel: sales_channel,
|
|
36677
|
+
store,
|
|
36678
|
+
pricePreferences: price_preferences,
|
|
36679
|
+
regions
|
|
36589
36680
|
}
|
|
36590
|
-
)
|
|
36591
|
-
/* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
36592
|
-
/* @__PURE__ */ jsxRuntime.jsx(StackedFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", type: "button", children: "Cancel" }) }),
|
|
36593
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", onClick: handleAdd, type: "button", children: "Save" })
|
|
36594
|
-
] }) })
|
|
36681
|
+
)
|
|
36595
36682
|
] });
|
|
36596
36683
|
};
|
|
36597
|
-
const
|
|
36598
|
-
|
|
36599
|
-
|
|
36600
|
-
|
|
36684
|
+
const StoreCreditAccountBalanceSection = ({
|
|
36685
|
+
storeCreditAccount
|
|
36686
|
+
}) => {
|
|
36687
|
+
if (!storeCreditAccount || typeof storeCreditAccount.balance === "undefined") {
|
|
36688
|
+
return;
|
|
36689
|
+
}
|
|
36690
|
+
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: [
|
|
36691
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-ui-tag-green-icon h-8 w-1 rounded-full" }),
|
|
36692
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
36693
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", size: "small", className: "text-ui-fg-subtle", children: "Current Balance" }),
|
|
36694
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
36695
|
+
ui.Text,
|
|
36696
|
+
{
|
|
36697
|
+
weight: "plus",
|
|
36698
|
+
size: "xlarge",
|
|
36699
|
+
className: "tabular-nums text-ui-fg-base",
|
|
36700
|
+
children: formatAmount(
|
|
36701
|
+
storeCreditAccount.balance,
|
|
36702
|
+
storeCreditAccount.currency_code
|
|
36703
|
+
)
|
|
36704
|
+
}
|
|
36705
|
+
)
|
|
36706
|
+
] })
|
|
36707
|
+
] }) });
|
|
36601
36708
|
};
|
|
36602
|
-
const
|
|
36603
|
-
|
|
36709
|
+
const StoreCreditAccountDetailsSection = ({
|
|
36710
|
+
storeCreditAccount
|
|
36604
36711
|
}) => {
|
|
36605
|
-
|
|
36606
|
-
|
|
36607
|
-
|
|
36712
|
+
if (!storeCreditAccount || typeof storeCreditAccount.balance === "undefined") {
|
|
36713
|
+
return;
|
|
36714
|
+
}
|
|
36715
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "flex justify-between gap-x-2 px-6 py-6", children: [
|
|
36716
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
36717
|
+
ui.Text,
|
|
36718
|
+
{
|
|
36719
|
+
weight: "plus",
|
|
36720
|
+
size: "xlarge",
|
|
36721
|
+
className: "text-ui-fg-base flex gap-x-4",
|
|
36722
|
+
children: [
|
|
36723
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
36724
|
+
/* @__PURE__ */ jsxRuntime.jsx(CreditCardIcon, { className: "inline" }),
|
|
36725
|
+
" "
|
|
36726
|
+
] }),
|
|
36727
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
36728
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-ui-fg-subtle", children: [
|
|
36729
|
+
storeCreditAccount.currency_code.toUpperCase(),
|
|
36730
|
+
" Account"
|
|
36731
|
+
] }),
|
|
36732
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-base", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
36733
|
+
ui.Text,
|
|
36734
|
+
{
|
|
36735
|
+
weight: "regular",
|
|
36736
|
+
size: "small",
|
|
36737
|
+
className: "text-ui-fg-base flex gap-x-4",
|
|
36738
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(DisplayId, { id: storeCreditAccount.id })
|
|
36739
|
+
}
|
|
36740
|
+
) })
|
|
36741
|
+
] })
|
|
36742
|
+
]
|
|
36743
|
+
}
|
|
36744
|
+
),
|
|
36745
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-x-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
36746
|
+
ActionMenu,
|
|
36747
|
+
{
|
|
36748
|
+
groups: [
|
|
36749
|
+
{
|
|
36750
|
+
actions: [
|
|
36751
|
+
{
|
|
36752
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CreditCard, {}),
|
|
36753
|
+
label: "Credit the account",
|
|
36754
|
+
to: "credit"
|
|
36755
|
+
}
|
|
36756
|
+
]
|
|
36757
|
+
}
|
|
36758
|
+
]
|
|
36759
|
+
}
|
|
36760
|
+
) })
|
|
36608
36761
|
] });
|
|
36609
36762
|
};
|
|
36610
|
-
|
|
36611
|
-
|
|
36612
|
-
})
|
|
36613
|
-
|
|
36614
|
-
|
|
36615
|
-
|
|
36616
|
-
|
|
36617
|
-
|
|
36618
|
-
|
|
36619
|
-
|
|
36620
|
-
|
|
36621
|
-
|
|
36763
|
+
function StoreCreditAccountCustomerSection({
|
|
36764
|
+
customerId
|
|
36765
|
+
}) {
|
|
36766
|
+
const { customer, isPending } = useCustomer(customerId, void 0, {
|
|
36767
|
+
enabled: !!customerId
|
|
36768
|
+
});
|
|
36769
|
+
if (isPending || !customer) {
|
|
36770
|
+
return null;
|
|
36771
|
+
}
|
|
36772
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0", children: [
|
|
36773
|
+
/* @__PURE__ */ jsxRuntime.jsx(Header$5, { title: "Customer" }),
|
|
36774
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
36775
|
+
SidebarLink,
|
|
36776
|
+
{
|
|
36777
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(icons.User, {}),
|
|
36778
|
+
labelKey: customer.email || "N/A",
|
|
36779
|
+
descriptionKey: !customer.first_name && !customer.last_name ? "N/A" : `${customer.first_name} ${customer.last_name}`,
|
|
36780
|
+
to: `/customers/${customer.id}`
|
|
36781
|
+
},
|
|
36782
|
+
customer.id
|
|
36783
|
+
)
|
|
36784
|
+
] });
|
|
36785
|
+
}
|
|
36786
|
+
function StoreCreditAccountCodeSection({ code }) {
|
|
36787
|
+
if (!code) {
|
|
36788
|
+
return null;
|
|
36789
|
+
}
|
|
36790
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "p-0", children: [
|
|
36791
|
+
/* @__PURE__ */ jsxRuntime.jsx(Header$5, { title: "Account Code" }),
|
|
36792
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-x-4 px-6 mb-2", children: [
|
|
36793
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.Share, { className: "inline" }),
|
|
36794
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ui-fg-subtle text-sm", children: code })
|
|
36622
36795
|
] })
|
|
36623
|
-
] })
|
|
36796
|
+
] });
|
|
36797
|
+
}
|
|
36798
|
+
const StoreCreditAccountPage = () => {
|
|
36799
|
+
const { id } = reactRouterDom.useParams();
|
|
36800
|
+
const { store_credit_account: storeCreditAccount } = useStoreCreditAccount(
|
|
36801
|
+
id
|
|
36802
|
+
);
|
|
36803
|
+
if (!storeCreditAccount) {
|
|
36804
|
+
return;
|
|
36805
|
+
}
|
|
36806
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
36807
|
+
TwoColumnLayout,
|
|
36808
|
+
{
|
|
36809
|
+
firstCol: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
36810
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
36811
|
+
StoreCreditAccountDetailsSection,
|
|
36812
|
+
{
|
|
36813
|
+
storeCreditAccount
|
|
36814
|
+
}
|
|
36815
|
+
),
|
|
36816
|
+
/* @__PURE__ */ jsxRuntime.jsx(TransactionsTable, { id: storeCreditAccount.id })
|
|
36817
|
+
] }),
|
|
36818
|
+
secondCol: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
36819
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
36820
|
+
StoreCreditAccountBalanceSection,
|
|
36821
|
+
{
|
|
36822
|
+
storeCreditAccount
|
|
36823
|
+
}
|
|
36824
|
+
),
|
|
36825
|
+
/* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountCodeSection, { code: storeCreditAccount.code }),
|
|
36826
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
36827
|
+
StoreCreditAccountCustomerSection,
|
|
36828
|
+
{
|
|
36829
|
+
customerId: storeCreditAccount.customer_id
|
|
36830
|
+
}
|
|
36831
|
+
)
|
|
36832
|
+
] })
|
|
36833
|
+
}
|
|
36834
|
+
) });
|
|
36624
36835
|
};
|
|
36625
|
-
const
|
|
36626
|
-
|
|
36836
|
+
const Note = () => {
|
|
36837
|
+
const { id } = reactRouterDom.useParams();
|
|
36838
|
+
const {
|
|
36839
|
+
store_credit_account: storeCreditAccount,
|
|
36840
|
+
isPending,
|
|
36841
|
+
isError,
|
|
36842
|
+
error
|
|
36843
|
+
} = useStoreCreditAccount(id, {});
|
|
36844
|
+
if (isError) {
|
|
36845
|
+
throw error;
|
|
36846
|
+
}
|
|
36847
|
+
const isReady = !isPending && !!storeCreditAccount;
|
|
36848
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
36849
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
36850
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Credit store credit account" }) }),
|
|
36851
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Credit the store credit account" }) })
|
|
36852
|
+
] }),
|
|
36853
|
+
isReady && /* @__PURE__ */ jsxRuntime.jsx(StoreCreditAccountCreditForm, { storeCreditAccount })
|
|
36854
|
+
] });
|
|
36627
36855
|
};
|
|
36628
|
-
const
|
|
36629
|
-
|
|
36630
|
-
defaultChannel,
|
|
36631
|
-
regions,
|
|
36632
|
-
store,
|
|
36633
|
-
pricePreferences
|
|
36856
|
+
const StoreCreditAccountCreditForm = ({
|
|
36857
|
+
storeCreditAccount
|
|
36634
36858
|
}) => {
|
|
36635
|
-
const [tab, setTab] = React.useState(
|
|
36636
|
-
"details"
|
|
36637
|
-
/* DETAILS */
|
|
36638
|
-
);
|
|
36639
|
-
const [tabState, setTabState] = React.useState({
|
|
36640
|
-
[
|
|
36641
|
-
"details"
|
|
36642
|
-
/* DETAILS */
|
|
36643
|
-
]: "in-progress",
|
|
36644
|
-
[
|
|
36645
|
-
"prices"
|
|
36646
|
-
/* PRICES */
|
|
36647
|
-
]: "not-started"
|
|
36648
|
-
});
|
|
36649
|
-
const { handleSuccess } = useRouteModal();
|
|
36650
36859
|
const form = useForm({
|
|
36651
36860
|
defaultValues: {
|
|
36652
|
-
|
|
36653
|
-
|
|
36861
|
+
amount: {
|
|
36862
|
+
float: 0,
|
|
36863
|
+
value: ""
|
|
36864
|
+
},
|
|
36865
|
+
note: ""
|
|
36654
36866
|
},
|
|
36655
|
-
resolver: t(
|
|
36867
|
+
resolver: t(schema)
|
|
36656
36868
|
});
|
|
36657
|
-
const { mutateAsync, isPending } =
|
|
36658
|
-
|
|
36659
|
-
|
|
36660
|
-
|
|
36661
|
-
|
|
36662
|
-
|
|
36663
|
-
|
|
36664
|
-
return
|
|
36665
|
-
}, {});
|
|
36666
|
-
}, [regions]);
|
|
36667
|
-
const handleSubmit = form.handleSubmit(async (values, e2) => {
|
|
36668
|
-
var _a;
|
|
36669
|
-
let isDraftSubmission = false;
|
|
36670
|
-
if ((e2 == null ? void 0 : e2.nativeEvent) instanceof SubmitEvent) {
|
|
36671
|
-
const submitter = (_a = e2 == null ? void 0 : e2.nativeEvent) == null ? void 0 : _a.submitter;
|
|
36672
|
-
isDraftSubmission = submitter.dataset.name === SAVE_DRAFT_BUTTON;
|
|
36673
|
-
}
|
|
36674
|
-
const media = values.media || [];
|
|
36675
|
-
const payload = { ...values, media: void 0 };
|
|
36676
|
-
let uploadedMedia = [];
|
|
36677
|
-
try {
|
|
36678
|
-
if (media.length) {
|
|
36679
|
-
const thumbnailReq = media.find((m) => m.isThumbnail);
|
|
36680
|
-
const otherMediaReq = media.filter((m) => !m.isThumbnail);
|
|
36681
|
-
const fileReqs = [];
|
|
36682
|
-
if (thumbnailReq) {
|
|
36683
|
-
fileReqs.push(
|
|
36684
|
-
sdk.admin.upload.create({ files: [thumbnailReq.file] }).then((r) => r.files.map((f2) => ({ ...f2, isThumbnail: true })))
|
|
36685
|
-
);
|
|
36686
|
-
}
|
|
36687
|
-
if (otherMediaReq == null ? void 0 : otherMediaReq.length) {
|
|
36688
|
-
fileReqs.push(
|
|
36689
|
-
sdk.admin.upload.create({
|
|
36690
|
-
files: otherMediaReq.map((m) => m.file)
|
|
36691
|
-
}).then((r) => r.files.map((f2) => ({ ...f2, isThumbnail: false })))
|
|
36692
|
-
);
|
|
36693
|
-
}
|
|
36694
|
-
uploadedMedia = (await Promise.all(fileReqs)).flat();
|
|
36695
|
-
}
|
|
36696
|
-
} catch (error) {
|
|
36697
|
-
if (error instanceof Error) {
|
|
36698
|
-
ui.toast.error(error.message);
|
|
36699
|
-
}
|
|
36869
|
+
const { mutateAsync, isPending } = useCreditStoreCreditAccount(
|
|
36870
|
+
storeCreditAccount.id
|
|
36871
|
+
);
|
|
36872
|
+
const { handleSuccess } = useRouteModal();
|
|
36873
|
+
const onSubmit = form.handleSubmit(async (data) => {
|
|
36874
|
+
if (data.amount.float <= 0) {
|
|
36875
|
+
form.setError("amount", { message: "Amount must be greater than 0" });
|
|
36876
|
+
return;
|
|
36700
36877
|
}
|
|
36701
36878
|
await mutateAsync(
|
|
36702
|
-
|
|
36703
|
-
...payload,
|
|
36704
|
-
media: uploadedMedia,
|
|
36705
|
-
status: isDraftSubmission ? "draft" : "published",
|
|
36706
|
-
regionsCurrencyMap
|
|
36707
|
-
}),
|
|
36879
|
+
{ amount: data.amount.float, note: data.note },
|
|
36708
36880
|
{
|
|
36709
|
-
onSuccess: (
|
|
36710
|
-
|
|
36711
|
-
`Product ${data.product.title} was successfully created.`
|
|
36712
|
-
);
|
|
36713
|
-
handleSuccess(`../${data.product.id}`);
|
|
36714
|
-
},
|
|
36715
|
-
onError: (error) => {
|
|
36716
|
-
ui.toast.error(error.message);
|
|
36717
|
-
}
|
|
36881
|
+
onSuccess: () => handleSuccess(),
|
|
36882
|
+
onError: (error) => ui.toast.error(error.message)
|
|
36718
36883
|
}
|
|
36719
36884
|
);
|
|
36720
36885
|
});
|
|
36721
|
-
|
|
36722
|
-
const valid = await form.trigger();
|
|
36723
|
-
if (!valid) {
|
|
36724
|
-
return;
|
|
36725
|
-
}
|
|
36726
|
-
if (currentTab === "details") {
|
|
36727
|
-
setTab(
|
|
36728
|
-
"prices"
|
|
36729
|
-
/* PRICES */
|
|
36730
|
-
);
|
|
36731
|
-
}
|
|
36732
|
-
};
|
|
36733
|
-
React.useEffect(() => {
|
|
36734
|
-
const currentState = { ...tabState };
|
|
36735
|
-
if (tab === "details") {
|
|
36736
|
-
currentState[
|
|
36737
|
-
"details"
|
|
36738
|
-
/* DETAILS */
|
|
36739
|
-
] = "in-progress";
|
|
36740
|
-
}
|
|
36741
|
-
if (tab === "prices") {
|
|
36742
|
-
currentState[
|
|
36743
|
-
"details"
|
|
36744
|
-
/* DETAILS */
|
|
36745
|
-
] = "completed";
|
|
36746
|
-
currentState[
|
|
36747
|
-
"prices"
|
|
36748
|
-
/* PRICES */
|
|
36749
|
-
] = "in-progress";
|
|
36750
|
-
}
|
|
36751
|
-
setTabState({ ...currentState });
|
|
36752
|
-
}, [tab]);
|
|
36753
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
36886
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
36754
36887
|
KeyboundForm,
|
|
36755
36888
|
{
|
|
36756
|
-
|
|
36757
|
-
|
|
36758
|
-
if (e2.target instanceof HTMLTextAreaElement && !(e2.metaKey || e2.ctrlKey)) {
|
|
36759
|
-
return;
|
|
36760
|
-
}
|
|
36761
|
-
e2.preventDefault();
|
|
36762
|
-
if (e2.metaKey || e2.ctrlKey) {
|
|
36763
|
-
if (tab !== "prices") {
|
|
36764
|
-
e2.preventDefault();
|
|
36765
|
-
e2.stopPropagation();
|
|
36766
|
-
onNext(tab);
|
|
36767
|
-
return;
|
|
36768
|
-
}
|
|
36769
|
-
handleSubmit();
|
|
36770
|
-
}
|
|
36771
|
-
}
|
|
36772
|
-
},
|
|
36773
|
-
onSubmit: handleSubmit,
|
|
36774
|
-
className: "flex h-full flex-col",
|
|
36889
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
36890
|
+
onSubmit,
|
|
36775
36891
|
children: [
|
|
36776
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
36777
|
-
|
|
36778
|
-
|
|
36779
|
-
|
|
36780
|
-
|
|
36781
|
-
|
|
36782
|
-
|
|
36783
|
-
|
|
36784
|
-
|
|
36785
|
-
|
|
36786
|
-
|
|
36787
|
-
|
|
36788
|
-
|
|
36789
|
-
|
|
36790
|
-
|
|
36791
|
-
|
|
36792
|
-
|
|
36793
|
-
|
|
36794
|
-
|
|
36795
|
-
|
|
36796
|
-
],
|
|
36797
|
-
|
|
36798
|
-
className: "max-w-[200px] truncate",
|
|
36799
|
-
children: "Details"
|
|
36800
|
-
}
|
|
36801
|
-
),
|
|
36802
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
36803
|
-
ui.ProgressTabs.Trigger,
|
|
36804
|
-
{
|
|
36805
|
-
status: tabState[
|
|
36806
|
-
"prices"
|
|
36807
|
-
/* PRICES */
|
|
36808
|
-
],
|
|
36809
|
-
value: "prices",
|
|
36810
|
-
className: "max-w-[200px] truncate",
|
|
36811
|
-
children: "Prices"
|
|
36812
|
-
}
|
|
36813
|
-
)
|
|
36814
|
-
] }) }) }),
|
|
36815
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteFocusModal.Body, { className: "size-full overflow-hidden", children: [
|
|
36816
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
36817
|
-
ui.ProgressTabs.Content,
|
|
36818
|
-
{
|
|
36819
|
-
className: "size-full overflow-y-auto",
|
|
36820
|
-
value: "details",
|
|
36821
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(GiftCardProductCreateDetailsForm, { form })
|
|
36822
|
-
}
|
|
36823
|
-
),
|
|
36824
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
36825
|
-
ui.ProgressTabs.Content,
|
|
36826
|
-
{
|
|
36827
|
-
className: "size-full overflow-y-auto",
|
|
36828
|
-
value: "prices",
|
|
36829
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
36830
|
-
GiftCardProductCreateDenominationsForm,
|
|
36831
|
-
{
|
|
36832
|
-
form,
|
|
36833
|
-
store,
|
|
36834
|
-
regions,
|
|
36835
|
-
pricePreferences
|
|
36836
|
-
}
|
|
36837
|
-
)
|
|
36892
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Body, { className: "flex flex-col gap-y-6 overflow-y-auto", children: [
|
|
36893
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
36894
|
+
Form$2.Field,
|
|
36895
|
+
{
|
|
36896
|
+
control: form.control,
|
|
36897
|
+
name: "amount",
|
|
36898
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
36899
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Amount" }),
|
|
36900
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
36901
|
+
ui.CurrencyInput,
|
|
36902
|
+
{
|
|
36903
|
+
min: 0,
|
|
36904
|
+
placeholder: "0",
|
|
36905
|
+
value: field.value.value,
|
|
36906
|
+
onValueChange: (_value, _name, values) => {
|
|
36907
|
+
field.onChange({
|
|
36908
|
+
value: values == null ? void 0 : values.value,
|
|
36909
|
+
float: (values == null ? void 0 : values.float) || null
|
|
36910
|
+
});
|
|
36911
|
+
},
|
|
36912
|
+
symbol: currencies[storeCreditAccount.currency_code.toUpperCase()].symbol_native,
|
|
36913
|
+
code: storeCreditAccount.currency_code.toUpperCase()
|
|
36838
36914
|
}
|
|
36839
|
-
)
|
|
36915
|
+
) }),
|
|
36916
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
36840
36917
|
] })
|
|
36841
|
-
|
|
36842
|
-
|
|
36843
|
-
),
|
|
36844
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
36845
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", size: "small", children: "Cancel" }) }),
|
|
36918
|
+
}
|
|
36919
|
+
),
|
|
36846
36920
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
36847
|
-
|
|
36921
|
+
Form$2.Field,
|
|
36848
36922
|
{
|
|
36849
|
-
|
|
36850
|
-
|
|
36851
|
-
|
|
36852
|
-
|
|
36853
|
-
|
|
36854
|
-
|
|
36923
|
+
control: form.control,
|
|
36924
|
+
name: "note",
|
|
36925
|
+
render: ({ field }) => /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { children: [
|
|
36926
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Label, { children: "Note" }),
|
|
36927
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Textarea, { ...field }) }),
|
|
36928
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
36929
|
+
] })
|
|
36855
36930
|
}
|
|
36856
|
-
)
|
|
36857
|
-
|
|
36931
|
+
)
|
|
36932
|
+
] }),
|
|
36933
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
36934
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
36935
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
36858
36936
|
] }) })
|
|
36859
36937
|
]
|
|
36860
36938
|
}
|
|
36861
36939
|
) });
|
|
36862
36940
|
};
|
|
36863
|
-
const
|
|
36864
|
-
|
|
36865
|
-
|
|
36866
|
-
|
|
36867
|
-
|
|
36868
|
-
|
|
36869
|
-
|
|
36870
|
-
variant: "primary",
|
|
36871
|
-
size: "small",
|
|
36872
|
-
isLoading,
|
|
36873
|
-
children: "Publish"
|
|
36874
|
-
},
|
|
36875
|
-
"submit-button"
|
|
36876
|
-
);
|
|
36877
|
-
}
|
|
36878
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
36879
|
-
ui.Button,
|
|
36880
|
-
{
|
|
36881
|
-
type: "button",
|
|
36882
|
-
variant: "primary",
|
|
36883
|
-
size: "small",
|
|
36884
|
-
onClick: () => next(tab),
|
|
36885
|
-
children: "Continue"
|
|
36886
|
-
},
|
|
36887
|
-
"next-button"
|
|
36888
|
-
);
|
|
36889
|
-
};
|
|
36890
|
-
const GiftCardProductCreate = () => {
|
|
36891
|
-
const {
|
|
36892
|
-
store,
|
|
36893
|
-
isPending: isStorePending,
|
|
36894
|
-
isError: isStoreError,
|
|
36895
|
-
error: storeError
|
|
36896
|
-
} = useStore$2({
|
|
36897
|
-
fields: "+default_sales_channel"
|
|
36898
|
-
});
|
|
36899
|
-
const {
|
|
36900
|
-
sales_channel,
|
|
36901
|
-
isPending: isSalesChannelPending,
|
|
36902
|
-
isError: isSalesChannelError,
|
|
36903
|
-
error: salesChannelError
|
|
36904
|
-
} = useSalesChannel(store == null ? void 0 : store.default_sales_channel_id, {
|
|
36905
|
-
enabled: !!(store == null ? void 0 : store.default_sales_channel_id)
|
|
36906
|
-
});
|
|
36907
|
-
const {
|
|
36908
|
-
regions,
|
|
36909
|
-
isPending: isRegionsPending,
|
|
36910
|
-
isError: isRegionsError,
|
|
36911
|
-
error: regionsError
|
|
36912
|
-
} = useRegions({ limit: 9999 });
|
|
36913
|
-
const {
|
|
36914
|
-
price_preferences,
|
|
36915
|
-
isPending: isPricePreferencesPending,
|
|
36916
|
-
isError: isPricePreferencesError,
|
|
36917
|
-
error: pricePreferencesError
|
|
36918
|
-
} = usePricePreferences({
|
|
36919
|
-
limit: 9999
|
|
36920
|
-
});
|
|
36921
|
-
const ready = !!store && !isStorePending && !!regions && !isRegionsPending && !!sales_channel && !isSalesChannelPending && !!price_preferences && !isPricePreferencesPending;
|
|
36922
|
-
if (isStoreError) {
|
|
36923
|
-
throw storeError;
|
|
36924
|
-
}
|
|
36925
|
-
if (isRegionsError) {
|
|
36926
|
-
throw regionsError;
|
|
36927
|
-
}
|
|
36928
|
-
if (isSalesChannelError) {
|
|
36929
|
-
throw salesChannelError;
|
|
36930
|
-
}
|
|
36931
|
-
if (isPricePreferencesError) {
|
|
36932
|
-
throw pricePreferencesError;
|
|
36933
|
-
}
|
|
36934
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteFocusModal, { children: [
|
|
36935
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Create Gift Card Product" }) }),
|
|
36936
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteFocusModal.Description, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Create a new gift card product" }) }),
|
|
36937
|
-
ready && /* @__PURE__ */ jsxRuntime.jsx(
|
|
36938
|
-
GiftCardProductCreateForm,
|
|
36939
|
-
{
|
|
36940
|
-
defaultChannel: sales_channel,
|
|
36941
|
-
store,
|
|
36942
|
-
pricePreferences: price_preferences,
|
|
36943
|
-
regions
|
|
36944
|
-
}
|
|
36945
|
-
)
|
|
36946
|
-
] });
|
|
36947
|
-
};
|
|
36941
|
+
const schema = objectType({
|
|
36942
|
+
note: stringType(),
|
|
36943
|
+
amount: objectType({
|
|
36944
|
+
float: numberType(),
|
|
36945
|
+
value: stringType()
|
|
36946
|
+
})
|
|
36947
|
+
});
|
|
36948
36948
|
const productStatusColor = (status) => {
|
|
36949
36949
|
switch (status) {
|
|
36950
36950
|
case "draft":
|
|
@@ -37392,34 +37392,181 @@ const useFilters = () => {
|
|
|
37392
37392
|
return [];
|
|
37393
37393
|
}, [dateFilters]);
|
|
37394
37394
|
};
|
|
37395
|
-
const ProductDetail = () => {
|
|
37395
|
+
const ProductDetail = () => {
|
|
37396
|
+
const { id } = reactRouterDom.useParams();
|
|
37397
|
+
const { product, isLoading, isError, error } = useProduct(id);
|
|
37398
|
+
if (isLoading || !product) {
|
|
37399
|
+
return;
|
|
37400
|
+
}
|
|
37401
|
+
if (isError) {
|
|
37402
|
+
throw error;
|
|
37403
|
+
}
|
|
37404
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
37405
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
37406
|
+
TwoColumnLayout,
|
|
37407
|
+
{
|
|
37408
|
+
firstCol: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
37409
|
+
/* @__PURE__ */ jsxRuntime.jsx(ProductGeneralSection, { product }),
|
|
37410
|
+
/* @__PURE__ */ jsxRuntime.jsx(ProductVariantSection, { product }),
|
|
37411
|
+
/* @__PURE__ */ jsxRuntime.jsx(JsonViewSection, { data: product })
|
|
37412
|
+
] }),
|
|
37413
|
+
secondCol: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
37414
|
+
/* @__PURE__ */ jsxRuntime.jsx(ProductSalesChannelSection, { product }),
|
|
37415
|
+
/* @__PURE__ */ jsxRuntime.jsx(ProductMediaSection, { product })
|
|
37416
|
+
] })
|
|
37417
|
+
}
|
|
37418
|
+
),
|
|
37419
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
37420
|
+
] });
|
|
37421
|
+
};
|
|
37422
|
+
const EditProductSchema$1 = objectType({
|
|
37423
|
+
denominations: arrayType(
|
|
37424
|
+
objectType({
|
|
37425
|
+
id: stringType().optional(),
|
|
37426
|
+
value: stringType().min(1),
|
|
37427
|
+
prices: recordType(stringType(), optionalFloat).optional()
|
|
37428
|
+
})
|
|
37429
|
+
).min(1)
|
|
37430
|
+
});
|
|
37431
|
+
const GiftCardProductEditDenominationsForm = ({
|
|
37432
|
+
product
|
|
37433
|
+
}) => {
|
|
37434
|
+
var _a;
|
|
37435
|
+
const { handleSuccess } = useRouteModal();
|
|
37436
|
+
const form = useForm({
|
|
37437
|
+
defaultValues: {
|
|
37438
|
+
denominations: (_a = product.variants) == null ? void 0 : _a.map((variant) => ({
|
|
37439
|
+
id: variant.id,
|
|
37440
|
+
value: variant.title
|
|
37441
|
+
}))
|
|
37442
|
+
},
|
|
37443
|
+
resolver: t(EditProductSchema$1)
|
|
37444
|
+
});
|
|
37445
|
+
const { mutateAsync, isPending } = useUpdateProduct(product.id);
|
|
37446
|
+
const handleSubmit = form.handleSubmit(async (data) => {
|
|
37447
|
+
const optionValues = data.denominations.map(
|
|
37448
|
+
(denomination) => denomination.value
|
|
37449
|
+
);
|
|
37450
|
+
const options = [
|
|
37451
|
+
{
|
|
37452
|
+
title: "denomination",
|
|
37453
|
+
values: optionValues
|
|
37454
|
+
}
|
|
37455
|
+
];
|
|
37456
|
+
await mutateAsync(
|
|
37457
|
+
{
|
|
37458
|
+
options,
|
|
37459
|
+
variants: data.denominations.map((denomination) => ({
|
|
37460
|
+
id: denomination.id,
|
|
37461
|
+
title: denomination.value,
|
|
37462
|
+
manage_inventory: false,
|
|
37463
|
+
options: {
|
|
37464
|
+
denomination: denomination.value
|
|
37465
|
+
}
|
|
37466
|
+
}))
|
|
37467
|
+
},
|
|
37468
|
+
{
|
|
37469
|
+
onSuccess: () => {
|
|
37470
|
+
ui.toast.success(`Denominations updated successfully`);
|
|
37471
|
+
handleSuccess();
|
|
37472
|
+
},
|
|
37473
|
+
onError: (e2) => {
|
|
37474
|
+
ui.toast.error(e2.message);
|
|
37475
|
+
}
|
|
37476
|
+
}
|
|
37477
|
+
);
|
|
37478
|
+
});
|
|
37479
|
+
const {
|
|
37480
|
+
fields: denominationsFields,
|
|
37481
|
+
append: addDenomination,
|
|
37482
|
+
remove: removeDenomination
|
|
37483
|
+
} = useFieldArray({
|
|
37484
|
+
name: "denominations",
|
|
37485
|
+
control: form.control
|
|
37486
|
+
});
|
|
37487
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
37488
|
+
KeyboundForm,
|
|
37489
|
+
{
|
|
37490
|
+
onSubmit: handleSubmit,
|
|
37491
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
37492
|
+
children: [
|
|
37493
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-y-6", children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
37494
|
+
denominationsFields.map((denominationField, index) => {
|
|
37495
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
37496
|
+
"div",
|
|
37497
|
+
{
|
|
37498
|
+
className: "flex items-center justify-between shadow-elevation-card-rest bg-ui-bg-component transition-fg rounded-md px-4 py-2",
|
|
37499
|
+
children: [
|
|
37500
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
37501
|
+
Form$2.Field,
|
|
37502
|
+
{
|
|
37503
|
+
control: form.control,
|
|
37504
|
+
name: `denominations.${index}.value`,
|
|
37505
|
+
render: ({ field }) => {
|
|
37506
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { className: "w-full", children: [
|
|
37507
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field, placeholder: "100" }) }),
|
|
37508
|
+
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
37509
|
+
] });
|
|
37510
|
+
}
|
|
37511
|
+
},
|
|
37512
|
+
denominationField.id
|
|
37513
|
+
),
|
|
37514
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center rounded-xl", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
37515
|
+
ui.Button,
|
|
37516
|
+
{
|
|
37517
|
+
size: "small",
|
|
37518
|
+
variant: "secondary",
|
|
37519
|
+
type: "button",
|
|
37520
|
+
className: "rounded-full p-0 ml-4",
|
|
37521
|
+
onClick: () => {
|
|
37522
|
+
removeDenomination(index);
|
|
37523
|
+
},
|
|
37524
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.XCircleSolid, { className: "rounded-full" })
|
|
37525
|
+
}
|
|
37526
|
+
) })
|
|
37527
|
+
]
|
|
37528
|
+
},
|
|
37529
|
+
denominationField.id
|
|
37530
|
+
);
|
|
37531
|
+
}),
|
|
37532
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
37533
|
+
ui.Button,
|
|
37534
|
+
{
|
|
37535
|
+
size: "small",
|
|
37536
|
+
variant: "secondary",
|
|
37537
|
+
type: "button",
|
|
37538
|
+
className: "w-full",
|
|
37539
|
+
onClick: () => {
|
|
37540
|
+
addDenomination({ value: "", prices: {} });
|
|
37541
|
+
},
|
|
37542
|
+
children: "Add denomination"
|
|
37543
|
+
}
|
|
37544
|
+
),
|
|
37545
|
+
form.formState.errors.denominations && /* @__PURE__ */ jsxRuntime.jsx(ui.Alert, { variant: "error", children: "Please add at least one denomination." })
|
|
37546
|
+
] }) }) }) }),
|
|
37547
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
37548
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
37549
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
37550
|
+
] }) })
|
|
37551
|
+
]
|
|
37552
|
+
}
|
|
37553
|
+
) });
|
|
37554
|
+
};
|
|
37555
|
+
const GiftCardProductEdit$1 = () => {
|
|
37396
37556
|
const { id } = reactRouterDom.useParams();
|
|
37397
|
-
const { product, isLoading, isError, error } = useProduct(id);
|
|
37398
|
-
if (isLoading || !product) {
|
|
37399
|
-
return;
|
|
37400
|
-
}
|
|
37557
|
+
const { product, isLoading, isError, error } = useProduct(id, {});
|
|
37401
37558
|
if (isError) {
|
|
37402
37559
|
throw error;
|
|
37403
37560
|
}
|
|
37404
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
37405
|
-
/* @__PURE__ */ jsxRuntime.
|
|
37406
|
-
|
|
37407
|
-
{
|
|
37408
|
-
|
|
37409
|
-
|
|
37410
|
-
/* @__PURE__ */ jsxRuntime.jsx(ProductVariantSection, { product }),
|
|
37411
|
-
/* @__PURE__ */ jsxRuntime.jsx(JsonViewSection, { data: product })
|
|
37412
|
-
] }),
|
|
37413
|
-
secondCol: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
37414
|
-
/* @__PURE__ */ jsxRuntime.jsx(ProductSalesChannelSection, { product }),
|
|
37415
|
-
/* @__PURE__ */ jsxRuntime.jsx(ProductMediaSection, { product })
|
|
37416
|
-
] })
|
|
37417
|
-
}
|
|
37418
|
-
),
|
|
37419
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
37561
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
37562
|
+
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
37563
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit gift cards denominations" }) }),
|
|
37564
|
+
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { className: "sr-only", children: "Edit the gift card denominations" })
|
|
37565
|
+
] }),
|
|
37566
|
+
!isLoading && product && /* @__PURE__ */ jsxRuntime.jsx(GiftCardProductEditDenominationsForm, { product })
|
|
37420
37567
|
] });
|
|
37421
37568
|
};
|
|
37422
|
-
const EditProductSchema
|
|
37569
|
+
const EditProductSchema = objectType({
|
|
37423
37570
|
status: enumType(["draft", "published", "proposed", "rejected"]),
|
|
37424
37571
|
title: stringType().min(1),
|
|
37425
37572
|
subtitle: stringType().optional(),
|
|
@@ -37438,7 +37585,7 @@ const GiftCardProductEditForm = ({
|
|
|
37438
37585
|
handle: product.handle || "",
|
|
37439
37586
|
description: product.description || ""
|
|
37440
37587
|
},
|
|
37441
|
-
resolver: t(EditProductSchema
|
|
37588
|
+
resolver: t(EditProductSchema)
|
|
37442
37589
|
});
|
|
37443
37590
|
const { mutateAsync, isPending } = useUpdateProduct(product.id);
|
|
37444
37591
|
const handleSubmit = form.handleSubmit(async (data) => {
|
|
@@ -37579,7 +37726,7 @@ const GiftCardProductEditForm = ({
|
|
|
37579
37726
|
}
|
|
37580
37727
|
) });
|
|
37581
37728
|
};
|
|
37582
|
-
const GiftCardProductEdit
|
|
37729
|
+
const GiftCardProductEdit = () => {
|
|
37583
37730
|
const { id } = reactRouterDom.useParams();
|
|
37584
37731
|
const { product, isLoading, isError, error } = useProduct(id, {});
|
|
37585
37732
|
if (isError) {
|
|
@@ -37593,153 +37740,6 @@ const GiftCardProductEdit$1 = () => {
|
|
|
37593
37740
|
!isLoading && product && /* @__PURE__ */ jsxRuntime.jsx(GiftCardProductEditForm, { product })
|
|
37594
37741
|
] });
|
|
37595
37742
|
};
|
|
37596
|
-
const EditProductSchema = objectType({
|
|
37597
|
-
denominations: arrayType(
|
|
37598
|
-
objectType({
|
|
37599
|
-
id: stringType().optional(),
|
|
37600
|
-
value: stringType().min(1),
|
|
37601
|
-
prices: recordType(stringType(), optionalFloat).optional()
|
|
37602
|
-
})
|
|
37603
|
-
).min(1)
|
|
37604
|
-
});
|
|
37605
|
-
const GiftCardProductEditDenominationsForm = ({
|
|
37606
|
-
product
|
|
37607
|
-
}) => {
|
|
37608
|
-
var _a;
|
|
37609
|
-
const { handleSuccess } = useRouteModal();
|
|
37610
|
-
const form = useForm({
|
|
37611
|
-
defaultValues: {
|
|
37612
|
-
denominations: (_a = product.variants) == null ? void 0 : _a.map((variant) => ({
|
|
37613
|
-
id: variant.id,
|
|
37614
|
-
value: variant.title
|
|
37615
|
-
}))
|
|
37616
|
-
},
|
|
37617
|
-
resolver: t(EditProductSchema)
|
|
37618
|
-
});
|
|
37619
|
-
const { mutateAsync, isPending } = useUpdateProduct(product.id);
|
|
37620
|
-
const handleSubmit = form.handleSubmit(async (data) => {
|
|
37621
|
-
const optionValues = data.denominations.map(
|
|
37622
|
-
(denomination) => denomination.value
|
|
37623
|
-
);
|
|
37624
|
-
const options = [
|
|
37625
|
-
{
|
|
37626
|
-
title: "denomination",
|
|
37627
|
-
values: optionValues
|
|
37628
|
-
}
|
|
37629
|
-
];
|
|
37630
|
-
await mutateAsync(
|
|
37631
|
-
{
|
|
37632
|
-
options,
|
|
37633
|
-
variants: data.denominations.map((denomination) => ({
|
|
37634
|
-
id: denomination.id,
|
|
37635
|
-
title: denomination.value,
|
|
37636
|
-
manage_inventory: false,
|
|
37637
|
-
options: {
|
|
37638
|
-
denomination: denomination.value
|
|
37639
|
-
}
|
|
37640
|
-
}))
|
|
37641
|
-
},
|
|
37642
|
-
{
|
|
37643
|
-
onSuccess: () => {
|
|
37644
|
-
ui.toast.success(`Denominations updated successfully`);
|
|
37645
|
-
handleSuccess();
|
|
37646
|
-
},
|
|
37647
|
-
onError: (e2) => {
|
|
37648
|
-
ui.toast.error(e2.message);
|
|
37649
|
-
}
|
|
37650
|
-
}
|
|
37651
|
-
);
|
|
37652
|
-
});
|
|
37653
|
-
const {
|
|
37654
|
-
fields: denominationsFields,
|
|
37655
|
-
append: addDenomination,
|
|
37656
|
-
remove: removeDenomination
|
|
37657
|
-
} = useFieldArray({
|
|
37658
|
-
name: "denominations",
|
|
37659
|
-
control: form.control
|
|
37660
|
-
});
|
|
37661
|
-
return /* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Form, { form, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
37662
|
-
KeyboundForm,
|
|
37663
|
-
{
|
|
37664
|
-
onSubmit: handleSubmit,
|
|
37665
|
-
className: "flex flex-1 flex-col overflow-hidden",
|
|
37666
|
-
children: [
|
|
37667
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Body, { className: "flex flex-1 flex-col gap-y-8 overflow-y-auto", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-y-6", children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-2", children: [
|
|
37668
|
-
denominationsFields.map((denominationField, index) => {
|
|
37669
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
37670
|
-
"div",
|
|
37671
|
-
{
|
|
37672
|
-
className: "flex items-center justify-between shadow-elevation-card-rest bg-ui-bg-component transition-fg rounded-md px-4 py-2",
|
|
37673
|
-
children: [
|
|
37674
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
37675
|
-
Form$2.Field,
|
|
37676
|
-
{
|
|
37677
|
-
control: form.control,
|
|
37678
|
-
name: `denominations.${index}.value`,
|
|
37679
|
-
render: ({ field }) => {
|
|
37680
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Form$2.Item, { className: "w-full", children: [
|
|
37681
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Input, { ...field, placeholder: "100" }) }),
|
|
37682
|
-
/* @__PURE__ */ jsxRuntime.jsx(Form$2.ErrorMessage, {})
|
|
37683
|
-
] });
|
|
37684
|
-
}
|
|
37685
|
-
},
|
|
37686
|
-
denominationField.id
|
|
37687
|
-
),
|
|
37688
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center rounded-xl", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
37689
|
-
ui.Button,
|
|
37690
|
-
{
|
|
37691
|
-
size: "small",
|
|
37692
|
-
variant: "secondary",
|
|
37693
|
-
type: "button",
|
|
37694
|
-
className: "rounded-full p-0 ml-4",
|
|
37695
|
-
onClick: () => {
|
|
37696
|
-
removeDenomination(index);
|
|
37697
|
-
},
|
|
37698
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(icons.XCircleSolid, { className: "rounded-full" })
|
|
37699
|
-
}
|
|
37700
|
-
) })
|
|
37701
|
-
]
|
|
37702
|
-
},
|
|
37703
|
-
denominationField.id
|
|
37704
|
-
);
|
|
37705
|
-
}),
|
|
37706
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
37707
|
-
ui.Button,
|
|
37708
|
-
{
|
|
37709
|
-
size: "small",
|
|
37710
|
-
variant: "secondary",
|
|
37711
|
-
type: "button",
|
|
37712
|
-
className: "w-full",
|
|
37713
|
-
onClick: () => {
|
|
37714
|
-
addDenomination({ value: "", prices: {} });
|
|
37715
|
-
},
|
|
37716
|
-
children: "Add denomination"
|
|
37717
|
-
}
|
|
37718
|
-
),
|
|
37719
|
-
form.formState.errors.denominations && /* @__PURE__ */ jsxRuntime.jsx(ui.Alert, { variant: "error", children: "Please add at least one denomination." })
|
|
37720
|
-
] }) }) }) }),
|
|
37721
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-x-2", children: [
|
|
37722
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", variant: "secondary", children: "Cancel" }) }),
|
|
37723
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "small", type: "submit", isLoading: isPending, children: "Save" })
|
|
37724
|
-
] }) })
|
|
37725
|
-
]
|
|
37726
|
-
}
|
|
37727
|
-
) });
|
|
37728
|
-
};
|
|
37729
|
-
const GiftCardProductEdit = () => {
|
|
37730
|
-
const { id } = reactRouterDom.useParams();
|
|
37731
|
-
const { product, isLoading, isError, error } = useProduct(id, {});
|
|
37732
|
-
if (isError) {
|
|
37733
|
-
throw error;
|
|
37734
|
-
}
|
|
37735
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer, { children: [
|
|
37736
|
-
/* @__PURE__ */ jsxRuntime.jsxs(RouteDrawer.Header, { children: [
|
|
37737
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Title, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Edit gift cards denominations" }) }),
|
|
37738
|
-
/* @__PURE__ */ jsxRuntime.jsx(RouteDrawer.Description, { className: "sr-only", children: "Edit the gift card denominations" })
|
|
37739
|
-
] }),
|
|
37740
|
-
!isLoading && product && /* @__PURE__ */ jsxRuntime.jsx(GiftCardProductEditDenominationsForm, { product })
|
|
37741
|
-
] });
|
|
37742
|
-
};
|
|
37743
37743
|
const EditProductMediaForm = ({ product }) => {
|
|
37744
37744
|
const [selection, setSelection] = React.useState({});
|
|
37745
37745
|
const { handleSuccess } = useRouteModal();
|
|
@@ -38668,22 +38668,22 @@ const routeModule = {
|
|
|
38668
38668
|
]
|
|
38669
38669
|
},
|
|
38670
38670
|
{
|
|
38671
|
-
Component:
|
|
38672
|
-
path: "/
|
|
38671
|
+
Component: GiftCardProductsPage,
|
|
38672
|
+
path: "/gift-cards/gift-card-products",
|
|
38673
38673
|
children: [
|
|
38674
38674
|
{
|
|
38675
|
-
Component:
|
|
38676
|
-
path: "/
|
|
38675
|
+
Component: GiftCardProductCreate,
|
|
38676
|
+
path: "/gift-cards/gift-card-products/create"
|
|
38677
38677
|
}
|
|
38678
38678
|
]
|
|
38679
38679
|
},
|
|
38680
38680
|
{
|
|
38681
|
-
Component:
|
|
38682
|
-
path: "/
|
|
38681
|
+
Component: StoreCreditAccountPage,
|
|
38682
|
+
path: "/store-credit-accounts/:id",
|
|
38683
38683
|
children: [
|
|
38684
38684
|
{
|
|
38685
|
-
Component:
|
|
38686
|
-
path: "/
|
|
38685
|
+
Component: Note,
|
|
38686
|
+
path: "/store-credit-accounts/:id/credit"
|
|
38687
38687
|
}
|
|
38688
38688
|
]
|
|
38689
38689
|
},
|
|
@@ -38693,11 +38693,11 @@ const routeModule = {
|
|
|
38693
38693
|
children: [
|
|
38694
38694
|
{
|
|
38695
38695
|
Component: GiftCardProductEdit$1,
|
|
38696
|
-
path: "/gift-cards/gift-card-products/:id/
|
|
38696
|
+
path: "/gift-cards/gift-card-products/:id/denominations"
|
|
38697
38697
|
},
|
|
38698
38698
|
{
|
|
38699
38699
|
Component: GiftCardProductEdit,
|
|
38700
|
-
path: "/gift-cards/gift-card-products/:id/
|
|
38700
|
+
path: "/gift-cards/gift-card-products/:id/edit"
|
|
38701
38701
|
}
|
|
38702
38702
|
]
|
|
38703
38703
|
},
|
|
@@ -38717,18 +38717,18 @@ const routeModule = {
|
|
|
38717
38717
|
};
|
|
38718
38718
|
const menuItemModule = {
|
|
38719
38719
|
menuItems: [
|
|
38720
|
-
{
|
|
38721
|
-
label: config$1.label,
|
|
38722
|
-
icon: config$1.icon,
|
|
38723
|
-
path: "/store-credit-accounts",
|
|
38724
|
-
nested: void 0
|
|
38725
|
-
},
|
|
38726
38720
|
{
|
|
38727
38721
|
label: config$2.label,
|
|
38728
38722
|
icon: config$2.icon,
|
|
38729
38723
|
path: "/gift-cards",
|
|
38730
38724
|
nested: void 0
|
|
38731
38725
|
},
|
|
38726
|
+
{
|
|
38727
|
+
label: config$1.label,
|
|
38728
|
+
icon: config$1.icon,
|
|
38729
|
+
path: "/store-credit-accounts",
|
|
38730
|
+
nested: void 0
|
|
38731
|
+
},
|
|
38732
38732
|
{
|
|
38733
38733
|
label: config.label,
|
|
38734
38734
|
icon: void 0,
|