@lightspeed/crane 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.d.mts +76 -8
- package/dist/app.d.ts +76 -8
- package/dist/app.mjs +1 -1
- package/dist/cli.mjs +10 -23
- package/package.json +6 -5
- package/template/footers/example-footer/ExampleFooter.vue +12 -2
- package/template/footers/example-footer/assets/cart.svg +19 -0
- package/template/footers/example-footer/component/LegalLinks.vue +20 -0
- package/template/footers/example-footer/component/MadeWith.vue +23 -0
- package/template/footers/example-footer/component/ReportAbuse.vue +4 -3
- package/template/footers/example-footer/showcases/1.ts +1 -1
- package/template/headers/example-header/ExampleHeader.vue +38 -4
- package/template/headers/example-header/assets/account_icon.svg +11 -0
- package/template/headers/example-header/assets/lightspeed_logo.png +0 -0
- package/template/headers/example-header/component/Account.vue +20 -0
- package/template/headers/example-header/component/Cart.vue +14 -33
- package/template/headers/example-header/component/Logo.vue +95 -0
- package/template/headers/example-header/component/NavigationMenu.vue +53 -0
- package/template/headers/example-header/settings/translations.ts +6 -2
- package/template/headers/example-header/showcases/1.ts +32 -3
- package/template/headers/example-header/showcases/2.ts +42 -0
- package/template/headers/example-header/showcases/translations.ts +14 -2
- package/template/package.json +1 -1
- package/template/reference/sections/about-us/AboutUs.vue +73 -0
- package/template/reference/sections/about-us/assets/our_company_in_numbers.jpg +0 -0
- package/template/reference/sections/about-us/assets/our_company_in_numbers_preview.jpg +0 -0
- package/template/reference/sections/about-us/assets/our_team.jpg +0 -0
- package/template/reference/sections/about-us/assets/our_team_preview.jpg +0 -0
- package/template/reference/sections/about-us/client.ts +6 -0
- package/template/reference/sections/about-us/component/Image.vue +94 -0
- package/template/reference/sections/about-us/component/Stats.vue +155 -0
- package/template/reference/sections/about-us/component/Title.vue +32 -0
- package/template/reference/sections/about-us/server.ts +6 -0
- package/template/reference/sections/about-us/settings/content.ts +64 -0
- package/template/reference/sections/about-us/settings/design.ts +74 -0
- package/template/reference/sections/about-us/settings/layout.ts +12 -0
- package/template/reference/sections/about-us/settings/translations.ts +151 -0
- package/template/reference/sections/about-us/showcases/1.ts +176 -0
- package/template/reference/sections/about-us/showcases/2.ts +160 -0
- package/template/reference/sections/about-us/showcases/translations.ts +259 -0
- package/template/reference/sections/about-us/type.ts +5 -0
- package/template/reference/sections/about-us/util/visibility-provider.ts +27 -0
- package/template/reference/sections/intro-slider/IntroSlider.vue +77 -0
- package/template/reference/sections/intro-slider/assets/bike_1.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_1@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_2.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_2@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_3.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_3@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_4.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_4@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_5.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_5@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_6.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/bike_6@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_1.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_1@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_2.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_2@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_3.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_3@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_5.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_5@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_6.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/category_6@2x.jpg +0 -0
- package/template/reference/sections/intro-slider/assets/custom_section_showcase_1_preview.png +0 -0
- package/template/reference/sections/intro-slider/assets/custom_section_showcase_2_preview.png +0 -0
- package/template/reference/sections/intro-slider/client.ts +5 -0
- package/template/reference/sections/intro-slider/component/Slider.vue +235 -0
- package/template/reference/sections/intro-slider/component/Title.vue +106 -0
- package/template/reference/sections/intro-slider/entity/color.ts +4 -0
- package/template/reference/sections/intro-slider/server.ts +5 -0
- package/template/reference/sections/intro-slider/settings/content.ts +43 -0
- package/template/reference/sections/intro-slider/settings/design.ts +88 -0
- package/template/reference/sections/intro-slider/settings/layout.ts +12 -0
- package/template/reference/sections/intro-slider/settings/translations.ts +53 -0
- package/template/reference/sections/intro-slider/showcases/1.ts +274 -0
- package/template/reference/sections/intro-slider/showcases/2.ts +270 -0
- package/template/reference/sections/intro-slider/showcases/translations.ts +88 -0
- package/template/reference/sections/intro-slider/type.ts +5 -0
- package/template/reference/sections/tag-lines/TagLines.vue +158 -0
- package/template/reference/sections/tag-lines/assets/explore_our_holiday_gift_guide.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/fall_is_here.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/fall_is_here_preview.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/folding_bikes.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/hybrid_bikes.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/mountain_and_road_bikes.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/shop_chelsea_boots.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/sweater_weather.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/what_we_sell.jpg +0 -0
- package/template/reference/sections/tag-lines/assets/what_we_sell_preview.jpg +0 -0
- package/template/reference/sections/tag-lines/client.ts +5 -0
- package/template/reference/sections/tag-lines/component/HighlightedText.vue +50 -0
- package/template/reference/sections/tag-lines/component/SectionImage.vue +78 -0
- package/template/reference/sections/tag-lines/component/Title.vue +51 -0
- package/template/reference/sections/tag-lines/composables/highlighted-text-image-list.ts +34 -0
- package/template/reference/sections/tag-lines/server.ts +5 -0
- package/template/reference/sections/tag-lines/settings/content.ts +37 -0
- package/template/reference/sections/tag-lines/settings/design.ts +81 -0
- package/template/reference/sections/tag-lines/settings/layout.ts +12 -0
- package/template/reference/sections/tag-lines/settings/translations.ts +61 -0
- package/template/reference/sections/tag-lines/showcases/1.ts +190 -0
- package/template/reference/sections/tag-lines/showcases/2.ts +190 -0
- package/template/reference/sections/tag-lines/showcases/translations.ts +49 -0
- package/template/reference/sections/tag-lines/type.ts +5 -0
- package/template/reference/shared/components/Button.vue +151 -0
- package/template/reference/shared/components/SectionWrapper.vue +26 -0
- package/template/reference/shared/components/Tagline.vue +45 -0
- package/template/reference/shared/utils/color.ts +16 -0
- package/template/reference/shared/utils/styles.ts +12 -0
- package/template/reference/templates/assets/reference_template_apparel_cover_image.jpg +0 -0
- package/template/reference/templates/assets/reference_template_bike_cover_image.jpg +0 -0
- package/template/reference/templates/reference-template-apparel.ts +44 -0
- package/template/reference/templates/reference-template-bike.ts +44 -0
- package/template/sections/example-section/ExampleSection.vue +8 -19
- package/template/sections/example-section/assets/bike_accessories_high.jpg +0 -0
- package/template/sections/example-section/assets/bike_accessories_low.jpg +0 -0
- package/template/sections/example-section/assets/bike_new_arrivals_high.jpg +0 -0
- package/template/sections/example-section/assets/bike_new_arrivals_low.jpg +0 -0
- package/template/sections/example-section/assets/custom_section_showcase_3_preview.jpg +0 -0
- package/template/sections/example-section/assets/fixed_gears_high.jpg +0 -0
- package/template/sections/example-section/assets/fixed_gears_low.jpg +0 -0
- package/template/sections/example-section/assets/repair_service_high.jpg +0 -0
- package/template/sections/example-section/assets/repair_service_low.jpg +0 -0
- package/template/sections/example-section/settings/translations.ts +39 -7
- package/template/sections/example-section/showcases/3.ts +198 -0
- package/template/sections/example-section/showcases/translations.ts +49 -1
- package/template/shared/components/LanguageSelector.vue +75 -0
- package/template/shared/components/SectionWrapper.vue +26 -0
- package/template/templates/template.ts +28 -43
- package/types.d.ts +264 -141
- package/template/headers/example-header/component/SampleComponent.vue +0 -11
package/dist/cli.mjs
CHANGED
|
@@ -1,23 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
`),b.info(`App ${e} created`)}catch(t){b.error(`Error while creating app: ${t.message}`),M.exit(1)}}async function nt(e){try{const t=e,s=M.cwd(),r=F.join(s,"sections",t);S.existsSync(r)?(b.error(`Section with the name: ${e} already exists. If you'd like to override it, delete previous version first`),M.exit(1)):S.mkdirSync(r);const n=F.resolve(J(import.meta.url),"../..","template/sections/example-section");S.readdirSync(n).forEach(async o=>oe(r,n,o)),b.info(`Section ${e} created`)}catch(t){b.error(`Error while creating section: ${t.message}`),M.exit(1)}}async function st(e,t=!1){try{const s=M.cwd(),r=F.join(s,"templates"),n={"template.ts":`${e}.ts`};S.existsSync(r)?S.existsSync(F.join(r,`${e}.ts`))&&(b.error(`Template with the name: ${e} already exists. If you'd like to override it, delete previous version first`),M.exit(1)):S.mkdirSync(r);const o=F.resolve(J(import.meta.url),"../..","template/templates");if(S.readdirSync(o).forEach(async i=>oe(r,o,i,n)),t){const i={headers:F.resolve(J(import.meta.url),"../..","template/headers"),footers:F.resolve(J(import.meta.url),"../..","template/footers")};["headers","footers"].forEach(c=>{const a=F.join(s,c);if(!S.existsSync(a)){S.mkdirSync(a);const u=i[c];S.readdirSync(u).forEach(async p=>oe(a,u,p))}})}b.info(`Template descriptor file [${e}.ts] has been created`)}catch(s){b.error(`Error while creating template descriptors: ${s.message}`),M.exit(1)}}var j=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.SectionSetting=2]="SectionSetting",e[e.SectionShowcase=3]="SectionShowcase",e[e.SectionAsset=4]="SectionAsset",e[e.TemplateDescriptor=5]="TemplateDescriptor",e[e.TemplateAsset=6]="TemplateAsset",e))(j||{}),_=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.Misc=2]="Misc",e))(_||{});function ot(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ce={exports:{}},Ee,rt;function Pn(){return rt||(rt=1,Ee={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}),Ee}var we,it;function at(){if(it)return we;it=1;const e=Pn(),t={};for(const n of Object.keys(e))t[e[n]]=n;const s={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};we=s;for(const n of Object.keys(s)){if(!("channels"in s[n]))throw new Error("missing channels property: "+n);if(!("labels"in s[n]))throw new Error("missing channel labels property: "+n);if(s[n].labels.length!==s[n].channels)throw new Error("channel and label counts mismatch: "+n);const{channels:o,labels:i}=s[n];delete s[n].channels,delete s[n].labels,Object.defineProperty(s[n],"channels",{value:o}),Object.defineProperty(s[n],"labels",{value:i})}s.rgb.hsl=function(n){const o=n[0]/255,i=n[1]/255,c=n[2]/255,a=Math.min(o,i,c),u=Math.max(o,i,c),p=u-a;let l,f;u===a?l=0:o===u?l=(i-c)/p:i===u?l=2+(c-o)/p:c===u&&(l=4+(o-i)/p),l=Math.min(l*60,360),l<0&&(l+=360);const d=(a+u)/2;return u===a?f=0:d<=.5?f=p/(u+a):f=p/(2-u-a),[l,f*100,d*100]},s.rgb.hsv=function(n){let o,i,c,a,u;const p=n[0]/255,l=n[1]/255,f=n[2]/255,d=Math.max(p,l,f),m=d-Math.min(p,l,f),h=function(g){return(d-g)/6/m+1/2};return m===0?(a=0,u=0):(u=m/d,o=h(p),i=h(l),c=h(f),p===d?a=c-i:l===d?a=1/3+o-c:f===d&&(a=2/3+i-o),a<0?a+=1:a>1&&(a-=1)),[a*360,u*100,d*100]},s.rgb.hwb=function(n){const o=n[0],i=n[1];let c=n[2];const a=s.rgb.hsl(n)[0],u=1/255*Math.min(o,Math.min(i,c));return c=1-1/255*Math.max(o,Math.max(i,c)),[a,u*100,c*100]},s.rgb.cmyk=function(n){const o=n[0]/255,i=n[1]/255,c=n[2]/255,a=Math.min(1-o,1-i,1-c),u=(1-o-a)/(1-a)||0,p=(1-i-a)/(1-a)||0,l=(1-c-a)/(1-a)||0;return[u*100,p*100,l*100,a*100]};function r(n,o){return(n[0]-o[0])**2+(n[1]-o[1])**2+(n[2]-o[2])**2}return s.rgb.keyword=function(n){const o=t[n];if(o)return o;let i=1/0,c;for(const a of Object.keys(e)){const u=e[a],p=r(n,u);p<i&&(i=p,c=a)}return c},s.keyword.rgb=function(n){return e[n]},s.rgb.xyz=function(n){let o=n[0]/255,i=n[1]/255,c=n[2]/255;o=o>.04045?((o+.055)/1.055)**2.4:o/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92,c=c>.04045?((c+.055)/1.055)**2.4:c/12.92;const a=o*.4124+i*.3576+c*.1805,u=o*.2126+i*.7152+c*.0722,p=o*.0193+i*.1192+c*.9505;return[a*100,u*100,p*100]},s.rgb.lab=function(n){const o=s.rgb.xyz(n);let i=o[0],c=o[1],a=o[2];i/=95.047,c/=100,a/=108.883,i=i>.008856?i**(1/3):7.787*i+16/116,c=c>.008856?c**(1/3):7.787*c+16/116,a=a>.008856?a**(1/3):7.787*a+16/116;const u=116*c-16,p=500*(i-c),l=200*(c-a);return[u,p,l]},s.hsl.rgb=function(n){const o=n[0]/360,i=n[1]/100,c=n[2]/100;let a,u,p;if(i===0)return p=c*255,[p,p,p];c<.5?a=c*(1+i):a=c+i-c*i;const l=2*c-a,f=[0,0,0];for(let d=0;d<3;d++)u=o+1/3*-(d-1),u<0&&u++,u>1&&u--,6*u<1?p=l+(a-l)*6*u:2*u<1?p=a:3*u<2?p=l+(a-l)*(2/3-u)*6:p=l,f[d]=p*255;return f},s.hsl.hsv=function(n){const o=n[0];let i=n[1]/100,c=n[2]/100,a=i;const u=Math.max(c,.01);c*=2,i*=c<=1?c:2-c,a*=u<=1?u:2-u;const p=(c+i)/2,l=c===0?2*a/(u+a):2*i/(c+i);return[o,l*100,p*100]},s.hsv.rgb=function(n){const o=n[0]/60,i=n[1]/100;let c=n[2]/100;const a=Math.floor(o)%6,u=o-Math.floor(o),p=255*c*(1-i),l=255*c*(1-i*u),f=255*c*(1-i*(1-u));switch(c*=255,a){case 0:return[c,f,p];case 1:return[l,c,p];case 2:return[p,c,f];case 3:return[p,l,c];case 4:return[f,p,c];case 5:return[c,p,l]}},s.hsv.hsl=function(n){const o=n[0],i=n[1]/100,c=n[2]/100,a=Math.max(c,.01);let u,p;p=(2-i)*c;const l=(2-i)*a;return u=i*a,u/=l<=1?l:2-l,u=u||0,p/=2,[o,u*100,p*100]},s.hwb.rgb=function(n){const o=n[0]/360;let i=n[1]/100,c=n[2]/100;const a=i+c;let u;a>1&&(i/=a,c/=a);const p=Math.floor(6*o),l=1-c;u=6*o-p,p&1&&(u=1-u);const f=i+u*(l-i);let d,m,h;switch(p){default:case 6:case 0:d=l,m=f,h=i;break;case 1:d=f,m=l,h=i;break;case 2:d=i,m=l,h=f;break;case 3:d=i,m=f,h=l;break;case 4:d=f,m=i,h=l;break;case 5:d=l,m=i,h=f;break}return[d*255,m*255,h*255]},s.cmyk.rgb=function(n){const o=n[0]/100,i=n[1]/100,c=n[2]/100,a=n[3]/100,u=1-Math.min(1,o*(1-a)+a),p=1-Math.min(1,i*(1-a)+a),l=1-Math.min(1,c*(1-a)+a);return[u*255,p*255,l*255]},s.xyz.rgb=function(n){const o=n[0]/100,i=n[1]/100,c=n[2]/100;let a,u,p;return a=o*3.2406+i*-1.5372+c*-.4986,u=o*-.9689+i*1.8758+c*.0415,p=o*.0557+i*-.204+c*1.057,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,u=u>.0031308?1.055*u**(1/2.4)-.055:u*12.92,p=p>.0031308?1.055*p**(1/2.4)-.055:p*12.92,a=Math.min(Math.max(0,a),1),u=Math.min(Math.max(0,u),1),p=Math.min(Math.max(0,p),1),[a*255,u*255,p*255]},s.xyz.lab=function(n){let o=n[0],i=n[1],c=n[2];o/=95.047,i/=100,c/=108.883,o=o>.008856?o**(1/3):7.787*o+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,c=c>.008856?c**(1/3):7.787*c+16/116;const a=116*i-16,u=500*(o-i),p=200*(i-c);return[a,u,p]},s.lab.xyz=function(n){const o=n[0],i=n[1],c=n[2];let a,u,p;u=(o+16)/116,a=i/500+u,p=u-c/200;const l=u**3,f=a**3,d=p**3;return u=l>.008856?l:(u-16/116)/7.787,a=f>.008856?f:(a-16/116)/7.787,p=d>.008856?d:(p-16/116)/7.787,a*=95.047,u*=100,p*=108.883,[a,u,p]},s.lab.lch=function(n){const o=n[0],i=n[1],c=n[2];let a;a=Math.atan2(c,i)*360/2/Math.PI,a<0&&(a+=360);const p=Math.sqrt(i*i+c*c);return[o,p,a]},s.lch.lab=function(n){const o=n[0],i=n[1],a=n[2]/360*2*Math.PI,u=i*Math.cos(a),p=i*Math.sin(a);return[o,u,p]},s.rgb.ansi16=function(n,o=null){const[i,c,a]=n;let u=o===null?s.rgb.hsv(n)[2]:o;if(u=Math.round(u/50),u===0)return 30;let p=30+(Math.round(a/255)<<2|Math.round(c/255)<<1|Math.round(i/255));return u===2&&(p+=60),p},s.hsv.ansi16=function(n){return s.rgb.ansi16(s.hsv.rgb(n),n[2])},s.rgb.ansi256=function(n){const o=n[0],i=n[1],c=n[2];return o===i&&i===c?o<8?16:o>248?231:Math.round((o-8)/247*24)+232:16+36*Math.round(o/255*5)+6*Math.round(i/255*5)+Math.round(c/255*5)},s.ansi16.rgb=function(n){let o=n%10;if(o===0||o===7)return n>50&&(o+=3.5),o=o/10.5*255,[o,o,o];const i=(~~(n>50)+1)*.5,c=(o&1)*i*255,a=(o>>1&1)*i*255,u=(o>>2&1)*i*255;return[c,a,u]},s.ansi256.rgb=function(n){if(n>=232){const u=(n-232)*10+8;return[u,u,u]}n-=16;let o;const i=Math.floor(n/36)/5*255,c=Math.floor((o=n%36)/6)/5*255,a=o%6/5*255;return[i,c,a]},s.rgb.hex=function(n){const i=(((Math.round(n[0])&255)<<16)+((Math.round(n[1])&255)<<8)+(Math.round(n[2])&255)).toString(16).toUpperCase();return"000000".substring(i.length)+i},s.hex.rgb=function(n){const o=n.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!o)return[0,0,0];let i=o[0];o[0].length===3&&(i=i.split("").map(l=>l+l).join(""));const c=parseInt(i,16),a=c>>16&255,u=c>>8&255,p=c&255;return[a,u,p]},s.rgb.hcg=function(n){const o=n[0]/255,i=n[1]/255,c=n[2]/255,a=Math.max(Math.max(o,i),c),u=Math.min(Math.min(o,i),c),p=a-u;let l,f;return p<1?l=u/(1-p):l=0,p<=0?f=0:a===o?f=(i-c)/p%6:a===i?f=2+(c-o)/p:f=4+(o-i)/p,f/=6,f%=1,[f*360,p*100,l*100]},s.hsl.hcg=function(n){const o=n[1]/100,i=n[2]/100,c=i<.5?2*o*i:2*o*(1-i);let a=0;return c<1&&(a=(i-.5*c)/(1-c)),[n[0],c*100,a*100]},s.hsv.hcg=function(n){const o=n[1]/100,i=n[2]/100,c=o*i;let a=0;return c<1&&(a=(i-c)/(1-c)),[n[0],c*100,a*100]},s.hcg.rgb=function(n){const o=n[0]/360,i=n[1]/100,c=n[2]/100;if(i===0)return[c*255,c*255,c*255];const a=[0,0,0],u=o%1*6,p=u%1,l=1-p;let f=0;switch(Math.floor(u)){case 0:a[0]=1,a[1]=p,a[2]=0;break;case 1:a[0]=l,a[1]=1,a[2]=0;break;case 2:a[0]=0,a[1]=1,a[2]=p;break;case 3:a[0]=0,a[1]=l,a[2]=1;break;case 4:a[0]=p,a[1]=0,a[2]=1;break;default:a[0]=1,a[1]=0,a[2]=l}return f=(1-i)*c,[(i*a[0]+f)*255,(i*a[1]+f)*255,(i*a[2]+f)*255]},s.hcg.hsv=function(n){const o=n[1]/100,i=n[2]/100,c=o+i*(1-o);let a=0;return c>0&&(a=o/c),[n[0],a*100,c*100]},s.hcg.hsl=function(n){const o=n[1]/100,c=n[2]/100*(1-o)+.5*o;let a=0;return c>0&&c<.5?a=o/(2*c):c>=.5&&c<1&&(a=o/(2*(1-c))),[n[0],a*100,c*100]},s.hcg.hwb=function(n){const o=n[1]/100,i=n[2]/100,c=o+i*(1-o);return[n[0],(c-o)*100,(1-c)*100]},s.hwb.hcg=function(n){const o=n[1]/100,c=1-n[2]/100,a=c-o;let u=0;return a<1&&(u=(c-a)/(1-a)),[n[0],a*100,u*100]},s.apple.rgb=function(n){return[n[0]/65535*255,n[1]/65535*255,n[2]/65535*255]},s.rgb.apple=function(n){return[n[0]/255*65535,n[1]/255*65535,n[2]/255*65535]},s.gray.rgb=function(n){return[n[0]/100*255,n[0]/100*255,n[0]/100*255]},s.gray.hsl=function(n){return[0,0,n[0]]},s.gray.hsv=s.gray.hsl,s.gray.hwb=function(n){return[0,100,n[0]]},s.gray.cmyk=function(n){return[0,0,0,n[0]]},s.gray.lab=function(n){return[n[0],0,0]},s.gray.hex=function(n){const o=Math.round(n[0]/100*255)&255,c=((o<<16)+(o<<8)+o).toString(16).toUpperCase();return"000000".substring(c.length)+c},s.rgb.gray=function(n){return[(n[0]+n[1]+n[2])/3/255*100]},we}var $e,ct;function Gn(){if(ct)return $e;ct=1;const e=at();function t(){const o={},i=Object.keys(e);for(let c=i.length,a=0;a<c;a++)o[i[a]]={distance:-1,parent:null};return o}function s(o){const i=t(),c=[o];for(i[o].distance=0;c.length;){const a=c.pop(),u=Object.keys(e[a]);for(let p=u.length,l=0;l<p;l++){const f=u[l],d=i[f];d.distance===-1&&(d.distance=i[a].distance+1,d.parent=a,c.unshift(f))}}return i}function r(o,i){return function(c){return i(o(c))}}function n(o,i){const c=[i[o].parent,o];let a=e[i[o].parent][o],u=i[o].parent;for(;i[u].parent;)c.unshift(i[u].parent),a=r(e[i[u].parent][u],a),u=i[u].parent;return a.conversion=c,a}return $e=function(o){const i=s(o),c={},a=Object.keys(i);for(let u=a.length,p=0;p<u;p++){const l=a[p];i[l].parent!==null&&(c[l]=n(l,i))}return c},$e}var ve,lt;function Un(){if(lt)return ve;lt=1;const e=at(),t=Gn(),s={},r=Object.keys(e);function n(i){const c=function(...a){const u=a[0];return u==null?u:(u.length>1&&(a=u),i(a))};return"conversion"in i&&(c.conversion=i.conversion),c}function o(i){const c=function(...a){const u=a[0];if(u==null)return u;u.length>1&&(a=u);const p=i(a);if(typeof p=="object")for(let l=p.length,f=0;f<l;f++)p[f]=Math.round(p[f]);return p};return"conversion"in i&&(c.conversion=i.conversion),c}return r.forEach(i=>{s[i]={},Object.defineProperty(s[i],"channels",{value:e[i].channels}),Object.defineProperty(s[i],"labels",{value:e[i].labels});const c=t(i);Object.keys(c).forEach(u=>{const p=c[u];s[i][u]=o(p),s[i][u].raw=n(p)})}),ve=s,ve}Ce.exports,function(e){const t=(p,l)=>(...f)=>`\x1B[${p(...f)+l}m`,s=(p,l)=>(...f)=>{const d=p(...f);return`\x1B[${38+l};5;${d}m`},r=(p,l)=>(...f)=>{const d=p(...f);return`\x1B[${38+l};2;${d[0]};${d[1]};${d[2]}m`},n=p=>p,o=(p,l,f)=>[p,l,f],i=(p,l,f)=>{Object.defineProperty(p,l,{get:()=>{const d=f();return Object.defineProperty(p,l,{value:d,enumerable:!0,configurable:!0}),d},enumerable:!0,configurable:!0})};let c;const a=(p,l,f,d)=>{c===void 0&&(c=Un());const m=d?10:0,h={};for(const[g,y]of Object.entries(c)){const T=g==="ansi16"?"ansi":g;g===l?h[T]=p(f,m):typeof y=="object"&&(h[T]=p(y[l],m))}return h};function u(){const p=new Map,l={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};l.color.gray=l.color.blackBright,l.bgColor.bgGray=l.bgColor.bgBlackBright,l.color.grey=l.color.blackBright,l.bgColor.bgGrey=l.bgColor.bgBlackBright;for(const[f,d]of Object.entries(l)){for(const[m,h]of Object.entries(d))l[m]={open:`\x1B[${h[0]}m`,close:`\x1B[${h[1]}m`},d[m]=l[m],p.set(h[0],h[1]);Object.defineProperty(l,f,{value:d,enumerable:!1})}return Object.defineProperty(l,"codes",{value:p,enumerable:!1}),l.color.close="\x1B[39m",l.bgColor.close="\x1B[49m",i(l.color,"ansi",()=>a(t,"ansi16",n,!1)),i(l.color,"ansi256",()=>a(s,"ansi256",n,!1)),i(l.color,"ansi16m",()=>a(r,"rgb",o,!1)),i(l.bgColor,"ansi",()=>a(t,"ansi16",n,!0)),i(l.bgColor,"ansi256",()=>a(s,"ansi256",n,!0)),i(l.bgColor,"ansi16m",()=>a(r,"rgb",o,!0)),l}Object.defineProperty(e,"exports",{enumerable:!0,get:u})}(Ce);var Xn=Ce.exports,zn=(e,t=process.argv)=>{const s=e.startsWith("-")?"":e.length===1?"-":"--",r=t.indexOf(s+e),n=t.indexOf("--");return r!==-1&&(n===-1||r<n)};const qn=Fn,ut=Je,x=zn,{env:$}=process;let P;x("no-color")||x("no-colors")||x("color=false")||x("color=never")?P=0:(x("color")||x("colors")||x("color=true")||x("color=always"))&&(P=1),"FORCE_COLOR"in $&&($.FORCE_COLOR==="true"?P=1:$.FORCE_COLOR==="false"?P=0:P=$.FORCE_COLOR.length===0?1:Math.min(parseInt($.FORCE_COLOR,10),3));function Te(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function Oe(e,t){if(P===0)return 0;if(x("color=16m")||x("color=full")||x("color=truecolor"))return 3;if(x("color=256"))return 2;if(e&&!t&&P===void 0)return 0;const s=P||0;if($.TERM==="dumb")return s;if(process.platform==="win32"){const r=qn.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in $)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in $)||$.CI_NAME==="codeship"?1:s;if("TEAMCITY_VERSION"in $)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test($.TEAMCITY_VERSION)?1:0;if($.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in $){const r=parseInt(($.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch($.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test($.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test($.TERM)||"COLORTERM"in $?1:s}function Kn(e){const t=Oe(e,e&&e.isTTY);return Te(t)}var pt={supportsColor:Kn,stdout:Te(Oe(!0,ut.isatty(1))),stderr:Te(Oe(!0,ut.isatty(2)))};const Hn=(e,t,s)=>{let r=e.indexOf(t);if(r===-1)return e;const n=t.length;let o=0,i="";do i+=e.substr(o,r-o)+t+s,o=r+n,r=e.indexOf(t,o);while(r!==-1);return i+=e.substr(o),i},Jn=(e,t,s,r)=>{let n=0,o="";do{const i=e[r-1]==="\r";o+=e.substr(n,(i?r-1:r)-n)+t+(i?`\r
|
|
3
|
-
|
|
4
|
-
`)
|
|
5
|
-
|
|
6
|
-
`
|
|
7
|
-
`)
|
|
8
|
-
`).
|
|
9
|
-
|
|
10
|
-
`)
|
|
11
|
-
`).map(d=>d.trim()).join(" ")},l.O=function(f){return this.inspectOpts.colors=this.useColors,r.inspect(f,this.inspectOpts)}}(pe,pe.exports)),pe.exports}typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?xe.exports=os():xe.exports=rs();var is=xe.exports;const as=ot(is),cs=e=>typeof e=="function",ls=e=>Object.prototype.toString.call(e)==="[object RegExp]";function vt(e,t){let s=[];try{de.existsSync(e)&&(de.lstatSync(e).isDirectory()?de.readdirSync(e).forEach(function(o){const i=vt(ee.join(e,"/",o),t);s=s.concat(i)}):t!==void 0||s.push(e))}catch(r){throw r}return s}const Ie=as.debug("vite-plugin-compression"),us=/\.(js|mjs|json|css|html)$/i,Tt=new Map;function ps(e={}){let t,s;const r={name:"vite:compression"},{disable:n=!1,filter:o=us,verbose:i=!0,threshold:c=1025,compressionOptions:a={},deleteOriginFile:u=!1,success:p=()=>{}}=e;let{ext:l=""}=e;const{algorithm:f="gzip"}=e;return f==="gzip"&&!l&&(l=".gz"),f==="brotliCompress"&&!l&&(l=".br"),n?r:(Ie("plugin options:",e),{...r,apply:"build",enforce:"post",configResolved(d){s=d,t=ee.isAbsolute(s.build.outDir)?s.build.outDir:ee.join(s.root,s.build.outDir),Ie("resolvedConfig:",d)},async closeBundle(){let d=vt(t)||[];if(Ie("files:",d),!d.length)return;d=fs(d,o);const m=ds(f,a),h=new Map,g=d.map(async y=>{const{mtimeMs:T,size:N}=await se.stat(y);if(T<=(Tt.get(y)||0)||N<c)return;let L=await se.readFile(y);u&&se.remove(y);try{L=await ms(L,f,m)}catch{s.logger.error("compress error:"+y)}const U=L.byteLength,fe=hs(y,l);h.set(y,{size:U/1024,oldSize:N/1024,cname:fe}),await se.writeFile(fe,L),Tt.set(y,Date.now())});return Promise.all(g).then(()=>{i&&(ys(s,h,f),p())})}})}function fs(e,t){if(t){const s=ls(t),r=cs(t);e=e.filter(n=>s?t.test(n):r?t(n):!0)}return e}function ds(e="",t={}){return{...{gzip:{level:B.constants.Z_BEST_COMPRESSION},deflate:{level:B.constants.Z_BEST_COMPRESSION},deflateRaw:{level:B.constants.Z_BEST_COMPRESSION},brotliCompress:{params:{[B.constants.BROTLI_PARAM_QUALITY]:B.constants.BROTLI_MAX_QUALITY,[B.constants.BROTLI_PARAM_MODE]:B.constants.BROTLI_MODE_TEXT}}}[e],...t}}function ms(e,t,s={}){return new Promise((r,n)=>{B[t](e,s,(o,i)=>o?n(o):r(i))})}function hs(e,t){const s=t.startsWith(".")?t:`.${t}`;return`${e}${s}`}function ys(e,t,s){e.logger.info(`
|
|
12
|
-
${le.cyan("\u2728 [vite-plugin-compression]:algorithm="+s)} - compressed file successfully: `);const r=Array.from(t.keys(),o=>o.length),n=Math.max(...r);t.forEach((o,i)=>{const{size:c,oldSize:a,cname:u}=o,p=Xe(u).replace(Xe(`${e.build.outDir}/`),""),l=`${a.toFixed(2)}kb / ${s}: ${c.toFixed(2)}kb`;e.logger.info(le.dim(ee.basename(e.build.outDir)+"/")+le.blueBright(p)+" ".repeat(2+n-i.length)+" "+le.dim(l))}),e.logger.info(`
|
|
13
|
-
`)}const gs=()=>ps({ext:".gz",algorithm:"gzip",deleteOriginFile:!0}),Ot=()=>{const e=process.env.npm_lifecycle_event;return _n({typescript:!0,vueTsc:!1,eslint:{lintCommand:`eslint --max-warnings=0 "./sections/**/*.{js,ts,vue}" --cache --cache-location "./build/eslintcache/${e}.json"`}})},bs={[_.Server]:[He(),me(),gs()],[_.Client]:[He(),me(),Ot(),kn({vue:"EcVue"})],[_.Misc]:[me(),Ot()]},v={SECTION:{source:"sections",dist:"dist/sections"},HEADER:{source:"headers",dist:"dist/headers"},FOOTER:{source:"footers",dist:"dist/footers"}};function Cs(e){return R(`${he}/${e}`)?"HEADER":R(`${ye}/${e}`)?"FOOTER":"SECTION"}const jt={"process.env":{NODE_ENV:"production"}},Es=[...Ke,...Ke.map(e=>`node:${e}`)],ws=[/@vue\/compiler-dom/,/@vue\/runtime-dom/,/@vue\/server-renderer/,/@vue\/compiler-ssr/,/@vue\/shared/],I={[j.Server]:{pluginType:_.Server,define:jt,ssr:!0,ssrOptions:{noExternal:!0},outDir:(e,t)=>`./${v[t].dist}/${e}/js/main/server`,externalOption:[...Es],entryFileNames:"server.js",inlineDynamicImports:!0},[j.Client]:{pluginType:_.Client,define:jt,ssr:!1,outDir:(e,t)=>`./${v[t].dist}/${e}/js/main/client`,entryFileNames:"client.js",assetFileNames:"assets/[name].[ext]",inlineDynamicImports:!0},[j.SectionSetting]:{pluginType:_.Misc,ssr:!1,outDir:(e,t)=>`./${v[t].dist}/${e}/js/settings`,entryFileNames:"[name].mjs"},[j.SectionShowcase]:{pluginType:_.Misc,ssr:!1,outDir:(e,t)=>`./${v[t].dist}/${e}/js/showcases`,entryFileNames:"[name].mjs"},[j.SectionAsset]:{pluginType:_.Misc,ssr:!1,outDir:(e,t)=>`./${v[t].dist}/${e}/assets`,assetFileNames:"[name].[ext]"},[j.TemplateDescriptor]:{pluginType:_.Misc,ssr:!1,outDir:()=>`./${z}/js`,entryFileNames:`[name]${X}.mjs`},[j.TemplateAsset]:{pluginType:_.Misc,ssr:!1,outDir:()=>`./${z}/assets`,assetFileNames:"[name].[ext]"}};function $s(e){switch(typeof e){case"string":return[E(process.cwd(),e)];case"object":return e.map(t=>E(process.cwd(),t));default:return[]}}function vs(e,t){const{externalOption:s}=I[e];return t?.externalizeVue&&e===j.Server?[...s??[],...ws]:s}function St(e,t,s,r,n){const o=I[s].define,i=I[s].ssrOptions,c=I[s].entryFileNames,a=I[s].chunkFileNames,u=I[s].assetFileNames,p=I[s].inlineDynamicImports,l=vs(s,n);return{plugins:bs[I[s].pluginType],...o!=null&&{define:o},...i!=null&&{ssr:i},resolve:{alias:{"@":"/src"}},build:{ssr:I[s].ssr,outDir:I[s].outDir(e,r),emptyOutDir:!0,minify:"terser",terserOptions:{compress:{drop_console:!1}},rollupOptions:{...l!=null&&{external:l},preserveEntrySignatures:"strict",input:$s(t),output:{validate:!0,inlineDynamicImports:p,...c!=null&&{entryFileNames:c},...a!=null&&{chunkFileNames:a},...u!=null&&{assetFileNames:u}}}}}}const At="https://json-schema.org/draft/2020-12/schema",kt="https://lightspeedhq.com/template.schema.json",Ft="Custom Template",xt="A custom template enclosing the necessary custom and default blocks",_t="object",Rt={metadata:{type:"object",properties:{name:{description:"Name of the template",type:"string",minLength:2,maxLength:60},description:{description:"Short description of the template",type:"string",minLength:2,maxLength:150},preview_url:{description:"Preview url of the demo website",type:"string",format:"uri",pattern:"^(https?)://([^.]+?\\.)company\\.site($|/[A-Za-z0-9\\-._~:/?#\\[\\]@!$&'()*+,;=]*)?$"},cover_image:{type:"object",properties:{set:{description:"Name of the image set",type:"object",patternProperties:{".*":{type:"object",properties:{url:{description:"Path to the preview image relative to the 'assets' folder for a specific resolution",type:"string"}},required:["url"],additionalProperties:!1}}}},required:["set"],additionalProperties:!1}},required:["name","description","cover_image"],additionalProperties:!1},sections:{description:"List of sections contained by this template",type:"array",items:{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]}},allOf:[{if:{properties:{type:{const:"default"}}},then:{$ref:"template-default.schema.json#/$defs/default-section"}},{if:{properties:{type:{const:"custom"}}},then:{$ref:"template-custom.schema.json#/$defs/custom-section"}}]},minItems:1,uniqueItems:!1}},It=["metadata","sections"],Ts={$schema:At,$id:kt,title:Ft,description:xt,type:_t,properties:Rt,required:It},Nt={__proto__:null,$id:kt,$schema:At,default:Ts,description:xt,properties:Rt,required:It,title:Ft,type:_t},Lt="https://json-schema.org/draft/2020-12/schema",Mt="https://lightspeedhq.com/template-default.schema.json",Dt="Default Section",Bt="Default section for a Custom Template",Pt="object",Gt={"default-section":{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","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})?)$"}},required:["type","id"],additionalProperties:!1}},Os={$schema:Lt,$id:Mt,title:Dt,description:Bt,type:Pt,$defs:Gt},js={__proto__:null,$defs:Gt,$id:Mt,$schema:Lt,default:Os,description:Bt,title:Dt,type:Pt},Ut="https://json-schema.org/draft/2020-12/schema",Xt="https://lightspeedhq.com/template-custom.schema.json",zt="Custom Section",qt="Custom section for a Custom Template",Kt="object",Ht={"custom-section":{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]},id:{description:"Identification of the section",type:"string"},showcase_id:{description:"Showcase id of the section",type:"string"},showcase_overrides:{type:"object",description:"Overrides for the showcase",properties:{content:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","DECK"]}},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:"DECK"}}},then:{$ref:"template-custom-content.schema.json#/$defs/deck"}}]}},minProperties:1},design:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the design configuration element",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]}},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"}}]}},minProperties:1},layoutId:{description:"Layout ID for the showcase",type:"string"},blockName:{description:"Section name for the showcase",type:"string"}},required:["content","design"]}},required:["type","id"],additionalProperties:!1}},Ss={$schema:Ut,$id:Xt,title:zt,description:qt,type:Kt,$defs:Ht},As={__proto__:null,$defs:Ht,$id:Xt,$schema:Ut,default:Ss,description:qt,title:zt,type:Kt},Jt="https://json-schema.org/draft/2020-12/schema",Wt="https://lightspeedhq.com/template-custom-content.schema.json",Yt="Custom Section :: Content Configuration",Zt="Content tab configuration of a Custom Section for a Custom Template",Vt="object",Qt={input_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","DECK"]},text:{type:"string"}},required:["type","text"],additionalProperties:!1},text_area:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","DECK"]},text:{type:"string"}},required:["type","text"],additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","DECK"]},title:{type:"string"},buttonType:{type:"string",enum:["SCROLL_TO_TILE","HYPER_LINK","MAIL_LINK","TEL_LINK","GO_TO_STORE_LINK","GO_TO_PAGE"]},link:{type:"string",format:"uri"},linkTarget:{type:"string"},email:{type:"string"},phone:{type:"string"},tileId:{type:"string"}},required:["type","title"],additionalProperties:!1},image:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","DECK"]},imageData:{type:"object",properties:{set:{type:"object"},borderInfo:{type:"object"},bucket:{type:"string"}},required:["set"]}},required:["type"],additionalProperties:!1},toggle:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","DECK"]},enabled:{type:"boolean"}},required:["type"],additionalProperties:!1},select_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","DECK"]},value:{type:"string"}},required:["type"],additionalProperties:!1},deck:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","DECK"]},cards:{description:"Cards of the content configuration element",type:"array",items:{type:"object",required:["settings"]},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"]}},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}}}}}},ks={$schema:Jt,$id:Wt,title:Yt,description:Zt,type:Vt,$defs:Qt},Fs={__proto__:null,$defs:Qt,$id:Wt,$schema:Jt,default:ks,description:Zt,title:Yt,type:Vt},en="https://json-schema.org/draft/2020-12/schema",tn="https://lightspeedhq.com/template-custom-design.schema.json",nn="Custom Section :: Design Configuration",sn="Design tab configuration of a Custom Section for a Custom Template",on="object",rn={text:{type:"object",properties:{type:{description:"Type of the text",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},font:{description:"Default font for the text",type:"string"},size:{description:"Default size for the text",type:"integer",minimum:1,exclusiveMaximum:50},bold:{description:"Default boldness for the text",type:"boolean"},italic:{description:"Default italic style for the text",type:"boolean"},color:{description:"Default color for the text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},visible:{description:"Default visibility for the text",type:"boolean"}},additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the button",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},font:{description:"Default font for the button",type:"string"},size:{description:"Default size for the button",type:"string",enum:["SMALL","MEDIUM","LARGE"]},appearance:{description:"Default appearance for the button",type:"string",enum:["SOLID","OUTLINE","TEXT"]},shape:{description:"Default shape for the button",type:"string",enum:["ROUND_CORNER","RECTANGLE","PILL"]},color:{description:"Default color for the button",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"}},additionalProperties:!1},image:{type:"object",properties:{type:{description:"Type of the image",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},overlay:{description:"Default overlay for the image",type:"string",enum:["COLOR","GRADIENT","NONE"]}},if:{properties:{overlay:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default color for the image",type:"array",items:{type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},minItems:2,maxItems:2}}},else:{properties:{color:{description:"Default color for the image",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"}}}},toggle:{type:"object",properties:{type:{description:"Type of the toggle",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},enabled:{description:"Default enabled status for the toggle",type:"boolean"}},additionalProperties:!1},select_box:{type:"object",properties:{type:{description:"Type of the checkbox",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},value:{description:"Default option for the checkbox",type:"string"}},additionalProperties:!1},background:{type:"object",properties:{type:{description:"Type of the background",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND"]},style:{description:"Default style for the background",type:"string",enum:["COLOR","GRADIENT"]}},if:{properties:{style:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default colors for the image",type:"array",items:{type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},minItems:2,maxItems:2}}},else:{properties:{color:{description:"Default color for the image",type:"string"}}}}},xs={$schema:en,$id:tn,title:nn,description:sn,type:on,$defs:rn},_s={__proto__:null,$defs:rn,$id:tn,$schema:en,default:xs,description:sn,title:nn,type:on};function Rs(e){return Object.entries(v).find(t=>t[1].source===e)?.[0]}async function Is(){const e=await O("**/server.{js,ts}",{ignore:["node_modules/**","dist/**"]});return Promise.all(e.map(async t=>{const s=On(t).split(jn),r=s.pop()??"default",n=s.pop();if(n===void 0)throw new Error("Cannot determine type of section, outer directory is undefined");const o=await O(`**/${r}/client.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),i=await O(`**/${r}/settings/content.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),c=await O(`**/${r}/settings/design.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),a=await O(`**/${r}/settings/layout.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),u=await O(`**/${r}/settings/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),p=await O(`**/${r}/showcases/*.{js,ts}`,{ignore:["node_modules/**","dist/**",`**/${r}/showcases/translations.{js,ts}`]}),l=await O(`**/${r}/showcases/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),f=await O(`**/${r}/assets/*`,{ignore:["node_modules/**","dist/**"]});return{name:r,type:Rs(n),serverEntrypoint:t,clientEntrypoint:o.at(0),contentSettingsEntrypoint:i.at(0),designSettingsEntrypoint:c.at(0),layoutSettingsEntrypoint:a.at(0),settingsTranslationsEntrypoint:u.at(0),showcasesEntrypoints:p,showcasesTranslationsEntrypoint:l.at(0),assetsEntrypoints:f}}))}async function Ns(){const e=await O("./templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]}),t=await O("./templates/assets/*",{ignore:["node_modules/**","dist/**"]});return{templates:e,assets:t}}async function Ne(e,t){try{const s=E(Ge.cwd(),t?`${e}${X}.mjs`:`${e}.mjs`);return(await import(G(s).href)).default}catch{throw new Error(`File [${e}${X}.mjs] is either invalid or undefined`)}}async function Ls(){let e=new Rn({allErrors:!0,schemas:[Nt,js,As,Fs,_s]});return In(e),e.compile(Nt)}async function Ms(e,t,s,r){if(e(t)&&r===void 0)new Promise(n=>{Cn(`${s}${X}.mjs`,`${s}.mjs`,function(o){o&&n(o)})});else throw new Promise(n=>{En(`${s}${X}.mjs`,function(o){o&&n(o)})}),new Error(`Invalid file [${te(s).name}].
|
|
14
|
-
Note: Errors regarding failingKeyword: "then" can sometimes be false negatives. Please focus on fixing other errors first!
|
|
15
|
-
Errors: ${JSON.stringify([...e.errors??[],...r??[]],null,2)}`)}async function Ds(e){const t=[];for(const s of e.sections){const r=e.sections.indexOf(s);if(r===0){const n=s.id==="header"&&s.type==="default",o=R(`${he}/${s.id}`);!n&&!o&&t.push({instancePath:`/sections/${r}/id`,message:"The first section must be a `header`"})}else if(r===e.sections.length-1){const n=s.id==="footer"&&s.type==="default",o=R(`${ye}/${s.id}`);!n&&!o&&t.push({instancePath:`/sections/${r}/id`,message:"The last section must be a `footer`"})}else if(s.type==="custom")if(!R(`${A}/${s.id}`))t.push({instancePath:`/sections/${r}/id`,message:"Custom section must have a corresponding block defined"});else{if(s.content!==void 0)if(!R(`${A}/${s.id}/js/settings/content.mjs`))t.push({instancePath:`/sections/${r}/content`,message:"Content descriptor is overridden, please provide a default descriptor in the block's settings folder"});else{const n=await Ne(`${A}/${s.id}/js/settings/content`,!1),o=new Set(Object.keys(n));Object.keys(s.content).every(i=>o.has(i))||t.push({instancePath:`/sections/${r}/content`,message:"Content descriptor must be a subset of the default content descriptor"})}if(s.design!==void 0)if(!R(`${A}/${s.id}/js/settings/design.mjs`))t.push({instancePath:`/sections/${r}/design`,message:"Design descriptor is overridden, please provide a default descriptor in the block's settings folder"});else{const n=await Ne(`${A}/${s.id}/js/settings/design`,!1),o=new Set(Object.keys(n));Object.keys(s.design).every(i=>o.has(i))||t.push({instancePath:`/sections/${r}/design`,message:"Design descriptor must be a subset of the default design descriptor"})}s.showcase_id!==void 0&&(R(`${A}/${s.id}/js/showcases/${s.showcase_id}.mjs`)||t.push({instancePath:`/sections/${r}/showcase-id`,message:"Custom section must have a corresponding showcase defined in case showcase_id is specified"}))}}return t.length===0?void 0:t}function Bs(e){const t=e.reduce((s,r)=>{const n=wn(r);return n.size>Qe&&(s[r]=Ve(n.size)),s},{});if(Object.keys(t).length!==0){const s=Math.max(...Object.keys(t).map(r=>r.length));b.error(`Size of individual assets must not exceed threshold [${Ve(Qe)}]!`);for(let r in t)b.error(`File: ${r}`.padEnd(s+10)+`| ${t[r]}`);throw new Error("Invalid asset file size")}}function Ps(){return $n.rm("dist",{recursive:!0,force:!0})}async function Gs(e){async function t(s,r,n,o="SECTION"){r.length!==0&&await ze({configFile:!1,...qe(St(s,r,n,o,e))})}try{const[s,r]=await Promise.all([Is(),Ns(),Ps()]),n=s.map(o=>({name:o.name,type:o.type,serverEntrypoint:o.serverEntrypoint,clientEntrypoint:[o.clientEntrypoint].filter(ge).flat(),settingsEntryPoints:[o.contentSettingsEntrypoint,o.designSettingsEntrypoint,o.layoutSettingsEntrypoint,o.settingsTranslationsEntrypoint].filter(ge),showcaseEntryPoints:[...o.showcasesEntrypoints??[],o.showcasesTranslationsEntrypoint].filter(ge),assetsEntrypoints:o.assetsEntrypoints??[]}));for(const o of n)Bs(o.assetsEntrypoints),await Promise.all([ze({configFile:!1,...qe(St(o.name,o.serverEntrypoint,j.Server,o.type,e))}),t(o.name,o.clientEntrypoint,j.Client,o.type),t(o.name,o.settingsEntryPoints,j.SectionSetting,o.type),t(o.name,o.showcaseEntryPoints,j.SectionShowcase,o.type),t(o.name,o.assetsEntrypoints,j.SectionAsset,o.type)]);if(r.templates.length!==0){const[o]=await Promise.all([Ls(),t(void 0,r.assets,j.TemplateAsset),t(void 0,r.templates,j.TemplateDescriptor)]);for(const i of r.templates){const c=`${z}/js/${te(i).name}`,a=await Ne(c,!0);await Ms(o,a,c,await Ds(a))}}b.info("Build successful. For deploy run: npx @lightspeed/crane@latest deploy")}catch(s){b.error(`Error while building: ${s.message}`),Ge.exit(1)}}function an(e){if(e!==void 0)return e.startsWith("global.")?{type:"GLOBAL_FONT",font:e}:{type:"PRESET_FONT",font:e}}function D(e){if(e===void 0)return;if(e.startsWith("global."))return{type:"GLOBAL_COLOR",raw:e};const t=Dn(e);return{type:"STRUCTURED_COLOR",raw:e,hex:t.toHex8String(),hsl:t.toHsl(),rgba:t.toRgb(),auto:!1}}function Us(e){if(e!==void 0)return typeof e=="string"&&e.startsWith("global.")?{type:"GLOBAL_TEXT_SIZE",size:e}:{type:"NUMERIC_TEXT_SIZE",size:e}}const Xs={COLOR:"COLOR",GRADIENT:"GRADIENT"};function zs(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(Xs)}`)}}function qs(e){const t=e.style,s=e.color,r=Array.isArray(s)?s:[s,s];return e.background={type:zs(t),solid:{color:D(r.at(0))},gradient:{fromColor:D(r.at(0)),toColor:D(r.at(1))}},e.style=void 0,e.color=void 0,e}const Ks={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"};function Hs(e){switch(e){case"SOLID":return"solid-button";case"OUTLINE":return"outline-button";case"TEXT":return"text-link";default:throw new Error(`Unknown button appearance: ${e}. Right options: ${Object.keys(Ks)}`)}}const Js={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"};function Ws(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(Js)}`)}}const Ys={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"};function Zs(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(Ys)}`)}}function Vs(e){const t=e.appearance;t!==void 0&&(e.appearance=Hs(t));const s=e.size;s!==void 0&&(e.size=Ws(s));const r=e.shape;r!==void 0&&(e.style=Zs(r),e.shape=void 0);const n=e.font;e.font=an(n);const o=e.color;return e.color=D(o),e}const Qs={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"};function eo(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(Qs)}`)}}function to(e){const t=e.overlay,s=e.color,r=Array.isArray(s)?s:[s,s];return e.overlay={type:eo(t),solid:{color:D(r.at(0))},gradient:{fromColor:D(r.at(0)),toColor:D(r.at(1))}},e.color=void 0,e}function no(e){const t=e.font;e.font=an(t);const s=e.color;e.color=D(s);const r=e.size;return e.size=Us(r),e}function so(e){const t=e.color;return e.color=D(t),e}function oo(e){Object.keys(e).forEach(t=>{const s=e[t],r=s.type;Le(r,s.defaults)})}function ro(e){e.forEach(t=>{t.type!==void 0&&t.defaults!==void 0&&(Le(t.type,t.defaults),t.defaults.type=t.type)})}function cn(e){Object.keys(e).forEach(t=>{const s=e[t],r=s.type;Le(r,s)})}function Le(e,t){switch(e){case"TEXT":{no(t);break}case"BUTTON":{Vs(t);break}case"IMAGE":{to(t);break}case"BACKGROUND":{qs(t);break}case"COLOR_PICKER":{so(t);break}case"TOGGLE":case"SELECTBOX":break;default:throw new Error(`Unknown design editor type: ${e}`)}return t}const io=200;var k=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.ClientAsset=2]="ClientAsset",e[e.Asset=3]="Asset",e[e.TemplateAsset=4]="TemplateAsset",e[e.Dependency=5]="Dependency",e))(k||{});const K={[k.Server]:{type:"server_js_compressed",isSingleton:!0,toPath:(e,t)=>`${v[t].dist}/${e}/js/main/server/`,fileName:"server.js.gz"},[k.Client]:{type:"client_js",isSingleton:!1,toPath:(e,t)=>`${v[t].dist}/${e}/js/main/client/`,fileName:"client.js"},[k.ClientAsset]:{type:"assets",isSingleton:!1,toPath:(e,t)=>`${v[t].dist}/${e}/js/main/client/assets/`,fileName:"*"},[k.Asset]:{type:"assets",isSingleton:!1,toPath:(e,t)=>`${v[t].dist}/${e}/assets/`,fileName:"*"},[k.TemplateAsset]:{type:"template_assets",isSingleton:!1,toPath:()=>`${z}/assets/`,fileName:"*"},[k.Dependency]:{type:"dependencies",isSingleton:!0,toPath:()=>{},fileName:"package.json"}},ao="https://blockbuster.ecwid.com",co="/api/v1/custom-apps/resources/sections/upload",lo="/api/v1/custom-apps/resources/templates/upload",uo="/api/v1/custom-apps/manifests/sections",po="/api/v1/custom-apps/manifests/templates",fo=5,mo=3;async function ho(){const e=await We(E(C.cwd(),"crane.config.json")),t=JSON.parse(e.toString());return{appClientId:t.app_client_id,appSecretKey:btoa(t.app_secret_key)}}async function yo(){const e=E(C.cwd(),"package.json"),t=await We(e),s=JSON.parse(t.toString());if(go(s))return s;throw new Error(`Package file located at path: ${e} does not contain a version field`)}function go(e){return typeof e=="object"&&e!==null&&"version"in e&&typeof e.version=="string"}async function bo(e){const t=Ln(e.version,"patch");if(t===null)throw Error("Error while incrementing app version");e.version=t,vn(E(C.cwd(),"package.json"),`${JSON.stringify(e,null,2)}
|
|
16
|
-
`)}async function Co(e,t,s=A){try{const r=E(C.cwd(),`${s}/${e}/js/settings/content.mjs`),n=(await import(G(r).href)).default;return Y(n,t),n}catch{throw new Error(`Content descriptor for section [${e}] is either invalid or undefined`)}}async function Eo(e,t,s=A){try{const r=E(C.cwd(),`${s}/${e}/js/settings/design.mjs`),n=(await import(G(r).href)).default;return oo(n),Y(n,t),n}catch(r){const n=r;throw new Error(`Design settings is invalid or undefined. Error ${n.stack}`)}}async function wo(e,t,s=A){try{const r=await O("*.mjs",{cwd:E(C.cwd(),`${s}/${e}/js/showcases/`),ignore:"**/translations.mjs"});return Promise.all(r.map(async n=>{const o=E(C.cwd(),`${s}/${e}/js/showcases/${n}`),i=(await import(G(o).href)).default;return cn(i.design),Y(i,t),i}))}catch(r){throw new Error(`Showcases is invalid or undefined. Error ${r}`)}}async function $o(e,t=A){try{const s=E(C.cwd(),`${t}/${e}/js/settings/layout.mjs`);if(!R(s))return[];const r=(await import(G(s).href)).default;return r.forEach(n=>ro(n.selectedDesignSettings)),r}catch{throw new Error(`Layout descriptor for section [${e}] is either invalid or undefined`)}}async function vo(e,t=A){return await un(`${t}/${e}/js/settings/translations.mjs`)}async function ln(e,t=A){return await un(`${t}/${e}/js/showcases/translations.mjs`)}async function un(e){const t=E(C.cwd(),e),s=(await import(G(t).href)).default;return Oo(s)}function Y(e,t){if(e&&typeof e=="object"){const s=e;for(let r in s){const n=s[r];typeof n=="string"&&n.startsWith("$")&&(s[r]=To(t,n)),typeof n=="object"&&Y(n,t)}}}function To(e,t){if(!t)return;const s=e[t];return s===void 0?{en:t}:s}function Oo(e){const t={};for(let s in e){const r=e[s];for(let n in r){const o=t[n],i=r[n];if(o===void 0){const c={};c[s]=i,t[n]=c}else o[s]=i}}return t}async function Me(e,t){const s=await vo(e,v[t].dist),r=await ln(e,v[t].dist),n=await Co(e,s,v[t].dist),o=await Eo(e,s,v[t].dist),i=await wo(e,r,v[t].dist),c=await $o(e,v[t].dist);return{id:e,type:t,name:{en:e},contentEditors:n,designEditors:o,layouts:c,showcases:i}}async function jo(){const e=await O("*/",{cwd:E(C.cwd(),`${A}/`)}),t=await O("*/",{cwd:E(C.cwd(),`${he}/`)}),s=await O("*/",{cwd:E(C.cwd(),`${ye}/`)});return Promise.all([...e.map(async r=>Me(r,"SECTION")),...t.map(async r=>Me(r,"HEADER")),...s.map(async r=>Me(r,"FOOTER"))])}async function So(e){try{return(await import(G(E(C.cwd(),e)).href)).default}catch{throw new Error(`Template descriptor [${e}] is either invalid or undefined`)}}async function Ao(){const e=await O(`${z}/js/**.mjs`,{ignore:[`${z}/js/**${X}.mjs`]});return Promise.all(e.map(async t=>{const s=await So(t),r=s.sections.filter(n=>n.type==="custom");for(const n of r){const o=Cs(n.id),i=await ln(n.id,v[o].dist);n.showcase_overrides!==void 0&&(Y(n.showcase_overrides,i),cn(n.showcase_overrides.design))}return{id:`${te(C.cwd()).name.replace(/[^a-zA-Z0-9]/g,"_")}_${te(t).name}`,descriptor:s}}))}function ko(e,t){const s=e.pathContext,r=s.toPath(e.currentSection,t),n=r===void 0?Ue(s.fileName):Ue(s.fileName,{cwd:E(C.cwd(),r),ignore:s.ignore});return s.isSingleton?n.splice(0):n}function Fo(e){return e instanceof Ye&&(e.code==="ECONNRESET"||e.response?.status!==void 0&&e.response?.status>=500&&e.response?.status<600)}function pn(e,t){return e<mo&&Fo(t)}async function fn(e){await new Promise(t=>{setTimeout(t,2**e*500)})}function dn(e,t,s,r){const n=e.config.app.templates.length>0?lo:co;return e.config.axios.post(n,{file:Tn(E(C.cwd(),s!==void 0?s+t:t))},{params:{appClientId:e.config.app.crane.appClientId,type:e.pathContext.type,version:e.config.app.packageJson.version,...e.currentSection!==void 0&&{block:e.currentSection},...e.pathContext.type!=="dependencies"&&{fileName:t}},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${e.config.app.crane.appSecretKey}`}}).then(o=>({status:o.status})).catch(async o=>pn(r,o)?(await fn(r),dn(e,t,s,r+1)):{status:o.response?.status,message:o.message})}function H(e,t="SECTION"){const s=ko(e,t),r=e.pathContext.toPath(e.currentSection,t);return s.map(n=>dn(e,n,r,0))}function xo(e){return[...e.app.sections.flatMap(t=>[...H({config:e,currentSection:t.id,pathContext:K[k.Server]},t.type),...H({config:e,currentSection:t.id,pathContext:K[k.Client]},t.type),...H({config:e,currentSection:t.id,pathContext:K[k.ClientAsset]},t.type),...H({config:e,currentSection:t.id,pathContext:K[k.Asset]},t.type)]),...H({config:e,pathContext:K[k.Dependency]}),...H({config:e,pathContext:K[k.TemplateAsset]})]}function _o(e){return e.includes(`
|
|
17
|
-
`)}function Ro(e,t,s){return e.split(`
|
|
18
|
-
`).map((r,n)=>n>=s?t+r:r).join(`
|
|
19
|
-
`)}function mn(e,t){const s=[];if(e instanceof Ye){e.response?.status!==void 0&&s.push(` HTTP Status Code: ${e.response.status}`);const o=e.response?.data;if(o?.errorCode&&s.push(` Error Code: ${o.errorCode}`),o?.errorMessage){const i=_o(o.errorMessage)?Ro(o.errorMessage," ",1):o.errorMessage;s.push(` Error Message: ${i}`)}}const r=s.length>0?s.join(`
|
|
20
|
-
`):e?.message??"Unknown error";if(!t||t.length===0)return r;const n=s.length>0?`
|
|
21
|
-
`:" ";return`${t}${n}${r}`}async function hn(e,t=0){const s=e.app.templates.length>0?po:uo;return e.axios.post(s,{version:e.app.packageJson.version,name:"Custom Block App",blocks:e.app.sections,templates:e.app.templates,compressionEnabled:!0},{params:{appClientId:e.app.crane.appClientId},headers:{Authorization:`Bearer ${e.app.crane.appSecretKey}`}}).catch(async r=>{if(pn(t,r))return await fn(t),hn(e,t+1);throw r})}async function Io(e){try{R(E(C.cwd(),A))||(b.error(`Distribution folder [${A}] not found, please execute the build command first.`),C.exit(1));const t=e??ao;b.info("Custom application deployment :: Started");const s=Nn.create({baseURL:t});Mn(s,fo),b.info("Loading configuration files ...");const r=await Promise.all([ho(),yo(),jo(),Ao()]).then(([c,a,u,p])=>({axios:s,app:{crane:c,packageJson:a,sections:u,templates:p}}));b.info("Uploading asset files ...");let n=et();const o=await Promise.all(xo(r)).finally(()=>{be(n)});o.every(c=>c.status===io)||(o.map(c=>c.message).filter((c,a,u)=>u.indexOf(c)===a).forEach(c=>b.error(`Error while uploading asset files: ${c}`)),C.exit(1)),b.info("Uploading manifest files ..."),n=et(),await hn(r).catch(c=>{be(n),b.error(mn(c,"Error while deploying manifest file:")),C.exit(1)}).finally(()=>{be(n)});const i=r.app.sections.map(c=>c.id);b.info(`Custom application deployment :: Successful
|
|
22
|
-
Current app version: ${r.app.packageJson.version}
|
|
23
|
-
Deployed sections: ${i.join(", ")}`),await bo(r.app.packageJson),r.app.templates.length>0&&b.info(`Deployed templates: ${r.app.templates.map(c=>c.id).join(", ")}`)}catch(t){b.error(mn(t,"Error while deploying:")),C.exit(1)}}const No="1.1.1",w=bn("crane");function Lo(){w.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("--template <name>","Creates the directory and files necessary to build a custom template inside your app folder.").option("--custom-headers-footers","Creates the directories and files necessary to build a custom header and footer inside your app folder.").action(e=>{if(e.app)return tt(e.app);if(e.section)return nt(e.section);if(e.template)return st(e.template,e.customHeadersFooters);w.outputHelp()}),w.command("build","Builds your resource code").option("--externalize-vue","Externalize @vue core libraries to reduce the bundle size").action(Gs),w.command("deploy","Deploys your resource code into Ecwid"),w.on("command:*",()=>{console.error("Invalid command: %s",w.args.join(" ")),w.outputHelp(),process.exit(1)}),w.on("command:init",()=>{const e=w.options.section,t=w.options.app,s=w.options.template,r=w.options.customHeadersFooters||!1;Be(t)?De("app",ne("init --app <name>"),tt):Be(e)?De("section",ne("init --section <name>"),nt):Be(s)&&De("template",ne("init --template <name>"),st,r)}),w.on("command:deploy",()=>Io(w.options.url)),w.help(),w.usage("<action> <resource>"),w.version(No),w.parse()}try{Lo()}catch{}async function De(e,t,s,r){const n=`You can use ${t} to directly specify the name of the ${e}.`;console.log(n);const o=await Bn({type:"text",name:"name",message:`Please specify a name for your ${e}:`});if(o.name)return e==="template"?s(o.name,r):s(o.name);console.log("Please provide a name for the template."),w.outputHelp()}function Be(e){return e&&(typeof e!="string"||e.trim().length==0)}
|
|
1
|
+
import io from"cac";import{red as ao,yellow as po,green as N}from"kolorist";import ne from"prompts";import b from"node:fs";import w from"node:path";import T from"node:process";import{fileURLToPath as R}from"node:url";import*as X from"fs";import D,{existsSync as O,rename as co,unlink as lo,statSync as fo,promises as uo,writeFileSync as yo,createReadStream as mo}from"fs";import*as z from"path";import S,{resolve as f,parse as x,dirname as go,sep as ho}from"path";import{glob as m,globSync as re}from"glob";import{build as ie,defineConfig as ae}from"vite";import{builtinModules as pe}from"module";import ce from"@vitejs/plugin-vue";import K from"vite-tsconfig-paths";import{viteExternalsPlugin as $o}from"vite-plugin-externals";import bo from"vite-plugin-compression";import To from"vite-plugin-checker";import Eo from"ajv/dist/2020.js";import jo from"ajv-formats";import*as l from"process";import wo from"process";import{pathToFileURL as _}from"url";import{readFile as le}from"fs/promises";import Oo,{AxiosError as de}from"axios";import{inc as So}from"semver";import{ConcurrencyManager as vo}from"axios-concurrency";import Ao from"tinycolor2";import Co from"cli-progress";function fe(e,t){X.statSync(e).isDirectory()?(X.mkdirSync(t,{recursive:!0}),X.readdirSync(e).forEach(o=>{const s=z.resolve(e,o),n=z.resolve(t,o);fe(s,n)})):X.copyFileSync(e,t)}function I(e,t,o,s){const n=z.join(e,s?.[o]??o);fe(z.join(t,o),n)}function V(e,t=2){if(!+e)return"0 Bytes";const o=1024,s=t<0?0:t,n=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],r=Math.floor(Math.log(e)/Math.log(o));return`${parseFloat((e/o**r).toFixed(s))} ${n[r]}`}const p={error:e=>console.log(ao(e)),warn:e=>console.log(po(e)),info:e=>console.log(N(e))},L="_temp",g="dist/sections",J="dist/headers",Z="dist/footers",P="dist/templates",ue=2*1024*1024;function W(e){return!!e}function ye(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}async function Do(e){try{const t=e,o=T.cwd(),s=w.join(o,t),n=["templates","headers","footers","reference"],r={_gitignore:".gitignore"};b.existsSync(s)?(p.error(`App with the name: ${e} already exists. If you'd like to override it, delete previous version first`),T.exit(1)):b.mkdirSync(s);const i=w.resolve(R(import.meta.url),"../..","template");b.readdirSync(i).filter(c=>c!=="package.json").filter(c=>!n.includes(c)).forEach(async c=>I(s,i,c,r));const a=JSON.parse(b.readFileSync(w.join(i,"package.json"),"utf-8"));a.name=e;const y=w.join(s,"package.json");b.writeFileSync(y,`${JSON.stringify(a,null,2)}
|
|
2
|
+
`),p.info(`App ${e} created`)}catch(t){p.error(`Error while creating app: ${t.message}`),T.exit(1)}}function Y(e,t,o,s){try{const n=T.cwd(),r=S.join(n,t);D.existsSync(r)||D.mkdirSync(r);const i=S.join(n,t,o);D.existsSync(i)?(p.error(`${s} with the name: ${o} already exists. If you'd like to override it, delete previous version first`),T.exit(1)):D.mkdirSync(i);const a=S.resolve(R(import.meta.url),"../..",e);D.readdirSync(a).forEach(async y=>I(i,a,y)),p.info(`${s} ${o} created`)}catch(n){p.error(`Error while creating ${s}: ${n.message}`),T.exit(1)}}function me(e){const t=T.cwd(),o=S.resolve(R(import.meta.url),"../..",`template/${e}`),s=S.join(t,e);D.existsSync(s)||(D.mkdirSync(s),D.readdirSync(o).forEach(async n=>I(s,o,n)))}async function Io(e){Y("template/sections/example-section","sections",e,"Section")}async function _o(e,t=!1){try{const o=T.cwd(),s=w.join(o,"templates"),n={"template.ts":`${e}.ts`};b.existsSync(s)?b.existsSync(w.join(s,`${e}.ts`))&&(p.error(`Template with the name: ${e} already exists. If you'd like to override it, delete previous version first`),T.exit(1)):b.mkdirSync(s);const r=w.resolve(R(import.meta.url),"../..","template/templates");b.readdirSync(r).forEach(async i=>I(s,r,i,n)),t&&(me("headers"),me("footers")),p.info(`Template descriptor file [${e}.ts] has been created`)}catch(o){p.error(`Error while creating template descriptors: ${o.message}`),T.exit(1)}}async function No(){try{const e=T.cwd(),t=w.resolve(R(import.meta.url),"../../","template/reference"),o=b.readdirSync(t);let s=!1;for(const n of o){const r=w.join(t,n),i=w.join(e,n);b.existsSync(i)||b.mkdirSync(i,{recursive:!0});const a=b.readdirSync(r),y=b.readdirSync(i);if(n==="shared"){a.forEach(c=>{I(i,r,c)});continue}for(const c of a){if(c==="assets"){I(i,r,c);continue}if(y.includes(c)){const{name:A}=await ne({type:"text",name:"name",message:`The "${c}" already exists in ${n} directory: provide a new name to keep both or press Esc to skip this one.`});A?(I(i,r,c,{[c]:A}),s=!0):p.info(`Skipped: ${c}`)}else I(i,r,c)}}p.info("Reference templates have been added to the app"),s&&p.warn("Some files or folders were renamed to avoid conflicts. Temlate files may need to be updated to reflect these changes.")}catch(e){p.error(`Error while creating template descriptors: ${e.message}`),T.exit(1)}}var h=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.SectionSetting=2]="SectionSetting",e[e.SectionShowcase=3]="SectionShowcase",e[e.SectionAsset=4]="SectionAsset",e[e.TemplateDescriptor=5]="TemplateDescriptor",e[e.TemplateAsset=6]="TemplateAsset",e))(h||{}),E=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.Misc=2]="Misc",e))(E||{});const xo=()=>bo({ext:".gz",algorithm:"gzip",deleteOriginFile:!0}),ge=()=>{const e=process.env.npm_lifecycle_event;return To({typescript:!0,vueTsc:!1,eslint:{lintCommand:`eslint --max-warnings=0 "./sections/**/*.{js,ts,vue}" --cache --cache-location "./build/eslintcache/${e}.json"`}})},Lo="/* EXTERNAL_IMPORTS_START */",Po="/* EXTERNAL_IMPORTS_END */",ko=()=>({name:"external-imports-wrapper-plugin",enforce:"post",apply:"build",generateBundle(e,t){for(const o of Object.keys(t)){const s=t[o];if(s.type==="chunk"){const n=/import.*\?commonjs-external["'];/g,r=s.code.match(n);if(r!==null){const i=r.join(""),a=Lo+i+Po,y=s.code.replace(n,"");s.code=a+y}}}}}),Ro={[E.Server]:[ce(),K(),ko(),xo()],[E.Client]:[ce(),K(),ge(),$o({vue:"EcVue"})],[E.Misc]:[K(),ge()]};var Q=(e=>(e.SECTION="SECTION",e.HEADER="HEADER",e.FOOTER="FOOTER",e))(Q||{});const u={SECTION:{source:"sections",dist:"dist/sections"},HEADER:{source:"headers",dist:"dist/headers"},FOOTER:{source:"footers",dist:"dist/footers"}};function G(e){return O(`${J}/${e}`)?"HEADER":O(`${Z}/${e}`)?"FOOTER":"SECTION"}function Go(e){const t=G(e);return u[t].dist}const he={"process.env":{NODE_ENV:"production"}},Fo=[...pe,...pe.map(e=>`node:${e}`)],Bo=[/@vue\/compiler-dom/,/@vue\/runtime-dom/,/@vue\/server-renderer/,/@vue\/compiler-ssr/,/@vue\/shared/],v={[h.Server]:{pluginType:E.Server,define:he,ssr:!0,ssrOptions:{noExternal:!0},outDir:(e,t)=>`./${u[t].dist}/${e}/js/main/server`,externalOption:[...Fo,...Bo],entryFileNames:"server.js",inlineDynamicImports:!0},[h.Client]:{pluginType:E.Client,define:he,ssr:!1,outDir:(e,t)=>`./${u[t].dist}/${e}/js/main/client`,entryFileNames:"client.js",assetFileNames:"assets/[name].[ext]",chunkFileNames:"chunks/[name].js",inlineDynamicImports:!1},[h.SectionSetting]:{pluginType:E.Misc,ssr:!1,outDir:(e,t)=>`./${u[t].dist}/${e}/js/settings`,entryFileNames:"[name].mjs"},[h.SectionShowcase]:{pluginType:E.Misc,ssr:!1,outDir:(e,t)=>`./${u[t].dist}/${e}/js/showcases`,entryFileNames:"[name].mjs"},[h.SectionAsset]:{pluginType:E.Misc,ssr:!1,outDir:(e,t)=>`./${u[t].dist}/${e}/assets`,assetFileNames:"[name].[ext]"},[h.TemplateDescriptor]:{pluginType:E.Misc,ssr:!1,outDir:()=>`./${P}/js`,entryFileNames:`[name]${L}.mjs`},[h.TemplateAsset]:{pluginType:E.Misc,ssr:!1,outDir:()=>`./${P}/assets`,assetFileNames:"[name].[ext]"}};function Mo(e){switch(typeof e){case"string":return[f(process.cwd(),e)];case"object":return e.map(t=>f(process.cwd(),t));default:return[]}}function $e(e,t,o,s){const n=v[o].define,r=v[o].ssrOptions,i=v[o].entryFileNames,a=v[o].chunkFileNames,y=v[o].assetFileNames,c=v[o].inlineDynamicImports,A=v[o].externalOption;return{plugins:Ro[v[o].pluginType],...n!=null&&{define:n},...r!=null&&{ssr:r},resolve:{alias:{"@":"/src"}},css:{preprocessorOptions:{scss:{api:"modern-compiler"}}},build:{ssr:v[o].ssr,outDir:v[o].outDir(e,s),emptyOutDir:!0,minify:"terser",terserOptions:{compress:{drop_console:!1}},rollupOptions:{...A!=null&&{external:A},preserveEntrySignatures:"strict",input:Mo(t),output:{validate:!0,inlineDynamicImports:c,...i!=null&&{entryFileNames:i},...a!=null&&{chunkFileNames:a},...y!=null&&{assetFileNames:y}}}}}}const be="https://json-schema.org/draft/2020-12/schema",Te="https://lightspeedhq.com/template-default.schema.json",Ee="Default Section",je="Default section for a Custom Template",we="object",Oe={"default-section":{type:"object",properties:{type:{description:"Type of the section",type:"string",const:"default"},id:{description:"Identification of the section",type:"string",pattern:"^((header|cover|announcement_bar|slider|special_offer|customer_review|company_info|shipping_payment|location|store|footer)(_\\d{3})?)$"},showcase_id:{description:"Showcase id of the section",type:"string"}},required:["type","id"],additionalProperties:!1}},qo={$schema:be,$id:Te,title:Ee,description:je,type:we,$defs:Oe},Uo={__proto__:null,$defs:Oe,$id:Te,$schema:be,default:qo,description:je,title:Ee,type:we},Se="https://json-schema.org/draft/2020-12/schema",ve="https://lightspeedhq.com/template-custom.schema.json",Ae="Custom Section",Ce="Custom section for a Custom Template",De="object",Ie={"custom-section":{type:"object",properties:{type:{description:"Type of the section",type:"string",const:"custom"},id:{description:"Identification of the section",type:"string"},showcase_id:{description:"Showcase id of the section",type:"string"},showcase_overrides:{$ref:"showcase_overrides.schema.json"}},required:["type","id"],additionalProperties:!1}},Xo={$schema:Se,$id:ve,title:Ae,description:Ce,type:De,$defs:Ie},zo={__proto__:null,$defs:Ie,$id:ve,$schema:Se,default:Xo,description:Ce,title:Ae,type:De},_e="https://json-schema.org/draft/2020-12/schema",Ne="https://lightspeedhq.com/template-custom-content.schema.json",xe="Custom Section :: Content Configuration",Le="Content tab configuration of a Custom Section for a Custom Template",Pe="object",ke={input_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"INPUTBOX"},text:{type:"string"}},required:["type","text"],additionalProperties:!1},text_area:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"TEXTAREA"},text:{type:"string"}},required:["type","text"],additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"BUTTON"},title:{type:"string"},buttonType:{type:"string",enum:["SCROLL_TO_TILE","HYPER_LINK","MAIL_LINK","TEL_LINK","GO_TO_STORE_LINK","GO_TO_PAGE"]},link:{type:"string",format:"uri"},linkTarget:{type:"string"},email:{type:"string"},phone:{type:"string"},tileId:{type:"string"}},required:["type","title"],additionalProperties:!1},image:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"IMAGE"},imageData:{type:"object",properties:{set:{type:"object"},borderInfo:{type:"object"},bucket:{type:"string"}},required:["set"]}},required:["type"],additionalProperties:!1},toggle:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"TOGGLE"},enabled:{type:"boolean"}},required:["type"],additionalProperties:!1},select_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"SELECTBOX"},value:{type:"string"}},required:["type"],additionalProperties:!1},logo:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"LOGO"},logoType:{description:"Type of the logo content",type:"string",enum:["TEXT","IMAGE"]},text:{description:"Logo content text",type:"string"},imageData:{type:"object",properties:{set:{type:"object"},borderInfo:{type:"object"},bucket:{type:"string"}},required:["set"]}},required:["type"],additionalProperties:!1},menu:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"MENU"}},required:["type"],additionalProperties:!1},deck:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"DECK"},cards:{type:"array",items:{type:"object",properties:{settings:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the settings configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]}},required:["type"],allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/input_box"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"template-custom-content.schema.json#/$defs/text_area"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-content.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/select_box"}}]}},minProperties:1}},required:["settings"]}}},required:["type","cards"]}},Ho={$schema:_e,$id:Ne,title:xe,description:Le,type:Pe,$defs:ke},Ko={__proto__:null,$defs:ke,$id:Ne,$schema:_e,default:Ho,description:Le,title:xe,type:Pe},Re="https://json-schema.org/draft/2020-12/schema",Ge="https://lightspeedhq.com/template-custom-design.schema.json",Fe="Custom Section :: Design Configuration",Be="Design tab configuration of a Custom Section for a Custom Template",Me="object",qe={text:{type:"object",properties:{type:{description:"Type of the text",type:"string",const:"TEXT"},font:{description:"Default font for the text",type:"string"},size:{description:"Default size for the text",type:"integer",minimum:1,exclusiveMaximum:50},bold:{description:"Default boldness for the text",type:"boolean"},italic:{description:"Default italic style for the text",type:"boolean"},color:{description:"Default color for the text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},visible:{description:"Default visibility for the text",type:"boolean"}},additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the button",type:"string",const:"BUTTON"},font:{description:"Default font for the button",type:"string"},size:{description:"Default size for the button",type:"string",enum:["SMALL","MEDIUM","LARGE"]},appearance:{description:"Default appearance for the button",type:"string",enum:["SOLID","OUTLINE","TEXT"]},shape:{description:"Default shape for the button",type:"string",enum:["ROUND_CORNER","RECTANGLE","PILL"]},color:{description:"Default color for the button",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"}},additionalProperties:!1},image:{type:"object",properties:{type:{description:"Type of the image",type:"string",const:"IMAGE"},overlay:{description:"Default overlay for the image",type:"string",enum:["COLOR","GRADIENT","NONE"]}},if:{properties:{overlay:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default color for the image",type:"array",items:{type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},minItems:2,maxItems:2}}},else:{properties:{color:{description:"Default color for the image",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"}}}},toggle:{type:"object",properties:{type:{description:"Type of the toggle",type:"string",const:"TOGGLE"},enabled:{description:"Default enabled status for the toggle",type:"boolean"}},additionalProperties:!1},select_box:{type:"object",properties:{type:{description:"Type of the checkbox",type:"string",const:"SELECTBOX"},value:{description:"Default option for the checkbox",type:"string"}},additionalProperties:!1},background:{type:"object",properties:{type:{description:"Type of the background",type:"string",const:"BACKGROUND"},style:{description:"Default style for the background",type:"string",enum:["COLOR","GRADIENT"]}},if:{properties:{style:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default colors for the image",type:"array",items:{type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},minItems:2,maxItems:2}}},else:{properties:{color:{description:"Default color for the image",type:"string"}}}},logo:{type:"object",properties:{type:{description:"Type of the logo",type:"string",const:"LOGO"},font:{description:"Default font for the text logo",type:"string"},size:{description:"Default size for the text logo",type:"integer",minimum:1,exclusiveMaximum:50},bold:{description:"Default boldness for the text logo",type:"boolean"},italic:{description:"Default italic style for the text logo",type:"boolean"},color:{description:"Default color for the text logo",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},visible:{description:"Default visibility for the logo",type:"boolean"},spacing:{description:"Default spacing size for the text logo",type:"integer",minimum:1,exclusiveMaximum:10},capitalization:{description:"Default capitalization style for the text logo",type:"string",enum:["none","all","small"]},frame:{description:"Default frame for the text logo",type:"object",properties:{visible:{description:"Default visibility for the frame on text logo",type:"boolean"},width:{description:"Default width size for the frame on text logo",type:"integer",minimum:1,exclusiveMaximum:50},color:{description:"Default color for the frame on text logo",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"}},required:["visible","width","color"],additionalProperties:!1}},additionalProperties:!1}},Vo={$schema:Re,$id:Ge,title:Fe,description:Be,type:Me,$defs:qe},Jo={__proto__:null,$defs:qe,$id:Ge,$schema:Re,default:Vo,description:Be,title:Fe,type:Me},Ue="https://json-schema.org/draft/2020-12/schema",Xe="https://lightspeedhq.com/section-content.schema.json",ze="Custom Section - Content",He="The content of a custom section",Ke="object",Ve={"^.*$":{type:"object",properties:{type:{type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","INFO","DECK","MENU","NAVIGATION_MENU","LOGO"]}},required:["type"],allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"#/$defs/Inputbox"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"#/$defs/Textarea"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"#/$defs/Button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"#/$defs/Image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"#/$defs/Toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"#/$defs/Selectbox"}},{if:{properties:{type:{const:"INFO"}}},then:{$ref:"#/$defs/Info"}},{if:{properties:{type:{const:"DECK"}}},then:{$ref:"#/$defs/Deck"}},{if:{properties:{type:{const:"MENU"}}},then:{$ref:"#/$defs/Menu"}},{if:{properties:{type:{const:"NAVIGATION_MENU"}}},then:{$ref:"#/$defs/NavigationMenu"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"#/$defs/Logo"}}]}},Je={Inputbox:{type:"object",properties:{type:{const:"INPUTBOX"},label:{type:"string"},placeholder:{type:"string"},defaults:{$ref:"#/$defs/InputboxDefaults"}},required:["type","label","placeholder"]},Textarea:{type:"object",properties:{type:{const:"TEXTAREA"},label:{type:"string"},placeholder:{type:"string"},defaults:{$ref:"#/$defs/TextareaDefaults"}},required:["type","label","placeholder"]},Button:{type:"object",properties:{type:{const:"BUTTON"},label:{type:"string"},defaults:{$ref:"#/$defs/ButtonDefaults"}},required:["type","label"]},Image:{type:"object",properties:{type:{const:"IMAGE"},label:{type:"string"},defaults:{$ref:"#/$defs/ImageDefaults"}},required:["type","label"]},Toggle:{type:"object",properties:{type:{const:"TOGGLE"},label:{type:"string"},description:{type:"string"},defaults:{$ref:"#/$defs/ToggleDefaults"}},required:["type","label","description"]},Selectbox:{type:"object",properties:{type:{const:"SELECTBOX"},label:{type:"string"},placeholder:{type:"string"},description:{type:"string"},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SelectboxDefaults"}},required:["type","label","placeholder","description","options"]},Menu:{type:"object",properties:{type:{const:"MENU"},label:{type:"string"}},required:["type"]},NavigationMenu:{type:"object",properties:{type:{const:"NAVIGATION_MENU"}},required:["type"]},Logo:{type:"object",properties:{type:{const:"LOGO"},label:{type:"string"}},required:["type"]},Info:{type:"object",properties:{type:{const:"INFO"},label:{type:"string"},description:{type:"string"},button:{$ref:"#/$defs/InfoEditorButton"},defaults:{$ref:"#/$defs/InfoDefaults"}},required:["type","label","description"]},InputboxDefaults:{type:"object",properties:{text:{type:"string"}},required:["text"]},TextareaDefaults:{type:"object",properties:{text:{type:"string"}},required:["text"]},ButtonDefaults:{type:"object",properties:{title:{type:"string"},buttonType:{type:"string",enum:["SCROLL_TO_TILE","HYPER_LINK","MAIL_LINK","TEL_LINK","GO_TO_STORE_LINK","GO_TO_PAGE"]},link:{type:"string",format:"uri"},linkTarget:{type:"string"},email:{type:"string"},phone:{type:"string"},tileId:{type:"string"}},required:["title"]},ImageDefaults:{type:"object",properties:{imageData:{$ref:"section-commons.schema.json#/$defs/Image"}}},ToggleDefaults:{type:"object",properties:{enabled:{type:"boolean"}}},SelectboxDefaults:{type:"object",properties:{value:{type:"string"}}},InfoDefaults:{type:"object",properties:{text:{type:"object",additionalProperties:{type:"string"}},button:{$ref:"#/$defs/InfoButtonDefaults"}}},SelectboxOption:{type:"object",properties:{label:{type:"string"},value:{type:"string"}}},InfoEditorButton:{type:"object",properties:{label:{type:"string"},link:{type:"string"}}},InfoButtonDefaults:{type:"object",properties:{title:{type:"string"},link:{type:"string",minLength:0}}},Deck:{type:"object",properties:{cards:{description:"Cards of the content configuration element",type:"object",properties:{settings:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the settings configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]}},required:["type"],allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"#/$defs/Inputbox"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"#/$defs/Textarea"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"#/$defs/ButtonDefaults"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"#/$defs/Image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"#/$defs/Toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"#/$defs/Selectbox"}}]}},minProperties:1}}}}}},Ze=!1,Zo={$schema:Ue,$id:Xe,title:ze,description:He,type:Ke,patternProperties:Ve,$defs:Je,additionalProperties:Ze},We={__proto__:null,$defs:Je,$id:Xe,$schema:Ue,additionalProperties:Ze,default:Zo,description:He,patternProperties:Ve,title:ze,type:Ke},Ye="https://json-schema.org/draft/2020-12/schema",Qe="https://lightspeedhq.com/sections/section-translation.schema.json",et="Custom Section - Translations",tt="The translation of the section's labels",ot="object",st={"^[a-z]{2}$":{type:"object",patternProperties:{"^\\$.*$":{type:"string"}},additionalProperties:!1}},nt=!1,Wo={$schema:Ye,$id:Qe,title:et,description:tt,type:ot,patternProperties:st,additionalProperties:nt},rt={__proto__:null,$id:Qe,$schema:Ye,additionalProperties:nt,default:Wo,description:tt,patternProperties:st,title:et,type:ot},it="https://json-schema.org/draft/2020-12/schema",at="https://lightspeedhq.com/section-design.schema.json",pt="Custom Section - Design",ct="The design of a custom section",lt="object",dt={"^.*$":{type:"object",properties:{type:{type:"string",enum:["TEXT","IMAGE","BUTTON","BACKGROUND","TOGGLE","COLOR_PICKER","RATING","SELECTBOX","SOCIAL_PROFILES","LOGO"]}},required:["type"],allOf:[{if:{properties:{type:{const:"TEXT"}}},then:{$ref:"#/$defs/Text"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"#/$defs/Image"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"#/$defs/Button"}},{if:{properties:{type:{const:"BACKGROUND"}}},then:{$ref:"#/$defs/Background"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"#/$defs/Toggle"}},{if:{properties:{type:{const:"COLOR"}}},then:{$ref:"#/$defs/Color"}},{if:{properties:{type:{const:"RATING"}}},then:{$ref:"#/$defs/Rating"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"#/$defs/Selectbox"}},{if:{properties:{type:{const:"SOCIAL_PROFILES"}}},then:{$ref:"#/$defs/SocialProfile"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"#/$defs/Logo"}}]}},ft={Text:{type:"object",properties:{type:{const:"TEXT"},label:{type:"string"},sizes:{type:"array",items:{type:"integer"}},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},hideSize:{type:["boolean","null"]},defaults:{$ref:"#/$defs/TextDesignDefaults"}},required:["type","label"]},Image:{type:"object",properties:{type:{const:"IMAGE"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},defaults:{$ref:"#/$defs/ImageDesignDefaults"}},required:["type","label"]},Button:{type:"object",properties:{type:{const:"BUTTON"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAutoColor:{type:["boolean","null"]},enableAlphaColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},hideSize:{type:["boolean","null"]},defaults:{$ref:"#/$defs/ButtonDesignDefaults"}},required:["type","label"]},Background:{type:"object",properties:{type:{const:"BACKGROUND"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},defaults:{$ref:"#/$defs/BackgroundDesignDefaults"}},required:["type","label"]},Toggle:{type:"object",properties:{type:{const:"TOGGLE"},label:{type:"string"},description:{type:"string"},defaults:{$ref:"#/$defs/ToggleDesignDefaults"}},required:["type","label"]},Color:{type:"object",properties:{type:{const:"COLOR_PICKER"},label:{type:"string"},description:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},defaults:{$ref:"#/$defs/ColorPickerDefaults"}},required:["type","label"]},Rating:{type:"object",properties:{type:{const:"RATING"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/RatingDefaults"}},required:["type","label"]},Selectbox:{type:"object",properties:{type:{const:"SELECTBOX"},label:{type:"string"},description:{type:"string"},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SelectboxDefaults"}},required:["type","label"]},SocialProfile:{type:"object",properties:{type:{const:"SOCIAL_PROFILES"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SocialProfilesDefaults"}},required:["type","label"]},Logo:{type:"object",properties:{type:{const:"LOGO"},label:{type:"string"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},sizes:{type:"array",items:{type:"integer"}},defaults:{$ref:"#/$defs/LogoDesignDefaults"}},required:["type"]},TextDesignDefaults:{type:"object",properties:{font:{type:"string"},size:{oneOf:[{type:"integer"},{type:"string"}]},bold:{type:"boolean"},italic:{type:"boolean"},color:{type:"string"},visible:{type:"boolean"}},required:[]},ImageDesignDefaults:{type:"object",properties:{overlay:{type:"string"},visible:{type:"boolean"}},required:[]},ButtonDesignDefaults:{type:"object",properties:{appearance:{type:"string",enum:["SOLID","OUTLINE","TEXT"]},font:{type:"string"},size:{type:"string",enum:["SMALL","MEDIUM","LARGE"]},style:{type:"string",enum:["round-corner","rectangle","pill"]},color:{type:"string"},visible:{type:"boolean"}},required:[]},BackgroundDesignDefaults:{type:"object",properties:{appearance:{$ref:"section-commons.schema.json#/$defs/Background"}},required:[]},ToggleDesignDefaults:{type:"object",properties:{enabled:{type:"boolean"}},required:[]},ColorPickerDefaults:{type:"object",properties:{appearance:{$ref:"section-commons.schema.json#/$defs/Color"}},required:[]},RatingDefaults:{type:"object",properties:{color:{$ref:"section-commons.schema.json#/$defs/Color"},visible:{type:"boolean"},style:{type:"string"}},required:[]},SelectboxDefaults:{type:"object",properties:{value:{type:"string"}},required:[]},SocialProfilesDefaults:{type:"object",properties:{color:{$ref:"section-commons.schema.json#/$defs/Color"},visible:{type:"boolean"},appearance:{type:"string"}},required:[]},LogoDesignDefaults:{type:"object",properties:{font:{type:"string"},size:{oneOf:[{type:"integer"},{type:"string"}]},bold:{type:"boolean"},italic:{type:"boolean"},color:{type:"string"},visible:{type:"boolean"}},required:[]},SelectboxOption:{type:"object",properties:{value:{type:"string"},label:{type:"string"}},required:[]}},Yo={$schema:it,$id:at,title:pt,description:ct,type:lt,patternProperties:dt,$defs:ft},ut={__proto__:null,$defs:ft,$id:at,$schema:it,default:Yo,description:ct,patternProperties:dt,title:pt,type:lt},yt="https://json-schema.org/draft/2020-12/schema",mt="https://lightspeedhq.com/section-commons.schema.json",gt="Custom Section - Content",ht="The content of a custom section",$t="object",bt={Image:{type:"object",properties:{set:{type:"object",additionalProperties:{$ref:"#/$defs/ImageInfo"}},borderInfo:{$ref:"#/$defs/BorderInfo"},bucket:{type:"string"}},required:["set"]},ImageInfo:{type:"object",properties:{url:{type:"string"},width:{type:"integer",minimum:0},height:{type:"integer",minimum:0}}},BorderInfo:{type:"object",properties:{homogeneity:{type:"boolean"},color:{$ref:"#/$defs/RGBA"}}},RGBA:{type:"object",properties:{r:{type:"integer",minimum:0,maximum:255},g:{type:"integer",minimum:0,maximum:255},b:{type:"integer",minimum:0,maximum:255},a:{type:"number",format:"double",minimum:0,maximum:1}},required:["r","g","b","a"]},HSL:{type:"object",properties:{h:{type:"number",format:"double"},s:{type:"number",format:"double"},l:{type:"number",format:"double"},a:{type:"number",format:"double"}},required:["h","s","l","a"]},Overlay:{type:"object",properties:{type:{type:"string",enum:["solid","gradient","none"]},solid:{$ref:"#/$defs/Solid"},gradient:{$ref:"#/$defs/Gradient"}}},Solid:{type:"object",properties:{color:{$ref:"#/$defs/Color"}}},Gradient:{type:"object",properties:{fromColor:{$ref:"#/$defs/Color"},toColor:{$ref:"#/$defs/Color"}}},Background:{type:"object",properties:{type:{type:"string",enum:["solid","gradient"]},solid:{$ref:"#/$defs/Solid"},gradient:{$ref:"#/$defs/Gradient"}}},Color:{type:"object",properties:{raw:{type:"string"},hex:{type:"string"},auto:{type:"boolean"},rgba:{$ref:"#/$defs/RGBA"},hsl:{$ref:"#/$defs/HSL"}}}},Tt=!1,Qo={$schema:yt,$id:mt,title:gt,description:ht,type:$t,$defs:bt,additionalProperties:Tt},es={__proto__:null,$defs:bt,$id:mt,$schema:yt,additionalProperties:Tt,default:Qo,description:ht,title:gt,type:$t},Et="https://json-schema.org/draft/2020-12/schema",jt="https://lightspeedhq.com/section-showcase.schema.json",wt="Custom Section - Showcase settings",Ot="The setting of a showcase",St="object",vt=["showcaseId","previewImage"],At={showcaseId:{description:"Showcase id of the section",type:"string"},previewImage:{$ref:"section-commons.schema.json#/$defs/Image"},showcase_overrides:{$ref:"../showcase_overrides.schema.json"}},ts={$schema:Et,$id:jt,title:wt,description:Ot,type:St,required:vt,properties:At},Ct={__proto__:null,$id:jt,$schema:Et,default:ts,description:Ot,properties:At,required:vt,title:wt,type:St},Dt="https://json-schema.org/draft/2020-12/schema",It="https://lightspeedhq.com/template.schema.json",_t="Custom Template",Nt="A custom template enclosing the necessary custom and default blocks",xt="object",Lt={metadata:{type:"object",properties:{name:{description:"Name of the template",type:"string",minLength:2,maxLength:60},description:{description:"Short description of the template",type:"string",minLength:2,maxLength:150},preview_url:{description:"Preview url of the demo website",type:"string",format:"uri",pattern:"^(https?)://([^.]+?\\.)company\\.site($|/[A-Za-z0-9\\-._~:/?#\\[\\]@!$&'()*+,;=]*)?$"},cover_image:{type:"object",properties:{set:{description:"Name of the image set",type:"object",patternProperties:{".*":{type:"object",properties:{url:{description:"Path to the preview image relative to the 'assets' folder for a specific resolution",type:"string"}},required:["url"],additionalProperties:!1}}}},required:["set"],additionalProperties:!1}},required:["name","description","cover_image"],additionalProperties:!1},sections:{description:"List of sections contained by this template",type:"array",items:{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]}},allOf:[{if:{properties:{type:{const:"default"}}},then:{$ref:"template-default.schema.json#/$defs/default-section"}},{if:{properties:{type:{const:"custom"}}},then:{$ref:"template-custom.schema.json#/$defs/custom-section"}}]},minItems:1,uniqueItems:!1}},Pt=["metadata","sections"],os={$schema:Dt,$id:It,title:_t,description:Nt,type:xt,properties:Lt,required:Pt},kt={__proto__:null,$id:It,$schema:Dt,default:os,description:Nt,properties:Lt,required:Pt,title:_t,type:xt},Rt="https://json-schema.org/draft/2020-12/schema",Gt="https://lightspeedhq.com/showcase_overrides.schema.json",Ft="Showcase overrides",Bt="Overrides for the showcase",Mt="object",qt={content:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","LOGO","DECK","MENU","NAVIGATION_MENU"]}},allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/input_box"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"template-custom-content.schema.json#/$defs/text_area"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-content.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/select_box"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"template-custom-content.schema.json#/$defs/logo"}},{if:{properties:{type:{const:"DECK"}}},then:{$ref:"template-custom-content.schema.json#/$defs/deck"}}]}},minProperties:1},design:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the design configuration element",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND","LOGO"]}},allOf:[{if:{properties:{type:{const:"TEXT"}}},then:{$ref:"template-custom-design.schema.json#/$defs/text"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-design.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-design.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-design.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-design.schema.json#/$defs/select_box"}},{if:{properties:{type:{const:"BACKGROUND"}}},then:{$ref:"template-custom-design.schema.json#/$defs/background"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"template-custom-design.schema.json#/$defs/logo"}}]}},minProperties:1},layoutId:{description:"Layout ID for the showcase",type:"string"},blockName:{description:"Section name for the showcase",type:"string"}},ss={$schema:Rt,$id:Gt,title:Ft,description:Bt,type:Mt,properties:qt},ns={__proto__:null,$id:Gt,$schema:Rt,default:ss,description:Bt,properties:qt,title:Ft,type:Mt};var F=(e=>(e.CONTENT="Content",e.DESIGN="Design",e))(F||{});const rs={menu:{type:"NAVIGATION_MENU"},logo:{type:"LOGO"}},is={logo:{type:"LOGO",colors:["#FFFFFF66","#0000004D","#00000099","#64C7FF66","#F9947266","#C794CD66","#FFD17466"],sizes:[18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60],defaults:{font:"global.fontFamily.body",size:40,bold:!0,italic:!1,color:"#313131",visible:!0,spacing:2,capitalization:"all",frame:{visible:!0,width:3,color:"#313131"}}}};function Ut(e){switch(e){case Q.HEADER:return rs;default:return{}}}function Xt(e){switch(e){case Q.HEADER:return is;default:return{}}}function as({validationType:e,sectionType:t}){switch(e){case F.CONTENT:return Ut(t);case F.DESIGN:return Xt(t);default:return{}}}function ps(e){return Object.keys(e).length===0}function cs({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).filter(([s])=>t[s]!==void 0).forEach(([s,n])=>{const r=t[s];n.type!==r.type&&o.push({instancePath:s,keyword:"type-mismatch",message:`Editor type "${n.type}" for reserved key "${s}" does not match the required type "${r.type}".`})}),o}function ls({type:e,mandatorySettings:t}){return Object.keys(t).find(o=>t[o].type===e)}function ds({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).forEach(([s,n])=>{const r=ls({type:n.type,mandatorySettings:t});r&&s!==r&&o.push({instancePath:s,keyword:"key-mismatch",message:`Editor key "${s}" for overriden content type "${n.type}" does not match the required key name "${r}".`})}),o}function fs({type:e,mandatorySettings:t}){return Object.keys(t).findLast(o=>t[o].type===e)}function us({sectionSettings:e,mandatorySettings:t}){const o=[],s=Object.values(t).map(({type:r})=>r),n=Object.values(e).map(({type:r})=>r);return new Set(n.filter(r=>s.includes(r))).forEach(r=>{if(n.filter(i=>i===r).length>1){const i=fs({type:r,mandatorySettings:t});o.push({instancePath:i,keyword:"duplicate-type",message:`Editor type "${r}" can only be used once.`})}}),o}function ys(e,t){const{sectionSettings:o,sectionType:s}=t,n=as({validationType:e,sectionType:s});return n===void 0||ps(n)?[]:[...cs({sectionSettings:o,mandatorySettings:n}),...ds({sectionSettings:o,mandatorySettings:n}),...us({sectionSettings:o,mandatorySettings:n})]}const B=[es,ut,We,Ct,kt,Uo,zo,Ko,Jo,ns];function M(e,t){const o=new Eo({allErrors:!0,schemas:e});return jo(o),o.compile(t)}function ms(){return M(B,kt)}function zt(e){return e.map(t=>({instancePath:t.instancePath,message:t.message??"",keyword:t.keyword}))}const gs=e=>(()=>{const t=Go(e.name),o=t.split("/").pop()?.toLowerCase();return[{source:`./${o}/${e.name}/settings/content.ts`,dist:S.resolve(`${t}/${e.name}/js/settings/content`),ajv:M(B,We),validationType:F.CONTENT,sectionName:e.name},{source:`./${o}/${e.name}/settings/design.ts`,dist:S.resolve(`${t}/${e.name}/js/settings/design`),ajv:M(B,ut),validationType:F.DESIGN,sectionName:e.name},{source:`./${o}/${e.name}/settings/translations.ts`,dist:S.resolve(`${t}/${e.name}/js/settings/translations`),ajv:M(B,rt)},...e.showcaseEntryPoints.map(s=>({source:`./${o}/${e.name}/showcases/${x(s).name}.ts`,dist:S.resolve(`${t}/${e.name}/js/showcases/${x(s).name}`),ajv:M(B,s.indexOf("translations")===-1?Ct:rt)}))]})();function hs(e){const t=n=>{const r=(n??"").split("/").filter(i=>i.length>0);return r.length===0?"$":`$${r.map(i=>`.${i}`).join("")}`};let o=0,s=0;Object.keys(e).forEach(n=>{const r=e[n];o=Math.max(o,Math.max(...r.map(i=>t(i.instancePath).length))),s=Math.max(s,Math.max(...r.map(i=>i.message.length)))}),Object.keys(e).forEach(n=>{const r=e[n].filter((i,a,y)=>a===y.findIndex(c=>`${i.instancePath}${i.message}${i.keyword}`==`${c.instancePath}${c.message}${c.keyword}`));p.error(n),r.filter(i=>i.keyword!=="if").forEach(i=>{p.error(`${t(i.instancePath).padEnd(o," ")} | ${i.message.padEnd(s," ")} | ${i.keyword||"-"}`)})})}async function H(e,t){try{const o=f(wo.cwd(),t?`${e}${L}.mjs`:`${e}.mjs`);return(await import(_(o).href)).default}catch{throw new Error(`File [${e}${L}.mjs] is either invalid or undefined`)}}function $s(e,t){if(e.validationType===void 0||e.sectionName===void 0)return[];const{sectionName:o,validationType:s}=e,n=G(o);return[...ys(s,{sectionSettings:t,sectionType:n})]}async function bs(e){const t=await H(e.dist,!1),o={},s=[];e.ajv(t)||s.push(...zt(e.ajv.errors??[]));const n=$s(e,t);return n.length>0&&s.push(...n),s.length>0&&(o[e.source]=s),o}function Ts(e){const t=e.reduce((o,s)=>{const n=fo(s);return n.size>ue&&(o[s]=V(n.size)),o},{});if(Object.keys(t).length!==0){const o=Math.max(...Object.keys(t).map(s=>s.length));p.error(`Size of individual assets must not exceed threshold [${V(ue)}]!`);for(const s in t)p.error(`${`File: ${s}`.padEnd(o+10)}| ${t[s]}`);throw new Error("Invalid asset file size")}}function Es(e,t,o,s){const n={};return e(t)&&s===void 0?co(`${o}${L}.mjs`,`${o}.mjs`,()=>{}):(lo(`${o}${L}.mjs`,()=>{}),n[S.resolve(`./templates/${x(o).name}.ts`)]=[...zt(e.errors??[]),...s??[]]),n}async function js(e){const t=[];for(const o of e.sections){const s=e.sections.indexOf(o);if(s===0){const n=o.id==="header"&&o.type==="default",r=O(`${J}/${o.id}`);!n&&!r&&t.push({instancePath:`/sections/${s}/id`,message:"The first section must be a `header`",keyword:"required"})}else if(s===e.sections.length-1){const n=o.id==="footer"&&o.type==="default",r=O(`${Z}/${o.id}`);!n&&!r&&t.push({instancePath:`/sections/${s}/id`,message:"The last section must be a `footer`",keyword:"required"})}else if(o.type==="custom")if(!O(`${g}/${o.id}`))t.push({instancePath:`/sections/${s}/id`,message:"Custom section must have a corresponding block defined",keyword:"required"});else{if(o.content!==void 0)if(!O(`${g}/${o.id}/js/settings/content.mjs`))t.push({instancePath:`/sections/${s}/content`,message:"Content descriptor is overridden, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const n=await H(`${g}/${o.id}/js/settings/content`,!1),r=new Set(Object.keys(n));Object.keys(o.content).every(i=>r.has(i))||t.push({instancePath:`/sections/${s}/content`,message:"Content descriptor must be a subset of the default content descriptor",keyword:"type"})}if(o.design!==void 0)if(!O(`${g}/${o.id}/js/settings/design.mjs`))t.push({instancePath:`/sections/${s}/design`,message:"Design descriptor is overridden, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const n=await H(`${g}/${o.id}/js/settings/design`,!1),r=new Set(Object.keys(n));Object.keys(o.design).every(i=>r.has(i))||t.push({instancePath:`/sections/${s}/design`,message:"Design descriptor must be a subset of the default design descriptor",keyword:"type"})}o.showcase_id!==void 0&&(O(`${g}/${o.id}/js/showcases/${o.showcase_id}.mjs`)||t.push({instancePath:`/sections/${s}/showcase-id`,message:"Custom section must have a corresponding showcase defined in case showcase_id is specified",keyword:"required"}))}}return t.length===0?void 0:t}function ws(e){return Object.entries(u).find(t=>t[1].source===e)?.[0]}async function Os(){const e=await m("**/server.{js,ts}",{ignore:["node_modules/**","dist/**"]});return Promise.all(e.map(async t=>{const o=go(t).split(ho),s=o.pop()??"default",n=o.pop();if(n===void 0)throw new Error("Cannot determine type of section, outer directory is undefined");const r=await m(`**/${s}/client.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),i=await m(`**/${s}/settings/content.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),a=await m(`**/${s}/settings/design.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),y=await m(`**/${s}/settings/layout.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),c=await m(`**/${s}/settings/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),A=await m(`**/${s}/showcases/*.{js,ts}`,{ignore:["node_modules/**","dist/**",`**/${s}/showcases/translations.{js,ts}`]}),no=await m(`**/${s}/showcases/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),ro=await m(`**/${s}/assets/*`,{ignore:["node_modules/**","dist/**"]});return{name:s,type:ws(n),serverEntrypoint:t,clientEntrypoint:r.at(0),contentSettingsEntrypoint:i.at(0),designSettingsEntrypoint:a.at(0),layoutSettingsEntrypoint:y.at(0),settingsTranslationsEntrypoint:c.at(0),showcasesEntrypoints:A,showcasesTranslationsEntrypoint:no.at(0),assetsEntrypoints:ro}}))}async function Ss(){const e=await m("./templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]}),t=await m("./templates/assets/*",{ignore:["node_modules/**","dist/**"]});return{templates:e,assets:t}}async function k(e,t,o,s="SECTION"){t.length!==0&&await ie({configFile:!1,...ae($e(e,t,o,s))})}function vs(){return uo.rm("dist",{recursive:!0,force:!0})}async function As(e){return Ts(e.assetEntryPoints),await ie({configFile:!1,...ae($e(e.name,e.serverEntrypoint,h.Server,e.type))}),await k(e.name,e.clientEntrypoint,h.Client,e.type),await k(e.name,e.settingsEntryPoints,h.SectionSetting,e.type),await k(e.name,e.showcaseEntryPoints,h.SectionShowcase,e.type),await k(e.name,e.assetEntryPoints,h.SectionAsset,e.type),await gs(e).reduce(async(t,o)=>{const s=await t,n=await bs(o);return{...s,...n}},Promise.resolve({}))}async function Cs(e){return e.reduce(async(t,o)=>{const s=await t,n=await As(o);return{...s,...n}},Promise.resolve({}))}async function Ds(){const e=await Ss();if(e.templates.length===0)return{};const t=await ms();return await k(void 0,e.assets,h.TemplateAsset),await k(void 0,e.templates,h.TemplateDescriptor),e.templates.reduce(async(o,s)=>{const n=await o,r=`${P}/js/${x(s).name}`,i=await H(r,!0);return{...n,...Es(t,i,r,await js(i))}},Promise.resolve({}))}async function Is(){await vs();try{const e=await Os().then(o=>o.map(s=>({name:s.name,type:s.type,serverEntrypoint:s.serverEntrypoint,clientEntrypoint:[s.clientEntrypoint].filter(W).flat(),settingsEntryPoints:[s.contentSettingsEntrypoint,s.designSettingsEntrypoint,s.layoutSettingsEntrypoint,s.settingsTranslationsEntrypoint].filter(W),showcaseEntryPoints:[...s.showcasesEntrypoints??[],s.showcasesTranslationsEntrypoint].filter(W),assetEntryPoints:s.assetsEntrypoints??[]}))),t={...await Cs(e),...await Ds()};Object.keys(t).length===0?p.info("Build successful. For deploy run: npx @lightspeed/crane@latest deploy"):(p.error("Error during build:"),hs(t))}catch(e){p.error(`Error while building: ${e.message}`),process.exit(1)}}function ee(e,t){return Object.keys(e).reduce((o,s)=>{const n=e[s],r=t[s];return ye(n)&&ye(r)?o[s]=ee(n,r):o[s]=n,o},{...t})}function _s({contentSettings:e,sectionType:t}){const o=Ut(t);return ee(e,o)}function Ns({designSettings:e,sectionType:t}){const o=Xt(t);return ee(e,o)}function te(e){if(e!==void 0)return e.startsWith("global.")?{type:"GLOBAL_FONT",font:e}:{type:"PRESET_FONT",font:e}}function j(e){if(e===void 0)return;if(e.startsWith("global."))return{type:"GLOBAL_COLOR",raw:e};const t=Ao(e);return{type:"STRUCTURED_COLOR",raw:e,hex:t.toHex8String(),hsl:t.toHsl(),rgba:t.toRgb(),auto:!1}}function Ht(e){if(e!==void 0)return typeof e=="string"&&e.startsWith("global.")?{type:"GLOBAL_TEXT_SIZE",size:e}:{type:"NUMERIC_TEXT_SIZE",size:Number(e)}}const xs={COLOR:"COLOR",GRADIENT:"GRADIENT"};function Ls(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(xs)}`)}}function Ps(e){const t=e.style,o=e.color,s=Array.isArray(o)?o:[o,o];return e.background={type:Ls(t),solid:{color:j(s.at(0))},gradient:{fromColor:j(s.at(0)),toColor:j(s.at(1))}},e.style=void 0,e.color=void 0,e}const ks={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"};function Rs(e){switch(e){case"SOLID":return"solid-button";case"OUTLINE":return"outline-button";case"TEXT":return"text-link";default:throw new Error(`Unknown button appearance: ${e}. Right options: ${Object.keys(ks)}`)}}const Gs={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"};function Fs(e){switch(e){case"SMALL":return"small";case"MEDIUM":return"medium";case"LARGE":return"large";default:throw new Error(`Unknown button size: ${e}. Right options: ${Object.keys(Gs)}`)}}const Bs={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"};function Ms(e){switch(e){case"ROUND_CORNER":return"round-corner";case"RECTANGLE":return"rectangle";case"PILL":return"pill";default:throw new Error(`Unknown button shape: ${e}. Right options: ${Object.keys(Bs)}`)}}function qs(e){const t=e.appearance;t!==void 0&&(e.appearance=Rs(t));const o=e.size;o!==void 0&&(e.size=Fs(o));const s=e.shape;s!==void 0&&(e.style=Ms(s),e.shape=void 0);const n=e.font;e.font=te(n);const r=e.color;return e.color=j(r),e}const Us={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"};function Xs(e){switch(e){case"COLOR":return"solid";case"GRADIENT":return"gradient";case"NONE":return"none";default:throw new Error(`Unknown image overlay type: ${e}. Right options: ${Object.keys(Us)}`)}}function zs(e){const t=e.overlay,o=e.color,s=Array.isArray(o)?o:[o,o];return e.overlay={type:Xs(t),solid:{color:j(s.at(0))},gradient:{fromColor:j(s.at(0)),toColor:j(s.at(1))}},e.color=void 0,e}function Hs(e){const t=e.font;e.font=te(t);const o=e.color;e.color=j(o);const s=e.size;return e.size=Ht(s),e}function Ks(e){const t=e.color;return e.color=j(t),e}function Vs(e){const t=e.font;e.font=te(t);const o=e.color;e.color=j(o);const s=e.size;if(e.size=Ht(s),e.frame!==void 0){const n=e.frame.color;e.frame.color=j(n)}return e}function oe(e,t){switch(e){case"TEXT":{Hs(t);break}case"BUTTON":{qs(t);break}case"IMAGE":{zs(t);break}case"BACKGROUND":{Ps(t);break}case"COLOR_PICKER":{Ks(t);break}case"LOGO":{Vs(t);break}case"TOGGLE":case"SELECTBOX":break;default:throw new Error(`Unknown design editor type: ${e}`)}return t}function Js(e){Object.keys(e).forEach(t=>{const o=e[t],s=o.type;oe(s,o.defaults)})}function Zs(e){e.forEach(t=>{t.type!==void 0&&t.defaults!==void 0&&(oe(t.type,t.defaults),t.defaults.type=t.type)})}function Kt(e){Object.keys(e).forEach(t=>{const o=e[t],s=o.type;oe(s,o)})}const Ws=200;var $=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.ClientChunks=2]="ClientChunks",e[e.ClientAsset=3]="ClientAsset",e[e.Asset=4]="Asset",e[e.TemplateAsset=5]="TemplateAsset",e[e.Dependency=6]="Dependency",e))($||{});const Vt={[$.Server]:{type:"server_js_compressed",fileName:"server.js.gz",isSingleton:!0,toPath:(e,t)=>`${u[t].dist}/${e}/js/main/server/`},[$.Client]:{type:"client_js",fileName:"client.js",isSingleton:!1,toPath:(e,t)=>`${u[t].dist}/${e}/js/main/client/`},[$.ClientChunks]:{type:"client_js_chunks",isSingleton:!1,toPath:(e,t)=>`${u[t].dist}/${e}/js/main/client/chunks/`,fileName:"*"},[$.ClientAsset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:(e,t)=>`${u[t].dist}/${e}/js/main/client/assets/`},[$.Asset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:(e,t)=>`${u[t].dist}/${e}/assets/`},[$.TemplateAsset]:{type:"template_assets",fileName:"*",isSingleton:!1,toPath:()=>`${P}/assets/`},[$.Dependency]:{type:"dependencies",fileName:"package.json",isSingleton:!0,toPath:()=>{}}},Ys=e=>`\x1B[32m${e}\x1B[0m`,Qs=(e,t,o,s,n)=>{if(!e.total)return;const{loaded:r}=e,i=(Date.now()-n)/1e3;o.value+=r-s.value,s.value=r,t.update({speed:`${V(o.value/i,2)}/s`})},en=()=>new Co.SingleBar({format:`|${Ys("{bar}")}| {status} || {percentage}% || {value}/{total} Files || Speed: {speed}`,barCompleteChar:"\u2588",barIncompleteChar:"\u2591"}),tn="https://blockbuster.ecwid.com",on="/api/v1/custom-apps/resources/sections/upload",sn="/api/v1/custom-apps/resources/templates/upload",nn="/api/v1/custom-apps/manifests/sections",rn="/api/v1/custom-apps/manifests/templates",an=5,pn=3,cn=[$.Server,$.Client,$.ClientChunks,$.ClientAsset,$.Asset],ln=[$.Dependency,$.TemplateAsset],dn={value:0},C=en();let Jt=Date.now();async function fn(){const e=await le(f(l.cwd(),"crane.config.json")),t=JSON.parse(e.toString());return{appClientId:t.app_client_id,appSecretKey:btoa(t.app_secret_key)}}async function un(){const e=f(l.cwd(),"package.json"),t=await le(e),o=JSON.parse(t.toString());if(yn(o))return o;throw new Error(`Package file located at path: ${e} does not contain a version field`)}function yn(e){return typeof e=="object"&&e!==null&&"version"in e&&typeof e.version=="string"}async function mn(e){const t=So(e.version,"patch");if(t===null)throw Error("Error while incrementing app version");e.version=t,yo(f(l.cwd(),"package.json"),`${JSON.stringify(e,null,2)}
|
|
3
|
+
`)}async function gn(e,t,o=g){try{const s=f(l.cwd(),`${o}/${e}/js/settings/content.mjs`),n=(await import(_(s).href)).default,r=G(e),i=_s({contentSettings:n,sectionType:r});return q(i,t),i}catch{throw new Error(`Content descriptor for section [${e}] is either invalid or undefined`)}}async function hn(e,t,o=g){try{const s=f(l.cwd(),`${o}/${e}/js/settings/design.mjs`),n=(await import(_(s).href)).default,r=G(e),i=Ns({designSettings:n,sectionType:r});return Js(i),q(i,t),i}catch(s){const n=s;throw new Error(`Design settings is invalid or undefined. Error ${n.stack}`)}}async function $n(e,t,o=g){try{const s=await m("*.mjs",{cwd:f(l.cwd(),`${o}/${e}/js/showcases/`),ignore:"**/translations.mjs"});return Promise.all(s.map(async n=>{const r=f(l.cwd(),`${o}/${e}/js/showcases/${n}`),i=(await import(_(r).href)).default;return Kt(i.design),q(i,t),i}))}catch(s){throw new Error(`Showcases is invalid or undefined. Error ${s}`)}}async function bn(e,t=g){try{const o=f(l.cwd(),`${t}/${e}/js/settings/layout.mjs`);if(!O(o))return[];const s=(await import(_(o).href)).default;return s.forEach(n=>Zs(n.selectedDesignSettings)),s}catch{throw new Error(`Layout descriptor for section [${e}] is either invalid or undefined`)}}async function Tn(e,t=g){return await Wt(`${t}/${e}/js/settings/translations.mjs`)}async function Zt(e,t=g){return await Wt(`${t}/${e}/js/showcases/translations.mjs`)}async function Wt(e){const t=f(l.cwd(),e),o=(await import(_(t).href)).default;return jn(o)}function q(e,t){if(e&&typeof e=="object"){const o=e;for(const s in o){const n=o[s];typeof n=="string"&&n.startsWith("$")&&(o[s]=En(t,n)),typeof n=="object"&&q(n,t)}}}function En(e,t){if(!t)return;const o=e[t];return o===void 0?{en:t}:o}function jn(e){const t={};for(const o in e){const s=e[o];for(const n in s){const r=t[n],i=s[n];if(r===void 0){const a={};a[o]=i,t[n]=a}else r[o]=i}}return t}async function se(e,t){const o=await Tn(e,u[t].dist),s=await Zt(e,u[t].dist),n=await gn(e,o,u[t].dist),r=await hn(e,o,u[t].dist),i=await $n(e,s,u[t].dist),a=await bn(e,u[t].dist);return{id:e,type:t,name:{en:e},contentEditors:n,designEditors:r,layouts:a,showcases:i}}async function wn(){const e=await m("*/",{cwd:f(l.cwd(),`${g}/`)}),t=await m("*/",{cwd:f(l.cwd(),`${J}/`)}),o=await m("*/",{cwd:f(l.cwd(),`${Z}/`)});return Promise.all([...e.map(async s=>se(s,"SECTION")),...t.map(async s=>se(s,"HEADER")),...o.map(async s=>se(s,"FOOTER"))])}async function On(e){try{return(await import(_(f(l.cwd(),e)).href)).default}catch{throw new Error(`Template descriptor [${e}] is either invalid or undefined`)}}async function Sn(){const e=await m(`${P}/js/**.mjs`,{ignore:[`${P}/js/**${L}.mjs`]});return Promise.all(e.map(async t=>{const o=await On(t),s=o.sections.filter(n=>n.type==="custom");for(const n of s){const r=G(n.id),i=await Zt(n.id,u[r].dist);n.showcase_overrides!==void 0&&(q(n.showcase_overrides,i),Kt(n.showcase_overrides.design))}return{id:`${x(l.cwd()).name.replace(/[^a-zA-Z0-9]/g,"_")}_${x(t).name}`,descriptor:o}}))}function Yt(e,t,o){const s=e.pathContext,n=s.toPath(e.currentSection,o),r=n===void 0?re(s.fileName):re(s.fileName,{cwd:f(l.cwd(),n),ignore:s.ignore});return(s.isSingleton?r.splice(0):r).map(i=>({url:i,subType:o,context:e}))}function Qt(e,t,o,s){const n={value:0},r=e.config.app.templates.length>0?sn:on;return e.config.axios.post(r,{file:mo(f(l.cwd(),o!==void 0?o+t:t))},{params:{appClientId:e.config.app.crane.appClientId,type:e.pathContext.type,version:e.config.app.packageJson.version,...e.currentSection!==void 0&&{block:e.currentSection},...e.pathContext.type!=="dependencies"&&{fileName:t}},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${e.config.app.crane.appSecretKey}`},onUploadProgress:i=>Qs(i,C,dn,n,Jt)}).then(i=>(C.increment(),{status:i.status})).catch(async i=>eo(s,i)?(await to(s),Qt(e,t,o,s+1)):(C.increment(),{status:i.response?.status,message:i.message}))}function vn(e){return C.start(e.length+1,0,{speed:"N/A",status:"Deployment in progress"}),e.map(t=>{const o=t.context,s=o.pathContext.toPath(o.currentSection,t.subType);return Qt(o,t.url,s,0)})}function An(e){const t=e.app.sections.flatMap(s=>cn.flatMap(n=>{const r={config:e,currentSection:s.id,pathContext:Vt[n]};return Yt(r,n,s.type)})),o=ln.flatMap(s=>Yt({config:e,pathContext:Vt[s]},s,"SECTION"));return vn([...t,...o])}function Cn(e){return e instanceof de&&(e.code==="ECONNRESET"||e.response?.status!==void 0&&e.response?.status>=500&&e.response?.status<600)}function eo(e,t){return e<pn&&Cn(t)}async function to(e){await new Promise(t=>{setTimeout(t,2**e*500)})}function Dn(e){return e.includes(`
|
|
4
|
+
`)}function In(e,t,o){return e.split(`
|
|
5
|
+
`).map((s,n)=>n>=o?t+s:s).join(`
|
|
6
|
+
`)}function oo(e,t){const o=[];if(e instanceof de){e.response?.status!==void 0&&o.push(` HTTP Status Code: ${e.response.status}`);const r=e.response?.data;if(r?.errorCode&&o.push(` Error Code: ${r.errorCode}`),r?.errorMessage){const i=Dn(r.errorMessage)?In(r.errorMessage," ",1):r.errorMessage;o.push(` Error Message: ${i}`)}}const s=o.length>0?o.join(`
|
|
7
|
+
`):e?.message??"Unknown error";if(!t||t.length===0)return s;const n=o.length>0?`
|
|
8
|
+
`:" ";return`${t}${n}${s}`}async function so(e,t=0){const o=e.app.templates.length>0?rn:nn;return e.axios.post(o,{version:e.app.packageJson.version,name:"Custom Block App",blocks:e.app.sections,templates:e.app.templates,compressionEnabled:!0,externalizationEnabled:!0,vueVersion:e.app.packageJson.dependencies.vue},{params:{appClientId:e.app.crane.appClientId},headers:{Authorization:`Bearer ${e.app.crane.appSecretKey}`}}).catch(async s=>{if(eo(t,s))return await to(t),so(e,t+1);throw s})}async function _n(e){try{O(f(l.cwd(),g))||(p.error(`Distribution folder [${g}] not found, please execute the build command first.`),l.exit(1));const t=e??tn;p.info("Custom application deployment :: Started");const o=Oo.create({baseURL:t});vo(o,an),p.info("Loading configuration files ...");const s=await Promise.all([fn(),un(),wn(),Sn()]).then(([a,y,c,A])=>({axios:o,app:{crane:a,packageJson:y,sections:c,templates:A}}));p.info("Uploading files ..."),Jt=Date.now();const n=await Promise.all(An(s));n.every(a=>a.status===Ws)||(C.stop(),n.map(a=>a.message).filter((a,y,c)=>c.indexOf(a)===y).forEach(a=>p.error(`Error while uploading asset files: ${a}`)),l.exit(1)),C.update({speed:"N/A",status:"Finalising deployment"}),await so(s).catch(a=>{C.stop(),p.error(oo(a,"Error while deploying manifest file:")),l.exit(1)}).finally(()=>{C.increment(),C.stop()});const r=s.app.sections.map(a=>a.id),i=s.app.packageJson.version;p.info(`Custom application deployment :: Successful
|
|
9
|
+
Current app version: ${i}
|
|
10
|
+
Deployed sections: ${r.join(", ")}`),await mn(s.app.packageJson),s.app.templates.length>0&&p.info(`Deployed templates: ${s.app.templates.map(a=>a.id).join(", ")}`)}catch(t){p.error(oo(t,"Error while deploying:")),l.exit(1)}}const Nn="1.1.3";async function xn(e){Y("template/headers/example-header","headers",e,"Header")}async function Ln(e){Y("template/footers/example-footer","footers",e,"Footer")}const d=io("crane");async function Pn(e,t,o,s){const n=`You can use ${t} to directly specify the name of the ${e}.`;console.log(n);const r=await ne({type:"text",name:"name",message:`Please specify a name for your ${e}:`});if(r.name)return e==="template"?o(r.name,s):o(r.name);console.log("Please provide a name for the template."),d.outputHelp()}function kn(e){return typeof e=="number"?!1:!(typeof e=="string"&&e.trim().length!==0)}async function U(e,t,o,s,n){s&&(kn(s)?await Pn(e,t,o):await o(s,n))}function Rn(){d.command("init","Initialize a new resource in the form of a directory.").option("--app <name>","Creates an app folder inside your current directory.").option("--section <name>","Creates the files necessary for one custom section with the given name, this can be repeated for each section.").option("--header <name>","Creates the files necessary for one custom header with the given name, this can be repeated for each header.").option("--footer <name>","Creates the files necessary for one custom footer with the given name, this can be repeated for each footer.").option("--template <name>","Creates the directory and files necessary to build a custom template inside your app folder.").option("--reference-template","Adds files necessary for the reference templates inside your app folder. ").option("--custom-headers-footers","Creates the directories and files necessary to build a custom header and footer inside your app folder."),d.command("build","Builds your resource code").action(Is),d.command("deploy","Deploys your resource code into Ecwid"),d.on("command:*",()=>{console.error("Invalid command: %s",d.args.join(" ")),d.outputHelp(),process.exit(1)}),d.on("command:init",async()=>{const e=d.options.section,t=d.options.header,o=d.options.footer,s=d.options.app,n=d.options.template,r=d.options.referenceTemplate,i=d.options.customHeadersFooters||!1;await U("app",N("init --app <name>"),Do,s),await U("section",N("init --section <name>"),Io,e),await U("header",N("init --header <name>"),xn,t),await U("footer",N("init --footer <name>"),Ln,o),await U("template",N("init --template <name>"),_o,n,i),r&&No()}),d.on("command:deploy",()=>_n(d.options.url)),d.help(),d.usage("<action> <resource>"),d.version(Nn),d.parse()}try{Rn()}catch(e){console.error(e)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightspeed/crane",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": "bin/crane.js",
|
|
6
6
|
"main": "./dist/app.mjs",
|
|
@@ -32,24 +32,23 @@
|
|
|
32
32
|
},
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"devDependencies": {
|
|
35
|
+
"@jest/globals": "^29.7.0",
|
|
35
36
|
"@types/express-fileupload": "^1.5.0",
|
|
36
37
|
"@types/fs-extra": "^11.0.1",
|
|
37
38
|
"@types/jest": "^29.5.12",
|
|
38
39
|
"@types/node": "^20.4.5",
|
|
40
|
+
"dir-compare": "^5.0.0",
|
|
39
41
|
"express": "^4.19.2",
|
|
40
42
|
"express-fileupload": "^1.5.1",
|
|
41
43
|
"jest": "^29.7.0",
|
|
42
|
-
"terser": "^5.35.0",
|
|
43
44
|
"ts-jest": "^29.1.5",
|
|
44
45
|
"ts-node": "^10.9.2",
|
|
45
46
|
"typescript": "5.4.5",
|
|
46
47
|
"unbuild": "^2.0.0",
|
|
47
|
-
"vite-plugin-compression": "^0.5.1",
|
|
48
48
|
"vite-plugin-dts": "^3.4.0",
|
|
49
49
|
"vite-plugin-static-copy": "^0.17.0"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@jest/globals": "^29.7.0",
|
|
53
52
|
"@jridgewell/sourcemap-codec": "^1.4.15",
|
|
54
53
|
"@lightspeed/eslint-config-crane": "1.0.2",
|
|
55
54
|
"@types/prompts": "^2.4.2",
|
|
@@ -59,17 +58,19 @@
|
|
|
59
58
|
"axios": "^1.7.7",
|
|
60
59
|
"axios-concurrency": "^1.0.4",
|
|
61
60
|
"cac": "^6.7.14",
|
|
62
|
-
"
|
|
61
|
+
"cli-progress": "^3.12.0",
|
|
63
62
|
"eslint": "npm:eslint-customized-for-crane@8.57.0",
|
|
64
63
|
"fs-extra": "^11.1.1",
|
|
65
64
|
"glob": "^9.3.5",
|
|
66
65
|
"kolorist": "^1.8.0",
|
|
67
66
|
"prompts": "^2.4.2",
|
|
68
67
|
"semver": "^7.5.4",
|
|
68
|
+
"terser": "^5.35.0",
|
|
69
69
|
"tinycolor2": "^1.6.0",
|
|
70
70
|
"typescript": "5.4.5",
|
|
71
71
|
"vite": "^5.3.3",
|
|
72
72
|
"vite-plugin-checker": "^0.6.1",
|
|
73
|
+
"vite-plugin-compression": "^0.5.1",
|
|
73
74
|
"vite-plugin-externals": "^0.6.2",
|
|
74
75
|
"vite-tsconfig-paths": "^4.2.0",
|
|
75
76
|
"vue": "^3.4.0",
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
class="custom-
|
|
3
|
+
class="custom-footer"
|
|
4
4
|
:style="backgroundStyle"
|
|
5
5
|
>
|
|
6
6
|
<div>
|
|
7
7
|
<ReportAbuse />
|
|
8
8
|
<div class="custom-block__blank_space" />
|
|
9
|
+
<LegalLinks />
|
|
10
|
+
<div class="custom-footer__blank_space" />
|
|
11
|
+
<LanguageSelector />
|
|
12
|
+
</div>
|
|
13
|
+
<div>
|
|
14
|
+
<MadeWith />
|
|
15
|
+
<div class="custom-block__blank_space" />
|
|
9
16
|
</div>
|
|
10
17
|
</div>
|
|
11
18
|
</template>
|
|
@@ -14,7 +21,10 @@
|
|
|
14
21
|
import { computed } from 'vue';
|
|
15
22
|
import { useBackgroundElementDesign } from '@lightspeed/crane';
|
|
16
23
|
import ReportAbuse from './component/ReportAbuse.vue';
|
|
24
|
+
import MadeWith from './component/MadeWith.vue';
|
|
17
25
|
import { Design } from './type.ts';
|
|
26
|
+
import LanguageSelector from '../../shared/components/LanguageSelector.vue';
|
|
27
|
+
import LegalLinks from './component/LegalLinks.vue';
|
|
18
28
|
|
|
19
29
|
const backgroundDesign = useBackgroundElementDesign<Design>('background');
|
|
20
30
|
const background = computed(() => ({
|
|
@@ -33,7 +43,7 @@ const backgroundStyle = computed(() => {
|
|
|
33
43
|
</script>
|
|
34
44
|
|
|
35
45
|
<style scoped lang="scss">
|
|
36
|
-
.custom-
|
|
46
|
+
.custom-footer {
|
|
37
47
|
padding: 50px;
|
|
38
48
|
|
|
39
49
|
@media screen and (min-width: 700px) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<svg
|
|
2
|
+
width="28"
|
|
3
|
+
height="28"
|
|
4
|
+
viewBox="0 0 28 28"
|
|
5
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
6
|
+
style="width: 1.1em; height: 1.1em; margin-right: .5em;"
|
|
7
|
+
>
|
|
8
|
+
<g
|
|
9
|
+
fill="currentColor"
|
|
10
|
+
fill-rule="evenodd"
|
|
11
|
+
>
|
|
12
|
+
<path
|
|
13
|
+
d="M21.523 0H6.377C2.89 0 0 2.9 0 6.4v15.3C0 25.2 2.89 28 6.377 28h15.246C25.11 28 28 25.2 28 21.6V6.4C27.9 2.9 25.01 0 21.523 0Zm-4.085 7.5c.697 0 1.295.6 1.295 1.3 0 .7-.598 1.3-1.295 1.3-.698 0-1.296-.6-1.296-1.3 0-.7.598-1.3 1.296-1.3Zm0 3.6c.697 0 1.295.6 1.295 1.3 0 .7-.598 1.3-1.295 1.3-.698 0-1.296-.6-1.296-1.3 0-.7.598-1.3 1.296-1.3ZM13.85 7.5c.697 0 1.295.6 1.295 1.3 0 .7-.598 1.3-1.295 1.3-.698 0-1.296-.6-1.296-1.3 0-.7.598-1.3 1.296-1.3Zm0 3.6c.697 0 1.295.6 1.295 1.3 0 .7-.598 1.3-1.295 1.3-.698 0-1.296-.6-1.296-1.3.1-.7.598-1.3 1.296-1.3Zm-3.488-3.6c.697 0 1.295.6 1.295 1.3 0 .7-.598 1.3-1.295 1.3-.698 0-1.295-.6-1.295-1.3 0-.7.597-1.3 1.295-1.3Zm0 3.6c.697 0 1.295.6 1.295 1.3 0 .7-.598 1.3-1.295 1.3-.698 0-1.295-.6-1.295-1.3 0-.7.597-1.3 1.295-1.3ZM6.975 24.4c-1.295 0-2.391-1.1-2.391-2.4 0-1.3 1.096-2.4 2.391-2.4s2.392 1.1 2.392 2.4c0 1.4-1.097 2.4-2.392 2.4Zm13.85.2c-1.295 0-2.39-1.1-2.39-2.4 0-1.3 1.095-2.4 2.39-2.4 1.296 0 2.392 1.1 2.392 2.4 0 1.3-.996 2.4-2.391 2.4ZM25.11 4.9l-2.49 9.3c-.698 2.5-2.79 4-5.282 4h-1.594c-.498 0-1.296-.3-1.694-.6-.1-.1-.1-.1-.2 0-.298.3-1.096.6-1.693.6h-1.794c-2.491 0-4.384-1.4-5.082-3.8L3.09 7.8c0-.1 0-.3.1-.4.1-.1.199-.2.398-.2h.399c.996 0 1.793.6 2.092 1.6l1.595 4.9c.398 1.3 1.793 2.2 3.188 2.2h.598c.598 0 1.096-.3 1.295-.6.1-.1.3-.2.499-.2h1.395c.199 0 .398.1.498.2.299.3.697.6 1.295.6h.598c1.395 0 2.79-1 3.189-2.4L22.22 6c.299-1 1.195-1.7 2.192-1.7h.498c.1.2.2.4.2.6Z"
|
|
14
|
+
/>
|
|
15
|
+
<path
|
|
16
|
+
d="M20.9 21.3c-.5 0-.9.4-.9.9s.4.9.9.9.9-.4.9-.9-.4-.9-.9-.9zM7 21.2c-.5 0-.9.4-.9.9s.4.9.9.9.9-.4.9-.9c-.1-.5-.5-.9-.9-.9z"
|
|
17
|
+
/>
|
|
18
|
+
</g>
|
|
19
|
+
</svg>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<span v-for="(link, index) in legalLinks" :key="index">
|
|
4
|
+
<a :href="link.url">{{ link.title }}</a>
|
|
5
|
+
<span v-if="index < legalLinks.length - 1"> | </span>
|
|
6
|
+
</span>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import { useVueBaseProps } from '@lightspeed/crane';
|
|
12
|
+
import { Design } from '../type.ts';
|
|
13
|
+
|
|
14
|
+
const baseProps = useVueBaseProps<unknown, Design>();
|
|
15
|
+
const siteContent: SiteContent = baseProps.site?.value satisfies SiteContent;
|
|
16
|
+
const legalLinks = siteContent.legalPages ?? [];
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<style lang="scss" scoped>
|
|
20
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<a :href="madeWith?.url" target="{{ madeWith?.target }}">
|
|
4
|
+
<span>{{ madeWith?.poweredBy }} </span>
|
|
5
|
+
<span>
|
|
6
|
+
<img src="../assets/cart.svg" alt="cart" />
|
|
7
|
+
</span>
|
|
8
|
+
<span>{{ madeWith?.company }}</span>
|
|
9
|
+
</a>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import { useVueBaseProps } from '@lightspeed/crane';
|
|
15
|
+
import { Design } from '../type.ts';
|
|
16
|
+
|
|
17
|
+
const baseProps = useVueBaseProps<unknown, Design>();
|
|
18
|
+
const siteContent: SiteContent = baseProps.site?.value satisfies SiteContent;
|
|
19
|
+
const madeWith = siteContent.madeWith;
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<style lang="scss" scoped>
|
|
23
|
+
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<a :href="
|
|
4
|
-
{{
|
|
3
|
+
<a :href="reportAbuse?.url" target="{{ reportAbuse?.target }}}">
|
|
4
|
+
{{ reportAbuse?.title }}
|
|
5
5
|
</a>
|
|
6
6
|
</div>
|
|
7
7
|
</template>
|
|
@@ -11,7 +11,8 @@ import { useVueBaseProps } from '@lightspeed/crane';
|
|
|
11
11
|
import { Design } from '../type.ts';
|
|
12
12
|
|
|
13
13
|
const baseProps = useVueBaseProps<unknown, Design>();
|
|
14
|
-
const
|
|
14
|
+
const siteContent: SiteContent = baseProps.site.value satisfies SiteContent;
|
|
15
|
+
const reportAbuse = siteContent.reportAbuse;
|
|
15
16
|
</script>
|
|
16
17
|
|
|
17
18
|
<style lang="scss" scoped>
|