svelte-firekit 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -20,7 +20,6 @@ export { FirekitRemoteConfig, firekitRemoteConfig, type FirekitRemoteConfigOptio
20
20
  export { firekitPerformance, type PerformanceTrace } from './services/performance.js';
21
21
  export { firekitMessaging, type MessagePayload } from './services/messaging.svelte.js';
22
22
  export { firekitAnalytics } from './services/analytics.js';
23
- export { firekitInAppMessaging } from './services/in-app-messaging.js';
24
23
  export { loadFirestoreBundle, getNamedQuery } from './services/bundles.js';
25
24
  export { default as FirebaseApp } from './components/FirebaseApp.svelte';
26
25
  export { default as SignedIn } from './components/SignedIn.svelte';
package/dist/index.js CHANGED
@@ -32,8 +32,6 @@ export { firekitPerformance } from './services/performance.js';
32
32
  export { firekitMessaging } from './services/messaging.svelte.js';
33
33
  // ─── Analytics ────────────────────────────────────────────────────────────────
34
34
  export { firekitAnalytics } from './services/analytics.js';
35
- // ─── In-App Messaging ─────────────────────────────────────────────────────────
36
- export { firekitInAppMessaging } from './services/in-app-messaging.js';
37
35
  // ─── Firestore bundles ────────────────────────────────────────────────────────
38
36
  export { loadFirestoreBundle, getNamedQuery } from './services/bundles.js';
39
37
  // ─── Components ──────────────────────────────────────────────────────────────
@@ -1,46 +1 @@
1
- /**
2
- * Reactive Firebase In-App Messaging service.
3
- *
4
- * In-App Messaging displays contextual messages to users while they are actively
5
- * using your app. Messages are configured in the Firebase console and triggered
6
- * by Analytics events. This service lets you control whether messages are shown.
7
- *
8
- * @example
9
- * ```ts
10
- * import { firekitInAppMessaging } from 'svelte-firekit';
11
- *
12
- * // Suppress messages during a critical flow (e.g. checkout)
13
- * firekitInAppMessaging.suppress();
14
- *
15
- * // Re-enable after the flow completes
16
- * firekitInAppMessaging.unsuppress();
17
- * ```
18
- */
19
- declare class FirekitInAppMessaging {
20
- private static instance;
21
- private _suppressed;
22
- private _supported;
23
- private _initialized;
24
- private _iam;
25
- private constructor();
26
- static getInstance(): FirekitInAppMessaging;
27
- get suppressed(): boolean;
28
- get supported(): boolean;
29
- get initialized(): boolean;
30
- private _init;
31
- /**
32
- * Suppresses all In-App Messaging messages.
33
- * Useful during critical flows such as checkout or sensitive forms.
34
- */
35
- suppress(): void;
36
- /**
37
- * Re-enables In-App Messaging after suppression.
38
- */
39
- unsuppress(): void;
40
- /**
41
- * Toggles suppression state.
42
- */
43
- toggleSuppression(): void;
44
- }
45
- export declare const firekitInAppMessaging: FirekitInAppMessaging;
46
1
  export {};
@@ -1,88 +1,4 @@
1
- import { getInAppMessaging, setMessagesDisplaySuppressed, isSupported } from 'firebase/in-app-messaging';
2
- import { firebaseService } from '../firebase.js';
3
- function getApp() {
4
- const app = firebaseService.getFirebaseApp();
5
- if (!app)
6
- throw new Error('Firebase app is not initialized.');
7
- return app;
8
- }
9
- /**
10
- * Reactive Firebase In-App Messaging service.
11
- *
12
- * In-App Messaging displays contextual messages to users while they are actively
13
- * using your app. Messages are configured in the Firebase console and triggered
14
- * by Analytics events. This service lets you control whether messages are shown.
15
- *
16
- * @example
17
- * ```ts
18
- * import { firekitInAppMessaging } from 'svelte-firekit';
19
- *
20
- * // Suppress messages during a critical flow (e.g. checkout)
21
- * firekitInAppMessaging.suppress();
22
- *
23
- * // Re-enable after the flow completes
24
- * firekitInAppMessaging.unsuppress();
25
- * ```
26
- */
27
- class FirekitInAppMessaging {
28
- static instance;
29
- _suppressed = $state(false);
30
- _supported = $state(false);
31
- _initialized = $state(false);
32
- _iam = null;
33
- constructor() {
34
- this._init();
35
- }
36
- static getInstance() {
37
- if (!FirekitInAppMessaging.instance) {
38
- FirekitInAppMessaging.instance = new FirekitInAppMessaging();
39
- }
40
- return FirekitInAppMessaging.instance;
41
- }
42
- get suppressed() { return this._suppressed; }
43
- get supported() { return this._supported; }
44
- get initialized() { return this._initialized; }
45
- async _init() {
46
- if (typeof window === 'undefined')
47
- return;
48
- try {
49
- const supported = await isSupported();
50
- this._supported = supported;
51
- if (!supported)
52
- return;
53
- this._iam = getInAppMessaging(getApp());
54
- // messagesDisplaySuppressed is a property on the InAppMessaging instance
55
- this._suppressed = this._iam.messagesDisplaySuppressed;
56
- this._initialized = true;
57
- }
58
- catch {
59
- // In-App Messaging is optional — failures are non-fatal
60
- }
61
- }
62
- /**
63
- * Suppresses all In-App Messaging messages.
64
- * Useful during critical flows such as checkout or sensitive forms.
65
- */
66
- suppress() {
67
- if (!this._iam)
68
- return;
69
- setMessagesDisplaySuppressed(this._iam, true);
70
- this._suppressed = true;
71
- }
72
- /**
73
- * Re-enables In-App Messaging after suppression.
74
- */
75
- unsuppress() {
76
- if (!this._iam)
77
- return;
78
- setMessagesDisplaySuppressed(this._iam, false);
79
- this._suppressed = false;
80
- }
81
- /**
82
- * Toggles suppression state.
83
- */
84
- toggleSuppression() {
85
- this._suppressed ? this.unsuppress() : this.suppress();
86
- }
87
- }
88
- export const firekitInAppMessaging = FirekitInAppMessaging.getInstance();
1
+ "use strict";
2
+ // Firebase In-App Messaging is not available in the Firebase JavaScript Web SDK.
3
+ // It is only supported on native mobile platforms (iOS/Android).
4
+ // This module is intentionally empty to prevent build errors in consumer projects.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-firekit",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "A Svelte library for Firebase integration",
5
5
  "license": "MIT",
6
6
  "author": "Giovani Rodriguez",