@feedmepos/mf-inventory-portal 0.0.25-dev.19 → 0.0.25-dev.20
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/{App-Hgn8IBaK.js → App-oGRS_PEV.js} +2 -2
- package/dist/{ApprovalView-BSk9kEGm.js → ApprovalView-BnTD6HJE.js} +2 -2
- package/dist/{BindingsDialog-SxUwbW5x.js → BindingsDialog-DLLq9cDi.js} +2 -2
- package/dist/{BindingsPicker-_zOGJ17i.js → BindingsPicker-NXJruTzV.js} +1 -1
- package/dist/{BindingsTable-I8MLwuIR.js → BindingsTable-Bs211Phb.js} +1 -1
- package/dist/{ClosingDraftView-D80vDRO7.js → ClosingDraftView-B4_2-44Y.js} +2 -2
- package/dist/{ClosingTemplateView-BCE-SHm9.js → ClosingTemplateView-Db6Fn2kD.js} +2 -2
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BmLxDo6V.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-YNtFlw4B.js} +25 -25
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-D21lpws0.js → FmUnitInput.vue_vue_type_script_setup_true_lang-jnn4TF71.js} +1 -1
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-WTlNX0f8.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-nP9OAqMD.js} +1 -1
- package/dist/{IngredientGroupView-DDD_-og5.js → IngredientGroupView-Bc2_n2PG.js} +1 -1
- package/dist/{IngredientsView-CJ4F7BwZ.js → IngredientsView-BePK8LAK.js} +4 -4
- package/dist/{IntegrationView-B0TjX4yz.js → IntegrationView-CfpQDaZj.js} +1 -1
- package/dist/{InventoryBindingForm-DGXN2PXz.js → InventoryBindingForm-BiwiGKsQ.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-gQNCKIfa.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DgOJi8Lz.js} +3 -3
- package/dist/{InventoryBindingSummary-CDAivJA8.js → InventoryBindingSummary-CIMPOjDM.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CfaZ1GtI.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-B-XKuP8P.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DmhP_O3l.js → PremiumBadge.vue_vue_type_script_setup_true_lang-45qs9f6I.js} +1 -1
- package/dist/{PublishView-DvriUy_9.js → PublishView-DgtRnkwT.js} +2 -2
- package/dist/{PurchaseOrderPrintPreview-Dr-I6VKI.js → PurchaseOrderPrintPreview-Cp_Ye4dK.js} +1 -1
- package/dist/{ReceiveRequestView-FcC0nStC.js → ReceiveRequestView-oe1V_bVC.js} +161 -160
- package/dist/{RecipeView-BMYzOsb2.js → RecipeView-Dy6W78uU.js} +3 -3
- package/dist/{StockView-gTmg4gih.js → StockView-D2kDteQe.js} +7 -7
- package/dist/{SupplierView-CrixDjq3.js → SupplierView-rNltG4Fy.js} +4 -4
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CX9l0sM4.js +1769 -0
- package/dist/{TransferTemplateView-DhgyCwnD.js → TransferTemplateView-PcJvtsk4.js} +7 -7
- package/dist/{UnitView-Bll1VTnD.js → UnitView-BSWzk_pn.js} +3 -3
- package/dist/{WarehouseView-KstzwWxq.js → WarehouseView-Dh-Q19A6.js} +1 -1
- package/dist/api/purchase-order.d.ts +1 -1
- package/dist/{app-qyqp2u_f.js → app-Dyd8pohX.js} +10 -10
- package/dist/app.js +1 -1
- package/dist/{decimal-BQ6Hkwom.js → decimal-aSw2Jae-.js} +1 -1
- package/dist/{feature-C6Z6N_iv.js → feature-BdLkjjxs.js} +215 -211
- package/dist/{format-unit-display-T-fT7FAg.js → format-unit-display-Ca92KbGT.js} +2 -2
- package/dist/{index-B6HIaHJq.js → index-Cvl2NcJ7.js} +2 -2
- package/dist/{stock-Cd6rXnhv.js → stock-CvQLThK4.js} +1 -1
- package/dist/stores/feature.d.ts +4 -3
- package/dist/{supplier-b6qWYeQu.js → supplier-C5hvXTbC.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-C8sylcwR.js → use-ingredient-select-dialog-BP_mP7e_.js} +1 -1
- package/dist/{use-inventory-binding-dialog-D7wI4_lU.js → use-inventory-binding-dialog-C_bBts1K.js} +1 -1
- package/dist/views/receive-request/components/transfer-details/TransferDetails.vue.d.ts +1 -1
- package/dist/views/receive-request/helper/print-po.d.ts +9 -2
- package/dist/{vue-i18n-BmWUvN1e.js → vue-i18n-Clx6r-KT.js} +209 -209
- package/package.json +3 -3
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-15cqyqCC.js +0 -1567
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
var fe = Object.defineProperty;
|
|
2
|
-
var pe = (
|
|
3
|
-
var ct = (
|
|
2
|
+
var pe = (S, u, v) => u in S ? fe(S, u, { enumerable: !0, configurable: !0, writable: !0, value: v }) : S[u] = v;
|
|
3
|
+
var ct = (S, u, v) => pe(S, typeof u != "symbol" ? u + "" : u, v);
|
|
4
4
|
import { useCoreStore as ht } from "@feedmepos/mf-common";
|
|
5
|
-
import { a4 as vt, u as
|
|
6
|
-
import { ref as
|
|
5
|
+
import { a4 as vt, u as Dt, ax as ae, a as ye } from "./app-Dyd8pohX.js";
|
|
6
|
+
import { ref as gt, readonly as Kt } from "vue";
|
|
7
7
|
var Gt = { exports: {} };
|
|
8
|
-
(function(
|
|
8
|
+
(function(S, u) {
|
|
9
9
|
(function(v, d) {
|
|
10
|
-
d(
|
|
10
|
+
d(u);
|
|
11
11
|
})(vt, function(v) {
|
|
12
12
|
var d = { getItemSync: function(a) {
|
|
13
13
|
try {
|
|
@@ -44,21 +44,21 @@ var Gt = { exports: {} };
|
|
|
44
44
|
function s(f) {
|
|
45
45
|
try {
|
|
46
46
|
h(i.next(f));
|
|
47
|
-
} catch (
|
|
48
|
-
r(
|
|
47
|
+
} catch (l) {
|
|
48
|
+
r(l);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
function c(f) {
|
|
52
52
|
try {
|
|
53
53
|
h(i.throw(f));
|
|
54
|
-
} catch (
|
|
55
|
-
r(
|
|
54
|
+
} catch (l) {
|
|
55
|
+
r(l);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
function h(f) {
|
|
59
|
-
var
|
|
60
|
-
f.done ? n(f.value) : (
|
|
61
|
-
|
|
59
|
+
var l;
|
|
60
|
+
f.done ? n(f.value) : (l = f.value, l instanceof t ? l : new t(function(y) {
|
|
61
|
+
y(l);
|
|
62
62
|
})).then(s, c);
|
|
63
63
|
}
|
|
64
64
|
h((i = i.apply(a, [])).next());
|
|
@@ -74,51 +74,51 @@ var Gt = { exports: {} };
|
|
|
74
74
|
}), r;
|
|
75
75
|
function c(h) {
|
|
76
76
|
return function(f) {
|
|
77
|
-
return function(
|
|
77
|
+
return function(l) {
|
|
78
78
|
if (t) throw new TypeError("Generator is already executing.");
|
|
79
79
|
for (; s; ) try {
|
|
80
|
-
if (t = 1, i && (n = 2 &
|
|
81
|
-
switch (i = 0, n && (
|
|
80
|
+
if (t = 1, i && (n = 2 & l[0] ? i.return : l[0] ? i.throw || ((n = i.return) && n.call(i), 0) : i.next) && !(n = n.call(i, l[1])).done) return n;
|
|
81
|
+
switch (i = 0, n && (l = [2 & l[0], n.value]), l[0]) {
|
|
82
82
|
case 0:
|
|
83
83
|
case 1:
|
|
84
|
-
n =
|
|
84
|
+
n = l;
|
|
85
85
|
break;
|
|
86
86
|
case 4:
|
|
87
|
-
return s.label++, { value:
|
|
87
|
+
return s.label++, { value: l[1], done: !1 };
|
|
88
88
|
case 5:
|
|
89
|
-
s.label++, i =
|
|
89
|
+
s.label++, i = l[1], l = [0];
|
|
90
90
|
continue;
|
|
91
91
|
case 7:
|
|
92
|
-
|
|
92
|
+
l = s.ops.pop(), s.trys.pop();
|
|
93
93
|
continue;
|
|
94
94
|
default:
|
|
95
|
-
if (n = s.trys, !((n = n.length > 0 && n[n.length - 1]) ||
|
|
95
|
+
if (n = s.trys, !((n = n.length > 0 && n[n.length - 1]) || l[0] !== 6 && l[0] !== 2)) {
|
|
96
96
|
s = 0;
|
|
97
97
|
continue;
|
|
98
98
|
}
|
|
99
|
-
if (
|
|
100
|
-
s.label =
|
|
99
|
+
if (l[0] === 3 && (!n || l[1] > n[0] && l[1] < n[3])) {
|
|
100
|
+
s.label = l[1];
|
|
101
101
|
break;
|
|
102
102
|
}
|
|
103
|
-
if (
|
|
104
|
-
s.label = n[1], n =
|
|
103
|
+
if (l[0] === 6 && s.label < n[1]) {
|
|
104
|
+
s.label = n[1], n = l;
|
|
105
105
|
break;
|
|
106
106
|
}
|
|
107
107
|
if (n && s.label < n[2]) {
|
|
108
|
-
s.label = n[2], s.ops.push(
|
|
108
|
+
s.label = n[2], s.ops.push(l);
|
|
109
109
|
break;
|
|
110
110
|
}
|
|
111
111
|
n[2] && s.ops.pop(), s.trys.pop();
|
|
112
112
|
continue;
|
|
113
113
|
}
|
|
114
|
-
|
|
115
|
-
} catch (
|
|
116
|
-
|
|
114
|
+
l = e.call(a, s);
|
|
115
|
+
} catch (y) {
|
|
116
|
+
l = [6, y], i = 0;
|
|
117
117
|
} finally {
|
|
118
118
|
t = n = 0;
|
|
119
119
|
}
|
|
120
|
-
if (5 &
|
|
121
|
-
return { value:
|
|
120
|
+
if (5 & l[0]) throw l[1];
|
|
121
|
+
return { value: l[0] ? l[1] : void 0, done: !0 };
|
|
122
122
|
}([h, f]);
|
|
123
123
|
};
|
|
124
124
|
}
|
|
@@ -160,77 +160,77 @@ var Gt = { exports: {} };
|
|
|
160
160
|
}), Object.keys(t).length ? t : null;
|
|
161
161
|
}
|
|
162
162
|
var F, g;
|
|
163
|
-
function
|
|
163
|
+
function p(a, e, t) {
|
|
164
164
|
var i = "shortString", n = !0;
|
|
165
165
|
typeof t == "number" && (i = "javaDouble", n = !1), a[i] = a[i] || {}, a[i][e] = n ? t + "" : t;
|
|
166
166
|
}
|
|
167
167
|
function C(a) {
|
|
168
168
|
return !!a && typeof a == "object" && a.value !== void 0;
|
|
169
169
|
}
|
|
170
|
-
function
|
|
170
|
+
function k(a) {
|
|
171
171
|
return Object.fromEntries(Object.entries(a).map(function(e) {
|
|
172
172
|
var t = e[0], i = e[1];
|
|
173
173
|
return [t, C(i) ? i : { value: i }];
|
|
174
174
|
}));
|
|
175
175
|
}
|
|
176
176
|
function z(a) {
|
|
177
|
-
return o(o({}, a), { identity: a.identity ? o(o({}, a.identity), { traits:
|
|
177
|
+
return o(o({}, a), { identity: a.identity ? o(o({}, a.identity), { traits: k(a.identity.traits || {}) }) : void 0 });
|
|
178
178
|
}
|
|
179
179
|
(function(a) {
|
|
180
180
|
a.NONE = "NONE", a.DEFAULT_FLAGS = "DEFAULT_FLAGS", a.CACHE = "CACHE", a.SERVER = "SERVER";
|
|
181
181
|
})(F || (F = {}));
|
|
182
|
-
var Y,
|
|
182
|
+
var Y, L = null, ce = "FLAGSMITH_EVENT", lt = ce, Jt = "https://edge.api.flagsmith.com/api/v1/", Vt = "flagsmith_value_", Mt = "flagsmith_enabled_", Bt = "flagsmith_trait_", he = function() {
|
|
183
183
|
function a(e) {
|
|
184
184
|
var t = this;
|
|
185
185
|
this._trigger = null, this._triggerLoadingState = null, this.timestamp = null, this.isLoading = !1, this.eventSource = null, this.getFlags = function() {
|
|
186
186
|
var i = t, n = i.api, r = i.evaluationContext;
|
|
187
187
|
t.log("Get Flags"), t.isLoading = !0, t.loadingState.isFetching || t.setLoadingState(o(o({}, t.loadingState), { isFetching: !0 }));
|
|
188
188
|
var s = "".concat(t.getContext().identity), c = function(h) {
|
|
189
|
-
var f,
|
|
189
|
+
var f, l, y, x;
|
|
190
190
|
if (h && s === "".concat(t.getContext().identity)) {
|
|
191
|
-
var D = h.flags, A = h.traits,
|
|
191
|
+
var D = h.flags, A = h.traits, R = h.identifier;
|
|
192
192
|
t.isLoading = !1;
|
|
193
193
|
var j = {}, P = {};
|
|
194
|
-
A = A || [], (D = D || []).forEach(function(
|
|
195
|
-
j[
|
|
196
|
-
}), A.forEach(function(
|
|
197
|
-
P[
|
|
194
|
+
A = A || [], (D = D || []).forEach(function(m) {
|
|
195
|
+
j[m.feature.name.toLowerCase().replace(/ /g, "_")] = { id: m.feature.id, enabled: m.enabled, value: m.feature_state_value };
|
|
196
|
+
}), A.forEach(function(m) {
|
|
197
|
+
P[m.trait_key.toLowerCase().replace(/ /g, "_")] = { transient: m.transient, value: m.trait_value };
|
|
198
198
|
}), t.oldFlags = o({}, t.flags);
|
|
199
199
|
var K = _(t.oldFlags, j), nt = _((f = t.evaluationContext.identity) === null || f === void 0 ? void 0 : f.traits, P);
|
|
200
|
-
if ((
|
|
200
|
+
if ((R || Object.keys(P).length) && (t.evaluationContext.identity = o(o({}, t.evaluationContext.identity), { traits: P }), R && (t.evaluationContext.identity.identifier = R)), t.flags = j, t.updateStorage(), t._onChange(t.oldFlags, { isFromServer: !0, flagsChanged: K, traitsChanged: nt }, t._loadedState(null, F.SERVER)), t.datadogRum) try {
|
|
201
201
|
if (t.datadogRum.trackTraits) {
|
|
202
202
|
var it = {};
|
|
203
|
-
Object.keys(((
|
|
204
|
-
it[
|
|
203
|
+
Object.keys(((l = t.evaluationContext.identity) === null || l === void 0 ? void 0 : l.traits) || {}).map(function(m) {
|
|
204
|
+
it[Bt + m] = t.getTrait(m);
|
|
205
205
|
});
|
|
206
|
-
var Z = o(o(o({}, t.datadogRum.client.getUser()), { id: t.datadogRum.client.getUser().id || ((
|
|
206
|
+
var Z = o(o(o({}, t.datadogRum.client.getUser()), { id: t.datadogRum.client.getUser().id || ((y = t.evaluationContext.identity) === null || y === void 0 ? void 0 : y.identifier) }), it);
|
|
207
207
|
t.log("Setting Datadog user", Z), t.datadogRum.client.setUser(Z);
|
|
208
208
|
}
|
|
209
|
-
} catch (
|
|
210
|
-
console.error(
|
|
209
|
+
} catch (m) {
|
|
210
|
+
console.error(m);
|
|
211
211
|
}
|
|
212
212
|
if (t.dtrum) try {
|
|
213
213
|
var w = { javaDouble: {}, date: {}, shortString: {}, javaLongOrObject: {} };
|
|
214
|
-
Object.keys(t.flags).map(function(
|
|
215
|
-
|
|
216
|
-
}), Object.keys(((x = t.evaluationContext.identity) === null || x === void 0 ? void 0 : x.traits) || {}).map(function(
|
|
217
|
-
|
|
214
|
+
Object.keys(t.flags).map(function(m) {
|
|
215
|
+
p(w, Vt + m, t.getValue(m, { skipAnalytics: !0 })), p(w, Mt + m, t.hasFeature(m, { skipAnalytics: !0 }));
|
|
216
|
+
}), Object.keys(((x = t.evaluationContext.identity) === null || x === void 0 ? void 0 : x.traits) || {}).map(function(m) {
|
|
217
|
+
p(w, Bt + m, t.getTrait(m));
|
|
218
218
|
}), t.log("Sending javaLongOrObject traits to dynatrace", w.javaLongOrObject), t.log("Sending date traits to dynatrace", w.date), t.log("Sending shortString traits to dynatrace", w.shortString), t.log("Sending javaDouble to dynatrace", w.javaDouble), t.dtrum.sendSessionProperties(w.javaLongOrObject, w.date, w.shortString, w.javaDouble);
|
|
219
|
-
} catch (
|
|
220
|
-
console.error(
|
|
219
|
+
} catch (m) {
|
|
220
|
+
console.error(m);
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
224
|
return r.identity ? Promise.all([r.identity.traits && Object.keys(r.identity.traits).length || !r.identity.identifier ? t.getJSON(n + "identities/", "POST", JSON.stringify({ identifier: r.identity.identifier, transient: r.identity.transient, traits: Object.entries(r.identity.traits).map(function(h) {
|
|
225
|
-
var f = h[0],
|
|
226
|
-
return { trait_key: f, trait_value:
|
|
225
|
+
var f = h[0], l = h[1];
|
|
226
|
+
return { trait_key: f, trait_value: l == null ? void 0 : l.value, transient: l == null ? void 0 : l.transient };
|
|
227
227
|
}).filter(function(h) {
|
|
228
228
|
return h.trait_value !== void 0 || (t.log("Warning - attempted to set an undefined trait value for key", h.trait_key), !1);
|
|
229
229
|
}) })) : t.getJSON(n + "identities/?identifier=" + encodeURIComponent(r.identity.identifier) + (r.identity.transient ? "&transient=true" : ""))]).then(function(h) {
|
|
230
230
|
return t.evaluationContext.identity = o(o({}, t.evaluationContext.identity), { traits: {} }), c(h == null ? void 0 : h[0]);
|
|
231
231
|
}).catch(function(h) {
|
|
232
|
-
var f = h.message,
|
|
233
|
-
return Promise.reject(
|
|
232
|
+
var f = h.message, l = new Error(f);
|
|
233
|
+
return Promise.reject(l);
|
|
234
234
|
}) : t.getJSON(n + "flags/").then(function(h) {
|
|
235
235
|
return c({ flags: h, traits: void 0 });
|
|
236
236
|
});
|
|
@@ -271,7 +271,7 @@ var Gt = { exports: {} };
|
|
|
271
271
|
return t.setContext(o(o({}, t.getContext()), i));
|
|
272
272
|
}, this.setTrait = function(i, n) {
|
|
273
273
|
var r;
|
|
274
|
-
if (t.api) return t.setContext(o(o({}, t.evaluationContext), { identity: o(o({}, t.evaluationContext.identity), { traits: o(o({}, (r = t.evaluationContext.identity) === null || r === void 0 ? void 0 : r.traits),
|
|
274
|
+
if (t.api) return t.setContext(o(o({}, t.evaluationContext), { identity: o(o({}, t.evaluationContext.identity), { traits: o(o({}, (r = t.evaluationContext.identity) === null || r === void 0 ? void 0 : r.traits), k(Object.fromEntries([[i, n]]))) }) }));
|
|
275
275
|
}, this.setTraits = function(i) {
|
|
276
276
|
var n;
|
|
277
277
|
if (t.api) return t.setContext(o(o({}, t.evaluationContext), { identity: o(o({}, t.evaluationContext.identity), { traits: o(o({}, (n = t.evaluationContext.identity) === null || n === void 0 ? void 0 : n.traits), Object.fromEntries(Object.entries(i).map(function(r) {
|
|
@@ -290,31 +290,31 @@ var Gt = { exports: {} };
|
|
|
290
290
|
c.evaluationContext;
|
|
291
291
|
var h = c.headers, f = { method: n || "GET", body: r, cache: "no-cache", headers: {} };
|
|
292
292
|
t.evaluationContext.environment && (f.headers["X-Environment-Key"] = t.evaluationContext.environment.apiKey), n && n !== "GET" && (f.headers["Content-Type"] = "application/json; charset=utf-8"), h && Object.assign(f.headers, h), g || console.error("Flagsmith: fetch is undefined, please specify a fetch implementation into flagsmith.init to support SSR.");
|
|
293
|
-
var
|
|
294
|
-
return g(i, f).then(function(
|
|
293
|
+
var l = "".concat((s = t.evaluationContext.identity) === null || s === void 0 ? void 0 : s.identifier);
|
|
294
|
+
return g(i, f).then(function(y) {
|
|
295
295
|
var x, D, A = "".concat((x = t.evaluationContext.identity) === null || x === void 0 ? void 0 : x.identifier);
|
|
296
|
-
if (
|
|
297
|
-
var
|
|
298
|
-
if (
|
|
299
|
-
var j = parseFloat(
|
|
296
|
+
if (l === A) {
|
|
297
|
+
var R = (D = y.headers) === null || D === void 0 ? void 0 : D.get("x-flagsmith-document-updated-at");
|
|
298
|
+
if (R) try {
|
|
299
|
+
var j = parseFloat(R);
|
|
300
300
|
if (isNaN(j)) return Promise.reject("Failed to parse x-flagsmith-document-updated-at");
|
|
301
301
|
t.timestamp = j;
|
|
302
302
|
} catch (P) {
|
|
303
|
-
t.log(P, "Failed to parse x-flagsmith-document-updated-at",
|
|
303
|
+
t.log(P, "Failed to parse x-flagsmith-document-updated-at", R);
|
|
304
304
|
}
|
|
305
|
-
return t.log("Fetch response: " +
|
|
305
|
+
return t.log("Fetch response: " + y.status + " " + (n || "GET") + 0 + i), y.text().then(function(P) {
|
|
306
306
|
var K = P;
|
|
307
307
|
try {
|
|
308
308
|
K = JSON.parse(P);
|
|
309
309
|
} catch {
|
|
310
310
|
}
|
|
311
|
-
return !K &&
|
|
311
|
+
return !K && y.status && (K = "API Response: ".concat(y.status)), y.status && y.status >= 200 && y.status < 300 ? K : Promise.reject(new Error(K));
|
|
312
312
|
});
|
|
313
313
|
}
|
|
314
|
-
t.log("Received response with identity mismatch, ignoring response. Requested: ".concat(
|
|
314
|
+
t.log("Received response with identity mismatch, ignoring response. Requested: ".concat(l, ", Current: ").concat(A));
|
|
315
315
|
});
|
|
316
316
|
}, this.evaluateFlag = function(i, n) {
|
|
317
|
-
if (t.datadogRum && (t.datadogRum.client.addFeatureFlagEvaluation ? n === "VALUE" ? t.datadogRum.client.addFeatureFlagEvaluation(
|
|
317
|
+
if (t.datadogRum && (t.datadogRum.client.addFeatureFlagEvaluation ? n === "VALUE" ? t.datadogRum.client.addFeatureFlagEvaluation(Vt + i, t.getValue(i, {}, !0)) : t.datadogRum.client.addFeatureFlagEvaluation(Mt + i, t.hasFeature(i, !0)) : console.error("Flagsmith: Your datadog RUM client does not support the function addFeatureFlagEvaluation, please update it.")), t.enableAnalytics) {
|
|
318
318
|
if (!t.evaluationEvent || !t.evaluationContext.environment) return;
|
|
319
319
|
t.evaluationEvent[t.evaluationContext.environment.apiKey] || (t.evaluationEvent[t.evaluationContext.environment.apiKey] = {}), t.evaluationEvent[t.evaluationContext.environment.apiKey][i] === void 0 && (t.evaluationEvent[t.evaluationContext.environment.apiKey][i] = 0), t.evaluationEvent[t.evaluationContext.environment.apiKey][i] += 1;
|
|
320
320
|
}
|
|
@@ -322,23 +322,23 @@ var Gt = { exports: {} };
|
|
|
322
322
|
}, this._onChange = function(i, n, r) {
|
|
323
323
|
var s, c;
|
|
324
324
|
t.setLoadingState(r), (s = t.onChange) === null || s === void 0 || s.call(t, i, n, t.loadingState), (c = t._trigger) === null || c === void 0 || c.call(t);
|
|
325
|
-
}, g = e.fetch ? e.fetch : typeof fetch < "u" ? fetch : vt === null || vt === void 0 ? void 0 : vt.fetch, this.canUseStorage = typeof window < "u" || !!e.browserlessStorage, this.log("Constructing flagsmith instance " + e), e.eventSource && (Y = e.eventSource), e.AsyncStorage && (
|
|
325
|
+
}, g = e.fetch ? e.fetch : typeof fetch < "u" ? fetch : vt === null || vt === void 0 ? void 0 : vt.fetch, this.canUseStorage = typeof window < "u" || !!e.browserlessStorage, this.log("Constructing flagsmith instance " + e), e.eventSource && (Y = e.eventSource), e.AsyncStorage && (L = e.AsyncStorage);
|
|
326
326
|
}
|
|
327
327
|
return a.prototype.init = function(e) {
|
|
328
328
|
var t, i, n;
|
|
329
329
|
return E(this, void 0, void 0, function() {
|
|
330
|
-
var r, s, c, h, f,
|
|
330
|
+
var r, s, c, h, f, l, y, x, D, A, R, j, P, K, nt, it, Z, w, m, pt, at, Yt, Q, yt, Zt, Qt, mt, te, St, rt, tt, ee, O = this;
|
|
331
331
|
return M(this, function(U) {
|
|
332
332
|
switch (U.label) {
|
|
333
333
|
case 0:
|
|
334
334
|
r = z(e.evaluationContext || this.evaluationContext), U.label = 1;
|
|
335
335
|
case 1:
|
|
336
|
-
if (U.trys.push([1, 13, , 14]), s = e.environmentID, c = e.api, h = c === void 0 ?
|
|
337
|
-
if (r.identity =
|
|
336
|
+
if (U.trys.push([1, 13, , 14]), s = e.environmentID, c = e.api, h = c === void 0 ? Jt : c, f = e.headers, l = e.onChange, y = e.cacheFlags, x = e.datadogRum, D = e.onError, A = e.defaultFlags, R = e.fetch, j = e.preventFetch, P = e.enableLogs, K = e.enableDynatrace, nt = e.enableAnalytics, it = e.realtime, Z = e.eventSourceUrl, w = Z === void 0 ? "https://realtime.flagsmith.com/" : Z, m = e.AsyncStorage, pt = e.identity, at = e.traits, Yt = e.state, Q = e.cacheOptions, yt = e.angularHttpClient, Zt = e._trigger, Qt = e._triggerLoadingState, r.environment = s ? { apiKey: s } : r.environment, !r.environment || !r.environment.apiKey) throw new Error("Please provide `evaluationContext.environment` with non-empty `apiKey`");
|
|
337
|
+
if (r.identity = pt || at ? { identifier: pt, traits: at ? Object.fromEntries(Object.entries(at).map(function(N) {
|
|
338
338
|
return [N[0], { value: N[1] }];
|
|
339
|
-
})) : {} } : r.identity, this.evaluationContext = r, this.api = h, this.headers = f, this.getFlagInterval = null, this.analyticsInterval = null, this.onChange =
|
|
339
|
+
})) : {} } : r.identity, this.evaluationContext = r, this.api = h, this.headers = f, this.getFlagInterval = null, this.analyticsInterval = null, this.onChange = l, mt = "Wrong Flagsmith Configuration: preventFetch is true and no defaulFlags provided", this._trigger = Zt || this._trigger, this._triggerLoadingState = Qt || this._triggerLoadingState, this.onError = function(N) {
|
|
340
340
|
O.setLoadingState(o(o({}, O.loadingState), { isFetching: !1, isLoading: !1, error: N })), D == null || D(N);
|
|
341
|
-
}, this.enableLogs = P || !1, this.cacheOptions = Q ? { skipAPI: !!Q.skipAPI, ttl: Q.ttl || 0, storageKey: Q.storageKey, loadStale: !!Q.loadStale } : this.cacheOptions, !this.cacheOptions.ttl && this.cacheOptions.skipAPI && console.warn("Flagsmith: you have set a cache ttl of 0 and are skipping API calls, this means the API will not be hit unless you clear local storage."),
|
|
341
|
+
}, this.enableLogs = P || !1, this.cacheOptions = Q ? { skipAPI: !!Q.skipAPI, ttl: Q.ttl || 0, storageKey: Q.storageKey, loadStale: !!Q.loadStale } : this.cacheOptions, !this.cacheOptions.ttl && this.cacheOptions.skipAPI && console.warn("Flagsmith: you have set a cache ttl of 0 and are skipping API calls, this means the API will not be hit unless you clear local storage."), R && (g = R), this.enableAnalytics = nt || !1, this.flags = Object.assign({}, A) || {}, this.datadogRum = x || null, this.initialised = !0, this.ticks = 1e4, this.timer = this.enableLogs ? (/* @__PURE__ */ new Date()).valueOf() : null, this.cacheFlags = L !== void 0 && !!y, lt = "FLAGSMITH_EVENT_" + r.environment.apiKey, m && (L = m), it && typeof window < "u" && this.setupRealtime(w, r.environment.apiKey), Object.keys(this.flags).length && (this.loadingState = o(o({}, this.loadingState), { isLoading: !1, source: F.DEFAULT_FLAGS })), this.setState(Yt), this.log("Initialising with properties", e, this), K && (typeof dtrum > "u" ? console.error("You have attempted to enable dynatrace but dtrum is undefined, please check you have the Dynatrace RUM JavaScript API installed.") : this.dtrum = dtrum), yt && (g = /* @__PURE__ */ function(N) {
|
|
342
342
|
return function(G, J) {
|
|
343
343
|
var H = J.headers, b = J.method, et = J.body;
|
|
344
344
|
return new Promise(function(W) {
|
|
@@ -359,14 +359,14 @@ var Gt = { exports: {} };
|
|
|
359
359
|
}
|
|
360
360
|
});
|
|
361
361
|
};
|
|
362
|
-
}(
|
|
362
|
+
}(yt)), L && this.canUseStorage && L.getItem(lt).then(function(N) {
|
|
363
363
|
try {
|
|
364
364
|
O.evaluationEvent = JSON.parse(N) || {};
|
|
365
365
|
} catch {
|
|
366
366
|
O.evaluationEvent = {};
|
|
367
367
|
}
|
|
368
368
|
O.analyticsInterval = setInterval(O.analyticsFlags, O.ticks);
|
|
369
|
-
}), this.enableAnalytics && (this.analyticsInterval && clearInterval(this.analyticsInterval),
|
|
369
|
+
}), this.enableAnalytics && (this.analyticsInterval && clearInterval(this.analyticsInterval), L && this.canUseStorage && L.getItem(lt, function(N, G) {
|
|
370
370
|
if (G && O.evaluationContext.environment) {
|
|
371
371
|
var J = JSON.parse(G);
|
|
372
372
|
if (J[O.evaluationContext.environment.apiKey]) {
|
|
@@ -374,20 +374,20 @@ var Gt = { exports: {} };
|
|
|
374
374
|
O.log("Retrieved events from cache", G), O.setState(o(o({}, H), { evaluationEvent: J[O.evaluationContext.environment.apiKey] }));
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
|
-
})), !
|
|
378
|
-
if (!
|
|
379
|
-
|
|
377
|
+
})), !y) return [3, 9];
|
|
378
|
+
if (!L || !this.canUseStorage) return [3, 8];
|
|
379
|
+
te = function(N, G) {
|
|
380
380
|
return E(O, void 0, void 0, function() {
|
|
381
|
-
var J, H, b, et, W, B,
|
|
381
|
+
var J, H, b, et, W, B, bt, ne, Ct, _t, Et, Ft, xt, wt, Ot, It, Lt, Tt, At, jt, Pt, Nt, kt, Rt, ie = this;
|
|
382
382
|
return M(this, function($) {
|
|
383
383
|
switch ($.label) {
|
|
384
384
|
case 0:
|
|
385
385
|
if (!G) return [3, 7];
|
|
386
386
|
J = null, H = null, $.label = 1;
|
|
387
387
|
case 1:
|
|
388
|
-
return $.trys.push([1, 5, , 6]), b = JSON.parse(G), et = !1, W = !1, b && b.api === this.api && ((
|
|
389
|
-
var
|
|
390
|
-
(
|
|
388
|
+
return $.trys.push([1, 5, , 6]), b = JSON.parse(G), et = !1, W = !1, b && b.api === this.api && ((_t = (Ct = b.evaluationContext) === null || Ct === void 0 ? void 0 : Ct.environment) === null || _t === void 0 ? void 0 : _t.apiKey) === ((Et = this.evaluationContext.environment) === null || Et === void 0 ? void 0 : Et.apiKey) && (B = !0, this.evaluationContext.identity && ((xt = (Ft = b.evaluationContext) === null || Ft === void 0 ? void 0 : Ft.identity) === null || xt === void 0 ? void 0 : xt.identifier) !== this.evaluationContext.identity.identifier && (this.log("Ignoring cache, identity has changed from " + ((Ot = (wt = b.evaluationContext) === null || wt === void 0 ? void 0 : wt.identity) === null || Ot === void 0 ? void 0 : Ot.identifier) + " to " + this.evaluationContext.identity.identifier), B = !1), this.cacheOptions.ttl && (!b.ts || (/* @__PURE__ */ new Date()).valueOf() - b.ts > this.cacheOptions.ttl) && (b.ts && !this.cacheOptions.loadStale ? (this.log("Ignoring cache, timestamp is too old ts:" + b.ts + " ttl: " + this.cacheOptions.ttl + " time elapsed since cache: " + ((/* @__PURE__ */ new Date()).valueOf() - b.ts) + "ms"), B = !1) : b.ts && this.cacheOptions.loadStale && (this.log("Loading stale cache, timestamp ts:" + b.ts + " ttl: " + this.cacheOptions.ttl + " time elapsed since cache: " + ((/* @__PURE__ */ new Date()).valueOf() - b.ts) + "ms"), W = !0, B = !0)), B && (et = !0, H = _((It = this.evaluationContext.identity) === null || It === void 0 ? void 0 : It.traits, (Tt = (Lt = b.evaluationContext) === null || Lt === void 0 ? void 0 : Lt.identity) === null || Tt === void 0 ? void 0 : Tt.traits), J = _(this.flags, b.flags), this.setState(o(o({}, b), { evaluationContext: z(o(o({}, b.evaluationContext), { identity: !((At = b.evaluationContext) === null || At === void 0) && At.identity ? o(o({}, (jt = b.evaluationContext) === null || jt === void 0 ? void 0 : jt.identity), { traits: o(o({}, ((Nt = (Pt = b.evaluationContext) === null || Pt === void 0 ? void 0 : Pt.identity) === null || Nt === void 0 ? void 0 : Nt.traits) || {}), at || {}) }) : void 0 })) })), this.log("Retrieved flags from cache", b))), et ? (bt = !j && (!this.cacheOptions.skipAPI || W), this._onChange(null, { isFromServer: !1, flagsChanged: J, traitsChanged: H }, this._loadedState(null, F.CACHE, bt)), this.oldFlags = this.flags, this.cacheOptions.skipAPI && et && !W && this.log("Skipping API, using cache"), bt && this.getFlags().catch(function(ge) {
|
|
389
|
+
var Ut;
|
|
390
|
+
(Ut = ie.onError) === null || Ut === void 0 || Ut.call(ie, ge);
|
|
391
391
|
}), [3, 4]) : [3, 2];
|
|
392
392
|
case 2:
|
|
393
393
|
return j ? [3, 4] : [4, this.getFlags()];
|
|
@@ -396,7 +396,7 @@ var Gt = { exports: {} };
|
|
|
396
396
|
case 4:
|
|
397
397
|
return [3, 6];
|
|
398
398
|
case 5:
|
|
399
|
-
return
|
|
399
|
+
return ne = $.sent(), this.log("Exception fetching cached logs", ne), [3, 6];
|
|
400
400
|
case 6:
|
|
401
401
|
return [3, 10];
|
|
402
402
|
case 7:
|
|
@@ -404,9 +404,9 @@ var Gt = { exports: {} };
|
|
|
404
404
|
case 8:
|
|
405
405
|
return $.sent(), [3, 10];
|
|
406
406
|
case 9:
|
|
407
|
-
if (A) this._onChange(null, { isFromServer: !1, flagsChanged: _({}, this.flags), traitsChanged: _({}, (
|
|
407
|
+
if (A) this._onChange(null, { isFromServer: !1, flagsChanged: _({}, this.flags), traitsChanged: _({}, (kt = this.evaluationContext.identity) === null || kt === void 0 ? void 0 : kt.traits) }, this._loadedState(null, F.DEFAULT_FLAGS));
|
|
408
408
|
else {
|
|
409
|
-
if (!this.flags) throw new Error(
|
|
409
|
+
if (!this.flags) throw new Error(mt);
|
|
410
410
|
this._onChange(null, { isFromServer: !1, flagsChanged: _({}, this.flags), traitsChanged: _({}, (Rt = this.evaluationContext.identity) === null || Rt === void 0 ? void 0 : Rt.traits) }, this._loadedState(null, F.DEFAULT_FLAGS));
|
|
411
411
|
}
|
|
412
412
|
$.label = 10;
|
|
@@ -417,13 +417,13 @@ var Gt = { exports: {} };
|
|
|
417
417
|
});
|
|
418
418
|
}, U.label = 2;
|
|
419
419
|
case 2:
|
|
420
|
-
return U.trys.push([2, 7, , 8]),
|
|
420
|
+
return U.trys.push([2, 7, , 8]), L.getItemSync ? (St = L.getItemSync(this.getStorageKey()), [3, 5]) : [3, 3];
|
|
421
421
|
case 3:
|
|
422
|
-
return [4,
|
|
422
|
+
return [4, L.getItem(this.getStorageKey())];
|
|
423
423
|
case 4:
|
|
424
|
-
|
|
424
|
+
St = U.sent(), U.label = 5;
|
|
425
425
|
case 5:
|
|
426
|
-
return [4,
|
|
426
|
+
return [4, te(null, St)];
|
|
427
427
|
case 6:
|
|
428
428
|
case 7:
|
|
429
429
|
return U.sent(), [3, 8];
|
|
@@ -435,12 +435,12 @@ var Gt = { exports: {} };
|
|
|
435
435
|
return U.sent(), [3, 12];
|
|
436
436
|
case 11:
|
|
437
437
|
if (A) this._onChange(null, { isFromServer: !1, flagsChanged: _({}, A), traitsChanged: _({}, (t = r.identity) === null || t === void 0 ? void 0 : t.traits) }, this._loadedState(null, F.DEFAULT_FLAGS));
|
|
438
|
-
else if (this.flags && (rt = null, Object.keys(this.flags).length === 0 && (rt =
|
|
438
|
+
else if (this.flags && (rt = null, Object.keys(this.flags).length === 0 && (rt = mt), this._onChange(null, { isFromServer: !1, flagsChanged: _({}, this.flags), traitsChanged: _({}, (i = r.identity) === null || i === void 0 ? void 0 : i.traits) }, this._loadedState(rt, F.DEFAULT_FLAGS)), rt)) throw new Error(rt);
|
|
439
439
|
U.label = 12;
|
|
440
440
|
case 12:
|
|
441
441
|
return [3, 14];
|
|
442
442
|
case 13:
|
|
443
|
-
throw tt = U.sent(), this.log("Error during initialisation ", tt),
|
|
443
|
+
throw tt = U.sent(), this.log("Error during initialisation ", tt), ee = tt instanceof Error ? tt : new Error("".concat(tt)), (n = this.onError) === null || n === void 0 || n.call(this, ee), tt;
|
|
444
444
|
case 14:
|
|
445
445
|
return [2];
|
|
446
446
|
}
|
|
@@ -456,7 +456,7 @@ var Gt = { exports: {} };
|
|
|
456
456
|
}, a.prototype.getState = function() {
|
|
457
457
|
return { api: this.api, flags: this.flags, ts: this.ts, evaluationContext: this.evaluationContext, evaluationEvent: this.evaluationEvent };
|
|
458
458
|
}, a.prototype.setState = function(e) {
|
|
459
|
-
e && (this.initialised = !0, this.api = e.api || this.api ||
|
|
459
|
+
e && (this.initialised = !0, this.api = e.api || this.api || Jt, this.flags = e.flags || this.flags, this.evaluationContext = e.evaluationContext || this.evaluationContext, this.evaluationEvent = e.evaluationEvent || this.evaluationEvent, this.log("setState called", this));
|
|
460
460
|
}, a.prototype.logout = function() {
|
|
461
461
|
return this.evaluationContext.identity = null, this.initialised ? this.getFlags() : Promise.resolve();
|
|
462
462
|
}, a.prototype.startListening = function(e) {
|
|
@@ -472,12 +472,12 @@ var Gt = { exports: {} };
|
|
|
472
472
|
if (this.cacheFlags) {
|
|
473
473
|
this.ts = (/* @__PURE__ */ new Date()).valueOf();
|
|
474
474
|
var e = JSON.stringify(this.getState());
|
|
475
|
-
this.log("Setting storage", e),
|
|
475
|
+
this.log("Setting storage", e), L.setItem(this.getStorageKey(), e);
|
|
476
476
|
}
|
|
477
477
|
}, a.prototype.updateEventStorage = function() {
|
|
478
478
|
if (this.enableAnalytics) {
|
|
479
479
|
var e = JSON.stringify(this.getState().evaluationEvent);
|
|
480
|
-
|
|
480
|
+
L.setItem(lt, e).catch(function(t) {
|
|
481
481
|
return console.error("Flagsmith: Error setting item in async storage", t);
|
|
482
482
|
});
|
|
483
483
|
}
|
|
@@ -497,7 +497,7 @@ var Gt = { exports: {} };
|
|
|
497
497
|
})) : this.log("Error, EventSource is undefined");
|
|
498
498
|
}, a;
|
|
499
499
|
}();
|
|
500
|
-
function
|
|
500
|
+
function zt(a) {
|
|
501
501
|
var e = a.fetch, t = a.AsyncStorage, i = a.eventSource;
|
|
502
502
|
return new he({ fetch: e, AsyncStorage: t, eventSource: i });
|
|
503
503
|
}
|
|
@@ -513,14 +513,14 @@ var Gt = { exports: {} };
|
|
|
513
513
|
this.constructor = a;
|
|
514
514
|
}
|
|
515
515
|
ut(a, e), a.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
|
|
516
|
-
}),
|
|
516
|
+
}), Ht = function(a) {
|
|
517
517
|
var e = typeof Symbol == "function" && Symbol.iterator, t = e && a[e], i = 0;
|
|
518
518
|
if (t) return t.call(a);
|
|
519
519
|
if (a && typeof a.length == "number") return { next: function() {
|
|
520
520
|
return a && i >= a.length && (a = void 0), { value: a && a[i++], done: !a };
|
|
521
521
|
} };
|
|
522
522
|
throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
523
|
-
},
|
|
523
|
+
}, $t = function(a, e) {
|
|
524
524
|
var t = typeof Symbol == "function" && a[Symbol.iterator];
|
|
525
525
|
if (!t) return a;
|
|
526
526
|
var i, n, r = t.call(a), s = [];
|
|
@@ -536,7 +536,7 @@ var Gt = { exports: {} };
|
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
538
|
return s;
|
|
539
|
-
},
|
|
539
|
+
}, ft = function(a, e, t) {
|
|
540
540
|
if (arguments.length === 2) for (var i, n = 0, r = e.length; n < r; n++) !i && n in e || (i || (i = Array.prototype.slice.call(e, 0, n)), i[n] = e[n]);
|
|
541
541
|
return a.concat(i || Array.prototype.slice.call(e));
|
|
542
542
|
}, de = function(a) {
|
|
@@ -545,7 +545,7 @@ var Gt = { exports: {} };
|
|
|
545
545
|
Consider loading an EventSource polyfill and making it available globally as EventSource, or passing one in as eventSourceClass to the ReconnectingEventSource constructor.`) || this;
|
|
546
546
|
}
|
|
547
547
|
return ve(e, a), e;
|
|
548
|
-
}(Error),
|
|
548
|
+
}(Error), qt = function() {
|
|
549
549
|
function a(e, t) {
|
|
550
550
|
var i = this;
|
|
551
551
|
if (this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, this._configuration = t != null ? Object.assign({}, t) : void 0, this.withCredentials = !1, this._eventSource = null, this._lastEventId = null, this._timer = null, this._listeners = { open: [], error: [], message: [] }, this.url = e.toString(), this.readyState = this.CONNECTING, this.max_retry_time = 3e3, this.eventSourceClass = globalThis.FlagsmithEventSource, this._configuration != null && (this._configuration.lastEventId && (this._lastEventId = this._configuration.lastEventId, delete this._configuration.lastEventId), this._configuration.max_retry_time && (this.max_retry_time = this._configuration.max_retry_time, delete this._configuration.max_retry_time), this._configuration.eventSourceClass && (this.eventSourceClass = this._configuration.eventSourceClass, delete this._configuration.eventSourceClass)), this.eventSourceClass == null || typeof this.eventSourceClass != "function") throw new de();
|
|
@@ -565,7 +565,7 @@ Consider loading an EventSource polyfill and making it available globally as Eve
|
|
|
565
565
|
i.onmessage(h);
|
|
566
566
|
};
|
|
567
567
|
try {
|
|
568
|
-
for (var r =
|
|
568
|
+
for (var r = Ht(Object.keys(this._listeners)), s = r.next(); !s.done; s = r.next()) {
|
|
569
569
|
var c = s.value;
|
|
570
570
|
this._eventSource.addEventListener(c, this._onevent_wrapped);
|
|
571
571
|
}
|
|
@@ -594,7 +594,7 @@ Consider loading an EventSource polyfill and making it available globally as Eve
|
|
|
594
594
|
e && e.lastEventId && (this._lastEventId = e.lastEventId);
|
|
595
595
|
var n = this._listeners[e.type];
|
|
596
596
|
if (n != null) try {
|
|
597
|
-
for (var r =
|
|
597
|
+
for (var r = Ht(ft([], $t(n), !1)), s = r.next(); !s.done; s = r.next())
|
|
598
598
|
s.value.call(this, e);
|
|
599
599
|
} catch (c) {
|
|
600
600
|
t = { error: c };
|
|
@@ -614,7 +614,7 @@ Consider loading an EventSource polyfill and making it available globally as Eve
|
|
|
614
614
|
}, a.prototype.addEventListener = function(e, t, i) {
|
|
615
615
|
this._listeners[e] == null && (this._listeners[e] = [], this._eventSource != null && this._eventSource.addEventListener(e, this._onevent_wrapped));
|
|
616
616
|
var n = this._listeners[e];
|
|
617
|
-
n.includes(t) || (this._listeners[e] =
|
|
617
|
+
n.includes(t) || (this._listeners[e] = ft(ft([], $t(n), !1), [t], !1));
|
|
618
618
|
}, a.prototype.removeEventListener = function(e, t, i) {
|
|
619
619
|
var n = this._listeners[e];
|
|
620
620
|
this._listeners[e] = n.filter(function(r) {
|
|
@@ -623,7 +623,7 @@ Consider loading an EventSource polyfill and making it available globally as Eve
|
|
|
623
623
|
}, a;
|
|
624
624
|
}();
|
|
625
625
|
globalThis.FlagsmithEventSource = typeof EventSource < "u" ? EventSource : null;
|
|
626
|
-
var
|
|
626
|
+
var Wt = function(a, e) {
|
|
627
627
|
return e = e || {}, new Promise(function(t, i) {
|
|
628
628
|
var n = new XMLHttpRequest(), r = [], s = [], c = {}, h = function() {
|
|
629
629
|
return { ok: (n.status / 100 | 0) == 2, statusText: n.statusText, status: n.status, url: n.responseURL, text: function() {
|
|
@@ -636,32 +636,32 @@ Consider loading an EventSource polyfill and making it available globally as Eve
|
|
|
636
636
|
return r;
|
|
637
637
|
}, entries: function() {
|
|
638
638
|
return s;
|
|
639
|
-
}, get: function(
|
|
640
|
-
return c[
|
|
641
|
-
}, has: function(
|
|
642
|
-
return
|
|
639
|
+
}, get: function(l) {
|
|
640
|
+
return c[l.toLowerCase()];
|
|
641
|
+
}, has: function(l) {
|
|
642
|
+
return l.toLowerCase() in c;
|
|
643
643
|
} } };
|
|
644
644
|
};
|
|
645
645
|
for (var f in n.open(e.method || "get", a, !0), n.onload = function() {
|
|
646
|
-
n.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function(
|
|
647
|
-
r.push(
|
|
646
|
+
n.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function(l, y, x) {
|
|
647
|
+
r.push(y = y.toLowerCase()), s.push([y, x]), c[y] = c[y] ? c[y] + "," + x : x;
|
|
648
648
|
}), t(h());
|
|
649
649
|
}, n.onerror = i, n.withCredentials = e.credentials == "include", e.headers) n.setRequestHeader(f, e.headers[f]);
|
|
650
650
|
n.send(e.body || null);
|
|
651
651
|
});
|
|
652
|
-
},
|
|
653
|
-
typeof window < "u" && (window.flagsmith =
|
|
654
|
-
return
|
|
655
|
-
}, v.default =
|
|
652
|
+
}, Xt = zt({ AsyncStorage: d, fetch: Wt, eventSource: qt });
|
|
653
|
+
typeof window < "u" && (window.flagsmith = Xt), v.createFlagsmithInstance = function() {
|
|
654
|
+
return zt({ AsyncStorage: d, fetch: Wt, eventSource: qt });
|
|
655
|
+
}, v.default = Xt, Object.defineProperty(v, "__esModule", { value: !0 });
|
|
656
656
|
});
|
|
657
657
|
})(Gt, Gt.exports);
|
|
658
|
-
var me = Gt.exports,
|
|
658
|
+
var me = Gt.exports, re = {
|
|
659
659
|
NOT_INITIALIZED: "FeatureFlag not initialized. Call init() first.",
|
|
660
660
|
INVALID_CONFIG: "Invalid Flagsmith configuration",
|
|
661
661
|
FETCH_FAILED: "Failed to fetch Flagsmith configuration",
|
|
662
662
|
NO_USER_CONTEXT: "User context not set. Call setUser() first.",
|
|
663
663
|
ALREADY_INITIALIZED: "FeatureFlag is already initialized."
|
|
664
|
-
},
|
|
664
|
+
}, se = "business", V, Se = (V = class {
|
|
665
665
|
constructor() {
|
|
666
666
|
ct(this, "flagsmithClient", null);
|
|
667
667
|
ct(this, "userContext", null);
|
|
@@ -671,31 +671,31 @@ var me = Gt.exports, se = {
|
|
|
671
671
|
}
|
|
672
672
|
ensureInitialized() {
|
|
673
673
|
if (!this.flagsmithClient)
|
|
674
|
-
throw new Error(
|
|
674
|
+
throw new Error(re.NOT_INITIALIZED);
|
|
675
675
|
}
|
|
676
|
-
async init(
|
|
676
|
+
async init(u, v = []) {
|
|
677
677
|
if (!this.flagsmithClient)
|
|
678
678
|
try {
|
|
679
679
|
this.flagsmithClient = me.createFlagsmithInstance();
|
|
680
680
|
const d = v.reduce((o, E) => (o[E.feature.name] = E, o), {});
|
|
681
681
|
await this.flagsmithClient.init({
|
|
682
|
-
environmentID:
|
|
683
|
-
api: (
|
|
684
|
-
enableAnalytics: (
|
|
682
|
+
environmentID: u.apiKey,
|
|
683
|
+
api: (u == null ? void 0 : u.url) ?? "https://flag.feedme.farm/api/v1/",
|
|
684
|
+
enableAnalytics: (u == null ? void 0 : u.enableAnalytics) ?? !0,
|
|
685
685
|
defaultFlags: d,
|
|
686
|
-
cacheFlags: (
|
|
686
|
+
cacheFlags: (u == null ? void 0 : u.cacheFlags) ?? !0
|
|
687
687
|
});
|
|
688
688
|
} catch (d) {
|
|
689
689
|
throw console.error("Failed to initialize FeatureFlag:", d), d;
|
|
690
690
|
}
|
|
691
691
|
}
|
|
692
|
-
async setUser(
|
|
693
|
-
this.ensureInitialized(), this.userContext = { identifier:
|
|
692
|
+
async setUser(u, v) {
|
|
693
|
+
this.ensureInitialized(), this.userContext = { identifier: u, traits: v }, await this.updateContext();
|
|
694
694
|
}
|
|
695
|
-
async addTraits(
|
|
695
|
+
async addTraits(u) {
|
|
696
696
|
if (this.ensureInitialized(), !this.userContext)
|
|
697
|
-
throw new Error(
|
|
698
|
-
this.userContext.traits = { ...this.userContext.traits, ...
|
|
697
|
+
throw new Error(re.NO_USER_CONTEXT);
|
|
698
|
+
this.userContext.traits = { ...this.userContext.traits, ...u }, await this.updateContext();
|
|
699
699
|
}
|
|
700
700
|
async updateContext() {
|
|
701
701
|
try {
|
|
@@ -706,14 +706,14 @@ var me = Gt.exports, se = {
|
|
|
706
706
|
traits: this.userContext.traits || {}
|
|
707
707
|
}
|
|
708
708
|
});
|
|
709
|
-
} catch (
|
|
710
|
-
throw console.error("Failed to update user context:",
|
|
709
|
+
} catch (u) {
|
|
710
|
+
throw console.error("Failed to update user context:", u), u;
|
|
711
711
|
}
|
|
712
712
|
}
|
|
713
713
|
async getFlags() {
|
|
714
714
|
this.ensureInitialized();
|
|
715
|
-
const
|
|
716
|
-
return Object.entries(
|
|
715
|
+
const u = this.flagsmithClient.getAllFlags();
|
|
716
|
+
return Object.entries(u).map(([v, d]) => {
|
|
717
717
|
var o;
|
|
718
718
|
return {
|
|
719
719
|
feature: {
|
|
@@ -725,9 +725,9 @@ var me = Gt.exports, se = {
|
|
|
725
725
|
};
|
|
726
726
|
});
|
|
727
727
|
}
|
|
728
|
-
getFlagValue(
|
|
728
|
+
getFlagValue(u, v) {
|
|
729
729
|
this.ensureInitialized();
|
|
730
|
-
const d = this.flagsmithClient.getValue(
|
|
730
|
+
const d = this.flagsmithClient.getValue(u);
|
|
731
731
|
if (d == null)
|
|
732
732
|
return null;
|
|
733
733
|
try {
|
|
@@ -737,25 +737,25 @@ var me = Gt.exports, se = {
|
|
|
737
737
|
return console.error("Error transforming flag value:", o), null;
|
|
738
738
|
}
|
|
739
739
|
}
|
|
740
|
-
getFlag(
|
|
740
|
+
getFlag(u) {
|
|
741
741
|
this.ensureInitialized();
|
|
742
|
-
const v = this.flagsmithClient.getValue(
|
|
742
|
+
const v = this.flagsmithClient.getValue(u);
|
|
743
743
|
if (v == null) return null;
|
|
744
|
-
const d = this.flagsmithClient.hasFeature(
|
|
744
|
+
const d = this.flagsmithClient.hasFeature(u);
|
|
745
745
|
return {
|
|
746
746
|
feature: {
|
|
747
|
-
name:
|
|
747
|
+
name: u,
|
|
748
748
|
id: 0
|
|
749
749
|
},
|
|
750
750
|
enabled: d,
|
|
751
751
|
value: v.toString()
|
|
752
752
|
};
|
|
753
753
|
}
|
|
754
|
-
async getUserFlagValue(
|
|
754
|
+
async getUserFlagValue(u, v, d = null, o) {
|
|
755
755
|
var M;
|
|
756
756
|
const E = this.userContext;
|
|
757
757
|
try {
|
|
758
|
-
return await this.setUser(
|
|
758
|
+
return await this.setUser(u), this.getFlagValue(v, o) ?? d;
|
|
759
759
|
} catch (T) {
|
|
760
760
|
return console.error(`Error getting user flag value for ${v}:`, T), d;
|
|
761
761
|
} finally {
|
|
@@ -769,56 +769,56 @@ var me = Gt.exports, se = {
|
|
|
769
769
|
reset() {
|
|
770
770
|
this.flagsmithClient = null, this.userContext = null;
|
|
771
771
|
}
|
|
772
|
-
}, ct(V, "instance"), V), be = Se.getInstance(), st =
|
|
773
|
-
function Ce(
|
|
774
|
-
const
|
|
772
|
+
}, ct(V, "instance"), V), be = Se.getInstance(), st = gt(!1), ot = gt([]), q = gt(null);
|
|
773
|
+
function Ce(S = be) {
|
|
774
|
+
const u = () => st.value ? !0 : (console.warn("FeatureFlag is not initialized. Using default values."), !1), v = async (g, p = []) => {
|
|
775
775
|
if (st.value) {
|
|
776
776
|
console.warn("FeatureFlag is already initialized.");
|
|
777
777
|
return;
|
|
778
778
|
}
|
|
779
779
|
try {
|
|
780
|
-
await
|
|
780
|
+
await S.init(g, p), ot.value = await S.getFlags(), st.value = !0, q.value = null;
|
|
781
781
|
} catch (C) {
|
|
782
782
|
console.error("Failed to initialize feature flags:", C), q.value = C;
|
|
783
783
|
}
|
|
784
|
-
}, d = async (g,
|
|
785
|
-
if (
|
|
784
|
+
}, d = async (g, p) => {
|
|
785
|
+
if (u())
|
|
786
786
|
try {
|
|
787
|
-
await
|
|
787
|
+
await S.setUser(g, p), ot.value = await S.getFlags(), q.value = null;
|
|
788
788
|
} catch (C) {
|
|
789
789
|
console.error("Failed to set user:", C), q.value = C;
|
|
790
790
|
}
|
|
791
|
-
}, o = async (g,
|
|
792
|
-
if (
|
|
791
|
+
}, o = async (g, p) => d(`${se}-${g}`, p), E = async (g) => {
|
|
792
|
+
if (u())
|
|
793
793
|
try {
|
|
794
|
-
await
|
|
795
|
-
} catch (
|
|
796
|
-
console.error("Failed to add traits:",
|
|
794
|
+
await S.addTraits(g), ot.value = await S.getFlags(), q.value = null;
|
|
795
|
+
} catch (p) {
|
|
796
|
+
console.error("Failed to add traits:", p), q.value = p;
|
|
797
797
|
}
|
|
798
|
-
}, M = (g,
|
|
799
|
-
if (!
|
|
798
|
+
}, M = (g, p, C = null) => {
|
|
799
|
+
if (!u()) return C;
|
|
800
800
|
try {
|
|
801
|
-
return
|
|
802
|
-
} catch (
|
|
803
|
-
return console.error(`Error getting flag value for ${g}:`,
|
|
801
|
+
return S.getFlagValue(g, p) ?? C;
|
|
802
|
+
} catch (k) {
|
|
803
|
+
return console.error(`Error getting flag value for ${g}:`, k), C;
|
|
804
804
|
}
|
|
805
|
-
}, T = (g,
|
|
806
|
-
if (!
|
|
805
|
+
}, T = (g, p) => {
|
|
806
|
+
if (!u()) return p ?? null;
|
|
807
807
|
try {
|
|
808
|
-
return
|
|
808
|
+
return S.getFlag(g) ?? p ?? null;
|
|
809
809
|
} catch (C) {
|
|
810
|
-
return console.error(`Error getting flag for ${g}:`, C),
|
|
810
|
+
return console.error(`Error getting flag for ${g}:`, C), p ?? null;
|
|
811
811
|
}
|
|
812
|
-
}, X = async (g,
|
|
813
|
-
if (!
|
|
812
|
+
}, X = async (g, p, C = null, k) => {
|
|
813
|
+
if (!u()) return C;
|
|
814
814
|
try {
|
|
815
|
-
return await
|
|
815
|
+
return await S.getUserFlagValue(g, p, C, k);
|
|
816
816
|
} catch (z) {
|
|
817
|
-
return console.error(`Error getting user flag value for ${
|
|
817
|
+
return console.error(`Error getting user flag value for ${p}:`, z), C;
|
|
818
818
|
}
|
|
819
|
-
}, _ = async (g,
|
|
819
|
+
}, _ = async (g, p, C = null, k) => X(`${se}-${g}`, p, C, k), F = () => {
|
|
820
820
|
try {
|
|
821
|
-
|
|
821
|
+
S.reset();
|
|
822
822
|
} catch (g) {
|
|
823
823
|
console.error("Error resetting feature flags:", g);
|
|
824
824
|
} finally {
|
|
@@ -826,9 +826,9 @@ function Ce(p = be) {
|
|
|
826
826
|
}
|
|
827
827
|
};
|
|
828
828
|
return {
|
|
829
|
-
flags:
|
|
830
|
-
isInitialized:
|
|
831
|
-
error:
|
|
829
|
+
flags: Kt(ot),
|
|
830
|
+
isInitialized: Kt(st),
|
|
831
|
+
error: Kt(q),
|
|
832
832
|
init: v,
|
|
833
833
|
setUser: d,
|
|
834
834
|
setBusiness: o,
|
|
@@ -840,7 +840,7 @@ function Ce(p = be) {
|
|
|
840
840
|
reset: F
|
|
841
841
|
};
|
|
842
842
|
}
|
|
843
|
-
var
|
|
843
|
+
var le = () => Ce();
|
|
844
844
|
const _e = /* @__PURE__ */ new Set([
|
|
845
845
|
// vivo pizza prod
|
|
846
846
|
"business_6687e91fa7240b001ba3f4c2",
|
|
@@ -855,7 +855,7 @@ const _e = /* @__PURE__ */ new Set([
|
|
|
855
855
|
"business_655b25254fe3be001b123f0b",
|
|
856
856
|
// King Menu V4
|
|
857
857
|
"business_646ee00ebffa92001b84c4c7"
|
|
858
|
-
]),
|
|
858
|
+
]), oe = /* @__PURE__ */ new Set([
|
|
859
859
|
// zus dev
|
|
860
860
|
"business_671005de24a7f4001c87e25e",
|
|
861
861
|
// zus prod
|
|
@@ -883,116 +883,120 @@ function ue() {
|
|
|
883
883
|
enableTotalCost: !1,
|
|
884
884
|
enableWastageTemplate: !1,
|
|
885
885
|
manualReceive: !1,
|
|
886
|
-
mustUsePoTemplate: !1
|
|
886
|
+
mustUsePoTemplate: !1,
|
|
887
|
+
enableReturnStocks: !1
|
|
887
888
|
};
|
|
888
889
|
}
|
|
889
|
-
const
|
|
890
|
+
const I = gt(ue()), Te = () => ({
|
|
890
891
|
get businessDbName() {
|
|
891
892
|
var v;
|
|
892
893
|
return `business_${((v = ht().currentBusiness.value) == null ? void 0 : v._id) ?? ""}`;
|
|
893
894
|
},
|
|
894
895
|
get isWarehouse() {
|
|
895
|
-
var
|
|
896
|
-
return ((
|
|
896
|
+
var u;
|
|
897
|
+
return ((u = Dt()._currentLocation) == null ? void 0 : u.type) === ae.enum.warehouse;
|
|
897
898
|
},
|
|
898
899
|
get restaurantPosVersion() {
|
|
899
900
|
var v;
|
|
900
|
-
const
|
|
901
|
+
const S = Dt();
|
|
901
902
|
return (v = ht().restaurants.value.find(
|
|
902
903
|
(d) => {
|
|
903
904
|
var o;
|
|
904
|
-
return d._id === ((o =
|
|
905
|
+
return d._id === ((o = S._currentLocation) == null ? void 0 : o.doc._id);
|
|
905
906
|
}
|
|
906
907
|
)) == null ? void 0 : v.posVersion;
|
|
907
908
|
},
|
|
908
909
|
get enableTotalCost() {
|
|
909
|
-
return
|
|
910
|
+
return I.value.enableTotalCost;
|
|
910
911
|
},
|
|
911
912
|
get enableBackdatePo() {
|
|
912
|
-
return
|
|
913
|
+
return I.value.enableBackdatePo;
|
|
913
914
|
},
|
|
914
915
|
/** @deprecated TODO: remove */
|
|
915
916
|
get autoReceiveWarehouse() {
|
|
916
|
-
return
|
|
917
|
+
return I.value.autoReceiveWarehouse;
|
|
917
918
|
},
|
|
918
919
|
/** @deprecated TODO: remove */
|
|
919
920
|
get manualReceive() {
|
|
920
|
-
return
|
|
921
|
+
return I.value.manualReceive;
|
|
921
922
|
},
|
|
922
923
|
get enablePoTemplate() {
|
|
923
|
-
return
|
|
924
|
+
return I.value.enablePoTemplate;
|
|
924
925
|
},
|
|
925
926
|
get enableClosingTemplate() {
|
|
926
|
-
return
|
|
927
|
+
return I.value.enableClosingTemplate;
|
|
927
928
|
},
|
|
928
929
|
get enableWastageTemplate() {
|
|
929
|
-
return
|
|
930
|
+
return I.value.enableWastageTemplate;
|
|
930
931
|
},
|
|
931
932
|
get enableIngredientGroup() {
|
|
932
|
-
return
|
|
933
|
+
return I.value.enableIngredientGroup;
|
|
933
934
|
},
|
|
934
935
|
get mustUsePoTemplate() {
|
|
935
|
-
return
|
|
936
|
+
return I.value.mustUsePoTemplate;
|
|
936
937
|
},
|
|
937
938
|
get enableSupplierMasterList() {
|
|
938
|
-
return
|
|
939
|
+
return I.value.enableSupplierMasterList;
|
|
939
940
|
},
|
|
940
941
|
get businessSupplierOnly() {
|
|
941
|
-
return
|
|
942
|
+
return I.value.businessSupplierOnly;
|
|
943
|
+
},
|
|
944
|
+
get enableReturnStocks() {
|
|
945
|
+
return I.value.enableReturnStocks;
|
|
942
946
|
},
|
|
943
947
|
async init() {
|
|
944
|
-
const
|
|
945
|
-
await
|
|
948
|
+
const S = ht(), { init: u, setUser: v } = le(), d = S.namespace.value === "prod";
|
|
949
|
+
await u({
|
|
946
950
|
apiKey: d ? "6GhcttsJ9Rj9cTevcdrpin" : "MaGoXrEWuEJNpWgKTqseee"
|
|
947
951
|
// url: 'https://flag.feedme.farm/api/v1/', // optional -> this is a default URL value
|
|
948
952
|
// enableAnalytics: true, // optional, defaults to true
|
|
949
953
|
// cacheFlags: true // optional, defaults to true
|
|
950
|
-
}),
|
|
951
|
-
var
|
|
954
|
+
}), Dt().watchLocation(async (E) => {
|
|
955
|
+
var k, z, Y;
|
|
952
956
|
if (!E) {
|
|
953
|
-
|
|
957
|
+
I.value = ue();
|
|
954
958
|
return;
|
|
955
959
|
}
|
|
956
960
|
await v(E.doc._id);
|
|
957
|
-
const M = ye(), T = ht(), _ = `business_${((
|
|
961
|
+
const M = ye(), T = ht(), _ = `business_${((k = T.currentBusiness.value) == null ? void 0 : k._id) ?? ""}`, F = E.type === ae.enum.warehouse, g = (
|
|
958
962
|
// if menu v4, must manual receive && must use outlet app
|
|
959
963
|
((z = T.currentBusiness.value) == null ? void 0 : z.menuVersion) === "v4" && // more guard for businesses using menu v4, only those listed for manual receive will be included
|
|
960
964
|
// TODO: may be removed to use menu version only
|
|
961
965
|
_e.has(this.businessDbName)
|
|
962
|
-
),
|
|
966
|
+
), p = oe.has(_) || dt(
|
|
963
967
|
"inventory_portal_must_use_transfer_template"
|
|
964
968
|
/* inventory_portal_must_use_transfer_template */
|
|
965
969
|
), C = Ee.has(this.businessDbName) && (this.isWarehouse || M.state.closing !== null);
|
|
966
|
-
|
|
970
|
+
I.value = {
|
|
967
971
|
enableTotalCost: ((Y = T.currentBusiness.value) == null ? void 0 : Y.menuVersion) === "v4",
|
|
968
972
|
enableBackdatePo: C,
|
|
969
973
|
autoReceiveWarehouse: F && !g,
|
|
970
974
|
manualReceive: g,
|
|
971
|
-
enablePoTemplate:
|
|
972
|
-
enableClosingTemplate: Fe.has(_) &&
|
|
975
|
+
enablePoTemplate: p,
|
|
976
|
+
enableClosingTemplate: Fe.has(_) && dt(
|
|
973
977
|
"inventory_pos_closing_v2"
|
|
974
978
|
/* inventory_pos_closing_v2 */
|
|
975
979
|
),
|
|
976
|
-
enableWastageTemplate: xe.has(_) &&
|
|
980
|
+
enableWastageTemplate: xe.has(_) && dt(
|
|
977
981
|
"inventory_pos_adjust_v2_wastage"
|
|
978
982
|
/* inventory_pos_adjust_v2_wastage */
|
|
979
983
|
),
|
|
980
984
|
enableIngredientGroup: !1,
|
|
981
|
-
mustUsePoTemplate:
|
|
982
|
-
businessSupplierOnly:
|
|
983
|
-
enableSupplierMasterList:
|
|
985
|
+
mustUsePoTemplate: p,
|
|
986
|
+
businessSupplierOnly: p,
|
|
987
|
+
enableSupplierMasterList: oe.has(_),
|
|
988
|
+
enableReturnStocks: dt(
|
|
989
|
+
"inventory_portal_stock_return"
|
|
990
|
+
/* inventory_portal_stock_return */
|
|
991
|
+
)
|
|
984
992
|
};
|
|
985
993
|
}, "feature");
|
|
986
|
-
},
|
|
987
|
-
async setUser(p) {
|
|
988
|
-
const { setUser: l } = Jt();
|
|
989
|
-
await l(p.doc._id);
|
|
990
994
|
}
|
|
991
995
|
});
|
|
992
|
-
function
|
|
993
|
-
|
|
994
|
-
const { getFlagValue: v } =
|
|
995
|
-
return v(
|
|
996
|
+
function dt(S, u) {
|
|
997
|
+
u = u === void 0 ? null : u;
|
|
998
|
+
const { getFlagValue: v } = le();
|
|
999
|
+
return v(S, (d) => d === "true") ?? u;
|
|
996
1000
|
}
|
|
997
1001
|
export {
|
|
998
1002
|
Te as u
|