@colabcommerce/elements 0.0.1 → 0.0.3
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/README.md +3 -3
- package/dist/CartForm.js +26 -26
- package/dist/{Container-BPKk2w_q.js → Container-7bFgo-eP.js} +1 -1
- package/dist/Modal-BqRDRCTs.js +863 -0
- package/dist/ProductForm.js +178 -157
- package/dist/Retailer.js +1420 -1351
- package/dist/StoreLocator.js +590 -449
- package/dist/addressComponentsToAddress-CNK2WJ24.js +1932 -0
- package/dist/{browser-ponyfill-CAlAl1ZX.js → browser-ponyfill-BEmK0BQJ.js} +1 -1
- package/dist/{globals-D3YPIcjZ.js → globals-C3lGVSJ0.js} +710 -702
- package/dist/index-DqABFy0O.js +137 -0
- package/dist/index-TPy0P4tu.js +98 -0
- package/dist/style.css +1 -1
- package/package.json +3 -2
- package/vite.config.js +3 -0
- package/dist/addressComponentsToAddress-CHYXse0U.js +0 -153
- package/dist/index-BComOHrk.js +0 -1909
- package/dist/index-Dv5Y39GK.js +0 -98
- package/dist/index-Ot1CirR6.js +0 -932
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Colab Elements
|
|
2
2
|
|
|
3
3
|
This is a bespoke version of Colab Commerce Elements customized for Palliser Furniture.
|
|
4
4
|
|
|
@@ -9,13 +9,13 @@ The API is the same as the standard Colab Commerce elements.
|
|
|
9
9
|
You will need an NPM token to install.
|
|
10
10
|
|
|
11
11
|
<pre>
|
|
12
|
-
npm install @colabocmmerce/
|
|
12
|
+
npm install @colabocmmerce/elements
|
|
13
13
|
</pre>
|
|
14
14
|
|
|
15
15
|
or
|
|
16
16
|
|
|
17
17
|
<pre>
|
|
18
|
-
yarn add @colabcommerce/
|
|
18
|
+
yarn add @colabcommerce/lements
|
|
19
19
|
</pre>
|
|
20
20
|
|
|
21
21
|
## Store Locator
|
package/dist/CartForm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as t, Fragment as H, jsxs as f } from "react/jsx-runtime";
|
|
2
2
|
import * as b from "react";
|
|
3
3
|
import { useRef as ae, useState as E, useCallback as re, useContext as j, useMemo as Y, useEffect as q } from "react";
|
|
4
|
-
import { C as ce, u as I, L as ie, d as le, g as de, b as ue, f as me, A as he,
|
|
5
|
-
import { L as
|
|
6
|
-
import { _ as be,
|
|
7
|
-
import { C as Me } from "./Container-
|
|
4
|
+
import { C as ce, u as I, L as ie, d as le, g as de, b as ue, f as me, A as he, c as pe, w as fe, h as ge, e as _e } from "./addressComponentsToAddress-CNK2WJ24.js";
|
|
5
|
+
import { L as ye, F as ve, a as Ce, Q as Ne } from "./index-DqABFy0O.js";
|
|
6
|
+
import { _ as be, p as B, q as k, j as we, A as Se, a as x, k as Ie, M as Le, c as y, Q as K, e as xe, h as F, i as Ae, F as v, R as qe, C as L, O as P, B as G, l as Q, I as Be, m as ke } from "./globals-C3lGVSJ0.js";
|
|
7
|
+
import { C as Me } from "./Container-7bFgo-eP.js";
|
|
8
8
|
function W() {
|
|
9
9
|
return W = Object.assign ? Object.assign.bind() : function(e) {
|
|
10
10
|
for (var n = 1; n < arguments.length; n++) {
|
|
@@ -120,7 +120,7 @@ function je(e, n) {
|
|
|
120
120
|
l && (Array.isArray(s) ? s.includes(e) ? c = s.filter((d) => d !== e) : c = [...s, e] : c = [e]), o == null || o(c, a), n == null || n(a);
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
|
-
const
|
|
123
|
+
const Z = /* @__PURE__ */ b.forwardRef(({
|
|
124
124
|
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
|
|
125
125
|
as: e = "button",
|
|
126
126
|
bsPrefix: n,
|
|
@@ -142,7 +142,7 @@ const K = /* @__PURE__ */ b.forwardRef(({
|
|
|
142
142
|
className: k(s, n, !X(g, c) && "collapsed")
|
|
143
143
|
});
|
|
144
144
|
});
|
|
145
|
-
|
|
145
|
+
Z.displayName = "AccordionButton";
|
|
146
146
|
const te = /* @__PURE__ */ b.forwardRef(({
|
|
147
147
|
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
|
|
148
148
|
as: e = "h2",
|
|
@@ -156,7 +156,7 @@ const te = /* @__PURE__ */ b.forwardRef(({
|
|
|
156
156
|
ref: d,
|
|
157
157
|
...c,
|
|
158
158
|
className: k(o, s),
|
|
159
|
-
children: /* @__PURE__ */ t(
|
|
159
|
+
children: /* @__PURE__ */ t(Z, {
|
|
160
160
|
onClick: a,
|
|
161
161
|
"aria-controls": n,
|
|
162
162
|
children: l
|
|
@@ -214,7 +214,7 @@ const oe = /* @__PURE__ */ b.forwardRef((e, n) => {
|
|
|
214
214
|
});
|
|
215
215
|
oe.displayName = "Accordion";
|
|
216
216
|
const Te = Object.assign(oe, {
|
|
217
|
-
Button:
|
|
217
|
+
Button: Z,
|
|
218
218
|
Collapse: U,
|
|
219
219
|
Item: ne,
|
|
220
220
|
Header: te,
|
|
@@ -304,16 +304,16 @@ const Te = Object.assign(oe, {
|
|
|
304
304
|
le({ lat: (u = e == null ? void 0 : e.address) == null ? void 0 : u.latitude, lng: (C = e.address) == null ? void 0 : C.longitude }, o);
|
|
305
305
|
const i = e.retailer_location_hours.find((p) => p.day === (/* @__PURE__ */ new Date()).getDay()), r = /* @__PURE__ */ new Date();
|
|
306
306
|
let _ = /* @__PURE__ */ new Date();
|
|
307
|
-
i && (_ = new
|
|
307
|
+
i && (_ = new K(r.getUTCFullYear(), r.getMonth(), r.getDate(), i.open_at_hour, i.open_at_minute, 0, 0, i.timezone));
|
|
308
308
|
let h = /* @__PURE__ */ new Date();
|
|
309
|
-
i && (h = new
|
|
309
|
+
i && (h = new K(r.getUTCFullYear(), r.getMonth(), r.getDate(), i.close_at_hour, i.close_at_minute, 0, 0, i.timezone));
|
|
310
310
|
const w = i && r >= _ && r <= h, M = i && !w && r - _ > 30 * 6e4 * -1, $ = i && w && h - r < 30 * 6e4;
|
|
311
|
-
return w ? $ ? (y(N.hours, N.soon), n("store.closingSoon")) : (y(N.hours, N.open), n("store.openNow")) : M ? (y(N.hours, N.soon), n("store.openingSoon")) : (y(N.hours, N.closed), n("store.closedNow")), e.id === a ? y(N.wrapper, N.selected) : y(N.wrapper), /* @__PURE__ */ t(
|
|
312
|
-
}, Ue = "ePOrG",
|
|
311
|
+
return w ? $ ? (y(N.hours, N.soon), n("store.closingSoon")) : (y(N.hours, N.open), n("store.openNow")) : M ? (y(N.hours, N.soon), n("store.openingSoon")) : (y(N.hours, N.closed), n("store.closedNow")), e.id === a ? y(N.wrapper, N.selected) : y(N.wrapper), /* @__PURE__ */ t(ye, { location: e, showProducts: !0 });
|
|
312
|
+
}, Ue = "ePOrG", Ze = "M-nbk", Ke = "FPD-7", Qe = "JswlX", O = {
|
|
313
313
|
loading: Ue,
|
|
314
|
-
itemWrapper:
|
|
315
|
-
selected:
|
|
316
|
-
wrapper:
|
|
314
|
+
itemWrapper: Ze,
|
|
315
|
+
selected: Ke,
|
|
316
|
+
wrapper: Qe
|
|
317
317
|
}, Ve = () => {
|
|
318
318
|
const { t: e } = x(), { locations: n, isLoading: s, focusedLocationId: o } = I();
|
|
319
319
|
function l(a, c) {
|
|
@@ -331,8 +331,8 @@ const Te = Object.assign(oe, {
|
|
|
331
331
|
l(c, a);
|
|
332
332
|
}
|
|
333
333
|
}, [o]), s ? /* @__PURE__ */ t("div", { className: y(O.loading), children: /* @__PURE__ */ t("img", { src: "https://images.sofasandsectionals.com/cc/pal-loader.svg", width: "50", height: "50", alt: e("store_locator.loading") }) }) : /* @__PURE__ */ t("div", { className: y(O.wrapper), id: "llw", children: n.map((a) => /* @__PURE__ */ t("div", { className: o === a.id ? y(O.itemWrapper, O.selected) : y(O.itemWrapper), id: `location-${a.id}`, children: /* @__PURE__ */ t(He, { id: a.id, location: a }) }, a.id)) });
|
|
334
|
-
},
|
|
335
|
-
name:
|
|
334
|
+
}, Je = "zBhXi", Ye = "yZvHZ", Ge = "VtRMr", D = {
|
|
335
|
+
name: Je,
|
|
336
336
|
address: Ye,
|
|
337
337
|
changeButton: Ge
|
|
338
338
|
}, Xe = () => {
|
|
@@ -372,7 +372,7 @@ const Te = Object.assign(oe, {
|
|
|
372
372
|
/* @__PURE__ */ t(me, {}),
|
|
373
373
|
/* @__PURE__ */ t(We, {})
|
|
374
374
|
] }),
|
|
375
|
-
/* @__PURE__ */ t(
|
|
375
|
+
/* @__PURE__ */ t(ve, {}),
|
|
376
376
|
/* @__PURE__ */ t(Ve, {})
|
|
377
377
|
] }),
|
|
378
378
|
e && /* @__PURE__ */ t(Xe, {})
|
|
@@ -400,8 +400,8 @@ const Te = Object.assign(oe, {
|
|
|
400
400
|
initialValues: w,
|
|
401
401
|
validationSchema: M,
|
|
402
402
|
onSubmit: async (C) => {
|
|
403
|
-
|
|
404
|
-
const p = await he(i == null ? void 0 : i.lat, i == null ? void 0 : i.lng), m =
|
|
403
|
+
fe("AIzaSyAnJmWEU1r63DiRWHkjczxzHyIEq3dhj4M");
|
|
404
|
+
const p = await he(i == null ? void 0 : i.lat, i == null ? void 0 : i.lng), m = pe(p.results[0].address_components), S = await fetch("https://api.colabcommerce.com/widget_api/leads", {
|
|
405
405
|
method: "POST",
|
|
406
406
|
headers: {
|
|
407
407
|
"Content-Type": "application/json"
|
|
@@ -588,7 +588,7 @@ const Te = Object.assign(oe, {
|
|
|
588
588
|
] })
|
|
589
589
|
] }) }) }) }) })
|
|
590
590
|
] });
|
|
591
|
-
}, dt = "fIA0W", ut = "I6plu",
|
|
591
|
+
}, dt = "fIA0W", ut = "I6plu", J = {
|
|
592
592
|
successContainer: dt,
|
|
593
593
|
successBtn: ut
|
|
594
594
|
}, mt = ({ products: e, id: n, onSuccess: s, onCancel: o, onClose: l }) => {
|
|
@@ -600,17 +600,17 @@ const Te = Object.assign(oe, {
|
|
|
600
600
|
/* @__PURE__ */ t(st, {}),
|
|
601
601
|
/* @__PURE__ */ t(lt, { setSuccess: c, success: a, products: e, onSuccess: s, id: n, onCancel: o, onClose: l })
|
|
602
602
|
] }),
|
|
603
|
-
a && /* @__PURE__ */ t("div", { className:
|
|
603
|
+
a && /* @__PURE__ */ t("div", { className: J.successContainer, children: /* @__PURE__ */ f("div", { className: "text-center", children: [
|
|
604
604
|
/* @__PURE__ */ t("h2", { className: "fw-bold fs-2", style: { marginBottom: "3.2rem" }, children: d("cart_form.success_title") }),
|
|
605
605
|
/* @__PURE__ */ t("div", { className: "fs-6", style: { fontWeight: 600, marginBottom: "3.2rem" }, children: d("cart_form.success_message") }),
|
|
606
|
-
/* @__PURE__ */ t(G, { variant: "dark", className:
|
|
606
|
+
/* @__PURE__ */ t(G, { variant: "dark", className: J.successBtn, onClick: g, children: d("cart_form.success_button") })
|
|
607
607
|
] }) })
|
|
608
608
|
] });
|
|
609
609
|
}, vt = ({ id: e, locale: n, products: s, onSuccess: o, onCancel: l, onClose: a }) => (q(() => {
|
|
610
|
-
|
|
611
|
-
}, [n]), /* @__PURE__ */ t(Be, { i18n:
|
|
610
|
+
Q.changeLanguage(n);
|
|
611
|
+
}, [n]), /* @__PURE__ */ t(Be, { i18n: Q, children: /* @__PURE__ */ f(ke, { apiKey: "AIzaSyAnJmWEU1r63DiRWHkjczxzHyIEq3dhj4M", libraries: ["places"], children: [
|
|
612
612
|
/* @__PURE__ */ t("script", { src: "https://maps.googleapis.com/maps/api/js?key=AIzaSyAnJmWEU1r63DiRWHkjczxzHyIEq3dhj4M&libraries=places" }),
|
|
613
|
-
/* @__PURE__ */ t(
|
|
613
|
+
/* @__PURE__ */ t(ge, { id: e, children: /* @__PURE__ */ t(Ce, { children: /* @__PURE__ */ t(_e, { autoLocate: !1, products: s, children: /* @__PURE__ */ t(Ne, { children: /* @__PURE__ */ t(mt, { id: e, products: s, onSuccess: o, onCancel: l, onClose: a }) }) }) }) })
|
|
614
614
|
] }) }));
|
|
615
615
|
export {
|
|
616
616
|
vt as default
|