@wix/cli-app 1.1.5 → 1.1.6

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 (71) hide show
  1. package/build/CreateVersionCommand-G2MTCG42.js +4 -0
  2. package/build/{CreateVersionCommand-YILZNSV2.js.map → CreateVersionCommand-G2MTCG42.js.map} +1 -1
  3. package/build/DevCommand-NTEEUFAO.js +4 -0
  4. package/build/{DevCommand-7WWSASM4.js.map → DevCommand-NTEEUFAO.js.map} +1 -1
  5. package/build/GenerateCommand-2J7LTVTG.js +99 -0
  6. package/build/GenerateCommand-2J7LTVTG.js.map +1 -0
  7. package/build/PreviewCommand-2VOKA43B.js +4 -0
  8. package/build/ServeCommand-ANGVMF5F.js +4 -0
  9. package/build/{ServeCommand-652X4MDY.js.map → ServeCommand-ANGVMF5F.js.map} +1 -1
  10. package/build/build-STNIJWOD.js +4 -0
  11. package/build/{build-E3PBKXVD.js.map → build-STNIJWOD.js.map} +1 -1
  12. package/build/chunk-33JVSWRU.js +4 -0
  13. package/build/{chunk-WQL7FOMI.js.map → chunk-33JVSWRU.js.map} +1 -1
  14. package/build/chunk-4PJZNBLP.js +4 -0
  15. package/build/{chunk-RHFXR5Z6.js.map → chunk-4PJZNBLP.js.map} +1 -1
  16. package/build/chunk-6672YZIR.js +4 -0
  17. package/build/{chunk-4VUK4C6N.js.map → chunk-6672YZIR.js.map} +1 -1
  18. package/build/chunk-APTJGMVX.js +4 -0
  19. package/build/chunk-APTJGMVX.js.map +1 -0
  20. package/build/{chunk-OGNGTOSN.js → chunk-B7UI5BHA.js} +2 -2
  21. package/build/{chunk-O5L7CVLC.js → chunk-C364KT35.js} +2 -2
  22. package/build/{chunk-JPAMNQ3J.js → chunk-CQ24SN6G.js} +2 -2
  23. package/build/{chunk-5GEONXLW.js → chunk-DORVLTGQ.js} +2 -2
  24. package/build/chunk-F6VIPS74.js +4 -0
  25. package/build/chunk-F6VIPS74.js.map +1 -0
  26. package/build/chunk-KHABFHDG.js +27 -0
  27. package/build/chunk-KHABFHDG.js.map +1 -0
  28. package/build/{chunk-BR6YUJN2.js → chunk-LXG62LU6.js} +3 -3
  29. package/build/{chunk-BR6YUJN2.js.map → chunk-LXG62LU6.js.map} +1 -1
  30. package/build/{chunk-GZEP5TCY.js → chunk-R5N7KNVD.js} +2 -2
  31. package/build/{chunk-JV42HHTE.js → chunk-SQ7GXOTK.js} +10 -10
  32. package/build/chunk-SQ7GXOTK.js.map +1 -0
  33. package/build/{chunk-YDKXRG4E.js → chunk-VFXI25UM.js} +2 -2
  34. package/build/{chunk-XWROUJPX.js → chunk-VMBTDYCK.js} +3 -3
  35. package/build/chunk-VMBTDYCK.js.map +1 -0
  36. package/build/chunk-XW5ALZ42.js +87 -0
  37. package/build/chunk-XW5ALZ42.js.map +1 -0
  38. package/build/{chunk-62BB54RE.js → chunk-Y2UEVFKZ.js} +2 -2
  39. package/build/index.js +1 -1
  40. package/build/index.js.map +1 -1
  41. package/build/preview-YEEZWFF7.js +4 -0
  42. package/build/{preview-SP4YHT6Z.js.map → preview-YEEZWFF7.js.map} +1 -1
  43. package/build/render-command-2J5IV7LA.js +4 -0
  44. package/build/{render-command-EGMZRC3N.js.map → render-command-2J5IV7LA.js.map} +1 -1
  45. package/package.json +7 -5
  46. package/templates/dashboard-page/page.json +1 -0
  47. package/templates/dashboard-page/page.tsx.ejs +26 -0
  48. package/build/CreateVersionCommand-YILZNSV2.js +0 -4
  49. package/build/DevCommand-7WWSASM4.js +0 -4
  50. package/build/PreviewCommand-TTE3HAKG.js +0 -4
  51. package/build/ServeCommand-652X4MDY.js +0 -4
  52. package/build/build-E3PBKXVD.js +0 -4
  53. package/build/chunk-4VUK4C6N.js +0 -4
  54. package/build/chunk-67JGH5YG.js +0 -108
  55. package/build/chunk-67JGH5YG.js.map +0 -1
  56. package/build/chunk-IHHKEQZ4.js +0 -4
  57. package/build/chunk-IHHKEQZ4.js.map +0 -1
  58. package/build/chunk-JV42HHTE.js.map +0 -1
  59. package/build/chunk-RHFXR5Z6.js +0 -4
  60. package/build/chunk-WQL7FOMI.js +0 -4
  61. package/build/chunk-XWROUJPX.js.map +0 -1
  62. package/build/preview-SP4YHT6Z.js +0 -4
  63. package/build/render-command-EGMZRC3N.js +0 -4
  64. /package/build/{PreviewCommand-TTE3HAKG.js.map → PreviewCommand-2VOKA43B.js.map} +0 -0
  65. /package/build/{chunk-OGNGTOSN.js.map → chunk-B7UI5BHA.js.map} +0 -0
  66. /package/build/{chunk-O5L7CVLC.js.map → chunk-C364KT35.js.map} +0 -0
  67. /package/build/{chunk-JPAMNQ3J.js.map → chunk-CQ24SN6G.js.map} +0 -0
  68. /package/build/{chunk-5GEONXLW.js.map → chunk-DORVLTGQ.js.map} +0 -0
  69. /package/build/{chunk-GZEP5TCY.js.map → chunk-R5N7KNVD.js.map} +0 -0
  70. /package/build/{chunk-YDKXRG4E.js.map → chunk-VFXI25UM.js.map} +0 -0
  71. /package/build/{chunk-62BB54RE.js.map → chunk-Y2UEVFKZ.js.map} +0 -0
@@ -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-C364KT35.js";import{a}from"./chunk-4PJZNBLP.js";import"./chunk-VFXI25UM.js";import"./chunk-F6VIPS74.js";import"./chunk-DORVLTGQ.js";import"./chunk-R5N7KNVD.js";import"./chunk-Y2UEVFKZ.js";import"./chunk-6672YZIR.js";import"./chunk-KHABFHDG.js";import"./chunk-XW5ALZ42.js";import"./chunk-B7UI5BHA.js";import"./chunk-APTJGMVX.js";import"./chunk-SQ7GXOTK.js";import"./chunk-HFDLXX7R.js";export{a as PreviewCommand,c as validateBase,b as validateSite};
4
+ //# sourceMappingURL=PreviewCommand-2VOKA43B.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 T,b as B}from"./chunk-LXG62LU6.js";import{a as j,b as U}from"./chunk-VFXI25UM.js";import{c as A,d as h,e as M}from"./chunk-F6VIPS74.js";import"./chunk-DORVLTGQ.js";import{b as I}from"./chunk-Y2UEVFKZ.js";import{i as F}from"./chunk-6672YZIR.js";import"./chunk-KHABFHDG.js";import{A as y,d as t,g as S,h as x,i as g,k as P,s as w,t as E,v as C,z as s}from"./chunk-XW5ALZ42.js";import{b as _}from"./chunk-B7UI5BHA.js";import"./chunk-APTJGMVX.js";import{a as q,ha as v}from"./chunk-SQ7GXOTK.js";import{e as W,h as r}from"./chunk-HFDLXX7R.js";r();r();import l from"react";r();var k=W(q(),1);import c,{createContext as Q,useContext as X}from"react";r();import{preview as z}from"vite";import{useCallback as G,useEffect as H,useRef as J}from"react";function b(){let o=J(),{model:n}=v();return H(()=>()=>{o.current?.httpServer.close()},[]),G(async()=>{let i=await z(await B(n,{type:"build"}));return o.current=i,T(i)},[n])}var K=Q(null),d=({children:o})=>{let{model:n}=v(),{t:i}=y(),V=F(),D=b(),{status:L}=C(async()=>{await U(n.projectFolder);let m=await D(),a=await I(n.projectFolder),O=_(a,m);return{armTag:await V.createAppRelease(O,n.config.projectId),serverUrl:m}},[]);return(0,k.match)(L,{Error:()=>null,Loading:()=>c.createElement(E,{text:i("serve_command.starting_serve_environment")}),Success:({result:{armTag:m,serverUrl:a}})=>c.createElement(K.Provider,{value:{serverUrl:a}},c.createElement(h,{armTag:m},o))})};function f(){let o=X(K);if(o===null)throw new Error("useServeEnvironment() cannot be used without an <ServeEnvironmentProvider>");return o}r();import e from"react";function N(){let{site:o}=M(),{serverUrl:n}=f();return e.createElement(t,{flexDirection:"column"},e.createElement(t,{gap:1},e.createElement(S,{skin:"success"},e.createElement(P,null)),e.createElement(s,{i18nKey:"serve_command.starting_serve_environment_success",components:[e.createElement(w,{url:n})]})),e.createElement(t,{gap:1},e.createElement(x,null),e.createElement(s,{i18nKey:"serve_command.production_build"})),e.createElement(t,{gap:1,paddingTop:1,paddingBottom:1},e.createElement(g,null),e.createElement(s,{i18nKey:"general.dev_site.current",values:{name:o.displayName}})),e.createElement(t,{paddingBottom:1,flexDirection:"column"},e.createElement(j,null)))}var Y=()=>l.createElement(A,null,l.createElement(d,null,l.createElement(N,null)));export{Y as ServeCommand,d as ServeEnvironmentProvider,f as useServeEnvironment};
4
+ //# sourceMappingURL=ServeCommand-ANGVMF5F.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/ServeCommand/index.ts","../src/components/ServeCommand/ServeCommand.tsx","../src/components/ServeCommand/ServeEnvironment.tsx","../src/components/ServeCommand/hooks/usePreviewServer.ts","../src/components/ServeCommand/ServeCommandScreen.tsx"],"sourcesContent":["export { ServeCommand } from './ServeCommand.js';\nexport {\n ServeEnvironmentProvider,\n useServeEnvironment,\n} from './ServeEnvironment.js';\n","import React, { type FC } from 'react';\nimport { SiteIdProvider } from '../../site-id/SiteIdProvider.js';\nimport { ServeEnvironmentProvider } from './ServeEnvironment.js';\nimport { ServeCommandScreen } from './ServeCommandScreen.js';\n\nexport const ServeCommand: FC = () => {\n return (\n <SiteIdProvider>\n <ServeEnvironmentProvider>\n <ServeCommandScreen />\n </ServeEnvironmentProvider>\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 { updateAppManifestWithBaseUrl } from '@wix/cli-app-manifest';\nimport { useARMClient } from '@wix/arm-client';\nimport { Spinner, useAsync } from '@wix/cli-ui-kit';\nimport { useTranslation } from '@wix/cli-i18n';\nimport { ArmTagProvider } from '../../context/armTag.js';\nimport { readAppManifestFile } from '../../app-manifest/file.js';\nimport { assertBuildOutputExists } from '../../files/assert-build-output-exists.js';\nimport { usePreviewServer } from './hooks/usePreviewServer.js';\nimport { useProjectModel } from '../../model.js';\n\ntype ServeEnvironment = {\n serverUrl: string;\n};\n\nconst ServeEnvironmentContext = createContext<ServeEnvironment | null>(null);\n\nexport const ServeEnvironmentProvider: FC<{\n children: ReactNode;\n}> = ({ children }) => {\n const { model } = useProjectModel();\n const { t } = useTranslation();\n const arm = useARMClient();\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 armTag = await arm.createAppRelease(\n updatedManifest,\n model.config.projectId\n );\n\n return { armTag, serverUrl };\n }, []);\n\n return match(status, {\n Error: () => null,\n Loading: () => (\n <Spinner text={t('serve_command.starting_serve_environment')}></Spinner>\n ),\n Success: ({ result: { armTag, serverUrl } }) => (\n <ServeEnvironmentContext.Provider value={{ serverUrl }}>\n <ArmTagProvider armTag={armTag}>{children}</ArmTagProvider>\n </ServeEnvironmentContext.Provider>\n ),\n });\n};\n\nexport function useServeEnvironment(): ServeEnvironment {\n const context = useContext(ServeEnvironmentContext);\n if (context === null) {\n throw new Error(\n 'useServeEnvironment() cannot be used without an <ServeEnvironmentProvider>'\n );\n }\n return context;\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","import {\n Box,\n InfoIcon,\n Link,\n PointerIcon,\n SuccessIcon,\n Text,\n} from '@wix/cli-ui-kit';\nimport React from 'react';\nimport { Trans } from '@wix/cli-i18n';\nimport { useSiteId } from '../../site-id/useSiteId.js';\nimport { useServeEnvironment } from './ServeEnvironment.js';\nimport { PlatformViewer } from '../extensions/PlatformViewer.js';\n\nexport function ServeCommandScreen() {\n const { site } = useSiteId();\n const { serverUrl } = useServeEnvironment();\n\n return (\n <Box 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 <Box gap={1}>\n <InfoIcon />\n <Trans i18nKey=\"serve_command.production_build\" />\n </Box>\n <Box gap={1} paddingTop={1} paddingBottom={1}>\n <PointerIcon />\n <Trans\n i18nKey=\"general.dev_site.current\"\n values={{ name: site.displayName }}\n />\n </Box>\n <Box paddingBottom={1} flexDirection=\"column\">\n <PlatformViewer />\n </Box>\n </Box>\n );\n}\n"],"mappings":";;8eAAAA,ICAAC,IAAA,OAAOC,MAAwB,QCA/BC,IAMA,IAAAC,EAAsB,SANtB,OAAOC,GAGL,iBAAAC,EACA,cAAAC,MACK,QCLPC,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,CAACJ,CAAK,CAAC,CACZ,CDLA,IAAMQ,EAA0BC,EAAuC,IAAI,EAE9DC,EAER,CAAC,CAAE,SAAAC,CAAS,IAAM,CACrB,GAAM,CAAE,MAAAC,CAAM,EAAIC,EAAgB,EAC5B,CAAE,EAAAC,CAAE,E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,CAAI,IAAK,GACRD,EAAA,cAACM,EAAA,IAAS,EACVN,EAAA,cAACI,EAAA,CAAM,QAAQ,iCAAiC,CAClD,EACAJ,EAAA,cAACC,EAAA,CAAI,IAAK,EAAG,WAAY,EAAG,cAAe,GACzCD,EAAA,cAACO,EAAA,IAAY,EACbP,EAAA,cAACI,EAAA,CACC,QAAQ,2BACR,OAAQ,CAAE,KAAMR,EAAK,WAAY,EACnC,CACF,EACAI,EAAA,cAACC,EAAA,CAAI,cAAe,EAAG,cAAc,UACnCD,EAAA,cAACQ,EAAA,IAAe,CAClB,CACF,CAEJ,CHxCO,IAAMC,EAAmB,IAE5BC,EAAA,cAACC,EAAA,KACCD,EAAA,cAACE,EAAA,KACCF,EAAA,cAACG,EAAA,IAAmB,CACtB,CACF","names":["init_esm_shims","init_esm_shims","React","init_esm_shims","import_variant","React","createContext","useContext","init_esm_shims","preview","useCallback","useEffect","useRef","usePreviewServer","previewServerRef","useRef","model","useProjectModel","useEffect","useCallback","previewServer","preview","getViteConfig","getViteServerUrl","ServeEnvironmentContext","createContext","ServeEnvironmentProvider","children","model","useProjectModel","t","useTranslation","arm","useARMClient","createPreviewServer","usePreviewServer","status","useAsync","assertBuildOutputExists","serverUrl","manifest","readAppManifestFile","updatedManifest","updateAppManifestWithBaseUrl","React","Spinner","armTag","ArmTagProvider","useServeEnvironment","context","useContext","init_esm_shims","React","ServeCommandScreen","site","useSiteId","serverUrl","useServeEnvironment","React","Box_default","Text","SuccessIcon","Trans","Link","InfoIcon","PointerIcon","PlatformViewer","ServeCommand","React","SiteIdProvider","ServeEnvironmentProvider","ServeCommandScreen"]}
1
+ {"version":3,"sources":["../src/components/ServeCommand/index.ts","../src/components/ServeCommand/ServeCommand.tsx","../src/components/ServeCommand/ServeEnvironment.tsx","../src/components/ServeCommand/hooks/usePreviewServer.ts","../src/components/ServeCommand/ServeCommandScreen.tsx"],"sourcesContent":["export { ServeCommand } from './ServeCommand.js';\nexport {\n ServeEnvironmentProvider,\n useServeEnvironment,\n} from './ServeEnvironment.js';\n","import React, { type FC } from 'react';\nimport { SiteIdProvider } from '../../site-id/SiteIdProvider.js';\nimport { ServeEnvironmentProvider } from './ServeEnvironment.js';\nimport { ServeCommandScreen } from './ServeCommandScreen.js';\n\nexport const ServeCommand: FC = () => {\n return (\n <SiteIdProvider>\n <ServeEnvironmentProvider>\n <ServeCommandScreen />\n </ServeEnvironmentProvider>\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 { updateAppManifestWithBaseUrl } from '@wix/cli-app-manifest';\nimport { useARMClient } from '@wix/arm-client';\nimport { Spinner, useAsync } from '@wix/cli-ui-kit';\nimport { useTranslation } from '@wix/cli-i18n';\nimport { ArmTagProvider } from '../../context/armTag.js';\nimport { readAppManifestFile } from '../../app-manifest/file.js';\nimport { assertBuildOutputExists } from '../../files/assert-build-output-exists.js';\nimport { usePreviewServer } from './hooks/usePreviewServer.js';\nimport { useProjectModel } from '../../model.js';\n\ntype ServeEnvironment = {\n serverUrl: string;\n};\n\nconst ServeEnvironmentContext = createContext<ServeEnvironment | null>(null);\n\nexport const ServeEnvironmentProvider: FC<{\n children: ReactNode;\n}> = ({ children }) => {\n const { model } = useProjectModel();\n const { t } = useTranslation();\n const arm = useARMClient();\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 armTag = await arm.createAppRelease(\n updatedManifest,\n model.config.projectId\n );\n\n return { armTag, serverUrl };\n }, []);\n\n return match(status, {\n Error: () => null,\n Loading: () => (\n <Spinner text={t('serve_command.starting_serve_environment')}></Spinner>\n ),\n Success: ({ result: { armTag, serverUrl } }) => (\n <ServeEnvironmentContext.Provider value={{ serverUrl }}>\n <ArmTagProvider armTag={armTag}>{children}</ArmTagProvider>\n </ServeEnvironmentContext.Provider>\n ),\n });\n};\n\nexport function useServeEnvironment(): ServeEnvironment {\n const context = useContext(ServeEnvironmentContext);\n if (context === null) {\n throw new Error(\n 'useServeEnvironment() cannot be used without an <ServeEnvironmentProvider>'\n );\n }\n return context;\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","import {\n Box,\n InfoIcon,\n Link,\n PointerIcon,\n SuccessIcon,\n Text,\n} from '@wix/cli-ui-kit';\nimport React from 'react';\nimport { Trans } from '@wix/cli-i18n';\nimport { useSiteId } from '../../site-id/useSiteId.js';\nimport { useServeEnvironment } from './ServeEnvironment.js';\nimport { PlatformViewer } from '../extensions/PlatformViewer.js';\n\nexport function ServeCommandScreen() {\n const { site } = useSiteId();\n const { serverUrl } = useServeEnvironment();\n\n return (\n <Box 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 <Box gap={1}>\n <InfoIcon />\n <Trans i18nKey=\"serve_command.production_build\" />\n </Box>\n <Box gap={1} paddingTop={1} paddingBottom={1}>\n <PointerIcon />\n <Trans\n i18nKey=\"general.dev_site.current\"\n values={{ name: site.displayName }}\n />\n </Box>\n <Box paddingBottom={1} flexDirection=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AAA,IAAmB,CACtB,CACF","names":["init_esm_shims","init_esm_shims","React","init_esm_shims","import_variant","React","createContext","useContext","init_esm_shims","preview","useCallback","useEffect","useRef","usePreviewServer","previewServerRef","useRef","model","useProjectModel","useEffect","useCallback","previewServer","preview","getViteConfig","getViteServerUrl","ServeEnvironmentContext","createContext","ServeEnvironmentProvider","children","model","useProjectModel","t","useTranslation","arm","useARMClient","createPreviewServer","usePreviewServer","status","useAsync","assertBuildOutputExists","serverUrl","manifest","readAppManifestFile","updatedManifest","updateAppManifestWithBaseUrl","React","Spinner","armTag","ArmTagProvider","useServeEnvironment","context","useContext","init_esm_shims","React","ServeCommandScreen","site","useSiteId","serverUrl","useServeEnvironment","React","Box_default","Text","SuccessIcon","Trans","Link","InfoIcon","PointerIcon","PlatformViewer","ServeCommand","React","SiteIdProvider","ServeEnvironmentProvider","ServeCommandScreen"]}
@@ -0,0 +1,4 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import{a as m,b as c,c as a}from"./chunk-CQ24SN6G.js";import{b as n}from"./chunk-LXG62LU6.js";import{a as p}from"./chunk-Y2UEVFKZ.js";import"./chunk-B7UI5BHA.js";import"./chunk-APTJGMVX.js";import{c as t,d as e,fa as i}from"./chunk-SQ7GXOTK.js";import{h as r}from"./chunk-HFDLXX7R.js";r();import{cwd as f}from"node:process";import{build as s}from"vite";async function S(){let o=await i(f());if(o.components.length===0)throw new t({code:e.NoExtensionsFound()});m(o.components);let d=await s(await n(o,{type:"build"})).catch(()=>{throw new t({code:e.FailedToBuildApp()})}),l=await c({appId:o.config.appId,components:o.components,sentryDSN:o.config.sentryDSN,componentSourceBuilder:a({model:o,buildOutput:d})});await p({projectFolder:o.projectFolder,manifest:l})}export{S as build};
4
+ //# sourceMappingURL=build-STNIJWOD.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/build.ts"],"sourcesContent":["import { cwd } from 'node:process';\nimport { build as viteBuild } from 'vite';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { loadProjectModel } from './model.js';\nimport { getViteConfig } from './vite/index.js';\nimport { writeAppManifestFile } from './app-manifest/file.js';\nimport { createAppManifest } from './app-manifest/create.js';\nimport { getComponentSourceBuilder } from './app-manifest/component-source.js';\nimport { ConfigType } from './vite/vite-config-options.js';\nimport { validateComponents } from './app-manifest/validate.js';\n\nexport async function build() {\n const projectModel = await loadProjectModel(cwd());\n\n // Validate before building the project, to fail fast in case of a validation issue\n if (projectModel.components.length === 0) {\n throw new CliError({\n code: CliErrorCode.NoExtensionsFound(),\n });\n }\n validateComponents(projectModel.components);\n const buildOutput = await viteBuild(\n await getViteConfig(projectModel, { type: ConfigType.build })\n ).catch(() => {\n throw new CliError({\n code: CliErrorCode.FailedToBuildApp(),\n });\n });\n\n const manifest = await createAppManifest({\n appId: projectModel.config.appId,\n components: projectModel.components,\n sentryDSN: projectModel.config.sentryDSN,\n componentSourceBuilder: getComponentSourceBuilder({\n model: projectModel,\n buildOutput,\n }),\n });\n\n await writeAppManifestFile({\n projectFolder: projectModel.projectFolder,\n manifest,\n });\n}\n"],"mappings":";;iQAAAA,IAAA,OAAS,OAAAC,MAAW,eACpB,OAAS,SAASC,MAAiB,OAUnC,eAAsBC,GAAQ,CAC5B,IAAMC,EAAe,MAAMC,EAAiBC,EAAI,CAAC,EAGjD,GAAIF,EAAa,WAAW,SAAW,EACrC,MAAM,IAAIG,EAAS,CACjB,KAAMC,EAAa,kBAAkB,CACvC,CAAC,EAEHC,EAAmBL,EAAa,UAAU,EAC1C,IAAMM,EAAc,MAAMC,EACxB,MAAMC,EAAcR,EAAc,CAAE,YAAuB,CAAC,CAC9D,EAAE,MAAM,IAAM,CACZ,MAAM,IAAIG,EAAS,CACjB,KAAMC,EAAa,iBAAiB,CACtC,CAAC,CACH,CAAC,EAEKK,EAAW,MAAMC,EAAkB,CACvC,MAAOV,EAAa,OAAO,MAC3B,WAAYA,EAAa,WACzB,UAAWA,EAAa,OAAO,UAC/B,uBAAwBW,EAA0B,CAChD,MAAOX,EACP,YAAAM,CACF,CAAC,CACH,CAAC,EAED,MAAMM,EAAqB,CACzB,cAAeZ,EAAa,cAC5B,SAAAS,CACF,CAAC,CACH","names":["init_esm_shims","cwd","viteBuild","build","projectModel","loadProjectModel","cwd","CliError","CliErrorCode","validateComponents","buildOutput","viteBuild","getViteConfig","manifest","createAppManifest","getComponentSourceBuilder","writeAppManifestFile"]}
1
+ {"version":3,"sources":["../src/build.ts"],"sourcesContent":["import { cwd } from 'node:process';\nimport { build as viteBuild } from 'vite';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { loadProjectModel } from './model.js';\nimport { getViteConfig } from './vite/index.js';\nimport { writeAppManifestFile } from './app-manifest/file.js';\nimport { createAppManifest } from './app-manifest/create.js';\nimport { getComponentSourceBuilder } from './app-manifest/component-source.js';\nimport { ConfigType } from './vite/vite-config-options.js';\nimport { validateComponents } from './app-manifest/validate.js';\n\nexport async function build() {\n const projectModel = await loadProjectModel(cwd());\n\n // Validate before building the project, to fail fast in case of a validation issue\n if (projectModel.components.length === 0) {\n throw new CliError({\n code: CliErrorCode.NoExtensionsFound(),\n });\n }\n validateComponents(projectModel.components);\n const buildOutput = await viteBuild(\n await getViteConfig(projectModel, { type: ConfigType.build })\n ).catch(() => {\n throw new CliError({\n code: CliErrorCode.FailedToBuildApp(),\n });\n });\n\n const manifest = await createAppManifest({\n appId: projectModel.config.appId,\n components: projectModel.components,\n sentryDSN: projectModel.config.sentryDSN,\n componentSourceBuilder: getComponentSourceBuilder({\n model: projectModel,\n buildOutput,\n }),\n });\n\n await writeAppManifestFile({\n projectFolder: projectModel.projectFolder,\n manifest,\n });\n}\n"],"mappings":";;6RAAAA,IAAA,OAAS,OAAAC,MAAW,eACpB,OAAS,SAASC,MAAiB,OAUnC,eAAsBC,GAAQ,CAC5B,IAAMC,EAAe,MAAMC,EAAiBC,EAAI,CAAC,EAGjD,GAAIF,EAAa,WAAW,SAAW,EACrC,MAAM,IAAIG,EAAS,CACjB,KAAMC,EAAa,kBAAkB,CACvC,CAAC,EAEHC,EAAmBL,EAAa,UAAU,EAC1C,IAAMM,EAAc,MAAMC,EACxB,MAAMC,EAAcR,EAAc,CAAE,YAAuB,CAAC,CAC9D,EAAE,MAAM,IAAM,CACZ,MAAM,IAAIG,EAAS,CACjB,KAAMC,EAAa,iBAAiB,CACtC,CAAC,CACH,CAAC,EAEKK,EAAW,MAAMC,EAAkB,CACvC,MAAOV,EAAa,OAAO,MAC3B,WAAYA,EAAa,WACzB,UAAWA,EAAa,OAAO,UAC/B,uBAAwBW,EAA0B,CAChD,MAAOX,EACP,YAAAM,CACF,CAAC,CACH,CAAC,EAED,MAAMM,EAAqB,CACzB,cAAeZ,EAAa,cAC5B,SAAAS,CACF,CAAC,CACH","names":["init_esm_shims","cwd","viteBuild","build","projectModel","loadProjectModel","cwd","CliError","CliErrorCode","validateComponents","buildOutput","viteBuild","getViteConfig","manifest","createAppManifest","getComponentSourceBuilder","writeAppManifestFile"]}
@@ -0,0 +1,4 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import{n,q as p}from"./chunk-KHABFHDG.js";import{c as y}from"./chunk-XW5ALZ42.js";import{e as a,f as g}from"./chunk-SQ7GXOTK.js";import{e as x,h as t}from"./chunk-HFDLXX7R.js";t();import{randomUUID as C}from"node:crypto";function E(r,e){r.updateDefaults(_(e))}function _(r){return r?{_client_id:r,_uuid:r,logged_user_id:r,logged_account_id:r,target_account_id:r}:{_client_id:C()}}t();import{uptime as L}from"node:process";t();var l=x(y(),1);import S from"node:os";import{platform as v,version as U}from"node:process";function c({cliVersion:r,flow:e}){return{...e?{flow:e}:{},cliVersion:r,isCI:l.default,nodeVersion:U,osName:k(),osVersion:S.release()}}function k(){switch(v){case"darwin":return"mac";case"win32":return"windows";default:return"linux"}}var d=()=>Math.round(L()*1e3);function V({biLogger:r,command:e,flow:f,cliVersion:u}){let i={command:e.name(),arguments:e.args.join(",")??"",flags:Object.keys(e.opts()).join(",")};return r.report(p({...c({cliVersion:u,flow:f}),...i,isValid:!0})),{succeed(){r.report(n({...i,duration:d(),isSuccess:!0,isValid:!0}))},failed(o){let w=a(o)?{errorType:g(o)?"SystemError":"UserError",errorName:o.name,errorMessage:o.message}:o instanceof Error?{errorType:"UnknownError",errorName:o.name,errorMessage:o.message}:{errorType:"UnknownError",errorMessage:JSON.stringify(o)};r.report(n({...i,...w,duration:d(),isSuccess:!1,isValid:!0}))}}}t();export{E as a,V as b};
4
+ //# sourceMappingURL=chunk-33JVSWRU.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../cli-telemetry/src/add-user-fields.ts","../../cli-telemetry/src/command-bi-event.ts","../../cli-telemetry/src/environment.ts","../../cli-telemetry/src/index.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport type { BiLogger } from '@wix/wix-bi-logger-client';\n\nexport function addUserFields(logger: BiLogger, userId: string) {\n logger.updateDefaults(resolveUserFields(userId));\n}\n\nexport function resolveUserFields(userId?: string): Record<string, string> {\n if (!userId) {\n // anonymous users need to have an identifier for the bi platform to accept the event\n return {\n _client_id: randomUUID(),\n };\n }\n\n return {\n _client_id: userId,\n _uuid: userId,\n logged_user_id: userId,\n logged_account_id: userId,\n target_account_id: userId,\n };\n}\n","import type { BiLogger } from '@wix/wix-bi-logger-client';\nimport {\n wixCliCliCommand,\n wixCliCliCommandStatus,\n} from '@wix/bi-logger-wix-cli/v2';\nimport { isCliError, isCliSystemError } from '@wix/cli-error';\nimport { uptime } from 'node:process';\nimport { getEnvironmentInfo } from './environment.js';\n\ninterface CommandLike {\n name(): string;\n args: string[];\n opts(): Record<string, unknown>;\n}\n\nconst getDuration = () => Math.round(uptime() * 1000);\n\nexport function reportCommandStartEvent({\n biLogger,\n command,\n flow,\n cliVersion,\n}: {\n biLogger: BiLogger;\n command: CommandLike;\n flow: 'Apps' | 'Sites' | null;\n cliVersion: string;\n}) {\n const commandFields = {\n command: command.name(),\n arguments: command.args.join(',') ?? '',\n flags: Object.keys(command.opts()).join(','),\n };\n\n biLogger.report(\n wixCliCliCommand({\n ...getEnvironmentInfo({ cliVersion, flow }),\n ...commandFields,\n isValid: true,\n })\n );\n\n return {\n succeed() {\n biLogger.report(\n wixCliCliCommandStatus({\n ...commandFields,\n duration: getDuration(),\n isSuccess: true,\n isValid: true,\n })\n );\n },\n failed(error: unknown) {\n const errorFields = isCliError(error)\n ? {\n errorType: isCliSystemError(error) ? 'SystemError' : 'UserError',\n errorName: error.name,\n errorMessage: error.message,\n }\n : error instanceof Error\n ? {\n errorType: 'UnknownError',\n errorName: error.name,\n errorMessage: error.message,\n }\n : {\n errorType: 'UnknownError',\n errorMessage: JSON.stringify(error),\n };\n\n biLogger.report(\n wixCliCliCommandStatus({\n ...commandFields,\n ...errorFields,\n duration: getDuration(),\n isSuccess: false,\n isValid: true,\n })\n );\n },\n };\n}\n","import os from 'node:os';\nimport { platform, version as nodeVersion } from 'node:process';\nimport isCI from 'is-ci';\n\nexport function getEnvironmentInfo({\n cliVersion,\n flow,\n}: {\n cliVersion: string;\n flow: 'Sites' | 'Apps' | null;\n}) {\n return {\n ...(flow ? { flow } : {}),\n cliVersion,\n isCI,\n nodeVersion,\n osName: getOsName(),\n osVersion: os.release(),\n };\n}\n\nexport type EnvironmentInfo = ReturnType<typeof getEnvironmentInfo>;\n\n// https://stackoverflow.com/a/8684009\nfunction getOsName() {\n switch (platform) {\n case 'darwin':\n return 'mac';\n case 'win32':\n return 'windows';\n default:\n return 'linux';\n }\n}\n","export type { BiLogger } from '@wix/wix-bi-logger-client';\nexport { createBiLogger } from './create-bi-logger.js';\nexport { reportCommandStartEvent } from './command-bi-event.js';\nexport { addUserFields } from './add-user-fields.js';\n"],"mappings":";;oJAAAA,IAAA,OAAS,cAAAC,MAAkB,cAGpB,SAASC,EAAcC,EAAkBC,EAAgB,CAC9DD,EAAO,eAAeE,EAAkBD,CAAM,CAAC,CACjD,CAEO,SAASC,EAAkBD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UAAWA,EAAM,KACjB,aAAcA,EAAM,OACtB,EACAA,aAAiB,MACjB,CACE,UAAW,eACX,UAAWA,EAAM,KACjB,aAAcA,EAAM,OACtB,EACA,CACE,UAAW,eACX,aAAc,KAAK,UAAUA,CAAK,CACpC,EAEJR,EAAS,OACPO,EAAuB,CACrB,GAAGH,EACH,GAAGK,EACH,SAAUZ,EAAY,EACtB,UAAW,GACX,QAAS,EACX,CAAC,CACH,CACF,CACF,CACF,CElFAe","names":["init_esm_shims","randomUUID","addUserFields","logger","userId","resolveUserFields","init_esm_shims","uptime","init_esm_shims","import_is_ci","os","platform","nodeVersion","getEnvironmentInfo","cliVersion","flow","isCI","getOsName","getDuration","uptime","reportCommandStartEvent","biLogger","command","flow","cliVersion","commandFields","wixCliCliCommand","getEnvironmentInfo","wixCliCliCommandStatus","error","errorFields","isCliError","isCliSystemError","init_esm_shims"]}
1
+ {"version":3,"sources":["../../cli-telemetry/src/add-user-fields.ts","../../cli-telemetry/src/command-bi-event.ts","../../cli-telemetry/src/environment.ts","../../cli-telemetry/src/index.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport type { BiLogger } from '@wix/wix-bi-logger-client';\n\nexport function addUserFields(logger: BiLogger, userId: string) {\n logger.updateDefaults(resolveUserFields(userId));\n}\n\nexport function resolveUserFields(userId?: string): Record<string, string> {\n if (!userId) {\n // anonymous users need to have an identifier for the bi platform to accept the event\n return {\n _client_id: randomUUID(),\n };\n }\n\n return {\n _client_id: userId,\n _uuid: userId,\n logged_user_id: userId,\n logged_account_id: userId,\n target_account_id: userId,\n };\n}\n","import type { BiLogger } from '@wix/wix-bi-logger-client';\nimport {\n wixCliCliCommand,\n wixCliCliCommandStatus,\n} from '@wix/bi-logger-wix-cli/v2';\nimport { isCliError, isCliSystemError } from '@wix/cli-error';\nimport { uptime } from 'node:process';\nimport { getEnvironmentInfo } from './environment.js';\n\ninterface CommandLike {\n name(): string;\n args: string[];\n opts(): Record<string, unknown>;\n}\n\nconst getDuration = () => Math.round(uptime() * 1000);\n\nexport function reportCommandStartEvent({\n biLogger,\n command,\n flow,\n cliVersion,\n}: {\n biLogger: BiLogger;\n command: CommandLike;\n flow: 'Apps' | 'Sites' | null;\n cliVersion: string;\n}) {\n const commandFields = {\n command: command.name(),\n arguments: command.args.join(',') ?? '',\n flags: Object.keys(command.opts()).join(','),\n };\n\n biLogger.report(\n wixCliCliCommand({\n ...getEnvironmentInfo({ cliVersion, flow }),\n ...commandFields,\n isValid: true,\n })\n );\n\n return {\n succeed() {\n biLogger.report(\n wixCliCliCommandStatus({\n ...commandFields,\n duration: getDuration(),\n isSuccess: true,\n isValid: true,\n })\n );\n },\n failed(error: unknown) {\n const errorFields = isCliError(error)\n ? {\n errorType: isCliSystemError(error) ? 'SystemError' : 'UserError',\n errorName: error.name,\n errorMessage: error.message,\n }\n : error instanceof Error\n ? {\n errorType: 'UnknownError',\n errorName: error.name,\n errorMessage: error.message,\n }\n : {\n errorType: 'UnknownError',\n errorMessage: JSON.stringify(error),\n };\n\n biLogger.report(\n wixCliCliCommandStatus({\n ...commandFields,\n ...errorFields,\n duration: getDuration(),\n isSuccess: false,\n isValid: true,\n })\n );\n },\n };\n}\n","import os from 'node:os';\nimport { platform, version as nodeVersion } from 'node:process';\nimport isCI from 'is-ci';\n\nexport function getEnvironmentInfo({\n cliVersion,\n flow,\n}: {\n cliVersion: string;\n flow: 'Sites' | 'Apps' | null;\n}) {\n return {\n ...(flow ? { flow } : {}),\n cliVersion,\n isCI,\n nodeVersion,\n osName: getOsName(),\n osVersion: os.release(),\n };\n}\n\nexport type EnvironmentInfo = ReturnType<typeof getEnvironmentInfo>;\n\n// https://stackoverflow.com/a/8684009\nfunction getOsName() {\n switch (platform) {\n case 'darwin':\n return 'mac';\n case 'win32':\n return 'windows';\n default:\n return 'linux';\n }\n}\n","export type { BiLogger } from '@wix/wix-bi-logger-client';\nexport { createBiLogger } from './create-bi-logger.js';\nexport { reportCommandStartEvent } from './command-bi-event.js';\nexport { addUser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H,EACH,SAAUP,EAAY,EACtB,UAAW,GACX,QAAS,EACX,CAAC,CACH,CACF,EACA,OAAOW,EAAgB,CACrB,IAAMC,EAAcC,EAAWF,CAAK,EAChC,CACE,UAAWG,EAAiBH,CAAK,EAAI,cAAgB,YACrD,UAAWA,EAAM,KACjB,aAAcA,EAAM,OACtB,EACAA,aAAiB,MACjB,CACE,UAAW,eACX,UAAWA,EAAM,KACjB,aAAcA,EAAM,OACtB,EACA,CACE,UAAW,eACX,aAAc,KAAK,UAAUA,CAAK,CACpC,EAEJR,EAAS,OACPO,EAAuB,CACrB,GAAGH,EACH,GAAGK,EACH,SAAUZ,EAAY,EACtB,UAAW,GACX,QAAS,EACX,CAAC,CACH,CACF,CACF,CACF,CElFAe","names":["init_esm_shims","randomUUID","addUserFields","logger","userId","resolveUserFields","init_esm_shims","uptime","init_esm_shims","import_is_ci","os","platform","nodeVersion","getEnvironmentInfo","cliVersion","flow","isCI","getOsName","getDuration","uptime","reportCommandStartEvent","biLogger","command","flow","cliVersion","commandFields","wixCliCliCommand","getEnvironmentInfo","wixCliCliCommandStatus","error","errorFields","isCliError","isCliSystemError","init_esm_shims"]}
@@ -0,0 +1,4 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import{a as M,b as N}from"./chunk-VFXI25UM.js";import{c as h,d as U,e as j}from"./chunk-F6VIPS74.js";import{a as L}from"./chunk-R5N7KNVD.js";import{b}from"./chunk-Y2UEVFKZ.js";import{b as I,i as k}from"./chunk-6672YZIR.js";import{l as _}from"./chunk-KHABFHDG.js";import{A as F,d as i,i as C,q as y,t as A,v as T,w as u,z as E}from"./chunk-XW5ALZ42.js";import{b as S}from"./chunk-B7UI5BHA.js";import{a as x,ha as B}from"./chunk-SQ7GXOTK.js";import{e as P,h as r}from"./chunk-HFDLXX7R.js";r();import f from"react";r();import n from"react";var D=()=>{let{site:e}=j();return n.createElement(i,{rowGap:1,marginTop:1,marginBottom:1,flexDirection:"column"},n.createElement(i,{gap:1},n.createElement(C,null),n.createElement(E,{i18nKey:"general.dev_site.current",values:{name:e.displayName}})),n.createElement(i,{rowGap:1},n.createElement(M,null)))};r();var q=P(x(),1);import t,{createContext as X,useContext as cr}from"react";r();var O=P(x(),1);import G from"react";var v=({status:e,loadingText:s,successText:m})=>(0,O.match)(e,{NotRequested:()=>null,Loading:()=>G.createElement(A,{text:s}),Error:()=>null,Success:()=>G.createElement(y,{type:"success"},m)});var Y=X(null),H=({children:e,baseUrl:s,onPreviewCreated:m})=>{let{t:c}=F(),{model:a}=B(),K=k(),V=_(),W=I({type:"backoffice"}),g=u(()=>L(a.config.appId,a.projectFolder,V,W)),w=u(async(p,o)=>{let J=await b(a.projectFolder),Q=S(J,o);return await K.createAppRelease(Q,a.config.projectId)}),z=T(async()=>{await N(a.projectFolder);let p=s??await g.execute(),o=await w.execute(p);return m?.(o),{armTag:o,serverUrl:p}},[]);return t.createElement(t.Fragment,null,t.createElement(i,{flexDirection:"column"},t.createElement(v,{status:g.status,loadingText:c("preview_command.uploading_files"),successText:c("preview_command.uploading_files_success")}),t.createElement(v,{status:w.status,loadingText:c("preview_command.creating_preview"),successText:c("preview_command.creating_preview_success")})),(0,q.match)(z.status,{Error:()=>null,Loading:()=>null,Success:({result:{armTag:p,serverUrl:o}})=>t.createElement(Y.Provider,{value:{serverUrl:o}},t.createElement(U,{armTag:p},e))}))};var br=({baseUrl:e,siteIdOverride:s,onPreviewCreated:m})=>f.createElement(h,{siteId:s},f.createElement(H,{baseUrl:e,onPreviewCreated:m},f.createElement(D,null)));export{br as a};
4
+ //# sourceMappingURL=chunk-4PJZNBLP.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/PreviewCommand/PreviewCommand.tsx","../src/components/PreviewCommand/Preview.tsx","../src/components/PreviewCommand/PreviewEnvironment.tsx","../src/components/PreviewCommand/ActionStatus.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport React from 'react';\nimport { SiteIdProvider } from '../../site-id/SiteIdProvider.js';\nimport { Preview } from './Preview.js';\nimport { PreviewEnvironmentProvider } from './PreviewEnvironment.js';\n\nexport const PreviewCommand: FC<{\n baseUrl?: string;\n siteIdOverride?: string;\n onPreviewCreated?: (tag: string) => void;\n}> = ({ baseUrl, siteIdOverride, onPreviewCreated }) => {\n return (\n <SiteIdProvider siteId={siteIdOverride}>\n <PreviewEnvironmentProvider\n baseUrl={baseUrl}\n onPreviewCreated={onPreviewCreated}\n >\n <Preview />\n </PreviewEnvironmentProvider>\n </SiteIdProvider>\n );\n};\n","import { Box, PointerIcon } from '@wix/cli-ui-kit';\nimport type { FC } from 'react';\nimport React from 'react';\nimport { Trans } from '@wix/cli-i18n';\nimport { useSiteId } from '../../site-id/useSiteId.js';\nimport { PlatformViewer } from '../extensions/PlatformViewer.js';\n\nexport const Preview: FC = () => {\n const { site } = useSiteId();\n\n return (\n <Box rowGap={1} marginTop={1} marginBottom={1} flexDirection=\"column\">\n <Box gap={1}>\n <PointerIcon />\n <Trans\n i18nKey=\"general.dev_site.current\"\n values={{ name: site.displayName }}\n />\n </Box>\n <Box rowGap={1}>\n <PlatformViewer />\n </Box>\n </Box>\n );\n};\n","import React, {\n type FC,\n type ReactNode,\n createContext,\n useContext,\n} from 'react';\nimport { match } from 'variant';\nimport { updateAppManifestWithBaseUrl } from '@wix/cli-app-manifest';\nimport { useARMClient } from '@wix/arm-client';\nimport { Box, useAsync, useAsyncCallback } from '@wix/cli-ui-kit';\nimport { useTranslation } from '@wix/cli-i18n';\nimport { useBiLogger } from '@wix/cli-telemetry-react';\nimport { useHttpClient } from '@wix/cli-http-client-react';\nimport { ArmTagProvider } from '../../context/armTag.js';\nimport { readAppManifestFile } from '../../app-manifest/file.js';\nimport { useProjectModel } from '../../model.js';\nimport { uploadApplication } from '../../hosting/upload-application.js';\nimport { ActionStatus } from './ActionStatus.js';\nimport { assertBuildOutputExists } from '../../files/assert-build-output-exists.js';\n\ntype PreviewEnvironment = {\n serverUrl: string;\n};\n\nconst PreviewEnvironmentContext = createContext<PreviewEnvironment | null>(\n null\n);\n\nexport const PreviewEnvironmentProvider: FC<{\n children: ReactNode;\n baseUrl?: string;\n onPreviewCreated?: (tag: string) => void;\n}> = ({ children, baseUrl, onPreviewCreated }) => {\n const { t } = useTranslation();\n const { model } = useProjectModel();\n const arm = useARMClient();\n const biLogger = useBiLogger();\n const httpClient = useHttpClient({ type: 'backoffice' });\n\n const uploadApplicationAction = useAsyncCallback(() =>\n uploadApplication(\n model.config.appId,\n model.projectFolder,\n biLogger,\n httpClient\n )\n );\n\n const createTag = useAsyncCallback(async (_, serverUrl: string) => {\n const manifest = await readAppManifestFile(model.projectFolder);\n const updatedManifest = updateAppManifestWithBaseUrl(manifest, serverUrl);\n const armTag = await arm.createAppRelease(\n updatedManifest,\n model.config.projectId\n );\n return armTag;\n });\n\n const createPreview = useAsync(async () => {\n await assertBuildOutputExists(model.projectFolder);\n const serverUrl = baseUrl ?? (await uploadApplicationAction.execute());\n const armTag = await createTag.execute(serverUrl);\n onPreviewCreated?.(armTag);\n return { armTag, serverUrl };\n }, []);\n\n return (\n <>\n <Box flexDirection=\"column\">\n <ActionStatus\n status={uploadApplicationAction.status}\n loadingText={t('preview_command.uploading_files')}\n successText={t('preview_command.uploading_files_success')}\n />\n <ActionStatus\n status={createTag.status}\n loadingText={t('preview_command.creating_preview')}\n successText={t('preview_command.creating_preview_success')}\n />\n </Box>\n {match(createPreview.status, {\n Error: () => null,\n Loading: () => null,\n Success: ({ result: { armTag, serverUrl } }) => (\n <PreviewEnvironmentContext.Provider value={{ serverUrl }}>\n <ArmTagProvider armTag={armTag}>{children}</ArmTagProvider>\n </PreviewEnvironmentContext.Provider>\n ),\n })}\n </>\n );\n};\n\nexport function usePreviewEnvironment(): PreviewEnvironment {\n const context = useContext(PreviewEnvironmentContext);\n if (context === null) {\n throw new Error(\n 'usePreviewEnvironment() cannot be used without an <PreviewEnvironmentProvider>'\n );\n }\n return context;\n}\n","import type { AsyncCallbackStatus } from '@wix/cli-ui-kit';\nimport { Alert, Spinner } from '@wix/cli-ui-kit';\nimport type { FC } from 'react';\nimport React from 'react';\nimport { match } from 'variant';\n\nexport const ActionStatus: FC<{\n status: AsyncCallbackStatus<unknown>;\n loadingText: string;\n successText: string;\n}> = ({ status, loadingText, successText }) =>\n match(status, {\n NotRequested: () => null,\n Loading: () => <Spinner text={loadingText} />,\n Error: () => null,\n Success: () => <Alert type=\"success\">{successText}</Alert>,\n });\n"],"mappings":";;scAAAA,IACA,OAAOC,MAAW,QCDlBC,IAEA,OAAOC,MAAW,QAKX,IAAMC,EAAc,IAAM,CAC/B,GAAM,CAAE,KAAAC,CAAK,EAAIC,EAAU,EAE3B,OACEC,EAAA,cAACC,EAAA,CAAI,OAAQ,EAAG,UAAW,EAAG,aAAc,EAAG,cAAc,UAC3DD,EAAA,cAACC,EAAA,CAAI,IAAK,GACRD,EAAA,cAACE,EAAA,IAAY,EACbF,EAAA,cAACG,EAAA,CACC,QAAQ,2BACR,OAAQ,CAAE,KAAML,EAAK,WAAY,EACnC,CACF,EACAE,EAAA,cAACC,EAAA,CAAI,OAAQ,GACXD,EAAA,cAACI,EAAA,IAAe,CAClB,CACF,CAEJ,ECxBAC,IAMA,IAAAC,EAAsB,SANtB,OAAOC,GAGL,iBAAAC,EACA,cAAAC,OACK,QCLPC,IAIA,IAAAC,EAAsB,SADtB,OAAOC,MAAW,QAGX,IAAMC,EAIR,CAAC,CAAE,OAAAC,EAAQ,YAAAC,EAAa,YAAAC,CAAY,OACvC,SAAMF,EAAQ,CACZ,aAAc,IAAM,KACpB,QAAS,IAAMF,EAAA,cAACK,EAAA,CAAQ,KAAMF,EAAa,EAC3C,MAAO,IAAM,KACb,QAAS,IAAMH,EAAA,cAACM,EAAA,CAAM,KAAK,WAAWF,CAAY,CACpD,CAAC,EDQH,IAAMG,EAA4BC,EAChC,IACF,EAEaC,EAIR,CAAC,CAAE,SAAAC,EAAU,QAAAC,EAAS,iBAAAC,CAAiB,IAAM,CAChD,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CAAS,CAC5C,CAEJ,CAAC,CACH,CAEJ,EFrFO,IAAM+B,GAIR,CAAC,CAAE,QAAAC,EAAS,eAAAC,EAAgB,iBAAAC,CAAiB,IAE9CC,EAAA,cAACC,EAAA,CAAe,OAAQH,GACtBE,EAAA,cAACE,EAAA,CACC,QAASL,EACT,iBAAkBE,GAElBC,EAAA,cAACG,EAAA,IAAQ,CACX,CACF","names":["init_esm_shims","React","init_esm_shims","React","Preview","site","useSiteId","React","Box_default","PointerIcon","Trans","PlatformViewer","init_esm_shims","import_variant","React","createContext","useContext","init_esm_shims","import_variant","React","ActionStatus","status","loadingText","successText","Spinner","Alert","PreviewEnvironmentContext","createContext","PreviewEnvironmentProvider","children","baseUrl","onPreviewCreated","t","useTranslation","model","useProjectModel","arm","useARMClient","biLogger","useBiLogger","httpClient","useHttpClient","uploadApplicationAction","useAsyncCallback","uploadApplication","createTag","_","serverUrl","manifest","readAppManifestFile","updatedManifest","updateAppManifestWithBaseUrl","createPreview","useAsync","assertBuildOutputExists","armTag","React","Box_default","ActionStatus","ArmTagProvider","PreviewCommand","baseUrl","siteIdOverride","onPreviewCreated","React","SiteIdProvider","PreviewEnvironmentProvider","Preview"]}
1
+ {"version":3,"sources":["../src/components/PreviewCommand/PreviewCommand.tsx","../src/components/PreviewCommand/Preview.tsx","../src/components/PreviewCommand/PreviewEnvironment.tsx","../src/components/PreviewCommand/ActionStatus.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport React from 'react';\nimport { SiteIdProvider } from '../../site-id/SiteIdProvider.js';\nimport { Preview } from './Preview.js';\nimport { PreviewEnvironmentProvider } from './PreviewEnvironment.js';\n\nexport const PreviewCommand: FC<{\n baseUrl?: string;\n siteIdOverride?: string;\n onPreviewCreated?: (tag: string) => void;\n}> = ({ baseUrl, siteIdOverride, onPreviewCreated }) => {\n return (\n <SiteIdProvider siteId={siteIdOverride}>\n <PreviewEnvironmentProvider\n baseUrl={baseUrl}\n onPreviewCreated={onPreviewCreated}\n >\n <Preview />\n </PreviewEnvironmentProvider>\n </SiteIdProvider>\n );\n};\n","import { Box, PointerIcon } from '@wix/cli-ui-kit';\nimport type { FC } from 'react';\nimport React from 'react';\nimport { Trans } from '@wix/cli-i18n';\nimport { useSiteId } from '../../site-id/useSiteId.js';\nimport { PlatformViewer } from '../extensions/PlatformViewer.js';\n\nexport const Preview: FC = () => {\n const { site } = useSiteId();\n\n return (\n <Box rowGap={1} marginTop={1} marginBottom={1} flexDirection=\"column\">\n <Box gap={1}>\n <PointerIcon />\n <Trans\n i18nKey=\"general.dev_site.current\"\n values={{ name: site.displayName }}\n />\n </Box>\n <Box rowGap={1}>\n <PlatformViewer />\n </Box>\n </Box>\n );\n};\n","import React, {\n type FC,\n type ReactNode,\n createContext,\n useContext,\n} from 'react';\nimport { match } from 'variant';\nimport { updateAppManifestWithBaseUrl } from '@wix/cli-app-manifest';\nimport { useARMClient } from '@wix/arm-client';\nimport { Box, useAsync, useAsyncCallback } from '@wix/cli-ui-kit';\nimport { useTranslation } from '@wix/cli-i18n';\nimport { useBiLogger } from '@wix/cli-telemetry-react';\nimport { useHttpClient } from '@wix/cli-http-client-react';\nimport { ArmTagProvider } from '../../context/armTag.js';\nimport { readAppManifestFile } from '../../app-manifest/file.js';\nimport { useProjectModel } from '../../model.js';\nimport { uploadApplication } from '../../hosting/upload-application.js';\nimport { ActionStatus } from './ActionStatus.js';\nimport { assertBuildOutputExists } from '../../files/assert-build-output-exists.js';\n\ntype PreviewEnvironment = {\n serverUrl: string;\n};\n\nconst PreviewEnvironmentContext = createContext<PreviewEnvironment | null>(\n null\n);\n\nexport const PreviewEnvironmentProvider: FC<{\n children: ReactNode;\n baseUrl?: string;\n onPreviewCreated?: (tag: string) => void;\n}> = ({ children, baseUrl, onPreviewCreated }) => {\n const { t } = useTranslation();\n const { model } = useProjectModel();\n const arm = useARMClient();\n const biLogger = useBiLogger();\n const httpClient = useHttpClient({ type: 'backoffice' });\n\n const uploadApplicationAction = useAsyncCallback(() =>\n uploadApplication(\n model.config.appId,\n model.projectFolder,\n biLogger,\n httpClient\n )\n );\n\n const createTag = useAsyncCallback(async (_, serverUrl: string) => {\n const manifest = await readAppManifestFile(model.projectFolder);\n const updatedManifest = updateAppManifestWithBaseUrl(manifest, serverUrl);\n const armTag = await arm.createAppRelease(\n updatedManifest,\n model.config.projectId\n );\n return armTag;\n });\n\n const createPreview = useAsync(async () => {\n await assertBuildOutputExists(model.projectFolder);\n const serverUrl = baseUrl ?? (await uploadApplicationAction.execute());\n const armTag = await createTag.execute(serverUrl);\n onPreviewCreated?.(armTag);\n return { armTag, serverUrl };\n }, []);\n\n return (\n <>\n <Box flexDirection=\"column\">\n <ActionStatus\n status={uploadApplicationAction.status}\n loadingText={t('preview_command.uploading_files')}\n successText={t('preview_command.uploading_files_success')}\n />\n <ActionStatus\n status={createTag.status}\n loadingText={t('preview_command.creating_preview')}\n successText={t('preview_command.creating_preview_success')}\n />\n </Box>\n {match(createPreview.status, {\n Error: () => null,\n Loading: () => null,\n Success: ({ result: { armTag, serverUrl } }) => (\n <PreviewEnvironmentContext.Provider value={{ serverUrl }}>\n <ArmTagProvider armTag={armTag}>{children}</ArmTagProvider>\n </PreviewEnvironmentContext.Provider>\n ),\n })}\n </>\n );\n};\n\nexport function usePreviewEnvironment(): PreviewEnvironment {\n const context = useContext(PreviewEnvironmentContext);\n if (context === null) {\n throw new Error(\n 'usePreviewEnvironment() cannot be used without an <PreviewEnvironmentProvider>'\n );\n }\n return context;\n}\n","import type { AsyncCallbackStatus } from '@wix/cli-ui-kit';\nimport { Alert, Spinner } from '@wix/cli-ui-kit';\nimport type { FC } from 'react';\nimport React from 'react';\nimport { match } from 'variant';\n\nexport const ActionStatus: FC<{\n status: AsyncCallbackStatus<unknown>;\n loadingText: string;\n successText: string;\n}> = ({ status, loadingText, successText }) =>\n match(status, {\n NotRequested: () => null,\n Loading: () => <Spinner text={loadingText} />,\n Error: () => null,\n Success: () => <Alert type=\"success\">{successText}</Alert>,\n });\n"],"mappings":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Box_default","PointerIcon","Trans","PlatformViewer","init_esm_shims","import_variant","React","createContext","useContext","init_esm_shims","import_variant","React","ActionStatus","status","loadingText","successText","Spinner","Alert","PreviewEnvironmentContext","createContext","PreviewEnvironmentProvider","children","baseUrl","onPreviewCreated","t","useTranslation","model","useProjectModel","arm","useARMClient","biLogger","useBiLogger","httpClient","useHttpClient","uploadApplicationAction","useAsyncCallback","uploadApplication","createTag","_","serverUrl","manifest","readAppManifestFile","updatedManifest","updateAppManifestWithBaseUrl","createPreview","useAsync","assertBuildOutputExists","armTag","React","Box_default","ActionStatus","ArmTagProvider","PreviewCommand","baseUrl","siteIdOverride","onPreviewCreated","React","SiteIdProvider","PreviewEnvironmentProvider","Preview"]}
@@ -0,0 +1,4 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import{c as v,d as x,f,h as J,i as T,j as E,r as k}from"./chunk-KHABFHDG.js";import{e as H,g as z,q as j,s as V,z as W}from"./chunk-XW5ALZ42.js";import{I as O,L as $,a as b,c as u,d as g,h as m,i as C,l as M,m as I,n as U}from"./chunk-SQ7GXOTK.js";import{e as q,h as s}from"./chunk-HFDLXX7R.js";s();s();var te={},re={};var ae={},se={},oe={},ie={};function N(r){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 x(Object.assign(r,{domainToMappings:e}))}function Q(r){var e=f(te,{}),t=e.toJSON,a=e.fromJSON,i=f(re,{}).fromJSON;function o(c){var d=c.host,l=t(r),h={entityFqdn:"wix.ctp.gradual_rollout.v1.app_config",method:"POST",methodFqn:"com.wix.ctp.AppsReleaseManagerService.CreateAppRelease",url:N({protoPath:"/apps/create/{appId}",data:l,host:d}),data:l,transformResponse:i};return h}return o.fromReq=a,o.__isAmbassador=!0,o}function G(r){var e=f(oe,{}),t=e.toJSON,a=e.fromJSON,i=f(ie,{}).fromJSON;function o(c){var d=c.host,l=t(r),h={entityFqdn:"wix.ctp.gradual_rollout.v1.app_config",method:"PUT",methodFqn:"com.wix.ctp.AppsReleaseManagerService.UpdateAppRelease",url:N({protoPath:"/apps/tags/{tag}",data:l,host:d}),data:l,transformResponse:i};return h}return o.fromReq=a,o.__isAmbassador=!0,o}function B(r){var e=f(ae,{}),t=e.toJSON,a=e.fromJSON,i=f(se,{}).fromJSON;function o(c){var d=c.host,l=t(r),h={entityFqdn:"wix.ctp.gradual_rollout.v1.app_config",method:"POST",methodFqn:"com.wix.ctp.AppsReleaseManagerService.PromoteAppReleaseToDevCenter",url:N({protoPath:"/apps/promote/{appId}/{tag}",data:l,host:d}),data:l,transformResponse:i};return h}return o.fromReq=a,o.__isAmbassador=!0,o}var P=q(b(),1);s();var K=m.object({newVersion:m.string()}),X=m.object({tag:m.string()});var{AppPermissionDenied:Y}=g,Z=(0,P.variant)({TagUpdated:{},TagNotFound:(0,P.fields)()}),y=class{constructor(e){this.httpClient=e;let{minRetryTimeout:t}=C();this.retryOptions={retries:3,minTimeout:t,maxTimeout:3*1e3}}retryOptions;createAppRelease=async(e,t)=>{try{let{data:a}=await v(()=>this.httpClient.request(Q({appId:e.appId,componentConfigs:e.components,projectId:t})),this.retryOptions);return X.parse(a).tag}catch(a){throw T(a)&&a.response?.status===403?new u({code:Y({appId:e.appId}),cause:a}):new u({code:g.FailedToCreateAppRelease(),cause:a})}};updateAppRelease=async(e,t)=>{try{return await v(()=>this.httpClient.request(G({appId:e.appId,componentConfigs:e.components,tag:t})),this.retryOptions),Z.TagUpdated()}catch(a){if(T(a)){if(a.response?.status===404)return Z.TagNotFound({cause:a});if(a.response?.status===403)throw new u({code:Y({appId:e.appId}),cause:a})}throw new u({code:g.FailedToUpdateAppRelease(),cause:a})}};promoteToDevCenter=async(e,t,a)=>{let{data:i}=await v(()=>this.httpClient.request(B({appId:e,tag:t,versionType:a})),this.retryOptions);return K.parse(i)}};s();import{useMemo as ne}from"react";s();s();import{useMemo as pe}from"react";function _({type:r}){let{getAccessToken:e}=E();return pe(()=>J({type:r,getAppToken:e}),[r,e])}function me(){let r=_({type:"backoffice"});return ne(()=>new y(r),[r])}s();s();s();var ce={},le={sites:"_site"},de={createdDate:"google.protobuf.Timestamp",updatedDate:"google.protobuf.Timestamp",trashedDate:"google.protobuf.Timestamp"};function fe(r){var e={"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(r,{domainToMappings:e}))}function D(r){var e=f(ce,{}),t=e.toJSON,a=e.fromJSON,i=f(le,{_site:de}).fromJSON;function o(c){var d=c.host,l=t(r),h={entityFqdn:"wix.site_list.v2.site",method:"POST",methodFqn:"com.wixpress.sitelist.api.SiteListServiceV2.QuerySites",url:fe({protoPath:"/v2/sites/query",data:l,host:d}),data:l,transformResponse:i};return h}return o.fromReq=a,o}s();var ue=m.object({id:m.string(),displayName:m.string(),viewUrl:m.union([m.string().url(),m.literal("")]).optional()}),F=m.object({sites:m.array(ue)});var R=class{constructor(e){this.httpClient=e;let{minRetryTimeout:t}=C();this.retryOptions={retries:3,minTimeout:t,maxTimeout:3*1e3}}retryOptions;querySites=async(e={})=>{try{let{data:t}=await v(()=>this.httpClient.request(D(e)),this.retryOptions);return F.parse(t).sites}catch(t){throw new u({code:g.FailedToQuerySites(),cause:t,info:{...e}})}};getSite=async e=>{try{let{data:t}=await v(()=>this.httpClient.request(D({query:{filter:{id:{$in:[e]}}}})),this.retryOptions),{sites:a}=F.parse(t);return a.at(0)??null}catch(t){throw new u({code:g.FailedToGetSite(),cause:t,info:{id:e}})}}};s();import{useMemo as he}from"react";function ge(){let r=_({type:"backoffice"});return he(()=>new R(r),[r])}s();s();async function L(r,e){let t=O(r);if(!await U(t))return null;try{let i=await I(t),o=await $.safeParseAsync(i);return o.success?o.data:null}catch(i){return e?.(i),null}}async function Rt(r,e){let a={...await L(r)??{},...e};await M(O(r),a)}s();var S=q(b(),1),A=(0,S.variant)({NotConfigured:{},NotFound:(0,S.fields)(),Resolved:(0,S.fields)()});s();async function qt({projectFolder:r,siteListClient:{getSite:e},siteId:t,writeDebugLog:a}){let i=t||(await L(r,a))?.siteId;if(!i)return A.NotConfigured();let o=await e(i);return o?A.Resolved({site:o}):A.NotFound({id:i})}s();import w from"react";var ee=q(b(),1);function Lt({envConfig:r,platformType:e,siteOverrideId:t}){let{appId:a,site:i,tag:o}=r;return(0,ee.match)(e,{Dashboard:({route:c})=>{let d=new URL(`dashboard/${i.id}/app/${a}${c??"/"}`,"https://manage.wix.com/");return d.searchParams.append("apps-override",o),d.toString()},Editor:()=>new URL(`https://wix.com/editor/${i.id}`).toString(),Site:()=>{let c=new URL(i.viewUrl);return t&&c.searchParams.append("site-override",t),c.searchParams.append("apps-override",o),c.toString()}})}var Jt=async({url:r,title:e},t)=>{try{await k(r)}catch{t({type:"error",prefix:"app",msg:w.createElement(j,{type:"error"},w.createElement(W,{i18nKey:"general.open_page_error",components:[w.createElement(z,{bold:!0})],values:{title:e}}),w.createElement(H,null),w.createElement(V,{url:r}))})}};export{R as a,_ as b,ge as c,L as d,Rt as e,A as f,qt as g,y as h,me as i,Lt as j,Jt as k};
4
+ //# sourceMappingURL=chunk-6672YZIR.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../arm-client/src/client.ts","../../../node_modules/@wix/ambassador-ctp-gradual-rollout-v1-app-config/http.impl.ts","../../arm-client/src/schemas.ts","../../arm-client/src/useARMClient.ts","../../cli-http-client-react/src/index.ts","../../cli-http-client-react/src/useHttpClient.ts","../../arm-client/src/index.ts","../../site-list-client/src/site-list-client.ts","../../../node_modules/@wix/ambassador-site-list-v2-site/http.impl.ts","../../site-list-client/src/schemas.ts","../../site-list-client/src/useSiteListClient.ts","../../site-list-client/src/index.ts","../src/files/app.config.ts","../src/site-id/site-id-state.ts","../src/site-id/resolve-configured-site.ts","../src/components/extensions/utils.tsx"],"sourcesContent":["import type { HttpClient, HttpError } from '@wix/cli-http-client';\nimport type { AppManifest } from '@wix/cli-app-manifest';\nimport type { Options } from 'p-retry';\nimport type { VersionType } from '@wix/ambassador-ctp-gradual-rollout-v1-app-config/types';\nimport {\n createAppRelease,\n promoteAppReleaseToDevCenter,\n updateAppRelease,\n} from '@wix/ambassador-ctp-gradual-rollout-v1-app-config/http';\nimport pRetry from 'p-retry';\nimport { fields, variant } from 'variant';\nimport { isHttpError } from '@wix/cli-http-client';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { getTestOverrides } from '@wix/cli-test-overrides';\nimport { createAppReleaseSchema, promoteAppReleaseSchema } from './schemas.js';\n\nconst { AppPermissionDenied } = CliErrorCode;\n\nexport const UpdateAppReleaseData = variant({\n TagUpdated: {},\n TagNotFound: fields<{ cause: HttpError }>(),\n});\n\nexport class ARMClient {\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 createAppRelease = async (manifest: AppManifest, projectId?: string) => {\n try {\n const { data } = await pRetry(\n () =>\n this.httpClient.request(\n createAppRelease({\n appId: manifest.appId,\n componentConfigs: manifest.components,\n projectId,\n })\n ),\n this.retryOptions\n );\n\n return createAppReleaseSchema.parse(data).tag;\n } catch (e) {\n if (isHttpError(e) && e.response?.status === 403) {\n throw new CliError({\n code: AppPermissionDenied({ appId: manifest.appId }),\n cause: e,\n });\n }\n throw new CliError({\n code: CliErrorCode.FailedToCreateAppRelease(),\n cause: e,\n });\n }\n };\n\n updateAppRelease = async (manifest: AppManifest, tag: string) => {\n try {\n await pRetry(\n () =>\n this.httpClient.request(\n updateAppRelease({\n appId: manifest.appId,\n componentConfigs: manifest.components,\n tag,\n })\n ),\n this.retryOptions\n );\n\n return UpdateAppReleaseData.TagUpdated();\n } catch (e) {\n if (isHttpError(e)) {\n if (e.response?.status === 404) {\n return UpdateAppReleaseData.TagNotFound({ cause: e });\n }\n if (e.response?.status === 403) {\n throw new CliError({\n code: AppPermissionDenied({ appId: manifest.appId }),\n cause: e,\n });\n }\n }\n throw new CliError({\n code: CliErrorCode.FailedToUpdateAppRelease(),\n cause: e,\n });\n }\n };\n\n promoteToDevCenter = async (\n appId: string,\n tag: string,\n versionType: VersionType\n ) => {\n const { data } = await pRetry(\n () =>\n this.httpClient.request(\n promoteAppReleaseToDevCenter({ appId, tag, versionType })\n ),\n this.retryOptions\n );\n\n return promoteAppReleaseSchema.parse(data);\n };\n}\n",null,"import { z } from 'zod';\n\nexport const promoteAppReleaseSchema = z.object({\n newVersion: z.string(),\n});\n\nexport const createAppReleaseSchema = z.object({\n tag: z.string(),\n});\n","import { useMemo } from 'react';\nimport { useHttpClient } from '@wix/cli-http-client-react';\nimport { ARMClient } from './client.js';\n\nexport function useARMClient(): ARMClient {\n const httpClient = useHttpClient({ type: 'backoffice' });\n return useMemo(() => new ARMClient(httpClient), [httpClient]);\n}\n","export { useHttpClient } from './useHttpClient.js';\n","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 { ARMClient } from './client.js';\nexport { useARMClient } from './useARMClient.js';\n","import pRetry from 'p-retry';\nimport type { Options } from 'p-retry';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport type { QuerySitesRequest } from '@wix/ambassador-site-list-v2-site/types';\nimport { querySites } from '@wix/ambassador-site-list-v2-site/http';\nimport type { HttpClient } from '@wix/cli-http-client';\nimport { getTestOverrides } from '@wix/cli-test-overrides';\nimport { querySitesSchema } from './schemas.js';\n\nexport class SiteListClient {\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 querySites = async (opts: QuerySitesRequest = {}) => {\n try {\n const { data } = await pRetry(\n () => this.httpClient.request(querySites(opts)),\n this.retryOptions\n );\n\n return querySitesSchema.parse(data).sites;\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToQuerySites(),\n cause: e,\n info: { ...opts },\n });\n }\n };\n\n getSite = async (id: string) => {\n try {\n const { data } = await pRetry(\n () =>\n this.httpClient.request(\n querySites({ query: { filter: { id: { $in: [id] } } } })\n ),\n this.retryOptions\n );\n\n const { sites } = querySitesSchema.parse(data);\n return sites.at(0) ?? null;\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToGetSite(),\n cause: e,\n info: { id },\n });\n }\n };\n}\n",null,"import { z } from 'zod';\n\nexport const siteSchema = z.object({\n id: z.string(),\n displayName: z.string(),\n viewUrl: z.union([z.string().url(), z.literal('')]).optional(),\n});\n\nexport const querySitesSchema = z.object({\n sites: z.array(siteSchema),\n});\n\nexport type Site = z.TypeOf<typeof siteSchema>;\n","import { useMemo } from 'react';\nimport { useHttpClient } from '@wix/cli-http-client-react';\nimport { SiteListClient } from './site-list-client.js';\n\nexport function useSiteListClient(): SiteListClient {\n const httpClient = useHttpClient({ type: 'backoffice' });\n return useMemo(() => new SiteListClient(httpClient), [httpClient]);\n}\n","export { SiteListClient } from './site-list-client.js';\nexport type { Site } from './schemas.js';\nexport { useSiteListClient } from './useSiteListClient.js';\n","import type { WriteDebugLogFn } from '@wix/cli-debug-log';\nimport { pathExists, readJson, writeJson } from '@wix/cli-fs';\nimport {\n type AppConfig,\n getAppConfigPath,\n appConfigSchema,\n} from '@wix/cli-app-definitions';\n\nexport async function readAppConfig(\n projectFolder: string,\n writeDebugLog?: WriteDebugLogFn\n) {\n const configPath = getAppConfigPath(projectFolder);\n const isConfigExist = await pathExists(configPath);\n\n if (!isConfigExist) {\n return null;\n }\n\n try {\n const json = await readJson(configPath);\n const appConfig = await appConfigSchema.safeParseAsync(json);\n\n if (!appConfig.success) {\n return null;\n }\n\n return appConfig.data;\n } catch (e) {\n writeDebugLog?.(e);\n return null;\n }\n}\n\nexport async function saveAppConfig(projectFolder: string, config: AppConfig) {\n const currentConfig = (await readAppConfig(projectFolder)) ?? {};\n const newConfig = {\n ...currentConfig,\n ...config,\n };\n\n await writeJson(getAppConfigPath(projectFolder), newConfig);\n}\n","import { variant, fields, type VariantOf, type TypeNames } from 'variant';\nimport { type Site } from '@wix/site-list-client';\n\nexport const SiteIdState = variant({\n NotConfigured: {},\n NotFound: fields<{ id: string }>(),\n Resolved: fields<{ site: Site }>(),\n});\n\nexport type SiteIdState<T extends TypeNames<typeof SiteIdState> = undefined> =\n VariantOf<typeof SiteIdState, T>;\n","import type { SiteListClient } from '@wix/site-list-client';\nimport type { WriteDebugLogFn } from '@wix/cli-debug-log';\nimport { readAppConfig } from '../files/app.config.js';\nimport { SiteIdState } from './site-id-state.js';\n\nexport async function resolveConfiguredSite({\n projectFolder,\n siteListClient: { getSite },\n siteId,\n writeDebugLog,\n}: {\n projectFolder: string;\n siteListClient: SiteListClient;\n siteId?: string;\n writeDebugLog?: WriteDebugLogFn;\n}) {\n const resolvedSiteId = !siteId\n ? (await readAppConfig(projectFolder, writeDebugLog))?.siteId\n : siteId;\n\n if (!resolvedSiteId) {\n return SiteIdState.NotConfigured();\n }\n\n const site = await getSite(resolvedSiteId);\n\n if (!site) {\n return SiteIdState.NotFound({ id: resolvedSiteId });\n }\n\n return SiteIdState.Resolved({ site });\n}\n","import React from 'react';\nimport { Trans } from '@wix/cli-i18n';\nimport { match } from 'variant';\nimport { openBrowser } from '@wix/user-browser';\nimport { Alert, Link, Text, Newline } from '@wix/cli-ui-kit';\nimport type { PlatformType } from '@wix/cli-app-definitions';\nimport type { EnvConfig } from './useExtensions.js';\nimport type { WriteLogFn } from '../DevCommand/devEnvLogs/useDevEnvLogs.js';\n\nexport function resolvePlatformUrl({\n envConfig,\n platformType,\n siteOverrideId,\n}: {\n envConfig: EnvConfig;\n platformType: PlatformType;\n siteOverrideId?: string;\n}) {\n const { appId, site, tag } = envConfig;\n return match(platformType, {\n Dashboard: ({ route }) => {\n const dashboardUrl = new URL(\n `dashboard/${site.id}/app/${appId}${route ?? '/'}`,\n 'https://manage.wix.com/'\n );\n dashboardUrl.searchParams.append('apps-override', tag);\n return dashboardUrl.toString();\n },\n Editor: () => new URL(`https://wix.com/editor/${site.id}`).toString(),\n Site: () => {\n const siteUrl = new URL(site.viewUrl!);\n if (siteOverrideId) {\n siteUrl.searchParams.append('site-override', siteOverrideId);\n }\n siteUrl.searchParams.append('apps-override', tag);\n return siteUrl.toString();\n },\n });\n}\n\nexport const openPage = async (\n { url, title }: { url: string; title: string },\n writeLog: WriteLogFn\n) => {\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=\"general.open_page_error\"\n components={[<Text bold />]}\n values={{ title }}\n />\n <Newline />\n <Link url={url} />\n </Alert>\n ),\n });\n }\n};\n"],"mappings":";;sQAAAA,ICWAC,IAIA,IAAMC,GAA2B,CAAA,EAC3BC,GAA4B,CAAA,EAGlC,IAAMC,GAAuC,CAAA,EACvCC,GAAwC,CAAA,EACxCC,GAA2B,CAAA,EAC3BC,GAA4B,CAAA,EAElC,SAASC,EACPC,EAA8C,CAE9C,IAAMC,EAAmB,CACvB,wBAAyB,CACvB,CACE,QAAS,oCACT,SAAU,KAGd,mBAAoB,CAClB,CACE,QAAS,oCACT,SAAU,KAGd,oBAAqB,CACnB,CACE,QACE,2EACF,SAAU,2CAEZ,CACE,QACE,gFACF,SAAU,2CAEZ,CACE,QAAS,gDACT,SAAU,gBAEZ,CACE,QAAS,iDACT,SAAU,iBAEZ,CACE,QAAS,8CACT,SAAU,eAGd,uBAAwB,CACtB,CACE,QAAS,iDACT,SAAU,iBAEZ,CACE,QAAS,gDACT,SAAU,gBAEZ,CACE,QAAS,8CACT,SAAU,gBAKhB,OAAOC,EAAW,OAAO,OAAOF,EAAM,CAAE,iBAAgBC,CAAA,CAAE,CAAC,CAC7D,CAEM,SAAUE,EACdC,EAAgC,CAE1B,IAAAC,EAAuCC,EAC3CC,GACA,CAAA,CAAE,EAFYC,EAAKH,EAAA,OAAYI,EAAOJ,EAAA,SAItBK,EAAYJ,EAAWK,GAA2B,CAAA,CAAE,EAAC,SAEvE,SAASC,EAAmBP,EAAa,KAAXQ,EAAIR,EAAA,KAC1BS,EAAiBN,EAAMJ,CAAO,EAC9BW,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M,IAAM,CACV,IAAMI,EAAU,IAAI,IAAIJ,EAAK,OAAQ,EACrC,OAAIF,GACFM,EAAQ,aAAa,OAAO,gBAAiBN,CAAc,EAE7DM,EAAQ,aAAa,OAAO,gBAAiBH,CAAG,EACzCG,EAAQ,SAAS,CAC1B,CACF,CAAC,CACH,CAEO,IAAMC,GAAW,MACtB,CAAE,IAAAC,EAAK,MAAAC,CAAM,EACbC,IACG,CACH,GAAI,CACF,MAAMC,EAAYH,CAAG,CACvB,MAAgB,CACdE,EAAS,CACP,KAAM,QACN,OAAQ,MACR,IACEE,EAAA,cAACC,EAAA,CAAM,KAAK,SACVD,EAAA,cAACE,EAAA,CACC,QAAQ,0BACR,WAAY,CAACF,EAAA,cAACG,EAAA,CAAK,KAAI,GAAC,CAAE,EAC1B,OAAQ,CAAE,MAAAN,CAAM,EAClB,EACAG,EAAA,cAACI,EAAA,IAAQ,EACTJ,EAAA,cAACK,EAAA,CAAK,IAAKT,EAAK,CAClB,CAEJ,CAAC,CACH,CACF","names":["init_esm_shims","init_esm_shims","_createAppReleaseRequest","_createAppReleaseResponse","_promoteAppReleaseToDevCenterRequest","_promoteAppReleaseToDevCenterResponse","_updateAppReleaseRequest","_updateAppReleaseResponse","resolveComWixCtpAppsReleaseManagerServiceUrl","opts","domainToMappings","resolveUrl","createAppRelease","payload","_a","serializer","_createAppReleaseRequest","toReq","fromReq","fromRes","_createAppReleaseResponse","__createAppRelease","host","serializedData","metadata","updateAppRelease","__updateAppRelease","promoteAppReleaseToDevCenter","payload","_a","serializer","_promoteAppReleaseToDevCenterRequest","toReq","fromReq","fromRes","_promoteAppReleaseToDevCenterResponse","__promoteAppReleaseToDevCenter","host","serializedData","metadata","resolveComWixCtpAppsReleaseManagerServiceUrl","import_variant","init_esm_shims","promoteAppReleaseSchema","z","createAppReleaseSchema","AppPermissionDenied","CliErrorCode","UpdateAppReleaseData","ARMClient","httpClient","minRetryTimeout","getTestOverrides","manifest","projectId","data","pRetry","createAppRelease","createAppReleaseSchema","e","isHttpError","CliError","tag","updateAppRelease","appId","versionType","promoteAppReleaseToDevCenter","promoteAppReleaseSchema","init_esm_shims","useMemo","init_esm_shims","init_esm_shims","useMemo","useHttpClient","type","getAppToken","useAuth","useMemo","createHttpClient","useARMClient","httpClient","useHttpClient","useMemo","ARMClient","init_esm_shims","init_esm_shims","init_esm_shims","_querySitesRequest","_querySitesResponse","_site","resolveComWixpressSitelistApiSiteListServiceV2Url","opts","domainToMappings","resolveUrl","querySites","payload","_a","serializer","toReq","fromReq","fromRes","__querySites","host","serializedData","metadata","init_esm_shims","siteSchema","z","querySitesSchema","SiteListClient","httpClient","minRetryTimeout","getTestOverrides","opts","data","pRetry","querySites","querySitesSchema","e","CliError","CliErrorCode","id","sites","init_esm_shims","useMemo","useSiteListClient","httpClient","useHttpClient","useMemo","SiteListClient","init_esm_shims","init_esm_shims","readAppConfig","projectFolder","writeDebugLog","configPath","getAppConfigPath","pathExists","json","readJson","appConfig","appConfigSchema","e","saveAppConfig","config","newConfig","writeJson","init_esm_shims","import_variant","SiteIdState","init_esm_shims","resolveConfiguredSite","projectFolder","getSite","siteId","writeDebugLog","resolvedSiteId","readAppConfig","SiteIdState","site","init_esm_shims","React","import_variant","resolvePlatformUrl","envConfig","platformType","siteOverrideId","appId","site","tag","route","dashboardUrl","siteUrl","openPage","url","title","writeLog","openBrowser","React","Alert","Trans","Text","Newline","Link"]}
1
+ {"version":3,"sources":["../../arm-client/src/client.ts","../../../node_modules/@wix/ambassador-ctp-gradual-rollout-v1-app-config/http.impl.ts","../../arm-client/src/schemas.ts","../../arm-client/src/useARMClient.ts","../../cli-http-client-react/src/index.ts","../../cli-http-client-react/src/useHttpClient.ts","../../arm-client/src/index.ts","../../site-list-client/src/site-list-client.ts","../../../node_modules/@wix/ambassador-site-list-v2-site/http.impl.ts","../../site-list-client/src/schemas.ts","../../site-list-client/src/useSiteListClient.ts","../../site-list-client/src/index.ts","../src/files/app.config.ts","../src/site-id/site-id-state.ts","../src/site-id/resolve-configured-site.ts","../src/components/extensions/utils.tsx"],"sourcesContent":["import type { HttpClient, HttpError } from '@wix/cli-http-client';\nimport type { AppManifest } from '@wix/cli-app-manifest';\nimport type { Options } from 'p-retry';\nimport type { VersionType } from '@wix/ambassador-ctp-gradual-rollout-v1-app-config/types';\nimport {\n createAppRelease,\n promoteAppReleaseToDevCenter,\n updateAppRelease,\n} from '@wix/ambassador-ctp-gradual-rollout-v1-app-config/http';\nimport pRetry from 'p-retry';\nimport { fields, variant } from 'variant';\nimport { isHttpError } from '@wix/cli-http-client';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { getTestOverrides } from '@wix/cli-test-overrides';\nimport { createAppReleaseSchema, promoteAppReleaseSchema } from './schemas.js';\n\nconst { AppPermissionDenied } = CliErrorCode;\n\nexport const UpdateAppReleaseData = variant({\n TagUpdated: {},\n TagNotFound: fields<{ cause: HttpError }>(),\n});\n\nexport class ARMClient {\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 createAppRelease = async (manifest: AppManifest, projectId?: string) => {\n try {\n const { data } = await pRetry(\n () =>\n this.httpClient.request(\n createAppRelease({\n appId: manifest.appId,\n componentConfigs: manifest.components,\n projectId,\n })\n ),\n this.retryOptions\n );\n\n return createAppReleaseSchema.parse(data).tag;\n } catch (e) {\n if (isHttpError(e) && e.response?.status === 403) {\n throw new CliError({\n code: AppPermissionDenied({ appId: manifest.appId }),\n cause: e,\n });\n }\n throw new CliError({\n code: CliErrorCode.FailedToCreateAppRelease(),\n cause: e,\n });\n }\n };\n\n updateAppRelease = async (manifest: AppManifest, tag: string) => {\n try {\n await pRetry(\n () =>\n this.httpClient.request(\n updateAppRelease({\n appId: manifest.appId,\n componentConfigs: manifest.components,\n tag,\n })\n ),\n this.retryOptions\n );\n\n return UpdateAppReleaseData.TagUpdated();\n } catch (e) {\n if (isHttpError(e)) {\n if (e.response?.status === 404) {\n return UpdateAppReleaseData.TagNotFound({ cause: e });\n }\n if (e.response?.status === 403) {\n throw new CliError({\n code: AppPermissionDenied({ appId: manifest.appId }),\n cause: e,\n });\n }\n }\n throw new CliError({\n code: CliErrorCode.FailedToUpdateAppRelease(),\n cause: e,\n });\n }\n };\n\n promoteToDevCenter = async (\n appId: string,\n tag: string,\n versionType: VersionType\n ) => {\n const { data } = await pRetry(\n () =>\n this.httpClient.request(\n promoteAppReleaseToDevCenter({ appId, tag, versionType })\n ),\n this.retryOptions\n );\n\n return promoteAppReleaseSchema.parse(data);\n };\n}\n",null,"import { z } from 'zod';\n\nexport const promoteAppReleaseSchema = z.object({\n newVersion: z.string(),\n});\n\nexport const createAppReleaseSchema = z.object({\n tag: z.string(),\n});\n","import { useMemo } from 'react';\nimport { useHttpClient } from '@wix/cli-http-client-react';\nimport { ARMClient } from './client.js';\n\nexport function useARMClient(): ARMClient {\n const httpClient = useHttpClient({ type: 'backoffice' });\n return useMemo(() => new ARMClient(httpClient), [httpClient]);\n}\n","export { useHttpClient } from './useHttpClient.js';\n","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 { ARMClient } from './client.js';\nexport { useARMClient } from './useARMClient.js';\n","import pRetry from 'p-retry';\nimport type { Options } from 'p-retry';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport type { QuerySitesRequest } from '@wix/ambassador-site-list-v2-site/types';\nimport { querySites } from '@wix/ambassador-site-list-v2-site/http';\nimport type { HttpClient } from '@wix/cli-http-client';\nimport { getTestOverrides } from '@wix/cli-test-overrides';\nimport { querySitesSchema } from './schemas.js';\n\nexport class SiteListClient {\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 querySites = async (opts: QuerySitesRequest = {}) => {\n try {\n const { data } = await pRetry(\n () => this.httpClient.request(querySites(opts)),\n this.retryOptions\n );\n\n return querySitesSchema.parse(data).sites;\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToQuerySites(),\n cause: e,\n info: { ...opts },\n });\n }\n };\n\n getSite = async (id: string) => {\n try {\n const { data } = await pRetry(\n () =>\n this.httpClient.request(\n querySites({ query: { filter: { id: { $in: [id] } } } })\n ),\n this.retryOptions\n );\n\n const { sites } = querySitesSchema.parse(data);\n return sites.at(0) ?? null;\n } catch (e) {\n throw new CliError({\n code: CliErrorCode.FailedToGetSite(),\n cause: e,\n info: { id },\n });\n }\n };\n}\n",null,"import { z } from 'zod';\n\nexport const siteSchema = z.object({\n id: z.string(),\n displayName: z.string(),\n viewUrl: z.union([z.string().url(), z.literal('')]).optional(),\n});\n\nexport const querySitesSchema = z.object({\n sites: z.array(siteSchema),\n});\n\nexport type Site = z.TypeOf<typeof siteSchema>;\n","import { useMemo } from 'react';\nimport { useHttpClient } from '@wix/cli-http-client-react';\nimport { SiteListClient } from './site-list-client.js';\n\nexport function useSiteListClient(): SiteListClient {\n const httpClient = useHttpClient({ type: 'backoffice' });\n return useMemo(() => new SiteListClient(httpClient), [httpClient]);\n}\n","export { SiteListClient } from './site-list-client.js';\nexport type { Site } from './schemas.js';\nexport { useSiteListClient } from './useSiteListClient.js';\n","import type { WriteDebugLogFn } from '@wix/cli-debug-log';\nimport { pathExists, readJson, writeJson } from '@wix/cli-fs';\nimport {\n type AppConfig,\n getAppConfigPath,\n appConfigSchema,\n} from '@wix/cli-app-definitions';\n\nexport async function readAppConfig(\n projectFolder: string,\n writeDebugLog?: WriteDebugLogFn\n) {\n const configPath = getAppConfigPath(projectFolder);\n const isConfigExist = await pathExists(configPath);\n\n if (!isConfigExist) {\n return null;\n }\n\n try {\n const json = await readJson(configPath);\n const appConfig = await appConfigSchema.safeParseAsync(json);\n\n if (!appConfig.success) {\n return null;\n }\n\n return appConfig.data;\n } catch (e) {\n writeDebugLog?.(e);\n return null;\n }\n}\n\nexport async function saveAppConfig(projectFolder: string, config: AppConfig) {\n const currentConfig = (await readAppConfig(projectFolder)) ?? {};\n const newConfig = {\n ...currentConfig,\n ...config,\n };\n\n await writeJson(getAppConfigPath(projectFolder), newConfig);\n}\n","import { variant, fields, type VariantOf, type TypeNames } from 'variant';\nimport { type Site } from '@wix/site-list-client';\n\nexport const SiteIdState = variant({\n NotConfigured: {},\n NotFound: fields<{ id: string }>(),\n Resolved: fields<{ site: Site }>(),\n});\n\nexport type SiteIdState<T extends TypeNames<typeof SiteIdState> = undefined> =\n VariantOf<typeof SiteIdState, T>;\n","import type { SiteListClient } from '@wix/site-list-client';\nimport type { WriteDebugLogFn } from '@wix/cli-debug-log';\nimport { readAppConfig } from '../files/app.config.js';\nimport { SiteIdState } from './site-id-state.js';\n\nexport async function resolveConfiguredSite({\n projectFolder,\n siteListClient: { getSite },\n siteId,\n writeDebugLog,\n}: {\n projectFolder: string;\n siteListClient: SiteListClient;\n siteId?: string;\n writeDebugLog?: WriteDebugLogFn;\n}) {\n const resolvedSiteId = !siteId\n ? (await readAppConfig(projectFolder, writeDebugLog))?.siteId\n : siteId;\n\n if (!resolvedSiteId) {\n return SiteIdState.NotConfigured();\n }\n\n const site = await getSite(resolvedSiteId);\n\n if (!site) {\n return SiteIdState.NotFound({ id: resolvedSiteId });\n }\n\n return SiteIdState.Resolved({ site });\n}\n","import React from 'react';\nimport { Trans } from '@wix/cli-i18n';\nimport { match } from 'variant';\nimport { openBrowser } from '@wix/user-browser';\nimport { Alert, Link, Text, Newline } from '@wix/cli-ui-kit';\nimport type { PlatformType } from '@wix/cli-app-definitions';\nimport type { EnvConfig } from './useExtensions.js';\nimport type { WriteLogFn } from '../DevCommand/devEnvLogs/useDevEnvLogs.js';\n\nexport function resolvePlatformUrl({\n envConfig,\n platformType,\n siteOverrideId,\n}: {\n envConfig: EnvConfig;\n platformType: PlatformType;\n siteOverrideId?: string;\n}) {\n const { appId, site, tag } = envConfig;\n return match(platformType, {\n Dashboard: ({ route }) => {\n const dashboardUrl = new URL(\n `dashboard/${site.id}/app/${appId}${route ?? '/'}`,\n 'https://manage.wix.com/'\n );\n dashboardUrl.searchParams.append('apps-override', tag);\n return dashboardUrl.toString();\n },\n Editor: () => new URL(`https://wix.com/editor/${site.id}`).toString(),\n Site: () => {\n const siteUrl = new URL(site.viewUrl!);\n if (siteOverrideId) {\n siteUrl.searchParams.append('site-override', siteOverrideId);\n }\n siteUrl.searchParams.append('apps-override', tag);\n return siteUrl.toString();\n },\n });\n}\n\nexport const openPage = async (\n { url, title }: { url: string; title: string },\n writeLog: WriteLogFn\n) => {\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=\"general.open_page_error\"\n components={[<Text bold />]}\n values={{ title }}\n />\n <Newline />\n <Link url={url} />\n </Alert>\n ),\n });\n }\n};\n"],"mappings":";;uSAAAA,ICWAC,IAIA,IAAMC,GAA2B,CAAA,EAC3BC,GAA4B,CAAA,EAGlC,IAAMC,GAAuC,CAAA,EACvCC,GAAwC,CAAA,EACxCC,GAA2B,CAAA,EAC3BC,GAA4B,CAAA,EAElC,SAASC,EACPC,EAA8C,CAE9C,IAAMC,EAAmB,CACvB,wBAAyB,CACvB,CACE,QAAS,oCACT,SAAU,KAGd,mBAAoB,CAClB,CACE,QAAS,oCACT,SAAU,KAGd,oBAAqB,CACnB,CACE,QACE,2EACF,SAAU,2CAEZ,CACE,QACE,gFACF,SAAU,2CAEZ,CACE,QAAS,gDACT,SAAU,gBAEZ,C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/BAI,IAAA,OAAOC,MAAW,QAElB,IAAAC,GAAsB,SAOf,SAASC,GAAmB,CACjC,UAAAC,EACA,aAAAC,EACA,eAAAC,CACF,EAIG,CACD,GAAM,CAAE,MAAAC,EAAO,KAAAC,EAAM,IAAAC,CAAI,EAAIL,EAC7B,SAAO,UAAMC,EAAc,CACzB,UAAW,CAAC,CAAE,MAAAK,CAAM,IAAM,CACxB,IAAMC,EAAe,IAAI,IACvB,aAAaH,EAAK,EAAE,QAAQD,CAAK,GAAGG,GAAS,GAAG,GAChD,yBACF,EACA,OAAAC,EAAa,aAAa,OAAO,gBAAiBF,CAAG,EAC9CE,EAAa,SAAS,CAC/B,EACA,OAAQ,IAAM,IAAI,IAAI,0BAA0BH,EAAK,EAAE,EAAE,EAAE,SAAS,EACpE,KAAM,IAAM,CACV,IAAMI,EAAU,IAAI,IAAIJ,EAAK,OAAQ,EACrC,OAAIF,GACFM,EAAQ,aAAa,OAAO,gBAAiBN,CAAc,EAE7DM,EAAQ,aAAa,OAAO,gBAAiBH,CAAG,EACzCG,EAAQ,SAAS,CAC1B,CACF,CAAC,CACH,CAEO,IAAMC,GAAW,MACtB,CAAE,IAAAC,EAAK,MAAAC,CAAM,EACbC,IACG,CACH,GAAI,CACF,MAAMC,EAAYH,CAAG,CACvB,MAAgB,CACdE,EAAS,CACP,KAAM,QACN,OAAQ,MACR,IACEE,EAAA,cAACC,EAAA,CAAM,KAAK,SACVD,EAAA,cAACE,EAAA,CACC,QAAQ,0BACR,WAAY,CAACF,EAAA,cAACG,EAAA,CAAK,KAAI,GAAC,CAAE,EAC1B,OAAQ,CAAE,MAAAN,CAAM,EAClB,EACAG,EAAA,cAACI,EAAA,IAAQ,EACTJ,EAAA,cAACK,EAAA,CAAK,IAAKT,EAAK,CAClB,CAEJ,CAAC,CACH,CACF","names":["init_esm_shims","init_esm_shims","_createAppReleaseRequest","_createAppReleaseResponse","_promoteAppReleaseToDevCenterRequest","_promoteAppReleaseToDevCenterResponse","_updateAppReleaseRequest","_updateAppReleaseResponse","resolveComWixCtpAppsReleaseManagerServiceUrl","opts","domainToMappings","resolveUrl","createAppRelease","payload","_a","serializer","_createAppReleaseRequest","toReq","fromReq","fromRes","_createAppReleaseResponse","__createAppRelease","host","serializedData","metadata","updateAppRelease","__updateAppRelease","promoteAppReleaseToDevCenter","payload","_a","serializer","_promoteAppReleaseToDevCenterRequest","toReq","fromReq","fromRes","_promoteAppReleaseToDevCenterResponse","__promoteAppReleaseToDevCenter","host","serializedData","metadata","resolveComWixCtpAppsReleaseManagerServiceUrl","import_variant","init_esm_shims","promoteAppReleaseSchema","z","createAppReleaseSchema","AppPermissionDenied","CliErrorCode","UpdateAppReleaseData","ARMClient","httpClient","minRetryTimeout","getTestOverrides","manifest","projectId","data","pRetry","createAppRelease","createAppReleaseSchema","e","isHttpError","CliError","tag","updateAppRelease","appId","versionType","promoteAppReleaseToDevCenter","promoteAppReleaseSchema","init_esm_shims","useMemo","init_esm_shims","init_esm_shims","useMemo","useHttpClient","type","getAppToken","useAuth","useMemo","createHttpClient","useARMClient","httpClient","useHttpClient","useMemo","ARMClient","init_esm_shims","init_esm_shims","init_esm_shims","_querySitesRequest","_querySitesResponse","_site","resolveComWixpressSitelistApiSiteListServiceV2Url","opts","domainToMappings","resolveUrl","querySites","payload","_a","serializer","toReq","fromReq","fromRes","__querySites","host","serializedData","metadata","init_esm_shims","siteSchema","z","querySitesSchema","SiteListClient","httpClient","minRetryTimeout","getTestOverrides","opts","data","pRetry","querySites","querySitesSchema","e","CliError","CliErrorCode","id","sites","init_esm_shims","useMemo","useSiteListClient","httpClient","useHttpClient","useMemo","SiteListClient","init_esm_shims","init_esm_shims","readAppConfig","projectFolder","writeDebugLog","configPath","getAppConfigPath","pathExists","json","readJson","appConfig","appConfigSchema","e","saveAppConfig","config","newConfig","writeJson","init_esm_shims","import_variant","SiteIdState","init_esm_shims","resolveConfiguredSite","projectFolder","getSite","siteId","writeDebugLog","resolvedSiteId","readAppConfig","SiteIdState","site","init_esm_shims","React","import_variant","resolvePlatformUrl","envConfig","platformType","siteOverrideId","appId","site","tag","route","dashboardUrl","siteUrl","openPage","url","title","writeLog","openBrowser","React","Alert","Trans","Text","Newline","Link"]}
@@ -0,0 +1,4 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import{i as t}from"./chunk-SQ7GXOTK.js";import{h as r}from"./chunk-HFDLXX7R.js";r();import{mkdir as e}from"node:fs/promises";import{resolve as i}from"node:path";import{homedir as o}from"node:os";function a(){return t().dataDir??i(o(),".wix")}async function D(){await e(a(),{recursive:!0})}export{a,D as b};
4
+ //# sourceMappingURL=chunk-APTJGMVX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../cli-data-dir/src/index.ts"],"sourcesContent":["import { mkdir } from 'node:fs/promises';\nimport { resolve } from 'node:path';\nimport { homedir } from 'node:os';\nimport { getTestOverrides } from '@wix/cli-test-overrides';\n\nexport function getDataDirPath() {\n return getTestOverrides().dataDir ?? resolve(homedir(), '.wix');\n}\n\nexport async function ensureDataDirExists() {\n await mkdir(getDataDirPath(), { recursive: true });\n}\n"],"mappings":";;gFAAAA,IAAA,OAAS,SAAAC,MAAa,mBACtB,OAAS,WAAAC,MAAe,YACxB,OAAS,WAAAC,MAAe,UAGjB,SAASC,GAAiB,CAC/B,OAAOC,EAAiB,EAAE,SAAWC,EAAQC,EAAQ,EAAG,MAAM,CAChE,CAEA,eAAsBC,GAAsB,CAC1C,MAAMC,EAAML,EAAe,EAAG,CAAE,UAAW,EAAK,CAAC,CACnD","names":["init_esm_shims","mkdir","resolve","homedir","getDataDirPath","getTestOverrides","resolve","homedir","ensureDataDirExists","mkdir"]}
@@ -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 h,h as e,u as a,v as m,w as p,x as s,y as g,z as d}from"./chunk-JV42HHTE.js";import{h as b}from"./chunk-HFDLXX7R.js";b();import I from"node:fs/promises";var u=e.object({errorReporting:e.object({url:e.string().optional()}).optional()}),f=e.object({iframeUrl:e.string().optional(),scriptAsset:e.object({exportedName:e.string(),containerId:e.string(),url:e.string(),scriptType:e.string().optional()}).optional()}),T=e.object({hostingPlatform:e.string(),fullPage:e.boolean().nullish(),hideInSidebar:e.boolean().nullish(),priority:e.number().nullish(),routePath:e.string().nullish(),title:e.string(),pageCategoryId:e.string().nullish(),activeSidebarPageId:e.string().nullish(),requiredPermission:e.string().nullish(),previousRoutePaths:e.array(e.string()).nullish()}).merge(u).merge(f).passthrough(),N=e.object({width:e.number().nullish(),height:e.number().nullish()}).merge(f).passthrough(),C=e.object({appId:e.string(),componentId:e.string(),spec:e.string().min(1),variantValue:e.string()}).passthrough().optional(),O=e.object({compId:e.string(),compType:e.literal(a.BACK_OFFICE_PAGE),compData:e.object({backOfficePage:T}),compName:e.string().optional(),experiment:C}).passthrough(),A=e.object({compId:e.string(),compType:e.literal(a.BACK_OFFICE_EXTENSION),compData:e.object({backOfficeExtension:e.object({hostingPlatform:e.string(),extends:e.string(),title:e.string().nullish(),extensionType:e.literal(h.BACK_OFFICE_EXTENSION_WIDGET),requiredPermission:e.string().nullish(),widget:N}).merge(u).passthrough()}),compName:e.string().optional(),experiment:C}).passthrough(),D=e.object({compId:e.string(),compType:e.literal(a.BACK_OFFICE_SIDEBAR_CATEGORY),compData:e.object({backOfficeSidebarCategory:e.object({hostingPlatform:e.string(),title:e.string(),priority:e.number().nullish()})}),compName:e.string().optional()}).passthrough(),_=e.object({compId:e.string(),compType:e.literal(a.BACK_OFFICE_WIDGET),compName:e.string().optional()}).passthrough(),y=e.object({compId:e.string(),compType:e.literal(a.BACK_OFFICE_EXTENSION_CONTAINER),compName:e.string().optional()}).passthrough(),j=e.object({template:e.string(),name:e.string(),pages:e.enum([m.NONE_PAGES,m.ONCE,m.SPECIFIC_PAGES]),placement:e.enum([p.HEAD,p.BODY_START,p.BODY_END,p.NONE_PLACEMENT]),connectArticleUrl:e.string(),embedCategory:e.enum([s.UNKNOWN,s.FUNCTIONAL,s.ESSENTIAL,s.ANALYTICS,s.ADVERTISING]),loadOnce:e.boolean(),allowedForFreeSite:e.boolean()}),P=e.object({compId:e.string(),compType:e.literal(a.EMBEDDED_SCRIPT),compName:e.string().optional(),compData:e.object({embeddedScriptComponentData:j})}).passthrough(),v=e.object({tagName:e.string(),settingsUrl:e.string(),scriptTag:e.string(),scriptType:e.literal(d.MODULE),type:e.enum([g.WIDGET,g.PAGE]).optional(),slug:e.string().optional(),showPageInMenu:e.boolean().optional(),size:e.object({width:e.number().optional(),height:e.number().optional()}).optional(),installation:e.object({base:e.object({essential:e.boolean().optional(),autoAdd:e.boolean().optional(),maxInstances:e.number().optional()}).optional()}).optional()}).passthrough(),F=e.object({compId:e.string(),compType:e.literal(a.WEB),compData:e.object({webComponentData:v})}).passthrough(),w=e.object({appId:e.string(),components:e.array(e.discriminatedUnion("compType",[O,A,D,_,y,P,F]))});async function W(r){try{let t=await I.readFile(r,"utf-8");return w.parse(JSON.parse(t))}catch(t){let n=t instanceof Error?t.toString():JSON.stringify(t);throw new Error(`Failed to read App Manifest at ${r}: ${n}`)}}var l=(r,t)=>new URL(r,t).href,E=(r,t)=>{let{scriptAsset:n,iframeUrl:i}=r;return n?{scriptAsset:{...n,url:l(n.url,t)}}:i?{iframeUrl:l(i,t)}:r},B=(r,t)=>({template:r.template.replaceAll("__STATICS_BASE_URL_PLACEHOLDER__",t)}),K=(r,t)=>{let n=JSON.parse(JSON.stringify(r)),i=t.endsWith("/")?t:`${t}/`;return n.components.forEach(S=>{let{compData:o,compType:c}=S;c===a.BACK_OFFICE_PAGE&&(o.backOfficePage={...o.backOfficePage,...E(o.backOfficePage,i)}),c===a.BACK_OFFICE_EXTENSION&&(o.backOfficeExtension.widget={...o.backOfficeExtension.widget,...E(o.backOfficeExtension.widget,i)}),c===a.EMBEDDED_SCRIPT&&(o.embeddedScriptComponentData={...o.embeddedScriptComponentData,...B(o.embeddedScriptComponentData,i)}),c===a.WEB&&(o.webComponentData={...o.webComponentData,scriptTag:l(o.webComponentData.scriptTag,i),settingsUrl:l(o.webComponentData.settingsUrl,i)})}),n};export{W as a,K as b};
4
- //# sourceMappingURL=chunk-OGNGTOSN.js.map
3
+ import{A as h,h as e,u as a,v as m,w as p,x as s,y as g,z as d}from"./chunk-SQ7GXOTK.js";import{h as b}from"./chunk-HFDLXX7R.js";b();import I from"node:fs/promises";var u=e.object({errorReporting:e.object({url:e.string().optional()}).optional()}),f=e.object({iframeUrl:e.string().optional(),scriptAsset:e.object({exportedName:e.string(),containerId:e.string(),url:e.string(),scriptType:e.string().optional()}).optional()}),T=e.object({hostingPlatform:e.string(),fullPage:e.boolean().nullish(),hideInSidebar:e.boolean().nullish(),priority:e.number().nullish(),routePath:e.string().nullish(),title:e.string(),pageCategoryId:e.string().nullish(),activeSidebarPageId:e.string().nullish(),requiredPermission:e.string().nullish(),previousRoutePaths:e.array(e.string()).nullish()}).merge(u).merge(f).passthrough(),N=e.object({width:e.number().nullish(),height:e.number().nullish()}).merge(f).passthrough(),C=e.object({appId:e.string(),componentId:e.string(),spec:e.string().min(1),variantValue:e.string()}).passthrough().optional(),O=e.object({compId:e.string(),compType:e.literal(a.BACK_OFFICE_PAGE),compData:e.object({backOfficePage:T}),compName:e.string().optional(),experiment:C}).passthrough(),A=e.object({compId:e.string(),compType:e.literal(a.BACK_OFFICE_EXTENSION),compData:e.object({backOfficeExtension:e.object({hostingPlatform:e.string(),extends:e.string(),title:e.string().nullish(),extensionType:e.literal(h.BACK_OFFICE_EXTENSION_WIDGET),requiredPermission:e.string().nullish(),widget:N}).merge(u).passthrough()}),compName:e.string().optional(),experiment:C}).passthrough(),D=e.object({compId:e.string(),compType:e.literal(a.BACK_OFFICE_SIDEBAR_CATEGORY),compData:e.object({backOfficeSidebarCategory:e.object({hostingPlatform:e.string(),title:e.string(),priority:e.number().nullish()})}),compName:e.string().optional()}).passthrough(),_=e.object({compId:e.string(),compType:e.literal(a.BACK_OFFICE_WIDGET),compName:e.string().optional()}).passthrough(),y=e.object({compId:e.string(),compType:e.literal(a.BACK_OFFICE_EXTENSION_CONTAINER),compName:e.string().optional()}).passthrough(),j=e.object({template:e.string(),name:e.string(),pages:e.enum([m.NONE_PAGES,m.ONCE,m.SPECIFIC_PAGES]),placement:e.enum([p.HEAD,p.BODY_START,p.BODY_END,p.NONE_PLACEMENT]),connectArticleUrl:e.string(),embedCategory:e.enum([s.UNKNOWN,s.FUNCTIONAL,s.ESSENTIAL,s.ANALYTICS,s.ADVERTISING]),loadOnce:e.boolean(),allowedForFreeSite:e.boolean()}),P=e.object({compId:e.string(),compType:e.literal(a.EMBEDDED_SCRIPT),compName:e.string().optional(),compData:e.object({embeddedScriptComponentData:j})}).passthrough(),v=e.object({tagName:e.string(),settingsUrl:e.string(),scriptTag:e.string(),scriptType:e.literal(d.MODULE),type:e.enum([g.WIDGET,g.PAGE]).optional(),slug:e.string().optional(),showPageInMenu:e.boolean().optional(),size:e.object({width:e.number().optional(),height:e.number().optional()}).optional(),installation:e.object({base:e.object({essential:e.boolean().optional(),autoAdd:e.boolean().optional(),maxInstances:e.number().optional()}).optional()}).optional()}).passthrough(),F=e.object({compId:e.string(),compType:e.literal(a.WEB),compData:e.object({webComponentData:v})}).passthrough(),w=e.object({appId:e.string(),components:e.array(e.discriminatedUnion("compType",[O,A,D,_,y,P,F]))});async function W(r){try{let t=await I.readFile(r,"utf-8");return w.parse(JSON.parse(t))}catch(t){let n=t instanceof Error?t.toString():JSON.stringify(t);throw new Error(`Failed to read App Manifest at ${r}: ${n}`)}}var l=(r,t)=>new URL(r,t).href,E=(r,t)=>{let{scriptAsset:n,iframeUrl:i}=r;return n?{scriptAsset:{...n,url:l(n.url,t)}}:i?{iframeUrl:l(i,t)}:r},B=(r,t)=>({template:r.template.replaceAll("__STATICS_BASE_URL_PLACEHOLDER__",t)}),K=(r,t)=>{let n=JSON.parse(JSON.stringify(r)),i=t.endsWith("/")?t:`${t}/`;return n.components.forEach(S=>{let{compData:o,compType:c}=S;c===a.BACK_OFFICE_PAGE&&(o.backOfficePage={...o.backOfficePage,...E(o.backOfficePage,i)}),c===a.BACK_OFFICE_EXTENSION&&(o.backOfficeExtension.widget={...o.backOfficeExtension.widget,...E(o.backOfficeExtension.widget,i)}),c===a.EMBEDDED_SCRIPT&&(o.embeddedScriptComponentData={...o.embeddedScriptComponentData,...B(o.embeddedScriptComponentData,i)}),c===a.WEB&&(o.webComponentData={...o.webComponentData,scriptTag:l(o.webComponentData.scriptTag,i),settingsUrl:l(o.webComponentData.settingsUrl,i)})}),n};export{W as a,K as b};
4
+ //# sourceMappingURL=chunk-B7UI5BHA.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{h as v}from"./chunk-JV42HHTE.js";import{a as $,c as E,e as he,h as m}from"./chunk-HFDLXX7R.js";var H=E(D=>{"use strict";m();var V=class extends Error{constructor(e,t,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},k=class extends V{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};D.CommanderError=V;D.InvalidArgumentError=k});var S=E(P=>{"use strict";m();var{InvalidArgumentError:ue}=H(),N=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new ue(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function ce(l){let e=l.name()+(l.variadic===!0?"...":"");return l.required?"<"+e+">":"["+e+"]"}P.Argument=N;P.humanReadableArgName=ce});var q=E(B=>{"use strict";m();var{humanReadableArgName:pe}=S(),I=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden);if(e._hasImplicitHelpCommand()){let[,i,n]=e._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),s=e.createCommand(i).helpOption(!1);s.description(e._helpCommandDescription),n&&s.arguments(n),t.push(s)}return this.sortSubcommands&&t.sort((i,n)=>i.name().localeCompare(n.name())),t}compareOptions(e,t){let i=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return i(e).localeCompare(i(t))}visibleOptions(e){let t=e.options.filter(s=>!s.hidden),i=e._hasHelpOption&&e._helpShortFlag&&!e._findOption(e._helpShortFlag),n=e._hasHelpOption&&!e._findOption(e._helpLongFlag);if(i||n){let s;i?n?s=e.createOption(e._helpFlags,e._helpDescription):s=e.createOption(e._helpShortFlag,e._helpDescription):s=e.createOption(e._helpLongFlag,e._helpDescription),t.push(s)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let i=e.parent;i;i=i.parent){let n=i.options.filter(s=>!s.hidden);t.push(...n)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(i=>pe(i)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((i,n)=>Math.max(i,t.subcommandTerm(n).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,n)=>Math.max(i,t.optionTerm(n).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((i,n)=>Math.max(i,t.optionTerm(n).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,n)=>Math.max(i,t.argumentTerm(n).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let n=e.parent;n;n=n.parent)i=n.name()+" "+i;return i+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatHelp(e,t){let i=t.padWidth(e,t),n=t.helpWidth||80,s=2,r=2;function a(d,w){if(w){let F=`${d.padEnd(i+r)}${w}`;return t.wrap(F,n-s,i+r)}return d}function o(d){return d.join(`
3
+ import{h as v}from"./chunk-SQ7GXOTK.js";import{a as $,c as E,e as he,h as m}from"./chunk-HFDLXX7R.js";var H=E(D=>{"use strict";m();var V=class extends Error{constructor(e,t,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},k=class extends V{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};D.CommanderError=V;D.InvalidArgumentError=k});var S=E(P=>{"use strict";m();var{InvalidArgumentError:ue}=H(),N=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new ue(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function ce(l){let e=l.name()+(l.variadic===!0?"...":"");return l.required?"<"+e+">":"["+e+"]"}P.Argument=N;P.humanReadableArgName=ce});var q=E(B=>{"use strict";m();var{humanReadableArgName:pe}=S(),I=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden);if(e._hasImplicitHelpCommand()){let[,i,n]=e._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),s=e.createCommand(i).helpOption(!1);s.description(e._helpCommandDescription),n&&s.arguments(n),t.push(s)}return this.sortSubcommands&&t.sort((i,n)=>i.name().localeCompare(n.name())),t}compareOptions(e,t){let i=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return i(e).localeCompare(i(t))}visibleOptions(e){let t=e.options.filter(s=>!s.hidden),i=e._hasHelpOption&&e._helpShortFlag&&!e._findOption(e._helpShortFlag),n=e._hasHelpOption&&!e._findOption(e._helpLongFlag);if(i||n){let s;i?n?s=e.createOption(e._helpFlags,e._helpDescription):s=e.createOption(e._helpShortFlag,e._helpDescription):s=e.createOption(e._helpLongFlag,e._helpDescription),t.push(s)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let i=e.parent;i;i=i.parent){let n=i.options.filter(s=>!s.hidden);t.push(...n)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(i=>pe(i)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((i,n)=>Math.max(i,t.subcommandTerm(n).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,n)=>Math.max(i,t.optionTerm(n).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((i,n)=>Math.max(i,t.optionTerm(n).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,n)=>Math.max(i,t.argumentTerm(n).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let n=e.parent;n;n=n.parent)i=n.name()+" "+i;return i+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatHelp(e,t){let i=t.padWidth(e,t),n=t.helpWidth||80,s=2,r=2;function a(d,w){if(w){let F=`${d.padEnd(i+r)}${w}`;return t.wrap(F,n-s,i+r)}return d}function o(d){return d.join(`
4
4
  `).replace(/^/gm," ".repeat(s))}let h=[`Usage: ${t.commandUsage(e)}`,""],u=t.commandDescription(e);u.length>0&&(h=h.concat([t.wrap(u,n,0),""]));let c=t.visibleArguments(e).map(d=>a(t.argumentTerm(d),t.argumentDescription(d)));c.length>0&&(h=h.concat(["Arguments:",o(c),""]));let f=t.visibleOptions(e).map(d=>a(t.optionTerm(d),t.optionDescription(d)));if(f.length>0&&(h=h.concat(["Options:",o(f),""])),this.showGlobalOptions){let d=t.visibleGlobalOptions(e).map(w=>a(t.optionTerm(w),t.optionDescription(w)));d.length>0&&(h=h.concat(["Global Options:",o(d),""]))}let x=t.visibleCommands(e).map(d=>a(t.subcommandTerm(d),t.subcommandDescription(d)));return x.length>0&&(h=h.concat(["Commands:",o(x),""])),h.join(`
5
5
  `)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,i,n=40){let s=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",r=new RegExp(`[\\n][${s}]+`);if(e.match(r))return e;let a=t-i;if(a<n)return e;let o=e.slice(0,i),h=e.slice(i).replace(`\r
6
6
  `,`
@@ -21,4 +21,4 @@ Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[e]?this._life
21
21
  `),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(i=>Ae(i));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=b.basename(e,b.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},i;return t.error?i=n=>this._outputConfiguration.writeErr(n):i=n=>this._outputConfiguration.writeOut(n),t.write=e.write||i,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let i=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let n=this.helpInformation(i);if(t&&(n=t(n),typeof n!="string"&&!Buffer.isBuffer(n)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(n),this._helpLongFlag&&this.emit(this._helpLongFlag),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",i))}helpOption(e,t){if(typeof e=="boolean")return this._hasHelpOption=e,this;this._helpFlags=e||this._helpFlags,this._helpDescription=t||this._helpDescription;let i=be(this._helpFlags);return this._helpShortFlag=i.shortFlag,this._helpLongFlag=i.longFlag,this}help(e){this.outputHelp(e);let t=p.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let i=["beforeAll","before","after","afterAll"];if(!i.includes(e))throw new Error(`Unexpected value for position to addHelpText.
22
22
  Expecting one of '${i.join("', '")}'`);let n=`${e}Help`;return this.on(n,s=>{let r;typeof t=="function"?r=t({error:s.error,command:s.command}):r=t,r&&s.write(`${r}
23
23
  `)}),this}};function X(l,e){l._hasHelpOption&&e.find(i=>i===l._helpLongFlag||i===l._helpShortFlag)&&(l.outputHelp(),l._exit(0,"commander.helpDisplayed","(outputHelp)"))}function Z(l){return l.map(e=>{if(!e.startsWith("--inspect"))return e;let t,i="127.0.0.1",n="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?n=s[3]:i=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],i=s[3],n=s[4]),t&&n!=="0"?`${t}=${i}:${parseInt(n)+1}`:e})}ee.Command=G});var re=E((_,se)=>{"use strict";m();var{Argument:Ee}=S(),{Command:ie}=te(),{CommanderError:xe,InvalidArgumentError:ne}=H(),{Help:$e}=q(),{Option:ve}=M();_=se.exports=new ie;_.program=_;_.Command=ie;_.Option=ve;_.Argument=Ee;_.Help=$e;_.CommanderError=xe;_.InvalidArgumentError=ne;_.InvalidOptionArgumentError=ne});var ae=E((g,oe)=>{"use strict";m();var O=re();g=oe.exports={};g.program=new O.Command;g.Argument=O.Argument;g.Command=O.Command;g.CommanderError=O.CommanderError;g.Help=O.Help;g.InvalidArgumentError=O.InvalidArgumentError;g.InvalidOptionArgumentError=O.InvalidArgumentError;g.Option=O.Option;g.createCommand=l=>new O.Command(l);g.createOption=(l,e)=>new O.Option(l,e);g.createArgument=(l,e)=>new O.Argument(l,e)});m();m();m();var le=he(ae(),1),{program:Ue,createCommand:Ge,createArgument:Re,createOption:Be,CommanderError:Je,InvalidArgumentError:R,InvalidOptionArgumentError:Ke,Command:ze,Argument:Ye,Option:Qe,Help:Xe}=le.default;function He(l){let e=v.union([v.string().uuid(),v.literal("current")]).transform(t=>t==="current"?void 0:t).safeParse(l);if(e.success)return e.data;throw new R('Value must be a valid GUID or "current"')}function Ve(l){let e=v.string().url().safeParse(l);if(e.success)return e.data;throw new R("Value must be a valid URL")}export{Ge as a,R as b,Qe as c,He as d,Ve as e};
24
- //# sourceMappingURL=chunk-O5L7CVLC.js.map
24
+ //# sourceMappingURL=chunk-C364KT35.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 I,B as l,C as P,M as u,O as B,Q as A,U as x,W 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-JV42HHTE.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-JPAMNQ3J.js.map
3
+ import{A as I,B as l,C as P,Q as u,S as B,U as A,Y as x,_ 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-SQ7GXOTK.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-CQ24SN6G.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-67JGH5YG.js";import{b as c}from"./chunk-JV42HHTE.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-KHABFHDG.js";import{b as c}from"./chunk-SQ7GXOTK.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-67JGH5YG.js";import{b as c}from"./chunk-JV42HHTE.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-5GEONXLW.js.map
11
+ //# sourceMappingURL=chunk-DORVLTGQ.js.map
@@ -0,0 +1,4 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import{b as ve}from"./chunk-DORVLTGQ.js";import{b as j,c as U,e as fe,f as ge,g as he}from"./chunk-6672YZIR.js";import{a as ie,b as se,c as y,d as D,e as A,f as u,r as le}from"./chunk-KHABFHDG.js";import{A as S,C as ce,f as ne,g as me,n as T,o as M,q as N,r as de,t as P,u as z,v as x,w as B,z as b}from"./chunk-XW5ALZ42.js";import{D as _e,P as ue,a as R,c as g,d as h,h as m,ha as w,i as G}from"./chunk-SQ7GXOTK.js";import{e as C,h as o}from"./chunk-HFDLXX7R.js";o();import{useMemo as Mt}from"react";o();o();var Ae={actionConfig:"_actionSPIConfig"},Pe={icon:"_commonImage"},Ce={requiredSettings:"google.protobuf.FieldMask",adminConfigurableSettings:"google.protobuf.FieldMask"};var Re={expectedInputs:"_expectedInputs"};var ye={urlExpirationDate:"google.protobuf.Timestamp"},xe={compData:"_componentData"},De={widgetComponentData:"_widgetComponentData",widgetOutOfIframeData:"_widgetOutOfIframeComponentData",studioWidgetComponentData:"_studioWidgetComponentData",shippingLabelCarrier:"_shippingLabelCarrierSpiConfig",fictionalShippingProvider:"_shippingProviderConfig",automationsActionProvider:"_actionProviderSPIConfig",identityAuthenticator:"_authenticatorConfig",multilingualTranslationSchema:"_multilingualTranslationSchema"};var be={presetsEditorPresence:"_presetEditorPresence"},qe={expectedStartInputs:"_predefinedExpectedInput",expectedVerifyInputs:"_predefinedExpectedInput"};var Pt={dateCreated:"google.protobuf.Timestamp",components:"_component"},Ct={};var Rt={dateCreated:"google.protobuf.Timestamp",components:"_component"};var yt={},xt={apps:"_getAppInfoResponse"};var we={urlExpirationDate:"google.protobuf.Timestamp"};var Ie={referenceData:"_schema"},Oe={width:"DOUBLE",length:"DOUBLE",height:"google.protobuf.DoubleValue"},Te={dimension:"_packageDimension",image:"_image"};var Ne={configuration:"_predefinedExpectedInputConfiguration"},Ee={textInput:"_adminConfigurableTextInput"},Je={wixMediaThumbnail:"_commonImage"};var Fe={createdDate:"google.protobuf.Timestamp",updatedDate:"google.protobuf.Timestamp",fields:"Map#_v1SchemaField"};var ke={packageTypes:"_packageType"},Le={shippingPrice:"DOUBLE"},Ge={widgetDisplay:"_widgetDisplay",editorPresence:"_editorPresence"};var Se={createdDate:"google.protobuf.Timestamp",updatedDate:"google.protobuf.Timestamp"},Dt={app:"_v1App"},bt={app:"_v1App"};var Me={index:"google.protobuf.DoubleValue"},ze={widgetDisplay:"_widgetDisplay"},Be={price:"google.protobuf.FloatValue"},je={widgetData:"_widgetComponentData"};function V(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 D(Object.assign(t,{domainToMappings:e}))}function qt(t){var e={"editor._base_domain_":[{srcPath:"/apps-service",destPath:""}],"blocks._base_domain_":[{srcPath:"/apps-service",destPath:""}],"create.editorx":[{srcPath:"/apps-service",destPath:""}],"bo._base_domain_":[{srcPath:"/apps-service",destPath:""},{srcPath:"/apps-service",destPath:""}],"dev._base_domain_":[{srcPath:"/apps-service",destPath:""}],"www._base_domain_":[{srcPath:"/_api/apps-service",destPath:"/api"}],"manage._base_domain_":[{srcPath:"/apps-service",destPath:""}]};return D(Object.assign(t,{domainToMappings:e}))}function Ue(t){var e=u(Dt,{_v1App:Se}),r=e.toJSON,a=e.fromJSON,s=u(bt,{_v1App:Se}).fromJSON;function p(n){var c=n.host,i=r(t),d={entityFqdn:"wix.devcenter.apps.v1.app",method:"POST",methodFqn:"wix.devcenter.apps.v1.AppsService.CreateApp",url:qt({protoPath:"/v1/apps",data:i,host:c}),data:i,transformResponse:s};return d}return p.fromReq=a,p.__isAmbassador=!0,p}function Ve(t){var e=u(Ct,{}),r=e.toJSON,a=e.fromJSON,s=u(Rt,{_actionProviderSPIConfig:Ae,_actionSPIConfig:Pe,_adminConfigurableTextInput:Ce,_authenticatorConfig:Re,_commonImage:ye,_component:xe,_componentData:De,_editorPresence:be,_expectedInputs:qe,_image:we,_multilingualTranslationSchema:Ie,_packageDimension:Oe,_packageType:Te,_predefinedExpectedInput:Ne,_predefinedExpectedInputConfiguration:Ee,_presetEditorPresence:Je,_schema:Fe,_shippingLabelCarrierSpiConfig:ke,_shippingProviderConfig:Le,_studioWidgetComponentData:Ge,_v1SchemaField:Me,_widgetComponentData:ze,_widgetDisplay:Be,_widgetOutOfIframeComponentData:je}).fromJSON;function p(n){var c=n.host,i=r(t),d={entityFqdn:"wix.devcenter.apps.v1.app",method:"GET",methodFqn:"com.wixpress.appservice.api.Apps.GetAppSnapshot",url:V({protoPath:"/v1/apps/{appId}",data:i,host:c}),params:A(i),transformResponse:s,fallback:[{method:"GET",url:V({protoPath:"/v1/apps/{appId}",data:i,host:c}),params:A(i)}]};return d}return p.fromReq=a,p.__isAmbassador=!0,p}function We(t){var e=u(yt,{}),r=e.toJSON,a=e.fromJSON,s=u(xt,{_actionProviderSPIConfig:Ae,_actionSPIConfig:Pe,_adminConfigurableTextInput:Ce,_authenticatorConfig:Re,_commonImage:ye,_component:xe,_componentData:De,_editorPresence:be,_expectedInputs:qe,_getAppInfoResponse:Pt,_image:we,_multilingualTranslationSchema:Ie,_packageDimension:Oe,_packageType:Te,_predefinedExpectedInput:Ne,_predefinedExpectedInputConfiguration:Ee,_presetEditorPresence:Je,_schema:Fe,_shippingLabelCarrierSpiConfig:ke,_shippingProviderConfig:Le,_studioWidgetComponentData:Ge,_v1SchemaField:Me,_widgetComponentData:ze,_widgetDisplay:Be,_widgetOutOfIframeComponentData:je}).fromJSON;function p(n){var c=n.host,i=r(t),d={entityFqdn:"wix.devcenter.apps.v1.app",method:"GET",methodFqn:"com.wixpress.appservice.api.Apps.GetDeveloperApps",url:V({protoPath:"/v1/apps",data:i,host:c}),params:A(i),transformResponse:s,fallback:[{method:"GET",url:V({protoPath:"/v1/apps",data:i,host:c}),params:A(i)}]};return d}return p.fromReq=a,p.__isAmbassador=!0,p}o();var wt={},It={};var Ot={},Tt={},Nt={},Et={};function Z(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 D(Object.assign(t,{domainToMappings:e}))}function He(t){var e=u(wt,{}),r=e.toJSON,a=e.fromJSON,s=u(It,{}).fromJSON;function p(n){var c=n.host,i=r(t),d={method:"POST",url:Z({protoPath:"/v1/development-sites",data:i,host:c}),data:i,transformResponse:s};return d}return p.fromReq=a,p}function Ke(t){var e=u(Nt,{}),r=e.toJSON,a=e.fromJSON,s=u(Et,{}).fromJSON;function p(n){var c=n.host,i=r(t),d={method:"GET",url:Z({protoPath:"/v1/development-sites",data:i,host:c}),params:A(i),transformResponse:s};return d}return p.fromReq=a,p}function Ye(t){var e=u(Ot,{}),r=e.toJSON,a=e.fromJSON,s=u(Tt,{}).fromJSON;function p(n){var c=n.host,i=r(t),d={method:"GET",url:Z({protoPath:"/v1/development-sites-limit",data:i,host:c}),params:A(i),transformResponse:s};return d}return p.fromReq=a,p}o();var Jt={},Ft={};function kt(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 D(Object.assign(t,{domainToMappings:e}))}function $e(t){var e=u(Jt,{}),r=e.toJSON,a=e.fromJSON,s=u(Ft,{}).fromJSON;function p(n){var c=n.host,i=r(t),d={entityFqdn:"wix.devcenter.app_assessment.v1.validation",method:"GET",methodFqn:"com.wix.devcenter.AppValidationService.GetAppValidationReport",url:kt({protoPath:"/v1/get-app-validation-report/{appId}/{version}",data:i,host:c}),params:A(i),transformResponse:s};return d}return p.fromReq=a,p.__isAmbassador=!0,p}o();var Qe=m.object({app:m.object({id:m.string()})}),Xe=m.object({latestVersion:m.string()}),Ze=m.object({developmentSite:m.object({id:m.string(),siteName:m.string()})}),et=m.object({developmentSites:m.array(m.object({}))}),tt=m.object({limit:m.number()}),Lt=m.object({name:m.string(),appId:m.string()}),at=m.object({apps:m.array(Lt)}),rt=m.object({appPropertiesValidity:m.array(m.object({failures:m.array(m.string())}))});var Gt="a573279f-ae6f-46d1-8556-7c93ae9b2c84",W=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 y(()=>this.httpClient.request(Ue({app:e})),this.retryOptions);return Qe.parse(r).app}catch(r){throw new g({code:h.FailedToCreateDevCenterApp(),cause:r})}};getAppSnapshot=async e=>{let{data:r}=await y(()=>this.httpClient.request(Ve(e)),this.retryOptions);return Xe.parse(r)};createDevSite=async e=>{try{let{data:r}=await y(()=>this.httpClient.request(He({templateId:Gt})),this.retryOptions),{id:a}=Ze.parse(r).developmentSite;return await y(async()=>{let p=await e.getSite(a);if(!p)throw new g({code:h.SiteNotFound(),info:{id:a}});return p},this.retryOptions)}catch(r){throw new g({code:h.FailedToCreateDevelopmentSite(),cause:r})}};getDevSitesCount=async()=>{try{let{data:e}=await y(()=>this.httpClient.request(Ke({})),this.retryOptions);return et.parse(e).developmentSites.length}catch(e){throw new g({code:h.FailedToGetDevelopmentSites(),cause:e})}};getDeveloperApps=async()=>{try{let{data:e}=await y(()=>this.httpClient.request(We({})),this.retryOptions);return at.parse(e).apps}catch(e){throw new g({code:h.FailedToGetDeveloperApps(),cause:e})}};getDevSitesLimit=async()=>{try{let{data:e}=await y(()=>this.httpClient.request(Ye({})),this.retryOptions);return tt.parse(e).limit}catch(e){throw new g({code:h.FailedToGetDevelopmentSitesLimit(),cause:e})}};getAppValidationFailuresCount=async(e,r)=>{try{let{data:a}=await this.httpClient.request($e({appId:e,version:r||"latest"}));return rt.parse(a).appPropertiesValidity.filter(n=>n.failures.length>0).length}catch(a){throw new g({code:h.FailedToGetAppValidity(),cause:a})}}};function E(){let t=j({type:"backoffice"});return Mt(()=>new W(t),[t])}o();o();var oe=C(R(),1);import Q,{useCallback as ft}from"react";o();var Y=C(R(),1);import L from"react";o();o();var ut=C(R(),1);import q,{useState as Wt}from"react";o();var pt=C(R(),1);import ot from"react";var it=({onSubmit:t,onError:e,sites:r})=>{let{t:a}=S(),{getDevSitesCount:s,getDevSitesLimit:p}=E(),{status:n}=x(()=>Promise.all([s(),p()]),[],{onError:e});return(0,pt.match)(n,{Error:()=>null,Loading:()=>ot.createElement(P,{text:a("general.loading")}),Success:({result:[c,i]})=>{let d=c>=i,f=r.length===0;return ot.createElement(M,{label:a("site_type_select.label"),options:[{availability:f?T.Disabled({reason:a("site_type_select.no_sites")}):T.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:d?T.Disabled({reason:a("site_type_select.create_new_dev_site.disabled",{limit:i})}):T.Enabled()}],onSubmit:({value:_})=>t(_)})}})};o();var mt=C(R(),1);import O from"react";o();import ee from"react";o();o();import{useMemo as zt}from"react";o();o();var st=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}`}),s=st.parse(a);return Object.values(s).some(n=>n.appDefinitionId===r&&!n.permissions?.revoked)}catch(a){throw new g({code:h.FailedToCheckIfAppInstalled(),cause:a})}}};function J(){let t=j({type:"general"});return zt(()=>new H(t),[t])}var I=C(R(),1);o();import F from"react";var nt=({siteId:t,appId:e})=>(ne(async(r,a)=>{a.return&&await le(`https://manage.wix.com/installer/install?metaSiteId=${t}&appId=${e}&platform=cli&version=latest`)}),F.createElement(F.Fragment,null,F.createElement(b,{i18nKey:"install_app_on_site.warning"}),F.createElement(b,{i18nKey:"install_app_on_site.warning.instructions",components:[F.createElement(de,{value:"enter"})]})));var te=(0,I.variant)({Success:{},Canceled:{}});function Bt(t){return t&&typeof t=="object"&&"name"in t&&t.name==="AbortError"}var K=({appId:t,site:e,onSubmit:r,onError:a})=>{let{isAppInstalled:s}=J(),{status:p}=x(async({signal:n})=>{let{appInstallationPollInterval:c}=G();try{return await se(()=>s({metaSiteId:e.id,appId:t}),{interval:c??2e3,timeout:{milliseconds:60*1e3*2,signal:n}}),te.Success()}catch(i){if(i instanceof ie)throw new g({code:h.SiteSelectorTimedout(),cause:i});if(Bt(i))return te.Canceled();throw i}},[],{onError:a,onSuccess:n=>{(0,I.isType)(n,te.Success)&&r()}});return(0,I.match)(p,{Error:()=>null,Loading:()=>ee.createElement(nt,{siteId:e.id,appId:t}),Success:()=>ee.createElement(N,{type:"success"},ee.createElement(b,{i18nKey:"install_app_on_site.finished_successfully"}))})};var dt=({status:t,appId:e,onSubmit:r,onError:a})=>{let{t:s}=S();return(0,mt.match)(t,{NotRequested:()=>null,Error:()=>null,Loading:()=>O.createElement(P,{text:s("create_dev_site.loading")}),Success:({result:p})=>O.createElement(O.Fragment,null,O.createElement(b,{i18nKey:"create_dev_site.success",components:[O.createElement(me,{skin:"success",bold:!0})],values:{name:p.displayName}}),O.createElement(K,{appId:e,site:p,onSubmit:()=>r(p),onError:a}))})};var ct={"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."};o();import k,{useState as Vt}from"react";var vt=C(R(),1);o();import Ut from"react";var lt=({onSubmit:t,sites:e})=>{let{t:r}=S();return Ut.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 _t=({sites:t,appId:e,onSubmit:r,onError:a})=>{let{t:s}=S(),{isAppInstalled:p}=J(),[n,c]=Vt(null),i=B((f,_)=>p({metaSiteId:_.id,appId:e}),{onError:a});async function d(f){await i.execute(f)?r(f):c(f)}return k.createElement(k.Fragment,null,k.createElement(lt,{onSubmit:d,sites:t}),(0,vt.isType)(i.status,"Loading")&&k.createElement(P,{text:s("general.loading")}),n&&k.createElement(K,{appId:e,site:n,onSubmit:()=>r(n),onError:a}))};var ae=({appId:t,onSubmit:e,onError:r})=>{let{t:a}=S(),[s,p]=Wt(null),{createDevSite:n}=E(),c=U(),{status:i}=x(()=>c.querySites({query:{cursorPaging:{limit:100}}}),[],{onError:r}),d=B(()=>n(c),{onError:r});function f(_){p(_),_==="create-dev-site"&&d.execute()}return q.createElement(ce,{messages:ct},(0,ut.match)(i,{Error:()=>null,Loading:()=>q.createElement(P,{text:a("general.loading")}),Success:({result:_})=>q.createElement(q.Fragment,null,q.createElement(it,{onSubmit:f,onError:r,sites:_}),s==="create-dev-site"&&q.createElement(dt,{status:d.status,appId:t,onSubmit:e,onError:r}),s==="select-existing-site"&&q.createElement(_t,{sites:_,appId:t,onSubmit:e,onError:r}))}))};var re=({state:t,onSubmit:e})=>{let r=z(),{t:a}=S(),{model:s}=w();return L.createElement(L.Fragment,null,(0,Y.match)(t,{NotConfigured:(0,Y.constant)(L.createElement(N,{type:"insight"},a("general.no_site_id_configured"))),NotFound:({id:p})=>L.createElement(N,{type:"error"},a("general.site_id_not_found",{id:p}))}),L.createElement(ae,{appId:s.config.appId,onSubmit:e,onError:r}))};o();import{createContext as Ht}from"react";var $=Ht(null);var So=({children:t,siteId:e})=>{let r=z(),{model:{projectFolder:a}}=w(),s=ve(),p=U(),{status:n,merge:c}=x(async()=>he({projectFolder:a,siteListClient:p,siteId:e,writeDebugLog:s}),[]),i=ft(async f=>{try{await fe(a,{siteId:f.id}),c({result:ge.Resolved({site:f})})}catch{throw new g({code:h.FailedToSaveDevelopmentSite({path:_e})})}},[c,a]),d=ft(f=>i(f).catch(r),[r,i]);return(0,oe.match)(n,{Error:()=>null,Loading:()=>Q.createElement(P,null),Success:({result:f})=>(0,oe.match)(f,{NotConfigured:_=>Q.createElement(re,{state:_,onSubmit:d}),NotFound:_=>Q.createElement(re,{state:_,onSubmit:d}),Resolved:({site:_})=>Q.createElement($.Provider,{value:{site:_,setSite:i}},typeof t=="function"?t(_):t)})})};o();import Kt,{useContext as Yt,createContext as $t}from"react";var gt=$t(null),Ro=({children:t,armTag:e})=>Kt.createElement(gt.Provider,{value:{armTag:e}},t),ht=()=>{let t=Yt(gt);if(t===null)throw new Error("useArmTag() cannot be used without an <ArmTagProvider>");return t};o();import{useContext as Qt}from"react";function St(){let t=Qt($);if(t===null)throw new Error("useSiteId() cannot be used without an <SiteIdProvider>");return t}o();var X=C(R(),1);import{useMemo as At,useCallback as pe}from"react";function Jo(){let{site:t}=St(),{model:e}=w(),{armTag:r}=ht(),a=At(()=>({appId:e.config.appId,site:t,tag:r}),[e.config.appId,t,r]),s=At(()=>e.components.filter((0,X.isType)(ue.DashboardPage)).sort((i,d)=>i.route.localeCompare(d.route)),[e.components]),p=pe(i=>e.components.some(d=>d.platforms.some((0,X.isType)(i.type))),[e.components]),n=pe(i=>e.components.every(d=>d.platforms.some((0,X.isType)(i.type))||d.platforms.length===0),[e.components]),c=pe(()=>e.components.length>0,[e.components]);return{envConfig:a,dashboardPages:s,isPlatformExists:p,hasSinglePlatform:n,hasExtensions:c}}export{E as a,ae as b,So as c,Ro as d,St as e,Jo as f};
4
+ //# sourceMappingURL=chunk-F6VIPS74.js.map