@acmekit/dashboard 2.13.8 → 2.13.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{api-key-management-create-D57V3NN2.mjs → api-key-management-create-VWUERPPB.mjs} +1 -1
- package/dist/{api-key-management-detail-QURSBB6T.mjs → api-key-management-detail-V4ENQHYY.mjs} +19 -20
- package/dist/{api-key-management-edit-GG5V77GY.mjs → api-key-management-edit-R44OHS7B.mjs} +1 -1
- package/dist/{api-key-management-list-PL64LD22.mjs → api-key-management-list-K2XPKF5E.mjs} +13 -13
- package/dist/app.js +2252 -2783
- package/dist/app.mjs +52 -205
- package/dist/{chunk-VBT5YZ4K.mjs → chunk-EFRMWHRX.mjs} +6 -51
- package/dist/{chunk-6SQCO25J.mjs → chunk-ST2YB7JN.mjs} +16 -7
- package/dist/{login-YURMNRCS.mjs → login-GNP3QIPI.mjs} +10 -11
- package/dist/{translation-list-H5X4DVCC.mjs → translation-list-CCEQJNED.mjs} +18 -24
- package/dist/{translations-edit-NPAUN2GZ.mjs → translations-edit-E57GVUFV.mjs} +27 -27
- package/dist/{user-invite-OREFWWYL.mjs → user-invite-E3FAAU3V.mjs} +11 -11
- package/dist/{chunk-YB52HEIR.mjs → user-metadata-5GQK75DT.mjs} +44 -6
- package/dist/{workflow-execution-detail-MWNM25TF.mjs → workflow-execution-detail-LZXCRVNC.mjs} +9 -10
- package/dist/{workflow-execution-list-IGYF44UH.mjs → workflow-execution-list-HQ3V6TML.mjs} +12 -12
- package/package.json +9 -9
- package/src/dashboard-app/routes/get-route.map.tsx +1 -14
- package/src/hooks/api/api-keys.tsx +0 -49
- package/src/hooks/api/index.ts +0 -1
- package/src/providers/keybind-provider/hooks.tsx +0 -145
- package/src/routes/translations/translation-list/translation-list.tsx +10 -21
- package/src/routes/translations/translations-edit/translations-edit.tsx +14 -11
- package/src/vite-env.d.ts +3 -1
- package/dist/chunk-OHAFITSB.mjs +0 -54
- package/dist/store-detail-SQKV5KBD.mjs +0 -109
- package/dist/store-edit-WGGIJMYJ.mjs +0 -97
- package/dist/store-metadata-CSBUGX6Z.mjs +0 -49
- package/dist/user-metadata-QHUX5SHZ.mjs +0 -51
- package/src/components/data-table/helpers/sales-channels/index.ts +0 -4
- package/src/components/data-table/helpers/sales-channels/use-sales-channel-table-columns.tsx +0 -61
- package/src/components/data-table/helpers/sales-channels/use-sales-channel-table-empty-state.tsx +0 -22
- package/src/components/data-table/helpers/sales-channels/use-sales-channel-table-filters.tsx +0 -33
- package/src/components/data-table/helpers/sales-channels/use-sales-channel-table-query.tsx +0 -30
- package/src/routes/api-key-management/api-key-management-detail/components/api-key-sales-channel-section/api-key-sales-channel-section.tsx +0 -206
- package/src/routes/api-key-management/api-key-management-detail/components/api-key-sales-channel-section/index.ts +0 -1
- package/src/routes/store/common/hooks/use-currencies-table-columns.tsx +0 -29
- package/src/routes/store/common/hooks/use-currencies-table-query.tsx +0 -21
- package/src/routes/store/common/hooks/use-locales-table-columns.tsx +0 -29
- package/src/routes/store/common/hooks/use-locales-table-query.tsx +0 -21
- package/src/routes/store/store-detail/components/store-general-section/index.ts +0 -1
- package/src/routes/store/store-detail/components/store-general-section/store-general-section.tsx +0 -48
- package/src/routes/store/store-detail/index.ts +0 -2
- package/src/routes/store/store-detail/loader.ts +0 -18
- package/src/routes/store/store-detail/store-detail.tsx +0 -42
- package/src/routes/store/store-edit/components/edit-store-form/edit-store-form.tsx +0 -83
- package/src/routes/store/store-edit/index.ts +0 -1
- package/src/routes/store/store-edit/store-edit.tsx +0 -25
- package/src/routes/store/store-metadata/index.ts +0 -1
- package/src/routes/store/store-metadata/store-metadata.tsx +0 -24
- package/dist/{chunk-7ZHDHEUH.mjs → chunk-YLPAZ2DP.mjs} +3 -3
- package/dist/{invite-BAFXQBLJ.mjs → invite-XGPZZBUP.mjs} +3 -3
- package/dist/{profile-detail-SJWODS2K.mjs → profile-detail-YX27F7N6.mjs} +8 -8
- package/dist/{profile-edit-HSGF4UXZ.mjs → profile-edit-2VRDU75O.mjs} +9 -9
- package/dist/{reset-password-RQ5M7HQC.mjs → reset-password-TWRNZO6Z.mjs} +1 -1
- package/dist/{user-detail-7SUQ35G7.mjs → user-detail-KUSRRVNX.mjs} +7 -7
- package/dist/{user-edit-KUZV37AH.mjs → user-edit-HTN3ZGCL.mjs} +4 -4
- package/dist/{user-list-OWUR75OP.mjs → user-list-KNJ5S3IM.mjs} +12 -12
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import { PencilSquare, Trash } from "@acmekit/icons"
|
|
2
|
-
import { AdminApiKeyResponse, HttpTypes } from "@acmekit/types"
|
|
3
|
-
import {
|
|
4
|
-
Container,
|
|
5
|
-
createDataTableColumnHelper,
|
|
6
|
-
createDataTableCommandHelper,
|
|
7
|
-
DataTableRowSelectionState,
|
|
8
|
-
toast,
|
|
9
|
-
usePrompt,
|
|
10
|
-
} from "@acmekit/ui"
|
|
11
|
-
import { keepPreviousData } from "@tanstack/react-query"
|
|
12
|
-
import { RowSelectionState } from "@tanstack/react-table"
|
|
13
|
-
import { useCallback, useMemo, useState } from "react"
|
|
14
|
-
import { useTranslation } from "react-i18next"
|
|
15
|
-
import { useNavigate } from "react-router-dom"
|
|
16
|
-
import { DataTable } from "../../../../../components/data-table"
|
|
17
|
-
import * as hooks from "../../../../../components/data-table/helpers/sales-channels"
|
|
18
|
-
import { useBatchRemoveSalesChannelsFromApiKey } from "../../../../../hooks/api/api-keys"
|
|
19
|
-
import { useSalesChannels } from "../../../../../hooks/api/sales-channels"
|
|
20
|
-
|
|
21
|
-
type ApiKeySalesChannelSectionProps = {
|
|
22
|
-
apiKey: AdminApiKeyResponse["api_key"]
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const PAGE_SIZE = 10
|
|
26
|
-
const PREFIX = "sc"
|
|
27
|
-
|
|
28
|
-
export const ApiKeySalesChannelSection = ({
|
|
29
|
-
apiKey,
|
|
30
|
-
}: ApiKeySalesChannelSectionProps) => {
|
|
31
|
-
const [rowSelection, setRowSelection] = useState<RowSelectionState>({})
|
|
32
|
-
const { t } = useTranslation()
|
|
33
|
-
|
|
34
|
-
const searchParams = hooks.useSalesChannelTableQuery({
|
|
35
|
-
pageSize: PAGE_SIZE,
|
|
36
|
-
prefix: PREFIX,
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
const { sales_channels, count, isPending } = useSalesChannels(
|
|
40
|
-
{ ...searchParams, publishable_key_id: apiKey.id },
|
|
41
|
-
{
|
|
42
|
-
placeholderData: keepPreviousData,
|
|
43
|
-
}
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
const columns = useColumns(apiKey.id)
|
|
47
|
-
const filters = hooks.useSalesChannelTableFilters()
|
|
48
|
-
const commands = useCommands(apiKey.id, setRowSelection)
|
|
49
|
-
const emptyState = hooks.useSalesChannelTableEmptyState()
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<Container className="divide-y p-0">
|
|
53
|
-
<DataTable
|
|
54
|
-
data={sales_channels}
|
|
55
|
-
columns={columns}
|
|
56
|
-
filters={filters}
|
|
57
|
-
commands={commands}
|
|
58
|
-
heading={t("salesChannels.domain")}
|
|
59
|
-
headingLevel="h2"
|
|
60
|
-
getRowId={(row) => row.id}
|
|
61
|
-
rowCount={count}
|
|
62
|
-
isLoading={isPending}
|
|
63
|
-
emptyState={emptyState}
|
|
64
|
-
rowSelection={{
|
|
65
|
-
state: rowSelection,
|
|
66
|
-
onRowSelectionChange: setRowSelection,
|
|
67
|
-
}}
|
|
68
|
-
rowHref={(row) => `/settings/sales-channels/${row.id}`}
|
|
69
|
-
action={{
|
|
70
|
-
label: t("actions.add"),
|
|
71
|
-
to: "sales-channels",
|
|
72
|
-
}}
|
|
73
|
-
prefix={PREFIX}
|
|
74
|
-
pageSize={PAGE_SIZE}
|
|
75
|
-
/>
|
|
76
|
-
</Container>
|
|
77
|
-
)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const columnHelper = createDataTableColumnHelper<HttpTypes.AdminSalesChannel>()
|
|
81
|
-
|
|
82
|
-
const useColumns = (id: string) => {
|
|
83
|
-
const { t } = useTranslation()
|
|
84
|
-
const navigate = useNavigate()
|
|
85
|
-
const prompt = usePrompt()
|
|
86
|
-
|
|
87
|
-
const base = hooks.useSalesChannelTableColumns()
|
|
88
|
-
|
|
89
|
-
const { mutateAsync } = useBatchRemoveSalesChannelsFromApiKey(id)
|
|
90
|
-
|
|
91
|
-
const handleDelete = useCallback(
|
|
92
|
-
async (salesChannel: HttpTypes.AdminSalesChannel) => {
|
|
93
|
-
const res = await prompt({
|
|
94
|
-
title: t("general.areYouSure"),
|
|
95
|
-
description: t("apiKeyManagement.removeSalesChannel.warning", {
|
|
96
|
-
name: salesChannel.name,
|
|
97
|
-
}),
|
|
98
|
-
confirmText: t("actions.delete"),
|
|
99
|
-
cancelText: t("actions.cancel"),
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
if (!res) {
|
|
103
|
-
return
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
await mutateAsync([salesChannel.id], {
|
|
107
|
-
onSuccess: () => {
|
|
108
|
-
toast.success(
|
|
109
|
-
t("apiKeyManagement.removeSalesChannel.successToast", {
|
|
110
|
-
count: 1,
|
|
111
|
-
})
|
|
112
|
-
)
|
|
113
|
-
},
|
|
114
|
-
onError: (err) => {
|
|
115
|
-
toast.error(err.message)
|
|
116
|
-
},
|
|
117
|
-
})
|
|
118
|
-
},
|
|
119
|
-
[mutateAsync, prompt, t]
|
|
120
|
-
)
|
|
121
|
-
|
|
122
|
-
return useMemo(
|
|
123
|
-
() => [
|
|
124
|
-
columnHelper.select(),
|
|
125
|
-
...base,
|
|
126
|
-
columnHelper.action({
|
|
127
|
-
actions: (ctx) => [
|
|
128
|
-
[
|
|
129
|
-
{
|
|
130
|
-
label: t("actions.edit"),
|
|
131
|
-
icon: <PencilSquare />,
|
|
132
|
-
onClick: () => {
|
|
133
|
-
navigate(`/settings/sales-channels/${ctx.row.original.id}/edit`)
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
[
|
|
138
|
-
{
|
|
139
|
-
icon: <Trash />,
|
|
140
|
-
label: t("actions.delete"),
|
|
141
|
-
onClick: () => handleDelete(ctx.row.original),
|
|
142
|
-
},
|
|
143
|
-
],
|
|
144
|
-
],
|
|
145
|
-
}),
|
|
146
|
-
],
|
|
147
|
-
[base, handleDelete, navigate, t]
|
|
148
|
-
)
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
const commandHelper = createDataTableCommandHelper()
|
|
152
|
-
|
|
153
|
-
const useCommands = (
|
|
154
|
-
id: string,
|
|
155
|
-
setRowSelection: (state: DataTableRowSelectionState) => void
|
|
156
|
-
) => {
|
|
157
|
-
const { t } = useTranslation()
|
|
158
|
-
const prompt = usePrompt()
|
|
159
|
-
|
|
160
|
-
const { mutateAsync } = useBatchRemoveSalesChannelsFromApiKey(id)
|
|
161
|
-
|
|
162
|
-
const handleRemove = useCallback(
|
|
163
|
-
async (rowSelection: DataTableRowSelectionState) => {
|
|
164
|
-
const keys = Object.keys(rowSelection)
|
|
165
|
-
|
|
166
|
-
const res = await prompt({
|
|
167
|
-
title: t("general.areYouSure"),
|
|
168
|
-
description: t("apiKeyManagement.removeSalesChannel.warningBatch", {
|
|
169
|
-
count: keys.length,
|
|
170
|
-
}),
|
|
171
|
-
confirmText: t("actions.continue"),
|
|
172
|
-
cancelText: t("actions.cancel"),
|
|
173
|
-
})
|
|
174
|
-
|
|
175
|
-
if (!res) {
|
|
176
|
-
return
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
await mutateAsync(keys, {
|
|
180
|
-
onSuccess: () => {
|
|
181
|
-
toast.success(
|
|
182
|
-
t("apiKeyManagement.removeSalesChannel.successToastBatch", {
|
|
183
|
-
count: keys.length,
|
|
184
|
-
})
|
|
185
|
-
)
|
|
186
|
-
setRowSelection({})
|
|
187
|
-
},
|
|
188
|
-
onError: (err) => {
|
|
189
|
-
toast.error(err.message)
|
|
190
|
-
},
|
|
191
|
-
})
|
|
192
|
-
},
|
|
193
|
-
[mutateAsync, prompt, t, setRowSelection]
|
|
194
|
-
)
|
|
195
|
-
|
|
196
|
-
return useMemo(
|
|
197
|
-
() => [
|
|
198
|
-
commandHelper.command({
|
|
199
|
-
action: handleRemove,
|
|
200
|
-
label: t("actions.remove"),
|
|
201
|
-
shortcut: "r",
|
|
202
|
-
}),
|
|
203
|
-
],
|
|
204
|
-
[handleRemove, t]
|
|
205
|
-
)
|
|
206
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./api-key-sales-channel-section"
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { HttpTypes } from "@acmekit/types"
|
|
2
|
-
import { createColumnHelper } from "@tanstack/react-table"
|
|
3
|
-
import { useMemo } from "react"
|
|
4
|
-
import { useTranslation } from "react-i18next"
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
TextCell,
|
|
8
|
-
TextHeader,
|
|
9
|
-
} from "../../../../components/table/table-cells/common/text-cell"
|
|
10
|
-
|
|
11
|
-
const columnHelper = createColumnHelper<HttpTypes.AdminCurrency>()
|
|
12
|
-
|
|
13
|
-
export const useCurrenciesTableColumns = () => {
|
|
14
|
-
const { t } = useTranslation()
|
|
15
|
-
|
|
16
|
-
return useMemo(
|
|
17
|
-
() => [
|
|
18
|
-
columnHelper.accessor("code", {
|
|
19
|
-
header: () => <TextHeader text={t("fields.code")} />,
|
|
20
|
-
cell: ({ getValue }) => <TextCell text={getValue().toUpperCase()} />,
|
|
21
|
-
}),
|
|
22
|
-
columnHelper.accessor("name", {
|
|
23
|
-
header: () => <TextHeader text={t("fields.name")} />,
|
|
24
|
-
cell: ({ getValue }) => <TextCell text={getValue()} />,
|
|
25
|
-
}),
|
|
26
|
-
],
|
|
27
|
-
[t]
|
|
28
|
-
)
|
|
29
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useQueryParams } from "../../../../hooks/use-query-params"
|
|
2
|
-
|
|
3
|
-
export const useCurrenciesTableQuery = ({
|
|
4
|
-
pageSize = 10,
|
|
5
|
-
prefix,
|
|
6
|
-
}: {
|
|
7
|
-
pageSize?: number
|
|
8
|
-
prefix?: string
|
|
9
|
-
}) => {
|
|
10
|
-
const raw = useQueryParams(["order", "q", "offset"], prefix)
|
|
11
|
-
|
|
12
|
-
const { offset, ...rest } = raw
|
|
13
|
-
|
|
14
|
-
const searchParams = {
|
|
15
|
-
limit: pageSize,
|
|
16
|
-
offset: offset ? parseInt(offset) : 0,
|
|
17
|
-
...rest,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return { searchParams, raw }
|
|
21
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { HttpTypes } from "@acmekit/types"
|
|
2
|
-
import { createColumnHelper } from "@tanstack/react-table"
|
|
3
|
-
import { useMemo } from "react"
|
|
4
|
-
import { useTranslation } from "react-i18next"
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
TextCell,
|
|
8
|
-
TextHeader,
|
|
9
|
-
} from "../../../../components/table/table-cells/common/text-cell"
|
|
10
|
-
|
|
11
|
-
const columnHelper = createColumnHelper<HttpTypes.AdminLocale>()
|
|
12
|
-
|
|
13
|
-
export const useLocalesTableColumns = () => {
|
|
14
|
-
const { t } = useTranslation()
|
|
15
|
-
|
|
16
|
-
return useMemo(
|
|
17
|
-
() => [
|
|
18
|
-
columnHelper.accessor("code", {
|
|
19
|
-
header: () => <TextHeader text={t("fields.code")} />,
|
|
20
|
-
cell: ({ getValue }) => <TextCell text={getValue()} />,
|
|
21
|
-
}),
|
|
22
|
-
columnHelper.accessor("name", {
|
|
23
|
-
header: () => <TextHeader text={t("fields.name")} />,
|
|
24
|
-
cell: ({ getValue }) => <TextCell text={getValue()} />,
|
|
25
|
-
}),
|
|
26
|
-
],
|
|
27
|
-
[t]
|
|
28
|
-
)
|
|
29
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useQueryParams } from "../../../../hooks/use-query-params"
|
|
2
|
-
|
|
3
|
-
export const useLocalesTableQuery = ({
|
|
4
|
-
pageSize = 10,
|
|
5
|
-
prefix,
|
|
6
|
-
}: {
|
|
7
|
-
pageSize?: number
|
|
8
|
-
prefix?: string
|
|
9
|
-
}) => {
|
|
10
|
-
const raw = useQueryParams(["order", "q", "offset"], prefix)
|
|
11
|
-
|
|
12
|
-
const { offset, ...rest } = raw
|
|
13
|
-
|
|
14
|
-
const searchParams = {
|
|
15
|
-
limit: pageSize,
|
|
16
|
-
offset: offset ? parseInt(offset) : 0,
|
|
17
|
-
...rest,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return { searchParams, raw }
|
|
21
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./store-general-section"
|
package/src/routes/store/store-detail/components/store-general-section/store-general-section.tsx
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { PencilSquare } from "@acmekit/icons"
|
|
2
|
-
import { AdminStore } from "@acmekit/types"
|
|
3
|
-
import { Container, Heading, Text } from "@acmekit/ui"
|
|
4
|
-
import { useTranslation } from "react-i18next"
|
|
5
|
-
|
|
6
|
-
import { ActionMenu } from "../../../../../components/common/action-menu"
|
|
7
|
-
|
|
8
|
-
type StoreGeneralSectionProps = {
|
|
9
|
-
store: AdminStore
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const StoreGeneralSection = ({ store }: StoreGeneralSectionProps) => {
|
|
13
|
-
const { t } = useTranslation()
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<Container className="divide-y p-0">
|
|
17
|
-
<div className="flex items-center justify-between px-6 py-4">
|
|
18
|
-
<div>
|
|
19
|
-
<Heading>{t("store.domain")}</Heading>
|
|
20
|
-
<Text className="text-ui-fg-subtle" size="small">
|
|
21
|
-
{t("store.manageYourStoresDetails")}
|
|
22
|
-
</Text>
|
|
23
|
-
</div>
|
|
24
|
-
<ActionMenu
|
|
25
|
-
groups={[
|
|
26
|
-
{
|
|
27
|
-
actions: [
|
|
28
|
-
{
|
|
29
|
-
icon: <PencilSquare />,
|
|
30
|
-
label: t("actions.edit"),
|
|
31
|
-
to: "edit",
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
]}
|
|
36
|
-
/>
|
|
37
|
-
</div>
|
|
38
|
-
<div className="text-ui-fg-subtle grid grid-cols-2 px-6 py-4">
|
|
39
|
-
<Text size="small" leading="compact" weight="plus">
|
|
40
|
-
{t("fields.name")}
|
|
41
|
-
</Text>
|
|
42
|
-
<Text size="small" leading="compact">
|
|
43
|
-
{store.name}
|
|
44
|
-
</Text>
|
|
45
|
-
</div>
|
|
46
|
-
</Container>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { HttpTypes } from "@acmekit/types"
|
|
2
|
-
|
|
3
|
-
import { retrieveActiveStore, storeQueryKeys } from "../../../hooks/api/store"
|
|
4
|
-
import { queryClient } from "../../../lib/query-client"
|
|
5
|
-
|
|
6
|
-
const storeDetailQuery = () => ({
|
|
7
|
-
queryKey: storeQueryKeys.details(),
|
|
8
|
-
queryFn: async () => retrieveActiveStore(),
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
export const storeLoader = async () => {
|
|
12
|
-
const query = storeDetailQuery()
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
queryClient.getQueryData<HttpTypes.AdminStoreResponse>(query.queryKey) ??
|
|
16
|
-
(await queryClient.fetchQuery(query))
|
|
17
|
-
)
|
|
18
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { useLoaderData } from "react-router-dom"
|
|
2
|
-
|
|
3
|
-
import { useStore } from "../../../hooks/api/store"
|
|
4
|
-
import { StoreGeneralSection } from "./components/store-general-section"
|
|
5
|
-
import { storeLoader } from "./loader"
|
|
6
|
-
|
|
7
|
-
import { SingleColumnPageSkeleton } from "../../../components/common/skeleton"
|
|
8
|
-
import { SingleColumnPage } from "../../../components/layout/pages"
|
|
9
|
-
import { useExtension } from "../../../providers/extension-provider"
|
|
10
|
-
|
|
11
|
-
export const StoreDetail = () => {
|
|
12
|
-
const initialData = useLoaderData() as Awaited<ReturnType<typeof storeLoader>>
|
|
13
|
-
|
|
14
|
-
const { store, isPending, isError, error } = useStore(undefined, {
|
|
15
|
-
initialData,
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
const { getWidgets } = useExtension()
|
|
19
|
-
|
|
20
|
-
if (isPending || !store) {
|
|
21
|
-
return <SingleColumnPageSkeleton sections={1} showJSON showMetadata />
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (isError) {
|
|
25
|
-
throw error
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<SingleColumnPage
|
|
30
|
-
widgets={{
|
|
31
|
-
before: getWidgets("store.details.before"),
|
|
32
|
-
after: getWidgets("store.details.after"),
|
|
33
|
-
}}
|
|
34
|
-
data={store}
|
|
35
|
-
hasOutlet
|
|
36
|
-
showMetadata
|
|
37
|
-
showJSON
|
|
38
|
-
>
|
|
39
|
-
<StoreGeneralSection store={store} />
|
|
40
|
-
</SingleColumnPage>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { zodResolver } from "@hookform/resolvers/zod"
|
|
2
|
-
import { HttpTypes } from "@acmekit/types"
|
|
3
|
-
import { Button, Input, toast } from "@acmekit/ui"
|
|
4
|
-
import { useForm } from "react-hook-form"
|
|
5
|
-
import { useTranslation } from "react-i18next"
|
|
6
|
-
import { z } from "zod"
|
|
7
|
-
|
|
8
|
-
import { Form } from "../../../../../components/common/form"
|
|
9
|
-
import { RouteDrawer, useRouteModal } from "../../../../../components/modals"
|
|
10
|
-
import { KeyboundForm } from "../../../../../components/utilities/keybound-form"
|
|
11
|
-
import { useUpdateStore } from "../../../../../hooks/api/store"
|
|
12
|
-
|
|
13
|
-
type EditStoreFormProps = {
|
|
14
|
-
store: HttpTypes.AdminStore
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const EditStoreSchema = z.object({
|
|
18
|
-
name: z.string().min(1),
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
export const EditStoreForm = ({ store }: EditStoreFormProps) => {
|
|
22
|
-
const { t } = useTranslation()
|
|
23
|
-
const { handleSuccess } = useRouteModal()
|
|
24
|
-
const form = useForm<z.infer<typeof EditStoreSchema>>({
|
|
25
|
-
defaultValues: {
|
|
26
|
-
name: store.name,
|
|
27
|
-
},
|
|
28
|
-
resolver: zodResolver(EditStoreSchema),
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
const { mutateAsync, isPending } = useUpdateStore(store.id)
|
|
32
|
-
|
|
33
|
-
const handleSubmit = form.handleSubmit(async (values) => {
|
|
34
|
-
await mutateAsync(values, {
|
|
35
|
-
onSuccess: () => {
|
|
36
|
-
toast.success(t("store.toast.update"))
|
|
37
|
-
handleSuccess()
|
|
38
|
-
},
|
|
39
|
-
onError: (error) => {
|
|
40
|
-
toast.error(error.message)
|
|
41
|
-
},
|
|
42
|
-
})
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<RouteDrawer.Form form={form}>
|
|
47
|
-
<KeyboundForm
|
|
48
|
-
onSubmit={handleSubmit}
|
|
49
|
-
className="flex h-full flex-col overflow-hidden"
|
|
50
|
-
>
|
|
51
|
-
<RouteDrawer.Body className="overflow-y-auto">
|
|
52
|
-
<div className="flex flex-col gap-y-8">
|
|
53
|
-
<Form.Field
|
|
54
|
-
control={form.control}
|
|
55
|
-
name="name"
|
|
56
|
-
render={({ field }) => (
|
|
57
|
-
<Form.Item>
|
|
58
|
-
<Form.Label>{t("fields.name")}</Form.Label>
|
|
59
|
-
<Form.Control>
|
|
60
|
-
<Input placeholder="ACME" {...field} />
|
|
61
|
-
</Form.Control>
|
|
62
|
-
<Form.ErrorMessage />
|
|
63
|
-
</Form.Item>
|
|
64
|
-
)}
|
|
65
|
-
/>
|
|
66
|
-
</div>
|
|
67
|
-
</RouteDrawer.Body>
|
|
68
|
-
<RouteDrawer.Footer>
|
|
69
|
-
<div className="flex items-center justify-end gap-x-2">
|
|
70
|
-
<RouteDrawer.Close asChild>
|
|
71
|
-
<Button size="small" variant="secondary">
|
|
72
|
-
{t("actions.cancel")}
|
|
73
|
-
</Button>
|
|
74
|
-
</RouteDrawer.Close>
|
|
75
|
-
<Button size="small" isLoading={isPending} type="submit">
|
|
76
|
-
{t("actions.save")}
|
|
77
|
-
</Button>
|
|
78
|
-
</div>
|
|
79
|
-
</RouteDrawer.Footer>
|
|
80
|
-
</KeyboundForm>
|
|
81
|
-
</RouteDrawer.Form>
|
|
82
|
-
)
|
|
83
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { StoreEdit as Component } from "./store-edit"
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Heading } from "@acmekit/ui"
|
|
2
|
-
import { useTranslation } from "react-i18next"
|
|
3
|
-
import { RouteDrawer } from "../../../components/modals"
|
|
4
|
-
import { useStore } from "../../../hooks/api/store"
|
|
5
|
-
import { EditStoreForm } from "./components/edit-store-form/edit-store-form"
|
|
6
|
-
|
|
7
|
-
export const StoreEdit = () => {
|
|
8
|
-
const { t } = useTranslation()
|
|
9
|
-
const { store, isPending: isLoading, isError, error } = useStore()
|
|
10
|
-
|
|
11
|
-
if (isError) {
|
|
12
|
-
throw error
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const ready = !!store && !isLoading
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<RouteDrawer>
|
|
19
|
-
<RouteDrawer.Header>
|
|
20
|
-
<Heading>{t("store.edit.header")}</Heading>
|
|
21
|
-
</RouteDrawer.Header>
|
|
22
|
-
{ready && <EditStoreForm store={store} />}
|
|
23
|
-
</RouteDrawer>
|
|
24
|
-
)
|
|
25
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { StoreMetadata as Component } from "./store-metadata"
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { MetadataForm } from "../../../components/forms/metadata-form"
|
|
2
|
-
import { RouteDrawer } from "../../../components/modals"
|
|
3
|
-
import { useStore, useUpdateStore } from "../../../hooks/api"
|
|
4
|
-
|
|
5
|
-
export const StoreMetadata = () => {
|
|
6
|
-
const { store, isPending, isError, error } = useStore()
|
|
7
|
-
|
|
8
|
-
const { mutateAsync, isPending: isMutating } = useUpdateStore(store?.id!)
|
|
9
|
-
|
|
10
|
-
if (isError) {
|
|
11
|
-
throw error
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<RouteDrawer>
|
|
16
|
-
<MetadataForm
|
|
17
|
-
isPending={isPending}
|
|
18
|
-
isMutating={isMutating}
|
|
19
|
-
hook={mutateAsync}
|
|
20
|
-
metadata={store?.metadata}
|
|
21
|
-
/>
|
|
22
|
-
</RouteDrawer>
|
|
23
|
-
)
|
|
24
|
-
}
|
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
AvatarBox
|
|
3
3
|
} from "./chunk-RREPQMYC.mjs";
|
|
4
4
|
import "./chunk-G2VJOHHV.mjs";
|
|
5
|
-
import {
|
|
6
|
-
useSignUpWithEmailPass
|
|
7
|
-
} from "./chunk-GBFVWROS.mjs";
|
|
8
5
|
import {
|
|
9
6
|
isFetchError
|
|
10
7
|
} from "./chunk-TCNCAWYD.mjs";
|
|
8
|
+
import {
|
|
9
|
+
useSignUpWithEmailPass
|
|
10
|
+
} from "./chunk-GBFVWROS.mjs";
|
|
11
11
|
import {
|
|
12
12
|
useAcceptInvite
|
|
13
13
|
} from "./chunk-XIM7X4FB.mjs";
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
languages
|
|
3
|
+
} from "./chunk-535OVBXR.mjs";
|
|
1
4
|
import {
|
|
2
5
|
SingleColumnPage
|
|
3
6
|
} from "./chunk-22YYMH6M.mjs";
|
|
@@ -5,19 +8,16 @@ import {
|
|
|
5
8
|
useExtension
|
|
6
9
|
} from "./chunk-C5P5PL3E.mjs";
|
|
7
10
|
import {
|
|
8
|
-
|
|
9
|
-
} from "./chunk-
|
|
11
|
+
ActionMenu
|
|
12
|
+
} from "./chunk-S3REQHPQ.mjs";
|
|
10
13
|
import {
|
|
11
14
|
SingleColumnPageSkeleton
|
|
12
15
|
} from "./chunk-ITNQKZQQ.mjs";
|
|
13
|
-
import {
|
|
14
|
-
languages
|
|
15
|
-
} from "./chunk-535OVBXR.mjs";
|
|
16
|
-
import {
|
|
17
|
-
ActionMenu
|
|
18
|
-
} from "./chunk-S3REQHPQ.mjs";
|
|
19
16
|
import "./chunk-OAHCJFG3.mjs";
|
|
20
17
|
import "./chunk-S4DMV3ZT.mjs";
|
|
18
|
+
import {
|
|
19
|
+
useMe
|
|
20
|
+
} from "./chunk-YRWSG3YM.mjs";
|
|
21
21
|
import "./chunk-FXYH54JP.mjs";
|
|
22
22
|
import "./chunk-774WSTCC.mjs";
|
|
23
23
|
import "./chunk-DTY37DDZ.mjs";
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import "./chunk-IUCDCPJU.mjs";
|
|
2
1
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
languages
|
|
3
|
+
} from "./chunk-535OVBXR.mjs";
|
|
4
|
+
import {
|
|
5
|
+
useDocumentDirection
|
|
6
|
+
} from "./chunk-S4DMV3ZT.mjs";
|
|
7
|
+
import "./chunk-IUCDCPJU.mjs";
|
|
6
8
|
import {
|
|
7
9
|
KeyboundForm,
|
|
8
10
|
RouteDrawer,
|
|
@@ -12,11 +14,9 @@ import {
|
|
|
12
14
|
Form
|
|
13
15
|
} from "./chunk-ND3ODI36.mjs";
|
|
14
16
|
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
useDocumentDirection
|
|
19
|
-
} from "./chunk-S4DMV3ZT.mjs";
|
|
17
|
+
useMe,
|
|
18
|
+
useUpdateUser
|
|
19
|
+
} from "./chunk-YRWSG3YM.mjs";
|
|
20
20
|
import "./chunk-FXYH54JP.mjs";
|
|
21
21
|
import "./chunk-774WSTCC.mjs";
|
|
22
22
|
import "./chunk-DTY37DDZ.mjs";
|
|
@@ -3,11 +3,11 @@ import "./chunk-G2VJOHHV.mjs";
|
|
|
3
3
|
import {
|
|
4
4
|
i18n
|
|
5
5
|
} from "./chunk-W3WS3HKB.mjs";
|
|
6
|
+
import "./chunk-C5P5PL3E.mjs";
|
|
6
7
|
import {
|
|
7
8
|
useResetPasswordForEmailPass,
|
|
8
9
|
useUpdateProviderForEmailPass
|
|
9
10
|
} from "./chunk-GBFVWROS.mjs";
|
|
10
|
-
import "./chunk-C5P5PL3E.mjs";
|
|
11
11
|
import {
|
|
12
12
|
Form
|
|
13
13
|
} from "./chunk-ND3ODI36.mjs";
|