@monterosa/sdk-identify-kit 2.0.0-rc.2 → 2.0.0-rc.4

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.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/types.ts","../src/constants.ts","../src/identify.ts","../src/experiences.ts","../src/api.ts","../src/bridge.ts"],"sourcesContent":["/**\n * @license\n * @monterosa/sdk-identify-kit\n *\n * Copyright © 2023-2026 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { MonterosaSdk } from '@monterosa/sdk-core';\nimport { Emitter, Unsubscribe } from '@monterosa/sdk-util';\n\n/**\n * Represents user authentication credentials.\n *\n * @remarks\n * The `token` property can be either the literal `'cookie'` for cookie-based\n * authentication or a string value for bearer token authentication.\n *\n * @example\n * ```javascript\n * // Bearer token authentication\n * const credentials: Credentials = { token: \"abc123\" };\n *\n * // Cookie-based authentication\n * const credentials: Credentials = { token: \"cookie\" };\n * ```\n */\nexport type Credentials = {\n token: 'cookie' | string;\n};\n\n/**\n * A tuple representing a digital signature: `[userId, timestamp, signature]`.\n *\n * @example\n * ```javascript\n * const signature: Signature = [\"user123\", 1646956195, \"abc123\"];\n * ```\n */\nexport type Signature = [userId: string, timestamp: number, signature: string];\n\n/**\n * A key-value object representing user profile data.\n *\n * @remarks\n * Contains `userId`, `timestamp`, and `signature` alongside any\n * additional custom properties.\n *\n * @example\n * ```javascript\n * const userData: UserData = {\n * userId: \"user123\",\n * timeStamp: 1646956195,\n * signature: \"abc123\",\n * name: \"John Doe\",\n * age: 30,\n * email: \"john.doe@example.com\"\n * };\n * ```\n */\nexport type UserData = {\n [key: string]: any;\n};\n\nexport type ResponsePayload<T> = {\n data: T;\n error?: string;\n};\n\n/**\n * @internal\n */\nexport type IdentifyHook = (identify: IdentifyKit) => Unsubscribe;\n\nexport type LoginState = {\n state: 'logged_out' | 'logged_in' | 'pending' | 'error';\n error?: string;\n errorType?: 'login' | 'logout';\n};\n\nexport type LoginPolicy = 'disabled' | 'auto';\n\n/**\n * Configuration options for Identify Kit.\n */\nexport interface IdentifyOptions {\n /**\n * Unique device identifier. Must be persisted and reused across sessions\n * to avoid duplicate user records.\n */\n readonly deviceId?: string;\n /**\n * Authentication strategy. Default: `'email'`.\n */\n readonly strategy?: string;\n /**\n * Identity provider name (e.g. `'aws'` for Cognito).\n */\n readonly provider?: string;\n /**\n * Identify API version. Default: `1`.\n */\n readonly version?: number;\n readonly loginPolicy?: LoginPolicy;\n}\n\n/**\n * Represents an Identify Kit instance. Obtain one via {@link getIdentify}.\n *\n * @remarks\n * This interface is opaque. Interact with it through the standalone\n * functions such as {@link setCredentials}, {@link clearCredentials},\n * and {@link getUserData}.\n */\nexport interface IdentifyKit extends Emitter {\n /**\n * The identify options.\n *\n * @internal\n */\n options: IdentifyOptions;\n /**\n * @internal\n */\n sdk: MonterosaSdk;\n /**\n * @internal\n */\n credentials: Credentials | null;\n /**\n * @internal\n */\n signature: Signature | null;\n /**\n * @internal\n */\n userData: UserData | null;\n /**\n * Whether the user should be automatically logged in when connection is\n * restored. This is true when:\n * - The user was previously logged in successfully\n * - Auto-login is enabled\n * - Credentials are available\n *\n * @internal\n */\n shouldLoginOnReconnect: boolean;\n\n state: LoginState;\n\n /**\n * @internal\n */\n getUrl(path?: string): Promise<string>;\n}\n\nexport interface Response {\n message: string;\n result: number;\n data: {\n [key: string]: any;\n };\n}\n\nexport interface UserResponse extends Response {}\n\nexport interface UserCheckResponse extends Response {\n data: {\n userId: string;\n timeStamp: number;\n signature: string;\n [key: string]: any;\n };\n}\n\n/**\n * @internal\n */\nexport enum IdentifyEvent {\n StateUpdated = 'state_updated',\n LoginRequested = 'login_requested',\n LogoutRequested = 'logout_requested',\n SignatureUpdated = 'signature_updated',\n UserdataUpdated = 'userdata_updated',\n CredentialsUpdated = 'credentials_updated',\n EnmasseLogin = 'enmasse_login',\n}\n\n/**\n * Defines a set of error codes that may be encountered when using the\n * Identify kit of the Monterosa SDK.\n *\n * @example\n * ```javascript\n * try {\n * // some code that uses the IdentifyKit\n * } catch (err) {\n * if (err.code === IdentifyError.NoCredentials) {\n * // handle missing credentials error\n * } else if (err.code === IdentifyError.NotInitialised) {\n * // handle initialization error\n * } else {\n * // handle other error types\n * }\n * }\n * ```\n *\n * @remarks\n * - The `IdentifyError` enum provides a convenient way to handle errors\n * encountered when using the `IdentifyKit` module. By checking the code\n * property of the caught error against the values of the enum, the error\n * type can be determined and appropriate action taken.\n *\n * - The `IdentifyError` enum is not intended to be instantiated or extended.\n */\nexport enum IdentifyError {\n /**\n * Indicates an error occurred during the call to the extension API.\n */\n ExtensionApiError = 'extension_api_error',\n /**\n * Indicates the extension required by the IdentifyKit is not set up properly.\n */\n ExtensionNotSetup = 'extension_not_setup',\n /**\n * Indicates the user's authentication credentials are not available\n * or have expired.\n */\n NoCredentials = 'no_credentials',\n /**\n * Indicates the IdentifyKit has not been initialised properly.\n */\n NotInitialised = 'not_initialised',\n /**\n * Indicates an error occurred in the parent app.\n */\n ParentAppError = 'parent_app_error',\n /**\n * Indicates an unexpected or invalid login state was encountered.\n */\n UnexpectedState = 'unexpected_state',\n /**\n * Indicates there is no parent application to delegate to.\n */\n NoParentApplication = 'no_parent_application',\n /**\n * Indicates a timeout occurred when communicating with the parent app.\n */\n ParentTimeoutError = 'parent_timeout_error',\n}\n\n/**\n * @internal\n */\nexport const IdentifyErrorMessages = {\n [IdentifyError.ExtensionApiError]: (error: string) =>\n `Identify extension API returned an error: ${error}`,\n [IdentifyError.ExtensionNotSetup]: () =>\n 'Identify extension is not set up for this project',\n [IdentifyError.NoCredentials]: () => 'Identify credentials are not set',\n [IdentifyError.NotInitialised]: () => 'Identify instance is not initialised',\n [IdentifyError.ParentAppError]: (error: string) =>\n `Parent application error: ${error}`,\n [IdentifyError.UnexpectedState]: (state: string) =>\n `Unexpected LoginState: ${state}`,\n [IdentifyError.NoParentApplication]: () =>\n 'No parent application available for delegation',\n [IdentifyError.ParentTimeoutError]: (error: string) =>\n `Parent application timeout: ${error}. Please check if the identify-kit is imported on the parent page.`,\n};\n\nexport enum IdentifyAction {\n Login = 'identifyLogin',\n Logout = 'identifyLogout',\n RequestLogin = 'identifyRequestLogin',\n RequestLogout = 'identifyRequestLogout',\n GetUserData = 'identifyGetUserData',\n GetSessionSignature = 'identifyGetSessionSignature',\n SetCredentials = 'identifySetCredentials',\n ClearCredentials = 'identifyClearCredentials',\n OnStateUpdated = 'identifyOnStateUpdated',\n OnCredentialsUpdated = 'identifyOnCredentialsUpdated',\n OnUserDataUpdated = 'identifyOnUserDataUpdated',\n OnSessionSignatureUpdated = 'identifyOnSessionSignatureUpdated',\n}\n","/**\n * @license\n * @monterosa/sdk-identify-kit\n *\n * Copyright © 2023 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nexport const EXTENSION_ID = 'lvis-id-custom-tab';\n\nexport const SIGNATURE_TTL = 10_000;\n","/**\n * @license\n * @monterosa/sdk-identify-kit\n *\n * Copyright © 2023 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { MonterosaSdk, getDeviceId } from '@monterosa/sdk-core';\nimport { Emitter, createError } from '@monterosa/sdk-util';\nimport { fetchListings } from '@monterosa/sdk-interact-interop';\n\nimport {\n IdentifyKit,\n IdentifyOptions,\n IdentifyEvent,\n IdentifyError,\n IdentifyErrorMessages,\n LoginState,\n Credentials,\n Signature,\n UserData,\n} from './types';\n\nimport { EXTENSION_ID, SIGNATURE_TTL } from './constants';\n\nexport default class Identify extends Emitter implements IdentifyKit {\n private wasLoggedIn: boolean = false;\n\n private host?: string;\n private readonly _options: IdentifyOptions;\n\n private _credentials: Credentials | null = null;\n private _signature: Signature | null = null;\n private _userData: UserData | null = null;\n private signatureExpireTimeout!: ReturnType<typeof setTimeout>;\n private userDataExpireTimeout!: ReturnType<typeof setTimeout>;\n\n _state: LoginState = {\n state: 'logged_out',\n };\n\n constructor(public sdk: MonterosaSdk, options: IdentifyOptions = {}) {\n super();\n\n this._options = {\n strategy: 'email',\n deviceId: getDeviceId(),\n version: 1,\n loginPolicy: 'disabled',\n ...options,\n };\n }\n\n private static async fetchIdentifyHost(\n host: string,\n projectId: string,\n ): Promise<string> {\n const listings = await fetchListings(host, projectId);\n const extensionAssets = listings.assets?.[EXTENSION_ID] ?? [];\n\n const endpointAsset = extensionAssets.find(\n ({ name }) => name === 'endpoint',\n );\n\n if (!endpointAsset) {\n throw createError(IdentifyError.ExtensionNotSetup, IdentifyErrorMessages);\n }\n\n return endpointAsset.data;\n }\n\n get state(): LoginState {\n return this._state;\n }\n\n set state(state: LoginState) {\n if (this._state.state === state.state) {\n return;\n }\n\n switch (state.state) {\n case 'logged_in':\n this.wasLoggedIn = true;\n break;\n case 'logged_out':\n case 'error':\n this.wasLoggedIn = false;\n break;\n case 'pending':\n // preserve wasLoggedIn value during transitional state\n break;\n default: {\n // Exhaustiveness check: TypeScript errors if a new state is added\n // but not handled. This is a compile-time error.\n //\n // See: https://www.typescriptlang.org/docs/handbook/2/narrowing.html#exhaustiveness-checking\n const exhaustiveCheck: never = state.state;\n\n throw createError(\n IdentifyError.UnexpectedState,\n IdentifyErrorMessages,\n String(exhaustiveCheck),\n );\n }\n }\n\n this._state = state;\n\n this.emit(IdentifyEvent.StateUpdated, state);\n }\n\n get options() {\n return this._options;\n }\n\n set signature(signature: Signature | null) {\n if (this._signature === signature) {\n return;\n }\n\n this._signature = signature;\n\n clearTimeout(this.signatureExpireTimeout);\n\n if (signature !== null) {\n this.signatureExpireTimeout = setTimeout(() => {\n this.signature = null;\n }, SIGNATURE_TTL);\n }\n\n this.emit(IdentifyEvent.SignatureUpdated, this.signature);\n }\n\n get signature(): Signature | null {\n return this._signature;\n }\n\n set credentials(credentials: Credentials | null) {\n if (this._credentials === credentials) {\n return;\n }\n\n this._credentials = credentials;\n\n this.emit(IdentifyEvent.CredentialsUpdated, credentials);\n }\n\n get credentials(): Credentials | null {\n return this._credentials;\n }\n\n set userData(data: UserData | null) {\n if (this._userData === data) {\n return;\n }\n\n this._userData = data;\n\n clearTimeout(this.userDataExpireTimeout);\n\n this.emit(IdentifyEvent.UserdataUpdated, data);\n }\n\n get userData(): UserData | null {\n return this._userData;\n }\n\n get shouldLoginOnReconnect(): boolean {\n return (\n this.wasLoggedIn &&\n this.options.loginPolicy === 'auto' &&\n this.credentials !== null\n );\n }\n\n reset() {\n this.credentials = null;\n this.userData = null;\n this.signature = null;\n this.wasLoggedIn = false;\n }\n\n async getUrl(path: string = '') {\n const {\n options: { host, projectId },\n } = this.sdk;\n\n if (this.host === undefined) {\n this.host = await Identify.fetchIdentifyHost(host, projectId);\n }\n\n const url = new URL(this.host!);\n const { version, deviceId, strategy, provider } = this._options;\n\n url.pathname = `/v${version}${path}`;\n\n url.searchParams.set('projectId', projectId);\n url.searchParams.set('deviceId', deviceId!);\n url.searchParams.set('strategy', strategy!);\n\n if (provider !== undefined) {\n url.searchParams.set('provider', provider);\n }\n\n return url.toString();\n }\n}\n","/**\n * @license\n * @monterosa/sdk-identify-kit\n *\n * Copyright © 2025-2026 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport type { Unsubscribe } from '@monterosa/sdk-util';\nimport type { Experience } from '@monterosa/sdk-launcher-kit';\n\ntype ExperienceEntry = {\n experience: Experience;\n unsubs: Set<Unsubscribe>;\n};\n\nconst entries = new Map<string, ExperienceEntry>();\n\nexport function getExperiences(): Experience[] {\n return Array.from(entries.values()).map((entry) => entry.experience);\n}\n\nexport function addExperience(\n experience: Experience,\n unsubs: Unsubscribe[] = [],\n) {\n entries.set(experience.id, {\n experience,\n unsubs: new Set(unsubs),\n });\n}\n\nexport function deleteExperience(experience: Experience) {\n const entry = entries.get(experience.id);\n\n if (entry) {\n entry.unsubs.forEach((unsub) => unsub());\n entries.delete(experience.id);\n }\n}\n","/**\n * @license\n * identify-kit\n *\n * Copyright © 2023-2026 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { MonterosaSdk, Sdk, getSdk } from '@monterosa/sdk-core';\nimport {\n Unsubscribe,\n TaskQueue,\n subscribe,\n createError,\n withRetryAsync,\n memoizePromise,\n MonterosaError,\n getErrorMessage,\n} from '@monterosa/sdk-util';\nimport {\n getConnect,\n login as connectLogin,\n logout as connectLogout,\n connect,\n onConnected,\n onConnecting,\n onDisconnected,\n} from '@monterosa/sdk-connect-kit';\nimport {\n Payload,\n getParentApplication,\n sendSdkRequest,\n sendSdkMessage,\n BridgeError,\n} from '@monterosa/sdk-launcher-kit';\n\nimport {\n IdentifyKit,\n Response,\n ResponsePayload,\n UserResponse,\n UserCheckResponse,\n LoginState,\n Credentials,\n Signature,\n UserData,\n IdentifyOptions,\n IdentifyAction,\n IdentifyHook,\n IdentifyEvent,\n IdentifyError,\n IdentifyErrorMessages,\n} from './types';\n\nimport Identify from './identify';\nimport { getExperiences } from './experiences';\n\nconst identifyKits: Map<string, Identify> = new Map();\nconst identifyHooks: IdentifyHook[] = [];\n\n/**\n * @internal\n */\nexport const taskQueue = new TaskQueue();\n\nfunction isSdk(value: MonterosaSdk | any): value is MonterosaSdk {\n return value instanceof Sdk;\n}\n\nasync function api<T extends Response>(\n url: string,\n token: Credentials['token'],\n method: string = 'GET',\n): Promise<T> {\n const headers: Record<string, string> = {\n accept: 'application/json',\n };\n\n let credentials: RequestCredentials | undefined;\n\n // Only include Authorization header for bearer token authentication\n // When token is 'cookie', use credentials: 'include' to ensure HttpOnly\n // cookies are sent\n if (token === 'cookie') {\n // Use credentials: 'include' to ensure HttpOnly cookies are sent\n credentials = 'include';\n } else {\n headers.Authorization = `Bearer ${token}`;\n }\n\n const response = await fetch(url, {\n method,\n headers,\n credentials,\n });\n\n const data = (await response.json()) as T;\n\n if (data.result < 0) {\n throw createError(\n IdentifyError.ExtensionApiError,\n IdentifyErrorMessages,\n data.message,\n );\n }\n\n return data;\n}\n\n/**\n * @internal\n */\nexport async function parentAppRequest<T>(\n identify: IdentifyKit,\n action: IdentifyAction,\n payload?: Payload,\n): Promise<T> {\n const parentApp = getParentApplication();\n\n if (parentApp === null) {\n throw createError(IdentifyError.NoParentApplication, IdentifyErrorMessages);\n }\n\n const { host, projectId } = identify.sdk.options;\n\n // Preserve existing origin (relay) or set from current context (source)\n const origin = payload?.origin ?? { host, projectId };\n\n try {\n const response = await sendSdkRequest(parentApp, action, {\n ...payload,\n origin,\n });\n\n const { error, data } = response.payload as ResponsePayload<T>;\n\n if (error !== undefined) {\n throw createError(\n IdentifyError.ParentAppError,\n IdentifyErrorMessages,\n error,\n );\n }\n\n return data;\n } catch (err) {\n if (\n err instanceof MonterosaError &&\n err.code === BridgeError.RequestTimeoutError\n ) {\n const errorMessage = getErrorMessage(err);\n\n throw createError(\n IdentifyError.ParentTimeoutError,\n IdentifyErrorMessages,\n errorMessage,\n );\n }\n\n throw err;\n }\n}\n\n/**\n * @internal\n */\nexport function registerIdentifyHook(hook: IdentifyHook) {\n identifyHooks.push(hook);\n}\n\n/**\n * @internal\n */\nasync function login(identify: IdentifyKit, credentials: Credentials) {\n const signature = await getSessionSignatureMemoized(identify, credentials);\n\n const conn = await getConnect(identify.sdk.options.host);\n\n await connect(conn);\n await connectLogin(conn, ...signature);\n}\n\nconst loginWithRetry = withRetryAsync(login);\n\n/**\n * @internal\n */\nasync function logout(identify: IdentifyKit) {\n const conn = await getConnect(identify.sdk.options.host);\n\n await connect(conn);\n await connectLogout(conn);\n}\n\nconst logoutWithRetry = withRetryAsync(logout);\n\n/**\n * @internal\n */\nexport async function loginTask(\n identify: IdentifyKit,\n credentials: Credentials,\n) {\n try {\n identify.state = {\n state: 'pending',\n };\n\n await loginWithRetry(identify, credentials);\n\n // Update state only if there are no pending tasks in the queue\n if (taskQueue.isEmpty()) {\n identify.state = {\n state: 'logged_in',\n };\n }\n } catch (err) {\n taskQueue.clear();\n\n identify.state = {\n state: 'error',\n error: err instanceof Error ? err.message : 'Unknown error',\n errorType: 'login',\n };\n }\n}\n\n/**\n * @internal\n */\nexport async function logoutTask(identify: IdentifyKit) {\n try {\n identify.state = {\n state: 'pending',\n };\n\n await logoutWithRetry(identify);\n\n // Update state only if there are no pending tasks in the queue\n if (taskQueue.isEmpty()) {\n identify.state = {\n state: 'logged_out',\n };\n }\n } catch (err) {\n taskQueue.clear();\n\n identify.state = {\n state: 'error',\n error: err instanceof Error ? err.message : 'Unknown error',\n errorType: 'logout',\n };\n }\n}\n\n/**\n * @internal\n */\nexport function enqueueLogin(\n identify: IdentifyKit,\n credentials: Credentials,\n prioritise: boolean = false,\n) {\n if (identify.options.loginPolicy === 'auto') {\n if (prioritise) {\n taskQueue.enqueueFront(() => loginTask(identify, credentials));\n } else {\n taskQueue.enqueue(() => loginTask(identify, credentials));\n }\n }\n\n for (const experience of getExperiences()) {\n sendSdkMessage(experience, IdentifyAction.Login, credentials);\n }\n}\n\n/**\n * @internal\n */\nexport function enqueueLogout(identify: IdentifyKit) {\n if (identify.options.loginPolicy === 'auto') {\n taskQueue.enqueue(() => logoutTask(identify));\n }\n\n for (const experience of getExperiences()) {\n sendSdkMessage(experience, IdentifyAction.Logout);\n }\n}\n\n/**\n * A factory function that creates a new instance of the `IdentifyKit` class,\n * which is a kit of the Monterosa SDK used for user identification.\n *\n * @example\n * ```javascript\n * import { configure } from '@monterosa/sdk-core';\n * import { getIdentify } from '@monterosa/sdk-identify-kit';\n *\n * configure({ host: '...', projectId: '...' });\n *\n * const identify = getIdentify();\n * ```\n *\n * @remarks\n * - The `getIdentify` function returns an instance of the `IdentifyKit` class\n * using optional MonterosaSdk instance as a parameter.\n *\n * - The `IdentifyKit` instance returned by `getIdentify` can be used to authenticate\n * users and perform other user identification-related operations.\n *\n * - Subsequent calls to getIdentify with the same MonterosaSdk instance will return\n * the same `IdentifyKit` instance.\n *\n * @param sdk - An instance of the MonterosaSdk class.\n * @param options - List of `IdentifyKit` options\n * @returns An instance of the `IdentifyKit` class, which is used for user\n * identification.\n */\n\nexport function getIdentify(\n sdk?: MonterosaSdk,\n options?: IdentifyOptions,\n): IdentifyKit;\n\n/**\n * A factory function that creates a new instance of the `IdentifyKit` class,\n * which is a kit of the Monterosa SDK used for user identification.\n *\n * @example\n * ```javascript\n * import { configure } from '@monterosa/sdk-core';\n * import { getIdentify } from '@monterosa/sdk-identify-kit';\n *\n * configure({ host: '...', projectId: '...' });\n *\n * const identify = getIdentify();\n * ```\n *\n * @remarks\n * - The `getIdentify` function returns an instance of the `IdentifyKit` class\n * using optional MonterosaSdk instance as a parameter.\n *\n * - The `IdentifyKit` instance returned by `getIdentify` can be used to authenticate\n * users and perform other user identification-related operations.\n *\n * - Subsequent calls to getIdentify with the same MonterosaSdk instance will return\n * the same `IdentifyKit` instance.\n *\n * @param options - List of `IdentifyKit` options\n * @returns An instance of the `IdentifyKit` class, which is used for user\n * identification.\n */\nexport function getIdentify(options?: IdentifyOptions): IdentifyKit;\n\nexport function getIdentify(\n sdkOrOptions?: MonterosaSdk | IdentifyOptions,\n options?: IdentifyOptions,\n): IdentifyKit {\n let sdk: MonterosaSdk;\n let identifyOptions: IdentifyOptions;\n\n if (isSdk(sdkOrOptions)) {\n /**\n * Interface: getIdentify(sdk, options?)\n */\n\n sdk = sdkOrOptions;\n\n if (options !== undefined) {\n identifyOptions = options;\n } else {\n identifyOptions = {};\n }\n } else if (sdkOrOptions !== undefined) {\n /**\n * Interface: getIdentify(options)\n */\n\n sdk = getSdk();\n identifyOptions = sdkOrOptions;\n } else {\n /**\n * Interface: getIdentify()\n */\n\n sdk = getSdk();\n identifyOptions = {};\n }\n\n const {\n options: { projectId },\n } = sdk;\n\n if (identifyKits.has(projectId)) {\n return identifyKits.get(projectId) as Identify;\n }\n\n const identify = new Identify(sdk, identifyOptions);\n\n for (const hook of identifyHooks) {\n hook(identify);\n }\n\n watchConnectionStatus(identify);\n\n identifyKits.set(projectId, identify);\n\n return identify;\n}\n\n/**\n * A function that requests a user login via the `IdentifyKit` of the Monterosa SDK.\n *\n * @example\n * ```javascript\n * import { configure } from '@monterosa/sdk-core';\n * import { getIdentify, requestLogin } from '@monterosa/sdk-identify-kit';\n *\n * configure({ host: '...', projectId: '...' });\n *\n * try {\n * const identify = getIdentify();\n *\n * await requestLogin(identify);\n *\n * console.log('Login request successful');\n * } catch (err) {\n * console.error('Error requesting login:', error.message)\n * }\n * ```\n *\n * @remarks\n * - If the app is running within a third-party application that uses\n * the Monterosa SDK, the function delegates to the parent app\n * to handle the login process.\n *\n * @param identify - An instance of the `IdentifyKit` class used for user\n * identification.\n * @returns A Promise that resolves with `void` when the login request\n * is completed.\n */\nexport async function requestLogin(identify: IdentifyKit): Promise<void> {\n const parentApp = getParentApplication();\n\n if (parentApp !== null) {\n await parentAppRequest<void>(identify, IdentifyAction.RequestLogin);\n\n return;\n }\n\n identify.emit(IdentifyEvent.LoginRequested);\n}\n\n/**\n * A function that requests a user login via the `IdentifyKit` of the Space.\n *\n * @example\n * ```javascript\n * import { getSpace } from '@monterosa/sdk-core';\n * import { getIdentify, requestLogout } from '@monterosa/sdk-identify-kit';\n *\n * const space = getSpace('host', 'space-id');\n * const identify = getIdentify(space);\n *\n * try {\n * await requestLogout(identify);\n *\n * console.log('Logout request successful');\n * } catch (err) {\n * console.error('Error requesting logout:', error.message)\n * }\n * ```\n *\n * @remarks\n * - If the app is running within a third-party application that uses\n * the Space, the function delegates to the parent app\n * to handle the logout process.\n *\n * @param identify - An instance of the `IdentifyKit` class used for user\n * identification.\n * @returns A Promise that resolves with `void` when the logout request\n * is completed.\n */\nexport async function requestLogout(identify: IdentifyKit): Promise<void> {\n const parentApp = getParentApplication();\n\n if (parentApp !== null) {\n await parentAppRequest<void>(identify, IdentifyAction.RequestLogout);\n\n return;\n }\n\n identify.emit(IdentifyEvent.LogoutRequested);\n}\n\n/**\n * @internal\n *\n * Returns a signature for a user session. The signature is based on the\n * user's identifying information provided in the `IdentifyKit` instance.\n *\n * @remarks\n * This function does not handle errors. Callers are responsible for catching\n * and handling failures.\n *\n * @param identify - An instance of the `IdentifyKit` class used for user\n * identification.\n * @param credentials - The credentials of the user.\n *\n * @returns A Promise that resolves to a `Signature` object.\n */\nexport async function getSessionSignature(\n identify: IdentifyKit,\n credentials: Credentials,\n): Promise<Signature> {\n const parentApp = getParentApplication();\n\n if (parentApp !== null) {\n const signature = await parentAppRequest<Signature>(\n identify,\n IdentifyAction.GetSessionSignature,\n credentials,\n );\n\n return signature;\n }\n\n if (identify.signature !== null) {\n return identify.signature;\n }\n\n const url = await identify.getUrl('/user/check');\n\n const { data } = await api<UserCheckResponse>(url, credentials.token);\n\n const signature: Signature = [data.userId, data.timeStamp, data.signature];\n\n identify.signature = signature;\n\n return signature;\n}\n\n/**\n * A memoized version of the `getSessionSignature` function.\n */\nexport const getSessionSignatureMemoized = memoizePromise(\n getSessionSignature,\n (identify: IdentifyKit, credentials: Credentials) => credentials.token,\n {\n clearOnResolve: true,\n clearOnReject: true,\n },\n);\n\n/**\n * The function that takes an instance of `IdentifyKit` as its argument and\n * returns a Promise that resolves to a key-value object representing user data.\n *\n * @example\n * ```javascript\n * import { configure } from '@monterosa/sdk-core';\n * import { getIdentify, getUserData } from '@monterosa/sdk-identify-kit';\n *\n * configure({ host: '...', projectId: '...' });\n *\n * const identify = getIdentify();\n * const userData = await getUserData(identify);\n *\n * console.log('User data:', userData);\n * ```\n *\n * @remarks\n * - If the app is running within a third-party application that uses\n * the Monterosa SDK, the function delegates to the parent app\n * to get user data.\n *\n * - If the request is successful, the function resolves with a key-value object\n * representing user data. If not, a `MonterosaError` is thrown.\n *\n * @param identify - An instance of `IdentifyKit` that provides the user\n * identification functionality.\n * @returns A Promise that resolves to a key-value object representing user data.\n * The structure and content of the user data object depend on the identify\n * service provider and may vary. It typically contains information about the user,\n * but the specific fields are determined by the Identify service provider.\n */\nexport async function getUserData(identify: IdentifyKit): Promise<UserData> {\n const parentApp = getParentApplication();\n\n if (parentApp !== null) {\n const userData = await parentAppRequest<UserData>(\n identify,\n IdentifyAction.GetUserData,\n );\n\n return userData;\n }\n\n // Return cached user data if available\n if (identify.userData !== null) {\n return identify.userData;\n }\n\n if (identify.credentials === null) {\n throw createError(IdentifyError.NoCredentials, IdentifyErrorMessages);\n }\n\n const url = await identify.getUrl('/user');\n\n const { data } = await api<UserResponse>(url, identify.credentials.token);\n\n identify.userData = data;\n\n return data;\n}\n\n/**\n * Sets the user's authentication credentials.\n *\n * @example\n * ```javascript\n * import { configure } from '@monterosa/sdk-core';\n * import { getIdentify, setCredentials } from '@monterosa/sdk-identify-kit';\n *\n * configure({ host: '...', projectId: '...' });\n *\n * const credentials = { token: 'abc123' };\n * const identify = getIdentify();\n *\n * await setCredentials(identify, credentials)\n * ```\n *\n * @remarks\n * - If the app is running within a third-party application that uses\n * the Monterosa SDK, the function delegates to the parent app\n * to set user credentials.\n *\n * - If the request is successful, the function resolves to `void`.\n * If not, a `MonterosaError` is thrown.\n *\n * @param identify - An instance of `IdentifyKit` that provides the user\n * identification functionality.\n * @param credentials - An object representing the user's authentication\n * credentials.\n * @returns A Promise that resolves to `void`.\n */\nexport async function setCredentials(\n identify: IdentifyKit,\n credentials: Credentials,\n): Promise<void> {\n const parentApp = getParentApplication();\n\n if (parentApp !== null) {\n await parentAppRequest<void>(\n identify,\n IdentifyAction.SetCredentials,\n credentials,\n );\n\n return;\n }\n\n const shouldLogin = identify.credentials === null;\n\n identify.credentials = credentials;\n\n if (shouldLogin) {\n enqueueLogin(identify, credentials);\n }\n}\n\n/**\n * Clears the user's authentication credentials.\n *\n * @example\n * ```javascript\n * import { configure } from '@monterosa/sdk-core';\n * import { getIdentify, clearCredentials } from '@monterosa/sdk-identify-kit';\n *\n * configure({ host: '...', projectId: '...' });\n *\n * const identify = getIdentify();\n *\n * await clearCredentials(identify);\n * ```\n *\n * @remarks\n * - If the app is running within a third-party application that uses\n * the Monterosa SDK, the function delegates to the parent app\n * to clear user credentials.\n *\n * - If the request is successful, the function resolves to `void`.\n * If not, a `MonterosaError` is thrown.\n *\n * @param identify - An instance of `IdentifyKit` that provides the user\n * identification functionality.\n * @returns A Promise that resolves to `void`.\n */\nexport async function clearCredentials(identify: IdentifyKit) {\n const parentApp = getParentApplication();\n\n if (parentApp !== null) {\n await parentAppRequest<void>(identify, IdentifyAction.ClearCredentials);\n\n return;\n }\n\n const shouldLogout = identify.credentials !== null;\n\n identify.credentials = null;\n identify.userData = null;\n identify.signature = null;\n\n if (shouldLogout) {\n enqueueLogout(identify);\n }\n}\n\n/**\n * Registers a callback function that will be called whenever the `LoginState`\n * object associated with the `IdentifyKit` instance is updated.\n *\n * @example\n * ```javascript\n * import { configure } from '@monterosa/sdk-core';\n * import { getIdentify, onStateUpdated } from '@monterosa/sdk-identify-kit';\n *\n * configure({ host: '...', projectId: '...' });\n *\n * const identify = getIdentify();\n *\n * const unsubscribe = onStateUpdated(identify, (state) => {\n * console.log(\"State updated:\", state);\n * });\n *\n * // Call unsubscribe() to unregister the callback function\n * // unsubscribe();\n * ```\n *\n * @param identify - An instance of `IdentifyKit` that provides the user\n * identification functionality.\n * @param callback - The callback function to register. This function will be\n * called with the updated `LoginState` object as its only argument.\n * @returns An `Unsubscribe` function that can be called to unregister\n * the callback function.\n */\nexport function onStateUpdated(\n identify: IdentifyKit,\n callback: (state: LoginState) => void,\n): Unsubscribe {\n return subscribe(identify, IdentifyEvent.StateUpdated, callback);\n}\n\n/**\n * Registers a callback function that will be called whenever the `Credentials`\n * object associated with the `IdentifyKit` instance is updated.\n *\n * @example\n * ```javascript\n * import { configure } from '@monterosa/sdk-core';\n * import { getIdentify, onCredentialsUpdated } from '@monterosa/sdk-identify-kit';\n *\n * configure({ host: '...', projectId: '...' });\n *\n * const identify = getIdentify();\n *\n * const unsubscribe = onCredentialsUpdated(identify, (credentials) => {\n * if (credentials !== null) {\n * console.log(\"Credentials updated:\", credentials);\n * } else {\n * console.log(\"Credentials cleared.\");\n * }\n * });\n *\n * // Call unsubscribe() to unregister the callback function\n * // unsubscribe();\n * ```\n *\n * @param identify - An instance of `IdentifyKit` that provides the user\n * identification functionality.\n * @param callback - The callback function to register. This function will be\n * called with the updated `Credentials` object as its only argument.\n * If the value `null` is received, it indicates that the signature has\n * been cleared\n * @returns An `Unsubscribe` function that can be called to unregister\n * the callback function.\n */\nexport function onCredentialsUpdated(\n identify: IdentifyKit,\n callback: (credentials: Credentials | null) => void,\n): Unsubscribe {\n return subscribe(identify, IdentifyEvent.CredentialsUpdated, callback);\n}\n\n/**\n * Registers a callback function that will be called whenever the `Signature`\n * object associated with the `IdentifyKit` instance is updated.\n *\n * @example\n * ```javascript\n * import { configure } from '@monterosa/sdk-core';\n * import { getIdentify, onSignatureUpdated } from '@monterosa/sdk-identify-kit';\n *\n * configure({ host: '...', projectId: '...' });\n *\n * const identify = getIdentify();\n *\n * const unsubscribe = onSignatureUpdated(identify, (signature) => {\n * if (signature !== null) {\n * console.log(\"Signature updated:\", signature);\n * } else {\n * console.log(\"Signature cleared.\");\n * }\n * });\n *\n * // Call unsubscribe() to unregister the callback function\n * // unsubscribe();\n * ```\n *\n * @param identify - An instance of `IdentifyKit` that provides the user\n * identification functionality.\n * @param callback - The callback function to register. This function will be\n * called with the updated `Signature` object as its only argument.\n * If the value `null` is received, it indicates that the signature has\n * been cleared\n * @returns An `Unsubscribe` function that can be called to unregister\n * the callback function.\n */\nexport function onSignatureUpdated(\n identify: IdentifyKit,\n callback: (signature: Signature | null) => void,\n): Unsubscribe {\n return subscribe(identify, IdentifyEvent.SignatureUpdated, callback);\n}\n\n/**\n * Registers a callback function that will be called whenever the `UserData`\n * object associated with the `IdentifyKit` instance is updated.\n *\n * @example\n * ```javascript\n * import { configure } from '@monterosa/sdk-core';\n * import { getIdentify, onUserDataUpdated } from '@monterosa/sdk-identify-kit';\n *\n * configure({ host: '...', projectId: '...' });\n *\n * const identify = getIdentify();\n *\n * const unsubscribe = onUserDataUpdated(identify, (userData) => {\n * if (userData !== null) {\n * console.log(\"User's data updated:\", userData);\n * } else {\n * console.log(\"User's data cleared.\");\n * }\n * });\n *\n * // Call unsubscribe() to unregister the callback function\n * // unsubscribe();\n * ```\n *\n * @param identify - An instance of `IdentifyKit` that provides the user\n * identification functionality.\n * @param callback - The callback function to register. This function will be\n * called with the updated `UserData` object as its only argument.\n * If the value `null` is received, it indicates that the user's data has\n * been cleared\n * @returns An `Unsubscribe` function that can be called to unregister\n * the callback function.\n */\nexport function onUserDataUpdated(\n identify: IdentifyKit,\n callback: (userData: UserData | null) => void,\n): Unsubscribe {\n return subscribe(identify, IdentifyEvent.UserdataUpdated, callback);\n}\n\n/**\n * Registers a callback function that will be called when a login is requested\n * by an Experience.\n *\n * @example\n * ```javascript\n * import { configure } from '@monterosa/sdk-core';\n * import { getIdentify, onLoginRequestedByExperience } from '@monterosa/sdk-identify-kit';\n *\n * configure({ host: '...', projectId: '...' });\n *\n * const identify = getIdentify();\n *\n * const unsubscribe = onLoginRequestedByExperience(identify, () => {\n * showLoginForm();\n * });\n *\n * // Call unsubscribe() to unregister the callback function\n * // unsubscribe();\n * ```\n *\n * @param identify - An instance of `IdentifyKit` that provides the user\n * identification functionality.\n * @param callback - The callback function to register. This function will\n * be called when a login is requested by an Experience.\n * @returns An `Unsubscribe` function that can be called to unregister\n * the callback function.\n */\nexport function onLoginRequestedByExperience(\n identify: IdentifyKit,\n callback: () => void,\n): Unsubscribe {\n return subscribe(identify, IdentifyEvent.LoginRequested, callback);\n}\n\n/**\n * Registers a callback function that will be called when a logout is requested\n * by an Experience.\n *\n * @example\n * ```javascript\n * import { getSpace } from '@monterosa/sdk-core';\n * import { getIdentify, onLogoutRequestedByExperience } from '@monterosa/sdk-identify-kit';\n *\n * const space = getSpace('host', 'space-id');\n * const identify = getIdentify(space);\n *\n * const unsubscribe = onLogoutRequestedByExperience(identify, () => {\n * // logout requested by experience\n * // perform logout from Auth service\n * });\n *\n * // Call unsubscribe() to unregister the callback function\n * // unsubscribe();\n * ```\n *\n * @param identify - An instance of `IdentifyKit` that provides the user\n * identification functionality.\n * @param callback - The callback function to register. This function will\n * be called when a logout is requested by an Experience.\n * @returns An `Unsubscribe` function that can be called to unregister\n * the callback function.\n */\nexport function onLogoutRequestedByExperience(\n identify: IdentifyKit,\n callback: () => void,\n): Unsubscribe {\n return subscribe(identify, IdentifyEvent.LogoutRequested, callback);\n}\n\n/**\n *\n * @internal\n */\nexport async function watchConnectionStatus(identify: IdentifyKit) {\n const conn = await getConnect(identify.sdk.options.host);\n\n onConnected(conn, () => {\n if (identify.shouldLoginOnReconnect) {\n enqueueLogin(identify, identify.credentials!, true);\n }\n\n taskQueue.resume();\n });\n\n onConnecting(conn, () => {\n taskQueue.pause();\n\n // If the user was logged in before the connection loss, set the state\n // to pending to notify that the user is no longer logged in and a login\n // attempt will be made when the connection is restored.\n if (identify.state.state === 'logged_in') {\n identify.state = {\n state: 'pending',\n };\n }\n });\n\n onDisconnected(conn, () => {\n taskQueue.pause();\n taskQueue.clear();\n\n // If the user was logged in before the connection loss, set the state\n // to logged_out to notify that the user is no longer logged in.\n if (identify.state.state === 'logged_in') {\n identify.state = {\n state: 'logged_out',\n };\n }\n });\n}\n","/**\n * @license\n * @monterosa/sdk-identify-kit\n *\n * Copyright © 2023-2026 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { MonterosaSdk, configure, getSdks } from '@monterosa/sdk-core';\nimport { getErrorMessage } from '@monterosa/sdk-util';\nimport {\n Experience,\n Payload,\n Message,\n getParentApplication,\n respondToSdkMessage,\n sendSdkMessage,\n onStateChanged,\n onSdkMessage,\n} from '@monterosa/sdk-launcher-kit';\n\nimport {\n IdentifyKit,\n IdentifyAction,\n Credentials,\n Signature,\n UserData,\n} from './types';\n\nimport {\n getIdentify,\n getUserData,\n getSessionSignatureMemoized,\n setCredentials,\n clearCredentials,\n requestLogin,\n requestLogout,\n enqueueLogin,\n enqueueLogout,\n onCredentialsUpdated,\n onSignatureUpdated,\n onUserDataUpdated,\n registerIdentifyHook,\n} from './api';\n\nimport { addExperience, deleteExperience } from './experiences';\n\n/**\n * @internal\n */\nexport function parentMessagesHook(identify: IdentifyKit) {\n const parentApp = getParentApplication();\n\n if (parentApp === null) {\n return () => {};\n }\n\n return onSdkMessage(parentApp, async (message: Message) => {\n switch (message.action) {\n case IdentifyAction.OnCredentialsUpdated: {\n identify.credentials = message.payload.data as Credentials;\n break;\n }\n case IdentifyAction.OnSessionSignatureUpdated: {\n identify.signature = message.payload.data as Signature;\n break;\n }\n case IdentifyAction.OnUserDataUpdated: {\n identify.userData = message.payload.data as UserData;\n break;\n }\n case IdentifyAction.Login: {\n enqueueLogin(identify, message.payload as Credentials);\n break;\n }\n case IdentifyAction.Logout: {\n enqueueLogout(identify);\n break;\n }\n }\n });\n}\n\n/**\n * Finds an existing SDK with matching projectId, or creates a new one.\n */\nfunction getOrConfigureSdk(host: string, projectId: string): MonterosaSdk {\n const existingSdk = getSdks().find(\n (sdk) => sdk.options.projectId === projectId,\n );\n\n return existingSdk ?? configure({ host, projectId }, projectId);\n}\n\n/**\n * @internal\n */\nexport function handleExperienceEmbedded(experience: Experience): void {\n const identify = getIdentify(experience.sdk);\n\n // Send login action with current credentials to the new experience if available.\n // The bridge queues this message until the experience is initialised.\n if (identify.credentials) {\n sendSdkMessage(experience, IdentifyAction.Login, identify.credentials);\n }\n\n const credentialsUpdatedUnsub = onCredentialsUpdated(identify, (data) => {\n sendSdkMessage(experience, IdentifyAction.OnCredentialsUpdated, {\n data,\n });\n });\n\n const signatureUpdatedUnsub = onSignatureUpdated(identify, (data) => {\n sendSdkMessage(experience, IdentifyAction.OnSessionSignatureUpdated, {\n data,\n });\n });\n\n const userDataUpdatedUnsub = onUserDataUpdated(identify, (data) => {\n sendSdkMessage(experience, IdentifyAction.OnUserDataUpdated, {\n data,\n });\n });\n\n const sdkMessageUnsub = onSdkMessage(experience, async (message) => {\n if (\n !Object.values(IdentifyAction).includes(message.action as IdentifyAction)\n ) {\n return;\n }\n\n // Extract origin context from payload if available.\n // New clients include origin (host, projectId) to ensure correct project context\n // in multilevel integrations. Old clients don't send origin, so we fall back\n // to the experience's SDK to maintain backward compatibility.\n const { origin } = message.payload as {\n origin?: { host: string; projectId: string };\n };\n\n const originSdk = origin\n ? getOrConfigureSdk(origin.host, origin.projectId)\n : experience.sdk;\n\n const originIdentify = getIdentify(originSdk);\n\n const respond = (payload?: Payload) =>\n respondToSdkMessage(experience, message, payload);\n\n try {\n switch (message.action) {\n case IdentifyAction.RequestLogin: {\n await requestLogin(originIdentify);\n\n respond();\n\n break;\n }\n case IdentifyAction.RequestLogout: {\n await requestLogout(identify);\n\n respond();\n break;\n }\n case IdentifyAction.GetUserData: {\n const data = await getUserData(identify);\n\n respond({ data });\n break;\n }\n case IdentifyAction.GetSessionSignature: {\n const signature = await getSessionSignatureMemoized(\n identify,\n message.payload as Credentials,\n );\n\n respond({ data: signature });\n break;\n }\n case IdentifyAction.SetCredentials: {\n await setCredentials(originIdentify, {\n token: message.payload.token as Credentials['token'],\n });\n\n respond();\n\n break;\n }\n case IdentifyAction.ClearCredentials: {\n await clearCredentials(identify);\n\n respond();\n\n break;\n }\n }\n } catch (err) {\n respond({\n error: getErrorMessage(err),\n });\n }\n });\n\n addExperience(experience, [\n credentialsUpdatedUnsub,\n signatureUpdatedUnsub,\n userDataUpdatedUnsub,\n sdkMessageUnsub,\n ]);\n}\n\n/**\n * @internal\n */\nexport function handleExperienceUnmounted(experience: Experience): void {\n deleteExperience(experience);\n}\n\nonStateChanged((experience, state) => {\n if (state === 'mounted') {\n handleExperienceEmbedded(experience);\n } else if (state === 'unmounted') {\n handleExperienceUnmounted(experience);\n }\n});\n\nregisterIdentifyHook(parentMessagesHook);\n"],"names":["connectLogin","connectLogout"],"mappings":";;;;;;AAAA;;;;;;;AAOG;AAyKH;;AAEG;AACH,IAAY,aAQX,CAAA;AARD,CAAA,UAAY,aAAa,EAAA;AACvB,IAAA,aAAA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D,gBAAgB,CAAC,UAAU,CAAC,CAAC;AAC/B,CAAC;AAED,cAAc,CAAC,CAAC,UAAU,EAAE,KAAK,KAAI;IACnC,IAAI,KAAK,KAAK,SAAS,EAAE;QACvB,wBAAwB,CAAC,UAAU,CAAC,CAAC;AACtC,KAAA;SAAM,IAAI,KAAK,KAAK,WAAW,EAAE;QAChC,yBAAyB,CAAC,UAAU,CAAC,CAAC;AACvC,KAAA;AACH,CAAC,CAAC,CAAC;AAEH,oBAAoB,CAAC,kBAAkB,CAAC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/types.ts","../src/constants.ts","../src/identify.ts","../src/experiences.ts","../src/login_policy_store.ts","../src/credentials_store.ts","../src/api.ts","../src/bridge.ts"],"sourcesContent":["/**\n * @license\n * @monterosa/sdk-identify-kit\n *\n * Copyright © 2023-2026 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { MonterosaSdk } from '@monterosa/sdk-core';\nimport { Emitter } from '@monterosa/sdk-util';\n\n/**\n * Represents user authentication credentials.\n *\n * @remarks\n * The `token` property can be either the literal `'cookie'` for cookie-based\n * authentication or a string value for bearer token authentication.\n *\n * @example\n * ```javascript\n * // Bearer token authentication\n * const credentials: Credentials = { token: \"abc123\" };\n *\n * // Cookie-based authentication\n * const credentials: Credentials = { token: \"cookie\" };\n * ```\n */\nexport type Credentials = {\n token: 'cookie' | string;\n};\n\n/**\n * A tuple representing a digital signature: `[userId, timestamp, signature]`.\n *\n * @example\n * ```javascript\n * const signature: Signature = [\"user123\", 1646956195, \"abc123\"];\n * ```\n */\nexport type Signature = [userId: string, timestamp: number, signature: string];\n\n/**\n * A key-value object representing user profile data.\n *\n * @remarks\n * Contains `userId`, `timestamp`, and `signature` alongside any\n * additional custom properties.\n *\n * @example\n * ```javascript\n * const userData: UserData = {\n * userId: \"user123\",\n * timeStamp: 1646956195,\n * signature: \"abc123\",\n * name: \"John Doe\",\n * age: 30,\n * email: \"john.doe@example.com\"\n * };\n * ```\n */\nexport type UserData = {\n [key: string]: any;\n};\n\nexport type ResponsePayload<T> = {\n data: T;\n error?: string;\n};\n\nexport type LoginState = {\n state: 'logged_out' | 'logged_in' | 'pending' | 'error';\n error?: string;\n errorType?: 'login' | 'logout';\n};\n\nexport type LoginPolicy = 'disabled' | 'auto';\n\n/**\n * Resolved configuration options for an `Identify` instance. Public APIs\n * that accept user-supplied options (such as {@link getIdentify}) take\n * `Partial<IdentifyOptions>` and apply defaults for any field not\n * supplied.\n *\n * `loginPolicy` is set separately via {@link setLoginPolicy}.\n */\nexport interface IdentifyOptions {\n /**\n * Authentication strategy. Default: `'email'`.\n */\n readonly strategy: string;\n /**\n * Identity provider name (e.g. `'aws'` for Cognito).\n */\n readonly provider?: string;\n /**\n * Identify API version. Default: `1`.\n */\n readonly version: number;\n}\n\n/**\n * Represents an Identify Kit instance. Obtain one via {@link getIdentify}.\n *\n * @remarks\n * This interface is opaque. Interact with it through the standalone\n * functions such as {@link setCredentials}, {@link clearCredentials},\n * and {@link getUserData}.\n */\nexport interface IdentifyKit extends Emitter {\n /**\n * Resolved identity options. `loginPolicy` is not on the instance —\n * see {@link setLoginPolicy}. Credentials are root-owned, accessed\n * via {@link getCredentials}.\n *\n * @internal\n */\n options: IdentifyOptions;\n /**\n * @internal\n */\n sdk: MonterosaSdk;\n /**\n * @internal\n */\n signature: Signature | null;\n /**\n * @internal\n */\n userData: UserData | null;\n /**\n * @internal\n */\n wasLoggedIn: boolean;\n\n state: LoginState;\n\n /**\n * @internal\n */\n getUrl(path?: string): Promise<string>;\n}\n\nexport interface Response {\n message: string;\n result: number;\n data: {\n [key: string]: any;\n };\n}\n\nexport interface UserResponse extends Response {}\n\nexport interface UserCheckResponse extends Response {\n data: {\n userId: string;\n timeStamp: number;\n signature: string;\n [key: string]: any;\n };\n}\n\n/**\n * @internal\n */\nexport enum IdentifyEvent {\n StateUpdated = 'state_updated',\n LoginRequested = 'login_requested',\n LogoutRequested = 'logout_requested',\n CredentialsUpdated = 'credentials_updated',\n LoginPolicyUpdated = 'login_policy_updated',\n}\n\n/**\n * Defines a set of error codes that may be encountered when using the\n * Identify kit of the Monterosa SDK.\n *\n * @example\n * ```javascript\n * try {\n * // some code that uses the IdentifyKit\n * } catch (err) {\n * if (err.code === IdentifyError.NoCredentials) {\n * // handle missing credentials error\n * } else {\n * // handle other error types\n * }\n * }\n * ```\n *\n * @remarks\n * - The `IdentifyError` enum provides a convenient way to handle errors\n * encountered when using the `IdentifyKit` module. By checking the code\n * property of the caught error against the values of the enum, the error\n * type can be determined and appropriate action taken.\n *\n * - The `IdentifyError` enum is not intended to be instantiated or extended.\n */\nexport enum IdentifyError {\n /**\n * Indicates an error occurred during the call to the extension API.\n */\n ExtensionApiError = 'extension_api_error',\n /**\n * Indicates the extension required by the IdentifyKit is not set up properly.\n */\n ExtensionNotSetup = 'extension_not_setup',\n /**\n * Indicates the user's authentication credentials are not available\n * or have expired.\n */\n NoCredentials = 'no_credentials',\n /**\n * Indicates an error occurred in the parent app.\n */\n ParentAppError = 'parent_app_error',\n /**\n * Indicates an unexpected or invalid login state was encountered.\n */\n UnexpectedState = 'unexpected_state',\n /**\n * Indicates there is no parent application to delegate to.\n */\n NoParentApplication = 'no_parent_application',\n /**\n * Indicates a timeout occurred when communicating with the parent app.\n */\n ParentTimeoutError = 'parent_timeout_error',\n}\n\n/**\n * @internal\n */\nexport const IdentifyErrorMessages = {\n [IdentifyError.ExtensionApiError]: (error: string) =>\n `Identify extension API returned an error: ${error}`,\n [IdentifyError.ExtensionNotSetup]: () =>\n 'Identify extension is not set up for this project',\n [IdentifyError.NoCredentials]: () => 'Identify credentials are not set',\n [IdentifyError.ParentAppError]: (error: string) =>\n `Parent application error: ${error}`,\n [IdentifyError.UnexpectedState]: (state: string) =>\n `Unexpected LoginState: ${state}`,\n [IdentifyError.NoParentApplication]: () =>\n 'No parent application available for delegation',\n [IdentifyError.ParentTimeoutError]: (error: string) =>\n `Parent application timeout: ${error}. Please check if the identify-kit is imported on the parent page.`,\n};\n\nexport enum IdentifyAction {\n Login = 'identifyLogin',\n Logout = 'identifyLogout',\n RequestLogin = 'identifyRequestLogin',\n RequestLogout = 'identifyRequestLogout',\n GetCredentials = 'identifyGetCredentials',\n SetCredentials = 'identifySetCredentials',\n ClearCredentials = 'identifyClearCredentials',\n}\n","/**\n * @license\n * @monterosa/sdk-identify-kit\n *\n * Copyright © 2023 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nexport const EXTENSION_ID = 'lvis-id-custom-tab';\n\nexport const SIGNATURE_TTL = 10_000;\n","/**\n * @license\n * @monterosa/sdk-identify-kit\n *\n * Copyright © 2023 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { MonterosaSdk, getDeviceId } from '@monterosa/sdk-core';\nimport { Emitter, createError } from '@monterosa/sdk-util';\nimport { fetchListings } from '@monterosa/sdk-interact-interop';\n\nimport {\n IdentifyKit,\n IdentifyOptions,\n IdentifyEvent,\n IdentifyError,\n IdentifyErrorMessages,\n LoginState,\n Signature,\n UserData,\n} from './types';\n\nimport { EXTENSION_ID, SIGNATURE_TTL } from './constants';\n\nexport class Identify extends Emitter implements IdentifyKit {\n wasLoggedIn: boolean = false;\n\n private host?: string;\n private readonly _options: IdentifyOptions;\n\n private _signature: Signature | null = null;\n private _userData: UserData | null = null;\n private signatureExpireTimeout!: ReturnType<typeof setTimeout>;\n\n _state: LoginState = {\n state: 'logged_out',\n };\n\n constructor(\n public sdk: MonterosaSdk,\n options: Partial<IdentifyOptions> = {},\n ) {\n super();\n this._options = {\n strategy: 'email',\n version: 1,\n ...options,\n };\n }\n\n private static async fetchIdentifyHost(\n host: string,\n projectId: string,\n ): Promise<string> {\n const listings = await fetchListings(host, projectId);\n const extensionAssets = listings.assets?.[EXTENSION_ID] ?? [];\n\n const endpointAsset = extensionAssets.find(\n ({ name }) => name === 'endpoint',\n );\n\n if (!endpointAsset) {\n throw createError(IdentifyError.ExtensionNotSetup, IdentifyErrorMessages);\n }\n\n return endpointAsset.data;\n }\n\n get state(): LoginState {\n return this._state;\n }\n\n set state(state: LoginState) {\n if (this._state.state === state.state) {\n return;\n }\n\n switch (state.state) {\n case 'logged_in':\n this.wasLoggedIn = true;\n break;\n case 'error':\n this.wasLoggedIn = false;\n break;\n case 'logged_out':\n case 'pending':\n // preserve wasLoggedIn — these states reflect transient transport\n // state, not a deliberate logout (credentials are the gate for that)\n break;\n default: {\n // Exhaustiveness check: TypeScript errors if a new state is added\n // but not handled. This is a compile-time error.\n //\n // See: https://www.typescriptlang.org/docs/handbook/2/narrowing.html#exhaustiveness-checking\n const exhaustiveCheck: never = state.state;\n\n throw createError(\n IdentifyError.UnexpectedState,\n IdentifyErrorMessages,\n String(exhaustiveCheck),\n );\n }\n }\n\n this._state = state;\n\n this.emit(IdentifyEvent.StateUpdated, state);\n }\n\n get options() {\n return this._options;\n }\n\n set signature(signature: Signature | null) {\n if (this._signature === signature) {\n return;\n }\n\n this._signature = signature;\n\n clearTimeout(this.signatureExpireTimeout);\n\n if (signature !== null) {\n this.signatureExpireTimeout = setTimeout(() => {\n this.signature = null;\n }, SIGNATURE_TTL);\n }\n }\n\n get signature(): Signature | null {\n return this._signature;\n }\n\n set userData(data: UserData | null) {\n if (this._userData === data) {\n return;\n }\n\n this._userData = data;\n }\n\n get userData(): UserData | null {\n return this._userData;\n }\n\n async getUrl(path: string = ''): Promise<string> {\n const { host, projectId } = this.sdk.options;\n\n if (this.host === undefined) {\n this.host = await Identify.fetchIdentifyHost(host, projectId);\n }\n\n const url = new URL(this.host);\n const { version, strategy, provider } = this._options;\n\n url.pathname = `/v${version}${path}`;\n\n url.searchParams.set('projectId', projectId);\n url.searchParams.set('deviceId', getDeviceId());\n url.searchParams.set('strategy', strategy);\n\n if (provider !== undefined) {\n url.searchParams.set('provider', provider);\n }\n\n return url.toString();\n }\n}\n","/**\n * @license\n * @monterosa/sdk-identify-kit\n *\n * Copyright © 2025-2026 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport type { Unsubscribe } from '@monterosa/sdk-util';\nimport type { Experience } from '@monterosa/sdk-launcher-kit';\n\ntype ExperienceEntry = {\n experience: Experience;\n unsubs: Set<Unsubscribe>;\n};\n\nconst entries = new Map<string, ExperienceEntry>();\n\nexport function getExperiences(): Experience[] {\n return Array.from(entries.values()).map((entry) => entry.experience);\n}\n\nexport function addExperience(\n experience: Experience,\n unsubs: Unsubscribe[] = [],\n) {\n entries.set(experience.id, {\n experience,\n unsubs: new Set(unsubs),\n });\n}\n\nexport function deleteExperience(experience: Experience) {\n const entry = entries.get(experience.id);\n\n if (entry) {\n entry.unsubs.forEach((unsub) => unsub());\n entries.delete(experience.id);\n }\n}\n","/**\n * @license\n * @monterosa/sdk-identify-kit\n *\n * Copyright © 2026 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { Emitter, Unsubscribe, subscribe } from '@monterosa/sdk-util';\n\nimport { IdentifyEvent, LoginPolicy } from './types';\n\n/**\n * Locally-owned login policy.\n *\n * Defaults to `'disabled'`. Set via the public `setLoginPolicy`. Never\n * propagated across the wire — each level owns its own policy.\n *\n * @internal\n */\nexport class LoginPolicyStore extends Emitter {\n private static instance: LoginPolicyStore;\n\n private _policy: LoginPolicy = 'disabled';\n\n private constructor() {\n super();\n }\n\n public static getInstance(): LoginPolicyStore {\n if (!LoginPolicyStore.instance) {\n LoginPolicyStore.instance = new LoginPolicyStore();\n }\n\n return LoginPolicyStore.instance;\n }\n\n get policy(): LoginPolicy {\n return this._policy;\n }\n\n set policy(next: LoginPolicy) {\n if (this._policy === next) {\n return;\n }\n\n this._policy = next;\n this.emit(IdentifyEvent.LoginPolicyUpdated, next);\n }\n\n subscribe(handler: (value: LoginPolicy) => void): Unsubscribe {\n return subscribe(this, IdentifyEvent.LoginPolicyUpdated, handler);\n }\n\n reset(): void {\n this._policy = 'disabled';\n this.off(IdentifyEvent.LoginPolicyUpdated);\n }\n}\n","/**\n * @license\n * @monterosa/sdk-identify-kit\n *\n * Copyright © 2026 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { Emitter, Unsubscribe, subscribe } from '@monterosa/sdk-util';\n\nimport { Credentials, IdentifyEvent } from './types';\n\n/**\n * Root-owned credentials slot.\n *\n * Single source of truth at the root of an integration; an internal\n * mirror at every other level, kept in sync via `Login` / `Logout`\n * broadcasts. Not exposed publicly — public access flows through\n * `setCredentials` / `getCredentials` / `clearCredentials` and\n * `onCredentialsUpdated`.\n *\n * @internal\n */\nexport class CredentialsStore extends Emitter {\n private static instance: CredentialsStore;\n\n private _credentials: Credentials | null = null;\n\n private constructor() {\n super();\n }\n\n public static getInstance(): CredentialsStore {\n if (!CredentialsStore.instance) {\n CredentialsStore.instance = new CredentialsStore();\n }\n\n return CredentialsStore.instance;\n }\n\n get credentials(): Credentials | null {\n return this._credentials;\n }\n\n set credentials(next: Credentials | null) {\n if (this._credentials === next) {\n return;\n }\n\n this._credentials = next;\n this.emit(IdentifyEvent.CredentialsUpdated, next);\n }\n\n subscribe(handler: (value: Credentials | null) => void): Unsubscribe {\n return subscribe(this, IdentifyEvent.CredentialsUpdated, handler);\n }\n\n reset(): void {\n this._credentials = null;\n this.off(IdentifyEvent.CredentialsUpdated);\n }\n}\n","/**\n * @license\n * identify-kit\n *\n * Copyright © 2023-2026 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { MonterosaSdk, Sdk, getSdk } from '@monterosa/sdk-core';\nimport {\n Unsubscribe,\n TaskQueue,\n Emitter,\n subscribe,\n createError,\n withRetryAsync,\n memoizePromise,\n MonterosaError,\n getErrorMessage,\n} from '@monterosa/sdk-util';\nimport {\n getConnect,\n login as connectLogin,\n logout as connectLogout,\n connect,\n onConnected,\n onConnecting,\n onDisconnected,\n} from '@monterosa/sdk-connect-kit';\nimport {\n Payload,\n getParentApplication,\n sendSdkRequest,\n sendSdkMessage,\n BridgeError,\n} from '@monterosa/sdk-launcher-kit';\n\nimport {\n IdentifyKit,\n Response,\n ResponsePayload,\n UserResponse,\n UserCheckResponse,\n LoginState,\n Credentials,\n Signature,\n UserData,\n IdentifyOptions,\n IdentifyAction,\n IdentifyEvent,\n IdentifyError,\n IdentifyErrorMessages,\n LoginPolicy,\n} from './types';\n\nimport { Identify } from './identify';\nimport { getExperiences } from './experiences';\nimport { LoginPolicyStore } from './login_policy_store';\nimport { CredentialsStore } from './credentials_store';\n\nconst loginPolicyStore = LoginPolicyStore.getInstance();\nconst credentialsStore = CredentialsStore.getInstance();\n\n/**\n * @internal\n */\nexport const identifyKits: Map<string, Identify> = new Map();\n\n/**\n * Emitter for identify request events that are not tied to a specific\n * identify instance (login / logout requests).\n *\n * @internal\n */\nconst requestsEmitter = new Emitter();\n\n/**\n * Read the current locally-owned login policy.\n *\n * Returns `'disabled'` by default.\n *\n * @internal\n */\nexport function getLoginPolicy(): LoginPolicy {\n return loginPolicyStore.policy;\n}\n\n/**\n * Set the locally-owned login policy.\n *\n * All `Identify` instances at this level honour the same policy; the\n * value is never propagated across the wire (each level of a multi-level\n * integration owns its own policy).\n *\n * Policy gates the Enmasse `loginTask` only — credentials always mirror\n * from upstream regardless of policy. A `'disabled'` level still\n * receives credentials via the module-load pull and the cascading\n * `Login` / `Logout` broadcasts; it just doesn't attempt Enmasse\n * validation against them.\n *\n * When the policy transitions to `'auto'`, enqueues a sync-state task\n * for every existing identify so that any in-flight session is picked\n * up.\n *\n * Idempotent: setting the same policy that's already in effect is a\n * no-op.\n *\n * @param policy - `'auto'` to enable auto-login, `'disabled'` to opt out.\n */\nexport function setLoginPolicy(policy: LoginPolicy): void {\n if (loginPolicyStore.policy === policy) {\n return;\n }\n\n loginPolicyStore.policy = policy;\n\n if (policy !== 'auto') {\n return;\n }\n\n // On transition to 'auto': if the local credentials slot already\n // has a value (typical after the non-root module-load pull, or after\n // a setCredentials at the root, or after an upstream Login broadcast\n // has cascaded down), enqueue a login task for each existing\n // identify. If the slot is empty, do nothing — a future credentials\n // arrival via `applyLogin` will trigger the login under this new\n // policy.\n const { credentials } = credentialsStore;\n\n if (credentials === null) {\n return;\n }\n\n for (const identify of identifyKits.values()) {\n enqueueLogin(identify, credentials);\n }\n}\n\n/**\n * Whether the user should be auto-logged in on reconnect.\n *\n * True when the user was previously logged in, the policy is `'auto'`,\n * and credentials are available on the identify instance.\n *\n * @internal\n */\nexport function shouldLoginOnReconnect(identify: IdentifyKit): boolean {\n return (\n identify.wasLoggedIn &&\n getLoginPolicy() === 'auto' &&\n credentialsStore.credentials !== null\n );\n}\n\n/**\n * @internal\n */\nexport const taskQueue = new TaskQueue();\n\nfunction isSdk(value: MonterosaSdk | any): value is MonterosaSdk {\n return value instanceof Sdk;\n}\n\nasync function api<T extends Response>(\n url: string,\n token: Credentials['token'],\n method: string = 'GET',\n): Promise<T> {\n const headers: Record<string, string> = {\n accept: 'application/json',\n };\n\n let credentials: RequestCredentials | undefined;\n\n // Only include Authorization header for bearer token authentication\n // When token is 'cookie', use credentials: 'include' to ensure HttpOnly\n // cookies are sent\n if (token === 'cookie') {\n // Use credentials: 'include' to ensure HttpOnly cookies are sent\n credentials = 'include';\n } else {\n headers.Authorization = `Bearer ${token}`;\n }\n\n const response = await fetch(url, {\n method,\n headers,\n credentials,\n });\n\n const data = (await response.json()) as T;\n\n if (data.result < 0) {\n throw createError(\n IdentifyError.ExtensionApiError,\n IdentifyErrorMessages,\n data.message,\n );\n }\n\n return data;\n}\n\n/**\n * @internal\n */\nexport async function sendParentRequest<T>(\n action: IdentifyAction,\n payload?: Payload,\n): Promise<T> {\n const parentApp = getParentApplication();\n\n if (parentApp === null) {\n throw createError(IdentifyError.NoParentApplication, IdentifyErrorMessages);\n }\n\n try {\n const response = await sendSdkRequest(parentApp, action, payload);\n\n const { error, data } = response.payload as ResponsePayload<T>;\n\n if (error !== undefined) {\n throw createError(\n IdentifyError.ParentAppError,\n IdentifyErrorMessages,\n error,\n );\n }\n\n return data;\n } catch (err) {\n if (\n err instanceof MonterosaError &&\n err.code === BridgeError.RequestTimeoutError\n ) {\n const errorMessage = getErrorMessage(err);\n\n throw createError(\n IdentifyError.ParentTimeoutError,\n IdentifyErrorMessages,\n errorMessage,\n );\n }\n\n throw err;\n }\n}\n\n/**\n * @internal\n */\nasync function login(identify: IdentifyKit, credentials: Credentials) {\n const signature = await getSessionSignatureMemoized(identify, credentials);\n\n const conn = await getConnect(identify.sdk.options.host);\n\n await connect(conn);\n await connectLogin(conn, ...signature);\n}\n\nconst loginWithRetry = withRetryAsync(login);\n\n/**\n * @internal\n */\nasync function logout(identify: IdentifyKit) {\n const conn = await getConnect(identify.sdk.options.host);\n\n await connect(conn);\n await connectLogout(conn);\n}\n\nconst logoutWithRetry = withRetryAsync(logout);\n\n/**\n * @internal\n */\nexport async function loginTask(\n identify: IdentifyKit,\n credentials: Credentials,\n) {\n if (identify.state.state === 'logged_in') {\n return;\n }\n\n try {\n identify.state = {\n state: 'pending',\n };\n\n await loginWithRetry(identify, credentials);\n\n // Update state only if there are no pending tasks in the queue\n if (taskQueue.isEmpty()) {\n identify.state = {\n state: 'logged_in',\n };\n }\n } catch (err) {\n // Abandon any pending login/logout/sync tasks on failure — letting\n // them run after an error would put the user in an inconsistent\n // state. Note: this also drops tasks for unrelated identifies that\n // share the queue; acceptable because the typical runtime has one\n // identify per project.\n taskQueue.clear();\n\n identify.state = {\n state: 'error',\n error: err instanceof Error ? err.message : 'Unknown error',\n errorType: 'login',\n };\n }\n}\n\n/**\n * @internal\n */\nexport async function logoutTask(identify: IdentifyKit) {\n if (identify.state.state === 'logged_out') {\n return;\n }\n\n try {\n identify.state = {\n state: 'pending',\n };\n\n await logoutWithRetry(identify);\n\n // Update state only if there are no pending tasks in the queue\n if (taskQueue.isEmpty()) {\n identify.state = {\n state: 'logged_out',\n };\n }\n } catch (err) {\n // Abandon any pending login/logout/sync tasks on failure — see\n // `loginTask` for the rationale.\n taskQueue.clear();\n\n identify.state = {\n state: 'error',\n error: err instanceof Error ? err.message : 'Unknown error',\n errorType: 'logout',\n };\n }\n}\n\n/**\n * Enqueue a `loginTask` for the given identify when `policy === 'auto'`.\n * The downstream `Login` broadcast is emitted by {@link applyLogin}.\n *\n * @internal\n */\nexport function enqueueLogin(\n identify: IdentifyKit,\n credentials: Credentials,\n prioritise: boolean = false,\n) {\n if (getLoginPolicy() !== 'auto') {\n return;\n }\n\n if (prioritise) {\n taskQueue.enqueueFront(() => loginTask(identify, credentials));\n } else {\n taskQueue.enqueue(() => loginTask(identify, credentials));\n }\n}\n\n/**\n * Reset the identify's identity-derived caches and enqueue a `logoutTask`\n * when `policy === 'auto'`.\n *\n * @internal\n */\nexport function enqueueLogout(identify: IdentifyKit) {\n identify.userData = null;\n identify.signature = null;\n\n if (getLoginPolicy() !== 'auto') {\n return;\n }\n\n taskQueue.enqueue(() => logoutTask(identify));\n}\n\n/**\n * Apply new credentials at this level: update the slot, enqueue a\n * `loginTask` for every existing identify on the null-to-set transition,\n * and broadcast `Login` downstream to every embedded experience.\n *\n * Idempotent on token refresh: re-setting an already-set slot updates\n * the value and broadcasts, but does not re-enqueue logins (their\n * `loginTask` would short-circuit on `state === 'logged_in'` anyway).\n *\n * @internal\n */\nexport function applyLogin(credentials: Credentials): void {\n const shouldLogin = credentialsStore.credentials === null;\n\n credentialsStore.credentials = credentials;\n\n if (shouldLogin) {\n for (const identify of identifyKits.values()) {\n enqueueLogin(identify, credentials);\n }\n }\n\n for (const experience of getExperiences()) {\n sendSdkMessage(experience, IdentifyAction.Login, credentials);\n }\n}\n\n/**\n * Clear credentials at this level: null out the slot, enqueue a\n * `logoutTask` for every existing identify on the set-to-null\n * transition, and broadcast `Logout` downstream to every embedded\n * experience.\n *\n * @internal\n */\nexport function applyLogout(): void {\n const shouldLogout = credentialsStore.credentials !== null;\n\n credentialsStore.credentials = null;\n\n if (shouldLogout) {\n for (const identify of identifyKits.values()) {\n enqueueLogout(identify);\n }\n }\n\n for (const experience of getExperiences()) {\n sendSdkMessage(experience, IdentifyAction.Logout, {});\n }\n}\n\n/**\n * Pull state from the parent application and apply locally.\n *\n * Fires once at non-root bridge module load, regardless of\n * `loginPolicy` — token presence is the customer-side sign-in state and\n * must mirror upstream whether or not we choose to validate against\n * Enmasse. Best-effort: a missing or non-identify-kit parent silently\n * resolves with no slot change.\n *\n * Uses {@link applyLogin} so the slot update cascades downstream to\n * this level's own embedded experiences and per-identify loginTasks\n * are enqueued under `loginPolicy === 'auto'`.\n *\n * @internal\n */\nexport async function pullStateFromParent(): Promise<void> {\n let credentials: Credentials | null;\n try {\n credentials = await getCredentials();\n } catch {\n return;\n }\n\n if (credentials !== null) {\n applyLogin(credentials);\n }\n}\n\n/**\n * A factory function that creates a new instance of the `IdentifyKit` class,\n * which is a kit of the Monterosa SDK used for user identification.\n *\n * @example\n * ```javascript\n * import { configure } from '@monterosa/sdk-core';\n * import { getIdentify } from '@monterosa/sdk-identify-kit';\n *\n * configure({ host: '...', projectId: '...' });\n *\n * const identify = getIdentify();\n * ```\n *\n * @remarks\n * - The `getIdentify` function returns an instance of the `IdentifyKit` class\n * using optional MonterosaSdk instance as a parameter.\n *\n * - The `IdentifyKit` instance returned by `getIdentify` can be used to authenticate\n * users and perform other user identification-related operations.\n *\n * - Subsequent calls return the cached `IdentifyKit` instance for the same\n * project. The `options` argument is honoured only on the first call;\n * later calls ignore it and return the instance configured by the first.\n *\n * @param sdk - An instance of the MonterosaSdk class.\n * @param options - List of `IdentifyKit` options\n * @returns An instance of the `IdentifyKit` class, which is used for user\n * identification.\n */\n\nexport function getIdentify(\n sdk?: MonterosaSdk,\n options?: Partial<IdentifyOptions>,\n): IdentifyKit;\n\n/**\n * A factory function that creates a new instance of the `IdentifyKit` class,\n * which is a kit of the Monterosa SDK used for user identification.\n *\n * @example\n * ```javascript\n * import { configure } from '@monterosa/sdk-core';\n * import { getIdentify } from '@monterosa/sdk-identify-kit';\n *\n * configure({ host: '...', projectId: '...' });\n *\n * const identify = getIdentify();\n * ```\n *\n * @remarks\n * - The `getIdentify` function returns an instance of the `IdentifyKit` class\n * using optional MonterosaSdk instance as a parameter.\n *\n * - The `IdentifyKit` instance returned by `getIdentify` can be used to authenticate\n * users and perform other user identification-related operations.\n *\n * - Subsequent calls return the cached `IdentifyKit` instance for the same\n * project. The `options` argument is honoured only on the first call;\n * later calls ignore it and return the instance configured by the first.\n *\n * @param options - List of `IdentifyKit` options\n * @returns An instance of the `IdentifyKit` class, which is used for user\n * identification.\n */\nexport function getIdentify(options?: Partial<IdentifyOptions>): IdentifyKit;\n\nexport function getIdentify(\n sdkOrOptions?: MonterosaSdk | Partial<IdentifyOptions>,\n options?: Partial<IdentifyOptions>,\n): IdentifyKit {\n let sdk: MonterosaSdk;\n let identifyOptions: Partial<IdentifyOptions>;\n\n if (isSdk(sdkOrOptions)) {\n /**\n * Interface: getIdentify(sdk, options?)\n */\n\n sdk = sdkOrOptions;\n\n if (options !== undefined) {\n identifyOptions = options;\n } else {\n identifyOptions = {};\n }\n } else if (sdkOrOptions !== undefined) {\n /**\n * Interface: getIdentify(options)\n */\n\n sdk = getSdk();\n identifyOptions = sdkOrOptions;\n } else {\n /**\n * Interface: getIdentify()\n */\n\n sdk = getSdk();\n identifyOptions = {};\n }\n\n const { projectId } = sdk.options;\n\n if (identifyKits.has(projectId)) {\n return identifyKits.get(projectId) as Identify;\n }\n\n const identify = new Identify(sdk, identifyOptions);\n\n watchConnectionStatus(identify);\n\n identifyKits.set(projectId, identify);\n\n return identify;\n}\n\n/**\n * Requests a user login.\n *\n * @example\n * ```javascript\n * import { configure } from '@monterosa/sdk-core';\n * import { requestLogin } from '@monterosa/sdk-identify-kit';\n *\n * configure({ host: '...', projectId: '...' });\n *\n * try {\n * await requestLogin();\n *\n * console.log('Login request successful');\n * } catch (err) {\n * console.error('Error requesting login:', err.message)\n * }\n * ```\n *\n * @remarks\n * - If the app is running within a third-party application that uses\n * the Monterosa SDK, the function delegates to the parent app\n * to handle the login process.\n *\n * @returns A Promise that resolves with `void` when the login request\n * is completed.\n */\nexport async function requestLogin(): Promise<void> {\n if (getParentApplication() !== null) {\n await sendParentRequest<void>(IdentifyAction.RequestLogin);\n return;\n }\n\n requestsEmitter.emit(IdentifyEvent.LoginRequested);\n}\n\n/**\n * Read the current credentials, pulling from the parent application when\n * called from an embedded experience.\n *\n * At the root this returns the canonical slot value. At a non-root\n * experience this dispatches a `GetCredentials` request upstream and\n * resolves with the response, ensuring the caller always sees the\n * authoritative value rather than a possibly-stale local mirror.\n *\n * @returns A Promise that resolves to the current credentials, or `null`\n * if none are set.\n */\nexport async function getCredentials(): Promise<Credentials | null> {\n if (getParentApplication() === null) {\n return credentialsStore.credentials;\n }\n\n return sendParentRequest<Credentials | null>(IdentifyAction.GetCredentials);\n}\n\n/**\n * Requests a user logout.\n *\n * @example\n * ```javascript\n * import { configure } from '@monterosa/sdk-core';\n * import { requestLogout } from '@monterosa/sdk-identify-kit';\n *\n * configure({ host: '...', projectId: '...' });\n *\n * try {\n * await requestLogout();\n *\n * console.log('Logout request successful');\n * } catch (err) {\n * console.error('Error requesting logout:', err.message)\n * }\n * ```\n *\n * @remarks\n * - If the app is running within a third-party application that uses\n * the Monterosa SDK, the function delegates to the parent app\n * to handle the logout process.\n *\n * @returns A Promise that resolves with `void` when the logout request\n * is completed.\n */\nexport async function requestLogout(): Promise<void> {\n if (getParentApplication() !== null) {\n await sendParentRequest<void>(IdentifyAction.RequestLogout);\n return;\n }\n\n requestsEmitter.emit(IdentifyEvent.LogoutRequested);\n}\n\n/**\n * @internal\n *\n * Returns a signature for a user session. The signature is based on the\n * user's identifying information provided in the `IdentifyKit` instance.\n *\n * @remarks\n * This function does not handle errors. Callers are responsible for catching\n * and handling failures.\n *\n * @param identify - An instance of the `IdentifyKit` class used for user\n * identification.\n * @param credentials - The credentials of the user.\n *\n * @returns A Promise that resolves to a `Signature` object.\n */\nexport async function getSessionSignature(\n identify: IdentifyKit,\n credentials: Credentials,\n): Promise<Signature> {\n if (identify.signature !== null) {\n return identify.signature;\n }\n\n const url = await identify.getUrl('/user/check');\n\n const { data } = await api<UserCheckResponse>(url, credentials.token);\n\n const signature: Signature = [data.userId, data.timeStamp, data.signature];\n\n identify.signature = signature;\n\n return signature;\n}\n\n/**\n * A memoized version of the `getSessionSignature` function. Memo key is\n * the credentials token, so both leaf-side and bridge-side callers share\n * the same cache for the same token.\n */\nexport const getSessionSignatureMemoized = memoizePromise(\n getSessionSignature,\n (identify: IdentifyKit, credentials: Credentials) => credentials.token,\n {\n clearOnResolve: true,\n clearOnReject: true,\n },\n);\n\n/**\n * Fetches user data for the given credentials.\n *\n * Credentials are required explicitly so the precondition is visible at\n * the call site — without them the function cannot be called. Obtain a\n * `Credentials` value via {@link getCredentials} or the\n * {@link onCredentialsUpdated} callback.\n *\n * @example\n * ```javascript\n * import { configure } from '@monterosa/sdk-core';\n * import {\n * getIdentify,\n * getUserData,\n * getCredentials,\n * } from '@monterosa/sdk-identify-kit';\n *\n * configure({ host: '...', projectId: '...' });\n *\n * const identify = getIdentify();\n * const credentials = await getCredentials();\n *\n * if (credentials !== null) {\n * const userData = await getUserData(identify, credentials);\n * console.log('User data:', userData);\n * }\n * ```\n *\n * @remarks\n * Cached on the identify instance after the first successful fetch.\n * Cleared on {@link clearCredentials} via the logout path.\n *\n * @param identify - An instance of `IdentifyKit` that provides the user\n * identification functionality.\n * @param credentials - The user's authentication credentials. The\n * request authorises against the value's token.\n * @returns A Promise that resolves to a key-value object representing\n * user data. The structure and content of the user data object depend\n * on the identify service provider and may vary.\n */\nexport async function getUserData(\n identify: IdentifyKit,\n credentials: Credentials,\n): Promise<UserData> {\n if (identify.userData !== null) {\n return identify.userData;\n }\n\n const url = await identify.getUrl('/user');\n\n const { data } = await api<UserResponse>(url, credentials.token);\n\n identify.userData = data;\n\n return data;\n}\n\n/**\n * Sets the user's authentication credentials.\n *\n * @example\n * ```javascript\n * import { configure } from '@monterosa/sdk-core';\n * import { setCredentials } from '@monterosa/sdk-identify-kit';\n *\n * configure({ host: '...', projectId: '...' });\n *\n * await setCredentials({ token: 'abc123' });\n * ```\n *\n * @remarks\n * - At the root of an integration, the credentials are stored locally\n * and a `Login` broadcast is sent to every embedded experience.\n * - When called from an embedded experience, the call is relayed\n * upstream via the `SetCredentials` wire action. The credentials are\n * ultimately applied at the root and propagate back down via the\n * cascading `Login` broadcast.\n *\n * @param credentials - An object representing the user's authentication\n * credentials.\n * @returns A Promise that resolves to `void` once the credentials have\n * been written (root) or the upstream relay has completed (non-root).\n */\nexport async function setCredentials(credentials: Credentials): Promise<void> {\n if (getParentApplication() !== null) {\n await sendParentRequest<void>(IdentifyAction.SetCredentials, credentials);\n\n return;\n }\n\n applyLogin(credentials);\n}\n\n/**\n * Clears the user's authentication credentials.\n *\n * @example\n * ```javascript\n * import { configure } from '@monterosa/sdk-core';\n * import { clearCredentials } from '@monterosa/sdk-identify-kit';\n *\n * configure({ host: '...', projectId: '...' });\n *\n * await clearCredentials();\n * ```\n *\n * @remarks\n * - At the root of an integration, the credentials slot is cleared and\n * a `Logout` broadcast is sent to every embedded experience.\n * - When called from an embedded experience, the call is relayed\n * upstream via the `ClearCredentials` wire action. The slot is\n * cleared at the root and the cascading `Logout` broadcast propagates\n * back down.\n *\n * @returns A Promise that resolves to `void` once the slot has been\n * cleared (root) or the upstream relay has completed (non-root).\n */\nexport async function clearCredentials(): Promise<void> {\n if (getParentApplication() !== null) {\n await sendParentRequest<void>(IdentifyAction.ClearCredentials);\n\n return;\n }\n\n applyLogout();\n}\n\n/**\n * Registers a callback function that will be called whenever the `LoginState`\n * object associated with the `IdentifyKit` instance is updated.\n *\n * @example\n * ```javascript\n * import { configure } from '@monterosa/sdk-core';\n * import { getIdentify, onStateUpdated } from '@monterosa/sdk-identify-kit';\n *\n * configure({ host: '...', projectId: '...' });\n *\n * const identify = getIdentify();\n *\n * const unsubscribe = onStateUpdated(identify, (state) => {\n * console.log(\"State updated:\", state);\n * });\n *\n * // Call unsubscribe() to unregister the callback function\n * // unsubscribe();\n * ```\n *\n * @param identify - An instance of `IdentifyKit` that provides the user\n * identification functionality.\n * @param callback - The callback function to register. This function will be\n * called with the updated `LoginState` object as its only argument.\n * @returns An `Unsubscribe` function that can be called to unregister\n * the callback function.\n */\nexport function onStateUpdated(\n identify: IdentifyKit,\n callback: (state: LoginState) => void,\n): Unsubscribe {\n return subscribe(identify, IdentifyEvent.StateUpdated, callback);\n}\n\n/**\n * Registers a callback function that will be called whenever the\n * credentials slot is updated.\n *\n * @example\n * ```javascript\n * import { configure } from '@monterosa/sdk-core';\n * import { onCredentialsUpdated } from '@monterosa/sdk-identify-kit';\n *\n * configure({ host: '...', projectId: '...' });\n *\n * const unsubscribe = onCredentialsUpdated((credentials) => {\n * if (credentials !== null) {\n * console.log(\"Credentials updated:\", credentials);\n * } else {\n * console.log(\"Credentials cleared.\");\n * }\n * });\n *\n * // Call unsubscribe() to unregister the callback function\n * // unsubscribe();\n * ```\n *\n * @param callback - The callback function to register. This function will be\n * called with the updated `Credentials` object as its only argument.\n * If the value `null` is received, it indicates that the credentials have\n * been cleared.\n * @returns An `Unsubscribe` function that can be called to unregister\n * the callback function.\n */\nexport function onCredentialsUpdated(\n callback: (credentials: Credentials | null) => void,\n): Unsubscribe {\n return credentialsStore.subscribe(callback);\n}\n\n/**\n * Registers a callback function that will be called when a login is requested\n * by an Experience.\n *\n * @example\n * ```javascript\n * import { configure } from '@monterosa/sdk-core';\n * import { onLoginRequestedByExperience } from '@monterosa/sdk-identify-kit';\n *\n * configure({ host: '...', projectId: '...' });\n *\n * const unsubscribe = onLoginRequestedByExperience(() => {\n * showLoginForm();\n * });\n *\n * // Call unsubscribe() to unregister the callback function\n * // unsubscribe();\n * ```\n *\n * @param callback - The callback function to register. This function will\n * be called when a login is requested by an Experience.\n * @returns An `Unsubscribe` function that can be called to unregister\n * the callback function.\n */\nexport function onLoginRequestedByExperience(\n callback: () => void,\n): Unsubscribe {\n return subscribe(requestsEmitter, IdentifyEvent.LoginRequested, callback);\n}\n\n/**\n * Registers a callback function that will be called when a logout is requested\n * by an Experience.\n *\n * @example\n * ```javascript\n * import { configure } from '@monterosa/sdk-core';\n * import { onLogoutRequestedByExperience } from '@monterosa/sdk-identify-kit';\n *\n * configure({ host: '...', projectId: '...' });\n *\n * const unsubscribe = onLogoutRequestedByExperience(() => {\n * // logout requested by experience\n * // perform logout from Auth service\n * });\n *\n * // Call unsubscribe() to unregister the callback function\n * // unsubscribe();\n * ```\n *\n * @param callback - The callback function to register. This function will\n * be called when a logout is requested by an Experience.\n * @returns An `Unsubscribe` function that can be called to unregister\n * the callback function.\n */\nexport function onLogoutRequestedByExperience(\n callback: () => void,\n): Unsubscribe {\n return subscribe(requestsEmitter, IdentifyEvent.LogoutRequested, callback);\n}\n\n/**\n *\n * @internal\n */\nexport async function watchConnectionStatus(identify: IdentifyKit) {\n const conn = await getConnect(identify.sdk.options.host);\n\n onConnected(conn, () => {\n if (shouldLoginOnReconnect(identify)) {\n enqueueLogin(identify, credentialsStore.credentials!, true);\n }\n\n taskQueue.resume();\n });\n\n onConnecting(conn, () => {\n taskQueue.pause();\n\n // If the user was logged in before the connection loss, set the state\n // to pending to notify that the user is no longer logged in and a login\n // attempt will be made when the connection is restored.\n if (identify.state.state === 'logged_in') {\n identify.state = {\n state: 'pending',\n };\n }\n });\n\n onDisconnected(conn, () => {\n taskQueue.pause();\n taskQueue.clear();\n\n // If the user was logged in before the connection loss, set the state\n // to logged_out to notify that the user is no longer logged in.\n if (identify.state.state === 'logged_in') {\n identify.state = {\n state: 'logged_out',\n };\n }\n });\n}\n","/**\n * @license\n * @monterosa/sdk-identify-kit\n *\n * Copyright © 2023-2026 Monterosa Productions Limited. All rights reserved.\n *\n * More details on the license can be found at https://www.monterosa.co/sdk/license\n */\n\nimport { getErrorMessage } from '@monterosa/sdk-util';\nimport {\n Experience,\n ExperienceState,\n Payload,\n Message,\n getParentApplication,\n respondToSdkMessage,\n onStateChanged,\n onSdkMessage,\n} from '@monterosa/sdk-launcher-kit';\n\nimport { IdentifyAction, Credentials } from './types';\n\nimport {\n getCredentials,\n requestLogin,\n requestLogout,\n setCredentials,\n clearCredentials,\n applyLogin,\n applyLogout,\n pullStateFromParent,\n} from './api';\nimport { addExperience, deleteExperience } from './experiences';\n\n/**\n * Process an incoming `Login` / `Logout` broadcast from the parent\n * application. Updates the local credentials slot, enqueues login/logout\n * for every existing identify, and forwards the broadcast downstream to\n * this level's own embedded experiences — the mechanism that cascades a\n * root-level `setCredentials` through every nested experience.\n *\n * @internal\n */\nexport function handleParentMessage(message: Message): void {\n switch (message.action) {\n case IdentifyAction.Login: {\n applyLogin(message.payload as Credentials);\n break;\n }\n case IdentifyAction.Logout: {\n applyLogout();\n break;\n }\n }\n}\n\n/**\n * @internal\n */\nexport function handleExperienceEmbedded(experience: Experience): void {\n const sdkMessageUnsub = onSdkMessage(experience, async (message) => {\n if (\n !Object.values(IdentifyAction).includes(message.action as IdentifyAction)\n ) {\n return;\n }\n\n const respond = (payload?: Payload) =>\n respondToSdkMessage(experience, message, payload);\n\n try {\n switch (message.action) {\n case IdentifyAction.RequestLogin: {\n await requestLogin();\n\n respond();\n\n break;\n }\n case IdentifyAction.RequestLogout: {\n await requestLogout();\n\n respond();\n break;\n }\n case IdentifyAction.GetCredentials: {\n const data = await getCredentials();\n\n respond({ data });\n break;\n }\n case IdentifyAction.SetCredentials: {\n await setCredentials(message.payload as Credentials);\n\n respond();\n break;\n }\n case IdentifyAction.ClearCredentials: {\n await clearCredentials();\n\n respond();\n break;\n }\n }\n } catch (err) {\n respond({\n error: getErrorMessage(err),\n });\n }\n });\n\n addExperience(experience, [sdkMessageUnsub]);\n}\n\n/**\n * @internal\n */\nexport function handleExperienceUnmounted(experience: Experience): void {\n deleteExperience(experience);\n}\n\n/**\n * @internal\n */\nexport function handleExperienceStateChange(\n experience: Experience,\n state: ExperienceState,\n): void {\n if (state === 'mounted') {\n handleExperienceEmbedded(experience);\n return;\n }\n\n if (state === 'unmounted') {\n handleExperienceUnmounted(experience);\n }\n}\n\nfunction subscribeToExperienceLifecycle(): void {\n onStateChanged(handleExperienceStateChange);\n}\n\nfunction connectToParentApplication(): void {\n const parentApp = getParentApplication();\n\n if (parentApp === null) {\n return;\n }\n\n onSdkMessage(parentApp, handleParentMessage);\n pullStateFromParent();\n}\n\nsubscribeToExperienceLifecycle();\nconnectToParentApplication();\n"],"names":["connectLogin","connectLogout"],"mappings":";;;;;;AAAA;;;;;;;AAOG;AA2JH;;AAEG;AACH,IAAY,aAMX,CAAA;AAND,CAAA,UAAY,aAAa,EAAA;AACvB,IAAA,aAAA,CAAA,cAAA,CAAA,GAAA,eAA8B,CAAA;AAC9B,IAAA,aAAA,CAAA,gBAAA,CAAA,GAAA,iBAAkC,CAAA;AAClC,IAAA,aAAA,CAAA,iBAAA,CAAA,GAAA,kBAAoC,CAAA;AACpC,IAAA,aAAA,CAAA,oBAAA,CAAA,GAAA,qBAA0C,CAAA;AAC1C,IAAA,aAAA,CAAA,oBAAA,CAAA,GAAA,sBAA2C,CAAA;AAC7C,CAAC,EANW,aAAa,KAAb,aAAa,GAMxB,EAAA,CAAA,CAAA,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;IACS,cA8BX;AA9BD,CAAA,UAAY,aAAa,EAAA;AACvB;;AAEG;AACH,IAAA,aAAA,CAAA,mBAAA,CAAA,GAAA,qBAAyC,CAAA;AACzC;;AAEG;AACH,IAAA,aAAA,CAAA,mBAAA,CAAA,GAAA,qBAAyC,CAAA;AACzC;;;AAGG;AACH,IAAA,aAAA,CAAA,eAAA,CAAA,GAAA,gBAAgC,CAAA;AAChC;;AAEG;AACH,IAAA,aAAA,CAAA,gBAAA,CAAA,GAAA,kBAAmC,CAAA;AACnC;;AAEG;AACH,IAAA,aAAA,CAAA,iBAAA,CAAA,GAAA,kBAAoC,CAAA;A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,CAAC,UAAU,CAAC,CAAC;AACvC,KAAA;AACH,CAAC;AAED,SAAS,8BAA8B,GAAA;IACrC,cAAc,CAAC,2BAA2B,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,0BAA0B,GAAA;AACjC,IAAA,MAAM,SAAS,GAAG,oBAAoB,EAAE,CAAC;IAEzC,IAAI,SAAS,KAAK,IAAI,EAAE;QACtB,OAAO;AACR,KAAA;AAED,IAAA,YAAY,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;AAC7C,IAAA,mBAAmB,EAAE,CAAC;AACxB,CAAC;AAED,8BAA8B,EAAE,CAAC;AACjC,0BAA0B,EAAE;;;;"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @license
3
+ * @monterosa/sdk-identify-kit
4
+ *
5
+ * Copyright © 2026 Monterosa Productions Limited. All rights reserved.
6
+ *
7
+ * More details on the license can be found at https://www.monterosa.co/sdk/license
8
+ */
9
+ import { Emitter, Unsubscribe } from '@monterosa/sdk-util';
10
+ import { LoginPolicy } from './types';
11
+ /**
12
+ * Locally-owned login policy.
13
+ *
14
+ * Defaults to `'disabled'`. Set via the public `setLoginPolicy`. Never
15
+ * propagated across the wire — each level owns its own policy.
16
+ *
17
+ * @internal
18
+ */
19
+ export declare class LoginPolicyStore extends Emitter {
20
+ private static instance;
21
+ private _policy;
22
+ private constructor();
23
+ static getInstance(): LoginPolicyStore;
24
+ get policy(): LoginPolicy;
25
+ set policy(next: LoginPolicy);
26
+ subscribe(handler: (value: LoginPolicy) => void): Unsubscribe;
27
+ reset(): void;
28
+ }
package/dist/types.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * More details on the license can be found at https://www.monterosa.co/sdk/license
8
8
  */
9
9
  import { MonterosaSdk } from '@monterosa/sdk-core';
10
- import { Emitter, Unsubscribe } from '@monterosa/sdk-util';
10
+ import { Emitter } from '@monterosa/sdk-util';
11
11
  /**
12
12
  * Represents user authentication credentials.
13
13
  *
@@ -62,10 +62,6 @@ export type ResponsePayload<T> = {
62
62
  data: T;
63
63
  error?: string;
64
64
  };
65
- /**
66
- * @internal
67
- */
68
- export type IdentifyHook = (identify: IdentifyKit) => Unsubscribe;
69
65
  export type LoginState = {
70
66
  state: 'logged_out' | 'logged_in' | 'pending' | 'error';
71
67
  error?: string;
@@ -73,18 +69,18 @@ export type LoginState = {
73
69
  };
74
70
  export type LoginPolicy = 'disabled' | 'auto';
75
71
  /**
76
- * Configuration options for Identify Kit.
72
+ * Resolved configuration options for an `Identify` instance. Public APIs
73
+ * that accept user-supplied options (such as {@link getIdentify}) take
74
+ * `Partial<IdentifyOptions>` and apply defaults for any field not
75
+ * supplied.
76
+ *
77
+ * `loginPolicy` is set separately via {@link setLoginPolicy}.
77
78
  */
78
79
  export interface IdentifyOptions {
79
- /**
80
- * Unique device identifier. Must be persisted and reused across sessions
81
- * to avoid duplicate user records.
82
- */
83
- readonly deviceId?: string;
84
80
  /**
85
81
  * Authentication strategy. Default: `'email'`.
86
82
  */
87
- readonly strategy?: string;
83
+ readonly strategy: string;
88
84
  /**
89
85
  * Identity provider name (e.g. `'aws'` for Cognito).
90
86
  */
@@ -92,8 +88,7 @@ export interface IdentifyOptions {
92
88
  /**
93
89
  * Identify API version. Default: `1`.
94
90
  */
95
- readonly version?: number;
96
- readonly loginPolicy?: LoginPolicy;
91
+ readonly version: number;
97
92
  }
98
93
  /**
99
94
  * Represents an Identify Kit instance. Obtain one via {@link getIdentify}.
@@ -105,7 +100,9 @@ export interface IdentifyOptions {
105
100
  */
106
101
  export interface IdentifyKit extends Emitter {
107
102
  /**
108
- * The identify options.
103
+ * Resolved identity options. `loginPolicy` is not on the instance —
104
+ * see {@link setLoginPolicy}. Credentials are root-owned, accessed
105
+ * via {@link getCredentials}.
109
106
  *
110
107
  * @internal
111
108
  */
@@ -114,10 +111,6 @@ export interface IdentifyKit extends Emitter {
114
111
  * @internal
115
112
  */
116
113
  sdk: MonterosaSdk;
117
- /**
118
- * @internal
119
- */
120
- credentials: Credentials | null;
121
114
  /**
122
115
  * @internal
123
116
  */
@@ -127,15 +120,9 @@ export interface IdentifyKit extends Emitter {
127
120
  */
128
121
  userData: UserData | null;
129
122
  /**
130
- * Whether the user should be automatically logged in when connection is
131
- * restored. This is true when:
132
- * - The user was previously logged in successfully
133
- * - Auto-login is enabled
134
- * - Credentials are available
135
- *
136
123
  * @internal
137
124
  */
138
- shouldLoginOnReconnect: boolean;
125
+ wasLoggedIn: boolean;
139
126
  state: LoginState;
140
127
  /**
141
128
  * @internal
@@ -166,10 +153,8 @@ export declare enum IdentifyEvent {
166
153
  StateUpdated = "state_updated",
167
154
  LoginRequested = "login_requested",
168
155
  LogoutRequested = "logout_requested",
169
- SignatureUpdated = "signature_updated",
170
- UserdataUpdated = "userdata_updated",
171
156
  CredentialsUpdated = "credentials_updated",
172
- EnmasseLogin = "enmasse_login"
157
+ LoginPolicyUpdated = "login_policy_updated"
173
158
  }
174
159
  /**
175
160
  * Defines a set of error codes that may be encountered when using the
@@ -182,8 +167,6 @@ export declare enum IdentifyEvent {
182
167
  * } catch (err) {
183
168
  * if (err.code === IdentifyError.NoCredentials) {
184
169
  * // handle missing credentials error
185
- * } else if (err.code === IdentifyError.NotInitialised) {
186
- * // handle initialization error
187
170
  * } else {
188
171
  * // handle other error types
189
172
  * }
@@ -212,10 +195,6 @@ export declare enum IdentifyError {
212
195
  * or have expired.
213
196
  */
214
197
  NoCredentials = "no_credentials",
215
- /**
216
- * Indicates the IdentifyKit has not been initialised properly.
217
- */
218
- NotInitialised = "not_initialised",
219
198
  /**
220
199
  * Indicates an error occurred in the parent app.
221
200
  */
@@ -240,7 +219,6 @@ export declare const IdentifyErrorMessages: {
240
219
  extension_api_error: (error: string) => string;
241
220
  extension_not_setup: () => string;
242
221
  no_credentials: () => string;
243
- not_initialised: () => string;
244
222
  parent_app_error: (error: string) => string;
245
223
  unexpected_state: (state: string) => string;
246
224
  no_parent_application: () => string;
@@ -251,12 +229,7 @@ export declare enum IdentifyAction {
251
229
  Logout = "identifyLogout",
252
230
  RequestLogin = "identifyRequestLogin",
253
231
  RequestLogout = "identifyRequestLogout",
254
- GetUserData = "identifyGetUserData",
255
- GetSessionSignature = "identifyGetSessionSignature",
232
+ GetCredentials = "identifyGetCredentials",
256
233
  SetCredentials = "identifySetCredentials",
257
- ClearCredentials = "identifyClearCredentials",
258
- OnStateUpdated = "identifyOnStateUpdated",
259
- OnCredentialsUpdated = "identifyOnCredentialsUpdated",
260
- OnUserDataUpdated = "identifyOnUserDataUpdated",
261
- OnSessionSignatureUpdated = "identifyOnSessionSignatureUpdated"
234
+ ClearCredentials = "identifyClearCredentials"
262
235
  }
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@monterosa/sdk-identify-kit",
3
- "version": "2.0.0-rc.2",
3
+ "version": "2.0.0-rc.4",
4
4
  "description": "Identify Kit for the Monterosa JS SDK",
5
5
  "author": "Monterosa Productions Limited <hello@monterosa.co.uk> (https://www.monterosa.co/)",
6
- "main": "./dist/index.js",
6
+ "main": "./dist/index.cjs",
7
7
  "types": "./dist/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
10
  "types": "./dist/index.d.ts",
11
11
  "import": "./dist/index.js",
12
- "default": "./dist/index.js"
12
+ "require": "./dist/index.cjs",
13
+ "default": "./dist/index.cjs"
13
14
  }
14
15
  },
15
16
  "files": [
@@ -32,12 +33,12 @@
32
33
  ],
33
34
  "license": "MIT",
34
35
  "dependencies": {
35
- "@monterosa/sdk-connect-kit": "2.0.0-rc.2",
36
- "@monterosa/sdk-core": "2.0.0-rc.2",
37
- "@monterosa/sdk-interact-interop": "2.0.0-rc.2",
38
- "@monterosa/sdk-interact-kit": "2.0.0-rc.2",
39
- "@monterosa/sdk-launcher-kit": "2.0.0-rc.2",
40
- "@monterosa/sdk-util": "2.0.0-rc.2"
36
+ "@monterosa/sdk-connect-kit": "2.0.0-rc.4",
37
+ "@monterosa/sdk-core": "2.0.0-rc.4",
38
+ "@monterosa/sdk-interact-interop": "2.0.0-rc.4",
39
+ "@monterosa/sdk-interact-kit": "2.0.0-rc.4",
40
+ "@monterosa/sdk-launcher-kit": "2.0.0-rc.4",
41
+ "@monterosa/sdk-util": "2.0.0-rc.4"
41
42
  },
42
43
  "devDependencies": {
43
44
  "@rollup/plugin-json": "^4.1.0",
@@ -58,5 +59,5 @@
58
59
  "publishConfig": {
59
60
  "access": "public"
60
61
  },
61
- "gitHead": "0e2d4cd71055bf0ab38ec5a73d6040c55151da1c"
62
+ "gitHead": "1c7b10a4da9d2b85a20a67cc4dac61c7aa8e692d"
62
63
  }