@feedmepos/mf-miniprogram-v2 0.2.7 → 0.2.8-dev.1
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-qAELeU_7.js → App-B7Mai_6F.js} +384 -374
- package/dist/{BrandFontPicker-BZyGrK3D.js → BrandFontPicker-JHyoGusq.js} +1 -1
- package/dist/{BrandKitView-CzefaEEN.js → BrandKitView-Dlt_ifI0.js} +2 -2
- package/dist/{ControlPlaneView-8TjwMZNJ.js → ControlPlaneView-CBGNMsPT.js} +7 -7
- package/dist/{EcosystemView-C-y5cPOp.js → EcosystemView-Cy0N2qNK.js} +4 -4
- package/dist/{LegacyWorkspaceEntry-CADRpDkg.js → LegacyWorkspaceEntry-lEMtmdIe.js} +1 -1
- package/dist/{MobileProjectsView-QBTJVYB9.js → MobileProjectsView-CvMvePvm.js} +3 -3
- package/dist/{ModuleCenterView-B08oZqQw.js → ModuleCenterView-C6mCPATr.js} +1 -1
- package/dist/{ModuleDetailView-lROTkaR7.js → ModuleDetailView-CSfMF0Uo.js} +1 -1
- package/dist/{PagesView-DOG8RSen.js → PagesView-DQCIwpnL.js} +2 -2
- package/dist/{PlatformUnavailableView-C1RltAIw.js → PlatformUnavailableView-DY2ntpNw.js} +1 -1
- package/dist/{PortalSettingsView-BK6kRgtf.js → PortalSettingsView-Cz566Ccd.js} +5 -5
- package/dist/{TemplateCenterView-niXTXw9y.js → TemplateCenterView-DqZLthqh.js} +1 -1
- package/dist/{WorkspaceEntryView-DzR8DQC5.js → WorkspaceEntryView-B28ASSit.js} +2 -2
- package/dist/{adminAccess-CDxAuQ-M.js → adminAccess-oXC0xjvK.js} +1 -1
- package/dist/app.js +12 -12
- package/dist/{controlPlane-DT3t_ftg.js → controlPlane-sXaC6pAh.js} +11 -11
- package/dist/package.json +1 -1
- package/dist/{portalContext-B2pXdNtB.js → portalContext-DV-6uUwp.js} +1 -1
- package/dist/portalNavigation-BBORm5cp.js +34 -0
- package/dist/style.css +1 -1
- package/dist/{useBrandKit-CQv08nyY.js → useBrandKit-CXLIXo5j.js} +2 -2
- package/dist/{useModuleCatalog-B9HXHA-e.js → useModuleCatalog-Cep-pzWO.js} +1 -1
- package/package.json +1 -1
- package/dist/portalNavigation-DKCfwTH8.js +0 -28
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var Et = (f, s,
|
|
4
|
-
import { readonly as
|
|
5
|
-
import { useCoreStore as
|
|
6
|
-
import { useRoute as Re,
|
|
1
|
+
var ke = Object.defineProperty;
|
|
2
|
+
var je = (f, s, p) => s in f ? ke(f, s, { enumerable: !0, configurable: !0, writable: !0, value: p }) : f[s] = p;
|
|
3
|
+
var Et = (f, s, p) => je(f, typeof s != "symbol" ? s + "" : s, p);
|
|
4
|
+
import { readonly as ee, ref as Z, watch as Ee, defineComponent as Pe, computed as St, onMounted as Te, onBeforeUnmount as Ne, resolveComponent as wt, openBlock as J, createElementBlock as Q, Fragment as ne, createElementVNode as C, normalizeClass as ie, createVNode as T, renderList as ye, unref as _, withCtx as st, toDisplayString as ut, createBlock as Se, createCommentVNode as ae } from "vue";
|
|
5
|
+
import { useCoreStore as we } from "@feedmepos/mf-common";
|
|
6
|
+
import { useRoute as Re, useRouter as Ue, RouterView as Ke } from "vue-router";
|
|
7
7
|
import { P as bt } from "./PortalIcon-DO0VrIoY.js";
|
|
8
|
-
import { r as be, u as
|
|
8
|
+
import { r as be, u as Me, w as Ce } from "./adminAccess-oXC0xjvK.js";
|
|
9
9
|
import { c as Ot } from "./_commonjsHelpers-DaMA6jEr.js";
|
|
10
|
-
import { p as
|
|
11
|
-
import { p as ct } from "./portalNavigation-
|
|
12
|
-
import { _ as
|
|
13
|
-
var
|
|
10
|
+
import { p as De } from "./portalContext-DV-6uUwp.js";
|
|
11
|
+
import { e as Ge, p as ct } from "./portalNavigation-BBORm5cp.js";
|
|
12
|
+
import { _ as Be } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
13
|
+
var re = { exports: {} };
|
|
14
14
|
(function(f, s) {
|
|
15
|
-
(function(
|
|
16
|
-
|
|
17
|
-
})(Ot, function(
|
|
18
|
-
var
|
|
15
|
+
(function(p, v) {
|
|
16
|
+
v(s);
|
|
17
|
+
})(Ot, function(p) {
|
|
18
|
+
var v = { getItemSync: function(a) {
|
|
19
19
|
try {
|
|
20
20
|
return localStorage.getItem(a) || null;
|
|
21
21
|
} catch {
|
|
@@ -45,32 +45,32 @@ var ie = { exports: {} };
|
|
|
45
45
|
return a;
|
|
46
46
|
}, o.apply(this, arguments);
|
|
47
47
|
};
|
|
48
|
-
function
|
|
48
|
+
function w(a, e, t, i) {
|
|
49
49
|
return new (t || (t = Promise))(function(n, r) {
|
|
50
|
-
function l(
|
|
50
|
+
function l(y) {
|
|
51
51
|
try {
|
|
52
|
-
|
|
52
|
+
d(i.next(y));
|
|
53
53
|
} catch (u) {
|
|
54
54
|
r(u);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
function c(
|
|
57
|
+
function c(y) {
|
|
58
58
|
try {
|
|
59
|
-
|
|
59
|
+
d(i.throw(y));
|
|
60
60
|
} catch (u) {
|
|
61
61
|
r(u);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function d(y) {
|
|
65
65
|
var u;
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
y.done ? n(y.value) : (u = y.value, u instanceof t ? u : new t(function(S) {
|
|
67
|
+
S(u);
|
|
68
68
|
})).then(l, c);
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
d((i = i.apply(a, [])).next());
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function I(a, e) {
|
|
74
74
|
var t, i, n, r, l = { label: 0, sent: function() {
|
|
75
75
|
if (1 & n[0]) throw n[1];
|
|
76
76
|
return n[1];
|
|
@@ -78,8 +78,8 @@ var ie = { exports: {} };
|
|
|
78
78
|
return r = { next: c(0), throw: c(1), return: c(2) }, typeof Symbol == "function" && (r[Symbol.iterator] = function() {
|
|
79
79
|
return this;
|
|
80
80
|
}), r;
|
|
81
|
-
function c(
|
|
82
|
-
return function(
|
|
81
|
+
function c(d) {
|
|
82
|
+
return function(y) {
|
|
83
83
|
return function(u) {
|
|
84
84
|
if (t) throw new TypeError("Generator is already executing.");
|
|
85
85
|
for (; l; ) try {
|
|
@@ -118,14 +118,14 @@ var ie = { exports: {} };
|
|
|
118
118
|
continue;
|
|
119
119
|
}
|
|
120
120
|
u = e.call(a, l);
|
|
121
|
-
} catch (
|
|
122
|
-
u = [6,
|
|
121
|
+
} catch (S) {
|
|
122
|
+
u = [6, S], i = 0;
|
|
123
123
|
} finally {
|
|
124
124
|
t = n = 0;
|
|
125
125
|
}
|
|
126
126
|
if (5 & u[0]) throw u[1];
|
|
127
127
|
return { value: u[0] ? u[1] : void 0, done: !0 };
|
|
128
|
-
}([
|
|
128
|
+
}([d, y]);
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
}
|
|
@@ -133,7 +133,7 @@ var ie = { exports: {} };
|
|
|
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;
|
|
@@ -159,57 +159,57 @@ var ie = { exports: {} };
|
|
|
159
159
|
function F(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, m;
|
|
169
|
+
function E(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
|
}
|
|
173
173
|
function D(a) {
|
|
174
174
|
return !!a && typeof a == "object" && a.value !== void 0;
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function it(a) {
|
|
177
177
|
return Object.fromEntries(Object.entries(a).map(function(e) {
|
|
178
178
|
var t = e[0], i = e[1];
|
|
179
179
|
return [t, D(i) ? i : { value: i }];
|
|
180
180
|
}));
|
|
181
181
|
}
|
|
182
|
-
function
|
|
183
|
-
return o(o({}, a), { identity: a.identity ? o(o({}, a.identity), { traits:
|
|
182
|
+
function vt(a) {
|
|
183
|
+
return o(o({}, a), { identity: a.identity ? o(o({}, a.identity), { traits: it(a.identity.traits || {}) }) : void 0 });
|
|
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 gt, A = null, At = "FLAGSMITH_EVENT", V = At, h = "https://edge.api.flagsmith.com/api/v1/", N = "flagsmith_value_", ht = "flagsmith_enabled_", Ft = "flagsmith_trait_", kt = 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
|
-
var l = "".concat(t.getContext().identity), c = function(
|
|
195
|
-
var
|
|
196
|
-
if (
|
|
197
|
-
var z =
|
|
194
|
+
var l = "".concat(t.getContext().identity), c = function(d) {
|
|
195
|
+
var y, u, S, k;
|
|
196
|
+
if (d && l === "".concat(t.getContext().identity)) {
|
|
197
|
+
var z = d.flags, R = d.traits, G = d.identifier;
|
|
198
198
|
t.isLoading = !1;
|
|
199
|
-
var
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}),
|
|
203
|
-
|
|
199
|
+
var U = {}, K = {};
|
|
200
|
+
R = R || [], (z = z || []).forEach(function(b) {
|
|
201
|
+
U[b.feature.name.toLowerCase().replace(/ /g, "_")] = { id: b.feature.id, enabled: b.enabled, value: b.feature_state_value };
|
|
202
|
+
}), R.forEach(function(b) {
|
|
203
|
+
K[b.trait_key.toLowerCase().replace(/ /g, "_")] = { transient: b.transient, value: b.trait_value };
|
|
204
204
|
}), t.oldFlags = o({}, t.flags);
|
|
205
|
-
var q = F(t.oldFlags,
|
|
206
|
-
if ((
|
|
205
|
+
var q = F(t.oldFlags, U), ft = F((y = t.evaluationContext.identity) === null || y === void 0 ? void 0 : y.traits, K);
|
|
206
|
+
if ((G || Object.keys(K).length) && (t.evaluationContext.identity = o(o({}, t.evaluationContext.identity), { traits: K }), G && (t.evaluationContext.identity.identifier = G)), t.flags = U, t.updateStorage(), t._onChange(t.oldFlags, { isFromServer: !0, flagsChanged: q, traitsChanged: ft }, t._loadedState(null, g.SERVER)), t.datadogRum) try {
|
|
207
207
|
if (t.datadogRum.trackTraits) {
|
|
208
|
-
var
|
|
208
|
+
var pt = {};
|
|
209
209
|
Object.keys(((u = t.evaluationContext.identity) === null || u === void 0 ? void 0 : u.traits) || {}).map(function(b) {
|
|
210
|
-
|
|
210
|
+
pt[Ft + b] = t.getTrait(b);
|
|
211
211
|
});
|
|
212
|
-
var at = o(o(o({}, t.datadogRum.client.getUser()), { id: t.datadogRum.client.getUser().id || ((
|
|
212
|
+
var at = o(o(o({}, t.datadogRum.client.getUser()), { id: t.datadogRum.client.getUser().id || ((S = t.evaluationContext.identity) === null || S === void 0 ? void 0 : S.identifier) }), pt);
|
|
213
213
|
t.log("Setting Datadog user", at), t.datadogRum.client.setUser(at);
|
|
214
214
|
}
|
|
215
215
|
} catch (b) {
|
|
@@ -218,27 +218,27 @@ var ie = { exports: {} };
|
|
|
218
218
|
if (t.dtrum) try {
|
|
219
219
|
var j = { javaDouble: {}, date: {}, shortString: {}, javaLongOrObject: {} };
|
|
220
220
|
Object.keys(t.flags).map(function(b) {
|
|
221
|
-
|
|
221
|
+
E(j, N + b, t.getValue(b, { skipAnalytics: !0 })), E(j, ht + b, t.hasFeature(b, { skipAnalytics: !0 }));
|
|
222
222
|
}), Object.keys(((k = t.evaluationContext.identity) === null || k === void 0 ? void 0 : k.traits) || {}).map(function(b) {
|
|
223
|
-
|
|
223
|
+
E(j, Ft + b, t.getTrait(b));
|
|
224
224
|
}), t.log("Sending javaLongOrObject traits to dynatrace", j.javaLongOrObject), t.log("Sending date traits to dynatrace", j.date), t.log("Sending shortString traits to dynatrace", j.shortString), t.log("Sending javaDouble to dynatrace", j.javaDouble), t.dtrum.sendSessionProperties(j.javaLongOrObject, j.date, j.shortString, j.javaDouble);
|
|
225
225
|
} catch (b) {
|
|
226
226
|
console.error(b);
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
};
|
|
230
|
-
return r.identity ? Promise.all([r.identity.traits && Object.keys(r.identity.traits).length || !r.identity.identifier ? t.getJSON(n + "identities/", "POST", JSON.stringify({ identifier: r.identity.identifier, transient: r.identity.transient, traits: Object.entries(r.identity.traits).map(function(
|
|
231
|
-
var
|
|
232
|
-
return { trait_key:
|
|
233
|
-
}).filter(function(
|
|
234
|
-
return
|
|
235
|
-
}) })) : t.getJSON(n + "identities/?identifier=" + encodeURIComponent(r.identity.identifier) + (r.identity.transient ? "&transient=true" : ""))]).then(function(
|
|
236
|
-
return t.evaluationContext.identity = o(o({}, t.evaluationContext.identity), { traits: {} }), c(
|
|
237
|
-
}).catch(function(
|
|
238
|
-
var
|
|
230
|
+
return r.identity ? Promise.all([r.identity.traits && Object.keys(r.identity.traits).length || !r.identity.identifier ? t.getJSON(n + "identities/", "POST", JSON.stringify({ identifier: r.identity.identifier, transient: r.identity.transient, traits: Object.entries(r.identity.traits).map(function(d) {
|
|
231
|
+
var y = d[0], u = d[1];
|
|
232
|
+
return { trait_key: y, trait_value: u == null ? void 0 : u.value, transient: u == null ? void 0 : u.transient };
|
|
233
|
+
}).filter(function(d) {
|
|
234
|
+
return d.trait_value !== void 0 || (t.log("Warning - attempted to set an undefined trait value for key", d.trait_key), !1);
|
|
235
|
+
}) })) : t.getJSON(n + "identities/?identifier=" + encodeURIComponent(r.identity.identifier) + (r.identity.transient ? "&transient=true" : ""))]).then(function(d) {
|
|
236
|
+
return t.evaluationContext.identity = o(o({}, t.evaluationContext.identity), { traits: {} }), c(d == null ? void 0 : d[0]);
|
|
237
|
+
}).catch(function(d) {
|
|
238
|
+
var y = d.message, u = new Error(y);
|
|
239
239
|
return Promise.reject(u);
|
|
240
|
-
}) : t.getJSON(n + "flags/").then(function(
|
|
241
|
-
return c({ flags:
|
|
240
|
+
}) : t.getJSON(n + "flags/").then(function(d) {
|
|
241
|
+
return c({ flags: d, traits: void 0 });
|
|
242
242
|
});
|
|
243
243
|
}, this.analyticsFlags = function() {
|
|
244
244
|
var i = t.api;
|
|
@@ -250,7 +250,7 @@ var ie = { 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 {
|
|
@@ -269,7 +269,7 @@ var ie = { exports: {} };
|
|
|
269
269
|
return [r, l == null ? void 0 : l.value];
|
|
270
270
|
}));
|
|
271
271
|
}, this.setContext = function(i) {
|
|
272
|
-
var n =
|
|
272
|
+
var n = vt(i);
|
|
273
273
|
return t.evaluationContext = o(o({}, n), { environment: n.environment || t.evaluationContext.environment }), t.initialised ? t.getFlags() : Promise.resolve();
|
|
274
274
|
}, this.getContext = function() {
|
|
275
275
|
return t.evaluationContext;
|
|
@@ -277,7 +277,7 @@ var ie = { exports: {} };
|
|
|
277
277
|
return t.setContext(o(o({}, t.getContext()), i));
|
|
278
278
|
}, this.setTrait = function(i, n) {
|
|
279
279
|
var r;
|
|
280
|
-
if (t.api) return t.setContext(o(o({}, t.evaluationContext), { identity: o(o({}, t.evaluationContext.identity), { traits: o(o({}, (r = t.evaluationContext.identity) === null || r === void 0 ? void 0 : r.traits),
|
|
280
|
+
if (t.api) return t.setContext(o(o({}, t.evaluationContext), { identity: o(o({}, t.evaluationContext.identity), { traits: o(o({}, (r = t.evaluationContext.identity) === null || r === void 0 ? void 0 : r.traits), it(Object.fromEntries([[i, n]]))) }) }));
|
|
281
281
|
}, this.setTraits = function(i) {
|
|
282
282
|
var n;
|
|
283
283
|
if (t.api) return t.setContext(o(o({}, t.evaluationContext), { identity: o(o({}, t.evaluationContext.identity), { traits: o(o({}, (n = t.evaluationContext.identity) === null || n === void 0 ? void 0 : n.traits), Object.fromEntries(Object.entries(i).map(function(r) {
|
|
@@ -294,33 +294,33 @@ var ie = { exports: {} };
|
|
|
294
294
|
}, this.getJSON = function(i, n, r) {
|
|
295
295
|
var l, c = t;
|
|
296
296
|
c.evaluationContext;
|
|
297
|
-
var
|
|
298
|
-
t.evaluationContext.environment && (
|
|
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), m || 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 k, z,
|
|
302
|
-
if (u ===
|
|
303
|
-
var
|
|
304
|
-
if (
|
|
305
|
-
var
|
|
306
|
-
if (isNaN(
|
|
307
|
-
t.timestamp =
|
|
308
|
-
} catch (
|
|
309
|
-
t.log(
|
|
300
|
+
return m(i, y).then(function(S) {
|
|
301
|
+
var k, z, R = "".concat((k = t.evaluationContext.identity) === null || k === void 0 ? void 0 : k.identifier);
|
|
302
|
+
if (u === R) {
|
|
303
|
+
var G = (z = S.headers) === null || z === void 0 ? void 0 : z.get("x-flagsmith-document-updated-at");
|
|
304
|
+
if (G) try {
|
|
305
|
+
var U = parseFloat(G);
|
|
306
|
+
if (isNaN(U)) return Promise.reject("Failed to parse x-flagsmith-document-updated-at");
|
|
307
|
+
t.timestamp = U;
|
|
308
|
+
} catch (K) {
|
|
309
|
+
t.log(K, "Failed to parse x-flagsmith-document-updated-at", G);
|
|
310
310
|
}
|
|
311
|
-
return t.log("Fetch response: " +
|
|
312
|
-
var q =
|
|
311
|
+
return t.log("Fetch response: " + S.status + " " + (n || "GET") + 0 + i), S.text().then(function(K) {
|
|
312
|
+
var q = K;
|
|
313
313
|
try {
|
|
314
|
-
q = JSON.parse(
|
|
314
|
+
q = JSON.parse(K);
|
|
315
315
|
} catch {
|
|
316
316
|
}
|
|
317
|
-
return !q &&
|
|
317
|
+
return !q && S.status && (q = "API Response: ".concat(S.status)), S.status && S.status >= 200 && S.status < 300 ? q : Promise.reject(new Error(q));
|
|
318
318
|
});
|
|
319
319
|
}
|
|
320
|
-
t.log("Received response with identity mismatch, ignoring response. Requested: ".concat(u, ", Current: ").concat(
|
|
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(ht + 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,125 +328,125 @@ var ie = { 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
|
+
}, m = 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 && (gt = 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,
|
|
337
|
-
return
|
|
338
|
-
switch (
|
|
335
|
+
return w(this, void 0, void 0, function() {
|
|
336
|
+
var r, l, c, d, y, u, S, k, z, R, G, U, K, q, ft, pt, at, j, b, Pt, mt, de, rt, Tt, ve, ge, Nt, he, Rt, yt, ot, fe, P = this;
|
|
337
|
+
return I(this, function(B) {
|
|
338
|
+
switch (B.label) {
|
|
339
339
|
case 0:
|
|
340
|
-
r =
|
|
340
|
+
r = vt(e.evaluationContext || this.evaluationContext), B.label = 1;
|
|
341
341
|
case 1:
|
|
342
|
-
if (
|
|
343
|
-
if (r.identity =
|
|
344
|
-
return [
|
|
345
|
-
})) : {} } : r.identity, this.evaluationContext = r, this.api =
|
|
346
|
-
P.setLoadingState(o(o({}, P.loadingState), { isFetching: !1, isLoading: !1, error:
|
|
347
|
-
}, this.enableLogs =
|
|
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, S = e.cacheFlags, k = e.datadogRum, z = e.onError, R = e.defaultFlags, G = e.fetch, U = e.preventFetch, K = e.enableLogs, q = e.enableDynatrace, ft = e.enableAnalytics, pt = e.realtime, at = e.eventSourceUrl, j = at === void 0 ? "https://realtime.flagsmith.com/" : at, b = e.AsyncStorage, Pt = e.identity, mt = e.traits, de = e.state, rt = e.cacheOptions, Tt = 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 = Pt || mt ? { identifier: Pt, traits: mt ? Object.fromEntries(Object.entries(mt).map(function(M) {
|
|
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, 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
|
+
P.setLoadingState(o(o({}, P.loadingState), { isFetching: !1, isLoading: !1, error: M })), z == null || z(M);
|
|
347
|
+
}, this.enableLogs = K || !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 && (m = G), this.enableAnalytics = ft || !1, this.flags = Object.assign({}, R) || {}, this.datadogRum = k || null, this.initialised = !0, this.ticks = 1e4, this.timer = this.enableLogs ? (/* @__PURE__ */ new Date()).valueOf() : null, this.cacheFlags = A !== void 0 && !!S, V = "FLAGSMITH_EVENT_" + r.environment.apiKey, b && (A = b), pt && typeof window < "u" && this.setupRealtime(j, 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), q && (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), Tt && (m = /* @__PURE__ */ function(M) {
|
|
348
348
|
return function($, H) {
|
|
349
|
-
var
|
|
350
|
-
return new Promise(function(
|
|
351
|
-
switch (
|
|
349
|
+
var tt = H.headers, x = H.method, lt = H.body;
|
|
350
|
+
return new Promise(function(nt) {
|
|
351
|
+
switch (x) {
|
|
352
352
|
case "GET":
|
|
353
|
-
return
|
|
354
|
-
|
|
353
|
+
return M.get($, { headers: tt }).subscribe(function(X) {
|
|
354
|
+
nt({ ok: !0, text: function() {
|
|
355
355
|
return Promise.resolve(X);
|
|
356
356
|
} });
|
|
357
357
|
});
|
|
358
358
|
case "POST":
|
|
359
359
|
case "PUT":
|
|
360
|
-
return
|
|
361
|
-
|
|
360
|
+
return M.post($, lt, { headers: tt }).subscribe(function(X) {
|
|
361
|
+
nt({ ok: !0, text: function() {
|
|
362
362
|
return Promise.resolve(X);
|
|
363
363
|
} });
|
|
364
364
|
});
|
|
365
365
|
}
|
|
366
366
|
});
|
|
367
367
|
};
|
|
368
|
-
}(
|
|
368
|
+
}(Tt)), A && this.canUseStorage && A.getItem(V).then(function(M) {
|
|
369
369
|
try {
|
|
370
|
-
P.evaluationEvent = JSON.parse(
|
|
370
|
+
P.evaluationEvent = JSON.parse(M) || {};
|
|
371
371
|
} catch {
|
|
372
372
|
P.evaluationEvent = {};
|
|
373
373
|
}
|
|
374
374
|
P.analyticsInterval = setInterval(P.analyticsFlags, P.ticks);
|
|
375
|
-
}), this.enableAnalytics && (this.analyticsInterval && clearInterval(this.analyticsInterval),
|
|
375
|
+
}), this.enableAnalytics && (this.analyticsInterval && clearInterval(this.analyticsInterval), A && this.canUseStorage && A.getItem(V, function(M, $) {
|
|
376
376
|
if ($ && P.evaluationContext.environment) {
|
|
377
377
|
var H = JSON.parse($);
|
|
378
378
|
if (H[P.evaluationContext.environment.apiKey]) {
|
|
379
|
-
var
|
|
380
|
-
P.log("Retrieved events from cache", $), P.setState(o(o({},
|
|
379
|
+
var tt = P.getState();
|
|
380
|
+
P.log("Retrieved events from cache", $), P.setState(o(o({}, tt), { evaluationEvent: H[P.evaluationContext.environment.apiKey] }));
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
|
-
})), !
|
|
384
|
-
if (!
|
|
385
|
-
|
|
386
|
-
return
|
|
387
|
-
var H,
|
|
388
|
-
return
|
|
389
|
-
switch (
|
|
383
|
+
})), !S) return [3, 9];
|
|
384
|
+
if (!A || !this.canUseStorage) return [3, 8];
|
|
385
|
+
he = function(M, $) {
|
|
386
|
+
return w(P, void 0, void 0, function() {
|
|
387
|
+
var H, tt, x, lt, nt, X, Ut, pe, Kt, Mt, Dt, Gt, Bt, Jt, Vt, zt, qt, $t, Ht, Yt, Xt, Qt, Zt, Wt, me = this;
|
|
388
|
+
return I(this, function(et) {
|
|
389
|
+
switch (et.label) {
|
|
390
390
|
case 0:
|
|
391
391
|
if (!$) return [3, 7];
|
|
392
|
-
H = null,
|
|
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 = (Kt = x.evaluationContext) === null || Kt === void 0 ? void 0 : Kt.environment) === null || Mt === void 0 ? void 0 : Mt.apiKey) === ((Dt = this.evaluationContext.environment) === null || Dt === void 0 ? void 0 : Dt.apiKey) && (X = !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), X = !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"), X = !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, X = !0)), X && (lt = !0, tt = F((zt = this.evaluationContext.identity) === null || zt === void 0 ? void 0 : zt.traits, ($t = (qt = x.evaluationContext) === null || qt === void 0 ? void 0 : qt.identity) === null || $t === void 0 ? void 0 : $t.traits), H = F(this.flags, x.flags), this.setState(o(o({}, x), { evaluationContext: vt(o(o({}, x.evaluationContext), { identity: !((Ht = x.evaluationContext) === null || Ht === void 0) && Ht.identity ? o(o({}, (Yt = x.evaluationContext) === null || Yt === void 0 ? void 0 : Yt.identity), { traits: o(o({}, ((Qt = (Xt = x.evaluationContext) === null || Xt === void 0 ? void 0 : Xt.identity) === null || Qt === void 0 ? void 0 : Qt.traits) || {}), mt || {}) }) : void 0 })) })), this.log("Retrieved flags from cache", x))), lt ? (Ut = !U && (!this.cacheOptions.skipAPI || nt), this._onChange(null, { isFromServer: !1, flagsChanged: H, traitsChanged: tt }, this._loadedState(null, g.CACHE, Ut)), this.oldFlags = this.flags, this.cacheOptions.skipAPI && lt && !nt && this.log("Skipping API, using cache"), Ut && 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
|
-
return
|
|
399
|
+
return U ? [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
|
|
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
|
-
return
|
|
409
|
+
return U ? [3, 9] : [4, this.getFlags()];
|
|
410
410
|
case 8:
|
|
411
|
-
return
|
|
411
|
+
return et.sent(), [3, 10];
|
|
412
412
|
case 9:
|
|
413
|
-
if (
|
|
413
|
+
if (R) this._onChange(null, { isFromServer: !1, flagsChanged: F({}, this.flags), traitsChanged: F({}, (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: F({}, this.flags), traitsChanged: F({}, (
|
|
415
|
+
if (!this.flags) throw new Error(Nt);
|
|
416
|
+
this._onChange(null, { isFromServer: !1, flagsChanged: F({}, this.flags), traitsChanged: F({}, (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
|
}
|
|
422
422
|
});
|
|
423
423
|
});
|
|
424
|
-
},
|
|
424
|
+
}, B.label = 2;
|
|
425
425
|
case 2:
|
|
426
|
-
return
|
|
426
|
+
return B.trys.push([2, 7, , 8]), A.getItemSync ? (Rt = A.getItemSync(this.getStorageKey()), [3, 5]) : [3, 3];
|
|
427
427
|
case 3:
|
|
428
|
-
return [4,
|
|
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,
|
|
432
|
+
return [4, he(null, Rt)];
|
|
433
433
|
case 6:
|
|
434
434
|
case 7:
|
|
435
|
-
return
|
|
435
|
+
return B.sent(), [3, 8];
|
|
436
436
|
case 8:
|
|
437
437
|
return [3, 12];
|
|
438
438
|
case 9:
|
|
439
|
-
return
|
|
439
|
+
return U ? [3, 11] : [4, this.getFlags()];
|
|
440
440
|
case 10:
|
|
441
|
-
return
|
|
441
|
+
return B.sent(), [3, 12];
|
|
442
442
|
case 11:
|
|
443
|
-
if (
|
|
444
|
-
else if (this.flags && (
|
|
445
|
-
|
|
443
|
+
if (R) this._onChange(null, { isFromServer: !1, flagsChanged: F({}, R), traitsChanged: F({}, (t = r.identity) === null || t === void 0 ? void 0 : t.traits) }, this._loadedState(null, g.DEFAULT_FLAGS));
|
|
444
|
+
else if (this.flags && (yt = null, Object.keys(this.flags).length === 0 && (yt = Nt), this._onChange(null, { isFromServer: !1, flagsChanged: F({}, this.flags), traitsChanged: F({}, (i = r.identity) === null || i === void 0 ? void 0 : i.traits) }, this._loadedState(yt, g.DEFAULT_FLAGS)), yt)) throw new Error(yt);
|
|
445
|
+
B.label = 12;
|
|
446
446
|
case 12:
|
|
447
447
|
return [3, 14];
|
|
448
448
|
case 13:
|
|
449
|
-
throw ot =
|
|
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 ie = { 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) {
|
|
@@ -478,21 +478,21 @@ var ie = { exports: {} };
|
|
|
478
478
|
if (this.cacheFlags) {
|
|
479
479
|
this.ts = (/* @__PURE__ */ new Date()).valueOf();
|
|
480
480
|
var e = JSON.stringify(this.getState());
|
|
481
|
-
this.log("Setting storage", e),
|
|
481
|
+
this.log("Setting storage", e), A.setItem(this.getStorageKey(), e);
|
|
482
482
|
}
|
|
483
483
|
}, a.prototype.updateEventStorage = function() {
|
|
484
484
|
if (this.enableAnalytics) {
|
|
485
485
|
var e = JSON.stringify(this.getState().evaluationEvent);
|
|
486
|
-
|
|
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
|
+
gt ? this.eventSource || (this.log("Creating event source with url " + n), this.eventSource = new gt(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,11 +503,11 @@ var ie = { 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 kt({ fetch: e, AsyncStorage: t, eventSource: i });
|
|
509
509
|
}
|
|
510
|
-
var xt,
|
|
510
|
+
var xt, Ie = (xt = function(a, e) {
|
|
511
511
|
return xt = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, i) {
|
|
512
512
|
t.__proto__ = i;
|
|
513
513
|
} || function(t, i) {
|
|
@@ -519,14 +519,14 @@ var ie = { exports: {} };
|
|
|
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);
|
|
525
525
|
if (a && typeof a.length == "number") return { next: function() {
|
|
526
526
|
return a && i >= a.length && (a = void 0), { value: a && a[i++], done: !a };
|
|
527
527
|
} };
|
|
528
528
|
throw new TypeError(e ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
529
|
-
},
|
|
529
|
+
}, le = function(a, e) {
|
|
530
530
|
var t = typeof Symbol == "function" && a[Symbol.iterator];
|
|
531
531
|
if (!t) return a;
|
|
532
532
|
var i, n, r = t.call(a), l = [];
|
|
@@ -542,19 +542,19 @@ var ie = { exports: {} };
|
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
544
|
return l;
|
|
545
|
-
},
|
|
545
|
+
}, jt = function(a, e, t) {
|
|
546
546
|
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]);
|
|
547
547
|
return a.concat(i || Array.prototype.slice.call(e));
|
|
548
|
-
},
|
|
548
|
+
}, Le = function(a) {
|
|
549
549
|
function e() {
|
|
550
550
|
return a.call(this, `EventSource not available.
|
|
551
551
|
Consider loading an EventSource polyfill and making it available globally as EventSource, or passing one in as eventSourceClass to the ReconnectingEventSource constructor.`) || this;
|
|
552
552
|
}
|
|
553
|
-
return
|
|
554
|
-
}(Error),
|
|
553
|
+
return Ie(e, a), e;
|
|
554
|
+
}(Error), se = function() {
|
|
555
555
|
function a(e, t) {
|
|
556
556
|
var i = this;
|
|
557
|
-
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
|
|
557
|
+
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 Le();
|
|
558
558
|
this._onevent_wrapped = function(n) {
|
|
559
559
|
i._onevent(n);
|
|
560
560
|
}, this._start();
|
|
@@ -563,20 +563,20 @@ Consider loading an EventSource polyfill and making it available globally as Eve
|
|
|
563
563
|
throw new Error("Method not implemented.");
|
|
564
564
|
}, a.prototype._start = function() {
|
|
565
565
|
var e, t, i = this, n = this.url;
|
|
566
|
-
this._lastEventId && (n.indexOf("?") === -1 ? n += "?" : n += "&", n += "lastEventId=" + encodeURIComponent(this._lastEventId)), this._eventSource = new this.eventSourceClass(n, this._configuration), this._eventSource.onopen = function(
|
|
567
|
-
i._onopen(
|
|
568
|
-
}, this._eventSource.onerror = function(
|
|
569
|
-
i._onerror(
|
|
570
|
-
}, this._eventSource.onmessage = function(
|
|
571
|
-
i.onmessage(
|
|
566
|
+
this._lastEventId && (n.indexOf("?") === -1 ? n += "?" : n += "&", n += "lastEventId=" + encodeURIComponent(this._lastEventId)), this._eventSource = new this.eventSourceClass(n, this._configuration), this._eventSource.onopen = function(d) {
|
|
567
|
+
i._onopen(d);
|
|
568
|
+
}, this._eventSource.onerror = function(d) {
|
|
569
|
+
i._onerror(d);
|
|
570
|
+
}, this._eventSource.onmessage = function(d) {
|
|
571
|
+
i.onmessage(d);
|
|
572
572
|
};
|
|
573
573
|
try {
|
|
574
|
-
for (var r =
|
|
574
|
+
for (var r = oe(Object.keys(this._listeners)), l = r.next(); !l.done; l = r.next()) {
|
|
575
575
|
var c = l.value;
|
|
576
576
|
this._eventSource.addEventListener(c, this._onevent_wrapped);
|
|
577
577
|
}
|
|
578
|
-
} catch (
|
|
579
|
-
e = { error:
|
|
578
|
+
} catch (d) {
|
|
579
|
+
e = { error: d };
|
|
580
580
|
} finally {
|
|
581
581
|
try {
|
|
582
582
|
l && !l.done && (t = r.return) && t.call(r);
|
|
@@ -600,7 +600,7 @@ Consider loading an EventSource polyfill and making it available globally as Eve
|
|
|
600
600
|
e && e.lastEventId && (this._lastEventId = e.lastEventId);
|
|
601
601
|
var n = this._listeners[e.type];
|
|
602
602
|
if (n != null) try {
|
|
603
|
-
for (var r =
|
|
603
|
+
for (var r = oe(jt([], le(n), !1)), l = r.next(); !l.done; l = r.next())
|
|
604
604
|
l.value.call(this, e);
|
|
605
605
|
} catch (c) {
|
|
606
606
|
t = { error: c };
|
|
@@ -620,7 +620,7 @@ Consider loading an EventSource polyfill and making it available globally as Eve
|
|
|
620
620
|
}, a.prototype.addEventListener = function(e, t, i) {
|
|
621
621
|
this._listeners[e] == null && (this._listeners[e] = [], this._eventSource != null && this._eventSource.addEventListener(e, this._onevent_wrapped));
|
|
622
622
|
var n = this._listeners[e];
|
|
623
|
-
n.includes(t) || (this._listeners[e] =
|
|
623
|
+
n.includes(t) || (this._listeners[e] = jt(jt([], le(n), !1), [t], !1));
|
|
624
624
|
}, a.prototype.removeEventListener = function(e, t, i) {
|
|
625
625
|
var n = this._listeners[e];
|
|
626
626
|
this._listeners[e] = n.filter(function(r) {
|
|
@@ -629,16 +629,16 @@ Consider loading an EventSource polyfill and making it available globally as Eve
|
|
|
629
629
|
}, a;
|
|
630
630
|
}();
|
|
631
631
|
globalThis.FlagsmithEventSource = typeof EventSource < "u" ? EventSource : null;
|
|
632
|
-
var
|
|
632
|
+
var ue = function(a, e) {
|
|
633
633
|
return e = e || {}, new Promise(function(t, i) {
|
|
634
|
-
var n = new XMLHttpRequest(), r = [], l = [], c = {},
|
|
634
|
+
var n = new XMLHttpRequest(), r = [], l = [], c = {}, d = function() {
|
|
635
635
|
return { ok: (n.status / 100 | 0) == 2, statusText: n.statusText, status: n.status, url: n.responseURL, text: function() {
|
|
636
636
|
return Promise.resolve(n.responseText);
|
|
637
637
|
}, json: function() {
|
|
638
638
|
return Promise.resolve(n.responseText).then(JSON.parse);
|
|
639
639
|
}, blob: function() {
|
|
640
640
|
return Promise.resolve(new Blob([n.response]));
|
|
641
|
-
}, clone:
|
|
641
|
+
}, clone: d, headers: { keys: function() {
|
|
642
642
|
return r;
|
|
643
643
|
}, entries: function() {
|
|
644
644
|
return l;
|
|
@@ -648,22 +648,22 @@ Consider loading an EventSource polyfill and making it available globally as Eve
|
|
|
648
648
|
return u.toLowerCase() in c;
|
|
649
649
|
} } };
|
|
650
650
|
};
|
|
651
|
-
for (var
|
|
652
|
-
n.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function(u,
|
|
653
|
-
r.push(
|
|
654
|
-
}), t(
|
|
655
|
-
}, n.onerror = i, n.withCredentials = e.credentials == "include", e.headers) n.setRequestHeader(
|
|
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, S, k) {
|
|
653
|
+
r.push(S = S.toLowerCase()), l.push([S, k]), c[S] = c[S] ? c[S] + "," + k : k;
|
|
654
|
+
}), t(d());
|
|
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
|
-
},
|
|
659
|
-
typeof window < "u" && (window.flagsmith =
|
|
660
|
-
return
|
|
661
|
-
},
|
|
658
|
+
}, ce = L({ AsyncStorage: v, fetch: ue, eventSource: se });
|
|
659
|
+
typeof window < "u" && (window.flagsmith = ce), p.createFlagsmithInstance = function() {
|
|
660
|
+
return L({ AsyncStorage: v, fetch: ue, eventSource: se });
|
|
661
|
+
}, p.default = ce, Object.defineProperty(p, "__esModule", { value: !0 });
|
|
662
662
|
});
|
|
663
|
-
})(
|
|
664
|
-
var
|
|
663
|
+
})(re, re.exports);
|
|
664
|
+
var Je = re.exports, Ve = {
|
|
665
665
|
NOT_INITIALIZED: "FeatureFlag not initialized. Call init() first."
|
|
666
|
-
},
|
|
666
|
+
}, _e = "business", Y, ze = (Y = class {
|
|
667
667
|
constructor() {
|
|
668
668
|
Et(this, "flagsmithClient", null);
|
|
669
669
|
Et(this, "userContext", null);
|
|
@@ -673,22 +673,22 @@ var Ge = ie.exports, Je = {
|
|
|
673
673
|
}
|
|
674
674
|
ensureInitialized() {
|
|
675
675
|
if (!this.flagsmithClient)
|
|
676
|
-
throw new Error(
|
|
676
|
+
throw new Error(Ve.NOT_INITIALIZED);
|
|
677
677
|
}
|
|
678
|
-
async init(s,
|
|
678
|
+
async init(s, p = []) {
|
|
679
679
|
if (!this.flagsmithClient)
|
|
680
680
|
try {
|
|
681
|
-
this.flagsmithClient =
|
|
682
|
-
const
|
|
681
|
+
this.flagsmithClient = Je.createFlagsmithInstance();
|
|
682
|
+
const v = p.reduce((o, w) => (o[w.feature.name] = w, 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/",
|
|
686
686
|
enableAnalytics: (s == null ? void 0 : s.enableAnalytics) ?? !0,
|
|
687
|
-
defaultFlags:
|
|
687
|
+
defaultFlags: v,
|
|
688
688
|
cacheFlags: (s == null ? void 0 : s.cacheFlags) ?? !0
|
|
689
689
|
});
|
|
690
|
-
} catch (
|
|
691
|
-
throw console.error("Failed to initialize FeatureFlag:",
|
|
690
|
+
} catch (v) {
|
|
691
|
+
throw console.error("Failed to initialize FeatureFlag:", v), v;
|
|
692
692
|
}
|
|
693
693
|
}
|
|
694
694
|
async setUser(s) {
|
|
@@ -709,54 +709,54 @@ var Ge = ie.exports, Je = {
|
|
|
709
709
|
async getFlags() {
|
|
710
710
|
this.ensureInitialized();
|
|
711
711
|
const s = this.flagsmithClient.getAllFlags();
|
|
712
|
-
return Object.entries(s).map(([
|
|
712
|
+
return Object.entries(s).map(([p, v]) => {
|
|
713
713
|
var o;
|
|
714
714
|
return {
|
|
715
715
|
feature: {
|
|
716
|
-
name:
|
|
717
|
-
id: (
|
|
716
|
+
name: p,
|
|
717
|
+
id: (v == null ? void 0 : v.id) ?? 0
|
|
718
718
|
},
|
|
719
|
-
enabled:
|
|
720
|
-
value: ((o =
|
|
719
|
+
enabled: v.enabled,
|
|
720
|
+
value: ((o = v.value) == null ? void 0 : o.toString()) ?? null
|
|
721
721
|
};
|
|
722
722
|
});
|
|
723
723
|
}
|
|
724
|
-
getFlagValue(s,
|
|
724
|
+
getFlagValue(s, p) {
|
|
725
725
|
this.ensureInitialized();
|
|
726
|
-
const
|
|
727
|
-
if (
|
|
726
|
+
const v = this.flagsmithClient.getValue(s);
|
|
727
|
+
if (v == null)
|
|
728
728
|
return null;
|
|
729
729
|
try {
|
|
730
|
-
const o =
|
|
731
|
-
return
|
|
730
|
+
const o = v.toString();
|
|
731
|
+
return p ? p(o) : typeof {} == "number" ? isNaN(Number(o)) ? null : Number(o) : typeof {} == "boolean" ? o.toLowerCase() === "true" : o;
|
|
732
732
|
} catch (o) {
|
|
733
733
|
return console.error("Error transforming flag value:", o), null;
|
|
734
734
|
}
|
|
735
735
|
}
|
|
736
736
|
getFlag(s) {
|
|
737
737
|
this.ensureInitialized();
|
|
738
|
-
const
|
|
739
|
-
if (
|
|
740
|
-
const
|
|
738
|
+
const p = this.flagsmithClient.getValue(s);
|
|
739
|
+
if (p == null) return null;
|
|
740
|
+
const v = this.flagsmithClient.hasFeature(s);
|
|
741
741
|
return {
|
|
742
742
|
feature: {
|
|
743
743
|
name: s,
|
|
744
744
|
id: 0
|
|
745
745
|
},
|
|
746
|
-
enabled:
|
|
747
|
-
value:
|
|
746
|
+
enabled: v,
|
|
747
|
+
value: p.toString()
|
|
748
748
|
};
|
|
749
749
|
}
|
|
750
|
-
async getUserFlagValue(s,
|
|
751
|
-
var
|
|
752
|
-
const
|
|
750
|
+
async getUserFlagValue(s, p, v = null, o) {
|
|
751
|
+
var I;
|
|
752
|
+
const w = this.userContext;
|
|
753
753
|
try {
|
|
754
|
-
return await this.setUser(s), this.getFlagValue(
|
|
754
|
+
return await this.setUser(s), this.getFlagValue(p, o) ?? v;
|
|
755
755
|
} catch (O) {
|
|
756
|
-
return console.error(`Error getting user flag value for ${
|
|
756
|
+
return console.error(`Error getting user flag value for ${p}:`, O), v;
|
|
757
757
|
} finally {
|
|
758
758
|
try {
|
|
759
|
-
await ((
|
|
759
|
+
await ((I = this.flagsmithClient) == null ? void 0 : I.logout()), this.userContext = null, w && await this.setUser(w.identifier);
|
|
760
760
|
} catch (O) {
|
|
761
761
|
console.error("Error during cleanup:", O);
|
|
762
762
|
}
|
|
@@ -765,93 +765,93 @@ var Ge = ie.exports, Je = {
|
|
|
765
765
|
reset() {
|
|
766
766
|
this.flagsmithClient = null, this.userContext = null;
|
|
767
767
|
}
|
|
768
|
-
}, Et(Y, "instance"), Y),
|
|
769
|
-
function
|
|
770
|
-
const s = () =>
|
|
771
|
-
if (
|
|
768
|
+
}, Et(Y, "instance"), Y), qe = ze.getInstance(), Ct = Z(!1), It = Z([]), dt = Z(null);
|
|
769
|
+
function $e(f = qe) {
|
|
770
|
+
const s = () => Ct.value ? !0 : (console.warn("FeatureFlag is not initialized. Using default values."), !1), p = async (g, m = []) => {
|
|
771
|
+
if (Ct.value) {
|
|
772
772
|
console.warn("FeatureFlag is already initialized.");
|
|
773
773
|
return;
|
|
774
774
|
}
|
|
775
775
|
try {
|
|
776
|
-
await f.init(
|
|
777
|
-
} catch (
|
|
778
|
-
console.error("Failed to initialize feature flags:",
|
|
776
|
+
await f.init(g, m), It.value = await f.getFlags(), Ct.value = !0, dt.value = null;
|
|
777
|
+
} catch (E) {
|
|
778
|
+
console.error("Failed to initialize feature flags:", E), dt.value = E;
|
|
779
779
|
}
|
|
780
|
-
},
|
|
780
|
+
}, v = async (g) => {
|
|
781
781
|
if (s())
|
|
782
782
|
try {
|
|
783
|
-
await f.setUser(
|
|
784
|
-
} catch (
|
|
785
|
-
console.error("Failed to set user:",
|
|
783
|
+
await f.setUser(g), It.value = await f.getFlags(), dt.value = null;
|
|
784
|
+
} catch (m) {
|
|
785
|
+
console.error("Failed to set user:", m), dt.value = m;
|
|
786
786
|
}
|
|
787
|
-
}, o = async (
|
|
788
|
-
if (!s()) return
|
|
787
|
+
}, o = async (g) => v(`${_e}-${g}`), w = (g, m, E = null) => {
|
|
788
|
+
if (!s()) return E;
|
|
789
789
|
try {
|
|
790
|
-
return f.getFlagValue(
|
|
790
|
+
return f.getFlagValue(g, m) ?? E;
|
|
791
791
|
} catch (D) {
|
|
792
|
-
return console.error(`Error getting flag value for ${
|
|
792
|
+
return console.error(`Error getting flag value for ${g}:`, D), E;
|
|
793
793
|
}
|
|
794
|
-
},
|
|
795
|
-
if (!s()) return
|
|
794
|
+
}, I = (g, m) => {
|
|
795
|
+
if (!s()) return m ?? null;
|
|
796
796
|
try {
|
|
797
|
-
return f.getFlag(
|
|
798
|
-
} catch (
|
|
799
|
-
return console.error(`Error getting flag for ${
|
|
797
|
+
return f.getFlag(g) ?? m ?? null;
|
|
798
|
+
} catch (E) {
|
|
799
|
+
return console.error(`Error getting flag for ${g}:`, E), m ?? null;
|
|
800
800
|
}
|
|
801
|
-
}, O = async (
|
|
802
|
-
if (!s()) return
|
|
801
|
+
}, O = async (g, m, E = null, D) => {
|
|
802
|
+
if (!s()) return E;
|
|
803
803
|
try {
|
|
804
|
-
return await f.getUserFlagValue(
|
|
805
|
-
} catch (
|
|
806
|
-
return console.error(`Error getting user flag value for ${
|
|
804
|
+
return await f.getUserFlagValue(g, m, E, D);
|
|
805
|
+
} catch (it) {
|
|
806
|
+
return console.error(`Error getting user flag value for ${m}:`, it), E;
|
|
807
807
|
}
|
|
808
|
-
},
|
|
808
|
+
}, W = async (g, m, E = null, D) => O(`${_e}-${g}`, m, E, D), F = () => {
|
|
809
809
|
try {
|
|
810
810
|
f.reset();
|
|
811
|
-
} catch (
|
|
812
|
-
console.error("Error resetting feature flags:",
|
|
811
|
+
} catch (g) {
|
|
812
|
+
console.error("Error resetting feature flags:", g);
|
|
813
813
|
} finally {
|
|
814
|
-
It.value = [],
|
|
814
|
+
It.value = [], Ct.value = !1, dt.value = null;
|
|
815
815
|
}
|
|
816
816
|
};
|
|
817
817
|
return {
|
|
818
|
-
flags:
|
|
819
|
-
isInitialized:
|
|
820
|
-
error:
|
|
821
|
-
init:
|
|
822
|
-
setUser:
|
|
818
|
+
flags: ee(It),
|
|
819
|
+
isInitialized: ee(Ct),
|
|
820
|
+
error: ee(dt),
|
|
821
|
+
init: p,
|
|
822
|
+
setUser: v,
|
|
823
823
|
setBusiness: o,
|
|
824
|
-
getFlagValue:
|
|
825
|
-
getFlag:
|
|
824
|
+
getFlagValue: w,
|
|
825
|
+
getFlag: I,
|
|
826
826
|
getUserFlagValue: O,
|
|
827
|
-
getBusinessFlagValue:
|
|
827
|
+
getBusinessFlagValue: W,
|
|
828
828
|
reset: F
|
|
829
829
|
};
|
|
830
830
|
}
|
|
831
|
-
var
|
|
832
|
-
const
|
|
831
|
+
var Oe = () => $e();
|
|
832
|
+
const Fe = {
|
|
833
833
|
dev: "MaGoXrEWuEJNpWgKTqseee",
|
|
834
834
|
prod: "6GhcttsJ9Rj9cTevcdrpin"
|
|
835
|
-
},
|
|
835
|
+
}, He = "order_miniprogram_v2", xe = 1e4, _t = Z("pending");
|
|
836
836
|
let Lt = null;
|
|
837
|
-
function
|
|
837
|
+
function Ye(f) {
|
|
838
838
|
if (Lt) return Lt;
|
|
839
|
-
const { init: s } =
|
|
840
|
-
let
|
|
839
|
+
const { init: s } = Oe(), p = f === "prod" ? Fe.prod : Fe.dev;
|
|
840
|
+
let v;
|
|
841
841
|
return Lt = Promise.race([
|
|
842
|
-
s({ apiKey:
|
|
843
|
-
new Promise((o,
|
|
844
|
-
|
|
842
|
+
s({ apiKey: p }),
|
|
843
|
+
new Promise((o, w) => {
|
|
844
|
+
v = setTimeout(() => w(new Error(`Flagsmith init exceeded ${xe}ms`)), xe);
|
|
845
845
|
})
|
|
846
846
|
]).then(() => {
|
|
847
|
-
|
|
847
|
+
_t.value = "ready";
|
|
848
848
|
}).catch((o) => {
|
|
849
|
-
|
|
849
|
+
_t.value = "failed", console.warn("[FeatureFlag] init failed:", o);
|
|
850
850
|
}).finally(() => {
|
|
851
|
-
clearTimeout(
|
|
851
|
+
clearTimeout(v);
|
|
852
852
|
}), Lt;
|
|
853
853
|
}
|
|
854
|
-
function
|
|
854
|
+
function Xe(f) {
|
|
855
855
|
try {
|
|
856
856
|
const s = typeof f == "string" ? JSON.parse(f) : f;
|
|
857
857
|
return s === !0 || s === "true" || (s == null ? void 0 : s.enabled) === !0 || (s == null ? void 0 : s.enabled) === "true";
|
|
@@ -859,254 +859,264 @@ function He(f) {
|
|
|
859
859
|
return f === !0 || f === "true";
|
|
860
860
|
}
|
|
861
861
|
}
|
|
862
|
-
function
|
|
863
|
-
const
|
|
862
|
+
function Qe(f, s, p) {
|
|
863
|
+
const v = we(), { getBusinessFlagValue: o } = Oe(), w = Z(s), I = Z(!0);
|
|
864
864
|
let O = 0;
|
|
865
|
-
async function
|
|
866
|
-
var
|
|
867
|
-
const F = ++O,
|
|
868
|
-
if (!
|
|
869
|
-
|
|
865
|
+
async function W() {
|
|
866
|
+
var m;
|
|
867
|
+
const F = ++O, g = (m = v.currentBusiness.value) == null ? void 0 : m._id;
|
|
868
|
+
if (!g || _t.value === "failed") {
|
|
869
|
+
w.value = s, I.value = !1;
|
|
870
870
|
return;
|
|
871
871
|
}
|
|
872
|
-
if (
|
|
873
|
-
|
|
872
|
+
if (_t.value === "pending") {
|
|
873
|
+
I.value = !0;
|
|
874
874
|
return;
|
|
875
875
|
}
|
|
876
|
-
|
|
876
|
+
I.value = !0;
|
|
877
877
|
try {
|
|
878
|
-
const
|
|
878
|
+
const E = await o(g, f, s);
|
|
879
879
|
if (F !== O) return;
|
|
880
|
-
|
|
880
|
+
w.value = p ? p(E) : E;
|
|
881
881
|
} catch {
|
|
882
882
|
if (F !== O) return;
|
|
883
|
-
|
|
883
|
+
w.value = s;
|
|
884
884
|
} finally {
|
|
885
|
-
F === O && (
|
|
885
|
+
F === O && (I.value = !1);
|
|
886
886
|
}
|
|
887
887
|
}
|
|
888
|
-
return
|
|
888
|
+
return Ee([() => {
|
|
889
889
|
var F;
|
|
890
|
-
return (F =
|
|
891
|
-
},
|
|
890
|
+
return (F = v.currentBusiness.value) == null ? void 0 : F._id;
|
|
891
|
+
}, _t], W, { immediate: !0 }), { value: w, loading: I };
|
|
892
892
|
}
|
|
893
|
-
function
|
|
894
|
-
const { value: f, loading: s } =
|
|
893
|
+
function Ze() {
|
|
894
|
+
const { value: f, loading: s } = Qe(He, !1, Xe);
|
|
895
895
|
return { enabled: f, loading: s };
|
|
896
896
|
}
|
|
897
|
-
const
|
|
898
|
-
function
|
|
897
|
+
const We = "templatePicker";
|
|
898
|
+
function tn() {
|
|
899
899
|
if (typeof window > "u") return !1;
|
|
900
900
|
try {
|
|
901
|
-
const f = new URLSearchParams(window.location.search).get(
|
|
901
|
+
const f = new URLSearchParams(window.location.search).get(We);
|
|
902
902
|
return f !== null && f !== "0" && f !== "false";
|
|
903
903
|
} catch {
|
|
904
904
|
return !1;
|
|
905
905
|
}
|
|
906
906
|
}
|
|
907
|
-
const
|
|
907
|
+
const en = {
|
|
908
908
|
key: 0,
|
|
909
909
|
class: "portal-sidebar",
|
|
910
910
|
"aria-label": "Mini Program navigation"
|
|
911
|
-
},
|
|
911
|
+
}, nn = ["aria-expanded", "aria-label"], an = {
|
|
912
912
|
id: "miniprogram-navigation",
|
|
913
913
|
class: "portal-nav"
|
|
914
|
-
},
|
|
914
|
+
}, rn = { class: "portal-nav-label" }, on = { class: "portal-nav-label" }, ln = { class: "portal-main" }, sn = {
|
|
915
915
|
key: 0,
|
|
916
916
|
class: "portal-breadcrumb",
|
|
917
917
|
"aria-label": "Breadcrumb"
|
|
918
|
-
},
|
|
918
|
+
}, un = {
|
|
919
919
|
id: "miniprogram-content",
|
|
920
920
|
class: "portal-content",
|
|
921
921
|
tabindex: "-1"
|
|
922
|
-
},
|
|
922
|
+
}, cn = {
|
|
923
923
|
key: 0,
|
|
924
924
|
class: "portal-empty"
|
|
925
|
-
},
|
|
925
|
+
}, dn = {
|
|
926
926
|
key: 1,
|
|
927
927
|
class: "portal-loading",
|
|
928
928
|
role: "status"
|
|
929
|
-
},
|
|
929
|
+
}, vn = {
|
|
930
930
|
key: 2,
|
|
931
931
|
class: "portal-empty"
|
|
932
|
-
},
|
|
932
|
+
}, gn = {
|
|
933
933
|
key: 3,
|
|
934
934
|
class: "portal-empty",
|
|
935
935
|
role: "alert"
|
|
936
|
-
},
|
|
936
|
+
}, hn = /* @__PURE__ */ Pe({
|
|
937
937
|
__name: "App",
|
|
938
938
|
setup(f) {
|
|
939
|
-
const s = Re(),
|
|
940
|
-
|
|
941
|
-
|
|
939
|
+
const s = Re(), p = Ue(), v = we(), o = De(), w = Z(!1);
|
|
940
|
+
Ee(o.businessId, async (V, h) => {
|
|
941
|
+
const N = Ge(s, h, V);
|
|
942
|
+
if (N) {
|
|
943
|
+
w.value = !0;
|
|
944
|
+
try {
|
|
945
|
+
await p.replace(N);
|
|
946
|
+
} finally {
|
|
947
|
+
w.value = !1;
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
}), Ye(v.namespace.value);
|
|
951
|
+
const I = Ze(), O = St(() => s.name === "miniprogram-v2-project"), W = St(() => I.loading.value || I.enabled.value), F = Z(
|
|
942
952
|
be(
|
|
943
953
|
"mpv2:portal-collapsed",
|
|
944
954
|
typeof window < "u" && window.matchMedia("(max-width: 1000px)").matches
|
|
945
955
|
)
|
|
946
|
-
),
|
|
956
|
+
), g = Z(be("mpv2:editor-collapsed", !0)), m = St(() => O.value ? g.value : F.value), E = St(
|
|
947
957
|
() => {
|
|
948
|
-
var
|
|
949
|
-
return
|
|
958
|
+
var V;
|
|
959
|
+
return O.value ? (V = o.context.value) == null ? void 0 : V.project.name : String(s.meta.title ?? "Ecosystem");
|
|
950
960
|
}
|
|
951
|
-
),
|
|
961
|
+
), D = [
|
|
952
962
|
{ name: "miniprogram-v2-ecosystem", label: "Ecosystem", icon: "ecosystem" },
|
|
953
963
|
{ name: "miniprogram-v2-brand-kit", label: "Brand Kit", icon: "brand" },
|
|
954
964
|
{ name: "miniprogram-v2-pages", label: "Pages", icon: "pages" }
|
|
955
|
-
],
|
|
956
|
-
let
|
|
965
|
+
], it = St(() => ({ name: "miniprogram-v2-mobile-projects", query: ct(s.query) })), vt = Me(), gt = tn();
|
|
966
|
+
let A = !1;
|
|
957
967
|
Te(() => {
|
|
958
|
-
|
|
968
|
+
A = v.hideSidebar.value, v.hideSidebar.value = !0;
|
|
959
969
|
}), Ne(() => {
|
|
960
|
-
|
|
970
|
+
v.hideSidebar.value = A;
|
|
961
971
|
});
|
|
962
|
-
function
|
|
963
|
-
|
|
972
|
+
function At() {
|
|
973
|
+
O.value ? (g.value = !g.value, Ce("mpv2:editor-collapsed", g.value)) : (F.value = !F.value, Ce("mpv2:portal-collapsed", F.value));
|
|
964
974
|
}
|
|
965
|
-
return (
|
|
966
|
-
const
|
|
967
|
-
return
|
|
968
|
-
|
|
975
|
+
return (V, h) => {
|
|
976
|
+
const N = wt("RouterLink"), ht = wt("FmIcon"), Ft = wt("FmCircularProgress"), kt = wt("FmButton");
|
|
977
|
+
return J(), Q(ne, null, [
|
|
978
|
+
h[14] || (h[14] = C("link", {
|
|
969
979
|
href: "https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@24,400,0..1,0",
|
|
970
980
|
rel: "stylesheet"
|
|
971
981
|
}, null, -1)),
|
|
972
|
-
|
|
973
|
-
class:
|
|
982
|
+
C("div", {
|
|
983
|
+
class: ie(["mpv2-app portal-shell", { "portal-shell--collapsed": m.value }])
|
|
974
984
|
}, [
|
|
975
|
-
|
|
985
|
+
h[13] || (h[13] = C("a", {
|
|
976
986
|
class: "portal-skip",
|
|
977
987
|
href: "#miniprogram-content"
|
|
978
988
|
}, "Skip to content", -1)),
|
|
979
|
-
|
|
980
|
-
|
|
989
|
+
W.value ? (J(), Q("aside", en, [
|
|
990
|
+
C("button", {
|
|
981
991
|
class: "portal-sidebar-toggle",
|
|
982
992
|
type: "button",
|
|
983
|
-
"aria-expanded": !
|
|
993
|
+
"aria-expanded": !m.value,
|
|
984
994
|
"aria-controls": "miniprogram-navigation",
|
|
985
|
-
"aria-label":
|
|
986
|
-
onClick:
|
|
995
|
+
"aria-label": m.value ? "Expand navigation" : "Collapse navigation",
|
|
996
|
+
onClick: At
|
|
987
997
|
}, [
|
|
988
998
|
T(bt, { name: "collapse" }),
|
|
989
|
-
|
|
990
|
-
], 8,
|
|
991
|
-
|
|
992
|
-
(
|
|
999
|
+
h[0] || (h[0] = C("span", { class: "portal-nav-label" }, "Mini Program", -1))
|
|
1000
|
+
], 8, nn),
|
|
1001
|
+
C("nav", an, [
|
|
1002
|
+
(J(), Q(ne, null, ye(D, (L) => T(N, {
|
|
993
1003
|
key: L.name,
|
|
994
|
-
to: { name: L.name, query:
|
|
1004
|
+
to: { name: L.name, query: _(ct)(_(s).query) },
|
|
995
1005
|
class: "portal-nav-item",
|
|
996
1006
|
title: L.label,
|
|
997
1007
|
"aria-label": L.label,
|
|
998
|
-
"aria-current":
|
|
1008
|
+
"aria-current": _(s).name === L.name ? "page" : void 0
|
|
999
1009
|
}, {
|
|
1000
1010
|
default: st(() => [
|
|
1001
1011
|
T(bt, {
|
|
1002
1012
|
name: L.icon
|
|
1003
1013
|
}, null, 8, ["name"]),
|
|
1004
|
-
|
|
1014
|
+
C("span", rn, ut(L.label), 1)
|
|
1005
1015
|
]),
|
|
1006
1016
|
_: 2
|
|
1007
1017
|
}, 1032, ["to", "title", "aria-label", "aria-current"])), 64)),
|
|
1008
|
-
|
|
1009
|
-
T(
|
|
1010
|
-
to:
|
|
1011
|
-
class:
|
|
1018
|
+
h[4] || (h[4] = C("p", { class: "portal-nav-caption" }, "Platforms", -1)),
|
|
1019
|
+
T(N, {
|
|
1020
|
+
to: it.value,
|
|
1021
|
+
class: ie(["portal-nav-item", { "router-link-active": O.value }]),
|
|
1012
1022
|
title: "Mobile Ordering",
|
|
1013
1023
|
"aria-label": "Mobile Ordering",
|
|
1014
|
-
"aria-current":
|
|
1024
|
+
"aria-current": O.value ? "page" : void 0
|
|
1015
1025
|
}, {
|
|
1016
1026
|
default: st(() => [
|
|
1017
1027
|
T(bt, { name: "mobile" }),
|
|
1018
|
-
|
|
1028
|
+
h[1] || (h[1] = C("span", { class: "portal-nav-label" }, "Mobile Ordering", -1))
|
|
1019
1029
|
]),
|
|
1020
1030
|
_: 1
|
|
1021
1031
|
}, 8, ["to", "class", "aria-current"]),
|
|
1022
|
-
(
|
|
1032
|
+
(J(), Q(ne, null, ye(["tablet", "kiosk"], (L) => T(N, {
|
|
1023
1033
|
key: L,
|
|
1024
|
-
to: { name: `miniprogram-v2-${L}`, query:
|
|
1034
|
+
to: { name: `miniprogram-v2-${L}`, query: _(ct)(_(s).query) },
|
|
1025
1035
|
class: "portal-nav-item",
|
|
1026
1036
|
title: L === "tablet" ? "Tablet" : "Kiosk",
|
|
1027
1037
|
"aria-label": L === "tablet" ? "Tablet" : "Kiosk"
|
|
1028
1038
|
}, {
|
|
1029
1039
|
default: st(() => [
|
|
1030
1040
|
T(bt, { name: L }, null, 8, ["name"]),
|
|
1031
|
-
|
|
1041
|
+
C("span", on, ut(L === "tablet" ? "Tablet" : "Kiosk"), 1)
|
|
1032
1042
|
]),
|
|
1033
1043
|
_: 2
|
|
1034
1044
|
}, 1032, ["to", "title", "aria-label"])), 64)),
|
|
1035
|
-
|
|
1036
|
-
T(
|
|
1037
|
-
to: { name: "miniprogram-v2-module-center", query:
|
|
1038
|
-
class:
|
|
1045
|
+
h[5] || (h[5] = C("div", { class: "portal-nav-divider" }, null, -1)),
|
|
1046
|
+
T(N, {
|
|
1047
|
+
to: { name: "miniprogram-v2-module-center", query: _(ct)(_(s).query) },
|
|
1048
|
+
class: ie(["portal-nav-item", { "router-link-active": _(s).name === "miniprogram-v2-module-detail" }]),
|
|
1039
1049
|
title: "Module library",
|
|
1040
1050
|
"aria-label": "Module library"
|
|
1041
1051
|
}, {
|
|
1042
1052
|
default: st(() => [
|
|
1043
|
-
T(
|
|
1053
|
+
T(ht, {
|
|
1044
1054
|
name: "widgets",
|
|
1045
1055
|
size: "md"
|
|
1046
1056
|
}),
|
|
1047
|
-
|
|
1057
|
+
h[2] || (h[2] = C("span", { class: "portal-nav-label" }, "Module library", -1))
|
|
1048
1058
|
]),
|
|
1049
1059
|
_: 1
|
|
1050
1060
|
}, 8, ["to", "class"]),
|
|
1051
|
-
|
|
1061
|
+
_(vt) && _(gt) ? (J(), Se(N, {
|
|
1052
1062
|
key: 0,
|
|
1053
|
-
to: { name: "miniprogram-v2-template-center", query:
|
|
1063
|
+
to: { name: "miniprogram-v2-template-center", query: _(ct)(_(s).query) },
|
|
1054
1064
|
class: "portal-nav-item",
|
|
1055
1065
|
title: "Template library",
|
|
1056
1066
|
"aria-label": "Template library"
|
|
1057
1067
|
}, {
|
|
1058
1068
|
default: st(() => [
|
|
1059
|
-
T(
|
|
1069
|
+
T(ht, {
|
|
1060
1070
|
name: "dashboard_customize",
|
|
1061
1071
|
size: "md"
|
|
1062
1072
|
}),
|
|
1063
|
-
|
|
1073
|
+
h[3] || (h[3] = C("span", { class: "portal-nav-label" }, "Template library", -1))
|
|
1064
1074
|
]),
|
|
1065
1075
|
_: 1
|
|
1066
|
-
}, 8, ["to"])) :
|
|
1076
|
+
}, 8, ["to"])) : ae("", !0)
|
|
1067
1077
|
]),
|
|
1068
|
-
T(
|
|
1069
|
-
to: { name: "miniprogram-v2-settings", query:
|
|
1078
|
+
T(N, {
|
|
1079
|
+
to: { name: "miniprogram-v2-settings", query: _(ct)(_(s).query) },
|
|
1070
1080
|
class: "portal-nav-item portal-settings-link",
|
|
1071
1081
|
title: "Settings",
|
|
1072
1082
|
"aria-label": "Settings"
|
|
1073
1083
|
}, {
|
|
1074
1084
|
default: st(() => [
|
|
1075
1085
|
T(bt, { name: "settings" }),
|
|
1076
|
-
|
|
1086
|
+
h[6] || (h[6] = C("span", { class: "portal-nav-label" }, "Settings", -1))
|
|
1077
1087
|
]),
|
|
1078
1088
|
_: 1
|
|
1079
1089
|
}, 8, ["to"])
|
|
1080
|
-
])) :
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1090
|
+
])) : ae("", !0),
|
|
1091
|
+
C("div", ln, [
|
|
1092
|
+
O.value ? ae("", !0) : (J(), Q("header", sn, [
|
|
1093
|
+
C("span", null, ut(_(o).businessName.value), 1),
|
|
1094
|
+
h[7] || (h[7] = C("span", { "aria-hidden": "true" }, "/", -1)),
|
|
1095
|
+
C("span", null, ut(E.value), 1),
|
|
1096
|
+
h[8] || (h[8] = C("div", {
|
|
1087
1097
|
id: "portal-page-actions",
|
|
1088
1098
|
class: "portal-page-actions"
|
|
1089
1099
|
}, null, -1))
|
|
1090
1100
|
])),
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
T(
|
|
1094
|
-
|
|
1095
|
-
])) :
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
T(
|
|
1101
|
+
C("div", un, [
|
|
1102
|
+
_(o).businessId.value ? _(o).loading.value || _(I).loading.value || w.value ? (J(), Q("div", dn, [
|
|
1103
|
+
T(Ft, { size: "xl" }),
|
|
1104
|
+
h[10] || (h[10] = C("span", null, "Loading your Mini Program…", -1))
|
|
1105
|
+
])) : _(I).enabled.value ? _(o).error.value ? (J(), Q("section", gn, [
|
|
1106
|
+
h[12] || (h[12] = C("h1", null, "Could not open this Mini Program", -1)),
|
|
1107
|
+
C("p", null, ut(_(o).error.value), 1),
|
|
1108
|
+
T(kt, {
|
|
1099
1109
|
label: "Try again",
|
|
1100
|
-
onClick:
|
|
1110
|
+
onClick: _(o).refresh
|
|
1101
1111
|
}, null, 8, ["onClick"])
|
|
1102
|
-
])) : (
|
|
1103
|
-
key: `${
|
|
1104
|
-
})) : (
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
])) : (
|
|
1108
|
-
|
|
1109
|
-
|
|
1112
|
+
])) : (J(), Se(_(Ke), {
|
|
1113
|
+
key: `${_(o).businessId.value}:${_(s).params.projectId ?? String(_(s).name)}`
|
|
1114
|
+
})) : (J(), Q("section", vn, [
|
|
1115
|
+
h[11] || (h[11] = C("h1", null, "Mini Program is not available for this business", -1)),
|
|
1116
|
+
C("p", null, " It is still rolling out. Your FeedMe contact can enable it for " + ut(_(o).businessName.value) + ". ", 1)
|
|
1117
|
+
])) : (J(), Q("section", cn, [...h[9] || (h[9] = [
|
|
1118
|
+
C("h1", null, "Select a business", -1),
|
|
1119
|
+
C("p", null, "Choose a business in the Portal header to open its Mini Program.", -1)
|
|
1110
1120
|
])]))
|
|
1111
1121
|
])
|
|
1112
1122
|
])
|
|
@@ -1114,7 +1124,7 @@ const We = {
|
|
|
1114
1124
|
], 64);
|
|
1115
1125
|
};
|
|
1116
1126
|
}
|
|
1117
|
-
}),
|
|
1127
|
+
}), En = /* @__PURE__ */ Be(hn, [["__scopeId", "data-v-37c75dd1"]]);
|
|
1118
1128
|
export {
|
|
1119
|
-
|
|
1129
|
+
En as default
|
|
1120
1130
|
};
|