@feedmepos/mf-miniprogram-v2 0.2.8-dev.7 → 0.2.8-dev.9
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-BXXNMcyn.js → App-Ck_p8Anr.js} +256 -253
- package/dist/{ControlPlaneView-DzOE4Rp5.js → ControlPlaneView-CqTLqklv.js} +8158 -7868
- package/dist/{EcosystemView-CseWybDf.js → EcosystemView-Bt-UdWfQ.js} +3 -3
- package/dist/{MobileProjectDialog-CwXuQgpj.js → MobileProjectDialog-DAYQdrCY.js} +247 -236
- package/dist/{MobileProjectsView-CmL6GQYo.js → MobileProjectsView-z7GucfWB.js} +63 -60
- package/dist/ModuleCenterView-t8rhd419.js +283 -0
- package/dist/ModuleDetailView-C2TJToR7.js +296 -0
- package/dist/{PagesView-3ETr8RbI.js → PagesView-bXfOrylf.js} +2 -2
- package/dist/{PlatformUnavailableView-ChSD6P3O.js → PlatformUnavailableView-CkKpF-bi.js} +1 -1
- package/dist/{PortalSettingsView-DAmx9m4y.js → PortalSettingsView-D_2Gd3-Y.js} +2 -2
- package/dist/{TemplateCenterView-D0Gn07_x.js → TemplateCenterView-DEN51nfK.js} +2 -2
- package/dist/{WorkspaceEntryView-CC1214ig.js → WorkspaceEntryView-SLqO3Mi4.js} +2 -2
- package/dist/app.js +14 -14
- package/dist/{adminAccess-B4NYKH6x.js → localPreference-Do4VKtxT.js} +34 -34
- package/dist/package.json +1 -1
- package/dist/{portalContext-RYc53ma3.js → portalContext-BeKN8Bcx.js} +1 -1
- package/dist/portalNavigation-DDMi3QTt.js +43 -0
- package/dist/{routes-BvzMt5vp.js → routes-B9oMJsaM.js} +2 -0
- package/dist/style.css +1 -1
- package/dist/useModuleCatalog-Daw8KA--.js +147 -0
- package/package.json +1 -1
- package/dist/ModuleCenterView-E6ne4DiL.js +0 -165
- package/dist/ModuleDetailView-bTcegMeT.js +0 -189
- package/dist/portalNavigation-L5VwKlps.js +0 -42
- package/dist/useModuleCatalog-D73n52U3.js +0 -124
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { readonly as
|
|
1
|
+
var je = Object.defineProperty;
|
|
2
|
+
var ke = (m, s, f) => s in m ? je(m, s, { enumerable: !0, configurable: !0, writable: !0, value: f }) : m[s] = f;
|
|
3
|
+
var Et = (m, s, f) => ke(m, typeof s != "symbol" ? s + "" : s, f);
|
|
4
|
+
import { readonly as ee, ref as Z, watch as Ee, defineComponent as Te, computed as st, onMounted as Pe, onBeforeUnmount as Ne, resolveComponent as wt, openBlock as J, createElementBlock as Q, Fragment as ne, createElementVNode as C, normalizeClass as ie, createVNode as P, renderList as ye, unref as F, withCtx as ut, toDisplayString as ct, createBlock as be, createCommentVNode as ae } from "vue";
|
|
5
5
|
import { useCoreStore as we } from "@feedmepos/mf-common";
|
|
6
6
|
import { useRoute as Re, useRouter as Ke, RouterView as Ue } from "vue-router";
|
|
7
7
|
import { P as St } from "./PortalIcon-DO0VrIoY.js";
|
|
8
|
-
import { r as Se, u as Me, w as Ce } from "./
|
|
9
|
-
import { c as
|
|
10
|
-
import { p as De } from "./portalContext-
|
|
11
|
-
import { e as Ge, p as dt } from "./portalNavigation-
|
|
8
|
+
import { r as Se, u as Me, w as Ce } from "./localPreference-Do4VKtxT.js";
|
|
9
|
+
import { c as Ot } from "./_commonjsHelpers-DaMA6jEr.js";
|
|
10
|
+
import { p as De } from "./portalContext-BeKN8Bcx.js";
|
|
11
|
+
import { e as Ge, p as dt } from "./portalNavigation-DDMi3QTt.js";
|
|
12
12
|
import { _ as Be } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
13
|
-
var
|
|
14
|
-
(function(
|
|
13
|
+
var re = { exports: {} };
|
|
14
|
+
(function(m, s) {
|
|
15
15
|
(function(f, v) {
|
|
16
16
|
v(s);
|
|
17
|
-
})(
|
|
17
|
+
})(Ot, function(f) {
|
|
18
18
|
var v = { getItemSync: function(a) {
|
|
19
19
|
try {
|
|
20
20
|
return localStorage.getItem(a) || null;
|
|
@@ -45,7 +45,7 @@ var ae = { exports: {} };
|
|
|
45
45
|
return a;
|
|
46
46
|
}, o.apply(this, arguments);
|
|
47
47
|
};
|
|
48
|
-
function
|
|
48
|
+
function O(a, e, t, i) {
|
|
49
49
|
return new (t || (t = Promise))(function(n, r) {
|
|
50
50
|
function l(y) {
|
|
51
51
|
try {
|
|
@@ -129,11 +129,11 @@ var ae = { exports: {} };
|
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function w(a, e, t) {
|
|
133
133
|
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]);
|
|
134
134
|
return a.concat(i || Array.prototype.slice.call(e));
|
|
135
135
|
}
|
|
136
|
-
var
|
|
136
|
+
var W = function a(e, t) {
|
|
137
137
|
if (e === t) return !0;
|
|
138
138
|
if (e && t && typeof e == "object" && typeof t == "object") {
|
|
139
139
|
if (e.constructor !== t.constructor) return !1;
|
|
@@ -156,17 +156,17 @@ var ae = { exports: {} };
|
|
|
156
156
|
}
|
|
157
157
|
return e != e && t != t;
|
|
158
158
|
};
|
|
159
|
-
function
|
|
159
|
+
function E(a, e) {
|
|
160
160
|
var t = Object.keys(e || {}).filter(function(i) {
|
|
161
161
|
var n = a == null ? void 0 : a[i], r = e == null ? void 0 : e[i];
|
|
162
|
-
return !
|
|
162
|
+
return !W(n, r);
|
|
163
163
|
});
|
|
164
164
|
return Object.keys(a || {}).filter(function(i) {
|
|
165
165
|
Object.keys(e || {}).includes(i) || t.push(i);
|
|
166
166
|
}), Object.keys(t).length ? t : null;
|
|
167
167
|
}
|
|
168
|
-
var
|
|
169
|
-
function
|
|
168
|
+
var g, p;
|
|
169
|
+
function _(a, e, t) {
|
|
170
170
|
var i = "shortString", n = !0;
|
|
171
171
|
typeof t == "number" && (i = "javaDouble", n = !1), a[i] = a[i] || {}, a[i][e] = n ? t + "" : t;
|
|
172
172
|
}
|
|
@@ -184,44 +184,44 @@ var ae = { exports: {} };
|
|
|
184
184
|
}
|
|
185
185
|
(function(a) {
|
|
186
186
|
a.NONE = "NONE", a.DEFAULT_FLAGS = "DEFAULT_FLAGS", a.CACHE = "CACHE", a.SERVER = "SERVER";
|
|
187
|
-
})(
|
|
188
|
-
var
|
|
187
|
+
})(g || (g = {}));
|
|
188
|
+
var ht, A = null, At = "FLAGSMITH_EVENT", V = At, h = "https://edge.api.flagsmith.com/api/v1/", N = "flagsmith_value_", ft = "flagsmith_enabled_", Ft = "flagsmith_trait_", jt = function() {
|
|
189
189
|
function a(e) {
|
|
190
190
|
var t = this;
|
|
191
191
|
this._trigger = null, this._triggerLoadingState = null, this.timestamp = null, this.isLoading = !1, this.eventSource = null, this.getFlags = function() {
|
|
192
192
|
var i = t, n = i.api, r = i.evaluationContext;
|
|
193
193
|
t.log("Get Flags"), t.isLoading = !0, t.loadingState.isFetching || t.setLoadingState(o(o({}, t.loadingState), { isFetching: !0 }));
|
|
194
194
|
var l = "".concat(t.getContext().identity), c = function(d) {
|
|
195
|
-
var y, u, b,
|
|
195
|
+
var y, u, b, j;
|
|
196
196
|
if (d && l === "".concat(t.getContext().identity)) {
|
|
197
|
-
var
|
|
197
|
+
var q = d.flags, R = d.traits, G = d.identifier;
|
|
198
198
|
t.isLoading = !1;
|
|
199
199
|
var K = {}, U = {};
|
|
200
|
-
R = R || [], (
|
|
200
|
+
R = R || [], (q = q || []).forEach(function(S) {
|
|
201
201
|
K[S.feature.name.toLowerCase().replace(/ /g, "_")] = { id: S.feature.id, enabled: S.enabled, value: S.feature_state_value };
|
|
202
202
|
}), R.forEach(function(S) {
|
|
203
203
|
U[S.trait_key.toLowerCase().replace(/ /g, "_")] = { transient: S.transient, value: S.trait_value };
|
|
204
204
|
}), t.oldFlags = o({}, t.flags);
|
|
205
|
-
var
|
|
206
|
-
if ((G || Object.keys(U).length) && (t.evaluationContext.identity = o(o({}, t.evaluationContext.identity), { traits: U }), G && (t.evaluationContext.identity.identifier = G)), t.flags = K, t.updateStorage(), t._onChange(t.oldFlags, { isFromServer: !0, flagsChanged:
|
|
205
|
+
var z = E(t.oldFlags, K), pt = E((y = t.evaluationContext.identity) === null || y === void 0 ? void 0 : y.traits, U);
|
|
206
|
+
if ((G || Object.keys(U).length) && (t.evaluationContext.identity = o(o({}, t.evaluationContext.identity), { traits: U }), G && (t.evaluationContext.identity.identifier = G)), t.flags = K, t.updateStorage(), t._onChange(t.oldFlags, { isFromServer: !0, flagsChanged: z, traitsChanged: pt }, t._loadedState(null, g.SERVER)), t.datadogRum) try {
|
|
207
207
|
if (t.datadogRum.trackTraits) {
|
|
208
|
-
var
|
|
208
|
+
var mt = {};
|
|
209
209
|
Object.keys(((u = t.evaluationContext.identity) === null || u === void 0 ? void 0 : u.traits) || {}).map(function(S) {
|
|
210
|
-
|
|
210
|
+
mt[Ft + S] = t.getTrait(S);
|
|
211
211
|
});
|
|
212
|
-
var
|
|
213
|
-
t.log("Setting Datadog user",
|
|
212
|
+
var at = o(o(o({}, t.datadogRum.client.getUser()), { id: t.datadogRum.client.getUser().id || ((b = t.evaluationContext.identity) === null || b === void 0 ? void 0 : b.identifier) }), mt);
|
|
213
|
+
t.log("Setting Datadog user", at), t.datadogRum.client.setUser(at);
|
|
214
214
|
}
|
|
215
215
|
} catch (S) {
|
|
216
216
|
console.error(S);
|
|
217
217
|
}
|
|
218
218
|
if (t.dtrum) try {
|
|
219
|
-
var
|
|
219
|
+
var k = { javaDouble: {}, date: {}, shortString: {}, javaLongOrObject: {} };
|
|
220
220
|
Object.keys(t.flags).map(function(S) {
|
|
221
|
-
|
|
222
|
-
}), Object.keys(((
|
|
223
|
-
|
|
224
|
-
}), t.log("Sending javaLongOrObject traits to dynatrace",
|
|
221
|
+
_(k, N + S, t.getValue(S, { skipAnalytics: !0 })), _(k, ft + S, t.hasFeature(S, { skipAnalytics: !0 }));
|
|
222
|
+
}), Object.keys(((j = t.evaluationContext.identity) === null || j === void 0 ? void 0 : j.traits) || {}).map(function(S) {
|
|
223
|
+
_(k, Ft + S, t.getTrait(S));
|
|
224
|
+
}), t.log("Sending javaLongOrObject traits to dynatrace", k.javaLongOrObject), t.log("Sending date traits to dynatrace", k.date), t.log("Sending shortString traits to dynatrace", k.shortString), t.log("Sending javaDouble to dynatrace", k.javaDouble), t.dtrum.sendSessionProperties(k.javaLongOrObject, k.date, k.shortString, k.javaDouble);
|
|
225
225
|
} catch (S) {
|
|
226
226
|
console.error(S);
|
|
227
227
|
}
|
|
@@ -250,7 +250,7 @@ var ae = { exports: {} };
|
|
|
250
250
|
}).catch(function(n) {
|
|
251
251
|
t.log("Exception fetching evaluationEvent", n);
|
|
252
252
|
}) : void 0;
|
|
253
|
-
}, this.datadogRum = null, this.loadingState = { isLoading: !0, isFetching: !0, error: null, source:
|
|
253
|
+
}, this.datadogRum = null, this.loadingState = { isLoading: !0, isFetching: !0, error: null, source: g.NONE }, this.canUseStorage = !1, this.analyticsInterval = null, this.api = null, this.cacheFlags = !1, this.ts = null, this.enableAnalytics = !1, this.enableLogs = !1, this.evaluationContext = {}, this.evaluationEvent = null, this.flags = null, this.getFlagInterval = null, this.headers = null, this.initialised = !1, this.oldFlags = null, this.onChange = null, this.onError = null, this.ticks = null, this.timer = null, this.dtrum = null, this.withTraits = null, this.cacheOptions = { ttl: 0, skipAPI: !1, loadStale: !1, storageKey: void 0 }, this.getValue = function(i, n, r) {
|
|
254
254
|
var l = t.flags && t.flags[i.toLowerCase().replace(/ /g, "_")], c = null;
|
|
255
255
|
if (l && (c = l.value), n != null && n.skipAnalytics || r || t.evaluateFlag(i, "VALUE"), c === null && (n == null ? void 0 : n.fallback) !== void 0) return n.fallback;
|
|
256
256
|
if (n != null && n.json) try {
|
|
@@ -295,12 +295,12 @@ var ae = { exports: {} };
|
|
|
295
295
|
var l, c = t;
|
|
296
296
|
c.evaluationContext;
|
|
297
297
|
var d = c.headers, y = { method: n || "GET", body: r, cache: "no-cache", headers: {} };
|
|
298
|
-
t.evaluationContext.environment && (y.headers["X-Environment-Key"] = t.evaluationContext.environment.apiKey), n && n !== "GET" && (y.headers["Content-Type"] = "application/json; charset=utf-8"), d && Object.assign(y.headers, d),
|
|
298
|
+
t.evaluationContext.environment && (y.headers["X-Environment-Key"] = t.evaluationContext.environment.apiKey), n && n !== "GET" && (y.headers["Content-Type"] = "application/json; charset=utf-8"), d && Object.assign(y.headers, d), p || console.error("Flagsmith: fetch is undefined, please specify a fetch implementation into flagsmith.init to support SSR.");
|
|
299
299
|
var u = "".concat((l = t.evaluationContext.identity) === null || l === void 0 ? void 0 : l.identifier);
|
|
300
|
-
return
|
|
301
|
-
var
|
|
300
|
+
return p(i, y).then(function(b) {
|
|
301
|
+
var j, q, R = "".concat((j = t.evaluationContext.identity) === null || j === void 0 ? void 0 : j.identifier);
|
|
302
302
|
if (u === R) {
|
|
303
|
-
var G = (
|
|
303
|
+
var G = (q = b.headers) === null || q === void 0 ? void 0 : q.get("x-flagsmith-document-updated-at");
|
|
304
304
|
if (G) try {
|
|
305
305
|
var K = parseFloat(G);
|
|
306
306
|
if (isNaN(K)) return Promise.reject("Failed to parse x-flagsmith-document-updated-at");
|
|
@@ -309,18 +309,18 @@ var ae = { exports: {} };
|
|
|
309
309
|
t.log(U, "Failed to parse x-flagsmith-document-updated-at", G);
|
|
310
310
|
}
|
|
311
311
|
return t.log("Fetch response: " + b.status + " " + (n || "GET") + 0 + i), b.text().then(function(U) {
|
|
312
|
-
var
|
|
312
|
+
var z = U;
|
|
313
313
|
try {
|
|
314
|
-
|
|
314
|
+
z = JSON.parse(U);
|
|
315
315
|
} catch {
|
|
316
316
|
}
|
|
317
|
-
return !
|
|
317
|
+
return !z && b.status && (z = "API Response: ".concat(b.status)), b.status && b.status >= 200 && b.status < 300 ? z : Promise.reject(new Error(z));
|
|
318
318
|
});
|
|
319
319
|
}
|
|
320
320
|
t.log("Received response with identity mismatch, ignoring response. Requested: ".concat(u, ", Current: ").concat(R));
|
|
321
321
|
});
|
|
322
322
|
}, this.evaluateFlag = function(i, n) {
|
|
323
|
-
if (t.datadogRum && (t.datadogRum.client.addFeatureFlagEvaluation ? n === "VALUE" ? t.datadogRum.client.addFeatureFlagEvaluation(
|
|
323
|
+
if (t.datadogRum && (t.datadogRum.client.addFeatureFlagEvaluation ? n === "VALUE" ? t.datadogRum.client.addFeatureFlagEvaluation(N + i, t.getValue(i, {}, !0)) : t.datadogRum.client.addFeatureFlagEvaluation(ft + i, t.hasFeature(i, !0)) : console.error("Flagsmith: Your datadog RUM client does not support the function addFeatureFlagEvaluation, please update it.")), t.enableAnalytics) {
|
|
324
324
|
if (!t.evaluationEvent || !t.evaluationContext.environment) return;
|
|
325
325
|
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;
|
|
326
326
|
}
|
|
@@ -328,94 +328,94 @@ var ae = { exports: {} };
|
|
|
328
328
|
}, this._onChange = function(i, n, r) {
|
|
329
329
|
var l, c;
|
|
330
330
|
t.setLoadingState(r), (l = t.onChange) === null || l === void 0 || l.call(t, i, n, t.loadingState), (c = t._trigger) === null || c === void 0 || c.call(t);
|
|
331
|
-
},
|
|
331
|
+
}, p = e.fetch ? e.fetch : typeof fetch < "u" ? fetch : Ot === null || Ot === void 0 ? void 0 : Ot.fetch, this.canUseStorage = typeof window < "u" || !!e.browserlessStorage, this.log("Constructing flagsmith instance " + e), e.eventSource && (ht = e.eventSource), e.AsyncStorage && (A = e.AsyncStorage);
|
|
332
332
|
}
|
|
333
333
|
return a.prototype.init = function(e) {
|
|
334
334
|
var t, i, n;
|
|
335
|
-
return
|
|
336
|
-
var r, l, c, d, y, u, b,
|
|
335
|
+
return O(this, void 0, void 0, function() {
|
|
336
|
+
var r, l, c, d, y, u, b, j, q, R, G, K, U, z, pt, mt, at, k, S, Tt, yt, de, rt, Pt, ve, ge, Nt, he, Rt, bt, ot, fe, T = this;
|
|
337
337
|
return I(this, function(B) {
|
|
338
338
|
switch (B.label) {
|
|
339
339
|
case 0:
|
|
340
340
|
r = gt(e.evaluationContext || this.evaluationContext), B.label = 1;
|
|
341
341
|
case 1:
|
|
342
|
-
if (B.trys.push([1, 13, , 14]), l = e.environmentID, c = e.api, d = c === void 0 ?
|
|
343
|
-
if (r.identity =
|
|
342
|
+
if (B.trys.push([1, 13, , 14]), l = e.environmentID, c = e.api, d = c === void 0 ? h : c, y = e.headers, u = e.onChange, b = e.cacheFlags, j = e.datadogRum, q = e.onError, R = e.defaultFlags, G = e.fetch, K = e.preventFetch, U = e.enableLogs, z = e.enableDynatrace, pt = e.enableAnalytics, mt = e.realtime, at = e.eventSourceUrl, k = at === void 0 ? "https://realtime.flagsmith.com/" : at, S = e.AsyncStorage, Tt = e.identity, yt = e.traits, de = e.state, rt = e.cacheOptions, Pt = e.angularHttpClient, ve = e._trigger, ge = e._triggerLoadingState, r.environment = l ? { apiKey: l } : r.environment, !r.environment || !r.environment.apiKey) throw new Error("Please provide `evaluationContext.environment` with non-empty `apiKey`");
|
|
343
|
+
if (r.identity = Tt || yt ? { identifier: Tt, traits: yt ? Object.fromEntries(Object.entries(yt).map(function(M) {
|
|
344
344
|
return [M[0], { value: M[1] }];
|
|
345
|
-
})) : {} } : r.identity, this.evaluationContext = r, this.api = d, this.headers = y, this.getFlagInterval = null, this.analyticsInterval = null, this.onChange = u,
|
|
346
|
-
T.setLoadingState(o(o({}, T.loadingState), { isFetching: !1, isLoading: !1, error: M })),
|
|
347
|
-
}, this.enableLogs = U || !1, this.cacheOptions =
|
|
348
|
-
return function(
|
|
349
|
-
var
|
|
345
|
+
})) : {} } : r.identity, this.evaluationContext = r, this.api = d, this.headers = y, this.getFlagInterval = null, this.analyticsInterval = null, this.onChange = u, Nt = "Wrong Flagsmith Configuration: preventFetch is true and no defaulFlags provided", this._trigger = ve || this._trigger, this._triggerLoadingState = ge || this._triggerLoadingState, this.onError = function(M) {
|
|
346
|
+
T.setLoadingState(o(o({}, T.loadingState), { isFetching: !1, isLoading: !1, error: M })), q == null || q(M);
|
|
347
|
+
}, this.enableLogs = U || !1, this.cacheOptions = rt ? { skipAPI: !!rt.skipAPI, ttl: rt.ttl || 0, storageKey: rt.storageKey, loadStale: !!rt.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."), G && (p = G), this.enableAnalytics = pt || !1, this.flags = Object.assign({}, R) || {}, this.datadogRum = j || null, this.initialised = !0, this.ticks = 1e4, this.timer = this.enableLogs ? (/* @__PURE__ */ new Date()).valueOf() : null, this.cacheFlags = A !== void 0 && !!b, V = "FLAGSMITH_EVENT_" + r.environment.apiKey, S && (A = S), mt && typeof window < "u" && this.setupRealtime(k, r.environment.apiKey), Object.keys(this.flags).length && (this.loadingState = o(o({}, this.loadingState), { isLoading: !1, source: g.DEFAULT_FLAGS })), this.setState(de), this.log("Initialising with properties", e, this), z && (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 && (p = /* @__PURE__ */ function(M) {
|
|
348
|
+
return function($, H) {
|
|
349
|
+
var tt = H.headers, x = H.method, lt = H.body;
|
|
350
350
|
return new Promise(function(nt) {
|
|
351
351
|
switch (x) {
|
|
352
352
|
case "GET":
|
|
353
|
-
return M.get(
|
|
353
|
+
return M.get($, { headers: tt }).subscribe(function(Y) {
|
|
354
354
|
nt({ ok: !0, text: function() {
|
|
355
|
-
return Promise.resolve(
|
|
355
|
+
return Promise.resolve(Y);
|
|
356
356
|
} });
|
|
357
357
|
});
|
|
358
358
|
case "POST":
|
|
359
359
|
case "PUT":
|
|
360
|
-
return M.post(
|
|
360
|
+
return M.post($, lt, { headers: tt }).subscribe(function(Y) {
|
|
361
361
|
nt({ ok: !0, text: function() {
|
|
362
|
-
return Promise.resolve(
|
|
362
|
+
return Promise.resolve(Y);
|
|
363
363
|
} });
|
|
364
364
|
});
|
|
365
365
|
}
|
|
366
366
|
});
|
|
367
367
|
};
|
|
368
|
-
}(
|
|
368
|
+
}(Pt)), A && this.canUseStorage && A.getItem(V).then(function(M) {
|
|
369
369
|
try {
|
|
370
370
|
T.evaluationEvent = JSON.parse(M) || {};
|
|
371
371
|
} catch {
|
|
372
372
|
T.evaluationEvent = {};
|
|
373
373
|
}
|
|
374
374
|
T.analyticsInterval = setInterval(T.analyticsFlags, T.ticks);
|
|
375
|
-
}), this.enableAnalytics && (this.analyticsInterval && clearInterval(this.analyticsInterval), A && this.canUseStorage && A.getItem(
|
|
376
|
-
if (
|
|
377
|
-
var
|
|
378
|
-
if (
|
|
379
|
-
var
|
|
380
|
-
T.log("Retrieved events from cache",
|
|
375
|
+
}), this.enableAnalytics && (this.analyticsInterval && clearInterval(this.analyticsInterval), A && this.canUseStorage && A.getItem(V, function(M, $) {
|
|
376
|
+
if ($ && T.evaluationContext.environment) {
|
|
377
|
+
var H = JSON.parse($);
|
|
378
|
+
if (H[T.evaluationContext.environment.apiKey]) {
|
|
379
|
+
var tt = T.getState();
|
|
380
|
+
T.log("Retrieved events from cache", $), T.setState(o(o({}, tt), { evaluationEvent: H[T.evaluationContext.environment.apiKey] }));
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
})), !b) return [3, 9];
|
|
384
384
|
if (!A || !this.canUseStorage) return [3, 8];
|
|
385
|
-
he = function(M,
|
|
386
|
-
return
|
|
387
|
-
var
|
|
388
|
-
return I(this, function(
|
|
389
|
-
switch (
|
|
385
|
+
he = function(M, $) {
|
|
386
|
+
return O(T, void 0, void 0, function() {
|
|
387
|
+
var H, tt, x, lt, nt, Y, Kt, pe, Ut, Mt, Dt, Gt, Bt, Jt, Vt, qt, zt, $t, Ht, Xt, Yt, Qt, Zt, Wt, me = this;
|
|
388
|
+
return I(this, function(et) {
|
|
389
|
+
switch (et.label) {
|
|
390
390
|
case 0:
|
|
391
|
-
if (
|
|
392
|
-
|
|
391
|
+
if (!$) return [3, 7];
|
|
392
|
+
H = null, tt = null, et.label = 1;
|
|
393
393
|
case 1:
|
|
394
|
-
return
|
|
395
|
-
var
|
|
396
|
-
(
|
|
394
|
+
return et.trys.push([1, 5, , 6]), x = JSON.parse($), lt = !1, nt = !1, x && x.api === this.api && ((Mt = (Ut = x.evaluationContext) === null || Ut === void 0 ? void 0 : Ut.environment) === null || Mt === void 0 ? void 0 : Mt.apiKey) === ((Dt = this.evaluationContext.environment) === null || Dt === void 0 ? void 0 : Dt.apiKey) && (Y = !0, this.evaluationContext.identity && ((Bt = (Gt = x.evaluationContext) === null || Gt === void 0 ? void 0 : Gt.identity) === null || Bt === void 0 ? void 0 : Bt.identifier) !== this.evaluationContext.identity.identifier && (this.log("Ignoring cache, identity has changed from " + ((Vt = (Jt = x.evaluationContext) === null || Jt === void 0 ? void 0 : Jt.identity) === null || Vt === void 0 ? void 0 : Vt.identifier) + " to " + this.evaluationContext.identity.identifier), Y = !1), this.cacheOptions.ttl && (!x.ts || (/* @__PURE__ */ new Date()).valueOf() - x.ts > this.cacheOptions.ttl) && (x.ts && !this.cacheOptions.loadStale ? (this.log("Ignoring cache, timestamp is too old ts:" + x.ts + " ttl: " + this.cacheOptions.ttl + " time elapsed since cache: " + ((/* @__PURE__ */ new Date()).valueOf() - x.ts) + "ms"), Y = !1) : x.ts && this.cacheOptions.loadStale && (this.log("Loading stale cache, timestamp ts:" + x.ts + " ttl: " + this.cacheOptions.ttl + " time elapsed since cache: " + ((/* @__PURE__ */ new Date()).valueOf() - x.ts) + "ms"), nt = !0, Y = !0)), Y && (lt = !0, tt = E((qt = this.evaluationContext.identity) === null || qt === void 0 ? void 0 : qt.traits, ($t = (zt = x.evaluationContext) === null || zt === void 0 ? void 0 : zt.identity) === null || $t === void 0 ? void 0 : $t.traits), H = E(this.flags, x.flags), this.setState(o(o({}, x), { evaluationContext: gt(o(o({}, x.evaluationContext), { identity: !((Ht = x.evaluationContext) === null || Ht === void 0) && Ht.identity ? o(o({}, (Xt = x.evaluationContext) === null || Xt === void 0 ? void 0 : Xt.identity), { traits: o(o({}, ((Qt = (Yt = x.evaluationContext) === null || Yt === void 0 ? void 0 : Yt.identity) === null || Qt === void 0 ? void 0 : Qt.traits) || {}), yt || {}) }) : void 0 })) })), this.log("Retrieved flags from cache", x))), lt ? (Kt = !K && (!this.cacheOptions.skipAPI || nt), this._onChange(null, { isFromServer: !1, flagsChanged: H, traitsChanged: tt }, this._loadedState(null, g.CACHE, Kt)), this.oldFlags = this.flags, this.cacheOptions.skipAPI && lt && !nt && this.log("Skipping API, using cache"), Kt && this.getFlags().catch(function(Ae) {
|
|
395
|
+
var te;
|
|
396
|
+
(te = me.onError) === null || te === void 0 || te.call(me, Ae);
|
|
397
397
|
}), [3, 4]) : [3, 2];
|
|
398
398
|
case 2:
|
|
399
399
|
return K ? [3, 4] : [4, this.getFlags()];
|
|
400
400
|
case 3:
|
|
401
|
-
|
|
401
|
+
et.sent(), et.label = 4;
|
|
402
402
|
case 4:
|
|
403
403
|
return [3, 6];
|
|
404
404
|
case 5:
|
|
405
|
-
return pe =
|
|
405
|
+
return pe = et.sent(), this.log("Exception fetching cached logs", pe), [3, 6];
|
|
406
406
|
case 6:
|
|
407
407
|
return [3, 10];
|
|
408
408
|
case 7:
|
|
409
409
|
return K ? [3, 9] : [4, this.getFlags()];
|
|
410
410
|
case 8:
|
|
411
|
-
return
|
|
411
|
+
return et.sent(), [3, 10];
|
|
412
412
|
case 9:
|
|
413
|
-
if (R) this._onChange(null, { isFromServer: !1, flagsChanged:
|
|
413
|
+
if (R) this._onChange(null, { isFromServer: !1, flagsChanged: E({}, this.flags), traitsChanged: E({}, (Zt = this.evaluationContext.identity) === null || Zt === void 0 ? void 0 : Zt.traits) }, this._loadedState(null, g.DEFAULT_FLAGS));
|
|
414
414
|
else {
|
|
415
|
-
if (!this.flags) throw new Error(
|
|
416
|
-
this._onChange(null, { isFromServer: !1, flagsChanged:
|
|
415
|
+
if (!this.flags) throw new Error(Nt);
|
|
416
|
+
this._onChange(null, { isFromServer: !1, flagsChanged: E({}, this.flags), traitsChanged: E({}, (Wt = this.evaluationContext.identity) === null || Wt === void 0 ? void 0 : Wt.traits) }, this._loadedState(null, g.DEFAULT_FLAGS));
|
|
417
417
|
}
|
|
418
|
-
|
|
418
|
+
et.label = 10;
|
|
419
419
|
case 10:
|
|
420
420
|
return [2];
|
|
421
421
|
}
|
|
@@ -423,13 +423,13 @@ var ae = { exports: {} };
|
|
|
423
423
|
});
|
|
424
424
|
}, B.label = 2;
|
|
425
425
|
case 2:
|
|
426
|
-
return B.trys.push([2, 7, , 8]), A.getItemSync ? (
|
|
426
|
+
return B.trys.push([2, 7, , 8]), A.getItemSync ? (Rt = A.getItemSync(this.getStorageKey()), [3, 5]) : [3, 3];
|
|
427
427
|
case 3:
|
|
428
428
|
return [4, A.getItem(this.getStorageKey())];
|
|
429
429
|
case 4:
|
|
430
|
-
|
|
430
|
+
Rt = B.sent(), B.label = 5;
|
|
431
431
|
case 5:
|
|
432
|
-
return [4, he(null,
|
|
432
|
+
return [4, he(null, Rt)];
|
|
433
433
|
case 6:
|
|
434
434
|
case 7:
|
|
435
435
|
return B.sent(), [3, 8];
|
|
@@ -440,13 +440,13 @@ var ae = { exports: {} };
|
|
|
440
440
|
case 10:
|
|
441
441
|
return B.sent(), [3, 12];
|
|
442
442
|
case 11:
|
|
443
|
-
if (R) this._onChange(null, { isFromServer: !1, flagsChanged:
|
|
444
|
-
else if (this.flags && (
|
|
443
|
+
if (R) this._onChange(null, { isFromServer: !1, flagsChanged: E({}, R), traitsChanged: E({}, (t = r.identity) === null || t === void 0 ? void 0 : t.traits) }, this._loadedState(null, g.DEFAULT_FLAGS));
|
|
444
|
+
else if (this.flags && (bt = null, Object.keys(this.flags).length === 0 && (bt = Nt), this._onChange(null, { isFromServer: !1, flagsChanged: E({}, this.flags), traitsChanged: E({}, (i = r.identity) === null || i === void 0 ? void 0 : i.traits) }, this._loadedState(bt, g.DEFAULT_FLAGS)), bt)) throw new Error(bt);
|
|
445
445
|
B.label = 12;
|
|
446
446
|
case 12:
|
|
447
447
|
return [3, 14];
|
|
448
448
|
case 13:
|
|
449
|
-
throw
|
|
449
|
+
throw ot = B.sent(), this.log("Error during initialisation ", ot), fe = ot instanceof Error ? ot : new Error("".concat(ot)), (n = this.onError) === null || n === void 0 || n.call(this, fe), ot;
|
|
450
450
|
case 14:
|
|
451
451
|
return [2];
|
|
452
452
|
}
|
|
@@ -462,7 +462,7 @@ var ae = { exports: {} };
|
|
|
462
462
|
}, a.prototype.getState = function() {
|
|
463
463
|
return { api: this.api, flags: this.flags, ts: this.ts, evaluationContext: this.evaluationContext, evaluationEvent: this.evaluationEvent };
|
|
464
464
|
}, a.prototype.setState = function(e) {
|
|
465
|
-
e && (this.initialised = !0, this.api = e.api || this.api ||
|
|
465
|
+
e && (this.initialised = !0, this.api = e.api || this.api || h, this.flags = e.flags || this.flags, this.evaluationContext = e.evaluationContext || this.evaluationContext, this.evaluationEvent = e.evaluationEvent || this.evaluationEvent, this.log("setState called", this));
|
|
466
466
|
}, a.prototype.logout = function() {
|
|
467
467
|
return this.evaluationContext.identity = null, this.initialised ? this.getFlags() : Promise.resolve();
|
|
468
468
|
}, a.prototype.startListening = function(e) {
|
|
@@ -473,7 +473,7 @@ var ae = { exports: {} };
|
|
|
473
473
|
return e === void 0 && (e = null), i === void 0 && (i = !1), { error: e, isFetching: i, isLoading: !1, source: t };
|
|
474
474
|
}, a.prototype.log = function() {
|
|
475
475
|
for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
|
|
476
|
-
this.enableLogs && console.log.apply(this,
|
|
476
|
+
this.enableLogs && console.log.apply(this, w(["FLAGSMITH:", (/* @__PURE__ */ new Date()).valueOf() - (this.timer || 0), "ms"], e));
|
|
477
477
|
}, a.prototype.updateStorage = function() {
|
|
478
478
|
if (this.cacheFlags) {
|
|
479
479
|
this.ts = (/* @__PURE__ */ new Date()).valueOf();
|
|
@@ -483,16 +483,16 @@ var ae = { exports: {} };
|
|
|
483
483
|
}, a.prototype.updateEventStorage = function() {
|
|
484
484
|
if (this.enableAnalytics) {
|
|
485
485
|
var e = JSON.stringify(this.getState().evaluationEvent);
|
|
486
|
-
A.setItem(
|
|
486
|
+
A.setItem(V, e).catch(function(t) {
|
|
487
487
|
return console.error("Flagsmith: Error setting item in async storage", t);
|
|
488
488
|
});
|
|
489
489
|
}
|
|
490
490
|
}, a.prototype.setLoadingState = function(e) {
|
|
491
491
|
var t;
|
|
492
|
-
|
|
492
|
+
W(e, this.loadingState) || (this.loadingState = o({}, e), this.log("Loading state changed", e), (t = this._triggerLoadingState) === null || t === void 0 || t.call(this));
|
|
493
493
|
}, a.prototype.setupRealtime = function(e, t) {
|
|
494
494
|
var i = this, n = e + "sse/environments/" + t + "/stream";
|
|
495
|
-
|
|
495
|
+
ht ? this.eventSource || (this.log("Creating event source with url " + n), this.eventSource = new ht(n), this.eventSource.addEventListener("environment_updated", function(r) {
|
|
496
496
|
var l;
|
|
497
497
|
try {
|
|
498
498
|
l = JSON.parse(r.data).updated_at;
|
|
@@ -503,22 +503,22 @@ var ae = { exports: {} };
|
|
|
503
503
|
})) : this.log("Error, EventSource is undefined");
|
|
504
504
|
}, a;
|
|
505
505
|
}();
|
|
506
|
-
function
|
|
506
|
+
function L(a) {
|
|
507
507
|
var e = a.fetch, t = a.AsyncStorage, i = a.eventSource;
|
|
508
|
-
return new
|
|
508
|
+
return new jt({ fetch: e, AsyncStorage: t, eventSource: i });
|
|
509
509
|
}
|
|
510
|
-
var
|
|
511
|
-
return
|
|
510
|
+
var xt, Ie = (xt = function(a, e) {
|
|
511
|
+
return xt = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, i) {
|
|
512
512
|
t.__proto__ = i;
|
|
513
513
|
} || function(t, i) {
|
|
514
514
|
for (var n in i) Object.prototype.hasOwnProperty.call(i, n) && (t[n] = i[n]);
|
|
515
|
-
},
|
|
515
|
+
}, xt(a, e);
|
|
516
516
|
}, function(a, e) {
|
|
517
517
|
if (typeof e != "function" && e !== null) throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
|
|
518
518
|
function t() {
|
|
519
519
|
this.constructor = a;
|
|
520
520
|
}
|
|
521
|
-
|
|
521
|
+
xt(a, e), a.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
|
|
522
522
|
}), oe = function(a) {
|
|
523
523
|
var e = typeof Symbol == "function" && Symbol.iterator, t = e && a[e], i = 0;
|
|
524
524
|
if (t) return t.call(a);
|
|
@@ -649,27 +649,27 @@ Consider loading an EventSource polyfill and making it available globally as Eve
|
|
|
649
649
|
} } };
|
|
650
650
|
};
|
|
651
651
|
for (var y in n.open(e.method || "get", a, !0), n.onload = function() {
|
|
652
|
-
n.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function(u, b,
|
|
653
|
-
r.push(b = b.toLowerCase()), l.push([b,
|
|
652
|
+
n.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function(u, b, j) {
|
|
653
|
+
r.push(b = b.toLowerCase()), l.push([b, j]), c[b] = c[b] ? c[b] + "," + j : j;
|
|
654
654
|
}), t(d());
|
|
655
655
|
}, n.onerror = i, n.withCredentials = e.credentials == "include", e.headers) n.setRequestHeader(y, e.headers[y]);
|
|
656
656
|
n.send(e.body || null);
|
|
657
657
|
});
|
|
658
|
-
}, ce =
|
|
658
|
+
}, ce = L({ AsyncStorage: v, fetch: ue, eventSource: se });
|
|
659
659
|
typeof window < "u" && (window.flagsmith = ce), f.createFlagsmithInstance = function() {
|
|
660
|
-
return
|
|
660
|
+
return L({ AsyncStorage: v, fetch: ue, eventSource: se });
|
|
661
661
|
}, f.default = ce, Object.defineProperty(f, "__esModule", { value: !0 });
|
|
662
662
|
});
|
|
663
|
-
})(
|
|
664
|
-
var Je =
|
|
663
|
+
})(re, re.exports);
|
|
664
|
+
var Je = re.exports, Ve = {
|
|
665
665
|
NOT_INITIALIZED: "FeatureFlag not initialized. Call init() first."
|
|
666
|
-
}, _e = "business",
|
|
666
|
+
}, _e = "business", X, qe = (X = class {
|
|
667
667
|
constructor() {
|
|
668
|
-
|
|
669
|
-
|
|
668
|
+
Et(this, "flagsmithClient", null);
|
|
669
|
+
Et(this, "userContext", null);
|
|
670
670
|
}
|
|
671
671
|
static getInstance() {
|
|
672
|
-
return
|
|
672
|
+
return X.instance || (X.instance = new X()), X.instance;
|
|
673
673
|
}
|
|
674
674
|
ensureInitialized() {
|
|
675
675
|
if (!this.flagsmithClient)
|
|
@@ -679,7 +679,7 @@ var Je = ae.exports, Ve = {
|
|
|
679
679
|
if (!this.flagsmithClient)
|
|
680
680
|
try {
|
|
681
681
|
this.flagsmithClient = Je.createFlagsmithInstance();
|
|
682
|
-
const v = f.reduce((o,
|
|
682
|
+
const v = f.reduce((o, O) => (o[O.feature.name] = O, o), {});
|
|
683
683
|
await this.flagsmithClient.init({
|
|
684
684
|
environmentID: s.apiKey,
|
|
685
685
|
api: (s == null ? void 0 : s.url) ?? "https://feature-flag-proxy.feedme.farm/api/v1/",
|
|
@@ -749,83 +749,83 @@ var Je = ae.exports, Ve = {
|
|
|
749
749
|
}
|
|
750
750
|
async getUserFlagValue(s, f, v = null, o) {
|
|
751
751
|
var I;
|
|
752
|
-
const
|
|
752
|
+
const O = this.userContext;
|
|
753
753
|
try {
|
|
754
754
|
return await this.setUser(s), this.getFlagValue(f, o) ?? v;
|
|
755
|
-
} catch (
|
|
756
|
-
return console.error(`Error getting user flag value for ${f}:`,
|
|
755
|
+
} catch (w) {
|
|
756
|
+
return console.error(`Error getting user flag value for ${f}:`, w), v;
|
|
757
757
|
} finally {
|
|
758
758
|
try {
|
|
759
|
-
await ((I = this.flagsmithClient) == null ? void 0 : I.logout()), this.userContext = null,
|
|
760
|
-
} catch (
|
|
761
|
-
console.error("Error during cleanup:",
|
|
759
|
+
await ((I = this.flagsmithClient) == null ? void 0 : I.logout()), this.userContext = null, O && await this.setUser(O.identifier);
|
|
760
|
+
} catch (w) {
|
|
761
|
+
console.error("Error during cleanup:", w);
|
|
762
762
|
}
|
|
763
763
|
}
|
|
764
764
|
}
|
|
765
765
|
reset() {
|
|
766
766
|
this.flagsmithClient = null, this.userContext = null;
|
|
767
767
|
}
|
|
768
|
-
},
|
|
769
|
-
function $e(
|
|
770
|
-
const s = () => Ct.value ? !0 : (console.warn("FeatureFlag is not initialized. Using default values."), !1), f = async (
|
|
768
|
+
}, Et(X, "instance"), X), ze = qe.getInstance(), Ct = Z(!1), It = Z([]), vt = Z(null);
|
|
769
|
+
function $e(m = ze) {
|
|
770
|
+
const s = () => Ct.value ? !0 : (console.warn("FeatureFlag is not initialized. Using default values."), !1), f = async (g, p = []) => {
|
|
771
771
|
if (Ct.value) {
|
|
772
772
|
console.warn("FeatureFlag is already initialized.");
|
|
773
773
|
return;
|
|
774
774
|
}
|
|
775
775
|
try {
|
|
776
|
-
await
|
|
777
|
-
} catch (
|
|
778
|
-
console.error("Failed to initialize feature flags:",
|
|
776
|
+
await m.init(g, p), It.value = await m.getFlags(), Ct.value = !0, vt.value = null;
|
|
777
|
+
} catch (_) {
|
|
778
|
+
console.error("Failed to initialize feature flags:", _), vt.value = _;
|
|
779
779
|
}
|
|
780
|
-
}, v = async (
|
|
780
|
+
}, v = async (g) => {
|
|
781
781
|
if (s())
|
|
782
782
|
try {
|
|
783
|
-
await
|
|
784
|
-
} catch (
|
|
785
|
-
console.error("Failed to set user:",
|
|
783
|
+
await m.setUser(g), It.value = await m.getFlags(), vt.value = null;
|
|
784
|
+
} catch (p) {
|
|
785
|
+
console.error("Failed to set user:", p), vt.value = p;
|
|
786
786
|
}
|
|
787
|
-
}, o = async (
|
|
788
|
-
if (!s()) return
|
|
787
|
+
}, o = async (g) => v(`${_e}-${g}`), O = (g, p, _ = null) => {
|
|
788
|
+
if (!s()) return _;
|
|
789
789
|
try {
|
|
790
|
-
return
|
|
790
|
+
return m.getFlagValue(g, p) ?? _;
|
|
791
791
|
} catch (D) {
|
|
792
|
-
return console.error(`Error getting flag value for ${
|
|
792
|
+
return console.error(`Error getting flag value for ${g}:`, D), _;
|
|
793
793
|
}
|
|
794
|
-
}, I = (
|
|
795
|
-
if (!s()) return
|
|
794
|
+
}, I = (g, p) => {
|
|
795
|
+
if (!s()) return p ?? null;
|
|
796
796
|
try {
|
|
797
|
-
return
|
|
798
|
-
} catch (
|
|
799
|
-
return console.error(`Error getting flag for ${
|
|
797
|
+
return m.getFlag(g) ?? p ?? null;
|
|
798
|
+
} catch (_) {
|
|
799
|
+
return console.error(`Error getting flag for ${g}:`, _), p ?? null;
|
|
800
800
|
}
|
|
801
|
-
},
|
|
802
|
-
if (!s()) return
|
|
801
|
+
}, w = async (g, p, _ = null, D) => {
|
|
802
|
+
if (!s()) return _;
|
|
803
803
|
try {
|
|
804
|
-
return await
|
|
804
|
+
return await m.getUserFlagValue(g, p, _, D);
|
|
805
805
|
} catch (it) {
|
|
806
|
-
return console.error(`Error getting user flag value for ${
|
|
806
|
+
return console.error(`Error getting user flag value for ${p}:`, it), _;
|
|
807
807
|
}
|
|
808
|
-
},
|
|
808
|
+
}, W = async (g, p, _ = null, D) => w(`${_e}-${g}`, p, _, D), E = () => {
|
|
809
809
|
try {
|
|
810
|
-
|
|
811
|
-
} catch (
|
|
812
|
-
console.error("Error resetting feature flags:",
|
|
810
|
+
m.reset();
|
|
811
|
+
} catch (g) {
|
|
812
|
+
console.error("Error resetting feature flags:", g);
|
|
813
813
|
} finally {
|
|
814
|
-
|
|
814
|
+
It.value = [], Ct.value = !1, vt.value = null;
|
|
815
815
|
}
|
|
816
816
|
};
|
|
817
817
|
return {
|
|
818
|
-
flags:
|
|
819
|
-
isInitialized:
|
|
820
|
-
error:
|
|
818
|
+
flags: ee(It),
|
|
819
|
+
isInitialized: ee(Ct),
|
|
820
|
+
error: ee(vt),
|
|
821
821
|
init: f,
|
|
822
822
|
setUser: v,
|
|
823
823
|
setBusiness: o,
|
|
824
|
-
getFlagValue:
|
|
824
|
+
getFlagValue: O,
|
|
825
825
|
getFlag: I,
|
|
826
|
-
getUserFlagValue:
|
|
827
|
-
getBusinessFlagValue:
|
|
828
|
-
reset:
|
|
826
|
+
getUserFlagValue: w,
|
|
827
|
+
getBusinessFlagValue: W,
|
|
828
|
+
reset: E
|
|
829
829
|
};
|
|
830
830
|
}
|
|
831
831
|
var Oe = () => $e();
|
|
@@ -833,15 +833,15 @@ const Fe = {
|
|
|
833
833
|
dev: "MaGoXrEWuEJNpWgKTqseee",
|
|
834
834
|
prod: "6GhcttsJ9Rj9cTevcdrpin"
|
|
835
835
|
}, He = "order_miniprogram_v2", xe = 1e4, _t = Z("pending");
|
|
836
|
-
let
|
|
837
|
-
function Xe(
|
|
838
|
-
if (
|
|
839
|
-
const { init: s } = Oe(), f =
|
|
836
|
+
let Lt = null;
|
|
837
|
+
function Xe(m) {
|
|
838
|
+
if (Lt) return Lt;
|
|
839
|
+
const { init: s } = Oe(), f = m === "prod" ? Fe.prod : Fe.dev;
|
|
840
840
|
let v;
|
|
841
|
-
return
|
|
841
|
+
return Lt = Promise.race([
|
|
842
842
|
s({ apiKey: f }),
|
|
843
|
-
new Promise((o,
|
|
844
|
-
v = setTimeout(() =>
|
|
843
|
+
new Promise((o, O) => {
|
|
844
|
+
v = setTimeout(() => O(new Error(`Flagsmith init exceeded ${xe}ms`)), xe);
|
|
845
845
|
})
|
|
846
846
|
]).then(() => {
|
|
847
847
|
_t.value = "ready";
|
|
@@ -849,24 +849,24 @@ function Xe(p) {
|
|
|
849
849
|
_t.value = "failed", console.warn("[FeatureFlag] init failed:", o);
|
|
850
850
|
}).finally(() => {
|
|
851
851
|
clearTimeout(v);
|
|
852
|
-
}),
|
|
852
|
+
}), Lt;
|
|
853
853
|
}
|
|
854
|
-
function Ye(
|
|
854
|
+
function Ye(m) {
|
|
855
855
|
try {
|
|
856
|
-
const s = typeof
|
|
856
|
+
const s = typeof m == "string" ? JSON.parse(m) : m;
|
|
857
857
|
return s === !0 || s === "true" || (s == null ? void 0 : s.enabled) === !0 || (s == null ? void 0 : s.enabled) === "true";
|
|
858
858
|
} catch {
|
|
859
|
-
return
|
|
859
|
+
return m === !0 || m === "true";
|
|
860
860
|
}
|
|
861
861
|
}
|
|
862
|
-
function
|
|
863
|
-
const v = we(), { getBusinessFlagValue: o } = Oe(),
|
|
864
|
-
let
|
|
865
|
-
async function
|
|
866
|
-
var
|
|
867
|
-
const
|
|
868
|
-
if (!
|
|
869
|
-
|
|
862
|
+
function Qe(m, s, f) {
|
|
863
|
+
const v = we(), { getBusinessFlagValue: o } = Oe(), O = Z(s), I = Z(!0);
|
|
864
|
+
let w = 0;
|
|
865
|
+
async function W() {
|
|
866
|
+
var p;
|
|
867
|
+
const E = ++w, g = (p = v.currentBusiness.value) == null ? void 0 : p._id;
|
|
868
|
+
if (!g || _t.value === "failed") {
|
|
869
|
+
O.value = s, I.value = !1;
|
|
870
870
|
return;
|
|
871
871
|
}
|
|
872
872
|
if (_t.value === "pending") {
|
|
@@ -875,24 +875,24 @@ function Ze(p, s, f) {
|
|
|
875
875
|
}
|
|
876
876
|
I.value = !0;
|
|
877
877
|
try {
|
|
878
|
-
const
|
|
879
|
-
if (
|
|
880
|
-
|
|
878
|
+
const _ = await o(g, m, s);
|
|
879
|
+
if (E !== w) return;
|
|
880
|
+
O.value = f ? f(_) : _;
|
|
881
881
|
} catch {
|
|
882
|
-
if (
|
|
883
|
-
|
|
882
|
+
if (E !== w) return;
|
|
883
|
+
O.value = s;
|
|
884
884
|
} finally {
|
|
885
|
-
|
|
885
|
+
E === w && (I.value = !1);
|
|
886
886
|
}
|
|
887
887
|
}
|
|
888
888
|
return Ee([() => {
|
|
889
|
-
var
|
|
890
|
-
return (
|
|
891
|
-
}, _t],
|
|
889
|
+
var E;
|
|
890
|
+
return (E = v.currentBusiness.value) == null ? void 0 : E._id;
|
|
891
|
+
}, _t], W, { immediate: !0 }), { value: O, loading: I };
|
|
892
892
|
}
|
|
893
|
-
function
|
|
894
|
-
const { value:
|
|
895
|
-
return { enabled:
|
|
893
|
+
function Ze() {
|
|
894
|
+
const { value: m, loading: s } = Qe(He, !1, Ye);
|
|
895
|
+
return { enabled: m, loading: s };
|
|
896
896
|
}
|
|
897
897
|
const We = {
|
|
898
898
|
key: 0,
|
|
@@ -925,77 +925,80 @@ const We = {
|
|
|
925
925
|
role: "alert"
|
|
926
926
|
}, vn = /* @__PURE__ */ Te({
|
|
927
927
|
__name: "App",
|
|
928
|
-
setup(
|
|
929
|
-
const s = Re(), f = Ke(), v = we(), o = De(),
|
|
930
|
-
Ee(o.businessId, async (
|
|
931
|
-
const N = Ge(s,
|
|
928
|
+
setup(m) {
|
|
929
|
+
const s = Re(), f = Ke(), v = we(), o = De(), O = Z(!1);
|
|
930
|
+
Ee(o.businessId, async (V, h) => {
|
|
931
|
+
const N = Ge(s, h, V);
|
|
932
932
|
if (N) {
|
|
933
|
-
|
|
933
|
+
O.value = !0;
|
|
934
934
|
try {
|
|
935
935
|
await f.replace(N);
|
|
936
936
|
} finally {
|
|
937
|
-
|
|
937
|
+
O.value = !1;
|
|
938
938
|
}
|
|
939
939
|
}
|
|
940
940
|
}), Xe(v.namespace.value);
|
|
941
|
-
const I =
|
|
941
|
+
const I = Ze(), w = st(() => s.name === "miniprogram-v2-project"), W = st(() => ({
|
|
942
|
+
...dt(s.query),
|
|
943
|
+
...w.value ? { returnProjectId: String(s.params.projectId) } : {}
|
|
944
|
+
})), E = st(() => I.loading.value || I.enabled.value), g = Z(
|
|
942
945
|
Se(
|
|
943
946
|
"mpv2:portal-collapsed",
|
|
944
947
|
typeof window < "u" && window.matchMedia("(max-width: 1000px)").matches
|
|
945
948
|
)
|
|
946
|
-
),
|
|
949
|
+
), p = Z(Se("mpv2:editor-collapsed", !0)), _ = st(() => w.value ? p.value : g.value), D = st(
|
|
947
950
|
() => {
|
|
948
|
-
var
|
|
949
|
-
return
|
|
951
|
+
var V;
|
|
952
|
+
return w.value ? (V = o.context.value) == null ? void 0 : V.project.name : String(s.meta.title ?? "Ecosystem");
|
|
950
953
|
}
|
|
951
|
-
),
|
|
954
|
+
), it = [
|
|
952
955
|
{ name: "miniprogram-v2-ecosystem", label: "Ecosystem", icon: "ecosystem" },
|
|
953
956
|
{ name: "miniprogram-v2-brand-kit", label: "Brand Kit", icon: "brand" },
|
|
954
957
|
{ name: "miniprogram-v2-pages", label: "Pages", icon: "pages" }
|
|
955
|
-
],
|
|
956
|
-
let
|
|
958
|
+
], gt = st(() => ({ name: "miniprogram-v2-mobile-projects", query: dt(s.query) })), ht = Me();
|
|
959
|
+
let A = !1;
|
|
957
960
|
Pe(() => {
|
|
958
|
-
|
|
961
|
+
A = v.hideSidebar.value, v.hideSidebar.value = !0;
|
|
959
962
|
}), Ne(() => {
|
|
960
|
-
v.hideSidebar.value =
|
|
963
|
+
v.hideSidebar.value = A;
|
|
961
964
|
});
|
|
962
|
-
function
|
|
963
|
-
|
|
965
|
+
function At() {
|
|
966
|
+
w.value ? (p.value = !p.value, Ce("mpv2:editor-collapsed", p.value)) : (g.value = !g.value, Ce("mpv2:portal-collapsed", g.value));
|
|
964
967
|
}
|
|
965
|
-
return (
|
|
966
|
-
const N =
|
|
967
|
-
return J(),
|
|
968
|
-
|
|
968
|
+
return (V, h) => {
|
|
969
|
+
const N = wt("RouterLink"), ft = wt("FmIcon"), Ft = wt("FmCircularProgress"), jt = wt("FmButton");
|
|
970
|
+
return J(), Q(ne, null, [
|
|
971
|
+
h[14] || (h[14] = C("link", {
|
|
969
972
|
href: "https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@24,400,0..1,0",
|
|
970
973
|
rel: "stylesheet"
|
|
971
974
|
}, null, -1)),
|
|
972
975
|
C("div", {
|
|
973
|
-
class:
|
|
976
|
+
class: ie(["mpv2-app portal-shell", { "portal-shell--collapsed": _.value }])
|
|
974
977
|
}, [
|
|
975
|
-
|
|
978
|
+
h[13] || (h[13] = C("a", {
|
|
976
979
|
class: "portal-skip",
|
|
977
980
|
href: "#miniprogram-content"
|
|
978
981
|
}, "Skip to content", -1)),
|
|
979
|
-
|
|
982
|
+
E.value ? (J(), Q("aside", We, [
|
|
980
983
|
C("button", {
|
|
981
984
|
class: "portal-sidebar-toggle",
|
|
982
985
|
type: "button",
|
|
983
|
-
"aria-expanded": !
|
|
986
|
+
"aria-expanded": !_.value,
|
|
984
987
|
"aria-controls": "miniprogram-navigation",
|
|
985
|
-
"aria-label":
|
|
986
|
-
onClick:
|
|
988
|
+
"aria-label": _.value ? "Expand navigation" : "Collapse navigation",
|
|
989
|
+
onClick: At
|
|
987
990
|
}, [
|
|
988
991
|
P(St, { name: "collapse" }),
|
|
989
|
-
|
|
992
|
+
h[0] || (h[0] = C("span", { class: "portal-nav-label" }, "Mini Program", -1))
|
|
990
993
|
], 8, tn),
|
|
991
994
|
C("nav", en, [
|
|
992
|
-
(J(),
|
|
995
|
+
(J(), Q(ne, null, ye(it, (L) => P(N, {
|
|
993
996
|
key: L.name,
|
|
994
|
-
to: { name: L.name, query:
|
|
997
|
+
to: { name: L.name, query: F(dt)(F(s).query) },
|
|
995
998
|
class: "portal-nav-item",
|
|
996
999
|
title: L.label,
|
|
997
1000
|
"aria-label": L.label,
|
|
998
|
-
"aria-current":
|
|
1001
|
+
"aria-current": F(s).name === L.name ? "page" : void 0
|
|
999
1002
|
}, {
|
|
1000
1003
|
default: ut(() => [
|
|
1001
1004
|
P(St, {
|
|
@@ -1005,23 +1008,23 @@ const We = {
|
|
|
1005
1008
|
]),
|
|
1006
1009
|
_: 2
|
|
1007
1010
|
}, 1032, ["to", "title", "aria-label", "aria-current"])), 64)),
|
|
1008
|
-
|
|
1011
|
+
h[4] || (h[4] = C("p", { class: "portal-nav-caption" }, "Platforms", -1)),
|
|
1009
1012
|
P(N, {
|
|
1010
|
-
to:
|
|
1011
|
-
class:
|
|
1013
|
+
to: gt.value,
|
|
1014
|
+
class: ie(["portal-nav-item", { "router-link-active": w.value }]),
|
|
1012
1015
|
title: "Mobile Ordering",
|
|
1013
1016
|
"aria-label": "Mobile Ordering",
|
|
1014
|
-
"aria-current":
|
|
1017
|
+
"aria-current": w.value ? "page" : void 0
|
|
1015
1018
|
}, {
|
|
1016
1019
|
default: ut(() => [
|
|
1017
1020
|
P(St, { name: "mobile" }),
|
|
1018
|
-
|
|
1021
|
+
h[1] || (h[1] = C("span", { class: "portal-nav-label" }, "Mobile Ordering", -1))
|
|
1019
1022
|
]),
|
|
1020
1023
|
_: 1
|
|
1021
1024
|
}, 8, ["to", "class", "aria-current"]),
|
|
1022
|
-
(J(),
|
|
1025
|
+
(J(), Q(ne, null, ye(["tablet", "kiosk"], (L) => P(N, {
|
|
1023
1026
|
key: L,
|
|
1024
|
-
to: { name: `miniprogram-v2-${L}`, query:
|
|
1027
|
+
to: { name: `miniprogram-v2-${L}`, query: F(dt)(F(s).query) },
|
|
1025
1028
|
class: "portal-nav-item",
|
|
1026
1029
|
title: L === "tablet" ? "Tablet" : "Kiosk",
|
|
1027
1030
|
"aria-label": L === "tablet" ? "Tablet" : "Kiosk"
|
|
@@ -1032,79 +1035,79 @@ const We = {
|
|
|
1032
1035
|
]),
|
|
1033
1036
|
_: 2
|
|
1034
1037
|
}, 1032, ["to", "title", "aria-label"])), 64)),
|
|
1035
|
-
|
|
1038
|
+
h[5] || (h[5] = C("div", { class: "portal-nav-divider" }, null, -1)),
|
|
1036
1039
|
P(N, {
|
|
1037
|
-
to: { name: "miniprogram-v2-module-center", query:
|
|
1038
|
-
class:
|
|
1039
|
-
title: "
|
|
1040
|
-
"aria-label": "
|
|
1040
|
+
to: { name: "miniprogram-v2-module-center", query: W.value },
|
|
1041
|
+
class: ie(["portal-nav-item", { "router-link-active": F(s).name === "miniprogram-v2-module-detail" }]),
|
|
1042
|
+
title: "Component Library",
|
|
1043
|
+
"aria-label": "Component Library"
|
|
1041
1044
|
}, {
|
|
1042
1045
|
default: ut(() => [
|
|
1043
|
-
P(
|
|
1046
|
+
P(ft, {
|
|
1044
1047
|
name: "widgets",
|
|
1045
1048
|
size: "md"
|
|
1046
1049
|
}),
|
|
1047
|
-
|
|
1050
|
+
h[2] || (h[2] = C("span", { class: "portal-nav-label" }, "Component Library", -1))
|
|
1048
1051
|
]),
|
|
1049
1052
|
_: 1
|
|
1050
1053
|
}, 8, ["to", "class"]),
|
|
1051
|
-
|
|
1054
|
+
F(ht) ? (J(), be(N, {
|
|
1052
1055
|
key: 0,
|
|
1053
|
-
to: { name: "miniprogram-v2-template-center", query:
|
|
1056
|
+
to: { name: "miniprogram-v2-template-center", query: F(dt)(F(s).query) },
|
|
1054
1057
|
class: "portal-nav-item",
|
|
1055
1058
|
title: "Template library",
|
|
1056
1059
|
"aria-label": "Template library"
|
|
1057
1060
|
}, {
|
|
1058
1061
|
default: ut(() => [
|
|
1059
|
-
P(
|
|
1062
|
+
P(ft, {
|
|
1060
1063
|
name: "dashboard_customize",
|
|
1061
1064
|
size: "md"
|
|
1062
1065
|
}),
|
|
1063
|
-
|
|
1066
|
+
h[3] || (h[3] = C("span", { class: "portal-nav-label" }, "Template library", -1))
|
|
1064
1067
|
]),
|
|
1065
1068
|
_: 1
|
|
1066
|
-
}, 8, ["to"])) :
|
|
1069
|
+
}, 8, ["to"])) : ae("", !0)
|
|
1067
1070
|
]),
|
|
1068
1071
|
P(N, {
|
|
1069
|
-
to: { name: "miniprogram-v2-settings", query:
|
|
1072
|
+
to: { name: "miniprogram-v2-settings", query: F(dt)(F(s).query) },
|
|
1070
1073
|
class: "portal-nav-item portal-settings-link",
|
|
1071
1074
|
title: "Settings",
|
|
1072
1075
|
"aria-label": "Settings"
|
|
1073
1076
|
}, {
|
|
1074
1077
|
default: ut(() => [
|
|
1075
1078
|
P(St, { name: "settings" }),
|
|
1076
|
-
|
|
1079
|
+
h[6] || (h[6] = C("span", { class: "portal-nav-label" }, "Settings", -1))
|
|
1077
1080
|
]),
|
|
1078
1081
|
_: 1
|
|
1079
1082
|
}, 8, ["to"])
|
|
1080
|
-
])) :
|
|
1083
|
+
])) : ae("", !0),
|
|
1081
1084
|
C("div", rn, [
|
|
1082
|
-
|
|
1083
|
-
C("span", null, ct(
|
|
1084
|
-
|
|
1085
|
-
C("span", null, ct(
|
|
1086
|
-
|
|
1085
|
+
w.value ? ae("", !0) : (J(), Q("header", on, [
|
|
1086
|
+
C("span", null, ct(F(o).businessName.value), 1),
|
|
1087
|
+
h[7] || (h[7] = C("span", { "aria-hidden": "true" }, "/", -1)),
|
|
1088
|
+
C("span", null, ct(D.value), 1),
|
|
1089
|
+
h[8] || (h[8] = C("div", {
|
|
1087
1090
|
id: "portal-page-actions",
|
|
1088
1091
|
class: "portal-page-actions"
|
|
1089
1092
|
}, null, -1))
|
|
1090
1093
|
])),
|
|
1091
1094
|
C("div", ln, [
|
|
1092
|
-
|
|
1095
|
+
F(o).businessId.value ? F(o).loading.value || F(I).loading.value || O.value ? (J(), Q("div", un, [
|
|
1093
1096
|
P(Ft, { size: "xl" }),
|
|
1094
|
-
|
|
1095
|
-
])) :
|
|
1096
|
-
|
|
1097
|
-
C("p", null, ct(
|
|
1098
|
-
P(
|
|
1097
|
+
h[10] || (h[10] = C("span", null, "Loading your Mini Program…", -1))
|
|
1098
|
+
])) : F(I).enabled.value ? F(o).error.value ? (J(), Q("section", dn, [
|
|
1099
|
+
h[12] || (h[12] = C("h1", null, "Could not open this Mini Program", -1)),
|
|
1100
|
+
C("p", null, ct(F(o).error.value), 1),
|
|
1101
|
+
P(jt, {
|
|
1099
1102
|
label: "Try again",
|
|
1100
|
-
onClick:
|
|
1103
|
+
onClick: F(o).refresh
|
|
1101
1104
|
}, null, 8, ["onClick"])
|
|
1102
|
-
])) : (J(), be(
|
|
1103
|
-
key: `${
|
|
1104
|
-
})) : (J(),
|
|
1105
|
-
|
|
1106
|
-
C("p", null, " It is still rolling out. Your FeedMe contact can enable it for " + ct(
|
|
1107
|
-
])) : (J(),
|
|
1105
|
+
])) : (J(), be(F(Ue), {
|
|
1106
|
+
key: `${F(o).businessId.value}:${F(s).params.projectId ?? String(F(s).name)}:${F(s).query.tpl === "1"}`
|
|
1107
|
+
})) : (J(), Q("section", cn, [
|
|
1108
|
+
h[11] || (h[11] = C("h1", null, "Mini Program is not available for this business", -1)),
|
|
1109
|
+
C("p", null, " It is still rolling out. Your FeedMe contact can enable it for " + ct(F(o).businessName.value) + ". ", 1)
|
|
1110
|
+
])) : (J(), Q("section", sn, [...h[9] || (h[9] = [
|
|
1108
1111
|
C("h1", null, "Select a business", -1),
|
|
1109
1112
|
C("p", null, "Choose a business in the Portal header to open its Mini Program.", -1)
|
|
1110
1113
|
])]))
|
|
@@ -1114,7 +1117,7 @@ const We = {
|
|
|
1114
1117
|
], 64);
|
|
1115
1118
|
};
|
|
1116
1119
|
}
|
|
1117
|
-
}), Fn = /* @__PURE__ */ Be(vn, [["__scopeId", "data-v-
|
|
1120
|
+
}), Fn = /* @__PURE__ */ Be(vn, [["__scopeId", "data-v-d5ab59ed"]]);
|
|
1118
1121
|
export {
|
|
1119
1122
|
Fn as default
|
|
1120
1123
|
};
|