@fanfare-io/fanfare-sdk-solid 0.1.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.
Files changed (96) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +53 -0
  3. package/dist/components/auth/access-code-input.d.ts +17 -0
  4. package/dist/components/auth/auth-form.d.ts +34 -0
  5. package/dist/components/auth/auth-input.d.ts +19 -0
  6. package/dist/components/auth/email-input.d.ts +14 -0
  7. package/dist/components/auth/index.d.ts +6 -0
  8. package/dist/components/auth/otp-input.d.ts +21 -0
  9. package/dist/components/auth/phone-input.d.ts +14 -0
  10. package/dist/components/compositions/access-code-form.d.ts +25 -0
  11. package/dist/components/compositions/challenge-gate.d.ts +24 -0
  12. package/dist/components/compositions/ended-module.d.ts +13 -0
  13. package/dist/components/compositions/error-view.d.ts +21 -0
  14. package/dist/components/compositions/granted-panel.d.ts +14 -0
  15. package/dist/components/compositions/index.d.ts +14 -0
  16. package/dist/components/compositions/journey-gate.d.ts +27 -0
  17. package/dist/components/compositions/outcome-panel.d.ts +12 -0
  18. package/dist/components/internal/appointment-day-tabs.d.ts +18 -0
  19. package/dist/components/internal/appointment-module.d.ts +27 -0
  20. package/dist/components/internal/appointment-slot-grid.d.ts +9 -0
  21. package/dist/components/internal/appointment-slot-item.d.ts +9 -0
  22. package/dist/components/internal/auction-module.d.ts +32 -0
  23. package/dist/components/internal/draw-module.d.ts +27 -0
  24. package/dist/components/internal/index.d.ts +15 -0
  25. package/dist/components/internal/loading-view.d.ts +9 -0
  26. package/dist/components/internal/queue-module.d.ts +28 -0
  27. package/dist/components/internal/start-view.d.ts +19 -0
  28. package/dist/components/internal/timed-release-module.d.ts +28 -0
  29. package/dist/components/internal/upcoming-module.d.ts +15 -0
  30. package/dist/components/internal/waitlist-view.d.ts +14 -0
  31. package/dist/components/module/alert-panel.d.ts +17 -0
  32. package/dist/components/module/index.d.ts +5 -0
  33. package/dist/components/module/info-panel.d.ts +8 -0
  34. package/dist/components/module/outcome-reason.d.ts +27 -0
  35. package/dist/components/module/panel-heading.d.ts +13 -0
  36. package/dist/components/module/panel-layout.d.ts +21 -0
  37. package/dist/components/primitives/badge.d.ts +17 -0
  38. package/dist/components/primitives/button.d.ts +16 -0
  39. package/dist/components/primitives/card.d.ts +49 -0
  40. package/dist/components/primitives/countdown.d.ts +16 -0
  41. package/dist/components/primitives/fade-presence.d.ts +11 -0
  42. package/dist/components/primitives/fanfare-logo.d.ts +8 -0
  43. package/dist/components/primitives/index.d.ts +11 -0
  44. package/dist/components/primitives/input.d.ts +18 -0
  45. package/dist/components/primitives/progress.d.ts +11 -0
  46. package/dist/components/primitives/skeleton.d.ts +8 -0
  47. package/dist/components/primitives/spinner.d.ts +14 -0
  48. package/dist/components/primitives/transition.d.ts +13 -0
  49. package/dist/components/provider.d.ts +27 -0
  50. package/dist/components/web/fanfare-web-component-provider.d.ts +20 -0
  51. package/dist/components/web/web-component-styles.d.ts +4 -0
  52. package/dist/components/widgets/auction/auction-actions.d.ts +21 -0
  53. package/dist/components/widgets/auction/auction-bid-display.d.ts +19 -0
  54. package/dist/components/widgets/auction/index.d.ts +7 -0
  55. package/dist/components/widgets/draw/draw-actions.d.ts +22 -0
  56. package/dist/components/widgets/draw/index.d.ts +6 -0
  57. package/dist/components/widgets/experience-widget.d.ts +127 -0
  58. package/dist/components/widgets/index.d.ts +11 -0
  59. package/dist/components/widgets/queue/index.d.ts +6 -0
  60. package/dist/components/widgets/queue/queue-actions.d.ts +20 -0
  61. package/dist/components/widgets/timed-release/index.d.ts +6 -0
  62. package/dist/components/widgets/timed-release/timed-release-actions.d.ts +21 -0
  63. package/dist/components/widgets/waitlist/index.d.ts +6 -0
  64. package/dist/components/widgets/waitlist/waitlist-actions.d.ts +22 -0
  65. package/dist/hooks/index.d.ts +12 -0
  66. package/dist/hooks/use-auth.d.ts +11 -0
  67. package/dist/hooks/use-experience-journey.d.ts +17 -0
  68. package/dist/hooks/use-journey-snapshot.d.ts +8 -0
  69. package/dist/hooks/use-nanostore.d.ts +7 -0
  70. package/dist/i18n/i18n-context.d.ts +19 -0
  71. package/dist/i18n/i18n-provider.d.ts +16 -0
  72. package/dist/i18n/index.d.ts +12 -0
  73. package/dist/index.d.ts +18 -0
  74. package/dist/index.js +6370 -0
  75. package/dist/internal-sdk.d.ts +2 -0
  76. package/dist/lib/animations.d.ts +31 -0
  77. package/dist/lib/appointment-format.d.ts +26 -0
  78. package/dist/lib/confetti.d.ts +3 -0
  79. package/dist/lib/currency.d.ts +9 -0
  80. package/dist/lib/phone-formatter-lite.d.ts +4 -0
  81. package/dist/lib/use-grant-celebration.d.ts +2 -0
  82. package/dist/lib/utils.d.ts +13 -0
  83. package/dist/register.d.ts +52 -0
  84. package/dist/styles/base.css +2301 -0
  85. package/dist/styles/index.d.ts +2 -0
  86. package/dist/styles/theme.css +82 -0
  87. package/dist/theme/index.d.ts +8 -0
  88. package/dist/theme/theme-context.d.ts +10 -0
  89. package/dist/theme/theme-provider.d.ts +15 -0
  90. package/dist/theme/theme-utils.d.ts +6 -0
  91. package/dist/theme/theme.types.d.ts +47 -0
  92. package/dist/theme/use-theme.d.ts +8 -0
  93. package/dist/utils/solid.d.ts +1 -0
  94. package/dist/utils/to-accessor.d.ts +3 -0
  95. package/docs/SLOTS.md +91 -0
  96. package/package.json +128 -0
@@ -0,0 +1,2 @@
1
+ import { FanfareSDK } from '@fanfare-io/fanfare-sdk-core';
2
+ export type AdapterRuntimeSDK = FanfareSDK;
@@ -0,0 +1,31 @@
1
+ import { WidgetVariant } from '@fanfare-io/fanfare-sdk-core/theme';
2
+ export type AnimationConfig = {
3
+ duration?: number;
4
+ delay?: number;
5
+ easing?: string;
6
+ respectMotionPreference?: boolean;
7
+ };
8
+ export declare const defaultAnimationConfig: AnimationConfig;
9
+ export declare const prefersReducedMotion: () => boolean;
10
+ export declare const getAnimationDuration: (config?: AnimationConfig) => number;
11
+ export declare const getAnimationDelay: (config?: AnimationConfig) => number;
12
+ export declare const animationClasses: {
13
+ readonly fadeIn: "ff:animate-fade-in";
14
+ readonly fadeOut: "ff:animate-fade-out";
15
+ readonly slideIn: "ff:animate-slide-in";
16
+ readonly slideOut: "ff:animate-slide-out";
17
+ readonly scaleIn: "ff:animate-scale-in";
18
+ readonly scaleOut: "ff:animate-scale-out";
19
+ readonly accordionDown: "ff:animate-accordion-down";
20
+ readonly accordionUp: "ff:animate-accordion-up";
21
+ readonly celebration: "ff:animate-celebration";
22
+ readonly shake: "ff:animate-shake";
23
+ readonly pulseSuccess: "ff:animate-pulse-success";
24
+ };
25
+ export type AnimationType = keyof typeof animationClasses;
26
+ export declare const getAnimationClass: (animation: AnimationType, config?: AnimationConfig) => string;
27
+ export declare const getVariantEntranceAnimationClass: (variant: WidgetVariant, config?: AnimationConfig) => string;
28
+ export declare const createTransition: (properties?: string[], config?: AnimationConfig) => string;
29
+ export declare const withAnimation: <T extends Record<string, unknown>>(baseProps: T, animation: AnimationType, config?: AnimationConfig) => T & {
30
+ class?: string;
31
+ };
@@ -0,0 +1,26 @@
1
+ import { AppointmentSlot } from '@fanfare-io/fanfare-sdk-core/appointments';
2
+ /**
3
+ * Date / time formatting helpers shared across the appointment picker
4
+ * components. Every helper falls back to the input string when given an
5
+ * unparseable value or when `Intl.DateTimeFormat` throws on a bad `timeZone`
6
+ * (it raises `RangeError: Invalid time zone specified`), so a bad input can
7
+ * never crash the render.
8
+ */
9
+ export declare function formatTime(value: string, timezone?: string): string;
10
+ /** Format the start time of an appointment slot, falling back to its id string. */
11
+ export declare function formatSlotTime(slot: AppointmentSlot): string;
12
+ /**
13
+ * Return the YYYY-MM-DD calendar date of `date` as seen in `timezone`.
14
+ * Buckets slots by day and renders the day strip. `sv-SE` produces
15
+ * ISO-format output, so it doubles as a TZ-shifted date key.
16
+ */
17
+ export declare function isoDateInTimezone(date: Date, timezone?: string): string;
18
+ /** Add `days` calendar days to a YYYY-MM-DD date string. Calendar-day arithmetic only. */
19
+ export declare function addCalendarDays(isoDate: string, days: number): string;
20
+ /**
21
+ * Weekday label (e.g. "Mon") for a YYYY-MM-DD calendar date. Uses noon UTC so
22
+ * a TZ offset can't push the formatter to the wrong weekday.
23
+ */
24
+ export declare function weekdayLabel(isoDate: string): string;
25
+ /** Day-of-month from a YYYY-MM-DD calendar date. */
26
+ export declare function dayOfMonth(isoDate: string): number;
@@ -0,0 +1,3 @@
1
+ import { WidgetVariant } from '../theme';
2
+ export declare function triggerCelebration(variant: WidgetVariant): void;
3
+ export declare function triggerCelebrationFromElement(element: HTMLElement, variant: WidgetVariant): void;
@@ -0,0 +1,9 @@
1
+ export type CurrencyFormatOptions = {
2
+ currencyCode?: string;
3
+ currencySymbol?: string;
4
+ locale?: string;
5
+ minimumFractionDigits?: number;
6
+ maximumFractionDigits?: number;
7
+ };
8
+ export declare function getCurrencySymbol(currencyCode: string, locale?: string): string;
9
+ export declare function formatMoney(amount: number, options?: CurrencyFormatOptions): string;
@@ -0,0 +1,4 @@
1
+ export declare function extractPhoneInput(value: string): string;
2
+ export declare function formatPhoneAsYouType(value: string): string;
3
+ export declare function toE164(value: string): string | null;
4
+ export declare function validatePhone(value: string): boolean;
@@ -0,0 +1,2 @@
1
+ import { Accessor } from 'solid-js';
2
+ export declare function useGrantCelebration(element: Accessor<HTMLElement | undefined>): void;
@@ -0,0 +1,13 @@
1
+ import { ClassValue } from 'clsx';
2
+ export declare function cn(...inputs: ClassValue[]): string;
3
+ export declare function fanfareClass(...inputs: ClassValue[]): string;
4
+ export declare const extractAriaProps: (props: {
5
+ [key: string]: unknown;
6
+ }) => {
7
+ [key: string]: unknown;
8
+ };
9
+ export declare const extractDataProps: (props: {
10
+ [key: string]: unknown;
11
+ }) => {
12
+ [key: string]: unknown;
13
+ };
@@ -0,0 +1,52 @@
1
+ import { FanfareConfig } from '@fanfare-io/fanfare-sdk-core';
2
+ import { BrandTheme, WidgetVariant } from '@fanfare-io/fanfare-sdk-core/theme';
3
+ import { Locale, PartialTranslationMessages, TranslationMessageKey } from '@fanfare-io/fanfare-sdk-i18n';
4
+ export interface RegisterWebComponentsOptions {
5
+ /** Fanfare organization ID */
6
+ organizationId?: string;
7
+ /** Fanfare publishable key */
8
+ publishableKey?: string;
9
+ /** SDK environment */
10
+ environment?: FanfareConfig["environment"];
11
+ /** Custom API URL (overrides environment) */
12
+ apiUrl?: string;
13
+ /** Enable debug mode */
14
+ debug?: boolean;
15
+ /** Whether to auto-restore a session */
16
+ autoRestore?: boolean;
17
+ /** Whether to auto-resume after restore */
18
+ autoResume?: boolean;
19
+ /** Locale for translations */
20
+ locale?: Locale;
21
+ /** Custom translations */
22
+ translations?: PartialTranslationMessages<TranslationMessageKey>;
23
+ /** Theme configuration (overrides host CSS vars when provided) */
24
+ themeConfig?: BrandTheme | null;
25
+ /** Styling variant (default/retro/rounded/clean) */
26
+ variant?: WidgetVariant;
27
+ /** CSS class applied to the internal widget container */
28
+ containerClass?: string;
29
+ }
30
+ /**
31
+ * Register all widget web components.
32
+ *
33
+ * @example
34
+ * ```html
35
+ * <script type="module">
36
+ * import { registerWebComponents } from "@fanfare-io/fanfare-sdk-solid";
37
+ *
38
+ * registerWebComponents({ organizationId: "org_123", publishableKey: "pk_live_123" });
39
+ * </script>
40
+ *
41
+ * <fanfare-experience-widget
42
+ * experience-id="exp_123"
43
+ * container-class="my-fanfare-widget"
44
+ * debug
45
+ * auto-start
46
+ * ></fanfare-experience-widget>
47
+ * ```
48
+ *
49
+ * Note: defaults are applied at registration time and cannot be changed after the
50
+ * custom elements are defined.
51
+ */
52
+ export declare function registerWebComponents(options?: RegisterWebComponentsOptions): void;