@colabcommerce/elements 0.0.4 → 0.9.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.
Files changed (99) hide show
  1. package/.pnp.cjs +16484 -0
  2. package/.pnp.loader.mjs +2126 -0
  3. package/.yarn/install-state.gz +0 -0
  4. package/.yarn/releases/yarn-4.12.0.cjs +942 -0
  5. package/.yarnrc.yml +1 -0
  6. package/README.md +60 -41
  7. package/cypress/fixtures/example.json +5 -0
  8. package/cypress/support/commands.js +25 -0
  9. package/cypress/support/component-index.html +15 -0
  10. package/cypress/support/component.js +26 -0
  11. package/cypress.config.js +10 -0
  12. package/eslint.config.js +32 -0
  13. package/index.html +13 -0
  14. package/package.json +91 -67
  15. package/playground/index.html +14 -0
  16. package/playground/main.jsx +36 -0
  17. package/public/vite.svg +1 -0
  18. package/src/App.css +0 -0
  19. package/src/App.jsx +65 -0
  20. package/src/components/CollapsibleStoreHours/index.jsx +269 -0
  21. package/src/components/HoursList/index.jsx +225 -0
  22. package/src/components/LeadForm/index.jsx +241 -0
  23. package/src/components/MessageDialog/index.jsx +169 -0
  24. package/src/components/QuoteForm/index.jsx +82 -0
  25. package/src/components/QuoteFormSearch/index.jsx +276 -0
  26. package/src/components/QuoteFormStoreList/index.jsx +65 -0
  27. package/src/components/QuoteFormStoreListItem/index.jsx +134 -0
  28. package/src/components/QuoteLeadForm/index.jsx +16 -0
  29. package/src/components/QuoteMap/index.jsx +96 -0
  30. package/src/components/QuoteMapMarker/index.jsx +56 -0
  31. package/src/components/StaticMap/index.jsx +24 -0
  32. package/src/components/Store/index.jsx +44 -0
  33. package/src/components/StoreContact/index.jsx +96 -0
  34. package/src/components/StoreInfo/index.jsx +50 -0
  35. package/src/components/StoreList/index.jsx +59 -0
  36. package/src/components/StoreListItem/index.jsx +99 -0
  37. package/src/components/StoreListItem/indexStoreListItem.cy.jsx +30 -0
  38. package/src/components/StoreListNoneFound/index.jsx +16 -0
  39. package/src/components/StoreLocator/index.jsx +43 -0
  40. package/src/components/StoreLocatorMap/index.jsx +93 -0
  41. package/src/components/StoreLocatorMapMarker/index.jsx +55 -0
  42. package/src/components/StoreLocatorMessageDialog/index.jsx +20 -0
  43. package/src/components/StoreLocatorSearch/index.jsx +316 -0
  44. package/src/components/StoreMap/index.jsx +30 -0
  45. package/src/components/StoreMeta/index.jsx +7 -0
  46. package/src/components/StoreProducts/index.jsx +112 -0
  47. package/src/components/ui/Badge/index.jsx +46 -0
  48. package/src/components/ui/Button/index.jsx +56 -0
  49. package/src/components/ui/Button/indexButton.cy.jsx +9 -0
  50. package/src/components/ui/Card/index.jsx +90 -0
  51. package/src/components/ui/Input/index.jsx +19 -0
  52. package/src/components/ui/Input/indexInput.cy.jsx +9 -0
  53. package/src/components/ui/LoadingPuff/index.jsx +10 -0
  54. package/src/components/ui/Panel/index.jsx +23 -0
  55. package/src/components/ui/PhoneNumberInput/index.jsx +17 -0
  56. package/src/contexts/quote-form.jsx +94 -0
  57. package/src/contexts/store-locator.jsx +83 -0
  58. package/src/contexts/store.jsx +59 -0
  59. package/src/contexts/translations.jsx +11 -0
  60. package/src/dist.css +229 -0
  61. package/src/entries/QuoteForm.js +2 -0
  62. package/src/entries/Store.js +2 -0
  63. package/src/entries/StoreLocator.js +2 -0
  64. package/src/entries/StoreLocatorProvider.js +2 -0
  65. package/src/entries/styles.js +2 -0
  66. package/src/entries/useStoreLocator.js +2 -0
  67. package/src/i18n/defaultResources.js +19 -0
  68. package/src/i18n/index.js +44 -0
  69. package/src/i18n/mergeResources.js +22 -0
  70. package/src/index.css +214 -0
  71. package/src/lib/addressComponentsToAddress.js +43 -0
  72. package/src/lib/productSchema.js +6 -0
  73. package/src/lib/useGeolocation.js +266 -0
  74. package/src/lib/useHours.js +205 -0
  75. package/src/lib/usePlacesAutocomplete.js +288 -0
  76. package/src/lib/useProductAvailability.js +38 -0
  77. package/src/lib/useRudderAnalytics.js +50 -0
  78. package/src/lib/useSearchResults.js +102 -0
  79. package/src/lib/useStoreLocatorConfig.js +50 -0
  80. package/src/lib/utils/cn.js +6 -0
  81. package/src/lib/utils/measure.js +31 -0
  82. package/src/locales/en/default.json +58 -0
  83. package/src/locales/es/default.json +58 -0
  84. package/src/locales/fr/default.json +58 -0
  85. package/src/locales/it/default.json +58 -0
  86. package/src/main.jsx +10 -0
  87. package/vite.config.js +60 -53
  88. package/dist/CartForm.js +0 -617
  89. package/dist/Container-CU_WrBOi.js +0 -22
  90. package/dist/Modal-DTBKy_6d.js +0 -863
  91. package/dist/ProductForm.js +0 -343
  92. package/dist/Retailer.js +0 -3637
  93. package/dist/StoreLocator.js +0 -797
  94. package/dist/addressComponentsToAddress-DCL-K8mn.js +0 -1932
  95. package/dist/browser-ponyfill-DcK7_cJB.js +0 -339
  96. package/dist/globals-B8-hYoIU.js +0 -8518
  97. package/dist/index-CqSfhXDd.js +0 -137
  98. package/dist/index-FM02Uq_P.js +0 -100
  99. package/dist/style.css +0 -1
@@ -1,339 +0,0 @@
1
- import { W as G, V as R } from "./globals-B8-hYoIU.js";
2
- function z(w, d) {
3
- for (var b = 0; b < d.length; b++) {
4
- const y = d[b];
5
- if (typeof y != "string" && !Array.isArray(y)) {
6
- for (const h in y)
7
- if (h !== "default" && !(h in w)) {
8
- const p = Object.getOwnPropertyDescriptor(y, h);
9
- p && Object.defineProperty(w, h, p.get ? p : {
10
- enumerable: !0,
11
- get: () => y[h]
12
- });
13
- }
14
- }
15
- }
16
- return Object.freeze(Object.defineProperty(w, Symbol.toStringTag, { value: "Module" }));
17
- }
18
- var O = { exports: {} };
19
- (function(w, d) {
20
- var b = typeof globalThis < "u" && globalThis || typeof self < "u" && self || typeof R < "u" && R, y = function() {
21
- function p() {
22
- this.fetch = !1, this.DOMException = b.DOMException;
23
- }
24
- return p.prototype = b, new p();
25
- }();
26
- (function(p) {
27
- (function(u) {
28
- var a = typeof p < "u" && p || typeof self < "u" && self || typeof a < "u" && a, f = {
29
- searchParams: "URLSearchParams" in a,
30
- iterable: "Symbol" in a && "iterator" in Symbol,
31
- blob: "FileReader" in a && "Blob" in a && function() {
32
- try {
33
- return new Blob(), !0;
34
- } catch {
35
- return !1;
36
- }
37
- }(),
38
- formData: "FormData" in a,
39
- arrayBuffer: "ArrayBuffer" in a
40
- };
41
- function j(e) {
42
- return e && DataView.prototype.isPrototypeOf(e);
43
- }
44
- if (f.arrayBuffer)
45
- var S = [
46
- "[object Int8Array]",
47
- "[object Uint8Array]",
48
- "[object Uint8ClampedArray]",
49
- "[object Int16Array]",
50
- "[object Uint16Array]",
51
- "[object Int32Array]",
52
- "[object Uint32Array]",
53
- "[object Float32Array]",
54
- "[object Float64Array]"
55
- ], F = ArrayBuffer.isView || function(e) {
56
- return e && S.indexOf(Object.prototype.toString.call(e)) > -1;
57
- };
58
- function v(e) {
59
- if (typeof e != "string" && (e = String(e)), /[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e) || e === "")
60
- throw new TypeError('Invalid character in header field name: "' + e + '"');
61
- return e.toLowerCase();
62
- }
63
- function A(e) {
64
- return typeof e != "string" && (e = String(e)), e;
65
- }
66
- function E(e) {
67
- var t = {
68
- next: function() {
69
- var r = e.shift();
70
- return { done: r === void 0, value: r };
71
- }
72
- };
73
- return f.iterable && (t[Symbol.iterator] = function() {
74
- return t;
75
- }), t;
76
- }
77
- function s(e) {
78
- this.map = {}, e instanceof s ? e.forEach(function(t, r) {
79
- this.append(r, t);
80
- }, this) : Array.isArray(e) ? e.forEach(function(t) {
81
- this.append(t[0], t[1]);
82
- }, this) : e && Object.getOwnPropertyNames(e).forEach(function(t) {
83
- this.append(t, e[t]);
84
- }, this);
85
- }
86
- s.prototype.append = function(e, t) {
87
- e = v(e), t = A(t);
88
- var r = this.map[e];
89
- this.map[e] = r ? r + ", " + t : t;
90
- }, s.prototype.delete = function(e) {
91
- delete this.map[v(e)];
92
- }, s.prototype.get = function(e) {
93
- return e = v(e), this.has(e) ? this.map[e] : null;
94
- }, s.prototype.has = function(e) {
95
- return this.map.hasOwnProperty(v(e));
96
- }, s.prototype.set = function(e, t) {
97
- this.map[v(e)] = A(t);
98
- }, s.prototype.forEach = function(e, t) {
99
- for (var r in this.map)
100
- this.map.hasOwnProperty(r) && e.call(t, this.map[r], r, this);
101
- }, s.prototype.keys = function() {
102
- var e = [];
103
- return this.forEach(function(t, r) {
104
- e.push(r);
105
- }), E(e);
106
- }, s.prototype.values = function() {
107
- var e = [];
108
- return this.forEach(function(t) {
109
- e.push(t);
110
- }), E(e);
111
- }, s.prototype.entries = function() {
112
- var e = [];
113
- return this.forEach(function(t, r) {
114
- e.push([r, t]);
115
- }), E(e);
116
- }, f.iterable && (s.prototype[Symbol.iterator] = s.prototype.entries);
117
- function T(e) {
118
- if (e.bodyUsed)
119
- return Promise.reject(new TypeError("Already read"));
120
- e.bodyUsed = !0;
121
- }
122
- function P(e) {
123
- return new Promise(function(t, r) {
124
- e.onload = function() {
125
- t(e.result);
126
- }, e.onerror = function() {
127
- r(e.error);
128
- };
129
- });
130
- }
131
- function I(e) {
132
- var t = new FileReader(), r = P(t);
133
- return t.readAsArrayBuffer(e), r;
134
- }
135
- function M(e) {
136
- var t = new FileReader(), r = P(t);
137
- return t.readAsText(e), r;
138
- }
139
- function H(e) {
140
- for (var t = new Uint8Array(e), r = new Array(t.length), n = 0; n < t.length; n++)
141
- r[n] = String.fromCharCode(t[n]);
142
- return r.join("");
143
- }
144
- function D(e) {
145
- if (e.slice)
146
- return e.slice(0);
147
- var t = new Uint8Array(e.byteLength);
148
- return t.set(new Uint8Array(e)), t.buffer;
149
- }
150
- function x() {
151
- return this.bodyUsed = !1, this._initBody = function(e) {
152
- this.bodyUsed = this.bodyUsed, this._bodyInit = e, e ? typeof e == "string" ? this._bodyText = e : f.blob && Blob.prototype.isPrototypeOf(e) ? this._bodyBlob = e : f.formData && FormData.prototype.isPrototypeOf(e) ? this._bodyFormData = e : f.searchParams && URLSearchParams.prototype.isPrototypeOf(e) ? this._bodyText = e.toString() : f.arrayBuffer && f.blob && j(e) ? (this._bodyArrayBuffer = D(e.buffer), this._bodyInit = new Blob([this._bodyArrayBuffer])) : f.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(e) || F(e)) ? this._bodyArrayBuffer = D(e) : this._bodyText = e = Object.prototype.toString.call(e) : this._bodyText = "", this.headers.get("content-type") || (typeof e == "string" ? this.headers.set("content-type", "text/plain;charset=UTF-8") : this._bodyBlob && this._bodyBlob.type ? this.headers.set("content-type", this._bodyBlob.type) : f.searchParams && URLSearchParams.prototype.isPrototypeOf(e) && this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8"));
153
- }, f.blob && (this.blob = function() {
154
- var e = T(this);
155
- if (e)
156
- return e;
157
- if (this._bodyBlob)
158
- return Promise.resolve(this._bodyBlob);
159
- if (this._bodyArrayBuffer)
160
- return Promise.resolve(new Blob([this._bodyArrayBuffer]));
161
- if (this._bodyFormData)
162
- throw new Error("could not read FormData body as blob");
163
- return Promise.resolve(new Blob([this._bodyText]));
164
- }, this.arrayBuffer = function() {
165
- if (this._bodyArrayBuffer) {
166
- var e = T(this);
167
- return e || (ArrayBuffer.isView(this._bodyArrayBuffer) ? Promise.resolve(
168
- this._bodyArrayBuffer.buffer.slice(
169
- this._bodyArrayBuffer.byteOffset,
170
- this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
171
- )
172
- ) : Promise.resolve(this._bodyArrayBuffer));
173
- } else
174
- return this.blob().then(I);
175
- }), this.text = function() {
176
- var e = T(this);
177
- if (e)
178
- return e;
179
- if (this._bodyBlob)
180
- return M(this._bodyBlob);
181
- if (this._bodyArrayBuffer)
182
- return Promise.resolve(H(this._bodyArrayBuffer));
183
- if (this._bodyFormData)
184
- throw new Error("could not read FormData body as text");
185
- return Promise.resolve(this._bodyText);
186
- }, f.formData && (this.formData = function() {
187
- return this.text().then(C);
188
- }), this.json = function() {
189
- return this.text().then(JSON.parse);
190
- }, this;
191
- }
192
- var q = ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT"];
193
- function L(e) {
194
- var t = e.toUpperCase();
195
- return q.indexOf(t) > -1 ? t : e;
196
- }
197
- function m(e, t) {
198
- if (!(this instanceof m))
199
- throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
200
- t = t || {};
201
- var r = t.body;
202
- if (e instanceof m) {
203
- if (e.bodyUsed)
204
- throw new TypeError("Already read");
205
- this.url = e.url, this.credentials = e.credentials, t.headers || (this.headers = new s(e.headers)), this.method = e.method, this.mode = e.mode, this.signal = e.signal, !r && e._bodyInit != null && (r = e._bodyInit, e.bodyUsed = !0);
206
- } else
207
- this.url = String(e);
208
- if (this.credentials = t.credentials || this.credentials || "same-origin", (t.headers || !this.headers) && (this.headers = new s(t.headers)), this.method = L(t.method || this.method || "GET"), this.mode = t.mode || this.mode || null, this.signal = t.signal || this.signal, this.referrer = null, (this.method === "GET" || this.method === "HEAD") && r)
209
- throw new TypeError("Body not allowed for GET or HEAD requests");
210
- if (this._initBody(r), (this.method === "GET" || this.method === "HEAD") && (t.cache === "no-store" || t.cache === "no-cache")) {
211
- var n = /([?&])_=[^&]*/;
212
- if (n.test(this.url))
213
- this.url = this.url.replace(n, "$1_=" + (/* @__PURE__ */ new Date()).getTime());
214
- else {
215
- var i = /\?/;
216
- this.url += (i.test(this.url) ? "&" : "?") + "_=" + (/* @__PURE__ */ new Date()).getTime();
217
- }
218
- }
219
- }
220
- m.prototype.clone = function() {
221
- return new m(this, { body: this._bodyInit });
222
- };
223
- function C(e) {
224
- var t = new FormData();
225
- return e.trim().split("&").forEach(function(r) {
226
- if (r) {
227
- var n = r.split("="), i = n.shift().replace(/\+/g, " "), o = n.join("=").replace(/\+/g, " ");
228
- t.append(decodeURIComponent(i), decodeURIComponent(o));
229
- }
230
- }), t;
231
- }
232
- function k(e) {
233
- var t = new s(), r = e.replace(/\r?\n[\t ]+/g, " ");
234
- return r.split("\r").map(function(n) {
235
- return n.indexOf(`
236
- `) === 0 ? n.substr(1, n.length) : n;
237
- }).forEach(function(n) {
238
- var i = n.split(":"), o = i.shift().trim();
239
- if (o) {
240
- var _ = i.join(":").trim();
241
- t.append(o, _);
242
- }
243
- }), t;
244
- }
245
- x.call(m.prototype);
246
- function c(e, t) {
247
- if (!(this instanceof c))
248
- throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
249
- t || (t = {}), this.type = "default", this.status = t.status === void 0 ? 200 : t.status, this.ok = this.status >= 200 && this.status < 300, this.statusText = t.statusText === void 0 ? "" : "" + t.statusText, this.headers = new s(t.headers), this.url = t.url || "", this._initBody(e);
250
- }
251
- x.call(c.prototype), c.prototype.clone = function() {
252
- return new c(this._bodyInit, {
253
- status: this.status,
254
- statusText: this.statusText,
255
- headers: new s(this.headers),
256
- url: this.url
257
- });
258
- }, c.error = function() {
259
- var e = new c(null, { status: 0, statusText: "" });
260
- return e.type = "error", e;
261
- };
262
- var N = [301, 302, 303, 307, 308];
263
- c.redirect = function(e, t) {
264
- if (N.indexOf(t) === -1)
265
- throw new RangeError("Invalid status code");
266
- return new c(null, { status: t, headers: { location: e } });
267
- }, u.DOMException = a.DOMException;
268
- try {
269
- new u.DOMException();
270
- } catch {
271
- u.DOMException = function(t, r) {
272
- this.message = t, this.name = r;
273
- var n = Error(t);
274
- this.stack = n.stack;
275
- }, u.DOMException.prototype = Object.create(Error.prototype), u.DOMException.prototype.constructor = u.DOMException;
276
- }
277
- function B(e, t) {
278
- return new Promise(function(r, n) {
279
- var i = new m(e, t);
280
- if (i.signal && i.signal.aborted)
281
- return n(new u.DOMException("Aborted", "AbortError"));
282
- var o = new XMLHttpRequest();
283
- function _() {
284
- o.abort();
285
- }
286
- o.onload = function() {
287
- var l = {
288
- status: o.status,
289
- statusText: o.statusText,
290
- headers: k(o.getAllResponseHeaders() || "")
291
- };
292
- l.url = "responseURL" in o ? o.responseURL : l.headers.get("X-Request-URL");
293
- var g = "response" in o ? o.response : o.responseText;
294
- setTimeout(function() {
295
- r(new c(g, l));
296
- }, 0);
297
- }, o.onerror = function() {
298
- setTimeout(function() {
299
- n(new TypeError("Network request failed"));
300
- }, 0);
301
- }, o.ontimeout = function() {
302
- setTimeout(function() {
303
- n(new TypeError("Network request failed"));
304
- }, 0);
305
- }, o.onabort = function() {
306
- setTimeout(function() {
307
- n(new u.DOMException("Aborted", "AbortError"));
308
- }, 0);
309
- };
310
- function V(l) {
311
- try {
312
- return l === "" && a.location.href ? a.location.href : l;
313
- } catch {
314
- return l;
315
- }
316
- }
317
- o.open(i.method, V(i.url), !0), i.credentials === "include" ? o.withCredentials = !0 : i.credentials === "omit" && (o.withCredentials = !1), "responseType" in o && (f.blob ? o.responseType = "blob" : f.arrayBuffer && i.headers.get("Content-Type") && i.headers.get("Content-Type").indexOf("application/octet-stream") !== -1 && (o.responseType = "arraybuffer")), t && typeof t.headers == "object" && !(t.headers instanceof s) ? Object.getOwnPropertyNames(t.headers).forEach(function(l) {
318
- o.setRequestHeader(l, A(t.headers[l]));
319
- }) : i.headers.forEach(function(l, g) {
320
- o.setRequestHeader(g, l);
321
- }), i.signal && (i.signal.addEventListener("abort", _), o.onreadystatechange = function() {
322
- o.readyState === 4 && i.signal.removeEventListener("abort", _);
323
- }), o.send(typeof i._bodyInit > "u" ? null : i._bodyInit);
324
- });
325
- }
326
- return B.polyfill = !0, a.fetch || (a.fetch = B, a.Headers = s, a.Request = m, a.Response = c), u.Headers = s, u.Request = m, u.Response = c, u.fetch = B, u;
327
- })({});
328
- })(y), y.fetch.ponyfill = !0, delete y.fetch.polyfill;
329
- var h = b.fetch ? b : y;
330
- d = h.fetch, d.default = h.fetch, d.fetch = h.fetch, d.Headers = h.Headers, d.Request = h.Request, d.Response = h.Response, w.exports = d;
331
- })(O, O.exports);
332
- var U = O.exports;
333
- const $ = /* @__PURE__ */ G(U), J = /* @__PURE__ */ z({
334
- __proto__: null,
335
- default: $
336
- }, [U]);
337
- export {
338
- J as b
339
- };