@mindly/ui-components 6.6.0 → 6.6.1

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 (52) hide show
  1. package/dist/cjs/index.js +8 -8
  2. package/dist/cjs/lib2/features/AcceptAgreementFeature/AcceptAgreemnetFeature.d.ts +0 -1
  3. package/dist/cjs/lib2/features/GoogleCalendarModalFeature/GoogleCalendarModalFeature.d.ts +0 -1
  4. package/dist/cjs/lib2/features/OutdatedPersonalDataFeature/OutdatedPersonalDataFeature.d.ts +0 -1
  5. package/dist/cjs/lib2/features/PushNotificationsIsDisabledBanner/PushNotificationsIsDisabledBanner.d.ts +0 -1
  6. package/dist/cjs/lib2/features/PushNotificationsModal/PushNotificationsModal.d.ts +0 -1
  7. package/dist/cjs/lib2/shared/assets/icons/IconMinus.d.ts +0 -1
  8. package/dist/cjs/lib2/shared/providers/AuthProvider/AuthProvider.d.ts +12 -0
  9. package/dist/cjs/lib2/shared/providers/AuthProvider/index.d.ts +1 -0
  10. package/dist/cjs/lib2/shared/providers/AuthProvider/types.d.ts +19 -0
  11. package/dist/cjs/lib2/shared/providers/index.d.ts +1 -0
  12. package/dist/cjs/lib2/shared/ui/Calendar/Calendar.d.ts +0 -1
  13. package/dist/cjs/lib2/shared/ui/Calendar/VerticalCalendar.d.ts +0 -1
  14. package/dist/cjs/lib2/shared/ui/Calendar/VerticalCalendarMonthSkeleton.d.ts +0 -1
  15. package/dist/cjs/lib2/shared/ui/Calendar/VerticalCalendarSkeleton.d.ts +0 -1
  16. package/dist/cjs/lib2/shared/ui/ListBox/ListBox.d.ts +0 -1
  17. package/dist/cjs/lib2/shared/ui/ListBoxItem/ListBoxDefaultItem.d.ts +1 -1
  18. package/dist/cjs/lib2/shared/ui/ListBoxItem/ListBoxIconItem.d.ts +1 -1
  19. package/dist/cjs/lib2/shared/ui/RatingCircle/RatingCircleIcons.d.ts +0 -1
  20. package/dist/cjs/lib2/shared/ui/Tabs/Tab.d.ts +0 -1
  21. package/dist/cjs/lib2/shared/ui/Tabs/TabPanel.d.ts +0 -1
  22. package/dist/cjs/lib2/shared/ui/Tabs/Tabs.d.ts +0 -1
  23. package/dist/cjs/lib2/shared/utils/globalAuthState.d.ts +131 -0
  24. package/dist/cjs/lib2/shared/utils/index.d.ts +1 -0
  25. package/dist/cjs/lib2/widgets/UpdateContractWidget/UpdateContractWidget.d.ts +0 -1
  26. package/dist/esm/index.js +8 -8
  27. package/dist/esm/lib2/features/AcceptAgreementFeature/AcceptAgreemnetFeature.d.ts +0 -1
  28. package/dist/esm/lib2/features/GoogleCalendarModalFeature/GoogleCalendarModalFeature.d.ts +0 -1
  29. package/dist/esm/lib2/features/OutdatedPersonalDataFeature/OutdatedPersonalDataFeature.d.ts +0 -1
  30. package/dist/esm/lib2/features/PushNotificationsIsDisabledBanner/PushNotificationsIsDisabledBanner.d.ts +0 -1
  31. package/dist/esm/lib2/features/PushNotificationsModal/PushNotificationsModal.d.ts +0 -1
  32. package/dist/esm/lib2/shared/assets/icons/IconMinus.d.ts +0 -1
  33. package/dist/esm/lib2/shared/providers/AuthProvider/AuthProvider.d.ts +12 -0
  34. package/dist/esm/lib2/shared/providers/AuthProvider/index.d.ts +1 -0
  35. package/dist/esm/lib2/shared/providers/AuthProvider/types.d.ts +19 -0
  36. package/dist/esm/lib2/shared/providers/index.d.ts +1 -0
  37. package/dist/esm/lib2/shared/ui/Calendar/Calendar.d.ts +0 -1
  38. package/dist/esm/lib2/shared/ui/Calendar/VerticalCalendar.d.ts +0 -1
  39. package/dist/esm/lib2/shared/ui/Calendar/VerticalCalendarMonthSkeleton.d.ts +0 -1
  40. package/dist/esm/lib2/shared/ui/Calendar/VerticalCalendarSkeleton.d.ts +0 -1
  41. package/dist/esm/lib2/shared/ui/ListBox/ListBox.d.ts +0 -1
  42. package/dist/esm/lib2/shared/ui/ListBoxItem/ListBoxDefaultItem.d.ts +1 -1
  43. package/dist/esm/lib2/shared/ui/ListBoxItem/ListBoxIconItem.d.ts +1 -1
  44. package/dist/esm/lib2/shared/ui/RatingCircle/RatingCircleIcons.d.ts +0 -1
  45. package/dist/esm/lib2/shared/ui/Tabs/Tab.d.ts +0 -1
  46. package/dist/esm/lib2/shared/ui/Tabs/TabPanel.d.ts +0 -1
  47. package/dist/esm/lib2/shared/ui/Tabs/Tabs.d.ts +0 -1
  48. package/dist/esm/lib2/shared/utils/globalAuthState.d.ts +131 -0
  49. package/dist/esm/lib2/shared/utils/index.d.ts +1 -0
  50. package/dist/esm/lib2/widgets/UpdateContractWidget/UpdateContractWidget.d.ts +0 -1
  51. package/dist/index.d.ts +161 -1
  52. package/package.json +3 -1
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type AcceptAgreementFeatureProps = {
3
2
  isAccepted: boolean;
4
3
  setIsAccepted: (isAccepted: boolean) => void;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { WithTranslation } from 'react-i18next';
3
2
  type GoogleCalendarModalFeatureProps = {
4
3
  isOpen: boolean;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import { OutdatedPersonalDataFeatureProps } from './types';
3
2
  export declare function OutdatedPersonalDataFeature({ isOpen, presentingElement, onApply, onDismiss, subtitle, title, applyText, }: OutdatedPersonalDataFeatureProps): JSX.Element;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import { PushNotificationsIsDisabledBannerProps } from './types';
3
2
  export declare function PushNotificationsIsDisabledBanner({ onOpenNativeSettings, className, title, description, buttonText, }: PushNotificationsIsDisabledBannerProps): JSX.Element;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import { PushNotificationsModalProps } from './types';
3
2
  export declare function PushNotificationsModal({ onApplyPermission, isOpen, title, description, image, applyPermissionText, ...props }: PushNotificationsModalProps): JSX.Element;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import { IconProps } from '../../types';
3
2
  export declare function IconMinus({ color, size, ...other }: IconProps): JSX.Element;
@@ -0,0 +1,12 @@
1
+ import React, { FC } from 'react';
2
+ import { User } from '@capacitor-firebase/authentication';
3
+ import { AuthContextType } from './types';
4
+ export declare const AuthContext: React.Context<AuthContextType | null>;
5
+ type AuthProviderProps = {
6
+ /**
7
+ * REMOVE WHEN WE MOVE AUTH TO NATIVE CAPACITOR PLUGIN
8
+ */
9
+ webAuthListener?: (callback: (user: User | null) => void) => () => void;
10
+ };
11
+ export declare const AuthProvider: FC<AuthProviderProps>;
12
+ export {};
@@ -0,0 +1 @@
1
+ export * from './AuthProvider';
@@ -0,0 +1,19 @@
1
+ import { CreateUserWithEmailAndPasswordOptions, LinkWithEmailAndPasswordOptions, SendPasswordResetEmailOptions, SignInResult, SignInWithEmailAndPasswordOptions, User } from '@capacitor-firebase/authentication';
2
+ export type AuthContextType = {
3
+ isAuthLoading: boolean;
4
+ isAuthReady: boolean;
5
+ authUser: User | null;
6
+ signInAnonymously: () => Promise<SignInResult>;
7
+ signInWithApple: () => Promise<SignInResult>;
8
+ signInWithGoogle: () => Promise<SignInResult>;
9
+ signInWithCustomToken: (token: string) => Promise<SignInResult>;
10
+ signInWithEmailAndPassword: (options: SignInWithEmailAndPasswordOptions) => Promise<SignInResult>;
11
+ linkWithApple: () => Promise<SignInResult>;
12
+ linkWithGoogle: () => Promise<SignInResult>;
13
+ linkWithEmailAndPassword: (options: LinkWithEmailAndPasswordOptions) => Promise<SignInResult>;
14
+ signOut: () => Promise<void>;
15
+ createUserWithEmailAndPassword: (options: CreateUserWithEmailAndPasswordOptions) => Promise<SignInResult>;
16
+ sendPasswordResetEmail: (options: SendPasswordResetEmailOptions) => Promise<void>;
17
+ changePassword: (newPassword: string) => Promise<void>;
18
+ sendEmailVerification: () => Promise<void>;
19
+ };
@@ -3,3 +3,4 @@ export * from './ToastProvider';
3
3
  export * from './CircleRatingProvider';
4
4
  export * from './VideoProvider';
5
5
  export * from './SpecialistScheduleProvider';
6
+ export * from './AuthProvider';
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import { CalendarProps } from './types';
3
2
  export declare function Calendar({ maxValue, minValue, timeZone, locale, isShowWeekNames, isShowMonthNavigation, selectionMode, onSelectionChange, defaultSelectDates, onDatePress, renderCustomDateContent, fullWidth, ...props }: CalendarProps): JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { CalendarProps } from './types';
3
2
  type VerticalCalendarProps = CalendarProps & {
4
3
  visibleDuration?: number;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type VerticalCalendarMonthSkeletonProps = {
3
2
  days: number;
4
3
  };
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare function VerticalCalendarSkeleton(): JSX.Element;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  import { ListBoxProps } from './types';
3
2
  export default function ListBox<T extends Record<string, unknown>>({ selectedIconProps, type, selectionPosition, enableSelection, className, variant, onboardingTheme, isOnboardingPreview, isTransparent, isRoundCorners, maxSelectionCount, initialVisibleCount, t, ...props }: ListBoxProps<T>): JSX.Element;
@@ -14,6 +14,6 @@ declare const _default: React.MemoExoticComponent<({ item, isSelected, selection
14
14
  selectionPosition: "end" | "start";
15
15
  enableSelection: boolean;
16
16
  selectedIconProps: IconProps;
17
- type: "image" | "icon" | "checkbox" | "radio" | "emoji" | "roundImage";
17
+ type: "image" | "checkbox" | "radio" | "icon" | "emoji" | "roundImage";
18
18
  }) => import("react/jsx-runtime").JSX.Element>;
19
19
  export default _default;
@@ -9,7 +9,7 @@ declare const _default: React.MemoExoticComponent<({ item, isSelected, enableSel
9
9
  onboardingTheme?: OnBoardingThemeV2Type | undefined;
10
10
  item: Node<unknown>;
11
11
  enableSelection: boolean;
12
- type: "image" | "icon" | "checkbox" | "radio" | "emoji" | "roundImage";
12
+ type: "image" | "checkbox" | "radio" | "icon" | "emoji" | "roundImage";
13
13
  isOnboardingPreview?: boolean | undefined;
14
14
  image?: ResponseFileType | null | undefined;
15
15
  selectionMode?: "none" | "multiple" | "single" | undefined;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare function CircleRatingIcon({ index, className, }: {
3
2
  index: number;
4
3
  className: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { ItemProps, Node, TabListState } from 'react-stately';
3
2
  type TabProps<T> = {
4
3
  item: Node<T> & {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { AriaTabPanelProps } from 'react-aria';
3
2
  import type { TabListState } from 'react-stately';
4
3
  type TabPanelProps<T> = AriaTabPanelProps & {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { AriaTabListProps } from 'react-aria';
3
2
  type TabsProps<T> = AriaTabListProps<T> & {
4
3
  className?: string;
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Global Authentication State Manager
3
+ *
4
+ * This utility class manages the authentication readiness state across the entire application.
5
+ * It ensures that HTTP requests and other auth-dependent operations wait for authentication
6
+ * initialization to complete before proceeding.
7
+ *
8
+ * ## Usage Pattern:
9
+ *
10
+ * 1. **UI Library Internal**: The UI library calls `setReady()` when authentication initialization
11
+ * is complete (e.g., after token validation, user session restoration, etc.)
12
+ *
13
+ * 2. **External Consumers**: Global states, HTTP interceptors, and other parts of the application
14
+ * use `waitForReady()` or `getIsReady()` to ensure auth is initialized before making requests
15
+ *
16
+ * ## Example:
17
+ * // In UI library (AuthProvider):
18
+ * globalAuthState.setReady(); // Called after auth initialization
19
+ *
20
+ * // In global states or HTTP clients:
21
+ * await globalAuthState.waitForReady(); // Wait before making authenticated requests
22
+ *
23
+ * // In synchronous contexts:
24
+ * if (globalAuthState.getIsReady()) {
25
+ * // Proceed with auth-dependent operations
26
+ * }
27
+ *
28
+ * ## Thread Safety:
29
+ * This class is designed to be safe for concurrent access. Multiple consumers can wait
30
+ * for readiness simultaneously, and all will be notified when auth becomes ready.
31
+ */
32
+ declare class GlobalAuthState {
33
+ /** Internal flag tracking whether authentication is ready */
34
+ private isReady;
35
+ /** Promise that resolves when authentication becomes ready */
36
+ private readyPromise;
37
+ /** Function to resolve the readiness promise */
38
+ private resolveReady;
39
+ constructor();
40
+ /**
41
+ * Mark authentication as ready and notify all waiting consumers
42
+ *
43
+ * **INTERNAL USE ONLY**: This method should only be called by the UI library's
44
+ * authentication provider when auth initialization is complete.
45
+ *
46
+ * This method is idempotent - calling it multiple times has no additional effect.
47
+ *
48
+ * @example
49
+ * // In AuthProvider after successful initialization
50
+ * globalAuthState.setReady();
51
+ */
52
+ setReady(): void;
53
+ /**
54
+ * Wait for authentication to be ready before proceeding
55
+ *
56
+ * **PUBLIC API**: This method is intended for use by global states, HTTP interceptors,
57
+ * and other parts of the application that need to ensure auth is ready before proceeding.
58
+ *
59
+ * If auth is already ready, this method returns immediately. Otherwise, it waits
60
+ * until `setReady()` is called.
61
+ *
62
+ * @returns Promise that resolves when authentication is ready
63
+ *
64
+ * @example
65
+ * // In HTTP interceptor
66
+ * async function makeAuthenticatedRequest(url: string) {
67
+ * await globalAuthState.waitForReady();
68
+ * return fetch(url, { headers: { Authorization: getToken() } });
69
+ * }
70
+ *
71
+ * // In global state
72
+ * async function initializeUserData() {
73
+ * await globalAuthState.waitForReady();
74
+ * // Now safe to make authenticated API calls
75
+ * }
76
+ */
77
+ waitForReady(): Promise<void>;
78
+ /**
79
+ * Check if authentication is ready synchronously
80
+ *
81
+ * **PUBLIC API**: This method is intended for use in synchronous contexts where
82
+ * you need to check auth readiness without waiting.
83
+ *
84
+ * @returns `true` if authentication is ready, `false` otherwise
85
+ *
86
+ * @example
87
+ * // In a synchronous context
88
+ * function canMakeAuthRequest(): boolean {
89
+ * return globalAuthState.getIsReady();
90
+ * }
91
+ *
92
+ * // In conditional logic
93
+ * if (globalAuthState.getIsReady()) {
94
+ * // Safe to access auth-dependent features
95
+ * showUserDashboard();
96
+ * } else {
97
+ * // Show loading state
98
+ * showAuthLoadingSpinner();
99
+ * }
100
+ */
101
+ getIsReady(): boolean;
102
+ /**
103
+ * Reset the authentication ready state
104
+ *
105
+ * **PRIVATE METHOD**: This method is for internal use only (testing, re-initialization).
106
+ * It should not be called by external consumers as it can cause race conditions
107
+ * and unexpected behavior in production.
108
+ *
109
+ * Resets the state to unready and creates a new promise that consumers will wait on.
110
+ */
111
+ private reset;
112
+ }
113
+ /**
114
+ * Global singleton instance of the authentication state manager
115
+ *
116
+ * This is the main interface for interacting with authentication readiness state.
117
+ * Import and use this instance throughout your application to coordinate auth-dependent operations.
118
+ *
119
+ * @example
120
+ * import { globalAuthState } from './globalAuthState';
121
+ *
122
+ * // Wait for auth in async contexts
123
+ * await globalAuthState.waitForReady();
124
+ *
125
+ * // Check auth state synchronously
126
+ * if (globalAuthState.getIsReady()) {
127
+ * // Proceed with authenticated operations
128
+ * }
129
+ */
130
+ export declare const globalAuthState: GlobalAuthState;
131
+ export {};
@@ -10,3 +10,4 @@ export * from './filter';
10
10
  export * from './session';
11
11
  export * from './mock';
12
12
  export { ONBOARDING_THEME_DEFAULT_COLORS } from './onboarding';
13
+ export * from './globalAuthState';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type UpdateContractWidgetProps = {
3
2
  isAccepted: boolean;
4
3
  setIsAccepted: (isAccepted: boolean) => void;