@wix/cli-app 1.1.14 → 1.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/CreateVersionCommand-EKTXL4HX.js +4 -0
- package/build/{CreateVersionCommand-BDPN3PCU.js.map → CreateVersionCommand-EKTXL4HX.js.map} +1 -1
- package/build/DevCommand-F4JNOQD3.js +4 -0
- package/build/{DevCommand-MZNQFQQK.js.map → DevCommand-F4JNOQD3.js.map} +1 -1
- package/build/GenerateCommand-M5FK5NRX.js +99 -0
- package/build/{GenerateCommand-GD5HZZQR.js.map → GenerateCommand-M5FK5NRX.js.map} +1 -1
- package/build/PreviewCommand-5SJI24RE.js +4 -0
- package/build/PreviewCommand-5SJI24RE.js.map +1 -0
- package/build/ServeCommand-SCDZSOGW.js +4 -0
- package/build/{ServeCommand-FW2FYLQU.js.map → ServeCommand-SCDZSOGW.js.map} +1 -1
- package/build/build-QKFFY6BT.js +4 -0
- package/build/{build-I6KUDQRX.js.map → build-QKFFY6BT.js.map} +1 -1
- package/build/chunk-62RRZRN6.js +6 -0
- package/build/chunk-62RRZRN6.js.map +1 -0
- package/build/{chunk-KZ5AQZHX.js → chunk-6VY5XPWN.js} +2 -2
- package/build/chunk-C6CRDQAM.js +4 -0
- package/build/chunk-F3L55KWK.js +4 -0
- package/build/{chunk-OMVHSBST.js.map → chunk-F3L55KWK.js.map} +1 -1
- package/build/chunk-HFEDL4QC.js +73 -0
- package/build/chunk-HFEDL4QC.js.map +1 -0
- package/build/chunk-J7GQKX36.js +4 -0
- package/build/{chunk-HZIZXN3F.js.map → chunk-J7GQKX36.js.map} +1 -1
- package/build/chunk-JRUKA4BX.js +4 -0
- package/build/{chunk-ADPHGQLQ.js.map → chunk-JRUKA4BX.js.map} +1 -1
- package/build/chunk-KDEP6ACN.js +4 -0
- package/build/{chunk-VKLHCMXH.js.map → chunk-KDEP6ACN.js.map} +1 -1
- package/build/chunk-KOTYDSCW.js +4 -0
- package/build/{chunk-ET3UG47O.js.map → chunk-KOTYDSCW.js.map} +1 -1
- package/build/{chunk-RVYKFFVG.js → chunk-M6F3SNYP.js} +2 -2
- package/build/{chunk-RVYKFFVG.js.map → chunk-M6F3SNYP.js.map} +1 -1
- package/build/{chunk-ZGFYYRQO.js → chunk-N6MHPAL7.js} +2 -2
- package/build/{chunk-ZGFYYRQO.js.map → chunk-N6MHPAL7.js.map} +1 -1
- package/build/chunk-NCLWI32Y.js +4 -0
- package/build/{chunk-RANVKLXM.js.map → chunk-NCLWI32Y.js.map} +1 -1
- package/build/{chunk-RHURHBSO.js → chunk-OQ2EIA5Y.js} +2 -2
- package/build/chunk-PBVA37S6.js +4 -0
- package/build/{chunk-FJVNH2R2.js.map → chunk-PBVA37S6.js.map} +1 -1
- package/build/chunk-RZD2Z3NM.js +4 -0
- package/build/chunk-RZD2Z3NM.js.map +1 -0
- package/build/chunk-TXD4M2YS.js +27 -0
- package/build/chunk-TXD4M2YS.js.map +1 -0
- package/build/chunk-V4D26EXO.js +87 -0
- package/build/chunk-V4D26EXO.js.map +1 -0
- package/build/chunk-VPVMEECP.js +23 -0
- package/build/{chunk-CQOGOYYY.js.map → chunk-VPVMEECP.js.map} +1 -1
- package/build/{chunk-OG3PMZHA.js → chunk-ZHOPW26J.js} +2 -2
- package/build/esm-GVPPSDDL.js +352 -0
- package/build/esm-GVPPSDDL.js.map +1 -0
- package/build/index.js +22 -1
- package/build/index.js.map +1 -1
- package/build/preview-WCMD3SX5.js +4 -0
- package/build/{preview-LPAYZBA2.js.map → preview-WCMD3SX5.js.map} +1 -1
- package/build/render-command-WAL3BAYK.js +4 -0
- package/build/{render-command-BHZU4MZU.js.map → render-command-WAL3BAYK.js.map} +1 -1
- package/package.json +3 -3
- package/templates/dashboard-plugin/plugin.tsx.ejs +1 -1
- package/build/CreateVersionCommand-BDPN3PCU.js +0 -4
- package/build/DevCommand-MZNQFQQK.js +0 -4
- package/build/GenerateCommand-GD5HZZQR.js +0 -99
- package/build/PreviewCommand-4V5HLV2C.js +0 -4
- package/build/PreviewCommand-4V5HLV2C.js.map +0 -1
- package/build/ServeCommand-FW2FYLQU.js +0 -4
- package/build/build-I6KUDQRX.js +0 -4
- package/build/chunk-ADPHGQLQ.js +0 -4
- package/build/chunk-CQOGOYYY.js +0 -23
- package/build/chunk-ET3UG47O.js +0 -4
- package/build/chunk-FJVNH2R2.js +0 -4
- package/build/chunk-HZIZXN3F.js +0 -4
- package/build/chunk-L6Z5LUAF.js +0 -25
- package/build/chunk-L6Z5LUAF.js.map +0 -1
- package/build/chunk-MRFJNNDD.js +0 -75
- package/build/chunk-MRFJNNDD.js.map +0 -1
- package/build/chunk-OMVHSBST.js +0 -4
- package/build/chunk-Q72ID43B.js +0 -4
- package/build/chunk-RANVKLXM.js +0 -4
- package/build/chunk-RW7A77Z2.js +0 -4
- package/build/chunk-RW7A77Z2.js.map +0 -1
- package/build/chunk-VKLHCMXH.js +0 -4
- package/build/chunk-XBWZVJAS.js +0 -108
- package/build/chunk-XBWZVJAS.js.map +0 -1
- package/build/preview-LPAYZBA2.js +0 -4
- package/build/render-command-BHZU4MZU.js +0 -4
- /package/build/{chunk-KZ5AQZHX.js.map → chunk-6VY5XPWN.js.map} +0 -0
- /package/build/{chunk-Q72ID43B.js.map → chunk-C6CRDQAM.js.map} +0 -0
- /package/build/{chunk-RHURHBSO.js.map → chunk-OQ2EIA5Y.js.map} +0 -0
- /package/build/{chunk-OG3PMZHA.js.map → chunk-ZHOPW26J.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{Q as c,S as B,U as A,fa as N,ha as x,j as S,l as m,m as b,n as P,r as l,s as M,t as I,u as v}from"./chunk-HFEDL4QC.js";import{a as h,c as p,d as u}from"./chunk-62RRZRN6.js";import{e as C,h as d}from"./chunk-HFDLXX7R.js";d();var T=C(h(),1);import{randomUUID as R}from"node:crypto";var w=t=>{let r=new Map;[...t].sort((e,a)=>e.id.localeCompare(a.id)).forEach(e=>{let a=r.get(e.id)??[];a.push(e),r.set(e.id,a)});let i=new Map;if(r.forEach((e,a)=>{e.length>1&&i.set(a,e)}),i.size)throw new p({code:u.DuplicateComponentIdsError({issues:Array.from(i.entries()).map(([e,a])=>({id:e,components:a.map(f=>(0,T.match)(f,{DashboardPage:({title:s,relativePath:n})=>({name:s,type:"page",path:c(n,"json")}),DashboardPlugin:({title:s,relativePath:n})=>({name:s,type:"plugin",path:c(n,"json")}),DashboardMenuPlugin:({title:s,relativePath:n})=>({name:s,type:"menu-plugin",path:n}),DashboardModal:({title:s,relativePath:n})=>({name:s,type:"modal",path:c(n,"json")}),DashboardSidebarCategory:({label:s})=>({name:s,type:"sidebar-category",path:S}),EmbeddedScript:({relativePath:s})=>({name:s,type:"embedded-script",path:c(s,"json")}),CustomElement:({name:s,relativePath:n})=>({name:s,type:"custom-element",path:c(n,"json")})})).sort((f,s)=>f.name.localeCompare(s.name)),suggestedId:R()}))})})};d();var O=C(h(),1);var k=(t,r)=>{if(t.experiments)return{appId:r,componentId:t.id,spec:t.experiments.enabledBy,variantValue:"true"}};async function $({appId:t,components:r,sentryDSN:o,componentSourceBuilder:i}){return w(r),{appId:t,components:await Promise.all(r.map((0,O.match)({DashboardPage:async e=>{let a=e.sentryDSN??o;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,...a?{errorReporting:{url:a}}:void 0,...await i(e)}},compName:e.title,experiment:k(e,t)}},DashboardPlugin:async e=>({compId:e.id,compType:m.BACK_OFFICE_EXTENSION_WIDGET,compData:{backOfficeExtensionWidget:{hostingPlatform:l.BUSINESS_MANAGER,extends:e.extends,title:e.title,requiredPermission:e.requiredPermission,width:e.width,height:e.height,...await i(e),...e.sentryDSN?{errorReporting:{url:e.sentryDSN}}:void 0}},compName:e.title}),DashboardMenuPlugin:async e=>({compId:e.id,compType:m.BACK_OFFICE_EXTENSION_MENU_ITEM,compData:{backOfficeExtensionMenuItem:{hostingPlatform:l.BUSINESS_MANAGER,id:e.id,title:e.title,subtitle:e.subtitle,iconKey:e.iconKey,extends:e.extends,action:e.action,requiredPermission:e.requiredPermission,...e.sentryDSN?{errorReporting:{url:e.sentryDSN}}:void 0}},compName:e.title}),DashboardModal:async e=>({compId:e.id,compType:m.BACK_OFFICE_MODAL,compData:{backOfficeModal:{hostingPlatform:l.BUSINESS_MANAGER,title:e.title,requiredPermission:e.requiredPermission,width:e.width,height:e.height,...await i(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:P.NONE_PAGES,placement:e.placement,connectArticleUrl:"",embedCategory:e.scriptType,loadOnce:!0,allowedForFreeSite:!0,...await i(e)}}}),CustomElement:async e=>{let{scriptUrl:a,settingsUrl:f}=await i(e);return{compId:e.id,compType:m.CUSTOM_ELEMENT_WIDGET,compName:e.name,compData:{customElementWidget:{base:{name:e.name},widgetData:{tagName:e.tagName,scriptType:I.ES_MODULE,scriptUrl:a},size:{width:{defaultWidth:e.width.defaultWidth,allowStretch:e.width.allowStretch,stretchByDefault:e.width.stretchByDefault},height:{defaultHeight:e.height.defaultHeight,heightMode:v.FIXED}},installation:{base:{autoAdd:e.installation?.autoAddToSite,essential:e.installation?.essential,maxInstances:e.installation?.maxInstances},widget:{region:b.BODY}},behaviors:{...e.relativePanelPath?{settings:{settingsUrl:f}}:{}}}}}}})))}}d();var F=C(h(),1);d();function U(t){if(!("output"in t||Array.isArray(t)))throw new p({code:u.InvalidViteBuildOutput()});return Array.isArray(t)?t.flatMap(i=>i.output):t.output}function E(t,r){let i=U(t).find(e=>e.type==="chunk"&&e.facadeModuleId===r);if(!i)throw new p({code:u.ViteModuleBundleNotFound()});return i.fileName}function _(t,r){let i=U(t).find(e=>e.fileName===r);if(!i||!("source"in i))throw new p({code:u.ViteFileNotFoundInOutput({fileName:r})});return i.source.toString()}async function V(t,r){let o=new URL(t.relativePath,r).href;return await fetch(o).then(e=>e.text())}var D=(t,r,o)=>{if(!r.config.trusted)return{iframeUrl:B(t.id)};let i=A(t.id),e=o?E(o,i):`/@id/${i}?import`;return{scriptAsset:{exportedName:t.id,containerId:r.config.appId,url:e,scriptType:M.MODULE}}},j=async(t,r,o)=>({template:r?_(r,t.relativePath):await V(t,o)}),G=(t,r)=>{let o=x(t.id);return{scriptUrl:r?E(r,o):`/@id/${o}?import`,settingsUrl:N(t.id)}};function se({model:t,buildOutput:r,devServerUrl:o}){return async i=>(0,F.match)(i,{EmbeddedScript:a=>j(a,r,o),DashboardSidebarCategory:()=>{},CustomElement:a=>G(a,r),DashboardPage:a=>D(a,t,r),DashboardPlugin:a=>D(a,t,r),DashboardModal:a=>D(a,t,r),DashboardMenuPlugin:()=>{}})}export{w as a,$ as b,se as c};
|
|
4
|
+
//# sourceMappingURL=chunk-J7GQKX36.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/app-manifest/validate.ts","../src/app-manifest/create.ts","../src/app-manifest/component-source.ts","../src/app-manifest/build-output-data-extractor.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport { match } from 'variant';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { CONFIG_FILENAME } from '@wix/cli-core-definitions';\nimport { replaceExtension } from '../dev-center/components/path.js';\nimport type { DevCenterComponent } from '../dev-center/components/dev-center-component.js';\n\nexport const validateComponents = (components: DevCenterComponent[]) => {\n const devCenterComponentsToIdMap: Map<string, DevCenterComponent[]> =\n new Map();\n const sortedComponentsById = [...components].sort((a, b) =>\n a.id.localeCompare(b.id)\n );\n sortedComponentsById.forEach((component) => {\n const componentList = devCenterComponentsToIdMap.get(component.id) ?? [];\n componentList.push(component);\n devCenterComponentsToIdMap.set(component.id, componentList);\n });\n\n const devCenterComponentsWithSameIDMap: Map<string, DevCenterComponent[]> =\n new Map();\n\n devCenterComponentsToIdMap.forEach((devCenterComponents, key) => {\n if (devCenterComponents.length > 1) {\n devCenterComponentsWithSameIDMap.set(key, devCenterComponents);\n }\n });\n\n if (devCenterComponentsWithSameIDMap.size) {\n throw new CliError({\n code: CliErrorCode.DuplicateComponentIdsError({\n issues: Array.from(devCenterComponentsWithSameIDMap.entries()).map(\n ([id, devCenterComponents]) => {\n return {\n id,\n components: devCenterComponents\n .map((component) =>\n match(component, {\n DashboardPage: ({ title, relativePath }) => ({\n name: title,\n type: 'page' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n DashboardPlugin: ({ title, relativePath }) => ({\n name: title,\n type: 'plugin' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n DashboardMenuPlugin: ({ title, relativePath }) => ({\n name: title,\n type: 'menu-plugin' as const,\n // We can use the relative path since the path already points to the menu config json\n path: relativePath,\n }),\n DashboardModal: ({ title, relativePath }) => ({\n name: title,\n type: 'modal' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n DashboardSidebarCategory: ({ label }) => ({\n name: label,\n type: 'sidebar-category' as const,\n path: CONFIG_FILENAME,\n }),\n EmbeddedScript: ({ relativePath }) => ({\n name: relativePath,\n type: 'embedded-script' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n CustomElement: ({ name, relativePath }) => ({\n name,\n type: 'custom-element' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n })\n )\n .sort((a, b) => a.name.localeCompare(b.name)),\n suggestedId: randomUUID(),\n };\n }\n ),\n }),\n });\n }\n};\n","import {\n ComponentType,\n BackOfficeHostingPlatforms,\n EmbeddedScriptPages,\n HeightMode,\n RegionType,\n CustomElementScriptType,\n} from '@wix/ambassador-devcenter-components-v1-component/types';\nimport { match } from 'variant';\nimport type {\n AppManifest,\n ComponentExperiment,\n BackofficePage,\n BackofficeExtensionWidget,\n BackofficeExtensionMenuItem,\n BackofficeSideCategory,\n BackofficeModal,\n EmbeddedScript,\n CustomElement,\n} from '@wix/cli-app-manifest';\nimport { validateComponents } from './validate.js';\nimport type { DevCenterComponent } from '../dev-center/components/dev-center-component.js';\nimport type { ComponentSourceBuilder } from './component-source.js';\n\ntype CreateAppManifestParams = {\n appId: string;\n components: DevCenterComponent[];\n sentryDSN?: string;\n componentSourceBuilder: ComponentSourceBuilder;\n};\n\nconst getExperiment = (\n component: DevCenterComponent<'DashboardPage'>,\n appId: string\n): ComponentExperiment => {\n if (component.experiments) {\n return {\n appId,\n componentId: component.id,\n spec: component.experiments.enabledBy,\n variantValue: 'true',\n };\n }\n return undefined;\n};\n\nexport async function createAppManifest({\n appId,\n components,\n sentryDSN,\n componentSourceBuilder,\n}: CreateAppManifestParams): Promise<AppManifest> {\n validateComponents(components);\n\n return {\n appId,\n components: await Promise.all(\n components.map(\n match({\n DashboardPage: async (component): Promise<BackofficePage> => {\n const componentSentryDSN = component.sentryDSN ?? sentryDSN;\n return {\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_PAGE as const,\n compData: {\n backOfficePage: {\n hostingPlatform: BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n fullPage: component.sidebar?.whenActive?.hideSidebar,\n hideInSidebar: component.sidebar?.disabled,\n priority: component.sidebar?.priority,\n routePath: component.route.slice(1),\n title: component.title,\n pageCategoryId: component.sidebar?.categoryId,\n activeSidebarPageId:\n component.sidebar?.whenActive?.selectedPageId,\n requiredPermission: component.requiredPermission,\n previousRoutePaths: component.additionalRoutes,\n ...(componentSentryDSN\n ? { errorReporting: { url: componentSentryDSN } }\n : undefined),\n ...(await componentSourceBuilder(component)),\n },\n },\n compName: component.title,\n experiment: getExperiment(component, appId),\n };\n },\n DashboardPlugin: async (\n component\n ): Promise<BackofficeExtensionWidget> => ({\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_EXTENSION_WIDGET as const,\n compData: {\n backOfficeExtensionWidget: {\n hostingPlatform: BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n extends: component.extends,\n title: component.title,\n requiredPermission: component.requiredPermission,\n width: component.width,\n height: component.height,\n ...(await componentSourceBuilder(component)),\n ...(component.sentryDSN\n ? { errorReporting: { url: component.sentryDSN } }\n : undefined),\n },\n },\n compName: component.title,\n }),\n DashboardMenuPlugin: async (\n component\n ): Promise<BackofficeExtensionMenuItem> => ({\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_EXTENSION_MENU_ITEM as const,\n compData: {\n backOfficeExtensionMenuItem: {\n hostingPlatform: BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n id: component.id,\n title: component.title,\n subtitle: component.subtitle,\n iconKey: component.iconKey,\n extends: component.extends,\n action: component.action,\n requiredPermission: component.requiredPermission,\n ...(component.sentryDSN\n ? { errorReporting: { url: component.sentryDSN } }\n : undefined),\n },\n },\n compName: component.title,\n }),\n DashboardModal: async (component): Promise<BackofficeModal> => ({\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_MODAL as const,\n compData: {\n backOfficeModal: {\n hostingPlatform: BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n title: component.title,\n requiredPermission: component.requiredPermission,\n width: component.width,\n height: component.height,\n ...(await componentSourceBuilder(component)),\n ...(component.sentryDSN\n ? { errorReporting: { url: component.sentryDSN } }\n : undefined),\n },\n },\n compName: component.title,\n }),\n DashboardSidebarCategory: async (\n component\n ): Promise<BackofficeSideCategory> => ({\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_SIDEBAR_CATEGORY as const,\n compData: {\n backOfficeSidebarCategory: {\n hostingPlatform: BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n title: component.label,\n priority: component.priority,\n },\n },\n compName: component.label,\n }),\n EmbeddedScript: async (component): Promise<EmbeddedScript> => ({\n compId: component.id,\n compType: ComponentType.EMBEDDED_SCRIPT as const,\n compName: component.name,\n compData: {\n embeddedScriptComponentData: {\n name: component.name,\n pages: EmbeddedScriptPages.NONE_PAGES,\n placement: component.placement,\n connectArticleUrl: '',\n embedCategory: component.scriptType,\n loadOnce: true,\n allowedForFreeSite: true,\n ...(await componentSourceBuilder(component)),\n },\n },\n }),\n CustomElement: async (component): Promise<CustomElement> => {\n const { scriptUrl, settingsUrl } = await componentSourceBuilder(\n component\n );\n\n return {\n compId: component.id,\n compType: ComponentType.CUSTOM_ELEMENT_WIDGET as const,\n compName: component.name,\n compData: {\n customElementWidget: {\n base: {\n name: component.name,\n },\n widgetData: {\n tagName: component.tagName,\n scriptType: CustomElementScriptType.ES_MODULE,\n scriptUrl,\n },\n size: {\n width: {\n defaultWidth: component.width.defaultWidth,\n allowStretch: component.width.allowStretch,\n stretchByDefault: component.width.stretchByDefault,\n },\n height: {\n defaultHeight: component.height.defaultHeight,\n heightMode: HeightMode.FIXED,\n },\n },\n installation: {\n base: {\n autoAdd: component.installation?.autoAddToSite,\n essential: component.installation?.essential,\n maxInstances: component.installation?.maxInstances,\n },\n widget: { region: RegionType.BODY },\n },\n behaviors: {\n ...(component.relativePanelPath\n ? { settings: { settingsUrl } }\n : {}),\n },\n },\n },\n };\n },\n })\n )\n ),\n };\n}\n","import { BackOfficeScriptAssetType } from '@wix/ambassador-devcenter-components-v1-component/types';\nimport type { ComponentSource } from '@wix/cli-app-manifest';\nimport { match } from 'variant';\nimport {\n virtualModuleIdForScriptAsset,\n virtualPathForHTMLAsset,\n} from '../dev-center/components/dashboard/config.js';\nimport {\n virtualModuleIdForCustomElementScriptAsset,\n virtualPathForCustomElementPanelHTMLAsset,\n} from '../dev-center/components/site/config.js';\nimport type { ProjectModel } from '../model.js';\nimport type { ViteBuildOutput } from './build-output-data-extractor.js';\nimport {\n extractModuleBundleContent,\n extractModuleBundleName,\n} from './build-output-data-extractor.js';\nimport type { DevCenterComponent } from '../dev-center/components/dev-center-component.js';\n\ntype DashboardSource =\n | {\n iframeUrl: string;\n scriptAsset?: never;\n }\n | {\n scriptAsset: ComponentSource['scriptAsset'];\n iframeUrl?: never;\n };\ntype EmbeddedScriptSource = {\n template: string;\n};\ntype CustomElementSource = { scriptUrl: string; settingsUrl: string };\n\nexport type ComponentSourceBuilder = <T extends DevCenterComponent>(\n component: T\n) => Promise<\n T extends DevCenterComponent<'EmbeddedScript'>\n ? EmbeddedScriptSource\n : T extends DevCenterComponent<'CustomElement'>\n ? CustomElementSource\n : T extends DevCenterComponent<'DashboardPage'>\n ? DashboardSource\n : T extends DevCenterComponent<'DashboardPlugin'>\n ? DashboardSource\n : T extends DevCenterComponent<'DashboardModal'>\n ? DashboardSource\n : undefined\n>;\n\nasync function getEmbeddedScriptDevTemplate(\n component: DevCenterComponent<'EmbeddedScript'>,\n devServerUrl?: string\n) {\n const url = new URL(component.relativePath, devServerUrl).href;\n const devTemplate = await fetch(url).then((res) => res.text());\n\n return devTemplate;\n}\n\nconst dashboardSourceBuilder = (\n component:\n | DevCenterComponent<'DashboardPage'>\n | DevCenterComponent<'DashboardPlugin'>\n | DevCenterComponent<'DashboardModal'>,\n model: ProjectModel,\n buildOutput?: ViteBuildOutput\n): DashboardSource => {\n if (!model.config.trusted) {\n return {\n iframeUrl: virtualPathForHTMLAsset(component.id),\n };\n }\n const moduleId = virtualModuleIdForScriptAsset(component.id);\n const componentUrl = buildOutput\n ? extractModuleBundleName(buildOutput, moduleId)\n : `/@id/${moduleId}?import`;\n\n return {\n scriptAsset: {\n exportedName: component.id,\n containerId: model.config.appId,\n url: componentUrl,\n scriptType: BackOfficeScriptAssetType.MODULE,\n },\n };\n};\n\nconst embeddedScriptBuilder = async (\n component: DevCenterComponent<'EmbeddedScript'>,\n buildOutput?: ViteBuildOutput,\n devServerUrl?: string\n): Promise<EmbeddedScriptSource> => {\n return {\n template: buildOutput\n ? extractModuleBundleContent(buildOutput, component.relativePath)\n : await getEmbeddedScriptDevTemplate(component, devServerUrl),\n };\n};\n\nconst customElementBuilder = (\n component: DevCenterComponent<'CustomElement'>,\n buildOutput?: ViteBuildOutput\n): CustomElementSource => {\n const moduleId = virtualModuleIdForCustomElementScriptAsset(component.id);\n const componentUrl = buildOutput\n ? extractModuleBundleName(buildOutput, moduleId)\n : `/@id/${moduleId}?import`;\n\n return {\n scriptUrl: componentUrl,\n settingsUrl: virtualPathForCustomElementPanelHTMLAsset(component.id),\n };\n};\n\nexport function getComponentSourceBuilder({\n model,\n buildOutput,\n devServerUrl,\n}: {\n model: ProjectModel;\n buildOutput?: ViteBuildOutput;\n devServerUrl?: string;\n}) {\n return (async (component: DevCenterComponent) => {\n const source = match(component, {\n EmbeddedScript: (embeddedScriptComponent) =>\n embeddedScriptBuilder(\n embeddedScriptComponent,\n buildOutput,\n devServerUrl\n ),\n DashboardSidebarCategory: () => {},\n CustomElement: (customElementComponent) =>\n customElementBuilder(customElementComponent, buildOutput),\n DashboardPage: (dashboardPageComponent) =>\n dashboardSourceBuilder(dashboardPageComponent, model, buildOutput),\n DashboardPlugin: (dashboardPluginComponent) =>\n dashboardSourceBuilder(dashboardPluginComponent, model, buildOutput),\n DashboardModal: (dashboardModalComponent) =>\n dashboardSourceBuilder(dashboardModalComponent, model, buildOutput),\n DashboardMenuPlugin: () => {},\n });\n\n return source;\n }) as ComponentSourceBuilder;\n}\n","import { CliError, CliErrorCode } from '@wix/cli-error';\nimport type { build } from 'vite';\n\nexport type ViteBuildOutput = Awaited<ReturnType<typeof build>>;\n\nfunction extractBuildOutputs(buildOutput: ViteBuildOutput) {\n const isValidRollupOutput =\n 'output' in buildOutput || Array.isArray(buildOutput);\n\n if (!isValidRollupOutput) {\n throw new CliError({ code: CliErrorCode.InvalidViteBuildOutput() });\n }\n\n const outputs = Array.isArray(buildOutput)\n ? buildOutput.flatMap((output) => output.output)\n : buildOutput.output;\n\n return outputs;\n}\n\nexport function extractModuleBundleName(\n buildOutput: ViteBuildOutput,\n moduleId: string\n) {\n const outputs = extractBuildOutputs(buildOutput);\n\n const output = outputs.find(\n (output) => output.type === 'chunk' && output.facadeModuleId === moduleId\n );\n\n if (!output) {\n throw new CliError({ code: CliErrorCode.ViteModuleBundleNotFound() });\n }\n\n return output.fileName;\n}\n\nexport function extractModuleBundleContent(\n buildOutput: ViteBuildOutput,\n fileName: string\n) {\n const outputs = extractBuildOutputs(buildOutput);\n\n const output = outputs.find((output) => output.fileName === fileName);\n\n if (!output || !('source' in output)) {\n throw new CliError({\n code: CliErrorCode.ViteFileNotFoundInOutput({ fileName }),\n });\n }\n\n return output.source.toString();\n}\n"],"mappings":";;oMAAAA,IACA,IAAAC,EAAsB,SADtB,OAAS,cAAAC,MAAkB,cAOpB,IAAMC,EAAsBC,GAAqC,CACtE,IAAMC,EACJ,IAAI,IACuB,CAAC,GAAGD,CAAU,EAAE,KAAK,CAACE,EAAGC,IACpDD,EAAE,GAAG,cAAcC,EAAE,EAAE,CACzB,EACqB,QAASC,GAAc,CAC1C,IAAMC,EAAgBJ,EAA2B,IAAIG,EAAU,EAAE,GAAK,CAAC,EACvEC,EAAc,KAAKD,CAAS,EAC5BH,EAA2B,IAAIG,EAAU,GAAIC,CAAa,CAC5D,CAAC,EAED,IAAMC,EACJ,IAAI,IAQN,GANAL,EAA2B,QAAQ,CAACM,EAAqBC,IAAQ,CAC3DD,EAAoB,OAAS,GAC/BD,EAAiC,IAAIE,EAAKD,CAAmB,CAEjE,CAAC,EAEGD,EAAiC,KACnC,MAAM,IAAIG,EAAS,CACjB,KAAMC,EAAa,2BAA2B,CAC5C,OAAQ,MAAM,KAAKJ,EAAiC,QAAQ,CAAC,EAAE,IAC7D,CAAC,CAACK,EAAIJ,CAAmB,KAChB,CACL,G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kBgB,GAChBlB,EAAuBkB,EAA0BjB,EAAOC,CAAW,EACrE,eAAiBiB,GACfnB,EAAuBmB,EAAyBlB,EAAOC,CAAW,EACpE,oBAAqB,IAAM,CAAC,CAC9B,CAAC,CAIL","names":["init_esm_shims","import_variant","randomUUID","validateComponents","components","devCenterComponentsToIdMap","a","b","component","componentList","devCenterComponentsWithSameIDMap","devCenterComponents","key","CliError","CliErrorCode","id","title","relativePath","replaceExtension","label","CONFIG_FILENAME","name","randomUUID","init_esm_shims","import_variant","getExperiment","component","appId","createAppManifest","components","sentryDSN","componentSourceBuilder","validateComponents","componentSentryDSN","ComponentType","BackOfficeHostingPlatforms","EmbeddedScriptPages","scriptUrl","settingsUrl","CustomElementScriptType","HeightMode","RegionType","init_esm_shims","import_variant","init_esm_shims","extractBuildOutputs","buildOutput","CliError","CliErrorCode","output","extractModuleBundleName","moduleId","extractModuleBundleContent","fileName","getEmbeddedScriptDevTemplate","component","devServerUrl","url","res","dashboardSourceBuilder","model","buildOutput","virtualPathForHTMLAsset","moduleId","virtualModuleIdForScriptAsset","componentUrl","extractModuleBundleName","BackOfficeScriptAssetType","embeddedScriptBuilder","extractModuleBundleContent","customElementBuilder","virtualModuleIdForCustomElementScriptAsset","virtualPathForCustomElementPanelHTMLAsset","getComponentSourceBuilder","embeddedScriptComponent","customElementComponent","dashboardPageComponent","dashboardPluginComponent","dashboardModalComponent"]}
|
|
1
|
+
{"version":3,"sources":["../src/app-manifest/validate.ts","../src/app-manifest/create.ts","../src/app-manifest/component-source.ts","../src/app-manifest/build-output-data-extractor.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport { match } from 'variant';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { CONFIG_FILENAME } from '@wix/cli-core-definitions';\nimport { replaceExtension } from '../dev-center/components/path.js';\nimport type { DevCenterComponent } from '../dev-center/components/dev-center-component.js';\n\nexport const validateComponents = (components: DevCenterComponent[]) => {\n const devCenterComponentsToIdMap: Map<string, DevCenterComponent[]> =\n new Map();\n const sortedComponentsById = [...components].sort((a, b) =>\n a.id.localeCompare(b.id)\n );\n sortedComponentsById.forEach((component) => {\n const componentList = devCenterComponentsToIdMap.get(component.id) ?? [];\n componentList.push(component);\n devCenterComponentsToIdMap.set(component.id, componentList);\n });\n\n const devCenterComponentsWithSameIDMap: Map<string, DevCenterComponent[]> =\n new Map();\n\n devCenterComponentsToIdMap.forEach((devCenterComponents, key) => {\n if (devCenterComponents.length > 1) {\n devCenterComponentsWithSameIDMap.set(key, devCenterComponents);\n }\n });\n\n if (devCenterComponentsWithSameIDMap.size) {\n throw new CliError({\n code: CliErrorCode.DuplicateComponentIdsError({\n issues: Array.from(devCenterComponentsWithSameIDMap.entries()).map(\n ([id, devCenterComponents]) => {\n return {\n id,\n components: devCenterComponents\n .map((component) =>\n match(component, {\n DashboardPage: ({ title, relativePath }) => ({\n name: title,\n type: 'page' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n DashboardPlugin: ({ title, relativePath }) => ({\n name: title,\n type: 'plugin' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n DashboardMenuPlugin: ({ title, relativePath }) => ({\n name: title,\n type: 'menu-plugin' as const,\n // We can use the relative path since the path already points to the menu config json\n path: relativePath,\n }),\n DashboardModal: ({ title, relativePath }) => ({\n name: title,\n type: 'modal' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n DashboardSidebarCategory: ({ label }) => ({\n name: label,\n type: 'sidebar-category' as const,\n path: CONFIG_FILENAME,\n }),\n EmbeddedScript: ({ relativePath }) => ({\n name: relativePath,\n type: 'embedded-script' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n CustomElement: ({ name, relativePath }) => ({\n name,\n type: 'custom-element' as const,\n path: replaceExtension(relativePath, 'json'),\n }),\n })\n )\n .sort((a, b) => a.name.localeCompare(b.name)),\n suggestedId: randomUUID(),\n };\n }\n ),\n }),\n });\n }\n};\n","import {\n ComponentType,\n BackOfficeHostingPlatforms,\n EmbeddedScriptPages,\n HeightMode,\n RegionType,\n CustomElementScriptType,\n} from '@wix/ambassador-devcenter-components-v1-component/types';\nimport { match } from 'variant';\nimport type {\n AppManifest,\n ComponentExperiment,\n BackofficePage,\n BackofficeExtensionWidget,\n BackofficeExtensionMenuItem,\n BackofficeSideCategory,\n BackofficeModal,\n EmbeddedScript,\n CustomElement,\n} from '@wix/cli-app-manifest';\nimport { validateComponents } from './validate.js';\nimport type { DevCenterComponent } from '../dev-center/components/dev-center-component.js';\nimport type { ComponentSourceBuilder } from './component-source.js';\n\ntype CreateAppManifestParams = {\n appId: string;\n components: DevCenterComponent[];\n sentryDSN?: string;\n componentSourceBuilder: ComponentSourceBuilder;\n};\n\nconst getExperiment = (\n component: DevCenterComponent<'DashboardPage'>,\n appId: string\n): ComponentExperiment => {\n if (component.experiments) {\n return {\n appId,\n componentId: component.id,\n spec: component.experiments.enabledBy,\n variantValue: 'true',\n };\n }\n return undefined;\n};\n\nexport async function createAppManifest({\n appId,\n components,\n sentryDSN,\n componentSourceBuilder,\n}: CreateAppManifestParams): Promise<AppManifest> {\n validateComponents(components);\n\n return {\n appId,\n components: await Promise.all(\n components.map(\n match({\n DashboardPage: async (component): Promise<BackofficePage> => {\n const componentSentryDSN = component.sentryDSN ?? sentryDSN;\n return {\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_PAGE as const,\n compData: {\n backOfficePage: {\n hostingPlatform: BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n fullPage: component.sidebar?.whenActive?.hideSidebar,\n hideInSidebar: component.sidebar?.disabled,\n priority: component.sidebar?.priority,\n routePath: component.route.slice(1),\n title: component.title,\n pageCategoryId: component.sidebar?.categoryId,\n activeSidebarPageId:\n component.sidebar?.whenActive?.selectedPageId,\n requiredPermission: component.requiredPermission,\n previousRoutePaths: component.additionalRoutes,\n ...(componentSentryDSN\n ? { errorReporting: { url: componentSentryDSN } }\n : undefined),\n ...(await componentSourceBuilder(component)),\n },\n },\n compName: component.title,\n experiment: getExperiment(component, appId),\n };\n },\n DashboardPlugin: async (\n component\n ): Promise<BackofficeExtensionWidget> => ({\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_EXTENSION_WIDGET as const,\n compData: {\n backOfficeExtensionWidget: {\n hostingPlatform: BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n extends: component.extends,\n title: component.title,\n requiredPermission: component.requiredPermission,\n width: component.width,\n height: component.height,\n ...(await componentSourceBuilder(component)),\n ...(component.sentryDSN\n ? { errorReporting: { url: component.sentryDSN } }\n : undefined),\n },\n },\n compName: component.title,\n }),\n DashboardMenuPlugin: async (\n component\n ): Promise<BackofficeExtensionMenuItem> => ({\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_EXTENSION_MENU_ITEM as const,\n compData: {\n backOfficeExtensionMenuItem: {\n hostingPlatform: BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n id: component.id,\n title: component.title,\n subtitle: component.subtitle,\n iconKey: component.iconKey,\n extends: component.extends,\n action: component.action,\n requiredPermission: component.requiredPermission,\n ...(component.sentryDSN\n ? { errorReporting: { url: component.sentryDSN } }\n : undefined),\n },\n },\n compName: component.title,\n }),\n DashboardModal: async (component): Promise<BackofficeModal> => ({\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_MODAL as const,\n compData: {\n backOfficeModal: {\n hostingPlatform: BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n title: component.title,\n requiredPermission: component.requiredPermission,\n width: component.width,\n height: component.height,\n ...(await componentSourceBuilder(component)),\n ...(component.sentryDSN\n ? { errorReporting: { url: component.sentryDSN } }\n : undefined),\n },\n },\n compName: component.title,\n }),\n DashboardSidebarCategory: async (\n component\n ): Promise<BackofficeSideCategory> => ({\n compId: component.id,\n compType: ComponentType.BACK_OFFICE_SIDEBAR_CATEGORY as const,\n compData: {\n backOfficeSidebarCategory: {\n hostingPlatform: BackOfficeHostingPlatforms.BUSINESS_MANAGER,\n title: component.label,\n priority: component.priority,\n },\n },\n compName: component.label,\n }),\n EmbeddedScript: async (component): Promise<EmbeddedScript> => ({\n compId: component.id,\n compType: ComponentType.EMBEDDED_SCRIPT as const,\n compName: component.name,\n compData: {\n embeddedScriptComponentData: {\n name: component.name,\n pages: EmbeddedScriptPages.NONE_PAGES,\n placement: component.placement,\n connectArticleUrl: '',\n embedCategory: component.scriptType,\n loadOnce: true,\n allowedForFreeSite: true,\n ...(await componentSourceBuilder(component)),\n },\n },\n }),\n CustomElement: async (component): Promise<CustomElement> => {\n const { scriptUrl, settingsUrl } = await componentSourceBuilder(\n component\n );\n\n return {\n compId: component.id,\n compType: ComponentType.CUSTOM_ELEMENT_WIDGET as const,\n compName: component.name,\n compData: {\n customElementWidget: {\n base: {\n name: component.name,\n },\n widgetData: {\n tagName: component.tagName,\n scriptType: CustomElementScriptType.ES_MODULE,\n scriptUrl,\n },\n size: {\n width: {\n defaultWidth: component.width.defaultWidth,\n allowStretch: component.width.allowStretch,\n stretchByDefault: component.width.stretchByDefault,\n },\n height: {\n defaultHeight: component.height.defaultHeight,\n heightMode: HeightMode.FIXED,\n },\n },\n installation: {\n base: {\n autoAdd: component.installation?.autoAddToSite,\n essential: component.installation?.essential,\n maxInstances: component.installation?.maxInstances,\n },\n widget: { region: RegionType.BODY },\n },\n behaviors: {\n ...(component.relativePanelPath\n ? { settings: { settingsUrl } }\n : {}),\n },\n },\n },\n };\n },\n })\n )\n ),\n };\n}\n","import { BackOfficeScriptAssetType } from '@wix/ambassador-devcenter-components-v1-component/types';\nimport type { ComponentSource } from '@wix/cli-app-manifest';\nimport { match } from 'variant';\nimport {\n virtualModuleIdForScriptAsset,\n virtualPathForHTMLAsset,\n} from '../dev-center/components/dashboard/config.js';\nimport {\n virtualModuleIdForCustomElementScriptAsset,\n virtualPathForCustomElementPanelHTMLAsset,\n} from '../dev-center/components/site/config.js';\nimport type { ProjectModel } from '../model.js';\nimport type { ViteBuildOutput } from './build-output-data-extractor.js';\nimport {\n extractModuleBundleContent,\n extractModuleBundleName,\n} from './build-output-data-extractor.js';\nimport type { DevCenterComponent } from '../dev-center/components/dev-center-component.js';\n\ntype DashboardSource =\n | {\n iframeUrl: string;\n scriptAsset?: never;\n }\n | {\n scriptAsset: ComponentSource['scriptAsset'];\n iframeUrl?: never;\n };\ntype EmbeddedScriptSource = {\n template: string;\n};\ntype CustomElementSource = { scriptUrl: string; settingsUrl: string };\n\nexport type ComponentSourceBuilder = <T extends DevCenterComponent>(\n component: T\n) => Promise<\n T extends DevCenterComponent<'EmbeddedScript'>\n ? EmbeddedScriptSource\n : T extends DevCenterComponent<'CustomElement'>\n ? CustomElementSource\n : T extends DevCenterComponent<'DashboardPage'>\n ? DashboardSource\n : T extends DevCenterComponent<'DashboardPlugin'>\n ? DashboardSource\n : T extends DevCenterComponent<'DashboardModal'>\n ? DashboardSource\n : undefined\n>;\n\nasync function getEmbeddedScriptDevTemplate(\n component: DevCenterComponent<'EmbeddedScript'>,\n devServerUrl?: string\n) {\n const url = new URL(component.relativePath, devServerUrl).href;\n const devTemplate = await fetch(url).then((res) => res.text());\n\n return devTemplate;\n}\n\nconst dashboardSourceBuilder = (\n component:\n | DevCenterComponent<'DashboardPage'>\n | DevCenterComponent<'DashboardPlugin'>\n | DevCenterComponent<'DashboardModal'>,\n model: ProjectModel,\n buildOutput?: ViteBuildOutput\n): DashboardSource => {\n if (!model.config.trusted) {\n return {\n iframeUrl: virtualPathForHTMLAsset(component.id),\n };\n }\n const moduleId = virtualModuleIdForScriptAsset(component.id);\n const componentUrl = buildOutput\n ? extractModuleBundleName(buildOutput, moduleId)\n : `/@id/${moduleId}?import`;\n\n return {\n scriptAsset: {\n exportedName: component.id,\n containerId: model.config.appId,\n url: componentUrl,\n scriptType: BackOfficeScriptAssetType.MODULE,\n },\n };\n};\n\nconst embeddedScriptBuilder = async (\n component: DevCenterComponent<'EmbeddedScript'>,\n buildOutput?: ViteBuildOutput,\n devServerUrl?: string\n): Promise<EmbeddedScriptSource> => {\n return {\n template: buildOutput\n ? extractModuleBundleContent(buildOutput, component.relativePath)\n : await getEmbeddedScriptDevTemplate(component, devServerUrl),\n };\n};\n\nconst customElementBuilder = (\n component: DevCenterComponent<'CustomElement'>,\n buildOutput?: ViteBuildOutput\n): CustomElementSource => {\n const moduleId = virtualModuleIdForCustomElementScriptAsset(component.id);\n const componentUrl = buildOutput\n ? extractModuleBundleName(buildOutput, moduleId)\n : `/@id/${moduleId}?import`;\n\n return {\n scriptUrl: componentUrl,\n settingsUrl: virtualPathForCustomElementPanelHTMLAsset(component.id),\n };\n};\n\nexport function getComponentSourceBuilder({\n model,\n buildOutput,\n devServerUrl,\n}: {\n model: ProjectModel;\n buildOutput?: ViteBuildOutput;\n devServerUrl?: string;\n}) {\n return (async (component: DevCenterComponent) => {\n const source = match(component, {\n EmbeddedScript: (embeddedScriptComponent) =>\n embeddedScriptBuilder(\n embeddedScriptComponent,\n buildOutput,\n devServerUrl\n ),\n DashboardSidebarCategory: () => {},\n CustomElement: (customElementComponent) =>\n customElementBuilder(customElementComponent, buildOutput),\n DashboardPage: (dashboardPageComponent) =>\n dashboardSourceBuilder(dashboardPageComponent, model, buildOutput),\n DashboardPlugin: (dashboardPluginComponent) =>\n dashboardSourceBuilder(dashboardPluginComponent, model, buildOutput),\n DashboardModal: (dashboardModalComponent) =>\n dashboardSourceBuilder(dashboardModalComponent, model, buildOutput),\n DashboardMenuPlugin: () => {},\n });\n\n return source;\n }) as ComponentSourceBuilder;\n}\n","import { CliError, CliErrorCode } from '@wix/cli-error';\nimport type { build } from 'vite';\n\nexport type ViteBuildOutput = Awaited<ReturnType<typeof build>>;\n\nfunction extractBuildOutputs(buildOutput: ViteBuildOutput) {\n const isValidRollupOutput =\n 'output' in buildOutput || Array.isArray(buildOutput);\n\n if (!isValidRollupOutput) {\n throw new CliError({ code: CliErrorCode.InvalidViteBuildOutput() });\n }\n\n const outputs = Array.isArray(buildOutput)\n ? buildOutput.flatMap((output) => output.output)\n : buildOutput.output;\n\n return outputs;\n}\n\nexport function extractModuleBundleName(\n buildOutput: ViteBuildOutput,\n moduleId: string\n) {\n const outputs = extractBuildOutputs(buildOutput);\n\n const output = outputs.find(\n (output) => output.type === 'chunk' && output.facadeModuleId === moduleId\n );\n\n if (!output) {\n throw new CliError({ code: CliErrorCode.ViteModuleBundleNotFound() });\n }\n\n return output.fileName;\n}\n\nexport function extractModuleBundleContent(\n buildOutput: ViteBuildOutput,\n fileName: string\n) {\n const outputs = extractBuildOutputs(buildOutput);\n\n const output = outputs.find((output) => output.fileName === fileName);\n\n if (!output || !('source' in output)) {\n throw new CliError({\n code: CliErrorCode.ViteFileNotFoundInOutput({ fileName }),\n });\n }\n\n return output.source.toString();\n}\n"],"mappings":";;mOAAAA,IACA,IAAAC,EAAsB,SADtB,OAAS,cAAAC,MAAkB,cAOpB,IAAMC,EAAsBC,GAAqC,CACtE,IAAMC,EACJ,IAAI,IACuB,CAAC,GAAGD,CAAU,EAAE,KAAK,CAACE,EAAGC,IACpDD,EAAE,GAAG,cAAcC,EAAE,EAAE,CACzB,EACqB,QAASC,GAAc,CAC1C,IAAMC,EAAgBJ,EAA2B,IAAIG,EAAU,EAAE,GAAK,CAAC,EACvEC,EAAc,KAAKD,CAAS,EAC5BH,EAA2B,IAAIG,EAAU,GAAIC,CAAa,CAC5D,CAAC,EAED,IAAMC,EACJ,IAAI,IAQN,GANAL,EAA2B,QAAQ,CAACM,EAAqBC,IAAQ,CAC3DD,EAAoB,OAAS,GAC/BD,EAAiC,IAAIE,EAAKD,CAAmB,CAEjE,CAAC,EAEGD,EAAiC,KACnC,MAAM,IAAIG,EAAS,CACjB,KAAMC,EAAa,2BAA2B,CAC5C,OAAQ,MAAM,KAAKJ,EAAiC,QAAQ,CAAC,EAAE,IAC7D,CAAC,CAACK,EAAIJ,CAAmB,KAChB,CACL,GAAAI,EACA,WAAYJ,EACT,IAAKH,MACJ,SAAMA,EAAW,CACf,cAAe,CAAC,CAAE,MAAAQ,EAAO,aAAAC,CAAa,KAAO,CAC3C,KAAMD,EACN,KAAM,OACN,KAAME,EAA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","names":["init_esm_shims","import_variant","randomUUID","validateComponents","components","devCenterComponentsToIdMap","a","b","component","componentList","devCenterComponentsWithSameIDMap","devCenterComponents","key","CliError","CliErrorCode","id","title","relativePath","replaceExtension","label","CONFIG_FILENAME","name","randomUUID","init_esm_shims","import_variant","getExperiment","component","appId","createAppManifest","components","sentryDSN","componentSourceBuilder","validateComponents","componentSentryDSN","ComponentType","BackOfficeHostingPlatforms","EmbeddedScriptPages","scriptUrl","settingsUrl","CustomElementScriptType","HeightMode","RegionType","init_esm_shims","import_variant","init_esm_shims","extractBuildOutputs","buildOutput","CliError","CliErrorCode","output","extractModuleBundleName","moduleId","extractModuleBundleContent","fileName","getEmbeddedScriptDevTemplate","component","devServerUrl","url","res","dashboardSourceBuilder","model","buildOutput","virtualPathForHTMLAsset","moduleId","virtualModuleIdForScriptAsset","componentUrl","extractModuleBundleName","BackOfficeScriptAssetType","embeddedScriptBuilder","extractModuleBundleContent","customElementBuilder","virtualModuleIdForCustomElementScriptAsset","virtualPathForCustomElementPanelHTMLAsset","getComponentSourceBuilder","embeddedScriptComponent","customElementComponent","dashboardPageComponent","dashboardPluginComponent","dashboardModalComponent"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as _createRequire } from 'node:module';
|
|
2
|
+
const require = _createRequire(import.meta.url);
|
|
3
|
+
import{a as C}from"./chunk-6VY5XPWN.js";import{a as g,b as R,d as l,g as O,r as W}from"./chunk-TXD4M2YS.js";import{A as V,e as U,g as j,q as z,s as H}from"./chunk-V4D26EXO.js";import{H as D,K as $,e as E,f as M,g as J,qa as k}from"./chunk-HFEDL4QC.js";import{a as q,c as u,d as v,h as m,i as x}from"./chunk-62RRZRN6.js";import{e as T,h as a}from"./chunk-HFDLXX7R.js";a();a();var ae={},oe={};var ie={},pe={},ne={},me={};function I(t){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 R(Object.assign(t,{domainToMappings:e}))}function Q(t){var e=l(ae,{}),r=e.toJSON,s=e.fromJSON,i=l(oe,{}).fromJSON;function o(d){var f=d.host,c=r(t),h={entityFqdn:"wix.ctp.gradual_rollout.v1.app_config",method:"POST",methodFqn:"com.wix.ctp.AppsReleaseManagerService.CreateAppRelease",url:I({protoPath:"/apps/create/{appId}",data:c,host:f}),data:c,transformResponse:i};return h}return o.fromReq=s,o.__isAmbassador=!0,o}function G(t){var e=l(ne,{}),r=e.toJSON,s=e.fromJSON,i=l(me,{}).fromJSON;function o(d){var f=d.host,c=r(t),h={entityFqdn:"wix.ctp.gradual_rollout.v1.app_config",method:"PUT",methodFqn:"com.wix.ctp.AppsReleaseManagerService.UpdateAppRelease",url:I({protoPath:"/apps/tags/{tag}",data:c,host:f}),data:c,transformResponse:i};return h}return o.fromReq=s,o.__isAmbassador=!0,o}function B(t){var e=l(ie,{}),r=e.toJSON,s=e.fromJSON,i=l(pe,{}).fromJSON;function o(d){var f=d.host,c=r(t),h={entityFqdn:"wix.ctp.gradual_rollout.v1.app_config",method:"POST",methodFqn:"com.wix.ctp.AppsReleaseManagerService.PromoteAppReleaseToDevCenter",url:I({protoPath:"/apps/promote/{appId}/{tag}",data:c,host:f}),data:c,transformResponse:i};return h}return o.fromReq=s,o.__isAmbassador=!0,o}var P=T(q(),1);a();var K=m.object({newVersion:m.string()}),X=m.object({tag:m.string()});var{AppPermissionDenied:Y}=v,Z=(0,P.variant)({TagUpdated:{},TagNotFound:(0,P.fields)()}),S=class{constructor(e){this.httpClient=e;let{minRetryTimeout:r}=x();this.retryOptions={retries:3,minTimeout:r,maxTimeout:3*1e3}}retryOptions;createAppRelease=async(e,r)=>{try{let{data:s}=await g(()=>this.httpClient.request(Q({appId:e.appId,componentConfigs:e.components,projectId:r})),this.retryOptions);return X.parse(s).tag}catch(s){throw O(s)&&s.response?.status===403?new u({code:Y({appId:e.appId}),cause:s}):new u({code:v.FailedToCreateAppRelease(),cause:s})}};updateAppRelease=async(e,r)=>{try{return await g(()=>this.httpClient.request(G({appId:e.appId,componentConfigs:e.components,tag:r})),this.retryOptions),Z.TagUpdated()}catch(s){if(O(s)){if(s.response?.status===404)return Z.TagNotFound({cause:s});if(s.response?.status===403)throw new u({code:Y({appId:e.appId}),cause:s})}throw new u({code:v.FailedToUpdateAppRelease(),cause:s})}};promoteToDevCenter=async(e,r,s)=>{let{data:i}=await g(()=>this.httpClient.request(B({appId:e,tag:r,versionType:s})),this.retryOptions);return K.parse(i)}};a();import{useMemo as ce}from"react";function de(){let t=C({type:"backoffice"});return ce(()=>new S(t),[t])}a();a();import le,{useContext as ue,createContext as fe}from"react";var ee=fe(null),Be=({children:t,armTag:e})=>le.createElement(ee.Provider,{value:{armTag:e}},t),te=()=>{let t=ue(ee);if(t===null)throw new Error("useArmTag() cannot be used without an <ArmTagProvider>");return t};a();a();var he={},ge={sites:"_site"},ve={createdDate:"google.protobuf.Timestamp",updatedDate:"google.protobuf.Timestamp",trashedDate:"google.protobuf.Timestamp"};function Se(t){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"}],"wixbo.ai":[{srcPath:"/_api/sites-list/v2/sites",destPath:"/v2/sites"}],"dev._base_domain_":[{srcPath:"/_api/sites-list/v2/sites",destPath:"/v2/sites"}],"editor._base_domain_":[{srcPath:"/_api/sites-list/v2/sites",destPath:"/v2/sites"}],"blocks._base_domain_":[{srcPath:"/_api/sites-list/v2/sites",destPath:"/v2/sites"}],"create.editorx":[{srcPath:"/_api/sites-list/v2/sites",destPath:"/v2/sites"}]};return R(Object.assign(t,{domainToMappings:e}))}function N(t){var e=l(he,{}),r=e.toJSON,s=e.fromJSON,i=l(ge,{_site:ve}).fromJSON;function o(d){var f=d.host,c=r(t),h={entityFqdn:"wix.site_list.v2.site",method:"POST",methodFqn:"com.wixpress.sitelist.api.SiteListServiceV2.QuerySites",url:Se({protoPath:"/v2/sites/query",data:c,host:f}),data:c,transformResponse:i};return h}return o.fromReq=s,o.__isAmbassador=!0,o}a();var _e=m.object({id:m.string(),displayName:m.string(),viewUrl:m.union([m.string().url(),m.literal("")]).optional()}),F=m.object({sites:m.array(_e)});var _=class{constructor(e){this.httpClient=e;let{minRetryTimeout:r}=x();this.retryOptions={retries:3,minTimeout:r,maxTimeout:3*1e3}}retryOptions;querySites=async(e={})=>{try{let{data:r}=await g(()=>this.httpClient.request(N(e)),this.retryOptions);return F.parse(r).sites}catch(r){throw new u({code:v.FailedToQuerySites(),cause:r,info:{...e}})}};getSite=async e=>{try{let{data:r}=await g(()=>this.httpClient.request(N({query:{filter:{id:{$in:[e]}}}})),this.retryOptions),{sites:s}=F.parse(r);return s.at(0)??null}catch(r){throw new u({code:v.FailedToGetSite(),cause:r,info:{id:e}})}}};a();import{useMemo as ye}from"react";function we(){let t=C({type:"backoffice"});return ye(()=>new _(t),[t])}a();a();async function L(t,e){let r=D(t);if(!await J(r))return null;try{let i=await M(r),o=await $.safeParseAsync(i);return o.success?o.data:null}catch(i){return e?.(i),null}}async function xt(t,e){let s={...await L(t)??{},...e};await E(D(t),s)}a();import{createContext as Re}from"react";var re=Re(null);a();var y=T(q(),1),A=(0,y.variant)({NotConfigured:{},NotFound:(0,y.fields)(),Resolved:(0,y.fields)()});a();async function Nt({projectFolder:t,siteListClient:{getSite:e},siteId:r,writeDebugLog:s}){let i=r||(await L(t,s))?.siteId;if(!i)return A.NotConfigured();let o=await e(i);return o?A.Resolved({site:o}):A.NotFound({id:i})}a();import{useContext as xe}from"react";function se(){let t=xe(re);if(t===null)throw new Error("useSiteId() cannot be used without an <SiteIdProvider>");return t}a();import w from"react";var b=T(q(),1);function Qt(){let{model:t}=k(),{site:e}=se(),{armTag:r}=te();return{appId:t.config.appId,site:e,tag:r}}function Gt({envConfig:t,platformType:e,siteOverrideId:r}){let{site:s,tag:i}=t,o=(0,b.match)(e,{Dashboard:()=>new URL(`dashboard/${s.id}`,"https://manage.wix.com/"),Editor:()=>new URL(`https://wix.com/editor/${s.id}`),Site:()=>{let d=new URL(s.viewUrl);return r&&d.searchParams.append("site-override",r),d}});return o.searchParams.append("apps-override",i),o.toString()}function Bt({envConfig:t,extension:e}){let{appId:r,site:s,tag:i}=t,o=(0,b.matcher)(e).with({DashboardPage:()=>new URL(`dashboard/${s.id}/app/${r}${e.route}`,"https://manage.wix.com/")}).when(["DashboardMenuPlugin","DashboardPlugin","DashboardModal"],()=>new URL(`dashboard/${s.id}${e.route}`,"https://manage.wix.com/")).complete();return o.searchParams.append("apps-override",i),o.toString()}var Kt=async({url:t,title:e},r)=>{try{await W(t)}catch{r({type:"error",prefix:"app",msg:w.createElement(z,{type:"error"},w.createElement(V,{i18nKey:"general.open_page_error",components:[w.createElement(j,{bold:!0})],values:{title:e}}),w.createElement(U,null),w.createElement(H,{url:t}))})}};export{_ as a,we as b,L as c,xt as d,re as e,A as f,Nt as g,S as h,de as i,Be as j,se as k,Qt as l,Gt as m,Bt as n,Kt as o};
|
|
4
|
+
//# sourceMappingURL=chunk-JRUKA4BX.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","../../arm-client/src/index.ts","../src/context/armTag.tsx","../../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/context.ts","../src/site-id/site-id-state.ts","../src/site-id/resolve-configured-site.ts","../src/site-id/useSiteId.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 { ARMClient } from './client.js';\nexport { useARMClient } from './useARMClient.js';\n","import React, {\n useContext,\n createContext,\n type FC,\n type ReactNode,\n} from 'react';\n\ntype ArmTag = {\n armTag: string;\n};\n\nexport const ArmTagContext = createContext<ArmTag | null>(null);\n\nexport const ArmTagProvider: FC<{ children: ReactNode; armTag: string }> = ({\n children,\n armTag,\n}) => {\n return (\n <ArmTagContext.Provider value={{ armTag }}>\n {children}\n </ArmTagContext.Provider>\n );\n};\n\nexport const useArmTag = () => {\n const context = useContext(ArmTagContext);\n\n if (context === null) {\n throw new Error('useArmTag() cannot be used without an <ArmTagProvider>');\n }\n\n return context;\n};\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 { createContext } from 'react';\nimport type { Site } from '@wix/site-list-client';\n\nexport type SiteIdState = {\n site: Site;\n setSite: (site: Site) => Promise<void>;\n};\n\nexport const SiteIdContext = createContext<SiteIdState | null>(null);\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 { useContext } from 'react';\nimport { SiteIdContext, type SiteIdState } from './context.js';\n\nexport function useSiteId(): SiteIdState {\n const context = useContext(SiteIdContext);\n if (context === null) {\n throw new Error('useSiteId() cannot be used without an <SiteIdProvider>');\n }\n return context;\n}\n","import React from 'react';\nimport { Trans } from '@wix/cli-i18n';\nimport { matcher, match } from 'variant';\nimport { openBrowser } from '@wix/user-browser';\nimport type { Site } from '@wix/site-list-client';\nimport { Alert, Link, Text, Newline } from '@wix/cli-ui-kit';\nimport type { PlatformType } from '@wix/cli-app-definitions';\nimport type { WriteLogFn } from '../DevCommand/devEnvLogs/useDevEnvLogs.js';\nimport { useProjectModel } from '../../model.js';\nimport { useSiteId } from '../../site-id/useSiteId.js';\nimport { useArmTag } from '../../context/armTag.js';\nimport type { DevCenterComponent } from '../../dev-center/components/dev-center-component.js';\nimport type { DashboardExtension } from './useExtensions.js';\n\nexport type EnvConfig = {\n site: Site;\n appId: string;\n tag: string;\n};\n\nexport function useEnvConfig(): EnvConfig {\n const { model } = useProjectModel();\n const { site } = useSiteId();\n const { armTag } = useArmTag();\n\n return {\n appId: model.config.appId,\n site,\n tag: armTag,\n };\n}\n\nexport function resolvePlatformUrl({\n envConfig,\n platformType,\n siteOverrideId,\n}: {\n envConfig: EnvConfig;\n platformType: PlatformType;\n siteOverrideId?: string;\n}) {\n const { site, tag } = envConfig;\n const url = match(platformType, {\n Dashboard: () => new URL(`dashboard/${site.id}`, 'https://manage.wix.com/'),\n Editor: () => new URL(`https://wix.com/editor/${site.id}`),\n Site: () => {\n const siteUrl = new URL(site.viewUrl!);\n if (siteOverrideId) {\n siteUrl.searchParams.append('site-override', siteOverrideId);\n }\n return siteUrl;\n },\n });\n url.searchParams.append('apps-override', tag);\n return url.toString();\n}\n\nexport function resolveDashboardExtensionUrl({\n envConfig,\n extension,\n}: {\n envConfig: EnvConfig;\n extension: DevCenterComponent<DashboardExtension>;\n}) {\n const { appId, site, tag } = envConfig;\n\n const url = matcher(extension)\n .with({\n DashboardPage: () =>\n new URL(\n `dashboard/${site.id}/app/${appId}${extension.route}`,\n 'https://manage.wix.com/'\n ),\n })\n .when(\n ['DashboardMenuPlugin', 'DashboardPlugin', 'DashboardModal'],\n () =>\n new URL(\n `dashboard/${site.id}${extension.route}`,\n 'https://manage.wix.com/'\n )\n )\n .complete();\n\n url.searchParams.append('apps-override', tag);\n\n return url.toString();\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":";;6SAAAA,ICWAC,IAIA,IAAMC,GAA2B,CAAA,EAC3BC,GAA4B,CAAA,EAGlC,IAAMC,GAAuC,C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,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","useARMClient","httpClient","useHttpClient","useMemo","ARMClient","init_esm_shims","init_esm_shims","React","useContext","createContext","ArmTagContext","ArmTagProvider","children","armTag","useArmTag","context","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","createContext","SiteIdContext","init_esm_shims","import_variant","SiteIdState","init_esm_shims","resolveConfiguredSite","projectFolder","getSite","siteId","writeDebugLog","resolvedSiteId","readAppConfig","SiteIdState","site","init_esm_shims","useContext","useSiteId","context","useContext","SiteIdContext","init_esm_shims","React","import_variant","useEnvConfig","model","useProjectModel","site","useSiteId","armTag","useArmTag","resolvePlatformUrl","envConfig","platformType","siteOverrideId","tag","url","siteUrl","resolveDashboardExtensionUrl","extension","appId","openPage","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","../../arm-client/src/index.ts","../src/context/armTag.tsx","../../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/context.ts","../src/site-id/site-id-state.ts","../src/site-id/resolve-configured-site.ts","../src/site-id/useSiteId.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 { ARMClient } from './client.js';\nexport { useARMClient } from './useARMClient.js';\n","import React, {\n useContext,\n createContext,\n type FC,\n type ReactNode,\n} from 'react';\n\ntype ArmTag = {\n armTag: string;\n};\n\nexport const ArmTagContext = createContext<ArmTag | null>(null);\n\nexport const ArmTagProvider: FC<{ children: ReactNode; armTag: string }> = ({\n children,\n armTag,\n}) => {\n return (\n <ArmTagContext.Provider value={{ armTag }}>\n {children}\n </ArmTagContext.Provider>\n );\n};\n\nexport const useArmTag = () => {\n const context = useContext(ArmTagContext);\n\n if (context === null) {\n throw new Error('useArmTag() cannot be used without an <ArmTagProvider>');\n }\n\n return context;\n};\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 { createContext } from 'react';\nimport type { Site } from '@wix/site-list-client';\n\nexport type SiteIdState = {\n site: Site;\n setSite: (site: Site) => Promise<void>;\n};\n\nexport const SiteIdContext = createContext<SiteIdState | null>(null);\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 { useContext } from 'react';\nimport { SiteIdContext, type SiteIdState } from './context.js';\n\nexport function useSiteId(): SiteIdState {\n const context = useContext(SiteIdContext);\n if (context === null) {\n throw new Error('useSiteId() cannot be used without an <SiteIdProvider>');\n }\n return context;\n}\n","import React from 'react';\nimport { Trans } from '@wix/cli-i18n';\nimport { matcher, match } from 'variant';\nimport { openBrowser } from '@wix/user-browser';\nimport type { Site } from '@wix/site-list-client';\nimport { Alert, Link, Text, Newline } from '@wix/cli-ui-kit';\nimport type { PlatformType } from '@wix/cli-app-definitions';\nimport type { WriteLogFn } from '../DevCommand/devEnvLogs/useDevEnvLogs.js';\nimport { useProjectModel } from '../../model.js';\nimport { useSiteId } from '../../site-id/useSiteId.js';\nimport { useArmTag } from '../../context/armTag.js';\nimport type { DevCenterComponent } from '../../dev-center/components/dev-center-component.js';\nimport type { DashboardExtension } from './useExtensions.js';\n\nexport type EnvConfig = {\n site: Site;\n appId: string;\n tag: string;\n};\n\nexport function useEnvConfig(): EnvConfig {\n const { model } = useProjectModel();\n const { site } = useSiteId();\n const { armTag } = useArmTag();\n\n return {\n appId: model.config.appId,\n site,\n tag: armTag,\n };\n}\n\nexport function resolvePlatformUrl({\n envConfig,\n platformType,\n siteOverrideId,\n}: {\n envConfig: EnvConfig;\n platformType: PlatformType;\n siteOverrideId?: string;\n}) {\n const { site, tag } = envConfig;\n const url = match(platformType, {\n Dashboard: () => new URL(`dashboard/${site.id}`, 'https://manage.wix.com/'),\n Editor: () => new URL(`https://wix.com/editor/${site.id}`),\n Site: () => {\n const siteUrl = new URL(site.viewUrl!);\n if (siteOverrideId) {\n siteUrl.searchParams.append('site-override', siteOverrideId);\n }\n return siteUrl;\n },\n });\n url.searchParams.append('apps-override', tag);\n return url.toString();\n}\n\nexport function resolveDashboardExtensionUrl({\n envConfig,\n extension,\n}: {\n envConfig: EnvConfig;\n extension: DevCenterComponent<DashboardExtension>;\n}) {\n const { appId, site, tag } = envConfig;\n\n const url = matcher(extension)\n .with({\n DashboardPage: () =>\n new URL(\n `dashboard/${site.id}/app/${appId}${extension.route}`,\n 'https://manage.wix.com/'\n ),\n })\n .when(\n ['DashboardMenuPlugin', 'DashboardPlugin', 'DashboardModal'],\n () =>\n new URL(\n `dashboard/${site.id}${extension.route}`,\n 'https://manage.wix.com/'\n )\n )\n .complete();\n\n url.searchParams.append('apps-override', tag);\n\n return url.toString();\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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AAK,KAAI,GAAC,CAAE,EAC1B,OAAQ,CAAE,MAAAN,CAAM,EAClB,EACAG,EAAA,cAACI,EAAA,IAAQ,EACTJ,EAAA,cAACK,EAAA,CAAK,IAAKd,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","useARMClient","httpClient","useHttpClient","useMemo","ARMClient","init_esm_shims","init_esm_shims","React","useContext","createContext","ArmTagContext","ArmTagProvider","children","armTag","useArmTag","context","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","createContext","SiteIdContext","init_esm_shims","import_variant","SiteIdState","init_esm_shims","resolveConfiguredSite","projectFolder","getSite","siteId","writeDebugLog","resolvedSiteId","readAppConfig","SiteIdState","site","init_esm_shims","useContext","useSiteId","context","useContext","SiteIdContext","init_esm_shims","React","import_variant","useEnvConfig","model","useProjectModel","site","useSiteId","armTag","useArmTag","resolvePlatformUrl","envConfig","platformType","siteOverrideId","tag","url","siteUrl","resolveDashboardExtensionUrl","extension","appId","openPage","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{m as c,n as s}from"./chunk-TXD4M2YS.js";import{c as E}from"./chunk-V4D26EXO.js";import{e as p,f as l}from"./chunk-62RRZRN6.js";import{e as C,h as i}from"./chunk-HFDLXX7R.js";i();import{randomUUID as S}from"node:crypto";function _(r,e){r.updateDefaults(v(e))}function v(r){return r?{_client_id:r,_uuid:r,logged_user_id:r,logged_account_id:r,target_account_id:r}:{_client_id:S()}}i();import{uptime as V}from"node:process";i();var f=C(E(),1);import U from"node:os";import{platform as k,version as L}from"node:process";function d({cliVersion:r,flow:e}){return{...e?{flow:e}:{},cliVersion:r,isCI:f.default,nodeVersion:L,osName:N(),osVersion:U.release()}}function N(){switch(k){case"darwin":return"mac";case"win32":return"windows";default:return"linux"}}var u=()=>Math.round(V()*1e3);function B({biLogger:r,command:e,flow:w,cliVersion:x,projectId:g,extensions:t}){let n={command:e.name(),arguments:e.args.join(",")??"",flags:Object.keys(e.opts()).join(",")};return r.report(c({...d({cliVersion:x,flow:w}),...n,...g?{projectId:g}:{},isValid:!0})),{succeed(){r.report(s({...n,...t?{extensions:JSON.stringify(t)}:{},duration:u(),isSuccess:!0,isValid:!0}))},failed(o){let y=p(o)?{errorType:l(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(s({...n,...y,...t?{extensions:JSON.stringify(t)}:{},duration:u(),isSuccess:!1,isValid:!0}))}}}i();export{_ as a,B as b};
|
|
4
|
+
//# sourceMappingURL=chunk-KDEP6ACN.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 projectId,\n extensions,\n}: {\n biLogger: BiLogger;\n command: CommandLike;\n flow: 'Apps' | 'Sites' | null;\n cliVersion: string;\n projectId?: string;\n extensions?: Record<string, number>;\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 ...(projectId ? { projectId } : {}),\n isValid: true,\n })\n );\n\n return {\n succeed() {\n biLogger.report(\n wixCliCliCommandStatus({\n ...commandFields,\n ...(extensions ? { extensions: JSON.stringify(extensions) } : {}),\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 ...(extensions ? { extensions: JSON.stringify(extensions) } : {}),\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":";;
|
|
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 projectId,\n extensions,\n}: {\n biLogger: BiLogger;\n command: CommandLike;\n flow: 'Apps' | 'Sites' | null;\n cliVersion: string;\n projectId?: string;\n extensions?: Record<string, number>;\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 ...(projectId ? { projectId } : {}),\n isValid: true,\n })\n );\n\n return {\n succeed() {\n biLogger.report(\n wixCliCliCommandStatus({\n ...commandFields,\n ...(extensions ? { extensions: JSON.stringify(extensions) } : {}),\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 ...(extensions ? { extensions: JSON.stringify(extensions) } : {}),\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":";;qLAAAA,IAAA,OAAS,cAAAC,MAAkB,cAGpB,SAASC,EAAcC,EAAkBC,EAAgB,CAC9DD,EAAO,eAAeE,EAAkBD,CAAM,CAAC,CACjD,CAEO,SAASC,EAAkBD,EAAyC,CACzE,OAAKA,EAOE,CACL,WAAYA,EACZ,MAAOA,EACP,eAAgBA,EAChB,kBAAmBA,EACnB,kBAAmBA,CACrB,EAXS,CACL,WAAYH,EAAW,CACzB,CAUJ,CCtBAK,IAMA,OAAS,UAAAC,MAAc,eCNvBC,IAEA,IAAAC,EAAiB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ACE,UAAW,eACX,UAAWA,EAAM,KACjB,aAAcA,EAAM,OACtB,EACA,CACE,UAAW,eACX,aAAc,KAAK,UAAUA,CAAK,CACpC,EAEJV,EAAS,OACPS,EAAuB,CACrB,GAAGH,EACH,GAAGK,EACH,GAAIN,EAAa,CAAE,WAAY,KAAK,UAAUA,CAAU,CAAE,EAAI,CAAC,EAC/D,SAAUR,EAAY,EACtB,UAAW,GACX,QAAS,EACX,CAAC,CACH,CACF,CACF,CACF,CEzFAiB","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","projectId","extensions","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 L,b as N}from"./chunk-PBVA37S6.js";import{b as h}from"./chunk-RZD2Z3NM.js";import{a as M}from"./chunk-VPVMEECP.js";import{b}from"./chunk-ZHOPW26J.js";import{i as k,j as U,k as j}from"./chunk-JRUKA4BX.js";import{a as I}from"./chunk-6VY5XPWN.js";import{l as E}from"./chunk-TXD4M2YS.js";import{A as F,B as _,d as i,i as C,q as y,t as A,w as T,x as u}from"./chunk-V4D26EXO.js";import{b as S}from"./chunk-NCLWI32Y.js";import{qa as B}from"./chunk-HFEDL4QC.js";import{a as x}from"./chunk-62RRZRN6.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(F,{i18nKey:"general.dev_site.current",values:{name:e.displayName}})),n.createElement(i,{rowGap:1},n.createElement(L,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}=_(),{model:a}=B(),K=k(),V=E(),W=I({type:"backoffice"}),g=u(()=>M(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-KOTYDSCW.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":";;
|
|
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":";;yiBAAAA,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,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AA,cAACE,EAAA,CACC,OAAQhB,EAAwB,OAChC,YAAaV,EAAE,iCAAiC,EAChD,YAAaA,EAAE,yCAAyC,EAC1D,EACAwB,EAAA,cAACE,EAAA,CACC,OAAQb,EAAU,OAClB,YAAab,EAAE,kCAAkC,EACjD,YAAaA,EAAE,0CAA0C,EAC3D,CACF,KACC,SAAMoB,EAAc,OAAQ,CAC3B,MAAO,IAAM,KACb,QAAS,IAAM,KACf,QAAS,CAAC,CAAE,OAAQ,CAAE,OAAAG,EAAQ,UAAAR,CAAU,CAAE,IACxCS,EAAA,cAAC9B,EAA0B,SAA1B,CAAmC,MAAO,CAAE,UAAAqB,CAAU,GACrDS,EAAA,cAACG,EAAA,CAAe,OAAQJ,GAAS1B,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 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"@wix/cli-app\",\n \"description\": \"CLI tool for Wix apps\",\n \"version\": \"1.1.
|
|
1
|
+
{"version":3,"sources":["../package.json"],"sourcesContent":["{\n \"name\": \"@wix/cli-app\",\n \"description\": \"CLI tool for Wix apps\",\n \"version\": \"1.1.15\",\n \"author\": \"Amit Dahan\",\n \"dependencies\": {\n \"vite\": \"5.2.10\"\n },\n \"devDependencies\": {\n \"@commander-js/extra-typings\": \"^12.0.1\",\n \"@types/lodash\": \"^4.17.0\",\n \"@types/mustache\": \"^4.2.5\",\n \"@wix/ambassador-cli-site-override-service-v1-site-override\": \"^1.0.4\",\n \"@wix/ambassador-ctp-app-cloud-deployer-service-v1-app-cloud-deployer\": \"^1.0.17\",\n \"@wix/ambassador-ctp-gradual-rollout-v1-app-config\": \"^1.0.64\",\n \"@wix/ambassador-devcenter-components-v1-component\": \"^1.0.376\",\n \"@wix/arm-client\": \"workspace:*\",\n \"@wix/bi-logger-wix-cli\": \"^1.37.0\",\n \"@wix/cli-app-definitions\": \"workspace:*\",\n \"@wix/cli-app-manifest\": \"workspace:*\",\n \"@wix/cli-auth\": \"workspace:*\",\n \"@wix/cli-command-contract\": \"workspace:*\",\n \"@wix/cli-core-definitions\": \"workspace:*\",\n \"@wix/cli-debug-log\": \"workspace:*\",\n \"@wix/cli-error\": \"workspace:*\",\n \"@wix/cli-error-reporting\": \"workspace:*\",\n \"@wix/cli-fs\": \"workspace:*\",\n \"@wix/cli-http-client\": \"workspace:*\",\n \"@wix/cli-http-client-react\": \"workspace:*\",\n \"@wix/cli-i18n\": \"workspace:*\",\n \"@wix/cli-logger\": \"workspace:*\",\n \"@wix/cli-site-selector\": \"workspace:*\",\n \"@wix/cli-ssl\": \"workspace:*\",\n \"@wix/cli-telemetry\": \"workspace:*\",\n \"@wix/cli-telemetry-react\": \"workspace:*\",\n \"@wix/cli-test-overrides\": \"workspace:*\",\n \"@wix/cli-ui-kit\": \"workspace:*\",\n \"@wix/dev-center-client\": \"workspace:*\",\n \"@wix/extensions-data-client\": \"workspace:*\",\n \"@wix/gena\": \"workspace:*\",\n \"@wix/site-list-client\": \"workspace:*\",\n \"@wix/site-override-client\": \"workspace:*\",\n \"@wix/tsup-configs\": \"workspace:*\",\n \"@wix/user-browser\": \"workspace:*\",\n \"chalk\": \"^5.3.0\",\n \"chokidar\": \"^3.6.0\",\n \"commander\": \"^12.0.0\",\n \"fast-equals\": \"^5.0.1\",\n \"form-data\": \"^4.0.0\",\n \"globby\": \"^13.2.2\",\n \"lodash\": \"^4.17.21\",\n \"mustache\": \"^4.2.0\",\n \"p-retry\": \"^5.1.2\",\n \"p-wait-for\": \"^5.0.2\",\n \"prompts\": \"^2.4.2\",\n \"semver\": \"^7.6.0\",\n \"tempy\": \"^3.1.0\",\n \"typed-emitter\": \"^2.1.0\",\n \"variant\": \"^3.0.0-dev.27\",\n \"vite-plugin-externals\": \"^0.6.2\",\n \"zod\": \"^3.22.4\",\n \"zod-to-json-schema\": \"^3.22.4\"\n },\n \"engines\": {\n \"node\": \">= 18.16\"\n },\n \"exports\": {\n \".\": \"./build/index.js\",\n \"./client\": {\n \"types\": \"./client.d.ts\"\n },\n \"./internal/component-hmr-wrapper\": \"./internal/component-hmr-wrapper.tsx\",\n \"./tsconfig.app.json\": \"./tsconfig.app.json\",\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"build\",\n \"schemas\",\n \"tsconfig.app.json\",\n \"client.d.ts\",\n \"internal\",\n \"templates\"\n ],\n \"peerDependencies\": {\n \"react\": \"^16.14 || ^17 || ^18\",\n \"react-dom\": \"^16.14 || ^17 || ^18\"\n },\n \"peerDependenciesMeta\": {\n \"react-dom\": {\n \"optional\": true\n }\n },\n \"perfer\": {\n \"bundleSize\": {\n \"files\": [\n {\n \"glob\": \"./build/index.js\",\n \"maxSize\": \"460kb\"\n }\n ]\n }\n },\n \"publishConfig\": {\n \"registry\": \"https://registry.npmjs.org/\",\n \"access\": \"public\",\n \"versionBumpStrategy\": \"manual\",\n \"logLevel\": \"verbose\"\n },\n \"scripts\": {\n \"build\": \"run -T tsup && yarn generate-schemas\",\n \"build:watch\": \"run -T tsup --watch\",\n \"generate-schemas\": \"node build-scripts/generate-schemas.js\",\n \"lint\": \"run -T lint-package\",\n \"test\": \"yarn workspace @wix/cli-app-spec run test\",\n \"test:watch\": \"yarn workspace @wix/cli-app-spec run test:watch\",\n \"typecheck\": \"run -T tsc --noEmit\"\n },\n \"sideEffects\": false,\n \"type\": \"module\",\n \"wix\": {\n \"artifact\": {\n \"groupId\": \"com.wixpress.npm\",\n \"artifactId\": \"wix-cli-app\"\n },\n \"validations\": {\n \"postBuild\": [\n \"typecheck\",\n \"lint\"\n ]\n }\n }\n}\n"],"mappings":";;AAGE,IAAAA,EAAW","names":["version"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as _createRequire } from 'node:module';
|
|
2
2
|
const require = _createRequire(import.meta.url);
|
|
3
|
-
import{
|
|
3
|
+
import{G as Zs,P as eo,R as to,T as yi,U as un,V as mi,a as Xs,b as $s,ca as ro,da as io,ea as ao,ga as ln,ia as Ai,ja as Ci,ka as fn,la as no,ma as so}from"./chunk-HFEDL4QC.js";import{a as Ws,c as Gr,d as jr}from"./chunk-62RRZRN6.js";import{a as Le,c as F,e as ra,h as S}from"./chunk-HFDLXX7R.js";var Et=F(yn=>{"use strict";S();yn.fromCallback=function(e){return Object.defineProperty(function(...t){if(typeof t[t.length-1]=="function")e.apply(this,t);else return new Promise((i,r)=>{e.call(this,...t,(a,n)=>a!=null?r(a):i(n))})},"name",{value:e.name})};yn.fromPromise=function(e){return Object.defineProperty(function(...t){let i=t[t.length-1];if(typeof i!="function")return e.apply(this,t);e.apply(this,t.slice(0,-1)).then(r=>i(null,r),i)},"name",{value:e.name})}});var po=F((AA,ho)=>{"use strict";S();var hr=Le("constants"),hh=process.cwd,na=null,ph=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return na||(na=hh.call(process)),na};try{process.cwd()}catch{}typeof process.chdir=="function"&&(mn=process.chdir,process.chdir=function(e){na=null,mn.call(process,e)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,mn));var mn;ho.exports=dh;function dh(e){hr.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&t(e),e.lutimes||i(e),e.chown=n(e.chown),e.fchown=n(e.fchown),e.lchown=n(e.lchown),e.chmod=r(e.chmod),e.fchmod=r(e.fchmod),e.lchmod=r(e.lchmod),e.chownSync=s(e.chownSync),e.fchownSync=s(e.fchownSync),e.lchownSync=s(e.lchownSync),e.chmodSync=a(e.chmodSync),e.fchmodSync=a(e.fchmodSync),e.lchmodSync=a(e.lchmodSync),e.stat=o(e.stat),e.fstat=o(e.fstat),e.lstat=o(e.lstat),e.statSync=u(e.statSync),e.fstatSync=u(e.fstatSync),e.lstatSync=u(e.lstatSync),e.chmod&&!e.lchmod&&(e.lchmod=function(f,c,p){p&&process.nextTick(p)},e.lchmodSync=function(){}),e.chown&&!e.lchown&&(e.lchown=function(f,c,p,m){m&&process.nextTick(m)},e.lchownSync=function(){}),ph==="win32"&&(e.rename=typeof e.rename!="function"?e.rename:function(f){function c(p,m,v){var C=Date.now(),E=0;f(p,m,function B(w){if(w&&(w.code==="EACCES"||w.code==="EPERM"||w.code==="EBUSY")&&Date.now()-C<6e4){setTimeout(function(){e.stat(m,function(T,U){T&&T.code==="ENOENT"?f(p,m,B):v(w)})},E),E<100&&(E+=10);return}v&&v(w)})}return Object.setPrototypeOf&&Object.setPrototypeOf(c,f),c}(e.rename)),e.read=typeof e.read!="function"?e.read:function(f){function c(p,m,v,C,E,B){var w;if(B&&typeof B=="function"){var T=0;w=function(U,P,Q){if(U&&U.code==="EAGAIN"&&T<10)return T++,f.call(e,p,m,v,C,E,w);B.apply(this,arguments)}}return f.call(e,p,m,v,C,E,w)}return Object.setPrototypeOf&&Object.setPrototypeOf(c,f),c}(e.read),e.readSync=typeof e.readSync!="function"?e.readSync:function(f){return function(c,p,m,v,C){for(var E=0;;)try{return f.call(e,c,p,m,v,C)}catch(B){if(B.code==="EAGAIN"&&E<10){E++;continue}throw B}}}(e.readSync);function t(f){f.lchmod=function(c,p,m){f.open(c,hr.O_WRONLY|hr.O_SYMLINK,p,function(v,C){if(v){m&&m(v);return}f.fchmod(C,p,function(E){f.close(C,function(B){m&&m(E||B)})})})},f.lchmodSync=function(c,p){var m=f.openSync(c,hr.O_WRONLY|hr.O_SYMLINK,p),v=!0,C;try{C=f.fchmodSync(m,p),v=!1}finally{if(v)try{f.closeSync(m)}catch{}else f.closeSync(m)}return C}}function i(f){hr.hasOwnProperty("O_SYMLINK")&&f.futimes?(f.lutimes=function(c,p,m,v){f.open(c,hr.O_SYMLINK,function(C,E){if(C){v&&v(C);return}f.futimes(E,p,m,function(B){f.close(E,function(w){v&&v(B||w)})})})},f.lutimesSync=function(c,p,m){var v=f.openSync(c,hr.O_SYMLINK),C,E=!0;try{C=f.futimesSync(v,p,m),E=!1}finally{if(E)try{f.closeSync(v)}catch{}else f.closeSync(v)}return C}):f.futimes&&(f.lutimes=function(c,p,m,v){v&&process.nextTick(v)},f.lutimesSync=function(){})}function r(f){return f&&function(c,p,m){return f.call(e,c,p,function(v){l(v)&&(v=null),m&&m.apply(this,arguments)})}}function a(f){return f&&function(c,p){try{return f.call(e,c,p)}catch(m){if(!l(m))throw m}}}function n(f){return f&&function(c,p,m,v){return f.call(e,c,p,m,function(C){l(C)&&(C=null),v&&v.apply(this,arguments)})}}function s(f){return f&&function(c,p,m){try{return f.call(e,c,p,m)}catch(v){if(!l(v))throw v}}}function o(f){return f&&function(c,p,m){typeof p=="function"&&(m=p,p=null);function v(C,E){E&&(E.uid<0&&(E.uid+=4294967296),E.gid<0&&(E.gid+=4294967296)),m&&m.apply(this,arguments)}return p?f.call(e,c,p,v):f.call(e,c,v)}}function u(f){return f&&function(c,p){var m=p?f.call(e,c,p):f.call(e,c);return m&&(m.uid<0&&(m.uid+=4294967296),m.gid<0&&(m.gid+=4294967296)),m}}function l(f){if(!f||f.code==="ENOSYS")return!0;var c=!process.getuid||process.getuid()!==0;return!!(c&&(f.code==="EINVAL"||f.code==="EPERM"))}}});var yo=F((EA,vo)=>{"use strict";S();var go=Le("stream").Stream;vo.exports=gh;function gh(e){return{ReadStream:t,WriteStream:i};function t(r,a){if(!(this instanceof t))return new t(r,a);go.call(this);var n=this;this.path=r,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,a=a||{};for(var s=Object.keys(a),o=0,u=s.length;o<u;o++){var l=s[o];this[l]=a[l]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){n._read()});return}e.open(this.path,this.flags,this.mode,function(f,c){if(f){n.emit("error",f),n.readable=!1;return}n.fd=c,n.emit("open",c),n._read()})}function i(r,a){if(!(this instanceof i))return new i(r,a);go.call(this),this.path=r,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,a=a||{};for(var n=Object.keys(a),s=0,o=n.length;s<o;s++){var u=n[s];this[u]=a[u]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var Ao=F((SA,mo)=>{"use strict";S();mo.exports=yh;var vh=Object.getPrototypeOf||function(e){return e.__proto__};function yh(e){if(e===null||typeof e!="object")return e;if(e instanceof Object)var t={__proto__:vh(e)};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))}),t}});var dt=F((BA,En)=>{"use strict";S();var Qe=Le("fs"),mh=po(),Ah=yo(),Ch=Ao(),sa=Le("util"),Je,ua;typeof Symbol=="function"&&typeof Symbol.for=="function"?(Je=Symbol.for("graceful-fs.queue"),ua=Symbol.for("graceful-fs.previous")):(Je="___graceful-fs.queue",ua="___graceful-fs.previous");function Eh(){}function xo(e,t){Object.defineProperty(e,Je,{get:function(){return t}})}var Rr=Eh;sa.debuglog?Rr=sa.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Rr=function(){var e=sa.format.apply(sa,arguments);e="GFS4: "+e.split(/\n/).join(`
|
|
4
4
|
GFS4: `),console.error(e)});Qe[Je]||(Co=global[Je]||[],xo(Qe,Co),Qe.close=function(e){function t(i,r){return e.call(Qe,i,function(a){a||Eo(),typeof r=="function"&&r.apply(this,arguments)})}return Object.defineProperty(t,ua,{value:e}),t}(Qe.close),Qe.closeSync=function(e){function t(i){e.apply(Qe,arguments),Eo()}return Object.defineProperty(t,ua,{value:e}),t}(Qe.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Rr(Qe[Je]),Le("assert").equal(Qe[Je].length,0)}));var Co;global[Je]||xo(global,Qe[Je]);En.exports=An(Ch(Qe));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Qe.__patched&&(En.exports=An(Qe),Qe.__patched=!0);function An(e){mh(e),e.gracefulify=An,e.createReadStream=P,e.createWriteStream=Q;var t=e.readFile;e.readFile=i;function i(H,z,Y){return typeof z=="function"&&(Y=z,z=null),re(H,z,Y);function re(ye,Ee,$,ie){return t(ye,Ee,function(V){V&&(V.code==="EMFILE"||V.code==="ENFILE")?zr([re,[ye,Ee,$],V,ie||Date.now(),Date.now()]):typeof $=="function"&&$.apply(this,arguments)})}}var r=e.writeFile;e.writeFile=a;function a(H,z,Y,re){return typeof Y=="function"&&(re=Y,Y=null),ye(H,z,Y,re);function ye(Ee,$,ie,V,_e){return r(Ee,$,ie,function(xe){xe&&(xe.code==="EMFILE"||xe.code==="ENFILE")?zr([ye,[Ee,$,ie,V],xe,_e||Date.now(),Date.now()]):typeof V=="function"&&V.apply(this,arguments)})}}var n=e.appendFile;n&&(e.appendFile=s);function s(H,z,Y,re){return typeof Y=="function"&&(re=Y,Y=null),ye(H,z,Y,re);function ye(Ee,$,ie,V,_e){return n(Ee,$,ie,function(xe){xe&&(xe.code==="EMFILE"||xe.code==="ENFILE")?zr([ye,[Ee,$,ie,V],xe,_e||Date.now(),Date.now()]):typeof V=="function"&&V.apply(this,arguments)})}}var o=e.copyFile;o&&(e.copyFile=u);function u(H,z,Y,re){return typeof Y=="function"&&(re=Y,Y=0),ye(H,z,Y,re);function ye(Ee,$,ie,V,_e){return o(Ee,$,ie,function(xe){xe&&(xe.code==="EMFILE"||xe.code==="ENFILE")?zr([ye,[Ee,$,ie,V],xe,_e||Date.now(),Date.now()]):typeof V=="function"&&V.apply(this,arguments)})}}var l=e.readdir;e.readdir=c;var f=/^v[0-5]\./;function c(H,z,Y){typeof z=="function"&&(Y=z,z=null);var re=f.test(process.version)?function($,ie,V,_e){return l($,ye($,ie,V,_e))}:function($,ie,V,_e){return l($,ie,ye($,ie,V,_e))};return re(H,z,Y);function ye(Ee,$,ie,V){return function(_e,xe){_e&&(_e.code==="EMFILE"||_e.code==="ENFILE")?zr([re,[Ee,$,ie],_e,V||Date.now(),Date.now()]):(xe&&xe.sort&&xe.sort(),typeof ie=="function"&&ie.call(this,_e,xe))}}}if(process.version.substr(0,4)==="v0.8"){var p=Ah(e);B=p.ReadStream,T=p.WriteStream}var m=e.ReadStream;m&&(B.prototype=Object.create(m.prototype),B.prototype.open=w);var v=e.WriteStream;v&&(T.prototype=Object.create(v.prototype),T.prototype.open=U),Object.defineProperty(e,"ReadStream",{get:function(){return B},set:function(H){B=H},enumerable:!0,configurable:!0}),Object.defineProperty(e,"WriteStream",{get:function(){return T},set:function(H){T=H},enumerable:!0,configurable:!0});var C=B;Object.defineProperty(e,"FileReadStream",{get:function(){return C},set:function(H){C=H},enumerable:!0,configurable:!0});var E=T;Object.defineProperty(e,"FileWriteStream",{get:function(){return E},set:function(H){E=H},enumerable:!0,configurable:!0});function B(H,z){return this instanceof B?(m.apply(this,arguments),this):B.apply(Object.create(B.prototype),arguments)}function w(){var H=this;ne(H.path,H.flags,H.mode,function(z,Y){z?(H.autoClose&&H.destroy(),H.emit("error",z)):(H.fd=Y,H.emit("open",Y),H.read())})}function T(H,z){return this instanceof T?(v.apply(this,arguments),this):T.apply(Object.create(T.prototype),arguments)}function U(){var H=this;ne(H.path,H.flags,H.mode,function(z,Y){z?(H.destroy(),H.emit("error",z)):(H.fd=Y,H.emit("open",Y))})}function P(H,z){return new e.ReadStream(H,z)}function Q(H,z){return new e.WriteStream(H,z)}var te=e.open;e.open=ne;function ne(H,z,Y,re){return typeof Y=="function"&&(re=Y,Y=null),ye(H,z,Y,re);function ye(Ee,$,ie,V,_e){return te(Ee,$,ie,function(xe,Oe){xe&&(xe.code==="EMFILE"||xe.code==="ENFILE")?zr([ye,[Ee,$,ie,V],xe,_e||Date.now(),Date.now()]):typeof V=="function"&&V.apply(this,arguments)})}}return e}function zr(e){Rr("ENQUEUE",e[0].name,e[1]),Qe[Je].push(e),Cn()}var oa;function Eo(){for(var e=Date.now(),t=0;t<Qe[Je].length;++t)Qe[Je][t].length>2&&(Qe[Je][t][3]=e,Qe[Je][t][4]=e);Cn()}function Cn(){if(clearTimeout(oa),oa=void 0,Qe[Je].length!==0){var e=Qe[Je].shift(),t=e[0],i=e[1],r=e[2],a=e[3],n=e[4];if(a===void 0)Rr("RETRY",t.name,i),t.apply(null,i);else if(Date.now()-a>=6e4){Rr("TIMEOUT",t.name,i);var s=i.pop();typeof s=="function"&&s.call(null,r)}else{var o=Date.now()-n,u=Math.max(n-a,1),l=Math.min(u*1.2,100);o>=l?(Rr("RETRY",t.name,i),t.apply(null,i.concat([a]))):Qe[Je].push(e)}oa===void 0&&(oa=setTimeout(Cn,0))}}});var Dr=F(pr=>{"use strict";S();var So=Et().fromCallback,xt=dt(),xh=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchmod","lchown","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(e=>typeof xt[e]=="function");Object.assign(pr,xt);xh.forEach(e=>{pr[e]=So(xt[e])});pr.exists=function(e,t){return typeof t=="function"?xt.exists(e,t):new Promise(i=>xt.exists(e,i))};pr.read=function(e,t,i,r,a,n){return typeof n=="function"?xt.read(e,t,i,r,a,n):new Promise((s,o)=>{xt.read(e,t,i,r,a,(u,l,f)=>{if(u)return o(u);s({bytesRead:l,buffer:f})})})};pr.write=function(e,t,...i){return typeof i[i.length-1]=="function"?xt.write(e,t,...i):new Promise((r,a)=>{xt.write(e,t,...i,(n,s,o)=>{if(n)return a(n);r({bytesWritten:s,buffer:o})})})};typeof xt.writev=="function"&&(pr.writev=function(e,t,...i){return typeof i[i.length-1]=="function"?xt.writev(e,t,...i):new Promise((r,a)=>{xt.writev(e,t,...i,(n,s,o)=>{if(n)return a(n);r({bytesWritten:s,buffers:o})})})});typeof xt.realpath.native=="function"?pr.realpath.native=So(xt.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")});var Bo=F((_A,Io)=>{"use strict";S();var Sh=Le("path");Io.exports.checkPath=function(t){if(process.platform==="win32"&&/[<>:"|?*]/.test(t.replace(Sh.parse(t).root,""))){let r=new Error(`Path contains invalid characters: ${t}`);throw r.code="EINVAL",r}}});var _o=F((kA,xn)=>{"use strict";S();var bo=Dr(),{checkPath:To}=Bo(),wo=e=>{let t={mode:511};return typeof e=="number"?e:{...t,...e}.mode};xn.exports.makeDir=async(e,t)=>(To(e),bo.mkdir(e,{mode:wo(t),recursive:!0}));xn.exports.makeDirSync=(e,t)=>(To(e),bo.mkdirSync(e,{mode:wo(t),recursive:!0}))});var Mt=F((RA,No)=>{"use strict";S();var Ih=Et().fromPromise,{makeDir:Bh,makeDirSync:Sn}=_o(),In=Ih(Bh);No.exports={mkdirs:In,mkdirsSync:Sn,mkdirp:In,mkdirpSync:Sn,ensureDir:In,ensureDirSync:Sn}});var dr=F((PA,Lo)=>{"use strict";S();var bh=Et().fromPromise,ko=Dr();function Th(e){return ko.access(e).then(()=>!0).catch(()=>!1)}Lo.exports={pathExists:bh(Th),pathExistsSync:ko.existsSync}});var Bn=F((UA,Ro)=>{"use strict";S();var Jr=dt();function wh(e,t,i,r){Jr.open(e,"r+",(a,n)=>{if(a)return r(a);Jr.futimes(n,t,i,s=>{Jr.close(n,o=>{r&&r(s||o)})})})}function _h(e,t,i){let r=Jr.openSync(e,"r+");return Jr.futimesSync(r,t,i),Jr.closeSync(r)}Ro.exports={utimesMillis:wh,utimesMillisSync:_h}});var Pr=F((VA,Qo)=>{"use strict";S();var Wr=Dr(),Ke=Le("path"),Nh=Le("util");function kh(e,t,i){let r=i.dereference?a=>Wr.stat(a,{bigint:!0}):a=>Wr.lstat(a,{bigint:!0});return Promise.all([r(e),r(t).catch(a=>{if(a.code==="ENOENT")return null;throw a})]).then(([a,n])=>({srcStat:a,destStat:n}))}function Lh(e,t,i){let r,a=i.dereference?s=>Wr.statSync(s,{bigint:!0}):s=>Wr.lstatSync(s,{bigint:!0}),n=a(e);try{r=a(t)}catch(s){if(s.code==="ENOENT")return{srcStat:n,destStat:null};throw s}return{srcStat:n,destStat:r}}function Rh(e,t,i,r,a){Nh.callbackify(kh)(e,t,r,(n,s)=>{if(n)return a(n);let{srcStat:o,destStat:u}=s;if(u){if(Bi(o,u)){let l=Ke.basename(e),f=Ke.basename(t);return i==="move"&&l!==f&&l.toLowerCase()===f.toLowerCase()?a(null,{srcStat:o,destStat:u,isChangingCase:!0}):a(new Error("Source and destination must not be the same."))}if(o.isDirectory()&&!u.isDirectory())return a(new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`));if(!o.isDirectory()&&u.isDirectory())return a(new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`))}return o.isDirectory()&&bn(e,t)?a(new Error(la(e,t,i))):a(null,{srcStat:o,destStat:u})})}function Dh(e,t,i,r){let{srcStat:a,destStat:n}=Lh(e,t,r);if(n){if(Bi(a,n)){let s=Ke.basename(e),o=Ke.basename(t);if(i==="move"&&s!==o&&s.toLowerCase()===o.toLowerCase())return{srcStat:a,destStat:n,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(a.isDirectory()&&!n.isDirectory())throw new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`);if(!a.isDirectory()&&n.isDirectory())throw new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`)}if(a.isDirectory()&&bn(e,t))throw new Error(la(e,t,i));return{srcStat:a,destStat:n}}function Do(e,t,i,r,a){let n=Ke.resolve(Ke.dirname(e)),s=Ke.resolve(Ke.dirname(i));if(s===n||s===Ke.parse(s).root)return a();Wr.stat(s,{bigint:!0},(o,u)=>o?o.code==="ENOENT"?a():a(o):Bi(t,u)?a(new Error(la(e,i,r))):Do(e,t,s,r,a))}function Po(e,t,i,r){let a=Ke.resolve(Ke.dirname(e)),n=Ke.resolve(Ke.dirname(i));if(n===a||n===Ke.parse(n).root)return;let s;try{s=Wr.statSync(n,{bigint:!0})}catch(o){if(o.code==="ENOENT")return;throw o}if(Bi(t,s))throw new Error(la(e,i,r));return Po(e,t,n,r)}function Bi(e,t){return t.ino&&t.dev&&t.ino===e.ino&&t.dev===e.dev}function bn(e,t){let i=Ke.resolve(e).split(Ke.sep).filter(a=>a),r=Ke.resolve(t).split(Ke.sep).filter(a=>a);return i.reduce((a,n,s)=>a&&r[s]===n,!0)}function la(e,t,i){return`Cannot ${i} '${e}' to a subdirectory of itself, '${t}'.`}Qo.exports={checkPaths:Rh,checkPathsSync:Dh,checkParentPaths:Do,checkParentPathsSync:Po,isSrcSubdir:bn,areIdentical:Bi}});var Ho=F((MA,Ko)=>{"use strict";S();var St=dt(),bi=Le("path"),Ph=Mt().mkdirs,Qh=dr().pathExists,Uh=Bn().utimesMillis,Ti=Pr();function Oh(e,t,i,r){typeof i=="function"&&!r?(r=i,i={}):typeof i=="function"&&(i={filter:i}),r=r||function(){},i=i||{},i.clobber="clobber"in i?!!i.clobber:!0,i.overwrite="overwrite"in i?!!i.overwrite:i.clobber,i.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
5
5
|
|
|
6
6
|
see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001"),Ti.checkPaths(e,t,"copy",i,(a,n)=>{if(a)return r(a);let{srcStat:s,destStat:o}=n;Ti.checkParentPaths(e,s,t,"copy",u=>u?r(u):i.filter?Vo(Uo,o,e,t,i,r):Uo(o,e,t,i,r))})}function Uo(e,t,i,r,a){let n=bi.dirname(i);Qh(n,(s,o)=>{if(s)return a(s);if(o)return fa(e,t,i,r,a);Ph(n,u=>u?a(u):fa(e,t,i,r,a))})}function Vo(e,t,i,r,a,n){Promise.resolve(a.filter(i,r)).then(s=>s?e(t,i,r,a,n):n(),s=>n(s))}function Vh(e,t,i,r,a){return r.filter?Vo(fa,e,t,i,r,a):fa(e,t,i,r,a)}function fa(e,t,i,r,a){(r.dereference?St.stat:St.lstat)(t,(s,o)=>s?a(s):o.isDirectory()?jh(o,e,t,i,r,a):o.isFile()||o.isCharacterDevice()||o.isBlockDevice()?Fh(o,e,t,i,r,a):o.isSymbolicLink()?Jh(e,t,i,r,a):o.isSocket()?a(new Error(`Cannot copy a socket file: ${t}`)):o.isFIFO()?a(new Error(`Cannot copy a FIFO pipe: ${t}`)):a(new Error(`Unknown file: ${t}`)))}function Fh(e,t,i,r,a,n){return t?Mh(e,i,r,a,n):Fo(e,i,r,a,n)}function Mh(e,t,i,r,a){if(r.overwrite)St.unlink(i,n=>n?a(n):Fo(e,t,i,r,a));else return r.errorOnExist?a(new Error(`'${i}' already exists`)):a()}function Fo(e,t,i,r,a){St.copyFile(t,i,n=>n?a(n):r.preserveTimestamps?qh(e.mode,t,i,a):ca(i,e.mode,a))}function qh(e,t,i,r){return Kh(e)?Hh(i,e,a=>a?r(a):Oo(e,t,i,r)):Oo(e,t,i,r)}function Kh(e){return(e&128)===0}function Hh(e,t,i){return ca(e,t|128,i)}function Oo(e,t,i,r){Gh(t,i,a=>a?r(a):ca(i,e,r))}function ca(e,t,i){return St.chmod(e,t,i)}function Gh(e,t,i){St.stat(e,(r,a)=>r?i(r):Uh(t,a.atime,a.mtime,i))}function jh(e,t,i,r,a,n){return t?Mo(i,r,a,n):Yh(e.mode,i,r,a,n)}function Yh(e,t,i,r,a){St.mkdir(i,n=>{if(n)return a(n);Mo(t,i,r,s=>s?a(s):ca(i,e,a))})}function Mo(e,t,i,r){St.readdir(e,(a,n)=>a?r(a):qo(n,e,t,i,r))}function qo(e,t,i,r,a){let n=e.pop();return n?zh(e,n,t,i,r,a):a()}function zh(e,t,i,r,a,n){let s=bi.join(i,t),o=bi.join(r,t);Ti.checkPaths(s,o,"copy",a,(u,l)=>{if(u)return n(u);let{destStat:f}=l;Vh(f,s,o,a,c=>c?n(c):qo(e,i,r,a,n))})}function Jh(e,t,i,r,a){St.readlink(t,(n,s)=>{if(n)return a(n);if(r.dereference&&(s=bi.resolve(process.cwd(),s)),e)St.readlink(i,(o,u)=>o?o.code==="EINVAL"||o.code==="UNKNOWN"?St.symlink(s,i,a):a(o):(r.dereference&&(u=bi.resolve(process.cwd(),u)),Ti.isSrcSubdir(s,u)?a(new Error(`Cannot copy '${s}' to a subdirectory of itself, '${u}'.`)):e.isDirectory()&&Ti.isSrcSubdir(u,s)?a(new Error(`Cannot overwrite '${u}' with '${s}'.`)):Wh(s,i,a)));else return St.symlink(s,i,a)})}function Wh(e,t,i){St.unlink(t,r=>r?i(r):St.symlink(e,t,i))}Ko.exports=Oh});var Jo=F((KA,zo)=>{"use strict";S();var pt=dt(),wi=Le("path"),Xh=Mt().mkdirsSync,$h=Bn().utimesMillisSync,_i=Pr();function Zh(e,t,i){typeof i=="function"&&(i={filter:i}),i=i||{},i.clobber="clobber"in i?!!i.clobber:!0,i.overwrite="overwrite"in i?!!i.overwrite:i.clobber,i.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended;
|
|
@@ -173,4 +173,4 @@ export default createComponentHmrWrapper(OriginalComponent, import.meta.hot.data
|
|
|
173
173
|
You can close this browser tab and return to the terminal to continue working.
|
|
174
174
|
</body>
|
|
175
175
|
</html>`}S();var th="__WIX_ORIGIN_PLACEHOLDER__";function rh(){let e=null;return{name:"wix:auto-origin",apply:"serve",config:()=>({server:{origin:th}}),configureServer:t=>{t.middlewares.use((i,r,a)=>{e=e??wa(t),a()})},transform:(t,i)=>{if(i.match(/.*\.(m?jsx?|tsx?)$/))return t;if(!e)throw new Gr({code:jr.FailedToResolveViteOrigin()});return t.replaceAll(th,e)}}}S();import{dirname as iA,isAbsolute as aA,join as nA}from"node:path";import{URL as ih}from"node:url";function sA(e,t,i){let r=new ih(t,i).href;if(t.startsWith("/@vite"))return r;if(!aA(t)){let a=nA(iA(e),t);r=new ih(a,i).href}return r}function ah(){let e;return{name:"wix:absolute-html-url",apply:"serve",configureServer(t){e=t},transformIndexHtml:{order:"post",handler(t,{originalUrl:i}){if(!i)throw new Error("Cannot find asset URL.");let r=e.resolvedUrls?.local?.[0],a=(n,s,o,u)=>{let l=sA(i,o,r);return`${s}${l}${u}`};return t.replace(/(<script [^><]*src=["'])((?!http)[^"']+)(["'][^><]*>[\r\n]*<\/script>)/g,a).replace(/(<link [^><]*href=["'])((?!http)[^"']+)(["'][^><]*>)/g,a).replace(/(\r\n|\n|\r)/gm,"")}}}}async function Nx(e,t){let{https:i}=t,r=[...yi(e)].map(([u,l])=>[`html-asset-${l.id}`,u]),a=[...mi(e)].map(([u,l])=>[`script-asset-${l.id}`,u]),n=e.components.filter((0,nh.isType)(eo.EmbeddedScript)).map(u=>[u.id,oA(e.projectFolder,u.relativePath)]),s=[...Ai(e)].map(([u,l])=>[`html-asset-${l.id}`,u]),o=[...Ci(e)].map(([u,l])=>[`script-asset-${l.id}`,u]);return{configFile:!1,root:e.projectFolder,customLogger:t.customLogger,clearScreen:!1,logLevel:"info",optimizeDeps:{entries:[ro,io,ao,no,so]},server:{},build:{sourcemap:!0,outDir:Zs(e.projectFolder),rollupOptions:{input:Object.fromEntries([...r,...a,...n,...s,...o])}},plugins:[kf(),...i?[eh()]:[],_f({initialModel:e,...t}),mf(),Cf(),vf({react:"React","react-dom":"ReactDOM"}),If({initialModel:e,...t}),rh(),ah()],experimental:{renderBuiltUrl(u,{hostType:l,hostId:f}){return l==="html"&&!f.includes("wix/html")?"__STATICS_BASE_URL_PLACEHOLDER__"+u:l!=="js"?{relative:!0}:{runtime:`import.meta.url.replace(${`"${f}"`}, ${`"${u}"`})`}}}}}export{wa as a,Nx as b};
|
|
176
|
-
//# sourceMappingURL=chunk-
|
|
176
|
+
//# sourceMappingURL=chunk-N6MHPAL7.js.map
|