@lightspeed/crane 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/app.d.mts +3 -3
- package/dist/app.d.ts +3 -3
- package/dist/cli.mjs +7 -7
- package/package.json +3 -3
- package/template/_gitignore +1 -0
- package/template/preview/sections/preview.html +2 -0
- package/template/preview/vite.config.js +49 -7
- package/template/reference/templates/reference-template-apparel/configuration.ts +22 -0
- package/template/reference/templates/reference-template-apparel/pages/catalog.ts +10 -0
- package/template/reference/templates/reference-template-apparel/pages/category.ts +10 -0
- package/template/reference/templates/reference-template-apparel/pages/home.ts +24 -0
- package/template/reference/templates/reference-template-apparel/pages/product.ts +10 -0
- package/template/reference/templates/reference-template-bike/configuration.ts +22 -0
- package/template/reference/templates/reference-template-bike/pages/catalog.ts +10 -0
- package/template/reference/templates/reference-template-bike/pages/category.ts +10 -0
- package/template/reference/templates/reference-template-bike/pages/home.ts +24 -0
- package/template/reference/templates/reference-template-bike/pages/product.ts +10 -0
- package/template/reference/templates/reference-template-apparel.ts +0 -44
- package/template/reference/templates/reference-template-bike.ts +0 -44
- package/template/templates/assets/template_cover_image.png +0 -0
- package/template/templates/template.ts +0 -198
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.3.3 - 2025-09-23
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Add support for Local Preview analytics tracking.
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Update folder structure of generated reference custom templates.
|
|
12
|
+
- Update version of 'eslint' dependency.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- Fix Local Preview for Windows operating systems.
|
|
17
|
+
- Fix Local Preview warning message during 'deploy' command execution.
|
|
18
|
+
|
|
3
19
|
## 1.3.2 - 2025-09-10
|
|
4
20
|
|
|
5
21
|
### Changed
|
package/dist/app.d.mts
CHANGED
|
@@ -204,6 +204,9 @@ declare function useDeckElementContent<CONTENT>(elementName: keyof CONTENT): {
|
|
|
204
204
|
getReactiveRef: typeof getReactiveRef;
|
|
205
205
|
};
|
|
206
206
|
declare function getReactiveRef(card: Card | undefined, editorType: EditorTypes, contentElementName: string): {
|
|
207
|
+
hasContent: boolean;
|
|
208
|
+
value: string | undefined;
|
|
209
|
+
} | {
|
|
207
210
|
hasContent: boolean;
|
|
208
211
|
lowResolutionMobileImage: string;
|
|
209
212
|
highResolutionMobileImage: string;
|
|
@@ -221,9 +224,6 @@ declare function getReactiveRef(card: Card | undefined, editorType: EditorTypes,
|
|
|
221
224
|
hasTitle: boolean;
|
|
222
225
|
hasLink: boolean;
|
|
223
226
|
performAction: (() => void) | undefined;
|
|
224
|
-
} | {
|
|
225
|
-
hasContent: boolean;
|
|
226
|
-
value: string | undefined;
|
|
227
227
|
} | {
|
|
228
228
|
hasContent: boolean;
|
|
229
229
|
value: boolean | undefined;
|
package/dist/app.d.ts
CHANGED
|
@@ -204,6 +204,9 @@ declare function useDeckElementContent<CONTENT>(elementName: keyof CONTENT): {
|
|
|
204
204
|
getReactiveRef: typeof getReactiveRef;
|
|
205
205
|
};
|
|
206
206
|
declare function getReactiveRef(card: Card | undefined, editorType: EditorTypes, contentElementName: string): {
|
|
207
|
+
hasContent: boolean;
|
|
208
|
+
value: string | undefined;
|
|
209
|
+
} | {
|
|
207
210
|
hasContent: boolean;
|
|
208
211
|
lowResolutionMobileImage: string;
|
|
209
212
|
highResolutionMobileImage: string;
|
|
@@ -221,9 +224,6 @@ declare function getReactiveRef(card: Card | undefined, editorType: EditorTypes,
|
|
|
221
224
|
hasTitle: boolean;
|
|
222
225
|
hasLink: boolean;
|
|
223
226
|
performAction: (() => void) | undefined;
|
|
224
|
-
} | {
|
|
225
|
-
hasContent: boolean;
|
|
226
|
-
value: string | undefined;
|
|
227
227
|
} | {
|
|
228
228
|
hasContent: boolean;
|
|
229
229
|
value: boolean | undefined;
|
package/dist/cli.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
`),a.info(`App ${e} created`)}catch(t){a.error(`Error while creating app: ${t.message}`),T.exit(1)}}function fe(e,t,o,s){try{const n=T.cwd(),i=g.join(n,t);u.existsSync(i)||u.mkdirSync(i);const r=g.join(n,t,o);u.existsSync(r)?(a.error(`${s} with the name: ${o} already exists. If you'd like to override it, delete previous version first`),T.exit(1)):u.mkdirSync(r);const c=k(e);u.readdirSync(c).forEach(async y=>x(r,c,y)),a.info(`${s} ${o} created`)}catch(n){a.error(`Error while creating ${s}: ${n.message}`),T.exit(1)}}function ue(e){const t=T.cwd(),o=k(`template/${e}`),s=g.join(t,e);u.existsSync(s)||(u.mkdirSync(s),u.readdirSync(o).forEach(async n=>x(s,o,n)))}function En(e,t,o){if(!u.existsSync(o)){u.copyFileSync(t,o);return}const s=u.readFileSync(t),n=u.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 Xe(e,t){const o=u.readdirSync(e,{withFileTypes:!0});u.existsSync(t)||u.mkdirSync(t,{recursive:!0}),o.forEach(s=>{const n=g.join(e,s.name),i=g.join(t,s.name);s.isDirectory()?Xe(n,i):En(s,n,i)})}function me(){try{const e=T.cwd(),t=g.join(e,"shared"),o=k("template/shared");if(!u.existsSync(o))return;Xe(o,t)}catch(e){a.error(`Error while processing shared folder: ${e.message}`),T.exit(1)}}async function Tn(e){me(),fe("template/sections/example-section","sections",e,"Section")}async function wn(e){const{targetPath:t,renameFiles:o,sourcePath:s,onTemplateCreated:n}=hn(e);try{const i=T.cwd(),r=P.join(i,"templates"),c=k(s),y=h.readdirSync(c);h.existsSync(r)?h.existsSync(P.join(r,t))&&(a.error(`Template with the name: ${e} already exists. If you'd like to override it, delete previous version first`),T.exit(1)):h.mkdirSync(r),y.forEach(m=>x(r,c,m,o)),ue("headers"),ue("footers"),ue("layouts"),n()}catch(i){a.error(`Error while creating template descriptors: ${i.message}`),T.exit(1)}}async function Sn(){try{const e=T.cwd(),t=k("template/reference"),o=h.readdirSync(t);let s=!1;for(const n of o){const i=P.join(t,n),r=P.join(e,n);h.existsSync(r)||h.mkdirSync(r,{recursive:!0});const c=h.readdirSync(i),y=h.readdirSync(r);if(n==="shared"){c.forEach(m=>{x(r,i,m)});continue}for(const m of c){if(m==="assets"){x(r,i,m);continue}if(y.includes(m)){const{name:E}=await Ce({type:"text",name:"name",message:`The "${m}" already exists in ${n} directory: provide a new name to keep both or press Esc to skip this one.`});E?(x(r,i,m,{[m]:E}),s=!0):a.info(`Skipped: ${m}`)}else x(r,i,m)}}a.info("Reference templates have been added to the app"),s&&a.warn("Some files or folders were renamed to avoid conflicts. Template files may need to be updated to reflect these changes.")}catch(e){a.error(`Error while creating template descriptors: ${e.message}`),T.exit(1)}}var p=(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[e.LayoutClient=8]="LayoutClient",e[e.LayoutAsset=9]="LayoutAsset",e[e.SlotServer=10]="SlotServer",e[e.SlotClient=11]="SlotClient",e[e.SlotClientChunks=12]="SlotClientChunks",e[e.SlotClientAsset=13]="SlotClientAsset",e))(p||{});const jn="https://blockbuster.ecwid.com",On="/api/v1/custom-apps/resources/sections/upload",_n="/api/v1/custom-apps/resources/templates/upload",In="/api/v1/custom-apps/manifests/sections",vn="/api/v1/custom-apps/manifests/templates",Dn=5,Cn=3,An=[p.Server,p.Client,p.ClientChunks,p.ClientAsset,p.Asset],Pn=[p.LayoutClient,p.LayoutAsset],Ln=[p.SlotServer,p.SlotClient,p.SlotClientChunks,p.SlotClientAsset],Nn=[p.Dependency,p.TemplateAsset,p.SourceCode],U={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.`},He={catalog:"products",category:"category",product:"product"},xn=e=>He[e],Ve=e=>e in He;async function F(e){return(await import(Le(e).href)).default}function ye(e){if(e!==void 0)return e.startsWith("global.")?{type:"GLOBAL_FONT",font:e}:{type:"PRESET_FONT",font:e}}function _(e){if(e===void 0)return;if(e.startsWith("global."))return{type:"GLOBAL_COLOR",raw:e};const t=Zs(e);return{type:"STRUCTURED_COLOR",raw:e,hex:t.toHex8String(),hsl:t.toHsl(),rgba:t.toRgb(),auto:!1}}function Ke(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 kn={COLOR:"COLOR",GRADIENT:"GRADIENT"};function Fn(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(kn)}`)}}function Rn(e){const t=e.style,o=e.color,s=Array.isArray(o)?o:[o,o];return e.background={type:Fn(t),solid:{color:_(s.at(0))},gradient:{fromColor:_(s.at(0)),toColor:_(s.at(1))}},e.style=void 0,e.color=void 0,e}const Gn={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"};function Mn(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(Gn)}`)}}const Bn={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"};function qn(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(Bn)}`)}}const Un={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"};function zn(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(Un)}`)}}function Xn(e){const t=e.appearance;t!==void 0&&(e.appearance=Mn(t));const o=e.size;o!==void 0&&(e.size=qn(o));const s=e.shape;s!==void 0&&(e.style=zn(s),e.shape=void 0);const n=e.font;e.font=ye(n);const i=e.color;return e.color=_(i),e}const Hn={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"};function Vn(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(Hn)}`)}}function Kn(e){const t=e.overlay,o=e.color,s=Array.isArray(o)?o:[o,o];return e.overlay={type:Vn(t),solid:{color:_(s.at(0))},gradient:{fromColor:_(s.at(0)),toColor:_(s.at(1))}},e.color=void 0,e}function Yn(e){const t=e.font;e.font=ye(t);const o=e.color;e.color=_(o);const s=e.size;return e.size=Ke(s),e}function Wn(e){const t=e.color;return e.color=_(t),e}function Jn(e){const t=e.font;e.font=ye(t);const o=e.color;e.color=_(o);const s=e.size;if(e.size=Ke(s),e.frame!==void 0){const n=e.frame.color;e.frame.color=_(n)}return e}function ge(e,t){switch(e){case"TEXT":{Yn(t);break}case"BUTTON":{Xn(t);break}case"IMAGE":{Kn(t);break}case"BACKGROUND":{Rn(t);break}case"COLOR_PICKER":{Wn(t);break}case"LOGO":{Jn(t);break}case"TOGGLE":case"DIVIDER":case"SELECTBOX":break;default:throw new Error(`Unknown design editor type: ${e}`)}return t}function Ye(e){Object.keys(e).forEach(t=>{const o=e[t];o.type!=="DIVIDER"&&ge(o.type,o.defaults)})}function Zn(e){e.forEach(t=>{t.type!==void 0&&t.defaults!==void 0&&(ge(t.type,t.defaults),t.defaults.type=t.type)})}function We(e){Object.keys(e).forEach(t=>{const o=e[t],s=o.type;ge(s,o)})}function Qn(e,t){if(!t)return;const o=e[t];return o===void 0?{en:t}:o}function ei(e){const t={};for(const o in e){const s=e[o];for(const n in s){const i=t[n],r=s[n];if(i===void 0){const c={};c[o]=r,t[n]=c}else i[o]=r}}return t}function R(e,t){if(!e||typeof e!="object")return;const o=e;for(const s in o){const n=o[s];typeof n=="string"&&n.startsWith("$")&&!Array.isArray(e)?o[s]=Qn(t,n):typeof n=="object"&&R(n,t)}}async function he(e){const t=f(process.cwd(),e),o=await F(t);return ei(o)}function ti(e){return e.replace(/\\/g,"/")}function oi(e){return e.replace(/^dist\/layouts\//,"").replace(/^layouts\//,"")}function $e(e){return oi(ti(e))}function Je(e){const t=$e(e).split("/");if(t.length<2)throw new Error(`Invalid layout path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/[...path]`);const[o,s]=t;if(!Ve(o))throw new Error(`Layout cannot be placed in a non-storefront section: ${o}`);const n=xn(o);return{id:s,sectionId:o,pageId:n}}async function si(){const e=`${O}/{product,catalog,category}/*`;return(await l(e,{ignore:["node_modules/**"]})).map(Je)}async function ni(e){return he(`${O}/${e.sectionId}/${e.layoutId}/js/settings/translations.mjs`)}async function ii(e){try{const t=f(process.cwd(),`${O}/${e.sectionId}/${e.layoutId}/js/settings/content.mjs`),o=await F(t);return R(o,e.translations),o}catch(t){throw new Error(`Content descriptor for layout [${e.layoutId}] is either invalid or undefined: ${t}`)}}async function ri(e){try{const t=f(process.cwd(),`${O}/${e.sectionId}/${e.layoutId}/js/settings/design.mjs`),o=await F(t);return Ye(o),R(o,e.translations),o}catch(t){throw new Error(`Design descriptor for layout [${e.layoutId}] is either invalid or undefined: ${t}`)}}function z(e,t,...o){if(!e||!t)throw new Error(`Cannot build layout path. Invalid parameters - sectionId: "${e}", layoutId: "${t}"`);return`${O}/${e}/${t}/${o.join("/")}`}var re=(e=>(e.SECTION="SECTION",e.HEADER="HEADER",e.FOOTER="FOOTER",e))(re||{});const b={SECTION:{source:"sections",dist:"dist/sections"},HEADER:{source:"headers",dist:"dist/headers"},FOOTER:{source:"footers",dist:"dist/footers"}};function W(e){return w(`${K}/${e}`)?"HEADER":w(`${Y}/${e}`)?"FOOTER":"SECTION"}function Ze(e){const t=W(e);return b[t].dist}const J=(e="SECTION")=>b[e].dist,X={[p.Server]:{type:"server_js_compressed",fileName:"server.js.gz",isSingleton:!0,toPath:({sectionId:e,sectionType:t})=>`${J(t)}/${e}/js/main/server/`},[p.Client]:{type:"client_js",fileName:"client.js",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${J(t)}/${e}/js/main/client/`},[p.ClientChunks]:{type:"client_js_chunks",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${J(t)}/${e}/js/main/client/chunks/`,fileName:"*"},[p.ClientAsset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${J(t)}/${e}/js/main/client/assets/`},[p.Asset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${J(t)}/${e}/assets/`},[p.TemplateAsset]:{type:"template_assets",fileName:"*",isSingleton:!1,toPath:()=>`${I}/assets/`},[p.Dependency]:{type:"dependencies",fileName:"package.json",isSingleton:!0,toPath:()=>{}},[p.SourceCode]:{type:"source_code",fileName:"source-code.zip",isSingleton:!0,toPath:()=>{}},[p.LayoutClient]:{type:"layout_client_js",fileName:"index.mjs",isSingleton:!0,toPath:({sectionId:e,layoutId:t})=>z(e,t,"")},[p.LayoutAsset]:{type:"layout_assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:t})=>z(e,t,"assets/")},[p.SlotServer]:{type:"slot_server_js",fileName:"server.js.gz",isSingleton:!0,toPath:({sectionId:e,layoutId:t,slotId:o})=>z(e,t,"slots",o,"js/main/server/")},[p.SlotClient]:{type:"slot_client_js",fileName:"client.js",isSingleton:!1,toPath:({sectionId:e,layoutId:t,slotId:o})=>z(e,t,"slots",o,"js/main/client/")},[p.SlotClientChunks]:{type:"slot_client_js_chunks",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:t,slotId:o})=>z(e,t,"slots",o,"js/main/client/chunks/")},[p.SlotClientAsset]:{type:"slot_client_assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:t,slotId:o})=>z(e,t,"slots",o,"js/main/client/assets/")}};var v=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.Misc=2]="Misc",e[e.Layout=3]="Layout",e))(v||{}),d=(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.PageTemplateDescriptor=6]="PageTemplateDescriptor",e[e.TemplateAsset=7]="TemplateAsset",e[e.Layout=8]="Layout",e[e.LayoutSettings=9]="LayoutSettings",e[e.LayoutAsset=10]="LayoutAsset",e[e.SlotServer=11]="SlotServer",e[e.SlotClient=12]="SlotClient",e))(d||{});const Qe={"process.env":{NODE_ENV:"production"}},ai=[...ke,...ke.map(e=>`node:${e}`)],ci=[/@vue\/compiler-dom/,/@vue\/runtime-dom/,/@vue\/server-renderer/,/@vue\/compiler-ssr/,/@vue\/shared/],et=e=>({pluginType:v.Server,define:Qe,ssr:!0,ssrOptions:{noExternal:!0},entryFileNames:"server.js",externalOption:[...ai,...ci],inlineDynamicImports:!0,...e,outDir:e.outDir}),tt=e=>({pluginType:v.Client,define:Qe,ssr:!1,entryFileNames:"client.js",assetFileNames:"assets/[name].[ext]",chunkFileNames:"chunks/[name].js",inlineDynamicImports:!1,...e,outDir:e.outDir}),Z=e=>({pluginType:v.Misc,ssr:!1,...e,entryFileNames:e.entryFileNames,outDir:e.outDir}),li=e=>({pluginType:v.Layout,ssr:!1,entryFileNames:"index.mjs",...e,outDir:e.outDir}),be=e=>({pluginType:v.Misc,ssr:!1,assetFileNames:"[name].[ext]",...e,outDir:e.outDir}),pi=()=>Qs({ext:".gz",algorithm:"gzip",deleteOriginFile:!0}),di="/* EXTERNAL_IMPORTS_START */",fi="/* EXTERNAL_IMPORTS_END */",ui=()=>({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,i=s.code.match(n);if(i!==null){const r=i.join(""),c=di+r+fi,y=s.code.replace(n,"");s.code=c+y}}}}}),mi=()=>{const e=process.env.npm_lifecycle_event;return on({typescript:!0,vueTsc:!1,eslint:e==="test"?!1:{lintCommand:`eslint --max-warnings=0 "./sections/**/*.{js,ts,vue}" --cache --cache-location "./build/eslintcache/${e}.json"`}})},D={VUE:en(),TS_CONFIG_PATHS:tn(),CHECKER:mi()},yi={[v.Server]:[D.VUE,D.TS_CONFIG_PATHS,ui(),pi()],[v.Client]:[D.VUE,D.TS_CONFIG_PATHS,D.CHECKER,Fe({vue:"EcVue"})],[v.Misc]:[D.TS_CONFIG_PATHS,D.CHECKER],[v.Layout]:[D.VUE,D.TS_CONFIG_PATHS,D.CHECKER,Fe({vue:["EcExternals","Vue"]})]},gi={[d.Server]:et({outDir:({name:e,sectionType:t})=>`./${b[t].dist}/${e}/js/main/server`}),[d.Client]:tt({outDir:({name:e,sectionType:t})=>`./${b[t].dist}/${e}/js/main/client`}),[d.SectionSetting]:Z({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:t})=>`./${b[t].dist}/${e}/js/settings`}),[d.SectionShowcase]:Z({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:t})=>`./${b[t].dist}/${e}/js/showcases`}),[d.SectionAsset]:be({outDir:({name:e,sectionType:t})=>`./${b[t].dist}/${e}/assets`}),[d.TemplateDescriptor]:Z({entryFileNames:`[name]${C}.mjs`,outDir:()=>`./${I}/js`}),[d.PageTemplateDescriptor]:Z({entryFileNames:`[name]${C}.mjs`,outDir:({name:e})=>`./${I}/${e}`}),[d.TemplateAsset]:be({outDir:()=>`./${I}/assets`}),[d.Layout]:li({outDir:({name:e,sectionId:t})=>`./${O}/${t}/${e}`}),[d.LayoutSettings]:Z({entryFileNames:"[name].mjs",outDir:({name:e,sectionId:t})=>`./${O}/${t}/${e}/js/settings`}),[d.LayoutAsset]:be({outDir:({name:e,sectionId:t})=>`./${O}/${t}/${e}/assets`}),[d.SlotServer]:et({outDir:({name:e,layoutId:t,sectionId:o})=>`./${O}/${o}/${t}/slots/${e}/js/main/server`}),[d.SlotClient]:tt({outDir:({name:e,layoutId:t,sectionId:o})=>`./${O}/${o}/${t}/slots/${e}/js/main/client`})};function hi(e){switch(typeof e){case"string":return[f(process.cwd(),e)];case"object":return e.map(t=>f(process.cwd(),t));default:return[]}}function ot({name:e,entryPoints:t,configType:o,layoutId:s,sectionId:n,sectionType:i=re.SECTION}){const r=gi[o],c=r.define,y=r.ssrOptions,m=r.entryFileNames,E=r.chunkFileNames,ce=r.assetFileNames,le=r.inlineDynamicImports,Bs=r.externalOption;return{plugins:yi[r.pluginType],ssr:y,define:c,resolve:{alias:{"@":"/src"}},css:{preprocessorOptions:{scss:{api:"modern-compiler"}}},build:{ssr:r.ssr,outDir:r.outDir({name:e,sectionType:i,layoutId:s,sectionId:n}),emptyOutDir:!0,minify:"terser",terserOptions:{compress:{drop_console:!1,pure_getters:!0}},rollupOptions:{external:Bs,preserveEntrySignatures:"strict",input:hi(t),treeshake:{moduleSideEffects:!1},output:{validate:!0,inlineDynamicImports:le,entryFileNames:m,chunkFileNames:E,assetFileNames:ce}}}}}const st="https://json-schema.org/draft/2020-12/schema",nt="https://lightspeedhq.com/template-default.schema.json",it="Default Section",rt="Default section for a Custom Template",at="object",ct={"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}},$i={$schema:st,$id:nt,title:it,description:rt,type:at,$defs:ct},lt={__proto__:null,$defs:ct,$id:nt,$schema:st,default:$i,description:rt,title:it,type:at},pt="https://json-schema.org/draft/2020-12/schema",dt="https://lightspeedhq.com/template-custom.schema.json",ft="Custom Section",ut="Custom section for a Custom Template",mt="object",yt={"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}},bi={$schema:pt,$id:dt,title:ft,description:ut,type:mt,$defs:yt},gt={__proto__:null,$defs:yt,$id:dt,$schema:pt,default:bi,description:ut,title:ft,type:mt},ht="https://json-schema.org/draft/2020-12/schema",$t="https://lightspeedhq.com/template-custom-content.schema.json",bt="Custom Section :: Content Configuration",Et="Content tab configuration of a Custom Section for a Custom Template",Tt="object",wt={input_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"INPUTBOX"},text:{$ref:"common.schema.json#/$defs/label_type"}},required:["type","text"],additionalProperties:!1},text_area:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"TEXTAREA"},text:{$ref:"common.schema.json#/$defs/label_type"}},required:["type","text"],additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"BUTTON"},title:{$ref:"common.schema.json#/$defs/label_type"},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",properties:{MOBILE_WEBP_LOW_RES:{type:"object"},MOBILE_WEBP_HI_RES:{type:"object"},WEBP_LOW_RES:{type:"object"},WEBP_HI_2X_RES:{type:"object"},ORIGINAL:{type:"object"}},additionalProperties:!1,minProperties:1},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",$ref:"common.schema.json#/$defs/label_type"},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"]}},Ei={$schema:ht,$id:$t,title:bt,description:Et,type:Tt,$defs:wt},St={__proto__:null,$defs:wt,$id:$t,$schema:ht,default:Ei,description:Et,title:bt,type:Tt},jt="https://json-schema.org/draft/2020-12/schema",Ot="https://lightspeedhq.com/template-custom-design.schema.json",_t="Custom Section :: Design Configuration",It="Design tab configuration of a Custom Section for a Custom Template",vt="object",Dt={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}},Ti={$schema:jt,$id:Ot,title:_t,description:It,type:vt,$defs:Dt},Ct={__proto__:null,$defs:Dt,$id:Ot,$schema:jt,default:Ti,description:It,title:_t,type:vt},At="https://json-schema.org/draft/2020-12/schema",Pt="https://lightspeedhq.com/section-content.schema.json",Lt="Custom Section - Content",Nt="The content of a custom section",xt="object",kt={"^.*$":{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"}}]}},Ft={Inputbox:{type:"object",properties:{type:{const:"INPUTBOX"},label:{$ref:"../common.schema.json#/$defs/label_type"},placeholder:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/InputboxDefaults"}},required:["type","label","placeholder"]},Textarea:{type:"object",properties:{type:{const:"TEXTAREA"},label:{$ref:"../common.schema.json#/$defs/label_type"},placeholder:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/TextareaDefaults"}},required:["type","label","placeholder"]},Button:{type:"object",properties:{type:{const:"BUTTON"},label:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/ButtonDefaults"}},required:["type","label"]},Image:{type:"object",properties:{type:{const:"IMAGE"},label:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"section-commons.schema.json#/$defs/Image"}},required:["type","label"]},Toggle:{type:"object",properties:{type:{const:"TOGGLE"},label:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/ToggleDefaults"}},required:["type","label","description"]},Selectbox:{type:"object",properties:{type:{const:"SELECTBOX"},label:{$ref:"../common.schema.json#/$defs/label_type"},placeholder:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},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:{$ref:"../common.schema.json#/$defs/label_type"}},required:["type"]},NavigationMenu:{type:"object",properties:{type:{const:"NAVIGATION_MENU"}},required:["type"]},Logo:{type:"object",properties:{type:{const:"LOGO"},label:{$ref:"../common.schema.json#/$defs/label_type"}},required:["type"]},Info:{type:"object",properties:{type:{const:"INFO"},label:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},button:{$ref:"#/$defs/InfoEditorButton"},defaults:{$ref:"#/$defs/InfoDefaults"}},required:["type","label","description"]},Divider:{type:"object",properties:{type:{const:"DIVIDER"},label:{$ref:"../common.schema.json#/$defs/label_type"}},required:["type","label"]},InputboxDefaults:{type:"object",properties:{text:{$ref:"../common.schema.json#/$defs/label_type"}},required:["text"]},TextareaDefaults:{type:"object",properties:{text:{$ref:"../common.schema.json#/$defs/label_type"}},required:["text"]},ButtonDefaults:{type:"object",properties:{title:{$ref:"../common.schema.json#/$defs/label_type"},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:{$ref:"../common.schema.json#/$defs/label_type"},button:{$ref:"#/$defs/InfoButtonDefaults"}}},SelectboxOption:{type:"object",properties:{label:{$ref:"../common.schema.json#/$defs/label_type"},value:{type:"string"}}},InfoEditorButton:{type:"object",properties:{label:{$ref:"../common.schema.json#/$defs/label_type"},link:{type:"string"}}},InfoButtonDefaults:{type:"object",properties:{title:{$ref:"../common.schema.json#/$defs/label_type"},link:{type:"string",minLength:0}}},Deck:{type:"object",properties:{type:{const:"DECK"},cards:{description:"Cards of the content configuration element",type:"object",properties:{defaultCardContent:{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}}}}},label:{$ref:"../common.schema.json#/$defs/label_type"},addButtonLabel:{$ref:"../common.schema.json#/$defs/label_type"},maxCards:{type:"number"}},required:["cards","maxCards","label","addButtonLabel","type"]}},Rt=!1,wi={$schema:At,$id:Pt,title:Lt,description:Nt,type:xt,patternProperties:kt,$defs:Ft,additionalProperties:Rt},Gt={__proto__:null,$defs:Ft,$id:Pt,$schema:At,additionalProperties:Rt,default:wi,description:Nt,patternProperties:kt,title:Lt,type:xt},Mt="https://json-schema.org/draft/2020-12/schema",Bt="https://lightspeedhq.com/sections/section-translation.schema.json",qt="Custom Section - Translations",Ut="The translation of the section's labels",zt="object",Xt={"^[a-z]{2}$":{type:"object",patternProperties:{"^\\$.*$":{type:"string"}},additionalProperties:!1}},Ht=!1,Si={$schema:Mt,$id:Bt,title:qt,description:Ut,type:zt,patternProperties:Xt,additionalProperties:Ht},Vt={__proto__:null,$id:Bt,$schema:Mt,additionalProperties:Ht,default:Si,description:Ut,patternProperties:Xt,title:qt,type:zt},Kt="https://json-schema.org/draft/2020-12/schema",Yt="https://lightspeedhq.com/section-design.schema.json",Wt="Custom Section - Design",Jt="The design of a custom section",Zt="object",Qt={"^.*$":{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_PICKER"}}},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}},eo={Text:{type:"object",properties:{type:{const:"TEXT"},label:{$ref:"../common.schema.json#/$defs/label_type"},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:{$ref:"../common.schema.json#/$defs/label_type"},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:{$ref:"../common.schema.json#/$defs/label_type"},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:{$ref:"../common.schema.json#/$defs/label_type"},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:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/ToggleDesignDefaults"}},required:["type","label"]},Color:{type:"object",properties:{type:{const:"COLOR_PICKER"},label:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},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:{$ref:"../common.schema.json#/$defs/label_type"},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:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SelectboxDefaults"}},required:["type","label"]},SocialProfile:{type:"object",properties:{type:{const:"SOCIAL_PROFILES"},label:{$ref:"../common.schema.json#/$defs/label_type"},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:{$ref:"../common.schema.json#/$defs/label_type"},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:{$ref:"../common.schema.json#/$defs/label_type"}},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:{$ref:"../common.schema.json#/$defs/label_type"}},required:[]}},ji={$schema:Kt,$id:Yt,title:Wt,description:Jt,type:Zt,patternProperties:Qt,$defs:eo},to={__proto__:null,$defs:eo,$id:Yt,$schema:Kt,default:ji,description:Jt,patternProperties:Qt,title:Wt,type:Zt},oo="https://json-schema.org/draft/2020-12/schema",so="https://lightspeedhq.com/section-commons.schema.json",no="Custom Section - Content",io="The content of a custom section",ro="object",ao={Image:{type:"object",properties:{set:{type:"object",properties:{MOBILE_WEBP_LOW_RES:{$ref:"#/$defs/ImageInfo"},MOBILE_WEBP_HI_RES:{$ref:"#/$defs/ImageInfo"},WEBP_LOW_RES:{$ref:"#/$defs/ImageInfo"},WEBP_HI_2X_RES:{$ref:"#/$defs/ImageInfo"},ORIGINAL:{$ref:"#/$defs/ImageInfo"}},additionalProperties:!1,minProperties:1},borderInfo:{$ref:"#/$defs/BorderInfo"}},additionalProperties:!1,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"}}}},co=!1,Oi={$schema:oo,$id:so,title:no,description:io,type:ro,$defs:ao,additionalProperties:co},lo={__proto__:null,$defs:ao,$id:so,$schema:oo,additionalProperties:co,default:Oi,description:io,title:no,type:ro},po="https://json-schema.org/draft/2020-12/schema",fo="https://lightspeedhq.com/section-showcase.schema.json",uo="Custom Section - Showcase settings",mo="The setting of a showcase",yo="object",go=["showcaseId","previewImage"],ho=[{properties:{showcaseId:{description:"Showcase id of the section",type:"string"},previewImage:{$ref:"section-commons.schema.json#/$defs/Image"}}},{$ref:"../showcase_overrides.schema.json"}],_i={$schema:po,$id:fo,title:uo,description:mo,type:yo,required:go,allOf:ho},$o={__proto__:null,$id:fo,$schema:po,allOf:ho,default:_i,description:mo,required:go,title:uo,type:yo},bo="https://json-schema.org/draft/2020-12/schema",Eo="https://lightspeedhq.com/template.schema.json",To="Custom Template",wo="A custom template enclosing the necessary custom and default blocks",So="object",jo={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}},Oo=["metadata","sections"],Ii={$schema:bo,$id:Eo,title:To,description:wo,type:So,properties:jo,required:Oo},_o={__proto__:null,$id:Eo,$schema:bo,default:Ii,description:wo,properties:jo,required:Oo,title:To,type:So},Io="https://json-schema.org/draft/2020-12/schema",vo="https://lightspeedhq.com/showcase_overrides.schema.json",Do="Showcase overrides",Co="Overrides for the showcase",Ao="object",Po={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",$ref:"common.schema.json#/$defs/label_type"}},vi={$schema:Io,$id:vo,title:Do,description:Co,type:Ao,properties:Po},Lo={__proto__:null,$id:vo,$schema:Io,default:vi,description:Co,properties:Po,title:Do,type:Ao},No="https://json-schema.org/draft/2020-12/schema",xo="https://lightspeedhq.com/common.schema.json",ko="Common Type Definitions",Fo="Common type definitions, used throughout other schemas",Ro="object",Go={label_type:{type:"string",pattern:"^\\$.+"}},Di={$schema:No,$id:xo,title:ko,description:Fo,type:Ro,$defs:Go},Mo={__proto__:null,$defs:Go,$id:xo,$schema:No,default:Di,description:Fo,title:ko,type:Ro};var Q=(e=>(e.CONTENT="Content",e.DESIGN="Design",e))(Q||{});const Ci={menu:{type:"NAVIGATION_MENU"},logo:{type:"LOGO"}},Ai={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 Bo(e){switch(e){case re.HEADER:return Ci;default:return{}}}function qo(e){switch(e){case re.HEADER:return Ai;default:return{}}}function Pi({validationType:e,sectionType:t}){switch(e){case Q.CONTENT:return Bo(t);case Q.DESIGN:return qo(t);default:return{}}}function Li({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).filter(([s])=>t[s]!==void 0).forEach(([s,n])=>{const i=t[s];n.type!==i.type&&o.push({instancePath:s,keyword:"type-mismatch",message:`Editor type "${n.type}" for reserved key "${s}" does not match the required type "${i.type}".`})}),o}function Ni({type:e,mandatorySettings:t}){return Object.keys(t).find(o=>t[o].type===e)}function xi({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).forEach(([s,n])=>{const i=Ni({type:n.type,mandatorySettings:t});i&&s!==i&&o.push({instancePath:s,keyword:"key-mismatch",message:`Editor key "${s}" for overriden content type "${n.type}" does not match the required key name "${i}".`})}),o}function ki({type:e,mandatorySettings:t}){return Object.keys(t).findLast(o=>t[o].type===e)}function Fi({sectionSettings:e,mandatorySettings:t}){const o=[],s=Object.values(t).map(({type:i})=>i),n=Object.values(e).map(({type:i})=>i);return new Set(n.filter(i=>s.includes(i))).forEach(i=>{if(n.filter(r=>r===i).length>1){const r=ki({type:i,mandatorySettings:t});o.push({instancePath:r,keyword:"duplicate-type",message:`Editor type "${i}" can only be used once.`})}}),o}function Ri(e,t){const{sectionSettings:o,sectionType:s}=t,n=Pi({validationType:e,sectionType:s});return n===void 0||Ue(n)?[]:[...Li({sectionSettings:o,mandatorySettings:n}),...xi({sectionSettings:o,mandatorySettings:n}),...Fi({sectionSettings:o,mandatorySettings:n})]}const ee=[lo,to,Gt,$o,_o,lt,gt,St,Ct,Lo,Mo];function H(e,t){const o=new sn({allErrors:!0,schemas:e});return nn(o),o.getSchema(t.$id)||o.compile(t)}function Gi(){return H(ee,_o)}function Ee(e){return e.map(t=>({instancePath:t.instancePath,message:t.message??"",keyword:t.keyword}))}const Mi=e=>(()=>{const t=Ze(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:H(ee,Gt),validationType:Q.CONTENT,sectionName:e.name,type:e.type},{source:`./${o}/${e.name}/settings/design.ts`,dist:g.resolve(`${t}/${e.name}/js/settings/design`),ajv:H(ee,to),validationType:Q.DESIGN,sectionName:e.name,type:e.type},{source:`./${o}/${e.name}/settings/translations.ts`,dist:g.resolve(`${t}/${e.name}/js/settings/translations`),ajv:H(ee,Vt),type:e.type},...e.showcaseEntryPoints.map(s=>({source:`./${o}/${e.name}/showcases/${G(s).name}.ts`,dist:g.resolve(`${t}/${e.name}/js/showcases/${G(s).name}`),ajv:H(ee,s.indexOf("translations")===-1?$o:Vt),type:e.type,sectionName:e.name}))]})();function Bi(e){const t=n=>{const i=(n??"").split("/").filter(r=>r.length>0);return i.length===0?"$":`$${i.map(r=>`.${r}`).join("")}`};let o=0,s=0;Object.keys(e).forEach(n=>{const i=e[n];o=Math.max(o,Math.max(...i.map(r=>t(r.instancePath).length))),s=Math.max(s,Math.max(...i.map(r=>r.message.length)))}),Object.keys(e).forEach(n=>{const i=e[n].filter((r,c,y)=>c===y.findIndex(m=>`${r.instancePath}${r.message}${r.keyword}`==`${m.instancePath}${m.message}${m.keyword}`));a.error(n),i.filter(r=>r.keyword!=="if").forEach(r=>{a.error(`${t(r.instancePath).padEnd(o," ")} | ${r.message.padEnd(s," ")} | ${r.keyword||"-"}`)})})}function qi(e,t){if(e.validationType===void 0||e.sectionName===void 0)return[];const{sectionName:o,validationType:s}=e,n=W(o);return[...Ri(s,{sectionSettings:t,sectionType:n})]}function Uo(e,t){return cn({path:"$..set..url",json:t,resultType:"value"}).map(o=>{if(new RegExp(/^https?:\/\//).test(o))return null;const s=`${e}/assets/${o}`;return w(s)?null:{message:`Image ${o} is missing from assets folder`,keyword:"missing-asset"}}).filter(o=>o!==null)}async function Ui(e){const t=await q(e.dist,!1),o={},s=[],n=Ze(e.sectionName??"").split("/").pop()?.toLowerCase();return e.ajv(t)||s.push(...Ee(e.ajv.errors??[])),s.push(...qi(e,t),...Uo(`${n}/${e.sectionName}`,t)),s.length>0&&(o[e.source]=s),o}async function zi(e){const t=an(rn.gunzip),o=await u.promises.readFile(e);return(await t(o)).length}async function zo(e,t){const o=X[e],s=g.resolve(`${o.toPath(t)}${o.fileName}`),n=await zi(s);if(n>Be)throw a.error(`Size of individual server file must not exceed threshold [${V(Be)}]!`),a.error(`${`File: ${s}`.padEnd(s.length+10)}| ${V(n)}`),new Error("Invalid server file size")}function Xo(e){const t=e.reduce((o,s)=>{const n=Hs(s);return n.size>Me&&(o[s]=V(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 [${V(Me)}]!`);for(const s in t)a.error(`${`File: ${s}`.padEnd(o+10)}| ${t[s]}`);throw new Error("Invalid asset file size")}}function Xi(e,t,o,s){const n={};return e(t)&&s===void 0?Ae(`${o}${C}.mjs`,`${o}.mjs`,()=>{}):(Pe(`${o}${C}.mjs`,()=>{}),n[g.resolve(`./templates/${G(o).name}.ts`)]=[...Ee(e.errors??[]),...s??[]]),n}async function Hi(){const e={ignore:["node_modules/**","dist/**"]},t=await l(`./${B}/{product,category,catalog}/*/Main.vue`,e);return await Promise.all(t.map(async o=>{const{id:s,sectionId:n,pageId:i}=Je(o),[r,c]=await Promise.all([l(`./${B}/${n}/${s}/settings/{content,design,translations}.{js,ts}`,e),l(`./${B}/${n}/${s}/assets/*`,e)]);return{name:s,sectionId:n,pageId:i,clientEntrypoint:o,settingsEntryPoints:r,assetsEntrypoints:c}}))}async function Vi(e){Xo(e.assetsEntrypoints),await S({entryPoints:[e.clientEntrypoint],configType:d.Layout,name:e.name,sectionId:e.sectionId}),await Promise.all([S({entryPoints:e.settingsEntryPoints,configType:d.LayoutSettings,name:e.name,sectionId:e.sectionId}),S({entryPoints:e.assetsEntrypoints,configType:d.LayoutAsset,name:e.name,sectionId:e.sectionId})])}async function Ki(e){e===void 0||e.length===0||await Promise.all(e.map(t=>Vi(t)))}async function Yi(e){const t=xe(ot({name:e.name,entryPoints:e.serverEntrypoint,configType:d.Server,sectionType:e.type}));return Xo(e.assetEntryPoints),await de({configFile:!1,...t}),await zo(p.Server,{sectionId:e.name,sectionType:e.type}),await Promise.all([S({entryPoints:e.clientEntrypoint,configType:d.Client,name:e.name,sectionType:e.type}),S({entryPoints:e.settingsEntryPoints,configType:d.SectionSetting,name:e.name,sectionType:e.type}),S({entryPoints:e.showcaseEntryPoints,configType:d.SectionShowcase,name:e.name,sectionType:e.type}),S({entryPoints:e.assetEntryPoints,configType:d.SectionAsset,name:e.name,sectionType:e.type})]),await Mi(e).reduce(async(o,s)=>{const n=await o,i=await Ui(s);return{...n,...i}},Promise.resolve({}))}async function Wi(e){return e.reduce(async(t,o)=>{const s=await t,n=await Yi(o);return{...s,...n}},Promise.resolve({}))}function Ho(e){const t=$e(e).split("/");if(t.length<4||t[2]!=="slots")throw new Error(`Invalid slot path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/slots/{slotId}/[...path]`);const[o,s,,n]=t;if(!Ve(o))throw new Error(`Slot cannot be placed in a non-storefront section: ${o}`);return{id:n,sectionId:o,layoutId:s}}async function Ji(e){const t=await ni(e),[o,s]=await Promise.all([ii({...e,translations:t}),ri({...e,translations:t})]);return{...e,contentEditors:o,designEditors:s}}async function Zi(){const e=`${O}/{product,catalog,category}/*/slots/*`,t=await l(e,{ignore:["node_modules/**"]});return await Promise.all(t.map(Ho).map(Ji))}async function Qi(){const e={ignore:["node_modules/**","dist/**"]},t=await l(`${B}/{product,category,catalog}/*/slots/*/server.ts`,e);return Promise.all(t.map(async o=>{const{id:s,sectionId:n,layoutId:i}=Ho(o),r=(await l(`${B}/${n}/${i}/slots/${s}/client.{js,ts}`,e))[0];if(r===void 0)throw new Error(`Cannot find client entrypoint file for slot ${s} of section ${n}`);return{id:s,sectionId:n,layoutId:i,serverEntrypoint:o,clientEntrypoint:r}}))}async function er(e){const t={name:e.id,layoutId:e.layoutId,sectionId:e.sectionId};await S({entryPoints:[e.serverEntrypoint],configType:d.SlotServer,...t}),await zo(p.SlotServer,{slotId:e.id,layoutId:e.layoutId,sectionId:e.sectionId}),await S({entryPoints:[e.clientEntrypoint],configType:d.SlotClient,...t})}async function tr(e){e===void 0||e.length===0||await e.reduce(async(t,o)=>{await t,await er(o)},Promise.resolve())}const Vo="https://json-schema.org/draft/2020-12/schema",Ko="https://lightspeedhq.com/metadata.schema.json",Yo="Custom Multi Page Template metadata",Wo="Metadata of a multi page template",Jo="object",Zo={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},header:{$ref:"./header_footer.schema.json"},footer:{$ref:"./header_footer.schema.json"}},Qo=["metadata","header","footer"],es=!1,or={$schema:Vo,$id:Ko,title:Yo,description:Wo,type:Jo,properties:Zo,required:Qo,additionalProperties:es},sr={__proto__:null,$id:Ko,$schema:Vo,additionalProperties:es,default:or,description:Wo,properties:Zo,required:Qo,title:Yo,type:Jo},ts="https://json-schema.org/draft/2020-12/schema",os="https://lightspeedhq.com/header_footer.schema.json",ss="Header/Footer definition for a page template",ns="object",is=["type","id"],rs={type:{type:"string",enum:["custom","default"]},id:{type:"string"}},as=!1,cs=[{if:{properties:{type:{const:"default"}}},then:{properties:{id:{enum:["header","footer"]}}}}],nr={$schema:ts,$id:os,title:ss,type:ns,required:is,properties:rs,additionalProperties:as,allOf:cs},ir={__proto__:null,$id:os,$schema:ts,additionalProperties:as,allOf:cs,default:nr,properties:rs,required:is,title:ss,type:ns},ls="https://json-schema.org/draft/2020-12/schema",ps="https://lightspeedhq.com/page.schema.json",ds="Homepage",fs="Homepage enclosing the necessary custom and default blocks",us="object",ms={sections:{description:"List of sections contained by this page",type:"array",items:{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]}},allOf:[{if:{properties:{type:{const:"custom"}}},then:{$ref:"../template-custom.schema.json#/$defs/custom-section"}},{if:{properties:{type:{const:"default"}}},then:{$ref:"../template-default.schema.json#/$defs/default-section"}},{not:{properties:{id:{enum:["header","footer"]}},required:["id"]}}]},minItems:1,uniqueItems:!1}},ys=!1,gs=["sections"],rr={$schema:ls,$id:ps,title:ds,description:fs,type:us,properties:ms,additionalProperties:ys,required:gs},ar={__proto__:null,$id:ps,$schema:ls,additionalProperties:ys,default:rr,description:fs,properties:ms,required:gs,title:ds,type:us},hs="https://json-schema.org/draft/2020-12/schema",$s="https://lightspeedhq.com/page.schema.json",bs="Custom Page",Es="A custom page enclosing the necessary custom and default blocks",Ts="object",ws={sections:{description:"List of sections contained by this page",type:"array",minItems:1,maxItems:1,uniqueItems:!1,contains:{type:"object",properties:{type:{const:"store"}},required:["type"]},items:{type:"object",required:["type"],allOf:[{if:{properties:{type:{const:"store"}}},then:{$ref:"./store-section.schema.json"},else:{properties:{type:{description:"Type of the section",type:"string"},id:{description:"Unique identifier for the section",type:"string"}},required:["type","id"]}}]}}},Ss=!1,js=["sections"],cr={$schema:hs,$id:$s,title:bs,description:Es,type:Ts,properties:ws,additionalProperties:Ss,required:js},Te={__proto__:null,$id:$s,$schema:hs,additionalProperties:Ss,default:cr,description:Es,properties:ws,required:js,title:bs,type:Ts},Os="https://json-schema.org/draft/2020-12/schema",_s="https://lightspeedhq.com/store-section.schema.json",Is="Store Section",vs="Store section for a custom page",Ds="object",Cs=[{type:"object",properties:{type:{description:"Type of the section",type:"string",const:"store"},id:{description:"Layout identifier of the section. When not provided, the section will use the default layout.",type:"string"}},required:["type"],additionalProperties:!1}],lr={$schema:Os,$id:_s,title:Is,description:vs,type:Ds,allOf:Cs},pr={__proto__:null,$id:_s,$schema:Os,allOf:Cs,default:lr,description:vs,title:Is,type:Ds};var A=(e=>(e.PRODUCT="PRODUCT",e.CATALOG="CATALOG",e.CATEGORY="CATEGORY",e.HOME="HOME",e.CUSTOM="CUSTOM",e))(A||{});function dr(e){switch(e){case"PRODUCT":return"product";case"CATALOG":return"catalog";case"CATEGORY":return"category";default:return null}}const fr=[lo,lt,gt,Lo,Ct,St,pr,ir,Mo],ur=e=>{const t=[],o={},s=(n,i,r,c)=>{if(!n){o[e.name]||(o[e.name]=[]),o[e.name].push({instancePath:`/templates/${e.name}/${i}`,message:`Missing file: ${i}`,keyword:"required"});return}t.push({templateName:e.name,source:n,dist:g.resolve(`dist/templates/${e.name}/${i}`),ajv:H(fr,r),templatePageType:c})};return s(e.catalogEntrypoint,"catalog",Te,A.CATALOG),s(e.productEntrypoint,"product",Te,A.PRODUCT),s(e.homeEntrypoint,"home",ar,A.HOME),s(e.categoryEntrypoint,"category",Te,A.CATEGORY),s(e.configurationEntrypoint,"configuration",sr,A.CUSTOM),[t,o]};function mr({section:e,context:t,normalizedPaths:o}){const s=dr(t.templatePageType);if(s===null)return{instancePath:`/sections/${e.id}/id`,message:`Source folder not found for template page type "${t.templatePageType}".`,keyword:"source_folder_not_found"};const n=`${s}/${e.id}`;return o.some(i=>i.startsWith(n))?null:{instancePath:`/sections/${e.id}/id`,message:`Source layout for section "${e.id}" not found in "layouts/${s}/${e.id}".`,keyword:"layout_not_found"}}function yr(e){const{type:t,id:o}=e;return t==="store"&&o!==void 0&&o!==""}async function gr({content:e,context:t,layoutBuildConfigs:o}){const s=o.map(n=>$e(n.clientEntrypoint));return e.sections.filter(yr).map(n=>mr({section:n,context:t,normalizedPaths:s})).filter(n=>n!==null)}function hr(e){return"sections"in e}async function $r(e,t){const o=await q(e.dist,!0),s={},n=[];if(e.ajv(o)?Ae(`${e.dist}${C}.mjs`,`${e.dist}.mjs`,()=>{}):(n.push(...Ee(e.ajv.errors??[])),Pe(`${e.dist}${C}.mjs`,()=>{})),hr(o)&&t!==void 0){const i=await gr({content:o,context:e,layoutBuildConfigs:t});n.push(...i)}return n.length>0&&(s[e.source]=n),s}const br=async(e,t)=>{const[o,s]=ur(e);return(await Promise.all(o.map(n=>$r(n,t)))).reduce((n,i)=>(Object.entries(i).forEach(([r,c])=>{n[r]=n[r]?[...n[r],...c]:[...c]}),n),{...s})};async function Er(e,t,o,s=$){if(t.showcase_overrides?.content!==void 0)if(!w(`${s}/${t.id}/js/settings/content.mjs`))e.push({instancePath:`/sections/${o}/showcase_overrides/content`,message:"Content descriptor is overridden, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const n=await q(`${s}/${t.id}/js/settings/content`,!1),i=new Set(Object.keys(n));Object.keys(t.showcase_overrides.content).every(r=>i.has(r))||e.push({instancePath:`/sections/${o}/showcase_overrides/content`,message:"Content descriptor must be a subset of the default content descriptor",keyword:"type"})}}async function Tr(e,t,o,s=$){if(t.showcase_overrides?.design!==void 0)if(!w(`${s}/${t.id}/js/settings/design.mjs`))e.push({instancePath:`/sections/${o}/showcase_overrides/design`,message:"Design descriptor is overridden, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const n=await q(`${s}/${t.id}/js/settings/design`,!1),i=new Set(Object.keys(n));Object.keys(t.showcase_overrides.design).every(r=>i.has(r))||e.push({instancePath:`/sections/${o}/showcase_overrides/design`,message:"Design descriptor must be a subset of the default design descriptor",keyword:"type"})}}async function wr(e,t,o,s=$){if(t.showcase_overrides?.layoutId!==void 0)if(!w(`${s}/${t.id}/js/settings/layout.mjs`))e.push({instancePath:`/sections/${o}/showcase_overrides/layout`,message:"Layout id descriptor is set, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const n=await q(`${s}/${t.id}/js/settings/layout`,!1);new Set(n.map(i=>i.layoutId)).has(t.showcase_overrides.layoutId)||e.push({instancePath:`/sections/${o}/showcase_overrides/layout`,message:"Layout id descriptor must be a valid id in the default layout descriptor",keyword:"type"})}}async function we(e,t,o,s=$){t.showcase_overrides!==void 0&&(await Er(e,t,o,s),await Tr(e,t,o,s),await wr(e,t,o,s))}function Se(e,t,o,s=$){t.showcase_id!==void 0&&(w(`${s}/${t.id}/js/showcases/${t.showcase_id}.mjs`)||e.push({instancePath:`/sections/${o}/showcase-id`,message:"Custom section must have a corresponding showcase defined in case showcase_id is specified",keyword:"required"}))}async function Sr(e,t){const o=t.id==="header"&&t.type==="default",s=w(`${K}/${t.id}`);!o&&!s&&e.push({instancePath:"/sections/0/id",message:"The first section must be a `header`",keyword:"required"}),s&&(await we(e,t,0,K),Se(e,t,0,K))}async function jr(e,t,o){const s=t.id==="footer"&&t.type==="default",n=w(`${Y}/${t.id}`);!s&&!n&&e.push({instancePath:`/sections/${o}/id`,message:"The last section must be a `footer`",keyword:"required"}),n&&(await we(e,t,o,Y),Se(e,t,o,Y))}async function Or(e,t){t.showcase_overrides&&e.push(...Uo(`sections/${t.id}`,t.showcase_overrides))}async function _r(e){const t=await e.sections.reduce(async(o,s,n)=>{const i=await o;return n===0?await Sr(i,s):n===e.sections.length-1?await jr(i,s,e.sections.length-1):s.type==="custom"?w(`${$}/${s.id}`)?(await we(i,s,n),Se(i,s,n),await Or(i,s)):i.push({instancePath:`/sections/${n}/id`,message:"Custom section must have a corresponding block defined",keyword:"required"}):s.type==="default"&&(s.id==="header"&&i.push({instancePath:`/sections/${n}/id`,message:"Header can only be placed as the first section",keyword:"required"}),s.id==="footer"&&i.push({instancePath:`/sections/${n}/id`,message:"Footer can only be placed as the last section",keyword:"required"})),i},Promise.resolve([]));return t.length>0?t:void 0}async function Ir(){const e=await l("./templates/*",{ignore:["templates/assets/**","templates/**.{js,ts}","node_modules/**","dist/**"]}).catch(t=>(a.error(`Error while getting page template entry points: ${t}`),[]));return Promise.all(e.map(async t=>{const o=t.split(De),s=o.pop()??"default";if(o.pop()===void 0)throw new Error("Cannot determine template with custom pages, outer directory is undefined");const n=await l(`**/${s}/configuration.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),i=await l(`**/${s}/pages/home.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),r=await l(`**/${s}/pages/category.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),c=await l(`**/${s}/pages/catalog.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),y=await l(`**/${s}/pages/product.{js,ts}`,{ignore:["node_modules/**","dist/**"]});return{name:s,configurationEntrypoint:n.at(0),homeEntrypoint:i.at(0),categoryEntrypoint:r.at(0),catalogEntrypoint:c.at(0),productEntrypoint:y.at(0)}}))}async function vr(){const e=await l("./templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]}),t=await l("./templates/assets/*",{ignore:["node_modules/**","dist/**"]});return{pageTemplates:await Ir(),templates:e,assets:t}}async function Dr(e){if(e.templates.length===0&&e.pageTemplates?.length===0)return{};const t=Gi();return await Promise.all([S({entryPoints:e.assets,configType:d.TemplateAsset}),S({entryPoints:e.templates,configType:d.TemplateDescriptor})]),e.templates.reduce(async(o,s)=>{const n=await o,i=`${I}/js/${G(s).name}`,r=await q(i,!0);return{...n,...Xi(t,r,i,await _r(r))}},Promise.resolve({}))}async function Cr({templateBuildConfig:e,layoutBuildConfigs:t}){return e.pageTemplates?.reduce(async(o,s)=>{const n=await o,i=[s.configurationEntrypoint,s.homeEntrypoint,s.categoryEntrypoint,s.catalogEntrypoint,s.productEntrypoint].filter(ie);if(i.length===0)throw new Error("No entry points provided for page template");return await S({entryPoints:i,configType:d.PageTemplateDescriptor,name:s.name}),{...n,...await br(s,t)}},Promise.resolve({}))??{}}async function Ar(e){const t=await vr(),o=await Promise.all([Dr(t),Cr({templateBuildConfig:t,layoutBuildConfigs:e})]);return o.some(s=>!Ue(s))?o.reduce((s,n)=>({...s,...n}),{}):{}}function Pr(e){return{name:e.name,type:e.type,serverEntrypoint:e.serverEntrypoint,clientEntrypoint:[e.clientEntrypoint].filter(ie).flat(),settingsEntryPoints:[e.contentSettingsEntrypoint,e.designSettingsEntrypoint,e.layoutSettingsEntrypoint,e.settingsTranslationsEntrypoint].filter(ie),showcaseEntryPoints:[...e.showcasesEntrypoints??[],e.showcasesTranslationsEntrypoint].filter(ie),assetEntryPoints:e.assetsEntrypoints??[]}}function Lr(e){return Object.entries(b).find(t=>t[1].source===e)?.[0]}async function Nr(){const e=await l("**/server.{js,ts}",{ignore:["node_modules/**","dist/**","templates/**","layouts/**"]});return Promise.all(e.map(async t=>{const o=Us(t).split(De),s=o.pop()??"default",n=o.pop();if(n===void 0)throw new Error("Cannot determine type of section, outer directory is undefined");const i=await l(`**/${s}/client.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),r=await l(`**/${s}/settings/content.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),c=await l(`**/${s}/settings/design.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),y=await l(`**/${s}/settings/layout.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),m=await l(`**/${s}/settings/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),E=await l(`**/${s}/showcases/*.{js,ts}`,{ignore:["node_modules/**","dist/**",`**/${s}/showcases/translations.{js,ts}`]}),ce=await l(`**/${s}/showcases/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),le=await l(`**/${s}/assets/*`,{ignore:["node_modules/**","dist/**"]});return{name:s,type:Lr(n),serverEntrypoint:t,clientEntrypoint:i.at(0),contentSettingsEntrypoint:r.at(0),designSettingsEntrypoint:c.at(0),layoutSettingsEntrypoint:y.at(0),settingsTranslationsEntrypoint:m.at(0),showcasesEntrypoints:E,showcasesTranslationsEntrypoint:ce.at(0),assetsEntrypoints:le}}))}function xr(){return Promise.all([pe.rm("dist",{recursive:!0,force:!0}),pe.rm("source-code",{recursive:!0,force:!0}),pe.rm("source-code.zip",{force:!0})])}async function kr(){const e=new Ws,t=["node_modules/**/*","dist/**/*","build/**/*",".git/**/*","**/assets/**/*","crane.config.json"],o=await l("**/*",{cwd:f(process.cwd()),ignore:t,dot:!0,nodir:!0});try{o.forEach(i=>{const r=f(process.cwd(),i);e.addLocalFile(r,G(i).dir)});const s=X[p.SourceCode].fileName,n=f(process.cwd(),s);await e.writeZipPromise(n)}catch(s){throw a.error("Error while zipping source files"),s}}async function je(e=!1){await xr();try{const[t,o,s]=await Promise.all([Hi(),Nr(),Qi()]),n=o.map(Pr),i={...await Wi(n),...await Ar(t)};Object.keys(i).length===0?(await Promise.all([tr(s),Ki(t),kr()]),a.info(`Build successful:
|
|
1
|
+
import zs from"cac";import*as se from"path";import g,{resolve as d,parse as G,sep as De,dirname as Xs}from"path";import{red as Hs,yellow as Vs,green as M}from"kolorist";import Ce from"prompts";import h from"node:fs";import N from"node:path";import T from"node:process";import*as ne from"fs";import u,{existsSync as w,statSync as Ks,rename as Ae,unlink as Pe,promises as pe,writeFileSync as Ne,readFileSync as Ys,createReadStream as Js}from"fs";import{pathToFileURL as Le}from"url";import{fileURLToPath as Ws}from"node:url";import Zs from"adm-zip";import{glob as l,globSync as xe}from"glob";import{defineConfig as ke,build as de,createServer as Qs}from"vite";import en from"tinycolor2";import{builtinModules as Fe}from"module";import{viteExternalsPlugin as Re}from"vite-plugin-externals";import tn from"vite-plugin-compression";import on from"@vitejs/plugin-vue";import sn from"vite-tsconfig-paths";import nn from"vite-plugin-checker";import rn from"ajv/dist/2020.js";import an from"ajv-formats";import cn from"node:zlib";import{promisify as ln}from"node:util";import{JSONPath as pn}from"jsonpath-plus";import dn,{AxiosError as Ge}from"axios";import{ConcurrencyManager as fn}from"axios-concurrency";import{readFile as Me}from"fs/promises";import*as L from"process";import I from"process";import{inc as un}from"semver";import mn from"cli-progress";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"],i=Math.floor(Math.log(e)/Math.log(o));return`${parseFloat((e/o**i).toFixed(s))} ${n[i]}`}const a={error:e=>console.log(Hs(e)),warn:e=>console.log(Vs(e)),info:e=>console.log(M(e))},A="_temp",$="dist/sections",K="dist/headers",Y="dist/footers",v="dist/templates",B="layouts",Be="preview",O=`dist/${B}`,qe=2*1024*1024,Ue=500*1024;function ie(e){return!!e}function ze(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}const yn="Resource name can only contain alphanumeric characters, dashes, and underscores";function gn(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:yn}}function hn(e){return e===!0?!0:typeof e=="string"&&e.trim().length===0}async function q(e,t){try{const o=d(process.cwd(),t?`${e}${A}.mjs`:`${e}.mjs`),s=`?timestamp=${Date.now()}`;return(await import(Le(o).href+s)).default}catch(o){const s=`File [${e}${t?A:""}.mjs] is either invalid or undefined`,n=o instanceof Error?o.message:s;throw new Error(n)}}function Xe(e){return Object.keys(e).length===0}function $n(e){return g.parse(e).name}function He(e,t){ne.statSync(e).isDirectory()?(ne.mkdirSync(t,{recursive:!0}),ne.readdirSync(e).forEach(o=>{const s=se.resolve(e,o),n=se.resolve(t,o);He(s,n)})):ne.copyFileSync(e,t)}function x(e,t,o,s){const n=se.join(e,s?.[o]??o);He(se.join(t,o),n)}function bn(e){return{renameFiles:{"example-template":`${e}`},targetPath:e,sourcePath:"template/page-templates",onTemplateCreated:()=>a.info(`Template [${e}] with pages structure named has been created`)}}function k(e){return N.resolve(Ws(import.meta.url),"../..",e)}function En(){const e=k("package.json");return e!==""?JSON.parse(h.readFileSync(e,"utf8")):{}}async function Tn(e){try{const t=e,o=T.cwd(),s=N.join(o,t),n=["templates","headers","footers","reference","page-templates","layouts"],i={_gitignore:".gitignore"};h.existsSync(s)?(a.error(`App with the name: ${e} already exists. If you'd like to override it, delete previous version first`),T.exit(1)):h.mkdirSync(s);const r=k("template");h.readdirSync(r).filter(E=>E!=="package.json").filter(E=>!n.includes(E)).forEach(async E=>x(s,r,E,i));const c=JSON.parse(h.readFileSync(N.join(r,"package.json"),"utf-8"));c.name=e;const m=En();m.version&&(c.dependencies["@lightspeed/crane"]=m.version),m.dependencies["@lightspeed/eslint-config-crane"]&&(c.dependencies["@lightspeed/eslint-config-crane"]=m.dependencies["@lightspeed/eslint-config-crane"]);const y=N.join(s,"package.json");h.writeFileSync(y,`${JSON.stringify(c,null,2)}
|
|
2
|
+
`),a.info(`App ${e} created`)}catch(t){a.error(`Error while creating app: ${t.message}`),T.exit(1)}}function fe(e,t,o,s){try{const n=T.cwd(),i=g.join(n,t);u.existsSync(i)||u.mkdirSync(i);const r=g.join(n,t,o);u.existsSync(r)?(a.error(`${s} with the name: ${o} already exists. If you'd like to override it, delete previous version first`),T.exit(1)):u.mkdirSync(r);const c=k(e);u.readdirSync(c).forEach(async m=>x(r,c,m)),a.info(`${s} ${o} created`)}catch(n){a.error(`Error while creating ${s}: ${n.message}`),T.exit(1)}}function ue(e){const t=T.cwd(),o=k(`template/${e}`),s=g.join(t,e);u.existsSync(s)||(u.mkdirSync(s),u.readdirSync(o).forEach(async n=>x(s,o,n)))}function wn(e,t,o){if(!u.existsSync(o)){u.copyFileSync(t,o);return}const s=u.readFileSync(t),n=u.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 Ve(e,t){const o=u.readdirSync(e,{withFileTypes:!0});u.existsSync(t)||u.mkdirSync(t,{recursive:!0}),o.forEach(s=>{const n=g.join(e,s.name),i=g.join(t,s.name);s.isDirectory()?Ve(n,i):wn(s,n,i)})}function me(){try{const e=T.cwd(),t=g.join(e,"shared"),o=k("template/shared");if(!u.existsSync(o))return;Ve(o,t)}catch(e){a.error(`Error while processing shared folder: ${e.message}`),T.exit(1)}}async function Sn(e){me(),fe("template/sections/example-section","sections",e,"Section")}async function jn(e){const{targetPath:t,renameFiles:o,sourcePath:s,onTemplateCreated:n}=bn(e);try{const i=T.cwd(),r=N.join(i,"templates"),c=k(s),m=h.readdirSync(c);h.existsSync(r)?h.existsSync(N.join(r,t))&&(a.error(`Template with the name: ${e} already exists. If you'd like to override it, delete previous version first`),T.exit(1)):h.mkdirSync(r),m.forEach(y=>x(r,c,y,o)),ue("headers"),ue("footers"),ue("layouts"),n()}catch(i){a.error(`Error while creating template descriptors: ${i.message}`),T.exit(1)}}async function On(){try{const e=T.cwd(),t=k("template/reference"),o=h.readdirSync(t);let s=!1;for(const n of o){const i=N.join(t,n),r=N.join(e,n);h.existsSync(r)||h.mkdirSync(r,{recursive:!0});const c=h.readdirSync(i),m=h.readdirSync(r);if(n==="shared"){c.forEach(y=>{x(r,i,y)});continue}for(const y of c){if(y==="assets"){x(r,i,y);continue}if(m.includes(y)){const{name:E}=await Ce({type:"text",name:"name",message:`The "${y}" already exists in ${n} directory: provide a new name to keep both or press Esc to skip this one.`});E?(x(r,i,y,{[y]:E}),s=!0):a.info(`Skipped: ${y}`)}else x(r,i,y)}}a.info("Reference templates have been added to the app"),s&&a.warn("Some files or folders were renamed to avoid conflicts. Template files may need to be updated to reflect these changes.")}catch(e){a.error(`Error while creating template descriptors: ${e.message}`),T.exit(1)}}var p=(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[e.LayoutClient=8]="LayoutClient",e[e.LayoutAsset=9]="LayoutAsset",e[e.SlotServer=10]="SlotServer",e[e.SlotClient=11]="SlotClient",e[e.SlotClientChunks=12]="SlotClientChunks",e[e.SlotClientAsset=13]="SlotClientAsset",e))(p||{});const _n="https://blockbuster.ecwid.com",In="/api/v1/custom-apps/resources/sections/upload",vn="/api/v1/custom-apps/resources/templates/upload",Dn="/api/v1/custom-apps/manifests/sections",Cn="/api/v1/custom-apps/manifests/templates",An=5,Pn=3,Nn=[p.Server,p.Client,p.ClientChunks,p.ClientAsset,p.Asset],Ln=[p.LayoutClient,p.LayoutAsset],xn=[p.SlotServer,p.SlotClient,p.SlotClientChunks,p.SlotClientAsset],kn=[p.Dependency,p.TemplateAsset,p.SourceCode],U={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.`},Ke={catalog:"products",category:"category",product:"product"},Fn=e=>Ke[e],Ye=e=>e in Ke;async function F(e){return(await import(Le(e).href)).default}function ye(e){if(e!==void 0)return e.startsWith("global.")?{type:"GLOBAL_FONT",font:e}:{type:"PRESET_FONT",font:e}}function _(e){if(e===void 0)return;if(e.startsWith("global."))return{type:"GLOBAL_COLOR",raw:e};const t=en(e);return{type:"STRUCTURED_COLOR",raw:e,hex:t.toHex8String(),hsl:t.toHsl(),rgba:t.toRgb(),auto:!1}}function Je(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 Rn={COLOR:"COLOR",GRADIENT:"GRADIENT"};function Gn(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(Rn)}`)}}function Mn(e){const t=e.style,o=e.color,s=Array.isArray(o)?o:[o,o];return e.background={type:Gn(t),solid:{color:_(s.at(0))},gradient:{fromColor:_(s.at(0)),toColor:_(s.at(1))}},e.style=void 0,e.color=void 0,e}const Bn={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"};function qn(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(Bn)}`)}}const Un={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"};function zn(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(Un)}`)}}const Xn={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"};function Hn(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(Xn)}`)}}function Vn(e){const t=e.appearance;t!==void 0&&(e.appearance=qn(t));const o=e.size;o!==void 0&&(e.size=zn(o));const s=e.shape;s!==void 0&&(e.style=Hn(s),e.shape=void 0);const n=e.font;e.font=ye(n);const i=e.color;return e.color=_(i),e}const Kn={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"};function Yn(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(Kn)}`)}}function Jn(e){const t=e.overlay,o=e.color,s=Array.isArray(o)?o:[o,o];return e.overlay={type:Yn(t),solid:{color:_(s.at(0))},gradient:{fromColor:_(s.at(0)),toColor:_(s.at(1))}},e.color=void 0,e}function Wn(e){const t=e.font;e.font=ye(t);const o=e.color;e.color=_(o);const s=e.size;return e.size=Je(s),e}function Zn(e){const t=e.color;return e.color=_(t),e}function Qn(e){const t=e.font;e.font=ye(t);const o=e.color;e.color=_(o);const s=e.size;if(e.size=Je(s),e.frame!==void 0){const n=e.frame.color;e.frame.color=_(n)}return e}function ge(e,t){switch(e){case"TEXT":{Wn(t);break}case"BUTTON":{Vn(t);break}case"IMAGE":{Jn(t);break}case"BACKGROUND":{Mn(t);break}case"COLOR_PICKER":{Zn(t);break}case"LOGO":{Qn(t);break}case"TOGGLE":case"DIVIDER":case"SELECTBOX":break;default:throw new Error(`Unknown design editor type: ${e}`)}return t}function We(e){Object.keys(e).forEach(t=>{const o=e[t];o.type!=="DIVIDER"&&ge(o.type,o.defaults)})}function ei(e){e.forEach(t=>{t.type!==void 0&&t.defaults!==void 0&&(ge(t.type,t.defaults),t.defaults.type=t.type)})}function Ze(e){Object.keys(e).forEach(t=>{const o=e[t],s=o.type;ge(s,o)})}function ti(e,t){if(!t)return;const o=e[t];return o===void 0?{en:t}:o}function oi(e){const t={};for(const o in e){const s=e[o];for(const n in s){const i=t[n],r=s[n];if(i===void 0){const c={};c[o]=r,t[n]=c}else i[o]=r}}return t}function R(e,t){if(!e||typeof e!="object")return;const o=e;for(const s in o){const n=o[s];typeof n=="string"&&n.startsWith("$")&&!Array.isArray(e)?o[s]=ti(t,n):typeof n=="object"&&R(n,t)}}async function he(e){const t=d(process.cwd(),e),o=await F(t);return oi(o)}function si(e){return e.replace(/\\/g,"/")}function ni(e){return e.replace(/^dist\/layouts\//,"").replace(/^layouts\//,"")}function $e(e){return ni(si(e))}function Qe(e){const t=$e(e).split("/");if(t.length<2)throw new Error(`Invalid layout path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/[...path]`);const[o,s]=t;if(!Ye(o))throw new Error(`Layout cannot be placed in a non-storefront section: ${o}`);const n=Fn(o);return{id:s,sectionId:o,pageId:n}}async function ii(){const e=`${O}/{product,catalog,category}/*`;return(await l(e,{ignore:["node_modules/**"]})).map(Qe)}async function ri(e){return he(`${O}/${e.sectionId}/${e.layoutId}/js/settings/translations.mjs`)}async function ai(e){try{const t=d(process.cwd(),`${O}/${e.sectionId}/${e.layoutId}/js/settings/content.mjs`),o=await F(t);return R(o,e.translations),o}catch(t){throw new Error(`Content descriptor for layout [${e.layoutId}] is either invalid or undefined: ${t}`)}}async function ci(e){try{const t=d(process.cwd(),`${O}/${e.sectionId}/${e.layoutId}/js/settings/design.mjs`),o=await F(t);return We(o),R(o,e.translations),o}catch(t){throw new Error(`Design descriptor for layout [${e.layoutId}] is either invalid or undefined: ${t}`)}}function z(e,t,...o){if(!e||!t)throw new Error(`Cannot build layout path. Invalid parameters - sectionId: "${e}", layoutId: "${t}"`);return`${O}/${e}/${t}/${o.join("/")}`}var re=(e=>(e.SECTION="SECTION",e.HEADER="HEADER",e.FOOTER="FOOTER",e))(re||{});const b={SECTION:{source:"sections",dist:"dist/sections"},HEADER:{source:"headers",dist:"dist/headers"},FOOTER:{source:"footers",dist:"dist/footers"}};function J(e){return w(`${K}/${e}`)?"HEADER":w(`${Y}/${e}`)?"FOOTER":"SECTION"}function et(e){const t=J(e);return b[t].dist}const W=(e="SECTION")=>b[e].dist,X={[p.Server]:{type:"server_js_compressed",fileName:"server.js.gz",isSingleton:!0,toPath:({sectionId:e,sectionType:t})=>`${W(t)}/${e}/js/main/server/`},[p.Client]:{type:"client_js",fileName:"client.js",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${W(t)}/${e}/js/main/client/`},[p.ClientChunks]:{type:"client_js_chunks",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${W(t)}/${e}/js/main/client/chunks/`,fileName:"*"},[p.ClientAsset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${W(t)}/${e}/js/main/client/assets/`},[p.Asset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${W(t)}/${e}/assets/`},[p.TemplateAsset]:{type:"template_assets",fileName:"*",isSingleton:!1,toPath:()=>`${v}/assets/`},[p.Dependency]:{type:"dependencies",fileName:"package.json",isSingleton:!0,toPath:()=>{}},[p.SourceCode]:{type:"source_code",fileName:"source-code.zip",isSingleton:!0,toPath:()=>{}},[p.LayoutClient]:{type:"layout_client_js",fileName:"index.mjs",isSingleton:!0,toPath:({sectionId:e,layoutId:t})=>z(e,t,"")},[p.LayoutAsset]:{type:"layout_assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:t})=>z(e,t,"assets/")},[p.SlotServer]:{type:"slot_server_js",fileName:"server.js.gz",isSingleton:!0,toPath:({sectionId:e,layoutId:t,slotId:o})=>z(e,t,"slots",o,"js/main/server/")},[p.SlotClient]:{type:"slot_client_js",fileName:"client.js",isSingleton:!1,toPath:({sectionId:e,layoutId:t,slotId:o})=>z(e,t,"slots",o,"js/main/client/")},[p.SlotClientChunks]:{type:"slot_client_js_chunks",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:t,slotId:o})=>z(e,t,"slots",o,"js/main/client/chunks/")},[p.SlotClientAsset]:{type:"slot_client_assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:t,slotId:o})=>z(e,t,"slots",o,"js/main/client/assets/")}};var D=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.Misc=2]="Misc",e[e.Layout=3]="Layout",e))(D||{}),f=(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.PageTemplateDescriptor=6]="PageTemplateDescriptor",e[e.TemplateAsset=7]="TemplateAsset",e[e.Layout=8]="Layout",e[e.LayoutSettings=9]="LayoutSettings",e[e.LayoutAsset=10]="LayoutAsset",e[e.SlotServer=11]="SlotServer",e[e.SlotClient=12]="SlotClient",e))(f||{});const tt={"process.env":{NODE_ENV:"production"}},li=[...Fe,...Fe.map(e=>`node:${e}`)],pi=[/@vue\/compiler-dom/,/@vue\/runtime-dom/,/@vue\/server-renderer/,/@vue\/compiler-ssr/,/@vue\/shared/],ot=e=>({pluginType:D.Server,define:tt,ssr:!0,ssrOptions:{noExternal:!0},entryFileNames:"server.js",externalOption:[...li,...pi],inlineDynamicImports:!0,...e,outDir:e.outDir}),st=e=>({pluginType:D.Client,define:tt,ssr:!1,entryFileNames:"client.js",assetFileNames:"assets/[name].[ext]",chunkFileNames:"chunks/[name].js",inlineDynamicImports:!1,...e,outDir:e.outDir}),Z=e=>({pluginType:D.Misc,ssr:!1,...e,entryFileNames:e.entryFileNames,outDir:e.outDir}),di=e=>({pluginType:D.Layout,ssr:!1,entryFileNames:"index.mjs",...e,outDir:e.outDir}),be=e=>({pluginType:D.Misc,ssr:!1,assetFileNames:"[name].[ext]",...e,outDir:e.outDir}),fi=()=>tn({ext:".gz",algorithm:"gzip",deleteOriginFile:!0}),ui="/* EXTERNAL_IMPORTS_START */",mi="/* EXTERNAL_IMPORTS_END */",yi=()=>({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,i=s.code.match(n);if(i!==null){const r=i.join(""),c=ui+r+mi,m=s.code.replace(n,"");s.code=c+m}}}}}),gi=()=>{const e=process.env.npm_lifecycle_event;return nn({typescript:!0,vueTsc:!1,eslint:e==="test"?!1:{lintCommand:`eslint --max-warnings=0 "./sections/**/*.{js,ts,vue}" --cache --cache-location "./build/eslintcache/${e}.json"`}})},C={VUE:on(),TS_CONFIG_PATHS:sn(),CHECKER:gi()},hi={[D.Server]:[C.VUE,C.TS_CONFIG_PATHS,yi(),fi()],[D.Client]:[C.VUE,C.TS_CONFIG_PATHS,C.CHECKER,Re({vue:"EcVue"})],[D.Misc]:[C.TS_CONFIG_PATHS,C.CHECKER],[D.Layout]:[C.VUE,C.TS_CONFIG_PATHS,C.CHECKER,Re({vue:["EcExternals","Vue"]})]},$i={[f.Server]:ot({outDir:({name:e,sectionType:t})=>`./${b[t].dist}/${e}/js/main/server`}),[f.Client]:st({outDir:({name:e,sectionType:t})=>`./${b[t].dist}/${e}/js/main/client`}),[f.SectionSetting]:Z({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:t})=>`./${b[t].dist}/${e}/js/settings`}),[f.SectionShowcase]:Z({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:t})=>`./${b[t].dist}/${e}/js/showcases`}),[f.SectionAsset]:be({outDir:({name:e,sectionType:t})=>`./${b[t].dist}/${e}/assets`}),[f.TemplateDescriptor]:Z({entryFileNames:`[name]${A}.mjs`,outDir:()=>`./${v}/js`}),[f.PageTemplateDescriptor]:Z({entryFileNames:`[name]${A}.mjs`,outDir:({name:e})=>`./${v}/${e}`}),[f.TemplateAsset]:be({outDir:()=>`./${v}/assets`}),[f.Layout]:di({outDir:({name:e,sectionId:t})=>`./${O}/${t}/${e}`}),[f.LayoutSettings]:Z({entryFileNames:"[name].mjs",outDir:({name:e,sectionId:t})=>`./${O}/${t}/${e}/js/settings`}),[f.LayoutAsset]:be({outDir:({name:e,sectionId:t})=>`./${O}/${t}/${e}/assets`}),[f.SlotServer]:ot({outDir:({name:e,layoutId:t,sectionId:o})=>`./${O}/${o}/${t}/slots/${e}/js/main/server`}),[f.SlotClient]:st({outDir:({name:e,layoutId:t,sectionId:o})=>`./${O}/${o}/${t}/slots/${e}/js/main/client`})};function bi(e){switch(typeof e){case"string":return[d(process.cwd(),e)];case"object":return e.map(t=>d(process.cwd(),t));default:return[]}}function nt({name:e,entryPoints:t,configType:o,layoutId:s,sectionId:n,sectionType:i=re.SECTION}){const r=$i[o],c=r.define,m=r.ssrOptions,y=r.entryFileNames,E=r.chunkFileNames,ce=r.assetFileNames,le=r.inlineDynamicImports,Us=r.externalOption;return{plugins:hi[r.pluginType],ssr:m,define:c,resolve:{alias:{"@":"/src"}},css:{preprocessorOptions:{scss:{api:"modern-compiler"}}},build:{ssr:r.ssr,outDir:r.outDir({name:e,sectionType:i,layoutId:s,sectionId:n}),emptyOutDir:!0,minify:"terser",terserOptions:{compress:{drop_console:!1,pure_getters:!0}},rollupOptions:{external:Us,preserveEntrySignatures:"strict",input:bi(t),treeshake:{moduleSideEffects:!1},output:{validate:!0,inlineDynamicImports:le,entryFileNames:y,chunkFileNames:E,assetFileNames:ce}}}}}const it="https://json-schema.org/draft/2020-12/schema",rt="https://lightspeedhq.com/template-default.schema.json",at="Default Section",ct="Default section for a Custom Template",lt="object",pt={"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}},Ei={$schema:it,$id:rt,title:at,description:ct,type:lt,$defs:pt},dt={__proto__:null,$defs:pt,$id:rt,$schema:it,default:Ei,description:ct,title:at,type:lt},ft="https://json-schema.org/draft/2020-12/schema",ut="https://lightspeedhq.com/template-custom.schema.json",mt="Custom Section",yt="Custom section for a Custom Template",gt="object",ht={"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}},Ti={$schema:ft,$id:ut,title:mt,description:yt,type:gt,$defs:ht},$t={__proto__:null,$defs:ht,$id:ut,$schema:ft,default:Ti,description:yt,title:mt,type:gt},bt="https://json-schema.org/draft/2020-12/schema",Et="https://lightspeedhq.com/template-custom-content.schema.json",Tt="Custom Section :: Content Configuration",wt="Content tab configuration of a Custom Section for a Custom Template",St="object",jt={input_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"INPUTBOX"},text:{$ref:"common.schema.json#/$defs/label_type"}},required:["type","text"],additionalProperties:!1},text_area:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"TEXTAREA"},text:{$ref:"common.schema.json#/$defs/label_type"}},required:["type","text"],additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"BUTTON"},title:{$ref:"common.schema.json#/$defs/label_type"},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",properties:{MOBILE_WEBP_LOW_RES:{type:"object"},MOBILE_WEBP_HI_RES:{type:"object"},WEBP_LOW_RES:{type:"object"},WEBP_HI_2X_RES:{type:"object"},ORIGINAL:{type:"object"}},additionalProperties:!1,minProperties:1},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",$ref:"common.schema.json#/$defs/label_type"},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"]}},wi={$schema:bt,$id:Et,title:Tt,description:wt,type:St,$defs:jt},Ot={__proto__:null,$defs:jt,$id:Et,$schema:bt,default:wi,description:wt,title:Tt,type:St},_t="https://json-schema.org/draft/2020-12/schema",It="https://lightspeedhq.com/template-custom-design.schema.json",vt="Custom Section :: Design Configuration",Dt="Design tab configuration of a Custom Section for a Custom Template",Ct="object",At={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}},Si={$schema:_t,$id:It,title:vt,description:Dt,type:Ct,$defs:At},Pt={__proto__:null,$defs:At,$id:It,$schema:_t,default:Si,description:Dt,title:vt,type:Ct},Nt="https://json-schema.org/draft/2020-12/schema",Lt="https://lightspeedhq.com/section-content.schema.json",xt="Custom Section - Content",kt="The content of a custom section",Ft="object",Rt={"^.*$":{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"}}]}},Gt={Inputbox:{type:"object",properties:{type:{const:"INPUTBOX"},label:{$ref:"../common.schema.json#/$defs/label_type"},placeholder:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/InputboxDefaults"}},required:["type","label","placeholder"]},Textarea:{type:"object",properties:{type:{const:"TEXTAREA"},label:{$ref:"../common.schema.json#/$defs/label_type"},placeholder:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/TextareaDefaults"}},required:["type","label","placeholder"]},Button:{type:"object",properties:{type:{const:"BUTTON"},label:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/ButtonDefaults"}},required:["type","label"]},Image:{type:"object",properties:{type:{const:"IMAGE"},label:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"section-commons.schema.json#/$defs/Image"}},required:["type","label"]},Toggle:{type:"object",properties:{type:{const:"TOGGLE"},label:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/ToggleDefaults"}},required:["type","label","description"]},Selectbox:{type:"object",properties:{type:{const:"SELECTBOX"},label:{$ref:"../common.schema.json#/$defs/label_type"},placeholder:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},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:{$ref:"../common.schema.json#/$defs/label_type"}},required:["type"]},NavigationMenu:{type:"object",properties:{type:{const:"NAVIGATION_MENU"}},required:["type"]},Logo:{type:"object",properties:{type:{const:"LOGO"},label:{$ref:"../common.schema.json#/$defs/label_type"}},required:["type"]},Info:{type:"object",properties:{type:{const:"INFO"},label:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},button:{$ref:"#/$defs/InfoEditorButton"},defaults:{$ref:"#/$defs/InfoDefaults"}},required:["type","label","description"]},Divider:{type:"object",properties:{type:{const:"DIVIDER"},label:{$ref:"../common.schema.json#/$defs/label_type"}},required:["type","label"]},InputboxDefaults:{type:"object",properties:{text:{$ref:"../common.schema.json#/$defs/label_type"}},required:["text"]},TextareaDefaults:{type:"object",properties:{text:{$ref:"../common.schema.json#/$defs/label_type"}},required:["text"]},ButtonDefaults:{type:"object",properties:{title:{$ref:"../common.schema.json#/$defs/label_type"},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:{$ref:"../common.schema.json#/$defs/label_type"},button:{$ref:"#/$defs/InfoButtonDefaults"}}},SelectboxOption:{type:"object",properties:{label:{$ref:"../common.schema.json#/$defs/label_type"},value:{type:"string"}}},InfoEditorButton:{type:"object",properties:{label:{$ref:"../common.schema.json#/$defs/label_type"},link:{type:"string"}}},InfoButtonDefaults:{type:"object",properties:{title:{$ref:"../common.schema.json#/$defs/label_type"},link:{type:"string",minLength:0}}},Deck:{type:"object",properties:{type:{const:"DECK"},cards:{description:"Cards of the content configuration element",type:"object",properties:{defaultCardContent:{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}}}}},label:{$ref:"../common.schema.json#/$defs/label_type"},addButtonLabel:{$ref:"../common.schema.json#/$defs/label_type"},maxCards:{type:"number"}},required:["cards","maxCards","label","addButtonLabel","type"]}},Mt=!1,ji={$schema:Nt,$id:Lt,title:xt,description:kt,type:Ft,patternProperties:Rt,$defs:Gt,additionalProperties:Mt},Bt={__proto__:null,$defs:Gt,$id:Lt,$schema:Nt,additionalProperties:Mt,default:ji,description:kt,patternProperties:Rt,title:xt,type:Ft},qt="https://json-schema.org/draft/2020-12/schema",Ut="https://lightspeedhq.com/sections/section-translation.schema.json",zt="Custom Section - Translations",Xt="The translation of the section's labels",Ht="object",Vt={"^[a-z]{2}$":{type:"object",patternProperties:{"^\\$.*$":{type:"string"}},additionalProperties:!1}},Kt=!1,Oi={$schema:qt,$id:Ut,title:zt,description:Xt,type:Ht,patternProperties:Vt,additionalProperties:Kt},Yt={__proto__:null,$id:Ut,$schema:qt,additionalProperties:Kt,default:Oi,description:Xt,patternProperties:Vt,title:zt,type:Ht},Jt="https://json-schema.org/draft/2020-12/schema",Wt="https://lightspeedhq.com/section-design.schema.json",Zt="Custom Section - Design",Qt="The design of a custom section",eo="object",to={"^.*$":{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_PICKER"}}},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}},oo={Text:{type:"object",properties:{type:{const:"TEXT"},label:{$ref:"../common.schema.json#/$defs/label_type"},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:{$ref:"../common.schema.json#/$defs/label_type"},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:{$ref:"../common.schema.json#/$defs/label_type"},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:{$ref:"../common.schema.json#/$defs/label_type"},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:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/ToggleDesignDefaults"}},required:["type","label"]},Color:{type:"object",properties:{type:{const:"COLOR_PICKER"},label:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},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:{$ref:"../common.schema.json#/$defs/label_type"},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:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SelectboxDefaults"}},required:["type","label"]},SocialProfile:{type:"object",properties:{type:{const:"SOCIAL_PROFILES"},label:{$ref:"../common.schema.json#/$defs/label_type"},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:{$ref:"../common.schema.json#/$defs/label_type"},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:{$ref:"../common.schema.json#/$defs/label_type"}},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:{$ref:"../common.schema.json#/$defs/label_type"}},required:[]}},_i={$schema:Jt,$id:Wt,title:Zt,description:Qt,type:eo,patternProperties:to,$defs:oo},so={__proto__:null,$defs:oo,$id:Wt,$schema:Jt,default:_i,description:Qt,patternProperties:to,title:Zt,type:eo},no="https://json-schema.org/draft/2020-12/schema",io="https://lightspeedhq.com/section-commons.schema.json",ro="Custom Section - Content",ao="The content of a custom section",co="object",lo={Image:{type:"object",properties:{set:{type:"object",properties:{MOBILE_WEBP_LOW_RES:{$ref:"#/$defs/ImageInfo"},MOBILE_WEBP_HI_RES:{$ref:"#/$defs/ImageInfo"},WEBP_LOW_RES:{$ref:"#/$defs/ImageInfo"},WEBP_HI_2X_RES:{$ref:"#/$defs/ImageInfo"},ORIGINAL:{$ref:"#/$defs/ImageInfo"}},additionalProperties:!1,minProperties:1},borderInfo:{$ref:"#/$defs/BorderInfo"}},additionalProperties:!1,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"}}}},po=!1,Ii={$schema:no,$id:io,title:ro,description:ao,type:co,$defs:lo,additionalProperties:po},fo={__proto__:null,$defs:lo,$id:io,$schema:no,additionalProperties:po,default:Ii,description:ao,title:ro,type:co},uo="https://json-schema.org/draft/2020-12/schema",mo="https://lightspeedhq.com/section-showcase.schema.json",yo="Custom Section - Showcase settings",go="The setting of a showcase",ho="object",$o=["showcaseId","previewImage"],bo=[{properties:{showcaseId:{description:"Showcase id of the section",type:"string"},previewImage:{$ref:"section-commons.schema.json#/$defs/Image"}}},{$ref:"../showcase_overrides.schema.json"}],vi={$schema:uo,$id:mo,title:yo,description:go,type:ho,required:$o,allOf:bo},Eo={__proto__:null,$id:mo,$schema:uo,allOf:bo,default:vi,description:go,required:$o,title:yo,type:ho},To="https://json-schema.org/draft/2020-12/schema",wo="https://lightspeedhq.com/template.schema.json",So="Custom Template",jo="A custom template enclosing the necessary custom and default blocks",Oo="object",_o={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}},Io=["metadata","sections"],Di={$schema:To,$id:wo,title:So,description:jo,type:Oo,properties:_o,required:Io},vo={__proto__:null,$id:wo,$schema:To,default:Di,description:jo,properties:_o,required:Io,title:So,type:Oo},Do="https://json-schema.org/draft/2020-12/schema",Co="https://lightspeedhq.com/showcase_overrides.schema.json",Ao="Showcase overrides",Po="Overrides for the showcase",No="object",Lo={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",$ref:"common.schema.json#/$defs/label_type"}},Ci={$schema:Do,$id:Co,title:Ao,description:Po,type:No,properties:Lo},xo={__proto__:null,$id:Co,$schema:Do,default:Ci,description:Po,properties:Lo,title:Ao,type:No},ko="https://json-schema.org/draft/2020-12/schema",Fo="https://lightspeedhq.com/common.schema.json",Ro="Common Type Definitions",Go="Common type definitions, used throughout other schemas",Mo="object",Bo={label_type:{type:"string",pattern:"^\\$.+"}},Ai={$schema:ko,$id:Fo,title:Ro,description:Go,type:Mo,$defs:Bo},qo={__proto__:null,$defs:Bo,$id:Fo,$schema:ko,default:Ai,description:Go,title:Ro,type:Mo};var Q=(e=>(e.CONTENT="Content",e.DESIGN="Design",e))(Q||{});const Pi={menu:{type:"NAVIGATION_MENU"},logo:{type:"LOGO"}},Ni={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 Uo(e){switch(e){case re.HEADER:return Pi;default:return{}}}function zo(e){switch(e){case re.HEADER:return Ni;default:return{}}}function Li({validationType:e,sectionType:t}){switch(e){case Q.CONTENT:return Uo(t);case Q.DESIGN:return zo(t);default:return{}}}function xi({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).filter(([s])=>t[s]!==void 0).forEach(([s,n])=>{const i=t[s];n.type!==i.type&&o.push({instancePath:s,keyword:"type-mismatch",message:`Editor type "${n.type}" for reserved key "${s}" does not match the required type "${i.type}".`})}),o}function ki({type:e,mandatorySettings:t}){return Object.keys(t).find(o=>t[o].type===e)}function Fi({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).forEach(([s,n])=>{const i=ki({type:n.type,mandatorySettings:t});i&&s!==i&&o.push({instancePath:s,keyword:"key-mismatch",message:`Editor key "${s}" for overriden content type "${n.type}" does not match the required key name "${i}".`})}),o}function Ri({type:e,mandatorySettings:t}){return Object.keys(t).findLast(o=>t[o].type===e)}function Gi({sectionSettings:e,mandatorySettings:t}){const o=[],s=Object.values(t).map(({type:i})=>i),n=Object.values(e).map(({type:i})=>i);return new Set(n.filter(i=>s.includes(i))).forEach(i=>{if(n.filter(r=>r===i).length>1){const r=Ri({type:i,mandatorySettings:t});o.push({instancePath:r,keyword:"duplicate-type",message:`Editor type "${i}" can only be used once.`})}}),o}function Mi(e,t){const{sectionSettings:o,sectionType:s}=t,n=Li({validationType:e,sectionType:s});return n===void 0||Xe(n)?[]:[...xi({sectionSettings:o,mandatorySettings:n}),...Fi({sectionSettings:o,mandatorySettings:n}),...Gi({sectionSettings:o,mandatorySettings:n})]}const ee=[fo,so,Bt,Eo,vo,dt,$t,Ot,Pt,xo,qo];function H(e,t){const o=new rn({allErrors:!0,schemas:e});return an(o),o.getSchema(t.$id)||o.compile(t)}function Bi(){return H(ee,vo)}function Ee(e){return e.map(t=>({instancePath:t.instancePath,message:t.message??"",keyword:t.keyword}))}const qi=e=>(()=>{const t=et(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:H(ee,Bt),validationType:Q.CONTENT,sectionName:e.name,type:e.type},{source:`./${o}/${e.name}/settings/design.ts`,dist:g.resolve(`${t}/${e.name}/js/settings/design`),ajv:H(ee,so),validationType:Q.DESIGN,sectionName:e.name,type:e.type},{source:`./${o}/${e.name}/settings/translations.ts`,dist:g.resolve(`${t}/${e.name}/js/settings/translations`),ajv:H(ee,Yt),type:e.type},...e.showcaseEntryPoints.map(s=>({source:`./${o}/${e.name}/showcases/${G(s).name}.ts`,dist:g.resolve(`${t}/${e.name}/js/showcases/${G(s).name}`),ajv:H(ee,s.indexOf("translations")===-1?Eo:Yt),type:e.type,sectionName:e.name}))]})();function Ui(e){const t=n=>{const i=(n??"").split("/").filter(r=>r.length>0);return i.length===0?"$":`$${i.map(r=>`.${r}`).join("")}`};let o=0,s=0;Object.keys(e).forEach(n=>{const i=e[n];o=Math.max(o,Math.max(...i.map(r=>t(r.instancePath).length))),s=Math.max(s,Math.max(...i.map(r=>r.message.length)))}),Object.keys(e).forEach(n=>{const i=e[n].filter((r,c,m)=>c===m.findIndex(y=>`${r.instancePath}${r.message}${r.keyword}`==`${y.instancePath}${y.message}${y.keyword}`));a.error(n),i.filter(r=>r.keyword!=="if").forEach(r=>{a.error(`${t(r.instancePath).padEnd(o," ")} | ${r.message.padEnd(s," ")} | ${r.keyword||"-"}`)})})}function zi(e,t){if(e.validationType===void 0||e.sectionName===void 0)return[];const{sectionName:o,validationType:s}=e,n=J(o);return[...Mi(s,{sectionSettings:t,sectionType:n})]}function Xo(e,t){return pn({path:"$..set..url",json:t,resultType:"value"}).map(o=>{if(new RegExp(/^https?:\/\//).test(o))return null;const s=`${e}/assets/${o}`;return w(s)?null:{message:`Image ${o} is missing from assets folder`,keyword:"missing-asset"}}).filter(o=>o!==null)}async function Xi(e){const t=await q(e.dist,!1),o={},s=[],n=et(e.sectionName??"").split("/").pop()?.toLowerCase();return e.ajv(t)||s.push(...Ee(e.ajv.errors??[])),s.push(...zi(e,t),...Xo(`${n}/${e.sectionName}`,t)),s.length>0&&(o[e.source]=s),o}async function Hi(e){const t=ln(cn.gunzip),o=await u.promises.readFile(e);return(await t(o)).length}async function Ho(e,t){const o=X[e],s=g.resolve(`${o.toPath(t)}${o.fileName}`),n=await Hi(s);if(n>Ue)throw a.error(`Size of individual server file must not exceed threshold [${V(Ue)}]!`),a.error(`${`File: ${s}`.padEnd(s.length+10)}| ${V(n)}`),new Error("Invalid server file size")}function Vo(e){const t=e.reduce((o,s)=>{const n=Ks(s);return n.size>qe&&(o[s]=V(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 [${V(qe)}]!`);for(const s in t)a.error(`${`File: ${s}`.padEnd(o+10)}| ${t[s]}`);throw new Error("Invalid asset file size")}}function Vi(e,t,o,s){const n={};return e(t)&&s===void 0?Ae(`${o}${A}.mjs`,`${o}.mjs`,()=>{}):(Pe(`${o}${A}.mjs`,()=>{}),n[g.resolve(`./templates/${G(o).name}.ts`)]=[...Ee(e.errors??[]),...s??[]]),n}async function Ki(){const e={ignore:["node_modules/**","dist/**"]},t=await l(`./${B}/{product,category,catalog}/*/Main.vue`,e);return await Promise.all(t.map(async o=>{const{id:s,sectionId:n,pageId:i}=Qe(o),[r,c]=await Promise.all([l(`./${B}/${n}/${s}/settings/{content,design,translations}.{js,ts}`,e),l(`./${B}/${n}/${s}/assets/*`,e)]);return{name:s,sectionId:n,pageId:i,clientEntrypoint:o,settingsEntryPoints:r,assetsEntrypoints:c}}))}async function Yi(e){Vo(e.assetsEntrypoints),await S({entryPoints:[e.clientEntrypoint],configType:f.Layout,name:e.name,sectionId:e.sectionId}),await Promise.all([S({entryPoints:e.settingsEntryPoints,configType:f.LayoutSettings,name:e.name,sectionId:e.sectionId}),S({entryPoints:e.assetsEntrypoints,configType:f.LayoutAsset,name:e.name,sectionId:e.sectionId})])}async function Ji(e){e===void 0||e.length===0||await Promise.all(e.map(t=>Yi(t)))}async function Wi(e){const t=ke(nt({name:e.name,entryPoints:e.serverEntrypoint,configType:f.Server,sectionType:e.type}));return Vo(e.assetEntryPoints),await de({configFile:!1,...t}),await Ho(p.Server,{sectionId:e.name,sectionType:e.type}),await Promise.all([S({entryPoints:e.clientEntrypoint,configType:f.Client,name:e.name,sectionType:e.type}),S({entryPoints:e.settingsEntryPoints,configType:f.SectionSetting,name:e.name,sectionType:e.type}),S({entryPoints:e.showcaseEntryPoints,configType:f.SectionShowcase,name:e.name,sectionType:e.type}),S({entryPoints:e.assetEntryPoints,configType:f.SectionAsset,name:e.name,sectionType:e.type})]),await qi(e).reduce(async(o,s)=>{const n=await o,i=await Xi(s);return{...n,...i}},Promise.resolve({}))}async function Zi(e){return e.reduce(async(t,o)=>{const s=await t,n=await Wi(o);return{...s,...n}},Promise.resolve({}))}function Ko(e){const t=$e(e).split("/");if(t.length<4||t[2]!=="slots")throw new Error(`Invalid slot path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/slots/{slotId}/[...path]`);const[o,s,,n]=t;if(!Ye(o))throw new Error(`Slot cannot be placed in a non-storefront section: ${o}`);return{id:n,sectionId:o,layoutId:s}}async function Qi(e){const t=await ri(e),[o,s]=await Promise.all([ai({...e,translations:t}),ci({...e,translations:t})]);return{...e,contentEditors:o,designEditors:s}}async function er(){const e=`${O}/{product,catalog,category}/*/slots/*`,t=await l(e,{ignore:["node_modules/**"]});return await Promise.all(t.map(Ko).map(Qi))}async function tr(){const e={ignore:["node_modules/**","dist/**"]},t=await l(`${B}/{product,category,catalog}/*/slots/*/server.ts`,e);return Promise.all(t.map(async o=>{const{id:s,sectionId:n,layoutId:i}=Ko(o),r=(await l(`${B}/${n}/${i}/slots/${s}/client.{js,ts}`,e))[0];if(r===void 0)throw new Error(`Cannot find client entrypoint file for slot ${s} of section ${n}`);return{id:s,sectionId:n,layoutId:i,serverEntrypoint:o,clientEntrypoint:r}}))}async function or(e){const t={name:e.id,layoutId:e.layoutId,sectionId:e.sectionId};await S({entryPoints:[e.serverEntrypoint],configType:f.SlotServer,...t}),await Ho(p.SlotServer,{slotId:e.id,layoutId:e.layoutId,sectionId:e.sectionId}),await S({entryPoints:[e.clientEntrypoint],configType:f.SlotClient,...t})}async function sr(e){e===void 0||e.length===0||await e.reduce(async(t,o)=>{await t,await or(o)},Promise.resolve())}const Yo="https://json-schema.org/draft/2020-12/schema",Jo="https://lightspeedhq.com/metadata.schema.json",Wo="Custom Multi Page Template metadata",Zo="Metadata of a multi page template",Qo="object",es={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},header:{$ref:"./header_footer.schema.json"},footer:{$ref:"./header_footer.schema.json"}},ts=["metadata","header","footer"],os=!1,nr={$schema:Yo,$id:Jo,title:Wo,description:Zo,type:Qo,properties:es,required:ts,additionalProperties:os},ir={__proto__:null,$id:Jo,$schema:Yo,additionalProperties:os,default:nr,description:Zo,properties:es,required:ts,title:Wo,type:Qo},ss="https://json-schema.org/draft/2020-12/schema",ns="https://lightspeedhq.com/header_footer.schema.json",is="Header/Footer definition for a page template",rs="object",as=["type","id"],cs={type:{type:"string",enum:["custom","default"]},id:{type:"string"}},ls=!1,ps=[{if:{properties:{type:{const:"default"}}},then:{properties:{id:{enum:["header","footer"]}}}}],rr={$schema:ss,$id:ns,title:is,type:rs,required:as,properties:cs,additionalProperties:ls,allOf:ps},ar={__proto__:null,$id:ns,$schema:ss,additionalProperties:ls,allOf:ps,default:rr,properties:cs,required:as,title:is,type:rs},ds="https://json-schema.org/draft/2020-12/schema",fs="https://lightspeedhq.com/page.schema.json",us="Homepage",ms="Homepage enclosing the necessary custom and default blocks",ys="object",gs={sections:{description:"List of sections contained by this page",type:"array",items:{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]}},allOf:[{if:{properties:{type:{const:"custom"}}},then:{$ref:"../template-custom.schema.json#/$defs/custom-section"}},{if:{properties:{type:{const:"default"}}},then:{$ref:"../template-default.schema.json#/$defs/default-section"}},{not:{properties:{id:{enum:["header","footer"]}},required:["id"]}}]},minItems:1,uniqueItems:!1}},hs=!1,$s=["sections"],cr={$schema:ds,$id:fs,title:us,description:ms,type:ys,properties:gs,additionalProperties:hs,required:$s},lr={__proto__:null,$id:fs,$schema:ds,additionalProperties:hs,default:cr,description:ms,properties:gs,required:$s,title:us,type:ys},bs="https://json-schema.org/draft/2020-12/schema",Es="https://lightspeedhq.com/page.schema.json",Ts="Custom Page",ws="A custom page enclosing the necessary custom and default blocks",Ss="object",js={sections:{description:"List of sections contained by this page",type:"array",minItems:1,maxItems:1,uniqueItems:!1,contains:{type:"object",properties:{type:{const:"store"}},required:["type"]},items:{type:"object",required:["type"],allOf:[{if:{properties:{type:{const:"store"}}},then:{$ref:"./store-section.schema.json"},else:{properties:{type:{description:"Type of the section",type:"string"},id:{description:"Unique identifier for the section",type:"string"}},required:["type","id"]}}]}}},Os=!1,_s=["sections"],pr={$schema:bs,$id:Es,title:Ts,description:ws,type:Ss,properties:js,additionalProperties:Os,required:_s},Te={__proto__:null,$id:Es,$schema:bs,additionalProperties:Os,default:pr,description:ws,properties:js,required:_s,title:Ts,type:Ss},Is="https://json-schema.org/draft/2020-12/schema",vs="https://lightspeedhq.com/store-section.schema.json",Ds="Store Section",Cs="Store section for a custom page",As="object",Ps=[{type:"object",properties:{type:{description:"Type of the section",type:"string",const:"store"},id:{description:"Layout identifier of the section. When not provided, the section will use the default layout.",type:"string"}},required:["type"],additionalProperties:!1}],dr={$schema:Is,$id:vs,title:Ds,description:Cs,type:As,allOf:Ps},fr={__proto__:null,$id:vs,$schema:Is,allOf:Ps,default:dr,description:Cs,title:Ds,type:As};var P=(e=>(e.PRODUCT="PRODUCT",e.CATALOG="CATALOG",e.CATEGORY="CATEGORY",e.HOME="HOME",e.CUSTOM="CUSTOM",e))(P||{});function ur(e){switch(e){case"PRODUCT":return"product";case"CATALOG":return"catalog";case"CATEGORY":return"category";default:return null}}const mr=[fo,dt,$t,xo,Pt,Ot,fr,ar,qo],yr=e=>{const t=[],o={},s=(n,i,r,c)=>{if(!n){o[e.name]||(o[e.name]=[]),o[e.name].push({instancePath:`/templates/${e.name}/${i}`,message:`Missing file: ${i}`,keyword:"required"});return}t.push({templateName:e.name,source:n,dist:g.resolve(`dist/templates/${e.name}/${i}`),ajv:H(mr,r),templatePageType:c})};return s(e.catalogEntrypoint,"catalog",Te,P.CATALOG),s(e.productEntrypoint,"product",Te,P.PRODUCT),s(e.homeEntrypoint,"home",lr,P.HOME),s(e.categoryEntrypoint,"category",Te,P.CATEGORY),s(e.configurationEntrypoint,"configuration",ir,P.CUSTOM),[t,o]};function gr({section:e,context:t,normalizedPaths:o}){const s=ur(t.templatePageType);if(s===null)return{instancePath:`/sections/${e.id}/id`,message:`Source folder not found for template page type "${t.templatePageType}".`,keyword:"source_folder_not_found"};const n=`${s}/${e.id}`;return o.some(i=>i.startsWith(n))?null:{instancePath:`/sections/${e.id}/id`,message:`Source layout for section "${e.id}" not found in "layouts/${s}/${e.id}".`,keyword:"layout_not_found"}}function hr(e){const{type:t,id:o}=e;return t==="store"&&o!==void 0&&o!==""}async function $r({content:e,context:t,layoutBuildConfigs:o}){const s=o.map(n=>$e(n.clientEntrypoint));return e.sections.filter(hr).map(n=>gr({section:n,context:t,normalizedPaths:s})).filter(n=>n!==null)}function br(e){return"sections"in e}async function Er(e,t){const o=await q(e.dist,!0),s={},n=[];if(e.ajv(o)?Ae(`${e.dist}${A}.mjs`,`${e.dist}.mjs`,()=>{}):(n.push(...Ee(e.ajv.errors??[])),Pe(`${e.dist}${A}.mjs`,()=>{})),br(o)&&t!==void 0){const i=await $r({content:o,context:e,layoutBuildConfigs:t});n.push(...i)}return n.length>0&&(s[e.source]=n),s}const Tr=async(e,t)=>{const[o,s]=yr(e);return(await Promise.all(o.map(n=>Er(n,t)))).reduce((n,i)=>(Object.entries(i).forEach(([r,c])=>{n[r]=n[r]?[...n[r],...c]:[...c]}),n),{...s})};async function wr(e,t,o,s=$){if(t.showcase_overrides?.content!==void 0)if(!w(`${s}/${t.id}/js/settings/content.mjs`))e.push({instancePath:`/sections/${o}/showcase_overrides/content`,message:"Content descriptor is overridden, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const n=await q(`${s}/${t.id}/js/settings/content`,!1),i=new Set(Object.keys(n));Object.keys(t.showcase_overrides.content).every(r=>i.has(r))||e.push({instancePath:`/sections/${o}/showcase_overrides/content`,message:"Content descriptor must be a subset of the default content descriptor",keyword:"type"})}}async function Sr(e,t,o,s=$){if(t.showcase_overrides?.design!==void 0)if(!w(`${s}/${t.id}/js/settings/design.mjs`))e.push({instancePath:`/sections/${o}/showcase_overrides/design`,message:"Design descriptor is overridden, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const n=await q(`${s}/${t.id}/js/settings/design`,!1),i=new Set(Object.keys(n));Object.keys(t.showcase_overrides.design).every(r=>i.has(r))||e.push({instancePath:`/sections/${o}/showcase_overrides/design`,message:"Design descriptor must be a subset of the default design descriptor",keyword:"type"})}}async function jr(e,t,o,s=$){if(t.showcase_overrides?.layoutId!==void 0)if(!w(`${s}/${t.id}/js/settings/layout.mjs`))e.push({instancePath:`/sections/${o}/showcase_overrides/layout`,message:"Layout id descriptor is set, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const n=await q(`${s}/${t.id}/js/settings/layout`,!1);new Set(n.map(i=>i.layoutId)).has(t.showcase_overrides.layoutId)||e.push({instancePath:`/sections/${o}/showcase_overrides/layout`,message:"Layout id descriptor must be a valid id in the default layout descriptor",keyword:"type"})}}async function we(e,t,o,s=$){t.showcase_overrides!==void 0&&(await wr(e,t,o,s),await Sr(e,t,o,s),await jr(e,t,o,s))}function Se(e,t,o,s=$){t.showcase_id!==void 0&&(w(`${s}/${t.id}/js/showcases/${t.showcase_id}.mjs`)||e.push({instancePath:`/sections/${o}/showcase-id`,message:"Custom section must have a corresponding showcase defined in case showcase_id is specified",keyword:"required"}))}async function Or(e,t){const o=t.id==="header"&&t.type==="default",s=w(`${K}/${t.id}`);!o&&!s&&e.push({instancePath:"/sections/0/id",message:"The first section must be a `header`",keyword:"required"}),s&&(await we(e,t,0,K),Se(e,t,0,K))}async function _r(e,t,o){const s=t.id==="footer"&&t.type==="default",n=w(`${Y}/${t.id}`);!s&&!n&&e.push({instancePath:`/sections/${o}/id`,message:"The last section must be a `footer`",keyword:"required"}),n&&(await we(e,t,o,Y),Se(e,t,o,Y))}async function Ir(e,t){t.showcase_overrides&&e.push(...Xo(`sections/${t.id}`,t.showcase_overrides))}async function vr(e){const t=await e.sections.reduce(async(o,s,n)=>{const i=await o;return n===0?await Or(i,s):n===e.sections.length-1?await _r(i,s,e.sections.length-1):s.type==="custom"?w(`${$}/${s.id}`)?(await we(i,s,n),Se(i,s,n),await Ir(i,s)):i.push({instancePath:`/sections/${n}/id`,message:"Custom section must have a corresponding block defined",keyword:"required"}):s.type==="default"&&(s.id==="header"&&i.push({instancePath:`/sections/${n}/id`,message:"Header can only be placed as the first section",keyword:"required"}),s.id==="footer"&&i.push({instancePath:`/sections/${n}/id`,message:"Footer can only be placed as the last section",keyword:"required"})),i},Promise.resolve([]));return t.length>0?t:void 0}async function Dr(){const e=await l("./templates/*",{ignore:["templates/assets/**","templates/**.{js,ts}","node_modules/**","dist/**"]}).catch(t=>(a.error(`Error while getting page template entry points: ${t}`),[]));return Promise.all(e.map(async t=>{const o=t.split(De),s=o.pop()??"default";if(o.pop()===void 0)throw new Error("Cannot determine template with custom pages, outer directory is undefined");const n=await l(`**/${s}/configuration.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),i=await l(`**/${s}/pages/home.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),r=await l(`**/${s}/pages/category.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),c=await l(`**/${s}/pages/catalog.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),m=await l(`**/${s}/pages/product.{js,ts}`,{ignore:["node_modules/**","dist/**"]});return{name:s,configurationEntrypoint:n.at(0),homeEntrypoint:i.at(0),categoryEntrypoint:r.at(0),catalogEntrypoint:c.at(0),productEntrypoint:m.at(0)}}))}async function Cr(){const e=await l("./templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]}),t=await l("./templates/assets/*",{ignore:["node_modules/**","dist/**"]});return{pageTemplates:await Dr(),templates:e,assets:t}}async function Ar(e){if(e.templates.length===0&&e.pageTemplates?.length===0)return{};const t=Bi();return await Promise.all([S({entryPoints:e.assets,configType:f.TemplateAsset}),S({entryPoints:e.templates,configType:f.TemplateDescriptor})]),e.templates.reduce(async(o,s)=>{const n=await o,i=`${v}/js/${G(s).name}`,r=await q(i,!0);return{...n,...Vi(t,r,i,await vr(r))}},Promise.resolve({}))}async function Pr({templateBuildConfig:e,layoutBuildConfigs:t}){return e.pageTemplates?.reduce(async(o,s)=>{const n=await o,i=[s.configurationEntrypoint,s.homeEntrypoint,s.categoryEntrypoint,s.catalogEntrypoint,s.productEntrypoint].filter(ie);if(i.length===0)throw new Error("No entry points provided for page template");return await S({entryPoints:i,configType:f.PageTemplateDescriptor,name:s.name}),{...n,...await Tr(s,t)}},Promise.resolve({}))??{}}async function Nr(e){const t=await Cr(),o=await Promise.all([Ar(t),Pr({templateBuildConfig:t,layoutBuildConfigs:e})]);return o.some(s=>!Xe(s))?o.reduce((s,n)=>({...s,...n}),{}):{}}function Lr(e){return{name:e.name,type:e.type,serverEntrypoint:e.serverEntrypoint,clientEntrypoint:[e.clientEntrypoint].filter(ie).flat(),settingsEntryPoints:[e.contentSettingsEntrypoint,e.designSettingsEntrypoint,e.layoutSettingsEntrypoint,e.settingsTranslationsEntrypoint].filter(ie),showcaseEntryPoints:[...e.showcasesEntrypoints??[],e.showcasesTranslationsEntrypoint].filter(ie),assetEntryPoints:e.assetsEntrypoints??[]}}function xr(e){return Object.entries(b).find(t=>t[1].source===e)?.[0]}async function kr(){const e=await l("**/server.{js,ts}",{ignore:["node_modules/**","dist/**","templates/**","layouts/**"]});return Promise.all(e.map(async t=>{const o=Xs(t).split(De),s=o.pop()??"default",n=o.pop();if(n===void 0)throw new Error("Cannot determine type of section, outer directory is undefined");const i=await l(`**/${s}/client.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),r=await l(`**/${s}/settings/content.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),c=await l(`**/${s}/settings/design.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),m=await l(`**/${s}/settings/layout.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),y=await l(`**/${s}/settings/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),E=await l(`**/${s}/showcases/*.{js,ts}`,{ignore:["node_modules/**","dist/**",`**/${s}/showcases/translations.{js,ts}`]}),ce=await l(`**/${s}/showcases/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),le=await l(`**/${s}/assets/*`,{ignore:["node_modules/**","dist/**"]});return{name:s,type:xr(n),serverEntrypoint:t,clientEntrypoint:i.at(0),contentSettingsEntrypoint:r.at(0),designSettingsEntrypoint:c.at(0),layoutSettingsEntrypoint:m.at(0),settingsTranslationsEntrypoint:y.at(0),showcasesEntrypoints:E,showcasesTranslationsEntrypoint:ce.at(0),assetsEntrypoints:le}}))}function Fr(){return Promise.all([pe.rm("dist",{recursive:!0,force:!0}),pe.rm("source-code",{recursive:!0,force:!0}),pe.rm("source-code.zip",{force:!0})])}async function Rr(){const e=new Zs,t=["node_modules/**/*","dist/**/*","build/**/*",".git/**/*","**/assets/**/*","crane.config.json"],o=await l("**/*",{cwd:d(process.cwd()),ignore:t,dot:!0,nodir:!0});try{o.forEach(i=>{const r=d(process.cwd(),i);e.addLocalFile(r,G(i).dir)});const s=X[p.SourceCode].fileName,n=d(process.cwd(),s);await e.writeZipPromise(n)}catch(s){throw a.error("Error while zipping source files"),s}}async function je(e=!1){await Fr();try{const[t,o,s]=await Promise.all([Ki(),kr(),tr()]),n=o.map(Lr),i={...await Zi(n),...await Nr(t)};Object.keys(i).length===0?(await Promise.all([sr(s),Ji(t),Rr()]),a.info(`Build successful:
|
|
3
3
|
For preview run: npx @lightspeed/crane@latest preview
|
|
4
|
-
For deploy run: npx @lightspeed/crane@latest deploy`)):(a.error("Error during build:"),
|
|
5
|
-
`)}function
|
|
6
|
-
`)}function
|
|
4
|
+
For deploy run: npx @lightspeed/crane@latest deploy`)):(a.error("Error during build:"),Ui(i))}catch(t){a.error(`Error while building: ${t.message}`),e||process.exit(1)}}async function S({entryPoints:e,configType:t,name:o,sectionType:s,sectionId:n,layoutId:i}){if(e.length!==0){const r=ke(nt({name:o,entryPoints:e,configType:t,sectionType:s,sectionId:n,layoutId:i}));await de({configFile:!1,...r})}}async function Ns(e){await new Promise(t=>setTimeout(t,e))}function ae({deploymentContext:e,sectionType:t="SECTION"}){const o=e.pathContext,s=o.toPath({sectionId:e.currentSection,sectionType:t,layoutId:e.layoutId,slotId:e.slotId}),n=s===void 0?xe(o.fileName):xe(o.fileName,{cwd:d(process.cwd(),s),ignore:o.ignore});return(o.isSingleton?n.splice(0):n).map(i=>({url:i,sectionType:t,context:e}))}const Gr=e=>e.app.sections.flatMap(t=>Nn.flatMap(o=>{const s={config:e,currentSection:t.id,pathContext:X[o]};return ae({deploymentContext:s,sectionType:t.type})})),Mr=e=>kn.flatMap(t=>{const o={config:e,pathContext:X[t]};return ae({deploymentContext:o})}),Br=e=>e.app.layouts.flatMap(t=>Ln.flatMap(o=>{const s={config:e,pathContext:X[o],currentSection:t.sectionId,layoutId:t.id};return ae({deploymentContext:s})})),qr=e=>e.app.slots.flatMap(t=>xn.flatMap(o=>{const s={config:e,pathContext:X[o],currentSection:t.sectionId,layoutId:t.layoutId,slotId:t.id};return ae({deploymentContext:s})})),Ur=e=>`\x1B[32m${e}\x1B[0m`,zr=(e,t,o,s,n)=>{if(!e.total)return;const{loaded:i}=e,r=(Date.now()-n)/1e3;o.value+=i-s.value,s.value=i,t.update({speed:`${V(o.value/r,2)}/s`})},Xr=()=>new mn.SingleBar({format:`|${Ur("{bar}")}| {status} || {percentage}% || {value}/{total} Files || Speed: {speed}`,barCompleteChar:"\u2588",barIncompleteChar:"\u2591"});function Oe(e,t){return Object.keys(e).reduce((o,s)=>{const n=e[s],i=t[s];return ze(n)&&ze(i)?o[s]=Oe(n,i):o[s]=n,o},{...t})}function Hr({contentSettings:e,sectionType:t}){const o=Uo(t);return Oe(e,o)}function Vr({designSettings:e,sectionType:t}){const o=zo(t);return Oe(e,o)}async function Kr(e,t,o=$){try{const s=d(I.cwd(),`${o}/${e}/js/settings/content.mjs`),n=await F(s),i=J(e),r=Hr({contentSettings:n,sectionType:i});return R(r,t),r}catch{throw new Error(`Content descriptor for section [${e}] is either invalid or undefined`)}}async function Yr(e,t,o=$){try{const s=d(I.cwd(),`${o}/${e}/js/settings/design.mjs`),n=await F(s),i=J(e),r=Vr({designSettings:n,sectionType:i});return We(r),R(r,t),r}catch(s){const n=s;throw new Error(`Design settings is invalid or undefined. Error ${n.stack}`)}}async function Jr(e,t,o=$){try{const s=await l("*.mjs",{cwd:d(I.cwd(),`${o}/${e}/js/showcases/`),ignore:"**/translations.mjs"});return Promise.all(s.map(async n=>{const i=d(I.cwd(),`${o}/${e}/js/showcases/${n}`),r=await F(i);return Ze(r.design),R(r,t),r}))}catch(s){throw new Error(`Showcases is invalid or undefined. Error ${s}`)}}async function Wr(e,t=$){try{const o=d(I.cwd(),`${t}/${e}/js/settings/layout.mjs`);if(!w(o))return[];const s=await F(o);return s.forEach(n=>ei(n.selectedDesignSettings)),s}catch{throw new Error(`Layout descriptor for section [${e}] is either invalid or undefined`)}}async function Zr(e,t=$){return he(`${t}/${e}/js/settings/translations.mjs`)}async function Ls(e,t=$){return he(`${t}/${e}/js/showcases/translations.mjs`)}function Qr(e){let t={};const o=d(I.cwd(),`${Be}/shared/analytics.json`);if(!w(o))return 0;try{const s=Ys(o,"utf-8");t=JSON.parse(s)}catch(s){console.warn("Error processing analytics.json file",s)}return t[e]||0}function ea(){try{const e=d(I.cwd(),`${Be}/shared/analytics.json`);w(e)&&Ne(e,JSON.stringify({},null,2),"utf-8")}catch(e){console.warn("Can not clean up preview analytics.json file",e)}}async function _e(e,t){const o=await Zr(e,b[t].dist),s=await Ls(e,b[t].dist),n=await Kr(e,o,b[t].dist),i=await Yr(e,o,b[t].dist),r=await Jr(e,s,b[t].dist),c=await Wr(e,b[t].dist),m=Qr(e);return{id:e,type:t,name:{en:e},contentEditors:n,designEditors:i,layouts:c,showcases:r,previewCount:m}}async function ta(){const e=await l("*/",{cwd:d(I.cwd(),`${$}/`)}),t=await l("*/",{cwd:d(I.cwd(),`${K}/`)}),o=await l("*/",{cwd:d(I.cwd(),`${Y}/`)});return Promise.all([...e.map(async s=>_e(s,"SECTION")),...t.map(async s=>_e(s,"HEADER")),...o.map(async s=>_e(s,"FOOTER"))])}async function Ie(e){if(!e||e.type!=="custom")return;const t=J(e.id),o=await Ls(e.id,b[t].dist);e.showcase_overrides!==void 0&&(R(e.showcase_overrides,o),e.showcase_overrides.design&&Ze(e.showcase_overrides.design))}async function xs(e){const t=e.filter(o=>o.type==="custom");await Promise.all(t.map(o=>Ie(o)))}async function ve(e){try{return await F(d(process.cwd(),e))}catch{throw new Error(`Template file [${e}] is either invalid or undefined`)}}async function oa(e){const t=await l(`${v}/js/**.mjs`,{ignore:[`${v}/js/**${A}.mjs`]});return Promise.all(t.map(async o=>{const s=await ve(o);return await xs(s.sections),{id:`${e}_${G(o).name}`,descriptor:s}}))}function sa(e){return e in P?P[e]:P.CUSTOM}async function na(e){const t=await l(`${v}/${e}/*.mjs`,{ignore:[`${v}/${e}/configuration*.mjs`]});return Promise.all(t.map(async o=>{const{sections:s}=await ve(o),n=$n(o);return await xs(s),{sections:s,id:n,type:sa(n.toUpperCase())}}))}async function ia(e){const t=await l(`${v}/**/configuration*.mjs`,{});return Promise.all(t.map(async o=>{const s=await ve(o);await Ie(s.header),await Ie(s.footer);const n=g.basename(g.dirname(o)),i=await na(n);return{id:`${e}_${n}`,descriptor:{...s,pages:i}}}))}async function ra(e){return[...await oa(e),...await ia(e)]}const aa={value:0},j=Xr();let ks=Date.now();const Fs=e=>2**e*500;async function ca(){const e=await Me(d(L.cwd(),"crane.config.json")),t=JSON.parse(e.toString());return{appClientId:t.app_client_id,appSecretKey:btoa(t.app_secret_key)}}function la(e){return typeof e=="object"&&e!==null&&"version"in e&&typeof e.version=="string"}async function pa(){const e=d(L.cwd(),"package.json"),t=await Me(e),o=JSON.parse(t.toString());if(la(o))return o;throw new Error(`Package file located at path: ${e} does not contain a version field`)}async function da(e){const t=un(e.version,"patch");if(t===null)throw Error("Error while incrementing app version");e.version=t,Ne(d(L.cwd(),"package.json"),`${JSON.stringify(e,null,2)}
|
|
5
|
+
`)}function fa(e){return e instanceof Ge&&(e.code==="ECONNRESET"||e.response?.status!==void 0&&e.response?.status>=500&&e.response?.status<600)}function Rs(e,t){return e<Pn&&fa(t)}async function Gs(e,t,o,s){const n={value:0},i=e.config.app.templates.length>0?vn:In;return e.config.axios.post(i,{file:Js(d(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.layoutId!==void 0&&{layoutId:e.layoutId},...e.slotId!==void 0&&{slotId:e.slotId},...!["dependencies","source_code"].includes(e.pathContext.type)&&{fileName:t}},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${e.config.app.crane.appSecretKey}`},onUploadProgress:r=>zr(r,j,aa,n,ks)}).then(r=>(j.increment(),r)).catch(async r=>{if(Rs(s,r))return await Ns(Fs(s)),Gs(e,t,o,s+1);throw j.increment(),r})}function ua(e){return j.start(e.length+1,0,{speed:"N/A",status:"Deployment in progress"}),e.map(t=>{const o=t.context,s=o.pathContext.toPath({sectionId:o.currentSection,sectionType:t.sectionType,layoutId:o.layoutId,slotId:o.slotId});return Gs(o,t.url,s,0)})}function ma(e){const t=[...Gr(e),...Mr(e),...Br(e),...qr(e)];return ua(t)}function ya(e){return e.includes(`
|
|
6
|
+
`)}function ga(e,t,o){return e.split(`
|
|
7
7
|
`).map((s,n)=>n>=o?t+s:s).join(`
|
|
8
|
-
`)}function te(e,t){const o=[];if(e instanceof
|
|
8
|
+
`)}function te(e,t){const o=[];if(e instanceof Ge){e.response?.status!==void 0&&o.push(` HTTP Status Code: ${e.response.status}`);const i=e.response?.data;if(i?.errorCode&&o.push(` Error Code: ${i.errorCode}`),i?.errorMessage){const r=ya(i.errorMessage)?ga(i.errorMessage," ",1):i.errorMessage;o.push(` Error Message: ${r}`)}}const s=o.length>0?o.join(`
|
|
9
9
|
`):e?.message??"Unknown error";if(!t||t.length===0)return s;const n=o.length>0?`
|
|
10
|
-
`:" ";return`${t}${n}${s}`}async function
|
|
10
|
+
`:" ";return`${t}${n}${s}`}async function Ms(e,t=0){const o=e.app.templates.length>0?Cn:Dn;return e.axios.post(o,{version:e.app.packageJson.version,name:"Custom Block App",blocks:e.app.sections,templates:e.app.templates,layouts:e.app.layouts,slots:e.app.slots,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(Rs(t,s))return await Ns(Fs(t)),Ms(e,t+1);throw s})}async function ha(e){try{if(!w(d(L.cwd(),$)))throw new Error(U.DISTRIBUTION_FOLDER_NOT_FOUND($));const t=e??_n;a.info("Custom application deployment :: Started");const o=dn.create({baseURL:t});fn(o,An),a.info("Loading configuration files ...");const s=await Promise.all([ca(),pa(),ta(),ii(),er()]).then(async([r,c,m,y,E])=>({axios:o,app:{crane:r,packageJson:c,sections:m,layouts:y,slots:E,templates:await ra(r.appClientId)}}));a.info("Uploading files ..."),ks=Date.now(),await Promise.all(ma(s)).catch(r=>{j.stop(),r.response?.status===404?a.error(te(r,U.DEPRECATED_VERSION_DEPLOYMENT)):a.error(te(r,U.ASSET_FILES_UPLOAD)),L.exit(1)}).finally(()=>{j.increment(),j.stop()}),j.update({speed:"N/A",status:"Finalising deployment"}),await Ms(s).catch(r=>{j.stop(),r.response?.status===404?a.error(te(r,U.DEPRECATED_VERSION_DEPLOYMENT)):a.error(te(r,U.MANIFEST_DEPLOYMENT)),L.exit(1)}).finally(()=>{j.increment(),j.stop()});const n=s.app.sections.map(r=>r.id),i=s.app.packageJson.version;a.info("Custom application deployment :: Successful"),a.info(`Current app version: ${i}`),a.info(`Deployed sections: ${n.join(", ")}`),await da(s.app.packageJson),s.app.templates.length>0&&a.info(`Deployed templates: ${s.app.templates.map(r=>r.id).join(", ")}`),s.app.slots.length>0&&a.info(`Deployed slots: ${s.app.slots.map(r=>r.id).join(", ")}`)}catch(t){j.stop(),a.error(te(t,U.DEFAULT)),L.exit(1)}finally{ea()}}const $a="1.3.2";async function ba(e){me(),fe("template/headers/example-header","headers",e,"Header")}async function Ea(e){me(),fe("template/footers/example-footer","footers",e,"Footer")}const Ta={deploy:["url"],init:[""],build:["generatePreview"]};function wa(e,t){return e.options.length!==0&&Object.keys(t).length===1}function Sa(e){return e.includes("-h")||e.includes("--help")}function ja(e,t){return Object.keys(t).some(o=>o!=="--"&&!e.hasOption(o)&&!Ta[e.rawName]?.includes(o))}function Oa(e){return e.length!==0}function _a(e,t,o){return e.matchedCommand!==void 0&&(wa(e.matchedCommand,o)||Sa(e.rawArgs)||ja(e.matchedCommand,e.options)||Oa(t))}function Ia(e,t,o){e.matchedCommand&&!_a(e,t,o)?e.runMatchedCommand():e.outputHelp()}async function va(e,t){const o=d(`${e}/shared/preview.ts`);await de({build:{lib:{entry:o,formats:["es"],fileName:()=>"preview.js"},outDir:d(t),emptyOutDir:!1,rollupOptions:{output:{entryFileNames:"preview.js"}},target:"esnext"}})}async function Da(){const e="preview",t=`${e}/shared`,o="vite.config.js",s=`${e}/sections`,n=`${s}/preview.html`;[e,s].forEach(r=>{u.existsSync(r)||u.mkdirSync(r,{recursive:!0})});const i=k("template/preview");u.existsSync(`${e}/${o}`)||u.copyFileSync(`${i}/${o}`,`${e}/${o}`),u.existsSync(n)||u.copyFileSync(`${i}/sections/preview.html`,n),u.existsSync(t)||(u.mkdirSync(t),await va(i,t))}function Ca(){return{timeout:null,inProgress:!1,hasPending:!1}}function Aa(e,t){const o=async()=>{e.inProgress=!0;try{await je(!0),t.ws.send({type:"full-reload",path:"*"})}catch(s){console.error("Build error:",s)}finally{e.inProgress=!1,e.hasPending&&(e.hasPending=!1,setTimeout(()=>o(),0))}};return async()=>{if(e.inProgress){e.hasPending=!0;return}await o()}}function Pa(e){const t=e.replace(/\\/g,"/"),o=t.match(/sections\/([^/]+)/),s=t.match(/shared\/components/);return!!(o||s)}function Na(e,t){return async o=>{Pa(o)&&(e.timeout&&clearTimeout(e.timeout),e.timeout=setTimeout(async()=>{await t()},1e3))}}function La(e,t){const o=Ca(),s=Aa(o,e),n=Na(o,s);e.watcher.add(t),e.watcher.on("add",n),e.watcher.on("change",n),e.watcher.on("unlink",n)}async function xa(){const e=g.resolve(process.cwd(),"preview/vite.config.js"),t=g.resolve(process.cwd(),"/sections/**/*"),o=g.resolve(process.cwd(),"/shared/components/*"),s=await Qs({configFile:e,root:process.cwd()});return await s.listen(),La(s,[t,o]),s}async function ka(){return await je(),await Da(),xa()}function Bs(e){if(hn(e))return console.log("Please specify a name for your resource."),!1;const{isValid:t,errorMessage:o}=gn(e);return o&&console.log(o),t}async function qs(e,t,o,s){const n=(await Ce({type:"text",name:"name",message:`Please specify a name for your ${t}:`})).name;if(n===void 0)return console.log(`You can use ${o} to directly specify the name of the ${t}.`),e.outputHelp();const i=g.basename(n);return Bs(i)?s(i):qs(e,t,o,s)}async function oe(e,t,o,s,n){if(n!==void 0)if(!Bs(n))await qs(e,t,o,s);else{const i=g.basename(n.toString());await s(i)}}async function Fa(e,t){try{const{app:o,section:s,header:n,footer:i,template:r,referenceTemplate:c}=e;await oe(t,"app",M("init --app <name>"),Tn,o),await oe(t,"section",M("init --section <name>"),Sn,s),await oe(t,"header",M("init --header <name>"),ba,n),await oe(t,"footer",M("init --footer <name>"),Ea,i),await oe(t,"template",M("init --template <name>"),jn,r),c&&await On()}catch(o){a.error(`Error while executing init operation: ${o.message}`),process.exit(1)}}function Ra(){try{const e=zs("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. ").allowUnknownOptions().action(async o=>Fa(o,e)),e.command("build","Builds your resource code").allowUnknownOptions().action(()=>je()),e.command("preview","Runs a local server to preview resources").allowUnknownOptions().action(()=>ka()),e.command("deploy","Deploys your resource code").allowUnknownOptions().action(()=>ha(e.options.url)),e.version($a),e.usage("<action> <resource>");const t=e.parse(process.argv,{run:!1});Ia(e,t.args,t.options)}catch(e){a.error(`Error while parsing input: ${e.message}`),process.exit(1)}}export{Ra as run};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightspeed/crane",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": "bin/crane.js",
|
|
6
6
|
"main": "./dist/app.mjs",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@jridgewell/sourcemap-codec": "^1.4.15",
|
|
65
|
-
"@lightspeed/eslint-config-crane": "1.1.
|
|
65
|
+
"@lightspeed/eslint-config-crane": "1.1.2",
|
|
66
66
|
"@types/prompts": "^2.4.2",
|
|
67
67
|
"@vitejs/plugin-vue": "^4.1.0",
|
|
68
68
|
"adm-zip": "^0.5.16",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"axios-concurrency": "^1.0.4",
|
|
73
73
|
"cac": "^6.7.14",
|
|
74
74
|
"cli-progress": "^3.12.0",
|
|
75
|
-
"eslint": "9.
|
|
75
|
+
"eslint": "^9.33.0",
|
|
76
76
|
"fs-extra": "^11.1.1",
|
|
77
77
|
"glob": "^9.3.5",
|
|
78
78
|
"jsonpath-plus": "^10.3.0",
|
package/template/_gitignore
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {defineConfig} from 'vite';
|
|
2
|
+
import path from "path";
|
|
3
|
+
import fs from "fs";
|
|
2
4
|
|
|
3
5
|
export default defineConfig({
|
|
4
6
|
root: '.',
|
|
5
7
|
server: {
|
|
6
|
-
fs: {
|
|
8
|
+
fs: {strict: false},
|
|
7
9
|
},
|
|
8
10
|
plugins: [
|
|
9
11
|
{
|
|
@@ -19,13 +21,53 @@ export default defineConfig({
|
|
|
19
21
|
{
|
|
20
22
|
name: 'no-vite-cache',
|
|
21
23
|
configureServer(server) {
|
|
22
|
-
//
|
|
24
|
+
// use process.cwd() for analytics path
|
|
25
|
+
const analyticsDir = path.resolve(process.cwd(), 'preview', 'shared')
|
|
26
|
+
const analyticsFile = path.resolve(analyticsDir, 'analytics.json')
|
|
27
|
+
|
|
28
|
+
// ensure analytics folder & file exist
|
|
29
|
+
fs.mkdirSync(analyticsDir, {recursive: true})
|
|
30
|
+
if (!fs.existsSync(analyticsFile)) {
|
|
31
|
+
fs.writeFileSync(analyticsFile, JSON.stringify({}, null, 2), 'utf-8')
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// helper to bump and persist counter for a given section
|
|
35
|
+
function bumpSectionCount(section) {
|
|
36
|
+
const raw = fs.readFileSync(analyticsFile, 'utf-8')
|
|
37
|
+
const data = JSON.parse(raw)
|
|
38
|
+
const next = (data[section] || 0) + 1
|
|
39
|
+
data[section] = next
|
|
40
|
+
fs.writeFileSync(analyticsFile, JSON.stringify(data, null, 2), 'utf-8')
|
|
41
|
+
return next
|
|
42
|
+
}
|
|
43
|
+
|
|
23
44
|
server.middlewares.use((req, res, next) => {
|
|
24
|
-
|
|
25
|
-
|
|
45
|
+
const url = req.url || ''
|
|
46
|
+
|
|
47
|
+
// cache-bust for any /sections/ URL
|
|
48
|
+
if (url.includes('/sections/')) {
|
|
49
|
+
server.moduleGraph.invalidateAll()
|
|
50
|
+
return next()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (url.startsWith('/chosen-section')) {
|
|
54
|
+
// extract "sectionName" from "/chosen-section/<sectionName>"
|
|
55
|
+
|
|
56
|
+
const sectionName = req.url.replace(/\/$/, '').split('/').filter(Boolean).pop()
|
|
57
|
+
const newCount = bumpSectionCount(sectionName)
|
|
58
|
+
|
|
59
|
+
res.statusCode = 200
|
|
60
|
+
res.setHeader('Content-Type', 'application/json')
|
|
61
|
+
return res.end(JSON.stringify({
|
|
62
|
+
section: sectionName,
|
|
63
|
+
count: newCount
|
|
64
|
+
}))
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// all other requests
|
|
68
|
+
next()
|
|
26
69
|
}
|
|
27
|
-
|
|
28
|
-
});
|
|
70
|
+
);
|
|
29
71
|
},
|
|
30
72
|
},
|
|
31
73
|
],
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
metadata: {
|
|
3
|
+
name: 'Reference Template — Apparel',
|
|
4
|
+
description: 'This is a reference template geared towards apparel merchants to aid development and act as a starting point for your custom template.',
|
|
5
|
+
preview_url: 'https://reference-template-apparel.company.site/',
|
|
6
|
+
cover_image: {
|
|
7
|
+
set: {
|
|
8
|
+
ORIGINAL: {
|
|
9
|
+
url: 'reference_template_apparel_cover_image.jpg',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
header: {
|
|
15
|
+
type: 'default',
|
|
16
|
+
id: 'header',
|
|
17
|
+
},
|
|
18
|
+
footer: {
|
|
19
|
+
type: 'default',
|
|
20
|
+
id: 'footer',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
sections: [
|
|
3
|
+
{
|
|
4
|
+
type: 'custom',
|
|
5
|
+
id: 'intro-slider',
|
|
6
|
+
showcase_id: '1',
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
type: 'custom',
|
|
10
|
+
id: 'tag-lines',
|
|
11
|
+
showcase_id: '1',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
type: 'custom',
|
|
15
|
+
id: 'about-us',
|
|
16
|
+
showcase_id: '1',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
type: 'custom',
|
|
20
|
+
id: 'example-section',
|
|
21
|
+
showcase_id: '1',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
metadata: {
|
|
3
|
+
name: 'Reference Template — Bike',
|
|
4
|
+
description: 'This is a reference template geared towards bike shops to aid development and act as a starting point for your custom template.',
|
|
5
|
+
preview_url: 'https://reference-template-bike.company.site/',
|
|
6
|
+
cover_image: {
|
|
7
|
+
set: {
|
|
8
|
+
ORIGINAL: {
|
|
9
|
+
url: 'reference_template_bike_cover_image.jpg',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
header: {
|
|
15
|
+
type: 'default',
|
|
16
|
+
id: 'header',
|
|
17
|
+
},
|
|
18
|
+
footer: {
|
|
19
|
+
type: 'default',
|
|
20
|
+
id: 'footer',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
sections: [
|
|
3
|
+
{
|
|
4
|
+
type: 'custom',
|
|
5
|
+
id: 'intro-slider',
|
|
6
|
+
showcase_id: '2',
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
type: 'custom',
|
|
10
|
+
id: 'example-section',
|
|
11
|
+
showcase_id: '3',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
type: 'custom',
|
|
15
|
+
id: 'tag-lines',
|
|
16
|
+
showcase_id: '2',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
type: 'custom',
|
|
20
|
+
id: 'about-us',
|
|
21
|
+
showcase_id: '2',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
metadata: {
|
|
3
|
-
name: 'Reference Template — Apparel',
|
|
4
|
-
description: 'This is a reference template geared towards apparel merchants to aid development and act as a starting point for your custom template.',
|
|
5
|
-
preview_url: 'https://reference-template-apparel.company.site/',
|
|
6
|
-
cover_image: {
|
|
7
|
-
set: {
|
|
8
|
-
ORIGINAL: {
|
|
9
|
-
url: 'reference_template_apparel_cover_image.jpg',
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
sections: [
|
|
15
|
-
{
|
|
16
|
-
type: 'default',
|
|
17
|
-
id: 'header',
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
type: 'custom',
|
|
21
|
-
id: 'intro-slider',
|
|
22
|
-
showcase_id: '1',
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
type: 'custom',
|
|
26
|
-
id: 'tag-lines',
|
|
27
|
-
showcase_id: '1',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
type: 'custom',
|
|
31
|
-
id: 'about-us',
|
|
32
|
-
showcase_id: '1',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
type: 'custom',
|
|
36
|
-
id: 'example-section',
|
|
37
|
-
showcase_id: '1',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
type: 'default',
|
|
41
|
-
id: 'footer',
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
metadata: {
|
|
3
|
-
name: 'Reference Template — Bike',
|
|
4
|
-
description: 'This is a reference template geared towards bike shops to aid development and act as a starting point for your custom template.',
|
|
5
|
-
preview_url: 'https://reference-template-bike.company.site/',
|
|
6
|
-
cover_image: {
|
|
7
|
-
set: {
|
|
8
|
-
ORIGINAL: {
|
|
9
|
-
url: 'reference_template_bike_cover_image.jpg',
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
sections: [
|
|
15
|
-
{
|
|
16
|
-
type: 'default',
|
|
17
|
-
id: 'header',
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
type: 'custom',
|
|
21
|
-
id: 'intro-slider',
|
|
22
|
-
showcase_id: '2',
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
type: 'custom',
|
|
26
|
-
id: 'example-section',
|
|
27
|
-
showcase_id: '3',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
type: 'custom',
|
|
31
|
-
id: 'tag-lines',
|
|
32
|
-
showcase_id: '2',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
type: 'custom',
|
|
36
|
-
id: 'about-us',
|
|
37
|
-
showcase_id: '2',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
type: 'default',
|
|
41
|
-
id: 'footer',
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
};
|
|
Binary file
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
metadata: {
|
|
3
|
-
name: 'Example Template :: Standard Preset',
|
|
4
|
-
description: 'Standard Preset for the Example template',
|
|
5
|
-
preview_url: 'https://template_preview.company.site',
|
|
6
|
-
cover_image: {
|
|
7
|
-
set: {
|
|
8
|
-
ORIGINAL: {
|
|
9
|
-
url: 'template_cover_image.png',
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
sections: [
|
|
15
|
-
{
|
|
16
|
-
type: 'default',
|
|
17
|
-
id: 'header',
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
type: 'default',
|
|
21
|
-
id: 'slider',
|
|
22
|
-
showcase_id: '001',
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
type: 'custom',
|
|
26
|
-
id: 'example-section',
|
|
27
|
-
showcase_id: '1',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
type: 'custom',
|
|
31
|
-
id: 'example-section',
|
|
32
|
-
showcase_overrides: {
|
|
33
|
-
content: {
|
|
34
|
-
section_title: {
|
|
35
|
-
type: 'INPUTBOX',
|
|
36
|
-
text: '$label.template_standard_showcase_1.section_title.text',
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
images: {
|
|
40
|
-
type: 'DECK',
|
|
41
|
-
cards: [
|
|
42
|
-
{
|
|
43
|
-
settings: {
|
|
44
|
-
image_text: {
|
|
45
|
-
type: 'TEXTAREA',
|
|
46
|
-
text: '$label.showcase_2.image_text_1.text',
|
|
47
|
-
},
|
|
48
|
-
image_content: {
|
|
49
|
-
type: 'IMAGE',
|
|
50
|
-
imageData: {
|
|
51
|
-
set: {
|
|
52
|
-
MOBILE_WEBP_LOW_RES: {
|
|
53
|
-
url: 'new_tshirts_collection_mobile_low.jpeg',
|
|
54
|
-
},
|
|
55
|
-
MOBILE_WEBP_HI_RES: {
|
|
56
|
-
url: 'new_tshirts_collection_mobile_high.jpeg',
|
|
57
|
-
},
|
|
58
|
-
WEBP_LOW_RES: {
|
|
59
|
-
url: 'new_tshirts_collection_pc_low.jpeg',
|
|
60
|
-
},
|
|
61
|
-
WEBP_HI_2X_RES: {
|
|
62
|
-
url: 'new_tshirts_collection_pc_high.jpeg',
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
borderInfo: {},
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
image_link: {
|
|
69
|
-
type: 'INPUTBOX',
|
|
70
|
-
text: '$label.showcase_2.image_link_1.text',
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
settings: {
|
|
76
|
-
image_text: {
|
|
77
|
-
type: 'TEXTAREA',
|
|
78
|
-
text: '$label.showcase_2.image_text_2.text',
|
|
79
|
-
},
|
|
80
|
-
image_content: {
|
|
81
|
-
type: 'IMAGE',
|
|
82
|
-
imageData: {
|
|
83
|
-
set: {
|
|
84
|
-
MOBILE_WEBP_LOW_RES: {
|
|
85
|
-
url: 'autumn_looks_mobile_low.jpeg',
|
|
86
|
-
},
|
|
87
|
-
MOBILE_WEBP_HI_RES: {
|
|
88
|
-
url: 'autumn_looks_mobile_high.jpeg',
|
|
89
|
-
},
|
|
90
|
-
WEBP_LOW_RES: {
|
|
91
|
-
url: 'autumn_looks_pc_low.jpeg',
|
|
92
|
-
},
|
|
93
|
-
WEBP_HI_2X_RES: {
|
|
94
|
-
url: 'autumn_looks_pc_high.jpeg',
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
borderInfo: {},
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
{
|
|
104
|
-
settings: {
|
|
105
|
-
image_text: {
|
|
106
|
-
type: 'TEXTAREA',
|
|
107
|
-
text: '$label.showcase_2.image_text_3.text',
|
|
108
|
-
},
|
|
109
|
-
image_content: {
|
|
110
|
-
type: 'IMAGE',
|
|
111
|
-
imageData: {
|
|
112
|
-
set: {
|
|
113
|
-
MOBILE_WEBP_LOW_RES: {
|
|
114
|
-
url: 'bianka_wardrobe_mobile_low.jpeg',
|
|
115
|
-
},
|
|
116
|
-
MOBILE_WEBP_HI_RES: {
|
|
117
|
-
url: 'bianka_wardrobe_mobile_high.jpeg',
|
|
118
|
-
},
|
|
119
|
-
WEBP_LOW_RES: {
|
|
120
|
-
url: 'bianka_wardrobe_pc_low.jpeg',
|
|
121
|
-
},
|
|
122
|
-
WEBP_HI_2X_RES: {
|
|
123
|
-
url: 'bianka_wardrobe_pc_high.jpeg',
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
borderInfo: {},
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
{
|
|
133
|
-
settings: {
|
|
134
|
-
image_text: {
|
|
135
|
-
type: 'TEXTAREA',
|
|
136
|
-
text: '$label.showcase_2.image_text_4.text',
|
|
137
|
-
},
|
|
138
|
-
image_content: {
|
|
139
|
-
type: 'IMAGE',
|
|
140
|
-
imageData: {
|
|
141
|
-
set: {
|
|
142
|
-
MOBILE_WEBP_LOW_RES: {
|
|
143
|
-
url: 'story_of_jane_mobile_low.jpeg',
|
|
144
|
-
},
|
|
145
|
-
MOBILE_WEBP_HI_RES: {
|
|
146
|
-
url: 'story_of_jane_mobile_high.jpeg',
|
|
147
|
-
},
|
|
148
|
-
WEBP_LOW_RES: {
|
|
149
|
-
url: 'story_of_jane_pc_low.jpeg',
|
|
150
|
-
},
|
|
151
|
-
WEBP_HI_2X_RES: {
|
|
152
|
-
url: 'story_of_jane_pc_high.jpeg',
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
borderInfo: {},
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
design: {
|
|
164
|
-
section_title: {
|
|
165
|
-
type: 'TEXT',
|
|
166
|
-
font: 'global.fontFamily.body',
|
|
167
|
-
size: 42,
|
|
168
|
-
bold: true,
|
|
169
|
-
italic: true,
|
|
170
|
-
color: '#222',
|
|
171
|
-
},
|
|
172
|
-
image_text: {
|
|
173
|
-
type: 'TEXT',
|
|
174
|
-
size: 22,
|
|
175
|
-
bold: false,
|
|
176
|
-
italic: true,
|
|
177
|
-
},
|
|
178
|
-
background: {
|
|
179
|
-
type: 'BACKGROUND',
|
|
180
|
-
style: 'COLOR',
|
|
181
|
-
color: 'global.color.background',
|
|
182
|
-
},
|
|
183
|
-
image_content: {
|
|
184
|
-
type: 'IMAGE',
|
|
185
|
-
overlay: 'GRADIENT',
|
|
186
|
-
color: ['#FFFFFF', '#CCCCCC'],
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
layoutId: 'Caption_Under_Image',
|
|
190
|
-
blockName: '$label.showcase_2.blockName',
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
type: 'default',
|
|
195
|
-
id: 'footer',
|
|
196
|
-
},
|
|
197
|
-
],
|
|
198
|
-
};
|