@acmekit/dashboard 2.13.6 → 2.13.8
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 +170 -0
- package/dist/api-key-management-detail-QURSBB6T.mjs +307 -0
- package/dist/api-key-management-edit-GG5V77GY.mjs +106 -0
- package/dist/api-key-management-list-PL64LD22.mjs +400 -0
- package/dist/app.js +16930 -1004
- package/dist/app.mjs +793 -884
- package/dist/chunk-22YYMH6M.mjs +382 -0
- package/dist/chunk-2U3RK3JG.mjs +474 -0
- package/dist/chunk-535OVBXR.mjs +226 -0
- package/dist/chunk-6SQCO25J.mjs +65 -0
- package/dist/chunk-774WSTCC.mjs +19 -0
- package/dist/chunk-7ZHDHEUH.mjs +1837 -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-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-OHAFITSB.mjs +54 -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-TCNCAWYD.mjs +9 -0
- package/dist/chunk-ULSPL3DR.mjs +126 -0
- package/dist/chunk-VBT5YZ4K.mjs +129 -0
- package/dist/chunk-WILMJYUB.mjs +35 -0
- package/dist/chunk-XIM7X4FB.mjs +83 -0
- package/dist/chunk-YB52HEIR.mjs +387 -0
- package/dist/chunk-YRWSG3YM.mjs +80 -0
- package/dist/{invite-S5USGDOZ.mjs → invite-BAFXQBLJ.mjs} +15 -7
- package/dist/{login-BRUR5XXN.mjs → login-YURMNRCS.mjs} +23 -9
- package/dist/profile-detail-SJWODS2K.mjs +96 -0
- package/dist/profile-edit-HSGF4UXZ.mjs +173 -0
- package/dist/{reset-password-UQPRHMB3.mjs → reset-password-RQ5M7HQC.mjs} +8 -4
- package/dist/settings-3XWLL5LG.mjs +545 -0
- package/dist/store-detail-SQKV5KBD.mjs +109 -0
- package/dist/store-edit-WGGIJMYJ.mjs +97 -0
- package/dist/store-metadata-CSBUGX6Z.mjs +49 -0
- package/dist/translation-list-H5X4DVCC.mjs +587 -0
- package/dist/translations-edit-NPAUN2GZ.mjs +5376 -0
- package/dist/user-detail-7SUQ35G7.mjs +169 -0
- package/dist/user-edit-KUZV37AH.mjs +114 -0
- package/dist/user-invite-OREFWWYL.mjs +361 -0
- package/dist/user-list-OWUR75OP.mjs +1116 -0
- package/dist/user-metadata-QHUX5SHZ.mjs +51 -0
- package/dist/workflow-execution-detail-MWNM25TF.mjs +820 -0
- package/dist/workflow-execution-list-IGYF44UH.mjs +175 -0
- package/package.json +9 -9
- package/src/components/layout/settings-layout/settings-layout.tsx +74 -6
- package/src/dashboard-app/routes/get-route.map.tsx +225 -0
- package/src/routes/login/login.tsx +1 -1
- package/dist/chunk-FBTP4AJM.mjs +0 -221
- package/dist/chunk-NQEMGMWU.mjs +0 -159
- package/dist/chunk-QYOO4QR6.mjs +0 -73
- package/dist/login-AIMR26AL.mjs +0 -291
|
@@ -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,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
|
+
};
|
|
@@ -1,69 +1,3 @@
|
|
|
1
|
-
// src/hooks/api/auth.tsx
|
|
2
|
-
import { useMutation } from "@tanstack/react-query";
|
|
3
|
-
|
|
4
|
-
// src/lib/client/client.ts
|
|
5
|
-
import AcmeKit from "@acmekit/js-sdk";
|
|
6
|
-
var backendUrl = __BACKEND_URL__ ?? "/";
|
|
7
|
-
var authType = __AUTH_TYPE__ ?? "session";
|
|
8
|
-
var jwtTokenStorageKey = __JWT_TOKEN_STORAGE_KEY__ || void 0;
|
|
9
|
-
var sdk = new AcmeKit({
|
|
10
|
-
baseUrl: backendUrl,
|
|
11
|
-
auth: {
|
|
12
|
-
type: authType,
|
|
13
|
-
jwtTokenStorageKey
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
if (typeof window !== "undefined") {
|
|
17
|
-
;
|
|
18
|
-
window.__sdk = sdk;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// src/hooks/api/auth.tsx
|
|
22
|
-
var useSignInWithEmailPass = (options) => {
|
|
23
|
-
return useMutation({
|
|
24
|
-
mutationFn: (payload) => sdk.auth.login("user", "emailpass", payload),
|
|
25
|
-
onSuccess: async (data, variables, context) => {
|
|
26
|
-
options?.onSuccess?.(data, variables, context);
|
|
27
|
-
},
|
|
28
|
-
...options
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
var useSignUpWithEmailPass = (options) => {
|
|
32
|
-
return useMutation({
|
|
33
|
-
mutationFn: (payload) => sdk.auth.register("user", "emailpass", payload),
|
|
34
|
-
onSuccess: async (data, variables, context) => {
|
|
35
|
-
options?.onSuccess?.(data, variables, context);
|
|
36
|
-
},
|
|
37
|
-
...options
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
var useResetPasswordForEmailPass = (options) => {
|
|
41
|
-
return useMutation({
|
|
42
|
-
mutationFn: (payload) => sdk.auth.resetPassword("user", "emailpass", {
|
|
43
|
-
identifier: payload.email
|
|
44
|
-
}),
|
|
45
|
-
onSuccess: async (data, variables, context) => {
|
|
46
|
-
options?.onSuccess?.(data, variables, context);
|
|
47
|
-
},
|
|
48
|
-
...options
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
var useLogout = (options) => {
|
|
52
|
-
return useMutation({
|
|
53
|
-
mutationFn: () => sdk.auth.logout(),
|
|
54
|
-
...options
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
var useUpdateProviderForEmailPass = (token, options) => {
|
|
58
|
-
return useMutation({
|
|
59
|
-
mutationFn: (payload) => sdk.auth.updateProvider("user", "emailpass", payload, token),
|
|
60
|
-
onSuccess: async (data, variables, context) => {
|
|
61
|
-
options?.onSuccess?.(data, variables, context);
|
|
62
|
-
},
|
|
63
|
-
...options
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
|
|
67
1
|
// src/components/common/form/form.tsx
|
|
68
2
|
import { InformationCircleSolid } from "@acmekit/icons";
|
|
69
3
|
import {
|
|
@@ -223,11 +157,5 @@ var Form = Object.assign(Provider, {
|
|
|
223
157
|
});
|
|
224
158
|
|
|
225
159
|
export {
|
|
226
|
-
sdk,
|
|
227
|
-
useSignInWithEmailPass,
|
|
228
|
-
useSignUpWithEmailPass,
|
|
229
|
-
useResetPasswordForEmailPass,
|
|
230
|
-
useLogout,
|
|
231
|
-
useUpdateProviderForEmailPass,
|
|
232
160
|
Form
|
|
233
161
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/components/common/conditional-tooltip/conditional-tooltip.tsx
|
|
2
|
+
import { Tooltip } from "@acmekit/ui";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var ConditionalTooltip = ({
|
|
5
|
+
children,
|
|
6
|
+
showTooltip = false,
|
|
7
|
+
...props
|
|
8
|
+
}) => {
|
|
9
|
+
if (showTooltip) {
|
|
10
|
+
return /* @__PURE__ */ jsx(Tooltip, { ...props, children });
|
|
11
|
+
}
|
|
12
|
+
return children;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
ConditionalTooltip
|
|
17
|
+
};
|