@fanfare-io/fanfare-sdk-react 0.9.0 → 0.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.
@@ -1,4 +1,5 @@
1
1
  import { FanfareConfig } from '@fanfare-io/fanfare-sdk-core';
2
+ import { JourneySnapshot } from '@fanfare-io/fanfare-sdk-core/experiences';
2
3
  import { default as React } from 'react';
3
4
  import { Locale, PartialTranslationMessages, TranslationMessageKey } from './i18n';
4
5
  interface RequiredFanfareConfig {
@@ -26,6 +27,29 @@ export interface FanfareProviderProps extends FanfareConfig, RequiredFanfareConf
26
27
  * @default "en"
27
28
  */
28
29
  locale?: Locale;
30
+ /**
31
+ * Render children during server render and the client's first paint against
32
+ * a synchronous read-only SDK, instead of gating on initialization. The live
33
+ * SDK attaches after mount and replaces it seamlessly — server markup and
34
+ * the client's first paint are identical, so hydration matches.
35
+ *
36
+ * The default (false) preserves the client-only behavior exactly: children
37
+ * render only after the SDK initializes, with `loadingComponent` shown
38
+ * meanwhile.
39
+ *
40
+ * @default false
41
+ */
42
+ ssr?: boolean;
43
+ /**
44
+ * Snapshot seeding journey handles for first paint when `ssr` is enabled.
45
+ * The live SDK is authoritative once attached and refreshes within one poll.
46
+ */
47
+ initialSnapshot?: JourneySnapshot;
48
+ /**
49
+ * Server-minted ISO timestamp anchoring time-derived rendering (countdowns)
50
+ * when `ssr` is enabled, so a skewed device clock doesn't shift the display.
51
+ */
52
+ serverNow?: string;
29
53
  /**
30
54
  * Custom translations to merge with or override defaults.
31
55
  * Use this to customize button labels, messages, and other text.
@@ -95,5 +119,5 @@ export interface FanfareProviderProps extends FanfareConfig, RequiredFanfareConf
95
119
  * </FanfareProvider>
96
120
  * ```
97
121
  */
98
- export declare function FanfareProvider({ children, autoRestore, autoResume, loadingComponent, locale, translations, organizationId, publishableKey, environment, apiUrl, credentials, debug, auth, logging, sync, features, beacon, }: FanfareProviderProps): import("react/jsx-runtime").JSX.Element | null;
122
+ export declare function FanfareProvider({ children, autoRestore, autoResume, loadingComponent, ssr, initialSnapshot, serverNow, locale, translations, organizationId, publishableKey, environment, apiUrl, credentials, debug, auth, logging, sync, features, beacon, }: FanfareProviderProps): import("react/jsx-runtime").JSX.Element | null;
99
123
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fanfare-io/fanfare-sdk-react",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "React adapter for Fanfare SDK",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org",
@@ -43,8 +43,8 @@
43
43
  "nanostores": "^1.1.0",
44
44
  "tailwind-merge": "^2.6.0",
45
45
  "valibot": "^1.1.0",
46
- "@fanfare-io/fanfare-sdk-core": "0.9.0",
47
- "@fanfare-io/fanfare-sdk-i18n": "0.9.0"
46
+ "@fanfare-io/fanfare-sdk-core": "0.11.0",
47
+ "@fanfare-io/fanfare-sdk-i18n": "0.11.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@iconify-json/heroicons": "^1.2.3",
@@ -67,8 +67,8 @@
67
67
  "@types/react": "^18.0.0",
68
68
  "@types/react-dom": "^18.0.0",
69
69
  "@vitejs/plugin-react": "^5.0.2",
70
- "@vitest/browser": "^3.2.4",
71
- "@vitest/ui": "^3.2.4",
70
+ "@vitest/browser": "^3.2.7",
71
+ "@vitest/ui": "^3.2.7",
72
72
  "jsdom": "^26.1.0",
73
73
  "motion": "^12.23.12",
74
74
  "playwright": "^1.51.1",
@@ -87,9 +87,9 @@
87
87
  "vite": "^7.3.5",
88
88
  "vite-plugin-dts": "^4.5.4",
89
89
  "vite-tsconfig-paths": "^5.1.4",
90
- "vitest": "^3.2.4",
91
- "@fanfare-io/fanfare-sdk-core": "0.9.0",
92
- "@fanfare-io/fanfare-sdk-solid": "0.9.0"
90
+ "vitest": "^3.2.7",
91
+ "@fanfare-io/fanfare-sdk-core": "0.11.0",
92
+ "@fanfare-io/fanfare-sdk-solid": "0.11.0"
93
93
  },
94
94
  "sideEffects": [
95
95
  "**/*.css"
@@ -137,7 +137,8 @@
137
137
  "test": "vitest run --project unit",
138
138
  "test:browser": "vitest run --project storybook",
139
139
  "test:watch": "vitest --project unit",
140
- "test:unit": "vitest run --project unit --passWithNoTests",
140
+ "test:unit": "vitest run --project unit --passWithNoTests && vitest run --project ssr --passWithNoTests",
141
+ "test:ssr": "vitest run --project ssr --passWithNoTests",
141
142
  "test:component": "vitest run .test.tsx --passWithNoTests",
142
143
  "typecheck": "tsc --noEmit"
143
144
  }