@instockng/storefront-ui 1.0.107 → 1.0.109
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/components/AssistantDrawer.d.ts +1 -3
- package/dist/components/AssistantDrawer.d.ts.map +1 -1
- package/dist/components/ProductAssistantChips.d.ts +9 -8
- package/dist/components/ProductAssistantChips.d.ts.map +1 -1
- package/dist/contexts/AssistantContext.d.ts +19 -0
- package/dist/contexts/AssistantContext.d.ts.map +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +56 -56
- package/dist/index10.mjs +103 -73
- package/dist/index100.mjs +28 -8
- package/dist/index101.mjs +8 -74
- package/dist/index102.mjs +74 -3
- package/dist/index103.mjs +4 -2
- package/dist/index104.mjs +2 -83
- package/dist/index105.mjs +81 -52
- package/dist/index106.mjs +53 -5
- package/dist/index107.mjs +5 -4
- package/dist/index108.mjs +4 -178
- package/dist/index109.mjs +174 -48
- package/dist/index11.mjs +73 -189
- package/dist/index110.mjs +51 -67
- package/dist/index111.mjs +69 -2
- package/dist/index112.mjs +2 -37
- package/dist/index113.mjs +25 -40
- package/dist/index114.mjs +18 -2
- package/dist/index115.mjs +213 -26
- package/dist/index116.mjs +175 -13
- package/dist/index117.mjs +17 -210
- package/dist/index118.mjs +17 -174
- package/dist/index119.mjs +25 -14
- package/dist/index12.mjs +171 -106
- package/dist/index120.mjs +150 -17
- package/dist/index121.mjs +13 -26
- package/dist/index122.mjs +24 -149
- package/dist/index123.mjs +77 -13
- package/dist/index124.mjs +27 -20
- package/dist/index125.mjs +137 -76
- package/dist/index126.mjs +50 -33
- package/dist/index127.mjs +19 -141
- package/dist/index128.mjs +22 -50
- package/dist/index129.mjs +14 -14
- package/dist/index13.mjs +127 -98
- package/dist/index130.mjs +18 -20
- package/dist/index131.mjs +14 -16
- package/dist/index132.mjs +14 -17
- package/dist/index133.mjs +12 -12
- package/dist/index134.mjs +58 -15
- package/dist/index135.mjs +11 -14
- package/dist/index136.mjs +30 -56
- package/dist/index137.mjs +15 -9
- package/dist/index138.mjs +26 -31
- package/dist/index139.mjs +16 -13
- package/dist/index14.mjs +94 -90
- package/dist/index140.mjs +11 -26
- package/dist/index141.mjs +12 -18
- package/dist/index142.mjs +40 -12
- package/dist/index143.mjs +16 -14
- package/dist/index144.mjs +263 -42
- package/dist/index145.mjs +62 -15
- package/dist/index146.mjs +7 -267
- package/dist/index147.mjs +2 -70
- package/dist/index148.mjs +2 -8
- package/dist/index149.mjs +33 -2
- package/dist/index15.mjs +84 -149
- package/dist/index150.mjs +2 -2
- package/dist/index151.mjs +37 -33
- package/dist/index152.mjs +43 -2
- package/dist/index153.mjs +2 -21
- package/dist/index154.mjs +19 -54
- package/dist/index155.mjs +55 -28
- package/dist/index156.mjs +28 -6
- package/dist/index157.mjs +6 -51
- package/dist/index158.mjs +51 -5
- package/dist/index159.mjs +6 -12
- package/dist/index16.mjs +157 -203
- package/dist/index160.mjs +12 -7
- package/dist/index161.mjs +6 -27
- package/dist/index162.mjs +28 -2
- package/dist/index163.mjs +2 -70
- package/dist/index164.mjs +67 -164
- package/dist/index165.mjs +167 -2
- package/dist/index167.mjs +2 -2
- package/dist/index168.mjs +2 -18
- package/dist/index169.mjs +11 -25
- package/dist/index17.mjs +197 -106
- package/dist/index170.mjs +26 -32
- package/dist/index171.mjs +32 -12
- package/dist/index172.mjs +9 -9
- package/dist/index173.mjs +18 -2
- package/dist/index174.mjs +2 -20
- package/dist/index175.mjs +13 -39
- package/dist/index176.mjs +46 -2
- package/dist/index177.mjs +2 -30
- package/dist/index178.mjs +24 -12
- package/dist/index179.mjs +18 -2
- package/dist/index18.mjs +96 -129
- package/dist/index180.mjs +2 -2
- package/dist/index181.mjs +2 -2
- package/dist/index182.mjs +2 -2
- package/dist/index183.mjs +2 -72
- package/dist/index184.mjs +72 -2
- package/dist/index185.mjs +2 -53
- package/dist/index186.mjs +53 -2
- package/dist/index187.mjs +2 -36
- package/dist/index188.mjs +30 -146
- package/dist/index189.mjs +152 -2
- package/dist/index19.mjs +140 -87
- package/dist/index190.mjs +2 -2
- package/dist/index191.mjs +2 -19
- package/dist/index192.mjs +19 -2
- package/dist/index193.mjs +2 -2
- package/dist/index194.mjs +2 -26
- package/dist/index195.mjs +26 -2
- package/dist/index196.mjs +2 -2
- package/dist/index197.mjs +2 -24
- package/dist/index198.mjs +17 -16
- package/dist/index199.mjs +23 -2
- package/dist/index2.mjs +29 -15
- package/dist/index20.mjs +82 -708
- package/dist/index201.mjs +2 -2
- package/dist/index202.mjs +2 -23
- package/dist/index203.mjs +23 -2
- package/dist/index204.mjs +2 -23
- package/dist/index205.mjs +23 -2
- package/dist/index206.mjs +2 -2
- package/dist/index208.mjs +2 -23
- package/dist/index209.mjs +23 -2
- package/dist/index21.mjs +688 -229
- package/dist/index210.mjs +2 -23
- package/dist/index211.mjs +23 -2
- package/dist/index212.mjs +2 -2
- package/dist/index213.mjs +2 -2
- package/dist/index215.mjs +2 -2
- package/dist/index216.mjs +2 -2
- package/dist/index217.mjs +2 -2
- package/dist/index218.mjs +2 -2
- package/dist/index219.mjs +2 -127
- package/dist/index22.mjs +260 -42
- package/dist/index220.mjs +127 -2
- package/dist/index221.mjs +2 -74
- package/dist/index222.mjs +59 -59
- package/dist/index223.mjs +74 -2
- package/dist/index224.mjs +2 -13
- package/dist/index225.mjs +108 -7
- package/dist/index226.mjs +2 -12
- package/dist/index227.mjs +2 -5
- package/dist/index228.mjs +2 -33
- package/dist/index229.mjs +2 -31
- package/dist/index23.mjs +44 -22
- package/dist/index230.mjs +2 -28
- package/dist/index231.mjs +2 -61
- package/dist/index232.mjs +2 -31
- package/dist/index233.mjs +2 -11
- package/dist/index234.mjs +2 -4
- package/dist/index235.mjs +36 -3
- package/dist/index236.mjs +2 -2
- package/dist/index237.mjs +244 -2
- package/dist/index238.mjs +2 -2
- package/dist/index239.mjs +33 -2
- package/dist/index240.mjs +65 -2
- package/dist/index241.mjs +25 -2
- package/dist/index242.mjs +2 -2
- package/dist/index244.mjs +2 -108
- package/dist/index245.mjs +2 -2
- package/dist/index246.mjs +2 -2
- package/dist/index247.mjs +2 -37
- package/dist/index248.mjs +2 -2
- package/dist/index249.mjs +2 -2
- package/dist/index250.mjs +2 -244
- package/dist/index251.mjs +13 -2
- package/dist/index252.mjs +7 -33
- package/dist/index253.mjs +30 -64
- package/dist/index254.mjs +10 -24
- package/dist/index255.mjs +4 -2
- package/dist/index256.mjs +4 -2
- package/dist/index257.mjs +2 -2
- package/dist/index258.mjs +4 -2
- package/dist/index259.mjs +12 -2
- package/dist/index260.mjs +5 -2
- package/dist/index261.mjs +33 -2
- package/dist/index262.mjs +31 -2
- package/dist/index263.mjs +28 -4
- package/dist/index264.mjs +61 -2
- package/dist/index265.mjs +2 -2
- package/dist/index266.mjs +2 -2
- package/dist/index277.mjs +1 -1
- package/dist/index282.mjs +1 -1
- package/dist/index283.mjs +2 -2
- package/dist/index3.mjs +3 -3
- package/dist/index4.mjs +34 -101
- package/dist/index5.mjs +92 -102
- package/dist/index50.mjs +1 -1
- package/dist/index58.mjs +1 -1
- package/dist/index6.mjs +111 -15
- package/dist/index63.mjs +17 -17
- package/dist/index64.mjs +2 -2
- package/dist/index7.mjs +15 -195
- package/dist/index8.mjs +135 -189
- package/dist/index81.mjs +19 -149
- package/dist/index82.mjs +149 -19
- package/dist/index85.mjs +1 -1
- package/dist/index89.mjs +35 -35
- package/dist/index9.mjs +240 -99
- package/dist/index90.mjs +1 -1
- package/dist/index91.mjs +2 -2
- package/dist/index92.mjs +2 -2
- package/dist/index94.mjs +2 -235
- package/dist/index95.mjs +233 -4
- package/dist/index96.mjs +5 -133
- package/dist/index97.mjs +129 -63
- package/dist/index98.mjs +67 -86
- package/dist/index99.mjs +85 -27
- package/dist/providers/StorefrontProvider.d.ts +3 -1
- package/dist/providers/StorefrontProvider.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
- package/src/components/AssistantDrawer.stories.tsx +20 -91
- package/src/components/AssistantDrawer.tsx +5 -9
- package/src/components/ProductAssistantChips.stories.tsx +11 -6
- package/src/components/ProductAssistantChips.tsx +13 -8
- package/src/contexts/AssistantContext.tsx +62 -0
- package/src/index.ts +3 -2
- package/src/providers/StorefrontProvider.tsx +17 -2
- package/dist/components/SearchAssistantTrigger.d.ts +0 -12
- package/dist/components/SearchAssistantTrigger.d.ts.map +0 -1
- package/src/components/SearchAssistantTrigger.stories.tsx +0 -35
- package/src/components/SearchAssistantTrigger.tsx +0 -41
package/dist/index187.mjs
CHANGED
|
@@ -1,39 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
import { __require as d } from "./index250.mjs";
|
|
4
|
-
var o;
|
|
5
|
-
function p() {
|
|
6
|
-
return o ? n : (o = 1, function(i) {
|
|
7
|
-
Object.defineProperty(i, "__esModule", {
|
|
8
|
-
value: !0
|
|
9
|
-
}), Object.defineProperty(i, "getPathMatch", {
|
|
10
|
-
enumerable: !0,
|
|
11
|
-
get: function() {
|
|
12
|
-
return s;
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
const u = d();
|
|
16
|
-
function s(l, e) {
|
|
17
|
-
const r = [], t = (0, u.pathToRegexp)(l, r, {
|
|
18
|
-
delimiter: "/",
|
|
19
|
-
sensitive: typeof (e == null ? void 0 : e.sensitive) == "boolean" ? e.sensitive : !1,
|
|
20
|
-
strict: e == null ? void 0 : e.strict
|
|
21
|
-
}), h = (0, u.regexpToFunction)(e != null && e.regexModifier ? new RegExp(e.regexModifier(t.source), t.flags) : t, r);
|
|
22
|
-
return (f, m) => {
|
|
23
|
-
if (typeof f != "string") return !1;
|
|
24
|
-
const a = h(f);
|
|
25
|
-
if (!a) return !1;
|
|
26
|
-
if (e != null && e.removeUnnamedParams)
|
|
27
|
-
for (const c of r)
|
|
28
|
-
typeof c.name == "number" && delete a.params[c.name];
|
|
29
|
-
return {
|
|
30
|
-
...m,
|
|
31
|
-
...a.params
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
}(n), n);
|
|
36
|
-
}
|
|
2
|
+
var e = {};
|
|
37
3
|
export {
|
|
38
|
-
|
|
4
|
+
e as __exports
|
|
39
5
|
};
|
package/dist/index188.mjs
CHANGED
|
@@ -1,155 +1,39 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { __exports as
|
|
3
|
-
import { __require as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { __require as v } from "./index254.mjs";
|
|
9
|
-
var S;
|
|
10
|
-
function W() {
|
|
11
|
-
return S ? A : (S = 1, function(R) {
|
|
12
|
-
Object.defineProperty(R, "__esModule", {
|
|
2
|
+
import { __exports as n } from "./index236.mjs";
|
|
3
|
+
import { __require as d } from "./index237.mjs";
|
|
4
|
+
var o;
|
|
5
|
+
function p() {
|
|
6
|
+
return o ? n : (o = 1, function(i) {
|
|
7
|
+
Object.defineProperty(i, "__esModule", {
|
|
13
8
|
value: !0
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
get: a[t]
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
k(R, {
|
|
22
|
-
compileNonPath: function() {
|
|
23
|
-
return d;
|
|
24
|
-
},
|
|
25
|
-
matchHas: function() {
|
|
26
|
-
return w;
|
|
27
|
-
},
|
|
28
|
-
prepareDestination: function() {
|
|
29
|
-
return M;
|
|
9
|
+
}), Object.defineProperty(i, "getPathMatch", {
|
|
10
|
+
enumerable: !0,
|
|
11
|
+
get: function() {
|
|
12
|
+
return s;
|
|
30
13
|
}
|
|
31
14
|
});
|
|
32
|
-
const
|
|
33
|
-
function
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const i = {}, f = (n) => {
|
|
51
|
-
let s, u = n.key;
|
|
52
|
-
switch (n.type) {
|
|
53
|
-
case "header": {
|
|
54
|
-
u = u.toLowerCase(), s = e.headers[u];
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
case "cookie": {
|
|
58
|
-
"cookies" in e ? s = e.cookies[n.key] : s = (0, D.getCookieParser)(e.headers)()[n.key];
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
case "query": {
|
|
62
|
-
s = a[u];
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
case "host": {
|
|
66
|
-
const { host: l } = (e == null ? void 0 : e.headers) || {};
|
|
67
|
-
s = l == null ? void 0 : l.split(":", 1)[0].toLowerCase();
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (!n.value && s)
|
|
72
|
-
return i[q(u)] = s, !0;
|
|
73
|
-
if (s) {
|
|
74
|
-
const l = new RegExp("^" + n.value + "$"), p = Array.isArray(s) ? s.slice(-1)[0].match(l) : s.match(l);
|
|
75
|
-
if (p)
|
|
76
|
-
return Array.isArray(p) && (p.groups ? Object.keys(p.groups).forEach((_) => {
|
|
77
|
-
i[_] = p.groups[_];
|
|
78
|
-
}) : n.type === "host" && p[0] && (i.host = p[0])), !0;
|
|
79
|
-
}
|
|
80
|
-
return !1;
|
|
81
|
-
};
|
|
82
|
-
return t.every((n) => f(n)) && !o.some((n) => f(n)) ? i : !1;
|
|
83
|
-
}
|
|
84
|
-
function d(e, a) {
|
|
85
|
-
if (!e.includes(":"))
|
|
86
|
-
return e;
|
|
87
|
-
for (const t of Object.keys(a))
|
|
88
|
-
e.includes(":" + t) && (e = e.replace(new RegExp(":" + t + "\\*", "g"), ":" + t + "--ESCAPED_PARAM_ASTERISKS").replace(new RegExp(":" + t + "\\?", "g"), ":" + t + "--ESCAPED_PARAM_QUESTION").replace(new RegExp(":" + t + "\\+", "g"), ":" + t + "--ESCAPED_PARAM_PLUS").replace(new RegExp(":" + t + "(?!\\w)", "g"), "--ESCAPED_PARAM_COLON" + t));
|
|
89
|
-
return e = e.replace(/(:|\*|\?|\+|\(|\)|\{|\})/g, "\\$1").replace(/--ESCAPED_PARAM_PLUS/g, "+").replace(/--ESCAPED_PARAM_COLON/g, ":").replace(/--ESCAPED_PARAM_QUESTION/g, "?").replace(/--ESCAPED_PARAM_ASTERISKS/g, "*"), (0, m.compile)("/" + e, {
|
|
90
|
-
validate: !1
|
|
91
|
-
})(a).slice(1);
|
|
92
|
-
}
|
|
93
|
-
function M(e) {
|
|
94
|
-
const a = Object.assign({}, e.query);
|
|
95
|
-
delete a.__nextLocale, delete a.__nextDefaultLocale, delete a.__nextDataReq, delete a.__nextInferredLocaleFromDefault, delete a[O.NEXT_RSC_UNION_QUERY];
|
|
96
|
-
let t = e.destination;
|
|
97
|
-
for (const r of Object.keys({
|
|
98
|
-
...e.params,
|
|
99
|
-
...a
|
|
100
|
-
}))
|
|
101
|
-
t = r ? b(t, r) : t;
|
|
102
|
-
const o = (0, x.parseUrl)(t), i = o.query, f = h("" + o.pathname + (o.hash || "")), E = h(o.hostname || ""), n = [], s = [];
|
|
103
|
-
(0, m.pathToRegexp)(f, n), (0, m.pathToRegexp)(E, s);
|
|
104
|
-
const u = [];
|
|
105
|
-
n.forEach((r) => u.push(r.name)), s.forEach((r) => u.push(r.name));
|
|
106
|
-
const l = (0, m.compile)(
|
|
107
|
-
f,
|
|
108
|
-
// we don't validate while compiling the destination since we should
|
|
109
|
-
// have already validated before we got to this point and validating
|
|
110
|
-
// breaks compiling destinations with named pattern params from the source
|
|
111
|
-
// e.g. /something:hello(.*) -> /another/:hello is broken with validation
|
|
112
|
-
// since compile validation is meant for reversing and not for inserting
|
|
113
|
-
// params from a separate path-regex into another
|
|
114
|
-
{
|
|
115
|
-
validate: !1
|
|
116
|
-
}
|
|
117
|
-
), p = (0, m.compile)(E, {
|
|
118
|
-
validate: !1
|
|
119
|
-
});
|
|
120
|
-
for (const [r, c] of Object.entries(i))
|
|
121
|
-
Array.isArray(c) ? i[r] = c.map((y) => d(h(y), e.params)) : typeof c == "string" && (i[r] = d(h(c), e.params));
|
|
122
|
-
let _ = Object.keys(e.params).filter((r) => r !== "nextInternalLocale");
|
|
123
|
-
if (e.appendParamsToQuery && !_.some((r) => u.includes(r)))
|
|
124
|
-
for (const r of _)
|
|
125
|
-
r in i || (i[r] = e.params[r]);
|
|
126
|
-
let P;
|
|
127
|
-
if ((0, g.isInterceptionRouteAppPath)(f))
|
|
128
|
-
for (const r of f.split("/")) {
|
|
129
|
-
const c = g.INTERCEPTION_ROUTE_MARKERS.find((y) => r.startsWith(y));
|
|
130
|
-
if (c) {
|
|
131
|
-
c === "(..)(..)" ? (e.params[0] = "(..)", e.params[1] = "(..)") : e.params[0] = c;
|
|
132
|
-
break;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
try {
|
|
136
|
-
P = l(e.params);
|
|
137
|
-
const [r, c] = P.split("#", 2);
|
|
138
|
-
o.hostname = p(e.params), o.pathname = r, o.hash = (c ? "#" : "") + (c || ""), delete o.search;
|
|
139
|
-
} catch (r) {
|
|
140
|
-
throw r.message.match(/Expected .*? to not repeat, but got an array/) ? new Error("To use a multi-match in the destination you must add `*` at the end of the param name to signify it should repeat. https://nextjs.org/docs/messages/invalid-multi-match") : r;
|
|
141
|
-
}
|
|
142
|
-
return o.query = {
|
|
143
|
-
...a,
|
|
144
|
-
...o.query
|
|
145
|
-
}, {
|
|
146
|
-
newUrl: P,
|
|
147
|
-
destQuery: i,
|
|
148
|
-
parsedDestination: o
|
|
15
|
+
const u = d();
|
|
16
|
+
function s(l, e) {
|
|
17
|
+
const r = [], t = (0, u.pathToRegexp)(l, r, {
|
|
18
|
+
delimiter: "/",
|
|
19
|
+
sensitive: typeof (e == null ? void 0 : e.sensitive) == "boolean" ? e.sensitive : !1,
|
|
20
|
+
strict: e == null ? void 0 : e.strict
|
|
21
|
+
}), h = (0, u.regexpToFunction)(e != null && e.regexModifier ? new RegExp(e.regexModifier(t.source), t.flags) : t, r);
|
|
22
|
+
return (f, m) => {
|
|
23
|
+
if (typeof f != "string") return !1;
|
|
24
|
+
const a = h(f);
|
|
25
|
+
if (!a) return !1;
|
|
26
|
+
if (e != null && e.removeUnnamedParams)
|
|
27
|
+
for (const c of r)
|
|
28
|
+
typeof c.name == "number" && delete a.params[c.name];
|
|
29
|
+
return {
|
|
30
|
+
...m,
|
|
31
|
+
...a.params
|
|
32
|
+
};
|
|
149
33
|
};
|
|
150
34
|
}
|
|
151
|
-
}(
|
|
35
|
+
}(n), n);
|
|
152
36
|
}
|
|
153
37
|
export {
|
|
154
|
-
|
|
38
|
+
p as __require
|
|
155
39
|
};
|
package/dist/index189.mjs
CHANGED
|
@@ -1,5 +1,155 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
2
|
+
import { __exports as A } from "./index238.mjs";
|
|
3
|
+
import { __require as T } from "./index237.mjs";
|
|
4
|
+
import { __require as L } from "./index192.mjs";
|
|
5
|
+
import { __require as N } from "./index239.mjs";
|
|
6
|
+
import { __require as U } from "./index184.mjs";
|
|
7
|
+
import { __require as j } from "./index240.mjs";
|
|
8
|
+
import { __require as v } from "./index241.mjs";
|
|
9
|
+
var S;
|
|
10
|
+
function W() {
|
|
11
|
+
return S ? A : (S = 1, function(R) {
|
|
12
|
+
Object.defineProperty(R, "__esModule", {
|
|
13
|
+
value: !0
|
|
14
|
+
});
|
|
15
|
+
function k(e, a) {
|
|
16
|
+
for (var t in a) Object.defineProperty(e, t, {
|
|
17
|
+
enumerable: !0,
|
|
18
|
+
get: a[t]
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
k(R, {
|
|
22
|
+
compileNonPath: function() {
|
|
23
|
+
return d;
|
|
24
|
+
},
|
|
25
|
+
matchHas: function() {
|
|
26
|
+
return w;
|
|
27
|
+
},
|
|
28
|
+
prepareDestination: function() {
|
|
29
|
+
return M;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const m = T(), C = L(), x = N(), g = U(), O = j(), D = v();
|
|
33
|
+
function q(e) {
|
|
34
|
+
let a = "";
|
|
35
|
+
for (let t = 0; t < e.length; t++) {
|
|
36
|
+
const o = e.charCodeAt(t);
|
|
37
|
+
(o > 64 && o < 91 || // A-Z
|
|
38
|
+
o > 96 && o < 123) && (a += e[t]);
|
|
39
|
+
}
|
|
40
|
+
return a;
|
|
41
|
+
}
|
|
42
|
+
function b(e, a) {
|
|
43
|
+
return e.replace(new RegExp(":" + (0, C.escapeStringRegexp)(a), "g"), "__ESC_COLON_" + a);
|
|
44
|
+
}
|
|
45
|
+
function h(e) {
|
|
46
|
+
return e.replace(/__ESC_COLON_/gi, ":");
|
|
47
|
+
}
|
|
48
|
+
function w(e, a, t, o) {
|
|
49
|
+
t === void 0 && (t = []), o === void 0 && (o = []);
|
|
50
|
+
const i = {}, f = (n) => {
|
|
51
|
+
let s, u = n.key;
|
|
52
|
+
switch (n.type) {
|
|
53
|
+
case "header": {
|
|
54
|
+
u = u.toLowerCase(), s = e.headers[u];
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
case "cookie": {
|
|
58
|
+
"cookies" in e ? s = e.cookies[n.key] : s = (0, D.getCookieParser)(e.headers)()[n.key];
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
case "query": {
|
|
62
|
+
s = a[u];
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
case "host": {
|
|
66
|
+
const { host: l } = (e == null ? void 0 : e.headers) || {};
|
|
67
|
+
s = l == null ? void 0 : l.split(":", 1)[0].toLowerCase();
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (!n.value && s)
|
|
72
|
+
return i[q(u)] = s, !0;
|
|
73
|
+
if (s) {
|
|
74
|
+
const l = new RegExp("^" + n.value + "$"), p = Array.isArray(s) ? s.slice(-1)[0].match(l) : s.match(l);
|
|
75
|
+
if (p)
|
|
76
|
+
return Array.isArray(p) && (p.groups ? Object.keys(p.groups).forEach((_) => {
|
|
77
|
+
i[_] = p.groups[_];
|
|
78
|
+
}) : n.type === "host" && p[0] && (i.host = p[0])), !0;
|
|
79
|
+
}
|
|
80
|
+
return !1;
|
|
81
|
+
};
|
|
82
|
+
return t.every((n) => f(n)) && !o.some((n) => f(n)) ? i : !1;
|
|
83
|
+
}
|
|
84
|
+
function d(e, a) {
|
|
85
|
+
if (!e.includes(":"))
|
|
86
|
+
return e;
|
|
87
|
+
for (const t of Object.keys(a))
|
|
88
|
+
e.includes(":" + t) && (e = e.replace(new RegExp(":" + t + "\\*", "g"), ":" + t + "--ESCAPED_PARAM_ASTERISKS").replace(new RegExp(":" + t + "\\?", "g"), ":" + t + "--ESCAPED_PARAM_QUESTION").replace(new RegExp(":" + t + "\\+", "g"), ":" + t + "--ESCAPED_PARAM_PLUS").replace(new RegExp(":" + t + "(?!\\w)", "g"), "--ESCAPED_PARAM_COLON" + t));
|
|
89
|
+
return e = e.replace(/(:|\*|\?|\+|\(|\)|\{|\})/g, "\\$1").replace(/--ESCAPED_PARAM_PLUS/g, "+").replace(/--ESCAPED_PARAM_COLON/g, ":").replace(/--ESCAPED_PARAM_QUESTION/g, "?").replace(/--ESCAPED_PARAM_ASTERISKS/g, "*"), (0, m.compile)("/" + e, {
|
|
90
|
+
validate: !1
|
|
91
|
+
})(a).slice(1);
|
|
92
|
+
}
|
|
93
|
+
function M(e) {
|
|
94
|
+
const a = Object.assign({}, e.query);
|
|
95
|
+
delete a.__nextLocale, delete a.__nextDefaultLocale, delete a.__nextDataReq, delete a.__nextInferredLocaleFromDefault, delete a[O.NEXT_RSC_UNION_QUERY];
|
|
96
|
+
let t = e.destination;
|
|
97
|
+
for (const r of Object.keys({
|
|
98
|
+
...e.params,
|
|
99
|
+
...a
|
|
100
|
+
}))
|
|
101
|
+
t = r ? b(t, r) : t;
|
|
102
|
+
const o = (0, x.parseUrl)(t), i = o.query, f = h("" + o.pathname + (o.hash || "")), E = h(o.hostname || ""), n = [], s = [];
|
|
103
|
+
(0, m.pathToRegexp)(f, n), (0, m.pathToRegexp)(E, s);
|
|
104
|
+
const u = [];
|
|
105
|
+
n.forEach((r) => u.push(r.name)), s.forEach((r) => u.push(r.name));
|
|
106
|
+
const l = (0, m.compile)(
|
|
107
|
+
f,
|
|
108
|
+
// we don't validate while compiling the destination since we should
|
|
109
|
+
// have already validated before we got to this point and validating
|
|
110
|
+
// breaks compiling destinations with named pattern params from the source
|
|
111
|
+
// e.g. /something:hello(.*) -> /another/:hello is broken with validation
|
|
112
|
+
// since compile validation is meant for reversing and not for inserting
|
|
113
|
+
// params from a separate path-regex into another
|
|
114
|
+
{
|
|
115
|
+
validate: !1
|
|
116
|
+
}
|
|
117
|
+
), p = (0, m.compile)(E, {
|
|
118
|
+
validate: !1
|
|
119
|
+
});
|
|
120
|
+
for (const [r, c] of Object.entries(i))
|
|
121
|
+
Array.isArray(c) ? i[r] = c.map((y) => d(h(y), e.params)) : typeof c == "string" && (i[r] = d(h(c), e.params));
|
|
122
|
+
let _ = Object.keys(e.params).filter((r) => r !== "nextInternalLocale");
|
|
123
|
+
if (e.appendParamsToQuery && !_.some((r) => u.includes(r)))
|
|
124
|
+
for (const r of _)
|
|
125
|
+
r in i || (i[r] = e.params[r]);
|
|
126
|
+
let P;
|
|
127
|
+
if ((0, g.isInterceptionRouteAppPath)(f))
|
|
128
|
+
for (const r of f.split("/")) {
|
|
129
|
+
const c = g.INTERCEPTION_ROUTE_MARKERS.find((y) => r.startsWith(y));
|
|
130
|
+
if (c) {
|
|
131
|
+
c === "(..)(..)" ? (e.params[0] = "(..)", e.params[1] = "(..)") : e.params[0] = c;
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
P = l(e.params);
|
|
137
|
+
const [r, c] = P.split("#", 2);
|
|
138
|
+
o.hostname = p(e.params), o.pathname = r, o.hash = (c ? "#" : "") + (c || ""), delete o.search;
|
|
139
|
+
} catch (r) {
|
|
140
|
+
throw r.message.match(/Expected .*? to not repeat, but got an array/) ? new Error("To use a multi-match in the destination you must add `*` at the end of the param name to signify it should repeat. https://nextjs.org/docs/messages/invalid-multi-match") : r;
|
|
141
|
+
}
|
|
142
|
+
return o.query = {
|
|
143
|
+
...a,
|
|
144
|
+
...o.query
|
|
145
|
+
}, {
|
|
146
|
+
newUrl: P,
|
|
147
|
+
destQuery: i,
|
|
148
|
+
parsedDestination: o
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}(A), A);
|
|
152
|
+
}
|
|
3
153
|
export {
|
|
4
|
-
|
|
154
|
+
W as __require
|
|
5
155
|
};
|
package/dist/index19.mjs
CHANGED
|
@@ -1,101 +1,154 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useState as
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import { cn as
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
import { jsx as s, jsxs as l, Fragment as x } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as T, useState as c } from "react";
|
|
4
|
+
import "./index31.mjs";
|
|
5
|
+
import { useGetCartUpsellAddons as z } from "./index43.mjs";
|
|
6
|
+
import "@tanstack/react-query";
|
|
7
|
+
import { useCart as G } from "./index3.mjs";
|
|
8
|
+
import { cn as b, formatCurrency as w } from "./index30.mjs";
|
|
9
|
+
import { FreeShippingProgress as R } from "./index52.mjs";
|
|
10
|
+
import { Button as A } from "./index24.mjs";
|
|
11
|
+
import { Loader2 as C, Package as q, Check as B } from "lucide-react";
|
|
12
|
+
import { VariantPickerModal as D } from "./index14.mjs";
|
|
13
|
+
function ee({
|
|
14
|
+
onSkip: k,
|
|
15
|
+
className: P,
|
|
16
|
+
checkoutButtonClassName: F
|
|
15
17
|
}) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const { cart: o, addItem: I } = G(), { data: m, isLoading: M } = z(o == null ? void 0 : o.id), u = T(null);
|
|
19
|
+
m && !u.current && (u.current = m);
|
|
20
|
+
const f = u.current ?? m, [V, N] = c([]), [h, j] = c([]), [r, g] = c(null), [U, y] = c(!1), v = async (t, e, n) => {
|
|
21
|
+
N((i) => [...i, t.id]);
|
|
22
|
+
try {
|
|
23
|
+
const i = Math.round(e.price * (1 - n / 100));
|
|
24
|
+
await I(t.slug, t.name, i, e.sku, 1, !0, n), j((a) => [...a, t.id]);
|
|
25
|
+
} finally {
|
|
26
|
+
N((i) => i.filter((a) => a !== t.id));
|
|
27
|
+
}
|
|
28
|
+
}, L = (t, e) => {
|
|
29
|
+
if (t.variants.length > 1) {
|
|
30
|
+
g({ product: t, discountPercent: e });
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const n = t.variants[0];
|
|
34
|
+
n && v(t, n, e);
|
|
35
|
+
}, O = async (t, e) => {
|
|
36
|
+
if (r) {
|
|
37
|
+
y(!0);
|
|
20
38
|
try {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
39
|
+
let n = null, i = null;
|
|
40
|
+
for (const a of f || []) {
|
|
41
|
+
const d = a.addons.find((p) => p.id === t.id);
|
|
42
|
+
if (d) {
|
|
43
|
+
n = d, i = d.variants.find((p) => p.id === e.id);
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
n && i && await v(n, i, r.discountPercent), g(null);
|
|
24
48
|
} finally {
|
|
25
|
-
|
|
49
|
+
y(!1);
|
|
26
50
|
}
|
|
27
51
|
}
|
|
28
|
-
}, R = async () => {
|
|
29
|
-
x(!0), c("");
|
|
30
|
-
try {
|
|
31
|
-
await I(), o("Discount code removed"), setTimeout(() => o(""), 3e3), i == null || i();
|
|
32
|
-
} catch (t) {
|
|
33
|
-
c((t == null ? void 0 : t.message) || "Failed to remove discount code");
|
|
34
|
-
} finally {
|
|
35
|
-
x(!1);
|
|
36
|
-
}
|
|
37
52
|
};
|
|
38
|
-
|
|
39
|
-
/* @__PURE__ */ s("div", { className: "flex items-center
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
53
|
+
if (M)
|
|
54
|
+
return /* @__PURE__ */ s("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ s(C, { className: "h-8 w-8 animate-spin text-accent-500" }) });
|
|
55
|
+
const S = [];
|
|
56
|
+
for (const t of f || [])
|
|
57
|
+
for (const e of t.addons)
|
|
58
|
+
h.includes(e.id) || S.push({
|
|
59
|
+
product: t,
|
|
60
|
+
addon: e,
|
|
61
|
+
parentName: t.productName,
|
|
62
|
+
parentThumbnail: t.productThumbnailUrl
|
|
63
|
+
});
|
|
64
|
+
return /* @__PURE__ */ l(x, { children: [
|
|
65
|
+
/* @__PURE__ */ l("div", { className: b("flex flex-1 min-h-0 flex-col", P), children: [
|
|
66
|
+
/* @__PURE__ */ s(R, {}),
|
|
67
|
+
/* @__PURE__ */ l("div", { className: "flex-1 min-h-0 overflow-y-auto p-4", children: [
|
|
68
|
+
/* @__PURE__ */ l("div", { className: "text-center mb-4", children: [
|
|
69
|
+
/* @__PURE__ */ s("h3", { className: "text-lg font-semibold text-gray-900", children: "Exclusive deals for you" }),
|
|
70
|
+
/* @__PURE__ */ s("p", { className: "text-sm text-gray-500 mt-1", children: "Get these items at a special discount before checkout" })
|
|
71
|
+
] }),
|
|
72
|
+
/* @__PURE__ */ s("div", { className: "grid grid-cols-2 gap-3", children: (f || []).flatMap(
|
|
73
|
+
(t) => t.addons.map((e) => {
|
|
74
|
+
const n = e.variants[0];
|
|
75
|
+
if (!n) return null;
|
|
76
|
+
const i = V.includes(e.id), a = h.includes(e.id), d = Math.round(n.price * (1 - e.discountPercent / 100));
|
|
77
|
+
return /* @__PURE__ */ l(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
className: "flex flex-col bg-white border border-gray-200 rounded-lg overflow-hidden",
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ l("div", { className: "relative aspect-square bg-gray-100 overflow-hidden", children: [
|
|
83
|
+
e.thumbnailUrl ? /* @__PURE__ */ s(
|
|
84
|
+
"img",
|
|
85
|
+
{
|
|
86
|
+
src: e.thumbnailUrl,
|
|
87
|
+
alt: e.name,
|
|
88
|
+
className: "absolute inset-0 w-full h-full object-cover"
|
|
89
|
+
}
|
|
90
|
+
) : /* @__PURE__ */ s("div", { className: "absolute inset-0 w-full h-full flex items-center justify-center", children: /* @__PURE__ */ s(q, { className: "h-8 w-8 text-gray-300" }) }),
|
|
91
|
+
/* @__PURE__ */ l("div", { className: "absolute top-1 left-1 bg-red-500 text-white text-xs font-bold px-1.5 py-0.5 rounded", children: [
|
|
92
|
+
e.discountPercent,
|
|
93
|
+
"% OFF"
|
|
94
|
+
] })
|
|
95
|
+
] }),
|
|
96
|
+
/* @__PURE__ */ l("div", { className: "p-2 flex flex-col flex-1", children: [
|
|
97
|
+
/* @__PURE__ */ s("h4", { className: "text-xs font-medium text-gray-900 line-clamp-2 leading-tight min-h-[2.5em]", children: e.name }),
|
|
98
|
+
/* @__PURE__ */ l("div", { className: "mt-1", children: [
|
|
99
|
+
/* @__PURE__ */ s("span", { className: "text-xs text-gray-400 line-through mr-1", children: w(n.price) }),
|
|
100
|
+
/* @__PURE__ */ s("span", { className: "text-sm font-bold text-red-600", children: w(d) })
|
|
101
|
+
] }),
|
|
102
|
+
/* @__PURE__ */ s(
|
|
103
|
+
A,
|
|
104
|
+
{
|
|
105
|
+
size: "sm",
|
|
106
|
+
onClick: () => L(e, e.discountPercent),
|
|
107
|
+
disabled: i || a,
|
|
108
|
+
className: b(
|
|
109
|
+
"w-full text-xs h-7 mt-2",
|
|
110
|
+
a ? "bg-green-500 hover:bg-green-500 text-white !opacity-100" : "bg-red-500 hover:bg-red-600 text-white"
|
|
111
|
+
),
|
|
112
|
+
children: i ? /* @__PURE__ */ l(x, { children: [
|
|
113
|
+
/* @__PURE__ */ s(C, { className: "h-3 w-3 animate-spin" }),
|
|
114
|
+
"Adding..."
|
|
115
|
+
] }) : a ? /* @__PURE__ */ l(x, { children: [
|
|
116
|
+
/* @__PURE__ */ s(B, { className: "h-3 w-3" }),
|
|
117
|
+
"Added"
|
|
118
|
+
] }) : "Add"
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
] })
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
e.id
|
|
125
|
+
);
|
|
126
|
+
})
|
|
127
|
+
) })
|
|
48
128
|
] }),
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
|
|
51
|
-
{
|
|
52
|
-
variant: "ghost",
|
|
53
|
-
size: "sm",
|
|
54
|
-
onClick: R,
|
|
55
|
-
disabled: h,
|
|
56
|
-
className: "h-8 px-2 text-green-700 hover:text-green-800",
|
|
57
|
-
children: h ? "Removing..." : /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(E, { className: "h-4 w-4" }) })
|
|
58
|
-
}
|
|
59
|
-
)
|
|
60
|
-
] }),
|
|
61
|
-
!((v = r == null ? void 0 : r.pricing) != null && v.discount) && /* @__PURE__ */ s("form", { onSubmit: M, className: "flex gap-2", children: [
|
|
62
|
-
/* @__PURE__ */ e(
|
|
63
|
-
"input",
|
|
129
|
+
/* @__PURE__ */ s("div", { className: "border-t border-gray-300 bg-white px-4 py-3", children: /* @__PURE__ */ s(
|
|
130
|
+
A,
|
|
64
131
|
{
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
disabled: l,
|
|
70
|
-
className: p(
|
|
71
|
-
"flex-1 rounded-md border border-gray-300 px-3 py-2 text-sm",
|
|
72
|
-
"focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50",
|
|
73
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
74
|
-
d && "border-red-500 focus:border-red-500 focus:ring-red-500",
|
|
75
|
-
C
|
|
76
|
-
)
|
|
132
|
+
onClick: k,
|
|
133
|
+
className: b("w-full bg-accent-500 text-white hover:bg-accent-600", F),
|
|
134
|
+
size: "lg",
|
|
135
|
+
children: h.length > 0 ? "Continue to checkout" : "No thanks, continue to checkout"
|
|
77
136
|
}
|
|
78
|
-
)
|
|
79
|
-
/* @__PURE__ */ e(
|
|
80
|
-
y,
|
|
81
|
-
{
|
|
82
|
-
type: "submit",
|
|
83
|
-
disabled: !n.trim() || l,
|
|
84
|
-
className: p("bg-accent-500 text-white hover:bg-accent-600", A),
|
|
85
|
-
children: l ? "Applying..." : "Apply"
|
|
86
|
-
}
|
|
87
|
-
)
|
|
137
|
+
) })
|
|
88
138
|
] }),
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
139
|
+
/* @__PURE__ */ s(
|
|
140
|
+
D,
|
|
141
|
+
{
|
|
142
|
+
isOpen: !!r,
|
|
143
|
+
onClose: () => g(null),
|
|
144
|
+
product: (r == null ? void 0 : r.product) || null,
|
|
145
|
+
onConfirm: O,
|
|
146
|
+
isLoading: U,
|
|
147
|
+
discountPercent: r == null ? void 0 : r.discountPercent
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
] });
|
|
98
151
|
}
|
|
99
152
|
export {
|
|
100
|
-
|
|
153
|
+
ee as AddOnsDiscountScreen
|
|
101
154
|
};
|
package/dist/index190.mjs
CHANGED
package/dist/index191.mjs
CHANGED
|
@@ -1,22 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
var n;
|
|
4
|
-
function i() {
|
|
5
|
-
return n ? r : (n = 1, function(t) {
|
|
6
|
-
Object.defineProperty(t, "__esModule", {
|
|
7
|
-
value: !0
|
|
8
|
-
}), Object.defineProperty(t, "escapeStringRegexp", {
|
|
9
|
-
enumerable: !0,
|
|
10
|
-
get: function() {
|
|
11
|
-
return c;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
const p = /[|\\{}()[\]^$+*?.-]/, u = /[|\\{}()[\]^$+*?.-]/g;
|
|
15
|
-
function c(e) {
|
|
16
|
-
return p.test(e) ? e.replace(u, "\\$&") : e;
|
|
17
|
-
}
|
|
18
|
-
}(r), r);
|
|
19
|
-
}
|
|
2
|
+
var e = {};
|
|
20
3
|
export {
|
|
21
|
-
|
|
4
|
+
e as __exports
|
|
22
5
|
};
|