@orderingstack/front-hooks 5.3.1 → 5.3.2
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.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +42 -41
- package/dist/index.es.js.map +1 -1
- package/dist/types/useMediaUrl.d.ts +1 -0
- package/dist/types/useMediaUrl.d.ts.map +1 -1
- package/package.json +3 -2
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 Y = (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";
|
|
@@ -44,7 +44,7 @@ function cn(t) {
|
|
|
44
44
|
on.call(t, e) && e != "constructor" && r.push(e);
|
|
45
45
|
return r;
|
|
46
46
|
}
|
|
47
|
-
var he = cn, fn = typeof Z == "object" && Z && Z.Object === Object && Z, ge = fn, un = ge, ln = typeof self == "object" && self && self.Object === Object && self, hn = un || ln || Function("return this")(),
|
|
47
|
+
var he = cn, fn = typeof Z == "object" && Z && Z.Object === Object && Z, ge = fn, un = ge, ln = typeof self == "object" && self && self.Object === Object && self, hn = un || ln || Function("return this")(), W = hn, gn = W, $n = gn.Symbol, Et = $n, $r = Et, $e = Object.prototype, vn = $e.hasOwnProperty, dn = $e.toString, lt = $r ? $r.toStringTag : void 0;
|
|
48
48
|
function yn(t) {
|
|
49
49
|
var r = vn.call(t, lt), e = t[lt];
|
|
50
50
|
try {
|
|
@@ -75,7 +75,7 @@ function Rn(t) {
|
|
|
75
75
|
var r = Dn(t);
|
|
76
76
|
return r == jn || r == Nn || r == Ln || r == Pn;
|
|
77
77
|
}
|
|
78
|
-
var ve = Rn, Un =
|
|
78
|
+
var ve = Rn, Un = W, xn = Un["__core-js_shared__"], Fn = xn, Pt = Fn, yr = function() {
|
|
79
79
|
var t = /[^.]+$/.exec(Pt && Pt.keys && Pt.keys.IE_PROTO || "");
|
|
80
80
|
return t ? "Symbol(src)_1." + t : "";
|
|
81
81
|
}();
|
|
@@ -114,7 +114,7 @@ function oa(t, r) {
|
|
|
114
114
|
var e = sa(t, r);
|
|
115
115
|
return ia(e) ? e : void 0;
|
|
116
116
|
}
|
|
117
|
-
var k = oa, ca = k, fa =
|
|
117
|
+
var k = oa, ca = k, fa = W, ua = ca(fa, "DataView"), la = ua, ha = k, ga = W, $a = ha(ga, "Map"), rr = $a, va = k, da = W, ya = va(da, "Promise"), pa = ya, _a = k, ba = W, Aa = _a(ba, "Set"), ye = Aa, ma = k, Ta = W, Oa = ma(Ta, "WeakMap"), Ea = Oa, Ft = la, Mt = rr, Bt = pa, Gt = ye, Yt = Ea, pe = It, nt = de, pr = "[object Map]", Ia = "[object Object]", _r = "[object Promise]", br = "[object Set]", Ar = "[object WeakMap]", mr = "[object DataView]", Sa = nt(Ft), wa = nt(Mt), Da = nt(Bt), Ca = nt(Gt), La = nt(Yt), J = pe;
|
|
118
118
|
(Ft && J(new Ft(new ArrayBuffer(1))) != mr || Mt && J(new Mt()) != pr || Bt && J(Bt.resolve()) != _r || Gt && J(new Gt()) != br || Yt && J(new Yt()) != Ar) && (J = function(t) {
|
|
119
119
|
var r = pe(t), e = r == Ia ? t.constructor : void 0, n = e ? nt(e) : "";
|
|
120
120
|
if (n)
|
|
@@ -165,7 +165,7 @@ function Ja() {
|
|
|
165
165
|
}
|
|
166
166
|
var Za = Ja;
|
|
167
167
|
(function(t, r) {
|
|
168
|
-
var e =
|
|
168
|
+
var e = W, n = Za, s = r && !r.nodeType && r, a = s && !0 && t && !t.nodeType && t, i = a && a.exports === s, f = i ? e.Buffer : void 0, l = f ? f.isBuffer : void 0, v = l || n;
|
|
169
169
|
t.exports = v;
|
|
170
170
|
})(za, X);
|
|
171
171
|
var Qa = It, Xa = Ae, ka = at, ti = "[object Arguments]", ri = "[object Array]", ei = "[object Boolean]", ni = "[object Date]", ai = "[object Error]", ii = "[object Function]", si = "[object Map]", oi = "[object Number]", ci = "[object Object]", fi = "[object RegExp]", ui = "[object Set]", li = "[object String]", hi = "[object WeakMap]", gi = "[object ArrayBuffer]", $i = "[object DataView]", vi = "[object Float32Array]", di = "[object Float64Array]", yi = "[object Int8Array]", pi = "[object Int16Array]", _i = "[object Int32Array]", bi = "[object Uint8Array]", Ai = "[object Uint8ClampedArray]", mi = "[object Uint16Array]", Ti = "[object Uint32Array]", U = {};
|
|
@@ -475,12 +475,12 @@ var Kt = {}, zi = {
|
|
|
475
475
|
}, m.valueOf = function() {
|
|
476
476
|
return this.$d.getTime();
|
|
477
477
|
}, m.startOf = function(_, S) {
|
|
478
|
-
var A = this, L = !!N.u(S) || S, D = N.p(_), P = function(tt,
|
|
479
|
-
var z = N.w(A.$u ? Date.UTC(A.$y,
|
|
478
|
+
var A = this, L = !!N.u(S) || S, D = N.p(_), P = function(tt, G) {
|
|
479
|
+
var z = N.w(A.$u ? Date.UTC(A.$y, G, tt) : new Date(A.$y, G, tt), A);
|
|
480
480
|
return L ? z : z.endOf(v);
|
|
481
|
-
}, F = function(tt,
|
|
482
|
-
return N.w(A.toDate()[tt].apply(A.toDate("s"), (L ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(
|
|
483
|
-
}, x = this.$W, M = this.$M, V = this.$D,
|
|
481
|
+
}, F = function(tt, G) {
|
|
482
|
+
return N.w(A.toDate()[tt].apply(A.toDate("s"), (L ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(G)), A);
|
|
483
|
+
}, x = this.$W, M = this.$M, V = this.$D, K = "set" + (this.$u ? "UTC" : "");
|
|
484
484
|
switch (D) {
|
|
485
485
|
case b:
|
|
486
486
|
return L ? P(1, 0) : P(31, 11);
|
|
@@ -491,13 +491,13 @@ var Kt = {}, zi = {
|
|
|
491
491
|
return P(L ? V - ut : V + (6 - ut), M);
|
|
492
492
|
case v:
|
|
493
493
|
case T:
|
|
494
|
-
return F(
|
|
494
|
+
return F(K + "Hours", 0);
|
|
495
495
|
case l:
|
|
496
|
-
return F(
|
|
496
|
+
return F(K + "Minutes", 1);
|
|
497
497
|
case f:
|
|
498
|
-
return F(
|
|
498
|
+
return F(K + "Seconds", 2);
|
|
499
499
|
case i:
|
|
500
|
-
return F(
|
|
500
|
+
return F(K + "Milliseconds", 3);
|
|
501
501
|
default:
|
|
502
502
|
return this.clone();
|
|
503
503
|
}
|
|
@@ -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, V = A.months,
|
|
542
|
-
return
|
|
543
|
-
}, ft = function(
|
|
544
|
-
return N.s(P % 12 || 12,
|
|
545
|
-
}, ut = A.meridiem || function(
|
|
546
|
-
var dt =
|
|
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, K = function(G, z, Nt, dt) {
|
|
542
|
+
return G && (G[z] || G(S, L)) || Nt[z].slice(0, dt);
|
|
543
|
+
}, ft = function(G) {
|
|
544
|
+
return N.s(P % 12 || 12, G, "0");
|
|
545
|
+
}, ut = A.meridiem || function(G, z, Nt) {
|
|
546
|
+
var dt = G < 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:
|
|
549
|
-
return L.replace(C, function(
|
|
550
|
-
return z || tt[
|
|
548
|
+
}, tt = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: x + 1, MM: N.s(x + 1, 2, "0"), MMM: K(A.monthsShort, x, V, 3), MMMM: K(V, x), D: this.$D, DD: N.s(this.$D, 2, "0"), d: String(this.$W), dd: K(A.weekdaysMin, this.$W, M, 2), ddd: K(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(G, z) {
|
|
550
|
+
return z || tt[G] || D.replace(":", "");
|
|
551
551
|
});
|
|
552
552
|
}, m.utcOffset = function() {
|
|
553
553
|
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
@@ -904,7 +904,7 @@ function ec(t, r, e, n, s, a) {
|
|
|
904
904
|
}
|
|
905
905
|
return a.delete(t), a.delete(r), p;
|
|
906
906
|
}
|
|
907
|
-
var Se = ec, nc =
|
|
907
|
+
var Se = ec, nc = W, ac = nc.Uint8Array, we = ac;
|
|
908
908
|
function ic(t) {
|
|
909
909
|
var r = -1, e = Array(t.size);
|
|
910
910
|
return t.forEach(function(n, s) {
|
|
@@ -1166,7 +1166,7 @@ var cu = ou, mt = {}, fu = {
|
|
|
1166
1166
|
}
|
|
1167
1167
|
};
|
|
1168
1168
|
(function(t, r) {
|
|
1169
|
-
var e =
|
|
1169
|
+
var e = W, n = r && !r.nodeType && r, s = n && !0 && t && !t.nodeType && t, a = s && s.exports === n, i = a ? e.Buffer : void 0, f = i ? i.allocUnsafe : void 0;
|
|
1170
1170
|
function l(v, d) {
|
|
1171
1171
|
if (d)
|
|
1172
1172
|
return v.slice();
|
|
@@ -2087,24 +2087,25 @@ var Fg = function(t) {
|
|
|
2087
2087
|
return t.pick(o, c, h);
|
|
2088
2088
|
};
|
|
2089
2089
|
})(Zt);
|
|
2090
|
-
const Gg = [".png", ".jpg", ".jpeg", ".webp", ".bmp", ".tiff"],
|
|
2090
|
+
const Gg = [".png", ".jpg", ".jpeg", ".webp", ".bmp", ".tiff"], B = class {
|
|
2091
2091
|
constructor() {
|
|
2092
|
-
|
|
2093
|
-
const n =
|
|
2094
|
-
return
|
|
2092
|
+
Y(this, "getUrl", (r, e) => {
|
|
2093
|
+
const n = B.getMediaToolsUrl(r, e);
|
|
2094
|
+
return B.status ? `${B.proxyUrl}?url=${encodeURIComponent(n)}` : n;
|
|
2095
2095
|
});
|
|
2096
2096
|
// supports different url per venue
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2097
|
+
Y(this, "setProxyUrl", async (r) => {
|
|
2098
|
+
B.interval && (clearInterval(B.interval), B.interval = null);
|
|
2099
|
+
const e = await B.checkStatus(r);
|
|
2100
|
+
return B.proxyUrl = r, B.interval = setInterval(() => B.checkStatus(r), 6e4), e;
|
|
2100
2101
|
});
|
|
2101
2102
|
}
|
|
2102
2103
|
static getInstance() {
|
|
2103
|
-
return this.instance || (this.instance = new
|
|
2104
|
+
return this.instance || (this.instance = new B()), this.instance;
|
|
2104
2105
|
}
|
|
2105
2106
|
};
|
|
2106
|
-
let
|
|
2107
|
-
|
|
2107
|
+
let H = B;
|
|
2108
|
+
Y(H, "instance"), Y(H, "proxyUrl"), Y(H, "status", !1), Y(H, "interval", null), Y(H, "getMediaToolsUrl", (r, e = 500) => {
|
|
2108
2109
|
const n = Zt.parseUrl(r);
|
|
2109
2110
|
if (!(r.startsWith(
|
|
2110
2111
|
"https://orderingstackmedia.blob.core.windows.net/pictures"
|
|
@@ -2120,21 +2121,21 @@ W(K, "instance"), W(K, "proxyUrl"), W(K, "status", !1), W(K, "getMediaToolsUrl",
|
|
|
2120
2121
|
),
|
|
2121
2122
|
query: { ...n.query, w: e }
|
|
2122
2123
|
}) : r;
|
|
2123
|
-
}),
|
|
2124
|
+
}), Y(H, "checkStatus", async (r) => {
|
|
2124
2125
|
try {
|
|
2125
|
-
return await ue.get(`${r}/status`),
|
|
2126
|
+
return await ue.get(`${r}/status`), B.status = !0, !0;
|
|
2126
2127
|
} catch (e) {
|
|
2127
|
-
return console.warn("ImageProxy is not available", e), !1;
|
|
2128
|
+
return console.warn("ImageProxy is not available", e), B.status = !1, !1;
|
|
2128
2129
|
}
|
|
2129
|
-
}),
|
|
2130
|
+
}), Y(H, "getStatus", () => B.status);
|
|
2130
2131
|
function Yg(t, r = 500) {
|
|
2131
|
-
return
|
|
2132
|
+
return H.getInstance().getUrl(t, r);
|
|
2132
2133
|
}
|
|
2133
2134
|
function s$(t, r = 500) {
|
|
2134
2135
|
return Yg(t, r);
|
|
2135
2136
|
}
|
|
2136
2137
|
export {
|
|
2137
|
-
|
|
2138
|
+
H as MediaProxy,
|
|
2138
2139
|
If as addDiscounts,
|
|
2139
2140
|
Xg as calculateDisplayPrice,
|
|
2140
2141
|
Jg as formatPrice,
|