@lightspeed/crane 1.2.5 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/app.d.mts +23 -10
  3. package/dist/app.d.ts +23 -10
  4. package/dist/app.mjs +1 -1
  5. package/dist/cli.mjs +7 -7
  6. package/package.json +11 -11
  7. package/template/layouts/catalog/example-catalog/Main.vue +1 -1
  8. package/template/layouts/catalog/example-catalog/assets/account-icon.svg +11 -0
  9. package/template/layouts/catalog/example-catalog/components/Icon.vue +52 -0
  10. package/template/layouts/catalog/example-catalog/settings/content.ts +1 -0
  11. package/template/layouts/catalog/example-catalog/settings/design.ts +1 -0
  12. package/template/layouts/catalog/example-catalog/settings/translations.ts +1 -0
  13. package/template/layouts/catalog/example-catalog/slots/custom-bottom-bar/CustomBottomBar.vue +69 -0
  14. package/template/layouts/catalog/example-catalog/slots/custom-bottom-bar/client.ts +5 -0
  15. package/template/layouts/catalog/example-catalog/slots/custom-bottom-bar/server.ts +5 -0
  16. package/template/layouts/catalog/example-catalog/type.ts +5 -0
  17. package/template/layouts/category/example-category/settings/content.ts +1 -0
  18. package/template/layouts/category/example-category/settings/design.ts +1 -0
  19. package/template/layouts/category/example-category/type.ts +5 -0
  20. package/template/layouts/product/example-product/settings/content.ts +1 -0
  21. package/template/layouts/product/example-product/settings/design.ts +1 -0
  22. package/template/layouts/product/example-product/type.ts +5 -0
  23. package/template/page-templates/example-template/pages/catalog.ts +5 -4
  24. package/template/page-templates/example-template/pages/category.ts +5 -4
  25. package/template/page-templates/example-template/pages/product.ts +5 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.6 - 2025-08-06
4
+
5
+ ### Added
6
+
7
+ - **Storefront (experimental):** add support for custom slots in storefront page layouts.
8
+
3
9
  ## 1.2.5 - 2025-07-07
4
10
 
5
11
  ### Added
package/dist/app.d.mts CHANGED
@@ -206,6 +206,15 @@ declare function useDeckElementContent<CONTENT>(elementName: keyof CONTENT): {
206
206
  declare function getReactiveRef(card: Card | undefined, editorType: EditorTypes, contentElementName: string): {
207
207
  hasContent: boolean;
208
208
  value: string | undefined;
209
+ } | {
210
+ hasContent: boolean;
211
+ lowResolutionMobileImage: string;
212
+ highResolutionMobileImage: string;
213
+ lowResolutionDesktopImage: string;
214
+ highResolutionDesktopImage: string;
215
+ } | {
216
+ hasContent: boolean;
217
+ value: boolean | undefined;
209
218
  } | {
210
219
  title: string | undefined;
211
220
  type: ActionLinkType | undefined;
@@ -218,15 +227,6 @@ declare function getReactiveRef(card: Card | undefined, editorType: EditorTypes,
218
227
  hasTitle: boolean;
219
228
  hasLink: boolean;
220
229
  performAction: (() => void) | undefined;
221
- } | {
222
- hasContent: boolean;
223
- value: boolean | undefined;
224
- } | {
225
- hasContent: boolean;
226
- lowResolutionMobileImage: string;
227
- highResolutionMobileImage: string;
228
- lowResolutionDesktopImage: string;
229
- highResolutionDesktopImage: string;
230
230
  } | undefined;
231
231
 
232
232
  declare function useLogoElementContent<CONTENT>(): {
@@ -384,14 +384,26 @@ interface InstantsiteJSAPI {
384
384
 
385
385
  declare function useInstantsiteJsApi(): InstantsiteJSAPI | undefined;
386
386
 
387
+ interface StorefrontSection {
388
+ /** Section layout identifier. When not provided, the section will use the default layout. */
389
+ readonly id?: string;
390
+ readonly type: 'store';
391
+ }
392
+
393
+ interface StorePageConfiguration {
394
+ readonly sections: [StorefrontSection];
395
+ }
396
+
387
397
  declare const CatalogLayoutSlot: {
388
398
  readonly PRODUCT_LIST: "CONTROLS";
389
399
  readonly BOTTOM_BAR: "FOOTER";
400
+ readonly CUSTOM_SLOT: "CUSTOM_SLOT";
390
401
  };
391
402
  declare const CategoryLayoutSlot: {
392
403
  readonly CATEGORY_TITLE: "MAIN_TITLE";
393
404
  readonly PRODUCT_LIST: "CONTROLS";
394
405
  readonly BOTTOM_BAR: "FOOTER";
406
+ readonly CUSTOM_SLOT: "CUSTOM_SLOT";
395
407
  };
396
408
  declare const ProductLayoutSlot: {
397
409
  readonly TOP_BAR: "TOP_BAR";
@@ -401,7 +413,8 @@ declare const ProductLayoutSlot: {
401
413
  readonly REVIEW_LIST: "REVIEW_LIST";
402
414
  readonly RELATED_PRODUCTS: "RELATED_PRODUCTS";
403
415
  readonly BOTTOM_BAR: "FOOTER";
416
+ readonly CUSTOM_SLOT: "CUSTOM_SLOT";
404
417
  };
405
418
 
406
419
  export { CatalogLayoutSlot, CategoryLayoutSlot, EditorTypes, ProductLayoutSlot, createVueClientApp, createVueServerApp, useBackgroundElementDesign, useButtonElementContent, useButtonElementDesign, useDeckElementContent, useImageElementContent, useImageElementDesign, useInputboxElementContent, useInstantsiteJsApi, useLayoutElementDesign, useLogoElementContent, useLogoElementDesign, useMenuElementContent, useNavigationMenuElementContent, useSelectboxElementContent, useSelectboxElementDesign, useTextElementDesign, useTextareaElementContent, useTextareaElementDesign, useToggleElementContent, useToggleElementDesign, useVueBaseProps };
407
- export type { ButtonContent, Card, Deck, ImageContent, InputBoxContent, SelectBoxContent, TextAreaContent, ToggleContent };
420
+ export type { ButtonContent, Card, Deck, ImageContent, InputBoxContent, SelectBoxContent, StorePageConfiguration, TextAreaContent, ToggleContent };
package/dist/app.d.ts CHANGED
@@ -206,6 +206,15 @@ declare function useDeckElementContent<CONTENT>(elementName: keyof CONTENT): {
206
206
  declare function getReactiveRef(card: Card | undefined, editorType: EditorTypes, contentElementName: string): {
207
207
  hasContent: boolean;
208
208
  value: string | undefined;
209
+ } | {
210
+ hasContent: boolean;
211
+ lowResolutionMobileImage: string;
212
+ highResolutionMobileImage: string;
213
+ lowResolutionDesktopImage: string;
214
+ highResolutionDesktopImage: string;
215
+ } | {
216
+ hasContent: boolean;
217
+ value: boolean | undefined;
209
218
  } | {
210
219
  title: string | undefined;
211
220
  type: ActionLinkType | undefined;
@@ -218,15 +227,6 @@ declare function getReactiveRef(card: Card | undefined, editorType: EditorTypes,
218
227
  hasTitle: boolean;
219
228
  hasLink: boolean;
220
229
  performAction: (() => void) | undefined;
221
- } | {
222
- hasContent: boolean;
223
- value: boolean | undefined;
224
- } | {
225
- hasContent: boolean;
226
- lowResolutionMobileImage: string;
227
- highResolutionMobileImage: string;
228
- lowResolutionDesktopImage: string;
229
- highResolutionDesktopImage: string;
230
230
  } | undefined;
231
231
 
232
232
  declare function useLogoElementContent<CONTENT>(): {
@@ -384,14 +384,26 @@ interface InstantsiteJSAPI {
384
384
 
385
385
  declare function useInstantsiteJsApi(): InstantsiteJSAPI | undefined;
386
386
 
387
+ interface StorefrontSection {
388
+ /** Section layout identifier. When not provided, the section will use the default layout. */
389
+ readonly id?: string;
390
+ readonly type: 'store';
391
+ }
392
+
393
+ interface StorePageConfiguration {
394
+ readonly sections: [StorefrontSection];
395
+ }
396
+
387
397
  declare const CatalogLayoutSlot: {
388
398
  readonly PRODUCT_LIST: "CONTROLS";
389
399
  readonly BOTTOM_BAR: "FOOTER";
400
+ readonly CUSTOM_SLOT: "CUSTOM_SLOT";
390
401
  };
391
402
  declare const CategoryLayoutSlot: {
392
403
  readonly CATEGORY_TITLE: "MAIN_TITLE";
393
404
  readonly PRODUCT_LIST: "CONTROLS";
394
405
  readonly BOTTOM_BAR: "FOOTER";
406
+ readonly CUSTOM_SLOT: "CUSTOM_SLOT";
395
407
  };
396
408
  declare const ProductLayoutSlot: {
397
409
  readonly TOP_BAR: "TOP_BAR";
@@ -401,7 +413,8 @@ declare const ProductLayoutSlot: {
401
413
  readonly REVIEW_LIST: "REVIEW_LIST";
402
414
  readonly RELATED_PRODUCTS: "RELATED_PRODUCTS";
403
415
  readonly BOTTOM_BAR: "FOOTER";
416
+ readonly CUSTOM_SLOT: "CUSTOM_SLOT";
404
417
  };
405
418
 
406
419
  export { CatalogLayoutSlot, CategoryLayoutSlot, EditorTypes, ProductLayoutSlot, createVueClientApp, createVueServerApp, useBackgroundElementDesign, useButtonElementContent, useButtonElementDesign, useDeckElementContent, useImageElementContent, useImageElementDesign, useInputboxElementContent, useInstantsiteJsApi, useLayoutElementDesign, useLogoElementContent, useLogoElementDesign, useMenuElementContent, useNavigationMenuElementContent, useSelectboxElementContent, useSelectboxElementDesign, useTextElementDesign, useTextareaElementContent, useTextareaElementDesign, useToggleElementContent, useToggleElementDesign, useVueBaseProps };
407
- export type { ButtonContent, Card, Deck, ImageContent, InputBoxContent, SelectBoxContent, TextAreaContent, ToggleContent };
420
+ export type { ButtonContent, Card, Deck, ImageContent, InputBoxContent, SelectBoxContent, StorePageConfiguration, TextAreaContent, ToggleContent };
package/dist/app.mjs CHANGED
@@ -1 +1 @@
1
- import{getCurrentInstance as M,ref as b,computed as i,reactive as d,createSSRApp as U}from"vue";import{renderToString as K}from"vue/server-renderer";const w=new Map;function c(){const e=(l,r,a,v,g,s,u)=>{w.set(l._uid,{context:b(r),content:b(a),design:b(v),defaults:b(g),site:b(s?.site??{}),category:b(s?.category),globalDesign:b(u)})},n=(l,r,a,v,g,s)=>{const u=w.get(l._uid);u!==void 0&&(u.content.value=r,u.design.value=a,u.defaults.value=v,u.site.value=g.site??{},u.category.value=g.category,u.globalDesign.value=s)},t=M()?.appContext.app._uid??-1,o=w.get(t);return{init:e,update:n,context:o?.context,content:o?.content,design:o?.design,defaults:o?.defaults,site:o?.site,category:o?.category,globalDesign:o?.globalDesign}}function R(e,n){const t=c(),o=i(()=>n!==void 0?n:t.content.value);return F(o,e)}function F(e,n){const t=i(()=>{const r=e.value[n];if(r!==void 0){if(typeof r=="string")return r;throw new Error(`Element ${n} is not inputbox`)}}),o=i(()=>t.value!==void 0),l=i(()=>t.value);return d({hasContent:o,value:l})}function C(e,n){const t=c(),o=i(()=>n!==void 0?n:t.content.value);return W(o,e)}function W(e,n){const t=i(()=>{const r=e.value[n];if(r!==void 0){if(typeof r=="string")return r;throw new Error(`Element ${n} is not textarea`)}}),o=i(()=>t.value!==void 0),l=i(()=>t.value);return d({hasContent:o,value:l})}const E={HYPER_LINK:"HYPER_LINK",SCROLL_TO_TILE:"SCROLL_TO_TILE",MAIL_LINK:"MAIL_LINK",TEL_LINK:"TEL_LINK",GO_TO_STORE:"GO_TO_STORE",GO_TO_STORE_LINK:"GO_TO_STORE_LINK",GO_TO_PAGE:"GO_TO_PAGE",GO_TO_CATEGORY:"GO_TO_CATEGORY"};function X(e){if("tileId"in e)return e.tileId;if("tileIdForScroll"in e)return e.tileIdForScroll}function Y(e){if("pageId"in e)return e.pageId;if("pageIdForNavigate"in e)return e.pageIdForNavigate}function V(e){if("pageUrl"in e)return e.pageUrl;switch(Y(e)){case"products":return"/products";case"cart":return"/cart";case"account":return"/account";case"search":return"/search";case"home":default:return"/"}}const L=(e,n)=>{if(!e||n)return;const{type:t,link:o,email:l,phone:r}=e,a=V(e);switch(t){case E.HYPER_LINK:if(o)return()=>window.open(o,"_blank");break;case E.GO_TO_STORE:case E.GO_TO_STORE_LINK:return()=>window.open("/products","_self");case E.MAIL_LINK:if(l)return()=>window.open(`mailto:${l}`,"_self");break;case E.TEL_LINK:if(r)return()=>window.open(`tel:${r}`,"_self");break;case E.SCROLL_TO_TILE:if(typeof document<"u")return()=>{const v=X(e);document.getElementById(`tile-${v}`)?.scrollIntoView()};break;case E.GO_TO_PAGE:if(a)return()=>window.open(a,"_self");break;default:console.error(`Unknown type of ActionLink: ${t}`)}};function H(e){return"title"in e&&"type"in e}function j(e,n,t){const o=i(()=>{const _=e.value[n];if(_!==void 0){if(H(_))return _;throw new Error(`Element ${n} is not action link`)}}),l=i(()=>o.value?.title),r=i(()=>o.value?.type),a=i(()=>o.value?.link),v=i(()=>o.value?.email),g=i(()=>o.value?.phone),s=i(()=>o.value?.tileId?`tile-${o.value?.tileId}`:null),u=i(()=>o.value?.type==="GO_TO_STORE_LINK"?"products":o.value?.pageId),f=i(()=>o.value?.pageUrl),m=i(()=>!!l.value),$=i(()=>!!a.value),P=L(o.value,t);return d({title:l,type:r,link:a,email:v,phone:g,tileDivId:s,pageId:u,pageUrl:f,hasTitle:m,hasLink:$,performAction:P})}function h(e,n){const t=c(),o=i(()=>!!t.site?.value?.isPreviewMode),l=i(()=>n!==void 0?n:t.content.value!==void 0?t.content.value:{});return j(l,e,o.value)}function J(e){return"bucket"in e&&"borderInfo"in e&&"set"in e}function T(e,n){const t=new RegExp(/^https?:\/\//);return e!=null&&t.test(e)?e:`${n}/${e}`}function D(e,n){const t=c(),o=i(()=>n!==void 0?n:t.content.value);return q(o,e)}function q(e,n){const t=i(()=>{const s=e.value[n];if(s!==void 0){if(J(s))return s;throw new Error(`Element ${n} is not image`)}}),o=i(()=>t.value===void 0?"":c().context.value.imageBuckets?.[t.value?.bucket]),l=i(()=>t.value!==void 0),r=i(()=>T(t.value?.set?.["cropped-webp-100x200"]?.url,o.value)),a=i(()=>T(t.value?.set?.["cropped-webp-1000x2000"]?.url,o.value)),v=i(()=>T(t.value?.set?.["webp-200x200"]?.url,o.value)),g=i(()=>T(t.value?.set?.["webp-2000x2000"]?.url,o.value));return d({hasContent:l,lowResolutionMobileImage:r,highResolutionMobileImage:a,lowResolutionDesktopImage:v,highResolutionDesktopImage:g})}function Q(e){return"enabled"in e}function A(e,n){const t=c(),o=i(()=>n!==void 0?n:t.content.value);return Z(o,e)}function Z(e,n){const t=i(()=>{const r=e.value[n];if(r!==void 0){if(Q(r))return r;throw new Error(`Element ${n} is not toggle`)}}),o=i(()=>t.value!==void 0),l=i(()=>t.value?.enabled);return d({hasContent:o,value:l})}function S(e,n){const t=c(),o=i(()=>n!==void 0?n:t.content.value);return ee(o,e)}function ee(e,n){const t=i(()=>{const r=e.value[n];if(r!==void 0){if(typeof r=="string")return r;throw new Error(`Element ${n} is not selectbox`)}}),o=i(()=>t.value!==void 0),l=i(()=>t.value);return d({hasContent:o,value:l})}function te(e){return e!==null&&"items"in e}function x(e){const n=c(),t=i(()=>{const a=n.content.value[e];if(a!==void 0){if(te(a))return a;throw new Error(`Element ${e} is not an menu`)}}),o=i(()=>!!n.site?.value?.isPreviewMode),l=i(()=>t.value!==void 0),r=i(()=>t.value?.items?t.value.items.map(a=>({...a,performAction:L(a,o.value)})):[]);return d({hasContent:l,items:r})}const ne="menu";function oe(){return x(ne)}var k=(e=>(e.INPUTBOX="INPUTBOX",e.TEXTAREA="TEXTAREA",e.BUTTON="BUTTON",e.IMAGE="IMAGE",e.TOGGLE="TOGGLE",e.SELECTBOX="SELECTBOX",e))(k||{});function ie(e){if(typeof e!="object"||e===null)return!1;const n=e;return Array.isArray(n.cards)&&n.cards.every(t=>typeof t.settings=="object"&&t.settings!==null)}function le(e){const n=c(),t=i(()=>{const r=n.content.value[e];if(r!==void 0){if(ie(r))return r;throw new Error(`Element ${e} is not of DECK type`)}}),o=i(()=>t.value!==void 0&&t.value.cards.length>0),l=i(()=>t.value?.cards);return d({hasContent:o,cards:l,getReactiveRef:re})}function re(e,n,t){if(e==null)throw Error("Could not get a reactive ref for undefined Card");const o=e.settings[t];if(o===void 0)return o;switch(n){case"TEXTAREA":return C(t,e.settings);case"INPUTBOX":return R(t,e.settings);case"SELECTBOX":return S(t,e.settings);case"IMAGE":return D(t,e.settings);case"TOGGLE":return A(t,e.settings);case"BUTTON":return h(t,e.settings);default:return}}function ae(e){return"type"in e&&("text"in e||"image"in e)}function O(e,n){const t=new RegExp(/^https?:\/\//);return e!==void 0&&t.test(e)?e:`${n}/${e}`}function ue(){const e=c(),n=i(()=>{const a=e.content.value.logo;if(a!==void 0){if(ae(a))return a;throw new Error("Element logo is not LOGO")}}),t=i(()=>n.value?.type),o=i(()=>n.value?.text),l=i(()=>n.value?.image===void 0?"":e.context.value.imageBuckets?.[n.value.image.bucket]),r=i(()=>({lowResolutionMobileImage:O(n.value?.image?.set?.["cropped-webp-100x200"]?.url,l.value),highResolutionMobileImage:O(n.value?.image?.set?.["cropped-webp-1000x2000"]?.url,l.value),lowResolutionDesktopImage:O(n.value?.image?.set?.["webp-200x200"]?.url,l.value),highResolutionDesktopImage:O(n.value?.image?.set?.["webp-2000x2000"]?.url,l.value)}));return d({type:t,text:o,image:r})}function G(e,n){if(n===void 0)return;if(!n.startsWith("global."))return n.replaceAll("_"," ");const t=n.split(".").at(2);if(t!==void 0)return e.fontFamily?e.fontFamily[t].replaceAll("_"," "):void 0}function I(e,n,t){return n?G(e,n):G(e,t)}function N(e,n){if(n===void 0)return;if(typeof n!="string"||!n.startsWith("global."))return n;const t=n.split(".").at(2);if(t!==void 0)return e.textSize?e.textSize[t]:void 0}function y(e,n,t){return n?N(e,n):N(e,t)}function B(e,n){if(n===void 0)return;if(typeof n!="string"||!n.startsWith("global."))return n;const t=n.split(".").at(2);if(t!==void 0)return e.color?e.color[t]:void 0}function p(e,n,t){return n?B(e,n):B(e,t)}function se(e,n,t){return{visible:n?.visible??t?.visible??!1,width:n?.width??t?.width??1,color:p(e,n?.color,t?.color)}}function ce(e){const n=c(),t=i(()=>{const s=n.design.value[e],u=n.defaults.value[e],f=n.globalDesign.value;return{font:I(f,s?.font,u?.font),size:y(f,s?.size,u?.size),bold:s?.bold??u?.bold,italic:s?.italic??u?.italic,color:p(f,s?.color,u?.color),visible:s?.visible??u?.visible??!1}}),o=i(()=>t.value?.font),l=i(()=>t.value?.size),r=i(()=>t.value?.bold),a=i(()=>t.value?.italic),v=i(()=>t.value?.color),g=i(()=>t.value?.visible);return d({font:o,size:l,bold:r,italic:a,color:v,visible:g})}function ve(e){const n=c(),t=i(()=>{const u=n.design.value[e],f=n.defaults.value[e],m=n.globalDesign.value;return{font:I(m,u?.font,f?.font),size:y(m,u?.size,f?.size),bold:u?.bold??f?.bold,italic:u?.italic??f?.italic,color:p(m,u?.color,f?.color),visible:u?.visible??f?.visible??!1,whiteSpace:"pre-wrap"}}),o=i(()=>t.value?.font),l=i(()=>t.value?.size),r=i(()=>t.value?.bold),a=i(()=>t.value?.italic),v=i(()=>t.value?.color),g=i(()=>t.value?.visible),s=i(()=>t.value?.whiteSpace);return d({font:o,size:l,bold:r,italic:a,color:v,visible:g,whiteSpace:s})}function de(e){const n=c(),t=i(()=>{const s=n.design.value[e],u=n.defaults.value[e],f=n.globalDesign.value;return{appearance:s?.appearance??u?.appearance,font:I(f,s?.font,u?.font),size:s?.size??u?.size,style:s?.style??u?.style,color:p(f,s?.color,u?.color),visible:s?.visible??u?.visible??!1}}),o=i(()=>t.value?.appearance),l=i(()=>t.value?.font),r=i(()=>t.value?.size),a=i(()=>t.value?.style),v=i(()=>t.value?.color),g=i(()=>t.value?.visible);return d({appearance:o,font:l,size:r,style:a,color:v,visible:g})}function fe(e){const n=c(),t=i(()=>{const r=n.design.value[e],a=n.defaults.value[e],v=n.globalDesign.value;return{overlay:{type:r?.overlay?.type??a?.overlay?.type,solid:{color:p(v,r?.overlay?.solid?.color,a?.overlay?.solid?.color)},gradient:{fromColor:p(v,r?.overlay?.gradient?.fromColor,a?.overlay?.gradient?.fromColor),toColor:p(v,r?.overlay?.gradient?.toColor,a?.overlay?.gradient?.toColor)}},visible:r?.visible??a?.visible??!1}}),o=i(()=>t.value?.overlay),l=i(()=>t.value?.visible);return d({overlay:o,visible:l})}function ge(e){const n=c(),t=i(()=>{const l=n.design.value[e],r=n.defaults.value[e];return{enabled:l?.enabled??r?.enabled}}),o=i(()=>t.value?.enabled);return d({enabled:o})}function pe(e){const n=c(),t=i(()=>{const l=n.design.value[e],r=n.defaults.value[e];return{value:l?.value??r?.value}}),o=i(()=>t.value?.value);return d({value:o})}function be(e){const n=c(),t=i(()=>{const l=n.design.value[e],r=n.defaults.value[e],a=n.globalDesign.value;return{background:{type:l?.background?.type??r?.background?.type,solid:{color:p(a,l?.background?.solid?.color,r?.background?.solid?.color)},gradient:{fromColor:p(a,l?.background?.gradient?.fromColor,r?.background?.gradient?.fromColor),toColor:p(a,l?.background?.gradient?.toColor,r?.background?.gradient?.toColor)}}}}),o=i(()=>t.value?.background);return d({background:o})}function Ee(){const e=c(),n=i(()=>e.design.value.layout),t=i(()=>n.value);return d({layout:t})}function me(){const e=c();return i(()=>{const n=e.design.value.logo,t=e.defaults.value.logo,o=e.globalDesign.value;return{font:I(o,n?.font,t?.font),size:y(o,n?.size,t?.size),bold:n?.bold??t?.bold,italic:n?.italic??t?.italic,color:p(o,n?.color,t?.color),visible:n?.visible??t?.visible??!1,spacing:n?.spacing??t?.spacing??0,capitalization:n?.capitalization??t?.capitalization??"none",frame:se(o,n?.frame,t?.frame)}})}function z(e){return{app:U(e)}}function Te(e,n){return{init:()=>{const{app:t}=z(e);return n?.init?.(t),{render:async(o,l)=>(c().init(t,o,l.content,l.design,l.defaults,l.externalContent,o.globalDesign),n?.render?.(t,o,l),{html:await K(t,{context:o}),state:{context:o,data:l}})}}}}function Oe(e,n){return{init:()=>{const{app:t}=z(e);return n?.init?.(t),{mount:(o,l)=>{c().init(t,l.context,l.data.content,l.data.design,l.data.defaults,l.data.externalContent,l.context.globalDesign),n?.mount?.(t,o,l),t.mount(o)},update:o=>{c().update(t,o.data.content,o.data.design,o.data.defaults,o.data.externalContent,o.context.globalDesign),n?.update?.(t,o)},unmount:()=>{n?.unmount?.(t),t.unmount()}}}}}function Ie(){return globalThis.window.instantsite}const _e={PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER"},we={CATEGORY_TITLE:"MAIN_TITLE",PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER"},ye={TOP_BAR:"TOP_BAR",GALLERY:"GALLERY",SIDEBAR:"SIDEBAR",DESCRIPTION:"DESCRIPTION",REVIEW_LIST:"REVIEW_LIST",RELATED_PRODUCTS:"RELATED_PRODUCTS",BOTTOM_BAR:"FOOTER"};export{_e as CatalogLayoutSlot,we as CategoryLayoutSlot,k as EditorTypes,ye as ProductLayoutSlot,Oe as createVueClientApp,Te as createVueServerApp,be as useBackgroundElementDesign,h as useButtonElementContent,de as useButtonElementDesign,le as useDeckElementContent,D as useImageElementContent,fe as useImageElementDesign,R as useInputboxElementContent,Ie as useInstantsiteJsApi,Ee as useLayoutElementDesign,ue as useLogoElementContent,me as useLogoElementDesign,x as useMenuElementContent,oe as useNavigationMenuElementContent,S as useSelectboxElementContent,pe as useSelectboxElementDesign,ce as useTextElementDesign,C as useTextareaElementContent,ve as useTextareaElementDesign,A as useToggleElementContent,ge as useToggleElementDesign,c as useVueBaseProps};
1
+ import{getCurrentInstance as P,ref as b,computed as i,reactive as d,createSSRApp as U}from"vue";import{renderToString as K}from"vue/server-renderer";const C=new Map;function c(){const e=(l,r,a,v,g,s,u)=>{C.set(l._uid,{context:b(r),content:b(a),design:b(v),defaults:b(g),site:b(s?.site??{}),category:b(s?.category),globalDesign:b(u)})},n=(l,r,a,v,g,s)=>{const u=C.get(l._uid);u!==void 0&&(u.content.value=r,u.design.value=a,u.defaults.value=v,u.site.value=g.site??{},u.category.value=g.category,u.globalDesign.value=s)},t=P()?.appContext.app._uid??-1,o=C.get(t);return{init:e,update:n,context:o?.context,content:o?.content,design:o?.design,defaults:o?.defaults,site:o?.site,category:o?.category,globalDesign:o?.globalDesign}}function w(e,n){const t=c(),o=i(()=>n!==void 0?n:t.content.value);return F(o,e)}function F(e,n){const t=i(()=>{const r=e.value[n];if(r!==void 0){if(typeof r=="string")return r;throw new Error(`Element ${n} is not inputbox`)}}),o=i(()=>t.value!==void 0),l=i(()=>t.value);return d({hasContent:o,value:l})}function y(e,n){const t=c(),o=i(()=>n!==void 0?n:t.content.value);return W(o,e)}function W(e,n){const t=i(()=>{const r=e.value[n];if(r!==void 0){if(typeof r=="string")return r;throw new Error(`Element ${n} is not textarea`)}}),o=i(()=>t.value!==void 0),l=i(()=>t.value);return d({hasContent:o,value:l})}const T={HYPER_LINK:"HYPER_LINK",SCROLL_TO_TILE:"SCROLL_TO_TILE",MAIL_LINK:"MAIL_LINK",TEL_LINK:"TEL_LINK",GO_TO_STORE:"GO_TO_STORE",GO_TO_STORE_LINK:"GO_TO_STORE_LINK",GO_TO_PAGE:"GO_TO_PAGE",GO_TO_CATEGORY:"GO_TO_CATEGORY"};function X(e){if("tileId"in e)return e.tileId;if("tileIdForScroll"in e)return e.tileIdForScroll}function Y(e){if("pageId"in e)return e.pageId;if("pageIdForNavigate"in e)return e.pageIdForNavigate}function V(e){if("pageUrl"in e)return e.pageUrl;switch(Y(e)){case"products":return"/products";case"cart":return"/cart";case"account":return"/account";case"search":return"/search";case"home":default:return"/"}}const R=(e,n)=>{if(!e||n)return;const{type:t,link:o,email:l,phone:r}=e,a=V(e);switch(t){case T.HYPER_LINK:if(o)return()=>window.open(o,"_blank");break;case T.GO_TO_STORE:case T.GO_TO_STORE_LINK:return()=>window.open("/products","_self");case T.MAIL_LINK:if(l)return()=>window.open(`mailto:${l}`,"_self");break;case T.TEL_LINK:if(r)return()=>window.open(`tel:${r}`,"_self");break;case T.SCROLL_TO_TILE:if(typeof document<"u")return()=>{const v=X(e);document.getElementById(`tile-${v}`)?.scrollIntoView()};break;case T.GO_TO_PAGE:if(a)return()=>window.open(a,"_self");break;default:console.error(`Unknown type of ActionLink: ${t}`)}};function H(e){return"title"in e&&"type"in e}function j(e,n,t){const o=i(()=>{const I=e.value[n];if(I!==void 0){if(H(I))return I;throw new Error(`Element ${n} is not action link`)}}),l=i(()=>o.value?.title),r=i(()=>o.value?.type),a=i(()=>o.value?.link),v=i(()=>o.value?.email),g=i(()=>o.value?.phone),s=i(()=>o.value?.tileId?`tile-${o.value?.tileId}`:null),u=i(()=>o.value?.type==="GO_TO_STORE_LINK"?"products":o.value?.pageId),f=i(()=>o.value?.pageUrl),E=i(()=>!!l.value),z=i(()=>!!a.value),$=R(o.value,t);return d({title:l,type:r,link:a,email:v,phone:g,tileDivId:s,pageId:u,pageUrl:f,hasTitle:E,hasLink:z,performAction:$})}function S(e,n){const t=c(),o=i(()=>!!t.site?.value?.isPreviewMode),l=i(()=>n!==void 0?n:t.content.value!==void 0?t.content.value:{});return j(l,e,o.value)}function J(e){return"bucket"in e&&"borderInfo"in e&&"set"in e}function m(e,n){const t=new RegExp(/^https?:\/\//);return e!=null&&t.test(e)?e:`${n}/${e}`}function h(e,n){const t=c(),o=i(()=>n!==void 0?n:t.content.value);return q(o,e)}function q(e,n){const t=i(()=>{const s=e.value[n];if(s!==void 0){if(J(s))return s;throw new Error(`Element ${n} is not image`)}}),o=i(()=>t.value===void 0?"":c().context.value.imageBuckets?.[t.value?.bucket]),l=i(()=>t.value!==void 0),r=i(()=>m(t.value?.set?.["cropped-webp-100x200"]?.url,o.value)),a=i(()=>m(t.value?.set?.["cropped-webp-1000x2000"]?.url,o.value)),v=i(()=>m(t.value?.set?.["webp-200x200"]?.url,o.value)),g=i(()=>m(t.value?.set?.["webp-2000x2000"]?.url,o.value));return d({hasContent:l,lowResolutionMobileImage:r,highResolutionMobileImage:a,lowResolutionDesktopImage:v,highResolutionDesktopImage:g})}function Q(e){return"enabled"in e}function D(e,n){const t=c(),o=i(()=>n!==void 0?n:t.content.value);return Z(o,e)}function Z(e,n){const t=i(()=>{const r=e.value[n];if(r!==void 0){if(Q(r))return r;throw new Error(`Element ${n} is not toggle`)}}),o=i(()=>t.value!==void 0),l=i(()=>t.value?.enabled);return d({hasContent:o,value:l})}function A(e,n){const t=c(),o=i(()=>n!==void 0?n:t.content.value);return ee(o,e)}function ee(e,n){const t=i(()=>{const r=e.value[n];if(r!==void 0){if(typeof r=="string")return r;throw new Error(`Element ${n} is not selectbox`)}}),o=i(()=>t.value!==void 0),l=i(()=>t.value);return d({hasContent:o,value:l})}function te(e){return e!==null&&"items"in e}function x(e){const n=c(),t=i(()=>{const a=n.content.value[e];if(a!==void 0){if(te(a))return a;throw new Error(`Element ${e} is not an menu`)}}),o=i(()=>!!n.site?.value?.isPreviewMode),l=i(()=>t.value!==void 0),r=i(()=>t.value?.items?t.value.items.map(a=>({...a,performAction:R(a,o.value)})):[]);return d({hasContent:l,items:r})}const ne="menu";function oe(){return x(ne)}var k=(e=>(e.INPUTBOX="INPUTBOX",e.TEXTAREA="TEXTAREA",e.BUTTON="BUTTON",e.IMAGE="IMAGE",e.TOGGLE="TOGGLE",e.SELECTBOX="SELECTBOX",e))(k||{});function ie(e){if(typeof e!="object"||e===null)return!1;const n=e;return Array.isArray(n.cards)&&n.cards.every(t=>typeof t.settings=="object"&&t.settings!==null)}function le(e){const n=c(),t=i(()=>{const r=n.content.value[e];if(r!==void 0){if(ie(r))return r;throw new Error(`Element ${e} is not of DECK type`)}}),o=i(()=>t.value!==void 0&&t.value.cards.length>0),l=i(()=>t.value?.cards);return d({hasContent:o,cards:l,getReactiveRef:re})}function re(e,n,t){if(e==null)throw Error("Could not get a reactive ref for undefined Card");const o=e.settings[t];if(o===void 0)return o;switch(n){case"TEXTAREA":return y(t,e.settings);case"INPUTBOX":return w(t,e.settings);case"SELECTBOX":return A(t,e.settings);case"IMAGE":return h(t,e.settings);case"TOGGLE":return D(t,e.settings);case"BUTTON":return S(t,e.settings);default:return}}function ae(e){return"type"in e&&("text"in e||"image"in e)}function O(e,n){const t=new RegExp(/^https?:\/\//);return e!==void 0&&t.test(e)?e:`${n}/${e}`}function ue(){const e=c(),n=i(()=>{const a=e.content.value.logo;if(a!==void 0){if(ae(a))return a;throw new Error("Element logo is not LOGO")}}),t=i(()=>n.value?.type),o=i(()=>n.value?.text),l=i(()=>n.value?.image===void 0?"":e.context.value.imageBuckets?.[n.value.image.bucket]),r=i(()=>({lowResolutionMobileImage:O(n.value?.image?.set?.["cropped-webp-100x200"]?.url,l.value),highResolutionMobileImage:O(n.value?.image?.set?.["cropped-webp-1000x2000"]?.url,l.value),lowResolutionDesktopImage:O(n.value?.image?.set?.["webp-200x200"]?.url,l.value),highResolutionDesktopImage:O(n.value?.image?.set?.["webp-2000x2000"]?.url,l.value)}));return d({type:t,text:o,image:r})}function G(e,n){if(n===void 0)return;if(!n.startsWith("global."))return n.replaceAll("_"," ");const t=n.split(".").at(2);if(t!==void 0)return e.fontFamily?e.fontFamily[t].replaceAll("_"," "):void 0}function _(e,n,t){return n?G(e,n):G(e,t)}function N(e,n){if(n===void 0)return;if(typeof n!="string"||!n.startsWith("global."))return n;const t=n.split(".").at(2);if(t!==void 0)return e.textSize?e.textSize[t]:void 0}function L(e,n,t){return n?N(e,n):N(e,t)}function B(e,n){if(n===void 0)return;if(typeof n!="string"||!n.startsWith("global."))return n;const t=n.split(".").at(2);if(t!==void 0)return e.color?e.color[t]:void 0}function p(e,n,t){return n?B(e,n):B(e,t)}function se(e,n,t){return{visible:n?.visible??t?.visible??!1,width:n?.width??t?.width??1,color:p(e,n?.color,t?.color)}}function ce(e){const n=c(),t=i(()=>{const s=n.design.value[e],u=n.defaults.value[e],f=n.globalDesign.value;return{font:_(f,s?.font,u?.font),size:L(f,s?.size,u?.size),bold:s?.bold??u?.bold,italic:s?.italic??u?.italic,color:p(f,s?.color,u?.color),visible:s?.visible??u?.visible??!1}}),o=i(()=>t.value?.font),l=i(()=>t.value?.size),r=i(()=>t.value?.bold),a=i(()=>t.value?.italic),v=i(()=>t.value?.color),g=i(()=>t.value?.visible);return d({font:o,size:l,bold:r,italic:a,color:v,visible:g})}function ve(e){const n=c(),t=i(()=>{const u=n.design.value[e],f=n.defaults.value[e],E=n.globalDesign.value;return{font:_(E,u?.font,f?.font),size:L(E,u?.size,f?.size),bold:u?.bold??f?.bold,italic:u?.italic??f?.italic,color:p(E,u?.color,f?.color),visible:u?.visible??f?.visible??!1,whiteSpace:"pre-wrap"}}),o=i(()=>t.value?.font),l=i(()=>t.value?.size),r=i(()=>t.value?.bold),a=i(()=>t.value?.italic),v=i(()=>t.value?.color),g=i(()=>t.value?.visible),s=i(()=>t.value?.whiteSpace);return d({font:o,size:l,bold:r,italic:a,color:v,visible:g,whiteSpace:s})}function de(e){const n=c(),t=i(()=>{const s=n.design.value[e],u=n.defaults.value[e],f=n.globalDesign.value;return{appearance:s?.appearance??u?.appearance,font:_(f,s?.font,u?.font),size:s?.size??u?.size,style:s?.style??u?.style,color:p(f,s?.color,u?.color),visible:s?.visible??u?.visible??!1}}),o=i(()=>t.value?.appearance),l=i(()=>t.value?.font),r=i(()=>t.value?.size),a=i(()=>t.value?.style),v=i(()=>t.value?.color),g=i(()=>t.value?.visible);return d({appearance:o,font:l,size:r,style:a,color:v,visible:g})}function fe(e){const n=c(),t=i(()=>{const r=n.design.value[e],a=n.defaults.value[e],v=n.globalDesign.value;return{overlay:{type:r?.overlay?.type??a?.overlay?.type,solid:{color:p(v,r?.overlay?.solid?.color,a?.overlay?.solid?.color)},gradient:{fromColor:p(v,r?.overlay?.gradient?.fromColor,a?.overlay?.gradient?.fromColor),toColor:p(v,r?.overlay?.gradient?.toColor,a?.overlay?.gradient?.toColor)}},visible:r?.visible??a?.visible??!1}}),o=i(()=>t.value?.overlay),l=i(()=>t.value?.visible);return d({overlay:o,visible:l})}function ge(e){const n=c(),t=i(()=>{const l=n.design.value[e],r=n.defaults.value[e];return{enabled:l?.enabled??r?.enabled}}),o=i(()=>t.value?.enabled);return d({enabled:o})}function pe(e){const n=c(),t=i(()=>{const l=n.design.value[e],r=n.defaults.value[e];return{value:l?.value??r?.value}}),o=i(()=>t.value?.value);return d({value:o})}function be(e){const n=c(),t=i(()=>{const l=n.design.value[e],r=n.defaults.value[e],a=n.globalDesign.value;return{background:{type:l?.background?.type??r?.background?.type,solid:{color:p(a,l?.background?.solid?.color,r?.background?.solid?.color)},gradient:{fromColor:p(a,l?.background?.gradient?.fromColor,r?.background?.gradient?.fromColor),toColor:p(a,l?.background?.gradient?.toColor,r?.background?.gradient?.toColor)}}}}),o=i(()=>t.value?.background);return d({background:o})}function Te(){const e=c(),n=i(()=>e.design.value.layout),t=i(()=>n.value);return d({layout:t})}function Ee(){const e=c();return i(()=>{const n=e.design.value.logo,t=e.defaults.value.logo,o=e.globalDesign.value;return{font:_(o,n?.font,t?.font),size:L(o,n?.size,t?.size),bold:n?.bold??t?.bold,italic:n?.italic??t?.italic,color:p(o,n?.color,t?.color),visible:n?.visible??t?.visible??!1,spacing:n?.spacing??t?.spacing??0,capitalization:n?.capitalization??t?.capitalization??"none",frame:se(o,n?.frame,t?.frame)}})}function M(e){return{app:U(e)}}function me(e,n){return{init:()=>{const{app:t}=M(e);return n?.init?.(t),{render:async(o,l)=>(c().init(t,o,l.content,l.design,l.defaults,l.externalContent,o.globalDesign),n?.render?.(t,o,l),{html:await K(t,{context:o}),state:{context:o,data:l}})}}}}function Oe(e,n){return{init:()=>{const{app:t}=M(e);return n?.init?.(t),{mount:(o,l)=>{c().init(t,l.context,l.data.content,l.data.design,l.data.defaults,l.data.externalContent,l.context.globalDesign),n?.mount?.(t,o,l),t.mount(o)},update:o=>{c().update(t,o.data.content,o.data.design,o.data.defaults,o.data.externalContent,o.context.globalDesign),n?.update?.(t,o)},unmount:()=>{n?.unmount?.(t),t.unmount()}}}}}function _e(){return globalThis.window.instantsite}const Ie={PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},Ce={CATEGORY_TITLE:"MAIN_TITLE",PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},Le={TOP_BAR:"TOP_BAR",GALLERY:"GALLERY",SIDEBAR:"SIDEBAR",DESCRIPTION:"DESCRIPTION",REVIEW_LIST:"REVIEW_LIST",RELATED_PRODUCTS:"RELATED_PRODUCTS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"};export{Ie as CatalogLayoutSlot,Ce as CategoryLayoutSlot,k as EditorTypes,Le as ProductLayoutSlot,Oe as createVueClientApp,me as createVueServerApp,be as useBackgroundElementDesign,S as useButtonElementContent,de as useButtonElementDesign,le as useDeckElementContent,h as useImageElementContent,fe as useImageElementDesign,w as useInputboxElementContent,_e as useInstantsiteJsApi,Te as useLayoutElementDesign,ue as useLogoElementContent,Ee as useLogoElementDesign,x as useMenuElementContent,oe as useNavigationMenuElementContent,A as useSelectboxElementContent,pe as useSelectboxElementDesign,ce as useTextElementDesign,y as useTextareaElementContent,ve as useTextareaElementDesign,D as useToggleElementContent,ge as useToggleElementDesign,c as useVueBaseProps};
package/dist/cli.mjs CHANGED
@@ -1,10 +1,10 @@
1
- import Is from"cac";import*as Q from"path";import y,{sep as k,resolve as f,parse as F,dirname as Cs}from"path";import{red as Ps,yellow as Ns,green as R}from"kolorist";import Te from"prompts";import b from"node:fs";import P from"node:path";import T from"node:process";import*as ee from"fs";import u,{existsSync as j,statSync as Ls,rename as we,unlink as je,promises as se,writeFileSync as xs,createReadStream as ks}from"fs";import{pathToFileURL as Oe}from"url";import{fileURLToPath as Fs}from"node:url";import Rs from"adm-zip";import{glob as p,globSync as Se}from"glob";import{defineConfig as _e,build as ne,createServer as Gs}from"vite";import Ms from"ajv/dist/2020.js";import Bs from"ajv-formats";import qs from"node:zlib";import{promisify as Us}from"node:util";import{JSONPath as zs}from"jsonpath-plus";import{builtinModules as ve}from"module";import{viteExternalsPlugin as De}from"vite-plugin-externals";import Xs from"vite-plugin-compression";import Hs from"@vitejs/plugin-vue";import Vs from"vite-tsconfig-paths";import Ks from"vite-plugin-checker";import{readFile as Ae}from"fs/promises";import Ys,{AxiosError as Ie}from"axios";import{inc as Js}from"semver";import*as A from"process";import I from"process";import{ConcurrencyManager as Ws}from"axios-concurrency";import Zs from"cli-progress";import Qs from"tinycolor2";function U(e,t=2){if(!+e)return"0 Bytes";const o=1024,s=t<0?0:t,n=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],r=Math.floor(Math.log(e)/Math.log(o));return`${parseFloat((e/o**r).toFixed(s))} ${n[r]}`}const a={error:e=>console.log(Ps(e)),warn:e=>console.log(Ns(e)),info:e=>console.log(R(e))},C="_temp",E="dist/sections",z="dist/headers",X="dist/footers",_="dist/templates",Ce="layouts",re=`dist/${Ce}`,Pe=2*1024*1024,Ne=300*1024;function te(e){return!!e}function Le(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function xe(e){return e.split(k).slice(1,-1).join(k)}const en="Resource name can only contain alphanumeric characters, dashes, and underscores";function tn(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:en}}function on(e){return e===!0?!0:typeof e=="string"&&e.trim().length===0}async function G(e,t){try{const o=f(process.cwd(),t?`${e}${C}.mjs`:`${e}.mjs`);return(await import(Oe(o).href)).default}catch{throw new Error(`File [${e}${C}.mjs] is either invalid or undefined`)}}function ke(e){return Object.keys(e).length===0}function sn(e){return y.parse(e).name}var nn=(e=>(e.SingleFile="single-file",e.MultiPage="multi-page",e))(nn||{});function Fe(e,t){ee.statSync(e).isDirectory()?(ee.mkdirSync(t,{recursive:!0}),ee.readdirSync(e).forEach(o=>{const s=Q.resolve(e,o),n=Q.resolve(t,o);Fe(s,n)})):ee.copyFileSync(e,t)}function N(e,t,o,s){const n=Q.join(e,s?.[o]??o);Fe(Q.join(t,o),n)}function rn(e){return e?"multi-page":"single-file"}function an(e,t){return e==="single-file"?{"template.ts":`${t}.ts`}:{"example-template":`${t}`}}function cn(e,t){return e==="single-file"?`${t}.ts`:t}function pn(e){return e==="single-file"?"template/templates":"template/page-templates"}function ln(e,t){return e==="single-file"?()=>a.info(`Template descriptor file [${t}.ts] has been created`):()=>a.info(`Template [${t}] with pages structure named has been created`)}function dn(e,t){const o=rn(t),s=an(o,e),n=cn(o,e),r=pn(o),i=ln(o,e);return{renameFiles:s,targetPath:n,sourcePath:r,onTemplateCreated:i}}function L(e){return P.resolve(Fs(import.meta.url),"../..",e)}function fn(){const e=L("package.json");return e!==""?JSON.parse(b.readFileSync(e,"utf8")):{}}async function un(e){try{const t=e,o=T.cwd(),s=P.join(o,t),n=["templates","headers","footers","reference","page-templates","layouts"],r={_gitignore:".gitignore"};b.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)):b.mkdirSync(s);const i=L("template");b.readdirSync(i).filter($=>$!=="package.json").filter($=>!n.includes($)).forEach(async $=>N(s,i,$,r));const c=JSON.parse(b.readFileSync(P.join(i,"package.json"),"utf-8"));c.name=e;const l=fn();l.version&&(c.dependencies["@lightspeed/crane"]=l.version),l.dependencies["@lightspeed/eslint-config-crane"]&&(c.dependencies["@lightspeed/eslint-config-crane"]=l.dependencies["@lightspeed/eslint-config-crane"]);const d=P.join(s,"package.json");b.writeFileSync(d,`${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 ie(e,t,o,s){try{const n=T.cwd(),r=y.join(n,t);u.existsSync(r)||u.mkdirSync(r);const i=y.join(n,t,o);u.existsSync(i)?(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(i);const c=L(e);u.readdirSync(c).forEach(async l=>N(i,c,l)),a.info(`${s} ${o} created`)}catch(n){a.error(`Error while creating ${s}: ${n.message}`),T.exit(1)}}function ae(e){const t=T.cwd(),o=L(`template/${e}`),s=y.join(t,e);u.existsSync(s)||(u.mkdirSync(s),u.readdirSync(o).forEach(async n=>N(s,o,n)))}function mn(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 Re(e,t){const o=u.readdirSync(e,{withFileTypes:!0});u.existsSync(t)||u.mkdirSync(t,{recursive:!0}),o.forEach(s=>{const n=y.join(e,s.name),r=y.join(t,s.name);s.isDirectory()?Re(n,r):mn(s,n,r)})}function ce(){try{const e=T.cwd(),t=y.join(e,"shared"),o=L("template/shared");if(!u.existsSync(o))return;Re(o,t)}catch(e){a.error(`Error while processing shared folder: ${e.message}`),T.exit(1)}}async function yn(e){ce(),ie("template/sections/example-section","sections",e,"Section")}async function gn(e,t){const{targetPath:o,renameFiles:s,sourcePath:n,onTemplateCreated:r}=dn(e,t);try{const i=T.cwd(),c=P.join(i,"templates"),l=L(n),d=b.readdirSync(l);b.existsSync(c)?b.existsSync(P.join(c,o))&&(a.error(`Template with the name: ${e} already exists. If you'd like to override it, delete previous version first`),T.exit(1)):b.mkdirSync(c),d.forEach($=>N(c,l,$,s)),ae("headers"),ae("footers"),t&&ae("layouts"),r()}catch(i){a.error(`Error while creating template descriptors: ${i.message}`),T.exit(1)}}async function hn(){try{const e=T.cwd(),t=L("template/reference"),o=b.readdirSync(t);let s=!1;for(const n of o){const r=P.join(t,n),i=P.join(e,n);b.existsSync(i)||b.mkdirSync(i,{recursive:!0});const c=b.readdirSync(r),l=b.readdirSync(i);if(n==="shared"){c.forEach(d=>{N(i,r,d)});continue}for(const d of c){if(d==="assets"){N(i,r,d);continue}if(l.includes(d)){const{name:$}=await Te({type:"text",name:"name",message:`The "${d}" already exists in ${n} directory: provide a new name to keep both or press Esc to skip this one.`});$?(N(i,r,d,{[d]:$}),s=!0):a.info(`Skipped: ${d}`)}else N(i,r,d)}}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)}}const Ge="https://json-schema.org/draft/2020-12/schema",Me="https://lightspeedhq.com/template-default.schema.json",Be="Default Section",qe="Default section for a Custom Template",Ue="object",ze={"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}},$n={$schema:Ge,$id:Me,title:Be,description:qe,type:Ue,$defs:ze},Xe={__proto__:null,$defs:ze,$id:Me,$schema:Ge,default:$n,description:qe,title:Be,type:Ue},He="https://json-schema.org/draft/2020-12/schema",Ve="https://lightspeedhq.com/template-custom.schema.json",Ke="Custom Section",Ye="Custom section for a Custom Template",Je="object",We={"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}},bn={$schema:He,$id:Ve,title:Ke,description:Ye,type:Je,$defs:We},Ze={__proto__:null,$defs:We,$id:Ve,$schema:He,default:bn,description:Ye,title:Ke,type:Je},Qe="https://json-schema.org/draft/2020-12/schema",et="https://lightspeedhq.com/template-custom-content.schema.json",tt="Custom Section :: Content Configuration",ot="Content tab configuration of a Custom Section for a Custom Template",st="object",nt={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"]}},En={$schema:Qe,$id:et,title:tt,description:ot,type:st,$defs:nt},rt={__proto__:null,$defs:nt,$id:et,$schema:Qe,default:En,description:ot,title:tt,type:st},it="https://json-schema.org/draft/2020-12/schema",at="https://lightspeedhq.com/template-custom-design.schema.json",ct="Custom Section :: Design Configuration",pt="Design tab configuration of a Custom Section for a Custom Template",lt="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}},Tn={$schema:it,$id:at,title:ct,description:pt,type:lt,$defs:dt},ft={__proto__:null,$defs:dt,$id:at,$schema:it,default:Tn,description:pt,title:ct,type:lt},ut="https://json-schema.org/draft/2020-12/schema",mt="https://lightspeedhq.com/section-content.schema.json",yt="Custom Section - Content",gt="The content of a custom section",ht="object",$t={"^.*$":{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"}}]}},bt={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"]}},Et=!1,wn={$schema:ut,$id:mt,title:yt,description:gt,type:ht,patternProperties:$t,$defs:bt,additionalProperties:Et},Tt={__proto__:null,$defs:bt,$id:mt,$schema:ut,additionalProperties:Et,default:wn,description:gt,patternProperties:$t,title:yt,type:ht},wt="https://json-schema.org/draft/2020-12/schema",jt="https://lightspeedhq.com/sections/section-translation.schema.json",Ot="Custom Section - Translations",St="The translation of the section's labels",_t="object",vt={"^[a-z]{2}$":{type:"object",patternProperties:{"^\\$.*$":{type:"string"}},additionalProperties:!1}},Dt=!1,jn={$schema:wt,$id:jt,title:Ot,description:St,type:_t,patternProperties:vt,additionalProperties:Dt},At={__proto__:null,$id:jt,$schema:wt,additionalProperties:Dt,default:jn,description:St,patternProperties:vt,title:Ot,type:_t},It="https://json-schema.org/draft/2020-12/schema",Ct="https://lightspeedhq.com/section-design.schema.json",Pt="Custom Section - Design",Nt="The design of a custom section",Lt="object",xt={"^.*$":{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}},kt={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:[]}},On={$schema:It,$id:Ct,title:Pt,description:Nt,type:Lt,patternProperties:xt,$defs:kt},Ft={__proto__:null,$defs:kt,$id:Ct,$schema:It,default:On,description:Nt,patternProperties:xt,title:Pt,type:Lt},Rt="https://json-schema.org/draft/2020-12/schema",Gt="https://lightspeedhq.com/section-commons.schema.json",Mt="Custom Section - Content",Bt="The content of a custom section",qt="object",Ut={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"}}}},zt=!1,Sn={$schema:Rt,$id:Gt,title:Mt,description:Bt,type:qt,$defs:Ut,additionalProperties:zt},Xt={__proto__:null,$defs:Ut,$id:Gt,$schema:Rt,additionalProperties:zt,default:Sn,description:Bt,title:Mt,type:qt},Ht="https://json-schema.org/draft/2020-12/schema",Vt="https://lightspeedhq.com/section-showcase.schema.json",Kt="Custom Section - Showcase settings",Yt="The setting of a showcase",Jt="object",Wt=["showcaseId","previewImage"],Zt=[{properties:{showcaseId:{description:"Showcase id of the section",type:"string"},previewImage:{$ref:"section-commons.schema.json#/$defs/Image"}}},{$ref:"../showcase_overrides.schema.json"}],_n={$schema:Ht,$id:Vt,title:Kt,description:Yt,type:Jt,required:Wt,allOf:Zt},Qt={__proto__:null,$id:Vt,$schema:Ht,allOf:Zt,default:_n,description:Yt,required:Wt,title:Kt,type:Jt},eo="https://json-schema.org/draft/2020-12/schema",to="https://lightspeedhq.com/template.schema.json",oo="Custom Template",so="A custom template enclosing the necessary custom and default blocks",no="object",ro={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"],vn={$schema:eo,$id:to,title:oo,description:so,type:no,properties:ro,required:io},ao={__proto__:null,$id:to,$schema:eo,default:vn,description:so,properties:ro,required:io,title:oo,type:no},co="https://json-schema.org/draft/2020-12/schema",po="https://lightspeedhq.com/showcase_overrides.schema.json",lo="Showcase overrides",fo="Overrides for the showcase",uo="object",mo={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"}},Dn={$schema:co,$id:po,title:lo,description:fo,type:uo,properties:mo},yo={__proto__:null,$id:po,$schema:co,default:Dn,description:fo,properties:mo,title:lo,type:uo},go="https://json-schema.org/draft/2020-12/schema",ho="https://lightspeedhq.com/common.schema.json",$o="Common Type Definitions",bo="Common type definitions, used throughout other schemas",Eo="object",To={label_type:{type:"string",pattern:"^\\$.+"}},An={$schema:go,$id:ho,title:$o,description:bo,type:Eo,$defs:To},wo={__proto__:null,$defs:To,$id:ho,$schema:go,default:An,description:bo,title:$o,type:Eo};var pe=(e=>(e.SECTION="SECTION",e.HEADER="HEADER",e.FOOTER="FOOTER",e))(pe||{});const g={SECTION:{source:"sections",dist:"dist/sections"},HEADER:{source:"headers",dist:"dist/headers"},FOOTER:{source:"footers",dist:"dist/footers"}};function H(e){return j(`${z}/${e}`)?"HEADER":j(`${X}/${e}`)?"FOOTER":"SECTION"}function jo(e){const t=H(e);return g[t].dist}var V=(e=>(e.CONTENT="Content",e.DESIGN="Design",e))(V||{});const In={menu:{type:"NAVIGATION_MENU"},logo:{type:"LOGO"}},Cn={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 Oo(e){switch(e){case pe.HEADER:return In;default:return{}}}function So(e){switch(e){case pe.HEADER:return Cn;default:return{}}}function Pn({validationType:e,sectionType:t}){switch(e){case V.CONTENT:return Oo(t);case V.DESIGN:return So(t);default:return{}}}function Nn({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).filter(([s])=>t[s]!==void 0).forEach(([s,n])=>{const r=t[s];n.type!==r.type&&o.push({instancePath:s,keyword:"type-mismatch",message:`Editor type "${n.type}" for reserved key "${s}" does not match the required type "${r.type}".`})}),o}function Ln({type:e,mandatorySettings:t}){return Object.keys(t).find(o=>t[o].type===e)}function xn({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).forEach(([s,n])=>{const r=Ln({type:n.type,mandatorySettings:t});r&&s!==r&&o.push({instancePath:s,keyword:"key-mismatch",message:`Editor key "${s}" for overriden content type "${n.type}" does not match the required key name "${r}".`})}),o}function kn({type:e,mandatorySettings:t}){return Object.keys(t).findLast(o=>t[o].type===e)}function Fn({sectionSettings:e,mandatorySettings:t}){const o=[],s=Object.values(t).map(({type:r})=>r),n=Object.values(e).map(({type:r})=>r);return new Set(n.filter(r=>s.includes(r))).forEach(r=>{if(n.filter(i=>i===r).length>1){const i=kn({type:r,mandatorySettings:t});o.push({instancePath:i,keyword:"duplicate-type",message:`Editor type "${r}" can only be used once.`})}}),o}function Rn(e,t){const{sectionSettings:o,sectionType:s}=t,n=Pn({validationType:e,sectionType:s});return n===void 0||ke(n)?[]:[...Nn({sectionSettings:o,mandatorySettings:n}),...xn({sectionSettings:o,mandatorySettings:n}),...Fn({sectionSettings:o,mandatorySettings:n})]}var m=(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.Layout=8]="Layout",e))(m||{}),oe=(e=>(e.PRODUCT="PRODUCT",e.CATALOG="CATALOG",e.CATEGORY="CATEGORY",e.HOME="HOME",e.CUSTOM="CUSTOM",e))(oe||{});const K={[m.Server]:{type:"server_js_compressed",fileName:"server.js.gz",isSingleton:!0,toPath:({id:e,sectionType:t})=>`${g[t].dist}/${e}/js/main/server/`},[m.Client]:{type:"client_js",fileName:"client.js",isSingleton:!1,toPath:({id:e,sectionType:t})=>`${g[t].dist}/${e}/js/main/client/`},[m.ClientChunks]:{type:"client_js_chunks",isSingleton:!1,toPath:({id:e,sectionType:t})=>`${g[t].dist}/${e}/js/main/client/chunks/`,fileName:"*"},[m.ClientAsset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:({id:e,sectionType:t})=>`${g[t].dist}/${e}/js/main/client/assets/`},[m.Asset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:({id:e,sectionType:t})=>`${g[t].dist}/${e}/assets/`},[m.TemplateAsset]:{type:"template_assets",fileName:"*",isSingleton:!1,toPath:()=>`${_}/assets/`},[m.Dependency]:{type:"dependencies",fileName:"package.json",isSingleton:!0,toPath:()=>{}},[m.SourceCode]:{type:"source_code",fileName:"source-code.zip",isSingleton:!0,toPath:()=>{}},[m.Layout]:{type:"layout",fileName:"index.mjs",isSingleton:!0,toPath:({id:e,layoutId:t})=>`${re}/${e}/${t}/`}},Y=[Xt,Ft,Tt,Qt,ao,Xe,Ze,rt,ft,yo,wo];function M(e,t){const o=new Ms({allErrors:!0,schemas:e});return Bs(o),o.getSchema(t.$id)||o.compile(t)}function Gn(){return M(Y,ao)}function le(e){return e.map(t=>({instancePath:t.instancePath,message:t.message??"",keyword:t.keyword}))}const Mn=e=>(()=>{const t=jo(e.name),o=t.split("/").pop()?.toLowerCase();return[{source:`./${o}/${e.name}/settings/content.ts`,dist:y.resolve(`${t}/${e.name}/js/settings/content`),ajv:M(Y,Tt),validationType:V.CONTENT,sectionName:e.name,type:e.type},{source:`./${o}/${e.name}/settings/design.ts`,dist:y.resolve(`${t}/${e.name}/js/settings/design`),ajv:M(Y,Ft),validationType:V.DESIGN,sectionName:e.name,type:e.type},{source:`./${o}/${e.name}/settings/translations.ts`,dist:y.resolve(`${t}/${e.name}/js/settings/translations`),ajv:M(Y,At),type:e.type},...e.showcaseEntryPoints.map(s=>({source:`./${o}/${e.name}/showcases/${F(s).name}.ts`,dist:y.resolve(`${t}/${e.name}/js/showcases/${F(s).name}`),ajv:M(Y,s.indexOf("translations")===-1?Qt:At),type:e.type,sectionName:e.name}))]})();function Bn(e){const t=n=>{const r=(n??"").split("/").filter(i=>i.length>0);return r.length===0?"$":`$${r.map(i=>`.${i}`).join("")}`};let o=0,s=0;Object.keys(e).forEach(n=>{const r=e[n];o=Math.max(o,Math.max(...r.map(i=>t(i.instancePath).length))),s=Math.max(s,Math.max(...r.map(i=>i.message.length)))}),Object.keys(e).forEach(n=>{const r=e[n].filter((i,c,l)=>c===l.findIndex(d=>`${i.instancePath}${i.message}${i.keyword}`==`${d.instancePath}${d.message}${d.keyword}`));a.error(n),r.filter(i=>i.keyword!=="if").forEach(i=>{a.error(`${t(i.instancePath).padEnd(o," ")} | ${i.message.padEnd(s," ")} | ${i.keyword||"-"}`)})})}function qn(e,t){if(e.validationType===void 0||e.sectionName===void 0)return[];const{sectionName:o,validationType:s}=e,n=H(o);return[...Rn(s,{sectionSettings:t,sectionType:n})]}function _o(e,t){return zs({path:"$..set..url",json:t,resultType:"value"}).map(o=>{if(new RegExp(/^https?:\/\//).test(o))return null;const s=`${e}/assets/${o}`;return j(s)?null:{message:`Image ${o} is missing from assets folder`,keyword:"missing-asset"}}).filter(o=>o!==null)}async function Un(e){const t=await G(e.dist,!1),o={},s=[],n=jo(e.sectionName??"").split("/").pop()?.toLowerCase();return e.ajv(t)||s.push(...le(e.ajv.errors??[])),s.push(...qn(e,t),..._o(`${n}/${e.sectionName}`,t)),s.length>0&&(o[e.source]=s),o}async function zn(e){const t=Us(qs.gunzip),o=await u.promises.readFile(e);return(await t(o)).length}async function Xn(e,t){const o=K[m.Server],s=y.resolve(`${o.toPath({id:e,sectionType:t})}${o.fileName}`),n=await zn(s);if(n>Ne)throw a.error(`Size of individual server file must not exceed threshold [${U(Ne)}]!`),a.error(`${`File: ${s}`.padEnd(s.length+10)}| ${U(n)}`),new Error("Invalid server file size")}function Hn(e){const t=e.reduce((o,s)=>{const n=Ls(s);return n.size>Pe&&(o[s]=U(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 [${U(Pe)}]!`);for(const s in t)a.error(`${`File: ${s}`.padEnd(o+10)}| ${t[s]}`);throw new Error("Invalid asset file size")}}function Vn(e,t,o,s){const n={};return e(t)&&s===void 0?we(`${o}${C}.mjs`,`${o}.mjs`,()=>{}):(je(`${o}${C}.mjs`,()=>{}),n[y.resolve(`./templates/${F(o).name}.ts`)]=[...le(e.errors??[]),...s??[]]),n}var w=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.Misc=2]="Misc",e[e.Layout=3]="Layout",e))(w||{}),h=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.SectionSetting=2]="SectionSetting",e[e.SectionShowcase=3]="SectionShowcase",e[e.SectionAsset=4]="SectionAsset",e[e.TemplateDescriptor=5]="TemplateDescriptor",e[e.PageTemplateDescriptor=6]="PageTemplateDescriptor",e[e.TemplateAsset=7]="TemplateAsset",e[e.Layout=8]="Layout",e))(h||{});const vo="https://json-schema.org/draft/2020-12/schema",Do="https://lightspeedhq.com/metadata.schema.json",Ao="Custom Multi Page Template metadata",Io="Metadata of a multi page template",Co="object",Po={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"}},No=["metadata","header","footer"],Lo=!1,Kn={$schema:vo,$id:Do,title:Ao,description:Io,type:Co,properties:Po,required:No,additionalProperties:Lo},Yn={__proto__:null,$id:Do,$schema:vo,additionalProperties:Lo,default:Kn,description:Io,properties:Po,required:No,title:Ao,type:Co},xo="https://json-schema.org/draft/2020-12/schema",ko="https://lightspeedhq.com/header_footer.schema.json",Fo="Header/Footer definition for a page template",Ro="object",Go=["type","id"],Mo={type:{type:"string",enum:["custom","default"]},id:{type:"string"}},Bo=!1,qo=[{if:{properties:{type:{const:"default"}}},then:{properties:{id:{enum:["header","footer"]}}}}],Jn={$schema:xo,$id:ko,title:Fo,type:Ro,required:Go,properties:Mo,additionalProperties:Bo,allOf:qo},Wn={__proto__:null,$id:ko,$schema:xo,additionalProperties:Bo,allOf:qo,default:Jn,properties:Mo,required:Go,title:Fo,type:Ro},Uo="https://json-schema.org/draft/2020-12/schema",zo="https://lightspeedhq.com/page.schema.json",Xo="Homepage",Ho="Homepage enclosing the necessary custom and default blocks",Vo="object",Ko={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}},Yo=!1,Jo=["sections"],Zn={$schema:Uo,$id:zo,title:Xo,description:Ho,type:Vo,properties:Ko,additionalProperties:Yo,required:Jo},Qn={__proto__:null,$id:zo,$schema:Uo,additionalProperties:Yo,default:Zn,description:Ho,properties:Ko,required:Jo,title:Xo,type:Vo},Wo="https://json-schema.org/draft/2020-12/schema",Zo="https://lightspeedhq.com/page.schema.json",Qo="Custom Page",es="A custom page enclosing the necessary custom and default blocks",ts="object",os={sections:{description:"List of sections contained by this page",type:"array",minItems:1,maxItems:1,uniqueItems:!1,items:{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]},id:{description:"Unique identifier for the section",type:"string"}},required:["type"],allOf:[{if:{properties:{type:{const:"default"}}},then:{$ref:"./product-browser.schema.json"}},{if:{properties:{type:{const:"custom"}}},then:{$ref:"../template-custom.schema.json#/$defs/custom-section"}}]}}},ss=!1,ns=["sections"],er={$schema:Wo,$id:Zo,title:Qo,description:es,type:ts,properties:os,additionalProperties:ss,required:ns},de={__proto__:null,$id:Zo,$schema:Wo,additionalProperties:ss,default:er,description:es,properties:os,required:ns,title:Qo,type:ts},rs="https://json-schema.org/draft/2020-12/schema",is="https://lightspeedhq.com/product-browser.schema.json",as="Product Browser Section",cs="Product browser section for a custom page",ps="object",ls=[{type:"object",properties:{type:{description:"Type of the section",type:"string",const:"default"},id:{description:"Identification of the section",type:"string",enum:["catalog","product","category"]},layout_id:{description:"Layout id of the section",type:"string"}},required:["type","id"],additionalProperties:!1}],tr={$schema:rs,$id:is,title:as,description:cs,type:ps,allOf:ls},or={__proto__:null,$id:is,$schema:rs,allOf:ls,default:tr,description:cs,title:as,type:ps},sr="https://blockbuster.ecwid.com",nr="/api/v1/custom-apps/resources/sections/upload",rr="/api/v1/custom-apps/resources/templates/upload",ir="/api/v1/custom-apps/manifests/sections",ar="/api/v1/custom-apps/manifests/templates",cr=5,pr=3,lr=[m.Server,m.Client,m.ClientChunks,m.ClientAsset,m.Asset],dr=[m.Dependency,m.TemplateAsset,m.SourceCode],B={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.`},ds={catalog:"products",category:"category",product:"product"},fr=e=>ds[e],ur=e=>e in ds,mr=[Xt,Xe,Ze,yo,ft,rt,or,Wn,wo],yr=e=>{const t=[],o={},s=(n,r,i)=>{if(!n){o[e.name]||(o[e.name]=[]),o[e.name].push({instancePath:`/templates/${e.name}/${r}`,message:`Missing file: ${r}`,keyword:"required"});return}t.push({templateName:e.name,source:n,dist:y.resolve(`dist/templates/${e.name}/${r}`),ajv:M(mr,i)})};return s(e.catalogEntrypoint,"catalog",de),s(e.productEntrypoint,"product",de),s(e.homeEntrypoint,"home",Qn),s(e.categoryEntrypoint,"category",de),s(e.configurationEntrypoint,"configuration",Yn),[t,o]};function gr(e,t){if(t.findIndex(o=>o===`${e.id}${k}${e.layout_id}`)===-1)return{instancePath:`/sections/${e.id}/layout_id`,message:`Layout "${e.layout_id}" for section "${e.id}" not found in "layouts/${e.id}/".`,keyword:"layout_not_found"}}async function hr(e,t){const o=(t??[]).map(xe);return e.sections.filter(s=>ur(s.id)).filter(s=>"layout_id"in s).map(s=>gr(s,o)).filter(s=>s!==void 0)}function $r(e){return"sections"in e}async function br(e,t){const o=await G(e.dist,!0),s={},n=[];if(e.ajv(o)?we(`${e.dist}${C}.mjs`,`${e.dist}.mjs`,()=>{}):(n.push(...le(e.ajv.errors??[])),je(`${e.dist}${C}.mjs`,()=>{})),$r(o)){const r=await hr(o,t);n.push(...r)}return n.length>0&&(s[e.source]=n),s}const Er=async(e,t)=>{const[o,s]=yr(e);return(await Promise.all(o.map(n=>br(n,t)))).reduce((n,r)=>(Object.entries(r).forEach(([i,c])=>{n[i]=n[i]?[...n[i],...c]:[...c]}),n),{...s})};async function Tr(e,t,o,s=E){if(t.showcase_overrides?.content!==void 0)if(!j(`${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 G(`${s}/${t.id}/js/settings/content`,!1),r=new Set(Object.keys(n));Object.keys(t.showcase_overrides.content).every(i=>r.has(i))||e.push({instancePath:`/sections/${o}/showcase_overrides/content`,message:"Content descriptor must be a subset of the default content descriptor",keyword:"type"})}}async function wr(e,t,o,s=E){if(t.showcase_overrides?.design!==void 0)if(!j(`${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 G(`${s}/${t.id}/js/settings/design`,!1),r=new Set(Object.keys(n));Object.keys(t.showcase_overrides.design).every(i=>r.has(i))||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=E){if(t.showcase_overrides?.layoutId!==void 0)if(!j(`${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 G(`${s}/${t.id}/js/settings/layout`,!1);new Set(n.map(r=>r.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 fe(e,t,o,s=E){t.showcase_overrides!==void 0&&(await Tr(e,t,o,s),await wr(e,t,o,s),await jr(e,t,o,s))}function ue(e,t,o,s=E){t.showcase_id!==void 0&&(j(`${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=j(`${z}/${t.id}`);!o&&!s&&e.push({instancePath:"/sections/0/id",message:"The first section must be a `header`",keyword:"required"}),s&&(await fe(e,t,0,z),ue(e,t,0,z))}async function Sr(e,t,o){const s=t.id==="footer"&&t.type==="default",n=j(`${X}/${t.id}`);!s&&!n&&e.push({instancePath:`/sections/${o}/id`,message:"The last section must be a `footer`",keyword:"required"}),n&&(await fe(e,t,o,X),ue(e,t,o,X))}async function _r(e,t){t.showcase_overrides&&e.push(..._o(`sections/${t.id}`,t.showcase_overrides))}async function vr(e){const t=await e.sections.reduce(async(o,s,n)=>{const r=await o;return n===0?await Or(r,s):n===e.sections.length-1?await Sr(r,s,e.sections.length-1):s.type==="custom"?j(`${E}/${s.id}`)?(await fe(r,s,n),ue(r,s,n),await _r(r,s)):r.push({instancePath:`/sections/${n}/id`,message:"Custom section must have a corresponding block defined",keyword:"required"}):s.type==="default"&&(s.id==="header"&&r.push({instancePath:`/sections/${n}/id`,message:"Header can only be placed as the first section",keyword:"required"}),s.id==="footer"&&r.push({instancePath:`/sections/${n}/id`,message:"Footer can only be placed as the last section",keyword:"required"})),r},Promise.resolve([]));return t.length>0?t:void 0}async function Dr(){const e=await p("./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(k),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 p(`**/${s}/configuration.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),r=await p(`**/${s}/pages/home.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),i=await p(`**/${s}/pages/category.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),c=await p(`**/${s}/pages/catalog.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),l=await p(`**/${s}/pages/product.{js,ts}`,{ignore:["node_modules/**","dist/**"]});return{name:s,configurationEntrypoint:n.at(0),homeEntrypoint:r.at(0),categoryEntrypoint:i.at(0),catalogEntrypoint:c.at(0),productEntrypoint:l.at(0)}}))}async function Ar(){const e=await p("./templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]}),t=await p("./templates/assets/*",{ignore:["node_modules/**","dist/**"]});return{pageTemplates:await Dr(),templates:e,assets:t}}async function Ir(e){if(e.templates.length===0&&e.pageTemplates?.length===0)return{};const t=await Gn();return await x(void 0,e.assets,h.TemplateAsset),await x(void 0,e.templates,h.TemplateDescriptor),e.templates.reduce(async(o,s)=>{const n=await o,r=`${_}/js/${F(s).name}`,i=await G(r,!0);return{...n,...Vn(t,i,r,await vr(i))}},Promise.resolve({}))}async function Cr({templateBuildConfig:e,layoutEntrypoints:t}){return e.pageTemplates?.reduce(async(o,s)=>{const n=await o,r=[s.configurationEntrypoint,s.homeEntrypoint,s.categoryEntrypoint,s.catalogEntrypoint,s.productEntrypoint].filter(te);if(r.length===0)throw new Error("No entry points provided for page template");return await x(s.name,r,h.PageTemplateDescriptor),{...n,...await Er(s,t)}},Promise.resolve({}))??{}}async function Pr({layoutEntrypoints:e}){const t=await Ar(),o=await Promise.all([Ir(t),Cr({templateBuildConfig:t,layoutEntrypoints:e})]);return o.some(s=>!ke(s))?o.reduce((s,n)=>({...s,...n}),{}):{}}const Nr=()=>Xs({ext:".gz",algorithm:"gzip",deleteOriginFile:!0}),Lr="/* EXTERNAL_IMPORTS_START */",xr="/* EXTERNAL_IMPORTS_END */",kr=()=>({name:"external-imports-wrapper-plugin",enforce:"post",apply:"build",generateBundle(e,t){for(const o of Object.keys(t)){const s=t[o];if(s.type==="chunk"){const n=/import.*\?commonjs-external["'];/g,r=s.code.match(n);if(r!==null){const i=r.join(""),c=Lr+i+xr,l=s.code.replace(n,"");s.code=c+l}}}}}),Fr=()=>{const e=process.env.npm_lifecycle_event;return Ks({typescript:!0,vueTsc:!1,eslint:e==="test"?!1:{lintCommand:`eslint --max-warnings=0 "./sections/**/*.{js,ts,vue}" --cache --cache-location "./build/eslintcache/${e}.json"`}})},v={VUE:Hs(),TS_CONFIG_PATHS:Vs(),CHECKER:Fr()},Rr={[w.Server]:[v.VUE,v.TS_CONFIG_PATHS,kr(),Nr()],[w.Client]:[v.VUE,v.TS_CONFIG_PATHS,v.CHECKER,De({vue:"EcVue"})],[w.Misc]:[v.TS_CONFIG_PATHS,v.CHECKER],[w.Layout]:[v.VUE,v.TS_CONFIG_PATHS,v.CHECKER,De({vue:"StVue"})]},fs={"process.env":{NODE_ENV:"production"}},Gr=[...ve,...ve.map(e=>`node:${e}`)],Mr=[/@vue\/compiler-dom/,/@vue\/runtime-dom/,/@vue\/server-renderer/,/@vue\/compiler-ssr/,/@vue\/shared/],D={[h.Server]:{pluginType:w.Server,define:fs,ssr:!0,ssrOptions:{noExternal:!0},outDir:(e,t)=>`./${g[t].dist}/${e}/js/main/server`,externalOption:[...Gr,...Mr],entryFileNames:"server.js",inlineDynamicImports:!0},[h.Client]:{pluginType:w.Client,define:fs,ssr:!1,outDir:(e,t)=>`./${g[t].dist}/${e}/js/main/client`,entryFileNames:"client.js",assetFileNames:"assets/[name].[ext]",chunkFileNames:"chunks/[name].js",inlineDynamicImports:!1},[h.SectionSetting]:{pluginType:w.Misc,ssr:!1,outDir:(e,t)=>`./${g[t].dist}/${e}/js/settings`,entryFileNames:"[name].mjs"},[h.SectionShowcase]:{pluginType:w.Misc,ssr:!1,outDir:(e,t)=>`./${g[t].dist}/${e}/js/showcases`,entryFileNames:"[name].mjs"},[h.SectionAsset]:{pluginType:w.Misc,ssr:!1,outDir:(e,t)=>`./${g[t].dist}/${e}/assets`,assetFileNames:"[name].[ext]"},[h.TemplateDescriptor]:{pluginType:w.Misc,ssr:!1,outDir:()=>`./${_}/js`,entryFileNames:`[name]${C}.mjs`},[h.PageTemplateDescriptor]:{pluginType:w.Misc,ssr:!1,outDir:e=>`./${_}/${e}`,entryFileNames:`[name]${C}.mjs`},[h.TemplateAsset]:{pluginType:w.Misc,ssr:!1,outDir:()=>`./${_}/assets`,assetFileNames:"[name].[ext]"},[h.Layout]:{pluginType:w.Layout,ssr:!1,outDir:e=>`./${re}/${e}`,entryFileNames:"index.mjs",inlineDynamicImports:!0}};function Br(e){switch(typeof e){case"string":return[f(process.cwd(),e)];case"object":return e.map(t=>f(process.cwd(),t));default:return[]}}function us({name:e,entryPoints:t,configType:o,sectionType:s}){const n=D[o].define,r=D[o].ssrOptions,i=D[o].entryFileNames,c=D[o].chunkFileNames,l=D[o].assetFileNames,d=D[o].inlineDynamicImports,$=D[o].externalOption;return{plugins:Rr[D[o].pluginType],...n!==void 0&&{define:n},...r!==void 0&&{ssr:r},resolve:{alias:{"@":"/src"}},css:{preprocessorOptions:{scss:{api:"modern-compiler"}}},build:{ssr:D[o].ssr,outDir:D[o].outDir(e,s),emptyOutDir:!0,minify:"terser",terserOptions:{compress:{drop_console:!1}},rollupOptions:{...$!==void 0&&{external:$},preserveEntrySignatures:"strict",input:Br(t),treeshake:{moduleSideEffects:!1},output:{validate:!0,inlineDynamicImports:d,...i!==void 0&&{entryFileNames:i},...c!==void 0&&{chunkFileNames:c},...l!==void 0&&{assetFileNames:l}}}}}}async function qr(e){const t=_e(us({name:e.name,entryPoints:e.serverEntrypoint,configType:h.Server,sectionType:e.type}));return Hn(e.assetEntryPoints),await ne({configFile:!1,...t}),await Xn(e.name,e.type),await x(e.name,e.clientEntrypoint,h.Client,e.type),await x(e.name,e.settingsEntryPoints,h.SectionSetting,e.type),await x(e.name,e.showcaseEntryPoints,h.SectionShowcase,e.type),await x(e.name,e.assetEntryPoints,h.SectionAsset,e.type),await Mn(e).reduce(async(o,s)=>{const n=await o,r=await Un(s);return{...n,...r}},Promise.resolve({}))}async function Ur(e){return e.reduce(async(t,o)=>{const s=await t,n=await qr(o);return{...s,...n}},Promise.resolve({}))}function zr(e){const t=xe(e);return x(t,[e],h.Layout)}function Xr(){return p(`./${Ce}/{product,category,catalog}/*/Main.vue`,{ignore:["node_modules/**","dist/**"]})}async function Hr(e){e===void 0||e.length===0||await Promise.all(e.map(zr))}function Vr(e){return Object.entries(g).find(t=>t[1].source===e)?.[0]}async function Kr(){const e=await p("**/server.{js,ts}",{ignore:["node_modules/**","dist/**","templates/**"]});return Promise.all(e.map(async t=>{const o=Cs(t).split(k),s=o.pop()??"default",n=o.pop();if(n===void 0)throw new Error("Cannot determine type of section, outer directory is undefined");const r=await p(`**/${s}/client.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),i=await p(`**/${s}/settings/content.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),c=await p(`**/${s}/settings/design.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),l=await p(`**/${s}/settings/layout.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),d=await p(`**/${s}/settings/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),$=await p(`**/${s}/showcases/*.{js,ts}`,{ignore:["node_modules/**","dist/**",`**/${s}/showcases/translations.{js,ts}`]}),Ds=await p(`**/${s}/showcases/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),As=await p(`**/${s}/assets/*`,{ignore:["node_modules/**","dist/**"]});return{name:s,type:Vr(n),serverEntrypoint:t,clientEntrypoint:r.at(0),contentSettingsEntrypoint:i.at(0),designSettingsEntrypoint:c.at(0),layoutSettingsEntrypoint:l.at(0),settingsTranslationsEntrypoint:d.at(0),showcasesEntrypoints:$,showcasesTranslationsEntrypoint:Ds.at(0),assetsEntrypoints:As}}))}function Yr(){return Promise.all([se.rm("dist",{recursive:!0,force:!0}),se.rm("source-code",{recursive:!0,force:!0}),se.rm("source-code.zip",{force:!0})])}async function Jr(){const e=new Rs,t=["node_modules/**/*","dist/**/*","build/**/*",".git/**/*","**/assets/**/*","crane.config.json"],o=await p("**/*",{cwd:f(process.cwd()),ignore:t,dot:!0,nodir:!0});try{o.forEach(r=>{const i=f(process.cwd(),r);e.addLocalFile(i,F(r).dir)});const s=K[m.SourceCode].fileName,n=f(process.cwd(),s);await e.writeZipPromise(n)}catch(s){throw a.error("Error while zipping source files"),s}}async function ms(){await Yr();try{const e=await Xr(),t=await Kr().then(s=>s.map(n=>({name:n.name,type:n.type,serverEntrypoint:n.serverEntrypoint,clientEntrypoint:[n.clientEntrypoint].filter(te).flat(),settingsEntryPoints:[n.contentSettingsEntrypoint,n.designSettingsEntrypoint,n.layoutSettingsEntrypoint,n.settingsTranslationsEntrypoint].filter(te),showcaseEntryPoints:[...n.showcasesEntrypoints??[],n.showcasesTranslationsEntrypoint].filter(te),assetEntryPoints:n.assetsEntrypoints??[]}))),o={...await Ur(t),...await Pr({layoutEntrypoints:e})};Object.keys(o).length===0?(await Hr(e),await Jr(),a.info(`Build successful:
1
+ import qs from"cac";import*as se from"path";import g,{resolve as u,parse as G,sep as ve,dirname as Us}from"path";import{red as zs,yellow as Xs,green as M}from"kolorist";import De from"prompts";import $ from"node:fs";import P from"node:path";import T from"node:process";import*as ne from"fs";import y,{existsSync as w,statSync as Hs,rename as Ce,unlink as Ae,promises as pe,writeFileSync as Vs,createReadStream as Ks}from"fs";import{pathToFileURL as Pe}from"url";import{fileURLToPath as Ys}from"node:url";import Ws from"adm-zip";import{glob as l,globSync as Le}from"glob";import{defineConfig as Ne,build as de,createServer as Js}from"vite";import Zs from"tinycolor2";import{builtinModules as xe}from"module";import{viteExternalsPlugin as ke}from"vite-plugin-externals";import Qs from"vite-plugin-compression";import en from"@vitejs/plugin-vue";import tn from"vite-tsconfig-paths";import on from"vite-plugin-checker";import sn from"ajv/dist/2020.js";import nn from"ajv-formats";import rn from"node:zlib";import{promisify as an}from"node:util";import{JSONPath as cn}from"jsonpath-plus";import ln,{AxiosError as Fe}from"axios";import{ConcurrencyManager as pn}from"axios-concurrency";import{readFile as Re}from"fs/promises";import*as L from"process";import N from"process";import{inc as dn}from"semver";import fn 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(zs(e)),warn:e=>console.log(Xs(e)),info:e=>console.log(M(e))},C="_temp",b="dist/sections",K="dist/headers",Y="dist/footers",I="dist/templates",B="layouts",O=`dist/${B}`,Ge=2*1024*1024,Me=300*1024;function ie(e){return!!e}function Be(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}const un="Resource name can only contain alphanumeric characters, dashes, and underscores";function mn(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:un}}function yn(e){return e===!0?!0:typeof e=="string"&&e.trim().length===0}async function q(e,t){try{const o=u(process.cwd(),t?`${e}${C}.mjs`:`${e}.mjs`);return(await import(Pe(o).href)).default}catch(o){const s=`File [${e}${t?C:""}.mjs] is either invalid or undefined`,n=o instanceof Error?o.message:s;throw new Error(n)}}function qe(e){return Object.keys(e).length===0}function gn(e){return g.parse(e).name}var hn=(e=>(e.SingleFile="single-file",e.MultiPage="multi-page",e))(hn||{});function Ue(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);Ue(s,n)})):ne.copyFileSync(e,t)}function x(e,t,o,s){const n=se.join(e,s?.[o]??o);Ue(se.join(t,o),n)}function $n(e){return e?"multi-page":"single-file"}function bn(e,t){return e==="single-file"?{"template.ts":`${t}.ts`}:{"example-template":`${t}`}}function En(e,t){return e==="single-file"?`${t}.ts`:t}function Tn(e){return e==="single-file"?"template/templates":"template/page-templates"}function wn(e,t){return e==="single-file"?()=>a.info(`Template descriptor file [${t}.ts] has been created`):()=>a.info(`Template [${t}] with pages structure named has been created`)}function Sn(e,t){const o=$n(t),s=bn(o,e),n=En(o,e),i=Tn(o),r=wn(o,e);return{renameFiles:s,targetPath:n,sourcePath:i,onTemplateCreated:r}}function k(e){return P.resolve(Ys(import.meta.url),"../..",e)}function jn(){const e=k("package.json");return e!==""?JSON.parse($.readFileSync(e,"utf8")):{}}async function On(e){try{const t=e,o=T.cwd(),s=P.join(o,t),n=["templates","headers","footers","reference","page-templates","layouts"],i={_gitignore:".gitignore"};$.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)):$.mkdirSync(s);const r=k("template");$.readdirSync(r).filter(h=>h!=="package.json").filter(h=>!n.includes(h)).forEach(async h=>x(s,r,h,i));const c=JSON.parse($.readFileSync(P.join(r,"package.json"),"utf-8"));c.name=e;const m=jn();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 f=P.join(s,"package.json");$.writeFileSync(f,`${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);y.existsSync(i)||y.mkdirSync(i);const r=g.join(n,t,o);y.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)):y.mkdirSync(r);const c=k(e);y.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);y.existsSync(s)||(y.mkdirSync(s),y.readdirSync(o).forEach(async n=>x(s,o,n)))}function _n(e,t,o){if(!y.existsSync(o)){y.copyFileSync(t,o);return}const s=y.readFileSync(t),n=y.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 ze(e,t){const o=y.readdirSync(e,{withFileTypes:!0});y.existsSync(t)||y.mkdirSync(t,{recursive:!0}),o.forEach(s=>{const n=g.join(e,s.name),i=g.join(t,s.name);s.isDirectory()?ze(n,i):_n(s,n,i)})}function me(){try{const e=T.cwd(),t=g.join(e,"shared"),o=k("template/shared");if(!y.existsSync(o))return;ze(o,t)}catch(e){a.error(`Error while processing shared folder: ${e.message}`),T.exit(1)}}async function In(e){me(),fe("template/sections/example-section","sections",e,"Section")}async function vn(e,t){const{targetPath:o,renameFiles:s,sourcePath:n,onTemplateCreated:i}=Sn(e,t);try{const r=T.cwd(),c=P.join(r,"templates"),m=k(n),f=$.readdirSync(m);$.existsSync(c)?$.existsSync(P.join(c,o))&&(a.error(`Template with the name: ${e} already exists. If you'd like to override it, delete previous version first`),T.exit(1)):$.mkdirSync(c),f.forEach(h=>x(c,m,h,s)),ue("headers"),ue("footers"),t&&ue("layouts"),i()}catch(r){a.error(`Error while creating template descriptors: ${r.message}`),T.exit(1)}}async function Dn(){try{const e=T.cwd(),t=k("template/reference"),o=$.readdirSync(t);let s=!1;for(const n of o){const i=P.join(t,n),r=P.join(e,n);$.existsSync(r)||$.mkdirSync(r,{recursive:!0});const c=$.readdirSync(i),m=$.readdirSync(r);if(n==="shared"){c.forEach(f=>{x(r,i,f)});continue}for(const f of c){if(f==="assets"){x(r,i,f);continue}if(m.includes(f)){const{name:h}=await De({type:"text",name:"name",message:`The "${f}" already exists in ${n} directory: provide a new name to keep both or press Esc to skip this one.`});h?(x(r,i,f,{[f]:h}),s=!0):a.info(`Skipped: ${f}`)}else x(r,i,f)}}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 Cn="https://blockbuster.ecwid.com",An="/api/v1/custom-apps/resources/sections/upload",Pn="/api/v1/custom-apps/resources/templates/upload",Ln="/api/v1/custom-apps/manifests/sections",Nn="/api/v1/custom-apps/manifests/templates",xn=5,kn=3,Fn=[p.Server,p.Client,p.ClientChunks,p.ClientAsset,p.Asset],Rn=[p.LayoutClient,p.LayoutAsset],Gn=[p.SlotServer,p.SlotClient,p.SlotClientChunks,p.SlotClientAsset],Mn=[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.`},Xe={catalog:"products",category:"category",product:"product"},Bn=e=>Xe[e],He=e=>e in Xe;async function F(e){return(await import(Pe(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 Ve(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 qn={COLOR:"COLOR",GRADIENT:"GRADIENT"};function Un(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(qn)}`)}}function zn(e){const t=e.style,o=e.color,s=Array.isArray(o)?o:[o,o];return e.background={type:Un(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 Xn={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"};function Hn(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(Xn)}`)}}const Vn={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"};function Kn(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(Vn)}`)}}const Yn={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"};function Wn(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(Yn)}`)}}function Jn(e){const t=e.appearance;t!==void 0&&(e.appearance=Hn(t));const o=e.size;o!==void 0&&(e.size=Kn(o));const s=e.shape;s!==void 0&&(e.style=Wn(s),e.shape=void 0);const n=e.font;e.font=ye(n);const i=e.color;return e.color=_(i),e}const Zn={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"};function Qn(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(Zn)}`)}}function ei(e){const t=e.overlay,o=e.color,s=Array.isArray(o)?o:[o,o];return e.overlay={type:Qn(t),solid:{color:_(s.at(0))},gradient:{fromColor:_(s.at(0)),toColor:_(s.at(1))}},e.color=void 0,e}function ti(e){const t=e.font;e.font=ye(t);const o=e.color;e.color=_(o);const s=e.size;return e.size=Ve(s),e}function oi(e){const t=e.color;return e.color=_(t),e}function si(e){const t=e.font;e.font=ye(t);const o=e.color;e.color=_(o);const s=e.size;if(e.size=Ve(s),e.frame!==void 0){const n=e.frame.color;e.frame.color=_(n)}return e}function ge(e,t){switch(e){case"TEXT":{ti(t);break}case"BUTTON":{Jn(t);break}case"IMAGE":{ei(t);break}case"BACKGROUND":{zn(t);break}case"COLOR_PICKER":{oi(t);break}case"LOGO":{si(t);break}case"TOGGLE":case"DIVIDER":case"SELECTBOX":break;default:throw new Error(`Unknown design editor type: ${e}`)}return t}function Ke(e){Object.keys(e).forEach(t=>{const o=e[t];o.type!=="DIVIDER"&&ge(o.type,o.defaults)})}function ni(e){e.forEach(t=>{t.type!==void 0&&t.defaults!==void 0&&(ge(t.type,t.defaults),t.defaults.type=t.type)})}function Ye(e){Object.keys(e).forEach(t=>{const o=e[t],s=o.type;ge(s,o)})}function ii(e,t){if(!t)return;const o=e[t];return o===void 0?{en:t}:o}function ri(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]=ii(t,n):typeof n=="object"&&R(n,t)}}async function he(e){const t=u(process.cwd(),e),o=await F(t);return ri(o)}function ai(e){return e.replace(/\\/g,"/")}function ci(e){return e.replace(/^dist\/layouts\//,"").replace(/^layouts\//,"")}function $e(e){return ci(ai(e))}function We(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(!He(o))throw new Error(`Layout cannot be placed in a non-storefront section: ${o}`);const n=Bn(o);return{id:s,sectionId:o,pageId:n}}async function li(){const e=`${O}/{product,catalog,category}/*`;return(await l(e,{ignore:["node_modules/**"]})).map(We)}async function pi(e){return he(`${O}/${e.sectionId}/${e.layoutId}/js/settings/translations.mjs`)}async function di(e){try{const t=u(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 fi(e){try{const t=u(process.cwd(),`${O}/${e.sectionId}/${e.layoutId}/js/settings/design.mjs`),o=await F(t);return Ke(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 E={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 Je(e){const t=W(e);return E[t].dist}const J=(e="SECTION")=>E[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 Ze={"process.env":{NODE_ENV:"production"}},ui=[...xe,...xe.map(e=>`node:${e}`)],mi=[/@vue\/compiler-dom/,/@vue\/runtime-dom/,/@vue\/server-renderer/,/@vue\/compiler-ssr/,/@vue\/shared/],Qe=e=>({pluginType:v.Server,define:Ze,ssr:!0,ssrOptions:{noExternal:!0},entryFileNames:"server.js",externalOption:[...ui,...mi],inlineDynamicImports:!0,...e,outDir:e.outDir}),et=e=>({pluginType:v.Client,define:Ze,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}),yi=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}),gi=()=>Qs({ext:".gz",algorithm:"gzip",deleteOriginFile:!0}),hi="/* EXTERNAL_IMPORTS_START */",$i="/* EXTERNAL_IMPORTS_END */",bi=()=>({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=hi+r+$i,m=s.code.replace(n,"");s.code=c+m}}}}}),Ei=()=>{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:Ei()},Ti={[v.Server]:[D.VUE,D.TS_CONFIG_PATHS,bi(),gi()],[v.Client]:[D.VUE,D.TS_CONFIG_PATHS,D.CHECKER,ke({vue:"EcVue"})],[v.Misc]:[D.TS_CONFIG_PATHS,D.CHECKER],[v.Layout]:[D.VUE,D.TS_CONFIG_PATHS,D.CHECKER,ke({vue:["EcExternals","Vue"]})]},wi={[d.Server]:Qe({outDir:({name:e,sectionType:t})=>`./${E[t].dist}/${e}/js/main/server`}),[d.Client]:et({outDir:({name:e,sectionType:t})=>`./${E[t].dist}/${e}/js/main/client`}),[d.SectionSetting]:Z({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:t})=>`./${E[t].dist}/${e}/js/settings`}),[d.SectionShowcase]:Z({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:t})=>`./${E[t].dist}/${e}/js/showcases`}),[d.SectionAsset]:be({outDir:({name:e,sectionType:t})=>`./${E[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]:yi({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]:Qe({outDir:({name:e,layoutId:t,sectionId:o})=>`./${O}/${o}/${t}/slots/${e}/js/main/server`}),[d.SlotClient]:et({outDir:({name:e,layoutId:t,sectionId:o})=>`./${O}/${o}/${t}/slots/${e}/js/main/client`})};function Si(e){switch(typeof e){case"string":return[u(process.cwd(),e)];case"object":return e.map(t=>u(process.cwd(),t));default:return[]}}function tt({name:e,entryPoints:t,configType:o,layoutId:s,sectionId:n,sectionType:i=re.SECTION}){const r=wi[o],c=r.define,m=r.ssrOptions,f=r.entryFileNames,h=r.chunkFileNames,ce=r.assetFileNames,le=r.inlineDynamicImports,Bs=r.externalOption;return{plugins:Ti[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:Bs,preserveEntrySignatures:"strict",input:Si(t),treeshake:{moduleSideEffects:!1},output:{validate:!0,inlineDynamicImports:le,entryFileNames:f,chunkFileNames:h,assetFileNames:ce}}}}}const ot="https://json-schema.org/draft/2020-12/schema",st="https://lightspeedhq.com/template-default.schema.json",nt="Default Section",it="Default section for a Custom Template",rt="object",at={"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}},ji={$schema:ot,$id:st,title:nt,description:it,type:rt,$defs:at},ct={__proto__:null,$defs:at,$id:st,$schema:ot,default:ji,description:it,title:nt,type:rt},lt="https://json-schema.org/draft/2020-12/schema",pt="https://lightspeedhq.com/template-custom.schema.json",dt="Custom Section",ft="Custom section for a Custom Template",ut="object",mt={"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}},Oi={$schema:lt,$id:pt,title:dt,description:ft,type:ut,$defs:mt},yt={__proto__:null,$defs:mt,$id:pt,$schema:lt,default:Oi,description:ft,title:dt,type:ut},gt="https://json-schema.org/draft/2020-12/schema",ht="https://lightspeedhq.com/template-custom-content.schema.json",$t="Custom Section :: Content Configuration",bt="Content tab configuration of a Custom Section for a Custom Template",Et="object",Tt={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"]}},_i={$schema:gt,$id:ht,title:$t,description:bt,type:Et,$defs:Tt},wt={__proto__:null,$defs:Tt,$id:ht,$schema:gt,default:_i,description:bt,title:$t,type:Et},St="https://json-schema.org/draft/2020-12/schema",jt="https://lightspeedhq.com/template-custom-design.schema.json",Ot="Custom Section :: Design Configuration",_t="Design tab configuration of a Custom Section for a Custom Template",It="object",vt={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}},Ii={$schema:St,$id:jt,title:Ot,description:_t,type:It,$defs:vt},Dt={__proto__:null,$defs:vt,$id:jt,$schema:St,default:Ii,description:_t,title:Ot,type:It},Ct="https://json-schema.org/draft/2020-12/schema",At="https://lightspeedhq.com/section-content.schema.json",Pt="Custom Section - Content",Lt="The content of a custom section",Nt="object",xt={"^.*$":{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"}}]}},kt={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"]}},Ft=!1,vi={$schema:Ct,$id:At,title:Pt,description:Lt,type:Nt,patternProperties:xt,$defs:kt,additionalProperties:Ft},Rt={__proto__:null,$defs:kt,$id:At,$schema:Ct,additionalProperties:Ft,default:vi,description:Lt,patternProperties:xt,title:Pt,type:Nt},Gt="https://json-schema.org/draft/2020-12/schema",Mt="https://lightspeedhq.com/sections/section-translation.schema.json",Bt="Custom Section - Translations",qt="The translation of the section's labels",Ut="object",zt={"^[a-z]{2}$":{type:"object",patternProperties:{"^\\$.*$":{type:"string"}},additionalProperties:!1}},Xt=!1,Di={$schema:Gt,$id:Mt,title:Bt,description:qt,type:Ut,patternProperties:zt,additionalProperties:Xt},Ht={__proto__:null,$id:Mt,$schema:Gt,additionalProperties:Xt,default:Di,description:qt,patternProperties:zt,title:Bt,type:Ut},Vt="https://json-schema.org/draft/2020-12/schema",Kt="https://lightspeedhq.com/section-design.schema.json",Yt="Custom Section - Design",Wt="The design of a custom section",Jt="object",Zt={"^.*$":{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}},Qt={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:[]}},Ci={$schema:Vt,$id:Kt,title:Yt,description:Wt,type:Jt,patternProperties:Zt,$defs:Qt},eo={__proto__:null,$defs:Qt,$id:Kt,$schema:Vt,default:Ci,description:Wt,patternProperties:Zt,title:Yt,type:Jt},to="https://json-schema.org/draft/2020-12/schema",oo="https://lightspeedhq.com/section-commons.schema.json",so="Custom Section - Content",no="The content of a custom section",io="object",ro={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"}}}},ao=!1,Ai={$schema:to,$id:oo,title:so,description:no,type:io,$defs:ro,additionalProperties:ao},co={__proto__:null,$defs:ro,$id:oo,$schema:to,additionalProperties:ao,default:Ai,description:no,title:so,type:io},lo="https://json-schema.org/draft/2020-12/schema",po="https://lightspeedhq.com/section-showcase.schema.json",fo="Custom Section - Showcase settings",uo="The setting of a showcase",mo="object",yo=["showcaseId","previewImage"],go=[{properties:{showcaseId:{description:"Showcase id of the section",type:"string"},previewImage:{$ref:"section-commons.schema.json#/$defs/Image"}}},{$ref:"../showcase_overrides.schema.json"}],Pi={$schema:lo,$id:po,title:fo,description:uo,type:mo,required:yo,allOf:go},ho={__proto__:null,$id:po,$schema:lo,allOf:go,default:Pi,description:uo,required:yo,title:fo,type:mo},$o="https://json-schema.org/draft/2020-12/schema",bo="https://lightspeedhq.com/template.schema.json",Eo="Custom Template",To="A custom template enclosing the necessary custom and default blocks",wo="object",So={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}},jo=["metadata","sections"],Li={$schema:$o,$id:bo,title:Eo,description:To,type:wo,properties:So,required:jo},Oo={__proto__:null,$id:bo,$schema:$o,default:Li,description:To,properties:So,required:jo,title:Eo,type:wo},_o="https://json-schema.org/draft/2020-12/schema",Io="https://lightspeedhq.com/showcase_overrides.schema.json",vo="Showcase overrides",Do="Overrides for the showcase",Co="object",Ao={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"}},Ni={$schema:_o,$id:Io,title:vo,description:Do,type:Co,properties:Ao},Po={__proto__:null,$id:Io,$schema:_o,default:Ni,description:Do,properties:Ao,title:vo,type:Co},Lo="https://json-schema.org/draft/2020-12/schema",No="https://lightspeedhq.com/common.schema.json",xo="Common Type Definitions",ko="Common type definitions, used throughout other schemas",Fo="object",Ro={label_type:{type:"string",pattern:"^\\$.+"}},xi={$schema:Lo,$id:No,title:xo,description:ko,type:Fo,$defs:Ro},Go={__proto__:null,$defs:Ro,$id:No,$schema:Lo,default:xi,description:ko,title:xo,type:Fo};var Q=(e=>(e.CONTENT="Content",e.DESIGN="Design",e))(Q||{});const ki={menu:{type:"NAVIGATION_MENU"},logo:{type:"LOGO"}},Fi={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 Mo(e){switch(e){case re.HEADER:return ki;default:return{}}}function Bo(e){switch(e){case re.HEADER:return Fi;default:return{}}}function Ri({validationType:e,sectionType:t}){switch(e){case Q.CONTENT:return Mo(t);case Q.DESIGN:return Bo(t);default:return{}}}function Gi({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 Mi({type:e,mandatorySettings:t}){return Object.keys(t).find(o=>t[o].type===e)}function Bi({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).forEach(([s,n])=>{const i=Mi({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 qi({type:e,mandatorySettings:t}){return Object.keys(t).findLast(o=>t[o].type===e)}function Ui({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=qi({type:i,mandatorySettings:t});o.push({instancePath:r,keyword:"duplicate-type",message:`Editor type "${i}" can only be used once.`})}}),o}function zi(e,t){const{sectionSettings:o,sectionType:s}=t,n=Ri({validationType:e,sectionType:s});return n===void 0||qe(n)?[]:[...Gi({sectionSettings:o,mandatorySettings:n}),...Bi({sectionSettings:o,mandatorySettings:n}),...Ui({sectionSettings:o,mandatorySettings:n})]}const ee=[co,eo,Rt,ho,Oo,ct,yt,wt,Dt,Po,Go];function H(e,t){const o=new sn({allErrors:!0,schemas:e});return nn(o),o.getSchema(t.$id)||o.compile(t)}function Xi(){return H(ee,Oo)}function Ee(e){return e.map(t=>({instancePath:t.instancePath,message:t.message??"",keyword:t.keyword}))}const Hi=e=>(()=>{const t=Je(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,Rt),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,eo),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,Ht),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?ho:Ht),type:e.type,sectionName:e.name}))]})();function Vi(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(f=>`${r.instancePath}${r.message}${r.keyword}`==`${f.instancePath}${f.message}${f.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 Ki(e,t){if(e.validationType===void 0||e.sectionName===void 0)return[];const{sectionName:o,validationType:s}=e,n=W(o);return[...zi(s,{sectionSettings:t,sectionType:n})]}function qo(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 Yi(e){const t=await q(e.dist,!1),o={},s=[],n=Je(e.sectionName??"").split("/").pop()?.toLowerCase();return e.ajv(t)||s.push(...Ee(e.ajv.errors??[])),s.push(...Ki(e,t),...qo(`${n}/${e.sectionName}`,t)),s.length>0&&(o[e.source]=s),o}async function Wi(e){const t=an(rn.gunzip),o=await y.promises.readFile(e);return(await t(o)).length}async function Uo(e,t){const o=X[e],s=g.resolve(`${o.toPath(t)}${o.fileName}`),n=await Wi(s);if(n>Me)throw a.error(`Size of individual server file must not exceed threshold [${V(Me)}]!`),a.error(`${`File: ${s}`.padEnd(s.length+10)}| ${V(n)}`),new Error("Invalid server file size")}function zo(e){const t=e.reduce((o,s)=>{const n=Hs(s);return n.size>Ge&&(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(Ge)}]!`);for(const s in t)a.error(`${`File: ${s}`.padEnd(o+10)}| ${t[s]}`);throw new Error("Invalid asset file size")}}function Ji(e,t,o,s){const n={};return e(t)&&s===void 0?Ce(`${o}${C}.mjs`,`${o}.mjs`,()=>{}):(Ae(`${o}${C}.mjs`,()=>{}),n[g.resolve(`./templates/${G(o).name}.ts`)]=[...Ee(e.errors??[]),...s??[]]),n}async function Zi(){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}=We(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 Qi(e){zo(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 er(e){e===void 0||e.length===0||await Promise.all(e.map(t=>Qi(t)))}async function tr(e){const t=Ne(tt({name:e.name,entryPoints:e.serverEntrypoint,configType:d.Server,sectionType:e.type}));return zo(e.assetEntryPoints),await de({configFile:!1,...t}),await Uo(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 Hi(e).reduce(async(o,s)=>{const n=await o,i=await Yi(s);return{...n,...i}},Promise.resolve({}))}async function or(e){return e.reduce(async(t,o)=>{const s=await t,n=await tr(o);return{...s,...n}},Promise.resolve({}))}function Xo(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(!He(o))throw new Error(`Slot cannot be placed in a non-storefront section: ${o}`);return{id:n,sectionId:o,layoutId:s}}async function sr(e){const t=await pi(e),[o,s]=await Promise.all([di({...e,translations:t}),fi({...e,translations:t})]);return{...e,contentEditors:o,designEditors:s}}async function nr(){const e=`${O}/{product,catalog,category}/*/slots/*`,t=await l(e,{ignore:["node_modules/**"]});return await Promise.all(t.map(Xo).map(sr))}async function ir(){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}=Xo(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 rr(e){const t={name:e.id,layoutId:e.layoutId,sectionId:e.sectionId};await S({entryPoints:[e.serverEntrypoint],configType:d.SlotServer,...t}),await Uo(p.SlotServer,{slotId:e.id,layoutId:e.layoutId,sectionId:e.sectionId}),await S({entryPoints:[e.clientEntrypoint],configType:d.SlotClient,...t})}async function ar(e){e===void 0||e.length===0||await e.reduce(async(t,o)=>{await t,await rr(o)},Promise.resolve())}const Ho="https://json-schema.org/draft/2020-12/schema",Vo="https://lightspeedhq.com/metadata.schema.json",Ko="Custom Multi Page Template metadata",Yo="Metadata of a multi page template",Wo="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($|/[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"}},Zo=["metadata","header","footer"],Qo=!1,cr={$schema:Ho,$id:Vo,title:Ko,description:Yo,type:Wo,properties:Jo,required:Zo,additionalProperties:Qo},lr={__proto__:null,$id:Vo,$schema:Ho,additionalProperties:Qo,default:cr,description:Yo,properties:Jo,required:Zo,title:Ko,type:Wo},es="https://json-schema.org/draft/2020-12/schema",ts="https://lightspeedhq.com/header_footer.schema.json",os="Header/Footer definition for a page template",ss="object",ns=["type","id"],is={type:{type:"string",enum:["custom","default"]},id:{type:"string"}},rs=!1,as=[{if:{properties:{type:{const:"default"}}},then:{properties:{id:{enum:["header","footer"]}}}}],pr={$schema:es,$id:ts,title:os,type:ss,required:ns,properties:is,additionalProperties:rs,allOf:as},dr={__proto__:null,$id:ts,$schema:es,additionalProperties:rs,allOf:as,default:pr,properties:is,required:ns,title:os,type:ss},cs="https://json-schema.org/draft/2020-12/schema",ls="https://lightspeedhq.com/page.schema.json",ps="Homepage",ds="Homepage enclosing the necessary custom and default blocks",fs="object",us={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}},ms=!1,ys=["sections"],fr={$schema:cs,$id:ls,title:ps,description:ds,type:fs,properties:us,additionalProperties:ms,required:ys},ur={__proto__:null,$id:ls,$schema:cs,additionalProperties:ms,default:fr,description:ds,properties:us,required:ys,title:ps,type:fs},gs="https://json-schema.org/draft/2020-12/schema",hs="https://lightspeedhq.com/page.schema.json",$s="Custom Page",bs="A custom page enclosing the necessary custom and default blocks",Es="object",Ts={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"]}}]}}},ws=!1,Ss=["sections"],mr={$schema:gs,$id:hs,title:$s,description:bs,type:Es,properties:Ts,additionalProperties:ws,required:Ss},Te={__proto__:null,$id:hs,$schema:gs,additionalProperties:ws,default:mr,description:bs,properties:Ts,required:Ss,title:$s,type:Es},js="https://json-schema.org/draft/2020-12/schema",Os="https://lightspeedhq.com/store-section.schema.json",_s="Store Section",Is="Store section for a custom page",vs="object",Ds=[{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}],yr={$schema:js,$id:Os,title:_s,description:Is,type:vs,allOf:Ds},gr={__proto__:null,$id:Os,$schema:js,allOf:Ds,default:yr,description:Is,title:_s,type:vs};var A=(e=>(e.PRODUCT="PRODUCT",e.CATALOG="CATALOG",e.CATEGORY="CATEGORY",e.HOME="HOME",e.CUSTOM="CUSTOM",e))(A||{});function hr(e){switch(e){case"PRODUCT":return"product";case"CATALOG":return"catalog";case"CATEGORY":return"category";default:return null}}const $r=[co,ct,yt,Po,Dt,wt,gr,dr,Go],br=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($r,r),templatePageType:c})};return s(e.catalogEntrypoint,"catalog",Te,A.CATALOG),s(e.productEntrypoint,"product",Te,A.PRODUCT),s(e.homeEntrypoint,"home",ur,A.HOME),s(e.categoryEntrypoint,"category",Te,A.CATEGORY),s(e.configurationEntrypoint,"configuration",lr,A.CUSTOM),[t,o]};function Er({section:e,context:t,normalizedPaths:o}){const s=hr(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 Tr(e){const{type:t,id:o}=e;return t==="store"&&o!==void 0&&o!==""}async function wr({content:e,context:t,layoutBuildConfigs:o}){const s=o.map(n=>$e(n.clientEntrypoint));return e.sections.filter(Tr).map(n=>Er({section:n,context:t,normalizedPaths:s})).filter(n=>n!==null)}function Sr(e){return"sections"in e}async function jr(e,t){const o=await q(e.dist,!0),s={},n=[];if(e.ajv(o)?Ce(`${e.dist}${C}.mjs`,`${e.dist}.mjs`,()=>{}):(n.push(...Ee(e.ajv.errors??[])),Ae(`${e.dist}${C}.mjs`,()=>{})),Sr(o)&&t!==void 0){const i=await wr({content:o,context:e,layoutBuildConfigs:t});n.push(...i)}return n.length>0&&(s[e.source]=n),s}const Or=async(e,t)=>{const[o,s]=br(e);return(await Promise.all(o.map(n=>jr(n,t)))).reduce((n,i)=>(Object.entries(i).forEach(([r,c])=>{n[r]=n[r]?[...n[r],...c]:[...c]}),n),{...s})};async function _r(e,t,o,s=b){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 Ir(e,t,o,s=b){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 vr(e,t,o,s=b){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=b){t.showcase_overrides!==void 0&&(await _r(e,t,o,s),await Ir(e,t,o,s),await vr(e,t,o,s))}function Se(e,t,o,s=b){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 Dr(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 Cr(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 Ar(e,t){t.showcase_overrides&&e.push(...qo(`sections/${t.id}`,t.showcase_overrides))}async function Pr(e){const t=await e.sections.reduce(async(o,s,n)=>{const i=await o;return n===0?await Dr(i,s):n===e.sections.length-1?await Cr(i,s,e.sections.length-1):s.type==="custom"?w(`${b}/${s.id}`)?(await we(i,s,n),Se(i,s,n),await Ar(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 Lr(){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(ve),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 Nr(){const e=await l("./templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]}),t=await l("./templates/assets/*",{ignore:["node_modules/**","dist/**"]});return{pageTemplates:await Lr(),templates:e,assets:t}}async function xr(e){if(e.templates.length===0&&e.pageTemplates?.length===0)return{};const t=Xi();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,...Ji(t,r,i,await Pr(r))}},Promise.resolve({}))}async function kr({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 Or(s,t)}},Promise.resolve({}))??{}}async function Fr(e){const t=await Nr(),o=await Promise.all([xr(t),kr({templateBuildConfig:t,layoutBuildConfigs:e})]);return o.some(s=>!qe(s))?o.reduce((s,n)=>({...s,...n}),{}):{}}function Rr(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 Gr(e){return Object.entries(E).find(t=>t[1].source===e)?.[0]}async function Mr(){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(ve),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/**"]}),f=await l(`**/${s}/settings/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),h=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:Gr(n),serverEntrypoint:t,clientEntrypoint:i.at(0),contentSettingsEntrypoint:r.at(0),designSettingsEntrypoint:c.at(0),layoutSettingsEntrypoint:m.at(0),settingsTranslationsEntrypoint:f.at(0),showcasesEntrypoints:h,showcasesTranslationsEntrypoint:ce.at(0),assetsEntrypoints:le}}))}function Br(){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 qr(){const e=new Ws,t=["node_modules/**/*","dist/**/*","build/**/*",".git/**/*","**/assets/**/*","crane.config.json"],o=await l("**/*",{cwd:u(process.cwd()),ignore:t,dot:!0,nodir:!0});try{o.forEach(i=>{const r=u(process.cwd(),i);e.addLocalFile(r,G(i).dir)});const s=X[p.SourceCode].fileName,n=u(process.cwd(),s);await e.writeZipPromise(n)}catch(s){throw a.error("Error while zipping source files"),s}}async function Cs(){await Br();try{const[e,t,o]=await Promise.all([Zi(),Mr(),ir()]),s=t.map(Rr),n={...await or(s),...await Fr(e)};Object.keys(n).length===0?(await Promise.all([ar(o),er(e),qr()]),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:"),Bn(o))}catch(e){a.error(`Error while building: ${e.message}`),process.exit(1)}}async function x(e,t,o,s="SECTION"){if(t.length!==0){const n=_e(us({name:e,entryPoints:t,configType:o,sectionType:s}));await ne({configFile:!1,...n})}}const Wr=e=>`\x1B[32m${e}\x1B[0m`,Zr=(e,t,o,s,n)=>{if(!e.total)return;const{loaded:r}=e,i=(Date.now()-n)/1e3;o.value+=r-s.value,s.value=r,t.update({speed:`${U(o.value/i,2)}/s`})},Qr=()=>new Zs.SingleBar({format:`|${Wr("{bar}")}| {status} || {percentage}% || {value}/{total} Files || Speed: {speed}`,barCompleteChar:"\u2588",barIncompleteChar:"\u2591"});function me(e,t){return Object.keys(e).reduce((o,s)=>{const n=e[s],r=t[s];return Le(n)&&Le(r)?o[s]=me(n,r):o[s]=n,o},{...t})}function ei({contentSettings:e,sectionType:t}){const o=Oo(t);return me(e,o)}function ti({designSettings:e,sectionType:t}){const o=So(t);return me(e,o)}function ye(e){if(e!==void 0)return e.startsWith("global.")?{type:"GLOBAL_FONT",font:e}:{type:"PRESET_FONT",font:e}}function S(e){if(e===void 0)return;if(e.startsWith("global."))return{type:"GLOBAL_COLOR",raw:e};const t=Qs(e);return{type:"STRUCTURED_COLOR",raw:e,hex:t.toHex8String(),hsl:t.toHsl(),rgba:t.toRgb(),auto:!1}}function ys(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 oi={COLOR:"COLOR",GRADIENT:"GRADIENT"};function si(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(oi)}`)}}function ni(e){const t=e.style,o=e.color,s=Array.isArray(o)?o:[o,o];return e.background={type:si(t),solid:{color:S(s.at(0))},gradient:{fromColor:S(s.at(0)),toColor:S(s.at(1))}},e.style=void 0,e.color=void 0,e}const ri={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"};function ii(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(ri)}`)}}const ai={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"};function ci(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(ai)}`)}}const pi={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"};function li(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(pi)}`)}}function di(e){const t=e.appearance;t!==void 0&&(e.appearance=ii(t));const o=e.size;o!==void 0&&(e.size=ci(o));const s=e.shape;s!==void 0&&(e.style=li(s),e.shape=void 0);const n=e.font;e.font=ye(n);const r=e.color;return e.color=S(r),e}const fi={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"};function ui(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(fi)}`)}}function mi(e){const t=e.overlay,o=e.color,s=Array.isArray(o)?o:[o,o];return e.overlay={type:ui(t),solid:{color:S(s.at(0))},gradient:{fromColor:S(s.at(0)),toColor:S(s.at(1))}},e.color=void 0,e}function yi(e){const t=e.font;e.font=ye(t);const o=e.color;e.color=S(o);const s=e.size;return e.size=ys(s),e}function gi(e){const t=e.color;return e.color=S(t),e}function hi(e){const t=e.font;e.font=ye(t);const o=e.color;e.color=S(o);const s=e.size;if(e.size=ys(s),e.frame!==void 0){const n=e.frame.color;e.frame.color=S(n)}return e}function ge(e,t){switch(e){case"TEXT":{yi(t);break}case"BUTTON":{di(t);break}case"IMAGE":{mi(t);break}case"BACKGROUND":{ni(t);break}case"COLOR_PICKER":{gi(t);break}case"LOGO":{hi(t);break}case"TOGGLE":case"DIVIDER":case"SELECTBOX":break;default:throw new Error(`Unknown design editor type: ${e}`)}return t}function $i(e){Object.keys(e).forEach(t=>{const o=e[t];o.type!=="DIVIDER"&&ge(o.type,o.defaults)})}function bi(e){e.forEach(t=>{t.type!==void 0&&t.defaults!==void 0&&(ge(t.type,t.defaults),t.defaults.type=t.type)})}function gs(e){Object.keys(e).forEach(t=>{const o=e[t],s=o.type;ge(s,o)})}function Ei(e,t){if(!t)return;const o=e[t];return o===void 0?{en:t}:o}function Ti(e){const t={};for(const o in e){const s=e[o];for(const n in s){const r=t[n],i=s[n];if(r===void 0){const c={};c[o]=i,t[n]=c}else r[o]=i}}return t}function J(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]=Ei(t,n):typeof n=="object"&&J(n,t)}}async function q(e){return(await import(Oe(e).href)).default}async function wi(e,t,o=E){try{const s=f(I.cwd(),`${o}/${e}/js/settings/content.mjs`),n=await q(s),r=H(e),i=ei({contentSettings:n,sectionType:r});return J(i,t),i}catch{throw new Error(`Content descriptor for section [${e}] is either invalid or undefined`)}}async function ji(e,t,o=E){try{const s=f(I.cwd(),`${o}/${e}/js/settings/design.mjs`),n=await q(s),r=H(e),i=ti({designSettings:n,sectionType:r});return $i(i),J(i,t),i}catch(s){const n=s;throw new Error(`Design settings is invalid or undefined. Error ${n.stack}`)}}async function Oi(e,t,o=E){try{const s=await p("*.mjs",{cwd:f(I.cwd(),`${o}/${e}/js/showcases/`),ignore:"**/translations.mjs"});return Promise.all(s.map(async n=>{const r=f(I.cwd(),`${o}/${e}/js/showcases/${n}`),i=await q(r);return gs(i.design),J(i,t),i}))}catch(s){throw new Error(`Showcases is invalid or undefined. Error ${s}`)}}async function Si(e,t=E){try{const o=f(I.cwd(),`${t}/${e}/js/settings/layout.mjs`);if(!j(o))return[];const s=await q(o);return s.forEach(n=>bi(n.selectedDesignSettings)),s}catch{throw new Error(`Layout descriptor for section [${e}] is either invalid or undefined`)}}async function hs(e){const t=f(I.cwd(),e),o=await q(t);return Ti(o)}async function _i(e,t=E){return hs(`${t}/${e}/js/settings/translations.mjs`)}async function $s(e,t=E){return hs(`${t}/${e}/js/showcases/translations.mjs`)}async function he(e,t){const o=await _i(e,g[t].dist),s=await $s(e,g[t].dist),n=await wi(e,o,g[t].dist),r=await ji(e,o,g[t].dist),i=await Oi(e,s,g[t].dist),c=await Si(e,g[t].dist);return{id:e,type:t,name:{en:e},contentEditors:n,designEditors:r,layouts:c,showcases:i}}async function vi(){const e=await p("*/",{cwd:f(I.cwd(),`${E}/`)}),t=await p("*/",{cwd:f(I.cwd(),`${z}/`)}),o=await p("*/",{cwd:f(I.cwd(),`${X}/`)});return Promise.all([...e.map(async s=>he(s,"SECTION")),...t.map(async s=>he(s,"HEADER")),...o.map(async s=>he(s,"FOOTER"))])}async function $e(e){if(!e||e.type!=="custom")return;const t=H(e.id),o=await $s(e.id,g[t].dist);e.showcase_overrides!==void 0&&(J(e.showcase_overrides,o),e.showcase_overrides.design&&gs(e.showcase_overrides.design))}async function bs(e){const t=e.filter(o=>o.type==="custom");await Promise.all(t.map(o=>$e(o)))}const Di=new Map([["catalog","product-details"],["product","storefront-product"],["category","storefront-category"]]);async function be(e){try{return await q(f(process.cwd(),e))}catch{throw new Error(`Template file [${e}] is either invalid or undefined`)}}async function Ai(e){const t=await p(`${_}/js/**.mjs`,{ignore:[`${_}/js/**${C}.mjs`]});return Promise.all(t.map(async o=>{const s=await be(o);return await bs(s.sections),{id:`${e}_${F(o).name}`,descriptor:s}}))}function Ii(e){return e in oe?oe[e]:oe.CUSTOM}function Ci(e){return e.map(t=>({...t,id:Di.get(t.id)??t.id}))}async function Pi(e){const t=await p(`${_}/${e}/*.mjs`,{ignore:[`${_}/${e}/configuration*.mjs`]});return Promise.all(t.map(async o=>{const{sections:s}=await be(o),n=sn(o);return await bs(s),{sections:Ci(s),id:n,type:Ii(n.toUpperCase())}}))}async function Ni(e){const t=await p(`${_}/**/configuration*.mjs`,{});return Promise.all(t.map(async o=>{const s=await be(o);await $e(s.header),await $e(s.footer);const n=y.basename(y.dirname(o)),r=await Pi(n);return{id:`${e}_${n}`,descriptor:{...s,pages:r}}}))}async function Li(e){return[...await Ai(e),...await Ni(e)]}async function Es(e){await new Promise(t=>setTimeout(t,e))}function xi(e){const[t,o]=e.split(k),s=fr(t);return{id:o,sectionId:t,pageId:s}}function ki(e){return e.split(k).length===2}async function Fi(){return(await p("*/*",{cwd:f(process.cwd(),re)})).filter(ki).map(xi)}const Ri={value:0},O=Qr();let Ts=Date.now();const ws=e=>2**e*500;async function Gi(){const e=await Ae(f(A.cwd(),"crane.config.json")),t=JSON.parse(e.toString());return{appClientId:t.app_client_id,appSecretKey:btoa(t.app_secret_key)}}function Mi(e){return typeof e=="object"&&e!==null&&"version"in e&&typeof e.version=="string"}async function Bi(){const e=f(A.cwd(),"package.json"),t=await Ae(e),o=JSON.parse(t.toString());if(Mi(o))return o;throw new Error(`Package file located at path: ${e} does not contain a version field`)}async function qi(e){const t=Js(e.version,"patch");if(t===null)throw Error("Error while incrementing app version");e.version=t,xs(f(A.cwd(),"package.json"),`${JSON.stringify(e,null,2)}
5
- `)}function Ee({deploymentContext:e,sectionType:t="SECTION"}){const o=e.pathContext,s=o.toPath({id:e.currentSection,sectionType:t,layoutId:e.layoutId}),n=s===void 0?Se(o.fileName):Se(o.fileName,{cwd:f(A.cwd(),s),ignore:o.ignore});return(o.isSingleton?n.splice(0):n).map(r=>({url:r,sectionType:t,context:e}))}function Ui(e){return e instanceof Ie&&(e.code==="ECONNRESET"||e.response?.status!==void 0&&e.response?.status>=500&&e.response?.status<600)}function js(e,t){return e<pr&&Ui(t)}function Os(e,t,o,s){const n={value:0},r=e.config.app.templates.length>0?rr:nr;return e.config.axios.post(r,{file:ks(f(A.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},...!["dependencies","source_code"].includes(e.pathContext.type)&&{fileName:t}},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${e.config.app.crane.appSecretKey}`},onUploadProgress:i=>Zr(i,O,Ri,n,Ts)}).then(i=>(O.increment(),i)).catch(async i=>{if(js(s,i))return await Es(ws(s)),Os(e,t,o,s+1);throw O.increment(),i})}function zi(e){return O.start(e.length+1,0,{speed:"N/A",status:"Deployment in progress"}),e.map(t=>{const o=t.context,s=o.pathContext.toPath({id:o.currentSection,sectionType:t.sectionType,layoutId:o.layoutId});return Os(o,t.url,s,0)})}function Xi(e){const t=e.app.sections.flatMap(n=>lr.flatMap(r=>{const i={config:e,currentSection:n.id,pathContext:K[r]};return Ee({deploymentContext:i,sectionType:n.type})})),o=dr.flatMap(n=>{const r={config:e,pathContext:K[n]};return Ee({deploymentContext:r,sectionType:"SECTION"})}),s=e.app.layouts.flatMap(n=>{const r={config:e,pathContext:K[m.Layout],currentSection:n.sectionId,layoutId:n.id};return Ee({deploymentContext:r})});return zi([...t,...o,...s])}function Hi(e){return e.includes(`
6
- `)}function Vi(e,t,o){return e.split(`
4
+ For deploy run: npx @lightspeed/crane@latest deploy`)):(a.error("Error during build:"),Vi(n))}catch(e){a.error(`Error while building: ${e.message}`),process.exit(1)}}async function S({entryPoints:e,configType:t,name:o,sectionType:s,sectionId:n,layoutId:i}){if(e.length!==0){const r=Ne(tt({name:o,entryPoints:e,configType:t,sectionType:s,sectionId:n,layoutId:i}));await de({configFile:!1,...r})}}async function As(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?Le(o.fileName):Le(o.fileName,{cwd:u(process.cwd(),s),ignore:o.ignore});return(o.isSingleton?n.splice(0):n).map(i=>({url:i,sectionType:t,context:e}))}const Ur=e=>e.app.sections.flatMap(t=>Fn.flatMap(o=>{const s={config:e,currentSection:t.id,pathContext:X[o]};return ae({deploymentContext:s,sectionType:t.type})})),zr=e=>Mn.flatMap(t=>{const o={config:e,pathContext:X[t]};return ae({deploymentContext:o})}),Xr=e=>e.app.layouts.flatMap(t=>Rn.flatMap(o=>{const s={config:e,pathContext:X[o],currentSection:t.sectionId,layoutId:t.id};return ae({deploymentContext:s})})),Hr=e=>e.app.slots.flatMap(t=>Gn.flatMap(o=>{const s={config:e,pathContext:X[o],currentSection:t.sectionId,layoutId:t.layoutId,slotId:t.id};return ae({deploymentContext:s})})),Vr=e=>`\x1B[32m${e}\x1B[0m`,Kr=(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`})},Yr=()=>new fn.SingleBar({format:`|${Vr("{bar}")}| {status} || {percentage}% || {value}/{total} Files || Speed: {speed}`,barCompleteChar:"\u2588",barIncompleteChar:"\u2591"});function je(e,t){return Object.keys(e).reduce((o,s)=>{const n=e[s],i=t[s];return Be(n)&&Be(i)?o[s]=je(n,i):o[s]=n,o},{...t})}function Wr({contentSettings:e,sectionType:t}){const o=Mo(t);return je(e,o)}function Jr({designSettings:e,sectionType:t}){const o=Bo(t);return je(e,o)}async function Zr(e,t,o=b){try{const s=u(N.cwd(),`${o}/${e}/js/settings/content.mjs`),n=await F(s),i=W(e),r=Wr({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 Qr(e,t,o=b){try{const s=u(N.cwd(),`${o}/${e}/js/settings/design.mjs`),n=await F(s),i=W(e),r=Jr({designSettings:n,sectionType:i});return Ke(r),R(r,t),r}catch(s){const n=s;throw new Error(`Design settings is invalid or undefined. Error ${n.stack}`)}}async function ea(e,t,o=b){try{const s=await l("*.mjs",{cwd:u(N.cwd(),`${o}/${e}/js/showcases/`),ignore:"**/translations.mjs"});return Promise.all(s.map(async n=>{const i=u(N.cwd(),`${o}/${e}/js/showcases/${n}`),r=await F(i);return Ye(r.design),R(r,t),r}))}catch(s){throw new Error(`Showcases is invalid or undefined. Error ${s}`)}}async function ta(e,t=b){try{const o=u(N.cwd(),`${t}/${e}/js/settings/layout.mjs`);if(!w(o))return[];const s=await F(o);return s.forEach(n=>ni(n.selectedDesignSettings)),s}catch{throw new Error(`Layout descriptor for section [${e}] is either invalid or undefined`)}}async function oa(e,t=b){return he(`${t}/${e}/js/settings/translations.mjs`)}async function Ps(e,t=b){return he(`${t}/${e}/js/showcases/translations.mjs`)}async function Oe(e,t){const o=await oa(e,E[t].dist),s=await Ps(e,E[t].dist),n=await Zr(e,o,E[t].dist),i=await Qr(e,o,E[t].dist),r=await ea(e,s,E[t].dist),c=await ta(e,E[t].dist);return{id:e,type:t,name:{en:e},contentEditors:n,designEditors:i,layouts:c,showcases:r}}async function sa(){const e=await l("*/",{cwd:u(N.cwd(),`${b}/`)}),t=await l("*/",{cwd:u(N.cwd(),`${K}/`)}),o=await l("*/",{cwd:u(N.cwd(),`${Y}/`)});return Promise.all([...e.map(async s=>Oe(s,"SECTION")),...t.map(async s=>Oe(s,"HEADER")),...o.map(async s=>Oe(s,"FOOTER"))])}async function _e(e){if(!e||e.type!=="custom")return;const t=W(e.id),o=await Ps(e.id,E[t].dist);e.showcase_overrides!==void 0&&(R(e.showcase_overrides,o),e.showcase_overrides.design&&Ye(e.showcase_overrides.design))}async function Ls(e){const t=e.filter(o=>o.type==="custom");await Promise.all(t.map(o=>_e(o)))}async function Ie(e){try{return await F(u(process.cwd(),e))}catch{throw new Error(`Template file [${e}] is either invalid or undefined`)}}async function na(e){const t=await l(`${I}/js/**.mjs`,{ignore:[`${I}/js/**${C}.mjs`]});return Promise.all(t.map(async o=>{const s=await Ie(o);return await Ls(s.sections),{id:`${e}_${G(o).name}`,descriptor:s}}))}function ia(e){return e in A?A[e]:A.CUSTOM}async function ra(e){const t=await l(`${I}/${e}/*.mjs`,{ignore:[`${I}/${e}/configuration*.mjs`]});return Promise.all(t.map(async o=>{const{sections:s}=await Ie(o),n=gn(o);return await Ls(s),{sections:s,id:n,type:ia(n.toUpperCase())}}))}async function aa(e){const t=await l(`${I}/**/configuration*.mjs`,{});return Promise.all(t.map(async o=>{const s=await Ie(o);await _e(s.header),await _e(s.footer);const n=g.basename(g.dirname(o)),i=await ra(n);return{id:`${e}_${n}`,descriptor:{...s,pages:i}}}))}async function ca(e){return[...await na(e),...await aa(e)]}const la={value:0},j=Yr();let Ns=Date.now();const xs=e=>2**e*500;async function pa(){const e=await Re(u(L.cwd(),"crane.config.json")),t=JSON.parse(e.toString());return{appClientId:t.app_client_id,appSecretKey:btoa(t.app_secret_key)}}function da(e){return typeof e=="object"&&e!==null&&"version"in e&&typeof e.version=="string"}async function fa(){const e=u(L.cwd(),"package.json"),t=await Re(e),o=JSON.parse(t.toString());if(da(o))return o;throw new Error(`Package file located at path: ${e} does not contain a version field`)}async function ua(e){const t=dn(e.version,"patch");if(t===null)throw Error("Error while incrementing app version");e.version=t,Vs(u(L.cwd(),"package.json"),`${JSON.stringify(e,null,2)}
5
+ `)}function ma(e){return e instanceof Fe&&(e.code==="ECONNRESET"||e.response?.status!==void 0&&e.response?.status>=500&&e.response?.status<600)}function ks(e,t){return e<kn&&ma(t)}async function Fs(e,t,o,s){const n={value:0},i=e.config.app.templates.length>0?Pn:An;return e.config.axios.post(i,{file:Ks(u(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=>Kr(r,j,la,n,Ns)}).then(r=>(j.increment(),r)).catch(async r=>{if(ks(s,r))return await As(xs(s)),Fs(e,t,o,s+1);throw j.increment(),r})}function ya(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 Fs(o,t.url,s,0)})}function ga(e){const t=[...Ur(e),...zr(e),...Xr(e),...Hr(e)];return ya(t)}function ha(e){return e.includes(`
6
+ `)}function $a(e,t,o){return e.split(`
7
7
  `).map((s,n)=>n>=o?t+s:s).join(`
8
- `)}function W(e,t){const o=[];if(e instanceof Ie){e.response?.status!==void 0&&o.push(` HTTP Status Code: ${e.response.status}`);const r=e.response?.data;if(r?.errorCode&&o.push(` Error Code: ${r.errorCode}`),r?.errorMessage){const i=Hi(r.errorMessage)?Vi(r.errorMessage," ",1):r.errorMessage;o.push(` Error Message: ${i}`)}}const s=o.length>0?o.join(`
8
+ `)}function te(e,t){const o=[];if(e instanceof Fe){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=ha(i.errorMessage)?$a(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 Ss(e,t=0){const o=e.app.templates.length>0?ar:ir;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,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(js(t,s))return await Es(ws(t)),Ss(e,t+1);throw s})}async function Ki(e){try{if(!j(f(A.cwd(),E)))throw new Error(B.DISTRIBUTION_FOLDER_NOT_FOUND(E));const t=e??sr;a.info("Custom application deployment :: Started");const o=Ys.create({baseURL:t});Ws(o,cr),a.info("Loading configuration files ...");const s=await Promise.all([Gi(),Bi(),vi(),Fi()]).then(async([i,c,l,d])=>({axios:o,app:{crane:i,packageJson:c,sections:l,layouts:d,templates:await Li(i.appClientId)}}));a.info("Uploading files ..."),Ts=Date.now(),await Promise.all(Xi(s)).catch(i=>{O.stop(),i.response?.status===404?a.error(W(i,B.DEPRECATED_VERSION_DEPLOYMENT)):a.error(W(i,B.ASSET_FILES_UPLOAD)),A.exit(1)}).finally(()=>{O.increment(),O.stop()}),O.update({speed:"N/A",status:"Finalising deployment"}),await Ss(s).catch(i=>{O.stop(),i.response?.status===404?a.error(W(i,B.DEPRECATED_VERSION_DEPLOYMENT)):a.error(W(i,B.MANIFEST_DEPLOYMENT)),A.exit(1)}).finally(()=>{O.increment(),O.stop()});const n=s.app.sections.map(i=>i.id),r=s.app.packageJson.version;a.info("Custom application deployment :: Successful"),a.info(`Current app version: ${r}`),a.info(`Deployed sections: ${n.join(", ")}`),await qi(s.app.packageJson),s.app.templates.length>0&&a.info(`Deployed templates: ${s.app.templates.map(i=>i.id).join(", ")}`)}catch(t){O.stop(),a.error(W(t,B.DEFAULT)),A.exit(1)}}const Yi="1.2.4";async function Ji(e){ce(),ie("template/headers/example-header","headers",e,"Header")}async function Wi(e){ce(),ie("template/footers/example-footer","footers",e,"Footer")}const Zi={deploy:["url"],init:["customStorefrontPages"],build:["generatePreview"]};function Qi(e,t){return e.options.length!==0&&Object.keys(t).length===1}function ea(e){return e.includes("-h")||e.includes("--help")}function ta(e,t){return Object.keys(t).some(o=>o!=="--"&&!e.hasOption(o)&&!Zi[e.rawName]?.includes(o))}function oa(e){return e.length!==0}function sa(e,t,o){return e.matchedCommand!==void 0&&(Qi(e.matchedCommand,o)||ea(e.rawArgs)||ta(e.matchedCommand,e.options)||oa(t))}function na(e,t,o){e.matchedCommand&&!sa(e,t,o)?e.runMatchedCommand():e.outputHelp()}async function ra(e,t){const o=f(`${e}/shared/preview.ts`);await ne({build:{lib:{entry:o,formats:["es"],fileName:()=>"preview.js"},outDir:f(t),emptyOutDir:!1,rollupOptions:{output:{entryFileNames:"preview.js"}},target:"esnext"}})}async function ia(){const e="preview",t=`${e}/shared`,o="vite.config.js",s=`${e}/sections`,n=`${s}/preview.html`;[e,s].forEach(i=>{u.existsSync(i)||u.mkdirSync(i,{recursive:!0})});const r=L("template/preview");u.existsSync(`${e}/${o}`)||u.copyFileSync(`${r}/${o}`,`${e}/${o}`),u.existsSync(n)||u.copyFileSync(`${r}/sections/preview.html`,n),u.existsSync(t)||(u.mkdirSync(t),await ra(r,t))}async function aa(){const e=y.resolve(process.cwd(),"preview/vite.config.js"),t=await Gs({configFile:e,root:process.cwd()});return await t.listen(),t}async function ca(){return await ms(),ia(),aa()}function _s(e){if(on(e))return console.log("Please specify a name for your resource."),!1;const{isValid:t,errorMessage:o}=tn(e);return o&&console.log(o),t}async function vs(e,t,o,s,n){const r=(await Te({type:"text",name:"name",message:`Please specify a name for your ${t}:`})).name;if(r===void 0)return console.log(`You can use ${o} to directly specify the name of the ${t}.`),e.outputHelp();const i=y.basename(r);return _s(i)?s(i,n):vs(e,t,o,s,n)}async function Z(e,t,o,s,n,r){if(n!==void 0)if(!_s(n))await vs(e,t,o,s);else{const i=y.basename(n.toString());await s(i,r)}}async function pa(e,t){try{const{app:o,section:s,header:n,footer:r,template:i,customStorefrontPages:c,referenceTemplate:l}=e,d=!!c;await Z(t,"app",R("init --app <name>"),un,o),await Z(t,"section",R("init --section <name>"),yn,s),await Z(t,"header",R("init --header <name>"),Ji,n),await Z(t,"footer",R("init --footer <name>"),Wi,r),await Z(t,"template",R("init --template <name>"),gn,i,d),l&&await hn()}catch(o){a.error(`Error while executing init operation: ${o.message}`),process.exit(1)}}function la(){try{const e=Is("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=>pa(o,e)),e.command("build","Builds your resource code").allowUnknownOptions().action(()=>ms()),e.command("preview","Runs a local server to preview resources").allowUnknownOptions().action(()=>ca()),e.command("deploy","Deploys your resource code").allowUnknownOptions().action(()=>Ki(e.options.url)),e.version(Yi),e.usage("<action> <resource>");const t=e.parse(process.argv,{run:!1});na(e,t.args,t.options)}catch(e){a.error(`Error while parsing input: ${e.message}`),process.exit(1)}}export{la as run};
10
+ `:" ";return`${t}${n}${s}`}async function Rs(e,t=0){const o=e.app.templates.length>0?Nn:Ln;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(ks(t,s))return await As(xs(t)),Rs(e,t+1);throw s})}async function ba(e){try{if(!w(u(L.cwd(),b)))throw new Error(U.DISTRIBUTION_FOLDER_NOT_FOUND(b));const t=e??Cn;a.info("Custom application deployment :: Started");const o=ln.create({baseURL:t});pn(o,xn),a.info("Loading configuration files ...");const s=await Promise.all([pa(),fa(),sa(),li(),nr()]).then(async([r,c,m,f,h])=>({axios:o,app:{crane:r,packageJson:c,sections:m,layouts:f,slots:h,templates:await ca(r.appClientId)}}));a.info("Uploading files ..."),Ns=Date.now(),await Promise.all(ga(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 Rs(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 ua(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)}}const Ea="1.2.5";async function Ta(e){me(),fe("template/headers/example-header","headers",e,"Header")}async function wa(e){me(),fe("template/footers/example-footer","footers",e,"Footer")}const Sa={deploy:["url"],init:["customStorefrontPages"],build:["generatePreview"]};function ja(e,t){return e.options.length!==0&&Object.keys(t).length===1}function Oa(e){return e.includes("-h")||e.includes("--help")}function _a(e,t){return Object.keys(t).some(o=>o!=="--"&&!e.hasOption(o)&&!Sa[e.rawName]?.includes(o))}function Ia(e){return e.length!==0}function va(e,t,o){return e.matchedCommand!==void 0&&(ja(e.matchedCommand,o)||Oa(e.rawArgs)||_a(e.matchedCommand,e.options)||Ia(t))}function Da(e,t,o){e.matchedCommand&&!va(e,t,o)?e.runMatchedCommand():e.outputHelp()}async function Ca(e,t){const o=u(`${e}/shared/preview.ts`);await de({build:{lib:{entry:o,formats:["es"],fileName:()=>"preview.js"},outDir:u(t),emptyOutDir:!1,rollupOptions:{output:{entryFileNames:"preview.js"}},target:"esnext"}})}async function Aa(){const e="preview",t=`${e}/shared`,o="vite.config.js",s=`${e}/sections`,n=`${s}/preview.html`;[e,s].forEach(r=>{y.existsSync(r)||y.mkdirSync(r,{recursive:!0})});const i=k("template/preview");y.existsSync(`${e}/${o}`)||y.copyFileSync(`${i}/${o}`,`${e}/${o}`),y.existsSync(n)||y.copyFileSync(`${i}/sections/preview.html`,n),y.existsSync(t)||(y.mkdirSync(t),await Ca(i,t))}async function Pa(){const e=g.resolve(process.cwd(),"preview/vite.config.js"),t=await Js({configFile:e,root:process.cwd()});return await t.listen(),t}async function La(){return await Cs(),Aa(),Pa()}function Gs(e){if(yn(e))return console.log("Please specify a name for your resource."),!1;const{isValid:t,errorMessage:o}=mn(e);return o&&console.log(o),t}async function Ms(e,t,o,s,n){const i=(await De({type:"text",name:"name",message:`Please specify a name for your ${t}:`})).name;if(i===void 0)return console.log(`You can use ${o} to directly specify the name of the ${t}.`),e.outputHelp();const r=g.basename(i);return Gs(r)?s(r,n):Ms(e,t,o,s,n)}async function oe(e,t,o,s,n,i){if(n!==void 0)if(!Gs(n))await Ms(e,t,o,s);else{const r=g.basename(n.toString());await s(r,i)}}async function Na(e,t){try{const{app:o,section:s,header:n,footer:i,template:r,customStorefrontPages:c,referenceTemplate:m}=e,f=!!c;await oe(t,"app",M("init --app <name>"),On,o),await oe(t,"section",M("init --section <name>"),In,s),await oe(t,"header",M("init --header <name>"),Ta,n),await oe(t,"footer",M("init --footer <name>"),wa,i),await oe(t,"template",M("init --template <name>"),vn,r,f),m&&await Dn()}catch(o){a.error(`Error while executing init operation: ${o.message}`),process.exit(1)}}function xa(){try{const e=qs("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=>Na(o,e)),e.command("build","Builds your resource code").allowUnknownOptions().action(()=>Cs()),e.command("preview","Runs a local server to preview resources").allowUnknownOptions().action(()=>La()),e.command("deploy","Deploys your resource code").allowUnknownOptions().action(()=>ba(e.options.url)),e.version(Ea),e.usage("<action> <resource>");const t=e.parse(process.argv,{run:!1});Da(e,t.args,t.options)}catch(e){a.error(`Error while parsing input: ${e.message}`),process.exit(1)}}export{xa as run};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightspeed/crane",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "type": "module",
5
5
  "bin": "bin/crane.js",
6
6
  "main": "./dist/app.mjs",
@@ -36,29 +36,29 @@
36
36
  },
37
37
  "license": "MIT",
38
38
  "devDependencies": {
39
- "@jest/globals": "^29.7.0",
40
- "@stylistic/eslint-plugin": "^4.2.0",
39
+ "@jest/globals": "^30.0.4",
40
+ "@stylistic/eslint-plugin": "^5.1.0",
41
41
  "@types/adm-zip": "^0.5.7",
42
42
  "@types/axios-concurrency": "^1.0.0",
43
43
  "@types/cli-progress": "^3.11.6",
44
44
  "@types/express-fileupload": "^1.5.0",
45
45
  "@types/fs-extra": "^11.0.1",
46
- "@types/jest": "^29.5.12",
46
+ "@types/jest": "^30.0.0",
47
47
  "@types/mock-fs": "^4.13.4",
48
- "@types/node": "^20.4.5",
48
+ "@types/node": "^24.0.10",
49
49
  "@types/semver": "^7.5.8",
50
50
  "@types/tinycolor2": "^1.4.6",
51
51
  "dir-compare": "^5.0.0",
52
- "express": "^4.19.2",
53
- "express-fileupload": "^1.5.1",
54
- "jest": "^29.7.0",
52
+ "express": "^5.1.0",
53
+ "express-fileupload": "^1.5.2",
54
+ "jest": "^30.0.4",
55
55
  "mock-fs": "^5.5.0",
56
- "ts-jest": "^29.1.5",
56
+ "ts-jest": "^29.4.0",
57
57
  "ts-node": "^10.9.2",
58
58
  "typescript": "5.4.5",
59
59
  "unbuild": "^3.5.0",
60
- "vite-plugin-dts": "^3.4.0",
61
- "vite-plugin-static-copy": "^3.0.0"
60
+ "vite-plugin-dts": "^4.5.4",
61
+ "vite-plugin-static-copy": "^3.1.0"
62
62
  },
63
63
  "dependencies": {
64
64
  "@jridgewell/sourcemap-codec": "^1.4.15",
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div>
3
3
  <slot :name="Slot.PRODUCT_LIST" />
4
- <slot :name="Slot.BOTTOM_BAR" />
4
+ <slot :name="Slot.CUSTOM_SLOT" slot-id="custom-bottom-bar" />
5
5
  </div>
6
6
  </template>
7
7
 
@@ -0,0 +1,11 @@
1
+ <svg
2
+ width="24"
3
+ height="24"
4
+ viewBox="0 0 24 24"
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ >
7
+ <path
8
+ d="M23.5 12.0037C23.5012 10.0898 23.0244 8.20585 22.1129 6.52281C21.2014 4.83976 19.884 3.41084 18.2802 2.36565C16.6764 1.32047 14.8369 0.692104 12.9287 0.537549C11.0204 0.382995 9.10378 0.707143 7.35258 1.48059C5.60138 2.25404 4.07105 3.45232 2.9004 4.96672C1.72975 6.48113 0.955821 8.26374 0.64882 10.1529C0.34182 12.042 0.511461 13.9779 1.14235 15.7848C1.77325 17.5918 2.84543 19.2128 4.26165 20.5006C4.28966 20.5338 4.32226 20.5629 4.35848 20.5869C6.46141 22.4631 9.18149 23.5 12.0001 23.5C14.8188 23.5 17.5388 22.463 19.6417 20.5867C19.6778 20.5628 19.7102 20.5338 19.7381 20.5007C20.9235 19.4252 21.8705 18.1135 22.5184 16.6501C23.1663 15.1867 23.5007 13.604 23.5 12.0037ZM1.42 12.0037C1.41878 10.2648 1.84643 8.55248 2.66509 7.01827C3.48375 5.48405 4.66817 4.17528 6.11348 3.20782C7.55879 2.24035 9.22042 1.64404 10.9512 1.47168C12.6821 1.29931 14.4287 1.55621 16.0365 2.21963C17.6444 2.88305 19.0638 3.93252 20.1691 5.27513C21.2744 6.61775 22.0316 8.21209 22.3735 9.91701C22.7155 11.6219 22.6317 13.3848 22.1295 15.0496C21.6274 16.7145 20.7224 18.2298 19.4947 19.4616C18.3528 17.55 16.5208 16.1493 14.3764 15.5482C15.373 15.0182 16.1638 14.1702 16.6228 13.1392C17.0819 12.1081 17.1828 10.9532 16.9096 9.85816C16.6364 8.76314 16.0047 7.79091 15.1151 7.09614C14.2254 6.40136 13.1289 6.02395 12 6.02395C10.8711 6.02395 9.77458 6.40136 8.88494 7.09614C7.9953 7.79091 7.36363 8.76314 7.09042 9.85816C6.8172 10.9532 6.91814 12.1081 7.37717 13.1392C7.8362 14.1702 8.62696 15.0182 9.62364 15.5482C7.4792 16.1493 5.64721 17.55 4.50533 19.4616C3.52633 18.4819 2.74996 17.3191 2.22057 16.0394C1.69119 14.7598 1.41915 13.3884 1.42 12.0037ZM12 15.2226C11.1812 15.2226 10.3808 14.9799 9.69994 14.5252C9.01912 14.0704 8.48848 13.424 8.17514 12.6678C7.86179 11.9115 7.77981 11.0794 7.93955 10.2765C8.09929 9.4737 8.49359 8.73626 9.07258 8.15745C9.65157 7.57864 10.3892 7.18447 11.1923 7.02478C11.9954 6.86509 12.8278 6.94705 13.5843 7.26029C14.3408 7.57354 14.9874 8.10401 15.4423 8.78461C15.8972 9.46522 16.14 10.2654 16.14 11.084C16.1388 12.1812 15.7022 13.2332 14.9261 14.0091C14.1499 14.785 13.0976 15.2214 12 15.2226ZM5.19947 20.0991C5.88217 18.8976 6.87116 17.8985 8.06574 17.2035C9.26032 16.5084 10.6178 16.1422 12 16.1422C13.3822 16.1422 14.7397 16.5084 15.9343 17.2035C17.1288 17.8985 18.1178 18.8976 18.8005 20.0991C16.897 21.7015 14.4885 22.5803 12 22.5803C9.51148 22.5803 7.10295 21.7015 5.19947 20.0991Z"
9
+ fill="currentColor"
10
+ />
11
+ </svg>
@@ -0,0 +1,52 @@
1
+ <template>
2
+ <div class="icon" :class="iconClass">
3
+ <img :src="accountIcon" alt="account icon" />
4
+ </div>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import { computed } from 'vue';
9
+ import accountIcon from '../assets/account-icon.svg';
10
+
11
+ interface Props {
12
+ size?: 'small' | 'medium' | 'large';
13
+ color?: string;
14
+ }
15
+
16
+ const props = withDefaults(defineProps<Props>(), {
17
+ size: 'medium',
18
+ color: 'currentColor',
19
+ });
20
+
21
+ const iconClass = computed(() => ({
22
+ [`icon--${props.size}`]: true,
23
+ }));
24
+ </script>
25
+
26
+ <style lang="scss" scoped>
27
+ .icon {
28
+ display: inline-flex;
29
+ align-items: center;
30
+ justify-content: center;
31
+
32
+ svg {
33
+ fill: v-bind(color);
34
+ transition: all 0.3s ease;
35
+ }
36
+
37
+ &--small svg {
38
+ width: 16px;
39
+ height: 16px;
40
+ }
41
+
42
+ &--medium svg {
43
+ width: 24px;
44
+ height: 24px;
45
+ }
46
+
47
+ &--large svg {
48
+ width: 32px;
49
+ height: 32px;
50
+ }
51
+ }
52
+ </style>
@@ -0,0 +1 @@
1
+ export default {} as const;
@@ -0,0 +1 @@
1
+ export default {} as const;
@@ -0,0 +1 @@
1
+ export default {} as const;
@@ -0,0 +1,69 @@
1
+ <template>
2
+ <div class="custom-bottom-bar">
3
+ <button class="account-button" @click="goToAccount">
4
+ <Icon size="small" color="white" />
5
+ <span class="account-text">Go to Account</span>
6
+ </button>
7
+ </div>
8
+ </template>
9
+
10
+ <script setup lang="ts">
11
+ import Icon from '../../components/Icon.vue';
12
+
13
+ const goToAccount = () => {
14
+ // eslint-disable-next-line
15
+ const storefrontApi = (window as any)?.Ecwid;
16
+
17
+ storefrontApi?.OnAPILoaded.add(() => {
18
+ storefrontApi?.openPage('account');
19
+ });
20
+ };
21
+ </script>
22
+
23
+ <style lang="scss" scoped>
24
+ .custom-bottom-bar {
25
+ position: fixed;
26
+ bottom: 0;
27
+ left: 0;
28
+ right: 0;
29
+ padding: 16px;
30
+ background: linear-gradient(to top, rgba(0, 0, 0, 0.1), transparent);
31
+ pointer-events: none;
32
+ z-index: 1000;
33
+
34
+ .account-button {
35
+ display: flex;
36
+ align-items: center;
37
+ gap: 8px;
38
+ background: #333;
39
+ color: white;
40
+ border: none;
41
+ padding: 12px 20px;
42
+ border-radius: 8px;
43
+ cursor: pointer;
44
+ font-size: 14px;
45
+ font-weight: 500;
46
+ transition: all 0.3s ease;
47
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
48
+ margin: 0 auto;
49
+ pointer-events: auto;
50
+ min-width: 160px;
51
+ justify-content: center;
52
+
53
+ &:hover {
54
+ background: #555;
55
+ transform: translateY(-2px);
56
+ box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
57
+ }
58
+
59
+ &:active {
60
+ transform: translateY(0);
61
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
62
+ }
63
+
64
+ .account-text {
65
+ white-space: nowrap;
66
+ }
67
+ }
68
+ }
69
+ </style>
@@ -0,0 +1,5 @@
1
+ import { createVueClientApp } from '@lightspeed/crane';
2
+ import CustomBottomBar from './CustomBottomBar.vue';
3
+ import { Content, Design } from '../../type.ts';
4
+
5
+ export default createVueClientApp<Content, Design>(CustomBottomBar);
@@ -0,0 +1,5 @@
1
+ import { createVueServerApp } from '@lightspeed/crane';
2
+ import CustomBottomBar from './CustomBottomBar.vue';
3
+ import { Content, Design } from '../../type.ts';
4
+
5
+ export default createVueServerApp<Content, Design>(CustomBottomBar);
@@ -0,0 +1,5 @@
1
+ import ContentSettings from './settings/content.ts';
2
+ import DesignSettings from './settings/design.ts';
3
+
4
+ export type Content = InferContentType<typeof ContentSettings>;
5
+ export type Design = InferDesignType<typeof DesignSettings>;
@@ -0,0 +1 @@
1
+ export default {} as const;
@@ -0,0 +1 @@
1
+ export default {} as const;
@@ -0,0 +1,5 @@
1
+ import ContentSettings from './settings/content.ts';
2
+ import DesignSettings from './settings/design.ts';
3
+
4
+ export type Content = InferContentType<typeof ContentSettings>;
5
+ export type Design = InferDesignType<typeof DesignSettings>;
@@ -0,0 +1 @@
1
+ export default {} as const;
@@ -0,0 +1 @@
1
+ export default {} as const;
@@ -0,0 +1,5 @@
1
+ import ContentSettings from './settings/content.ts';
2
+ import DesignSettings from './settings/design.ts';
3
+
4
+ export type Content = InferContentType<typeof ContentSettings>;
5
+ export type Design = InferDesignType<typeof DesignSettings>;
@@ -1,9 +1,10 @@
1
+ import { StorePageConfiguration } from '@lightspeed/crane';
2
+
1
3
  export default {
2
4
  sections: [
3
5
  {
4
- type: 'default',
5
- id: 'catalog',
6
- layout_id: 'example-catalog',
6
+ type: 'store',
7
+ id: 'example-catalog',
7
8
  },
8
9
  ],
9
- };
10
+ } satisfies StorePageConfiguration;
@@ -1,9 +1,10 @@
1
+ import { StorePageConfiguration } from '@lightspeed/crane';
2
+
1
3
  export default {
2
4
  sections: [
3
5
  {
4
- type: 'default',
5
- id: 'category',
6
- layout_id: 'example-category',
6
+ type: 'store',
7
+ id: 'example-category',
7
8
  },
8
9
  ],
9
- };
10
+ } satisfies StorePageConfiguration;
@@ -1,9 +1,10 @@
1
+ import { StorePageConfiguration } from '@lightspeed/crane';
2
+
1
3
  export default {
2
4
  sections: [
3
5
  {
4
- type: 'default',
5
- id: 'product',
6
- layout_id: 'example-product',
6
+ type: 'store',
7
+ id: 'example-product',
7
8
  },
8
9
  ],
9
- };
10
+ } satisfies StorePageConfiguration;