@moonbase.sh/storefront 0.4.27 → 0.4.31
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/moonbase.js +21 -12
- package/dist/moonbase.umd.cjs +3 -3
- package/package.json +2 -2
package/dist/moonbase.js
CHANGED
|
@@ -3327,7 +3327,8 @@ var Nn = /* @__PURE__ */ ((e) => (e.Universal = "Universal", e.Windows = "Window
|
|
|
3327
3327
|
discount: Ta
|
|
3328
3328
|
}), I0 = y.object({
|
|
3329
3329
|
suggestedCurrency: y.string(),
|
|
3330
|
-
|
|
3330
|
+
// Enabled currencies need to be optional since we may still have old, cached representations in browsers
|
|
3331
|
+
enabledCurrencies: y.string().array().optional(),
|
|
3331
3332
|
products: Qo.array(),
|
|
3332
3333
|
bundles: Pa.array(),
|
|
3333
3334
|
// Offers need to be optional since we may still have old, cached representations in browsers
|
|
@@ -4141,9 +4142,15 @@ var vu = class {
|
|
|
4141
4142
|
switch (e.condition.type) {
|
|
4142
4143
|
case "CartContainsItems":
|
|
4143
4144
|
const n = t.items.filter(
|
|
4144
|
-
(
|
|
4145
|
-
)
|
|
4146
|
-
|
|
4145
|
+
(o) => o.type === "Product" && e.condition.relevantItemVariations[`Product/${o.productId}`] && e.condition.relevantItemVariations[`Product/${o.productId}`].includes(o.variationId) || o.type === "Bundle" && e.condition.relevantItemVariations[`Bundle/${o.bundleId}`] && e.condition.relevantItemVariations[`Bundle/${o.bundleId}`].includes(o.variationId)
|
|
4146
|
+
), r = t.items.flatMap((o) => {
|
|
4147
|
+
var s;
|
|
4148
|
+
return o.type === "Bundle" && e.target.type === "Bundle" && e.target.id === o.bundleId && e.id === o.offerId ? (s = o.replaced) != null ? s : [] : [];
|
|
4149
|
+
}).filter((o) => {
|
|
4150
|
+
const [s, i] = o.split("/");
|
|
4151
|
+
return e.condition.relevantItemVariations[`Product/${s}`] && e.condition.relevantItemVariations[`Product/${s}`].includes(i);
|
|
4152
|
+
});
|
|
4153
|
+
return n.length + r.length >= e.condition.minimumItems;
|
|
4147
4154
|
}
|
|
4148
4155
|
return console.warn("Unsupported offer condition found:", e.condition), !1;
|
|
4149
4156
|
}
|
|
@@ -9965,8 +9972,9 @@ var yi = class it {
|
|
|
9965
9972
|
return this.currentUser.value;
|
|
9966
9973
|
}
|
|
9967
9974
|
async updateStorefront() {
|
|
9968
|
-
|
|
9969
|
-
|
|
9975
|
+
var t;
|
|
9976
|
+
const n = await this.client.storefront.get(this.hasUtm ? this.utm.value : void 0);
|
|
9977
|
+
return n && (typeof window < "u" && localStorage.setItem(it.storefrontKey, JSON.stringify(n)), this.storefront.value = n, this.loadedStorefront.value = !0, (!this.currentOrder.value.currency || !((t = n.enabledCurrencies) != null && t.includes(this.currentOrder.value.currency))) && (this.currentOrder.value.currency = n.suggestedCurrency), this.currentOrder.value.items = this.enrichLineItems(this.currentOrder.value.items)), n;
|
|
9970
9978
|
}
|
|
9971
9979
|
async pushOrderContent() {
|
|
9972
9980
|
typeof window < "u" && localStorage.setItem(it.sessionKey, JSON.stringify(this.currentOrder.value)), this.refreshOrderAbortController.abort(), this.refreshOrderAbortController = new AbortController(), this.debouncedPushOrderContent(this.currentOrder.value);
|
|
@@ -9994,11 +10002,12 @@ var yi = class it {
|
|
|
9994
10002
|
}
|
|
9995
10003
|
}
|
|
9996
10004
|
async refreshOrder() {
|
|
10005
|
+
var t;
|
|
9997
10006
|
try {
|
|
9998
|
-
const
|
|
9999
|
-
|
|
10000
|
-
} catch (
|
|
10001
|
-
|
|
10007
|
+
const n = await this.client.orders.get(this.currentOrder.value.id, { abort: this.refreshOrderAbortController.signal });
|
|
10008
|
+
n && (n.status !== Oo.Open ? this.resetOrder() : (n.items = this.enrichLineItems(n.items), typeof window < "u" && localStorage.setItem(it.sessionKey, JSON.stringify(n)), this.storefront.value && !((t = this.storefront.value.enabledCurrencies) != null && t.includes(n.currency)) && (n.currency = this.storefront.value.suggestedCurrency), this.currentOrder.value = n));
|
|
10009
|
+
} catch (n) {
|
|
10010
|
+
n instanceof nf && this.resetOrder();
|
|
10002
10011
|
}
|
|
10003
10012
|
}
|
|
10004
10013
|
resetOrder() {
|
|
@@ -10182,7 +10191,7 @@ function er(e) {
|
|
|
10182
10191
|
const R = t.storefront.value.bundles.find((T) => T.id === l.bundleId), g = ((R == null ? void 0 : R.variations) || []).find((T) => T.id === l.variationId);
|
|
10183
10192
|
H = (O = (_ = g == null ? void 0 : g.price[s]) != null ? _ : (m = R == null ? void 0 : R.defaultVariation) == null ? void 0 : m.price[s]) != null ? O : 0;
|
|
10184
10193
|
}
|
|
10185
|
-
const z = (V = t.storefront.value.offers) == null ? void 0 : V.find((R) => R.id === l.offerId);
|
|
10194
|
+
const z = l.offerId ? (V = t.storefront.value.offers) == null ? void 0 : V.find((R) => R.id === l.offerId) : null;
|
|
10186
10195
|
if (z && Po.eligible(z, t.currentOrder.value)) {
|
|
10187
10196
|
const R = vu.apply(z.discount, { [s]: H });
|
|
10188
10197
|
H -= R[s];
|
|
@@ -17309,7 +17318,7 @@ function hE(e, t) {
|
|
|
17309
17318
|
const Me = /* @__PURE__ */ ar(dE, [["render", hE]]), pE = { class: "moonbase:about" }, mE = /* @__PURE__ */ pe({
|
|
17310
17319
|
__name: "About",
|
|
17311
17320
|
setup(e) {
|
|
17312
|
-
const t = $e(), n = "0.4.
|
|
17321
|
+
const t = $e(), n = "0.4.31";
|
|
17313
17322
|
return (r, o) => (b(), S("div", pE, [
|
|
17314
17323
|
o[2] || (o[2] = Fh('<svg viewBox="0 0 512 512" height="56px" width="56px"><g><path fill="currentColor" d="m493.17795,174.6135c6.257,75.3 -30.577,150.948 -100.579,190.758c-66.292,37.697 -145.001,33.405 -205.402,-4.415c0.409,-1.248 0.638,-2.577 0.638,-3.96c0,-7.026 -5.717,-12.743 -12.743,-12.743c-2.876,0 -5.524,0.969 -7.659,2.582c-18.813,-15.259 -35.159,-34.207 -47.856,-56.534c-54.663,-96.122 -21.054,-218.358 75.069,-273.021a201.218,201.218 0 0 1 33.302,-15.124c-32.428,3.667 -64.663,13.809 -94.827,30.962c-104.526,59.443 -149.511,183.241 -113.473,293.249c-3.376,3.057 -5.513,7.459 -5.513,12.362c0,9.207 7.491,16.698 16.698,16.698c0.136,0 0.267,-0.017 0.401,-0.02a252.205,252.205 0 0 0 8.683,16.691c67.869,119.344 219.635,161.073 338.98,93.204a250.416,250.416 0 0 0 32.893,-22.333c1.045,0.331 2.157,0.513 3.311,0.513c6.047,0 10.968,-4.921 10.968,-10.968c0,-0.605 -0.063,-1.196 -0.157,-1.775c69.545,-64.988 96.008,-165.054 67.266,-256.126m-446.526,25.112a5.071,5.071 0 0 1 -5.066,-5.066a5.072,5.072 0 0 1 5.066,-5.067a5.073,5.073 0 0 1 5.066,5.067a5.072,5.072 0 0 1 -5.066,5.066m-15.819,153.944c-8.238,0 -14.94,-6.702 -14.94,-14.94c0,-8.239 6.702,-14.941 14.94,-14.941c8.239,0 14.941,6.702 14.941,14.941c-0.001,8.238 -6.703,14.94 -14.941,14.94m144.258,-7.659c6.057,0 10.985,4.928 10.985,10.986c0,6.058 -4.928,10.985 -10.985,10.985c-6.058,0 -10.986,-4.928 -10.986,-10.985c0.001,-6.059 4.928,-10.986 10.986,-10.986m70.829,133.004c-5.079,0 -9.21,-4.132 -9.21,-9.21c0,-5.079 4.131,-9.21 9.21,-9.21c5.078,0 9.209,4.131 9.209,9.21c0,5.078 -4.13,9.21 -9.209,9.21m169.18,-37.289c-5.078,0 -9.209,-4.132 -9.209,-9.21s4.131,-9.209 9.209,-9.209s9.21,4.131 9.21,9.209s-4.132,9.21 -9.21,9.21"></path><path fill="currentColor" d="m144.78195,275.9675c46.746,82.201 151.278,110.943 233.48,64.197c59.864,-34.044 91.363,-98.736 86.013,-163.13a170.094,170.094 0 0 0 -5.515,-31.052c-23.045,0.567 -63.864,10.137 -104.194,61.671c-52.045,66.5 -186.285,49.153 -228.855,17.372c3.503,17.443 9.796,34.632 19.071,50.942m233.513,-65.677a8.663,8.663 0 1 1 -8.663,8.663a8.662,8.662 0 0 1 8.663,-8.663m-37.006,62.618c7.02,0 12.712,5.691 12.712,12.712s-5.692,12.712 -12.712,12.712c-7.021,0 -12.712,-5.691 -12.712,-12.712s5.691,-12.712 12.712,-12.712m-102.544,12.712a6.78,6.78 0 1 1 0,13.56a6.78,6.78 0 0 1 0,-13.56"></path><ellipse fill="currentColor" ry="7.3075" rx="7.3075" cy="152.05851" cx="251.33138"></ellipse><ellipse fill="currentColor" ry="5.35076" rx="5.35076" cy="210.31151" cx="204.89499"></ellipse><ellipse fill="currentColor" ry="12.09273" rx="12.09273" cy="200.15625" cx="302.28597"></ellipse></g></svg>', 1)),
|
|
17315
17324
|
E(v(kp), { as: "h3" }, {
|