@acmekit/dashboard 2.13.7 → 2.13.9
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-VWUERPPB.mjs +170 -0
- package/dist/api-key-management-detail-V4ENQHYY.mjs +306 -0
- package/dist/api-key-management-edit-R44OHS7B.mjs +106 -0
- package/dist/api-key-management-list-K2XPKF5E.mjs +400 -0
- package/dist/app.js +16765 -1370
- package/dist/app.mjs +786 -1030
- package/dist/chunk-22YYMH6M.mjs +382 -0
- package/dist/chunk-2U3RK3JG.mjs +474 -0
- package/dist/chunk-535OVBXR.mjs +226 -0
- package/dist/chunk-774WSTCC.mjs +19 -0
- package/dist/chunk-C76H5USB.mjs +16 -0
- package/dist/chunk-DFFLVEZ5.mjs +40 -0
- package/dist/chunk-DN3MIYQH.mjs +140 -0
- package/dist/chunk-DQCEH3X2.mjs +28 -0
- package/dist/chunk-DTY37DDZ.mjs +20 -0
- package/dist/chunk-EFRMWHRX.mjs +84 -0
- package/dist/chunk-FXYH54JP.mjs +16 -0
- package/dist/chunk-G22WWLPG.mjs +44 -0
- package/dist/chunk-G2VJOHHV.mjs +32 -0
- package/dist/chunk-GBFVWROS.mjs +58 -0
- package/dist/chunk-ITNQKZQQ.mjs +142 -0
- package/dist/chunk-IUCDCPJU.mjs +0 -0
- package/dist/chunk-LKWTBYYC.mjs +35 -0
- package/dist/{chunk-4VYJHIB3.mjs → chunk-ND3ODI36.mjs} +0 -72
- package/dist/chunk-OAHCJFG3.mjs +17 -0
- package/dist/chunk-RPAL6FHW.mjs +73 -0
- package/dist/{chunk-JSJZMTQG.mjs → chunk-RREPQMYC.mjs} +14 -41
- package/dist/chunk-S3REQHPQ.mjs +86 -0
- package/dist/chunk-S4DMV3ZT.mjs +35 -0
- package/dist/chunk-ST2YB7JN.mjs +74 -0
- package/dist/chunk-TCNCAWYD.mjs +9 -0
- package/dist/chunk-ULSPL3DR.mjs +126 -0
- package/dist/chunk-WILMJYUB.mjs +35 -0
- package/dist/chunk-XIM7X4FB.mjs +83 -0
- package/dist/chunk-YLPAZ2DP.mjs +1837 -0
- package/dist/chunk-YRWSG3YM.mjs +80 -0
- package/dist/{invite-S5USGDOZ.mjs → invite-XGPZZBUP.mjs} +15 -7
- package/dist/{login-AIMR26AL.mjs → login-GNP3QIPI.mjs} +25 -12
- package/dist/profile-detail-YX27F7N6.mjs +96 -0
- package/dist/profile-edit-2VRDU75O.mjs +173 -0
- package/dist/{reset-password-UQPRHMB3.mjs → reset-password-TWRNZO6Z.mjs} +7 -3
- package/dist/settings-3XWLL5LG.mjs +545 -0
- package/dist/translation-list-CCEQJNED.mjs +581 -0
- package/dist/translations-edit-E57GVUFV.mjs +5376 -0
- package/dist/user-detail-KUSRRVNX.mjs +169 -0
- package/dist/user-edit-HTN3ZGCL.mjs +114 -0
- package/dist/user-invite-E3FAAU3V.mjs +361 -0
- package/dist/user-list-KNJ5S3IM.mjs +1116 -0
- package/dist/user-metadata-5GQK75DT.mjs +425 -0
- package/dist/workflow-execution-detail-LZXCRVNC.mjs +819 -0
- package/dist/workflow-execution-list-HQ3V6TML.mjs +175 -0
- package/package.json +9 -9
- package/src/components/layout/settings-layout/settings-layout.tsx +8 -2
- 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-FBTP4AJM.mjs +0 -221
- package/dist/chunk-QYOO4QR6.mjs +0 -73
- 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
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/hooks/use-query-params.tsx
|
|
2
|
+
import { useSearchParams } from "react-router-dom";
|
|
3
|
+
function useQueryParams(keys, prefix) {
|
|
4
|
+
const [params] = useSearchParams();
|
|
5
|
+
const result = {};
|
|
6
|
+
keys.forEach((key) => {
|
|
7
|
+
const prefixedKey = prefix ? `${prefix}_${key}` : key;
|
|
8
|
+
const value = params.get(prefixedKey) || void 0;
|
|
9
|
+
result[key] = value;
|
|
10
|
+
});
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
useQueryParams
|
|
16
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
languages
|
|
3
|
+
} from "./chunk-535OVBXR.mjs";
|
|
4
|
+
|
|
5
|
+
// src/hooks/use-date.tsx
|
|
6
|
+
import { format, formatDistance, sub } from "date-fns";
|
|
7
|
+
import { enUS } from "date-fns/locale";
|
|
8
|
+
import { useTranslation } from "react-i18next";
|
|
9
|
+
var useDate = () => {
|
|
10
|
+
const { i18n } = useTranslation();
|
|
11
|
+
const locale = languages.find((l) => l.code === i18n.language)?.date_locale || enUS;
|
|
12
|
+
const getFullDate = ({
|
|
13
|
+
date,
|
|
14
|
+
includeTime = false
|
|
15
|
+
}) => {
|
|
16
|
+
const ensuredDate = new Date(date);
|
|
17
|
+
if (isNaN(ensuredDate.getTime())) {
|
|
18
|
+
return "";
|
|
19
|
+
}
|
|
20
|
+
const timeFormat = includeTime ? "p" : "";
|
|
21
|
+
return format(ensuredDate, `PP ${timeFormat}`, {
|
|
22
|
+
locale
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
function getRelativeDate(date) {
|
|
26
|
+
const now = /* @__PURE__ */ new Date();
|
|
27
|
+
return formatDistance(sub(new Date(date), { minutes: 0 }), now, {
|
|
28
|
+
addSuffix: true,
|
|
29
|
+
locale
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
getFullDate,
|
|
34
|
+
getRelativeDate
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
useDate
|
|
40
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import {
|
|
2
|
+
queryClient
|
|
3
|
+
} from "./chunk-FXYH54JP.mjs";
|
|
4
|
+
import {
|
|
5
|
+
queryKeysFactory
|
|
6
|
+
} from "./chunk-774WSTCC.mjs";
|
|
7
|
+
import {
|
|
8
|
+
sdk
|
|
9
|
+
} from "./chunk-DTY37DDZ.mjs";
|
|
10
|
+
|
|
11
|
+
// src/hooks/api/feature-flags.tsx
|
|
12
|
+
import { useQuery } from "@tanstack/react-query";
|
|
13
|
+
var useFeatureFlags = () => {
|
|
14
|
+
return useQuery({
|
|
15
|
+
queryKey: ["admin", "feature-flags"],
|
|
16
|
+
queryFn: async () => {
|
|
17
|
+
const response = await sdk.client.fetch(
|
|
18
|
+
"/admin/feature-flags",
|
|
19
|
+
{
|
|
20
|
+
method: "GET"
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
return response.feature_flags;
|
|
24
|
+
},
|
|
25
|
+
staleTime: 5 * 60 * 1e3,
|
|
26
|
+
// Cache for 5 minutes
|
|
27
|
+
cacheTime: 10 * 60 * 1e3
|
|
28
|
+
// Keep in cache for 10 minutes
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// src/hooks/api/views.tsx
|
|
33
|
+
import {
|
|
34
|
+
useMutation,
|
|
35
|
+
useQuery as useQuery2
|
|
36
|
+
} from "@tanstack/react-query";
|
|
37
|
+
var VIEWS_QUERY_KEY = "views";
|
|
38
|
+
var _viewsKeys = queryKeysFactory(VIEWS_QUERY_KEY);
|
|
39
|
+
_viewsKeys.columns = function(entity) {
|
|
40
|
+
return [this.all, "columns", entity];
|
|
41
|
+
};
|
|
42
|
+
_viewsKeys.active = function(entity) {
|
|
43
|
+
return [this.detail(entity), "active"];
|
|
44
|
+
};
|
|
45
|
+
_viewsKeys.configurations = function(entity, query) {
|
|
46
|
+
const key = [this.all, "configurations", entity];
|
|
47
|
+
if (query !== void 0) {
|
|
48
|
+
key.push(query);
|
|
49
|
+
}
|
|
50
|
+
return key;
|
|
51
|
+
};
|
|
52
|
+
var viewsQueryKeys = _viewsKeys;
|
|
53
|
+
var useViewConfigurations = (entity, query, options) => {
|
|
54
|
+
const { data, ...rest } = useQuery2({
|
|
55
|
+
queryFn: () => sdk.admin.views.listConfigurations(entity, query),
|
|
56
|
+
queryKey: viewsQueryKeys.configurations(entity, query),
|
|
57
|
+
...options
|
|
58
|
+
});
|
|
59
|
+
return { ...data, ...rest };
|
|
60
|
+
};
|
|
61
|
+
var useActiveViewConfiguration = (entity, options) => {
|
|
62
|
+
const query = useQuery2({
|
|
63
|
+
queryFn: () => sdk.admin.views.retrieveActiveConfiguration(entity),
|
|
64
|
+
queryKey: viewsQueryKeys.active(entity),
|
|
65
|
+
...options
|
|
66
|
+
});
|
|
67
|
+
const { data, ...rest } = query;
|
|
68
|
+
return { ...data, ...rest };
|
|
69
|
+
};
|
|
70
|
+
var useCreateViewConfiguration = (entity, options) => {
|
|
71
|
+
return useMutation({
|
|
72
|
+
mutationFn: (payload) => sdk.admin.views.createConfiguration(entity, payload),
|
|
73
|
+
...options,
|
|
74
|
+
onSuccess: (data, variables, context) => {
|
|
75
|
+
queryClient.invalidateQueries({ queryKey: viewsQueryKeys.configurations(entity) });
|
|
76
|
+
if (variables.set_active) {
|
|
77
|
+
queryClient.invalidateQueries({
|
|
78
|
+
queryKey: viewsQueryKeys.active(entity)
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
options?.onSuccess?.(data, variables, context);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
var useUpdateViewConfiguration = (entity, id, options) => {
|
|
86
|
+
return useMutation({
|
|
87
|
+
mutationFn: (payload) => sdk.admin.views.updateConfiguration(entity, id, payload),
|
|
88
|
+
...options,
|
|
89
|
+
onSuccess: (data, variables, context) => {
|
|
90
|
+
queryClient.invalidateQueries({ queryKey: viewsQueryKeys.configurations(entity) });
|
|
91
|
+
queryClient.invalidateQueries({ queryKey: viewsQueryKeys.detail(id) });
|
|
92
|
+
queryClient.invalidateQueries({ queryKey: viewsQueryKeys.active(entity) });
|
|
93
|
+
options?.onSuccess?.(data, variables, context);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
var useDeleteViewConfiguration = (entity, id, options) => {
|
|
98
|
+
return useMutation({
|
|
99
|
+
mutationFn: () => sdk.admin.views.deleteConfiguration(entity, id),
|
|
100
|
+
...options,
|
|
101
|
+
onSuccess: (data, variables, context) => {
|
|
102
|
+
queryClient.invalidateQueries({ queryKey: viewsQueryKeys.configurations(entity) });
|
|
103
|
+
queryClient.invalidateQueries({ queryKey: viewsQueryKeys.detail(id) });
|
|
104
|
+
queryClient.invalidateQueries({
|
|
105
|
+
queryKey: viewsQueryKeys.active(entity)
|
|
106
|
+
});
|
|
107
|
+
options?.onSuccess?.(data, variables, context);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
var useSetActiveViewConfiguration = (entity, options) => {
|
|
112
|
+
return useMutation({
|
|
113
|
+
mutationFn: (viewConfigurationId) => {
|
|
114
|
+
return sdk.admin.views.setActiveConfiguration(entity, {
|
|
115
|
+
view_configuration_id: viewConfigurationId
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
...options,
|
|
119
|
+
onSuccess: async (data, variables, context) => {
|
|
120
|
+
await queryClient.invalidateQueries({
|
|
121
|
+
queryKey: viewsQueryKeys.active(entity)
|
|
122
|
+
});
|
|
123
|
+
await queryClient.invalidateQueries({ queryKey: viewsQueryKeys.configurations(entity) });
|
|
124
|
+
options?.onSuccess?.(data, variables, context);
|
|
125
|
+
},
|
|
126
|
+
onError: (error, variables, context) => {
|
|
127
|
+
options?.onError?.(error, variables, context);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export {
|
|
133
|
+
useFeatureFlags,
|
|
134
|
+
useViewConfigurations,
|
|
135
|
+
useActiveViewConfiguration,
|
|
136
|
+
useCreateViewConfiguration,
|
|
137
|
+
useUpdateViewConfiguration,
|
|
138
|
+
useDeleteViewConfiguration,
|
|
139
|
+
useSetActiveViewConfiguration
|
|
140
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useFeatureFlags
|
|
3
|
+
} from "./chunk-DN3MIYQH.mjs";
|
|
4
|
+
|
|
5
|
+
// src/providers/feature-flag-provider/index.tsx
|
|
6
|
+
import { createContext, useContext } from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var FeatureFlagContext = createContext(null);
|
|
9
|
+
var useFeatureFlag = (flag) => {
|
|
10
|
+
const context = useContext(FeatureFlagContext);
|
|
11
|
+
if (!context) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
return context.isFeatureEnabled(flag);
|
|
15
|
+
};
|
|
16
|
+
var FeatureFlagProvider = ({ children }) => {
|
|
17
|
+
const { data: flags = {}, isLoading, error } = useFeatureFlags();
|
|
18
|
+
const isFeatureEnabled = (flag) => {
|
|
19
|
+
const enabled = flags[flag] === true;
|
|
20
|
+
return enabled;
|
|
21
|
+
};
|
|
22
|
+
return /* @__PURE__ */ jsx(FeatureFlagContext.Provider, { value: { flags, isLoading, isFeatureEnabled }, children });
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
useFeatureFlag,
|
|
27
|
+
FeatureFlagProvider
|
|
28
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/lib/client/client.ts
|
|
2
|
+
import AcmeKit from "@acmekit/js-sdk";
|
|
3
|
+
var backendUrl = __BACKEND_URL__ ?? "/";
|
|
4
|
+
var authType = __AUTH_TYPE__ ?? "session";
|
|
5
|
+
var jwtTokenStorageKey = __JWT_TOKEN_STORAGE_KEY__ || void 0;
|
|
6
|
+
var sdk = new AcmeKit({
|
|
7
|
+
baseUrl: backendUrl,
|
|
8
|
+
auth: {
|
|
9
|
+
type: authType,
|
|
10
|
+
jwtTokenStorageKey
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
if (typeof window !== "undefined") {
|
|
14
|
+
;
|
|
15
|
+
window.__sdk = sdk;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
sdk
|
|
20
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import {
|
|
2
|
+
queryClient
|
|
3
|
+
} from "./chunk-FXYH54JP.mjs";
|
|
4
|
+
import {
|
|
5
|
+
queryKeysFactory
|
|
6
|
+
} from "./chunk-774WSTCC.mjs";
|
|
7
|
+
import {
|
|
8
|
+
sdk
|
|
9
|
+
} from "./chunk-DTY37DDZ.mjs";
|
|
10
|
+
|
|
11
|
+
// src/hooks/api/api-keys.tsx
|
|
12
|
+
import {
|
|
13
|
+
useMutation,
|
|
14
|
+
useQuery
|
|
15
|
+
} from "@tanstack/react-query";
|
|
16
|
+
var API_KEYS_QUERY_KEY = "api_keys";
|
|
17
|
+
var apiKeysQueryKeys = queryKeysFactory(API_KEYS_QUERY_KEY);
|
|
18
|
+
var useApiKey = (id, options) => {
|
|
19
|
+
const { data, ...rest } = useQuery({
|
|
20
|
+
queryFn: () => sdk.admin.apiKey.retrieve(id),
|
|
21
|
+
queryKey: apiKeysQueryKeys.detail(id),
|
|
22
|
+
...options
|
|
23
|
+
});
|
|
24
|
+
return { ...data, ...rest };
|
|
25
|
+
};
|
|
26
|
+
var useApiKeys = (query, options) => {
|
|
27
|
+
const { data, ...rest } = useQuery({
|
|
28
|
+
queryFn: () => sdk.admin.apiKey.list(query),
|
|
29
|
+
queryKey: apiKeysQueryKeys.list(query),
|
|
30
|
+
...options
|
|
31
|
+
});
|
|
32
|
+
return { ...data, ...rest };
|
|
33
|
+
};
|
|
34
|
+
var useCreateApiKey = (options) => {
|
|
35
|
+
return useMutation({
|
|
36
|
+
mutationFn: (payload) => sdk.admin.apiKey.create(payload),
|
|
37
|
+
onSuccess: (data, variables, context) => {
|
|
38
|
+
queryClient.invalidateQueries({ queryKey: apiKeysQueryKeys.lists() });
|
|
39
|
+
options?.onSuccess?.(data, variables, context);
|
|
40
|
+
},
|
|
41
|
+
...options
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var useUpdateApiKey = (id, options) => {
|
|
45
|
+
return useMutation({
|
|
46
|
+
mutationFn: (payload) => sdk.admin.apiKey.update(id, payload),
|
|
47
|
+
onSuccess: (data, variables, context) => {
|
|
48
|
+
queryClient.invalidateQueries({ queryKey: apiKeysQueryKeys.lists() });
|
|
49
|
+
queryClient.invalidateQueries({ queryKey: apiKeysQueryKeys.detail(id) });
|
|
50
|
+
options?.onSuccess?.(data, variables, context);
|
|
51
|
+
},
|
|
52
|
+
...options
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
var useRevokeApiKey = (id, options) => {
|
|
56
|
+
return useMutation({
|
|
57
|
+
mutationFn: () => sdk.admin.apiKey.revoke(id),
|
|
58
|
+
onSuccess: (data, variables, context) => {
|
|
59
|
+
queryClient.invalidateQueries({ queryKey: apiKeysQueryKeys.lists() });
|
|
60
|
+
queryClient.invalidateQueries({ queryKey: apiKeysQueryKeys.detail(id) });
|
|
61
|
+
options?.onSuccess?.(data, variables, context);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
var useDeleteApiKey = (id, options) => {
|
|
66
|
+
return useMutation({
|
|
67
|
+
mutationFn: () => sdk.admin.apiKey.delete(id),
|
|
68
|
+
onSuccess: (data, variables, context) => {
|
|
69
|
+
queryClient.invalidateQueries({ queryKey: apiKeysQueryKeys.lists() });
|
|
70
|
+
queryClient.invalidateQueries({ queryKey: apiKeysQueryKeys.detail(id) });
|
|
71
|
+
options?.onSuccess?.(data, variables, context);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
apiKeysQueryKeys,
|
|
78
|
+
useApiKey,
|
|
79
|
+
useApiKeys,
|
|
80
|
+
useCreateApiKey,
|
|
81
|
+
useUpdateApiKey,
|
|
82
|
+
useRevokeApiKey,
|
|
83
|
+
useDeleteApiKey
|
|
84
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/lib/query-client.ts
|
|
2
|
+
import { QueryClient } from "@tanstack/react-query";
|
|
3
|
+
var MEDUSA_BACKEND_URL = __BACKEND_URL__ ?? "/";
|
|
4
|
+
var queryClient = new QueryClient({
|
|
5
|
+
defaultOptions: {
|
|
6
|
+
queries: {
|
|
7
|
+
refetchOnWindowFocus: false,
|
|
8
|
+
staleTime: 9e4,
|
|
9
|
+
retry: 1
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
queryClient
|
|
16
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// src/routes/api-key-management/common/utils.ts
|
|
2
|
+
function getApiKeyTypeFromPathname(pathname) {
|
|
3
|
+
const isSecretKey = pathname.startsWith("/settings/secret-api-keys");
|
|
4
|
+
switch (isSecretKey) {
|
|
5
|
+
case true:
|
|
6
|
+
return "secret" /* SECRET */;
|
|
7
|
+
case false:
|
|
8
|
+
return "publishable" /* PUBLISHABLE */;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function getApiKeyStatusProps(revokedAt, t) {
|
|
12
|
+
if (!revokedAt) {
|
|
13
|
+
return {
|
|
14
|
+
color: "green",
|
|
15
|
+
label: t("apiKeyManagement.status.active")
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
color: "red",
|
|
20
|
+
label: t("apiKeyManagement.status.revoked")
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function getApiKeyTypeProps(type, t) {
|
|
24
|
+
if (type === "publishable" /* PUBLISHABLE */) {
|
|
25
|
+
return {
|
|
26
|
+
color: "green",
|
|
27
|
+
label: t("apiKeyManagement.type.publishable")
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
color: "blue",
|
|
32
|
+
label: t("apiKeyManagement.type.secret")
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
var prettifyRedactedToken = (token) => {
|
|
36
|
+
return token.replace("***", `\u2022\u2022\u2022`);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export {
|
|
40
|
+
getApiKeyTypeFromPathname,
|
|
41
|
+
getApiKeyStatusProps,
|
|
42
|
+
getApiKeyTypeProps,
|
|
43
|
+
prettifyRedactedToken
|
|
44
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// src/components/common/icon-avatar/icon-avatar.tsx
|
|
2
|
+
import { clx } from "@acmekit/ui";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var IconAvatar = ({
|
|
5
|
+
size = "small",
|
|
6
|
+
variant = "rounded",
|
|
7
|
+
children,
|
|
8
|
+
className
|
|
9
|
+
}) => {
|
|
10
|
+
return /* @__PURE__ */ jsx(
|
|
11
|
+
"div",
|
|
12
|
+
{
|
|
13
|
+
className: clx(
|
|
14
|
+
"shadow-borders-base flex size-7 items-center justify-center",
|
|
15
|
+
variant === "squared" && "rounded-md",
|
|
16
|
+
variant === "rounded" && "rounded-full",
|
|
17
|
+
"[&>div]:bg-ui-bg-field [&>div]:text-ui-fg-subtle [&>div]:flex [&>div]:size-6 [&>div]:items-center [&>div]:justify-center",
|
|
18
|
+
{
|
|
19
|
+
"size-7 rounded-md [&>div]:size-6 [&>div]:rounded-[4px]": size === "small",
|
|
20
|
+
"size-10 rounded-lg [&>div]:size-9 [&>div]:rounded-[6px]": size === "large",
|
|
21
|
+
"size-12 rounded-xl [&>div]:size-11 [&>div]:rounded-[10px]": size === "xlarge"
|
|
22
|
+
},
|
|
23
|
+
className
|
|
24
|
+
),
|
|
25
|
+
children: /* @__PURE__ */ jsx("div", { children })
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
IconAvatar
|
|
32
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sdk
|
|
3
|
+
} from "./chunk-DTY37DDZ.mjs";
|
|
4
|
+
|
|
5
|
+
// src/hooks/api/auth.tsx
|
|
6
|
+
import { useMutation } from "@tanstack/react-query";
|
|
7
|
+
var useSignInWithEmailPass = (options) => {
|
|
8
|
+
return useMutation({
|
|
9
|
+
mutationFn: (payload) => sdk.auth.login("user", "emailpass", payload),
|
|
10
|
+
onSuccess: async (data, variables, context) => {
|
|
11
|
+
options?.onSuccess?.(data, variables, context);
|
|
12
|
+
},
|
|
13
|
+
...options
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var useSignUpWithEmailPass = (options) => {
|
|
17
|
+
return useMutation({
|
|
18
|
+
mutationFn: (payload) => sdk.auth.register("user", "emailpass", payload),
|
|
19
|
+
onSuccess: async (data, variables, context) => {
|
|
20
|
+
options?.onSuccess?.(data, variables, context);
|
|
21
|
+
},
|
|
22
|
+
...options
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
var useResetPasswordForEmailPass = (options) => {
|
|
26
|
+
return useMutation({
|
|
27
|
+
mutationFn: (payload) => sdk.auth.resetPassword("user", "emailpass", {
|
|
28
|
+
identifier: payload.email
|
|
29
|
+
}),
|
|
30
|
+
onSuccess: async (data, variables, context) => {
|
|
31
|
+
options?.onSuccess?.(data, variables, context);
|
|
32
|
+
},
|
|
33
|
+
...options
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
var useLogout = (options) => {
|
|
37
|
+
return useMutation({
|
|
38
|
+
mutationFn: () => sdk.auth.logout(),
|
|
39
|
+
...options
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
var useUpdateProviderForEmailPass = (token, options) => {
|
|
43
|
+
return useMutation({
|
|
44
|
+
mutationFn: (payload) => sdk.auth.updateProvider("user", "emailpass", payload, token),
|
|
45
|
+
onSuccess: async (data, variables, context) => {
|
|
46
|
+
options?.onSuccess?.(data, variables, context);
|
|
47
|
+
},
|
|
48
|
+
...options
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export {
|
|
53
|
+
useSignInWithEmailPass,
|
|
54
|
+
useSignUpWithEmailPass,
|
|
55
|
+
useResetPasswordForEmailPass,
|
|
56
|
+
useLogout,
|
|
57
|
+
useUpdateProviderForEmailPass
|
|
58
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// src/components/common/skeleton/skeleton.tsx
|
|
2
|
+
import { Container, clx } from "@acmekit/ui";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
var Skeleton = ({ className, style }) => {
|
|
5
|
+
return /* @__PURE__ */ jsx(
|
|
6
|
+
"div",
|
|
7
|
+
{
|
|
8
|
+
"aria-hidden": true,
|
|
9
|
+
className: clx(
|
|
10
|
+
"bg-ui-bg-component h-3 w-3 animate-pulse rounded-[4px]",
|
|
11
|
+
className
|
|
12
|
+
),
|
|
13
|
+
style
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
var TableFooterSkeleton = ({ layout }) => {
|
|
18
|
+
return /* @__PURE__ */ jsxs(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
className: clx("flex items-center justify-between p-4", {
|
|
22
|
+
"border-t": layout === "fill"
|
|
23
|
+
}),
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-[138px]" }),
|
|
26
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
27
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-24" }),
|
|
28
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-11" }),
|
|
29
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-11" })
|
|
30
|
+
] })
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
var TableSkeleton = ({
|
|
36
|
+
rowCount = 10,
|
|
37
|
+
search = true,
|
|
38
|
+
filters = true,
|
|
39
|
+
orderBy = true,
|
|
40
|
+
pagination = true,
|
|
41
|
+
layout = "fit"
|
|
42
|
+
}) => {
|
|
43
|
+
const totalRowCount = rowCount + 1;
|
|
44
|
+
const rows = Array.from({ length: totalRowCount }, (_, i) => i);
|
|
45
|
+
const hasToolbar = search || filters || orderBy;
|
|
46
|
+
return /* @__PURE__ */ jsxs(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
"aria-hidden": true,
|
|
50
|
+
className: clx({
|
|
51
|
+
"flex h-full flex-col overflow-hidden": layout === "fill"
|
|
52
|
+
}),
|
|
53
|
+
children: [
|
|
54
|
+
hasToolbar && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-4", children: [
|
|
55
|
+
filters && /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-full max-w-[135px]" }),
|
|
56
|
+
(search || orderBy) && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
|
|
57
|
+
search && /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-[160px]" }),
|
|
58
|
+
orderBy && /* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-7" })
|
|
59
|
+
] })
|
|
60
|
+
] }),
|
|
61
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col divide-y border-y", children: rows.map((row) => /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-full rounded-none" }, row)) }),
|
|
62
|
+
pagination && /* @__PURE__ */ jsx(TableFooterSkeleton, { layout })
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
var SingleColumnPageSkeleton = ({
|
|
68
|
+
sections = 2,
|
|
69
|
+
showJSON = false,
|
|
70
|
+
showMetadata = false
|
|
71
|
+
}) => {
|
|
72
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-3", children: [
|
|
73
|
+
Array.from({ length: sections }, (_, i) => i).map((section) => {
|
|
74
|
+
return /* @__PURE__ */ jsx(
|
|
75
|
+
Skeleton,
|
|
76
|
+
{
|
|
77
|
+
className: clx("h-full max-h-[460px] w-full rounded-lg", {
|
|
78
|
+
// First section is smaller on most pages, this gives us less
|
|
79
|
+
// layout shifting in general,
|
|
80
|
+
"max-h-[219px]": section === 0
|
|
81
|
+
})
|
|
82
|
+
},
|
|
83
|
+
section
|
|
84
|
+
);
|
|
85
|
+
}),
|
|
86
|
+
showMetadata && /* @__PURE__ */ jsx(Skeleton, { className: "h-[60px] w-full rounded-lg" }),
|
|
87
|
+
showJSON && /* @__PURE__ */ jsx(Skeleton, { className: "h-[60px] w-full rounded-lg" })
|
|
88
|
+
] });
|
|
89
|
+
};
|
|
90
|
+
var TwoColumnPageSkeleton = ({
|
|
91
|
+
mainSections = 2,
|
|
92
|
+
sidebarSections = 1,
|
|
93
|
+
showJSON = false,
|
|
94
|
+
showMetadata = true
|
|
95
|
+
}) => {
|
|
96
|
+
const showExtraData = showJSON || showMetadata;
|
|
97
|
+
return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-y-3", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-x-4 gap-y-3 xl:flex-row xl:items-start", children: [
|
|
98
|
+
/* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-y-3", children: [
|
|
99
|
+
Array.from({ length: mainSections }, (_, i) => i).map((section) => {
|
|
100
|
+
return /* @__PURE__ */ jsx(
|
|
101
|
+
Skeleton,
|
|
102
|
+
{
|
|
103
|
+
className: clx("h-full max-h-[460px] w-full rounded-lg", {
|
|
104
|
+
"max-h-[219px]": section === 0
|
|
105
|
+
})
|
|
106
|
+
},
|
|
107
|
+
section
|
|
108
|
+
);
|
|
109
|
+
}),
|
|
110
|
+
showExtraData && /* @__PURE__ */ jsxs("div", { className: "hidden flex-col gap-y-3 xl:flex", children: [
|
|
111
|
+
showMetadata && /* @__PURE__ */ jsx(Skeleton, { className: "h-[60px] w-full rounded-lg" }),
|
|
112
|
+
showJSON && /* @__PURE__ */ jsx(Skeleton, { className: "h-[60px] w-full rounded-lg" })
|
|
113
|
+
] })
|
|
114
|
+
] }),
|
|
115
|
+
/* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[100%] flex-col gap-y-3 xl:mt-0 xl:max-w-[440px]", children: [
|
|
116
|
+
Array.from({ length: sidebarSections }, (_, i) => i).map(
|
|
117
|
+
(section) => {
|
|
118
|
+
return /* @__PURE__ */ jsx(
|
|
119
|
+
Skeleton,
|
|
120
|
+
{
|
|
121
|
+
className: clx("h-full max-h-[320px] w-full rounded-lg", {
|
|
122
|
+
"max-h-[140px]": section === 0
|
|
123
|
+
})
|
|
124
|
+
},
|
|
125
|
+
section
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
),
|
|
129
|
+
showExtraData && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-3 xl:hidden", children: [
|
|
130
|
+
showMetadata && /* @__PURE__ */ jsx(Skeleton, { className: "h-[60px] w-full rounded-lg" }),
|
|
131
|
+
showJSON && /* @__PURE__ */ jsx(Skeleton, { className: "h-[60px] w-full rounded-lg" })
|
|
132
|
+
] })
|
|
133
|
+
] })
|
|
134
|
+
] }) });
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export {
|
|
138
|
+
Skeleton,
|
|
139
|
+
TableSkeleton,
|
|
140
|
+
SingleColumnPageSkeleton,
|
|
141
|
+
TwoColumnPageSkeleton
|
|
142
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
queryKeysFactory
|
|
3
|
+
} from "./chunk-774WSTCC.mjs";
|
|
4
|
+
import {
|
|
5
|
+
sdk
|
|
6
|
+
} from "./chunk-DTY37DDZ.mjs";
|
|
7
|
+
|
|
8
|
+
// src/hooks/api/workflow-executions.tsx
|
|
9
|
+
import { useQuery } from "@tanstack/react-query";
|
|
10
|
+
var WORKFLOW_EXECUTIONS_QUERY_KEY = "workflow_executions";
|
|
11
|
+
var workflowExecutionsQueryKeys = queryKeysFactory(
|
|
12
|
+
WORKFLOW_EXECUTIONS_QUERY_KEY
|
|
13
|
+
);
|
|
14
|
+
var useWorkflowExecutions = (query, options) => {
|
|
15
|
+
const { data, ...rest } = useQuery({
|
|
16
|
+
queryFn: () => sdk.admin.workflowExecution.list(query),
|
|
17
|
+
queryKey: workflowExecutionsQueryKeys.list(query),
|
|
18
|
+
...options
|
|
19
|
+
});
|
|
20
|
+
return { ...data, ...rest };
|
|
21
|
+
};
|
|
22
|
+
var useWorkflowExecution = (id, options) => {
|
|
23
|
+
const { data, ...rest } = useQuery({
|
|
24
|
+
queryFn: () => sdk.admin.workflowExecution.retrieve(id),
|
|
25
|
+
queryKey: workflowExecutionsQueryKeys.detail(id),
|
|
26
|
+
...options
|
|
27
|
+
});
|
|
28
|
+
return { ...data, ...rest };
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
workflowExecutionsQueryKeys,
|
|
33
|
+
useWorkflowExecutions,
|
|
34
|
+
useWorkflowExecution
|
|
35
|
+
};
|