@swell/apps-sdk 1.0.140 → 1.0.141
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 +114 -97
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +114 -97
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +98 -81
- package/dist/index.mjs.map +4 -4
- package/dist/src/liquid/filters/handleize.d.ts +3 -0
- package/dist/src/liquid/filters/index.d.ts +3 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -8725,11 +8725,11 @@ function getRandomId() {
|
|
|
8725
8725
|
}
|
|
8726
8726
|
|
|
8727
8727
|
// src/menus.ts
|
|
8728
|
-
var
|
|
8728
|
+
var import_lodash_es12 = require("lodash-es");
|
|
8729
8729
|
|
|
8730
8730
|
// src/theme.ts
|
|
8731
8731
|
var import_json56 = __toESM(require("json5"), 1);
|
|
8732
|
-
var
|
|
8732
|
+
var import_lodash_es11 = require("lodash-es");
|
|
8733
8733
|
|
|
8734
8734
|
// src/compatibility/shopify.ts
|
|
8735
8735
|
var import_lodash_es7 = require("lodash-es");
|
|
@@ -17549,7 +17549,7 @@ var tags = {
|
|
|
17549
17549
|
};
|
|
17550
17550
|
function bindTags(liquidSwell) {
|
|
17551
17551
|
Object.entries(tags).forEach(
|
|
17552
|
-
([tag,
|
|
17552
|
+
([tag, bind63]) => liquidSwell.registerTag(tag, bind63(liquidSwell))
|
|
17553
17553
|
);
|
|
17554
17554
|
}
|
|
17555
17555
|
|
|
@@ -17833,8 +17833,16 @@ var format_address_default = {
|
|
|
17833
17833
|
]
|
|
17834
17834
|
};
|
|
17835
17835
|
|
|
17836
|
-
// src/liquid/filters/
|
|
17836
|
+
// src/liquid/filters/handleize.ts
|
|
17837
|
+
var import_lodash_es10 = require("lodash-es");
|
|
17837
17838
|
function bind40(_liquidSwell) {
|
|
17839
|
+
return function filterHandleize(handle) {
|
|
17840
|
+
return (0, import_lodash_es10.kebabCase)(handle);
|
|
17841
|
+
};
|
|
17842
|
+
}
|
|
17843
|
+
|
|
17844
|
+
// src/liquid/filters/image_tag.ts
|
|
17845
|
+
function bind41(_liquidSwell) {
|
|
17838
17846
|
return function filterImageTag(imageUrl, ...params) {
|
|
17839
17847
|
imageUrl = String(imageUrl || "");
|
|
17840
17848
|
let {
|
|
@@ -17998,7 +18006,7 @@ var filterDefinition = {
|
|
|
17998
18006
|
var image_url_default = filterDefinition;
|
|
17999
18007
|
|
|
18000
18008
|
// src/liquid/filters/inline_asset_content.ts
|
|
18001
|
-
function
|
|
18009
|
+
function bind42(liquidSwell) {
|
|
18002
18010
|
return async (assetPath) => {
|
|
18003
18011
|
const config = await liquidSwell.theme.getThemeConfig(
|
|
18004
18012
|
`theme/assets/${assetPath}`
|
|
@@ -18008,14 +18016,14 @@ function bind41(liquidSwell) {
|
|
|
18008
18016
|
}
|
|
18009
18017
|
|
|
18010
18018
|
// src/liquid/filters/json.ts
|
|
18011
|
-
function
|
|
18019
|
+
function bind43(_liquidSwell) {
|
|
18012
18020
|
return async function filterJson(input, space = 0) {
|
|
18013
18021
|
return jsonStringifyAsync(input, space);
|
|
18014
18022
|
};
|
|
18015
18023
|
}
|
|
18016
18024
|
|
|
18017
18025
|
// src/liquid/filters/json_pretty.ts
|
|
18018
|
-
function
|
|
18026
|
+
function bind44(_liquidSwell) {
|
|
18019
18027
|
return async function filterJsonPretty(input, space = 2) {
|
|
18020
18028
|
const output = await jsonStringifyAsync(input, space);
|
|
18021
18029
|
return `<pre>${output}</pre>`;
|
|
@@ -18032,7 +18040,7 @@ function getCountryCode(localCode) {
|
|
|
18032
18040
|
return localCode.toUpperCase();
|
|
18033
18041
|
}
|
|
18034
18042
|
}
|
|
18035
|
-
function
|
|
18043
|
+
function bind45(_liquidSwell) {
|
|
18036
18044
|
return (localeCode) => {
|
|
18037
18045
|
if (typeof localeCode !== "string") {
|
|
18038
18046
|
return flags.US;
|
|
@@ -18043,7 +18051,7 @@ function bind44(_liquidSwell) {
|
|
|
18043
18051
|
}
|
|
18044
18052
|
|
|
18045
18053
|
// src/liquid/filters/money.ts
|
|
18046
|
-
function
|
|
18054
|
+
function bind46(liquidSwell) {
|
|
18047
18055
|
return function filterMoney(value) {
|
|
18048
18056
|
const amount = value instanceof MoneyDrop ? value.toFloat() : Number(value || 0);
|
|
18049
18057
|
return liquidSwell.renderCurrency(amount);
|
|
@@ -18051,7 +18059,7 @@ function bind45(liquidSwell) {
|
|
|
18051
18059
|
}
|
|
18052
18060
|
|
|
18053
18061
|
// src/liquid/filters/money_with_currency.ts
|
|
18054
|
-
function
|
|
18062
|
+
function bind47(liquidSwell) {
|
|
18055
18063
|
return function filterMoneyWithCurrency(value) {
|
|
18056
18064
|
const { currency } = liquidSwell.theme.swell.getStorefrontLocalization();
|
|
18057
18065
|
const amount = value instanceof MoneyDrop ? value.toFloat() : Number(value || 0);
|
|
@@ -18060,7 +18068,7 @@ function bind46(liquidSwell) {
|
|
|
18060
18068
|
}
|
|
18061
18069
|
|
|
18062
18070
|
// src/liquid/filters/money_without_currency.ts
|
|
18063
|
-
function
|
|
18071
|
+
function bind48(liquidSwell) {
|
|
18064
18072
|
return function filterMoneyWithoutCurrency(value) {
|
|
18065
18073
|
const amount = value instanceof MoneyDrop ? value.toFloat() : Number(value || 0);
|
|
18066
18074
|
return liquidSwell.renderCurrency(amount).replace(/[^0-9.,]/g, "");
|
|
@@ -18068,7 +18076,7 @@ function bind47(liquidSwell) {
|
|
|
18068
18076
|
}
|
|
18069
18077
|
|
|
18070
18078
|
// src/liquid/filters/money_without_trailing_zeros.ts
|
|
18071
|
-
function
|
|
18079
|
+
function bind49(liquidSwell) {
|
|
18072
18080
|
return function filterMoneyWithoutTrailingZeros(value) {
|
|
18073
18081
|
const amount = value instanceof MoneyDrop ? value.toFloat() : Number(value || 0);
|
|
18074
18082
|
return liquidSwell.renderCurrency(amount).split(".")[0].split(",")[0];
|
|
@@ -18076,21 +18084,21 @@ function bind48(liquidSwell) {
|
|
|
18076
18084
|
}
|
|
18077
18085
|
|
|
18078
18086
|
// src/liquid/filters/script_tag.ts
|
|
18079
|
-
function
|
|
18087
|
+
function bind50(_liquidSwell) {
|
|
18080
18088
|
return function filterScriptTag(assetUrl) {
|
|
18081
18089
|
return `<script src="${assetUrl}" type="text/javascript"></script>`;
|
|
18082
18090
|
};
|
|
18083
18091
|
}
|
|
18084
18092
|
|
|
18085
18093
|
// src/liquid/filters/stylesheet_tag.ts
|
|
18086
|
-
function
|
|
18094
|
+
function bind51(_liquidSwell) {
|
|
18087
18095
|
return function filterStyleSheetTag(assetUrl) {
|
|
18088
18096
|
return `<link href="${assetUrl}" rel="stylesheet" type="text/css" media="all" />`;
|
|
18089
18097
|
};
|
|
18090
18098
|
}
|
|
18091
18099
|
|
|
18092
18100
|
// src/liquid/filters/time_tag.ts
|
|
18093
|
-
function
|
|
18101
|
+
function bind52(_liquidSwell) {
|
|
18094
18102
|
const dateFilter = bind33(_liquidSwell);
|
|
18095
18103
|
return (dateValue, ...params) => {
|
|
18096
18104
|
const date = ensureDate(dateValue);
|
|
@@ -18101,7 +18109,7 @@ function bind51(_liquidSwell) {
|
|
|
18101
18109
|
}
|
|
18102
18110
|
|
|
18103
18111
|
// src/liquid/filters/translate.ts
|
|
18104
|
-
function
|
|
18112
|
+
function bind53(liquidSwell) {
|
|
18105
18113
|
return async function filterTranslate(key, params) {
|
|
18106
18114
|
const props = params && paramsToProps(params);
|
|
18107
18115
|
const str = await liquidSwell.renderTranslation(key, props);
|
|
@@ -18110,7 +18118,7 @@ function bind52(liquidSwell) {
|
|
|
18110
18118
|
}
|
|
18111
18119
|
|
|
18112
18120
|
// src/liquid/filters/where.ts
|
|
18113
|
-
function
|
|
18121
|
+
function bind54(_liquidSwell) {
|
|
18114
18122
|
return function* filterWhere(arr, property, expected) {
|
|
18115
18123
|
const results = [];
|
|
18116
18124
|
const list = yield resolveEnumerable(arr);
|
|
@@ -18164,7 +18172,7 @@ function getSizesFromParam(param) {
|
|
|
18164
18172
|
height: height ? Number(height) : void 0
|
|
18165
18173
|
};
|
|
18166
18174
|
}
|
|
18167
|
-
function
|
|
18175
|
+
function bind55(liquidSwell) {
|
|
18168
18176
|
return async function filterAssetImgUrl(assetPath, size = "small") {
|
|
18169
18177
|
const imageUrl = await liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
|
|
18170
18178
|
const sizes = getSizesFromParam(size);
|
|
@@ -18180,7 +18188,7 @@ function bind54(liquidSwell) {
|
|
|
18180
18188
|
}
|
|
18181
18189
|
|
|
18182
18190
|
// src/liquid/filters/shopify/hex_to_rgba.ts
|
|
18183
|
-
function
|
|
18191
|
+
function bind56(_liquidSwell) {
|
|
18184
18192
|
return (color, alpha) => {
|
|
18185
18193
|
return ThemeColor.get(color).rgba(alpha || 1);
|
|
18186
18194
|
};
|
|
@@ -18200,14 +18208,14 @@ var item_count_for_variant_default = {
|
|
|
18200
18208
|
};
|
|
18201
18209
|
|
|
18202
18210
|
// src/liquid/filters/shopify/payment_button.ts
|
|
18203
|
-
function
|
|
18211
|
+
function bind57(_liquidSwell) {
|
|
18204
18212
|
return (form) => {
|
|
18205
18213
|
return null;
|
|
18206
18214
|
};
|
|
18207
18215
|
}
|
|
18208
18216
|
|
|
18209
18217
|
// src/liquid/filters/shopify/payment_terms.ts
|
|
18210
|
-
function
|
|
18218
|
+
function bind58(_liquidSwell) {
|
|
18211
18219
|
return (form) => {
|
|
18212
18220
|
return null;
|
|
18213
18221
|
};
|
|
@@ -18309,7 +18317,7 @@ var svgs = {
|
|
|
18309
18317
|
var placeholder_svgs_default = svgs;
|
|
18310
18318
|
|
|
18311
18319
|
// src/liquid/filters/shopify/placeholder_svg_tag.ts
|
|
18312
|
-
function
|
|
18320
|
+
function bind59(_liquidSwell) {
|
|
18313
18321
|
return function filterPlaceholderSvgTag(name, className) {
|
|
18314
18322
|
const svg = placeholder_svgs_default[name];
|
|
18315
18323
|
if (typeof svg === "object" && svg !== null) {
|
|
@@ -18320,7 +18328,7 @@ function bind58(_liquidSwell) {
|
|
|
18320
18328
|
}
|
|
18321
18329
|
|
|
18322
18330
|
// src/liquid/filters/shopify/shopify_asset_url.ts
|
|
18323
|
-
function
|
|
18331
|
+
function bind60(_liquidSwell) {
|
|
18324
18332
|
return function filterShopifyAssetUrl(input) {
|
|
18325
18333
|
if (typeof input === "string") {
|
|
18326
18334
|
switch (input) {
|
|
@@ -18345,7 +18353,7 @@ function bind59(_liquidSwell) {
|
|
|
18345
18353
|
}
|
|
18346
18354
|
|
|
18347
18355
|
// src/liquid/filters/shopify/structured_data.ts
|
|
18348
|
-
function
|
|
18356
|
+
function bind61(_liquidSwell) {
|
|
18349
18357
|
return async function filterStructuredData(input) {
|
|
18350
18358
|
let value = input;
|
|
18351
18359
|
if (value instanceof StorefrontResource) {
|
|
@@ -18423,7 +18431,7 @@ function convertToSchemaOrgProductGroup(product) {
|
|
|
18423
18431
|
}
|
|
18424
18432
|
|
|
18425
18433
|
// src/liquid/filters/inline_editable.ts
|
|
18426
|
-
function
|
|
18434
|
+
function bind62(_liquidSwell) {
|
|
18427
18435
|
return (value, key) => {
|
|
18428
18436
|
if (typeof value === "object" && "value" in value) {
|
|
18429
18437
|
value = value.value;
|
|
@@ -18457,34 +18465,37 @@ var filters = {
|
|
|
18457
18465
|
font_modify: bind38,
|
|
18458
18466
|
font_url: bind39,
|
|
18459
18467
|
format_address: format_address_default,
|
|
18460
|
-
|
|
18468
|
+
handle: bind40,
|
|
18469
|
+
// alias
|
|
18470
|
+
handleize: bind40,
|
|
18471
|
+
image_tag: bind41,
|
|
18461
18472
|
image_url: image_url_default,
|
|
18462
|
-
inline_asset_content:
|
|
18463
|
-
json:
|
|
18464
|
-
json_pretty:
|
|
18465
|
-
locale_flag:
|
|
18466
|
-
money:
|
|
18467
|
-
money_with_currency:
|
|
18468
|
-
money_without_currency:
|
|
18469
|
-
money_without_trailing_zeros:
|
|
18470
|
-
script_tag:
|
|
18471
|
-
stylesheet_tag:
|
|
18472
|
-
time_tag:
|
|
18473
|
-
translate:
|
|
18474
|
-
t:
|
|
18473
|
+
inline_asset_content: bind42,
|
|
18474
|
+
json: bind43,
|
|
18475
|
+
json_pretty: bind44,
|
|
18476
|
+
locale_flag: bind45,
|
|
18477
|
+
money: bind46,
|
|
18478
|
+
money_with_currency: bind47,
|
|
18479
|
+
money_without_currency: bind48,
|
|
18480
|
+
money_without_trailing_zeros: bind49,
|
|
18481
|
+
script_tag: bind50,
|
|
18482
|
+
stylesheet_tag: bind51,
|
|
18483
|
+
time_tag: bind52,
|
|
18484
|
+
translate: bind53,
|
|
18485
|
+
t: bind53,
|
|
18475
18486
|
// alias
|
|
18476
|
-
where:
|
|
18487
|
+
where: bind54,
|
|
18477
18488
|
// Shopify compatibility only
|
|
18478
|
-
asset_img_url:
|
|
18479
|
-
hex_to_rgba:
|
|
18489
|
+
asset_img_url: bind55,
|
|
18490
|
+
hex_to_rgba: bind56,
|
|
18480
18491
|
item_count_for_variant: item_count_for_variant_default,
|
|
18481
|
-
payment_button:
|
|
18482
|
-
payment_terms:
|
|
18483
|
-
placeholder_svg_tag:
|
|
18484
|
-
shopify_asset_url:
|
|
18485
|
-
structured_data:
|
|
18492
|
+
payment_button: bind57,
|
|
18493
|
+
payment_terms: bind58,
|
|
18494
|
+
placeholder_svg_tag: bind59,
|
|
18495
|
+
shopify_asset_url: bind60,
|
|
18496
|
+
structured_data: bind61,
|
|
18486
18497
|
// Swell only
|
|
18487
|
-
inline_editable:
|
|
18498
|
+
inline_editable: bind62
|
|
18488
18499
|
};
|
|
18489
18500
|
function bindFilters(liquidSwell) {
|
|
18490
18501
|
for (const [tag, handler] of Object.entries(filters)) {
|
|
@@ -18498,8 +18509,8 @@ function bindFilters(liquidSwell) {
|
|
|
18498
18509
|
}
|
|
18499
18510
|
}
|
|
18500
18511
|
}
|
|
18501
|
-
function bindWithResolvedProps(liquidSwell,
|
|
18502
|
-
const handler =
|
|
18512
|
+
function bindWithResolvedProps(liquidSwell, bind63, resolve = []) {
|
|
18513
|
+
const handler = bind63(liquidSwell);
|
|
18503
18514
|
if (!Array.isArray(resolve)) {
|
|
18504
18515
|
return handler;
|
|
18505
18516
|
}
|
|
@@ -19591,7 +19602,7 @@ var SwellTheme3 = class {
|
|
|
19591
19602
|
return languageConfig;
|
|
19592
19603
|
}
|
|
19593
19604
|
const localeShortCode = locale.split("-")[0];
|
|
19594
|
-
return (0,
|
|
19605
|
+
return (0, import_lodash_es11.reduce)(
|
|
19595
19606
|
languageConfig,
|
|
19596
19607
|
(acc, value, key) => {
|
|
19597
19608
|
if (isObject2(value)) {
|
|
@@ -19615,15 +19626,15 @@ var SwellTheme3 = class {
|
|
|
19615
19626
|
const translationEnd = translationParts.pop();
|
|
19616
19627
|
const translationPath = translationParts.join(".");
|
|
19617
19628
|
const translationConfigGlobal = this.globals.language;
|
|
19618
|
-
acc[key] = (0,
|
|
19629
|
+
acc[key] = (0, import_lodash_es11.get)(
|
|
19619
19630
|
translationConfigGlobal,
|
|
19620
19631
|
`${translationPath}.$locale.${locale}.${translationEnd}`
|
|
19621
|
-
) || (0,
|
|
19632
|
+
) || (0, import_lodash_es11.get)(
|
|
19622
19633
|
translationConfigGlobal,
|
|
19623
19634
|
`${translationPath}.$locale.${localeShortCode}.${translationEnd}`
|
|
19624
|
-
) || (0,
|
|
19635
|
+
) || (0, import_lodash_es11.get)(translationConfigGlobal, translationKey) || value;
|
|
19625
19636
|
} else {
|
|
19626
|
-
acc[key] = (0,
|
|
19637
|
+
acc[key] = (0, import_lodash_es11.get)(languageConfig, `$locale.${locale}.${key}`) || (0, import_lodash_es11.get)(languageConfig, `$locale.${localeShortCode}.${key}`) || value;
|
|
19627
19638
|
}
|
|
19628
19639
|
}
|
|
19629
19640
|
return acc;
|
|
@@ -20411,8 +20422,8 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
20411
20422
|
const keyParts = key?.split(".") || [];
|
|
20412
20423
|
const keyName = keyParts.pop() || "";
|
|
20413
20424
|
const keyPath = keyParts.join(".");
|
|
20414
|
-
const langObject = (0,
|
|
20415
|
-
let localeValue = (0,
|
|
20425
|
+
const langObject = (0, import_lodash_es11.get)(langConfig, keyPath);
|
|
20426
|
+
let localeValue = (0, import_lodash_es11.get)(langObject?.[localeCode], keyName) || (0, import_lodash_es11.get)(langObject?.[localeCode.split("-")[0]], keyName) || langObject?.[keyName];
|
|
20416
20427
|
if (data?.count !== void 0 && localeValue?.one) {
|
|
20417
20428
|
localeValue = data.count === 1 ? localeValue.one : localeValue.other;
|
|
20418
20429
|
}
|
|
@@ -20491,7 +20502,7 @@ function fillDefaultThemeSettings(themeSettings, editorSchemaSettings) {
|
|
|
20491
20502
|
}
|
|
20492
20503
|
}
|
|
20493
20504
|
function resolveThemeSettings(theme, themeSettings, editorSchemaSettings) {
|
|
20494
|
-
const settings = (0,
|
|
20505
|
+
const settings = (0, import_lodash_es11.cloneDeep)(themeSettings);
|
|
20495
20506
|
if (settings.$locale) {
|
|
20496
20507
|
const { locale } = theme.swell.getStorefrontLocalization();
|
|
20497
20508
|
const localeConfig = settings.$locale[locale] || {};
|
|
@@ -20501,16 +20512,16 @@ function resolveThemeSettings(theme, themeSettings, editorSchemaSettings) {
|
|
|
20501
20512
|
}
|
|
20502
20513
|
}
|
|
20503
20514
|
}
|
|
20504
|
-
(0,
|
|
20515
|
+
(0, import_lodash_es11.each)(settings, (value, key) => {
|
|
20505
20516
|
const setting = (editorSchemaSettings && findEditorSetting(editorSchemaSettings, key)) ?? null;
|
|
20506
20517
|
if (isObject2(value) && !(value instanceof StorefrontResource)) {
|
|
20507
20518
|
switch (setting?.type) {
|
|
20508
20519
|
case "color_scheme_group": {
|
|
20509
|
-
(0,
|
|
20520
|
+
(0, import_lodash_es11.each)(value, (scheme, schemeId) => {
|
|
20510
20521
|
if (isObject2(scheme) && typeof scheme.settings === "object" && scheme.settings) {
|
|
20511
20522
|
const settings2 = scheme.settings;
|
|
20512
|
-
(0,
|
|
20513
|
-
const fieldDef = (0,
|
|
20523
|
+
(0, import_lodash_es11.each)(settings2, (colorValue, colorId) => {
|
|
20524
|
+
const fieldDef = (0, import_lodash_es11.find)(setting.fields, { id: colorId });
|
|
20514
20525
|
if (fieldDef?.type === "color" && colorValue) {
|
|
20515
20526
|
scheme.id = schemeId;
|
|
20516
20527
|
settings2[colorId] = new ThemeColor(colorValue);
|
|
@@ -20561,7 +20572,7 @@ function resolveThemeSettings(theme, themeSettings, editorSchemaSettings) {
|
|
|
20561
20572
|
}
|
|
20562
20573
|
function findThemeSettingsByType(type, themeSettings, editorSchemaSettings) {
|
|
20563
20574
|
const foundSettings = [];
|
|
20564
|
-
(0,
|
|
20575
|
+
(0, import_lodash_es11.each)(themeSettings, (value, key) => {
|
|
20565
20576
|
if (isObject2(value) && !(value instanceof ThemeFont) && !(value instanceof StorefrontResource)) {
|
|
20566
20577
|
foundSettings.push(
|
|
20567
20578
|
...findThemeSettingsByType(type, value, editorSchemaSettings)
|
|
@@ -20692,13 +20703,20 @@ async function resolveMenuItems(theme, menuItems, options) {
|
|
|
20692
20703
|
async function resolveMenuItemUrlAndResource(theme, item, options) {
|
|
20693
20704
|
if (!item) return { url: "#invalid-link-item" };
|
|
20694
20705
|
if (typeof item === "object" && item !== null) {
|
|
20695
|
-
|
|
20696
|
-
|
|
20697
|
-
|
|
20698
|
-
|
|
20699
|
-
|
|
20700
|
-
if (
|
|
20701
|
-
|
|
20706
|
+
const { url: itemUrl, resource } = await getMenuItemUrlAndResource(
|
|
20707
|
+
theme,
|
|
20708
|
+
item
|
|
20709
|
+
);
|
|
20710
|
+
let url = itemUrl;
|
|
20711
|
+
if (url.length > 1) {
|
|
20712
|
+
const endsWithSlash = url.endsWith("/");
|
|
20713
|
+
if (options?.trailingSlash) {
|
|
20714
|
+
if (!endsWithSlash) {
|
|
20715
|
+
url = url + "/";
|
|
20716
|
+
}
|
|
20717
|
+
} else if (endsWithSlash) {
|
|
20718
|
+
url = url.slice(0, -1);
|
|
20719
|
+
}
|
|
20702
20720
|
}
|
|
20703
20721
|
return { url, resource };
|
|
20704
20722
|
} else {
|
|
@@ -20723,7 +20741,7 @@ function isChildItemActive(items) {
|
|
|
20723
20741
|
}
|
|
20724
20742
|
function getMenuItemValueId(value) {
|
|
20725
20743
|
const fallback = typeof value === "string" ? value : "";
|
|
20726
|
-
const slug = (0,
|
|
20744
|
+
const slug = (0, import_lodash_es12.get)(value, "id", (0, import_lodash_es12.get)(value, "slug", fallback)) || "";
|
|
20727
20745
|
return slug;
|
|
20728
20746
|
}
|
|
20729
20747
|
async function getMenuItemUrlAndResource(theme, menuItem) {
|
|
@@ -20740,43 +20758,40 @@ async function getMenuItemUrlAndResource(theme, menuItem) {
|
|
|
20740
20758
|
return {
|
|
20741
20759
|
url: getMenuItemStorefrontUrl(theme, "index")
|
|
20742
20760
|
};
|
|
20743
|
-
case "category" /* Category */:
|
|
20761
|
+
case "category" /* Category */: {
|
|
20744
20762
|
if (!id) {
|
|
20745
20763
|
return {
|
|
20746
20764
|
url: getMenuItemStorefrontUrl(theme, "categories/index")
|
|
20747
20765
|
};
|
|
20748
20766
|
}
|
|
20749
|
-
return
|
|
20750
|
-
|
|
20751
|
-
|
|
20752
|
-
id
|
|
20753
|
-
);
|
|
20754
|
-
case "product" /* Product */:
|
|
20767
|
+
return deferMenuItemUrlAndResource(theme, "categories/category", id);
|
|
20768
|
+
}
|
|
20769
|
+
case "product" /* Product */: {
|
|
20755
20770
|
if (!id) {
|
|
20756
20771
|
return {
|
|
20757
20772
|
url: getMenuItemStorefrontUrl(theme, "products/index")
|
|
20758
20773
|
};
|
|
20759
20774
|
}
|
|
20760
|
-
return
|
|
20775
|
+
return deferMenuItemUrlAndResource(theme, "products/product", id);
|
|
20776
|
+
}
|
|
20777
|
+
case "product_list" /* ProductList */:
|
|
20778
|
+
return {
|
|
20779
|
+
url: getMenuItemStorefrontUrl(theme, "products/index")
|
|
20780
|
+
};
|
|
20761
20781
|
case "page" /* Page */:
|
|
20762
|
-
return
|
|
20782
|
+
return deferMenuItemUrlAndResource(theme, "pages/page", id);
|
|
20763
20783
|
case "blog" /* Blog */:
|
|
20764
|
-
return
|
|
20765
|
-
|
|
20766
|
-
|
|
20767
|
-
|
|
20768
|
-
|
|
20769
|
-
|
|
20770
|
-
|
|
20771
|
-
|
|
20772
|
-
blog.category_id
|
|
20773
|
-
);
|
|
20774
|
-
return blogCategory.slug;
|
|
20775
|
-
}
|
|
20776
|
-
);
|
|
20784
|
+
return deferMenuItemUrlAndResource(theme, "blogs/blog", id, (blog) => {
|
|
20785
|
+
const blogCategory = new SwellStorefrontRecord(
|
|
20786
|
+
theme.swell,
|
|
20787
|
+
"content/blog-categories",
|
|
20788
|
+
blog.category_id
|
|
20789
|
+
);
|
|
20790
|
+
return blogCategory.slug;
|
|
20791
|
+
});
|
|
20777
20792
|
case "blog_category" /* BlogCategory */:
|
|
20778
|
-
return
|
|
20779
|
-
case "content_list" /* ContentList */:
|
|
20793
|
+
return deferMenuItemUrlAndResource(theme, "blogs/category", id);
|
|
20794
|
+
case "content_list" /* ContentList */: {
|
|
20780
20795
|
if (model) {
|
|
20781
20796
|
const slug = model?.replace("content/", "");
|
|
20782
20797
|
return {
|
|
@@ -20785,10 +20800,11 @@ async function getMenuItemUrlAndResource(theme, menuItem) {
|
|
|
20785
20800
|
};
|
|
20786
20801
|
}
|
|
20787
20802
|
break;
|
|
20788
|
-
|
|
20803
|
+
}
|
|
20804
|
+
case "content" /* Content */: {
|
|
20789
20805
|
if (model) {
|
|
20790
20806
|
const collectionSlug = model?.replace("content/", "");
|
|
20791
|
-
return
|
|
20807
|
+
return deferMenuItemUrlAndResource(
|
|
20792
20808
|
theme,
|
|
20793
20809
|
"content/content",
|
|
20794
20810
|
id,
|
|
@@ -20796,6 +20812,7 @@ async function getMenuItemUrlAndResource(theme, menuItem) {
|
|
|
20796
20812
|
);
|
|
20797
20813
|
}
|
|
20798
20814
|
break;
|
|
20815
|
+
}
|
|
20799
20816
|
case "search" /* Search */:
|
|
20800
20817
|
return {
|
|
20801
20818
|
url: getMenuItemStorefrontUrl(theme, "search")
|