@feedmepos/mf-miniprogram-v2 0.2.12-dev.1 → 0.2.12-dev.2
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-B0BXsVum.js → App-DkOwAOxM.js} +1 -1
- package/dist/{ControlPlaneView-Bl_2Mt4i.js → ControlPlaneView-9iS3i2u0.js} +7743 -7667
- package/dist/app.js +2 -2
- package/dist/{localPreference-CaizsY6G.js → localPreference-BsnGsgbd.js} +178 -172
- package/dist/package.json +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var lt = (c, o, d) =>
|
|
1
|
+
var ye = Object.defineProperty;
|
|
2
|
+
var me = (c, o, d) => o in c ? ye(c, o, { enumerable: !0, configurable: !0, writable: !0, value: d }) : c[o] = d;
|
|
3
|
+
var lt = (c, o, d) => me(c, typeof o != "symbol" ? o + "" : o, d);
|
|
4
4
|
import "./index-DB33ug2V.js";
|
|
5
|
-
import { a as
|
|
6
|
-
import { ref as
|
|
7
|
-
import { c as
|
|
5
|
+
import { a as Se } from "./routes-W8KfuhWL.js";
|
|
6
|
+
import { ref as M, readonly as Ut, watch as Ce } from "vue";
|
|
7
|
+
import { c as _e } from "./controlPlane-Bn-uDXG_.js";
|
|
8
8
|
import { c as ut } from "./_commonjsHelpers-DaMA6jEr.js";
|
|
9
|
-
import { useCoreStore as
|
|
9
|
+
import { useCoreStore as re } from "@feedmepos/mf-common";
|
|
10
10
|
let Kt = null;
|
|
11
|
-
function
|
|
12
|
-
return Kt || (Kt =
|
|
11
|
+
function oe() {
|
|
12
|
+
return Kt || (Kt = _e(Se.adminWhoami()).catch(() => ({
|
|
13
13
|
isAdmin: !1,
|
|
14
14
|
isFeedMeStaff: !1
|
|
15
15
|
}))), Kt;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return
|
|
17
|
+
function Fe() {
|
|
18
|
+
return oe().then((c) => c.isAdmin);
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
const c =
|
|
22
|
-
return
|
|
20
|
+
function Ge() {
|
|
21
|
+
const c = M(!1);
|
|
22
|
+
return Fe().then((o) => {
|
|
23
23
|
c.value = o;
|
|
24
24
|
}), c;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
const c =
|
|
28
|
-
return
|
|
26
|
+
function Me() {
|
|
27
|
+
const c = M(!1);
|
|
28
|
+
return oe().then((o) => {
|
|
29
29
|
c.value = o.isFeedMeStaff === !0;
|
|
30
30
|
}), c;
|
|
31
31
|
}
|
|
@@ -64,7 +64,7 @@ var Dt = { exports: {} };
|
|
|
64
64
|
return a;
|
|
65
65
|
}, l.apply(this, arguments);
|
|
66
66
|
};
|
|
67
|
-
function
|
|
67
|
+
function b(a, e, t, i) {
|
|
68
68
|
return new (t || (t = Promise))(function(n, r) {
|
|
69
69
|
function s(p) {
|
|
70
70
|
try {
|
|
@@ -152,7 +152,7 @@ var Dt = { exports: {} };
|
|
|
152
152
|
for (var i, n = 0, r = e.length; n < r; n++) !i && n in e || (i || (i = Array.prototype.slice.call(e, 0, n)), i[n] = e[n]);
|
|
153
153
|
return a.concat(i || Array.prototype.slice.call(e));
|
|
154
154
|
}
|
|
155
|
-
var
|
|
155
|
+
var $ = function a(e, t) {
|
|
156
156
|
if (e === t) return !0;
|
|
157
157
|
if (e && t && typeof e == "object" && typeof t == "object") {
|
|
158
158
|
if (e.constructor !== t.constructor) return !1;
|
|
@@ -175,27 +175,27 @@ var Dt = { exports: {} };
|
|
|
175
175
|
}
|
|
176
176
|
return e != e && t != t;
|
|
177
177
|
};
|
|
178
|
-
function
|
|
178
|
+
function F(a, e) {
|
|
179
179
|
var t = Object.keys(e || {}).filter(function(i) {
|
|
180
180
|
var n = a == null ? void 0 : a[i], r = e == null ? void 0 : e[i];
|
|
181
|
-
return
|
|
181
|
+
return !$(n, r);
|
|
182
182
|
});
|
|
183
183
|
return Object.keys(a || {}).filter(function(i) {
|
|
184
184
|
Object.keys(e || {}).includes(i) || t.push(i);
|
|
185
185
|
}), Object.keys(t).length ? t : null;
|
|
186
186
|
}
|
|
187
187
|
var g, S;
|
|
188
|
-
function
|
|
188
|
+
function _(a, e, t) {
|
|
189
189
|
var i = "shortString", n = !0;
|
|
190
190
|
typeof t == "number" && (i = "javaDouble", n = !1), a[i] = a[i] || {}, a[i][e] = n ? t + "" : t;
|
|
191
191
|
}
|
|
192
|
-
function
|
|
192
|
+
function J(a) {
|
|
193
193
|
return !!a && typeof a == "object" && a.value !== void 0;
|
|
194
194
|
}
|
|
195
195
|
function rt(a) {
|
|
196
196
|
return Object.fromEntries(Object.entries(a).map(function(e) {
|
|
197
197
|
var t = e[0], i = e[1];
|
|
198
|
-
return [t,
|
|
198
|
+
return [t, J(i) ? i : { value: i }];
|
|
199
199
|
}));
|
|
200
200
|
}
|
|
201
201
|
function dt(a) {
|
|
@@ -204,7 +204,7 @@ var Dt = { exports: {} };
|
|
|
204
204
|
(function(a) {
|
|
205
205
|
a.NONE = "NONE", a.DEFAULT_FLAGS = "DEFAULT_FLAGS", a.CACHE = "CACHE", a.SERVER = "SERVER";
|
|
206
206
|
})(g || (g = {}));
|
|
207
|
-
var vt, A = null,
|
|
207
|
+
var vt, A = null, de = "FLAGSMITH_EVENT", ot = de, Gt = "https://edge.api.flagsmith.com/api/v1/", Mt = "flagsmith_value_", Jt = "flagsmith_enabled_", Vt = "flagsmith_trait_", ve = function() {
|
|
208
208
|
function a(e) {
|
|
209
209
|
var t = this;
|
|
210
210
|
this._trigger = null, this._triggerLoadingState = null, this.timestamp = null, this.isLoading = !1, this.eventSource = null, this.getFlags = function() {
|
|
@@ -215,21 +215,21 @@ var Dt = { exports: {} };
|
|
|
215
215
|
if (v && s === "".concat(t.getContext().identity)) {
|
|
216
216
|
var k = v.flags, L = v.traits, P = v.identifier;
|
|
217
217
|
t.isLoading = !1;
|
|
218
|
-
var j = {},
|
|
218
|
+
var j = {}, T = {};
|
|
219
219
|
L = L || [], (k = k || []).forEach(function(m) {
|
|
220
220
|
j[m.feature.name.toLowerCase().replace(/ /g, "_")] = { id: m.feature.id, enabled: m.enabled, value: m.feature_state_value };
|
|
221
221
|
}), L.forEach(function(m) {
|
|
222
|
-
|
|
222
|
+
T[m.trait_key.toLowerCase().replace(/ /g, "_")] = { transient: m.transient, value: m.trait_value };
|
|
223
223
|
}), t.oldFlags = l({}, t.flags);
|
|
224
|
-
var U =
|
|
225
|
-
if ((P || Object.keys(
|
|
224
|
+
var U = F(t.oldFlags, j), W = F((p = t.evaluationContext.identity) === null || p === void 0 ? void 0 : p.traits, T);
|
|
225
|
+
if ((P || Object.keys(T).length) && (t.evaluationContext.identity = l(l({}, t.evaluationContext.identity), { traits: T }), P && (t.evaluationContext.identity.identifier = P)), t.flags = j, t.updateStorage(), t._onChange(t.oldFlags, { isFromServer: !0, flagsChanged: U, traitsChanged: W }, t._loadedState(null, g.SERVER)), t.datadogRum) try {
|
|
226
226
|
if (t.datadogRum.trackTraits) {
|
|
227
227
|
var tt = {};
|
|
228
228
|
Object.keys(((u = t.evaluationContext.identity) === null || u === void 0 ? void 0 : u.traits) || {}).map(function(m) {
|
|
229
229
|
tt[Vt + m] = t.getTrait(m);
|
|
230
230
|
});
|
|
231
|
-
var
|
|
232
|
-
t.log("Setting Datadog user",
|
|
231
|
+
var q = l(l(l({}, t.datadogRum.client.getUser()), { id: t.datadogRum.client.getUser().id || ((y = t.evaluationContext.identity) === null || y === void 0 ? void 0 : y.identifier) }), tt);
|
|
232
|
+
t.log("Setting Datadog user", q), t.datadogRum.client.setUser(q);
|
|
233
233
|
}
|
|
234
234
|
} catch (m) {
|
|
235
235
|
console.error(m);
|
|
@@ -237,9 +237,9 @@ var Dt = { exports: {} };
|
|
|
237
237
|
if (t.dtrum) try {
|
|
238
238
|
var w = { javaDouble: {}, date: {}, shortString: {}, javaLongOrObject: {} };
|
|
239
239
|
Object.keys(t.flags).map(function(m) {
|
|
240
|
-
|
|
240
|
+
_(w, Mt + m, t.getValue(m, { skipAnalytics: !0 })), _(w, Jt + m, t.hasFeature(m, { skipAnalytics: !0 }));
|
|
241
241
|
}), Object.keys(((x = t.evaluationContext.identity) === null || x === void 0 ? void 0 : x.traits) || {}).map(function(m) {
|
|
242
|
-
|
|
242
|
+
_(w, Vt + m, t.getTrait(m));
|
|
243
243
|
}), t.log("Sending javaLongOrObject traits to dynatrace", w.javaLongOrObject), t.log("Sending date traits to dynatrace", w.date), t.log("Sending shortString traits to dynatrace", w.shortString), t.log("Sending javaDouble to dynatrace", w.javaDouble), t.dtrum.sendSessionProperties(w.javaLongOrObject, w.date, w.shortString, w.javaDouble);
|
|
244
244
|
} catch (m) {
|
|
245
245
|
console.error(m);
|
|
@@ -301,7 +301,7 @@ var Dt = { exports: {} };
|
|
|
301
301
|
var n;
|
|
302
302
|
if (t.api) return t.setContext(l(l({}, t.evaluationContext), { identity: l(l({}, t.evaluationContext.identity), { traits: l(l({}, (n = t.evaluationContext.identity) === null || n === void 0 ? void 0 : n.traits), Object.fromEntries(Object.entries(i).map(function(r) {
|
|
303
303
|
var s = r[0], h = r[1];
|
|
304
|
-
return [s,
|
|
304
|
+
return [s, J(h) ? h : { value: h }];
|
|
305
305
|
}))) }) }));
|
|
306
306
|
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.");
|
|
307
307
|
}, this.hasFeature = function(i, n) {
|
|
@@ -324,13 +324,13 @@ var Dt = { exports: {} };
|
|
|
324
324
|
var j = parseFloat(P);
|
|
325
325
|
if (isNaN(j)) return Promise.reject("Failed to parse x-flagsmith-document-updated-at");
|
|
326
326
|
t.timestamp = j;
|
|
327
|
-
} catch (
|
|
328
|
-
t.log(
|
|
327
|
+
} catch (T) {
|
|
328
|
+
t.log(T, "Failed to parse x-flagsmith-document-updated-at", P);
|
|
329
329
|
}
|
|
330
|
-
return t.log("Fetch response: " + y.status + " " + (n || "GET") + 0 + i), y.text().then(function(
|
|
331
|
-
var U =
|
|
330
|
+
return t.log("Fetch response: " + y.status + " " + (n || "GET") + 0 + i), y.text().then(function(T) {
|
|
331
|
+
var U = T;
|
|
332
332
|
try {
|
|
333
|
-
U = JSON.parse(
|
|
333
|
+
U = JSON.parse(T);
|
|
334
334
|
} catch {
|
|
335
335
|
}
|
|
336
336
|
return !U && y.status && (U = "API Response: ".concat(y.status)), y.status && y.status >= 200 && y.status < 300 ? U : Promise.reject(new Error(U));
|
|
@@ -339,7 +339,7 @@ var Dt = { exports: {} };
|
|
|
339
339
|
t.log("Received response with identity mismatch, ignoring response. Requested: ".concat(u, ", Current: ").concat(L));
|
|
340
340
|
});
|
|
341
341
|
}, this.evaluateFlag = function(i, n) {
|
|
342
|
-
if (t.datadogRum && (t.datadogRum.client.addFeatureFlagEvaluation ? n === "VALUE" ? t.datadogRum.client.addFeatureFlagEvaluation(
|
|
342
|
+
if (t.datadogRum && (t.datadogRum.client.addFeatureFlagEvaluation ? n === "VALUE" ? t.datadogRum.client.addFeatureFlagEvaluation(Mt + i, t.getValue(i, {}, !0)) : t.datadogRum.client.addFeatureFlagEvaluation(Jt + i, t.hasFeature(i, !0)) : console.error("Flagsmith: Your datadog RUM client does not support the function addFeatureFlagEvaluation, please update it.")), t.enableAnalytics) {
|
|
343
343
|
if (!t.evaluationEvent || !t.evaluationContext.environment) return;
|
|
344
344
|
t.evaluationEvent[t.evaluationContext.environment.apiKey] || (t.evaluationEvent[t.evaluationContext.environment.apiKey] = {}), t.evaluationEvent[t.evaluationContext.environment.apiKey][i] === void 0 && (t.evaluationEvent[t.evaluationContext.environment.apiKey][i] = 0), t.evaluationEvent[t.evaluationContext.environment.apiKey][i] += 1;
|
|
345
345
|
}
|
|
@@ -351,90 +351,90 @@ var Dt = { exports: {} };
|
|
|
351
351
|
}
|
|
352
352
|
return a.prototype.init = function(e) {
|
|
353
353
|
var t, i, n;
|
|
354
|
-
return
|
|
355
|
-
var r, s, h, v, p, u, y, x, k, L, P, j,
|
|
354
|
+
return b(this, void 0, void 0, function() {
|
|
355
|
+
var r, s, h, v, p, u, y, x, k, L, P, j, T, U, W, tt, q, w, m, gt, et, Yt, X, pt, Zt, Qt, yt, Wt, mt, nt, Y, te, O = this;
|
|
356
356
|
return I(this, function(R) {
|
|
357
357
|
switch (R.label) {
|
|
358
358
|
case 0:
|
|
359
359
|
r = dt(e.evaluationContext || this.evaluationContext), R.label = 1;
|
|
360
360
|
case 1:
|
|
361
|
-
if (R.trys.push([1, 13, , 14]), s = e.environmentID, h = e.api, v = h === void 0 ? Gt : h, p = e.headers, u = e.onChange, y = e.cacheFlags, x = e.datadogRum, k = e.onError, L = e.defaultFlags, P = e.fetch, j = e.preventFetch,
|
|
362
|
-
if (r.identity = gt || et ? { identifier: gt, traits: et ? Object.fromEntries(Object.entries(et).map(function(
|
|
363
|
-
return [
|
|
364
|
-
})) : {} } : r.identity, this.evaluationContext = r, this.api = v, this.headers = p, this.getFlagInterval = null, this.analyticsInterval = null, this.onChange = u, yt = "Wrong Flagsmith Configuration: preventFetch is true and no defaulFlags provided", this._trigger = Zt || this._trigger, this._triggerLoadingState = Qt || this._triggerLoadingState, this.onError = function(
|
|
365
|
-
O.setLoadingState(l(l({}, O.loadingState), { isFetching: !1, isLoading: !1, error:
|
|
366
|
-
}, this.enableLogs =
|
|
361
|
+
if (R.trys.push([1, 13, , 14]), s = e.environmentID, h = e.api, v = h === void 0 ? Gt : h, p = e.headers, u = e.onChange, y = e.cacheFlags, x = e.datadogRum, k = e.onError, L = e.defaultFlags, P = e.fetch, j = e.preventFetch, T = e.enableLogs, U = e.enableDynatrace, W = e.enableAnalytics, tt = e.realtime, q = e.eventSourceUrl, w = q === void 0 ? "https://realtime.flagsmith.com/" : q, m = e.AsyncStorage, gt = e.identity, et = e.traits, Yt = e.state, X = e.cacheOptions, pt = e.angularHttpClient, Zt = e._trigger, Qt = e._triggerLoadingState, r.environment = s ? { apiKey: s } : r.environment, !r.environment || !r.environment.apiKey) throw new Error("Please provide `evaluationContext.environment` with non-empty `apiKey`");
|
|
362
|
+
if (r.identity = gt || et ? { identifier: gt, traits: et ? Object.fromEntries(Object.entries(et).map(function(N) {
|
|
363
|
+
return [N[0], { value: N[1] }];
|
|
364
|
+
})) : {} } : r.identity, this.evaluationContext = r, this.api = v, this.headers = p, this.getFlagInterval = null, this.analyticsInterval = null, this.onChange = u, yt = "Wrong Flagsmith Configuration: preventFetch is true and no defaulFlags provided", this._trigger = Zt || this._trigger, this._triggerLoadingState = Qt || this._triggerLoadingState, this.onError = function(N) {
|
|
365
|
+
O.setLoadingState(l(l({}, O.loadingState), { isFetching: !1, isLoading: !1, error: N })), k == null || k(N);
|
|
366
|
+
}, this.enableLogs = T || !1, this.cacheOptions = X ? { skipAPI: !!X.skipAPI, ttl: X.ttl || 0, storageKey: X.storageKey, loadStale: !!X.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."), P && (S = P), this.enableAnalytics = W || !1, this.flags = Object.assign({}, L) || {}, this.datadogRum = x || null, this.initialised = !0, this.ticks = 1e4, this.timer = this.enableLogs ? (/* @__PURE__ */ new Date()).valueOf() : null, this.cacheFlags = A !== void 0 && !!y, ot = "FLAGSMITH_EVENT_" + r.environment.apiKey, m && (A = m), tt && typeof window < "u" && this.setupRealtime(w, r.environment.apiKey), Object.keys(this.flags).length && (this.loadingState = l(l({}, this.loadingState), { isLoading: !1, source: g.DEFAULT_FLAGS })), this.setState(Yt), this.log("Initialising with properties", e, this), U && (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), pt && (S = /* @__PURE__ */ function(N) {
|
|
367
367
|
return function(K, D) {
|
|
368
|
-
var
|
|
369
|
-
return new Promise(function(
|
|
368
|
+
var H = D.headers, C = D.method, Z = D.body;
|
|
369
|
+
return new Promise(function(B) {
|
|
370
370
|
switch (C) {
|
|
371
371
|
case "GET":
|
|
372
|
-
return
|
|
373
|
-
|
|
372
|
+
return N.get(K, { headers: H }).subscribe(function(V) {
|
|
373
|
+
B({ ok: !0, text: function() {
|
|
374
374
|
return Promise.resolve(V);
|
|
375
375
|
} });
|
|
376
376
|
});
|
|
377
377
|
case "POST":
|
|
378
378
|
case "PUT":
|
|
379
|
-
return
|
|
380
|
-
|
|
379
|
+
return N.post(K, Z, { headers: H }).subscribe(function(V) {
|
|
380
|
+
B({ ok: !0, text: function() {
|
|
381
381
|
return Promise.resolve(V);
|
|
382
382
|
} });
|
|
383
383
|
});
|
|
384
384
|
}
|
|
385
385
|
});
|
|
386
386
|
};
|
|
387
|
-
}(pt)), A && this.canUseStorage && A.getItem(ot).then(function(
|
|
387
|
+
}(pt)), A && this.canUseStorage && A.getItem(ot).then(function(N) {
|
|
388
388
|
try {
|
|
389
|
-
O.evaluationEvent = JSON.parse(
|
|
389
|
+
O.evaluationEvent = JSON.parse(N) || {};
|
|
390
390
|
} catch {
|
|
391
391
|
O.evaluationEvent = {};
|
|
392
392
|
}
|
|
393
393
|
O.analyticsInterval = setInterval(O.analyticsFlags, O.ticks);
|
|
394
|
-
}), this.enableAnalytics && (this.analyticsInterval && clearInterval(this.analyticsInterval), A && this.canUseStorage && A.getItem(ot, function(
|
|
394
|
+
}), this.enableAnalytics && (this.analyticsInterval && clearInterval(this.analyticsInterval), A && this.canUseStorage && A.getItem(ot, function(N, K) {
|
|
395
395
|
if (K && O.evaluationContext.environment) {
|
|
396
396
|
var D = JSON.parse(K);
|
|
397
397
|
if (D[O.evaluationContext.environment.apiKey]) {
|
|
398
|
-
var
|
|
399
|
-
O.log("Retrieved events from cache", K), O.setState(l(l({},
|
|
398
|
+
var H = O.getState();
|
|
399
|
+
O.log("Retrieved events from cache", K), O.setState(l(l({}, H), { evaluationEvent: D[O.evaluationContext.environment.apiKey] }));
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
})), !y) return [3, 9];
|
|
403
403
|
if (!A || !this.canUseStorage) return [3, 8];
|
|
404
|
-
Wt = function(
|
|
405
|
-
return
|
|
406
|
-
var D,
|
|
407
|
-
return I(this, function(
|
|
408
|
-
switch (
|
|
404
|
+
Wt = function(N, K) {
|
|
405
|
+
return b(O, void 0, void 0, function() {
|
|
406
|
+
var D, H, C, Z, B, V, St, ee, Ct, _t, Ft, bt, Et, xt, wt, Ot, It, At, Lt, jt, Tt, Nt, Pt, Rt, ne = this;
|
|
407
|
+
return I(this, function(z) {
|
|
408
|
+
switch (z.label) {
|
|
409
409
|
case 0:
|
|
410
410
|
if (!K) return [3, 7];
|
|
411
|
-
D = null,
|
|
411
|
+
D = null, H = null, z.label = 1;
|
|
412
412
|
case 1:
|
|
413
|
-
return
|
|
413
|
+
return z.trys.push([1, 5, , 6]), C = JSON.parse(K), Z = !1, B = !1, C && C.api === this.api && ((_t = (Ct = C.evaluationContext) === null || Ct === void 0 ? void 0 : Ct.environment) === null || _t === void 0 ? void 0 : _t.apiKey) === ((Ft = this.evaluationContext.environment) === null || Ft === void 0 ? void 0 : Ft.apiKey) && (V = !0, this.evaluationContext.identity && ((Et = (bt = C.evaluationContext) === null || bt === void 0 ? void 0 : bt.identity) === null || Et === void 0 ? void 0 : Et.identifier) !== this.evaluationContext.identity.identifier && (this.log("Ignoring cache, identity has changed from " + ((wt = (xt = C.evaluationContext) === null || xt === void 0 ? void 0 : xt.identity) === null || wt === void 0 ? void 0 : wt.identifier) + " to " + this.evaluationContext.identity.identifier), V = !1), this.cacheOptions.ttl && (!C.ts || (/* @__PURE__ */ new Date()).valueOf() - C.ts > this.cacheOptions.ttl) && (C.ts && !this.cacheOptions.loadStale ? (this.log("Ignoring cache, timestamp is too old ts:" + C.ts + " ttl: " + this.cacheOptions.ttl + " time elapsed since cache: " + ((/* @__PURE__ */ new Date()).valueOf() - C.ts) + "ms"), V = !1) : C.ts && this.cacheOptions.loadStale && (this.log("Loading stale cache, timestamp ts:" + C.ts + " ttl: " + this.cacheOptions.ttl + " time elapsed since cache: " + ((/* @__PURE__ */ new Date()).valueOf() - C.ts) + "ms"), B = !0, V = !0)), V && (Z = !0, H = F((Ot = this.evaluationContext.identity) === null || Ot === void 0 ? void 0 : Ot.traits, (At = (It = C.evaluationContext) === null || It === void 0 ? void 0 : It.identity) === null || At === void 0 ? void 0 : At.traits), D = F(this.flags, C.flags), this.setState(l(l({}, C), { evaluationContext: dt(l(l({}, C.evaluationContext), { identity: !((Lt = C.evaluationContext) === null || Lt === void 0) && Lt.identity ? l(l({}, (jt = C.evaluationContext) === null || jt === void 0 ? void 0 : jt.identity), { traits: l(l({}, ((Nt = (Tt = C.evaluationContext) === null || Tt === void 0 ? void 0 : Tt.identity) === null || Nt === void 0 ? void 0 : Nt.traits) || {}), et || {}) }) : void 0 })) })), this.log("Retrieved flags from cache", C))), Z ? (St = !j && (!this.cacheOptions.skipAPI || B), this._onChange(null, { isFromServer: !1, flagsChanged: D, traitsChanged: H }, this._loadedState(null, g.CACHE, St)), this.oldFlags = this.flags, this.cacheOptions.skipAPI && Z && !B && this.log("Skipping API, using cache"), St && this.getFlags().catch(function(pe) {
|
|
414
414
|
var kt;
|
|
415
|
-
(kt = ne.onError) === null || kt === void 0 || kt.call(ne,
|
|
415
|
+
(kt = ne.onError) === null || kt === void 0 || kt.call(ne, pe);
|
|
416
416
|
}), [3, 4]) : [3, 2];
|
|
417
417
|
case 2:
|
|
418
418
|
return j ? [3, 4] : [4, this.getFlags()];
|
|
419
419
|
case 3:
|
|
420
|
-
|
|
420
|
+
z.sent(), z.label = 4;
|
|
421
421
|
case 4:
|
|
422
422
|
return [3, 6];
|
|
423
423
|
case 5:
|
|
424
|
-
return ee =
|
|
424
|
+
return ee = z.sent(), this.log("Exception fetching cached logs", ee), [3, 6];
|
|
425
425
|
case 6:
|
|
426
426
|
return [3, 10];
|
|
427
427
|
case 7:
|
|
428
428
|
return j ? [3, 9] : [4, this.getFlags()];
|
|
429
429
|
case 8:
|
|
430
|
-
return
|
|
430
|
+
return z.sent(), [3, 10];
|
|
431
431
|
case 9:
|
|
432
|
-
if (L) this._onChange(null, { isFromServer: !1, flagsChanged:
|
|
432
|
+
if (L) this._onChange(null, { isFromServer: !1, flagsChanged: F({}, this.flags), traitsChanged: F({}, (Pt = this.evaluationContext.identity) === null || Pt === void 0 ? void 0 : Pt.traits) }, this._loadedState(null, g.DEFAULT_FLAGS));
|
|
433
433
|
else {
|
|
434
434
|
if (!this.flags) throw new Error(yt);
|
|
435
|
-
this._onChange(null, { isFromServer: !1, flagsChanged:
|
|
435
|
+
this._onChange(null, { isFromServer: !1, flagsChanged: F({}, this.flags), traitsChanged: F({}, (Rt = this.evaluationContext.identity) === null || Rt === void 0 ? void 0 : Rt.traits) }, this._loadedState(null, g.DEFAULT_FLAGS));
|
|
436
436
|
}
|
|
437
|
-
|
|
437
|
+
z.label = 10;
|
|
438
438
|
case 10:
|
|
439
439
|
return [2];
|
|
440
440
|
}
|
|
@@ -459,8 +459,8 @@ var Dt = { exports: {} };
|
|
|
459
459
|
case 10:
|
|
460
460
|
return R.sent(), [3, 12];
|
|
461
461
|
case 11:
|
|
462
|
-
if (L) this._onChange(null, { isFromServer: !1, flagsChanged:
|
|
463
|
-
else if (this.flags && (nt = null, Object.keys(this.flags).length === 0 && (nt = yt), this._onChange(null, { isFromServer: !1, flagsChanged:
|
|
462
|
+
if (L) this._onChange(null, { isFromServer: !1, flagsChanged: F({}, L), traitsChanged: F({}, (t = r.identity) === null || t === void 0 ? void 0 : t.traits) }, this._loadedState(null, g.DEFAULT_FLAGS));
|
|
463
|
+
else if (this.flags && (nt = null, Object.keys(this.flags).length === 0 && (nt = yt), this._onChange(null, { isFromServer: !1, flagsChanged: F({}, this.flags), traitsChanged: F({}, (i = r.identity) === null || i === void 0 ? void 0 : i.traits) }, this._loadedState(nt, g.DEFAULT_FLAGS)), nt)) throw new Error(nt);
|
|
464
464
|
R.label = 12;
|
|
465
465
|
case 12:
|
|
466
466
|
return [3, 14];
|
|
@@ -476,7 +476,7 @@ var Dt = { exports: {} };
|
|
|
476
476
|
}, a.prototype.identify = function(e, t, i) {
|
|
477
477
|
return this.evaluationContext.identity = { identifier: e, transient: i, traits: this.evaluationContext.identity && this.evaluationContext.identity.identifier == e ? this.evaluationContext.identity.traits : {} }, this.evaluationContext.identity.identifier = e, this.log("Identify: " + this.evaluationContext.identity.identifier), t && (this.evaluationContext.identity.traits = Object.fromEntries(Object.entries(t).map(function(n) {
|
|
478
478
|
var r = n[0], s = n[1];
|
|
479
|
-
return [r,
|
|
479
|
+
return [r, J(s) ? s : { value: s }];
|
|
480
480
|
}))), this.initialised ? this.getFlags() : Promise.resolve();
|
|
481
481
|
}, a.prototype.getState = function() {
|
|
482
482
|
return { api: this.api, flags: this.flags, ts: this.ts, evaluationContext: this.evaluationContext, evaluationEvent: this.evaluationEvent };
|
|
@@ -508,7 +508,7 @@ var Dt = { exports: {} };
|
|
|
508
508
|
}
|
|
509
509
|
}, a.prototype.setLoadingState = function(e) {
|
|
510
510
|
var t;
|
|
511
|
-
|
|
511
|
+
$(e, this.loadingState) || (this.loadingState = l({}, e), this.log("Loading state changed", e), (t = this._triggerLoadingState) === null || t === void 0 || t.call(this));
|
|
512
512
|
}, a.prototype.setupRealtime = function(e, t) {
|
|
513
513
|
var i = this, n = e + "sse/environments/" + t + "/stream";
|
|
514
514
|
vt ? this.eventSource || (this.log("Creating event source with url " + n), this.eventSource = new vt(n), this.eventSource.addEventListener("environment_updated", function(r) {
|
|
@@ -522,11 +522,11 @@ var Dt = { exports: {} };
|
|
|
522
522
|
})) : this.log("Error, EventSource is undefined");
|
|
523
523
|
}, a;
|
|
524
524
|
}();
|
|
525
|
-
function
|
|
525
|
+
function Ht(a) {
|
|
526
526
|
var e = a.fetch, t = a.AsyncStorage, i = a.eventSource;
|
|
527
|
-
return new
|
|
527
|
+
return new ve({ fetch: e, AsyncStorage: t, eventSource: i });
|
|
528
528
|
}
|
|
529
|
-
var st,
|
|
529
|
+
var st, fe = (st = function(a, e) {
|
|
530
530
|
return st = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, i) {
|
|
531
531
|
t.__proto__ = i;
|
|
532
532
|
} || function(t, i) {
|
|
@@ -538,14 +538,14 @@ var Dt = { exports: {} };
|
|
|
538
538
|
this.constructor = a;
|
|
539
539
|
}
|
|
540
540
|
st(a, e), a.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
|
|
541
|
-
}),
|
|
541
|
+
}), zt = function(a) {
|
|
542
542
|
var e = typeof Symbol == "function" && Symbol.iterator, t = e && a[e], i = 0;
|
|
543
543
|
if (t) return t.call(a);
|
|
544
544
|
if (a && typeof a.length == "number") return { next: function() {
|
|
545
545
|
return a && i >= a.length && (a = void 0), { value: a && a[i++], done: !a };
|
|
546
546
|
} };
|
|
547
547
|
throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
548
|
-
},
|
|
548
|
+
}, Bt = function(a, e) {
|
|
549
549
|
var t = typeof Symbol == "function" && a[Symbol.iterator];
|
|
550
550
|
if (!t) return a;
|
|
551
551
|
var i, n, r = t.call(a), s = [];
|
|
@@ -564,16 +564,16 @@ var Dt = { exports: {} };
|
|
|
564
564
|
}, ft = function(a, e, t) {
|
|
565
565
|
if (arguments.length === 2) for (var i, n = 0, r = e.length; n < r; n++) !i && n in e || (i || (i = Array.prototype.slice.call(e, 0, n)), i[n] = e[n]);
|
|
566
566
|
return a.concat(i || Array.prototype.slice.call(e));
|
|
567
|
-
},
|
|
567
|
+
}, ge = function(a) {
|
|
568
568
|
function e() {
|
|
569
569
|
return a.call(this, `EventSource not available.
|
|
570
570
|
Consider loading an EventSource polyfill and making it available globally as EventSource, or passing one in as eventSourceClass to the ReconnectingEventSource constructor.`) || this;
|
|
571
571
|
}
|
|
572
|
-
return
|
|
573
|
-
}(Error),
|
|
572
|
+
return fe(e, a), e;
|
|
573
|
+
}(Error), $t = function() {
|
|
574
574
|
function a(e, t) {
|
|
575
575
|
var i = this;
|
|
576
|
-
if (this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, this._configuration = t != null ? Object.assign({}, t) : void 0, this.withCredentials = !1, this._eventSource = null, this._lastEventId = null, this._timer = null, this._listeners = { open: [], error: [], message: [] }, this.url = e.toString(), this.readyState = this.CONNECTING, this.max_retry_time = 3e3, this.eventSourceClass = globalThis.FlagsmithEventSource, this._configuration != null && (this._configuration.lastEventId && (this._lastEventId = this._configuration.lastEventId, delete this._configuration.lastEventId), this._configuration.max_retry_time && (this.max_retry_time = this._configuration.max_retry_time, delete this._configuration.max_retry_time), this._configuration.eventSourceClass && (this.eventSourceClass = this._configuration.eventSourceClass, delete this._configuration.eventSourceClass)), this.eventSourceClass == null || typeof this.eventSourceClass != "function") throw new
|
|
576
|
+
if (this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, this._configuration = t != null ? Object.assign({}, t) : void 0, this.withCredentials = !1, this._eventSource = null, this._lastEventId = null, this._timer = null, this._listeners = { open: [], error: [], message: [] }, this.url = e.toString(), this.readyState = this.CONNECTING, this.max_retry_time = 3e3, this.eventSourceClass = globalThis.FlagsmithEventSource, this._configuration != null && (this._configuration.lastEventId && (this._lastEventId = this._configuration.lastEventId, delete this._configuration.lastEventId), this._configuration.max_retry_time && (this.max_retry_time = this._configuration.max_retry_time, delete this._configuration.max_retry_time), this._configuration.eventSourceClass && (this.eventSourceClass = this._configuration.eventSourceClass, delete this._configuration.eventSourceClass)), this.eventSourceClass == null || typeof this.eventSourceClass != "function") throw new ge();
|
|
577
577
|
this._onevent_wrapped = function(n) {
|
|
578
578
|
i._onevent(n);
|
|
579
579
|
}, this._start();
|
|
@@ -590,7 +590,7 @@ Consider loading an EventSource polyfill and making it available globally as Eve
|
|
|
590
590
|
i.onmessage(v);
|
|
591
591
|
};
|
|
592
592
|
try {
|
|
593
|
-
for (var r =
|
|
593
|
+
for (var r = zt(Object.keys(this._listeners)), s = r.next(); !s.done; s = r.next()) {
|
|
594
594
|
var h = s.value;
|
|
595
595
|
this._eventSource.addEventListener(h, this._onevent_wrapped);
|
|
596
596
|
}
|
|
@@ -619,7 +619,7 @@ Consider loading an EventSource polyfill and making it available globally as Eve
|
|
|
619
619
|
e && e.lastEventId && (this._lastEventId = e.lastEventId);
|
|
620
620
|
var n = this._listeners[e.type];
|
|
621
621
|
if (n != null) try {
|
|
622
|
-
for (var r =
|
|
622
|
+
for (var r = zt(ft([], Bt(n), !1)), s = r.next(); !s.done; s = r.next())
|
|
623
623
|
s.value.call(this, e);
|
|
624
624
|
} catch (h) {
|
|
625
625
|
t = { error: h };
|
|
@@ -639,7 +639,7 @@ Consider loading an EventSource polyfill and making it available globally as Eve
|
|
|
639
639
|
}, a.prototype.addEventListener = function(e, t, i) {
|
|
640
640
|
this._listeners[e] == null && (this._listeners[e] = [], this._eventSource != null && this._eventSource.addEventListener(e, this._onevent_wrapped));
|
|
641
641
|
var n = this._listeners[e];
|
|
642
|
-
n.includes(t) || (this._listeners[e] = ft(ft([],
|
|
642
|
+
n.includes(t) || (this._listeners[e] = ft(ft([], Bt(n), !1), [t], !1));
|
|
643
643
|
}, a.prototype.removeEventListener = function(e, t, i) {
|
|
644
644
|
var n = this._listeners[e];
|
|
645
645
|
this._listeners[e] = n.filter(function(r) {
|
|
@@ -648,7 +648,7 @@ Consider loading an EventSource polyfill and making it available globally as Eve
|
|
|
648
648
|
}, a;
|
|
649
649
|
}();
|
|
650
650
|
globalThis.FlagsmithEventSource = typeof EventSource < "u" ? EventSource : null;
|
|
651
|
-
var
|
|
651
|
+
var qt = function(a, e) {
|
|
652
652
|
return e = e || {}, new Promise(function(t, i) {
|
|
653
653
|
var n = new XMLHttpRequest(), r = [], s = [], h = {}, v = function() {
|
|
654
654
|
return { ok: (n.status / 100 | 0) == 2, statusText: n.statusText, status: n.status, url: n.responseURL, text: function() {
|
|
@@ -674,15 +674,15 @@ Consider loading an EventSource polyfill and making it available globally as Eve
|
|
|
674
674
|
}, n.onerror = i, n.withCredentials = e.credentials == "include", e.headers) n.setRequestHeader(p, e.headers[p]);
|
|
675
675
|
n.send(e.body || null);
|
|
676
676
|
});
|
|
677
|
-
}, Xt =
|
|
677
|
+
}, Xt = Ht({ AsyncStorage: f, fetch: qt, eventSource: $t });
|
|
678
678
|
typeof window < "u" && (window.flagsmith = Xt), d.createFlagsmithInstance = function() {
|
|
679
|
-
return
|
|
679
|
+
return Ht({ AsyncStorage: f, fetch: qt, eventSource: $t });
|
|
680
680
|
}, d.default = Xt, Object.defineProperty(d, "__esModule", { value: !0 });
|
|
681
681
|
});
|
|
682
682
|
})(Dt, Dt.exports);
|
|
683
|
-
var be = Dt.exports,
|
|
683
|
+
var be = Dt.exports, Ee = {
|
|
684
684
|
NOT_INITIALIZED: "FeatureFlag not initialized. Call init() first."
|
|
685
|
-
}, ie = "business", G,
|
|
685
|
+
}, ie = "business", G, xe = (G = class {
|
|
686
686
|
constructor() {
|
|
687
687
|
lt(this, "flagsmithClient", null);
|
|
688
688
|
lt(this, "userContext", null);
|
|
@@ -692,13 +692,13 @@ var be = Dt.exports, Fe = {
|
|
|
692
692
|
}
|
|
693
693
|
ensureInitialized() {
|
|
694
694
|
if (!this.flagsmithClient)
|
|
695
|
-
throw new Error(
|
|
695
|
+
throw new Error(Ee.NOT_INITIALIZED);
|
|
696
696
|
}
|
|
697
697
|
async init(o, d = []) {
|
|
698
698
|
if (!this.flagsmithClient)
|
|
699
699
|
try {
|
|
700
700
|
this.flagsmithClient = be.createFlagsmithInstance();
|
|
701
|
-
const f = d.reduce((l,
|
|
701
|
+
const f = d.reduce((l, b) => (l[b.feature.name] = b, l), {});
|
|
702
702
|
await this.flagsmithClient.init({
|
|
703
703
|
environmentID: o.apiKey,
|
|
704
704
|
api: (o == null ? void 0 : o.url) ?? "https://feature-flag-proxy.feedme.farm/api/v1/",
|
|
@@ -768,14 +768,14 @@ var be = Dt.exports, Fe = {
|
|
|
768
768
|
}
|
|
769
769
|
async getUserFlagValue(o, d, f = null, l) {
|
|
770
770
|
var I;
|
|
771
|
-
const
|
|
771
|
+
const b = this.userContext;
|
|
772
772
|
try {
|
|
773
773
|
return await this.setUser(o), this.getFlagValue(d, l) ?? f;
|
|
774
774
|
} catch (E) {
|
|
775
775
|
return console.error(`Error getting user flag value for ${d}:`, E), f;
|
|
776
776
|
} finally {
|
|
777
777
|
try {
|
|
778
|
-
await ((I = this.flagsmithClient) == null ? void 0 : I.logout()), this.userContext = null,
|
|
778
|
+
await ((I = this.flagsmithClient) == null ? void 0 : I.logout()), this.userContext = null, b && await this.setUser(b.identifier);
|
|
779
779
|
} catch (E) {
|
|
780
780
|
console.error("Error during cleanup:", E);
|
|
781
781
|
}
|
|
@@ -784,8 +784,8 @@ var be = Dt.exports, Fe = {
|
|
|
784
784
|
reset() {
|
|
785
785
|
this.flagsmithClient = null, this.userContext = null;
|
|
786
786
|
}
|
|
787
|
-
}, lt(G, "instance"), G),
|
|
788
|
-
function
|
|
787
|
+
}, lt(G, "instance"), G), we = xe.getInstance(), it = M(!1), ct = M([]), Q = M(null);
|
|
788
|
+
function Oe(c = we) {
|
|
789
789
|
const o = () => it.value ? !0 : (console.warn("FeatureFlag is not initialized. Using default values."), !1), d = async (g, S = []) => {
|
|
790
790
|
if (it.value) {
|
|
791
791
|
console.warn("FeatureFlag is already initialized.");
|
|
@@ -793,8 +793,8 @@ function we(c = xe) {
|
|
|
793
793
|
}
|
|
794
794
|
try {
|
|
795
795
|
await c.init(g, S), ct.value = await c.getFlags(), it.value = !0, Q.value = null;
|
|
796
|
-
} catch (
|
|
797
|
-
console.error("Failed to initialize feature flags:",
|
|
796
|
+
} catch (_) {
|
|
797
|
+
console.error("Failed to initialize feature flags:", _), Q.value = _;
|
|
798
798
|
}
|
|
799
799
|
}, f = async (g) => {
|
|
800
800
|
if (o())
|
|
@@ -803,28 +803,28 @@ function we(c = xe) {
|
|
|
803
803
|
} catch (S) {
|
|
804
804
|
console.error("Failed to set user:", S), Q.value = S;
|
|
805
805
|
}
|
|
806
|
-
}, l = async (g) => f(`${ie}-${g}`),
|
|
807
|
-
if (!o()) return
|
|
806
|
+
}, l = async (g) => f(`${ie}-${g}`), b = (g, S, _ = null) => {
|
|
807
|
+
if (!o()) return _;
|
|
808
808
|
try {
|
|
809
|
-
return c.getFlagValue(g, S) ??
|
|
810
|
-
} catch (
|
|
811
|
-
return console.error(`Error getting flag value for ${g}:`,
|
|
809
|
+
return c.getFlagValue(g, S) ?? _;
|
|
810
|
+
} catch (J) {
|
|
811
|
+
return console.error(`Error getting flag value for ${g}:`, J), _;
|
|
812
812
|
}
|
|
813
813
|
}, I = (g, S) => {
|
|
814
814
|
if (!o()) return S ?? null;
|
|
815
815
|
try {
|
|
816
816
|
return c.getFlag(g) ?? S ?? null;
|
|
817
|
-
} catch (
|
|
818
|
-
return console.error(`Error getting flag for ${g}:`,
|
|
817
|
+
} catch (_) {
|
|
818
|
+
return console.error(`Error getting flag for ${g}:`, _), S ?? null;
|
|
819
819
|
}
|
|
820
|
-
}, E = async (g, S,
|
|
821
|
-
if (!o()) return
|
|
820
|
+
}, E = async (g, S, _ = null, J) => {
|
|
821
|
+
if (!o()) return _;
|
|
822
822
|
try {
|
|
823
|
-
return await c.getUserFlagValue(g, S,
|
|
823
|
+
return await c.getUserFlagValue(g, S, _, J);
|
|
824
824
|
} catch (rt) {
|
|
825
|
-
return console.error(`Error getting user flag value for ${S}:`, rt),
|
|
825
|
+
return console.error(`Error getting user flag value for ${S}:`, rt), _;
|
|
826
826
|
}
|
|
827
|
-
},
|
|
827
|
+
}, $ = async (g, S, _ = null, J) => E(`${ie}-${g}`, S, _, J), F = () => {
|
|
828
828
|
try {
|
|
829
829
|
c.reset();
|
|
830
830
|
} catch (g) {
|
|
@@ -840,37 +840,39 @@ function we(c = xe) {
|
|
|
840
840
|
init: d,
|
|
841
841
|
setUser: f,
|
|
842
842
|
setBusiness: l,
|
|
843
|
-
getFlagValue:
|
|
843
|
+
getFlagValue: b,
|
|
844
844
|
getFlag: I,
|
|
845
845
|
getUserFlagValue: E,
|
|
846
|
-
getBusinessFlagValue:
|
|
847
|
-
reset:
|
|
846
|
+
getBusinessFlagValue: $,
|
|
847
|
+
reset: F
|
|
848
848
|
};
|
|
849
849
|
}
|
|
850
|
-
var
|
|
850
|
+
var se = () => Oe();
|
|
851
851
|
const ae = {
|
|
852
852
|
dev: "MaGoXrEWuEJNpWgKTqseee",
|
|
853
853
|
prod: "6GhcttsJ9Rj9cTevcdrpin"
|
|
854
|
-
},
|
|
855
|
-
|
|
856
|
-
function Ge(c) {
|
|
857
|
-
if (ht) return ht;
|
|
858
|
-
const { init: o } = le(), d = c === "prod" ? ae.prod : ae.dev;
|
|
854
|
+
}, le = "order_miniprogram_v2", Ie = "https://flag.feedmeapi.com/api/v1/", ue = 1e4;
|
|
855
|
+
function ce(c, o, d) {
|
|
859
856
|
let f;
|
|
860
|
-
return
|
|
861
|
-
|
|
862
|
-
new Promise((l,
|
|
863
|
-
f = setTimeout(() =>
|
|
857
|
+
return Promise.race([
|
|
858
|
+
c,
|
|
859
|
+
new Promise((l, b) => {
|
|
860
|
+
f = setTimeout(() => b(new Error(`${d} exceeded ${o}ms`)), o);
|
|
864
861
|
})
|
|
865
|
-
]).
|
|
862
|
+
]).finally(() => clearTimeout(f));
|
|
863
|
+
}
|
|
864
|
+
const at = M("pending");
|
|
865
|
+
let ht = null;
|
|
866
|
+
function Je(c) {
|
|
867
|
+
if (ht) return ht;
|
|
868
|
+
const { init: o } = se(), d = c === "prod" ? ae.prod : ae.dev;
|
|
869
|
+
return ht = ce(o({ apiKey: d, url: Ie }), ue, "Flagsmith init").then(() => {
|
|
866
870
|
at.value = "ready";
|
|
867
|
-
}).catch((
|
|
868
|
-
at.value = "failed", console.warn("[FeatureFlag] init failed:",
|
|
869
|
-
}).finally(() => {
|
|
870
|
-
clearTimeout(f);
|
|
871
|
+
}).catch((f) => {
|
|
872
|
+
at.value = "failed", console.warn("[FeatureFlag] init failed:", f);
|
|
871
873
|
}), ht;
|
|
872
874
|
}
|
|
873
|
-
function
|
|
875
|
+
function Ae(c) {
|
|
874
876
|
try {
|
|
875
877
|
const o = typeof c == "string" ? JSON.parse(c) : c;
|
|
876
878
|
return o === !0 || o === "true" || (o == null ? void 0 : o.enabled) === !0 || (o == null ? void 0 : o.enabled) === "true";
|
|
@@ -878,7 +880,7 @@ function Oe(c) {
|
|
|
878
880
|
return c === !0 || c === "true";
|
|
879
881
|
}
|
|
880
882
|
}
|
|
881
|
-
function
|
|
883
|
+
function Le(c) {
|
|
882
884
|
try {
|
|
883
885
|
const o = typeof c == "string" ? JSON.parse(c) : c, d = o == null ? void 0 : o.edit_require_license;
|
|
884
886
|
return d === !0 || d === "true";
|
|
@@ -886,14 +888,14 @@ function Ie(c) {
|
|
|
886
888
|
return !1;
|
|
887
889
|
}
|
|
888
890
|
}
|
|
889
|
-
function
|
|
890
|
-
const f =
|
|
891
|
+
function he(c, o, d) {
|
|
892
|
+
const f = re(), { getBusinessFlagValue: l } = se(), b = M(o), I = M(!0);
|
|
891
893
|
let E = 0;
|
|
892
|
-
async function
|
|
894
|
+
async function $() {
|
|
893
895
|
var S;
|
|
894
|
-
const
|
|
896
|
+
const F = ++E, g = (S = f.currentBusiness.value) == null ? void 0 : S._id;
|
|
895
897
|
if (!g || at.value === "failed") {
|
|
896
|
-
|
|
898
|
+
b.value = o, I.value = !1;
|
|
897
899
|
return;
|
|
898
900
|
}
|
|
899
901
|
if (at.value === "pending") {
|
|
@@ -902,36 +904,40 @@ function ce(c, o, d) {
|
|
|
902
904
|
}
|
|
903
905
|
I.value = !0;
|
|
904
906
|
try {
|
|
905
|
-
const
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
F
|
|
907
|
+
const _ = await ce(
|
|
908
|
+
l(g, c, o),
|
|
909
|
+
ue,
|
|
910
|
+
`Flagsmith ${c} read`
|
|
911
|
+
);
|
|
912
|
+
if (F !== E) return;
|
|
913
|
+
b.value = d ? d(_) : _;
|
|
914
|
+
} catch (_) {
|
|
915
|
+
if (F !== E) return;
|
|
916
|
+
console.warn(`[FeatureFlag] ${c} read failed:`, _), b.value = o;
|
|
911
917
|
} finally {
|
|
912
|
-
|
|
918
|
+
F === E && (I.value = !1);
|
|
913
919
|
}
|
|
914
920
|
}
|
|
915
|
-
return
|
|
916
|
-
var
|
|
917
|
-
return (
|
|
918
|
-
}, at],
|
|
921
|
+
return Ce([() => {
|
|
922
|
+
var F;
|
|
923
|
+
return (F = f.currentBusiness.value) == null ? void 0 : F._id;
|
|
924
|
+
}, at], $, { immediate: !0 }), { value: b, loading: I };
|
|
919
925
|
}
|
|
920
|
-
function
|
|
921
|
-
const o =
|
|
922
|
-
if (
|
|
923
|
-
return { enabled:
|
|
924
|
-
const { value: d, loading: f } =
|
|
926
|
+
function Ve(c) {
|
|
927
|
+
const o = re();
|
|
928
|
+
if (je(c, o.namespace.value))
|
|
929
|
+
return { enabled: M(!0), loading: M(!1) };
|
|
930
|
+
const { value: d, loading: f } = he(le, !1, Ae);
|
|
925
931
|
return { enabled: d, loading: f };
|
|
926
932
|
}
|
|
927
|
-
function
|
|
928
|
-
const { value: c, loading: o } =
|
|
933
|
+
function He() {
|
|
934
|
+
const { value: c, loading: o } = he(le, !1, Le);
|
|
929
935
|
return { required: c, loading: o };
|
|
930
936
|
}
|
|
931
|
-
function
|
|
937
|
+
function je(c, o) {
|
|
932
938
|
return c.toLowerCase().includes("dev") && o === "dev";
|
|
933
939
|
}
|
|
934
|
-
function
|
|
940
|
+
function ze(c, o) {
|
|
935
941
|
if (typeof window > "u") return o;
|
|
936
942
|
try {
|
|
937
943
|
const d = window.localStorage.getItem(c);
|
|
@@ -940,7 +946,7 @@ function Ve(c, o) {
|
|
|
940
946
|
return o;
|
|
941
947
|
}
|
|
942
948
|
}
|
|
943
|
-
function
|
|
949
|
+
function Be(c, o) {
|
|
944
950
|
if (typeof window > "u") return o;
|
|
945
951
|
try {
|
|
946
952
|
const d = Number(window.localStorage.getItem(c));
|
|
@@ -949,24 +955,24 @@ function ze(c, o) {
|
|
|
949
955
|
return o;
|
|
950
956
|
}
|
|
951
957
|
}
|
|
952
|
-
function
|
|
958
|
+
function Te(c, o) {
|
|
953
959
|
if (!(typeof window > "u"))
|
|
954
960
|
try {
|
|
955
961
|
window.localStorage.setItem(c, o);
|
|
956
962
|
} catch {
|
|
957
963
|
}
|
|
958
964
|
}
|
|
959
|
-
function
|
|
960
|
-
|
|
965
|
+
function $e(c, o) {
|
|
966
|
+
Te(c, o ? "1" : "0");
|
|
961
967
|
}
|
|
962
968
|
export {
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
969
|
+
Ge as a,
|
|
970
|
+
Me as b,
|
|
971
|
+
He as c,
|
|
972
|
+
Be as d,
|
|
973
|
+
Te as e,
|
|
974
|
+
Je as i,
|
|
975
|
+
ze as r,
|
|
976
|
+
Ve as u,
|
|
977
|
+
$e as w
|
|
972
978
|
};
|