@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.
- package/LICENSE +202 -0
- package/README.md +53 -0
- package/dist/components/auth/access-code-input.d.ts +17 -0
- package/dist/components/auth/auth-form.d.ts +34 -0
- package/dist/components/auth/auth-input.d.ts +19 -0
- package/dist/components/auth/email-input.d.ts +14 -0
- package/dist/components/auth/index.d.ts +6 -0
- package/dist/components/auth/otp-input.d.ts +21 -0
- package/dist/components/auth/phone-input.d.ts +14 -0
- package/dist/components/compositions/access-code-form.d.ts +25 -0
- package/dist/components/compositions/challenge-gate.d.ts +24 -0
- package/dist/components/compositions/ended-module.d.ts +13 -0
- package/dist/components/compositions/error-view.d.ts +21 -0
- package/dist/components/compositions/granted-panel.d.ts +14 -0
- package/dist/components/compositions/index.d.ts +14 -0
- package/dist/components/compositions/journey-gate.d.ts +27 -0
- package/dist/components/compositions/outcome-panel.d.ts +12 -0
- package/dist/components/internal/appointment-day-tabs.d.ts +18 -0
- package/dist/components/internal/appointment-module.d.ts +27 -0
- package/dist/components/internal/appointment-slot-grid.d.ts +9 -0
- package/dist/components/internal/appointment-slot-item.d.ts +9 -0
- package/dist/components/internal/auction-module.d.ts +32 -0
- package/dist/components/internal/draw-module.d.ts +27 -0
- package/dist/components/internal/index.d.ts +15 -0
- package/dist/components/internal/loading-view.d.ts +9 -0
- package/dist/components/internal/queue-module.d.ts +28 -0
- package/dist/components/internal/start-view.d.ts +19 -0
- package/dist/components/internal/timed-release-module.d.ts +28 -0
- package/dist/components/internal/upcoming-module.d.ts +15 -0
- package/dist/components/internal/waitlist-view.d.ts +14 -0
- package/dist/components/module/alert-panel.d.ts +17 -0
- package/dist/components/module/index.d.ts +5 -0
- package/dist/components/module/info-panel.d.ts +8 -0
- package/dist/components/module/outcome-reason.d.ts +27 -0
- package/dist/components/module/panel-heading.d.ts +13 -0
- package/dist/components/module/panel-layout.d.ts +21 -0
- package/dist/components/primitives/badge.d.ts +17 -0
- package/dist/components/primitives/button.d.ts +16 -0
- package/dist/components/primitives/card.d.ts +49 -0
- package/dist/components/primitives/countdown.d.ts +16 -0
- package/dist/components/primitives/fade-presence.d.ts +11 -0
- package/dist/components/primitives/fanfare-logo.d.ts +8 -0
- package/dist/components/primitives/index.d.ts +11 -0
- package/dist/components/primitives/input.d.ts +18 -0
- package/dist/components/primitives/progress.d.ts +11 -0
- package/dist/components/primitives/skeleton.d.ts +8 -0
- package/dist/components/primitives/spinner.d.ts +14 -0
- package/dist/components/primitives/transition.d.ts +13 -0
- package/dist/components/provider.d.ts +27 -0
- package/dist/components/web/fanfare-web-component-provider.d.ts +20 -0
- package/dist/components/web/web-component-styles.d.ts +4 -0
- package/dist/components/widgets/auction/auction-actions.d.ts +21 -0
- package/dist/components/widgets/auction/auction-bid-display.d.ts +19 -0
- package/dist/components/widgets/auction/index.d.ts +7 -0
- package/dist/components/widgets/draw/draw-actions.d.ts +22 -0
- package/dist/components/widgets/draw/index.d.ts +6 -0
- package/dist/components/widgets/experience-widget.d.ts +127 -0
- package/dist/components/widgets/index.d.ts +11 -0
- package/dist/components/widgets/queue/index.d.ts +6 -0
- package/dist/components/widgets/queue/queue-actions.d.ts +20 -0
- package/dist/components/widgets/timed-release/index.d.ts +6 -0
- package/dist/components/widgets/timed-release/timed-release-actions.d.ts +21 -0
- package/dist/components/widgets/waitlist/index.d.ts +6 -0
- package/dist/components/widgets/waitlist/waitlist-actions.d.ts +22 -0
- package/dist/hooks/index.d.ts +12 -0
- package/dist/hooks/use-auth.d.ts +11 -0
- package/dist/hooks/use-experience-journey.d.ts +17 -0
- package/dist/hooks/use-journey-snapshot.d.ts +8 -0
- package/dist/hooks/use-nanostore.d.ts +7 -0
- package/dist/i18n/i18n-context.d.ts +19 -0
- package/dist/i18n/i18n-provider.d.ts +16 -0
- package/dist/i18n/index.d.ts +12 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +6370 -0
- package/dist/internal-sdk.d.ts +2 -0
- package/dist/lib/animations.d.ts +31 -0
- package/dist/lib/appointment-format.d.ts +26 -0
- package/dist/lib/confetti.d.ts +3 -0
- package/dist/lib/currency.d.ts +9 -0
- package/dist/lib/phone-formatter-lite.d.ts +4 -0
- package/dist/lib/use-grant-celebration.d.ts +2 -0
- package/dist/lib/utils.d.ts +13 -0
- package/dist/register.d.ts +52 -0
- package/dist/styles/base.css +2301 -0
- package/dist/styles/index.d.ts +2 -0
- package/dist/styles/theme.css +82 -0
- package/dist/theme/index.d.ts +8 -0
- package/dist/theme/theme-context.d.ts +10 -0
- package/dist/theme/theme-provider.d.ts +15 -0
- package/dist/theme/theme-utils.d.ts +6 -0
- package/dist/theme/theme.types.d.ts +47 -0
- package/dist/theme/use-theme.d.ts +8 -0
- package/dist/utils/solid.d.ts +1 -0
- package/dist/utils/to-accessor.d.ts +3 -0
- package/docs/SLOTS.md +91 -0
- package/package.json +128 -0
|
@@ -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,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,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;
|