@fanfare-io/fanfare-sdk-solid 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,5 +1,5 @@
1
1
  export { AlertPanel, type AlertPanelProps } from './alert-panel';
2
2
  export { InfoPanel, type InfoPanelProps } from './info-panel';
3
- export { normalizeOutcomeReason, type OutcomeReason } from './outcome-reason';
3
+ export { normalizeOutcomeReason, normalizeSequenceOutcomeReason, type OutcomeReason } from './outcome-reason';
4
4
  export { PanelHeading, type PanelHeadingProps, type PanelHeadingVariant } from './panel-heading';
5
5
  export { PanelBody, PanelFooter, PanelLayout, type PanelBodyProps, type PanelFooterProps, type PanelLayoutProps, } from './panel-layout';
@@ -16,8 +16,13 @@
16
16
  * queue_denied / draw_denied / denied / lost -> not_selected
17
17
  * timed_release_denied -> sold_out
18
18
  * outbid -> outbid
19
+ * floor_unsold -> floor_unsold
19
20
  * reserve_not_met -> reserve_not_met
20
21
  * completed / already_completed -> completed (a success terminal, not a loss)
22
+ * won -> won
23
+ * cancelled -> cancelled
24
+ * no_show -> no_show
25
+ * left -> left (voluntary exit: leave/withdraw)
21
26
  * closed / unknown / other -> ended
22
27
  *
23
28
  * The terminal projection carries the outcome TYPE (completed/denied/lost);
@@ -27,5 +32,9 @@
27
32
  * Static story lanes pass UI values directly (e.g. `"outbid"`); those
28
33
  * pass through unchanged.
29
34
  */
30
- export type OutcomeReason = "expired" | "not_selected" | "sold_out" | "outbid" | "reserve_not_met" | "completed" | "ended";
35
+ export type OutcomeReason = "expired" | "not_selected" | "sold_out" | "outbid" | "floor_unsold" | "reserve_not_met" | "completed" | "won" | "cancelled" | "no_show" | "left" | "ended";
31
36
  export declare function normalizeOutcomeReason(reason: string | undefined): OutcomeReason;
37
+ export declare function normalizeSequenceOutcomeReason(outcome: {
38
+ type: string;
39
+ reason?: string;
40
+ } | undefined, fallbackReason?: string): OutcomeReason;
@@ -6,6 +6,7 @@
6
6
  * @packageDocumentation
7
7
  */
8
8
  export { useFanfareAuth } from './use-auth';
9
+ export { createBeaconTracker } from './use-beacon-tracker';
9
10
  export { useExperienceJourney } from './use-experience-journey';
10
11
  export type { ExperienceJourneyOptions, UseExperienceJourneyOptions, UseExperienceJourneyResult, } from './use-experience-journey';
11
12
  export { useJourneySnapshot } from './use-journey-snapshot';
@@ -4,6 +4,7 @@ export declare function useFanfareAuth(): {
4
4
  isAuthenticated: import('solid-js').Accessor<boolean>;
5
5
  isGuest: import('solid-js').Accessor<boolean | undefined>;
6
6
  session: import('solid-js').Accessor<import('@fanfare-io/fanfare-sdk-core/auth').Session | undefined>;
7
+ identityExpiresAt: import('solid-js').Accessor<string | undefined>;
7
8
  guest: () => Promise<import('@fanfare-io/fanfare-sdk-core/auth').GuestSession>;
8
9
  requestOtp: (options: OtpRequest) => Promise<void>;
9
10
  verifyOtp: (options: OtpVerify) => Promise<import('@fanfare-io/fanfare-sdk-core/auth').AuthenticatedSession>;
@@ -0,0 +1,28 @@
1
+ import { BoundBeaconTracker } from '@fanfare-io/fanfare-sdk-core/beacon';
2
+ import { Accessor } from 'solid-js';
3
+ /**
4
+ * Experience currently rendering around the consumer, as an accessor.
5
+ * `ExperienceWidget` publishes its `experienceId` here so descendants (slots,
6
+ * render-prop children, storefront components) can attribute beacon events
7
+ * without threading the id through props. It is an accessor, not a bare string,
8
+ * because Solid runs component setup once: a tracker must read the value at
9
+ * track time so a later change to the widget's `experienceId` prop is honored.
10
+ * Returns `null` outside any experience.
11
+ */
12
+ export declare const ExperienceIdContext: import('solid-js').Context<Accessor<string | null>>;
13
+ /**
14
+ * Creates a beacon tracker scoped to an experience.
15
+ *
16
+ * With no argument the tracker binds to the enclosing `ExperienceWidget`'s
17
+ * experience; pass an `experienceId` to bind explicitly (an override, or for use
18
+ * outside a widget). Called with neither an argument nor a surrounding
19
+ * experience, it throws rather than silently emitting unattributed events.
20
+ *
21
+ * The bound experience is resolved at each `track`/`trackBatch` call, so if the
22
+ * enclosing widget's `experienceId` changes, subsequent events follow it.
23
+ *
24
+ * @param experienceId - Experience to bind to; defaults to the enclosing widget's
25
+ * @returns A tracker whose `track`/`trackBatch` stamp events with the experience
26
+ * and, once routed, the sequence
27
+ */
28
+ export declare function createBeaconTracker(experienceId?: string): BoundBeaconTracker;
@@ -1,3 +1,4 @@
1
+ import { FanfareError } from '@fanfare-io/fanfare-sdk-core/errors';
1
2
  import { JourneyHandle, JourneySnapshot, JourneyView } from '@fanfare-io/fanfare-sdk-core/experiences';
2
3
  import { MaybeAccessor } from '../utils/to-accessor';
3
4
  export interface ExperienceJourneyOptions {
@@ -12,6 +13,7 @@ export interface UseExperienceJourneyResult {
12
13
  view: () => JourneyView | null;
13
14
  snapshot: () => JourneySnapshot | null;
14
15
  error: () => string | null;
16
+ fanfareError: () => FanfareError | null;
15
17
  start: (options?: ExperienceJourneyOptions) => Promise<JourneyView>;
16
18
  }
17
19
  export declare function useExperienceJourney(experienceId: MaybeAccessor<string | undefined>, options?: UseExperienceJourneyOptions): UseExperienceJourneyResult;
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  */
8
8
  export { FanfareProvider, useFanfare } from './components/provider';
9
9
  export type { FanfareProviderProps } from './components/provider';
10
- export { useExperienceJourney, useFanfareAuth, useJourneySnapshot, useNanostore } from './hooks';
10
+ export { createBeaconTracker, useExperienceJourney, useFanfareAuth, useJourneySnapshot, useNanostore } from './hooks';
11
11
  export { I18nProvider, RTL_LOCALES, isRTLLocale, useTranslations } from './i18n';
12
12
  export type { I18nConfig, I18nProviderProps, Locale, PartialTranslationMessages, RTLLocale, TextDirection, TranslateFunction, TranslateOptions, TranslationKey, TranslationMessageKey, TranslationMessages, } from './i18n';
13
13
  export { THEME_CSS_VARS, ThemeProvider, buildThemeCssVars } from './theme';