@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
package/dist/feature-B4BoCy_k.js
DELETED
|
@@ -1,1548 +0,0 @@
|
|
|
1
|
-
var jt = Object.defineProperty;
|
|
2
|
-
var Ft = (e, n, o) => n in e ? jt(e, n, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[n] = o;
|
|
3
|
-
var he = (e, n, o) => Ft(e, typeof n != "symbol" ? n + "" : n, o);
|
|
4
|
-
import { useCoreStore as Ve } from "@feedmepos/mf-common";
|
|
5
|
-
import { Y as ge, a as Dt, u as $e, j as bt } from "./app-37NZKFUI.js";
|
|
6
|
-
import { readonly as Xe, ref as we } from "vue";
|
|
7
|
-
import "./inventory-core-dart.default-NpD15h63.js";
|
|
8
|
-
var We = { exports: {} };
|
|
9
|
-
(function(e, n) {
|
|
10
|
-
(function(o, s) {
|
|
11
|
-
s(n);
|
|
12
|
-
})(ge, function(o) {
|
|
13
|
-
var s = { getItemSync: function(u) {
|
|
14
|
-
try {
|
|
15
|
-
return localStorage.getItem(u) || null;
|
|
16
|
-
} catch {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
}, getItem: function(u, r) {
|
|
20
|
-
var t = this;
|
|
21
|
-
return new Promise(function(a, i) {
|
|
22
|
-
try {
|
|
23
|
-
var c = t.getItemSync(u);
|
|
24
|
-
r == null || r(null, c), a(c);
|
|
25
|
-
} catch (v) {
|
|
26
|
-
r && r(v, null), i(v);
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}, setItem: function(u, r, t) {
|
|
30
|
-
return new Promise(function(a, i) {
|
|
31
|
-
try {
|
|
32
|
-
localStorage.setItem(u, r), t && t(null, r), a(r);
|
|
33
|
-
} catch (c) {
|
|
34
|
-
t && t(c, null), i(c);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
} }, l = function() {
|
|
38
|
-
return l = Object.assign || function(u) {
|
|
39
|
-
for (var r, t = 1, a = arguments.length; t < a; t++) for (var i in r = arguments[t]) Object.prototype.hasOwnProperty.call(r, i) && (u[i] = r[i]);
|
|
40
|
-
return u;
|
|
41
|
-
}, l.apply(this, arguments);
|
|
42
|
-
};
|
|
43
|
-
function f(u, r, t, a) {
|
|
44
|
-
return new (t || (t = Promise))(function(i, c) {
|
|
45
|
-
function v(C) {
|
|
46
|
-
try {
|
|
47
|
-
y(a.next(C));
|
|
48
|
-
} catch (p) {
|
|
49
|
-
c(p);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function h(C) {
|
|
53
|
-
try {
|
|
54
|
-
y(a.throw(C));
|
|
55
|
-
} catch (p) {
|
|
56
|
-
c(p);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function y(C) {
|
|
60
|
-
var p;
|
|
61
|
-
C.done ? i(C.value) : (p = C.value, p instanceof t ? p : new t(function(x) {
|
|
62
|
-
x(p);
|
|
63
|
-
})).then(v, h);
|
|
64
|
-
}
|
|
65
|
-
y((a = a.apply(u, [])).next());
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
function _(u, r) {
|
|
69
|
-
var t, a, i, c, v = { label: 0, sent: function() {
|
|
70
|
-
if (1 & i[0]) throw i[1];
|
|
71
|
-
return i[1];
|
|
72
|
-
}, trys: [], ops: [] };
|
|
73
|
-
return c = { next: h(0), throw: h(1), return: h(2) }, typeof Symbol == "function" && (c[Symbol.iterator] = function() {
|
|
74
|
-
return this;
|
|
75
|
-
}), c;
|
|
76
|
-
function h(y) {
|
|
77
|
-
return function(C) {
|
|
78
|
-
return function(p) {
|
|
79
|
-
if (t) throw new TypeError("Generator is already executing.");
|
|
80
|
-
for (; v; ) try {
|
|
81
|
-
if (t = 1, a && (i = 2 & p[0] ? a.return : p[0] ? a.throw || ((i = a.return) && i.call(a), 0) : a.next) && !(i = i.call(a, p[1])).done) return i;
|
|
82
|
-
switch (a = 0, i && (p = [2 & p[0], i.value]), p[0]) {
|
|
83
|
-
case 0:
|
|
84
|
-
case 1:
|
|
85
|
-
i = p;
|
|
86
|
-
break;
|
|
87
|
-
case 4:
|
|
88
|
-
return v.label++, { value: p[1], done: !1 };
|
|
89
|
-
case 5:
|
|
90
|
-
v.label++, a = p[1], p = [0];
|
|
91
|
-
continue;
|
|
92
|
-
case 7:
|
|
93
|
-
p = v.ops.pop(), v.trys.pop();
|
|
94
|
-
continue;
|
|
95
|
-
default:
|
|
96
|
-
if (i = v.trys, !((i = i.length > 0 && i[i.length - 1]) || p[0] !== 6 && p[0] !== 2)) {
|
|
97
|
-
v = 0;
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
if (p[0] === 3 && (!i || p[1] > i[0] && p[1] < i[3])) {
|
|
101
|
-
v.label = p[1];
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
if (p[0] === 6 && v.label < i[1]) {
|
|
105
|
-
v.label = i[1], i = p;
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
if (i && v.label < i[2]) {
|
|
109
|
-
v.label = i[2], v.ops.push(p);
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
i[2] && v.ops.pop(), v.trys.pop();
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
p = r.call(u, v);
|
|
116
|
-
} catch (x) {
|
|
117
|
-
p = [6, x], a = 0;
|
|
118
|
-
} finally {
|
|
119
|
-
t = i = 0;
|
|
120
|
-
}
|
|
121
|
-
if (5 & p[0]) throw p[1];
|
|
122
|
-
return { value: p[0] ? p[1] : void 0, done: !0 };
|
|
123
|
-
}([y, C]);
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
function S(u, r, t) {
|
|
128
|
-
for (var a, i = 0, c = r.length; i < c; i++) !a && i in r || (a || (a = Array.prototype.slice.call(r, 0, i)), a[i] = r[i]);
|
|
129
|
-
return u.concat(a || Array.prototype.slice.call(r));
|
|
130
|
-
}
|
|
131
|
-
var A = function u(r, t) {
|
|
132
|
-
if (r === t) return !0;
|
|
133
|
-
if (r && t && typeof r == "object" && typeof t == "object") {
|
|
134
|
-
if (r.constructor !== t.constructor) return !1;
|
|
135
|
-
var a, i, c;
|
|
136
|
-
if (Array.isArray(r)) {
|
|
137
|
-
if ((a = r.length) != t.length) return !1;
|
|
138
|
-
for (i = a; i-- != 0; ) if (!u(r[i], t[i])) return !1;
|
|
139
|
-
return !0;
|
|
140
|
-
}
|
|
141
|
-
if (r.constructor === RegExp) return r.source === t.source && r.flags === t.flags;
|
|
142
|
-
if (r.valueOf !== Object.prototype.valueOf) return r.valueOf() === t.valueOf();
|
|
143
|
-
if (r.toString !== Object.prototype.toString) return r.toString() === t.toString();
|
|
144
|
-
if ((a = (c = Object.keys(r)).length) !== Object.keys(t).length) return !1;
|
|
145
|
-
for (i = a; i-- != 0; ) if (!Object.prototype.hasOwnProperty.call(t, c[i])) return !1;
|
|
146
|
-
for (i = a; i-- != 0; ) {
|
|
147
|
-
var v = c[i];
|
|
148
|
-
if (!u(r[v], t[v])) return !1;
|
|
149
|
-
}
|
|
150
|
-
return !0;
|
|
151
|
-
}
|
|
152
|
-
return r != r && t != t;
|
|
153
|
-
};
|
|
154
|
-
function g(u, r) {
|
|
155
|
-
var t = Object.keys(r || {}).filter(function(a) {
|
|
156
|
-
var i = u == null ? void 0 : u[a], c = r == null ? void 0 : r[a];
|
|
157
|
-
return !A(i, c);
|
|
158
|
-
});
|
|
159
|
-
return Object.keys(u || {}).filter(function(a) {
|
|
160
|
-
Object.keys(r || {}).includes(a) || t.push(a);
|
|
161
|
-
}), Object.keys(t).length ? t : null;
|
|
162
|
-
}
|
|
163
|
-
var d, w;
|
|
164
|
-
function P(u, r, t) {
|
|
165
|
-
var a = "shortString", i = !0;
|
|
166
|
-
typeof t == "number" && (a = "javaDouble", i = !1), u[a] = u[a] || {}, u[a][r] = i ? t + "" : t;
|
|
167
|
-
}
|
|
168
|
-
function b(u) {
|
|
169
|
-
return !!u && typeof u == "object" && u.value !== void 0;
|
|
170
|
-
}
|
|
171
|
-
function J(u) {
|
|
172
|
-
return Object.fromEntries(Object.entries(u).map(function(r) {
|
|
173
|
-
var t = r[0], a = r[1];
|
|
174
|
-
return [t, b(a) ? a : { value: a }];
|
|
175
|
-
}));
|
|
176
|
-
}
|
|
177
|
-
function te(u) {
|
|
178
|
-
return l(l({}, u), { identity: u.identity ? l(l({}, u.identity), { traits: J(u.identity.traits || {}) }) : void 0 });
|
|
179
|
-
}
|
|
180
|
-
(function(u) {
|
|
181
|
-
u.NONE = "NONE", u.DEFAULT_FLAGS = "DEFAULT_FLAGS", u.CACHE = "CACHE", u.SERVER = "SERVER";
|
|
182
|
-
})(d || (d = {}));
|
|
183
|
-
var Oe, F = null, Pt = "FLAGSMITH_EVENT", pe = Pt, at = "https://edge.api.flagsmith.com/api/v1/", ot = "flagsmith_value_", st = "flagsmith_enabled_", lt = "flagsmith_trait_", Lt = function() {
|
|
184
|
-
function u(r) {
|
|
185
|
-
var t = this;
|
|
186
|
-
this._trigger = null, this._triggerLoadingState = null, this.timestamp = null, this.isLoading = !1, this.eventSource = null, this.getFlags = function() {
|
|
187
|
-
var a = t, i = a.api, c = a.evaluationContext;
|
|
188
|
-
t.log("Get Flags"), t.isLoading = !0, t.loadingState.isFetching || t.setLoadingState(l(l({}, t.loadingState), { isFetching: !0 }));
|
|
189
|
-
var v = "".concat(t.getContext().identity), h = function(y) {
|
|
190
|
-
var C, p, x, I;
|
|
191
|
-
if (y && v === "".concat(t.getContext().identity)) {
|
|
192
|
-
var B = y.flags, k = y.traits, M = y.identifier;
|
|
193
|
-
t.isLoading = !1;
|
|
194
|
-
var U = {}, K = {};
|
|
195
|
-
k = k || [], (B = B || []).forEach(function(T) {
|
|
196
|
-
U[T.feature.name.toLowerCase().replace(/ /g, "_")] = { id: T.feature.id, enabled: T.enabled, value: T.feature_state_value };
|
|
197
|
-
}), k.forEach(function(T) {
|
|
198
|
-
K[T.trait_key.toLowerCase().replace(/ /g, "_")] = { transient: T.transient, value: T.trait_value };
|
|
199
|
-
}), t.oldFlags = l({}, t.flags);
|
|
200
|
-
var H = g(t.oldFlags, U), le = g((C = t.evaluationContext.identity) === null || C === void 0 ? void 0 : C.traits, K);
|
|
201
|
-
if ((M || Object.keys(K).length) && (t.evaluationContext.identity = l(l({}, t.evaluationContext.identity), { traits: K }), M && (t.evaluationContext.identity.identifier = M)), t.flags = U, t.updateStorage(), t._onChange(t.oldFlags, { isFromServer: !0, flagsChanged: H, traitsChanged: le }, t._loadedState(null, d.SERVER)), t.datadogRum) try {
|
|
202
|
-
if (t.datadogRum.trackTraits) {
|
|
203
|
-
var ue = {};
|
|
204
|
-
Object.keys(((p = t.evaluationContext.identity) === null || p === void 0 ? void 0 : p.traits) || {}).map(function(T) {
|
|
205
|
-
ue[lt + T] = t.getTrait(T);
|
|
206
|
-
});
|
|
207
|
-
var ne = l(l(l({}, t.datadogRum.client.getUser()), { id: t.datadogRum.client.getUser().id || ((x = t.evaluationContext.identity) === null || x === void 0 ? void 0 : x.identifier) }), ue);
|
|
208
|
-
t.log("Setting Datadog user", ne), t.datadogRum.client.setUser(ne);
|
|
209
|
-
}
|
|
210
|
-
} catch (T) {
|
|
211
|
-
console.error(T);
|
|
212
|
-
}
|
|
213
|
-
if (t.dtrum) try {
|
|
214
|
-
var R = { javaDouble: {}, date: {}, shortString: {}, javaLongOrObject: {} };
|
|
215
|
-
Object.keys(t.flags).map(function(T) {
|
|
216
|
-
P(R, ot + T, t.getValue(T, { skipAnalytics: !0 })), P(R, st + T, t.hasFeature(T, { skipAnalytics: !0 }));
|
|
217
|
-
}), Object.keys(((I = t.evaluationContext.identity) === null || I === void 0 ? void 0 : I.traits) || {}).map(function(T) {
|
|
218
|
-
P(R, lt + T, t.getTrait(T));
|
|
219
|
-
}), t.log("Sending javaLongOrObject traits to dynatrace", R.javaLongOrObject), t.log("Sending date traits to dynatrace", R.date), t.log("Sending shortString traits to dynatrace", R.shortString), t.log("Sending javaDouble to dynatrace", R.javaDouble), t.dtrum.sendSessionProperties(R.javaLongOrObject, R.date, R.shortString, R.javaDouble);
|
|
220
|
-
} catch (T) {
|
|
221
|
-
console.error(T);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
return c.identity ? Promise.all([c.identity.traits && Object.keys(c.identity.traits).length || !c.identity.identifier ? t.getJSON(i + "identities/", "POST", JSON.stringify({ identifier: c.identity.identifier, transient: c.identity.transient, traits: Object.entries(c.identity.traits).map(function(y) {
|
|
226
|
-
var C = y[0], p = y[1];
|
|
227
|
-
return { trait_key: C, trait_value: p == null ? void 0 : p.value, transient: p == null ? void 0 : p.transient };
|
|
228
|
-
}).filter(function(y) {
|
|
229
|
-
return y.trait_value !== void 0 || (t.log("Warning - attempted to set an undefined trait value for key", y.trait_key), !1);
|
|
230
|
-
}) })) : t.getJSON(i + "identities/?identifier=" + encodeURIComponent(c.identity.identifier) + (c.identity.transient ? "&transient=true" : ""))]).then(function(y) {
|
|
231
|
-
return t.evaluationContext.identity = l(l({}, t.evaluationContext.identity), { traits: {} }), h(y == null ? void 0 : y[0]);
|
|
232
|
-
}).catch(function(y) {
|
|
233
|
-
var C = y.message, p = new Error(C);
|
|
234
|
-
return Promise.reject(p);
|
|
235
|
-
}) : t.getJSON(i + "flags/").then(function(y) {
|
|
236
|
-
return h({ flags: y, traits: void 0 });
|
|
237
|
-
});
|
|
238
|
-
}, this.analyticsFlags = function() {
|
|
239
|
-
var a = t.api;
|
|
240
|
-
if (t.evaluationEvent && t.evaluationContext.environment && t.evaluationEvent[t.evaluationContext.environment.apiKey]) return t.evaluationEvent && Object.getOwnPropertyNames(t.evaluationEvent).length !== 0 && Object.getOwnPropertyNames(t.evaluationEvent[t.evaluationContext.environment.apiKey]).length !== 0 ? t.getJSON(a + "analytics/flags/", "POST", JSON.stringify(t.evaluationEvent[t.evaluationContext.environment.apiKey])).then(function(i) {
|
|
241
|
-
if (t.evaluationContext.environment) {
|
|
242
|
-
var c = t.getState();
|
|
243
|
-
t.evaluationEvent || (t.evaluationEvent = {}), t.evaluationEvent[t.evaluationContext.environment.apiKey] = {}, t.setState(l(l({}, c), { evaluationEvent: t.evaluationEvent })), t.updateEventStorage();
|
|
244
|
-
}
|
|
245
|
-
}).catch(function(i) {
|
|
246
|
-
t.log("Exception fetching evaluationEvent", i);
|
|
247
|
-
}) : void 0;
|
|
248
|
-
}, this.datadogRum = null, this.loadingState = { isLoading: !0, isFetching: !0, error: null, source: d.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(a, i, c) {
|
|
249
|
-
var v = t.flags && t.flags[a.toLowerCase().replace(/ /g, "_")], h = null;
|
|
250
|
-
if (v && (h = v.value), i != null && i.skipAnalytics || c || t.evaluateFlag(a, "VALUE"), h === null && (i == null ? void 0 : i.fallback) !== void 0) return i.fallback;
|
|
251
|
-
if (i != null && i.json) try {
|
|
252
|
-
return h === null ? (t.log("Tried to parse null flag as JSON: " + a), null) : JSON.parse(h);
|
|
253
|
-
} catch {
|
|
254
|
-
return i.fallback;
|
|
255
|
-
}
|
|
256
|
-
return h;
|
|
257
|
-
}, this.getTrait = function(a) {
|
|
258
|
-
var i, c;
|
|
259
|
-
return ((i = t.evaluationContext.identity) === null || i === void 0 ? void 0 : i.traits) && ((c = t.evaluationContext.identity.traits[a.toLowerCase().replace(/ /g, "_")]) === null || c === void 0 ? void 0 : c.value);
|
|
260
|
-
}, this.getAllTraits = function() {
|
|
261
|
-
var a;
|
|
262
|
-
return Object.fromEntries(Object.entries(((a = t.evaluationContext.identity) === null || a === void 0 ? void 0 : a.traits) || {}).map(function(i) {
|
|
263
|
-
var c = i[0], v = i[1];
|
|
264
|
-
return [c, v == null ? void 0 : v.value];
|
|
265
|
-
}));
|
|
266
|
-
}, this.setContext = function(a) {
|
|
267
|
-
var i = te(a);
|
|
268
|
-
return t.evaluationContext = l(l({}, i), { environment: i.environment || t.evaluationContext.environment }), t.initialised ? t.getFlags() : Promise.resolve();
|
|
269
|
-
}, this.getContext = function() {
|
|
270
|
-
return t.evaluationContext;
|
|
271
|
-
}, this.updateContext = function(a) {
|
|
272
|
-
return t.setContext(l(l({}, t.getContext()), a));
|
|
273
|
-
}, this.setTrait = function(a, i) {
|
|
274
|
-
var c;
|
|
275
|
-
if (t.api) return t.setContext(l(l({}, t.evaluationContext), { identity: l(l({}, t.evaluationContext.identity), { traits: l(l({}, (c = t.evaluationContext.identity) === null || c === void 0 ? void 0 : c.traits), J(Object.fromEntries([[a, i]]))) }) }));
|
|
276
|
-
}, this.setTraits = function(a) {
|
|
277
|
-
var i;
|
|
278
|
-
if (t.api) return t.setContext(l(l({}, t.evaluationContext), { identity: l(l({}, t.evaluationContext.identity), { traits: l(l({}, (i = t.evaluationContext.identity) === null || i === void 0 ? void 0 : i.traits), Object.fromEntries(Object.entries(a).map(function(c) {
|
|
279
|
-
var v = c[0], h = c[1];
|
|
280
|
-
return [v, b(h) ? h : { value: h }];
|
|
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(a, i) {
|
|
284
|
-
var c = typeof i == "object", v = t.flags && t.flags[a.toLowerCase().replace(/ /g, "_")], h = !1;
|
|
285
|
-
return !v && c && i.fallback !== void 0 ? h = i == null ? void 0 : i.fallback : v && v.enabled && (h = !0), (c && !i.skipAnalytics || !i) && t.evaluateFlag(a, "ENABLED"), h;
|
|
286
|
-
}, this.getStorageKey = function() {
|
|
287
|
-
var a, i;
|
|
288
|
-
return ((a = t.cacheOptions) === null || a === void 0 ? void 0 : a.storageKey) || "FLAGSMITH_DB_" + ((i = t.evaluationContext.environment) === null || i === void 0 ? void 0 : i.apiKey);
|
|
289
|
-
}, this.getJSON = function(a, i, c) {
|
|
290
|
-
var v, h = t;
|
|
291
|
-
h.evaluationContext;
|
|
292
|
-
var y = h.headers, C = { method: i || "GET", body: c, cache: "no-cache", headers: {} };
|
|
293
|
-
t.evaluationContext.environment && (C.headers["X-Environment-Key"] = t.evaluationContext.environment.apiKey), i && i !== "GET" && (C.headers["Content-Type"] = "application/json; charset=utf-8"), y && Object.assign(C.headers, y), w || console.error("Flagsmith: fetch is undefined, please specify a fetch implementation into flagsmith.init to support SSR.");
|
|
294
|
-
var p = "".concat((v = t.evaluationContext.identity) === null || v === void 0 ? void 0 : v.identifier);
|
|
295
|
-
return w(a, C).then(function(x) {
|
|
296
|
-
var I, B, k = "".concat((I = t.evaluationContext.identity) === null || I === void 0 ? void 0 : I.identifier);
|
|
297
|
-
if (p === k) {
|
|
298
|
-
var M = (B = x.headers) === null || B === void 0 ? void 0 : B.get("x-flagsmith-document-updated-at");
|
|
299
|
-
if (M) try {
|
|
300
|
-
var U = parseFloat(M);
|
|
301
|
-
if (isNaN(U)) return Promise.reject("Failed to parse x-flagsmith-document-updated-at");
|
|
302
|
-
t.timestamp = U;
|
|
303
|
-
} catch (K) {
|
|
304
|
-
t.log(K, "Failed to parse x-flagsmith-document-updated-at", M);
|
|
305
|
-
}
|
|
306
|
-
return t.log("Fetch response: " + x.status + " " + (i || "GET") + 0 + a), x.text().then(function(K) {
|
|
307
|
-
var H = K;
|
|
308
|
-
try {
|
|
309
|
-
H = JSON.parse(K);
|
|
310
|
-
} catch {
|
|
311
|
-
}
|
|
312
|
-
return !H && x.status && (H = "API Response: ".concat(x.status)), x.status && x.status >= 200 && x.status < 300 ? H : Promise.reject(new Error(H));
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
t.log("Received response with identity mismatch, ignoring response. Requested: ".concat(p, ", Current: ").concat(k));
|
|
316
|
-
});
|
|
317
|
-
}, this.evaluateFlag = function(a, i) {
|
|
318
|
-
if (t.datadogRum && (t.datadogRum.client.addFeatureFlagEvaluation ? i === "VALUE" ? t.datadogRum.client.addFeatureFlagEvaluation(ot + a, t.getValue(a, {}, !0)) : t.datadogRum.client.addFeatureFlagEvaluation(st + a, t.hasFeature(a, !0)) : console.error("Flagsmith: Your datadog RUM client does not support the function addFeatureFlagEvaluation, please update it.")), t.enableAnalytics) {
|
|
319
|
-
if (!t.evaluationEvent || !t.evaluationContext.environment) return;
|
|
320
|
-
t.evaluationEvent[t.evaluationContext.environment.apiKey] || (t.evaluationEvent[t.evaluationContext.environment.apiKey] = {}), t.evaluationEvent[t.evaluationContext.environment.apiKey][a] === void 0 && (t.evaluationEvent[t.evaluationContext.environment.apiKey][a] = 0), t.evaluationEvent[t.evaluationContext.environment.apiKey][a] += 1;
|
|
321
|
-
}
|
|
322
|
-
t.updateEventStorage();
|
|
323
|
-
}, this._onChange = function(a, i, c) {
|
|
324
|
-
var v, h;
|
|
325
|
-
t.setLoadingState(c), (v = t.onChange) === null || v === void 0 || v.call(t, a, i, t.loadingState), (h = t._trigger) === null || h === void 0 || h.call(t);
|
|
326
|
-
}, w = r.fetch ? r.fetch : typeof fetch < "u" ? fetch : ge === null || ge === void 0 ? void 0 : ge.fetch, this.canUseStorage = typeof window < "u" || !!r.browserlessStorage, this.log("Constructing flagsmith instance " + r), r.eventSource && (Oe = r.eventSource), r.AsyncStorage && (F = r.AsyncStorage);
|
|
327
|
-
}
|
|
328
|
-
return u.prototype.init = function(r) {
|
|
329
|
-
var t, a, i;
|
|
330
|
-
return f(this, void 0, void 0, function() {
|
|
331
|
-
var c, v, h, y, C, p, x, I, B, k, M, U, K, H, le, ue, ne, R, T, Ce, ce, dt, re, Ae, ht, gt, xe, yt, Te, ve, ie, mt, j = this;
|
|
332
|
-
return _(this, function(G) {
|
|
333
|
-
switch (G.label) {
|
|
334
|
-
case 0:
|
|
335
|
-
c = te(r.evaluationContext || this.evaluationContext), G.label = 1;
|
|
336
|
-
case 1:
|
|
337
|
-
if (G.trys.push([1, 13, , 14]), v = r.environmentID, h = r.api, y = h === void 0 ? at : h, C = r.headers, p = r.onChange, x = r.cacheFlags, I = r.datadogRum, B = r.onError, k = r.defaultFlags, M = r.fetch, U = r.preventFetch, K = r.enableLogs, H = r.enableDynatrace, le = r.enableAnalytics, ue = r.realtime, ne = r.eventSourceUrl, R = ne === void 0 ? "https://realtime.flagsmith.com/" : ne, T = r.AsyncStorage, Ce = r.identity, ce = r.traits, dt = r.state, re = r.cacheOptions, Ae = r.angularHttpClient, ht = r._trigger, gt = r._triggerLoadingState, c.environment = v ? { apiKey: v } : c.environment, !c.environment || !c.environment.apiKey) throw new Error("Please provide `evaluationContext.environment` with non-empty `apiKey`");
|
|
338
|
-
if (c.identity = Ce || ce ? { identifier: Ce, traits: ce ? Object.fromEntries(Object.entries(ce).map(function(q) {
|
|
339
|
-
return [q[0], { value: q[1] }];
|
|
340
|
-
})) : {} } : c.identity, this.evaluationContext = c, this.api = y, this.headers = C, this.getFlagInterval = null, this.analyticsInterval = null, this.onChange = p, xe = "Wrong Flagsmith Configuration: preventFetch is true and no defaulFlags provided", this._trigger = ht || this._trigger, this._triggerLoadingState = gt || this._triggerLoadingState, this.onError = function(q) {
|
|
341
|
-
j.setLoadingState(l(l({}, j.loadingState), { isFetching: !1, isLoading: !1, error: q })), B == null || B(q);
|
|
342
|
-
}, this.enableLogs = K || !1, this.cacheOptions = re ? { skipAPI: !!re.skipAPI, ttl: re.ttl || 0, storageKey: re.storageKey, loadStale: !!re.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."), M && (w = M), this.enableAnalytics = le || !1, this.flags = Object.assign({}, k) || {}, this.datadogRum = I || null, this.initialised = !0, this.ticks = 1e4, this.timer = this.enableLogs ? (/* @__PURE__ */ new Date()).valueOf() : null, this.cacheFlags = F !== void 0 && !!x, pe = "FLAGSMITH_EVENT_" + c.environment.apiKey, T && (F = T), ue && typeof window < "u" && this.setupRealtime(R, c.environment.apiKey), Object.keys(this.flags).length && (this.loadingState = l(l({}, this.loadingState), { isLoading: !1, source: d.DEFAULT_FLAGS })), this.setState(dt), this.log("Initialising with properties", r, this), H && (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), Ae && (w = /* @__PURE__ */ function(q) {
|
|
343
|
-
return function(z, V) {
|
|
344
|
-
var W = V.headers, L = V.method, ae = V.body;
|
|
345
|
-
return new Promise(function(Q) {
|
|
346
|
-
switch (L) {
|
|
347
|
-
case "GET":
|
|
348
|
-
return q.get(z, { headers: W }).subscribe(function(X) {
|
|
349
|
-
Q({ ok: !0, text: function() {
|
|
350
|
-
return Promise.resolve(X);
|
|
351
|
-
} });
|
|
352
|
-
});
|
|
353
|
-
case "POST":
|
|
354
|
-
case "PUT":
|
|
355
|
-
return q.post(z, ae, { headers: W }).subscribe(function(X) {
|
|
356
|
-
Q({ ok: !0, text: function() {
|
|
357
|
-
return Promise.resolve(X);
|
|
358
|
-
} });
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
});
|
|
362
|
-
};
|
|
363
|
-
}(Ae)), F && this.canUseStorage && F.getItem(pe).then(function(q) {
|
|
364
|
-
try {
|
|
365
|
-
j.evaluationEvent = JSON.parse(q) || {};
|
|
366
|
-
} catch {
|
|
367
|
-
j.evaluationEvent = {};
|
|
368
|
-
}
|
|
369
|
-
j.analyticsInterval = setInterval(j.analyticsFlags, j.ticks);
|
|
370
|
-
}), this.enableAnalytics && (this.analyticsInterval && clearInterval(this.analyticsInterval), F && this.canUseStorage && F.getItem(pe, function(q, z) {
|
|
371
|
-
if (z && j.evaluationContext.environment) {
|
|
372
|
-
var V = JSON.parse(z);
|
|
373
|
-
if (V[j.evaluationContext.environment.apiKey]) {
|
|
374
|
-
var W = j.getState();
|
|
375
|
-
j.log("Retrieved events from cache", z), j.setState(l(l({}, W), { evaluationEvent: V[j.evaluationContext.environment.apiKey] }));
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
})), !x) return [3, 9];
|
|
379
|
-
if (!F || !this.canUseStorage) return [3, 8];
|
|
380
|
-
yt = function(q, z) {
|
|
381
|
-
return f(j, void 0, void 0, function() {
|
|
382
|
-
var V, W, L, ae, Q, X, Pe, St, Le, Ne, Ie, Re, je, Fe, De, ke, Ue, Ke, qe, Je, Me, Ge, Be, He, wt = this;
|
|
383
|
-
return _(this, function(Y) {
|
|
384
|
-
switch (Y.label) {
|
|
385
|
-
case 0:
|
|
386
|
-
if (!z) return [3, 7];
|
|
387
|
-
V = null, W = null, Y.label = 1;
|
|
388
|
-
case 1:
|
|
389
|
-
return Y.trys.push([1, 5, , 6]), L = JSON.parse(z), ae = !1, Q = !1, L && L.api === this.api && ((Ne = (Le = L.evaluationContext) === null || Le === void 0 ? void 0 : Le.environment) === null || Ne === void 0 ? void 0 : Ne.apiKey) === ((Ie = this.evaluationContext.environment) === null || Ie === void 0 ? void 0 : Ie.apiKey) && (X = !0, this.evaluationContext.identity && ((je = (Re = L.evaluationContext) === null || Re === void 0 ? void 0 : Re.identity) === null || je === void 0 ? void 0 : je.identifier) !== this.evaluationContext.identity.identifier && (this.log("Ignoring cache, identity has changed from " + ((De = (Fe = L.evaluationContext) === null || Fe === void 0 ? void 0 : Fe.identity) === null || De === void 0 ? void 0 : De.identifier) + " to " + this.evaluationContext.identity.identifier), X = !1), this.cacheOptions.ttl && (!L.ts || (/* @__PURE__ */ new Date()).valueOf() - L.ts > this.cacheOptions.ttl) && (L.ts && !this.cacheOptions.loadStale ? (this.log("Ignoring cache, timestamp is too old ts:" + L.ts + " ttl: " + this.cacheOptions.ttl + " time elapsed since cache: " + ((/* @__PURE__ */ new Date()).valueOf() - L.ts) + "ms"), X = !1) : L.ts && this.cacheOptions.loadStale && (this.log("Loading stale cache, timestamp ts:" + L.ts + " ttl: " + this.cacheOptions.ttl + " time elapsed since cache: " + ((/* @__PURE__ */ new Date()).valueOf() - L.ts) + "ms"), Q = !0, X = !0)), X && (ae = !0, W = g((ke = this.evaluationContext.identity) === null || ke === void 0 ? void 0 : ke.traits, (Ke = (Ue = L.evaluationContext) === null || Ue === void 0 ? void 0 : Ue.identity) === null || Ke === void 0 ? void 0 : Ke.traits), V = g(this.flags, L.flags), this.setState(l(l({}, L), { evaluationContext: te(l(l({}, L.evaluationContext), { identity: !((qe = L.evaluationContext) === null || qe === void 0) && qe.identity ? l(l({}, (Je = L.evaluationContext) === null || Je === void 0 ? void 0 : Je.identity), { traits: l(l({}, ((Ge = (Me = L.evaluationContext) === null || Me === void 0 ? void 0 : Me.identity) === null || Ge === void 0 ? void 0 : Ge.traits) || {}), ce || {}) }) : void 0 })) })), this.log("Retrieved flags from cache", L))), ae ? (Pe = !U && (!this.cacheOptions.skipAPI || Q), this._onChange(null, { isFromServer: !1, flagsChanged: V, traitsChanged: W }, this._loadedState(null, d.CACHE, Pe)), this.oldFlags = this.flags, this.cacheOptions.skipAPI && ae && !Q && this.log("Skipping API, using cache"), Pe && this.getFlags().catch(function(Rt) {
|
|
390
|
-
var ze;
|
|
391
|
-
(ze = wt.onError) === null || ze === void 0 || ze.call(wt, Rt);
|
|
392
|
-
}), [3, 4]) : [3, 2];
|
|
393
|
-
case 2:
|
|
394
|
-
return U ? [3, 4] : [4, this.getFlags()];
|
|
395
|
-
case 3:
|
|
396
|
-
Y.sent(), Y.label = 4;
|
|
397
|
-
case 4:
|
|
398
|
-
return [3, 6];
|
|
399
|
-
case 5:
|
|
400
|
-
return St = Y.sent(), this.log("Exception fetching cached logs", St), [3, 6];
|
|
401
|
-
case 6:
|
|
402
|
-
return [3, 10];
|
|
403
|
-
case 7:
|
|
404
|
-
return U ? [3, 9] : [4, this.getFlags()];
|
|
405
|
-
case 8:
|
|
406
|
-
return Y.sent(), [3, 10];
|
|
407
|
-
case 9:
|
|
408
|
-
if (k) this._onChange(null, { isFromServer: !1, flagsChanged: g({}, this.flags), traitsChanged: g({}, (Be = this.evaluationContext.identity) === null || Be === void 0 ? void 0 : Be.traits) }, this._loadedState(null, d.DEFAULT_FLAGS));
|
|
409
|
-
else {
|
|
410
|
-
if (!this.flags) throw new Error(xe);
|
|
411
|
-
this._onChange(null, { isFromServer: !1, flagsChanged: g({}, this.flags), traitsChanged: g({}, (He = this.evaluationContext.identity) === null || He === void 0 ? void 0 : He.traits) }, this._loadedState(null, d.DEFAULT_FLAGS));
|
|
412
|
-
}
|
|
413
|
-
Y.label = 10;
|
|
414
|
-
case 10:
|
|
415
|
-
return [2];
|
|
416
|
-
}
|
|
417
|
-
});
|
|
418
|
-
});
|
|
419
|
-
}, G.label = 2;
|
|
420
|
-
case 2:
|
|
421
|
-
return G.trys.push([2, 7, , 8]), F.getItemSync ? (Te = F.getItemSync(this.getStorageKey()), [3, 5]) : [3, 3];
|
|
422
|
-
case 3:
|
|
423
|
-
return [4, F.getItem(this.getStorageKey())];
|
|
424
|
-
case 4:
|
|
425
|
-
Te = G.sent(), G.label = 5;
|
|
426
|
-
case 5:
|
|
427
|
-
return [4, yt(null, Te)];
|
|
428
|
-
case 6:
|
|
429
|
-
case 7:
|
|
430
|
-
return G.sent(), [3, 8];
|
|
431
|
-
case 8:
|
|
432
|
-
return [3, 12];
|
|
433
|
-
case 9:
|
|
434
|
-
return U ? [3, 11] : [4, this.getFlags()];
|
|
435
|
-
case 10:
|
|
436
|
-
return G.sent(), [3, 12];
|
|
437
|
-
case 11:
|
|
438
|
-
if (k) this._onChange(null, { isFromServer: !1, flagsChanged: g({}, k), traitsChanged: g({}, (t = c.identity) === null || t === void 0 ? void 0 : t.traits) }, this._loadedState(null, d.DEFAULT_FLAGS));
|
|
439
|
-
else if (this.flags && (ve = null, Object.keys(this.flags).length === 0 && (ve = xe), this._onChange(null, { isFromServer: !1, flagsChanged: g({}, this.flags), traitsChanged: g({}, (a = c.identity) === null || a === void 0 ? void 0 : a.traits) }, this._loadedState(ve, d.DEFAULT_FLAGS)), ve)) throw new Error(ve);
|
|
440
|
-
G.label = 12;
|
|
441
|
-
case 12:
|
|
442
|
-
return [3, 14];
|
|
443
|
-
case 13:
|
|
444
|
-
throw ie = G.sent(), this.log("Error during initialisation ", ie), mt = ie instanceof Error ? ie : new Error("".concat(ie)), (i = this.onError) === null || i === void 0 || i.call(this, mt), ie;
|
|
445
|
-
case 14:
|
|
446
|
-
return [2];
|
|
447
|
-
}
|
|
448
|
-
});
|
|
449
|
-
});
|
|
450
|
-
}, u.prototype.getAllFlags = function() {
|
|
451
|
-
return this.flags;
|
|
452
|
-
}, u.prototype.identify = function(r, t, a) {
|
|
453
|
-
return this.evaluationContext.identity = { identifier: r, transient: a, traits: this.evaluationContext.identity && this.evaluationContext.identity.identifier == r ? this.evaluationContext.identity.traits : {} }, this.evaluationContext.identity.identifier = r, this.log("Identify: " + this.evaluationContext.identity.identifier), t && (this.evaluationContext.identity.traits = Object.fromEntries(Object.entries(t).map(function(i) {
|
|
454
|
-
var c = i[0], v = i[1];
|
|
455
|
-
return [c, b(v) ? v : { value: v }];
|
|
456
|
-
}))), this.initialised ? this.getFlags() : Promise.resolve();
|
|
457
|
-
}, u.prototype.getState = function() {
|
|
458
|
-
return { api: this.api, flags: this.flags, ts: this.ts, evaluationContext: this.evaluationContext, evaluationEvent: this.evaluationEvent };
|
|
459
|
-
}, u.prototype.setState = function(r) {
|
|
460
|
-
r && (this.initialised = !0, this.api = r.api || this.api || at, this.flags = r.flags || this.flags, this.evaluationContext = r.evaluationContext || this.evaluationContext, this.evaluationEvent = r.evaluationEvent || this.evaluationEvent, this.log("setState called", this));
|
|
461
|
-
}, u.prototype.logout = function() {
|
|
462
|
-
return this.evaluationContext.identity = null, this.initialised ? this.getFlags() : Promise.resolve();
|
|
463
|
-
}, u.prototype.startListening = function(r) {
|
|
464
|
-
r === void 0 && (r = 1e3), this.getFlagInterval && clearInterval(this.getFlagInterval), this.getFlagInterval = setInterval(this.getFlags, r);
|
|
465
|
-
}, u.prototype.stopListening = function() {
|
|
466
|
-
this.getFlagInterval && (clearInterval(this.getFlagInterval), this.getFlagInterval = null);
|
|
467
|
-
}, u.prototype._loadedState = function(r, t, a) {
|
|
468
|
-
return r === void 0 && (r = null), a === void 0 && (a = !1), { error: r, isFetching: a, isLoading: !1, source: t };
|
|
469
|
-
}, u.prototype.log = function() {
|
|
470
|
-
for (var r = [], t = 0; t < arguments.length; t++) r[t] = arguments[t];
|
|
471
|
-
this.enableLogs && console.log.apply(this, S(["FLAGSMITH:", (/* @__PURE__ */ new Date()).valueOf() - (this.timer || 0), "ms"], r));
|
|
472
|
-
}, u.prototype.updateStorage = function() {
|
|
473
|
-
if (this.cacheFlags) {
|
|
474
|
-
this.ts = (/* @__PURE__ */ new Date()).valueOf();
|
|
475
|
-
var r = JSON.stringify(this.getState());
|
|
476
|
-
this.log("Setting storage", r), F.setItem(this.getStorageKey(), r);
|
|
477
|
-
}
|
|
478
|
-
}, u.prototype.updateEventStorage = function() {
|
|
479
|
-
if (this.enableAnalytics) {
|
|
480
|
-
var r = JSON.stringify(this.getState().evaluationEvent);
|
|
481
|
-
F.setItem(pe, r).catch(function(t) {
|
|
482
|
-
return console.error("Flagsmith: Error setting item in async storage", t);
|
|
483
|
-
});
|
|
484
|
-
}
|
|
485
|
-
}, u.prototype.setLoadingState = function(r) {
|
|
486
|
-
var t;
|
|
487
|
-
A(r, this.loadingState) || (this.loadingState = l({}, r), this.log("Loading state changed", r), (t = this._triggerLoadingState) === null || t === void 0 || t.call(this));
|
|
488
|
-
}, u.prototype.setupRealtime = function(r, t) {
|
|
489
|
-
var a = this, i = r + "sse/environments/" + t + "/stream";
|
|
490
|
-
Oe ? this.eventSource || (this.log("Creating event source with url " + i), this.eventSource = new Oe(i), this.eventSource.addEventListener("environment_updated", function(c) {
|
|
491
|
-
var v;
|
|
492
|
-
try {
|
|
493
|
-
v = JSON.parse(c.data).updated_at;
|
|
494
|
-
} catch (h) {
|
|
495
|
-
a.log("Could not parse sse event", h);
|
|
496
|
-
}
|
|
497
|
-
v ? !a.timestamp || v > a.timestamp ? a.isLoading ? a.log("updated_at is new, but flags are loading", c.data, a.timestamp) : (a.log("updated_at is new, fetching flags", c.data, a.timestamp), a.getFlags()) : a.log("updated_at is outdated, skipping get flags", c.data, a.timestamp) : a.log("No updated_at received, fetching flags", c);
|
|
498
|
-
})) : this.log("Error, EventSource is undefined");
|
|
499
|
-
}, u;
|
|
500
|
-
}();
|
|
501
|
-
function ut(u) {
|
|
502
|
-
var r = u.fetch, t = u.AsyncStorage, a = u.eventSource;
|
|
503
|
-
return new Lt({ fetch: r, AsyncStorage: t, eventSource: a });
|
|
504
|
-
}
|
|
505
|
-
var de, Nt = (de = function(u, r) {
|
|
506
|
-
return de = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, a) {
|
|
507
|
-
t.__proto__ = a;
|
|
508
|
-
} || function(t, a) {
|
|
509
|
-
for (var i in a) Object.prototype.hasOwnProperty.call(a, i) && (t[i] = a[i]);
|
|
510
|
-
}, de(u, r);
|
|
511
|
-
}, function(u, r) {
|
|
512
|
-
if (typeof r != "function" && r !== null) throw new TypeError("Class extends value " + String(r) + " is not a constructor or null");
|
|
513
|
-
function t() {
|
|
514
|
-
this.constructor = u;
|
|
515
|
-
}
|
|
516
|
-
de(u, r), u.prototype = r === null ? Object.create(r) : (t.prototype = r.prototype, new t());
|
|
517
|
-
}), ct = function(u) {
|
|
518
|
-
var r = typeof Symbol == "function" && Symbol.iterator, t = r && u[r], a = 0;
|
|
519
|
-
if (t) return t.call(u);
|
|
520
|
-
if (u && typeof u.length == "number") return { next: function() {
|
|
521
|
-
return u && a >= u.length && (u = void 0), { value: u && u[a++], done: !u };
|
|
522
|
-
} };
|
|
523
|
-
throw new TypeError(r ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
524
|
-
}, vt = function(u, r) {
|
|
525
|
-
var t = typeof Symbol == "function" && u[Symbol.iterator];
|
|
526
|
-
if (!t) return u;
|
|
527
|
-
var a, i, c = t.call(u), v = [];
|
|
528
|
-
try {
|
|
529
|
-
for (; (r === void 0 || r-- > 0) && !(a = c.next()).done; ) v.push(a.value);
|
|
530
|
-
} catch (h) {
|
|
531
|
-
i = { error: h };
|
|
532
|
-
} finally {
|
|
533
|
-
try {
|
|
534
|
-
a && !a.done && (t = c.return) && t.call(c);
|
|
535
|
-
} finally {
|
|
536
|
-
if (i) throw i.error;
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
return v;
|
|
540
|
-
}, Ee = function(u, r, t) {
|
|
541
|
-
if (arguments.length === 2) for (var a, i = 0, c = r.length; i < c; i++) !a && i in r || (a || (a = Array.prototype.slice.call(r, 0, i)), a[i] = r[i]);
|
|
542
|
-
return u.concat(a || Array.prototype.slice.call(r));
|
|
543
|
-
}, It = function(u) {
|
|
544
|
-
function r() {
|
|
545
|
-
return u.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 Nt(r, u), r;
|
|
549
|
-
}(Error), ft = function() {
|
|
550
|
-
function u(r, t) {
|
|
551
|
-
var a = this;
|
|
552
|
-
if (this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, this._configuration = t != null ? Object.assign({}, t) : void 0, this.withCredentials = !1, this._eventSource = null, this._lastEventId = null, this._timer = null, this._listeners = { open: [], error: [], message: [] }, this.url = r.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 It();
|
|
553
|
-
this._onevent_wrapped = function(i) {
|
|
554
|
-
a._onevent(i);
|
|
555
|
-
}, this._start();
|
|
556
|
-
}
|
|
557
|
-
return u.prototype.dispatchEvent = function(r) {
|
|
558
|
-
throw new Error("Method not implemented.");
|
|
559
|
-
}, u.prototype._start = function() {
|
|
560
|
-
var r, t, a = this, i = this.url;
|
|
561
|
-
this._lastEventId && (i.indexOf("?") === -1 ? i += "?" : i += "&", i += "lastEventId=" + encodeURIComponent(this._lastEventId)), this._eventSource = new this.eventSourceClass(i, this._configuration), this._eventSource.onopen = function(y) {
|
|
562
|
-
a._onopen(y);
|
|
563
|
-
}, this._eventSource.onerror = function(y) {
|
|
564
|
-
a._onerror(y);
|
|
565
|
-
}, this._eventSource.onmessage = function(y) {
|
|
566
|
-
a.onmessage(y);
|
|
567
|
-
};
|
|
568
|
-
try {
|
|
569
|
-
for (var c = ct(Object.keys(this._listeners)), v = c.next(); !v.done; v = c.next()) {
|
|
570
|
-
var h = v.value;
|
|
571
|
-
this._eventSource.addEventListener(h, this._onevent_wrapped);
|
|
572
|
-
}
|
|
573
|
-
} catch (y) {
|
|
574
|
-
r = { error: y };
|
|
575
|
-
} finally {
|
|
576
|
-
try {
|
|
577
|
-
v && !v.done && (t = c.return) && t.call(c);
|
|
578
|
-
} finally {
|
|
579
|
-
if (r) throw r.error;
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
}, u.prototype._onopen = function(r) {
|
|
583
|
-
this.readyState === 0 && (this.readyState = 1, this.onopen(r));
|
|
584
|
-
}, u.prototype._onerror = function(r) {
|
|
585
|
-
var t = this;
|
|
586
|
-
if (this.readyState === 1 && (this.readyState = 0, this.onerror(r)), this._eventSource) {
|
|
587
|
-
this._eventSource.close(), this._eventSource = null;
|
|
588
|
-
var a = Math.round(this.max_retry_time * Math.random());
|
|
589
|
-
this._timer = setTimeout(function() {
|
|
590
|
-
return t._start();
|
|
591
|
-
}, a);
|
|
592
|
-
}
|
|
593
|
-
}, u.prototype._onevent = function(r) {
|
|
594
|
-
var t, a;
|
|
595
|
-
r && r.lastEventId && (this._lastEventId = r.lastEventId);
|
|
596
|
-
var i = this._listeners[r.type];
|
|
597
|
-
if (i != null) try {
|
|
598
|
-
for (var c = ct(Ee([], vt(i), !1)), v = c.next(); !v.done; v = c.next())
|
|
599
|
-
v.value.call(this, r);
|
|
600
|
-
} catch (h) {
|
|
601
|
-
t = { error: h };
|
|
602
|
-
} finally {
|
|
603
|
-
try {
|
|
604
|
-
v && !v.done && (a = c.return) && a.call(c);
|
|
605
|
-
} finally {
|
|
606
|
-
if (t) throw t.error;
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
r.type === "message" && this.onmessage(r);
|
|
610
|
-
}, u.prototype.onopen = function(r) {
|
|
611
|
-
}, u.prototype.onerror = function(r) {
|
|
612
|
-
}, u.prototype.onmessage = function(r) {
|
|
613
|
-
}, u.prototype.close = function() {
|
|
614
|
-
this._timer && (clearTimeout(this._timer), this._timer = null), this._eventSource && (this._eventSource.close(), this._eventSource = null), this.readyState = 2;
|
|
615
|
-
}, u.prototype.addEventListener = function(r, t, a) {
|
|
616
|
-
this._listeners[r] == null && (this._listeners[r] = [], this._eventSource != null && this._eventSource.addEventListener(r, this._onevent_wrapped));
|
|
617
|
-
var i = this._listeners[r];
|
|
618
|
-
i.includes(t) || (this._listeners[r] = Ee(Ee([], vt(i), !1), [t], !1));
|
|
619
|
-
}, u.prototype.removeEventListener = function(r, t, a) {
|
|
620
|
-
var i = this._listeners[r];
|
|
621
|
-
this._listeners[r] = i.filter(function(c) {
|
|
622
|
-
return c !== t;
|
|
623
|
-
});
|
|
624
|
-
}, u;
|
|
625
|
-
}();
|
|
626
|
-
globalThis.FlagsmithEventSource = typeof EventSource < "u" ? EventSource : null;
|
|
627
|
-
var _t = function(u, r) {
|
|
628
|
-
return r = r || {}, new Promise(function(t, a) {
|
|
629
|
-
var i = new XMLHttpRequest(), c = [], v = [], h = {}, y = function() {
|
|
630
|
-
return { ok: (i.status / 100 | 0) == 2, statusText: i.statusText, status: i.status, url: i.responseURL, text: function() {
|
|
631
|
-
return Promise.resolve(i.responseText);
|
|
632
|
-
}, json: function() {
|
|
633
|
-
return Promise.resolve(i.responseText).then(JSON.parse);
|
|
634
|
-
}, blob: function() {
|
|
635
|
-
return Promise.resolve(new Blob([i.response]));
|
|
636
|
-
}, clone: y, headers: { keys: function() {
|
|
637
|
-
return c;
|
|
638
|
-
}, entries: function() {
|
|
639
|
-
return v;
|
|
640
|
-
}, get: function(p) {
|
|
641
|
-
return h[p.toLowerCase()];
|
|
642
|
-
}, has: function(p) {
|
|
643
|
-
return p.toLowerCase() in h;
|
|
644
|
-
} } };
|
|
645
|
-
};
|
|
646
|
-
for (var C in i.open(r.method || "get", u, !0), i.onload = function() {
|
|
647
|
-
i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function(p, x, I) {
|
|
648
|
-
c.push(x = x.toLowerCase()), v.push([x, I]), h[x] = h[x] ? h[x] + "," + I : I;
|
|
649
|
-
}), t(y());
|
|
650
|
-
}, i.onerror = a, i.withCredentials = r.credentials == "include", r.headers) i.setRequestHeader(C, r.headers[C]);
|
|
651
|
-
i.send(r.body || null);
|
|
652
|
-
});
|
|
653
|
-
}, pt = ut({ AsyncStorage: s, fetch: _t, eventSource: ft });
|
|
654
|
-
typeof window < "u" && (window.flagsmith = pt), o.createFlagsmithInstance = function() {
|
|
655
|
-
return ut({ AsyncStorage: s, fetch: _t, eventSource: ft });
|
|
656
|
-
}, o.default = pt, Object.defineProperty(o, "__esModule", { value: !0 });
|
|
657
|
-
});
|
|
658
|
-
})(We, We.exports);
|
|
659
|
-
var kt = We.exports, Ut = {
|
|
660
|
-
NOT_INITIALIZED: "FeatureFlag not initialized. Call init() first."
|
|
661
|
-
}, Ot = "business", $, Kt = ($ = class {
|
|
662
|
-
constructor() {
|
|
663
|
-
he(this, "flagsmithClient", null);
|
|
664
|
-
he(this, "userContext", null);
|
|
665
|
-
}
|
|
666
|
-
static getInstance() {
|
|
667
|
-
return $.instance || ($.instance = new $()), $.instance;
|
|
668
|
-
}
|
|
669
|
-
ensureInitialized() {
|
|
670
|
-
if (!this.flagsmithClient)
|
|
671
|
-
throw new Error(Ut.NOT_INITIALIZED);
|
|
672
|
-
}
|
|
673
|
-
async init(n, o = []) {
|
|
674
|
-
if (!this.flagsmithClient)
|
|
675
|
-
try {
|
|
676
|
-
this.flagsmithClient = kt.createFlagsmithInstance();
|
|
677
|
-
const s = o.reduce((l, f) => (l[f.feature.name] = f, l), {});
|
|
678
|
-
await this.flagsmithClient.init({
|
|
679
|
-
environmentID: n.apiKey,
|
|
680
|
-
api: (n == null ? void 0 : n.url) ?? "https://feature-flag-proxy.feedme.farm/api/v1/",
|
|
681
|
-
enableAnalytics: (n == null ? void 0 : n.enableAnalytics) ?? !0,
|
|
682
|
-
defaultFlags: s,
|
|
683
|
-
cacheFlags: (n == null ? void 0 : n.cacheFlags) ?? !0
|
|
684
|
-
});
|
|
685
|
-
} catch (s) {
|
|
686
|
-
throw console.error("Failed to initialize FeatureFlag:", s), s;
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
async setUser(n) {
|
|
690
|
-
this.ensureInitialized(), this.userContext = { identifier: n }, 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 (n) {
|
|
701
|
-
throw console.error("Failed to update user context:", n), n;
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
async getFlags() {
|
|
705
|
-
this.ensureInitialized();
|
|
706
|
-
const n = this.flagsmithClient.getAllFlags();
|
|
707
|
-
return Object.entries(n).map(([o, s]) => {
|
|
708
|
-
var l;
|
|
709
|
-
return {
|
|
710
|
-
feature: {
|
|
711
|
-
name: o,
|
|
712
|
-
id: (s == null ? void 0 : s.id) ?? 0
|
|
713
|
-
},
|
|
714
|
-
enabled: s.enabled,
|
|
715
|
-
value: ((l = s.value) == null ? void 0 : l.toString()) ?? null
|
|
716
|
-
};
|
|
717
|
-
});
|
|
718
|
-
}
|
|
719
|
-
getFlagValue(n, o) {
|
|
720
|
-
this.ensureInitialized();
|
|
721
|
-
const s = this.flagsmithClient.getValue(n);
|
|
722
|
-
if (s == null)
|
|
723
|
-
return null;
|
|
724
|
-
try {
|
|
725
|
-
const l = s.toString();
|
|
726
|
-
return o ? o(l) : typeof {} == "number" ? isNaN(Number(l)) ? null : Number(l) : typeof {} == "boolean" ? l.toLowerCase() === "true" : l;
|
|
727
|
-
} catch (l) {
|
|
728
|
-
return console.error("Error transforming flag value:", l), null;
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
getFlag(n) {
|
|
732
|
-
this.ensureInitialized();
|
|
733
|
-
const o = this.flagsmithClient.getValue(n);
|
|
734
|
-
if (o == null) return null;
|
|
735
|
-
const s = this.flagsmithClient.hasFeature(n);
|
|
736
|
-
return {
|
|
737
|
-
feature: {
|
|
738
|
-
name: n,
|
|
739
|
-
id: 0
|
|
740
|
-
},
|
|
741
|
-
enabled: s,
|
|
742
|
-
value: o.toString()
|
|
743
|
-
};
|
|
744
|
-
}
|
|
745
|
-
async getUserFlagValue(n, o, s = null, l) {
|
|
746
|
-
var _;
|
|
747
|
-
const f = this.userContext;
|
|
748
|
-
try {
|
|
749
|
-
return await this.setUser(n), this.getFlagValue(o, l) ?? s;
|
|
750
|
-
} catch (S) {
|
|
751
|
-
return console.error(`Error getting user flag value for ${o}:`, S), s;
|
|
752
|
-
} finally {
|
|
753
|
-
try {
|
|
754
|
-
await ((_ = this.flagsmithClient) == null ? void 0 : _.logout()), this.userContext = null, f && await this.setUser(f.identifier);
|
|
755
|
-
} catch (S) {
|
|
756
|
-
console.error("Error during cleanup:", S);
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
reset() {
|
|
761
|
-
this.flagsmithClient = null, this.userContext = null;
|
|
762
|
-
}
|
|
763
|
-
}, he($, "instance"), $), qt = Kt.getInstance(), fe = we(!1), ye = we([]), oe = we(null);
|
|
764
|
-
function Jt(e = qt) {
|
|
765
|
-
const n = () => fe.value ? !0 : (console.warn("FeatureFlag is not initialized. Using default values."), !1), o = async (d, w = []) => {
|
|
766
|
-
if (fe.value) {
|
|
767
|
-
console.warn("FeatureFlag is already initialized.");
|
|
768
|
-
return;
|
|
769
|
-
}
|
|
770
|
-
try {
|
|
771
|
-
await e.init(d, w), ye.value = await e.getFlags(), fe.value = !0, oe.value = null;
|
|
772
|
-
} catch (P) {
|
|
773
|
-
console.error("Failed to initialize feature flags:", P), oe.value = P;
|
|
774
|
-
}
|
|
775
|
-
}, s = async (d) => {
|
|
776
|
-
if (n())
|
|
777
|
-
try {
|
|
778
|
-
await e.setUser(d), ye.value = await e.getFlags(), oe.value = null;
|
|
779
|
-
} catch (w) {
|
|
780
|
-
console.error("Failed to set user:", w), oe.value = w;
|
|
781
|
-
}
|
|
782
|
-
}, l = async (d) => s(`${Ot}-${d}`), f = (d, w, P = null) => {
|
|
783
|
-
if (!n()) return P;
|
|
784
|
-
try {
|
|
785
|
-
return e.getFlagValue(d, w) ?? P;
|
|
786
|
-
} catch (b) {
|
|
787
|
-
return console.error(`Error getting flag value for ${d}:`, b), P;
|
|
788
|
-
}
|
|
789
|
-
}, _ = (d, w) => {
|
|
790
|
-
if (!n()) return w ?? null;
|
|
791
|
-
try {
|
|
792
|
-
return e.getFlag(d) ?? w ?? null;
|
|
793
|
-
} catch (P) {
|
|
794
|
-
return console.error(`Error getting flag for ${d}:`, P), w ?? null;
|
|
795
|
-
}
|
|
796
|
-
}, S = async (d, w, P = null, b) => {
|
|
797
|
-
if (!n()) return P;
|
|
798
|
-
try {
|
|
799
|
-
return await e.getUserFlagValue(d, w, P, b);
|
|
800
|
-
} catch (J) {
|
|
801
|
-
return console.error(`Error getting user flag value for ${w}:`, J), P;
|
|
802
|
-
}
|
|
803
|
-
}, A = async (d, w, P = null, b) => S(`${Ot}-${d}`, w, P, b), g = () => {
|
|
804
|
-
try {
|
|
805
|
-
e.reset();
|
|
806
|
-
} catch (d) {
|
|
807
|
-
console.error("Error resetting feature flags:", d);
|
|
808
|
-
} finally {
|
|
809
|
-
ye.value = [], fe.value = !1, oe.value = null;
|
|
810
|
-
}
|
|
811
|
-
};
|
|
812
|
-
return {
|
|
813
|
-
flags: Xe(ye),
|
|
814
|
-
isInitialized: Xe(fe),
|
|
815
|
-
error: Xe(oe),
|
|
816
|
-
init: o,
|
|
817
|
-
setUser: s,
|
|
818
|
-
setBusiness: l,
|
|
819
|
-
getFlagValue: f,
|
|
820
|
-
getFlag: _,
|
|
821
|
-
getUserFlagValue: S,
|
|
822
|
-
getBusinessFlagValue: A,
|
|
823
|
-
reset: g
|
|
824
|
-
};
|
|
825
|
-
}
|
|
826
|
-
var be = () => Jt();
|
|
827
|
-
/*!
|
|
828
|
-
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
829
|
-
* (c) 2017-2022 Joachim Wester
|
|
830
|
-
* MIT licensed
|
|
831
|
-
*/
|
|
832
|
-
var Mt = /* @__PURE__ */ function() {
|
|
833
|
-
var e = function(n, o) {
|
|
834
|
-
return e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(s, l) {
|
|
835
|
-
s.__proto__ = l;
|
|
836
|
-
} || function(s, l) {
|
|
837
|
-
for (var f in l) l.hasOwnProperty(f) && (s[f] = l[f]);
|
|
838
|
-
}, e(n, o);
|
|
839
|
-
};
|
|
840
|
-
return function(n, o) {
|
|
841
|
-
e(n, o);
|
|
842
|
-
function s() {
|
|
843
|
-
this.constructor = n;
|
|
844
|
-
}
|
|
845
|
-
n.prototype = o === null ? Object.create(o) : (s.prototype = o.prototype, new s());
|
|
846
|
-
};
|
|
847
|
-
}(), Gt = Object.prototype.hasOwnProperty;
|
|
848
|
-
function Ye(e, n) {
|
|
849
|
-
return Gt.call(e, n);
|
|
850
|
-
}
|
|
851
|
-
function Qe(e) {
|
|
852
|
-
if (Array.isArray(e)) {
|
|
853
|
-
for (var n = new Array(e.length), o = 0; o < n.length; o++)
|
|
854
|
-
n[o] = "" + o;
|
|
855
|
-
return n;
|
|
856
|
-
}
|
|
857
|
-
if (Object.keys)
|
|
858
|
-
return Object.keys(e);
|
|
859
|
-
var s = [];
|
|
860
|
-
for (var l in e)
|
|
861
|
-
Ye(e, l) && s.push(l);
|
|
862
|
-
return s;
|
|
863
|
-
}
|
|
864
|
-
function D(e) {
|
|
865
|
-
switch (typeof e) {
|
|
866
|
-
case "object":
|
|
867
|
-
return JSON.parse(JSON.stringify(e));
|
|
868
|
-
case "undefined":
|
|
869
|
-
return null;
|
|
870
|
-
default:
|
|
871
|
-
return e;
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
function Ze(e) {
|
|
875
|
-
for (var n = 0, o = e.length, s; n < o; ) {
|
|
876
|
-
if (s = e.charCodeAt(n), s >= 48 && s <= 57) {
|
|
877
|
-
n++;
|
|
878
|
-
continue;
|
|
879
|
-
}
|
|
880
|
-
return !1;
|
|
881
|
-
}
|
|
882
|
-
return !0;
|
|
883
|
-
}
|
|
884
|
-
function Z(e) {
|
|
885
|
-
return e.indexOf("/") === -1 && e.indexOf("~") === -1 ? e : e.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
886
|
-
}
|
|
887
|
-
function Ct(e) {
|
|
888
|
-
return e.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
889
|
-
}
|
|
890
|
-
function et(e) {
|
|
891
|
-
if (e === void 0)
|
|
892
|
-
return !0;
|
|
893
|
-
if (e) {
|
|
894
|
-
if (Array.isArray(e)) {
|
|
895
|
-
for (var n = 0, o = e.length; n < o; n++)
|
|
896
|
-
if (et(e[n]))
|
|
897
|
-
return !0;
|
|
898
|
-
} else if (typeof e == "object") {
|
|
899
|
-
for (var s = Qe(e), l = s.length, f = 0; f < l; f++)
|
|
900
|
-
if (et(e[s[f]]))
|
|
901
|
-
return !0;
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
return !1;
|
|
905
|
-
}
|
|
906
|
-
function Et(e, n) {
|
|
907
|
-
var o = [e];
|
|
908
|
-
for (var s in n) {
|
|
909
|
-
var l = typeof n[s] == "object" ? JSON.stringify(n[s], null, 2) : n[s];
|
|
910
|
-
typeof l < "u" && o.push(s + ": " + l);
|
|
911
|
-
}
|
|
912
|
-
return o.join(`
|
|
913
|
-
`);
|
|
914
|
-
}
|
|
915
|
-
var At = (
|
|
916
|
-
/** @class */
|
|
917
|
-
function(e) {
|
|
918
|
-
Mt(n, e);
|
|
919
|
-
function n(o, s, l, f, _) {
|
|
920
|
-
var S = this.constructor, A = e.call(this, Et(o, { name: s, index: l, operation: f, tree: _ })) || this;
|
|
921
|
-
return A.name = s, A.index = l, A.operation = f, A.tree = _, Object.setPrototypeOf(A, S.prototype), A.message = Et(o, { name: s, index: l, operation: f, tree: _ }), A;
|
|
922
|
-
}
|
|
923
|
-
return n;
|
|
924
|
-
}(Error)
|
|
925
|
-
), N = At, Bt = D, se = {
|
|
926
|
-
add: function(e, n, o) {
|
|
927
|
-
return e[n] = this.value, { newDocument: o };
|
|
928
|
-
},
|
|
929
|
-
remove: function(e, n, o) {
|
|
930
|
-
var s = e[n];
|
|
931
|
-
return delete e[n], { newDocument: o, removed: s };
|
|
932
|
-
},
|
|
933
|
-
replace: function(e, n, o) {
|
|
934
|
-
var s = e[n];
|
|
935
|
-
return e[n] = this.value, { newDocument: o, removed: s };
|
|
936
|
-
},
|
|
937
|
-
move: function(e, n, o) {
|
|
938
|
-
var s = me(o, this.path);
|
|
939
|
-
s && (s = D(s));
|
|
940
|
-
var l = ee(o, { op: "remove", path: this.from }).removed;
|
|
941
|
-
return ee(o, { op: "add", path: this.path, value: l }), { newDocument: o, removed: s };
|
|
942
|
-
},
|
|
943
|
-
copy: function(e, n, o) {
|
|
944
|
-
var s = me(o, this.from);
|
|
945
|
-
return ee(o, { op: "add", path: this.path, value: D(s) }), { newDocument: o };
|
|
946
|
-
},
|
|
947
|
-
test: function(e, n, o) {
|
|
948
|
-
return { newDocument: o, test: _e(e[n], this.value) };
|
|
949
|
-
},
|
|
950
|
-
_get: function(e, n, o) {
|
|
951
|
-
return this.value = e[n], { newDocument: o };
|
|
952
|
-
}
|
|
953
|
-
}, Ht = {
|
|
954
|
-
add: function(e, n, o) {
|
|
955
|
-
return Ze(n) ? e.splice(n, 0, this.value) : e[n] = this.value, { newDocument: o, index: n };
|
|
956
|
-
},
|
|
957
|
-
remove: function(e, n, o) {
|
|
958
|
-
var s = e.splice(n, 1);
|
|
959
|
-
return { newDocument: o, removed: s[0] };
|
|
960
|
-
},
|
|
961
|
-
replace: function(e, n, o) {
|
|
962
|
-
var s = e[n];
|
|
963
|
-
return e[n] = this.value, { newDocument: o, removed: s };
|
|
964
|
-
},
|
|
965
|
-
move: se.move,
|
|
966
|
-
copy: se.copy,
|
|
967
|
-
test: se.test,
|
|
968
|
-
_get: se._get
|
|
969
|
-
};
|
|
970
|
-
function me(e, n) {
|
|
971
|
-
if (n == "")
|
|
972
|
-
return e;
|
|
973
|
-
var o = { op: "_get", path: n };
|
|
974
|
-
return ee(e, o), o.value;
|
|
975
|
-
}
|
|
976
|
-
function ee(e, n, o, s, l, f) {
|
|
977
|
-
if (o === void 0 && (o = !1), s === void 0 && (s = !0), l === void 0 && (l = !0), f === void 0 && (f = 0), o && (typeof o == "function" ? o(n, 0, e, n.path) : Se(n, 0)), n.path === "") {
|
|
978
|
-
var _ = { newDocument: e };
|
|
979
|
-
if (n.op === "add")
|
|
980
|
-
return _.newDocument = n.value, _;
|
|
981
|
-
if (n.op === "replace")
|
|
982
|
-
return _.newDocument = n.value, _.removed = e, _;
|
|
983
|
-
if (n.op === "move" || n.op === "copy")
|
|
984
|
-
return _.newDocument = me(e, n.from), n.op === "move" && (_.removed = e), _;
|
|
985
|
-
if (n.op === "test") {
|
|
986
|
-
if (_.test = _e(e, n.value), _.test === !1)
|
|
987
|
-
throw new N("Test operation failed", "TEST_OPERATION_FAILED", f, n, e);
|
|
988
|
-
return _.newDocument = e, _;
|
|
989
|
-
} else {
|
|
990
|
-
if (n.op === "remove")
|
|
991
|
-
return _.removed = e, _.newDocument = null, _;
|
|
992
|
-
if (n.op === "_get")
|
|
993
|
-
return n.value = e, _;
|
|
994
|
-
if (o)
|
|
995
|
-
throw new N("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", f, n, e);
|
|
996
|
-
return _;
|
|
997
|
-
}
|
|
998
|
-
} else {
|
|
999
|
-
s || (e = D(e));
|
|
1000
|
-
var S = n.path || "", A = S.split("/"), g = e, d = 1, w = A.length, P = void 0, b = void 0, J = void 0;
|
|
1001
|
-
for (typeof o == "function" ? J = o : J = Se; ; ) {
|
|
1002
|
-
if (b = A[d], b && b.indexOf("~") != -1 && (b = Ct(b)), l && (b == "__proto__" || b == "prototype" && d > 0 && A[d - 1] == "constructor"))
|
|
1003
|
-
throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");
|
|
1004
|
-
if (o && P === void 0 && (g[b] === void 0 ? P = A.slice(0, d).join("/") : d == w - 1 && (P = n.path), P !== void 0 && J(n, 0, e, P)), d++, Array.isArray(g)) {
|
|
1005
|
-
if (b === "-")
|
|
1006
|
-
b = g.length;
|
|
1007
|
-
else {
|
|
1008
|
-
if (o && !Ze(b))
|
|
1009
|
-
throw new N("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index", "OPERATION_PATH_ILLEGAL_ARRAY_INDEX", f, n, e);
|
|
1010
|
-
Ze(b) && (b = ~~b);
|
|
1011
|
-
}
|
|
1012
|
-
if (d >= w) {
|
|
1013
|
-
if (o && n.op === "add" && b > g.length)
|
|
1014
|
-
throw new N("The specified index MUST NOT be greater than the number of elements in the array", "OPERATION_VALUE_OUT_OF_BOUNDS", f, n, e);
|
|
1015
|
-
var _ = Ht[n.op].call(n, g, b, e);
|
|
1016
|
-
if (_.test === !1)
|
|
1017
|
-
throw new N("Test operation failed", "TEST_OPERATION_FAILED", f, n, e);
|
|
1018
|
-
return _;
|
|
1019
|
-
}
|
|
1020
|
-
} else if (d >= w) {
|
|
1021
|
-
var _ = se[n.op].call(n, g, b, e);
|
|
1022
|
-
if (_.test === !1)
|
|
1023
|
-
throw new N("Test operation failed", "TEST_OPERATION_FAILED", f, n, e);
|
|
1024
|
-
return _;
|
|
1025
|
-
}
|
|
1026
|
-
if (g = g[b], o && d < w && (!g || typeof g != "object"))
|
|
1027
|
-
throw new N("Cannot perform operation at the desired path", "OPERATION_PATH_UNRESOLVABLE", f, n, e);
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
function nt(e, n, o, s, l) {
|
|
1032
|
-
if (s === void 0 && (s = !0), l === void 0 && (l = !0), o && !Array.isArray(n))
|
|
1033
|
-
throw new N("Patch sequence must be an array", "SEQUENCE_NOT_AN_ARRAY");
|
|
1034
|
-
s || (e = D(e));
|
|
1035
|
-
for (var f = new Array(n.length), _ = 0, S = n.length; _ < S; _++)
|
|
1036
|
-
f[_] = ee(e, n[_], o, !0, l, _), e = f[_].newDocument;
|
|
1037
|
-
return f.newDocument = e, f;
|
|
1038
|
-
}
|
|
1039
|
-
function zt(e, n, o) {
|
|
1040
|
-
var s = ee(e, n);
|
|
1041
|
-
if (s.test === !1)
|
|
1042
|
-
throw new N("Test operation failed", "TEST_OPERATION_FAILED", o, n, e);
|
|
1043
|
-
return s.newDocument;
|
|
1044
|
-
}
|
|
1045
|
-
function Se(e, n, o, s) {
|
|
1046
|
-
if (typeof e != "object" || e === null || Array.isArray(e))
|
|
1047
|
-
throw new N("Operation is not an object", "OPERATION_NOT_AN_OBJECT", n, e, o);
|
|
1048
|
-
if (se[e.op]) {
|
|
1049
|
-
if (typeof e.path != "string")
|
|
1050
|
-
throw new N("Operation `path` property is not a string", "OPERATION_PATH_INVALID", n, e, o);
|
|
1051
|
-
if (e.path.indexOf("/") !== 0 && e.path.length > 0)
|
|
1052
|
-
throw new N('Operation `path` property must start with "/"', "OPERATION_PATH_INVALID", n, e, o);
|
|
1053
|
-
if ((e.op === "move" || e.op === "copy") && typeof e.from != "string")
|
|
1054
|
-
throw new N("Operation `from` property is not present (applicable in `move` and `copy` operations)", "OPERATION_FROM_REQUIRED", n, e, o);
|
|
1055
|
-
if ((e.op === "add" || e.op === "replace" || e.op === "test") && e.value === void 0)
|
|
1056
|
-
throw new N("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_REQUIRED", n, e, o);
|
|
1057
|
-
if ((e.op === "add" || e.op === "replace" || e.op === "test") && et(e.value))
|
|
1058
|
-
throw new N("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED", n, e, o);
|
|
1059
|
-
if (o) {
|
|
1060
|
-
if (e.op == "add") {
|
|
1061
|
-
var l = e.path.split("/").length, f = s.split("/").length;
|
|
1062
|
-
if (l !== f + 1 && l !== f)
|
|
1063
|
-
throw new N("Cannot perform an `add` operation at the desired path", "OPERATION_PATH_CANNOT_ADD", n, e, o);
|
|
1064
|
-
} else if (e.op === "replace" || e.op === "remove" || e.op === "_get") {
|
|
1065
|
-
if (e.path !== s)
|
|
1066
|
-
throw new N("Cannot perform the operation at a path that does not exist", "OPERATION_PATH_UNRESOLVABLE", n, e, o);
|
|
1067
|
-
} else if (e.op === "move" || e.op === "copy") {
|
|
1068
|
-
var _ = { op: "_get", path: e.from, value: void 0 }, S = xt([_], o);
|
|
1069
|
-
if (S && S.name === "OPERATION_PATH_UNRESOLVABLE")
|
|
1070
|
-
throw new N("Cannot perform the operation from a path that does not exist", "OPERATION_FROM_UNRESOLVABLE", n, e, o);
|
|
1071
|
-
}
|
|
1072
|
-
}
|
|
1073
|
-
} else throw new N("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", n, e, o);
|
|
1074
|
-
}
|
|
1075
|
-
function xt(e, n, o) {
|
|
1076
|
-
try {
|
|
1077
|
-
if (!Array.isArray(e))
|
|
1078
|
-
throw new N("Patch sequence must be an array", "SEQUENCE_NOT_AN_ARRAY");
|
|
1079
|
-
if (n)
|
|
1080
|
-
nt(D(n), D(e), o || !0);
|
|
1081
|
-
else {
|
|
1082
|
-
o = o || Se;
|
|
1083
|
-
for (var s = 0; s < e.length; s++)
|
|
1084
|
-
o(e[s], s, n, void 0);
|
|
1085
|
-
}
|
|
1086
|
-
} catch (l) {
|
|
1087
|
-
if (l instanceof N)
|
|
1088
|
-
return l;
|
|
1089
|
-
throw l;
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
function _e(e, n) {
|
|
1093
|
-
if (e === n)
|
|
1094
|
-
return !0;
|
|
1095
|
-
if (e && n && typeof e == "object" && typeof n == "object") {
|
|
1096
|
-
var o = Array.isArray(e), s = Array.isArray(n), l, f, _;
|
|
1097
|
-
if (o && s) {
|
|
1098
|
-
if (f = e.length, f != n.length)
|
|
1099
|
-
return !1;
|
|
1100
|
-
for (l = f; l-- !== 0; )
|
|
1101
|
-
if (!_e(e[l], n[l]))
|
|
1102
|
-
return !1;
|
|
1103
|
-
return !0;
|
|
1104
|
-
}
|
|
1105
|
-
if (o != s)
|
|
1106
|
-
return !1;
|
|
1107
|
-
var S = Object.keys(e);
|
|
1108
|
-
if (f = S.length, f !== Object.keys(n).length)
|
|
1109
|
-
return !1;
|
|
1110
|
-
for (l = f; l-- !== 0; )
|
|
1111
|
-
if (!n.hasOwnProperty(S[l]))
|
|
1112
|
-
return !1;
|
|
1113
|
-
for (l = f; l-- !== 0; )
|
|
1114
|
-
if (_ = S[l], !_e(e[_], n[_]))
|
|
1115
|
-
return !1;
|
|
1116
|
-
return !0;
|
|
1117
|
-
}
|
|
1118
|
-
return e !== e && n !== n;
|
|
1119
|
-
}
|
|
1120
|
-
const Vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1121
|
-
__proto__: null,
|
|
1122
|
-
JsonPatchError: N,
|
|
1123
|
-
_areEquals: _e,
|
|
1124
|
-
applyOperation: ee,
|
|
1125
|
-
applyPatch: nt,
|
|
1126
|
-
applyReducer: zt,
|
|
1127
|
-
deepClone: Bt,
|
|
1128
|
-
getValueByPointer: me,
|
|
1129
|
-
validate: xt,
|
|
1130
|
-
validator: Se
|
|
1131
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
1132
|
-
/*!
|
|
1133
|
-
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
1134
|
-
* (c) 2017-2021 Joachim Wester
|
|
1135
|
-
* MIT license
|
|
1136
|
-
*/
|
|
1137
|
-
var rt = /* @__PURE__ */ new WeakMap(), $t = (
|
|
1138
|
-
/** @class */
|
|
1139
|
-
/* @__PURE__ */ function() {
|
|
1140
|
-
function e(n) {
|
|
1141
|
-
this.observers = /* @__PURE__ */ new Map(), this.obj = n;
|
|
1142
|
-
}
|
|
1143
|
-
return e;
|
|
1144
|
-
}()
|
|
1145
|
-
), Xt = (
|
|
1146
|
-
/** @class */
|
|
1147
|
-
/* @__PURE__ */ function() {
|
|
1148
|
-
function e(n, o) {
|
|
1149
|
-
this.callback = n, this.observer = o;
|
|
1150
|
-
}
|
|
1151
|
-
return e;
|
|
1152
|
-
}()
|
|
1153
|
-
);
|
|
1154
|
-
function Wt(e) {
|
|
1155
|
-
return rt.get(e);
|
|
1156
|
-
}
|
|
1157
|
-
function Yt(e, n) {
|
|
1158
|
-
return e.observers.get(n);
|
|
1159
|
-
}
|
|
1160
|
-
function Qt(e, n) {
|
|
1161
|
-
e.observers.delete(n.callback);
|
|
1162
|
-
}
|
|
1163
|
-
function Zt(e, n) {
|
|
1164
|
-
n.unobserve();
|
|
1165
|
-
}
|
|
1166
|
-
function en(e, n) {
|
|
1167
|
-
var o = [], s, l = Wt(e);
|
|
1168
|
-
if (!l)
|
|
1169
|
-
l = new $t(e), rt.set(e, l);
|
|
1170
|
-
else {
|
|
1171
|
-
var f = Yt(l, n);
|
|
1172
|
-
s = f && f.observer;
|
|
1173
|
-
}
|
|
1174
|
-
if (s)
|
|
1175
|
-
return s;
|
|
1176
|
-
if (s = {}, l.value = D(e), n) {
|
|
1177
|
-
s.callback = n, s.next = null;
|
|
1178
|
-
var _ = function() {
|
|
1179
|
-
tt(s);
|
|
1180
|
-
}, S = function() {
|
|
1181
|
-
clearTimeout(s.next), s.next = setTimeout(_);
|
|
1182
|
-
};
|
|
1183
|
-
typeof window < "u" && (window.addEventListener("mouseup", S), window.addEventListener("keyup", S), window.addEventListener("mousedown", S), window.addEventListener("keydown", S), window.addEventListener("change", S));
|
|
1184
|
-
}
|
|
1185
|
-
return s.patches = o, s.object = e, s.unobserve = function() {
|
|
1186
|
-
tt(s), clearTimeout(s.next), Qt(l, s), typeof window < "u" && (window.removeEventListener("mouseup", S), window.removeEventListener("keyup", S), window.removeEventListener("mousedown", S), window.removeEventListener("keydown", S), window.removeEventListener("change", S));
|
|
1187
|
-
}, l.observers.set(n, new Xt(n, s)), s;
|
|
1188
|
-
}
|
|
1189
|
-
function tt(e, n) {
|
|
1190
|
-
n === void 0 && (n = !1);
|
|
1191
|
-
var o = rt.get(e.object);
|
|
1192
|
-
it(o.value, e.object, e.patches, "", n), e.patches.length && nt(o.value, e.patches);
|
|
1193
|
-
var s = e.patches;
|
|
1194
|
-
return s.length > 0 && (e.patches = [], e.callback && e.callback(s)), s;
|
|
1195
|
-
}
|
|
1196
|
-
function it(e, n, o, s, l) {
|
|
1197
|
-
if (n !== e) {
|
|
1198
|
-
typeof n.toJSON == "function" && (n = n.toJSON());
|
|
1199
|
-
for (var f = Qe(n), _ = Qe(e), S = !1, A = _.length - 1; A >= 0; A--) {
|
|
1200
|
-
var g = _[A], d = e[g];
|
|
1201
|
-
if (Ye(n, g) && !(n[g] === void 0 && d !== void 0 && Array.isArray(n) === !1)) {
|
|
1202
|
-
var w = n[g];
|
|
1203
|
-
typeof d == "object" && d != null && typeof w == "object" && w != null && Array.isArray(d) === Array.isArray(w) ? it(d, w, o, s + "/" + Z(g), l) : d !== w && (l && o.push({ op: "test", path: s + "/" + Z(g), value: D(d) }), o.push({ op: "replace", path: s + "/" + Z(g), value: D(w) }));
|
|
1204
|
-
} else Array.isArray(e) === Array.isArray(n) ? (l && o.push({ op: "test", path: s + "/" + Z(g), value: D(d) }), o.push({ op: "remove", path: s + "/" + Z(g) }), S = !0) : (l && o.push({ op: "test", path: s, value: e }), o.push({ op: "replace", path: s, value: n }));
|
|
1205
|
-
}
|
|
1206
|
-
if (!(!S && f.length == _.length))
|
|
1207
|
-
for (var A = 0; A < f.length; A++) {
|
|
1208
|
-
var g = f[A];
|
|
1209
|
-
!Ye(e, g) && n[g] !== void 0 && o.push({ op: "add", path: s + "/" + Z(g), value: D(n[g]) });
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
function tn(e, n, o) {
|
|
1214
|
-
o === void 0 && (o = !1);
|
|
1215
|
-
var s = [];
|
|
1216
|
-
return it(e, n, s, "", o), s;
|
|
1217
|
-
}
|
|
1218
|
-
const nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1219
|
-
__proto__: null,
|
|
1220
|
-
compare: tn,
|
|
1221
|
-
generate: tt,
|
|
1222
|
-
observe: en,
|
|
1223
|
-
unobserve: Zt
|
|
1224
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
1225
|
-
Object.assign({}, Vt, nn, {
|
|
1226
|
-
JsonPatchError: At,
|
|
1227
|
-
deepClone: D,
|
|
1228
|
-
escapePathComponent: Z,
|
|
1229
|
-
unescapePathComponent: Ct
|
|
1230
|
-
});
|
|
1231
|
-
var O = /* @__PURE__ */ ((e) => (e.inventory_portal_must_use_transfer_template = "inventory_portal_must_use_transfer_template", e.inventory_portal_use_iframe = "inventory_portal_use_iframe", e.inventory_pos_adjust_v1 = "inventory_pos_adjust_v1", e.inventory_pos_adjust_v2_wastage = "inventory_pos_adjust_v2_wastage", e.inventory_pos_closing_recalculation = "inventory_pos_closing_recalculation", e.inventory_pos_closing_v1 = "inventory_pos_closing_v1", e.inventory_pos_closing_v2 = "inventory_pos_closing_v2", e.inventory_pos_convert_v1 = "inventory_pos_convert_v1", e.inventory_pos_costing = "inventory_pos_costing", e.inventory_pos_stock_return = "inventory_pos_stock_return", e.inventory_pos_transfer_require_fulfillment = "inventory_pos_transfer_require_fulfillment", e.inventory_purchase_order_approval = "inventory_purchase_order_approval", e.inventory_portal_xilnex_transfer_note = "inventory_portal_xilnex_transfer_note", e.inventory_portal_custom_attribute = "inventory_portal_custom_attribute", e.inventory_portal_purchase_order_v2 = "inventory_portal_purchase_order_v2", e.inventory_portal_accept_require_fulfillment = "inventory_portal_accept_require_fulfillment", e.inventory_portal_po_operate_v2 = "inventory_portal_po_operate_v2", e.inventory_pos_allow_receive_order = "inventory_pos_allow_receive_order", e.inventory_xilnex_opening_migration = "inventory_xilnex_opening_migration", e.inventory_ingredient_group = "inventory_ingredient_group", e.inventory_purchase_order_backdate = "inventory_purchase_order_backdate", e.inventory_synergy_opening_migration = "inventory_synergy_opening_migration", e.inventory_netsuite_inventory_transfer_out = "inventory_netsuite_inventory_transfer_out", e.inventory_portal_supplier_preparation_time = "inventory_portal_supplier_preparation_time", e.inventory_backdate_receive = "inventory_backdate_receive", e.inventory_portal_delivery_order_write = "inventory_portal_delivery_order_write", e.inventory_purchase_order_custom_cost = "inventory_purchase_order_custom_cost", e.inventory_bulk_import = "inventory_bulk_import", e.inventory_portal_surcharge = "inventory_portal_surcharge", e.inventory_purchase_order_cost_edit = "inventory_purchase_order_cost_edit", e.inventory_purchase_order_price_adjustment = "inventory_purchase_order_price_adjustment", e.inventory_purchase_order_workflow_allow_to_mark_completed = "inventory_purchase_order_workflow_allow_to_mark_completed", e.inventory_recipe_v2 = "inventory_recipe_v2", e.inventory_print_template = "inventory_print_template", e.inventory_purchase_order_email = "inventory_purchase_order_email", e.inventory_bulk_edit_recipes = "inventory_bulk_edit_recipes", e.inventory_stocksnapshot_cron_beta = "inventory_stocksnapshot_cron_beta", e.inventory_portal_production_item = "inventory_portal_production_item", e.inventory_receive_request_transfer_v3_beta = "inventory_receive_request_transfer_v3_beta", e))(O || {});
|
|
1232
|
-
const rn = /* @__PURE__ */ new Set([
|
|
1233
|
-
// vivo pizza prod
|
|
1234
|
-
"business_6687e91fa7240b001ba3f4c2",
|
|
1235
|
-
// vivo dev
|
|
1236
|
-
"business_669a1d2efc050a001cfbb5a2"
|
|
1237
|
-
]), an = /* @__PURE__ */ new Set([
|
|
1238
|
-
// zus dev
|
|
1239
|
-
"business_671005de24a7f4001c87e25e",
|
|
1240
|
-
// zus prod
|
|
1241
|
-
"business_6776a1fe205a52001c516efa"
|
|
1242
|
-
]);
|
|
1243
|
-
function Tt() {
|
|
1244
|
-
return {
|
|
1245
|
-
isLoaded: !1,
|
|
1246
|
-
autoReceiveWarehouse: !1,
|
|
1247
|
-
businessSupplierOnly: !1,
|
|
1248
|
-
enableBackdatePo: !1,
|
|
1249
|
-
enableClosingTemplate: !1,
|
|
1250
|
-
enableIngredientGroup: !1,
|
|
1251
|
-
enablePoTemplate: !1,
|
|
1252
|
-
enableTotalCost: !1,
|
|
1253
|
-
enableWastageTemplate: !1,
|
|
1254
|
-
manualReceive: !1,
|
|
1255
|
-
mustUseDefaultCost: !1,
|
|
1256
|
-
mustUsePoTemplate: !1,
|
|
1257
|
-
enableXilnexTransferNote: !1,
|
|
1258
|
-
enableCustomAttribute: !1,
|
|
1259
|
-
usePurchaseOrderV2: !1,
|
|
1260
|
-
acceptRequireFulfillment: !1,
|
|
1261
|
-
useOperatePurchaseOrderV2: !1,
|
|
1262
|
-
inventory_xilnex_opening_migration: !1,
|
|
1263
|
-
inventory_synergy_opening_migration: !1,
|
|
1264
|
-
inventory_netsuite_inventory_transfer_out: !1,
|
|
1265
|
-
inventory_portal_supplier_preparation_time: !1,
|
|
1266
|
-
inventory_portal_delivery_order_write: !1,
|
|
1267
|
-
inventory_pos_transfer_require_fulfillment: !1,
|
|
1268
|
-
inventory_backdate_receive: !1,
|
|
1269
|
-
inventory_purchase_order_custom_cost: !1,
|
|
1270
|
-
inventory_bulk_import: !1,
|
|
1271
|
-
inventory_portal_surcharge: !1,
|
|
1272
|
-
inventory_purchase_order_cost_edit: !1,
|
|
1273
|
-
inventory_purchase_order_price_adjustment: !1,
|
|
1274
|
-
inventory_purchase_order_workflow_allow_to_mark_completed: !1,
|
|
1275
|
-
inventory_recipe_v2: !1,
|
|
1276
|
-
inventory_print_template: !1,
|
|
1277
|
-
inventory_purchase_order_email: !1,
|
|
1278
|
-
inventory_bulk_edit_recipes: !1,
|
|
1279
|
-
inventory_receive_request_beta: !1,
|
|
1280
|
-
inventory_receive_request_transfer_v3_beta: !1,
|
|
1281
|
-
inventory_portal_production_item: !1,
|
|
1282
|
-
report_portal_po_forecast_days_constraint: null,
|
|
1283
|
-
report_portal_po_forecast_days_default: 7
|
|
1284
|
-
};
|
|
1285
|
-
}
|
|
1286
|
-
const m = we(Tt()), on = () => ({
|
|
1287
|
-
get businessDbName() {
|
|
1288
|
-
var o;
|
|
1289
|
-
return `business_${((o = Ve().currentBusiness.value) == null ? void 0 : o._id) ?? ""}`;
|
|
1290
|
-
},
|
|
1291
|
-
get isWarehouse() {
|
|
1292
|
-
var n;
|
|
1293
|
-
return ((n = $e()._currentLocation) == null ? void 0 : n.type) === bt.enum.warehouse;
|
|
1294
|
-
},
|
|
1295
|
-
get restaurantPosVersion() {
|
|
1296
|
-
var o;
|
|
1297
|
-
const e = $e();
|
|
1298
|
-
return (o = Ve().restaurants.value.find(
|
|
1299
|
-
(s) => {
|
|
1300
|
-
var l;
|
|
1301
|
-
return s._id === ((l = e._currentLocation) == null ? void 0 : l.doc._id);
|
|
1302
|
-
}
|
|
1303
|
-
)) == null ? void 0 : o.posVersion;
|
|
1304
|
-
},
|
|
1305
|
-
get enableTotalCost() {
|
|
1306
|
-
return m.value.enableTotalCost;
|
|
1307
|
-
},
|
|
1308
|
-
get enableBackdatePo() {
|
|
1309
|
-
return m.value.enableBackdatePo;
|
|
1310
|
-
},
|
|
1311
|
-
/** @deprecated TODO: remove */
|
|
1312
|
-
get autoReceiveWarehouse() {
|
|
1313
|
-
return m.value.autoReceiveWarehouse;
|
|
1314
|
-
},
|
|
1315
|
-
/** @deprecated TODO: remove */
|
|
1316
|
-
get manualReceive() {
|
|
1317
|
-
return m.value.manualReceive;
|
|
1318
|
-
},
|
|
1319
|
-
get isLoaded() {
|
|
1320
|
-
return m.value.isLoaded;
|
|
1321
|
-
},
|
|
1322
|
-
get enablePoTemplate() {
|
|
1323
|
-
return m.value.enablePoTemplate;
|
|
1324
|
-
},
|
|
1325
|
-
get enableClosingTemplate() {
|
|
1326
|
-
return m.value.enableClosingTemplate;
|
|
1327
|
-
},
|
|
1328
|
-
get enableWastageTemplate() {
|
|
1329
|
-
return m.value.enableWastageTemplate;
|
|
1330
|
-
},
|
|
1331
|
-
get enableIngredientGroup() {
|
|
1332
|
-
return m.value.enableIngredientGroup;
|
|
1333
|
-
},
|
|
1334
|
-
get mustUsePoTemplate() {
|
|
1335
|
-
return m.value.mustUsePoTemplate;
|
|
1336
|
-
},
|
|
1337
|
-
get businessSupplierOnly() {
|
|
1338
|
-
return m.value.businessSupplierOnly;
|
|
1339
|
-
},
|
|
1340
|
-
get enableXilnexTransferNote() {
|
|
1341
|
-
return m.value.enableXilnexTransferNote;
|
|
1342
|
-
},
|
|
1343
|
-
get enabledXilnexOpeningMigration() {
|
|
1344
|
-
return m.value.inventory_xilnex_opening_migration;
|
|
1345
|
-
},
|
|
1346
|
-
get enabledSynergyOpeningMigration() {
|
|
1347
|
-
return m.value.inventory_synergy_opening_migration;
|
|
1348
|
-
},
|
|
1349
|
-
get enableCustomAttribute() {
|
|
1350
|
-
return m.value.enableCustomAttribute;
|
|
1351
|
-
},
|
|
1352
|
-
get usePurchaseOrderV2() {
|
|
1353
|
-
return m.value.usePurchaseOrderV2;
|
|
1354
|
-
},
|
|
1355
|
-
get acceptRequireFulfillment() {
|
|
1356
|
-
return m.value.acceptRequireFulfillment;
|
|
1357
|
-
},
|
|
1358
|
-
get useOperatePurchaseOrderV2() {
|
|
1359
|
-
return m.value.useOperatePurchaseOrderV2;
|
|
1360
|
-
},
|
|
1361
|
-
get isNetSuiteInventoryTransferOutEnabled() {
|
|
1362
|
-
return m.value.inventory_netsuite_inventory_transfer_out;
|
|
1363
|
-
},
|
|
1364
|
-
get enableSupplierPreparationTime() {
|
|
1365
|
-
return m.value.inventory_portal_supplier_preparation_time;
|
|
1366
|
-
},
|
|
1367
|
-
get enablePortalDeliveryOrderWrite() {
|
|
1368
|
-
return m.value.inventory_portal_delivery_order_write ?? !0;
|
|
1369
|
-
},
|
|
1370
|
-
get enablePOSTransferRequireFulfillment() {
|
|
1371
|
-
return m.value.inventory_pos_transfer_require_fulfillment;
|
|
1372
|
-
},
|
|
1373
|
-
get enableBackdateReceive() {
|
|
1374
|
-
return m.value.inventory_backdate_receive;
|
|
1375
|
-
},
|
|
1376
|
-
get enablePurchaseOrderReceiveWithCustomCost() {
|
|
1377
|
-
return m.value.inventory_purchase_order_custom_cost;
|
|
1378
|
-
},
|
|
1379
|
-
get enableBulkImport() {
|
|
1380
|
-
return m.value.inventory_bulk_import;
|
|
1381
|
-
},
|
|
1382
|
-
get enableSurcharge() {
|
|
1383
|
-
return m.value.inventory_portal_surcharge;
|
|
1384
|
-
},
|
|
1385
|
-
get enablePurchaseOrderCostEdit() {
|
|
1386
|
-
return m.value.inventory_purchase_order_cost_edit;
|
|
1387
|
-
},
|
|
1388
|
-
get enablePurchaseOrderPriceAdjustment() {
|
|
1389
|
-
return m.value.inventory_purchase_order_price_adjustment;
|
|
1390
|
-
},
|
|
1391
|
-
get poWorkflowAllowToMarkCompleted() {
|
|
1392
|
-
return m.value.inventory_purchase_order_workflow_allow_to_mark_completed;
|
|
1393
|
-
},
|
|
1394
|
-
get enableRecipeV2() {
|
|
1395
|
-
return m.value.inventory_recipe_v2;
|
|
1396
|
-
},
|
|
1397
|
-
get enablePrintTemplate() {
|
|
1398
|
-
return m.value.inventory_print_template;
|
|
1399
|
-
},
|
|
1400
|
-
get enablePurchaseOrderEmail() {
|
|
1401
|
-
return m.value.inventory_purchase_order_email;
|
|
1402
|
-
},
|
|
1403
|
-
get enableBulkEditRecipes() {
|
|
1404
|
-
return m.value.inventory_bulk_edit_recipes;
|
|
1405
|
-
},
|
|
1406
|
-
get enableReceiveRequestBeta() {
|
|
1407
|
-
return m.value.inventory_receive_request_beta;
|
|
1408
|
-
},
|
|
1409
|
-
get enableTransferV3Beta() {
|
|
1410
|
-
return m.value.inventory_receive_request_transfer_v3_beta;
|
|
1411
|
-
},
|
|
1412
|
-
get enableProductionItem() {
|
|
1413
|
-
return m.value.inventory_portal_production_item;
|
|
1414
|
-
},
|
|
1415
|
-
get poForecastDaysConstraint() {
|
|
1416
|
-
return m.value.report_portal_po_forecast_days_constraint;
|
|
1417
|
-
},
|
|
1418
|
-
get poForecastDaysDefault() {
|
|
1419
|
-
return m.value.report_portal_po_forecast_days_default;
|
|
1420
|
-
},
|
|
1421
|
-
async init() {
|
|
1422
|
-
const e = Ve(), { init: n, setBusiness: o } = be(), s = Dt(), l = e.namespace.value === "prod";
|
|
1423
|
-
await n({
|
|
1424
|
-
apiKey: l ? "6GhcttsJ9Rj9cTevcdrpin" : "MaGoXrEWuEJNpWgKTqseee"
|
|
1425
|
-
// url: 'https://flag.feedme.farm/api/v1/', // optional -> this is a default URL value
|
|
1426
|
-
// enableAnalytics: true, // optional, defaults to true
|
|
1427
|
-
// cacheFlags: true // optional, defaults to true
|
|
1428
|
-
}), $e().watchLocation(async (_) => {
|
|
1429
|
-
var b, J, te;
|
|
1430
|
-
if (!_) {
|
|
1431
|
-
m.value = Tt();
|
|
1432
|
-
return;
|
|
1433
|
-
}
|
|
1434
|
-
const S = ((b = e.currentBusiness.value) == null ? void 0 : b._id) ?? "";
|
|
1435
|
-
await o(S);
|
|
1436
|
-
const A = `business_${S}`, g = _.type === bt.enum.warehouse, d = (
|
|
1437
|
-
// if menu v4, must manual receive && must use outlet app
|
|
1438
|
-
((J = e.currentBusiness.value) == null ? void 0 : J.menuVersion) === "v4" && // more guard for businesses using menu v4, only those listed for manual receive will be included
|
|
1439
|
-
// TODO: may be removed to use menu version only
|
|
1440
|
-
rn.has(this.businessDbName)
|
|
1441
|
-
), w = an.has(A) || E(O.inventory_portal_must_use_transfer_template), P = E(O.inventory_purchase_order_backdate) && (this.isWarehouse || s.state.closing !== null);
|
|
1442
|
-
m.value = {
|
|
1443
|
-
isLoaded: !0,
|
|
1444
|
-
enableTotalCost: ((te = e.currentBusiness.value) == null ? void 0 : te.menuVersion) === "v4",
|
|
1445
|
-
enableBackdatePo: P,
|
|
1446
|
-
autoReceiveWarehouse: g && !d,
|
|
1447
|
-
manualReceive: d,
|
|
1448
|
-
enablePoTemplate: w,
|
|
1449
|
-
enableClosingTemplate: E(O.inventory_pos_closing_v2),
|
|
1450
|
-
enableWastageTemplate: E(O.inventory_pos_adjust_v2_wastage),
|
|
1451
|
-
enableIngredientGroup: E(O.inventory_ingredient_group),
|
|
1452
|
-
mustUsePoTemplate: w,
|
|
1453
|
-
businessSupplierOnly: w,
|
|
1454
|
-
enableXilnexTransferNote: E(O.inventory_portal_xilnex_transfer_note),
|
|
1455
|
-
enableCustomAttribute: E(O.inventory_portal_custom_attribute),
|
|
1456
|
-
usePurchaseOrderV2: E(O.inventory_portal_purchase_order_v2),
|
|
1457
|
-
acceptRequireFulfillment: E(
|
|
1458
|
-
O.inventory_portal_accept_require_fulfillment
|
|
1459
|
-
),
|
|
1460
|
-
useOperatePurchaseOrderV2: E(O.inventory_portal_po_operate_v2),
|
|
1461
|
-
inventory_xilnex_opening_migration: E(
|
|
1462
|
-
O.inventory_xilnex_opening_migration
|
|
1463
|
-
),
|
|
1464
|
-
inventory_synergy_opening_migration: E(
|
|
1465
|
-
O.inventory_synergy_opening_migration
|
|
1466
|
-
),
|
|
1467
|
-
inventory_netsuite_inventory_transfer_out: E(
|
|
1468
|
-
O.inventory_netsuite_inventory_transfer_out
|
|
1469
|
-
),
|
|
1470
|
-
inventory_portal_supplier_preparation_time: E(
|
|
1471
|
-
O.inventory_portal_supplier_preparation_time
|
|
1472
|
-
),
|
|
1473
|
-
inventory_portal_delivery_order_write: E(
|
|
1474
|
-
O.inventory_portal_delivery_order_write
|
|
1475
|
-
),
|
|
1476
|
-
inventory_pos_transfer_require_fulfillment: E(
|
|
1477
|
-
O.inventory_pos_transfer_require_fulfillment
|
|
1478
|
-
),
|
|
1479
|
-
inventory_backdate_receive: E(O.inventory_backdate_receive),
|
|
1480
|
-
inventory_purchase_order_custom_cost: E(
|
|
1481
|
-
O.inventory_purchase_order_custom_cost
|
|
1482
|
-
),
|
|
1483
|
-
inventory_bulk_import: E(O.inventory_bulk_import),
|
|
1484
|
-
inventory_portal_surcharge: E(O.inventory_portal_surcharge),
|
|
1485
|
-
inventory_purchase_order_cost_edit: E(
|
|
1486
|
-
O.inventory_purchase_order_cost_edit
|
|
1487
|
-
),
|
|
1488
|
-
inventory_purchase_order_price_adjustment: E(
|
|
1489
|
-
O.inventory_purchase_order_price_adjustment
|
|
1490
|
-
),
|
|
1491
|
-
inventory_purchase_order_workflow_allow_to_mark_completed: E(
|
|
1492
|
-
O.inventory_purchase_order_workflow_allow_to_mark_completed
|
|
1493
|
-
),
|
|
1494
|
-
inventory_recipe_v2: E(O.inventory_recipe_v2),
|
|
1495
|
-
inventory_print_template: E(O.inventory_print_template),
|
|
1496
|
-
inventory_purchase_order_email: E(O.inventory_purchase_order_email),
|
|
1497
|
-
inventory_bulk_edit_recipes: E(O.inventory_bulk_edit_recipes),
|
|
1498
|
-
inventory_receive_request_beta: E("inventory_receive_request_beta"),
|
|
1499
|
-
inventory_receive_request_transfer_v3_beta: E(
|
|
1500
|
-
O.inventory_receive_request_transfer_v3_beta
|
|
1501
|
-
),
|
|
1502
|
-
inventory_portal_production_item: E(O.inventory_portal_production_item),
|
|
1503
|
-
report_portal_po_forecast_days_constraint: sn(
|
|
1504
|
-
"report_portal_po_forecast_days_constraint"
|
|
1505
|
-
),
|
|
1506
|
-
report_portal_po_forecast_days_default: ln(
|
|
1507
|
-
"report_portal_po_forecast_days_default",
|
|
1508
|
-
7
|
|
1509
|
-
)
|
|
1510
|
-
};
|
|
1511
|
-
}, "feature");
|
|
1512
|
-
},
|
|
1513
|
-
async awaitFeatureLoaded(e) {
|
|
1514
|
-
return new Promise((n) => {
|
|
1515
|
-
const o = () => {
|
|
1516
|
-
m.value.isLoaded ? n(e()) : setTimeout(o, 100);
|
|
1517
|
-
};
|
|
1518
|
-
o();
|
|
1519
|
-
});
|
|
1520
|
-
}
|
|
1521
|
-
});
|
|
1522
|
-
function E(e, n) {
|
|
1523
|
-
n = n === void 0 ? null : n;
|
|
1524
|
-
const { getFlagValue: o } = be();
|
|
1525
|
-
return o(e, (s) => s === "true") ?? n;
|
|
1526
|
-
}
|
|
1527
|
-
function sn(e) {
|
|
1528
|
-
const { getFlagValue: n } = be();
|
|
1529
|
-
return n(e, (s) => s.trim() ? s.trim() : null) ?? null;
|
|
1530
|
-
}
|
|
1531
|
-
function ln(e, n) {
|
|
1532
|
-
const { getFlagValue: o } = be();
|
|
1533
|
-
return o(e, (l) => {
|
|
1534
|
-
const f = parseInt(l, 10);
|
|
1535
|
-
return isNaN(f) ? null : f;
|
|
1536
|
-
}) ?? n;
|
|
1537
|
-
}
|
|
1538
|
-
const pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1539
|
-
__proto__: null,
|
|
1540
|
-
InventoryFeatureFlags: O,
|
|
1541
|
-
useFeatureStore: on
|
|
1542
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
1543
|
-
export {
|
|
1544
|
-
O as I,
|
|
1545
|
-
be as a,
|
|
1546
|
-
pn as f,
|
|
1547
|
-
on as u
|
|
1548
|
-
};
|