@srimandir/astro-consultation 2.37.4 → 2.37.5

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 (36) hide show
  1. package/dist/astro-consultation.js +2388 -1052
  2. package/dist/astro-consultation.js.map +1 -1
  3. package/dist/astro-consultation.umd.cjs +2 -2
  4. package/dist/astro-consultation.umd.cjs.map +1 -1
  5. package/dist/components/AstrologerCard/AstrologerCard.d.ts +5 -0
  6. package/dist/components/AstrologerCard/index.d.ts +2 -1
  7. package/dist/components/AstrologerCard/mapApiAstrologer.d.ts +6 -0
  8. package/dist/components/AstrologerCard/types.d.ts +36 -3
  9. package/dist/components/ConsultationAstrologerListPage/ConsultationAstrologerListPage.d.ts +3 -0
  10. package/dist/components/ConsultationAstrologerListPage/filterAstrologers.d.ts +8 -0
  11. package/dist/components/ConsultationAstrologerListPage/index.d.ts +3 -0
  12. package/dist/components/ConsultationAstrologerListPage/types.d.ts +69 -0
  13. package/dist/components/ConsultationAstrologerSummaryCard/ConsultationAstrologerSummaryCard.d.ts +43 -0
  14. package/dist/components/ConsultationAstrologerSummaryCard/index.d.ts +1 -0
  15. package/dist/components/ConsultationLanding/ConsultationHero.d.ts +6 -4
  16. package/dist/components/ConsultationLanding/LandingSections.d.ts +4 -4
  17. package/dist/components/ConsultationLandingV2/ConsultationHeroV2.d.ts +6 -4
  18. package/dist/components/ConsultationPaymentPage/ConsultationPaymentPage.d.ts +3 -0
  19. package/dist/components/ConsultationPaymentPage/index.d.ts +2 -0
  20. package/dist/components/ConsultationPaymentPage/types.d.ts +106 -0
  21. package/dist/components/ConsultationPriceDetails/ConsultationPriceDetails.d.ts +19 -0
  22. package/dist/components/ConsultationPriceDetails/index.d.ts +1 -0
  23. package/dist/components/ConsultationSlotPage/ConsultationSlotPage.d.ts +3 -0
  24. package/dist/components/ConsultationSlotPage/index.d.ts +2 -0
  25. package/dist/components/ConsultationSlotPage/types.d.ts +138 -0
  26. package/dist/components/EmailField/EmailField.d.ts +17 -0
  27. package/dist/components/EmailField/index.d.ts +2 -0
  28. package/dist/components/EmailField/useEmailAddress.d.ts +28 -0
  29. package/dist/components/LandingShared/PageHeader.d.ts +10 -0
  30. package/dist/components/LandingShared/icons.d.ts +17 -0
  31. package/dist/components/WhatsAppNumberField/WhatsAppNumberField.d.ts +48 -0
  32. package/dist/components/WhatsAppNumberField/index.d.ts +2 -0
  33. package/dist/components/WhatsAppNumberField/useWhatsAppNumber.d.ts +34 -0
  34. package/dist/index.d.ts +17 -3
  35. package/dist/style.css +1 -1
  36. package/package.json +4 -4
@@ -23,5 +23,10 @@ export interface AstrologerCardProps {
23
23
  className?: string;
24
24
  /** Forwarded to the outermost element so hosts can attach impression observers. */
25
25
  innerRef?: React.Ref<HTMLDivElement>;
26
+ /**
27
+ * `default` — the landing page's card. `list` — the full astrologer listing:
28
+ * 16px name and, for `isRecommended`, the featured layout with its ribbon.
29
+ */
30
+ variant?: "default" | "list";
26
31
  }
27
32
  export declare const AstrologerCard: React.FC<AstrologerCardProps>;
@@ -1,2 +1,3 @@
1
1
  export { AstrologerCard, type AstrologerCardProps, type AstrologerCardIcons, } from './AstrologerCard';
2
- export type { AstrologerCardAstrologer } from './types';
2
+ export type { AstrologerCardAstrologer, ConsultationApiAstrologer, } from './types';
3
+ export { toAstrologerCardAstrologer } from './mapApiAstrologer';
@@ -0,0 +1,6 @@
1
+ import { AstrologerCardAstrologer, ConsultationApiAstrologer } from './types';
2
+ /**
3
+ * API row → card fields, so every host maps the response the same way.
4
+ * `null`s become `undefined`, which the card treats as "hide this part".
5
+ */
6
+ export declare const toAstrologerCardAstrologer: (astrologer: ConsultationApiAstrologer) => AstrologerCardAstrologer;
@@ -1,8 +1,9 @@
1
1
  /** Shared types for the astrologer listing card. */
2
2
  /**
3
3
  * The astrologer fields this card renders — the host's available-astrologers
4
- * response, mapped. Every optional field has a defined fallback in the card,
5
- * so it renders correctly against the API as it stands today.
4
+ * response, mapped (see `toAstrologerCardAstrologer`). Every optional field has
5
+ * a defined fallback in the card, so it renders correctly against the API as
6
+ * it stands today.
6
7
  */
7
8
  export interface AstrologerCardAstrologer {
8
9
  /** API: `astrologer_id`. */
@@ -21,6 +22,38 @@ export interface AstrologerCardAstrologer {
21
22
  rating?: number;
22
23
  /** API: `consultation_count`. Falls back to hiding the count when 0/undefined. */
23
24
  consultationCount?: number;
24
- /** API: `is_recommended` — the V2 card shows it as a "Most Popular" ribbon. */
25
+ /**
26
+ * API: `is_recommended`. The `list` variant shows it as a "Most Popular"
27
+ * ribbon with the featured layout; the V2 card shows the ribbon too.
28
+ */
25
29
  isRecommended?: boolean;
30
+ /**
31
+ * API: `nearest_slot` — Unix seconds of the next bookable slot. No longer
32
+ * shown on the card (the footer shows only the consultation count); kept so
33
+ * hosts mapping it keep compiling.
34
+ */
35
+ nextAvailableAt?: number | null;
36
+ /**
37
+ * Green presence dot on the photo. No API field carries this yet; hosts
38
+ * that can derive it (e.g. a slot starting within minutes) set it.
39
+ */
40
+ isOnline?: boolean;
41
+ }
42
+ /**
43
+ * One astrologer as rishi's `/kundli/astrologers/available` returns it — the
44
+ * fields this package reads. Structural, so the host's own `Astrologer` type
45
+ * (with `available_slots` etc.) passes in as-is.
46
+ */
47
+ export interface ConsultationApiAstrologer {
48
+ astrologer_id: string;
49
+ name: string;
50
+ photo_url?: string | null;
51
+ languages?: string[] | null;
52
+ specialties?: string[] | null;
53
+ experience_years?: number | null;
54
+ rating?: number | null;
55
+ consultation_count?: number | null;
56
+ /** Unix seconds. */
57
+ nearest_slot?: number | null;
58
+ is_recommended?: boolean | null;
26
59
  }
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { ConsultationAstrologerListPageProps } from './types';
3
+ export declare const ConsultationAstrologerListPage: React.FC<ConsultationAstrologerListPageProps>;
@@ -0,0 +1,8 @@
1
+ import { AstrologerCardAstrologer } from '../AstrologerCard';
2
+ import { ConsultationLanguageChip } from './types';
3
+ /**
4
+ * Astrologers who speak any of the selected languages. A chip matches an
5
+ * astrologer's `languages` entry by `code`, `label` or any of its `aliases`,
6
+ * case-insensitively. No selection keeps everyone.
7
+ */
8
+ export declare const filterAstrologersByLanguages: (astrologers: AstrologerCardAstrologer[], languages: ConsultationLanguageChip[], selectedCodes: string[]) => AstrologerCardAstrologer[];
@@ -0,0 +1,3 @@
1
+ export { ConsultationAstrologerListPage } from './ConsultationAstrologerListPage';
2
+ export { filterAstrologersByLanguages } from './filterAstrologers';
3
+ export type { ConsultationAstrologerListPageProps, ConsultationLanguageChip, ConsultationAstrologerSelectContext, AstrologerCardClickAt, } from './types';
@@ -0,0 +1,69 @@
1
+ import { AstrologerCardAstrologer, AstrologerCardIcons } from '../AstrologerCard';
2
+ import { ConsultationTranslate } from '../../i18n';
3
+ /** One language chip. */
4
+ export interface ConsultationLanguageChip {
5
+ /** e.g. "hi". What `selectedLanguages` / `onLanguagesChange` carry. */
6
+ code: string;
7
+ /** Chip text, e.g. "Hindi" or "हिंदी". */
8
+ label: string;
9
+ /**
10
+ * Other spellings the API uses in `astrologer.languages`, for the built-in
11
+ * filter, e.g. `['Hindi']` when `label` is "हिंदी". `code` and `label` are
12
+ * always matched (case-insensitively) as well.
13
+ */
14
+ aliases?: string[];
15
+ }
16
+ /** Where on the card the tap landed — hosts log it as `click_at`. */
17
+ export type AstrologerCardClickAt = 'card' | 'cta';
18
+ export interface ConsultationAstrologerSelectContext {
19
+ /** 1-based position in the rendered list. */
20
+ position: number;
21
+ clickAt: AstrologerCardClickAt;
22
+ }
23
+ export interface ConsultationAstrologerListPageProps {
24
+ /** Header back button. Omit to render the header without one. */
25
+ onBack?: () => void;
26
+ /** Hides the sticky header, for hosts whose own app bar already titles the page. */
27
+ hideHeader?: boolean;
28
+ /** Wins over `t("consultationChooseAstrologerTitle")`. */
29
+ title?: string;
30
+ /** API astrologers, mapped with `toAstrologerCardAstrologer`. Rendered in this order. */
31
+ astrologers: AstrologerCardAstrologer[];
32
+ /** The card's host-supplied icons (CDN URLs). */
33
+ icons: AstrologerCardIcons;
34
+ loading?: boolean;
35
+ /** Renders the error state (with Retry when `onRetry` is given). */
36
+ error?: boolean;
37
+ onRetry?: () => void;
38
+ /** Chips above the list. Omit or pass `[]` to hide the row. */
39
+ languages?: ConsultationLanguageChip[];
40
+ /**
41
+ * Selected chip codes — multi-select; `[]` means no filter. Controlled
42
+ * when passed, otherwise the page keeps its own state.
43
+ */
44
+ selectedLanguages?: string[];
45
+ /** Initial selection when uncontrolled. */
46
+ defaultSelectedLanguages?: string[];
47
+ onLanguagesChange?: (codes: string[]) => void;
48
+ /**
49
+ * Filters `astrologers` by the selected chips against each astrologer's
50
+ * `languages` (any match). Turn off when the host already fetched the
51
+ * filtered list.
52
+ */
53
+ filterByLanguage?: boolean;
54
+ /** How many lead the list under "Top Astrologers for you"; the rest go under "Explore other astrologers". */
55
+ topCount?: number;
56
+ /** Wins over `t("consultationTopAstrologers")`. */
57
+ topTitle?: string;
58
+ /** Wins over `t("consultationExploreOtherAstrologers")`. */
59
+ othersTitle?: string;
60
+ /** Card body or "Choose slots" tapped. */
61
+ onSelectAstrologer?: (astrologer: AstrologerCardAstrologer, context: ConsultationAstrologerSelectContext) => void;
62
+ /** Fires once per astrologer when half its card is first on screen. */
63
+ onAstrologerImpression?: (astrologer: AstrologerCardAstrologer, position: number) => void;
64
+ /** Greys out every "Choose slots", e.g. while a booking is already in flight. */
65
+ disabled?: boolean;
66
+ /** Translation lookup; every string falls back to the English default. */
67
+ t?: ConsultationTranslate;
68
+ className?: string;
69
+ }
@@ -0,0 +1,43 @@
1
+ import { default as React } from 'react';
2
+ import { ConsultationTranslate } from '../../i18n';
3
+ /** The astrologer, as mapped from the API. Field names match `AstrologerCardAstrologer`. */
4
+ export interface ConsultationAstrologerSummary {
5
+ /** API: `astrologer_id`. */
6
+ id?: string;
7
+ /** API: `name`. */
8
+ name: string;
9
+ /** API: `photo_url`. Falls back to the initial-letter avatar when empty. */
10
+ photoUrl?: string;
11
+ /** One-line headline under the name. Wins over `specialties` / `experienceYears`. */
12
+ designation?: string | null;
13
+ /** API: `specialties` — comma-joined when there's no `designation`. */
14
+ specialties?: string[] | null;
15
+ /** API: `experience_years` — "{n}+ years of experience" when neither of the above is set. */
16
+ experienceYears?: number;
17
+ /** API: `languages`. Not rendered here; accepted so card objects pass through. */
18
+ languages?: string[];
19
+ /** API: `rating`. Not rendered here; accepted so card objects pass through. */
20
+ rating?: number;
21
+ /** Green presence dot on the photo (host-derived; no API field). */
22
+ isOnline?: boolean;
23
+ }
24
+ /** Built-in detail icons; any node works too. */
25
+ export type ConsultationSummaryDetailIcon = 'calendar' | 'clock' | 'duration' | React.ReactNode;
26
+ export interface ConsultationAstrologerSummaryDetail {
27
+ /** React key. */
28
+ id: string;
29
+ label: string;
30
+ icon?: ConsultationSummaryDetailIcon;
31
+ }
32
+ export interface ConsultationAstrologerSummaryCardProps {
33
+ astrologer: ConsultationAstrologerSummary;
34
+ /** Shown under the dashed rule, separated by dots. Omit or `[]` to drop the rule and row. */
35
+ details?: ConsultationAstrologerSummaryDetail[];
36
+ /** `default` — slot page. `highlight` — payment page: saffron border, wider spacing. */
37
+ tone?: 'default' | 'highlight';
38
+ t?: ConsultationTranslate;
39
+ className?: string;
40
+ }
41
+ /** Designation, else specialties, else experience — whichever the API filled in. */
42
+ export declare const astrologerHeadline: (astrologer: ConsultationAstrologerSummary, t?: ConsultationTranslate) => string | null;
43
+ export declare const ConsultationAstrologerSummaryCard: React.FC<ConsultationAstrologerSummaryCardProps>;
@@ -0,0 +1 @@
1
+ export { ConsultationAstrologerSummaryCard, astrologerHeadline, type ConsultationAstrologerSummaryCardProps, type ConsultationAstrologerSummary, type ConsultationAstrologerSummaryDetail, type ConsultationSummaryDetailIcon, } from './ConsultationAstrologerSummaryCard';
@@ -4,11 +4,13 @@ import { ConsultationHeroCard } from '../LandingShared/types';
4
4
  import { ConsultationLandingAssets } from './types';
5
5
  export interface ConsultationHeroProps {
6
6
  /**
7
- * Exactly three: the stack's motion is a three-card cycle. Order is
8
- * centre, left, right at the start of the loop. `null` while the host is
9
- * still loading them — the stack keeps its space, empty.
7
+ * Three to eight. The stack's motion is a five-spot conveyor (off left,
8
+ * left, centre, right, off right); past five, the extras wait hidden in
9
+ * the wrap. Order is centre, left, right, off right, off left, then the
10
+ * hidden ones at the start of the loop. Past eight are dropped. `null`
11
+ * while the host is still loading them — the stack keeps its space, empty.
10
12
  */
11
- cards: [ConsultationHeroCard, ConsultationHeroCard, ConsultationHeroCard] | null;
13
+ cards: ConsultationHeroCard[] | null;
12
14
  assets: ConsultationLandingAssets;
13
15
  t?: ConsultationTranslate;
14
16
  className?: string;
@@ -10,18 +10,18 @@ interface WithAssets {
10
10
  assets: ConsultationLandingAssets;
11
11
  }
12
12
  export declare const BenefitsStrip: React.FC<SectionProps & WithAssets>;
13
- export type ConsultationConcern = 'career' | 'love' | 'finance' | 'health';
13
+ export type ConsultationConcern = "career" | "love" | "finance" | "health";
14
14
  export declare const GuidanceSection: React.FC<SectionProps & WithAssets & {
15
15
  /** Tap on a problem-area tile. Omit and the tiles render as plain cards. */
16
16
  onConcernSelect?: (concern: ConsultationConcern) => void;
17
17
  }>;
18
18
  export declare const TestimonialsSection: React.FC<SectionProps & {
19
- assets: Pick<ConsultationLandingAssets, 'reviewStar'>;
19
+ assets: Pick<ConsultationLandingAssets, "reviewStar">;
20
20
  testimonials: ConsultationTestimonial[];
21
21
  }>;
22
22
  export declare const JourneySection: React.FC<SectionProps>;
23
23
  export interface AstrologerSectionProps extends SectionProps {
24
- assets: Pick<ConsultationLandingAssets, 'bookedAvatars' | 'viewAllChevron'>;
24
+ assets: Pick<ConsultationLandingAssets, "bookedAvatars" | "viewAllChevron">;
25
25
  /** The cards, plus whatever loading/empty/error state the host renders. */
26
26
  children: React.ReactNode;
27
27
  /** Omit to hide "View all astrologers", e.g. once everything is shown. */
@@ -32,7 +32,7 @@ export interface AstrologerSectionProps extends SectionProps {
32
32
  export declare const AstrologerSection: React.FC<AstrologerSectionProps>;
33
33
  /** Native `<details>`: open/close, keyboard and a11y without any state. */
34
34
  export declare const ConsultationFaq: React.FC<SectionProps & {
35
- assets: Pick<ConsultationLandingAssets, 'faqArrow'>;
35
+ assets: Pick<ConsultationLandingAssets, "faqArrow">;
36
36
  }>;
37
37
  export declare const ConsultationStickyCta: React.FC<SectionProps & WithAssets & {
38
38
  onClick: () => void;
@@ -4,11 +4,13 @@ import { ConsultationHeroCard } from '../LandingShared/types';
4
4
  import { ConsultationLandingAssetsV2 } from './types';
5
5
  export interface ConsultationHeroV2Props {
6
6
  /**
7
- * Exactly three: the carousel's motion is a three-card cycle. Order is
8
- * centre, far left, far right at the start of the loop. `null` while the
9
- * host is still loading them — the carousel keeps its space, empty.
7
+ * Three to eight. Three are in view at a time; the rest wait hidden behind
8
+ * the centre card for their turn. Order is centre, far left, then the
9
+ * hidden ones, and far right last at the start of the loop. Past eight are
10
+ * dropped. `null` while the host is still loading them — the carousel
11
+ * keeps its space, empty.
10
12
  */
11
- cards: [ConsultationHeroCard, ConsultationHeroCard, ConsultationHeroCard] | null;
13
+ cards: ConsultationHeroCard[] | null;
12
14
  assets: ConsultationLandingAssetsV2;
13
15
  t?: ConsultationTranslate;
14
16
  className?: string;
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { ConsultationPaymentPageProps } from './types';
3
+ export declare const ConsultationPaymentPage: React.FC<ConsultationPaymentPageProps>;
@@ -0,0 +1,2 @@
1
+ export { ConsultationPaymentPage } from './ConsultationPaymentPage';
2
+ export type { ConsultationPaymentPageProps, ConsultationPaymentSlot, ConsultationPaymentPrice, ConsultationPaymentSubmission, } from './types';
@@ -0,0 +1,106 @@
1
+ import { default as React } from 'react';
2
+ import { WhatsAppCountryOption } from '../WhatsAppNumberField';
3
+ import { ConsultationTranslate } from '../../i18n';
4
+ import { ConsultationAstrologerSummary } from '../ConsultationAstrologerSummaryCard';
5
+ /** The chosen slot. A `ConsultationSlot` from the slot page fits as-is. */
6
+ export interface ConsultationPaymentSlot {
7
+ /** ISO datetime with offset, e.g. "2026-10-26T15:00:00+05:30". */
8
+ start: string;
9
+ /** ISO datetime with offset. Used for the duration when `durationMinutes` is omitted. */
10
+ end?: string;
11
+ }
12
+ /** The catalog's numbers for this consultation. */
13
+ export interface ConsultationPaymentPrice {
14
+ /** Price before discount (MRP). */
15
+ totalPrice: number;
16
+ /** What the user pays (sell rate). */
17
+ amount: number;
18
+ /** Defaults to `totalPrice - amount`. */
19
+ discount?: number;
20
+ /** Defaults to "₹". */
21
+ currencySymbol?: string;
22
+ /** Wins over the default `₹1,234` formatting. */
23
+ formatAmount?: (value: number) => string;
24
+ }
25
+ /** Everything the host needs to place the order, handed to `onProceed`. */
26
+ export interface ConsultationPaymentSubmission {
27
+ /** `astrologer.id`, when the host supplied one. */
28
+ astrologerId?: string;
29
+ slot: ConsultationPaymentSlot;
30
+ /** Digits only, without the country code. Empty when hidden or in email mode. */
31
+ phoneNumber: string;
32
+ /** e.g. "+91". */
33
+ countryCode: string;
34
+ /** Email and both modes; empty otherwise. */
35
+ email: string;
36
+ }
37
+ export interface ConsultationPaymentPageProps {
38
+ /** Header back button. Omit to render the header without one. */
39
+ onBack?: () => void;
40
+ hideHeader?: boolean;
41
+ /** Wins over `t("consultationPaymentTitle")`. */
42
+ title?: string;
43
+ astrologer: ConsultationAstrologerSummary;
44
+ slot: ConsultationPaymentSlot;
45
+ /** Defaults to the slot's `end - start`; `null` hides the duration. */
46
+ durationMinutes?: number | null;
47
+ /** Locale for the date and time, e.g. "hi-IN". Defaults to "en-IN". */
48
+ dateLocale?: string;
49
+ /** Omit (e.g. while the catalog loads) to hide the price section. */
50
+ price?: ConsultationPaymentPrice | null;
51
+ /**
52
+ * How the user is reached: `whatsapp` (default) — the number block below —
53
+ * `email`, which shows an email field in its place, or `both`: the email
54
+ * field and the number block, each required (e.g. global users).
55
+ */
56
+ contactType?: 'whatsapp' | 'email' | 'both';
57
+ /** Email mode: controlled value. Omit to let the page manage it. */
58
+ email?: string;
59
+ /** Email mode: initial value when uncontrolled, e.g. the account's email. */
60
+ defaultEmail?: string;
61
+ onEmailChange?: (value: string) => void;
62
+ /** Email mode: host-side error. Wins over the built-in format check. */
63
+ emailError?: string | null;
64
+ /** The number field took focus (e.g. analytics). Built-in field only. */
65
+ onPhoneNumberFocus?: () => void;
66
+ /** Email mode: the field took focus. */
67
+ onEmailFocus?: () => void;
68
+ /** Email mode: the field lost focus, with what it holds and whether that is valid. */
69
+ onEmailBlur?: (email: string, isValid: boolean) => void;
70
+ /** Hides the whole contact block, e.g. when it was collected earlier. */
71
+ hidePhoneNumberSection?: boolean;
72
+ /** Controlled value, digits only. Omit to let the page manage it. */
73
+ phoneNumber?: string;
74
+ /** Initial value when uncontrolled, e.g. the user's number from their profile. */
75
+ defaultPhoneNumber?: string;
76
+ onPhoneNumberChange?: (value: string) => void;
77
+ /** Digits allowed, and required unless `phoneNumberMinLength` says fewer. Defaults to 10 (India). */
78
+ phoneNumberLength?: number;
79
+ /** Fewest digits for a valid number, for countries whose numbers vary. Defaults to `phoneNumberLength`. */
80
+ phoneNumberMinLength?: number;
81
+ /** Defaults to "+91". */
82
+ countryCode?: string;
83
+ /** Defaults to the Indian flag. */
84
+ countryFlag?: string;
85
+ onCountryCodeClick?: () => void;
86
+ /** Makes the country box a picker over these (see `WhatsAppNumberField`). */
87
+ countryOptions?: WhatsAppCountryOption[];
88
+ selectedCountryId?: string;
89
+ /** Update `countryCode`, `countryFlag` and the length props from here. */
90
+ onCountryChange?: (country: WhatsAppCountryOption) => void;
91
+ /** Host-side error. Wins over the built-in length check. */
92
+ phoneNumberError?: string | null;
93
+ /** Host-owned input row (it then owns validation); label and helper stay. */
94
+ phoneNumberSection?: React.ReactNode;
95
+ /** Wins over `t("consultationProceedToPayment")`. */
96
+ ctaLabel?: string;
97
+ /** Fires only with a valid number (when the built-in input is shown). */
98
+ onProceed?: (submission: ConsultationPaymentSubmission) => void;
99
+ ctaDisabled?: boolean;
100
+ /** Busy label + disabled while the order is being placed. */
101
+ isProcessing?: boolean;
102
+ /** Floats above the CTA, e.g. a failed order. */
103
+ errorMessage?: string | null;
104
+ t?: ConsultationTranslate;
105
+ className?: string;
106
+ }
@@ -0,0 +1,19 @@
1
+ import { default as React } from 'react';
2
+ import { ConsultationTranslate } from '../../i18n';
3
+ export interface ConsultationPriceDetailsProps {
4
+ /** Price before discount — the catalog's MRP. */
5
+ totalPrice: number;
6
+ /** What the user pays — the catalog's sell rate. */
7
+ amount: number;
8
+ /** Defaults to `totalPrice - amount`. The row and banner hide when it is 0. */
9
+ discount?: number;
10
+ /** Prefix for the default formatter. Defaults to "₹". */
11
+ currencySymbol?: string;
12
+ /** Wins over the default `₹1,234` formatting, e.g. for decimals in USD. */
13
+ formatAmount?: (value: number) => string;
14
+ /** Section heading. Wins over `t("consultationPriceDetails")`; `null` hides it. */
15
+ title?: string | null;
16
+ t?: ConsultationTranslate;
17
+ className?: string;
18
+ }
19
+ export declare const ConsultationPriceDetails: React.FC<ConsultationPriceDetailsProps>;
@@ -0,0 +1 @@
1
+ export { ConsultationPriceDetails, type ConsultationPriceDetailsProps, } from './ConsultationPriceDetails';
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ import { ConsultationSlotPageProps } from './types';
3
+ export declare const ConsultationSlotPage: React.FC<ConsultationSlotPageProps>;
@@ -0,0 +1,2 @@
1
+ export { ConsultationSlotPage } from './ConsultationSlotPage';
2
+ export type { ConsultationSlotPageProps, ConsultationSlotPageAstrologer, ConsultationSlotPageSocialProof, ConsultationSlotBookingSelection, } from './types';
@@ -0,0 +1,138 @@
1
+ import { default as React } from 'react';
2
+ import { WhatsAppCountryOption } from '../WhatsAppNumberField';
3
+ import { ConsultationSlot, ConsultationSlotDay, ConsultationSlotPeriod } from '../../../../astrology-common/dist/index.js';
4
+ import { ConsultationTranslate } from '../../i18n';
5
+ import { ConsultationAstrologerSummary } from '../ConsultationAstrologerSummaryCard';
6
+ /**
7
+ * The astrologer being booked, as mapped from the API — the shared summary
8
+ * card's type. Field names match `AstrologerCardAstrologer`, so hosts pass the
9
+ * card's astrologer straight through.
10
+ */
11
+ export type ConsultationSlotPageAstrologer = ConsultationAstrologerSummary;
12
+ /** Everything the host needs to create the booking, handed to `onCtaClick`. */
13
+ export interface ConsultationSlotBookingSelection {
14
+ /** `astrologer.id`, when the host supplied one. */
15
+ astrologerId?: string;
16
+ /** ISO "yyyy-MM-dd". */
17
+ date: string;
18
+ period: ConsultationSlotPeriod;
19
+ /** The chosen slot, exactly as it came in `days` (ISO `start` / `end`). */
20
+ slot: ConsultationSlot;
21
+ /** Digits only, without the country code. Empty when hidden or in email mode. */
22
+ phoneNumber: string;
23
+ /** e.g. "+91". */
24
+ countryCode: string;
25
+ /** Email and both modes; empty otherwise. */
26
+ email: string;
27
+ }
28
+ /** The pill above the CTA. Static marketing content, not API data. */
29
+ export interface ConsultationSlotPageSocialProof {
30
+ /** The overlapping faces, as one pre-composited image. Defaults to the bundled CDN artwork. */
31
+ imageUrl?: string;
32
+ /** Wins over `t("consultationSlotPageSocialProof")`. */
33
+ label?: string;
34
+ }
35
+ export interface ConsultationSlotPageProps {
36
+ /** Header back button. Omit to render the header without one. */
37
+ onBack?: () => void;
38
+ /** Hides the sticky header, for hosts whose own app bar already titles the page. */
39
+ hideHeader?: boolean;
40
+ /** Header title. Wins over `t("consultationSlotPageTitle")`. */
41
+ title?: string;
42
+ /** Omit and the summary card is not rendered. */
43
+ astrologer?: ConsultationSlotPageAstrologer | null;
44
+ /**
45
+ * Shown as "{n}-minute consultation". Defaults to the selected slot's
46
+ * `end - start`; pass `null` to hide the line.
47
+ */
48
+ durationMinutes?: number | null;
49
+ /** API availability. Only days with `has_availability` and slots are shown. */
50
+ days: ConsultationSlotDay[];
51
+ loading?: boolean;
52
+ error?: boolean;
53
+ onRetry?: () => void;
54
+ /** Heading above the date strip. Wins over `t("consultationSelectDateTime")`. */
55
+ heading?: string;
56
+ /** International build — labels the evening tab "Evening/Night". */
57
+ isGlobal?: boolean;
58
+ /**
59
+ * Selection is controlled-optional: pass a value to drive it, or omit it and
60
+ * the page keeps its own state. Either way the page falls back to the first
61
+ * available day, its first period, and that period's first bookable slot.
62
+ */
63
+ selectedDate?: string;
64
+ onDateSelect?: (date: string) => void;
65
+ selectedPeriod?: ConsultationSlotPeriod;
66
+ onPeriodSelect?: (period: ConsultationSlotPeriod) => void;
67
+ /** `null` = explicitly nothing selected (no fallback). */
68
+ selectedSlotStart?: string | null;
69
+ onSlotSelect?: (slot: ConsultationSlot) => void;
70
+ /**
71
+ * How the user is reached: `whatsapp` (default) — the number block below —
72
+ * `email`, which shows an email field in its place, or `both`: the email
73
+ * field and the number block, each required (e.g. global users).
74
+ */
75
+ contactType?: 'whatsapp' | 'email' | 'both';
76
+ /** Email mode: controlled value. Omit to let the page manage it. */
77
+ email?: string;
78
+ /** Email mode: initial value when uncontrolled, e.g. the account's email. */
79
+ defaultEmail?: string;
80
+ onEmailChange?: (value: string) => void;
81
+ /** Email mode: host-side error. Wins over the built-in format check. */
82
+ emailError?: string | null;
83
+ /** The number field took focus (e.g. analytics). Built-in field only. */
84
+ onPhoneNumberFocus?: () => void;
85
+ /** Email mode: the field took focus. */
86
+ onEmailFocus?: () => void;
87
+ /** Email mode: the field lost focus, with what it holds and whether that is valid. */
88
+ onEmailBlur?: (email: string, isValid: boolean) => void;
89
+ /** Hides the whole contact block, e.g. when it is already known. */
90
+ hidePhoneNumberSection?: boolean;
91
+ /** Controlled value, digits only. Omit to let the page manage it. */
92
+ phoneNumber?: string;
93
+ /** Initial value when uncontrolled, e.g. the user's number from their profile. */
94
+ defaultPhoneNumber?: string;
95
+ onPhoneNumberChange?: (value: string) => void;
96
+ /** Digits allowed, and required unless `phoneNumberMinLength` says fewer. Defaults to 10 (India). */
97
+ phoneNumberLength?: number;
98
+ /** Fewest digits for a valid number, for countries whose numbers vary. Defaults to `phoneNumberLength`. */
99
+ phoneNumberMinLength?: number;
100
+ /** Defaults to "+91". */
101
+ countryCode?: string;
102
+ /** Defaults to the Indian flag. */
103
+ countryFlag?: string;
104
+ /** Opens the host's country picker. Omit and the selector is not interactive. */
105
+ onCountryCodeClick?: () => void;
106
+ /** Makes the country box a picker over these (see `WhatsAppNumberField`). */
107
+ countryOptions?: WhatsAppCountryOption[];
108
+ selectedCountryId?: string;
109
+ /** Update `countryCode`, `countryFlag` and the length props from here. */
110
+ onCountryChange?: (country: WhatsAppCountryOption) => void;
111
+ /** Host-side error (e.g. rejected by the API). Wins over the built-in length check. */
112
+ phoneNumberError?: string | null;
113
+ /**
114
+ * Host-owned input row, replacing the built-in one (label and helper text
115
+ * stay). The host then owns validation; `phoneNumber` is still what
116
+ * `onCtaClick` reports.
117
+ */
118
+ phoneNumberSection?: React.ReactNode;
119
+ /** Defaults to the bundled faces and copy; `null` hides the pill. */
120
+ socialProof?: ConsultationSlotPageSocialProof | null;
121
+ /** CTA label. Wins over `t("consultationContinue")`. */
122
+ ctaLabel?: string;
123
+ /**
124
+ * Fires only with a bookable slot selected and, when the built-in input is
125
+ * shown, a valid number — otherwise the page shows the validation error
126
+ * instead. `() => void` handlers from `ConsultationSlotSheet` still fit.
127
+ */
128
+ onCtaClick?: (selection: ConsultationSlotBookingSelection) => void;
129
+ /** Extra host condition for disabling the CTA. */
130
+ ctaDisabled?: boolean;
131
+ /** Swaps the CTA label for a busy label and disables it while a booking is in flight. */
132
+ isProcessing?: boolean;
133
+ /** Floats above the CTA, e.g. a failed booking attempt. */
134
+ errorMessage?: string | null;
135
+ /** Translation lookup; every string falls back to the English default. */
136
+ t?: ConsultationTranslate;
137
+ className?: string;
138
+ }
@@ -0,0 +1,17 @@
1
+ import { default as React } from 'react';
2
+ import { ConsultationTranslate } from '../../i18n';
3
+ export interface EmailFieldProps {
4
+ value: string;
5
+ onChange: (value: string) => void;
6
+ onBlur?: () => void;
7
+ /** The input took focus — e.g. to log that the user started on it. */
8
+ onFocus?: () => void;
9
+ /** Replaces the helper text, in red. */
10
+ error?: string | null;
11
+ inputRef?: React.Ref<HTMLInputElement>;
12
+ /** The 4px grey divider above the block. Defaults to shown. */
13
+ withDivider?: boolean;
14
+ t?: ConsultationTranslate;
15
+ className?: string;
16
+ }
17
+ export declare const EmailField: React.FC<EmailFieldProps>;
@@ -0,0 +1,2 @@
1
+ export { EmailField, type EmailFieldProps } from './EmailField';
2
+ export { useEmailAddress, isValidEmail, type UseEmailAddressOptions } from './useEmailAddress';
@@ -0,0 +1,28 @@
1
+ import { ConsultationTranslate } from '../../i18n';
2
+ export declare const isValidEmail: (value: string) => boolean;
3
+ export interface UseEmailAddressOptions {
4
+ /** Controlled value. Omit to let the hook manage it. */
5
+ value?: string;
6
+ /** Initial value when uncontrolled, e.g. the account's email. */
7
+ defaultValue?: string;
8
+ onChange?: (value: string) => void;
9
+ /** Whether the format check applies — off when the field is hidden. */
10
+ validate?: boolean;
11
+ /** Host-side error (e.g. rejected by the API). Always wins. */
12
+ hostError?: string | null;
13
+ t?: ConsultationTranslate;
14
+ }
15
+ /**
16
+ * State + validation for `EmailField` — the email counterpart of
17
+ * `useWhatsAppNumber`: the format error is held back until the user leaves
18
+ * the field or tries to continue.
19
+ */
20
+ export declare const useEmailAddress: ({ value, defaultValue, onChange, validate, hostError, t, }: UseEmailAddressOptions) => {
21
+ email: string;
22
+ setEmail: (next: string) => void;
23
+ isValid: boolean;
24
+ error: string | null;
25
+ handleBlur: () => void;
26
+ checkBeforeSubmit: () => boolean;
27
+ inputRef: import('react').MutableRefObject<HTMLInputElement | null>;
28
+ };
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ import { ConsultationTranslate } from '../../i18n';
3
+ export interface PageHeaderProps {
4
+ title: string;
5
+ /** Omit to render the title alone. */
6
+ onBack?: () => void;
7
+ t?: ConsultationTranslate;
8
+ }
9
+ /** Sticky back + title bar shared by the full-page consultation screens. */
10
+ export declare const PageHeader: React.FC<PageHeaderProps>;