@feedmepos/mf-inventory-portal 1.4.2 → 1.4.4-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App-_rrlFpzI.js +309 -0
- package/dist/{ApprovalView-B6WmrP3R.js → ApprovalView-BA13wbQ-.js} +7 -7
- package/dist/{BindingsDialog-DAG2toHR.js → BindingsDialog-DMzMv881.js} +2 -2
- package/dist/{BindingsPicker-CPbNuwFq.js → BindingsPicker-BGxYZDn_.js} +2 -2
- package/dist/{BindingsTable-Hkkel0vq.js → BindingsTable-D7I6KyIQ.js} +3 -3
- package/dist/ClosingDraftView-osqh-QJ1.js +3649 -0
- package/dist/{ClosingHistoryView-D7GacAqj.js → ClosingHistoryView-DQoNfb5z.js} +5 -5
- package/dist/{ClosingTemplateView-DqpbjHK2.js → ClosingTemplateView-Ckq2Veyq.js} +14 -14
- package/dist/{DefaultView-BSm6fE5w.js → DefaultView-BYIk34PR.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-DFj56iJk.js → DeliveryOrderPrintPreview-BgHL-gvt.js} +2 -2
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CaVUl6v3.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-yqA2fgtH.js} +2 -2
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-FunJ5ZX5.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Bvma2A4K.js} +2 -2
- package/dist/{FmMultiselectDialog-DpekFj8a.js → FmMultiselectDialog-BmTCvmlw.js} +2 -2
- package/dist/{FmMultiselectDialog-BE2Tqm4H.js → FmMultiselectDialog-VPcV-FQV.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-Bt_kCIFn.js → FmUnitInput.vue_vue_type_script_setup_true_lang-7dkCTYcT.js} +4 -4
- package/dist/{ImportView-CAcUO9Pv.js → ImportView-gzF9CWtM.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-0Abq7FDN.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BJKxFdjv.js} +1 -1
- package/dist/{IngredientGroupView-CeUfykez.js → IngredientGroupView-DkoVLdIi.js} +5 -5
- package/dist/{IngredientsView-Cdhgw3Tw.js → IngredientsView-NBpaVLDo.js} +15 -15
- package/dist/{IntegrationExplorerView-BioiObpU.js → IntegrationExplorerView-D4P5Sxcm.js} +5 -5
- package/dist/{IntegrationView-BHjOvMpX.js → IntegrationView-B5YN8TEE.js} +13 -13
- package/dist/{InventoryBindingForm-D892WEqV.js → InventoryBindingForm-B7VMypYy.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BMfmKcz8.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DziCetjY.js} +5 -5
- package/dist/{InventoryBindingSummary-DOGWF0fo.js → InventoryBindingSummary-B9Vy49tr.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-B-dhMJ0F.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DXbiPSqB.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CKuIWTXZ.js → PremiumBadge.vue_vue_type_script_setup_true_lang-7ikbnzXX.js} +1 -1
- package/dist/{PublishView-Dh6OiaG1.js → PublishView-BwmWveBB.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-Cpme08gm.js → PurchaseOrderPrintPreview-kajF_P0m.js} +2 -2
- package/dist/{ReceiveRequestView-Dldwu3-H.js → ReceiveRequestView-DHYEENEf.js} +10550 -10507
- package/dist/{RecipeView-gkZuFdCP.js → RecipeView-BHwVXfLJ.js} +17 -17
- package/dist/{SettingsView-wOy_OATI.js → SettingsView-AdpIDPVs.js} +4 -4
- package/dist/{StockView-DeLcyQrC.js → StockView-C5AtoijI.js} +19 -19
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-C2Jax3tb.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-B3az_NVO.js} +1 -1
- package/dist/{SupplierView-Bf2AW8JH.js → SupplierView-D7Nr2RxT.js} +12 -12
- package/dist/{SurchargeView-CJtg87ol.js → SurchargeView-vJimp1Cv.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-Bfzqxalj.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-CinFL3QM.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CEz3Yc2Z.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-D2SvRBN6.js} +1 -1
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DlEjTd8E.js +4353 -0
- package/dist/{TransferTemplateView-DpWFExzQ.js → TransferTemplateView-C6RmjS-v.js} +18 -18
- package/dist/{UnitCostHistoryView-PEexDaAO.js → UnitCostHistoryView-aC4aPr3L.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-i8HZEphD.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-CuP7FMd1.js} +4 -4
- package/dist/{UnitView-BPyyMHKE.js → UnitView-BCGMlHCV.js} +7 -7
- package/dist/{WarehouseView-BmCech19.js → WarehouseView-O3gc_PiU.js} +5 -5
- package/dist/{WastageTemplateView-DJOBAWKd.js → WastageTemplateView-H9PA6ryl.js} +14 -14
- package/dist/api/purchase-order.d.ts +1 -0
- package/dist/api/sse.d.ts +3 -15
- package/dist/{app-D4P-koOR.js → app-CItiJtFw.js} +13 -11
- package/dist/app.js +1 -1
- package/dist/{closing-template-CCvXzoLm.js → closing-template-Cwj3O7Lm.js} +1 -1
- package/dist/composable/useSseClient.d.ts +5 -4
- package/dist/{date2-XHYHbI0K.js → date2-D00juOhc.js} +1 -1
- package/dist/{dayjs.min-pkE_kmHZ.js → dayjs.min-DmEufB_X.js} +1 -1
- package/dist/{decimal-CQ7SlCe0.js → decimal-Cfx4iNIN.js} +2 -2
- package/dist/{defineDeepModel-CZDkmNol.js → defineDeepModel-Dn4pcA76.js} +1 -1
- package/dist/{duplicate-template-BQ0bF_MO.js → duplicate-template-3GCMrDdJ.js} +1 -1
- package/dist/{export-CDIp6ydU.js → export-Taxbki8U.js} +2 -2
- package/dist/{feature-C4zPjstX.js → feature-CWFT4m6D.js} +426 -400
- package/dist/{format-time-from-id-D_USijTz.js → format-time-from-id-DBU5YJL6.js} +1 -1
- package/dist/{format-unit-display-CF6-yU7v.js → format-unit-display-Bcg7Sa60.js} +11 -11
- package/dist/{import-export.helper-iVXMr9yw.js → import-export.helper-DDM-pvFO.js} +6 -6
- package/dist/{index-BIG8c4oA.js → index-BMhosF1x.js} +3 -3
- package/dist/{index-EoaZ_eFV.js → index-DHnHIq4-.js} +1 -1
- package/dist/{index-CTNLpvtM.js → index-DK0BNrfa.js} +1 -1
- package/dist/{inventory-core-dart.default-D6cCA8tk.js → inventory-core-dart.default-B8aW6vKZ.js} +1 -1
- package/dist/{lodash-DR7t9CsC.js → lodash-raCw-gUe.js} +1 -1
- package/dist/{lz-string-DgqLqrsO.js → lz-string-eBAqN_g9.js} +1 -1
- package/dist/{netsuite-ByBZj6uf.js → netsuite-uRj2P-EH.js} +5 -6
- package/dist/{number-f4J4YlZT.js → number-C9o5tPfP.js} +3 -3
- package/dist/{predefined-templates-BlmLhRsh.js → predefined-templates-YPJMW8GJ.js} +1 -1
- package/dist/{purchase-order-template-BS94QDpg.js → purchase-order-template-B6aV2vdS.js} +1 -1
- package/dist/{recalculationUtils-D0wl-tgM.js → recalculationUtils-BiZ-pU6y.js} +1 -1
- package/dist/{rules-Cpi5Vduo.js → rules-01UCJome.js} +2 -2
- package/dist/{stock-BynB5KIH.js → stock-DTp9AhdZ.js} +1 -1
- package/dist/{stock-GYUDrBUF.js → stock-SuApOj2U.js} +3 -3
- package/dist/stores/feature.d.ts +15 -0
- package/dist/{supplier-BDpzWHvm.js → supplier-D60bDAuZ.js} +2 -2
- package/dist/{surcharge-ztZ3mUE2.js → surcharge-BWwSWZ1U.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-xx_W7OyU.js → use-ingredient-select-dialog-B4zci6JI.js} +2 -2
- package/dist/{use-inventory-binding-dialog-B_OV8CCL.js → use-inventory-binding-dialog-CgSz72ZS.js} +2 -2
- package/dist/{use-template-enabled-locations-ByOi4t2R.js → use-template-enabled-locations-DVLHfYM9.js} +2 -2
- package/dist/{use-transfer-locations-BOR-wq8s.js → use-transfer-locations-POSn3UDi.js} +2 -2
- package/dist/{useHrmPermission-BtXw89bp.js → useHrmPermission-B9ffPr7i.js} +1 -1
- package/dist/{useNavigationMenu-Ds6IBfYX.js → useNavigationMenu-dJYOEiud.js} +2 -2
- package/dist/views/receive-request/components/delivery-order-form/CreateFormProps.d.ts +2 -0
- package/dist/views/receive-request/components/delivery-order-form/EditFormProps.d.ts +1 -0
- package/dist/views/receive-request/helper/extra-items.d.ts +10 -0
- package/dist/views/receive-request/helper/extra-items.spec.d.ts +1 -0
- package/dist/{vue-i18n-C35dl24s.js → vue-i18n-CqFS0F9S.js} +477 -477
- package/dist/{xlsx-CzLrFB_A.js → xlsx-BY0_-lpm.js} +1 -1
- package/dist/{xlsx.util-osyDkxYO.js → xlsx.util-DR3_mTtm.js} +3 -3
- package/package.json +4 -4
- package/dist/App-D8p5pMar.js +0 -310
- package/dist/ClosingDraftView-JCtS2MZa.js +0 -3183
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CcpH12aM.js +0 -3874
- package/dist/useSseClient-q5d7Qjrq.js +0 -502
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
var
|
|
2
|
-
var ft = (l,
|
|
3
|
-
var ce = (l,
|
|
4
|
-
import { useCoreStore as
|
|
5
|
-
import { U as ve, u as
|
|
6
|
-
import { ref as
|
|
7
|
-
import "./inventory-core-dart.default-
|
|
8
|
-
var
|
|
9
|
-
(function(l,
|
|
10
|
-
(function(
|
|
11
|
-
f(
|
|
12
|
-
})(ve, function(
|
|
13
|
-
var f = { getItemSync: function(
|
|
1
|
+
var ht = Object.defineProperty;
|
|
2
|
+
var ft = (l, u, _) => u in l ? ht(l, u, { enumerable: !0, configurable: !0, writable: !0, value: _ }) : l[u] = _;
|
|
3
|
+
var ce = (l, u, _) => ft(l, typeof u != "symbol" ? u + "" : u, _);
|
|
4
|
+
import { useCoreStore as Ke } from "@feedmepos/mf-common";
|
|
5
|
+
import { U as ve, u as Ve, j as ot, a as gt } from "./app-CItiJtFw.js";
|
|
6
|
+
import { ref as de, readonly as Ge } from "vue";
|
|
7
|
+
import "./inventory-core-dart.default-B8aW6vKZ.js";
|
|
8
|
+
var Je = { exports: {} };
|
|
9
|
+
(function(l, u) {
|
|
10
|
+
(function(_, f) {
|
|
11
|
+
f(u);
|
|
12
|
+
})(ve, function(_) {
|
|
13
|
+
var f = { getItemSync: function(i) {
|
|
14
14
|
try {
|
|
15
|
-
return localStorage.getItem(
|
|
15
|
+
return localStorage.getItem(i) || null;
|
|
16
16
|
} catch {
|
|
17
17
|
return null;
|
|
18
18
|
}
|
|
19
|
-
}, getItem: function(
|
|
19
|
+
}, getItem: function(i, t) {
|
|
20
20
|
var e = this;
|
|
21
|
-
return new Promise(function(
|
|
21
|
+
return new Promise(function(r, n) {
|
|
22
22
|
try {
|
|
23
|
-
var a = e.getItemSync(
|
|
24
|
-
t == null || t(null, a),
|
|
23
|
+
var a = e.getItemSync(i);
|
|
24
|
+
t == null || t(null, a), r(a);
|
|
25
25
|
} catch (o) {
|
|
26
26
|
t && t(o, null), n(o);
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
|
-
}, setItem: function(
|
|
30
|
-
return new Promise(function(
|
|
29
|
+
}, setItem: function(i, t, e) {
|
|
30
|
+
return new Promise(function(r, n) {
|
|
31
31
|
try {
|
|
32
|
-
localStorage.setItem(
|
|
32
|
+
localStorage.setItem(i, t), e && e(null, t), r(t);
|
|
33
33
|
} catch (a) {
|
|
34
34
|
e && e(a, null), n(a);
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
} }, s = function() {
|
|
38
|
-
return s = Object.assign || function(
|
|
39
|
-
for (var t, e = 1,
|
|
40
|
-
return
|
|
38
|
+
return s = Object.assign || function(i) {
|
|
39
|
+
for (var t, e = 1, r = arguments.length; e < r; e++) for (var n in t = arguments[e]) Object.prototype.hasOwnProperty.call(t, n) && (i[n] = t[n]);
|
|
40
|
+
return i;
|
|
41
41
|
}, s.apply(this, arguments);
|
|
42
42
|
};
|
|
43
|
-
function
|
|
43
|
+
function O(i, t, e, r) {
|
|
44
44
|
return new (e || (e = Promise))(function(n, a) {
|
|
45
45
|
function o(p) {
|
|
46
46
|
try {
|
|
47
|
-
d(
|
|
48
|
-
} catch (
|
|
49
|
-
a(
|
|
47
|
+
d(r.next(p));
|
|
48
|
+
} catch (c) {
|
|
49
|
+
a(c);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
function v(p) {
|
|
53
53
|
try {
|
|
54
|
-
d(
|
|
55
|
-
} catch (
|
|
56
|
-
a(
|
|
54
|
+
d(r.throw(p));
|
|
55
|
+
} catch (c) {
|
|
56
|
+
a(c);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
function d(p) {
|
|
60
|
-
var
|
|
61
|
-
p.done ? n(p.value) : (
|
|
62
|
-
y(
|
|
60
|
+
var c;
|
|
61
|
+
p.done ? n(p.value) : (c = p.value, c instanceof e ? c : new e(function(y) {
|
|
62
|
+
y(c);
|
|
63
63
|
})).then(o, v);
|
|
64
64
|
}
|
|
65
|
-
d((
|
|
65
|
+
d((r = r.apply(i, [])).next());
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
function K(
|
|
69
|
-
var e,
|
|
68
|
+
function K(i, t) {
|
|
69
|
+
var e, r, n, a, o = { label: 0, sent: function() {
|
|
70
70
|
if (1 & n[0]) throw n[1];
|
|
71
71
|
return n[1];
|
|
72
72
|
}, trys: [], ops: [] };
|
|
@@ -75,169 +75,169 @@ var Ve = { exports: {} };
|
|
|
75
75
|
}), a;
|
|
76
76
|
function v(d) {
|
|
77
77
|
return function(p) {
|
|
78
|
-
return function(
|
|
78
|
+
return function(c) {
|
|
79
79
|
if (e) throw new TypeError("Generator is already executing.");
|
|
80
80
|
for (; o; ) try {
|
|
81
|
-
if (e = 1,
|
|
82
|
-
switch (
|
|
81
|
+
if (e = 1, r && (n = 2 & c[0] ? r.return : c[0] ? r.throw || ((n = r.return) && n.call(r), 0) : r.next) && !(n = n.call(r, c[1])).done) return n;
|
|
82
|
+
switch (r = 0, n && (c = [2 & c[0], n.value]), c[0]) {
|
|
83
83
|
case 0:
|
|
84
84
|
case 1:
|
|
85
|
-
n =
|
|
85
|
+
n = c;
|
|
86
86
|
break;
|
|
87
87
|
case 4:
|
|
88
|
-
return o.label++, { value:
|
|
88
|
+
return o.label++, { value: c[1], done: !1 };
|
|
89
89
|
case 5:
|
|
90
|
-
o.label++,
|
|
90
|
+
o.label++, r = c[1], c = [0];
|
|
91
91
|
continue;
|
|
92
92
|
case 7:
|
|
93
|
-
|
|
93
|
+
c = o.ops.pop(), o.trys.pop();
|
|
94
94
|
continue;
|
|
95
95
|
default:
|
|
96
|
-
if (n = o.trys, !((n = n.length > 0 && n[n.length - 1]) ||
|
|
96
|
+
if (n = o.trys, !((n = n.length > 0 && n[n.length - 1]) || c[0] !== 6 && c[0] !== 2)) {
|
|
97
97
|
o = 0;
|
|
98
98
|
continue;
|
|
99
99
|
}
|
|
100
|
-
if (
|
|
101
|
-
o.label =
|
|
100
|
+
if (c[0] === 3 && (!n || c[1] > n[0] && c[1] < n[3])) {
|
|
101
|
+
o.label = c[1];
|
|
102
102
|
break;
|
|
103
103
|
}
|
|
104
|
-
if (
|
|
105
|
-
o.label = n[1], n =
|
|
104
|
+
if (c[0] === 6 && o.label < n[1]) {
|
|
105
|
+
o.label = n[1], n = c;
|
|
106
106
|
break;
|
|
107
107
|
}
|
|
108
108
|
if (n && o.label < n[2]) {
|
|
109
|
-
o.label = n[2], o.ops.push(
|
|
109
|
+
o.label = n[2], o.ops.push(c);
|
|
110
110
|
break;
|
|
111
111
|
}
|
|
112
112
|
n[2] && o.ops.pop(), o.trys.pop();
|
|
113
113
|
continue;
|
|
114
114
|
}
|
|
115
|
-
|
|
115
|
+
c = t.call(i, o);
|
|
116
116
|
} catch (y) {
|
|
117
|
-
|
|
117
|
+
c = [6, y], r = 0;
|
|
118
118
|
} finally {
|
|
119
119
|
e = n = 0;
|
|
120
120
|
}
|
|
121
|
-
if (5 &
|
|
122
|
-
return { value:
|
|
121
|
+
if (5 & c[0]) throw c[1];
|
|
122
|
+
return { value: c[0] ? c[1] : void 0, done: !0 };
|
|
123
123
|
}([d, p]);
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
for (var
|
|
129
|
-
return
|
|
127
|
+
function I(i, t, e) {
|
|
128
|
+
for (var r, n = 0, a = t.length; n < a; n++) !r && n in t || (r || (r = Array.prototype.slice.call(t, 0, n)), r[n] = t[n]);
|
|
129
|
+
return i.concat(r || Array.prototype.slice.call(t));
|
|
130
130
|
}
|
|
131
|
-
var W = function
|
|
131
|
+
var W = function i(t, e) {
|
|
132
132
|
if (t === e) return !0;
|
|
133
133
|
if (t && e && typeof t == "object" && typeof e == "object") {
|
|
134
134
|
if (t.constructor !== e.constructor) return !1;
|
|
135
|
-
var
|
|
135
|
+
var r, n, a;
|
|
136
136
|
if (Array.isArray(t)) {
|
|
137
|
-
if ((
|
|
138
|
-
for (n =
|
|
137
|
+
if ((r = t.length) != e.length) return !1;
|
|
138
|
+
for (n = r; n-- != 0; ) if (!i(t[n], e[n])) return !1;
|
|
139
139
|
return !0;
|
|
140
140
|
}
|
|
141
141
|
if (t.constructor === RegExp) return t.source === e.source && t.flags === e.flags;
|
|
142
142
|
if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === e.valueOf();
|
|
143
143
|
if (t.toString !== Object.prototype.toString) return t.toString() === e.toString();
|
|
144
|
-
if ((
|
|
145
|
-
for (n =
|
|
146
|
-
for (n =
|
|
144
|
+
if ((r = (a = Object.keys(t)).length) !== Object.keys(e).length) return !1;
|
|
145
|
+
for (n = r; n-- != 0; ) if (!Object.prototype.hasOwnProperty.call(e, a[n])) return !1;
|
|
146
|
+
for (n = r; n-- != 0; ) {
|
|
147
147
|
var o = a[n];
|
|
148
|
-
if (!
|
|
148
|
+
if (!i(t[o], e[o])) return !1;
|
|
149
149
|
}
|
|
150
150
|
return !0;
|
|
151
151
|
}
|
|
152
152
|
return t != t && e != e;
|
|
153
153
|
};
|
|
154
|
-
function w(
|
|
155
|
-
var e = Object.keys(t || {}).filter(function(
|
|
156
|
-
var n =
|
|
154
|
+
function w(i, t) {
|
|
155
|
+
var e = Object.keys(t || {}).filter(function(r) {
|
|
156
|
+
var n = i == null ? void 0 : i[r], a = t == null ? void 0 : t[r];
|
|
157
157
|
return !W(n, a);
|
|
158
158
|
});
|
|
159
|
-
return Object.keys(
|
|
160
|
-
Object.keys(t || {}).includes(
|
|
159
|
+
return Object.keys(i || {}).filter(function(r) {
|
|
160
|
+
Object.keys(t || {}).includes(r) || e.push(r);
|
|
161
161
|
}), Object.keys(e).length ? e : null;
|
|
162
162
|
}
|
|
163
163
|
var g, C;
|
|
164
|
-
function E(
|
|
165
|
-
var
|
|
166
|
-
typeof e == "number" && (
|
|
164
|
+
function E(i, t, e) {
|
|
165
|
+
var r = "shortString", n = !0;
|
|
166
|
+
typeof e == "number" && (r = "javaDouble", n = !1), i[r] = i[r] || {}, i[r][t] = n ? e + "" : e;
|
|
167
167
|
}
|
|
168
|
-
function A(
|
|
169
|
-
return !!
|
|
168
|
+
function A(i) {
|
|
169
|
+
return !!i && typeof i == "object" && i.value !== void 0;
|
|
170
170
|
}
|
|
171
|
-
function $(
|
|
172
|
-
return Object.fromEntries(Object.entries(
|
|
173
|
-
var e = t[0],
|
|
174
|
-
return [e, A(
|
|
171
|
+
function $(i) {
|
|
172
|
+
return Object.fromEntries(Object.entries(i).map(function(t) {
|
|
173
|
+
var e = t[0], r = t[1];
|
|
174
|
+
return [e, A(r) ? r : { value: r }];
|
|
175
175
|
}));
|
|
176
176
|
}
|
|
177
|
-
function Y(
|
|
178
|
-
return s(s({},
|
|
177
|
+
function Y(i) {
|
|
178
|
+
return s(s({}, i), { identity: i.identity ? s(s({}, i.identity), { traits: $(i.identity.traits || {}) }) : void 0 });
|
|
179
179
|
}
|
|
180
|
-
(function(
|
|
181
|
-
|
|
180
|
+
(function(i) {
|
|
181
|
+
i.NONE = "NONE", i.DEFAULT_FLAGS = "DEFAULT_FLAGS", i.CACHE = "CACHE", i.SERVER = "SERVER";
|
|
182
182
|
})(g || (g = {}));
|
|
183
|
-
var
|
|
184
|
-
function
|
|
183
|
+
var fe, F = null, ut = "FLAGSMITH_EVENT", le = ut, qe = "https://edge.api.flagsmith.com/api/v1/", Be = "flagsmith_value_", Me = "flagsmith_enabled_", ze = "flagsmith_trait_", ct = function() {
|
|
184
|
+
function i(t) {
|
|
185
185
|
var e = this;
|
|
186
186
|
this._trigger = null, this._triggerLoadingState = null, this.timestamp = null, this.isLoading = !1, this.eventSource = null, this.getFlags = function() {
|
|
187
|
-
var
|
|
187
|
+
var r = e, n = r.api, a = r.evaluationContext;
|
|
188
188
|
e.log("Get Flags"), e.isLoading = !0, e.loadingState.isFetching || e.setLoadingState(s(s({}, e.loadingState), { isFetching: !0 }));
|
|
189
189
|
var o = "".concat(e.getContext().identity), v = function(d) {
|
|
190
|
-
var p,
|
|
190
|
+
var p, c, y, k;
|
|
191
191
|
if (d && o === "".concat(e.getContext().identity)) {
|
|
192
|
-
var
|
|
192
|
+
var V = d.flags, P = d.traits, U = d.identifier;
|
|
193
193
|
e.isLoading = !1;
|
|
194
|
-
var
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}),
|
|
198
|
-
|
|
194
|
+
var j = {}, N = {};
|
|
195
|
+
P = P || [], (V = V || []).forEach(function(m) {
|
|
196
|
+
j[m.feature.name.toLowerCase().replace(/ /g, "_")] = { id: m.feature.id, enabled: m.enabled, value: m.feature_state_value };
|
|
197
|
+
}), P.forEach(function(m) {
|
|
198
|
+
N[m.trait_key.toLowerCase().replace(/ /g, "_")] = { transient: m.transient, value: m.trait_value };
|
|
199
199
|
}), e.oldFlags = s({}, e.flags);
|
|
200
|
-
var
|
|
201
|
-
if ((U || Object.keys(
|
|
200
|
+
var G = w(e.oldFlags, j), re = w((p = e.evaluationContext.identity) === null || p === void 0 ? void 0 : p.traits, N);
|
|
201
|
+
if ((U || Object.keys(N).length) && (e.evaluationContext.identity = s(s({}, e.evaluationContext.identity), { traits: N }), U && (e.evaluationContext.identity.identifier = U)), e.flags = j, e.updateStorage(), e._onChange(e.oldFlags, { isFromServer: !0, flagsChanged: G, traitsChanged: re }, e._loadedState(null, g.SERVER)), e.datadogRum) try {
|
|
202
202
|
if (e.datadogRum.trackTraits) {
|
|
203
|
-
var
|
|
204
|
-
Object.keys(((
|
|
205
|
-
|
|
203
|
+
var ie = {};
|
|
204
|
+
Object.keys(((c = e.evaluationContext.identity) === null || c === void 0 ? void 0 : c.traits) || {}).map(function(m) {
|
|
205
|
+
ie[ze + m] = e.getTrait(m);
|
|
206
206
|
});
|
|
207
|
-
var Z = s(s(s({}, e.datadogRum.client.getUser()), { id: e.datadogRum.client.getUser().id || ((y = e.evaluationContext.identity) === null || y === void 0 ? void 0 : y.identifier) }),
|
|
207
|
+
var Z = s(s(s({}, e.datadogRum.client.getUser()), { id: e.datadogRum.client.getUser().id || ((y = e.evaluationContext.identity) === null || y === void 0 ? void 0 : y.identifier) }), ie);
|
|
208
208
|
e.log("Setting Datadog user", Z), e.datadogRum.client.setUser(Z);
|
|
209
209
|
}
|
|
210
210
|
} catch (m) {
|
|
211
211
|
console.error(m);
|
|
212
212
|
}
|
|
213
213
|
if (e.dtrum) try {
|
|
214
|
-
var
|
|
214
|
+
var T = { javaDouble: {}, date: {}, shortString: {}, javaLongOrObject: {} };
|
|
215
215
|
Object.keys(e.flags).map(function(m) {
|
|
216
|
-
E(
|
|
217
|
-
}), Object.keys(((
|
|
218
|
-
E(
|
|
219
|
-
}), e.log("Sending javaLongOrObject traits to dynatrace",
|
|
216
|
+
E(T, Be + m, e.getValue(m, { skipAnalytics: !0 })), E(T, Me + m, e.hasFeature(m, { skipAnalytics: !0 }));
|
|
217
|
+
}), Object.keys(((k = e.evaluationContext.identity) === null || k === void 0 ? void 0 : k.traits) || {}).map(function(m) {
|
|
218
|
+
E(T, ze + m, e.getTrait(m));
|
|
219
|
+
}), e.log("Sending javaLongOrObject traits to dynatrace", T.javaLongOrObject), e.log("Sending date traits to dynatrace", T.date), e.log("Sending shortString traits to dynatrace", T.shortString), e.log("Sending javaDouble to dynatrace", T.javaDouble), e.dtrum.sendSessionProperties(T.javaLongOrObject, T.date, T.shortString, T.javaDouble);
|
|
220
220
|
} catch (m) {
|
|
221
221
|
console.error(m);
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
};
|
|
225
225
|
return a.identity ? Promise.all([a.identity.traits && Object.keys(a.identity.traits).length || !a.identity.identifier ? e.getJSON(n + "identities/", "POST", JSON.stringify({ identifier: a.identity.identifier, transient: a.identity.transient, traits: Object.entries(a.identity.traits).map(function(d) {
|
|
226
|
-
var p = d[0],
|
|
227
|
-
return { trait_key: p, trait_value:
|
|
226
|
+
var p = d[0], c = d[1];
|
|
227
|
+
return { trait_key: p, trait_value: c == null ? void 0 : c.value, transient: c == null ? void 0 : c.transient };
|
|
228
228
|
}).filter(function(d) {
|
|
229
229
|
return d.trait_value !== void 0 || (e.log("Warning - attempted to set an undefined trait value for key", d.trait_key), !1);
|
|
230
230
|
}) })) : e.getJSON(n + "identities/?identifier=" + encodeURIComponent(a.identity.identifier) + (a.identity.transient ? "&transient=true" : ""))]).then(function(d) {
|
|
231
231
|
return e.evaluationContext.identity = s(s({}, e.evaluationContext.identity), { traits: {} }), v(d == null ? void 0 : d[0]);
|
|
232
232
|
}).catch(function(d) {
|
|
233
|
-
var p = d.message,
|
|
234
|
-
return Promise.reject(
|
|
233
|
+
var p = d.message, c = new Error(p);
|
|
234
|
+
return Promise.reject(c);
|
|
235
235
|
}) : e.getJSON(n + "flags/").then(function(d) {
|
|
236
236
|
return v({ flags: d, traits: void 0 });
|
|
237
237
|
});
|
|
238
238
|
}, this.analyticsFlags = function() {
|
|
239
|
-
var
|
|
240
|
-
if (e.evaluationEvent && e.evaluationContext.environment && e.evaluationEvent[e.evaluationContext.environment.apiKey]) return e.evaluationEvent && Object.getOwnPropertyNames(e.evaluationEvent).length !== 0 && Object.getOwnPropertyNames(e.evaluationEvent[e.evaluationContext.environment.apiKey]).length !== 0 ? e.getJSON(
|
|
239
|
+
var r = e.api;
|
|
240
|
+
if (e.evaluationEvent && e.evaluationContext.environment && e.evaluationEvent[e.evaluationContext.environment.apiKey]) return e.evaluationEvent && Object.getOwnPropertyNames(e.evaluationEvent).length !== 0 && Object.getOwnPropertyNames(e.evaluationEvent[e.evaluationContext.environment.apiKey]).length !== 0 ? e.getJSON(r + "analytics/flags/", "POST", JSON.stringify(e.evaluationEvent[e.evaluationContext.environment.apiKey])).then(function(n) {
|
|
241
241
|
if (e.evaluationContext.environment) {
|
|
242
242
|
var a = e.getState();
|
|
243
243
|
e.evaluationEvent || (e.evaluationEvent = {}), e.evaluationEvent[e.evaluationContext.environment.apiKey] = {}, e.setState(s(s({}, a), { evaluationEvent: e.evaluationEvent })), e.updateEventStorage();
|
|
@@ -245,114 +245,114 @@ var Ve = { exports: {} };
|
|
|
245
245
|
}).catch(function(n) {
|
|
246
246
|
e.log("Exception fetching evaluationEvent", n);
|
|
247
247
|
}) : void 0;
|
|
248
|
-
}, this.datadogRum = null, this.loadingState = { isLoading: !0, isFetching: !0, error: null, source: g.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(
|
|
249
|
-
var o = e.flags && e.flags[
|
|
250
|
-
if (o && (v = o.value), n != null && n.skipAnalytics || a || e.evaluateFlag(
|
|
248
|
+
}, this.datadogRum = null, this.loadingState = { isLoading: !0, isFetching: !0, error: null, source: g.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(r, n, a) {
|
|
249
|
+
var o = e.flags && e.flags[r.toLowerCase().replace(/ /g, "_")], v = null;
|
|
250
|
+
if (o && (v = o.value), n != null && n.skipAnalytics || a || e.evaluateFlag(r, "VALUE"), v === null && (n == null ? void 0 : n.fallback) !== void 0) return n.fallback;
|
|
251
251
|
if (n != null && n.json) try {
|
|
252
|
-
return v === null ? (e.log("Tried to parse null flag as JSON: " +
|
|
252
|
+
return v === null ? (e.log("Tried to parse null flag as JSON: " + r), null) : JSON.parse(v);
|
|
253
253
|
} catch {
|
|
254
254
|
return n.fallback;
|
|
255
255
|
}
|
|
256
256
|
return v;
|
|
257
|
-
}, this.getTrait = function(
|
|
257
|
+
}, this.getTrait = function(r) {
|
|
258
258
|
var n, a;
|
|
259
|
-
return ((n = e.evaluationContext.identity) === null || n === void 0 ? void 0 : n.traits) && ((a = e.evaluationContext.identity.traits[
|
|
259
|
+
return ((n = e.evaluationContext.identity) === null || n === void 0 ? void 0 : n.traits) && ((a = e.evaluationContext.identity.traits[r.toLowerCase().replace(/ /g, "_")]) === null || a === void 0 ? void 0 : a.value);
|
|
260
260
|
}, this.getAllTraits = function() {
|
|
261
|
-
var
|
|
262
|
-
return Object.fromEntries(Object.entries(((
|
|
261
|
+
var r;
|
|
262
|
+
return Object.fromEntries(Object.entries(((r = e.evaluationContext.identity) === null || r === void 0 ? void 0 : r.traits) || {}).map(function(n) {
|
|
263
263
|
var a = n[0], o = n[1];
|
|
264
264
|
return [a, o == null ? void 0 : o.value];
|
|
265
265
|
}));
|
|
266
|
-
}, this.setContext = function(
|
|
267
|
-
var n = Y(
|
|
266
|
+
}, this.setContext = function(r) {
|
|
267
|
+
var n = Y(r);
|
|
268
268
|
return e.evaluationContext = s(s({}, n), { environment: n.environment || e.evaluationContext.environment }), e.initialised ? e.getFlags() : Promise.resolve();
|
|
269
269
|
}, this.getContext = function() {
|
|
270
270
|
return e.evaluationContext;
|
|
271
|
-
}, this.updateContext = function(
|
|
272
|
-
return e.setContext(s(s({}, e.getContext()),
|
|
273
|
-
}, this.setTrait = function(
|
|
271
|
+
}, this.updateContext = function(r) {
|
|
272
|
+
return e.setContext(s(s({}, e.getContext()), r));
|
|
273
|
+
}, this.setTrait = function(r, n) {
|
|
274
274
|
var a;
|
|
275
|
-
if (e.api) return e.setContext(s(s({}, e.evaluationContext), { identity: s(s({}, e.evaluationContext.identity), { traits: s(s({}, (a = e.evaluationContext.identity) === null || a === void 0 ? void 0 : a.traits), $(Object.fromEntries([[
|
|
276
|
-
}, this.setTraits = function(
|
|
275
|
+
if (e.api) return e.setContext(s(s({}, e.evaluationContext), { identity: s(s({}, e.evaluationContext.identity), { traits: s(s({}, (a = e.evaluationContext.identity) === null || a === void 0 ? void 0 : a.traits), $(Object.fromEntries([[r, n]]))) }) }));
|
|
276
|
+
}, this.setTraits = function(r) {
|
|
277
277
|
var n;
|
|
278
|
-
if (e.api) return e.setContext(s(s({}, e.evaluationContext), { identity: s(s({}, e.evaluationContext.identity), { traits: s(s({}, (n = e.evaluationContext.identity) === null || n === void 0 ? void 0 : n.traits), Object.fromEntries(Object.entries(
|
|
278
|
+
if (e.api) return e.setContext(s(s({}, e.evaluationContext), { identity: s(s({}, e.evaluationContext.identity), { traits: s(s({}, (n = e.evaluationContext.identity) === null || n === void 0 ? void 0 : n.traits), Object.fromEntries(Object.entries(r).map(function(a) {
|
|
279
279
|
var o = a[0], v = a[1];
|
|
280
280
|
return [o, A(v) ? v : { value: v }];
|
|
281
281
|
}))) }) }));
|
|
282
282
|
console.error("Attempted to setTraits a user before calling flagsmith.init. Call flagsmith.init first, if you wish to prevent it sending a request for flags, call init with preventFetch:true.");
|
|
283
|
-
}, this.hasFeature = function(
|
|
284
|
-
var a = typeof n == "object", o = e.flags && e.flags[
|
|
285
|
-
return !o && a && n.fallback !== void 0 ? v = n == null ? void 0 : n.fallback : o && o.enabled && (v = !0), (a && !n.skipAnalytics || !n) && e.evaluateFlag(
|
|
283
|
+
}, this.hasFeature = function(r, n) {
|
|
284
|
+
var a = typeof n == "object", o = e.flags && e.flags[r.toLowerCase().replace(/ /g, "_")], v = !1;
|
|
285
|
+
return !o && a && n.fallback !== void 0 ? v = n == null ? void 0 : n.fallback : o && o.enabled && (v = !0), (a && !n.skipAnalytics || !n) && e.evaluateFlag(r, "ENABLED"), v;
|
|
286
286
|
}, this.getStorageKey = function() {
|
|
287
|
-
var
|
|
288
|
-
return ((
|
|
289
|
-
}, this.getJSON = function(
|
|
287
|
+
var r, n;
|
|
288
|
+
return ((r = e.cacheOptions) === null || r === void 0 ? void 0 : r.storageKey) || "FLAGSMITH_DB_" + ((n = e.evaluationContext.environment) === null || n === void 0 ? void 0 : n.apiKey);
|
|
289
|
+
}, this.getJSON = function(r, n, a) {
|
|
290
290
|
var o, v = e;
|
|
291
291
|
v.evaluationContext;
|
|
292
292
|
var d = v.headers, p = { method: n || "GET", body: a, cache: "no-cache", headers: {} };
|
|
293
293
|
e.evaluationContext.environment && (p.headers["X-Environment-Key"] = e.evaluationContext.environment.apiKey), n && n !== "GET" && (p.headers["Content-Type"] = "application/json; charset=utf-8"), d && Object.assign(p.headers, d), C || console.error("Flagsmith: fetch is undefined, please specify a fetch implementation into flagsmith.init to support SSR.");
|
|
294
|
-
var
|
|
295
|
-
return C(
|
|
296
|
-
var
|
|
297
|
-
if (
|
|
298
|
-
var U = (
|
|
294
|
+
var c = "".concat((o = e.evaluationContext.identity) === null || o === void 0 ? void 0 : o.identifier);
|
|
295
|
+
return C(r, p).then(function(y) {
|
|
296
|
+
var k, V, P = "".concat((k = e.evaluationContext.identity) === null || k === void 0 ? void 0 : k.identifier);
|
|
297
|
+
if (c === P) {
|
|
298
|
+
var U = (V = y.headers) === null || V === void 0 ? void 0 : V.get("x-flagsmith-document-updated-at");
|
|
299
299
|
if (U) try {
|
|
300
|
-
var
|
|
301
|
-
if (isNaN(
|
|
302
|
-
e.timestamp =
|
|
303
|
-
} catch (
|
|
304
|
-
e.log(
|
|
300
|
+
var j = parseFloat(U);
|
|
301
|
+
if (isNaN(j)) return Promise.reject("Failed to parse x-flagsmith-document-updated-at");
|
|
302
|
+
e.timestamp = j;
|
|
303
|
+
} catch (N) {
|
|
304
|
+
e.log(N, "Failed to parse x-flagsmith-document-updated-at", U);
|
|
305
305
|
}
|
|
306
|
-
return e.log("Fetch response: " + y.status + " " + (n || "GET") + 0 +
|
|
307
|
-
var
|
|
306
|
+
return e.log("Fetch response: " + y.status + " " + (n || "GET") + 0 + r), y.text().then(function(N) {
|
|
307
|
+
var G = N;
|
|
308
308
|
try {
|
|
309
|
-
|
|
309
|
+
G = JSON.parse(N);
|
|
310
310
|
} catch {
|
|
311
311
|
}
|
|
312
|
-
return !
|
|
312
|
+
return !G && y.status && (G = "API Response: ".concat(y.status)), y.status && y.status >= 200 && y.status < 300 ? G : Promise.reject(new Error(G));
|
|
313
313
|
});
|
|
314
314
|
}
|
|
315
|
-
e.log("Received response with identity mismatch, ignoring response. Requested: ".concat(
|
|
315
|
+
e.log("Received response with identity mismatch, ignoring response. Requested: ".concat(c, ", Current: ").concat(P));
|
|
316
316
|
});
|
|
317
|
-
}, this.evaluateFlag = function(
|
|
318
|
-
if (e.datadogRum && (e.datadogRum.client.addFeatureFlagEvaluation ? n === "VALUE" ? e.datadogRum.client.addFeatureFlagEvaluation(
|
|
317
|
+
}, this.evaluateFlag = function(r, n) {
|
|
318
|
+
if (e.datadogRum && (e.datadogRum.client.addFeatureFlagEvaluation ? n === "VALUE" ? e.datadogRum.client.addFeatureFlagEvaluation(Be + r, e.getValue(r, {}, !0)) : e.datadogRum.client.addFeatureFlagEvaluation(Me + r, e.hasFeature(r, !0)) : console.error("Flagsmith: Your datadog RUM client does not support the function addFeatureFlagEvaluation, please update it.")), e.enableAnalytics) {
|
|
319
319
|
if (!e.evaluationEvent || !e.evaluationContext.environment) return;
|
|
320
|
-
e.evaluationEvent[e.evaluationContext.environment.apiKey] || (e.evaluationEvent[e.evaluationContext.environment.apiKey] = {}), e.evaluationEvent[e.evaluationContext.environment.apiKey][
|
|
320
|
+
e.evaluationEvent[e.evaluationContext.environment.apiKey] || (e.evaluationEvent[e.evaluationContext.environment.apiKey] = {}), e.evaluationEvent[e.evaluationContext.environment.apiKey][r] === void 0 && (e.evaluationEvent[e.evaluationContext.environment.apiKey][r] = 0), e.evaluationEvent[e.evaluationContext.environment.apiKey][r] += 1;
|
|
321
321
|
}
|
|
322
322
|
e.updateEventStorage();
|
|
323
|
-
}, this._onChange = function(
|
|
323
|
+
}, this._onChange = function(r, n, a) {
|
|
324
324
|
var o, v;
|
|
325
|
-
e.setLoadingState(a), (o = e.onChange) === null || o === void 0 || o.call(e,
|
|
326
|
-
}, C = t.fetch ? t.fetch : typeof fetch < "u" ? fetch : ve === null || ve === void 0 ? void 0 : ve.fetch, this.canUseStorage = typeof window < "u" || !!t.browserlessStorage, this.log("Constructing flagsmith instance " + t), t.eventSource && (
|
|
325
|
+
e.setLoadingState(a), (o = e.onChange) === null || o === void 0 || o.call(e, r, n, e.loadingState), (v = e._trigger) === null || v === void 0 || v.call(e);
|
|
326
|
+
}, C = t.fetch ? t.fetch : typeof fetch < "u" ? fetch : ve === null || ve === void 0 ? void 0 : ve.fetch, this.canUseStorage = typeof window < "u" || !!t.browserlessStorage, this.log("Constructing flagsmith instance " + t), t.eventSource && (fe = t.eventSource), t.AsyncStorage && (F = t.AsyncStorage);
|
|
327
327
|
}
|
|
328
|
-
return
|
|
329
|
-
var e,
|
|
330
|
-
return
|
|
331
|
-
var a, o, v, d, p,
|
|
328
|
+
return i.prototype.init = function(t) {
|
|
329
|
+
var e, r, n;
|
|
330
|
+
return O(this, void 0, void 0, function() {
|
|
331
|
+
var a, o, v, d, p, c, y, k, V, P, U, j, N, G, re, ie, Z, T, m, pe, ae, Qe, Q, ye, et, tt, me, nt, be, oe, ee, rt, L = this;
|
|
332
332
|
return K(this, function(D) {
|
|
333
333
|
switch (D.label) {
|
|
334
334
|
case 0:
|
|
335
335
|
a = Y(t.evaluationContext || this.evaluationContext), D.label = 1;
|
|
336
336
|
case 1:
|
|
337
|
-
if (D.trys.push([1, 13, , 14]), o = t.environmentID, v = t.api, d = v === void 0 ?
|
|
338
|
-
if (a.identity =
|
|
339
|
-
return [
|
|
340
|
-
})) : {} } : a.identity, this.evaluationContext = a, this.api = d, this.headers = p, this.getFlagInterval = null, this.analyticsInterval = null, this.onChange =
|
|
341
|
-
|
|
342
|
-
}, this.enableLogs =
|
|
337
|
+
if (D.trys.push([1, 13, , 14]), o = t.environmentID, v = t.api, d = v === void 0 ? qe : v, p = t.headers, c = t.onChange, y = t.cacheFlags, k = t.datadogRum, V = t.onError, P = t.defaultFlags, U = t.fetch, j = t.preventFetch, N = t.enableLogs, G = t.enableDynatrace, re = t.enableAnalytics, ie = t.realtime, Z = t.eventSourceUrl, T = Z === void 0 ? "https://realtime.flagsmith.com/" : Z, m = t.AsyncStorage, pe = t.identity, ae = t.traits, Qe = t.state, Q = t.cacheOptions, ye = t.angularHttpClient, et = t._trigger, tt = t._triggerLoadingState, a.environment = o ? { apiKey: o } : a.environment, !a.environment || !a.environment.apiKey) throw new Error("Please provide `evaluationContext.environment` with non-empty `apiKey`");
|
|
338
|
+
if (a.identity = pe || ae ? { identifier: pe, traits: ae ? Object.fromEntries(Object.entries(ae).map(function(R) {
|
|
339
|
+
return [R[0], { value: R[1] }];
|
|
340
|
+
})) : {} } : a.identity, this.evaluationContext = a, this.api = d, this.headers = p, this.getFlagInterval = null, this.analyticsInterval = null, this.onChange = c, me = "Wrong Flagsmith Configuration: preventFetch is true and no defaulFlags provided", this._trigger = et || this._trigger, this._triggerLoadingState = tt || this._triggerLoadingState, this.onError = function(R) {
|
|
341
|
+
L.setLoadingState(s(s({}, L.loadingState), { isFetching: !1, isLoading: !1, error: R })), V == null || V(R);
|
|
342
|
+
}, 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."), U && (C = U), this.enableAnalytics = re || !1, this.flags = Object.assign({}, P) || {}, this.datadogRum = k || null, this.initialised = !0, this.ticks = 1e4, this.timer = this.enableLogs ? (/* @__PURE__ */ new Date()).valueOf() : null, this.cacheFlags = F !== void 0 && !!y, le = "FLAGSMITH_EVENT_" + a.environment.apiKey, m && (F = m), ie && typeof window < "u" && this.setupRealtime(T, a.environment.apiKey), Object.keys(this.flags).length && (this.loadingState = s(s({}, this.loadingState), { isLoading: !1, source: g.DEFAULT_FLAGS })), this.setState(Qe), this.log("Initialising with properties", t, this), G && (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), ye && (C = /* @__PURE__ */ function(R) {
|
|
343
343
|
return function(J, q) {
|
|
344
344
|
var z = q.headers, x = q.method, te = q.body;
|
|
345
345
|
return new Promise(function(X) {
|
|
346
346
|
switch (x) {
|
|
347
347
|
case "GET":
|
|
348
|
-
return
|
|
348
|
+
return R.get(J, { headers: z }).subscribe(function(M) {
|
|
349
349
|
X({ ok: !0, text: function() {
|
|
350
350
|
return Promise.resolve(M);
|
|
351
351
|
} });
|
|
352
352
|
});
|
|
353
353
|
case "POST":
|
|
354
354
|
case "PUT":
|
|
355
|
-
return
|
|
355
|
+
return R.post(J, te, { headers: z }).subscribe(function(M) {
|
|
356
356
|
X({ ok: !0, text: function() {
|
|
357
357
|
return Promise.resolve(M);
|
|
358
358
|
} });
|
|
@@ -360,38 +360,38 @@ var Ve = { exports: {} };
|
|
|
360
360
|
}
|
|
361
361
|
});
|
|
362
362
|
};
|
|
363
|
-
}(
|
|
363
|
+
}(ye)), F && this.canUseStorage && F.getItem(le).then(function(R) {
|
|
364
364
|
try {
|
|
365
|
-
|
|
365
|
+
L.evaluationEvent = JSON.parse(R) || {};
|
|
366
366
|
} catch {
|
|
367
|
-
|
|
367
|
+
L.evaluationEvent = {};
|
|
368
368
|
}
|
|
369
|
-
|
|
370
|
-
}), this.enableAnalytics && (this.analyticsInterval && clearInterval(this.analyticsInterval),
|
|
371
|
-
if (J &&
|
|
369
|
+
L.analyticsInterval = setInterval(L.analyticsFlags, L.ticks);
|
|
370
|
+
}), this.enableAnalytics && (this.analyticsInterval && clearInterval(this.analyticsInterval), F && this.canUseStorage && F.getItem(le, function(R, J) {
|
|
371
|
+
if (J && L.evaluationContext.environment) {
|
|
372
372
|
var q = JSON.parse(J);
|
|
373
|
-
if (q[
|
|
374
|
-
var z =
|
|
375
|
-
|
|
373
|
+
if (q[L.evaluationContext.environment.apiKey]) {
|
|
374
|
+
var z = L.getState();
|
|
375
|
+
L.log("Retrieved events from cache", J), L.setState(s(s({}, z), { evaluationEvent: q[L.evaluationContext.environment.apiKey] }));
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
})), !y) return [3, 9];
|
|
379
|
-
if (!
|
|
380
|
-
|
|
381
|
-
return
|
|
382
|
-
var q, z, x, te, X, M,
|
|
379
|
+
if (!F || !this.canUseStorage) return [3, 8];
|
|
380
|
+
nt = function(R, J) {
|
|
381
|
+
return O(L, void 0, void 0, function() {
|
|
382
|
+
var q, z, x, te, X, M, Se, it, Ce, xe, Ee, we, Oe, ke, Te, Le, Fe, Ie, Ae, Pe, je, Ne, Re, Ue, at = this;
|
|
383
383
|
return K(this, function(H) {
|
|
384
384
|
switch (H.label) {
|
|
385
385
|
case 0:
|
|
386
386
|
if (!J) return [3, 7];
|
|
387
387
|
q = null, z = null, H.label = 1;
|
|
388
388
|
case 1:
|
|
389
|
-
return H.trys.push([1, 5, , 6]), x = JSON.parse(J), te = !1, X = !1, x && x.api === this.api && ((
|
|
390
|
-
var
|
|
391
|
-
(
|
|
389
|
+
return H.trys.push([1, 5, , 6]), x = JSON.parse(J), te = !1, X = !1, x && x.api === this.api && ((xe = (Ce = x.evaluationContext) === null || Ce === void 0 ? void 0 : Ce.environment) === null || xe === void 0 ? void 0 : xe.apiKey) === ((Ee = this.evaluationContext.environment) === null || Ee === void 0 ? void 0 : Ee.apiKey) && (M = !0, this.evaluationContext.identity && ((Oe = (we = x.evaluationContext) === null || we === void 0 ? void 0 : we.identity) === null || Oe === void 0 ? void 0 : Oe.identifier) !== this.evaluationContext.identity.identifier && (this.log("Ignoring cache, identity has changed from " + ((Te = (ke = x.evaluationContext) === null || ke === void 0 ? void 0 : ke.identity) === null || Te === void 0 ? void 0 : Te.identifier) + " to " + this.evaluationContext.identity.identifier), M = !1), this.cacheOptions.ttl && (!x.ts || (/* @__PURE__ */ new Date()).valueOf() - x.ts > this.cacheOptions.ttl) && (x.ts && !this.cacheOptions.loadStale ? (this.log("Ignoring cache, timestamp is too old ts:" + x.ts + " ttl: " + this.cacheOptions.ttl + " time elapsed since cache: " + ((/* @__PURE__ */ new Date()).valueOf() - x.ts) + "ms"), M = !1) : x.ts && this.cacheOptions.loadStale && (this.log("Loading stale cache, timestamp ts:" + x.ts + " ttl: " + this.cacheOptions.ttl + " time elapsed since cache: " + ((/* @__PURE__ */ new Date()).valueOf() - x.ts) + "ms"), X = !0, M = !0)), M && (te = !0, z = w((Le = this.evaluationContext.identity) === null || Le === void 0 ? void 0 : Le.traits, (Ie = (Fe = x.evaluationContext) === null || Fe === void 0 ? void 0 : Fe.identity) === null || Ie === void 0 ? void 0 : Ie.traits), q = w(this.flags, x.flags), this.setState(s(s({}, x), { evaluationContext: Y(s(s({}, x.evaluationContext), { identity: !((Ae = x.evaluationContext) === null || Ae === void 0) && Ae.identity ? s(s({}, (Pe = x.evaluationContext) === null || Pe === void 0 ? void 0 : Pe.identity), { traits: s(s({}, ((Ne = (je = x.evaluationContext) === null || je === void 0 ? void 0 : je.identity) === null || Ne === void 0 ? void 0 : Ne.traits) || {}), ae || {}) }) : void 0 })) })), this.log("Retrieved flags from cache", x))), te ? (Se = !j && (!this.cacheOptions.skipAPI || X), this._onChange(null, { isFromServer: !1, flagsChanged: q, traitsChanged: z }, this._loadedState(null, g.CACHE, Se)), this.oldFlags = this.flags, this.cacheOptions.skipAPI && te && !X && this.log("Skipping API, using cache"), Se && this.getFlags().catch(function(dt) {
|
|
390
|
+
var De;
|
|
391
|
+
(De = at.onError) === null || De === void 0 || De.call(at, dt);
|
|
392
392
|
}), [3, 4]) : [3, 2];
|
|
393
393
|
case 2:
|
|
394
|
-
return
|
|
394
|
+
return j ? [3, 4] : [4, this.getFlags()];
|
|
395
395
|
case 3:
|
|
396
396
|
H.sent(), H.label = 4;
|
|
397
397
|
case 4:
|
|
@@ -401,14 +401,14 @@ var Ve = { exports: {} };
|
|
|
401
401
|
case 6:
|
|
402
402
|
return [3, 10];
|
|
403
403
|
case 7:
|
|
404
|
-
return
|
|
404
|
+
return j ? [3, 9] : [4, this.getFlags()];
|
|
405
405
|
case 8:
|
|
406
406
|
return H.sent(), [3, 10];
|
|
407
407
|
case 9:
|
|
408
|
-
if (
|
|
408
|
+
if (P) this._onChange(null, { isFromServer: !1, flagsChanged: w({}, this.flags), traitsChanged: w({}, (Re = this.evaluationContext.identity) === null || Re === void 0 ? void 0 : Re.traits) }, this._loadedState(null, g.DEFAULT_FLAGS));
|
|
409
409
|
else {
|
|
410
|
-
if (!this.flags) throw new Error(
|
|
411
|
-
this._onChange(null, { isFromServer: !1, flagsChanged: w({}, this.flags), traitsChanged: w({}, (
|
|
410
|
+
if (!this.flags) throw new Error(me);
|
|
411
|
+
this._onChange(null, { isFromServer: !1, flagsChanged: w({}, this.flags), traitsChanged: w({}, (Ue = this.evaluationContext.identity) === null || Ue === void 0 ? void 0 : Ue.traits) }, this._loadedState(null, g.DEFAULT_FLAGS));
|
|
412
412
|
}
|
|
413
413
|
H.label = 10;
|
|
414
414
|
case 10:
|
|
@@ -418,155 +418,155 @@ var Ve = { exports: {} };
|
|
|
418
418
|
});
|
|
419
419
|
}, D.label = 2;
|
|
420
420
|
case 2:
|
|
421
|
-
return D.trys.push([2, 7, , 8]),
|
|
421
|
+
return D.trys.push([2, 7, , 8]), F.getItemSync ? (be = F.getItemSync(this.getStorageKey()), [3, 5]) : [3, 3];
|
|
422
422
|
case 3:
|
|
423
|
-
return [4,
|
|
423
|
+
return [4, F.getItem(this.getStorageKey())];
|
|
424
424
|
case 4:
|
|
425
|
-
|
|
425
|
+
be = D.sent(), D.label = 5;
|
|
426
426
|
case 5:
|
|
427
|
-
return [4,
|
|
427
|
+
return [4, nt(null, be)];
|
|
428
428
|
case 6:
|
|
429
429
|
case 7:
|
|
430
430
|
return D.sent(), [3, 8];
|
|
431
431
|
case 8:
|
|
432
432
|
return [3, 12];
|
|
433
433
|
case 9:
|
|
434
|
-
return
|
|
434
|
+
return j ? [3, 11] : [4, this.getFlags()];
|
|
435
435
|
case 10:
|
|
436
436
|
return D.sent(), [3, 12];
|
|
437
437
|
case 11:
|
|
438
|
-
if (
|
|
439
|
-
else if (this.flags && (oe = null, Object.keys(this.flags).length === 0 && (oe =
|
|
438
|
+
if (P) this._onChange(null, { isFromServer: !1, flagsChanged: w({}, P), traitsChanged: w({}, (e = a.identity) === null || e === void 0 ? void 0 : e.traits) }, this._loadedState(null, g.DEFAULT_FLAGS));
|
|
439
|
+
else if (this.flags && (oe = null, Object.keys(this.flags).length === 0 && (oe = me), this._onChange(null, { isFromServer: !1, flagsChanged: w({}, this.flags), traitsChanged: w({}, (r = a.identity) === null || r === void 0 ? void 0 : r.traits) }, this._loadedState(oe, g.DEFAULT_FLAGS)), oe)) throw new Error(oe);
|
|
440
440
|
D.label = 12;
|
|
441
441
|
case 12:
|
|
442
442
|
return [3, 14];
|
|
443
443
|
case 13:
|
|
444
|
-
throw ee = D.sent(), this.log("Error during initialisation ", ee),
|
|
444
|
+
throw ee = D.sent(), this.log("Error during initialisation ", ee), rt = ee instanceof Error ? ee : new Error("".concat(ee)), (n = this.onError) === null || n === void 0 || n.call(this, rt), ee;
|
|
445
445
|
case 14:
|
|
446
446
|
return [2];
|
|
447
447
|
}
|
|
448
448
|
});
|
|
449
449
|
});
|
|
450
|
-
},
|
|
450
|
+
}, i.prototype.getAllFlags = function() {
|
|
451
451
|
return this.flags;
|
|
452
|
-
},
|
|
453
|
-
return this.evaluationContext.identity = { identifier: t, transient:
|
|
452
|
+
}, i.prototype.identify = function(t, e, r) {
|
|
453
|
+
return this.evaluationContext.identity = { identifier: t, transient: r, traits: this.evaluationContext.identity && this.evaluationContext.identity.identifier == t ? this.evaluationContext.identity.traits : {} }, this.evaluationContext.identity.identifier = t, this.log("Identify: " + this.evaluationContext.identity.identifier), e && (this.evaluationContext.identity.traits = Object.fromEntries(Object.entries(e).map(function(n) {
|
|
454
454
|
var a = n[0], o = n[1];
|
|
455
455
|
return [a, A(o) ? o : { value: o }];
|
|
456
456
|
}))), this.initialised ? this.getFlags() : Promise.resolve();
|
|
457
|
-
},
|
|
457
|
+
}, i.prototype.getState = function() {
|
|
458
458
|
return { api: this.api, flags: this.flags, ts: this.ts, evaluationContext: this.evaluationContext, evaluationEvent: this.evaluationEvent };
|
|
459
|
-
},
|
|
460
|
-
t && (this.initialised = !0, this.api = t.api || this.api ||
|
|
461
|
-
},
|
|
459
|
+
}, i.prototype.setState = function(t) {
|
|
460
|
+
t && (this.initialised = !0, this.api = t.api || this.api || qe, this.flags = t.flags || this.flags, this.evaluationContext = t.evaluationContext || this.evaluationContext, this.evaluationEvent = t.evaluationEvent || this.evaluationEvent, this.log("setState called", this));
|
|
461
|
+
}, i.prototype.logout = function() {
|
|
462
462
|
return this.evaluationContext.identity = null, this.initialised ? this.getFlags() : Promise.resolve();
|
|
463
|
-
},
|
|
463
|
+
}, i.prototype.startListening = function(t) {
|
|
464
464
|
t === void 0 && (t = 1e3), this.getFlagInterval && clearInterval(this.getFlagInterval), this.getFlagInterval = setInterval(this.getFlags, t);
|
|
465
|
-
},
|
|
465
|
+
}, i.prototype.stopListening = function() {
|
|
466
466
|
this.getFlagInterval && (clearInterval(this.getFlagInterval), this.getFlagInterval = null);
|
|
467
|
-
},
|
|
468
|
-
return t === void 0 && (t = null),
|
|
469
|
-
},
|
|
467
|
+
}, i.prototype._loadedState = function(t, e, r) {
|
|
468
|
+
return t === void 0 && (t = null), r === void 0 && (r = !1), { error: t, isFetching: r, isLoading: !1, source: e };
|
|
469
|
+
}, i.prototype.log = function() {
|
|
470
470
|
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
471
|
-
this.enableLogs && console.log.apply(this,
|
|
472
|
-
},
|
|
471
|
+
this.enableLogs && console.log.apply(this, I(["FLAGSMITH:", (/* @__PURE__ */ new Date()).valueOf() - (this.timer || 0), "ms"], t));
|
|
472
|
+
}, i.prototype.updateStorage = function() {
|
|
473
473
|
if (this.cacheFlags) {
|
|
474
474
|
this.ts = (/* @__PURE__ */ new Date()).valueOf();
|
|
475
475
|
var t = JSON.stringify(this.getState());
|
|
476
|
-
this.log("Setting storage", t),
|
|
476
|
+
this.log("Setting storage", t), F.setItem(this.getStorageKey(), t);
|
|
477
477
|
}
|
|
478
|
-
},
|
|
478
|
+
}, i.prototype.updateEventStorage = function() {
|
|
479
479
|
if (this.enableAnalytics) {
|
|
480
480
|
var t = JSON.stringify(this.getState().evaluationEvent);
|
|
481
|
-
|
|
481
|
+
F.setItem(le, t).catch(function(e) {
|
|
482
482
|
return console.error("Flagsmith: Error setting item in async storage", e);
|
|
483
483
|
});
|
|
484
484
|
}
|
|
485
|
-
},
|
|
485
|
+
}, i.prototype.setLoadingState = function(t) {
|
|
486
486
|
var e;
|
|
487
487
|
W(t, this.loadingState) || (this.loadingState = s({}, t), this.log("Loading state changed", t), (e = this._triggerLoadingState) === null || e === void 0 || e.call(this));
|
|
488
|
-
},
|
|
489
|
-
var
|
|
490
|
-
|
|
488
|
+
}, i.prototype.setupRealtime = function(t, e) {
|
|
489
|
+
var r = this, n = t + "sse/environments/" + e + "/stream";
|
|
490
|
+
fe ? this.eventSource || (this.log("Creating event source with url " + n), this.eventSource = new fe(n), this.eventSource.addEventListener("environment_updated", function(a) {
|
|
491
491
|
var o;
|
|
492
492
|
try {
|
|
493
493
|
o = JSON.parse(a.data).updated_at;
|
|
494
494
|
} catch (v) {
|
|
495
|
-
|
|
495
|
+
r.log("Could not parse sse event", v);
|
|
496
496
|
}
|
|
497
|
-
o ? !
|
|
497
|
+
o ? !r.timestamp || o > r.timestamp ? r.isLoading ? r.log("updated_at is new, but flags are loading", a.data, r.timestamp) : (r.log("updated_at is new, fetching flags", a.data, r.timestamp), r.getFlags()) : r.log("updated_at is outdated, skipping get flags", a.data, r.timestamp) : r.log("No updated_at received, fetching flags", a);
|
|
498
498
|
})) : this.log("Error, EventSource is undefined");
|
|
499
|
-
},
|
|
499
|
+
}, i;
|
|
500
500
|
}();
|
|
501
|
-
function
|
|
502
|
-
var t =
|
|
503
|
-
return new ct({ fetch: t, AsyncStorage: e, eventSource:
|
|
501
|
+
function He(i) {
|
|
502
|
+
var t = i.fetch, e = i.AsyncStorage, r = i.eventSource;
|
|
503
|
+
return new ct({ fetch: t, AsyncStorage: e, eventSource: r });
|
|
504
504
|
}
|
|
505
|
-
var ue, vt = (ue = function(
|
|
506
|
-
return ue = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e,
|
|
507
|
-
e.__proto__ =
|
|
508
|
-
} || function(e,
|
|
509
|
-
for (var n in
|
|
510
|
-
}, ue(
|
|
511
|
-
}, function(
|
|
505
|
+
var ue, vt = (ue = function(i, t) {
|
|
506
|
+
return ue = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
|
|
507
|
+
e.__proto__ = r;
|
|
508
|
+
} || function(e, r) {
|
|
509
|
+
for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
|
|
510
|
+
}, ue(i, t);
|
|
511
|
+
}, function(i, t) {
|
|
512
512
|
if (typeof t != "function" && t !== null) throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
|
513
513
|
function e() {
|
|
514
|
-
this.constructor =
|
|
514
|
+
this.constructor = i;
|
|
515
515
|
}
|
|
516
|
-
ue(
|
|
517
|
-
}),
|
|
518
|
-
var t = typeof Symbol == "function" && Symbol.iterator, e = t &&
|
|
519
|
-
if (e) return e.call(
|
|
520
|
-
if (
|
|
521
|
-
return
|
|
516
|
+
ue(i, t), i.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
|
|
517
|
+
}), $e = function(i) {
|
|
518
|
+
var t = typeof Symbol == "function" && Symbol.iterator, e = t && i[t], r = 0;
|
|
519
|
+
if (e) return e.call(i);
|
|
520
|
+
if (i && typeof i.length == "number") return { next: function() {
|
|
521
|
+
return i && r >= i.length && (i = void 0), { value: i && i[r++], done: !i };
|
|
522
522
|
} };
|
|
523
523
|
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
524
|
-
},
|
|
525
|
-
var e = typeof Symbol == "function" &&
|
|
526
|
-
if (!e) return
|
|
527
|
-
var
|
|
524
|
+
}, Xe = function(i, t) {
|
|
525
|
+
var e = typeof Symbol == "function" && i[Symbol.iterator];
|
|
526
|
+
if (!e) return i;
|
|
527
|
+
var r, n, a = e.call(i), o = [];
|
|
528
528
|
try {
|
|
529
|
-
for (; (t === void 0 || t-- > 0) && !(
|
|
529
|
+
for (; (t === void 0 || t-- > 0) && !(r = a.next()).done; ) o.push(r.value);
|
|
530
530
|
} catch (v) {
|
|
531
531
|
n = { error: v };
|
|
532
532
|
} finally {
|
|
533
533
|
try {
|
|
534
|
-
|
|
534
|
+
r && !r.done && (e = a.return) && e.call(a);
|
|
535
535
|
} finally {
|
|
536
536
|
if (n) throw n.error;
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
539
|
return o;
|
|
540
|
-
},
|
|
541
|
-
if (arguments.length === 2) for (var
|
|
542
|
-
return
|
|
543
|
-
},
|
|
540
|
+
}, ge = function(i, t, e) {
|
|
541
|
+
if (arguments.length === 2) for (var r, n = 0, a = t.length; n < a; n++) !r && n in t || (r || (r = Array.prototype.slice.call(t, 0, n)), r[n] = t[n]);
|
|
542
|
+
return i.concat(r || Array.prototype.slice.call(t));
|
|
543
|
+
}, _t = function(i) {
|
|
544
544
|
function t() {
|
|
545
|
-
return
|
|
545
|
+
return i.call(this, `EventSource not available.
|
|
546
546
|
Consider loading an EventSource polyfill and making it available globally as EventSource, or passing one in as eventSourceClass to the ReconnectingEventSource constructor.`) || this;
|
|
547
547
|
}
|
|
548
|
-
return vt(t,
|
|
549
|
-
}(Error),
|
|
550
|
-
function
|
|
551
|
-
var
|
|
552
|
-
if (this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, this._configuration = e != null ? Object.assign({}, e) : void 0, this.withCredentials = !1, this._eventSource = null, this._lastEventId = null, this._timer = null, this._listeners = { open: [], error: [], message: [] }, this.url = t.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
|
|
548
|
+
return vt(t, i), t;
|
|
549
|
+
}(Error), We = function() {
|
|
550
|
+
function i(t, e) {
|
|
551
|
+
var r = this;
|
|
552
|
+
if (this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, this._configuration = e != null ? Object.assign({}, e) : void 0, this.withCredentials = !1, this._eventSource = null, this._lastEventId = null, this._timer = null, this._listeners = { open: [], error: [], message: [] }, this.url = t.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 _t();
|
|
553
553
|
this._onevent_wrapped = function(n) {
|
|
554
|
-
|
|
554
|
+
r._onevent(n);
|
|
555
555
|
}, this._start();
|
|
556
556
|
}
|
|
557
|
-
return
|
|
557
|
+
return i.prototype.dispatchEvent = function(t) {
|
|
558
558
|
throw new Error("Method not implemented.");
|
|
559
|
-
},
|
|
560
|
-
var t, e,
|
|
559
|
+
}, i.prototype._start = function() {
|
|
560
|
+
var t, e, r = this, n = this.url;
|
|
561
561
|
this._lastEventId && (n.indexOf("?") === -1 ? n += "?" : n += "&", n += "lastEventId=" + encodeURIComponent(this._lastEventId)), this._eventSource = new this.eventSourceClass(n, this._configuration), this._eventSource.onopen = function(d) {
|
|
562
|
-
|
|
562
|
+
r._onopen(d);
|
|
563
563
|
}, this._eventSource.onerror = function(d) {
|
|
564
|
-
|
|
564
|
+
r._onerror(d);
|
|
565
565
|
}, this._eventSource.onmessage = function(d) {
|
|
566
|
-
|
|
566
|
+
r.onmessage(d);
|
|
567
567
|
};
|
|
568
568
|
try {
|
|
569
|
-
for (var a =
|
|
569
|
+
for (var a = $e(Object.keys(this._listeners)), o = a.next(); !o.done; o = a.next()) {
|
|
570
570
|
var v = o.value;
|
|
571
571
|
this._eventSource.addEventListener(v, this._onevent_wrapped);
|
|
572
572
|
}
|
|
@@ -579,53 +579,53 @@ Consider loading an EventSource polyfill and making it available globally as Eve
|
|
|
579
579
|
if (t) throw t.error;
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
|
-
},
|
|
582
|
+
}, i.prototype._onopen = function(t) {
|
|
583
583
|
this.readyState === 0 && (this.readyState = 1, this.onopen(t));
|
|
584
|
-
},
|
|
584
|
+
}, i.prototype._onerror = function(t) {
|
|
585
585
|
var e = this;
|
|
586
586
|
if (this.readyState === 1 && (this.readyState = 0, this.onerror(t)), this._eventSource) {
|
|
587
587
|
this._eventSource.close(), this._eventSource = null;
|
|
588
|
-
var
|
|
588
|
+
var r = Math.round(this.max_retry_time * Math.random());
|
|
589
589
|
this._timer = setTimeout(function() {
|
|
590
590
|
return e._start();
|
|
591
|
-
},
|
|
591
|
+
}, r);
|
|
592
592
|
}
|
|
593
|
-
},
|
|
594
|
-
var e,
|
|
593
|
+
}, i.prototype._onevent = function(t) {
|
|
594
|
+
var e, r;
|
|
595
595
|
t && t.lastEventId && (this._lastEventId = t.lastEventId);
|
|
596
596
|
var n = this._listeners[t.type];
|
|
597
597
|
if (n != null) try {
|
|
598
|
-
for (var a =
|
|
598
|
+
for (var a = $e(ge([], Xe(n), !1)), o = a.next(); !o.done; o = a.next())
|
|
599
599
|
o.value.call(this, t);
|
|
600
600
|
} catch (v) {
|
|
601
601
|
e = { error: v };
|
|
602
602
|
} finally {
|
|
603
603
|
try {
|
|
604
|
-
o && !o.done && (
|
|
604
|
+
o && !o.done && (r = a.return) && r.call(a);
|
|
605
605
|
} finally {
|
|
606
606
|
if (e) throw e.error;
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
609
|
t.type === "message" && this.onmessage(t);
|
|
610
|
-
},
|
|
611
|
-
},
|
|
612
|
-
},
|
|
613
|
-
},
|
|
610
|
+
}, i.prototype.onopen = function(t) {
|
|
611
|
+
}, i.prototype.onerror = function(t) {
|
|
612
|
+
}, i.prototype.onmessage = function(t) {
|
|
613
|
+
}, i.prototype.close = function() {
|
|
614
614
|
this._timer && (clearTimeout(this._timer), this._timer = null), this._eventSource && (this._eventSource.close(), this._eventSource = null), this.readyState = 2;
|
|
615
|
-
},
|
|
615
|
+
}, i.prototype.addEventListener = function(t, e, r) {
|
|
616
616
|
this._listeners[t] == null && (this._listeners[t] = [], this._eventSource != null && this._eventSource.addEventListener(t, this._onevent_wrapped));
|
|
617
617
|
var n = this._listeners[t];
|
|
618
|
-
n.includes(e) || (this._listeners[t] =
|
|
619
|
-
},
|
|
618
|
+
n.includes(e) || (this._listeners[t] = ge(ge([], Xe(n), !1), [e], !1));
|
|
619
|
+
}, i.prototype.removeEventListener = function(t, e, r) {
|
|
620
620
|
var n = this._listeners[t];
|
|
621
621
|
this._listeners[t] = n.filter(function(a) {
|
|
622
622
|
return a !== e;
|
|
623
623
|
});
|
|
624
|
-
},
|
|
624
|
+
}, i;
|
|
625
625
|
}();
|
|
626
626
|
globalThis.FlagsmithEventSource = typeof EventSource < "u" ? EventSource : null;
|
|
627
|
-
var
|
|
628
|
-
return t = t || {}, new Promise(function(e,
|
|
627
|
+
var Ye = function(i, t) {
|
|
628
|
+
return t = t || {}, new Promise(function(e, r) {
|
|
629
629
|
var n = new XMLHttpRequest(), a = [], o = [], v = {}, d = function() {
|
|
630
630
|
return { ok: (n.status / 100 | 0) == 2, statusText: n.statusText, status: n.status, url: n.responseURL, text: function() {
|
|
631
631
|
return Promise.resolve(n.responseText);
|
|
@@ -637,32 +637,32 @@ Consider loading an EventSource polyfill and making it available globally as Eve
|
|
|
637
637
|
return a;
|
|
638
638
|
}, entries: function() {
|
|
639
639
|
return o;
|
|
640
|
-
}, get: function(
|
|
641
|
-
return v[
|
|
642
|
-
}, has: function(
|
|
643
|
-
return
|
|
640
|
+
}, get: function(c) {
|
|
641
|
+
return v[c.toLowerCase()];
|
|
642
|
+
}, has: function(c) {
|
|
643
|
+
return c.toLowerCase() in v;
|
|
644
644
|
} } };
|
|
645
645
|
};
|
|
646
|
-
for (var p in n.open(t.method || "get",
|
|
647
|
-
n.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function(
|
|
648
|
-
a.push(y = y.toLowerCase()), o.push([y,
|
|
646
|
+
for (var p in n.open(t.method || "get", i, !0), n.onload = function() {
|
|
647
|
+
n.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function(c, y, k) {
|
|
648
|
+
a.push(y = y.toLowerCase()), o.push([y, k]), v[y] = v[y] ? v[y] + "," + k : k;
|
|
649
649
|
}), e(d());
|
|
650
|
-
}, n.onerror =
|
|
650
|
+
}, n.onerror = r, n.withCredentials = t.credentials == "include", t.headers) n.setRequestHeader(p, t.headers[p]);
|
|
651
651
|
n.send(t.body || null);
|
|
652
652
|
});
|
|
653
|
-
},
|
|
654
|
-
typeof window < "u" && (window.flagsmith =
|
|
655
|
-
return
|
|
656
|
-
},
|
|
653
|
+
}, Ze = He({ AsyncStorage: f, fetch: Ye, eventSource: We });
|
|
654
|
+
typeof window < "u" && (window.flagsmith = Ze), _.createFlagsmithInstance = function() {
|
|
655
|
+
return He({ AsyncStorage: f, fetch: Ye, eventSource: We });
|
|
656
|
+
}, _.default = Ze, Object.defineProperty(_, "__esModule", { value: !0 });
|
|
657
657
|
});
|
|
658
|
-
})(
|
|
659
|
-
var pt =
|
|
658
|
+
})(Je, Je.exports);
|
|
659
|
+
var pt = Je.exports, yt = {
|
|
660
660
|
NOT_INITIALIZED: "FeatureFlag not initialized. Call init() first.",
|
|
661
661
|
INVALID_CONFIG: "Invalid Flagsmith configuration",
|
|
662
662
|
FETCH_FAILED: "Failed to fetch Flagsmith configuration",
|
|
663
663
|
NO_USER_CONTEXT: "User context not set. Call setUser() first.",
|
|
664
664
|
ALREADY_INITIALIZED: "FeatureFlag is already initialized."
|
|
665
|
-
},
|
|
665
|
+
}, st = "business", B, mt = (B = class {
|
|
666
666
|
constructor() {
|
|
667
667
|
ce(this, "flagsmithClient", null);
|
|
668
668
|
ce(this, "userContext", null);
|
|
@@ -674,24 +674,24 @@ var pt = Ve.exports, yt = {
|
|
|
674
674
|
if (!this.flagsmithClient)
|
|
675
675
|
throw new Error(yt.NOT_INITIALIZED);
|
|
676
676
|
}
|
|
677
|
-
async init(
|
|
677
|
+
async init(u, _ = []) {
|
|
678
678
|
if (!this.flagsmithClient)
|
|
679
679
|
try {
|
|
680
680
|
this.flagsmithClient = pt.createFlagsmithInstance();
|
|
681
|
-
const f =
|
|
681
|
+
const f = _.reduce((s, O) => (s[O.feature.name] = O, s), {});
|
|
682
682
|
await this.flagsmithClient.init({
|
|
683
|
-
environmentID:
|
|
684
|
-
api: (
|
|
685
|
-
enableAnalytics: (
|
|
683
|
+
environmentID: u.apiKey,
|
|
684
|
+
api: (u == null ? void 0 : u.url) ?? "https://feature-flag-proxy.feedme.farm/api/v1/",
|
|
685
|
+
enableAnalytics: (u == null ? void 0 : u.enableAnalytics) ?? !0,
|
|
686
686
|
defaultFlags: f,
|
|
687
|
-
cacheFlags: (
|
|
687
|
+
cacheFlags: (u == null ? void 0 : u.cacheFlags) ?? !0
|
|
688
688
|
});
|
|
689
689
|
} catch (f) {
|
|
690
690
|
throw console.error("Failed to initialize FeatureFlag:", f), f;
|
|
691
691
|
}
|
|
692
692
|
}
|
|
693
|
-
async setUser(
|
|
694
|
-
this.ensureInitialized(), this.userContext = { identifier:
|
|
693
|
+
async setUser(u) {
|
|
694
|
+
this.ensureInitialized(), this.userContext = { identifier: u }, await this.updateContext();
|
|
695
695
|
}
|
|
696
696
|
async updateContext() {
|
|
697
697
|
try {
|
|
@@ -701,18 +701,18 @@ var pt = Ve.exports, yt = {
|
|
|
701
701
|
identifier: this.userContext.identifier
|
|
702
702
|
}
|
|
703
703
|
});
|
|
704
|
-
} catch (
|
|
705
|
-
throw console.error("Failed to update user context:",
|
|
704
|
+
} catch (u) {
|
|
705
|
+
throw console.error("Failed to update user context:", u), u;
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
708
|
async getFlags() {
|
|
709
709
|
this.ensureInitialized();
|
|
710
|
-
const
|
|
711
|
-
return Object.entries(
|
|
710
|
+
const u = this.flagsmithClient.getAllFlags();
|
|
711
|
+
return Object.entries(u).map(([_, f]) => {
|
|
712
712
|
var s;
|
|
713
713
|
return {
|
|
714
714
|
feature: {
|
|
715
|
-
name:
|
|
715
|
+
name: _,
|
|
716
716
|
id: (f == null ? void 0 : f.id) ?? 0
|
|
717
717
|
},
|
|
718
718
|
enabled: f.enabled,
|
|
@@ -720,114 +720,114 @@ var pt = Ve.exports, yt = {
|
|
|
720
720
|
};
|
|
721
721
|
});
|
|
722
722
|
}
|
|
723
|
-
getFlagValue(
|
|
723
|
+
getFlagValue(u, _) {
|
|
724
724
|
this.ensureInitialized();
|
|
725
|
-
const f = this.flagsmithClient.getValue(
|
|
725
|
+
const f = this.flagsmithClient.getValue(u);
|
|
726
726
|
if (f == null)
|
|
727
727
|
return null;
|
|
728
728
|
try {
|
|
729
729
|
const s = f.toString();
|
|
730
|
-
return
|
|
730
|
+
return _ ? _(s) : typeof {} == "number" ? isNaN(Number(s)) ? null : Number(s) : typeof {} == "boolean" ? s.toLowerCase() === "true" : s;
|
|
731
731
|
} catch (s) {
|
|
732
732
|
return console.error("Error transforming flag value:", s), null;
|
|
733
733
|
}
|
|
734
734
|
}
|
|
735
|
-
getFlag(
|
|
735
|
+
getFlag(u) {
|
|
736
736
|
this.ensureInitialized();
|
|
737
|
-
const
|
|
738
|
-
if (
|
|
739
|
-
const f = this.flagsmithClient.hasFeature(
|
|
737
|
+
const _ = this.flagsmithClient.getValue(u);
|
|
738
|
+
if (_ == null) return null;
|
|
739
|
+
const f = this.flagsmithClient.hasFeature(u);
|
|
740
740
|
return {
|
|
741
741
|
feature: {
|
|
742
|
-
name:
|
|
742
|
+
name: u,
|
|
743
743
|
id: 0
|
|
744
744
|
},
|
|
745
745
|
enabled: f,
|
|
746
|
-
value:
|
|
746
|
+
value: _.toString()
|
|
747
747
|
};
|
|
748
748
|
}
|
|
749
|
-
async getUserFlagValue(
|
|
749
|
+
async getUserFlagValue(u, _, f = null, s) {
|
|
750
750
|
var K;
|
|
751
|
-
const
|
|
751
|
+
const O = this.userContext;
|
|
752
752
|
try {
|
|
753
|
-
return await this.setUser(
|
|
754
|
-
} catch (
|
|
755
|
-
return console.error(`Error getting user flag value for ${
|
|
753
|
+
return await this.setUser(u), this.getFlagValue(_, s) ?? f;
|
|
754
|
+
} catch (I) {
|
|
755
|
+
return console.error(`Error getting user flag value for ${_}:`, I), f;
|
|
756
756
|
} finally {
|
|
757
757
|
try {
|
|
758
|
-
await ((K = this.flagsmithClient) == null ? void 0 : K.logout()), this.userContext = null,
|
|
759
|
-
} catch (
|
|
760
|
-
console.error("Error during cleanup:",
|
|
758
|
+
await ((K = this.flagsmithClient) == null ? void 0 : K.logout()), this.userContext = null, O && await this.setUser(O.identifier);
|
|
759
|
+
} catch (I) {
|
|
760
|
+
console.error("Error during cleanup:", I);
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
763
|
}
|
|
764
764
|
reset() {
|
|
765
765
|
this.flagsmithClient = null, this.userContext = null;
|
|
766
766
|
}
|
|
767
|
-
}, ce(B, "instance"), B), bt = mt.getInstance(), se =
|
|
767
|
+
}, ce(B, "instance"), B), bt = mt.getInstance(), se = de(!1), _e = de([]), ne = de(null);
|
|
768
768
|
function St(l = bt) {
|
|
769
|
-
const
|
|
769
|
+
const u = () => se.value ? !0 : (console.warn("FeatureFlag is not initialized. Using default values."), !1), _ = async (g, C = []) => {
|
|
770
770
|
if (se.value) {
|
|
771
771
|
console.warn("FeatureFlag is already initialized.");
|
|
772
772
|
return;
|
|
773
773
|
}
|
|
774
774
|
try {
|
|
775
|
-
await l.init(g, C),
|
|
775
|
+
await l.init(g, C), _e.value = await l.getFlags(), se.value = !0, ne.value = null;
|
|
776
776
|
} catch (E) {
|
|
777
777
|
console.error("Failed to initialize feature flags:", E), ne.value = E;
|
|
778
778
|
}
|
|
779
779
|
}, f = async (g) => {
|
|
780
|
-
if (
|
|
780
|
+
if (u())
|
|
781
781
|
try {
|
|
782
|
-
await l.setUser(g),
|
|
782
|
+
await l.setUser(g), _e.value = await l.getFlags(), ne.value = null;
|
|
783
783
|
} catch (C) {
|
|
784
784
|
console.error("Failed to set user:", C), ne.value = C;
|
|
785
785
|
}
|
|
786
|
-
}, s = async (g) => f(`${
|
|
787
|
-
if (!
|
|
786
|
+
}, s = async (g) => f(`${st}-${g}`), O = (g, C, E = null) => {
|
|
787
|
+
if (!u()) return E;
|
|
788
788
|
try {
|
|
789
789
|
return l.getFlagValue(g, C) ?? E;
|
|
790
790
|
} catch (A) {
|
|
791
791
|
return console.error(`Error getting flag value for ${g}:`, A), E;
|
|
792
792
|
}
|
|
793
793
|
}, K = (g, C) => {
|
|
794
|
-
if (!
|
|
794
|
+
if (!u()) return C ?? null;
|
|
795
795
|
try {
|
|
796
796
|
return l.getFlag(g) ?? C ?? null;
|
|
797
797
|
} catch (E) {
|
|
798
798
|
return console.error(`Error getting flag for ${g}:`, E), C ?? null;
|
|
799
799
|
}
|
|
800
|
-
},
|
|
801
|
-
if (!
|
|
800
|
+
}, I = async (g, C, E = null, A) => {
|
|
801
|
+
if (!u()) return E;
|
|
802
802
|
try {
|
|
803
803
|
return await l.getUserFlagValue(g, C, E, A);
|
|
804
804
|
} catch ($) {
|
|
805
805
|
return console.error(`Error getting user flag value for ${C}:`, $), E;
|
|
806
806
|
}
|
|
807
|
-
}, W = async (g, C, E = null, A) =>
|
|
807
|
+
}, W = async (g, C, E = null, A) => I(`${st}-${g}`, C, E, A), w = () => {
|
|
808
808
|
try {
|
|
809
809
|
l.reset();
|
|
810
810
|
} catch (g) {
|
|
811
811
|
console.error("Error resetting feature flags:", g);
|
|
812
812
|
} finally {
|
|
813
|
-
|
|
813
|
+
_e.value = [], se.value = !1, ne.value = null;
|
|
814
814
|
}
|
|
815
815
|
};
|
|
816
816
|
return {
|
|
817
|
-
flags: Ge(
|
|
817
|
+
flags: Ge(_e),
|
|
818
818
|
isInitialized: Ge(se),
|
|
819
819
|
error: Ge(ne),
|
|
820
|
-
init:
|
|
820
|
+
init: _,
|
|
821
821
|
setUser: f,
|
|
822
822
|
setBusiness: s,
|
|
823
|
-
getFlagValue:
|
|
823
|
+
getFlagValue: O,
|
|
824
824
|
getFlag: K,
|
|
825
|
-
getUserFlagValue:
|
|
825
|
+
getUserFlagValue: I,
|
|
826
826
|
getBusinessFlagValue: W,
|
|
827
827
|
reset: w
|
|
828
828
|
};
|
|
829
829
|
}
|
|
830
|
-
var
|
|
830
|
+
var he = () => St(), b = /* @__PURE__ */ ((l) => (l.inventory_portal_must_use_transfer_template = "inventory_portal_must_use_transfer_template", l.inventory_portal_use_iframe = "inventory_portal_use_iframe", l.inventory_pos_adjust_v1 = "inventory_pos_adjust_v1", l.inventory_pos_adjust_v2_wastage = "inventory_pos_adjust_v2_wastage", l.inventory_pos_closing_recalculation = "inventory_pos_closing_recalculation", l.inventory_pos_closing_v1 = "inventory_pos_closing_v1", l.inventory_pos_closing_v2 = "inventory_pos_closing_v2", l.inventory_pos_convert_v1 = "inventory_pos_convert_v1", l.inventory_pos_costing = "inventory_pos_costing", l.inventory_pos_stock_return = "inventory_pos_stock_return", l.inventory_pos_transfer_require_fulfillment = "inventory_pos_transfer_require_fulfillment", l.inventory_purchase_order_approval = "inventory_purchase_order_approval", l.inventory_portal_xilnex_transfer_note = "inventory_portal_xilnex_transfer_note", l.inventory_portal_custom_attribute = "inventory_portal_custom_attribute", l.inventory_portal_purchase_order_v2 = "inventory_portal_purchase_order_v2", l.inventory_portal_accept_require_fulfillment = "inventory_portal_accept_require_fulfillment", l.inventory_portal_po_operate_v2 = "inventory_portal_po_operate_v2", l.inventory_pos_allow_receive_order = "inventory_pos_allow_receive_order", l.inventory_xilnex_opening_migration = "inventory_xilnex_opening_migration", l.inventory_ingredient_group = "inventory_ingredient_group", l.inventory_purchase_order_backdate = "inventory_purchase_order_backdate", l.inventory_synergy_opening_migration = "inventory_synergy_opening_migration", l.inventory_netsuite_inventory_transfer_out = "inventory_netsuite_inventory_transfer_out", l.inventory_portal_supplier_preparation_time = "inventory_portal_supplier_preparation_time", l.inventory_backdate_receive = "inventory_backdate_receive", l.inventory_portal_delivery_order_write = "inventory_portal_delivery_order_write", l.inventory_purchase_order_custom_cost = "inventory_purchase_order_custom_cost", l.inventory_bulk_import = "inventory_bulk_import", l.inventory_portal_surcharge = "inventory_portal_surcharge", l.inventory_purchase_order_cost_edit = "inventory_purchase_order_cost_edit", l.inventory_purchase_order_workflow_allow_to_mark_completed = "inventory_purchase_order_workflow_allow_to_mark_completed", l.inventory_recipe_v2 = "inventory_recipe_v2", l.inventory_print_template = "inventory_print_template", l.inventory_purchase_order_email = "inventory_purchase_order_email", l.inventory_bulk_edit_recipes = "inventory_bulk_edit_recipes", l))(b || {});
|
|
831
831
|
const Ct = /* @__PURE__ */ new Set([
|
|
832
832
|
// vivo pizza prod
|
|
833
833
|
"business_6687e91fa7240b001ba3f4c2",
|
|
@@ -873,148 +873,156 @@ function lt() {
|
|
|
873
873
|
inventory_recipe_v2: !1,
|
|
874
874
|
inventory_print_template: !1,
|
|
875
875
|
inventory_purchase_order_email: !1,
|
|
876
|
-
inventory_bulk_edit_recipes: !1
|
|
876
|
+
inventory_bulk_edit_recipes: !1,
|
|
877
|
+
report_portal_po_forecast_days_constraint: null,
|
|
878
|
+
report_portal_po_forecast_days_default: 7
|
|
877
879
|
};
|
|
878
880
|
}
|
|
879
|
-
const
|
|
881
|
+
const h = de(lt()), It = () => ({
|
|
880
882
|
get businessDbName() {
|
|
881
|
-
var
|
|
882
|
-
return `business_${((
|
|
883
|
+
var _;
|
|
884
|
+
return `business_${((_ = Ke().currentBusiness.value) == null ? void 0 : _._id) ?? ""}`;
|
|
883
885
|
},
|
|
884
886
|
get isWarehouse() {
|
|
885
|
-
var
|
|
886
|
-
return ((
|
|
887
|
+
var u;
|
|
888
|
+
return ((u = Ve()._currentLocation) == null ? void 0 : u.type) === ot.enum.warehouse;
|
|
887
889
|
},
|
|
888
890
|
get restaurantPosVersion() {
|
|
889
|
-
var
|
|
890
|
-
const l =
|
|
891
|
-
return (
|
|
891
|
+
var _;
|
|
892
|
+
const l = Ve();
|
|
893
|
+
return (_ = Ke().restaurants.value.find(
|
|
892
894
|
(f) => {
|
|
893
895
|
var s;
|
|
894
896
|
return f._id === ((s = l._currentLocation) == null ? void 0 : s.doc._id);
|
|
895
897
|
}
|
|
896
|
-
)) == null ? void 0 :
|
|
898
|
+
)) == null ? void 0 : _.posVersion;
|
|
897
899
|
},
|
|
898
900
|
get enableTotalCost() {
|
|
899
|
-
return
|
|
901
|
+
return h.value.enableTotalCost;
|
|
900
902
|
},
|
|
901
903
|
get enableBackdatePo() {
|
|
902
|
-
return
|
|
904
|
+
return h.value.enableBackdatePo;
|
|
903
905
|
},
|
|
904
906
|
/** @deprecated TODO: remove */
|
|
905
907
|
get autoReceiveWarehouse() {
|
|
906
|
-
return
|
|
908
|
+
return h.value.autoReceiveWarehouse;
|
|
907
909
|
},
|
|
908
910
|
/** @deprecated TODO: remove */
|
|
909
911
|
get manualReceive() {
|
|
910
|
-
return
|
|
912
|
+
return h.value.manualReceive;
|
|
911
913
|
},
|
|
912
914
|
get isLoaded() {
|
|
913
|
-
return
|
|
915
|
+
return h.value.isLoaded;
|
|
914
916
|
},
|
|
915
917
|
get enablePoTemplate() {
|
|
916
|
-
return
|
|
918
|
+
return h.value.enablePoTemplate;
|
|
917
919
|
},
|
|
918
920
|
get enableClosingTemplate() {
|
|
919
|
-
return
|
|
921
|
+
return h.value.enableClosingTemplate;
|
|
920
922
|
},
|
|
921
923
|
get enableWastageTemplate() {
|
|
922
|
-
return
|
|
924
|
+
return h.value.enableWastageTemplate;
|
|
923
925
|
},
|
|
924
926
|
get enableIngredientGroup() {
|
|
925
|
-
return
|
|
927
|
+
return h.value.enableIngredientGroup;
|
|
926
928
|
},
|
|
927
929
|
get mustUsePoTemplate() {
|
|
928
|
-
return
|
|
930
|
+
return h.value.mustUsePoTemplate;
|
|
929
931
|
},
|
|
930
932
|
get businessSupplierOnly() {
|
|
931
|
-
return
|
|
933
|
+
return h.value.businessSupplierOnly;
|
|
932
934
|
},
|
|
933
935
|
get enableXilnexTransferNote() {
|
|
934
|
-
return
|
|
936
|
+
return h.value.enableXilnexTransferNote;
|
|
935
937
|
},
|
|
936
938
|
get enabledXilnexOpeningMigration() {
|
|
937
|
-
return
|
|
939
|
+
return h.value.inventory_xilnex_opening_migration;
|
|
938
940
|
},
|
|
939
941
|
get enabledSynergyOpeningMigration() {
|
|
940
|
-
return
|
|
942
|
+
return h.value.inventory_synergy_opening_migration;
|
|
941
943
|
},
|
|
942
944
|
get enableCustomAttribute() {
|
|
943
|
-
return
|
|
945
|
+
return h.value.enableCustomAttribute;
|
|
944
946
|
},
|
|
945
947
|
get usePurchaseOrderV2() {
|
|
946
|
-
return
|
|
948
|
+
return h.value.usePurchaseOrderV2;
|
|
947
949
|
},
|
|
948
950
|
get acceptRequireFulfillment() {
|
|
949
|
-
return
|
|
951
|
+
return h.value.acceptRequireFulfillment;
|
|
950
952
|
},
|
|
951
953
|
get useOperatePurchaseOrderV2() {
|
|
952
|
-
return
|
|
954
|
+
return h.value.useOperatePurchaseOrderV2;
|
|
953
955
|
},
|
|
954
956
|
get isNetSuiteInventoryTransferOutEnabled() {
|
|
955
|
-
return
|
|
957
|
+
return h.value.inventory_netsuite_inventory_transfer_out;
|
|
956
958
|
},
|
|
957
959
|
get enableSupplierPreparationTime() {
|
|
958
|
-
return
|
|
960
|
+
return h.value.inventory_portal_supplier_preparation_time;
|
|
959
961
|
},
|
|
960
962
|
get enablePortalDeliveryOrderWrite() {
|
|
961
|
-
return
|
|
963
|
+
return h.value.inventory_portal_delivery_order_write ?? !0;
|
|
962
964
|
},
|
|
963
965
|
get enablePOSTransferRequireFulfillment() {
|
|
964
|
-
return
|
|
966
|
+
return h.value.inventory_pos_transfer_require_fulfillment;
|
|
965
967
|
},
|
|
966
968
|
get enableBackdateReceive() {
|
|
967
|
-
return
|
|
969
|
+
return h.value.inventory_backdate_receive;
|
|
968
970
|
},
|
|
969
971
|
get enablePurchaseOrderReceiveWithCustomCost() {
|
|
970
|
-
return
|
|
972
|
+
return h.value.inventory_purchase_order_custom_cost;
|
|
971
973
|
},
|
|
972
974
|
get enableBulkImport() {
|
|
973
|
-
return
|
|
975
|
+
return h.value.inventory_bulk_import;
|
|
974
976
|
},
|
|
975
977
|
get enableSurcharge() {
|
|
976
|
-
return
|
|
978
|
+
return h.value.inventory_portal_surcharge;
|
|
977
979
|
},
|
|
978
980
|
get enablePurchaseOrderCostEdit() {
|
|
979
|
-
return
|
|
981
|
+
return h.value.inventory_purchase_order_cost_edit;
|
|
980
982
|
},
|
|
981
983
|
get poWorkflowAllowToMarkCompleted() {
|
|
982
|
-
return
|
|
984
|
+
return h.value.inventory_purchase_order_workflow_allow_to_mark_completed;
|
|
983
985
|
},
|
|
984
986
|
get enableRecipeV2() {
|
|
985
|
-
return
|
|
987
|
+
return h.value.inventory_recipe_v2;
|
|
986
988
|
},
|
|
987
989
|
get enablePrintTemplate() {
|
|
988
|
-
return
|
|
990
|
+
return h.value.inventory_print_template;
|
|
989
991
|
},
|
|
990
992
|
get enablePurchaseOrderEmail() {
|
|
991
|
-
return
|
|
993
|
+
return h.value.inventory_purchase_order_email;
|
|
992
994
|
},
|
|
993
995
|
get enableBulkEditRecipes() {
|
|
994
|
-
return
|
|
996
|
+
return h.value.inventory_bulk_edit_recipes;
|
|
997
|
+
},
|
|
998
|
+
get poForecastDaysConstraint() {
|
|
999
|
+
return h.value.report_portal_po_forecast_days_constraint;
|
|
1000
|
+
},
|
|
1001
|
+
get poForecastDaysDefault() {
|
|
1002
|
+
return h.value.report_portal_po_forecast_days_default;
|
|
995
1003
|
},
|
|
996
1004
|
async init() {
|
|
997
|
-
const l =
|
|
998
|
-
await
|
|
1005
|
+
const l = Ke(), { init: u, setBusiness: _ } = he(), f = gt(), s = l.namespace.value === "prod";
|
|
1006
|
+
await u({
|
|
999
1007
|
apiKey: s ? "6GhcttsJ9Rj9cTevcdrpin" : "MaGoXrEWuEJNpWgKTqseee"
|
|
1000
1008
|
// url: 'https://flag.feedme.farm/api/v1/', // optional -> this is a default URL value
|
|
1001
1009
|
// enableAnalytics: true, // optional, defaults to true
|
|
1002
1010
|
// cacheFlags: true // optional, defaults to true
|
|
1003
|
-
}),
|
|
1011
|
+
}), Ve().watchLocation(async (K) => {
|
|
1004
1012
|
var A, $, Y;
|
|
1005
1013
|
if (!K) {
|
|
1006
|
-
|
|
1014
|
+
h.value = lt();
|
|
1007
1015
|
return;
|
|
1008
1016
|
}
|
|
1009
|
-
const
|
|
1010
|
-
await
|
|
1011
|
-
const W = `business_${
|
|
1017
|
+
const I = ((A = l.currentBusiness.value) == null ? void 0 : A._id) ?? "";
|
|
1018
|
+
await _(I);
|
|
1019
|
+
const W = `business_${I}`, w = K.type === ot.enum.warehouse, g = (
|
|
1012
1020
|
// if menu v4, must manual receive && must use outlet app
|
|
1013
1021
|
(($ = l.currentBusiness.value) == null ? void 0 : $.menuVersion) === "v4" && // more guard for businesses using menu v4, only those listed for manual receive will be included
|
|
1014
1022
|
// TODO: may be removed to use menu version only
|
|
1015
1023
|
Ct.has(this.businessDbName)
|
|
1016
1024
|
), C = xt.has(W) || S(b.inventory_portal_must_use_transfer_template), E = S(b.inventory_purchase_order_backdate) && (this.isWarehouse || f.state.closing !== null);
|
|
1017
|
-
|
|
1025
|
+
h.value = {
|
|
1018
1026
|
isLoaded: !0,
|
|
1019
1027
|
enableTotalCost: ((Y = l.currentBusiness.value) == null ? void 0 : Y.menuVersion) === "v4",
|
|
1020
1028
|
enableBackdatePo: E,
|
|
@@ -1066,26 +1074,44 @@ const _ = he(lt()), Lt = () => ({
|
|
|
1066
1074
|
inventory_recipe_v2: S(b.inventory_recipe_v2),
|
|
1067
1075
|
inventory_print_template: S(b.inventory_print_template),
|
|
1068
1076
|
inventory_purchase_order_email: S(b.inventory_purchase_order_email),
|
|
1069
|
-
inventory_bulk_edit_recipes: S(b.inventory_bulk_edit_recipes)
|
|
1077
|
+
inventory_bulk_edit_recipes: S(b.inventory_bulk_edit_recipes),
|
|
1078
|
+
report_portal_po_forecast_days_constraint: Et(
|
|
1079
|
+
"report_portal_po_forecast_days_constraint"
|
|
1080
|
+
),
|
|
1081
|
+
report_portal_po_forecast_days_default: wt(
|
|
1082
|
+
"report_portal_po_forecast_days_default",
|
|
1083
|
+
7
|
|
1084
|
+
)
|
|
1070
1085
|
};
|
|
1071
1086
|
}, "feature");
|
|
1072
1087
|
},
|
|
1073
1088
|
async awaitFeatureLoaded(l) {
|
|
1074
|
-
return new Promise((
|
|
1075
|
-
const
|
|
1076
|
-
|
|
1089
|
+
return new Promise((u) => {
|
|
1090
|
+
const _ = () => {
|
|
1091
|
+
h.value.isLoaded ? u(l()) : setTimeout(_, 100);
|
|
1077
1092
|
};
|
|
1078
|
-
|
|
1093
|
+
_();
|
|
1079
1094
|
});
|
|
1080
1095
|
}
|
|
1081
1096
|
});
|
|
1082
|
-
function S(l,
|
|
1083
|
-
|
|
1084
|
-
const { getFlagValue:
|
|
1085
|
-
return
|
|
1097
|
+
function S(l, u) {
|
|
1098
|
+
u = u === void 0 ? null : u;
|
|
1099
|
+
const { getFlagValue: _ } = he();
|
|
1100
|
+
return _(l, (f) => f === "true") ?? u;
|
|
1101
|
+
}
|
|
1102
|
+
function Et(l) {
|
|
1103
|
+
const { getFlagValue: u } = he();
|
|
1104
|
+
return u(l, (f) => f.trim() ? f.trim() : null) ?? null;
|
|
1105
|
+
}
|
|
1106
|
+
function wt(l, u) {
|
|
1107
|
+
const { getFlagValue: _ } = he();
|
|
1108
|
+
return _(l, (s) => {
|
|
1109
|
+
const O = parseInt(s, 10);
|
|
1110
|
+
return isNaN(O) ? null : O;
|
|
1111
|
+
}) ?? u;
|
|
1086
1112
|
}
|
|
1087
1113
|
export {
|
|
1088
1114
|
b as I,
|
|
1089
|
-
|
|
1090
|
-
|
|
1115
|
+
he as a,
|
|
1116
|
+
It as u
|
|
1091
1117
|
};
|