@swell/apps-sdk 1.0.132 → 1.0.134
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 +88 -5
- package/dist/index.cjs.map +3 -3
- package/dist/index.js +74 -5
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +81 -5
- package/dist/index.mjs.map +3 -3
- package/dist/src/api.d.ts +1 -1
- package/dist/src/resources/index.d.ts +9 -0
- package/dist/src/resources/swell_types.d.ts +28 -0
- package/dist/types/swell.d.ts +4 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -65,8 +65,15 @@ __export(index_exports, {
|
|
|
65
65
|
ShopifyVariant: () => ShopifyVariant,
|
|
66
66
|
StorefrontResource: () => StorefrontResource,
|
|
67
67
|
Swell: () => Swell,
|
|
68
|
+
SwellAccount: () => SwellAccount,
|
|
68
69
|
SwellBackendAPI: () => SwellBackendAPI,
|
|
70
|
+
SwellBlog: () => SwellBlog,
|
|
71
|
+
SwellBlogCategory: () => SwellBlogCategory,
|
|
72
|
+
SwellCart: () => SwellCart,
|
|
73
|
+
SwellCategory: () => SwellCategory,
|
|
69
74
|
SwellError: () => SwellError,
|
|
75
|
+
SwellOrder: () => SwellOrder,
|
|
76
|
+
SwellPage: () => SwellPage,
|
|
70
77
|
SwellProduct: () => SwellProduct,
|
|
71
78
|
SwellStorefrontCollection: () => SwellStorefrontCollection,
|
|
72
79
|
SwellStorefrontPagination: () => SwellStorefrontPagination,
|
|
@@ -7178,6 +7185,62 @@ var ThemeCache = class extends Cache {
|
|
|
7178
7185
|
}
|
|
7179
7186
|
};
|
|
7180
7187
|
|
|
7188
|
+
// src/resources/account.ts
|
|
7189
|
+
var SwellAccount = class extends SwellStorefrontSingleton {
|
|
7190
|
+
constructor(swell, getter) {
|
|
7191
|
+
super(swell, "account", getter);
|
|
7192
|
+
return this._getProxy();
|
|
7193
|
+
}
|
|
7194
|
+
};
|
|
7195
|
+
|
|
7196
|
+
// src/resources/blog_category.ts
|
|
7197
|
+
var SwellBlogCategory = class extends SwellStorefrontRecord {
|
|
7198
|
+
constructor(swell, id, query = {}, getter) {
|
|
7199
|
+
super(swell, "content/blog-categories", id, query, getter);
|
|
7200
|
+
return this._getProxy();
|
|
7201
|
+
}
|
|
7202
|
+
};
|
|
7203
|
+
|
|
7204
|
+
// src/resources/blog.ts
|
|
7205
|
+
var SwellBlog = class extends SwellStorefrontRecord {
|
|
7206
|
+
constructor(swell, id, query = {}, getter) {
|
|
7207
|
+
super(swell, "content/blogs", id, query, getter);
|
|
7208
|
+
return this._getProxy();
|
|
7209
|
+
}
|
|
7210
|
+
};
|
|
7211
|
+
|
|
7212
|
+
// src/resources/cart.ts
|
|
7213
|
+
var SwellCart = class extends SwellStorefrontSingleton {
|
|
7214
|
+
constructor(swell, getter) {
|
|
7215
|
+
super(swell, "cart", getter);
|
|
7216
|
+
return this._getProxy();
|
|
7217
|
+
}
|
|
7218
|
+
};
|
|
7219
|
+
|
|
7220
|
+
// src/resources/category.ts
|
|
7221
|
+
var SwellCategory = class extends SwellStorefrontRecord {
|
|
7222
|
+
constructor(swell, id, query = {}, getter) {
|
|
7223
|
+
super(swell, "categories", id, query, getter);
|
|
7224
|
+
return this._getProxy();
|
|
7225
|
+
}
|
|
7226
|
+
};
|
|
7227
|
+
|
|
7228
|
+
// src/resources/order.ts
|
|
7229
|
+
var SwellOrder = class extends SwellStorefrontRecord {
|
|
7230
|
+
constructor(swell, id, query = {}, getter) {
|
|
7231
|
+
super(swell, "orders", id, query, getter);
|
|
7232
|
+
return this._getProxy();
|
|
7233
|
+
}
|
|
7234
|
+
};
|
|
7235
|
+
|
|
7236
|
+
// src/resources/page.ts
|
|
7237
|
+
var SwellPage = class extends SwellStorefrontRecord {
|
|
7238
|
+
constructor(swell, id, query = {}, getter) {
|
|
7239
|
+
super(swell, "content/pages", id, query, getter);
|
|
7240
|
+
return this._getProxy();
|
|
7241
|
+
}
|
|
7242
|
+
};
|
|
7243
|
+
|
|
7181
7244
|
// src/resources/product_helpers.ts
|
|
7182
7245
|
function getAvailableVariants(product) {
|
|
7183
7246
|
return (product.variants?.results?.slice()?.reverse() || []).filter(
|
|
@@ -16124,7 +16187,11 @@ var ShopifyCompatibility3 = class {
|
|
|
16124
16187
|
({ from }) => from === key || from.startsWith(keyObject)
|
|
16125
16188
|
);
|
|
16126
16189
|
if (resourceMap && value instanceof StorefrontResource) {
|
|
16127
|
-
pageData[resourceMap.to] =
|
|
16190
|
+
pageData[resourceMap.to] = Object.assign(
|
|
16191
|
+
{},
|
|
16192
|
+
value.toObject(),
|
|
16193
|
+
resourceMap.object(this, value)
|
|
16194
|
+
);
|
|
16128
16195
|
}
|
|
16129
16196
|
}
|
|
16130
16197
|
}
|
|
@@ -19146,6 +19213,7 @@ var SwellTheme3 = class {
|
|
|
19146
19213
|
current: Number(this.swell.queryParams.page) || 1,
|
|
19147
19214
|
url: this.swell.url.pathname,
|
|
19148
19215
|
custom: !swellPage,
|
|
19216
|
+
title: swellPage?.label,
|
|
19149
19217
|
slug: void 0,
|
|
19150
19218
|
description: void 0,
|
|
19151
19219
|
$locale: void 0
|
|
@@ -19165,9 +19233,17 @@ var SwellTheme3 = class {
|
|
|
19165
19233
|
console.warn(err);
|
|
19166
19234
|
}
|
|
19167
19235
|
if (pageSchema?.page) {
|
|
19168
|
-
const {
|
|
19236
|
+
const {
|
|
19237
|
+
title,
|
|
19238
|
+
label,
|
|
19239
|
+
// 'label' is deprecated, kept for compatibility
|
|
19240
|
+
description,
|
|
19241
|
+
slug,
|
|
19242
|
+
$locale
|
|
19243
|
+
} = pageSchema.page;
|
|
19244
|
+
page.label = page.label || title || label || "";
|
|
19245
|
+
page.title = title || page.label;
|
|
19169
19246
|
page.slug = slug;
|
|
19170
|
-
page.label = label || page.label;
|
|
19171
19247
|
page.description = description;
|
|
19172
19248
|
page.$locale = $locale;
|
|
19173
19249
|
}
|
|
@@ -19884,9 +19960,9 @@ ${content.slice(pos)}`;
|
|
|
19884
19960
|
this.setGlobals(pageData);
|
|
19885
19961
|
}
|
|
19886
19962
|
let pageConfig;
|
|
19887
|
-
if (this.
|
|
19963
|
+
if (this.pageId) {
|
|
19888
19964
|
pageConfig = await this.renderPageTemplate(
|
|
19889
|
-
this.
|
|
19965
|
+
this.pageId,
|
|
19890
19966
|
pageData,
|
|
19891
19967
|
altTemplateId
|
|
19892
19968
|
);
|
|
@@ -20893,8 +20969,15 @@ function getResourceQuery(slug, query) {
|
|
|
20893
20969
|
ShopifyVariant,
|
|
20894
20970
|
StorefrontResource,
|
|
20895
20971
|
Swell,
|
|
20972
|
+
SwellAccount,
|
|
20896
20973
|
SwellBackendAPI,
|
|
20974
|
+
SwellBlog,
|
|
20975
|
+
SwellBlogCategory,
|
|
20976
|
+
SwellCart,
|
|
20977
|
+
SwellCategory,
|
|
20897
20978
|
SwellError,
|
|
20979
|
+
SwellOrder,
|
|
20980
|
+
SwellPage,
|
|
20898
20981
|
SwellProduct,
|
|
20899
20982
|
SwellStorefrontCollection,
|
|
20900
20983
|
SwellStorefrontPagination,
|