@passflow/react 0.2.8 → 0.2.10

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 (27) hide show
  1. package/dist/index.cjs.js +4 -4
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.es.js +440 -6
  4. package/dist/index.es.js.map +1 -1
  5. package/dist/src/components/flow/two-factor-verify/index.d.ts +1 -0
  6. package/dist/src/components/flow/two-factor-verify/index.d.ts.map +1 -1
  7. package/dist/src/components/form/index.d.ts +1 -0
  8. package/dist/src/components/form/index.d.ts.map +1 -1
  9. package/dist/src/components/form/two-factor-challenge/index.d.ts +10 -0
  10. package/dist/src/components/form/two-factor-challenge/index.d.ts.map +1 -0
  11. package/dist/src/components/form/two-factor-challenge/method-selector.d.ts +12 -0
  12. package/dist/src/components/form/two-factor-challenge/method-selector.d.ts.map +1 -0
  13. package/dist/src/components/form/two-factor-challenge/otp-input.d.ts +12 -0
  14. package/dist/src/components/form/two-factor-challenge/otp-input.d.ts.map +1 -0
  15. package/dist/src/context/auth-context.d.ts +10 -1
  16. package/dist/src/context/auth-context.d.ts.map +1 -1
  17. package/dist/src/hooks/index.d.ts +3 -0
  18. package/dist/src/hooks/index.d.ts.map +1 -1
  19. package/dist/src/hooks/use-session-expired.d.ts +49 -0
  20. package/dist/src/hooks/use-session-expired.d.ts.map +1 -0
  21. package/dist/src/hooks/use-two-factor-challenge.d.ts +16 -0
  22. package/dist/src/hooks/use-two-factor-challenge.d.ts.map +1 -0
  23. package/dist/src/hooks/use-two-factor-methods.d.ts +14 -0
  24. package/dist/src/hooks/use-two-factor-methods.d.ts.map +1 -0
  25. package/dist/src/types/index.d.ts +18 -0
  26. package/dist/src/types/index.d.ts.map +1 -1
  27. package/package.json +2 -2
@@ -4,6 +4,7 @@ type TwoFactorVerifyFlowProps = {
4
4
  successAuthRedirect?: SuccessAuthRedirect;
5
5
  signInPath?: string;
6
6
  twoFactorSetupPath?: string;
7
+ useV2Flow?: boolean;
7
8
  };
8
9
  export declare const TwoFactorVerifyFlow: FC<TwoFactorVerifyFlowProps>;
9
10
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/flow/two-factor-verify/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,oBAAoB,CAAC;AAE5B,KAAK,wBAAwB,GAAG;IAC9B,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CA2F5D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/flow/two-factor-verify/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,oBAAoB,CAAC;AAE5B,KAAK,wBAAwB,GAAG;IAC9B,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAkG5D,CAAC"}
@@ -7,4 +7,5 @@ export * from './reset-password';
7
7
  export * from './invitation-join';
8
8
  export * from './two-factor-verify';
9
9
  export * from './two-factor-setup';
10
+ export * from './two-factor-challenge';
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/form/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAElC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/form/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAElC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { FC } from 'react';
2
+ type TwoFactorChallengeProps = {
3
+ firstFactorMethod?: string;
4
+ onSuccess?: () => void;
5
+ onError?: (error: Error) => void;
6
+ trustDevice?: boolean;
7
+ };
8
+ export declare const TwoFactorChallenge: FC<TwoFactorChallengeProps>;
9
+ export {};
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/two-factor-challenge/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKhC,KAAK,uBAAuB,GAAG;IAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAkK1D,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { TwoFactorMethod } from '@passflow/core';
2
+ import { FC } from 'react';
3
+ type MethodSelectorProps = {
4
+ availableMethods: TwoFactorMethod[];
5
+ currentMethod: TwoFactorMethod;
6
+ onSelectMethod: (method: TwoFactorMethod) => void;
7
+ isOpen: boolean;
8
+ onClose: () => void;
9
+ };
10
+ export declare const MethodSelector: FC<MethodSelectorProps>;
11
+ export {};
12
+ //# sourceMappingURL=method-selector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"method-selector.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/two-factor-challenge/method-selector.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,KAAK,mBAAmB,GAAG;IACzB,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,aAAa,EAAE,eAAe,CAAC;IAC/B,cAAc,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IAClD,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAsBF,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CA+ClD,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { FC } from 'react';
2
+ type OtpInputComponentProps = {
3
+ value: string;
4
+ onChange: (value: string) => void;
5
+ numInputs?: number;
6
+ error?: string;
7
+ disabled?: boolean;
8
+ autoFocus?: boolean;
9
+ };
10
+ export declare const OtpInputComponent: FC<OtpInputComponentProps>;
11
+ export {};
12
+ //# sourceMappingURL=otp-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otp-input.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/two-factor-challenge/otp-input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,KAAK,sBAAsB,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAuCxD,CAAC"}
@@ -1,14 +1,23 @@
1
1
  import { ParsedTokens, Tokens } from '@passflow/core';
2
2
  import { default as React, FC, PropsWithChildren } from 'react';
3
+ export type SessionExpiredHandler = (reason: 'refresh_failed' | 'token_invalid' | 'logged_out') => void;
3
4
  export type AuthContextValue = {
4
5
  isAuthenticated: () => boolean;
5
6
  logout: () => void;
6
7
  isLoading: boolean;
8
+ isSessionExpired: boolean;
7
9
  getTokens: (doRefresh: boolean) => Promise<{
8
10
  tokens: Tokens | undefined;
9
11
  parsedTokens: ParsedTokens | undefined;
10
12
  }>;
11
13
  };
12
14
  export declare const AuthContext: React.Context<AuthContextValue | undefined>;
13
- export declare const AuthProvider: FC<PropsWithChildren>;
15
+ export type AuthProviderProps = PropsWithChildren<{
16
+ /**
17
+ * Called when the session expires (token refresh failed).
18
+ * Use this to redirect to your login page.
19
+ */
20
+ onSessionExpired?: SessionExpiredHandler;
21
+ }>;
22
+ export declare const AuthProvider: FC<AuthProviderProps>;
14
23
  //# sourceMappingURL=auth-context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth-context.d.ts","sourceRoot":"","sources":["../../../src/context/auth-context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,EAAE,KAAK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,iBAAiB,CAAC;IAChD;;;OAGG;IACH,gBAAgB,CAAC,EAAE,qBAAqB,CAAC;CAC1C,CAAC,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAkE9C,CAAC"}
@@ -18,4 +18,7 @@ export { useTwoFactorSetup, type UseTwoFactorSetupProps, type TwoFactorSetupStep
18
18
  export { useTwoFactorVerify, type UseTwoFactorVerifyProps } from './use-two-factor-verify';
19
19
  export { useTwoFactorManage, type UseTwoFactorManageProps } from './use-two-factor-manage';
20
20
  export { useTwoFactorSetupMagicLink, type UseTwoFactorSetupMagicLinkReturn } from './use-two-factor-setup-magic-link';
21
+ export { useTwoFactorChallenge, type UseTwoFactorChallengeReturn } from './use-two-factor-challenge';
22
+ export { useTwoFactorMethods, type UseTwoFactorMethodsReturn } from './use-two-factor-methods';
23
+ export { useSessionExpired, type UseSessionExpiredOptions, type UseSessionExpiredResult, type SessionExpiredReason } from './use-session-expired';
21
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,KAAK,4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E,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,49 @@
1
+ export type SessionExpiredReason = 'refresh_failed' | 'token_invalid' | 'logged_out';
2
+ export interface UseSessionExpiredOptions {
3
+ /**
4
+ * Called when the session expires.
5
+ * Use this to redirect to your login page.
6
+ */
7
+ onSessionExpired?: (reason: SessionExpiredReason) => void;
8
+ }
9
+ export interface UseSessionExpiredResult {
10
+ /**
11
+ * True if the session has expired and user needs to re-authenticate.
12
+ */
13
+ isSessionExpired: boolean;
14
+ /**
15
+ * The reason why the session expired, if applicable.
16
+ */
17
+ expiredReason: SessionExpiredReason | null;
18
+ /**
19
+ * Reset the session expired state (e.g., after redirecting to login).
20
+ */
21
+ resetSessionExpired: () => void;
22
+ }
23
+ /**
24
+ * Hook to handle session expiration events.
25
+ *
26
+ * When the SDK detects that the session is invalid (e.g., refresh token expired),
27
+ * it emits a SessionExpired event. This hook allows you to react to that event
28
+ * and redirect users to your login page.
29
+ *
30
+ * @example
31
+ * ```tsx
32
+ * function App() {
33
+ * const { isSessionExpired } = useSessionExpired({
34
+ * onSessionExpired: (reason) => {
35
+ * console.log('Session expired:', reason);
36
+ * window.location.href = '/login';
37
+ * },
38
+ * });
39
+ *
40
+ * if (isSessionExpired) {
41
+ * return <div>Redirecting to login...</div>;
42
+ * }
43
+ *
44
+ * return <YourApp />;
45
+ * }
46
+ * ```
47
+ */
48
+ export declare function useSessionExpired(options?: UseSessionExpiredOptions): UseSessionExpiredResult;
49
+ //# sourceMappingURL=use-session-expired.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-session-expired.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-session-expired.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG,eAAe,GAAG,YAAY,CAAC;AAErF,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;CAC3D;AAED,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,aAAa,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAC3C;;OAEG;IACH,mBAAmB,EAAE,MAAM,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,CAAC,EAAE,wBAAwB,GAAG,uBAAuB,CAsC7F"}
@@ -0,0 +1,16 @@
1
+ import { TwoFactorChallengeResponse, TwoFactorMethod, TwoFactorVerifyResponseV2 } from '@passflow/core';
2
+ export type UseTwoFactorChallengeReturn = {
3
+ challenge: TwoFactorChallengeResponse | null;
4
+ isLoading: boolean;
5
+ error: Error | null;
6
+ requestChallenge: (firstFactorMethod?: string) => Promise<void>;
7
+ verify: (response: string, trustDevice?: boolean) => Promise<TwoFactorVerifyResponseV2 | null>;
8
+ switchMethod: (method: TwoFactorMethod) => Promise<void>;
9
+ selectedMethod: TwoFactorMethod | null;
10
+ reset: () => void;
11
+ };
12
+ /**
13
+ * Hook to manage the v2 two-factor challenge flow with multi-method support
14
+ */
15
+ export declare const useTwoFactorChallenge: () => UseTwoFactorChallengeReturn;
16
+ //# sourceMappingURL=use-two-factor-challenge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-two-factor-challenge.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-two-factor-challenge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,eAAe,EACf,yBAAyB,EAC1B,MAAM,gBAAgB,CAAC;AAIxB,MAAM,MAAM,2BAA2B,GAAG;IACxC,SAAS,EAAE,0BAA0B,GAAG,IAAI,CAAC;IAC7C,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,gBAAgB,EAAE,CAAC,iBAAiB,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAAC;IAC/F,YAAY,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,cAAc,EAAE,eAAe,GAAG,IAAI,CAAC;IACvC,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,QAAO,2BAmGxC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { RegisteredTwoFactorMethod, TwoFactorMethod } from '@passflow/core';
2
+ export type UseTwoFactorMethodsReturn = {
3
+ availableMethods: TwoFactorMethod[];
4
+ registeredMethods: RegisteredTwoFactorMethod[];
5
+ isLoading: boolean;
6
+ error: Error | null;
7
+ refresh: () => Promise<void>;
8
+ removeMethod: (methodId: string) => Promise<void>;
9
+ };
10
+ /**
11
+ * Hook to manage two-factor authentication methods
12
+ */
13
+ export declare const useTwoFactorMethods: () => UseTwoFactorMethodsReturn;
14
+ //# sourceMappingURL=use-two-factor-methods.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-two-factor-methods.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-two-factor-methods.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAIjF,MAAM,MAAM,yBAAyB,GAAG;IACtC,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,iBAAiB,EAAE,yBAAyB,EAAE,CAAC;IAC/C,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,QAAO,yBAwDtC,CAAC"}
@@ -3,4 +3,22 @@ export type DefaultMethod = 'email_or_username' | 'phone';
3
3
  export type PreferChallenge = 'passkey' | 'password' | 'otp' | 'magic_link';
4
4
  export type SuccessAuthRedirect = string;
5
5
  export type { TwoFactorErrorType, TwoFactorError } from './two-factor-errors';
6
+ export type { TwoFactorMethod, TwoFactorChallengeResponse, RegisteredTwoFactorMethod, TwoFactorVerifyRequestV2, TwoFactorVerifyResponseV2, } from '@passflow/core';
7
+ export interface UseTwoFactorChallengeReturn {
8
+ challenge: import('@passflow/core').TwoFactorChallengeResponse | null;
9
+ isLoading: boolean;
10
+ error: Error | null;
11
+ requestChallenge: (firstFactorMethod?: string) => Promise<void>;
12
+ verify: (response: string, trustDevice?: boolean) => Promise<void>;
13
+ switchMethod: (method: import('@passflow/core').TwoFactorMethod) => Promise<void>;
14
+ selectedMethod: import('@passflow/core').TwoFactorMethod | null;
15
+ }
16
+ export interface UseTwoFactorMethodsReturn {
17
+ availableMethods: import('@passflow/core').TwoFactorMethod[];
18
+ registeredMethods: import('@passflow/core').RegisteredTwoFactorMethod[];
19
+ isLoading: boolean;
20
+ error: Error | null;
21
+ refresh: () => Promise<void>;
22
+ removeMethod: (methodId: string) => Promise<void>;
23
+ }
6
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;AAE3D,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,OAAO,CAAC;AAE1D,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,UAAU,GAAG,KAAK,GAAG,YAAY,CAAC;AAE5E,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAEzC,YAAY,EAAE,kBAAkB,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OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@passflow/react",
3
3
  "description": "Passflow React UI Kit",
4
- "version": "0.2.8",
4
+ "version": "0.2.10",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -43,7 +43,7 @@
43
43
  "react-dom": "^18.0.0 || ^19.0.0"
44
44
  },
45
45
  "dependencies": {
46
- "@passflow/core": "^0.2.0",
46
+ "@passflow/core": "^0.2.11",
47
47
  "@radix-ui/react-dialog": "^1.1.15",
48
48
  "@radix-ui/react-popover": "^1.1.15",
49
49
  "clsx": "^2.1.1",