@lightspeed/crane 1.2.3 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.4 - 2025-06-02
4
+
5
+ ### Added
6
+
7
+ - **Storefront (experimental):** add multipage template support in the 'deploy' flow.
8
+ - **Storefront (experimental):** add external layout support during compilation of multipage templates.
9
+ - **Storefront (experimental):** implement external layout selection and deployment integration for multipage templates.
10
+ - **Local Preview (experimental):** add structural support for local custom section preview generation.
11
+ - Add validation for translation label properties in custom section configuration files during the 'build' command.
12
+ - Add typing for all the available font sets in the custom section configuration files.
13
+
14
+ ### Changed
15
+
16
+ - Update versions of 'unbuild' and 'vite-plugin-static-copy' dependencies.
17
+
18
+ ### Fixed
19
+
20
+ - Fix the validation flow for template section showcase overrides.
21
+
3
22
  ## 1.2.3 - 2025-05-15
4
23
 
5
24
  ### Changed
package/README.md CHANGED
@@ -122,3 +122,5 @@ For more information regarding the notable changes for each versioned release an
122
122
 
123
123
  - [CHANGELOG](CHANGELOG.md)
124
124
  - [UPGRADE](UPGRADE.md)
125
+
126
+ Note: for visitors through the `npmjs.com` site, please refer to the individual files in the `Code` tab of the package repository, as the links above will not work.
package/dist/app.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as vue from 'vue';
2
- import type { Ref, App, Component } from 'vue';
2
+ import { App, Ref, Component } from 'vue';
3
3
 
4
4
  interface AppBaseContext {
5
5
  readonly appName: string;
@@ -56,8 +56,6 @@ interface GlobalDesign {
56
56
  customCss?: string;
57
57
  }
58
58
 
59
-
60
-
61
59
  interface VueBaseProps<CONTENT, DESIGN> {
62
60
  init: (app: App<Element>, contextValue: AppBaseContext, contentValue: CONTENT, designValue: DESIGN, defaultsValue: Record<string, unknown>, externalContent: ExternalContentData, globalDesignValue: GlobalDesign) => void;
63
61
  update: (app: App<Element>, contentValue: CONTENT, designValue: DESIGN, defaultsValue: Record<string, unknown>, externalContent: ExternalContentData, globalDesignValue: GlobalDesign) => void;
@@ -242,15 +240,6 @@ declare function useLogoElementContent<CONTENT>(): {
242
240
  };
243
241
  };
244
242
 
245
-
246
-
247
-
248
-
249
-
250
-
251
-
252
-
253
-
254
243
  declare function useTextElementDesign<DESIGN>(elementName: keyof DESIGN): {
255
244
  font: string | undefined;
256
245
  size: number | GlobalTextSizeString | undefined;
@@ -302,10 +291,6 @@ declare function useLayoutElementDesign(): {
302
291
 
303
292
  declare function useLogoElementDesign<DESIGN>(): vue.ComputedRef<LogoDesignData>;
304
293
 
305
-
306
-
307
-
308
-
309
294
  interface VueServerAppExtensions {
310
295
  init?: (app: App<Element>) => void;
311
296
  render?: <C, D>(app: App<Element>, context: AppBaseContext, data: AppBaseData<C, D>) => void;
@@ -320,10 +305,6 @@ declare function createVueServerApp<C, D>(appComponent: Component, extensions?:
320
305
  };
321
306
  };
322
307
 
323
-
324
-
325
-
326
-
327
308
  interface VueClientAppExtensions {
328
309
  init?: (app: App<Element>) => void;
329
310
  mount?: <C, D, S extends AppBaseState<C, D>>(app: App<Element>, rootContainer: string, state: S) => void;
@@ -343,74 +324,84 @@ interface InstantsiteTilePromise {
343
324
  }
344
325
  interface InstantsiteJSAPI {
345
326
  /**
346
- * Retrieves the current site ID.
347
- *
348
- * @returns {number} The site ID.
349
- */
327
+ * Retrieves the current site ID.
328
+ *
329
+ * @returns {number} The site ID.
330
+ */
350
331
  getSiteId: () => number;
351
332
  /**
352
- * Retrieves the public token for a given app.
353
- *
354
- * @param {string} appId - The ID of the app.
355
- * @returns {string | undefined} The app's public token, or `undefined` if not found.
356
- */
333
+ * Retrieves the public token for a given app.
334
+ *
335
+ * @param {string} appId - The ID of the app.
336
+ * @returns {string | undefined} The app's public token, or `undefined` if not found.
337
+ */
357
338
  getAppPublicToken: (appId: string) => string | undefined;
358
339
  /**
359
- * Retrieves the public configuration for a given app.
360
- *
361
- * @param {string} appId - The ID of the app.
362
- * @returns {string | undefined} The app's public configuration, or `undefined` if not found.
363
- */
340
+ * Retrieves the public configuration for a given app.
341
+ *
342
+ * @param {string} appId - The ID of the app.
343
+ * @returns {string | undefined} The app's public configuration, or `undefined` if not found.
344
+ */
364
345
  getAppPublicConfig: (appId: string) => string | undefined;
365
346
  /**
366
- * An event that triggers when a tile is loaded.
367
- *
368
- * @type {InstantsiteTilePromise}
369
- *
370
- * @example
371
- * ```ts
372
- * const tileLoadedPromise = instantsiteJsApi?.onTileLoaded;
373
- *
374
- * tileLoadedPromise?.add((tileId) => {
375
- * console.log('Tile loaded:', tileId);
376
- * });
377
- * ```
378
- */
347
+ * An event that triggers when a tile is loaded.
348
+ *
349
+ * @type {InstantsiteTilePromise}
350
+ *
351
+ * @example
352
+ * ```ts
353
+ * const tileLoadedPromise = instantsiteJsApi?.onTileLoaded;
354
+ *
355
+ * tileLoadedPromise?.add((tileId) => {
356
+ * console.log('Tile loaded:', tileId);
357
+ * });
358
+ * ```
359
+ */
379
360
  onTileLoaded: InstantsiteTilePromise;
380
361
  /**
381
- * An event that triggers when a tile is unloaded.
382
- *
383
- * @type {InstantsiteTilePromise}
384
- *
385
- * @example
386
- * ```ts
387
- * const tileUnloadedPromise = instantsiteJsApi?.onTileUnloaded;
388
- *
389
- * tileUnloadedPromise?.add((tileId) => {
390
- * console.log('Tile unloaded:', tileId);
391
- * });
392
- * ```
393
- */
362
+ * An event that triggers when a tile is unloaded.
363
+ *
364
+ * @type {InstantsiteTilePromise}
365
+ *
366
+ * @example
367
+ * ```ts
368
+ * const tileUnloadedPromise = instantsiteJsApi?.onTileUnloaded;
369
+ *
370
+ * tileUnloadedPromise?.add((tileId) => {
371
+ * console.log('Tile unloaded:', tileId);
372
+ * });
373
+ * ```
374
+ */
394
375
  onTileUnloaded: InstantsiteTilePromise;
395
376
  /**
396
- * Opens the search page with the specified keyword.
397
- *
398
- * @param {string | undefined} keyword - The keyword to search for.
399
- * @returns {void}
400
- */
377
+ * Opens the search page with the specified keyword.
378
+ *
379
+ * @param {string | undefined} keyword - The keyword to search for.
380
+ * @returns {void}
381
+ */
401
382
  openSearchPage: (keyword: string | undefined) => void;
402
383
  }
403
384
 
404
385
  declare function useInstantsiteJsApi(): InstantsiteJSAPI | undefined;
405
386
 
387
+ declare const CatalogLayoutSlot: {
388
+ readonly PRODUCT_LIST: "CONTROLS";
389
+ readonly BOTTOM_BAR: "FOOTER";
390
+ };
391
+ declare const CategoryLayoutSlot: {
392
+ readonly CATEGORY_TITLE: "MAIN_TITLE";
393
+ readonly PRODUCT_LIST: "CONTROLS";
394
+ readonly BOTTOM_BAR: "FOOTER";
395
+ };
396
+ declare const ProductLayoutSlot: {
397
+ readonly TOP_BAR: "TOP_BAR";
398
+ readonly GALLERY: "GALLERY";
399
+ readonly SIDEBAR: "SIDEBAR";
400
+ readonly DESCRIPTION: "DESCRIPTION";
401
+ readonly REVIEW_LIST: "REVIEW_LIST";
402
+ readonly RELATED_PRODUCTS: "RELATED_PRODUCTS";
403
+ readonly BOTTOM_BAR: "FOOTER";
404
+ };
406
405
 
407
-
408
-
409
-
410
-
411
-
412
-
413
-
414
-
415
- export { EditorTypes, createVueClientApp, createVueServerApp, useBackgroundElementDesign, useButtonElementContent, useButtonElementDesign, useDeckElementContent, useImageElementContent, useImageElementDesign, useInputboxElementContent, useInstantsiteJsApi, useLayoutElementDesign, useLogoElementContent, useLogoElementDesign, useMenuElementContent, useNavigationMenuElementContent, useSelectboxElementContent, useSelectboxElementDesign, useTextElementDesign, useTextareaElementContent, useTextareaElementDesign, useToggleElementContent, useToggleElementDesign, useVueBaseProps };
406
+ 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 };
416
407
  export type { ButtonContent, Card, Deck, ImageContent, InputBoxContent, SelectBoxContent, TextAreaContent, ToggleContent };
package/dist/app.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as vue from 'vue';
2
- import type { Ref, App, Component } from 'vue';
2
+ import { App, Ref, Component } from 'vue';
3
3
 
4
4
  interface AppBaseContext {
5
5
  readonly appName: string;
@@ -56,8 +56,6 @@ interface GlobalDesign {
56
56
  customCss?: string;
57
57
  }
58
58
 
59
-
60
-
61
59
  interface VueBaseProps<CONTENT, DESIGN> {
62
60
  init: (app: App<Element>, contextValue: AppBaseContext, contentValue: CONTENT, designValue: DESIGN, defaultsValue: Record<string, unknown>, externalContent: ExternalContentData, globalDesignValue: GlobalDesign) => void;
63
61
  update: (app: App<Element>, contentValue: CONTENT, designValue: DESIGN, defaultsValue: Record<string, unknown>, externalContent: ExternalContentData, globalDesignValue: GlobalDesign) => void;
@@ -242,15 +240,6 @@ declare function useLogoElementContent<CONTENT>(): {
242
240
  };
243
241
  };
244
242
 
245
-
246
-
247
-
248
-
249
-
250
-
251
-
252
-
253
-
254
243
  declare function useTextElementDesign<DESIGN>(elementName: keyof DESIGN): {
255
244
  font: string | undefined;
256
245
  size: number | GlobalTextSizeString | undefined;
@@ -302,10 +291,6 @@ declare function useLayoutElementDesign(): {
302
291
 
303
292
  declare function useLogoElementDesign<DESIGN>(): vue.ComputedRef<LogoDesignData>;
304
293
 
305
-
306
-
307
-
308
-
309
294
  interface VueServerAppExtensions {
310
295
  init?: (app: App<Element>) => void;
311
296
  render?: <C, D>(app: App<Element>, context: AppBaseContext, data: AppBaseData<C, D>) => void;
@@ -320,10 +305,6 @@ declare function createVueServerApp<C, D>(appComponent: Component, extensions?:
320
305
  };
321
306
  };
322
307
 
323
-
324
-
325
-
326
-
327
308
  interface VueClientAppExtensions {
328
309
  init?: (app: App<Element>) => void;
329
310
  mount?: <C, D, S extends AppBaseState<C, D>>(app: App<Element>, rootContainer: string, state: S) => void;
@@ -343,74 +324,84 @@ interface InstantsiteTilePromise {
343
324
  }
344
325
  interface InstantsiteJSAPI {
345
326
  /**
346
- * Retrieves the current site ID.
347
- *
348
- * @returns {number} The site ID.
349
- */
327
+ * Retrieves the current site ID.
328
+ *
329
+ * @returns {number} The site ID.
330
+ */
350
331
  getSiteId: () => number;
351
332
  /**
352
- * Retrieves the public token for a given app.
353
- *
354
- * @param {string} appId - The ID of the app.
355
- * @returns {string | undefined} The app's public token, or `undefined` if not found.
356
- */
333
+ * Retrieves the public token for a given app.
334
+ *
335
+ * @param {string} appId - The ID of the app.
336
+ * @returns {string | undefined} The app's public token, or `undefined` if not found.
337
+ */
357
338
  getAppPublicToken: (appId: string) => string | undefined;
358
339
  /**
359
- * Retrieves the public configuration for a given app.
360
- *
361
- * @param {string} appId - The ID of the app.
362
- * @returns {string | undefined} The app's public configuration, or `undefined` if not found.
363
- */
340
+ * Retrieves the public configuration for a given app.
341
+ *
342
+ * @param {string} appId - The ID of the app.
343
+ * @returns {string | undefined} The app's public configuration, or `undefined` if not found.
344
+ */
364
345
  getAppPublicConfig: (appId: string) => string | undefined;
365
346
  /**
366
- * An event that triggers when a tile is loaded.
367
- *
368
- * @type {InstantsiteTilePromise}
369
- *
370
- * @example
371
- * ```ts
372
- * const tileLoadedPromise = instantsiteJsApi?.onTileLoaded;
373
- *
374
- * tileLoadedPromise?.add((tileId) => {
375
- * console.log('Tile loaded:', tileId);
376
- * });
377
- * ```
378
- */
347
+ * An event that triggers when a tile is loaded.
348
+ *
349
+ * @type {InstantsiteTilePromise}
350
+ *
351
+ * @example
352
+ * ```ts
353
+ * const tileLoadedPromise = instantsiteJsApi?.onTileLoaded;
354
+ *
355
+ * tileLoadedPromise?.add((tileId) => {
356
+ * console.log('Tile loaded:', tileId);
357
+ * });
358
+ * ```
359
+ */
379
360
  onTileLoaded: InstantsiteTilePromise;
380
361
  /**
381
- * An event that triggers when a tile is unloaded.
382
- *
383
- * @type {InstantsiteTilePromise}
384
- *
385
- * @example
386
- * ```ts
387
- * const tileUnloadedPromise = instantsiteJsApi?.onTileUnloaded;
388
- *
389
- * tileUnloadedPromise?.add((tileId) => {
390
- * console.log('Tile unloaded:', tileId);
391
- * });
392
- * ```
393
- */
362
+ * An event that triggers when a tile is unloaded.
363
+ *
364
+ * @type {InstantsiteTilePromise}
365
+ *
366
+ * @example
367
+ * ```ts
368
+ * const tileUnloadedPromise = instantsiteJsApi?.onTileUnloaded;
369
+ *
370
+ * tileUnloadedPromise?.add((tileId) => {
371
+ * console.log('Tile unloaded:', tileId);
372
+ * });
373
+ * ```
374
+ */
394
375
  onTileUnloaded: InstantsiteTilePromise;
395
376
  /**
396
- * Opens the search page with the specified keyword.
397
- *
398
- * @param {string | undefined} keyword - The keyword to search for.
399
- * @returns {void}
400
- */
377
+ * Opens the search page with the specified keyword.
378
+ *
379
+ * @param {string | undefined} keyword - The keyword to search for.
380
+ * @returns {void}
381
+ */
401
382
  openSearchPage: (keyword: string | undefined) => void;
402
383
  }
403
384
 
404
385
  declare function useInstantsiteJsApi(): InstantsiteJSAPI | undefined;
405
386
 
387
+ declare const CatalogLayoutSlot: {
388
+ readonly PRODUCT_LIST: "CONTROLS";
389
+ readonly BOTTOM_BAR: "FOOTER";
390
+ };
391
+ declare const CategoryLayoutSlot: {
392
+ readonly CATEGORY_TITLE: "MAIN_TITLE";
393
+ readonly PRODUCT_LIST: "CONTROLS";
394
+ readonly BOTTOM_BAR: "FOOTER";
395
+ };
396
+ declare const ProductLayoutSlot: {
397
+ readonly TOP_BAR: "TOP_BAR";
398
+ readonly GALLERY: "GALLERY";
399
+ readonly SIDEBAR: "SIDEBAR";
400
+ readonly DESCRIPTION: "DESCRIPTION";
401
+ readonly REVIEW_LIST: "REVIEW_LIST";
402
+ readonly RELATED_PRODUCTS: "RELATED_PRODUCTS";
403
+ readonly BOTTOM_BAR: "FOOTER";
404
+ };
406
405
 
407
-
408
-
409
-
410
-
411
-
412
-
413
-
414
-
415
- export { EditorTypes, createVueClientApp, createVueServerApp, useBackgroundElementDesign, useButtonElementContent, useButtonElementDesign, useDeckElementContent, useImageElementContent, useImageElementDesign, useInputboxElementContent, useInstantsiteJsApi, useLayoutElementDesign, useLogoElementContent, useLogoElementDesign, useMenuElementContent, useNavigationMenuElementContent, useSelectboxElementContent, useSelectboxElementDesign, useTextElementDesign, useTextareaElementContent, useTextareaElementDesign, useToggleElementContent, useToggleElementDesign, useVueBaseProps };
406
+ 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 };
416
407
  export type { ButtonContent, Card, Deck, ImageContent, InputBoxContent, SelectBoxContent, TextAreaContent, ToggleContent };
package/dist/app.mjs CHANGED
@@ -1 +1 @@
1
- import{getCurrentInstance as K,ref as b,computed as i,reactive as d,createSSRApp as P}from"vue";import{renderToString as U}from"vue/server-renderer";const I=new Map;function c(){const e=(l,r,a,v,g,s,u)=>{I.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=I.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=K()?.appContext.app._uid??-1,o=I.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 O(e,n){const t=c(),o=i(()=>n!==void 0?n:t.content.value);return X(o,e)}function X(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 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 textarea`)}}),o=i(()=>t.value!==void 0),l=i(()=>t.value);return d({hasContent:o,value:l})}const m={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"};function W(e){if("tileId"in e)return e.tileId;if("tileIdForScroll"in e)return e.tileIdForScroll}function V(e){if("pageId"in e)return e.pageId;if("pageIdForNavigate"in e)return e.pageIdForNavigate}function H(e){if("pageUrl"in e)return e.pageUrl;switch(V(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=H(e);switch(t){case m.HYPER_LINK:if(o)return()=>window.open(o,"_blank");break;case m.GO_TO_STORE:case m.GO_TO_STORE_LINK:return()=>window.open("/products","_self");case m.MAIL_LINK:if(l)return()=>window.open(`mailto:${l}`,"_self");break;case m.TEL_LINK:if(r)return()=>window.open(`tel:${r}`,"_self");break;case m.SCROLL_TO_TILE:if(typeof document<"u")return()=>{const v=W(e);document.getElementById(`tile-${v}`)?.scrollIntoView()};break;case m.GO_TO_PAGE:if(a)return()=>window.open(a,"_self");break;default:console.error(`Unknown type of ActionLink: ${t}`)}};function Y(e){return"title"in e&&"type"in e}function j(e,n,t){const o=i(()=>{const h=e.value[n];if(h!==void 0){if(Y(h))return h;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),B=i(()=>!!a.value),M=L(o.value,t);return d({title:l,type:r,link:a,email:v,phone:g,tileDivId:s,pageId:u,pageUrl:f,hasTitle:E,hasLink:B,performAction:M})}function x(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 w(e,n){const t=new RegExp(/^https?:\/\//);return e!=null&&t.test(e)?e:`${n}/${e}`}function k(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(()=>w(t.value?.set?.["cropped-webp-100x200"]?.url,o.value)),a=i(()=>w(t.value?.set?.["cropped-webp-1000x2000"]?.url,o.value)),v=i(()=>w(t.value?.set?.["webp-200x200"]?.url,o.value)),g=i(()=>w(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 R(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 A(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 A(ne)}var G=(e=>(e.INPUTBOX="INPUTBOX",e.TEXTAREA="TEXTAREA",e.BUTTON="BUTTON",e.IMAGE="IMAGE",e.TOGGLE="TOGGLE",e.SELECTBOX="SELECTBOX",e))(G||{});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 O(t,e.settings);case"SELECTBOX":return R(t,e.settings);case"IMAGE":return k(t,e.settings);case"TOGGLE":return D(t,e.settings);case"BUTTON":return x(t,e.settings);default:return}}function ae(e){return"type"in e&&("text"in e||"image"in e)}function T(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:T(n.value?.image?.set?.["cropped-webp-100x200"]?.url,l.value),highResolutionMobileImage:T(n.value?.image?.set?.["cropped-webp-1000x2000"]?.url,l.value),lowResolutionDesktopImage:T(n.value?.image?.set?.["webp-200x200"]?.url,l.value),highResolutionDesktopImage:T(n.value?.image?.set?.["webp-2000x2000"]?.url,l.value)}));return d({type:t,text:o,image:r})}function S(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 y(e,n,t){return n?S(e,n):S(e,t)}function $(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 _(e,n,t){return n?$(e,n):$(e,t)}function z(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?z(e,n):z(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:y(f,s?.font,u?.font),size:_(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:y(E,u?.font,f?.font),size:_(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:y(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 me(){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:y(o,n?.font,t?.font),size:_(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 N(e){return{app:P(e)}}function we(e,n){return{init:()=>{const{app:t}=N(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 U(t,{context:o}),state:{context:o,data:l}})}}}}function Te(e,n){return{init:()=>{const{app:t}=N(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 ye(){return globalThis.window.instantsite}export{G as EditorTypes,Te as createVueClientApp,we as createVueServerApp,be as useBackgroundElementDesign,x as useButtonElementContent,de as useButtonElementDesign,le as useDeckElementContent,k as useImageElementContent,fe as useImageElementDesign,O as useInputboxElementContent,ye as useInstantsiteJsApi,me as useLayoutElementDesign,ue as useLogoElementContent,Ee as useLogoElementDesign,A as useMenuElementContent,oe as useNavigationMenuElementContent,R as useSelectboxElementContent,pe as useSelectboxElementDesign,ce as useTextElementDesign,C as useTextareaElementContent,ve as useTextareaElementDesign,D as useToggleElementContent,ge as useToggleElementDesign,c as useVueBaseProps};
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};
package/dist/cli.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import ls from"cac";import*as H from"path";import g,{resolve as f,parse as P,sep as le,dirname as ds}from"path";import{red as fs,yellow as us,green as x}from"kolorist";import de from"prompts";import h from"node:fs";import j from"node:path";import T from"node:process";import{fileURLToPath as L}from"node:url";import{pathToFileURL as fe}from"url";import*as u from"process";import{platform as ms}from"process";import*as K from"fs";import $,{existsSync as D,statSync as ys,rename as gs,unlink as hs,promises as Y,writeFileSync as $s,createReadStream as bs}from"fs";import Es from"adm-zip";import{glob as d,globSync as ue}from"glob";import{build as me,defineConfig as ye}from"vite";import Ts from"ajv/dist/2020.js";import Os from"ajv-formats";import js from"node:zlib";import{promisify as ws}from"node:util";import{JSONPath as Ss}from"jsonpath-plus";import{builtinModules as ge}from"module";import he from"@vitejs/plugin-vue";import Z from"vite-tsconfig-paths";import{viteExternalsPlugin as Ds}from"vite-plugin-externals";import vs from"vite-plugin-compression";import _s from"vite-plugin-checker";import{readFile as $e}from"fs/promises";import As,{AxiosError as be}from"axios";import{inc as Is}from"semver";import{ConcurrencyManager as Cs}from"axios-concurrency";import Ns from"tinycolor2";import Ps from"cli-progress";function G(e,t=2){if(!+e)return"0 Bytes";const o=1024,s=t<0?0:t,r=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],n=Math.floor(Math.log(e)/Math.log(o));return`${parseFloat((e/o**n).toFixed(s))} ${r[n]}`}const a={error:e=>console.log(fs(e)),warn:e=>console.log(us(e)),info:e=>console.log(x(e))},I="_temp",O="dist/sections",Q="dist/headers",ee="dist/footers",C="dist/templates",Ee=2*1024*1024,Te=300*1024;function J(e){return!!e}function Oe(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}const xs="Resource name can only contain alphanumeric characters, dashes, and underscores";function Ls(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:xs}}function ks(e){return e===!0?!0:typeof e=="string"&&e.trim().length===0}async function M(e,t){try{const o=f(process.cwd(),t?`${e}${I}.mjs`:`${e}.mjs`);return(await import(fe(o).href)).default}catch{throw new Error(`File [${e}${I}.mjs] is either invalid or undefined`)}}function Fs(e){return ms==="win32"?e.replace(/\//g,"\\"):e}var Rs=(e=>(e.SingleFile="single-file",e.MultiPage="multi-page",e))(Rs||{});function je(e,t){K.statSync(e).isDirectory()?(K.mkdirSync(t,{recursive:!0}),K.readdirSync(e).forEach(o=>{const s=H.resolve(e,o),r=H.resolve(t,o);je(s,r)})):K.copyFileSync(e,t)}function A(e,t,o,s){const r=H.join(e,s?.[o]??o);je(H.join(t,o),r)}function Gs(e){return e?"multi-page":"single-file"}function Ms(e,t){return e==="single-file"?{"template.ts":`${t}.ts`}:{"example-template":`${t}`}}function Bs(e,t){return e==="single-file"?`${t}.ts`:t}function qs(e){return e==="single-file"?"template/templates":"template/page-templates"}function Us(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 zs(e,t){const o=Gs(t),s=Ms(o,e),r=Bs(o,e),n=qs(o),i=Us(o,e);return{renameFiles:s,targetPath:r,sourcePath:n,onTemplateCreated:i}}function we(e,t){const o=e.split(t);let s="";for(;o.length;){const r=o.join(t),n=h.lstatSync(r||t);if(n.isSymbolicLink()){const i=h.readlinkSync(r),c=j.resolve(j.dirname(r),i);return we(c,t)}if(n.isDirectory()){const i=`${r}${t}package.json`;if(h.existsSync(i)){s=i;break}}o.pop()}return s}function Xs(){const e=Fs("/"),t=we(T.argv[1],e);return t!==""?JSON.parse(h.readFileSync(t,"utf8")):{}}async function Vs(e){try{const t=e,o=T.cwd(),s=j.join(o,t),r=["templates","headers","footers","reference","page-templates"],n={_gitignore:".gitignore"};h.existsSync(s)?(a.error(`App with the name: ${e} already exists. If you'd like to override it, delete previous version first`),T.exit(1)):h.mkdirSync(s);const i=j.resolve(L(import.meta.url),"../..","template");h.readdirSync(i).filter(E=>E!=="package.json").filter(E=>!r.includes(E)).forEach(async E=>A(s,i,E,n));const c=JSON.parse(h.readFileSync(j.join(i,"package.json"),"utf-8"));c.name=e;const p=Xs();p.version&&(c.dependencies["@lightspeed/crane"]=p.version),p.dependencies["@lightspeed/eslint-config-crane"]&&(c.dependencies["@lightspeed/eslint-config-crane"]=p.dependencies["@lightspeed/eslint-config-crane"]);const l=j.join(s,"package.json");h.writeFileSync(l,`${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 te(e,t,o,s){try{const r=T.cwd(),n=g.join(r,t);$.existsSync(n)||$.mkdirSync(n);const i=g.join(r,t,o);$.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)):$.mkdirSync(i);const c=g.resolve(L(import.meta.url),"../..",e);$.readdirSync(c).forEach(async p=>A(i,c,p)),a.info(`${s} ${o} created`)}catch(r){a.error(`Error while creating ${s}: ${r.message}`),T.exit(1)}}function Se(e){const t=T.cwd(),o=g.resolve(L(import.meta.url),"../..",`template/${e}`),s=g.join(t,e);$.existsSync(s)||($.mkdirSync(s),$.readdirSync(o).forEach(async r=>A(s,o,r)))}function Hs(e,t,o){if(!$.existsSync(o)){$.copyFileSync(t,o);return}const s=$.readFileSync(t),r=$.readFileSync(o);s.equals(r)||a.warn(`File "${e.name}" exists but differs from template. File will be skipped, this may lead to issues.`)}function De(e,t){const o=$.readdirSync(e,{withFileTypes:!0});$.existsSync(t)||$.mkdirSync(t,{recursive:!0}),o.forEach(s=>{const r=g.join(e,s.name),n=g.join(t,s.name);s.isDirectory()?De(r,n):Hs(s,r,n)})}function oe(){try{const e=T.cwd(),t=g.join(e,"shared"),o=g.resolve(L(import.meta.url),"../..","template/shared");if(!$.existsSync(o))return;De(o,t)}catch(e){a.error(`Error while processing shared folder: ${e.message}`),T.exit(1)}}async function Ks(e){oe(),te("template/sections/example-section","sections",e,"Section")}async function Js(e,t){const{targetPath:o,renameFiles:s,sourcePath:r,onTemplateCreated:n}=zs(e,t);try{const i=T.cwd(),c=j.join(i,"templates"),p=j.resolve(L(import.meta.url),"../..",r),l=h.readdirSync(p);h.existsSync(c)?h.existsSync(j.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)):h.mkdirSync(c),l.forEach(E=>A(c,p,E,s)),Se("headers"),Se("footers"),n()}catch(i){a.error(`Error while creating template descriptors: ${i.message}`),T.exit(1)}}async function Ws(){try{const e=T.cwd(),t=j.resolve(L(import.meta.url),"../../","template/reference"),o=h.readdirSync(t);let s=!1;for(const r of o){const n=j.join(t,r),i=j.join(e,r);h.existsSync(i)||h.mkdirSync(i,{recursive:!0});const c=h.readdirSync(n),p=h.readdirSync(i);if(r==="shared"){c.forEach(l=>{A(i,n,l)});continue}for(const l of c){if(l==="assets"){A(i,n,l);continue}if(p.includes(l)){const{name:E}=await de({type:"text",name:"name",message:`The "${l}" already exists in ${r} directory: provide a new name to keep both or press Esc to skip this one.`});E?(A(i,n,l,{[l]:E}),s=!0):a.info(`Skipped: ${l}`)}else A(i,n,l)}}a.info("Reference templates have been added to the app"),s&&a.warn("Some files or folders were renamed to avoid conflicts. Temlate files may need to be updated to reflect these changes.")}catch(e){a.error(`Error while creating template descriptors: ${e.message}`),T.exit(1)}}const ve="https://json-schema.org/draft/2020-12/schema",_e="https://lightspeedhq.com/template-default.schema.json",Ae="Default Section",Ie="Default section for a Custom Template",Ce="object",Ne={"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}},Ys={$schema:ve,$id:_e,title:Ae,description:Ie,type:Ce,$defs:Ne},Pe={__proto__:null,$defs:Ne,$id:_e,$schema:ve,default:Ys,description:Ie,title:Ae,type:Ce},xe="https://json-schema.org/draft/2020-12/schema",Le="https://lightspeedhq.com/template-custom.schema.json",ke="Custom Section",Fe="Custom section for a Custom Template",Re="object",Ge={"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}},Zs={$schema:xe,$id:Le,title:ke,description:Fe,type:Re,$defs:Ge},Me={__proto__:null,$defs:Ge,$id:Le,$schema:xe,default:Zs,description:Fe,title:ke,type:Re},Be="https://json-schema.org/draft/2020-12/schema",qe="https://lightspeedhq.com/template-custom-content.schema.json",Ue="Custom Section :: Content Configuration",ze="Content tab configuration of a Custom Section for a Custom Template",Xe="object",Ve={input_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"INPUTBOX"},text:{type:"string"}},required:["type","text"],additionalProperties:!1},text_area:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"TEXTAREA"},text:{type:"string"}},required:["type","text"],additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"BUTTON"},title:{type:"string"},buttonType:{type:"string",enum:["SCROLL_TO_TILE","HYPER_LINK","MAIL_LINK","TEL_LINK","GO_TO_STORE_LINK","GO_TO_PAGE"]},link:{type:"string",format:"uri"},linkTarget:{type:"string"},email:{type:"string"},phone:{type:"string"},tileId:{type:"string"}},required:["type","title","buttonType"],additionalProperties:!0},image:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"IMAGE"},imageData:{type:"object",properties:{set:{type:"object",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",type:"string"},imageData:{type:"object",properties:{set:{type:"object"},borderInfo:{type:"object"},bucket:{type:"string"}},required:["set"]}},required:["type"],additionalProperties:!1},menu:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"MENU"}},required:["type"],additionalProperties:!1},deck:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"DECK"},cards:{type:"array",items:{type:"object",properties:{settings:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the settings configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]}},required:["type"],allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/input_box"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"template-custom-content.schema.json#/$defs/text_area"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-content.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/select_box"}}]}},minProperties:1}},required:["settings"]}}},required:["type","cards"]}},Qs={$schema:Be,$id:qe,title:Ue,description:ze,type:Xe,$defs:Ve},He={__proto__:null,$defs:Ve,$id:qe,$schema:Be,default:Qs,description:ze,title:Ue,type:Xe},Ke="https://json-schema.org/draft/2020-12/schema",Je="https://lightspeedhq.com/template-custom-design.schema.json",We="Custom Section :: Design Configuration",Ye="Design tab configuration of a Custom Section for a Custom Template",Ze="object",Qe={text:{type:"object",properties:{type:{description:"Type of the text",type:"string",const:"TEXT"},font:{description:"Default font for the text",type:"string"},size:{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}},er={$schema:Ke,$id:Je,title:We,description:Ye,type:Ze,$defs:Qe},et={__proto__:null,$defs:Qe,$id:Je,$schema:Ke,default:er,description:Ye,title:We,type:Ze},tt="https://json-schema.org/draft/2020-12/schema",ot="https://lightspeedhq.com/section-content.schema.json",st="Custom Section - Content",rt="The content of a custom section",nt="object",it={"^.*$":{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"}}]}},at={Inputbox:{type:"object",properties:{type:{const:"INPUTBOX"},label:{type:"string"},placeholder:{type:"string"},defaults:{$ref:"#/$defs/InputboxDefaults"}},required:["type","label","placeholder"]},Textarea:{type:"object",properties:{type:{const:"TEXTAREA"},label:{type:"string"},placeholder:{type:"string"},defaults:{$ref:"#/$defs/TextareaDefaults"}},required:["type","label","placeholder"]},Button:{type:"object",properties:{type:{const:"BUTTON"},label:{type:"string"},defaults:{$ref:"#/$defs/ButtonDefaults"}},required:["type","label"]},Image:{type:"object",properties:{type:{const:"IMAGE"},label:{type:"string"},defaults:{$ref:"section-commons.schema.json#/$defs/Image"}},required:["type","label"]},Toggle:{type:"object",properties:{type:{const:"TOGGLE"},label:{type:"string"},description:{type:"string"},defaults:{$ref:"#/$defs/ToggleDefaults"}},required:["type","label","description"]},Selectbox:{type:"object",properties:{type:{const:"SELECTBOX"},label:{type:"string"},placeholder:{type:"string"},description:{type:"string"},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SelectboxDefaults"}},required:["type","label","placeholder","description","options"]},Menu:{type:"object",properties:{type:{const:"MENU"},label:{type:"string"}},required:["type"]},NavigationMenu:{type:"object",properties:{type:{const:"NAVIGATION_MENU"}},required:["type"]},Logo:{type:"object",properties:{type:{const:"LOGO"},label:{type:"string"}},required:["type"]},Info:{type:"object",properties:{type:{const:"INFO"},label:{type:"string"},description:{type:"string"},button:{$ref:"#/$defs/InfoEditorButton"},defaults:{$ref:"#/$defs/InfoDefaults"}},required:["type","label","description"]},Divider:{type:"object",properties:{type:{const:"DIVIDER"},label:{type:"string"}},required:["type","label"]},InputboxDefaults:{type:"object",properties:{text:{type:"string"}},required:["text"]},TextareaDefaults:{type:"object",properties:{text:{type:"string"}},required:["text"]},ButtonDefaults:{type:"object",properties:{title:{type:"string"},buttonType:{type:"string",enum:["SCROLL_TO_TILE","HYPER_LINK","MAIL_LINK","TEL_LINK","GO_TO_STORE_LINK","GO_TO_PAGE"]},link:{type:"string",format:"uri"},linkTarget:{type:"string"},email:{type:"string"},phone:{type:"string"},tileId:{type:"string"}},required:["title"]},ImageDefaults:{type:"object",properties:{imageData:{$ref:"section-commons.schema.json#/$defs/Image"}}},ToggleDefaults:{type:"object",properties:{enabled:{type:"boolean"}}},SelectboxDefaults:{type:"object",properties:{value:{type:"string"}}},InfoDefaults:{type:"object",properties:{text:{type:"object",additionalProperties:{type:"string"}},button:{$ref:"#/$defs/InfoButtonDefaults"}}},SelectboxOption:{type:"object",properties:{label:{type:"string"},value:{type:"string"}}},InfoEditorButton:{type:"object",properties:{label:{type:"string"},link:{type:"string"}}},InfoButtonDefaults:{type:"object",properties:{title:{type:"string"},link:{type:"string",minLength:0}}},Deck:{type:"object",properties:{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:{type:"string",minLength:0},addButtonLabel:{type:"string",minLength:0},maxCards:{type:"number"}},required:["cards","maxCards","label","addButtonLabel","type"]}},ct=!1,tr={$schema:tt,$id:ot,title:st,description:rt,type:nt,patternProperties:it,$defs:at,additionalProperties:ct},pt={__proto__:null,$defs:at,$id:ot,$schema:tt,additionalProperties:ct,default:tr,description:rt,patternProperties:it,title:st,type:nt},lt="https://json-schema.org/draft/2020-12/schema",dt="https://lightspeedhq.com/sections/section-translation.schema.json",ft="Custom Section - Translations",ut="The translation of the section's labels",mt="object",yt={"^[a-z]{2}$":{type:"object",patternProperties:{"^\\$.*$":{type:"string"}},additionalProperties:!1}},gt=!1,or={$schema:lt,$id:dt,title:ft,description:ut,type:mt,patternProperties:yt,additionalProperties:gt},ht={__proto__:null,$id:dt,$schema:lt,additionalProperties:gt,default:or,description:ut,patternProperties:yt,title:ft,type:mt},$t="https://json-schema.org/draft/2020-12/schema",bt="https://lightspeedhq.com/section-design.schema.json",Et="Custom Section - Design",Tt="The design of a custom section",Ot="object",jt={"^.*$":{type:"object",properties:{type:{type:"string",enum:["TEXT","IMAGE","BUTTON","BACKGROUND","TOGGLE","COLOR_PICKER","RATING","SELECTBOX","SOCIAL_PROFILES","LOGO","INFO","DIVIDER"]}},required:["type"],allOf:[{if:{properties:{type:{const:"TEXT"}}},then:{$ref:"#/$defs/Text"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"#/$defs/Image"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"#/$defs/Button"}},{if:{properties:{type:{const:"BACKGROUND"}}},then:{$ref:"#/$defs/Background"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"#/$defs/Toggle"}},{if:{properties:{type:{const:"COLOR"}}},then:{$ref:"#/$defs/Color"}},{if:{properties:{type:{const:"RATING"}}},then:{$ref:"#/$defs/Rating"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"#/$defs/Selectbox"}},{if:{properties:{type:{const:"SOCIAL_PROFILES"}}},then:{$ref:"#/$defs/SocialProfile"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"#/$defs/Logo"}},{if:{properties:{type:{const:"INFO"}}},then:{$ref:"#/$defs/Info"}},{if:{properties:{type:{const:"DIVIDER"}}},then:{$ref:"#/$defs/Divider"}}],additionalProperties:!0}},wt={Text:{type:"object",properties:{type:{const:"TEXT"},label:{type:"string"},sizes:{type:"array",items:{type:"integer"}},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},hideSize:{type:["boolean","null"]},defaults:{$ref:"#/$defs/TextDesignDefaults"}},required:["type","label"]},Image:{type:"object",properties:{type:{const:"IMAGE"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},defaults:{$ref:"#/$defs/ImageDesignDefaults"}},required:["type","label"]},Button:{type:"object",properties:{type:{const:"BUTTON"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAutoColor:{type:["boolean","null"]},enableAlphaColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},hideSize:{type:["boolean","null"]},defaults:{$ref:"#/$defs/ButtonDesignDefaults"}},required:["type","label"]},Background:{type:"object",properties:{type:{const:"BACKGROUND"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},defaults:{$ref:"#/$defs/BackgroundDesignDefaults"}},required:["type","label"]},Toggle:{type:"object",properties:{type:{const:"TOGGLE"},label:{type:"string"},description:{type:"string"},defaults:{$ref:"#/$defs/ToggleDesignDefaults"}},required:["type","label"]},Color:{type:"object",properties:{type:{const:"COLOR_PICKER"},label:{type:"string"},description:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},defaults:{$ref:"#/$defs/ColorPickerDefaults"}},required:["type","label"]},Rating:{type:"object",properties:{type:{const:"RATING"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/RatingDefaults"}},required:["type","label"]},Selectbox:{type:"object",properties:{type:{const:"SELECTBOX"},label:{type:"string"},description:{type:"string"},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SelectboxDefaults"}},required:["type","label"]},SocialProfile:{type:"object",properties:{type:{const:"SOCIAL_PROFILES"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SocialProfilesDefaults"}},required:["type","label"]},Logo:{type:"object",properties:{type:{const:"LOGO"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},sizes:{type:"array",items:{type:"integer"}},defaults:{$ref:"#/$defs/LogoDesignDefaults"}},required:["type"]},Info:{type:"object",properties:{type:{const:"INFO"},text:{type:"string"},button:{type:"object",properties:{title:{type:"string"},link:{type:"string"}},additionalProperties:!0}},required:["type","text"],additionalProperties:!0},Divider:{type:"object",properties:{type:{const:"DIVIDER"},label:{type:"string"}},required:["type","label"]},TextDesignDefaults:{type:"object",properties:{font:{type:"string"},size:{oneOf:[{description:"Default size for the text",type:"integer",minimum:1,exclusiveMaximum:50},{description:"Default global size string for the text",type:"string",enum:["global.textSize.title","global.textSize.subtitle","global.textSize.body"]}]},bold:{type:"boolean"},italic:{type:"boolean"},color:{oneOf:[{description:"Default color for the text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the text",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},visible:{type:"boolean"}},required:[]},ImageDesignDefaults:{type:"object",properties:{overlay:{type:"string"},visible:{type:"boolean"}},if:{properties:{overlay:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default colors for the image overlay",type:"array",items:{oneOf:[{description:"Default color for the image overlay",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the image overlay",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},minItems:2,maxItems:2}}},else:{properties:{color:{oneOf:[{description:"Default color for the image overlay",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the image overlay",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]}}},required:[]},ButtonDesignDefaults:{type:"object",properties:{appearance:{type:"string",enum:["SOLID","OUTLINE","TEXT"]},font:{type:"string"},size:{type:"string",enum:["SMALL","MEDIUM","LARGE"]},style:{type:"string",enum:["round-corner","rectangle","pill"]},color:{oneOf:[{description:"Default color for the button",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the button",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},visible:{type:"boolean"}},required:[]},BackgroundDesignDefaults:{type:"object",properties:{type:{description:"Type of the background",type:"string",const:"BACKGROUND"},style:{description:"Style of the background",type:"string",enum:["COLOR","GRADIENT"]}},if:{properties:{style:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default colors for the background",type:"array",items:{oneOf:[{description:"Default color for the background",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the background",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},minItems:2,maxItems:2}}},else:{properties:{color:{oneOf:[{description:"Default color for the background",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the background",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]}}}},ToggleDesignDefaults:{type:"object",properties:{enabled:{type:"boolean"}},required:[]},ColorPickerDefaults:{type:"object",properties:{appearance:{$ref:"section-commons.schema.json#/$defs/Color"}},required:[]},RatingDefaults:{type:"object",properties:{color:{$ref:"section-commons.schema.json#/$defs/Color"},visible:{type:"boolean"},style:{type:"string"}},required:[]},SelectboxDefaults:{type:"object",properties:{value:{type:"string"}},required:[]},SocialProfilesDefaults:{type:"object",properties:{color:{$ref:"section-commons.schema.json#/$defs/Color"},visible:{type:"boolean"},appearance:{type:"string"}},required:[]},LogoDesignDefaults:{type:"object",properties:{font:{type:"string"},size:{oneOf:[{description:"Default size for the logo text",type:"integer",minimum:1,exclusiveMaximum:50},{description:"Default global size string for the logo text",type:"string",enum:["global.textSize.title","global.textSize.subtitle","global.textSize.body"]}]},bold:{type:"boolean"},italic:{type:"boolean"},color:{oneOf:[{description:"Default color for the logo text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the logo text",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},visible:{type:"boolean"}},required:[]},SelectboxOption:{type:"object",properties:{value:{type:"string"},label:{type:"string"}},required:[]}},sr={$schema:$t,$id:bt,title:Et,description:Tt,type:Ot,patternProperties:jt,$defs:wt},St={__proto__:null,$defs:wt,$id:bt,$schema:$t,default:sr,description:Tt,patternProperties:jt,title:Et,type:Ot},Dt="https://json-schema.org/draft/2020-12/schema",vt="https://lightspeedhq.com/section-commons.schema.json",_t="Custom Section - Content",At="The content of a custom section",It="object",Ct={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"}}}},Nt=!1,rr={$schema:Dt,$id:vt,title:_t,description:At,type:It,$defs:Ct,additionalProperties:Nt},Pt={__proto__:null,$defs:Ct,$id:vt,$schema:Dt,additionalProperties:Nt,default:rr,description:At,title:_t,type:It},xt="https://json-schema.org/draft/2020-12/schema",Lt="https://lightspeedhq.com/section-showcase.schema.json",kt="Custom Section - Showcase settings",Ft="The setting of a showcase",Rt="object",Gt=["showcaseId","previewImage"],Mt=[{properties:{showcaseId:{description:"Showcase id of the section",type:"string"},previewImage:{$ref:"section-commons.schema.json#/$defs/Image"}}},{$ref:"../showcase_overrides.schema.json"}],nr={$schema:xt,$id:Lt,title:kt,description:Ft,type:Rt,required:Gt,allOf:Mt},Bt={__proto__:null,$id:Lt,$schema:xt,allOf:Mt,default:nr,description:Ft,required:Gt,title:kt,type:Rt},qt="https://json-schema.org/draft/2020-12/schema",Ut="https://lightspeedhq.com/template.schema.json",zt="Custom Template",Xt="A custom template enclosing the necessary custom and default blocks",Vt="object",Ht={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}},Kt=["metadata","sections"],ir={$schema:qt,$id:Ut,title:zt,description:Xt,type:Vt,properties:Ht,required:Kt},Jt={__proto__:null,$id:Ut,$schema:qt,default:ir,description:Xt,properties:Ht,required:Kt,title:zt,type:Vt},Wt="https://json-schema.org/draft/2020-12/schema",Yt="https://lightspeedhq.com/showcase_overrides.schema.json",Zt="Showcase overrides",Qt="Overrides for the showcase",eo="object",to={content:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","LOGO","DECK","MENU","NAVIGATION_MENU","INFO"]}},allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/input_box"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"template-custom-content.schema.json#/$defs/text_area"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-content.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/select_box"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"template-custom-content.schema.json#/$defs/logo"}},{if:{properties:{type:{const:"DECK"}}},then:{$ref:"template-custom-content.schema.json#/$defs/deck"}}]}}},design:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the design configuration element",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND","LOGO"]}},allOf:[{if:{properties:{type:{const:"TEXT"}}},then:{$ref:"template-custom-design.schema.json#/$defs/text"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-design.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-design.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-design.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-design.schema.json#/$defs/select_box"}},{if:{properties:{type:{const:"BACKGROUND"}}},then:{$ref:"template-custom-design.schema.json#/$defs/background"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"template-custom-design.schema.json#/$defs/logo"}},{if:{properties:{type:{const:"INFO"}}},then:{$ref:"template-custom-design.schema.json#/$defs/info"}}]}}},layoutId:{description:"Layout ID for the showcase",type:"string"},blockName:{description:"Section name for the showcase",type:"string"}},ar={$schema:Wt,$id:Yt,title:Zt,description:Qt,type:eo,properties:to},oo={__proto__:null,$id:Yt,$schema:Wt,default:ar,description:Qt,properties:to,title:Zt,type:eo};var se=(e=>(e.SECTION="SECTION",e.HEADER="HEADER",e.FOOTER="FOOTER",e))(se||{});const m={SECTION:{source:"sections",dist:"dist/sections"},HEADER:{source:"headers",dist:"dist/headers"},FOOTER:{source:"footers",dist:"dist/footers"}};function B(e){return D(`${Q}/${e}`)?"HEADER":D(`${ee}/${e}`)?"FOOTER":"SECTION"}function so(e){const t=B(e);return m[t].dist}var q=(e=>(e.CONTENT="Content",e.DESIGN="Design",e))(q||{});const cr={menu:{type:"NAVIGATION_MENU"},logo:{type:"LOGO"}},pr={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 ro(e){switch(e){case se.HEADER:return cr;default:return{}}}function no(e){switch(e){case se.HEADER:return pr;default:return{}}}function lr({validationType:e,sectionType:t}){switch(e){case q.CONTENT:return ro(t);case q.DESIGN:return no(t);default:return{}}}function dr(e){return Object.keys(e).length===0}function fr({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).filter(([s])=>t[s]!==void 0).forEach(([s,r])=>{const n=t[s];r.type!==n.type&&o.push({instancePath:s,keyword:"type-mismatch",message:`Editor type "${r.type}" for reserved key "${s}" does not match the required type "${n.type}".`})}),o}function ur({type:e,mandatorySettings:t}){return Object.keys(t).find(o=>t[o].type===e)}function mr({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).forEach(([s,r])=>{const n=ur({type:r.type,mandatorySettings:t});n&&s!==n&&o.push({instancePath:s,keyword:"key-mismatch",message:`Editor key "${s}" for overriden content type "${r.type}" does not match the required key name "${n}".`})}),o}function yr({type:e,mandatorySettings:t}){return Object.keys(t).findLast(o=>t[o].type===e)}function gr({sectionSettings:e,mandatorySettings:t}){const o=[],s=Object.values(t).map(({type:n})=>n),r=Object.values(e).map(({type:n})=>n);return new Set(r.filter(n=>s.includes(n))).forEach(n=>{if(r.filter(i=>i===n).length>1){const i=yr({type:n,mandatorySettings:t});o.push({instancePath:i,keyword:"duplicate-type",message:`Editor type "${n}" can only be used once.`})}}),o}function hr(e,t){const{sectionSettings:o,sectionType:s}=t,r=lr({validationType:e,sectionType:s});return r===void 0||dr(r)?[]:[...fr({sectionSettings:o,mandatorySettings:r}),...mr({sectionSettings:o,mandatorySettings:r}),...gr({sectionSettings:o,mandatorySettings:r})]}var y=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.ClientChunks=2]="ClientChunks",e[e.ClientAsset=3]="ClientAsset",e[e.Asset=4]="Asset",e[e.TemplateAsset=5]="TemplateAsset",e[e.Dependency=6]="Dependency",e[e.SourceCode=7]="SourceCode",e))(y||{});const W={[y.Server]:{type:"server_js_compressed",fileName:"server.js.gz",isSingleton:!0,toPath:(e,t)=>`${m[t].dist}/${e}/js/main/server/`},[y.Client]:{type:"client_js",fileName:"client.js",isSingleton:!1,toPath:(e,t)=>`${m[t].dist}/${e}/js/main/client/`},[y.ClientChunks]:{type:"client_js_chunks",isSingleton:!1,toPath:(e,t)=>`${m[t].dist}/${e}/js/main/client/chunks/`,fileName:"*"},[y.ClientAsset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:(e,t)=>`${m[t].dist}/${e}/js/main/client/assets/`},[y.Asset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:(e,t)=>`${m[t].dist}/${e}/assets/`},[y.TemplateAsset]:{type:"template_assets",fileName:"*",isSingleton:!1,toPath:()=>`${C}/assets/`},[y.Dependency]:{type:"dependencies",fileName:"package.json",isSingleton:!0,toPath:()=>{}},[y.SourceCode]:{type:"source_code",fileName:"source-code.zip",isSingleton:!0,toPath:()=>{}}},U=[Pt,St,pt,Bt,Jt,Pe,Me,He,et,oo];function k(e,t){const o=new Ts({allErrors:!0,schemas:e});return Os(o),o.getSchema(t.$id)||o.compile(t)}function $r(){return k(U,Jt)}function re(e){return e.map(t=>({instancePath:t.instancePath,message:t.message??"",keyword:t.keyword}))}const br=e=>(()=>{const t=so(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:k(U,pt),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:k(U,St),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:k(U,ht),type:e.type},...e.showcaseEntryPoints.map(s=>({source:`./${o}/${e.name}/showcases/${P(s).name}.ts`,dist:g.resolve(`${t}/${e.name}/js/showcases/${P(s).name}`),ajv:k(U,s.indexOf("translations")===-1?Bt:ht),type:e.type,sectionName:e.name}))]})();function Er(e){const t=r=>{const n=(r??"").split("/").filter(i=>i.length>0);return n.length===0?"$":`$${n.map(i=>`.${i}`).join("")}`};let o=0,s=0;Object.keys(e).forEach(r=>{const n=e[r];o=Math.max(o,Math.max(...n.map(i=>t(i.instancePath).length))),s=Math.max(s,Math.max(...n.map(i=>i.message.length)))}),Object.keys(e).forEach(r=>{const n=e[r].filter((i,c,p)=>c===p.findIndex(l=>`${i.instancePath}${i.message}${i.keyword}`==`${l.instancePath}${l.message}${l.keyword}`));a.error(r),n.filter(i=>i.keyword!=="if").forEach(i=>{a.error(`${t(i.instancePath).padEnd(o," ")} | ${i.message.padEnd(s," ")} | ${i.keyword||"-"}`)})})}function Tr(e,t){if(e.validationType===void 0||e.sectionName===void 0)return[];const{sectionName:o,validationType:s}=e,r=B(o);return[...hr(s,{sectionSettings:t,sectionType:r})]}function io(e,t){return Ss({path:"$..set..url",json:t,resultType:"value"}).map(o=>{if(new RegExp(/^https?:\/\//).test(o))return null;const s=`${e}/assets/${o}`;return D(s)?null:{message:`Image ${o} is missing from assets folder`,keyword:"missing-asset"}}).filter(o=>o!==null)}async function Or(e){const t=await M(e.dist,!1),o={},s=[],r=so(e.sectionName??"").split("/").pop()?.toLowerCase();return e.ajv(t)||s.push(...re(e.ajv.errors??[])),s.push(...Tr(e,t),...io(`${r}/${e.sectionName}`,t)),s.length>0&&(o[e.source]=s),o}async function jr(e){const t=ws(js.gunzip),o=await $.promises.readFile(e);return(await t(o)).length}async function wr(e,t){const o=W[y.Server],s=g.resolve(`${o.toPath(e,t)}${o.fileName}`),r=await jr(s);if(r>Te)throw a.error(`Size of individual server file must not exceed threshold [${G(Te)}]!`),a.error(`${`File: ${s}`.padEnd(s.length+10)}| ${G(r)}`),new Error("Invalid server file size")}function Sr(e){const t=e.reduce((o,s)=>{const r=ys(s);return r.size>Ee&&(o[s]=G(r.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 [${G(Ee)}]!`);for(const s in t)a.error(`${`File: ${s}`.padEnd(o+10)}| ${t[s]}`);throw new Error("Invalid asset file size")}}function Dr(e,t,o,s){const r={};return e(t)&&s===void 0?gs(`${o}${I}.mjs`,`${o}.mjs`,()=>{}):(hs(`${o}${I}.mjs`,()=>{}),r[g.resolve(`./templates/${P(o).name}.ts`)]=[...re(e.errors??[]),...s??[]]),r}async function vr(e){const t=[];for(const o of e.sections){const s=e.sections.indexOf(o);if(s===0){const r=o.id==="header"&&o.type==="default",n=D(`${Q}/${o.id}`);!r&&!n&&t.push({instancePath:`/sections/${s}/id`,message:"The first section must be a `header`",keyword:"required"})}else if(s===e.sections.length-1){const r=o.id==="footer"&&o.type==="default",n=D(`${ee}/${o.id}`);!r&&!n&&t.push({instancePath:`/sections/${s}/id`,message:"The last section must be a `footer`",keyword:"required"})}else if(o.type==="custom")if(!D(`${O}/${o.id}`))t.push({instancePath:`/sections/${s}/id`,message:"Custom section must have a corresponding block defined",keyword:"required"});else{if(o.content!==void 0)if(!D(`${O}/${o.id}/js/settings/content.mjs`))t.push({instancePath:`/sections/${s}/content`,message:"Content descriptor is overridden, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const r=await M(`${O}/${o.id}/js/settings/content`,!1),n=new Set(Object.keys(r));Object.keys(o.content).every(i=>n.has(i))||t.push({instancePath:`/sections/${s}/content`,message:"Content descriptor must be a subset of the default content descriptor",keyword:"type"})}if(o.design!==void 0)if(!D(`${O}/${o.id}/js/settings/design.mjs`))t.push({instancePath:`/sections/${s}/design`,message:"Design descriptor is overridden, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const r=await M(`${O}/${o.id}/js/settings/design`,!1),n=new Set(Object.keys(r));Object.keys(o.design).every(i=>n.has(i))||t.push({instancePath:`/sections/${s}/design`,message:"Design descriptor must be a subset of the default design descriptor",keyword:"type"})}o.showcase_id!==void 0&&(D(`${O}/${o.id}/js/showcases/${o.showcase_id}.mjs`)||t.push({instancePath:`/sections/${s}/showcase-id`,message:"Custom section must have a corresponding showcase defined in case showcase_id is specified",keyword:"required"})),o.showcase_overrides&&t.push(...io(`sections/${o.id}`,o.showcase_overrides))}}return t.length===0?void 0:t}var b=(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))(b||{}),w=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.Misc=2]="Misc",e))(w||{});const ao="https://json-schema.org/draft/2020-12/schema",co="https://lightspeedhq.com/page.schema.json",po="Custom Page",lo="A custom page enclosing the necessary custom and default blocks",fo="object",uo={sections:{description:"List of sections contained by this page",type:"array",minItems: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"}}]},contains:{type:"object",properties:{id:{const:"product-browser"},type:{const:"default"}},required:["id"]},minContains:1,maxContains:1}},mo=!1,yo=["sections"],_r={$schema:ao,$id:co,title:po,description:lo,type:fo,properties:uo,additionalProperties:mo,required:yo},ne={__proto__:null,$id:co,$schema:ao,additionalProperties:mo,default:_r,description:lo,properties:uo,required:yo,title:po,type:fo},go="https://json-schema.org/draft/2020-12/schema",ho="https://lightspeedhq.com/page.schema.json",$o="Homepage",bo="Homepage enclosing the necessary custom and default blocks",Eo="object",To={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}},Oo=!1,jo=["sections"],Ar={$schema:go,$id:ho,title:$o,description:bo,type:Eo,properties:To,additionalProperties:Oo,required:jo},Ir={__proto__:null,$id:ho,$schema:go,additionalProperties:Oo,default:Ar,description:bo,properties:To,required:jo,title:$o,type:Eo},wo="https://json-schema.org/draft/2020-12/schema",So="https://lightspeedhq.com/header_footer.schema.json",Do="Header/Footer definition for a page template",vo="object",_o=["type","id"],Ao={type:{type:"string",enum:["custom","default"]},id:{type:"string"}},Io=!1,Co=[{if:{properties:{type:{const:"default"}}},then:{properties:{id:{enum:["header","footer"]}}}}],Cr={$schema:wo,$id:So,title:Do,type:vo,required:_o,properties:Ao,additionalProperties:Io,allOf:Co},Nr={__proto__:null,$id:So,$schema:wo,additionalProperties:Io,allOf:Co,default:Cr,properties:Ao,required:_o,title:Do,type:vo},No="https://json-schema.org/draft/2020-12/schema",Po="https://lightspeedhq.com/metadata.schema.json",xo="Custom Multi Page Template metadata",Lo="Metadata of a multi page template",ko="object",Fo={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"}},Ro=["metadata","header","footer"],Go=!1,Pr={$schema:No,$id:Po,title:xo,description:Lo,type:ko,properties:Fo,required:Ro,additionalProperties:Go},xr={__proto__:null,$id:Po,$schema:No,additionalProperties:Go,default:Pr,description:Lo,properties:Fo,required:Ro,title:xo,type:ko},Mo="https://json-schema.org/draft/2020-12/schema",Bo="https://lightspeedhq.com/product-browser.schema.json",qo="Product Browser Section",Uo="Product browser section for a custom page",zo="object",Xo=[{type:"object",properties:{type:{description:"Type of the section",type:"string",const:"default"},id:{description:"Identification of the section",type:"string",pattern:"^((cover|announcement_bar|slider|special_offer|customer_review|company_info|shipping_payment|location|store|product-browser)(_\\d{3})?)$"},showcase_id:{description:"Showcase id of the section",type:"string"}},required:["type","id"],additionalProperties:!1}],Lr={$schema:Mo,$id:Bo,title:qo,description:Uo,type:zo,allOf:Xo},kr={__proto__:null,$id:Bo,$schema:Mo,allOf:Xo,default:Lr,description:Uo,title:qo,type:zo},Fr=[Pt,Pe,Me,oo,et,He,kr,Nr],Rr=e=>{const t=[],o={},s=(r,n,i)=>{if(!r){o[e.name]||(o[e.name]=[]),o[e.name].push({instancePath:`/templates/${e.name}/${n}`,message:`Missing file: ${n}`,keyword:"required"});return}t.push({templateName:e.name,source:r,dist:g.resolve(`dist/templates/${e.name}/${n}`),ajv:k(Fr,i)})};return s(e.catalogEntrypoint,"catalog",ne),s(e.productEntrypoint,"product",ne),s(e.homeEntrypoint,"home",Ir),s(e.categoryEntrypoint,"category",ne),s(e.configurationEntrypoint,"configuration",xr),[t,o]};async function Gr(e){const t=await M(e.dist,!0),o={},s=[];return e.ajv(t)||s.push(...re(e.ajv.errors??[])),s.length>0&&(o[e.source]=s),o}const Mr=async e=>{const[t,o]=Rr(e);return(await Promise.all(t.map(s=>Gr(s)))).reduce((s,r)=>(Object.entries(r).forEach(([n,i])=>{s[n]=s[n]?[...s[n],...i]:[...i]}),s),{...o})};async function Br(){const e=await d("./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(le),s=o.pop()??"default";if(o.pop()===void 0)throw new Error("Cannot determine template with custom pages, outer directory is undefined");const r=await d(`**/${s}/configuration.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),n=await d(`**/${s}/pages/home.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),i=await d(`**/${s}/pages/category.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),c=await d(`**/${s}/pages/catalog.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),p=await d(`**/${s}/pages/product.{js,ts}`,{ignore:["node_modules/**","dist/**"]});return{name:s,configurationEntrypoint:r.at(0),homeEntrypoint:n.at(0),categoryEntrypoint:i.at(0),catalogEntrypoint:c.at(0),productEntrypoint:p.at(0)}}))}async function qr(){const e=await d("./templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]}),t=await d("./templates/assets/*",{ignore:["node_modules/**","dist/**"]});return{pageTemplates:await Br(),templates:e,assets:t}}async function Ur(e){if(e.templates.length===0&&e.pageTemplates?.length===0)return{};const t=await $r();return await N(void 0,e.assets,b.TemplateAsset),await N(void 0,e.templates,b.TemplateDescriptor),e.templates.reduce(async(o,s)=>{const r=await o,n=`${C}/js/${P(s).name}`,i=await M(n,!0);return{...r,...Dr(t,i,n,await vr(i))}},Promise.resolve({}))}async function zr(e){return e.pageTemplates?.reduce(async(t,o)=>{const s=await t,r=[o.configurationEntrypoint,o.homeEntrypoint,o.categoryEntrypoint,o.catalogEntrypoint,o.productEntrypoint].filter(J);if(r.length===0)throw new Error("No entry points provided for page template");return await N(o.name,r,b.PageTemplateDescriptor),{...s,...await Mr(o)}},Promise.resolve({}))??{}}async function Xr(){const e=await qr();return{...await Ur(e),...await zr(e)}}const Vr=()=>vs({ext:".gz",algorithm:"gzip",deleteOriginFile:!0}),Vo=()=>{const e=process.env.npm_lifecycle_event;return _s({typescript:!0,vueTsc:!1,eslint:e==="test"?!1:{lintCommand:`eslint --max-warnings=0 "./sections/**/*.{js,ts,vue}" --cache --cache-location "./build/eslintcache/${e}.json"`}})},Hr="/* EXTERNAL_IMPORTS_START */",Kr="/* EXTERNAL_IMPORTS_END */",Jr=()=>({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 r=/import.*\?commonjs-external["'];/g,n=s.code.match(r);if(n!==null){const i=n.join(""),c=Hr+i+Kr,p=s.code.replace(r,"");s.code=c+p}}}}}),Wr={[w.Server]:[he(),Z(),Jr(),Vr()],[w.Client]:[he(),Z(),Vo(),Ds({vue:"EcVue"})],[w.Misc]:[Z(),Vo()]},Ho={"process.env":{NODE_ENV:"production"}},Yr=[...ge,...ge.map(e=>`node:${e}`)],Zr=[/@vue\/compiler-dom/,/@vue\/runtime-dom/,/@vue\/server-renderer/,/@vue\/compiler-ssr/,/@vue\/shared/],_={[b.Server]:{pluginType:w.Server,define:Ho,ssr:!0,ssrOptions:{noExternal:!0},outDir:(e,t)=>`./${m[t].dist}/${e}/js/main/server`,externalOption:[...Yr,...Zr],entryFileNames:"server.js",inlineDynamicImports:!0},[b.Client]:{pluginType:w.Client,define:Ho,ssr:!1,outDir:(e,t)=>`./${m[t].dist}/${e}/js/main/client`,entryFileNames:"client.js",assetFileNames:"assets/[name].[ext]",chunkFileNames:"chunks/[name].js",inlineDynamicImports:!1},[b.SectionSetting]:{pluginType:w.Misc,ssr:!1,outDir:(e,t)=>`./${m[t].dist}/${e}/js/settings`,entryFileNames:"[name].mjs"},[b.SectionShowcase]:{pluginType:w.Misc,ssr:!1,outDir:(e,t)=>`./${m[t].dist}/${e}/js/showcases`,entryFileNames:"[name].mjs"},[b.SectionAsset]:{pluginType:w.Misc,ssr:!1,outDir:(e,t)=>`./${m[t].dist}/${e}/assets`,assetFileNames:"[name].[ext]"},[b.TemplateDescriptor]:{pluginType:w.Misc,ssr:!1,outDir:()=>`./${C}/js`,entryFileNames:`[name]${I}.mjs`},[b.PageTemplateDescriptor]:{pluginType:w.Misc,ssr:!1,outDir:e=>`./${C}/${e}`,entryFileNames:`[name]${I}.mjs`},[b.TemplateAsset]:{pluginType:w.Misc,ssr:!1,outDir:()=>`./${C}/assets`,assetFileNames:"[name].[ext]"}};function Qr(e){switch(typeof e){case"string":return[f(process.cwd(),e)];case"object":return e.map(t=>f(process.cwd(),t));default:return[]}}function Ko(e,t,o,s){const r=_[o].define,n=_[o].ssrOptions,i=_[o].entryFileNames,c=_[o].chunkFileNames,p=_[o].assetFileNames,l=_[o].inlineDynamicImports,E=_[o].externalOption;return{plugins:Wr[_[o].pluginType],...r!=null&&{define:r},...n!=null&&{ssr:n},resolve:{alias:{"@":"/src"}},css:{preprocessorOptions:{scss:{api:"modern-compiler"}}},build:{ssr:_[o].ssr,outDir:_[o].outDir(e,s),emptyOutDir:!0,minify:"terser",terserOptions:{compress:{drop_console:!1}},rollupOptions:{...E!=null&&{external:E},preserveEntrySignatures:"strict",input:Qr(t),output:{validate:!0,inlineDynamicImports:l,...i!=null&&{entryFileNames:i},...c!=null&&{chunkFileNames:c},...p!=null&&{assetFileNames:p}}}}}}async function en(e){return Sr(e.assetEntryPoints),await me({configFile:!1,...ye(Ko(e.name,e.serverEntrypoint,b.Server,e.type))}),await wr(e.name,e.type),await N(e.name,e.clientEntrypoint,b.Client,e.type),await N(e.name,e.settingsEntryPoints,b.SectionSetting,e.type),await N(e.name,e.showcaseEntryPoints,b.SectionShowcase,e.type),await N(e.name,e.assetEntryPoints,b.SectionAsset,e.type),await br(e).reduce(async(t,o)=>{const s=await t,r=await Or(o);return{...s,...r}},Promise.resolve({}))}async function tn(e){return e.reduce(async(t,o)=>{const s=await t,r=await en(o);return{...s,...r}},Promise.resolve({}))}function on(e){return Object.entries(m).find(t=>t[1].source===e)?.[0]}async function sn(){const e=await d("**/server.{js,ts}",{ignore:["node_modules/**","dist/**","templates/**"]});return Promise.all(e.map(async t=>{const o=ds(t).split(le),s=o.pop()??"default",r=o.pop();if(r===void 0)throw new Error("Cannot determine type of section, outer directory is undefined");const n=await d(`**/${s}/client.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),i=await d(`**/${s}/settings/content.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),c=await d(`**/${s}/settings/design.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),p=await d(`**/${s}/settings/layout.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),l=await d(`**/${s}/settings/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),E=await d(`**/${s}/showcases/*.{js,ts}`,{ignore:["node_modules/**","dist/**",`**/${s}/showcases/translations.{js,ts}`]}),cs=await d(`**/${s}/showcases/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),ps=await d(`**/${s}/assets/*`,{ignore:["node_modules/**","dist/**"]});return{name:s,type:on(r),serverEntrypoint:t,clientEntrypoint:n.at(0),contentSettingsEntrypoint:i.at(0),designSettingsEntrypoint:c.at(0),layoutSettingsEntrypoint:p.at(0),settingsTranslationsEntrypoint:l.at(0),showcasesEntrypoints:E,showcasesTranslationsEntrypoint:cs.at(0),assetsEntrypoints:ps}}))}function rn(){return Promise.all([Y.rm("dist",{recursive:!0,force:!0}),Y.rm("source-code",{recursive:!0,force:!0}),Y.rm("source-code.zip",{force:!0})])}async function nn(){const e=new Es,t=["node_modules/**/*","dist/**/*","build/**/*",".git/**/*","**/assets/**/*","crane.config.json"],o=await d("**/*",{cwd:f(process.cwd()),ignore:t,dot:!0,nodir:!0});try{o.forEach(n=>{const i=f(process.cwd(),n);e.addLocalFile(i,P(n).dir)});const s=W[y.SourceCode].fileName,r=f(process.cwd(),s);await e.writeZipPromise(r)}catch(s){throw a.error("Error while zipping source files"),s}}async function an(){await rn();try{const e=await sn().then(o=>o.map(s=>({name:s.name,type:s.type,serverEntrypoint:s.serverEntrypoint,clientEntrypoint:[s.clientEntrypoint].filter(J).flat(),settingsEntryPoints:[s.contentSettingsEntrypoint,s.designSettingsEntrypoint,s.layoutSettingsEntrypoint,s.settingsTranslationsEntrypoint].filter(J),showcaseEntryPoints:[...s.showcasesEntrypoints??[],s.showcasesTranslationsEntrypoint].filter(J),assetEntryPoints:s.assetsEntrypoints??[]}))),t={...await tn(e),...await Xr()};Object.keys(t).length===0?(await nn(),a.info("Build successful. For deploy run: npx @lightspeed/crane@latest deploy")):(a.error("Error during build:"),Er(t))}catch(e){a.error(`Error while building: ${e.message}`),process.exit(1)}}async function N(e,t,o,s="SECTION"){t.length!==0&&await me({configFile:!1,...ye(Ko(e,t,o,s))})}function ie(e,t){return Object.keys(e).reduce((o,s)=>{const r=e[s],n=t[s];return Oe(r)&&Oe(n)?o[s]=ie(r,n):o[s]=r,o},{...t})}function cn({contentSettings:e,sectionType:t}){const o=ro(t);return ie(e,o)}function pn({designSettings:e,sectionType:t}){const o=no(t);return ie(e,o)}function ae(e){if(e!==void 0)return e.startsWith("global.")?{type:"GLOBAL_FONT",font:e}:{type:"PRESET_FONT",font:e}}function v(e){if(e===void 0)return;if(e.startsWith("global."))return{type:"GLOBAL_COLOR",raw:e};const t=Ns(e);return{type:"STRUCTURED_COLOR",raw:e,hex:t.toHex8String(),hsl:t.toHsl(),rgba:t.toRgb(),auto:!1}}function Jo(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 ln={COLOR:"COLOR",GRADIENT:"GRADIENT"};function dn(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(ln)}`)}}function fn(e){const t=e.style,o=e.color,s=Array.isArray(o)?o:[o,o];return e.background={type:dn(t),solid:{color:v(s.at(0))},gradient:{fromColor:v(s.at(0)),toColor:v(s.at(1))}},e.style=void 0,e.color=void 0,e}const un={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"};function mn(e){switch(e){case"SOLID":return"solid-button";case"OUTLINE":return"outline-button";case"TEXT":return"text-link";default:throw new Error(`Unknown button appearance: ${e}. Right options: ${Object.keys(un)}`)}}const yn={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"};function gn(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(yn)}`)}}const hn={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"};function $n(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(hn)}`)}}function bn(e){const t=e.appearance;t!==void 0&&(e.appearance=mn(t));const o=e.size;o!==void 0&&(e.size=gn(o));const s=e.shape;s!==void 0&&(e.style=$n(s),e.shape=void 0);const r=e.font;e.font=ae(r);const n=e.color;return e.color=v(n),e}const En={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"};function Tn(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(En)}`)}}function On(e){const t=e.overlay,o=e.color,s=Array.isArray(o)?o:[o,o];return e.overlay={type:Tn(t),solid:{color:v(s.at(0))},gradient:{fromColor:v(s.at(0)),toColor:v(s.at(1))}},e.color=void 0,e}function jn(e){const t=e.font;e.font=ae(t);const o=e.color;e.color=v(o);const s=e.size;return e.size=Jo(s),e}function wn(e){const t=e.color;return e.color=v(t),e}function Sn(e){const t=e.font;e.font=ae(t);const o=e.color;e.color=v(o);const s=e.size;if(e.size=Jo(s),e.frame!==void 0){const r=e.frame.color;e.frame.color=v(r)}return e}function ce(e,t){switch(e){case"TEXT":{jn(t);break}case"BUTTON":{bn(t);break}case"IMAGE":{On(t);break}case"BACKGROUND":{fn(t);break}case"COLOR_PICKER":{wn(t);break}case"LOGO":{Sn(t);break}case"TOGGLE":case"DIVIDER":case"SELECTBOX":break;default:throw new Error(`Unknown design editor type: ${e}`)}return t}function Dn(e){Object.keys(e).forEach(t=>{const o=e[t];o.type!=="DIVIDER"&&ce(o.type,o.defaults)})}function vn(e){e.forEach(t=>{t.type!==void 0&&t.defaults!==void 0&&(ce(t.type,t.defaults),t.defaults.type=t.type)})}function Wo(e){Object.keys(e).forEach(t=>{const o=e[t],s=o.type;ce(s,o)})}const _n=e=>`\x1B[32m${e}\x1B[0m`,An=(e,t,o,s,r)=>{if(!e.total)return;const{loaded:n}=e,i=(Date.now()-r)/1e3;o.value+=n-s.value,s.value=n,t.update({speed:`${G(o.value/i,2)}/s`})},In=()=>new Ps.SingleBar({format:`|${_n("{bar}")}| {status} || {percentage}% || {value}/{total} Files || Speed: {speed}`,barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}),Cn="https://blockbuster.ecwid.com",Nn="/api/v1/custom-apps/resources/sections/upload",Pn="/api/v1/custom-apps/resources/templates/upload",xn="/api/v1/custom-apps/manifests/sections",Ln="/api/v1/custom-apps/manifests/templates",kn=5,Fn=3,Rn=[y.Server,y.Client,y.ClientChunks,y.ClientAsset,y.Asset],Gn=[y.Dependency,y.TemplateAsset,y.SourceCode],F={DEFAULT:"Error while deploying:",ASSET_FILES_UPLOAD:"Error while uploading asset files:",MANIFEST_DEPLOYMENT:"Error while deploying manifest file:",DEPRECATED_VERSION_DEPLOYMENT:"You are using a non-supported version of crane. Please update to the latest crane version to continue.",DISTRIBUTION_FOLDER_NOT_FOUND:e=>`Distribution folder [${e}] not found, please execute the build command first.`};async function R(e){return(await import(fe(e).href)).default}function Mn(e,t){if(!t)return;const o=e[t];return o===void 0?{en:t}:o}function Bn(e){const t={};for(const o in e){const s=e[o];for(const r in s){const n=t[r],i=s[r];if(n===void 0){const c={};c[o]=i,t[r]=c}else n[o]=i}}return t}function z(e,t){if(e&&typeof e=="object"){const o=e;for(const s in o){const r=o[s];typeof r=="string"&&r.startsWith("$")&&(o[s]=Mn(t,r)),typeof r=="object"&&z(r,t)}}}async function Yo(e){await new Promise(t=>{setTimeout(t,e)})}const qn={value:0},S=In();let Zo=Date.now();const Qo=e=>2**e*500;async function Un(){const e=await $e(f(u.cwd(),"crane.config.json")),t=JSON.parse(e.toString());return{appClientId:t.app_client_id,appSecretKey:btoa(t.app_secret_key)}}function zn(e){return typeof e=="object"&&e!==null&&"version"in e&&typeof e.version=="string"}async function Xn(){const e=f(u.cwd(),"package.json"),t=await $e(e),o=JSON.parse(t.toString());if(zn(o))return o;throw new Error(`Package file located at path: ${e} does not contain a version field`)}async function Vn(e){const t=Is(e.version,"patch");if(t===null)throw Error("Error while incrementing app version");e.version=t,$s(f(u.cwd(),"package.json"),`${JSON.stringify(e,null,2)}
3
- `)}async function Hn(e,t,o=O){try{const s=f(u.cwd(),`${o}/${e}/js/settings/content.mjs`),r=await R(s),n=B(e),i=cn({contentSettings:r,sectionType:n});return z(i,t),i}catch{throw new Error(`Content descriptor for section [${e}] is either invalid or undefined`)}}async function Kn(e,t,o=O){try{const s=f(u.cwd(),`${o}/${e}/js/settings/design.mjs`),r=await R(s),n=B(e),i=pn({designSettings:r,sectionType:n});return Dn(i),z(i,t),i}catch(s){const r=s;throw new Error(`Design settings is invalid or undefined. Error ${r.stack}`)}}async function Jn(e,t,o=O){try{const s=await d("*.mjs",{cwd:f(u.cwd(),`${o}/${e}/js/showcases/`),ignore:"**/translations.mjs"});return Promise.all(s.map(async r=>{const n=f(u.cwd(),`${o}/${e}/js/showcases/${r}`),i=await R(n);return Wo(i.design),z(i,t),i}))}catch(s){throw new Error(`Showcases is invalid or undefined. Error ${s}`)}}async function Wn(e,t=O){try{const o=f(u.cwd(),`${t}/${e}/js/settings/layout.mjs`);if(!D(o))return[];const s=await R(o);return s.forEach(r=>vn(r.selectedDesignSettings)),s}catch{throw new Error(`Layout descriptor for section [${e}] is either invalid or undefined`)}}async function es(e){const t=f(u.cwd(),e),o=await R(t);return Bn(o)}async function Yn(e,t=O){return es(`${t}/${e}/js/settings/translations.mjs`)}async function ts(e,t=O){return es(`${t}/${e}/js/showcases/translations.mjs`)}async function pe(e,t){const o=await Yn(e,m[t].dist),s=await ts(e,m[t].dist),r=await Hn(e,o,m[t].dist),n=await Kn(e,o,m[t].dist),i=await Jn(e,s,m[t].dist),c=await Wn(e,m[t].dist);return{id:e,type:t,name:{en:e},contentEditors:r,designEditors:n,layouts:c,showcases:i}}async function Zn(){const e=await d("*/",{cwd:f(u.cwd(),`${O}/`)}),t=await d("*/",{cwd:f(u.cwd(),`${Q}/`)}),o=await d("*/",{cwd:f(u.cwd(),`${ee}/`)});return Promise.all([...e.map(async s=>pe(s,"SECTION")),...t.map(async s=>pe(s,"HEADER")),...o.map(async s=>pe(s,"FOOTER"))])}async function Qn(e){try{return await R(f(u.cwd(),e))}catch{throw new Error(`Template descriptor [${e}] is either invalid or undefined`)}}async function ei(e){const t=await d(`${C}/js/**.mjs`,{ignore:[`${C}/js/**${I}.mjs`]});return Promise.all(t.map(async o=>{const s=await Qn(o),r=s.sections.filter(n=>n.type==="custom");for(const n of r){const i=B(n.id),c=await ts(n.id,m[i].dist);n.showcase_overrides!==void 0&&(z(n.showcase_overrides,c),Wo(n.showcase_overrides.design))}return{id:`${e}_${P(o).name}`,descriptor:s}}))}function os(e,t){const o=e.pathContext,s=o.toPath(e.currentSection,t),r=s===void 0?ue(o.fileName):ue(o.fileName,{cwd:f(u.cwd(),s),ignore:o.ignore});return(o.isSingleton?r.splice(0):r).map(n=>({url:n,subType:t,context:e}))}function ti(e){return e instanceof be&&(e.code==="ECONNRESET"||e.response?.status!==void 0&&e.response?.status>=500&&e.response?.status<600)}function ss(e,t){return e<Fn&&ti(t)}function rs(e,t,o,s){const r={value:0},n=e.config.app.templates.length>0?Pn:Nn;return e.config.axios.post(n,{file:bs(f(u.cwd(),o!==void 0?o+t:t))},{params:{appClientId:e.config.app.crane.appClientId,type:e.pathContext.type,version:e.config.app.packageJson.version,...e.currentSection!==void 0&&{block:e.currentSection},...!["dependencies","source_code"].includes(e.pathContext.type)&&{fileName:t}},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${e.config.app.crane.appSecretKey}`},onUploadProgress:i=>An(i,S,qn,r,Zo)}).then(i=>(S.increment(),i)).catch(async i=>{if(ss(s,i))return await Yo(Qo(s)),rs(e,t,o,s+1);throw S.increment(),i})}function oi(e){return S.start(e.length+1,0,{speed:"N/A",status:"Deployment in progress"}),e.map(t=>{const o=t.context,s=o.pathContext.toPath(o.currentSection,t.subType);return rs(o,t.url,s,0)})}function si(e){const t=e.app.sections.flatMap(s=>Rn.flatMap(r=>{const n={config:e,currentSection:s.id,pathContext:W[r]};return os(n,s.type)})),o=Gn.flatMap(s=>os({config:e,pathContext:W[s]},"SECTION"));return oi([...t,...o])}function ri(e){return e.includes(`
4
- `)}function ni(e,t,o){return e.split(`
5
- `).map((s,r)=>r>=o?t+s:s).join(`
6
- `)}function X(e,t){const o=[];if(e instanceof be){e.response?.status!==void 0&&o.push(` HTTP Status Code: ${e.response.status}`);const n=e.response?.data;if(n?.errorCode&&o.push(` Error Code: ${n.errorCode}`),n?.errorMessage){const i=ri(n.errorMessage)?ni(n.errorMessage," ",1):n.errorMessage;o.push(` Error Message: ${i}`)}}const s=o.length>0?o.join(`
7
- `):e?.message??"Unknown error";if(!t||t.length===0)return s;const r=o.length>0?`
8
- `:" ";return`${t}${r}${s}`}async function ns(e,t=0){const o=e.app.templates.length>0?Ln:xn;return e.axios.post(o,{version:e.app.packageJson.version,name:"Custom Block App",blocks:e.app.sections,templates:e.app.templates,compressionEnabled:!0,externalizationEnabled:!0,vueVersion:e.app.packageJson.dependencies.vue},{params:{appClientId:e.app.crane.appClientId},headers:{Authorization:`Bearer ${e.app.crane.appSecretKey}`}}).catch(async s=>{if(ss(t,s))return await Yo(Qo(t)),ns(e,t+1);throw s})}async function ii(e){try{if(!D(f(u.cwd(),O)))throw new Error(F.DISTRIBUTION_FOLDER_NOT_FOUND(O));const t=e??Cn;a.info("Custom application deployment :: Started");const o=As.create({baseURL:t});Cs(o,kn),a.info("Loading configuration files ...");const s=await Promise.all([Un(),Xn(),Zn()]).then(async([i,c,p])=>({axios:o,app:{crane:i,packageJson:c,sections:p,templates:await ei(i.appClientId)}}));a.info("Uploading files ..."),Zo=Date.now(),await Promise.all(si(s)).catch(i=>{S.stop(),i.response?.status===404?a.error(X(i,F.DEPRECATED_VERSION_DEPLOYMENT)):a.error(X(i,F.ASSET_FILES_UPLOAD)),u.exit(1)}).finally(()=>{S.increment(),S.stop()}),S.update({speed:"N/A",status:"Finalising deployment"}),await ns(s).catch(i=>{S.stop(),i.response?.status===404?a.error(X(i,F.DEPRECATED_VERSION_DEPLOYMENT)):a.error(X(i,F.MANIFEST_DEPLOYMENT)),u.exit(1)}).finally(()=>{S.increment(),S.stop()});const r=s.app.sections.map(i=>i.id),n=s.app.packageJson.version;a.info("Custom application deployment :: Successful"),a.info(`Current app version: ${n}`),a.info(`Deployed sections: ${r.join(", ")}`),await Vn(s.app.packageJson),s.app.templates.length>0&&a.info(`Deployed templates: ${s.app.templates.map(i=>i.id).join(", ")}`)}catch(t){S.stop(),a.error(X(t,F.DEFAULT)),u.exit(1)}}const ai="1.2.2";async function ci(e){oe(),te("template/headers/example-header","headers",e,"Header")}async function pi(e){oe(),te("template/footers/example-footer","footers",e,"Footer")}const li={deploy:["url"],init:["customStorefrontPages"]};function di(e,t){return e.options.length!==0&&Object.keys(t).length===1}function fi(e){return e.includes("-h")||e.includes("--help")}function ui(e,t){return Object.keys(t).some(o=>o!=="--"&&!e.hasOption(o)&&!li[e.rawName]?.includes(o))}function mi(e){return e.length!==0}function yi(e,t,o){return e.matchedCommand!==void 0&&(di(e.matchedCommand,o)||fi(e.rawArgs)||ui(e.matchedCommand,e.options)||mi(t))}function gi(e,t,o){e.matchedCommand&&!yi(e,t,o)?e.runMatchedCommand():e.outputHelp()}function is(e){if(ks(e))return console.log("Please specify a name for your resource."),!1;const{isValid:t,errorMessage:o}=Ls(e);return o&&console.log(o),t}async function as(e,t,o,s,r){const n=(await de({type:"text",name:"name",message:`Please specify a name for your ${t}:`})).name;if(n===void 0)return console.log(`You can use ${o} to directly specify the name of the ${t}.`),e.outputHelp();const i=g.basename(n);return is(i)?s(i,r):as(e,t,o,s,r)}async function V(e,t,o,s,r,n){if(r!==void 0)if(!is(r))await as(e,t,o,s);else{const i=g.basename(r.toString());await s(i,n)}}async function hi(e,t){try{const{app:o,section:s,header:r,footer:n,template:i,customStorefrontPages:c,referenceTemplate:p}=e,l=!!c;await V(t,"app",x("init --app <name>"),Vs,o),await V(t,"section",x("init --section <name>"),Ks,s),await V(t,"header",x("init --header <name>"),ci,r),await V(t,"footer",x("init --footer <name>"),pi,n),await V(t,"template",x("init --template <name>"),Js,i,l),p&&await Ws()}catch(o){a.error(`Error while executing init operation: ${o.message}`),process.exit(1)}}function $i(){try{const e=ls("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=>hi(o,e)),e.command("build","Builds your resource code").action(an),e.command("deploy","Deploys your resource code").allowUnknownOptions().action(()=>ii(e.options.url)),e.version(ai),e.usage("<action> <resource>");const t=e.parse(process.argv,{run:!1});gi(e,t.args,t.options)}catch(e){a.error(`Error while parsing input: ${e.message}`),process.exit(1)}}export{$i as run};
1
+ import As from"cac";import*as Q from"path";import g,{sep as x,resolve as f,parse as F,dirname as Is}from"path";import{red as Cs,yellow as Ps,green as R}from"kolorist";import Ee from"prompts";import b from"node:fs";import P from"node:path";import T from"node:process";import*as ee from"fs";import h,{existsSync as w,statSync as Ns,rename as Te,unlink as je,promises as se,writeFileSync as Ls,createReadStream as xs}from"fs";import{pathToFileURL as we}from"url";import{fileURLToPath as ks}from"node:url";import Fs from"adm-zip";import{glob as p,globSync as Oe}from"glob";import{defineConfig as _e,build as Se}from"vite";import Rs from"ajv/dist/2020.js";import Gs from"ajv-formats";import Ms from"node:zlib";import{promisify as Bs}from"node:util";import{JSONPath as qs}from"jsonpath-plus";import{builtinModules as ve}from"module";import{viteExternalsPlugin as De}from"vite-plugin-externals";import Us from"vite-plugin-compression";import zs from"@vitejs/plugin-vue";import Xs from"vite-tsconfig-paths";import Hs from"vite-plugin-checker";import{readFile as Ae}from"fs/promises";import Vs,{AxiosError as Ie}from"axios";import{inc as Ks}from"semver";import*as A from"process";import I from"process";import{ConcurrencyManager as Ys}from"axios-concurrency";import Js from"cli-progress";import Ws 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(Cs(e)),warn:e=>console.log(Ps(e)),info:e=>console.log(R(e))},C="_temp",E="dist/sections",z="dist/headers",X="dist/footers",S="dist/templates",Ce="layouts",ne=`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(x).slice(1,-1).join(x)}const Zs="Resource name can only contain alphanumeric characters, dashes, and underscores";function Qs(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:Zs}}function en(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(we(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 tn(e){return g.parse(e).name}var on=(e=>(e.SingleFile="single-file",e.MultiPage="multi-page",e))(on||{});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 sn(e){return e?"multi-page":"single-file"}function nn(e,t){return e==="single-file"?{"template.ts":`${t}.ts`}:{"example-template":`${t}`}}function rn(e,t){return e==="single-file"?`${t}.ts`:t}function an(e){return e==="single-file"?"template/templates":"template/page-templates"}function cn(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 pn(e,t){const o=sn(t),s=nn(o,e),n=rn(o,e),r=an(o),i=cn(o,e);return{renameFiles:s,targetPath:n,sourcePath:r,onTemplateCreated:i}}function k(e){return P.resolve(ks(import.meta.url),"../..",e)}function ln(){const e=k("package.json");return e!==""?JSON.parse(b.readFileSync(e,"utf8")):{}}async function dn(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=k("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=ln();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 re(e,t,o,s){try{const n=T.cwd(),r=g.join(n,t);h.existsSync(r)||h.mkdirSync(r);const i=g.join(n,t,o);h.existsSync(i)?(a.error(`${s} with the name: ${o} already exists. If you'd like to override it, delete previous version first`),T.exit(1)):h.mkdirSync(i);const c=k(e);h.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 ie(e){const t=T.cwd(),o=k(`template/${e}`),s=g.join(t,e);h.existsSync(s)||(h.mkdirSync(s),h.readdirSync(o).forEach(async n=>N(s,o,n)))}function fn(e,t,o){if(!h.existsSync(o)){h.copyFileSync(t,o);return}const s=h.readFileSync(t),n=h.readFileSync(o);s.equals(n)||a.warn(`File "${e.name}" exists but differs from template. File will be skipped, this may lead to issues.`)}function Re(e,t){const o=h.readdirSync(e,{withFileTypes:!0});h.existsSync(t)||h.mkdirSync(t,{recursive:!0}),o.forEach(s=>{const n=g.join(e,s.name),r=g.join(t,s.name);s.isDirectory()?Re(n,r):fn(s,n,r)})}function ae(){try{const e=T.cwd(),t=g.join(e,"shared"),o=k("template/shared");if(!h.existsSync(o))return;Re(o,t)}catch(e){a.error(`Error while processing shared folder: ${e.message}`),T.exit(1)}}async function un(e){ae(),re("template/sections/example-section","sections",e,"Section")}async function mn(e,t){const{targetPath:o,renameFiles:s,sourcePath:n,onTemplateCreated:r}=pn(e,t);try{const i=T.cwd(),c=P.join(i,"templates"),l=k(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)),ie("headers"),ie("footers"),t&&ie("layouts"),r()}catch(i){a.error(`Error while creating template descriptors: ${i.message}`),T.exit(1)}}async function yn(){try{const e=T.cwd(),t=k("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 Ee({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}},gn={$schema:Ge,$id:Me,title:Be,description:qe,type:Ue,$defs:ze},Xe={__proto__:null,$defs:ze,$id:Me,$schema:Ge,default:gn,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}},hn={$schema:He,$id:Ve,title:Ke,description:Ye,type:Je,$defs:We},Ze={__proto__:null,$defs:We,$id:Ve,$schema:He,default:hn,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"]}},$n={$schema:Qe,$id:et,title:tt,description:ot,type:st,$defs:nt},rt={__proto__:null,$defs:nt,$id:et,$schema:Qe,default:$n,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}},bn={$schema:it,$id:at,title:ct,description:pt,type:lt,$defs:dt},ft={__proto__:null,$defs:dt,$id:at,$schema:it,default:bn,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,En={$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:En,description:gt,patternProperties:$t,title:yt,type:ht},jt="https://json-schema.org/draft/2020-12/schema",wt="https://lightspeedhq.com/sections/section-translation.schema.json",Ot="Custom Section - Translations",_t="The translation of the section's labels",St="object",vt={"^[a-z]{2}$":{type:"object",patternProperties:{"^\\$.*$":{type:"string"}},additionalProperties:!1}},Dt=!1,Tn={$schema:jt,$id:wt,title:Ot,description:_t,type:St,patternProperties:vt,additionalProperties:Dt},At={__proto__:null,$id:wt,$schema:jt,additionalProperties:Dt,default:Tn,description:_t,patternProperties:vt,title:Ot,type:St},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:[]}},jn={$schema:It,$id:Ct,title:Pt,description:Nt,type:Lt,patternProperties:xt,$defs:kt},Ft={__proto__:null,$defs:kt,$id:Ct,$schema:It,default:jn,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,wn={$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:wn,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"}],On={$schema:Ht,$id:Vt,title:Kt,description:Yt,type:Jt,required:Wt,allOf:Zt},Qt={__proto__:null,$id:Vt,$schema:Ht,allOf:Zt,default:On,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"],_n={$schema:eo,$id:to,title:oo,description:so,type:no,properties:ro,required:io},ao={__proto__:null,$id:to,$schema:eo,default:_n,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"}},Sn={$schema:co,$id:po,title:lo,description:fo,type:uo,properties:mo},yo={__proto__:null,$id:po,$schema:co,default:Sn,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:"^\\$.+"}},vn={$schema:go,$id:ho,title:$o,description:bo,type:Eo,$defs:To},jo={__proto__:null,$defs:To,$id:ho,$schema:go,default:vn,description:bo,title:$o,type:Eo};var ce=(e=>(e.SECTION="SECTION",e.HEADER="HEADER",e.FOOTER="FOOTER",e))(ce||{});const m={SECTION:{source:"sections",dist:"dist/sections"},HEADER:{source:"headers",dist:"dist/headers"},FOOTER:{source:"footers",dist:"dist/footers"}};function H(e){return w(`${z}/${e}`)?"HEADER":w(`${X}/${e}`)?"FOOTER":"SECTION"}function wo(e){const t=H(e);return m[t].dist}var V=(e=>(e.CONTENT="Content",e.DESIGN="Design",e))(V||{});const Dn={menu:{type:"NAVIGATION_MENU"},logo:{type:"LOGO"}},An={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 ce.HEADER:return Dn;default:return{}}}function _o(e){switch(e){case ce.HEADER:return An;default:return{}}}function In({validationType:e,sectionType:t}){switch(e){case V.CONTENT:return Oo(t);case V.DESIGN:return _o(t);default:return{}}}function Cn({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 Pn({type:e,mandatorySettings:t}){return Object.keys(t).find(o=>t[o].type===e)}function Nn({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).forEach(([s,n])=>{const r=Pn({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 Ln({type:e,mandatorySettings:t}){return Object.keys(t).findLast(o=>t[o].type===e)}function xn({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=Ln({type:r,mandatorySettings:t});o.push({instancePath:i,keyword:"duplicate-type",message:`Editor type "${r}" can only be used once.`})}}),o}function kn(e,t){const{sectionSettings:o,sectionType:s}=t,n=In({validationType:e,sectionType:s});return n===void 0||ke(n)?[]:[...Cn({sectionSettings:o,mandatorySettings:n}),...Nn({sectionSettings:o,mandatorySettings:n}),...xn({sectionSettings:o,mandatorySettings:n})]}var u=(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))(u||{}),oe=(e=>(e.PRODUCT="PRODUCT",e.CATALOG="CATALOG",e.CATEGORY="CATEGORY",e.HOME="HOME",e.CUSTOM="CUSTOM",e))(oe||{});const K={[u.Server]:{type:"server_js_compressed",fileName:"server.js.gz",isSingleton:!0,toPath:({id:e,sectionType:t})=>`${m[t].dist}/${e}/js/main/server/`},[u.Client]:{type:"client_js",fileName:"client.js",isSingleton:!1,toPath:({id:e,sectionType:t})=>`${m[t].dist}/${e}/js/main/client/`},[u.ClientChunks]:{type:"client_js_chunks",isSingleton:!1,toPath:({id:e,sectionType:t})=>`${m[t].dist}/${e}/js/main/client/chunks/`,fileName:"*"},[u.ClientAsset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:({id:e,sectionType:t})=>`${m[t].dist}/${e}/js/main/client/assets/`},[u.Asset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:({id:e,sectionType:t})=>`${m[t].dist}/${e}/assets/`},[u.TemplateAsset]:{type:"template_assets",fileName:"*",isSingleton:!1,toPath:()=>`${S}/assets/`},[u.Dependency]:{type:"dependencies",fileName:"package.json",isSingleton:!0,toPath:()=>{}},[u.SourceCode]:{type:"source_code",fileName:"source-code.zip",isSingleton:!0,toPath:()=>{}},[u.Layout]:{type:"layout",fileName:"index.mjs",isSingleton:!0,toPath:({id:e,layoutId:t})=>`${ne}/${e}/${t}/`}},Y=[Xt,Ft,Tt,Qt,ao,Xe,Ze,rt,ft,yo,jo];function M(e,t){const o=new Rs({allErrors:!0,schemas:e});return Gs(o),o.getSchema(t.$id)||o.compile(t)}function Fn(){return M(Y,ao)}function pe(e){return e.map(t=>({instancePath:t.instancePath,message:t.message??"",keyword:t.keyword}))}const Rn=e=>(()=>{const t=wo(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:M(Y,Tt),validationType:V.CONTENT,sectionName:e.name,type:e.type},{source:`./${o}/${e.name}/settings/design.ts`,dist:g.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:g.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:g.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 Gn(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 Mn(e,t){if(e.validationType===void 0||e.sectionName===void 0)return[];const{sectionName:o,validationType:s}=e,n=H(o);return[...kn(s,{sectionSettings:t,sectionType:n})]}function So(e,t){return qs({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 Bn(e){const t=await G(e.dist,!1),o={},s=[],n=wo(e.sectionName??"").split("/").pop()?.toLowerCase();return e.ajv(t)||s.push(...pe(e.ajv.errors??[])),s.push(...Mn(e,t),...So(`${n}/${e.sectionName}`,t)),s.length>0&&(o[e.source]=s),o}async function qn(e){const t=Bs(Ms.gunzip),o=await h.promises.readFile(e);return(await t(o)).length}async function Un(e,t){const o=K[u.Server],s=g.resolve(`${o.toPath({id:e,sectionType:t})}${o.fileName}`),n=await qn(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 zn(e){const t=e.reduce((o,s)=>{const n=Ns(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 Xn(e,t,o,s){const n={};return e(t)&&s===void 0?Te(`${o}${C}.mjs`,`${o}.mjs`,()=>{}):(je(`${o}${C}.mjs`,()=>{}),n[g.resolve(`./templates/${F(o).name}.ts`)]=[...pe(e.errors??[]),...s??[]]),n}var j=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.Misc=2]="Misc",e[e.Layout=3]="Layout",e))(j||{}),y=(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))(y||{});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,Hn={$schema:vo,$id:Do,title:Ao,description:Io,type:Co,properties:Po,required:No,additionalProperties:Lo},Vn={__proto__:null,$id:Do,$schema:vo,additionalProperties:Lo,default:Hn,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"]}}}}],Kn={$schema:xo,$id:ko,title:Fo,type:Ro,required:Go,properties:Mo,additionalProperties:Bo,allOf:qo},Yn={__proto__:null,$id:ko,$schema:xo,additionalProperties:Bo,allOf:qo,default:Kn,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"],Jn={$schema:Uo,$id:zo,title:Xo,description:Ho,type:Vo,properties:Ko,additionalProperties:Yo,required:Jo},Wn={__proto__:null,$id:zo,$schema:Uo,additionalProperties:Yo,default:Jn,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"],Zn={$schema:Wo,$id:Zo,title:Qo,description:es,type:ts,properties:os,additionalProperties:ss,required:ns},le={__proto__:null,$id:Zo,$schema:Wo,additionalProperties:ss,default:Zn,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}],Qn={$schema:rs,$id:is,title:as,description:cs,type:ps,allOf:ls},er={__proto__:null,$id:is,$schema:rs,allOf:ls,default:Qn,description:cs,title:as,type:ps},tr="https://blockbuster.ecwid.com",or="/api/v1/custom-apps/resources/sections/upload",sr="/api/v1/custom-apps/resources/templates/upload",nr="/api/v1/custom-apps/manifests/sections",rr="/api/v1/custom-apps/manifests/templates",ir=5,ar=3,cr=[u.Server,u.Client,u.ClientChunks,u.ClientAsset,u.Asset],pr=[u.Dependency,u.TemplateAsset,u.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"},lr=e=>ds[e],dr=e=>e in ds,fr=[Xt,Xe,Ze,yo,ft,rt,er,Yn,jo],ur=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:g.resolve(`dist/templates/${e.name}/${r}`),ajv:M(fr,i)})};return s(e.catalogEntrypoint,"catalog",le),s(e.productEntrypoint,"product",le),s(e.homeEntrypoint,"home",Wn),s(e.categoryEntrypoint,"category",le),s(e.configurationEntrypoint,"configuration",Vn),[t,o]};function mr(e,t){if(t.findIndex(o=>o===`${e.id}${x}${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 yr(e,t){const o=(t??[]).map(xe);return e.sections.filter(s=>dr(s.id)).filter(s=>"layout_id"in s).map(s=>mr(s,o)).filter(s=>s!==void 0)}function gr(e){return"sections"in e}async function hr(e,t){const o=await G(e.dist,!0),s={},n=[];if(e.ajv(o)?Te(`${e.dist}${C}.mjs`,`${e.dist}.mjs`,()=>{}):(n.push(...pe(e.ajv.errors??[])),je(`${e.dist}${C}.mjs`,()=>{})),gr(o)){const r=await yr(o,t);n.push(...r)}return n.length>0&&(s[e.source]=n),s}const $r=async(e,t)=>{const[o,s]=ur(e);return(await Promise.all(o.map(n=>hr(n,t)))).reduce((n,r)=>(Object.entries(r).forEach(([i,c])=>{n[i]=n[i]?[...n[i],...c]:[...c]}),n),{...s})};async function br(e,t,o,s=E){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 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 Er(e,t,o,s=E){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 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 Tr(e,t,o,s=E){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 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 de(e,t,o,s=E){t.showcase_overrides!==void 0&&(await br(e,t,o,s),await Er(e,t,o,s),await Tr(e,t,o,s))}function fe(e,t,o,s=E){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 jr(e,t){const o=t.id==="header"&&t.type==="default",s=w(`${z}/${t.id}`);!o&&!s&&e.push({instancePath:"/sections/0/id",message:"The first section must be a `header`",keyword:"required"}),s&&(await de(e,t,0,z),fe(e,t,0,z))}async function wr(e,t,o){const s=t.id==="footer"&&t.type==="default",n=w(`${X}/${t.id}`);!s&&!n&&e.push({instancePath:`/sections/${o}/id`,message:"The last section must be a `footer`",keyword:"required"}),n&&(await de(e,t,o,X),fe(e,t,o,X))}async function Or(e,t){t.showcase_overrides&&e.push(...So(`sections/${t.id}`,t.showcase_overrides))}async function _r(e){const t=await e.sections.reduce(async(o,s,n)=>{const r=await o;return n===0?await jr(r,s):n===e.sections.length-1?await wr(r,s,e.sections.length-1):s.type==="custom"?w(`${E}/${s.id}`)?(await de(r,s,n),fe(r,s,n),await Or(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 Sr(){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(x),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 vr(){const e=await p("./templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]}),t=await p("./templates/assets/*",{ignore:["node_modules/**","dist/**"]});return{pageTemplates:await Sr(),templates:e,assets:t}}async function Dr(e){if(e.templates.length===0&&e.pageTemplates?.length===0)return{};const t=await Fn();return await L(void 0,e.assets,y.TemplateAsset),await L(void 0,e.templates,y.TemplateDescriptor),e.templates.reduce(async(o,s)=>{const n=await o,r=`${S}/js/${F(s).name}`,i=await G(r,!0);return{...n,...Xn(t,i,r,await _r(i))}},Promise.resolve({}))}async function Ar({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 L(s.name,r,y.PageTemplateDescriptor),{...n,...await $r(s,t)}},Promise.resolve({}))??{}}async function Ir({layoutEntrypoints:e}){const t=await vr(),o=await Promise.all([Dr(t),Ar({templateBuildConfig:t,layoutEntrypoints:e})]);return o.some(s=>!ke(s))?o.reduce((s,n)=>({...s,...n}),{}):{}}const Cr=()=>Us({ext:".gz",algorithm:"gzip",deleteOriginFile:!0}),Pr="/* EXTERNAL_IMPORTS_START */",Nr="/* EXTERNAL_IMPORTS_END */",Lr=()=>({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=Pr+i+Nr,l=s.code.replace(n,"");s.code=c+l}}}}}),xr=()=>{const e=process.env.npm_lifecycle_event;return Hs({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:zs(),TS_CONFIG_PATHS:Xs(),CHECKER:xr()},kr={[j.Server]:[v.VUE,v.TS_CONFIG_PATHS,Lr(),Cr()],[j.Client]:[v.VUE,v.TS_CONFIG_PATHS,v.CHECKER,De({vue:"EcVue"})],[j.Misc]:[v.TS_CONFIG_PATHS,v.CHECKER],[j.Layout]:[v.VUE,v.TS_CONFIG_PATHS,v.CHECKER,De({vue:"StVue"})]},fs={"process.env":{NODE_ENV:"production"}},Fr=[...ve,...ve.map(e=>`node:${e}`)],Rr=[/@vue\/compiler-dom/,/@vue\/runtime-dom/,/@vue\/server-renderer/,/@vue\/compiler-ssr/,/@vue\/shared/],D={[y.Server]:{pluginType:j.Server,define:fs,ssr:!0,ssrOptions:{noExternal:!0},outDir:(e,t)=>`./${m[t].dist}/${e}/js/main/server`,externalOption:[...Fr,...Rr],entryFileNames:"server.js",inlineDynamicImports:!0},[y.Client]:{pluginType:j.Client,define:fs,ssr:!1,outDir:(e,t)=>`./${m[t].dist}/${e}/js/main/client`,entryFileNames:"client.js",assetFileNames:"assets/[name].[ext]",chunkFileNames:"chunks/[name].js",inlineDynamicImports:!1},[y.SectionSetting]:{pluginType:j.Misc,ssr:!1,outDir:(e,t)=>`./${m[t].dist}/${e}/js/settings`,entryFileNames:"[name].mjs"},[y.SectionShowcase]:{pluginType:j.Misc,ssr:!1,outDir:(e,t)=>`./${m[t].dist}/${e}/js/showcases`,entryFileNames:"[name].mjs"},[y.SectionAsset]:{pluginType:j.Misc,ssr:!1,outDir:(e,t)=>`./${m[t].dist}/${e}/assets`,assetFileNames:"[name].[ext]"},[y.TemplateDescriptor]:{pluginType:j.Misc,ssr:!1,outDir:()=>`./${S}/js`,entryFileNames:`[name]${C}.mjs`},[y.PageTemplateDescriptor]:{pluginType:j.Misc,ssr:!1,outDir:e=>`./${S}/${e}`,entryFileNames:`[name]${C}.mjs`},[y.TemplateAsset]:{pluginType:j.Misc,ssr:!1,outDir:()=>`./${S}/assets`,assetFileNames:"[name].[ext]"},[y.Layout]:{pluginType:j.Layout,ssr:!1,outDir:e=>`./${ne}/${e}`,entryFileNames:"index.mjs",inlineDynamicImports:!0}};function Gr(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:kr[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:Gr(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 Mr(e){const t=_e(us({name:e.name,entryPoints:e.serverEntrypoint,configType:y.Server,sectionType:e.type}));return zn(e.assetEntryPoints),await Se({configFile:!1,...t}),await Un(e.name,e.type),await L(e.name,e.clientEntrypoint,y.Client,e.type),await L(e.name,e.settingsEntryPoints,y.SectionSetting,e.type),await L(e.name,e.showcaseEntryPoints,y.SectionShowcase,e.type),await L(e.name,e.assetEntryPoints,y.SectionAsset,e.type),await Rn(e).reduce(async(o,s)=>{const n=await o,r=await Bn(s);return{...n,...r}},Promise.resolve({}))}async function Br(e){return e.reduce(async(t,o)=>{const s=await t,n=await Mr(o);return{...s,...n}},Promise.resolve({}))}function qr(e){const t=xe(e);return L(t,[e],y.Layout)}function Ur(){return p(`./${Ce}/{product,category,catalog}/*/Main.vue`,{ignore:["node_modules/**","dist/**"]})}async function zr(e){e===void 0||e.length===0||await Promise.all(e.map(qr))}function Xr(e){return Object.entries(m).find(t=>t[1].source===e)?.[0]}async function Hr(){const e=await p("**/server.{js,ts}",{ignore:["node_modules/**","dist/**","templates/**"]});return Promise.all(e.map(async t=>{const o=Is(t).split(x),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}`]}),vs=await p(`**/${s}/showcases/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),Ds=await p(`**/${s}/assets/*`,{ignore:["node_modules/**","dist/**"]});return{name:s,type:Xr(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:vs.at(0),assetsEntrypoints:Ds}}))}function Vr(){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 Kr(){const e=new Fs,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[u.SourceCode].fileName,n=f(process.cwd(),s);await e.writeZipPromise(n)}catch(s){throw a.error("Error while zipping source files"),s}}async function Yr(e=!1){await Vr();try{const t=await Ur(),o=await Hr().then(n=>n.map(r=>({name:r.name,type:r.type,serverEntrypoint:r.serverEntrypoint,clientEntrypoint:[r.clientEntrypoint].filter(te).flat(),settingsEntryPoints:[r.contentSettingsEntrypoint,r.designSettingsEntrypoint,r.layoutSettingsEntrypoint,r.settingsTranslationsEntrypoint].filter(te),showcaseEntryPoints:[...r.showcasesEntrypoints??[],r.showcasesTranslationsEntrypoint].filter(te),assetEntryPoints:r.assetsEntrypoints??[]}))),s={...await Br(o),...await Ir({layoutEntrypoints:t})};Object.keys(s).length===0?(await zr(t),await Kr(),a.info("Build successful. For deploy run: npx @lightspeed/crane@latest deploy")):(a.error("Error during build:"),Gn(s))}catch(t){a.error(`Error while building: ${t.message}`),process.exit(1)}}async function L(e,t,o,s="SECTION"){if(t.length!==0){const n=_e(us({name:e,entryPoints:t,configType:o,sectionType:s}));await Se({configFile:!1,...n})}}const Jr=e=>`\x1B[32m${e}\x1B[0m`,Wr=(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`})},Zr=()=>new Js.SingleBar({format:`|${Jr("{bar}")}| {status} || {percentage}% || {value}/{total} Files || Speed: {speed}`,barCompleteChar:"\u2588",barIncompleteChar:"\u2591"});function ue(e,t){return Object.keys(e).reduce((o,s)=>{const n=e[s],r=t[s];return Le(n)&&Le(r)?o[s]=ue(n,r):o[s]=n,o},{...t})}function Qr({contentSettings:e,sectionType:t}){const o=Oo(t);return ue(e,o)}function ei({designSettings:e,sectionType:t}){const o=_o(t);return ue(e,o)}function me(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=Ws(e);return{type:"STRUCTURED_COLOR",raw:e,hex:t.toHex8String(),hsl:t.toHsl(),rgba:t.toRgb(),auto:!1}}function ms(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 ti={COLOR:"COLOR",GRADIENT:"GRADIENT"};function oi(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(ti)}`)}}function si(e){const t=e.style,o=e.color,s=Array.isArray(o)?o:[o,o];return e.background={type:oi(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 ni={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"};function ri(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(ni)}`)}}const ii={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"};function ai(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(ii)}`)}}const ci={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"};function pi(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(ci)}`)}}function li(e){const t=e.appearance;t!==void 0&&(e.appearance=ri(t));const o=e.size;o!==void 0&&(e.size=ai(o));const s=e.shape;s!==void 0&&(e.style=pi(s),e.shape=void 0);const n=e.font;e.font=me(n);const r=e.color;return e.color=_(r),e}const di={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"};function fi(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(di)}`)}}function ui(e){const t=e.overlay,o=e.color,s=Array.isArray(o)?o:[o,o];return e.overlay={type:fi(t),solid:{color:_(s.at(0))},gradient:{fromColor:_(s.at(0)),toColor:_(s.at(1))}},e.color=void 0,e}function mi(e){const t=e.font;e.font=me(t);const o=e.color;e.color=_(o);const s=e.size;return e.size=ms(s),e}function yi(e){const t=e.color;return e.color=_(t),e}function gi(e){const t=e.font;e.font=me(t);const o=e.color;e.color=_(o);const s=e.size;if(e.size=ms(s),e.frame!==void 0){const n=e.frame.color;e.frame.color=_(n)}return e}function ye(e,t){switch(e){case"TEXT":{mi(t);break}case"BUTTON":{li(t);break}case"IMAGE":{ui(t);break}case"BACKGROUND":{si(t);break}case"COLOR_PICKER":{yi(t);break}case"LOGO":{gi(t);break}case"TOGGLE":case"DIVIDER":case"SELECTBOX":break;default:throw new Error(`Unknown design editor type: ${e}`)}return t}function hi(e){Object.keys(e).forEach(t=>{const o=e[t];o.type!=="DIVIDER"&&ye(o.type,o.defaults)})}function $i(e){e.forEach(t=>{t.type!==void 0&&t.defaults!==void 0&&(ye(t.type,t.defaults),t.defaults.type=t.type)})}function ys(e){Object.keys(e).forEach(t=>{const o=e[t],s=o.type;ye(s,o)})}function bi(e,t){if(!t)return;const o=e[t];return o===void 0?{en:t}:o}function Ei(e){const t={};for(const o in e){const s=e[o];for(const n in s){const 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]=bi(t,n):typeof n=="object"&&J(n,t)}}async function q(e){return(await import(we(e).href)).default}async function Ti(e,t,o=E){try{const s=f(I.cwd(),`${o}/${e}/js/settings/content.mjs`),n=await q(s),r=H(e),i=Qr({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=ei({designSettings:n,sectionType:r});return hi(i),J(i,t),i}catch(s){const n=s;throw new Error(`Design settings is invalid or undefined. Error ${n.stack}`)}}async function wi(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 ys(i.design),J(i,t),i}))}catch(s){throw new Error(`Showcases is invalid or undefined. Error ${s}`)}}async function Oi(e,t=E){try{const o=f(I.cwd(),`${t}/${e}/js/settings/layout.mjs`);if(!w(o))return[];const s=await q(o);return s.forEach(n=>$i(n.selectedDesignSettings)),s}catch{throw new Error(`Layout descriptor for section [${e}] is either invalid or undefined`)}}async function gs(e){const t=f(I.cwd(),e),o=await q(t);return Ei(o)}async function _i(e,t=E){return gs(`${t}/${e}/js/settings/translations.mjs`)}async function hs(e,t=E){return gs(`${t}/${e}/js/showcases/translations.mjs`)}async function ge(e,t){const o=await _i(e,m[t].dist),s=await hs(e,m[t].dist),n=await Ti(e,o,m[t].dist),r=await ji(e,o,m[t].dist),i=await wi(e,s,m[t].dist),c=await Oi(e,m[t].dist);return{id:e,type:t,name:{en:e},contentEditors:n,designEditors:r,layouts:c,showcases:i}}async function Si(){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=>ge(s,"SECTION")),...t.map(async s=>ge(s,"HEADER")),...o.map(async s=>ge(s,"FOOTER"))])}async function he(e){if(!e||e.type!=="custom")return;const t=H(e.id),o=await hs(e.id,m[t].dist);e.showcase_overrides!==void 0&&(J(e.showcase_overrides,o),e.showcase_overrides.design&&ys(e.showcase_overrides.design))}async function $s(e){const t=e.filter(o=>o.type==="custom");await Promise.all(t.map(o=>he(o)))}const vi=new Map([["catalog","product-details"],["product","storefront-product"],["category","storefront-category"]]);async function $e(e){try{return await q(f(process.cwd(),e))}catch{throw new Error(`Template file [${e}] is either invalid or undefined`)}}async function Di(e){const t=await p(`${S}/js/**.mjs`,{ignore:[`${S}/js/**${C}.mjs`]});return Promise.all(t.map(async o=>{const s=await $e(o);return await $s(s.sections),{id:`${e}_${F(o).name}`,descriptor:s}}))}function Ai(e){return e in oe?oe[e]:oe.CUSTOM}function Ii(e){return e.map(t=>({...t,id:vi.get(t.id)??t.id}))}async function Ci(e){const t=await p(`${S}/${e}/*.mjs`,{ignore:[`${S}/${e}/configuration*.mjs`]});return Promise.all(t.map(async o=>{const{sections:s}=await $e(o),n=tn(o);return await $s(s),{sections:Ii(s),id:n,type:Ai(n.toUpperCase())}}))}async function Pi(e){const t=await p(`${S}/**/configuration*.mjs`,{});return Promise.all(t.map(async o=>{const s=await $e(o);await he(s.header),await he(s.footer);const n=g.basename(g.dirname(o)),r=await Ci(n);return{id:`${e}_${n}`,descriptor:{...s,pages:r}}}))}async function Ni(e){return[...await Di(e),...await Pi(e)]}async function bs(e){await new Promise(t=>setTimeout(t,e))}function Li(e){const[t,o]=e.split(x),s=lr(t);return{id:o,sectionId:t,pageId:s}}function xi(e){return e.split(x).length===2}async function ki(){return(await p("*/*",{cwd:f(process.cwd(),ne)})).filter(xi).map(Li)}const Fi={value:0},O=Zr();let Es=Date.now();const Ts=e=>2**e*500;async function Ri(){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 Gi(e){return typeof e=="object"&&e!==null&&"version"in e&&typeof e.version=="string"}async function Mi(){const e=f(A.cwd(),"package.json"),t=await Ae(e),o=JSON.parse(t.toString());if(Gi(o))return o;throw new Error(`Package file located at path: ${e} does not contain a version field`)}async function Bi(e){const t=Ks(e.version,"patch");if(t===null)throw Error("Error while incrementing app version");e.version=t,Ls(f(A.cwd(),"package.json"),`${JSON.stringify(e,null,2)}
3
+ `)}function be({deploymentContext:e,sectionType:t="SECTION"}){const o=e.pathContext,s=o.toPath({id:e.currentSection,sectionType:t,layoutId:e.layoutId}),n=s===void 0?Oe(o.fileName):Oe(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 qi(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<ar&&qi(t)}function ws(e,t,o,s){const n={value:0},r=e.config.app.templates.length>0?sr:or;return e.config.axios.post(r,{file:xs(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=>Wr(i,O,Fi,n,Es)}).then(i=>(O.increment(),i)).catch(async i=>{if(js(s,i))return await bs(Ts(s)),ws(e,t,o,s+1);throw O.increment(),i})}function Ui(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 ws(o,t.url,s,0)})}function zi(e){const t=e.app.sections.flatMap(n=>cr.flatMap(r=>{const i={config:e,currentSection:n.id,pathContext:K[r]};return be({deploymentContext:i,sectionType:n.type})})),o=pr.flatMap(n=>{const r={config:e,pathContext:K[n]};return be({deploymentContext:r,sectionType:"SECTION"})}),s=e.app.layouts.flatMap(n=>{const r={config:e,pathContext:K[u.Layout],currentSection:n.sectionId,layoutId:n.id};return be({deploymentContext:r})});return Ui([...t,...o,...s])}function Xi(e){return e.includes(`
4
+ `)}function Hi(e,t,o){return e.split(`
5
+ `).map((s,n)=>n>=o?t+s:s).join(`
6
+ `)}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=Xi(r.errorMessage)?Hi(r.errorMessage," ",1):r.errorMessage;o.push(` Error Message: ${i}`)}}const s=o.length>0?o.join(`
7
+ `):e?.message??"Unknown error";if(!t||t.length===0)return s;const n=o.length>0?`
8
+ `:" ";return`${t}${n}${s}`}async function Os(e,t=0){const o=e.app.templates.length>0?rr:nr;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 bs(Ts(t)),Os(e,t+1);throw s})}async function Vi(e){try{if(!w(f(A.cwd(),E)))throw new Error(B.DISTRIBUTION_FOLDER_NOT_FOUND(E));const t=e??tr;a.info("Custom application deployment :: Started");const o=Vs.create({baseURL:t});Ys(o,ir),a.info("Loading configuration files ...");const s=await Promise.all([Ri(),Mi(),Si(),ki()]).then(async([i,c,l,d])=>({axios:o,app:{crane:i,packageJson:c,sections:l,layouts:d,templates:await Ni(i.appClientId)}}));a.info("Uploading files ..."),Es=Date.now(),await Promise.all(zi(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 Os(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 Bi(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 Ki="1.2.3";async function Yi(e){ae(),re("template/headers/example-header","headers",e,"Header")}async function Ji(e){ae(),re("template/footers/example-footer","footers",e,"Footer")}const Wi={deploy:["url"],init:["customStorefrontPages"],build:["generatePreview"]};function Zi(e,t){return e.options.length!==0&&Object.keys(t).length===1}function Qi(e){return e.includes("-h")||e.includes("--help")}function ea(e,t){return Object.keys(t).some(o=>o!=="--"&&!e.hasOption(o)&&!Wi[e.rawName]?.includes(o))}function ta(e){return e.length!==0}function oa(e,t,o){return e.matchedCommand!==void 0&&(Zi(e.matchedCommand,o)||Qi(e.rawArgs)||ea(e.matchedCommand,e.options)||ta(t))}function sa(e,t,o){e.matchedCommand&&!oa(e,t,o)?e.runMatchedCommand():e.outputHelp()}function _s(e){if(en(e))return console.log("Please specify a name for your resource."),!1;const{isValid:t,errorMessage:o}=Qs(e);return o&&console.log(o),t}async function Ss(e,t,o,s,n){const r=(await Ee({type:"text",name:"name",message:`Please specify a name for your ${t}:`})).name;if(r===void 0)return console.log(`You can use ${o} to directly specify the name of the ${t}.`),e.outputHelp();const i=g.basename(r);return _s(i)?s(i,n):Ss(e,t,o,s,n)}async function Z(e,t,o,s,n,r){if(n!==void 0)if(!_s(n))await Ss(e,t,o,s);else{const i=g.basename(n.toString());await s(i,r)}}async function na(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>"),dn,o),await Z(t,"section",R("init --section <name>"),un,s),await Z(t,"header",R("init --header <name>"),Yi,n),await Z(t,"footer",R("init --footer <name>"),Ji,r),await Z(t,"template",R("init --template <name>"),mn,i,d),l&&await yn()}catch(o){a.error(`Error while executing init operation: ${o.message}`),process.exit(1)}}function ra(){try{const e=As("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(()=>Yr(e.options.generatePreview)),e.command("deploy","Deploys your resource code").allowUnknownOptions().action(()=>Vi(e.options.url)),e.version(Ki),e.usage("<action> <resource>");const t=e.parse(process.argv,{run:!1});sa(e,t.args,t.options)}catch(e){a.error(`Error while parsing input: ${e.message}`),process.exit(1)}}export{ra as run};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightspeed/crane",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "type": "module",
5
5
  "bin": "bin/crane.js",
6
6
  "main": "./dist/app.mjs",
@@ -26,36 +26,43 @@
26
26
  "scripts": {
27
27
  "dev": "unbuild --stub",
28
28
  "build": "unbuild",
29
- "lint": "eslint \"./{src,test}/**/*.{js,ts}\"",
29
+ "type-check": "tsc --noEmit",
30
+ "lint": "eslint \"./{src,tests}/**/*.{js,ts}\"",
31
+ "lint:all": "yarn lint && yarn type-check",
30
32
  "test": "jest"
31
33
  },
32
34
  "engines": {
33
- "node": ">=22"
35
+ "node": "22"
34
36
  },
35
37
  "license": "MIT",
36
38
  "devDependencies": {
37
39
  "@jest/globals": "^29.7.0",
40
+ "@stylistic/eslint-plugin": "^4.2.0",
38
41
  "@types/adm-zip": "^0.5.7",
39
42
  "@types/axios-concurrency": "^1.0.0",
43
+ "@types/cli-progress": "^3.11.6",
40
44
  "@types/express-fileupload": "^1.5.0",
41
45
  "@types/fs-extra": "^11.0.1",
42
46
  "@types/jest": "^29.5.12",
47
+ "@types/mock-fs": "^4.13.4",
43
48
  "@types/node": "^20.4.5",
44
49
  "@types/semver": "^7.5.8",
50
+ "@types/tinycolor2": "^1.4.6",
45
51
  "dir-compare": "^5.0.0",
46
52
  "express": "^4.19.2",
47
53
  "express-fileupload": "^1.5.1",
48
54
  "jest": "^29.7.0",
55
+ "mock-fs": "^5.5.0",
49
56
  "ts-jest": "^29.1.5",
50
57
  "ts-node": "^10.9.2",
51
58
  "typescript": "5.4.5",
52
- "unbuild": "^2.0.0",
59
+ "unbuild": "^3.5.0",
53
60
  "vite-plugin-dts": "^3.4.0",
54
- "vite-plugin-static-copy": "^0.17.0"
61
+ "vite-plugin-static-copy": "^3.0.0"
55
62
  },
56
63
  "dependencies": {
57
64
  "@jridgewell/sourcemap-codec": "^1.4.15",
58
- "@lightspeed/eslint-config-crane": "1.1.0",
65
+ "@lightspeed/eslint-config-crane": "1.1.1",
59
66
  "@types/prompts": "^2.4.2",
60
67
  "@vitejs/plugin-vue": "^4.1.0",
61
68
  "adm-zip": "^0.5.16",
@@ -0,0 +1,10 @@
1
+ <template>
2
+ <div>
3
+ <slot :name="Slot.PRODUCT_LIST" />
4
+ <slot :name="Slot.BOTTOM_BAR" />
5
+ </div>
6
+ </template>
7
+
8
+ <script setup lang="ts">
9
+ import { CatalogLayoutSlot as Slot } from '@lightspeed/crane';
10
+ </script>
@@ -0,0 +1,11 @@
1
+ <template>
2
+ <div>
3
+ <slot :name="Slot.CATEGORY_TITLE" />
4
+ <slot :name="Slot.PRODUCT_LIST" />
5
+ <slot :name="Slot.BOTTOM_BAR" />
6
+ </div>
7
+ </template>
8
+
9
+ <script setup lang="ts">
10
+ import { CategoryLayoutSlot as Slot } from '@lightspeed/crane';
11
+ </script>
@@ -0,0 +1,35 @@
1
+ <template>
2
+ <div :class="{ 'product-details--top-title-navigation': isProductNameAlwaysFirstOnMobile }">
3
+ <slot :name="Slot.TOP_BAR" />
4
+ <div
5
+ :class="availableProductClasses"
6
+ itemtype="http://schema.org/Product"
7
+ :itemscope="showProductDetailsProductPrice"
8
+ >
9
+ <slot :name="Slot.GALLERY" />
10
+ <slot :name="Slot.SIDEBAR" />
11
+ <slot :name="Slot.DESCRIPTION" />
12
+ <div class="clearboth" />
13
+ </div>
14
+ <slot :name="Slot.REVIEW_LIST" />
15
+ <slot :name="Slot.RELATED_PRODUCTS" />
16
+ <slot :name="Slot.BOTTOM_BAR" />
17
+ </div>
18
+ </template>
19
+
20
+ <script setup lang="ts">
21
+ import { HTMLAttributes } from 'vue';
22
+ import { ProductLayoutSlot as Slot } from '@lightspeed/crane';
23
+
24
+ interface Props {
25
+ availableProductClasses?: HTMLAttributes['class'],
26
+ showProductDetailsProductPrice?: boolean,
27
+ isProductNameAlwaysFirstOnMobile?: boolean,
28
+ }
29
+
30
+ withDefaults(defineProps<Props>(), {
31
+ isProductNameAlwaysFirstOnMobile: false,
32
+ availableProductClasses: '',
33
+ showProductDetailsProductPrice: true,
34
+ });
35
+ </script>
@@ -2,7 +2,8 @@ export default {
2
2
  sections: [
3
3
  {
4
4
  type: 'default',
5
- id: 'product-browser',
5
+ id: 'catalog',
6
+ layout_id: 'example-catalog',
6
7
  },
7
8
  ],
8
9
  };
@@ -2,7 +2,8 @@ export default {
2
2
  sections: [
3
3
  {
4
4
  type: 'default',
5
- id: 'product-browser',
5
+ id: 'category',
6
+ layout_id: 'example-category',
6
7
  },
7
8
  ],
8
9
  };
@@ -2,7 +2,8 @@ export default {
2
2
  sections: [
3
3
  {
4
4
  type: 'default',
5
- id: 'product-browser',
5
+ id: 'product',
6
+ layout_id: 'example-product',
6
7
  },
7
8
  ],
8
9
  };
package/types.d.ts CHANGED
@@ -9,13 +9,13 @@ declare module '*.vue' {
9
9
 
10
10
  type ActionLinkType
11
11
  = 'SCROLL_TO_TILE'
12
- | 'HYPER_LINK'
13
- | 'MAIL_LINK'
14
- | 'TEL_LINK'
15
- | 'GO_TO_STORE'
16
- | 'GO_TO_STORE_LINK'
17
- | 'GO_TO_PAGE'
18
- | 'GO_TO_CATEGORY';
12
+ | 'HYPER_LINK'
13
+ | 'MAIL_LINK'
14
+ | 'TEL_LINK'
15
+ | 'GO_TO_STORE'
16
+ | 'GO_TO_STORE_LINK'
17
+ | 'GO_TO_PAGE'
18
+ | 'GO_TO_CATEGORY';
19
19
 
20
20
  interface ButtonContentData {
21
21
  readonly title: string;
@@ -78,7 +78,7 @@ type LogoType = 'TEXT' | 'IMAGE';
78
78
  interface LogoContentData {
79
79
  readonly type: LogoType;
80
80
  readonly text: string;
81
- readonly image: ImageContentData
81
+ readonly image: ImageContentData;
82
82
  }
83
83
 
84
84
  type GlobalColorsString =
@@ -382,7 +382,7 @@ type ContentEditor =
382
382
 
383
383
  type InferContentType<T extends Record<string, ContentEditor>> = {
384
384
  readonly [P in keyof T]: MapEditorContentTypes[T[P]['type']]
385
- }
385
+ };
386
386
 
387
387
  type MapEditorDesignTypes = {
388
388
  readonly TEXT: string;
@@ -444,8 +444,8 @@ interface LogoDesignEditor {
444
444
  }
445
445
 
446
446
  interface DividerDesignEditor {
447
- readonly type: 'DIVIDER';
448
- readonly label: string | Record<string, string>;
447
+ readonly type: 'DIVIDER';
448
+ readonly label: string | Record<string, string>;
449
449
  }
450
450
 
451
451
  type DesignEditor =
@@ -461,6 +461,6 @@ type DesignEditor =
461
461
 
462
462
  type InferDesignType<T extends Record<string, DesignEditor>> = {
463
463
  readonly [P in keyof T]: MapEditorDesignTypes[T[P]['type']]
464
- }
464
+ };
465
465
 
466
466
  type SettingsEditor = DesignEditor | ContentEditor;