@shellapps/experience-react 1.1.0 → 1.3.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/dist/index.d.mts CHANGED
@@ -35,6 +35,22 @@ declare class ErrorBoundary extends React__default.Component<ErrorBoundaryProps,
35
35
  render(): string | number | boolean | Iterable<React__default.ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
36
36
  }
37
37
 
38
+ interface FeedbackButtonProps {
39
+ /** Position of the floating button */
40
+ position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
41
+ /** Custom button label */
42
+ label?: string;
43
+ /** Button colour */
44
+ color?: string;
45
+ /** Hide the floating button (use exp.openFeedback() instead) */
46
+ hidden?: boolean;
47
+ /** API endpoint base URL */
48
+ apiUrl?: string;
49
+ /** Auth token for user endpoints */
50
+ authToken?: string;
51
+ }
52
+ declare function FeedbackButton({ position, label, color, hidden, apiUrl, authToken, }: FeedbackButtonProps): react_jsx_runtime.JSX.Element;
53
+
38
54
  declare function useExperience(): _shellapps_experience.Experience;
39
55
  declare function useTrack(): {
40
56
  track: (eventName: string, metadata?: Record<string, string>) => void;
@@ -48,15 +64,24 @@ interface TranslationResult {
48
64
  locales: Array<{
49
65
  code: string;
50
66
  name: string;
67
+ progress?: number;
51
68
  }>;
69
+ isLoading: boolean;
52
70
  }
53
71
  /**
54
- * Translation hook stub implementation for EXP-5.
55
- * Currently returns the key with interpolation support.
56
- * Will fetch from the Experience API when translations are implemented.
72
+ * Translation hook for the Experience Platform.
73
+ *
74
+ * Fetches translations from the Experience API, caches in memory + localStorage,
75
+ * and provides `t()` for interpolation and `setLocale()` for switching.
76
+ *
77
+ * Usage:
78
+ * ```tsx
79
+ * const { t, locale, setLocale, locales } = useTranslation();
80
+ * return <h1>{t('greeting', { name: 'Alex' })}</h1>;
81
+ * ```
57
82
  */
58
83
  declare function useTranslation(): TranslationResult;
59
84
 
60
85
  declare const ExperienceContext: React.Context<Experience | null>;
61
86
 
62
- export { ErrorBoundary, ExperienceContext, ExperienceProvider, type ExperienceProviderProps, useExperience, useFlag, useTrack, useTranslation };
87
+ export { ErrorBoundary, ExperienceContext, ExperienceProvider, type ExperienceProviderProps, FeedbackButton, useExperience, useFlag, useTrack, useTranslation };
package/dist/index.d.ts CHANGED
@@ -35,6 +35,22 @@ declare class ErrorBoundary extends React__default.Component<ErrorBoundaryProps,
35
35
  render(): string | number | boolean | Iterable<React__default.ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
36
36
  }
37
37
 
38
+ interface FeedbackButtonProps {
39
+ /** Position of the floating button */
40
+ position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
41
+ /** Custom button label */
42
+ label?: string;
43
+ /** Button colour */
44
+ color?: string;
45
+ /** Hide the floating button (use exp.openFeedback() instead) */
46
+ hidden?: boolean;
47
+ /** API endpoint base URL */
48
+ apiUrl?: string;
49
+ /** Auth token for user endpoints */
50
+ authToken?: string;
51
+ }
52
+ declare function FeedbackButton({ position, label, color, hidden, apiUrl, authToken, }: FeedbackButtonProps): react_jsx_runtime.JSX.Element;
53
+
38
54
  declare function useExperience(): _shellapps_experience.Experience;
39
55
  declare function useTrack(): {
40
56
  track: (eventName: string, metadata?: Record<string, string>) => void;
@@ -48,15 +64,24 @@ interface TranslationResult {
48
64
  locales: Array<{
49
65
  code: string;
50
66
  name: string;
67
+ progress?: number;
51
68
  }>;
69
+ isLoading: boolean;
52
70
  }
53
71
  /**
54
- * Translation hook stub implementation for EXP-5.
55
- * Currently returns the key with interpolation support.
56
- * Will fetch from the Experience API when translations are implemented.
72
+ * Translation hook for the Experience Platform.
73
+ *
74
+ * Fetches translations from the Experience API, caches in memory + localStorage,
75
+ * and provides `t()` for interpolation and `setLocale()` for switching.
76
+ *
77
+ * Usage:
78
+ * ```tsx
79
+ * const { t, locale, setLocale, locales } = useTranslation();
80
+ * return <h1>{t('greeting', { name: 'Alex' })}</h1>;
81
+ * ```
57
82
  */
58
83
  declare function useTranslation(): TranslationResult;
59
84
 
60
85
  declare const ExperienceContext: React.Context<Experience | null>;
61
86
 
62
- export { ErrorBoundary, ExperienceContext, ExperienceProvider, type ExperienceProviderProps, useExperience, useFlag, useTrack, useTranslation };
87
+ export { ErrorBoundary, ExperienceContext, ExperienceProvider, type ExperienceProviderProps, FeedbackButton, useExperience, useFlag, useTrack, useTranslation };