@wix/cli-app 1.1.36 → 1.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/build/{CreateVersionCommand-GJYJMFS6.js → CreateVersionCommand-C6UP5ORQ.js} +2 -2
  2. package/build/{CreateVersionCommand-GJYJMFS6.js.map → CreateVersionCommand-C6UP5ORQ.js.map} +1 -1
  3. package/build/DevCommand-BO6KQHRP.js +4 -0
  4. package/build/DevCommand-BO6KQHRP.js.map +1 -0
  5. package/build/GenerateCommand-7ZGIGNPF.js +99 -0
  6. package/build/GenerateCommand-7ZGIGNPF.js.map +1 -0
  7. package/build/{LogsCommand-ZWIIAJI6.js → LogsCommand-W5CRI6WA.js} +2 -2
  8. package/build/LogsCommand-W5CRI6WA.js.map +1 -0
  9. package/build/PreviewCommand-DWQCCBBZ.js +4 -0
  10. package/build/{ServeCommand-ZJMRR4ES.js → ServeCommand-T5PQKB57.js} +2 -2
  11. package/build/ServeCommand-T5PQKB57.js.map +1 -0
  12. package/build/{build-6EB3DE3E.js → build-CNTVWU2X.js} +2 -2
  13. package/build/{chunk-3ACKBLKR.js → chunk-35BUZ7CK.js} +2 -2
  14. package/build/{chunk-3ACKBLKR.js.map → chunk-35BUZ7CK.js.map} +1 -1
  15. package/build/{chunk-PQFAL6B4.js → chunk-3Q7TAN43.js} +2 -2
  16. package/build/{chunk-E7IQZNJ7.js → chunk-4YU6J2EW.js} +2 -2
  17. package/build/{chunk-HNY5L6XA.js → chunk-6QCQALVT.js} +2 -2
  18. package/build/{chunk-3EO7KOOF.js → chunk-7OVUUUVH.js} +2 -2
  19. package/build/{chunk-5POS3EQI.js → chunk-BW3SDDV3.js} +2 -2
  20. package/build/chunk-GK5AZX2F.js +4 -0
  21. package/build/{chunk-I24C7SNY.js → chunk-I2Z6OIJW.js} +2 -2
  22. package/build/{chunk-OMZB4UKG.js → chunk-IBNMP32R.js} +2 -2
  23. package/build/chunk-KLTGX7JQ.js +4 -0
  24. package/build/chunk-KLTGX7JQ.js.map +1 -0
  25. package/build/{chunk-TSKFLGBO.js → chunk-MIBBNKYS.js} +5 -5
  26. package/build/{chunk-TSKFLGBO.js.map → chunk-MIBBNKYS.js.map} +1 -1
  27. package/build/chunk-PBBKM3Z3.js +233 -0
  28. package/build/chunk-PBBKM3Z3.js.map +1 -0
  29. package/build/{chunk-ZTMLHHUQ.js → chunk-QDPEZ5A2.js} +2 -2
  30. package/build/chunk-QDPEZ5A2.js.map +1 -0
  31. package/build/chunk-QT3P4FJP.js +11 -0
  32. package/build/chunk-QT3P4FJP.js.map +1 -0
  33. package/build/{chunk-JPGXKQXP.js → chunk-R3JUFM5X.js} +1 -1
  34. package/build/chunk-R3JUFM5X.js.map +1 -0
  35. package/build/{chunk-OOIZVKTY.js → chunk-RCIAHQJ5.js} +2 -2
  36. package/build/chunk-RCIAHQJ5.js.map +1 -0
  37. package/build/{chunk-3UAIFRQA.js → chunk-RZI5OJAA.js} +2 -2
  38. package/build/chunk-RZI5OJAA.js.map +1 -0
  39. package/build/chunk-TRE6G7GA.js +4 -0
  40. package/build/chunk-TRE6G7GA.js.map +1 -0
  41. package/build/{chunk-KX7T4WP2.js → chunk-VAOLKVA2.js} +2 -2
  42. package/build/chunk-VAOLKVA2.js.map +1 -0
  43. package/build/{chunk-7IFG7QRE.js → chunk-YHA4H34H.js} +3 -3
  44. package/build/{chunk-7IFG7QRE.js.map → chunk-YHA4H34H.js.map} +1 -1
  45. package/build/index.js +2 -2
  46. package/build/index.js.map +1 -1
  47. package/build/platform-sdk/editor.js +2 -2
  48. package/build/platform-sdk/editor.js.map +1 -1
  49. package/build/platform-sdk/site.js +1 -1
  50. package/build/platform-sdk/site.js.map +1 -1
  51. package/build/preview-HS2NEMQI.js +4 -0
  52. package/build/{preview-OUDOPVIF.js.map → preview-HS2NEMQI.js.map} +1 -1
  53. package/build/render-command-QGD6AYTF.js +4 -0
  54. package/build/render-command-QGD6AYTF.js.map +1 -0
  55. package/package.json +7 -4
  56. package/templates/custom-element/dependencies.json +1 -2
  57. package/templates/custom-element/files/element.tsx.ejs +8 -5
  58. package/templates/custom-element/files/panel.tsx.ejs +26 -32
  59. package/templates/dashboard-modal/dependencies.json +2 -3
  60. package/templates/dashboard-modal/files/modal.tsx.ejs +11 -16
  61. package/templates/dashboard-page/dependencies.json +1 -3
  62. package/templates/dashboard-page/files/page.tsx.ejs +7 -11
  63. package/templates/dashboard-plugin/dependencies.json +1 -3
  64. package/templates/dashboard-plugin/files/plugin.tsx.ejs +6 -10
  65. package/build/DevCommand-UJ56EKIV.js +0 -4
  66. package/build/DevCommand-UJ56EKIV.js.map +0 -1
  67. package/build/GenerateCommand-YTAYOWLN.js +0 -99
  68. package/build/GenerateCommand-YTAYOWLN.js.map +0 -1
  69. package/build/LogsCommand-ZWIIAJI6.js.map +0 -1
  70. package/build/PreviewCommand-7JJAW5Y4.js +0 -4
  71. package/build/ServeCommand-ZJMRR4ES.js.map +0 -1
  72. package/build/chunk-3UAIFRQA.js.map +0 -1
  73. package/build/chunk-5GXRNUOR.js +0 -201
  74. package/build/chunk-5GXRNUOR.js.map +0 -1
  75. package/build/chunk-6N3YP4CO.js +0 -4
  76. package/build/chunk-AXFFV5MU.js +0 -4
  77. package/build/chunk-AXFFV5MU.js.map +0 -1
  78. package/build/chunk-DAPZQSXG.js +0 -11
  79. package/build/chunk-DAPZQSXG.js.map +0 -1
  80. package/build/chunk-JPGXKQXP.js.map +0 -1
  81. package/build/chunk-KX7T4WP2.js.map +0 -1
  82. package/build/chunk-OOIZVKTY.js.map +0 -1
  83. package/build/chunk-SLG2HQYB.js +0 -4
  84. package/build/chunk-SLG2HQYB.js.map +0 -1
  85. package/build/chunk-ZTMLHHUQ.js.map +0 -1
  86. package/build/preview-OUDOPVIF.js +0 -4
  87. package/build/render-command-URXJKFYN.js +0 -4
  88. package/build/render-command-URXJKFYN.js.map +0 -1
  89. /package/build/{PreviewCommand-7JJAW5Y4.js.map → PreviewCommand-DWQCCBBZ.js.map} +0 -0
  90. /package/build/{build-6EB3DE3E.js.map → build-CNTVWU2X.js.map} +0 -0
  91. /package/build/{chunk-PQFAL6B4.js.map → chunk-3Q7TAN43.js.map} +0 -0
  92. /package/build/{chunk-E7IQZNJ7.js.map → chunk-4YU6J2EW.js.map} +0 -0
  93. /package/build/{chunk-HNY5L6XA.js.map → chunk-6QCQALVT.js.map} +0 -0
  94. /package/build/{chunk-3EO7KOOF.js.map → chunk-7OVUUUVH.js.map} +0 -0
  95. /package/build/{chunk-5POS3EQI.js.map → chunk-BW3SDDV3.js.map} +0 -0
  96. /package/build/{chunk-6N3YP4CO.js.map → chunk-GK5AZX2F.js.map} +0 -0
  97. /package/build/{chunk-I24C7SNY.js.map → chunk-I2Z6OIJW.js.map} +0 -0
  98. /package/build/{chunk-OMZB4UKG.js.map → chunk-IBNMP32R.js.map} +0 -0
@@ -1,4 +1,4 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{a as J}from"./chunk-3UAIFRQA.js";import{Na as V,Oa as z,Pa as H,Ua as R,Va as q,lb as U}from"./chunk-TSKFLGBO.js";import{O as j,R as G,V as C,W as N,a as I,b as M,d as _,e as v,l as r,w as l,z as d}from"./chunk-JPGXKQXP.js";import{e as f,h as a}from"./chunk-V4TR6DCM.js";a();a();var L=f(I(),1);var S=f(M(),1);a();var o=f(I(),1),k=f(M(),1);a();var y=f(I(),1);import{createServer as pe}from"node:http";var X=f(M(),1);a();var x=f(M(),1),oe=r.any(),re=r.enum(["info","error","warn","debug","log"]),te=r.object({message:r.array(oe),level:re,timestamp:r.number()}),ne=r.object({stack:r.string(),name:r.string(),message:r.string(),timestamp:r.number()}),se=r.object({_type:r.literal("log"),exceptions:r.array(ne),logs:r.array(te)}).passthrough(),ie=r.object({_type:r.literal("session-timeout")}).passthrough(),me=r.discriminatedUnion("_type",[se,ie]),K=(0,x.variant)({Log:(0,x.fields)(),Exception:(0,x.fields)()}),D="/logs",$=(e,n)=>{let i,g;if(e.method==="POST"&&e.url===D){let m="";e.on("data",s=>{m+=s.toString()}),e.on("end",()=>{let s;try{s=me.parse(JSON.parse(m))}catch(p){return g(v.FailedToParseLog(),p,{body:m}),n.statusCode=400,n.end()}let t=[];s._type==="log"&&(t.push(...s.exceptions.map(p=>K.Exception(p))),t.push(...s.logs.map(p=>K.Log(p)))),(0,x.match)(s._type,{log:()=>{i(t)},"session-timeout":()=>{n.statusCode=200,n.end(),g(v.LogsConnectionTimeout(),{},{body:m})}}),n.statusCode=200,n.end()})}else n.statusCode=404,n.end("Not Found");let u={onLog:m=>(i=m,u),onError:m=>(g=m,u)};return u};var ae=/([0-9a-f-]{36})/,Y=({onLog:e,version:n,appId:i})=>{let{getAppByVersion:g}=H(),u=J(),m=z({type:"backoffice"}),s=(0,y.useRef)(),t=(0,y.useMemo)(()=>pe((c,h)=>{$(c,h).onLog(e).onError((B,b,O)=>{throw t.close(),new _({code:B,cause:b,info:O})})}),[e]),p=(0,y.useMemo)(()=>new Promise(c=>{s.current=c}),[]);(0,y.useEffect)(()=>(t.listen(0,async()=>{let c=t.address().port;s.current?.(c)}),()=>{t.listening&&t.close()}),[t]);let{status:T}=G(async()=>{let c=await p,{url:h}=await u(c),{data:B}=await g({appId:i,version:n}),b=B.components.find(A=>A.compType===V.TOPOLOGY),O=ae.exec(b?.compData.topology.topology.backendApiUrl??"");if(!O?.[1])throw new _({code:v.FailedToGetLogsTopology()});let F=O[1],ee={appId:i,deploymentId:F,destinationUrl:new URL(D,h).href};try{await m.request(R(ee))}catch(A){throw t.close(),new _({code:v.FailedToConnectToLogsService(),cause:A})}return F},[]);return(0,y.useEffect)(()=>()=>{(0,X.isType)(T,"Success")&&m.request(q({appId:i,deploymentId:T.result}))},[]),T};a();var Q=f(I(),1);var P=({message:e,level:n})=>{let i="unknown";return typeof e=="object"?i=JSON.stringify(e):i=String(e),Q.default.createElement(d,{skin:n==="error"?"error":"standard"},i)};var W=({version:e,appId:n})=>{let{t:i}=N(),[g,u]=(0,o.useState)([]),m=Y({appId:n,version:e,onLog:(0,o.useCallback)(s=>{u(t=>[...t,...s])},[u])});return(0,k.match)(m,{Success:()=>o.default.createElement(l,{marginTop:1,marginBottom:1,flexDirection:"column"},o.default.createElement(l,{marginBottom:1,flexDirection:"column"},o.default.createElement(d,null,o.default.createElement(C,{i18nKey:"logs_command.listening_to_logs"})),o.default.createElement(d,null,o.default.createElement(C,{i18nKey:"logs_command.prod_env_logs",values:{version:e}}))),g.map((s,t)=>o.default.createElement(l,{key:t,flexDirection:"column"},o.default.createElement(l,{columnGap:1},o.default.createElement(l,{flexShrink:0},o.default.createElement(d,{skin:"secondary"},new Date(s.timestamp).toLocaleTimeString())),o.default.createElement(l,{columnGap:1},(0,k.match)(s,{Log:({message:p,level:T})=>p.map((c,h)=>o.default.createElement(P,{key:`${t}-${h}`,message:c,level:T})),Exception:({message:p})=>o.default.createElement(P,{key:t,message:p,level:"error"})}))),(0,k.match)(s,{Log:()=>null,Exception:({stack:p})=>o.default.createElement(d,{skin:"error"},p)})))),Loading:()=>o.default.createElement(j,{text:i("logs_command.connecting")}),Error:()=>null})};var Z=(0,S.variant)({Valid:(0,S.fields)(),Error:(0,S.fields)()}),ge=({version:e})=>e?Z.Valid({version:e}):Z.Error({message:L.default.createElement(C,{i18nKey:"logs_command.logs_without_version"})}),le=({version:e})=>{let{model:n}=U(),i=(0,L.useMemo)(()=>ge({version:e}),[e]);return(0,S.match)(i,{Valid:({version:g})=>L.default.createElement(W,{version:g,appId:n.config.appId}),Error:({message:g})=>L.default.createElement(l,{rowGap:1,marginTop:1,marginBottom:1,flexDirection:"column"},L.default.createElement(l,{gap:1},L.default.createElement(d,{skin:"error"},g)))})};export{le as LogsCommand};
4
- //# sourceMappingURL=LogsCommand-ZWIIAJI6.js.map
3
+ import{a as J}from"./chunk-RZI5OJAA.js";import{Oa as V,Pa as z,Qa as H,Va as R,Wa as q,mb as U}from"./chunk-MIBBNKYS.js";import{O as j,R as G,V as C,W as N,a as I,b as M,d as _,e as S,l as r,w as l,z as d}from"./chunk-R3JUFM5X.js";import{e as f,h as a}from"./chunk-V4TR6DCM.js";a();a();var L=f(I(),1);var v=f(M(),1);a();var o=f(I(),1),k=f(M(),1);a();var y=f(I(),1);import{createServer as pe}from"node:http";var X=f(M(),1);a();var x=f(M(),1),oe=r.any(),re=r.enum(["info","error","warn","debug","log"]),te=r.object({message:r.array(oe),level:re,timestamp:r.number()}),ne=r.object({stack:r.string(),name:r.string(),message:r.string(),timestamp:r.number()}),se=r.object({_type:r.literal("log"),exceptions:r.array(ne),logs:r.array(te)}).passthrough(),ie=r.object({_type:r.literal("session-timeout")}).passthrough(),me=r.discriminatedUnion("_type",[se,ie]),K=(0,x.variant)({Log:(0,x.fields)(),Exception:(0,x.fields)()}),D="/logs",$=(e,n)=>{let i,g;if(e.method==="POST"&&e.url===D){let m="";e.on("data",s=>{m+=s.toString()}),e.on("end",()=>{let s;try{s=me.parse(JSON.parse(m))}catch(p){return g(S.FailedToParseLog(),p,{body:m}),n.statusCode=400,n.end()}let t=[];s._type==="log"&&(t.push(...s.exceptions.map(p=>K.Exception(p))),t.push(...s.logs.map(p=>K.Log(p)))),(0,x.match)(s._type,{log:()=>{i(t)},"session-timeout":()=>{n.statusCode=200,n.end(),g(S.LogsConnectionTimeout(),{},{body:m})}}),n.statusCode=200,n.end()})}else n.statusCode=404,n.end("Not Found");let u={onLog:m=>(i=m,u),onError:m=>(g=m,u)};return u};var ae=/([0-9a-f-]{36})/,Y=({onLog:e,version:n,appId:i})=>{let{getAppByVersion:g}=H(),u=J(),m=z({type:"backoffice"}),s=(0,y.useRef)(),t=(0,y.useMemo)(()=>pe((c,h)=>{$(c,h).onLog(e).onError((B,b,O)=>{throw t.close(),new _({code:B,cause:b,info:O})})}),[e]),p=(0,y.useMemo)(()=>new Promise(c=>{s.current=c}),[]);(0,y.useEffect)(()=>(t.listen(0,async()=>{let c=t.address().port;s.current?.(c)}),()=>{t.listening&&t.close()}),[t]);let{status:T}=G(async()=>{let c=await p,{url:h}=await u(c),{data:B}=await g({appId:i,version:n}),b=B.components.find(A=>A.compType===V.TOPOLOGY),O=ae.exec(b?.compData.topology.topology.backendApiUrl??"");if(!O?.[1])throw new _({code:S.FailedToGetLogsTopology()});let F=O[1],ee={appId:i,deploymentId:F,destinationUrl:new URL(D,h).href};try{await m.request(R(ee))}catch(A){throw t.close(),new _({code:S.FailedToConnectToLogsService(),cause:A})}return F},[]);return(0,y.useEffect)(()=>()=>{(0,X.isType)(T,"Success")&&m.request(q({appId:i,deploymentId:T.result}))},[]),T};a();var Q=f(I(),1);var P=({message:e,level:n})=>{let i="unknown";return typeof e=="object"?i=JSON.stringify(e):i=String(e),Q.default.createElement(d,{skin:n==="error"?"error":"standard"},i)};var W=({version:e,appId:n})=>{let{t:i}=N(),[g,u]=(0,o.useState)([]),m=Y({appId:n,version:e,onLog:(0,o.useCallback)(s=>{u(t=>[...t,...s])},[u])});return(0,k.match)(m,{Success:()=>o.default.createElement(l,{marginTop:1,marginBottom:1,flexDirection:"column"},o.default.createElement(l,{marginBottom:1,flexDirection:"column"},o.default.createElement(d,null,o.default.createElement(C,{i18nKey:"logs_command.listening_to_logs"})),o.default.createElement(d,null,o.default.createElement(C,{i18nKey:"logs_command.prod_env_logs",values:{version:e}}))),g.map((s,t)=>o.default.createElement(l,{key:t,flexDirection:"column"},o.default.createElement(l,{columnGap:1},o.default.createElement(l,{flexShrink:0},o.default.createElement(d,{skin:"secondary"},new Date(s.timestamp).toLocaleTimeString())),o.default.createElement(l,{columnGap:1},(0,k.match)(s,{Log:({message:p,level:T})=>p.map((c,h)=>o.default.createElement(P,{key:`${t}-${h}`,message:c,level:T})),Exception:({message:p})=>o.default.createElement(P,{key:t,message:p,level:"error"})}))),(0,k.match)(s,{Log:()=>null,Exception:({stack:p})=>o.default.createElement(d,{skin:"error"},p)})))),Loading:()=>o.default.createElement(j,{text:i("logs_command.connecting")}),Error:()=>null})};var Z=(0,v.variant)({Valid:(0,v.fields)(),Error:(0,v.fields)()}),ge=({version:e})=>e?Z.Valid({version:e}):Z.Error({message:L.default.createElement(C,{i18nKey:"logs_command.logs_without_version"})}),le=({version:e})=>{let{model:n}=U(),i=(0,L.useMemo)(()=>ge({version:e}),[e]);return(0,v.match)(i,{Valid:({version:g})=>L.default.createElement(W,{version:g,appId:n.config.appId}),Error:({message:g})=>L.default.createElement(l,{rowGap:1,marginTop:1,marginBottom:1,flexDirection:"column"},L.default.createElement(l,{gap:1},L.default.createElement(d,{skin:"error"},g)))})};export{le as LogsCommand};
4
+ //# sourceMappingURL=LogsCommand-W5CRI6WA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/LogsCommand/index.ts","../src/components/LogsCommand/LogsCommand.tsx","../src/components/LogsCommand/DisplayServerLogs.tsx","../src/components/LogsCommand/useLogsServer.ts","../src/components/LogsCommand/logsReqHandler.ts","../src/components/LogsCommand/ServerLogMessage.tsx"],"sourcesContent":["export { LogsCommand } from './LogsCommand.js';\n","import type { FC } from 'react';\nimport React, { useMemo } from 'react';\nimport { Trans } from '@wix/cli-i18n';\nimport { Box, Text } from '@wix/cli-ui-kit';\nimport { fields, match, variant } from 'variant';\nimport { DisplayServerLogs } from './DisplayServerLogs.js';\nimport { useProjectModel } from '../../model.js';\n\nconst ValidationResult = variant({\n Valid: fields<{ version: string }>(),\n Error: fields<{ message: React.JSX.Element }>(),\n});\n\nconst validateInput = ({ version }: { version?: string }) => {\n if (!version) {\n return ValidationResult.Error({\n message: <Trans i18nKey=\"logs_command.logs_without_version\" />,\n });\n }\n return ValidationResult.Valid({ version });\n};\n\nexport const LogsCommand: FC<{\n version?: string;\n}> = ({ version }) => {\n const { model } = useProjectModel();\n\n const validationResult = useMemo(() => validateInput({ version }), [version]);\n\n return match(validationResult, {\n Valid: ({ version }) => (\n <DisplayServerLogs version={version} appId={model.config.appId} />\n ),\n Error: ({ message }) => (\n <Box rowGap={1} marginTop={1} marginBottom={1} flexDirection=\"column\">\n <Box gap={1}>\n <Text skin=\"error\">{message}</Text>\n </Box>\n </Box>\n ),\n });\n};\n","import type { FC } from 'react';\nimport React, { useState, useCallback } from 'react';\nimport { match } from 'variant';\nimport { Spinner, Box, Text } from '@wix/cli-ui-kit';\nimport { useTranslation, Trans } from '@wix/cli-i18n';\nimport { useLogsServer } from './useLogsServer.js';\nimport type { AggregatedLog } from './logsReqHandler.js';\nimport { ServerLogMessage } from './ServerLogMessage.js';\n\nexport const DisplayServerLogs: FC<{\n version: string;\n appId: string;\n}> = ({ version, appId }) => {\n const { t } = useTranslation();\n const [logs, setLogs] = useState<AggregatedLog[]>([]);\n const serverResult = useLogsServer({\n appId,\n version,\n onLog: useCallback(\n (serverLogs) => {\n setLogs((prevLogs) => {\n return [...prevLogs, ...serverLogs];\n });\n },\n [setLogs]\n ),\n });\n\n return match(serverResult, {\n Success: () => (\n <Box marginTop={1} marginBottom={1} flexDirection=\"column\">\n <Box marginBottom={1} flexDirection=\"column\">\n <Text>\n <Trans i18nKey=\"logs_command.listening_to_logs\" />\n </Text>\n <Text>\n <Trans i18nKey=\"logs_command.prod_env_logs\" values={{ version }} />\n </Text>\n </Box>\n\n {logs.map((log, logIdx) => (\n <Box key={logIdx} flexDirection=\"column\">\n <Box columnGap={1}>\n <Box flexShrink={0}>\n <Text skin=\"secondary\">\n {new Date(log.timestamp).toLocaleTimeString()}\n </Text>\n </Box>\n <Box columnGap={1}>\n {match(log, {\n Log: ({ message, level }) =>\n message.map((msgItem, idx) => (\n <ServerLogMessage\n key={`${logIdx}-${idx}`}\n message={msgItem}\n level={level}\n />\n )),\n Exception: ({ message }) => (\n <ServerLogMessage\n key={logIdx}\n message={message}\n level=\"error\"\n />\n ),\n })}\n </Box>\n </Box>\n {match(log, {\n Log: () => null,\n Exception: ({ stack }) => <Text skin=\"error\">{stack}</Text>,\n })}\n </Box>\n ))}\n </Box>\n ),\n Loading: () => <Spinner text={t('logs_command.connecting')} />,\n Error: () => null,\n });\n};\n","import { useEffect, useMemo, useRef } from 'react';\nimport { createServer } from 'node:http';\nimport type { AddressInfo } from 'node:net';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { useAsync } from '@wix/cli-ui-kit';\nimport { useHttpClient } from '@wix/cli-http-client-react';\nimport {\n attachLogger,\n deattachLogger,\n} from '@wix/ambassador-ctp-app-cloud-backend-service-v1-app-cloud-backend-deployment/http';\nimport { useTunnel } from '@wix/cli-tunnel';\nimport { useDevCenterClient, ComponentType } from '@wix/dev-center-client';\nimport type { TopologyComponent } from '@wix/dev-center-client';\nimport { isType } from 'variant';\nimport type { OnLog } from './logsReqHandler.js';\nimport { LOGS_ENDPOINT, logsReqHandler } from './logsReqHandler.js';\n\nconst deploymentIdRegex = /([0-9a-f-]{36})/;\n\nexport const useLogsServer = ({\n onLog,\n version,\n appId,\n}: {\n onLog: OnLog;\n version: string;\n appId: string;\n}) => {\n const { getAppByVersion } = useDevCenterClient();\n const createTunnelClient = useTunnel();\n const httpClient = useHttpClient({ type: 'backoffice' });\n const localServerPortResolverRef = useRef<(port: number) => void>();\n\n const server = useMemo(() => {\n return createServer((req, res) => {\n logsReqHandler(req, res)\n .onLog(onLog)\n .onError((code, err, info) => {\n server.close();\n throw new CliError({ code, cause: err, info });\n });\n });\n }, [onLog]);\n\n const localServerPortPromise = useMemo(() => {\n return new Promise<number>((resolve) => {\n localServerPortResolverRef.current = resolve;\n });\n }, []);\n\n useEffect(() => {\n server.listen(0, async () => {\n const port = (server.address() as AddressInfo).port;\n localServerPortResolverRef.current?.(port);\n });\n return () => {\n if (server.listening) {\n server.close();\n }\n };\n }, [server]);\n\n const { status } = useAsync(async () => {\n const localServerPort = await localServerPortPromise;\n const { url: tunnelUrl } = await createTunnelClient(localServerPort);\n const { data } = await getAppByVersion({ appId, version });\n\n const topologyComponent = data.components.find(\n (component): component is TopologyComponent => {\n return component.compType === ComponentType.TOPOLOGY;\n }\n );\n const match = deploymentIdRegex.exec(\n topologyComponent?.compData.topology.topology.backendApiUrl ?? ''\n );\n\n if (!match?.[1]) {\n throw new CliError({\n code: CliErrorCode.FailedToGetLogsTopology(),\n });\n }\n const deploymentId = match[1];\n\n const loggerReq = {\n appId,\n deploymentId,\n destinationUrl: new URL(LOGS_ENDPOINT, tunnelUrl).href,\n };\n\n try {\n await httpClient.request(attachLogger(loggerReq));\n } catch (error) {\n server.close();\n throw new CliError({\n code: CliErrorCode.FailedToConnectToLogsService(),\n cause: error,\n });\n }\n\n return deploymentId;\n }, []);\n\n useEffect(() => {\n // Logs should be deattached only on unmount.\n // This is why this `useEffect` has only `return` statement.\n return () => {\n if (isType(status, 'Success')) {\n httpClient.request(\n deattachLogger({\n appId,\n deploymentId: status.result,\n })\n );\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return status;\n};\n","import type { IncomingMessage, ServerResponse } from 'node:http';\nimport type { CliErrorCodeType } from '@wix/cli-error';\nimport { CliErrorCode } from '@wix/cli-error';\nimport { z } from 'zod';\nimport { variant, fields, match } from 'variant';\nimport type { VariantOf } from 'variant';\n\nconst LogMessageSchema = z.any();\nexport type LogMessage = z.infer<typeof LogMessageSchema>;\n\nconst LogMessageLevelSchema = z.enum(['info', 'error', 'warn', 'debug', 'log']);\nexport type LogMessageLevel = z.infer<typeof LogMessageLevelSchema>;\n\nconst LogItemSchema = z.object({\n message: z.array(LogMessageSchema),\n level: LogMessageLevelSchema,\n timestamp: z.number(),\n});\n\ntype LogItem = z.infer<typeof LogItemSchema>;\n\nconst ExceptionItemSchema = z.object({\n stack: z.string(),\n name: z.string(),\n message: z.string(),\n timestamp: z.number(),\n});\n\ntype ExceptionItem = z.infer<typeof ExceptionItemSchema>;\n\nconst LogResponseSchema = z\n .object({\n _type: z.literal('log'),\n exceptions: z.array(ExceptionItemSchema),\n logs: z.array(LogItemSchema),\n })\n .passthrough();\n\nconst SessionTimeoutResponseSchema = z\n .object({\n _type: z.literal('session-timeout'),\n })\n .passthrough();\n\nconst ServerLogResponseSchema = z.discriminatedUnion('_type', [\n LogResponseSchema,\n SessionTimeoutResponseSchema,\n]);\n\ntype ServerLogResponse = z.infer<typeof ServerLogResponseSchema>;\n\nconst AggregatedLog = variant({\n Log: fields<LogItem>(),\n Exception: fields<ExceptionItem>(),\n});\nexport type AggregatedLog = VariantOf<typeof AggregatedLog>;\n\nexport type OnLog = (data: AggregatedLog[]) => void;\nexport type OnError = (\n errType: CliErrorCodeType,\n err: unknown,\n info?: Record<string, unknown>\n) => void;\n\nexport const LOGS_ENDPOINT = '/logs';\n\nexport const logsReqHandler = (req: IncomingMessage, res: ServerResponse) => {\n let onLog: OnLog;\n let onError: OnError;\n\n if (req.method === 'POST' && req.url === LOGS_ENDPOINT) {\n let body = '';\n\n req.on('data', (chunk) => {\n body += chunk.toString();\n });\n\n req.on('end', () => {\n let parsedBody: ServerLogResponse;\n try {\n parsedBody = ServerLogResponseSchema.parse(JSON.parse(body));\n } catch (err) {\n onError(CliErrorCode.FailedToParseLog(), err, { body });\n res.statusCode = 400;\n return res.end();\n }\n\n const resultLogs: AggregatedLog[] = [];\n\n if (parsedBody._type === 'log') {\n resultLogs.push(\n ...parsedBody.exceptions.map((exception) =>\n AggregatedLog.Exception(exception)\n )\n );\n resultLogs.push(\n ...parsedBody.logs.map((log) => AggregatedLog.Log(log))\n );\n }\n\n match(parsedBody._type, {\n log: () => {\n onLog(resultLogs);\n },\n 'session-timeout': () => {\n res.statusCode = 200;\n res.end();\n\n onError(CliErrorCode.LogsConnectionTimeout(), {}, { body });\n },\n });\n\n res.statusCode = 200;\n res.end();\n });\n } else {\n res.statusCode = 404;\n res.end('Not Found');\n }\n\n const api = {\n onLog: (callback: OnLog) => {\n onLog = callback;\n return api;\n },\n onError: (callback: OnError) => {\n onError = callback;\n return api;\n },\n };\n\n return api;\n};\n","import React from 'react';\nimport type { FC } from 'react';\nimport { Text } from '@wix/cli-ui-kit';\nimport type { LogMessage, LogMessageLevel } from './logsReqHandler.js';\n\nexport const ServerLogMessage: FC<{\n message: LogMessage;\n level: LogMessageLevel;\n}> = ({ message, level }) => {\n let content = 'unknown';\n\n if (typeof message === 'object') {\n content = JSON.stringify(message);\n } else {\n content = String(message);\n }\n\n return <Text skin={level === 'error' ? 'error' : 'standard'}>{content}</Text>;\n};\n"],"mappings":";;sRAAAA,ICAAC,IACA,IAAAC,EAA+B,SAG/B,IAAAC,EAAuC,SCJvCC,IACA,IAAAC,EAA6C,SAC7CC,EAAsB,SCFtBC,IAAA,IAAAC,EAA2C,SAC3C,OAAS,gBAAAC,OAAoB,YAY7B,IAAAC,EAAuB,SCbvBC,IAIA,IAAAC,EAAuC,SAGjCC,GAAmBC,EAAE,IAAI,EAGzBC,GAAwBD,EAAE,KAAK,CAAC,OAAQ,QAAS,OAAQ,QAAS,KAAK,CAAC,EAGxEE,GAAgBF,EAAE,OAAO,CAC7B,QAASA,EAAE,MAAMD,EAAgB,EACjC,MAAOE,GACP,UAAWD,EAAE,OAAO,CACtB,CAAC,EAIKG,GAAsBH,EAAE,OAAO,CACnC,MAAOA,EAAE,OAAO,EAChB,KAAMA,EAAE,OAAO,EACf,QAASA,EAAE,OAAO,EAClB,UAAWA,EAAE,OAAO,CACtB,CAAC,EAIKI,GAAoBJ,EACvB,OAAO,CACN,MAAOA,EAAE,QAAQ,KAAK,EACtB,WAAYA,EAAE,MAAMG,EAAmB,EACvC,KAAMH,EAAE,MAAME,EAAa,CAC7B,CAAC,EACA,YAAY,EAETG,GAA+BL,EAClC,OAAO,CACN,MAAOA,EAAE,QAAQ,iBAAiB,CACpC,CAAC,EACA,YAAY,EAETM,GAA0BN,EAAE,mBAAmB,QAAS,CAC5DI,GACAC,EACF,CAAC,EAIKE,KAAgB,WAAQ,CAC5B,OAAK,UAAgB,EACrB,aAAW,UAAsB,CACnC,CAAC,EAUYC,EAAgB,QAEhBC,EAAiB,CAACC,EAAsBC,IAAwB,CAC3E,IAAIC,EACAC,EAEJ,GAAIH,EAAI,SAAW,QAAUA,EAAI,MAAQF,EAAe,CACtD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AC,CAAE,QAAAH,CAAQ,IAAM,CACpB,GAAM,CAAE,MAAAI,CAAM,EAAIC,EAAgB,EAE5BC,KAAmB,WAAQ,IAAMP,GAAc,CAAE,QAAAC,CAAQ,CAAC,EAAG,CAACA,CAAO,CAAC,EAE5E,SAAO,SAAMM,EAAkB,CAC7B,MAAO,CAAC,CAAE,QAAAN,CAAQ,IAChB,EAAAC,QAAA,cAACM,EAAA,CAAkB,QAASP,EAAS,MAAOI,EAAM,OAAO,MAAO,EAElE,MAAO,CAAC,CAAE,QAAAI,CAAQ,IAChB,EAAAP,QAAA,cAACQ,EAAA,CAAI,OAAQ,EAAG,UAAW,EAAG,aAAc,EAAG,cAAc,UAC3D,EAAAR,QAAA,cAACQ,EAAA,CAAI,IAAK,GACR,EAAAR,QAAA,cAACS,EAAA,CAAK,KAAK,SAASF,CAAQ,CAC9B,CACF,CAEJ,CAAC,CACH","names":["init_esm_shims","init_esm_shims","import_react","import_variant","init_esm_shims","import_react","import_variant","init_esm_shims","import_react","createServer","import_variant","init_esm_shims","import_variant","LogMessageSchema","z","LogMessageLevelSchema","LogItemSchema","ExceptionItemSchema","LogResponseSchema","SessionTimeoutResponseSchema","ServerLogResponseSchema","AggregatedLog","LOGS_ENDPOINT","logsReqHandler","req","res","onLog","onError","body","chunk","parsedBody","err","CliErrorCode","resultLogs","exception","log","api","callback","deploymentIdRegex","useLogsServer","onLog","version","appId","getAppByVersion","useDevCenterClient","createTunnelClient","useTunnel","httpClient","useHttpClient","localServerPortResolverRef","server","createServer","req","res","logsReqHandler","code","err","info","CliError","localServerPortPromise","resolve","port","status","useAsync","localServerPort","tunnelUrl","data","topologyComponent","component","ComponentType","match","CliErrorCode","deploymentId","loggerReq","LOGS_ENDPOINT","attachLogger","error","deattachLogger","init_esm_shims","import_react","ServerLogMessage","message","level","content","React","Text","DisplayServerLogs","version","appId","t","useTranslation","logs","setLogs","serverResult","useLogsServer","serverLogs","prevLogs","React","Box_default","Text","Trans","log","logIdx","message","level","msgItem","idx","ServerLogMessage","stack","Spinner","ValidationResult","validateInput","version","React","Trans","LogsCommand","model","useProjectModel","validationResult","DisplayServerLogs","message","Box_default","Text"]}
@@ -0,0 +1,4 @@
1
+ import { createRequire as _createRequire } from 'node:module';
2
+ const require = _createRequire(import.meta.url);
3
+ import{a}from"./chunk-VAOLKVA2.js";import"./chunk-TRE6G7GA.js";import"./chunk-QDPEZ5A2.js";import"./chunk-6QCQALVT.js";import"./chunk-BW3SDDV3.js";import"./chunk-QT3P4FJP.js";import"./chunk-IBNMP32R.js";import"./chunk-3Q7TAN43.js";import"./chunk-KLTGX7JQ.js";import"./chunk-4YU6J2EW.js";import"./chunk-MIBBNKYS.js";import"./chunk-R3JUFM5X.js";import"./chunk-V4TR6DCM.js";export{a as PreviewCommand};
4
+ //# sourceMappingURL=PreviewCommand-DWQCCBBZ.js.map
@@ -1,4 +1,4 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{a as D,b as L}from"./chunk-AXFFV5MU.js";import{b as U,c as K,d as N}from"./chunk-ZTMLHHUQ.js";import"./chunk-5POS3EQI.js";import"./chunk-DAPZQSXG.js";import{a as F,b as h}from"./chunk-5GXRNUOR.js";import{b as j}from"./chunk-PQFAL6B4.js";import{g as b,h as k,i as c,j as V}from"./chunk-SLG2HQYB.js";import{b as M}from"./chunk-E7IQZNJ7.js";import{lb as u}from"./chunk-TSKFLGBO.js";import{A as I,B as y,D as B,N as T,O as _,R as O,V as a,W as A,a as d,b as R,w as i,z as E}from"./chunk-JPGXKQXP.js";import{e as s,h as o}from"./chunk-V4TR6DCM.js";o();o();var S=s(d(),1);o();var n=s(d(),1),q=s(R(),1);o();var m=s(d(),1);import{preview as ee}from"vite";function W(){let t=(0,m.useRef)(),{model:r}=u();return(0,m.useEffect)(()=>()=>{t.current?.httpServer.close()},[]),(0,m.useCallback)(async()=>{let v=await ee(await h(r,{type:"build"}));return t.current=v,F(v)},[r])}var z=(0,n.createContext)(null),g=({children:t})=>{let{model:r}=u(),{t:v}=A(),{site:H}=c(),J=b(),{createOverride:Q}=K(),X=W(),{status:Y}=O(async()=>{await D(r.projectFolder);let p=await X(),x=await j(r.projectFolder),P=M(x,p),Z=await J.createAppRelease(P,r.config.projectId),C=N(r),{id:$}=C?await Q({appId:r.config.appId,siteId:H.id,overrides:C}):await Promise.resolve({id:void 0});return{armTag:Z,serverUrl:p,siteOverrideId:$}},[]);return(0,q.match)(Y,{Error:()=>null,Loading:()=>n.default.createElement(_,{text:v("serve_command.starting_serve_environment")}),Success:({result:{armTag:p,serverUrl:x,siteOverrideId:P}})=>n.default.createElement(z.Provider,{value:{serverUrl:x}},n.default.createElement(V,{siteOverrideId:P},n.default.createElement(k,{armTag:p},t)))})};function w(){let t=(0,n.useContext)(z);if(t===null)throw new Error("useServeEnvironment() cannot be used without an <ServeEnvironmentProvider>");return t}o();var e=s(d(),1);function G(){let{site:t}=c(),{serverUrl:r}=w();return e.default.createElement(i,{flexDirection:"column"},e.default.createElement(i,{gap:1},e.default.createElement(E,{skin:"success"},e.default.createElement(B,null)),e.default.createElement(a,{i18nKey:"serve_command.starting_serve_environment_success",components:[e.default.createElement(T,{url:r})]})),e.default.createElement(i,{gap:1},e.default.createElement(I,null),e.default.createElement(a,{i18nKey:"serve_command.production_build"})),e.default.createElement(i,{gap:1,paddingTop:1,paddingBottom:1},e.default.createElement(y,null),e.default.createElement(a,{i18nKey:"general.dev_site.current",values:{name:t.displayName}})),e.default.createElement(i,{paddingBottom:1,flexDirection:"column"},e.default.createElement(L,null)))}var re=()=>S.default.createElement(U,null,S.default.createElement(g,null,S.default.createElement(G,null)));export{re as ServeCommand,g as ServeEnvironmentProvider,w as useServeEnvironment};
4
- //# sourceMappingURL=ServeCommand-ZJMRR4ES.js.map
3
+ import{a as D,b as L}from"./chunk-TRE6G7GA.js";import{b as U,c as K,d as N}from"./chunk-QDPEZ5A2.js";import"./chunk-BW3SDDV3.js";import"./chunk-QT3P4FJP.js";import{a as F,b as h}from"./chunk-PBBKM3Z3.js";import{b as j}from"./chunk-3Q7TAN43.js";import{g as b,h as k,j as f,k as V}from"./chunk-KLTGX7JQ.js";import{b as M}from"./chunk-4YU6J2EW.js";import{mb as c}from"./chunk-MIBBNKYS.js";import{A as I,B as y,D as B,N as T,O as _,R as O,V as a,W as A,a as d,b as R,w as i,z as E}from"./chunk-R3JUFM5X.js";import{e as s,h as o}from"./chunk-V4TR6DCM.js";o();o();var S=s(d(),1);o();var n=s(d(),1),q=s(R(),1);o();var m=s(d(),1);import{preview as ee}from"vite";function W(){let t=(0,m.useRef)(),{model:r}=c();return(0,m.useEffect)(()=>()=>{t.current?.httpServer.close()},[]),(0,m.useCallback)(async()=>{let v=await ee(await h(r,{type:"build"}));return t.current=v,F(v)},[r])}var z=(0,n.createContext)(null),g=({children:t})=>{let{model:r}=c(),{t:v}=A(),{site:H}=f(),J=b(),{createOverride:Q}=K(),X=W(),{status:Y}=O(async()=>{await D(r.projectFolder);let p=await X(),x=await j(r.projectFolder),P=M(x,p),Z=await J.createAppRelease(P,r.config.projectId),C=N(r),{id:$}=C?await Q({appId:r.config.appId,siteId:H.id,overrides:C}):await Promise.resolve({id:void 0});return{armTag:Z,serverUrl:p,siteOverrideId:$}},[]);return(0,q.match)(Y,{Error:()=>null,Loading:()=>n.default.createElement(_,{text:v("serve_command.starting_serve_environment")}),Success:({result:{armTag:p,serverUrl:x,siteOverrideId:P}})=>n.default.createElement(z.Provider,{value:{serverUrl:x}},n.default.createElement(V,{siteOverrideId:P},n.default.createElement(k,{armTag:p},t)))})};function w(){let t=(0,n.useContext)(z);if(t===null)throw new Error("useServeEnvironment() cannot be used without an <ServeEnvironmentProvider>");return t}o();var e=s(d(),1);function G(){let{site:t}=f(),{serverUrl:r}=w();return e.default.createElement(i,{flexDirection:"column"},e.default.createElement(i,{gap:1},e.default.createElement(E,{skin:"success"},e.default.createElement(B,null)),e.default.createElement(a,{i18nKey:"serve_command.starting_serve_environment_success",components:[e.default.createElement(T,{url:r})]})),e.default.createElement(i,{gap:1},e.default.createElement(I,null),e.default.createElement(a,{i18nKey:"serve_command.production_build"})),e.default.createElement(i,{gap:1,paddingTop:1,paddingBottom:1},e.default.createElement(y,null),e.default.createElement(a,{i18nKey:"general.dev_site.current",values:{name:t.displayName}})),e.default.createElement(i,{paddingBottom:1,flexDirection:"column"},e.default.createElement(L,null)))}var re=()=>S.default.createElement(U,null,S.default.createElement(g,null,S.default.createElement(G,null)));export{re as ServeCommand,g as ServeEnvironmentProvider,w as useServeEnvironment};
4
+ //# sourceMappingURL=ServeCommand-T5PQKB57.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/ServeCommand/index.ts","../src/components/ServeCommand/ServeCommand.tsx","../src/components/ServeCommand/ServeEnvironment.tsx","../src/components/ServeCommand/hooks/usePreviewServer.ts","../src/components/ServeCommand/ServeCommandScreen.tsx"],"sourcesContent":["export { ServeCommand } from './ServeCommand.js';\nexport {\n ServeEnvironmentProvider,\n useServeEnvironment,\n} from './ServeEnvironment.js';\n","import React from 'react';\nimport type { FC } from 'react';\nimport { SiteIdProvider } from '../../site-id/SiteIdProvider.js';\nimport { ServeEnvironmentProvider } from './ServeEnvironment.js';\nimport { ServeCommandScreen } from './ServeCommandScreen.js';\n\nexport const ServeCommand: FC = () => {\n return (\n <SiteIdProvider>\n <ServeEnvironmentProvider>\n <ServeCommandScreen />\n </ServeEnvironmentProvider>\n </SiteIdProvider>\n );\n};\n","import React, { createContext, useContext } from 'react';\nimport type { FC, ReactNode } from 'react';\nimport { match } from 'variant';\nimport { updateAppManifestWithBaseUrl } from '@wix/cli-app-manifest';\nimport { useARMClient } from '@wix/arm-client';\nimport { Spinner, useAsync } from '@wix/cli-ui-kit';\nimport { useTranslation } from '@wix/cli-i18n';\nimport { useSiteOverrideClient } from '@wix/site-override-client';\nimport { ArmTagProvider } from '../../context/armTag.js';\nimport { readAppManifestFile } from '../../app-manifest/file.js';\nimport { assertBuildOutputExists } from '../../files/assert-build-output-exists.js';\nimport { usePreviewServer } from './hooks/usePreviewServer.js';\nimport { useProjectModel } from '../../model.js';\nimport { useSiteId } from '../../site-id/index.js';\nimport { createSiteOverrides } from '../../site-override/createSiteOverrides.js';\nimport { SiteOverrideProvider } from '../../context/siteOverride.js';\n\ninterface ServeEnvironment {\n serverUrl: string;\n}\n\nconst ServeEnvironmentContext = createContext<ServeEnvironment | null>(null);\n\nexport const ServeEnvironmentProvider: FC<{\n children: ReactNode;\n}> = ({ children }) => {\n const { model } = useProjectModel();\n const { t } = useTranslation();\n const { site } = useSiteId();\n const arm = useARMClient();\n const { createOverride } = useSiteOverrideClient();\n const createPreviewServer = usePreviewServer();\n\n const { status } = useAsync(async () => {\n await assertBuildOutputExists(model.projectFolder);\n const serverUrl = await createPreviewServer();\n\n const manifest = await readAppManifestFile(model.projectFolder);\n const updatedManifest = updateAppManifestWithBaseUrl(manifest, serverUrl);\n\n const armTag = await arm.createAppRelease(\n updatedManifest,\n model.config.projectId\n );\n\n const overrides = createSiteOverrides(model);\n const { id: siteOverrideId } = overrides\n ? await createOverride({\n appId: model.config.appId,\n siteId: site.id,\n overrides,\n })\n : await Promise.resolve({ id: undefined });\n\n return { armTag, serverUrl, siteOverrideId };\n }, []);\n\n return match(status, {\n Error: () => null,\n Loading: () => (\n <Spinner text={t('serve_command.starting_serve_environment')}></Spinner>\n ),\n Success: ({ result: { armTag, serverUrl, siteOverrideId } }) => (\n <ServeEnvironmentContext.Provider value={{ serverUrl }}>\n <SiteOverrideProvider siteOverrideId={siteOverrideId}>\n <ArmTagProvider armTag={armTag}>{children}</ArmTagProvider>\n </SiteOverrideProvider>\n </ServeEnvironmentContext.Provider>\n ),\n });\n};\n\nexport function useServeEnvironment(): ServeEnvironment {\n const context = useContext(ServeEnvironmentContext);\n if (context === null) {\n throw new Error(\n 'useServeEnvironment() cannot be used without an <ServeEnvironmentProvider>'\n );\n }\n return context;\n}\n","import { preview } from 'vite';\nimport type { PreviewServer } from 'vite';\nimport { useCallback, useEffect, useRef } from 'react';\nimport { useProjectModel } from '../../../model.js';\nimport { getClientViteConfig } from '../../../vite/index.js';\nimport { getViteServerUrl } from '../../../vite/vite-server-url.js';\nimport { ConfigType } from '../../../vite/vite-config-options.js';\n\nexport function usePreviewServer() {\n const previewServerRef = useRef<PreviewServer>();\n const { model } = useProjectModel();\n\n useEffect(() => {\n return () => {\n previewServerRef.current?.httpServer.close();\n };\n }, []);\n\n return useCallback(async () => {\n const previewServer = await preview(\n await getClientViteConfig(model, { type: ConfigType.build })\n );\n\n previewServerRef.current = previewServer;\n\n return getViteServerUrl(previewServer);\n }, [model]);\n}\n","import {\n Box,\n InfoIcon,\n Link,\n PointerIcon,\n SuccessIcon,\n Text,\n} from '@wix/cli-ui-kit';\nimport React from 'react';\nimport { Trans } from '@wix/cli-i18n';\nimport { useSiteId } from '../../site-id/useSiteId.js';\nimport { useServeEnvironment } from './ServeEnvironment.js';\nimport { PlatformViewer } from '../Platform/PlatformViewer.js';\n\nexport function ServeCommandScreen() {\n const { site } = useSiteId();\n const { serverUrl } = useServeEnvironment();\n\n return (\n <Box flexDirection=\"column\">\n <Box gap={1}>\n <Text skin=\"success\">\n <SuccessIcon />\n </Text>\n <Trans\n i18nKey=\"serve_command.starting_serve_environment_success\"\n components={[<Link url={serverUrl} />]}\n />\n </Box>\n <Box gap={1}>\n <InfoIcon />\n <Trans i18nKey=\"serve_command.production_build\" />\n </Box>\n <Box gap={1} paddingTop={1} paddingBottom={1}>\n <PointerIcon />\n <Trans\n i18nKey=\"general.dev_site.current\"\n values={{ name: site.displayName }}\n />\n </Box>\n <Box paddingBottom={1} flexDirection=\"column\">\n <PlatformViewer />\n </Box>\n </Box>\n );\n}\n"],"mappings":";;siBAAAA,ICAAC,IAAA,IAAAC,EAAkB,SCAlBC,IAAA,IAAAC,EAAiD,SAEjDC,EAAsB,SCFtBC,IAEA,IAAAC,EAA+C,SAF/C,OAAS,WAAAC,OAAe,OAQjB,SAASC,GAAmB,CACjC,IAA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ACA,EAAAI,QAAA,cAACC,EAAA,CAAI,cAAe,EAAG,cAAc,UACnC,EAAAD,QAAA,cAACQ,EAAA,IAAe,CAClB,CACF,CAEJ,CHvCO,IAAMC,GAAmB,IAE5B,EAAAC,QAAA,cAACC,EAAA,KACC,EAAAD,QAAA,cAACE,EAAA,KACC,EAAAF,QAAA,cAACG,EAAA,IAAmB,CACtB,CACF","names":["init_esm_shims","init_esm_shims","import_react","init_esm_shims","import_react","import_variant","init_esm_shims","import_react","preview","usePreviewServer","previewServerRef","model","useProjectModel","previewServer","preview","getViteConfig","getViteServerUrl","ServeEnvironmentContext","ServeEnvironmentProvider","children","model","useProjectModel","t","useTranslation","site","useSiteId","arm","useARMClient","createOverride","useSiteOverrideClient","createPreviewServer","usePreviewServer","status","useAsync","assertBuildOutputExists","serverUrl","manifest","readAppManifestFile","updatedManifest","updateAppManifestWithBaseUrl","armTag","overrides","createSiteOverrides","siteOverrideId","React","Spinner","SiteOverrideProvider","ArmTagProvider","useServeEnvironment","context","init_esm_shims","import_react","ServeCommandScreen","site","useSiteId","serverUrl","useServeEnvironment","React","Box_default","Text","SuccessIcon","Trans","Link","InfoIcon","PointerIcon","PlatformViewer","ServeCommand","React","SiteIdProvider","ServeEnvironmentProvider","ServeCommandScreen"]}
@@ -1,4 +1,4 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{a as s,c as u,d as f}from"./chunk-3ACKBLKR.js";import{b as m,c as d}from"./chunk-5GXRNUOR.js";import{a as l}from"./chunk-PQFAL6B4.js";import"./chunk-E7IQZNJ7.js";import{Xa as c,jb as a,ua as i}from"./chunk-TSKFLGBO.js";import{b as E,d as t,e as n}from"./chunk-JPGXKQXP.js";import{e as g,h as p}from"./chunk-V4TR6DCM.js";p();import{cwd as b}from"node:process";import{build as w}from"vite";var r=g(E(),1);async function M(){let o=await a(b());if(o.components.length===0)throw new t({code:n.NoExtensionsFound()});s(o.components);let C=o.components.filter(e=>(0,r.isType)(e,i.Api)||(0,r.isType)(e,i.Event)||(0,r.isType)(e,i.ServicePlugin)).length>0?await w(await d(o,{type:"build"},{appSecret:"__APP_SECRET__",webhooksPublicKey:"__WEBHOOKS_PUBLIC_KEY__"})).catch(e=>{throw new t({code:n.FailedToBuildApp({cause:e}),cause:e})}):void 0,_=await w(await m(o,{type:"build"},{baseBackendUrl:c})).catch(e=>{throw new t({code:n.FailedToBuildApp({cause:e}),cause:e})}),B=await u({appId:o.config.appId,components:o.components,sentryDSN:o.config.sentryDSN,componentSourceBuilder:f(o,{clientBuildOutput:_},{backendBuildOutput:C})});await l({projectFolder:o.projectFolder,manifest:B})}export{M as build};
4
- //# sourceMappingURL=build-6EB3DE3E.js.map
3
+ import{a as s,c as u,d as f}from"./chunk-35BUZ7CK.js";import{b as m,c as d}from"./chunk-PBBKM3Z3.js";import{a as l}from"./chunk-3Q7TAN43.js";import"./chunk-4YU6J2EW.js";import{Ya as c,kb as a,va as i}from"./chunk-MIBBNKYS.js";import{b as E,d as t,e as n}from"./chunk-R3JUFM5X.js";import{e as g,h as p}from"./chunk-V4TR6DCM.js";p();import{cwd as b}from"node:process";import{build as w}from"vite";var r=g(E(),1);async function M(){let o=await a(b());if(o.components.length===0)throw new t({code:n.NoExtensionsFound()});s(o.components);let C=o.components.filter(e=>(0,r.isType)(e,i.Api)||(0,r.isType)(e,i.Event)||(0,r.isType)(e,i.ServicePlugin)).length>0?await w(await d(o,{type:"build"},{appSecret:"__APP_SECRET__",webhooksPublicKey:"__WEBHOOKS_PUBLIC_KEY__"})).catch(e=>{throw new t({code:n.FailedToBuildApp({cause:e}),cause:e})}):void 0,_=await w(await m(o,{type:"build"},{baseBackendUrl:c})).catch(e=>{throw new t({code:n.FailedToBuildApp({cause:e}),cause:e})}),B=await u({appId:o.config.appId,components:o.components,sentryDSN:o.config.sentryDSN,componentSourceBuilder:f(o,{clientBuildOutput:_},{backendBuildOutput:C})});await l({projectFolder:o.projectFolder,manifest:B})}export{M as build};
4
+ //# sourceMappingURL=build-CNTVWU2X.js.map
@@ -1,4 +1,4 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{E as A,I as l,J as M,K as N,O as S,P as x,Q as O,R as U,ab as V,cb as W,ha as k,na as fe,oa as Ee,pa as R,qa as Ce,ta as L,ua as P,va as v,wa as F,ya as q}from"./chunk-TSKFLGBO.js";import{b,d as f,e as E}from"./chunk-JPGXKQXP.js";import{c as g,e as D,h as u}from"./chunk-V4TR6DCM.js";var H=g((lt,G)=>{"use strict";u();function Se(e,r,n,i){for(var d=e.length,o=n+(i?1:-1);i?o--:++o<d;)if(r(e[o],o,e))return o;return-1}G.exports=Se});var Y=g((mt,K)=>{"use strict";u();function ve(e){return e!==e}K.exports=ve});var X=g((ft,$)=>{"use strict";u();function ye(e,r,n){for(var i=n-1,d=e.length;++i<d;)if(e[i]===r)return i;return-1}$.exports=ye});var Z=g((Ct,z)=>{"use strict";u();var De=H(),Pe=Y(),be=X();function Ie(e,r,n){return r===r?be(e,r,n):De(e,Pe,n)}z.exports=Ie});var Q=g((St,J)=>{"use strict";u();var Te=Z();function _e(e,r){var n=e==null?0:e.length;return!!n&&Te(e,r,0)>-1}J.exports=_e});var te=g((yt,ee)=>{"use strict";u();function we(e,r,n){for(var i=-1,d=e==null?0:e.length;++i<d;)if(n(r,e[i]))return!0;return!1}ee.exports=we});var ie=g((Pt,re)=>{"use strict";u();function Be(){}re.exports=Be});var oe=g((It,ne)=>{"use strict";u();var I=Ce(),Ae=ie(),Me=R(),Ne=1/0,xe=I&&1/Me(new I([,-0]))[1]==Ne?function(e){return new I(e)}:Ae;ne.exports=xe});var se=g((_t,ae)=>{"use strict";u();var Oe=fe(),Ue=Q(),ke=te(),Re=Ee(),Le=oe(),Fe=R(),qe=200;function Ve(e,r,n){var i=-1,d=Ue,o=e.length,t=!0,c=[],s=c;if(n)t=!1,d=ke;else if(o>=qe){var a=r?null:Le(e);if(a)return Fe(a);t=!1,d=Re,s=new Oe}else s=r?[]:c;e:for(;++i<o;){var C=e[i],h=r?r(C):C;if(C=n||C!==0?C:0,t&&h===h){for(var B=s.length;B--;)if(s[B]===h)continue e;r&&s.push(h),c.push(C)}else d(s,h,n)||(s!==c&&s.push(h),c.push(C))}return c}ae.exports=Ve});var ue=g((Bt,de)=>{"use strict";u();var We=se();function je(e,r){return r=typeof r=="function"?r:void 0,e&&e.length?We(e,void 0,r):[]}de.exports=je});u();var y=D(b(),1);import{randomUUID as he}from"node:crypto";var j=e=>{let r=new Map;[...e.filter(o=>!(0,y.isType)(o,P.Api)&&!(0,y.isType)(o,P.Event)&&!(0,y.isType)(o,P.ServicePlugin))].sort((o,t)=>o.id.localeCompare(t.id)).forEach(o=>{let t=r.get(o.id)??[];t.push(o),r.set(o.id,t)});let d=new Map;if(r.forEach((o,t)=>{o.length>1&&d.set(t,o)}),d.size)throw new f({code:E.DuplicateComponentIdsError({issues:Array.from(d.entries()).map(([o,t])=>({id:o,components:t.map(c=>(0,y.match)(c,{DashboardPage:({title:s,relativePath:a})=>({name:s,type:"page",path:v(a,"json")}),DashboardPlugin:({title:s,relativePath:a})=>({name:s,type:"plugin",path:v(a,"json")}),DashboardMenuPlugin:({title:s,relativePath:a})=>({name:s,type:"menu-plugin",path:a}),DashboardModal:({title:s,relativePath:a})=>({name:s,type:"modal",path:v(a,"json")}),DashboardSidebarCategory:({label:s})=>({name:s,type:"sidebar-category",path:A}),EmbeddedScript:({relativePath:s})=>({name:s,type:"embedded-script",path:v(s,"json")}),CustomElement:({name:s,relativePath:a})=>({name:s,type:"custom-element",path:v(a,"json")}),Topology:({name:s})=>({name:s,type:"topology",path:""})})).sort((c,s)=>c.name.localeCompare(s.name)),suggestedId:he()}))})})};u();var T=D(b(),1),ce=D(ue(),1);import{randomUUID as Ge}from"node:crypto";function He(e){return e!=null&&e!==!1}var Ke=(e,r)=>{if(e.experiments)return{appId:r,componentId:e.id,spec:e.experiments.enabledBy,variantValue:"true"}},Ye=e=>({compId:e.id,compType:l.CUSTOM_ELEMENT_WIDGET,compName:e.name,compData:{customElementWidget:{base:{name:e.name},widgetData:{tagName:e.tagName,scriptType:O.ES_MODULE,scriptUrl:""},size:{width:{defaultWidth:e.width.defaultWidth,allowStretch:e.width.allowStretch,stretchByDefault:e.width.stretchByDefault},height:{defaultHeight:e.height.defaultHeight,heightMode:U.FIXED}},installation:{base:{autoAdd:e.installation?.autoAddToSite,essential:e.installation?.essential,maxInstances:e.installation?.essential?1:0},widget:{region:M.BODY}},behaviors:{},dependencies:e.dependencies}}});async function Ut({appId:e,components:r,sentryDSN:n,componentSourceBuilder:i}){j(r);let d=(await Promise.all(r.map((0,T.match)({DashboardPage:async t=>{let c=t.sentryDSN??n;return{compId:t.id,compType:l.BACK_OFFICE_PAGE,compData:{backOfficePage:{hostingPlatform:S.BUSINESS_MANAGER,fullPage:t.sidebar?.whenActive?.hideSidebar,hideInSidebar:t.sidebar?.disabled,priority:t.sidebar?.priority,routePath:t.route.slice(1),title:t.title,pageCategoryId:t.sidebar?.categoryId,activeSidebarPageId:t.sidebar?.whenActive?.selectedPageId,requiredPermission:t.requiredPermission,previousRoutePaths:t.additionalRoutes,...c?{errorReporting:{url:c}}:void 0,...await i(t)}},compName:t.title,experiment:Ke(t,e)}},DashboardPlugin:async t=>({compId:t.id,compType:l.BACK_OFFICE_EXTENSION_WIDGET,compData:{backOfficeExtensionWidget:{hostingPlatform:S.BUSINESS_MANAGER,extends:t.extends,title:t.title,requiredPermission:t.requiredPermission,width:t.width,height:t.height,...await i(t),...t.sentryDSN?{errorReporting:{url:t.sentryDSN}}:void 0}},compName:t.title}),DashboardMenuPlugin:async t=>({compId:t.id,compType:l.BACK_OFFICE_EXTENSION_MENU_ITEM,compData:{backOfficeExtensionMenuItem:{hostingPlatform:S.BUSINESS_MANAGER,id:t.id,title:t.title,subtitle:t.subtitle,iconKey:t.iconKey,extends:t.extends,action:t.action,requiredPermission:t.requiredPermission,...t.sentryDSN?{errorReporting:{url:t.sentryDSN}}:void 0}},compName:t.title}),DashboardModal:async t=>({compId:t.id,compType:l.BACK_OFFICE_MODAL,compData:{backOfficeModal:{hostingPlatform:S.BUSINESS_MANAGER,title:t.title,requiredPermission:t.requiredPermission,width:t.width,height:t.height,...await i(t),...t.sentryDSN?{errorReporting:{url:t.sentryDSN}}:void 0}},compName:t.title}),DashboardSidebarCategory:async t=>({compId:t.id,compType:l.BACK_OFFICE_SIDEBAR_CATEGORY,compData:{backOfficeSidebarCategory:{hostingPlatform:S.BUSINESS_MANAGER,title:t.label,priority:t.priority}},compName:t.label}),EmbeddedScript:async t=>({compId:t.id,compType:l.EMBEDDED_SCRIPT,compName:t.name,compData:{embeddedScriptComponentData:{name:t.name,pages:N.NONE_PAGES,placement:t.placement,connectArticleUrl:"",embedCategory:t.scriptType,dependencies:t.dependencies,loadOnce:!0,allowedForFreeSite:!0,...await i(t)}}}),CustomElement:async t=>{let{scriptUrl:c,settingsUrl:s}=await i(t),a=Ye(t);return{...a,compData:{customElementWidget:{...a.compData.customElementWidget,widgetData:{...a.compData.customElementWidget.widgetData,scriptUrl:c},behaviors:{...a.compData.customElementWidget.behaviors,...t.relativePanelPath?{settings:{settingsUrl:s}}:{}}}}}},Topology:async t=>({compId:t.id,compType:l.TOPOLOGY,compName:t.name,compData:{topology:{topology:{backendApiUrl:t.backendApiUrl}}}}),Api:()=>null,Event:async t=>(await i(t)).map(({webhookSlug:s})=>({compName:s,compId:Ge(),compType:l.WEBHOOK,compData:{webhook:{callbackUrl:"__WEBHOOKS_URL_PLACEHOLDER__",webhookSlug:s}}})),ServicePlugin:async t=>{let c=(0,T.match)(t.servicePlugin,{EcomShippingRates:a=>({compName:a.name,compId:a.id,compType:l.ECOM_SHIPPING_RATES,compData:{ecomShippingRates:{name:a.name,deploymentUri:"__SERVICE_PLUGIN_URL_PLACEHOLDER__",description:a.description,learnMoreUrl:a.learnMoreUrl,dashboardUrl:a.dashboardUrl,fallbackDefinitionMandatory:a.fallbackDefinitionMandatory,thumbnailUrl:a.thumbnailUrl}}}),EcomAdditionalFees:a=>({compName:a.name,compId:a.id,compType:l.ECOM_ADDITIONAL_FEES,compData:{ecomAdditionalFees:{deploymentUri:"__SERVICE_PLUGIN_URL_PLACEHOLDER__"}}}),EcomDiscountsTrigger:a=>({compName:a.name,compId:a.id,compType:l.ECOM_DISCOUNTS_TRIGGER,compData:{ecomDiscountsTrigger:{deploymentUri:"__SERVICE_PLUGIN_URL_PLACEHOLDER__"}}}),EcomValidations:a=>({compName:a.name,compId:a.id,compType:l.ECOM_VALIDATIONS,compData:{ecomValidations:{deploymentUri:"__SERVICE_PLUGIN_URL_PLACEHOLDER__",validateInCart:a.validateInCart}}}),EcomPaymentSettings:a=>({compName:a.name,compId:a.id,compType:l.ECOM_PAYMENT_SETTINGS,compData:{ecomPaymentSettings:{deploymentUri:"__SERVICE_PLUGIN_URL_PLACEHOLDER__",fallbackValueForRequires3dSecure:a.fallbackValueForRequires3dSecure}}})}),{servicePluginType:s}=await i(t);if(c.compType!==s)throw new f({code:E.InvalidServicePluginImplementation({configuredImplementation:c.compType})});return c}})))).filter(He).flat(),o=(0,ce.default)(d,(t,c)=>t.compType===l.WEBHOOK&&c.compType===l.WEBHOOK&&t.compData.webhook.webhookSlug===c.compData.webhook.webhookSlug);return{appId:e,components:o}}u();var me=D(b(),1);import{join as $e}from"node:path";u();function le(e){if(!("output"in e||Array.isArray(e)))throw new f({code:E.InvalidViteBuildOutput()});return Array.isArray(e)?e.flatMap(i=>i.output):e.output}function _(e,r){let i=le(e).find(d=>d.type==="chunk"&&d.facadeModuleId===r);if(!i)throw new f({code:E.ViteModuleBundleNotFound()});return i.fileName}function pe(e,r){let i=le(e).find(d=>d.fileName===r);if(!i||!("source"in i))throw new f({code:E.ViteFileNotFoundInOutput({fileName:r})});return i.source.toString()}async function Xe(e,r){let n=new URL(e.relativePath,r).href;return await fetch(n).then(d=>d.text())}async function ze(e,r){let n=new URL("__get-registered-events",r).href,i=await fetch(n);return i.ok?(await i.json())[`/${e.relativePath}`]??[]:[]}async function ge(e){let r=k(e.projectFolder);return import($e(r,"getRegisteredExtensions.mjs"))}async function Ze(e,r){let{getRegisteredEvents:n}=await ge(r);return(await n())[`/${e.relativePath}`]}async function Je(e,r){let n=new URL("__get-registered-service-plugins",r).href,i=await fetch(n);return i.ok?(await i.json())[`/${e.relativePath}`]:null}async function Qe(e,r){let{getRegisteredServicePlugins:n}=await ge(r);return(await n())[`/${e.relativePath}`]}var w=(e,r,n)=>{if(!r.config.trusted)return{iframeUrl:F(e.id)};let i=q(e.id),d=n.clientBuildOutput?_(n.clientBuildOutput,i):`/@id/${i}?import`;return{scriptAsset:{exportedName:e.id,containerId:r.config.appId,url:d,scriptType:x.MODULE}}},et=async(e,{clientBuildOutput:r,clientDevServerUrl:n})=>({template:r?pe(r,e.relativePath):await Xe(e,n)}),tt=async(e,r,n)=>{let i=n.backendDevServerUrl?await ze(e,n.backendDevServerUrl):await Ze(e,r);return(i?await Promise.all(i.map(L)):[]).map(o=>({webhookSlug:o}))},rt=async(e,r,n)=>{let i=n.backendDevServerUrl?await Je(e,n.backendDevServerUrl):await Qe(e,r);if(!i)throw new Error("could not find service plugin definition");return{servicePluginType:i}},it=(e,r)=>{let n=W(e.id);return{scriptUrl:r.clientBuildOutput?_(r.clientBuildOutput,n):`/@id/${n}?import`,settingsUrl:V(e.id)}};function $t(e,r,n){return async i=>(0,me.match)(i,{EmbeddedScript:o=>et(o,r),DashboardSidebarCategory:()=>{},CustomElement:o=>it(o,r),DashboardPage:o=>w(o,e,r),DashboardPlugin:o=>w(o,e,r),DashboardModal:o=>w(o,e,r),DashboardMenuPlugin:()=>{},Topology:()=>{},Api:()=>{},Event:o=>tt(o,e,n),ServicePlugin:o=>rt(o,e,n)})}export{j as a,Ye as b,Ut as c,$t as d};
4
- //# sourceMappingURL=chunk-3ACKBLKR.js.map
3
+ import{F as A,J as l,K as M,L as N,P as S,Q as x,R as U,S as O,bb as V,db as W,ia as k,oa as fe,pa as Ee,qa as R,ra as Ce,ua as L,va as P,wa as v,xa as F,za as q}from"./chunk-MIBBNKYS.js";import{b,d as f,e as E}from"./chunk-R3JUFM5X.js";import{c as g,e as D,h as c}from"./chunk-V4TR6DCM.js";var H=g((pt,G)=>{"use strict";c();function Se(e,r,n,i){for(var d=e.length,o=n+(i?1:-1);i?o--:++o<d;)if(r(e[o],o,e))return o;return-1}G.exports=Se});var Y=g((gt,K)=>{"use strict";c();function ve(e){return e!==e}K.exports=ve});var X=g((Et,$)=>{"use strict";c();function ye(e,r,n){for(var i=n-1,d=e.length;++i<d;)if(e[i]===r)return i;return-1}$.exports=ye});var Z=g((ht,z)=>{"use strict";c();var De=H(),Pe=Y(),be=X();function Ie(e,r,n){return r===r?be(e,r,n):De(e,Pe,n)}z.exports=Ie});var Q=g((vt,J)=>{"use strict";c();var Te=Z();function _e(e,r){var n=e==null?0:e.length;return!!n&&Te(e,r,0)>-1}J.exports=_e});var te=g((Dt,ee)=>{"use strict";c();function we(e,r,n){for(var i=-1,d=e==null?0:e.length;++i<d;)if(n(r,e[i]))return!0;return!1}ee.exports=we});var ie=g((bt,re)=>{"use strict";c();function Be(){}re.exports=Be});var oe=g((Tt,ne)=>{"use strict";c();var I=Ce(),Ae=ie(),Me=R(),Ne=1/0,xe=I&&1/Me(new I([,-0]))[1]==Ne?function(e){return new I(e)}:Ae;ne.exports=xe});var se=g((wt,ae)=>{"use strict";c();var Ue=fe(),Oe=Q(),ke=te(),Re=Ee(),Le=oe(),Fe=R(),qe=200;function Ve(e,r,n){var i=-1,d=Oe,o=e.length,t=!0,u=[],s=u;if(n)t=!1,d=ke;else if(o>=qe){var a=r?null:Le(e);if(a)return Fe(a);t=!1,d=Re,s=new Ue}else s=r?[]:u;e:for(;++i<o;){var C=e[i],h=r?r(C):C;if(C=n||C!==0?C:0,t&&h===h){for(var B=s.length;B--;)if(s[B]===h)continue e;r&&s.push(h),u.push(C)}else d(s,h,n)||(s!==u&&s.push(h),u.push(C))}return u}ae.exports=Ve});var ce=g((At,de)=>{"use strict";c();var We=se();function je(e,r){return r=typeof r=="function"?r:void 0,e&&e.length?We(e,void 0,r):[]}de.exports=je});c();var y=D(b(),1);import{randomUUID as he}from"node:crypto";var j=e=>{let r=new Map;[...e.filter(o=>!(0,y.isType)(o,P.Api)&&!(0,y.isType)(o,P.Event)&&!(0,y.isType)(o,P.ServicePlugin))].sort((o,t)=>o.id.localeCompare(t.id)).forEach(o=>{let t=r.get(o.id)??[];t.push(o),r.set(o.id,t)});let d=new Map;if(r.forEach((o,t)=>{o.length>1&&d.set(t,o)}),d.size)throw new f({code:E.DuplicateComponentIdsError({issues:Array.from(d.entries()).map(([o,t])=>({id:o,components:t.map(u=>(0,y.match)(u,{DashboardPage:({title:s,relativePath:a})=>({name:s,type:"page",path:v(a,"json")}),DashboardPlugin:({title:s,relativePath:a})=>({name:s,type:"plugin",path:v(a,"json")}),DashboardMenuPlugin:({title:s,relativePath:a})=>({name:s,type:"menu-plugin",path:a}),DashboardModal:({title:s,relativePath:a})=>({name:s,type:"modal",path:v(a,"json")}),DashboardSidebarCategory:({label:s})=>({name:s,type:"sidebar-category",path:A}),EmbeddedScript:({relativePath:s})=>({name:s,type:"embedded-script",path:v(s,"json")}),CustomElement:({name:s,relativePath:a})=>({name:s,type:"custom-element",path:v(a,"json")}),Topology:({name:s})=>({name:s,type:"topology",path:""})})).sort((u,s)=>u.name.localeCompare(s.name)),suggestedId:he()}))})})};c();var T=D(b(),1),ue=D(ce(),1);import{randomUUID as Ge}from"node:crypto";function He(e){return e!=null&&e!==!1}var Ke=(e,r)=>{if(e.experiments)return{appId:r,componentId:e.id,spec:e.experiments.enabledBy,variantValue:"true"}},Ye=e=>({compId:e.id,compType:l.CUSTOM_ELEMENT_WIDGET,compName:e.name,compData:{customElementWidget:{base:{name:e.name},widgetData:{tagName:e.tagName,scriptType:U.ES_MODULE,scriptUrl:""},size:{width:{defaultWidth:e.width.defaultWidth,allowStretch:e.width.allowStretch,stretchByDefault:e.width.stretchByDefault},height:{defaultHeight:e.height.defaultHeight,heightMode:O.FIXED}},installation:{base:{autoAdd:e.installation?.autoAddToSite,essential:e.installation?.essential,maxInstances:e.installation?.essential?1:0},widget:{region:M.BODY}},behaviors:{},dependencies:e.dependencies}}});async function kt({appId:e,components:r,sentryDSN:n,componentSourceBuilder:i}){j(r);let d=(await Promise.all(r.map((0,T.match)({DashboardPage:async t=>{let u=t.sentryDSN??n;return{compId:t.id,compType:l.BACK_OFFICE_PAGE,compData:{backOfficePage:{hostingPlatform:S.BUSINESS_MANAGER,fullPage:t.sidebar?.whenActive?.hideSidebar,hideInSidebar:t.sidebar?.disabled,priority:t.sidebar?.priority,routePath:t.route.slice(1),title:t.title,pageCategoryId:t.sidebar?.categoryId,activeSidebarPageId:t.sidebar?.whenActive?.selectedPageId,requiredPermission:t.requiredPermission,previousRoutePaths:t.additionalRoutes,...u?{errorReporting:{url:u}}:void 0,...await i(t)}},compName:t.title,experiment:Ke(t,e)}},DashboardPlugin:async t=>({compId:t.id,compType:l.BACK_OFFICE_EXTENSION_WIDGET,compData:{backOfficeExtensionWidget:{hostingPlatform:S.BUSINESS_MANAGER,extends:t.extends,title:t.title,requiredPermission:t.requiredPermission,width:t.width,height:t.height,...await i(t),...t.sentryDSN?{errorReporting:{url:t.sentryDSN}}:void 0}},compName:t.title}),DashboardMenuPlugin:async t=>({compId:t.id,compType:l.BACK_OFFICE_EXTENSION_MENU_ITEM,compData:{backOfficeExtensionMenuItem:{hostingPlatform:S.BUSINESS_MANAGER,id:t.id,title:t.title,subtitle:t.subtitle,iconKey:t.iconKey,extends:t.extends,action:t.action,requiredPermission:t.requiredPermission,...t.sentryDSN?{errorReporting:{url:t.sentryDSN}}:void 0}},compName:t.title}),DashboardModal:async t=>({compId:t.id,compType:l.BACK_OFFICE_MODAL,compData:{backOfficeModal:{hostingPlatform:S.BUSINESS_MANAGER,title:t.title,requiredPermission:t.requiredPermission,width:t.width,height:t.height,...await i(t),...t.sentryDSN?{errorReporting:{url:t.sentryDSN}}:void 0}},compName:t.title}),DashboardSidebarCategory:async t=>({compId:t.id,compType:l.BACK_OFFICE_SIDEBAR_CATEGORY,compData:{backOfficeSidebarCategory:{hostingPlatform:S.BUSINESS_MANAGER,title:t.label,priority:t.priority}},compName:t.label}),EmbeddedScript:async t=>({compId:t.id,compType:l.EMBEDDED_SCRIPT,compName:t.name,compData:{embeddedScriptComponentData:{name:t.name,pages:N.NONE_PAGES,placement:t.placement,connectArticleUrl:"",embedCategory:t.scriptType,dependencies:t.dependencies,loadOnce:!0,allowedForFreeSite:!0,...await i(t)}}}),CustomElement:async t=>{let{scriptUrl:u,settingsUrl:s}=await i(t),a=Ye(t);return{...a,compData:{customElementWidget:{...a.compData.customElementWidget,widgetData:{...a.compData.customElementWidget.widgetData,scriptUrl:u},behaviors:{...a.compData.customElementWidget.behaviors,...t.relativePanelPath?{settings:{settingsUrl:s}}:{}}}}}},Topology:async t=>({compId:t.id,compType:l.TOPOLOGY,compName:t.name,compData:{topology:{topology:{backendApiUrl:t.backendApiUrl}}}}),Api:()=>null,Event:async t=>(await i(t)).map(({webhookSlug:s})=>({compName:s,compId:Ge(),compType:l.WEBHOOK,compData:{webhook:{callbackUrl:"__WEBHOOKS_URL_PLACEHOLDER__",webhookSlug:s}}})),ServicePlugin:async t=>{let u=(0,T.match)(t.servicePlugin,{EcomShippingRates:a=>({compName:a.name,compId:a.id,compType:l.ECOM_SHIPPING_RATES,compData:{ecomShippingRates:{name:a.name,deploymentUri:"__SERVICE_PLUGIN_URL_PLACEHOLDER__",description:a.description,learnMoreUrl:a.learnMoreUrl,dashboardUrl:a.dashboardUrl,fallbackDefinitionMandatory:a.fallbackDefinitionMandatory,thumbnailUrl:a.thumbnailUrl}}}),EcomAdditionalFees:a=>({compName:a.name,compId:a.id,compType:l.ECOM_ADDITIONAL_FEES,compData:{ecomAdditionalFees:{deploymentUri:"__SERVICE_PLUGIN_URL_PLACEHOLDER__"}}}),EcomDiscountsTrigger:a=>({compName:a.name,compId:a.id,compType:l.ECOM_DISCOUNTS_TRIGGER,compData:{ecomDiscountsTrigger:{deploymentUri:"__SERVICE_PLUGIN_URL_PLACEHOLDER__"}}}),EcomValidations:a=>({compName:a.name,compId:a.id,compType:l.ECOM_VALIDATIONS,compData:{ecomValidations:{deploymentUri:"__SERVICE_PLUGIN_URL_PLACEHOLDER__",validateInCart:a.validateInCart}}}),EcomPaymentSettings:a=>({compName:a.name,compId:a.id,compType:l.ECOM_PAYMENT_SETTINGS,compData:{ecomPaymentSettings:{deploymentUri:"__SERVICE_PLUGIN_URL_PLACEHOLDER__",fallbackValueForRequires3dSecure:a.fallbackValueForRequires3dSecure}}})}),{servicePluginType:s}=await i(t);if(u.compType!==s)throw new f({code:E.InvalidServicePluginImplementation({configuredImplementation:u.compType})});return u}})))).filter(He).flat(),o=(0,ue.default)(d,(t,u)=>t.compType===l.WEBHOOK&&u.compType===l.WEBHOOK&&t.compData.webhook.webhookSlug===u.compData.webhook.webhookSlug);return{appId:e,components:o}}c();var me=D(b(),1);import{join as $e}from"node:path";import{pathToFileURL as Xe}from"node:url";c();function le(e){if(!("output"in e||Array.isArray(e)))throw new f({code:E.InvalidViteBuildOutput()});return Array.isArray(e)?e.flatMap(i=>i.output):e.output}function _(e,r){let i=le(e).find(d=>d.type==="chunk"&&d.facadeModuleId===r);if(!i)throw new f({code:E.ViteModuleBundleNotFound()});return i.fileName}function pe(e,r){let i=le(e).find(d=>d.fileName===r);if(!i||!("source"in i))throw new f({code:E.ViteFileNotFoundInOutput({fileName:r})});return i.source.toString()}async function ze(e,r){let n=new URL(e.relativePath,r).href;return await fetch(n).then(d=>d.text())}async function Ze(e,r){let n=new URL("__get-registered-events",r).href,i=await fetch(n);return i.ok?(await i.json())[`/${e.relativePath}`]??[]:[]}async function ge(e){let r=k(e.projectFolder),n=$e(r,"getRegisteredExtensions.mjs");return import(Xe(n).href)}async function Je(e,r){let{getRegisteredEvents:n}=await ge(r);return(await n())[`/${e.relativePath}`]}async function Qe(e,r){let n=new URL("__get-registered-service-plugins",r).href,i=await fetch(n);return i.ok?(await i.json())[`/${e.relativePath}`]:null}async function et(e,r){let{getRegisteredServicePlugins:n}=await ge(r);return(await n())[`/${e.relativePath}`]}var w=(e,r,n)=>{if(!r.config.trusted)return{iframeUrl:F(e.id)};let i=q(e.id),d=n.clientBuildOutput?_(n.clientBuildOutput,i):`/@id/${i}?import`;return{scriptAsset:{exportedName:e.id,containerId:r.config.appId,url:d,scriptType:x.MODULE}}},tt=async(e,{clientBuildOutput:r,clientDevServerUrl:n})=>({template:r?pe(r,e.relativePath):await ze(e,n)}),rt=async(e,r,n)=>{let i=n.backendDevServerUrl?await Ze(e,n.backendDevServerUrl):await Je(e,r);return(i?await Promise.all(i.map(L)):[]).map(o=>({webhookSlug:o}))},it=async(e,r,n)=>{let i=n.backendDevServerUrl?await Qe(e,n.backendDevServerUrl):await et(e,r);if(!i)throw new Error("could not find service plugin definition");return{servicePluginType:i}},nt=(e,r)=>{let n=W(e.id);return{scriptUrl:r.clientBuildOutput?_(r.clientBuildOutput,n):`/@id/${n}?import`,settingsUrl:V(e.id)}};function zt(e,r,n){return async i=>(0,me.match)(i,{EmbeddedScript:o=>tt(o,r),DashboardSidebarCategory:()=>{},CustomElement:o=>nt(o,r),DashboardPage:o=>w(o,e,r),DashboardPlugin:o=>w(o,e,r),DashboardModal:o=>w(o,e,r),DashboardMenuPlugin:()=>{},Topology:()=>{},Api:()=>{},Event:o=>rt(o,e,n),ServicePlugin:o=>it(o,e,n)})}export{j as a,Ye as b,kt as c,zt as d};
4
+ //# sourceMappingURL=chunk-35BUZ7CK.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/lodash/_baseFindIndex.js","../../../node_modules/lodash/_baseIsNaN.js","../../../node_modules/lodash/_strictIndexOf.js","../../../node_modules/lodash/_baseIndexOf.js","../../../node_modules/lodash/_arrayIncludes.js","../../../node_modules/lodash/_arrayIncludesWith.js","../../../node_modules/lodash/noop.js","../../../node_modules/lodash/_createSet.js","../../../node_modules/lodash/_baseUniq.js","../../../node_modules/lodash/uniqWith.js","../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":["/**\n * The base implementation of `_.findIndex` and `_.findLastIndex` without\n * support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} predicate The function invoked per iteration.\n * @param {number} fromIndex The index to search from.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction baseFindIndex(array, predicate, fromIndex, fromRight) {\n var length = array.length,\n index = fromIndex + (fromRight ? 1 : -1);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (predicate(array[index], index, array)) {\n return index;\n }\n }\n return -1;\n}\n\nmodule.exports = baseFindIndex;\n","/**\n * The base implementation of `_.isNaN` without support for number objects.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n */\nfunction baseIsNaN(value) {\n return value !== value;\n}\n\nmodule.exports = baseIsNaN;\n","/**\n * A specialized version of `_.indexOf` which performs strict equality\n * comparisons of values, i.e. `===`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction strictIndexOf(array, value, fromIndex) {\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (array[index] === value) {\n return index;\n }\n }\n return -1;\n}\n\nmodule.exports = strictIndexOf;\n","var baseFindIndex = require('./_baseFindIndex'),\n baseIsNaN = require('./_baseIsNaN'),\n strictIndexOf = require('./_strictIndexOf');\n\n/**\n * The base implementation of `_.indexOf` without `fromIndex` bounds checks.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction baseIndexOf(array, value, fromIndex) {\n return value === value\n ? strictIndexOf(array, value, fromIndex)\n : baseFindIndex(array, baseIsNaN, fromIndex);\n}\n\nmodule.exports = baseIndexOf;\n","var baseIndexOf = require('./_baseIndexOf');\n\n/**\n * A specialized version of `_.includes` for arrays without support for\n * specifying an index to search from.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\nfunction arrayIncludes(array, value) {\n var length = array == null ? 0 : array.length;\n return !!length && baseIndexOf(array, value, 0) > -1;\n}\n\nmodule.exports = arrayIncludes;\n","/**\n * This function is like `arrayIncludes` except that it accepts a comparator.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @param {Function} comparator The comparator invoked per element.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\nfunction arrayIncludesWith(array, value, comparator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (comparator(value, array[index])) {\n return true;\n }\n }\n return false;\n}\n\nmodule.exports = arrayIncludesWith;\n","/**\n * This method returns `undefined`.\n *\n * @static\n * @memberOf _\n * @since 2.3.0\n * @category Util\n * @example\n *\n * _.times(2, _.noop);\n * // => [undefined, undefined]\n */\nfunction noop() {\n // No operation performed.\n}\n\nmodule.exports = noop;\n","var Set = require('./_Set'),\n noop = require('./noop'),\n setToArray = require('./_setToArray');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Creates a set object of `values`.\n *\n * @private\n * @param {Array} values The values to add to the set.\n * @returns {Object} Returns the new set.\n */\nvar createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {\n return new Set(values);\n};\n\nmodule.exports = createSet;\n","var SetCache = require('./_SetCache'),\n arrayIncludes = require('./_arrayIncludes'),\n arrayIncludesWith = require('./_arrayIncludesWith'),\n cacheHas = require('./_cacheHas'),\n createSet = require('./_createSet'),\n setToArray = require('./_setToArray');\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * The base implementation of `_.uniqBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n */\nfunction baseUniq(array, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n length = array.length,\n isCommon = true,\n result = [],\n seen = result;\n\n if (comparator) {\n isCommon = false;\n includes = arrayIncludesWith;\n }\n else if (length >= LARGE_ARRAY_SIZE) {\n var set = iteratee ? null : createSet(array);\n if (set) {\n return setToArray(set);\n }\n isCommon = false;\n includes = cacheHas;\n seen = new SetCache;\n }\n else {\n seen = iteratee ? [] : result;\n }\n outer:\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value;\n\n value = (comparator || value !== 0) ? value : 0;\n if (isCommon && computed === computed) {\n var seenIndex = seen.length;\n while (seenIndex--) {\n if (seen[seenIndex] === computed) {\n continue outer;\n }\n }\n if (iteratee) {\n seen.push(computed);\n }\n result.push(value);\n }\n else if (!includes(seen, computed, comparator)) {\n if (seen !== result) {\n seen.push(computed);\n }\n result.push(value);\n }\n }\n return result;\n}\n\nmodule.exports = baseUniq;\n","var baseUniq = require('./_baseUniq');\n\n/**\n * This method is like `_.uniq` except that it accepts `comparator` which\n * is invoked to compare elements of `array`. The order of result values is\n * determined by the order they occur in the array.The comparator is invoked\n * with two arguments: (arrVal, othVal).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];\n *\n * _.uniqWith(objects, _.isEqual);\n * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]\n */\nfunction uniqWith(array, comparator) {\n comparator = typeof comparator == 'function' ? comparator : undefined;\n return (array && array.length) ? baseUniq(array, undefined, comparator) : [];\n}\n\nmodule.exports = uniqWith;\n","import { randomUUID } from 'node:crypto';\nimport { isType, 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 { BackendComponent } from '../dev-center/components/dev-center-component.js';\nimport { DevCenterComponent } from '../dev-center/components/dev-center-component.js';\n\ntype NonBackendComponent = Exclude<DevCenterComponent, BackendComponent>;\n\nexport const validateComponents = (components: DevCenterComponent[]) => {\n const devCenterComponentsToIdMap = new Map<string, NonBackendComponent[]>();\n\n const componentsWithConfig = components.filter(\n (component): component is NonBackendComponent =>\n !isType(component, DevCenterComponent.Api) &&\n !isType(component, DevCenterComponent.Event) &&\n !isType(component, DevCenterComponent.ServicePlugin)\n );\n\n const sortedComponentsById = [...componentsWithConfig].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 = new Map<\n string,\n NonBackendComponent[]\n >();\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 Topology: ({ name }) => ({\n name,\n type: 'topology' as const,\n // Topology component doesn't have a config file\n path: '',\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 { randomUUID } from 'node:crypto';\nimport uniqWith from 'lodash/uniqWith.js';\nimport type {\n AppManifest,\n ComponentExperiment,\n BackofficePage,\n BackofficeExtensionWidget,\n BackofficeExtensionMenuItem,\n BackofficeSideCategory,\n BackofficeModal,\n EmbeddedScript,\n CustomElement,\n Webhook,\n ServicePlugin,\n Topology,\n EcomShippingRates,\n EcomAdditionalFees,\n EcomDiscountsTrigger,\n EcomValidations,\n EcomPaymentSettings,\n} from '@wix/cli-app-manifest';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { validateComponents } from './validate.js';\nimport type { DevCenterComponent } from '../dev-center/components/dev-center-component.js';\nimport type { ComponentSourceBuilder } from './component-source.js';\n\ninterface CreateAppManifestParams {\n appId: string;\n backendServerUrl?: string;\n components: DevCenterComponent[];\n sentryDSN?: string;\n componentSourceBuilder: ComponentSourceBuilder;\n}\n\nfunction isTruthy<T>(x: T | undefined | null | false): x is T {\n return x !== undefined && x !== null && x !== false;\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 const createCustomElementConfig = (\n component: DevCenterComponent<'CustomElement'>\n): CustomElement => {\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?.essential ? 1 : 0,\n },\n widget: { region: RegionType.BODY },\n },\n behaviors: {},\n dependencies: component.dependencies,\n },\n },\n };\n};\n\nexport async function createAppManifest({\n appId,\n components,\n sentryDSN,\n componentSourceBuilder,\n}: CreateAppManifestParams): Promise<AppManifest> {\n validateComponents(components);\n\n const appManifestComponents = (\n 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 dependencies: component.dependencies,\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 const basicConfig = createCustomElementConfig(component);\n\n return {\n ...basicConfig,\n compData: {\n customElementWidget: {\n ...basicConfig.compData.customElementWidget,\n widgetData: {\n ...basicConfig.compData.customElementWidget.widgetData,\n scriptUrl,\n },\n behaviors: {\n ...basicConfig.compData.customElementWidget.behaviors,\n ...(component.relativePanelPath\n ? { settings: { settingsUrl } }\n : {}),\n },\n },\n },\n };\n },\n Topology: async (component): Promise<Topology> => {\n return {\n compId: component.id,\n compType: ComponentType.TOPOLOGY as const,\n compName: component.name,\n compData: {\n topology: {\n topology: {\n backendApiUrl: component.backendApiUrl,\n },\n },\n },\n };\n },\n Api: () => null,\n Event: async (component): Promise<Webhook[]> => {\n const webhookSlugs = await componentSourceBuilder(component);\n\n return webhookSlugs.map(({ webhookSlug }) => ({\n compName: webhookSlug,\n compId: randomUUID(),\n compType: ComponentType.WEBHOOK,\n compData: {\n webhook: {\n callbackUrl: '__WEBHOOKS_URL_PLACEHOLDER__',\n webhookSlug,\n },\n },\n }));\n },\n ServicePlugin: async (component): Promise<ServicePlugin> => {\n const servicePlugin = match(component.servicePlugin, {\n EcomShippingRates: (component): EcomShippingRates => ({\n compName: component.name,\n compId: component.id,\n compType: ComponentType.ECOM_SHIPPING_RATES,\n compData: {\n ecomShippingRates: {\n name: component.name,\n deploymentUri: '__SERVICE_PLUGIN_URL_PLACEHOLDER__',\n description: component.description,\n learnMoreUrl: component.learnMoreUrl,\n dashboardUrl: component.dashboardUrl,\n fallbackDefinitionMandatory:\n component.fallbackDefinitionMandatory,\n thumbnailUrl: component.thumbnailUrl,\n },\n },\n }),\n EcomAdditionalFees: (component): EcomAdditionalFees => ({\n compName: component.name,\n compId: component.id,\n compType: ComponentType.ECOM_ADDITIONAL_FEES,\n compData: {\n ecomAdditionalFees: {\n deploymentUri: '__SERVICE_PLUGIN_URL_PLACEHOLDER__',\n },\n },\n }),\n EcomDiscountsTrigger: (component): EcomDiscountsTrigger => ({\n compName: component.name,\n compId: component.id,\n compType: ComponentType.ECOM_DISCOUNTS_TRIGGER,\n compData: {\n ecomDiscountsTrigger: {\n deploymentUri: '__SERVICE_PLUGIN_URL_PLACEHOLDER__',\n },\n },\n }),\n EcomValidations: (component): EcomValidations => ({\n compName: component.name,\n compId: component.id,\n compType: ComponentType.ECOM_VALIDATIONS,\n compData: {\n ecomValidations: {\n deploymentUri: '__SERVICE_PLUGIN_URL_PLACEHOLDER__',\n validateInCart: component.validateInCart,\n },\n },\n }),\n EcomPaymentSettings: (component): EcomPaymentSettings => ({\n compName: component.name,\n compId: component.id,\n compType: ComponentType.ECOM_PAYMENT_SETTINGS,\n compData: {\n ecomPaymentSettings: {\n deploymentUri: '__SERVICE_PLUGIN_URL_PLACEHOLDER__',\n fallbackValueForRequires3dSecure:\n component.fallbackValueForRequires3dSecure,\n },\n },\n }),\n });\n\n const { servicePluginType } = await componentSourceBuilder(\n component\n );\n\n if (servicePlugin.compType !== servicePluginType) {\n throw new CliError({\n code: CliErrorCode.InvalidServicePluginImplementation({\n configuredImplementation: servicePlugin.compType,\n }),\n });\n }\n\n return servicePlugin;\n },\n })\n )\n )\n )\n .filter(isTruthy)\n .flat();\n\n const uniqueComponents = uniqWith(appManifestComponents, (one, two) => {\n return (\n one.compType === ComponentType.WEBHOOK &&\n two.compType === ComponentType.WEBHOOK &&\n one.compData.webhook.webhookSlug === two.compData.webhook.webhookSlug\n );\n });\n\n return {\n appId,\n components: uniqueComponents,\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 { join } from 'node:path';\nimport type { SupportedServicePlugin } from '@wix/cli-app-definitions';\nimport { getAppBackendBuildFolder } from '@wix/cli-app-definitions';\nimport type * as GetRegisteredExtensions from '@wix/cli-cloudflare-runtime/getRegisteredExtensions';\nimport { getBackendEventSlug } from '@wix/extensions-data-client';\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 BackendSource =\n | {\n backendBuildOutput: ViteBuildOutput | undefined;\n backendDevServerUrl?: never;\n }\n | { backendDevServerUrl: string | undefined; backendBuildOutput?: never };\n\ntype ClientSource =\n | { clientBuildOutput: ViteBuildOutput; clientDevServerUrl?: never }\n | { clientDevServerUrl: string; clientBuildOutput?: never };\n\ntype DashboardSource =\n | {\n iframeUrl: string;\n scriptAsset?: never;\n }\n | {\n scriptAsset: ComponentSource['scriptAsset'];\n iframeUrl?: never;\n };\n\ninterface EmbeddedScriptSource {\n template: string;\n}\n\ninterface CustomElementSource {\n scriptUrl: string;\n settingsUrl: string;\n}\n\ninterface EventSource {\n webhookSlug: string;\n}\n\ninterface ServicePluginSource {\n servicePluginType: SupportedServicePlugin;\n}\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 : T extends DevCenterComponent<'Event'>\n ? EventSource[]\n : T extends DevCenterComponent<'ServicePlugin'>\n ? ServicePluginSource\n : undefined\n>;\n\nasync function getEmbeddedScriptDevTemplate(\n component: DevCenterComponent<'EmbeddedScript'>,\n backendDevServerUrl: string\n) {\n const url = new URL(component.relativePath, backendDevServerUrl).href;\n const devTemplate = await fetch(url).then((res) => res.text());\n\n return devTemplate;\n}\n\nasync function getEventDevSlugs(\n component: DevCenterComponent<'Event'>,\n backendDevServerUrl: string\n) {\n const url = new URL(`__get-registered-events`, backendDevServerUrl).href;\n const response = await fetch(url);\n\n if (!response.ok) {\n return [];\n }\n\n const eventTypes = await response.json();\n const devSlugs = eventTypes[`/${component.relativePath}`] ?? [];\n\n return devSlugs as string[];\n}\n\nasync function getRegisteredExtensions(model: ProjectModel) {\n const backendBuildFolder = getAppBackendBuildFolder(model.projectFolder);\n const outputFilepath = join(\n backendBuildFolder,\n 'getRegisteredExtensions.mjs'\n );\n\n return import(outputFilepath) as Promise<typeof GetRegisteredExtensions>;\n}\n\nasync function getEventProdSlugs(\n component: DevCenterComponent<'Event'>,\n model: ProjectModel\n) {\n const { getRegisteredEvents } = await getRegisteredExtensions(model);\n\n const eventsMap = await getRegisteredEvents();\n\n return eventsMap[`/${component.relativePath}`];\n}\n\nasync function getServicePluginDevType(\n component: DevCenterComponent<'ServicePlugin'>,\n backendDevServerUrl: string\n) {\n const url = new URL(`__get-registered-service-plugins`, backendDevServerUrl)\n .href;\n const response = await fetch(url);\n\n if (!response.ok) {\n return null;\n }\n\n const servicePluginTypes = await response.json();\n const servicePluginType = servicePluginTypes[`/${component.relativePath}`];\n\n return servicePluginType as string;\n}\n\nasync function getServicePluginProdType(\n component: DevCenterComponent<'ServicePlugin'>,\n model: ProjectModel\n) {\n const { getRegisteredServicePlugins } = await getRegisteredExtensions(model);\n\n const servicePluginsMap = await getRegisteredServicePlugins();\n\n return servicePluginsMap[`/${component.relativePath}`];\n}\n\nconst dashboardSourceBuilder = (\n component:\n | DevCenterComponent<'DashboardPage'>\n | DevCenterComponent<'DashboardPlugin'>\n | DevCenterComponent<'DashboardModal'>,\n model: ProjectModel,\n clientSource: ClientSource\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 = clientSource.clientBuildOutput\n ? extractModuleBundleName(clientSource.clientBuildOutput, 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 { clientBuildOutput, clientDevServerUrl }: ClientSource\n): Promise<EmbeddedScriptSource> => {\n return {\n template: clientBuildOutput\n ? extractModuleBundleContent(clientBuildOutput, component.relativePath)\n : await getEmbeddedScriptDevTemplate(component, clientDevServerUrl),\n };\n};\n\nconst eventSourceBuilder = async (\n component: DevCenterComponent<'Event'>,\n model: ProjectModel,\n backendSource: BackendSource\n): Promise<EventSource[]> => {\n const fullSlugNames = backendSource.backendDevServerUrl\n ? await getEventDevSlugs(component, backendSource.backendDevServerUrl)\n : await getEventProdSlugs(component, model);\n\n const webhookSlugs = fullSlugNames\n ? await Promise.all(fullSlugNames.map(getBackendEventSlug))\n : [];\n\n return webhookSlugs.map((webhookSlug) => ({\n webhookSlug,\n }));\n};\n\nconst servicePluginSourceBuilder = async (\n component: DevCenterComponent<'ServicePlugin'>,\n model: ProjectModel,\n backendSource: BackendSource\n): Promise<ServicePluginSource> => {\n const servicePluginType = backendSource.backendDevServerUrl\n ? await getServicePluginDevType(\n component,\n backendSource.backendDevServerUrl\n )\n : await getServicePluginProdType(component, model);\n\n if (!servicePluginType) {\n throw new Error('could not find service plugin definition');\n }\n\n return {\n servicePluginType,\n } as ServicePluginSource;\n};\n\nconst customElementBuilder = (\n component: DevCenterComponent<'CustomElement'>,\n clientSource: ClientSource\n): CustomElementSource => {\n const moduleId = virtualModuleIdForCustomElementScriptAsset(component.id);\n const componentUrl = clientSource.clientBuildOutput\n ? extractModuleBundleName(clientSource.clientBuildOutput, moduleId)\n : `/@id/${moduleId}?import`;\n\n return {\n scriptUrl: componentUrl,\n settingsUrl: virtualPathForCustomElementPanelHTMLAsset(component.id),\n };\n};\n\nexport function getComponentSourceBuilder(\n model: ProjectModel,\n clientSource: ClientSource,\n backendSource: BackendSource\n) {\n return (async (component: DevCenterComponent) => {\n const source = match(component, {\n EmbeddedScript: (embeddedScriptComponent) =>\n embeddedScriptBuilder(embeddedScriptComponent, clientSource),\n DashboardSidebarCategory: () => {},\n CustomElement: (customElementComponent) =>\n customElementBuilder(customElementComponent, clientSource),\n DashboardPage: (dashboardPageComponent) =>\n dashboardSourceBuilder(dashboardPageComponent, model, clientSource),\n DashboardPlugin: (dashboardPluginComponent) =>\n dashboardSourceBuilder(dashboardPluginComponent, model, clientSource),\n DashboardModal: (dashboardModalComponent) =>\n dashboardSourceBuilder(dashboardModalComponent, model, clientSource),\n DashboardMenuPlugin: () => {},\n Topology: () => {},\n Api: () => {},\n Event: (component) => eventSourceBuilder(component, model, backendSource),\n ServicePlugin: (component) =>\n servicePluginSourceBuilder(component, model, backendSource),\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":";;mSAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,IAAA,cAAAC,IAWA,SAASC,GAAcC,EAAOC,EAAWC,EAAWC,EAAW,CAI7D,QAHIC,EAASJ,EAAM,OACfK,EAAQH,GAAaC,EAAY,EAAI,IAEjCA,EAAYE,IAAU,EAAEA,EAAQD,GACtC,GAAIH,EAAUD,EAAMK,CAAK,EAAGA,EAAOL,CAAK,EACtC,OAAOK,EAGX,MAAO,EACT,CAEAR,EAAO,QAAUE,KCvBjB,IAAAO,EAAAC,EAAA,CAAAC,GAAAC,IAAA,cAAAC,IAOA,SAASC,GAAUC,EAAO,CACxB,OAAOA,IAAUA,CACnB,CAEAH,EAAO,QAAUE,KCXjB,IAAAE,EAAAC,EAAA,CAAAC,GAAAC,IAAA,cAAAC,IAUA,SAAS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CAC9D,CAAC,CAIL","names":["require_baseFindIndex","__commonJSMin","exports","module","init_esm_shims","baseFindIndex","array","predicate","fromIndex","fromRight","length","index","require_baseIsNaN","__commonJSMin","exports","module","init_esm_shims","baseIsNaN","value","require_strictIndexOf","__commonJSMin","exports","module","init_esm_shims","strictIndexOf","array","value","fromIndex","index","length","require_baseIndexOf","__commonJSMin","exports","module","init_esm_shims","baseFindIndex","baseIsNaN","strictIndexOf","baseIndexOf","array","value","fromIndex","require_arrayIncludes","__commonJSMin","exports","module","init_esm_shims","baseIndexOf","arrayIncludes","array","value","length","require_arrayIncludesWith","__commonJSMin","exports","module","init_esm_shims","arrayIncludesWith","array","value","comparator","index","length","require_noop","__commonJSMin","exports","module","init_esm_shims","noop","require_createSet","__commonJSMin","exports","module","init_esm_shims","Set","noop","setToArray","INFINITY","createSet","values","require_baseUniq","__commonJSMin","exports","module","init_esm_shims","SetCache","arrayIncludes","arrayIncludesWith","cacheHas","createSet","setToArray","LARGE_ARRAY_SIZE","baseUniq","array","iteratee","comparator","index","includes","length","isCommon","result","seen","set","outer","value","computed","seenIndex","require_uniqWith","__commonJSMin","exports","module","init_esm_shims","baseUniq","uniqWith","array","comparator","init_esm_shims","import_variant","randomUUID","validateComponents","components","devCenterComponentsToIdMap","component","DevCenterComponent","a","b","componentList","devCenterComponentsWithSameIDMap","devCenterComponents","key","CliError","CliErrorCode","id","title","relativePath","replaceExtension","label","CONFIG_FILENAME","name","randomUUID","init_esm_shims","import_variant","import_uniqWith","randomUUID","isTruthy","x","getExperiment","component","appId","createCustomElementConfig","ComponentType","CustomElementScriptType","HeightMode","RegionType","createAppManifest","components","sentryDSN","componentSourceBuilder","validateComponents","appManifestComponents","componentSentryDSN","BackOfficeHostingPlatforms","EmbeddedScriptPages","scriptUrl","settingsUrl","basicConfig","webhookSlug","randomUUID","servicePlugin","servicePluginType","CliError","CliErrorCode","uniqueComponents","uniqWith","one","two","init_esm_shims","import_variant","join","init_esm_shims","extractBuildOutputs","buildOutput","CliError","CliErrorCode","output","extractModuleBundleName","moduleId","extractModuleBundleContent","fileName","getEmbeddedScriptDevTemplate","component","backendDevServerUrl","url","res","getEventDevSlugs","response","getRegisteredExtensions","model","backendBuildFolder","getAppBackendBuildFolder","join","getEventProdSlugs","getRegisteredEvents","getServicePluginDevType","getServicePluginProdType","getRegisteredServicePlugins","dashboardSourceBuilder","clientSource","virtualPathForHTMLAsset","moduleId","virtualModuleIdForScriptAsset","componentUrl","extractModuleBundleName","BackOfficeScriptAssetType","embeddedScriptBuilder","clientBuildOutput","clientDevServerUrl","extractModuleBundleContent","eventSourceBuilder","backendSource","fullSlugNames","getBackendEventSlug","webhookSlug","servicePluginSourceBuilder","servicePluginType","customElementBuilder","virtualModuleIdForCustomElementScriptAsset","virtualPathForCustomElementPanelHTMLAsset","getComponentSourceBuilder","embeddedScriptComponent","customElementComponent","dashboardPageComponent","dashboardPluginComponent","dashboardModalComponent"]}
1
+ {"version":3,"sources":["../../../node_modules/lodash/_baseFindIndex.js","../../../node_modules/lodash/_baseIsNaN.js","../../../node_modules/lodash/_strictIndexOf.js","../../../node_modules/lodash/_baseIndexOf.js","../../../node_modules/lodash/_arrayIncludes.js","../../../node_modules/lodash/_arrayIncludesWith.js","../../../node_modules/lodash/noop.js","../../../node_modules/lodash/_createSet.js","../../../node_modules/lodash/_baseUniq.js","../../../node_modules/lodash/uniqWith.js","../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":["/**\n * The base implementation of `_.findIndex` and `_.findLastIndex` without\n * support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} predicate The function invoked per iteration.\n * @param {number} fromIndex The index to search from.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction baseFindIndex(array, predicate, fromIndex, fromRight) {\n var length = array.length,\n index = fromIndex + (fromRight ? 1 : -1);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (predicate(array[index], index, array)) {\n return index;\n }\n }\n return -1;\n}\n\nmodule.exports = baseFindIndex;\n","/**\n * The base implementation of `_.isNaN` without support for number objects.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n */\nfunction baseIsNaN(value) {\n return value !== value;\n}\n\nmodule.exports = baseIsNaN;\n","/**\n * A specialized version of `_.indexOf` which performs strict equality\n * comparisons of values, i.e. `===`.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction strictIndexOf(array, value, fromIndex) {\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (array[index] === value) {\n return index;\n }\n }\n return -1;\n}\n\nmodule.exports = strictIndexOf;\n","var baseFindIndex = require('./_baseFindIndex'),\n baseIsNaN = require('./_baseIsNaN'),\n strictIndexOf = require('./_strictIndexOf');\n\n/**\n * The base implementation of `_.indexOf` without `fromIndex` bounds checks.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction baseIndexOf(array, value, fromIndex) {\n return value === value\n ? strictIndexOf(array, value, fromIndex)\n : baseFindIndex(array, baseIsNaN, fromIndex);\n}\n\nmodule.exports = baseIndexOf;\n","var baseIndexOf = require('./_baseIndexOf');\n\n/**\n * A specialized version of `_.includes` for arrays without support for\n * specifying an index to search from.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\nfunction arrayIncludes(array, value) {\n var length = array == null ? 0 : array.length;\n return !!length && baseIndexOf(array, value, 0) > -1;\n}\n\nmodule.exports = arrayIncludes;\n","/**\n * This function is like `arrayIncludes` except that it accepts a comparator.\n *\n * @private\n * @param {Array} [array] The array to inspect.\n * @param {*} target The value to search for.\n * @param {Function} comparator The comparator invoked per element.\n * @returns {boolean} Returns `true` if `target` is found, else `false`.\n */\nfunction arrayIncludesWith(array, value, comparator) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (comparator(value, array[index])) {\n return true;\n }\n }\n return false;\n}\n\nmodule.exports = arrayIncludesWith;\n","/**\n * This method returns `undefined`.\n *\n * @static\n * @memberOf _\n * @since 2.3.0\n * @category Util\n * @example\n *\n * _.times(2, _.noop);\n * // => [undefined, undefined]\n */\nfunction noop() {\n // No operation performed.\n}\n\nmodule.exports = noop;\n","var Set = require('./_Set'),\n noop = require('./noop'),\n setToArray = require('./_setToArray');\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0;\n\n/**\n * Creates a set object of `values`.\n *\n * @private\n * @param {Array} values The values to add to the set.\n * @returns {Object} Returns the new set.\n */\nvar createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {\n return new Set(values);\n};\n\nmodule.exports = createSet;\n","var SetCache = require('./_SetCache'),\n arrayIncludes = require('./_arrayIncludes'),\n arrayIncludesWith = require('./_arrayIncludesWith'),\n cacheHas = require('./_cacheHas'),\n createSet = require('./_createSet'),\n setToArray = require('./_setToArray');\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * The base implementation of `_.uniqBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The iteratee invoked per element.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n */\nfunction baseUniq(array, iteratee, comparator) {\n var index = -1,\n includes = arrayIncludes,\n length = array.length,\n isCommon = true,\n result = [],\n seen = result;\n\n if (comparator) {\n isCommon = false;\n includes = arrayIncludesWith;\n }\n else if (length >= LARGE_ARRAY_SIZE) {\n var set = iteratee ? null : createSet(array);\n if (set) {\n return setToArray(set);\n }\n isCommon = false;\n includes = cacheHas;\n seen = new SetCache;\n }\n else {\n seen = iteratee ? [] : result;\n }\n outer:\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value) : value;\n\n value = (comparator || value !== 0) ? value : 0;\n if (isCommon && computed === computed) {\n var seenIndex = seen.length;\n while (seenIndex--) {\n if (seen[seenIndex] === computed) {\n continue outer;\n }\n }\n if (iteratee) {\n seen.push(computed);\n }\n result.push(value);\n }\n else if (!includes(seen, computed, comparator)) {\n if (seen !== result) {\n seen.push(computed);\n }\n result.push(value);\n }\n }\n return result;\n}\n\nmodule.exports = baseUniq;\n","var baseUniq = require('./_baseUniq');\n\n/**\n * This method is like `_.uniq` except that it accepts `comparator` which\n * is invoked to compare elements of `array`. The order of result values is\n * determined by the order they occur in the array.The comparator is invoked\n * with two arguments: (arrVal, othVal).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {Function} [comparator] The comparator invoked per element.\n * @returns {Array} Returns the new duplicate free array.\n * @example\n *\n * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];\n *\n * _.uniqWith(objects, _.isEqual);\n * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]\n */\nfunction uniqWith(array, comparator) {\n comparator = typeof comparator == 'function' ? comparator : undefined;\n return (array && array.length) ? baseUniq(array, undefined, comparator) : [];\n}\n\nmodule.exports = uniqWith;\n","import { randomUUID } from 'node:crypto';\nimport { isType, 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 { BackendComponent } from '../dev-center/components/dev-center-component.js';\nimport { DevCenterComponent } from '../dev-center/components/dev-center-component.js';\n\ntype NonBackendComponent = Exclude<DevCenterComponent, BackendComponent>;\n\nexport const validateComponents = (components: DevCenterComponent[]) => {\n const devCenterComponentsToIdMap = new Map<string, NonBackendComponent[]>();\n\n const componentsWithConfig = components.filter(\n (component): component is NonBackendComponent =>\n !isType(component, DevCenterComponent.Api) &&\n !isType(component, DevCenterComponent.Event) &&\n !isType(component, DevCenterComponent.ServicePlugin)\n );\n\n const sortedComponentsById = [...componentsWithConfig].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 = new Map<\n string,\n NonBackendComponent[]\n >();\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 Topology: ({ name }) => ({\n name,\n type: 'topology' as const,\n // Topology component doesn't have a config file\n path: '',\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 { randomUUID } from 'node:crypto';\nimport uniqWith from 'lodash/uniqWith.js';\nimport type {\n AppManifest,\n ComponentExperiment,\n BackofficePage,\n BackofficeExtensionWidget,\n BackofficeExtensionMenuItem,\n BackofficeSideCategory,\n BackofficeModal,\n EmbeddedScript,\n CustomElement,\n Webhook,\n ServicePlugin,\n Topology,\n EcomShippingRates,\n EcomAdditionalFees,\n EcomDiscountsTrigger,\n EcomValidations,\n EcomPaymentSettings,\n} from '@wix/cli-app-manifest';\nimport { CliError, CliErrorCode } from '@wix/cli-error';\nimport { validateComponents } from './validate.js';\nimport type { DevCenterComponent } from '../dev-center/components/dev-center-component.js';\nimport type { ComponentSourceBuilder } from './component-source.js';\n\ninterface CreateAppManifestParams {\n appId: string;\n backendServerUrl?: string;\n components: DevCenterComponent[];\n sentryDSN?: string;\n componentSourceBuilder: ComponentSourceBuilder;\n}\n\nfunction isTruthy<T>(x: T | undefined | null | false): x is T {\n return x !== undefined && x !== null && x !== false;\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 const createCustomElementConfig = (\n component: DevCenterComponent<'CustomElement'>\n): CustomElement => {\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?.essential ? 1 : 0,\n },\n widget: { region: RegionType.BODY },\n },\n behaviors: {},\n dependencies: component.dependencies,\n },\n },\n };\n};\n\nexport async function createAppManifest({\n appId,\n components,\n sentryDSN,\n componentSourceBuilder,\n}: CreateAppManifestParams): Promise<AppManifest> {\n validateComponents(components);\n\n const appManifestComponents = (\n 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 dependencies: component.dependencies,\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 const basicConfig = createCustomElementConfig(component);\n\n return {\n ...basicConfig,\n compData: {\n customElementWidget: {\n ...basicConfig.compData.customElementWidget,\n widgetData: {\n ...basicConfig.compData.customElementWidget.widgetData,\n scriptUrl,\n },\n behaviors: {\n ...basicConfig.compData.customElementWidget.behaviors,\n ...(component.relativePanelPath\n ? { settings: { settingsUrl } }\n : {}),\n },\n },\n },\n };\n },\n Topology: async (component): Promise<Topology> => {\n return {\n compId: component.id,\n compType: ComponentType.TOPOLOGY as const,\n compName: component.name,\n compData: {\n topology: {\n topology: {\n backendApiUrl: component.backendApiUrl,\n },\n },\n },\n };\n },\n Api: () => null,\n Event: async (component): Promise<Webhook[]> => {\n const webhookSlugs = await componentSourceBuilder(component);\n\n return webhookSlugs.map(({ webhookSlug }) => ({\n compName: webhookSlug,\n compId: randomUUID(),\n compType: ComponentType.WEBHOOK,\n compData: {\n webhook: {\n callbackUrl: '__WEBHOOKS_URL_PLACEHOLDER__',\n webhookSlug,\n },\n },\n }));\n },\n ServicePlugin: async (component): Promise<ServicePlugin> => {\n const servicePlugin = match(component.servicePlugin, {\n EcomShippingRates: (component): EcomShippingRates => ({\n compName: component.name,\n compId: component.id,\n compType: ComponentType.ECOM_SHIPPING_RATES,\n compData: {\n ecomShippingRates: {\n name: component.name,\n deploymentUri: '__SERVICE_PLUGIN_URL_PLACEHOLDER__',\n description: component.description,\n learnMoreUrl: component.learnMoreUrl,\n dashboardUrl: component.dashboardUrl,\n fallbackDefinitionMandatory:\n component.fallbackDefinitionMandatory,\n thumbnailUrl: component.thumbnailUrl,\n },\n },\n }),\n EcomAdditionalFees: (component): EcomAdditionalFees => ({\n compName: component.name,\n compId: component.id,\n compType: ComponentType.ECOM_ADDITIONAL_FEES,\n compData: {\n ecomAdditionalFees: {\n deploymentUri: '__SERVICE_PLUGIN_URL_PLACEHOLDER__',\n },\n },\n }),\n EcomDiscountsTrigger: (component): EcomDiscountsTrigger => ({\n compName: component.name,\n compId: component.id,\n compType: ComponentType.ECOM_DISCOUNTS_TRIGGER,\n compData: {\n ecomDiscountsTrigger: {\n deploymentUri: '__SERVICE_PLUGIN_URL_PLACEHOLDER__',\n },\n },\n }),\n EcomValidations: (component): EcomValidations => ({\n compName: component.name,\n compId: component.id,\n compType: ComponentType.ECOM_VALIDATIONS,\n compData: {\n ecomValidations: {\n deploymentUri: '__SERVICE_PLUGIN_URL_PLACEHOLDER__',\n validateInCart: component.validateInCart,\n },\n },\n }),\n EcomPaymentSettings: (component): EcomPaymentSettings => ({\n compName: component.name,\n compId: component.id,\n compType: ComponentType.ECOM_PAYMENT_SETTINGS,\n compData: {\n ecomPaymentSettings: {\n deploymentUri: '__SERVICE_PLUGIN_URL_PLACEHOLDER__',\n fallbackValueForRequires3dSecure:\n component.fallbackValueForRequires3dSecure,\n },\n },\n }),\n });\n\n const { servicePluginType } = await componentSourceBuilder(\n component\n );\n\n if (servicePlugin.compType !== servicePluginType) {\n throw new CliError({\n code: CliErrorCode.InvalidServicePluginImplementation({\n configuredImplementation: servicePlugin.compType,\n }),\n });\n }\n\n return servicePlugin;\n },\n })\n )\n )\n )\n .filter(isTruthy)\n .flat();\n\n const uniqueComponents = uniqWith(appManifestComponents, (one, two) => {\n return (\n one.compType === ComponentType.WEBHOOK &&\n two.compType === ComponentType.WEBHOOK &&\n one.compData.webhook.webhookSlug === two.compData.webhook.webhookSlug\n );\n });\n\n return {\n appId,\n components: uniqueComponents,\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 { join } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport type { SupportedServicePlugin } from '@wix/cli-app-definitions';\nimport { getAppBackendBuildFolder } from '@wix/cli-app-definitions';\nimport type * as GetRegisteredExtensions from '@wix/cli-cloudflare-runtime/getRegisteredExtensions';\nimport { getBackendEventSlug } from '@wix/extensions-data-client';\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 BackendSource =\n | {\n backendBuildOutput: ViteBuildOutput | undefined;\n backendDevServerUrl?: never;\n }\n | { backendDevServerUrl: string | undefined; backendBuildOutput?: never };\n\ntype ClientSource =\n | { clientBuildOutput: ViteBuildOutput; clientDevServerUrl?: never }\n | { clientDevServerUrl: string; clientBuildOutput?: never };\n\ntype DashboardSource =\n | {\n iframeUrl: string;\n scriptAsset?: never;\n }\n | {\n scriptAsset: ComponentSource['scriptAsset'];\n iframeUrl?: never;\n };\n\ninterface EmbeddedScriptSource {\n template: string;\n}\n\ninterface CustomElementSource {\n scriptUrl: string;\n settingsUrl: string;\n}\n\ninterface EventSource {\n webhookSlug: string;\n}\n\ninterface ServicePluginSource {\n servicePluginType: SupportedServicePlugin;\n}\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 : T extends DevCenterComponent<'Event'>\n ? EventSource[]\n : T extends DevCenterComponent<'ServicePlugin'>\n ? ServicePluginSource\n : undefined\n>;\n\nasync function getEmbeddedScriptDevTemplate(\n component: DevCenterComponent<'EmbeddedScript'>,\n backendDevServerUrl: string\n) {\n const url = new URL(component.relativePath, backendDevServerUrl).href;\n const devTemplate = await fetch(url).then((res) => res.text());\n\n return devTemplate;\n}\n\nasync function getEventDevSlugs(\n component: DevCenterComponent<'Event'>,\n backendDevServerUrl: string\n) {\n const url = new URL(`__get-registered-events`, backendDevServerUrl).href;\n const response = await fetch(url);\n\n if (!response.ok) {\n return [];\n }\n\n const eventTypes = await response.json();\n const devSlugs = eventTypes[`/${component.relativePath}`] ?? [];\n\n return devSlugs as string[];\n}\n\nasync function getRegisteredExtensions(model: ProjectModel) {\n const backendBuildFolder = getAppBackendBuildFolder(model.projectFolder);\n const outputFilepath = join(\n backendBuildFolder,\n 'getRegisteredExtensions.mjs'\n );\n\n return import(pathToFileURL(outputFilepath).href) as Promise<\n typeof GetRegisteredExtensions\n >;\n}\n\nasync function getEventProdSlugs(\n component: DevCenterComponent<'Event'>,\n model: ProjectModel\n) {\n const { getRegisteredEvents } = await getRegisteredExtensions(model);\n\n const eventsMap = await getRegisteredEvents();\n\n return eventsMap[`/${component.relativePath}`];\n}\n\nasync function getServicePluginDevType(\n component: DevCenterComponent<'ServicePlugin'>,\n backendDevServerUrl: string\n) {\n const url = new URL(`__get-registered-service-plugins`, backendDevServerUrl)\n .href;\n const response = await fetch(url);\n\n if (!response.ok) {\n return null;\n }\n\n const servicePluginTypes = await response.json();\n const servicePluginType = servicePluginTypes[`/${component.relativePath}`];\n\n return servicePluginType as string;\n}\n\nasync function getServicePluginProdType(\n component: DevCenterComponent<'ServicePlugin'>,\n model: ProjectModel\n) {\n const { getRegisteredServicePlugins } = await getRegisteredExtensions(model);\n\n const servicePluginsMap = await getRegisteredServicePlugins();\n\n return servicePluginsMap[`/${component.relativePath}`];\n}\n\nconst dashboardSourceBuilder = (\n component:\n | DevCenterComponent<'DashboardPage'>\n | DevCenterComponent<'DashboardPlugin'>\n | DevCenterComponent<'DashboardModal'>,\n model: ProjectModel,\n clientSource: ClientSource\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 = clientSource.clientBuildOutput\n ? extractModuleBundleName(clientSource.clientBuildOutput, 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 { clientBuildOutput, clientDevServerUrl }: ClientSource\n): Promise<EmbeddedScriptSource> => {\n return {\n template: clientBuildOutput\n ? extractModuleBundleContent(clientBuildOutput, component.relativePath)\n : await getEmbeddedScriptDevTemplate(component, clientDevServerUrl),\n };\n};\n\nconst eventSourceBuilder = async (\n component: DevCenterComponent<'Event'>,\n model: ProjectModel,\n backendSource: BackendSource\n): Promise<EventSource[]> => {\n const fullSlugNames = backendSource.backendDevServerUrl\n ? await getEventDevSlugs(component, backendSource.backendDevServerUrl)\n : await getEventProdSlugs(component, model);\n\n const webhookSlugs = fullSlugNames\n ? await Promise.all(fullSlugNames.map(getBackendEventSlug))\n : [];\n\n return webhookSlugs.map((webhookSlug) => ({\n webhookSlug,\n }));\n};\n\nconst servicePluginSourceBuilder = async (\n component: DevCenterComponent<'ServicePlugin'>,\n model: ProjectModel,\n backendSource: BackendSource\n): Promise<ServicePluginSource> => {\n const servicePluginType = backendSource.backendDevServerUrl\n ? await getServicePluginDevType(\n component,\n backendSource.backendDevServerUrl\n )\n : await getServicePluginProdType(component, model);\n\n if (!servicePluginType) {\n throw new Error('could not find service plugin definition');\n }\n\n return {\n servicePluginType,\n } as ServicePluginSource;\n};\n\nconst customElementBuilder = (\n component: DevCenterComponent<'CustomElement'>,\n clientSource: ClientSource\n): CustomElementSource => {\n const moduleId = virtualModuleIdForCustomElementScriptAsset(component.id);\n const componentUrl = clientSource.clientBuildOutput\n ? extractModuleBundleName(clientSource.clientBuildOutput, moduleId)\n : `/@id/${moduleId}?import`;\n\n return {\n scriptUrl: componentUrl,\n settingsUrl: virtualPathForCustomElementPanelHTMLAsset(component.id),\n };\n};\n\nexport function getComponentSourceBuilder(\n model: ProjectModel,\n clientSource: ClientSource,\n backendSource: BackendSource\n) {\n return (async (component: DevCenterComponent) => {\n const source = match(component, {\n EmbeddedScript: (embeddedScriptComponent) =>\n embeddedScriptBuilder(embeddedScriptComponent, clientSource),\n DashboardSidebarCategory: () => {},\n CustomElement: (customElementComponent) =>\n customElementBuilder(customElementComponent, clientSource),\n DashboardPage: (dashboardPageComponent) =>\n dashboardSourceBuilder(dashboardPageComponent, model, clientSource),\n DashboardPlugin: (dashboardPluginComponent) =>\n dashboardSourceBuilder(dashboardPluginComponent, model, clientSource),\n DashboardModal: (dashboardModalComponent) =>\n dashboardSourceBuilder(dashboardModalComponent, model, clientSource),\n DashboardMenuPlugin: () => {},\n Topology: () => {},\n Api: () => {},\n Event: (component) => eventSourceBuilder(component, model, backendSource),\n ServicePlugin: (component) =>\n servicePluginSourceBuilder(component, model, backendSource),\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":";;mSAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,IAAA,cAAAC,IAWA,SAASC,GAAcC,EAAOC,EAAWC,EAAWC,EAAW,CAI7D,QAHIC,EAASJ,EAAM,OACfK,EAAQH,GAAaC,EAAY,EAAI,IAEjCA,EAAYE,IAAU,EAAEA,EAAQD,GACtC,GAAIH,EAAUD,EAAMK,CAAK,EAAGA,EAAOL,CAAK,EACtC,OAAOK,EAGX,MAAO,EACT,CAEAR,EAAO,QAAUE,KCvBjB,IAAAO,EAAAC,EAAA,CAAAC,GAAAC,IAAA,cAAAC,IAOA,SAASC,GAAUC,EAAO,CACxB,OAAOA,IAAUA,CACnB,CAEAH,EAAO,QAAUE,KCXjB,IAAAE,EAAAC,EAAA,CAAAC,GAAAC,IAAA,cAAAC,IAUA,SAASC,GAAcC,EAAOC,EAAOC,EAAW,CAI9C,QAHIC,EAAQD,EAAY,EACpBE,EAASJ,EAAM,OAEZ,EAAEG,EAAQC,GACf,GAAIJ,EAAMG,CAAK,IAAMF,EACnB,OAAOE,EAGX,MAAO,EACT,CAEAN,EAAO,QAAUE,KCtBjB,IAAAM,EAAAC,EAAA,CAAAC,GAAAC,IAAA,cAAAC,IAAA,IAAIC,GAAgB,IAChBC,GAAY,IACZC,GAAgB,IAWpB,SAASC,GAAYC,EAAOC,EAAOC,EAAW,CAC5C,OAAOD,IAAUA,EACbH,GAAcE,EAAOC,EAAOC,CAAS,EACrCN,GAAcI,EAAOH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B,EACA,MAAMf,GAAyBhB,EAAWO,CAAK,EAEnD,GAAI,CAAC6B,EACH,MAAM,IAAI,MAAM,0CAA0C,EAG5D,MAAO,CACL,kBAAAA,CACF,CACF,EAEMC,GAAuB,CAC3BrC,EACAmB,IACwB,CACxB,IAAME,EAAWiB,EAA2CtC,EAAU,EAAE,EAKxE,MAAO,CACL,UALmBmB,EAAa,kBAC9BK,EAAwBL,EAAa,kBAAmBE,CAAQ,EAChE,QAAQA,CAAQ,UAIlB,YAAakB,EAA0CvC,EAAU,EAAE,CACrE,CACF,EAEO,SAASwC,GACdjC,EACAY,EACAY,EACA,CACA,MAAQ,OAAO/B,MACE,UAAMA,EAAW,CAC9B,eAAiByC,GACff,GAAsBe,EAAyBtB,CAAY,EAC7D,yBAA0B,IAAM,CAAC,EACjC,cAAgBuB,GACdL,GAAqBK,EAAwBvB,CAAY,EAC3D,cAAgBwB,GACdzB,EAAuByB,EAAwBpC,EAAOY,CAAY,EACpE,gBAAkByB,GAChB1B,EAAuB0B,EAA0BrC,EAAOY,CAAY,EACtE,eAAiB0B,GACf3B,EAAuB2B,EAAyBtC,EAAOY,CAAY,EACrE,oBAAqB,IAAM,CAAC,EAC5B,SAAU,IAAM,CAAC,EACjB,IAAK,IAAM,CAAC,EACZ,MAAQnB,GAAc8B,GAAmB9B,EAAWO,EAAOwB,CAAa,EACxE,cAAgB/B,GACdmC,GAA2BnC,EAAWO,EAAOwB,CAAa,CAC9D,CAAC,CAIL","names":["require_baseFindIndex","__commonJSMin","exports","module","init_esm_shims","baseFindIndex","array","predicate","fromIndex","fromRight","length","index","require_baseIsNaN","__commonJSMin","exports","module","init_esm_shims","baseIsNaN","value","require_strictIndexOf","__commonJSMin","exports","module","init_esm_shims","strictIndexOf","array","value","fromIndex","index","length","require_baseIndexOf","__commonJSMin","exports","module","init_esm_shims","baseFindIndex","baseIsNaN","strictIndexOf","baseIndexOf","array","value","fromIndex","require_arrayIncludes","__commonJSMin","exports","module","init_esm_shims","baseIndexOf","arrayIncludes","array","value","length","require_arrayIncludesWith","__commonJSMin","exports","module","init_esm_shims","arrayIncludesWith","array","value","comparator","index","length","require_noop","__commonJSMin","exports","module","init_esm_shims","noop","require_createSet","__commonJSMin","exports","module","init_esm_shims","Set","noop","setToArray","INFINITY","createSet","values","require_baseUniq","__commonJSMin","exports","module","init_esm_shims","SetCache","arrayIncludes","arrayIncludesWith","cacheHas","createSet","setToArray","LARGE_ARRAY_SIZE","baseUniq","array","iteratee","comparator","index","includes","length","isCommon","result","seen","set","outer","value","computed","seenIndex","require_uniqWith","__commonJSMin","exports","module","init_esm_shims","baseUniq","uniqWith","array","comparator","init_esm_shims","import_variant","randomUUID","validateComponents","components","devCenterComponentsToIdMap","component","DevCenterComponent","a","b","componentList","devCenterComponentsWithSameIDMap","devCenterComponents","key","CliError","CliErrorCode","id","title","relativePath","replaceExtension","label","CONFIG_FILENAME","name","randomUUID","init_esm_shims","import_variant","import_uniqWith","randomUUID","isTruthy","x","getExperiment","component","appId","createCustomElementConfig","ComponentType","CustomElementScriptType","HeightMode","RegionType","createAppManifest","components","sentryDSN","componentSourceBuilder","validateComponents","appManifestComponents","componentSentryDSN","BackOfficeHostingPlatforms","EmbeddedScriptPages","scriptUrl","settingsUrl","basicConfig","webhookSlug","randomUUID","servicePlugin","servicePluginType","CliError","CliErrorCode","uniqueComponents","uniqWith","one","two","init_esm_shims","import_variant","join","pathToFileURL","init_esm_shims","extractBuildOutputs","buildOutput","CliError","CliErrorCode","output","extractModuleBundleName","moduleId","extractModuleBundleContent","fileName","getEmbeddedScriptDevTemplate","component","backendDevServerUrl","url","res","getEventDevSlugs","response","getRegisteredExtensions","model","backendBuildFolder","getAppBackendBuildFolder","outputFilepath","join","pathToFileURL","getEventProdSlugs","getRegisteredEvents","getServicePluginDevType","getServicePluginProdType","getRegisteredServicePlugins","dashboardSourceBuilder","clientSource","virtualPathForHTMLAsset","moduleId","virtualModuleIdForScriptAsset","componentUrl","extractModuleBundleName","BackOfficeScriptAssetType","embeddedScriptBuilder","clientBuildOutput","clientDevServerUrl","extractModuleBundleContent","eventSourceBuilder","backendSource","fullSlugNames","getBackendEventSlug","webhookSlug","servicePluginSourceBuilder","servicePluginType","customElementBuilder","virtualModuleIdForCustomElementScriptAsset","virtualPathForCustomElementPanelHTMLAsset","getComponentSourceBuilder","embeddedScriptComponent","customElementComponent","dashboardPageComponent","dashboardPluginComponent","dashboardModalComponent"]}
@@ -1,4 +1,4 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{a as r}from"./chunk-E7IQZNJ7.js";import{ja as i,k as p}from"./chunk-TSKFLGBO.js";import{h as n}from"./chunk-V4TR6DCM.js";n();async function A({projectFolder:t,manifest:e}){let a=i(t);return p(a,e)}async function M(t){let e=i(t);return r(e)}export{A as a,M as b};
4
- //# sourceMappingURL=chunk-PQFAL6B4.js.map
3
+ import{a as r}from"./chunk-4YU6J2EW.js";import{k as p,ka as i}from"./chunk-MIBBNKYS.js";import{h as n}from"./chunk-V4TR6DCM.js";n();async function A({projectFolder:t,manifest:e}){let a=i(t);return p(a,e)}async function M(t){let e=i(t);return r(e)}export{A as a,M as b};
4
+ //# sourceMappingURL=chunk-3Q7TAN43.js.map
@@ -1,4 +1,4 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{I as l,J as A,K as S,L as O,M as h,N as w,Q as C,R as N}from"./chunk-TSKFLGBO.js";import{l as e}from"./chunk-JPGXKQXP.js";import{c as R,e as P,h as T}from"./chunk-V4TR6DCM.js";var _=R((be,F)=>{"use strict";T();F.exports=L;function E(a){return a instanceof Buffer?Buffer.from(a):new a.constructor(a.buffer.slice(),a.byteOffset,a.length)}function L(a){if(a=a||{},a.circles)return K(a);let n=new Map;if(n.set(Date,t=>new Date(t)),n.set(Map,(t,s)=>new Map(m(Array.from(t),s))),n.set(Set,(t,s)=>new Set(m(Array.from(t),s))),a.constructorHandlers)for(let t of a.constructorHandlers)n.set(t[0],t[1]);let r=null;return a.proto?f:p;function m(t,s){let o=Object.keys(t),i=new Array(o.length);for(let g=0;g<o.length;g++){let c=o[g],u=t[c];typeof u!="object"||u===null?i[c]=u:u.constructor!==Object&&(r=n.get(u.constructor))?i[c]=r(u,s):ArrayBuffer.isView(u)?i[c]=E(u):i[c]=s(u)}return i}function p(t){if(typeof t!="object"||t===null)return t;if(Array.isArray(t))return m(t,p);if(t.constructor!==Object&&(r=n.get(t.constructor)))return r(t,p);let s={};for(let o in t){if(Object.hasOwnProperty.call(t,o)===!1)continue;let i=t[o];typeof i!="object"||i===null?s[o]=i:i.constructor!==Object&&(r=n.get(i.constructor))?s[o]=r(i,p):ArrayBuffer.isView(i)?s[o]=E(i):s[o]=p(i)}return s}function f(t){if(typeof t!="object"||t===null)return t;if(Array.isArray(t))return m(t,f);if(t.constructor!==Object&&(r=n.get(t.constructor)))return r(t,f);let s={};for(let o in t){let i=t[o];typeof i!="object"||i===null?s[o]=i:i.constructor!==Object&&(r=n.get(i.constructor))?s[o]=r(i,f):ArrayBuffer.isView(i)?s[o]=E(i):s[o]=f(i)}return s}}function K(a){let n=[],r=[],m=new Map;if(m.set(Date,o=>new Date(o)),m.set(Map,(o,i)=>new Map(f(Array.from(o),i))),m.set(Set,(o,i)=>new Set(f(Array.from(o),i))),a.constructorHandlers)for(let o of a.constructorHandlers)m.set(o[0],o[1]);let p=null;return a.proto?s:t;function f(o,i){let g=Object.keys(o),c=new Array(g.length);for(let u=0;u<g.length;u++){let b=g[u],d=o[b];if(typeof d!="object"||d===null)c[b]=d;else if(d.constructor!==Object&&(p=m.get(d.constructor)))c[b]=p(d,i);else if(ArrayBuffer.isView(d))c[b]=E(d);else{let v=n.indexOf(d);v!==-1?c[b]=r[v]:c[b]=i(d)}}return c}function t(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return f(o,t);if(o.constructor!==Object&&(p=m.get(o.constructor)))return p(o,t);let i={};n.push(o),r.push(i);for(let g in o){if(Object.hasOwnProperty.call(o,g)===!1)continue;let c=o[g];if(typeof c!="object"||c===null)i[g]=c;else if(c.constructor!==Object&&(p=m.get(c.constructor)))i[g]=p(c,t);else if(ArrayBuffer.isView(c))i[g]=E(c);else{let u=n.indexOf(c);u!==-1?i[g]=r[u]:i[g]=t(c)}}return n.pop(),r.pop(),i}function s(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return f(o,s);if(o.constructor!==Object&&(p=m.get(o.constructor)))return p(o,s);let i={};n.push(o),r.push(i);for(let g in o){let c=o[g];if(typeof c!="object"||c===null)i[g]=c;else if(c.constructor!==Object&&(p=m.get(c.constructor)))i[g]=p(c,s);else if(ArrayBuffer.isView(c))i[g]=E(c);else{let u=n.indexOf(c);u!==-1?i[g]=r[u]:i[g]=s(c)}}return n.pop(),r.pop(),i}}});T();import H from"node:fs/promises";var x=P(_(),1);var B=P(_(),1);var U=P(_(),1),y=e.object({errorReporting:e.object({url:e.string().optional(),artifact:e.object({fullArtifactId:e.string().max(255).min(1),version:e.string().max(255).min(1)}).optional()}).optional()}),j=e.object({iframeUrl:e.string().optional(),scriptAsset:e.object({exportedName:e.string(),containerId:e.string(),url:e.string(),scriptType:e.string().optional()}).optional()}),V=e.object({hostingPlatform:e.string(),fullPage:e.boolean().nullish(),hideInSidebar:e.boolean().nullish(),priority:e.number().nullish(),routePath:e.string().nullish(),title:e.string(),pageCategoryId:e.string().uuid().nullish(),activeSidebarPageId:e.string().nullish(),requiredPermission:e.string().nullish(),previousRoutePaths:e.array(e.string()).nullish()}).merge(y).merge(j).passthrough(),$=e.object({width:e.number().nullish(),height:e.number().nullish()}).merge(j).passthrough(),I=e.object({appId:e.string(),componentId:e.string().uuid(),spec:e.string().min(1),variantValue:e.string()}).passthrough().optional(),Y=e.object({compId:e.string(),compType:e.literal(l.BACK_OFFICE_PAGE),compData:e.object({backOfficePage:V}),compName:e.string().optional(),experiment:I}).passthrough(),X=e.object({compId:e.string(),compType:e.literal(l.BACK_OFFICE_EXTENSION),compData:e.object({backOfficeExtension:e.object({hostingPlatform:e.string(),extends:e.string(),title:e.string().nullish(),extensionType:e.literal(w.BACK_OFFICE_EXTENSION_WIDGET),requiredPermission:e.string().nullish(),widget:$}).merge(y).passthrough()}),compName:e.string().optional(),experiment:I}).passthrough(),q=e.object({compId:e.string(),compType:e.literal(l.BACK_OFFICE_EXTENSION_WIDGET),compData:e.object({backOfficeExtensionWidget:e.object({hostingPlatform:e.string(),extends:e.string(),title:e.string().nullish(),description:e.string().optional(),requiredPermission:e.string().nullish(),width:e.number().nullish(),height:e.number().nullish()}).merge(j).merge(y).passthrough()}),compName:e.string().optional(),experiment:I}).passthrough(),z=e.object({compId:e.string(),compType:e.literal(l.BACK_OFFICE_EXTENSION_MENU_ITEM),compData:e.object({backOfficeExtensionMenuItem:e.object({id:e.string().uuid(),title:e.string().min(1),subtitle:e.string().max(200).optional(),iconKey:e.string().min(3).max(50).optional(),extends:e.string().uuid(),action:e.object({navigateToPage:e.object({pageId:e.string().uuid(),relativeUrl:e.string().optional()}),openModal:e.object({componentId:e.string().uuid(),componentParams:e.record(e.string().min(1),e.string().min(1)).optional()})}).partial().superRefine((a,n)=>{!a.navigateToPage&&!a.openModal&&n.addIssue({code:e.ZodIssueCode.custom,message:"action must have either navigateToPage or openModal"}),a.navigateToPage&&a.openModal&&n.addIssue({code:e.ZodIssueCode.custom,message:"action can't have both navigateToPage and openModal"})}),sentryDSN:e.string().optional(),requiredPermission:e.string().optional()}).merge(j).merge(y).passthrough()}),compName:e.string().optional(),experiment:I}).passthrough(),J=e.object({compId:e.string(),compType:e.literal(l.BACK_OFFICE_MODAL),compData:e.object({backOfficeModal:e.object({hostingPlatform:e.string(),title:e.string().nullish(),requiredPermission:e.string().nullish(),width:e.number().nullish(),height:e.number().nullish()}).merge(j).merge(y).passthrough()}),compName:e.string().optional(),experiment:I}).passthrough(),Z=e.object({compId:e.string(),compType:e.literal(l.BACK_OFFICE_SIDEBAR_CATEGORY),compData:e.object({backOfficeSidebarCategory:e.object({hostingPlatform:e.string(),title:e.string(),priority:e.number().nullish()})}),compName:e.string().optional()}).passthrough(),Q=e.object({compId:e.string(),compType:e.literal(l.BACK_OFFICE_WIDGET),compName:e.string().optional()}).passthrough(),ee=e.object({compId:e.string(),compType:e.literal(l.BACK_OFFICE_EXTENSION_CONTAINER),compName:e.string().optional()}).passthrough(),k=e.object({packageName:e.string().min(2).max(100),version:e.number().int().min(0)}),te=e.object({template:e.string(),name:e.string(),pages:e.enum([S.NONE_PAGES,S.ONCE,S.SPECIFIC_PAGES]),placement:e.enum([O.HEAD,O.BODY_START,O.BODY_END,O.NONE_PLACEMENT]),connectArticleUrl:e.string(),embedCategory:e.enum([h.UNKNOWN,h.FUNCTIONAL,h.ESSENTIAL,h.ANALYTICS,h.ADVERTISING]),loadOnce:e.boolean(),allowedForFreeSite:e.boolean(),dependencies:e.array(k)}),oe=e.object({compId:e.string(),compType:e.literal(l.EMBEDDED_SCRIPT),compName:e.string().optional(),compData:e.object({embeddedScriptComponentData:te})}).passthrough(),ie=e.object({base:e.object({id:e.string().optional(),name:e.string()}),installation:e.object({base:e.object({autoAdd:e.boolean().optional(),essential:e.boolean().optional(),maxInstances:e.number().optional()}).optional(),widget:e.object({default_preset:e.object({desktop_preset_id:e.string().optional(),tablet_preset_id:e.string().optional(),mobile_preset_id:e.string().optional()}).optional(),region:e.enum([A.BODY,A.FOOTER,A.HEADER])}).optional()}).optional(),widgetData:e.object({tagName:e.string(),scriptUrl:e.string(),scriptType:e.enum([C.NONE,C.COMMON_JS,C.ES_MODULE])}),behaviors:e.object({settings:e.object({settingsUrl:e.string()}).optional(),dashboard:e.object({dashboardPageComponentId:e.string()}).optional()}),size:e.object({width:e.object({allowStretch:e.boolean().optional(),defaultWidth:e.number().optional(),stretchByDefault:e.boolean().optional()}),height:e.object({defaultHeight:e.number(),heightMode:e.enum([N.AUTO,N.FIXED,N.UNKNOWN]).optional()})}),dependencies:e.array(k)}),re=e.object({compId:e.string(),compType:e.literal(l.CUSTOM_ELEMENT_WIDGET),compName:e.string().optional(),compData:e.object({customElementWidget:ie})}).passthrough(),ne=e.object({compId:e.string().uuid(),compType:e.literal(l.WEBHOOK),compName:e.string().optional(),compData:e.object({webhook:e.object({webhookSlug:e.string(),callbackUrl:e.string()})})}).passthrough(),ae=e.object({compId:e.string().uuid(),compType:e.literal(l.ECOM_SHIPPING_RATES),compName:e.string().optional(),compData:e.object({ecomShippingRates:e.object({name:e.string(),deploymentUri:e.string(),description:e.string().optional(),learnMoreUrl:e.string().url().optional(),dashboardUrl:e.string().url().optional(),fallbackDefinitionMandatory:e.boolean().optional(),thumbnailUrl:e.string().url().optional()})})}).passthrough(),se=e.object({compId:e.string().uuid(),compType:e.literal(l.ECOM_ADDITIONAL_FEES),compName:e.string().optional(),compData:e.object({ecomAdditionalFees:e.object({deploymentUri:e.string()})})}).passthrough(),ce=e.object({compId:e.string().uuid(),compType:e.literal(l.ECOM_DISCOUNTS_TRIGGER),compName:e.string().optional(),compData:e.object({ecomDiscountsTrigger:e.object({deploymentUri:e.string()})})}).passthrough(),le=e.object({compId:e.string().uuid(),compType:e.literal(l.ECOM_VALIDATIONS),compName:e.string().optional(),compData:e.object({ecomValidations:e.object({deploymentUri:e.string(),validateInCart:e.boolean().optional()})})}).passthrough(),pe=e.object({compId:e.string().uuid(),compType:e.literal(l.ECOM_PAYMENT_SETTINGS),compName:e.string().optional(),compData:e.object({ecomPaymentSettings:e.object({deploymentUri:e.string(),fallbackValueForRequires3dSecure:e.boolean().optional()})})}).passthrough(),me=e.object({compType:e.literal(l.TOPOLOGY),compId:e.string(),compName:e.string().optional(),compData:e.object({topology:e.object({topology:e.object({backendApiUrl:e.string().url()})})})}).passthrough(),ge=e.object({appId:e.string(),components:e.array(e.discriminatedUnion("compType",[Y,X,q,z,J,Z,Q,ee,oe,re,ne,se,ae,ce,le,pe,me]))});async function je(a){try{let n=await H.readFile(a,"utf-8");return ge.parse(JSON.parse(n))}catch(n){let r=n instanceof Error?n.toString():JSON.stringify(n);throw new Error(`Failed to read App Manifest at ${a}: ${r}`)}}var Ie=(0,x.default)();var ue=(0,B.default)(),M=(a,n)=>new URL(a,n).href,D=(a,n)=>{let{scriptAsset:r,iframeUrl:m}=a;return r?{scriptAsset:{...r,url:M(r.url,n)}}:m?{iframeUrl:M(m,n)}:a},fe=(a,n)=>({template:a.template.replaceAll("__STATICS_BASE_URL_PLACEHOLDER__",n)}),Ae=(a,n,r)=>{let m=ue(a),p=n.endsWith("/")?n:`${n}/`;return m.components.forEach(f=>{let{compData:t,compType:s}=f;s===l.BACK_OFFICE_PAGE&&(t.backOfficePage={...t.backOfficePage,...D(t.backOfficePage,p)}),s===l.BACK_OFFICE_EXTENSION&&(t.backOfficeExtension.widget={...t.backOfficeExtension.widget,...D(t.backOfficeExtension.widget,p)}),s===l.BACK_OFFICE_EXTENSION_WIDGET&&(t.backOfficeExtensionWidget={...t.backOfficeExtensionWidget,...D(t.backOfficeExtensionWidget,p)}),s===l.BACK_OFFICE_MODAL&&(t.backOfficeModal={...t.backOfficeModal,...D(t.backOfficeModal,p)}),s===l.EMBEDDED_SCRIPT&&(t.embeddedScriptComponentData={...t.embeddedScriptComponentData,...fe(t.embeddedScriptComponentData,p)}),s===l.CUSTOM_ELEMENT_WIDGET&&(t.customElementWidget={...t.customElementWidget,widgetData:{...t.customElementWidget.widgetData,scriptUrl:M(t.customElementWidget.widgetData.scriptUrl,p)},behaviors:{...t.customElementWidget.behaviors,...t.customElementWidget.behaviors.settings?{settings:{settingsUrl:M(t.customElementWidget.behaviors.settings.settingsUrl,p)}}:{}}}),s===l.WEBHOOK&&r&&(t.webhook={...t.webhook,callbackUrl:`${r}/webhooks`}),s===l.ECOM_ADDITIONAL_FEES&&r&&(t.ecomAdditionalFees={...t.ecomAdditionalFees,deploymentUri:`${r}/service-plugins`}),s===l.ECOM_SHIPPING_RATES&&r&&(t.ecomShippingRates={...t.ecomShippingRates,deploymentUri:`${r}/service-plugins`}),s===l.ECOM_VALIDATIONS&&r&&(t.ecomValidations={...t.ecomValidations,deploymentUri:`${r}/service-plugins`}),s===l.ECOM_DISCOUNTS_TRIGGER&&r&&(t.ecomDiscountsTrigger={...t.ecomDiscountsTrigger,deploymentUri:`${r}/service-plugins`}),s===l.ECOM_PAYMENT_SETTINGS&&r&&(t.ecomPaymentSettings={...t.ecomPaymentSettings,deploymentUri:`${r}/service-plugins`})}),m},de=(0,U.default)(),Ce=(a,n)=>{let{baseApiUrl:r,id:m}=n;if(!m&&!r)return a;let p=de(a);return p.components.forEach(f=>{f.compType===l.TOPOLOGY&&(m&&(f.compId=m),r&&(f.compData.topology.topology.backendApiUrl=r))}),p};export{je as a,Ae as b,Ce as c};
4
- //# sourceMappingURL=chunk-E7IQZNJ7.js.map
3
+ import{J as l,K as A,L as S,M as O,N as h,O as w,R as C,S as N}from"./chunk-MIBBNKYS.js";import{l as e}from"./chunk-R3JUFM5X.js";import{c as R,e as P,h as T}from"./chunk-V4TR6DCM.js";var _=R((be,F)=>{"use strict";T();F.exports=L;function E(a){return a instanceof Buffer?Buffer.from(a):new a.constructor(a.buffer.slice(),a.byteOffset,a.length)}function L(a){if(a=a||{},a.circles)return K(a);let n=new Map;if(n.set(Date,t=>new Date(t)),n.set(Map,(t,s)=>new Map(m(Array.from(t),s))),n.set(Set,(t,s)=>new Set(m(Array.from(t),s))),a.constructorHandlers)for(let t of a.constructorHandlers)n.set(t[0],t[1]);let r=null;return a.proto?f:p;function m(t,s){let o=Object.keys(t),i=new Array(o.length);for(let g=0;g<o.length;g++){let c=o[g],u=t[c];typeof u!="object"||u===null?i[c]=u:u.constructor!==Object&&(r=n.get(u.constructor))?i[c]=r(u,s):ArrayBuffer.isView(u)?i[c]=E(u):i[c]=s(u)}return i}function p(t){if(typeof t!="object"||t===null)return t;if(Array.isArray(t))return m(t,p);if(t.constructor!==Object&&(r=n.get(t.constructor)))return r(t,p);let s={};for(let o in t){if(Object.hasOwnProperty.call(t,o)===!1)continue;let i=t[o];typeof i!="object"||i===null?s[o]=i:i.constructor!==Object&&(r=n.get(i.constructor))?s[o]=r(i,p):ArrayBuffer.isView(i)?s[o]=E(i):s[o]=p(i)}return s}function f(t){if(typeof t!="object"||t===null)return t;if(Array.isArray(t))return m(t,f);if(t.constructor!==Object&&(r=n.get(t.constructor)))return r(t,f);let s={};for(let o in t){let i=t[o];typeof i!="object"||i===null?s[o]=i:i.constructor!==Object&&(r=n.get(i.constructor))?s[o]=r(i,f):ArrayBuffer.isView(i)?s[o]=E(i):s[o]=f(i)}return s}}function K(a){let n=[],r=[],m=new Map;if(m.set(Date,o=>new Date(o)),m.set(Map,(o,i)=>new Map(f(Array.from(o),i))),m.set(Set,(o,i)=>new Set(f(Array.from(o),i))),a.constructorHandlers)for(let o of a.constructorHandlers)m.set(o[0],o[1]);let p=null;return a.proto?s:t;function f(o,i){let g=Object.keys(o),c=new Array(g.length);for(let u=0;u<g.length;u++){let b=g[u],d=o[b];if(typeof d!="object"||d===null)c[b]=d;else if(d.constructor!==Object&&(p=m.get(d.constructor)))c[b]=p(d,i);else if(ArrayBuffer.isView(d))c[b]=E(d);else{let v=n.indexOf(d);v!==-1?c[b]=r[v]:c[b]=i(d)}}return c}function t(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return f(o,t);if(o.constructor!==Object&&(p=m.get(o.constructor)))return p(o,t);let i={};n.push(o),r.push(i);for(let g in o){if(Object.hasOwnProperty.call(o,g)===!1)continue;let c=o[g];if(typeof c!="object"||c===null)i[g]=c;else if(c.constructor!==Object&&(p=m.get(c.constructor)))i[g]=p(c,t);else if(ArrayBuffer.isView(c))i[g]=E(c);else{let u=n.indexOf(c);u!==-1?i[g]=r[u]:i[g]=t(c)}}return n.pop(),r.pop(),i}function s(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return f(o,s);if(o.constructor!==Object&&(p=m.get(o.constructor)))return p(o,s);let i={};n.push(o),r.push(i);for(let g in o){let c=o[g];if(typeof c!="object"||c===null)i[g]=c;else if(c.constructor!==Object&&(p=m.get(c.constructor)))i[g]=p(c,s);else if(ArrayBuffer.isView(c))i[g]=E(c);else{let u=n.indexOf(c);u!==-1?i[g]=r[u]:i[g]=s(c)}}return n.pop(),r.pop(),i}}});T();import H from"node:fs/promises";var x=P(_(),1);var B=P(_(),1);var U=P(_(),1),y=e.object({errorReporting:e.object({url:e.string().optional(),artifact:e.object({fullArtifactId:e.string().max(255).min(1),version:e.string().max(255).min(1)}).optional()}).optional()}),j=e.object({iframeUrl:e.string().optional(),scriptAsset:e.object({exportedName:e.string(),containerId:e.string(),url:e.string(),scriptType:e.string().optional()}).optional()}),V=e.object({hostingPlatform:e.string(),fullPage:e.boolean().nullish(),hideInSidebar:e.boolean().nullish(),priority:e.number().nullish(),routePath:e.string().nullish(),title:e.string(),pageCategoryId:e.string().uuid().nullish(),activeSidebarPageId:e.string().nullish(),requiredPermission:e.string().nullish(),previousRoutePaths:e.array(e.string()).nullish()}).merge(y).merge(j).passthrough(),$=e.object({width:e.number().nullish(),height:e.number().nullish()}).merge(j).passthrough(),I=e.object({appId:e.string(),componentId:e.string().uuid(),spec:e.string().min(1),variantValue:e.string()}).passthrough().optional(),Y=e.object({compId:e.string(),compType:e.literal(l.BACK_OFFICE_PAGE),compData:e.object({backOfficePage:V}),compName:e.string().optional(),experiment:I}).passthrough(),X=e.object({compId:e.string(),compType:e.literal(l.BACK_OFFICE_EXTENSION),compData:e.object({backOfficeExtension:e.object({hostingPlatform:e.string(),extends:e.string(),title:e.string().nullish(),extensionType:e.literal(w.BACK_OFFICE_EXTENSION_WIDGET),requiredPermission:e.string().nullish(),widget:$}).merge(y).passthrough()}),compName:e.string().optional(),experiment:I}).passthrough(),q=e.object({compId:e.string(),compType:e.literal(l.BACK_OFFICE_EXTENSION_WIDGET),compData:e.object({backOfficeExtensionWidget:e.object({hostingPlatform:e.string(),extends:e.string(),title:e.string().nullish(),description:e.string().optional(),requiredPermission:e.string().nullish(),width:e.number().nullish(),height:e.number().nullish()}).merge(j).merge(y).passthrough()}),compName:e.string().optional(),experiment:I}).passthrough(),z=e.object({compId:e.string(),compType:e.literal(l.BACK_OFFICE_EXTENSION_MENU_ITEM),compData:e.object({backOfficeExtensionMenuItem:e.object({id:e.string().uuid(),title:e.string().min(1),subtitle:e.string().max(200).optional(),iconKey:e.string().min(3).max(50).optional(),extends:e.string().uuid(),action:e.object({navigateToPage:e.object({pageId:e.string().uuid(),relativeUrl:e.string().optional()}),openModal:e.object({componentId:e.string().uuid(),componentParams:e.record(e.string().min(1),e.string().min(1)).optional()})}).partial().superRefine((a,n)=>{!a.navigateToPage&&!a.openModal&&n.addIssue({code:e.ZodIssueCode.custom,message:"action must have either navigateToPage or openModal"}),a.navigateToPage&&a.openModal&&n.addIssue({code:e.ZodIssueCode.custom,message:"action can't have both navigateToPage and openModal"})}),sentryDSN:e.string().optional(),requiredPermission:e.string().optional()}).merge(j).merge(y).passthrough()}),compName:e.string().optional(),experiment:I}).passthrough(),J=e.object({compId:e.string(),compType:e.literal(l.BACK_OFFICE_MODAL),compData:e.object({backOfficeModal:e.object({hostingPlatform:e.string(),title:e.string().nullish(),requiredPermission:e.string().nullish(),width:e.number().nullish(),height:e.number().nullish()}).merge(j).merge(y).passthrough()}),compName:e.string().optional(),experiment:I}).passthrough(),Z=e.object({compId:e.string(),compType:e.literal(l.BACK_OFFICE_SIDEBAR_CATEGORY),compData:e.object({backOfficeSidebarCategory:e.object({hostingPlatform:e.string(),title:e.string(),priority:e.number().nullish()})}),compName:e.string().optional()}).passthrough(),Q=e.object({compId:e.string(),compType:e.literal(l.BACK_OFFICE_WIDGET),compName:e.string().optional()}).passthrough(),ee=e.object({compId:e.string(),compType:e.literal(l.BACK_OFFICE_EXTENSION_CONTAINER),compName:e.string().optional()}).passthrough(),k=e.object({packageName:e.string().min(2).max(100),version:e.number().int().min(0)}),te=e.object({template:e.string(),name:e.string(),pages:e.enum([S.NONE_PAGES,S.ONCE,S.SPECIFIC_PAGES]),placement:e.enum([O.HEAD,O.BODY_START,O.BODY_END,O.NONE_PLACEMENT]),connectArticleUrl:e.string(),embedCategory:e.enum([h.UNKNOWN,h.FUNCTIONAL,h.ESSENTIAL,h.ANALYTICS,h.ADVERTISING]),loadOnce:e.boolean(),allowedForFreeSite:e.boolean(),dependencies:e.array(k)}),oe=e.object({compId:e.string(),compType:e.literal(l.EMBEDDED_SCRIPT),compName:e.string().optional(),compData:e.object({embeddedScriptComponentData:te})}).passthrough(),ie=e.object({base:e.object({id:e.string().optional(),name:e.string()}),installation:e.object({base:e.object({autoAdd:e.boolean().optional(),essential:e.boolean().optional(),maxInstances:e.number().optional()}).optional(),widget:e.object({default_preset:e.object({desktop_preset_id:e.string().optional(),tablet_preset_id:e.string().optional(),mobile_preset_id:e.string().optional()}).optional(),region:e.enum([A.BODY,A.FOOTER,A.HEADER])}).optional()}).optional(),widgetData:e.object({tagName:e.string(),scriptUrl:e.string(),scriptType:e.enum([C.NONE,C.COMMON_JS,C.ES_MODULE])}),behaviors:e.object({settings:e.object({settingsUrl:e.string()}).optional(),dashboard:e.object({dashboardPageComponentId:e.string()}).optional()}),size:e.object({width:e.object({allowStretch:e.boolean().optional(),defaultWidth:e.number().optional(),stretchByDefault:e.boolean().optional()}),height:e.object({defaultHeight:e.number(),heightMode:e.enum([N.AUTO,N.FIXED,N.UNKNOWN]).optional()})}),dependencies:e.array(k)}),re=e.object({compId:e.string(),compType:e.literal(l.CUSTOM_ELEMENT_WIDGET),compName:e.string().optional(),compData:e.object({customElementWidget:ie})}).passthrough(),ne=e.object({compId:e.string().uuid(),compType:e.literal(l.WEBHOOK),compName:e.string().optional(),compData:e.object({webhook:e.object({webhookSlug:e.string(),callbackUrl:e.string()})})}).passthrough(),ae=e.object({compId:e.string().uuid(),compType:e.literal(l.ECOM_SHIPPING_RATES),compName:e.string().optional(),compData:e.object({ecomShippingRates:e.object({name:e.string(),deploymentUri:e.string(),description:e.string().optional(),learnMoreUrl:e.string().url().optional(),dashboardUrl:e.string().url().optional(),fallbackDefinitionMandatory:e.boolean().optional(),thumbnailUrl:e.string().url().optional()})})}).passthrough(),se=e.object({compId:e.string().uuid(),compType:e.literal(l.ECOM_ADDITIONAL_FEES),compName:e.string().optional(),compData:e.object({ecomAdditionalFees:e.object({deploymentUri:e.string()})})}).passthrough(),ce=e.object({compId:e.string().uuid(),compType:e.literal(l.ECOM_DISCOUNTS_TRIGGER),compName:e.string().optional(),compData:e.object({ecomDiscountsTrigger:e.object({deploymentUri:e.string()})})}).passthrough(),le=e.object({compId:e.string().uuid(),compType:e.literal(l.ECOM_VALIDATIONS),compName:e.string().optional(),compData:e.object({ecomValidations:e.object({deploymentUri:e.string(),validateInCart:e.boolean().optional()})})}).passthrough(),pe=e.object({compId:e.string().uuid(),compType:e.literal(l.ECOM_PAYMENT_SETTINGS),compName:e.string().optional(),compData:e.object({ecomPaymentSettings:e.object({deploymentUri:e.string(),fallbackValueForRequires3dSecure:e.boolean().optional()})})}).passthrough(),me=e.object({compType:e.literal(l.TOPOLOGY),compId:e.string(),compName:e.string().optional(),compData:e.object({topology:e.object({topology:e.object({backendApiUrl:e.string().url()})})})}).passthrough(),ge=e.object({appId:e.string(),components:e.array(e.discriminatedUnion("compType",[Y,X,q,z,J,Z,Q,ee,oe,re,ne,se,ae,ce,le,pe,me]))});async function je(a){try{let n=await H.readFile(a,"utf-8");return ge.parse(JSON.parse(n))}catch(n){let r=n instanceof Error?n.toString():JSON.stringify(n);throw new Error(`Failed to read App Manifest at ${a}: ${r}`)}}var Ie=(0,x.default)();var ue=(0,B.default)(),M=(a,n)=>new URL(a,n).href,D=(a,n)=>{let{scriptAsset:r,iframeUrl:m}=a;return r?{scriptAsset:{...r,url:M(r.url,n)}}:m?{iframeUrl:M(m,n)}:a},fe=(a,n)=>({template:a.template.replaceAll("__STATICS_BASE_URL_PLACEHOLDER__",n)}),Ae=(a,n,r)=>{let m=ue(a),p=n.endsWith("/")?n:`${n}/`;return m.components.forEach(f=>{let{compData:t,compType:s}=f;s===l.BACK_OFFICE_PAGE&&(t.backOfficePage={...t.backOfficePage,...D(t.backOfficePage,p)}),s===l.BACK_OFFICE_EXTENSION&&(t.backOfficeExtension.widget={...t.backOfficeExtension.widget,...D(t.backOfficeExtension.widget,p)}),s===l.BACK_OFFICE_EXTENSION_WIDGET&&(t.backOfficeExtensionWidget={...t.backOfficeExtensionWidget,...D(t.backOfficeExtensionWidget,p)}),s===l.BACK_OFFICE_MODAL&&(t.backOfficeModal={...t.backOfficeModal,...D(t.backOfficeModal,p)}),s===l.EMBEDDED_SCRIPT&&(t.embeddedScriptComponentData={...t.embeddedScriptComponentData,...fe(t.embeddedScriptComponentData,p)}),s===l.CUSTOM_ELEMENT_WIDGET&&(t.customElementWidget={...t.customElementWidget,widgetData:{...t.customElementWidget.widgetData,scriptUrl:M(t.customElementWidget.widgetData.scriptUrl,p)},behaviors:{...t.customElementWidget.behaviors,...t.customElementWidget.behaviors.settings?{settings:{settingsUrl:M(t.customElementWidget.behaviors.settings.settingsUrl,p)}}:{}}}),s===l.WEBHOOK&&r&&(t.webhook={...t.webhook,callbackUrl:`${r}/webhooks`}),s===l.ECOM_ADDITIONAL_FEES&&r&&(t.ecomAdditionalFees={...t.ecomAdditionalFees,deploymentUri:`${r}/service-plugins`}),s===l.ECOM_SHIPPING_RATES&&r&&(t.ecomShippingRates={...t.ecomShippingRates,deploymentUri:`${r}/service-plugins`}),s===l.ECOM_VALIDATIONS&&r&&(t.ecomValidations={...t.ecomValidations,deploymentUri:`${r}/service-plugins`}),s===l.ECOM_DISCOUNTS_TRIGGER&&r&&(t.ecomDiscountsTrigger={...t.ecomDiscountsTrigger,deploymentUri:`${r}/service-plugins`}),s===l.ECOM_PAYMENT_SETTINGS&&r&&(t.ecomPaymentSettings={...t.ecomPaymentSettings,deploymentUri:`${r}/service-plugins`})}),m},de=(0,U.default)(),Ce=(a,n)=>{let{baseApiUrl:r,id:m}=n;if(!m&&!r)return a;let p=de(a);return p.components.forEach(f=>{f.compType===l.TOPOLOGY&&(m&&(f.compId=m),r&&(f.compData.topology.topology.backendApiUrl=r))}),p};export{je as a,Ae as b,Ce as c};
4
+ //# sourceMappingURL=chunk-4YU6J2EW.js.map
@@ -1,4 +1,4 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{lb as p,ua as r}from"./chunk-TSKFLGBO.js";import{a as v,b as f}from"./chunk-JPGXKQXP.js";import{e as m,h as c}from"./chunk-V4TR6DCM.js";c();var s=m(v(),1),i=m(f(),1);function k(){let{model:t}=p(),n=(0,s.useMemo)(()=>{let l=t.components.filter((0,i.isType)(r.Api)).sort((e,o)=>e.title.localeCompare(o.title)),a=t.components.filter((0,i.isType)(r.Event)).sort((e,o)=>e.title.localeCompare(o.title)),u=t.components.filter((0,i.isType)(r.ServicePlugin)).sort((e,o)=>e.servicePlugin.name.localeCompare(o.servicePlugin.name));return{Api:l,Event:a,ServicePlugin:u}},[t.components]);return{backendComponents:[...n.Api,...n.Event,...n.ServicePlugin],backendComponentsByType:n}}export{k as a};
4
- //# sourceMappingURL=chunk-HNY5L6XA.js.map
3
+ import{mb as p,va as r}from"./chunk-MIBBNKYS.js";import{a as v,b as f}from"./chunk-R3JUFM5X.js";import{e as m,h as c}from"./chunk-V4TR6DCM.js";c();var s=m(v(),1),i=m(f(),1);function k(){let{model:t}=p(),n=(0,s.useMemo)(()=>{let l=t.components.filter((0,i.isType)(r.Api)).sort((e,o)=>e.title.localeCompare(o.title)),a=t.components.filter((0,i.isType)(r.Event)).sort((e,o)=>e.title.localeCompare(o.title)),u=t.components.filter((0,i.isType)(r.ServicePlugin)).sort((e,o)=>e.servicePlugin.name.localeCompare(o.servicePlugin.name));return{Api:l,Event:a,ServicePlugin:u}},[t.components]);return{backendComponents:[...n.Api,...n.Event,...n.ServicePlugin],backendComponentsByType:n}}export{k as a};
4
+ //# sourceMappingURL=chunk-6QCQALVT.js.map
@@ -1,4 +1,4 @@
1
1
  import { createRequire as _createRequire } from 'node:module';
2
2
  const require = _createRequire(import.meta.url);
3
- import{Ta as e,u as r}from"./chunk-TSKFLGBO.js";import{a as m}from"./chunk-JPGXKQXP.js";import{e as t,h as i}from"./chunk-V4TR6DCM.js";i();var p=t(m(),1);function f(){let o=r();return(0,p.useMemo)(()=>e(o),[o])}i();export{f as a};
4
- //# sourceMappingURL=chunk-3EO7KOOF.js.map
3
+ import{Ua as e,u as r}from"./chunk-MIBBNKYS.js";import{a as m}from"./chunk-R3JUFM5X.js";import{e as t,h as i}from"./chunk-V4TR6DCM.js";i();var p=t(m(),1);function f(){let o=r();return(0,p.useMemo)(()=>e(o),[o])}i();export{f as a};
4
+ //# sourceMappingURL=chunk-7OVUUUVH.js.map