@colabcommerce/elements 0.0.1

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 ADDED
@@ -0,0 +1,70 @@
1
+ # palliser-elements
2
+
3
+ This is a bespoke version of Colab Commerce Elements customized for Palliser Furniture.
4
+
5
+ The API is the same as the standard Colab Commerce elements.
6
+
7
+ ## Installation
8
+
9
+ You will need an NPM token to install.
10
+
11
+ <pre>
12
+ npm install @colabocmmerce/palliser-elements
13
+ </pre>
14
+
15
+ or
16
+
17
+ <pre>
18
+ yarn add @colabcommerce/palliser-elements
19
+ </pre>
20
+
21
+ ## Store Locator
22
+
23
+ The store locator provides a drop in component to embed a store locator on any page.
24
+
25
+ ## Usage
26
+
27
+ <pre>
28
+ import StoreLocator from '@colabcommerce/elements/StoreLocator';
29
+ import '@colabcommerce/elements/dist/index.css';
30
+
31
+ <StoreLocator id={YOUR_CC_ORGANIZATION_ID} locale="en-US" root="/retailers" />
32
+ </pre>
33
+
34
+ ### Props
35
+
36
+ #### ID => `String`
37
+
38
+ The Colab Commerce Organization ID that retailers will be loaded for
39
+
40
+ #### locale => `String`
41
+
42
+ An ISO string representing the locale of the user.
43
+
44
+ #### root => `String`
45
+
46
+ The root path, this is necessary for the correct linking paths for the retailer pages.
47
+
48
+ ## Retailer
49
+
50
+ The store locator provides a drop in component to embed a store locator on any page.
51
+
52
+ ## Usage
53
+
54
+ <pre>
55
+ import Retailer from '@colabcommerce/elements/Retailer';
56
+ import '@colabcommerce/elements/dist/index.css';
57
+
58
+ <Retailer id={RETAILER_CC_ID} locale="en-US" />
59
+ </pre>
60
+
61
+ ### Props
62
+
63
+ #### ID => `String`
64
+
65
+ The Colab Commerce Organization ID that retailers will be loaded for
66
+
67
+ #### locale => `String`
68
+
69
+ An ISO string representing the locale of the user.
70
+
@@ -0,0 +1,617 @@
1
+ import { jsx as t, Fragment as H, jsxs as f } from "react/jsx-runtime";
2
+ import * as b from "react";
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, w as pe, c as fe, e as ge } from "./index-BComOHrk.js";
5
+ import { L as _e, F as ye, a as ve, b as Ce, Q as Ne } from "./addressComponentsToAddress-CHYXse0U.js";
6
+ import { _ as be, j as B, k, e as we, A as Se, a as x, g as Ie, M as Le, c as y, O as Z, G as xe, J as F, K as Ae, L as v, R as qe, C as L, N as P, B as G, i as J, I as Be, h as ke } from "./globals-D3YPIcjZ.js";
7
+ import { C as Me } from "./Container-BPKk2w_q.js";
8
+ function W() {
9
+ return W = Object.assign ? Object.assign.bind() : function(e) {
10
+ for (var n = 1; n < arguments.length; n++) {
11
+ var s = arguments[n];
12
+ for (var o in s) ({}).hasOwnProperty.call(s, o) && (e[o] = s[o]);
13
+ }
14
+ return e;
15
+ }, W.apply(null, arguments);
16
+ }
17
+ function V(e) {
18
+ return "default" + e.charAt(0).toUpperCase() + e.substr(1);
19
+ }
20
+ function Fe(e) {
21
+ var n = Pe(e, "string");
22
+ return typeof n == "symbol" ? n : String(n);
23
+ }
24
+ function Pe(e, n) {
25
+ if (typeof e != "object" || e === null) return e;
26
+ var s = e[Symbol.toPrimitive];
27
+ if (s !== void 0) {
28
+ var o = s.call(e, n);
29
+ if (typeof o != "object") return o;
30
+ throw new TypeError("@@toPrimitive must return a primitive value.");
31
+ }
32
+ return String(e);
33
+ }
34
+ function Oe(e, n, s) {
35
+ var o = ae(e !== void 0), l = E(n), a = l[0], c = l[1], d = e !== void 0, g = o.current;
36
+ return o.current = d, !d && g && a !== n && c(n), [d ? e : a, re(function(i) {
37
+ for (var r = arguments.length, _ = new Array(r > 1 ? r - 1 : 0), h = 1; h < r; h++)
38
+ _[h - 1] = arguments[h];
39
+ s && s.apply(void 0, [i].concat(_)), c(i);
40
+ }, [s])];
41
+ }
42
+ function Ee(e, n) {
43
+ return Object.keys(n).reduce(function(s, o) {
44
+ var l, a = s, c = a[V(o)], d = a[o], g = be(a, [V(o), o].map(Fe)), i = n[o], r = Oe(d, c, e[i]), _ = r[0], h = r[1];
45
+ return W({}, g, (l = {}, l[o] = _, l[i] = h, l));
46
+ }, e);
47
+ }
48
+ function X(e, n) {
49
+ return Array.isArray(e) ? e.includes(n) : e === n;
50
+ }
51
+ const T = /* @__PURE__ */ b.createContext({});
52
+ T.displayName = "AccordionContext";
53
+ const U = /* @__PURE__ */ b.forwardRef(({
54
+ as: e = "div",
55
+ bsPrefix: n,
56
+ className: s,
57
+ children: o,
58
+ eventKey: l,
59
+ ...a
60
+ }, c) => {
61
+ const {
62
+ activeEventKey: d
63
+ } = j(T);
64
+ return n = B(n, "accordion-collapse"), /* @__PURE__ */ t(ce, {
65
+ ref: c,
66
+ in: X(d, l),
67
+ ...a,
68
+ className: k(s, n),
69
+ children: /* @__PURE__ */ t(e, {
70
+ children: b.Children.only(o)
71
+ })
72
+ });
73
+ });
74
+ U.displayName = "AccordionCollapse";
75
+ const z = /* @__PURE__ */ b.createContext({
76
+ eventKey: ""
77
+ });
78
+ z.displayName = "AccordionItemContext";
79
+ const ee = /* @__PURE__ */ b.forwardRef(({
80
+ // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
81
+ as: e = "div",
82
+ bsPrefix: n,
83
+ className: s,
84
+ onEnter: o,
85
+ onEntering: l,
86
+ onEntered: a,
87
+ onExit: c,
88
+ onExiting: d,
89
+ onExited: g,
90
+ ...i
91
+ }, r) => {
92
+ n = B(n, "accordion-body");
93
+ const {
94
+ eventKey: _
95
+ } = j(z);
96
+ return /* @__PURE__ */ t(U, {
97
+ eventKey: _,
98
+ onEnter: o,
99
+ onEntering: l,
100
+ onEntered: a,
101
+ onExit: c,
102
+ onExiting: d,
103
+ onExited: g,
104
+ children: /* @__PURE__ */ t(e, {
105
+ ref: r,
106
+ ...i,
107
+ className: k(s, n)
108
+ })
109
+ });
110
+ });
111
+ ee.displayName = "AccordionBody";
112
+ function je(e, n) {
113
+ const {
114
+ activeEventKey: s,
115
+ onSelect: o,
116
+ alwaysOpen: l
117
+ } = j(T);
118
+ return (a) => {
119
+ let c = e === s ? null : e;
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
+ };
122
+ }
123
+ const K = /* @__PURE__ */ b.forwardRef(({
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
+ as: e = "button",
126
+ bsPrefix: n,
127
+ className: s,
128
+ onClick: o,
129
+ ...l
130
+ }, a) => {
131
+ n = B(n, "accordion-button");
132
+ const {
133
+ eventKey: c
134
+ } = j(z), d = je(c, o), {
135
+ activeEventKey: g
136
+ } = j(T);
137
+ return e === "button" && (l.type = "button"), /* @__PURE__ */ t(e, {
138
+ ref: a,
139
+ onClick: d,
140
+ ...l,
141
+ "aria-expanded": Array.isArray(g) ? g.includes(c) : c === g,
142
+ className: k(s, n, !X(g, c) && "collapsed")
143
+ });
144
+ });
145
+ K.displayName = "AccordionButton";
146
+ const te = /* @__PURE__ */ b.forwardRef(({
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
+ as: e = "h2",
149
+ "aria-controls": n,
150
+ bsPrefix: s,
151
+ className: o,
152
+ children: l,
153
+ onClick: a,
154
+ ...c
155
+ }, d) => (s = B(s, "accordion-header"), /* @__PURE__ */ t(e, {
156
+ ref: d,
157
+ ...c,
158
+ className: k(o, s),
159
+ children: /* @__PURE__ */ t(K, {
160
+ onClick: a,
161
+ "aria-controls": n,
162
+ children: l
163
+ })
164
+ })));
165
+ te.displayName = "AccordionHeader";
166
+ const ne = /* @__PURE__ */ b.forwardRef(({
167
+ // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
168
+ as: e = "div",
169
+ bsPrefix: n,
170
+ className: s,
171
+ eventKey: o,
172
+ ...l
173
+ }, a) => {
174
+ n = B(n, "accordion-item");
175
+ const c = Y(() => ({
176
+ eventKey: o
177
+ }), [o]);
178
+ return /* @__PURE__ */ t(z.Provider, {
179
+ value: c,
180
+ children: /* @__PURE__ */ t(e, {
181
+ ref: a,
182
+ ...l,
183
+ className: k(s, n)
184
+ })
185
+ });
186
+ });
187
+ ne.displayName = "AccordionItem";
188
+ const oe = /* @__PURE__ */ b.forwardRef((e, n) => {
189
+ const {
190
+ // Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
191
+ as: s = "div",
192
+ activeKey: o,
193
+ bsPrefix: l,
194
+ className: a,
195
+ onSelect: c,
196
+ flush: d,
197
+ alwaysOpen: g,
198
+ ...i
199
+ } = Ee(e, {
200
+ activeKey: "onSelect"
201
+ }), r = B(l, "accordion"), _ = Y(() => ({
202
+ activeEventKey: o,
203
+ onSelect: c,
204
+ alwaysOpen: g
205
+ }), [o, c, g]);
206
+ return /* @__PURE__ */ t(T.Provider, {
207
+ value: _,
208
+ children: /* @__PURE__ */ t(s, {
209
+ ref: n,
210
+ ...i,
211
+ className: k(a, r, d && `${r}-flush`)
212
+ })
213
+ });
214
+ });
215
+ oe.displayName = "Accordion";
216
+ const Te = Object.assign(oe, {
217
+ Button: K,
218
+ Collapse: U,
219
+ Item: ne,
220
+ Header: te,
221
+ Body: ee
222
+ }), $e = () => {
223
+ const { locationName: e, setLocationName: n, setSearchCenter: s, setMapCenter: o, setShowFilters: l, setLoadingGeo: a, getPosition: c } = I();
224
+ return /* @__PURE__ */ t(
225
+ ie,
226
+ {
227
+ locationName: e,
228
+ setLocationName: n,
229
+ setSearchCenter: s,
230
+ setMapCenter: o,
231
+ handleLocate: () => {
232
+ a(!0), c();
233
+ }
234
+ }
235
+ );
236
+ }, Re = ({ location: e }) => {
237
+ var i, r;
238
+ const { focusedLocationId: n, selectedLocationId: s, setShowDetails: o, setFocusedLocationId: l } = I(), a = () => {
239
+ l(e.id);
240
+ }, c = we(), d = n === e.id, g = (e == null ? void 0 : e.store_type) === "Palliser Studio" ? d ? c.studioSelected : c.studio : d ? c.standardSelected : c.standard;
241
+ return /* @__PURE__ */ t(
242
+ Se,
243
+ {
244
+ onClick: a,
245
+ zIndex: n === e.id ? 1e3 : 1,
246
+ position: { lat: ((i = e == null ? void 0 : e.address) == null ? void 0 : i.latitude) * 1, lng: ((r = e.address) == null ? void 0 : r.longitude) * 1 },
247
+ children: /* @__PURE__ */ t("img", { src: g, width: 30 })
248
+ }
249
+ );
250
+ }, ze = "VuYOd", De = {
251
+ map: ze
252
+ }, We = () => {
253
+ const { locations: e, selectedLocationId: n, mapCenter: s, searchCenter: o, setMapCenter: l, zoom: a, setZoom: c, focusedLocationId: d } = I(), { t: g } = x(), [i, r] = E(s), _ = Ie(), [h, w] = E(null), M = (p) => {
254
+ c(p.detail.zoom);
255
+ }, $ = (p) => {
256
+ var m, S;
257
+ h && r({ lat: (m = h == null ? void 0 : h.getCenter()) == null ? void 0 : m.lat(), lng: (S = h == null ? void 0 : h.getCenter()) == null ? void 0 : S.lng() });
258
+ };
259
+ q(() => {
260
+ const p = setTimeout(() => {
261
+ l({ lat: i.lat, lng: i.lng });
262
+ }, 500);
263
+ return () => clearTimeout(p);
264
+ }, [i, l]), q(() => {
265
+ _ && w(_);
266
+ }, [_, w]);
267
+ const u = () => {
268
+ if (!h) return;
269
+ const p = new window.google.maps.LatLngBounds();
270
+ e.slice(0, 2).map((m) => {
271
+ p.extend({ lat: m.address.latitude * 1, lng: m.address.longitude * 1 });
272
+ }), p.extend(o), h.fitBounds(p, 10);
273
+ }, C = (p) => {
274
+ var S;
275
+ if (!h) return;
276
+ const m = new window.google.maps.LatLngBounds();
277
+ (S = h == null ? void 0 : h.getBounds()) != null && S.contains({ lat: p.address.latitude * 1, lng: p.address.longitude * 1 }) || (m.extend({ lat: p.address.latitude * 1, lng: p.address.longitude * 1 }), m.extend(o), h.fitBounds(m, 10));
278
+ };
279
+ return q(() => {
280
+ if (d && e.length > 0) {
281
+ const p = e.find((m) => m.id === d);
282
+ p && C(p);
283
+ } else e.length > 0;
284
+ }, [d, e, h]), q(() => {
285
+ e.length > 0 && u();
286
+ }, [e]), !s.lat || !s.lng ? null : /* @__PURE__ */ t(H, { children: /* @__PURE__ */ t(
287
+ Le,
288
+ {
289
+ className: y(De.map),
290
+ defaultZoom: a,
291
+ defaultCenter: i,
292
+ mapId: "fb10c7a27b297863",
293
+ gestureHandling: "greedy",
294
+ keyboardShortcuts: !1,
295
+ disableDefaultUI: !0,
296
+ onDragend: $,
297
+ onCameraChanged: M,
298
+ children: e == null ? void 0 : e.map((p) => /* @__PURE__ */ t(Re, { location: p }, p.id))
299
+ }
300
+ ) });
301
+ }, N = {}, He = ({ location: e }) => {
302
+ var u, C;
303
+ const { t: n } = x(), { distanceUnit: s, searchCenter: o, setSelectedLocationId: l, selectedLocationId: a, setMessageModalOpen: c, setShowMap: d, setShowDetails: g } = I();
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
+ const i = e.retailer_location_hours.find((p) => p.day === (/* @__PURE__ */ new Date()).getDay()), r = /* @__PURE__ */ new Date();
306
+ let _ = /* @__PURE__ */ new Date();
307
+ i && (_ = new Z(r.getUTCFullYear(), r.getMonth(), r.getDate(), i.open_at_hour, i.open_at_minute, 0, 0, i.timezone));
308
+ let h = /* @__PURE__ */ new Date();
309
+ i && (h = new Z(r.getUTCFullYear(), r.getMonth(), r.getDate(), i.close_at_hour, i.close_at_minute, 0, 0, i.timezone));
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(_e, { location: e, showProducts: !0 });
312
+ }, Ue = "ePOrG", Ke = "M-nbk", Ze = "FPD-7", Je = "JswlX", O = {
313
+ loading: Ue,
314
+ itemWrapper: Ke,
315
+ selected: Ze,
316
+ wrapper: Je
317
+ }, Ve = () => {
318
+ const { t: e } = x(), { locations: n, isLoading: s, focusedLocationId: o } = I();
319
+ function l(a, c) {
320
+ if (!a || !c) return;
321
+ const d = a.getBoundingClientRect(), i = c.getBoundingClientRect().top - d.top + a.scrollTop;
322
+ a.scrollTo({
323
+ top: i,
324
+ behavior: "smooth"
325
+ });
326
+ }
327
+ return q(() => {
328
+ const a = document.getElementById(`location-${o}`);
329
+ if (a) {
330
+ const c = document.getElementById("llw");
331
+ l(c, a);
332
+ }
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
+ }, Qe = "zBhXi", Ye = "yZvHZ", Ge = "VtRMr", D = {
335
+ name: Qe,
336
+ address: Ye,
337
+ changeButton: Ge
338
+ }, Xe = () => {
339
+ const { selectedLocation: e, setSelectedLocationId: n } = I(), { cc_company_retailer_location_id: s } = de(), { t: o } = x("default");
340
+ return !e || e.location_id === s ? null : /* @__PURE__ */ t("div", { children: /* @__PURE__ */ f("div", { children: [
341
+ /* @__PURE__ */ t("h3", { className: D.name, children: e.retailer_name }),
342
+ /* @__PURE__ */ t(ue, { hours: e.retailer_location_hours }),
343
+ /* @__PURE__ */ f("address", { className: D.address, children: [
344
+ /* @__PURE__ */ t("div", { children: e.address.street_line_one }),
345
+ /* @__PURE__ */ f("div", { children: [
346
+ e.address.city,
347
+ ", ",
348
+ e.address.province,
349
+ " ",
350
+ e.address.postal_code
351
+ ] })
352
+ ] }),
353
+ /* @__PURE__ */ t("button", { className: D.changeButton, onClick: () => n(null), children: o("quote.selected_location.change") })
354
+ ] }) });
355
+ }, et = "rzOiv", tt = "VViY9", nt = "Z6pWc", ot = "SmFFK", R = {
356
+ stepOneContainer: et,
357
+ header: tt,
358
+ tag: nt,
359
+ content: ot
360
+ }, st = () => {
361
+ const { selectedLocationId: e } = I(), { t: n } = x("default");
362
+ return /* @__PURE__ */ f("div", { className: R.stepOneContainer, children: [
363
+ /* @__PURE__ */ f("h2", { className: R.header, children: [
364
+ "1. ",
365
+ n("cart_form.step_one_title")
366
+ ] }),
367
+ /* @__PURE__ */ f("div", { className: R.content, children: [
368
+ !e && /* @__PURE__ */ f(H, { children: [
369
+ /* @__PURE__ */ t($e, {}),
370
+ /* @__PURE__ */ t("p", { className: R.tag, children: n("quote_form.exclusive") }),
371
+ /* @__PURE__ */ f("div", { className: "pb-3 position-relative", children: [
372
+ /* @__PURE__ */ t(me, {}),
373
+ /* @__PURE__ */ t(We, {})
374
+ ] }),
375
+ /* @__PURE__ */ t(ye, {}),
376
+ /* @__PURE__ */ t(Ve, {})
377
+ ] }),
378
+ e && /* @__PURE__ */ t(Xe, {})
379
+ ] })
380
+ ] });
381
+ }, at = "_2eMqH", rt = "ylSg7", ct = "_4WWPr", it = "HeQuC", A = {
382
+ stepTwoContainer: at,
383
+ header: rt,
384
+ content: ct,
385
+ submitButton: it
386
+ }, lt = ({ success: e, products: n, setSuccess: s, onSuccess: o, onCancel: l, onClose: a, id: c }) => {
387
+ const { selectedLocationId: d, locale: g, searchCenter: i } = I(), { t: r } = x("default"), [_, h] = E(!1), w = {
388
+ firstName: "",
389
+ lastName: "",
390
+ email: "",
391
+ phone: "",
392
+ notes: ""
393
+ }, M = xe().shape({
394
+ firstName: F().required(r("quote_form.first_name_required")),
395
+ lastName: F().required(r("quote_form.last_name_required")),
396
+ email: F().email(r("quote_form.invalid_email")).required(r("quote_form.email_required")),
397
+ phone: F().required(r("quote_form.phone_required")),
398
+ notes: F()
399
+ }), u = Ae({
400
+ initialValues: w,
401
+ validationSchema: M,
402
+ onSubmit: async (C) => {
403
+ pe("AIzaSyAnJmWEU1r63DiRWHkjczxzHyIEq3dhj4M");
404
+ const p = await he(i == null ? void 0 : i.lat, i == null ? void 0 : i.lng), m = ve(p.results[0].address_components), S = await fetch("https://api.colabcommerce.com/widget_api/leads", {
405
+ method: "POST",
406
+ headers: {
407
+ "Content-Type": "application/json"
408
+ },
409
+ body: JSON.stringify({
410
+ id: c,
411
+ lead: {
412
+ name: `${C.firstName} ${C.lastName}`,
413
+ emails_attributes: [{ email: C.email }],
414
+ phone_numbers_attributes: [{ phone_number: C.phone, country_code: "US" }],
415
+ message: C.message,
416
+ opt_in: C.optIn,
417
+ location_attributes: {
418
+ street_line_one: m == null ? void 0 : m.addressLine1,
419
+ street_line_two: m == null ? void 0 : m.addressLine2,
420
+ city: m == null ? void 0 : m.city,
421
+ province: m == null ? void 0 : m.province,
422
+ postal_code: m == null ? void 0 : m.postalCode,
423
+ country: m == null ? void 0 : m.country,
424
+ latitude: (i == null ? void 0 : i.lat) || null,
425
+ longitude: (i == null ? void 0 : i.lng) || null
426
+ },
427
+ assignee_id: d || null,
428
+ assignee_type: "CompanyRetailerLocation",
429
+ lead_activities_attributes: [{
430
+ type: "LeadActivity::QuoteRequest",
431
+ products: n,
432
+ notes: C.notes,
433
+ source_type: "Company",
434
+ source_id: c
435
+ }]
436
+ }
437
+ })
438
+ });
439
+ if (!S.ok) {
440
+ h(!0);
441
+ return;
442
+ }
443
+ const se = await S.json();
444
+ s(!0), o && o(se);
445
+ }
446
+ });
447
+ return /* @__PURE__ */ f("div", { className: A.stepTwoContainer, children: [
448
+ /* @__PURE__ */ f("h2", { className: A.header, id: "#step-two", children: [
449
+ "2. ",
450
+ r("cart_form.step_two_title")
451
+ ] }),
452
+ d && /* @__PURE__ */ t("div", { className: A.content, children: /* @__PURE__ */ t(H, { children: /* @__PURE__ */ t(v, { onSubmit: u.handleSubmit, className: y(A.form), children: /* @__PURE__ */ t(Me, { className: "px-0 mx-0", children: /* @__PURE__ */ f(qe, { children: [
453
+ /* @__PURE__ */ t(L, { xs: 12, md: 6, children: /* @__PURE__ */ f(
454
+ P,
455
+ {
456
+ controlId: "floatingInput",
457
+ label: r("quote_form.first_name"),
458
+ className: "mb-3",
459
+ children: [
460
+ /* @__PURE__ */ t(
461
+ v.Control,
462
+ {
463
+ type: "text",
464
+ name: "firstName",
465
+ className: "rounded-0",
466
+ placeholder: r("quote_form.first_name_placeholder"),
467
+ onChange: u.handleChange,
468
+ value: u.values.firstName,
469
+ isInvalid: !!u.errors.firstName
470
+ }
471
+ ),
472
+ /* @__PURE__ */ t(v.Control.Feedback, { type: "invalid", children: u.errors.firstName })
473
+ ]
474
+ }
475
+ ) }),
476
+ /* @__PURE__ */ t(L, { xs: 12, md: 6, children: /* @__PURE__ */ f(
477
+ P,
478
+ {
479
+ controlId: "floatingInput",
480
+ label: r("quote_form.last_name"),
481
+ className: "mb-3",
482
+ children: [
483
+ /* @__PURE__ */ t(
484
+ v.Control,
485
+ {
486
+ type: "text",
487
+ name: "lastName",
488
+ className: "rounded-0",
489
+ placeholder: r("quote_form.last_name_placeholder"),
490
+ onChange: u.handleChange,
491
+ value: u.values.lastName,
492
+ isInvalid: !!u.errors.lastName
493
+ }
494
+ ),
495
+ /* @__PURE__ */ t(v.Control.Feedback, { type: "invalid", children: u.errors.lastName })
496
+ ]
497
+ }
498
+ ) }),
499
+ /* @__PURE__ */ t(L, { xs: 12, md: 6, children: /* @__PURE__ */ f(
500
+ P,
501
+ {
502
+ controlId: "floatingInput",
503
+ label: r("quote_form.email"),
504
+ className: "mb-3",
505
+ children: [
506
+ /* @__PURE__ */ t(
507
+ v.Control,
508
+ {
509
+ type: "email",
510
+ name: "email",
511
+ className: "rounded-0",
512
+ placeholder: r("quote_form.email_placeholder"),
513
+ onChange: u.handleChange,
514
+ value: u.values.email,
515
+ isInvalid: !!u.errors.email
516
+ }
517
+ ),
518
+ /* @__PURE__ */ t(v.Control.Feedback, { type: "invalid", children: u.errors.email })
519
+ ]
520
+ }
521
+ ) }),
522
+ /* @__PURE__ */ t(L, { xs: 12, md: 6, children: /* @__PURE__ */ f(
523
+ P,
524
+ {
525
+ controlId: "floatingInput",
526
+ label: r("quote_form.phone"),
527
+ className: "mb-3",
528
+ children: [
529
+ /* @__PURE__ */ t(
530
+ v.Control,
531
+ {
532
+ type: "text",
533
+ name: "phone",
534
+ placeholder: r("quote_form.phone_placeholder"),
535
+ onChange: u.handleChange,
536
+ size: "sm",
537
+ className: "rounded-0",
538
+ value: u.values.phone,
539
+ isInvalid: !!u.errors.phone
540
+ }
541
+ ),
542
+ /* @__PURE__ */ t(v.Control.Feedback, { type: "invalid", children: u.errors.phone })
543
+ ]
544
+ }
545
+ ) }),
546
+ /* @__PURE__ */ t(L, { xs: 12, children: /* @__PURE__ */ f(
547
+ P,
548
+ {
549
+ controlId: "floatingTextarea",
550
+ label: r("quote_form.notes"),
551
+ className: ["mb-3", y(A.textarea)].join(" "),
552
+ children: [
553
+ /* @__PURE__ */ t(
554
+ v.Control,
555
+ {
556
+ as: "textarea",
557
+ name: "notes",
558
+ className: "rounded-0",
559
+ placeholder: r("quote_form.notes_placeholder"),
560
+ onChange: u.handleChange,
561
+ value: u.values.notes,
562
+ isInvalid: !!u.errors.notes,
563
+ style: { height: "100px" }
564
+ }
565
+ ),
566
+ /* @__PURE__ */ t(v.Control.Feedback, { type: "invalid", children: u.errors.notes })
567
+ ]
568
+ }
569
+ ) }),
570
+ /* @__PURE__ */ f(L, { xs: 12, children: [
571
+ /* @__PURE__ */ t(
572
+ v.Check,
573
+ {
574
+ name: "optIn",
575
+ type: "checkbox",
576
+ label: r("quote_form.optIn"),
577
+ className: "mb-3 fs-6",
578
+ onChange: u.handleChange,
579
+ isInvalid: !!u.errors.optIn
580
+ }
581
+ ),
582
+ /* @__PURE__ */ t(v.Control.Feedback, { type: "invalid", children: u.errors.optIn })
583
+ ] }),
584
+ /* @__PURE__ */ f(L, { xs: 12, className: "text-start d-flex align-items-center", children: [
585
+ /* @__PURE__ */ t(G, { type: "submit", variant: "dark", className: y(A.submitButton), disabled: e, children: u.isSubmitting ? r("quote.submitting") : r("quote_form.submit") }),
586
+ _ && /* @__PURE__ */ t("div", { className: y("text-danger ms-2"), children: r("quote_form.error") }),
587
+ e && /* @__PURE__ */ t("div", { className: y("text-success ms-2"), children: r("quote_form.success") })
588
+ ] })
589
+ ] }) }) }) }) })
590
+ ] });
591
+ }, dt = "fIA0W", ut = "I6plu", Q = {
592
+ successContainer: dt,
593
+ successBtn: ut
594
+ }, mt = ({ products: e, id: n, onSuccess: s, onCancel: o, onClose: l }) => {
595
+ const [a, c] = E(!1), { t: d } = x(), g = () => {
596
+ c(!1), l && l(), window.location.href = "/";
597
+ };
598
+ return /* @__PURE__ */ f("div", { className: "cc-scope", children: [
599
+ !a && /* @__PURE__ */ f(Te, { className: "p-3", children: [
600
+ /* @__PURE__ */ t(st, {}),
601
+ /* @__PURE__ */ t(lt, { setSuccess: c, success: a, products: e, onSuccess: s, id: n, onCancel: o, onClose: l })
602
+ ] }),
603
+ a && /* @__PURE__ */ t("div", { className: Q.successContainer, children: /* @__PURE__ */ f("div", { className: "text-center", children: [
604
+ /* @__PURE__ */ t("h2", { className: "fw-bold fs-2", style: { marginBottom: "3.2rem" }, children: d("cart_form.success_title") }),
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: Q.successBtn, onClick: g, children: d("cart_form.success_button") })
607
+ ] }) })
608
+ ] });
609
+ }, vt = ({ id: e, locale: n, products: s, onSuccess: o, onCancel: l, onClose: a }) => (q(() => {
610
+ J.changeLanguage(n);
611
+ }, [n]), /* @__PURE__ */ t(Be, { i18n: J, children: /* @__PURE__ */ f(ke, { apiKey: "AIzaSyAnJmWEU1r63DiRWHkjczxzHyIEq3dhj4M", libraries: ["places"], children: [
612
+ /* @__PURE__ */ t("script", { src: "https://maps.googleapis.com/maps/api/js?key=AIzaSyAnJmWEU1r63DiRWHkjczxzHyIEq3dhj4M&libraries=places" }),
613
+ /* @__PURE__ */ t(fe, { id: e, children: /* @__PURE__ */ t(Ce, { children: /* @__PURE__ */ t(ge, { autoLocate: !1, products: s, children: /* @__PURE__ */ t(Ne, { children: /* @__PURE__ */ t(mt, { id: e, products: s, onSuccess: o, onCancel: l, onClose: a }) }) }) }) })
614
+ ] }) }));
615
+ export {
616
+ vt as default
617
+ };