@feedmepos/mf-order-setting 0.0.102 → 0.0.103
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/{DisplaySystemView-jnt6letY.js → DisplaySystemView-BBiZqcWq.js} +1497 -1468
- package/dist/{FoodCourtInvitationsView-DoynqFWB.js → FoodCourtInvitationsView-DwOkVs9m.js} +4 -4
- package/dist/{FoodCourtOrderSettingsView-DYZLhTHy.js → FoodCourtOrderSettingsView-C9Ag5Bsg.js} +1 -1
- package/dist/FoodCourtOrdersView-y4EwK3sn.js +1173 -0
- package/dist/{FoodCourtStallsView-CRMTt5BB.js → FoodCourtStallsView-Bi8H-yR7.js} +2 -2
- package/dist/{FoodCourtStatusView-C-b-eI-8.js → FoodCourtStatusView-jugAzTKg.js} +1 -1
- package/dist/KioskDevicesView-CYiew4X5.js +4 -0
- package/dist/KioskDevicesView.vue_vue_type_script_setup_true_lang-BCvbeo7R.js +1497 -0
- package/dist/KioskSettingView-AKBiij9a.js +1124 -0
- package/dist/KioskView-zKB6mC8I.js +765 -0
- package/dist/{OrderSettingsView-BBCnekaj.js → OrderSettingsView-CoV_yX3m.js} +22064 -21635
- package/dist/{RestaurantSelector.vue_vue_type_script_setup_true_lang-DjoTyV6m.js → RestaurantSelector.vue_vue_type_script_setup_true_lang-KSMU_jGl.js} +1 -1
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/{app-Dvk30CIa.js → app-CmuI6uSl.js} +3589 -2902
- package/dist/app.js +1 -1
- package/dist/{dayjs.min-DUFHhM7O.js → dayjs.min-B3MssMma.js} +1 -1
- package/dist/{featureFlag-BvcirzHS.js → featureFlag-CWvkPOBY.js} +123 -130
- package/dist/frontend/mf-order/src/api/food-court/index.d.ts +51 -0
- package/dist/frontend/mf-order/src/api/kiosk/index.d.ts +4 -0
- package/dist/frontend/mf-order/src/api/payment/index.d.ts +8 -0
- package/dist/frontend/mf-order/src/api/queue/index.d.ts +13 -0
- package/dist/frontend/mf-order/src/api/restaurant-setting/index.d.ts +9 -1
- package/dist/frontend/mf-order/src/app.d.ts +687 -0
- package/dist/frontend/mf-order/src/main.d.ts +687 -0
- package/dist/frontend/mf-order/src/modules/display-system/interface.d.ts +5 -0
- package/dist/frontend/mf-order/src/modules/kiosk/interface.d.ts +4 -0
- package/dist/frontend/mf-order/src/modules/kiosk/license.d.ts +92 -0
- package/dist/frontend/mf-order/src/modules/kiosk/outletLoad.d.ts +15 -0
- package/dist/frontend/mf-order/src/modules/kiosk/settingsSections.d.ts +24 -0
- package/dist/frontend/mf-order/src/modules/kiosk/useKioskSettings.d.ts +29 -0
- package/dist/frontend/mf-order/src/modules/payment/paymentDevice.d.ts +58 -0
- package/dist/frontend/mf-order/src/stores/kiosk/index.d.ts +67 -1
- package/dist/frontend/mf-order/src/stores/order-setting/index.d.ts +19 -10
- package/dist/frontend/mf-order/src/stores/payment/index.d.ts +59 -1
- package/dist/frontend/mf-order/src/views/food-court/food-court-export.d.ts +38 -0
- package/dist/frontend/mf-order/src/views/kiosk/devices/KioskDeviceCard.vue.d.ts +3 -0
- package/dist/frontend/mf-order/src/views/kiosk/devices/KioskDevicesView.vue.d.ts +7 -0
- package/dist/frontend/mf-order/src/views/kiosk/devices/KioskLicenseSummary.vue.d.ts +7 -0
- package/dist/frontend/mf-order/src/views/kiosk/devices/KioskLicensesView.vue.d.ts +6 -0
- package/dist/frontend/mf-order/src/views/kiosk/devices/KioskOtpDialog.vue.d.ts +3 -0
- package/dist/frontend/mf-order/src/views/kiosk/devices/KioskPaymentDeviceCard.vue.d.ts +17 -0
- package/dist/frontend/mf-order/src/views/kiosk/settings/KioskSettingView.vue.d.ts +5 -2
- package/dist/frontend/mf-order/src/views/order-settings/pickup/PickUpSettingDialogContent.vue.d.ts +0 -9
- package/dist/frontend/mf-order/src/views/order-settings/pos-status/PosOrderingStatus.vue.d.ts +17 -0
- package/dist/frontend/mf-order/src/views/order-settings/pos-status/pos-status.d.ts +44 -0
- package/dist/frontend/mf-order/src/views/order-settings/queue/called-message.d.ts +1 -0
- package/dist/frontend/mf-order/src/views/order-settings/queue/phone-join-mode.d.ts +25 -0
- package/dist/frontend/mf-order/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{index-C4n5H7t3.js → index-BQa8AudZ.js} +3 -3
- package/dist/index-CMOvrim4.js +147 -0
- package/dist/{index-CW4VlFWz.js → index-D5qh2_4b.js} +1 -1
- package/dist/{index-C5n6lil6.js → index-Dup6kWLX.js} +6 -6
- package/dist/{index-CGxCWKHB.js → index-wuFIsXHT.js} +188 -179
- package/dist/{order.dto-Cb_gh3iB.js → order.dto-BD9raQG5.js} +2782 -2735
- package/dist/package/entity/display/blocks.d.ts +12 -2
- package/dist/package/entity/marketing/marketing.dto.d.ts +18 -18
- package/dist/package/entity/order-platform/external/reconciliation/external-reconciliation.do.d.ts +24 -24
- package/dist/package/entity/order-platform/menu.dto.d.ts +20 -20
- package/dist/package/entity/order-setting/order-setting.do.d.ts +10 -0
- package/dist/package/entity/order-setting/order-setting.dto.d.ts +26 -0
- package/dist/package/entity/order-setting/queue/queue.do.d.ts +23 -0
- package/dist/package/entity/order-setting/queue/queue.dto.d.ts +14 -0
- package/dist/package/entity/queue/queue.do.d.ts +153 -0
- package/dist/package/entity/queue/queue.dto.d.ts +221 -2
- package/dist/package/entity/queue/queue.enum.d.ts +5 -0
- package/dist/package/entity/restaurant/restaurant.dto.d.ts +20 -0
- package/dist/style.css +1 -1
- package/dist/{index-ILnighyU.js → useInternalUser-CHtaur9A.js} +93 -81
- package/package.json +2 -1
- package/src/api/food-court/index.ts +63 -0
- package/src/api/kiosk/index.ts +8 -0
- package/src/api/payment/index.ts +18 -1
- package/src/api/queue/index.ts +39 -0
- package/src/api/restaurant-setting/index.ts +14 -0
- package/src/locales/en-US.json +197 -26
- package/src/locales/ja-JP.json +193 -23
- package/src/locales/th-TH.json +193 -21
- package/src/locales/zh-CN.json +197 -23
- package/src/modules/display-system/interface.spec.ts +26 -1
- package/src/modules/display-system/interface.ts +20 -0
- package/src/modules/kiosk/interface.ts +4 -0
- package/src/modules/kiosk/license.spec.ts +167 -0
- package/src/modules/kiosk/license.ts +175 -0
- package/src/modules/kiosk/outletLoad.spec.ts +25 -0
- package/src/modules/kiosk/outletLoad.ts +19 -0
- package/src/modules/kiosk/settingsSections.spec.ts +85 -0
- package/src/modules/kiosk/settingsSections.ts +82 -0
- package/src/modules/kiosk/useKioskSettings.spec.ts +157 -0
- package/src/modules/kiosk/useKioskSettings.ts +61 -0
- package/src/modules/payment/paymentDevice.spec.ts +175 -0
- package/src/modules/payment/paymentDevice.ts +156 -0
- package/src/stores/kiosk/index.ts +16 -1
- package/src/stores/kiosk/mapper.ts +2 -0
- package/src/stores/order-setting/index.spec.ts +83 -0
- package/src/stores/order-setting/index.ts +49 -27
- package/src/stores/payment/index.spec.ts +86 -0
- package/src/stores/payment/index.ts +48 -2
- package/src/views/display-system/DisplayInspector.vue +17 -8
- package/src/views/display-system/DisplayTemplateEditor.vue +3 -1
- package/src/views/food-court/FoodCourtOrdersView.vue +46 -1
- package/src/views/food-court/food-court-export.spec.ts +151 -0
- package/src/views/food-court/food-court-export.ts +283 -0
- package/src/views/kiosk/KioskStatePanel.vue +2 -2
- package/src/views/kiosk/KioskView.vue +219 -82
- package/src/views/kiosk/devices/KioskDeviceCard.vue +148 -23
- package/src/views/kiosk/devices/KioskDevicesView.vue +48 -10
- package/src/views/kiosk/devices/KioskLicenseSummary.vue +79 -0
- package/src/views/kiosk/devices/KioskLicensesView.vue +152 -0
- package/src/views/kiosk/devices/KioskOtpDialog.vue +41 -1
- package/src/views/kiosk/devices/KioskPaymentDeviceCard.spec.ts +97 -0
- package/src/views/kiosk/devices/KioskPaymentDeviceCard.vue +221 -0
- package/src/views/kiosk/settings/KioskPaymentTypeSection.vue +1 -1
- package/src/views/kiosk/settings/KioskSettingView.vue +702 -419
- package/src/views/order-settings/delivery/DeliverySetting.vue +4 -0
- package/src/views/order-settings/dine-in/DineInSetting.vue +4 -0
- package/src/views/order-settings/pickup/PickUpSetting.vue +4 -4
- package/src/views/order-settings/pickup/PickUpSettingDialogContent.vue +0 -23
- package/src/views/order-settings/pos-status/PosOrderingStatus.spec.ts +207 -0
- package/src/views/order-settings/pos-status/PosOrderingStatus.vue +209 -0
- package/src/views/order-settings/pos-status/pos-status.spec.ts +103 -0
- package/src/views/order-settings/pos-status/pos-status.ts +86 -0
- package/src/views/order-settings/queue/QueueSetting.source.spec.ts +43 -0
- package/src/views/order-settings/queue/QueueSetting.vue +289 -15
- package/src/views/order-settings/queue/called-message.spec.ts +29 -1
- package/src/views/order-settings/queue/called-message.ts +18 -0
- package/src/views/order-settings/queue/phone-join-mode.spec.ts +90 -0
- package/src/views/order-settings/queue/phone-join-mode.ts +49 -0
- package/dist/FoodCourtOrdersView-CAPOycT3.js +0 -544
- package/dist/KioskDevicesView-B0U9JxRl.js +0 -4
- package/dist/KioskDevicesView.vue_vue_type_script_setup_true_lang-V3ai4FVI.js +0 -937
- package/dist/KioskSettingView-rdom_aS8.js +0 -880
- package/dist/KioskView-DOON9zR6.js +0 -516
- package/dist/frontend/mf-order/src/views/kiosk/settings/KioskDisplayStandSection.vue.d.ts +0 -10
- package/dist/frontend/mf-order/src/views/kiosk/settings/KioskInstructionSection.vue.d.ts +0 -15
- package/dist/frontend/mf-order/src/views/kiosk/settings/KioskPickAtCounterSection.vue.d.ts +0 -10
- package/dist/index-CaHG3M7C.js +0 -135
- package/src/views/kiosk/settings/KioskDisplayStandSection.vue +0 -189
- package/src/views/kiosk/settings/KioskInstructionSection.vue +0 -40
- package/src/views/kiosk/settings/KioskPickAtCounterSection.vue +0 -68
package/dist/app.js
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
var le = Object.defineProperty;
|
|
2
|
-
var ue = (
|
|
3
|
-
var ot = (
|
|
2
|
+
var ue = (C, c, y) => c in C ? le(C, c, { enumerable: !0, configurable: !0, writable: !0, value: y }) : C[c] = y;
|
|
3
|
+
var ot = (C, c, y) => ue(C, typeof c != "symbol" ? c + "" : c, y);
|
|
4
4
|
import { readonly as Pt, ref as Ut } from "vue";
|
|
5
|
-
import { c as st } from "./app-
|
|
6
|
-
const _e = (S, c) => {
|
|
7
|
-
const v = S.__vccOpts || S;
|
|
8
|
-
for (const [d, s] of c)
|
|
9
|
-
v[d] = s;
|
|
10
|
-
return v;
|
|
11
|
-
};
|
|
5
|
+
import { c as st } from "./app-CmuI6uSl.js";
|
|
12
6
|
var lt = { exports: {} }, ee;
|
|
13
7
|
function ce() {
|
|
14
|
-
return ee || (ee = 1, function(
|
|
15
|
-
(function(
|
|
16
|
-
|
|
17
|
-
})(st, function(
|
|
18
|
-
var
|
|
8
|
+
return ee || (ee = 1, function(C, c) {
|
|
9
|
+
(function(y, p) {
|
|
10
|
+
p(c);
|
|
11
|
+
})(st, function(y) {
|
|
12
|
+
var p = { getItemSync: function(a) {
|
|
19
13
|
try {
|
|
20
14
|
return localStorage.getItem(a) || null;
|
|
21
15
|
} catch {
|
|
@@ -47,24 +41,24 @@ function ce() {
|
|
|
47
41
|
};
|
|
48
42
|
function N(a, e, t, i) {
|
|
49
43
|
return new (t || (t = Promise))(function(n, r) {
|
|
50
|
-
function o(
|
|
44
|
+
function o(d) {
|
|
51
45
|
try {
|
|
52
|
-
h(i.next(
|
|
46
|
+
h(i.next(d));
|
|
53
47
|
} catch (l) {
|
|
54
48
|
r(l);
|
|
55
49
|
}
|
|
56
50
|
}
|
|
57
|
-
function u(
|
|
51
|
+
function u(d) {
|
|
58
52
|
try {
|
|
59
|
-
h(i.throw(
|
|
53
|
+
h(i.throw(d));
|
|
60
54
|
} catch (l) {
|
|
61
55
|
r(l);
|
|
62
56
|
}
|
|
63
57
|
}
|
|
64
|
-
function h(
|
|
58
|
+
function h(d) {
|
|
65
59
|
var l;
|
|
66
|
-
|
|
67
|
-
|
|
60
|
+
d.done ? n(d.value) : (l = d.value, l instanceof t ? l : new t(function(g) {
|
|
61
|
+
g(l);
|
|
68
62
|
})).then(o, u);
|
|
69
63
|
}
|
|
70
64
|
h((i = i.apply(a, [])).next());
|
|
@@ -79,7 +73,7 @@ function ce() {
|
|
|
79
73
|
return this;
|
|
80
74
|
}), r;
|
|
81
75
|
function u(h) {
|
|
82
|
-
return function(
|
|
76
|
+
return function(d) {
|
|
83
77
|
return function(l) {
|
|
84
78
|
if (t) throw new TypeError("Generator is already executing.");
|
|
85
79
|
for (; o; ) try {
|
|
@@ -118,14 +112,14 @@ function ce() {
|
|
|
118
112
|
continue;
|
|
119
113
|
}
|
|
120
114
|
l = e.call(a, o);
|
|
121
|
-
} catch (
|
|
122
|
-
l = [6,
|
|
115
|
+
} catch (g) {
|
|
116
|
+
l = [6, g], i = 0;
|
|
123
117
|
} finally {
|
|
124
118
|
t = n = 0;
|
|
125
119
|
}
|
|
126
120
|
if (5 & l[0]) throw l[1];
|
|
127
121
|
return { value: l[0] ? l[1] : void 0, done: !0 };
|
|
128
|
-
}([h,
|
|
122
|
+
}([h, d]);
|
|
129
123
|
};
|
|
130
124
|
}
|
|
131
125
|
}
|
|
@@ -165,7 +159,7 @@ function ce() {
|
|
|
165
159
|
Object.keys(e || {}).includes(i) || t.push(i);
|
|
166
160
|
}), Object.keys(t).length ? t : null;
|
|
167
161
|
}
|
|
168
|
-
var
|
|
162
|
+
var v, S;
|
|
169
163
|
function _(a, e, t) {
|
|
170
164
|
var i = "shortString", n = !0;
|
|
171
165
|
typeof t == "number" && (i = "javaDouble", n = !1), a[i] = a[i] || {}, a[i][e] = n ? t + "" : t;
|
|
@@ -184,7 +178,7 @@ function ce() {
|
|
|
184
178
|
}
|
|
185
179
|
(function(a) {
|
|
186
180
|
a.NONE = "NONE", a.DEFAULT_FLAGS = "DEFAULT_FLAGS", a.CACHE = "CACHE", a.SERVER = "SERVER";
|
|
187
|
-
})(
|
|
181
|
+
})(v || (v = {}));
|
|
188
182
|
var ht, O = null, ie = "FLAGSMITH_EVENT", at = ie, Kt = "https://edge.api.flagsmith.com/api/v1/", Dt = "flagsmith_value_", Gt = "flagsmith_enabled_", Jt = "flagsmith_trait_", ae = function() {
|
|
189
183
|
function a(e) {
|
|
190
184
|
var t = this;
|
|
@@ -192,50 +186,50 @@ function ce() {
|
|
|
192
186
|
var i = t, n = i.api, r = i.evaluationContext;
|
|
193
187
|
t.log("Get Flags"), t.isLoading = !0, t.loadingState.isFetching || t.setLoadingState(s(s({}, t.loadingState), { isFetching: !0 }));
|
|
194
188
|
var o = "".concat(t.getContext().identity), u = function(h) {
|
|
195
|
-
var
|
|
189
|
+
var d, l, g, E;
|
|
196
190
|
if (h && o === "".concat(t.getContext().identity)) {
|
|
197
191
|
var k = h.flags, w = h.traits, j = h.identifier;
|
|
198
192
|
t.isLoading = !1;
|
|
199
193
|
var I = {}, A = {};
|
|
200
|
-
w = w || [], (k = k || []).forEach(function(
|
|
201
|
-
I[
|
|
202
|
-
}), w.forEach(function(
|
|
203
|
-
A[
|
|
194
|
+
w = w || [], (k = k || []).forEach(function(f) {
|
|
195
|
+
I[f.feature.name.toLowerCase().replace(/ /g, "_")] = { id: f.feature.id, enabled: f.enabled, value: f.feature_state_value };
|
|
196
|
+
}), w.forEach(function(f) {
|
|
197
|
+
A[f.trait_key.toLowerCase().replace(/ /g, "_")] = { transient: f.transient, value: f.trait_value };
|
|
204
198
|
}), t.oldFlags = s({}, t.flags);
|
|
205
|
-
var P = b(t.oldFlags, I), Z = b((
|
|
206
|
-
if ((j || Object.keys(A).length) && (t.evaluationContext.identity = s(s({}, t.evaluationContext.identity), { traits: A }), j && (t.evaluationContext.identity.identifier = j)), t.flags = I, t.updateStorage(), t._onChange(t.oldFlags, { isFromServer: !0, flagsChanged: P, traitsChanged: Z }, t._loadedState(null,
|
|
199
|
+
var P = b(t.oldFlags, I), Z = b((d = t.evaluationContext.identity) === null || d === void 0 ? void 0 : d.traits, A);
|
|
200
|
+
if ((j || Object.keys(A).length) && (t.evaluationContext.identity = s(s({}, t.evaluationContext.identity), { traits: A }), j && (t.evaluationContext.identity.identifier = j)), t.flags = I, t.updateStorage(), t._onChange(t.oldFlags, { isFromServer: !0, flagsChanged: P, traitsChanged: Z }, t._loadedState(null, v.SERVER)), t.datadogRum) try {
|
|
207
201
|
if (t.datadogRum.trackTraits) {
|
|
208
202
|
var Q = {};
|
|
209
|
-
Object.keys(((l = t.evaluationContext.identity) === null || l === void 0 ? void 0 : l.traits) || {}).map(function(
|
|
210
|
-
Q[Jt +
|
|
203
|
+
Object.keys(((l = t.evaluationContext.identity) === null || l === void 0 ? void 0 : l.traits) || {}).map(function(f) {
|
|
204
|
+
Q[Jt + f] = t.getTrait(f);
|
|
211
205
|
});
|
|
212
|
-
var $ = s(s(s({}, t.datadogRum.client.getUser()), { id: t.datadogRum.client.getUser().id || ((
|
|
206
|
+
var $ = s(s(s({}, t.datadogRum.client.getUser()), { id: t.datadogRum.client.getUser().id || ((g = t.evaluationContext.identity) === null || g === void 0 ? void 0 : g.identifier) }), Q);
|
|
213
207
|
t.log("Setting Datadog user", $), t.datadogRum.client.setUser($);
|
|
214
208
|
}
|
|
215
|
-
} catch (
|
|
216
|
-
console.error(
|
|
209
|
+
} catch (f) {
|
|
210
|
+
console.error(f);
|
|
217
211
|
}
|
|
218
212
|
if (t.dtrum) try {
|
|
219
|
-
var
|
|
220
|
-
Object.keys(t.flags).map(function(
|
|
221
|
-
_(
|
|
222
|
-
}), Object.keys(((
|
|
223
|
-
_(
|
|
224
|
-
}), t.log("Sending javaLongOrObject traits to dynatrace",
|
|
225
|
-
} catch (
|
|
226
|
-
console.error(
|
|
213
|
+
var x = { javaDouble: {}, date: {}, shortString: {}, javaLongOrObject: {} };
|
|
214
|
+
Object.keys(t.flags).map(function(f) {
|
|
215
|
+
_(x, Dt + f, t.getValue(f, { skipAnalytics: !0 })), _(x, Gt + f, t.hasFeature(f, { skipAnalytics: !0 }));
|
|
216
|
+
}), Object.keys(((E = t.evaluationContext.identity) === null || E === void 0 ? void 0 : E.traits) || {}).map(function(f) {
|
|
217
|
+
_(x, Jt + f, t.getTrait(f));
|
|
218
|
+
}), t.log("Sending javaLongOrObject traits to dynatrace", x.javaLongOrObject), t.log("Sending date traits to dynatrace", x.date), t.log("Sending shortString traits to dynatrace", x.shortString), t.log("Sending javaDouble to dynatrace", x.javaDouble), t.dtrum.sendSessionProperties(x.javaLongOrObject, x.date, x.shortString, x.javaDouble);
|
|
219
|
+
} catch (f) {
|
|
220
|
+
console.error(f);
|
|
227
221
|
}
|
|
228
222
|
}
|
|
229
223
|
};
|
|
230
224
|
return r.identity ? Promise.all([r.identity.traits && Object.keys(r.identity.traits).length || !r.identity.identifier ? t.getJSON(n + "identities/", "POST", JSON.stringify({ identifier: r.identity.identifier, transient: r.identity.transient, traits: Object.entries(r.identity.traits).map(function(h) {
|
|
231
|
-
var
|
|
232
|
-
return { trait_key:
|
|
225
|
+
var d = h[0], l = h[1];
|
|
226
|
+
return { trait_key: d, trait_value: l == null ? void 0 : l.value, transient: l == null ? void 0 : l.transient };
|
|
233
227
|
}).filter(function(h) {
|
|
234
228
|
return h.trait_value !== void 0 || (t.log("Warning - attempted to set an undefined trait value for key", h.trait_key), !1);
|
|
235
229
|
}) })) : t.getJSON(n + "identities/?identifier=" + encodeURIComponent(r.identity.identifier) + (r.identity.transient ? "&transient=true" : ""))]).then(function(h) {
|
|
236
230
|
return t.evaluationContext.identity = s(s({}, t.evaluationContext.identity), { traits: {} }), u(h == null ? void 0 : h[0]);
|
|
237
231
|
}).catch(function(h) {
|
|
238
|
-
var
|
|
232
|
+
var d = h.message, l = new Error(d);
|
|
239
233
|
return Promise.reject(l);
|
|
240
234
|
}) : t.getJSON(n + "flags/").then(function(h) {
|
|
241
235
|
return u({ flags: h, traits: void 0 });
|
|
@@ -250,7 +244,7 @@ function ce() {
|
|
|
250
244
|
}).catch(function(n) {
|
|
251
245
|
t.log("Exception fetching evaluationEvent", n);
|
|
252
246
|
}) : void 0;
|
|
253
|
-
}, this.datadogRum = null, this.loadingState = { isLoading: !0, isFetching: !0, error: null, source:
|
|
247
|
+
}, this.datadogRum = null, this.loadingState = { isLoading: !0, isFetching: !0, error: null, source: v.NONE }, this.canUseStorage = !1, this.analyticsInterval = null, this.api = null, this.cacheFlags = !1, this.ts = null, this.enableAnalytics = !1, this.enableLogs = !1, this.evaluationContext = {}, this.evaluationEvent = null, this.flags = null, this.getFlagInterval = null, this.headers = null, this.initialised = !1, this.oldFlags = null, this.onChange = null, this.onError = null, this.ticks = null, this.timer = null, this.dtrum = null, this.withTraits = null, this.cacheOptions = { ttl: 0, skipAPI: !1, loadStale: !1, storageKey: void 0 }, this.getValue = function(i, n, r) {
|
|
254
248
|
var o = t.flags && t.flags[i.toLowerCase().replace(/ /g, "_")], u = null;
|
|
255
249
|
if (o && (u = o.value), n != null && n.skipAnalytics || r || t.evaluateFlag(i, "VALUE"), u === null && (n == null ? void 0 : n.fallback) !== void 0) return n.fallback;
|
|
256
250
|
if (n != null && n.json) try {
|
|
@@ -294,13 +288,13 @@ function ce() {
|
|
|
294
288
|
}, this.getJSON = function(i, n, r) {
|
|
295
289
|
var o, u = t;
|
|
296
290
|
u.evaluationContext;
|
|
297
|
-
var h = u.headers,
|
|
298
|
-
t.evaluationContext.environment && (
|
|
291
|
+
var h = u.headers, d = { method: n || "GET", body: r, cache: "no-cache", headers: {} };
|
|
292
|
+
t.evaluationContext.environment && (d.headers["X-Environment-Key"] = t.evaluationContext.environment.apiKey), n && n !== "GET" && (d.headers["Content-Type"] = "application/json; charset=utf-8"), h && Object.assign(d.headers, h), S || console.error("Flagsmith: fetch is undefined, please specify a fetch implementation into flagsmith.init to support SSR.");
|
|
299
293
|
var l = "".concat((o = t.evaluationContext.identity) === null || o === void 0 ? void 0 : o.identifier);
|
|
300
|
-
return
|
|
301
|
-
var
|
|
294
|
+
return S(i, d).then(function(g) {
|
|
295
|
+
var E, k, w = "".concat((E = t.evaluationContext.identity) === null || E === void 0 ? void 0 : E.identifier);
|
|
302
296
|
if (l === w) {
|
|
303
|
-
var j = (k =
|
|
297
|
+
var j = (k = g.headers) === null || k === void 0 ? void 0 : k.get("x-flagsmith-document-updated-at");
|
|
304
298
|
if (j) try {
|
|
305
299
|
var I = parseFloat(j);
|
|
306
300
|
if (isNaN(I)) return Promise.reject("Failed to parse x-flagsmith-document-updated-at");
|
|
@@ -308,13 +302,13 @@ function ce() {
|
|
|
308
302
|
} catch (A) {
|
|
309
303
|
t.log(A, "Failed to parse x-flagsmith-document-updated-at", j);
|
|
310
304
|
}
|
|
311
|
-
return t.log("Fetch response: " +
|
|
305
|
+
return t.log("Fetch response: " + g.status + " " + (n || "GET") + 0 + i), g.text().then(function(A) {
|
|
312
306
|
var P = A;
|
|
313
307
|
try {
|
|
314
308
|
P = JSON.parse(A);
|
|
315
309
|
} catch {
|
|
316
310
|
}
|
|
317
|
-
return !P &&
|
|
311
|
+
return !P && g.status && (P = "API Response: ".concat(g.status)), g.status && g.status >= 200 && g.status < 300 ? P : Promise.reject(new Error(P));
|
|
318
312
|
});
|
|
319
313
|
}
|
|
320
314
|
t.log("Received response with identity mismatch, ignoring response. Requested: ".concat(l, ", Current: ").concat(w));
|
|
@@ -328,23 +322,23 @@ function ce() {
|
|
|
328
322
|
}, this._onChange = function(i, n, r) {
|
|
329
323
|
var o, u;
|
|
330
324
|
t.setLoadingState(r), (o = t.onChange) === null || o === void 0 || o.call(t, i, n, t.loadingState), (u = t._trigger) === null || u === void 0 || u.call(t);
|
|
331
|
-
},
|
|
325
|
+
}, S = e.fetch ? e.fetch : typeof fetch < "u" ? fetch : st === null || st === void 0 ? void 0 : st.fetch, this.canUseStorage = typeof window < "u" || !!e.browserlessStorage, this.log("Constructing flagsmith instance " + e), e.eventSource && (ht = e.eventSource), e.AsyncStorage && (O = e.AsyncStorage);
|
|
332
326
|
}
|
|
333
327
|
return a.prototype.init = function(e) {
|
|
334
328
|
var t, i, n;
|
|
335
329
|
return N(this, void 0, void 0, function() {
|
|
336
|
-
var r, o, u, h,
|
|
330
|
+
var r, o, u, h, d, l, g, E, k, w, j, I, A, P, Z, Q, $, x, f, dt, W, Bt, q, gt, Xt, Yt, ft, Zt, pt, tt, B, Qt, F = this;
|
|
337
331
|
return z(this, function(T) {
|
|
338
332
|
switch (T.label) {
|
|
339
333
|
case 0:
|
|
340
334
|
r = ct(e.evaluationContext || this.evaluationContext), T.label = 1;
|
|
341
335
|
case 1:
|
|
342
|
-
if (T.trys.push([1, 13, , 14]), o = e.environmentID, u = e.api, h = u === void 0 ? Kt : u,
|
|
336
|
+
if (T.trys.push([1, 13, , 14]), o = e.environmentID, u = e.api, h = u === void 0 ? Kt : u, d = e.headers, l = e.onChange, g = e.cacheFlags, E = e.datadogRum, k = e.onError, w = e.defaultFlags, j = e.fetch, I = e.preventFetch, A = e.enableLogs, P = e.enableDynatrace, Z = e.enableAnalytics, Q = e.realtime, $ = e.eventSourceUrl, x = $ === void 0 ? "https://realtime.flagsmith.com/" : $, f = e.AsyncStorage, dt = e.identity, W = e.traits, Bt = e.state, q = e.cacheOptions, gt = e.angularHttpClient, Xt = e._trigger, Yt = e._triggerLoadingState, r.environment = o ? { apiKey: o } : r.environment, !r.environment || !r.environment.apiKey) throw new Error("Please provide `evaluationContext.environment` with non-empty `apiKey`");
|
|
343
337
|
if (r.identity = dt || W ? { identifier: dt, traits: W ? Object.fromEntries(Object.entries(W).map(function(L) {
|
|
344
338
|
return [L[0], { value: L[1] }];
|
|
345
|
-
})) : {} } : r.identity, this.evaluationContext = r, this.api = h, this.headers =
|
|
339
|
+
})) : {} } : r.identity, this.evaluationContext = r, this.api = h, this.headers = d, this.getFlagInterval = null, this.analyticsInterval = null, this.onChange = l, ft = "Wrong Flagsmith Configuration: preventFetch is true and no defaulFlags provided", this._trigger = Xt || this._trigger, this._triggerLoadingState = Yt || this._triggerLoadingState, this.onError = function(L) {
|
|
346
340
|
F.setLoadingState(s(s({}, F.loadingState), { isFetching: !1, isLoading: !1, error: L })), k == null || k(L);
|
|
347
|
-
}, this.enableLogs = A || !1, this.cacheOptions = q ? { skipAPI: !!q.skipAPI, ttl: q.ttl || 0, storageKey: q.storageKey, loadStale: !!q.loadStale } : this.cacheOptions, !this.cacheOptions.ttl && this.cacheOptions.skipAPI && console.warn("Flagsmith: you have set a cache ttl of 0 and are skipping API calls, this means the API will not be hit unless you clear local storage."), j && (
|
|
341
|
+
}, this.enableLogs = A || !1, this.cacheOptions = q ? { skipAPI: !!q.skipAPI, ttl: q.ttl || 0, storageKey: q.storageKey, loadStale: !!q.loadStale } : this.cacheOptions, !this.cacheOptions.ttl && this.cacheOptions.skipAPI && console.warn("Flagsmith: you have set a cache ttl of 0 and are skipping API calls, this means the API will not be hit unless you clear local storage."), j && (S = j), this.enableAnalytics = Z || !1, this.flags = Object.assign({}, w) || {}, this.datadogRum = E || null, this.initialised = !0, this.ticks = 1e4, this.timer = this.enableLogs ? (/* @__PURE__ */ new Date()).valueOf() : null, this.cacheFlags = O !== void 0 && !!g, at = "FLAGSMITH_EVENT_" + r.environment.apiKey, f && (O = f), Q && typeof window < "u" && this.setupRealtime(x, r.environment.apiKey), Object.keys(this.flags).length && (this.loadingState = s(s({}, this.loadingState), { isLoading: !1, source: v.DEFAULT_FLAGS })), this.setState(Bt), this.log("Initialising with properties", e, this), P && (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), gt && (S = /* @__PURE__ */ function(L) {
|
|
348
342
|
return function(R, U) {
|
|
349
343
|
var M = U.headers, m = U.method, X = U.body;
|
|
350
344
|
return new Promise(function(H) {
|
|
@@ -380,18 +374,18 @@ function ce() {
|
|
|
380
374
|
F.log("Retrieved events from cache", R), F.setState(s(s({}, M), { evaluationEvent: U[F.evaluationContext.environment.apiKey] }));
|
|
381
375
|
}
|
|
382
376
|
}
|
|
383
|
-
})), !
|
|
377
|
+
})), !g) return [3, 9];
|
|
384
378
|
if (!O || !this.canUseStorage) return [3, 8];
|
|
385
379
|
Zt = function(L, R) {
|
|
386
380
|
return N(F, void 0, void 0, function() {
|
|
387
|
-
var U, M, m, X, H, J, yt, Wt, mt, St, Ct, _t, bt,
|
|
381
|
+
var U, M, m, X, H, J, yt, Wt, mt, St, Ct, _t, bt, Et, xt, Ft, Ot, wt, It, At, Lt, jt, Tt, Nt, te = this;
|
|
388
382
|
return z(this, function(V) {
|
|
389
383
|
switch (V.label) {
|
|
390
384
|
case 0:
|
|
391
385
|
if (!R) return [3, 7];
|
|
392
386
|
U = null, M = null, V.label = 1;
|
|
393
387
|
case 1:
|
|
394
|
-
return V.trys.push([1, 5, , 6]), m = JSON.parse(R), X = !1, H = !1, m && m.api === this.api && ((St = (mt = m.evaluationContext) === null || mt === void 0 ? void 0 : mt.environment) === null || St === void 0 ? void 0 : St.apiKey) === ((Ct = this.evaluationContext.environment) === null || Ct === void 0 ? void 0 : Ct.apiKey) && (J = !0, this.evaluationContext.identity && ((bt = (_t = m.evaluationContext) === null || _t === void 0 ? void 0 : _t.identity) === null || bt === void 0 ? void 0 : bt.identifier) !== this.evaluationContext.identity.identifier && (this.log("Ignoring cache, identity has changed from " + ((
|
|
388
|
+
return V.trys.push([1, 5, , 6]), m = JSON.parse(R), X = !1, H = !1, m && m.api === this.api && ((St = (mt = m.evaluationContext) === null || mt === void 0 ? void 0 : mt.environment) === null || St === void 0 ? void 0 : St.apiKey) === ((Ct = this.evaluationContext.environment) === null || Ct === void 0 ? void 0 : Ct.apiKey) && (J = !0, this.evaluationContext.identity && ((bt = (_t = m.evaluationContext) === null || _t === void 0 ? void 0 : _t.identity) === null || bt === void 0 ? void 0 : bt.identifier) !== this.evaluationContext.identity.identifier && (this.log("Ignoring cache, identity has changed from " + ((xt = (Et = m.evaluationContext) === null || Et === void 0 ? void 0 : Et.identity) === null || xt === void 0 ? void 0 : xt.identifier) + " to " + this.evaluationContext.identity.identifier), J = !1), this.cacheOptions.ttl && (!m.ts || (/* @__PURE__ */ new Date()).valueOf() - m.ts > this.cacheOptions.ttl) && (m.ts && !this.cacheOptions.loadStale ? (this.log("Ignoring cache, timestamp is too old ts:" + m.ts + " ttl: " + this.cacheOptions.ttl + " time elapsed since cache: " + ((/* @__PURE__ */ new Date()).valueOf() - m.ts) + "ms"), J = !1) : m.ts && this.cacheOptions.loadStale && (this.log("Loading stale cache, timestamp ts:" + m.ts + " ttl: " + this.cacheOptions.ttl + " time elapsed since cache: " + ((/* @__PURE__ */ new Date()).valueOf() - m.ts) + "ms"), H = !0, J = !0)), J && (X = !0, M = b((Ft = this.evaluationContext.identity) === null || Ft === void 0 ? void 0 : Ft.traits, (wt = (Ot = m.evaluationContext) === null || Ot === void 0 ? void 0 : Ot.identity) === null || wt === void 0 ? void 0 : wt.traits), U = b(this.flags, m.flags), this.setState(s(s({}, m), { evaluationContext: ct(s(s({}, m.evaluationContext), { identity: !((It = m.evaluationContext) === null || It === void 0) && It.identity ? s(s({}, (At = m.evaluationContext) === null || At === void 0 ? void 0 : At.identity), { traits: s(s({}, ((jt = (Lt = m.evaluationContext) === null || Lt === void 0 ? void 0 : Lt.identity) === null || jt === void 0 ? void 0 : jt.traits) || {}), W || {}) }) : void 0 })) })), this.log("Retrieved flags from cache", m))), X ? (yt = !I && (!this.cacheOptions.skipAPI || H), this._onChange(null, { isFromServer: !1, flagsChanged: U, traitsChanged: M }, this._loadedState(null, v.CACHE, yt)), this.oldFlags = this.flags, this.cacheOptions.skipAPI && X && !H && this.log("Skipping API, using cache"), yt && this.getFlags().catch(function(se) {
|
|
395
389
|
var kt;
|
|
396
390
|
(kt = te.onError) === null || kt === void 0 || kt.call(te, se);
|
|
397
391
|
}), [3, 4]) : [3, 2];
|
|
@@ -410,10 +404,10 @@ function ce() {
|
|
|
410
404
|
case 8:
|
|
411
405
|
return V.sent(), [3, 10];
|
|
412
406
|
case 9:
|
|
413
|
-
if (w) this._onChange(null, { isFromServer: !1, flagsChanged: b({}, this.flags), traitsChanged: b({}, (Tt = this.evaluationContext.identity) === null || Tt === void 0 ? void 0 : Tt.traits) }, this._loadedState(null,
|
|
407
|
+
if (w) this._onChange(null, { isFromServer: !1, flagsChanged: b({}, this.flags), traitsChanged: b({}, (Tt = this.evaluationContext.identity) === null || Tt === void 0 ? void 0 : Tt.traits) }, this._loadedState(null, v.DEFAULT_FLAGS));
|
|
414
408
|
else {
|
|
415
409
|
if (!this.flags) throw new Error(ft);
|
|
416
|
-
this._onChange(null, { isFromServer: !1, flagsChanged: b({}, this.flags), traitsChanged: b({}, (Nt = this.evaluationContext.identity) === null || Nt === void 0 ? void 0 : Nt.traits) }, this._loadedState(null,
|
|
410
|
+
this._onChange(null, { isFromServer: !1, flagsChanged: b({}, this.flags), traitsChanged: b({}, (Nt = this.evaluationContext.identity) === null || Nt === void 0 ? void 0 : Nt.traits) }, this._loadedState(null, v.DEFAULT_FLAGS));
|
|
417
411
|
}
|
|
418
412
|
V.label = 10;
|
|
419
413
|
case 10:
|
|
@@ -440,8 +434,8 @@ function ce() {
|
|
|
440
434
|
case 10:
|
|
441
435
|
return T.sent(), [3, 12];
|
|
442
436
|
case 11:
|
|
443
|
-
if (w) this._onChange(null, { isFromServer: !1, flagsChanged: b({}, w), traitsChanged: b({}, (t = r.identity) === null || t === void 0 ? void 0 : t.traits) }, this._loadedState(null,
|
|
444
|
-
else if (this.flags && (tt = null, Object.keys(this.flags).length === 0 && (tt = ft), this._onChange(null, { isFromServer: !1, flagsChanged: b({}, this.flags), traitsChanged: b({}, (i = r.identity) === null || i === void 0 ? void 0 : i.traits) }, this._loadedState(tt,
|
|
437
|
+
if (w) this._onChange(null, { isFromServer: !1, flagsChanged: b({}, w), traitsChanged: b({}, (t = r.identity) === null || t === void 0 ? void 0 : t.traits) }, this._loadedState(null, v.DEFAULT_FLAGS));
|
|
438
|
+
else if (this.flags && (tt = null, Object.keys(this.flags).length === 0 && (tt = ft), this._onChange(null, { isFromServer: !1, flagsChanged: b({}, this.flags), traitsChanged: b({}, (i = r.identity) === null || i === void 0 ? void 0 : i.traits) }, this._loadedState(tt, v.DEFAULT_FLAGS)), tt)) throw new Error(tt);
|
|
445
439
|
T.label = 12;
|
|
446
440
|
case 12:
|
|
447
441
|
return [3, 14];
|
|
@@ -648,17 +642,17 @@ Consider loading an EventSource polyfill and making it available globally as Eve
|
|
|
648
642
|
return l.toLowerCase() in u;
|
|
649
643
|
} } };
|
|
650
644
|
};
|
|
651
|
-
for (var
|
|
652
|
-
n.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function(l,
|
|
653
|
-
r.push(
|
|
645
|
+
for (var d in n.open(e.method || "get", a, !0), n.onload = function() {
|
|
646
|
+
n.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function(l, g, E) {
|
|
647
|
+
r.push(g = g.toLowerCase()), o.push([g, E]), u[g] = u[g] ? u[g] + "," + E : E;
|
|
654
648
|
}), t(h());
|
|
655
|
-
}, n.onerror = i, n.withCredentials = e.credentials == "include", e.headers) n.setRequestHeader(
|
|
649
|
+
}, n.onerror = i, n.withCredentials = e.credentials == "include", e.headers) n.setRequestHeader(d, e.headers[d]);
|
|
656
650
|
n.send(e.body || null);
|
|
657
651
|
});
|
|
658
|
-
}, qt = Mt({ AsyncStorage:
|
|
659
|
-
typeof window < "u" && (window.flagsmith = qt),
|
|
660
|
-
return Mt({ AsyncStorage:
|
|
661
|
-
},
|
|
652
|
+
}, qt = Mt({ AsyncStorage: p, fetch: $t, eventSource: Ht });
|
|
653
|
+
typeof window < "u" && (window.flagsmith = qt), y.createFlagsmithInstance = function() {
|
|
654
|
+
return Mt({ AsyncStorage: p, fetch: $t, eventSource: Ht });
|
|
655
|
+
}, y.default = qt, Object.defineProperty(y, "__esModule", { value: !0 });
|
|
662
656
|
});
|
|
663
657
|
}(lt, lt.exports)), lt.exports;
|
|
664
658
|
}
|
|
@@ -676,20 +670,20 @@ var he = ce(), ve = {
|
|
|
676
670
|
if (!this.flagsmithClient)
|
|
677
671
|
throw new Error(ve.NOT_INITIALIZED);
|
|
678
672
|
}
|
|
679
|
-
async init(c,
|
|
673
|
+
async init(c, y = []) {
|
|
680
674
|
if (!this.flagsmithClient)
|
|
681
675
|
try {
|
|
682
676
|
this.flagsmithClient = he.createFlagsmithInstance();
|
|
683
|
-
const
|
|
677
|
+
const p = y.reduce((s, N) => (s[N.feature.name] = N, s), {});
|
|
684
678
|
await this.flagsmithClient.init({
|
|
685
679
|
environmentID: c.apiKey,
|
|
686
680
|
api: (c == null ? void 0 : c.url) ?? "https://feature-flag-proxy.feedme.farm/api/v1/",
|
|
687
681
|
enableAnalytics: (c == null ? void 0 : c.enableAnalytics) ?? !0,
|
|
688
|
-
defaultFlags:
|
|
682
|
+
defaultFlags: p,
|
|
689
683
|
cacheFlags: (c == null ? void 0 : c.cacheFlags) ?? !0
|
|
690
684
|
});
|
|
691
|
-
} catch (
|
|
692
|
-
throw console.error("Failed to initialize FeatureFlag:",
|
|
685
|
+
} catch (p) {
|
|
686
|
+
throw console.error("Failed to initialize FeatureFlag:", p), p;
|
|
693
687
|
}
|
|
694
688
|
}
|
|
695
689
|
async setUser(c) {
|
|
@@ -710,51 +704,51 @@ var he = ce(), ve = {
|
|
|
710
704
|
async getFlags() {
|
|
711
705
|
this.ensureInitialized();
|
|
712
706
|
const c = this.flagsmithClient.getAllFlags();
|
|
713
|
-
return Object.entries(c).map(([
|
|
707
|
+
return Object.entries(c).map(([y, p]) => {
|
|
714
708
|
var s;
|
|
715
709
|
return {
|
|
716
710
|
feature: {
|
|
717
|
-
name:
|
|
718
|
-
id: (
|
|
711
|
+
name: y,
|
|
712
|
+
id: (p == null ? void 0 : p.id) ?? 0
|
|
719
713
|
},
|
|
720
|
-
enabled:
|
|
721
|
-
value: ((s =
|
|
714
|
+
enabled: p.enabled,
|
|
715
|
+
value: ((s = p.value) == null ? void 0 : s.toString()) ?? null
|
|
722
716
|
};
|
|
723
717
|
});
|
|
724
718
|
}
|
|
725
|
-
getFlagValue(c,
|
|
719
|
+
getFlagValue(c, y) {
|
|
726
720
|
this.ensureInitialized();
|
|
727
|
-
const
|
|
728
|
-
if (
|
|
721
|
+
const p = this.flagsmithClient.getValue(c);
|
|
722
|
+
if (p == null)
|
|
729
723
|
return null;
|
|
730
724
|
try {
|
|
731
|
-
const s =
|
|
732
|
-
return
|
|
725
|
+
const s = p.toString();
|
|
726
|
+
return y ? y(s) : typeof {} == "number" ? isNaN(Number(s)) ? null : Number(s) : typeof {} == "boolean" ? s.toLowerCase() === "true" : s;
|
|
733
727
|
} catch (s) {
|
|
734
728
|
return console.error("Error transforming flag value:", s), null;
|
|
735
729
|
}
|
|
736
730
|
}
|
|
737
731
|
getFlag(c) {
|
|
738
732
|
this.ensureInitialized();
|
|
739
|
-
const
|
|
740
|
-
if (
|
|
741
|
-
const
|
|
733
|
+
const y = this.flagsmithClient.getValue(c);
|
|
734
|
+
if (y == null) return null;
|
|
735
|
+
const p = this.flagsmithClient.hasFeature(c);
|
|
742
736
|
return {
|
|
743
737
|
feature: {
|
|
744
738
|
name: c,
|
|
745
739
|
id: 0
|
|
746
740
|
},
|
|
747
|
-
enabled:
|
|
748
|
-
value:
|
|
741
|
+
enabled: p,
|
|
742
|
+
value: y.toString()
|
|
749
743
|
};
|
|
750
744
|
}
|
|
751
|
-
async getUserFlagValue(c,
|
|
745
|
+
async getUserFlagValue(c, y, p = null, s) {
|
|
752
746
|
var z;
|
|
753
747
|
const N = this.userContext;
|
|
754
748
|
try {
|
|
755
|
-
return await this.setUser(c), this.getFlagValue(
|
|
749
|
+
return await this.setUser(c), this.getFlagValue(y, s) ?? p;
|
|
756
750
|
} catch (D) {
|
|
757
|
-
return console.error(`Error getting user flag value for ${
|
|
751
|
+
return console.error(`Error getting user flag value for ${y}:`, D), p;
|
|
758
752
|
} finally {
|
|
759
753
|
try {
|
|
760
754
|
await ((z = this.flagsmithClient) == null ? void 0 : z.logout()), this.userContext = null, N && await this.setUser(N.identifier);
|
|
@@ -767,50 +761,50 @@ var he = ce(), ve = {
|
|
|
767
761
|
this.flagsmithClient = null, this.userContext = null;
|
|
768
762
|
}
|
|
769
763
|
}, ot(K, "instance"), K), ge = de.getInstance(), et = Ut(!1), ut = Ut([]), Y = Ut(null);
|
|
770
|
-
function fe(
|
|
771
|
-
const c = () => et.value ? !0 : (console.warn("FeatureFlag is not initialized. Using default values."), !1),
|
|
764
|
+
function fe(C = ge) {
|
|
765
|
+
const c = () => et.value ? !0 : (console.warn("FeatureFlag is not initialized. Using default values."), !1), y = async (v, S = []) => {
|
|
772
766
|
if (et.value) {
|
|
773
767
|
console.warn("FeatureFlag is already initialized.");
|
|
774
768
|
return;
|
|
775
769
|
}
|
|
776
770
|
try {
|
|
777
|
-
await
|
|
771
|
+
await C.init(v, S), ut.value = await C.getFlags(), et.value = !0, Y.value = null;
|
|
778
772
|
} catch (_) {
|
|
779
773
|
console.error("Failed to initialize feature flags:", _), Y.value = _;
|
|
780
774
|
}
|
|
781
|
-
},
|
|
775
|
+
}, p = async (v) => {
|
|
782
776
|
if (c())
|
|
783
777
|
try {
|
|
784
|
-
await
|
|
785
|
-
} catch (
|
|
786
|
-
console.error("Failed to set user:",
|
|
778
|
+
await C.setUser(v), ut.value = await C.getFlags(), Y.value = null;
|
|
779
|
+
} catch (S) {
|
|
780
|
+
console.error("Failed to set user:", S), Y.value = S;
|
|
787
781
|
}
|
|
788
|
-
}, s = async (
|
|
782
|
+
}, s = async (v) => p(`${ne}-${v}`), N = (v, S, _ = null) => {
|
|
789
783
|
if (!c()) return _;
|
|
790
784
|
try {
|
|
791
|
-
return
|
|
785
|
+
return C.getFlagValue(v, S) ?? _;
|
|
792
786
|
} catch (G) {
|
|
793
|
-
return console.error(`Error getting flag value for ${
|
|
787
|
+
return console.error(`Error getting flag value for ${v}:`, G), _;
|
|
794
788
|
}
|
|
795
|
-
}, z = (
|
|
796
|
-
if (!c()) return
|
|
789
|
+
}, z = (v, S) => {
|
|
790
|
+
if (!c()) return S ?? null;
|
|
797
791
|
try {
|
|
798
|
-
return
|
|
792
|
+
return C.getFlag(v) ?? S ?? null;
|
|
799
793
|
} catch (_) {
|
|
800
|
-
return console.error(`Error getting flag for ${
|
|
794
|
+
return console.error(`Error getting flag for ${v}:`, _), S ?? null;
|
|
801
795
|
}
|
|
802
|
-
}, D = async (
|
|
796
|
+
}, D = async (v, S, _ = null, G) => {
|
|
803
797
|
if (!c()) return _;
|
|
804
798
|
try {
|
|
805
|
-
return await
|
|
799
|
+
return await C.getUserFlagValue(v, S, _, G);
|
|
806
800
|
} catch (it) {
|
|
807
|
-
return console.error(`Error getting user flag value for ${
|
|
801
|
+
return console.error(`Error getting user flag value for ${S}:`, it), _;
|
|
808
802
|
}
|
|
809
|
-
}, nt = async (
|
|
803
|
+
}, nt = async (v, S, _ = null, G) => D(`${ne}-${v}`, S, _, G), b = () => {
|
|
810
804
|
try {
|
|
811
|
-
|
|
812
|
-
} catch (
|
|
813
|
-
console.error("Error resetting feature flags:",
|
|
805
|
+
C.reset();
|
|
806
|
+
} catch (v) {
|
|
807
|
+
console.error("Error resetting feature flags:", v);
|
|
814
808
|
} finally {
|
|
815
809
|
ut.value = [], et.value = !1, Y.value = null;
|
|
816
810
|
}
|
|
@@ -819,8 +813,8 @@ function fe(S = ge) {
|
|
|
819
813
|
flags: Pt(ut),
|
|
820
814
|
isInitialized: Pt(et),
|
|
821
815
|
error: Pt(Y),
|
|
822
|
-
init:
|
|
823
|
-
setUser:
|
|
816
|
+
init: y,
|
|
817
|
+
setUser: p,
|
|
824
818
|
setBusiness: s,
|
|
825
819
|
getFlagValue: N,
|
|
826
820
|
getFlag: z,
|
|
@@ -829,18 +823,17 @@ function fe(S = ge) {
|
|
|
829
823
|
reset: b
|
|
830
824
|
};
|
|
831
825
|
}
|
|
832
|
-
var
|
|
826
|
+
var _e = () => fe();
|
|
833
827
|
const pe = "https://flag.feedmeapi.com/api/v1/", ye = {
|
|
834
828
|
dev: "MaGoXrEWuEJNpWgKTqseee",
|
|
835
829
|
prod: "6GhcttsJ9Rj9cTevcdrpin"
|
|
836
830
|
};
|
|
837
831
|
let Rt = null;
|
|
838
|
-
function
|
|
839
|
-
return
|
|
832
|
+
function be(C, c) {
|
|
833
|
+
return C.isInitialized.value ? Promise.resolve() : (Rt || (Rt = C.init({ apiKey: ye[c], url: pe }).catch(() => {
|
|
840
834
|
})), Rt);
|
|
841
835
|
}
|
|
842
836
|
export {
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
be as u
|
|
837
|
+
be as e,
|
|
838
|
+
_e as u
|
|
846
839
|
};
|
|
@@ -314,4 +314,55 @@ export interface FoodCourtOrderReceipt {
|
|
|
314
314
|
export declare const FoodCourtOrderApi: {
|
|
315
315
|
listOrders(foodCourtId: string, query: FoodCourtOrderListQuery): Promise<FoodCourtOrderListRes>;
|
|
316
316
|
getOrder(foodCourtId: string, orderId: string): Promise<FoodCourtOrderReceipt>;
|
|
317
|
+
/**
|
|
318
|
+
* Every order the list's filters match, one row per stall order (KDI-4942).
|
|
319
|
+
* Refused (400) past 31 days with code EXPORT_RANGE_TOO_LONG, or past 50,000
|
|
320
|
+
* rows with EXPORT_TOO_MANY_ROWS.
|
|
321
|
+
*/
|
|
322
|
+
exportOrders(foodCourtId: string, query: FoodCourtOrderExportQuery): Promise<FoodCourtOrderExport>;
|
|
317
323
|
};
|
|
324
|
+
export type FoodCourtOrderExportQuery = Pick<FoodCourtOrderListQuery, 'from' | 'to' | 'status'>;
|
|
325
|
+
/**
|
|
326
|
+
* One stall order of the export (`FdtoFoodCourtOrderExportRow`, order-backend).
|
|
327
|
+
* Money is in major units (12.3 = RM12.30). The payment, total, fee and
|
|
328
|
+
* settlement columns belong to the whole court order and repeat on each of its
|
|
329
|
+
* stall rows.
|
|
330
|
+
*/
|
|
331
|
+
export interface FoodCourtOrderExportRow {
|
|
332
|
+
mainOrderId: string;
|
|
333
|
+
subOrderId: string;
|
|
334
|
+
shortOrderId: string | null;
|
|
335
|
+
/** No court-level invoice number exists yet: always null. */
|
|
336
|
+
invoiceNo: string | null;
|
|
337
|
+
subInvoiceNo: string | null;
|
|
338
|
+
transactionId: string | null;
|
|
339
|
+
gatewayId: string | null;
|
|
340
|
+
gatewayName: string | null;
|
|
341
|
+
paymentMethod: string | null;
|
|
342
|
+
orderChannel: 'KIOSK' | 'QR' | null;
|
|
343
|
+
transactionTimestamp: string | null;
|
|
344
|
+
orderStatus: string | null;
|
|
345
|
+
paymentStatus: string | null;
|
|
346
|
+
currency: string;
|
|
347
|
+
grossAmount: number | null;
|
|
348
|
+
sst: number | null;
|
|
349
|
+
serviceCharge: number | null;
|
|
350
|
+
rounding: number | null;
|
|
351
|
+
discountApplied: number | null;
|
|
352
|
+
nettSalesAmount: number;
|
|
353
|
+
totalSalesAmount: number;
|
|
354
|
+
fcId: string;
|
|
355
|
+
fcName: string | null;
|
|
356
|
+
restaurantId: string;
|
|
357
|
+
restaurantName: string | null;
|
|
358
|
+
fee: number | null;
|
|
359
|
+
settlementAmount: number | null;
|
|
360
|
+
settlementId: string | null;
|
|
361
|
+
}
|
|
362
|
+
export interface FoodCourtOrderExport {
|
|
363
|
+
/** For the file name; null when the court could not be read. */
|
|
364
|
+
courtName: string | null;
|
|
365
|
+
rows: FoodCourtOrderExportRow[];
|
|
366
|
+
/** Stalls whose bills could not be read: their bill columns are empty. */
|
|
367
|
+
unreadableStalls: string[];
|
|
368
|
+
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { KioskOtpDto, KioskDeviceDto } from '@entity';
|
|
2
|
+
import type { MfKioskLicenseList } from '@/modules/kiosk/license';
|
|
2
3
|
declare function requestOtp(): Promise<KioskOtpDto>;
|
|
3
4
|
declare function getDevices(): Promise<KioskDeviceDto[]>;
|
|
5
|
+
/** Every licence of the restaurant's business (licences are shared by all its outlets). */
|
|
6
|
+
declare function getLicenses(): Promise<MfKioskLicenseList>;
|
|
4
7
|
declare function unbind(machineId: string): Promise<void>;
|
|
5
8
|
declare function updateDevicePin(pinInfo: string, machineId: string): Promise<void>;
|
|
6
9
|
declare function updateDeviceRemark(remarkInfo: string | null, machineId: string): Promise<void>;
|
|
7
10
|
export declare const KioskApi: {
|
|
8
11
|
requestOtp: typeof requestOtp;
|
|
9
12
|
getDevices: typeof getDevices;
|
|
13
|
+
getLicenses: typeof getLicenses;
|
|
10
14
|
unbind: typeof unbind;
|
|
11
15
|
updateDevicePin: typeof updateDevicePin;
|
|
12
16
|
updateDeviceRemark: typeof updateDeviceRemark;
|