@swell/apps-sdk 1.0.155 → 1.0.157
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 +240 -162
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +207 -127
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +224 -145
- package/dist/index.mjs.map +4 -4
- package/dist/src/liquid/filters/date_next_interval.d.ts +3 -0
- package/dist/src/liquid/filters/index.d.ts +2 -0
- package/dist/src/resources/index.d.ts +34 -4
- package/package.json +1 -1
- package/dist/src/resources/product_recommendations.d.ts +0 -6
package/dist/index.cjs
CHANGED
|
@@ -30,19 +30,34 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
AccountAddressesResource: () => AccountAddressesResource,
|
|
34
|
+
AccountOrderResource: () => AccountOrderResource,
|
|
35
|
+
AccountOrdersResource: () => AccountOrdersResource,
|
|
36
|
+
AccountResource: () => AccountResource,
|
|
37
|
+
AccountSubscriptionResource: () => AccountSubscriptionResource,
|
|
38
|
+
AccountSubscriptionsResource: () => AccountSubscriptionsResource,
|
|
39
|
+
BlogCategoryResource: () => BlogCategoryResource,
|
|
40
|
+
BlogResource: () => BlogResource,
|
|
33
41
|
CURRENCY_COUNTRIES: () => CURRENCY_COUNTRIES,
|
|
42
|
+
CartResource: () => CartResource,
|
|
43
|
+
CategoriesResource: () => CategoriesResource,
|
|
44
|
+
CategoryResource: () => CategoryResource,
|
|
34
45
|
DEFAULT_QUERY_PAGE_LIMIT: () => DEFAULT_QUERY_PAGE_LIMIT,
|
|
35
46
|
DeferredShopifyResource: () => DeferredShopifyResource,
|
|
36
47
|
FILE_DATA_INCLUDE_QUERY: () => FILE_DATA_INCLUDE_QUERY,
|
|
37
48
|
GEO_DATA: () => GEO_DATA,
|
|
38
49
|
LANG_TO_COUNTRY_CODES: () => LANG_TO_COUNTRY_CODES,
|
|
39
|
-
LiquidSwell: () =>
|
|
50
|
+
LiquidSwell: () => LiquidSwell30,
|
|
40
51
|
MAX_QUERY_PAGE_LIMIT: () => MAX_QUERY_PAGE_LIMIT,
|
|
41
52
|
MockRecordResource: () => MockRecordResource,
|
|
42
53
|
MockRecordSingleton: () => MockRecordSingleton,
|
|
43
54
|
PageError: () => PageError,
|
|
44
55
|
PageNotFound: () => PageNotFound,
|
|
56
|
+
PageResource: () => PageResource,
|
|
57
|
+
PredictiveSearchResource: () => PredictiveSearchResource,
|
|
58
|
+
ProductResource: () => ProductResource,
|
|
45
59
|
SECTION_GROUP_CONTENT: () => SECTION_GROUP_CONTENT,
|
|
60
|
+
SearchResource: () => SearchResource,
|
|
46
61
|
ShopifyArticle: () => ShopifyArticle,
|
|
47
62
|
ShopifyBlog: () => ShopifyBlog,
|
|
48
63
|
ShopifyCart: () => ShopifyCart,
|
|
@@ -65,35 +80,19 @@ __export(index_exports, {
|
|
|
65
80
|
ShopifyVariant: () => ShopifyVariant,
|
|
66
81
|
StorefrontResource: () => StorefrontResource,
|
|
67
82
|
Swell: () => Swell,
|
|
68
|
-
SwellAccount: () => SwellAccount,
|
|
69
|
-
SwellAddresses: () => SwellAddresses,
|
|
70
83
|
SwellBackendAPI: () => SwellBackendAPI,
|
|
71
|
-
SwellBlog: () => SwellBlog,
|
|
72
|
-
SwellBlogCategory: () => SwellBlogCategory,
|
|
73
|
-
SwellCart: () => SwellCart,
|
|
74
|
-
SwellCategories: () => SwellCategories,
|
|
75
|
-
SwellCategory: () => SwellCategory,
|
|
76
84
|
SwellError: () => SwellError,
|
|
77
|
-
SwellOrder: () => SwellOrder,
|
|
78
|
-
SwellOrders: () => SwellOrders,
|
|
79
|
-
SwellPage: () => SwellPage,
|
|
80
|
-
SwellPredictiveSearch: () => SwellPredictiveSearch,
|
|
81
|
-
SwellProduct: () => SwellProduct,
|
|
82
|
-
SwellProductRecommendations: () => SwellProductRecommendations,
|
|
83
|
-
SwellSearch: () => SwellSearch,
|
|
84
85
|
SwellStorefrontCollection: () => SwellStorefrontCollection,
|
|
85
86
|
SwellStorefrontPagination: () => SwellStorefrontPagination,
|
|
86
87
|
SwellStorefrontRecord: () => SwellStorefrontRecord,
|
|
87
88
|
SwellStorefrontResource: () => SwellStorefrontResource,
|
|
88
89
|
SwellStorefrontSingleton: () => SwellStorefrontSingleton,
|
|
89
|
-
SwellSubscription: () => SwellSubscription,
|
|
90
|
-
SwellSubscriptions: () => SwellSubscriptions,
|
|
91
90
|
SwellTheme: () => SwellTheme3,
|
|
92
|
-
SwellVariant: () => SwellVariant,
|
|
93
91
|
ThemeColor: () => ThemeColor,
|
|
94
92
|
ThemeFont: () => ThemeFont,
|
|
95
93
|
ThemeForm: () => ThemeForm,
|
|
96
94
|
ThemeFormErrors: () => ThemeFormErrors,
|
|
95
|
+
VariantResource: () => VariantResource,
|
|
97
96
|
WorkerHtmlCache: () => WorkerHtmlCache,
|
|
98
97
|
adaptShopifyFontData: () => adaptShopifyFontData,
|
|
99
98
|
adaptShopifyFormData: () => adaptShopifyFormData,
|
|
@@ -8308,28 +8307,6 @@ var SwellAccount = class extends SwellStorefrontSingleton {
|
|
|
8308
8307
|
}
|
|
8309
8308
|
};
|
|
8310
8309
|
|
|
8311
|
-
// src/resources/blog_category.ts
|
|
8312
|
-
var SwellBlogCategory = class extends SwellStorefrontRecord {
|
|
8313
|
-
constructor(swell, id, query) {
|
|
8314
|
-
super(swell, "content/blog-categories", id, query, async function() {
|
|
8315
|
-
const category = await this._defaultGetter().call(this);
|
|
8316
|
-
if (!category) {
|
|
8317
|
-
return null;
|
|
8318
|
-
}
|
|
8319
|
-
category.blogs = new SwellStorefrontCollection(
|
|
8320
|
-
this._swell,
|
|
8321
|
-
"content/blogs",
|
|
8322
|
-
{
|
|
8323
|
-
category_id: category.id,
|
|
8324
|
-
expand: "author"
|
|
8325
|
-
}
|
|
8326
|
-
);
|
|
8327
|
-
return category;
|
|
8328
|
-
});
|
|
8329
|
-
return this._getProxy();
|
|
8330
|
-
}
|
|
8331
|
-
};
|
|
8332
|
-
|
|
8333
8310
|
// src/resources/blog.ts
|
|
8334
8311
|
var SwellBlog = class extends SwellStorefrontRecord {
|
|
8335
8312
|
constructor(swell, blogId, categoryId, query) {
|
|
@@ -8352,6 +8329,28 @@ var SwellBlog = class extends SwellStorefrontRecord {
|
|
|
8352
8329
|
}
|
|
8353
8330
|
};
|
|
8354
8331
|
|
|
8332
|
+
// src/resources/blog_category.ts
|
|
8333
|
+
var SwellBlogCategory = class extends SwellStorefrontRecord {
|
|
8334
|
+
constructor(swell, id, query) {
|
|
8335
|
+
super(swell, "content/blog-categories", id, query, async function() {
|
|
8336
|
+
const category = await this._defaultGetter().call(this);
|
|
8337
|
+
if (!category) {
|
|
8338
|
+
return null;
|
|
8339
|
+
}
|
|
8340
|
+
category.blogs = new SwellStorefrontCollection(
|
|
8341
|
+
this._swell,
|
|
8342
|
+
"content/blogs",
|
|
8343
|
+
{
|
|
8344
|
+
category_id: category.id,
|
|
8345
|
+
expand: "author"
|
|
8346
|
+
}
|
|
8347
|
+
);
|
|
8348
|
+
return category;
|
|
8349
|
+
});
|
|
8350
|
+
return this._getProxy();
|
|
8351
|
+
}
|
|
8352
|
+
};
|
|
8353
|
+
|
|
8355
8354
|
// src/resources/cart.ts
|
|
8356
8355
|
var SwellCart = class extends SwellStorefrontSingleton {
|
|
8357
8356
|
constructor(swell) {
|
|
@@ -8360,35 +8359,6 @@ var SwellCart = class extends SwellStorefrontSingleton {
|
|
|
8360
8359
|
}
|
|
8361
8360
|
};
|
|
8362
8361
|
|
|
8363
|
-
// src/resources/categories.ts
|
|
8364
|
-
var SwellCategories = class extends SwellStorefrontCollection {
|
|
8365
|
-
constructor(swell, query) {
|
|
8366
|
-
super(
|
|
8367
|
-
swell,
|
|
8368
|
-
"categories",
|
|
8369
|
-
{
|
|
8370
|
-
limit: 100,
|
|
8371
|
-
top_id: null,
|
|
8372
|
-
...query
|
|
8373
|
-
},
|
|
8374
|
-
async function() {
|
|
8375
|
-
const categories = await this._defaultGetter().call(this);
|
|
8376
|
-
if (!categories) {
|
|
8377
|
-
return null;
|
|
8378
|
-
}
|
|
8379
|
-
for (const category of categories.results) {
|
|
8380
|
-
category.products = new SwellStorefrontCollection(
|
|
8381
|
-
this._swell,
|
|
8382
|
-
"products",
|
|
8383
|
-
{ category: category.id }
|
|
8384
|
-
);
|
|
8385
|
-
}
|
|
8386
|
-
return categories;
|
|
8387
|
-
}
|
|
8388
|
-
);
|
|
8389
|
-
}
|
|
8390
|
-
};
|
|
8391
|
-
|
|
8392
8362
|
// src/resources/product_helpers.ts
|
|
8393
8363
|
function isGiftcard(product) {
|
|
8394
8364
|
return product.type === "giftcard";
|
|
@@ -8639,6 +8609,35 @@ var SwellCategory = class extends SwellStorefrontRecord {
|
|
|
8639
8609
|
}
|
|
8640
8610
|
};
|
|
8641
8611
|
|
|
8612
|
+
// src/resources/categories.ts
|
|
8613
|
+
var SwellCategories = class extends SwellStorefrontCollection {
|
|
8614
|
+
constructor(swell, query) {
|
|
8615
|
+
super(
|
|
8616
|
+
swell,
|
|
8617
|
+
"categories",
|
|
8618
|
+
{
|
|
8619
|
+
limit: 100,
|
|
8620
|
+
top_id: null,
|
|
8621
|
+
...query
|
|
8622
|
+
},
|
|
8623
|
+
async function() {
|
|
8624
|
+
const categories = await this._defaultGetter().call(this);
|
|
8625
|
+
if (!categories) {
|
|
8626
|
+
return null;
|
|
8627
|
+
}
|
|
8628
|
+
for (const category of categories.results) {
|
|
8629
|
+
category.products = new SwellStorefrontCollection(
|
|
8630
|
+
this._swell,
|
|
8631
|
+
"products",
|
|
8632
|
+
{ category: category.id }
|
|
8633
|
+
);
|
|
8634
|
+
}
|
|
8635
|
+
return categories;
|
|
8636
|
+
}
|
|
8637
|
+
);
|
|
8638
|
+
}
|
|
8639
|
+
};
|
|
8640
|
+
|
|
8642
8641
|
// src/resources/order.ts
|
|
8643
8642
|
var SwellOrder = class extends SwellStorefrontRecord {
|
|
8644
8643
|
constructor(swell, id, query) {
|
|
@@ -8747,13 +8746,6 @@ var SwellProduct = class extends SwellStorefrontRecord {
|
|
|
8747
8746
|
}
|
|
8748
8747
|
};
|
|
8749
8748
|
|
|
8750
|
-
// src/resources/product_recommendations.ts
|
|
8751
|
-
var SwellProductRecommendations = class extends SwellProduct {
|
|
8752
|
-
constructor(swell, id, query) {
|
|
8753
|
-
super(swell, id, { ...query, $recommendations: true });
|
|
8754
|
-
}
|
|
8755
|
-
};
|
|
8756
|
-
|
|
8757
8749
|
// src/resources/search.ts
|
|
8758
8750
|
var SwellSearch = class extends StorefrontResource {
|
|
8759
8751
|
constructor(swell, query) {
|
|
@@ -8781,6 +8773,40 @@ var SwellSubscription = class extends SwellStorefrontRecord {
|
|
|
8781
8773
|
}
|
|
8782
8774
|
};
|
|
8783
8775
|
|
|
8776
|
+
// src/resources/index.ts
|
|
8777
|
+
var AccountResource = class extends SwellAccount {
|
|
8778
|
+
};
|
|
8779
|
+
var AccountAddressesResource = class extends SwellAddresses {
|
|
8780
|
+
};
|
|
8781
|
+
var BlogResource = class extends SwellBlog {
|
|
8782
|
+
};
|
|
8783
|
+
var BlogCategoryResource = class extends SwellBlogCategory {
|
|
8784
|
+
};
|
|
8785
|
+
var CartResource = class extends SwellCart {
|
|
8786
|
+
};
|
|
8787
|
+
var CategoryResource = class extends SwellCategory {
|
|
8788
|
+
};
|
|
8789
|
+
var CategoriesResource = class extends SwellCategories {
|
|
8790
|
+
};
|
|
8791
|
+
var AccountOrderResource = class extends SwellOrder {
|
|
8792
|
+
};
|
|
8793
|
+
var AccountOrdersResource = class extends SwellOrders {
|
|
8794
|
+
};
|
|
8795
|
+
var PageResource = class extends SwellPage {
|
|
8796
|
+
};
|
|
8797
|
+
var PredictiveSearchResource = class extends SwellPredictiveSearch {
|
|
8798
|
+
};
|
|
8799
|
+
var ProductResource = class extends SwellProduct {
|
|
8800
|
+
};
|
|
8801
|
+
var SearchResource = class extends SwellSearch {
|
|
8802
|
+
};
|
|
8803
|
+
var AccountSubscriptionResource = class extends SwellSubscription {
|
|
8804
|
+
};
|
|
8805
|
+
var AccountSubscriptionsResource = class extends SwellSubscriptions {
|
|
8806
|
+
};
|
|
8807
|
+
var VariantResource = class extends SwellVariant {
|
|
8808
|
+
};
|
|
8809
|
+
|
|
8784
8810
|
// src/api.ts
|
|
8785
8811
|
var DEFAULT_API_HOST = "https://api.schema.io";
|
|
8786
8812
|
var resourceCaches = /* @__PURE__ */ new Map();
|
|
@@ -19199,7 +19225,7 @@ var tags = {
|
|
|
19199
19225
|
};
|
|
19200
19226
|
function bindTags(liquidSwell) {
|
|
19201
19227
|
Object.entries(tags).forEach(
|
|
19202
|
-
([tag,
|
|
19228
|
+
([tag, bind64]) => liquidSwell.registerTag(tag, bind64(liquidSwell))
|
|
19203
19229
|
);
|
|
19204
19230
|
}
|
|
19205
19231
|
|
|
@@ -19367,8 +19393,60 @@ function applyStrftimeFormat(format, date) {
|
|
|
19367
19393
|
return (0, import_strftime.default)(format, date);
|
|
19368
19394
|
}
|
|
19369
19395
|
|
|
19370
|
-
// src/liquid/filters/
|
|
19396
|
+
// src/liquid/filters/date_next_interval.ts
|
|
19371
19397
|
function bind34(_liquidSwell) {
|
|
19398
|
+
return (dateValue, interval, intervalCount) => {
|
|
19399
|
+
const date = ensureDate(dateValue);
|
|
19400
|
+
const result = getNextIntervalDate(date, interval, Number(intervalCount));
|
|
19401
|
+
return result ? new Date(result).toISOString() : (/* @__PURE__ */ new Date()).toISOString();
|
|
19402
|
+
};
|
|
19403
|
+
}
|
|
19404
|
+
function getNextIntervalDate(date, interval, intervalCount) {
|
|
19405
|
+
if (!interval || !date) {
|
|
19406
|
+
return;
|
|
19407
|
+
}
|
|
19408
|
+
if (interval === "monthly" || interval === 30) {
|
|
19409
|
+
return dateNextMonth(date, intervalCount);
|
|
19410
|
+
}
|
|
19411
|
+
let intervalDays = 0;
|
|
19412
|
+
if (typeof interval === "string") {
|
|
19413
|
+
if (interval === "daily") {
|
|
19414
|
+
intervalDays = 1;
|
|
19415
|
+
} else if (interval === "weekly") {
|
|
19416
|
+
intervalDays = 7;
|
|
19417
|
+
} else if (interval === "yearly") {
|
|
19418
|
+
intervalDays = 365;
|
|
19419
|
+
}
|
|
19420
|
+
}
|
|
19421
|
+
if (intervalDays <= 0) {
|
|
19422
|
+
return;
|
|
19423
|
+
}
|
|
19424
|
+
return time(date) + intervalDays * intervalCount * 86400 * 1e3;
|
|
19425
|
+
}
|
|
19426
|
+
function dateNextMonth(startDate, intervalCount) {
|
|
19427
|
+
const date = new Date(startDate);
|
|
19428
|
+
const nextDate = new Date(date);
|
|
19429
|
+
nextDate.setUTCMonth(date.getMonth() + (intervalCount || 1));
|
|
19430
|
+
if (nextDate.getDate() !== date.getDate()) {
|
|
19431
|
+
nextDate.setDate(nextDate.getDate() - nextDate.getDate());
|
|
19432
|
+
}
|
|
19433
|
+
return nextDate.getTime();
|
|
19434
|
+
}
|
|
19435
|
+
function time(date) {
|
|
19436
|
+
if (date === void 0) {
|
|
19437
|
+
return Date.now();
|
|
19438
|
+
}
|
|
19439
|
+
if (typeof date === "number" || typeof date === "string") {
|
|
19440
|
+
return new Date(date).getTime();
|
|
19441
|
+
}
|
|
19442
|
+
if (date instanceof Date) {
|
|
19443
|
+
return date.getTime();
|
|
19444
|
+
}
|
|
19445
|
+
return Date.now();
|
|
19446
|
+
}
|
|
19447
|
+
|
|
19448
|
+
// src/liquid/filters/default_errors.ts
|
|
19449
|
+
function bind35(_liquidSwell) {
|
|
19372
19450
|
return async function filterDefaultError(errors) {
|
|
19373
19451
|
if (!errors) {
|
|
19374
19452
|
return "";
|
|
@@ -19394,7 +19472,7 @@ function bind34(_liquidSwell) {
|
|
|
19394
19472
|
}
|
|
19395
19473
|
|
|
19396
19474
|
// src/liquid/filters/divided_by.ts
|
|
19397
|
-
function
|
|
19475
|
+
function bind36(_liquidSwell) {
|
|
19398
19476
|
return (dividend, divisor, integerArithmetic) => {
|
|
19399
19477
|
if (!isNumber(dividend) || !isNumber(divisor)) {
|
|
19400
19478
|
return dividend;
|
|
@@ -19405,7 +19483,7 @@ function bind35(_liquidSwell) {
|
|
|
19405
19483
|
|
|
19406
19484
|
// src/liquid/filters/embedded_content.ts
|
|
19407
19485
|
var import_lodash_es10 = require("lodash-es");
|
|
19408
|
-
function
|
|
19486
|
+
function bind37(_liquidSwell) {
|
|
19409
19487
|
return (value, tag = "iframe") => {
|
|
19410
19488
|
const escapeIframes = value.replaceAll(`<${tag}`, `<${tag}`).replaceAll(`</${tag}`, `</${tag}`);
|
|
19411
19489
|
const removeTags = escapeIframes.replaceAll(/<(.*?)>/gi, "");
|
|
@@ -19416,7 +19494,7 @@ function bind36(_liquidSwell) {
|
|
|
19416
19494
|
}
|
|
19417
19495
|
|
|
19418
19496
|
// src/liquid/filters/font_face.ts
|
|
19419
|
-
function
|
|
19497
|
+
function bind38(_liquidSwell) {
|
|
19420
19498
|
return (fontSetting, ...params) => {
|
|
19421
19499
|
if (!fontSetting) {
|
|
19422
19500
|
return null;
|
|
@@ -19428,14 +19506,14 @@ function bind37(_liquidSwell) {
|
|
|
19428
19506
|
}
|
|
19429
19507
|
|
|
19430
19508
|
// src/liquid/filters/font_modify.ts
|
|
19431
|
-
function
|
|
19509
|
+
function bind39(_liquidSwell) {
|
|
19432
19510
|
return (fontSetting, prop, value) => {
|
|
19433
19511
|
return ThemeFont.clone(fontSetting).modify(prop, value);
|
|
19434
19512
|
};
|
|
19435
19513
|
}
|
|
19436
19514
|
|
|
19437
19515
|
// src/liquid/filters/font_url.ts
|
|
19438
|
-
function
|
|
19516
|
+
function bind40(_liquidSwell) {
|
|
19439
19517
|
return (fontSetting) => {
|
|
19440
19518
|
return ThemeFont.get(fontSetting).url();
|
|
19441
19519
|
};
|
|
@@ -19485,14 +19563,14 @@ var format_address_default = {
|
|
|
19485
19563
|
|
|
19486
19564
|
// src/liquid/filters/handleize.ts
|
|
19487
19565
|
var import_lodash_es11 = require("lodash-es");
|
|
19488
|
-
function
|
|
19566
|
+
function bind41(_liquidSwell) {
|
|
19489
19567
|
return function filterHandleize(handle) {
|
|
19490
19568
|
return (0, import_lodash_es11.kebabCase)(handle);
|
|
19491
19569
|
};
|
|
19492
19570
|
}
|
|
19493
19571
|
|
|
19494
19572
|
// src/liquid/filters/image_tag.ts
|
|
19495
|
-
function
|
|
19573
|
+
function bind42(_liquidSwell) {
|
|
19496
19574
|
return function filterImageTag(imageUrl, ...params) {
|
|
19497
19575
|
imageUrl = String(imageUrl || "");
|
|
19498
19576
|
let {
|
|
@@ -19656,7 +19734,7 @@ var filterDefinition = {
|
|
|
19656
19734
|
var image_url_default = filterDefinition;
|
|
19657
19735
|
|
|
19658
19736
|
// src/liquid/filters/inline_asset_content.ts
|
|
19659
|
-
function
|
|
19737
|
+
function bind43(liquidSwell) {
|
|
19660
19738
|
return async (assetPath) => {
|
|
19661
19739
|
const config = await liquidSwell.theme.getThemeConfig(
|
|
19662
19740
|
`theme/assets/${assetPath}`
|
|
@@ -19666,14 +19744,14 @@ function bind42(liquidSwell) {
|
|
|
19666
19744
|
}
|
|
19667
19745
|
|
|
19668
19746
|
// src/liquid/filters/json.ts
|
|
19669
|
-
function
|
|
19747
|
+
function bind44(_liquidSwell) {
|
|
19670
19748
|
return async function filterJson(input, space = 0) {
|
|
19671
19749
|
return jsonStringifyAsync(input, space);
|
|
19672
19750
|
};
|
|
19673
19751
|
}
|
|
19674
19752
|
|
|
19675
19753
|
// src/liquid/filters/json_pretty.ts
|
|
19676
|
-
function
|
|
19754
|
+
function bind45(_liquidSwell) {
|
|
19677
19755
|
return async function filterJsonPretty(input, space = 2) {
|
|
19678
19756
|
const output = await jsonStringifyAsync(input, space);
|
|
19679
19757
|
return `<pre>${output}</pre>`;
|
|
@@ -19690,7 +19768,7 @@ function getCountryCode(localCode) {
|
|
|
19690
19768
|
return localCode.toUpperCase();
|
|
19691
19769
|
}
|
|
19692
19770
|
}
|
|
19693
|
-
function
|
|
19771
|
+
function bind46(_liquidSwell) {
|
|
19694
19772
|
return (localeCode) => {
|
|
19695
19773
|
if (typeof localeCode !== "string") {
|
|
19696
19774
|
return flags.US;
|
|
@@ -19701,7 +19779,7 @@ function bind45(_liquidSwell) {
|
|
|
19701
19779
|
}
|
|
19702
19780
|
|
|
19703
19781
|
// src/liquid/filters/money.ts
|
|
19704
|
-
function
|
|
19782
|
+
function bind47(liquidSwell) {
|
|
19705
19783
|
return function filterMoney(value) {
|
|
19706
19784
|
const amount = value instanceof MoneyDrop ? value.toFloat() : Number(value || 0);
|
|
19707
19785
|
return liquidSwell.renderCurrency(amount);
|
|
@@ -19709,7 +19787,7 @@ function bind46(liquidSwell) {
|
|
|
19709
19787
|
}
|
|
19710
19788
|
|
|
19711
19789
|
// src/liquid/filters/money_with_currency.ts
|
|
19712
|
-
function
|
|
19790
|
+
function bind48(liquidSwell) {
|
|
19713
19791
|
return function filterMoneyWithCurrency(value) {
|
|
19714
19792
|
const { currency } = liquidSwell.theme.swell.getStorefrontLocalization();
|
|
19715
19793
|
const amount = value instanceof MoneyDrop ? value.toFloat() : Number(value || 0);
|
|
@@ -19718,7 +19796,7 @@ function bind47(liquidSwell) {
|
|
|
19718
19796
|
}
|
|
19719
19797
|
|
|
19720
19798
|
// src/liquid/filters/money_without_currency.ts
|
|
19721
|
-
function
|
|
19799
|
+
function bind49(liquidSwell) {
|
|
19722
19800
|
return function filterMoneyWithoutCurrency(value) {
|
|
19723
19801
|
const amount = value instanceof MoneyDrop ? value.toFloat() : Number(value || 0);
|
|
19724
19802
|
return liquidSwell.renderCurrency(amount).replace(/[^0-9.,]/g, "");
|
|
@@ -19726,7 +19804,7 @@ function bind48(liquidSwell) {
|
|
|
19726
19804
|
}
|
|
19727
19805
|
|
|
19728
19806
|
// src/liquid/filters/money_without_trailing_zeros.ts
|
|
19729
|
-
function
|
|
19807
|
+
function bind50(liquidSwell) {
|
|
19730
19808
|
return function filterMoneyWithoutTrailingZeros(value) {
|
|
19731
19809
|
const amount = value instanceof MoneyDrop ? value.toFloat() : Number(value || 0);
|
|
19732
19810
|
return liquidSwell.renderCurrency(amount).split(".")[0].split(",")[0];
|
|
@@ -19734,21 +19812,21 @@ function bind49(liquidSwell) {
|
|
|
19734
19812
|
}
|
|
19735
19813
|
|
|
19736
19814
|
// src/liquid/filters/script_tag.ts
|
|
19737
|
-
function
|
|
19815
|
+
function bind51(_liquidSwell) {
|
|
19738
19816
|
return function filterScriptTag(assetUrl) {
|
|
19739
19817
|
return `<script src="${assetUrl}" type="text/javascript"></script>`;
|
|
19740
19818
|
};
|
|
19741
19819
|
}
|
|
19742
19820
|
|
|
19743
19821
|
// src/liquid/filters/stylesheet_tag.ts
|
|
19744
|
-
function
|
|
19822
|
+
function bind52(_liquidSwell) {
|
|
19745
19823
|
return function filterStyleSheetTag(assetUrl) {
|
|
19746
19824
|
return `<link href="${assetUrl}" rel="stylesheet" type="text/css" media="all" />`;
|
|
19747
19825
|
};
|
|
19748
19826
|
}
|
|
19749
19827
|
|
|
19750
19828
|
// src/liquid/filters/time_tag.ts
|
|
19751
|
-
function
|
|
19829
|
+
function bind53(_liquidSwell) {
|
|
19752
19830
|
const dateFilter = bind33(_liquidSwell);
|
|
19753
19831
|
return (dateValue, ...params) => {
|
|
19754
19832
|
const date = ensureDate(dateValue);
|
|
@@ -19759,7 +19837,7 @@ function bind52(_liquidSwell) {
|
|
|
19759
19837
|
}
|
|
19760
19838
|
|
|
19761
19839
|
// src/liquid/filters/translate.ts
|
|
19762
|
-
function
|
|
19840
|
+
function bind54(liquidSwell) {
|
|
19763
19841
|
return async function filterTranslate(key, params) {
|
|
19764
19842
|
const props = params && paramsToProps(params);
|
|
19765
19843
|
const str = await liquidSwell.renderTranslation(key, props);
|
|
@@ -19768,7 +19846,7 @@ function bind53(liquidSwell) {
|
|
|
19768
19846
|
}
|
|
19769
19847
|
|
|
19770
19848
|
// src/liquid/filters/where.ts
|
|
19771
|
-
function
|
|
19849
|
+
function bind55(_liquidSwell) {
|
|
19772
19850
|
return function* filterWhere(arr, property, expected) {
|
|
19773
19851
|
const results = [];
|
|
19774
19852
|
const list = yield resolveEnumerable(arr);
|
|
@@ -19822,7 +19900,7 @@ function getSizesFromParam(param) {
|
|
|
19822
19900
|
height: height ? Number(height) : void 0
|
|
19823
19901
|
};
|
|
19824
19902
|
}
|
|
19825
|
-
function
|
|
19903
|
+
function bind56(liquidSwell) {
|
|
19826
19904
|
return async function filterAssetImgUrl(assetPath, size = "small") {
|
|
19827
19905
|
const imageUrl = await liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
|
|
19828
19906
|
const sizes = getSizesFromParam(size);
|
|
@@ -19838,7 +19916,7 @@ function bind55(liquidSwell) {
|
|
|
19838
19916
|
}
|
|
19839
19917
|
|
|
19840
19918
|
// src/liquid/filters/shopify/hex_to_rgba.ts
|
|
19841
|
-
function
|
|
19919
|
+
function bind57(_liquidSwell) {
|
|
19842
19920
|
return (color, alpha) => {
|
|
19843
19921
|
return ThemeColor.get(color).rgba(alpha || 1);
|
|
19844
19922
|
};
|
|
@@ -19858,14 +19936,14 @@ var item_count_for_variant_default = {
|
|
|
19858
19936
|
};
|
|
19859
19937
|
|
|
19860
19938
|
// src/liquid/filters/shopify/payment_button.ts
|
|
19861
|
-
function
|
|
19939
|
+
function bind58(_liquidSwell) {
|
|
19862
19940
|
return (form) => {
|
|
19863
19941
|
return null;
|
|
19864
19942
|
};
|
|
19865
19943
|
}
|
|
19866
19944
|
|
|
19867
19945
|
// src/liquid/filters/shopify/payment_terms.ts
|
|
19868
|
-
function
|
|
19946
|
+
function bind59(_liquidSwell) {
|
|
19869
19947
|
return (form) => {
|
|
19870
19948
|
return null;
|
|
19871
19949
|
};
|
|
@@ -19967,7 +20045,7 @@ var svgs = {
|
|
|
19967
20045
|
var placeholder_svgs_default = svgs;
|
|
19968
20046
|
|
|
19969
20047
|
// src/liquid/filters/shopify/placeholder_svg_tag.ts
|
|
19970
|
-
function
|
|
20048
|
+
function bind60(_liquidSwell) {
|
|
19971
20049
|
return function filterPlaceholderSvgTag(name, className) {
|
|
19972
20050
|
const svg = placeholder_svgs_default[name];
|
|
19973
20051
|
if (typeof svg === "object" && svg !== null) {
|
|
@@ -19978,7 +20056,7 @@ function bind59(_liquidSwell) {
|
|
|
19978
20056
|
}
|
|
19979
20057
|
|
|
19980
20058
|
// src/liquid/filters/shopify/shopify_asset_url.ts
|
|
19981
|
-
function
|
|
20059
|
+
function bind61(_liquidSwell) {
|
|
19982
20060
|
return function filterShopifyAssetUrl(input) {
|
|
19983
20061
|
if (typeof input === "string") {
|
|
19984
20062
|
switch (input) {
|
|
@@ -20003,7 +20081,7 @@ function bind60(_liquidSwell) {
|
|
|
20003
20081
|
}
|
|
20004
20082
|
|
|
20005
20083
|
// src/liquid/filters/shopify/structured_data.ts
|
|
20006
|
-
function
|
|
20084
|
+
function bind62(_liquidSwell) {
|
|
20007
20085
|
return async function filterStructuredData(input) {
|
|
20008
20086
|
let value = input;
|
|
20009
20087
|
if (value instanceof StorefrontResource) {
|
|
@@ -20081,7 +20159,7 @@ function convertToSchemaOrgProductGroup(product) {
|
|
|
20081
20159
|
}
|
|
20082
20160
|
|
|
20083
20161
|
// src/liquid/filters/inline_editable.ts
|
|
20084
|
-
function
|
|
20162
|
+
function bind63(_liquidSwell) {
|
|
20085
20163
|
return (value, key) => {
|
|
20086
20164
|
if (typeof value === "object" && "value" in value) {
|
|
20087
20165
|
value = value.value;
|
|
@@ -20107,45 +20185,46 @@ var filters = {
|
|
|
20107
20185
|
color_to_hex: bind30,
|
|
20108
20186
|
color_to_hsl: bind31,
|
|
20109
20187
|
color_to_rgb: bind32,
|
|
20188
|
+
date_next_interval: bind34,
|
|
20110
20189
|
date: bind33,
|
|
20111
|
-
default_errors:
|
|
20112
|
-
divided_by:
|
|
20113
|
-
embedded_content:
|
|
20114
|
-
font_face:
|
|
20115
|
-
font_modify:
|
|
20116
|
-
font_url:
|
|
20190
|
+
default_errors: bind35,
|
|
20191
|
+
divided_by: bind36,
|
|
20192
|
+
embedded_content: bind37,
|
|
20193
|
+
font_face: bind38,
|
|
20194
|
+
font_modify: bind39,
|
|
20195
|
+
font_url: bind40,
|
|
20117
20196
|
format_address: format_address_default,
|
|
20118
|
-
handle:
|
|
20197
|
+
handle: bind41,
|
|
20119
20198
|
// alias
|
|
20120
|
-
handleize:
|
|
20121
|
-
image_tag:
|
|
20199
|
+
handleize: bind41,
|
|
20200
|
+
image_tag: bind42,
|
|
20122
20201
|
image_url: image_url_default,
|
|
20123
|
-
inline_asset_content:
|
|
20124
|
-
json:
|
|
20125
|
-
json_pretty:
|
|
20126
|
-
locale_flag:
|
|
20127
|
-
money:
|
|
20128
|
-
money_with_currency:
|
|
20129
|
-
money_without_currency:
|
|
20130
|
-
money_without_trailing_zeros:
|
|
20131
|
-
script_tag:
|
|
20132
|
-
stylesheet_tag:
|
|
20133
|
-
time_tag:
|
|
20134
|
-
translate:
|
|
20135
|
-
t:
|
|
20202
|
+
inline_asset_content: bind43,
|
|
20203
|
+
json: bind44,
|
|
20204
|
+
json_pretty: bind45,
|
|
20205
|
+
locale_flag: bind46,
|
|
20206
|
+
money: bind47,
|
|
20207
|
+
money_with_currency: bind48,
|
|
20208
|
+
money_without_currency: bind49,
|
|
20209
|
+
money_without_trailing_zeros: bind50,
|
|
20210
|
+
script_tag: bind51,
|
|
20211
|
+
stylesheet_tag: bind52,
|
|
20212
|
+
time_tag: bind53,
|
|
20213
|
+
translate: bind54,
|
|
20214
|
+
t: bind54,
|
|
20136
20215
|
// alias
|
|
20137
|
-
where:
|
|
20216
|
+
where: bind55,
|
|
20138
20217
|
// Shopify compatibility only
|
|
20139
|
-
asset_img_url:
|
|
20140
|
-
hex_to_rgba:
|
|
20218
|
+
asset_img_url: bind56,
|
|
20219
|
+
hex_to_rgba: bind57,
|
|
20141
20220
|
item_count_for_variant: item_count_for_variant_default,
|
|
20142
|
-
payment_button:
|
|
20143
|
-
payment_terms:
|
|
20144
|
-
placeholder_svg_tag:
|
|
20145
|
-
shopify_asset_url:
|
|
20146
|
-
structured_data:
|
|
20221
|
+
payment_button: bind58,
|
|
20222
|
+
payment_terms: bind59,
|
|
20223
|
+
placeholder_svg_tag: bind60,
|
|
20224
|
+
shopify_asset_url: bind61,
|
|
20225
|
+
structured_data: bind62,
|
|
20147
20226
|
// Swell only
|
|
20148
|
-
inline_editable:
|
|
20227
|
+
inline_editable: bind63
|
|
20149
20228
|
};
|
|
20150
20229
|
function bindFilters(liquidSwell) {
|
|
20151
20230
|
for (const [tag, handler] of Object.entries(filters)) {
|
|
@@ -20159,8 +20238,8 @@ function bindFilters(liquidSwell) {
|
|
|
20159
20238
|
}
|
|
20160
20239
|
}
|
|
20161
20240
|
}
|
|
20162
|
-
function bindWithResolvedProps(liquidSwell,
|
|
20163
|
-
const handler =
|
|
20241
|
+
function bindWithResolvedProps(liquidSwell, bind64, resolve = []) {
|
|
20242
|
+
const handler = bind64(liquidSwell);
|
|
20164
20243
|
if (!Array.isArray(resolve)) {
|
|
20165
20244
|
return handler;
|
|
20166
20245
|
}
|
|
@@ -20377,7 +20456,7 @@ function isThemeColorLike(value) {
|
|
|
20377
20456
|
}
|
|
20378
20457
|
|
|
20379
20458
|
// src/liquid/index.ts
|
|
20380
|
-
var
|
|
20459
|
+
var LiquidSwell30 = class extends import_liquidjs30.Liquid {
|
|
20381
20460
|
theme;
|
|
20382
20461
|
getThemeConfig;
|
|
20383
20462
|
getThemeTemplateConfigByType;
|
|
@@ -20965,7 +21044,7 @@ var SwellTheme3 = class {
|
|
|
20965
21044
|
this.forms = forms;
|
|
20966
21045
|
this.resources = resources;
|
|
20967
21046
|
this.shopifyCompatibilityClass = shopifyCompatibilityClass || ShopifyCompatibility2;
|
|
20968
|
-
this.liquidSwell = new
|
|
21047
|
+
this.liquidSwell = new LiquidSwell30({
|
|
20969
21048
|
theme: this,
|
|
20970
21049
|
getThemeConfig: this.getThemeConfig.bind(this),
|
|
20971
21050
|
getAssetUrl: this.getAssetUrl.bind(this),
|
|
@@ -21240,8 +21319,8 @@ var SwellTheme3 = class {
|
|
|
21240
21319
|
return result ?? defaultValue();
|
|
21241
21320
|
}
|
|
21242
21321
|
async fetchCart() {
|
|
21243
|
-
const
|
|
21244
|
-
const cart =
|
|
21322
|
+
const CartResource2 = this.resources?.singletons?.cart;
|
|
21323
|
+
const cart = CartResource2 ? new CartResource2(this.swell) : new SwellStorefrontSingleton(this.swell, "cart");
|
|
21245
21324
|
cart._isEmpty = function() {
|
|
21246
21325
|
return !this._result?.items?.length;
|
|
21247
21326
|
};
|
|
@@ -21253,8 +21332,8 @@ var SwellTheme3 = class {
|
|
|
21253
21332
|
return cart;
|
|
21254
21333
|
}
|
|
21255
21334
|
async fetchAccount() {
|
|
21256
|
-
const
|
|
21257
|
-
const account =
|
|
21335
|
+
const AccountResource2 = this.resources?.singletons?.account;
|
|
21336
|
+
const account = AccountResource2 ? new AccountResource2(this.swell) : new SwellStorefrontSingleton(this.swell, "account");
|
|
21258
21337
|
await account.id;
|
|
21259
21338
|
if (!account?.id) {
|
|
21260
21339
|
return null;
|
|
@@ -22844,7 +22923,18 @@ function getResourceQuery(slug, query) {
|
|
|
22844
22923
|
}
|
|
22845
22924
|
// Annotate the CommonJS export names for ESM import in node:
|
|
22846
22925
|
0 && (module.exports = {
|
|
22926
|
+
AccountAddressesResource,
|
|
22927
|
+
AccountOrderResource,
|
|
22928
|
+
AccountOrdersResource,
|
|
22929
|
+
AccountResource,
|
|
22930
|
+
AccountSubscriptionResource,
|
|
22931
|
+
AccountSubscriptionsResource,
|
|
22932
|
+
BlogCategoryResource,
|
|
22933
|
+
BlogResource,
|
|
22847
22934
|
CURRENCY_COUNTRIES,
|
|
22935
|
+
CartResource,
|
|
22936
|
+
CategoriesResource,
|
|
22937
|
+
CategoryResource,
|
|
22848
22938
|
DEFAULT_QUERY_PAGE_LIMIT,
|
|
22849
22939
|
DeferredShopifyResource,
|
|
22850
22940
|
FILE_DATA_INCLUDE_QUERY,
|
|
@@ -22856,7 +22946,11 @@ function getResourceQuery(slug, query) {
|
|
|
22856
22946
|
MockRecordSingleton,
|
|
22857
22947
|
PageError,
|
|
22858
22948
|
PageNotFound,
|
|
22949
|
+
PageResource,
|
|
22950
|
+
PredictiveSearchResource,
|
|
22951
|
+
ProductResource,
|
|
22859
22952
|
SECTION_GROUP_CONTENT,
|
|
22953
|
+
SearchResource,
|
|
22860
22954
|
ShopifyArticle,
|
|
22861
22955
|
ShopifyBlog,
|
|
22862
22956
|
ShopifyCart,
|
|
@@ -22879,35 +22973,19 @@ function getResourceQuery(slug, query) {
|
|
|
22879
22973
|
ShopifyVariant,
|
|
22880
22974
|
StorefrontResource,
|
|
22881
22975
|
Swell,
|
|
22882
|
-
SwellAccount,
|
|
22883
|
-
SwellAddresses,
|
|
22884
22976
|
SwellBackendAPI,
|
|
22885
|
-
SwellBlog,
|
|
22886
|
-
SwellBlogCategory,
|
|
22887
|
-
SwellCart,
|
|
22888
|
-
SwellCategories,
|
|
22889
|
-
SwellCategory,
|
|
22890
22977
|
SwellError,
|
|
22891
|
-
SwellOrder,
|
|
22892
|
-
SwellOrders,
|
|
22893
|
-
SwellPage,
|
|
22894
|
-
SwellPredictiveSearch,
|
|
22895
|
-
SwellProduct,
|
|
22896
|
-
SwellProductRecommendations,
|
|
22897
|
-
SwellSearch,
|
|
22898
22978
|
SwellStorefrontCollection,
|
|
22899
22979
|
SwellStorefrontPagination,
|
|
22900
22980
|
SwellStorefrontRecord,
|
|
22901
22981
|
SwellStorefrontResource,
|
|
22902
22982
|
SwellStorefrontSingleton,
|
|
22903
|
-
SwellSubscription,
|
|
22904
|
-
SwellSubscriptions,
|
|
22905
22983
|
SwellTheme,
|
|
22906
|
-
SwellVariant,
|
|
22907
22984
|
ThemeColor,
|
|
22908
22985
|
ThemeFont,
|
|
22909
22986
|
ThemeForm,
|
|
22910
22987
|
ThemeFormErrors,
|
|
22988
|
+
VariantResource,
|
|
22911
22989
|
WorkerHtmlCache,
|
|
22912
22990
|
adaptShopifyFontData,
|
|
22913
22991
|
adaptShopifyFormData,
|