@feedmepos/mf-inventory-portal 0.0.25-dev.35 → 0.0.25-dev.37
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-C0_9-oDP.js +277 -0
- package/dist/{ApprovalView-lHxxupqD.js → ApprovalView-BDUbQAH0.js} +12 -18
- package/dist/{BindingsDialog-BYXxxF3D.js → BindingsDialog-BvKDyWAP.js} +4 -4
- package/dist/{BindingsPicker-BiOmhG63.js → BindingsPicker-zAexcP3H.js} +5 -5
- package/dist/{BindingsTable-C2CG0Wzx.js → BindingsTable-6dPndhbk.js} +5 -5
- package/dist/{ClosingDraftView-BO8Fg9uW.js → ClosingDraftView-NwwxcHA-.js} +2 -2
- package/dist/{ClosingTemplateView-DmBvstOM.js → ClosingTemplateView-Cfh0BZXH.js} +2 -2
- package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DKxW0e2c.js +211 -0
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-CQB9QYnf.js → FmUnitInput.vue_vue_type_script_setup_true_lang-CD0p0eOE.js} +1 -1
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DditohRx.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-eGofs51J.js} +1 -1
- package/dist/{IngredientGroupView-D5SpwtqP.js → IngredientGroupView-Cz4zcWgF.js} +1 -1
- package/dist/{IngredientsView-Dgw0nCeT.js → IngredientsView-Ctmor1Ds.js} +622 -605
- package/dist/{IntegrationView-BPkBh8lR.js → IntegrationView-DYV2ISmc.js} +23 -23
- package/dist/{InventoryBindingForm-COpLVAaA.js → InventoryBindingForm-Be75Cpzd.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BkyQOb8e.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-D8dK7h0Z.js} +11 -11
- package/dist/{InventoryBindingSummary-D6lmFeFs.js → InventoryBindingSummary-Cw1Woc3L.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BKzL_obr.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BhKk5nMz.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CRrDyI6N.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DECtXs-3.js} +1 -1
- package/dist/{PublishView-DRLVREhD.js → PublishView-D9mnP1d8.js} +11 -11
- package/dist/{PurchaseOrderPrintPreview-DvaJAeNk.js → PurchaseOrderPrintPreview-2DOgQczG.js} +1 -1
- package/dist/ReceiveRequestView-Ss803mII.js +2547 -0
- package/dist/{RecipeView-BFVpv5zA.js → RecipeView-DTwkk7M_.js} +3 -3
- package/dist/{StockView-BOzx7POz.js → StockView-cd047f5L.js} +7 -7
- package/dist/{SupplierView-DA3-b1sK.js → SupplierView-CkYiC3sV.js} +4 -4
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CE3vSlpG.js +1540 -0
- package/dist/{TransferTemplateView-V4C_flzB.js → TransferTemplateView-C6-6Db2r.js} +7 -7
- package/dist/{UnitView-CfQSRLN9.js → UnitView-C-1I-kVv.js} +3 -3
- package/dist/{WarehouseView-B5mEXts4.js → WarehouseView-CJTtNzco.js} +1 -1
- package/dist/api/purchase-order.d.ts +2 -2
- package/dist/{app-tDCjbNqA.js → app-C720GM9g.js} +6632 -6672
- package/dist/app.js +1 -1
- package/dist/components/FmMultiselectDialog.d.ts +1 -24
- package/dist/{decimal-BXNZd-qR.js → decimal-BCdHyq3s.js} +1 -1
- package/dist/{feature-RoIIaF13.js → feature-Df0TfAlQ.js} +227 -231
- package/dist/{format-unit-display-B2P_1U8-.js → format-unit-display-DhVGfJ3A.js} +2 -2
- package/dist/{index-0DbWAreR.js → index-BcO0U3XD.js} +2 -2
- package/dist/{stock-BkYwqicV.js → stock-AgQ9Kd12.js} +1 -1
- package/dist/stores/feature.d.ts +2 -3
- package/dist/{supplier-2qlZME6l.js → supplier-y6wN-U1P.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-D9bLhIPr.js → use-ingredient-select-dialog-DedAlRiZ.js} +1 -1
- package/dist/{use-inventory-binding-dialog-FprlSH51.js → use-inventory-binding-dialog-D6ESCCxB.js} +1 -1
- package/dist/views/receive-request/components/transfer-details/TransferDetails.vue.d.ts +0 -1375
- package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +1 -3
- package/dist/views/receive-request/components/transfer-dialog/TransferDialogProps.d.ts +0 -3
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +3022 -0
- package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +2 -1
- package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +1 -0
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +9 -27
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +9 -22
- package/dist/views/receive-request/helper/print-po.d.ts +2 -9
- package/dist/{vue-i18n-C2CwX0tc.js → vue-i18n-C4yPgaCz.js} +397 -397
- package/package.json +1 -1
- package/dist/App-DPw6U_NJ.js +0 -280
- package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CJ7BgFh6.js +0 -215
- package/dist/ReceiveRequestView-C9Hqtit6.js +0 -2661
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DRUroMZS.js +0 -1843
- package/dist/components/MountListener.vue.d.ts +0 -15
- package/dist/views/receive-request/helper/po-to-po-template.util.d.ts +0 -1
- package/dist/views/transfer-template/helpers/location-to-po-supplier.util.d.ts +0 -75
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var fe = Object.defineProperty;
|
|
2
|
-
var pe = (
|
|
3
|
-
var
|
|
4
|
-
import { useCoreStore as
|
|
5
|
-
import { a4 as
|
|
2
|
+
var pe = (p, l, v) => l in p ? fe(p, l, { enumerable: !0, configurable: !0, writable: !0, value: v }) : p[l] = v;
|
|
3
|
+
var ct = (p, l, v) => pe(p, typeof l != "symbol" ? l + "" : l, v);
|
|
4
|
+
import { useCoreStore as ht } from "@feedmepos/mf-common";
|
|
5
|
+
import { a4 as vt, u as Dt, aH as re, a as ye } from "./app-C720GM9g.js";
|
|
6
6
|
import { ref as gt, readonly as Kt } from "vue";
|
|
7
7
|
var Gt = { exports: {} };
|
|
8
|
-
(function(
|
|
8
|
+
(function(p, l) {
|
|
9
9
|
(function(v, d) {
|
|
10
|
-
d(
|
|
11
|
-
})(
|
|
10
|
+
d(l);
|
|
11
|
+
})(vt, function(v) {
|
|
12
12
|
var d = { getItemSync: function(a) {
|
|
13
13
|
try {
|
|
14
14
|
return localStorage.getItem(a) || null;
|
|
@@ -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 (u) {
|
|
48
|
+
r(u);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
function c(f) {
|
|
52
52
|
try {
|
|
53
53
|
h(i.throw(f));
|
|
54
|
-
} catch (
|
|
55
|
-
r(
|
|
54
|
+
} catch (u) {
|
|
55
|
+
r(u);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
function h(f) {
|
|
59
|
-
var
|
|
60
|
-
f.done ? n(f.value) : (
|
|
61
|
-
|
|
59
|
+
var u;
|
|
60
|
+
f.done ? n(f.value) : (u = f.value, u instanceof t ? u : new t(function(m) {
|
|
61
|
+
m(u);
|
|
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(u) {
|
|
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 & u[0] ? i.return : u[0] ? i.throw || ((n = i.return) && n.call(i), 0) : i.next) && !(n = n.call(i, u[1])).done) return n;
|
|
81
|
+
switch (i = 0, n && (u = [2 & u[0], n.value]), u[0]) {
|
|
82
82
|
case 0:
|
|
83
83
|
case 1:
|
|
84
|
-
n =
|
|
84
|
+
n = u;
|
|
85
85
|
break;
|
|
86
86
|
case 4:
|
|
87
|
-
return s.label++, { value:
|
|
87
|
+
return s.label++, { value: u[1], done: !1 };
|
|
88
88
|
case 5:
|
|
89
|
-
s.label++, i =
|
|
89
|
+
s.label++, i = u[1], u = [0];
|
|
90
90
|
continue;
|
|
91
91
|
case 7:
|
|
92
|
-
|
|
92
|
+
u = 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]) || u[0] !== 6 && u[0] !== 2)) {
|
|
96
96
|
s = 0;
|
|
97
97
|
continue;
|
|
98
98
|
}
|
|
99
|
-
if (
|
|
100
|
-
s.label =
|
|
99
|
+
if (u[0] === 3 && (!n || u[1] > n[0] && u[1] < n[3])) {
|
|
100
|
+
s.label = u[1];
|
|
101
101
|
break;
|
|
102
102
|
}
|
|
103
|
-
if (
|
|
104
|
-
s.label = n[1], n =
|
|
103
|
+
if (u[0] === 6 && s.label < n[1]) {
|
|
104
|
+
s.label = n[1], n = u;
|
|
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(u);
|
|
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
|
+
u = e.call(a, s);
|
|
115
|
+
} catch (m) {
|
|
116
|
+
u = [6, m], i = 0;
|
|
117
117
|
} finally {
|
|
118
118
|
t = n = 0;
|
|
119
119
|
}
|
|
120
|
-
if (5 &
|
|
121
|
-
return { value:
|
|
120
|
+
if (5 & u[0]) throw u[1];
|
|
121
|
+
return { value: u[0] ? u[1] : void 0, done: !0 };
|
|
122
122
|
}([h, f]);
|
|
123
123
|
};
|
|
124
124
|
}
|
|
@@ -159,78 +159,78 @@ var Gt = { exports: {} };
|
|
|
159
159
|
Object.keys(e || {}).includes(i) || t.push(i);
|
|
160
160
|
}), Object.keys(t).length ? t : null;
|
|
161
161
|
}
|
|
162
|
-
var
|
|
163
|
-
function
|
|
162
|
+
var E, g;
|
|
163
|
+
function y(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 R(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: R(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
|
-
})(
|
|
182
|
-
var Y, T = null, ce = "FLAGSMITH_EVENT",
|
|
181
|
+
})(E || (E = {}));
|
|
182
|
+
var Y, T = null, ce = "FLAGSMITH_EVENT", lt = ce, Vt = "https://edge.api.flagsmith.com/api/v1/", Mt = "flagsmith_value_", Bt = "flagsmith_enabled_", zt = "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, u, m, F;
|
|
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, k = h.identifier;
|
|
192
192
|
t.isLoading = !1;
|
|
193
193
|
var j = {}, N = {};
|
|
194
|
-
A = A || [], (D = D || []).forEach(function(
|
|
195
|
-
j[
|
|
196
|
-
}), A.forEach(function(
|
|
197
|
-
N[
|
|
194
|
+
A = A || [], (D = D || []).forEach(function(S) {
|
|
195
|
+
j[S.feature.name.toLowerCase().replace(/ /g, "_")] = { id: S.feature.id, enabled: S.enabled, value: S.feature_state_value };
|
|
196
|
+
}), A.forEach(function(S) {
|
|
197
|
+
N[S.trait_key.toLowerCase().replace(/ /g, "_")] = { transient: S.transient, value: S.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, N);
|
|
200
|
-
if ((
|
|
200
|
+
if ((k || Object.keys(N).length) && (t.evaluationContext.identity = o(o({}, t.evaluationContext.identity), { traits: N }), k && (t.evaluationContext.identity.identifier = k)), t.flags = j, t.updateStorage(), t._onChange(t.oldFlags, { isFromServer: !0, flagsChanged: K, traitsChanged: nt }, t._loadedState(null, E.SERVER)), t.datadogRum) try {
|
|
201
201
|
if (t.datadogRum.trackTraits) {
|
|
202
202
|
var it = {};
|
|
203
|
-
Object.keys(((
|
|
204
|
-
it[
|
|
203
|
+
Object.keys(((u = t.evaluationContext.identity) === null || u === void 0 ? void 0 : u.traits) || {}).map(function(S) {
|
|
204
|
+
it[zt + S] = t.getTrait(S);
|
|
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 || ((m = t.evaluationContext.identity) === null || m === void 0 ? void 0 : m.identifier) }), it);
|
|
207
207
|
t.log("Setting Datadog user", Z), t.datadogRum.client.setUser(Z);
|
|
208
208
|
}
|
|
209
|
-
} catch (
|
|
210
|
-
console.error(
|
|
209
|
+
} catch (S) {
|
|
210
|
+
console.error(S);
|
|
211
211
|
}
|
|
212
212
|
if (t.dtrum) try {
|
|
213
|
-
var
|
|
214
|
-
Object.keys(t.flags).map(function(
|
|
215
|
-
|
|
216
|
-
}), Object.keys(((
|
|
217
|
-
|
|
218
|
-
}), t.log("Sending javaLongOrObject traits to dynatrace",
|
|
219
|
-
} catch (
|
|
220
|
-
console.error(
|
|
213
|
+
var w = { javaDouble: {}, date: {}, shortString: {}, javaLongOrObject: {} };
|
|
214
|
+
Object.keys(t.flags).map(function(S) {
|
|
215
|
+
y(w, Mt + S, t.getValue(S, { skipAnalytics: !0 })), y(w, Bt + S, t.hasFeature(S, { skipAnalytics: !0 }));
|
|
216
|
+
}), Object.keys(((F = t.evaluationContext.identity) === null || F === void 0 ? void 0 : F.traits) || {}).map(function(S) {
|
|
217
|
+
y(w, zt + S, t.getTrait(S));
|
|
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 (S) {
|
|
220
|
+
console.error(S);
|
|
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], u = h[1];
|
|
226
|
+
return { trait_key: f, trait_value: u == null ? void 0 : u.value, transient: u == null ? void 0 : u.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, u = new Error(f);
|
|
233
|
+
return Promise.reject(u);
|
|
234
234
|
}) : t.getJSON(n + "flags/").then(function(h) {
|
|
235
235
|
return c({ flags: h, traits: void 0 });
|
|
236
236
|
});
|
|
@@ -244,7 +244,7 @@ var Gt = { exports: {} };
|
|
|
244
244
|
}).catch(function(n) {
|
|
245
245
|
t.log("Exception fetching evaluationEvent", n);
|
|
246
246
|
}) : void 0;
|
|
247
|
-
}, this.datadogRum = null, this.loadingState = { isLoading: !0, isFetching: !0, error: null, source:
|
|
247
|
+
}, this.datadogRum = null, this.loadingState = { isLoading: !0, isFetching: !0, error: null, source: E.NONE }, this.canUseStorage = !1, this.analyticsInterval = null, this.api = null, this.cacheFlags = !1, this.ts = null, this.enableAnalytics = !1, this.enableLogs = !1, this.evaluationContext = {}, this.evaluationEvent = null, this.flags = null, this.getFlagInterval = null, this.headers = null, this.initialised = !1, this.oldFlags = null, this.onChange = null, this.onError = null, this.ticks = null, this.timer = null, this.dtrum = null, this.withTraits = null, this.cacheOptions = { ttl: 0, skipAPI: !1, loadStale: !1, storageKey: void 0 }, this.getValue = function(i, n, r) {
|
|
248
248
|
var s = t.flags && t.flags[i.toLowerCase().replace(/ /g, "_")], c = null;
|
|
249
249
|
if (s && (c = s.value), n != null && n.skipAnalytics || r || t.evaluateFlag(i, "VALUE"), c === null && (n == null ? void 0 : n.fallback) !== void 0) return n.fallback;
|
|
250
250
|
if (n != null && n.json) try {
|
|
@@ -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), R(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(
|
|
295
|
-
var
|
|
296
|
-
if (
|
|
297
|
-
var
|
|
298
|
-
if (
|
|
299
|
-
var j = parseFloat(
|
|
293
|
+
var u = "".concat((s = t.evaluationContext.identity) === null || s === void 0 ? void 0 : s.identifier);
|
|
294
|
+
return g(i, f).then(function(m) {
|
|
295
|
+
var F, D, A = "".concat((F = t.evaluationContext.identity) === null || F === void 0 ? void 0 : F.identifier);
|
|
296
|
+
if (u === A) {
|
|
297
|
+
var k = (D = m.headers) === null || D === void 0 ? void 0 : D.get("x-flagsmith-document-updated-at");
|
|
298
|
+
if (k) try {
|
|
299
|
+
var j = parseFloat(k);
|
|
300
300
|
if (isNaN(j)) return Promise.reject("Failed to parse x-flagsmith-document-updated-at");
|
|
301
301
|
t.timestamp = j;
|
|
302
302
|
} catch (N) {
|
|
303
|
-
t.log(N, "Failed to parse x-flagsmith-document-updated-at",
|
|
303
|
+
t.log(N, "Failed to parse x-flagsmith-document-updated-at", k);
|
|
304
304
|
}
|
|
305
|
-
return t.log("Fetch response: " +
|
|
305
|
+
return t.log("Fetch response: " + m.status + " " + (n || "GET") + 0 + i), m.text().then(function(N) {
|
|
306
306
|
var K = N;
|
|
307
307
|
try {
|
|
308
308
|
K = JSON.parse(N);
|
|
309
309
|
} catch {
|
|
310
310
|
}
|
|
311
|
-
return !K &&
|
|
311
|
+
return !K && m.status && (K = "API Response: ".concat(m.status)), m.status && m.status >= 200 && m.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(u, ", 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(Mt + i, t.getValue(i, {}, !0)) : t.datadogRum.client.addFeatureFlagEvaluation(Bt + 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 :
|
|
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 && (T = e.AsyncStorage);
|
|
326
326
|
}
|
|
327
327
|
return a.prototype.init = function(e) {
|
|
328
328
|
var t, i, n;
|
|
329
329
|
return x(this, void 0, void 0, function() {
|
|
330
|
-
var r, s, c, h, f,
|
|
330
|
+
var r, s, c, h, f, u, m, F, D, A, k, j, N, K, nt, it, Z, w, S, pt, at, Zt, Q, yt, Qt, te, mt, ee, St, rt, tt, ne, 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 ?
|
|
336
|
+
if (U.trys.push([1, 13, , 14]), s = e.environmentID, c = e.api, h = c === void 0 ? Vt : c, f = e.headers, u = e.onChange, m = e.cacheFlags, F = e.datadogRum, D = e.onError, A = e.defaultFlags, k = e.fetch, j = e.preventFetch, N = e.enableLogs, K = e.enableDynatrace, nt = e.enableAnalytics, it = e.realtime, Z = e.eventSourceUrl, w = Z === void 0 ? "https://realtime.flagsmith.com/" : Z, S = e.AsyncStorage, pt = e.identity, at = e.traits, Zt = e.state, Q = e.cacheOptions, yt = e.angularHttpClient, Qt = e._trigger, te = 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
337
|
if (r.identity = pt || at ? { identifier: pt, traits: at ? Object.fromEntries(Object.entries(at).map(function(P) {
|
|
338
338
|
return [P[0], { value: P[1] }];
|
|
339
|
-
})) : {} } : r.identity, this.evaluationContext = r, this.api = h, this.headers = f, this.getFlagInterval = null, this.analyticsInterval = null, this.onChange =
|
|
340
|
-
|
|
341
|
-
}, this.enableLogs = N || !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."),
|
|
339
|
+
})) : {} } : r.identity, this.evaluationContext = r, this.api = h, this.headers = f, this.getFlagInterval = null, this.analyticsInterval = null, this.onChange = u, mt = "Wrong Flagsmith Configuration: preventFetch is true and no defaulFlags provided", this._trigger = Qt || this._trigger, this._triggerLoadingState = te || this._triggerLoadingState, this.onError = function(P) {
|
|
340
|
+
O.setLoadingState(o(o({}, O.loadingState), { isFetching: !1, isLoading: !1, error: P })), D == null || D(P);
|
|
341
|
+
}, this.enableLogs = N || !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."), k && (g = k), this.enableAnalytics = nt || !1, this.flags = Object.assign({}, A) || {}, this.datadogRum = F || null, this.initialised = !0, this.ticks = 1e4, this.timer = this.enableLogs ? (/* @__PURE__ */ new Date()).valueOf() : null, this.cacheFlags = T !== void 0 && !!m, lt = "FLAGSMITH_EVENT_" + r.environment.apiKey, S && (T = S), it && typeof window < "u" && this.setupRealtime(w, r.environment.apiKey), Object.keys(this.flags).length && (this.loadingState = o(o({}, this.loadingState), { isLoading: !1, source: E.DEFAULT_FLAGS })), this.setState(Zt), 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(P) {
|
|
342
342
|
return function(G, J) {
|
|
343
343
|
var H = J.headers, b = J.method, et = J.body;
|
|
344
344
|
return new Promise(function(q) {
|
|
@@ -359,35 +359,35 @@ var Gt = { exports: {} };
|
|
|
359
359
|
}
|
|
360
360
|
});
|
|
361
361
|
};
|
|
362
|
-
}(yt)), T && this.canUseStorage && T.getItem(
|
|
362
|
+
}(yt)), T && this.canUseStorage && T.getItem(lt).then(function(P) {
|
|
363
363
|
try {
|
|
364
|
-
|
|
364
|
+
O.evaluationEvent = JSON.parse(P) || {};
|
|
365
365
|
} catch {
|
|
366
|
-
|
|
366
|
+
O.evaluationEvent = {};
|
|
367
367
|
}
|
|
368
|
-
|
|
369
|
-
}), this.enableAnalytics && (this.analyticsInterval && clearInterval(this.analyticsInterval), T && this.canUseStorage && T.getItem(
|
|
370
|
-
if (G &&
|
|
368
|
+
O.analyticsInterval = setInterval(O.analyticsFlags, O.ticks);
|
|
369
|
+
}), this.enableAnalytics && (this.analyticsInterval && clearInterval(this.analyticsInterval), T && this.canUseStorage && T.getItem(lt, function(P, G) {
|
|
370
|
+
if (G && O.evaluationContext.environment) {
|
|
371
371
|
var J = JSON.parse(G);
|
|
372
|
-
if (J[
|
|
373
|
-
var H =
|
|
374
|
-
|
|
372
|
+
if (J[O.evaluationContext.environment.apiKey]) {
|
|
373
|
+
var H = O.getState();
|
|
374
|
+
O.log("Retrieved events from cache", G), O.setState(o(o({}, H), { evaluationEvent: J[O.evaluationContext.environment.apiKey] }));
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
|
-
})), !
|
|
377
|
+
})), !m) return [3, 9];
|
|
378
378
|
if (!T || !this.canUseStorage) return [3, 8];
|
|
379
|
-
|
|
380
|
-
return x(
|
|
381
|
-
var J, H, b, et, q, B, bt,
|
|
379
|
+
ee = function(P, G) {
|
|
380
|
+
return x(O, void 0, void 0, function() {
|
|
381
|
+
var J, H, b, et, q, B, bt, ie, Ct, _t, xt, Et, Ft, wt, Ot, It, Tt, Lt, At, jt, Nt, Pt, Rt, kt, ae = 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, q = !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) === ((xt = this.evaluationContext.environment) === null || xt === void 0 ? void 0 : xt.apiKey) && (B = !0, this.evaluationContext.identity && ((Ft = (Et = b.evaluationContext) === null || Et === void 0 ? void 0 : Et.identity) === null || Ft === void 0 ? void 0 : Ft.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"), q = !0, B = !0)), B && (et = !0, H = _((It = this.evaluationContext.identity) === null || It === void 0 ? void 0 : It.traits, (Lt = (Tt = b.evaluationContext) === null || Tt === void 0 ? void 0 : Tt.identity) === null || Lt === void 0 ? void 0 : Lt.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({}, ((Pt = (Nt = b.evaluationContext) === null || Nt === void 0 ? void 0 : Nt.identity) === null || Pt === void 0 ? void 0 : Pt.traits) || {}), at || {}) }) : void 0 })) })), this.log("Retrieved flags from cache", b))), et ? (bt = !j && (!this.cacheOptions.skipAPI || q), this._onChange(null, { isFromServer: !1, flagsChanged: J, traitsChanged: H }, this._loadedState(null,
|
|
388
|
+
return $.trys.push([1, 5, , 6]), b = JSON.parse(G), et = !1, q = !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) === ((xt = this.evaluationContext.environment) === null || xt === void 0 ? void 0 : xt.apiKey) && (B = !0, this.evaluationContext.identity && ((Ft = (Et = b.evaluationContext) === null || Et === void 0 ? void 0 : Et.identity) === null || Ft === void 0 ? void 0 : Ft.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"), q = !0, B = !0)), B && (et = !0, H = _((It = this.evaluationContext.identity) === null || It === void 0 ? void 0 : It.traits, (Lt = (Tt = b.evaluationContext) === null || Tt === void 0 ? void 0 : Tt.identity) === null || Lt === void 0 ? void 0 : Lt.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({}, ((Pt = (Nt = b.evaluationContext) === null || Nt === void 0 ? void 0 : Nt.identity) === null || Pt === void 0 ? void 0 : Pt.traits) || {}), at || {}) }) : void 0 })) })), this.log("Retrieved flags from cache", b))), et ? (bt = !j && (!this.cacheOptions.skipAPI || q), this._onChange(null, { isFromServer: !1, flagsChanged: J, traitsChanged: H }, this._loadedState(null, E.CACHE, bt)), this.oldFlags = this.flags, this.cacheOptions.skipAPI && et && !q && this.log("Skipping API, using cache"), bt && this.getFlags().catch(function(ge) {
|
|
389
389
|
var Ut;
|
|
390
|
-
(Ut =
|
|
390
|
+
(Ut = ae.onError) === null || Ut === void 0 || Ut.call(ae, 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 ie = $.sent(), this.log("Exception fetching cached logs", ie), [3, 6];
|
|
400
400
|
case 6:
|
|
401
401
|
return [3, 10];
|
|
402
402
|
case 7:
|
|
@@ -404,10 +404,10 @@ 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: _({}, (Rt = this.evaluationContext.identity) === null || Rt === void 0 ? void 0 : Rt.traits) }, this._loadedState(null, E.DEFAULT_FLAGS));
|
|
408
408
|
else {
|
|
409
409
|
if (!this.flags) throw new Error(mt);
|
|
410
|
-
this._onChange(null, { isFromServer: !1, flagsChanged: _({}, this.flags), traitsChanged: _({}, (
|
|
410
|
+
this._onChange(null, { isFromServer: !1, flagsChanged: _({}, this.flags), traitsChanged: _({}, (kt = this.evaluationContext.identity) === null || kt === void 0 ? void 0 : kt.traits) }, this._loadedState(null, E.DEFAULT_FLAGS));
|
|
411
411
|
}
|
|
412
412
|
$.label = 10;
|
|
413
413
|
case 10:
|
|
@@ -423,7 +423,7 @@ var Gt = { exports: {} };
|
|
|
423
423
|
case 4:
|
|
424
424
|
St = U.sent(), U.label = 5;
|
|
425
425
|
case 5:
|
|
426
|
-
return [4,
|
|
426
|
+
return [4, ee(null, St)];
|
|
427
427
|
case 6:
|
|
428
428
|
case 7:
|
|
429
429
|
return U.sent(), [3, 8];
|
|
@@ -434,13 +434,13 @@ var Gt = { exports: {} };
|
|
|
434
434
|
case 10:
|
|
435
435
|
return U.sent(), [3, 12];
|
|
436
436
|
case 11:
|
|
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,
|
|
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,
|
|
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, E.DEFAULT_FLAGS));
|
|
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, E.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), ne = tt instanceof Error ? tt : new Error("".concat(tt)), (n = this.onError) === null || n === void 0 || n.call(this, ne), 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 || Vt, 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) {
|
|
@@ -477,7 +477,7 @@ var Gt = { exports: {} };
|
|
|
477
477
|
}, a.prototype.updateEventStorage = function() {
|
|
478
478
|
if (this.enableAnalytics) {
|
|
479
479
|
var e = JSON.stringify(this.getState().evaluationEvent);
|
|
480
|
-
T.setItem(
|
|
480
|
+
T.setItem(lt, e).catch(function(t) {
|
|
481
481
|
return console.error("Flagsmith: Error setting item in async storage", t);
|
|
482
482
|
});
|
|
483
483
|
}
|
|
@@ -497,30 +497,30 @@ var Gt = { exports: {} };
|
|
|
497
497
|
})) : this.log("Error, EventSource is undefined");
|
|
498
498
|
}, a;
|
|
499
499
|
}();
|
|
500
|
-
function
|
|
500
|
+
function Ht(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
|
}
|
|
504
|
-
var
|
|
505
|
-
return
|
|
504
|
+
var ut, ve = (ut = function(a, e) {
|
|
505
|
+
return ut = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, i) {
|
|
506
506
|
t.__proto__ = i;
|
|
507
507
|
} || function(t, i) {
|
|
508
508
|
for (var n in i) Object.prototype.hasOwnProperty.call(i, n) && (t[n] = i[n]);
|
|
509
|
-
},
|
|
509
|
+
}, ut(a, e);
|
|
510
510
|
}, function(a, e) {
|
|
511
511
|
if (typeof e != "function" && e !== null) throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
|
|
512
512
|
function t() {
|
|
513
513
|
this.constructor = a;
|
|
514
514
|
}
|
|
515
|
-
|
|
516
|
-
}),
|
|
515
|
+
ut(a, e), a.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
|
|
516
|
+
}), $t = 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
|
+
}, Xt = 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 = [];
|
|
@@ -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 = $t(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 = $t(ft([], Xt(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] = ft(ft([],
|
|
617
|
+
n.includes(t) || (this._listeners[e] = ft(ft([], Xt(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,66 +636,66 @@ 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(u) {
|
|
640
|
+
return c[u.toLowerCase()];
|
|
641
|
+
}, has: function(u) {
|
|
642
|
+
return u.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(u, m, F) {
|
|
647
|
+
r.push(m = m.toLowerCase()), s.push([m, F]), c[m] = c[m] ? c[m] + "," + F : F;
|
|
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
|
+
}, Yt = Ht({ AsyncStorage: d, fetch: Wt, eventSource: qt });
|
|
653
|
+
typeof window < "u" && (window.flagsmith = Yt), v.createFlagsmithInstance = function() {
|
|
654
|
+
return Ht({ AsyncStorage: d, fetch: Wt, eventSource: qt });
|
|
655
|
+
}, v.default = Yt, Object.defineProperty(v, "__esModule", { value: !0 });
|
|
656
656
|
});
|
|
657
657
|
})(Gt, Gt.exports);
|
|
658
|
-
var me = Gt.exports,
|
|
658
|
+
var me = Gt.exports, se = {
|
|
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
|
+
}, oe = "business", V, Se = (V = class {
|
|
665
665
|
constructor() {
|
|
666
|
-
|
|
667
|
-
|
|
666
|
+
ct(this, "flagsmithClient", null);
|
|
667
|
+
ct(this, "userContext", null);
|
|
668
668
|
}
|
|
669
669
|
static getInstance() {
|
|
670
670
|
return V.instance || (V.instance = new V()), V.instance;
|
|
671
671
|
}
|
|
672
672
|
ensureInitialized() {
|
|
673
673
|
if (!this.flagsmithClient)
|
|
674
|
-
throw new Error(
|
|
674
|
+
throw new Error(se.NOT_INITIALIZED);
|
|
675
675
|
}
|
|
676
|
-
async init(
|
|
676
|
+
async init(l, v = []) {
|
|
677
677
|
if (!this.flagsmithClient)
|
|
678
678
|
try {
|
|
679
679
|
this.flagsmithClient = me.createFlagsmithInstance();
|
|
680
680
|
const d = v.reduce((o, x) => (o[x.feature.name] = x, o), {});
|
|
681
681
|
await this.flagsmithClient.init({
|
|
682
|
-
environmentID:
|
|
683
|
-
api: (
|
|
684
|
-
enableAnalytics: (
|
|
682
|
+
environmentID: l.apiKey,
|
|
683
|
+
api: (l == null ? void 0 : l.url) ?? "https://flag.feedme.farm/api/v1/",
|
|
684
|
+
enableAnalytics: (l == null ? void 0 : l.enableAnalytics) ?? !0,
|
|
685
685
|
defaultFlags: d,
|
|
686
|
-
cacheFlags: (
|
|
686
|
+
cacheFlags: (l == null ? void 0 : l.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(l, v) {
|
|
693
|
+
this.ensureInitialized(), this.userContext = { identifier: l, traits: v }, await this.updateContext();
|
|
694
694
|
}
|
|
695
|
-
async addTraits(
|
|
695
|
+
async addTraits(l) {
|
|
696
696
|
if (this.ensureInitialized(), !this.userContext)
|
|
697
|
-
throw new Error(
|
|
698
|
-
this.userContext.traits = { ...this.userContext.traits, ...
|
|
697
|
+
throw new Error(se.NO_USER_CONTEXT);
|
|
698
|
+
this.userContext.traits = { ...this.userContext.traits, ...l }, await this.updateContext();
|
|
699
699
|
}
|
|
700
700
|
async updateContext() {
|
|
701
701
|
try {
|
|
@@ -706,14 +706,14 @@ var me = Gt.exports, re = {
|
|
|
706
706
|
traits: this.userContext.traits || {}
|
|
707
707
|
}
|
|
708
708
|
});
|
|
709
|
-
} catch (
|
|
710
|
-
throw console.error("Failed to update user context:",
|
|
709
|
+
} catch (l) {
|
|
710
|
+
throw console.error("Failed to update user context:", l), l;
|
|
711
711
|
}
|
|
712
712
|
}
|
|
713
713
|
async getFlags() {
|
|
714
714
|
this.ensureInitialized();
|
|
715
|
-
const
|
|
716
|
-
return Object.entries(
|
|
715
|
+
const l = this.flagsmithClient.getAllFlags();
|
|
716
|
+
return Object.entries(l).map(([v, d]) => {
|
|
717
717
|
var o;
|
|
718
718
|
return {
|
|
719
719
|
feature: {
|
|
@@ -725,9 +725,9 @@ var me = Gt.exports, re = {
|
|
|
725
725
|
};
|
|
726
726
|
});
|
|
727
727
|
}
|
|
728
|
-
getFlagValue(
|
|
728
|
+
getFlagValue(l, v) {
|
|
729
729
|
this.ensureInitialized();
|
|
730
|
-
const d = this.flagsmithClient.getValue(
|
|
730
|
+
const d = this.flagsmithClient.getValue(l);
|
|
731
731
|
if (d == null)
|
|
732
732
|
return null;
|
|
733
733
|
try {
|
|
@@ -737,25 +737,25 @@ var me = Gt.exports, re = {
|
|
|
737
737
|
return console.error("Error transforming flag value:", o), null;
|
|
738
738
|
}
|
|
739
739
|
}
|
|
740
|
-
getFlag(
|
|
740
|
+
getFlag(l) {
|
|
741
741
|
this.ensureInitialized();
|
|
742
|
-
const v = this.flagsmithClient.getValue(
|
|
742
|
+
const v = this.flagsmithClient.getValue(l);
|
|
743
743
|
if (v == null) return null;
|
|
744
|
-
const d = this.flagsmithClient.hasFeature(
|
|
744
|
+
const d = this.flagsmithClient.hasFeature(l);
|
|
745
745
|
return {
|
|
746
746
|
feature: {
|
|
747
|
-
name:
|
|
747
|
+
name: l,
|
|
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(l, v, d = null, o) {
|
|
755
755
|
var M;
|
|
756
756
|
const x = this.userContext;
|
|
757
757
|
try {
|
|
758
|
-
return await this.setUser(
|
|
758
|
+
return await this.setUser(l), this.getFlagValue(v, o) ?? d;
|
|
759
759
|
} catch (L) {
|
|
760
760
|
return console.error(`Error getting user flag value for ${v}:`, L), d;
|
|
761
761
|
} finally {
|
|
@@ -769,56 +769,56 @@ var me = Gt.exports, re = {
|
|
|
769
769
|
reset() {
|
|
770
770
|
this.flagsmithClient = null, this.userContext = null;
|
|
771
771
|
}
|
|
772
|
-
},
|
|
773
|
-
function Ce(
|
|
774
|
-
const
|
|
772
|
+
}, ct(V, "instance"), V), be = Se.getInstance(), st = gt(!1), ot = gt([]), X = gt(null);
|
|
773
|
+
function Ce(p = be) {
|
|
774
|
+
const l = () => st.value ? !0 : (console.warn("FeatureFlag is not initialized. Using default values."), !1), v = async (g, y = []) => {
|
|
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 p.init(g, y), ot.value = await p.getFlags(), st.value = !0, X.value = null;
|
|
781
781
|
} catch (C) {
|
|
782
782
|
console.error("Failed to initialize feature flags:", C), X.value = C;
|
|
783
783
|
}
|
|
784
|
-
}, d = async (g,
|
|
785
|
-
if (
|
|
784
|
+
}, d = async (g, y) => {
|
|
785
|
+
if (l())
|
|
786
786
|
try {
|
|
787
|
-
await
|
|
787
|
+
await p.setUser(g, y), ot.value = await p.getFlags(), X.value = null;
|
|
788
788
|
} catch (C) {
|
|
789
789
|
console.error("Failed to set user:", C), X.value = C;
|
|
790
790
|
}
|
|
791
|
-
}, o = async (g,
|
|
792
|
-
if (
|
|
791
|
+
}, o = async (g, y) => d(`${oe}-${g}`, y), x = async (g) => {
|
|
792
|
+
if (l())
|
|
793
793
|
try {
|
|
794
|
-
await
|
|
795
|
-
} catch (
|
|
796
|
-
console.error("Failed to add traits:",
|
|
794
|
+
await p.addTraits(g), ot.value = await p.getFlags(), X.value = null;
|
|
795
|
+
} catch (y) {
|
|
796
|
+
console.error("Failed to add traits:", y), X.value = y;
|
|
797
797
|
}
|
|
798
|
-
}, M = (g,
|
|
799
|
-
if (!
|
|
798
|
+
}, M = (g, y, C = null) => {
|
|
799
|
+
if (!l()) return C;
|
|
800
800
|
try {
|
|
801
|
-
return
|
|
802
|
-
} catch (
|
|
803
|
-
return console.error(`Error getting flag value for ${g}:`,
|
|
801
|
+
return p.getFlagValue(g, y) ?? C;
|
|
802
|
+
} catch (R) {
|
|
803
|
+
return console.error(`Error getting flag value for ${g}:`, R), C;
|
|
804
804
|
}
|
|
805
|
-
}, L = (g,
|
|
806
|
-
if (!
|
|
805
|
+
}, L = (g, y) => {
|
|
806
|
+
if (!l()) return y ?? null;
|
|
807
807
|
try {
|
|
808
|
-
return
|
|
808
|
+
return p.getFlag(g) ?? y ?? 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), y ?? null;
|
|
811
811
|
}
|
|
812
|
-
}, W = async (g,
|
|
813
|
-
if (!
|
|
812
|
+
}, W = async (g, y, C = null, R) => {
|
|
813
|
+
if (!l()) return C;
|
|
814
814
|
try {
|
|
815
|
-
return await
|
|
815
|
+
return await p.getUserFlagValue(g, y, C, R);
|
|
816
816
|
} catch (z) {
|
|
817
|
-
return console.error(`Error getting user flag value for ${
|
|
817
|
+
return console.error(`Error getting user flag value for ${y}:`, z), C;
|
|
818
818
|
}
|
|
819
|
-
}, _ = async (g,
|
|
819
|
+
}, _ = async (g, y, C = null, R) => W(`${oe}-${g}`, y, C, R), E = () => {
|
|
820
820
|
try {
|
|
821
|
-
|
|
821
|
+
p.reset();
|
|
822
822
|
} catch (g) {
|
|
823
823
|
console.error("Error resetting feature flags:", g);
|
|
824
824
|
} finally {
|
|
@@ -837,10 +837,10 @@ function Ce(S = be) {
|
|
|
837
837
|
getFlag: L,
|
|
838
838
|
getUserFlagValue: W,
|
|
839
839
|
getBusinessFlagValue: _,
|
|
840
|
-
reset:
|
|
840
|
+
reset: E
|
|
841
841
|
};
|
|
842
842
|
}
|
|
843
|
-
var
|
|
843
|
+
var Jt = () => 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
|
+
]), le = /* @__PURE__ */ new Set([
|
|
859
859
|
// zus dev
|
|
860
860
|
"business_671005de24a7f4001c87e25e",
|
|
861
861
|
// zus prod
|
|
@@ -884,127 +884,123 @@ function ue() {
|
|
|
884
884
|
enableWastageTemplate: !1,
|
|
885
885
|
manualReceive: !1,
|
|
886
886
|
mustUsePoTemplate: !1,
|
|
887
|
-
enableReturnStocks: !1,
|
|
888
887
|
enableXilnexTransferNote: !1
|
|
889
888
|
};
|
|
890
889
|
}
|
|
891
|
-
const
|
|
890
|
+
const I = gt(ue()), Le = () => ({
|
|
892
891
|
get businessDbName() {
|
|
893
892
|
var v;
|
|
894
|
-
return `business_${((v =
|
|
893
|
+
return `business_${((v = ht().currentBusiness.value) == null ? void 0 : v._id) ?? ""}`;
|
|
895
894
|
},
|
|
896
895
|
get isWarehouse() {
|
|
897
|
-
var
|
|
898
|
-
return ((
|
|
896
|
+
var l;
|
|
897
|
+
return ((l = Dt()._currentLocation) == null ? void 0 : l.type) === re.enum.warehouse;
|
|
899
898
|
},
|
|
900
899
|
get restaurantPosVersion() {
|
|
901
900
|
var v;
|
|
902
|
-
const
|
|
903
|
-
return (v =
|
|
901
|
+
const p = Dt();
|
|
902
|
+
return (v = ht().restaurants.value.find(
|
|
904
903
|
(d) => {
|
|
905
904
|
var o;
|
|
906
|
-
return d._id === ((o =
|
|
905
|
+
return d._id === ((o = p._currentLocation) == null ? void 0 : o.doc._id);
|
|
907
906
|
}
|
|
908
907
|
)) == null ? void 0 : v.posVersion;
|
|
909
908
|
},
|
|
910
909
|
get enableTotalCost() {
|
|
911
|
-
return
|
|
910
|
+
return I.value.enableTotalCost;
|
|
912
911
|
},
|
|
913
912
|
get enableBackdatePo() {
|
|
914
|
-
return
|
|
913
|
+
return I.value.enableBackdatePo;
|
|
915
914
|
},
|
|
916
915
|
/** @deprecated TODO: remove */
|
|
917
916
|
get autoReceiveWarehouse() {
|
|
918
|
-
return
|
|
917
|
+
return I.value.autoReceiveWarehouse;
|
|
919
918
|
},
|
|
920
919
|
/** @deprecated TODO: remove */
|
|
921
920
|
get manualReceive() {
|
|
922
|
-
return
|
|
921
|
+
return I.value.manualReceive;
|
|
923
922
|
},
|
|
924
923
|
get enablePoTemplate() {
|
|
925
|
-
return
|
|
924
|
+
return I.value.enablePoTemplate;
|
|
926
925
|
},
|
|
927
926
|
get enableClosingTemplate() {
|
|
928
|
-
return
|
|
927
|
+
return I.value.enableClosingTemplate;
|
|
929
928
|
},
|
|
930
929
|
get enableWastageTemplate() {
|
|
931
|
-
return
|
|
930
|
+
return I.value.enableWastageTemplate;
|
|
932
931
|
},
|
|
933
932
|
get enableIngredientGroup() {
|
|
934
|
-
return
|
|
933
|
+
return I.value.enableIngredientGroup;
|
|
935
934
|
},
|
|
936
935
|
get mustUsePoTemplate() {
|
|
937
|
-
return
|
|
936
|
+
return I.value.mustUsePoTemplate;
|
|
938
937
|
},
|
|
939
938
|
get enableSupplierMasterList() {
|
|
940
|
-
return
|
|
939
|
+
return I.value.enableSupplierMasterList;
|
|
941
940
|
},
|
|
942
941
|
get businessSupplierOnly() {
|
|
943
|
-
return
|
|
944
|
-
},
|
|
945
|
-
get enableReturnStocks() {
|
|
946
|
-
return E.value.enableReturnStocks;
|
|
942
|
+
return I.value.businessSupplierOnly;
|
|
947
943
|
},
|
|
948
944
|
get enableXilnexTransferNote() {
|
|
949
|
-
return
|
|
945
|
+
return I.value.enableXilnexTransferNote;
|
|
950
946
|
},
|
|
951
947
|
async init() {
|
|
952
|
-
const
|
|
953
|
-
await
|
|
948
|
+
const p = ht(), { init: l, setUser: v } = Jt(), d = p.namespace.value === "prod";
|
|
949
|
+
await l({
|
|
954
950
|
apiKey: d ? "6GhcttsJ9Rj9cTevcdrpin" : "MaGoXrEWuEJNpWgKTqseee"
|
|
955
951
|
// url: 'https://flag.feedme.farm/api/v1/', // optional -> this is a default URL value
|
|
956
952
|
// enableAnalytics: true, // optional, defaults to true
|
|
957
953
|
// cacheFlags: true // optional, defaults to true
|
|
958
954
|
}), Dt().watchLocation(async (x) => {
|
|
959
|
-
var
|
|
955
|
+
var R, z, Y;
|
|
960
956
|
if (!x) {
|
|
961
|
-
|
|
957
|
+
I.value = ue();
|
|
962
958
|
return;
|
|
963
959
|
}
|
|
964
960
|
await v(x.doc._id);
|
|
965
|
-
const M = ye(), L =
|
|
961
|
+
const M = ye(), L = ht(), _ = `business_${((R = L.currentBusiness.value) == null ? void 0 : R._id) ?? ""}`, E = x.type === re.enum.warehouse, g = (
|
|
966
962
|
// if menu v4, must manual receive && must use outlet app
|
|
967
963
|
((z = L.currentBusiness.value) == null ? void 0 : z.menuVersion) === "v4" && // more guard for businesses using menu v4, only those listed for manual receive will be included
|
|
968
964
|
// TODO: may be removed to use menu version only
|
|
969
965
|
_e.has(this.businessDbName)
|
|
970
|
-
),
|
|
966
|
+
), y = le.has(_) || dt(
|
|
971
967
|
"inventory_portal_must_use_transfer_template"
|
|
972
968
|
/* inventory_portal_must_use_transfer_template */
|
|
973
969
|
), C = xe.has(this.businessDbName) && (this.isWarehouse || M.state.closing !== null);
|
|
974
|
-
|
|
970
|
+
I.value = {
|
|
975
971
|
enableTotalCost: ((Y = L.currentBusiness.value) == null ? void 0 : Y.menuVersion) === "v4",
|
|
976
972
|
enableBackdatePo: C,
|
|
977
|
-
autoReceiveWarehouse:
|
|
973
|
+
autoReceiveWarehouse: E && !g,
|
|
978
974
|
manualReceive: g,
|
|
979
|
-
enablePoTemplate:
|
|
980
|
-
enableClosingTemplate: Ee.has(_) &&
|
|
975
|
+
enablePoTemplate: y,
|
|
976
|
+
enableClosingTemplate: Ee.has(_) && dt(
|
|
981
977
|
"inventory_pos_closing_v2"
|
|
982
978
|
/* inventory_pos_closing_v2 */
|
|
983
979
|
),
|
|
984
|
-
enableWastageTemplate: Fe.has(_) &&
|
|
980
|
+
enableWastageTemplate: Fe.has(_) && dt(
|
|
985
981
|
"inventory_pos_adjust_v2_wastage"
|
|
986
982
|
/* inventory_pos_adjust_v2_wastage */
|
|
987
983
|
),
|
|
988
984
|
enableIngredientGroup: !1,
|
|
989
|
-
mustUsePoTemplate:
|
|
990
|
-
businessSupplierOnly:
|
|
991
|
-
enableSupplierMasterList:
|
|
992
|
-
|
|
993
|
-
"inventory_portal_stock_return"
|
|
994
|
-
/* inventory_portal_stock_return */
|
|
995
|
-
),
|
|
996
|
-
enableXilnexTransferNote: lt(
|
|
985
|
+
mustUsePoTemplate: y,
|
|
986
|
+
businessSupplierOnly: y,
|
|
987
|
+
enableSupplierMasterList: le.has(_),
|
|
988
|
+
enableXilnexTransferNote: dt(
|
|
997
989
|
"inventory_portal_xilnex_transfer_note"
|
|
998
990
|
/* inventory_portal_xilnex_transfer_note */
|
|
999
991
|
)
|
|
1000
992
|
};
|
|
1001
993
|
}, "feature");
|
|
994
|
+
},
|
|
995
|
+
async setUser(p) {
|
|
996
|
+
const { setUser: l } = Jt();
|
|
997
|
+
await l(p.doc._id);
|
|
1002
998
|
}
|
|
1003
999
|
});
|
|
1004
|
-
function
|
|
1005
|
-
|
|
1006
|
-
const { getFlagValue: v } =
|
|
1007
|
-
return v(
|
|
1000
|
+
function dt(p, l) {
|
|
1001
|
+
l = l === void 0 ? null : l;
|
|
1002
|
+
const { getFlagValue: v } = Jt();
|
|
1003
|
+
return v(p, (d) => d === "true") ?? l;
|
|
1008
1004
|
}
|
|
1009
1005
|
export {
|
|
1010
1006
|
Le as u
|