@orderingstack/front-hooks 5.3.0 → 5.3.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/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var Ve = Object.defineProperty;
|
|
2
2
|
var ze = (t, r, e) => r in t ? Ve(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
|
|
3
|
-
var
|
|
3
|
+
var W = (t, r, e) => (ze(t, typeof r != "symbol" ? r + "" : r, e), e);
|
|
4
4
|
import { useRef as Je, useState as Q, useEffect as rt, useContext as Xt } from "react";
|
|
5
5
|
import ue from "axios";
|
|
6
6
|
import { ConfigContext as kt } from "@orderingstack/ordering-core-react";
|
|
@@ -361,8 +361,8 @@ var Wt = {}, qi = {
|
|
|
361
361
|
var w = g - 60 * I * 1e3, N = v(w, E);
|
|
362
362
|
if (I === N)
|
|
363
363
|
return [w, I];
|
|
364
|
-
var
|
|
365
|
-
return N ===
|
|
364
|
+
var q = v(w -= 60 * (N - I) * 1e3, E);
|
|
365
|
+
return N === q ? [w, N] : [g - 60 * Math.min(N, q) * 1e3, Math.max(N, q)];
|
|
366
366
|
}(i.utc(p, $).valueOf(), C, O), u = o[0], h = o[1], c = i(u).utcOffset(h);
|
|
367
367
|
return c.$x.$timezone = O, c;
|
|
368
368
|
}, i.tz.guess = function() {
|
|
@@ -406,7 +406,7 @@ var Kt = {}, zi = {
|
|
|
406
406
|
} }, c = "en", g = {};
|
|
407
407
|
g[c] = o;
|
|
408
408
|
var I = function(j) {
|
|
409
|
-
return j instanceof
|
|
409
|
+
return j instanceof q;
|
|
410
410
|
}, E = function j(m, _, S) {
|
|
411
411
|
var A;
|
|
412
412
|
if (!m)
|
|
@@ -426,12 +426,12 @@ var Kt = {}, zi = {
|
|
|
426
426
|
if (I(j))
|
|
427
427
|
return j.clone();
|
|
428
428
|
var _ = typeof m == "object" ? m : {};
|
|
429
|
-
return _.date = j, _.args = arguments, new
|
|
429
|
+
return _.date = j, _.args = arguments, new q(_);
|
|
430
430
|
}, N = h;
|
|
431
431
|
N.l = E, N.i = I, N.w = function(j, m) {
|
|
432
432
|
return w(j, { locale: m.$L, utc: m.$u, x: m.$x, $offset: m.$offset });
|
|
433
433
|
};
|
|
434
|
-
var
|
|
434
|
+
var q = function() {
|
|
435
435
|
function j(_) {
|
|
436
436
|
this.$L = E(_.locale, null, !0), this.parse(_);
|
|
437
437
|
}
|
|
@@ -476,11 +476,11 @@ var Kt = {}, zi = {
|
|
|
476
476
|
return this.$d.getTime();
|
|
477
477
|
}, m.startOf = function(_, S) {
|
|
478
478
|
var A = this, L = !!N.u(S) || S, D = N.p(_), P = function(tt, B) {
|
|
479
|
-
var
|
|
480
|
-
return L ?
|
|
479
|
+
var z = N.w(A.$u ? Date.UTC(A.$y, B, tt) : new Date(A.$y, B, tt), A);
|
|
480
|
+
return L ? z : z.endOf(v);
|
|
481
481
|
}, F = function(tt, B) {
|
|
482
482
|
return N.w(A.toDate()[tt].apply(A.toDate("s"), (L ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(B)), A);
|
|
483
|
-
}, x = this.$W, M = this.$M,
|
|
483
|
+
}, x = this.$W, M = this.$M, V = this.$D, H = "set" + (this.$u ? "UTC" : "");
|
|
484
484
|
switch (D) {
|
|
485
485
|
case b:
|
|
486
486
|
return L ? P(1, 0) : P(31, 11);
|
|
@@ -488,7 +488,7 @@ var Kt = {}, zi = {
|
|
|
488
488
|
return L ? P(1, M) : P(0, M + 1);
|
|
489
489
|
case d:
|
|
490
490
|
var ft = this.$locale().weekStart || 0, ut = (x < ft ? x + 7 : x) - ft;
|
|
491
|
-
return P(L ?
|
|
491
|
+
return P(L ? V - ut : V + (6 - ut), M);
|
|
492
492
|
case v:
|
|
493
493
|
case T:
|
|
494
494
|
return F(H + "Hours", 0);
|
|
@@ -519,8 +519,8 @@ var Kt = {}, zi = {
|
|
|
519
519
|
var A, L = this;
|
|
520
520
|
_ = Number(_);
|
|
521
521
|
var D = N.p(S), P = function(M) {
|
|
522
|
-
var
|
|
523
|
-
return N.w(
|
|
522
|
+
var V = w(L);
|
|
523
|
+
return N.w(V.date(V.date() + Math.round(M * _)), L);
|
|
524
524
|
};
|
|
525
525
|
if (D === y)
|
|
526
526
|
return this.set(y, this.$M + _);
|
|
@@ -538,16 +538,16 @@ var Kt = {}, zi = {
|
|
|
538
538
|
var S = this, A = this.$locale();
|
|
539
539
|
if (!this.isValid())
|
|
540
540
|
return A.invalidDate || $;
|
|
541
|
-
var L = _ || "YYYY-MM-DDTHH:mm:ssZ", D = N.z(this), P = this.$H, F = this.$m, x = this.$M, M = A.weekdays,
|
|
542
|
-
return B && (B[
|
|
541
|
+
var L = _ || "YYYY-MM-DDTHH:mm:ssZ", D = N.z(this), P = this.$H, F = this.$m, x = this.$M, M = A.weekdays, V = A.months, H = function(B, z, Nt, dt) {
|
|
542
|
+
return B && (B[z] || B(S, L)) || Nt[z].slice(0, dt);
|
|
543
543
|
}, ft = function(B) {
|
|
544
544
|
return N.s(P % 12 || 12, B, "0");
|
|
545
|
-
}, ut = A.meridiem || function(B,
|
|
545
|
+
}, ut = A.meridiem || function(B, z, Nt) {
|
|
546
546
|
var dt = B < 12 ? "AM" : "PM";
|
|
547
547
|
return Nt ? dt.toLowerCase() : dt;
|
|
548
|
-
}, tt = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: x + 1, MM: N.s(x + 1, 2, "0"), MMM: H(A.monthsShort, x,
|
|
549
|
-
return L.replace(C, function(B,
|
|
550
|
-
return
|
|
548
|
+
}, tt = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: x + 1, MM: N.s(x + 1, 2, "0"), MMM: H(A.monthsShort, x, V, 3), MMMM: H(V, x), D: this.$D, DD: N.s(this.$D, 2, "0"), d: String(this.$W), dd: H(A.weekdaysMin, this.$W, M, 2), ddd: H(A.weekdaysShort, this.$W, M, 3), dddd: M[this.$W], H: String(P), HH: N.s(P, 2, "0"), h: ft(1), hh: ft(2), a: ut(P, F, !0), A: ut(P, F, !1), m: String(F), mm: N.s(F, 2, "0"), s: String(this.$s), ss: N.s(this.$s, 2, "0"), SSS: N.s(this.$ms, 3, "0"), Z: D };
|
|
549
|
+
return L.replace(C, function(B, z) {
|
|
550
|
+
return z || tt[B] || D.replace(":", "");
|
|
551
551
|
});
|
|
552
552
|
}, m.utcOffset = function() {
|
|
553
553
|
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
@@ -574,13 +574,13 @@ var Kt = {}, zi = {
|
|
|
574
574
|
}, m.toString = function() {
|
|
575
575
|
return this.$d.toUTCString();
|
|
576
576
|
}, j;
|
|
577
|
-
}(), gr =
|
|
577
|
+
}(), gr = q.prototype;
|
|
578
578
|
return w.prototype = gr, [["$ms", a], ["$s", i], ["$m", f], ["$H", l], ["$W", v], ["$M", y], ["$y", b], ["$D", T]].forEach(function(j) {
|
|
579
579
|
gr[j[1]] = function(m) {
|
|
580
580
|
return this.$g(m, j[0], j[1]);
|
|
581
581
|
};
|
|
582
582
|
}), w.extend = function(j, m) {
|
|
583
|
-
return j.$i || (j(m,
|
|
583
|
+
return j.$i || (j(m, q, w), j.$i = !0), w;
|
|
584
584
|
}, w.locale = E, w.isDayjs = I, w.unix = function(j) {
|
|
585
585
|
return w(1e3 * j);
|
|
586
586
|
}, w.en = g[c], w.Ls = g, w.p = {}, w;
|
|
@@ -2089,12 +2089,12 @@ var Fg = function(t) {
|
|
|
2089
2089
|
})(Zt);
|
|
2090
2090
|
const Gg = [".png", ".jpg", ".jpeg", ".webp", ".bmp", ".tiff"], G = class {
|
|
2091
2091
|
constructor() {
|
|
2092
|
-
|
|
2092
|
+
W(this, "getUrl", (r, e) => {
|
|
2093
2093
|
const n = G.getMediaToolsUrl(r, e);
|
|
2094
2094
|
return G.status ? `${G.proxyUrl}?url=${encodeURIComponent(n)}` : n;
|
|
2095
2095
|
});
|
|
2096
2096
|
// supports different url per venue
|
|
2097
|
-
|
|
2097
|
+
W(this, "setProxyUrl", async (r) => {
|
|
2098
2098
|
const e = await G.checkStatus(r);
|
|
2099
2099
|
return e && (G.proxyUrl = r, setInterval(() => G.checkStatus(r), 6e4)), e;
|
|
2100
2100
|
});
|
|
@@ -2103,8 +2103,8 @@ const Gg = [".png", ".jpg", ".jpeg", ".webp", ".bmp", ".tiff"], G = class {
|
|
|
2103
2103
|
return this.instance || (this.instance = new G()), this.instance;
|
|
2104
2104
|
}
|
|
2105
2105
|
};
|
|
2106
|
-
let
|
|
2107
|
-
|
|
2106
|
+
let K = G;
|
|
2107
|
+
W(K, "instance"), W(K, "proxyUrl"), W(K, "status", !1), W(K, "getMediaToolsUrl", (r, e = 500) => {
|
|
2108
2108
|
const n = Zt.parseUrl(r);
|
|
2109
2109
|
if (!(r.startsWith(
|
|
2110
2110
|
"https://orderingstackmedia.blob.core.windows.net/pictures"
|
|
@@ -2120,21 +2120,21 @@ V(z, "instance"), V(z, "proxyUrl"), V(z, "status", !1), V(z, "getMediaToolsUrl",
|
|
|
2120
2120
|
),
|
|
2121
2121
|
query: { ...n.query, w: e }
|
|
2122
2122
|
}) : r;
|
|
2123
|
-
}),
|
|
2123
|
+
}), W(K, "checkStatus", async (r) => {
|
|
2124
2124
|
try {
|
|
2125
2125
|
return await ue.get(`${r}/status`), G.status = !0, !0;
|
|
2126
2126
|
} catch (e) {
|
|
2127
2127
|
return console.warn("ImageProxy is not available", e), !1;
|
|
2128
2128
|
}
|
|
2129
|
-
});
|
|
2129
|
+
}), W(K, "getStatus", () => G.status);
|
|
2130
2130
|
function Yg(t, r = 500) {
|
|
2131
|
-
return
|
|
2131
|
+
return K.getInstance().getUrl(t, r);
|
|
2132
2132
|
}
|
|
2133
2133
|
function s$(t, r = 500) {
|
|
2134
2134
|
return Yg(t, r);
|
|
2135
2135
|
}
|
|
2136
2136
|
export {
|
|
2137
|
-
|
|
2137
|
+
K as MediaProxy,
|
|
2138
2138
|
If as addDiscounts,
|
|
2139
2139
|
Xg as calculateDisplayPrice,
|
|
2140
2140
|
Jg as formatPrice,
|