@feedmepos/mf-inventory-portal 1.7.1-dev.0 → 1.7.2-dev.0
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-B_ja37tB.js → App-GsVnjJ5M.js} +5 -5
- package/dist/ApprovalView-DSPu2Gk5.js +242 -0
- package/dist/{BindingsDialog-0IRWCLTc.js → BindingsDialog-B9_lCD9R.js} +2 -2
- package/dist/{BindingsPicker-DCISa6Fx.js → BindingsPicker-ZKl53ZBk.js} +2 -2
- package/dist/{BindingsTable-B3CmHp97.js → BindingsTable-CLtS3u8f.js} +3 -3
- package/dist/BulkReceiveRequestView-BbHwEPzW.js +2011 -0
- package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-D4Nd89xp.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-KgqYNGrB.js} +1 -1
- package/dist/ClosingDraftView-Ctc6-1-J.js +4496 -0
- package/dist/{ClosingHistoryView-KdmhszIO.js → ClosingHistoryView-CX9xtMvI.js} +7 -7
- package/dist/{ClosingTemplateView-CQRujMB9.js → ClosingTemplateView-BuoQegZF.js} +17 -17
- package/dist/{DefaultView-QAEDG6pS.js → DefaultView-BltV37jK.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-B08SSOCX.js → DeliveryOrderPrintPreview-CxzgxTJk.js} +2 -2
- package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-DdzV_fzq.js → EmailDialog.vue_vue_type_script_setup_true_lang-5Hhoj-yj.js} +10225 -10398
- package/dist/{FmAdminBadge-DH_2w13D.js → FmAdminBadge-DlplQOHb.js} +8 -8
- package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-CmH3uhTZ.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-jTZNZIrW.js} +1 -1
- package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BYTn-hpQ.js +76 -0
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Df-yCfRe.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DLYrZfPo.js} +4 -4
- package/dist/{FmMultiselectDialog-QEs0yct_.js → FmMultiselectDialog-BxAfKkDh.js} +2 -2
- package/dist/{FmMultiselectDialog-DpPyNOpJ.js → FmMultiselectDialog-DF_inpi2.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-D8-IQUtA.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BYhQBazV.js} +119 -121
- package/dist/{ImportView-8qlgZSTO.js → ImportView-C76r6and.js} +8 -8
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-CGWRbAF2.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-By-9uV57.js} +1 -1
- package/dist/{IngredientGroupView-BI9SlKfz.js → IngredientGroupView-vRbMzHBS.js} +6 -6
- package/dist/{IngredientsView-1naUkKAi.js → IngredientsView-GMSV1cL0.js} +17 -17
- package/dist/{IntegrationExplorerView-C6kyLz3y.js → IntegrationExplorerView-ClhCRTC-.js} +5 -5
- package/dist/{IntegrationView-DrmxLdlk.js → IntegrationView-DM-TvYjd.js} +15 -15
- package/dist/{InventoryBindingForm-CPNAgZkD.js → InventoryBindingForm-CpY3n5Ug.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-sz_VtHRr.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CEF1D6bJ.js} +5 -5
- package/dist/{InventoryBindingSummary-Cu98L10w.js → InventoryBindingSummary-CYOt-E-3.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-g2PDNQx-.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-jZHUuEoU.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BZEa61go.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Bw1xCASs.js} +1 -1
- package/dist/{ProductionView-D8dxypqA.js → ProductionView-D6UC_XqI.js} +8 -8
- package/dist/{PublishView-C82UwIoz.js → PublishView-CuDaby-H.js} +4 -4
- package/dist/{PurchaseOrderPrintPreview-CP40tEma.js → PurchaseOrderPrintPreview-DcSuomzT.js} +2 -2
- package/dist/ReceiveRequestView-CMywjm4H.js +345 -0
- package/dist/{RecipeView-DB1DJQp7.js → RecipeView-BAcLGUEw.js} +18 -18
- package/dist/{SettingsView-DsS62lxW.js → SettingsView-Dy3VaVP2.js} +6 -6
- package/dist/{SingleColumnLayout.vue_vue_type_script_setup_true_lang-DWsPvPE1.js → SingleColumnLayout.vue_vue_type_script_setup_true_lang-DwrLsWX_.js} +1 -1
- package/dist/{StockView-gcf7RCZz.js → StockView-BFSFWXEY.js} +23 -23
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-nXqFCKic.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-B5qk8k2h.js} +1 -1
- package/dist/{SupplierView-BIANlKLE.js → SupplierView-BvZ4bdjb.js} +13 -13
- package/dist/{SurchargeView-kRzaixM5.js → SurchargeView-DEx1ncN0.js} +7 -7
- package/dist/SystemTrailDialog.vue_vue_type_script_setup_true_lang-DvjxSkiV.js +178 -0
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BceIOuBq.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-raGPvWWz.js} +2 -2
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-Dqn_ArEw.js +4660 -0
- package/dist/{TransferTemplateView-Bq68Vh7t.js → TransferTemplateView-DqwLSixK.js} +21 -21
- package/dist/{UnitCostHistoryView-d0oLssyZ.js → UnitCostHistoryView-BwuW604u.js} +6 -6
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-CLOotG6K.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-DI4MfA6h.js} +4 -4
- package/dist/{UnitView-BHfm2IE4.js → UnitView-DBSX7myc.js} +8 -8
- package/dist/{WarehouseView-CorSYwm6.js → WarehouseView-D9BLSUaw.js} +6 -6
- package/dist/{WastageTemplateView-CtYZwiRW.js → WastageTemplateView-BV98TGlI.js} +15 -15
- package/dist/api/closing-draft.d.ts +5 -1
- package/dist/api/purchase-order.d.ts +1 -35
- package/dist/{app-37NZKFUI.js → app-D_Ym25tG.js} +5262 -5566
- package/dist/app.d.ts +24 -88
- package/dist/app.js +1 -1
- package/dist/{closing-template-C0dl45x2.js → closing-template-CgZ_4k-K.js} +1 -1
- package/dist/components/FmFilterableMenuOptions.vue.d.ts +2 -11
- package/dist/{date2-r4KgBCs9.js → date2-BJDb1yuY.js} +1 -1
- package/dist/{dayjs.min-BKUldDi9.js → dayjs.min-DaQY5dXC.js} +1 -1
- package/dist/{decimal-Cgmw6HIY.js → decimal-D7kHeIBp.js} +2 -2
- package/dist/{defineDeepModel-DXLwZWst.js → defineDeepModel-C6b9BBLr.js} +1 -1
- package/dist/{duplicate-template-DDA4QWPl.js → duplicate-template-B3efBcsm.js} +1 -1
- package/dist/feature-8uw1BmnH.js +1136 -0
- package/dist/{format-time-from-id-Dhjn5QgH.js → format-time-from-id-DLNUrReR.js} +1 -1
- package/dist/{format-unit-display-g95-VuYJ.js → format-unit-display-dedOq7Rd.js} +12 -12
- package/dist/{import-export.helper-DsZFPPqj.js → import-export.helper-CLJoNMDx.js} +6 -6
- package/dist/{index-B9WjF3Ox.js → index-BzcCCKB7.js} +1 -1
- package/dist/{index-C207KsUh.js → index-D0IvVK8C.js} +3 -3
- package/dist/{index-D3Bmmx66.js → index-K8Z-b9IK.js} +1 -1
- package/dist/{inventory-core-dart.default-NpD15h63.js → inventory-core-dart.default-DD-U6dYG.js} +5550 -7099
- package/dist/{jszip.min-B52cHzHI.js → jszip.min-D6DuQ9eP.js} +2 -2
- package/dist/{lz-string-CItFpr5-.js → lz-string-DPtdOdTM.js} +1 -1
- package/dist/{netsuite-R_NkLn5t.js → netsuite-6tmjDviW.js} +2 -2
- package/dist/{number-BkC_lelq.js → number-CMVOg7m3.js} +3 -3
- package/dist/{predefined-templates-CVT54o4V.js → predefined-templates-DfSWTcww.js} +1 -1
- package/dist/{purchase-order-template-DvqAncB2.js → purchase-order-template-GCzUtb6y.js} +1 -1
- package/dist/{recalculationUtils-Cak1mo4o.js → recalculationUtils-CSBScoyF.js} +1 -1
- package/dist/router/name.d.ts +0 -1
- package/dist/{rules--cnFg-PI.js → rules-pC-W9ghI.js} +2 -2
- package/dist/{stock-BLYAJxMj.js → stock-C0lKfZnz.js} +1 -1
- package/dist/{stock-DvquSog3.js → stock-CIpjxe6A.js} +3 -3
- package/dist/stores/feature.d.ts +0 -2
- package/dist/style.css +1 -1
- package/dist/{supplier-C5X8p_vd.js → supplier-eYlqSO4X.js} +2 -2
- package/dist/{surcharge-CLkpleoW.js → surcharge-CX5M8xDS.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{uom-rules-CykFo_pB.js → uom-rules-CfUOdeZ4.js} +1 -1
- package/dist/{use-ingredient-select-dialog-DlxWMkAI.js → use-ingredient-select-dialog-DYRHuZLi.js} +2 -2
- package/dist/{use-inventory-binding-dialog-DnWDyziu.js → use-inventory-binding-dialog-CQahb9Rn.js} +2 -2
- package/dist/{use-template-enabled-locations-SRgcWLO4.js → use-template-enabled-locations-BOO-eQch.js} +2 -2
- package/dist/{use-transfer-locations-D4f4Ib1r.js → use-transfer-locations-Ffdy6Z9C.js} +2 -2
- package/dist/{useHrmPermission-lAc6ZHVZ.js → useHrmPermission-CXSUDdlQ.js} +1 -1
- package/dist/{useNavigationMenu-CeN7TEwe.js → useNavigationMenu-DfW5RBKu.js} +49 -59
- package/dist/{useSseClient-C6ndlLpA.js → useSseClient-Bl-WWwFk.js} +1 -1
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftApprovalDialog.vue.d.ts +6 -2
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +4 -4
- package/dist/views/closing-draft/components/closing-draft-groups/ClosingGroupAction.vue.d.ts +2 -2
- package/dist/views/closing-draft/components/closing-draft-groups/ClosingGroupDetailSideSheet.vue.d.ts +2 -2
- package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +6 -6
- package/dist/views/closing-draft/composables/use-closing-draft-import.d.ts +1 -1
- package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +12 -12
- package/dist/views/receive-request/components/transfer-dialog/TransferDialogProps.d.ts +0 -1
- package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +0 -1
- package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +2 -102
- package/dist/views/receive-request/composables/fn.d.ts +1 -2
- package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +3 -119
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +14 -643
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +15 -721
- package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-form.d.ts +10 -524
- package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-table.d.ts +2 -102
- package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +0 -4
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +0 -8
- package/dist/views/transfer-template/composables/use-template-item-bulk-editor.d.ts +0 -12
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +0 -24
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +0 -24
- package/dist/{vue-i18n-DDqVG60p.js → vue-i18n-BAu5G_RB.js} +152 -152
- package/dist/{xlsx.util-BzQcPwvM.js → xlsx.util-BgM338n0.js} +2 -2
- package/package.json +5 -5
- package/dist/ApprovalView-_wG6KeZl.js +0 -249
- package/dist/BulkReceiveRequestView-Dmqm65c9.js +0 -2025
- package/dist/ClosingDraftView-DDWU93p0.js +0 -4398
- package/dist/ConnectedBusinessView-Cu2QnRN9.js +0 -533
- package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Dzqh8pM9.js +0 -84
- package/dist/ReceiveRequestView-DDo0Pb0J.js +0 -514
- package/dist/SystemTrailDialog.vue_vue_type_script_setup_true_lang-QMUVuthC.js +0 -211
- package/dist/TransferDetailsV3.vue_vue_type_script_setup_true_lang-DYAzxoHE.js +0 -5991
- package/dist/api/connected-business-mapping.d.ts +0 -25
- package/dist/connected-business-mapping-ywgqqyMr.js +0 -37
- package/dist/feature-B4BoCy_k.js +0 -1548
- package/dist/views/connected-business/ConnectedBusinessMappingPanel.vue.d.ts +0 -25
- package/dist/views/connected-business/ConnectedBusinessView.vue.d.ts +0 -2
- package/dist/views/receive-request/components/CreateTransferChoice.vue.d.ts +0 -27
- package/dist/views/receive-request/components/transfer-details/TransferDetailsV3.vue.d.ts +0 -18
- package/dist/views/receive-request/helper/po-version.d.ts +0 -6
- /package/dist/views/{receive-request/composables/fn.spec.d.ts → closing-draft/components/closing-draft-dialog/ClosingDraftApprovalDialog.spec.d.ts} +0 -0
|
@@ -0,0 +1,1136 @@
|
|
|
1
|
+
var ht = Object.defineProperty;
|
|
2
|
+
var pt = (l, u, _) => u in l ? ht(l, u, { enumerable: !0, configurable: !0, writable: !0, value: _ }) : l[u] = _;
|
|
3
|
+
var ce = (l, u, _) => pt(l, typeof u != "symbol" ? u + "" : u, _);
|
|
4
|
+
import { useCoreStore as Ke } from "@feedmepos/mf-common";
|
|
5
|
+
import { Y as ve, a as ft, u as Ve, j as ot } from "./app-D_Ym25tG.js";
|
|
6
|
+
import { readonly as Ge, ref as de } from "vue";
|
|
7
|
+
import "./inventory-core-dart.default-DD-U6dYG.js";
|
|
8
|
+
var qe = { exports: {} };
|
|
9
|
+
(function(l, u) {
|
|
10
|
+
(function(_, p) {
|
|
11
|
+
p(u);
|
|
12
|
+
})(ve, function(_) {
|
|
13
|
+
var p = { getItemSync: function(i) {
|
|
14
|
+
try {
|
|
15
|
+
return localStorage.getItem(i) || null;
|
|
16
|
+
} catch {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}, getItem: function(i, t) {
|
|
20
|
+
var e = this;
|
|
21
|
+
return new Promise(function(r, n) {
|
|
22
|
+
try {
|
|
23
|
+
var a = e.getItemSync(i);
|
|
24
|
+
t == null || t(null, a), r(a);
|
|
25
|
+
} catch (o) {
|
|
26
|
+
t && t(o, null), n(o);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}, setItem: function(i, t, e) {
|
|
30
|
+
return new Promise(function(r, n) {
|
|
31
|
+
try {
|
|
32
|
+
localStorage.setItem(i, t), e && e(null, t), r(t);
|
|
33
|
+
} catch (a) {
|
|
34
|
+
e && e(a, null), n(a);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
} }, s = function() {
|
|
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
|
+
}, s.apply(this, arguments);
|
|
42
|
+
};
|
|
43
|
+
function O(i, t, e, r) {
|
|
44
|
+
return new (e || (e = Promise))(function(n, a) {
|
|
45
|
+
function o(m) {
|
|
46
|
+
try {
|
|
47
|
+
d(r.next(m));
|
|
48
|
+
} catch (c) {
|
|
49
|
+
a(c);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function v(m) {
|
|
53
|
+
try {
|
|
54
|
+
d(r.throw(m));
|
|
55
|
+
} catch (c) {
|
|
56
|
+
a(c);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function d(m) {
|
|
60
|
+
var c;
|
|
61
|
+
m.done ? n(m.value) : (c = m.value, c instanceof e ? c : new e(function(b) {
|
|
62
|
+
b(c);
|
|
63
|
+
})).then(o, v);
|
|
64
|
+
}
|
|
65
|
+
d((r = r.apply(i, [])).next());
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function K(i, t) {
|
|
69
|
+
var e, r, n, a, o = { label: 0, sent: function() {
|
|
70
|
+
if (1 & n[0]) throw n[1];
|
|
71
|
+
return n[1];
|
|
72
|
+
}, trys: [], ops: [] };
|
|
73
|
+
return a = { next: v(0), throw: v(1), return: v(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() {
|
|
74
|
+
return this;
|
|
75
|
+
}), a;
|
|
76
|
+
function v(d) {
|
|
77
|
+
return function(m) {
|
|
78
|
+
return function(c) {
|
|
79
|
+
if (e) throw new TypeError("Generator is already executing.");
|
|
80
|
+
for (; o; ) try {
|
|
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
|
+
case 0:
|
|
84
|
+
case 1:
|
|
85
|
+
n = c;
|
|
86
|
+
break;
|
|
87
|
+
case 4:
|
|
88
|
+
return o.label++, { value: c[1], done: !1 };
|
|
89
|
+
case 5:
|
|
90
|
+
o.label++, r = c[1], c = [0];
|
|
91
|
+
continue;
|
|
92
|
+
case 7:
|
|
93
|
+
c = o.ops.pop(), o.trys.pop();
|
|
94
|
+
continue;
|
|
95
|
+
default:
|
|
96
|
+
if (n = o.trys, !((n = n.length > 0 && n[n.length - 1]) || c[0] !== 6 && c[0] !== 2)) {
|
|
97
|
+
o = 0;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (c[0] === 3 && (!n || c[1] > n[0] && c[1] < n[3])) {
|
|
101
|
+
o.label = c[1];
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
if (c[0] === 6 && o.label < n[1]) {
|
|
105
|
+
o.label = n[1], n = c;
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
if (n && o.label < n[2]) {
|
|
109
|
+
o.label = n[2], o.ops.push(c);
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
n[2] && o.ops.pop(), o.trys.pop();
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
c = t.call(i, o);
|
|
116
|
+
} catch (b) {
|
|
117
|
+
c = [6, b], r = 0;
|
|
118
|
+
} finally {
|
|
119
|
+
e = n = 0;
|
|
120
|
+
}
|
|
121
|
+
if (5 & c[0]) throw c[1];
|
|
122
|
+
return { value: c[0] ? c[1] : void 0, done: !0 };
|
|
123
|
+
}([d, m]);
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function P(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
|
+
}
|
|
131
|
+
var W = function i(t, e) {
|
|
132
|
+
if (t === e) return !0;
|
|
133
|
+
if (t && e && typeof t == "object" && typeof e == "object") {
|
|
134
|
+
if (t.constructor !== e.constructor) return !1;
|
|
135
|
+
var r, n, a;
|
|
136
|
+
if (Array.isArray(t)) {
|
|
137
|
+
if ((r = t.length) != e.length) return !1;
|
|
138
|
+
for (n = r; n-- != 0; ) if (!i(t[n], e[n])) return !1;
|
|
139
|
+
return !0;
|
|
140
|
+
}
|
|
141
|
+
if (t.constructor === RegExp) return t.source === e.source && t.flags === e.flags;
|
|
142
|
+
if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === e.valueOf();
|
|
143
|
+
if (t.toString !== Object.prototype.toString) return t.toString() === e.toString();
|
|
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
|
+
var o = a[n];
|
|
148
|
+
if (!i(t[o], e[o])) return !1;
|
|
149
|
+
}
|
|
150
|
+
return !0;
|
|
151
|
+
}
|
|
152
|
+
return t != t && e != e;
|
|
153
|
+
};
|
|
154
|
+
function E(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
|
+
return !W(n, a);
|
|
158
|
+
});
|
|
159
|
+
return Object.keys(i || {}).filter(function(r) {
|
|
160
|
+
Object.keys(t || {}).includes(r) || e.push(r);
|
|
161
|
+
}), Object.keys(e).length ? e : null;
|
|
162
|
+
}
|
|
163
|
+
var f, C;
|
|
164
|
+
function w(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
|
+
}
|
|
168
|
+
function A(i) {
|
|
169
|
+
return !!i && typeof i == "object" && i.value !== void 0;
|
|
170
|
+
}
|
|
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
|
+
}));
|
|
176
|
+
}
|
|
177
|
+
function Y(i) {
|
|
178
|
+
return s(s({}, i), { identity: i.identity ? s(s({}, i.identity), { traits: $(i.identity.traits || {}) }) : void 0 });
|
|
179
|
+
}
|
|
180
|
+
(function(i) {
|
|
181
|
+
i.NONE = "NONE", i.DEFAULT_FLAGS = "DEFAULT_FLAGS", i.CACHE = "CACHE", i.SERVER = "SERVER";
|
|
182
|
+
})(f || (f = {}));
|
|
183
|
+
var pe, j = null, ut = "FLAGSMITH_EVENT", le = ut, Be = "https://edge.api.flagsmith.com/api/v1/", Je = "flagsmith_value_", Me = "flagsmith_enabled_", ze = "flagsmith_trait_", ct = function() {
|
|
184
|
+
function i(t) {
|
|
185
|
+
var e = this;
|
|
186
|
+
this._trigger = null, this._triggerLoadingState = null, this.timestamp = null, this.isLoading = !1, this.eventSource = null, this.getFlags = function() {
|
|
187
|
+
var r = e, n = r.api, a = r.evaluationContext;
|
|
188
|
+
e.log("Get Flags"), e.isLoading = !0, e.loadingState.isFetching || e.setLoadingState(s(s({}, e.loadingState), { isFetching: !0 }));
|
|
189
|
+
var o = "".concat(e.getContext().identity), v = function(d) {
|
|
190
|
+
var m, c, b, k;
|
|
191
|
+
if (d && o === "".concat(e.getContext().identity)) {
|
|
192
|
+
var V = d.flags, F = d.traits, U = d.identifier;
|
|
193
|
+
e.isLoading = !1;
|
|
194
|
+
var I = {}, N = {};
|
|
195
|
+
F = F || [], (V = V || []).forEach(function(S) {
|
|
196
|
+
I[S.feature.name.toLowerCase().replace(/ /g, "_")] = { id: S.feature.id, enabled: S.enabled, value: S.feature_state_value };
|
|
197
|
+
}), F.forEach(function(S) {
|
|
198
|
+
N[S.trait_key.toLowerCase().replace(/ /g, "_")] = { transient: S.transient, value: S.trait_value };
|
|
199
|
+
}), e.oldFlags = s({}, e.flags);
|
|
200
|
+
var G = E(e.oldFlags, I), re = E((m = e.evaluationContext.identity) === null || m === void 0 ? void 0 : m.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 = I, e.updateStorage(), e._onChange(e.oldFlags, { isFromServer: !0, flagsChanged: G, traitsChanged: re }, e._loadedState(null, f.SERVER)), e.datadogRum) try {
|
|
202
|
+
if (e.datadogRum.trackTraits) {
|
|
203
|
+
var ie = {};
|
|
204
|
+
Object.keys(((c = e.evaluationContext.identity) === null || c === void 0 ? void 0 : c.traits) || {}).map(function(S) {
|
|
205
|
+
ie[ze + S] = e.getTrait(S);
|
|
206
|
+
});
|
|
207
|
+
var Z = s(s(s({}, e.datadogRum.client.getUser()), { id: e.datadogRum.client.getUser().id || ((b = e.evaluationContext.identity) === null || b === void 0 ? void 0 : b.identifier) }), ie);
|
|
208
|
+
e.log("Setting Datadog user", Z), e.datadogRum.client.setUser(Z);
|
|
209
|
+
}
|
|
210
|
+
} catch (S) {
|
|
211
|
+
console.error(S);
|
|
212
|
+
}
|
|
213
|
+
if (e.dtrum) try {
|
|
214
|
+
var T = { javaDouble: {}, date: {}, shortString: {}, javaLongOrObject: {} };
|
|
215
|
+
Object.keys(e.flags).map(function(S) {
|
|
216
|
+
w(T, Je + S, e.getValue(S, { skipAnalytics: !0 })), w(T, Me + S, e.hasFeature(S, { skipAnalytics: !0 }));
|
|
217
|
+
}), Object.keys(((k = e.evaluationContext.identity) === null || k === void 0 ? void 0 : k.traits) || {}).map(function(S) {
|
|
218
|
+
w(T, ze + S, e.getTrait(S));
|
|
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
|
+
} catch (S) {
|
|
221
|
+
console.error(S);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
};
|
|
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 m = d[0], c = d[1];
|
|
227
|
+
return { trait_key: m, trait_value: c == null ? void 0 : c.value, transient: c == null ? void 0 : c.transient };
|
|
228
|
+
}).filter(function(d) {
|
|
229
|
+
return d.trait_value !== void 0 || (e.log("Warning - attempted to set an undefined trait value for key", d.trait_key), !1);
|
|
230
|
+
}) })) : e.getJSON(n + "identities/?identifier=" + encodeURIComponent(a.identity.identifier) + (a.identity.transient ? "&transient=true" : ""))]).then(function(d) {
|
|
231
|
+
return e.evaluationContext.identity = s(s({}, e.evaluationContext.identity), { traits: {} }), v(d == null ? void 0 : d[0]);
|
|
232
|
+
}).catch(function(d) {
|
|
233
|
+
var m = d.message, c = new Error(m);
|
|
234
|
+
return Promise.reject(c);
|
|
235
|
+
}) : e.getJSON(n + "flags/").then(function(d) {
|
|
236
|
+
return v({ flags: d, traits: void 0 });
|
|
237
|
+
});
|
|
238
|
+
}, this.analyticsFlags = function() {
|
|
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
|
+
if (e.evaluationContext.environment) {
|
|
242
|
+
var a = e.getState();
|
|
243
|
+
e.evaluationEvent || (e.evaluationEvent = {}), e.evaluationEvent[e.evaluationContext.environment.apiKey] = {}, e.setState(s(s({}, a), { evaluationEvent: e.evaluationEvent })), e.updateEventStorage();
|
|
244
|
+
}
|
|
245
|
+
}).catch(function(n) {
|
|
246
|
+
e.log("Exception fetching evaluationEvent", n);
|
|
247
|
+
}) : void 0;
|
|
248
|
+
}, this.datadogRum = null, this.loadingState = { isLoading: !0, isFetching: !0, error: null, source: f.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
|
+
if (n != null && n.json) try {
|
|
252
|
+
return v === null ? (e.log("Tried to parse null flag as JSON: " + r), null) : JSON.parse(v);
|
|
253
|
+
} catch {
|
|
254
|
+
return n.fallback;
|
|
255
|
+
}
|
|
256
|
+
return v;
|
|
257
|
+
}, this.getTrait = function(r) {
|
|
258
|
+
var n, a;
|
|
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
|
+
}, this.getAllTraits = function() {
|
|
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
|
+
var a = n[0], o = n[1];
|
|
264
|
+
return [a, o == null ? void 0 : o.value];
|
|
265
|
+
}));
|
|
266
|
+
}, this.setContext = function(r) {
|
|
267
|
+
var n = Y(r);
|
|
268
|
+
return e.evaluationContext = s(s({}, n), { environment: n.environment || e.evaluationContext.environment }), e.initialised ? e.getFlags() : Promise.resolve();
|
|
269
|
+
}, this.getContext = function() {
|
|
270
|
+
return e.evaluationContext;
|
|
271
|
+
}, this.updateContext = function(r) {
|
|
272
|
+
return e.setContext(s(s({}, e.getContext()), r));
|
|
273
|
+
}, this.setTrait = function(r, n) {
|
|
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([[r, n]]))) }) }));
|
|
276
|
+
}, this.setTraits = function(r) {
|
|
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(r).map(function(a) {
|
|
279
|
+
var o = a[0], v = a[1];
|
|
280
|
+
return [o, A(v) ? v : { value: v }];
|
|
281
|
+
}))) }) }));
|
|
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(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
|
+
}, this.getStorageKey = 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
|
+
var o, v = e;
|
|
291
|
+
v.evaluationContext;
|
|
292
|
+
var d = v.headers, m = { method: n || "GET", body: a, cache: "no-cache", headers: {} };
|
|
293
|
+
e.evaluationContext.environment && (m.headers["X-Environment-Key"] = e.evaluationContext.environment.apiKey), n && n !== "GET" && (m.headers["Content-Type"] = "application/json; charset=utf-8"), d && Object.assign(m.headers, d), C || console.error("Flagsmith: fetch is undefined, please specify a fetch implementation into flagsmith.init to support SSR.");
|
|
294
|
+
var c = "".concat((o = e.evaluationContext.identity) === null || o === void 0 ? void 0 : o.identifier);
|
|
295
|
+
return C(r, m).then(function(b) {
|
|
296
|
+
var k, V, F = "".concat((k = e.evaluationContext.identity) === null || k === void 0 ? void 0 : k.identifier);
|
|
297
|
+
if (c === F) {
|
|
298
|
+
var U = (V = b.headers) === null || V === void 0 ? void 0 : V.get("x-flagsmith-document-updated-at");
|
|
299
|
+
if (U) try {
|
|
300
|
+
var I = parseFloat(U);
|
|
301
|
+
if (isNaN(I)) return Promise.reject("Failed to parse x-flagsmith-document-updated-at");
|
|
302
|
+
e.timestamp = I;
|
|
303
|
+
} catch (N) {
|
|
304
|
+
e.log(N, "Failed to parse x-flagsmith-document-updated-at", U);
|
|
305
|
+
}
|
|
306
|
+
return e.log("Fetch response: " + b.status + " " + (n || "GET") + 0 + r), b.text().then(function(N) {
|
|
307
|
+
var G = N;
|
|
308
|
+
try {
|
|
309
|
+
G = JSON.parse(N);
|
|
310
|
+
} catch {
|
|
311
|
+
}
|
|
312
|
+
return !G && b.status && (G = "API Response: ".concat(b.status)), b.status && b.status >= 200 && b.status < 300 ? G : Promise.reject(new Error(G));
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
e.log("Received response with identity mismatch, ignoring response. Requested: ".concat(c, ", Current: ").concat(F));
|
|
316
|
+
});
|
|
317
|
+
}, this.evaluateFlag = function(r, n) {
|
|
318
|
+
if (e.datadogRum && (e.datadogRum.client.addFeatureFlagEvaluation ? n === "VALUE" ? e.datadogRum.client.addFeatureFlagEvaluation(Je + 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
|
+
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][r] === void 0 && (e.evaluationEvent[e.evaluationContext.environment.apiKey][r] = 0), e.evaluationEvent[e.evaluationContext.environment.apiKey][r] += 1;
|
|
321
|
+
}
|
|
322
|
+
e.updateEventStorage();
|
|
323
|
+
}, this._onChange = function(r, n, a) {
|
|
324
|
+
var o, v;
|
|
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 && (pe = t.eventSource), t.AsyncStorage && (j = t.AsyncStorage);
|
|
327
|
+
}
|
|
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, m, c, b, k, V, F, U, I, N, G, re, ie, Z, T, S, ge, ae, Qe, Q, ye, et, tt, me, nt, be, oe, ee, rt, L = this;
|
|
332
|
+
return K(this, function(D) {
|
|
333
|
+
switch (D.label) {
|
|
334
|
+
case 0:
|
|
335
|
+
a = Y(t.evaluationContext || this.evaluationContext), D.label = 1;
|
|
336
|
+
case 1:
|
|
337
|
+
if (D.trys.push([1, 13, , 14]), o = t.environmentID, v = t.api, d = v === void 0 ? Be : v, m = t.headers, c = t.onChange, b = t.cacheFlags, k = t.datadogRum, V = t.onError, F = t.defaultFlags, U = t.fetch, I = 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, S = t.AsyncStorage, ge = 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 = ge || ae ? { identifier: ge, 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 = m, 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({}, F) || {}, this.datadogRum = k || null, this.initialised = !0, this.ticks = 1e4, this.timer = this.enableLogs ? (/* @__PURE__ */ new Date()).valueOf() : null, this.cacheFlags = j !== void 0 && !!b, le = "FLAGSMITH_EVENT_" + a.environment.apiKey, S && (j = S), ie && typeof window < "u" && this.setupRealtime(T, a.environment.apiKey), Object.keys(this.flags).length && (this.loadingState = s(s({}, this.loadingState), { isLoading: !1, source: f.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
|
+
return function(q, B) {
|
|
344
|
+
var z = B.headers, x = B.method, te = B.body;
|
|
345
|
+
return new Promise(function(X) {
|
|
346
|
+
switch (x) {
|
|
347
|
+
case "GET":
|
|
348
|
+
return R.get(q, { headers: z }).subscribe(function(M) {
|
|
349
|
+
X({ ok: !0, text: function() {
|
|
350
|
+
return Promise.resolve(M);
|
|
351
|
+
} });
|
|
352
|
+
});
|
|
353
|
+
case "POST":
|
|
354
|
+
case "PUT":
|
|
355
|
+
return R.post(q, te, { headers: z }).subscribe(function(M) {
|
|
356
|
+
X({ ok: !0, text: function() {
|
|
357
|
+
return Promise.resolve(M);
|
|
358
|
+
} });
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
};
|
|
363
|
+
}(ye)), j && this.canUseStorage && j.getItem(le).then(function(R) {
|
|
364
|
+
try {
|
|
365
|
+
L.evaluationEvent = JSON.parse(R) || {};
|
|
366
|
+
} catch {
|
|
367
|
+
L.evaluationEvent = {};
|
|
368
|
+
}
|
|
369
|
+
L.analyticsInterval = setInterval(L.analyticsFlags, L.ticks);
|
|
370
|
+
}), this.enableAnalytics && (this.analyticsInterval && clearInterval(this.analyticsInterval), j && this.canUseStorage && j.getItem(le, function(R, q) {
|
|
371
|
+
if (q && L.evaluationContext.environment) {
|
|
372
|
+
var B = JSON.parse(q);
|
|
373
|
+
if (B[L.evaluationContext.environment.apiKey]) {
|
|
374
|
+
var z = L.getState();
|
|
375
|
+
L.log("Retrieved events from cache", q), L.setState(s(s({}, z), { evaluationEvent: B[L.evaluationContext.environment.apiKey] }));
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
})), !b) return [3, 9];
|
|
379
|
+
if (!j || !this.canUseStorage) return [3, 8];
|
|
380
|
+
nt = function(R, q) {
|
|
381
|
+
return O(L, void 0, void 0, function() {
|
|
382
|
+
var B, z, x, te, X, M, Se, it, Ce, xe, we, Ee, Oe, ke, Te, Le, je, Pe, Ae, Fe, Ie, Ne, Re, Ue, at = this;
|
|
383
|
+
return K(this, function(H) {
|
|
384
|
+
switch (H.label) {
|
|
385
|
+
case 0:
|
|
386
|
+
if (!q) return [3, 7];
|
|
387
|
+
B = null, z = null, H.label = 1;
|
|
388
|
+
case 1:
|
|
389
|
+
return H.trys.push([1, 5, , 6]), x = JSON.parse(q), 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) === ((we = this.evaluationContext.environment) === null || we === void 0 ? void 0 : we.apiKey) && (M = !0, this.evaluationContext.identity && ((Oe = (Ee = x.evaluationContext) === null || Ee === void 0 ? void 0 : Ee.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 = E((Le = this.evaluationContext.identity) === null || Le === void 0 ? void 0 : Le.traits, (Pe = (je = x.evaluationContext) === null || je === void 0 ? void 0 : je.identity) === null || Pe === void 0 ? void 0 : Pe.traits), B = E(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({}, (Fe = x.evaluationContext) === null || Fe === void 0 ? void 0 : Fe.identity), { traits: s(s({}, ((Ne = (Ie = x.evaluationContext) === null || Ie === void 0 ? void 0 : Ie.identity) === null || Ne === void 0 ? void 0 : Ne.traits) || {}), ae || {}) }) : void 0 })) })), this.log("Retrieved flags from cache", x))), te ? (Se = !I && (!this.cacheOptions.skipAPI || X), this._onChange(null, { isFromServer: !1, flagsChanged: B, traitsChanged: z }, this._loadedState(null, f.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
|
+
}), [3, 4]) : [3, 2];
|
|
393
|
+
case 2:
|
|
394
|
+
return I ? [3, 4] : [4, this.getFlags()];
|
|
395
|
+
case 3:
|
|
396
|
+
H.sent(), H.label = 4;
|
|
397
|
+
case 4:
|
|
398
|
+
return [3, 6];
|
|
399
|
+
case 5:
|
|
400
|
+
return it = H.sent(), this.log("Exception fetching cached logs", it), [3, 6];
|
|
401
|
+
case 6:
|
|
402
|
+
return [3, 10];
|
|
403
|
+
case 7:
|
|
404
|
+
return I ? [3, 9] : [4, this.getFlags()];
|
|
405
|
+
case 8:
|
|
406
|
+
return H.sent(), [3, 10];
|
|
407
|
+
case 9:
|
|
408
|
+
if (F) this._onChange(null, { isFromServer: !1, flagsChanged: E({}, this.flags), traitsChanged: E({}, (Re = this.evaluationContext.identity) === null || Re === void 0 ? void 0 : Re.traits) }, this._loadedState(null, f.DEFAULT_FLAGS));
|
|
409
|
+
else {
|
|
410
|
+
if (!this.flags) throw new Error(me);
|
|
411
|
+
this._onChange(null, { isFromServer: !1, flagsChanged: E({}, this.flags), traitsChanged: E({}, (Ue = this.evaluationContext.identity) === null || Ue === void 0 ? void 0 : Ue.traits) }, this._loadedState(null, f.DEFAULT_FLAGS));
|
|
412
|
+
}
|
|
413
|
+
H.label = 10;
|
|
414
|
+
case 10:
|
|
415
|
+
return [2];
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
});
|
|
419
|
+
}, D.label = 2;
|
|
420
|
+
case 2:
|
|
421
|
+
return D.trys.push([2, 7, , 8]), j.getItemSync ? (be = j.getItemSync(this.getStorageKey()), [3, 5]) : [3, 3];
|
|
422
|
+
case 3:
|
|
423
|
+
return [4, j.getItem(this.getStorageKey())];
|
|
424
|
+
case 4:
|
|
425
|
+
be = D.sent(), D.label = 5;
|
|
426
|
+
case 5:
|
|
427
|
+
return [4, nt(null, be)];
|
|
428
|
+
case 6:
|
|
429
|
+
case 7:
|
|
430
|
+
return D.sent(), [3, 8];
|
|
431
|
+
case 8:
|
|
432
|
+
return [3, 12];
|
|
433
|
+
case 9:
|
|
434
|
+
return I ? [3, 11] : [4, this.getFlags()];
|
|
435
|
+
case 10:
|
|
436
|
+
return D.sent(), [3, 12];
|
|
437
|
+
case 11:
|
|
438
|
+
if (F) this._onChange(null, { isFromServer: !1, flagsChanged: E({}, F), traitsChanged: E({}, (e = a.identity) === null || e === void 0 ? void 0 : e.traits) }, this._loadedState(null, f.DEFAULT_FLAGS));
|
|
439
|
+
else if (this.flags && (oe = null, Object.keys(this.flags).length === 0 && (oe = me), this._onChange(null, { isFromServer: !1, flagsChanged: E({}, this.flags), traitsChanged: E({}, (r = a.identity) === null || r === void 0 ? void 0 : r.traits) }, this._loadedState(oe, f.DEFAULT_FLAGS)), oe)) throw new Error(oe);
|
|
440
|
+
D.label = 12;
|
|
441
|
+
case 12:
|
|
442
|
+
return [3, 14];
|
|
443
|
+
case 13:
|
|
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
|
+
case 14:
|
|
446
|
+
return [2];
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
});
|
|
450
|
+
}, i.prototype.getAllFlags = function() {
|
|
451
|
+
return this.flags;
|
|
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
|
+
var a = n[0], o = n[1];
|
|
455
|
+
return [a, A(o) ? o : { value: o }];
|
|
456
|
+
}))), this.initialised ? this.getFlags() : Promise.resolve();
|
|
457
|
+
}, i.prototype.getState = function() {
|
|
458
|
+
return { api: this.api, flags: this.flags, ts: this.ts, evaluationContext: this.evaluationContext, evaluationEvent: this.evaluationEvent };
|
|
459
|
+
}, i.prototype.setState = function(t) {
|
|
460
|
+
t && (this.initialised = !0, this.api = t.api || this.api || Be, 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
|
+
return this.evaluationContext.identity = null, this.initialised ? this.getFlags() : Promise.resolve();
|
|
463
|
+
}, i.prototype.startListening = function(t) {
|
|
464
|
+
t === void 0 && (t = 1e3), this.getFlagInterval && clearInterval(this.getFlagInterval), this.getFlagInterval = setInterval(this.getFlags, t);
|
|
465
|
+
}, i.prototype.stopListening = function() {
|
|
466
|
+
this.getFlagInterval && (clearInterval(this.getFlagInterval), this.getFlagInterval = null);
|
|
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
|
+
for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
|
|
471
|
+
this.enableLogs && console.log.apply(this, P(["FLAGSMITH:", (/* @__PURE__ */ new Date()).valueOf() - (this.timer || 0), "ms"], t));
|
|
472
|
+
}, i.prototype.updateStorage = function() {
|
|
473
|
+
if (this.cacheFlags) {
|
|
474
|
+
this.ts = (/* @__PURE__ */ new Date()).valueOf();
|
|
475
|
+
var t = JSON.stringify(this.getState());
|
|
476
|
+
this.log("Setting storage", t), j.setItem(this.getStorageKey(), t);
|
|
477
|
+
}
|
|
478
|
+
}, i.prototype.updateEventStorage = function() {
|
|
479
|
+
if (this.enableAnalytics) {
|
|
480
|
+
var t = JSON.stringify(this.getState().evaluationEvent);
|
|
481
|
+
j.setItem(le, t).catch(function(e) {
|
|
482
|
+
return console.error("Flagsmith: Error setting item in async storage", e);
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
}, i.prototype.setLoadingState = function(t) {
|
|
486
|
+
var e;
|
|
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
|
+
}, i.prototype.setupRealtime = function(t, e) {
|
|
489
|
+
var r = this, n = t + "sse/environments/" + e + "/stream";
|
|
490
|
+
pe ? this.eventSource || (this.log("Creating event source with url " + n), this.eventSource = new pe(n), this.eventSource.addEventListener("environment_updated", function(a) {
|
|
491
|
+
var o;
|
|
492
|
+
try {
|
|
493
|
+
o = JSON.parse(a.data).updated_at;
|
|
494
|
+
} catch (v) {
|
|
495
|
+
r.log("Could not parse sse event", v);
|
|
496
|
+
}
|
|
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
|
+
})) : this.log("Error, EventSource is undefined");
|
|
499
|
+
}, i;
|
|
500
|
+
}();
|
|
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
|
+
}
|
|
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
|
+
if (typeof t != "function" && t !== null) throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
|
513
|
+
function e() {
|
|
514
|
+
this.constructor = i;
|
|
515
|
+
}
|
|
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
|
+
} };
|
|
523
|
+
throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
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
|
+
try {
|
|
529
|
+
for (; (t === void 0 || t-- > 0) && !(r = a.next()).done; ) o.push(r.value);
|
|
530
|
+
} catch (v) {
|
|
531
|
+
n = { error: v };
|
|
532
|
+
} finally {
|
|
533
|
+
try {
|
|
534
|
+
r && !r.done && (e = a.return) && e.call(a);
|
|
535
|
+
} finally {
|
|
536
|
+
if (n) throw n.error;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
return o;
|
|
540
|
+
}, fe = 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
|
+
function t() {
|
|
545
|
+
return i.call(this, `EventSource not available.
|
|
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
|
+
}
|
|
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
|
+
this._onevent_wrapped = function(n) {
|
|
554
|
+
r._onevent(n);
|
|
555
|
+
}, this._start();
|
|
556
|
+
}
|
|
557
|
+
return i.prototype.dispatchEvent = function(t) {
|
|
558
|
+
throw new Error("Method not implemented.");
|
|
559
|
+
}, i.prototype._start = function() {
|
|
560
|
+
var t, e, r = this, n = this.url;
|
|
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
|
+
r._onopen(d);
|
|
563
|
+
}, this._eventSource.onerror = function(d) {
|
|
564
|
+
r._onerror(d);
|
|
565
|
+
}, this._eventSource.onmessage = function(d) {
|
|
566
|
+
r.onmessage(d);
|
|
567
|
+
};
|
|
568
|
+
try {
|
|
569
|
+
for (var a = $e(Object.keys(this._listeners)), o = a.next(); !o.done; o = a.next()) {
|
|
570
|
+
var v = o.value;
|
|
571
|
+
this._eventSource.addEventListener(v, this._onevent_wrapped);
|
|
572
|
+
}
|
|
573
|
+
} catch (d) {
|
|
574
|
+
t = { error: d };
|
|
575
|
+
} finally {
|
|
576
|
+
try {
|
|
577
|
+
o && !o.done && (e = a.return) && e.call(a);
|
|
578
|
+
} finally {
|
|
579
|
+
if (t) throw t.error;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}, i.prototype._onopen = function(t) {
|
|
583
|
+
this.readyState === 0 && (this.readyState = 1, this.onopen(t));
|
|
584
|
+
}, i.prototype._onerror = function(t) {
|
|
585
|
+
var e = this;
|
|
586
|
+
if (this.readyState === 1 && (this.readyState = 0, this.onerror(t)), this._eventSource) {
|
|
587
|
+
this._eventSource.close(), this._eventSource = null;
|
|
588
|
+
var r = Math.round(this.max_retry_time * Math.random());
|
|
589
|
+
this._timer = setTimeout(function() {
|
|
590
|
+
return e._start();
|
|
591
|
+
}, r);
|
|
592
|
+
}
|
|
593
|
+
}, i.prototype._onevent = function(t) {
|
|
594
|
+
var e, r;
|
|
595
|
+
t && t.lastEventId && (this._lastEventId = t.lastEventId);
|
|
596
|
+
var n = this._listeners[t.type];
|
|
597
|
+
if (n != null) try {
|
|
598
|
+
for (var a = $e(fe([], Xe(n), !1)), o = a.next(); !o.done; o = a.next())
|
|
599
|
+
o.value.call(this, t);
|
|
600
|
+
} catch (v) {
|
|
601
|
+
e = { error: v };
|
|
602
|
+
} finally {
|
|
603
|
+
try {
|
|
604
|
+
o && !o.done && (r = a.return) && r.call(a);
|
|
605
|
+
} finally {
|
|
606
|
+
if (e) throw e.error;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
t.type === "message" && this.onmessage(t);
|
|
610
|
+
}, i.prototype.onopen = function(t) {
|
|
611
|
+
}, i.prototype.onerror = function(t) {
|
|
612
|
+
}, i.prototype.onmessage = function(t) {
|
|
613
|
+
}, i.prototype.close = function() {
|
|
614
|
+
this._timer && (clearTimeout(this._timer), this._timer = null), this._eventSource && (this._eventSource.close(), this._eventSource = null), this.readyState = 2;
|
|
615
|
+
}, i.prototype.addEventListener = function(t, e, r) {
|
|
616
|
+
this._listeners[t] == null && (this._listeners[t] = [], this._eventSource != null && this._eventSource.addEventListener(t, this._onevent_wrapped));
|
|
617
|
+
var n = this._listeners[t];
|
|
618
|
+
n.includes(e) || (this._listeners[t] = fe(fe([], Xe(n), !1), [e], !1));
|
|
619
|
+
}, i.prototype.removeEventListener = function(t, e, r) {
|
|
620
|
+
var n = this._listeners[t];
|
|
621
|
+
this._listeners[t] = n.filter(function(a) {
|
|
622
|
+
return a !== e;
|
|
623
|
+
});
|
|
624
|
+
}, i;
|
|
625
|
+
}();
|
|
626
|
+
globalThis.FlagsmithEventSource = typeof EventSource < "u" ? EventSource : null;
|
|
627
|
+
var Ye = function(i, t) {
|
|
628
|
+
return t = t || {}, new Promise(function(e, r) {
|
|
629
|
+
var n = new XMLHttpRequest(), a = [], o = [], v = {}, d = function() {
|
|
630
|
+
return { ok: (n.status / 100 | 0) == 2, statusText: n.statusText, status: n.status, url: n.responseURL, text: function() {
|
|
631
|
+
return Promise.resolve(n.responseText);
|
|
632
|
+
}, json: function() {
|
|
633
|
+
return Promise.resolve(n.responseText).then(JSON.parse);
|
|
634
|
+
}, blob: function() {
|
|
635
|
+
return Promise.resolve(new Blob([n.response]));
|
|
636
|
+
}, clone: d, headers: { keys: function() {
|
|
637
|
+
return a;
|
|
638
|
+
}, entries: function() {
|
|
639
|
+
return o;
|
|
640
|
+
}, get: function(c) {
|
|
641
|
+
return v[c.toLowerCase()];
|
|
642
|
+
}, has: function(c) {
|
|
643
|
+
return c.toLowerCase() in v;
|
|
644
|
+
} } };
|
|
645
|
+
};
|
|
646
|
+
for (var m in n.open(t.method || "get", i, !0), n.onload = function() {
|
|
647
|
+
n.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function(c, b, k) {
|
|
648
|
+
a.push(b = b.toLowerCase()), o.push([b, k]), v[b] = v[b] ? v[b] + "," + k : k;
|
|
649
|
+
}), e(d());
|
|
650
|
+
}, n.onerror = r, n.withCredentials = t.credentials == "include", t.headers) n.setRequestHeader(m, t.headers[m]);
|
|
651
|
+
n.send(t.body || null);
|
|
652
|
+
});
|
|
653
|
+
}, Ze = He({ AsyncStorage: p, fetch: Ye, eventSource: We });
|
|
654
|
+
typeof window < "u" && (window.flagsmith = Ze), _.createFlagsmithInstance = function() {
|
|
655
|
+
return He({ AsyncStorage: p, fetch: Ye, eventSource: We });
|
|
656
|
+
}, _.default = Ze, Object.defineProperty(_, "__esModule", { value: !0 });
|
|
657
|
+
});
|
|
658
|
+
})(qe, qe.exports);
|
|
659
|
+
var gt = qe.exports, yt = {
|
|
660
|
+
NOT_INITIALIZED: "FeatureFlag not initialized. Call init() first."
|
|
661
|
+
}, st = "business", J, mt = (J = class {
|
|
662
|
+
constructor() {
|
|
663
|
+
ce(this, "flagsmithClient", null);
|
|
664
|
+
ce(this, "userContext", null);
|
|
665
|
+
}
|
|
666
|
+
static getInstance() {
|
|
667
|
+
return J.instance || (J.instance = new J()), J.instance;
|
|
668
|
+
}
|
|
669
|
+
ensureInitialized() {
|
|
670
|
+
if (!this.flagsmithClient)
|
|
671
|
+
throw new Error(yt.NOT_INITIALIZED);
|
|
672
|
+
}
|
|
673
|
+
async init(u, _ = []) {
|
|
674
|
+
if (!this.flagsmithClient)
|
|
675
|
+
try {
|
|
676
|
+
this.flagsmithClient = gt.createFlagsmithInstance();
|
|
677
|
+
const p = _.reduce((s, O) => (s[O.feature.name] = O, s), {});
|
|
678
|
+
await this.flagsmithClient.init({
|
|
679
|
+
environmentID: u.apiKey,
|
|
680
|
+
api: (u == null ? void 0 : u.url) ?? "https://feature-flag-proxy.feedme.farm/api/v1/",
|
|
681
|
+
enableAnalytics: (u == null ? void 0 : u.enableAnalytics) ?? !0,
|
|
682
|
+
defaultFlags: p,
|
|
683
|
+
cacheFlags: (u == null ? void 0 : u.cacheFlags) ?? !0
|
|
684
|
+
});
|
|
685
|
+
} catch (p) {
|
|
686
|
+
throw console.error("Failed to initialize FeatureFlag:", p), p;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
async setUser(u) {
|
|
690
|
+
this.ensureInitialized(), this.userContext = { identifier: u }, await this.updateContext();
|
|
691
|
+
}
|
|
692
|
+
async updateContext() {
|
|
693
|
+
try {
|
|
694
|
+
if (!this.userContext) return;
|
|
695
|
+
await this.flagsmithClient.setContext({
|
|
696
|
+
identity: {
|
|
697
|
+
identifier: this.userContext.identifier
|
|
698
|
+
}
|
|
699
|
+
});
|
|
700
|
+
} catch (u) {
|
|
701
|
+
throw console.error("Failed to update user context:", u), u;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
async getFlags() {
|
|
705
|
+
this.ensureInitialized();
|
|
706
|
+
const u = this.flagsmithClient.getAllFlags();
|
|
707
|
+
return Object.entries(u).map(([_, p]) => {
|
|
708
|
+
var s;
|
|
709
|
+
return {
|
|
710
|
+
feature: {
|
|
711
|
+
name: _,
|
|
712
|
+
id: (p == null ? void 0 : p.id) ?? 0
|
|
713
|
+
},
|
|
714
|
+
enabled: p.enabled,
|
|
715
|
+
value: ((s = p.value) == null ? void 0 : s.toString()) ?? null
|
|
716
|
+
};
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
getFlagValue(u, _) {
|
|
720
|
+
this.ensureInitialized();
|
|
721
|
+
const p = this.flagsmithClient.getValue(u);
|
|
722
|
+
if (p == null)
|
|
723
|
+
return null;
|
|
724
|
+
try {
|
|
725
|
+
const s = p.toString();
|
|
726
|
+
return _ ? _(s) : typeof {} == "number" ? isNaN(Number(s)) ? null : Number(s) : typeof {} == "boolean" ? s.toLowerCase() === "true" : s;
|
|
727
|
+
} catch (s) {
|
|
728
|
+
return console.error("Error transforming flag value:", s), null;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
getFlag(u) {
|
|
732
|
+
this.ensureInitialized();
|
|
733
|
+
const _ = this.flagsmithClient.getValue(u);
|
|
734
|
+
if (_ == null) return null;
|
|
735
|
+
const p = this.flagsmithClient.hasFeature(u);
|
|
736
|
+
return {
|
|
737
|
+
feature: {
|
|
738
|
+
name: u,
|
|
739
|
+
id: 0
|
|
740
|
+
},
|
|
741
|
+
enabled: p,
|
|
742
|
+
value: _.toString()
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
async getUserFlagValue(u, _, p = null, s) {
|
|
746
|
+
var K;
|
|
747
|
+
const O = this.userContext;
|
|
748
|
+
try {
|
|
749
|
+
return await this.setUser(u), this.getFlagValue(_, s) ?? p;
|
|
750
|
+
} catch (P) {
|
|
751
|
+
return console.error(`Error getting user flag value for ${_}:`, P), p;
|
|
752
|
+
} finally {
|
|
753
|
+
try {
|
|
754
|
+
await ((K = this.flagsmithClient) == null ? void 0 : K.logout()), this.userContext = null, O && await this.setUser(O.identifier);
|
|
755
|
+
} catch (P) {
|
|
756
|
+
console.error("Error during cleanup:", P);
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
reset() {
|
|
761
|
+
this.flagsmithClient = null, this.userContext = null;
|
|
762
|
+
}
|
|
763
|
+
}, ce(J, "instance"), J), bt = mt.getInstance(), se = de(!1), _e = de([]), ne = de(null);
|
|
764
|
+
function St(l = bt) {
|
|
765
|
+
const u = () => se.value ? !0 : (console.warn("FeatureFlag is not initialized. Using default values."), !1), _ = async (f, C = []) => {
|
|
766
|
+
if (se.value) {
|
|
767
|
+
console.warn("FeatureFlag is already initialized.");
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
try {
|
|
771
|
+
await l.init(f, C), _e.value = await l.getFlags(), se.value = !0, ne.value = null;
|
|
772
|
+
} catch (w) {
|
|
773
|
+
console.error("Failed to initialize feature flags:", w), ne.value = w;
|
|
774
|
+
}
|
|
775
|
+
}, p = async (f) => {
|
|
776
|
+
if (u())
|
|
777
|
+
try {
|
|
778
|
+
await l.setUser(f), _e.value = await l.getFlags(), ne.value = null;
|
|
779
|
+
} catch (C) {
|
|
780
|
+
console.error("Failed to set user:", C), ne.value = C;
|
|
781
|
+
}
|
|
782
|
+
}, s = async (f) => p(`${st}-${f}`), O = (f, C, w = null) => {
|
|
783
|
+
if (!u()) return w;
|
|
784
|
+
try {
|
|
785
|
+
return l.getFlagValue(f, C) ?? w;
|
|
786
|
+
} catch (A) {
|
|
787
|
+
return console.error(`Error getting flag value for ${f}:`, A), w;
|
|
788
|
+
}
|
|
789
|
+
}, K = (f, C) => {
|
|
790
|
+
if (!u()) return C ?? null;
|
|
791
|
+
try {
|
|
792
|
+
return l.getFlag(f) ?? C ?? null;
|
|
793
|
+
} catch (w) {
|
|
794
|
+
return console.error(`Error getting flag for ${f}:`, w), C ?? null;
|
|
795
|
+
}
|
|
796
|
+
}, P = async (f, C, w = null, A) => {
|
|
797
|
+
if (!u()) return w;
|
|
798
|
+
try {
|
|
799
|
+
return await l.getUserFlagValue(f, C, w, A);
|
|
800
|
+
} catch ($) {
|
|
801
|
+
return console.error(`Error getting user flag value for ${C}:`, $), w;
|
|
802
|
+
}
|
|
803
|
+
}, W = async (f, C, w = null, A) => P(`${st}-${f}`, C, w, A), E = () => {
|
|
804
|
+
try {
|
|
805
|
+
l.reset();
|
|
806
|
+
} catch (f) {
|
|
807
|
+
console.error("Error resetting feature flags:", f);
|
|
808
|
+
} finally {
|
|
809
|
+
_e.value = [], se.value = !1, ne.value = null;
|
|
810
|
+
}
|
|
811
|
+
};
|
|
812
|
+
return {
|
|
813
|
+
flags: Ge(_e),
|
|
814
|
+
isInitialized: Ge(se),
|
|
815
|
+
error: Ge(ne),
|
|
816
|
+
init: _,
|
|
817
|
+
setUser: p,
|
|
818
|
+
setBusiness: s,
|
|
819
|
+
getFlagValue: O,
|
|
820
|
+
getFlag: K,
|
|
821
|
+
getUserFlagValue: P,
|
|
822
|
+
getBusinessFlagValue: W,
|
|
823
|
+
reset: E
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
var he = () => St(), g = /* @__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_price_adjustment = "inventory_purchase_order_price_adjustment", 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.inventory_stocksnapshot_cron_beta = "inventory_stocksnapshot_cron_beta", l.inventory_portal_production_item = "inventory_portal_production_item", l))(g || {});
|
|
827
|
+
const Ct = /* @__PURE__ */ new Set([
|
|
828
|
+
// vivo pizza prod
|
|
829
|
+
"business_6687e91fa7240b001ba3f4c2",
|
|
830
|
+
// vivo dev
|
|
831
|
+
"business_669a1d2efc050a001cfbb5a2"
|
|
832
|
+
]), xt = /* @__PURE__ */ new Set([
|
|
833
|
+
// zus dev
|
|
834
|
+
"business_671005de24a7f4001c87e25e",
|
|
835
|
+
// zus prod
|
|
836
|
+
"business_6776a1fe205a52001c516efa"
|
|
837
|
+
]);
|
|
838
|
+
function lt() {
|
|
839
|
+
return {
|
|
840
|
+
isLoaded: !1,
|
|
841
|
+
autoReceiveWarehouse: !1,
|
|
842
|
+
businessSupplierOnly: !1,
|
|
843
|
+
enableBackdatePo: !1,
|
|
844
|
+
enableClosingTemplate: !1,
|
|
845
|
+
enableIngredientGroup: !1,
|
|
846
|
+
enablePoTemplate: !1,
|
|
847
|
+
enableTotalCost: !1,
|
|
848
|
+
enableWastageTemplate: !1,
|
|
849
|
+
manualReceive: !1,
|
|
850
|
+
mustUseDefaultCost: !1,
|
|
851
|
+
mustUsePoTemplate: !1,
|
|
852
|
+
enableXilnexTransferNote: !1,
|
|
853
|
+
enableCustomAttribute: !1,
|
|
854
|
+
usePurchaseOrderV2: !1,
|
|
855
|
+
acceptRequireFulfillment: !1,
|
|
856
|
+
useOperatePurchaseOrderV2: !1,
|
|
857
|
+
inventory_xilnex_opening_migration: !1,
|
|
858
|
+
inventory_synergy_opening_migration: !1,
|
|
859
|
+
inventory_netsuite_inventory_transfer_out: !1,
|
|
860
|
+
inventory_portal_supplier_preparation_time: !1,
|
|
861
|
+
inventory_portal_delivery_order_write: !1,
|
|
862
|
+
inventory_pos_transfer_require_fulfillment: !1,
|
|
863
|
+
inventory_backdate_receive: !1,
|
|
864
|
+
inventory_purchase_order_custom_cost: !1,
|
|
865
|
+
inventory_bulk_import: !1,
|
|
866
|
+
inventory_portal_surcharge: !1,
|
|
867
|
+
inventory_purchase_order_cost_edit: !1,
|
|
868
|
+
inventory_purchase_order_price_adjustment: !1,
|
|
869
|
+
inventory_purchase_order_workflow_allow_to_mark_completed: !1,
|
|
870
|
+
inventory_recipe_v2: !1,
|
|
871
|
+
inventory_print_template: !1,
|
|
872
|
+
inventory_purchase_order_email: !1,
|
|
873
|
+
inventory_bulk_edit_recipes: !1,
|
|
874
|
+
inventory_receive_request_beta: !1,
|
|
875
|
+
inventory_portal_production_item: !1,
|
|
876
|
+
report_portal_po_forecast_days_constraint: null,
|
|
877
|
+
report_portal_po_forecast_days_default: 7
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
const h = de(lt()), wt = () => ({
|
|
881
|
+
get businessDbName() {
|
|
882
|
+
var _;
|
|
883
|
+
return `business_${((_ = Ke().currentBusiness.value) == null ? void 0 : _._id) ?? ""}`;
|
|
884
|
+
},
|
|
885
|
+
get isWarehouse() {
|
|
886
|
+
var u;
|
|
887
|
+
return ((u = Ve()._currentLocation) == null ? void 0 : u.type) === ot.enum.warehouse;
|
|
888
|
+
},
|
|
889
|
+
get restaurantPosVersion() {
|
|
890
|
+
var _;
|
|
891
|
+
const l = Ve();
|
|
892
|
+
return (_ = Ke().restaurants.value.find(
|
|
893
|
+
(p) => {
|
|
894
|
+
var s;
|
|
895
|
+
return p._id === ((s = l._currentLocation) == null ? void 0 : s.doc._id);
|
|
896
|
+
}
|
|
897
|
+
)) == null ? void 0 : _.posVersion;
|
|
898
|
+
},
|
|
899
|
+
get enableTotalCost() {
|
|
900
|
+
return h.value.enableTotalCost;
|
|
901
|
+
},
|
|
902
|
+
get enableBackdatePo() {
|
|
903
|
+
return h.value.enableBackdatePo;
|
|
904
|
+
},
|
|
905
|
+
/** @deprecated TODO: remove */
|
|
906
|
+
get autoReceiveWarehouse() {
|
|
907
|
+
return h.value.autoReceiveWarehouse;
|
|
908
|
+
},
|
|
909
|
+
/** @deprecated TODO: remove */
|
|
910
|
+
get manualReceive() {
|
|
911
|
+
return h.value.manualReceive;
|
|
912
|
+
},
|
|
913
|
+
get isLoaded() {
|
|
914
|
+
return h.value.isLoaded;
|
|
915
|
+
},
|
|
916
|
+
get enablePoTemplate() {
|
|
917
|
+
return h.value.enablePoTemplate;
|
|
918
|
+
},
|
|
919
|
+
get enableClosingTemplate() {
|
|
920
|
+
return h.value.enableClosingTemplate;
|
|
921
|
+
},
|
|
922
|
+
get enableWastageTemplate() {
|
|
923
|
+
return h.value.enableWastageTemplate;
|
|
924
|
+
},
|
|
925
|
+
get enableIngredientGroup() {
|
|
926
|
+
return h.value.enableIngredientGroup;
|
|
927
|
+
},
|
|
928
|
+
get mustUsePoTemplate() {
|
|
929
|
+
return h.value.mustUsePoTemplate;
|
|
930
|
+
},
|
|
931
|
+
get businessSupplierOnly() {
|
|
932
|
+
return h.value.businessSupplierOnly;
|
|
933
|
+
},
|
|
934
|
+
get enableXilnexTransferNote() {
|
|
935
|
+
return h.value.enableXilnexTransferNote;
|
|
936
|
+
},
|
|
937
|
+
get enabledXilnexOpeningMigration() {
|
|
938
|
+
return h.value.inventory_xilnex_opening_migration;
|
|
939
|
+
},
|
|
940
|
+
get enabledSynergyOpeningMigration() {
|
|
941
|
+
return h.value.inventory_synergy_opening_migration;
|
|
942
|
+
},
|
|
943
|
+
get enableCustomAttribute() {
|
|
944
|
+
return h.value.enableCustomAttribute;
|
|
945
|
+
},
|
|
946
|
+
get usePurchaseOrderV2() {
|
|
947
|
+
return h.value.usePurchaseOrderV2;
|
|
948
|
+
},
|
|
949
|
+
get acceptRequireFulfillment() {
|
|
950
|
+
return h.value.acceptRequireFulfillment;
|
|
951
|
+
},
|
|
952
|
+
get useOperatePurchaseOrderV2() {
|
|
953
|
+
return h.value.useOperatePurchaseOrderV2;
|
|
954
|
+
},
|
|
955
|
+
get isNetSuiteInventoryTransferOutEnabled() {
|
|
956
|
+
return h.value.inventory_netsuite_inventory_transfer_out;
|
|
957
|
+
},
|
|
958
|
+
get enableSupplierPreparationTime() {
|
|
959
|
+
return h.value.inventory_portal_supplier_preparation_time;
|
|
960
|
+
},
|
|
961
|
+
get enablePortalDeliveryOrderWrite() {
|
|
962
|
+
return h.value.inventory_portal_delivery_order_write ?? !0;
|
|
963
|
+
},
|
|
964
|
+
get enablePOSTransferRequireFulfillment() {
|
|
965
|
+
return h.value.inventory_pos_transfer_require_fulfillment;
|
|
966
|
+
},
|
|
967
|
+
get enableBackdateReceive() {
|
|
968
|
+
return h.value.inventory_backdate_receive;
|
|
969
|
+
},
|
|
970
|
+
get enablePurchaseOrderReceiveWithCustomCost() {
|
|
971
|
+
return h.value.inventory_purchase_order_custom_cost;
|
|
972
|
+
},
|
|
973
|
+
get enableBulkImport() {
|
|
974
|
+
return h.value.inventory_bulk_import;
|
|
975
|
+
},
|
|
976
|
+
get enableSurcharge() {
|
|
977
|
+
return h.value.inventory_portal_surcharge;
|
|
978
|
+
},
|
|
979
|
+
get enablePurchaseOrderCostEdit() {
|
|
980
|
+
return h.value.inventory_purchase_order_cost_edit;
|
|
981
|
+
},
|
|
982
|
+
get enablePurchaseOrderPriceAdjustment() {
|
|
983
|
+
return h.value.inventory_purchase_order_price_adjustment;
|
|
984
|
+
},
|
|
985
|
+
get poWorkflowAllowToMarkCompleted() {
|
|
986
|
+
return h.value.inventory_purchase_order_workflow_allow_to_mark_completed;
|
|
987
|
+
},
|
|
988
|
+
get enableRecipeV2() {
|
|
989
|
+
return h.value.inventory_recipe_v2;
|
|
990
|
+
},
|
|
991
|
+
get enablePrintTemplate() {
|
|
992
|
+
return h.value.inventory_print_template;
|
|
993
|
+
},
|
|
994
|
+
get enablePurchaseOrderEmail() {
|
|
995
|
+
return h.value.inventory_purchase_order_email;
|
|
996
|
+
},
|
|
997
|
+
get enableBulkEditRecipes() {
|
|
998
|
+
return h.value.inventory_bulk_edit_recipes;
|
|
999
|
+
},
|
|
1000
|
+
get enableReceiveRequestBeta() {
|
|
1001
|
+
return h.value.inventory_receive_request_beta;
|
|
1002
|
+
},
|
|
1003
|
+
get enableProductionItem() {
|
|
1004
|
+
return h.value.inventory_portal_production_item;
|
|
1005
|
+
},
|
|
1006
|
+
get poForecastDaysConstraint() {
|
|
1007
|
+
return h.value.report_portal_po_forecast_days_constraint;
|
|
1008
|
+
},
|
|
1009
|
+
get poForecastDaysDefault() {
|
|
1010
|
+
return h.value.report_portal_po_forecast_days_default;
|
|
1011
|
+
},
|
|
1012
|
+
async init() {
|
|
1013
|
+
const l = Ke(), { init: u, setBusiness: _ } = he(), p = ft(), s = l.namespace.value === "prod";
|
|
1014
|
+
await u({
|
|
1015
|
+
apiKey: s ? "6GhcttsJ9Rj9cTevcdrpin" : "MaGoXrEWuEJNpWgKTqseee"
|
|
1016
|
+
// url: 'https://flag.feedme.farm/api/v1/', // optional -> this is a default URL value
|
|
1017
|
+
// enableAnalytics: true, // optional, defaults to true
|
|
1018
|
+
// cacheFlags: true // optional, defaults to true
|
|
1019
|
+
}), Ve().watchLocation(async (K) => {
|
|
1020
|
+
var A, $, Y;
|
|
1021
|
+
if (!K) {
|
|
1022
|
+
h.value = lt();
|
|
1023
|
+
return;
|
|
1024
|
+
}
|
|
1025
|
+
const P = ((A = l.currentBusiness.value) == null ? void 0 : A._id) ?? "";
|
|
1026
|
+
await _(P);
|
|
1027
|
+
const W = `business_${P}`, E = K.type === ot.enum.warehouse, f = (
|
|
1028
|
+
// if menu v4, must manual receive && must use outlet app
|
|
1029
|
+
(($ = l.currentBusiness.value) == null ? void 0 : $.menuVersion) === "v4" && // more guard for businesses using menu v4, only those listed for manual receive will be included
|
|
1030
|
+
// TODO: may be removed to use menu version only
|
|
1031
|
+
Ct.has(this.businessDbName)
|
|
1032
|
+
), C = xt.has(W) || y(g.inventory_portal_must_use_transfer_template), w = y(g.inventory_purchase_order_backdate) && (this.isWarehouse || p.state.closing !== null);
|
|
1033
|
+
h.value = {
|
|
1034
|
+
isLoaded: !0,
|
|
1035
|
+
enableTotalCost: ((Y = l.currentBusiness.value) == null ? void 0 : Y.menuVersion) === "v4",
|
|
1036
|
+
enableBackdatePo: w,
|
|
1037
|
+
autoReceiveWarehouse: E && !f,
|
|
1038
|
+
manualReceive: f,
|
|
1039
|
+
enablePoTemplate: C,
|
|
1040
|
+
enableClosingTemplate: y(g.inventory_pos_closing_v2),
|
|
1041
|
+
enableWastageTemplate: y(g.inventory_pos_adjust_v2_wastage),
|
|
1042
|
+
enableIngredientGroup: y(g.inventory_ingredient_group),
|
|
1043
|
+
mustUsePoTemplate: C,
|
|
1044
|
+
businessSupplierOnly: C,
|
|
1045
|
+
enableXilnexTransferNote: y(g.inventory_portal_xilnex_transfer_note),
|
|
1046
|
+
enableCustomAttribute: y(g.inventory_portal_custom_attribute),
|
|
1047
|
+
usePurchaseOrderV2: y(g.inventory_portal_purchase_order_v2),
|
|
1048
|
+
acceptRequireFulfillment: y(
|
|
1049
|
+
g.inventory_portal_accept_require_fulfillment
|
|
1050
|
+
),
|
|
1051
|
+
useOperatePurchaseOrderV2: y(g.inventory_portal_po_operate_v2),
|
|
1052
|
+
inventory_xilnex_opening_migration: y(
|
|
1053
|
+
g.inventory_xilnex_opening_migration
|
|
1054
|
+
),
|
|
1055
|
+
inventory_synergy_opening_migration: y(
|
|
1056
|
+
g.inventory_synergy_opening_migration
|
|
1057
|
+
),
|
|
1058
|
+
inventory_netsuite_inventory_transfer_out: y(
|
|
1059
|
+
g.inventory_netsuite_inventory_transfer_out
|
|
1060
|
+
),
|
|
1061
|
+
inventory_portal_supplier_preparation_time: y(
|
|
1062
|
+
g.inventory_portal_supplier_preparation_time
|
|
1063
|
+
),
|
|
1064
|
+
inventory_portal_delivery_order_write: y(
|
|
1065
|
+
g.inventory_portal_delivery_order_write
|
|
1066
|
+
),
|
|
1067
|
+
inventory_pos_transfer_require_fulfillment: y(
|
|
1068
|
+
g.inventory_pos_transfer_require_fulfillment
|
|
1069
|
+
),
|
|
1070
|
+
inventory_backdate_receive: y(g.inventory_backdate_receive),
|
|
1071
|
+
inventory_purchase_order_custom_cost: y(
|
|
1072
|
+
g.inventory_purchase_order_custom_cost
|
|
1073
|
+
),
|
|
1074
|
+
inventory_bulk_import: y(g.inventory_bulk_import),
|
|
1075
|
+
inventory_portal_surcharge: y(g.inventory_portal_surcharge),
|
|
1076
|
+
inventory_purchase_order_cost_edit: y(
|
|
1077
|
+
g.inventory_purchase_order_cost_edit
|
|
1078
|
+
),
|
|
1079
|
+
inventory_purchase_order_price_adjustment: y(
|
|
1080
|
+
g.inventory_purchase_order_price_adjustment
|
|
1081
|
+
),
|
|
1082
|
+
inventory_purchase_order_workflow_allow_to_mark_completed: y(
|
|
1083
|
+
g.inventory_purchase_order_workflow_allow_to_mark_completed
|
|
1084
|
+
),
|
|
1085
|
+
inventory_recipe_v2: y(g.inventory_recipe_v2),
|
|
1086
|
+
inventory_print_template: y(g.inventory_print_template),
|
|
1087
|
+
inventory_purchase_order_email: y(g.inventory_purchase_order_email),
|
|
1088
|
+
inventory_bulk_edit_recipes: y(g.inventory_bulk_edit_recipes),
|
|
1089
|
+
inventory_receive_request_beta: y("inventory_receive_request_beta"),
|
|
1090
|
+
inventory_portal_production_item: y(g.inventory_portal_production_item),
|
|
1091
|
+
report_portal_po_forecast_days_constraint: Et(
|
|
1092
|
+
"report_portal_po_forecast_days_constraint"
|
|
1093
|
+
),
|
|
1094
|
+
report_portal_po_forecast_days_default: Ot(
|
|
1095
|
+
"report_portal_po_forecast_days_default",
|
|
1096
|
+
7
|
|
1097
|
+
)
|
|
1098
|
+
};
|
|
1099
|
+
}, "feature");
|
|
1100
|
+
},
|
|
1101
|
+
async awaitFeatureLoaded(l) {
|
|
1102
|
+
return new Promise((u) => {
|
|
1103
|
+
const _ = () => {
|
|
1104
|
+
h.value.isLoaded ? u(l()) : setTimeout(_, 100);
|
|
1105
|
+
};
|
|
1106
|
+
_();
|
|
1107
|
+
});
|
|
1108
|
+
}
|
|
1109
|
+
});
|
|
1110
|
+
function y(l, u) {
|
|
1111
|
+
u = u === void 0 ? null : u;
|
|
1112
|
+
const { getFlagValue: _ } = he();
|
|
1113
|
+
return _(l, (p) => p === "true") ?? u;
|
|
1114
|
+
}
|
|
1115
|
+
function Et(l) {
|
|
1116
|
+
const { getFlagValue: u } = he();
|
|
1117
|
+
return u(l, (p) => p.trim() ? p.trim() : null) ?? null;
|
|
1118
|
+
}
|
|
1119
|
+
function Ot(l, u) {
|
|
1120
|
+
const { getFlagValue: _ } = he();
|
|
1121
|
+
return _(l, (s) => {
|
|
1122
|
+
const O = parseInt(s, 10);
|
|
1123
|
+
return isNaN(O) ? null : O;
|
|
1124
|
+
}) ?? u;
|
|
1125
|
+
}
|
|
1126
|
+
const At = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1127
|
+
__proto__: null,
|
|
1128
|
+
InventoryFeatureFlags: g,
|
|
1129
|
+
useFeatureStore: wt
|
|
1130
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1131
|
+
export {
|
|
1132
|
+
g as I,
|
|
1133
|
+
he as a,
|
|
1134
|
+
At as f,
|
|
1135
|
+
wt as u
|
|
1136
|
+
};
|