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.
Files changed (29) hide show
  1. package/dist/bt-core/core/node_modules/@firebase/app/dist/esm/index.esm.mjs +577 -0
  2. package/dist/bt-core/core/node_modules/@firebase/component/dist/esm/index.esm.mjs +275 -0
  3. package/dist/bt-core/core/node_modules/@firebase/installations/dist/esm/index.esm.mjs +763 -0
  4. package/dist/bt-core/core/node_modules/@firebase/logger/dist/esm/index.esm.mjs +101 -0
  5. package/dist/bt-core/core/node_modules/@firebase/messaging/dist/esm/index.esm.mjs +1278 -0
  6. package/dist/bt-core/core/node_modules/@firebase/util/dist/index.esm.mjs +444 -0
  7. package/dist/bt-core/core/node_modules/@firebase/util/dist/postinstall.mjs +5 -0
  8. package/dist/bt-core/core/node_modules/@mdi/js/mdi.mjs +60 -59
  9. package/dist/bt-core/core/node_modules/firebase/app/dist/esm/index.esm.mjs +32 -0
  10. package/dist/bt-core/core/node_modules/idb/build/index.mjs +58 -0
  11. package/dist/bt-core/core/node_modules/idb/build/wrap-idb-value.mjs +101 -0
  12. package/dist/components/BT-Blade-Steps.vue.mjs +2 -2
  13. package/dist/components/BT-Blade-Steps.vue2.mjs +4 -4
  14. package/dist/components/BT-Firebase-Notification.vue.d.ts +2 -0
  15. package/dist/components/BT-Firebase-Notification.vue.mjs +106 -0
  16. package/dist/components/BT-Firebase-Notification.vue2.mjs +4 -0
  17. package/dist/components.mjs +18 -16
  18. package/dist/composables/devices.d.ts +1 -0
  19. package/dist/composables/devices.mjs +12 -7
  20. package/dist/composables/firebase.d.ts +29 -0
  21. package/dist/composables/firebase.mjs +80 -0
  22. package/dist/composables/icons.mjs +58 -57
  23. package/dist/composables.mjs +200 -195
  24. package/dist/core.d.ts +2 -0
  25. package/dist/core2.mjs +89 -88
  26. package/dist/index-components.d.ts +2 -1
  27. package/dist/index-composables.d.ts +3 -1
  28. package/dist/style.css +1 -1
  29. package/package.json +2 -1
@@ -0,0 +1,32 @@
1
+ import { registerVersion as e } from "../../../../@firebase/app/dist/esm/index.esm.mjs";
2
+ import { _DEFAULT_ENTRY_NAME as n, _addComponent as s, _apps as _, _components as a, _getProvider as m, _registerComponent as v, _serverApps as A, getApp as g, initializeApp as d } from "../../../../@firebase/app/dist/esm/index.esm.mjs";
3
+ var r = "firebase", p = "12.19.0";
4
+ /**
5
+ * @license
6
+ * Copyright 2020 Google LLC
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */
20
+ e(r, p, "app");
21
+ export {
22
+ n as _DEFAULT_ENTRY_NAME,
23
+ s as _addComponent,
24
+ _ as _apps,
25
+ a as _components,
26
+ m as _getProvider,
27
+ v as _registerComponent,
28
+ A as _serverApps,
29
+ g as getApp,
30
+ d as initializeApp,
31
+ e as registerVersion
32
+ };
@@ -0,0 +1,58 @@
1
+ import { r as h, w as u } from "./wrap-idb-value.mjs";
2
+ import { u as y } from "./wrap-idb-value.mjs";
3
+ function g(s, e, { blocked: t, upgrade: i, blocking: d, terminated: a } = {}) {
4
+ const o = indexedDB.open(s, e), c = u(o);
5
+ return i && o.addEventListener("upgradeneeded", (n) => {
6
+ i(u(o.result), n.oldVersion, n.newVersion, u(o.transaction), n);
7
+ }), t && o.addEventListener("blocked", (n) => t(
8
+ // Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405
9
+ n.oldVersion,
10
+ n.newVersion,
11
+ n
12
+ )), c.then((n) => {
13
+ a && n.addEventListener("close", () => a()), d && n.addEventListener("versionchange", (r) => d(r.oldVersion, r.newVersion, r));
14
+ }).catch(() => {
15
+ }), c;
16
+ }
17
+ function m(s, { blocked: e } = {}) {
18
+ const t = indexedDB.deleteDatabase(s);
19
+ return e && t.addEventListener("blocked", (i) => e(
20
+ // Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405
21
+ i.oldVersion,
22
+ i
23
+ )), u(t).then(() => {
24
+ });
25
+ }
26
+ const w = ["get", "getKey", "getAll", "getAllKeys", "count"], x = ["put", "add", "delete", "clear"], f = /* @__PURE__ */ new Map();
27
+ function l(s, e) {
28
+ if (!(s instanceof IDBDatabase && !(e in s) && typeof e == "string"))
29
+ return;
30
+ if (f.get(e))
31
+ return f.get(e);
32
+ const t = e.replace(/FromIndex$/, ""), i = e !== t, d = x.includes(t);
33
+ if (
34
+ // Bail if the target doesn't exist on the target. Eg, getAll isn't in Edge.
35
+ !(t in (i ? IDBIndex : IDBObjectStore).prototype) || !(d || w.includes(t))
36
+ )
37
+ return;
38
+ const a = async function(o, ...c) {
39
+ const n = this.transaction(o, d ? "readwrite" : "readonly");
40
+ let r = n.store;
41
+ return i && (r = r.index(c.shift())), (await Promise.all([
42
+ r[t](...c),
43
+ d && n.done
44
+ ]))[0];
45
+ };
46
+ return f.set(e, a), a;
47
+ }
48
+ h((s) => ({
49
+ ...s,
50
+ get: (e, t, i) => l(e, t) || s.get(e, t, i),
51
+ has: (e, t) => !!l(e, t) || s.has(e, t)
52
+ }));
53
+ export {
54
+ m as deleteDB,
55
+ g as openDB,
56
+ y as unwrap,
57
+ u as wrap
58
+ };
@@ -0,0 +1,101 @@
1
+ const I = (e, n) => n.some((r) => e instanceof r);
2
+ let m, D;
3
+ function h() {
4
+ return m || (m = [
5
+ IDBDatabase,
6
+ IDBObjectStore,
7
+ IDBIndex,
8
+ IDBCursor,
9
+ IDBTransaction
10
+ ]);
11
+ }
12
+ function B() {
13
+ return D || (D = [
14
+ IDBCursor.prototype.advance,
15
+ IDBCursor.prototype.continue,
16
+ IDBCursor.prototype.continuePrimaryKey
17
+ ]);
18
+ }
19
+ const b = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap();
20
+ function w(e) {
21
+ const n = new Promise((r, o) => {
22
+ const s = () => {
23
+ e.removeEventListener("success", i), e.removeEventListener("error", t);
24
+ }, i = () => {
25
+ r(c(e.result)), s();
26
+ }, t = () => {
27
+ o(e.error), s();
28
+ };
29
+ e.addEventListener("success", i), e.addEventListener("error", t);
30
+ });
31
+ return n.then((r) => {
32
+ r instanceof IDBCursor && b.set(r, e);
33
+ }).catch(() => {
34
+ }), d.set(n, e), n;
35
+ }
36
+ function E(e) {
37
+ if (f.has(e))
38
+ return;
39
+ const n = new Promise((r, o) => {
40
+ const s = () => {
41
+ e.removeEventListener("complete", i), e.removeEventListener("error", t), e.removeEventListener("abort", t);
42
+ }, i = () => {
43
+ r(), s();
44
+ }, t = () => {
45
+ o(e.error || new DOMException("AbortError", "AbortError")), s();
46
+ };
47
+ e.addEventListener("complete", i), e.addEventListener("error", t), e.addEventListener("abort", t);
48
+ });
49
+ f.set(e, n);
50
+ }
51
+ let p = {
52
+ get(e, n, r) {
53
+ if (e instanceof IDBTransaction) {
54
+ if (n === "done")
55
+ return f.get(e);
56
+ if (n === "objectStoreNames")
57
+ return e.objectStoreNames || y.get(e);
58
+ if (n === "store")
59
+ return r.objectStoreNames[1] ? void 0 : r.objectStore(r.objectStoreNames[0]);
60
+ }
61
+ return c(e[n]);
62
+ },
63
+ set(e, n, r) {
64
+ return e[n] = r, !0;
65
+ },
66
+ has(e, n) {
67
+ return e instanceof IDBTransaction && (n === "done" || n === "store") ? !0 : n in e;
68
+ }
69
+ };
70
+ function L(e) {
71
+ p = e(p);
72
+ }
73
+ function M(e) {
74
+ return e === IDBDatabase.prototype.transaction && !("objectStoreNames" in IDBTransaction.prototype) ? function(n, ...r) {
75
+ const o = e.call(u(this), n, ...r);
76
+ return y.set(o, n.sort ? n.sort() : [n]), c(o);
77
+ } : B().includes(e) ? function(...n) {
78
+ return e.apply(u(this), n), c(b.get(this));
79
+ } : function(...n) {
80
+ return c(e.apply(u(this), n));
81
+ };
82
+ }
83
+ function T(e) {
84
+ return typeof e == "function" ? M(e) : (e instanceof IDBTransaction && E(e), I(e, h()) ? new Proxy(e, p) : e);
85
+ }
86
+ function c(e) {
87
+ if (e instanceof IDBRequest)
88
+ return w(e);
89
+ if (a.has(e))
90
+ return a.get(e);
91
+ const n = T(e);
92
+ return n !== e && (a.set(e, n), d.set(n, e)), n;
93
+ }
94
+ const u = (e) => d.get(e);
95
+ export {
96
+ d as a,
97
+ I as i,
98
+ L as r,
99
+ u,
100
+ c as w
101
+ };
@@ -1,7 +1,7 @@
1
1
  import o from "./BT-Blade-Steps.vue2.mjs";
2
2
  import "./BT-Blade-Steps.vue3.mjs";
3
3
  import t from "../_virtual/_plugin-vue_export-helper.mjs";
4
- const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-b1f63fa9"]]);
4
+ const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-7e39cd32"]]);
5
5
  export {
6
- r as default
6
+ a as default
7
7
  };
@@ -406,7 +406,7 @@ const bt = {
406
406
  if (t != null) {
407
407
  S.value = he(t), ee();
408
408
  var a = ((m = k.value) == null ? void 0 : m.onSaveMoveNext) ?? 0;
409
- typeof a == "number" ? C(a) : typeof a == "boolean" && a == !0 && w();
409
+ typeof a == "number" ? (C(a), await l.refresh()) : typeof a == "boolean" && a == !0 && w();
410
410
  }
411
411
  }
412
412
  }
@@ -420,16 +420,16 @@ const bt = {
420
420
  C(0);
421
421
  }), lt(() => {
422
422
  var a;
423
- console.log("mounted"), we();
423
+ we();
424
424
  var t = (a = I == null ? void 0 : I.query) == null ? void 0 : a.step;
425
- t != null ? q(t) : (console.log("mm"), C(0)), ne(i.stepsID) || ct(i.stepsID, {
425
+ t != null ? q(t) : C(0), ne(i.stepsID) || ct(i.stepsID, {
426
426
  navBack: ce,
427
427
  navTo: C,
428
428
  navToName: q,
429
429
  nextStep: w
430
430
  });
431
431
  }), at(() => {
432
- console.log("unmounte"), ne(i.stepsID) || pt(i.stepsID);
432
+ ne(i.stepsID) || pt(i.stepsID);
433
433
  }), (t, a) => {
434
434
  const m = Ae("bt-header-option"), $ = Ae("bt-blade");
435
435
  return o(), u($, {
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,106 @@
1
+ import { defineComponent as P, ref as c, onMounted as V, computed as v, resolveComponent as t, openBlock as u, createBlock as d, withCtx as n, createVNode as o, createTextVNode as a, createCommentVNode as f } from "vue";
2
+ import { useFirebase as E } from "../composables/firebase.mjs";
3
+ const M = /* @__PURE__ */ P({
4
+ __name: "BT-Firebase-Notification",
5
+ setup(F) {
6
+ const s = E(), r = c("default"), l = c(!1), m = c(!1);
7
+ V(() => {
8
+ typeof window < "u" && "Notification" in window && (r.value = Notification.permission);
9
+ });
10
+ const w = v(() => !(m.value || r.value === "granted")), _ = v(() => r.value === "denied");
11
+ async function b() {
12
+ if (!("Notification" in window)) {
13
+ alert("This browser does not support desktop notifications.");
14
+ return;
15
+ }
16
+ l.value = !0;
17
+ try {
18
+ const i = await Notification.requestPermission();
19
+ r.value = i, i === "granted" ? (console.log("Notification permission granted."), s && s.initiate && await s.initiate()) : console.log("Notification permission denied.");
20
+ } catch (i) {
21
+ console.error("Error requesting notification permission:", i);
22
+ } finally {
23
+ l.value = !1;
24
+ }
25
+ }
26
+ function y() {
27
+ m.value = !0;
28
+ }
29
+ return (i, e) => {
30
+ const N = t("v-icon"), g = t("v-card-title"), x = t("v-card-subtitle"), k = t("v-card-item"), C = t("v-card-text"), B = t("v-spacer"), p = t("v-btn"), T = t("v-card-actions"), q = t("v-card");
31
+ return w.value ? (u(), d(q, {
32
+ key: 0,
33
+ class: "mx-auto my-4",
34
+ "max-width": "400",
35
+ variant: "outlined"
36
+ }, {
37
+ default: n(() => [
38
+ o(k, null, {
39
+ prepend: n(() => [
40
+ o(N, {
41
+ icon: "$bell-ring",
42
+ color: "primary",
43
+ size: "large"
44
+ })
45
+ ]),
46
+ default: n(() => [
47
+ o(g, null, {
48
+ default: n(() => e[0] || (e[0] = [
49
+ a("Enable Notifications")
50
+ ])),
51
+ _: 1
52
+ }),
53
+ o(x, null, {
54
+ default: n(() => e[1] || (e[1] = [
55
+ a("Stay updated with the latest alerts and updates.")
56
+ ])),
57
+ _: 1
58
+ })
59
+ ]),
60
+ _: 1
61
+ }),
62
+ _.value ? (u(), d(C, {
63
+ key: 0,
64
+ class: "text-error text-caption"
65
+ }, {
66
+ default: n(() => e[2] || (e[2] = [
67
+ a(" Notifications are blocked in your browser settings. Please enable them manually in your browser address bar. ")
68
+ ])),
69
+ _: 1
70
+ })) : f("", !0),
71
+ o(T, null, {
72
+ default: n(() => [
73
+ o(B),
74
+ _.value ? f("", !0) : (u(), d(p, {
75
+ key: 0,
76
+ color: "primary",
77
+ variant: "flat",
78
+ loading: l.value,
79
+ onClick: b
80
+ }, {
81
+ default: n(() => e[3] || (e[3] = [
82
+ a(" Turn On ")
83
+ ])),
84
+ _: 1
85
+ }, 8, ["loading"])),
86
+ o(p, {
87
+ variant: "text",
88
+ onClick: y
89
+ }, {
90
+ default: n(() => e[4] || (e[4] = [
91
+ a(" Not Now ")
92
+ ])),
93
+ _: 1
94
+ })
95
+ ]),
96
+ _: 1
97
+ })
98
+ ]),
99
+ _: 1
100
+ })) : f("", !0);
101
+ };
102
+ }
103
+ });
104
+ export {
105
+ M as default
106
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./BT-Firebase-Notification.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -2,37 +2,39 @@ import { default as r } from "./components/BT-Assistant-Menu.vue.mjs";
2
2
  import { default as t } from "./components/BT-Banner.vue.mjs";
3
3
  import { default as l } from "./components/BT-Blade-Steps.vue.mjs";
4
4
  import { default as u } from "./components/BT-Cron-Span.vue.mjs";
5
- import { default as p } from "./components/BT-Date-Select.vue.mjs";
5
+ import { default as d } from "./components/BT-Date-Select.vue.mjs";
6
6
  import { default as B } from "./components/BT-Dialog-Confirm.vue.mjs";
7
7
  import { default as x } from "./components/BT-Dialog-Select.vue.mjs";
8
8
  import { default as S } from "./components/BT-Dialog-Number.vue.mjs";
9
9
  import { default as c } from "./components/BT-Dialog-Date.vue.mjs";
10
10
  import { default as F } from "./components/BT-Demo-Profile-Select.vue.mjs";
11
11
  import { default as C } from "./components/BT-Color-Picker-Menu.vue.mjs";
12
- import { default as M } from "./components/BT-Form.vue.mjs";
13
- import { default as b } from "./components/BT-Form-Builder.vue.mjs";
14
- import { default as q } from "./components/BT-Form-Field.vue.mjs";
15
- import { default as N } from "./components/BT-Square-Check.vue.mjs";
16
- import { default as v } from "./components/BT-Select-Simple.vue.mjs";
17
- import { default as y } from "./components/BT-Field-Select-Simple.vue.mjs";
18
- import { default as E } from "./components/BT-Tour.vue.mjs";
12
+ import { default as k } from "./components/BT-Firebase-Notification.vue.mjs";
13
+ import { default as N } from "./components/BT-Form.vue.mjs";
14
+ import { default as h } from "./components/BT-Form-Builder.vue.mjs";
15
+ import { default as A } from "./components/BT-Form-Field.vue.mjs";
16
+ import { default as v } from "./components/BT-Square-Check.vue.mjs";
17
+ import { default as y } from "./components/BT-Select-Simple.vue.mjs";
18
+ import { default as E } from "./components/BT-Field-Select-Simple.vue.mjs";
19
+ import { default as H } from "./components/BT-Tour.vue.mjs";
19
20
  export {
20
21
  r as BTAssistantMenu,
21
22
  t as BTBanner,
22
23
  l as BTBladeSteps,
23
24
  C as BTColorPickerMenu,
24
25
  u as BTCronSpan,
25
- p as BTDateSelect,
26
+ d as BTDateSelect,
26
27
  F as BTDemoProfileSelect,
27
28
  B as BTDialogConfirm,
28
29
  c as BTDialogDate,
29
30
  S as BTDialogNumber,
30
31
  x as BTDialogSelect,
31
- y as BTFieldSelectSimple,
32
- M as BTForm,
33
- b as BTFormBuilder,
34
- q as BTFormField,
35
- v as BTSelectSimple,
36
- N as BTSquareCheck,
37
- E as BTTour
32
+ E as BTFieldSelectSimple,
33
+ k as BTFirebaseNotification,
34
+ N as BTForm,
35
+ h as BTFormBuilder,
36
+ A as BTFormField,
37
+ y as BTSelectSimple,
38
+ v as BTSquareCheck,
39
+ H as BTTour
38
40
  };
@@ -4,3 +4,4 @@ export declare function getDeviceInfo(): {
4
4
  isMac: boolean;
5
5
  isDesktop: boolean;
6
6
  };
7
+ export declare function getDetailedDeviceType(): "mac-app-store" | "apple-app-store-ios" | "android-app-store" | "windows-desktop" | "web-ios" | "android-web" | "mac-web";
@@ -1,12 +1,17 @@
1
- function t() {
2
- const i = navigator.userAgent;
1
+ function c() {
2
+ const t = navigator.userAgent;
3
3
  return {
4
- isIPhone: /iPhone/i.test(i),
5
- isAndroid: /Android/i.test(i),
6
- isMac: /Macintosh/i.test(i) && !/iPhone|iPad/i.test(i),
7
- isDesktop: !/Mobi|Android|iPhone|iPad|iPod/i.test(i)
4
+ isIPhone: /iPhone/i.test(t),
5
+ isAndroid: /Android/i.test(t),
6
+ isMac: /Macintosh/i.test(t) && !/iPhone|iPad/i.test(t),
7
+ isDesktop: !/Mobi|Android|iPhone|iPad|iPod/i.test(t)
8
8
  };
9
9
  }
10
+ function p() {
11
+ const t = navigator.userAgent, s = document.referrer, r = /PWAShell/i.test(t) || document.cookie.includes("iOS App Store"), a = s.startsWith("android-app://"), e = /iPhone/i.test(t), o = /iPad/i.test(t) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, n = /Android/i.test(t), i = /Macintosh|MacIntel/i.test(t) && !e && !o, d = /Windows/i.test(t);
12
+ return r ? i ? "mac-app-store" : "apple-app-store-ios" : n && a ? "android-app-store" : d ? "windows-desktop" : i && window.matchMedia("(display-mode: standalone)").matches ? "mac-app-store" : e || o ? "web-ios" : n ? "android-web" : i ? "mac-web" : "windows-desktop";
13
+ }
10
14
  export {
11
- t as getDeviceInfo
15
+ p as getDetailedDeviceType,
16
+ c as getDeviceInfo
12
17
  };
@@ -0,0 +1,29 @@
1
+ import { Messaging, MessagePayload } from 'firebase/messaging';
2
+ import { FirebaseApp } from 'firebase/app';
3
+
4
+ export interface FirebaseConfig {
5
+ apiKey?: string;
6
+ authDomain?: string;
7
+ projectID?: string;
8
+ storageBucket?: string;
9
+ messagingSenderID?: string;
10
+ appID?: string;
11
+ }
12
+ export interface CreateFirebaseOptions {
13
+ config: FirebaseConfig;
14
+ finalRegisterURL?: string;
15
+ finalUnregisterURL?: string;
16
+ registerUrl?: string;
17
+ unregisterURL?: string;
18
+ vapidPublicKey?: string;
19
+ }
20
+ export interface BTFirebase {
21
+ actionLoadingMsg: any;
22
+ app: FirebaseApp;
23
+ messaging: Messaging;
24
+ initiate: () => Promise<void>;
25
+ unregister: () => Promise<void>;
26
+ }
27
+ export declare function useFirebaseListener(handler?: (payload: MessagePayload) => void): void;
28
+ export declare function useFirebase(): BTFirebase;
29
+ export declare function createFirebase(options: CreateFirebaseOptions): BTFirebase;
@@ -0,0 +1,80 @@
1
+ import { ref as w } from "vue";
2
+ import { useActions as R } from "./actions.mjs";
3
+ import { appendUrl as o } from "./helpers.mjs";
4
+ import { useDataUrl as f } from "./urls.mjs";
5
+ import "../bt-core/core/node_modules/firebase/app/dist/esm/index.esm.mjs";
6
+ import { getMessaging as v, onRegistered as F, onUnregistered as h, onMessage as L, register as D, unregister as E } from "../bt-core/core/node_modules/@firebase/messaging/dist/esm/index.esm.mjs";
7
+ import { getDetailedDeviceType as u } from "./devices.mjs";
8
+ import { initializeApp as M } from "../bt-core/core/node_modules/@firebase/app/dist/esm/index.esm.mjs";
9
+ let s, g;
10
+ function p(e) {
11
+ g = e;
12
+ }
13
+ function q() {
14
+ return s;
15
+ }
16
+ function x(e) {
17
+ const { actionLoadingMsg: d, apiPost: c } = R();
18
+ var t = "", a = "";
19
+ (e == null ? void 0 : e.finalRegisterURL) != null ? t = e.finalRegisterURL : t = o(f(), (e == null ? void 0 : e.registerUrl) ?? "FirebaseNotifications/Register"), (e == null ? void 0 : e.finalUnregisterURL) != null ? a = e.finalUnregisterURL : a = o(f(), (e == null ? void 0 : e.unregisterURL) ?? "FirebaseNotifications/Unregister");
20
+ const l = M(e.config), i = v(l), m = w(typeof window < "u" && "Notification" in window ? Notification.permission : "default");
21
+ async function U() {
22
+ F(i, async (r) => {
23
+ console.log("Firebase Installation ID received:", r);
24
+ try {
25
+ await c({
26
+ data: {
27
+ token: r,
28
+ deviceType: u()
29
+ },
30
+ finalUrl: t,
31
+ throwError: !0
32
+ });
33
+ } catch (n) {
34
+ console.log("firebase initiation error"), console.log(n);
35
+ }
36
+ }), h(i, async (r) => {
37
+ console.log("Firebase Installation ID unregistered:", r);
38
+ try {
39
+ await c({
40
+ data: {
41
+ token: r,
42
+ deviceType: u()
43
+ },
44
+ finalUrl: a,
45
+ throwError: !0
46
+ });
47
+ } catch (n) {
48
+ console.log("firebase backend unregister notification error", n);
49
+ }
50
+ }), L(i, (r) => {
51
+ g != null && g(r);
52
+ }), m.value === "granted" && await y();
53
+ }
54
+ async function y() {
55
+ try {
56
+ await D(i, { vapidKey: e.vapidPublicKey });
57
+ } catch (r) {
58
+ console.log("Error triggering firebase register:", r);
59
+ }
60
+ }
61
+ async function b() {
62
+ try {
63
+ await E(i), console.log("Successfully requested Firebase unregistration.");
64
+ } catch (r) {
65
+ throw console.log("Error calling firebase unregister:", r), r;
66
+ }
67
+ }
68
+ return s ?? (s = {
69
+ actionLoadingMsg: d,
70
+ app: l,
71
+ messaging: i,
72
+ initiate: U,
73
+ unregister: b
74
+ }), s;
75
+ }
76
+ export {
77
+ x as createFirebase,
78
+ q as useFirebase,
79
+ p as useFirebaseListener
80
+ };