@swell/apps-sdk 1.0.148 → 1.0.149
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/index.cjs +726 -226
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +723 -225
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +637 -138
- package/dist/index.mjs.map +4 -4
- package/dist/src/compatibility/drops/all_products.d.ts +10 -0
- package/dist/src/compatibility/drops/articles.d.ts +10 -0
- package/dist/src/compatibility/drops/blogs.d.ts +10 -0
- package/dist/src/compatibility/drops/collections.d.ts +9 -4
- package/dist/src/compatibility/drops/images.d.ts +10 -0
- package/dist/src/compatibility/drops/pages.d.ts +18 -0
- package/dist/src/compatibility/drops/robots-rule.d.ts +9 -0
- package/dist/src/compatibility/shopify-objects/image.d.ts +1 -2
- package/dist/src/compatibility/shopify-objects/media.d.ts +1 -2
- package/dist/src/compatibility/shopify.d.ts +1 -2
- package/dist/src/content.d.ts +8 -8
- package/dist/src/globals.d.ts +7 -0
- package/dist/src/liquid/drops/render.d.ts +10 -0
- package/dist/src/liquid/utils.d.ts +2 -1
- package/dist/src/theme.d.ts +6 -4
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/types/shopify.d.ts +12 -0
- package/dist/types/swell.d.ts +16 -1
- package/package.json +1 -1
- package/dist/src/compatibility/drops/render.d.ts +0 -6
package/dist/index.js
CHANGED
|
@@ -352,7 +352,8 @@
|
|
|
352
352
|
last;
|
|
353
353
|
rindex;
|
|
354
354
|
rindex0;
|
|
355
|
-
|
|
355
|
+
parentloop;
|
|
356
|
+
constructor(length, collection, variable, parent) {
|
|
356
357
|
super();
|
|
357
358
|
this.length = length;
|
|
358
359
|
this.name = `${variable}-${collection}`;
|
|
@@ -360,9 +361,10 @@
|
|
|
360
361
|
this.index = 1;
|
|
361
362
|
this.index0 = 0;
|
|
362
363
|
this.first = true;
|
|
363
|
-
this.last =
|
|
364
|
+
this.last = length <= 0;
|
|
364
365
|
this.rindex = length;
|
|
365
366
|
this.rindex0 = length - 1;
|
|
367
|
+
this.parentloop = parent ?? null;
|
|
366
368
|
}
|
|
367
369
|
next() {
|
|
368
370
|
this.i += 1;
|
|
@@ -569,6 +571,8 @@
|
|
|
569
571
|
switch (prop) {
|
|
570
572
|
// Ignore liquid prop checks
|
|
571
573
|
case "toLiquid":
|
|
574
|
+
return typeof instance.toLiquid === "function" ? instance.toLiquid : void 0;
|
|
575
|
+
// Ignore liquid prop checks
|
|
572
576
|
case "next":
|
|
573
577
|
return;
|
|
574
578
|
// Indicate props are thenable
|
|
@@ -6561,6 +6565,7 @@
|
|
|
6561
6565
|
}
|
|
6562
6566
|
),
|
|
6563
6567
|
id: sectionSchema.id,
|
|
6568
|
+
type: sectionSchema.id,
|
|
6564
6569
|
blocks: props.Blocks?.filter(
|
|
6565
6570
|
(propBlock) => Boolean(propBlock.props.compiled?._component)
|
|
6566
6571
|
).map((propBlock) => {
|
|
@@ -6581,7 +6586,8 @@
|
|
|
6581
6586
|
{ $locale: blockProps.$locale }
|
|
6582
6587
|
) || {}
|
|
6583
6588
|
};
|
|
6584
|
-
})
|
|
6589
|
+
}),
|
|
6590
|
+
location: getSectionLocation(sectionSchema.id)
|
|
6585
6591
|
};
|
|
6586
6592
|
}
|
|
6587
6593
|
function toEasyblocksFieldId(fieldId) {
|
|
@@ -6838,7 +6844,8 @@
|
|
|
6838
6844
|
async function getPageSections(sectionGroup, getSchema) {
|
|
6839
6845
|
const order = Array.isArray(sectionGroup?.order) && sectionGroup.order.length > 0 ? sectionGroup.order : Object.keys(sectionGroup?.sections || {});
|
|
6840
6846
|
const pageSections = [];
|
|
6841
|
-
for (
|
|
6847
|
+
for (let i = 0; i < order.length; ++i) {
|
|
6848
|
+
const key = order[i];
|
|
6842
6849
|
const section = sectionGroup.sections?.[key];
|
|
6843
6850
|
if (!section) {
|
|
6844
6851
|
continue;
|
|
@@ -6860,7 +6867,10 @@
|
|
|
6860
6867
|
section: {
|
|
6861
6868
|
id,
|
|
6862
6869
|
...section,
|
|
6863
|
-
blocks
|
|
6870
|
+
blocks,
|
|
6871
|
+
index0: i,
|
|
6872
|
+
index: i + 1,
|
|
6873
|
+
location: getSectionLocation(section.type)
|
|
6864
6874
|
}
|
|
6865
6875
|
};
|
|
6866
6876
|
pageSections.push({
|
|
@@ -7104,6 +7114,15 @@
|
|
|
7104
7114
|
(0, import_lodash_es3.cloneDeep)(currentSettings)
|
|
7105
7115
|
);
|
|
7106
7116
|
}
|
|
7117
|
+
function getSectionLocation(sectionType) {
|
|
7118
|
+
switch (sectionType) {
|
|
7119
|
+
case "header":
|
|
7120
|
+
case "footer":
|
|
7121
|
+
return sectionType;
|
|
7122
|
+
default:
|
|
7123
|
+
return sectionType ? `custom.${sectionType}` : "template";
|
|
7124
|
+
}
|
|
7125
|
+
}
|
|
7107
7126
|
var SECTION_GROUP_CONTENT = "ContentSections";
|
|
7108
7127
|
function getSectionGroupProp(sectionId) {
|
|
7109
7128
|
return `SectionGroup_${sectionId}`;
|
|
@@ -8013,19 +8032,19 @@ ${formattedMessage}`;
|
|
|
8013
8032
|
})
|
|
8014
8033
|
);
|
|
8015
8034
|
}
|
|
8016
|
-
|
|
8035
|
+
function getContentList(swell, type, query) {
|
|
8017
8036
|
return new SwellStorefrontCollection(swell, `content/${type}`, query);
|
|
8018
8037
|
}
|
|
8019
|
-
|
|
8038
|
+
function getContentEntry(swell, type, id, query) {
|
|
8020
8039
|
return new SwellStorefrontRecord(swell, `content/${type}`, id, query);
|
|
8021
8040
|
}
|
|
8022
|
-
|
|
8041
|
+
function getPage(swell, id, query) {
|
|
8023
8042
|
return getContentEntry(swell, "pages", id, query);
|
|
8024
8043
|
}
|
|
8025
|
-
|
|
8044
|
+
function getBlogs(swell, query) {
|
|
8026
8045
|
return getContentList(swell, "blogs", query);
|
|
8027
8046
|
}
|
|
8028
|
-
|
|
8047
|
+
function getBlog(swell, id, query) {
|
|
8029
8048
|
return getContentEntry(swell, "blogs", id, query);
|
|
8030
8049
|
}
|
|
8031
8050
|
|
|
@@ -8835,11 +8854,11 @@ ${formattedMessage}`;
|
|
|
8835
8854
|
}
|
|
8836
8855
|
|
|
8837
8856
|
// src/menus.ts
|
|
8838
|
-
var
|
|
8857
|
+
var import_lodash_es14 = __require("lodash-es");
|
|
8839
8858
|
|
|
8840
8859
|
// src/theme.ts
|
|
8841
8860
|
var import_json56 = __toESM(__require("json5"), 1);
|
|
8842
|
-
var
|
|
8861
|
+
var import_lodash_es13 = __require("lodash-es");
|
|
8843
8862
|
|
|
8844
8863
|
// src/compatibility/shopify.ts
|
|
8845
8864
|
var import_lodash_es7 = __require("lodash-es");
|
|
@@ -14023,7 +14042,7 @@ ${formattedMessage}`;
|
|
|
14023
14042
|
});
|
|
14024
14043
|
|
|
14025
14044
|
// src/compatibility/shopify-objects/image.ts
|
|
14026
|
-
function ShopifyImage(
|
|
14045
|
+
function ShopifyImage(image, options = {}, product, variant) {
|
|
14027
14046
|
if (image instanceof ShopifyResource) {
|
|
14028
14047
|
return image.clone();
|
|
14029
14048
|
}
|
|
@@ -14085,7 +14104,7 @@ ${formattedMessage}`;
|
|
|
14085
14104
|
id: defer(() => blog.id),
|
|
14086
14105
|
image: deferWith(
|
|
14087
14106
|
blog,
|
|
14088
|
-
(blog2) => blog2.image ? ShopifyImage(
|
|
14107
|
+
(blog2) => blog2.image ? ShopifyImage(blog2.image) : void 0
|
|
14089
14108
|
),
|
|
14090
14109
|
metafields: {},
|
|
14091
14110
|
published_at: deferWith(
|
|
@@ -14175,7 +14194,7 @@ ${formattedMessage}`;
|
|
|
14175
14194
|
}
|
|
14176
14195
|
|
|
14177
14196
|
// src/compatibility/shopify-objects/media.ts
|
|
14178
|
-
function ShopifyMedia(
|
|
14197
|
+
function ShopifyMedia(image, options) {
|
|
14179
14198
|
if (image instanceof ShopifyResource) {
|
|
14180
14199
|
return image.clone();
|
|
14181
14200
|
}
|
|
@@ -14184,7 +14203,7 @@ ${formattedMessage}`;
|
|
|
14184
14203
|
id: image.id || image.file?.id,
|
|
14185
14204
|
media_type: options?.media_type ?? "image",
|
|
14186
14205
|
position: options?.position,
|
|
14187
|
-
preview_image: ShopifyImage(
|
|
14206
|
+
preview_image: ShopifyImage(image)
|
|
14188
14207
|
});
|
|
14189
14208
|
}
|
|
14190
14209
|
|
|
@@ -14212,19 +14231,19 @@ ${formattedMessage}`;
|
|
|
14212
14231
|
[product, variant],
|
|
14213
14232
|
(product2, variant2) => {
|
|
14214
14233
|
const image = variant2.images?.[0] || product2.images?.[0];
|
|
14215
|
-
return image ? ShopifyImage(
|
|
14234
|
+
return image ? ShopifyImage(image, {}, product2, variant2) : void 0;
|
|
14216
14235
|
}
|
|
14217
14236
|
),
|
|
14218
14237
|
featured_media: deferWith([product, variant], (product2, variant2) => {
|
|
14219
14238
|
const image = variant2.images?.[0] || product2.images?.[0];
|
|
14220
|
-
return image ? ShopifyMedia(
|
|
14239
|
+
return image ? ShopifyMedia(image, { media_type: "image" }) : void 0;
|
|
14221
14240
|
}),
|
|
14222
14241
|
id: defer(() => variant.id),
|
|
14223
14242
|
image: deferWith(
|
|
14224
14243
|
[product, variant],
|
|
14225
14244
|
(product2, variant2) => {
|
|
14226
14245
|
const image = variant2.images?.[0] || product2.images?.[0];
|
|
14227
|
-
return image ? ShopifyImage(
|
|
14246
|
+
return image ? ShopifyImage(image, {}, product2, variant2) : void 0;
|
|
14228
14247
|
}
|
|
14229
14248
|
),
|
|
14230
14249
|
incoming: false,
|
|
@@ -14376,11 +14395,11 @@ ${formattedMessage}`;
|
|
|
14376
14395
|
description: defer(() => product.description),
|
|
14377
14396
|
featured_image: deferWith(product, (product2) => {
|
|
14378
14397
|
const image = product2.images?.[0];
|
|
14379
|
-
return image ? ShopifyImage(
|
|
14398
|
+
return image ? ShopifyImage(image, {}, product2) : void 0;
|
|
14380
14399
|
}),
|
|
14381
14400
|
featured_media: deferWith(product, (product2) => {
|
|
14382
14401
|
const image = product2.images?.[0];
|
|
14383
|
-
return image ? ShopifyMedia(
|
|
14402
|
+
return image ? ShopifyMedia(image) : void 0;
|
|
14384
14403
|
}),
|
|
14385
14404
|
// not used
|
|
14386
14405
|
first_available_variant: deferWith(product, (product2) => {
|
|
@@ -14400,7 +14419,7 @@ ${formattedMessage}`;
|
|
|
14400
14419
|
return [];
|
|
14401
14420
|
}
|
|
14402
14421
|
return product2.images.map(
|
|
14403
|
-
(image, index) => ShopifyImage(
|
|
14422
|
+
(image, index) => ShopifyImage(image, { position: index + 1 }, product2)
|
|
14404
14423
|
);
|
|
14405
14424
|
}),
|
|
14406
14425
|
media: deferWith(product, (product2) => {
|
|
@@ -14408,7 +14427,7 @@ ${formattedMessage}`;
|
|
|
14408
14427
|
return [];
|
|
14409
14428
|
}
|
|
14410
14429
|
return product2.images.map(
|
|
14411
|
-
(image, index) => ShopifyMedia(
|
|
14430
|
+
(image, index) => ShopifyMedia(image, {
|
|
14412
14431
|
media_type: "image",
|
|
14413
14432
|
position: index + 1
|
|
14414
14433
|
})
|
|
@@ -14638,7 +14657,7 @@ ${formattedMessage}`;
|
|
|
14638
14657
|
[item.product, item.variant],
|
|
14639
14658
|
(product, variant) => {
|
|
14640
14659
|
const image = product?.images?.[0];
|
|
14641
|
-
return image ? ShopifyImage(
|
|
14660
|
+
return image ? ShopifyImage(image, {}, product, variant) : void 0;
|
|
14642
14661
|
}
|
|
14643
14662
|
),
|
|
14644
14663
|
item_components: (item.bundle_items ?? []).map(
|
|
@@ -15044,10 +15063,7 @@ ${formattedMessage}`;
|
|
|
15044
15063
|
(category2) => convertToShopifySorting(category2.sort_options?.[0].value ?? "")
|
|
15045
15064
|
),
|
|
15046
15065
|
description: defer(() => category.description),
|
|
15047
|
-
featured_image: deferWith(
|
|
15048
|
-
category,
|
|
15049
|
-
(category2) => getFirstImage(instance, category2)
|
|
15050
|
-
),
|
|
15066
|
+
featured_image: deferWith(category, (category2) => getFirstImage(category2)),
|
|
15051
15067
|
filters: deferWith(
|
|
15052
15068
|
category,
|
|
15053
15069
|
(category2) => (category2?.filter_options ?? []).map(
|
|
@@ -15056,7 +15072,7 @@ ${formattedMessage}`;
|
|
|
15056
15072
|
),
|
|
15057
15073
|
handle: defer(() => category.slug),
|
|
15058
15074
|
id: defer(() => category.id),
|
|
15059
|
-
image: deferWith(category, (category2) => getFirstImage(
|
|
15075
|
+
image: deferWith(category, (category2) => getFirstImage(category2)),
|
|
15060
15076
|
metafields: {},
|
|
15061
15077
|
next_product: void 0,
|
|
15062
15078
|
previous_product: void 0,
|
|
@@ -15076,9 +15092,9 @@ ${formattedMessage}`;
|
|
|
15076
15092
|
url: deferWith(category, (category2) => `/collections/${category2.slug}`)
|
|
15077
15093
|
});
|
|
15078
15094
|
}
|
|
15079
|
-
function getFirstImage(
|
|
15095
|
+
function getFirstImage(category) {
|
|
15080
15096
|
const image = category.images?.[0];
|
|
15081
|
-
return image ? ShopifyImage(
|
|
15097
|
+
return image ? ShopifyImage(image) : void 0;
|
|
15082
15098
|
}
|
|
15083
15099
|
function convertToShopifySorting(value) {
|
|
15084
15100
|
switch (value) {
|
|
@@ -16031,38 +16047,72 @@ ${formattedMessage}`;
|
|
|
16031
16047
|
});
|
|
16032
16048
|
}
|
|
16033
16049
|
|
|
16034
|
-
// src/compatibility/drops/
|
|
16050
|
+
// src/compatibility/drops/all_products.ts
|
|
16035
16051
|
var import_liquidjs3 = __require("liquidjs");
|
|
16036
|
-
var
|
|
16052
|
+
var AllProductsDrop = class extends import_liquidjs3.Drop {
|
|
16053
|
+
#instance;
|
|
16037
16054
|
#map;
|
|
16038
|
-
constructor(
|
|
16055
|
+
constructor(instance) {
|
|
16039
16056
|
super();
|
|
16040
|
-
|
|
16057
|
+
this.#instance = instance;
|
|
16058
|
+
this.#map = /* @__PURE__ */ new Map();
|
|
16059
|
+
}
|
|
16060
|
+
liquidMethodMissing(key) {
|
|
16061
|
+
switch (typeof key) {
|
|
16062
|
+
case "string": {
|
|
16063
|
+
return this.getProduct(key);
|
|
16064
|
+
}
|
|
16041
16065
|
case "object": {
|
|
16042
|
-
if (
|
|
16043
|
-
|
|
16044
|
-
|
|
16066
|
+
if (key !== null) {
|
|
16067
|
+
const obj = key;
|
|
16068
|
+
const id = obj.handle || obj.id || obj._id;
|
|
16069
|
+
if (isLikePromise(id)) {
|
|
16070
|
+
return id.then((id2) => this.getProduct(id2));
|
|
16071
|
+
}
|
|
16072
|
+
return this.getProduct(id);
|
|
16045
16073
|
}
|
|
16046
|
-
this.#map = new Map(
|
|
16047
|
-
map instanceof Map ? map : Object.entries(map)
|
|
16048
|
-
);
|
|
16049
16074
|
break;
|
|
16050
16075
|
}
|
|
16051
16076
|
default:
|
|
16052
|
-
this.#map = /* @__PURE__ */ new Map();
|
|
16053
16077
|
break;
|
|
16054
16078
|
}
|
|
16055
16079
|
}
|
|
16080
|
+
getProduct(slug) {
|
|
16081
|
+
let resource = this.#map.get(slug);
|
|
16082
|
+
if (resource === void 0 && this.#map.size < 20) {
|
|
16083
|
+
resource = ShopifyProduct(
|
|
16084
|
+
this.#instance,
|
|
16085
|
+
new SwellStorefrontRecord(this.#instance.swell, "products", slug)
|
|
16086
|
+
);
|
|
16087
|
+
this.#map.set(slug, resource);
|
|
16088
|
+
}
|
|
16089
|
+
return resource ?? null;
|
|
16090
|
+
}
|
|
16091
|
+
};
|
|
16092
|
+
|
|
16093
|
+
// src/compatibility/drops/articles.ts
|
|
16094
|
+
var import_liquidjs4 = __require("liquidjs");
|
|
16095
|
+
var ArticlesDrop = class extends import_liquidjs4.Drop {
|
|
16096
|
+
#instance;
|
|
16097
|
+
#map;
|
|
16098
|
+
constructor(instance) {
|
|
16099
|
+
super();
|
|
16100
|
+
this.#instance = instance;
|
|
16101
|
+
this.#map = /* @__PURE__ */ new Map();
|
|
16102
|
+
}
|
|
16056
16103
|
liquidMethodMissing(key) {
|
|
16057
16104
|
switch (typeof key) {
|
|
16058
|
-
case "string":
|
|
16059
|
-
return this
|
|
16105
|
+
case "string": {
|
|
16106
|
+
return this.getArticle(key);
|
|
16107
|
+
}
|
|
16060
16108
|
case "object": {
|
|
16061
|
-
if (key !== null
|
|
16062
|
-
const
|
|
16063
|
-
|
|
16064
|
-
|
|
16109
|
+
if (key !== null) {
|
|
16110
|
+
const obj = key;
|
|
16111
|
+
const id = obj.handle || obj.id || obj._id;
|
|
16112
|
+
if (isLikePromise(id)) {
|
|
16113
|
+
return id.then((id2) => this.getArticle(id2));
|
|
16065
16114
|
}
|
|
16115
|
+
return this.getArticle(id);
|
|
16066
16116
|
}
|
|
16067
16117
|
break;
|
|
16068
16118
|
}
|
|
@@ -16070,13 +16120,71 @@ ${formattedMessage}`;
|
|
|
16070
16120
|
break;
|
|
16071
16121
|
}
|
|
16072
16122
|
}
|
|
16123
|
+
getArticle(slug) {
|
|
16124
|
+
let resource = this.#map.get(slug);
|
|
16125
|
+
if (resource === void 0) {
|
|
16126
|
+
resource = ShopifyArticle(
|
|
16127
|
+
this.#instance,
|
|
16128
|
+
new SwellStorefrontRecord(this.#instance.swell, "content/blogs", slug)
|
|
16129
|
+
);
|
|
16130
|
+
this.#map.set(slug, resource);
|
|
16131
|
+
}
|
|
16132
|
+
return resource;
|
|
16133
|
+
}
|
|
16134
|
+
};
|
|
16135
|
+
|
|
16136
|
+
// src/compatibility/drops/blogs.ts
|
|
16137
|
+
var import_liquidjs5 = __require("liquidjs");
|
|
16138
|
+
var BlogsDrop = class extends import_liquidjs5.Drop {
|
|
16139
|
+
#instance;
|
|
16140
|
+
#map;
|
|
16141
|
+
constructor(instance) {
|
|
16142
|
+
super();
|
|
16143
|
+
this.#instance = instance;
|
|
16144
|
+
this.#map = /* @__PURE__ */ new Map();
|
|
16145
|
+
}
|
|
16146
|
+
liquidMethodMissing(key) {
|
|
16147
|
+
switch (typeof key) {
|
|
16148
|
+
case "string": {
|
|
16149
|
+
return this.getBlog(key);
|
|
16150
|
+
}
|
|
16151
|
+
case "object": {
|
|
16152
|
+
if (key !== null) {
|
|
16153
|
+
const obj = key;
|
|
16154
|
+
const id = obj.handle || obj.id || obj._id;
|
|
16155
|
+
if (isLikePromise(id)) {
|
|
16156
|
+
return id.then((id2) => this.getBlog(id2));
|
|
16157
|
+
}
|
|
16158
|
+
return this.getBlog(id);
|
|
16159
|
+
}
|
|
16160
|
+
break;
|
|
16161
|
+
}
|
|
16162
|
+
default:
|
|
16163
|
+
break;
|
|
16164
|
+
}
|
|
16165
|
+
}
|
|
16166
|
+
getBlog(slug) {
|
|
16167
|
+
let resource = this.#map.get(slug);
|
|
16168
|
+
if (resource === void 0) {
|
|
16169
|
+
resource = ShopifyBlog(
|
|
16170
|
+
this.#instance,
|
|
16171
|
+
new SwellStorefrontRecord(
|
|
16172
|
+
this.#instance.swell,
|
|
16173
|
+
"content/blog-categories",
|
|
16174
|
+
slug
|
|
16175
|
+
)
|
|
16176
|
+
);
|
|
16177
|
+
this.#map.set(slug, resource);
|
|
16178
|
+
}
|
|
16179
|
+
return resource;
|
|
16180
|
+
}
|
|
16073
16181
|
};
|
|
16074
16182
|
|
|
16075
16183
|
// src/compatibility/drops/collections.ts
|
|
16076
|
-
var
|
|
16077
|
-
var AllCategoryResource = class extends
|
|
16184
|
+
var import_liquidjs6 = __require("liquidjs");
|
|
16185
|
+
var AllCategoryResource = class extends StorefrontResource {
|
|
16078
16186
|
constructor(instance) {
|
|
16079
|
-
super(
|
|
16187
|
+
super(() => {
|
|
16080
16188
|
const category = {
|
|
16081
16189
|
id: "all",
|
|
16082
16190
|
slug: "all",
|
|
@@ -16087,15 +16195,12 @@ ${formattedMessage}`;
|
|
|
16087
16195
|
});
|
|
16088
16196
|
}
|
|
16089
16197
|
};
|
|
16090
|
-
var CollectionsDrop = class extends
|
|
16198
|
+
var CollectionsDrop = class extends import_liquidjs6.Drop {
|
|
16091
16199
|
#instance;
|
|
16092
|
-
#categories;
|
|
16093
|
-
#size;
|
|
16094
16200
|
#map;
|
|
16095
16201
|
constructor(instance) {
|
|
16096
16202
|
super();
|
|
16097
16203
|
this.#instance = instance;
|
|
16098
|
-
this.#size = Number.NaN;
|
|
16099
16204
|
this.#map = /* @__PURE__ */ new Map();
|
|
16100
16205
|
}
|
|
16101
16206
|
liquidMethodMissing(key) {
|
|
@@ -16140,36 +16245,32 @@ ${formattedMessage}`;
|
|
|
16140
16245
|
}
|
|
16141
16246
|
return resource;
|
|
16142
16247
|
}
|
|
16143
|
-
|
|
16144
|
-
|
|
16145
|
-
|
|
16146
|
-
|
|
16147
|
-
|
|
16148
|
-
|
|
16149
|
-
|
|
16150
|
-
|
|
16151
|
-
|
|
16152
|
-
|
|
16153
|
-
|
|
16154
|
-
|
|
16248
|
+
};
|
|
16249
|
+
var Collections = class extends SwellStorefrontCollection {
|
|
16250
|
+
#drop;
|
|
16251
|
+
constructor(instance) {
|
|
16252
|
+
super(instance.swell, "categories", {}, async () => {
|
|
16253
|
+
const response = await this._defaultGetter().call(this);
|
|
16254
|
+
if (!response) {
|
|
16255
|
+
return null;
|
|
16256
|
+
}
|
|
16257
|
+
return {
|
|
16258
|
+
...response,
|
|
16259
|
+
page_count: response.page_count || 0,
|
|
16260
|
+
results: response.results.map(
|
|
16261
|
+
(item) => ShopifyCollection(instance, item)
|
|
16262
|
+
)
|
|
16263
|
+
};
|
|
16264
|
+
});
|
|
16265
|
+
this.#drop = new CollectionsDrop(instance);
|
|
16155
16266
|
}
|
|
16156
|
-
|
|
16157
|
-
|
|
16158
|
-
this.#categories = await this.#instance.swell.storefront.categories.list().then((res) => {
|
|
16159
|
-
return res.results.map(
|
|
16160
|
-
(category) => ShopifyCollection(
|
|
16161
|
-
this.#instance,
|
|
16162
|
-
new SwellStorefrontCategory(this.#instance, category.slug)
|
|
16163
|
-
)
|
|
16164
|
-
);
|
|
16165
|
-
});
|
|
16166
|
-
}
|
|
16167
|
-
return this.#categories.values();
|
|
16267
|
+
toLiquid() {
|
|
16268
|
+
return this.#drop;
|
|
16168
16269
|
}
|
|
16169
16270
|
};
|
|
16170
|
-
var SwellStorefrontCategory = class extends
|
|
16271
|
+
var SwellStorefrontCategory = class extends StorefrontResource {
|
|
16171
16272
|
constructor(instance, id, query) {
|
|
16172
|
-
super(
|
|
16273
|
+
super(async () => {
|
|
16173
16274
|
const category = new SwellStorefrontRecord(
|
|
16174
16275
|
instance.swell,
|
|
16175
16276
|
"categories",
|
|
@@ -16210,8 +16311,168 @@ ${formattedMessage}`;
|
|
|
16210
16311
|
}
|
|
16211
16312
|
};
|
|
16212
16313
|
|
|
16314
|
+
// src/compatibility/drops/images.ts
|
|
16315
|
+
var import_liquidjs7 = __require("liquidjs");
|
|
16316
|
+
var ImagesDrop = class extends import_liquidjs7.Drop {
|
|
16317
|
+
#instance;
|
|
16318
|
+
#map;
|
|
16319
|
+
constructor(instance) {
|
|
16320
|
+
super();
|
|
16321
|
+
this.#instance = instance;
|
|
16322
|
+
this.#map = /* @__PURE__ */ new Map();
|
|
16323
|
+
}
|
|
16324
|
+
liquidMethodMissing(key) {
|
|
16325
|
+
switch (typeof key) {
|
|
16326
|
+
case "string": {
|
|
16327
|
+
return this.getImage(key);
|
|
16328
|
+
}
|
|
16329
|
+
case "object": {
|
|
16330
|
+
if (key !== null) {
|
|
16331
|
+
const obj = key;
|
|
16332
|
+
const id = obj.handle || obj.id || obj._id;
|
|
16333
|
+
if (isLikePromise(id)) {
|
|
16334
|
+
return id.then((id2) => this.getImage(id2));
|
|
16335
|
+
}
|
|
16336
|
+
return this.getImage(id);
|
|
16337
|
+
}
|
|
16338
|
+
break;
|
|
16339
|
+
}
|
|
16340
|
+
default:
|
|
16341
|
+
break;
|
|
16342
|
+
}
|
|
16343
|
+
}
|
|
16344
|
+
getImage(name) {
|
|
16345
|
+
let resource = this.#map.get(name);
|
|
16346
|
+
if (resource === void 0) {
|
|
16347
|
+
resource = ShopifyImage(new SwellImage(this.#instance.swell, name));
|
|
16348
|
+
this.#map.set(name, resource);
|
|
16349
|
+
}
|
|
16350
|
+
return resource;
|
|
16351
|
+
}
|
|
16352
|
+
};
|
|
16353
|
+
var SwellImage = class extends StorefrontResource {
|
|
16354
|
+
constructor(swell, name) {
|
|
16355
|
+
super(async () => {
|
|
16356
|
+
const files = await swell.get("/:files", {
|
|
16357
|
+
private: { $ne: true },
|
|
16358
|
+
content_type: { $regex: "^image/" },
|
|
16359
|
+
filename: name
|
|
16360
|
+
});
|
|
16361
|
+
const file = files?.results[0] ?? null;
|
|
16362
|
+
if (file === null) {
|
|
16363
|
+
return null;
|
|
16364
|
+
}
|
|
16365
|
+
return { file };
|
|
16366
|
+
});
|
|
16367
|
+
}
|
|
16368
|
+
};
|
|
16369
|
+
|
|
16370
|
+
// src/compatibility/drops/object-handles.ts
|
|
16371
|
+
var import_liquidjs8 = __require("liquidjs");
|
|
16372
|
+
var ObjectHandlesDrop = class extends import_liquidjs8.Drop {
|
|
16373
|
+
#map;
|
|
16374
|
+
constructor(map) {
|
|
16375
|
+
super();
|
|
16376
|
+
switch (typeof map) {
|
|
16377
|
+
case "object": {
|
|
16378
|
+
if (map === null) {
|
|
16379
|
+
this.#map = /* @__PURE__ */ new Map();
|
|
16380
|
+
break;
|
|
16381
|
+
}
|
|
16382
|
+
this.#map = new Map(
|
|
16383
|
+
map instanceof Map ? map : Object.entries(map)
|
|
16384
|
+
);
|
|
16385
|
+
break;
|
|
16386
|
+
}
|
|
16387
|
+
default:
|
|
16388
|
+
this.#map = /* @__PURE__ */ new Map();
|
|
16389
|
+
break;
|
|
16390
|
+
}
|
|
16391
|
+
}
|
|
16392
|
+
liquidMethodMissing(key) {
|
|
16393
|
+
switch (typeof key) {
|
|
16394
|
+
case "string":
|
|
16395
|
+
return this.#map.get(key);
|
|
16396
|
+
case "object": {
|
|
16397
|
+
if (key !== null && "handle" in key) {
|
|
16398
|
+
const { handle } = key;
|
|
16399
|
+
if (typeof handle === "string") {
|
|
16400
|
+
return this.#map.get(handle);
|
|
16401
|
+
}
|
|
16402
|
+
}
|
|
16403
|
+
break;
|
|
16404
|
+
}
|
|
16405
|
+
default:
|
|
16406
|
+
break;
|
|
16407
|
+
}
|
|
16408
|
+
}
|
|
16409
|
+
};
|
|
16410
|
+
|
|
16411
|
+
// src/compatibility/drops/pages.ts
|
|
16412
|
+
var import_liquidjs9 = __require("liquidjs");
|
|
16413
|
+
var PagesDrop = class extends import_liquidjs9.Drop {
|
|
16414
|
+
#instance;
|
|
16415
|
+
#map;
|
|
16416
|
+
constructor(instance) {
|
|
16417
|
+
super();
|
|
16418
|
+
this.#instance = instance;
|
|
16419
|
+
this.#map = /* @__PURE__ */ new Map();
|
|
16420
|
+
}
|
|
16421
|
+
liquidMethodMissing(key) {
|
|
16422
|
+
switch (typeof key) {
|
|
16423
|
+
case "string": {
|
|
16424
|
+
return this.getPage(key);
|
|
16425
|
+
}
|
|
16426
|
+
case "object": {
|
|
16427
|
+
if (key !== null) {
|
|
16428
|
+
const obj = key;
|
|
16429
|
+
const id = obj.handle || obj.id || obj._id;
|
|
16430
|
+
if (isLikePromise(id)) {
|
|
16431
|
+
return id.then((id2) => this.getPage(id2));
|
|
16432
|
+
}
|
|
16433
|
+
return this.getPage(id);
|
|
16434
|
+
}
|
|
16435
|
+
break;
|
|
16436
|
+
}
|
|
16437
|
+
default:
|
|
16438
|
+
break;
|
|
16439
|
+
}
|
|
16440
|
+
}
|
|
16441
|
+
getPage(slug) {
|
|
16442
|
+
let resource = this.#map.get(slug);
|
|
16443
|
+
if (resource === void 0) {
|
|
16444
|
+
resource = ShopifyPage(
|
|
16445
|
+
this.#instance,
|
|
16446
|
+
new SwellStorefrontRecord(this.#instance.swell, "content/pages", slug)
|
|
16447
|
+
);
|
|
16448
|
+
this.#map.set(slug, resource);
|
|
16449
|
+
}
|
|
16450
|
+
return resource;
|
|
16451
|
+
}
|
|
16452
|
+
};
|
|
16453
|
+
var Pages = class extends SwellStorefrontCollection {
|
|
16454
|
+
#drop;
|
|
16455
|
+
constructor(instance) {
|
|
16456
|
+
super(instance.swell, "content/pages", {}, async () => {
|
|
16457
|
+
const response = await this._defaultGetter().call(this);
|
|
16458
|
+
if (!response) {
|
|
16459
|
+
return null;
|
|
16460
|
+
}
|
|
16461
|
+
return {
|
|
16462
|
+
...response,
|
|
16463
|
+
page_count: response.page_count || 0,
|
|
16464
|
+
results: response.results.map((page) => ShopifyPage(instance, page))
|
|
16465
|
+
};
|
|
16466
|
+
});
|
|
16467
|
+
this.#drop = new PagesDrop(instance);
|
|
16468
|
+
}
|
|
16469
|
+
toLiquid() {
|
|
16470
|
+
return this.#drop;
|
|
16471
|
+
}
|
|
16472
|
+
};
|
|
16473
|
+
|
|
16213
16474
|
// src/compatibility/shopify.ts
|
|
16214
|
-
var
|
|
16475
|
+
var ShopifyCompatibility2 = class {
|
|
16215
16476
|
theme;
|
|
16216
16477
|
swell;
|
|
16217
16478
|
pageId;
|
|
@@ -16232,9 +16493,25 @@ ${formattedMessage}`;
|
|
|
16232
16493
|
}
|
|
16233
16494
|
initGlobals(globals) {
|
|
16234
16495
|
const { request, page } = globals;
|
|
16496
|
+
globals.additional_checkout_buttons = false;
|
|
16497
|
+
globals.all_products = new AllProductsDrop(this);
|
|
16498
|
+
globals.articles = new ArticlesDrop(this);
|
|
16499
|
+
globals.blogs = new BlogsDrop(this);
|
|
16500
|
+
globals.closest = {};
|
|
16501
|
+
globals.collections = new Collections(this);
|
|
16502
|
+
globals.content_for_additional_checkout_buttons = "";
|
|
16503
|
+
globals.content_for_header = "";
|
|
16504
|
+
globals.content_for_index = "";
|
|
16505
|
+
globals.content_for_layout = "";
|
|
16506
|
+
globals.current_page = this.swell.queryParams.page || 1;
|
|
16507
|
+
globals.images = new ImagesDrop(this);
|
|
16508
|
+
globals.linklists = null;
|
|
16509
|
+
globals.localization = null;
|
|
16510
|
+
globals.metaobjects = {};
|
|
16235
16511
|
globals.page = {
|
|
16236
16512
|
...page || void 0
|
|
16237
16513
|
};
|
|
16514
|
+
globals.pages = new Pages(this);
|
|
16238
16515
|
globals.request = {
|
|
16239
16516
|
...request || void 0,
|
|
16240
16517
|
design_mode: this.swell.isEditor,
|
|
@@ -16242,9 +16519,11 @@ ${formattedMessage}`;
|
|
|
16242
16519
|
// TODO: Add support for visual section preview
|
|
16243
16520
|
page_type: page?.id
|
|
16244
16521
|
};
|
|
16245
|
-
globals.collections = new CollectionsDrop(this);
|
|
16246
|
-
globals.current_page = this.swell.queryParams.page || 1;
|
|
16247
16522
|
globals.routes = this.getPageRoutes();
|
|
16523
|
+
globals.scripts = {};
|
|
16524
|
+
globals.shop = null;
|
|
16525
|
+
globals.template = {};
|
|
16526
|
+
globals.theme = {};
|
|
16248
16527
|
}
|
|
16249
16528
|
adaptGlobals(globals, prevGlobals) {
|
|
16250
16529
|
if (globals.page) {
|
|
@@ -16265,11 +16544,6 @@ ${formattedMessage}`;
|
|
|
16265
16544
|
if (globals.menus) {
|
|
16266
16545
|
globals.linklists = new ObjectHandlesDrop(globals.menus);
|
|
16267
16546
|
}
|
|
16268
|
-
if (globals.geo) {
|
|
16269
|
-
const countryOptions = this.getAllCountryOptionTags(globals.geo);
|
|
16270
|
-
globals.all_country_option_tags = countryOptions;
|
|
16271
|
-
globals.country_option_tags = countryOptions;
|
|
16272
|
-
}
|
|
16273
16547
|
if (globals.store) {
|
|
16274
16548
|
globals.shop = this.getShopData(globals.store);
|
|
16275
16549
|
const request = globals.request || prevGlobals.request;
|
|
@@ -16781,20 +17055,6 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16781
17055
|
}
|
|
16782
17056
|
];
|
|
16783
17057
|
}
|
|
16784
|
-
getAllCountryOptionTags(geoSettings) {
|
|
16785
|
-
if (!geoSettings) {
|
|
16786
|
-
return "";
|
|
16787
|
-
}
|
|
16788
|
-
return geoSettings.countries?.map((country) => {
|
|
16789
|
-
if (!country) return "";
|
|
16790
|
-
const provinces = (geoSettings.states || []).filter((state) => state.country === country.id).map((state) => [state.id, state.name]);
|
|
16791
|
-
const provincesEncoded = JSON.stringify(provinces).replace(
|
|
16792
|
-
/"/g,
|
|
16793
|
-
"""
|
|
16794
|
-
);
|
|
16795
|
-
return `<option value="${country.id}" data-provinces="${provincesEncoded}">${country.name}</option>`;
|
|
16796
|
-
}).filter(Boolean).join("\n");
|
|
16797
|
-
}
|
|
16798
17058
|
// returns true if this URL is used for script actions
|
|
16799
17059
|
isScriptFormActionUrl(url) {
|
|
16800
17060
|
if (!url) {
|
|
@@ -16850,25 +17110,41 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16850
17110
|
);
|
|
16851
17111
|
}
|
|
16852
17112
|
|
|
16853
|
-
// src/
|
|
16854
|
-
var
|
|
16855
|
-
var
|
|
17113
|
+
// src/liquid/drops/render.ts
|
|
17114
|
+
var import_liquidjs10 = __require("liquidjs");
|
|
17115
|
+
var import_lodash_es8 = __require("lodash-es");
|
|
17116
|
+
var RenderDrop = class extends import_liquidjs10.Drop {
|
|
17117
|
+
#result;
|
|
17118
|
+
#handler;
|
|
16856
17119
|
constructor(handler) {
|
|
16857
17120
|
super();
|
|
16858
|
-
this
|
|
17121
|
+
this.#result = void 0;
|
|
17122
|
+
this.#handler = handler;
|
|
16859
17123
|
}
|
|
16860
|
-
|
|
16861
|
-
|
|
17124
|
+
/**
|
|
17125
|
+
* For `Drop` we usually use `valueOf` to convert the `object` to a `string`.
|
|
17126
|
+
* Use `then` instead of `valueOf` since `valueOf` doesn't work for `Promise`.
|
|
17127
|
+
*/
|
|
17128
|
+
then(onfulfilled, onrejected) {
|
|
17129
|
+
if (this.#handler !== import_lodash_es8.noop) {
|
|
17130
|
+
this.#result = Promise.resolve().then(this.#handler).then((result) => {
|
|
17131
|
+
this.#result = result;
|
|
17132
|
+
return this.#result;
|
|
17133
|
+
}).then(onfulfilled, onrejected);
|
|
17134
|
+
this.#handler = import_lodash_es8.noop;
|
|
17135
|
+
return;
|
|
17136
|
+
}
|
|
17137
|
+
onfulfilled(this.#result);
|
|
16862
17138
|
}
|
|
16863
17139
|
};
|
|
16864
17140
|
|
|
16865
17141
|
// src/liquid/index.ts
|
|
16866
|
-
var
|
|
17142
|
+
var import_liquidjs30 = __require("liquidjs");
|
|
16867
17143
|
|
|
16868
17144
|
// src/liquid/tags/assign.ts
|
|
16869
|
-
var
|
|
17145
|
+
var import_liquidjs11 = __require("liquidjs");
|
|
16870
17146
|
function bind(_liquidSwell) {
|
|
16871
|
-
return class AssignTag extends
|
|
17147
|
+
return class AssignTag extends import_liquidjs11.Tag {
|
|
16872
17148
|
key;
|
|
16873
17149
|
value;
|
|
16874
17150
|
identifier;
|
|
@@ -16880,7 +17156,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16880
17156
|
this.tokenizer.skipBlank();
|
|
16881
17157
|
this.tokenizer.advance();
|
|
16882
17158
|
try {
|
|
16883
|
-
this.value = new
|
|
17159
|
+
this.value = new import_liquidjs11.Value(this.tokenizer.readFilteredValue(), this.liquid);
|
|
16884
17160
|
} catch (e) {
|
|
16885
17161
|
console.warn(
|
|
16886
17162
|
`Liquid "assign" tag: ${e instanceof Error ? e.stack : String(e)}`
|
|
@@ -16907,9 +17183,9 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16907
17183
|
}
|
|
16908
17184
|
|
|
16909
17185
|
// src/liquid/tags/case.ts
|
|
16910
|
-
var
|
|
17186
|
+
var import_liquidjs12 = __require("liquidjs");
|
|
16911
17187
|
function bind2(liquidSwell) {
|
|
16912
|
-
return class CaseTag extends
|
|
17188
|
+
return class CaseTag extends import_liquidjs12.Tag {
|
|
16913
17189
|
value;
|
|
16914
17190
|
branches;
|
|
16915
17191
|
elseTemplates;
|
|
@@ -16920,7 +17196,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16920
17196
|
const caseVar = this.tokenizer.readValue()?.getText();
|
|
16921
17197
|
this.isBlock = Boolean(caseVar?.startsWith("block."));
|
|
16922
17198
|
this.tokenizer.p = begin;
|
|
16923
|
-
this.value = new
|
|
17199
|
+
this.value = new import_liquidjs12.Value(this.tokenizer.readFilteredValue(), this.liquid);
|
|
16924
17200
|
this.branches = [];
|
|
16925
17201
|
this.elseTemplates = [];
|
|
16926
17202
|
let p = [];
|
|
@@ -16958,12 +17234,12 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16958
17234
|
}
|
|
16959
17235
|
*render(ctx, emitter) {
|
|
16960
17236
|
const r = this.liquid.renderer;
|
|
16961
|
-
const target = (0,
|
|
17237
|
+
const target = (0, import_liquidjs12.toValue)(yield this.value.value(ctx, ctx.opts.lenientIf));
|
|
16962
17238
|
let branchHit = false;
|
|
16963
17239
|
let output = "";
|
|
16964
17240
|
for (const branch of this.branches) {
|
|
16965
17241
|
for (const valueToken of branch.values) {
|
|
16966
|
-
const value = yield (0,
|
|
17242
|
+
const value = yield (0, import_liquidjs12.evalToken)(valueToken, ctx, ctx.opts.lenientIf);
|
|
16967
17243
|
if (target === value) {
|
|
16968
17244
|
const blockOutput = yield r.renderTemplates(branch.templates, ctx);
|
|
16969
17245
|
output += this.isBlock && liquidSwell.isEditor ? `<span class="swell-block">${blockOutput}</span>` : blockOutput;
|
|
@@ -16996,15 +17272,15 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16996
17272
|
}
|
|
16997
17273
|
|
|
16998
17274
|
// src/liquid/tags/comment.ts
|
|
16999
|
-
var
|
|
17275
|
+
var import_liquidjs13 = __require("liquidjs");
|
|
17000
17276
|
function bind3(_liquidSwell) {
|
|
17001
|
-
return class CommentTag extends
|
|
17277
|
+
return class CommentTag extends import_liquidjs13.Tag {
|
|
17002
17278
|
constructor(tagToken, remainTokens, liquid) {
|
|
17003
17279
|
super(tagToken, remainTokens, liquid);
|
|
17004
17280
|
let nested = 1;
|
|
17005
17281
|
while (remainTokens.length > 0) {
|
|
17006
17282
|
const token = remainTokens.shift();
|
|
17007
|
-
if (
|
|
17283
|
+
if (import_liquidjs13.TypeGuards.isTagToken(token)) {
|
|
17008
17284
|
switch (token.name) {
|
|
17009
17285
|
case "comment":
|
|
17010
17286
|
nested += 1;
|
|
@@ -17029,20 +17305,22 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17029
17305
|
}
|
|
17030
17306
|
|
|
17031
17307
|
// src/liquid/tags/for.ts
|
|
17032
|
-
var
|
|
17308
|
+
var import_liquidjs14 = __require("liquidjs");
|
|
17033
17309
|
var MODIFIERS = Object.freeze(["offset", "limit", "reversed"]);
|
|
17034
17310
|
function bind4(_liquidSwell) {
|
|
17035
|
-
return class ForTag extends
|
|
17311
|
+
return class ForTag extends import_liquidjs14.ForTag {
|
|
17036
17312
|
*render(ctx, emitter) {
|
|
17037
17313
|
const r = this.liquid.renderer;
|
|
17038
|
-
let collection = yield (0,
|
|
17314
|
+
let collection = yield (0, import_liquidjs14.evalToken)(this.collection, ctx);
|
|
17039
17315
|
collection = yield resolveEnumerable(collection);
|
|
17040
17316
|
if (!collection.length) {
|
|
17041
17317
|
yield r.renderTemplates(this.elseTemplates, ctx, emitter);
|
|
17042
17318
|
return;
|
|
17043
17319
|
}
|
|
17044
17320
|
const continueKey = "continue-" + this.variable + "-" + this.collection.getText();
|
|
17045
|
-
ctx.push({
|
|
17321
|
+
ctx.push({
|
|
17322
|
+
continue: ctx.getRegister(continueKey)
|
|
17323
|
+
});
|
|
17046
17324
|
const hash = yield this.hash.render(ctx);
|
|
17047
17325
|
ctx.pop();
|
|
17048
17326
|
const modifiers = this.liquid.options.orderedFilterParameters ? Object.keys(hash).filter((x) => MODIFIERS.includes(x)) : MODIFIERS.filter((x) => hash[x] !== void 0);
|
|
@@ -17058,23 +17336,29 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17058
17336
|
return collection2;
|
|
17059
17337
|
}
|
|
17060
17338
|
}, collection);
|
|
17061
|
-
|
|
17339
|
+
const length = Math.min(collection.length, 50);
|
|
17340
|
+
const parent = ctx.getRegister("parentloop");
|
|
17341
|
+
ctx.setRegister(continueKey, (hash["offset"] || 0) + length);
|
|
17342
|
+
const forloop = new ForloopDrop(
|
|
17343
|
+
length,
|
|
17344
|
+
this.collection.getText(),
|
|
17345
|
+
this.variable,
|
|
17346
|
+
parent
|
|
17347
|
+
);
|
|
17062
17348
|
const scope = {
|
|
17063
|
-
forloop
|
|
17064
|
-
collection.length,
|
|
17065
|
-
this.collection.getText(),
|
|
17066
|
-
this.variable
|
|
17067
|
-
)
|
|
17349
|
+
forloop
|
|
17068
17350
|
};
|
|
17069
17351
|
ctx.push(scope);
|
|
17070
|
-
|
|
17071
|
-
|
|
17352
|
+
ctx.setRegister("parentloop", forloop);
|
|
17353
|
+
for (let i = 0; i < length; ++i) {
|
|
17354
|
+
scope[this.variable] = collection[i];
|
|
17072
17355
|
ctx.continueCalled = ctx.breakCalled = false;
|
|
17073
17356
|
yield r.renderTemplates(this.templates, ctx, emitter);
|
|
17074
17357
|
if (ctx.breakCalled) break;
|
|
17075
17358
|
scope.forloop.next();
|
|
17076
17359
|
}
|
|
17077
17360
|
ctx.continueCalled = ctx.breakCalled = false;
|
|
17361
|
+
ctx.setRegister("parentloop", parent);
|
|
17078
17362
|
ctx.pop();
|
|
17079
17363
|
}
|
|
17080
17364
|
};
|
|
@@ -17090,10 +17374,10 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17090
17374
|
}
|
|
17091
17375
|
|
|
17092
17376
|
// src/liquid/tags/form.ts
|
|
17093
|
-
var
|
|
17377
|
+
var import_liquidjs15 = __require("liquidjs");
|
|
17094
17378
|
var IGNORED_SHOPIFY_FORMS = Object.freeze(["new_comment", "guest_login"]);
|
|
17095
17379
|
function bind5(liquidSwell) {
|
|
17096
|
-
return class FormTag extends
|
|
17380
|
+
return class FormTag extends import_liquidjs15.Tag {
|
|
17097
17381
|
formType;
|
|
17098
17382
|
formConfig;
|
|
17099
17383
|
templates;
|
|
@@ -17107,10 +17391,10 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17107
17391
|
tokenizer.advance();
|
|
17108
17392
|
this.arg = tokenizer.readValue();
|
|
17109
17393
|
this.templates = [];
|
|
17110
|
-
this.hash = new
|
|
17394
|
+
this.hash = new import_liquidjs15.Hash(this.tokenizer.remaining());
|
|
17111
17395
|
while (remainTokens.length > 0) {
|
|
17112
17396
|
const token2 = remainTokens.shift();
|
|
17113
|
-
if (
|
|
17397
|
+
if (import_liquidjs15.TypeGuards.isTagToken(token2) && token2.name === "endform") {
|
|
17114
17398
|
return;
|
|
17115
17399
|
}
|
|
17116
17400
|
this.templates.push(parser.parseToken(token2, remainTokens));
|
|
@@ -17128,7 +17412,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17128
17412
|
return;
|
|
17129
17413
|
}
|
|
17130
17414
|
const r = this.liquid.renderer;
|
|
17131
|
-
const arg = yield (0,
|
|
17415
|
+
const arg = yield (0, import_liquidjs15.evalToken)(this.arg, ctx);
|
|
17132
17416
|
const hash = yield this.hash.render(ctx);
|
|
17133
17417
|
const scope = ctx.getAll();
|
|
17134
17418
|
const attrs = " " + Object.entries(hash).reduce((acc, [key, value]) => {
|
|
@@ -17183,14 +17467,15 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17183
17467
|
${html}
|
|
17184
17468
|
</form>
|
|
17185
17469
|
`);
|
|
17470
|
+
ctx.pop();
|
|
17186
17471
|
}
|
|
17187
17472
|
};
|
|
17188
17473
|
}
|
|
17189
17474
|
|
|
17190
17475
|
// src/liquid/tags/if.ts
|
|
17191
|
-
var
|
|
17476
|
+
var import_liquidjs16 = __require("liquidjs");
|
|
17192
17477
|
function bind6(_liquidSwell) {
|
|
17193
|
-
return class IfTag extends
|
|
17478
|
+
return class IfTag extends import_liquidjs16.Tag {
|
|
17194
17479
|
branches = [];
|
|
17195
17480
|
elseTemplates;
|
|
17196
17481
|
constructor(tagToken, remainTokens, liquid, parser) {
|
|
@@ -17199,22 +17484,22 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17199
17484
|
parser.parseStream(remainTokens).on(
|
|
17200
17485
|
"start",
|
|
17201
17486
|
() => this.branches.push({
|
|
17202
|
-
value: new
|
|
17487
|
+
value: new import_liquidjs16.Value(
|
|
17203
17488
|
tagToken.tokenizer.readFilteredValue(),
|
|
17204
17489
|
this.liquid
|
|
17205
17490
|
),
|
|
17206
17491
|
templates: p = []
|
|
17207
17492
|
})
|
|
17208
17493
|
).on("tag:elsif", (token) => {
|
|
17209
|
-
(0,
|
|
17494
|
+
(0, import_liquidjs16.assert)(!this.elseTemplates, "unexpected elsif after else");
|
|
17210
17495
|
this.branches.push({
|
|
17211
|
-
value: new
|
|
17496
|
+
value: new import_liquidjs16.Value(token.tokenizer.readFilteredValue(), this.liquid),
|
|
17212
17497
|
templates: p = []
|
|
17213
17498
|
});
|
|
17214
17499
|
}).on("tag:else", (tag) => {
|
|
17215
17500
|
if (tag.args.length > 0) {
|
|
17216
17501
|
this.branches.push({
|
|
17217
|
-
value: new
|
|
17502
|
+
value: new import_liquidjs16.Value(tag.tokenizer.readFilteredValue(), this.liquid),
|
|
17218
17503
|
templates: p = []
|
|
17219
17504
|
});
|
|
17220
17505
|
} else {
|
|
@@ -17232,7 +17517,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17232
17517
|
const r = this.liquid.renderer;
|
|
17233
17518
|
for (const { value, templates } of this.branches) {
|
|
17234
17519
|
const v = yield value.value(ctx, ctx.opts.lenientIf);
|
|
17235
|
-
if ((0,
|
|
17520
|
+
if ((0, import_liquidjs16.isTruthy)(v, ctx)) {
|
|
17236
17521
|
yield r.renderTemplates(templates, ctx, emitter);
|
|
17237
17522
|
return;
|
|
17238
17523
|
}
|
|
@@ -17253,20 +17538,20 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17253
17538
|
};
|
|
17254
17539
|
}
|
|
17255
17540
|
function assertEmpty(predicate, message = `unexpected ${JSON.stringify(predicate)}`) {
|
|
17256
|
-
(0,
|
|
17541
|
+
(0, import_liquidjs16.assert)(!predicate, message);
|
|
17257
17542
|
}
|
|
17258
17543
|
|
|
17259
17544
|
// src/liquid/tags/javascript.ts
|
|
17260
|
-
var
|
|
17545
|
+
var import_liquidjs17 = __require("liquidjs");
|
|
17261
17546
|
function bind7(_liquidSwell) {
|
|
17262
|
-
return class JavascriptTag extends
|
|
17547
|
+
return class JavascriptTag extends import_liquidjs17.Tag {
|
|
17263
17548
|
templates;
|
|
17264
17549
|
constructor(token, remainTokens, liquid, parser) {
|
|
17265
17550
|
super(token, remainTokens, liquid);
|
|
17266
17551
|
this.templates = [];
|
|
17267
17552
|
while (remainTokens.length > 0) {
|
|
17268
17553
|
const token2 = remainTokens.shift();
|
|
17269
|
-
if (
|
|
17554
|
+
if (import_liquidjs17.TypeGuards.isTagToken(token2) && token2.name === "endjavascript") {
|
|
17270
17555
|
return;
|
|
17271
17556
|
}
|
|
17272
17557
|
this.templates.push(parser.parseToken(token2, remainTokens));
|
|
@@ -17284,9 +17569,9 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17284
17569
|
}
|
|
17285
17570
|
|
|
17286
17571
|
// src/liquid/tags/layout.ts
|
|
17287
|
-
var
|
|
17572
|
+
var import_liquidjs18 = __require("liquidjs");
|
|
17288
17573
|
function bind8(liquidSwell) {
|
|
17289
|
-
return class LayoutTag extends
|
|
17574
|
+
return class LayoutTag extends import_liquidjs18.Tag {
|
|
17290
17575
|
fileName;
|
|
17291
17576
|
constructor(token, remainTokens, liquid, _parser) {
|
|
17292
17577
|
super(token, remainTokens, liquid);
|
|
@@ -17302,9 +17587,9 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17302
17587
|
}
|
|
17303
17588
|
|
|
17304
17589
|
// src/liquid/tags/paginate.ts
|
|
17305
|
-
var
|
|
17590
|
+
var import_liquidjs19 = __require("liquidjs");
|
|
17306
17591
|
function bind9(liquidSwell) {
|
|
17307
|
-
return class PaginateTag extends
|
|
17592
|
+
return class PaginateTag extends import_liquidjs19.Tag {
|
|
17308
17593
|
collection;
|
|
17309
17594
|
pageSize;
|
|
17310
17595
|
templates;
|
|
@@ -17319,7 +17604,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17319
17604
|
}
|
|
17320
17605
|
this.templates = [];
|
|
17321
17606
|
this.collection = collection;
|
|
17322
|
-
this.hash = new
|
|
17607
|
+
this.hash = new import_liquidjs19.Hash(this.tokenizer.remaining());
|
|
17323
17608
|
const stream = parser.parseStream(remainTokens).on("tag:endpaginate", () => stream.stop()).on("template", (tpl) => {
|
|
17324
17609
|
this.templates.push(tpl);
|
|
17325
17610
|
}).on("end", () => {
|
|
@@ -17329,10 +17614,10 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17329
17614
|
}
|
|
17330
17615
|
*render(ctx, emitter) {
|
|
17331
17616
|
const r = this.liquid.renderer;
|
|
17332
|
-
const collection = yield (0,
|
|
17333
|
-
const pageSize = Number(yield (0,
|
|
17617
|
+
const collection = yield (0, import_liquidjs19.evalToken)(this.collection, ctx);
|
|
17618
|
+
const pageSize = Number(yield (0, import_liquidjs19.evalToken)(this.pageSize, ctx));
|
|
17334
17619
|
const hash = yield this.hash.render(ctx);
|
|
17335
|
-
if (!Number.isNaN(pageSize) && collection instanceof SwellStorefrontCollection && collection.limit
|
|
17620
|
+
if (!Number.isNaN(pageSize) && collection instanceof SwellStorefrontCollection && collection.limit !== pageSize) {
|
|
17336
17621
|
yield collection._get({
|
|
17337
17622
|
limit: pageSize,
|
|
17338
17623
|
window: hash.window_size || void 0
|
|
@@ -17348,15 +17633,18 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17348
17633
|
ctx.push({ paginate });
|
|
17349
17634
|
}
|
|
17350
17635
|
yield r.renderTemplates(this.templates, ctx, emitter);
|
|
17636
|
+
if (collection) {
|
|
17637
|
+
ctx.pop();
|
|
17638
|
+
}
|
|
17351
17639
|
}
|
|
17352
17640
|
};
|
|
17353
17641
|
}
|
|
17354
17642
|
|
|
17355
17643
|
// src/liquid/tags/render.ts
|
|
17356
|
-
var
|
|
17357
|
-
var
|
|
17644
|
+
var import_lodash_es9 = __require("lodash-es");
|
|
17645
|
+
var import_liquidjs20 = __require("liquidjs");
|
|
17358
17646
|
function bind10(liquidSwell) {
|
|
17359
|
-
return class RenderTag extends
|
|
17647
|
+
return class RenderTag extends import_liquidjs20.RenderTag {
|
|
17360
17648
|
*render(ctx, emitter) {
|
|
17361
17649
|
const { liquid, hash } = this;
|
|
17362
17650
|
const filepath = yield renderFilePath(
|
|
@@ -17364,23 +17652,23 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17364
17652
|
ctx,
|
|
17365
17653
|
liquid
|
|
17366
17654
|
);
|
|
17367
|
-
(0,
|
|
17655
|
+
(0, import_liquidjs20.assert)(filepath, () => `illegal file path "${filepath}"`);
|
|
17368
17656
|
const themeConfig = yield liquidSwell.getComponentPath(filepath).then(
|
|
17369
17657
|
(fileName) => liquidSwell.getThemeConfig(fileName)
|
|
17370
17658
|
);
|
|
17371
17659
|
const childCtx = ctx.spawn();
|
|
17372
17660
|
const scope = childCtx.bottom();
|
|
17373
|
-
(0,
|
|
17661
|
+
(0, import_lodash_es9.assign)(scope, yield hash.render(ctx));
|
|
17374
17662
|
const parentSection = yield ctx._get(["section"]);
|
|
17375
|
-
if (parentSection) (0,
|
|
17663
|
+
if (parentSection) (0, import_lodash_es9.assign)(scope, { section: parentSection });
|
|
17376
17664
|
if (this["with"]) {
|
|
17377
17665
|
const { value, alias } = this["with"];
|
|
17378
17666
|
const aliasName = alias || filepath;
|
|
17379
|
-
scope[aliasName] = yield (0,
|
|
17667
|
+
scope[aliasName] = yield (0, import_liquidjs20.evalToken)(value, ctx);
|
|
17380
17668
|
}
|
|
17381
17669
|
if (this["for"]) {
|
|
17382
17670
|
const { value, alias } = this["for"];
|
|
17383
|
-
let collection = yield (0,
|
|
17671
|
+
let collection = yield (0, import_liquidjs20.evalToken)(value, ctx);
|
|
17384
17672
|
collection = yield resolveEnumerable(collection);
|
|
17385
17673
|
scope["forloop"] = new ForloopDrop(
|
|
17386
17674
|
collection.length,
|
|
@@ -17413,13 +17701,13 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17413
17701
|
default:
|
|
17414
17702
|
break;
|
|
17415
17703
|
}
|
|
17416
|
-
return yield (0,
|
|
17704
|
+
return yield (0, import_liquidjs20.evalToken)(file, ctx);
|
|
17417
17705
|
}
|
|
17418
17706
|
|
|
17419
17707
|
// src/liquid/tags/section.ts
|
|
17420
|
-
var
|
|
17708
|
+
var import_liquidjs21 = __require("liquidjs");
|
|
17421
17709
|
function bind11(liquidSwell) {
|
|
17422
|
-
return class SectionTag extends
|
|
17710
|
+
return class SectionTag extends import_liquidjs21.Tag {
|
|
17423
17711
|
fileName;
|
|
17424
17712
|
constructor(token, remainTokens, liquid, _parser) {
|
|
17425
17713
|
super(token, remainTokens, liquid);
|
|
@@ -17451,7 +17739,8 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17451
17739
|
section: {
|
|
17452
17740
|
id: this.fileName,
|
|
17453
17741
|
settings: { ...defaultSettings, blocks: void 0 },
|
|
17454
|
-
blocks: defaultSettings.blocks
|
|
17742
|
+
blocks: defaultSettings.blocks,
|
|
17743
|
+
location: "static"
|
|
17455
17744
|
}
|
|
17456
17745
|
});
|
|
17457
17746
|
});
|
|
@@ -17469,10 +17758,10 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17469
17758
|
}
|
|
17470
17759
|
|
|
17471
17760
|
// src/liquid/tags/sections.ts
|
|
17472
|
-
var
|
|
17761
|
+
var import_liquidjs22 = __require("liquidjs");
|
|
17473
17762
|
var import_json54 = __toESM(__require("json5"), 1);
|
|
17474
17763
|
function bind12(liquidSwell) {
|
|
17475
|
-
return class SectionsTag extends
|
|
17764
|
+
return class SectionsTag extends import_liquidjs22.Tag {
|
|
17476
17765
|
fileName;
|
|
17477
17766
|
constructor(token, remainTokens, liquid, _parser) {
|
|
17478
17767
|
super(token, remainTokens, liquid);
|
|
@@ -17511,9 +17800,9 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17511
17800
|
}
|
|
17512
17801
|
|
|
17513
17802
|
// src/liquid/tags/style.ts
|
|
17514
|
-
var
|
|
17803
|
+
var import_liquidjs23 = __require("liquidjs");
|
|
17515
17804
|
function bind13(_liquidSwell) {
|
|
17516
|
-
return class StyleTag extends
|
|
17805
|
+
return class StyleTag extends import_liquidjs23.Tag {
|
|
17517
17806
|
templates;
|
|
17518
17807
|
hash;
|
|
17519
17808
|
constructor(token, remainTokens, liquid, parser) {
|
|
@@ -17522,7 +17811,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17522
17811
|
const tagBegin = token.begin;
|
|
17523
17812
|
while (remainTokens.length > 0) {
|
|
17524
17813
|
const token2 = remainTokens.shift();
|
|
17525
|
-
if (
|
|
17814
|
+
if (import_liquidjs23.TypeGuards.isTagToken(token2) && token2.name === "endstyle") {
|
|
17526
17815
|
this.hash = md5(token2.input.slice(tagBegin, token2.end));
|
|
17527
17816
|
return;
|
|
17528
17817
|
}
|
|
@@ -17545,16 +17834,16 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17545
17834
|
}
|
|
17546
17835
|
|
|
17547
17836
|
// src/liquid/tags/stylesheet.ts
|
|
17548
|
-
var
|
|
17837
|
+
var import_liquidjs24 = __require("liquidjs");
|
|
17549
17838
|
function bind14(_liquidSwell) {
|
|
17550
|
-
return class StyleSheetTag extends
|
|
17839
|
+
return class StyleSheetTag extends import_liquidjs24.Tag {
|
|
17551
17840
|
templates;
|
|
17552
17841
|
constructor(token, remainTokens, liquid, parser) {
|
|
17553
17842
|
super(token, remainTokens, liquid);
|
|
17554
17843
|
this.templates = [];
|
|
17555
17844
|
while (remainTokens.length > 0) {
|
|
17556
17845
|
const token2 = remainTokens.shift();
|
|
17557
|
-
if (
|
|
17846
|
+
if (import_liquidjs24.TypeGuards.isTagToken(token2) && token2.name === "endstylesheet") {
|
|
17558
17847
|
return;
|
|
17559
17848
|
}
|
|
17560
17849
|
this.templates.push(parser.parseToken(token2, remainTokens));
|
|
@@ -17570,9 +17859,9 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17570
17859
|
}
|
|
17571
17860
|
|
|
17572
17861
|
// src/liquid/tags/shopify/include.ts
|
|
17573
|
-
var
|
|
17862
|
+
var import_liquidjs25 = __require("liquidjs");
|
|
17574
17863
|
function bind15(liquidSwell) {
|
|
17575
|
-
return class IncludeTag extends
|
|
17864
|
+
return class IncludeTag extends import_liquidjs25.IncludeTag {
|
|
17576
17865
|
*render(ctx, emitter) {
|
|
17577
17866
|
const { hash } = this;
|
|
17578
17867
|
const filepath = yield renderFilePath(
|
|
@@ -17580,13 +17869,13 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17580
17869
|
ctx,
|
|
17581
17870
|
this.liquid
|
|
17582
17871
|
);
|
|
17583
|
-
(0,
|
|
17872
|
+
(0, import_liquidjs25.assert)(filepath, () => `illegal file path "${filepath}"`);
|
|
17584
17873
|
const saved = ctx.saveRegister("blocks", "blockMode");
|
|
17585
17874
|
ctx.setRegister("blocks", {});
|
|
17586
17875
|
ctx.setRegister("blockMode", 0);
|
|
17587
17876
|
const scope = yield hash.render(ctx);
|
|
17588
17877
|
if (this.withVar) {
|
|
17589
|
-
scope[filepath] = yield (0,
|
|
17878
|
+
scope[filepath] = yield (0, import_liquidjs25.evalToken)(this.withVar, ctx);
|
|
17590
17879
|
}
|
|
17591
17880
|
ctx.push(ctx.opts.jekyllInclude ? { include: scope } : scope);
|
|
17592
17881
|
const output = yield liquidSwell.getComponentPath(filepath).then((path) => liquidSwell.getThemeConfig(path)).then((themeConfig) => liquidSwell.renderTemplate(themeConfig, scope));
|
|
@@ -17598,10 +17887,10 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17598
17887
|
}
|
|
17599
17888
|
|
|
17600
17889
|
// src/liquid/tags/shopify/schema.ts
|
|
17601
|
-
var
|
|
17890
|
+
var import_liquidjs26 = __require("liquidjs");
|
|
17602
17891
|
var import_json55 = __toESM(__require("json5"), 1);
|
|
17603
17892
|
function bind16(liquidSwell) {
|
|
17604
|
-
return class SchemaTag extends
|
|
17893
|
+
return class SchemaTag extends import_liquidjs26.Tag {
|
|
17605
17894
|
templates;
|
|
17606
17895
|
constructor(token, remainTokens, liquid, parser) {
|
|
17607
17896
|
super(token, remainTokens, liquid);
|
|
@@ -17634,9 +17923,9 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17634
17923
|
}
|
|
17635
17924
|
|
|
17636
17925
|
// src/liquid/tags/inline_editable.ts
|
|
17637
|
-
var
|
|
17926
|
+
var import_liquidjs27 = __require("liquidjs");
|
|
17638
17927
|
function bind17(_liquidSwell) {
|
|
17639
|
-
return class InlineEditableTag extends
|
|
17928
|
+
return class InlineEditableTag extends import_liquidjs27.Tag {
|
|
17640
17929
|
key;
|
|
17641
17930
|
value;
|
|
17642
17931
|
constructor(token, remainTokens, liquid, _parser) {
|
|
@@ -17888,12 +18177,12 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17888
18177
|
}
|
|
17889
18178
|
|
|
17890
18179
|
// src/liquid/filters/embedded_content.ts
|
|
17891
|
-
var
|
|
18180
|
+
var import_lodash_es10 = __require("lodash-es");
|
|
17892
18181
|
function bind36(_liquidSwell) {
|
|
17893
18182
|
return (value, tag = "iframe") => {
|
|
17894
18183
|
const escapeIframes = value.replaceAll(`<${tag}`, `<${tag}`).replaceAll(`</${tag}`, `</${tag}`);
|
|
17895
18184
|
const removeTags = escapeIframes.replaceAll(/<(.*?)>/gi, "");
|
|
17896
|
-
const unescaped = (0,
|
|
18185
|
+
const unescaped = (0, import_lodash_es10.unescape)(removeTags);
|
|
17897
18186
|
const replaceSpaces = unescaped.replaceAll(" ", " ");
|
|
17898
18187
|
return replaceSpaces;
|
|
17899
18188
|
};
|
|
@@ -17968,10 +18257,10 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17968
18257
|
};
|
|
17969
18258
|
|
|
17970
18259
|
// src/liquid/filters/handleize.ts
|
|
17971
|
-
var
|
|
18260
|
+
var import_lodash_es11 = __require("lodash-es");
|
|
17972
18261
|
function bind40(_liquidSwell) {
|
|
17973
18262
|
return function filterHandleize(handle) {
|
|
17974
|
-
return (0,
|
|
18263
|
+
return (0, import_lodash_es11.kebabCase)(handle);
|
|
17975
18264
|
};
|
|
17976
18265
|
}
|
|
17977
18266
|
|
|
@@ -18696,9 +18985,9 @@ ${injects.join("\n")}<\/script>`;
|
|
|
18696
18985
|
}
|
|
18697
18986
|
|
|
18698
18987
|
// src/liquid/operators.ts
|
|
18699
|
-
var
|
|
18988
|
+
var import_liquidjs28 = __require("liquidjs");
|
|
18700
18989
|
var swellOperators = {
|
|
18701
|
-
...
|
|
18990
|
+
...import_liquidjs28.defaultOperators,
|
|
18702
18991
|
"==": equal,
|
|
18703
18992
|
"!=": (l, r) => !equal(l, r),
|
|
18704
18993
|
contains: (l, r) => {
|
|
@@ -18725,8 +19014,8 @@ ${injects.join("\n")}<\/script>`;
|
|
|
18725
19014
|
|
|
18726
19015
|
// src/liquid/color.ts
|
|
18727
19016
|
var import_color = __toESM(__require("color"), 1);
|
|
18728
|
-
var
|
|
18729
|
-
var ThemeColor = class _ThemeColor extends
|
|
19017
|
+
var import_liquidjs29 = __require("liquidjs");
|
|
19018
|
+
var ThemeColor = class _ThemeColor extends import_liquidjs29.Drop {
|
|
18730
19019
|
color;
|
|
18731
19020
|
colorValues;
|
|
18732
19021
|
red;
|
|
@@ -18861,7 +19150,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
18861
19150
|
}
|
|
18862
19151
|
|
|
18863
19152
|
// src/liquid/index.ts
|
|
18864
|
-
var LiquidSwell29 = class extends
|
|
19153
|
+
var LiquidSwell29 = class extends import_liquidjs30.Liquid {
|
|
18865
19154
|
theme;
|
|
18866
19155
|
getThemeConfig;
|
|
18867
19156
|
getThemeTemplateConfigByType;
|
|
@@ -19340,6 +19629,161 @@ ${injects.join("\n")}<\/script>`;
|
|
|
19340
19629
|
}
|
|
19341
19630
|
};
|
|
19342
19631
|
|
|
19632
|
+
// src/globals.ts
|
|
19633
|
+
var import_lodash_es12 = __require("lodash-es");
|
|
19634
|
+
|
|
19635
|
+
// src/compatibility/drops/robots-rule.ts
|
|
19636
|
+
var import_liquidjs31 = __require("liquidjs");
|
|
19637
|
+
var RobotsRule = class _RobotsRule extends import_liquidjs31.Drop {
|
|
19638
|
+
constructor(directive, value) {
|
|
19639
|
+
super();
|
|
19640
|
+
this.directive = directive;
|
|
19641
|
+
this.value = value;
|
|
19642
|
+
}
|
|
19643
|
+
static from(directive, value) {
|
|
19644
|
+
return new _RobotsRule(directive, value);
|
|
19645
|
+
}
|
|
19646
|
+
valueOf() {
|
|
19647
|
+
return `${this.directive}: ${this.value}
|
|
19648
|
+
`;
|
|
19649
|
+
}
|
|
19650
|
+
};
|
|
19651
|
+
|
|
19652
|
+
// src/globals.ts
|
|
19653
|
+
async function getFirstFilledValue(values) {
|
|
19654
|
+
for (const promise of values) {
|
|
19655
|
+
const value = await promise;
|
|
19656
|
+
if (value) {
|
|
19657
|
+
return value;
|
|
19658
|
+
}
|
|
19659
|
+
}
|
|
19660
|
+
}
|
|
19661
|
+
function getRecordGlobals(theme, record) {
|
|
19662
|
+
const globals = {};
|
|
19663
|
+
globals.handle = new RenderDrop(() => record.slug);
|
|
19664
|
+
globals.page_title = new RenderDrop(
|
|
19665
|
+
() => getFirstFilledValue([
|
|
19666
|
+
record.meta_title,
|
|
19667
|
+
// filled SEO
|
|
19668
|
+
record.name,
|
|
19669
|
+
// all records
|
|
19670
|
+
record.title,
|
|
19671
|
+
// content/pages, content/blogs, content/blog-categories
|
|
19672
|
+
theme.page?.title,
|
|
19673
|
+
// default page title
|
|
19674
|
+
theme.globals.store?.name
|
|
19675
|
+
// fallback to store name
|
|
19676
|
+
])
|
|
19677
|
+
);
|
|
19678
|
+
globals.page_description = new RenderDrop(
|
|
19679
|
+
() => getFirstFilledValue([
|
|
19680
|
+
record.meta_description,
|
|
19681
|
+
// filled SEO
|
|
19682
|
+
record.description,
|
|
19683
|
+
// product and category
|
|
19684
|
+
record.summary,
|
|
19685
|
+
// content/blogs
|
|
19686
|
+
theme.page?.description
|
|
19687
|
+
])
|
|
19688
|
+
);
|
|
19689
|
+
globals.page_image = new RenderDrop(
|
|
19690
|
+
() => getFirstFilledValue([
|
|
19691
|
+
record.images,
|
|
19692
|
+
// product and category
|
|
19693
|
+
record.image
|
|
19694
|
+
// article
|
|
19695
|
+
]).then((images) => {
|
|
19696
|
+
if (typeof images !== "object" || images === null) {
|
|
19697
|
+
return;
|
|
19698
|
+
}
|
|
19699
|
+
const image = Array.isArray(images) ? images[0] : images;
|
|
19700
|
+
return image ? ShopifyImage(image) : void 0;
|
|
19701
|
+
})
|
|
19702
|
+
);
|
|
19703
|
+
return globals;
|
|
19704
|
+
}
|
|
19705
|
+
var POWERED_BY_LINK = '<a target="_blank" rel="nofollow" href="https://www.swell.is/?utm_campaign=poweredby&utm_medium=swell&utm_source=onlinestore">Powered by Swell</a>';
|
|
19706
|
+
function getAllCountryOptionTags(geoSettings) {
|
|
19707
|
+
if (!geoSettings) {
|
|
19708
|
+
return "";
|
|
19709
|
+
}
|
|
19710
|
+
const stateMap = (geoSettings.states || []).reduce((map, state) => {
|
|
19711
|
+
let list = map.get(state.country);
|
|
19712
|
+
if (list === void 0) {
|
|
19713
|
+
list = [];
|
|
19714
|
+
map.set(state.country, list);
|
|
19715
|
+
}
|
|
19716
|
+
list.push(state);
|
|
19717
|
+
return map;
|
|
19718
|
+
}, /* @__PURE__ */ new Map());
|
|
19719
|
+
return (geoSettings.countries || []).map((country) => {
|
|
19720
|
+
if (!country) return "";
|
|
19721
|
+
const provinces = (stateMap.get(country.id) || []).map((state) => [
|
|
19722
|
+
state.id,
|
|
19723
|
+
state.name
|
|
19724
|
+
]);
|
|
19725
|
+
const provincesEncoded = JSON.stringify(provinces).replace(
|
|
19726
|
+
/"/g,
|
|
19727
|
+
"""
|
|
19728
|
+
);
|
|
19729
|
+
return `<option value="${country.id}" data-provinces="${provincesEncoded}">${country.name}</option>`;
|
|
19730
|
+
}).filter(Boolean).join("\n");
|
|
19731
|
+
}
|
|
19732
|
+
function getRobotsGlobals(canonicalUrl) {
|
|
19733
|
+
const sitemapUrl = `${(0, import_lodash_es12.trimEnd)(canonicalUrl, "/")}/sitemap.xml`;
|
|
19734
|
+
const defaultRules = [
|
|
19735
|
+
{ directive: "Disallow", value: "/admin" },
|
|
19736
|
+
{ directive: "Disallow", value: "/cart" },
|
|
19737
|
+
{ directive: "Disallow", value: "/account" },
|
|
19738
|
+
{ directive: "Disallow", value: "/search" },
|
|
19739
|
+
{ directive: "Disallow", value: "/categories/*sort_by*" },
|
|
19740
|
+
{ directive: "Disallow", value: "/*/categories/*sort_by*" }
|
|
19741
|
+
];
|
|
19742
|
+
return {
|
|
19743
|
+
default_groups: [
|
|
19744
|
+
{
|
|
19745
|
+
user_agent: RobotsRule.from("User-agent", "*"),
|
|
19746
|
+
// sitemap: RobotsRule.from('Sitemap', sitemapUrl),
|
|
19747
|
+
rules: defaultRules.map(
|
|
19748
|
+
(rule) => RobotsRule.from(rule.directive, rule.value)
|
|
19749
|
+
)
|
|
19750
|
+
},
|
|
19751
|
+
{
|
|
19752
|
+
user_agent: RobotsRule.from("User-agent", "AhrefsBot"),
|
|
19753
|
+
// sitemap: RobotsRule.from('Sitemap', sitemapUrl),
|
|
19754
|
+
rules: [
|
|
19755
|
+
RobotsRule.from("Crawl-delay", "10"),
|
|
19756
|
+
...defaultRules.map(
|
|
19757
|
+
(rule) => RobotsRule.from(rule.directive, rule.value)
|
|
19758
|
+
)
|
|
19759
|
+
]
|
|
19760
|
+
},
|
|
19761
|
+
{
|
|
19762
|
+
user_agent: RobotsRule.from("User-agent", "AhrefsSiteAudit"),
|
|
19763
|
+
// sitemap: RobotsRule.from('Sitemap', sitemapUrl),
|
|
19764
|
+
rules: [
|
|
19765
|
+
RobotsRule.from("Crawl-delay", "10"),
|
|
19766
|
+
...defaultRules.map(
|
|
19767
|
+
(rule) => RobotsRule.from(rule.directive, rule.value)
|
|
19768
|
+
)
|
|
19769
|
+
]
|
|
19770
|
+
},
|
|
19771
|
+
{
|
|
19772
|
+
user_agent: RobotsRule.from("User-agent", "Nutch"),
|
|
19773
|
+
rules: [RobotsRule.from("Crawl-delay", "10")]
|
|
19774
|
+
},
|
|
19775
|
+
{
|
|
19776
|
+
user_agent: RobotsRule.from("User-agent", "MJ12bot"),
|
|
19777
|
+
rules: [RobotsRule.from("Crawl-delay", "10")]
|
|
19778
|
+
},
|
|
19779
|
+
{
|
|
19780
|
+
user_agent: RobotsRule.from("User-agent", "Pinterest"),
|
|
19781
|
+
rules: [RobotsRule.from("Crawl-delay", "1")]
|
|
19782
|
+
}
|
|
19783
|
+
]
|
|
19784
|
+
};
|
|
19785
|
+
}
|
|
19786
|
+
|
|
19343
19787
|
// src/theme.ts
|
|
19344
19788
|
var SwellTheme3 = class {
|
|
19345
19789
|
swell;
|
|
@@ -19353,7 +19797,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
19353
19797
|
page;
|
|
19354
19798
|
pageId;
|
|
19355
19799
|
shopifyCompatibility = null;
|
|
19356
|
-
shopifyCompatibilityClass =
|
|
19800
|
+
shopifyCompatibilityClass = ShopifyCompatibility2;
|
|
19357
19801
|
shopifyCompatibilityConfig = null;
|
|
19358
19802
|
formData = {};
|
|
19359
19803
|
globalData = {};
|
|
@@ -19368,7 +19812,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
19368
19812
|
this.globals = globals || {};
|
|
19369
19813
|
this.forms = forms;
|
|
19370
19814
|
this.resources = resources;
|
|
19371
|
-
this.shopifyCompatibilityClass = shopifyCompatibilityClass ||
|
|
19815
|
+
this.shopifyCompatibilityClass = shopifyCompatibilityClass || ShopifyCompatibility2;
|
|
19372
19816
|
this.liquidSwell = new LiquidSwell29({
|
|
19373
19817
|
theme: this,
|
|
19374
19818
|
getThemeConfig: this.getThemeConfig.bind(this),
|
|
@@ -19386,8 +19830,10 @@ ${injects.join("\n")}<\/script>`;
|
|
|
19386
19830
|
getSwellAppThemeProps(swellConfig) {
|
|
19387
19831
|
return swellConfig?.storefront?.theme || {};
|
|
19388
19832
|
}
|
|
19389
|
-
async initGlobals(pageId,
|
|
19833
|
+
async initGlobals(pageId, options) {
|
|
19390
19834
|
this.pageId = pageId;
|
|
19835
|
+
const pageRecord = options?.pageRecord;
|
|
19836
|
+
const altTemplate = options?.altTemplate;
|
|
19391
19837
|
const trace = createTraceId();
|
|
19392
19838
|
logger.debug("[SDK] Theme init start", { page: pageId, trace });
|
|
19393
19839
|
await this.themeLoader.init(this.themeConfigs || void 0);
|
|
@@ -19397,6 +19843,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
19397
19843
|
const { settings, request, page, cart, account, customer } = await this.resolvePageData(store, configs, pageId, altTemplate);
|
|
19398
19844
|
logger.debug("[SDK] Theme page data load done", { page: pageId, trace });
|
|
19399
19845
|
this.page = page;
|
|
19846
|
+
const countryOptions = getAllCountryOptionTags(geo);
|
|
19400
19847
|
const globals = {
|
|
19401
19848
|
...this.globalData,
|
|
19402
19849
|
// return all storefront settings in the store
|
|
@@ -19412,10 +19859,24 @@ ${injects.join("\n")}<\/script>`;
|
|
|
19412
19859
|
geo,
|
|
19413
19860
|
configs,
|
|
19414
19861
|
language: configs?.language,
|
|
19862
|
+
...pageRecord ? getRecordGlobals(this, pageRecord) : {
|
|
19863
|
+
page_title: page.title,
|
|
19864
|
+
page_description: page.description
|
|
19865
|
+
},
|
|
19866
|
+
all_country_option_tags: countryOptions,
|
|
19867
|
+
country_option_tags: countryOptions,
|
|
19415
19868
|
canonical_url: `${store.url}${this.swell.url?.pathname || ""}`,
|
|
19869
|
+
powered_by_link: POWERED_BY_LINK,
|
|
19416
19870
|
// Flag to enable Shopify compatibility in sections and tags/filters
|
|
19417
19871
|
shopify_compatibility: Boolean(settings.shopify_compatibility)
|
|
19418
19872
|
};
|
|
19873
|
+
switch (pageId) {
|
|
19874
|
+
case "robots.txt":
|
|
19875
|
+
globals.robots = getRobotsGlobals(globals.canonical_url);
|
|
19876
|
+
break;
|
|
19877
|
+
default:
|
|
19878
|
+
break;
|
|
19879
|
+
}
|
|
19419
19880
|
if (this.shopifyCompatibility) {
|
|
19420
19881
|
this.shopifyCompatibility.initGlobals(globals);
|
|
19421
19882
|
}
|
|
@@ -19750,7 +20211,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
19750
20211
|
return languageConfig;
|
|
19751
20212
|
}
|
|
19752
20213
|
const localeShortCode = locale.split("-")[0];
|
|
19753
|
-
return (0,
|
|
20214
|
+
return (0, import_lodash_es13.reduce)(
|
|
19754
20215
|
languageConfig,
|
|
19755
20216
|
(acc, value, key) => {
|
|
19756
20217
|
if (isObject2(value)) {
|
|
@@ -19774,15 +20235,15 @@ ${injects.join("\n")}<\/script>`;
|
|
|
19774
20235
|
const translationEnd = translationParts.pop();
|
|
19775
20236
|
const translationPath = translationParts.join(".");
|
|
19776
20237
|
const translationConfigGlobal = this.globals.language;
|
|
19777
|
-
acc[key] = (0,
|
|
20238
|
+
acc[key] = (0, import_lodash_es13.get)(
|
|
19778
20239
|
translationConfigGlobal,
|
|
19779
20240
|
`${translationPath}.$locale.${locale}.${translationEnd}`
|
|
19780
|
-
) || (0,
|
|
20241
|
+
) || (0, import_lodash_es13.get)(
|
|
19781
20242
|
translationConfigGlobal,
|
|
19782
20243
|
`${translationPath}.$locale.${localeShortCode}.${translationEnd}`
|
|
19783
|
-
) || (0,
|
|
20244
|
+
) || (0, import_lodash_es13.get)(translationConfigGlobal, translationKey) || value;
|
|
19784
20245
|
} else {
|
|
19785
|
-
acc[key] = (0,
|
|
20246
|
+
acc[key] = (0, import_lodash_es13.get)(languageConfig, `$locale.${locale}.${key}`) || (0, import_lodash_es13.get)(languageConfig, `$locale.${localeShortCode}.${key}`) || value;
|
|
19786
20247
|
}
|
|
19787
20248
|
}
|
|
19788
20249
|
return acc;
|
|
@@ -19797,7 +20258,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
19797
20258
|
}
|
|
19798
20259
|
return this.shopifyCompatibility;
|
|
19799
20260
|
};
|
|
19800
|
-
if (
|
|
20261
|
+
if (Object.keys(configs.editor).length <= 0 && configs.settings_schema) {
|
|
19801
20262
|
const store = await this.swell.storefront.settings.get("store");
|
|
19802
20263
|
configs.editor = shopifyCompatibility().getEditorConfig(
|
|
19803
20264
|
configs.settings_schema
|
|
@@ -19808,13 +20269,13 @@ ${injects.join("\n")}<\/script>`;
|
|
|
19808
20269
|
store.locale || "en-US"
|
|
19809
20270
|
);
|
|
19810
20271
|
}
|
|
19811
|
-
if (
|
|
20272
|
+
if (Object.keys(configs.theme).length <= 0 && configs.settings_data) {
|
|
19812
20273
|
configs.theme = shopifyCompatibility().getThemeConfig(
|
|
19813
20274
|
configs.settings_data
|
|
19814
20275
|
);
|
|
19815
20276
|
this.themeSettingFilePath = "theme/config/settings_data.json";
|
|
19816
20277
|
}
|
|
19817
|
-
if (
|
|
20278
|
+
if (Object.keys(configs.presets).length <= 0 && configs.settings_data) {
|
|
19818
20279
|
configs.presets = shopifyCompatibility().getPresetsConfig(
|
|
19819
20280
|
configs.settings_data
|
|
19820
20281
|
);
|
|
@@ -20006,8 +20467,11 @@ ${injects.join("\n")}<\/script>`;
|
|
|
20006
20467
|
}
|
|
20007
20468
|
return null;
|
|
20008
20469
|
}
|
|
20470
|
+
async getAssetConfig(assetName) {
|
|
20471
|
+
return await this.getThemeConfig(`theme/assets/${assetName}`) ?? await this.getThemeConfig(`assets/${assetName}`) ?? null;
|
|
20472
|
+
}
|
|
20009
20473
|
async getAssetUrl(filePath) {
|
|
20010
|
-
const assetConfig = await this.
|
|
20474
|
+
const assetConfig = await this.getAssetConfig(filePath);
|
|
20011
20475
|
const file = assetConfig?.file;
|
|
20012
20476
|
if (!file) {
|
|
20013
20477
|
return null;
|
|
@@ -20309,13 +20773,42 @@ ${content.slice(pos)}`;
|
|
|
20309
20773
|
}
|
|
20310
20774
|
return "";
|
|
20311
20775
|
}
|
|
20312
|
-
async renderLayout(layoutName, data) {
|
|
20776
|
+
async renderLayout(layoutName, data, contentForLayout, contentForHeader) {
|
|
20313
20777
|
layoutName = layoutName || this.liquidSwell.layoutName;
|
|
20314
20778
|
if (layoutName) {
|
|
20315
|
-
|
|
20779
|
+
if (data) {
|
|
20780
|
+
data = await this.renderDataFields(data, [
|
|
20781
|
+
"page_title",
|
|
20782
|
+
"page_description"
|
|
20783
|
+
]);
|
|
20784
|
+
}
|
|
20785
|
+
return this.renderLayoutTemplate(layoutName, {
|
|
20786
|
+
...data,
|
|
20787
|
+
content_for_layout: contentForLayout,
|
|
20788
|
+
content_for_header: contentForHeader
|
|
20789
|
+
});
|
|
20316
20790
|
} else {
|
|
20317
|
-
return
|
|
20791
|
+
return contentForLayout || "";
|
|
20792
|
+
}
|
|
20793
|
+
}
|
|
20794
|
+
async renderDataFields(data, fields) {
|
|
20795
|
+
const promises = [];
|
|
20796
|
+
for (const key of fields) {
|
|
20797
|
+
if (typeof data[key] === "string") {
|
|
20798
|
+
promises.push(
|
|
20799
|
+
this.renderTemplateString(data[key], data).then((value) => {
|
|
20800
|
+
if (data) {
|
|
20801
|
+
data[key] = value;
|
|
20802
|
+
}
|
|
20803
|
+
})
|
|
20804
|
+
);
|
|
20805
|
+
}
|
|
20318
20806
|
}
|
|
20807
|
+
if (promises.length > 0) {
|
|
20808
|
+
data = { ...data };
|
|
20809
|
+
await Promise.all(promises);
|
|
20810
|
+
}
|
|
20811
|
+
return data;
|
|
20319
20812
|
}
|
|
20320
20813
|
getContentForHeader() {
|
|
20321
20814
|
let content = "\n";
|
|
@@ -20483,8 +20976,10 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
20483
20976
|
const pageLayout = pageSchema.layout || "";
|
|
20484
20977
|
const pageSectionGroups = [];
|
|
20485
20978
|
this.pageSectionGroups = pageSectionGroups;
|
|
20486
|
-
await this.renderLayout(
|
|
20487
|
-
|
|
20979
|
+
await this.renderLayout(
|
|
20980
|
+
pageLayout,
|
|
20981
|
+
{},
|
|
20982
|
+
new RenderDrop(() => {
|
|
20488
20983
|
pageSectionGroups.push({
|
|
20489
20984
|
prop: SECTION_GROUP_CONTENT,
|
|
20490
20985
|
label: "Template",
|
|
@@ -20493,7 +20988,7 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
20493
20988
|
});
|
|
20494
20989
|
return "";
|
|
20495
20990
|
})
|
|
20496
|
-
|
|
20991
|
+
);
|
|
20497
20992
|
this.pageSectionGroups = null;
|
|
20498
20993
|
return pageSectionGroups;
|
|
20499
20994
|
}
|
|
@@ -20535,7 +21030,7 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
20535
21030
|
return Promise.all(
|
|
20536
21031
|
sectionConfigs.map(async (sectionConfig, index) => {
|
|
20537
21032
|
const { section, schema } = sectionConfig;
|
|
20538
|
-
const settings = schema?.fields && this.globals ? resolveSectionSettings(this, sectionConfig) : { ...sectionConfig.settings };
|
|
21033
|
+
const settings = schema?.fields && this.globals ? resolveSectionSettings(this, sectionConfig, index) : { ...sectionConfig.settings };
|
|
20539
21034
|
const templateConfig = await this.getThemeTemplateConfigByType(
|
|
20540
21035
|
"sections",
|
|
20541
21036
|
`${section.type}.liquid`
|
|
@@ -20549,7 +21044,7 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
20549
21044
|
});
|
|
20550
21045
|
if (settings?.section?.custom_css) {
|
|
20551
21046
|
output += `<style>${scopeCustomCSS(
|
|
20552
|
-
settings
|
|
21047
|
+
settings.section.custom_css,
|
|
20553
21048
|
sectionConfig.id
|
|
20554
21049
|
)}</style>`;
|
|
20555
21050
|
}
|
|
@@ -20579,8 +21074,8 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
20579
21074
|
const keyParts = key?.split(".") || [];
|
|
20580
21075
|
const keyName = keyParts.pop() || "";
|
|
20581
21076
|
const keyPath = keyParts.join(".");
|
|
20582
|
-
const langObject = (0,
|
|
20583
|
-
let localeValue = (0,
|
|
21077
|
+
const langObject = (0, import_lodash_es13.get)(langConfig, keyPath);
|
|
21078
|
+
let localeValue = (0, import_lodash_es13.get)(langObject?.[localeCode], keyName) || (0, import_lodash_es13.get)(langObject?.[localeCode.split("-")[0]], keyName) || langObject?.[keyName];
|
|
20584
21079
|
if (data?.count !== void 0 && localeValue?.one) {
|
|
20585
21080
|
localeValue = data.count === 1 ? localeValue.one : localeValue.other;
|
|
20586
21081
|
}
|
|
@@ -20614,7 +21109,7 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
20614
21109
|
super(title, status, description);
|
|
20615
21110
|
}
|
|
20616
21111
|
};
|
|
20617
|
-
function resolveSectionSettings(theme, sectionConfig) {
|
|
21112
|
+
function resolveSectionSettings(theme, sectionConfig, index) {
|
|
20618
21113
|
const { settings, schema } = sectionConfig;
|
|
20619
21114
|
if (!schema || !settings?.section?.settings) {
|
|
20620
21115
|
return settings;
|
|
@@ -20645,7 +21140,10 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
20645
21140
|
settings.section.settings,
|
|
20646
21141
|
editorSettings
|
|
20647
21142
|
),
|
|
20648
|
-
blocks
|
|
21143
|
+
blocks,
|
|
21144
|
+
index0: index,
|
|
21145
|
+
index: typeof index === "number" ? index + 1 : void 0,
|
|
21146
|
+
location: getSectionLocation(settings.section.type)
|
|
20649
21147
|
}
|
|
20650
21148
|
};
|
|
20651
21149
|
}
|
|
@@ -20659,7 +21157,7 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
20659
21157
|
}
|
|
20660
21158
|
}
|
|
20661
21159
|
function resolveThemeSettings(theme, themeSettings, editorSchemaSettings) {
|
|
20662
|
-
const settings = (0,
|
|
21160
|
+
const settings = (0, import_lodash_es13.cloneDeep)(themeSettings);
|
|
20663
21161
|
if (settings.$locale) {
|
|
20664
21162
|
const { locale } = theme.swell.getStorefrontLocalization();
|
|
20665
21163
|
const localeConfig = settings.$locale[locale] || {};
|
|
@@ -20669,16 +21167,16 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
20669
21167
|
}
|
|
20670
21168
|
}
|
|
20671
21169
|
}
|
|
20672
|
-
(0,
|
|
21170
|
+
(0, import_lodash_es13.each)(settings, (value, key) => {
|
|
20673
21171
|
const setting = (editorSchemaSettings && findEditorSetting(editorSchemaSettings, key)) ?? null;
|
|
20674
21172
|
if (isObject2(value) && !(value instanceof StorefrontResource)) {
|
|
20675
21173
|
switch (setting?.type) {
|
|
20676
21174
|
case "color_scheme_group": {
|
|
20677
|
-
(0,
|
|
21175
|
+
(0, import_lodash_es13.each)(value, (scheme, schemeId) => {
|
|
20678
21176
|
if (isObject2(scheme) && typeof scheme.settings === "object" && scheme.settings) {
|
|
20679
21177
|
const settings2 = scheme.settings;
|
|
20680
|
-
(0,
|
|
20681
|
-
const fieldDef = (0,
|
|
21178
|
+
(0, import_lodash_es13.each)(settings2, (colorValue, colorId) => {
|
|
21179
|
+
const fieldDef = (0, import_lodash_es13.find)(setting.fields, { id: colorId });
|
|
20682
21180
|
if (fieldDef?.type === "color" && colorValue) {
|
|
20683
21181
|
scheme.id = schemeId;
|
|
20684
21182
|
settings2[colorId] = new ThemeColor(colorValue);
|
|
@@ -20729,7 +21227,7 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
20729
21227
|
}
|
|
20730
21228
|
function findThemeSettingsByType(type, themeSettings, editorSchemaSettings) {
|
|
20731
21229
|
const foundSettings = [];
|
|
20732
|
-
(0,
|
|
21230
|
+
(0, import_lodash_es13.each)(themeSettings, (value, key) => {
|
|
20733
21231
|
if (isObject2(value) && !(value instanceof ThemeFont) && !(value instanceof StorefrontResource)) {
|
|
20734
21232
|
foundSettings.push(
|
|
20735
21233
|
...findThemeSettingsByType(type, value, editorSchemaSettings)
|
|
@@ -20898,7 +21396,7 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
20898
21396
|
}
|
|
20899
21397
|
function getMenuItemValueId(value) {
|
|
20900
21398
|
const fallback = typeof value === "string" ? value : "";
|
|
20901
|
-
const slug = (0,
|
|
21399
|
+
const slug = (0, import_lodash_es14.get)(value, "id", (0, import_lodash_es14.get)(value, "slug", fallback)) || "";
|
|
20902
21400
|
return slug;
|
|
20903
21401
|
}
|
|
20904
21402
|
async function getMenuItemUrlAndResource(theme, menuItem) {
|