@wix/cli-app 1.1.55 → 1.1.56
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/build/CreateVersionCommand-LU6LUBNT.js +269 -0
- package/build/{CreateVersionCommand-XTZT5DED.js.map → CreateVersionCommand-LU6LUBNT.js.map} +1 -1
- package/build/DevCommand-G2BIT4FY.js +1168 -0
- package/build/{DevCommand-Q5XLAGMG.js.map → DevCommand-G2BIT4FY.js.map} +1 -1
- package/build/GenerateCommand-XKWJ2FEG.js +12392 -0
- package/build/GenerateCommand-XKWJ2FEG.js.map +1 -0
- package/build/LogsCommand-HYGDI5KW.js +284 -0
- package/build/{LogsCommand-XJHE75L2.js.map → LogsCommand-HYGDI5KW.js.map} +1 -1
- package/build/PreviewCommand-6EMIKGQN.js +23 -0
- package/build/ServeCommand-YJ5RHQZ4.js +165 -0
- package/build/{ServeCommand-CPZOI7DC.js.map → ServeCommand-YJ5RHQZ4.js.map} +1 -1
- package/build/build-EC7LZLAY.js +3596 -0
- package/build/{build-D3GVJS75.js.map → build-EC7LZLAY.js.map} +1 -1
- package/build/build-Q5P6MZLW.js +97 -0
- package/build/{build-3RXHADZD.js.map → build-Q5P6MZLW.js.map} +1 -1
- package/build/chunk-3KMSVIRS.js +1323 -0
- package/build/{chunk-LJEYXY4V.js.map → chunk-3KMSVIRS.js.map} +1 -1
- package/build/chunk-FH6U3Y37.js +19 -0
- package/build/chunk-FH6U3Y37.js.map +1 -0
- package/build/chunk-GIUEJUXG.js +151 -0
- package/build/{chunk-6HSUK2A2.js.map → chunk-GIUEJUXG.js.map} +1 -1
- package/build/chunk-IJVKSYIY.js +222 -0
- package/build/chunk-IJVKSYIY.js.map +1 -0
- package/build/chunk-IMNXLCE5.js +51 -0
- package/build/{chunk-HDXLQ34N.js.map → chunk-IMNXLCE5.js.map} +1 -1
- package/build/chunk-IWDISZ2R.js +96 -0
- package/build/{chunk-K2A77MMN.js.map → chunk-IWDISZ2R.js.map} +1 -1
- package/build/chunk-JKI4MP27.js +32 -0
- package/build/{chunk-QOUZ6J7N.js.map → chunk-JKI4MP27.js.map} +1 -1
- package/build/chunk-JOVPQ7BW.js +183 -0
- package/build/{chunk-X4BLMM2K.js.map → chunk-JOVPQ7BW.js.map} +1 -1
- package/build/chunk-KCMEJP7H.js +897 -0
- package/build/{chunk-7VOKCPZP.js.map → chunk-KCMEJP7H.js.map} +1 -1
- package/build/chunk-NDFUPX6I.js +635 -0
- package/build/{chunk-GWU77DPO.js.map → chunk-NDFUPX6I.js.map} +1 -1
- package/build/chunk-NUUM6HPA.js +195 -0
- package/build/{chunk-C4SXZWXS.js.map → chunk-NUUM6HPA.js.map} +1 -1
- package/build/chunk-PYIAC2GK.js +66 -0
- package/build/{chunk-V4TR6DCM.js.map → chunk-PYIAC2GK.js.map} +1 -1
- package/build/chunk-QICLTOEP.js +46 -0
- package/build/{chunk-4BHNJVL2.js.map → chunk-QICLTOEP.js.map} +1 -1
- package/build/chunk-QLZPVGJV.js +29 -0
- package/build/{chunk-KG7BHEJG.js.map → chunk-QLZPVGJV.js.map} +1 -1
- package/build/chunk-QZOQAFHK.js +2197 -0
- package/build/chunk-QZOQAFHK.js.map +1 -0
- package/build/chunk-SP37PQ3I.js +38035 -0
- package/build/{chunk-N5D4TFKX.js.map → chunk-SP37PQ3I.js.map} +1 -1
- package/build/chunk-TSFNDZPX.js +39101 -0
- package/build/chunk-TSFNDZPX.js.map +1 -0
- package/build/chunk-TTW4MEC3.js +104 -0
- package/build/{chunk-FKBCPMYK.js.map → chunk-TTW4MEC3.js.map} +1 -1
- package/build/chunk-U4QPSXJP.js +45 -0
- package/build/{chunk-B4SDDVMV.js.map → chunk-U4QPSXJP.js.map} +1 -1
- package/build/chunk-WG365AHZ.js +23 -0
- package/build/{chunk-2FB5F5QF.js.map → chunk-WG365AHZ.js.map} +1 -1
- package/build/chunk-XU5JBKO6.js +29230 -0
- package/build/chunk-XU5JBKO6.js.map +1 -0
- package/build/cloudflare-runtime/entry.js +1 -1
- package/build/cloudflare-runtime/getRegisteredExtensions.js +1 -1
- package/build/devtools-YPSDP32D.js +3702 -0
- package/build/{devtools-4JFNYU2B.js.map → devtools-YPSDP32D.js.map} +1 -1
- package/build/esm-YQVNLOAI.js +22083 -0
- package/build/{esm-HBMYQBEO.js.map → esm-YQVNLOAI.js.map} +1 -1
- package/build/index.js +3252 -21
- package/build/index.js.map +1 -1
- package/build/platform-sdk/chunk-DGX4CFXG.js +2 -0
- package/build/platform-sdk/chunk-DGX4CFXG.js.map +1 -0
- package/build/platform-sdk/chunk-TN6HYRXL.js +2 -0
- package/build/platform-sdk/chunk-TN6HYRXL.js.map +1 -0
- package/build/platform-sdk/dashboard.js +1 -1
- package/build/platform-sdk/dashboard.js.map +1 -1
- package/build/platform-sdk/editor.js +5 -5
- package/build/platform-sdk/editor.js.map +1 -1
- package/build/platform-sdk/site.js +1 -1
- package/build/preview-HPJCC5SU.js +138 -0
- package/build/{preview-TM7JAWFS.js.map → preview-HPJCC5SU.js.map} +1 -1
- package/build/render-command-BJTVLIM5.js +117 -0
- package/build/{render-command-QEQ3L7OX.js.map → render-command-BJTVLIM5.js.map} +1 -1
- package/build/types.impl-CD4WWRUK.js +10 -0
- package/package.json +10 -5
- package/templates/custom-element/dependencies.json +1 -1
- package/templates/dashboard-modal/dependencies.json +1 -1
- package/templates/site-plugin/dependencies.json +1 -1
- package/build/CreateVersionCommand-XTZT5DED.js +0 -4
- package/build/DevCommand-Q5XLAGMG.js +0 -4
- package/build/GenerateCommand-HNFICZJA.js +0 -128
- package/build/GenerateCommand-HNFICZJA.js.map +0 -1
- package/build/LogsCommand-XJHE75L2.js +0 -4
- package/build/PreviewCommand-JKPFMGWV.js +0 -4
- package/build/ServeCommand-CPZOI7DC.js +0 -4
- package/build/build-3RXHADZD.js +0 -4
- package/build/build-D3GVJS75.js +0 -5
- package/build/chunk-2FB5F5QF.js +0 -4
- package/build/chunk-4BHNJVL2.js +0 -4
- package/build/chunk-5OZZ7R6I.js +0 -11
- package/build/chunk-5OZZ7R6I.js.map +0 -1
- package/build/chunk-6HSUK2A2.js +0 -4
- package/build/chunk-7VOKCPZP.js +0 -5
- package/build/chunk-B4SDDVMV.js +0 -4
- package/build/chunk-C4SXZWXS.js +0 -4
- package/build/chunk-FKBCPMYK.js +0 -11
- package/build/chunk-FMIXY6J5.js +0 -115
- package/build/chunk-FMIXY6J5.js.map +0 -1
- package/build/chunk-GWU77DPO.js +0 -4
- package/build/chunk-HDXLQ34N.js +0 -4
- package/build/chunk-JXE3LQ2S.js +0 -100
- package/build/chunk-JXE3LQ2S.js.map +0 -1
- package/build/chunk-K2A77MMN.js +0 -4
- package/build/chunk-KG7BHEJG.js +0 -4
- package/build/chunk-LJEYXY4V.js +0 -4
- package/build/chunk-N5D4TFKX.js +0 -280
- package/build/chunk-PCBMS46R.js +0 -4
- package/build/chunk-PCBMS46R.js.map +0 -1
- package/build/chunk-QOUZ6J7N.js +0 -4
- package/build/chunk-V4TR6DCM.js +0 -4
- package/build/chunk-WJTPY35F.js +0 -9
- package/build/chunk-WJTPY35F.js.map +0 -1
- package/build/chunk-X4BLMM2K.js +0 -4
- package/build/devtools-4JFNYU2B.js +0 -10
- package/build/esm-HBMYQBEO.js +0 -466
- package/build/platform-sdk/chunk-GZP4Z76C.js +0 -2
- package/build/platform-sdk/chunk-GZP4Z76C.js.map +0 -1
- package/build/platform-sdk/chunk-KGLNBMRO.js +0 -2
- package/build/platform-sdk/chunk-KGLNBMRO.js.map +0 -1
- package/build/preview-TM7JAWFS.js +0 -4
- package/build/render-command-QEQ3L7OX.js +0 -4
- package/build/types.impl-L2DPGJ77.js +0 -4
- /package/build/{PreviewCommand-JKPFMGWV.js.map → PreviewCommand-6EMIKGQN.js.map} +0 -0
- /package/build/{types.impl-L2DPGJ77.js.map → types.impl-CD4WWRUK.js.map} +0 -0
|
@@ -0,0 +1,1168 @@
|
|
|
1
|
+
import { createRequire as _createRequire } from 'node:module';
|
|
2
|
+
const require = _createRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
SiteProvider,
|
|
5
|
+
SiteSelector,
|
|
6
|
+
useMetasiteManagerClient,
|
|
7
|
+
usePlatform
|
|
8
|
+
} from "./chunk-NDFUPX6I.js";
|
|
9
|
+
import {
|
|
10
|
+
useWixCliAppBi
|
|
11
|
+
} from "./chunk-QLZPVGJV.js";
|
|
12
|
+
import {
|
|
13
|
+
createLogger
|
|
14
|
+
} from "./chunk-IMNXLCE5.js";
|
|
15
|
+
import {
|
|
16
|
+
DevEnvironmentProvider,
|
|
17
|
+
redirectWithCSMv2FTs,
|
|
18
|
+
useARMClient,
|
|
19
|
+
useArmTag,
|
|
20
|
+
useDevEnvironment,
|
|
21
|
+
useOpenPage,
|
|
22
|
+
useResolveDashboardExtensionDevUrl,
|
|
23
|
+
useResolvePlatformDevUrl,
|
|
24
|
+
useSite
|
|
25
|
+
} from "./chunk-3KMSVIRS.js";
|
|
26
|
+
import {
|
|
27
|
+
useBackendComponents
|
|
28
|
+
} from "./chunk-U4QPSXJP.js";
|
|
29
|
+
import "./chunk-KCMEJP7H.js";
|
|
30
|
+
import "./chunk-QZOQAFHK.js";
|
|
31
|
+
import "./chunk-TTW4MEC3.js";
|
|
32
|
+
import {
|
|
33
|
+
createCustomElementConfig
|
|
34
|
+
} from "./chunk-SP37PQ3I.js";
|
|
35
|
+
import "./chunk-NUUM6HPA.js";
|
|
36
|
+
import {
|
|
37
|
+
ComponentType,
|
|
38
|
+
DevCenterComponent,
|
|
39
|
+
ErrorViewer,
|
|
40
|
+
PlatformType,
|
|
41
|
+
USER_CONFIG_FILENAME,
|
|
42
|
+
getDataDirPath,
|
|
43
|
+
openBrowser,
|
|
44
|
+
pathExists,
|
|
45
|
+
readJson,
|
|
46
|
+
useBiLogger,
|
|
47
|
+
useDevCenterClient,
|
|
48
|
+
useErrorReporter,
|
|
49
|
+
useExtensions,
|
|
50
|
+
useHttpClient,
|
|
51
|
+
useProjectModel,
|
|
52
|
+
userConfigSchema,
|
|
53
|
+
writeJson
|
|
54
|
+
} from "./chunk-TSFNDZPX.js";
|
|
55
|
+
import {
|
|
56
|
+
Alert,
|
|
57
|
+
Box_default,
|
|
58
|
+
CliError,
|
|
59
|
+
CliErrorCode,
|
|
60
|
+
ConfirmInput,
|
|
61
|
+
Key,
|
|
62
|
+
Link,
|
|
63
|
+
PointerIcon,
|
|
64
|
+
PointerSmallIcon,
|
|
65
|
+
SelectInput,
|
|
66
|
+
Spinner,
|
|
67
|
+
Text,
|
|
68
|
+
Trans,
|
|
69
|
+
getTestOverrides,
|
|
70
|
+
require_lib,
|
|
71
|
+
require_react,
|
|
72
|
+
useAsync,
|
|
73
|
+
useAsyncCallback,
|
|
74
|
+
useExit,
|
|
75
|
+
useTranslation,
|
|
76
|
+
use_input_default
|
|
77
|
+
} from "./chunk-XU5JBKO6.js";
|
|
78
|
+
import {
|
|
79
|
+
__toESM,
|
|
80
|
+
init_esm_shims
|
|
81
|
+
} from "./chunk-PYIAC2GK.js";
|
|
82
|
+
|
|
83
|
+
// src/components/DevCommand/index.ts
|
|
84
|
+
init_esm_shims();
|
|
85
|
+
|
|
86
|
+
// src/components/DevCommand/DevCommand.tsx
|
|
87
|
+
init_esm_shims();
|
|
88
|
+
var import_react17 = __toESM(require_react(), 1);
|
|
89
|
+
|
|
90
|
+
// src/components/DevCommand/DevCommandScreens.tsx
|
|
91
|
+
init_esm_shims();
|
|
92
|
+
var import_react12 = __toESM(require_react(), 1);
|
|
93
|
+
var import_variant10 = __toESM(require_lib(), 1);
|
|
94
|
+
|
|
95
|
+
// src/components/DevCommand/HomeScreen.tsx
|
|
96
|
+
init_esm_shims();
|
|
97
|
+
var import_react7 = __toESM(require_react(), 1);
|
|
98
|
+
var import_variant6 = __toESM(require_lib(), 1);
|
|
99
|
+
|
|
100
|
+
// src/components/DevCommand/screen-state.ts
|
|
101
|
+
init_esm_shims();
|
|
102
|
+
var import_variant = __toESM(require_lib(), 1);
|
|
103
|
+
var ScreenState = (0, import_variant.variant)({
|
|
104
|
+
Home: {},
|
|
105
|
+
SiteSelector: {},
|
|
106
|
+
DashboardScreen: (0, import_variant.fields)(),
|
|
107
|
+
BackendScreen: (0, import_variant.fields)()
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// src/components/Platform/PlatformSelector.tsx
|
|
111
|
+
init_esm_shims();
|
|
112
|
+
var import_react = __toESM(require_react(), 1);
|
|
113
|
+
var PlatformOption = ({
|
|
114
|
+
label,
|
|
115
|
+
inputKey,
|
|
116
|
+
suffix,
|
|
117
|
+
disabled
|
|
118
|
+
}) => {
|
|
119
|
+
const getTextSkin = () => disabled ? "secondary" : "standard";
|
|
120
|
+
return /* @__PURE__ */ import_react.default.createElement(Box_default, null, /* @__PURE__ */ import_react.default.createElement(Box_default, { marginRight: 1 }, /* @__PURE__ */ import_react.default.createElement(Box_default, { marginRight: 1 }, /* @__PURE__ */ import_react.default.createElement(Text, { skin: getTextSkin() }, /* @__PURE__ */ import_react.default.createElement(PointerSmallIcon, null), " ", /* @__PURE__ */ import_react.default.createElement(Key, { value: inputKey }), " -")), /* @__PURE__ */ import_react.default.createElement(Box_default, { gap: 1 }, /* @__PURE__ */ import_react.default.createElement(Text, { skin: getTextSkin() }, label))), /* @__PURE__ */ import_react.default.createElement(Text, { skin: getTextSkin() }, suffix));
|
|
121
|
+
};
|
|
122
|
+
var PlatformSelector = ({
|
|
123
|
+
onMultipleDashboardExtensionSelection
|
|
124
|
+
}) => {
|
|
125
|
+
const { t } = useTranslation();
|
|
126
|
+
const bi = useWixCliAppBi();
|
|
127
|
+
const { isPlatformExists } = usePlatform();
|
|
128
|
+
const { dashboardExtensions } = useExtensions();
|
|
129
|
+
const resolvePlatformUrl = useResolvePlatformDevUrl();
|
|
130
|
+
const resolveDashboardExtensionUrl = useResolveDashboardExtensionDevUrl();
|
|
131
|
+
const { site } = useSite();
|
|
132
|
+
const openPage = useOpenPage();
|
|
133
|
+
const openPlatform = (0, import_react.useCallback)(
|
|
134
|
+
async (platformType) => {
|
|
135
|
+
await openPage({
|
|
136
|
+
title: platformType.type,
|
|
137
|
+
url: resolvePlatformUrl(platformType)
|
|
138
|
+
});
|
|
139
|
+
},
|
|
140
|
+
[openPage, resolvePlatformUrl]
|
|
141
|
+
);
|
|
142
|
+
use_input_default(async (input) => {
|
|
143
|
+
if (input === "d" && isPlatformExists(PlatformType.Dashboard())) {
|
|
144
|
+
bi.cliAction({
|
|
145
|
+
question: t("general.view_changes"),
|
|
146
|
+
questionKey: "general.view_changes",
|
|
147
|
+
action: t("general.platform.dashboard"),
|
|
148
|
+
key: input
|
|
149
|
+
});
|
|
150
|
+
if (dashboardExtensions.length === 1) {
|
|
151
|
+
await openPage({
|
|
152
|
+
title: "Dashboard",
|
|
153
|
+
url: resolveDashboardExtensionUrl(dashboardExtensions[0])
|
|
154
|
+
});
|
|
155
|
+
} else {
|
|
156
|
+
onMultipleDashboardExtensionSelection();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (input === "e" && isPlatformExists(PlatformType.Editor())) {
|
|
160
|
+
bi.cliAction({
|
|
161
|
+
question: t("general.view_changes"),
|
|
162
|
+
questionKey: "general.view_changes",
|
|
163
|
+
action: t("general.platform.editor"),
|
|
164
|
+
key: input
|
|
165
|
+
});
|
|
166
|
+
await openPlatform(PlatformType.Editor());
|
|
167
|
+
}
|
|
168
|
+
if (input === "s" && site.viewUrl && isPlatformExists(PlatformType.Site())) {
|
|
169
|
+
bi.cliAction({
|
|
170
|
+
question: t("general.view_changes"),
|
|
171
|
+
questionKey: "general.view_changes",
|
|
172
|
+
action: t("general.platform.site"),
|
|
173
|
+
key: input
|
|
174
|
+
});
|
|
175
|
+
await openPlatform(PlatformType.Site());
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
const dashboardOptionSuffix = (0, import_react.useMemo)(() => {
|
|
179
|
+
if (dashboardExtensions.length === 0) {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
if (dashboardExtensions.length === 1) {
|
|
183
|
+
return /* @__PURE__ */ import_react.default.createElement(Text, { skin: "secondary" }, " - ", dashboardExtensions[0].route);
|
|
184
|
+
}
|
|
185
|
+
return /* @__PURE__ */ import_react.default.createElement(Text, null, String.fromCodePoint(9660));
|
|
186
|
+
}, [dashboardExtensions]);
|
|
187
|
+
return /* @__PURE__ */ import_react.default.createElement(Box_default, { paddingLeft: 2, flexDirection: "column" }, isPlatformExists(PlatformType.Site()) && /* @__PURE__ */ import_react.default.createElement(
|
|
188
|
+
PlatformOption,
|
|
189
|
+
{
|
|
190
|
+
inputKey: "S",
|
|
191
|
+
label: site.viewUrl ? t("general.platform.site") : t("general.platform.unpublished_site"),
|
|
192
|
+
disabled: !site.viewUrl
|
|
193
|
+
}
|
|
194
|
+
), isPlatformExists(PlatformType.Editor()) && /* @__PURE__ */ import_react.default.createElement(PlatformOption, { inputKey: "E", label: t("general.platform.editor") }), isPlatformExists(PlatformType.Dashboard()) && /* @__PURE__ */ import_react.default.createElement(
|
|
195
|
+
PlatformOption,
|
|
196
|
+
{
|
|
197
|
+
inputKey: "D",
|
|
198
|
+
label: t("general.platform.dashboard"),
|
|
199
|
+
suffix: dashboardOptionSuffix
|
|
200
|
+
}
|
|
201
|
+
));
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
// src/components/DevCommand/DashboardNumericViewer.tsx
|
|
205
|
+
init_esm_shims();
|
|
206
|
+
var import_react6 = __toESM(require_react(), 1);
|
|
207
|
+
var import_variant5 = __toESM(require_lib(), 1);
|
|
208
|
+
|
|
209
|
+
// src/components/CloseScreen/CloseScreen.tsx
|
|
210
|
+
init_esm_shims();
|
|
211
|
+
var import_react2 = __toESM(require_react(), 1);
|
|
212
|
+
var CloseScreen = ({ onClose }) => {
|
|
213
|
+
const { t } = useTranslation();
|
|
214
|
+
const bi = useWixCliAppBi();
|
|
215
|
+
use_input_default((_, key) => {
|
|
216
|
+
if (key.escape) {
|
|
217
|
+
bi.cliAction({
|
|
218
|
+
question: t("general.close_screen"),
|
|
219
|
+
questionKey: "general.close_screen",
|
|
220
|
+
action: "close",
|
|
221
|
+
key: "esc"
|
|
222
|
+
});
|
|
223
|
+
onClose();
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
return /* @__PURE__ */ import_react2.default.createElement(Text, { skin: "secondary" }, /* @__PURE__ */ import_react2.default.createElement(
|
|
227
|
+
Trans,
|
|
228
|
+
{
|
|
229
|
+
i18nKey: "general.close_screen",
|
|
230
|
+
components: [/* @__PURE__ */ import_react2.default.createElement(Key, { value: "esc", skin: "secondary" })]
|
|
231
|
+
}
|
|
232
|
+
));
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
// src/components/DevCommand/DashboardScreen.tsx
|
|
236
|
+
init_esm_shims();
|
|
237
|
+
var import_react4 = __toESM(require_react(), 1);
|
|
238
|
+
var import_variant3 = __toESM(require_lib(), 1);
|
|
239
|
+
|
|
240
|
+
// src/components/DevCommand/DashboardArrowViewer.tsx
|
|
241
|
+
init_esm_shims();
|
|
242
|
+
var import_react3 = __toESM(require_react(), 1);
|
|
243
|
+
var import_variant2 = __toESM(require_lib(), 1);
|
|
244
|
+
var DashboardArrowViewer = ({
|
|
245
|
+
dashboardExtension,
|
|
246
|
+
onClose,
|
|
247
|
+
onSelect
|
|
248
|
+
}) => {
|
|
249
|
+
const { t } = useTranslation();
|
|
250
|
+
const { getExtensions } = useExtensions();
|
|
251
|
+
const bi = useWixCliAppBi();
|
|
252
|
+
const resolveDashboardExtensionUrl = useResolveDashboardExtensionDevUrl();
|
|
253
|
+
const openPage = useOpenPage();
|
|
254
|
+
const getLabelKey = (0, import_react3.useCallback)(
|
|
255
|
+
() => (0, import_variant2.match)(
|
|
256
|
+
dashboardExtension,
|
|
257
|
+
(0, import_variant2.lookup)({
|
|
258
|
+
DashboardPlugin: "dev_command.dashboard_page_plugin_screen.select_label",
|
|
259
|
+
DashboardMenuPlugin: "dev_command.dashboard_menu_plugin_screen.select_label",
|
|
260
|
+
DashboardPage: "dev_command.dashboard_pages_screen.select_label",
|
|
261
|
+
DashboardModal: "dev_command.dashboard_modal_screen.select_label"
|
|
262
|
+
})
|
|
263
|
+
),
|
|
264
|
+
[dashboardExtension]
|
|
265
|
+
);
|
|
266
|
+
const handleSubmit = (0, import_react3.useCallback)(
|
|
267
|
+
async (dashboardExtension2) => {
|
|
268
|
+
const url = resolveDashboardExtensionUrl(dashboardExtension2);
|
|
269
|
+
bi.cliAction({
|
|
270
|
+
question: t(getLabelKey()),
|
|
271
|
+
questionKey: getLabelKey(),
|
|
272
|
+
action: dashboardExtension2.title,
|
|
273
|
+
key: "enter"
|
|
274
|
+
});
|
|
275
|
+
await openPage({ url, title: dashboardExtension2.title });
|
|
276
|
+
onSelect?.(dashboardExtension2);
|
|
277
|
+
},
|
|
278
|
+
[resolveDashboardExtensionUrl, bi, t, getLabelKey, openPage, onSelect]
|
|
279
|
+
);
|
|
280
|
+
return /* @__PURE__ */ import_react3.default.createElement(Box_default, { flexDirection: "column", gap: 1 }, /* @__PURE__ */ import_react3.default.createElement(Box_default, { flexDirection: "column" }, /* @__PURE__ */ import_react3.default.createElement(
|
|
281
|
+
SelectInput,
|
|
282
|
+
{
|
|
283
|
+
label: t(getLabelKey()),
|
|
284
|
+
options: getExtensions(dashboardExtension).map(
|
|
285
|
+
(dashboardExtensionInstance) => ({
|
|
286
|
+
key: dashboardExtensionInstance.id,
|
|
287
|
+
title: dashboardExtensionInstance.title,
|
|
288
|
+
description: dashboardExtensionInstance.route,
|
|
289
|
+
value: dashboardExtensionInstance
|
|
290
|
+
})
|
|
291
|
+
),
|
|
292
|
+
onSubmit: ({ value: dashboardExtensionInstance }) => handleSubmit(dashboardExtensionInstance)
|
|
293
|
+
}
|
|
294
|
+
)), /* @__PURE__ */ import_react3.default.createElement(CloseScreen, { onClose }));
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
// src/components/DevCommand/DashboardScreen.tsx
|
|
298
|
+
var DashboardScreenSelector = (0, import_variant3.variant)({
|
|
299
|
+
Arrow: (0, import_variant3.fields)(),
|
|
300
|
+
Numeric: {}
|
|
301
|
+
});
|
|
302
|
+
var DashboardScreen = ({
|
|
303
|
+
onClose,
|
|
304
|
+
onSelect,
|
|
305
|
+
initialSelectorType = DashboardScreenSelector.Numeric()
|
|
306
|
+
}) => {
|
|
307
|
+
const [selectorType, setSelectorType] = (0, import_react4.useState)(initialSelectorType);
|
|
308
|
+
return /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, (0, import_variant3.match)(selectorType, {
|
|
309
|
+
Arrow: ({ dashboardExtension }) => /* @__PURE__ */ import_react4.default.createElement(
|
|
310
|
+
DashboardArrowViewer,
|
|
311
|
+
{
|
|
312
|
+
dashboardExtension,
|
|
313
|
+
onSelect,
|
|
314
|
+
onClose
|
|
315
|
+
}
|
|
316
|
+
),
|
|
317
|
+
Numeric: () => /* @__PURE__ */ import_react4.default.createElement(
|
|
318
|
+
DashboardNumericViewer,
|
|
319
|
+
{
|
|
320
|
+
onViewMore: setSelectorType,
|
|
321
|
+
onSelect,
|
|
322
|
+
onClose
|
|
323
|
+
}
|
|
324
|
+
)
|
|
325
|
+
}));
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
// src/components/NumericViewer/index.ts
|
|
329
|
+
init_esm_shims();
|
|
330
|
+
|
|
331
|
+
// src/components/NumericViewer/NumericViewer.tsx
|
|
332
|
+
init_esm_shims();
|
|
333
|
+
var import_react5 = __toESM(require_react(), 1);
|
|
334
|
+
var import_variant4 = __toESM(require_lib(), 1);
|
|
335
|
+
var ListItem = ({ itemNumber, children }) => {
|
|
336
|
+
const keyValue = `${itemNumber}`;
|
|
337
|
+
return /* @__PURE__ */ import_react5.default.createElement(Box_default, { flexDirection: "row", gap: 1 }, /* @__PURE__ */ import_react5.default.createElement(Text, null, /* @__PURE__ */ import_react5.default.createElement(PointerSmallIcon, null), " ", /* @__PURE__ */ import_react5.default.createElement(Key, { value: keyValue }), " -"), children);
|
|
338
|
+
};
|
|
339
|
+
var NumericOption = (0, import_variant4.variant)(
|
|
340
|
+
(0, import_variant4.onTerms)(({ I: _I, V }) => ({
|
|
341
|
+
Item: (0, import_variant4.fields)(),
|
|
342
|
+
ViewMore: (0, import_variant4.payload)(V)
|
|
343
|
+
}))
|
|
344
|
+
);
|
|
345
|
+
function NumericViewer({
|
|
346
|
+
startIndex,
|
|
347
|
+
titleKey,
|
|
348
|
+
items
|
|
349
|
+
}) {
|
|
350
|
+
return /* @__PURE__ */ import_react5.default.createElement(Box_default, { flexDirection: "column" }, /* @__PURE__ */ import_react5.default.createElement(Trans, { i18nKey: titleKey }), /* @__PURE__ */ import_react5.default.createElement(Box_default, { paddingLeft: 2, flexDirection: "column" }, items.map((item, index) => /* @__PURE__ */ import_react5.default.createElement(
|
|
351
|
+
ListItem,
|
|
352
|
+
{
|
|
353
|
+
key: startIndex + index + 1,
|
|
354
|
+
itemNumber: startIndex + index + 1
|
|
355
|
+
},
|
|
356
|
+
(0, import_variant4.match)(item, {
|
|
357
|
+
Item: ({ title, description }) => /* @__PURE__ */ import_react5.default.createElement(Box_default, { flexDirection: "row", gap: 1 }, /* @__PURE__ */ import_react5.default.createElement(Text, null, title), description && /* @__PURE__ */ import_react5.default.createElement(Text, { skin: "secondary" }, "(", description, ")")),
|
|
358
|
+
ViewMore: () => /* @__PURE__ */ import_react5.default.createElement(Trans, { i18nKey: "general.numeric_viewer.show_more" })
|
|
359
|
+
})
|
|
360
|
+
))));
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
// src/components/DevCommand/DashboardNumericViewer.tsx
|
|
364
|
+
var MAX_EXTENSIONS = 9;
|
|
365
|
+
var MAX_DASHBOARD_PAGES = 3;
|
|
366
|
+
var MAX_PAGE_PLUGINS = 3;
|
|
367
|
+
var MAX_MENU_PLUGINS = 3;
|
|
368
|
+
var DashboardNumericViewer = ({
|
|
369
|
+
onViewMore,
|
|
370
|
+
onSelect,
|
|
371
|
+
onClose
|
|
372
|
+
}) => {
|
|
373
|
+
const { t } = useTranslation();
|
|
374
|
+
const { getExtensions } = useExtensions();
|
|
375
|
+
const bi = useWixCliAppBi();
|
|
376
|
+
const resolveDashboardExtensionUrl = useResolveDashboardExtensionDevUrl();
|
|
377
|
+
const openPage = useOpenPage();
|
|
378
|
+
const dashboardExtensions = (0, import_react6.useMemo)(
|
|
379
|
+
() => ({
|
|
380
|
+
dashboardPages: getExtensions("DashboardPage"),
|
|
381
|
+
dashboardMenuPlugins: getExtensions("DashboardMenuPlugin"),
|
|
382
|
+
dashboardPlugins: getExtensions("DashboardPlugin")
|
|
383
|
+
}),
|
|
384
|
+
[getExtensions]
|
|
385
|
+
);
|
|
386
|
+
const dashboardPagesData = dashboardExtensions.dashboardPages.slice(
|
|
387
|
+
0,
|
|
388
|
+
dashboardExtensions.dashboardPages.length > MAX_DASHBOARD_PAGES ? MAX_DASHBOARD_PAGES - 1 : dashboardExtensions.dashboardPages.length
|
|
389
|
+
);
|
|
390
|
+
const dashboardPagesShowMoreIndex = dashboardExtensions.dashboardPages.length > dashboardPagesData.length ? dashboardPagesData.length + 1 : void 0;
|
|
391
|
+
const dashboardPagesCount = Math.max(
|
|
392
|
+
dashboardPagesData.length,
|
|
393
|
+
dashboardPagesShowMoreIndex ?? 0
|
|
394
|
+
);
|
|
395
|
+
const maxMenuPlugins = Math.min(
|
|
396
|
+
MAX_MENU_PLUGINS,
|
|
397
|
+
Math.floor((MAX_EXTENSIONS - dashboardPagesCount) / 2)
|
|
398
|
+
);
|
|
399
|
+
const dashboardMenuPluginsData = dashboardExtensions.dashboardMenuPlugins.slice(
|
|
400
|
+
0,
|
|
401
|
+
dashboardExtensions.dashboardMenuPlugins.length > maxMenuPlugins ? maxMenuPlugins - 1 : dashboardExtensions.dashboardMenuPlugins.length
|
|
402
|
+
);
|
|
403
|
+
const dashboardMenuPluginsShowMoreIndex = dashboardExtensions.dashboardMenuPlugins.length > dashboardMenuPluginsData.length ? dashboardMenuPluginsData.length + dashboardPagesCount + 1 : void 0;
|
|
404
|
+
const dashboardMenuPluginsCount = Math.max(
|
|
405
|
+
dashboardMenuPluginsData.length + dashboardPagesCount,
|
|
406
|
+
dashboardMenuPluginsShowMoreIndex ?? 0
|
|
407
|
+
);
|
|
408
|
+
const maxPagePlugins = Math.min(
|
|
409
|
+
MAX_PAGE_PLUGINS,
|
|
410
|
+
MAX_EXTENSIONS - dashboardMenuPluginsCount
|
|
411
|
+
);
|
|
412
|
+
const dashboardPluginsData = dashboardExtensions.dashboardPlugins.slice(
|
|
413
|
+
0,
|
|
414
|
+
dashboardExtensions.dashboardPlugins.length > maxPagePlugins ? maxPagePlugins - 1 : dashboardExtensions.dashboardPlugins.length
|
|
415
|
+
);
|
|
416
|
+
const dashboardPluginsShowMoreIndex = dashboardExtensions.dashboardPlugins.length > dashboardPluginsData.length ? dashboardPluginsData.length + dashboardMenuPluginsCount + 1 : void 0;
|
|
417
|
+
const visibleItems = [
|
|
418
|
+
...dashboardPagesData.map(
|
|
419
|
+
(page) => NumericOption.Item({
|
|
420
|
+
title: page.title,
|
|
421
|
+
description: page.route,
|
|
422
|
+
value: page
|
|
423
|
+
})
|
|
424
|
+
),
|
|
425
|
+
...dashboardPagesShowMoreIndex ? [NumericOption.ViewMore("DashboardPage")] : [],
|
|
426
|
+
...dashboardMenuPluginsData.map(
|
|
427
|
+
(menuPlugin) => NumericOption.Item({
|
|
428
|
+
title: menuPlugin.title,
|
|
429
|
+
description: menuPlugin.route,
|
|
430
|
+
value: menuPlugin
|
|
431
|
+
})
|
|
432
|
+
),
|
|
433
|
+
...dashboardMenuPluginsShowMoreIndex ? [NumericOption.ViewMore("DashboardMenuPlugin")] : [],
|
|
434
|
+
...dashboardPluginsData.map(
|
|
435
|
+
(pagePlugin) => NumericOption.Item({
|
|
436
|
+
title: pagePlugin.title,
|
|
437
|
+
description: pagePlugin.route,
|
|
438
|
+
value: pagePlugin
|
|
439
|
+
})
|
|
440
|
+
),
|
|
441
|
+
...dashboardPluginsShowMoreIndex ? [NumericOption.ViewMore("DashboardPlugin")] : []
|
|
442
|
+
];
|
|
443
|
+
const getLabelKey = (dashboardExtension) => {
|
|
444
|
+
return (0, import_variant5.match)(
|
|
445
|
+
dashboardExtension,
|
|
446
|
+
(0, import_variant5.lookup)({
|
|
447
|
+
DashboardPage: "general.dashboard_pages_viewer.title",
|
|
448
|
+
DashboardMenuPlugin: "general.dashboard_menu_plugins_viewer.title",
|
|
449
|
+
DashboardPlugin: "general.dashboard_plugins_viewer.title",
|
|
450
|
+
DashboardModal: ""
|
|
451
|
+
// NOTE: No key for this type
|
|
452
|
+
})
|
|
453
|
+
);
|
|
454
|
+
};
|
|
455
|
+
use_input_default(async (input) => {
|
|
456
|
+
const inputNumber = Number(input);
|
|
457
|
+
if (inputNumber > 0 && inputNumber <= visibleItems.length) {
|
|
458
|
+
const itemIndex = inputNumber - 1;
|
|
459
|
+
const item = visibleItems.at(itemIndex);
|
|
460
|
+
if (item) {
|
|
461
|
+
await (0, import_variant5.match)(item, {
|
|
462
|
+
Item: async (item2) => {
|
|
463
|
+
bi.cliAction({
|
|
464
|
+
question: t(getLabelKey(item2.value)),
|
|
465
|
+
questionKey: getLabelKey(item2.value),
|
|
466
|
+
action: item2.title,
|
|
467
|
+
key: input
|
|
468
|
+
});
|
|
469
|
+
await handleSelect(item2.value);
|
|
470
|
+
},
|
|
471
|
+
ViewMore: (viewMore) => {
|
|
472
|
+
bi.cliAction({
|
|
473
|
+
question: t("general.numeric_viewer.show_more"),
|
|
474
|
+
questionKey: "general.numeric_viewer.show_more",
|
|
475
|
+
action: "view_more",
|
|
476
|
+
key: input
|
|
477
|
+
});
|
|
478
|
+
onViewMore(
|
|
479
|
+
DashboardScreenSelector.Arrow({
|
|
480
|
+
dashboardExtension: viewMore.payload
|
|
481
|
+
})
|
|
482
|
+
);
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
const handleSelect = (0, import_react6.useCallback)(
|
|
489
|
+
async (dashboardExtension) => {
|
|
490
|
+
const url = resolveDashboardExtensionUrl(dashboardExtension);
|
|
491
|
+
await openPage({ url, title: dashboardExtension.title });
|
|
492
|
+
onSelect?.(dashboardExtension);
|
|
493
|
+
},
|
|
494
|
+
[onSelect, openPage, resolveDashboardExtensionUrl]
|
|
495
|
+
);
|
|
496
|
+
const dashboardPages = visibleItems.slice(0, dashboardPagesCount);
|
|
497
|
+
const dashboardMenuPlugins = visibleItems.slice(
|
|
498
|
+
dashboardPagesCount,
|
|
499
|
+
dashboardMenuPluginsCount
|
|
500
|
+
);
|
|
501
|
+
const dashboardPlugins = visibleItems.slice(dashboardMenuPluginsCount);
|
|
502
|
+
return /* @__PURE__ */ import_react6.default.createElement(Box_default, { flexDirection: "column", gap: 1 }, dashboardPages.length > 0 && /* @__PURE__ */ import_react6.default.createElement(
|
|
503
|
+
NumericViewer,
|
|
504
|
+
{
|
|
505
|
+
startIndex: 0,
|
|
506
|
+
titleKey: "general.dashboard_pages_viewer.title",
|
|
507
|
+
items: dashboardPages
|
|
508
|
+
}
|
|
509
|
+
), dashboardMenuPlugins.length > 0 && /* @__PURE__ */ import_react6.default.createElement(
|
|
510
|
+
NumericViewer,
|
|
511
|
+
{
|
|
512
|
+
startIndex: dashboardPagesCount,
|
|
513
|
+
titleKey: "general.dashboard_menu_plugins_viewer.title",
|
|
514
|
+
items: dashboardMenuPlugins
|
|
515
|
+
}
|
|
516
|
+
), dashboardPlugins.length > 0 && /* @__PURE__ */ import_react6.default.createElement(
|
|
517
|
+
NumericViewer,
|
|
518
|
+
{
|
|
519
|
+
startIndex: dashboardMenuPluginsCount,
|
|
520
|
+
titleKey: "general.dashboard_plugins_viewer.title",
|
|
521
|
+
items: dashboardPlugins
|
|
522
|
+
}
|
|
523
|
+
), onClose && /* @__PURE__ */ import_react6.default.createElement(CloseScreen, { onClose }));
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
// src/components/DevCommand/HomeScreen.tsx
|
|
527
|
+
var HomeScreen = ({ onScreenChange }) => {
|
|
528
|
+
const { t } = useTranslation();
|
|
529
|
+
const { site } = useSite();
|
|
530
|
+
const bi = useWixCliAppBi();
|
|
531
|
+
const { hasSinglePlatform } = usePlatform();
|
|
532
|
+
const { hasExtensions, dashboardExtensions } = useExtensions();
|
|
533
|
+
const { backendComponents } = useBackendComponents();
|
|
534
|
+
use_input_default(async (input) => {
|
|
535
|
+
if (input === "c") {
|
|
536
|
+
bi.cliAction({
|
|
537
|
+
question: t("dev_command.dev_site.change"),
|
|
538
|
+
questionKey: "dev_command.dev_site.change",
|
|
539
|
+
action: "change_site",
|
|
540
|
+
key: input
|
|
541
|
+
});
|
|
542
|
+
onScreenChange(ScreenState.SiteSelector());
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
return /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, /* @__PURE__ */ import_react7.default.createElement(Box_default, { gap: 1 }, /* @__PURE__ */ import_react7.default.createElement(
|
|
546
|
+
Trans,
|
|
547
|
+
{
|
|
548
|
+
i18nKey: "dev_command.dev_site.current",
|
|
549
|
+
values: { siteName: site.displayName },
|
|
550
|
+
components: [/* @__PURE__ */ import_react7.default.createElement(Text, { bold: true, skin: "info" })]
|
|
551
|
+
}
|
|
552
|
+
), /* @__PURE__ */ import_react7.default.createElement(Text, { skin: "secondary" }, /* @__PURE__ */ import_react7.default.createElement(
|
|
553
|
+
Trans,
|
|
554
|
+
{
|
|
555
|
+
i18nKey: "dev_command.dev_site.change",
|
|
556
|
+
components: [/* @__PURE__ */ import_react7.default.createElement(Key, { value: "C", skin: "secondary" })]
|
|
557
|
+
}
|
|
558
|
+
))), /* @__PURE__ */ import_react7.default.createElement(Box_default, { paddingTop: 1, paddingBottom: 1, flexDirection: "column" }, !hasExtensions() ? /* @__PURE__ */ import_react7.default.createElement(
|
|
559
|
+
Trans,
|
|
560
|
+
{
|
|
561
|
+
i18nKey: "general.platform.none",
|
|
562
|
+
components: [/* @__PURE__ */ import_react7.default.createElement(Link, { url: "https://wix.to/b7o4Ml0" })]
|
|
563
|
+
}
|
|
564
|
+
) : /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, hasSinglePlatform(PlatformType.Dashboard()) && backendComponents.length === 0 && dashboardExtensions.some(
|
|
565
|
+
(dashboardExtension) => !(0, import_variant6.isType)(dashboardExtension, "DashboardModal")
|
|
566
|
+
) ? /* @__PURE__ */ import_react7.default.createElement(
|
|
567
|
+
DashboardNumericViewer,
|
|
568
|
+
{
|
|
569
|
+
onViewMore: (selectorType) => onScreenChange(
|
|
570
|
+
ScreenState.DashboardScreen({
|
|
571
|
+
selectorType
|
|
572
|
+
})
|
|
573
|
+
)
|
|
574
|
+
}
|
|
575
|
+
) : /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, /* @__PURE__ */ import_react7.default.createElement(
|
|
576
|
+
Trans,
|
|
577
|
+
{
|
|
578
|
+
i18nKey: "general.view_changes",
|
|
579
|
+
components: [/* @__PURE__ */ import_react7.default.createElement(Text, { skin: "secondary" })]
|
|
580
|
+
}
|
|
581
|
+
), /* @__PURE__ */ import_react7.default.createElement(
|
|
582
|
+
PlatformSelector,
|
|
583
|
+
{
|
|
584
|
+
onMultipleDashboardExtensionSelection: () => onScreenChange(ScreenState.DashboardScreen()),
|
|
585
|
+
onMultipleBackendComponentSelection: () => onScreenChange(ScreenState.BackendScreen())
|
|
586
|
+
}
|
|
587
|
+
)))));
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
// src/components/DevCommand/SiteSelectorScreen.tsx
|
|
591
|
+
init_esm_shims();
|
|
592
|
+
var import_react8 = __toESM(require_react(), 1);
|
|
593
|
+
|
|
594
|
+
// src/components/CloseScreen/index.tsx
|
|
595
|
+
init_esm_shims();
|
|
596
|
+
|
|
597
|
+
// src/components/DevCommand/SiteSelectorScreen.tsx
|
|
598
|
+
var SiteSelectorScreen = ({ onScreenChange }) => {
|
|
599
|
+
const { t } = useTranslation();
|
|
600
|
+
const { model } = useProjectModel();
|
|
601
|
+
const biLogger = useBiLogger();
|
|
602
|
+
const { site, setSite } = useSite();
|
|
603
|
+
const { reportError } = useErrorReporter();
|
|
604
|
+
const [error, setError] = (0, import_react8.useState)(null);
|
|
605
|
+
const handleError = (0, import_react8.useCallback)(
|
|
606
|
+
(error2) => {
|
|
607
|
+
reportError(error2);
|
|
608
|
+
setError(error2);
|
|
609
|
+
},
|
|
610
|
+
[reportError, setError]
|
|
611
|
+
);
|
|
612
|
+
const handleSubmit = (0, import_react8.useCallback)(
|
|
613
|
+
async (site2) => {
|
|
614
|
+
try {
|
|
615
|
+
await setSite(site2);
|
|
616
|
+
onScreenChange(ScreenState.Home());
|
|
617
|
+
} catch (e) {
|
|
618
|
+
handleError(e);
|
|
619
|
+
}
|
|
620
|
+
},
|
|
621
|
+
[setSite, onScreenChange, handleError]
|
|
622
|
+
);
|
|
623
|
+
return /* @__PURE__ */ import_react8.default.createElement(Box_default, { flexDirection: "column", gap: 1 }, /* @__PURE__ */ import_react8.default.createElement(Box_default, { gap: 1 }, /* @__PURE__ */ import_react8.default.createElement(PointerIcon, null), /* @__PURE__ */ import_react8.default.createElement(
|
|
624
|
+
Trans,
|
|
625
|
+
{
|
|
626
|
+
i18nKey: "general.dev_site.current",
|
|
627
|
+
values: { name: site.displayName }
|
|
628
|
+
}
|
|
629
|
+
)), /* @__PURE__ */ import_react8.default.createElement(Box_default, { flexDirection: "column" }, /* @__PURE__ */ import_react8.default.createElement(
|
|
630
|
+
SiteSelector,
|
|
631
|
+
{
|
|
632
|
+
appId: model.config.appId,
|
|
633
|
+
biLogger,
|
|
634
|
+
onSubmit: handleSubmit,
|
|
635
|
+
onError: handleError
|
|
636
|
+
}
|
|
637
|
+
), error ? /* @__PURE__ */ import_react8.default.createElement(
|
|
638
|
+
ErrorViewer,
|
|
639
|
+
{
|
|
640
|
+
error,
|
|
641
|
+
systemErrorOverride: /* @__PURE__ */ import_react8.default.createElement(Alert, { type: "error" }, t("dev_command.site_selector.error"))
|
|
642
|
+
}
|
|
643
|
+
) : null), /* @__PURE__ */ import_react8.default.createElement(CloseScreen, { onClose: () => onScreenChange(ScreenState.Home()) }));
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
// src/components/DevCommand/BackendScreen.tsx
|
|
647
|
+
init_esm_shims();
|
|
648
|
+
var import_react11 = __toESM(require_react(), 1);
|
|
649
|
+
var import_variant9 = __toESM(require_lib(), 1);
|
|
650
|
+
|
|
651
|
+
// src/components/DevCommand/BackendNumericViewer.tsx
|
|
652
|
+
init_esm_shims();
|
|
653
|
+
var import_react9 = __toESM(require_react(), 1);
|
|
654
|
+
var import_variant7 = __toESM(require_lib(), 1);
|
|
655
|
+
var MAX_BACKEND_COMPONENT = 9;
|
|
656
|
+
var MAX_SERVICE_PLUGINS = 4;
|
|
657
|
+
var MAX_EVENTS = 5;
|
|
658
|
+
var BackendNumericViewer = ({
|
|
659
|
+
onViewMore,
|
|
660
|
+
onSelect,
|
|
661
|
+
onClose
|
|
662
|
+
}) => {
|
|
663
|
+
const { t } = useTranslation();
|
|
664
|
+
const bi = useWixCliAppBi();
|
|
665
|
+
const { backendComponentsByType } = useBackendComponents();
|
|
666
|
+
const servicePluginsData = backendComponentsByType.ServicePlugin.slice(
|
|
667
|
+
0,
|
|
668
|
+
backendComponentsByType.ServicePlugin.length > MAX_SERVICE_PLUGINS ? MAX_SERVICE_PLUGINS - 1 : backendComponentsByType.ServicePlugin.length
|
|
669
|
+
);
|
|
670
|
+
const servicePluginsShowMoreIndex = backendComponentsByType.ServicePlugin.length > servicePluginsData.length ? servicePluginsData.length + 1 : void 0;
|
|
671
|
+
const servicePluginsCount = Math.max(
|
|
672
|
+
servicePluginsData.length,
|
|
673
|
+
servicePluginsShowMoreIndex ?? 0
|
|
674
|
+
);
|
|
675
|
+
const maxBackendEvents = Math.min(
|
|
676
|
+
MAX_EVENTS,
|
|
677
|
+
MAX_BACKEND_COMPONENT - servicePluginsCount
|
|
678
|
+
);
|
|
679
|
+
const backendEventsData = backendComponentsByType.Event.slice(
|
|
680
|
+
0,
|
|
681
|
+
backendComponentsByType.Event.length > maxBackendEvents ? maxBackendEvents - 1 : backendComponentsByType.Event.length
|
|
682
|
+
);
|
|
683
|
+
const backendEventsShowMoreIndex = backendComponentsByType.Event.length > backendEventsData.length ? backendEventsData.length + servicePluginsCount + 1 : void 0;
|
|
684
|
+
const visibleItems = [
|
|
685
|
+
...servicePluginsData.map(
|
|
686
|
+
(servicePlugin) => NumericOption.Item({
|
|
687
|
+
title: servicePlugin.servicePlugin.name,
|
|
688
|
+
value: servicePlugin
|
|
689
|
+
})
|
|
690
|
+
),
|
|
691
|
+
...servicePluginsShowMoreIndex ? [NumericOption.ViewMore("ServicePlugin")] : [],
|
|
692
|
+
...backendEventsData.map(
|
|
693
|
+
(event) => NumericOption.Item({
|
|
694
|
+
title: event.title,
|
|
695
|
+
value: event
|
|
696
|
+
})
|
|
697
|
+
),
|
|
698
|
+
...backendEventsShowMoreIndex ? [NumericOption.ViewMore("Event")] : []
|
|
699
|
+
];
|
|
700
|
+
const getLabelKey = (backendComponent) => {
|
|
701
|
+
return (0, import_variant7.match)(
|
|
702
|
+
backendComponent,
|
|
703
|
+
(0, import_variant7.lookup)({
|
|
704
|
+
Api: "general.backend_api_viewer.title",
|
|
705
|
+
Event: "general.backend_events_viewer.title",
|
|
706
|
+
ServicePlugin: "general.backend_plugin_viewer.title"
|
|
707
|
+
})
|
|
708
|
+
);
|
|
709
|
+
};
|
|
710
|
+
use_input_default((input) => {
|
|
711
|
+
const inputNumber = Number(input);
|
|
712
|
+
if (inputNumber > 0 && inputNumber <= visibleItems.length) {
|
|
713
|
+
const item = visibleItems.at(inputNumber - 1);
|
|
714
|
+
if (item) {
|
|
715
|
+
(0, import_variant7.match)(item, {
|
|
716
|
+
Item: (item2) => {
|
|
717
|
+
bi.cliAction({
|
|
718
|
+
question: t(getLabelKey(item2.value)),
|
|
719
|
+
questionKey: getLabelKey(item2.value),
|
|
720
|
+
action: item2.title,
|
|
721
|
+
key: input
|
|
722
|
+
});
|
|
723
|
+
handleSelect(item2.value);
|
|
724
|
+
},
|
|
725
|
+
ViewMore: (viewMore) => {
|
|
726
|
+
bi.cliAction({
|
|
727
|
+
question: t("general.numeric_viewer.show_more"),
|
|
728
|
+
questionKey: "general.numeric_viewer.show_more",
|
|
729
|
+
action: "view_more",
|
|
730
|
+
key: input
|
|
731
|
+
});
|
|
732
|
+
onViewMore(
|
|
733
|
+
BackendScreenSelector.Arrow({
|
|
734
|
+
backendComponentName: viewMore.payload
|
|
735
|
+
})
|
|
736
|
+
);
|
|
737
|
+
}
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
});
|
|
742
|
+
const handleSelect = (0, import_react9.useCallback)(
|
|
743
|
+
(backendComponent) => {
|
|
744
|
+
onSelect?.(backendComponent);
|
|
745
|
+
},
|
|
746
|
+
[onSelect]
|
|
747
|
+
);
|
|
748
|
+
const backendPlugins = visibleItems.slice(0, servicePluginsCount);
|
|
749
|
+
const backendEvents = visibleItems.slice(servicePluginsCount);
|
|
750
|
+
return /* @__PURE__ */ import_react9.default.createElement(Box_default, { flexDirection: "column", gap: 1 }, backendPlugins.length > 0 && /* @__PURE__ */ import_react9.default.createElement(
|
|
751
|
+
NumericViewer,
|
|
752
|
+
{
|
|
753
|
+
startIndex: 0,
|
|
754
|
+
titleKey: "general.backend_plugin_viewer.title",
|
|
755
|
+
items: backendPlugins
|
|
756
|
+
}
|
|
757
|
+
), backendEvents.length > 0 && /* @__PURE__ */ import_react9.default.createElement(
|
|
758
|
+
NumericViewer,
|
|
759
|
+
{
|
|
760
|
+
startIndex: servicePluginsCount,
|
|
761
|
+
titleKey: "general.backend_events_viewer.title",
|
|
762
|
+
items: backendEvents
|
|
763
|
+
}
|
|
764
|
+
), onClose && /* @__PURE__ */ import_react9.default.createElement(CloseScreen, { onClose }));
|
|
765
|
+
};
|
|
766
|
+
|
|
767
|
+
// src/components/DevCommand/BackendArrowViewer.tsx
|
|
768
|
+
init_esm_shims();
|
|
769
|
+
var import_react10 = __toESM(require_react(), 1);
|
|
770
|
+
var import_variant8 = __toESM(require_lib(), 1);
|
|
771
|
+
var BackendArrowViewer = ({
|
|
772
|
+
backendComponentName,
|
|
773
|
+
onClose,
|
|
774
|
+
onSelect
|
|
775
|
+
}) => {
|
|
776
|
+
const { t } = useTranslation();
|
|
777
|
+
const bi = useWixCliAppBi();
|
|
778
|
+
const { backendComponentsByType } = useBackendComponents();
|
|
779
|
+
const getLabelKey = (0, import_react10.useCallback)(
|
|
780
|
+
() => (0, import_variant8.match)(
|
|
781
|
+
backendComponentName,
|
|
782
|
+
(0, import_variant8.lookup)({
|
|
783
|
+
Api: "dev_command.backend_apis_screen.select_label",
|
|
784
|
+
Event: "dev_command.backend_events_screen.select_label",
|
|
785
|
+
ServicePlugin: "dev_command.backend_plugins_screen.select_label"
|
|
786
|
+
})
|
|
787
|
+
),
|
|
788
|
+
[backendComponentName]
|
|
789
|
+
);
|
|
790
|
+
const getBackendComponentName = (backendComponent) => (0, import_variant8.isType)(backendComponent, "ServicePlugin") ? backendComponent.servicePlugin.name : backendComponent.title;
|
|
791
|
+
const handleSubmit = (0, import_react10.useCallback)(
|
|
792
|
+
(backendComponent) => {
|
|
793
|
+
bi.cliAction({
|
|
794
|
+
question: t(getLabelKey()),
|
|
795
|
+
questionKey: getLabelKey(),
|
|
796
|
+
action: getBackendComponentName(backendComponent),
|
|
797
|
+
key: "enter"
|
|
798
|
+
});
|
|
799
|
+
onSelect?.(backendComponent);
|
|
800
|
+
},
|
|
801
|
+
[bi, getLabelKey, onSelect, t]
|
|
802
|
+
);
|
|
803
|
+
const options = (0, import_react10.useMemo)(() => {
|
|
804
|
+
return backendComponentsByType[backendComponentName].map(
|
|
805
|
+
(backendComponent, index) => ({
|
|
806
|
+
key: index.toString(),
|
|
807
|
+
title: getBackendComponentName(backendComponent),
|
|
808
|
+
value: backendComponent
|
|
809
|
+
})
|
|
810
|
+
);
|
|
811
|
+
}, [backendComponentsByType, backendComponentName]);
|
|
812
|
+
return /* @__PURE__ */ import_react10.default.createElement(Box_default, { flexDirection: "column", gap: 1 }, /* @__PURE__ */ import_react10.default.createElement(Box_default, { flexDirection: "column" }, /* @__PURE__ */ import_react10.default.createElement(
|
|
813
|
+
SelectInput,
|
|
814
|
+
{
|
|
815
|
+
label: t(getLabelKey()),
|
|
816
|
+
options,
|
|
817
|
+
onSubmit: ({ value: backendComponent }) => handleSubmit(backendComponent)
|
|
818
|
+
}
|
|
819
|
+
)), /* @__PURE__ */ import_react10.default.createElement(CloseScreen, { onClose }));
|
|
820
|
+
};
|
|
821
|
+
|
|
822
|
+
// src/components/DevCommand/BackendScreen.tsx
|
|
823
|
+
var BackendScreenSelector = (0, import_variant9.variant)({
|
|
824
|
+
Arrow: (0, import_variant9.fields)(),
|
|
825
|
+
Numeric: {}
|
|
826
|
+
});
|
|
827
|
+
var BackendScreen = ({
|
|
828
|
+
onClose,
|
|
829
|
+
onSelect,
|
|
830
|
+
initialSelectorType = BackendScreenSelector.Numeric()
|
|
831
|
+
}) => {
|
|
832
|
+
const [selectorType, setSelectorType] = (0, import_react11.useState)(initialSelectorType);
|
|
833
|
+
return /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, (0, import_variant9.match)(selectorType, {
|
|
834
|
+
Arrow: ({ backendComponentName }) => /* @__PURE__ */ import_react11.default.createElement(
|
|
835
|
+
BackendArrowViewer,
|
|
836
|
+
{
|
|
837
|
+
backendComponentName,
|
|
838
|
+
onSelect,
|
|
839
|
+
onClose
|
|
840
|
+
}
|
|
841
|
+
),
|
|
842
|
+
Numeric: () => /* @__PURE__ */ import_react11.default.createElement(
|
|
843
|
+
BackendNumericViewer,
|
|
844
|
+
{
|
|
845
|
+
onViewMore: setSelectorType,
|
|
846
|
+
onClose
|
|
847
|
+
}
|
|
848
|
+
)
|
|
849
|
+
}));
|
|
850
|
+
};
|
|
851
|
+
|
|
852
|
+
// src/components/DevCommand/DevCommandScreens.tsx
|
|
853
|
+
var DevCommandScreens = () => {
|
|
854
|
+
const [screen, setScreen] = (0, import_react12.useState)(ScreenState.Home());
|
|
855
|
+
return (0, import_variant10.match)(screen, {
|
|
856
|
+
Home: () => /* @__PURE__ */ import_react12.default.createElement(HomeScreen, { onScreenChange: setScreen }),
|
|
857
|
+
SiteSelector: () => /* @__PURE__ */ import_react12.default.createElement(SiteSelectorScreen, { onScreenChange: setScreen }),
|
|
858
|
+
DashboardScreen: ({ selectorType }) => /* @__PURE__ */ import_react12.default.createElement(
|
|
859
|
+
DashboardScreen,
|
|
860
|
+
{
|
|
861
|
+
initialSelectorType: selectorType,
|
|
862
|
+
onSelect: () => setScreen(ScreenState.Home()),
|
|
863
|
+
onClose: () => setScreen(ScreenState.Home())
|
|
864
|
+
}
|
|
865
|
+
),
|
|
866
|
+
BackendScreen: ({ selectorType }) => /* @__PURE__ */ import_react12.default.createElement(
|
|
867
|
+
BackendScreen,
|
|
868
|
+
{
|
|
869
|
+
initialSelectorType: selectorType,
|
|
870
|
+
onSelect: () => setScreen(ScreenState.Home()),
|
|
871
|
+
onClose: () => setScreen(ScreenState.Home())
|
|
872
|
+
}
|
|
873
|
+
)
|
|
874
|
+
});
|
|
875
|
+
};
|
|
876
|
+
|
|
877
|
+
// src/components/DevCommand/TunnelingConsent.tsx
|
|
878
|
+
init_esm_shims();
|
|
879
|
+
var import_react13 = __toESM(require_react(), 1);
|
|
880
|
+
|
|
881
|
+
// ../cli-user-config/src/user-config.ts
|
|
882
|
+
init_esm_shims();
|
|
883
|
+
import { join } from "node:path";
|
|
884
|
+
function getUserConfigPath() {
|
|
885
|
+
return join(getDataDirPath(), USER_CONFIG_FILENAME);
|
|
886
|
+
}
|
|
887
|
+
async function readUserConfig() {
|
|
888
|
+
const configPath = getUserConfigPath();
|
|
889
|
+
const isConfigExist = await pathExists(configPath);
|
|
890
|
+
const json = isConfigExist ? await readJson(configPath) : {};
|
|
891
|
+
return userConfigSchema.parse(json);
|
|
892
|
+
}
|
|
893
|
+
async function updateUserConfig(config) {
|
|
894
|
+
const currentConfig = await readUserConfig();
|
|
895
|
+
const newConfig = {
|
|
896
|
+
...currentConfig,
|
|
897
|
+
...config
|
|
898
|
+
};
|
|
899
|
+
const configPath = getUserConfigPath();
|
|
900
|
+
await writeJson(configPath, newConfig);
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
// src/components/DevCommand/TunnelingConsent.tsx
|
|
904
|
+
var import_variant11 = __toESM(require_lib(), 1);
|
|
905
|
+
var TunnelingConsent = ({ children }) => {
|
|
906
|
+
const exit = useExit();
|
|
907
|
+
const { t } = useTranslation();
|
|
908
|
+
const { backendComponents } = useBackendComponents();
|
|
909
|
+
const [approved, setApproved] = (0, import_react13.useState)();
|
|
910
|
+
const { status } = useAsync(async () => {
|
|
911
|
+
const config = await readUserConfig();
|
|
912
|
+
if (config.tunneling) {
|
|
913
|
+
setApproved(true);
|
|
914
|
+
}
|
|
915
|
+
return config;
|
|
916
|
+
}, []);
|
|
917
|
+
if (backendComponents.length === 0 || approved) {
|
|
918
|
+
return children;
|
|
919
|
+
}
|
|
920
|
+
return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, (0, import_variant11.match)(status, {
|
|
921
|
+
Success: () => /* @__PURE__ */ import_react13.default.createElement(
|
|
922
|
+
ConfirmInput,
|
|
923
|
+
{
|
|
924
|
+
label: t("dev_command.tunneling.confirm"),
|
|
925
|
+
initialValue: true,
|
|
926
|
+
onSubmit: async (approved2) => {
|
|
927
|
+
setApproved(approved2);
|
|
928
|
+
await updateUserConfig({ tunneling: approved2 });
|
|
929
|
+
if (!approved2) {
|
|
930
|
+
exit();
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
),
|
|
935
|
+
Error: () => null,
|
|
936
|
+
Loading: () => null
|
|
937
|
+
}), approved === false && /* @__PURE__ */ import_react13.default.createElement(Text, { skin: "error" }, /* @__PURE__ */ import_react13.default.createElement(Trans, { i18nKey: "dev_command.tunneling.abort_dev" })));
|
|
938
|
+
};
|
|
939
|
+
|
|
940
|
+
// src/components/DevCommand/CustomElementsMigration.tsx
|
|
941
|
+
init_esm_shims();
|
|
942
|
+
var import_react14 = __toESM(require_react(), 1);
|
|
943
|
+
var import_variant12 = __toESM(require_lib(), 1);
|
|
944
|
+
import { setTimeout } from "node:timers/promises";
|
|
945
|
+
var DUMMY_CUSTOM_ELEMENT_TAG_NAME = "wix-cli-dummy-custom-element";
|
|
946
|
+
var DUMMY_CUSTOM_ELEMENT_URL = "https://www.unpkg.com/@wix/cli-dummy-custom-element";
|
|
947
|
+
var AppUpdater = ({ children, newCustomElements }) => {
|
|
948
|
+
const { model } = useProjectModel();
|
|
949
|
+
const { reportError } = useErrorReporter();
|
|
950
|
+
const { createComponents } = useARMClient();
|
|
951
|
+
const httpClient = useHttpClient({ type: "backoffice" });
|
|
952
|
+
const { site } = useSite();
|
|
953
|
+
const { armTag } = useArmTag();
|
|
954
|
+
const [isAppReinstalled, setAppReinstalledFlag] = (0, import_react14.useState)(false);
|
|
955
|
+
const prepareNewElements = useAsyncCallback(
|
|
956
|
+
async () => {
|
|
957
|
+
const componentConfigs = newCustomElements.map(
|
|
958
|
+
(customElement) => {
|
|
959
|
+
const scriptUrl = DUMMY_CUSTOM_ELEMENT_URL;
|
|
960
|
+
const config = createCustomElementConfig(customElement, scriptUrl);
|
|
961
|
+
return {
|
|
962
|
+
...config,
|
|
963
|
+
compData: {
|
|
964
|
+
customElementWidget: {
|
|
965
|
+
...config.compData.customElementWidget,
|
|
966
|
+
widgetData: {
|
|
967
|
+
...config.compData.customElementWidget.widgetData,
|
|
968
|
+
tagName: DUMMY_CUSTOM_ELEMENT_TAG_NAME
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
);
|
|
975
|
+
await createComponents(
|
|
976
|
+
model.config.appId,
|
|
977
|
+
componentConfigs,
|
|
978
|
+
model.config.projectId
|
|
979
|
+
);
|
|
980
|
+
const { customElementsCreationDelay } = getTestOverrides();
|
|
981
|
+
const [{ data: signedAppMarketParams }] = await Promise.all([
|
|
982
|
+
httpClient.post(
|
|
983
|
+
"/_serverless/app-market-json-web-token/json-web-token",
|
|
984
|
+
{
|
|
985
|
+
data: {
|
|
986
|
+
data: JSON.stringify({
|
|
987
|
+
appDefId: model.config.appId,
|
|
988
|
+
version: "latest"
|
|
989
|
+
})
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
).catch((e) => {
|
|
993
|
+
throw new CliError({
|
|
994
|
+
code: CliErrorCode.FailedToGenerateAppMarketQueryParam(),
|
|
995
|
+
cause: e
|
|
996
|
+
});
|
|
997
|
+
}),
|
|
998
|
+
setTimeout(customElementsCreationDelay ?? 5e3)
|
|
999
|
+
]);
|
|
1000
|
+
const url = new URL(`https://wix.com/editor/${site.id}`);
|
|
1001
|
+
url.searchParams.append("openPanel", "appMarket");
|
|
1002
|
+
url.searchParams.append("preferAppManager", "true");
|
|
1003
|
+
url.searchParams.append("appMarketParams", signedAppMarketParams);
|
|
1004
|
+
url.searchParams.append("apps-override", armTag);
|
|
1005
|
+
await openBrowser(
|
|
1006
|
+
redirectWithCSMv2FTs(url, PlatformType.Editor()).toString()
|
|
1007
|
+
);
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
onError: (error) => {
|
|
1011
|
+
reportError(error);
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
);
|
|
1015
|
+
use_input_default(
|
|
1016
|
+
(0, import_react14.useCallback)(
|
|
1017
|
+
(input, key) => {
|
|
1018
|
+
if (key.return) {
|
|
1019
|
+
void prepareNewElements.execute();
|
|
1020
|
+
}
|
|
1021
|
+
},
|
|
1022
|
+
[prepareNewElements]
|
|
1023
|
+
),
|
|
1024
|
+
{
|
|
1025
|
+
isActive: (0, import_variant12.isType)(prepareNewElements.status, "NotRequested")
|
|
1026
|
+
}
|
|
1027
|
+
);
|
|
1028
|
+
use_input_default(
|
|
1029
|
+
(0, import_react14.useCallback)(
|
|
1030
|
+
(input, key) => {
|
|
1031
|
+
if (key.return) {
|
|
1032
|
+
setAppReinstalledFlag(true);
|
|
1033
|
+
}
|
|
1034
|
+
},
|
|
1035
|
+
[setAppReinstalledFlag]
|
|
1036
|
+
),
|
|
1037
|
+
{
|
|
1038
|
+
isActive: !isAppReinstalled && ((0, import_variant12.isType)(prepareNewElements.status, "Success") || (0, import_variant12.isType)(prepareNewElements.status, "Error"))
|
|
1039
|
+
}
|
|
1040
|
+
);
|
|
1041
|
+
if (isAppReinstalled) {
|
|
1042
|
+
return children;
|
|
1043
|
+
}
|
|
1044
|
+
return (0, import_variant12.match)(prepareNewElements.status, {
|
|
1045
|
+
Loading: () => /* @__PURE__ */ import_react14.default.createElement(Spinner, null),
|
|
1046
|
+
Success: () => {
|
|
1047
|
+
return /* @__PURE__ */ import_react14.default.createElement(Alert, { type: "warning" }, /* @__PURE__ */ import_react14.default.createElement(Text, null, /* @__PURE__ */ import_react14.default.createElement(
|
|
1048
|
+
Trans,
|
|
1049
|
+
{
|
|
1050
|
+
i18nKey: "dev_command.new_custom_element.confirm_reinstall",
|
|
1051
|
+
components: [/* @__PURE__ */ import_react14.default.createElement(Key, { value: "enter" })]
|
|
1052
|
+
}
|
|
1053
|
+
)));
|
|
1054
|
+
},
|
|
1055
|
+
Error: () => /* @__PURE__ */ import_react14.default.createElement(Alert, { type: "error" }, /* @__PURE__ */ import_react14.default.createElement(Text, null, /* @__PURE__ */ import_react14.default.createElement(
|
|
1056
|
+
Trans,
|
|
1057
|
+
{
|
|
1058
|
+
i18nKey: "dev_command.new_custom_element.reinstall_error",
|
|
1059
|
+
components: [/* @__PURE__ */ import_react14.default.createElement(Key, { value: "enter" })]
|
|
1060
|
+
}
|
|
1061
|
+
))),
|
|
1062
|
+
NotRequested: () => /* @__PURE__ */ import_react14.default.createElement(Alert, { type: "warning" }, /* @__PURE__ */ import_react14.default.createElement(Text, null, /* @__PURE__ */ import_react14.default.createElement(
|
|
1063
|
+
Trans,
|
|
1064
|
+
{
|
|
1065
|
+
i18nKey: "dev_command.new_custom_element.warning",
|
|
1066
|
+
components: [/* @__PURE__ */ import_react14.default.createElement(Key, { value: "enter" })]
|
|
1067
|
+
}
|
|
1068
|
+
)))
|
|
1069
|
+
});
|
|
1070
|
+
};
|
|
1071
|
+
var CustomElementsMigration = ({ children }) => {
|
|
1072
|
+
const { getAppByVersion } = useDevCenterClient();
|
|
1073
|
+
const { model } = useProjectModel();
|
|
1074
|
+
const { t } = useTranslation();
|
|
1075
|
+
const customElementsCheck = useAsync(async () => {
|
|
1076
|
+
const localCustomElements = model.components.filter(
|
|
1077
|
+
(component) => (0, import_variant12.isType)(component, DevCenterComponent.CustomElement)
|
|
1078
|
+
);
|
|
1079
|
+
if (!localCustomElements.length) {
|
|
1080
|
+
return [];
|
|
1081
|
+
}
|
|
1082
|
+
const {
|
|
1083
|
+
data: { components }
|
|
1084
|
+
} = await getAppByVersion({
|
|
1085
|
+
appId: model.config.appId
|
|
1086
|
+
});
|
|
1087
|
+
const existingCustomElements = components.filter(
|
|
1088
|
+
(component) => component.compType === ComponentType.CUSTOM_ELEMENT_WIDGET
|
|
1089
|
+
);
|
|
1090
|
+
const newCustomElements = localCustomElements.filter(
|
|
1091
|
+
(localCustomElement) => !existingCustomElements.some(
|
|
1092
|
+
(customElement) => customElement.compId === localCustomElement.id
|
|
1093
|
+
)
|
|
1094
|
+
);
|
|
1095
|
+
return newCustomElements;
|
|
1096
|
+
}, []);
|
|
1097
|
+
return (0, import_variant12.match)(customElementsCheck.status, {
|
|
1098
|
+
Error: () => null,
|
|
1099
|
+
Loading: () => /* @__PURE__ */ import_react14.default.createElement(Spinner, { text: t("dev_command.custom_elements_migration.loading") }),
|
|
1100
|
+
Success: ({ result: newCustomElements }) => newCustomElements.length ? /* @__PURE__ */ import_react14.default.createElement(AppUpdater, { newCustomElements }, children) : children
|
|
1101
|
+
});
|
|
1102
|
+
};
|
|
1103
|
+
|
|
1104
|
+
// src/components/DevCommand/RequiredAppsWarning.tsx
|
|
1105
|
+
init_esm_shims();
|
|
1106
|
+
var import_react15 = __toESM(require_react(), 1);
|
|
1107
|
+
var import_variant13 = __toESM(require_lib(), 1);
|
|
1108
|
+
var RequiredAppsWarning = ({ children }) => {
|
|
1109
|
+
const { logger } = useDevEnvironment();
|
|
1110
|
+
const { site } = useSite();
|
|
1111
|
+
const { model } = useProjectModel();
|
|
1112
|
+
const { getRequiredApps } = useDevCenterClient();
|
|
1113
|
+
const { getSiteInstalledApps } = useMetasiteManagerClient();
|
|
1114
|
+
const { t } = useTranslation();
|
|
1115
|
+
const { status: requiredAppsStatus } = useAsync(async () => {
|
|
1116
|
+
const requiredApps = await getRequiredApps(model.config.appId);
|
|
1117
|
+
if (requiredApps.length === 0) {
|
|
1118
|
+
return;
|
|
1119
|
+
}
|
|
1120
|
+
const siteInstalledApps = await getSiteInstalledApps(site.id);
|
|
1121
|
+
const missingRequiredApps = requiredApps.filter(
|
|
1122
|
+
(requiredApp) => !siteInstalledApps.includes(requiredApp.id)
|
|
1123
|
+
);
|
|
1124
|
+
if (missingRequiredApps.length === 0) {
|
|
1125
|
+
return;
|
|
1126
|
+
}
|
|
1127
|
+
logger.warn(
|
|
1128
|
+
/* @__PURE__ */ import_react15.default.createElement(Alert, { type: "warning" }, t("dev_command.required_apps.warning", {
|
|
1129
|
+
requiredAppNames: missingRequiredApps.map((app) => app.name).join(", ")
|
|
1130
|
+
}))
|
|
1131
|
+
);
|
|
1132
|
+
}, []);
|
|
1133
|
+
return (0, import_variant13.match)(requiredAppsStatus, {
|
|
1134
|
+
Loading: () => /* @__PURE__ */ import_react15.default.createElement(Spinner, { text: t("dev_command.required_apps.loading") }),
|
|
1135
|
+
Error: () => null,
|
|
1136
|
+
Success: () => children
|
|
1137
|
+
});
|
|
1138
|
+
};
|
|
1139
|
+
|
|
1140
|
+
// src/components/DevCommand/DevScreenBorder.tsx
|
|
1141
|
+
init_esm_shims();
|
|
1142
|
+
var import_react16 = __toESM(require_react(), 1);
|
|
1143
|
+
var DevScreenBorder = ({ children }) => {
|
|
1144
|
+
return /* @__PURE__ */ import_react16.default.createElement(
|
|
1145
|
+
Box_default,
|
|
1146
|
+
{
|
|
1147
|
+
flexDirection: "column",
|
|
1148
|
+
borderTop: true,
|
|
1149
|
+
borderLeft: false,
|
|
1150
|
+
borderBottom: false,
|
|
1151
|
+
borderRight: false,
|
|
1152
|
+
borderStyle: "round",
|
|
1153
|
+
borderColor: "blueBright"
|
|
1154
|
+
},
|
|
1155
|
+
children
|
|
1156
|
+
);
|
|
1157
|
+
};
|
|
1158
|
+
|
|
1159
|
+
// src/components/DevCommand/DevCommand.tsx
|
|
1160
|
+
var DevCommand = ({ https }) => {
|
|
1161
|
+
const logger = (0, import_react17.useMemo)(() => createLogger({ timestamp: true }), []);
|
|
1162
|
+
return /* @__PURE__ */ import_react17.default.createElement(SiteProvider, null, /* @__PURE__ */ import_react17.default.createElement(TunnelingConsent, null, /* @__PURE__ */ import_react17.default.createElement(DevEnvironmentProvider, { logger, https }, /* @__PURE__ */ import_react17.default.createElement(CustomElementsMigration, null, /* @__PURE__ */ import_react17.default.createElement(RequiredAppsWarning, null, /* @__PURE__ */ import_react17.default.createElement(DevScreenBorder, null, /* @__PURE__ */ import_react17.default.createElement(DevCommandScreens, null)))))));
|
|
1163
|
+
};
|
|
1164
|
+
export {
|
|
1165
|
+
DevCommand,
|
|
1166
|
+
DevEnvironmentProvider
|
|
1167
|
+
};
|
|
1168
|
+
//# sourceMappingURL=DevCommand-G2BIT4FY.js.map
|