@lightspeed/crane 1.1.3 → 1.2.1

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 (30) hide show
  1. package/CHANGELOG.md +179 -0
  2. package/bin/crane.js +3 -2
  3. package/dist/app.d.mts +50 -12
  4. package/dist/app.d.ts +50 -12
  5. package/dist/app.mjs +1 -1
  6. package/dist/cli.d.mts +2 -1
  7. package/dist/cli.d.ts +2 -1
  8. package/dist/cli.mjs +6 -8
  9. package/package.json +11 -3
  10. package/template/headers/example-header/showcases/2.ts +1 -1
  11. package/template/package.json +3 -4
  12. package/template/reference/sections/about-us/showcases/1.ts +2 -23
  13. package/template/reference/sections/about-us/showcases/2.ts +2 -19
  14. package/template/reference/sections/intro-slider/showcases/1.ts +2 -1
  15. package/template/reference/sections/intro-slider/showcases/2.ts +2 -1
  16. package/template/sections/example-section/ExampleSection.vue +13 -5
  17. package/template/sections/example-section/assets/arrow.svg +3 -0
  18. package/template/sections/example-section/component/button/Button.vue +87 -0
  19. package/template/sections/example-section/component/selectbox/Selectbox.vue +45 -0
  20. package/template/sections/example-section/component/toggle/Toggle.vue +110 -0
  21. package/template/sections/example-section/settings/content.ts +49 -1
  22. package/template/sections/example-section/settings/design.ts +4 -0
  23. package/template/sections/example-section/settings/translations.ts +48 -0
  24. package/template/sections/example-section/showcases/1.ts +43 -0
  25. package/template/sections/example-section/showcases/2.ts +43 -0
  26. package/template/sections/example-section/showcases/3.ts +43 -0
  27. package/template/sections/example-section/showcases/translations.ts +158 -2
  28. package/template/shared/components/LanguageSelector.vue +4 -4
  29. package/template/shared/utils.ts +28 -0
  30. package/types.d.ts +15 -8
package/dist/cli.mjs CHANGED
@@ -1,10 +1,8 @@
1
- import io from"cac";import{red as ao,yellow as po,green as N}from"kolorist";import ne from"prompts";import b from"node:fs";import w from"node:path";import T from"node:process";import{fileURLToPath as R}from"node:url";import*as X from"fs";import D,{existsSync as O,rename as co,unlink as lo,statSync as fo,promises as uo,writeFileSync as yo,createReadStream as mo}from"fs";import*as z from"path";import S,{resolve as f,parse as x,dirname as go,sep as ho}from"path";import{glob as m,globSync as re}from"glob";import{build as ie,defineConfig as ae}from"vite";import{builtinModules as pe}from"module";import ce from"@vitejs/plugin-vue";import K from"vite-tsconfig-paths";import{viteExternalsPlugin as $o}from"vite-plugin-externals";import bo from"vite-plugin-compression";import To from"vite-plugin-checker";import Eo from"ajv/dist/2020.js";import jo from"ajv-formats";import*as l from"process";import wo from"process";import{pathToFileURL as _}from"url";import{readFile as le}from"fs/promises";import Oo,{AxiosError as de}from"axios";import{inc as So}from"semver";import{ConcurrencyManager as vo}from"axios-concurrency";import Ao from"tinycolor2";import Co from"cli-progress";function fe(e,t){X.statSync(e).isDirectory()?(X.mkdirSync(t,{recursive:!0}),X.readdirSync(e).forEach(o=>{const s=z.resolve(e,o),n=z.resolve(t,o);fe(s,n)})):X.copyFileSync(e,t)}function I(e,t,o,s){const n=z.join(e,s?.[o]??o);fe(z.join(t,o),n)}function V(e,t=2){if(!+e)return"0 Bytes";const o=1024,s=t<0?0:t,n=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],r=Math.floor(Math.log(e)/Math.log(o));return`${parseFloat((e/o**r).toFixed(s))} ${n[r]}`}const p={error:e=>console.log(ao(e)),warn:e=>console.log(po(e)),info:e=>console.log(N(e))},L="_temp",g="dist/sections",J="dist/headers",Z="dist/footers",P="dist/templates",ue=2*1024*1024;function W(e){return!!e}function ye(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}async function Do(e){try{const t=e,o=T.cwd(),s=w.join(o,t),n=["templates","headers","footers","reference"],r={_gitignore:".gitignore"};b.existsSync(s)?(p.error(`App with the name: ${e} already exists. If you'd like to override it, delete previous version first`),T.exit(1)):b.mkdirSync(s);const i=w.resolve(R(import.meta.url),"../..","template");b.readdirSync(i).filter(c=>c!=="package.json").filter(c=>!n.includes(c)).forEach(async c=>I(s,i,c,r));const a=JSON.parse(b.readFileSync(w.join(i,"package.json"),"utf-8"));a.name=e;const y=w.join(s,"package.json");b.writeFileSync(y,`${JSON.stringify(a,null,2)}
2
- `),p.info(`App ${e} created`)}catch(t){p.error(`Error while creating app: ${t.message}`),T.exit(1)}}function Y(e,t,o,s){try{const n=T.cwd(),r=S.join(n,t);D.existsSync(r)||D.mkdirSync(r);const i=S.join(n,t,o);D.existsSync(i)?(p.error(`${s} with the name: ${o} already exists. If you'd like to override it, delete previous version first`),T.exit(1)):D.mkdirSync(i);const a=S.resolve(R(import.meta.url),"../..",e);D.readdirSync(a).forEach(async y=>I(i,a,y)),p.info(`${s} ${o} created`)}catch(n){p.error(`Error while creating ${s}: ${n.message}`),T.exit(1)}}function me(e){const t=T.cwd(),o=S.resolve(R(import.meta.url),"../..",`template/${e}`),s=S.join(t,e);D.existsSync(s)||(D.mkdirSync(s),D.readdirSync(o).forEach(async n=>I(s,o,n)))}async function Io(e){Y("template/sections/example-section","sections",e,"Section")}async function _o(e,t=!1){try{const o=T.cwd(),s=w.join(o,"templates"),n={"template.ts":`${e}.ts`};b.existsSync(s)?b.existsSync(w.join(s,`${e}.ts`))&&(p.error(`Template with the name: ${e} already exists. If you'd like to override it, delete previous version first`),T.exit(1)):b.mkdirSync(s);const r=w.resolve(R(import.meta.url),"../..","template/templates");b.readdirSync(r).forEach(async i=>I(s,r,i,n)),t&&(me("headers"),me("footers")),p.info(`Template descriptor file [${e}.ts] has been created`)}catch(o){p.error(`Error while creating template descriptors: ${o.message}`),T.exit(1)}}async function No(){try{const e=T.cwd(),t=w.resolve(R(import.meta.url),"../../","template/reference"),o=b.readdirSync(t);let s=!1;for(const n of o){const r=w.join(t,n),i=w.join(e,n);b.existsSync(i)||b.mkdirSync(i,{recursive:!0});const a=b.readdirSync(r),y=b.readdirSync(i);if(n==="shared"){a.forEach(c=>{I(i,r,c)});continue}for(const c of a){if(c==="assets"){I(i,r,c);continue}if(y.includes(c)){const{name:A}=await ne({type:"text",name:"name",message:`The "${c}" already exists in ${n} directory: provide a new name to keep both or press Esc to skip this one.`});A?(I(i,r,c,{[c]:A}),s=!0):p.info(`Skipped: ${c}`)}else I(i,r,c)}}p.info("Reference templates have been added to the app"),s&&p.warn("Some files or folders were renamed to avoid conflicts. Temlate files may need to be updated to reflect these changes.")}catch(e){p.error(`Error while creating template descriptors: ${e.message}`),T.exit(1)}}var h=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.SectionSetting=2]="SectionSetting",e[e.SectionShowcase=3]="SectionShowcase",e[e.SectionAsset=4]="SectionAsset",e[e.TemplateDescriptor=5]="TemplateDescriptor",e[e.TemplateAsset=6]="TemplateAsset",e))(h||{}),E=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.Misc=2]="Misc",e))(E||{});const xo=()=>bo({ext:".gz",algorithm:"gzip",deleteOriginFile:!0}),ge=()=>{const e=process.env.npm_lifecycle_event;return To({typescript:!0,vueTsc:!1,eslint:{lintCommand:`eslint --max-warnings=0 "./sections/**/*.{js,ts,vue}" --cache --cache-location "./build/eslintcache/${e}.json"`}})},Lo="/* EXTERNAL_IMPORTS_START */",Po="/* EXTERNAL_IMPORTS_END */",ko=()=>({name:"external-imports-wrapper-plugin",enforce:"post",apply:"build",generateBundle(e,t){for(const o of Object.keys(t)){const s=t[o];if(s.type==="chunk"){const n=/import.*\?commonjs-external["'];/g,r=s.code.match(n);if(r!==null){const i=r.join(""),a=Lo+i+Po,y=s.code.replace(n,"");s.code=a+y}}}}}),Ro={[E.Server]:[ce(),K(),ko(),xo()],[E.Client]:[ce(),K(),ge(),$o({vue:"EcVue"})],[E.Misc]:[K(),ge()]};var Q=(e=>(e.SECTION="SECTION",e.HEADER="HEADER",e.FOOTER="FOOTER",e))(Q||{});const u={SECTION:{source:"sections",dist:"dist/sections"},HEADER:{source:"headers",dist:"dist/headers"},FOOTER:{source:"footers",dist:"dist/footers"}};function G(e){return O(`${J}/${e}`)?"HEADER":O(`${Z}/${e}`)?"FOOTER":"SECTION"}function Go(e){const t=G(e);return u[t].dist}const he={"process.env":{NODE_ENV:"production"}},Fo=[...pe,...pe.map(e=>`node:${e}`)],Bo=[/@vue\/compiler-dom/,/@vue\/runtime-dom/,/@vue\/server-renderer/,/@vue\/compiler-ssr/,/@vue\/shared/],v={[h.Server]:{pluginType:E.Server,define:he,ssr:!0,ssrOptions:{noExternal:!0},outDir:(e,t)=>`./${u[t].dist}/${e}/js/main/server`,externalOption:[...Fo,...Bo],entryFileNames:"server.js",inlineDynamicImports:!0},[h.Client]:{pluginType:E.Client,define:he,ssr:!1,outDir:(e,t)=>`./${u[t].dist}/${e}/js/main/client`,entryFileNames:"client.js",assetFileNames:"assets/[name].[ext]",chunkFileNames:"chunks/[name].js",inlineDynamicImports:!1},[h.SectionSetting]:{pluginType:E.Misc,ssr:!1,outDir:(e,t)=>`./${u[t].dist}/${e}/js/settings`,entryFileNames:"[name].mjs"},[h.SectionShowcase]:{pluginType:E.Misc,ssr:!1,outDir:(e,t)=>`./${u[t].dist}/${e}/js/showcases`,entryFileNames:"[name].mjs"},[h.SectionAsset]:{pluginType:E.Misc,ssr:!1,outDir:(e,t)=>`./${u[t].dist}/${e}/assets`,assetFileNames:"[name].[ext]"},[h.TemplateDescriptor]:{pluginType:E.Misc,ssr:!1,outDir:()=>`./${P}/js`,entryFileNames:`[name]${L}.mjs`},[h.TemplateAsset]:{pluginType:E.Misc,ssr:!1,outDir:()=>`./${P}/assets`,assetFileNames:"[name].[ext]"}};function Mo(e){switch(typeof e){case"string":return[f(process.cwd(),e)];case"object":return e.map(t=>f(process.cwd(),t));default:return[]}}function $e(e,t,o,s){const n=v[o].define,r=v[o].ssrOptions,i=v[o].entryFileNames,a=v[o].chunkFileNames,y=v[o].assetFileNames,c=v[o].inlineDynamicImports,A=v[o].externalOption;return{plugins:Ro[v[o].pluginType],...n!=null&&{define:n},...r!=null&&{ssr:r},resolve:{alias:{"@":"/src"}},css:{preprocessorOptions:{scss:{api:"modern-compiler"}}},build:{ssr:v[o].ssr,outDir:v[o].outDir(e,s),emptyOutDir:!0,minify:"terser",terserOptions:{compress:{drop_console:!1}},rollupOptions:{...A!=null&&{external:A},preserveEntrySignatures:"strict",input:Mo(t),output:{validate:!0,inlineDynamicImports:c,...i!=null&&{entryFileNames:i},...a!=null&&{chunkFileNames:a},...y!=null&&{assetFileNames:y}}}}}}const be="https://json-schema.org/draft/2020-12/schema",Te="https://lightspeedhq.com/template-default.schema.json",Ee="Default Section",je="Default section for a Custom Template",we="object",Oe={"default-section":{type:"object",properties:{type:{description:"Type of the section",type:"string",const:"default"},id:{description:"Identification of the section",type:"string",pattern:"^((header|cover|announcement_bar|slider|special_offer|customer_review|company_info|shipping_payment|location|store|footer)(_\\d{3})?)$"},showcase_id:{description:"Showcase id of the section",type:"string"}},required:["type","id"],additionalProperties:!1}},qo={$schema:be,$id:Te,title:Ee,description:je,type:we,$defs:Oe},Uo={__proto__:null,$defs:Oe,$id:Te,$schema:be,default:qo,description:je,title:Ee,type:we},Se="https://json-schema.org/draft/2020-12/schema",ve="https://lightspeedhq.com/template-custom.schema.json",Ae="Custom Section",Ce="Custom section for a Custom Template",De="object",Ie={"custom-section":{type:"object",properties:{type:{description:"Type of the section",type:"string",const:"custom"},id:{description:"Identification of the section",type:"string"},showcase_id:{description:"Showcase id of the section",type:"string"},showcase_overrides:{$ref:"showcase_overrides.schema.json"}},required:["type","id"],additionalProperties:!1}},Xo={$schema:Se,$id:ve,title:Ae,description:Ce,type:De,$defs:Ie},zo={__proto__:null,$defs:Ie,$id:ve,$schema:Se,default:Xo,description:Ce,title:Ae,type:De},_e="https://json-schema.org/draft/2020-12/schema",Ne="https://lightspeedhq.com/template-custom-content.schema.json",xe="Custom Section :: Content Configuration",Le="Content tab configuration of a Custom Section for a Custom Template",Pe="object",ke={input_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"INPUTBOX"},text:{type:"string"}},required:["type","text"],additionalProperties:!1},text_area:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"TEXTAREA"},text:{type:"string"}},required:["type","text"],additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"BUTTON"},title:{type:"string"},buttonType:{type:"string",enum:["SCROLL_TO_TILE","HYPER_LINK","MAIL_LINK","TEL_LINK","GO_TO_STORE_LINK","GO_TO_PAGE"]},link:{type:"string",format:"uri"},linkTarget:{type:"string"},email:{type:"string"},phone:{type:"string"},tileId:{type:"string"}},required:["type","title"],additionalProperties:!1},image:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"IMAGE"},imageData:{type:"object",properties:{set:{type:"object"},borderInfo:{type:"object"},bucket:{type:"string"}},required:["set"]}},required:["type"],additionalProperties:!1},toggle:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"TOGGLE"},enabled:{type:"boolean"}},required:["type"],additionalProperties:!1},select_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"SELECTBOX"},value:{type:"string"}},required:["type"],additionalProperties:!1},logo:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"LOGO"},logoType:{description:"Type of the logo content",type:"string",enum:["TEXT","IMAGE"]},text:{description:"Logo content text",type:"string"},imageData:{type:"object",properties:{set:{type:"object"},borderInfo:{type:"object"},bucket:{type:"string"}},required:["set"]}},required:["type"],additionalProperties:!1},menu:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"MENU"}},required:["type"],additionalProperties:!1},deck:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"DECK"},cards:{type:"array",items:{type:"object",properties:{settings:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the settings configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]}},required:["type"],allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/input_box"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"template-custom-content.schema.json#/$defs/text_area"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-content.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/select_box"}}]}},minProperties:1}},required:["settings"]}}},required:["type","cards"]}},Ho={$schema:_e,$id:Ne,title:xe,description:Le,type:Pe,$defs:ke},Ko={__proto__:null,$defs:ke,$id:Ne,$schema:_e,default:Ho,description:Le,title:xe,type:Pe},Re="https://json-schema.org/draft/2020-12/schema",Ge="https://lightspeedhq.com/template-custom-design.schema.json",Fe="Custom Section :: Design Configuration",Be="Design tab configuration of a Custom Section for a Custom Template",Me="object",qe={text:{type:"object",properties:{type:{description:"Type of the text",type:"string",const:"TEXT"},font:{description:"Default font for the text",type:"string"},size:{description:"Default size for the text",type:"integer",minimum:1,exclusiveMaximum:50},bold:{description:"Default boldness for the text",type:"boolean"},italic:{description:"Default italic style for the text",type:"boolean"},color:{description:"Default color for the text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},visible:{description:"Default visibility for the text",type:"boolean"}},additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the button",type:"string",const:"BUTTON"},font:{description:"Default font for the button",type:"string"},size:{description:"Default size for the button",type:"string",enum:["SMALL","MEDIUM","LARGE"]},appearance:{description:"Default appearance for the button",type:"string",enum:["SOLID","OUTLINE","TEXT"]},shape:{description:"Default shape for the button",type:"string",enum:["ROUND_CORNER","RECTANGLE","PILL"]},color:{description:"Default color for the button",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"}},additionalProperties:!1},image:{type:"object",properties:{type:{description:"Type of the image",type:"string",const:"IMAGE"},overlay:{description:"Default overlay for the image",type:"string",enum:["COLOR","GRADIENT","NONE"]}},if:{properties:{overlay:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default color for the image",type:"array",items:{type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},minItems:2,maxItems:2}}},else:{properties:{color:{description:"Default color for the image",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"}}}},toggle:{type:"object",properties:{type:{description:"Type of the toggle",type:"string",const:"TOGGLE"},enabled:{description:"Default enabled status for the toggle",type:"boolean"}},additionalProperties:!1},select_box:{type:"object",properties:{type:{description:"Type of the checkbox",type:"string",const:"SELECTBOX"},value:{description:"Default option for the checkbox",type:"string"}},additionalProperties:!1},background:{type:"object",properties:{type:{description:"Type of the background",type:"string",const:"BACKGROUND"},style:{description:"Default style for the background",type:"string",enum:["COLOR","GRADIENT"]}},if:{properties:{style:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default colors for the image",type:"array",items:{type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},minItems:2,maxItems:2}}},else:{properties:{color:{description:"Default color for the image",type:"string"}}}},logo:{type:"object",properties:{type:{description:"Type of the logo",type:"string",const:"LOGO"},font:{description:"Default font for the text logo",type:"string"},size:{description:"Default size for the text logo",type:"integer",minimum:1,exclusiveMaximum:50},bold:{description:"Default boldness for the text logo",type:"boolean"},italic:{description:"Default italic style for the text logo",type:"boolean"},color:{description:"Default color for the text logo",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},visible:{description:"Default visibility for the logo",type:"boolean"},spacing:{description:"Default spacing size for the text logo",type:"integer",minimum:1,exclusiveMaximum:10},capitalization:{description:"Default capitalization style for the text logo",type:"string",enum:["none","all","small"]},frame:{description:"Default frame for the text logo",type:"object",properties:{visible:{description:"Default visibility for the frame on text logo",type:"boolean"},width:{description:"Default width size for the frame on text logo",type:"integer",minimum:1,exclusiveMaximum:50},color:{description:"Default color for the frame on text logo",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"}},required:["visible","width","color"],additionalProperties:!1}},additionalProperties:!1}},Vo={$schema:Re,$id:Ge,title:Fe,description:Be,type:Me,$defs:qe},Jo={__proto__:null,$defs:qe,$id:Ge,$schema:Re,default:Vo,description:Be,title:Fe,type:Me},Ue="https://json-schema.org/draft/2020-12/schema",Xe="https://lightspeedhq.com/section-content.schema.json",ze="Custom Section - Content",He="The content of a custom section",Ke="object",Ve={"^.*$":{type:"object",properties:{type:{type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","INFO","DECK","MENU","NAVIGATION_MENU","LOGO"]}},required:["type"],allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"#/$defs/Inputbox"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"#/$defs/Textarea"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"#/$defs/Button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"#/$defs/Image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"#/$defs/Toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"#/$defs/Selectbox"}},{if:{properties:{type:{const:"INFO"}}},then:{$ref:"#/$defs/Info"}},{if:{properties:{type:{const:"DECK"}}},then:{$ref:"#/$defs/Deck"}},{if:{properties:{type:{const:"MENU"}}},then:{$ref:"#/$defs/Menu"}},{if:{properties:{type:{const:"NAVIGATION_MENU"}}},then:{$ref:"#/$defs/NavigationMenu"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"#/$defs/Logo"}}]}},Je={Inputbox:{type:"object",properties:{type:{const:"INPUTBOX"},label:{type:"string"},placeholder:{type:"string"},defaults:{$ref:"#/$defs/InputboxDefaults"}},required:["type","label","placeholder"]},Textarea:{type:"object",properties:{type:{const:"TEXTAREA"},label:{type:"string"},placeholder:{type:"string"},defaults:{$ref:"#/$defs/TextareaDefaults"}},required:["type","label","placeholder"]},Button:{type:"object",properties:{type:{const:"BUTTON"},label:{type:"string"},defaults:{$ref:"#/$defs/ButtonDefaults"}},required:["type","label"]},Image:{type:"object",properties:{type:{const:"IMAGE"},label:{type:"string"},defaults:{$ref:"#/$defs/ImageDefaults"}},required:["type","label"]},Toggle:{type:"object",properties:{type:{const:"TOGGLE"},label:{type:"string"},description:{type:"string"},defaults:{$ref:"#/$defs/ToggleDefaults"}},required:["type","label","description"]},Selectbox:{type:"object",properties:{type:{const:"SELECTBOX"},label:{type:"string"},placeholder:{type:"string"},description:{type:"string"},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SelectboxDefaults"}},required:["type","label","placeholder","description","options"]},Menu:{type:"object",properties:{type:{const:"MENU"},label:{type:"string"}},required:["type"]},NavigationMenu:{type:"object",properties:{type:{const:"NAVIGATION_MENU"}},required:["type"]},Logo:{type:"object",properties:{type:{const:"LOGO"},label:{type:"string"}},required:["type"]},Info:{type:"object",properties:{type:{const:"INFO"},label:{type:"string"},description:{type:"string"},button:{$ref:"#/$defs/InfoEditorButton"},defaults:{$ref:"#/$defs/InfoDefaults"}},required:["type","label","description"]},InputboxDefaults:{type:"object",properties:{text:{type:"string"}},required:["text"]},TextareaDefaults:{type:"object",properties:{text:{type:"string"}},required:["text"]},ButtonDefaults:{type:"object",properties:{title:{type:"string"},buttonType:{type:"string",enum:["SCROLL_TO_TILE","HYPER_LINK","MAIL_LINK","TEL_LINK","GO_TO_STORE_LINK","GO_TO_PAGE"]},link:{type:"string",format:"uri"},linkTarget:{type:"string"},email:{type:"string"},phone:{type:"string"},tileId:{type:"string"}},required:["title"]},ImageDefaults:{type:"object",properties:{imageData:{$ref:"section-commons.schema.json#/$defs/Image"}}},ToggleDefaults:{type:"object",properties:{enabled:{type:"boolean"}}},SelectboxDefaults:{type:"object",properties:{value:{type:"string"}}},InfoDefaults:{type:"object",properties:{text:{type:"object",additionalProperties:{type:"string"}},button:{$ref:"#/$defs/InfoButtonDefaults"}}},SelectboxOption:{type:"object",properties:{label:{type:"string"},value:{type:"string"}}},InfoEditorButton:{type:"object",properties:{label:{type:"string"},link:{type:"string"}}},InfoButtonDefaults:{type:"object",properties:{title:{type:"string"},link:{type:"string",minLength:0}}},Deck:{type:"object",properties:{cards:{description:"Cards of the content configuration element",type:"object",properties:{settings:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the settings configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]}},required:["type"],allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"#/$defs/Inputbox"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"#/$defs/Textarea"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"#/$defs/ButtonDefaults"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"#/$defs/Image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"#/$defs/Toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"#/$defs/Selectbox"}}]}},minProperties:1}}}}}},Ze=!1,Zo={$schema:Ue,$id:Xe,title:ze,description:He,type:Ke,patternProperties:Ve,$defs:Je,additionalProperties:Ze},We={__proto__:null,$defs:Je,$id:Xe,$schema:Ue,additionalProperties:Ze,default:Zo,description:He,patternProperties:Ve,title:ze,type:Ke},Ye="https://json-schema.org/draft/2020-12/schema",Qe="https://lightspeedhq.com/sections/section-translation.schema.json",et="Custom Section - Translations",tt="The translation of the section's labels",ot="object",st={"^[a-z]{2}$":{type:"object",patternProperties:{"^\\$.*$":{type:"string"}},additionalProperties:!1}},nt=!1,Wo={$schema:Ye,$id:Qe,title:et,description:tt,type:ot,patternProperties:st,additionalProperties:nt},rt={__proto__:null,$id:Qe,$schema:Ye,additionalProperties:nt,default:Wo,description:tt,patternProperties:st,title:et,type:ot},it="https://json-schema.org/draft/2020-12/schema",at="https://lightspeedhq.com/section-design.schema.json",pt="Custom Section - Design",ct="The design of a custom section",lt="object",dt={"^.*$":{type:"object",properties:{type:{type:"string",enum:["TEXT","IMAGE","BUTTON","BACKGROUND","TOGGLE","COLOR_PICKER","RATING","SELECTBOX","SOCIAL_PROFILES","LOGO"]}},required:["type"],allOf:[{if:{properties:{type:{const:"TEXT"}}},then:{$ref:"#/$defs/Text"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"#/$defs/Image"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"#/$defs/Button"}},{if:{properties:{type:{const:"BACKGROUND"}}},then:{$ref:"#/$defs/Background"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"#/$defs/Toggle"}},{if:{properties:{type:{const:"COLOR"}}},then:{$ref:"#/$defs/Color"}},{if:{properties:{type:{const:"RATING"}}},then:{$ref:"#/$defs/Rating"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"#/$defs/Selectbox"}},{if:{properties:{type:{const:"SOCIAL_PROFILES"}}},then:{$ref:"#/$defs/SocialProfile"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"#/$defs/Logo"}}]}},ft={Text:{type:"object",properties:{type:{const:"TEXT"},label:{type:"string"},sizes:{type:"array",items:{type:"integer"}},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},hideSize:{type:["boolean","null"]},defaults:{$ref:"#/$defs/TextDesignDefaults"}},required:["type","label"]},Image:{type:"object",properties:{type:{const:"IMAGE"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},defaults:{$ref:"#/$defs/ImageDesignDefaults"}},required:["type","label"]},Button:{type:"object",properties:{type:{const:"BUTTON"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAutoColor:{type:["boolean","null"]},enableAlphaColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},hideSize:{type:["boolean","null"]},defaults:{$ref:"#/$defs/ButtonDesignDefaults"}},required:["type","label"]},Background:{type:"object",properties:{type:{const:"BACKGROUND"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},defaults:{$ref:"#/$defs/BackgroundDesignDefaults"}},required:["type","label"]},Toggle:{type:"object",properties:{type:{const:"TOGGLE"},label:{type:"string"},description:{type:"string"},defaults:{$ref:"#/$defs/ToggleDesignDefaults"}},required:["type","label"]},Color:{type:"object",properties:{type:{const:"COLOR_PICKER"},label:{type:"string"},description:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},defaults:{$ref:"#/$defs/ColorPickerDefaults"}},required:["type","label"]},Rating:{type:"object",properties:{type:{const:"RATING"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/RatingDefaults"}},required:["type","label"]},Selectbox:{type:"object",properties:{type:{const:"SELECTBOX"},label:{type:"string"},description:{type:"string"},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SelectboxDefaults"}},required:["type","label"]},SocialProfile:{type:"object",properties:{type:{const:"SOCIAL_PROFILES"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SocialProfilesDefaults"}},required:["type","label"]},Logo:{type:"object",properties:{type:{const:"LOGO"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},sizes:{type:"array",items:{type:"integer"}},defaults:{$ref:"#/$defs/LogoDesignDefaults"}},required:["type"]},TextDesignDefaults:{type:"object",properties:{font:{type:"string"},size:{oneOf:[{type:"integer"},{type:"string"}]},bold:{type:"boolean"},italic:{type:"boolean"},color:{type:"string"},visible:{type:"boolean"}},required:[]},ImageDesignDefaults:{type:"object",properties:{overlay:{type:"string"},visible:{type:"boolean"}},required:[]},ButtonDesignDefaults:{type:"object",properties:{appearance:{type:"string",enum:["SOLID","OUTLINE","TEXT"]},font:{type:"string"},size:{type:"string",enum:["SMALL","MEDIUM","LARGE"]},style:{type:"string",enum:["round-corner","rectangle","pill"]},color:{type:"string"},visible:{type:"boolean"}},required:[]},BackgroundDesignDefaults:{type:"object",properties:{appearance:{$ref:"section-commons.schema.json#/$defs/Background"}},required:[]},ToggleDesignDefaults:{type:"object",properties:{enabled:{type:"boolean"}},required:[]},ColorPickerDefaults:{type:"object",properties:{appearance:{$ref:"section-commons.schema.json#/$defs/Color"}},required:[]},RatingDefaults:{type:"object",properties:{color:{$ref:"section-commons.schema.json#/$defs/Color"},visible:{type:"boolean"},style:{type:"string"}},required:[]},SelectboxDefaults:{type:"object",properties:{value:{type:"string"}},required:[]},SocialProfilesDefaults:{type:"object",properties:{color:{$ref:"section-commons.schema.json#/$defs/Color"},visible:{type:"boolean"},appearance:{type:"string"}},required:[]},LogoDesignDefaults:{type:"object",properties:{font:{type:"string"},size:{oneOf:[{type:"integer"},{type:"string"}]},bold:{type:"boolean"},italic:{type:"boolean"},color:{type:"string"},visible:{type:"boolean"}},required:[]},SelectboxOption:{type:"object",properties:{value:{type:"string"},label:{type:"string"}},required:[]}},Yo={$schema:it,$id:at,title:pt,description:ct,type:lt,patternProperties:dt,$defs:ft},ut={__proto__:null,$defs:ft,$id:at,$schema:it,default:Yo,description:ct,patternProperties:dt,title:pt,type:lt},yt="https://json-schema.org/draft/2020-12/schema",mt="https://lightspeedhq.com/section-commons.schema.json",gt="Custom Section - Content",ht="The content of a custom section",$t="object",bt={Image:{type:"object",properties:{set:{type:"object",additionalProperties:{$ref:"#/$defs/ImageInfo"}},borderInfo:{$ref:"#/$defs/BorderInfo"},bucket:{type:"string"}},required:["set"]},ImageInfo:{type:"object",properties:{url:{type:"string"},width:{type:"integer",minimum:0},height:{type:"integer",minimum:0}}},BorderInfo:{type:"object",properties:{homogeneity:{type:"boolean"},color:{$ref:"#/$defs/RGBA"}}},RGBA:{type:"object",properties:{r:{type:"integer",minimum:0,maximum:255},g:{type:"integer",minimum:0,maximum:255},b:{type:"integer",minimum:0,maximum:255},a:{type:"number",format:"double",minimum:0,maximum:1}},required:["r","g","b","a"]},HSL:{type:"object",properties:{h:{type:"number",format:"double"},s:{type:"number",format:"double"},l:{type:"number",format:"double"},a:{type:"number",format:"double"}},required:["h","s","l","a"]},Overlay:{type:"object",properties:{type:{type:"string",enum:["solid","gradient","none"]},solid:{$ref:"#/$defs/Solid"},gradient:{$ref:"#/$defs/Gradient"}}},Solid:{type:"object",properties:{color:{$ref:"#/$defs/Color"}}},Gradient:{type:"object",properties:{fromColor:{$ref:"#/$defs/Color"},toColor:{$ref:"#/$defs/Color"}}},Background:{type:"object",properties:{type:{type:"string",enum:["solid","gradient"]},solid:{$ref:"#/$defs/Solid"},gradient:{$ref:"#/$defs/Gradient"}}},Color:{type:"object",properties:{raw:{type:"string"},hex:{type:"string"},auto:{type:"boolean"},rgba:{$ref:"#/$defs/RGBA"},hsl:{$ref:"#/$defs/HSL"}}}},Tt=!1,Qo={$schema:yt,$id:mt,title:gt,description:ht,type:$t,$defs:bt,additionalProperties:Tt},es={__proto__:null,$defs:bt,$id:mt,$schema:yt,additionalProperties:Tt,default:Qo,description:ht,title:gt,type:$t},Et="https://json-schema.org/draft/2020-12/schema",jt="https://lightspeedhq.com/section-showcase.schema.json",wt="Custom Section - Showcase settings",Ot="The setting of a showcase",St="object",vt=["showcaseId","previewImage"],At={showcaseId:{description:"Showcase id of the section",type:"string"},previewImage:{$ref:"section-commons.schema.json#/$defs/Image"},showcase_overrides:{$ref:"../showcase_overrides.schema.json"}},ts={$schema:Et,$id:jt,title:wt,description:Ot,type:St,required:vt,properties:At},Ct={__proto__:null,$id:jt,$schema:Et,default:ts,description:Ot,properties:At,required:vt,title:wt,type:St},Dt="https://json-schema.org/draft/2020-12/schema",It="https://lightspeedhq.com/template.schema.json",_t="Custom Template",Nt="A custom template enclosing the necessary custom and default blocks",xt="object",Lt={metadata:{type:"object",properties:{name:{description:"Name of the template",type:"string",minLength:2,maxLength:60},description:{description:"Short description of the template",type:"string",minLength:2,maxLength:150},preview_url:{description:"Preview url of the demo website",type:"string",format:"uri",pattern:"^(https?)://([^.]+?\\.)company\\.site($|/[A-Za-z0-9\\-._~:/?#\\[\\]@!$&'()*+,;=]*)?$"},cover_image:{type:"object",properties:{set:{description:"Name of the image set",type:"object",patternProperties:{".*":{type:"object",properties:{url:{description:"Path to the preview image relative to the 'assets' folder for a specific resolution",type:"string"}},required:["url"],additionalProperties:!1}}}},required:["set"],additionalProperties:!1}},required:["name","description","cover_image"],additionalProperties:!1},sections:{description:"List of sections contained by this template",type:"array",items:{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]}},allOf:[{if:{properties:{type:{const:"default"}}},then:{$ref:"template-default.schema.json#/$defs/default-section"}},{if:{properties:{type:{const:"custom"}}},then:{$ref:"template-custom.schema.json#/$defs/custom-section"}}]},minItems:1,uniqueItems:!1}},Pt=["metadata","sections"],os={$schema:Dt,$id:It,title:_t,description:Nt,type:xt,properties:Lt,required:Pt},kt={__proto__:null,$id:It,$schema:Dt,default:os,description:Nt,properties:Lt,required:Pt,title:_t,type:xt},Rt="https://json-schema.org/draft/2020-12/schema",Gt="https://lightspeedhq.com/showcase_overrides.schema.json",Ft="Showcase overrides",Bt="Overrides for the showcase",Mt="object",qt={content:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","LOGO","DECK","MENU","NAVIGATION_MENU"]}},allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/input_box"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"template-custom-content.schema.json#/$defs/text_area"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-content.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/select_box"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"template-custom-content.schema.json#/$defs/logo"}},{if:{properties:{type:{const:"DECK"}}},then:{$ref:"template-custom-content.schema.json#/$defs/deck"}}]}},minProperties:1},design:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the design configuration element",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND","LOGO"]}},allOf:[{if:{properties:{type:{const:"TEXT"}}},then:{$ref:"template-custom-design.schema.json#/$defs/text"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-design.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-design.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-design.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-design.schema.json#/$defs/select_box"}},{if:{properties:{type:{const:"BACKGROUND"}}},then:{$ref:"template-custom-design.schema.json#/$defs/background"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"template-custom-design.schema.json#/$defs/logo"}}]}},minProperties:1},layoutId:{description:"Layout ID for the showcase",type:"string"},blockName:{description:"Section name for the showcase",type:"string"}},ss={$schema:Rt,$id:Gt,title:Ft,description:Bt,type:Mt,properties:qt},ns={__proto__:null,$id:Gt,$schema:Rt,default:ss,description:Bt,properties:qt,title:Ft,type:Mt};var F=(e=>(e.CONTENT="Content",e.DESIGN="Design",e))(F||{});const rs={menu:{type:"NAVIGATION_MENU"},logo:{type:"LOGO"}},is={logo:{type:"LOGO",colors:["#FFFFFF66","#0000004D","#00000099","#64C7FF66","#F9947266","#C794CD66","#FFD17466"],sizes:[18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60],defaults:{font:"global.fontFamily.body",size:40,bold:!0,italic:!1,color:"#313131",visible:!0,spacing:2,capitalization:"all",frame:{visible:!0,width:3,color:"#313131"}}}};function Ut(e){switch(e){case Q.HEADER:return rs;default:return{}}}function Xt(e){switch(e){case Q.HEADER:return is;default:return{}}}function as({validationType:e,sectionType:t}){switch(e){case F.CONTENT:return Ut(t);case F.DESIGN:return Xt(t);default:return{}}}function ps(e){return Object.keys(e).length===0}function cs({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).filter(([s])=>t[s]!==void 0).forEach(([s,n])=>{const r=t[s];n.type!==r.type&&o.push({instancePath:s,keyword:"type-mismatch",message:`Editor type "${n.type}" for reserved key "${s}" does not match the required type "${r.type}".`})}),o}function ls({type:e,mandatorySettings:t}){return Object.keys(t).find(o=>t[o].type===e)}function ds({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).forEach(([s,n])=>{const r=ls({type:n.type,mandatorySettings:t});r&&s!==r&&o.push({instancePath:s,keyword:"key-mismatch",message:`Editor key "${s}" for overriden content type "${n.type}" does not match the required key name "${r}".`})}),o}function fs({type:e,mandatorySettings:t}){return Object.keys(t).findLast(o=>t[o].type===e)}function us({sectionSettings:e,mandatorySettings:t}){const o=[],s=Object.values(t).map(({type:r})=>r),n=Object.values(e).map(({type:r})=>r);return new Set(n.filter(r=>s.includes(r))).forEach(r=>{if(n.filter(i=>i===r).length>1){const i=fs({type:r,mandatorySettings:t});o.push({instancePath:i,keyword:"duplicate-type",message:`Editor type "${r}" can only be used once.`})}}),o}function ys(e,t){const{sectionSettings:o,sectionType:s}=t,n=as({validationType:e,sectionType:s});return n===void 0||ps(n)?[]:[...cs({sectionSettings:o,mandatorySettings:n}),...ds({sectionSettings:o,mandatorySettings:n}),...us({sectionSettings:o,mandatorySettings:n})]}const B=[es,ut,We,Ct,kt,Uo,zo,Ko,Jo,ns];function M(e,t){const o=new Eo({allErrors:!0,schemas:e});return jo(o),o.compile(t)}function ms(){return M(B,kt)}function zt(e){return e.map(t=>({instancePath:t.instancePath,message:t.message??"",keyword:t.keyword}))}const gs=e=>(()=>{const t=Go(e.name),o=t.split("/").pop()?.toLowerCase();return[{source:`./${o}/${e.name}/settings/content.ts`,dist:S.resolve(`${t}/${e.name}/js/settings/content`),ajv:M(B,We),validationType:F.CONTENT,sectionName:e.name},{source:`./${o}/${e.name}/settings/design.ts`,dist:S.resolve(`${t}/${e.name}/js/settings/design`),ajv:M(B,ut),validationType:F.DESIGN,sectionName:e.name},{source:`./${o}/${e.name}/settings/translations.ts`,dist:S.resolve(`${t}/${e.name}/js/settings/translations`),ajv:M(B,rt)},...e.showcaseEntryPoints.map(s=>({source:`./${o}/${e.name}/showcases/${x(s).name}.ts`,dist:S.resolve(`${t}/${e.name}/js/showcases/${x(s).name}`),ajv:M(B,s.indexOf("translations")===-1?Ct:rt)}))]})();function hs(e){const t=n=>{const r=(n??"").split("/").filter(i=>i.length>0);return r.length===0?"$":`$${r.map(i=>`.${i}`).join("")}`};let o=0,s=0;Object.keys(e).forEach(n=>{const r=e[n];o=Math.max(o,Math.max(...r.map(i=>t(i.instancePath).length))),s=Math.max(s,Math.max(...r.map(i=>i.message.length)))}),Object.keys(e).forEach(n=>{const r=e[n].filter((i,a,y)=>a===y.findIndex(c=>`${i.instancePath}${i.message}${i.keyword}`==`${c.instancePath}${c.message}${c.keyword}`));p.error(n),r.filter(i=>i.keyword!=="if").forEach(i=>{p.error(`${t(i.instancePath).padEnd(o," ")} | ${i.message.padEnd(s," ")} | ${i.keyword||"-"}`)})})}async function H(e,t){try{const o=f(wo.cwd(),t?`${e}${L}.mjs`:`${e}.mjs`);return(await import(_(o).href)).default}catch{throw new Error(`File [${e}${L}.mjs] is either invalid or undefined`)}}function $s(e,t){if(e.validationType===void 0||e.sectionName===void 0)return[];const{sectionName:o,validationType:s}=e,n=G(o);return[...ys(s,{sectionSettings:t,sectionType:n})]}async function bs(e){const t=await H(e.dist,!1),o={},s=[];e.ajv(t)||s.push(...zt(e.ajv.errors??[]));const n=$s(e,t);return n.length>0&&s.push(...n),s.length>0&&(o[e.source]=s),o}function Ts(e){const t=e.reduce((o,s)=>{const n=fo(s);return n.size>ue&&(o[s]=V(n.size)),o},{});if(Object.keys(t).length!==0){const o=Math.max(...Object.keys(t).map(s=>s.length));p.error(`Size of individual assets must not exceed threshold [${V(ue)}]!`);for(const s in t)p.error(`${`File: ${s}`.padEnd(o+10)}| ${t[s]}`);throw new Error("Invalid asset file size")}}function Es(e,t,o,s){const n={};return e(t)&&s===void 0?co(`${o}${L}.mjs`,`${o}.mjs`,()=>{}):(lo(`${o}${L}.mjs`,()=>{}),n[S.resolve(`./templates/${x(o).name}.ts`)]=[...zt(e.errors??[]),...s??[]]),n}async function js(e){const t=[];for(const o of e.sections){const s=e.sections.indexOf(o);if(s===0){const n=o.id==="header"&&o.type==="default",r=O(`${J}/${o.id}`);!n&&!r&&t.push({instancePath:`/sections/${s}/id`,message:"The first section must be a `header`",keyword:"required"})}else if(s===e.sections.length-1){const n=o.id==="footer"&&o.type==="default",r=O(`${Z}/${o.id}`);!n&&!r&&t.push({instancePath:`/sections/${s}/id`,message:"The last section must be a `footer`",keyword:"required"})}else if(o.type==="custom")if(!O(`${g}/${o.id}`))t.push({instancePath:`/sections/${s}/id`,message:"Custom section must have a corresponding block defined",keyword:"required"});else{if(o.content!==void 0)if(!O(`${g}/${o.id}/js/settings/content.mjs`))t.push({instancePath:`/sections/${s}/content`,message:"Content descriptor is overridden, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const n=await H(`${g}/${o.id}/js/settings/content`,!1),r=new Set(Object.keys(n));Object.keys(o.content).every(i=>r.has(i))||t.push({instancePath:`/sections/${s}/content`,message:"Content descriptor must be a subset of the default content descriptor",keyword:"type"})}if(o.design!==void 0)if(!O(`${g}/${o.id}/js/settings/design.mjs`))t.push({instancePath:`/sections/${s}/design`,message:"Design descriptor is overridden, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const n=await H(`${g}/${o.id}/js/settings/design`,!1),r=new Set(Object.keys(n));Object.keys(o.design).every(i=>r.has(i))||t.push({instancePath:`/sections/${s}/design`,message:"Design descriptor must be a subset of the default design descriptor",keyword:"type"})}o.showcase_id!==void 0&&(O(`${g}/${o.id}/js/showcases/${o.showcase_id}.mjs`)||t.push({instancePath:`/sections/${s}/showcase-id`,message:"Custom section must have a corresponding showcase defined in case showcase_id is specified",keyword:"required"}))}}return t.length===0?void 0:t}function ws(e){return Object.entries(u).find(t=>t[1].source===e)?.[0]}async function Os(){const e=await m("**/server.{js,ts}",{ignore:["node_modules/**","dist/**"]});return Promise.all(e.map(async t=>{const o=go(t).split(ho),s=o.pop()??"default",n=o.pop();if(n===void 0)throw new Error("Cannot determine type of section, outer directory is undefined");const r=await m(`**/${s}/client.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),i=await m(`**/${s}/settings/content.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),a=await m(`**/${s}/settings/design.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),y=await m(`**/${s}/settings/layout.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),c=await m(`**/${s}/settings/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),A=await m(`**/${s}/showcases/*.{js,ts}`,{ignore:["node_modules/**","dist/**",`**/${s}/showcases/translations.{js,ts}`]}),no=await m(`**/${s}/showcases/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),ro=await m(`**/${s}/assets/*`,{ignore:["node_modules/**","dist/**"]});return{name:s,type:ws(n),serverEntrypoint:t,clientEntrypoint:r.at(0),contentSettingsEntrypoint:i.at(0),designSettingsEntrypoint:a.at(0),layoutSettingsEntrypoint:y.at(0),settingsTranslationsEntrypoint:c.at(0),showcasesEntrypoints:A,showcasesTranslationsEntrypoint:no.at(0),assetsEntrypoints:ro}}))}async function Ss(){const e=await m("./templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]}),t=await m("./templates/assets/*",{ignore:["node_modules/**","dist/**"]});return{templates:e,assets:t}}async function k(e,t,o,s="SECTION"){t.length!==0&&await ie({configFile:!1,...ae($e(e,t,o,s))})}function vs(){return uo.rm("dist",{recursive:!0,force:!0})}async function As(e){return Ts(e.assetEntryPoints),await ie({configFile:!1,...ae($e(e.name,e.serverEntrypoint,h.Server,e.type))}),await k(e.name,e.clientEntrypoint,h.Client,e.type),await k(e.name,e.settingsEntryPoints,h.SectionSetting,e.type),await k(e.name,e.showcaseEntryPoints,h.SectionShowcase,e.type),await k(e.name,e.assetEntryPoints,h.SectionAsset,e.type),await gs(e).reduce(async(t,o)=>{const s=await t,n=await bs(o);return{...s,...n}},Promise.resolve({}))}async function Cs(e){return e.reduce(async(t,o)=>{const s=await t,n=await As(o);return{...s,...n}},Promise.resolve({}))}async function Ds(){const e=await Ss();if(e.templates.length===0)return{};const t=await ms();return await k(void 0,e.assets,h.TemplateAsset),await k(void 0,e.templates,h.TemplateDescriptor),e.templates.reduce(async(o,s)=>{const n=await o,r=`${P}/js/${x(s).name}`,i=await H(r,!0);return{...n,...Es(t,i,r,await js(i))}},Promise.resolve({}))}async function Is(){await vs();try{const e=await Os().then(o=>o.map(s=>({name:s.name,type:s.type,serverEntrypoint:s.serverEntrypoint,clientEntrypoint:[s.clientEntrypoint].filter(W).flat(),settingsEntryPoints:[s.contentSettingsEntrypoint,s.designSettingsEntrypoint,s.layoutSettingsEntrypoint,s.settingsTranslationsEntrypoint].filter(W),showcaseEntryPoints:[...s.showcasesEntrypoints??[],s.showcasesTranslationsEntrypoint].filter(W),assetEntryPoints:s.assetsEntrypoints??[]}))),t={...await Cs(e),...await Ds()};Object.keys(t).length===0?p.info("Build successful. For deploy run: npx @lightspeed/crane@latest deploy"):(p.error("Error during build:"),hs(t))}catch(e){p.error(`Error while building: ${e.message}`),process.exit(1)}}function ee(e,t){return Object.keys(e).reduce((o,s)=>{const n=e[s],r=t[s];return ye(n)&&ye(r)?o[s]=ee(n,r):o[s]=n,o},{...t})}function _s({contentSettings:e,sectionType:t}){const o=Ut(t);return ee(e,o)}function Ns({designSettings:e,sectionType:t}){const o=Xt(t);return ee(e,o)}function te(e){if(e!==void 0)return e.startsWith("global.")?{type:"GLOBAL_FONT",font:e}:{type:"PRESET_FONT",font:e}}function j(e){if(e===void 0)return;if(e.startsWith("global."))return{type:"GLOBAL_COLOR",raw:e};const t=Ao(e);return{type:"STRUCTURED_COLOR",raw:e,hex:t.toHex8String(),hsl:t.toHsl(),rgba:t.toRgb(),auto:!1}}function Ht(e){if(e!==void 0)return typeof e=="string"&&e.startsWith("global.")?{type:"GLOBAL_TEXT_SIZE",size:e}:{type:"NUMERIC_TEXT_SIZE",size:Number(e)}}const xs={COLOR:"COLOR",GRADIENT:"GRADIENT"};function Ls(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(xs)}`)}}function Ps(e){const t=e.style,o=e.color,s=Array.isArray(o)?o:[o,o];return e.background={type:Ls(t),solid:{color:j(s.at(0))},gradient:{fromColor:j(s.at(0)),toColor:j(s.at(1))}},e.style=void 0,e.color=void 0,e}const ks={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"};function Rs(e){switch(e){case"SOLID":return"solid-button";case"OUTLINE":return"outline-button";case"TEXT":return"text-link";default:throw new Error(`Unknown button appearance: ${e}. Right options: ${Object.keys(ks)}`)}}const Gs={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"};function Fs(e){switch(e){case"SMALL":return"small";case"MEDIUM":return"medium";case"LARGE":return"large";default:throw new Error(`Unknown button size: ${e}. Right options: ${Object.keys(Gs)}`)}}const Bs={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"};function Ms(e){switch(e){case"ROUND_CORNER":return"round-corner";case"RECTANGLE":return"rectangle";case"PILL":return"pill";default:throw new Error(`Unknown button shape: ${e}. Right options: ${Object.keys(Bs)}`)}}function qs(e){const t=e.appearance;t!==void 0&&(e.appearance=Rs(t));const o=e.size;o!==void 0&&(e.size=Fs(o));const s=e.shape;s!==void 0&&(e.style=Ms(s),e.shape=void 0);const n=e.font;e.font=te(n);const r=e.color;return e.color=j(r),e}const Us={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"};function Xs(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";case"NONE":return"none";default:throw new Error(`Unknown image overlay type: ${e}. Right options: ${Object.keys(Us)}`)}}function zs(e){const t=e.overlay,o=e.color,s=Array.isArray(o)?o:[o,o];return e.overlay={type:Xs(t),solid:{color:j(s.at(0))},gradient:{fromColor:j(s.at(0)),toColor:j(s.at(1))}},e.color=void 0,e}function Hs(e){const t=e.font;e.font=te(t);const o=e.color;e.color=j(o);const s=e.size;return e.size=Ht(s),e}function Ks(e){const t=e.color;return e.color=j(t),e}function Vs(e){const t=e.font;e.font=te(t);const o=e.color;e.color=j(o);const s=e.size;if(e.size=Ht(s),e.frame!==void 0){const n=e.frame.color;e.frame.color=j(n)}return e}function oe(e,t){switch(e){case"TEXT":{Hs(t);break}case"BUTTON":{qs(t);break}case"IMAGE":{zs(t);break}case"BACKGROUND":{Ps(t);break}case"COLOR_PICKER":{Ks(t);break}case"LOGO":{Vs(t);break}case"TOGGLE":case"SELECTBOX":break;default:throw new Error(`Unknown design editor type: ${e}`)}return t}function Js(e){Object.keys(e).forEach(t=>{const o=e[t],s=o.type;oe(s,o.defaults)})}function Zs(e){e.forEach(t=>{t.type!==void 0&&t.defaults!==void 0&&(oe(t.type,t.defaults),t.defaults.type=t.type)})}function Kt(e){Object.keys(e).forEach(t=>{const o=e[t],s=o.type;oe(s,o)})}const Ws=200;var $=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.ClientChunks=2]="ClientChunks",e[e.ClientAsset=3]="ClientAsset",e[e.Asset=4]="Asset",e[e.TemplateAsset=5]="TemplateAsset",e[e.Dependency=6]="Dependency",e))($||{});const Vt={[$.Server]:{type:"server_js_compressed",fileName:"server.js.gz",isSingleton:!0,toPath:(e,t)=>`${u[t].dist}/${e}/js/main/server/`},[$.Client]:{type:"client_js",fileName:"client.js",isSingleton:!1,toPath:(e,t)=>`${u[t].dist}/${e}/js/main/client/`},[$.ClientChunks]:{type:"client_js_chunks",isSingleton:!1,toPath:(e,t)=>`${u[t].dist}/${e}/js/main/client/chunks/`,fileName:"*"},[$.ClientAsset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:(e,t)=>`${u[t].dist}/${e}/js/main/client/assets/`},[$.Asset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:(e,t)=>`${u[t].dist}/${e}/assets/`},[$.TemplateAsset]:{type:"template_assets",fileName:"*",isSingleton:!1,toPath:()=>`${P}/assets/`},[$.Dependency]:{type:"dependencies",fileName:"package.json",isSingleton:!0,toPath:()=>{}}},Ys=e=>`\x1B[32m${e}\x1B[0m`,Qs=(e,t,o,s,n)=>{if(!e.total)return;const{loaded:r}=e,i=(Date.now()-n)/1e3;o.value+=r-s.value,s.value=r,t.update({speed:`${V(o.value/i,2)}/s`})},en=()=>new Co.SingleBar({format:`|${Ys("{bar}")}| {status} || {percentage}% || {value}/{total} Files || Speed: {speed}`,barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}),tn="https://blockbuster.ecwid.com",on="/api/v1/custom-apps/resources/sections/upload",sn="/api/v1/custom-apps/resources/templates/upload",nn="/api/v1/custom-apps/manifests/sections",rn="/api/v1/custom-apps/manifests/templates",an=5,pn=3,cn=[$.Server,$.Client,$.ClientChunks,$.ClientAsset,$.Asset],ln=[$.Dependency,$.TemplateAsset],dn={value:0},C=en();let Jt=Date.now();async function fn(){const e=await le(f(l.cwd(),"crane.config.json")),t=JSON.parse(e.toString());return{appClientId:t.app_client_id,appSecretKey:btoa(t.app_secret_key)}}async function un(){const e=f(l.cwd(),"package.json"),t=await le(e),o=JSON.parse(t.toString());if(yn(o))return o;throw new Error(`Package file located at path: ${e} does not contain a version field`)}function yn(e){return typeof e=="object"&&e!==null&&"version"in e&&typeof e.version=="string"}async function mn(e){const t=So(e.version,"patch");if(t===null)throw Error("Error while incrementing app version");e.version=t,yo(f(l.cwd(),"package.json"),`${JSON.stringify(e,null,2)}
3
- `)}async function gn(e,t,o=g){try{const s=f(l.cwd(),`${o}/${e}/js/settings/content.mjs`),n=(await import(_(s).href)).default,r=G(e),i=_s({contentSettings:n,sectionType:r});return q(i,t),i}catch{throw new Error(`Content descriptor for section [${e}] is either invalid or undefined`)}}async function hn(e,t,o=g){try{const s=f(l.cwd(),`${o}/${e}/js/settings/design.mjs`),n=(await import(_(s).href)).default,r=G(e),i=Ns({designSettings:n,sectionType:r});return Js(i),q(i,t),i}catch(s){const n=s;throw new Error(`Design settings is invalid or undefined. Error ${n.stack}`)}}async function $n(e,t,o=g){try{const s=await m("*.mjs",{cwd:f(l.cwd(),`${o}/${e}/js/showcases/`),ignore:"**/translations.mjs"});return Promise.all(s.map(async n=>{const r=f(l.cwd(),`${o}/${e}/js/showcases/${n}`),i=(await import(_(r).href)).default;return Kt(i.design),q(i,t),i}))}catch(s){throw new Error(`Showcases is invalid or undefined. Error ${s}`)}}async function bn(e,t=g){try{const o=f(l.cwd(),`${t}/${e}/js/settings/layout.mjs`);if(!O(o))return[];const s=(await import(_(o).href)).default;return s.forEach(n=>Zs(n.selectedDesignSettings)),s}catch{throw new Error(`Layout descriptor for section [${e}] is either invalid or undefined`)}}async function Tn(e,t=g){return await Wt(`${t}/${e}/js/settings/translations.mjs`)}async function Zt(e,t=g){return await Wt(`${t}/${e}/js/showcases/translations.mjs`)}async function Wt(e){const t=f(l.cwd(),e),o=(await import(_(t).href)).default;return jn(o)}function q(e,t){if(e&&typeof e=="object"){const o=e;for(const s in o){const n=o[s];typeof n=="string"&&n.startsWith("$")&&(o[s]=En(t,n)),typeof n=="object"&&q(n,t)}}}function En(e,t){if(!t)return;const o=e[t];return o===void 0?{en:t}:o}function jn(e){const t={};for(const o in e){const s=e[o];for(const n in s){const r=t[n],i=s[n];if(r===void 0){const a={};a[o]=i,t[n]=a}else r[o]=i}}return t}async function se(e,t){const o=await Tn(e,u[t].dist),s=await Zt(e,u[t].dist),n=await gn(e,o,u[t].dist),r=await hn(e,o,u[t].dist),i=await $n(e,s,u[t].dist),a=await bn(e,u[t].dist);return{id:e,type:t,name:{en:e},contentEditors:n,designEditors:r,layouts:a,showcases:i}}async function wn(){const e=await m("*/",{cwd:f(l.cwd(),`${g}/`)}),t=await m("*/",{cwd:f(l.cwd(),`${J}/`)}),o=await m("*/",{cwd:f(l.cwd(),`${Z}/`)});return Promise.all([...e.map(async s=>se(s,"SECTION")),...t.map(async s=>se(s,"HEADER")),...o.map(async s=>se(s,"FOOTER"))])}async function On(e){try{return(await import(_(f(l.cwd(),e)).href)).default}catch{throw new Error(`Template descriptor [${e}] is either invalid or undefined`)}}async function Sn(){const e=await m(`${P}/js/**.mjs`,{ignore:[`${P}/js/**${L}.mjs`]});return Promise.all(e.map(async t=>{const o=await On(t),s=o.sections.filter(n=>n.type==="custom");for(const n of s){const r=G(n.id),i=await Zt(n.id,u[r].dist);n.showcase_overrides!==void 0&&(q(n.showcase_overrides,i),Kt(n.showcase_overrides.design))}return{id:`${x(l.cwd()).name.replace(/[^a-zA-Z0-9]/g,"_")}_${x(t).name}`,descriptor:o}}))}function Yt(e,t,o){const s=e.pathContext,n=s.toPath(e.currentSection,o),r=n===void 0?re(s.fileName):re(s.fileName,{cwd:f(l.cwd(),n),ignore:s.ignore});return(s.isSingleton?r.splice(0):r).map(i=>({url:i,subType:o,context:e}))}function Qt(e,t,o,s){const n={value:0},r=e.config.app.templates.length>0?sn:on;return e.config.axios.post(r,{file:mo(f(l.cwd(),o!==void 0?o+t:t))},{params:{appClientId:e.config.app.crane.appClientId,type:e.pathContext.type,version:e.config.app.packageJson.version,...e.currentSection!==void 0&&{block:e.currentSection},...e.pathContext.type!=="dependencies"&&{fileName:t}},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${e.config.app.crane.appSecretKey}`},onUploadProgress:i=>Qs(i,C,dn,n,Jt)}).then(i=>(C.increment(),{status:i.status})).catch(async i=>eo(s,i)?(await to(s),Qt(e,t,o,s+1)):(C.increment(),{status:i.response?.status,message:i.message}))}function vn(e){return C.start(e.length+1,0,{speed:"N/A",status:"Deployment in progress"}),e.map(t=>{const o=t.context,s=o.pathContext.toPath(o.currentSection,t.subType);return Qt(o,t.url,s,0)})}function An(e){const t=e.app.sections.flatMap(s=>cn.flatMap(n=>{const r={config:e,currentSection:s.id,pathContext:Vt[n]};return Yt(r,n,s.type)})),o=ln.flatMap(s=>Yt({config:e,pathContext:Vt[s]},s,"SECTION"));return vn([...t,...o])}function Cn(e){return e instanceof de&&(e.code==="ECONNRESET"||e.response?.status!==void 0&&e.response?.status>=500&&e.response?.status<600)}function eo(e,t){return e<pn&&Cn(t)}async function to(e){await new Promise(t=>{setTimeout(t,2**e*500)})}function Dn(e){return e.includes(`
4
- `)}function In(e,t,o){return e.split(`
1
+ import go from"cac";import*as V from"path";import g,{resolve as l,parse as C,dirname as ho,sep as $o}from"path";import{red as bo,yellow as Eo,green as N}from"kolorist";import ce from"prompts";import m from"node:fs";import S from"node:path";import b from"node:process";import{fileURLToPath as _}from"node:url";import*as K from"fs";import h,{existsSync as v,rename as To,unlink as Oo,statSync as So,promises as Y,writeFileSync as wo,createReadStream as jo}from"fs";import{pathToFileURL as pe}from"url";import*as f from"process";import{platform as Do}from"process";import vo from"adm-zip";import{glob as $,globSync as le}from"glob";import{build as de,defineConfig as fe}from"vite";import{builtinModules as ue}from"module";import ye from"@vitejs/plugin-vue";import Z from"vite-tsconfig-paths";import{viteExternalsPlugin as Ao}from"vite-plugin-externals";import Io from"vite-plugin-compression";import Co from"vite-plugin-checker";import No from"ajv/dist/2020.js";import _o from"ajv-formats";import xo from"node:zlib";import{promisify as ko}from"node:util";import{readFile as me}from"fs/promises";import Lo,{AxiosError as ge}from"axios";import{inc as Po}from"semver";import{ConcurrencyManager as Fo}from"axios-concurrency";import Ro from"tinycolor2";import Go from"cli-progress";function he(e,t){K.statSync(e).isDirectory()?(K.mkdirSync(t,{recursive:!0}),K.readdirSync(e).forEach(o=>{const s=V.resolve(e,o),n=V.resolve(t,o);he(s,n)})):K.copyFileSync(e,t)}function I(e,t,o,s){const n=V.join(e,s?.[o]??o);he(V.join(t,o),n)}function R(e,t=2){if(!+e)return"0 Bytes";const o=1024,s=t<0?0:t,n=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],r=Math.floor(Math.log(e)/Math.log(o));return`${parseFloat((e/o**r).toFixed(s))} ${n[r]}`}const a={error:e=>console.log(bo(e)),warn:e=>console.log(Eo(e)),info:e=>console.log(N(e))},x="_temp",E="dist/sections",W="dist/headers",Q="dist/footers",k="dist/templates",$e=2*1024*1024,be=300*1024;function ee(e){return!!e}function Ee(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}const Mo="Resource name can only contain alphanumeric characters, dashes, and underscores";function Bo(e){if(typeof e=="string"||typeof e=="number"){const t=/^[a-zA-Z0-9_-]+$/.test(e.toString());if(t)return{isValid:t,errorMessage:null}}return{isValid:!1,errorMessage:Mo}}function qo(e){return e===!0?!0:typeof e=="string"&&e.trim().length===0}async function H(e,t){try{const o=l(process.cwd(),t?`${e}${x}.mjs`:`${e}.mjs`);return(await import(pe(o).href)).default}catch{throw new Error(`File [${e}${x}.mjs] is either invalid or undefined`)}}function Uo(e){return Do==="win32"?e.replace(/\//g,"\\"):e}function Te(e,t){const o=e.split(t);let s="";for(;o.length;){const n=o.join(t),r=m.lstatSync(n||t);if(r.isSymbolicLink()){const i=m.readlinkSync(n),c=S.resolve(S.dirname(n),i);return Te(c,t)}if(r.isDirectory()){const i=`${n}${t}package.json`;if(m.existsSync(i)){s=i;break}}o.pop()}return s}function zo(){const e=Uo("/"),t=Te(b.argv[1],e);return t!==""?JSON.parse(m.readFileSync(t,"utf8")):{}}async function Xo(e){try{const t=e,o=b.cwd(),s=S.join(o,t),n=["templates","headers","footers","reference"],r={_gitignore:".gitignore"};m.existsSync(s)?(a.error(`App with the name: ${e} already exists. If you'd like to override it, delete previous version first`),b.exit(1)):m.mkdirSync(s);const i=S.resolve(_(import.meta.url),"../..","template");m.readdirSync(i).filter(O=>O!=="package.json").filter(O=>!n.includes(O)).forEach(async O=>I(s,i,O,r));const c=JSON.parse(m.readFileSync(S.join(i,"package.json"),"utf-8"));c.name=e;const d=zo();d.version&&(c.dependencies["@lightspeed/crane"]=d.version),d.dependencies["@lightspeed/eslint-config-crane"]&&(c.dependencies["@lightspeed/eslint-config-crane"]=d.dependencies["@lightspeed/eslint-config-crane"]);const p=S.join(s,"package.json");m.writeFileSync(p,`${JSON.stringify(c,null,2)}
2
+ `),a.info(`App ${e} created`)}catch(t){a.error(`Error while creating app: ${t.message}`),b.exit(1)}}function te(e,t,o,s){try{const n=b.cwd(),r=g.join(n,t);h.existsSync(r)||h.mkdirSync(r);const i=g.join(n,t,o);h.existsSync(i)?(a.error(`${s} with the name: ${o} already exists. If you'd like to override it, delete previous version first`),b.exit(1)):h.mkdirSync(i);const c=g.resolve(_(import.meta.url),"../..",e);h.readdirSync(c).forEach(async d=>I(i,c,d)),a.info(`${s} ${o} created`)}catch(n){a.error(`Error while creating ${s}: ${n.message}`),b.exit(1)}}function Oe(e){const t=b.cwd(),o=g.resolve(_(import.meta.url),"../..",`template/${e}`),s=g.join(t,e);h.existsSync(s)||(h.mkdirSync(s),h.readdirSync(o).forEach(async n=>I(s,o,n)))}function Vo(e,t,o){if(!h.existsSync(o)){h.copyFileSync(t,o);return}const s=h.readFileSync(t),n=h.readFileSync(o);s.equals(n)||a.warn(`File "${e.name}" exists but differs from template. File will be skipped, this may lead to issues.`)}function Se(e,t){const o=h.readdirSync(e,{withFileTypes:!0});h.existsSync(t)||h.mkdirSync(t,{recursive:!0}),o.forEach(s=>{const n=g.join(e,s.name),r=g.join(t,s.name);s.isDirectory()?Se(n,r):Vo(s,n,r)})}function oe(){try{const e=b.cwd(),t=g.join(e,"shared"),o=g.resolve(_(import.meta.url),"../..","template/shared");if(!h.existsSync(o))return;Se(o,t)}catch(e){a.error(`Error while processing shared folder: ${e.message}`),b.exit(1)}}async function Ko(e){oe(),te("template/sections/example-section","sections",e,"Section")}async function Ho(e){try{const t=b.cwd(),o=S.join(t,"templates"),s={"template.ts":`${e}.ts`};m.existsSync(o)?m.existsSync(S.join(o,`${e}.ts`))&&(a.error(`Template with the name: ${e} already exists. If you'd like to override it, delete previous version first`),b.exit(1)):m.mkdirSync(o);const n=S.resolve(_(import.meta.url),"../..","template/templates");m.readdirSync(n).forEach(async r=>I(o,n,r,s)),Oe("headers"),Oe("footers"),a.info(`Template descriptor file [${e}.ts] has been created`)}catch(t){a.error(`Error while creating template descriptors: ${t.message}`),b.exit(1)}}async function Jo(){try{const e=b.cwd(),t=S.resolve(_(import.meta.url),"../../","template/reference"),o=m.readdirSync(t);let s=!1;for(const n of o){const r=S.join(t,n),i=S.join(e,n);m.existsSync(i)||m.mkdirSync(i,{recursive:!0});const c=m.readdirSync(r),d=m.readdirSync(i);if(n==="shared"){c.forEach(p=>{I(i,r,p)});continue}for(const p of c){if(p==="assets"){I(i,r,p);continue}if(d.includes(p)){const{name:O}=await ce({type:"text",name:"name",message:`The "${p}" already exists in ${n} directory: provide a new name to keep both or press Esc to skip this one.`});O?(I(i,r,p,{[p]:O}),s=!0):a.info(`Skipped: ${p}`)}else I(i,r,p)}}a.info("Reference templates have been added to the app"),s&&a.warn("Some files or folders were renamed to avoid conflicts. Temlate files may need to be updated to reflect these changes.")}catch(e){a.error(`Error while creating template descriptors: ${e.message}`),b.exit(1)}}var T=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.SectionSetting=2]="SectionSetting",e[e.SectionShowcase=3]="SectionShowcase",e[e.SectionAsset=4]="SectionAsset",e[e.TemplateDescriptor=5]="TemplateDescriptor",e[e.TemplateAsset=6]="TemplateAsset",e))(T||{}),j=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.Misc=2]="Misc",e))(j||{});const Yo=()=>Io({ext:".gz",algorithm:"gzip",deleteOriginFile:!0}),we=()=>{const e=process.env.npm_lifecycle_event;return Co({typescript:!0,vueTsc:!1,eslint:{lintCommand:`eslint --max-warnings=0 "./sections/**/*.{js,ts,vue}" --cache --cache-location "./build/eslintcache/${e}.json"`}})},Zo="/* EXTERNAL_IMPORTS_START */",Wo="/* EXTERNAL_IMPORTS_END */",Qo=()=>({name:"external-imports-wrapper-plugin",enforce:"post",apply:"build",generateBundle(e,t){for(const o of Object.keys(t)){const s=t[o];if(s.type==="chunk"){const n=/import.*\?commonjs-external["'];/g,r=s.code.match(n);if(r!==null){const i=r.join(""),c=Zo+i+Wo,d=s.code.replace(n,"");s.code=c+d}}}}}),es={[j.Server]:[ye(),Z(),Qo(),Yo()],[j.Client]:[ye(),Z(),we(),Ao({vue:"EcVue"})],[j.Misc]:[Z(),we()]};var se=(e=>(e.SECTION="SECTION",e.HEADER="HEADER",e.FOOTER="FOOTER",e))(se||{});const u={SECTION:{source:"sections",dist:"dist/sections"},HEADER:{source:"headers",dist:"dist/headers"},FOOTER:{source:"footers",dist:"dist/footers"}};function G(e){return v(`${W}/${e}`)?"HEADER":v(`${Q}/${e}`)?"FOOTER":"SECTION"}function ts(e){const t=G(e);return u[t].dist}const je={"process.env":{NODE_ENV:"production"}},os=[...ue,...ue.map(e=>`node:${e}`)],ss=[/@vue\/compiler-dom/,/@vue\/runtime-dom/,/@vue\/server-renderer/,/@vue\/compiler-ssr/,/@vue\/shared/],A={[T.Server]:{pluginType:j.Server,define:je,ssr:!0,ssrOptions:{noExternal:!0},outDir:(e,t)=>`./${u[t].dist}/${e}/js/main/server`,externalOption:[...os,...ss],entryFileNames:"server.js",inlineDynamicImports:!0},[T.Client]:{pluginType:j.Client,define:je,ssr:!1,outDir:(e,t)=>`./${u[t].dist}/${e}/js/main/client`,entryFileNames:"client.js",assetFileNames:"assets/[name].[ext]",chunkFileNames:"chunks/[name].js",inlineDynamicImports:!1},[T.SectionSetting]:{pluginType:j.Misc,ssr:!1,outDir:(e,t)=>`./${u[t].dist}/${e}/js/settings`,entryFileNames:"[name].mjs"},[T.SectionShowcase]:{pluginType:j.Misc,ssr:!1,outDir:(e,t)=>`./${u[t].dist}/${e}/js/showcases`,entryFileNames:"[name].mjs"},[T.SectionAsset]:{pluginType:j.Misc,ssr:!1,outDir:(e,t)=>`./${u[t].dist}/${e}/assets`,assetFileNames:"[name].[ext]"},[T.TemplateDescriptor]:{pluginType:j.Misc,ssr:!1,outDir:()=>`./${k}/js`,entryFileNames:`[name]${x}.mjs`},[T.TemplateAsset]:{pluginType:j.Misc,ssr:!1,outDir:()=>`./${k}/assets`,assetFileNames:"[name].[ext]"}};function ns(e){switch(typeof e){case"string":return[l(process.cwd(),e)];case"object":return e.map(t=>l(process.cwd(),t));default:return[]}}function De(e,t,o,s){const n=A[o].define,r=A[o].ssrOptions,i=A[o].entryFileNames,c=A[o].chunkFileNames,d=A[o].assetFileNames,p=A[o].inlineDynamicImports,O=A[o].externalOption;return{plugins:es[A[o].pluginType],...n!=null&&{define:n},...r!=null&&{ssr:r},resolve:{alias:{"@":"/src"}},css:{preprocessorOptions:{scss:{api:"modern-compiler"}}},build:{ssr:A[o].ssr,outDir:A[o].outDir(e,s),emptyOutDir:!0,minify:"terser",terserOptions:{compress:{drop_console:!1}},rollupOptions:{...O!=null&&{external:O},preserveEntrySignatures:"strict",input:ns(t),output:{validate:!0,inlineDynamicImports:p,...i!=null&&{entryFileNames:i},...c!=null&&{chunkFileNames:c},...d!=null&&{assetFileNames:d}}}}}}const ve="https://json-schema.org/draft/2020-12/schema",Ae="https://lightspeedhq.com/template-default.schema.json",Ie="Default Section",Ce="Default section for a Custom Template",Ne="object",_e={"default-section":{type:"object",properties:{type:{description:"Type of the section",type:"string",const:"default"},id:{description:"Identification of the section",type:"string",pattern:"^((header|cover|announcement_bar|slider|special_offer|customer_review|company_info|shipping_payment|location|store|footer)(_\\d{3})?)$"},showcase_id:{description:"Showcase id of the section",type:"string"}},required:["type","id"],additionalProperties:!1}},rs={$schema:ve,$id:Ae,title:Ie,description:Ce,type:Ne,$defs:_e},is={__proto__:null,$defs:_e,$id:Ae,$schema:ve,default:rs,description:Ce,title:Ie,type:Ne},xe="https://json-schema.org/draft/2020-12/schema",ke="https://lightspeedhq.com/template-custom.schema.json",Le="Custom Section",Pe="Custom section for a Custom Template",Fe="object",Re={"custom-section":{type:"object",properties:{type:{description:"Type of the section",type:"string",const:"custom"},id:{description:"Identification of the section",type:"string"},showcase_id:{description:"Showcase id of the section",type:"string"},showcase_overrides:{$ref:"showcase_overrides.schema.json"}},required:["type","id"],additionalProperties:!1}},as={$schema:xe,$id:ke,title:Le,description:Pe,type:Fe,$defs:Re},cs={__proto__:null,$defs:Re,$id:ke,$schema:xe,default:as,description:Pe,title:Le,type:Fe},Ge="https://json-schema.org/draft/2020-12/schema",Me="https://lightspeedhq.com/template-custom-content.schema.json",Be="Custom Section :: Content Configuration",qe="Content tab configuration of a Custom Section for a Custom Template",Ue="object",ze={input_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"INPUTBOX"},text:{type:"string"}},required:["type","text"],additionalProperties:!1},text_area:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"TEXTAREA"},text:{type:"string"}},required:["type","text"],additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"BUTTON"},title:{type:"string"},buttonType:{type:"string",enum:["SCROLL_TO_TILE","HYPER_LINK","MAIL_LINK","TEL_LINK","GO_TO_STORE_LINK","GO_TO_PAGE"]},link:{type:"string",format:"uri"},linkTarget:{type:"string"},email:{type:"string"},phone:{type:"string"},tileId:{type:"string"}},required:["type","title","buttonType"],additionalProperties:!0},image:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"IMAGE"},imageData:{type:"object",properties:{set:{type:"object"},borderInfo:{type:"object"},bucket:{type:"string"}},required:["set"]}},required:["type"],additionalProperties:!1},toggle:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"TOGGLE"},enabled:{type:"boolean"}},required:["type"],additionalProperties:!0},select_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"SELECTBOX"},value:{type:"string"}},required:["type"],additionalProperties:!0},logo:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"LOGO"},logoType:{description:"Type of the logo content",type:"string",enum:["TEXT","IMAGE"]},text:{description:"Logo content text",type:"string"},imageData:{type:"object",properties:{set:{type:"object"},borderInfo:{type:"object"},bucket:{type:"string"}},required:["set"]}},required:["type"],additionalProperties:!1},menu:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"MENU"}},required:["type"],additionalProperties:!1},deck:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"DECK"},cards:{type:"array",items:{type:"object",properties:{settings:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the settings configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]}},required:["type"],allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/input_box"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"template-custom-content.schema.json#/$defs/text_area"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-content.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/select_box"}}]}},minProperties:1}},required:["settings"]}}},required:["type","cards"]}},ps={$schema:Ge,$id:Me,title:Be,description:qe,type:Ue,$defs:ze},ls={__proto__:null,$defs:ze,$id:Me,$schema:Ge,default:ps,description:qe,title:Be,type:Ue},Xe="https://json-schema.org/draft/2020-12/schema",Ve="https://lightspeedhq.com/template-custom-design.schema.json",Ke="Custom Section :: Design Configuration",He="Design tab configuration of a Custom Section for a Custom Template",Je="object",Ye={text:{type:"object",properties:{type:{description:"Type of the text",type:"string",const:"TEXT"},font:{description:"Default font for the text",type:"string"},size:{oneOf:[{description:"Default size for the text",type:"integer",minimum:1,exclusiveMaximum:50},{description:"Default global size string for the text",type:"string",enum:["global.textSize.title","global.textSize.subtitle","global.textSize.body"]}]},bold:{description:"Default boldness for the text",type:"boolean"},italic:{description:"Default italic style for the text",type:"boolean"},color:{oneOf:[{description:"Default color for the text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the text",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},visible:{description:"Default visibility for the text",type:"boolean"}},additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the button",type:"string",const:"BUTTON"},font:{description:"Default font for the button",type:"string"},size:{description:"Default size for the button",type:"string",enum:["SMALL","MEDIUM","LARGE"]},appearance:{description:"Default appearance for the button",type:"string",enum:["SOLID","OUTLINE","TEXT"]},shape:{description:"Default shape for the button",type:"string",enum:["ROUND_CORNER","RECTANGLE","PILL"]},color:{oneOf:[{description:"Default color for the button",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the button",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]}},additionalProperties:!1},image:{type:"object",properties:{type:{description:"Type of the image",type:"string",const:"IMAGE"},overlay:{description:"Default overlay for the image",type:"string",enum:["COLOR","GRADIENT","NONE"]}},if:{properties:{overlay:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default color for the image overlay",type:"array",items:{oneOf:[{description:"Default color for the image overlay",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the image overlay",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},minItems:2,maxItems:2}}},else:{properties:{color:{oneOf:[{description:"Default color for the image overlay",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the image overlay",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]}}}},toggle:{type:"object",properties:{type:{description:"Type of the toggle",type:"string",const:"TOGGLE"},enabled:{description:"Default enabled status for the toggle",type:"boolean"}},additionalProperties:!1},info:{type:"object",properties:{type:{description:"Type of the info",type:"string",const:"INFO"},font:{description:"Default font for the info",type:"string"},size:{description:"Default size for the info",type:"integer",minimum:1,exclusiveMaximum:50},bold:{description:"Default boldness for the info",type:"boolean"},italic:{description:"Default italic style for the info",type:"boolean"},color:{description:"Default color for the info",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},visible:{description:"Default visibility for the info",type:"boolean"}},required:["type"],additionalProperties:!1},select_box:{type:"object",properties:{type:{description:"Type of the checkbox",type:"string",const:"SELECTBOX"},value:{description:"Default option for the checkbox",type:"string"}},additionalProperties:!1},background:{type:"object",properties:{type:{description:"Type of the background",type:"string",const:"BACKGROUND"},style:{description:"Style of the background",type:"string",enum:["COLOR","GRADIENT"]}},if:{properties:{style:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default colors for the background",type:"array",items:{oneOf:[{description:"Default color for the background",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the background",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},minItems:2,maxItems:2}}},else:{properties:{color:{oneOf:[{description:"Default color for the background",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the background",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]}}}},logo:{type:"object",properties:{type:{description:"Type of the logo",type:"string",const:"LOGO"},font:{description:"Default font for the text logo",type:"string"},size:{oneOf:[{description:"Default size for the logo text",type:"integer",minimum:1,exclusiveMaximum:50},{description:"Default global size string for the logo text",type:"string",enum:["global.textSize.title","global.textSize.subtitle","global.textSize.body"]}]},bold:{description:"Default boldness for the text logo",type:"boolean"},italic:{description:"Default italic style for the text logo",type:"boolean"},color:{oneOf:[{description:"Default color for the logo text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the logo text",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},visible:{description:"Default visibility for the logo",type:"boolean"},spacing:{description:"Default spacing size for the text logo",type:"integer",minimum:1,exclusiveMaximum:10},capitalization:{description:"Default capitalization style for the text logo",type:"string",enum:["none","all","small"]},frame:{description:"Default frame for the text logo",type:"object",properties:{visible:{description:"Default visibility for the frame on text logo",type:"boolean"},width:{description:"Default width size for the frame on text logo",type:"integer",minimum:1,exclusiveMaximum:50},color:{oneOf:[{description:"Default color for frame on logo text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for frame on logo text",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]}},required:["visible","width","color"],additionalProperties:!1}},additionalProperties:!1}},ds={$schema:Xe,$id:Ve,title:Ke,description:He,type:Je,$defs:Ye},fs={__proto__:null,$defs:Ye,$id:Ve,$schema:Xe,default:ds,description:He,title:Ke,type:Je},Ze="https://json-schema.org/draft/2020-12/schema",We="https://lightspeedhq.com/section-content.schema.json",Qe="Custom Section - Content",et="The content of a custom section",tt="object",ot={"^.*$":{type:"object",properties:{type:{type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","INFO","DECK","MENU","NAVIGATION_MENU","LOGO","DIVIDER"]}},required:["type"],allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"#/$defs/Inputbox"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"#/$defs/Textarea"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"#/$defs/Button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"#/$defs/Image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"#/$defs/Toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"#/$defs/Selectbox"}},{if:{properties:{type:{const:"INFO"}}},then:{$ref:"#/$defs/Info"}},{if:{properties:{type:{const:"DECK"}}},then:{$ref:"#/$defs/Deck"}},{if:{properties:{type:{const:"MENU"}}},then:{$ref:"#/$defs/Menu"}},{if:{properties:{type:{const:"NAVIGATION_MENU"}}},then:{$ref:"#/$defs/NavigationMenu"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"#/$defs/Logo"}},{if:{properties:{type:{const:"DIVIDER"}}},then:{$ref:"#/$defs/Divider"}}]}},st={Inputbox:{type:"object",properties:{type:{const:"INPUTBOX"},label:{type:"string"},placeholder:{type:"string"},defaults:{$ref:"#/$defs/InputboxDefaults"}},required:["type","label","placeholder"]},Textarea:{type:"object",properties:{type:{const:"TEXTAREA"},label:{type:"string"},placeholder:{type:"string"},defaults:{$ref:"#/$defs/TextareaDefaults"}},required:["type","label","placeholder"]},Button:{type:"object",properties:{type:{const:"BUTTON"},label:{type:"string"},defaults:{$ref:"#/$defs/ButtonDefaults"}},required:["type","label"]},Image:{type:"object",properties:{type:{const:"IMAGE"},label:{type:"string"},defaults:{$ref:"#/$defs/ImageDefaults"}},required:["type","label"]},Toggle:{type:"object",properties:{type:{const:"TOGGLE"},label:{type:"string"},description:{type:"string"},defaults:{$ref:"#/$defs/ToggleDefaults"}},required:["type","label","description"]},Selectbox:{type:"object",properties:{type:{const:"SELECTBOX"},label:{type:"string"},placeholder:{type:"string"},description:{type:"string"},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SelectboxDefaults"}},required:["type","label","placeholder","description","options"]},Menu:{type:"object",properties:{type:{const:"MENU"},label:{type:"string"}},required:["type"]},NavigationMenu:{type:"object",properties:{type:{const:"NAVIGATION_MENU"}},required:["type"]},Logo:{type:"object",properties:{type:{const:"LOGO"},label:{type:"string"}},required:["type"]},Info:{type:"object",properties:{type:{const:"INFO"},label:{type:"string"},description:{type:"string"},button:{$ref:"#/$defs/InfoEditorButton"},defaults:{$ref:"#/$defs/InfoDefaults"}},required:["type","label","description"]},Divider:{type:"object",properties:{type:{const:"DIVIDER"},label:{type:"string"}},required:["type","label"]},InputboxDefaults:{type:"object",properties:{text:{type:"string"}},required:["text"]},TextareaDefaults:{type:"object",properties:{text:{type:"string"}},required:["text"]},ButtonDefaults:{type:"object",properties:{title:{type:"string"},buttonType:{type:"string",enum:["SCROLL_TO_TILE","HYPER_LINK","MAIL_LINK","TEL_LINK","GO_TO_STORE_LINK","GO_TO_PAGE"]},link:{type:"string",format:"uri"},linkTarget:{type:"string"},email:{type:"string"},phone:{type:"string"},tileId:{type:"string"}},required:["title"]},ImageDefaults:{type:"object",properties:{imageData:{$ref:"section-commons.schema.json#/$defs/Image"}}},ToggleDefaults:{type:"object",properties:{enabled:{type:"boolean"}}},SelectboxDefaults:{type:"object",properties:{value:{type:"string"}}},InfoDefaults:{type:"object",properties:{text:{type:"object",additionalProperties:{type:"string"}},button:{$ref:"#/$defs/InfoButtonDefaults"}}},SelectboxOption:{type:"object",properties:{label:{type:"string"},value:{type:"string"}}},InfoEditorButton:{type:"object",properties:{label:{type:"string"},link:{type:"string"}}},InfoButtonDefaults:{type:"object",properties:{title:{type:"string"},link:{type:"string",minLength:0}}},Deck:{type:"object",properties:{cards:{description:"Cards of the content configuration element",type:"object",properties:{settings:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the settings configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]}},required:["type"],allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"#/$defs/Inputbox"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"#/$defs/Textarea"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"#/$defs/ButtonDefaults"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"#/$defs/Image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"#/$defs/Toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"#/$defs/Selectbox"}}]}},minProperties:1}}}}}},nt=!1,us={$schema:Ze,$id:We,title:Qe,description:et,type:tt,patternProperties:ot,$defs:st,additionalProperties:nt},rt={__proto__:null,$defs:st,$id:We,$schema:Ze,additionalProperties:nt,default:us,description:et,patternProperties:ot,title:Qe,type:tt},it="https://json-schema.org/draft/2020-12/schema",at="https://lightspeedhq.com/sections/section-translation.schema.json",ct="Custom Section - Translations",pt="The translation of the section's labels",lt="object",dt={"^[a-z]{2}$":{type:"object",patternProperties:{"^\\$.*$":{type:"string"}},additionalProperties:!1}},ft=!1,ys={$schema:it,$id:at,title:ct,description:pt,type:lt,patternProperties:dt,additionalProperties:ft},ut={__proto__:null,$id:at,$schema:it,additionalProperties:ft,default:ys,description:pt,patternProperties:dt,title:ct,type:lt},yt="https://json-schema.org/draft/2020-12/schema",mt="https://lightspeedhq.com/section-design.schema.json",gt="Custom Section - Design",ht="The design of a custom section",$t="object",bt={"^.*$":{type:"object",properties:{type:{type:"string",enum:["TEXT","IMAGE","BUTTON","BACKGROUND","TOGGLE","COLOR_PICKER","RATING","SELECTBOX","SOCIAL_PROFILES","LOGO","INFO","DIVIDER"]}},required:["type"],allOf:[{if:{properties:{type:{const:"TEXT"}}},then:{$ref:"#/$defs/Text"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"#/$defs/Image"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"#/$defs/Button"}},{if:{properties:{type:{const:"BACKGROUND"}}},then:{$ref:"#/$defs/Background"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"#/$defs/Toggle"}},{if:{properties:{type:{const:"COLOR"}}},then:{$ref:"#/$defs/Color"}},{if:{properties:{type:{const:"RATING"}}},then:{$ref:"#/$defs/Rating"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"#/$defs/Selectbox"}},{if:{properties:{type:{const:"SOCIAL_PROFILES"}}},then:{$ref:"#/$defs/SocialProfile"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"#/$defs/Logo"}},{if:{properties:{type:{const:"INFO"}}},then:{$ref:"#/$defs/Info"}},{if:{properties:{type:{const:"DIVIDER"}}},then:{$ref:"#/$defs/Divider"}}],additionalProperties:!0}},Et={Text:{type:"object",properties:{type:{const:"TEXT"},label:{type:"string"},sizes:{type:"array",items:{type:"integer"}},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},hideSize:{type:["boolean","null"]},defaults:{$ref:"#/$defs/TextDesignDefaults"}},required:["type","label"]},Image:{type:"object",properties:{type:{const:"IMAGE"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},defaults:{$ref:"#/$defs/ImageDesignDefaults"}},required:["type","label"]},Button:{type:"object",properties:{type:{const:"BUTTON"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAutoColor:{type:["boolean","null"]},enableAlphaColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},hideSize:{type:["boolean","null"]},defaults:{$ref:"#/$defs/ButtonDesignDefaults"}},required:["type","label"]},Background:{type:"object",properties:{type:{const:"BACKGROUND"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},defaults:{$ref:"#/$defs/BackgroundDesignDefaults"}},required:["type","label"]},Toggle:{type:"object",properties:{type:{const:"TOGGLE"},label:{type:"string"},description:{type:"string"},defaults:{$ref:"#/$defs/ToggleDesignDefaults"}},required:["type","label"]},Color:{type:"object",properties:{type:{const:"COLOR_PICKER"},label:{type:"string"},description:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},defaults:{$ref:"#/$defs/ColorPickerDefaults"}},required:["type","label"]},Rating:{type:"object",properties:{type:{const:"RATING"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/RatingDefaults"}},required:["type","label"]},Selectbox:{type:"object",properties:{type:{const:"SELECTBOX"},label:{type:"string"},description:{type:"string"},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SelectboxDefaults"}},required:["type","label"]},SocialProfile:{type:"object",properties:{type:{const:"SOCIAL_PROFILES"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SocialProfilesDefaults"}},required:["type","label"]},Logo:{type:"object",properties:{type:{const:"LOGO"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},sizes:{type:"array",items:{type:"integer"}},defaults:{$ref:"#/$defs/LogoDesignDefaults"}},required:["type"]},Info:{type:"object",properties:{type:{const:"INFO"},text:{type:"string"},button:{type:"object",properties:{title:{type:"string"},link:{type:"string"}},additionalProperties:!0}},required:["type","text"],additionalProperties:!0},Divider:{type:"object",properties:{type:{const:"DIVIDER"},label:{type:"string"}},required:["type","label"]},TextDesignDefaults:{type:"object",properties:{font:{type:"string"},size:{oneOf:[{description:"Default size for the text",type:"integer",minimum:1,exclusiveMaximum:50},{description:"Default global size string for the text",type:"string",enum:["global.textSize.title","global.textSize.subtitle","global.textSize.body"]}]},bold:{type:"boolean"},italic:{type:"boolean"},color:{oneOf:[{description:"Default color for the text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the text",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},visible:{type:"boolean"}},required:[]},ImageDesignDefaults:{type:"object",properties:{overlay:{type:"string"},visible:{type:"boolean"}},if:{properties:{overlay:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default colors for the image overlay",type:"array",items:{oneOf:[{description:"Default color for the image overlay",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the image overlay",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},minItems:2,maxItems:2}}},else:{properties:{color:{oneOf:[{description:"Default color for the image overlay",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the image overlay",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]}}},required:[]},ButtonDesignDefaults:{type:"object",properties:{appearance:{type:"string",enum:["SOLID","OUTLINE","TEXT"]},font:{type:"string"},size:{type:"string",enum:["SMALL","MEDIUM","LARGE"]},style:{type:"string",enum:["round-corner","rectangle","pill"]},color:{oneOf:[{description:"Default color for the button",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the button",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},visible:{type:"boolean"}},required:[]},BackgroundDesignDefaults:{type:"object",properties:{type:{description:"Type of the background",type:"string",const:"BACKGROUND"},style:{description:"Style of the background",type:"string",enum:["COLOR","GRADIENT"]}},if:{properties:{style:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default colors for the background",type:"array",items:{oneOf:[{description:"Default color for the background",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the background",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},minItems:2,maxItems:2}}},else:{properties:{color:{oneOf:[{description:"Default color for the background",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the background",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]}}}},ToggleDesignDefaults:{type:"object",properties:{enabled:{type:"boolean"}},required:[]},ColorPickerDefaults:{type:"object",properties:{appearance:{$ref:"section-commons.schema.json#/$defs/Color"}},required:[]},RatingDefaults:{type:"object",properties:{color:{$ref:"section-commons.schema.json#/$defs/Color"},visible:{type:"boolean"},style:{type:"string"}},required:[]},SelectboxDefaults:{type:"object",properties:{value:{type:"string"}},required:[]},SocialProfilesDefaults:{type:"object",properties:{color:{$ref:"section-commons.schema.json#/$defs/Color"},visible:{type:"boolean"},appearance:{type:"string"}},required:[]},LogoDesignDefaults:{type:"object",properties:{font:{type:"string"},size:{oneOf:[{description:"Default size for the logo text",type:"integer",minimum:1,exclusiveMaximum:50},{description:"Default global size string for the logo text",type:"string",enum:["global.textSize.title","global.textSize.subtitle","global.textSize.body"]}]},bold:{type:"boolean"},italic:{type:"boolean"},color:{oneOf:[{description:"Default color for the logo text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the logo text",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},visible:{type:"boolean"}},required:[]},SelectboxOption:{type:"object",properties:{value:{type:"string"},label:{type:"string"}},required:[]}},ms={$schema:yt,$id:mt,title:gt,description:ht,type:$t,patternProperties:bt,$defs:Et},Tt={__proto__:null,$defs:Et,$id:mt,$schema:yt,default:ms,description:ht,patternProperties:bt,title:gt,type:$t},Ot="https://json-schema.org/draft/2020-12/schema",St="https://lightspeedhq.com/section-commons.schema.json",wt="Custom Section - Content",jt="The content of a custom section",Dt="object",vt={Image:{type:"object",properties:{set:{type:"object",additionalProperties:{$ref:"#/$defs/ImageInfo"}},borderInfo:{$ref:"#/$defs/BorderInfo"},bucket:{type:"string"}},required:["set"]},ImageInfo:{type:"object",properties:{url:{type:"string"},width:{type:"integer",minimum:0},height:{type:"integer",minimum:0}}},BorderInfo:{type:"object",properties:{homogeneity:{type:"boolean"},color:{$ref:"#/$defs/RGBA"}}},RGBA:{type:"object",properties:{r:{type:"integer",minimum:0,maximum:255},g:{type:"integer",minimum:0,maximum:255},b:{type:"integer",minimum:0,maximum:255},a:{type:"number",format:"double",minimum:0,maximum:1}},required:["r","g","b","a"]},HSL:{type:"object",properties:{h:{type:"number",format:"double"},s:{type:"number",format:"double"},l:{type:"number",format:"double"},a:{type:"number",format:"double"}},required:["h","s","l","a"]},Overlay:{type:"object",properties:{type:{type:"string",enum:["solid","gradient","none"]},solid:{$ref:"#/$defs/Solid"},gradient:{$ref:"#/$defs/Gradient"}}},Solid:{type:"object",properties:{color:{$ref:"#/$defs/Color"}}},Gradient:{type:"object",properties:{fromColor:{$ref:"#/$defs/Color"},toColor:{$ref:"#/$defs/Color"}}},Background:{type:"object",properties:{type:{type:"string",enum:["solid","gradient"]},solid:{$ref:"#/$defs/Solid"},gradient:{$ref:"#/$defs/Gradient"}}},Color:{type:"object",properties:{raw:{type:"string"},hex:{type:"string"},auto:{type:"boolean"},rgba:{$ref:"#/$defs/RGBA"},hsl:{$ref:"#/$defs/HSL"}}}},At=!1,gs={$schema:Ot,$id:St,title:wt,description:jt,type:Dt,$defs:vt,additionalProperties:At},hs={__proto__:null,$defs:vt,$id:St,$schema:Ot,additionalProperties:At,default:gs,description:jt,title:wt,type:Dt},It="https://json-schema.org/draft/2020-12/schema",Ct="https://lightspeedhq.com/section-showcase.schema.json",Nt="Custom Section - Showcase settings",_t="The setting of a showcase",xt="object",kt=["showcaseId","previewImage"],Lt=[{properties:{showcaseId:{description:"Showcase id of the section",type:"string"},previewImage:{$ref:"section-commons.schema.json#/$defs/Image"}}},{$ref:"../showcase_overrides.schema.json"}],$s={$schema:It,$id:Ct,title:Nt,description:_t,type:xt,required:kt,allOf:Lt},Pt={__proto__:null,$id:Ct,$schema:It,allOf:Lt,default:$s,description:_t,required:kt,title:Nt,type:xt},Ft="https://json-schema.org/draft/2020-12/schema",Rt="https://lightspeedhq.com/template.schema.json",Gt="Custom Template",Mt="A custom template enclosing the necessary custom and default blocks",Bt="object",qt={metadata:{type:"object",properties:{name:{description:"Name of the template",type:"string",minLength:2,maxLength:60},description:{description:"Short description of the template",type:"string",minLength:2,maxLength:150},preview_url:{description:"Preview url of the demo website",type:"string",format:"uri",pattern:"^(https?)://([^.]+?\\.)?(company\\.site|ecwid\\.qa)($|/[A-Za-z0-9\\-._~:/?#\\[\\]@!$&'()*+,;=]*)?$"},cover_image:{type:"object",properties:{set:{description:"Name of the image set",type:"object",patternProperties:{".*":{type:"object",properties:{url:{description:"Path to the preview image relative to the 'assets' folder for a specific resolution",type:"string"}},required:["url"],additionalProperties:!1}}}},required:["set"],additionalProperties:!1}},required:["name","description","cover_image"],additionalProperties:!1},sections:{description:"List of sections contained by this template",type:"array",items:{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]}},allOf:[{if:{properties:{type:{const:"default"}}},then:{$ref:"template-default.schema.json#/$defs/default-section"}},{if:{properties:{type:{const:"custom"}}},then:{$ref:"template-custom.schema.json#/$defs/custom-section"}}]},minItems:1,uniqueItems:!1}},Ut=["metadata","sections"],bs={$schema:Ft,$id:Rt,title:Gt,description:Mt,type:Bt,properties:qt,required:Ut},zt={__proto__:null,$id:Rt,$schema:Ft,default:bs,description:Mt,properties:qt,required:Ut,title:Gt,type:Bt},Xt="https://json-schema.org/draft/2020-12/schema",Vt="https://lightspeedhq.com/showcase_overrides.schema.json",Kt="Showcase overrides",Ht="Overrides for the showcase",Jt="object",Yt={content:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","LOGO","DECK","MENU","NAVIGATION_MENU","INFO"]}},allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/input_box"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"template-custom-content.schema.json#/$defs/text_area"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-content.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/select_box"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"template-custom-content.schema.json#/$defs/logo"}},{if:{properties:{type:{const:"DECK"}}},then:{$ref:"template-custom-content.schema.json#/$defs/deck"}}]}}},design:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the design configuration element",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND","LOGO"]}},allOf:[{if:{properties:{type:{const:"TEXT"}}},then:{$ref:"template-custom-design.schema.json#/$defs/text"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-design.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-design.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-design.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-design.schema.json#/$defs/select_box"}},{if:{properties:{type:{const:"BACKGROUND"}}},then:{$ref:"template-custom-design.schema.json#/$defs/background"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"template-custom-design.schema.json#/$defs/logo"}},{if:{properties:{type:{const:"INFO"}}},then:{$ref:"template-custom-design.schema.json#/$defs/info"}}]}}},layoutId:{description:"Layout ID for the showcase",type:"string"},blockName:{description:"Section name for the showcase",type:"string"}},Es={$schema:Xt,$id:Vt,title:Kt,description:Ht,type:Jt,properties:Yt},Ts={__proto__:null,$id:Vt,$schema:Xt,default:Es,description:Ht,properties:Yt,title:Kt,type:Jt};var M=(e=>(e.CONTENT="Content",e.DESIGN="Design",e))(M||{});const Os={menu:{type:"NAVIGATION_MENU"},logo:{type:"LOGO"}},Ss={logo:{type:"LOGO",colors:["#FFFFFF66","#0000004D","#00000099","#64C7FF66","#F9947266","#C794CD66","#FFD17466"],sizes:[18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60],defaults:{font:"global.fontFamily.body",size:40,bold:!0,italic:!1,color:"#313131",visible:!0,spacing:2,capitalization:"all",frame:{visible:!0,width:3,color:"#313131"}}}};function Zt(e){switch(e){case se.HEADER:return Os;default:return{}}}function Wt(e){switch(e){case se.HEADER:return Ss;default:return{}}}function ws({validationType:e,sectionType:t}){switch(e){case M.CONTENT:return Zt(t);case M.DESIGN:return Wt(t);default:return{}}}function js(e){return Object.keys(e).length===0}function Ds({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).filter(([s])=>t[s]!==void 0).forEach(([s,n])=>{const r=t[s];n.type!==r.type&&o.push({instancePath:s,keyword:"type-mismatch",message:`Editor type "${n.type}" for reserved key "${s}" does not match the required type "${r.type}".`})}),o}function vs({type:e,mandatorySettings:t}){return Object.keys(t).find(o=>t[o].type===e)}function As({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).forEach(([s,n])=>{const r=vs({type:n.type,mandatorySettings:t});r&&s!==r&&o.push({instancePath:s,keyword:"key-mismatch",message:`Editor key "${s}" for overriden content type "${n.type}" does not match the required key name "${r}".`})}),o}function Is({type:e,mandatorySettings:t}){return Object.keys(t).findLast(o=>t[o].type===e)}function Cs({sectionSettings:e,mandatorySettings:t}){const o=[],s=Object.values(t).map(({type:r})=>r),n=Object.values(e).map(({type:r})=>r);return new Set(n.filter(r=>s.includes(r))).forEach(r=>{if(n.filter(i=>i===r).length>1){const i=Is({type:r,mandatorySettings:t});o.push({instancePath:i,keyword:"duplicate-type",message:`Editor type "${r}" can only be used once.`})}}),o}function Ns(e,t){const{sectionSettings:o,sectionType:s}=t,n=ws({validationType:e,sectionType:s});return n===void 0||js(n)?[]:[...Ds({sectionSettings:o,mandatorySettings:n}),...As({sectionSettings:o,mandatorySettings:n}),...Cs({sectionSettings:o,mandatorySettings:n})]}var y=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.ClientChunks=2]="ClientChunks",e[e.ClientAsset=3]="ClientAsset",e[e.Asset=4]="Asset",e[e.TemplateAsset=5]="TemplateAsset",e[e.Dependency=6]="Dependency",e[e.SourceCode=7]="SourceCode",e))(y||{});const J={[y.Server]:{type:"server_js_compressed",fileName:"server.js.gz",isSingleton:!0,toPath:(e,t)=>`${u[t].dist}/${e}/js/main/server/`},[y.Client]:{type:"client_js",fileName:"client.js",isSingleton:!1,toPath:(e,t)=>`${u[t].dist}/${e}/js/main/client/`},[y.ClientChunks]:{type:"client_js_chunks",isSingleton:!1,toPath:(e,t)=>`${u[t].dist}/${e}/js/main/client/chunks/`,fileName:"*"},[y.ClientAsset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:(e,t)=>`${u[t].dist}/${e}/js/main/client/assets/`},[y.Asset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:(e,t)=>`${u[t].dist}/${e}/assets/`},[y.TemplateAsset]:{type:"template_assets",fileName:"*",isSingleton:!1,toPath:()=>`${k}/assets/`},[y.Dependency]:{type:"dependencies",fileName:"package.json",isSingleton:!0,toPath:()=>{}},[y.SourceCode]:{type:"source_code",fileName:"source-code.zip",isSingleton:!0,toPath:()=>{}}},B=[hs,Tt,rt,Pt,zt,is,cs,ls,fs,Ts];function q(e,t){const o=new No({allErrors:!0,schemas:e});return _o(o),o.getSchema(t.$id)||o.compile(t)}function _s(){return q(B,zt)}function Qt(e){return e.map(t=>({instancePath:t.instancePath,message:t.message??"",keyword:t.keyword}))}const xs=e=>(()=>{const t=ts(e.name),o=t.split("/").pop()?.toLowerCase();return[{source:`./${o}/${e.name}/settings/content.ts`,dist:g.resolve(`${t}/${e.name}/js/settings/content`),ajv:q(B,rt),validationType:M.CONTENT,sectionName:e.name},{source:`./${o}/${e.name}/settings/design.ts`,dist:g.resolve(`${t}/${e.name}/js/settings/design`),ajv:q(B,Tt),validationType:M.DESIGN,sectionName:e.name},{source:`./${o}/${e.name}/settings/translations.ts`,dist:g.resolve(`${t}/${e.name}/js/settings/translations`),ajv:q(B,ut)},...e.showcaseEntryPoints.map(s=>({source:`./${o}/${e.name}/showcases/${C(s).name}.ts`,dist:g.resolve(`${t}/${e.name}/js/showcases/${C(s).name}`),ajv:q(B,s.indexOf("translations")===-1?Pt:ut)}))]})();function ks(e){const t=n=>{const r=(n??"").split("/").filter(i=>i.length>0);return r.length===0?"$":`$${r.map(i=>`.${i}`).join("")}`};let o=0,s=0;Object.keys(e).forEach(n=>{const r=e[n];o=Math.max(o,Math.max(...r.map(i=>t(i.instancePath).length))),s=Math.max(s,Math.max(...r.map(i=>i.message.length)))}),Object.keys(e).forEach(n=>{const r=e[n].filter((i,c,d)=>c===d.findIndex(p=>`${i.instancePath}${i.message}${i.keyword}`==`${p.instancePath}${p.message}${p.keyword}`));a.error(n),r.filter(i=>i.keyword!=="if").forEach(i=>{a.error(`${t(i.instancePath).padEnd(o," ")} | ${i.message.padEnd(s," ")} | ${i.keyword||"-"}`)})})}function Ls(e,t){if(e.validationType===void 0||e.sectionName===void 0)return[];const{sectionName:o,validationType:s}=e,n=G(o);return[...Ns(s,{sectionSettings:t,sectionType:n})]}async function Ps(e){const t=await H(e.dist,!1),o={},s=[];e.ajv(t)||s.push(...Qt(e.ajv.errors??[]));const n=Ls(e,t);return n.length>0&&s.push(...n),s.length>0&&(o[e.source]=s),o}async function Fs(e){const t=ko(xo.gunzip),o=await h.promises.readFile(e);return(await t(o)).length}async function Rs(e,t){const o=J[y.Server],s=g.resolve(`${o.toPath(e,t)}${o.fileName}`),n=await Fs(s);if(n>be)throw a.error(`Size of individual server file must not exceed threshold [${R(be)}]!`),a.error(`${`File: ${s}`.padEnd(s.length+10)}| ${R(n)}`),new Error("Invalid server file size")}function Gs(e){const t=e.reduce((o,s)=>{const n=So(s);return n.size>$e&&(o[s]=R(n.size)),o},{});if(Object.keys(t).length!==0){const o=Math.max(...Object.keys(t).map(s=>s.length));a.error(`Size of individual assets must not exceed threshold [${R($e)}]!`);for(const s in t)a.error(`${`File: ${s}`.padEnd(o+10)}| ${t[s]}`);throw new Error("Invalid asset file size")}}function Ms(e,t,o,s){const n={};return e(t)&&s===void 0?To(`${o}${x}.mjs`,`${o}.mjs`,()=>{}):(Oo(`${o}${x}.mjs`,()=>{}),n[g.resolve(`./templates/${C(o).name}.ts`)]=[...Qt(e.errors??[]),...s??[]]),n}async function Bs(e){const t=[];for(const o of e.sections){const s=e.sections.indexOf(o);if(s===0){const n=o.id==="header"&&o.type==="default",r=v(`${W}/${o.id}`);!n&&!r&&t.push({instancePath:`/sections/${s}/id`,message:"The first section must be a `header`",keyword:"required"})}else if(s===e.sections.length-1){const n=o.id==="footer"&&o.type==="default",r=v(`${Q}/${o.id}`);!n&&!r&&t.push({instancePath:`/sections/${s}/id`,message:"The last section must be a `footer`",keyword:"required"})}else if(o.type==="custom")if(!v(`${E}/${o.id}`))t.push({instancePath:`/sections/${s}/id`,message:"Custom section must have a corresponding block defined",keyword:"required"});else{if(o.content!==void 0)if(!v(`${E}/${o.id}/js/settings/content.mjs`))t.push({instancePath:`/sections/${s}/content`,message:"Content descriptor is overridden, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const n=await H(`${E}/${o.id}/js/settings/content`,!1),r=new Set(Object.keys(n));Object.keys(o.content).every(i=>r.has(i))||t.push({instancePath:`/sections/${s}/content`,message:"Content descriptor must be a subset of the default content descriptor",keyword:"type"})}if(o.design!==void 0)if(!v(`${E}/${o.id}/js/settings/design.mjs`))t.push({instancePath:`/sections/${s}/design`,message:"Design descriptor is overridden, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const n=await H(`${E}/${o.id}/js/settings/design`,!1),r=new Set(Object.keys(n));Object.keys(o.design).every(i=>r.has(i))||t.push({instancePath:`/sections/${s}/design`,message:"Design descriptor must be a subset of the default design descriptor",keyword:"type"})}o.showcase_id!==void 0&&(v(`${E}/${o.id}/js/showcases/${o.showcase_id}.mjs`)||t.push({instancePath:`/sections/${s}/showcase-id`,message:"Custom section must have a corresponding showcase defined in case showcase_id is specified",keyword:"required"}))}}return t.length===0?void 0:t}function qs(e){return Object.entries(u).find(t=>t[1].source===e)?.[0]}async function Us(){const e=await $("**/server.{js,ts}",{ignore:["node_modules/**","dist/**"]});return Promise.all(e.map(async t=>{const o=ho(t).split($o),s=o.pop()??"default",n=o.pop();if(n===void 0)throw new Error("Cannot determine type of section, outer directory is undefined");const r=await $(`**/${s}/client.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),i=await $(`**/${s}/settings/content.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),c=await $(`**/${s}/settings/design.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),d=await $(`**/${s}/settings/layout.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),p=await $(`**/${s}/settings/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),O=await $(`**/${s}/showcases/*.{js,ts}`,{ignore:["node_modules/**","dist/**",`**/${s}/showcases/translations.{js,ts}`]}),yo=await $(`**/${s}/showcases/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),mo=await $(`**/${s}/assets/*`,{ignore:["node_modules/**","dist/**"]});return{name:s,type:qs(n),serverEntrypoint:t,clientEntrypoint:r.at(0),contentSettingsEntrypoint:i.at(0),designSettingsEntrypoint:c.at(0),layoutSettingsEntrypoint:d.at(0),settingsTranslationsEntrypoint:p.at(0),showcasesEntrypoints:O,showcasesTranslationsEntrypoint:yo.at(0),assetsEntrypoints:mo}}))}async function zs(){const e=await $("./templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]}),t=await $("./templates/assets/*",{ignore:["node_modules/**","dist/**"]});return{templates:e,assets:t}}async function L(e,t,o,s="SECTION"){t.length!==0&&await de({configFile:!1,...fe(De(e,t,o,s))})}function Xs(){return Promise.all([Y.rm("dist",{recursive:!0,force:!0}),Y.rm("source-code",{recursive:!0,force:!0}),Y.rm("source-code.zip",{force:!0})])}async function Vs(e){return Gs(e.assetEntryPoints),await de({configFile:!1,...fe(De(e.name,e.serverEntrypoint,T.Server,e.type))}),await Rs(e.name,e.type),await L(e.name,e.clientEntrypoint,T.Client,e.type),await L(e.name,e.settingsEntryPoints,T.SectionSetting,e.type),await L(e.name,e.showcaseEntryPoints,T.SectionShowcase,e.type),await L(e.name,e.assetEntryPoints,T.SectionAsset,e.type),await xs(e).reduce(async(t,o)=>{const s=await t,n=await Ps(o);return{...s,...n}},Promise.resolve({}))}async function Ks(e){return e.reduce(async(t,o)=>{const s=await t,n=await Vs(o);return{...s,...n}},Promise.resolve({}))}async function Hs(){const e=await zs();if(e.templates.length===0)return{};const t=await _s();return await L(void 0,e.assets,T.TemplateAsset),await L(void 0,e.templates,T.TemplateDescriptor),e.templates.reduce(async(o,s)=>{const n=await o,r=`${k}/js/${C(s).name}`,i=await H(r,!0);return{...n,...Ms(t,i,r,await Bs(i))}},Promise.resolve({}))}async function Js(){const e=new vo,t=["node_modules/**/*","dist/**/*","build/**/*",".git/**/*","**/assets/**/*","crane.config.json"],o=await $("**/*",{cwd:l(process.cwd()),ignore:t,dot:!0,nodir:!0});try{o.forEach(r=>{const i=l(process.cwd(),r);e.addLocalFile(i,C(r).dir)});const s=J[y.SourceCode].fileName,n=l(process.cwd(),s);await e.writeZipPromise(n)}catch(s){throw a.error("Error while zipping source files"),s}}async function Ys(){await Xs();try{const e=await Us().then(o=>o.map(s=>({name:s.name,type:s.type,serverEntrypoint:s.serverEntrypoint,clientEntrypoint:[s.clientEntrypoint].filter(ee).flat(),settingsEntryPoints:[s.contentSettingsEntrypoint,s.designSettingsEntrypoint,s.layoutSettingsEntrypoint,s.settingsTranslationsEntrypoint].filter(ee),showcaseEntryPoints:[...s.showcasesEntrypoints??[],s.showcasesTranslationsEntrypoint].filter(ee),assetEntryPoints:s.assetsEntrypoints??[]}))),t={...await Ks(e),...await Hs()};Object.keys(t).length===0?(await Js(),a.info("Build successful. For deploy run: npx @lightspeed/crane@latest deploy")):(a.error("Error during build:"),ks(t))}catch(e){a.error(`Error while building: ${e.message}`),process.exit(1)}}function ne(e,t){return Object.keys(e).reduce((o,s)=>{const n=e[s],r=t[s];return Ee(n)&&Ee(r)?o[s]=ne(n,r):o[s]=n,o},{...t})}function Zs({contentSettings:e,sectionType:t}){const o=Zt(t);return ne(e,o)}function Ws({designSettings:e,sectionType:t}){const o=Wt(t);return ne(e,o)}function re(e){if(e!==void 0)return e.startsWith("global.")?{type:"GLOBAL_FONT",font:e}:{type:"PRESET_FONT",font:e}}function D(e){if(e===void 0)return;if(e.startsWith("global."))return{type:"GLOBAL_COLOR",raw:e};const t=Ro(e);return{type:"STRUCTURED_COLOR",raw:e,hex:t.toHex8String(),hsl:t.toHsl(),rgba:t.toRgb(),auto:!1}}function eo(e){if(e!==void 0)return typeof e=="string"&&e.startsWith("global.")?{type:"GLOBAL_TEXT_SIZE",size:e}:{type:"NUMERIC_TEXT_SIZE",size:Number(e)}}const Qs={COLOR:"COLOR",GRADIENT:"GRADIENT"};function en(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(Qs)}`)}}function tn(e){const t=e.style,o=e.color,s=Array.isArray(o)?o:[o,o];return e.background={type:en(t),solid:{color:D(s.at(0))},gradient:{fromColor:D(s.at(0)),toColor:D(s.at(1))}},e.style=void 0,e.color=void 0,e}const on={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"};function sn(e){switch(e){case"SOLID":return"solid-button";case"OUTLINE":return"outline-button";case"TEXT":return"text-link";default:throw new Error(`Unknown button appearance: ${e}. Right options: ${Object.keys(on)}`)}}const nn={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"};function rn(e){switch(e){case"SMALL":return"small";case"MEDIUM":return"medium";case"LARGE":return"large";default:throw new Error(`Unknown button size: ${e}. Right options: ${Object.keys(nn)}`)}}const an={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"};function cn(e){switch(e){case"ROUND_CORNER":return"round-corner";case"RECTANGLE":return"rectangle";case"PILL":return"pill";default:throw new Error(`Unknown button shape: ${e}. Right options: ${Object.keys(an)}`)}}function pn(e){const t=e.appearance;t!==void 0&&(e.appearance=sn(t));const o=e.size;o!==void 0&&(e.size=rn(o));const s=e.shape;s!==void 0&&(e.style=cn(s),e.shape=void 0);const n=e.font;e.font=re(n);const r=e.color;return e.color=D(r),e}const ln={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"};function dn(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";case"NONE":return"none";default:throw new Error(`Unknown image overlay type: ${e}. Right options: ${Object.keys(ln)}`)}}function fn(e){const t=e.overlay,o=e.color,s=Array.isArray(o)?o:[o,o];return e.overlay={type:dn(t),solid:{color:D(s.at(0))},gradient:{fromColor:D(s.at(0)),toColor:D(s.at(1))}},e.color=void 0,e}function un(e){const t=e.font;e.font=re(t);const o=e.color;e.color=D(o);const s=e.size;return e.size=eo(s),e}function yn(e){const t=e.color;return e.color=D(t),e}function mn(e){const t=e.font;e.font=re(t);const o=e.color;e.color=D(o);const s=e.size;if(e.size=eo(s),e.frame!==void 0){const n=e.frame.color;e.frame.color=D(n)}return e}function ie(e,t){switch(e){case"TEXT":{un(t);break}case"BUTTON":{pn(t);break}case"IMAGE":{fn(t);break}case"BACKGROUND":{tn(t);break}case"COLOR_PICKER":{yn(t);break}case"LOGO":{mn(t);break}case"TOGGLE":case"DIVIDER":case"SELECTBOX":break;default:throw new Error(`Unknown design editor type: ${e}`)}return t}function gn(e){Object.keys(e).forEach(t=>{const o=e[t];o.type!=="DIVIDER"&&ie(o.type,o.defaults)})}function hn(e){e.forEach(t=>{t.type!==void 0&&t.defaults!==void 0&&(ie(t.type,t.defaults),t.defaults.type=t.type)})}function to(e){Object.keys(e).forEach(t=>{const o=e[t],s=o.type;ie(s,o)})}const $n=e=>`\x1B[32m${e}\x1B[0m`,bn=(e,t,o,s,n)=>{if(!e.total)return;const{loaded:r}=e,i=(Date.now()-n)/1e3;o.value+=r-s.value,s.value=r,t.update({speed:`${R(o.value/i,2)}/s`})},En=()=>new Go.SingleBar({format:`|${$n("{bar}")}| {status} || {percentage}% || {value}/{total} Files || Speed: {speed}`,barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}),Tn="https://blockbuster.ecwid.com",On="/api/v1/custom-apps/resources/sections/upload",Sn="/api/v1/custom-apps/resources/templates/upload",wn="/api/v1/custom-apps/manifests/sections",jn="/api/v1/custom-apps/manifests/templates",Dn=5,vn=3,An=[y.Server,y.Client,y.ClientChunks,y.ClientAsset,y.Asset],In=[y.Dependency,y.TemplateAsset,y.SourceCode],P={DEFAULT:"Error while deploying:",ASSET_FILES_UPLOAD:"Error while uploading asset files:",MANIFEST_DEPLOYMENT:"Error while deploying manifest file:",DEPRECATED_VERSION_DEPLOYMENT:"You are using a non-supported version of crane. Please update to the latest crane version to continue.",DISTRIBUTION_FOLDER_NOT_FOUND:e=>`Distribution folder [${e}] not found, please execute the build command first.`};async function F(e){return(await import(pe(e).href)).default}function Cn(e,t){if(!t)return;const o=e[t];return o===void 0?{en:t}:o}function Nn(e){const t={};for(const o in e){const s=e[o];for(const n in s){const r=t[n],i=s[n];if(r===void 0){const c={};c[o]=i,t[n]=c}else r[o]=i}}return t}function U(e,t){if(e&&typeof e=="object"){const o=e;for(const s in o){const n=o[s];typeof n=="string"&&n.startsWith("$")&&(o[s]=Cn(t,n)),typeof n=="object"&&U(n,t)}}}async function oo(e){await new Promise(t=>{setTimeout(t,e)})}const _n={value:0},w=En();let so=Date.now();const no=e=>2**e*500;async function xn(){const e=await me(l(f.cwd(),"crane.config.json")),t=JSON.parse(e.toString());return{appClientId:t.app_client_id,appSecretKey:btoa(t.app_secret_key)}}function kn(e){return typeof e=="object"&&e!==null&&"version"in e&&typeof e.version=="string"}async function Ln(){const e=l(f.cwd(),"package.json"),t=await me(e),o=JSON.parse(t.toString());if(kn(o))return o;throw new Error(`Package file located at path: ${e} does not contain a version field`)}async function Pn(e){const t=Po(e.version,"patch");if(t===null)throw Error("Error while incrementing app version");e.version=t,wo(l(f.cwd(),"package.json"),`${JSON.stringify(e,null,2)}
3
+ `)}async function Fn(e,t,o=E){try{const s=l(f.cwd(),`${o}/${e}/js/settings/content.mjs`),n=await F(s),r=G(e),i=Zs({contentSettings:n,sectionType:r});return U(i,t),i}catch{throw new Error(`Content descriptor for section [${e}] is either invalid or undefined`)}}async function Rn(e,t,o=E){try{const s=l(f.cwd(),`${o}/${e}/js/settings/design.mjs`),n=await F(s),r=G(e),i=Ws({designSettings:n,sectionType:r});return gn(i),U(i,t),i}catch(s){const n=s;throw new Error(`Design settings is invalid or undefined. Error ${n.stack}`)}}async function Gn(e,t,o=E){try{const s=await $("*.mjs",{cwd:l(f.cwd(),`${o}/${e}/js/showcases/`),ignore:"**/translations.mjs"});return Promise.all(s.map(async n=>{const r=l(f.cwd(),`${o}/${e}/js/showcases/${n}`),i=await F(r);return to(i.design),U(i,t),i}))}catch(s){throw new Error(`Showcases is invalid or undefined. Error ${s}`)}}async function Mn(e,t=E){try{const o=l(f.cwd(),`${t}/${e}/js/settings/layout.mjs`);if(!v(o))return[];const s=await F(o);return s.forEach(n=>hn(n.selectedDesignSettings)),s}catch{throw new Error(`Layout descriptor for section [${e}] is either invalid or undefined`)}}async function ro(e){const t=l(f.cwd(),e),o=await F(t);return Nn(o)}async function Bn(e,t=E){return ro(`${t}/${e}/js/settings/translations.mjs`)}async function io(e,t=E){return ro(`${t}/${e}/js/showcases/translations.mjs`)}async function ae(e,t){const o=await Bn(e,u[t].dist),s=await io(e,u[t].dist),n=await Fn(e,o,u[t].dist),r=await Rn(e,o,u[t].dist),i=await Gn(e,s,u[t].dist),c=await Mn(e,u[t].dist);return{id:e,type:t,name:{en:e},contentEditors:n,designEditors:r,layouts:c,showcases:i}}async function qn(){const e=await $("*/",{cwd:l(f.cwd(),`${E}/`)}),t=await $("*/",{cwd:l(f.cwd(),`${W}/`)}),o=await $("*/",{cwd:l(f.cwd(),`${Q}/`)});return Promise.all([...e.map(async s=>ae(s,"SECTION")),...t.map(async s=>ae(s,"HEADER")),...o.map(async s=>ae(s,"FOOTER"))])}async function Un(e){try{return await F(l(f.cwd(),e))}catch{throw new Error(`Template descriptor [${e}] is either invalid or undefined`)}}async function zn(e){const t=await $(`${k}/js/**.mjs`,{ignore:[`${k}/js/**${x}.mjs`]});return Promise.all(t.map(async o=>{const s=await Un(o),n=s.sections.filter(r=>r.type==="custom");for(const r of n){const i=G(r.id),c=await io(r.id,u[i].dist);r.showcase_overrides!==void 0&&(U(r.showcase_overrides,c),to(r.showcase_overrides.design))}return{id:`${e}_${C(o).name}`,descriptor:s}}))}function ao(e,t){const o=e.pathContext,s=o.toPath(e.currentSection,t),n=s===void 0?le(o.fileName):le(o.fileName,{cwd:l(f.cwd(),s),ignore:o.ignore});return(o.isSingleton?n.splice(0):n).map(r=>({url:r,subType:t,context:e}))}function Xn(e){return e instanceof ge&&(e.code==="ECONNRESET"||e.response?.status!==void 0&&e.response?.status>=500&&e.response?.status<600)}function co(e,t){return e<vn&&Xn(t)}function po(e,t,o,s){const n={value:0},r=e.config.app.templates.length>0?Sn:On;return e.config.axios.post(r,{file:jo(l(f.cwd(),o!==void 0?o+t:t))},{params:{appClientId:e.config.app.crane.appClientId,type:e.pathContext.type,version:e.config.app.packageJson.version,...e.currentSection!==void 0&&{block:e.currentSection},...!["dependencies","source_code"].includes(e.pathContext.type)&&{fileName:t}},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${e.config.app.crane.appSecretKey}`},onUploadProgress:i=>bn(i,w,_n,n,so)}).then(i=>(w.increment(),i)).catch(async i=>{if(co(s,i))return await oo(no(s)),po(e,t,o,s+1);throw w.increment(),i})}function Vn(e){return w.start(e.length+1,0,{speed:"N/A",status:"Deployment in progress"}),e.map(t=>{const o=t.context,s=o.pathContext.toPath(o.currentSection,t.subType);return po(o,t.url,s,0)})}function Kn(e){const t=e.app.sections.flatMap(s=>An.flatMap(n=>{const r={config:e,currentSection:s.id,pathContext:J[n]};return ao(r,s.type)})),o=In.flatMap(s=>ao({config:e,pathContext:J[s]},"SECTION"));return Vn([...t,...o])}function Hn(e){return e.includes(`
4
+ `)}function Jn(e,t,o){return e.split(`
5
5
  `).map((s,n)=>n>=o?t+s:s).join(`
6
- `)}function oo(e,t){const o=[];if(e instanceof de){e.response?.status!==void 0&&o.push(` HTTP Status Code: ${e.response.status}`);const r=e.response?.data;if(r?.errorCode&&o.push(` Error Code: ${r.errorCode}`),r?.errorMessage){const i=Dn(r.errorMessage)?In(r.errorMessage," ",1):r.errorMessage;o.push(` Error Message: ${i}`)}}const s=o.length>0?o.join(`
6
+ `)}function z(e,t){const o=[];if(e instanceof ge){e.response?.status!==void 0&&o.push(` HTTP Status Code: ${e.response.status}`);const r=e.response?.data;if(r?.errorCode&&o.push(` Error Code: ${r.errorCode}`),r?.errorMessage){const i=Hn(r.errorMessage)?Jn(r.errorMessage," ",1):r.errorMessage;o.push(` Error Message: ${i}`)}}const s=o.length>0?o.join(`
7
7
  `):e?.message??"Unknown error";if(!t||t.length===0)return s;const n=o.length>0?`
8
- `:" ";return`${t}${n}${s}`}async function so(e,t=0){const o=e.app.templates.length>0?rn:nn;return e.axios.post(o,{version:e.app.packageJson.version,name:"Custom Block App",blocks:e.app.sections,templates:e.app.templates,compressionEnabled:!0,externalizationEnabled:!0,vueVersion:e.app.packageJson.dependencies.vue},{params:{appClientId:e.app.crane.appClientId},headers:{Authorization:`Bearer ${e.app.crane.appSecretKey}`}}).catch(async s=>{if(eo(t,s))return await to(t),so(e,t+1);throw s})}async function _n(e){try{O(f(l.cwd(),g))||(p.error(`Distribution folder [${g}] not found, please execute the build command first.`),l.exit(1));const t=e??tn;p.info("Custom application deployment :: Started");const o=Oo.create({baseURL:t});vo(o,an),p.info("Loading configuration files ...");const s=await Promise.all([fn(),un(),wn(),Sn()]).then(([a,y,c,A])=>({axios:o,app:{crane:a,packageJson:y,sections:c,templates:A}}));p.info("Uploading files ..."),Jt=Date.now();const n=await Promise.all(An(s));n.every(a=>a.status===Ws)||(C.stop(),n.map(a=>a.message).filter((a,y,c)=>c.indexOf(a)===y).forEach(a=>p.error(`Error while uploading asset files: ${a}`)),l.exit(1)),C.update({speed:"N/A",status:"Finalising deployment"}),await so(s).catch(a=>{C.stop(),p.error(oo(a,"Error while deploying manifest file:")),l.exit(1)}).finally(()=>{C.increment(),C.stop()});const r=s.app.sections.map(a=>a.id),i=s.app.packageJson.version;p.info(`Custom application deployment :: Successful
9
- Current app version: ${i}
10
- Deployed sections: ${r.join(", ")}`),await mn(s.app.packageJson),s.app.templates.length>0&&p.info(`Deployed templates: ${s.app.templates.map(a=>a.id).join(", ")}`)}catch(t){p.error(oo(t,"Error while deploying:")),l.exit(1)}}const Nn="1.1.3";async function xn(e){Y("template/headers/example-header","headers",e,"Header")}async function Ln(e){Y("template/footers/example-footer","footers",e,"Footer")}const d=io("crane");async function Pn(e,t,o,s){const n=`You can use ${t} to directly specify the name of the ${e}.`;console.log(n);const r=await ne({type:"text",name:"name",message:`Please specify a name for your ${e}:`});if(r.name)return e==="template"?o(r.name,s):o(r.name);console.log("Please provide a name for the template."),d.outputHelp()}function kn(e){return typeof e=="number"?!1:!(typeof e=="string"&&e.trim().length!==0)}async function U(e,t,o,s,n){s&&(kn(s)?await Pn(e,t,o):await o(s,n))}function Rn(){d.command("init","Initialize a new resource in the form of a directory.").option("--app <name>","Creates an app folder inside your current directory.").option("--section <name>","Creates the files necessary for one custom section with the given name, this can be repeated for each section.").option("--header <name>","Creates the files necessary for one custom header with the given name, this can be repeated for each header.").option("--footer <name>","Creates the files necessary for one custom footer with the given name, this can be repeated for each footer.").option("--template <name>","Creates the directory and files necessary to build a custom template inside your app folder.").option("--reference-template","Adds files necessary for the reference templates inside your app folder. ").option("--custom-headers-footers","Creates the directories and files necessary to build a custom header and footer inside your app folder."),d.command("build","Builds your resource code").action(Is),d.command("deploy","Deploys your resource code into Ecwid"),d.on("command:*",()=>{console.error("Invalid command: %s",d.args.join(" ")),d.outputHelp(),process.exit(1)}),d.on("command:init",async()=>{const e=d.options.section,t=d.options.header,o=d.options.footer,s=d.options.app,n=d.options.template,r=d.options.referenceTemplate,i=d.options.customHeadersFooters||!1;await U("app",N("init --app <name>"),Do,s),await U("section",N("init --section <name>"),Io,e),await U("header",N("init --header <name>"),xn,t),await U("footer",N("init --footer <name>"),Ln,o),await U("template",N("init --template <name>"),_o,n,i),r&&No()}),d.on("command:deploy",()=>_n(d.options.url)),d.help(),d.usage("<action> <resource>"),d.version(Nn),d.parse()}try{Rn()}catch(e){console.error(e)}
8
+ `:" ";return`${t}${n}${s}`}async function lo(e,t=0){const o=e.app.templates.length>0?jn:wn;return e.axios.post(o,{version:e.app.packageJson.version,name:"Custom Block App",blocks:e.app.sections,templates:e.app.templates,compressionEnabled:!0,externalizationEnabled:!0,vueVersion:e.app.packageJson.dependencies.vue},{params:{appClientId:e.app.crane.appClientId},headers:{Authorization:`Bearer ${e.app.crane.appSecretKey}`}}).catch(async s=>{if(co(t,s))return await oo(no(t)),lo(e,t+1);throw s})}async function Yn(e){try{if(!v(l(f.cwd(),E)))throw new Error(P.DISTRIBUTION_FOLDER_NOT_FOUND(E));const t=e??Tn;a.info("Custom application deployment :: Started");const o=Lo.create({baseURL:t});Fo(o,Dn),a.info("Loading configuration files ...");const s=await Promise.all([xn(),Ln(),qn()]).then(async([i,c,d])=>({axios:o,app:{crane:i,packageJson:c,sections:d,templates:await zn(i.appClientId)}}));a.info("Uploading files ..."),so=Date.now(),await Promise.all(Kn(s)).catch(i=>{w.stop(),i.response?.status===404?a.error(z(i,P.DEPRECATED_VERSION_DEPLOYMENT)):a.error(z(i,P.ASSET_FILES_UPLOAD)),f.exit(1)}).finally(()=>{w.increment(),w.stop()}),w.update({speed:"N/A",status:"Finalising deployment"}),await lo(s).catch(i=>{w.stop(),i.response?.status===404?a.error(z(i,P.DEPRECATED_VERSION_DEPLOYMENT)):a.error(z(i,P.MANIFEST_DEPLOYMENT)),f.exit(1)}).finally(()=>{w.increment(),w.stop()});const n=s.app.sections.map(i=>i.id),r=s.app.packageJson.version;a.info("Custom application deployment :: Successful"),a.info(`Current app version: ${r}`),a.info(`Deployed sections: ${n.join(", ")}`),await Pn(s.app.packageJson),s.app.templates.length>0&&a.info(`Deployed templates: ${s.app.templates.map(i=>i.id).join(", ")}`)}catch(t){w.stop(),a.error(z(t,P.DEFAULT)),f.exit(1)}}const Zn="1.2.0";async function Wn(e){oe(),te("template/headers/example-header","headers",e,"Header")}async function Qn(e){oe(),te("template/footers/example-footer","footers",e,"Footer")}const er={deploy:["url"]};function tr(e,t){return e.options.length!==0&&Object.keys(t).length===1}function or(e){return e.includes("-h")||e.includes("--help")}function sr(e,t){return Object.keys(t).some(o=>o!=="--"&&!e.hasOption(o)&&!er[e.rawName]?.includes(o))}function nr(e){return e.length!==0}function rr(e,t,o){return e.matchedCommand!==void 0&&(tr(e.matchedCommand,o)||or(e.rawArgs)||sr(e.matchedCommand,e.options)||nr(t))}function ir(e,t,o){e.matchedCommand&&!rr(e,t,o)?e.runMatchedCommand():e.outputHelp()}function fo(e){if(qo(e))return console.log("Please specify a name for your resource."),!1;const{isValid:t,errorMessage:o}=Bo(e);return o&&console.log(o),t}async function uo(e,t,o,s,n){const r=(await ce({type:"text",name:"name",message:`Please specify a name for your ${t}:`})).name;if(r===void 0)return console.log(`You can use ${o} to directly specify the name of the ${t}.`),e.outputHelp();const i=g.basename(r);return fo(i)?s(i,n):uo(e,t,o,s,n)}async function X(e,t,o,s,n,r){if(n!==void 0)if(!fo(n))await uo(e,t,o,s);else{const i=g.basename(n.toString());await s(i,r)}}async function ar(e,t){try{const{app:o,section:s,header:n,footer:r,template:i,customHeadersFooters:c,referenceTemplate:d}=e,p=!!c;await X(t,"app",N("init --app <name>"),Xo,o),await X(t,"section",N("init --section <name>"),Ko,s),await X(t,"header",N("init --header <name>"),Wn,n),await X(t,"footer",N("init --footer <name>"),Qn,r),await X(t,"template",N("init --template <name>"),Ho,i,p),d&&await Jo()}catch(o){a.error(`Error while executing init operation: ${o.message}`),process.exit(1)}}function cr(){try{const e=go("crane");e.option("-h, --help","Display this message"),e.command("init","Initialize a new resource in the form of a directory.").option("--app [name]","Creates an app folder inside your current directory.").option("--section [name]","Creates the files necessary for one custom section with the given name, this can be repeated for each section.").option("--header [name]","Creates the files necessary for one custom header with the given name, this can be repeated for each header.").option("--footer [name]","Creates the files necessary for one custom footer with the given name, this can be repeated for each footer.").option("--template [name]","Creates the directory and files necessary to build a custom template inside your app folder.").option("--reference-template","Adds files necessary for the reference templates inside your app folder. ").action(async o=>ar(o,e)),e.command("build","Builds your resource code").action(Ys),e.command("deploy","Deploys your resource code").allowUnknownOptions().action(()=>Yn(e.options.url)),e.version(Zn),e.usage("<action> <resource>");const t=e.parse(process.argv,{run:!1});ir(e,t.args,t.options)}catch(e){a.error(`Error while parsing input: ${e.message}`),process.exit(1)}}export{cr as run};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightspeed/crane",
3
- "version": "1.1.3",
3
+ "version": "1.2.1",
4
4
  "type": "module",
5
5
  "bin": "bin/crane.js",
6
6
  "main": "./dist/app.mjs",
@@ -19,7 +19,8 @@
19
19
  "bin",
20
20
  "dist",
21
21
  "template",
22
- "types.d.ts"
22
+ "types.d.ts",
23
+ "CHANGELOG.md"
23
24
  ],
24
25
  "scripts": {
25
26
  "dev": "unbuild --stub",
@@ -33,10 +34,13 @@
33
34
  "license": "MIT",
34
35
  "devDependencies": {
35
36
  "@jest/globals": "^29.7.0",
37
+ "@types/adm-zip": "^0.5.7",
38
+ "@types/axios-concurrency": "^1.0.0",
36
39
  "@types/express-fileupload": "^1.5.0",
37
40
  "@types/fs-extra": "^11.0.1",
38
41
  "@types/jest": "^29.5.12",
39
42
  "@types/node": "^20.4.5",
43
+ "@types/semver": "^7.5.8",
40
44
  "dir-compare": "^5.0.0",
41
45
  "express": "^4.19.2",
42
46
  "express-fileupload": "^1.5.1",
@@ -53,9 +57,10 @@
53
57
  "@lightspeed/eslint-config-crane": "1.0.2",
54
58
  "@types/prompts": "^2.4.2",
55
59
  "@vitejs/plugin-vue": "^4.1.0",
60
+ "adm-zip": "^0.5.16",
56
61
  "ajv": "^8.12.0",
57
62
  "ajv-formats": "^2.1.1",
58
- "axios": "^1.7.7",
63
+ "axios": "^1.8.2",
59
64
  "axios-concurrency": "^1.0.4",
60
65
  "cac": "^6.7.14",
61
66
  "cli-progress": "^3.12.0",
@@ -83,6 +88,9 @@
83
88
  "eslint": {
84
89
  "file-entry-cache": "8.0.0"
85
90
  },
91
+ "axios-concurrency": {
92
+ "axios": "1.8.2"
93
+ },
86
94
  "magic-string": "0.30.10",
87
95
  "glob": "^9.3.5",
88
96
  "stylus": "^0.63.0"
@@ -3,7 +3,7 @@ export default {
3
3
  previewImage: {
4
4
  set: {
5
5
  ORIGINAL: {
6
- url: 'custom_section_showcase_2_preview.png',
6
+ url: 'example_header_showcase_1_preview.png',
7
7
  },
8
8
  },
9
9
  },
@@ -7,10 +7,9 @@
7
7
  "deploy": "crane build && crane deploy"
8
8
  },
9
9
  "dependencies": {
10
- "@lightspeed/crane": "1.1.3",
11
- "@lightspeed/eslint-config-crane": "1.0.2",
12
- "vue": "^3.4.0",
13
- "@ecwid/sdk": "^0.8.0"
10
+ "@lightspeed/crane": "latest",
11
+ "@lightspeed/eslint-config-crane": "latest",
12
+ "vue": "^3.4.0"
14
13
  },
15
14
  "engines": {
16
15
  "node": ">=20"
@@ -44,17 +44,11 @@ export default {
44
44
  settings: {
45
45
  stat_value: {
46
46
  type: 'INPUTBOX',
47
- label: '$label.showcase_1.stat_value_1.label',
48
- placeholder: '$label.showcase_1.stat_value_1.placeholder',
49
47
  text: '$label.showcase_1.stat_value.default_1.text',
50
- title: '$label.showcase_1.stat_value.default_1.text',
51
48
  },
52
49
  stat_caption: {
53
50
  type: 'INPUTBOX',
54
- label: '$label.showcase_1.stat_caption_1.label',
55
- placeholder: '$label.showcase_1.stat_caption_1.placeholder',
56
51
  text: '$label.showcase_1.stat_caption_1.default.text',
57
- title: '$label.showcase_1.stat_caption_1.default.text',
58
52
  },
59
53
  },
60
54
  },
@@ -62,14 +56,10 @@ export default {
62
56
  settings: {
63
57
  stat_value: {
64
58
  type: 'INPUTBOX',
65
- label: '$label.showcase_1.stat_value_2.label',
66
- placeholder: '$label.showcase_1.stat_value_2.placeholder',
67
59
  text: '$label.showcase_1.stat_value.default_2.text',
68
60
  },
69
61
  stat_caption: {
70
62
  type: 'INPUTBOX',
71
- label: '$label.showcase_1.stat_caption_2.label',
72
- placeholder: '$label.showcase_1.stat_caption_2.placeholder',
73
63
  text: '$label.showcase_1.stat_caption_2.default.text',
74
64
  },
75
65
  },
@@ -78,14 +68,10 @@ export default {
78
68
  settings: {
79
69
  stat_value: {
80
70
  type: 'INPUTBOX',
81
- label: '$label.showcase_1.stat_value_3.label',
82
- placeholder: '$label.showcase_1.stat_value_3.placeholder',
83
71
  text: '$label.showcase_1.stat_value.default_3.text',
84
72
  },
85
73
  stat_caption: {
86
74
  type: 'INPUTBOX',
87
- label: '$label.showcase_1.stat_caption_3.label',
88
- placeholder: '$label.showcase_1.stat_caption_3.placeholder',
89
75
  text: '$label.showcase_1.stat_caption_3.default.text',
90
76
  },
91
77
  },
@@ -94,14 +80,10 @@ export default {
94
80
  settings: {
95
81
  stat_value: {
96
82
  type: 'INPUTBOX',
97
- label: '$label.showcase_1.stat_value_4.label',
98
- placeholder: '$label.showcase_1.stat_value_4.placeholder',
99
83
  text: '$label.showcase_1.stat_value.default_4.text',
100
84
  },
101
85
  stat_caption: {
102
86
  type: 'INPUTBOX',
103
- label: '$label.showcase_1.stat_caption_4.label',
104
- placeholder: '$label.showcase_1.stat_caption_4.placeholder',
105
87
  text: '$label.showcase_1.stat_caption_4.default.text',
106
88
  },
107
89
  },
@@ -110,14 +92,10 @@ export default {
110
92
  settings: {
111
93
  stat_value: {
112
94
  type: 'INPUTBOX',
113
- label: '$label.showcase_1.stat_value_5.label',
114
- placeholder: '$label.showcase_1.stat_value_5.placeholder',
115
95
  text: '$label.showcase_1.stat_value.default_5.text',
116
96
  },
117
97
  stat_caption: {
118
98
  type: 'INPUTBOX',
119
- label: '$label.showcase_1.stat_caption_5.label',
120
- placeholder: '$label.showcase_1.stat_caption_5.placeholder',
121
99
  text: '$label.showcase_1.stat_caption_5.default.text',
122
100
  },
123
101
  },
@@ -127,6 +105,7 @@ export default {
127
105
  button: {
128
106
  type: 'BUTTON',
129
107
  title: '$label.showcase_1.button_content.title',
108
+ buttonType: 'HYPER_LINK',
130
109
  },
131
110
  },
132
111
  design: {
@@ -169,7 +148,7 @@ export default {
169
148
  font: 'inter',
170
149
  appearance: 'OUTLINE',
171
150
  size: 'LARGE',
172
- style: 'pill',
151
+ shape: 'PILL',
173
152
  color: '#000000',
174
153
  },
175
154
  },