@foxpixel/react 0.2.1 → 0.2.3
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 +30 -5
- package/dist/index.d.ts +30 -5
- package/dist/index.js +153 -83
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +177 -107
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.d.mts
CHANGED
|
@@ -22,6 +22,10 @@ interface FoxPixelConfig {
|
|
|
22
22
|
* Tenant ID (optional, can be set per request)
|
|
23
23
|
*/
|
|
24
24
|
tenantId?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Current locale for site content i18n (e.g. "en", "pt"). Omit for default.
|
|
27
|
+
*/
|
|
28
|
+
locale?: string;
|
|
25
29
|
}
|
|
26
30
|
interface Service {
|
|
27
31
|
id: string;
|
|
@@ -140,6 +144,8 @@ interface FoxPixelContextValue {
|
|
|
140
144
|
config: FoxPixelConfig;
|
|
141
145
|
/** Optional: pass QueryClient so edit-mode messaging can invalidate cache without requiring useQueryClient() in SDK (avoids "No QueryClient set" in iframe). */
|
|
142
146
|
queryClient?: QueryClient | null;
|
|
147
|
+
/** Current locale for site content i18n (e.g. "en", "pt"). From config.locale. */
|
|
148
|
+
locale?: string;
|
|
143
149
|
}
|
|
144
150
|
interface FoxPixelProviderProps {
|
|
145
151
|
children: ReactNode;
|
|
@@ -274,8 +280,10 @@ interface EditableProps {
|
|
|
274
280
|
as?: keyof JSX.IntrinsicElements;
|
|
275
281
|
multiline?: boolean;
|
|
276
282
|
className?: string;
|
|
283
|
+
/** Override locale for this editable (default: from FoxPixelProvider config.locale). */
|
|
284
|
+
locale?: string;
|
|
277
285
|
}
|
|
278
|
-
declare function Editable({ contentKey, defaultValue, as, multiline, className, }: EditableProps): React.ReactElement<{
|
|
286
|
+
declare function Editable({ contentKey, defaultValue, as, multiline, className, locale: localeProp, }: EditableProps): React.ReactElement<{
|
|
279
287
|
className: string;
|
|
280
288
|
'aria-busy': boolean;
|
|
281
289
|
'aria-label': string;
|
|
@@ -291,7 +299,7 @@ declare function Editable({ contentKey, defaultValue, as, multiline, className,
|
|
|
291
299
|
/**
|
|
292
300
|
* Renders rich HTML content from the CMS. Content is sanitized before rendering.
|
|
293
301
|
*/
|
|
294
|
-
declare function EditableHTML({ contentKey, defaultValue, as, className, }: Omit<EditableProps, 'multiline'>): React.ReactElement<{
|
|
302
|
+
declare function EditableHTML({ contentKey, defaultValue, as, className, locale: localeProp, }: Omit<EditableProps, 'multiline'>): React.ReactElement<{
|
|
295
303
|
className: string;
|
|
296
304
|
'aria-busy': boolean;
|
|
297
305
|
}, string | React.JSXElementConstructor<any>> | React.DetailedReactHTMLElement<{
|
|
@@ -311,11 +319,12 @@ interface EditableImageProps {
|
|
|
311
319
|
width?: number;
|
|
312
320
|
height?: number;
|
|
313
321
|
priority?: boolean;
|
|
322
|
+
locale?: string;
|
|
314
323
|
}
|
|
315
324
|
/**
|
|
316
325
|
* Renders an image from a CMS-managed URL. Uses native img (no Next.js Image in SDK).
|
|
317
326
|
*/
|
|
318
|
-
declare function EditableImage({ contentKey, defaultValue, alt, className, width, height, priority, }: EditableImageProps): react_jsx_runtime.JSX.Element;
|
|
327
|
+
declare function EditableImage({ contentKey, defaultValue, alt, className, width, height, priority, locale: localeProp, }: EditableImageProps): react_jsx_runtime.JSX.Element;
|
|
319
328
|
|
|
320
329
|
/**
|
|
321
330
|
* Hook to fetch and manage services (Projects module)
|
|
@@ -470,6 +479,7 @@ declare function useContactCapture(): UseContactCaptureReturn;
|
|
|
470
479
|
interface SiteContent {
|
|
471
480
|
id: string;
|
|
472
481
|
contentKey: string;
|
|
482
|
+
locale?: string;
|
|
473
483
|
value: string | null;
|
|
474
484
|
contentType: string;
|
|
475
485
|
defaultValue: string | null;
|
|
@@ -488,6 +498,10 @@ interface UseSiteContentOptions {
|
|
|
488
498
|
* Whether to fetch on mount (default: true)
|
|
489
499
|
*/
|
|
490
500
|
fetchOnMount?: boolean;
|
|
501
|
+
/**
|
|
502
|
+
* Locale for i18n (e.g. "en", "pt"). Omit for default.
|
|
503
|
+
*/
|
|
504
|
+
locale?: string;
|
|
491
505
|
}
|
|
492
506
|
interface UseSiteContentReturn {
|
|
493
507
|
/**
|
|
@@ -561,6 +575,10 @@ interface UseSiteContentsOptions {
|
|
|
561
575
|
* Default values map
|
|
562
576
|
*/
|
|
563
577
|
defaults?: Record<string, string>;
|
|
578
|
+
/**
|
|
579
|
+
* Locale for i18n (e.g. "en", "pt"). Omit for default.
|
|
580
|
+
*/
|
|
581
|
+
locale?: string;
|
|
564
582
|
}
|
|
565
583
|
interface UseSiteContentsReturn {
|
|
566
584
|
/**
|
|
@@ -647,7 +665,10 @@ interface UseSiteContentSectionReturn {
|
|
|
647
665
|
* }
|
|
648
666
|
* ```
|
|
649
667
|
*/
|
|
650
|
-
|
|
668
|
+
interface UseSiteContentSectionOptions {
|
|
669
|
+
locale?: string;
|
|
670
|
+
}
|
|
671
|
+
declare function useSiteContentSection(section: string, options?: UseSiteContentSectionOptions): UseSiteContentSectionReturn;
|
|
651
672
|
|
|
652
673
|
/**
|
|
653
674
|
* Edit-mode hooks for CMS Visual (iframe communication with Tenant Admin).
|
|
@@ -671,7 +692,7 @@ declare function useEditModeMessaging(): boolean;
|
|
|
671
692
|
* Returns a callback to send an edit request to the parent iframe.
|
|
672
693
|
* Only has effect when in edit mode.
|
|
673
694
|
*/
|
|
674
|
-
declare function useSendEditRequest(): (contentKey: string, currentValue: string, contentType?: string, section?: string, description?: string) => void;
|
|
695
|
+
declare function useSendEditRequest(): (contentKey: string, currentValue: string, contentType?: string, section?: string, description?: string, locale?: string) => void;
|
|
675
696
|
|
|
676
697
|
/**
|
|
677
698
|
* Site content hook for Editable components.
|
|
@@ -680,6 +701,8 @@ declare function useSendEditRequest(): (contentKey: string, currentValue: string
|
|
|
680
701
|
*/
|
|
681
702
|
interface UseSiteContentQueryOptions {
|
|
682
703
|
defaultValue: string;
|
|
704
|
+
/** Locale for i18n (e.g. "en", "pt"). Omit for default. */
|
|
705
|
+
locale?: string;
|
|
683
706
|
}
|
|
684
707
|
interface UseSiteContentQueryReturn {
|
|
685
708
|
value: string;
|
|
@@ -702,6 +725,8 @@ interface PrefetchSiteContentOptions {
|
|
|
702
725
|
apiKey?: string;
|
|
703
726
|
tenantId?: string;
|
|
704
727
|
contentKeys: string[];
|
|
728
|
+
/** Locale for i18n (e.g. "en", "pt"). Can pass multiple to prefetch several locales. */
|
|
729
|
+
locale?: string | string[];
|
|
705
730
|
}
|
|
706
731
|
/**
|
|
707
732
|
* Prefetch site content keys and set them on the given QueryClient.
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,10 @@ interface FoxPixelConfig {
|
|
|
22
22
|
* Tenant ID (optional, can be set per request)
|
|
23
23
|
*/
|
|
24
24
|
tenantId?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Current locale for site content i18n (e.g. "en", "pt"). Omit for default.
|
|
27
|
+
*/
|
|
28
|
+
locale?: string;
|
|
25
29
|
}
|
|
26
30
|
interface Service {
|
|
27
31
|
id: string;
|
|
@@ -140,6 +144,8 @@ interface FoxPixelContextValue {
|
|
|
140
144
|
config: FoxPixelConfig;
|
|
141
145
|
/** Optional: pass QueryClient so edit-mode messaging can invalidate cache without requiring useQueryClient() in SDK (avoids "No QueryClient set" in iframe). */
|
|
142
146
|
queryClient?: QueryClient | null;
|
|
147
|
+
/** Current locale for site content i18n (e.g. "en", "pt"). From config.locale. */
|
|
148
|
+
locale?: string;
|
|
143
149
|
}
|
|
144
150
|
interface FoxPixelProviderProps {
|
|
145
151
|
children: ReactNode;
|
|
@@ -274,8 +280,10 @@ interface EditableProps {
|
|
|
274
280
|
as?: keyof JSX.IntrinsicElements;
|
|
275
281
|
multiline?: boolean;
|
|
276
282
|
className?: string;
|
|
283
|
+
/** Override locale for this editable (default: from FoxPixelProvider config.locale). */
|
|
284
|
+
locale?: string;
|
|
277
285
|
}
|
|
278
|
-
declare function Editable({ contentKey, defaultValue, as, multiline, className, }: EditableProps): React.ReactElement<{
|
|
286
|
+
declare function Editable({ contentKey, defaultValue, as, multiline, className, locale: localeProp, }: EditableProps): React.ReactElement<{
|
|
279
287
|
className: string;
|
|
280
288
|
'aria-busy': boolean;
|
|
281
289
|
'aria-label': string;
|
|
@@ -291,7 +299,7 @@ declare function Editable({ contentKey, defaultValue, as, multiline, className,
|
|
|
291
299
|
/**
|
|
292
300
|
* Renders rich HTML content from the CMS. Content is sanitized before rendering.
|
|
293
301
|
*/
|
|
294
|
-
declare function EditableHTML({ contentKey, defaultValue, as, className, }: Omit<EditableProps, 'multiline'>): React.ReactElement<{
|
|
302
|
+
declare function EditableHTML({ contentKey, defaultValue, as, className, locale: localeProp, }: Omit<EditableProps, 'multiline'>): React.ReactElement<{
|
|
295
303
|
className: string;
|
|
296
304
|
'aria-busy': boolean;
|
|
297
305
|
}, string | React.JSXElementConstructor<any>> | React.DetailedReactHTMLElement<{
|
|
@@ -311,11 +319,12 @@ interface EditableImageProps {
|
|
|
311
319
|
width?: number;
|
|
312
320
|
height?: number;
|
|
313
321
|
priority?: boolean;
|
|
322
|
+
locale?: string;
|
|
314
323
|
}
|
|
315
324
|
/**
|
|
316
325
|
* Renders an image from a CMS-managed URL. Uses native img (no Next.js Image in SDK).
|
|
317
326
|
*/
|
|
318
|
-
declare function EditableImage({ contentKey, defaultValue, alt, className, width, height, priority, }: EditableImageProps): react_jsx_runtime.JSX.Element;
|
|
327
|
+
declare function EditableImage({ contentKey, defaultValue, alt, className, width, height, priority, locale: localeProp, }: EditableImageProps): react_jsx_runtime.JSX.Element;
|
|
319
328
|
|
|
320
329
|
/**
|
|
321
330
|
* Hook to fetch and manage services (Projects module)
|
|
@@ -470,6 +479,7 @@ declare function useContactCapture(): UseContactCaptureReturn;
|
|
|
470
479
|
interface SiteContent {
|
|
471
480
|
id: string;
|
|
472
481
|
contentKey: string;
|
|
482
|
+
locale?: string;
|
|
473
483
|
value: string | null;
|
|
474
484
|
contentType: string;
|
|
475
485
|
defaultValue: string | null;
|
|
@@ -488,6 +498,10 @@ interface UseSiteContentOptions {
|
|
|
488
498
|
* Whether to fetch on mount (default: true)
|
|
489
499
|
*/
|
|
490
500
|
fetchOnMount?: boolean;
|
|
501
|
+
/**
|
|
502
|
+
* Locale for i18n (e.g. "en", "pt"). Omit for default.
|
|
503
|
+
*/
|
|
504
|
+
locale?: string;
|
|
491
505
|
}
|
|
492
506
|
interface UseSiteContentReturn {
|
|
493
507
|
/**
|
|
@@ -561,6 +575,10 @@ interface UseSiteContentsOptions {
|
|
|
561
575
|
* Default values map
|
|
562
576
|
*/
|
|
563
577
|
defaults?: Record<string, string>;
|
|
578
|
+
/**
|
|
579
|
+
* Locale for i18n (e.g. "en", "pt"). Omit for default.
|
|
580
|
+
*/
|
|
581
|
+
locale?: string;
|
|
564
582
|
}
|
|
565
583
|
interface UseSiteContentsReturn {
|
|
566
584
|
/**
|
|
@@ -647,7 +665,10 @@ interface UseSiteContentSectionReturn {
|
|
|
647
665
|
* }
|
|
648
666
|
* ```
|
|
649
667
|
*/
|
|
650
|
-
|
|
668
|
+
interface UseSiteContentSectionOptions {
|
|
669
|
+
locale?: string;
|
|
670
|
+
}
|
|
671
|
+
declare function useSiteContentSection(section: string, options?: UseSiteContentSectionOptions): UseSiteContentSectionReturn;
|
|
651
672
|
|
|
652
673
|
/**
|
|
653
674
|
* Edit-mode hooks for CMS Visual (iframe communication with Tenant Admin).
|
|
@@ -671,7 +692,7 @@ declare function useEditModeMessaging(): boolean;
|
|
|
671
692
|
* Returns a callback to send an edit request to the parent iframe.
|
|
672
693
|
* Only has effect when in edit mode.
|
|
673
694
|
*/
|
|
674
|
-
declare function useSendEditRequest(): (contentKey: string, currentValue: string, contentType?: string, section?: string, description?: string) => void;
|
|
695
|
+
declare function useSendEditRequest(): (contentKey: string, currentValue: string, contentType?: string, section?: string, description?: string, locale?: string) => void;
|
|
675
696
|
|
|
676
697
|
/**
|
|
677
698
|
* Site content hook for Editable components.
|
|
@@ -680,6 +701,8 @@ declare function useSendEditRequest(): (contentKey: string, currentValue: string
|
|
|
680
701
|
*/
|
|
681
702
|
interface UseSiteContentQueryOptions {
|
|
682
703
|
defaultValue: string;
|
|
704
|
+
/** Locale for i18n (e.g. "en", "pt"). Omit for default. */
|
|
705
|
+
locale?: string;
|
|
683
706
|
}
|
|
684
707
|
interface UseSiteContentQueryReturn {
|
|
685
708
|
value: string;
|
|
@@ -702,6 +725,8 @@ interface PrefetchSiteContentOptions {
|
|
|
702
725
|
apiKey?: string;
|
|
703
726
|
tenantId?: string;
|
|
704
727
|
contentKeys: string[];
|
|
728
|
+
/** Locale for i18n (e.g. "en", "pt"). Can pass multiple to prefetch several locales. */
|
|
729
|
+
locale?: string | string[];
|
|
705
730
|
}
|
|
706
731
|
/**
|
|
707
732
|
* Prefetch site content keys and set them on the given QueryClient.
|