@instockng/storefront-ui 1.0.27 → 1.0.29
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/Checkout.d.ts.map +1 -1
- package/dist/components/ShoppingCart.d.ts +3 -1
- package/dist/components/ShoppingCart.d.ts.map +1 -1
- package/dist/contexts/CartContext.d.ts.map +1 -1
- package/dist/index10.mjs +39 -38
- package/dist/index100.mjs +13 -15
- package/dist/index101.mjs +16 -27
- package/dist/index102.mjs +26 -20
- package/dist/index103.mjs +151 -14
- package/dist/index104.mjs +13 -14
- package/dist/index105.mjs +23 -39
- package/dist/index106.mjs +76 -15
- package/dist/index107.mjs +33 -263
- package/dist/index108.mjs +138 -63
- package/dist/index109.mjs +54 -7
- package/dist/index110.mjs +23 -2
- package/dist/index111.mjs +27 -2
- package/dist/index112.mjs +19 -29
- package/dist/index113.mjs +25 -2
- package/dist/index114.mjs +18 -232
- package/dist/index115.mjs +21 -5
- package/dist/index116.mjs +17 -130
- package/dist/index117.mjs +64 -67
- package/dist/index118.mjs +16 -85
- package/dist/index119.mjs +38 -28
- package/dist/index12.mjs +171 -167
- package/dist/index120.mjs +23 -8
- package/dist/index121.mjs +31 -72
- package/dist/index122.mjs +26 -3
- package/dist/index123.mjs +19 -2
- package/dist/index124.mjs +19 -81
- package/dist/index125.mjs +46 -53
- package/dist/index126.mjs +22 -5
- package/dist/index127.mjs +267 -4
- package/dist/index128.mjs +62 -171
- package/dist/index129.mjs +8 -53
- package/dist/index130.mjs +2 -69
- package/dist/index131.mjs +2 -34
- package/dist/index132.mjs +32 -42
- package/dist/index133.mjs +2 -2
- package/dist/index134.mjs +21 -2
- package/dist/index135.mjs +56 -2
- package/dist/index136.mjs +29 -2
- package/dist/index137.mjs +7 -2
- package/dist/index138.mjs +50 -16
- package/dist/index139.mjs +6 -32
- package/dist/index140.mjs +11 -37
- package/dist/index141.mjs +7 -18
- package/dist/index142.mjs +28 -18
- package/dist/index143.mjs +2 -2
- package/dist/index144.mjs +70 -20
- package/dist/index145.mjs +163 -42
- package/dist/index147.mjs +2 -30
- package/dist/index148.mjs +2 -18
- package/dist/index149.mjs +2 -2
- package/dist/index150.mjs +18 -2
- package/dist/index151.mjs +32 -2
- package/dist/index152.mjs +38 -2
- package/dist/index153.mjs +13 -67
- package/dist/index154.mjs +18 -2
- package/dist/index155.mjs +2 -53
- package/dist/index156.mjs +20 -2
- package/dist/index157.mjs +39 -29
- package/dist/index158.mjs +2 -152
- package/dist/index159.mjs +30 -2
- package/dist/index160.mjs +18 -2
- package/dist/index161.mjs +2 -19
- package/dist/index162.mjs +2 -2
- package/dist/index163.mjs +2 -2
- package/dist/index164.mjs +2 -26
- package/dist/index165.mjs +72 -2
- package/dist/index166.mjs +2 -2
- package/dist/index167.mjs +49 -20
- package/dist/index168.mjs +2 -23
- package/dist/index169.mjs +36 -2
- package/dist/index170.mjs +152 -2
- package/dist/index171.mjs +2 -2
- package/dist/index172.mjs +2 -23
- package/dist/index173.mjs +19 -2
- package/dist/index174.mjs +2 -23
- package/dist/index176.mjs +26 -2
- package/dist/index177.mjs +2 -2
- package/dist/index178.mjs +2 -23
- package/dist/index179.mjs +24 -2
- package/dist/index180.mjs +15 -15
- package/dist/index181.mjs +2 -2
- package/dist/index182.mjs +2 -2
- package/dist/index183.mjs +2 -2
- package/dist/index184.mjs +23 -2
- package/dist/index185.mjs +2 -2
- package/dist/index186.mjs +23 -2
- package/dist/index187.mjs +2 -2
- package/dist/index188.mjs +2 -2
- package/dist/index189.mjs +2 -127
- package/dist/index19.mjs +26 -13
- package/dist/index190.mjs +23 -2
- package/dist/index191.mjs +2 -74
- package/dist/index192.mjs +20 -71
- package/dist/index193.mjs +2 -21
- package/dist/index194.mjs +2 -56
- package/dist/index195.mjs +2 -29
- package/dist/index196.mjs +2 -7
- package/dist/index197.mjs +2 -52
- package/dist/index198.mjs +2 -6
- package/dist/index199.mjs +2 -12
- package/dist/index200.mjs +2 -7
- package/dist/index201.mjs +127 -28
- package/dist/index202.mjs +2 -2
- package/dist/index203.mjs +73 -69
- package/dist/index204.mjs +71 -164
- package/dist/index205.mjs +31 -2
- package/dist/index206.mjs +11 -2
- package/dist/index207.mjs +4 -2
- package/dist/index208.mjs +4 -2
- package/dist/index209.mjs +13 -108
- package/dist/index210.mjs +7 -2
- package/dist/index211.mjs +12 -2
- package/dist/index212.mjs +5 -2
- package/dist/index213.mjs +33 -2
- package/dist/index214.mjs +31 -2
- package/dist/index215.mjs +28 -2
- package/dist/index216.mjs +61 -2
- package/dist/index217.mjs +2 -244
- package/dist/index218.mjs +2 -2
- package/dist/index219.mjs +2 -33
- package/dist/index220.mjs +2 -65
- package/dist/index221.mjs +2 -25
- package/dist/index223.mjs +2 -37
- package/dist/index225.mjs +37 -2
- package/dist/index226.mjs +2 -2
- package/dist/index227.mjs +108 -2
- package/dist/index229.mjs +2 -2
- package/dist/index232.mjs +244 -2
- package/dist/index233.mjs +2 -4
- package/dist/index234.mjs +33 -2
- package/dist/index235.mjs +65 -2
- package/dist/index236.mjs +25 -13
- package/dist/index237.mjs +2 -7
- package/dist/index238.mjs +2 -31
- package/dist/index239.mjs +2 -11
- package/dist/index240.mjs +2 -4
- package/dist/index241.mjs +2 -4
- package/dist/index242.mjs +2 -12
- package/dist/index243.mjs +2 -5
- package/dist/index244.mjs +2 -33
- package/dist/index245.mjs +2 -31
- package/dist/index246.mjs +2 -28
- package/dist/index247.mjs +4 -61
- package/dist/index248.mjs +3 -2
- package/dist/index249.mjs +2 -2
- package/dist/index250.mjs +2 -2
- package/dist/index251.mjs +16 -17
- package/dist/index252.mjs +12 -46
- package/dist/index253.mjs +6 -2
- package/dist/index254.mjs +30 -2
- package/dist/index255.mjs +2 -2
- package/dist/index256.mjs +16 -89
- package/dist/index257.mjs +47 -2
- package/dist/index258.mjs +2 -3
- package/dist/index259.mjs +2 -2
- package/dist/index260.mjs +2 -2
- package/dist/index261.mjs +2 -17
- package/dist/index262.mjs +2 -13
- package/dist/index263.mjs +91 -6
- package/dist/index264.mjs +2 -30
- package/dist/index3.mjs +95 -105
- package/dist/index32.mjs +1 -1
- package/dist/index33.mjs +1 -1
- package/dist/index34.mjs +1 -1
- package/dist/index35.mjs +1 -1
- package/dist/index36.mjs +1 -1
- package/dist/index37.mjs +1 -1
- package/dist/index38.mjs +2 -2
- package/dist/index39.mjs +3 -3
- package/dist/index42.mjs +1 -1
- package/dist/index47.mjs +17 -17
- package/dist/index48.mjs +2 -2
- package/dist/index49.mjs +1 -1
- package/dist/index50.mjs +1 -1
- package/dist/index51.mjs +1 -1
- package/dist/index52.mjs +1 -1
- package/dist/index53.mjs +1 -1
- package/dist/index54.mjs +1 -1
- package/dist/index55.mjs +1 -1
- package/dist/index56.mjs +1 -1
- package/dist/index57.mjs +1 -1
- package/dist/index58.mjs +1 -1
- package/dist/index59.mjs +1 -1
- package/dist/index60.mjs +20 -21
- package/dist/index61.mjs +21 -150
- package/dist/index63.mjs +149 -19
- package/dist/index64.mjs +4 -74
- package/dist/index65.mjs +74 -14
- package/dist/index66.mjs +14 -62
- package/dist/index67.mjs +62 -4
- package/dist/index70.mjs +35 -35
- package/dist/index71.mjs +1 -1
- package/dist/index72.mjs +2 -2
- package/dist/index73.mjs +2 -2
- package/dist/index75.mjs +235 -2
- package/dist/index76.mjs +5 -27
- package/dist/index77.mjs +130 -14
- package/dist/index78.mjs +67 -214
- package/dist/index79.mjs +82 -175
- package/dist/index80.mjs +28 -21
- package/dist/index81.mjs +8 -22
- package/dist/index82.mjs +72 -30
- package/dist/index83.mjs +3 -155
- package/dist/index84.mjs +2 -20
- package/dist/index85.mjs +81 -29
- package/dist/index86.mjs +53 -83
- package/dist/index87.mjs +5 -37
- package/dist/index88.mjs +4 -144
- package/dist/index89.mjs +173 -49
- package/dist/index90.mjs +53 -23
- package/dist/index91.mjs +69 -27
- package/dist/index92.mjs +34 -23
- package/dist/index93.mjs +42 -24
- package/dist/index94.mjs +2 -21
- package/dist/index95.mjs +2 -22
- package/dist/index96.mjs +26 -19
- package/dist/index97.mjs +11 -58
- package/dist/index98.mjs +210 -13
- package/dist/index99.mjs +173 -32
- package/dist/lib/utils.d.ts +8 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Checkout.tsx +11 -1
- package/src/components/ShoppingCart.tsx +5 -2
- package/src/contexts/CartContext.tsx +2 -20
- package/src/lib/utils.ts +20 -0
package/dist/index99.mjs
CHANGED
|
@@ -1,42 +1,183 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { __require as
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { __module as L } from "./index155.mjs";
|
|
3
|
+
import "./index69.mjs";
|
|
4
|
+
import { __require as K } from "./index96.mjs";
|
|
5
|
+
import F from "react/jsx-runtime";
|
|
6
|
+
import J from "react-dom";
|
|
7
|
+
import N from "react";
|
|
8
|
+
import { __require as B } from "./index156.mjs";
|
|
9
|
+
import { __require as D } from "./index157.mjs";
|
|
10
|
+
import { __require as G } from "./index152.mjs";
|
|
11
|
+
import { __exports as Q } from "./index74.mjs";
|
|
12
|
+
var w;
|
|
13
|
+
function ie() {
|
|
14
|
+
return w ? L.exports : (w = 1, function(x, o) {
|
|
15
|
+
"use client";
|
|
16
|
+
Object.defineProperty(o, "__esModule", {
|
|
10
17
|
value: !0
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
});
|
|
19
|
+
function M(t, e) {
|
|
20
|
+
for (var n in e) Object.defineProperty(t, n, {
|
|
21
|
+
enumerable: !0,
|
|
22
|
+
get: e[n]
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
M(o, {
|
|
26
|
+
default: function() {
|
|
27
|
+
return z;
|
|
28
|
+
},
|
|
29
|
+
handleClientScriptLoad: function() {
|
|
30
|
+
return C;
|
|
31
|
+
},
|
|
32
|
+
initScriptLoader: function() {
|
|
33
|
+
return $;
|
|
15
34
|
}
|
|
16
35
|
});
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
|
|
36
|
+
const j = Q, P = K(), O = F, h = /* @__PURE__ */ j._(J), g = /* @__PURE__ */ P._(N), R = B(), k = D(), I = G(), v = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Set(), A = (t) => {
|
|
37
|
+
if (h.default.preinit) {
|
|
38
|
+
t.forEach((e) => {
|
|
39
|
+
h.default.preinit(e, {
|
|
40
|
+
as: "style"
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (typeof window < "u") {
|
|
46
|
+
let e = document.head;
|
|
47
|
+
t.forEach((n) => {
|
|
48
|
+
let s = document.createElement("link");
|
|
49
|
+
s.type = "text/css", s.rel = "stylesheet", s.href = n, e.appendChild(s);
|
|
50
|
+
});
|
|
29
51
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
52
|
+
}, y = (t) => {
|
|
53
|
+
const { src: e, id: n, onLoad: s = () => {
|
|
54
|
+
}, onReady: l = null, dangerouslySetInnerHTML: i, children: _ = "", strategy: S = "afterInteractive", onError: r, stylesheets: q } = t, c = n || e;
|
|
55
|
+
if (c && p.has(c))
|
|
56
|
+
return;
|
|
57
|
+
if (v.has(e)) {
|
|
58
|
+
p.add(c), v.get(e).then(s, r);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const d = () => {
|
|
62
|
+
l && l(), p.add(c);
|
|
63
|
+
}, a = document.createElement("script"), u = new Promise((m, b) => {
|
|
64
|
+
a.addEventListener("load", function(f) {
|
|
65
|
+
m(), s && s.call(this, f), d();
|
|
66
|
+
}), a.addEventListener("error", function(f) {
|
|
67
|
+
b(f);
|
|
68
|
+
});
|
|
69
|
+
}).catch(function(m) {
|
|
70
|
+
r && r(m);
|
|
71
|
+
});
|
|
72
|
+
i ? (a.innerHTML = i.__html || "", d()) : _ ? (a.textContent = typeof _ == "string" ? _ : Array.isArray(_) ? _.join("") : "", d()) : e && (a.src = e, v.set(e, u)), (0, k.setAttributesFromProps)(a, t), S === "worker" && a.setAttribute("type", "text/partytown"), a.setAttribute("data-nscript", S), q && A(q), document.body.appendChild(a);
|
|
73
|
+
};
|
|
74
|
+
function C(t) {
|
|
75
|
+
const { strategy: e = "afterInteractive" } = t;
|
|
76
|
+
e === "lazyOnload" ? window.addEventListener("load", () => {
|
|
77
|
+
(0, I.requestIdleCallback)(() => y(t));
|
|
78
|
+
}) : y(t);
|
|
79
|
+
}
|
|
80
|
+
function H(t) {
|
|
81
|
+
document.readyState === "complete" ? (0, I.requestIdleCallback)(() => y(t)) : window.addEventListener("load", () => {
|
|
82
|
+
(0, I.requestIdleCallback)(() => y(t));
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function T() {
|
|
86
|
+
[
|
|
87
|
+
...document.querySelectorAll('[data-nscript="beforeInteractive"]'),
|
|
88
|
+
...document.querySelectorAll('[data-nscript="beforePageRender"]')
|
|
89
|
+
].forEach((e) => {
|
|
90
|
+
const n = e.id || e.getAttribute("src");
|
|
91
|
+
p.add(n);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function $(t) {
|
|
95
|
+
t.forEach(C), T();
|
|
96
|
+
}
|
|
97
|
+
function E(t) {
|
|
98
|
+
const { id: e, src: n = "", onLoad: s = () => {
|
|
99
|
+
}, onReady: l = null, strategy: i = "afterInteractive", onError: _, stylesheets: S, ...r } = t, { updateScripts: q, scripts: c, getIsSsr: d, appDir: a, nonce: u } = (0, g.useContext)(R.HeadManagerContext), m = (0, g.useRef)(!1);
|
|
100
|
+
(0, g.useEffect)(() => {
|
|
101
|
+
const f = e || n;
|
|
102
|
+
m.current || (l && f && p.has(f) && l(), m.current = !0);
|
|
103
|
+
}, [
|
|
104
|
+
l,
|
|
105
|
+
e,
|
|
106
|
+
n
|
|
107
|
+
]);
|
|
108
|
+
const b = (0, g.useRef)(!1);
|
|
109
|
+
if ((0, g.useEffect)(() => {
|
|
110
|
+
b.current || (i === "afterInteractive" ? y(t) : i === "lazyOnload" && H(t), b.current = !0);
|
|
111
|
+
}, [
|
|
112
|
+
t,
|
|
113
|
+
i
|
|
114
|
+
]), (i === "beforeInteractive" || i === "worker") && (q ? (c[i] = (c[i] || []).concat([
|
|
115
|
+
{
|
|
116
|
+
id: e,
|
|
117
|
+
src: n,
|
|
118
|
+
onLoad: s,
|
|
119
|
+
onReady: l,
|
|
120
|
+
onError: _,
|
|
121
|
+
...r
|
|
122
|
+
}
|
|
123
|
+
]), q(c)) : d && d() ? p.add(e || n) : d && !d() && y(t)), a) {
|
|
124
|
+
if (S && S.forEach((f) => {
|
|
125
|
+
h.default.preinit(f, {
|
|
126
|
+
as: "style"
|
|
127
|
+
});
|
|
128
|
+
}), i === "beforeInteractive")
|
|
129
|
+
return n ? (h.default.preload(n, r.integrity ? {
|
|
130
|
+
as: "script",
|
|
131
|
+
integrity: r.integrity,
|
|
132
|
+
nonce: u,
|
|
133
|
+
crossOrigin: r.crossOrigin
|
|
134
|
+
} : {
|
|
135
|
+
as: "script",
|
|
136
|
+
nonce: u,
|
|
137
|
+
crossOrigin: r.crossOrigin
|
|
138
|
+
}), /* @__PURE__ */ (0, O.jsx)("script", {
|
|
139
|
+
nonce: u,
|
|
140
|
+
dangerouslySetInnerHTML: {
|
|
141
|
+
__html: "(self.__next_s=self.__next_s||[]).push(" + JSON.stringify([
|
|
142
|
+
n,
|
|
143
|
+
{
|
|
144
|
+
...r,
|
|
145
|
+
id: e
|
|
146
|
+
}
|
|
147
|
+
]) + ")"
|
|
148
|
+
}
|
|
149
|
+
})) : (r.dangerouslySetInnerHTML && (r.children = r.dangerouslySetInnerHTML.__html, delete r.dangerouslySetInnerHTML), /* @__PURE__ */ (0, O.jsx)("script", {
|
|
150
|
+
nonce: u,
|
|
151
|
+
dangerouslySetInnerHTML: {
|
|
152
|
+
__html: "(self.__next_s=self.__next_s||[]).push(" + JSON.stringify([
|
|
153
|
+
0,
|
|
154
|
+
{
|
|
155
|
+
...r,
|
|
156
|
+
id: e
|
|
157
|
+
}
|
|
158
|
+
]) + ")"
|
|
159
|
+
}
|
|
160
|
+
}));
|
|
161
|
+
i === "afterInteractive" && n && h.default.preload(n, r.integrity ? {
|
|
162
|
+
as: "script",
|
|
163
|
+
integrity: r.integrity,
|
|
164
|
+
nonce: u,
|
|
165
|
+
crossOrigin: r.crossOrigin
|
|
166
|
+
} : {
|
|
167
|
+
as: "script",
|
|
168
|
+
nonce: u,
|
|
169
|
+
crossOrigin: r.crossOrigin
|
|
170
|
+
});
|
|
35
171
|
}
|
|
36
|
-
return
|
|
172
|
+
return null;
|
|
37
173
|
}
|
|
38
|
-
|
|
174
|
+
Object.defineProperty(E, "__nextScript", {
|
|
175
|
+
value: !0
|
|
176
|
+
});
|
|
177
|
+
const z = E;
|
|
178
|
+
(typeof o.default == "function" || typeof o.default == "object" && o.default !== null) && typeof o.default.__esModule > "u" && (Object.defineProperty(o.default, "__esModule", { value: !0 }), Object.assign(o.default, o), x.exports = o.default);
|
|
179
|
+
}(L, L.exports), L.exports);
|
|
39
180
|
}
|
|
40
181
|
export {
|
|
41
|
-
|
|
182
|
+
ie as __require
|
|
42
183
|
};
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -4,4 +4,12 @@ export declare function formatCurrency(amount: number): string;
|
|
|
4
4
|
export declare function formatDate(date: string | Date): string;
|
|
5
5
|
export declare function formatDateTime(date: string | Date): string;
|
|
6
6
|
export declare function getStatusColor(status: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Extract Facebook attribution cookies (fbc & fbp) for Meta Pixel CAPI
|
|
9
|
+
* @returns Object with fbc (Facebook Click ID) and fbp (Facebook Browser ID) cookies
|
|
10
|
+
*/
|
|
11
|
+
export declare function getFbCookies(): {
|
|
12
|
+
fbc: string | undefined;
|
|
13
|
+
fbp: string | undefined;
|
|
14
|
+
};
|
|
7
15
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAA;AAG5C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKrD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAOtD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAS1D;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAUrD"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAA;AAG5C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKrD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAOtD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAS1D;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAUrD;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI;IAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAcnF"}
|
package/package.json
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
CheckCircle,
|
|
29
29
|
Package,
|
|
30
30
|
} from 'lucide-react';
|
|
31
|
-
import { formatCurrency, cn } from '../lib/utils';
|
|
31
|
+
import { formatCurrency, cn, getFbCookies } from '../lib/utils';
|
|
32
32
|
import PaystackSVG from "../paystack.svg"
|
|
33
33
|
import { usePaystackPayment } from '../hooks/usePaystackPayment';
|
|
34
34
|
|
|
@@ -155,6 +155,9 @@ export function Checkout({
|
|
|
155
155
|
onSuccess: async (response) => {
|
|
156
156
|
|
|
157
157
|
try {
|
|
158
|
+
// Get Facebook attribution cookies for CAPI
|
|
159
|
+
const { fbc, fbp } = getFbCookies();
|
|
160
|
+
|
|
158
161
|
const order = await checkout.mutateAsync({
|
|
159
162
|
firstName: formData.firstName,
|
|
160
163
|
lastName: formData.lastName,
|
|
@@ -165,6 +168,8 @@ export function Checkout({
|
|
|
165
168
|
deliveryZoneId: selectedDeliveryZoneId || formData.deliveryZoneId,
|
|
166
169
|
paymentMethod: formData.paymentMethod,
|
|
167
170
|
paystackReference: response.reference,
|
|
171
|
+
fbc,
|
|
172
|
+
fbp,
|
|
168
173
|
});
|
|
169
174
|
|
|
170
175
|
// Check if response is an error
|
|
@@ -419,6 +424,9 @@ export function Checkout({
|
|
|
419
424
|
|
|
420
425
|
// For COD payment, proceed directly with checkout
|
|
421
426
|
try {
|
|
427
|
+
// Get Facebook attribution cookies for CAPI
|
|
428
|
+
const { fbc, fbp } = getFbCookies();
|
|
429
|
+
|
|
422
430
|
const order = await checkout.mutateAsync({
|
|
423
431
|
firstName: formData.firstName,
|
|
424
432
|
lastName: formData.lastName,
|
|
@@ -428,6 +436,8 @@ export function Checkout({
|
|
|
428
436
|
city: formData.city,
|
|
429
437
|
deliveryZoneId: selectedDeliveryZoneId || formData.deliveryZoneId,
|
|
430
438
|
paymentMethod: formData.paymentMethod,
|
|
439
|
+
fbc,
|
|
440
|
+
fbp,
|
|
431
441
|
});
|
|
432
442
|
|
|
433
443
|
// Check if response is an error
|
|
@@ -29,6 +29,8 @@ export interface ShoppingCartProps {
|
|
|
29
29
|
className?: string;
|
|
30
30
|
/** Show discount code input */
|
|
31
31
|
showDiscountCode?: boolean;
|
|
32
|
+
/** Show continue shopping button */
|
|
33
|
+
showContinueShopping?: boolean;
|
|
32
34
|
/** Checkout button text */
|
|
33
35
|
checkoutButtonText?: string;
|
|
34
36
|
/** Continue shopping button text */
|
|
@@ -50,6 +52,7 @@ export function ShoppingCart({
|
|
|
50
52
|
onContinueShopping,
|
|
51
53
|
className,
|
|
52
54
|
showDiscountCode = true,
|
|
55
|
+
showContinueShopping = true,
|
|
53
56
|
checkoutButtonText = 'Complete Purchase',
|
|
54
57
|
continueShoppingText = 'Continue Shopping',
|
|
55
58
|
checkoutButtonClassName,
|
|
@@ -240,14 +243,14 @@ export function ShoppingCart({
|
|
|
240
243
|
<Package className="h-5 w-5" />
|
|
241
244
|
{checkoutButtonText}
|
|
242
245
|
</Button>
|
|
243
|
-
<Button
|
|
246
|
+
{showContinueShopping && <Button
|
|
244
247
|
onClick={handleContinueShopping}
|
|
245
248
|
variant="outline"
|
|
246
249
|
className={cn('w-full border-gray-300 text-gray-600 hover:bg-gray-100', continueShoppingButtonClassName)}
|
|
247
250
|
size="lg"
|
|
248
251
|
>
|
|
249
252
|
{continueShoppingText}
|
|
250
|
-
</Button>
|
|
253
|
+
</Button>}
|
|
251
254
|
</div>
|
|
252
255
|
</div>
|
|
253
256
|
</>
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
} from '@instockng/api-client';
|
|
24
24
|
import { ShoppingCart } from '../components/ShoppingCart';
|
|
25
25
|
import { useMetaPixel } from '../providers/MetaPixelProvider';
|
|
26
|
+
import { getFbCookies } from '../lib/utils';
|
|
26
27
|
|
|
27
28
|
const CART_ID_KEY = 'oms_cart_id';
|
|
28
29
|
|
|
@@ -96,25 +97,6 @@ export function CartProvider({ children, brandSlug, initialCartId, shoppingCartP
|
|
|
96
97
|
// Get Meta Pixel tracking methods
|
|
97
98
|
const { trackAddToCart, trackInitiateCheckout } = useMetaPixel();
|
|
98
99
|
|
|
99
|
-
/**
|
|
100
|
-
* Extract fbc (Facebook Click ID) and fbp (Facebook Browser ID) cookies for attribution
|
|
101
|
-
*/
|
|
102
|
-
const getFbCookies = useCallback(() => {
|
|
103
|
-
if (typeof document === 'undefined') return { fbc: undefined, fbp: undefined };
|
|
104
|
-
|
|
105
|
-
const getCookie = (name: string) => {
|
|
106
|
-
const value = `; ${document.cookie}`;
|
|
107
|
-
const parts = value.split(`; ${name}=`);
|
|
108
|
-
if (parts.length === 2) return parts.pop()?.split(';').shift();
|
|
109
|
-
return undefined;
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
return {
|
|
113
|
-
fbc: getCookie('_fbc'),
|
|
114
|
-
fbp: getCookie('_fbp'),
|
|
115
|
-
};
|
|
116
|
-
}, []);
|
|
117
|
-
|
|
118
100
|
// Set mounted flag on client
|
|
119
101
|
useEffect(() => {
|
|
120
102
|
setIsMounted(true);
|
|
@@ -281,7 +263,7 @@ export function CartProvider({ children, brandSlug, initialCartId, shoppingCartP
|
|
|
281
263
|
}
|
|
282
264
|
},
|
|
283
265
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
284
|
-
[cartId, trackAddToCart
|
|
266
|
+
[cartId, trackAddToCart]
|
|
285
267
|
);
|
|
286
268
|
|
|
287
269
|
const updateItem = useCallback(
|
package/src/lib/utils.ts
CHANGED
|
@@ -43,3 +43,23 @@ export function getStatusColor(status: string): string {
|
|
|
43
43
|
}
|
|
44
44
|
return colors[status] || 'bg-gray-100 text-gray-800'
|
|
45
45
|
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Extract Facebook attribution cookies (fbc & fbp) for Meta Pixel CAPI
|
|
49
|
+
* @returns Object with fbc (Facebook Click ID) and fbp (Facebook Browser ID) cookies
|
|
50
|
+
*/
|
|
51
|
+
export function getFbCookies(): { fbc: string | undefined; fbp: string | undefined } {
|
|
52
|
+
if (typeof document === 'undefined') return { fbc: undefined, fbp: undefined };
|
|
53
|
+
|
|
54
|
+
const getCookie = (name: string) => {
|
|
55
|
+
const value = `; ${document.cookie}`;
|
|
56
|
+
const parts = value.split(`; ${name}=`);
|
|
57
|
+
if (parts.length === 2) return parts.pop()?.split(';').shift();
|
|
58
|
+
return undefined;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
fbc: getCookie('_fbc'),
|
|
63
|
+
fbp: getCookie('_fbp'),
|
|
64
|
+
};
|
|
65
|
+
}
|