@rdlabo/ionic-angular-kit 22.0.1-beta.pr105.sha55308d6acf67 → 22.0.2-beta.pr107.shabca274cf9d55

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.
@@ -1,226 +1,15 @@
1
- import { signInWithCredential, linkWithCredential, reauthenticateWithCredential, EmailAuthProvider, OAuthProvider, FacebookAuthProvider, reauthenticateWithPopup, signInWithPopup, linkWithPopup } from 'firebase/auth';
2
- import { Capacitor } from '@capacitor/core';
3
- import { FacebookLogin } from '@capacitor-community/facebook-login';
4
- import { SignInWithApple } from '@capacitor-community/apple-sign-in';
1
+ import { kitAppleLogin as kitAppleLogin$1 } from '@rdlabo/ionic-angular-kit/auth-firebase/apple';
2
+ import { kitFacebookLogin as kitFacebookLogin$1, kitFacebookLogout as kitFacebookLogout$1 } from '@rdlabo/ionic-angular-kit/auth-firebase/facebook';
5
3
 
6
- /** Generate a random nonce for the Facebook OIDC (Limited Login) flow. */
7
- const generateNonce = (length = 16) => {
8
- const charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
9
- let nonce = '';
10
- for (let i = 0; i < length; i++) {
11
- nonce += charset[Math.floor(Math.random() * charset.length)];
12
- }
13
- return nonce;
14
- };
15
- const classifyOAuthError = (e) => {
16
- const code = e?.code;
17
- if (code === 'auth/credential-already-in-use') {
18
- return 'already-in-use';
19
- }
20
- if (code === 'auth/user-cancelled' || code === 'auth/popup-closed-by-user' || code === 'auth/cancelled-popup-request') {
21
- return 'cancelled';
22
- }
23
- return 'other';
24
- };
25
- /** Convert a possibly synchronously-throwing Promise producer into an explicit result. */
26
- const settle = (operation) => {
27
- const execute = async () => operation();
28
- return execute().then((value) => ({ status: 'fulfilled', value }), (reason) => ({ status: 'rejected', reason }));
29
- };
30
- /**
31
- * The shared 3-mode credential state machine (internal).
32
- *
33
- * @remarks
34
- * `new` signs in with the credential, `link` links it, `credential` re-authenticates with the social
35
- * credential and then links an email/password. Any Firebase error is classified and handed to
36
- * `error` (returning `false`); on success the app's `success` hook (backend + feedback) runs with the
37
- * identity payload, and it returns `true`.
38
- */
39
- const applyOAuthCredential = async (auth, credential, mode, effects) => {
40
- const result = await settle(async () => {
41
- if (mode.mode === 'new') {
42
- await signInWithCredential(auth, credential);
43
- }
44
- else {
45
- const user = auth.currentUser;
46
- if (!user) {
47
- throw new Error('kit social: no signed-in user to link/re-authenticate');
48
- }
49
- if (mode.mode === 'link') {
50
- await linkWithCredential(user, credential);
51
- }
52
- else {
53
- await reauthenticateWithCredential(user, credential);
54
- await linkWithCredential(user, EmailAuthProvider.credential(mode.emailLogin.email, mode.emailLogin.password));
55
- }
56
- }
57
- });
58
- if (result.status === 'rejected') {
59
- await effects.error(classifyOAuthError(result.reason), result.reason);
60
- return false;
61
- }
62
- await effects.success();
63
- return true;
64
- };
65
- /** Await one animation frame where available (iOS WebView crash workaround; no-op off-browser). */
66
- const nextFrame = () => new Promise((resolve) => {
67
- if (typeof requestAnimationFrame === 'function') {
68
- requestAnimationFrame(() => resolve());
69
- }
70
- else {
71
- resolve();
72
- }
73
- });
74
- /** Web plugin cancellation shape: the login promise rejects with a response whose token is null. */
75
- const isFacebookCancellation = (error) => {
76
- if (typeof error !== 'object' || error === null || !('accessToken' in error)) {
77
- return false;
78
- }
79
- const { accessToken } = error;
80
- if (typeof accessToken !== 'object' || accessToken === null || !('token' in accessToken)) {
81
- return false;
82
- }
83
- return accessToken.token === null;
84
- };
85
- /**
86
- * Facebook login / link, bundled: native plugin → credential → the shared 3-mode state machine.
87
- *
88
- * @remarks
89
- * On iOS the credential is built from the OIDC token with a nonce (`OAuthProvider('facebook.com')`);
90
- * elsewhere from the access token (`FacebookAuthProvider`). Returns `{ status: false }` on a
91
- * cancelled/failed plugin login or a handled Firebase error (the app was already notified via the
92
- * hooks).
93
- */
94
- const kitFacebookLogin = async (auth, options) => {
95
- const execute = async () => {
96
- await options.before?.();
97
- const nonce = generateNonce();
98
- const login = await settle(() => FacebookLogin.login({ permissions: options.permissions, nonce }));
99
- await nextFrame();
100
- if (login.status === 'rejected') {
101
- if (!isFacebookCancellation(login.reason))
102
- await options.error?.('other', login.reason);
103
- return { status: false };
104
- }
105
- const event = login.value;
106
- if (!event?.accessToken?.token)
107
- return { status: false };
108
- const accessToken = event.accessToken.token;
109
- const credential = Capacitor.isNativePlatform() && Capacitor.getPlatform() === 'ios'
110
- ? new OAuthProvider('facebook.com').credential({ rawNonce: nonce, idToken: accessToken })
111
- : FacebookAuthProvider.credential(accessToken);
112
- const status = await applyOAuthCredential(auth, credential, options, {
113
- success: () => options.success?.({ accessToken, mode: options.mode }),
114
- error: (category, error) => options.error?.(category, error),
115
- });
116
- return { status };
117
- };
118
- return execute().finally(() => options.finally?.());
119
- };
120
- /**
121
- * Log out of the Facebook SDK (best-effort; errors are ignored).
122
- *
123
- * @remarks
124
- * Apps that offer Facebook login typically call this alongside the Firebase sign-out, so it lives
125
- * here to keep the `@capacitor-community/facebook-login` import out of the app.
126
- * Skips the call when the Facebook SDK has no active session — otherwise `FB.logout()` logs
127
- * "called without an access token" on web and native rejects for email/password users.
128
- */
129
- const kitFacebookLogout = async () => {
130
- const session = await FacebookLogin.getCurrentAccessToken().catch(() => null);
131
- if (!session?.accessToken?.token) {
132
- return;
133
- }
134
- await FacebookLogin.logout().catch(() => undefined);
135
- };
136
- /**
137
- * Sign in with Apple / link, bundled. Native uses the plugin; the web uses the Firebase popup.
138
- *
139
- * @remarks
140
- * - **Native**: `SignInWithApple.authorize()` → `OAuthProvider('apple.com')` credential → the shared
141
- * 3-mode state machine.
142
- * - **Web**: `signInWithPopup` / `linkWithPopup` (with `email`/`name` scopes), or, for `credential`,
143
- * `reauthenticateWithPopup` then link the email/password. The identity payload for the backend is
144
- * synthesized from the popup result.
145
- *
146
- * Every failure path (including popup errors) is routed through `onError`.
147
- */
148
- const kitAppleLogin = async (auth, options) => {
149
- const execute = async () => {
150
- await options.before?.();
151
- if (Capacitor.isNativePlatform()) {
152
- const authorize = await SignInWithApple.authorize().catch(() => undefined);
153
- if (!authorize)
154
- return { status: false };
155
- const r = authorize.response;
156
- const response = {
157
- user: r.user ?? null,
158
- email: r.email ?? null,
159
- givenName: r.givenName ?? null,
160
- familyName: r.familyName ?? null,
161
- identityToken: r.identityToken ?? null,
162
- authorizationCode: r.authorizationCode ?? null,
163
- };
164
- const credential = new OAuthProvider('apple.com').credential({ idToken: response.identityToken ?? undefined });
165
- const status = await applyOAuthCredential(auth, credential, options, {
166
- success: () => options.success?.({ response, mode: options.mode }),
167
- error: (category, error) => options.error?.(category, error),
168
- });
169
- return { status };
170
- }
171
- // Web: the popup performs the sign-in/link itself.
172
- const provider = new OAuthProvider('apple.com');
173
- provider.addScope('email');
174
- provider.addScope('name');
175
- if (options.mode === 'credential') {
176
- const operation = await settle(async () => {
177
- const user = requireUser(auth);
178
- await reauthenticateWithPopup(user, provider);
179
- await linkWithCredential(user, EmailAuthProvider.credential(options.emailLogin.email, options.emailLogin.password));
180
- });
181
- if (operation.status === 'rejected') {
182
- await options.error?.(classifyOAuthError(operation.reason), operation.reason);
183
- return { status: false };
184
- }
185
- await options.success?.({ response: emptyAppleResponse(), mode: 'credential' });
186
- return { status: true };
187
- }
188
- const popup = await settle(() => options.mode === 'new' ? signInWithPopup(auth, provider) : linkWithPopup(requireUser(auth), provider));
189
- if (popup.status === 'rejected') {
190
- await options.error?.(classifyOAuthError(popup.reason), popup.reason);
191
- return { status: false };
192
- }
193
- const result = popup.value;
194
- const credential = OAuthProvider.credentialFromResult(result);
195
- const response = {
196
- ...emptyAppleResponse(),
197
- email: result.user?.email ?? null,
198
- identityToken: credential?.idToken ?? null,
199
- authorizationCode: credential?.accessToken ?? null,
200
- };
201
- await options.success?.({ response, mode: options.mode });
202
- return { status: true };
203
- };
204
- return execute().finally(() => options.finally?.());
205
- };
206
- const emptyAppleResponse = () => ({
207
- user: null,
208
- email: null,
209
- givenName: null,
210
- familyName: null,
211
- identityToken: null,
212
- authorizationCode: null,
213
- });
214
- const requireUser = (auth) => {
215
- const user = auth.currentUser;
216
- if (!user) {
217
- throw new Error('kit social: no signed-in user to link');
218
- }
219
- return user;
220
- };
4
+ /** @deprecated Import kitAppleLogin from @rdlabo/ionic-angular-kit/auth-firebase/apple. Kept for backwards compatibility. */
5
+ const kitAppleLogin = kitAppleLogin$1;
6
+ /** @deprecated Import kitFacebookLogin from @rdlabo/ionic-angular-kit/auth-firebase/facebook. Kept for backwards compatibility. */
7
+ const kitFacebookLogin = kitFacebookLogin$1;
8
+ /** @deprecated Import kitFacebookLogout from @rdlabo/ionic-angular-kit/auth-firebase/facebook. Kept for backwards compatibility. */
9
+ const kitFacebookLogout = kitFacebookLogout$1;
221
10
 
222
11
  // Social login (Facebook / Apple). Its own entry point so only apps that use it pull in the native
223
- // plugins `@capacitor-community/facebook-login` and `@capacitor-community/apple-sign-in`; the core
12
+ // plugins `@capacitor-community/facebook-login` and `@capawesome/capacitor-apple-sign-in`; the core
224
13
  // `auth-firebase` entry stays free of them.
225
14
  //
226
15
  // Public surface is curated: two bundled flows plus their option types. The nonce util, the error
@@ -1 +1 @@
1
- {"version":3,"file":"rdlabo-ionic-angular-kit-auth-firebase-social.mjs","sources":["../../../projects/kit/auth-firebase/social/src/kit-social.ts","../../../projects/kit/auth-firebase/social/src/public-api.ts","../../../projects/kit/auth-firebase/social/src/rdlabo-ionic-angular-kit-auth-firebase-social.ts"],"sourcesContent":["import type { Auth, AuthCredential } from 'firebase/auth';\nimport {\n EmailAuthProvider,\n FacebookAuthProvider,\n linkWithCredential,\n linkWithPopup,\n OAuthProvider,\n reauthenticateWithCredential,\n reauthenticateWithPopup,\n signInWithCredential,\n signInWithPopup,\n} from 'firebase/auth';\nimport { Capacitor } from '@capacitor/core';\nimport { FacebookLogin } from '@capacitor-community/facebook-login';\nimport { SignInWithApple } from '@capacitor-community/apple-sign-in';\n\n/** How a social-credential failure is classified for the app's error hook. */\nexport type KitOAuthErrorCategory = 'already-in-use' | 'cancelled' | 'other';\n\n/** The mode a social login runs in. */\nexport type KitOAuthModeName = 'new' | 'link' | 'credential';\n\n/**\n * The mode discriminator. `'credential'` links an email/password to the (re-authenticated) social\n * account, so it requires the new email/password; `'new'` / `'link'` do not.\n */\nexport type KitOAuthMode = { mode: 'new' } | { mode: 'link' } | { mode: 'credential'; emailLogin: { email: string; password: string } };\n\n/**\n * The apple identity payload handed to the `success` hook for the backend call. Populated from the\n * native plugin on device, or synthesized from the popup result on the web.\n */\nexport interface KitAppleResponse {\n user: string | null;\n email: string | null;\n givenName: string | null;\n familyName: string | null;\n identityToken: string | null;\n authorizationCode: string | null;\n}\n\n/**\n * The uniform lifecycle hooks for a social flow — the same `before / success / error / finally`\n * shape as {@link KitFirebaseAuthService}'s hooks, so a call site reads the same everywhere. All are\n * optional; the kit renders nothing itself.\n *\n * @typeParam Info - the identity payload handed to {@link success} (Facebook access token / Apple\n * response), so an app can notify its backend and give feedback in one place.\n *\n * @remarks\n * `before` runs before the plugin login starts, `success` after the mode's Firebase op succeeds\n * (carrying the identity payload — do the backend call and the toast here), `error` on a classified\n * failure (`'cancelled'` is passed through so the app can stay silent on a user cancel), and\n * `finally` always. The kit swallows none of these errors.\n */\ninterface KitSocialHooks<Info> {\n before?: () => void | Promise<unknown>;\n success?: (info: Info) => void | Promise<unknown>;\n error?: (category: KitOAuthErrorCategory, error: unknown) => void | Promise<unknown>;\n finally?: () => void | Promise<unknown>;\n}\n\n/** Options for {@link kitFacebookLogin}. */\nexport type KitFacebookLoginOptions = KitOAuthMode &\n KitSocialHooks<{ accessToken: string; mode: KitOAuthModeName }> & {\n /** Facebook permissions to request. */\n permissions: string[];\n };\n\n/** Options for {@link kitAppleLogin}. */\nexport type KitAppleLoginOptions = KitOAuthMode & KitSocialHooks<{ response: KitAppleResponse; mode: KitOAuthModeName }>;\n\n/** Generate a random nonce for the Facebook OIDC (Limited Login) flow. */\nconst generateNonce = (length = 16): string => {\n const charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n let nonce = '';\n for (let i = 0; i < length; i++) {\n nonce += charset[Math.floor(Math.random() * charset.length)];\n }\n return nonce;\n};\n\nconst classifyOAuthError = (e: unknown): KitOAuthErrorCategory => {\n const code = (e as { code?: string } | undefined)?.code;\n if (code === 'auth/credential-already-in-use') {\n return 'already-in-use';\n }\n if (code === 'auth/user-cancelled' || code === 'auth/popup-closed-by-user' || code === 'auth/cancelled-popup-request') {\n return 'cancelled';\n }\n return 'other';\n};\n\ntype Settled<T> = { status: 'fulfilled'; value: T } | { status: 'rejected'; reason: unknown };\n\n/** Convert a possibly synchronously-throwing Promise producer into an explicit result. */\nconst settle = <T>(operation: () => Promise<T>): Promise<Settled<T>> => {\n const execute = async (): Promise<T> => operation();\n return execute().then(\n (value) => ({ status: 'fulfilled', value }),\n (reason: unknown) => ({ status: 'rejected', reason }),\n );\n};\n\n/**\n * The shared 3-mode credential state machine (internal).\n *\n * @remarks\n * `new` signs in with the credential, `link` links it, `credential` re-authenticates with the social\n * credential and then links an email/password. Any Firebase error is classified and handed to\n * `error` (returning `false`); on success the app's `success` hook (backend + feedback) runs with the\n * identity payload, and it returns `true`.\n */\nconst applyOAuthCredential = async (\n auth: Auth,\n credential: AuthCredential,\n mode: KitOAuthMode,\n effects: {\n success: () => void | Promise<unknown>;\n error: (category: KitOAuthErrorCategory, error: unknown) => void | Promise<unknown>;\n },\n): Promise<boolean> => {\n const result = await settle(async () => {\n if (mode.mode === 'new') {\n await signInWithCredential(auth, credential);\n } else {\n const user = auth.currentUser;\n if (!user) {\n throw new Error('kit social: no signed-in user to link/re-authenticate');\n }\n if (mode.mode === 'link') {\n await linkWithCredential(user, credential);\n } else {\n await reauthenticateWithCredential(user, credential);\n await linkWithCredential(user, EmailAuthProvider.credential(mode.emailLogin.email, mode.emailLogin.password));\n }\n }\n });\n if (result.status === 'rejected') {\n await effects.error(classifyOAuthError(result.reason), result.reason);\n return false;\n }\n await effects.success();\n return true;\n};\n\n/** Await one animation frame where available (iOS WebView crash workaround; no-op off-browser). */\nconst nextFrame = (): Promise<void> =>\n new Promise<void>((resolve) => {\n if (typeof requestAnimationFrame === 'function') {\n requestAnimationFrame(() => resolve());\n } else {\n resolve();\n }\n });\n\n/** Web plugin cancellation shape: the login promise rejects with a response whose token is null. */\nconst isFacebookCancellation = (error: unknown): boolean => {\n if (typeof error !== 'object' || error === null || !('accessToken' in error)) {\n return false;\n }\n const { accessToken } = error;\n if (typeof accessToken !== 'object' || accessToken === null || !('token' in accessToken)) {\n return false;\n }\n return accessToken.token === null;\n};\n\n/**\n * Facebook login / link, bundled: native plugin → credential → the shared 3-mode state machine.\n *\n * @remarks\n * On iOS the credential is built from the OIDC token with a nonce (`OAuthProvider('facebook.com')`);\n * elsewhere from the access token (`FacebookAuthProvider`). Returns `{ status: false }` on a\n * cancelled/failed plugin login or a handled Firebase error (the app was already notified via the\n * hooks).\n */\nexport const kitFacebookLogin = async (auth: Auth, options: KitFacebookLoginOptions): Promise<{ status: boolean }> => {\n const execute = async (): Promise<{ status: boolean }> => {\n await options.before?.();\n const nonce = generateNonce();\n const login = await settle(() => FacebookLogin.login({ permissions: options.permissions, nonce }));\n await nextFrame();\n if (login.status === 'rejected') {\n if (!isFacebookCancellation(login.reason)) await options.error?.('other', login.reason);\n return { status: false };\n }\n const event = login.value;\n if (!event?.accessToken?.token) return { status: false };\n const accessToken = event.accessToken.token;\n const credential: AuthCredential =\n Capacitor.isNativePlatform() && Capacitor.getPlatform() === 'ios'\n ? new OAuthProvider('facebook.com').credential({ rawNonce: nonce, idToken: accessToken })!\n : FacebookAuthProvider.credential(accessToken);\n\n const status = await applyOAuthCredential(auth, credential, options, {\n success: () => options.success?.({ accessToken, mode: options.mode }),\n error: (category, error) => options.error?.(category, error),\n });\n return { status };\n };\n return execute().finally(() => options.finally?.());\n};\n\n/**\n * Log out of the Facebook SDK (best-effort; errors are ignored).\n *\n * @remarks\n * Apps that offer Facebook login typically call this alongside the Firebase sign-out, so it lives\n * here to keep the `@capacitor-community/facebook-login` import out of the app.\n * Skips the call when the Facebook SDK has no active session — otherwise `FB.logout()` logs\n * \"called without an access token\" on web and native rejects for email/password users.\n */\nexport const kitFacebookLogout = async (): Promise<void> => {\n const session = await FacebookLogin.getCurrentAccessToken().catch(() => null);\n if (!session?.accessToken?.token) {\n return;\n }\n await FacebookLogin.logout().catch(() => undefined);\n};\n\n/**\n * Sign in with Apple / link, bundled. Native uses the plugin; the web uses the Firebase popup.\n *\n * @remarks\n * - **Native**: `SignInWithApple.authorize()` → `OAuthProvider('apple.com')` credential → the shared\n * 3-mode state machine.\n * - **Web**: `signInWithPopup` / `linkWithPopup` (with `email`/`name` scopes), or, for `credential`,\n * `reauthenticateWithPopup` then link the email/password. The identity payload for the backend is\n * synthesized from the popup result.\n *\n * Every failure path (including popup errors) is routed through `onError`.\n */\nexport const kitAppleLogin = async (auth: Auth, options: KitAppleLoginOptions): Promise<{ status: boolean }> => {\n const execute = async (): Promise<{ status: boolean }> => {\n await options.before?.();\n if (Capacitor.isNativePlatform()) {\n const authorize = await SignInWithApple.authorize().catch(() => undefined);\n if (!authorize) return { status: false };\n const r = authorize.response;\n const response: KitAppleResponse = {\n user: r.user ?? null,\n email: r.email ?? null,\n givenName: r.givenName ?? null,\n familyName: r.familyName ?? null,\n identityToken: r.identityToken ?? null,\n authorizationCode: r.authorizationCode ?? null,\n };\n const credential = new OAuthProvider('apple.com').credential({ idToken: response.identityToken ?? undefined })!;\n const status = await applyOAuthCredential(auth, credential, options, {\n success: () => options.success?.({ response, mode: options.mode }),\n error: (category, error) => options.error?.(category, error),\n });\n return { status };\n }\n\n // Web: the popup performs the sign-in/link itself.\n const provider = new OAuthProvider('apple.com');\n provider.addScope('email');\n provider.addScope('name');\n\n if (options.mode === 'credential') {\n const operation = await settle(async () => {\n const user = requireUser(auth);\n await reauthenticateWithPopup(user, provider);\n await linkWithCredential(user, EmailAuthProvider.credential(options.emailLogin.email, options.emailLogin.password));\n });\n if (operation.status === 'rejected') {\n await options.error?.(classifyOAuthError(operation.reason), operation.reason);\n return { status: false };\n }\n await options.success?.({ response: emptyAppleResponse(), mode: 'credential' });\n return { status: true };\n }\n\n const popup = await settle(() =>\n options.mode === 'new' ? signInWithPopup(auth, provider) : linkWithPopup(requireUser(auth), provider),\n );\n if (popup.status === 'rejected') {\n await options.error?.(classifyOAuthError(popup.reason), popup.reason);\n return { status: false };\n }\n const result = popup.value;\n const credential = OAuthProvider.credentialFromResult(result);\n const response: KitAppleResponse = {\n ...emptyAppleResponse(),\n email: result.user?.email ?? null,\n identityToken: credential?.idToken ?? null,\n authorizationCode: credential?.accessToken ?? null,\n };\n await options.success?.({ response, mode: options.mode });\n return { status: true };\n };\n return execute().finally(() => options.finally?.());\n};\n\nconst emptyAppleResponse = (): KitAppleResponse => ({\n user: null,\n email: null,\n givenName: null,\n familyName: null,\n identityToken: null,\n authorizationCode: null,\n});\n\nconst requireUser = (auth: Auth) => {\n const user = auth.currentUser;\n if (!user) {\n throw new Error('kit social: no signed-in user to link');\n }\n return user;\n};\n","// Social login (Facebook / Apple). Its own entry point so only apps that use it pull in the native\n// plugins `@capacitor-community/facebook-login` and `@capacitor-community/apple-sign-in`; the core\n// `auth-firebase` entry stays free of them.\n//\n// Public surface is curated: two bundled flows plus their option types. The nonce util, the error\n// classifier and the 3-mode credential state machine are internal implementation details.\nexport * from './kit-social';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAwEA;AACA,MAAM,aAAa,GAAG,CAAC,MAAM,GAAG,EAAE,KAAY;IAC5C,MAAM,OAAO,GAAG,gEAAgE;IAChF,IAAI,KAAK,GAAG,EAAE;AACd,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;AAC/B,QAAA,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EA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CAAC;AACzD,QAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE;AACzB,IAAA,CAAC;AACD,IAAA,OAAO,OAAO,EAAE,CAAC,OAAO,CAAC,MAAM,OAAO,CAAC,OAAO,IAAI,CAAC;AACrD;AAEA,MAAM,kBAAkB,GAAG,OAAyB;AAClD,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,SAAS,EAAE,IAAI;AACf,IAAA,UAAU,EAAE,IAAI;AAChB,IAAA,aAAa,EAAE,IAAI;AACnB,IAAA,iBAAiB,EAAE,IAAI;AACxB,CAAA,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,IAAU,KAAI;AACjC,IAAA,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW;IAC7B,IAAI,CAAC,IAAI,EAAE;AACT,QAAA,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC;IAC1D;AACA,IAAA,OAAO,IAAI;AACb,CAAC;;ACvTD;AACA;AACA;AACA;AACA;AACA;;ACLA;;AAEG;;;;"}
1
+ {"version":3,"file":"rdlabo-ionic-angular-kit-auth-firebase-social.mjs","sources":["../../../projects/kit/auth-firebase/social/src/kit-social.ts","../../../projects/kit/auth-firebase/social/src/public-api.ts","../../../projects/kit/auth-firebase/social/src/rdlabo-ionic-angular-kit-auth-firebase-social.ts"],"sourcesContent":["import { kitAppleLogin as appleLogin } from '@rdlabo/ionic-angular-kit/auth-firebase/apple';\nimport type {\n KitAppleLoginOptions as AppleLoginOptions,\n KitAppleResponse as AppleResponse,\n KitOAuthErrorCategory as OAuthErrorCategory,\n KitOAuthMode as OAuthMode,\n KitOAuthModeName as OAuthModeName,\n} from '@rdlabo/ionic-angular-kit/auth-firebase/apple';\nimport { kitFacebookLogin as facebookLogin, kitFacebookLogout as facebookLogout } from '@rdlabo/ionic-angular-kit/auth-firebase/facebook';\nimport type { KitFacebookLoginOptions as FacebookLoginOptions } from '@rdlabo/ionic-angular-kit/auth-firebase/facebook';\n\n/** @deprecated Import kitAppleLogin from @rdlabo/ionic-angular-kit/auth-firebase/apple. Kept for backwards compatibility. */\nexport const kitAppleLogin: typeof appleLogin = appleLogin;\n/** @deprecated Import kitFacebookLogin from @rdlabo/ionic-angular-kit/auth-firebase/facebook. Kept for backwards compatibility. */\nexport const kitFacebookLogin: typeof facebookLogin = facebookLogin;\n/** @deprecated Import kitFacebookLogout from @rdlabo/ionic-angular-kit/auth-firebase/facebook. Kept for backwards compatibility. */\nexport const kitFacebookLogout: typeof facebookLogout = facebookLogout;\n/** @deprecated Import this type from @rdlabo/ionic-angular-kit/auth-firebase/apple. */\nexport type KitAppleLoginOptions = AppleLoginOptions;\n/** @deprecated Import this type from @rdlabo/ionic-angular-kit/auth-firebase/apple. */\nexport type KitAppleResponse = AppleResponse;\n/** @deprecated Import this type from @rdlabo/ionic-angular-kit/auth-firebase/apple or /facebook. */\nexport type KitOAuthErrorCategory = OAuthErrorCategory;\n/** @deprecated Import this type from @rdlabo/ionic-angular-kit/auth-firebase/apple or /facebook. */\nexport type KitOAuthMode = OAuthMode;\n/** @deprecated Import this type from @rdlabo/ionic-angular-kit/auth-firebase/apple or /facebook. */\nexport type KitOAuthModeName = OAuthModeName;\n/** @deprecated Import this type from @rdlabo/ionic-angular-kit/auth-firebase/facebook. */\nexport type KitFacebookLoginOptions = FacebookLoginOptions;\n","// Social login (Facebook / Apple). Its own entry point so only apps that use it pull in the native\n// plugins `@capacitor-community/facebook-login` and `@capawesome/capacitor-apple-sign-in`; the core\n// `auth-firebase` entry stays free of them.\n//\n// Public surface is curated: two bundled flows plus their option types. The nonce util, the error\n// classifier and the 3-mode credential state machine are internal implementation details.\nexport * from './kit-social';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["appleLogin","facebookLogin","facebookLogout"],"mappings":";;;AAWA;AACO,MAAM,aAAa,GAAsBA;AAChD;AACO,MAAM,gBAAgB,GAAyBC;AACtD;AACO,MAAM,iBAAiB,GAA0BC;;AChBxD;AACA;AACA;AACA;AACA;AACA;;ACLA;;AAEG;;;;"}