@cloudscaile-eng/web-ext-utils 0.0.4 → 0.0.6

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/README.md CHANGED
@@ -36,7 +36,15 @@ const hostAPI = initializeHost({
36
36
  toast: toastFunction,
37
37
  getUser: getUserFunction,
38
38
  validateUserPermission: validateUserPermissionFunction,
39
- triggerLogin: triggerLoginFunction
39
+ triggerLogin: triggerLoginFunction,
40
+ triggerLogout: triggerLogoutFunction,
41
+ getCookieConsent: getCookieConsentFunction,
42
+ updateCookieConsent: updateCookieConsentFunction,
43
+ resetCookieConsent: resetCookieConsentFunction,
44
+ trackGA4Event: trackGA4EventFunction,
45
+ getOAuthProviders: getOAuthProvidersFunction,
46
+ triggerSendOTP: triggerSendOtpFunction,
47
+ triggerSignUp: triggerSignUpFunction
40
48
  });
41
49
  ```
42
50
 
@@ -58,10 +66,15 @@ import {
58
66
  getUser,
59
67
  validateUserPermission,
60
68
  triggerLogin,
69
+ triggerLogout,
61
70
  getCookieConsent,
62
71
  updateCookieConsent,
63
72
  resetCookieConsent,
64
- trackGA4Event
73
+ trackGA4Event,
74
+ getOAuthProviders,
75
+ triggerSendOTP,
76
+ triggerSignUp,
77
+ OTP_INTENT
65
78
  } from '@cloudscaile-eng/web-ext-utils';
66
79
 
67
80
  // Create extension object
@@ -93,9 +106,21 @@ toast(extension, 'Welcome!', 'success');
93
106
  const user = getUser(extension);
94
107
  const permissions = validateUserPermission(extension, ['payment.refund', 'inventory.bill']); // Returns {"payment.refund": true, "inventory.bill": false}
95
108
 
96
- // Trigger login with redirect
109
+ // Trigger login redirect only (navigates to auth page, returns after login)
97
110
  triggerLogin(extension, { redirect: '/home/dash' });
98
111
 
112
+ // Trigger login – SSO / social provider
113
+ triggerLogin(extension, { provider: 'google', redirect: '/home/dash' });
114
+
115
+ // Trigger login – email / password (returns { success, data } or { success, error })
116
+ const result = await triggerLogin(extension, { email: 'user@example.com', password: 'secret', redirect: '/home/dash' });
117
+ if (result?.success) {
118
+ console.log('Logged in', result.data);
119
+ }
120
+
121
+ // Trigger logout with redirect
122
+ await triggerLogout(extension, { redirect: '/home/login' });
123
+
99
124
  // Cookie consent
100
125
  const consent = getCookieConsent(extension); // { status: 'pending', timestamp: null }
101
126
  updateCookieConsent(extension, 'accepted');
@@ -104,6 +129,22 @@ resetCookieConsent(extension);
104
129
  // Track GA4 events (no-ops if consent not given)
105
130
  trackGA4Event(extension, 'login', { method: 'email' });
106
131
  trackGA4Event(extension, 'purchase', { item: 'cart', value: 49 });
132
+
133
+ // Get configured OAuth / SSO providers (sorted by order in the host)
134
+ const providers = getOAuthProviders(extension);
135
+ // providers → [{ value: 'google', name: 'Google', displayName: 'Continue with Google', icon: '/icons/google.svg', order: 1 }, ...]
136
+
137
+ // Send an OTP (tenant is injected by the host; extensions never pass or see it)
138
+ const otpResult = await triggerSendOTP(extension, { email: 'user@example.com', intent: OTP_INTENT.REGISTER });
139
+
140
+ // Sign up a new user with a verified OTP. On success, the host logs the user in immediately.
141
+ const signUpResult = await triggerSignUp(extension, {
142
+ email: 'user@example.com',
143
+ password: 'secret',
144
+ firstName: 'Jane',
145
+ lastName: 'Doe',
146
+ otp: '123456'
147
+ });
107
148
  ```
108
149
 
109
150
  ## API Reference
@@ -124,11 +165,14 @@ Initializes shared resources in the host application.
124
165
  - `config.getUser`: Function to get user information.
125
166
  - `config.validateUserPermission`: Function to validate user permissions.
126
167
  - `config.triggerLogin`: Function to trigger login in the host.
127
- - `config.validateUserPermission`: Function to validate user permissions.
168
+ - `config.triggerLogout`: Function to trigger logout in the host.
128
169
  - `config.getCookieConsent`: Function to retrieve the current cookie consent state.
129
170
  - `config.updateCookieConsent`: Function to dispatch consent actions and initialize analytics on acceptance.
130
171
  - `config.resetCookieConsent`: Function to reset consent state and stop analytics events.
131
172
  - `config.trackGA4Event`: Function to track a GA4 event.
173
+ - `config.getOAuthProviders`: Function to get the list of available OAuth providers.
174
+ - `config.triggerSendOTP`: Function to send an OTP to an email for a given intent.
175
+ - `config.triggerSignUp`: Function to register a new user; logs them in on success.
132
176
 
133
177
  #### Returns
134
178
 
@@ -245,17 +289,40 @@ An object mapping each permission to a boolean (e.g., `{"payment.refund": true,
245
289
 
246
290
  ### `triggerLogin(extension, config)`
247
291
 
248
- Triggers the login process in the host application for the given extension.
292
+ Triggers the login process in the host application. Supports three modes:
293
+
294
+ | Mode | Config supplied | Behaviour |
295
+ |---|---|---|
296
+ | Redirect only | `redirect` | Navigates to the auth page; returns to `redirect` after login |
297
+ | SSO / social | `provider` (+ optional `redirect`) | Redirects the browser to the configured SSO URL |
298
+ | Credential login | `email` + `password` (+ optional `redirect`) | Calls the login API, stores tokens and user in Redux |
249
299
 
250
300
  #### Parameters
251
301
 
252
302
  - `extension`: Extension object from `getExtension()`.
303
+ - `config.redirect`: Path to navigate to after a successful login (all modes).
304
+ - `config.email`: User email for direct credential login.
305
+ - `config.password`: User password for direct credential login.
306
+ - `config.provider`: Social / SSO provider identifier (e.g. `'google'`).
307
+
308
+ **Returns:**
309
+
310
+ `Promise<{ success: true; data: unknown } | { success: false; error: unknown } | undefined>`
253
311
 
254
- - `config`: Optional configuration object with properties like `redirect` (e.g., `'/home/dash'`).
312
+ Returns a result object only for credential login. SSO and redirect flows return `undefined`.
313
+
314
+ ### `triggerLogout(extension, config)`
315
+
316
+ Triggers the logout process in the host application for the given extension.
317
+
318
+ #### Parameters
319
+
320
+ - `extension`: Extension object from `getExtension()`.
321
+ - `config.redirect`: Path to navigate to after logout completes.
255
322
 
256
323
  **Returns:**
257
324
 
258
- The result of the triggerLogin resource.
325
+ `Promise<void>`
259
326
 
260
327
  #### `getCookieConsent(extension)`
261
328
 
@@ -296,6 +363,57 @@ Tracks a GA4 event. Silently no-ops if analytics has not been initialized (i.e.
296
363
  - `eventName`: The GA4 event name (e.g. `'login'`, `'purchase'`).
297
364
  - `params`: Optional object of event parameters (e.g. `{ method: 'email' }`).
298
365
 
366
+ #### `getOAuthProviders(extension)`
367
+
368
+ Returns the list of OAuth / SSO login providers configured by the host application.
369
+
370
+ **Parameters:**
371
+
372
+ - `extension`: Extension object from `getExtension()`.
373
+
374
+ **Returns:**
375
+
376
+ An array of `OAuthProvider` objects:
377
+
378
+ | Field | Type | Description |
379
+ |---|---|---|
380
+ | `value` | `string` | Unique provider identifier (e.g. `'google'`) |
381
+ | `name` | `string` | Provider name used as icon alt text |
382
+ | `displayName` | `string` | Label shown on the login button |
383
+ | `icon` | `string` | URL or path to the provider's icon image |
384
+ | `order` | `number` | Sort order relative to other providers |
385
+
386
+ #### `triggerSendOTP(extension, params)`
387
+
388
+ Sends an OTP to the given email for the given intent. The host injects the tenant identifier automatically; extensions never pass or receive it.
389
+
390
+ **Parameters:**
391
+
392
+ - `extension`: Extension object from `getExtension()`.
393
+ - `params.email`: The email address to send the OTP to.
394
+ - `params.intent`: One of the `OTP_INTENT` values — `'RESET_PASSWORD'`, `'REGISTER'`, or `'EMAIL_VERIFICATION'`.
395
+
396
+ **Returns:**
397
+
398
+ `Promise<{ success: boolean; data?: unknown; error?: unknown }>`
399
+
400
+ #### `triggerSignUp(extension, params)`
401
+
402
+ Registers a new user with the host application. The host injects the tenant identifier automatically. On success, the host logs the user in immediately, the same effect as a successful `triggerLogin`.
403
+
404
+ **Parameters:**
405
+
406
+ - `extension`: Extension object from `getExtension()`.
407
+ - `params.email`: The new user's email.
408
+ - `params.password`: The new user's password.
409
+ - `params.firstName`: The new user's first name.
410
+ - `params.lastName`: The new user's last name.
411
+ - `params.otp`: The OTP previously verified via `triggerSendOTP`.
412
+
413
+ **Returns:**
414
+
415
+ `Promise<{ success: boolean; data?: unknown; error?: unknown }>`
416
+
299
417
  ## Error Handling
300
418
 
301
419
  - If the host has not initialized resources, individual resource functions will throw an error.
@@ -110,6 +110,15 @@ export declare function getExtension(tenant: string, name: string): Extension;
110
110
  */
111
111
  export declare function getNsForTranslation(extension: Extension, extensionNs: string): string;
112
112
 
113
+ /**
114
+ * Returns the list of configured OAuth / SSO providers for the given extension,
115
+ * sorted by the host-defined order.
116
+ * @param extension - The extension object.
117
+ * @returns Array of OAuth provider descriptors.
118
+ * @public
119
+ */
120
+ export declare function getOAuthProviders(extension: Extension): OAuthProvider[];
121
+
113
122
  /**
114
123
  * Returns the Redux store resource for the given extension.
115
124
  * @param extension - The extension object.
@@ -156,12 +165,16 @@ export declare interface HostConfig {
156
165
  getUser: SharedResources['getUser'];
157
166
  validateUserPermission: SharedResources['validateUserPermission'];
158
167
  triggerLogin: SharedResources['triggerLogin'];
168
+ triggerLogout: SharedResources['triggerLogout'];
159
169
  theme: SharedResources['theme'];
160
170
  initialized?: boolean;
161
171
  getCookieConsent: SharedResources['getCookieConsent'];
162
172
  updateCookieConsent: SharedResources['updateCookieConsent'];
163
173
  resetCookieConsent: SharedResources['resetCookieConsent'];
164
174
  trackGA4Event: SharedResources['trackGA4Event'];
175
+ getOAuthProviders: SharedResources['getOAuthProviders'];
176
+ triggerSendOTP: SharedResources['triggerSendOTP'];
177
+ triggerSignUp: SharedResources['triggerSignUp'];
165
178
  }
166
179
 
167
180
  /**
@@ -177,10 +190,14 @@ export declare interface HostConfig {
177
190
  * - getUser: Function to get the user information from the host
178
191
  * - validateUserPermission: Function to validate user permissions in the host
179
192
  * - triggerLogin: Function to trigger login in the host
193
+ * - triggerLogout: Function to trigger logout in the host
180
194
  * - getCookieConsent: Function to retrieve the current cookie consent state
181
195
  * - updateCookieConsent: Function to dispatch consent actions and initialize analytics on acceptance
182
196
  * - resetCookieConsent: Function to reset consent state and stop analytics events
183
197
  * - trackGA4Event: Function to track a GA4 event
198
+ * - getOAuthProviders: Function to get the list of available OAuth providers
199
+ * - triggerSendOTP: Function to send an OTP to an email for a given intent
200
+ * - triggerSignUp: Function to register a new user and log them in on success
184
201
  * @throws Will throw an error if any required configuration is missing
185
202
  * @returns Object with method to access shared resources
186
203
  * @public
@@ -206,6 +223,34 @@ export declare type InjectedReducer = {
206
223
  */
207
224
  export declare function injectReducers(extension: Extension, params: InjectedReducer): boolean;
208
225
 
226
+ /**
227
+ * OAuth / SSO login provider descriptor returned by getOAuthProviders
228
+ * @public
229
+ */
230
+ export declare type OAuthProvider = {
231
+ value: string;
232
+ name: string;
233
+ displayName: string;
234
+ icon: string;
235
+ order: number;
236
+ };
237
+
238
+ /**
239
+ * Supported intents for sending a one-time password
240
+ * @public
241
+ */
242
+ export declare const OTP_INTENT: {
243
+ readonly RESET_PASSWORD: "RESET_PASSWORD";
244
+ readonly REGISTER: "REGISTER";
245
+ readonly EMAIL_VERIFICATION: "EMAIL_VERIFICATION";
246
+ };
247
+
248
+ /**
249
+ * Intent value describing why an OTP is being sent
250
+ * @public
251
+ */
252
+ export declare type OtpIntent = (typeof OTP_INTENT)[keyof typeof OTP_INTENT];
253
+
209
254
  /**
210
255
  * Configuration for registering translations
211
256
  * @public
@@ -266,13 +311,17 @@ export declare interface SharedResources {
266
311
  toast: (message: string, type: ToastType) => void;
267
312
  getUser: () => User;
268
313
  validateUserPermission: (extension: Extension, permissions: string[]) => Record<string, boolean>;
269
- triggerLogin: (config?: TriggerLoginConfig) => unknown;
314
+ triggerLogin: (config?: TriggerLoginConfig) => Promise<TriggerLoginResult | undefined>;
315
+ triggerLogout: (config?: TriggerLogoutConfig) => Promise<void>;
270
316
  theme: Theme;
271
317
  initialized: boolean;
272
318
  getCookieConsent: () => CookieConsent;
273
319
  updateCookieConsent: (status: CookieConsentStatus) => void;
274
320
  resetCookieConsent: () => void;
275
321
  trackGA4Event: (eventName: string, params?: Record<string, unknown>) => void;
322
+ getOAuthProviders: () => OAuthProvider[];
323
+ triggerSendOTP: (params: TriggerSendOtpParams) => Promise<TriggerSendOtpResult>;
324
+ triggerSignUp: (params: TriggerSignUpParams) => Promise<TriggerSignUpResult>;
276
325
  }
277
326
 
278
327
  export { StoreEnhancer }
@@ -310,12 +359,22 @@ export declare function trackGA4Event(extension: Extension, eventName: string, p
310
359
 
311
360
  /**
312
361
  * Triggers the login process in the host application for the given extension.
362
+ *
363
+ * Supports three modes based on the supplied config:
364
+ * - **SSO / social login**: pass `provider` to redirect the browser to the configured SSO URL.
365
+ * - **Redirect only**: pass only `redirect` (no credentials) to navigate the user to the auth
366
+ * page with an optional `from` state so they return after login.
367
+ * - **Email / password login**: pass `email` and `password` to authenticate directly via the API.
368
+ * On success, tokens, user details, and permissions are stored in the Redux store.
369
+ *
313
370
  * @param extension - The extension object.
314
- * @param config - Optional configuration for login.
315
- * @returns The result of the triggerLogin resource.
371
+ * @param config - Optional configuration: `redirect` (return path), `email`+`password` for
372
+ * credential login, or `provider` for SSO (e.g. `'google'`).
373
+ * @returns A promise resolving to `{ success: true, data }` on credential login success,
374
+ * `{ success: false, error }` on failure, or `undefined` for redirect / SSO flows.
316
375
  * @public
317
376
  */
318
- export declare function triggerLogin(extension: Extension, config?: TriggerLoginConfig): unknown;
377
+ export declare function triggerLogin(extension: Extension, config?: TriggerLoginConfig): Promise<TriggerLoginResult | undefined>;
319
378
 
320
379
  /**
321
380
  * Configuration for triggering the login process
@@ -323,6 +382,100 @@ export declare function triggerLogin(extension: Extension, config?: TriggerLogin
323
382
  */
324
383
  export declare type TriggerLoginConfig = {
325
384
  redirect?: string;
385
+ email?: string;
386
+ password?: string;
387
+ provider?: string;
388
+ };
389
+
390
+ /**
391
+ * Result returned by triggerLogin when credentials or SSO provider are supplied
392
+ * @public
393
+ */
394
+ export declare type TriggerLoginResult = {
395
+ success: true;
396
+ data: unknown;
397
+ } | {
398
+ success: false;
399
+ error: unknown;
400
+ };
401
+
402
+ /**
403
+ * Triggers the logout process in the host application for the given extension.
404
+ * @param extension - The extension object.
405
+ * @param config - Optional configuration: `redirect` (path to navigate to after logout).
406
+ * @returns A promise that resolves once the logout process completes.
407
+ * @public
408
+ */
409
+ export declare function triggerLogout(extension: Extension, config?: TriggerLogoutConfig): Promise<void>;
410
+
411
+ /**
412
+ * Configuration for triggering the logout process
413
+ * @public
414
+ */
415
+ export declare type TriggerLogoutConfig = {
416
+ redirect?: string;
417
+ };
418
+
419
+ /**
420
+ * Triggers the host to send a one-time password to the given email for the given intent.
421
+ * The host injects the tenant identifier automatically.
422
+ * @param extension - The extension object.
423
+ * @param params - `email` and `intent` (see `OTP_INTENT`).
424
+ * @returns A promise resolving to `{ success, data }` or `{ success, error }`.
425
+ * @public
426
+ */
427
+ export declare function triggerSendOTP(extension: Extension, params: TriggerSendOtpParams): Promise<TriggerSendOtpResult>;
428
+
429
+ /**
430
+ * Parameters for triggering an OTP send
431
+ * @public
432
+ */
433
+ export declare type TriggerSendOtpParams = {
434
+ email: string;
435
+ intent: OtpIntent;
436
+ };
437
+
438
+ /**
439
+ * Result returned by triggerSendOTP
440
+ * @public
441
+ */
442
+ export declare type TriggerSendOtpResult = {
443
+ success: boolean;
444
+ data?: unknown;
445
+ error?: unknown;
446
+ };
447
+
448
+ /**
449
+ * Triggers the host to register a new user. On success, the host logs the user in
450
+ * immediately, equivalent to a successful triggerLogin. The host injects the tenant
451
+ * identifier automatically.
452
+ * @param extension - The extension object.
453
+ * @param params - `email`, `password`, `firstName`, `lastName`, and the verified `otp`.
454
+ * @returns A promise resolving to `{ success, data }` or `{ success, error }`.
455
+ * @public
456
+ */
457
+ export declare function triggerSignUp(extension: Extension, params: TriggerSignUpParams): Promise<TriggerSignUpResult>;
458
+
459
+ /**
460
+ * Parameters for triggering sign up
461
+ * @public
462
+ */
463
+ export declare type TriggerSignUpParams = {
464
+ email: string;
465
+ password: string;
466
+ firstName: string;
467
+ lastName: string;
468
+ otp: string;
469
+ };
470
+
471
+ /**
472
+ * Result returned by triggerSignUp
473
+ * @public
474
+ */
475
+ export declare type TriggerSignUpResult = {
476
+ success: boolean;
477
+ data?: unknown;
478
+ error?: unknown;
326
479
  };
327
480
 
328
481
  export { Tuple }
package/dist/index.d.ts CHANGED
@@ -110,6 +110,15 @@ export declare function getExtension(tenant: string, name: string): Extension;
110
110
  */
111
111
  export declare function getNsForTranslation(extension: Extension, extensionNs: string): string;
112
112
 
113
+ /**
114
+ * Returns the list of configured OAuth / SSO providers for the given extension,
115
+ * sorted by the host-defined order.
116
+ * @param extension - The extension object.
117
+ * @returns Array of OAuth provider descriptors.
118
+ * @public
119
+ */
120
+ export declare function getOAuthProviders(extension: Extension): OAuthProvider[];
121
+
113
122
  /**
114
123
  * Returns the Redux store resource for the given extension.
115
124
  * @param extension - The extension object.
@@ -156,12 +165,16 @@ export declare interface HostConfig {
156
165
  getUser: SharedResources['getUser'];
157
166
  validateUserPermission: SharedResources['validateUserPermission'];
158
167
  triggerLogin: SharedResources['triggerLogin'];
168
+ triggerLogout: SharedResources['triggerLogout'];
159
169
  theme: SharedResources['theme'];
160
170
  initialized?: boolean;
161
171
  getCookieConsent: SharedResources['getCookieConsent'];
162
172
  updateCookieConsent: SharedResources['updateCookieConsent'];
163
173
  resetCookieConsent: SharedResources['resetCookieConsent'];
164
174
  trackGA4Event: SharedResources['trackGA4Event'];
175
+ getOAuthProviders: SharedResources['getOAuthProviders'];
176
+ triggerSendOTP: SharedResources['triggerSendOTP'];
177
+ triggerSignUp: SharedResources['triggerSignUp'];
165
178
  }
166
179
 
167
180
  /**
@@ -177,10 +190,14 @@ export declare interface HostConfig {
177
190
  * - getUser: Function to get the user information from the host
178
191
  * - validateUserPermission: Function to validate user permissions in the host
179
192
  * - triggerLogin: Function to trigger login in the host
193
+ * - triggerLogout: Function to trigger logout in the host
180
194
  * - getCookieConsent: Function to retrieve the current cookie consent state
181
195
  * - updateCookieConsent: Function to dispatch consent actions and initialize analytics on acceptance
182
196
  * - resetCookieConsent: Function to reset consent state and stop analytics events
183
197
  * - trackGA4Event: Function to track a GA4 event
198
+ * - getOAuthProviders: Function to get the list of available OAuth providers
199
+ * - triggerSendOTP: Function to send an OTP to an email for a given intent
200
+ * - triggerSignUp: Function to register a new user and log them in on success
184
201
  * @throws Will throw an error if any required configuration is missing
185
202
  * @returns Object with method to access shared resources
186
203
  * @public
@@ -206,6 +223,34 @@ export declare type InjectedReducer = {
206
223
  */
207
224
  export declare function injectReducers(extension: Extension, params: InjectedReducer): boolean;
208
225
 
226
+ /**
227
+ * OAuth / SSO login provider descriptor returned by getOAuthProviders
228
+ * @public
229
+ */
230
+ export declare type OAuthProvider = {
231
+ value: string;
232
+ name: string;
233
+ displayName: string;
234
+ icon: string;
235
+ order: number;
236
+ };
237
+
238
+ /**
239
+ * Supported intents for sending a one-time password
240
+ * @public
241
+ */
242
+ export declare const OTP_INTENT: {
243
+ readonly RESET_PASSWORD: "RESET_PASSWORD";
244
+ readonly REGISTER: "REGISTER";
245
+ readonly EMAIL_VERIFICATION: "EMAIL_VERIFICATION";
246
+ };
247
+
248
+ /**
249
+ * Intent value describing why an OTP is being sent
250
+ * @public
251
+ */
252
+ export declare type OtpIntent = (typeof OTP_INTENT)[keyof typeof OTP_INTENT];
253
+
209
254
  /**
210
255
  * Configuration for registering translations
211
256
  * @public
@@ -266,13 +311,17 @@ export declare interface SharedResources {
266
311
  toast: (message: string, type: ToastType) => void;
267
312
  getUser: () => User;
268
313
  validateUserPermission: (extension: Extension, permissions: string[]) => Record<string, boolean>;
269
- triggerLogin: (config?: TriggerLoginConfig) => unknown;
314
+ triggerLogin: (config?: TriggerLoginConfig) => Promise<TriggerLoginResult | undefined>;
315
+ triggerLogout: (config?: TriggerLogoutConfig) => Promise<void>;
270
316
  theme: Theme;
271
317
  initialized: boolean;
272
318
  getCookieConsent: () => CookieConsent;
273
319
  updateCookieConsent: (status: CookieConsentStatus) => void;
274
320
  resetCookieConsent: () => void;
275
321
  trackGA4Event: (eventName: string, params?: Record<string, unknown>) => void;
322
+ getOAuthProviders: () => OAuthProvider[];
323
+ triggerSendOTP: (params: TriggerSendOtpParams) => Promise<TriggerSendOtpResult>;
324
+ triggerSignUp: (params: TriggerSignUpParams) => Promise<TriggerSignUpResult>;
276
325
  }
277
326
 
278
327
  export { StoreEnhancer }
@@ -310,12 +359,22 @@ export declare function trackGA4Event(extension: Extension, eventName: string, p
310
359
 
311
360
  /**
312
361
  * Triggers the login process in the host application for the given extension.
362
+ *
363
+ * Supports three modes based on the supplied config:
364
+ * - **SSO / social login**: pass `provider` to redirect the browser to the configured SSO URL.
365
+ * - **Redirect only**: pass only `redirect` (no credentials) to navigate the user to the auth
366
+ * page with an optional `from` state so they return after login.
367
+ * - **Email / password login**: pass `email` and `password` to authenticate directly via the API.
368
+ * On success, tokens, user details, and permissions are stored in the Redux store.
369
+ *
313
370
  * @param extension - The extension object.
314
- * @param config - Optional configuration for login.
315
- * @returns The result of the triggerLogin resource.
371
+ * @param config - Optional configuration: `redirect` (return path), `email`+`password` for
372
+ * credential login, or `provider` for SSO (e.g. `'google'`).
373
+ * @returns A promise resolving to `{ success: true, data }` on credential login success,
374
+ * `{ success: false, error }` on failure, or `undefined` for redirect / SSO flows.
316
375
  * @public
317
376
  */
318
- export declare function triggerLogin(extension: Extension, config?: TriggerLoginConfig): unknown;
377
+ export declare function triggerLogin(extension: Extension, config?: TriggerLoginConfig): Promise<TriggerLoginResult | undefined>;
319
378
 
320
379
  /**
321
380
  * Configuration for triggering the login process
@@ -323,6 +382,100 @@ export declare function triggerLogin(extension: Extension, config?: TriggerLogin
323
382
  */
324
383
  export declare type TriggerLoginConfig = {
325
384
  redirect?: string;
385
+ email?: string;
386
+ password?: string;
387
+ provider?: string;
388
+ };
389
+
390
+ /**
391
+ * Result returned by triggerLogin when credentials or SSO provider are supplied
392
+ * @public
393
+ */
394
+ export declare type TriggerLoginResult = {
395
+ success: true;
396
+ data: unknown;
397
+ } | {
398
+ success: false;
399
+ error: unknown;
400
+ };
401
+
402
+ /**
403
+ * Triggers the logout process in the host application for the given extension.
404
+ * @param extension - The extension object.
405
+ * @param config - Optional configuration: `redirect` (path to navigate to after logout).
406
+ * @returns A promise that resolves once the logout process completes.
407
+ * @public
408
+ */
409
+ export declare function triggerLogout(extension: Extension, config?: TriggerLogoutConfig): Promise<void>;
410
+
411
+ /**
412
+ * Configuration for triggering the logout process
413
+ * @public
414
+ */
415
+ export declare type TriggerLogoutConfig = {
416
+ redirect?: string;
417
+ };
418
+
419
+ /**
420
+ * Triggers the host to send a one-time password to the given email for the given intent.
421
+ * The host injects the tenant identifier automatically.
422
+ * @param extension - The extension object.
423
+ * @param params - `email` and `intent` (see `OTP_INTENT`).
424
+ * @returns A promise resolving to `{ success, data }` or `{ success, error }`.
425
+ * @public
426
+ */
427
+ export declare function triggerSendOTP(extension: Extension, params: TriggerSendOtpParams): Promise<TriggerSendOtpResult>;
428
+
429
+ /**
430
+ * Parameters for triggering an OTP send
431
+ * @public
432
+ */
433
+ export declare type TriggerSendOtpParams = {
434
+ email: string;
435
+ intent: OtpIntent;
436
+ };
437
+
438
+ /**
439
+ * Result returned by triggerSendOTP
440
+ * @public
441
+ */
442
+ export declare type TriggerSendOtpResult = {
443
+ success: boolean;
444
+ data?: unknown;
445
+ error?: unknown;
446
+ };
447
+
448
+ /**
449
+ * Triggers the host to register a new user. On success, the host logs the user in
450
+ * immediately, equivalent to a successful triggerLogin. The host injects the tenant
451
+ * identifier automatically.
452
+ * @param extension - The extension object.
453
+ * @param params - `email`, `password`, `firstName`, `lastName`, and the verified `otp`.
454
+ * @returns A promise resolving to `{ success, data }` or `{ success, error }`.
455
+ * @public
456
+ */
457
+ export declare function triggerSignUp(extension: Extension, params: TriggerSignUpParams): Promise<TriggerSignUpResult>;
458
+
459
+ /**
460
+ * Parameters for triggering sign up
461
+ * @public
462
+ */
463
+ export declare type TriggerSignUpParams = {
464
+ email: string;
465
+ password: string;
466
+ firstName: string;
467
+ lastName: string;
468
+ otp: string;
469
+ };
470
+
471
+ /**
472
+ * Result returned by triggerSignUp
473
+ * @public
474
+ */
475
+ export declare type TriggerSignUpResult = {
476
+ success: boolean;
477
+ data?: unknown;
478
+ error?: unknown;
326
479
  };
327
480
 
328
481
  export { Tuple }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AA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Aa,EACd,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -4,6 +4,15 @@ Copyright 2026 CloudScaile
4
4
  Licensed under the Apache License, Version 2.0
5
5
  http://www.apache.org/licenses/LICENSE-2.0
6
6
  */
7
+ /**
8
+ * Supported intents for sending a one-time password
9
+ * @public
10
+ */
11
+ export const OTP_INTENT = {
12
+ RESET_PASSWORD: 'RESET_PASSWORD',
13
+ REGISTER: 'REGISTER',
14
+ EMAIL_VERIFICATION: 'EMAIL_VERIFICATION'
15
+ };
7
16
  // ============ Implementation ============
8
17
  let globalStore = {
9
18
  initialized: false
@@ -19,10 +28,14 @@ const ERROR_MAPS = {
19
28
  getUser: 'Get User',
20
29
  validateUserPermission: 'Validate User Permission',
21
30
  triggerLogin: 'Trigger Login',
31
+ triggerLogout: 'Trigger Logout',
22
32
  getCookieConsent: 'Get Cookie Consent',
23
33
  updateCookieConsent: 'Update Cookie Consent',
24
34
  resetCookieConsent: 'Reset Cookie Consent',
25
- trackGA4Event: 'Track GA4 Event'
35
+ trackGA4Event: 'Track GA4 Event',
36
+ getOAuthProviders: 'Get OAuth Providers',
37
+ triggerSendOTP: 'Trigger Send OTP',
38
+ triggerSignUp: 'Trigger Sign Up'
26
39
  };
27
40
  /**
28
41
  * Initialize the communication package in the host application
@@ -37,10 +50,14 @@ const ERROR_MAPS = {
37
50
  * - getUser: Function to get the user information from the host
38
51
  * - validateUserPermission: Function to validate user permissions in the host
39
52
  * - triggerLogin: Function to trigger login in the host
53
+ * - triggerLogout: Function to trigger logout in the host
40
54
  * - getCookieConsent: Function to retrieve the current cookie consent state
41
55
  * - updateCookieConsent: Function to dispatch consent actions and initialize analytics on acceptance
42
56
  * - resetCookieConsent: Function to reset consent state and stop analytics events
43
57
  * - trackGA4Event: Function to track a GA4 event
58
+ * - getOAuthProviders: Function to get the list of available OAuth providers
59
+ * - triggerSendOTP: Function to send an OTP to an email for a given intent
60
+ * - triggerSignUp: Function to register a new user and log them in on success
44
61
  * @throws Will throw an error if any required configuration is missing
45
62
  * @returns Object with method to access shared resources
46
63
  * @public
@@ -214,9 +231,19 @@ export function validateUserPermission(extension, permissions) {
214
231
  }
215
232
  /**
216
233
  * Triggers the login process in the host application for the given extension.
234
+ *
235
+ * Supports three modes based on the supplied config:
236
+ * - **SSO / social login**: pass `provider` to redirect the browser to the configured SSO URL.
237
+ * - **Redirect only**: pass only `redirect` (no credentials) to navigate the user to the auth
238
+ * page with an optional `from` state so they return after login.
239
+ * - **Email / password login**: pass `email` and `password` to authenticate directly via the API.
240
+ * On success, tokens, user details, and permissions are stored in the Redux store.
241
+ *
217
242
  * @param extension - The extension object.
218
- * @param config - Optional configuration for login.
219
- * @returns The result of the triggerLogin resource.
243
+ * @param config - Optional configuration: `redirect` (return path), `email`+`password` for
244
+ * credential login, or `provider` for SSO (e.g. `'google'`).
245
+ * @returns A promise resolving to `{ success: true, data }` on credential login success,
246
+ * `{ success: false, error }` on failure, or `undefined` for redirect / SSO flows.
220
247
  * @public
221
248
  */
222
249
  export function triggerLogin(extension, config) {
@@ -224,6 +251,18 @@ export function triggerLogin(extension, config) {
224
251
  const triggerLoginResource = getResource('triggerLogin');
225
252
  return triggerLoginResource(config);
226
253
  }
254
+ /**
255
+ * Triggers the logout process in the host application for the given extension.
256
+ * @param extension - The extension object.
257
+ * @param config - Optional configuration: `redirect` (path to navigate to after logout).
258
+ * @returns A promise that resolves once the logout process completes.
259
+ * @public
260
+ */
261
+ export function triggerLogout(extension, config) {
262
+ validateExtension(extension);
263
+ const triggerLogoutResource = getResource('triggerLogout');
264
+ return triggerLogoutResource(config);
265
+ }
227
266
  /**
228
267
  * Retrieves the current cookie consent state for the given extension.
229
268
  * @param extension - The extension object.
@@ -271,4 +310,43 @@ export function trackGA4Event(extension, eventName, params = {}) {
271
310
  const trackGA4EventResource = getResource('trackGA4Event');
272
311
  trackGA4EventResource(eventName, params);
273
312
  }
313
+ /**
314
+ * Returns the list of configured OAuth / SSO providers for the given extension,
315
+ * sorted by the host-defined order.
316
+ * @param extension - The extension object.
317
+ * @returns Array of OAuth provider descriptors.
318
+ * @public
319
+ */
320
+ export function getOAuthProviders(extension) {
321
+ validateExtension(extension);
322
+ const getOAuthProvidersResource = getResource('getOAuthProviders');
323
+ return getOAuthProvidersResource();
324
+ }
325
+ /**
326
+ * Triggers the host to send a one-time password to the given email for the given intent.
327
+ * The host injects the tenant identifier automatically.
328
+ * @param extension - The extension object.
329
+ * @param params - `email` and `intent` (see `OTP_INTENT`).
330
+ * @returns A promise resolving to `{ success, data }` or `{ success, error }`.
331
+ * @public
332
+ */
333
+ export function triggerSendOTP(extension, params) {
334
+ validateExtension(extension);
335
+ const triggerSendOTPResource = getResource('triggerSendOTP');
336
+ return triggerSendOTPResource(params);
337
+ }
338
+ /**
339
+ * Triggers the host to register a new user. On success, the host logs the user in
340
+ * immediately, equivalent to a successful triggerLogin. The host injects the tenant
341
+ * identifier automatically.
342
+ * @param extension - The extension object.
343
+ * @param params - `email`, `password`, `firstName`, `lastName`, and the verified `otp`.
344
+ * @returns A promise resolving to `{ success, data }` or `{ success, error }`.
345
+ * @public
346
+ */
347
+ export function triggerSignUp(extension, params) {
348
+ validateExtension(extension);
349
+ const triggerSignUpResource = getResource('triggerSignUp');
350
+ return triggerSignUpResource(params);
351
+ }
274
352
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AA6LF,2CAA2C;AAE3C,IAAI,WAAW,GAA6B;IAC1C,WAAW,EAAE,KAAK;CACnB,CAAC;AAEF,MAAM,UAAU,GAA0D;IACxE,QAAQ,EAAE,mBAAmB;IAC7B,UAAU,EAAE,aAAa;IACzB,QAAQ,EAAE,WAAW;IACrB,cAAc,EAAE,iBAAiB;IACjC,mBAAm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utils",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Utilities for sharing host resources with micro-frontends in web applications",
5
5
  "license": "Apache-2.0",
6
6
  "author": "CloudScaile Engineering",