@wix/cli-app 1.1.1 → 1.1.3

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.
Files changed (77) hide show
  1. package/build/CreateVersionCommand-PIV2LH7B.js +4 -0
  2. package/build/CreateVersionCommand-PIV2LH7B.js.map +1 -0
  3. package/build/DevCommand-UIDNUWIP.js +4 -0
  4. package/build/DevCommand-UIDNUWIP.js.map +1 -0
  5. package/build/PreviewCommand-UKHGM3U7.js +4 -0
  6. package/build/ServeCommand-JX2AYHNK.js +4 -0
  7. package/build/{ServeCommand-PBWWH7JV.js.map → ServeCommand-JX2AYHNK.js.map} +1 -1
  8. package/build/SiteIdProvider-UIS4BKVC.js +4 -0
  9. package/build/{build-2RGFEOAH.js → build-X5PQLJYY.js} +2 -2
  10. package/build/{chunk-6G7R73WW.js → chunk-44TZXTHO.js} +2 -2
  11. package/build/{chunk-JZEMYLWD.js → chunk-7PCCZH2Q.js} +2 -2
  12. package/build/{chunk-JDGDMH7E.js → chunk-7PDV5QDK.js} +2 -2
  13. package/build/chunk-7T43YDHD.js +4 -0
  14. package/build/chunk-7T43YDHD.js.map +1 -0
  15. package/build/chunk-7XQUV5HO.js +4 -0
  16. package/build/chunk-7XQUV5HO.js.map +1 -0
  17. package/build/{chunk-IJ6QC2OQ.js → chunk-BJOLH7YC.js} +2 -2
  18. package/build/{chunk-BNCDZAQC.js → chunk-BQW2QNTV.js} +2 -2
  19. package/build/chunk-BXSRILE5.js +4 -0
  20. package/build/chunk-BXSRILE5.js.map +1 -0
  21. package/build/{chunk-RGPGMVHK.js → chunk-EICHKHNE.js} +3 -3
  22. package/build/chunk-EICHKHNE.js.map +1 -0
  23. package/build/{chunk-ZVAVQTPJ.js → chunk-GAEEULSA.js} +2 -2
  24. package/build/chunk-GXCVI5BG.js +75 -0
  25. package/build/chunk-GXCVI5BG.js.map +1 -0
  26. package/build/{chunk-DUZ55BRL.js → chunk-HMJ5TWEC.js} +85 -56
  27. package/build/{chunk-DUZ55BRL.js.map → chunk-HMJ5TWEC.js.map} +1 -1
  28. package/build/chunk-NQPO4DHF.js +106 -0
  29. package/build/chunk-NQPO4DHF.js.map +1 -0
  30. package/build/chunk-SGABAIB5.js +4 -0
  31. package/build/chunk-SGABAIB5.js.map +1 -0
  32. package/build/chunk-UFOJJCTK.js +4 -0
  33. package/build/{chunk-LHKDRLTT.js.map → chunk-UFOJJCTK.js.map} +1 -1
  34. package/build/{chunk-L4IT3FJC.js → chunk-UO6ED7UB.js} +2 -2
  35. package/build/chunk-XD45SKTN.js +23 -0
  36. package/build/{chunk-FJCAYHQL.js.map → chunk-XD45SKTN.js.map} +1 -1
  37. package/build/index.js +1 -1
  38. package/build/preview-5ELYGXV7.js +4 -0
  39. package/build/preview-5ELYGXV7.js.map +1 -0
  40. package/build/render-command-VECNS26S.js +4 -0
  41. package/build/{render-command-3GYMO4L2.js.map → render-command-VECNS26S.js.map} +1 -1
  42. package/package.json +6 -4
  43. package/build/CreateVersionCommand-M57PLQFO.js +0 -4
  44. package/build/CreateVersionCommand-M57PLQFO.js.map +0 -1
  45. package/build/DevCommand-HBIIRNKJ.js +0 -4
  46. package/build/DevCommand-HBIIRNKJ.js.map +0 -1
  47. package/build/PreviewCommand-ISSV3BOT.js +0 -4
  48. package/build/ServeCommand-PBWWH7JV.js +0 -4
  49. package/build/SiteIdProvider-OORASSSR.js +0 -4
  50. package/build/chunk-52CFCSNQ.js +0 -65
  51. package/build/chunk-52CFCSNQ.js.map +0 -1
  52. package/build/chunk-5CJ7KYIU.js +0 -4
  53. package/build/chunk-5CJ7KYIU.js.map +0 -1
  54. package/build/chunk-FGP4AKBM.js +0 -4
  55. package/build/chunk-FGP4AKBM.js.map +0 -1
  56. package/build/chunk-FJCAYHQL.js +0 -23
  57. package/build/chunk-JI4J5GCL.js +0 -4
  58. package/build/chunk-JI4J5GCL.js.map +0 -1
  59. package/build/chunk-LHKDRLTT.js +0 -4
  60. package/build/chunk-RGPGMVHK.js.map +0 -1
  61. package/build/chunk-U6YFRFIX.js +0 -106
  62. package/build/chunk-U6YFRFIX.js.map +0 -1
  63. package/build/chunk-XVSH4K7G.js +0 -4
  64. package/build/chunk-XVSH4K7G.js.map +0 -1
  65. package/build/preview-3532IXSY.js +0 -4
  66. package/build/preview-3532IXSY.js.map +0 -1
  67. package/build/render-command-3GYMO4L2.js +0 -4
  68. /package/build/{PreviewCommand-ISSV3BOT.js.map → PreviewCommand-UKHGM3U7.js.map} +0 -0
  69. /package/build/{SiteIdProvider-OORASSSR.js.map → SiteIdProvider-UIS4BKVC.js.map} +0 -0
  70. /package/build/{build-2RGFEOAH.js.map → build-X5PQLJYY.js.map} +0 -0
  71. /package/build/{chunk-6G7R73WW.js.map → chunk-44TZXTHO.js.map} +0 -0
  72. /package/build/{chunk-JZEMYLWD.js.map → chunk-7PCCZH2Q.js.map} +0 -0
  73. /package/build/{chunk-JDGDMH7E.js.map → chunk-7PDV5QDK.js.map} +0 -0
  74. /package/build/{chunk-IJ6QC2OQ.js.map → chunk-BJOLH7YC.js.map} +0 -0
  75. /package/build/{chunk-BNCDZAQC.js.map → chunk-BQW2QNTV.js.map} +0 -0
  76. /package/build/{chunk-ZVAVQTPJ.js.map → chunk-GAEEULSA.js.map} +0 -0
  77. /package/build/{chunk-L4IT3FJC.js.map → chunk-UO6ED7UB.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/DevCommand/index.ts","../src/components/DevCommand/DevCommand.tsx","../src/components/DevCommand/DevEnvironment.tsx","../src/components/DevCommand/useArmUpdater.ts","../src/components/DevCommand/useDevServer.ts","../src/vite/custom-logger.ts","../src/components/DevCommand/useDevEnvLogs.tsx","../src/files/dev.log.ts","../src/components/DevCommand/DevEnvLogLine.tsx","../src/components/DevCommand/DevCommandScreens.tsx","../src/components/DevCommand/HomeScreen.tsx","../src/site-id/index.ts","../src/components/DevCommand/screen-state.ts","../src/components/DevCommand/DevEnvLogsViewer.tsx","../src/components/DevCommand/DashboardPagesViewer.tsx","../src/components/DevCommand/useDashboardPages.tsx","../src/components/DevCommand/SiteSelectorScreen.tsx","../src/components/CloseScreen/index.tsx","../src/components/CloseScreen/CloseScreen.tsx","../src/components/DevCommand/DashboardPagesScreen.tsx"],"sourcesContent":["export { DevCommand } from './DevCommand.js';\nexport { DevEnvironmentProvider } from './DevEnvironment.js';\n","import React, { type FC } from 'react';\nimport { SiteIdProvider } from '../../site-id/SiteIdProvider.js';\nimport { DevEnvironmentProvider } from './DevEnvironment.js';\nimport { DevCommandScreens } from './DevCommandScreens.js';\n\nexport const DevCommand: FC<{ https: boolean }> = ({ https }) => {\n return (\n <SiteIdProvider>\n <DevEnvironmentProvider https={https}>\n <DevCommandScreens />\n </DevEnvironmentProvider>\n </SiteIdProvider>\n );\n};\n","import React, {\n type FC,\n type ReactNode,\n createContext,\n useContext,\n} from 'react';\nimport { match } from 'variant';\nimport { useTranslation } from '@wix/cli-i18n';\nimport { useAsync, Spinner } from '@wix/cli-ui-kit';\nimport { useErrorReporter } from '@wix/cli-error-reporting';\nimport { useProjectModel } from '../../model.js';\nimport { useArmUpdater } from './useArmUpdater.js';\nimport { useDevServer } from './useDevServer.js';\nimport {\n useDevEnvLogs,\n type DevEnvLog,\n type WriteLogFn,\n} from './useDevEnvLogs.js';\n\ntype DevEnvironment = {\n armTag: string;\n https: boolean;\n devServerUrl: string;\n logs: DevEnvLog[];\n writeLog: WriteLogFn;\n};\n\nconst DevEnvironmentContext = createContext<DevEnvironment | null>(null);\n\nexport const DevEnvironmentProvider: FC<{\n https: boolean;\n children: ReactNode;\n}> = ({ https, children }) => {\n const { t } = useTranslation();\n const { reportError } = useErrorReporter();\n const createDevServer = useDevServer({ https });\n const createArmUpdater = useArmUpdater();\n const { logs, writeLog } = useDevEnvLogs();\n const { watcher: projectModelWatcher } = useProjectModel();\n\n const { status } = useAsync(async () => {\n const devServerUrl = await createDevServer({\n projectModelWatcher,\n onLog(options) {\n const { msg, type } = options;\n\n switch (type) {\n case 'error':\n writeLog({ type, msg, error: options.opts?.error, prefix: 'vite' });\n break;\n case 'info':\n case 'warning':\n writeLog({ type, msg, prefix: 'vite' });\n break;\n }\n },\n });\n\n const armTag = await createArmUpdater({\n devServerUrl,\n projectModelWatcher,\n onChange(changeType) {\n match(changeType, {\n 'change-received': () => {\n writeLog({ type: 'info', msg: t('dev_command.config_change') });\n },\n 'model-did-not-change': () => {\n writeLog({\n type: 'info',\n msg: t('dev_command.config_didnt_update'),\n });\n },\n 'model-updated': () => {\n writeLog({ type: 'info', msg: t('dev_command.config_update') });\n },\n });\n },\n onError(error) {\n reportError(error);\n writeLog({ type: 'error', error, msg: 'no error details' });\n writeLog({ type: 'info', msg: t('dev_command.config_didnt_update') });\n },\n });\n\n return { devServerUrl, armTag, https };\n }, []);\n\n return match(status, {\n Error: () => null,\n Loading: () => <Spinner text={t('dev_command.dev_environment.loading')} />,\n Success: ({ result }) => (\n <DevEnvironmentContext.Provider value={{ logs, writeLog, ...result }}>\n {children}\n </DevEnvironmentContext.Provider>\n ),\n });\n};\n\nexport function useDevEnvironment(): DevEnvironment {\n const context = useContext(DevEnvironmentContext);\n if (context === null) {\n throw new Error(\n 'useDevEnvironment() cannot be used without an <DevEnvironmentProvider>'\n );\n }\n return context;\n}\n","import { useCallback } from 'react';\nimport { match } from 'variant';\nimport { deepEqual } from 'fast-equals';\nimport { updateAppManifestWithBaseUrl } from '@wix/cli-app-manifest';\nimport { useARMClient } from '@wix/arm-client';\nimport { useDebugLog } from '@wix/cli-debug-log';\nimport { createAppManifest } from '../../app-manifest/create.js';\nimport { getComponentSourceBuilder } from '../../app-manifest/component-source.js';\nimport type {\n ChangeType,\n ProjectModelWatcher,\n} from '../../app-manifest/project-model-watcher.js';\nimport { readAppConfig, saveAppConfig } from '../../files/app.config.js';\nimport { useProjectModel, type ProjectModel } from '../../model.js';\n\nconst createAppManifestWithBaseUrl = async (\n model: ProjectModel,\n devServerUrl: string\n) => {\n const manifest = await createAppManifest({\n appId: model.config.appId,\n components: model.components,\n componentSourceBuilder: getComponentSourceBuilder({\n model,\n devServerUrl,\n }),\n });\n\n return updateAppManifestWithBaseUrl(manifest, devServerUrl);\n};\n\ninterface CreateOptions {\n devServerUrl: string;\n projectModelWatcher: ProjectModelWatcher;\n onChange: (changeType: ChangeType) => void;\n onError: (e: unknown) => void;\n}\n\nexport function useArmUpdater() {\n const { model } = useProjectModel();\n const writeDebugLog = useDebugLog();\n const { createAppRelease, updateAppRelease } = useARMClient();\n\n return useCallback(\n async ({\n devServerUrl,\n projectModelWatcher,\n onChange,\n onError,\n }: CreateOptions) => {\n const { projectId } = model.config;\n const appManifest = await createAppManifestWithBaseUrl(\n model,\n devServerUrl\n );\n const appConfig = await readAppConfig(model.projectFolder, writeDebugLog);\n\n const createOrUpdateAppRelease = async (tag?: string) => {\n if (tag) {\n const updateState = await updateAppRelease(appManifest, tag);\n return match(updateState, {\n TagUpdated: () => tag,\n TagNotFound: ({ cause }) => {\n writeDebugLog(cause);\n return createAppRelease(appManifest, projectId);\n },\n });\n }\n return createAppRelease(appManifest, projectId);\n };\n\n const armTag = await createOrUpdateAppRelease(appConfig?.devArmTag);\n\n if (armTag !== appConfig?.devArmTag) {\n await saveAppConfig(model.projectFolder, { devArmTag: armTag }).catch(\n (error) => writeDebugLog(error)\n );\n }\n\n projectModelWatcher\n .onChange(async (newModel, changeType) => {\n try {\n if (changeType === 'model-updated') {\n const updatedAppManifest = await createAppManifestWithBaseUrl(\n newModel,\n devServerUrl\n );\n\n if (!deepEqual(appManifest, updatedAppManifest)) {\n await updateAppRelease(updatedAppManifest, armTag);\n }\n }\n onChange(changeType);\n } catch (e) {\n onError(e);\n }\n })\n .onError(onError);\n\n return armTag;\n },\n [createAppRelease, model, updateAppRelease, writeDebugLog]\n );\n}\n","import { useRef, useCallback, useEffect } from 'react';\nimport { createServer, type ViteDevServer } from 'vite';\nimport { getViteConfig } from '../../vite/index.js';\nimport { getViteServerUrl } from '../../vite/vite-server-url.js';\nimport {\n createCustomLogger,\n type CustomLoggerOptions,\n} from '../../vite/custom-logger.js';\nimport type { ProjectModelWatcher } from '../../app-manifest/project-model-watcher.js';\nimport { useProjectModel } from '../../model.js';\nimport { ConfigType } from '../../vite/vite-config-options.js';\n\ninterface Options {\n projectModelWatcher: ProjectModelWatcher;\n onLog: CustomLoggerOptions['onLog'];\n}\n\nexport function useDevServer({ https }: { https: boolean }) {\n const devServerRef = useRef<ViteDevServer>();\n const { model } = useProjectModel();\n\n useEffect(() => {\n return () => {\n devServerRef.current?.close();\n };\n }, []);\n\n return useCallback(\n async ({ projectModelWatcher, onLog }: Options) => {\n const devServer = await createServer(\n await getViteConfig(model, {\n type: ConfigType.dev,\n https,\n projectModelWatcher,\n customLogger: createCustomLogger({ onLog }),\n })\n );\n devServerRef.current = devServer;\n\n await devServer.listen();\n\n return getViteServerUrl(devServer);\n },\n [model, https]\n );\n}\n","import type { LogErrorOptions, Logger, Rollup } from 'vite';\n\nexport type LogType = 'error' | 'warning' | 'info';\n\nexport interface CustomLoggerOptions {\n onLog(\n options:\n | { type: 'error'; msg: string; opts?: LogErrorOptions }\n | { type: 'warning' | 'info'; msg: string }\n ): void;\n}\n\nexport function createCustomLogger({ onLog }: CustomLoggerOptions): Logger {\n const loggedErrors = new WeakSet<Error | Rollup.RollupError>();\n const warnedMessages = new Set<string>();\n\n const logger: Logger = {\n hasWarned: false,\n info(msg) {\n onLog({ type: 'info', msg });\n },\n warn(msg) {\n logger.hasWarned = true;\n onLog({ type: 'warning', msg });\n },\n warnOnce(msg) {\n if (warnedMessages.has(msg)) return;\n logger.hasWarned = true;\n onLog({ type: 'warning', msg });\n warnedMessages.add(msg);\n },\n error(msg, opts) {\n logger.hasWarned = true;\n onLog({ type: 'error', msg, opts });\n if (opts?.error) {\n loggedErrors.add(opts.error);\n }\n },\n clearScreen() {},\n hasErrorLogged(error) {\n return loggedErrors.has(error);\n },\n };\n\n return logger;\n}\n","import React, {\n useCallback,\n useEffect,\n useState,\n useMemo,\n type ReactNode,\n type FC,\n} from 'react';\nimport { DEV_LOG_PATH } from '@wix/cli-app-definitions';\nimport { Trans } from '@wix/cli-i18n';\nimport { createRendererToString, Alert, Box, Text } from '@wix/cli-ui-kit';\nimport { DevLogStream } from '../../files/dev.log.js';\nimport { useProjectModel } from '../../model.js';\nimport { DevEnvLogLine } from './DevEnvLogLine.js';\n\ntype GenericLog = (\n | {\n type: 'warning' | 'info';\n msg: ReactNode;\n error?: never;\n }\n | {\n type: 'error';\n msg: ReactNode;\n error?: unknown;\n }\n) & { prefix?: LogPrefix };\n\ntype LogPrefix = 'app' | 'vite';\n\nexport type WriteLogFn = (log: GenericLog) => void;\n\nexport type DevEnvLog = GenericLog & {\n timestamp: Date;\n};\n\nconst ErrorMsg: FC = () => (\n <Box flexDirection=\"column\">\n <Alert type=\"error\">\n <Trans\n i18nKey=\"general.write_dev_log_failure.message\"\n components={[<Text bold />]}\n values={{ path: DEV_LOG_PATH }}\n />\n </Alert>\n <Box paddingTop={1}>\n <Alert type=\"insight\">\n <Trans i18nKey=\"general.write_dev_log_failure.hint\" />\n </Alert>\n </Box>\n </Box>\n);\n\nconst MAX_LOGS_TO_SHOW = 5;\n\nfunction isMessageFiltered(message: string) {\n if (/Port \\d{1,5} is in use, trying another one/.test(message)) {\n return true;\n }\n\n return false;\n}\n\nexport function useDevEnvLogs() {\n const { model } = useProjectModel();\n const [logs, setLogs] = useState<DevEnvLog[]>([]);\n\n const insertLog = useCallback((genericLog: GenericLog) => {\n const log = { ...genericLog, timestamp: new Date() };\n\n setLogs((logs) => {\n const newLogs = [...logs, log];\n if (newLogs.length > MAX_LOGS_TO_SHOW) {\n newLogs.shift();\n }\n\n return newLogs;\n });\n\n return log;\n }, []);\n\n const { renderer, stream } = useMemo(() => {\n return {\n renderer: createRendererToString(),\n stream: new DevLogStream(model.projectFolder, {\n onError() {\n insertLog({ type: 'error', msg: <ErrorMsg /> });\n },\n }),\n };\n }, [insertLog, model.projectFolder]);\n\n const writeLog = useCallback<WriteLogFn>(\n (genericLog) => {\n if (genericLog.msg && isMessageFiltered(genericLog.msg.toString())) {\n return;\n }\n\n const log = insertLog(genericLog);\n const content = renderer.render(<DevEnvLogLine {...log} />);\n\n stream.write(content);\n },\n [insertLog, renderer, stream]\n );\n\n useEffect(() => {\n return () => {\n renderer.unmount();\n stream.close();\n };\n }, [renderer, stream]);\n\n return { logs, writeLog };\n}\n","import { EOL } from 'node:os';\nimport { createWriteStream, type WriteStream } from 'node:fs';\nimport { getDevLogPath } from '@wix/cli-app-definitions';\n\nexport class DevLogStream {\n private drain = false;\n private readonly stream: WriteStream;\n\n constructor(\n projectFolder: string,\n private readonly opts: { onError: (err: Error) => void }\n ) {\n this.stream = createWriteStream(getDevLogPath(projectFolder), {\n flags: 'w',\n });\n\n this.stream.on('error', this.opts.onError);\n }\n\n write = (content: string) => {\n if (this.drain) {\n this.stream.once('drain', () => {\n this.drain = false;\n this.write(content);\n });\n return;\n }\n\n const written = this.stream.write(content.concat(EOL), (err) => {\n if (err) {\n this.opts.onError(err);\n }\n });\n if (!written) {\n this.drain = true;\n this.stream.once('drain', () => {\n this.drain = false;\n });\n }\n };\n\n close = () => {\n this.stream.close();\n };\n}\n","import React, { type FC } from 'react';\nimport { Box, Text } from '@wix/cli-ui-kit';\nimport { ErrorViewer } from '@wix/cli-error-reporting';\nimport type { DevEnvLog } from './useDevEnvLogs.js';\n\nexport const DevEnvLogLine: FC<DevEnvLog> = ({\n type,\n msg,\n error,\n prefix = 'app',\n timestamp,\n}) => {\n return (\n <Box columnGap={1}>\n <Box flexShrink={0}>\n <Text skin=\"secondary\">{timestamp.toLocaleTimeString()}</Text>\n </Box>\n <Box flexShrink={0}>\n <Text skin={type} bold>\n [{prefix}]\n </Text>\n </Box>\n <Box>\n {type === 'error' && error ? (\n <ErrorViewer error={error} />\n ) : typeof msg === 'string' ? (\n <Text>{msg}</Text>\n ) : (\n msg\n )}\n </Box>\n </Box>\n );\n};\n","import React, { type FC, useState } from 'react';\nimport { match } from 'variant';\nimport { HomeScreen } from './HomeScreen.js';\nimport { SiteSelectorScreen } from './SiteSelectorScreen.js';\nimport { DashboardPagesScreen } from './DashboardPagesScreen.js';\nimport { ScreenState } from './screen-state.js';\n\nexport const DevCommandScreens: FC = () => {\n const [screen, setScreen] = useState<ScreenState>(ScreenState.Home());\n\n return match(screen, {\n Home: () => <HomeScreen onScreenChange={setScreen} />,\n SiteSelector: () => <SiteSelectorScreen onScreenChange={setScreen} />,\n DashboardPages: () => <DashboardPagesScreen onScreenChange={setScreen} />,\n });\n};\n","import React, { type FC } from 'react';\nimport {\n Key,\n Box,\n Text,\n SuccessIcon,\n InfoIcon,\n PointerIcon,\n Link,\n useInput,\n Alert,\n} from '@wix/cli-ui-kit';\nimport { Trans } from '@wix/cli-i18n';\nimport { openBrowser } from '@wix/user-browser';\nimport { useSiteId } from '../../site-id/index.js';\nimport { ScreenState } from './screen-state.js';\nimport { useDevEnvironment } from './DevEnvironment.js';\nimport { DevEnvLogsViewer } from './DevEnvLogsViewer.js';\nimport { DashboardPagesViewer } from './DashboardPagesViewer.js';\n\ninterface Props {\n onScreenChange: (screen: ScreenState) => void;\n}\n\nexport const HomeScreen: FC<Props> = ({ onScreenChange }) => {\n const { site } = useSiteId();\n const { devServerUrl, https, writeLog } = useDevEnvironment();\n\n const openDevServerInBrowser = async () => {\n try {\n await openBrowser(devServerUrl);\n } catch (error) {\n writeLog({\n type: 'error',\n prefix: 'app',\n msg: (\n <Alert type=\"error\">\n <Trans\n i18nKey=\"dev_command.dev_environment.https_url.failed_to_open\"\n components={[<Link url={devServerUrl} />]}\n />\n </Alert>\n ),\n });\n }\n };\n\n useInput(async (input) => {\n if (input === 'c') {\n onScreenChange(ScreenState.SiteSelector());\n }\n if (input === 'a' && https) {\n await openDevServerInBrowser();\n }\n });\n\n return (\n <>\n <Box gap={1}>\n <Text skin=\"success\">\n <SuccessIcon />\n </Text>\n <Trans i18nKey=\"dev_command.dev_environment.started\" />\n </Box>\n <Box gap={1}>\n <InfoIcon />\n <Trans\n i18nKey=\"dev_command.dev_environment.url\"\n components={[<Link url={devServerUrl} />]}\n />\n </Box>\n {https && (\n <Box paddingLeft={2}>\n <Text skin=\"secondary\">\n <Trans\n components={[<Key value=\"A\" />]}\n i18nKey=\"dev_command.dev_environment.https_url.open_info\"\n />\n </Text>\n </Box>\n )}\n <Box gap={1}>\n <PointerIcon />\n <Trans\n i18nKey=\"dev_command.dev_site.current\"\n values={{ name: site.displayName }}\n />\n </Box>\n <Box paddingLeft={2}>\n <Text skin=\"secondary\">\n <Trans\n i18nKey=\"dev_command.dev_site.change\"\n components={[<Key value=\"C\" />]}\n />\n </Text>\n </Box>\n <Box paddingTop={1} paddingBottom={1} flexDirection=\"column\">\n <DashboardPagesViewer\n onViewMore={() => onScreenChange(ScreenState.DashboardPages())}\n />\n </Box>\n <DevEnvLogsViewer />\n </>\n );\n};\n","export { SiteIdProvider } from './SiteIdProvider.js';\nexport { useSiteId } from './useSiteId.js';\n","import { variant, type VariantOf } from 'variant';\n\nexport const ScreenState = variant({\n Home: {},\n SiteSelector: {},\n DashboardPages: {},\n});\n\nexport type ScreenState = VariantOf<typeof ScreenState>;\n","import React, { type FC } from 'react';\nimport { Text, Box } from '@wix/cli-ui-kit';\nimport { useTranslation, Trans } from '@wix/cli-i18n';\nimport { DEV_LOG_PATH } from '@wix/cli-app-definitions';\nimport { useDevEnvironment } from './DevEnvironment.js';\nimport { DevEnvLogLine } from './DevEnvLogLine.js';\n\nexport const DevEnvLogsViewer: FC = () => {\n const { t } = useTranslation();\n const { logs } = useDevEnvironment();\n const isEmpty = !logs.length;\n\n return (\n <>\n <Box gap={1}>\n <Trans\n i18nKey=\"dev_command.dev_env_logs.title\"\n components={[<Text skin={isEmpty ? 'secondary' : 'standard'} />]}\n values={{ path: DEV_LOG_PATH }}\n />\n </Box>\n {isEmpty && (\n <Text skin=\"secondary\">{t('dev_command.dev_env_logs.empty')}</Text>\n )}\n {logs.map((log) => {\n return <DevEnvLogLine key={log.timestamp.getTime()} {...log} />;\n })}\n </>\n );\n};\n","import React, { type FC, type ReactNode, useMemo } from 'react';\nimport { Box, Text, Key, PointerSmallIcon, useInput } from '@wix/cli-ui-kit';\nimport { Trans } from '@wix/cli-i18n';\nimport { useDashboardPages } from './useDashboardPages.js';\n\nconst MAX_PAGES = 3;\n\nconst ListItem: FC<{\n itemNumber: number;\n onSelect: () => void;\n children: ReactNode;\n}> = ({ itemNumber, onSelect, children }) => {\n const keyValue = `${itemNumber}`;\n\n useInput((input) => {\n if (input === keyValue) {\n onSelect();\n }\n });\n\n return (\n <Text>\n <PointerSmallIcon /> <Key value={keyValue} /> - {children}\n </Text>\n );\n};\n\ninterface Props {\n onViewMore: () => void;\n}\n\nexport const DashboardPagesViewer: FC<Props> = ({ onViewMore }) => {\n const { pages, openPage } = useDashboardPages();\n\n const { visiblePages, showMore } = useMemo(() => {\n const numberOfPagesToShow =\n pages.length <= MAX_PAGES ? pages.length : MAX_PAGES - 1;\n return {\n visiblePages: pages.slice(0, numberOfPagesToShow),\n showMore: pages.length > MAX_PAGES,\n };\n }, [pages]);\n\n return (\n <>\n <Trans i18nKey=\"dev_command.dashboard_pages_viewer.title\" />\n <Box paddingLeft={2} flexDirection=\"column\">\n {visiblePages.map((page, index) => (\n <ListItem\n key={page.route}\n itemNumber={index + 1}\n onSelect={() => openPage(page)}\n >\n {page.title} (<Text skin=\"secondary\">{page.route}</Text>)\n </ListItem>\n ))}\n {showMore && (\n <ListItem itemNumber={MAX_PAGES} onSelect={onViewMore}>\n <Trans i18nKey=\"dev_command.dashboard_pages_viewer.show_more\" />\n </ListItem>\n )}\n </Box>\n </>\n );\n};\n","import React, { useMemo, useCallback } from 'react';\nimport { isType } from 'variant';\nimport { openBrowser } from '@wix/user-browser';\nimport { Trans } from '@wix/cli-i18n';\nimport { Alert, Link, Text, Newline } from '@wix/cli-ui-kit';\nimport { DevCenterComponent } from '../../dev-center/components/dev-center-component.js';\nimport { createDashboardPageUrl } from '../../dashboard-page-url.js';\nimport { useSiteId } from '../../site-id/index.js';\nimport { useProjectModel } from '../../model.js';\nimport { useDevEnvironment } from './DevEnvironment.js';\n\nexport interface DashboardPage {\n title: string;\n route: string;\n url: string;\n}\n\nexport function useDashboardPages() {\n const { site } = useSiteId();\n const { model } = useProjectModel();\n const { armTag, writeLog } = useDevEnvironment();\n\n const pages = useMemo(() => {\n return model.components\n .filter(isType(DevCenterComponent.DashboardPage))\n .sort((a, b) => a.route.localeCompare(b.route))\n .map((component) => ({\n title: component.title,\n route: component.route,\n url: createDashboardPageUrl({\n appId: model.config.appId,\n siteId: site.id,\n tag: armTag,\n component,\n }),\n }));\n }, [model.components, model.config.appId, site.id, armTag]);\n\n const openPage = useCallback(\n async ({ url, title }: DashboardPage) => {\n try {\n await openBrowser(url);\n } catch (error) {\n writeLog({\n type: 'error',\n prefix: 'app',\n msg: (\n <Alert type=\"error\">\n <Trans\n i18nKey=\"dev_command.dashboard_pages.open_page_error\"\n components={[<Text bold />]}\n values={{ title }}\n />\n <Newline />\n <Link url={url} />\n </Alert>\n ),\n });\n }\n },\n [writeLog]\n );\n\n return { pages, openPage };\n}\n","import React, { type FC, useState, useCallback } from 'react';\nimport { Alert } from '@wix/cli-ui-kit';\nimport { ErrorViewer, useErrorReporter } from '@wix/cli-error-reporting';\nimport type { Site } from '@wix/site-list-client';\nimport { useTranslation } from '@wix/cli-i18n';\nimport { SiteSelector } from '@wix/cli-site-selector';\nimport { useProjectModel } from '../../model.js';\nimport { useSiteId } from '../../site-id/index.js';\nimport { CloseScreen } from '../CloseScreen';\nimport { ScreenState } from './screen-state.js';\n\ninterface Props {\n onScreenChange: (screen: ScreenState) => void;\n}\n\nexport const SiteSelectorScreen: FC<Props> = ({ onScreenChange }) => {\n const { t } = useTranslation();\n const { model } = useProjectModel();\n const { setSite } = useSiteId();\n const { reportError } = useErrorReporter();\n const [error, setError] = useState<unknown>(null);\n\n const handleError = useCallback(\n (error: unknown) => {\n reportError(error);\n setError(error);\n },\n [reportError, setError]\n );\n\n const handleSubmit = useCallback(\n async (site: Site) => {\n try {\n await setSite(site);\n onScreenChange(ScreenState.Home());\n } catch (e) {\n handleError(e);\n }\n },\n [setSite, onScreenChange, handleError]\n );\n\n return (\n <>\n <SiteSelector\n appId={model.config.appId}\n onSubmit={handleSubmit}\n onError={handleError}\n />\n {error && (\n <ErrorViewer\n error={error}\n systemErrorOverride={\n <Alert type=\"error\">{t('dev_command.site_selector.error')}</Alert>\n }\n />\n )}\n <CloseScreen onClose={() => onScreenChange(ScreenState.Home())} />\n </>\n );\n};\n","export { CloseScreen } from './CloseScreen.js';\n","import React, { type FC } from 'react';\nimport { Key, Box, Text, useInput } from '@wix/cli-ui-kit';\nimport { Trans } from '@wix/cli-i18n';\n\ninterface Props {\n onClose: () => void;\n}\n\nexport const CloseScreen: FC<Props> = ({ onClose }) => {\n useInput((_, key) => {\n if (key.escape) {\n onClose();\n }\n });\n\n return (\n <Box paddingTop={1}>\n <Text skin=\"secondary\">\n <Trans\n i18nKey=\"general.close_screen\"\n components={[<Key value=\"esc\" />]}\n />\n </Text>\n </Box>\n );\n};\n","import React, { type FC, useCallback } from 'react';\nimport { SelectInput, type SelectOption } from '@wix/cli-ui-kit';\nimport { useTranslation } from '@wix/cli-i18n';\nimport { CloseScreen } from '../CloseScreen';\nimport { ScreenState } from './screen-state.js';\nimport { useDashboardPages, type DashboardPage } from './useDashboardPages.js';\n\ninterface Props {\n onScreenChange: (screen: ScreenState) => void;\n}\n\nexport const DashboardPagesScreen: FC<Props> = ({ onScreenChange }) => {\n const { t } = useTranslation();\n const { pages, openPage } = useDashboardPages();\n\n const handleSubmit = useCallback(\n async ({ value }: SelectOption<DashboardPage>) => {\n await openPage(value);\n onScreenChange(ScreenState.Home());\n },\n [onScreenChange, openPage]\n );\n\n return (\n <>\n <SelectInput<DashboardPage>\n label={t('dev_command.dashboard_pages_screen.select_label')}\n options={pages.map((page) => ({\n key: page.route,\n title: page.title,\n description: page.route,\n value: page,\n }))}\n on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ext","useContext","init_esm_shims","import_variant","useCallback","createAppManifestWithBaseUrl","model","devServerUrl","manifest","createAppManifest","getComponentSourceBuilder","updateAppManifestWithBaseUrl","useArmUpdater","useProjectModel","writeDebugLog","useDebugLog","createAppRelease","updateAppRelease","useARMClient","useCallback","projectModelWatcher","onChange","onError","projectId","appManifest","appConfig","readAppConfig","armTag","tag","updateState","cause","saveAppConfig","error","newModel","changeType","updatedAppManifest","deepEqual","e","init_esm_shims","useRef","useCallback","useEffect","createServer","init_esm_shims","createCustomLogger","onLog","loggedErrors","warnedMessages","logger","msg","opts","error","useDevServer","https","devServerRef","useRef","model","useProjectModel","useEffect","useCallback","projectModelWatcher","onLog","devServer","createServer","getViteConfig","createCustomLogger","getViteServerUrl","init_esm_shims","React","useCallback","useEffect","useState","useMemo","init_esm_shims","EOL","createWriteStream","DevLogStream","projectFolder","opts","createWriteStream","getDevLogPath","content","EOL","err","init_esm_shims","React","DevEnvLogLine","type","msg","error","prefix","timestamp","React","Box_default","Text","ErrorViewer","ErrorMsg","React","Box_default","Alert","Trans","Text","DEV_LOG_PATH","MAX_LOGS_TO_SHOW","isMessageFiltered","message","useDevEnvLogs","model","useProjectModel","logs","setLogs","useState","insertLog","useCallback","genericLog","log","newLogs","renderer","stream","useMemo","createRendererToString","DevLogStream","writeLog","content","DevEnvLogLine","useEffect","DevEnvironmentContext","createContext","DevEnvironmentProvider","https","children","t","useTranslation","reportError","useErrorReporter","createDevServer","useDevServer","createArmUpdater","useArmUpdater","logs","writeLog","useDevEnvLogs","projectModelWatcher","useProjectModel","status","useAsync","devServerUrl","options","msg","type","armTag","changeType","error","React","Spinner","result","useDevEnvironment","context","useContext","init_esm_shims","import_variant","React","useState","init_esm_shims","React","init_esm_shims","init_esm_shims","import_variant","ScreenState","init_esm_shims","React","DevEnvLogsViewer","t","useTranslation","logs","useDevEnvironment","isEmpty","React","Box_default","Trans","Text","DEV_LOG_PATH","log","DevEnvLogLine","init_esm_shims","React","useMemo","init_esm_shims","import_variant","React","useMemo","useCallback","useDashboardPages","site","useSiteId","model","useProjectModel","armTag","writeLog","useDevEnvironment","pages","useMemo","DevCenterComponent","b","component","createDashboardPageUrl","openPage","useCallback","url","title","openBrowser","React","Alert","Trans","Text","Newline","Link","MAX_PAGES","ListItem","itemNumber","onSelect","children","keyValue","use_input_default","input","React","Text","PointerSmallIcon","Key","DashboardPagesViewer","onViewMore","pages","openPage","useDashboardPages","visiblePages","showMore","useMemo","numberOfPagesToShow","Trans","Box_default","page","index","HomeScreen","onScreenChange","site","useSiteId","devServerUrl","https","writeLog","useDevEnvironment","openDevServerInBrowser","openBrowser","React","Alert","Trans","Link","use_input_default","input","ScreenState","Box_default","Text","SuccessIcon","InfoIcon","Key","PointerIcon","DashboardPagesViewer","DevEnvLogsViewer","init_esm_shims","React","useState","useCallback","init_esm_shims","init_esm_shims","React","CloseScreen","onClose","use_input_default","_","key","React","Box_default","Text","Trans","Key","SiteSelectorScreen","onScreenChange","t","useTranslation","model","useProjectModel","setSite","useSiteId","reportError","useErrorReporter","error","setError","useState","handleError","useCallback","handleSubmit","site","ScreenState","e","React","SiteSelector","ErrorViewer","Alert","CloseScreen","init_esm_shims","React","useCallback","DashboardPagesScreen","onScreenChange","t","useTranslation","pages","openPage","useDashboardPages","handleSubmit","useCallback","value","ScreenState","React","SelectInput","page","CloseScreen","DevCommandScreens","screen","setScreen","useState","ScreenState","React","HomeScreen","SiteSelectorScreen","DashboardPagesScreen","DevCommand","https","React","SiteIdProvider","DevEnvironmentProvider","DevCommandScreens"]}
@@ -0,0 +1,4 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import{d as b,e as c}from"./chunk-GAEEULSA.js";import{a}from"./chunk-UFOJJCTK.js";import"./chunk-BQW2QNTV.js";import"./chunk-7XQUV5HO.js";import"./chunk-AWOTQVII.js";import"./chunk-7PCCZH2Q.js";import"./chunk-XD45SKTN.js";import"./chunk-BJOLH7YC.js";import"./chunk-7PDV5QDK.js";import"./chunk-SGABAIB5.js";import"./chunk-44TZXTHO.js";import"./chunk-BXSRILE5.js";import"./chunk-NQPO4DHF.js";import"./chunk-GXCVI5BG.js";import"./chunk-HFDLXX7R.js";export{a as PreviewCommand,c as validateBase,b as validateSite};
4
+ //# sourceMappingURL=PreviewCommand-UKHGM3U7.js.map
@@ -0,0 +1,4 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import{a as h}from"./chunk-BOTVIAFU.js";import{a as y,b as P}from"./chunk-HMJ5TWEC.js";import{a as M}from"./chunk-BQW2QNTV.js";import"./chunk-AWOTQVII.js";import{b as C}from"./chunk-BJOLH7YC.js";import{b as T,c as I}from"./chunk-7PDV5QDK.js";import{b as _}from"./chunk-SGABAIB5.js";import"./chunk-BXSRILE5.js";import{B as S,F as f,G as w,l as c,o as l,s as v,y as u,z as g}from"./chunk-NQPO4DHF.js";import{K as x,a as E,ba as s}from"./chunk-GXCVI5BG.js";import{e as k,h as t}from"./chunk-HFDLXX7R.js";t();t();var m=k(E(),1);import e from"react";t();import{preview as F}from"vite";import{useCallback as K,useEffect as L,useRef as V}from"react";function A(){let r=V(),{model:o}=s();return L(()=>()=>{r.current?.httpServer.close()},[]),K(async()=>{let n=await F(await P(o,{type:"build"}));return r.current=n,y(n)},[o])}function O(){let{model:r}=s(),{t:o}=w(),n=T(),{site:B}=h(),D=A(),{status:U}=S(async()=>{await M(r.projectFolder);let i=await D(),p=await C(r.projectFolder),a=_(p,i);return{tag:await n.createAppRelease(a,r.config.projectId),serverUrl:i}},[]);return(0,m.match)(U,{Loading:()=>e.createElement(g,{text:o("serve_command.starting_serve_environment")}),Error:()=>null,Success:({result:{tag:i,serverUrl:p}})=>{let[a]=r.components.filter((0,m.isType)(x.DashboardPage)),d=I({appId:r.config.appId,siteId:B.id,component:a,tag:i});return e.createElement(c,{paddingTop:1,flexDirection:"column"},e.createElement(c,{gap:1},e.createElement(l,{skin:"success"},e.createElement(v,null)),e.createElement(f,{i18nKey:"serve_command.starting_serve_environment_success",components:[e.createElement(u,{url:p})]})),e.createElement(f,{i18nKey:"general.dashboard_page_text",components:[e.createElement(u,{url:d})]}))}})}export{O as ServeCommand};
4
+ //# sourceMappingURL=ServeCommand-JX2AYHNK.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/ServeCommand/index.ts","../src/components/ServeCommand/ServeCommand.tsx","../src/components/ServeCommand/hooks/usePreviewServer.ts"],"sourcesContent":["export { ServeCommand } from './ServeCommand.js';\n","import { isType, match } from 'variant';\nimport { updateAppManifestWithBaseUrl } from '@wix/cli-app-manifest';\nimport { useARMClient } from '@wix/arm-client';\nimport {\n Box,\n Link,\n Spinner,\n SuccessIcon,\n Text,\n useAsync,\n} from '@wix/cli-ui-kit';\nimport React from 'react';\nimport { Trans, useTranslation } from '@wix/cli-i18n';\nimport { createDashboardPageUrl } from '../../dashboard-page-url.js';\nimport { useProjectModel } from '../../model.js';\nimport { readAppManifestFile } from '../../app-manifest/file.js';\nimport { DevCenterComponent } from '../../dev-center/components/dev-center-component.js';\nimport { assertBuildOutputExists } from '../../files/assert-build-output-exists.js';\nimport { useSiteId } from '../../site-id/useSiteId.js';\nimport { usePreviewServer } from './hooks/usePreviewServer.js';\n\nexport function ServeCommand() {\n const { model } = useProjectModel();\n const { t } = useTranslation();\n const arm = useARMClient();\n const { site } = useSiteId();\n const createPreviewServer = usePreviewServer();\n\n const { status } = useAsync(async () => {\n await assertBuildOutputExists(model.projectFolder);\n const serverUrl = await createPreviewServer();\n\n const manifest = await readAppManifestFile(model.projectFolder);\n const updatedManifest = updateAppManifestWithBaseUrl(manifest, serverUrl);\n\n const tag = await arm.createAppRelease(\n updatedManifest,\n model.config.projectId\n );\n\n return { tag, serverUrl };\n }, []);\n\n return match(status, {\n Loading: () => (\n <Spinner text={t('serve_command.starting_serve_environment')}></Spinner>\n ),\n Error: () => null,\n Success: ({ result: { tag, serverUrl } }) => {\n const [component] = model.components.filter(\n isType(DevCenterComponent.DashboardPage)\n );\n const url = createDashboardPageUrl({\n appId: model.config.appId,\n siteId: site.id,\n component,\n tag,\n });\n\n return (\n <Box paddingTop={1} flexDirection=\"column\">\n <Box gap={1}>\n <Text skin=\"success\">\n <SuccessIcon />\n </Text>\n <Trans\n i18nKey=\"serve_command.starting_serve_environment_success\"\n components={[<Link url={serverUrl} />]}\n />\n </Box>\n <Trans\n i18nKey=\"general.dashboard_page_text\"\n components={[<Link url={url} />]}\n />\n </Box>\n );\n },\n });\n}\n","import { preview, type PreviewServer } from 'vite';\nimport { useCallback, useEffect, useRef } from 'react';\nimport { useProjectModel } from '../../../model.js';\nimport { getViteConfig } from '../../../vite/index.js';\nimport { getViteServerUrl } from '../../../vite/vite-server-url.js';\nimport { ConfigType } from '../../../vite/vite-config-options.js';\n\nexport function usePreviewServer() {\n const previewServerRef = useRef<PreviewServer>();\n const { model } = useProjectModel();\n\n useEffect(() => {\n return () => {\n previewServerRef.current?.httpServer.close();\n };\n }, []);\n\n return useCallback(async () => {\n const previewServer = await preview(\n await getViteConfig(model, { type: ConfigType.build })\n );\n\n previewServerRef.current = previewServer;\n\n return getViteServerUrl(previewServer);\n }, [model]);\n}\n"],"mappings":";;ofAAAA,ICAAC,IAAA,IAAAC,EAA8B,SAW9B,OAAOC,MAAW,QCXlBC,IAAA,OAAS,WAAAC,MAAmC,OAC5C,OAAS,eAAAC,EAAa,aAAAC,EAAW,UAAAC,MAAc,QAMxC,SAASC,GAAmB,CACjC,IAAMC,EAAmBC,EAAsB,EACzC,CAAE,MAAAC,CAAM,EAAIC,EAAgB,EAElC,OAAAC,EAAU,IACD,IAAM,CACXJ,EAAiB,SAAS,WAAW,MAAM,CAC7C,EACC,CAAC,CAAC,EAEEK,EAAY,SAAY,CAC7B,IAAMC,EAAgB,MAAMC,EAC1B,MAAMC,EAAcN,EAAO,CAAE,YAAuB,CAAC,CACvD,EAEA,OAAAF,EAAiB,QAAUM,EAEpBG,EAAiBH,CAAa,CACvC,EAAG,C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W,EAAA,CAAK,IAAKN,EAAK,CAAE,EACjC,CACF,CAEJ,CACF,CAAC,CACH","names":["init_esm_shims","init_esm_shims","import_variant","React","init_esm_shims","preview","useCallback","useEffect","useRef","usePreviewServer","previewServerRef","useRef","model","useProjectModel","useEffect","useCallback","previewServer","preview","getViteConfig","getViteServerUrl","ServeCommand","model","useProjectModel","t","useTranslation","arm","useARMClient","site","useSiteId","createPreviewServer","usePreviewServer","status","useAsync","assertBuildOutputExists","serverUrl","manifest","readAppManifestFile","updatedManifest","updateAppManifestWithBaseUrl","React","Spinner","tag","component","DevCenterComponent","url","createDashboardPageUrl","Box_default","Text","SuccessIcon","Trans","Link"]}
1
+ {"version":3,"sources":["../src/components/ServeCommand/index.ts","../src/components/ServeCommand/ServeCommand.tsx","../src/components/ServeCommand/hooks/usePreviewServer.ts"],"sourcesContent":["export { ServeCommand } from './ServeCommand.js';\n","import { isType, match } from 'variant';\nimport { updateAppManifestWithBaseUrl } from '@wix/cli-app-manifest';\nimport { useARMClient } from '@wix/arm-client';\nimport {\n Box,\n Link,\n Spinner,\n SuccessIcon,\n Text,\n useAsync,\n} from '@wix/cli-ui-kit';\nimport React from 'react';\nimport { Trans, useTranslation } from '@wix/cli-i18n';\nimport { createDashboardPageUrl } from '../../dashboard-page-url.js';\nimport { useProjectModel } from '../../model.js';\nimport { readAppManifestFile } from '../../app-manifest/file.js';\nimport { DevCenterComponent } from '../../dev-center/components/dev-center-component.js';\nimport { assertBuildOutputExists } from '../../files/assert-build-output-exists.js';\nimport { useSiteId } from '../../site-id/useSiteId.js';\nimport { usePreviewServer } from './hooks/usePreviewServer.js';\n\nexport function ServeCommand() {\n const { model } = useProjectModel();\n const { t } = useTranslation();\n const arm = useARMClient();\n const { site } = useSiteId();\n const createPreviewServer = usePreviewServer();\n\n const { status } = useAsync(async () => {\n await assertBuildOutputExists(model.projectFolder);\n const serverUrl = await createPreviewServer();\n\n const manifest = await readAppManifestFile(model.projectFolder);\n const updatedManifest = updateAppManifestWithBaseUrl(manifest, serverUrl);\n\n const tag = await arm.createAppRelease(\n updatedManifest,\n model.config.projectId\n );\n\n return { tag, serverUrl };\n }, []);\n\n return match(status, {\n Loading: () => (\n <Spinner text={t('serve_command.starting_serve_environment')}></Spinner>\n ),\n Error: () => null,\n Success: ({ result: { tag, serverUrl } }) => {\n const [component] = model.components.filter(\n isType(DevCenterComponent.DashboardPage)\n );\n const url = createDashboardPageUrl({\n appId: model.config.appId,\n siteId: site.id,\n component,\n tag,\n });\n\n return (\n <Box paddingTop={1} flexDirection=\"column\">\n <Box gap={1}>\n <Text skin=\"success\">\n <SuccessIcon />\n </Text>\n <Trans\n i18nKey=\"serve_command.starting_serve_environment_success\"\n components={[<Link url={serverUrl} />]}\n />\n </Box>\n <Trans\n i18nKey=\"general.dashboard_page_text\"\n components={[<Link url={url} />]}\n />\n </Box>\n );\n },\n });\n}\n","import { preview, type PreviewServer } from 'vite';\nimport { useCallback, useEffect, useRef } from 'react';\nimport { useProjectModel } from '../../../model.js';\nimport { getViteConfig } from '../../../vite/index.js';\nimport { getViteServerUrl } from '../../../vite/vite-server-url.js';\nimport { ConfigType } from '../../../vite/vite-config-options.js';\n\nexport function usePreviewServer() {\n const previewServerRef = useRef<PreviewServer>();\n const { model } = useProjectModel();\n\n useEffect(() => {\n return () => {\n previewServerRef.current?.httpServer.close();\n };\n }, []);\n\n return useCallback(async () => {\n const previewServer = await preview(\n await getViteConfig(model, { type: ConfigType.build })\n );\n\n previewServerRef.current = previewServer;\n\n return getViteServerUrl(previewServer);\n }, [model]);\n}\n"],"mappings":";;qfAAAA,ICAAC,IAAA,IAAAC,EAA8B,SAW9B,OAAOC,MAAW,QCXlBC,IAAA,OAAS,WAAAC,MAAmC,OAC5C,OAAS,eAAAC,EAAa,aAAAC,EAAW,UAAAC,MAAc,QAMxC,SAASC,GAAmB,CACjC,IAAMC,EAAmBC,EAAsB,EACzC,CAAE,MAAAC,CAAM,EAAIC,EAAgB,EAElC,OAAAC,EAAU,IACD,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,EAAA,CAAK,KAAK,WACTR,EAAA,cAACS,EAAA,IAAY,CACf,EACAT,EAAA,cAACU,EAAA,CACC,QAAQ,mDACR,WAAY,CAACV,EAAA,cAACW,EAAA,CAAK,IAAKhB,EAAW,CAAE,EACvC,CACF,EACAK,EAAA,cAACU,EAAA,CACC,QAAQ,8BACR,WAAY,CAACV,EAAA,cAACW,EAAA,CAAK,IAAKN,EAAK,CAAE,EACjC,CACF,CAEJ,CACF,CAAC,CACH","names":["init_esm_shims","init_esm_shims","import_variant","React","init_esm_shims","preview","useCallback","useEffect","useRef","usePreviewServer","previewServerRef","useRef","model","useProjectModel","useEffect","useCallback","previewServer","preview","getViteConfig","getViteServerUrl","ServeCommand","model","useProjectModel","t","useTranslation","arm","useARMClient","site","useSiteId","createPreviewServer","usePreviewServer","status","useAsync","assertBuildOutputExists","serverUrl","manifest","readAppManifestFile","updatedManifest","updateAppManifestWithBaseUrl","React","Spinner","tag","component","DevCenterComponent","url","createDashboardPageUrl","Box_default","Text","SuccessIcon","Trans","Link"]}
@@ -0,0 +1,4 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import{c as a}from"./chunk-7XQUV5HO.js";import"./chunk-AWOTQVII.js";import"./chunk-7PCCZH2Q.js";import"./chunk-44TZXTHO.js";import"./chunk-BXSRILE5.js";import"./chunk-NQPO4DHF.js";import"./chunk-GXCVI5BG.js";import"./chunk-HFDLXX7R.js";export{a as SiteIdProvider};
4
+ //# sourceMappingURL=SiteIdProvider-UIS4BKVC.js.map
@@ -1,4 +1,4 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{a as n,b as a,c}from"./chunk-FGP4AKBM.js";import{b as p}from"./chunk-DUZ55BRL.js";import{a as m}from"./chunk-IJ6QC2OQ.js";import"./chunk-JI4J5GCL.js";import{Q as i,c as r,d as e}from"./chunk-52CFCSNQ.js";import{h as t}from"./chunk-HFDLXX7R.js";t();import{cwd as f}from"node:process";import{build as s}from"vite";async function A(){let o=await i(f());n(o.components);let d=await s(await p(o,{type:"build"})).catch(()=>{throw new r({code:e.FailedToBuildApp()})}),l=await a({appId:o.config.appId,components:o.components,sentryDSN:o.config.sentryDSN,componentSourceBuilder:c({model:o,buildOutput:d})});await m({projectFolder:o.projectFolder,manifest:l})}export{A as build};
4
- //# sourceMappingURL=build-2RGFEOAH.js.map
3
+ import{a as n,b as a,c}from"./chunk-7T43YDHD.js";import{b as p}from"./chunk-HMJ5TWEC.js";import{a as m}from"./chunk-BJOLH7YC.js";import"./chunk-SGABAIB5.js";import{$ as i,c as r,d as e}from"./chunk-GXCVI5BG.js";import{h as t}from"./chunk-HFDLXX7R.js";t();import{cwd as f}from"node:process";import{build as s}from"vite";async function A(){let o=await i(f());n(o.components);let d=await s(await p(o,{type:"build"})).catch(()=>{throw new r({code:e.FailedToBuildApp()})}),l=await a({appId:o.config.appId,components:o.components,sentryDSN:o.config.sentryDSN,componentSourceBuilder:c({model:o,buildOutput:d})});await m({projectFolder:o.projectFolder,manifest:l})}export{A as build};
4
+ //# sourceMappingURL=build-X5PQLJYY.js.map
@@ -1,4 +1,4 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{a as O}from"./chunk-5CJ7KYIU.js";import{c as S,d as x,f as h}from"./chunk-U6YFRFIX.js";import{E as y,H as R,a as D,c as d,d as l,h as o,i as w,m as P,n as q,o as b}from"./chunk-52CFCSNQ.js";import{e as F,h as i}from"./chunk-HFDLXX7R.js";i();import{useMemo as E}from"react";i();i();var A={},I={sites:"_site"},J={createdDate:"google.protobuf.Timestamp",updatedDate:"google.protobuf.Timestamp",trashedDate:"google.protobuf.Timestamp"};function j(s){var t={"www._base_domain_":[{srcPath:"/_api/sites-list",destPath:"/api"},{srcPath:"/_api/sites-list/v2/sites",destPath:"/v2/sites"}],"feedback._base_domain_":[{srcPath:"/_api/sites-list",destPath:"/api"}],"manage._base_domain_":[{srcPath:"/_api/sites-list",destPath:"/api"},{srcPath:"/_api/sites-list/v2/sites",destPath:"/v2/sites"},{srcPath:"/_api/sites-list-data",destPath:"/api/sites-list-data"}],"www.wixapis.com":[{srcPath:"/site-list/v2/sites",destPath:"/v2/sites"}],"api._api_base_domain_":[{srcPath:"/sites-list",destPath:""}],"bo._base_domain_":[{srcPath:"/_api/sites-list/v2/sites",destPath:"/v2/sites"}],"dev._base_domain_":[{srcPath:"/_api/sites-list/v2/sites",destPath:"/v2/sites"}]};return x(Object.assign(s,{domainToMappings:t}))}function g(s){var t=h(A,{}),e=t.toJSON,r=t.fromJSON,a=h(I,{_site:J}).fromJSON;function m(T){var L=T.host,C=e(s),N={entityFqdn:"wix.site_list.v2.site",method:"POST",methodFqn:"com.wixpress.sitelist.api.SiteListServiceV2.QuerySites",url:j({protoPath:"/v2/sites/query",data:C,host:L}),data:C,transformResponse:a};return N}return m.fromReq=r,m}i();var z=o.object({id:o.string(),displayName:o.string(),viewUrl:o.union([o.string().url(),o.literal("")])}),v=o.object({sites:o.array(z)});var c=class{constructor(t){this.httpClient=t;let{minRetryTimeout:e}=w();this.retryOptions={retries:3,minTimeout:e,maxTimeout:3*1e3}}retryOptions;querySites=async(t={})=>{try{let{data:e}=await S(()=>this.httpClient.request(g(t)),this.retryOptions);return v.parse(e).sites}catch(e){throw new d({code:l.FailedToQuerySites(),cause:e,info:{...t}})}};getSite=async t=>{try{let{data:e}=await S(()=>this.httpClient.request(g({query:{filter:{id:{$in:[t]}}}})),this.retryOptions),{sites:r}=v.parse(e);return r.at(0)??null}catch(e){throw new d({code:l.FailedToGetSite(),cause:e,info:{id:t}})}}};function V(){let s=O({type:"backoffice"});return E(()=>new c(s),[s])}i();i();async function _(s,t){let e=y(s);if(!await b(e))return null;try{let a=await q(e),m=await R.safeParseAsync(a);return m.success?m.data:null}catch(a){return t?.(a),null}}async function ft(s,t){let r={...await _(s)??{},...t};await P(y(s),r)}i();var u=F(D(),1),f=(0,u.variant)({NotConfigured:{},NotFound:(0,u.fields)(),Resolved:(0,u.fields)()});i();async function vt({projectFolder:s,siteListClient:{getSite:t},writeDebugLog:e}){let r=await _(s,e);if(!r?.siteId)return f.NotConfigured();let a=await t(r.siteId);return a?f.Resolved({site:a}):f.NotFound({id:r.siteId})}export{c as a,V as b,_ as c,ft as d,f as e,vt as f};
4
- //# sourceMappingURL=chunk-6G7R73WW.js.map
3
+ import{a as O}from"./chunk-BXSRILE5.js";import{c as S,d as x,f as h}from"./chunk-NQPO4DHF.js";import{G as y,J as R,a as D,c as d,d as l,h as o,i as w,m as P,n as q,o as b}from"./chunk-GXCVI5BG.js";import{e as F,h as i}from"./chunk-HFDLXX7R.js";i();import{useMemo as E}from"react";i();i();var A={},I={sites:"_site"},J={createdDate:"google.protobuf.Timestamp",updatedDate:"google.protobuf.Timestamp",trashedDate:"google.protobuf.Timestamp"};function j(s){var t={"www._base_domain_":[{srcPath:"/_api/sites-list",destPath:"/api"},{srcPath:"/_api/sites-list/v2/sites",destPath:"/v2/sites"}],"feedback._base_domain_":[{srcPath:"/_api/sites-list",destPath:"/api"}],"manage._base_domain_":[{srcPath:"/_api/sites-list",destPath:"/api"},{srcPath:"/_api/sites-list/v2/sites",destPath:"/v2/sites"},{srcPath:"/_api/sites-list-data",destPath:"/api/sites-list-data"}],"www.wixapis.com":[{srcPath:"/site-list/v2/sites",destPath:"/v2/sites"}],"api._api_base_domain_":[{srcPath:"/sites-list",destPath:""}],"bo._base_domain_":[{srcPath:"/_api/sites-list/v2/sites",destPath:"/v2/sites"}],"dev._base_domain_":[{srcPath:"/_api/sites-list/v2/sites",destPath:"/v2/sites"}]};return x(Object.assign(s,{domainToMappings:t}))}function g(s){var t=h(A,{}),e=t.toJSON,r=t.fromJSON,a=h(I,{_site:J}).fromJSON;function m(T){var L=T.host,C=e(s),N={entityFqdn:"wix.site_list.v2.site",method:"POST",methodFqn:"com.wixpress.sitelist.api.SiteListServiceV2.QuerySites",url:j({protoPath:"/v2/sites/query",data:C,host:L}),data:C,transformResponse:a};return N}return m.fromReq=r,m}i();var z=o.object({id:o.string(),displayName:o.string(),viewUrl:o.union([o.string().url(),o.literal("")])}),v=o.object({sites:o.array(z)});var c=class{constructor(t){this.httpClient=t;let{minRetryTimeout:e}=w();this.retryOptions={retries:3,minTimeout:e,maxTimeout:3*1e3}}retryOptions;querySites=async(t={})=>{try{let{data:e}=await S(()=>this.httpClient.request(g(t)),this.retryOptions);return v.parse(e).sites}catch(e){throw new d({code:l.FailedToQuerySites(),cause:e,info:{...t}})}};getSite=async t=>{try{let{data:e}=await S(()=>this.httpClient.request(g({query:{filter:{id:{$in:[t]}}}})),this.retryOptions),{sites:r}=v.parse(e);return r.at(0)??null}catch(e){throw new d({code:l.FailedToGetSite(),cause:e,info:{id:t}})}}};function V(){let s=O({type:"backoffice"});return E(()=>new c(s),[s])}i();i();async function _(s,t){let e=y(s);if(!await b(e))return null;try{let a=await q(e),m=await R.safeParseAsync(a);return m.success?m.data:null}catch(a){return t?.(a),null}}async function ft(s,t){let r={...await _(s)??{},...t};await P(y(s),r)}i();var u=F(D(),1),f=(0,u.variant)({NotConfigured:{},NotFound:(0,u.fields)(),Resolved:(0,u.fields)()});i();async function vt({projectFolder:s,siteListClient:{getSite:t},writeDebugLog:e}){let r=await _(s,e);if(!r?.siteId)return f.NotConfigured();let a=await t(r.siteId);return a?f.Resolved({site:a}):f.NotFound({id:r.siteId})}export{c as a,V as b,_ as c,ft as d,f as e,vt as f};
4
+ //# sourceMappingURL=chunk-44TZXTHO.js.map
@@ -1,6 +1,6 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{g as m}from"./chunk-U6YFRFIX.js";import{b as c}from"./chunk-52CFCSNQ.js";import{e as i,h as r}from"./chunk-HFDLXX7R.js";r();var u=i(c(),1);import{dirname as b}from"node:path";import{appendFileSync as x,mkdirSync as L}from"node:fs";import D,{createContext as w,useContext as y,useCallback as C}from"react";r();var p=i(m(),1),f=i(c(),1);function s(e){if(p.HttpClient.isHttpError(e))return e;let o=e instanceof Error?f.default.cause(e):null;return o?s(o):null}r();function l(e){return{request:{baseURL:e.config?.baseURL,url:e.config?.url,method:e.config?.method,headers:e.config?.headers,data:e.config?.data},response:{code:e.code,message:e.message,status:e.response?.status,headers:e.response?.headers,data:e.response?.data}}}function H(e,o){try{let t=`----- CLI crash report at ${new Date().toISOString()}
3
+ import{g as m}from"./chunk-NQPO4DHF.js";import{b as c}from"./chunk-GXCVI5BG.js";import{e as i,h as r}from"./chunk-HFDLXX7R.js";r();var u=i(c(),1);import{dirname as b}from"node:path";import{appendFileSync as x,mkdirSync as L}from"node:fs";import D,{createContext as w,useContext as y,useCallback as C}from"react";r();var p=i(m(),1),f=i(c(),1);function s(e){if(p.HttpClient.isHttpError(e))return e;let o=e instanceof Error?f.default.cause(e):null;return o?s(o):null}r();function l(e){return{request:{baseURL:e.config?.baseURL,url:e.config?.url,method:e.config?.method,headers:e.config?.headers,data:e.config?.data},response:{code:e.code,message:e.message,status:e.response?.status,headers:e.response?.headers,data:e.response?.data}}}function H(e,o){try{let t=`----- CLI crash report at ${new Date().toISOString()}
4
4
  `;if(o instanceof Error){t+=`Error Trace
5
5
  `,t+=`${u.default.fullStack(o)}
6
6
  `,t+=`Error Info
@@ -8,4 +8,4 @@ import{g as m}from"./chunk-U6YFRFIX.js";import{b as c}from"./chunk-52CFCSNQ.js";
8
8
  `;let n=s(o);n&&(t+=`Request Info
9
9
  `,t+=`${JSON.stringify(l(n),null,2)}
10
10
  `)}L(b(e),{recursive:!0}),x(e,t)}catch{}}var d=w(null),P=({filePath:e,children:o})=>{let t=C(n=>H(e,n),[e]);return D.createElement(d.Provider,{value:t},o)},N=()=>{let e=y(d);if(e===null)throw new Error("useDebugLog() cannot be used without an <DebugLogProvider>");return e};export{P as a,N as b};
11
- //# sourceMappingURL=chunk-JZEMYLWD.js.map
11
+ //# sourceMappingURL=chunk-7PCCZH2Q.js.map
@@ -1,4 +1,4 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{a as y}from"./chunk-5CJ7KYIU.js";import{c as v,d as C,f as i,i as A}from"./chunk-U6YFRFIX.js";import{a as I,c as d,d as g,h as u,i as P}from"./chunk-52CFCSNQ.js";import{e as M,h as s}from"./chunk-HFDLXX7R.js";s();s();var N={},F={};var J={},U={},z={},H={};function w(p){var e={"api._api_base_domain_":[{srcPath:"/apps-release-manager-service-web",destPath:""}],"bo._base_domain_":[{srcPath:"/apps-release-manager-service-web",destPath:""}],"www._base_domain_":[{srcPath:"/apps-release-manager-service-web/artifacts-release-manager/app-releases",destPath:"/artifacts-release-manager/app-releases"},{srcPath:"/_api/apps-release-manager-service-web/artifacts-release-manager/app-releases",destPath:"/artifacts-release-manager/app-releases"},{srcPath:"/apps-release-manager-service-web/apps/create",destPath:"/apps/create"},{srcPath:"/apps-release-manager-service-web/apps/promote",destPath:"/apps/promote"},{srcPath:"/apps-release-manager-service-web/apps/tags",destPath:"/apps/tags"}],"manage._base_domain_":[{srcPath:"/apps-release-manager-service-web/apps/promote",destPath:"/apps/promote"},{srcPath:"/apps-release-manager-service-web/apps/create",destPath:"/apps/create"},{srcPath:"/apps-release-manager-service-web/apps/tags",destPath:"/apps/tags"}]};return C(Object.assign(p,{domainToMappings:e}))}function b(p){var e=i(N,{}),a=e.toJSON,t=e.fromJSON,o=i(F,{}).fromJSON;function r(m){var c=m.host,n=a(p),l={entityFqdn:"wix.ctp.gradual_rollout.v1.app_config",method:"POST",methodFqn:"com.wix.ctp.AppsReleaseManagerService.CreateAppRelease",url:w({protoPath:"/apps/create/{appId}",data:n,host:c}),data:n,transformResponse:o};return l}return r.fromReq=t,r.__isAmbassador=!0,r}function q(p){var e=i(z,{}),a=e.toJSON,t=e.fromJSON,o=i(H,{}).fromJSON;function r(m){var c=m.host,n=a(p),l={entityFqdn:"wix.ctp.gradual_rollout.v1.app_config",method:"PUT",methodFqn:"com.wix.ctp.AppsReleaseManagerService.UpdateAppRelease",url:w({protoPath:"/apps/tags/{tag}",data:n,host:c}),data:n,transformResponse:o};return l}return r.fromReq=t,r.__isAmbassador=!0,r}function x(p){var e=i(J,{}),a=e.toJSON,t=e.fromJSON,o=i(U,{}).fromJSON;function r(m){var c=m.host,n=a(p),l={entityFqdn:"wix.ctp.gradual_rollout.v1.app_config",method:"POST",methodFqn:"com.wix.ctp.AppsReleaseManagerService.PromoteAppReleaseToDevCenter",url:w({protoPath:"/apps/promote/{appId}/{tag}",data:n,host:c}),data:n,transformResponse:o};return l}return r.fromReq=t,r.__isAmbassador=!0,r}var _=M(I(),1);s();var S=u.object({newVersion:u.string()}),T=u.object({tag:u.string()});var{AppPermissionDenied:O}=g,D=(0,_.variant)({TagUpdated:{},TagNotFound:(0,_.fields)()}),R=class{constructor(e){this.httpClient=e;let{minRetryTimeout:a}=P();this.retryOptions={retries:3,minTimeout:a,maxTimeout:3*1e3}}retryOptions;createAppRelease=async(e,a)=>{try{let{data:t}=await v(()=>this.httpClient.request(b({appId:e.appId,componentConfigs:e.components,projectId:a})),this.retryOptions);return T.parse(t).tag}catch(t){throw A(t)&&t.response?.status===403?new d({code:O({appId:e.appId}),cause:t}):new d({code:g.FailedToCreateAppRelease(),cause:t})}};updateAppRelease=async(e,a)=>{try{return await v(()=>this.httpClient.request(q({appId:e.appId,componentConfigs:e.components,tag:a})),this.retryOptions),D.TagUpdated()}catch(t){if(A(t)){if(t.response?.status===404)return D.TagNotFound({cause:t});if(t.response?.status===403)throw new d({code:O({appId:e.appId}),cause:t})}throw new d({code:g.FailedToUpdateAppRelease(),cause:t})}};promoteToDevCenter=async(e,a,t)=>{let{data:o}=await v(()=>this.httpClient.request(x({appId:e,tag:a,versionType:t})),this.retryOptions);return S.parse(o)}};s();import{useMemo as E}from"react";function j(){let p=y({type:"backoffice"});return E(()=>new R(p),[p])}s();s();function de(p){let{appId:e,siteId:a,tag:t,component:o}=p,r=new URL(`dashboard/${a}/app/${e}${o.route}`,"https://manage.wix.com/");return r.searchParams.append("apps-override",t),r.toString()}export{R as a,j as b,de as c};
4
- //# sourceMappingURL=chunk-JDGDMH7E.js.map
3
+ import{a as y}from"./chunk-BXSRILE5.js";import{c as v,d as C,f as i,i as A}from"./chunk-NQPO4DHF.js";import{a as I,c as d,d as g,h as u,i as P}from"./chunk-GXCVI5BG.js";import{e as M,h as s}from"./chunk-HFDLXX7R.js";s();s();var N={},F={};var J={},U={},z={},H={};function w(p){var e={"api._api_base_domain_":[{srcPath:"/apps-release-manager-service-web",destPath:""}],"bo._base_domain_":[{srcPath:"/apps-release-manager-service-web",destPath:""}],"www._base_domain_":[{srcPath:"/apps-release-manager-service-web/artifacts-release-manager/app-releases",destPath:"/artifacts-release-manager/app-releases"},{srcPath:"/_api/apps-release-manager-service-web/artifacts-release-manager/app-releases",destPath:"/artifacts-release-manager/app-releases"},{srcPath:"/apps-release-manager-service-web/apps/create",destPath:"/apps/create"},{srcPath:"/apps-release-manager-service-web/apps/promote",destPath:"/apps/promote"},{srcPath:"/apps-release-manager-service-web/apps/tags",destPath:"/apps/tags"}],"manage._base_domain_":[{srcPath:"/apps-release-manager-service-web/apps/promote",destPath:"/apps/promote"},{srcPath:"/apps-release-manager-service-web/apps/create",destPath:"/apps/create"},{srcPath:"/apps-release-manager-service-web/apps/tags",destPath:"/apps/tags"}]};return C(Object.assign(p,{domainToMappings:e}))}function b(p){var e=i(N,{}),a=e.toJSON,t=e.fromJSON,o=i(F,{}).fromJSON;function r(m){var c=m.host,n=a(p),l={entityFqdn:"wix.ctp.gradual_rollout.v1.app_config",method:"POST",methodFqn:"com.wix.ctp.AppsReleaseManagerService.CreateAppRelease",url:w({protoPath:"/apps/create/{appId}",data:n,host:c}),data:n,transformResponse:o};return l}return r.fromReq=t,r.__isAmbassador=!0,r}function q(p){var e=i(z,{}),a=e.toJSON,t=e.fromJSON,o=i(H,{}).fromJSON;function r(m){var c=m.host,n=a(p),l={entityFqdn:"wix.ctp.gradual_rollout.v1.app_config",method:"PUT",methodFqn:"com.wix.ctp.AppsReleaseManagerService.UpdateAppRelease",url:w({protoPath:"/apps/tags/{tag}",data:n,host:c}),data:n,transformResponse:o};return l}return r.fromReq=t,r.__isAmbassador=!0,r}function x(p){var e=i(J,{}),a=e.toJSON,t=e.fromJSON,o=i(U,{}).fromJSON;function r(m){var c=m.host,n=a(p),l={entityFqdn:"wix.ctp.gradual_rollout.v1.app_config",method:"POST",methodFqn:"com.wix.ctp.AppsReleaseManagerService.PromoteAppReleaseToDevCenter",url:w({protoPath:"/apps/promote/{appId}/{tag}",data:n,host:c}),data:n,transformResponse:o};return l}return r.fromReq=t,r.__isAmbassador=!0,r}var _=M(I(),1);s();var S=u.object({newVersion:u.string()}),T=u.object({tag:u.string()});var{AppPermissionDenied:O}=g,D=(0,_.variant)({TagUpdated:{},TagNotFound:(0,_.fields)()}),R=class{constructor(e){this.httpClient=e;let{minRetryTimeout:a}=P();this.retryOptions={retries:3,minTimeout:a,maxTimeout:3*1e3}}retryOptions;createAppRelease=async(e,a)=>{try{let{data:t}=await v(()=>this.httpClient.request(b({appId:e.appId,componentConfigs:e.components,projectId:a})),this.retryOptions);return T.parse(t).tag}catch(t){throw A(t)&&t.response?.status===403?new d({code:O({appId:e.appId}),cause:t}):new d({code:g.FailedToCreateAppRelease(),cause:t})}};updateAppRelease=async(e,a)=>{try{return await v(()=>this.httpClient.request(q({appId:e.appId,componentConfigs:e.components,tag:a})),this.retryOptions),D.TagUpdated()}catch(t){if(A(t)){if(t.response?.status===404)return D.TagNotFound({cause:t});if(t.response?.status===403)throw new d({code:O({appId:e.appId}),cause:t})}throw new d({code:g.FailedToUpdateAppRelease(),cause:t})}};promoteToDevCenter=async(e,a,t)=>{let{data:o}=await v(()=>this.httpClient.request(x({appId:e,tag:a,versionType:t})),this.retryOptions);return S.parse(o)}};s();import{useMemo as E}from"react";function j(){let p=y({type:"backoffice"});return E(()=>new R(p),[p])}s();s();function de(p){let{appId:e,siteId:a,tag:t,component:o}=p,r=new URL(`dashboard/${a}/app/${e}${o.route}`,"https://manage.wix.com/");return r.searchParams.append("apps-override",t),r.toString()}export{R as a,j as b,de as c};
4
+ //# sourceMappingURL=chunk-7PDV5QDK.js.map
@@ -0,0 +1,4 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import{A as I,B as l,C as P,L as u,M as B,O as A,S as x,U as T,a as g,c as d,d as p,s as h,u as m,v as D,y as b,z as v}from"./chunk-GXCVI5BG.js";import{e as f,h as s}from"./chunk-HFDLXX7R.js";s();var M=f(g(),1);import{randomUUID as V}from"node:crypto";var N=t=>{let r=new Map;[...t].sort((e,i)=>e.id.localeCompare(i.id)).forEach(e=>{let i=r.get(e.id)??[];i.push(e),r.set(e.id,i)});let o=new Map;if(r.forEach((e,i)=>{e.length>1&&o.set(i,e)}),o.size)throw new d({code:p.DuplicateComponentIdsError({issues:Array.from(o.entries()).map(([e,i])=>({id:e,components:i.map(C=>(0,M.match)(C,{DashboardPage:({title:n,relativePath:c})=>({name:n,type:"page",path:u(c,"json")}),DashboardWidget:({title:n,relativePath:c})=>({name:n,type:"widget",path:u(c,"json")}),DashboardSidebarCategory:({label:n})=>({name:n,type:"sidebar-category",path:h}),EmbeddedScript:({relativePath:n})=>({name:n,type:"embedded-script",path:u(n,"json")}),CustomElement:({title:n,relativePath:c})=>({name:n,type:"custom-element",path:u(c,"json")})})).sort((C,n)=>C.name.localeCompare(n.name)),suggestedId:V()}))})})};s();var w=f(g(),1);var R=(t,r)=>{if(t.experiments)return{appId:r,componentId:t.id,spec:t.experiments.enabledBy,variantValue:"true"}};async function Y({appId:t,components:r,sentryDSN:a,componentSourceBuilder:o}){return N(r),{appId:t,components:await Promise.all(r.map((0,w.match)({DashboardPage:async e=>{let i=e.sentryDSN??a;return{compId:e.id,compType:m.BACK_OFFICE_PAGE,compData:{backOfficePage:{hostingPlatform:l.BUSINESS_MANAGER,fullPage:e.sidebar?.whenActive?.hideSidebar,hideInSidebar:e.sidebar?.disabled,priority:e.sidebar?.priority,routePath:e.route.slice(1),title:e.title,pageCategoryId:e.sidebar?.categoryId,activeSidebarPageId:e.sidebar?.whenActive?.selectedPageId,requiredPermission:e.requiredPermission,previousRoutePaths:e.additionalRoutes,...i?{errorReporting:{url:i}}:void 0,...await o(e)}},compName:e.title,experiment:R(e,t)}},DashboardWidget:async e=>({compId:e.id,compType:m.BACK_OFFICE_EXTENSION,compData:{backOfficeExtension:{hostingPlatform:l.BUSINESS_MANAGER,extends:e.containerId,title:e.title,extensionType:I.BACK_OFFICE_EXTENSION_WIDGET,requiredPermission:e.requiredPermission,widget:{width:e.width,height:e.height,...await o(e)},...e.sentryDSN?{errorReporting:{url:e.sentryDSN}}:void 0}},compName:e.title}),DashboardSidebarCategory:async e=>({compId:e.id,compType:m.BACK_OFFICE_SIDEBAR_CATEGORY,compData:{backOfficeSidebarCategory:{hostingPlatform:l.BUSINESS_MANAGER,title:e.label,priority:e.priority}},compName:e.label}),EmbeddedScript:async e=>({compId:e.id,compType:m.EMBEDDED_SCRIPT,compName:e.name,compData:{embeddedScriptComponentData:{name:e.name,pages:D.NONE_PAGES,placement:e.placement,connectArticleUrl:"",embedCategory:e.scriptType,loadOnce:!0,allowedForFreeSite:!0,...await o(e)}}}),CustomElement:async e=>({compId:e.id,compType:m.WEB,compName:e.title,compData:{webComponentData:{scriptType:v.MODULE,tagName:e.tagName,type:b.WIDGET,size:{width:e.width,height:e.height},installation:{base:{autoAdd:e.installation?.autoAddToSite,essential:e.installation?.essential,maxInstances:e.installation?.maxInstances}},...await o(e)}}})})))}}s();var _=f(g(),1);s();function O(t){if(!("output"in t||Array.isArray(t)))throw new d({code:p.InvalidViteBuildOutput()});return Array.isArray(t)?t.flatMap(o=>o.output):t.output}function S(t,r){let o=O(t).find(e=>e.type==="chunk"&&e.facadeModuleId===r);if(!o)throw new d({code:p.ViteModuleBundleNotFound()});return o.fileName}function F(t,r){let o=O(t).find(e=>e.fileName===r);if(!o||!("source"in o))throw new d({code:p.ViteFileNotFoundInOutput({fileName:r})});return o.source.toString()}async function j(t,r){let a=new URL(t.relativePath,r).href;return await fetch(a).then(e=>e.text())}var U=(t,r,a)=>{if(!r.config.trusted)return{iframeUrl:B(t.id)};let o=A(t.id),e=a?S(a,o):`/@id/${o}?import`;return{scriptAsset:{exportedName:t.id,containerId:r.config.appId,url:e,scriptType:P.MODULE}}},k=async(t,r,a)=>({template:r?F(r,t.relativePath):await j(t,a)}),G=(t,r)=>{let a=T(t.id);return{scriptTag:r?S(r,a):`/@id/${a}?import`,settingsUrl:x(t.id)}};function ne({model:t,buildOutput:r,devServerUrl:a}){return async o=>(0,_.match)(o,{EmbeddedScript:i=>k(i,r,a),DashboardSidebarCategory:()=>{},CustomElement:i=>G(i,r),DashboardPage:i=>U(i,t,r),DashboardWidget:i=>U(i,t,r)})}export{N as a,Y as b,ne as c};
4
+ //# sourceMappingURL=chunk-7T43YDHD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/app-manifest/validate.ts","../src/app-manifest/create.ts","../src/app-manifest/component-source.ts","../src/app-manifest/build-output-data-extractor.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport { match } from 'variant';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { CONFIG_FILENAME } from '@wix/cli-core-definitions';\nimport { replaceExtension } from '../dev-center/components/path.js';\nimport type { DevCenterComponent } from '../dev-center/components/dev-center-component.js';\n\nexport const validateComponents = (components: DevCenterComponent[]) => {\n const devCenterComponentsToIdMap: Map<string, DevCenterComponent[]> =\n new Map();\n const sortedComponentsById = [...components].sort((a, b) =>\n a.id.localeCompare(b.id)\n );\n sortedComponentsById.forEach((component) => {\n const componentList = devCenterComponentsToIdMap.get(component.id) ?? [];\n componentList.push(component);\n devCenterComponentsToIdMap.set(component.id, componentList);\n });\n\n const devCenterComponentsWithSameIDMap: Map<string, DevCenterComponent[]> =\n new Map();\n\n devCenterComponentsToIdMap.forEach((devCenterComponents, key) => {\n if (devCenterComponents.length > 1) {\n devCenterComponentsWithSameIDMap.set(key, devCenterComponents);\n }\n });\n\n if (devCenterComponentsWithSameIDMap.size) {\n throw new CliError({\n code: CliErrorCode.DuplicateComponentIdsError({\n issues: Array.from(devCenterComponentsWithSameIDMap.entries()).map(\n ([id, devCenterComponents]) => {\n return {\n id,\n components: devCenterComponents\n .map((component) =>\n match(component, {\n DashboardPage: ({ title, relativePath }) => ({\n name: title,\n type: 'page' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n DashboardWidget: ({ title, relativePath }) => ({\n name: title,\n type: 'widget' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n DashboardSidebarCategory: ({ label }) => ({\n name: label,\n type: 'sidebar-category' as const,\n path: CONFIG_FILENAME,\n }),\n EmbeddedScript: ({ relativePath }) => ({\n name: relativePath,\n type: 'embedded-script' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n CustomElement: ({ title, relativePath }) => ({\n name: title,\n type: 'custom-element' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n })\n )\n .sort((a, b) => a.name.localeCompare(b.name)),\n suggestedId: randomUUID(),\n };\n }\n ),\n }),\n });\n }\n};\n","import {\n ComponentType,\n BackOfficeHostingPlatforms,\n ExtendingComponentType,\n EmbeddedScriptPages,\n ScriptType,\n ElementType,\n} from '@wix/ambassador-devcenter-components-v1-component/types';\nimport { match } from 'variant';\nimport type {\n AppManifest,\n ComponentExperiment,\n BackofficePage,\n BackofficeExtension,\n BackofficeSideCategory,\n EmbeddedScript,\n CustomElement,\n} from '@wix/cli-app-manifest';\nimport { validateComponents } from './validate.js';\nimport type { DevCenterComponent } from '../dev-center/components/dev-center-component.js';\nimport type { ComponentSourceBuilder } from './component-source.js';\n\ntype CreateAppManifestParams = {\n appId: string;\n components: DevCenterComponent[];\n sentryDSN?: string;\n componentSourceBuilder: ComponentSourceBuilder;\n};\n\nconst getExperiment = (\n component: DevCenterComponent<'DashboardPage'>,\n appId: string\n): ComponentExperiment => {\n if (component.experiments) {\n return {\n appId,\n componentId: component.id,\n spec: component.experiments.enabledBy,\n variantValue: 'true',\n };\n }\n return undefined;\n};\n\nexport async function createAppManifest({\n appId,\n components,\n sentryDSN,\n componentSourceBuilder,\n}: CreateAppManifestParams): Promise<AppManifest> {\n validateComponents(components);\n\n return {\n appId,\n components: await Promise.all(\n components.map(\n match({\n DashboardPage: async (component): Promise<BackofficePage> => {\n const componentSentryDSN = component.sentryDSN ?? sentryDSN;\n return {\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_PAGE as const,\n compData: {\n backOfficePage: {\n hostingPlatform: BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n fullPage: component.sidebar?.whenActive?.hideSidebar,\n hideInSidebar: component.sidebar?.disabled,\n priority: component.sidebar?.priority,\n routePath: component.route.slice(1),\n title: component.title,\n pageCategoryId: component.sidebar?.categoryId,\n activeSidebarPageId:\n component.sidebar?.whenActive?.selectedPageId,\n requiredPermission: component.requiredPermission,\n previousRoutePaths: component.additionalRoutes,\n ...(componentSentryDSN\n ? { errorReporting: { url: componentSentryDSN } }\n : undefined),\n ...(await componentSourceBuilder(component)),\n },\n },\n compName: component.title,\n experiment: getExperiment(component, appId),\n };\n },\n DashboardWidget: async (component): Promise<BackofficeExtension> => ({\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_EXTENSION as const,\n compData: {\n backOfficeExtension: {\n hostingPlatform: BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n extends: component.containerId,\n title: component.title,\n extensionType:\n ExtendingComponentType.BACK_OFFICE_EXTENSION_WIDGET as const,\n requiredPermission: component.requiredPermission,\n widget: {\n width: component.width,\n height: component.height,\n ...(await componentSourceBuilder(component)),\n },\n ...(component.sentryDSN\n ? { errorReporting: { url: component.sentryDSN } }\n : undefined),\n },\n },\n compName: component.title,\n }),\n DashboardSidebarCategory: async (\n component\n ): Promise<BackofficeSideCategory> => ({\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_SIDEBAR_CATEGORY as const,\n compData: {\n backOfficeSidebarCategory: {\n hostingPlatform: BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n title: component.label,\n priority: component.priority,\n },\n },\n compName: component.label,\n }),\n EmbeddedScript: async (component): Promise<EmbeddedScript> => ({\n compId: component.id,\n compType: ComponentType.EMBEDDED_SCRIPT as const,\n compName: component.name,\n compData: {\n embeddedScriptComponentData: {\n name: component.name,\n pages: EmbeddedScriptPages.NONE_PAGES,\n placement: component.placement,\n connectArticleUrl: '',\n embedCategory: component.scriptType,\n loadOnce: true,\n allowedForFreeSite: true,\n ...(await componentSourceBuilder(component)),\n },\n },\n }),\n CustomElement: async (component): Promise<CustomElement> => ({\n compId: component.id,\n compType: ComponentType.WEB as const,\n compName: component.title,\n compData: {\n webComponentData: {\n scriptType: ScriptType.MODULE,\n tagName: component.tagName,\n type: ElementType.WIDGET,\n size: {\n width: component.width,\n height: component.height,\n },\n installation: {\n base: {\n autoAdd: component.installation?.autoAddToSite,\n essential: component.installation?.essential,\n maxInstances: component.installation?.maxInstances,\n },\n },\n ...(await componentSourceBuilder(component)),\n },\n },\n }),\n })\n )\n ),\n };\n}\n","import { BackOfficeScriptAssetType } from '@wix/ambassador-devcenter-components-v1-component/types';\nimport type { ComponentSource } from '@wix/cli-app-manifest';\nimport { match } from 'variant';\nimport {\n virtualModuleIdForScriptAsset,\n virtualPathForHTMLAsset,\n} from '../dev-center/components/dashboard/config.js';\nimport {\n virtualModuleIdForCustomElementScriptAsset,\n virtualPathForCustomElementPanelHTMLAsset,\n} from '../dev-center/components/website/config.js';\nimport type { ProjectModel } from '../model.js';\nimport type { ViteBuildOutput } from './build-output-data-extractor.js';\nimport {\n extractModuleBundleContent,\n extractModuleBundleName,\n} from './build-output-data-extractor.js';\nimport type { DevCenterComponent } from '../dev-center/components/dev-center-component.js';\n\ntype DashboardSource =\n | {\n iframeUrl: string;\n scriptAsset?: never;\n }\n | {\n scriptAsset: ComponentSource['scriptAsset'];\n iframeUrl?: never;\n };\ntype EmbeddedScriptSource = {\n template: string;\n};\ntype CustomElementSource = { scriptTag: string; settingsUrl: string };\n\nexport type ComponentSourceBuilder = <T extends DevCenterComponent>(\n component: T\n) => Promise<\n T extends DevCenterComponent<'EmbeddedScript'>\n ? EmbeddedScriptSource\n : T extends DevCenterComponent<'CustomElement'>\n ? CustomElementSource\n : T extends DevCenterComponent<'DashboardPage'>\n ? DashboardSource\n : T extends DevCenterComponent<'DashboardWidget'>\n ? DashboardSource\n : undefined\n>;\n\nasync function getEmbeddedScriptDevTemplate(\n component: DevCenterComponent<'EmbeddedScript'>,\n devServerUrl?: string\n) {\n const url = new URL(component.relativePath, devServerUrl).href;\n const devTemplate = await fetch(url).then((res) => res.text());\n\n return devTemplate;\n}\n\nconst dashboardSourceBuilder = (\n component:\n | DevCenterComponent<'DashboardPage'>\n | DevCenterComponent<'DashboardWidget'>,\n model: ProjectModel,\n buildOutput?: ViteBuildOutput\n): DashboardSource => {\n if (!model.config.trusted) {\n return {\n iframeUrl: virtualPathForHTMLAsset(component.id),\n };\n }\n const moduleId = virtualModuleIdForScriptAsset(component.id);\n const componentUrl = buildOutput\n ? extractModuleBundleName(buildOutput, moduleId)\n : `/@id/${moduleId}?import`;\n\n return {\n scriptAsset: {\n exportedName: component.id,\n containerId: model.config.appId,\n url: componentUrl,\n scriptType: BackOfficeScriptAssetType.MODULE,\n },\n };\n};\n\nconst embeddedScriptBuilder = async (\n component: DevCenterComponent<'EmbeddedScript'>,\n buildOutput?: ViteBuildOutput,\n devServerUrl?: string\n): Promise<EmbeddedScriptSource> => {\n return {\n template: buildOutput\n ? extractModuleBundleContent(buildOutput, component.relativePath)\n : await getEmbeddedScriptDevTemplate(component, devServerUrl),\n };\n};\n\nconst customElementBuilder = (\n component: DevCenterComponent<'CustomElement'>,\n buildOutput?: ViteBuildOutput\n): CustomElementSource => {\n const moduleId = virtualModuleIdForCustomElementScriptAsset(component.id);\n const componentUrl = buildOutput\n ? extractModuleBundleName(buildOutput, moduleId)\n : `/@id/${moduleId}?import`;\n\n return {\n scriptTag: componentUrl,\n settingsUrl: virtualPathForCustomElementPanelHTMLAsset(component.id),\n };\n};\n\nexport function getComponentSourceBuilder({\n model,\n buildOutput,\n devServerUrl,\n}: {\n model: ProjectModel;\n buildOutput?: ViteBuildOutput;\n devServerUrl?: string;\n}) {\n return (async (component: DevCenterComponent) => {\n const source = match(component, {\n EmbeddedScript: (embeddedScriptComponent) =>\n embeddedScriptBuilder(\n embeddedScriptComponent,\n buildOutput,\n devServerUrl\n ),\n DashboardSidebarCategory: () => {},\n CustomElement: (customElementComponent) =>\n customElementBuilder(customElementComponent, buildOutput),\n DashboardPage: (dashboardPageComponent) =>\n dashboardSourceBuilder(dashboardPageComponent, model, buildOutput),\n DashboardWidget: (dashboardWidgetComponent) =>\n dashboardSourceBuilder(dashboardWidgetComponent, model, buildOutput),\n });\n\n return source;\n }) as ComponentSourceBuilder;\n}\n","import { CliError, CliErrorCode } from '@wix/cli-error';\nimport type { build } from 'vite';\n\nexport type ViteBuildOutput = Awaited<ReturnType<typeof build>>;\n\nfunction extractBuildOutputs(buildOutput: ViteBuildOutput) {\n const isValidRollupOutput =\n 'output' in buildOutput || Array.isArray(buildOutput);\n\n if (!isValidRollupOutput) {\n throw new CliError({ code: CliErrorCode.InvalidViteBuildOutput() });\n }\n\n const outputs = Array.isArray(buildOutput)\n ? buildOutput.flatMap((output) => output.output)\n : buildOutput.output;\n\n return outputs;\n}\n\nexport function extractModuleBundleName(\n buildOutput: ViteBuildOutput,\n moduleId: string\n) {\n const outputs = extractBuildOutputs(buildOutput);\n\n const output = outputs.find(\n (output) => output.type === 'chunk' && output.facadeModuleId === moduleId\n );\n\n if (!output) {\n throw new CliError({ code: CliErrorCode.ViteModuleBundleNotFound() });\n }\n\n return output.fileName;\n}\n\nexport function extractModuleBundleContent(\n buildOutput: ViteBuildOutput,\n fileName: string\n) {\n const outputs = extractBuildOutputs(buildOutput);\n\n const output = outputs.find((output) => output.fileName === fileName);\n\n if (!output || !('source' in output)) {\n throw new CliError({\n code: CliErrorCode.ViteFileNotFoundInOutput({ fileName }),\n });\n }\n\n return output.source.toString();\n}\n"],"mappings":";;gMAAAA,IACA,IAAAC,EAAsB,SADtB,OAAS,cAAAC,MAAkB,cAOpB,IAAMC,EAAsBC,GAAqC,CACtE,IAAMC,EACJ,IAAI,IACuB,CAAC,GAAGD,CAAU,EAAE,KAAK,CAACE,EAAGC,IACpDD,EAAE,GAAG,cAAcC,EAAE,EAAE,CACzB,EACqB,QAASC,GAAc,CAC1C,IAAMC,EAAgBJ,EAA2B,IAAIG,EAAU,EAAE,GAAK,CAAC,EACvEC,EAAc,KAAKD,CAAS,EAC5BH,EAA2B,IAAIG,EAAU,GAAIC,CAAa,CAC5D,CAAC,EAED,IAAMC,EACJ,IAAI,IAQN,GANAL,EAA2B,QAAQ,CAACM,EAAqBC,IAAQ,CAC3DD,EAAoB,OAAS,GAC/BD,EAAiC,IAAIE,EAAKD,CAAmB,CAEjE,CAAC,EAEGD,EAAiC,KACnC,MAAM,IAAIG,EAAS,CACjB,KAAMC,EAAa,2BAA2B,CAC5C,OAAQ,MAAM,KAAKJ,EAAiC,QAAQ,CAAC,EAAE,IAC7D,CAAC,CAACK,EAAIJ,CAAmB,KAChB,CACL,GAAAI,EACA,WAAYJ,EACT,IAAKH,MACJ,SAAMA,EAAW,CACf,cAAe,CAAC,CAAE,MAAAQ,EAAO,aAAAC,CAAa,KAAO,CAC3C,KAAMD,EACN,KAAM,OACN,KAAME,EAAiBD,EAAc,MAAM,CAC7C,GACA,gBAAiB,CAAC,CAAE,MAAAD,EAAO,aAAAC,CAAa,KAAO,CAC7C,KAAMD,EACN,KAAM,SACN,KAAME,EAAiBD,EAAc,MAAM,CAC7C,GACA,yBAA0B,CAAC,CAAE,MAAAE,CAAM,KAAO,CACxC,KAAMA,EACN,KAAM,mBACN,KAAMC,CACR,GACA,eAAgB,CAAC,CAAE,aAAAH,CAAa,KAAO,CACrC,KAAMA,EACN,KAAM,kBACN,KAA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E,CAAQ,EAC7C,QAAQA,CAAQ,UAEpB,MAAO,CACL,YAAa,CACX,aAAcR,EAAU,GACxB,YAAaK,EAAM,OAAO,MAC1B,IAAKK,EACL,WAAYE,EAA0B,MACxC,CACF,CACF,EAEMC,EAAwB,MAC5Bb,EACAM,EACAL,KAEO,CACL,SAAUK,EACNQ,EAA2BR,EAAaN,EAAU,YAAY,EAC9D,MAAMD,EAA6BC,EAAWC,CAAY,CAChE,GAGIc,EAAuB,CAC3Bf,EACAM,IACwB,CACxB,IAAME,EAAWQ,EAA2ChB,EAAU,EAAE,EAKxE,MAAO,CACL,UALmBM,EACjBK,EAAwBL,EAAaE,CAAQ,EAC7C,QAAQA,CAAQ,UAIlB,YAAaS,EAA0CjB,EAAU,EAAE,CACrE,CACF,EAEO,SAASkB,GAA0B,CACxC,MAAAb,EACA,YAAAC,EACA,aAAAL,CACF,EAIG,CACD,MAAQ,OAAOD,MACE,SAAMA,EAAW,CAC9B,eAAiBmB,GACfN,EACEM,EACAb,EACAL,CACF,EACF,yBAA0B,IAAM,CAAC,EACjC,cAAgBmB,GACdL,EAAqBK,EAAwBd,CAAW,EAC1D,cAAgBe,GACdjB,EAAuBiB,EAAwBhB,EAAOC,CAAW,EACnE,gBAAkBgB,GAChBlB,EAAuBkB,EAA0BjB,EAAOC,CAAW,CACvE,CAAC,CAIL","names":["init_esm_shims","import_variant","randomUUID","validateComponents","components","devCenterComponentsToIdMap","a","b","component","componentList","devCenterComponentsWithSameIDMap","devCenterComponents","key","CliError","CliErrorCode","id","title","relativePath","replaceExtension","label","CONFIG_FILENAME","randomUUID","init_esm_shims","import_variant","getExperiment","component","appId","createAppManifest","components","sentryDSN","componentSourceBuilder","validateComponents","componentSentryDSN","ComponentType","BackOfficeHostingPlatforms","ExtendingComponentType","EmbeddedScriptPages","ScriptType","ElementType","init_esm_shims","import_variant","init_esm_shims","extractBuildOutputs","buildOutput","CliError","CliErrorCode","output","extractModuleBundleName","moduleId","extractModuleBundleContent","fileName","getEmbeddedScriptDevTemplate","component","devServerUrl","url","res","dashboardSourceBuilder","model","buildOutput","virtualPathForHTMLAsset","moduleId","virtualModuleIdForScriptAsset","componentUrl","extractModuleBundleName","BackOfficeScriptAssetType","embeddedScriptBuilder","extractModuleBundleContent","customElementBuilder","virtualModuleIdForCustomElementScriptAsset","virtualPathForCustomElementPanelHTMLAsset","getComponentSourceBuilder","embeddedScriptComponent","customElementComponent","dashboardPageComponent","dashboardWidgetComponent"]}
@@ -0,0 +1,4 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import{a as ve}from"./chunk-AWOTQVII.js";import{b as de}from"./chunk-7PCCZH2Q.js";import{b as j,d as le,e as _e,f as ue}from"./chunk-44TZXTHO.js";import{a as W}from"./chunk-BXSRILE5.js";import{A as z,B as C,C as B,F as x,G as g,I as ne,Q as me,a as re,b as oe,c as R,d as b,e as A,f as _,n as pe,o as se,u as O,v as M,w as T,x as ie,z as P}from"./chunk-NQPO4DHF.js";import{D as ce,a as D,ba as U,c as f,d as h,h as m,i as G}from"./chunk-GXCVI5BG.js";import{e as y,h as p}from"./chunk-HFDLXX7R.js";p();var ae=y(D(),1);import $,{useCallback as ct}from"react";p();var Y=y(D(),1);import L from"react";p();p();var dt=y(D(),1);import q,{useState as Ft}from"react";p();p();p();var fe={actionConfig:"_actionSPIConfig"},he={icon:"_commonImage"},ge={requiredSettings:"google.protobuf.FieldMask",adminConfigurableSettings:"google.protobuf.FieldMask"};var Se={expectedInputs:"_expectedInputs"};var Ae={urlExpirationDate:"google.protobuf.Timestamp"},Pe={compData:"_componentData"},Re={widgetComponentData:"_widgetComponentData",widgetOutOfIframeData:"_widgetOutOfIframeComponentData",studioWidgetComponentData:"_studioWidgetComponentData",shippingLabelCarrier:"_shippingLabelCarrierSpiConfig",fictionalShippingProvider:"_shippingProviderConfig",automationsActionProvider:"_actionProviderSPIConfig",identityAuthenticator:"_authenticatorConfig",multilingualTranslationSchema:"_multilingualTranslationSchema"},lt={},vt={};var Ce={presetsEditorPresence:"_presetEditorPresence"},ye={expectedStartInputs:"_predefinedExpectedInput",expectedVerifyInputs:"_predefinedExpectedInput"};var _t={dateCreated:"google.protobuf.Timestamp",components:"_component"},ut={};var ft={dateCreated:"google.protobuf.Timestamp",components:"_component"};var ht={},gt={apps:"_getAppInfoResponse"};var De={urlExpirationDate:"google.protobuf.Timestamp"};var xe={referenceData:"_schema"},qe={width:"DOUBLE",length:"DOUBLE",height:"google.protobuf.DoubleValue"},be={dimension:"_packageDimension",image:"_image"};var we={configuration:"_predefinedExpectedInputConfiguration"},Ie={textInput:"_adminConfigurableTextInput"},Oe={wixMediaThumbnail:"_commonImage"};var Te={createdDate:"google.protobuf.Timestamp",updatedDate:"google.protobuf.Timestamp"};var Ne={packageTypes:"_packageType"},Je={shippingPrice:"DOUBLE"},Ee={widgetDisplay:"_widgetDisplay",editorPresence:"_editorPresence"};var Fe={widgetDisplay:"_widgetDisplay"},ke={price:"google.protobuf.FloatValue"},Le={widgetData:"_widgetComponentData"};function N(t){var e={"api._api_base_domain_":[{srcPath:"/app-service-webapp",destPath:""}],"dev._base_domain_":[{srcPath:"/_api/app-service",destPath:"/api"},{srcPath:"/_api/app-service-webapp",destPath:""}],"editor._base_domain_":[{srcPath:"/_api/app-service",destPath:"/api"},{srcPath:"/_api/app-service-webapp",destPath:""}],"blocks._base_domain_":[{srcPath:"/_api/app-service",destPath:"/api"},{srcPath:"/_api/app-service-webapp",destPath:""}],"create.editorx":[{srcPath:"/_api/app-service",destPath:"/api"},{srcPath:"/_api/app-service-webapp",destPath:""}],"bo._base_domain_":[{srcPath:"/_api/app-service",destPath:"/api"},{srcPath:"/_api/app-service-webapp",destPath:""},{srcPath:"/app-service-webapp",destPath:"/api"}],"manage._base_domain_":[{srcPath:"/_api/app-service",destPath:"/api"},{srcPath:"/_api/app-service-webapp",destPath:""}],"www._base_domain_":[{srcPath:"/_api/app-service",destPath:"/api"},{srcPath:"/_api/app-service-webapp",destPath:""}]};return b(Object.assign(t,{domainToMappings:e}))}function Ge(t){var e=_(lt,{}),r=e.toJSON,a=e.fromJSON,n=_(vt,{}).fromJSON;function o(i){var d=i.host,s=r(t),c={entityFqdn:"wix.devcenter.apps.v1.app",method:"POST",methodFqn:"com.wixpress.appservice.api.Apps.Create",url:N({protoPath:"/v1/apps",data:s,host:d}),data:s,transformResponse:n};return c}return o.fromReq=a,o.__isAmbassador=!0,o}function Me(t){var e=_(ut,{}),r=e.toJSON,a=e.fromJSON,n=_(ft,{_actionProviderSPIConfig:fe,_actionSPIConfig:he,_adminConfigurableTextInput:ge,_authenticatorConfig:Se,_commonImage:Ae,_component:Pe,_componentData:Re,_editorPresence:Ce,_expectedInputs:ye,_image:De,_multilingualTranslationSchema:xe,_packageDimension:qe,_packageType:be,_predefinedExpectedInput:we,_predefinedExpectedInputConfiguration:Ie,_presetEditorPresence:Oe,_schema:Te,_shippingLabelCarrierSpiConfig:Ne,_shippingProviderConfig:Je,_studioWidgetComponentData:Ee,_widgetComponentData:Fe,_widgetDisplay:ke,_widgetOutOfIframeComponentData:Le}).fromJSON;function o(i){var d=i.host,s=r(t),c={entityFqdn:"wix.devcenter.apps.v1.app",method:"GET",methodFqn:"com.wixpress.appservice.api.Apps.GetAppSnapshot",url:N({protoPath:"/v1/apps/{appId}",data:s,host:d}),params:A(s),transformResponse:n,fallback:[{method:"GET",url:N({protoPath:"/v1/apps/{appId}",data:s,host:d}),params:A(s)}]};return c}return o.fromReq=a,o.__isAmbassador=!0,o}function ze(t){var e=_(ht,{}),r=e.toJSON,a=e.fromJSON,n=_(gt,{_actionProviderSPIConfig:fe,_actionSPIConfig:he,_adminConfigurableTextInput:ge,_authenticatorConfig:Se,_commonImage:Ae,_component:Pe,_componentData:Re,_editorPresence:Ce,_expectedInputs:ye,_getAppInfoResponse:_t,_image:De,_multilingualTranslationSchema:xe,_packageDimension:qe,_packageType:be,_predefinedExpectedInput:we,_predefinedExpectedInputConfiguration:Ie,_presetEditorPresence:Oe,_schema:Te,_shippingLabelCarrierSpiConfig:Ne,_shippingProviderConfig:Je,_studioWidgetComponentData:Ee,_widgetComponentData:Fe,_widgetDisplay:ke,_widgetOutOfIframeComponentData:Le}).fromJSON;function o(i){var d=i.host,s=r(t),c={entityFqdn:"wix.devcenter.apps.v1.app",method:"GET",methodFqn:"com.wixpress.appservice.api.Apps.GetDeveloperApps",url:N({protoPath:"/v1/apps",data:s,host:d}),params:A(s),transformResponse:n,fallback:[{method:"GET",url:N({protoPath:"/v1/apps",data:s,host:d}),params:A(s)}]};return c}return o.fromReq=a,o.__isAmbassador=!0,o}p();var St={},At={};var Pt={},Rt={},Ct={},yt={};function Q(t){var e={"api._api_base_domain_":[{srcPath:"/development-sites-manager",destPath:""}],"manage._base_domain_":[{srcPath:"/development-sites-manager",destPath:""},{srcPath:"/_api/development-sites-manager",destPath:""}],"bo._base_domain_":[{srcPath:"/development-sites-manager",destPath:""}],"www.wixapps.net":[{srcPath:"/development-sites-manager/v1/development-sites",destPath:""}],"dev._base_domain_":[{srcPath:"/development-sites-manager",destPath:""}],"www.wixapis.com":[{srcPath:"/development-sites-manager/v1/development-sites",destPath:""}]};return b(Object.assign(t,{domainToMappings:e}))}function Be(t){var e=_(St,{}),r=e.toJSON,a=e.fromJSON,n=_(At,{}).fromJSON;function o(i){var d=i.host,s=r(t),c={method:"POST",url:Q({protoPath:"/v1/development-sites",data:s,host:d}),data:s,transformResponse:n};return c}return o.fromReq=a,o}function Ue(t){var e=_(Ct,{}),r=e.toJSON,a=e.fromJSON,n=_(yt,{}).fromJSON;function o(i){var d=i.host,s=r(t),c={method:"GET",url:Q({protoPath:"/v1/development-sites",data:s,host:d}),params:A(s),transformResponse:n};return c}return o.fromReq=a,o}function We(t){var e=_(Pt,{}),r=e.toJSON,a=e.fromJSON,n=_(Rt,{}).fromJSON;function o(i){var d=i.host,s=r(t),c={method:"GET",url:Q({protoPath:"/v1/development-sites-limit",data:s,host:d}),params:A(s),transformResponse:n};return c}return o.fromReq=a,o}p();var Dt={},xt={};function qt(t){var e={"bo._base_domain_":[{srcPath:"/_api/app-assessment",destPath:""}],_api_base_domain_:[{srcPath:"/_api/app-assessment-service",destPath:""}],"dev._base_domain_":[{srcPath:"/_api/app-assessment",destPath:""}],"manage._base_domain_":[{srcPath:"/_api/app-assessment",destPath:""}]};return b(Object.assign(t,{domainToMappings:e}))}function je(t){var e=_(Dt,{}),r=e.toJSON,a=e.fromJSON,n=_(xt,{}).fromJSON;function o(i){var d=i.host,s=r(t),c={entityFqdn:"wix.devcenter.app_assessment.v1.validation",method:"GET",methodFqn:"com.wix.devcenter.AppValidationService.GetAppValidationReport",url:qt({protoPath:"/v1/get-app-validation-report/{appId}/{version}",data:s,host:d}),params:A(s),transformResponse:n};return c}return o.fromReq=a,o.__isAmbassador=!0,o}p();var Ve=m.object({appId:m.string()}),He=m.object({latestVersion:m.string()}),Ke=m.object({developmentSite:m.object({id:m.string(),siteName:m.string()})}),Ye=m.object({developmentSites:m.array(m.object({}))}),$e=m.object({limit:m.number()}),bt=m.object({name:m.string(),appId:m.string()}),Qe=m.object({apps:m.array(bt)}),Xe=m.object({appPropertiesValidity:m.array(m.object({failures:m.array(m.string())}))});var wt="a573279f-ae6f-46d1-8556-7c93ae9b2c84",V=class{constructor(e){this.httpClient=e;let{minRetryTimeout:r}=G();this.retryOptions={retries:3,minTimeout:r,maxTimeout:3*1e3}}retryOptions;createApp=async e=>{try{let{data:r}=await R(()=>this.httpClient.request(Ge(e)),this.retryOptions);return Ve.parse(r)}catch(r){throw new f({code:h.FailedToCreateDevCenterApp(),cause:r})}};getAppSnapshot=async e=>{let{data:r}=await R(()=>this.httpClient.request(Me(e)),this.retryOptions);return He.parse(r)};createDevSite=async e=>{try{let{data:r}=await R(()=>this.httpClient.request(Be({templateId:wt})),this.retryOptions),{id:a}=Ke.parse(r).developmentSite;return await R(async()=>{let o=await e.getSite(a);if(!o)throw new f({code:h.SiteNotFound(),info:{id:a}});return o},this.retryOptions)}catch(r){throw new f({code:h.FailedToCreateDevelopmentSite(),cause:r})}};getDevSitesCount=async()=>{try{let{data:e}=await R(()=>this.httpClient.request(Ue({})),this.retryOptions);return Ye.parse(e).developmentSites.length}catch(e){throw new f({code:h.FailedToGetDevelopmentSites(),cause:e})}};getDeveloperApps=async()=>{try{let{data:e}=await R(()=>this.httpClient.request(ze({})),this.retryOptions);return Qe.parse(e).apps}catch(e){throw new f({code:h.FailedToGetDeveloperApps(),cause:e})}};getDevSitesLimit=async()=>{try{let{data:e}=await R(()=>this.httpClient.request(We({})),this.retryOptions);return $e.parse(e).limit}catch(e){throw new f({code:h.FailedToGetDevelopmentSitesLimit(),cause:e})}};getAppValidationFailuresCount=async(e,r)=>{try{let{data:a}=await this.httpClient.request(je({appId:e,version:r||"latest"}));return Xe.parse(a).appPropertiesValidity.filter(i=>i.failures.length>0).length}catch(a){throw new f({code:h.FailedToGetAppValidity(),cause:a})}}};p();import{useMemo as It}from"react";function J(){let t=W({type:"backoffice"});return It(()=>new V(t),[t])}p();var et=y(D(),1);import Ze from"react";var tt=({onSubmit:t,onError:e,sites:r})=>{let{t:a}=g(),{getDevSitesCount:n,getDevSitesLimit:o}=J(),{status:i}=C(()=>Promise.all([n(),o()]),[],{onError:e});return(0,et.match)(i,{Error:()=>null,Loading:()=>Ze.createElement(P,{text:a("general.loading")}),Success:({result:[d,s]})=>{let c=d>=s,u=r.length===0;return Ze.createElement(M,{label:a("site_type_select.label"),options:[{availability:u?O.Disabled({reason:a("site_type_select.no_sites")}):O.Enabled(),title:a("site_type_select.pick_existing_site"),value:"select-existing-site"},{title:a("site_type_select.create_new_dev_site"),value:"create-dev-site",availability:c?O.Disabled({reason:a("site_type_select.create_new_dev_site.disabled",{limit:s})}):O.Enabled()}],onSubmit:({value:S})=>t(S)})}})};p();var ot=y(D(),1);import I from"react";p();import X from"react";p();p();import{useMemo as Ot}from"react";p();p();var at=m.record(m.object({appDefinitionId:m.string().optional(),permissions:m.object({revoked:m.boolean()}).optional()}));var H=class{constructor(e){this.httpClient=e}isAppInstalled=async({metaSiteId:e,appId:r})=>{try{let{data:a}=await this.httpClient.request({url:`/_api/msm/v1/meta-site/editor-client-spec-map/${e}`}),n=at.parse(a);return Object.values(n).some(i=>i.appDefinitionId===r&&!i.permissions?.revoked)}catch(a){throw new f({code:h.FailedToCheckIfAppInstalled(),cause:a})}}};function E(){let t=W({type:"general"});return Ot(()=>new H(t),[t])}var w=y(D(),1);p();import F from"react";var rt=({siteId:t,appId:e})=>(pe(async(r,a)=>{a.return&&await me(`https://manage.wix.com/installer/install?metaSiteId=${t}&appId=${e}&platform=cli&version=latest`)}),F.createElement(F.Fragment,null,F.createElement(x,{i18nKey:"install_app_on_site.warning"}),F.createElement(x,{i18nKey:"install_app_on_site.warning.instructions",components:[F.createElement(ie,{value:"enter"})]})));var Z=(0,w.variant)({Success:{},Canceled:{}});function Tt(t){return t&&typeof t=="object"&&"name"in t&&t.name==="AbortError"}var K=({appId:t,site:e,onSubmit:r,onError:a})=>{let{isAppInstalled:n}=E(),{status:o}=C(async({signal:i})=>{let{appInstallationPollInterval:d}=G();try{return await oe(()=>n({metaSiteId:e.id,appId:t}),{interval:d??2e3,timeout:{milliseconds:60*1e3*2,signal:i}}),Z.Success()}catch(s){if(s instanceof re)throw new f({code:h.SiteSelectorTimedout(),cause:s});if(Tt(s))return Z.Canceled();throw s}},[],{onError:a,onSuccess:i=>{(0,w.isType)(i,Z.Success)&&r()}});return(0,w.match)(o,{Error:()=>null,Loading:()=>X.createElement(rt,{siteId:e.id,appId:t}),Success:()=>X.createElement(T,{type:"success"},X.createElement(x,{i18nKey:"install_app_on_site.finished_successfully"}))})};var pt=({status:t,appId:e,onSubmit:r,onError:a})=>{let{t:n}=g();return(0,ot.match)(t,{NotRequested:()=>null,Error:()=>null,Loading:()=>I.createElement(P,{text:n("create_dev_site.loading")}),Success:({result:o})=>I.createElement(I.Fragment,null,I.createElement(x,{i18nKey:"create_dev_site.success",components:[I.createElement(se,{skin:"success",bold:!0})],values:{name:o.displayName}}),I.createElement(K,{appId:e,site:o,onSubmit:()=>r(o),onError:a}))})};var st={"general.loading":"Loading...","site_type_select.label":"Select Development Site","site_type_select.create_new_dev_site":"Create a new Development Site","site_type_select.create_new_dev_site.disabled":"You have reached the maximum number of {limit} Development Sites","site_type_select.pick_existing_site":"Pick an existing site","site_type_select.no_sites":"No sites found","create_dev_site.loading":"Creating your new Development Site...","create_dev_site.success":"Development Site <0>{name}</0> created successfully! \u{1F680}","site_list_select.label":"Select Site","install_app_on_site.warning":"Your new application needs to be installed on the selected Development Site","install_app_on_site.warning.instructions":"Press <0/> to install the application in your browser","install_app_on_site.finished_successfully":"App installed on Development Site."};p();import k,{useState as Et}from"react";var nt=y(D(),1);p();import Jt from"react";var it=({onSubmit:t,sites:e})=>{let{t:r}=g();return Jt.createElement(M,{label:r("site_list_select.label"),options:e.map(a=>({key:a.id,title:a.displayName,description:a.viewUrl,value:a})),onSubmit:({value:a})=>t(a)})};var mt=({sites:t,appId:e,onSubmit:r,onError:a})=>{let{t:n}=g(),{isAppInstalled:o}=E(),[i,d]=Et(null),s=B((u,S)=>o({metaSiteId:S.id,appId:e}),{onError:a});async function c(u){await s.execute(u)?r(u):d(u)}return k.createElement(k.Fragment,null,k.createElement(it,{onSubmit:c,sites:t}),(0,nt.isType)(s.status,"Loading")&&k.createElement(P,{text:n("general.loading")}),i&&k.createElement(K,{appId:e,site:i,onSubmit:()=>r(i),onError:a}))};var ee=({appId:t,onSubmit:e,onError:r})=>{let{t:a}=g(),[n,o]=Ft(null),{createDevSite:i}=J(),d=j(),{status:s}=C(()=>d.querySites({query:{cursorPaging:{limit:100}}}),[],{onError:r}),c=B(()=>i(d),{onError:r});function u(S){o(S),S==="create-dev-site"&&c.execute()}return q.createElement(ne,{messages:st},(0,dt.match)(s,{Error:()=>null,Loading:()=>q.createElement(P,{text:a("general.loading")}),Success:({result:S})=>q.createElement(q.Fragment,null,q.createElement(tt,{onSubmit:u,onError:r,sites:S}),n==="create-dev-site"&&q.createElement(pt,{status:c.status,appId:t,onSubmit:e,onError:r}),n==="select-existing-site"&&q.createElement(mt,{sites:S,appId:t,onSubmit:e,onError:r}))}))};var te=({state:t,onSubmit:e})=>{let r=z(),{t:a}=g(),{model:n}=U();return L.createElement(L.Fragment,null,(0,Y.match)(t,{NotConfigured:(0,Y.constant)(L.createElement(T,{type:"insight"},a("general.no_site_id_configured"))),NotFound:({id:o})=>L.createElement(T,{type:"error"},a("general.site_id_not_found",{id:o}))}),L.createElement(ee,{appId:n.config.appId,onSubmit:e,onError:r}))};var eo=({children:t})=>{let e=z(),{model:{projectFolder:r}}=U(),a=de(),n=j(),{status:o,merge:i}=C(async()=>ue({projectFolder:r,siteListClient:n,writeDebugLog:a}),[]),d=ct(async c=>{try{await le(r,{siteId:c.id}),i({result:_e.Resolved({site:c})})}catch{throw new f({code:h.FailedToSaveDevelopmentSite({path:ce})})}},[i,r]),s=ct(c=>d(c).catch(e),[e,d]);return(0,ae.match)(o,{Error:()=>null,Loading:()=>$.createElement(P,null),Success:({result:c})=>(0,ae.match)(c,{NotConfigured:u=>$.createElement(te,{state:u,onSubmit:s}),NotFound:u=>$.createElement(te,{state:u,onSubmit:s}),Resolved:({site:u})=>$.createElement(ve.Provider,{value:{site:u,setSite:d}},typeof t=="function"?t(u):t)})})};export{J as a,ee as b,eo as c};
4
+ //# sourceMappingURL=chunk-7XQUV5HO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/site-id/SiteIdProvider.tsx","../src/site-id/ResolveSiteId.tsx","../../cli-site-selector/src/index.ts","../../cli-site-selector/src/SiteSelector.tsx","../../dev-center-client/src/index.ts","../../dev-center-client/src/dev-center-client.ts","../../../node_modules/@wix/ambassador-devcenter-apps-v1-app/http.impl.ts","../../../node_modules/@wix/ambassador-devcenter-dsm-v1-development-site/http.impl.ts","../../../node_modules/@wix/ambassador-devcenter-app-assessment-v1-validation/http.impl.ts","../../dev-center-client/src/schemas.ts","../../dev-center-client/src/useDevCenterClient.ts","../../cli-site-selector/src/SiteTypeSelect.tsx","../../cli-site-selector/src/CreateDevSite.tsx","../../cli-site-selector/src/WaitForAppToBeInstalled.tsx","../../metasite-manager-client/src/index.ts","../../metasite-manager-client/src/useMetasiteManagerClient.ts","../../metasite-manager-client/src/metasite-manager-client.ts","../../metasite-manager-client/src/schemas.ts","../../cli-site-selector/src/OpenBrowser.tsx","../../cli-site-selector/src/messages.json","../../cli-site-selector/src/SelectExistingSite.tsx","../../cli-site-selector/src/SiteListSelect.tsx"],"sourcesContent":["import React, { type FC, type ReactNode, useCallback } from 'react';\nimport { match } from 'variant';\nimport { useDebugLog } from '@wix/cli-debug-log';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { APP_CONFIG_PATH } from '@wix/cli-app-definitions';\nimport { useAsync, useExit, Spinner } from '@wix/cli-ui-kit';\nimport { type Site, useSiteListClient } from '@wix/site-list-client';\nimport { saveAppConfig } from '../files/app.config.js';\nimport { useProjectModel } from '../model.js';\nimport { ResolveSiteId } from './ResolveSiteId.js';\nimport { SiteIdContext } from './context.js';\nimport { SiteIdState } from './site-id-state.js';\nimport { resolveConfiguredSite } from './resolve-configured-site.js';\n\nexport const SiteIdProvider: FC<{\n children: ReactNode | ((site: Site) => ReactNode);\n}> = ({ children }) => {\n const exit = useExit();\n const {\n model: { projectFolder },\n } = useProjectModel();\n const writeDebugLog = useDebugLog();\n const siteListClient = useSiteListClient();\n\n const { status, merge } = useAsync(\n async () =>\n resolveConfiguredSite({\n projectFolder,\n siteListClient,\n writeDebugLog,\n }),\n []\n );\n\n const setSite = useCallback(\n async (site: Site) => {\n try {\n await saveAppConfig(projectFolder, { siteId: site.id });\n merge({ result: SiteIdState.Resolved({ site }) });\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToSaveDevelopmentSite({\n path: APP_CONFIG_PATH,\n }),\n });\n }\n },\n [merge, projectFolder]\n );\n\n const handleResolveSiteId = useCallback(\n (site: Site) => setSite(site).catch(exit),\n [exit, setSite]\n );\n\n return match(status, {\n Error: () => null,\n Loading: () => <Spinner />,\n Success: ({ result: state }) => {\n return match(state, {\n NotConfigured: (variant) => (\n <ResolveSiteId state={variant} onSubmit={handleResolveSiteId} />\n ),\n NotFound: (variant) => (\n <ResolveSiteId state={variant} onSubmit={handleResolveSiteId} />\n ),\n Resolved: ({ site }) => (\n <SiteIdContext.Provider value={{ site, setSite }}>\n {typeof children === 'function' ? children(site) : children}\n </SiteIdContext.Provider>\n ),\n });\n },\n });\n};\n","import React, { type FC } from 'react';\nimport { match, constant } from 'variant';\nimport type { Site } from '@wix/site-list-client';\nimport { Alert, useExit } from '@wix/cli-ui-kit';\nimport { useTranslation } from '@wix/cli-i18n';\nimport { SiteSelector } from '@wix/cli-site-selector';\nimport { useProjectModel } from '../model.js';\nimport type { SiteIdState } from './site-id-state.js';\n\ninterface Props {\n state: SiteIdState<'NotConfigured' | 'NotFound'>;\n onSubmit: (site: Site) => void;\n}\n\nexport const ResolveSiteId: FC<Props> = ({ state, onSubmit }) => {\n const exit = useExit();\n const { t } = useTranslation();\n const { model } = useProjectModel();\n\n return (\n <>\n {match(state, {\n NotConfigured: constant(\n <Alert type=\"insight\">{t('general.no_site_id_configured')}</Alert>\n ),\n NotFound: ({ id }) => (\n <Alert type=\"error\">{t('general.site_id_not_found', { id })}</Alert>\n ),\n })}\n <SiteSelector\n appId={model.config.appId}\n onSubmit={onSubmit}\n onError={exit}\n />\n </>\n );\n};\n","export { SiteSelector } from './SiteSelector.js';\n","import React, { type FC, useState } from 'react';\nimport { match } from 'variant';\nimport { I18nProvider, useTranslation } from '@wix/cli-i18n';\nimport type { Site } from '@wix/site-list-client';\nimport { Spinner, useAsync, useAsyncCallback } from '@wix/cli-ui-kit';\nimport { useDevCenterClient } from '@wix/dev-center-client';\nimport { useSiteListClient } from '@wix/site-list-client';\nimport { SiteTypeSelect, type SiteType } from './SiteTypeSelect.js';\nimport { CreateDevSite } from './CreateDevSite.js';\nimport messages from './messages.json';\nimport { SelectExistingSite } from './SelectExistingSite.js';\n\ninterface Props {\n appId: string;\n onSubmit: (site: Site) => void;\n onError: (error: unknown) => void;\n}\n\nexport const SiteSelector: FC<Props> = ({ appId, onSubmit, onError }) => {\n const { t } = useTranslation();\n const [siteType, setSiteType] = useState<SiteType | null>(null);\n const { createDevSite } = useDevCenterClient();\n const siteListClient = useSiteListClient();\n\n const { status } = useAsync(\n () =>\n siteListClient.querySites({\n query: {\n cursorPaging: {\n limit: 100,\n },\n },\n }),\n [],\n {\n onError,\n }\n );\n\n const createSite = useAsyncCallback(() => createDevSite(siteListClient), {\n onError,\n });\n\n function handleSelectSiteType(siteType: SiteType) {\n setSiteType(siteType);\n if (siteType === 'create-dev-site') {\n createSite.execute();\n }\n }\n\n return (\n <I18nProvider messages={messages}>\n {match(status, {\n Error: () => null,\n Loading: () => <Spinner text={t('general.loading')} />,\n Success: ({ result: sites }) => (\n <>\n <SiteTypeSelect\n onSubmit={handleSelectSiteType}\n onError={onError}\n sites={sites}\n />\n {siteType === 'create-dev-site' && (\n <CreateDevSite\n status={createSite.status}\n appId={appId}\n onSubmit={onSubmit}\n onError={onError}\n />\n )}\n {siteType === 'select-existing-site' && (\n <SelectExistingSite\n sites={sites}\n appId={appId}\n onSubmit={onSubmit}\n onError={onError}\n />\n )}\n </>\n ),\n })}\n </I18nProvider>\n );\n};\n","export { DevCenterClient } from './dev-center-client.js';\nexport type { DeveloperApp } from './schemas.js';\nexport { useDevCenterClient } from './useDevCenterClient.js';\n","import { getTestOverrides } from '@wix/cli-test-overrides';\nimport pRetry, { type Options } from 'p-retry';\nimport { type HttpClient } from '@wix/cli-http-client';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport type {\n GetAppRequest,\n CreateAppRequest,\n} from '@wix/ambassador-devcenter-apps-v1-app/types';\nimport {\n getAppSnapshot,\n create as createApp,\n getDeveloperApps,\n} from '@wix/ambassador-devcenter-apps-v1-app/http';\nimport {\n getDevelopmentSites,\n createDevelopmentSite,\n getDevelopmentSitesLimit,\n} from '@wix/ambassador-devcenter-dsm-v1-development-site/http';\nimport { getAppValidationReport } from '@wix/ambassador-devcenter-app-assessment-v1-validation/http';\nimport type { SiteListClient } from '@wix/site-list-client';\nimport {\n createAppSchema,\n appSnapshotSchema,\n createDevelopmentSiteSchema,\n getDevelopmentSitesLimitSchema,\n getDevelopmentSitesSchema,\n getDeveloperAppsSchema,\n getAppPropertiesValiditySchema,\n} from './schemas.js';\n\nconst EMPTY_SITE_TEMPLATE = 'a573279f-ae6f-46d1-8556-7c93ae9b2c84';\n\nexport class DevCenterClient {\n private readonly retryOptions: Options;\n\n constructor(private readonly httpClient: HttpClient) {\n const { minRetryTimeout } = getTestOverrides();\n\n this.retryOptions = {\n retries: 3,\n minTimeout: minRetryTimeout,\n maxTimeout: 3 * 1000,\n };\n }\n\n createApp = async (opts: CreateAppRequest) => {\n try {\n const { data } = await pRetry(\n () => this.httpClient.request(createApp(opts)),\n this.retryOptions\n );\n\n return createAppSchema.parse(data);\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToCreateDevCenterApp(),\n cause: e,\n });\n }\n };\n\n getAppSnapshot = async (req: GetAppRequest) => {\n const { data } = await pRetry(\n () => this.httpClient.request(getAppSnapshot(req)),\n this.retryOptions\n );\n\n return appSnapshotSchema.parse(data);\n };\n\n createDevSite = async (siteListClient: SiteListClient) => {\n try {\n const { data } = await pRetry(\n () =>\n this.httpClient.request(\n createDevelopmentSite({\n templateId: EMPTY_SITE_TEMPLATE,\n })\n ),\n this.retryOptions\n );\n\n const { id } = createDevelopmentSiteSchema.parse(data).developmentSite;\n\n // 'createDevSite' is missing displayName and viewUrl\n const site = await pRetry(async () => {\n const site = await siteListClient.getSite(id);\n if (!site) {\n throw new CliError({\n code: CliErrorCode.SiteNotFound(),\n info: { id },\n });\n }\n return site;\n }, this.retryOptions);\n\n return site;\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToCreateDevelopmentSite(),\n cause: e,\n });\n }\n };\n\n getDevSitesCount = async () => {\n try {\n const { data } = await pRetry(\n () => this.httpClient.request(getDevelopmentSites({})),\n this.retryOptions\n );\n\n return getDevelopmentSitesSchema.parse(data).developmentSites.length;\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToGetDevelopmentSites(),\n cause: e,\n });\n }\n };\n\n getDeveloperApps = async () => {\n try {\n const { data } = await pRetry(\n () => this.httpClient.request(getDeveloperApps({})),\n this.retryOptions\n );\n\n return getDeveloperAppsSchema.parse(data).apps;\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToGetDeveloperApps(),\n cause: e,\n });\n }\n };\n\n getDevSitesLimit = async () => {\n try {\n const { data } = await pRetry(\n () => this.httpClient.request(getDevelopmentSitesLimit({})),\n this.retryOptions\n );\n\n return getDevelopmentSitesLimitSchema.parse(data).limit;\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToGetDevelopmentSitesLimit(),\n cause: e,\n });\n }\n };\n\n getAppValidationFailuresCount = async (appId: string, version?: string) => {\n try {\n const { data } = await this.httpClient.request(\n getAppValidationReport({ appId, version: version || 'latest' })\n );\n const result = getAppPropertiesValiditySchema.parse(data);\n const numOfFailingProperties = result.appPropertiesValidity.filter(\n (appProperty) => appProperty.failures.length > 0\n ).length;\n\n return numOfFailingProperties;\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToGetAppValidity(),\n cause: e,\n });\n }\n };\n}\n",null,null,null,"import { z } from 'zod';\n\nexport const createAppSchema = z.object({\n appId: z.string(),\n});\n\nexport const appSnapshotSchema = z.object({\n latestVersion: z.string(),\n});\n\nexport const createDevelopmentSiteSchema = z.object({\n developmentSite: z.object({\n id: z.string(),\n siteName: z.string(),\n }),\n});\n\nexport const getDevelopmentSitesSchema = z.object({\n developmentSites: z.array(z.object({})),\n});\n\nexport const getDevelopmentSitesLimitSchema = z.object({\n limit: z.number(),\n});\n\nexport const developerAppSchema = z.object({\n name: z.string(),\n appId: z.string(),\n});\n\nexport const getDeveloperAppsSchema = z.object({\n apps: z.array(developerAppSchema),\n});\n\nexport type DeveloperApp = z.TypeOf<typeof developerAppSchema>;\n\nexport const getAppPropertiesValiditySchema = z.object({\n appPropertiesValidity: z.array(\n z.object({\n failures: z.array(z.string()),\n })\n ),\n});\n","import { useMemo } from 'react';\nimport { useHttpClient } from '@wix/cli-http-client-react';\nimport { DevCenterClient } from './dev-center-client.js';\n\nexport function useDevCenterClient(): DevCenterClient {\n const httpClient = useHttpClient({ type: 'backoffice' });\n return useMemo(() => new DevCenterClient(httpClient), [httpClient]);\n}\n","import React, { type FC } from 'react';\nimport { match } from 'variant';\nimport { useTranslation } from '@wix/cli-i18n';\nimport {\n Spinner,\n SelectInput,\n useAsync,\n SelectOptionAvailability,\n} from '@wix/cli-ui-kit';\nimport { useDevCenterClient } from '@wix/dev-center-client';\nimport type { Site } from '@wix/site-list-client';\n\nexport type SiteType = 'create-dev-site' | 'select-existing-site';\ninterface Props {\n onSubmit: (siteType: SiteType) => void;\n onError: (error: unknown) => void;\n sites: Site[];\n}\n\nexport const SiteTypeSelect: FC<Props> = ({ onSubmit, onError, sites }) => {\n const { t } = useTranslation();\n const { getDevSitesCount, getDevSitesLimit } = useDevCenterClient();\n const { status } = useAsync(\n () => Promise.all([getDevSitesCount(), getDevSitesLimit()]),\n [],\n { onError }\n );\n\n return match(status, {\n Error: () => null,\n Loading: () => <Spinner text={t('general.loading')} />,\n Success: ({ result: [devSitesCount, devSitesLimit] }) => {\n const isDevSitesLimitReached = devSitesCount >= devSitesLimit;\n const userHasNoSites = sites.length === 0;\n\n return (\n <SelectInput<SiteType>\n label={t('site_type_select.label')}\n options={[\n {\n availability: userHasNoSites\n ? SelectOptionAvailability.Disabled({\n reason: t('site_type_select.no_sites'),\n })\n : SelectOptionAvailability.Enabled(),\n title: t('site_type_select.pick_existing_site'),\n value: 'select-existing-site',\n },\n {\n title: t('site_type_select.create_new_dev_site'),\n value: 'create-dev-site',\n availability: isDevSitesLimitReached\n ? SelectOptionAvailability.Disabled({\n reason: t('site_type_select.create_new_dev_site.disabled', {\n limit: devSitesLimit,\n }),\n })\n : SelectOptionAvailability.Enabled(),\n },\n ]}\n onSubmit={({ value }) => onSubmit(value)}\n />\n );\n },\n });\n};\n","import React, { type FC } from 'react';\nimport { match } from 'variant';\nimport { Trans, useTranslation } from '@wix/cli-i18n';\nimport type { AsyncCallbackStatus } from '@wix/cli-ui-kit';\nimport { Text, Spinner } from '@wix/cli-ui-kit';\nimport type { Site } from '@wix/site-list-client';\nimport { WaitForAppToBeInstalled } from './WaitForAppToBeInstalled.js';\n\ninterface Props {\n status: AsyncCallbackStatus<Site>;\n appId: string;\n onSubmit: (site: Site) => void;\n onError: (error: unknown) => void;\n}\n\nexport const CreateDevSite: FC<Props> = ({\n status,\n appId,\n onSubmit,\n onError,\n}) => {\n const { t } = useTranslation();\n\n return match(status, {\n NotRequested: () => null,\n Error: () => null,\n Loading: () => <Spinner text={t('create_dev_site.loading')} />,\n Success: ({ result }) => (\n <>\n <Trans\n i18nKey=\"create_dev_site.success\"\n components={[<Text skin=\"success\" bold />]}\n values={{ name: result.displayName }}\n />\n <WaitForAppToBeInstalled\n appId={appId}\n site={result}\n onSubmit={() => onSubmit(result)}\n onError={onError}\n />\n </>\n ),\n });\n};\n","import pWaitFor, { TimeoutError } from 'p-wait-for';\nimport React, { type FC } from 'react';\nimport { Trans } from '@wix/cli-i18n';\nimport { Alert, useAsync } from '@wix/cli-ui-kit';\nimport { useMetasiteManagerClient } from '@wix/metasite-manager-client';\nimport { isType, match, variant } from 'variant';\nimport { getTestOverrides } from '@wix/cli-test-overrides';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport type { Site } from '@wix/site-list-client';\nimport { OpenBrowser } from './OpenBrowser.js';\n\ninterface Props {\n site: Site;\n appId: string;\n onSubmit: () => void;\n onError: (error: unknown) => void;\n}\n\nexport const AppInstallData = variant({\n Success: {},\n Canceled: {},\n});\n\nfunction isAbortError(error: unknown) {\n return (\n error &&\n typeof error === 'object' &&\n 'name' in error &&\n error.name === 'AbortError'\n );\n}\n\nexport const WaitForAppToBeInstalled: FC<Props> = ({\n appId,\n site,\n onSubmit,\n onError,\n}) => {\n const { isAppInstalled } = useMetasiteManagerClient();\n\n const { status } = useAsync(\n async ({ signal }) => {\n const { appInstallationPollInterval } = getTestOverrides();\n\n try {\n await pWaitFor(() => isAppInstalled({ metaSiteId: site.id, appId }), {\n interval: appInstallationPollInterval ?? 2000,\n timeout: {\n milliseconds: 60 * 1000 * 2,\n signal,\n },\n });\n\n return AppInstallData.Success();\n } catch (error) {\n if (error instanceof TimeoutError) {\n throw new CliError({\n code: CliErrorCode.SiteSelectorTimedout(),\n cause: error,\n });\n }\n\n if (isAbortError(error)) {\n return AppInstallData.Canceled();\n }\n\n throw error;\n }\n },\n [],\n {\n onError,\n onSuccess: (result) => {\n if (isType(result, AppInstallData.Success)) {\n onSubmit();\n }\n },\n }\n );\n\n return match(status, {\n Error: () => null,\n Loading: () => <OpenBrowser siteId={site.id} appId={appId} />,\n Success: () => (\n <Alert type=\"success\">\n <Trans i18nKey=\"install_app_on_site.finished_successfully\" />\n </Alert>\n ),\n });\n};\n","export { useMetasiteManagerClient } from './useMetasiteManagerClient.js';\n","import { useMemo } from 'react';\nimport { useHttpClient } from '@wix/cli-http-client-react';\nimport { MetasiteManagerClient } from './metasite-manager-client.js';\n\nexport function useMetasiteManagerClient(): MetasiteManagerClient {\n const httpClient = useHttpClient({ type: 'general' });\n return useMemo(() => new MetasiteManagerClient(httpClient), [httpClient]);\n}\n","import { CliError, CliErrorCode } from '@wix/cli-error';\nimport type { HttpClient } from '@wix/cli-http-client';\nimport { clientSpecMapSchema } from './schemas.js';\n\nexport class MetasiteManagerClient {\n constructor(private readonly httpClient: HttpClient) {}\n\n public isAppInstalled = async ({\n metaSiteId,\n appId,\n }: {\n metaSiteId: string;\n appId: string;\n }) => {\n try {\n const { data } = await this.httpClient.request({\n url: `/_api/msm/v1/meta-site/editor-client-spec-map/${metaSiteId}`,\n });\n\n const clientSpecMap = clientSpecMapSchema.parse(data);\n\n const isInstalled = Object.values(clientSpecMap).some(\n (spec) => spec.appDefinitionId === appId && !spec.permissions?.revoked\n );\n\n return isInstalled;\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToCheckIfAppInstalled(),\n cause: e,\n });\n }\n };\n}\n","import { z } from 'zod';\n\nexport const clientSpecMapSchema = z.record(\n z.object({\n appDefinitionId: z.string().optional(),\n permissions: z.object({ revoked: z.boolean() }).optional(),\n })\n);\n\nexport type ClientSpecMap = z.TypeOf<typeof clientSpecMapSchema>;\n","import React, { type FC } from 'react';\nimport { Key, useInput } from '@wix/cli-ui-kit';\nimport { Trans } from '@wix/cli-i18n';\nimport { openBrowser } from '@wix/user-browser';\n\ninterface Props {\n siteId: string;\n appId: string;\n}\n\nexport const OpenBrowser: FC<Props> = ({ siteId, appId }) => {\n useInput(async (input, key) => {\n if (key.return) {\n await openBrowser(\n `https://manage.wix.com/installer/install?metaSiteId=${siteId}&appId=${appId}&platform=cli&version=latest`\n );\n }\n });\n\n return (\n <>\n <Trans i18nKey=\"install_app_on_site.warning\" />\n <Trans\n i18nKey=\"install_app_on_site.warning.instructions\"\n components={[<Key value=\"enter\" />]}\n />\n </>\n );\n};\n","{\n \"general.loading\": \"Loading...\",\n \"site_type_select.label\": \"Select Development Site\",\n \"site_type_select.create_new_dev_site\": \"Create a new Development Site\",\n \"site_type_select.create_new_dev_site.disabled\": \"You have reached the maximum number of {limit} Development Sites\",\n \"site_type_select.pick_existing_site\": \"Pick an existing site\",\n \"site_type_select.no_sites\": \"No sites found\",\n \"create_dev_site.loading\": \"Creating your new Development Site...\",\n \"create_dev_site.success\": \"Development Site <0>{name}</0> created successfully! 🚀\",\n \"site_list_select.label\": \"Select Site\",\n \"install_app_on_site.warning\": \"Your new application needs to be installed on the selected Development Site\",\n \"install_app_on_site.warning.instructions\": \"Press <0/> to install the application in your browser\",\n \"install_app_on_site.finished_successfully\": \"App installed on Development Site.\"\n}\n","import React, { useState } from 'react';\nimport { Spinner, useAsyncCallback } from '@wix/cli-ui-kit';\nimport { useMetasiteManagerClient } from '@wix/metasite-manager-client';\nimport type { Site } from '@wix/site-list-client';\nimport { isType } from 'variant';\nimport { useTranslation } from '@wix/cli-i18n';\nimport { WaitForAppToBeInstalled } from './WaitForAppToBeInstalled.js';\nimport { SiteListSelect } from './SiteListSelect.js';\n\ninterface Props {\n sites: Site[];\n appId: string;\n onSubmit: (site: Site) => void;\n onError: (error: unknown) => void;\n}\n\nexport const SelectExistingSite = ({\n sites,\n appId,\n onSubmit,\n onError,\n}: Props) => {\n const { t } = useTranslation();\n const { isAppInstalled } = useMetasiteManagerClient();\n const [siteToInstallAppOn, setSiteToInstallAppOn] = useState<Site | null>(\n null\n );\n const checkAppInstalled = useAsyncCallback(\n (_, site: Site) => isAppInstalled({ metaSiteId: site.id, appId }),\n {\n onError,\n }\n );\n\n async function handleSelectSite(site: Site) {\n const isInstalled = await checkAppInstalled.execute(site);\n if (isInstalled) {\n onSubmit(site);\n } else {\n setSiteToInstallAppOn(site);\n }\n }\n\n return (\n <>\n <SiteListSelect onSubmit={handleSelectSite} sites={sites} />\n {isType(checkAppInstalled.status, 'Loading') && (\n <Spinner text={t('general.loading')} />\n )}\n {siteToInstallAppOn && (\n <WaitForAppToBeInstalled\n appId={appId}\n site={siteToInstallAppOn}\n onSubmit={() => onSubmit(siteToInstallAppOn)}\n onError={onError}\n />\n )}\n </>\n );\n};\n","import React, { type FC } from 'react';\nimport { useTranslation } from '@wix/cli-i18n';\nimport { SelectInput } from '@wix/cli-ui-kit';\nimport { type Site } from '@wix/site-list-client';\n\ninterface Props {\n onSubmit: (site: Site) => void;\n sites: Site[];\n}\n\nexport const SiteListSelect: FC<Props> = ({ onSubmit, sites }) => {\n const { t } = useTranslation();\n\n return (\n <SelectInput<Site>\n label={t('site_list_select.label')}\n options={sites.map((site) => ({\n key: site.id,\n title: site.displayName,\n description: site.viewUrl,\n value: site,\n }))}\n onSub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,EACR,CAAC,CACH,CAAC,CACH,CACF,EACA,CAACV,EAAOP,CAAa,CACvB,EAEMkB,EAAsBP,GACzBC,GAAeF,EAAQE,CAAI,EAAE,MAAMd,CAAI,EACxC,CAACA,EAAMY,CAAO,CAChB,EAEA,SAAO,UAAMJ,EAAQ,CACnB,MAAO,IAAM,KACb,QAAS,IAAMa,EAAA,cAACC,EAAA,IAAQ,EACxB,QAAS,CAAC,CAAE,OAAQC,CAAM,OACjB,UAAMA,EAAO,CAClB,cAAgBC,GACdH,EAAA,cAACI,GAAA,CAAc,MAAOD,EAAS,SAAUJ,EAAqB,EAEhE,SAAWI,GACTH,EAAA,cAACI,GAAA,CAAc,MAAOD,EAAS,SAAUJ,EAAqB,EAEhE,SAAU,CAAC,CAAE,KAAAN,CAAK,IAChBO,EAAA,cAACK,GAAc,SAAd,CAAuB,MAAO,CAAE,KAAAZ,EAAM,QAAAF,CAAQ,GAC5C,OAAOb,GAAa,WAAaA,EAASe,CAAI,EAAIf,CACrD,CAEJ,CAAC,CAEL,CAAC,CACH","names":["init_esm_shims","import_variant","React","useCallback","init_esm_shims","import_variant","React","init_esm_shims","init_esm_shims","import_variant","React","useState","init_esm_shims","init_esm_shims","init_esm_shims","_actionProviderSPIConfig","_actionSPIConfig","_adminConfigurableTextInput","_authenticatorConfig","_commonImage","_component","_componentData","_createAppRequest","_createAppResponse","_editorPresence","_expectedInputs","_getAppInfoResponse","_getAppRequest","_getAppSnapshotResponse","_getDeveloperAppsRequest","_getDeveloperAppsResponse","_image","_multilingualTranslationSchema","_packageDimension","_packageType","_predefinedExpectedInput","_predefinedExpectedInputConfiguration","_presetEditorPresence","_schema","_shippingLabelCarrierSpiConfig","_shippingProviderConfig","_studioWidgetComponentData","_widgetComponentData","_widgetDisplay","_widgetOutOfIframeComponentData","resolveComWixpressAppserviceApiAppsUrl","opts","domainToMappings","resolveUrl","create","payload","_a","serializer","_createAppRequest","toReq","fromReq","fromRes","_createAppResponse","__create","host","serializedData","metadata","resolveComWixpressAppserviceApiAppsUrl","getAppSnapshot","payload","_a","serializer","_getAppRequest","toReq","fromReq","fromRes","_getAppSnapshotResponse","_actionProviderSPIConfig","_actionSPIConfig","_adminConfigurableTextInput","_authenticatorConfig","_commonImage","_component","_componentData","_editorPresence","_expectedInputs","_image","_multilingualTranslationSchema","_packageDimension","_packageType","_predefinedExpectedInput","_predefinedExpectedInputConfiguration","_presetEditorPresence","_schema","_shippingLabelCarrierSpiConfig","_shippingProviderConfig","_studioWidgetComponentData","_widgetComponentData","_widgetDisplay","_widgetOutOfIframeComponentData","__getAppSnapshot","host","serializedData","metadata","resolveComWixpressAppserviceApiAppsUrl","toURLSearchParams","getDeveloperApps","payload","_a","serializer","_getDeveloperAppsRequest","toReq","fromReq","fromRes","_getDeveloperAppsResponse","_actionProviderSPIConfig","_actionSPIConfig","_adminConfigurableTextInput","_authenticatorConfig","_commonImage","_component","_componentData","_editorPresence","_expectedInputs","_getAppInfoResponse","_image","_multilingualTranslationSchema","_packageDimension","_packageType","_predefinedExpectedInput","_predefinedExpectedInputConfiguration","_presetEditorPresence","_schema","_shippingLabelCarrierSpiConfig","_shippingProviderConfig","_studioWidgetComponentData","_widgetComponentData","_widgetDisplay","_widgetOutOfIframeComponentData","__getDeveloperApps","host","serializedData","metadata","resolveComWixpressAppserviceApiAppsUrl","toURLSearchParams","init_esm_shims","_createDevelopmentSiteRequest","_createDevelopmentSiteResponse","_getDevelopmentSitesLimitRequest","_getDevelopmentSitesLimitResponse","_getDevelopmentSitesRequest","_getDevelopmentSitesResponse","resolveComWixpressDevcenterDsmDevelopmentSitesManagerUrl","opts","domainToMappings","resolveUrl","createDevelopmentSite","payload","_a","serializer","_createDevelopmentSiteRequest","toReq","fromReq","fromRes","_createDevelopmentSiteResponse","__createDevelopmentSite","host","serializedData","metadata","resolveComWixpressDevcenterDsmDevelopmentSitesManagerUrl","getDevelopmentSites","_getDevelopmentSitesRequest","_getDevelopmentSitesResponse","__getDevelopmentSites","toURLSearchParams","getDevelopmentSitesLimit","_getDevelopmentSitesLimitRequest","_getDevelopmentSitesLimitResponse","__getDevelopmentSitesLimit","init_esm_shims","_getAppValidationReportRequest","_getAppValidationReportResponse","resolveComWixDevcenterAppValidationServiceUrl","opts","domainToMappings","resolveUrl","getAppValidationReport","payload","_a","serializer","_getAppValidationReportRequest","toReq","fromReq","fromRes","_getAppValidationReportResponse","__getAppValidationReport","host","serializedData","metadata","toURLSearchParams","init_esm_shims","createAppSchema","z","appSnapshotSchema","createDevelopmentSiteSchema","getDevelopmentSitesSchema","getDevelopmentSitesLimitSchema","developerAppSchema","getDeveloperAppsSchema","getAppPropertiesValiditySchema","EMPTY_SITE_TEMPLATE","DevCenterClient","httpClient","minRetryTimeout","getTestOverrides","opts","data","pRetry","create","createAppSchema","e","CliError","CliErrorCode","req","getAppSnapshot","appSnapshotSchema","siteListClient","createDevelopmentSite","id","createDevelopmentSiteSchema","site","getDevelopmentSites","getDevelopmentSitesSchema","getDeveloperApps","getDeveloperAppsSchema","getDevelopmentSitesLimit","getDevelopmentSitesLimitSchema","appId","version","getAppValidationReport","getAppPropertiesValiditySchema","appProperty","init_esm_shims","useMemo","useDevCenterClient","httpClient","useHttpClient","useMemo","DevCenterClient","init_esm_shims","import_variant","React","SiteTypeSelect","onSubmit","onError","sites","t","useTranslation","getDevSitesCount","getDevSitesLimit","useDevCenterClient","status","useAsync","React","Spinner","devSitesCount","devSitesLimit","isDevSitesLimitReached","userHasNoSites","SelectInput","SelectOptionAvailability","value","init_esm_shims","import_variant","React","init_esm_shims","React","init_esm_shims","init_esm_shims","useMemo","init_esm_shims","init_esm_shims","clientSpecMapSchema","z","MetasiteManagerClient","httpClient","metaSiteId","appId","data","clientSpecMap","clientSpecMapSchema","spec","e","CliError","CliErrorCode","useMetasiteManagerClient","httpClient","useHttpClient","useMemo","MetasiteManagerClient","import_variant","init_esm_shims","React","OpenBrowser","siteId","appId","use_input_default","input","key","openBrowser","React","Trans","Key","AppInstallData","isAbortError","error","WaitForAppToBeInstalled","appId","site","onSubmit","onError","isAppInstalled","useMetasiteManagerClient","status","useAsync","signal","appInstallationPollInterval","getTestOverrides","pWaitFor","TimeoutError","CliError","CliErrorCode","result","React","OpenBrowser","Alert","Trans","CreateDevSite","status","appId","onSubmit","onError","t","useTranslation","React","Spinner","result","Trans","Text","WaitForAppToBeInstalled","messages_default","init_esm_shims","React","useState","import_variant","init_esm_shims","React","SiteListSelect","onSubmit","sites","t","useTranslation","React","SelectInput","site","value","SelectExistingSite","sites","appId","onSubmit","onError","t","useTranslation","isAppInstalled","useMetasiteManagerClient","siteToInstallAppOn","setSiteToInstallAppOn","useState","checkAppInstalled","useAsyncCallback","_","site","handleSelectSite","React","SiteListSelect","Spinner","WaitForAppToBeInstalled","SiteSelector","appId","onSubmit","onError","t","useTranslation","siteType","setSiteType","useState","createDevSite","useDevCenterClient","siteListClient","useSiteListClient","status","useAsync","createSite","useAsyncCallback","handleSelectSiteType","React","I18nProvider","messages_default","Spinner","sites","SiteTypeSelect","CreateDevSite","SelectExistingSite","ResolveSiteId","state","onSubmit","exit","useExit","t","useTranslation","model","useProjectModel","React","Alert","id","SiteSelector","SiteIdProvider","children","exit","useExit","projectFolder","useProjectModel","writeDebugLog","useDebugLog","siteListClient","useSiteListClient","status","merge","useAsync","resolveConfiguredSite","setSite","useCallback","site","saveAppConfig","SiteIdState","CliError","CliErrorCode","APP_CONFIG_PATH","handleResolveSiteId","React","Spinner","state","variant","ResolveSiteId","SiteIdContext"]}
@@ -1,4 +1,4 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{a as r}from"./chunk-JI4J5GCL.js";import{G as i,m as p}from"./chunk-52CFCSNQ.js";import{h as n}from"./chunk-HFDLXX7R.js";n();async function A({projectFolder:t,manifest:e}){let a=i(t);return p(a,e)}async function M(t){let e=i(t);return r(e)}export{A as a,M as b};
4
- //# sourceMappingURL=chunk-IJ6QC2OQ.js.map
3
+ import{a as r}from"./chunk-SGABAIB5.js";import{I as i,m as p}from"./chunk-GXCVI5BG.js";import{h as n}from"./chunk-HFDLXX7R.js";n();async function A({projectFolder:t,manifest:e}){let a=i(t);return p(a,e)}async function M(t){let e=i(t);return r(e)}export{A as a,M as b};
4
+ //# sourceMappingURL=chunk-BJOLH7YC.js.map
@@ -1,4 +1,4 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{D as s,G as a,c as o,d as e,o as t}from"./chunk-52CFCSNQ.js";import{h as r}from"./chunk-HFDLXX7R.js";r();async function c(i){let n=s(i),p=a(i);if(!await t(n)||!await t(p))throw new o({code:e.BuiltProjectNeeded()})}export{c as a};
4
- //# sourceMappingURL=chunk-BNCDZAQC.js.map
3
+ import{F as s,I as a,c as o,d as e,o as t}from"./chunk-GXCVI5BG.js";import{h as r}from"./chunk-HFDLXX7R.js";r();async function c(i){let n=s(i),p=a(i);if(!await t(n)||!await t(p))throw new o({code:e.BuiltProjectNeeded()})}export{c as a};
4
+ //# sourceMappingURL=chunk-BQW2QNTV.js.map
@@ -0,0 +1,4 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import{h as i,j as o}from"./chunk-NQPO4DHF.js";import{h as t}from"./chunk-HFDLXX7R.js";t();import{useMemo as m}from"react";function l({type:e}){let{getAccessToken:p}=o();return m(()=>i({type:e,getAppToken:p}),[e,p])}t();export{l as a};
4
+ //# sourceMappingURL=chunk-BXSRILE5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../cli-http-client-react/src/useHttpClient.ts","../../cli-http-client-react/src/index.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { useAuth } from '@wix/cli-auth';\nimport type { CreateHttpClientOptions, HttpClient } from '@wix/cli-http-client';\nimport { createHttpClient } from '@wix/cli-http-client';\n\nexport function useHttpClient({\n type,\n}: Pick<CreateHttpClientOptions, 'type'>): HttpClient {\n const { getAccessToken: getAppToken } = useAuth();\n\n return useMemo(\n () => createHttpClient({ type, getAppToken }),\n [type, getAppToken]\n );\n}\n","export { useHttpClient } from './useHttpClient.js';\n"],"mappings":";;uFAAAA,IAAA,OAAS,WAAAC,MAAe,QAKjB,SAASC,EAAc,CAC5B,KAAAC,CACF,EAAsD,CACpD,GAAM,CAAE,eAAgBC,CAAY,EAAIC,EAAQ,EAEhD,OAAOC,EACL,IAAMC,EAAiB,CAAE,KAAAJ,EAAM,YAAAC,CAAY,CAAC,EAC5C,CAACD,EAAMC,CAAW,CACpB,CACF,CCdAI","names":["init_esm_shims","useMemo","useHttpClient","type","getAppToken","useAuth","useMemo","createHttpClient","init_esm_shims"]}