@strivacity/sdk-angular 3.0.2 → 4.0.0-beta.0
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/CHANGELOG.md +7 -0
- package/README.md +1991 -609
- package/dist/README.md +1991 -609
- package/dist/fesm2022/strivacity-sdk-angular-src-server.mjs +221 -0
- package/dist/fesm2022/strivacity-sdk-angular-src-server.mjs.map +1 -0
- package/dist/fesm2022/strivacity-sdk-angular-src-types.mjs +6 -0
- package/dist/fesm2022/strivacity-sdk-angular-src-types.mjs.map +1 -0
- package/dist/fesm2022/strivacity-sdk-angular.mjs +284 -498
- package/dist/fesm2022/strivacity-sdk-angular.mjs.map +1 -1
- package/dist/types/strivacity-sdk-angular-src-server.d.ts +82 -0
- package/dist/types/strivacity-sdk-angular-src-types.d.ts +41 -0
- package/dist/types/strivacity-sdk-angular.d.ts +147 -0
- package/eslint.config.mjs +31 -0
- package/ng-package.json +3 -3
- package/package.json +29 -11
- package/project.json +33 -0
- package/src/index.ts +8 -0
- package/src/lib/services/auth.service.ts +131 -0
- package/src/lib/services/index.ts +2 -0
- package/src/lib/services/native-login.service.ts +172 -0
- package/src/lib/storages.ts +12 -0
- package/src/lib/utils.ts +39 -0
- package/src/server/errors.ts +1 -0
- package/src/server/index.ts +6 -0
- package/src/server/ng-package.json +6 -0
- package/src/server/sdk.ts +113 -0
- package/src/server/session.ts +30 -0
- package/src/server/storages.ts +25 -0
- package/src/server/types.ts +32 -0
- package/src/server/utils.ts +74 -0
- package/src/types/index.ts +47 -0
- package/src/types/ng-package.json +6 -0
- package/testing/setup.ts +10 -0
- package/testing/tests/auth.service.spec.ts +236 -0
- package/testing/tests/index.spec.ts +193 -0
- package/testing/tests/native-login.service.spec.ts +311 -0
- package/testing/tests/server/errors.spec.ts +14 -0
- package/testing/tests/server/sdk.spec.ts +197 -0
- package/testing/tests/server/session.spec.ts +52 -0
- package/testing/tests/server/storages.spec.ts +58 -0
- package/testing/tests/server/utils.spec.ts +112 -0
- package/testing/tests/storages.spec.ts +31 -0
- package/testing/tests/utils.spec.ts +24 -0
- package/testing/utils/testbed.ts +26 -0
- package/tsconfig.lib.json +13 -0
- package/tsconfig.lib.prod.json +9 -0
- package/tsconfig.spec.json +8 -0
- package/vite.config.mts +11 -0
- package/dist/index.d.ts +0 -5
- package/dist/lib/components/login-renderer.component.d.ts +0 -38
- package/dist/lib/components/widget-renderer.component.d.ts +0 -16
- package/dist/lib/services/auth.service.d.ts +0 -93
- package/dist/lib/services/widget.service.d.ts +0 -25
- package/dist/lib/strivacity-auth.module.d.ts +0 -10
- package/dist/lib/utils/helpers.d.ts +0 -16
- package/dist/lib/utils/types.d.ts +0 -41
- package/dist/public-api.d.ts +0 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strivacity-sdk-angular.mjs","sources":["../../src/lib/services/widget.service.ts","../../src/lib/components/widget-renderer.component.ts","../../src/lib/utils/helpers.ts","../../src/lib/services/auth.service.ts","../../src/lib/components/login-renderer.component.ts","../../src/lib/strivacity-auth.module.ts","../../src/strivacity-sdk-angular.ts"],"sourcesContent":["import type { LoginFlowMessage, LoginFlowState } from '@strivacity/sdk-core';\nimport { Injectable } from '@angular/core';\nimport { BehaviorSubject } from 'rxjs';\n\nexport interface NativeFlowState {\n\tloading: boolean;\n\tformContexts: Record<string, Record<string, unknown>>;\n\tmessageContexts: Record<string, Record<string, string | null>>;\n\tstate: LoginFlowState;\n}\n\n/**\n * Service that manages Strivacity native widgets.\n */\n@Injectable({\n\tprovidedIn: 'root',\n})\nexport class StrivacityWidgetService {\n\treadonly loading$ = new BehaviorSubject<boolean>(false);\n\treadonly forms$ = new BehaviorSubject<Record<string, Record<string, unknown>>>({});\n\treadonly messages$ = new BehaviorSubject<Record<string, Record<string, LoginFlowMessage>>>({});\n\treadonly state$ = new BehaviorSubject<LoginFlowState>({});\n\n\ttriggerFallback!: (hostedUrl?: string, message?: string) => void;\n\ttriggerClose!: () => void;\n\tsubmitForm!: (formId: string) => Promise<void>;\n\n\tsetFormValue(formId: string, widgetId: string, value: unknown) {\n\t\tconst forms = { ...this.forms$.value };\n\t\tforms[formId] = { ...(forms[formId] || {}), [widgetId]: value === '' ? null : value };\n\n\t\tthis.forms$.next(forms);\n\t}\n\n\tsetMessage(formId: string, widgetId: string, value: LoginFlowMessage) {\n\t\tconst messages = { ...this.messages$.value };\n\t\tmessages[formId] = { ...(messages[formId] || {}), [widgetId]: value };\n\n\t\tthis.messages$.next(messages);\n\t}\n}\n","import type { Type, SimpleChanges, OnChanges } from '@angular/core';\nimport type { WidgetType, LayoutWidget, Widget } from '@strivacity/sdk-core';\nimport { Component, Input, ViewContainerRef, ViewChild } from '@angular/core';\nimport { StrivacityWidgetService } from '../services/widget.service';\n\n@Component({\n\tstandalone: true,\n\t// eslint-disable-next-line @angular-eslint/component-selector\n\tselector: 'sty-widget-renderer',\n\ttemplate: '<ng-container #container></ng-container>',\n\tstyles: `\n\t\t:host {\n\t\t\tdisplay: contents;\n\t\t}\n\t`,\n})\nexport class StyWidgetRenderer implements OnChanges {\n\t@Input() items: LayoutWidget['items'] = [];\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t@Input({ required: true }) widgets!: Record<WidgetType, Type<any>>;\n\n\t@ViewChild('container', { read: ViewContainerRef, static: true }) readonly $containerRef!: ViewContainerRef;\n\n\tconstructor(protected widgetService: StrivacityWidgetService) {}\n\n\tngOnChanges(changes: SimpleChanges): void {\n\t\tif (changes['items']) {\n\t\t\tthis.render();\n\t\t}\n\t}\n\n\trender(): void {\n\t\tthis.$containerRef.clear();\n\n\t\tif (!this.items) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const item of this.items) {\n\t\t\tif (item.type === 'widget') {\n\t\t\t\tconst form = this.widgetService.state$.value.forms?.find((f) => f.id === item.formId);\n\t\t\t\tconst widget = form?.widgets.find((w) => w.id === item.widgetId);\n\t\t\t\tconst component = widget ? this.widgets[widget.type] : undefined;\n\n\t\t\t\tif (!form || !widget) {\n\t\t\t\t\tthis.widgetService.triggerFallback(undefined, `Unable to find form or widget for item: formId=${item.formId}, widgetId=${item.widgetId}`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (!component) {\n\t\t\t\t\tthis.widgetService.triggerFallback(undefined, `No component found for widget type ${widget.type}`);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst componentRef = this.$containerRef.createComponent(component);\n\t\t\t\tcomponentRef.setInput('formId', item.formId);\n\t\t\t\tcomponentRef.setInput('config', widget);\n\t\t\t\tcomponentRef.changeDetectorRef.detectChanges();\n\t\t\t} else if (item.type === 'vertical' || item.type === 'horizontal') {\n\t\t\t\tconst component = this.widgets.layout;\n\n\t\t\t\tif (!component) {\n\t\t\t\t\tthis.widgetService.triggerFallback(undefined, 'No layout component provided');\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst widgetRendererRef = this.$containerRef.createComponent(StyWidgetRenderer);\n\t\t\t\twidgetRendererRef.setInput('items', item.items);\n\t\t\t\twidgetRendererRef.setInput('widgets', this.widgets);\n\t\t\t\twidgetRendererRef.changeDetectorRef.detectChanges();\n\n\t\t\t\tconst layoutRef = this.$containerRef.createComponent(component, {\n\t\t\t\t\tprojectableNodes: [[widgetRendererRef.location.nativeElement]],\n\t\t\t\t});\n\t\t\t\tlayoutRef.setInput('formId', (item.items[0] as Widget)?.formId);\n\t\t\t\tlayoutRef.setInput('type', item.type);\n\t\t\t\tlayoutRef.changeDetectorRef.detectChanges();\n\t\t\t} else {\n\t\t\t\tthis.widgetService.triggerFallback(undefined, 'Unknown item type in layout');\n\t\t\t}\n\t\t}\n\t}\n}\n","import { InjectionToken } from '@angular/core';\nimport type { SDKOptions } from '@strivacity/sdk-core';\n\nexport const STRIVACITY_SDK = new InjectionToken<SDKOptions>('sty');\n\n/**\n * Provides the Strivacity SDK configuration as a dependency injection token.\n *\n * This function is used to supply the Strivacity SDK configuration to the application\n * by binding it to the `STRIVACITY_SDK` token.\n *\n * @param {SDKOptions} config The SDK configuration options.\n * @returns {{ provide: InjectionToken<SDKOptions>, useValue: SDKOptions }} An object that provides the SDK configuration using the `STRIVACITY_SDK` token.\n */\nexport function provideStrivacity(config: SDKOptions) {\n\treturn { provide: STRIVACITY_SDK, useValue: config };\n}\n","import { Inject, Injectable } from '@angular/core';\nimport { type Observable, BehaviorSubject, from } from 'rxjs';\nimport type { PopupFlow } from '@strivacity/sdk-core/flows/PopupFlow';\nimport type { RedirectFlow } from '@strivacity/sdk-core/flows/RedirectFlow';\nimport type { NativeFlow } from '@strivacity/sdk-core/flows/NativeFlow';\nimport { type SDKOptions, initFlow } from '@strivacity/sdk-core';\nimport type { Session } from '../utils/types';\nimport { STRIVACITY_SDK } from '../utils/helpers';\n\n/**\n * Service that manages Strivacity authentication flows.\n * Supports either PopupFlow or RedirectFlow types.\n *\n * @template Flow Type of authentication flow (PopupFlow or RedirectFlow).\n * @template Options Type of SDK options (defaults to SDKOptions).\n */\n@Injectable({\n\tprovidedIn: 'root',\n})\nexport class StrivacityAuthService<\n\tFlow extends PopupFlow | RedirectFlow | NativeFlow = PopupFlow | RedirectFlow | NativeFlow,\n\tOptions extends SDKOptions = SDKOptions,\n> {\n\t/**\n\t * Instance of the authentication flow (PopupFlow or RedirectFlow).\n\t */\n\tsdk: Flow;\n\n\t/**\n\t * BehaviorSubject that holds the current session state.\n\t * @protected\n\t * @readonly\n\t */\n\tprivate readonly sessionSubject: BehaviorSubject<Session>;\n\n\t/**\n\t * Observable that emits the session state changes.\n\t * @readonly\n\t */\n\treadonly session$: Observable<Session>;\n\n\t/**\n\t * Creates an instance of StrivacityAuthService.\n\t *\n\t * @param {Options} options SDK configuration options injected via STRIVACITY_SDK.\n\t */\n\tconstructor(@Inject(STRIVACITY_SDK) public options: Options) {\n\t\tthis.sdk = initFlow(options) as Flow;\n\t\tthis.sessionSubject = new BehaviorSubject<Session>({\n\t\t\tloading: true,\n\t\t\tisAuthenticated: false,\n\t\t\tidTokenClaims: null,\n\t\t\taccessToken: null,\n\t\t\trefreshToken: null,\n\t\t\taccessTokenExpired: true,\n\t\t\taccessTokenExpirationDate: null,\n\t\t});\n\t\tthis.session$ = this.sessionSubject.asObservable();\n\n\t\tconst updateSession = async () => {\n\t\t\tthis.sessionSubject.next({\n\t\t\t\tloading: false,\n\t\t\t\tisAuthenticated: await this.sdk.isAuthenticated,\n\t\t\t\tidTokenClaims: this.sdk.idTokenClaims || null,\n\t\t\t\taccessToken: this.sdk.accessToken || null,\n\t\t\t\trefreshToken: this.sdk.refreshToken || null,\n\t\t\t\taccessTokenExpired: this.sdk.accessTokenExpired,\n\t\t\t\taccessTokenExpirationDate: this.sdk.accessTokenExpirationDate || null,\n\t\t\t});\n\t\t};\n\n\t\tthis.sdk.subscribeToEvent('init', updateSession);\n\t\tthis.sdk.subscribeToEvent('loggedIn', updateSession);\n\t\tthis.sdk.subscribeToEvent('sessionLoaded', updateSession);\n\t\tthis.sdk.subscribeToEvent('tokenRefreshed', updateSession);\n\t\tthis.sdk.subscribeToEvent('tokenRefreshFailed', updateSession);\n\t\tthis.sdk.subscribeToEvent('logoutInitiated', updateSession);\n\t\tthis.sdk.subscribeToEvent('tokenRevoked', updateSession);\n\t\tthis.sdk.subscribeToEvent('tokenRevokeFailed', updateSession);\n\t}\n\n\t/**\n\t * Checks if the user is authenticated.\n\t *\n\t * @returns {Observable<boolean>} An observable that emits the authentication status.\n\t */\n\tisAuthenticated() {\n\t\treturn from(this.sdk.isAuthenticated);\n\t}\n\n\t/**\n\t * Logs the user in using the specified options.\n\t *\n\t * @param {Parameters<Flow['login']>[0]} [options] Options to customize the login behavior.\n\t * @returns {Observable<void>} An observable that completes when the login process is done.\n\t */\n\tlogin(options?: Parameters<Flow['login']>[0]) {\n\t\tconst result = this.sdk.login(options);\n\n\t\tif (result instanceof Promise) {\n\t\t\treturn from(result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Initiates the entry process using the provided challenge.\n\t *\n\t * @param {string} [url] Optional URL to use for the entry process. If not provided, the current window location will be used.\n\t * @returns {Observable<void>} An observable that completes when the entry process is done.\n\t */\n\tentry(url?: string) {\n\t\tconst result = this.sdk.entry(url);\n\n\t\tif (result instanceof Promise) {\n\t\t\treturn from(result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Registers a new user using the specified options.\n\t *\n\t * @param {Parameters<Flow['register']>[0]} [options] Options to customize the registration behavior.\n\t * @returns {Observable<void>} An observable that completes when the registration process is done.\n\t */\n\tregister(options?: Parameters<Flow['register']>[0]) {\n\t\tconst result = this.sdk.register(options);\n\n\t\tif (result instanceof Promise) {\n\t\t\treturn from(result);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Refreshes the current authentication session.\n\t *\n\t * @returns {Observable<void>} An observable that completes when the session is refreshed.\n\t */\n\trefresh() {\n\t\treturn from(this.sdk.refresh());\n\t}\n\n\t/**\n\t * Revokes the current session tokens.\n\t *\n\t * @returns {Observable<void>} An observable that completes when the tokens are revoked.\n\t */\n\trevoke() {\n\t\treturn from(this.sdk.revoke());\n\t}\n\n\t/**\n\t * Logs the user out using the specified options.\n\t *\n\t * @param {Parameters<Flow['logout']>[0]} [options] Options to customize the logout behavior.\n\t * @returns {Observable<void>} An observable that completes when the logout process is done.\n\t */\n\tlogout(options?: Parameters<Flow['logout']>[0]) {\n\t\treturn from(this.sdk.logout(options));\n\t}\n\n\t/**\n\t * Handles the authentication callback (e.g., after a redirect or popup flow).\n\t *\n\t * @param {Parameters<Flow['handleCallback']>[0]} [url] The URL to handle for the callback.\n\t * @returns {Observable<void>} An observable that completes when the callback is handled.\n\t */\n\thandleCallback(url?: Parameters<Flow['handleCallback']>[0]) {\n\t\treturn from(this.sdk.handleCallback(url));\n\t}\n}\n","import type { OnInit, OnDestroy, ComponentRef } from '@angular/core';\nimport type { NativeFlow } from '@strivacity/sdk-core/flows/NativeFlow';\nimport type { IdTokenClaims, NativeParams, WidgetType, LoginFlowState, LoginFlowMessage, Widget } from '@strivacity/sdk-core';\nimport { Component, EventEmitter, Input, Output, Type, ViewChild, ViewContainerRef } from '@angular/core';\nimport { Subscription } from 'rxjs';\nimport { FallbackError } from '@strivacity/sdk-core';\nimport { StrivacityAuthService } from '../services/auth.service';\nimport { StrivacityWidgetService } from '../services/widget.service';\nimport { unflattenObject } from '@strivacity/sdk-core/utils/object';\nimport { StyWidgetRenderer } from './widget-renderer.component';\n\n@Component({\n\tstandalone: true,\n\t// eslint-disable-next-line @angular-eslint/component-selector\n\tselector: 'sty-login-renderer',\n\ttemplate: '<ng-container #container></ng-container>',\n\thost: {\n\t\tclass: 'login-renderer',\n\t},\n})\nexport class StyLoginRenderer implements OnInit, OnDestroy {\n\tprivate subscriptions = new Subscription();\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tprivate createdComponentRefs: ComponentRef<any>[] = [];\n\tloginHandler!: ReturnType<StrivacityAuthService<NativeFlow>['sdk']['login']>;\n\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t@Input({ required: true }) widgets!: Record<WidgetType, Type<any>>;\n\t@Input() sessionId?: string | null;\n\t@Input() language?: string | null;\n\t@Input() params: NativeParams = {};\n\n\t@Output('login') readonly onLogin = new EventEmitter<IdTokenClaims | null | undefined>();\n\t@Output('fallback') readonly onFallback = new EventEmitter<FallbackError>();\n\t@Output('close') readonly onClose = new EventEmitter();\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t@Output('error') readonly onError = new EventEmitter<any>();\n\t@Output('globalMessage') readonly onGlobalMessage = new EventEmitter<string>();\n\t@Output('blockReady') readonly onBlockReady = new EventEmitter<{ previousState: LoginFlowState; state: LoginFlowState }>();\n\t@Output('languageChange') readonly onLanguageChange = new EventEmitter<string | null>();\n\n\t@ViewChild('container', { read: ViewContainerRef, static: true }) readonly $containerRef!: ViewContainerRef;\n\n\tconstructor(\n\t\tprotected authService: StrivacityAuthService<NativeFlow>,\n\t\tprotected widgetService: StrivacityWidgetService,\n\t) {\n\t\tthis.widgetService.triggerFallback = (hostedUrl?: string, message?: string) => {\n\t\t\tconst url = hostedUrl || this.widgetService.state$.value.hostedUrl;\n\n\t\t\tthis.authService.sdk.logging?.warn(message ? `Triggering fallback due to: ${message}` : 'Triggering fallback');\n\n\t\t\tif (!url) {\n\t\t\t\tconst error = new Error('No hosted URL provided');\n\t\t\t\tthis.authService.sdk.logging?.error('Fallback error', error);\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tthis.onFallback.emit(new FallbackError(new URL(url)));\n\t\t};\n\t\tthis.widgetService.triggerClose = () => {\n\t\t\tthis.onClose.emit();\n\t\t};\n\t\tthis.widgetService.submitForm = async (formId: string) => {\n\t\t\ttry {\n\t\t\t\tthis.widgetService.loading$.next(true);\n\n\t\t\t\tconst data = await this.loginHandler.submitForm(formId, unflattenObject(this.widgetService.forms$.value[formId]));\n\n\t\t\t\tif (await this.authService.sdk.isAuthenticated) {\n\t\t\t\t\tthis.onLogin.emit(this.authService.sdk.idTokenClaims);\n\t\t\t\t} else {\n\t\t\t\t\tconst previousState = JSON.parse(JSON.stringify(this.widgetService.state$.value));\n\t\t\t\t\tconst newState: LoginFlowState = {\n\t\t\t\t\t\thostedUrl: data?.hostedUrl ?? this.widgetService.state$.value.hostedUrl,\n\t\t\t\t\t\tfinalizeUrl: data?.finalizeUrl ?? this.widgetService.state$.value.finalizeUrl,\n\t\t\t\t\t\tscreen: data?.screen ?? this.widgetService.state$.value.screen,\n\t\t\t\t\t\tforms: data?.forms ?? this.widgetService.state$.value.forms,\n\t\t\t\t\t\tlayout: data?.layout ?? this.widgetService.state$.value.layout,\n\t\t\t\t\t\tmessages: data?.messages ?? {},\n\t\t\t\t\t\tbranding: data?.branding ?? this.widgetService.state$.value.branding,\n\t\t\t\t\t};\n\n\t\t\t\t\tif (newState.screen !== this.widgetService.state$.value.screen) {\n\t\t\t\t\t\tconst forms: Record<string, Record<string, unknown>> = {};\n\t\t\t\t\t\tconst messages: Record<string, Record<string, LoginFlowMessage>> = {};\n\n\t\t\t\t\t\tfor (const form of newState.forms ?? []) {\n\t\t\t\t\t\t\tforms[form.id] = {};\n\t\t\t\t\t\t\tmessages[form.id] = {};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tthis.widgetService.forms$.next(forms);\n\t\t\t\t\t\tthis.widgetService.messages$.next(messages);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.authService.sdk.logging?.info(`Updating screen: ${newState.screen}`);\n\t\t\t\t\t}\n\n\t\t\t\t\tObject.keys(newState.messages ?? {}).forEach((formId) => {\n\t\t\t\t\t\tif (formId === 'global') {\n\t\t\t\t\t\t\tthis.onGlobalMessage.emit(newState.messages?.global?.text ?? '');\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst messages = { ...this.widgetService.messages$.value };\n\t\t\t\t\t\t\tmessages[formId] = newState.messages![formId];\n\t\t\t\t\t\t\tthis.widgetService.messages$.next(messages);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tthis.widgetService.state$.next(newState);\n\t\t\t\t\tthis.onBlockReady.emit({ previousState, state: structuredClone(newState) });\n\t\t\t\t\tthis.widgetService.loading$.next(false);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof FallbackError) {\n\t\t\t\t\tthis.onFallback.emit(error);\n\t\t\t\t} else {\n\t\t\t\t\tthis.onError.emit(error);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n\n\tngOnInit() {\n\t\tthis.subscriptions.add(\n\t\t\tthis.widgetService.state$.subscribe((state) => {\n\t\t\t\tthis.render(state);\n\t\t\t}),\n\t\t);\n\t\tvoid this.init();\n\t}\n\n\tngOnDestroy(): void {\n\t\tthis.subscriptions.unsubscribe();\n\t\tthis.clearAndDestroyComponents();\n\t\tthis.widgetService.loading$.next(false);\n\t\tthis.widgetService.state$.next({});\n\t\tthis.widgetService.forms$.next({});\n\t\tthis.widgetService.messages$.next({});\n\t}\n\n\tasync init() {\n\t\ttry {\n\t\t\tthis.loginHandler = this.authService.sdk.login(this.params);\n\n\t\t\tconst data = (await this.loginHandler.startSession(this.sessionId, this.language)) as LoginFlowState;\n\t\t\tconst previousState = JSON.parse(JSON.stringify(this.widgetService.state$.value));\n\t\t\tconst newState = {\n\t\t\t\thostedUrl: data?.hostedUrl ?? this.widgetService.state$.value.hostedUrl,\n\t\t\t\tfinalizeUrl: data?.finalizeUrl ?? this.widgetService.state$.value.finalizeUrl,\n\t\t\t\tscreen: data?.screen ?? this.widgetService.state$.value.screen,\n\t\t\t\tforms: data?.forms ?? this.widgetService.state$.value.forms,\n\t\t\t\tlayout: data?.layout ?? this.widgetService.state$.value.layout,\n\t\t\t\tmessages: data?.messages ?? {},\n\t\t\t\tbranding: data?.branding ?? this.widgetService.state$.value.branding,\n\t\t\t};\n\n\t\t\tthis.onLanguageChange.emit(this.loginHandler.language);\n\n\t\t\tif (await this.authService.sdk.isAuthenticated) {\n\t\t\t\tthis.onLogin.emit(this.authService.sdk.idTokenClaims);\n\t\t\t} else {\n\t\t\t\tif (newState.screen !== this.widgetService.state$.value.screen) {\n\t\t\t\t\tconst newFormContexts: Record<string, Record<string, unknown>> = {};\n\t\t\t\t\tconst newMessageContexts: Record<string, Record<string, LoginFlowMessage>> = {};\n\n\t\t\t\t\tfor (const form of newState.forms ?? []) {\n\t\t\t\t\t\tnewFormContexts[form.id] = {};\n\t\t\t\t\t\tnewMessageContexts[form.id] = {};\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.widgetService.forms$.next(newFormContexts);\n\t\t\t\t\tthis.widgetService.messages$.next(newMessageContexts);\n\t\t\t\t}\n\n\t\t\t\tObject.keys(newState.messages ?? {}).forEach((formId) => {\n\t\t\t\t\tif (formId === 'global') {\n\t\t\t\t\t\tthis.onGlobalMessage.emit(newState.messages?.global?.text ?? '');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst messages = { ...this.widgetService.messages$.value };\n\t\t\t\t\t\tmessages[formId] = newState.messages[formId];\n\n\t\t\t\t\t\tthis.widgetService.messages$.next(messages);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tthis.widgetService.state$.next(newState);\n\t\t\t\tthis.onBlockReady.emit({ previousState, state: structuredClone(newState) });\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (error instanceof FallbackError) {\n\t\t\t\tthis.onFallback.emit(error);\n\t\t\t} else {\n\t\t\t\tthis.onError.emit(error);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate render(state: LoginFlowState): void {\n\t\tthis.clearAndDestroyComponents();\n\n\t\tif (state.screen) {\n\t\t\tconst component = this.widgets['layout'];\n\n\t\t\tif (!component) {\n\t\t\t\tthis.widgetService.triggerFallback(undefined, 'No layout component provided');\n\t\t\t}\n\n\t\t\tconst widgetRendererRef = this.$containerRef.createComponent(StyWidgetRenderer);\n\t\t\twidgetRendererRef.setInput('items', state.layout?.items);\n\t\t\twidgetRendererRef.setInput('widgets', this.widgets);\n\t\t\twidgetRendererRef.changeDetectorRef.detectChanges();\n\n\t\t\tconst layoutRef = this.$containerRef.createComponent(component, {\n\t\t\t\tprojectableNodes: [[widgetRendererRef.location.nativeElement]],\n\t\t\t});\n\t\t\tlayoutRef.setInput('formId', (state.layout?.items[0] as Widget)?.formId);\n\t\t\tlayoutRef.setInput('type', state.layout?.type);\n\t\t\tlayoutRef.setInput('tag', 'form');\n\t\t\tlayoutRef.changeDetectorRef.detectChanges();\n\n\t\t\tthis.createdComponentRefs.push(widgetRendererRef, layoutRef);\n\t\t} else {\n\t\t\tconst loadingComponentType = this.widgets['loading'];\n\n\t\t\tif (loadingComponentType) {\n\t\t\t\tconst loadingRef = this.$containerRef.createComponent(loadingComponentType);\n\n\t\t\t\tthis.createdComponentRefs.push(loadingRef);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate clearAndDestroyComponents(): void {\n\t\tthis.createdComponentRefs.forEach((ref) => {\n\t\t\tif (!ref.hostView.destroyed) {\n\t\t\t\tref.destroy();\n\t\t\t}\n\t\t});\n\t\tthis.createdComponentRefs = [];\n\t\tthis.$containerRef?.clear();\n\t}\n}\n","import { type ModuleWithProviders, CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';\nimport type { SDKOptions } from '@strivacity/sdk-core';\nimport { StrivacityAuthService } from './services/auth.service';\nimport { provideStrivacity } from './utils/helpers';\nimport { StyLoginRenderer } from './components/login-renderer.component';\n\n@NgModule({\n\tschemas: [CUSTOM_ELEMENTS_SCHEMA],\n\tproviders: [StrivacityAuthService],\n\timports: [StyLoginRenderer],\n\texports: [StyLoginRenderer],\n})\nexport class StrivacityAuthModule {\n\tstatic forRoot(options: SDKOptions): ModuleWithProviders<StrivacityAuthModule> {\n\t\treturn {\n\t\t\tngModule: StrivacityAuthModule,\n\t\t\tproviders: [provideStrivacity(options)],\n\t\t};\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.StrivacityWidgetService","i1.StrivacityAuthService","i2.StrivacityWidgetService"],"mappings":";;;;;;;;;;;;;AAWA;;AAEG;MAIU,uBAAuB,CAAA;AAC1B,IAAA,QAAQ,GAAG,IAAI,eAAe,CAAU,KAAK,CAAC;AAC9C,IAAA,MAAM,GAAG,IAAI,eAAe,CAA0C,EAAE,CAAC;AACzE,IAAA,SAAS,GAAG,IAAI,eAAe,CAAmD,EAAE,CAAC;AACrF,IAAA,MAAM,GAAG,IAAI,eAAe,CAAiB,EAAE,CAAC;AAEzD,IAAA,eAAe;AACf,IAAA,YAAY;AACZ,IAAA,UAAU;AAEV,IAAA,YAAY,CAAC,MAAc,EAAE,QAAgB,EAAE,KAAc,EAAA;QAC5D,MAAM,KAAK,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE;AACtC,QAAA,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,CAA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C,eAAe;gBACQ,YAAY,EAAA,CAAA;sBAA1C,MAAM;uBAAC,YAAY;gBACe,gBAAgB,EAAA,CAAA;sBAAlD,MAAM;uBAAC,gBAAgB;gBAEmD,aAAa,EAAA,CAAA;sBAAvF,SAAS;uBAAC,WAAW,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE;;;MC7BpD,oBAAoB,CAAA;IAChC,OAAO,OAAO,CAAC,OAAmB,EAAA;QACjC,OAAO;AACN,YAAA,QAAQ,EAAE,oBAAoB;AAC9B,YAAA,SAAS,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;SACvC;IACF;wGANY,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;yGAApB,oBAAoB,EAAA,OAAA,EAAA,CAHtB,gBAAgB,CAAA,EAAA,OAAA,EAAA,CAChB,gBAAgB,CAAA,EAAA,CAAA;yGAEd,oBAAoB,EAAA,SAAA,EAJrB,CAAC,qBAAqB,CAAC,EAAA,CAAA;;4FAItB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBANhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACT,OAAO,EAAE,CAAC,sBAAsB,CAAC;oBACjC,SAAS,EAAE,CAAC,qBAAqB,CAAC;oBAClC,OAAO,EAAE,CAAC,gBAAgB,CAAC;oBAC3B,OAAO,EAAE,CAAC,gBAAgB,CAAC;AAC3B,iBAAA;;;ACXD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"strivacity-sdk-angular.mjs","sources":["../../src/lib/utils.ts","../../src/server/session.ts","../../src/lib/services/auth.service.ts","../../src/lib/services/native-login.service.ts","../../src/strivacity-sdk-angular.ts"],"sourcesContent":["import type { Provider, ModuleWithProviders } from '@angular/core';\nimport type { AngularSDKInitConfig } from '../types';\nimport { CUSTOM_ELEMENTS_SCHEMA, NgModule, InjectionToken } from '@angular/core';\nimport { StrivacityAuthService } from './services/auth.service';\n\nexport const STRIVACITY_SDK = new InjectionToken<AngularSDKInitConfig>('strivacity-sdk');\n\n/**\n * Provides the Strivacity SDK configuration and the `StrivacityAuthService` as dependency injection providers.\n *\n * This function is used to supply the Strivacity SDK configuration to the application\n * by binding it to the `STRIVACITY_SDK` token, and to register `StrivacityAuthService` as an injectable.\n *\n * @param {AngularSDKInitConfig} config The SDK configuration options.\n * @returns {Provider[]} The providers to add to the application (or component) injector.\n */\nexport function provideStrivacity(config: AngularSDKInitConfig): Provider[] {\n\treturn [{ provide: STRIVACITY_SDK, useValue: config }, StrivacityAuthService];\n}\n\n@NgModule({\n\tschemas: [CUSTOM_ELEMENTS_SCHEMA],\n})\nexport class StrivacityAuthModule {\n\t/**\n\t * Registers the Strivacity SDK configuration and the `StrivacityAuthService` as dependency injection providers.\n\t *\n\t * This is the `NgModule`-based equivalent of `provideStrivacity()`, for applications that still bootstrap via `NgModule`.\n\t *\n\t * @param {AngularSDKInitConfig} options The SDK configuration options.\n\t * @returns {ModuleWithProviders<StrivacityAuthModule>} The module along with its providers, to be imported once at the root of the application.\n\t */\n\tstatic forRoot(options: AngularSDKInitConfig): ModuleWithProviders<StrivacityAuthModule> {\n\t\treturn {\n\t\t\tngModule: StrivacityAuthModule,\n\t\t\tproviders: [provideStrivacity(options)],\n\t\t};\n\t}\n}\n","import type { EnvironmentProviders } from '@angular/core';\nimport type { AngularServerSDK, SessionData } from './types';\nimport { REQUEST, TransferState, inject, makeStateKey, provideAppInitializer } from '@angular/core';\n\nexport const SESSION_TRANSFER_KEY = makeStateKey<SessionData | null>('sty.session');\n\n/**\n * Loads the current session from the encrypted cookie storage (using Angular's `REQUEST` token) before the app\n * renders, and hands it over to the client through `TransferState`, so `StrivacityAuthService` can hydrate without\n * an extra round-trip or a loading flash.\n *\n * Add this to the server-only `ApplicationConfig` (e.g. `app.config.server.ts`), alongside `provideServerRendering()`.\n *\n * @param {AngularServerSDK | undefined} serverSdk - The server SDK instance created via `createServerSDK()`, or `undefined` when server-side sessions aren't configured (a no-op in that case).\n * @returns {EnvironmentProviders} The providers to add to the server `ApplicationConfig`.\n */\nexport function provideStrivacityServerSession(serverSdk: AngularServerSDK | undefined): EnvironmentProviders {\n\treturn provideAppInitializer(async () => {\n\t\tconst request = inject(REQUEST);\n\n\t\tif (!request || !serverSdk) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst transferState = inject(TransferState);\n\t\tconst session = await serverSdk.getSession(request);\n\n\t\ttransferState.set(SESSION_TRANSFER_KEY, session);\n\t});\n}\n","import type { IdTokenClaims, SDKInstance } from '../../types';\nimport { DestroyRef, Injectable, PLATFORM_ID, TransferState, inject, signal } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { initFlow } from '@strivacity/sdk-core';\nimport { STRIVACITY_SDK } from '../utils';\nimport { SESSION_TRANSFER_KEY } from '../../server/session';\n\n/**\n * Signal-based service exposing the Strivacity SDK state and actions to Angular components.\n *\n * Provided via `provideStrivacity()` (standalone) or `StrivacityAuthModule.forRoot()` (NgModule).\n */\n@Injectable()\nexport class StrivacityAuthService {\n\tprivate readonly loadingSignal = signal(true);\n\tprivate readonly languageSignal = signal(globalThis.navigator?.language ?? 'en-US');\n\tprivate readonly isAuthenticatedSignal = signal(false);\n\tprivate readonly idTokenClaimsSignal = signal<IdTokenClaims | null>(null);\n\tprivate readonly accessTokenSignal = signal<string | null>(null);\n\tprivate readonly refreshTokenSignal = signal<string | null>(null);\n\tprivate readonly accessTokenExpiredSignal = signal(true);\n\tprivate readonly accessTokenExpirationDateSignal = signal<number | null>(null);\n\n\treadonly options = inject(STRIVACITY_SDK);\n\treadonly sdk: SDKInstance = initFlow(this.options as never);\n\treadonly loading = this.loadingSignal.asReadonly();\n\treadonly language = this.languageSignal.asReadonly();\n\treadonly isAuthenticated = this.isAuthenticatedSignal.asReadonly();\n\treadonly idTokenClaims = this.idTokenClaimsSignal.asReadonly();\n\treadonly accessToken = this.accessTokenSignal.asReadonly();\n\treadonly refreshToken = this.refreshTokenSignal.asReadonly();\n\treadonly accessTokenExpired = this.accessTokenExpiredSignal.asReadonly();\n\treadonly accessTokenExpirationDate = this.accessTokenExpirationDateSignal.asReadonly();\n\n\tconstructor() {\n\t\tif (this.options.serverSessionUri) {\n\t\t\tconst transferState = inject(TransferState);\n\t\t\tconst hydratedSession = transferState.get(SESSION_TRANSFER_KEY, undefined);\n\n\t\t\tif (hydratedSession) {\n\t\t\t\tthis.sdk.session = hydratedSession;\n\n\t\t\t\tif (isPlatformBrowser(inject(PLATFORM_ID))) {\n\t\t\t\t\ttransferState.remove(SESSION_TRANSFER_KEY);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvoid this.updateSession();\n\n\t\tconst subscription = this.sdk.subscribeToAllEvents(() => this.updateSession());\n\t\tinject(DestroyRef).onDestroy(() => subscription.dispose());\n\t}\n\n\tinit(...args: Parameters<typeof this.sdk.init>): ReturnType<typeof this.sdk.init> {\n\t\treturn this.sdk.init(...args);\n\t}\n\n\tsubscribeToEvent(...args: Parameters<typeof this.sdk.subscribeToEvent>): ReturnType<typeof this.sdk.subscribeToEvent> {\n\t\treturn this.sdk.subscribeToEvent(...args);\n\t}\n\n\tsubscribeToAllEvents(...args: Parameters<typeof this.sdk.subscribeToAllEvents>): ReturnType<typeof this.sdk.subscribeToAllEvents> {\n\t\treturn this.sdk.subscribeToAllEvents(...args);\n\t}\n\n\tcheckAuthentication(...args: Parameters<typeof this.sdk.checkAuthentication>): ReturnType<typeof this.sdk.checkAuthentication> {\n\t\treturn this.sdk.checkAuthentication(...args);\n\t}\n\n\ttokenExchange(...args: Parameters<typeof this.sdk.tokenExchange>): ReturnType<typeof this.sdk.tokenExchange> {\n\t\treturn this.sdk.tokenExchange(...args);\n\t}\n\n\thandleCallback(...args: Parameters<typeof this.sdk.handleCallback>): ReturnType<typeof this.sdk.handleCallback> {\n\t\treturn this.sdk.handleCallback(...args);\n\t}\n\n\trefresh(): ReturnType<typeof this.sdk.refresh> {\n\t\treturn this.sdk.refresh();\n\t}\n\n\trevoke(): ReturnType<typeof this.sdk.revoke> {\n\t\treturn this.sdk.revoke();\n\t}\n\n\tlogout(...args: Parameters<typeof this.sdk.logout>): ReturnType<typeof this.sdk.logout> {\n\t\treturn this.sdk.logout(...args);\n\t}\n\n\tlogin(...args: Parameters<typeof this.sdk.login>): ReturnType<typeof this.sdk.login> {\n\t\treturn this.sdk.login(...args);\n\t}\n\n\tregister(...args: Parameters<typeof this.sdk.register>): ReturnType<typeof this.sdk.register> {\n\t\treturn this.sdk.register(...args);\n\t}\n\n\tentry(...args: Parameters<typeof this.sdk.entry>): ReturnType<typeof this.sdk.entry> {\n\t\treturn this.sdk.entry(...args);\n\t}\n\n\tprivate async updateSession(): Promise<void> {\n\t\tconst authenticated = await this.sdk.isAuthenticated;\n\n\t\tif (this.loadingSignal()) {\n\t\t\tthis.loadingSignal.set(false);\n\t\t}\n\t\tif (this.sdk.language !== this.languageSignal()) {\n\t\t\tthis.languageSignal.set(this.sdk.language);\n\t\t}\n\t\tif (authenticated !== this.isAuthenticatedSignal()) {\n\t\t\tthis.isAuthenticatedSignal.set(authenticated);\n\t\t}\n\t\tif (this.sdk.idTokenClaims !== this.idTokenClaimsSignal()) {\n\t\t\tthis.idTokenClaimsSignal.set(this.sdk.idTokenClaims ?? null);\n\t\t}\n\t\tif (this.sdk.accessToken !== this.accessTokenSignal()) {\n\t\t\tthis.accessTokenSignal.set(this.sdk.accessToken ?? null);\n\t\t}\n\t\tif (this.sdk.refreshToken !== this.refreshTokenSignal()) {\n\t\t\tthis.refreshTokenSignal.set(this.sdk.refreshToken ?? null);\n\t\t}\n\t\tif (this.sdk.accessTokenExpired !== this.accessTokenExpiredSignal()) {\n\t\t\tthis.accessTokenExpiredSignal.set(this.sdk.accessTokenExpired);\n\t\t}\n\t\tif (this.sdk.accessTokenExpirationDate !== this.accessTokenExpirationDateSignal()) {\n\t\t\tthis.accessTokenExpirationDateSignal.set(this.sdk.accessTokenExpirationDate ?? null);\n\t\t}\n\t}\n}\n","import type { NativeFlowMessage, NativeFlowState, NativeParams, NativeLoginOptions } from '../../types';\nimport { DestroyRef, Injectable, inject, signal } from '@angular/core';\nimport { FallbackError } from '@strivacity/sdk-core/utils/errors';\nimport { unflattenObject } from '@strivacity/sdk-core/utils';\nimport { StrivacityAuthService } from './auth.service';\n\n@Injectable()\nexport class StrivacityNativeLoginService {\n\tprivate readonly authService = inject(StrivacityAuthService);\n\tprivate readonly sdk = this.authService.sdk;\n\tprivate readonly abortController = new AbortController();\n\tprivate options: NativeLoginOptions = {};\n\n\tprivate readonly loadingSignal = signal(true);\n\tprivate readonly formsSignal = signal<Record<string, Record<string, unknown>>>({});\n\tprivate readonly messagesSignal = signal<Record<string, Record<string, NativeFlowMessage>>>({});\n\tprivate readonly stateSignal = signal<Partial<NativeFlowState>>({});\n\n\treadonly loading = this.loadingSignal.asReadonly();\n\treadonly forms = this.formsSignal.asReadonly();\n\treadonly messages = this.messagesSignal.asReadonly();\n\treadonly state = this.stateSignal.asReadonly();\n\n\tconstructor() {\n\t\tinject(DestroyRef).onDestroy(() => this.abortController.abort());\n\t}\n\n\t/**\n\t * Starts a native login flow session. Should be called once, from the page component that owns this service.\n\t *\n\t * @param {NativeLoginOptions} [options] - Optional options for the login session.\n\t */\n\tasync start(options: NativeLoginOptions = {}): Promise<void> {\n\t\tthis.options = options;\n\n\t\tawait this.sdk.init();\n\n\t\ttry {\n\t\t\tawait this.startSession(options.params);\n\t\t} catch (error) {\n\t\t\tif (error instanceof DOMException && error.name === 'AbortError') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.sdk.logging?.error('Error fetching authorization URI', error as Error);\n\t\t\tawait this.options.onError?.(error as Error);\n\t\t\tthis.loadingSignal.set(false);\n\t\t}\n\t}\n\n\tasync submitForm(formId: string, customBody?: Record<string, unknown>): Promise<void> {\n\t\ttry {\n\t\t\tthis.loadingSignal.set(true);\n\n\t\t\tconst nextState = await this.sdk.submitForm(formId, customBody ?? unflattenObject(this.formsSignal()[formId] ?? {}));\n\n\t\t\tif (nextState) {\n\t\t\t\tawait this.handleResponse(nextState);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (error instanceof FallbackError) {\n\t\t\t\tthis.sdk.logging?.error('Fallback error occurred', error);\n\t\t\t\tawait this.options.onFallback?.(error);\n\t\t\t} else {\n\t\t\t\tthis.sdk.logging?.error('Error submitting form', error as Error);\n\t\t\t\tawait this.options.onError?.(error as Error);\n\t\t\t}\n\t\t}\n\t}\n\n\tsetFormValue(formId: string, widgetId: string, value: unknown): void {\n\t\tconst forms = { ...this.formsSignal() };\n\n\t\tforms[formId] = { ...(forms[formId] ?? {}), [widgetId]: value === '' ? null : value };\n\t\tthis.formsSignal.set(forms);\n\t}\n\n\tsetMessage(formId: string, widgetId: string, value: NativeFlowMessage): void {\n\t\tconst messages = { ...this.messagesSignal() };\n\n\t\tmessages[formId] = { ...(messages[formId] ?? {}), [widgetId]: value };\n\t\tthis.messagesSignal.set(messages);\n\t}\n\n\ttriggerFallback(message?: string): void {\n\t\tthis.sdk.logging?.warn(message ? `Triggering fallback due to: ${message}` : 'Triggering fallback');\n\n\t\tconst hostedUrl = this.stateSignal().hostedUrl;\n\n\t\tif (!hostedUrl) {\n\t\t\tconst error = new Error('No hosted URL provided');\n\t\t\tthis.sdk.logging?.error('Fallback error', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tvoid this.options.onFallback?.(new FallbackError(new URL(hostedUrl)));\n\t}\n\n\ttriggerClose(): void {\n\t\tthis.sdk.logging?.debug('Triggering close');\n\t\tvoid this.options.onClose?.();\n\t}\n\n\tprivate async startSession(loginParams: NativeParams = {}): Promise<void> {\n\t\ttry {\n\t\t\tthis.loadingSignal.set(true);\n\n\t\t\tconst nextState = await this.sdk.startSession(loginParams);\n\n\t\t\tif (nextState) {\n\t\t\t\tawait this.handleResponse(nextState);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (error instanceof FallbackError) {\n\t\t\t\tthis.sdk.logging?.error('Fallback error occurred', error);\n\t\t\t\tawait this.options.onFallback?.(error);\n\t\t\t} else {\n\t\t\t\tthis.sdk.logging?.error('Error starting session', error as Error);\n\t\t\t\tawait this.options.onError?.(error as Error);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async handleResponse(nextState: Partial<NativeFlowState>): Promise<void> {\n\t\tif (this.sdk.session) {\n\t\t\treturn await this.options.onLogin?.(this.sdk.session);\n\t\t}\n\n\t\tconst currentState = this.stateSignal();\n\t\tconst newState: NativeFlowState = {\n\t\t\thostedUrl: nextState.hostedUrl ?? currentState.hostedUrl,\n\t\t\tfinalizeUrl: nextState.finalizeUrl ?? currentState.finalizeUrl,\n\t\t\tscreen: nextState.screen ?? currentState.screen,\n\t\t\tforms: nextState.forms ?? currentState.forms,\n\t\t\tlayout: nextState.layout ?? currentState.layout,\n\t\t\tmessages: nextState.messages ?? {},\n\t\t\tbranding: nextState.branding ?? currentState.branding,\n\t\t};\n\n\t\tif (newState.screen !== currentState.screen) {\n\t\t\tconst nextForms: Record<string, Record<string, unknown>> = {};\n\t\t\tconst nextMessages: Record<string, Record<string, NativeFlowMessage>> = {};\n\n\t\t\tfor (const form of newState.forms ?? []) {\n\t\t\t\tnextForms[form.id] = {};\n\t\t\t\tnextMessages[form.id] = {};\n\t\t\t}\n\n\t\t\tthis.formsSignal.set(nextForms);\n\t\t\tthis.messagesSignal.set(nextMessages);\n\t\t} else {\n\t\t\tthis.sdk.logging?.info(`Updating screen: ${newState.screen}`);\n\t\t}\n\n\t\tconst nextMessageMap = { ...this.messagesSignal() };\n\n\t\tfor (const formId of Object.keys(newState.messages ?? {})) {\n\t\t\tif (formId === 'global') {\n\t\t\t\tawait this.options.onGlobalMessage?.(newState.messages!.global!);\n\t\t\t} else {\n\t\t\t\tnextMessageMap[formId] = newState.messages![formId] ?? {};\n\t\t\t}\n\t\t}\n\n\t\tthis.messagesSignal.set(nextMessageMap);\n\t\tthis.stateSignal.set(newState);\n\n\t\tif (!newState.finalizeUrl) {\n\t\t\tthis.loadingSignal.set(false);\n\t\t}\n\t}\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;MAKa,cAAc,GAAG,IAAI,cAAc,CAAuB,gBAAgB;AAEvF;;;;;;;;AAQG;AACG,SAAU,iBAAiB,CAAC,MAA4B,EAAA;AAC7D,IAAA,OAAO,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,qBAAqB,CAAC;AAC9E;MAKa,oBAAoB,CAAA;AAChC;;;;;;;AAOG;IACH,OAAO,OAAO,CAAC,OAA6B,EAAA;QAC3C,OAAO;AACN,YAAA,QAAQ,EAAE,oBAAoB;AAC9B,YAAA,SAAS,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;SACvC;IACF;8GAdY,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;+GAApB,oBAAoB,EAAA,CAAA,CAAA;+GAApB,oBAAoB,EAAA,CAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAHhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACT,OAAO,EAAE,CAAC,sBAAsB,CAAC;AACjC,iBAAA;;;AClBM,MAAM,oBAAoB,GAAG,YAAY,CAAqB,aAAa,CAAC;AAEnF;;;;;;;;;AASG;AACG,SAAU,8BAA8B,CAAC,SAAuC,EAAA;AACrF,IAAA,OAAO,qBAAqB,CAAC,YAAW;AACvC,QAAA,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;AAE/B,QAAA,IAAI,CAAC,OAAO,IAAI,CAAC,SAAS,EAAE;YAC3B;QACD;AAEA,QAAA,MAAM,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;QAC3C,MAAM,OAAO,GAAG,MA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CAAC,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC;AACvC,QAAA,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC;AAE9B,QAAA,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE;AAC1B,YAAA,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC;QAC9B;IACD;8GAnKY,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA5B,4BAA4B,EAAA,CAAA,CAAA;;2FAA5B,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC;;;ACND;;AAEG;;"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export * from '@strivacity/sdk-core/utils/errors';
|
|
2
|
+
import { Request as Request$1, Router, Response as Response$1 } from 'express';
|
|
3
|
+
import { BaseServerSDK, SDKStorage, CookieOptions, LogoutTokenClaims, ServerSDKInitConfig, ServerSDKOptions, SessionData, SessionIdCookieStorageOptions, ServerStorage } from '@strivacity/sdk-core/types';
|
|
4
|
+
export * from '@strivacity/sdk-core/types';
|
|
5
|
+
import * as _angular_core from '@angular/core';
|
|
6
|
+
import { EnvironmentProviders } from '@angular/core';
|
|
7
|
+
export * from '@strivacity/sdk-core/storages';
|
|
8
|
+
export * from '@strivacity/sdk-core/utils';
|
|
9
|
+
|
|
10
|
+
type AngularServerRequest = Request$1 | Request;
|
|
11
|
+
type AngularServerStorage = SDKStorage<[
|
|
12
|
+
req?: AngularServerRequest
|
|
13
|
+
], [
|
|
14
|
+
req?: Request$1,
|
|
15
|
+
res?: Response$1,
|
|
16
|
+
cookieOptions?: CookieOptions
|
|
17
|
+
], [
|
|
18
|
+
req?: Request$1,
|
|
19
|
+
res?: Response$1,
|
|
20
|
+
cookieOptions?: CookieOptions
|
|
21
|
+
]> & {
|
|
22
|
+
deleteByLogoutToken?(token: LogoutTokenClaims): Promise<void>;
|
|
23
|
+
};
|
|
24
|
+
type AngularServerSDKOptions<Storage extends AngularServerStorage = AngularServerStorage, StateStorage extends SDKStorage = SDKStorage> = ServerSDKOptions<Storage, StateStorage>;
|
|
25
|
+
type AngularServerSDKInitConfig<Storage extends AngularServerStorage = AngularServerStorage, StateStorage extends SDKStorage = SDKStorage> = ServerSDKInitConfig & Partial<AngularServerSDKOptions<Storage, StateStorage>>;
|
|
26
|
+
type AngularServerSDK<TEvent extends AngularServerRequest | undefined = AngularServerRequest | undefined> = BaseServerSDK<TEvent> & {
|
|
27
|
+
/**
|
|
28
|
+
* The Express router exposing the authentication endpoints.
|
|
29
|
+
* Mount it under `authUrlPrefix`, e.g. `app.use('/auth', sdk.router)`.
|
|
30
|
+
*/
|
|
31
|
+
readonly handlers: Router;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Creates the server-side Strivacity SDK: an Express router exposing the auth endpoints and session helpers that can be reused elsewhere on the server.
|
|
36
|
+
*
|
|
37
|
+
* @param {AngularServerSDKInitConfig} initConfig - The SDK configuration options.
|
|
38
|
+
* @returns {AngularServerSDK} The server-side SDK instance.
|
|
39
|
+
*/
|
|
40
|
+
declare function createServerSDK(initConfig: AngularServerSDKInitConfig): AngularServerSDK;
|
|
41
|
+
|
|
42
|
+
declare const SESSION_TRANSFER_KEY: _angular_core.StateKey<SessionData | null>;
|
|
43
|
+
/**
|
|
44
|
+
* Loads the current session from the encrypted cookie storage (using Angular's `REQUEST` token) before the app
|
|
45
|
+
* renders, and hands it over to the client through `TransferState`, so `StrivacityAuthService` can hydrate without
|
|
46
|
+
* an extra round-trip or a loading flash.
|
|
47
|
+
*
|
|
48
|
+
* Add this to the server-only `ApplicationConfig` (e.g. `app.config.server.ts`), alongside `provideServerRendering()`.
|
|
49
|
+
*
|
|
50
|
+
* @param {AngularServerSDK | undefined} serverSdk - The server SDK instance created via `createServerSDK()`, or `undefined` when server-side sessions aren't configured (a no-op in that case).
|
|
51
|
+
* @returns {EnvironmentProviders} The providers to add to the server `ApplicationConfig`.
|
|
52
|
+
*/
|
|
53
|
+
declare function provideStrivacityServerSession(serverSdk: AngularServerSDK | undefined): EnvironmentProviders;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Creates a session storage that puts a random unique id value cookie on the client and keeping the actual session data in the given `storage`.
|
|
57
|
+
*
|
|
58
|
+
* @param {SDKStorage} storage - The storage used to persist session data, keyed by a randomly generated session id.
|
|
59
|
+
* @param {SessionIdCookieStorageOptions} [options] - Options for the session ID cookie, including default cookie attributes and a UUID generator function.
|
|
60
|
+
* @param {Partial<ServerCookieOptions>} [options.defaultCookieOptions] - Default cookie attributes for the session ID cookie.
|
|
61
|
+
* @param {() => string} [options.uuidGenerator] - Function to generate a new UUID for the session ID. Defaults to `() => crypto.randomUUID()`.
|
|
62
|
+
* @returns {ServerStorage} An object implementing the ServerStorage interface for managing sessions indexed by a session-id cookie.
|
|
63
|
+
*/
|
|
64
|
+
declare function createSessionIdCookieStorage(storage: SDKStorage, options?: SessionIdCookieStorageOptions): ServerStorage;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Converts an incoming Express request (or an already-standard `Request`, e.g. Angular's SSR `REQUEST` token) into a standard Web `Request`.
|
|
68
|
+
*
|
|
69
|
+
* @param {AngularServerRequest} req - The incoming request.
|
|
70
|
+
* @returns {Request} The equivalent Web `Request` object.
|
|
71
|
+
*/
|
|
72
|
+
declare function toWebRequest(req: AngularServerRequest): Request;
|
|
73
|
+
/**
|
|
74
|
+
* Writes a standard Web `Response` (built by the shared server SDK core) onto the Express response.
|
|
75
|
+
*
|
|
76
|
+
* @param {Response} response - The `Response` to write.
|
|
77
|
+
* @param {ExpressResponse} res - The Express response to write to.
|
|
78
|
+
*/
|
|
79
|
+
declare function applyResponse(response: Response, res: Response$1): Promise<void>;
|
|
80
|
+
|
|
81
|
+
export { SESSION_TRANSFER_KEY, applyResponse, createServerSDK, createSessionIdCookieStorage, provideStrivacityServerSession, toWebRequest };
|
|
82
|
+
export type { AngularServerRequest, AngularServerSDK, AngularServerSDKInitConfig, AngularServerSDKOptions, AngularServerStorage };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { SDKInitConfig, NativeParams, SessionData, NativeFlowMessage } from '@strivacity/sdk-core/types';
|
|
2
|
+
export * from '@strivacity/sdk-core/types';
|
|
3
|
+
import { initFlow } from '@strivacity/sdk-core';
|
|
4
|
+
import { FallbackError } from '@strivacity/sdk-core/utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Configuration used to initialize the Strivacity SDK on the client (browser) side.
|
|
8
|
+
*/
|
|
9
|
+
type AngularSDKInitConfig = SDKInitConfig;
|
|
10
|
+
/**
|
|
11
|
+
* The concrete SDK flow instance returned by `initFlow`, matching the configured `mode`.
|
|
12
|
+
*/
|
|
13
|
+
type SDKInstance = ReturnType<typeof initFlow>;
|
|
14
|
+
type NativeLoginOptions = {
|
|
15
|
+
/**
|
|
16
|
+
* Optional parameters to be passed to the login session request. These parameters will be sent to the `authorizationUri` endpoint.
|
|
17
|
+
*/
|
|
18
|
+
params?: NativeParams;
|
|
19
|
+
/**
|
|
20
|
+
* Called when the user successfully completes the login flow.
|
|
21
|
+
*/
|
|
22
|
+
onLogin?: (session: SessionData) => void | Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Called when the fallback flow is triggered, typically due to an error or unsupported environment.
|
|
25
|
+
*/
|
|
26
|
+
onFallback?: (error: FallbackError) => void | Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Called when the login flow is closed by the user.
|
|
29
|
+
*/
|
|
30
|
+
onClose?: () => void | Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Called when an error occurs during the login session initialization or flow.
|
|
33
|
+
*/
|
|
34
|
+
onError?: (error: Error) => void | Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Called when a global message is received during the login flow.
|
|
37
|
+
*/
|
|
38
|
+
onGlobalMessage?: (message: NativeFlowMessage) => void | Promise<void>;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type { AngularSDKInitConfig, NativeLoginOptions, SDKInstance };
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
export * from '@strivacity/sdk-core/flows';
|
|
2
|
+
export * from '@strivacity/sdk-core/handlers';
|
|
3
|
+
import { FallbackError } from '@strivacity/sdk-core/utils';
|
|
4
|
+
export * from '@strivacity/sdk-core/utils';
|
|
5
|
+
import { SDKInitConfig, NativeParams, SessionData, NativeFlowMessage, IdTokenClaims, NativeFlowState } from '@strivacity/sdk-core/types';
|
|
6
|
+
export * from '@strivacity/sdk-core/types';
|
|
7
|
+
import * as _angular_core from '@angular/core';
|
|
8
|
+
import { InjectionToken, ModuleWithProviders, Provider } from '@angular/core';
|
|
9
|
+
import * as _strivacity_sdk_core from '@strivacity/sdk-core';
|
|
10
|
+
import { initFlow } from '@strivacity/sdk-core';
|
|
11
|
+
export { COOKIE_CHUNK_SIZE, COOKIE_CONTEXT, createCacheAPIStorage, createIndexedDBStorage, createLocalStorage, createMemoryStorage, createServerMemoryStorage, createSessionStorage, createWorkerStorage, handleWorkerStorageRequests } from '@strivacity/sdk-core/storages';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Configuration used to initialize the Strivacity SDK on the client (browser) side.
|
|
15
|
+
*/
|
|
16
|
+
type AngularSDKInitConfig = SDKInitConfig;
|
|
17
|
+
/**
|
|
18
|
+
* The concrete SDK flow instance returned by `initFlow`, matching the configured `mode`.
|
|
19
|
+
*/
|
|
20
|
+
type SDKInstance = ReturnType<typeof initFlow>;
|
|
21
|
+
type NativeLoginOptions = {
|
|
22
|
+
/**
|
|
23
|
+
* Optional parameters to be passed to the login session request. These parameters will be sent to the `authorizationUri` endpoint.
|
|
24
|
+
*/
|
|
25
|
+
params?: NativeParams;
|
|
26
|
+
/**
|
|
27
|
+
* Called when the user successfully completes the login flow.
|
|
28
|
+
*/
|
|
29
|
+
onLogin?: (session: SessionData) => void | Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Called when the fallback flow is triggered, typically due to an error or unsupported environment.
|
|
32
|
+
*/
|
|
33
|
+
onFallback?: (error: FallbackError) => void | Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Called when the login flow is closed by the user.
|
|
36
|
+
*/
|
|
37
|
+
onClose?: () => void | Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Called when an error occurs during the login session initialization or flow.
|
|
40
|
+
*/
|
|
41
|
+
onError?: (error: Error) => void | Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Called when a global message is received during the login flow.
|
|
44
|
+
*/
|
|
45
|
+
onGlobalMessage?: (message: NativeFlowMessage) => void | Promise<void>;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Signal-based service exposing the Strivacity SDK state and actions to Angular components.
|
|
50
|
+
*
|
|
51
|
+
* Provided via `provideStrivacity()` (standalone) or `StrivacityAuthModule.forRoot()` (NgModule).
|
|
52
|
+
*/
|
|
53
|
+
declare class StrivacityAuthService {
|
|
54
|
+
private readonly loadingSignal;
|
|
55
|
+
private readonly languageSignal;
|
|
56
|
+
private readonly isAuthenticatedSignal;
|
|
57
|
+
private readonly idTokenClaimsSignal;
|
|
58
|
+
private readonly accessTokenSignal;
|
|
59
|
+
private readonly refreshTokenSignal;
|
|
60
|
+
private readonly accessTokenExpiredSignal;
|
|
61
|
+
private readonly accessTokenExpirationDateSignal;
|
|
62
|
+
readonly options: _strivacity_sdk_core.SDKInitConfig;
|
|
63
|
+
readonly sdk: SDKInstance;
|
|
64
|
+
readonly loading: _angular_core.Signal<boolean>;
|
|
65
|
+
readonly language: _angular_core.Signal<string>;
|
|
66
|
+
readonly isAuthenticated: _angular_core.Signal<boolean>;
|
|
67
|
+
readonly idTokenClaims: _angular_core.Signal<IdTokenClaims | null>;
|
|
68
|
+
readonly accessToken: _angular_core.Signal<string | null>;
|
|
69
|
+
readonly refreshToken: _angular_core.Signal<string | null>;
|
|
70
|
+
readonly accessTokenExpired: _angular_core.Signal<boolean>;
|
|
71
|
+
readonly accessTokenExpirationDate: _angular_core.Signal<number | null>;
|
|
72
|
+
constructor();
|
|
73
|
+
init(...args: Parameters<typeof this$1.sdk.init>): ReturnType<typeof this$1.sdk.init>;
|
|
74
|
+
subscribeToEvent(...args: Parameters<typeof this$1.sdk.subscribeToEvent>): ReturnType<typeof this$1.sdk.subscribeToEvent>;
|
|
75
|
+
subscribeToAllEvents(...args: Parameters<typeof this$1.sdk.subscribeToAllEvents>): ReturnType<typeof this$1.sdk.subscribeToAllEvents>;
|
|
76
|
+
checkAuthentication(...args: Parameters<typeof this$1.sdk.checkAuthentication>): ReturnType<typeof this$1.sdk.checkAuthentication>;
|
|
77
|
+
tokenExchange(...args: Parameters<typeof this$1.sdk.tokenExchange>): ReturnType<typeof this$1.sdk.tokenExchange>;
|
|
78
|
+
handleCallback(...args: Parameters<typeof this$1.sdk.handleCallback>): ReturnType<typeof this$1.sdk.handleCallback>;
|
|
79
|
+
refresh(): ReturnType<typeof this$1.sdk.refresh>;
|
|
80
|
+
revoke(): ReturnType<typeof this$1.sdk.revoke>;
|
|
81
|
+
logout(...args: Parameters<typeof this$1.sdk.logout>): ReturnType<typeof this$1.sdk.logout>;
|
|
82
|
+
login(...args: Parameters<typeof this$1.sdk.login>): ReturnType<typeof this$1.sdk.login>;
|
|
83
|
+
register(...args: Parameters<typeof this$1.sdk.register>): ReturnType<typeof this$1.sdk.register>;
|
|
84
|
+
entry(...args: Parameters<typeof this$1.sdk.entry>): ReturnType<typeof this$1.sdk.entry>;
|
|
85
|
+
private updateSession;
|
|
86
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<StrivacityAuthService, never>;
|
|
87
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<StrivacityAuthService>;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
declare class StrivacityNativeLoginService {
|
|
91
|
+
private readonly authService;
|
|
92
|
+
private readonly sdk;
|
|
93
|
+
private readonly abortController;
|
|
94
|
+
private options;
|
|
95
|
+
private readonly loadingSignal;
|
|
96
|
+
private readonly formsSignal;
|
|
97
|
+
private readonly messagesSignal;
|
|
98
|
+
private readonly stateSignal;
|
|
99
|
+
readonly loading: _angular_core.Signal<boolean>;
|
|
100
|
+
readonly forms: _angular_core.Signal<Record<string, Record<string, unknown>>>;
|
|
101
|
+
readonly messages: _angular_core.Signal<Record<string, Record<string, NativeFlowMessage>>>;
|
|
102
|
+
readonly state: _angular_core.Signal<Partial<NativeFlowState>>;
|
|
103
|
+
constructor();
|
|
104
|
+
/**
|
|
105
|
+
* Starts a native login flow session. Should be called once, from the page component that owns this service.
|
|
106
|
+
*
|
|
107
|
+
* @param {NativeLoginOptions} [options] - Optional options for the login session.
|
|
108
|
+
*/
|
|
109
|
+
start(options?: NativeLoginOptions): Promise<void>;
|
|
110
|
+
submitForm(formId: string, customBody?: Record<string, unknown>): Promise<void>;
|
|
111
|
+
setFormValue(formId: string, widgetId: string, value: unknown): void;
|
|
112
|
+
setMessage(formId: string, widgetId: string, value: NativeFlowMessage): void;
|
|
113
|
+
triggerFallback(message?: string): void;
|
|
114
|
+
triggerClose(): void;
|
|
115
|
+
private startSession;
|
|
116
|
+
private handleResponse;
|
|
117
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<StrivacityNativeLoginService, never>;
|
|
118
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<StrivacityNativeLoginService>;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
declare const STRIVACITY_SDK: InjectionToken<_strivacity_sdk_core.SDKInitConfig>;
|
|
122
|
+
/**
|
|
123
|
+
* Provides the Strivacity SDK configuration and the `StrivacityAuthService` as dependency injection providers.
|
|
124
|
+
*
|
|
125
|
+
* This function is used to supply the Strivacity SDK configuration to the application
|
|
126
|
+
* by binding it to the `STRIVACITY_SDK` token, and to register `StrivacityAuthService` as an injectable.
|
|
127
|
+
*
|
|
128
|
+
* @param {AngularSDKInitConfig} config The SDK configuration options.
|
|
129
|
+
* @returns {Provider[]} The providers to add to the application (or component) injector.
|
|
130
|
+
*/
|
|
131
|
+
declare function provideStrivacity(config: AngularSDKInitConfig): Provider[];
|
|
132
|
+
declare class StrivacityAuthModule {
|
|
133
|
+
/**
|
|
134
|
+
* Registers the Strivacity SDK configuration and the `StrivacityAuthService` as dependency injection providers.
|
|
135
|
+
*
|
|
136
|
+
* This is the `NgModule`-based equivalent of `provideStrivacity()`, for applications that still bootstrap via `NgModule`.
|
|
137
|
+
*
|
|
138
|
+
* @param {AngularSDKInitConfig} options The SDK configuration options.
|
|
139
|
+
* @returns {ModuleWithProviders<StrivacityAuthModule>} The module along with its providers, to be imported once at the root of the application.
|
|
140
|
+
*/
|
|
141
|
+
static forRoot(options: AngularSDKInitConfig): ModuleWithProviders<StrivacityAuthModule>;
|
|
142
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<StrivacityAuthModule, never>;
|
|
143
|
+
static ɵmod: _angular_core.ɵɵNgModuleDeclaration<StrivacityAuthModule, never, never, never>;
|
|
144
|
+
static ɵinj: _angular_core.ɵɵInjectorDeclaration<StrivacityAuthModule>;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export { STRIVACITY_SDK, StrivacityAuthModule, StrivacityAuthService, StrivacityNativeLoginService, provideStrivacity };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import angular from '@angular-eslint/eslint-plugin';
|
|
2
|
+
import angularTemplate from '@angular-eslint/eslint-plugin-template';
|
|
3
|
+
import { defineAngularConfig } from '../../eslint.config.base.mjs';
|
|
4
|
+
|
|
5
|
+
export default defineAngularConfig({
|
|
6
|
+
files: ['./src/**/*.ts'],
|
|
7
|
+
plugins: {
|
|
8
|
+
'@angular-eslint': angular,
|
|
9
|
+
'@angular-eslint/template': angularTemplate,
|
|
10
|
+
},
|
|
11
|
+
rules: {
|
|
12
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
13
|
+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
14
|
+
'@angular-eslint/directive-selector': [
|
|
15
|
+
'error',
|
|
16
|
+
{
|
|
17
|
+
type: 'attribute',
|
|
18
|
+
prefix: 'app',
|
|
19
|
+
style: 'camelCase',
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
'@angular-eslint/component-selector': [
|
|
23
|
+
'error',
|
|
24
|
+
{
|
|
25
|
+
type: 'element',
|
|
26
|
+
prefix: 'app',
|
|
27
|
+
style: 'kebab-case',
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
});
|
package/ng-package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
|
3
|
+
"allowedNonPeerDependencies": ["@strivacity/sdk-core", "@strivacity/sdk-angular"],
|
|
3
4
|
"dest": "dist",
|
|
4
5
|
"lib": {
|
|
5
|
-
"entryFile": "src/
|
|
6
|
-
}
|
|
7
|
-
"allowedNonPeerDependencies": ["@strivacity/sdk-core", "@strivacity/sdk-angular"]
|
|
6
|
+
"entryFile": "./src/index.ts"
|
|
7
|
+
}
|
|
8
8
|
}
|
package/package.json
CHANGED
|
@@ -1,28 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strivacity/sdk-angular",
|
|
3
|
-
"version": "
|
|
4
|
-
"license": "MIT",
|
|
3
|
+
"version": "4.0.0-beta.0",
|
|
5
4
|
"description": "Strivacity Angular SDK client",
|
|
5
|
+
"license": "MIT",
|
|
6
6
|
"author": "strivacity <opensource@strivacity.com>",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/Strivacity/sdk-js"
|
|
10
10
|
},
|
|
11
|
-
"
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@strivacity/sdk-core": "3.0.2"
|
|
14
|
-
},
|
|
15
|
-
"peerDependencies": {
|
|
16
|
-
"@angular/core": ">=14"
|
|
17
|
-
},
|
|
11
|
+
"sideEffects": false,
|
|
18
12
|
"main": "./dist/fesm2022/strivacity-sdk-angular.mjs",
|
|
19
|
-
"types": "./dist/
|
|
13
|
+
"types": "./dist/types/strivacity-sdk-angular.d.ts",
|
|
20
14
|
"exports": {
|
|
21
15
|
".": {
|
|
22
|
-
"types": "./dist/
|
|
16
|
+
"types": "./dist/types/strivacity-sdk-angular.d.ts",
|
|
23
17
|
"import": "./dist/fesm2022/strivacity-sdk-angular.mjs",
|
|
24
18
|
"esm": "./dist/fesm2022/strivacity-sdk-angular.mjs",
|
|
25
19
|
"default": "./dist/fesm2022/strivacity-sdk-angular.mjs"
|
|
20
|
+
},
|
|
21
|
+
"./types": {
|
|
22
|
+
"types": "./dist/types/strivacity-sdk-angular-src-types.d.ts",
|
|
23
|
+
"import": "./dist/fesm2022/strivacity-sdk-angular-src-types.mjs",
|
|
24
|
+
"esm": "./dist/fesm2022/strivacity-sdk-angular-src-types.mjs",
|
|
25
|
+
"default": "./dist/fesm2022/strivacity-sdk-angular-src-types.mjs"
|
|
26
|
+
},
|
|
27
|
+
"./server": {
|
|
28
|
+
"types": "./dist/types/strivacity-sdk-angular-src-server.d.ts",
|
|
29
|
+
"import": "./dist/fesm2022/strivacity-sdk-angular-src-server.mjs",
|
|
30
|
+
"esm": "./dist/fesm2022/strivacity-sdk-angular-src-server.mjs",
|
|
31
|
+
"default": "./dist/fesm2022/strivacity-sdk-angular-src-server.mjs"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@strivacity/sdk-core": "4.0.0-beta.0"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"@angular/core": ">=20",
|
|
39
|
+
"express": ">=5"
|
|
40
|
+
},
|
|
41
|
+
"peerDependenciesMeta": {
|
|
42
|
+
"express": {
|
|
43
|
+
"optional": true
|
|
26
44
|
}
|
|
27
45
|
}
|
|
28
46
|
}
|
package/project.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
3
|
+
"name": "sdk-angular",
|
|
4
|
+
"projectType": "library",
|
|
5
|
+
"sourceRoot": "packages/sdk-angular/src",
|
|
6
|
+
"targets": {
|
|
7
|
+
"build": {
|
|
8
|
+
"executor": "nx:run-commands",
|
|
9
|
+
"dependsOn": ["sdk-core:build"],
|
|
10
|
+
"options": {
|
|
11
|
+
"commands": [
|
|
12
|
+
{
|
|
13
|
+
"command": "ng-packagr -p packages/sdk-angular/ng-package.json -c packages/sdk-angular/tsconfig.lib.prod.json",
|
|
14
|
+
"forwardAllArgs": false
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"command": "rm -rf ./packages/sdk-angular/dist/src ./packages/sdk-angular/dist/package.json ./packages/sdk-angular/dist/.npmignore",
|
|
18
|
+
"forwardAllArgs": false
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"parallel": false
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"test": {
|
|
25
|
+
"executor": "nx:run-commands",
|
|
26
|
+
"dependsOn": ["build"],
|
|
27
|
+
"options": {
|
|
28
|
+
"cwd": "packages/sdk-angular",
|
|
29
|
+
"command": "vitest"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from '@strivacity/sdk-core/flows';
|
|
2
|
+
export * from '@strivacity/sdk-core/handlers';
|
|
3
|
+
export * from '@strivacity/sdk-core/utils';
|
|
4
|
+
export type * from '@strivacity/sdk-core/types';
|
|
5
|
+
|
|
6
|
+
export * from './lib/services';
|
|
7
|
+
export * from './lib/storages';
|
|
8
|
+
export * from './lib/utils';
|