vlite3 1.4.4 → 1.4.5
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/components/AppShell/AppShellLayoutStorefront.vue.js +2 -2
- package/components/Cart/Cart.vue.js +242 -0
- package/components/Cart/Cart.vue2.js +4 -0
- package/components/Cart/CartCouponInput.vue.js +176 -0
- package/components/Cart/CartCouponInput.vue2.js +4 -0
- package/components/Cart/CartEmptyState.vue.js +48 -0
- package/components/Cart/CartEmptyState.vue2.js +4 -0
- package/components/Cart/CartLineItem.vue.js +341 -0
- package/components/Cart/CartLineItem.vue2.js +4 -0
- package/components/Cart/CartSummary.vue.js +157 -0
- package/components/Cart/CartSummary.vue2.js +4 -0
- package/components/Cart/CartVariant1.vue.js +156 -0
- package/components/Cart/CartVariant1.vue2.js +4 -0
- package/components/Cart/CartVariant2.vue.js +154 -0
- package/components/Cart/CartVariant2.vue2.js +4 -0
- package/components/Cart/CartVariant3.vue.js +192 -0
- package/components/Cart/CartVariant3.vue2.js +4 -0
- package/components/Cart/CartVariant4.vue.js +145 -0
- package/components/Cart/CartVariant4.vue2.js +4 -0
- package/components/Cart/composables/useCart.d.ts +46 -0
- package/components/Cart/composables/useCart.js +110 -0
- package/components/Cart/composables/useCartCalculation.js +145 -0
- package/components/Cart/index.d.ts +2 -0
- package/components/CategoryManager/CategoryManager.vue.js +3 -3
- package/components/CategoryManager/CategoryManager.vue2.js +224 -248
- package/components/CategoryManager/utils.d.ts +3 -0
- package/components/CategoryManager/utils.js +31 -0
- package/components/CategoryMenu/CategoryMenu.vue.d.ts +2 -0
- package/components/CategoryMenu/CategoryMenu.vue.js +46 -40
- package/components/CategoryMenu/CategoryMenuVariant1.vue.d.ts +5 -1
- package/components/CategoryMenu/CategoryMenuVariant1.vue.js +5 -144
- package/components/CategoryMenu/CategoryMenuVariant1.vue2.js +220 -2
- package/components/CategoryMenu/CategoryMenuVariant2.vue.d.ts +5 -1
- package/components/CategoryMenu/CategoryMenuVariant2.vue.js +5 -160
- package/components/CategoryMenu/CategoryMenuVariant2.vue2.js +235 -2
- package/components/CategoryMenu/types.d.ts +5 -2
- package/components/Dropdown/Dropdown.vue.d.ts +1 -0
- package/components/Dropdown/Dropdown.vue.js +31 -29
- package/components/FilePicker/FilePicker.vue.js +278 -202
- package/components/Form/CustomFields.vue.d.ts +4 -0
- package/components/Form/CustomFields.vue.js +2 -2
- package/components/Form/CustomFields.vue2.js +349 -145
- package/components/Form/FormField.vue.js +1 -1
- package/components/Form/types.d.ts +3 -0
- package/components/Modal.vue.d.ts +2 -0
- package/components/Modal.vue.js +1 -1
- package/components/Modal.vue2.js +30 -28
- package/components/Screen/ScreenFilter.vue.js +3 -2
- package/components/SidePanel.vue.d.ts +2 -0
- package/components/SidePanel.vue.js +1 -1
- package/components/SidePanel.vue2.js +25 -23
- package/components/SidebarMenu/SidebarMenu.vue.js +145 -128
- package/components/index.d.ts +1 -0
- package/core/config.d.ts +6 -6
- package/index.d.ts +1 -0
- package/index.js +327 -306
- package/package.json +1 -1
- package/style.css +1 -1
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
const n = (o, e = 0) => {
|
|
2
|
+
const r = Number(o);
|
|
3
|
+
return Number.isFinite(r) ? r : e;
|
|
4
|
+
}, u = (o, e = 2) => {
|
|
5
|
+
const r = Math.pow(10, e);
|
|
6
|
+
return Math.round((o + Number.EPSILON) * r) / r;
|
|
7
|
+
};
|
|
8
|
+
function h(o, e = !1) {
|
|
9
|
+
return o.reduce((r, t) => {
|
|
10
|
+
const a = n(t.price), i = Math.max(0, Math.floor(n(t.quantity))), c = a * i;
|
|
11
|
+
return e && t.taxable === !1 ? r : r + c;
|
|
12
|
+
}, 0);
|
|
13
|
+
}
|
|
14
|
+
function M(o) {
|
|
15
|
+
return o.reduce((e, r) => {
|
|
16
|
+
const t = n(r.originalPrice), a = n(r.price), i = Math.max(0, Math.floor(n(r.quantity)));
|
|
17
|
+
return t > a ? e + (t - a) * i : e;
|
|
18
|
+
}, 0);
|
|
19
|
+
}
|
|
20
|
+
function S(o) {
|
|
21
|
+
return o.reduce((e, r) => e + Math.max(0, Math.floor(n(r.quantity))), 0);
|
|
22
|
+
}
|
|
23
|
+
function y(o, e, r) {
|
|
24
|
+
if (!o) return 0;
|
|
25
|
+
const t = o.definition;
|
|
26
|
+
if (!t)
|
|
27
|
+
return Math.max(0, n(o.discountAmount));
|
|
28
|
+
if (t.currency && r && t.currency !== r) return 0;
|
|
29
|
+
if (t.expiresAt) {
|
|
30
|
+
const i = t.expiresAt instanceof Date ? t.expiresAt : new Date(t.expiresAt);
|
|
31
|
+
if (!Number.isNaN(i.getTime()) && i.getTime() < Date.now()) return 0;
|
|
32
|
+
}
|
|
33
|
+
if (t.minSubtotal !== void 0 && e < n(t.minSubtotal)) return 0;
|
|
34
|
+
let a = 0;
|
|
35
|
+
if (t.type === "percentage")
|
|
36
|
+
a = e * n(t.value) / 100;
|
|
37
|
+
else if (t.type === "fixed")
|
|
38
|
+
a = n(t.value);
|
|
39
|
+
else
|
|
40
|
+
return 0;
|
|
41
|
+
return t.maxDiscount !== void 0 && a > n(t.maxDiscount) && (a = n(t.maxDiscount)), a > e && (a = e), Math.max(0, a);
|
|
42
|
+
}
|
|
43
|
+
function k(o, e, r = 2) {
|
|
44
|
+
if (!e || e.mode === "exempt")
|
|
45
|
+
return { total: 0, breakdown: [] };
|
|
46
|
+
if (e.mode === "flat") {
|
|
47
|
+
const t = Math.max(0, n(e.amount));
|
|
48
|
+
return {
|
|
49
|
+
total: u(t, r),
|
|
50
|
+
breakdown: [{ label: e.label || "Tax", amount: u(t, r) }]
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
if (e.mode === "rate" || e.mode === "inclusive") {
|
|
54
|
+
const t = n(e.rate);
|
|
55
|
+
if (t <= 0) return { total: 0, breakdown: [] };
|
|
56
|
+
const a = u(o * t / 100, r), i = e.label || (e.mode === "inclusive" ? `VAT (${t}%)` : `Tax (${t}%)`);
|
|
57
|
+
return { total: a, breakdown: [{ label: i, amount: a, rate: t }] };
|
|
58
|
+
}
|
|
59
|
+
return { total: 0, breakdown: [] };
|
|
60
|
+
}
|
|
61
|
+
function g(o, e, r) {
|
|
62
|
+
if (!e || e.mode === "free" || e.mode === "pickup")
|
|
63
|
+
return {
|
|
64
|
+
cost: 0,
|
|
65
|
+
isFree: !0,
|
|
66
|
+
label: e?.label || (e?.mode === "pickup" ? "In-store pickup" : "Free shipping"),
|
|
67
|
+
freeShippingProgress: null
|
|
68
|
+
};
|
|
69
|
+
let t = 0, a = !1, i = e.label || "Shipping", c = 0, s = 0;
|
|
70
|
+
switch (e.mode) {
|
|
71
|
+
case "flat": {
|
|
72
|
+
t = Math.max(0, n(e.cost)), i = e.label || "Shipping";
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
case "freeOver": {
|
|
76
|
+
c = n(e.freeOver), o >= c && c > 0 ? (t = 0, a = !0, i = e.label || `Free (orders over ${c})`) : (t = Math.max(0, n(e.cost)), i = e.label || "Shipping", s = c > 0 ? Math.max(0, c - o) : 0);
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
case "tiered": {
|
|
80
|
+
const l = (e.tiers || []).slice().sort((m, d) => m.minSubtotal - d.minSubtotal);
|
|
81
|
+
let f;
|
|
82
|
+
for (const m of l)
|
|
83
|
+
if (o >= n(m.minSubtotal)) f = m;
|
|
84
|
+
else break;
|
|
85
|
+
!f && l.length && (f = l[0]), f && (t = Math.max(0, n(f.cost)), f.cost === 0 && (a = !0), i = f.label || e.label || "Shipping");
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
case "function": {
|
|
89
|
+
if (typeof e.calculate == "function") {
|
|
90
|
+
const l = e.calculate(o, r);
|
|
91
|
+
t = Math.max(0, n(l?.cost)), l?.isFree && (a = !0), l?.label && (i = l.label);
|
|
92
|
+
}
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
cost: u(t, 2),
|
|
98
|
+
isFree: a,
|
|
99
|
+
label: i,
|
|
100
|
+
freeShippingProgress: e.mode === "freeOver" && c > 0 && !a ? { remaining: u(s, 2), threshold: c } : null
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function T(o) {
|
|
104
|
+
const { items: e, tax: r, shipping: t, coupon: a, currency: i } = o, c = o.roundToCents ?? 2, s = u(h(e, !1), c);
|
|
105
|
+
u(h(e, !0), c);
|
|
106
|
+
const l = u(M(e), c), f = S(e), m = u(y(a, s, i), c), d = u(Math.max(0, s - m), c);
|
|
107
|
+
let x = d;
|
|
108
|
+
r?.applyTo === "subtotal" && (x = s), r?.applyTo === "original" && (x = s);
|
|
109
|
+
const b = k(x, r, c), p = g(
|
|
110
|
+
r?.applyTo === "original" ? s : d,
|
|
111
|
+
t,
|
|
112
|
+
e
|
|
113
|
+
), v = u(
|
|
114
|
+
Math.max(0, d + b.total + p.cost),
|
|
115
|
+
c
|
|
116
|
+
);
|
|
117
|
+
return {
|
|
118
|
+
totals: {
|
|
119
|
+
subtotal: s,
|
|
120
|
+
discount: m > 0 ? m : void 0,
|
|
121
|
+
estimatedTax: b.total > 0 ? b.total : void 0,
|
|
122
|
+
taxRate: r?.mode === "rate" || r?.mode === "inclusive" ? r.rate : void 0,
|
|
123
|
+
shipping: p.cost,
|
|
124
|
+
grandTotal: v,
|
|
125
|
+
itemCount: f,
|
|
126
|
+
totalSavings: l > 0 ? l : void 0,
|
|
127
|
+
currency: i || r?.currency || t?.currency
|
|
128
|
+
},
|
|
129
|
+
taxBreakdown: b.breakdown,
|
|
130
|
+
freeShippingProgress: p.freeShippingProgress
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function w(o) {
|
|
134
|
+
return T(o());
|
|
135
|
+
}
|
|
136
|
+
export {
|
|
137
|
+
T as calculateCartTotals,
|
|
138
|
+
y as computeCouponDiscount,
|
|
139
|
+
g as computeShipping,
|
|
140
|
+
k as computeTax,
|
|
141
|
+
S as sumItemCount,
|
|
142
|
+
h as sumLineTotals,
|
|
143
|
+
M as sumSavings,
|
|
144
|
+
w as useCartCalculation
|
|
145
|
+
};
|
|
@@ -3,5 +3,7 @@ export { default as CartLineItem } from './CartLineItem.vue';
|
|
|
3
3
|
export { default as CartSummary } from './CartSummary.vue';
|
|
4
4
|
export { default as CartCouponInput } from './CartCouponInput.vue';
|
|
5
5
|
export { default as CartEmptyState } from './CartEmptyState.vue';
|
|
6
|
+
export { useCart } from './composables/useCart';
|
|
7
|
+
export type { CartItemId, UseCartOptions, UseCartReturn } from './composables/useCart';
|
|
6
8
|
export * from './composables/useCartCalculation';
|
|
7
9
|
export * from './types';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./CategoryManager.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
const
|
|
3
|
+
import r from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-0e426dc4"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
m as default
|
|
7
7
|
};
|