@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.js
CHANGED
|
@@ -7079,6 +7079,62 @@
|
|
|
7079
7079
|
}
|
|
7080
7080
|
};
|
|
7081
7081
|
|
|
7082
|
+
// src/resources/account.ts
|
|
7083
|
+
var SwellAccount = class extends SwellStorefrontSingleton {
|
|
7084
|
+
constructor(swell, getter) {
|
|
7085
|
+
super(swell, "account", getter);
|
|
7086
|
+
return this._getProxy();
|
|
7087
|
+
}
|
|
7088
|
+
};
|
|
7089
|
+
|
|
7090
|
+
// src/resources/blog_category.ts
|
|
7091
|
+
var SwellBlogCategory = class extends SwellStorefrontRecord {
|
|
7092
|
+
constructor(swell, id, query = {}, getter) {
|
|
7093
|
+
super(swell, "content/blog-categories", id, query, getter);
|
|
7094
|
+
return this._getProxy();
|
|
7095
|
+
}
|
|
7096
|
+
};
|
|
7097
|
+
|
|
7098
|
+
// src/resources/blog.ts
|
|
7099
|
+
var SwellBlog = class extends SwellStorefrontRecord {
|
|
7100
|
+
constructor(swell, id, query = {}, getter) {
|
|
7101
|
+
super(swell, "content/blogs", id, query, getter);
|
|
7102
|
+
return this._getProxy();
|
|
7103
|
+
}
|
|
7104
|
+
};
|
|
7105
|
+
|
|
7106
|
+
// src/resources/cart.ts
|
|
7107
|
+
var SwellCart = class extends SwellStorefrontSingleton {
|
|
7108
|
+
constructor(swell, getter) {
|
|
7109
|
+
super(swell, "cart", getter);
|
|
7110
|
+
return this._getProxy();
|
|
7111
|
+
}
|
|
7112
|
+
};
|
|
7113
|
+
|
|
7114
|
+
// src/resources/category.ts
|
|
7115
|
+
var SwellCategory = class extends SwellStorefrontRecord {
|
|
7116
|
+
constructor(swell, id, query = {}, getter) {
|
|
7117
|
+
super(swell, "categories", id, query, getter);
|
|
7118
|
+
return this._getProxy();
|
|
7119
|
+
}
|
|
7120
|
+
};
|
|
7121
|
+
|
|
7122
|
+
// src/resources/order.ts
|
|
7123
|
+
var SwellOrder = class extends SwellStorefrontRecord {
|
|
7124
|
+
constructor(swell, id, query = {}, getter) {
|
|
7125
|
+
super(swell, "orders", id, query, getter);
|
|
7126
|
+
return this._getProxy();
|
|
7127
|
+
}
|
|
7128
|
+
};
|
|
7129
|
+
|
|
7130
|
+
// src/resources/page.ts
|
|
7131
|
+
var SwellPage = class extends SwellStorefrontRecord {
|
|
7132
|
+
constructor(swell, id, query = {}, getter) {
|
|
7133
|
+
super(swell, "content/pages", id, query, getter);
|
|
7134
|
+
return this._getProxy();
|
|
7135
|
+
}
|
|
7136
|
+
};
|
|
7137
|
+
|
|
7082
7138
|
// src/resources/product_helpers.ts
|
|
7083
7139
|
function getAvailableVariants(product) {
|
|
7084
7140
|
return (product.variants?.results?.slice()?.reverse() || []).filter(
|
|
@@ -16025,7 +16081,11 @@ ${formattedMessage}`;
|
|
|
16025
16081
|
({ from }) => from === key || from.startsWith(keyObject)
|
|
16026
16082
|
);
|
|
16027
16083
|
if (resourceMap && value instanceof StorefrontResource) {
|
|
16028
|
-
pageData[resourceMap.to] =
|
|
16084
|
+
pageData[resourceMap.to] = Object.assign(
|
|
16085
|
+
{},
|
|
16086
|
+
value.toObject(),
|
|
16087
|
+
resourceMap.object(this, value)
|
|
16088
|
+
);
|
|
16029
16089
|
}
|
|
16030
16090
|
}
|
|
16031
16091
|
}
|
|
@@ -19047,6 +19107,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
19047
19107
|
current: Number(this.swell.queryParams.page) || 1,
|
|
19048
19108
|
url: this.swell.url.pathname,
|
|
19049
19109
|
custom: !swellPage,
|
|
19110
|
+
title: swellPage?.label,
|
|
19050
19111
|
slug: void 0,
|
|
19051
19112
|
description: void 0,
|
|
19052
19113
|
$locale: void 0
|
|
@@ -19066,9 +19127,17 @@ ${injects.join("\n")}<\/script>`;
|
|
|
19066
19127
|
console.warn(err);
|
|
19067
19128
|
}
|
|
19068
19129
|
if (pageSchema?.page) {
|
|
19069
|
-
const {
|
|
19130
|
+
const {
|
|
19131
|
+
title,
|
|
19132
|
+
label,
|
|
19133
|
+
// 'label' is deprecated, kept for compatibility
|
|
19134
|
+
description,
|
|
19135
|
+
slug,
|
|
19136
|
+
$locale
|
|
19137
|
+
} = pageSchema.page;
|
|
19138
|
+
page.label = page.label || title || label || "";
|
|
19139
|
+
page.title = title || page.label;
|
|
19070
19140
|
page.slug = slug;
|
|
19071
|
-
page.label = label || page.label;
|
|
19072
19141
|
page.description = description;
|
|
19073
19142
|
page.$locale = $locale;
|
|
19074
19143
|
}
|
|
@@ -19785,9 +19854,9 @@ ${content.slice(pos)}`;
|
|
|
19785
19854
|
this.setGlobals(pageData);
|
|
19786
19855
|
}
|
|
19787
19856
|
let pageConfig;
|
|
19788
|
-
if (this.
|
|
19857
|
+
if (this.pageId) {
|
|
19789
19858
|
pageConfig = await this.renderPageTemplate(
|
|
19790
|
-
this.
|
|
19859
|
+
this.pageId,
|
|
19791
19860
|
pageData,
|
|
19792
19861
|
altTemplateId
|
|
19793
19862
|
);
|