fds-vue-core 8.10.0 → 8.11.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.
Files changed (65) hide show
  1. package/components.d.ts +8 -0
  2. package/dist/components/BankId/FdsBankIdQr/FdsBankIdQr.vue.d.ts +28 -0
  3. package/dist/components/BankId/FdsBankIdQr/types.d.ts +11 -0
  4. package/dist/components/BankId/FdsBankIdSameDevice/FdsBankIdSameDevice.vue.d.ts +13 -0
  5. package/dist/components/BankId/FdsBankIdSameDevice/types.d.ts +8 -0
  6. package/dist/components/BankId/FdsBankIdStatusAlert/FdsBankIdStatusAlert.vue.d.ts +13 -0
  7. package/dist/components/BankId/FdsBankIdStatusAlert/types.d.ts +9 -0
  8. package/dist/components/Form/FdsLoginEmailForm/FdsLoginEmailForm.vue.d.ts +20 -0
  9. package/dist/components/Form/FdsLoginEmailForm/types.d.ts +20 -0
  10. package/dist/composables/useBankIdDeviceIdentifier.d.ts +8 -0
  11. package/dist/composables/useBankIdMessages.d.ts +8 -0
  12. package/dist/composables/useBankIdSameDevice.d.ts +32 -0
  13. package/dist/composables/useBankIdSession.d.ts +53 -0
  14. package/dist/fds-vue-core.cjs.js +3141 -451
  15. package/dist/fds-vue-core.cjs.js.map +1 -1
  16. package/dist/fds-vue-core.css +1 -1
  17. package/dist/fds-vue-core.es.js +3133 -454
  18. package/dist/fds-vue-core.es.js.map +1 -1
  19. package/dist/helpers/bankId/autostart.d.ts +7 -0
  20. package/dist/helpers/bankId/constants.d.ts +13 -0
  21. package/dist/helpers/bankId/device.d.ts +2 -0
  22. package/dist/helpers/bankId/deviceIdentifier.d.ts +6 -0
  23. package/dist/helpers/bankId/hintCode.d.ts +13 -0
  24. package/dist/helpers/bankId/index.d.ts +29 -0
  25. package/dist/helpers/bankId/pollError.d.ts +2 -0
  26. package/dist/helpers/bankId/sameDevice.d.ts +46 -0
  27. package/dist/helpers/bankId/types.d.ts +83 -0
  28. package/dist/helpers/validateLoginEmail.d.ts +3 -0
  29. package/dist/index.d.ts +21 -2
  30. package/dist/tsconfig.build.tsbuildinfo +1 -1
  31. package/package.json +3 -2
  32. package/src/components/BankId/FdsBankIdQr/FdsBankIdQr.stories.ts +33 -0
  33. package/src/components/BankId/FdsBankIdQr/FdsBankIdQr.vue +89 -0
  34. package/src/components/BankId/FdsBankIdQr/types.ts +12 -0
  35. package/src/components/BankId/FdsBankIdSameDevice/FdsBankIdSameDevice.stories.ts +23 -0
  36. package/src/components/BankId/FdsBankIdSameDevice/FdsBankIdSameDevice.vue +48 -0
  37. package/src/components/BankId/FdsBankIdSameDevice/types.ts +9 -0
  38. package/src/components/BankId/FdsBankIdStatusAlert/FdsBankIdStatusAlert.stories.ts +19 -0
  39. package/src/components/BankId/FdsBankIdStatusAlert/FdsBankIdStatusAlert.vue +28 -0
  40. package/src/components/BankId/FdsBankIdStatusAlert/types.ts +10 -0
  41. package/src/components/Form/FdsLoginEmailForm/FdsLoginEmailForm.stories.ts +23 -0
  42. package/src/components/Form/FdsLoginEmailForm/FdsLoginEmailForm.vue +126 -0
  43. package/src/components/Form/FdsLoginEmailForm/types.ts +22 -0
  44. package/src/composables/useBankIdDeviceIdentifier.ts +15 -0
  45. package/src/composables/useBankIdMessages.ts +83 -0
  46. package/src/composables/useBankIdSameDevice.ts +161 -0
  47. package/src/composables/useBankIdSession.spec.ts +748 -0
  48. package/src/composables/useBankIdSession.ts +542 -0
  49. package/src/helpers/bankId/autostart.spec.ts +11 -0
  50. package/src/helpers/bankId/autostart.ts +32 -0
  51. package/src/helpers/bankId/constants.ts +13 -0
  52. package/src/helpers/bankId/device.ts +7 -0
  53. package/src/helpers/bankId/deviceIdentifier.ts +52 -0
  54. package/src/helpers/bankId/hintCode.spec.ts +31 -0
  55. package/src/helpers/bankId/hintCode.ts +62 -0
  56. package/src/helpers/bankId/index.ts +34 -0
  57. package/src/helpers/bankId/pollError.ts +44 -0
  58. package/src/helpers/bankId/sameDevice.spec.ts +126 -0
  59. package/src/helpers/bankId/sameDevice.ts +242 -0
  60. package/src/helpers/bankId/types.ts +91 -0
  61. package/src/helpers/validateLoginEmail.spec.ts +25 -0
  62. package/src/helpers/validateLoginEmail.ts +26 -0
  63. package/src/index.ts +60 -0
  64. package/src/lang/en.json +61 -0
  65. package/src/lang/sv.json +61 -0
package/components.d.ts CHANGED
@@ -35,6 +35,10 @@ import type { FdsRadioProps } from './dist/components/Form/FdsRadio/types'
35
35
  import type { FdsSelectProps } from './dist/components/Form/FdsSelect/types'
36
36
  import type { FdsPhonenumberProps } from './dist/components/Form/FdsPhonenumber/types'
37
37
  import type { FdsSsnProps } from './dist/components/Form/FdsSsn/types'
38
+ import type { FdsLoginEmailFormProps } from './dist/components/Form/FdsLoginEmailForm/types'
39
+ import type { FdsBankIdQrProps } from './dist/components/BankId/FdsBankIdQr/types'
40
+ import type { FdsBankIdSameDeviceProps } from './dist/components/BankId/FdsBankIdSameDevice/types'
41
+ import type { FdsBankIdStatusAlertProps } from './dist/components/BankId/FdsBankIdStatusAlert/types'
38
42
  import type { FdsTextareaProps } from './dist/components/Form/FdsTextarea/types'
39
43
  import type { FdsTableProps } from './dist/components/Table/FdsTable/types'
40
44
  import type { FdsTableHeadProps } from './dist/components/Table/FdsTableHead/types'
@@ -70,6 +74,10 @@ declare module 'vue' {
70
74
  FdsTextarea: DefineComponent<FdsTextareaProps>
71
75
  FdsPhonenumber: DefineComponent<FdsPhonenumberProps>
72
76
  FdsSsn: DefineComponent<FdsSsnProps>
77
+ FdsLoginEmailForm: DefineComponent<FdsLoginEmailFormProps>
78
+ FdsBankIdQr: DefineComponent<FdsBankIdQrProps>
79
+ FdsBankIdSameDevice: DefineComponent<FdsBankIdSameDeviceProps>
80
+ FdsBankIdStatusAlert: DefineComponent<FdsBankIdStatusAlertProps>
73
81
  FdsSelect: DefineComponent<FdsSelectProps>
74
82
  FdsTable: DefineComponent<FdsTableProps>
75
83
  FdsTableHead: DefineComponent<FdsTableHeadProps>
@@ -0,0 +1,28 @@
1
+ import { FdsBankIdQrProps } from './types';
2
+ declare var __VLS_14: {
3
+ qrCode: string | null;
4
+ };
5
+ type __VLS_Slots = {} & {
6
+ qr?: (props: typeof __VLS_14) => any;
7
+ };
8
+ declare const __VLS_base: import('vue').DefineComponent<FdsBankIdQrProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
9
+ cancel: () => any;
10
+ showQr: () => any;
11
+ }, string, import('vue').PublicProps, Readonly<FdsBankIdQrProps> & Readonly<{
12
+ onCancel?: (() => any) | undefined;
13
+ onShowQr?: (() => any) | undefined;
14
+ }>, {
15
+ dataTestid: string;
16
+ qrCode: string | null;
17
+ activePolling: boolean;
18
+ ongoingLogin: boolean;
19
+ rfa: string | null;
20
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
21
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
22
+ declare const _default: typeof __VLS_export;
23
+ export default _default;
24
+ type __VLS_WithSlots<T, S> = T & {
25
+ new (): {
26
+ $slots: S;
27
+ };
28
+ };
@@ -0,0 +1,11 @@
1
+ export interface FdsBankIdQrProps {
2
+ qrCode?: string | null;
3
+ activePolling?: boolean;
4
+ ongoingLogin?: boolean;
5
+ rfa?: string | null;
6
+ dataTestid?: string;
7
+ }
8
+ export interface FdsBankIdQrEmits {
9
+ showQr: [];
10
+ cancel: [];
11
+ }
@@ -0,0 +1,13 @@
1
+ import { FdsBankIdSameDeviceProps } from './types';
2
+ declare const __VLS_export: import('vue').DefineComponent<FdsBankIdSameDeviceProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
3
+ start: () => any;
4
+ cancel: () => any;
5
+ }, string, import('vue').PublicProps, Readonly<FdsBankIdSameDeviceProps> & Readonly<{
6
+ onStart?: (() => any) | undefined;
7
+ onCancel?: (() => any) | undefined;
8
+ }>, {
9
+ dataTestid: string;
10
+ ongoingLogin: boolean;
11
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,8 @@
1
+ export interface FdsBankIdSameDeviceProps {
2
+ ongoingLogin?: boolean;
3
+ dataTestid?: string;
4
+ }
5
+ export interface FdsBankIdSameDeviceEmits {
6
+ start: [];
7
+ cancel: [];
8
+ }
@@ -0,0 +1,13 @@
1
+ import { FdsBankIdStatusAlertProps } from './types';
2
+ declare const __VLS_export: import('vue').DefineComponent<FdsBankIdStatusAlertProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
3
+ close: () => any;
4
+ }, string, import('vue').PublicProps, Readonly<FdsBankIdStatusAlertProps> & Readonly<{
5
+ onClose?: (() => any) | undefined;
6
+ }>, {
7
+ title: string | null;
8
+ dataTestid: string;
9
+ body: string | null;
10
+ closeable: boolean;
11
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,9 @@
1
+ export interface FdsBankIdStatusAlertProps {
2
+ title?: string | null;
3
+ body?: string | null;
4
+ closeable?: boolean;
5
+ dataTestid?: string;
6
+ }
7
+ export interface FdsBankIdStatusAlertEmits {
8
+ close: [];
9
+ }
@@ -0,0 +1,20 @@
1
+ import { FdsLoginEmailFormProps } from './types';
2
+ declare const __VLS_export: import('vue').DefineComponent<FdsLoginEmailFormProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
3
+ submit: (payload: import('./types').FdsLoginEmailSubmitPayload) => any;
4
+ }, string, import('vue').PublicProps, Readonly<FdsLoginEmailFormProps> & Readonly<{
5
+ onSubmit?: ((payload: import('./types').FdsLoginEmailSubmitPayload) => any) | undefined;
6
+ }>, {
7
+ loading: boolean;
8
+ emailLabel: string;
9
+ passwordLabel: string;
10
+ submitLabel: string;
11
+ submittingLabel: string;
12
+ emailInvalidMessage: string;
13
+ emailRequiredMessage: string;
14
+ passwordRequiredMessage: string;
15
+ emailTestid: string;
16
+ passwordTestid: string;
17
+ submitTestid: string;
18
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
19
+ declare const _default: typeof __VLS_export;
20
+ export default _default;
@@ -0,0 +1,20 @@
1
+ export interface FdsLoginEmailFormProps {
2
+ loading?: boolean;
3
+ emailLabel?: string;
4
+ passwordLabel?: string;
5
+ submitLabel?: string;
6
+ submittingLabel?: string;
7
+ emailInvalidMessage?: string;
8
+ emailRequiredMessage?: string;
9
+ passwordRequiredMessage?: string;
10
+ emailTestid?: string;
11
+ passwordTestid?: string;
12
+ submitTestid?: string;
13
+ }
14
+ export interface FdsLoginEmailSubmitPayload {
15
+ email: string;
16
+ password: string;
17
+ }
18
+ export interface FdsLoginEmailFormEmits {
19
+ submit: [payload: FdsLoginEmailSubmitPayload];
20
+ }
@@ -0,0 +1,8 @@
1
+ export interface UseBankIdDeviceIdentifierOptions {
2
+ storageKey?: string;
3
+ }
4
+ export declare function useBankIdDeviceIdentifier(options?: UseBankIdDeviceIdentifierOptions): {
5
+ getBankIdDeviceIdentifier: ({ hash }?: {
6
+ hash?: boolean | undefined;
7
+ }) => Promise<string>;
8
+ };
@@ -0,0 +1,8 @@
1
+ export interface UseBankIdMessagesOptions {
2
+ titles?: Partial<Record<string, string>>;
3
+ bodies?: Partial<Record<string, string>>;
4
+ }
5
+ export declare function useBankIdMessages(options?: UseBankIdMessagesOptions): {
6
+ mapTitle: (code: string) => string;
7
+ mapBody: (code: string) => string;
8
+ };
@@ -0,0 +1,32 @@
1
+ import { generateBankIdNonce } from '../helpers/bankId/sameDevice';
2
+ import { BankIdNonceMetadata } from '../helpers/bankId/types';
3
+ export interface UseBankIdSameDeviceOptions {
4
+ storageKey: string;
5
+ getCurrentPath?: () => string;
6
+ navigateTo?: (path: string) => void | Promise<unknown>;
7
+ }
8
+ export interface HandleBankIdClientReturnOptions {
9
+ onCancel?: () => void;
10
+ onError?: (errorMessage: string) => void;
11
+ /** Order this mounted session is already polling. Its stored nonce is kept past the 3 minute limit. */
12
+ activeOrderRef?: string | null;
13
+ }
14
+ export interface BankIdClientReturnResult {
15
+ status: 'ignored' | 'matched' | 'resumed' | 'mismatch';
16
+ nonce?: string;
17
+ orderRef?: string;
18
+ /** Set when the return landed on another route. The caller navigates and must not cancel the order. */
19
+ redirectTo?: string;
20
+ }
21
+ export declare const useBankIdSameDevice: (options: UseBankIdSameDeviceOptions) => {
22
+ generateNonce: typeof generateBankIdNonce;
23
+ createReturnUrl: (nonce: string) => string | null;
24
+ persistNonceMetadata: (nonce: string, orderRef?: string) => void;
25
+ navigateTo: (path: string) => void | Promise<unknown>;
26
+ getStoredNonceMetadata: () => BankIdNonceMetadata | null;
27
+ clearStoredNonceMetadata: () => void;
28
+ extractNonceFromHash: (hash?: string) => string | null;
29
+ stripNonceFromLocation: () => void;
30
+ handleBankIdClientReturn: (returnOptions?: HandleBankIdClientReturnOptions) => BankIdClientReturnResult;
31
+ validateStoredNonce: (expectedNonce: string | null) => boolean;
32
+ };
@@ -0,0 +1,53 @@
1
+ import { Ref } from 'vue';
2
+ import { BankIdCreateOrderPayload, BankIdDeviceType, BankIdOrderResponse, BankIdPollPayload, BankIdPollResponse } from '../helpers/bankId/types';
3
+ import { UseBankIdMessagesOptions } from './useBankIdMessages';
4
+ import { BankIdClientReturnResult, HandleBankIdClientReturnOptions, UseBankIdSameDeviceOptions } from './useBankIdSameDevice';
5
+ export interface UseBankIdSessionOptions extends Pick<UseBankIdSameDeviceOptions, 'storageKey' | 'getCurrentPath' | 'navigateTo'>, UseBankIdMessagesOptions {
6
+ createOrder: (payload: BankIdCreateOrderPayload) => Promise<BankIdOrderResponse>;
7
+ poll: (payload: BankIdPollPayload) => Promise<BankIdPollResponse>;
8
+ cancel: (orderRef: string) => Promise<unknown>;
9
+ deviceIdentifierStorageKey?: string;
10
+ onSuccess?: (response: BankIdPollResponse) => void | Promise<void>;
11
+ onActivation?: (response: BankIdPollResponse) => void;
12
+ onPoll?: (response: BankIdPollResponse) => void;
13
+ onNonceMismatch?: () => void;
14
+ mapPollError?: (error: unknown) => string | null | undefined;
15
+ pollIntervalMs?: number;
16
+ maxPolls?: number;
17
+ }
18
+ export declare const useBankIdSession: (options: UseBankIdSessionOptions) => {
19
+ bankId: {
20
+ activePolling: boolean;
21
+ title: string | null;
22
+ body: string | null;
23
+ messageType: "info" | "warning";
24
+ messageCloseable: boolean;
25
+ transactionToken: {
26
+ orderRef: string;
27
+ } | null;
28
+ qrCode: string | null;
29
+ autoStartToken: string | null;
30
+ ongoingLogin: boolean;
31
+ sameDevice: boolean;
32
+ hintCode: string | null;
33
+ rfa: string | null;
34
+ nonce: string | null;
35
+ messageCode: string | null;
36
+ };
37
+ device: Ref<BankIdDeviceType | null, BankIdDeviceType | null>;
38
+ loading: Ref<boolean, boolean>;
39
+ initiateBankId: () => Promise<BankIdOrderResponse | undefined>;
40
+ openBankId: () => Promise<void>;
41
+ onCancel: () => Promise<void>;
42
+ clearError: () => void;
43
+ clearBankid: (msg: string) => void;
44
+ getDevice: () => void;
45
+ handleBankIdClientReturn: (returnOptions?: HandleBankIdClientReturnOptions) => BankIdClientReturnResult;
46
+ generateNonce: typeof import('../helpers/bankId/sameDevice').generateBankIdNonce;
47
+ createReturnUrl: (nonce: string) => string | null;
48
+ persistNonceMetadata: (nonce: string, orderRef?: string) => void;
49
+ clearStoredNonceMetadata: () => void;
50
+ validateStoredNonce: (expectedNonce: string | null) => boolean;
51
+ mapTitle: (code: string) => string;
52
+ mapBody: (code: string) => string;
53
+ };