@feedmepos/mf-miniprogram-v2 0.2.8-dev.2 → 0.2.8-dev.20
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-C8Vn8LvE.js → App-dgkwfArX.js} +337 -338
- package/dist/{BrandFontPicker-JHyoGusq.js → BrandFontPicker-CF3O3meB.js} +1 -1
- package/dist/BrandKitView-CdLMBZKd.js +276 -0
- package/dist/ControlPlaneView-fc2wIqfk.js +27162 -0
- package/dist/{EcosystemView-XP9IZ9wn.js → EcosystemView-DHtS5IDN.js} +115 -93
- package/dist/MobileProjectDialog-Bt6r-bHC.js +446 -0
- package/dist/MobileProjectsView-Dvj7YKlO.js +237 -0
- package/dist/ModuleCenterView-t8rhd419.js +283 -0
- package/dist/ModuleDetailView-CcqJ4Hfu.js +296 -0
- package/dist/{PagesView-DzDqCd8N.js → PagesView-D0RMTyqw.js} +2 -2
- package/dist/{PlatformUnavailableView-CdHjkolw.js → PlatformUnavailableView-OHEJAztd.js} +1 -1
- package/dist/{PortalSettingsView-Df5jChmi.js → PortalSettingsView-B68s6fiS.js} +3 -3
- package/dist/StatusBadge.vue_vue_type_script_setup_true_lang-DMm_s9ua.js +41 -0
- package/dist/TemplateCenterView-Cpr39Y5S.js +515 -0
- package/dist/{WorkspaceEntryView-DQkYJWdf.js → WorkspaceEntryView-gM7RX5BV.js} +2 -2
- package/dist/app.js +15 -15
- package/dist/{controlPlane-sXaC6pAh.js → controlPlane-DR5ykj4d.js} +8 -8
- package/dist/{adminAccess-D2K-L-Vt.js → localPreference-Do4VKtxT.js} +35 -35
- package/dist/package.json +1 -1
- package/dist/{portalContext-DV-6uUwp.js → portalContext-BeKN8Bcx.js} +2 -2
- package/dist/portalNavigation-DLcC7Koh.js +43 -0
- package/dist/{routes-CeuodIgg.js → routes-B9oMJsaM.js} +45 -27
- package/dist/style.css +1 -1
- package/dist/{useBrandKit-CXLIXo5j.js → useBrandKit-MkgkEuIX.js} +265 -233
- package/dist/useModuleCatalog-Daw8KA--.js +147 -0
- package/package.json +1 -1
- package/dist/AppTemplatePicker.vue_vue_type_script_setup_true_lang-LE_aKvfg.js +0 -198
- package/dist/BrandKitView-Dlt_ifI0.js +0 -249
- package/dist/ControlPlaneView-qDA8RgiR.js +0 -25317
- package/dist/MobileProjectsView-aAyHV5G-.js +0 -333
- package/dist/ModuleCenterView-C6mCPATr.js +0 -147
- package/dist/ModuleDetailView-CSfMF0Uo.js +0 -189
- package/dist/StatusBadge.vue_vue_type_script_setup_true_lang-CMgQ0bd_.js +0 -30
- package/dist/TemplateCenterView-DrWImUYO.js +0 -425
- package/dist/portalNavigation-C29ihtq_.js +0 -38
- package/dist/useModuleCatalog-Cep-pzWO.js +0 -124
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var Et = (
|
|
4
|
-
import { readonly as ee, ref as
|
|
5
|
-
import { useCoreStore as
|
|
6
|
-
import { useRoute as Re, useRouter as
|
|
1
|
+
var je = Object.defineProperty;
|
|
2
|
+
var ke = (p, l, f) => l in p ? je(p, l, { enumerable: !0, configurable: !0, writable: !0, value: f }) : p[l] = f;
|
|
3
|
+
var Et = (p, l, f) => ke(p, typeof l != "symbol" ? l + "" : l, f);
|
|
4
|
+
import { readonly as ee, ref as V, watch as we, defineComponent as Te, computed as st, onMounted as Pe, onBeforeUnmount as Ne, resolveComponent as wt, openBlock as J, createElementBlock as Z, Fragment as ne, createElementVNode as C, normalizeClass as ie, createVNode as P, renderList as be, unref as F, withCtx as ut, toDisplayString as ct, createBlock as Se, createCommentVNode as ae } from "vue";
|
|
5
|
+
import { useCoreStore as oe } from "@feedmepos/mf-common";
|
|
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
|
|
8
|
+
import { r as Ce, u as Me, w as _e } from "./localPreference-Do4VKtxT.js";
|
|
9
9
|
import { c as Ot } from "./_commonjsHelpers-DaMA6jEr.js";
|
|
10
|
-
import { p as De } from "./portalContext-
|
|
11
|
-
import { e as Ge, p as
|
|
10
|
+
import { p as De } from "./portalContext-BeKN8Bcx.js";
|
|
11
|
+
import { e as Ge, p as dt } from "./portalNavigation-DLcC7Koh.js";
|
|
12
12
|
import { _ as Be } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
13
13
|
var re = { exports: {} };
|
|
14
|
-
(function(
|
|
15
|
-
(function(
|
|
16
|
-
v(
|
|
17
|
-
})(Ot, function(
|
|
14
|
+
(function(p, l) {
|
|
15
|
+
(function(f, v) {
|
|
16
|
+
v(l);
|
|
17
|
+
})(Ot, function(f) {
|
|
18
18
|
var v = { getItemSync: function(a) {
|
|
19
19
|
try {
|
|
20
20
|
return localStorage.getItem(a) || null;
|
|
@@ -27,8 +27,8 @@ var re = { exports: {} };
|
|
|
27
27
|
try {
|
|
28
28
|
var r = t.getItemSync(a);
|
|
29
29
|
e == null || e(null, r), i(r);
|
|
30
|
-
} catch (
|
|
31
|
-
e && e(
|
|
30
|
+
} catch (s) {
|
|
31
|
+
e && e(s, null), n(s);
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
}, setItem: function(a, e, t) {
|
|
@@ -45,9 +45,9 @@ var re = { 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
|
-
function
|
|
50
|
+
function s(y) {
|
|
51
51
|
try {
|
|
52
52
|
d(i.next(y));
|
|
53
53
|
} catch (u) {
|
|
@@ -65,13 +65,13 @@ var re = { exports: {} };
|
|
|
65
65
|
var u;
|
|
66
66
|
y.done ? n(y.value) : (u = y.value, u instanceof t ? u : new t(function(b) {
|
|
67
67
|
b(u);
|
|
68
|
-
})).then(
|
|
68
|
+
})).then(s, c);
|
|
69
69
|
}
|
|
70
70
|
d((i = i.apply(a, [])).next());
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
function I(a, e) {
|
|
74
|
-
var t, i, n, r,
|
|
74
|
+
var t, i, n, r, s = { label: 0, sent: function() {
|
|
75
75
|
if (1 & n[0]) throw n[1];
|
|
76
76
|
return n[1];
|
|
77
77
|
}, trys: [], ops: [] };
|
|
@@ -82,7 +82,7 @@ var re = { exports: {} };
|
|
|
82
82
|
return function(y) {
|
|
83
83
|
return function(u) {
|
|
84
84
|
if (t) throw new TypeError("Generator is already executing.");
|
|
85
|
-
for (;
|
|
85
|
+
for (; s; ) try {
|
|
86
86
|
if (t = 1, i && (n = 2 & u[0] ? i.return : u[0] ? i.throw || ((n = i.return) && n.call(i), 0) : i.next) && !(n = n.call(i, u[1])).done) return n;
|
|
87
87
|
switch (i = 0, n && (u = [2 & u[0], n.value]), u[0]) {
|
|
88
88
|
case 0:
|
|
@@ -90,34 +90,34 @@ var re = { exports: {} };
|
|
|
90
90
|
n = u;
|
|
91
91
|
break;
|
|
92
92
|
case 4:
|
|
93
|
-
return
|
|
93
|
+
return s.label++, { value: u[1], done: !1 };
|
|
94
94
|
case 5:
|
|
95
|
-
|
|
95
|
+
s.label++, i = u[1], u = [0];
|
|
96
96
|
continue;
|
|
97
97
|
case 7:
|
|
98
|
-
u =
|
|
98
|
+
u = s.ops.pop(), s.trys.pop();
|
|
99
99
|
continue;
|
|
100
100
|
default:
|
|
101
|
-
if (n =
|
|
102
|
-
|
|
101
|
+
if (n = s.trys, !((n = n.length > 0 && n[n.length - 1]) || u[0] !== 6 && u[0] !== 2)) {
|
|
102
|
+
s = 0;
|
|
103
103
|
continue;
|
|
104
104
|
}
|
|
105
105
|
if (u[0] === 3 && (!n || u[1] > n[0] && u[1] < n[3])) {
|
|
106
|
-
|
|
106
|
+
s.label = u[1];
|
|
107
107
|
break;
|
|
108
108
|
}
|
|
109
|
-
if (u[0] === 6 &&
|
|
110
|
-
|
|
109
|
+
if (u[0] === 6 && s.label < n[1]) {
|
|
110
|
+
s.label = n[1], n = u;
|
|
111
111
|
break;
|
|
112
112
|
}
|
|
113
|
-
if (n &&
|
|
114
|
-
|
|
113
|
+
if (n && s.label < n[2]) {
|
|
114
|
+
s.label = n[2], s.ops.push(u);
|
|
115
115
|
break;
|
|
116
116
|
}
|
|
117
|
-
n[2] &&
|
|
117
|
+
n[2] && s.ops.pop(), s.trys.pop();
|
|
118
118
|
continue;
|
|
119
119
|
}
|
|
120
|
-
u = e.call(a,
|
|
120
|
+
u = e.call(a, s);
|
|
121
121
|
} catch (b) {
|
|
122
122
|
u = [6, b], i = 0;
|
|
123
123
|
} finally {
|
|
@@ -129,7 +129,7 @@ var re = { 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
|
}
|
|
@@ -149,14 +149,14 @@ var re = { exports: {} };
|
|
|
149
149
|
if ((i = (r = Object.keys(e)).length) !== Object.keys(t).length) return !1;
|
|
150
150
|
for (n = i; n-- != 0; ) if (!Object.prototype.hasOwnProperty.call(t, r[n])) return !1;
|
|
151
151
|
for (n = i; n-- != 0; ) {
|
|
152
|
-
var
|
|
153
|
-
if (!a(e[
|
|
152
|
+
var s = r[n];
|
|
153
|
+
if (!a(e[s], t[s])) return !1;
|
|
154
154
|
}
|
|
155
155
|
return !0;
|
|
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
162
|
return !W(n, r);
|
|
@@ -166,7 +166,7 @@ var re = { exports: {} };
|
|
|
166
166
|
}), Object.keys(t).length ? t : null;
|
|
167
167
|
}
|
|
168
168
|
var g, m;
|
|
169
|
-
function
|
|
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
|
}
|
|
@@ -179,49 +179,49 @@ var re = { exports: {} };
|
|
|
179
179
|
return [t, D(i) ? i : { value: i }];
|
|
180
180
|
}));
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function gt(a) {
|
|
183
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
187
|
})(g || (g = {}));
|
|
188
|
-
var
|
|
188
|
+
var ht, A = null, At = "FLAGSMITH_EVENT", q = 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
|
-
var
|
|
195
|
-
var y, u, b,
|
|
196
|
-
if (d &&
|
|
194
|
+
var s = "".concat(t.getContext().identity), c = function(d) {
|
|
195
|
+
var y, u, b, j;
|
|
196
|
+
if (d && s === "".concat(t.getContext().identity)) {
|
|
197
197
|
var z = d.flags, R = d.traits, G = d.identifier;
|
|
198
198
|
t.isLoading = !1;
|
|
199
|
-
var
|
|
199
|
+
var K = {}, U = {};
|
|
200
200
|
R = R || [], (z = z || []).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(
|
|
205
|
+
var $ = 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: $, 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 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) }),
|
|
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
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
|
}
|
|
@@ -251,8 +251,8 @@ var re = { exports: {} };
|
|
|
251
251
|
t.log("Exception fetching evaluationEvent", n);
|
|
252
252
|
}) : void 0;
|
|
253
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
|
-
var
|
|
255
|
-
if (
|
|
254
|
+
var s = t.flags && t.flags[i.toLowerCase().replace(/ /g, "_")], c = null;
|
|
255
|
+
if (s && (c = s.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 {
|
|
257
257
|
return c === null ? (t.log("Tried to parse null flag as JSON: " + i), null) : JSON.parse(c);
|
|
258
258
|
} catch {
|
|
@@ -265,11 +265,11 @@ var re = { exports: {} };
|
|
|
265
265
|
}, this.getAllTraits = function() {
|
|
266
266
|
var i;
|
|
267
267
|
return Object.fromEntries(Object.entries(((i = t.evaluationContext.identity) === null || i === void 0 ? void 0 : i.traits) || {}).map(function(n) {
|
|
268
|
-
var r = n[0],
|
|
269
|
-
return [r,
|
|
268
|
+
var r = n[0], s = n[1];
|
|
269
|
+
return [r, s == null ? void 0 : s.value];
|
|
270
270
|
}));
|
|
271
271
|
}, this.setContext = function(i) {
|
|
272
|
-
var n =
|
|
272
|
+
var n = gt(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;
|
|
@@ -281,139 +281,139 @@ var re = { exports: {} };
|
|
|
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) {
|
|
284
|
-
var
|
|
285
|
-
return [
|
|
284
|
+
var s = r[0], c = r[1];
|
|
285
|
+
return [s, D(c) ? c : { value: c }];
|
|
286
286
|
}))) }) }));
|
|
287
287
|
console.error("Attempted to setTraits a user before calling flagsmith.init. Call flagsmith.init first, if you wish to prevent it sending a request for flags, call init with preventFetch:true.");
|
|
288
288
|
}, this.hasFeature = function(i, n) {
|
|
289
|
-
var r = typeof n == "object",
|
|
290
|
-
return !
|
|
289
|
+
var r = typeof n == "object", s = t.flags && t.flags[i.toLowerCase().replace(/ /g, "_")], c = !1;
|
|
290
|
+
return !s && r && n.fallback !== void 0 ? c = n == null ? void 0 : n.fallback : s && s.enabled && (c = !0), (r && !n.skipAnalytics || !n) && t.evaluateFlag(i, "ENABLED"), c;
|
|
291
291
|
}, this.getStorageKey = function() {
|
|
292
292
|
var i, n;
|
|
293
293
|
return ((i = t.cacheOptions) === null || i === void 0 ? void 0 : i.storageKey) || "FLAGSMITH_DB_" + ((n = t.evaluationContext.environment) === null || n === void 0 ? void 0 : n.apiKey);
|
|
294
294
|
}, this.getJSON = function(i, n, r) {
|
|
295
|
-
var
|
|
295
|
+
var s, c = t;
|
|
296
296
|
c.evaluationContext;
|
|
297
297
|
var d = c.headers, y = { method: n || "GET", body: r, cache: "no-cache", headers: {} };
|
|
298
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
|
-
var u = "".concat((
|
|
299
|
+
var u = "".concat((s = t.evaluationContext.identity) === null || s === void 0 ? void 0 : s.identifier);
|
|
300
300
|
return m(i, y).then(function(b) {
|
|
301
|
-
var
|
|
301
|
+
var j, z, R = "".concat((j = t.evaluationContext.identity) === null || j === void 0 ? void 0 : j.identifier);
|
|
302
302
|
if (u === R) {
|
|
303
303
|
var G = (z = b.headers) === null || z === void 0 ? void 0 : z.get("x-flagsmith-document-updated-at");
|
|
304
304
|
if (G) try {
|
|
305
|
-
var
|
|
306
|
-
if (isNaN(
|
|
307
|
-
t.timestamp =
|
|
308
|
-
} catch (
|
|
309
|
-
t.log(
|
|
305
|
+
var K = parseFloat(G);
|
|
306
|
+
if (isNaN(K)) return Promise.reject("Failed to parse x-flagsmith-document-updated-at");
|
|
307
|
+
t.timestamp = K;
|
|
308
|
+
} catch (U) {
|
|
309
|
+
t.log(U, "Failed to parse x-flagsmith-document-updated-at", G);
|
|
310
310
|
}
|
|
311
|
-
return t.log("Fetch response: " + b.status + " " + (n || "GET") + 0 + i), b.text().then(function(
|
|
312
|
-
var
|
|
311
|
+
return t.log("Fetch response: " + b.status + " " + (n || "GET") + 0 + i), b.text().then(function(U) {
|
|
312
|
+
var $ = U;
|
|
313
313
|
try {
|
|
314
|
-
|
|
314
|
+
$ = JSON.parse(U);
|
|
315
315
|
} catch {
|
|
316
316
|
}
|
|
317
|
-
return
|
|
317
|
+
return !$ && b.status && ($ = "API Response: ".concat(b.status)), b.status && b.status >= 200 && b.status < 300 ? $ : Promise.reject(new Error($));
|
|
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(N + i, t.getValue(i, {}, !0)) : 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
|
}
|
|
327
327
|
t.updateEventStorage();
|
|
328
328
|
}, this._onChange = function(i, n, r) {
|
|
329
|
-
var
|
|
330
|
-
t.setLoadingState(r), (
|
|
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 && (
|
|
329
|
+
var s, c;
|
|
330
|
+
t.setLoadingState(r), (s = t.onChange) === null || s === void 0 || s.call(t, i, n, t.loadingState), (c = t._trigger) === null || c === void 0 || c.call(t);
|
|
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 && (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,
|
|
335
|
+
return O(this, void 0, void 0, function() {
|
|
336
|
+
var r, s, c, d, y, u, b, j, z, R, G, K, U, $, pt, mt, at, k, S, Tt, yt, ve, rt, Pt, ge, he, Nt, fe, Rt, bt, ot, pe, T = this;
|
|
337
337
|
return I(this, function(B) {
|
|
338
338
|
switch (B.label) {
|
|
339
339
|
case 0:
|
|
340
|
-
r =
|
|
340
|
+
r = gt(e.evaluationContext || this.evaluationContext), B.label = 1;
|
|
341
341
|
case 1:
|
|
342
|
-
if (B.trys.push([1, 13, , 14]),
|
|
343
|
-
if (r.identity =
|
|
342
|
+
if (B.trys.push([1, 13, , 14]), s = e.environmentID, c = e.api, d = c === void 0 ? h : c, y = e.headers, u = e.onChange, b = e.cacheFlags, j = e.datadogRum, z = e.onError, R = e.defaultFlags, G = e.fetch, K = e.preventFetch, U = e.enableLogs, $ = 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, ve = e.state, rt = e.cacheOptions, Pt = e.angularHttpClient, ge = e._trigger, he = e._triggerLoadingState, r.environment = s ? { apiKey: s } : r.environment, !r.environment || !r.environment.apiKey) throw new Error("Please provide `evaluationContext.environment` with non-empty `apiKey`");
|
|
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, Nt = "Wrong Flagsmith Configuration: preventFetch is true and no defaulFlags provided", this._trigger =
|
|
346
|
-
|
|
347
|
-
}, this.enableLogs =
|
|
348
|
-
return function(
|
|
349
|
-
var tt =
|
|
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 = ge || this._trigger, this._triggerLoadingState = he || this._triggerLoadingState, this.onError = function(M) {
|
|
346
|
+
T.setLoadingState(o(o({}, T.loadingState), { isFetching: !1, isLoading: !1, error: M })), z == null || z(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 && (m = 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, q = "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(ve), this.log("Initialising with properties", e, this), $ && (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 && (m = /* @__PURE__ */ function(M) {
|
|
348
|
+
return function(H, X) {
|
|
349
|
+
var tt = X.headers, x = X.method, lt = X.body;
|
|
350
350
|
return new Promise(function(nt) {
|
|
351
351
|
switch (x) {
|
|
352
352
|
case "GET":
|
|
353
|
-
return M.get(
|
|
353
|
+
return M.get(H, { headers: tt }).subscribe(function(Q) {
|
|
354
354
|
nt({ ok: !0, text: function() {
|
|
355
|
-
return Promise.resolve(
|
|
355
|
+
return Promise.resolve(Q);
|
|
356
356
|
} });
|
|
357
357
|
});
|
|
358
358
|
case "POST":
|
|
359
359
|
case "PUT":
|
|
360
|
-
return M.post(
|
|
360
|
+
return M.post(H, lt, { headers: tt }).subscribe(function(Q) {
|
|
361
361
|
nt({ ok: !0, text: function() {
|
|
362
|
-
return Promise.resolve(
|
|
362
|
+
return Promise.resolve(Q);
|
|
363
363
|
} });
|
|
364
364
|
});
|
|
365
365
|
}
|
|
366
366
|
});
|
|
367
367
|
};
|
|
368
|
-
}(
|
|
368
|
+
}(Pt)), A && this.canUseStorage && A.getItem(q).then(function(M) {
|
|
369
369
|
try {
|
|
370
|
-
|
|
370
|
+
T.evaluationEvent = JSON.parse(M) || {};
|
|
371
371
|
} catch {
|
|
372
|
-
|
|
372
|
+
T.evaluationEvent = {};
|
|
373
373
|
}
|
|
374
|
-
|
|
375
|
-
}), this.enableAnalytics && (this.analyticsInterval && clearInterval(this.analyticsInterval), A && this.canUseStorage && A.getItem(
|
|
376
|
-
if (
|
|
377
|
-
var
|
|
378
|
-
if (
|
|
379
|
-
var tt =
|
|
380
|
-
|
|
374
|
+
T.analyticsInterval = setInterval(T.analyticsFlags, T.ticks);
|
|
375
|
+
}), this.enableAnalytics && (this.analyticsInterval && clearInterval(this.analyticsInterval), A && this.canUseStorage && A.getItem(q, function(M, H) {
|
|
376
|
+
if (H && T.evaluationContext.environment) {
|
|
377
|
+
var X = JSON.parse(H);
|
|
378
|
+
if (X[T.evaluationContext.environment.apiKey]) {
|
|
379
|
+
var tt = T.getState();
|
|
380
|
+
T.log("Retrieved events from cache", H), T.setState(o(o({}, tt), { evaluationEvent: X[T.evaluationContext.environment.apiKey] }));
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
})), !b) return [3, 9];
|
|
384
384
|
if (!A || !this.canUseStorage) return [3, 8];
|
|
385
|
-
|
|
386
|
-
return
|
|
387
|
-
var
|
|
385
|
+
fe = function(M, H) {
|
|
386
|
+
return O(T, void 0, void 0, function() {
|
|
387
|
+
var X, tt, x, lt, nt, Q, Kt, me, Ut, Mt, Dt, Gt, Bt, Jt, Vt, qt, zt, $t, Ht, Xt, Yt, Qt, Zt, Wt, ye = this;
|
|
388
388
|
return I(this, function(et) {
|
|
389
389
|
switch (et.label) {
|
|
390
390
|
case 0:
|
|
391
|
-
if (
|
|
392
|
-
|
|
391
|
+
if (!H) return [3, 7];
|
|
392
|
+
X = null, tt = null, et.label = 1;
|
|
393
393
|
case 1:
|
|
394
|
-
return et.trys.push([1, 5, , 6]), x = JSON.parse(
|
|
394
|
+
return et.trys.push([1, 5, , 6]), x = JSON.parse(H), 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) && (Q = !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), Q = !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"), Q = !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, Q = !0)), Q && (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), X = 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: X, 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
395
|
var te;
|
|
396
|
-
(te =
|
|
396
|
+
(te = ye.onError) === null || te === void 0 || te.call(ye, Ae);
|
|
397
397
|
}), [3, 4]) : [3, 2];
|
|
398
398
|
case 2:
|
|
399
|
-
return
|
|
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
|
|
405
|
+
return me = et.sent(), this.log("Exception fetching cached logs", me), [3, 6];
|
|
406
406
|
case 6:
|
|
407
407
|
return [3, 10];
|
|
408
408
|
case 7:
|
|
409
|
-
return
|
|
409
|
+
return K ? [3, 9] : [4, this.getFlags()];
|
|
410
410
|
case 8:
|
|
411
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
415
|
if (!this.flags) throw new Error(Nt);
|
|
416
|
-
this._onChange(null, { isFromServer: !1, flagsChanged:
|
|
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:
|
|
@@ -429,24 +429,24 @@ var re = { exports: {} };
|
|
|
429
429
|
case 4:
|
|
430
430
|
Rt = B.sent(), B.label = 5;
|
|
431
431
|
case 5:
|
|
432
|
-
return [4,
|
|
432
|
+
return [4, fe(null, Rt)];
|
|
433
433
|
case 6:
|
|
434
434
|
case 7:
|
|
435
435
|
return B.sent(), [3, 8];
|
|
436
436
|
case 8:
|
|
437
437
|
return [3, 12];
|
|
438
438
|
case 9:
|
|
439
|
-
return
|
|
439
|
+
return K ? [3, 11] : [4, this.getFlags()];
|
|
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 ot = B.sent(), this.log("Error during initialisation ", ot),
|
|
449
|
+
throw ot = B.sent(), this.log("Error during initialisation ", ot), pe = ot instanceof Error ? ot : new Error("".concat(ot)), (n = this.onError) === null || n === void 0 || n.call(this, pe), ot;
|
|
450
450
|
case 14:
|
|
451
451
|
return [2];
|
|
452
452
|
}
|
|
@@ -456,8 +456,8 @@ var re = { exports: {} };
|
|
|
456
456
|
return this.flags;
|
|
457
457
|
}, a.prototype.identify = function(e, t, i) {
|
|
458
458
|
return this.evaluationContext.identity = { identifier: e, transient: i, traits: this.evaluationContext.identity && this.evaluationContext.identity.identifier == e ? this.evaluationContext.identity.traits : {} }, this.evaluationContext.identity.identifier = e, this.log("Identify: " + this.evaluationContext.identity.identifier), t && (this.evaluationContext.identity.traits = Object.fromEntries(Object.entries(t).map(function(n) {
|
|
459
|
-
var r = n[0],
|
|
460
|
-
return [r, D(
|
|
459
|
+
var r = n[0], s = n[1];
|
|
460
|
+
return [r, D(s) ? s : { value: s }];
|
|
461
461
|
}))), this.initialised ? this.getFlags() : Promise.resolve();
|
|
462
462
|
}, a.prototype.getState = function() {
|
|
463
463
|
return { api: this.api, flags: this.flags, ts: this.ts, evaluationContext: this.evaluationContext, evaluationEvent: this.evaluationEvent };
|
|
@@ -473,7 +473,7 @@ var re = { 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,7 +483,7 @@ var re = { 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(q, e).catch(function(t) {
|
|
487
487
|
return console.error("Flagsmith: Error setting item in async storage", t);
|
|
488
488
|
});
|
|
489
489
|
}
|
|
@@ -492,20 +492,20 @@ var re = { exports: {} };
|
|
|
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
|
-
|
|
496
|
-
var
|
|
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
|
+
var s;
|
|
497
497
|
try {
|
|
498
|
-
|
|
498
|
+
s = JSON.parse(r.data).updated_at;
|
|
499
499
|
} catch (c) {
|
|
500
500
|
i.log("Could not parse sse event", c);
|
|
501
501
|
}
|
|
502
|
-
|
|
502
|
+
s ? !i.timestamp || s > i.timestamp ? i.isLoading ? i.log("updated_at is new, but flags are loading", r.data, i.timestamp) : (i.log("updated_at is new, fetching flags", r.data, i.timestamp), i.getFlags()) : i.log("updated_at is outdated, skipping get flags", r.data, i.timestamp) : i.log("No updated_at received, fetching flags", r);
|
|
503
503
|
})) : this.log("Error, EventSource is undefined");
|
|
504
504
|
}, a;
|
|
505
505
|
}();
|
|
506
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
510
|
var xt, Ie = (xt = function(a, e) {
|
|
511
511
|
return xt = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, i) {
|
|
@@ -519,19 +519,19 @@ var re = { 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
|
+
}), le = 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
|
+
}, se = function(a, e) {
|
|
530
530
|
var t = typeof Symbol == "function" && a[Symbol.iterator];
|
|
531
531
|
if (!t) return a;
|
|
532
|
-
var i, n, r = t.call(a),
|
|
532
|
+
var i, n, r = t.call(a), s = [];
|
|
533
533
|
try {
|
|
534
|
-
for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; )
|
|
534
|
+
for (; (e === void 0 || e-- > 0) && !(i = r.next()).done; ) s.push(i.value);
|
|
535
535
|
} catch (c) {
|
|
536
536
|
n = { error: c };
|
|
537
537
|
} finally {
|
|
@@ -541,8 +541,8 @@ var re = { exports: {} };
|
|
|
541
541
|
if (n) throw n.error;
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
|
-
return
|
|
545
|
-
},
|
|
544
|
+
return s;
|
|
545
|
+
}, kt = 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) {
|
|
@@ -551,7 +551,7 @@ var re = { exports: {} };
|
|
|
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
553
|
return Ie(e, a), e;
|
|
554
|
-
}(Error),
|
|
554
|
+
}(Error), ue = function() {
|
|
555
555
|
function a(e, t) {
|
|
556
556
|
var i = this;
|
|
557
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();
|
|
@@ -571,15 +571,15 @@ Consider loading an EventSource polyfill and making it available globally as Eve
|
|
|
571
571
|
i.onmessage(d);
|
|
572
572
|
};
|
|
573
573
|
try {
|
|
574
|
-
for (var r =
|
|
575
|
-
var c =
|
|
574
|
+
for (var r = le(Object.keys(this._listeners)), s = r.next(); !s.done; s = r.next()) {
|
|
575
|
+
var c = s.value;
|
|
576
576
|
this._eventSource.addEventListener(c, this._onevent_wrapped);
|
|
577
577
|
}
|
|
578
578
|
} catch (d) {
|
|
579
579
|
e = { error: d };
|
|
580
580
|
} finally {
|
|
581
581
|
try {
|
|
582
|
-
|
|
582
|
+
s && !s.done && (t = r.return) && t.call(r);
|
|
583
583
|
} finally {
|
|
584
584
|
if (e) throw e.error;
|
|
585
585
|
}
|
|
@@ -600,13 +600,13 @@ 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 =
|
|
604
|
-
|
|
603
|
+
for (var r = le(kt([], se(n), !1)), s = r.next(); !s.done; s = r.next())
|
|
604
|
+
s.value.call(this, e);
|
|
605
605
|
} catch (c) {
|
|
606
606
|
t = { error: c };
|
|
607
607
|
} finally {
|
|
608
608
|
try {
|
|
609
|
-
|
|
609
|
+
s && !s.done && (i = r.return) && i.call(r);
|
|
610
610
|
} finally {
|
|
611
611
|
if (t) throw t.error;
|
|
612
612
|
}
|
|
@@ -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] = kt(kt([], se(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,9 +629,9 @@ 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 ce = function(a, e) {
|
|
633
633
|
return e = e || {}, new Promise(function(t, i) {
|
|
634
|
-
var n = new XMLHttpRequest(), r = [],
|
|
634
|
+
var n = new XMLHttpRequest(), r = [], s = [], 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() {
|
|
@@ -641,7 +641,7 @@ Consider loading an EventSource polyfill and making it available globally as Eve
|
|
|
641
641
|
}, clone: d, headers: { keys: function() {
|
|
642
642
|
return r;
|
|
643
643
|
}, entries: function() {
|
|
644
|
-
return
|
|
644
|
+
return s;
|
|
645
645
|
}, get: function(u) {
|
|
646
646
|
return c[u.toLowerCase()];
|
|
647
647
|
}, has: function(u) {
|
|
@@ -649,21 +649,21 @@ 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()),
|
|
652
|
+
n.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm, function(u, b, j) {
|
|
653
|
+
r.push(b = b.toLowerCase()), s.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
|
-
},
|
|
659
|
-
typeof window < "u" && (window.flagsmith =
|
|
660
|
-
return L({ AsyncStorage: v, fetch:
|
|
661
|
-
},
|
|
658
|
+
}, de = L({ AsyncStorage: v, fetch: ce, eventSource: ue });
|
|
659
|
+
typeof window < "u" && (window.flagsmith = de), f.createFlagsmithInstance = function() {
|
|
660
|
+
return L({ AsyncStorage: v, fetch: ce, eventSource: ue });
|
|
661
|
+
}, f.default = de, Object.defineProperty(f, "__esModule", { value: !0 });
|
|
662
662
|
});
|
|
663
663
|
})(re, re.exports);
|
|
664
664
|
var Je = re.exports, Ve = {
|
|
665
665
|
NOT_INITIALIZED: "FeatureFlag not initialized. Call init() first."
|
|
666
|
-
},
|
|
666
|
+
}, Fe = "business", Y, qe = (Y = class {
|
|
667
667
|
constructor() {
|
|
668
668
|
Et(this, "flagsmithClient", null);
|
|
669
669
|
Et(this, "userContext", null);
|
|
@@ -675,24 +675,24 @@ var Je = re.exports, Ve = {
|
|
|
675
675
|
if (!this.flagsmithClient)
|
|
676
676
|
throw new Error(Ve.NOT_INITIALIZED);
|
|
677
677
|
}
|
|
678
|
-
async init(
|
|
678
|
+
async init(l, f = []) {
|
|
679
679
|
if (!this.flagsmithClient)
|
|
680
680
|
try {
|
|
681
681
|
this.flagsmithClient = Je.createFlagsmithInstance();
|
|
682
|
-
const v =
|
|
682
|
+
const v = f.reduce((o, O) => (o[O.feature.name] = O, o), {});
|
|
683
683
|
await this.flagsmithClient.init({
|
|
684
|
-
environmentID:
|
|
685
|
-
api: (
|
|
686
|
-
enableAnalytics: (
|
|
684
|
+
environmentID: l.apiKey,
|
|
685
|
+
api: (l == null ? void 0 : l.url) ?? "https://feature-flag-proxy.feedme.farm/api/v1/",
|
|
686
|
+
enableAnalytics: (l == null ? void 0 : l.enableAnalytics) ?? !0,
|
|
687
687
|
defaultFlags: v,
|
|
688
|
-
cacheFlags: (
|
|
688
|
+
cacheFlags: (l == null ? void 0 : l.cacheFlags) ?? !0
|
|
689
689
|
});
|
|
690
690
|
} catch (v) {
|
|
691
691
|
throw console.error("Failed to initialize FeatureFlag:", v), v;
|
|
692
692
|
}
|
|
693
693
|
}
|
|
694
|
-
async setUser(
|
|
695
|
-
this.ensureInitialized(), this.userContext = { identifier:
|
|
694
|
+
async setUser(l) {
|
|
695
|
+
this.ensureInitialized(), this.userContext = { identifier: l }, await this.updateContext();
|
|
696
696
|
}
|
|
697
697
|
async updateContext() {
|
|
698
698
|
try {
|
|
@@ -702,18 +702,18 @@ var Je = re.exports, Ve = {
|
|
|
702
702
|
identifier: this.userContext.identifier
|
|
703
703
|
}
|
|
704
704
|
});
|
|
705
|
-
} catch (
|
|
706
|
-
throw console.error("Failed to update user context:",
|
|
705
|
+
} catch (l) {
|
|
706
|
+
throw console.error("Failed to update user context:", l), l;
|
|
707
707
|
}
|
|
708
708
|
}
|
|
709
709
|
async getFlags() {
|
|
710
710
|
this.ensureInitialized();
|
|
711
|
-
const
|
|
712
|
-
return Object.entries(
|
|
711
|
+
const l = this.flagsmithClient.getAllFlags();
|
|
712
|
+
return Object.entries(l).map(([f, v]) => {
|
|
713
713
|
var o;
|
|
714
714
|
return {
|
|
715
715
|
feature: {
|
|
716
|
-
name:
|
|
716
|
+
name: f,
|
|
717
717
|
id: (v == null ? void 0 : v.id) ?? 0
|
|
718
718
|
},
|
|
719
719
|
enabled: v.enabled,
|
|
@@ -721,127 +721,127 @@ var Je = re.exports, Ve = {
|
|
|
721
721
|
};
|
|
722
722
|
});
|
|
723
723
|
}
|
|
724
|
-
getFlagValue(
|
|
724
|
+
getFlagValue(l, f) {
|
|
725
725
|
this.ensureInitialized();
|
|
726
|
-
const v = this.flagsmithClient.getValue(
|
|
726
|
+
const v = this.flagsmithClient.getValue(l);
|
|
727
727
|
if (v == null)
|
|
728
728
|
return null;
|
|
729
729
|
try {
|
|
730
730
|
const o = v.toString();
|
|
731
|
-
return
|
|
731
|
+
return f ? f(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
|
-
getFlag(
|
|
736
|
+
getFlag(l) {
|
|
737
737
|
this.ensureInitialized();
|
|
738
|
-
const
|
|
739
|
-
if (
|
|
740
|
-
const v = this.flagsmithClient.hasFeature(
|
|
738
|
+
const f = this.flagsmithClient.getValue(l);
|
|
739
|
+
if (f == null) return null;
|
|
740
|
+
const v = this.flagsmithClient.hasFeature(l);
|
|
741
741
|
return {
|
|
742
742
|
feature: {
|
|
743
|
-
name:
|
|
743
|
+
name: l,
|
|
744
744
|
id: 0
|
|
745
745
|
},
|
|
746
746
|
enabled: v,
|
|
747
|
-
value:
|
|
747
|
+
value: f.toString()
|
|
748
748
|
};
|
|
749
749
|
}
|
|
750
|
-
async getUserFlagValue(
|
|
750
|
+
async getUserFlagValue(l, f, v = null, o) {
|
|
751
751
|
var I;
|
|
752
|
-
const
|
|
752
|
+
const O = this.userContext;
|
|
753
753
|
try {
|
|
754
|
-
return await this.setUser(
|
|
755
|
-
} catch (
|
|
756
|
-
return console.error(`Error getting user flag value for ${
|
|
754
|
+
return await this.setUser(l), this.getFlagValue(f, o) ?? v;
|
|
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
|
-
}, Et(Y, "instance"), Y),
|
|
769
|
-
function $e(
|
|
770
|
-
const
|
|
768
|
+
}, Et(Y, "instance"), Y), ze = qe.getInstance(), Ct = V(!1), It = V([]), vt = V(null);
|
|
769
|
+
function $e(p = ze) {
|
|
770
|
+
const l = () => Ct.value ? !0 : (console.warn("FeatureFlag is not initialized. Using default values."), !1), f = async (g, m = []) => {
|
|
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 p.init(g, m), It.value = await p.getFlags(), Ct.value = !0, vt.value = null;
|
|
777
|
+
} catch (_) {
|
|
778
|
+
console.error("Failed to initialize feature flags:", _), vt.value = _;
|
|
779
779
|
}
|
|
780
780
|
}, v = async (g) => {
|
|
781
|
-
if (
|
|
781
|
+
if (l())
|
|
782
782
|
try {
|
|
783
|
-
await
|
|
783
|
+
await p.setUser(g), It.value = await p.getFlags(), vt.value = null;
|
|
784
784
|
} catch (m) {
|
|
785
|
-
console.error("Failed to set user:", m),
|
|
785
|
+
console.error("Failed to set user:", m), vt.value = m;
|
|
786
786
|
}
|
|
787
|
-
}, o = async (g) => v(`${
|
|
788
|
-
if (!
|
|
787
|
+
}, o = async (g) => v(`${Fe}-${g}`), O = (g, m, _ = null) => {
|
|
788
|
+
if (!l()) return _;
|
|
789
789
|
try {
|
|
790
|
-
return
|
|
790
|
+
return p.getFlagValue(g, m) ?? _;
|
|
791
791
|
} catch (D) {
|
|
792
|
-
return console.error(`Error getting flag value for ${g}:`, D),
|
|
792
|
+
return console.error(`Error getting flag value for ${g}:`, D), _;
|
|
793
793
|
}
|
|
794
794
|
}, I = (g, m) => {
|
|
795
|
-
if (!
|
|
795
|
+
if (!l()) return m ?? null;
|
|
796
796
|
try {
|
|
797
|
-
return
|
|
798
|
-
} catch (
|
|
799
|
-
return console.error(`Error getting flag for ${g}:`,
|
|
797
|
+
return p.getFlag(g) ?? m ?? null;
|
|
798
|
+
} catch (_) {
|
|
799
|
+
return console.error(`Error getting flag for ${g}:`, _), m ?? null;
|
|
800
800
|
}
|
|
801
|
-
},
|
|
802
|
-
if (!
|
|
801
|
+
}, w = async (g, m, _ = null, D) => {
|
|
802
|
+
if (!l()) return _;
|
|
803
803
|
try {
|
|
804
|
-
return await
|
|
804
|
+
return await p.getUserFlagValue(g, m, _, D);
|
|
805
805
|
} catch (it) {
|
|
806
|
-
return console.error(`Error getting user flag value for ${m}:`, it),
|
|
806
|
+
return console.error(`Error getting user flag value for ${m}:`, it), _;
|
|
807
807
|
}
|
|
808
|
-
}, W = async (g, m,
|
|
808
|
+
}, W = async (g, m, _ = null, D) => w(`${Fe}-${g}`, m, _, D), E = () => {
|
|
809
809
|
try {
|
|
810
|
-
|
|
810
|
+
p.reset();
|
|
811
811
|
} catch (g) {
|
|
812
812
|
console.error("Error resetting feature flags:", g);
|
|
813
813
|
} finally {
|
|
814
|
-
It.value = [], Ct.value = !1,
|
|
814
|
+
It.value = [], Ct.value = !1, vt.value = null;
|
|
815
815
|
}
|
|
816
816
|
};
|
|
817
817
|
return {
|
|
818
818
|
flags: ee(It),
|
|
819
819
|
isInitialized: ee(Ct),
|
|
820
|
-
error: ee(
|
|
821
|
-
init:
|
|
820
|
+
error: ee(vt),
|
|
821
|
+
init: f,
|
|
822
822
|
setUser: v,
|
|
823
823
|
setBusiness: o,
|
|
824
|
-
getFlagValue:
|
|
824
|
+
getFlagValue: O,
|
|
825
825
|
getFlag: I,
|
|
826
|
-
getUserFlagValue:
|
|
826
|
+
getUserFlagValue: w,
|
|
827
827
|
getBusinessFlagValue: W,
|
|
828
|
-
reset:
|
|
828
|
+
reset: E
|
|
829
829
|
};
|
|
830
830
|
}
|
|
831
831
|
var Oe = () => $e();
|
|
832
|
-
const
|
|
832
|
+
const xe = {
|
|
833
833
|
dev: "MaGoXrEWuEJNpWgKTqseee",
|
|
834
834
|
prod: "6GhcttsJ9Rj9cTevcdrpin"
|
|
835
|
-
}, He = "order_miniprogram_v2",
|
|
835
|
+
}, He = "order_miniprogram_v2", Ee = 1e4, _t = V("pending");
|
|
836
836
|
let Lt = null;
|
|
837
|
-
function
|
|
837
|
+
function Xe(p) {
|
|
838
838
|
if (Lt) return Lt;
|
|
839
|
-
const { init:
|
|
839
|
+
const { init: l } = Oe(), f = p === "prod" ? xe.prod : xe.dev;
|
|
840
840
|
let v;
|
|
841
841
|
return Lt = Promise.race([
|
|
842
|
-
|
|
843
|
-
new Promise((o,
|
|
844
|
-
v = setTimeout(() =>
|
|
842
|
+
l({ apiKey: f }),
|
|
843
|
+
new Promise((o, O) => {
|
|
844
|
+
v = setTimeout(() => O(new Error(`Flagsmith init exceeded ${Ee}ms`)), Ee);
|
|
845
845
|
})
|
|
846
846
|
]).then(() => {
|
|
847
847
|
_t.value = "ready";
|
|
@@ -851,22 +851,22 @@ function Ye(f) {
|
|
|
851
851
|
clearTimeout(v);
|
|
852
852
|
}), Lt;
|
|
853
853
|
}
|
|
854
|
-
function
|
|
854
|
+
function Ye(p) {
|
|
855
855
|
try {
|
|
856
|
-
const
|
|
857
|
-
return
|
|
856
|
+
const l = typeof p == "string" ? JSON.parse(p) : p;
|
|
857
|
+
return l === !0 || l === "true" || (l == null ? void 0 : l.enabled) === !0 || (l == null ? void 0 : l.enabled) === "true";
|
|
858
858
|
} catch {
|
|
859
|
-
return
|
|
859
|
+
return p === !0 || p === "true";
|
|
860
860
|
}
|
|
861
861
|
}
|
|
862
|
-
function Qe(
|
|
863
|
-
const v =
|
|
864
|
-
let
|
|
862
|
+
function Qe(p, l, f) {
|
|
863
|
+
const v = oe(), { getBusinessFlagValue: o } = Oe(), O = V(l), I = V(!0);
|
|
864
|
+
let w = 0;
|
|
865
865
|
async function W() {
|
|
866
866
|
var m;
|
|
867
|
-
const
|
|
867
|
+
const E = ++w, g = (m = v.currentBusiness.value) == null ? void 0 : m._id;
|
|
868
868
|
if (!g || _t.value === "failed") {
|
|
869
|
-
|
|
869
|
+
O.value = l, I.value = !1;
|
|
870
870
|
return;
|
|
871
871
|
}
|
|
872
872
|
if (_t.value === "pending") {
|
|
@@ -875,198 +875,197 @@ function Qe(f, s, p) {
|
|
|
875
875
|
}
|
|
876
876
|
I.value = !0;
|
|
877
877
|
try {
|
|
878
|
-
const
|
|
879
|
-
if (
|
|
880
|
-
|
|
878
|
+
const _ = await o(g, p, l);
|
|
879
|
+
if (E !== w) return;
|
|
880
|
+
O.value = f ? f(_) : _;
|
|
881
881
|
} catch {
|
|
882
|
-
if (
|
|
883
|
-
|
|
882
|
+
if (E !== w) return;
|
|
883
|
+
O.value = l;
|
|
884
884
|
} finally {
|
|
885
|
-
|
|
885
|
+
E === w && (I.value = !1);
|
|
886
886
|
}
|
|
887
887
|
}
|
|
888
|
-
return
|
|
889
|
-
var
|
|
890
|
-
return (
|
|
891
|
-
}, _t], W, { immediate: !0 }), { value:
|
|
888
|
+
return we([() => {
|
|
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 Ze() {
|
|
894
|
-
const
|
|
895
|
-
|
|
893
|
+
function Ze(p) {
|
|
894
|
+
const l = oe();
|
|
895
|
+
if (We(p, l.namespace.value))
|
|
896
|
+
return { enabled: V(!0), loading: V(!1) };
|
|
897
|
+
const { value: f, loading: v } = Qe(He, !1, Ye);
|
|
898
|
+
return { enabled: f, loading: v };
|
|
896
899
|
}
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
if (typeof window > "u") return !1;
|
|
900
|
-
try {
|
|
901
|
-
const f = new URLSearchParams(window.location.search).get(We);
|
|
902
|
-
return f !== null && f !== "0" && f !== "false";
|
|
903
|
-
} catch {
|
|
904
|
-
return !1;
|
|
905
|
-
}
|
|
900
|
+
function We(p, l) {
|
|
901
|
+
return p.toLowerCase().includes("dev") && l === "dev";
|
|
906
902
|
}
|
|
907
|
-
const
|
|
903
|
+
const tn = {
|
|
908
904
|
key: 0,
|
|
909
905
|
class: "portal-sidebar",
|
|
910
906
|
"aria-label": "Mini Program navigation"
|
|
911
|
-
},
|
|
907
|
+
}, en = ["aria-expanded", "aria-label"], nn = {
|
|
912
908
|
id: "miniprogram-navigation",
|
|
913
909
|
class: "portal-nav"
|
|
914
|
-
},
|
|
910
|
+
}, an = { class: "portal-nav-label" }, rn = { class: "portal-nav-label" }, on = { class: "portal-main" }, ln = {
|
|
915
911
|
key: 0,
|
|
916
912
|
class: "portal-breadcrumb",
|
|
917
913
|
"aria-label": "Breadcrumb"
|
|
918
|
-
},
|
|
914
|
+
}, sn = {
|
|
919
915
|
id: "miniprogram-content",
|
|
920
916
|
class: "portal-content",
|
|
921
917
|
tabindex: "-1"
|
|
922
|
-
},
|
|
918
|
+
}, un = {
|
|
923
919
|
key: 0,
|
|
924
920
|
class: "portal-empty"
|
|
925
|
-
},
|
|
921
|
+
}, cn = {
|
|
926
922
|
key: 1,
|
|
927
923
|
class: "portal-loading",
|
|
928
924
|
role: "status"
|
|
929
|
-
},
|
|
925
|
+
}, dn = {
|
|
930
926
|
key: 2,
|
|
931
927
|
class: "portal-empty"
|
|
932
|
-
},
|
|
928
|
+
}, vn = {
|
|
933
929
|
key: 3,
|
|
934
930
|
class: "portal-empty",
|
|
935
931
|
role: "alert"
|
|
936
|
-
},
|
|
932
|
+
}, gn = /* @__PURE__ */ Te({
|
|
937
933
|
__name: "App",
|
|
938
|
-
setup(
|
|
939
|
-
const
|
|
940
|
-
|
|
941
|
-
const N = Ge(
|
|
934
|
+
setup(p) {
|
|
935
|
+
const l = Re(), f = Ke(), v = oe(), o = De(), O = V(!1);
|
|
936
|
+
we(o.businessId, async (q, h) => {
|
|
937
|
+
const N = Ge(l, h, q);
|
|
942
938
|
if (N) {
|
|
943
|
-
|
|
939
|
+
O.value = !0;
|
|
944
940
|
try {
|
|
945
|
-
await
|
|
941
|
+
await f.replace(N);
|
|
946
942
|
} finally {
|
|
947
|
-
|
|
943
|
+
O.value = !1;
|
|
948
944
|
}
|
|
949
945
|
}
|
|
950
|
-
}),
|
|
951
|
-
const I = Ze(),
|
|
952
|
-
|
|
946
|
+
}), Xe(v.namespace.value);
|
|
947
|
+
const I = Ze("fmmf:dev"), w = st(() => l.name === "miniprogram-v2-project"), W = st(() => ({
|
|
948
|
+
...dt(l.query),
|
|
949
|
+
...w.value ? { returnProjectId: String(l.params.projectId) } : {}
|
|
950
|
+
})), E = st(() => I.loading.value || I.enabled.value), g = V(
|
|
951
|
+
Ce(
|
|
953
952
|
"mpv2:portal-collapsed",
|
|
954
953
|
typeof window < "u" && window.matchMedia("(max-width: 1000px)").matches
|
|
955
954
|
)
|
|
956
|
-
),
|
|
955
|
+
), m = V(Ce("mpv2:editor-collapsed", !0)), _ = st(() => w.value ? m.value : g.value), D = st(
|
|
957
956
|
() => {
|
|
958
|
-
var
|
|
959
|
-
return
|
|
957
|
+
var q;
|
|
958
|
+
return w.value ? (q = o.context.value) == null ? void 0 : q.project.name : String(l.meta.title ?? "Ecosystem");
|
|
960
959
|
}
|
|
961
|
-
),
|
|
960
|
+
), it = [
|
|
962
961
|
{ name: "miniprogram-v2-ecosystem", label: "Ecosystem", icon: "ecosystem" },
|
|
963
962
|
{ name: "miniprogram-v2-brand-kit", label: "Brand Kit", icon: "brand" },
|
|
964
963
|
{ name: "miniprogram-v2-pages", label: "Pages", icon: "pages" }
|
|
965
|
-
],
|
|
964
|
+
], gt = st(() => ({ name: "miniprogram-v2-mobile-projects", query: dt(l.query) })), ht = Me();
|
|
966
965
|
let A = !1;
|
|
967
|
-
|
|
966
|
+
Pe(() => {
|
|
968
967
|
A = v.hideSidebar.value, v.hideSidebar.value = !0;
|
|
969
968
|
}), Ne(() => {
|
|
970
969
|
v.hideSidebar.value = A;
|
|
971
970
|
});
|
|
972
971
|
function At() {
|
|
973
|
-
|
|
972
|
+
w.value ? (m.value = !m.value, _e("mpv2:editor-collapsed", m.value)) : (g.value = !g.value, _e("mpv2:portal-collapsed", g.value));
|
|
974
973
|
}
|
|
975
|
-
return (
|
|
976
|
-
const N = wt("RouterLink"),
|
|
977
|
-
return J(),
|
|
974
|
+
return (q, h) => {
|
|
975
|
+
const N = wt("RouterLink"), ft = wt("FmIcon"), Ft = wt("FmCircularProgress"), jt = wt("FmButton");
|
|
976
|
+
return J(), Z(ne, null, [
|
|
978
977
|
h[14] || (h[14] = C("link", {
|
|
979
978
|
href: "https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@24,400,0..1,0",
|
|
980
979
|
rel: "stylesheet"
|
|
981
980
|
}, null, -1)),
|
|
982
981
|
C("div", {
|
|
983
|
-
class: ie(["mpv2-app portal-shell", { "portal-shell--collapsed":
|
|
982
|
+
class: ie(["mpv2-app portal-shell", { "portal-shell--collapsed": _.value }])
|
|
984
983
|
}, [
|
|
985
984
|
h[13] || (h[13] = C("a", {
|
|
986
985
|
class: "portal-skip",
|
|
987
986
|
href: "#miniprogram-content"
|
|
988
987
|
}, "Skip to content", -1)),
|
|
989
|
-
|
|
988
|
+
E.value ? (J(), Z("aside", tn, [
|
|
990
989
|
C("button", {
|
|
991
990
|
class: "portal-sidebar-toggle",
|
|
992
991
|
type: "button",
|
|
993
|
-
"aria-expanded": !
|
|
992
|
+
"aria-expanded": !_.value,
|
|
994
993
|
"aria-controls": "miniprogram-navigation",
|
|
995
|
-
"aria-label":
|
|
994
|
+
"aria-label": _.value ? "Expand navigation" : "Collapse navigation",
|
|
996
995
|
onClick: At
|
|
997
996
|
}, [
|
|
998
|
-
|
|
997
|
+
P(St, { name: "collapse" }),
|
|
999
998
|
h[0] || (h[0] = C("span", { class: "portal-nav-label" }, "Mini Program", -1))
|
|
1000
|
-
], 8,
|
|
1001
|
-
C("nav",
|
|
1002
|
-
(J(),
|
|
999
|
+
], 8, en),
|
|
1000
|
+
C("nav", nn, [
|
|
1001
|
+
(J(), Z(ne, null, be(it, (L) => P(N, {
|
|
1003
1002
|
key: L.name,
|
|
1004
|
-
to: { name: L.name, query:
|
|
1003
|
+
to: { name: L.name, query: F(dt)(F(l).query) },
|
|
1005
1004
|
class: "portal-nav-item",
|
|
1006
1005
|
title: L.label,
|
|
1007
1006
|
"aria-label": L.label,
|
|
1008
|
-
"aria-current":
|
|
1007
|
+
"aria-current": F(l).name === L.name ? "page" : void 0
|
|
1009
1008
|
}, {
|
|
1010
|
-
default:
|
|
1011
|
-
|
|
1009
|
+
default: ut(() => [
|
|
1010
|
+
P(St, {
|
|
1012
1011
|
name: L.icon
|
|
1013
1012
|
}, null, 8, ["name"]),
|
|
1014
|
-
C("span",
|
|
1013
|
+
C("span", an, ct(L.label), 1)
|
|
1015
1014
|
]),
|
|
1016
1015
|
_: 2
|
|
1017
1016
|
}, 1032, ["to", "title", "aria-label", "aria-current"])), 64)),
|
|
1018
1017
|
h[4] || (h[4] = C("p", { class: "portal-nav-caption" }, "Platforms", -1)),
|
|
1019
|
-
|
|
1020
|
-
to:
|
|
1021
|
-
class: ie(["portal-nav-item", { "router-link-active":
|
|
1018
|
+
P(N, {
|
|
1019
|
+
to: gt.value,
|
|
1020
|
+
class: ie(["portal-nav-item", { "router-link-active": w.value }]),
|
|
1022
1021
|
title: "Mobile Ordering",
|
|
1023
1022
|
"aria-label": "Mobile Ordering",
|
|
1024
|
-
"aria-current":
|
|
1023
|
+
"aria-current": w.value ? "page" : void 0
|
|
1025
1024
|
}, {
|
|
1026
|
-
default:
|
|
1027
|
-
|
|
1025
|
+
default: ut(() => [
|
|
1026
|
+
P(St, { name: "mobile" }),
|
|
1028
1027
|
h[1] || (h[1] = C("span", { class: "portal-nav-label" }, "Mobile Ordering", -1))
|
|
1029
1028
|
]),
|
|
1030
1029
|
_: 1
|
|
1031
1030
|
}, 8, ["to", "class", "aria-current"]),
|
|
1032
|
-
(J(),
|
|
1031
|
+
(J(), Z(ne, null, be(["tablet", "kiosk"], (L) => P(N, {
|
|
1033
1032
|
key: L,
|
|
1034
|
-
to: { name: `miniprogram-v2-${L}`, query:
|
|
1033
|
+
to: { name: `miniprogram-v2-${L}`, query: F(dt)(F(l).query) },
|
|
1035
1034
|
class: "portal-nav-item",
|
|
1036
1035
|
title: L === "tablet" ? "Tablet" : "Kiosk",
|
|
1037
1036
|
"aria-label": L === "tablet" ? "Tablet" : "Kiosk"
|
|
1038
1037
|
}, {
|
|
1039
|
-
default:
|
|
1040
|
-
|
|
1041
|
-
C("span",
|
|
1038
|
+
default: ut(() => [
|
|
1039
|
+
P(St, { name: L }, null, 8, ["name"]),
|
|
1040
|
+
C("span", rn, ct(L === "tablet" ? "Tablet" : "Kiosk"), 1)
|
|
1042
1041
|
]),
|
|
1043
1042
|
_: 2
|
|
1044
1043
|
}, 1032, ["to", "title", "aria-label"])), 64)),
|
|
1045
1044
|
h[5] || (h[5] = C("div", { class: "portal-nav-divider" }, null, -1)),
|
|
1046
|
-
|
|
1047
|
-
to: { name: "miniprogram-v2-module-center", query:
|
|
1048
|
-
class: ie(["portal-nav-item", { "router-link-active":
|
|
1049
|
-
title: "
|
|
1050
|
-
"aria-label": "
|
|
1045
|
+
P(N, {
|
|
1046
|
+
to: { name: "miniprogram-v2-module-center", query: W.value },
|
|
1047
|
+
class: ie(["portal-nav-item", { "router-link-active": F(l).name === "miniprogram-v2-module-detail" }]),
|
|
1048
|
+
title: "Component Library",
|
|
1049
|
+
"aria-label": "Component Library"
|
|
1051
1050
|
}, {
|
|
1052
|
-
default:
|
|
1053
|
-
|
|
1051
|
+
default: ut(() => [
|
|
1052
|
+
P(ft, {
|
|
1054
1053
|
name: "widgets",
|
|
1055
1054
|
size: "md"
|
|
1056
1055
|
}),
|
|
1057
|
-
h[2] || (h[2] = C("span", { class: "portal-nav-label" }, "
|
|
1056
|
+
h[2] || (h[2] = C("span", { class: "portal-nav-label" }, "Component Library", -1))
|
|
1058
1057
|
]),
|
|
1059
1058
|
_: 1
|
|
1060
1059
|
}, 8, ["to", "class"]),
|
|
1061
|
-
|
|
1060
|
+
F(ht) ? (J(), Se(N, {
|
|
1062
1061
|
key: 0,
|
|
1063
|
-
to: { name: "miniprogram-v2-template-center", query:
|
|
1062
|
+
to: { name: "miniprogram-v2-template-center", query: F(dt)(F(l).query) },
|
|
1064
1063
|
class: "portal-nav-item",
|
|
1065
1064
|
title: "Template library",
|
|
1066
1065
|
"aria-label": "Template library"
|
|
1067
1066
|
}, {
|
|
1068
|
-
default:
|
|
1069
|
-
|
|
1067
|
+
default: ut(() => [
|
|
1068
|
+
P(ft, {
|
|
1070
1069
|
name: "dashboard_customize",
|
|
1071
1070
|
size: "md"
|
|
1072
1071
|
}),
|
|
@@ -1075,46 +1074,46 @@ const en = {
|
|
|
1075
1074
|
_: 1
|
|
1076
1075
|
}, 8, ["to"])) : ae("", !0)
|
|
1077
1076
|
]),
|
|
1078
|
-
|
|
1079
|
-
to: { name: "miniprogram-v2-settings", query:
|
|
1077
|
+
P(N, {
|
|
1078
|
+
to: { name: "miniprogram-v2-settings", query: F(dt)(F(l).query) },
|
|
1080
1079
|
class: "portal-nav-item portal-settings-link",
|
|
1081
1080
|
title: "Settings",
|
|
1082
1081
|
"aria-label": "Settings"
|
|
1083
1082
|
}, {
|
|
1084
|
-
default:
|
|
1085
|
-
|
|
1083
|
+
default: ut(() => [
|
|
1084
|
+
P(St, { name: "settings" }),
|
|
1086
1085
|
h[6] || (h[6] = C("span", { class: "portal-nav-label" }, "Settings", -1))
|
|
1087
1086
|
]),
|
|
1088
1087
|
_: 1
|
|
1089
1088
|
}, 8, ["to"])
|
|
1090
1089
|
])) : ae("", !0),
|
|
1091
|
-
C("div",
|
|
1092
|
-
|
|
1093
|
-
C("span", null,
|
|
1090
|
+
C("div", on, [
|
|
1091
|
+
w.value ? ae("", !0) : (J(), Z("header", ln, [
|
|
1092
|
+
C("span", null, ct(F(o).businessName.value), 1),
|
|
1094
1093
|
h[7] || (h[7] = C("span", { "aria-hidden": "true" }, "/", -1)),
|
|
1095
|
-
C("span", null,
|
|
1094
|
+
C("span", null, ct(D.value), 1),
|
|
1096
1095
|
h[8] || (h[8] = C("div", {
|
|
1097
1096
|
id: "portal-page-actions",
|
|
1098
1097
|
class: "portal-page-actions"
|
|
1099
1098
|
}, null, -1))
|
|
1100
1099
|
])),
|
|
1101
|
-
C("div",
|
|
1102
|
-
|
|
1103
|
-
|
|
1100
|
+
C("div", sn, [
|
|
1101
|
+
F(o).businessId.value ? F(o).loading.value || F(I).loading.value || O.value ? (J(), Z("div", cn, [
|
|
1102
|
+
P(Ft, { size: "xl" }),
|
|
1104
1103
|
h[10] || (h[10] = C("span", null, "Loading your Mini Program…", -1))
|
|
1105
|
-
])) :
|
|
1104
|
+
])) : F(I).enabled.value ? F(o).error.value ? (J(), Z("section", vn, [
|
|
1106
1105
|
h[12] || (h[12] = C("h1", null, "Could not open this Mini Program", -1)),
|
|
1107
|
-
C("p", null,
|
|
1108
|
-
|
|
1106
|
+
C("p", null, ct(F(o).error.value), 1),
|
|
1107
|
+
P(jt, {
|
|
1109
1108
|
label: "Try again",
|
|
1110
|
-
onClick:
|
|
1109
|
+
onClick: F(o).refresh
|
|
1111
1110
|
}, null, 8, ["onClick"])
|
|
1112
|
-
])) : (J(),
|
|
1113
|
-
key: `${
|
|
1114
|
-
})) : (J(),
|
|
1111
|
+
])) : (J(), Se(F(Ue), {
|
|
1112
|
+
key: `${F(o).businessId.value}:${F(l).params.projectId ?? String(F(l).name)}:${F(l).query.tpl === "1"}`
|
|
1113
|
+
})) : (J(), Z("section", dn, [
|
|
1115
1114
|
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 " +
|
|
1117
|
-
])) : (J(),
|
|
1115
|
+
C("p", null, " It is still rolling out. Your FeedMe contact can enable it for " + ct(F(o).businessName.value) + ". ", 1)
|
|
1116
|
+
])) : (J(), Z("section", un, [...h[9] || (h[9] = [
|
|
1118
1117
|
C("h1", null, "Select a business", -1),
|
|
1119
1118
|
C("p", null, "Choose a business in the Portal header to open its Mini Program.", -1)
|
|
1120
1119
|
])]))
|
|
@@ -1124,7 +1123,7 @@ const en = {
|
|
|
1124
1123
|
], 64);
|
|
1125
1124
|
};
|
|
1126
1125
|
}
|
|
1127
|
-
}),
|
|
1126
|
+
}), xn = /* @__PURE__ */ Be(gn, [["__scopeId", "data-v-53801e3e"]]);
|
|
1128
1127
|
export {
|
|
1129
|
-
|
|
1128
|
+
xn as default
|
|
1130
1129
|
};
|