bt-core-app 2.2.38 → 2.2.40
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/bt-core/core/node_modules/@firebase/app/dist/esm/index.esm.mjs +577 -0
- package/dist/bt-core/core/node_modules/@firebase/component/dist/esm/index.esm.mjs +275 -0
- package/dist/bt-core/core/node_modules/@firebase/installations/dist/esm/index.esm.mjs +763 -0
- package/dist/bt-core/core/node_modules/@firebase/logger/dist/esm/index.esm.mjs +101 -0
- package/dist/bt-core/core/node_modules/@firebase/messaging/dist/esm/index.esm.mjs +1278 -0
- package/dist/bt-core/core/node_modules/@firebase/util/dist/index.esm.mjs +444 -0
- package/dist/bt-core/core/node_modules/@firebase/util/dist/postinstall.mjs +5 -0
- package/dist/bt-core/core/node_modules/@mdi/js/mdi.mjs +60 -59
- package/dist/bt-core/core/node_modules/firebase/app/dist/esm/index.esm.mjs +32 -0
- package/dist/bt-core/core/node_modules/idb/build/index.mjs +58 -0
- package/dist/bt-core/core/node_modules/idb/build/wrap-idb-value.mjs +101 -0
- package/dist/components/BT-Blade-Steps.vue.mjs +2 -2
- package/dist/components/BT-Blade-Steps.vue2.mjs +4 -4
- package/dist/components/BT-Firebase-Notification.vue.d.ts +2 -0
- package/dist/components/BT-Firebase-Notification.vue.mjs +106 -0
- package/dist/components/BT-Firebase-Notification.vue2.mjs +4 -0
- package/dist/components.mjs +18 -16
- package/dist/composables/devices.d.ts +1 -0
- package/dist/composables/devices.mjs +12 -7
- package/dist/composables/firebase.d.ts +29 -0
- package/dist/composables/firebase.mjs +80 -0
- package/dist/composables/icons.mjs +58 -57
- package/dist/composables.mjs +200 -195
- package/dist/core.d.ts +2 -0
- package/dist/core2.mjs +89 -88
- package/dist/index-components.d.ts +2 -1
- package/dist/index-composables.d.ts +3 -1
- package/dist/style.css +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,577 @@
|
|
|
1
|
+
import { Component as p, ComponentContainer as B } from "../../../component/dist/esm/index.esm.mjs";
|
|
2
|
+
import { Logger as P } from "../../../logger/dist/esm/index.esm.mjs";
|
|
3
|
+
import { getDefaultAppConfig as S, deepEqual as D, ErrorFactory as H, base64urlEncodeWithoutPadding as I, isIndexedDBAvailable as O, validateIndexedDBOpenable as F, FirebaseError as A } from "../../../util/dist/index.esm.mjs";
|
|
4
|
+
import { openDB as R } from "../../../../idb/build/index.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2019 Google LLC
|
|
8
|
+
*
|
|
9
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
* you may not use this file except in compliance with the License.
|
|
11
|
+
* You may obtain a copy of the License at
|
|
12
|
+
*
|
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
* See the License for the specific language governing permissions and
|
|
19
|
+
* limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
class M {
|
|
22
|
+
constructor(e) {
|
|
23
|
+
this.container = e;
|
|
24
|
+
}
|
|
25
|
+
// In initial implementation, this will be called by installations on
|
|
26
|
+
// auth token refresh, and installations will send this string.
|
|
27
|
+
getPlatformInfoString() {
|
|
28
|
+
return this.container.getProviders().map((t) => {
|
|
29
|
+
if (T(t)) {
|
|
30
|
+
const r = t.getImmediate();
|
|
31
|
+
return `${r.library}/${r.version}`;
|
|
32
|
+
} else
|
|
33
|
+
return null;
|
|
34
|
+
}).filter((t) => t).join(" ");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function T(a) {
|
|
38
|
+
const e = a.getComponent();
|
|
39
|
+
return (e == null ? void 0 : e.type) === "VERSION";
|
|
40
|
+
}
|
|
41
|
+
const m = "@firebase/app", E = "0.16.2";
|
|
42
|
+
/**
|
|
43
|
+
* @license
|
|
44
|
+
* Copyright 2019 Google LLC
|
|
45
|
+
*
|
|
46
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
47
|
+
* you may not use this file except in compliance with the License.
|
|
48
|
+
* You may obtain a copy of the License at
|
|
49
|
+
*
|
|
50
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
51
|
+
*
|
|
52
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
53
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
54
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
55
|
+
* See the License for the specific language governing permissions and
|
|
56
|
+
* limitations under the License.
|
|
57
|
+
*/
|
|
58
|
+
const c = new P("@firebase/app"), U = "@firebase/app-compat", k = "@firebase/analytics-compat", V = "@firebase/analytics", j = "@firebase/app-check-compat", L = "@firebase/app-check", J = "@firebase/auth", G = "@firebase/auth-compat", Y = "@firebase/database", z = "@firebase/data-connect", q = "@firebase/database-compat", X = "@firebase/functions", W = "@firebase/functions-compat", K = "@firebase/installations", Q = "@firebase/installations-compat", Z = "@firebase/messaging", ee = "@firebase/messaging-compat", te = "@firebase/performance", ae = "@firebase/performance-compat", re = "@firebase/remote-config", ne = "@firebase/remote-config-compat", se = "@firebase/storage", ie = "@firebase/storage-compat", oe = "@firebase/firestore", ce = "@firebase/ai", he = "@firebase/firestore-compat", pe = "firebase";
|
|
59
|
+
/**
|
|
60
|
+
* @license
|
|
61
|
+
* Copyright 2019 Google LLC
|
|
62
|
+
*
|
|
63
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
64
|
+
* you may not use this file except in compliance with the License.
|
|
65
|
+
* You may obtain a copy of the License at
|
|
66
|
+
*
|
|
67
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
68
|
+
*
|
|
69
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
70
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
71
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
72
|
+
* See the License for the specific language governing permissions and
|
|
73
|
+
* limitations under the License.
|
|
74
|
+
*/
|
|
75
|
+
const b = "[DEFAULT]", le = {
|
|
76
|
+
[m]: "fire-core",
|
|
77
|
+
[U]: "fire-core-compat",
|
|
78
|
+
[V]: "fire-analytics",
|
|
79
|
+
[k]: "fire-analytics-compat",
|
|
80
|
+
[L]: "fire-app-check",
|
|
81
|
+
[j]: "fire-app-check-compat",
|
|
82
|
+
[J]: "fire-auth",
|
|
83
|
+
[G]: "fire-auth-compat",
|
|
84
|
+
[Y]: "fire-rtdb",
|
|
85
|
+
[z]: "fire-data-connect",
|
|
86
|
+
[q]: "fire-rtdb-compat",
|
|
87
|
+
[X]: "fire-fn",
|
|
88
|
+
[W]: "fire-fn-compat",
|
|
89
|
+
[K]: "fire-iid",
|
|
90
|
+
[Q]: "fire-iid-compat",
|
|
91
|
+
[Z]: "fire-fcm",
|
|
92
|
+
[ee]: "fire-fcm-compat",
|
|
93
|
+
[te]: "fire-perf",
|
|
94
|
+
[ae]: "fire-perf-compat",
|
|
95
|
+
[re]: "fire-rc",
|
|
96
|
+
[ne]: "fire-rc-compat",
|
|
97
|
+
[se]: "fire-gcs",
|
|
98
|
+
[ie]: "fire-gcs-compat",
|
|
99
|
+
[oe]: "fire-fst",
|
|
100
|
+
[he]: "fire-fst-compat",
|
|
101
|
+
[ce]: "fire-vertex",
|
|
102
|
+
"fire-js": "fire-js",
|
|
103
|
+
// Platform identifier for JS SDK.
|
|
104
|
+
[pe]: "fire-js-all"
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* @license
|
|
108
|
+
* Copyright 2019 Google LLC
|
|
109
|
+
*
|
|
110
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
111
|
+
* you may not use this file except in compliance with the License.
|
|
112
|
+
* You may obtain a copy of the License at
|
|
113
|
+
*
|
|
114
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
115
|
+
*
|
|
116
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
117
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
118
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
119
|
+
* See the License for the specific language governing permissions and
|
|
120
|
+
* limitations under the License.
|
|
121
|
+
*/
|
|
122
|
+
const l = /* @__PURE__ */ new Map(), de = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map();
|
|
123
|
+
function $(a, e) {
|
|
124
|
+
try {
|
|
125
|
+
a.container.addComponent(e);
|
|
126
|
+
} catch (t) {
|
|
127
|
+
c.debug(`Component ${e.name} failed to register with FirebaseApp ${a.name}`, t);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function u(a) {
|
|
131
|
+
const e = a.name;
|
|
132
|
+
if (g.has(e))
|
|
133
|
+
return c.debug(`There were multiple attempts to register component ${e}.`), !1;
|
|
134
|
+
g.set(e, a);
|
|
135
|
+
for (const t of l.values())
|
|
136
|
+
$(t, a);
|
|
137
|
+
for (const t of de.values())
|
|
138
|
+
$(t, a);
|
|
139
|
+
return !0;
|
|
140
|
+
}
|
|
141
|
+
function Ne(a, e) {
|
|
142
|
+
const t = a.container.getProvider("heartbeat").getImmediate({ optional: !0 });
|
|
143
|
+
return t && t.triggerHeartbeat(), a.container.getProvider(e);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* @license
|
|
147
|
+
* Copyright 2019 Google LLC
|
|
148
|
+
*
|
|
149
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
150
|
+
* you may not use this file except in compliance with the License.
|
|
151
|
+
* You may obtain a copy of the License at
|
|
152
|
+
*
|
|
153
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
154
|
+
*
|
|
155
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
156
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
157
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
158
|
+
* See the License for the specific language governing permissions and
|
|
159
|
+
* limitations under the License.
|
|
160
|
+
*/
|
|
161
|
+
const fe = {
|
|
162
|
+
"no-app": "No Firebase App '{$appName}' has been created - call initializeApp() first",
|
|
163
|
+
"bad-app-name": "Illegal App name: '{$appName}'",
|
|
164
|
+
"duplicate-app": "Firebase App named '{$appName}' already exists with different {$mismatchedParam}. Existing: '{$oldValue}'. New: '{$newValue}'.",
|
|
165
|
+
"app-deleted": "Firebase App named '{$appName}' already deleted",
|
|
166
|
+
"server-app-deleted": "Firebase Server App has been deleted",
|
|
167
|
+
"no-options": "Need to provide options, when not being deployed to hosting via source.",
|
|
168
|
+
"invalid-app-argument": "firebase.{$appName}() takes either no argument or a Firebase App instance.",
|
|
169
|
+
"invalid-log-argument": "First argument to `onLog` must be null or a function.",
|
|
170
|
+
"idb-open": "Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.",
|
|
171
|
+
"idb-get": "Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.",
|
|
172
|
+
"idb-set": "Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.",
|
|
173
|
+
"idb-delete": "Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.",
|
|
174
|
+
"finalization-registry-not-supported": "FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.",
|
|
175
|
+
"invalid-server-app-environment": "FirebaseServerApp is not for use in browser environments."
|
|
176
|
+
}, o = new H("app", "Firebase", fe);
|
|
177
|
+
/**
|
|
178
|
+
* @license
|
|
179
|
+
* Copyright 2019 Google LLC
|
|
180
|
+
*
|
|
181
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
* you may not use this file except in compliance with the License.
|
|
183
|
+
* You may obtain a copy of the License at
|
|
184
|
+
*
|
|
185
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
*
|
|
187
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
* See the License for the specific language governing permissions and
|
|
191
|
+
* limitations under the License.
|
|
192
|
+
*/
|
|
193
|
+
class me {
|
|
194
|
+
constructor(e, t, r) {
|
|
195
|
+
this._isDeleted = !1, this._options = { ...e }, this._config = { ...t }, this._name = t.name, this._automaticDataCollectionEnabled = t.automaticDataCollectionEnabled, this._container = r, this.container.addComponent(new p(
|
|
196
|
+
"app",
|
|
197
|
+
() => this,
|
|
198
|
+
"PUBLIC"
|
|
199
|
+
/* ComponentType.PUBLIC */
|
|
200
|
+
));
|
|
201
|
+
}
|
|
202
|
+
get automaticDataCollectionEnabled() {
|
|
203
|
+
return this.checkDestroyed(), this._automaticDataCollectionEnabled;
|
|
204
|
+
}
|
|
205
|
+
set automaticDataCollectionEnabled(e) {
|
|
206
|
+
this.checkDestroyed(), this._automaticDataCollectionEnabled = e;
|
|
207
|
+
}
|
|
208
|
+
get name() {
|
|
209
|
+
return this.checkDestroyed(), this._name;
|
|
210
|
+
}
|
|
211
|
+
get options() {
|
|
212
|
+
return this.checkDestroyed(), this._options;
|
|
213
|
+
}
|
|
214
|
+
get config() {
|
|
215
|
+
return this.checkDestroyed(), this._config;
|
|
216
|
+
}
|
|
217
|
+
get container() {
|
|
218
|
+
return this._container;
|
|
219
|
+
}
|
|
220
|
+
get isDeleted() {
|
|
221
|
+
return this._isDeleted;
|
|
222
|
+
}
|
|
223
|
+
set isDeleted(e) {
|
|
224
|
+
this._isDeleted = e;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* This function will throw an Error if the App has already been deleted -
|
|
228
|
+
* use before performing API actions on the App.
|
|
229
|
+
*/
|
|
230
|
+
checkDestroyed() {
|
|
231
|
+
if (this.isDeleted)
|
|
232
|
+
throw o.create("app-deleted", { appName: this._name });
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
function be(a, e = {}) {
|
|
236
|
+
let t = a;
|
|
237
|
+
typeof e != "object" && (e = { name: e });
|
|
238
|
+
const r = {
|
|
239
|
+
name: b,
|
|
240
|
+
automaticDataCollectionEnabled: !0,
|
|
241
|
+
...e
|
|
242
|
+
}, n = r.name;
|
|
243
|
+
if (typeof n != "string" || !n)
|
|
244
|
+
throw o.create("bad-app-name", {
|
|
245
|
+
appName: String(n)
|
|
246
|
+
});
|
|
247
|
+
if (t || (t = S()), !t)
|
|
248
|
+
throw o.create(
|
|
249
|
+
"no-options"
|
|
250
|
+
/* AppError.NO_OPTIONS */
|
|
251
|
+
);
|
|
252
|
+
const s = l.get(n);
|
|
253
|
+
if (s)
|
|
254
|
+
if (D(t, s.options)) {
|
|
255
|
+
if (D(r, s.config))
|
|
256
|
+
return s;
|
|
257
|
+
throw o.create("duplicate-app", {
|
|
258
|
+
appName: n,
|
|
259
|
+
mismatchedParam: "config",
|
|
260
|
+
oldValue: JSON.stringify(s.config),
|
|
261
|
+
newValue: JSON.stringify(r)
|
|
262
|
+
});
|
|
263
|
+
} else
|
|
264
|
+
throw o.create("duplicate-app", {
|
|
265
|
+
appName: n,
|
|
266
|
+
mismatchedParam: "options",
|
|
267
|
+
oldValue: JSON.stringify(s.options),
|
|
268
|
+
newValue: JSON.stringify(t)
|
|
269
|
+
});
|
|
270
|
+
const i = new B(n);
|
|
271
|
+
for (const _ of g.values())
|
|
272
|
+
i.addComponent(_);
|
|
273
|
+
const w = new me(t, r, i);
|
|
274
|
+
return l.set(n, w), w;
|
|
275
|
+
}
|
|
276
|
+
function Be(a = b) {
|
|
277
|
+
const e = l.get(a);
|
|
278
|
+
if (!e && a === b && S())
|
|
279
|
+
return be();
|
|
280
|
+
if (!e)
|
|
281
|
+
throw o.create("no-app", { appName: a });
|
|
282
|
+
return e;
|
|
283
|
+
}
|
|
284
|
+
function d(a, e, t) {
|
|
285
|
+
let r = le[a] ?? a;
|
|
286
|
+
t && (r += `-${t}`);
|
|
287
|
+
const n = r.match(/\s|\//), s = e.match(/\s|\//);
|
|
288
|
+
if (n || s) {
|
|
289
|
+
const i = [
|
|
290
|
+
`Unable to register library "${r}" with version "${e}":`
|
|
291
|
+
];
|
|
292
|
+
n && i.push(`library name "${r}" contains illegal characters (whitespace or "/")`), n && s && i.push("and"), s && i.push(`version name "${e}" contains illegal characters (whitespace or "/")`), c.warn(i.join(" "));
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
u(new p(
|
|
296
|
+
`${r}-version`,
|
|
297
|
+
() => ({ library: r, version: e }),
|
|
298
|
+
"VERSION"
|
|
299
|
+
/* ComponentType.VERSION */
|
|
300
|
+
));
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* @license
|
|
304
|
+
* Copyright 2021 Google LLC
|
|
305
|
+
*
|
|
306
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
307
|
+
* you may not use this file except in compliance with the License.
|
|
308
|
+
* You may obtain a copy of the License at
|
|
309
|
+
*
|
|
310
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
311
|
+
*
|
|
312
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
313
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
314
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
315
|
+
* See the License for the specific language governing permissions and
|
|
316
|
+
* limitations under the License.
|
|
317
|
+
*/
|
|
318
|
+
const ge = "firebase-heartbeat-database", ue = 1, h = "firebase-heartbeat-store";
|
|
319
|
+
let f = null;
|
|
320
|
+
function x() {
|
|
321
|
+
return f || (f = R(ge, ue, {
|
|
322
|
+
upgrade: (a, e) => {
|
|
323
|
+
switch (e) {
|
|
324
|
+
case 0:
|
|
325
|
+
try {
|
|
326
|
+
a.createObjectStore(h);
|
|
327
|
+
} catch (t) {
|
|
328
|
+
console.warn(t);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}).catch((a) => {
|
|
333
|
+
throw o.create("idb-open", {
|
|
334
|
+
originalErrorMessage: a.message
|
|
335
|
+
});
|
|
336
|
+
})), f;
|
|
337
|
+
}
|
|
338
|
+
async function we(a) {
|
|
339
|
+
try {
|
|
340
|
+
const t = (await x()).transaction(h), r = await t.objectStore(h).get(N(a));
|
|
341
|
+
return await t.done, r;
|
|
342
|
+
} catch (e) {
|
|
343
|
+
if (e instanceof A)
|
|
344
|
+
c.warn(e.message);
|
|
345
|
+
else {
|
|
346
|
+
const t = o.create("idb-get", {
|
|
347
|
+
originalErrorMessage: e == null ? void 0 : e.message
|
|
348
|
+
});
|
|
349
|
+
c.warn(t.message);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
async function y(a, e) {
|
|
354
|
+
try {
|
|
355
|
+
const r = (await x()).transaction(h, "readwrite");
|
|
356
|
+
await r.objectStore(h).put(e, N(a)), await r.done;
|
|
357
|
+
} catch (t) {
|
|
358
|
+
if (t instanceof A)
|
|
359
|
+
c.warn(t.message);
|
|
360
|
+
else {
|
|
361
|
+
const r = o.create("idb-set", {
|
|
362
|
+
originalErrorMessage: t == null ? void 0 : t.message
|
|
363
|
+
});
|
|
364
|
+
c.warn(r.message);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
function N(a) {
|
|
369
|
+
return `${a.name}!${a.options.appId}`;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* @license
|
|
373
|
+
* Copyright 2021 Google LLC
|
|
374
|
+
*
|
|
375
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
376
|
+
* you may not use this file except in compliance with the License.
|
|
377
|
+
* You may obtain a copy of the License at
|
|
378
|
+
*
|
|
379
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
380
|
+
*
|
|
381
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
382
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
383
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
384
|
+
* See the License for the specific language governing permissions and
|
|
385
|
+
* limitations under the License.
|
|
386
|
+
*/
|
|
387
|
+
const _e = 1024, De = 30;
|
|
388
|
+
class Ee {
|
|
389
|
+
constructor(e) {
|
|
390
|
+
this.container = e, this._heartbeatsCache = null;
|
|
391
|
+
const t = this.container.getProvider("app").getImmediate();
|
|
392
|
+
this._storage = new ye(t), this._heartbeatsCachePromise = this._storage.read().then((r) => (this._heartbeatsCache = r, r));
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Called to report a heartbeat. The function will generate
|
|
396
|
+
* a HeartbeatsByUserAgent object, update heartbeatsCache, and persist it
|
|
397
|
+
* to IndexedDB.
|
|
398
|
+
* Note that we only store one heartbeat per day. So if a heartbeat for today is
|
|
399
|
+
* already logged, subsequent calls to this function in the same day will be ignored.
|
|
400
|
+
*/
|
|
401
|
+
async triggerHeartbeat() {
|
|
402
|
+
var e, t;
|
|
403
|
+
try {
|
|
404
|
+
const n = this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(), s = C();
|
|
405
|
+
if (((e = this._heartbeatsCache) == null ? void 0 : e.heartbeats) == null && (this._heartbeatsCache = await this._heartbeatsCachePromise, ((t = this._heartbeatsCache) == null ? void 0 : t.heartbeats) == null) || this._heartbeatsCache.lastSentHeartbeatDate === s || this._heartbeatsCache.heartbeats.some((i) => i.date === s))
|
|
406
|
+
return;
|
|
407
|
+
if (this._heartbeatsCache.heartbeats.push({ date: s, agent: n }), this._heartbeatsCache.heartbeats.length > De) {
|
|
408
|
+
const i = Ce(this._heartbeatsCache.heartbeats);
|
|
409
|
+
this._heartbeatsCache.heartbeats.splice(i, 1);
|
|
410
|
+
}
|
|
411
|
+
return this._storage.overwrite(this._heartbeatsCache);
|
|
412
|
+
} catch (r) {
|
|
413
|
+
c.warn(r);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Returns a base64 encoded string which can be attached to the heartbeat-specific header directly.
|
|
418
|
+
* It also clears all heartbeats from memory as well as in IndexedDB.
|
|
419
|
+
*
|
|
420
|
+
* NOTE: Consuming product SDKs should not send the header if this method
|
|
421
|
+
* returns an empty string.
|
|
422
|
+
*/
|
|
423
|
+
async getHeartbeatsHeader() {
|
|
424
|
+
var e;
|
|
425
|
+
try {
|
|
426
|
+
if (this._heartbeatsCache === null && await this._heartbeatsCachePromise, ((e = this._heartbeatsCache) == null ? void 0 : e.heartbeats) == null || this._heartbeatsCache.heartbeats.length === 0)
|
|
427
|
+
return "";
|
|
428
|
+
const t = C(), { heartbeatsToSend: r, unsentEntries: n } = $e(this._heartbeatsCache.heartbeats), s = I(JSON.stringify({ version: 2, heartbeats: r }));
|
|
429
|
+
return this._heartbeatsCache.lastSentHeartbeatDate = t, n.length > 0 ? (this._heartbeatsCache.heartbeats = n, await this._storage.overwrite(this._heartbeatsCache)) : (this._heartbeatsCache.heartbeats = [], this._storage.overwrite(this._heartbeatsCache)), s;
|
|
430
|
+
} catch (t) {
|
|
431
|
+
return c.warn(t), "";
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
function C() {
|
|
436
|
+
return (/* @__PURE__ */ new Date()).toISOString().substring(0, 10);
|
|
437
|
+
}
|
|
438
|
+
function $e(a, e = _e) {
|
|
439
|
+
const t = [];
|
|
440
|
+
let r = a.slice();
|
|
441
|
+
for (const n of a) {
|
|
442
|
+
const s = t.find((i) => i.agent === n.agent);
|
|
443
|
+
if (s) {
|
|
444
|
+
if (s.dates.push(n.date), v(t) > e) {
|
|
445
|
+
s.dates.pop();
|
|
446
|
+
break;
|
|
447
|
+
}
|
|
448
|
+
} else if (t.push({
|
|
449
|
+
agent: n.agent,
|
|
450
|
+
dates: [n.date]
|
|
451
|
+
}), v(t) > e) {
|
|
452
|
+
t.pop();
|
|
453
|
+
break;
|
|
454
|
+
}
|
|
455
|
+
r = r.slice(1);
|
|
456
|
+
}
|
|
457
|
+
return {
|
|
458
|
+
heartbeatsToSend: t,
|
|
459
|
+
unsentEntries: r
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
class ye {
|
|
463
|
+
constructor(e) {
|
|
464
|
+
this.app = e, this._canUseIndexedDBPromise = this.runIndexedDBEnvironmentCheck();
|
|
465
|
+
}
|
|
466
|
+
async runIndexedDBEnvironmentCheck() {
|
|
467
|
+
return O() ? F().then(() => !0).catch(() => !1) : !1;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Read all heartbeats.
|
|
471
|
+
*/
|
|
472
|
+
async read() {
|
|
473
|
+
if (await this._canUseIndexedDBPromise) {
|
|
474
|
+
const t = await we(this.app);
|
|
475
|
+
return t != null && t.heartbeats ? t : { heartbeats: [] };
|
|
476
|
+
} else
|
|
477
|
+
return { heartbeats: [] };
|
|
478
|
+
}
|
|
479
|
+
// overwrite the storage with the provided heartbeats
|
|
480
|
+
async overwrite(e) {
|
|
481
|
+
if (await this._canUseIndexedDBPromise) {
|
|
482
|
+
const r = await this.read();
|
|
483
|
+
return y(this.app, {
|
|
484
|
+
lastSentHeartbeatDate: e.lastSentHeartbeatDate ?? r.lastSentHeartbeatDate,
|
|
485
|
+
heartbeats: e.heartbeats
|
|
486
|
+
});
|
|
487
|
+
} else
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
// add heartbeats
|
|
491
|
+
async add(e) {
|
|
492
|
+
if (await this._canUseIndexedDBPromise) {
|
|
493
|
+
const r = await this.read();
|
|
494
|
+
return y(this.app, {
|
|
495
|
+
lastSentHeartbeatDate: e.lastSentHeartbeatDate ?? r.lastSentHeartbeatDate,
|
|
496
|
+
heartbeats: [
|
|
497
|
+
...r.heartbeats,
|
|
498
|
+
...e.heartbeats
|
|
499
|
+
]
|
|
500
|
+
});
|
|
501
|
+
} else
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
function v(a) {
|
|
506
|
+
return I(
|
|
507
|
+
// heartbeatsCache wrapper properties
|
|
508
|
+
JSON.stringify({ version: 2, heartbeats: a })
|
|
509
|
+
).length;
|
|
510
|
+
}
|
|
511
|
+
function Ce(a) {
|
|
512
|
+
if (a.length === 0)
|
|
513
|
+
return -1;
|
|
514
|
+
let e = 0, t = a[0].date;
|
|
515
|
+
for (let r = 1; r < a.length; r++)
|
|
516
|
+
a[r].date < t && (t = a[r].date, e = r);
|
|
517
|
+
return e;
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* @license
|
|
521
|
+
* Copyright 2019 Google LLC
|
|
522
|
+
*
|
|
523
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
524
|
+
* you may not use this file except in compliance with the License.
|
|
525
|
+
* You may obtain a copy of the License at
|
|
526
|
+
*
|
|
527
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
528
|
+
*
|
|
529
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
530
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
531
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
532
|
+
* See the License for the specific language governing permissions and
|
|
533
|
+
* limitations under the License.
|
|
534
|
+
*/
|
|
535
|
+
function ve(a) {
|
|
536
|
+
u(new p(
|
|
537
|
+
"platform-logger",
|
|
538
|
+
(e) => new M(e),
|
|
539
|
+
"PRIVATE"
|
|
540
|
+
/* ComponentType.PRIVATE */
|
|
541
|
+
)), u(new p(
|
|
542
|
+
"heartbeat",
|
|
543
|
+
(e) => new Ee(e),
|
|
544
|
+
"PRIVATE"
|
|
545
|
+
/* ComponentType.PRIVATE */
|
|
546
|
+
)), d(m, E, a), d(m, E, "esm2020"), d("fire-js", "");
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* @license
|
|
550
|
+
* Copyright 2019 Google LLC
|
|
551
|
+
*
|
|
552
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
553
|
+
* you may not use this file except in compliance with the License.
|
|
554
|
+
* You may obtain a copy of the License at
|
|
555
|
+
*
|
|
556
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
557
|
+
*
|
|
558
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
559
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
560
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
561
|
+
* See the License for the specific language governing permissions and
|
|
562
|
+
* limitations under the License.
|
|
563
|
+
*/
|
|
564
|
+
ve("");
|
|
565
|
+
export {
|
|
566
|
+
A as FirebaseError,
|
|
567
|
+
b as _DEFAULT_ENTRY_NAME,
|
|
568
|
+
$ as _addComponent,
|
|
569
|
+
l as _apps,
|
|
570
|
+
g as _components,
|
|
571
|
+
Ne as _getProvider,
|
|
572
|
+
u as _registerComponent,
|
|
573
|
+
de as _serverApps,
|
|
574
|
+
Be as getApp,
|
|
575
|
+
be as initializeApp,
|
|
576
|
+
d as registerVersion
|
|
577
|
+
};
|