@haus-storefront-react/vendure-plugin-configs 1.0.4-next.7 → 1.0.4-next.8

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +808 -793
  2. package/badge.js +1 -1
  3. package/badge.mjs +439 -424
  4. package/campaign.js +1 -1
  5. package/campaign.mjs +50 -106
  6. package/elastic.js +1 -1
  7. package/elastic.mjs +10 -26
  8. package/index.js +1 -1
  9. package/index.mjs +2 -4
  10. package/lib/configs/vendure-badge-plugin.d.ts +2 -2
  11. package/lib/configs/vendure-related-products-plugin.d.ts +39 -0
  12. package/lib/configs/vendure-related-products-plugin.types.d.ts +16 -0
  13. package/lib/exports/related-products.d.ts +3 -0
  14. package/lib/hooks/use-related-products.d.ts +2 -0
  15. package/package.json +13 -7
  16. package/packagesize.js +1 -1
  17. package/packagesize.mjs +15 -59
  18. package/plugin-config-DrQQb9Ry.js +1 -0
  19. package/plugin-config-DywohMgp.mjs +903 -0
  20. package/product-popularity.js +1 -1
  21. package/product-popularity.mjs +12 -22
  22. package/product-variant-specifications.js +1 -1
  23. package/product-variant-specifications.mjs +8 -18
  24. package/purchase-order-payment.js +5 -5
  25. package/purchase-order-payment.mjs +207 -631
  26. package/related-products.d.ts +2 -0
  27. package/related-products.js +1 -0
  28. package/related-products.mjs +36 -0
  29. package/src-BCHcjT-q.mjs +455 -0
  30. package/src-BqcrcEUL.mjs +2718 -0
  31. package/src-Cj3iGasO.js +6 -0
  32. package/src-CvZOxNaX.js +21 -0
  33. package/compiler-runtime-oPPev21o.js +0 -10
  34. package/compiler-runtime-qHgugrLy.mjs +0 -296
  35. package/index-BRlTlK6a.mjs +0 -3768
  36. package/index-BgBC_k8M.js +0 -1
  37. package/index-C0E-40z0.mjs +0 -19
  38. package/index-CgxqXyHf.js +0 -20
  39. package/useSdk-DOrZRSHz.mjs +0 -2634
  40. package/useSdk-YXpk8Wsi.js +0 -21
package/badge.mjs CHANGED
@@ -1,438 +1,453 @@
1
- import { V as j, l as R } from "./index-BRlTlK6a.mjs";
2
- import { c as P, j as y } from "./compiler-runtime-qHgugrLy.mjs";
3
- import * as m from "react";
4
- import $, { useRef as N } from "react";
5
- import { r as V } from "./index-C0E-40z0.mjs";
6
- import { u as k } from "./useSdk-DOrZRSHz.mjs";
7
- import "@tanstack/react-query";
8
- const v = new j({
9
- name: "badges",
10
- enableFeatures: {
11
- showBadges: ({
12
- badges: t = [],
13
- parentComponent: e
14
- }) => {
15
- const n = e ? v.getSettings().availablePositions[e] : v.getSettings().defaultPositions;
16
- return {
17
- badges: R.filter(t, (c) => n ? n.includes(c.position) : !0),
18
- availablePositions: n
19
- };
20
- }
21
- },
22
- queryUpdates: {},
23
- settings: {
24
- defaultPositions: ["top-left", "top-right", "bottom-left", "bottom-right"],
25
- availablePositions: {
26
- productListItem: ["top-left", "top-right", "bottom-left", "bottom-right"],
27
- productDetail: ["top-left", "top-right", "bottom-left", "bottom-right"],
28
- imageCarousel: ["top-left", "top-right", "bottom-left", "bottom-right"]
29
- }
30
- }
31
- });
32
- v.setQueryUpdates({
33
- product: {
34
- fields: [{
35
- badges: ["id", "position", "assetId", {
36
- asset: ["id", "name", "preview", "source"]
37
- }, {
38
- collection: ["id", "name"]
39
- }]
40
- }]
41
- },
42
- search: {
43
- fields: [{
44
- items: [{
45
- badges: ["id", "position", "assetId", {
46
- asset: ["id", "name", "preview", "source"]
47
- }, {
48
- collection: ["id", "name"]
49
- }]
50
- }]
51
- }]
52
- },
53
- products: {
54
- fields: [{
55
- items: [{
56
- badges: ["id", "position", "assetId", {
57
- asset: ["id", "name", "preview", "source"]
58
- }, {
59
- collection: ["id", "name"]
60
- }]
61
- }]
62
- }]
63
- },
64
- briefProducts: {
65
- fields: [{
66
- items: [{
67
- badges: ["id", "position", "assetId", {
68
- asset: ["id", "name", "preview", "source"]
69
- }, {
70
- collection: ["id", "name"]
71
- }]
72
- }]
73
- }]
74
- }
75
- });
76
- v.setRequests({
77
- getBadges: async () => v.getSdk().createRequest({
78
- operation: "badges",
79
- fields: ["totalItems", {
80
- items: ["id", "createdAt", "updatedAt", "collectionId", "position", "assetId", {
81
- asset: ["id", "name", "preview", "source"]
82
- }, {
83
- collection: ["id", "name"]
84
- }]
85
- }]
86
- }, {
87
- options: {
88
- take: 100
89
- }
90
- }, !1).then((t) => t.data).catch((t) => ({
91
- message: t.message,
92
- errorCode: t.code || "unknown"
93
- }))
94
- });
95
- function A(t) {
96
- const e = [];
97
- function n(c, o) {
98
- const s = m.createContext(o), r = e.length;
99
- e.push(s);
100
- const l = (u) => {
101
- const f = P.c(8);
102
- let d, p, g;
103
- f[0] !== u ? ({
104
- scope: g,
105
- children: d,
106
- ...p
107
- } = u, f[0] = u, f[1] = d, f[2] = p, f[3] = g) : (d = f[1], p = f[2], g = f[3]);
108
- const h = g?.[t]?.[r] || s, b = p;
109
- let x;
110
- return f[4] !== h.Provider || f[5] !== d || f[6] !== b ? (x = /* @__PURE__ */ y.jsx(h.Provider, { value: b, children: d }), f[4] = h.Provider, f[5] = d, f[6] = b, f[7] = x) : x = f[7], x;
111
- };
112
- l.displayName = c + "Provider";
113
- function a(u, f) {
114
- const d = f?.[t]?.[r] || s, p = m.useContext(d);
115
- if (p)
116
- return p;
117
- if (o !== void 0)
118
- return o;
119
- throw new Error(`\`${u}\` must be used within \`${c}\``);
120
- }
121
- return [l, a];
122
- }
123
- function i() {
124
- const c = e.map((o) => m.createContext(o));
125
- return function(s) {
126
- const r = s?.[t] || c;
127
- return m.useMemo(() => ({
128
- [`__scope${t}`]: {
129
- ...s,
130
- [t]: r
131
- }
132
- }), [s, r]);
133
- };
134
- }
135
- return i.scopeName = t, [n, i];
1
+ import { a as e, c as t, o as n, r, s as i } from "./src-BCHcjT-q.mjs";
2
+ import { C as a, S as o, T as s, _ as c, a as l, b as u, c as d, d as f, f as p, g as m, h, i as g, l as _, m as v, n as y, o as b, p as x, r as S, s as C, t as ee, u as w, v as te, w as T, x as ne, y as re } from "./plugin-config-DywohMgp.mjs";
3
+ import { i as E } from "./src-BqcrcEUL.mjs";
4
+ import { useRef as ie } from "react";
5
+ //#region ../../../node_modules/lodash-es/_setCacheAdd.js
6
+ var ae = "__lodash_hash_undefined__";
7
+ function oe(e) {
8
+ return this.__data__.set(e, ae), this;
136
9
  }
137
- function O(t, e) {
138
- if (e === "web")
139
- return t;
140
- const {
141
- src: n,
142
- alt: i,
143
- width: c,
144
- height: o,
145
- ...s
146
- } = t, r = [typeof c == "number" ? {
147
- width: c
148
- } : void 0, typeof o == "number" ? {
149
- height: o
150
- } : void 0].filter(Boolean);
151
- let l;
152
- return r.length === 1 ? l = r[0] : r.length > 1 && (l = r), {
153
- ...s,
154
- source: {
155
- uri: n
156
- },
157
- ...l ? {
158
- style: l
159
- } : {}
160
- // alt tas bort, finns inte i RN
161
- };
10
+ //#endregion
11
+ //#region ../../../node_modules/lodash-es/_setCacheHas.js
12
+ function se(e) {
13
+ return this.__data__.has(e);
162
14
  }
163
- function D(t) {
164
- const {
165
- src: e,
166
- alt: n,
167
- ...i
168
- } = t;
169
- return e ? {
170
- ...i,
171
- source: {
172
- uri: e
173
- }
174
- } : i;
15
+ //#endregion
16
+ //#region ../../../node_modules/lodash-es/_SetCache.js
17
+ function D(e) {
18
+ var t = -1, n = e == null ? 0 : e.length;
19
+ for (this.__data__ = new p(); ++t < n;) this.add(e[t]);
175
20
  }
176
- const q = {
177
- div: "View",
178
- span: "Text",
179
- p: "Text",
180
- h1: "Text",
181
- h2: "Text",
182
- h3: "Text",
183
- h4: "Text",
184
- h5: "Text",
185
- h6: "Text",
186
- button: "Pressable",
187
- input: "TextInput",
188
- form: "View",
189
- section: "View",
190
- article: "View",
191
- nav: "View",
192
- header: "View",
193
- footer: "View",
194
- main: "View",
195
- aside: "View",
196
- ul: "View",
197
- ol: "View",
198
- li: "View",
199
- a: "Pressable",
200
- img: "Image",
201
- label: "Text",
202
- textarea: "TextInput",
203
- select: "Pressable",
204
- option: "Text"
205
- };
206
- function F(t, e) {
207
- if (e === "web")
208
- return t;
209
- let n = null;
210
- try {
211
- n = require("react-native");
212
- } catch {
213
- n = null;
214
- }
215
- if (!n)
216
- return console.warn(`react-native is not available at runtime; falling back to 'View' for '${t}'`), "div";
217
- const i = q[t];
218
- if (!i)
219
- return console.warn(`No native component mapping found for '${t}', falling back to View`), n.View;
220
- if (i === "Image") {
221
- const o = $.forwardRef((s, r) => {
222
- const l = P.c(5);
223
- if (!s.src)
224
- return null;
225
- let a;
226
- l[0] !== s ? (a = D(s), l[0] = s, l[1] = a) : a = l[1];
227
- let u;
228
- return l[2] !== r || l[3] !== a ? (u = /* @__PURE__ */ y.jsx(n.Image, { ref: r, ...a }), l[2] = r, l[3] = a, l[4] = u) : u = l[4], u;
229
- });
230
- return o.displayName = "PlatformPrimitiveImage", o;
231
- }
232
- const c = n[i];
233
- return c || (console.warn(`Native component '${i}' not found, falling back to View`), n.View);
21
+ D.prototype.add = D.prototype.push = oe, D.prototype.has = se;
22
+ //#endregion
23
+ //#region ../../../node_modules/lodash-es/_arraySome.js
24
+ function ce(e, t) {
25
+ for (var n = -1, r = e == null ? 0 : e.length; ++n < r;) if (t(e[n], n, e)) return !0;
26
+ return !1;
234
27
  }
235
- const W = /* @__PURE__ */ Symbol("radix.slottable");
236
- function G(...t) {
237
- return (e) => t.forEach((n) => {
238
- typeof n == "function" ? n(e) : n != null && (n.current = e);
239
- });
28
+ //#endregion
29
+ //#region ../../../node_modules/lodash-es/_cacheHas.js
30
+ function le(e, t) {
31
+ return e.has(t);
240
32
  }
241
- function L(t, e) {
242
- const n = {
243
- ...e
244
- };
245
- for (const i in e) {
246
- const c = t[i], o = e[i];
247
- /^on[A-Z]/.test(i) ? c && o ? n[i] = (...r) => {
248
- const l = o(...r);
249
- return c(...r), l;
250
- } : c && (n[i] = c) : i === "style" ? n[i] = M(c, o) : i === "className" && (n[i] = [c, o].filter(Boolean).join(" "));
251
- }
252
- return {
253
- ...t,
254
- ...n
255
- };
33
+ //#endregion
34
+ //#region ../../../node_modules/lodash-es/_equalArrays.js
35
+ var ue = 1, de = 2;
36
+ function O(e, t, n, r, i, a) {
37
+ var o = n & ue, s = e.length, c = t.length;
38
+ if (s != c && !(o && c > s)) return !1;
39
+ var l = a.get(e), u = a.get(t);
40
+ if (l && u) return l == t && u == e;
41
+ var d = -1, f = !0, p = n & de ? new D() : void 0;
42
+ for (a.set(e, t), a.set(t, e); ++d < s;) {
43
+ var m = e[d], h = t[d];
44
+ if (r) var g = o ? r(h, m, d, t, e, a) : r(m, h, d, e, t, a);
45
+ if (g !== void 0) {
46
+ if (g) continue;
47
+ f = !1;
48
+ break;
49
+ }
50
+ if (p) {
51
+ if (!ce(t, function(e, t) {
52
+ if (!le(p, t) && (m === e || i(m, e, n, r, a))) return p.push(t);
53
+ })) {
54
+ f = !1;
55
+ break;
56
+ }
57
+ } else if (!(m === h || i(m, h, n, r, a))) {
58
+ f = !1;
59
+ break;
60
+ }
61
+ }
62
+ return a.delete(e), a.delete(t), f;
256
63
  }
257
- function M(t, e) {
258
- let n = null;
259
- try {
260
- n = require("react-native");
261
- } catch {
262
- n = null;
263
- }
264
- const i = n?.StyleSheet?.flatten;
265
- if (typeof t == "function" && typeof e == "function")
266
- return (o) => {
267
- const s = [t(o), e(o)];
268
- return i ? i(s) : s;
269
- };
270
- if (typeof t == "function")
271
- return (o) => {
272
- const s = e ? [t(o), e] : t(o);
273
- return i ? i(s) : s;
274
- };
275
- if (typeof e == "function")
276
- return (o) => {
277
- const s = t ? [t, e(o)] : e(o);
278
- return i ? i(s) : s;
279
- };
280
- const c = [t, e].filter(Boolean);
281
- return i ? i(c) : c;
64
+ //#endregion
65
+ //#region ../../../node_modules/lodash-es/_mapToArray.js
66
+ function fe(e) {
67
+ var t = -1, n = Array(e.size);
68
+ return e.forEach(function(e, r) {
69
+ n[++t] = [r, e];
70
+ }), n;
282
71
  }
283
- function U(t) {
284
- return m.isValidElement(t) && typeof t.type == "function" && "__radixId" in t.type && t.type.__radixId === W;
72
+ //#endregion
73
+ //#region ../../../node_modules/lodash-es/_setToArray.js
74
+ function pe(e) {
75
+ var t = -1, n = Array(e.size);
76
+ return e.forEach(function(e) {
77
+ n[++t] = e;
78
+ }), n;
285
79
  }
286
- function H(t) {
287
- let e = Object.getOwnPropertyDescriptor(t.props, "ref")?.get, n = e && "isReactWarning" in e && e.isReactWarning;
288
- return n ? t.ref : (e = Object.getOwnPropertyDescriptor(t, "ref")?.get, n = e && "isReactWarning" in e && e.isReactWarning, n ? t.props.ref : t.props.ref || t.ref);
80
+ //#endregion
81
+ //#region ../../../node_modules/lodash-es/_equalByTag.js
82
+ var me = 1, he = 2, ge = "[object Boolean]", _e = "[object Date]", k = "[object Error]", A = "[object Map]", j = "[object Number]", M = "[object RegExp]", N = "[object Set]", P = "[object String]", F = "[object Symbol]", I = "[object ArrayBuffer]", ve = "[object DataView]", L = s ? s.prototype : void 0, R = L ? L.valueOf : void 0;
83
+ function ye(e, t, n, r, i, a, o) {
84
+ switch (n) {
85
+ case ve:
86
+ if (e.byteLength != t.byteLength || e.byteOffset != t.byteOffset) return !1;
87
+ e = e.buffer, t = t.buffer;
88
+ case I: return !(e.byteLength != t.byteLength || !a(new S(e), new S(t)));
89
+ case ge:
90
+ case _e:
91
+ case j: return re(+e, +t);
92
+ case k: return e.name == t.name && e.message == t.message;
93
+ case M:
94
+ case P: return e == t + "";
95
+ case A: var s = fe;
96
+ case N:
97
+ var c = r & me;
98
+ if (s ||= pe, e.size != t.size && !c) return !1;
99
+ var l = o.get(e);
100
+ if (l) return l == t;
101
+ r |= he, o.set(e, t);
102
+ var u = O(s(e), s(t), r, i, a, o);
103
+ return o.delete(e), u;
104
+ case F: if (R) return R.call(e) == R.call(t);
105
+ }
106
+ return !1;
289
107
  }
290
- function K(t, e) {
291
- const n = m.forwardRef((i, c) => {
292
- const {
293
- children: o,
294
- ...s
295
- } = i;
296
- if (m.isValidElement(o)) {
297
- const r = H(o), l = L(s, o.props);
298
- return o.type !== m.Fragment && (l.ref = c ? G(c, r) : r), m.cloneElement(o, l);
299
- }
300
- return m.Children.count(o) > 1 ? m.Children.only(null) : null;
301
- });
302
- return n.displayName = `${t}.SlotClone`, n;
108
+ //#endregion
109
+ //#region ../../../node_modules/lodash-es/_equalObjects.js
110
+ var be = 1, xe = Object.prototype.hasOwnProperty;
111
+ function Se(e, t, n, r, i, a) {
112
+ var o = n & be, s = l(e), c = s.length;
113
+ if (c != l(t).length && !o) return !1;
114
+ for (var u = c; u--;) {
115
+ var d = s[u];
116
+ if (!(o ? d in t : xe.call(t, d))) return !1;
117
+ }
118
+ var f = a.get(e), p = a.get(t);
119
+ if (f && p) return f == t && p == e;
120
+ var m = !0;
121
+ a.set(e, t), a.set(t, e);
122
+ for (var h = o; ++u < c;) {
123
+ d = s[u];
124
+ var g = e[d], _ = t[d];
125
+ if (r) var v = o ? r(_, g, d, t, e, a) : r(g, _, d, e, t, a);
126
+ if (!(v === void 0 ? g === _ || i(g, _, n, r, a) : v)) {
127
+ m = !1;
128
+ break;
129
+ }
130
+ h ||= d == "constructor";
131
+ }
132
+ if (m && !h) {
133
+ var y = e.constructor, b = t.constructor;
134
+ y != b && "constructor" in e && "constructor" in t && !(typeof y == "function" && y instanceof y && typeof b == "function" && b instanceof b) && (m = !1);
135
+ }
136
+ return a.delete(e), a.delete(t), m;
303
137
  }
304
- function w(t, e = !1, n = "div") {
305
- if (!e)
306
- return F(n, t);
307
- const i = K("Slot"), c = m.forwardRef((o, s) => {
308
- const r = P.c(15);
309
- let l, a;
310
- r[0] !== o ? ({
311
- children: l,
312
- ...a
313
- } = o, r[0] = o, r[1] = l, r[2] = a) : (l = r[1], a = r[2]);
314
- let u;
315
- if (r[3] !== l || r[4] !== s || r[5] !== a) {
316
- u = /* @__PURE__ */ Symbol.for("react.early_return_sentinel");
317
- e: {
318
- const d = m.Children.toArray(l), p = d.find(U);
319
- if (p) {
320
- const g = p.props.children, h = d.map((B) => B === p ? m.Children.count(g) > 1 ? m.Children.only(null) : m.isValidElement(g) ? g.props.children : null : B), b = m.isValidElement(g) ? m.cloneElement(g, void 0, h) : null;
321
- let x;
322
- r[7] !== s || r[8] !== a || r[9] !== b ? (x = /* @__PURE__ */ y.jsx(i, { ...a, ref: s, children: b }), r[7] = s, r[8] = a, r[9] = b, r[10] = x) : x = r[10], u = x;
323
- break e;
324
- }
325
- }
326
- r[3] = l, r[4] = s, r[5] = a, r[6] = u;
327
- } else
328
- u = r[6];
329
- if (u !== /* @__PURE__ */ Symbol.for("react.early_return_sentinel"))
330
- return u;
331
- let f;
332
- return r[11] !== l || r[12] !== s || r[13] !== a ? (f = /* @__PURE__ */ y.jsx(i, { ...a, ref: s, children: l }), r[11] = l, r[12] = s, r[13] = a, r[14] = f) : f = r[14], f;
333
- });
334
- return c.displayName = "Slot", c;
138
+ //#endregion
139
+ //#region ../../../node_modules/lodash-es/_baseIsEqualDeep.js
140
+ var Ce = 1, z = "[object Arguments]", B = "[object Array]", V = "[object Object]", H = Object.prototype.hasOwnProperty;
141
+ function we(e, t, n, r, i, o) {
142
+ var s = a(e), c = a(t), l = s ? B : g(e), u = c ? B : g(t);
143
+ l = l == z ? V : l, u = u == z ? V : u;
144
+ var d = l == V, f = u == V, p = l == u;
145
+ if (p && m(e)) {
146
+ if (!m(t)) return !1;
147
+ s = !0, d = !1;
148
+ }
149
+ if (p && !d) return o ||= new C(), s || h(e) ? O(e, t, n, r, i, o) : ye(e, t, l, n, r, i, o);
150
+ if (!(n & Ce)) {
151
+ var _ = d && H.call(e, "__wrapped__"), v = f && H.call(t, "__wrapped__");
152
+ if (_ || v) {
153
+ var y = _ ? e.value() : e, b = v ? t.value() : t;
154
+ return o ||= new C(), i(y, b, n, r, o);
155
+ }
156
+ }
157
+ return p ? (o ||= new C(), Se(e, t, n, r, i, o)) : !1;
335
158
  }
336
- const C = () => {
337
- const t = P.c(2), {
338
- getPlatform: e
339
- } = k();
340
- let n;
341
- return t[0] !== e ? (n = e(), t[0] = e, t[1] = n) : n = t[1], n;
342
- }, I = "ProductBadge", [Q] = A(I), [Z, z] = Q(I), _ = (t) => {
343
- const e = P.c(13);
344
- let n, i, c, o, s;
345
- e[0] !== t ? ({
346
- children: i,
347
- product: c,
348
- __scopeProductBadge: n,
349
- style: s,
350
- ...o
351
- } = t, e[0] = t, e[1] = n, e[2] = i, e[3] = c, e[4] = o, e[5] = s) : (n = e[1], i = e[2], c = e[3], o = e[4], s = e[5]);
352
- const r = N(null), l = C();
353
- let a;
354
- e[6] !== l ? (a = w(l), e[6] = l, e[7] = a) : a = e[7];
355
- const u = a;
356
- if (!v.getEnabled())
357
- return null;
358
- const {
359
- badges: f
360
- } = c;
361
- if (!f)
362
- return null;
363
- const d = f.reduce(J, {}), p = Object.keys(d), g = {
364
- groupedBadges: d,
365
- badges: f,
366
- badgesRef: r,
367
- positions: p
368
- }, h = V(i, g);
369
- let b;
370
- return e[8] !== u || e[9] !== o || e[10] !== s || e[11] !== h ? (b = /* @__PURE__ */ y.jsx(u, { ...o, style: s, children: h }), e[8] = u, e[9] = o, e[10] = s, e[11] = h, e[12] = b) : b = e[12], /* @__PURE__ */ y.jsx(Z, { scope: n, ...g, children: b });
371
- };
372
- _.displayName = I;
373
- const E = (t) => {
374
- const e = P.c(18);
375
- let n, i, c, o, s;
376
- e[0] !== t ? ({
377
- children: c,
378
- position: o,
379
- asChild: i,
380
- __scopeProductBadge: n,
381
- ...s
382
- } = t, e[0] = t, e[1] = n, e[2] = i, e[3] = c, e[4] = o, e[5] = s) : (n = e[1], i = e[2], c = e[3], o = e[4], s = e[5]);
383
- const r = C();
384
- let l;
385
- e[6] !== i || e[7] !== r ? (l = w(r, i, "div"), e[6] = i, e[7] = r, e[8] = l) : l = e[8];
386
- const a = l, {
387
- groupedBadges: u
388
- } = z(I, n), f = u[o];
389
- let d;
390
- e[9] !== f || e[10] !== c || e[11] !== o ? (d = V(c, {
391
- badges: f,
392
- position: o
393
- }), e[9] = f, e[10] = c, e[11] = o, e[12] = d) : d = e[12];
394
- let p;
395
- return e[13] !== a || e[14] !== o || e[15] !== s || e[16] !== d ? (p = /* @__PURE__ */ y.jsx(a, { ...s, "data-position": o, children: d }), e[13] = a, e[14] = o, e[15] = s, e[16] = d, e[17] = p) : p = e[17], p;
396
- }, S = (t) => {
397
- const e = P.c(13);
398
- let n, i, c, o;
399
- e[0] !== t ? ({
400
- children: c,
401
- asChild: n,
402
- badge: i,
403
- ...o
404
- } = t, e[0] = t, e[1] = n, e[2] = i, e[3] = c, e[4] = o) : (n = e[1], i = e[2], c = e[3], o = e[4]);
405
- const s = C();
406
- let r;
407
- e[5] !== n || e[6] !== s ? (r = w(s, n, "div"), e[5] = n, e[6] = s, e[7] = r) : r = e[7];
408
- const l = r, a = i?.id;
409
- let u;
410
- return e[8] !== l || e[9] !== c || e[10] !== o || e[11] !== a ? (u = /* @__PURE__ */ y.jsx(l, { ...o, "data-badge-id": a, children: c }), e[8] = l, e[9] = c, e[10] = o, e[11] = a, e[12] = u) : u = e[12], u;
411
- }, T = (t) => {
412
- const e = P.c(8), {
413
- badge: n,
414
- asChild: i,
415
- ...c
416
- } = t, o = C();
417
- let s;
418
- e[0] !== i || e[1] !== o ? (s = w(o, i, "img"), e[0] = i, e[1] = o, e[2] = s) : s = e[2];
419
- const r = s, l = O(c, o), a = n.asset?.preview;
420
- let u;
421
- return e[3] !== r || e[4] !== n.collection.name || e[5] !== a || e[6] !== l ? (u = /* @__PURE__ */ y.jsx(r, { src: a, alt: n.collection.name, "data-badge-name": n.collection.name, ...l }), e[3] = r, e[4] = n.collection.name, e[5] = a, e[6] = l, e[7] = u) : u = e[7], u;
159
+ //#endregion
160
+ //#region ../../../node_modules/lodash-es/_baseIsEqual.js
161
+ function U(e, t, n, r, i) {
162
+ return e === t ? !0 : e == null || t == null || !T(e) && !T(t) ? e !== e && t !== t : we(e, t, n, r, U, i);
163
+ }
164
+ //#endregion
165
+ //#region ../../../node_modules/lodash-es/_baseIsMatch.js
166
+ var Te = 1, Ee = 2;
167
+ function De(e, t, n, r) {
168
+ var i = n.length, a = i, o = !r;
169
+ if (e == null) return !a;
170
+ for (e = Object(e); i--;) {
171
+ var s = n[i];
172
+ if (o && s[2] ? s[1] !== e[s[0]] : !(s[0] in e)) return !1;
173
+ }
174
+ for (; ++i < a;) {
175
+ s = n[i];
176
+ var c = s[0], l = e[c], u = s[1];
177
+ if (o && s[2]) {
178
+ if (l === void 0 && !(c in e)) return !1;
179
+ } else {
180
+ var d = new C();
181
+ if (r) var f = r(l, u, c, e, t, d);
182
+ if (!(f === void 0 ? U(u, l, Te | Ee, r, d) : f)) return !1;
183
+ }
184
+ }
185
+ return !0;
186
+ }
187
+ //#endregion
188
+ //#region ../../../node_modules/lodash-es/_isStrictComparable.js
189
+ function W(e) {
190
+ return e === e && !o(e);
191
+ }
192
+ //#endregion
193
+ //#region ../../../node_modules/lodash-es/_getMatchData.js
194
+ function Oe(e) {
195
+ for (var t = v(e), n = t.length; n--;) {
196
+ var r = t[n], i = e[r];
197
+ t[n] = [
198
+ r,
199
+ i,
200
+ W(i)
201
+ ];
202
+ }
203
+ return t;
204
+ }
205
+ //#endregion
206
+ //#region ../../../node_modules/lodash-es/_matchesStrictComparable.js
207
+ function G(e, t) {
208
+ return function(n) {
209
+ return n == null ? !1 : n[e] === t && (t !== void 0 || e in Object(n));
210
+ };
211
+ }
212
+ //#endregion
213
+ //#region ../../../node_modules/lodash-es/_baseMatches.js
214
+ function ke(e) {
215
+ var t = Oe(e);
216
+ return t.length == 1 && t[0][2] ? G(t[0][0], t[0][1]) : function(n) {
217
+ return n === e || De(n, e, t);
218
+ };
219
+ }
220
+ //#endregion
221
+ //#region ../../../node_modules/lodash-es/_baseHasIn.js
222
+ function Ae(e, t) {
223
+ return e != null && t in Object(e);
224
+ }
225
+ //#endregion
226
+ //#region ../../../node_modules/lodash-es/_hasPath.js
227
+ function je(e, t, n) {
228
+ t = f(t, e);
229
+ for (var r = -1, i = t.length, o = !1; ++r < i;) {
230
+ var s = w(t[r]);
231
+ if (!(o = e != null && n(e, s))) break;
232
+ e = e[s];
233
+ }
234
+ return o || ++r != i ? o : (i = e == null ? 0 : e.length, !!i && te(i) && u(s, i) && (a(e) || c(e)));
235
+ }
236
+ //#endregion
237
+ //#region ../../../node_modules/lodash-es/hasIn.js
238
+ function Me(e, t) {
239
+ return e != null && je(e, t, Ae);
240
+ }
241
+ //#endregion
242
+ //#region ../../../node_modules/lodash-es/_baseMatchesProperty.js
243
+ var Ne = 1, Pe = 2;
244
+ function Fe(e, t) {
245
+ return x(e) && W(t) ? G(w(e), t) : function(n) {
246
+ var r = d(n, e);
247
+ return r === void 0 && r === t ? Me(n, e) : U(t, r, Ne | Pe);
248
+ };
249
+ }
250
+ //#endregion
251
+ //#region ../../../node_modules/lodash-es/_baseProperty.js
252
+ function Ie(e) {
253
+ return function(t) {
254
+ return t?.[e];
255
+ };
256
+ }
257
+ //#endregion
258
+ //#region ../../../node_modules/lodash-es/_basePropertyDeep.js
259
+ function Le(e) {
260
+ return function(t) {
261
+ return _(t, e);
262
+ };
263
+ }
264
+ //#endregion
265
+ //#region ../../../node_modules/lodash-es/property.js
266
+ function Re(e) {
267
+ return x(e) ? Ie(w(e)) : Le(e);
268
+ }
269
+ //#endregion
270
+ //#region ../../../node_modules/lodash-es/_baseIteratee.js
271
+ function ze(e) {
272
+ return typeof e == "function" ? e : e == null ? ne : typeof e == "object" ? a(e) ? Fe(e[0], e[1]) : ke(e) : Re(e);
273
+ }
274
+ //#endregion
275
+ //#region ../../../node_modules/lodash-es/_baseFilter.js
276
+ function Be(e, t) {
277
+ var n = [];
278
+ return y(e, function(e, r, i) {
279
+ t(e, r, i) && n.push(e);
280
+ }), n;
281
+ }
282
+ //#endregion
283
+ //#region ../../../node_modules/lodash-es/filter.js
284
+ function Ve(e, t) {
285
+ return (a(e) ? b : Be)(e, ze(t, 3));
286
+ }
287
+ //#endregion
288
+ //#region src/lib/configs/vendure-badge-plugin.ts
289
+ var K = new ee({
290
+ name: "badges",
291
+ enableFeatures: { showBadges: ({ badges: e = [], parentComponent: t }) => {
292
+ let n = t ? K.getSettings().availablePositions[t] : K.getSettings().defaultPositions;
293
+ return {
294
+ badges: Ve(e, (e) => n ? n.includes(e.position) : !0),
295
+ availablePositions: n
296
+ };
297
+ } },
298
+ queryUpdates: {},
299
+ settings: {
300
+ defaultPositions: [
301
+ "top-left",
302
+ "top-right",
303
+ "bottom-left",
304
+ "bottom-right"
305
+ ],
306
+ availablePositions: {
307
+ productListItem: [
308
+ "top-left",
309
+ "top-right",
310
+ "bottom-left",
311
+ "bottom-right"
312
+ ],
313
+ productDetail: [
314
+ "top-left",
315
+ "top-right",
316
+ "bottom-left",
317
+ "bottom-right"
318
+ ],
319
+ imageCarousel: [
320
+ "top-left",
321
+ "top-right",
322
+ "bottom-left",
323
+ "bottom-right"
324
+ ]
325
+ }
326
+ }
327
+ });
328
+ K.setQueryUpdates({
329
+ product: { fields: [{ badges: [
330
+ "id",
331
+ "position",
332
+ "assetId",
333
+ { asset: [
334
+ "id",
335
+ "name",
336
+ "preview",
337
+ "source"
338
+ ] },
339
+ { collection: ["id", "name"] }
340
+ ] }] },
341
+ search: { fields: [{ items: [{ badges: [
342
+ "id",
343
+ "position",
344
+ "assetId",
345
+ { asset: [
346
+ "id",
347
+ "name",
348
+ "preview",
349
+ "source"
350
+ ] },
351
+ { collection: ["id", "name"] }
352
+ ] }] }] },
353
+ products: { fields: [{ items: [{ badges: [
354
+ "id",
355
+ "position",
356
+ "assetId",
357
+ { asset: [
358
+ "id",
359
+ "name",
360
+ "preview",
361
+ "source"
362
+ ] },
363
+ { collection: ["id", "name"] }
364
+ ] }] }] },
365
+ briefProducts: { fields: [{ items: [{ badges: [
366
+ "id",
367
+ "position",
368
+ "assetId",
369
+ { asset: [
370
+ "id",
371
+ "name",
372
+ "preview",
373
+ "source"
374
+ ] },
375
+ { collection: ["id", "name"] }
376
+ ] }] }] }
377
+ }), K.setRequests({ getBadges: async () => K.getSdk().createRequest({
378
+ operation: "badges",
379
+ fields: ["totalItems", { items: [
380
+ "id",
381
+ "createdAt",
382
+ "updatedAt",
383
+ "collectionId",
384
+ "position",
385
+ "assetId",
386
+ { asset: [
387
+ "id",
388
+ "name",
389
+ "preview",
390
+ "source"
391
+ ] },
392
+ { collection: ["id", "name"] }
393
+ ] }]
394
+ }, { options: { take: 100 } }, !1).then((e) => e.data).catch((e) => ({
395
+ message: e.message,
396
+ errorCode: e.code || "unknown"
397
+ })) });
398
+ //#endregion
399
+ //#region src/lib/components/product-badges.tsx
400
+ var q = t(), J = "ProductBadge", [Y] = i(J), [He, Ue] = Y(J), X = ({ children: t, product: n, __scopeProductBadge: i, style: a, ...o }) => {
401
+ let s = ie(null), c = e(E());
402
+ if (!K.getEnabled()) return null;
403
+ let { badges: l } = n;
404
+ if (!l) return null;
405
+ let u = l.reduce((e, t) => (e[t.position] || (e[t.position] = []), e[t.position].push(t), e), {}), d = {
406
+ groupedBadges: u,
407
+ badges: l,
408
+ badgesRef: s,
409
+ positions: Object.keys(u)
410
+ };
411
+ return /* @__PURE__ */ (0, q.jsx)(He, {
412
+ scope: i,
413
+ ...d,
414
+ children: /* @__PURE__ */ (0, q.jsx)(c, {
415
+ ...o,
416
+ style: a,
417
+ children: r(t, d)
418
+ })
419
+ });
422
420
  };
423
- E.displayName = "ProductBadgeGroup";
424
- S.displayName = "ProductBadgeItem";
425
- T.displayName = "ProductBadgeImage";
426
- const re = {
427
- Root: _,
428
- Group: E,
429
- Item: S,
430
- Image: T
421
+ X.displayName = J;
422
+ var Z = ({ children: t, position: n, asChild: i, __scopeProductBadge: a, ...o }) => {
423
+ let s = e(E(), i, "div"), { groupedBadges: c } = Ue(J, a), l = c[n];
424
+ return /* @__PURE__ */ (0, q.jsx)(s, {
425
+ ...o,
426
+ "data-position": n,
427
+ children: r(t, {
428
+ badges: l,
429
+ position: n
430
+ })
431
+ });
432
+ }, Q = ({ children: t, asChild: n, badge: r, ...i }) => /* @__PURE__ */ (0, q.jsx)(e(E(), n, "div"), {
433
+ ...i,
434
+ "data-badge-id": r?.id,
435
+ children: t
436
+ }), $ = ({ badge: t, asChild: r, ...i }) => {
437
+ let a = E(), o = e(a, r, "img"), s = n(i, a);
438
+ return /* @__PURE__ */ (0, q.jsx)(o, {
439
+ src: t.asset?.preview,
440
+ alt: t.collection.name,
441
+ "data-badge-name": t.collection.name,
442
+ ...s
443
+ });
431
444
  };
432
- function J(t, e) {
433
- return t[e.position] || (t[e.position] = []), t[e.position].push(e), t;
434
- }
435
- export {
436
- re as ProductBadge,
437
- v as VendureBadgePlugin
445
+ Z.displayName = "ProductBadgeGroup", Q.displayName = "ProductBadgeItem", $.displayName = "ProductBadgeImage";
446
+ var We = {
447
+ Root: X,
448
+ Group: Z,
449
+ Item: Q,
450
+ Image: $
438
451
  };
452
+ //#endregion
453
+ export { We as ProductBadge, K as VendureBadgePlugin };