@cimplify/sdk 0.67.0 → 0.68.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/dist/advanced.d.mts +1 -1
- package/dist/advanced.d.ts +1 -1
- package/dist/advanced.js +20 -20
- package/dist/advanced.mjs +1 -1
- package/dist/{chunk-SSLFZPAI.js → chunk-5HAUJBOK.js} +35 -35
- package/dist/{chunk-JAPCAZN4.mjs → chunk-KNPE4WCQ.mjs} +1 -1
- package/dist/{chunk-SH6HJW4A.js → chunk-NGQCWFKF.js} +2 -2
- package/dist/{chunk-QQMDEGAK.mjs → chunk-SOV4H6PQ.mjs} +177 -50
- package/dist/{chunk-FNK6UZOE.mjs → chunk-TAKORJP4.mjs} +1 -1
- package/dist/{chunk-3QSW33RG.js → chunk-WCSAZRNC.js} +179 -49
- package/dist/{client-Dd82KQ_G.d.mts → client-CBE7ksYC.d.mts} +1 -1
- package/dist/{client-DVFQoDtI.d.ts → client-CfeQRwhl.d.ts} +24 -2
- package/dist/{client-CQlEWH5j.d.ts → client-DlXfZy7N.d.ts} +1 -1
- package/dist/{client-ByI_3jfL.d.mts → client-Dyo3dvNy.d.mts} +24 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +89 -72
- package/dist/index.mjs +15 -10
- package/dist/react.d.mts +43 -40
- package/dist/react.d.ts +43 -40
- package/dist/react.js +251 -120
- package/dist/react.mjs +237 -106
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +7 -7
- package/dist/server.mjs +2 -2
- package/dist/{sign-in-RFuWZOgF.d.mts → sign-in-DQlIdqsi.d.mts} +8 -0
- package/dist/{sign-in-RFuWZOgF.d.ts → sign-in-DQlIdqsi.d.ts} +8 -0
- package/dist/styles.css +1 -1
- package/dist/testing/suite.d.mts +2 -2
- package/dist/testing/suite.d.ts +2 -2
- package/dist/testing/suite.js +22 -22
- package/dist/testing/suite.mjs +3 -3
- package/dist/testing.d.mts +17 -17
- package/dist/testing.d.ts +17 -17
- package/dist/testing.js +78 -78
- package/dist/testing.mjs +4 -4
- package/package.json +1 -1
- package/registry/index.json +0 -9
- package/registry/account.json +0 -15
package/dist/react.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React$1, { ReactNode } from 'react';
|
|
2
|
-
import { d as AdSlot, c as AdPosition, a as AdContextValue, S as SignInOptions } from './sign-in-
|
|
3
|
-
export { A as AdConfig, g as getVariantDisplayName } from './sign-in-
|
|
4
|
-
import { ac as CimplifyClient,
|
|
2
|
+
import { d as AdSlot, c as AdPosition, a as AdContextValue, S as SignInOptions } from './sign-in-DQlIdqsi.js';
|
|
3
|
+
export { A as AdConfig, g as getVariantDisplayName } from './sign-in-DQlIdqsi.js';
|
|
4
|
+
import { ac as CimplifyClient, c7 as ProcessCheckoutResult, a9 as CheckoutStatus, aa as CheckoutStatusContext, w as Business, bk as Location, co as ReorderResult, bR as OrderStatus, bA as Order, c9 as QuoteBundleSelectionInput, ca as QuoteCompositeSelectionInput, c3 as PriceQuote, cd as QuoteUiMessage, cJ as Service, r as AvailableSlot, au as DayAvailability, am as CustomerBooking, L as CancelBookingResult, f as ActivityStateResponse, cS as SessionMessage, c as ActivityRecommendation, aw as DeliveryFeeResponse, b2 as FxRateResponse, c$ as StorefrontBootstrap, X as ChatWidgetStarter, W as ChatMessage, h as AddressInfo, n as AuthenticatedData, aS as ElementsOptions, bZ as PaymentMethodInfo, aQ as ElementsCheckoutResult, c6 as ProcessCheckoutOptions, af as CimplifyElements, bb as LineItem, cV as Staff, cE as Room } from './client-CfeQRwhl.js';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import { ab as CurrencyCode, aX as Product, aO as Pagination, T as CimplifyError, b9 as ProductWithDetails, Q as Category, aM as Money, C as BundleSelectionInput, $ as ComponentSelectionInput, z as BundleSelectionData, a8 as CompositeSelectionData, U as Collection, b4 as ProductTaxonomy, bt as TaxonomyWithChildren, b5 as ProductTimeProfile, ah as Deal, b0 as ProductDealInfo, an as DiscountValidation, E as BundleSummary, a6 as CompositePriceResult, bo as SubscriptionWithDetails, bn as SubscriptionStatus, bk as Subscription, ac as CustomAttributeDefinition, ba as PropertyFacet, a$ as ProductBillingPlan, bL as VariantView, bF as VariantAxisWithValues, f as AddOnWithOptions, w as BundleComponentView, x as BundlePriceType, a4 as CompositeGroupView, aq as DisplayCart, b1 as ProductInputField, bg as SchedulingMode, at as DurationUnit, ad as CustomAttributeValue, b2 as ProductProperty, bc as QuantityPricingTier } from './product-B_kS4Oxa.js';
|
|
7
7
|
import { P as ProductWithPrice } from './price-9T1Y47oS.js';
|
|
@@ -83,42 +83,6 @@ interface CimplifyCheckoutProps {
|
|
|
83
83
|
}
|
|
84
84
|
declare function CimplifyCheckout({ client, businessId, cartId, locationId, linkUrl, orderTypes, defaultOrderType, submitLabel, enrollInLink, onComplete, onError, onStatusChange, appearance, className, }: CimplifyCheckoutProps): React$1.ReactElement;
|
|
85
85
|
|
|
86
|
-
interface CimplifyAccountProps {
|
|
87
|
-
/** CimplifyClient instance. Falls back to provider context. */
|
|
88
|
-
client?: CimplifyClient;
|
|
89
|
-
/** Override the Link base URL. */
|
|
90
|
-
linkUrl?: string;
|
|
91
|
-
/** Initial section to show: "dashboard" | "orders" | "addresses" | "payment-methods" | "sessions" | "settings". */
|
|
92
|
-
section?: string;
|
|
93
|
-
/**
|
|
94
|
-
* Per-merchant scope for the embedded account widget. When set, the
|
|
95
|
-
* widget filters orders/subs/sessions to this business and hides
|
|
96
|
-
* cross-merchant surfaces. Defaults to the client's configured
|
|
97
|
-
* business ID so storefronts get scoping for free.
|
|
98
|
-
*/
|
|
99
|
-
businessId?: string;
|
|
100
|
-
/**
|
|
101
|
-
* Display name of the embedding merchant — shown in the widget's
|
|
102
|
-
* scoping footer ("Showing your account with Acme Threads only.").
|
|
103
|
-
* Optional but recommended for trust signal.
|
|
104
|
-
*/
|
|
105
|
-
merchantName?: string;
|
|
106
|
-
/** Appearance variables — passed to Link for theming. */
|
|
107
|
-
appearance?: {
|
|
108
|
-
theme?: "light" | "dark";
|
|
109
|
-
variables?: {
|
|
110
|
-
primaryColor?: string;
|
|
111
|
-
fontFamily?: string;
|
|
112
|
-
borderRadius?: string;
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
/** Called when the user logs out from the account portal. */
|
|
116
|
-
onLogout?: () => void;
|
|
117
|
-
/** Additional CSS class for the container. */
|
|
118
|
-
className?: string;
|
|
119
|
-
}
|
|
120
|
-
declare function CimplifyAccount({ client: clientProp, linkUrl, section, businessId: businessIdProp, merchantName, appearance, onLogout, className, }: CimplifyAccountProps): React$1.ReactElement;
|
|
121
|
-
|
|
122
86
|
interface NavItem {
|
|
123
87
|
label: string;
|
|
124
88
|
href: string;
|
|
@@ -592,6 +556,45 @@ interface UseCimplifySessionResult {
|
|
|
592
556
|
}
|
|
593
557
|
declare function useCimplifySession(options?: UseCimplifySessionOptions): UseCimplifySessionResult;
|
|
594
558
|
|
|
559
|
+
interface UserButtonLink {
|
|
560
|
+
label: string;
|
|
561
|
+
href: string;
|
|
562
|
+
icon?: React$1.ReactNode;
|
|
563
|
+
external?: boolean;
|
|
564
|
+
}
|
|
565
|
+
interface CimplifyUserButtonProps {
|
|
566
|
+
/** Controlled session. When omitted, the component reads it from `sessionUri`. */
|
|
567
|
+
session?: CimplifyClientSession | null;
|
|
568
|
+
/** Session endpoint for the uncontrolled case. Defaults to `/auth/session`. */
|
|
569
|
+
sessionUri?: string;
|
|
570
|
+
/**
|
|
571
|
+
* Storefront-scoped quick links shown in the menu. These resolve against the
|
|
572
|
+
* merchant's own pages (the business-scoped token already in the page reads
|
|
573
|
+
* the data). Defaults to the native `/account/*` routes.
|
|
574
|
+
*/
|
|
575
|
+
links?: UserButtonLink[];
|
|
576
|
+
/**
|
|
577
|
+
* Cross-merchant identity home. Profile, security, passkeys and devices live
|
|
578
|
+
* on the root session at `link.cimplify.io` — never in the merchant frame —
|
|
579
|
+
* so this is always an external link.
|
|
580
|
+
*/
|
|
581
|
+
identityUrl?: string;
|
|
582
|
+
/** Sign-out target. A `<form>` POST is used so the BFF can clear cookies. */
|
|
583
|
+
signOutHref?: string;
|
|
584
|
+
onSignOut?: () => void;
|
|
585
|
+
/** Signed-out state delegates to the hosted OAuth flow. */
|
|
586
|
+
clientId?: string;
|
|
587
|
+
redirectUri?: string;
|
|
588
|
+
signInLabel?: string;
|
|
589
|
+
onSignIn?: () => void;
|
|
590
|
+
/** Hide the name beside the avatar (avatar-only trigger). */
|
|
591
|
+
hideName?: boolean;
|
|
592
|
+
/** Menu alignment relative to the trigger. */
|
|
593
|
+
align?: "start" | "end";
|
|
594
|
+
className?: string;
|
|
595
|
+
}
|
|
596
|
+
declare function CimplifyUserButton({ session: controlledSession, sessionUri, links, identityUrl, signOutHref, onSignOut, clientId, redirectUri, signInLabel, onSignIn, hideName, align, className, }: CimplifyUserButtonProps): React$1.ReactElement | null;
|
|
597
|
+
|
|
595
598
|
interface PriceProps {
|
|
596
599
|
/** The amount in base (business) currency. */
|
|
597
600
|
amount: number | string;
|
|
@@ -3448,4 +3451,4 @@ interface ChatWidgetProps {
|
|
|
3448
3451
|
}
|
|
3449
3452
|
declare function ChatWidget({ client: clientProp, businessName, greeting, subtitle, starters, placeholder, position, defaultOpen, pollInterval, className, classNames, }: ChatWidgetProps): react_jsx_runtime.JSX.Element;
|
|
3450
3453
|
|
|
3451
|
-
export { AccommodationCard, AccountContent, type AccountContentProps, AccountDashboardPage, type AccountDashboardPageProps, AccountHero, type AccountHeroProps, AccountIdentityStrip, type AccountIdentityStripProps, AccountNav, type AccountNavProps, AccountOrderDetailPage, type AccountOrderDetailPageProps, AccountOrdersPage, type AccountOrdersPageProps, type AccountPageBaseProps, AccountShell, type AccountShellProps, AccountSidebar, type AccountSidebarProps, AccountSignedOutPrompt, type AccountSignedOutPromptProps, AccountSubscriptionDetailPage, type AccountSubscriptionDetailPageProps, AccountSubscriptionsPage, type AccountSubscriptionsPageProps, Ad, AdPosition, type AdProps, AdProvider, AdSlot, AddOnSelector, type AddOnSelectorClassNames, type AddOnSelectorProps, type AddToCartOptions, AddressElement, AuthElement, AvailabilityBadge, type AvailabilityBadgeClassNames, type AvailabilityBadgeProps, BackLink, type BackLinkProps, BillingPlanSelector, type BillingPlanSelectorClassNames, type BillingPlanSelectorProps, BookingCard, type BookingCardClassNames, type BookingCardProps, BookingList, type BookingListClassNames, type BookingListProps, BookingPage, type BookingPageClassNames, type BookingPageProps, BookingsPage, type BookingsPageClassNames, type BookingsPageProps, BoxIcon24, BundleProductCard, BundleProductLayout, BundleSelector, type BundleSelectorClassNames, type BundleSelectorProps, Button, type ButtonProps, CardImage, type CardLayoutProps, CardShell, CardVariant, type CartAddOnOptionSelection, CartDrawer, type CartDrawerProps, CartDrawerProvider, type CartLayoutProps, CartPage, type CartPageClassNames, type CartPageProps, CartSummary, type CartSummaryClassNames, type CartSummaryProps, CartTemplate, type CartVariantSelection, CatalogueCollectionLayout, type CatalogueLayoutProps, CataloguePage, type CataloguePageClassNames, type CataloguePageProps, CatalogueTemplate, CategoryFilter, type CategoryFilterClassNames, type CategoryFilterProps, CategoryGrid, type CategoryGridClassNames, type CategoryGridProps, ChatWidget, type ChatWidgetClassNames, type ChatWidgetProps, CheckIcon, CheckoutPage, type CheckoutPageClassNames, type CheckoutPageProps, CimplifyAccount, type CimplifyAccountProps, CimplifyCheckout, type CimplifyCheckoutProps, type CimplifyClientContextValue, type CimplifyClientSession, type CimplifyContextValue, CimplifyProvider, type CimplifyProviderProps, CimplifySignInButton, type CimplifySignInButtonProps, type CollectionLayoutProps, CollectionPage, type CollectionPageClassNames, type CollectionPageProps, CollectionTemplate, CompactCartLayout, CompactCatalogueLayout, CompactSearchLayout, CompactServiceCard, CompositeProductCard, CompositeProductLayout, CompositeSelector, type CompositeSelectorClassNames, type CompositeSelectorProps, ContextCard, type ContextCardProps, type ContextRow, ContinuityCard, type ContinuityCardProps, CurrencySelector, type CurrencySelectorClassNames, type CurrencySelectorProps, CustomAttributesTable, CustomerInputFields, type CustomerInputFieldsClassNames, type CustomerInputFieldsProps, DashboardIcon, DashboardIcon20, DatePicker, type DatePickerClassNames, type DatePickerProps, DateSlotPicker, type DateSlotPickerClassNames, type DateSlotPickerProps, DealBanner, type DealBannerClassNames, type DealBannerProps, DealsPage, type DealsPageClassNames, type DealsPageProps, DefaultCartLayout, DefaultCatalogueLayout, DefaultCollectionLayout, DefaultProductLayout, DefaultSearchLayout, DeliveryEstimate, type DeliveryEstimateClassNames, type DeliveryEstimateProps, DeliveryTruckIcon, DigitalProductCard, DigitalProductLayout, DiscountInput, type DiscountInputClassNames, type DiscountInputProps, ElementsProvider, EmptyState, type EmptyStateProps, ErrorState, type ErrorStateProps, FeaturedCollectionLayout, type FilterTabItem, FilterTabs, type FilterTabsProps, FoodProductCard, FoodProductLayout, HappeningCard, type HappeningCardProps, type HappeningPaneData, IdentityIcon, IdentityOfframp, type IdentityOfframpProps, type IdentitySummary, InventoryBadge, ItemsCard, type ItemsCardProps, LeaseServiceCard, LocationPicker, type LocationPickerClassNames, type LocationPickerProps, MediaGallery, type MediaGalleryProps, type MediaItem, MetadataStringList, MobileAccountShell, type MobileAccountShellProps, MobileBackButton, MobileMoreButton, MobileTabBar, type MobileTabBarProps, type NavItem, NextDeliveryCard, type NextDeliveryCardProps, OrderDetailHeader, type OrderDetailHeaderProps, OrderDetailMetaPipe, OrderDetailPage, type OrderDetailPageClassNames, type OrderDetailPageProps, OrderHistory, type OrderHistoryClassNames, OrderHistoryPage, type OrderHistoryPageClassNames, type OrderHistoryPageProps, type OrderHistoryProps, type OrderItemData, OrderList, type OrderListProps, OrderRow, type OrderRowData, type OrderRowProps, type OrderRowStatus, OrderSummary, type OrderSummaryClassNames, type OrderSummaryProps, OrderTimeline, type OrderTimelineProps, OrderTotals, type OrderTotalsProps, OrdersIcon, OrdersIcon20, OvenIcon, PackageIcon, PaymentElement, Price, type PriceProps, PriceRange, type PriceRangeProps, ProductCard, type ProductCardClassNames, type ProductCardProps, ProductCustomizer, type ProductCustomizerClassNames, type ProductCustomizerProps, ProductGrid, type ProductGridClassNames, type ProductGridProps, ProductImageGallery, type ProductImageGalleryProps, type ProductLayoutProps, ProductModel3D, type ProductModel3DProps, ProductPage, type ProductPageClassNames, type ProductPageProps, ProductSheet, type ProductSheetClassNames, type ProductSheetProps, ProductTemplate, PropertiesTable, QuantitySelector, type QuantitySelectorClassNames, type QuantitySelectorProps, QuickAddButton, RecentlyViewed, type RecentlyViewedClassNames, type RecentlyViewedProps, RecommendationCarousel, type RecommendationCarouselClassNames, type RecommendationCarouselProps, RelatedProductsSection, RentalServiceCard, type Resource, ResourcePicker, type ResourcePickerClassNames, type ResourcePickerProps, RetailProductCard, RichText, type RichTextProps, SaleBadge, type SaleBadgeClassNames, type SaleBadgeProps, ScheduleServiceCard, SearchInput, type SearchInputClassNames, type SearchInputProps, type SearchLayoutProps, SearchPage, type SearchPageClassNames, type SearchPageProps, SearchTemplate, Section, SectionMore, type SectionMoreProps, type SectionProps, type ServiceCardLayoutProps, ServiceProductLayout, SessionMessageBanner, type SessionMessageBannerClassNames, type SessionMessageBannerProps, SignOutIcon, Skeleton, type SkeletonProps, SlotPicker, type SlotPickerClassNames, type SlotPickerProps, SoldOutOverlay, StaffPicker, type StaffPickerClassNames, type StaffPickerProps, StandardServiceCard, Status, type StatusProps, StoreNav, type StoreNavClassNames, type StoreNavProps, StoreVideo, type StoreVideoProps, SubscriptionCard, SubscriptionList, type SubscriptionListProps, SubscriptionRow, type SubscriptionRowData, type SubscriptionRowProps, SubscriptionsIcon, SubscriptionsIcon20, TagPills, TimePicker, type TimePickerClassNames, type TimePickerProps, type TimelineStep, Toast, type ToastProps, type TotalsData, TwoColumnGrid, type UseActivityStateOptions, type UseActivityStateResult, type UseAttributeDefinitionsOptions, type UseAttributeDefinitionsResult, type UseAvailableSlotsOptions, type UseAvailableSlotsResult, type UseBillingPlansOptions, type UseBillingPlansResult, type UseBookingsOptions, type UseBookingsResult, type UseBootstrapOptions, type UseBootstrapResult, type UseBundlesOptions, type UseBundlesResult, type UseCartItem, type UseCartOptions, type UseCartResult, type UseCategoriesOptions, type UseCategoriesResult, type UseChatOptions, type UseChatResult, type UseCimplifySessionOptions, type UseCimplifySessionResult, type UseCollectionOptions, type UseCollectionResult, type UseCollectionsOptions, type UseCollectionsResult, type UseDealsOptions, type UseDealsResult, type UseDeliveryFeeOptions, type UseDeliveryFeeResult, type UseFxRateOptions, type UseFxRateResult, type UseLocationsOptions, type UseLocationsResult, type UseOrderOptions, type UseOrderResult, type UseOrdersOptions, type UseOrdersResult, type UseProductAvailabilityOptions, type UseProductAvailabilityResult, type UseProductDealsOptions, type UseProductDealsResult, type UseProductOptions, type UseProductPriceInput, type UseProductPriceResult, type UseProductResult, type UseProductSchedulesOptions, type UseProductSchedulesResult, type UseProductsOnSaleOptions, type UseProductsOnSaleResult, type UseProductsOptions, type UseProductsResult, type UsePropertyFacetsOptions, type UsePropertyFacetsResult, type UseQuoteInput, type UseQuoteOptions, type UseQuoteResult, type UseRecommendationsOptions, type UseRecommendationsResult, type UseSearchOptions, type UseSearchResult, type UseServiceAvailabilityOptions, type UseServiceAvailabilityResult, type UseServicesOptions, type UseServicesResult, type UseTaxonomiesOptions, type UseTaxonomiesResult, type UseTaxonomyOptions, type UseTaxonomyPathOptions, type UseTaxonomyPathResult, type UseTaxonomyResult, type UseValidateDiscountOptions, type UseValidateDiscountResult, type UseVariantSelectorOptions, type UseVariantSelectorResult, VariantSelector, type VariantSelectorClassNames, type VariantSelectorProps, VolumePricing, type VolumePricingClassNames, type VolumePricingProps, WelcomeCard, type WelcomeCardProps, WholesaleProductCard, WholesaleProductLayout, WishlistButton, cn, roomToResource, sanitizeRichTextHtml, stripHtmlToText, useActivityState, useAds, useAttributeDefinitions, useAvailableSlots, useBillingPlans, useBookings, useBootstrap, useBundles, useCart, useCartDrawer, useCategories, useChat, useCheckout, useCimplify, useCimplifyClient, useCimplifySession, useCollection, useCollections, useDeals, useDeliveryFee, useElements, useElementsReady, useFxRate, useLocations, useOptionalCimplify, useOrder, useOrders, useProduct, useProductAvailability, useProductDeals, useProductPrice, useProductSchedules, useProducts, useProductsOnSale, usePropertyFacets, useQuote, useRecommendations, useSearch, useServiceAvailability, useServices, useSubscription, useSubscriptions, useTaxonomies, useTaxonomy, useTaxonomyPath, useValidateDiscount, useVariantSelector };
|
|
3454
|
+
export { AccommodationCard, AccountContent, type AccountContentProps, AccountDashboardPage, type AccountDashboardPageProps, AccountHero, type AccountHeroProps, AccountIdentityStrip, type AccountIdentityStripProps, AccountNav, type AccountNavProps, AccountOrderDetailPage, type AccountOrderDetailPageProps, AccountOrdersPage, type AccountOrdersPageProps, type AccountPageBaseProps, AccountShell, type AccountShellProps, AccountSidebar, type AccountSidebarProps, AccountSignedOutPrompt, type AccountSignedOutPromptProps, AccountSubscriptionDetailPage, type AccountSubscriptionDetailPageProps, AccountSubscriptionsPage, type AccountSubscriptionsPageProps, Ad, AdPosition, type AdProps, AdProvider, AdSlot, AddOnSelector, type AddOnSelectorClassNames, type AddOnSelectorProps, type AddToCartOptions, AddressElement, AuthElement, AvailabilityBadge, type AvailabilityBadgeClassNames, type AvailabilityBadgeProps, BackLink, type BackLinkProps, BillingPlanSelector, type BillingPlanSelectorClassNames, type BillingPlanSelectorProps, BookingCard, type BookingCardClassNames, type BookingCardProps, BookingList, type BookingListClassNames, type BookingListProps, BookingPage, type BookingPageClassNames, type BookingPageProps, BookingsPage, type BookingsPageClassNames, type BookingsPageProps, BoxIcon24, BundleProductCard, BundleProductLayout, BundleSelector, type BundleSelectorClassNames, type BundleSelectorProps, Button, type ButtonProps, CardImage, type CardLayoutProps, CardShell, CardVariant, type CartAddOnOptionSelection, CartDrawer, type CartDrawerProps, CartDrawerProvider, type CartLayoutProps, CartPage, type CartPageClassNames, type CartPageProps, CartSummary, type CartSummaryClassNames, type CartSummaryProps, CartTemplate, type CartVariantSelection, CatalogueCollectionLayout, type CatalogueLayoutProps, CataloguePage, type CataloguePageClassNames, type CataloguePageProps, CatalogueTemplate, CategoryFilter, type CategoryFilterClassNames, type CategoryFilterProps, CategoryGrid, type CategoryGridClassNames, type CategoryGridProps, ChatWidget, type ChatWidgetClassNames, type ChatWidgetProps, CheckIcon, CheckoutPage, type CheckoutPageClassNames, type CheckoutPageProps, CimplifyCheckout, type CimplifyCheckoutProps, type CimplifyClientContextValue, type CimplifyClientSession, type CimplifyContextValue, CimplifyProvider, type CimplifyProviderProps, CimplifySignInButton, type CimplifySignInButtonProps, CimplifyUserButton, type CimplifyUserButtonProps, type CollectionLayoutProps, CollectionPage, type CollectionPageClassNames, type CollectionPageProps, CollectionTemplate, CompactCartLayout, CompactCatalogueLayout, CompactSearchLayout, CompactServiceCard, CompositeProductCard, CompositeProductLayout, CompositeSelector, type CompositeSelectorClassNames, type CompositeSelectorProps, ContextCard, type ContextCardProps, type ContextRow, ContinuityCard, type ContinuityCardProps, CurrencySelector, type CurrencySelectorClassNames, type CurrencySelectorProps, CustomAttributesTable, CustomerInputFields, type CustomerInputFieldsClassNames, type CustomerInputFieldsProps, DashboardIcon, DashboardIcon20, DatePicker, type DatePickerClassNames, type DatePickerProps, DateSlotPicker, type DateSlotPickerClassNames, type DateSlotPickerProps, DealBanner, type DealBannerClassNames, type DealBannerProps, DealsPage, type DealsPageClassNames, type DealsPageProps, DefaultCartLayout, DefaultCatalogueLayout, DefaultCollectionLayout, DefaultProductLayout, DefaultSearchLayout, DeliveryEstimate, type DeliveryEstimateClassNames, type DeliveryEstimateProps, DeliveryTruckIcon, DigitalProductCard, DigitalProductLayout, DiscountInput, type DiscountInputClassNames, type DiscountInputProps, ElementsProvider, EmptyState, type EmptyStateProps, ErrorState, type ErrorStateProps, FeaturedCollectionLayout, type FilterTabItem, FilterTabs, type FilterTabsProps, FoodProductCard, FoodProductLayout, HappeningCard, type HappeningCardProps, type HappeningPaneData, IdentityIcon, IdentityOfframp, type IdentityOfframpProps, type IdentitySummary, InventoryBadge, ItemsCard, type ItemsCardProps, LeaseServiceCard, LocationPicker, type LocationPickerClassNames, type LocationPickerProps, MediaGallery, type MediaGalleryProps, type MediaItem, MetadataStringList, MobileAccountShell, type MobileAccountShellProps, MobileBackButton, MobileMoreButton, MobileTabBar, type MobileTabBarProps, type NavItem, NextDeliveryCard, type NextDeliveryCardProps, OrderDetailHeader, type OrderDetailHeaderProps, OrderDetailMetaPipe, OrderDetailPage, type OrderDetailPageClassNames, type OrderDetailPageProps, OrderHistory, type OrderHistoryClassNames, OrderHistoryPage, type OrderHistoryPageClassNames, type OrderHistoryPageProps, type OrderHistoryProps, type OrderItemData, OrderList, type OrderListProps, OrderRow, type OrderRowData, type OrderRowProps, type OrderRowStatus, OrderSummary, type OrderSummaryClassNames, type OrderSummaryProps, OrderTimeline, type OrderTimelineProps, OrderTotals, type OrderTotalsProps, OrdersIcon, OrdersIcon20, OvenIcon, PackageIcon, PaymentElement, Price, type PriceProps, PriceRange, type PriceRangeProps, ProductCard, type ProductCardClassNames, type ProductCardProps, ProductCustomizer, type ProductCustomizerClassNames, type ProductCustomizerProps, ProductGrid, type ProductGridClassNames, type ProductGridProps, ProductImageGallery, type ProductImageGalleryProps, type ProductLayoutProps, ProductModel3D, type ProductModel3DProps, ProductPage, type ProductPageClassNames, type ProductPageProps, ProductSheet, type ProductSheetClassNames, type ProductSheetProps, ProductTemplate, PropertiesTable, QuantitySelector, type QuantitySelectorClassNames, type QuantitySelectorProps, QuickAddButton, RecentlyViewed, type RecentlyViewedClassNames, type RecentlyViewedProps, RecommendationCarousel, type RecommendationCarouselClassNames, type RecommendationCarouselProps, RelatedProductsSection, RentalServiceCard, type Resource, ResourcePicker, type ResourcePickerClassNames, type ResourcePickerProps, RetailProductCard, RichText, type RichTextProps, SaleBadge, type SaleBadgeClassNames, type SaleBadgeProps, ScheduleServiceCard, SearchInput, type SearchInputClassNames, type SearchInputProps, type SearchLayoutProps, SearchPage, type SearchPageClassNames, type SearchPageProps, SearchTemplate, Section, SectionMore, type SectionMoreProps, type SectionProps, type ServiceCardLayoutProps, ServiceProductLayout, SessionMessageBanner, type SessionMessageBannerClassNames, type SessionMessageBannerProps, SignOutIcon, Skeleton, type SkeletonProps, SlotPicker, type SlotPickerClassNames, type SlotPickerProps, SoldOutOverlay, StaffPicker, type StaffPickerClassNames, type StaffPickerProps, StandardServiceCard, Status, type StatusProps, StoreNav, type StoreNavClassNames, type StoreNavProps, StoreVideo, type StoreVideoProps, SubscriptionCard, SubscriptionList, type SubscriptionListProps, SubscriptionRow, type SubscriptionRowData, type SubscriptionRowProps, SubscriptionsIcon, SubscriptionsIcon20, TagPills, TimePicker, type TimePickerClassNames, type TimePickerProps, type TimelineStep, Toast, type ToastProps, type TotalsData, TwoColumnGrid, type UseActivityStateOptions, type UseActivityStateResult, type UseAttributeDefinitionsOptions, type UseAttributeDefinitionsResult, type UseAvailableSlotsOptions, type UseAvailableSlotsResult, type UseBillingPlansOptions, type UseBillingPlansResult, type UseBookingsOptions, type UseBookingsResult, type UseBootstrapOptions, type UseBootstrapResult, type UseBundlesOptions, type UseBundlesResult, type UseCartItem, type UseCartOptions, type UseCartResult, type UseCategoriesOptions, type UseCategoriesResult, type UseChatOptions, type UseChatResult, type UseCimplifySessionOptions, type UseCimplifySessionResult, type UseCollectionOptions, type UseCollectionResult, type UseCollectionsOptions, type UseCollectionsResult, type UseDealsOptions, type UseDealsResult, type UseDeliveryFeeOptions, type UseDeliveryFeeResult, type UseFxRateOptions, type UseFxRateResult, type UseLocationsOptions, type UseLocationsResult, type UseOrderOptions, type UseOrderResult, type UseOrdersOptions, type UseOrdersResult, type UseProductAvailabilityOptions, type UseProductAvailabilityResult, type UseProductDealsOptions, type UseProductDealsResult, type UseProductOptions, type UseProductPriceInput, type UseProductPriceResult, type UseProductResult, type UseProductSchedulesOptions, type UseProductSchedulesResult, type UseProductsOnSaleOptions, type UseProductsOnSaleResult, type UseProductsOptions, type UseProductsResult, type UsePropertyFacetsOptions, type UsePropertyFacetsResult, type UseQuoteInput, type UseQuoteOptions, type UseQuoteResult, type UseRecommendationsOptions, type UseRecommendationsResult, type UseSearchOptions, type UseSearchResult, type UseServiceAvailabilityOptions, type UseServiceAvailabilityResult, type UseServicesOptions, type UseServicesResult, type UseTaxonomiesOptions, type UseTaxonomiesResult, type UseTaxonomyOptions, type UseTaxonomyPathOptions, type UseTaxonomyPathResult, type UseTaxonomyResult, type UseValidateDiscountOptions, type UseValidateDiscountResult, type UseVariantSelectorOptions, type UseVariantSelectorResult, type UserButtonLink, VariantSelector, type VariantSelectorClassNames, type VariantSelectorProps, VolumePricing, type VolumePricingClassNames, type VolumePricingProps, WelcomeCard, type WelcomeCardProps, WholesaleProductCard, WholesaleProductLayout, WishlistButton, cn, roomToResource, sanitizeRichTextHtml, stripHtmlToText, useActivityState, useAds, useAttributeDefinitions, useAvailableSlots, useBillingPlans, useBookings, useBootstrap, useBundles, useCart, useCartDrawer, useCategories, useChat, useCheckout, useCimplify, useCimplifyClient, useCimplifySession, useCollection, useCollections, useDeals, useDeliveryFee, useElements, useElementsReady, useFxRate, useLocations, useOptionalCimplify, useOrder, useOrders, useProduct, useProductAvailability, useProductDeals, useProductPrice, useProductSchedules, useProducts, useProductsOnSale, usePropertyFacets, useQuote, useRecommendations, useSearch, useServiceAvailability, useServices, useSubscription, useSubscriptions, useTaxonomies, useTaxonomy, useTaxonomyPath, useValidateDiscount, useVariantSelector };
|
package/dist/react.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var chunkIQLJJW2H_js = require('./chunk-IQLJJW2H.js');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var chunk5HAUJBOK_js = require('./chunk-5HAUJBOK.js');
|
|
6
|
+
var chunkWCSAZRNC_js = require('./chunk-WCSAZRNC.js');
|
|
7
7
|
var chunk7Y2O3E4D_js = require('./chunk-7Y2O3E4D.js');
|
|
8
8
|
var chunkXA3ZNR75_js = require('./chunk-XA3ZNR75.js');
|
|
9
9
|
require('./chunk-OWW5GUSB.js');
|
|
@@ -1086,7 +1086,7 @@ var DEFAULT_COUNTRY = "US";
|
|
|
1086
1086
|
function createDefaultClient() {
|
|
1087
1087
|
const processRef = globalThis.process;
|
|
1088
1088
|
const envPublicKey = processRef?.env?.NEXT_PUBLIC_CIMPLIFY_PUBLIC_KEY || "";
|
|
1089
|
-
return
|
|
1089
|
+
return chunk5HAUJBOK_js.createCimplifyClient({ publicKey: envPublicKey });
|
|
1090
1090
|
}
|
|
1091
1091
|
function getStoredLocationId() {
|
|
1092
1092
|
if (typeof window === "undefined" || !window.localStorage) {
|
|
@@ -1662,100 +1662,6 @@ function CimplifyCheckout({
|
|
|
1662
1662
|
function cn(...inputs) {
|
|
1663
1663
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
1664
1664
|
}
|
|
1665
|
-
var DEFAULT_LINK_URL = "https://link.cimplify.io";
|
|
1666
|
-
function CimplifyAccount({
|
|
1667
|
-
client: clientProp,
|
|
1668
|
-
linkUrl,
|
|
1669
|
-
section,
|
|
1670
|
-
businessId: businessIdProp,
|
|
1671
|
-
merchantName,
|
|
1672
|
-
appearance,
|
|
1673
|
-
onLogout,
|
|
1674
|
-
className
|
|
1675
|
-
}) {
|
|
1676
|
-
const context = useOptionalCimplify();
|
|
1677
|
-
const client = clientProp ?? context?.client;
|
|
1678
|
-
const resolvedLinkUrl = linkUrl || DEFAULT_LINK_URL;
|
|
1679
|
-
const resolvedBusinessId = businessIdProp || client?.getBusinessId?.() || "";
|
|
1680
|
-
const iframeRef = React12.useRef(null);
|
|
1681
|
-
const [height, setHeight] = React12.useState(400);
|
|
1682
|
-
const [isReady, setIsReady] = React12.useState(false);
|
|
1683
|
-
const iframeSrc = React12.useMemo(() => {
|
|
1684
|
-
const path = section ? `/elements/account/${section}` : "/elements/account";
|
|
1685
|
-
const url = new URL(path, resolvedLinkUrl);
|
|
1686
|
-
if (resolvedBusinessId) url.searchParams.set("businessId", resolvedBusinessId);
|
|
1687
|
-
return url.toString();
|
|
1688
|
-
}, [resolvedLinkUrl, section, resolvedBusinessId]);
|
|
1689
|
-
React12.useEffect(() => {
|
|
1690
|
-
function handleMessage(event) {
|
|
1691
|
-
if (!event.data || typeof event.data !== "object") return;
|
|
1692
|
-
if (iframeRef.current?.contentWindow && event.source !== iframeRef.current.contentWindow) {
|
|
1693
|
-
return;
|
|
1694
|
-
}
|
|
1695
|
-
switch (event.data.type) {
|
|
1696
|
-
case "ready":
|
|
1697
|
-
setIsReady(true);
|
|
1698
|
-
if (typeof event.data.height === "number") {
|
|
1699
|
-
setHeight(event.data.height);
|
|
1700
|
-
}
|
|
1701
|
-
sendInit();
|
|
1702
|
-
break;
|
|
1703
|
-
case "height_change":
|
|
1704
|
-
if (typeof event.data.height === "number") {
|
|
1705
|
-
setHeight(event.data.height);
|
|
1706
|
-
}
|
|
1707
|
-
break;
|
|
1708
|
-
case "logout_complete":
|
|
1709
|
-
onLogout?.();
|
|
1710
|
-
break;
|
|
1711
|
-
}
|
|
1712
|
-
}
|
|
1713
|
-
window.addEventListener("message", handleMessage);
|
|
1714
|
-
return () => window.removeEventListener("message", handleMessage);
|
|
1715
|
-
}, [appearance, client, onLogout]);
|
|
1716
|
-
function sendInit() {
|
|
1717
|
-
const contentWindow = iframeRef.current?.contentWindow;
|
|
1718
|
-
if (!contentWindow) return;
|
|
1719
|
-
const token = client?.getAccessToken?.();
|
|
1720
|
-
contentWindow.postMessage(
|
|
1721
|
-
{
|
|
1722
|
-
type: "init",
|
|
1723
|
-
token: token ?? void 0,
|
|
1724
|
-
appearance: appearance ?? void 0,
|
|
1725
|
-
businessId: resolvedBusinessId || void 0,
|
|
1726
|
-
merchantName: merchantName ?? void 0
|
|
1727
|
-
},
|
|
1728
|
-
resolvedLinkUrl
|
|
1729
|
-
);
|
|
1730
|
-
}
|
|
1731
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1732
|
-
"div",
|
|
1733
|
-
{
|
|
1734
|
-
"data-cimplify-account": true,
|
|
1735
|
-
className: cn("relative overflow-hidden", className),
|
|
1736
|
-
children: [
|
|
1737
|
-
!isReady && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-6 h-6 border-2 border-border border-t-foreground rounded-full animate-spin" }) }),
|
|
1738
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1739
|
-
"iframe",
|
|
1740
|
-
{
|
|
1741
|
-
ref: iframeRef,
|
|
1742
|
-
src: iframeSrc,
|
|
1743
|
-
style: {
|
|
1744
|
-
border: "none",
|
|
1745
|
-
width: "100%",
|
|
1746
|
-
height: `${height}px`,
|
|
1747
|
-
display: isReady ? "block" : "none",
|
|
1748
|
-
overflow: "hidden",
|
|
1749
|
-
background: "transparent"
|
|
1750
|
-
},
|
|
1751
|
-
allow: "geolocation",
|
|
1752
|
-
sandbox: "allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox"
|
|
1753
|
-
}
|
|
1754
|
-
)
|
|
1755
|
-
]
|
|
1756
|
-
}
|
|
1757
|
-
);
|
|
1758
|
-
}
|
|
1759
1665
|
var BUTTON_BASE = "inline-flex items-center justify-center gap-2 font-semibold leading-none transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 disabled:opacity-50 disabled:cursor-not-allowed [font-family:inherit] cursor-pointer rounded-[10px]";
|
|
1760
1666
|
var BUTTON_VARIANTS = {
|
|
1761
1667
|
primary: "bg-foreground text-background hover:bg-foreground/90",
|
|
@@ -1987,6 +1893,17 @@ function Toast({ title, description, onUndo, onDismiss, className }) {
|
|
|
1987
1893
|
}
|
|
1988
1894
|
);
|
|
1989
1895
|
}
|
|
1896
|
+
|
|
1897
|
+
// src/react/utils/avatar.ts
|
|
1898
|
+
function avatarGradient(seed) {
|
|
1899
|
+
let hash = 0;
|
|
1900
|
+
for (let i = 0; i < seed.length; i++) hash = (hash << 5) - hash + seed.charCodeAt(i) | 0;
|
|
1901
|
+
const hue = (Math.abs(hash) % 60 + 20) % 360;
|
|
1902
|
+
return `linear-gradient(135deg, oklch(0.78 0.10 ${hue}), oklch(0.55 0.16 ${hue - 8}))`;
|
|
1903
|
+
}
|
|
1904
|
+
function initials(name) {
|
|
1905
|
+
return name.trim().split(/\s+/).map((p) => p[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
|
|
1906
|
+
}
|
|
1990
1907
|
function AccountShell({ sidebar, children, className }) {
|
|
1991
1908
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1992
1909
|
"div",
|
|
@@ -2021,15 +1938,6 @@ function AccountSidebar({ children, scopeNote, className }) {
|
|
|
2021
1938
|
}
|
|
2022
1939
|
);
|
|
2023
1940
|
}
|
|
2024
|
-
function avatarGradient(seed) {
|
|
2025
|
-
let hash = 0;
|
|
2026
|
-
for (let i = 0; i < seed.length; i++) hash = (hash << 5) - hash + seed.charCodeAt(i) | 0;
|
|
2027
|
-
const hue = (Math.abs(hash) % 60 + 20) % 360;
|
|
2028
|
-
return `linear-gradient(135deg, oklch(0.78 0.10 ${hue}), oklch(0.55 0.16 ${hue - 8}))`;
|
|
2029
|
-
}
|
|
2030
|
-
function initials(name) {
|
|
2031
|
-
return name.trim().split(/\s+/).map((p) => p[0]).filter(Boolean).slice(0, 2).join("").toUpperCase();
|
|
2032
|
-
}
|
|
2033
1941
|
function AccountIdentityStrip({
|
|
2034
1942
|
name,
|
|
2035
1943
|
email,
|
|
@@ -2715,7 +2623,7 @@ function CimplifySignInButton({
|
|
|
2715
2623
|
const onClick = async () => {
|
|
2716
2624
|
if (busy || disabled) return;
|
|
2717
2625
|
setBusy(true);
|
|
2718
|
-
await
|
|
2626
|
+
await chunkWCSAZRNC_js.startSignIn({
|
|
2719
2627
|
...signInOpts,
|
|
2720
2628
|
onSuccess: () => {
|
|
2721
2629
|
setBusy(false);
|
|
@@ -3350,6 +3258,229 @@ function useCimplifySession(options) {
|
|
|
3350
3258
|
}, [fetchSession]);
|
|
3351
3259
|
return { session, loading, refresh: fetchSession };
|
|
3352
3260
|
}
|
|
3261
|
+
var DEFAULT_LINKS = [
|
|
3262
|
+
{
|
|
3263
|
+
label: "Your orders",
|
|
3264
|
+
href: "/account/orders",
|
|
3265
|
+
icon: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": true, children: [
|
|
3266
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z" }),
|
|
3267
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 6h18" }),
|
|
3268
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16 10a4 4 0 0 1-8 0" })
|
|
3269
|
+
] })
|
|
3270
|
+
},
|
|
3271
|
+
{
|
|
3272
|
+
label: "Addresses",
|
|
3273
|
+
href: "/account/addresses",
|
|
3274
|
+
icon: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": true, children: [
|
|
3275
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 21s-7-5.5-7-11a7 7 0 0 1 14 0c0 5.5-7 11-7 11Z" }),
|
|
3276
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "10", r: "2.5" })
|
|
3277
|
+
] })
|
|
3278
|
+
},
|
|
3279
|
+
{
|
|
3280
|
+
label: "Payment methods",
|
|
3281
|
+
href: "/account/payment",
|
|
3282
|
+
icon: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": true, children: [
|
|
3283
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "2", y: "5", width: "20", height: "14", rx: "2" }),
|
|
3284
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 10h20" })
|
|
3285
|
+
] })
|
|
3286
|
+
},
|
|
3287
|
+
{
|
|
3288
|
+
label: "Account",
|
|
3289
|
+
href: "/account",
|
|
3290
|
+
icon: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": true, children: [
|
|
3291
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "3" }),
|
|
3292
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2v3M12 19v3M4.2 4.2l2.1 2.1M17.7 17.7l2.1 2.1M2 12h3M19 12h3M4.2 19.8l2.1-2.1M17.7 6.3l2.1-2.1" })
|
|
3293
|
+
] })
|
|
3294
|
+
}
|
|
3295
|
+
];
|
|
3296
|
+
var LinkIcon = /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": true, children: [
|
|
3297
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 13.5a4 4 0 0 0 5.6 0l3-3a4 4 0 0 0-5.6-5.6L11.5 6.4" }),
|
|
3298
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M14 10.5a4 4 0 0 0-5.6 0l-3 3a4 4 0 0 0 5.6 5.6l1.5-1.5" })
|
|
3299
|
+
] });
|
|
3300
|
+
var ExternalIcon = /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "13", height: "13", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": true, className: "ml-auto opacity-50", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M7 17 17 7M9 7h8v8" }) });
|
|
3301
|
+
function Avatar({ seed, name, size }) {
|
|
3302
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3303
|
+
"span",
|
|
3304
|
+
{
|
|
3305
|
+
"aria-hidden": true,
|
|
3306
|
+
className: "grid place-items-center rounded-full font-serif font-semibold text-white shrink-0",
|
|
3307
|
+
style: { width: size, height: size, fontSize: size * 0.4, background: avatarGradient(seed) },
|
|
3308
|
+
children: initials(name)
|
|
3309
|
+
}
|
|
3310
|
+
);
|
|
3311
|
+
}
|
|
3312
|
+
function CimplifyUserButton({
|
|
3313
|
+
session: controlledSession,
|
|
3314
|
+
sessionUri,
|
|
3315
|
+
links = DEFAULT_LINKS,
|
|
3316
|
+
identityUrl = "https://link.cimplify.io",
|
|
3317
|
+
signOutHref = "/auth/signout",
|
|
3318
|
+
onSignOut,
|
|
3319
|
+
clientId,
|
|
3320
|
+
redirectUri,
|
|
3321
|
+
signInLabel,
|
|
3322
|
+
onSignIn,
|
|
3323
|
+
hideName,
|
|
3324
|
+
align = "end",
|
|
3325
|
+
className
|
|
3326
|
+
}) {
|
|
3327
|
+
const controlled = controlledSession !== void 0;
|
|
3328
|
+
const hook = useCimplifySession({ sessionUri });
|
|
3329
|
+
const session = controlled ? controlledSession : hook.session;
|
|
3330
|
+
const loading = controlled ? false : hook.loading;
|
|
3331
|
+
const [open, setOpen] = React12.useState(false);
|
|
3332
|
+
const rootRef = React12.useRef(null);
|
|
3333
|
+
const menuId = React12.useId();
|
|
3334
|
+
React12.useEffect(() => {
|
|
3335
|
+
if (!open) return;
|
|
3336
|
+
const onDocClick = (e) => {
|
|
3337
|
+
if (!rootRef.current?.contains(e.target)) setOpen(false);
|
|
3338
|
+
};
|
|
3339
|
+
const onKey = (e) => {
|
|
3340
|
+
if (e.key === "Escape") setOpen(false);
|
|
3341
|
+
};
|
|
3342
|
+
document.addEventListener("mousedown", onDocClick);
|
|
3343
|
+
document.addEventListener("keydown", onKey);
|
|
3344
|
+
return () => {
|
|
3345
|
+
document.removeEventListener("mousedown", onDocClick);
|
|
3346
|
+
document.removeEventListener("keydown", onKey);
|
|
3347
|
+
};
|
|
3348
|
+
}, [open]);
|
|
3349
|
+
if (loading) {
|
|
3350
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("inline-flex items-center", className), "data-cimplify-user-button": "loading", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-8 rounded-full bg-muted/60 animate-pulse" }) });
|
|
3351
|
+
}
|
|
3352
|
+
if (!session) {
|
|
3353
|
+
if (!clientId || !redirectUri) return null;
|
|
3354
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3355
|
+
CimplifySignInButton,
|
|
3356
|
+
{
|
|
3357
|
+
variant: "outline",
|
|
3358
|
+
label: signInLabel ?? "Sign in",
|
|
3359
|
+
clientId,
|
|
3360
|
+
redirectUri,
|
|
3361
|
+
onSuccess: onSignIn,
|
|
3362
|
+
className
|
|
3363
|
+
}
|
|
3364
|
+
);
|
|
3365
|
+
}
|
|
3366
|
+
const name = session.name?.trim() || session.email || "Account";
|
|
3367
|
+
const seed = session.sub || name;
|
|
3368
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: rootRef, className: cn("relative inline-block", className), "data-cimplify-user-button": true, children: [
|
|
3369
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3370
|
+
"button",
|
|
3371
|
+
{
|
|
3372
|
+
type: "button",
|
|
3373
|
+
onClick: () => setOpen((v) => !v),
|
|
3374
|
+
"aria-haspopup": "menu",
|
|
3375
|
+
"aria-expanded": open,
|
|
3376
|
+
"aria-controls": menuId,
|
|
3377
|
+
className: cn(
|
|
3378
|
+
"inline-flex items-center gap-2 rounded-full border border-border bg-card p-1 pr-2.5",
|
|
3379
|
+
"shadow-[0_1px_2px_rgba(16,24,40,0.06)] transition-colors cursor-pointer",
|
|
3380
|
+
"hover:border-foreground/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
|
|
3381
|
+
hideName && "pr-1"
|
|
3382
|
+
),
|
|
3383
|
+
children: [
|
|
3384
|
+
/* @__PURE__ */ jsxRuntime.jsx(Avatar, { seed, name, size: 28 }),
|
|
3385
|
+
!hideName && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "max-w-[120px] truncate text-[13px] font-semibold text-foreground", children: session.name?.split(/\s+/)[0] || name }),
|
|
3386
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3387
|
+
"svg",
|
|
3388
|
+
{
|
|
3389
|
+
width: "13",
|
|
3390
|
+
height: "13",
|
|
3391
|
+
viewBox: "0 0 24 24",
|
|
3392
|
+
fill: "none",
|
|
3393
|
+
stroke: "currentColor",
|
|
3394
|
+
strokeWidth: "2.2",
|
|
3395
|
+
"aria-hidden": true,
|
|
3396
|
+
className: cn("text-foreground/45 transition-transform", open && "rotate-180"),
|
|
3397
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m6 9 6 6 6-6" })
|
|
3398
|
+
}
|
|
3399
|
+
)
|
|
3400
|
+
]
|
|
3401
|
+
}
|
|
3402
|
+
),
|
|
3403
|
+
open && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3404
|
+
"div",
|
|
3405
|
+
{
|
|
3406
|
+
id: menuId,
|
|
3407
|
+
role: "menu",
|
|
3408
|
+
className: cn(
|
|
3409
|
+
"absolute top-[calc(100%+8px)] z-50 w-[280px] overflow-hidden",
|
|
3410
|
+
"rounded-[14px] border border-border bg-card",
|
|
3411
|
+
"shadow-[0_1px_2px_rgba(16,24,40,0.04),0_16px_40px_-16px_rgba(16,24,40,0.24)]",
|
|
3412
|
+
align === "end" ? "right-0" : "left-0"
|
|
3413
|
+
),
|
|
3414
|
+
children: [
|
|
3415
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3 border-b border-border/60 p-3.5", children: [
|
|
3416
|
+
/* @__PURE__ */ jsxRuntime.jsx(Avatar, { seed, name, size: 40 }),
|
|
3417
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
|
|
3418
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate text-[14px] font-semibold text-foreground", children: name }),
|
|
3419
|
+
session.email && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate text-[12px] text-foreground/55", children: session.email })
|
|
3420
|
+
] })
|
|
3421
|
+
] }),
|
|
3422
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-1.5", children: [
|
|
3423
|
+
links.map((link) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3424
|
+
"a",
|
|
3425
|
+
{
|
|
3426
|
+
role: "menuitem",
|
|
3427
|
+
href: link.href,
|
|
3428
|
+
target: link.external ? "_blank" : void 0,
|
|
3429
|
+
rel: link.external ? "noreferrer" : void 0,
|
|
3430
|
+
className: "flex items-center gap-3 rounded-[9px] px-3 py-2 text-[13.5px] text-foreground hover:bg-muted/50",
|
|
3431
|
+
children: [
|
|
3432
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground/45", children: link.icon }),
|
|
3433
|
+
link.label,
|
|
3434
|
+
link.external && ExternalIcon
|
|
3435
|
+
]
|
|
3436
|
+
},
|
|
3437
|
+
link.href
|
|
3438
|
+
)),
|
|
3439
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-1.5 h-px bg-border/60" }),
|
|
3440
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3441
|
+
"a",
|
|
3442
|
+
{
|
|
3443
|
+
role: "menuitem",
|
|
3444
|
+
href: identityUrl,
|
|
3445
|
+
target: "_blank",
|
|
3446
|
+
rel: "noreferrer",
|
|
3447
|
+
className: "flex items-center gap-3 rounded-[9px] px-3 py-2 text-[13.5px] text-foreground hover:bg-muted/50",
|
|
3448
|
+
children: [
|
|
3449
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground/45", children: LinkIcon }),
|
|
3450
|
+
"Manage Cimplify identity",
|
|
3451
|
+
ExternalIcon
|
|
3452
|
+
]
|
|
3453
|
+
}
|
|
3454
|
+
),
|
|
3455
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3456
|
+
"form",
|
|
3457
|
+
{
|
|
3458
|
+
method: "post",
|
|
3459
|
+
action: signOutHref,
|
|
3460
|
+
onSubmit: onSignOut ? () => onSignOut() : void 0,
|
|
3461
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3462
|
+
"button",
|
|
3463
|
+
{
|
|
3464
|
+
type: "submit",
|
|
3465
|
+
role: "menuitem",
|
|
3466
|
+
className: "flex w-full items-center gap-3 rounded-[9px] px-3 py-2 text-[13.5px] text-destructive hover:bg-destructive/10",
|
|
3467
|
+
children: [
|
|
3468
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": true, children: [
|
|
3469
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }),
|
|
3470
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m16 17 5-5-5-5M21 12H9" })
|
|
3471
|
+
] }),
|
|
3472
|
+
"Sign out"
|
|
3473
|
+
]
|
|
3474
|
+
}
|
|
3475
|
+
)
|
|
3476
|
+
}
|
|
3477
|
+
)
|
|
3478
|
+
] })
|
|
3479
|
+
]
|
|
3480
|
+
}
|
|
3481
|
+
)
|
|
3482
|
+
] });
|
|
3483
|
+
}
|
|
3353
3484
|
function Price({ amount, currency, className, prefix }) {
|
|
3354
3485
|
const context = useOptionalCimplify();
|
|
3355
3486
|
const resolvedCurrency = currency ?? context?.displayCurrency ?? "USD";
|
|
@@ -5114,15 +5245,15 @@ function AuthElement({
|
|
|
5114
5245
|
}, [onReady, onAuthenticated, onError]);
|
|
5115
5246
|
React12.useEffect(() => {
|
|
5116
5247
|
if (!elements || !containerRef.current) return;
|
|
5117
|
-
const element = elements.create(
|
|
5248
|
+
const element = elements.create(chunkWCSAZRNC_js.ELEMENT_TYPES.AUTH, { prefillEmail });
|
|
5118
5249
|
elementRef.current = element;
|
|
5119
|
-
element.on(
|
|
5250
|
+
element.on(chunkWCSAZRNC_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
5120
5251
|
element.on(
|
|
5121
|
-
|
|
5252
|
+
chunkWCSAZRNC_js.EVENT_TYPES.AUTHENTICATED,
|
|
5122
5253
|
(data) => onAuthenticatedRef.current?.(data)
|
|
5123
5254
|
);
|
|
5124
5255
|
element.on(
|
|
5125
|
-
|
|
5256
|
+
chunkWCSAZRNC_js.EVENT_TYPES.ERROR,
|
|
5126
5257
|
(data) => onErrorRef.current?.(data)
|
|
5127
5258
|
);
|
|
5128
5259
|
element.mount(containerRef.current);
|
|
@@ -5151,15 +5282,15 @@ function AddressElement({
|
|
|
5151
5282
|
}, [onReady, onChange, onError]);
|
|
5152
5283
|
React12.useEffect(() => {
|
|
5153
5284
|
if (!elements || !containerRef.current) return;
|
|
5154
|
-
const element = elements.create(
|
|
5285
|
+
const element = elements.create(chunkWCSAZRNC_js.ELEMENT_TYPES.ADDRESS, { mode });
|
|
5155
5286
|
elementRef.current = element;
|
|
5156
|
-
element.on(
|
|
5287
|
+
element.on(chunkWCSAZRNC_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
5157
5288
|
element.on(
|
|
5158
|
-
|
|
5289
|
+
chunkWCSAZRNC_js.EVENT_TYPES.CHANGE,
|
|
5159
5290
|
(data) => onChangeRef.current?.(data)
|
|
5160
5291
|
);
|
|
5161
5292
|
element.on(
|
|
5162
|
-
|
|
5293
|
+
chunkWCSAZRNC_js.EVENT_TYPES.ERROR,
|
|
5163
5294
|
(data) => onErrorRef.current?.(data)
|
|
5164
5295
|
);
|
|
5165
5296
|
element.mount(containerRef.current);
|
|
@@ -5189,15 +5320,15 @@ function PaymentElement({
|
|
|
5189
5320
|
}, [onReady, onChange, onError]);
|
|
5190
5321
|
React12.useEffect(() => {
|
|
5191
5322
|
if (!elements || !containerRef.current) return;
|
|
5192
|
-
const element = elements.create(
|
|
5323
|
+
const element = elements.create(chunkWCSAZRNC_js.ELEMENT_TYPES.PAYMENT, { amount, currency });
|
|
5193
5324
|
elementRef.current = element;
|
|
5194
|
-
element.on(
|
|
5325
|
+
element.on(chunkWCSAZRNC_js.EVENT_TYPES.READY, () => onReadyRef.current?.());
|
|
5195
5326
|
element.on(
|
|
5196
|
-
|
|
5327
|
+
chunkWCSAZRNC_js.EVENT_TYPES.CHANGE,
|
|
5197
5328
|
(data) => onChangeRef.current?.(data)
|
|
5198
5329
|
);
|
|
5199
5330
|
element.on(
|
|
5200
|
-
|
|
5331
|
+
chunkWCSAZRNC_js.EVENT_TYPES.ERROR,
|
|
5201
5332
|
(data) => onErrorRef.current?.(data)
|
|
5202
5333
|
);
|
|
5203
5334
|
element.mount(containerRef.current);
|
|
@@ -15712,10 +15843,10 @@ exports.CategoryGrid = CategoryGrid;
|
|
|
15712
15843
|
exports.ChatWidget = ChatWidget;
|
|
15713
15844
|
exports.CheckIcon = CheckIcon;
|
|
15714
15845
|
exports.CheckoutPage = CheckoutPage;
|
|
15715
|
-
exports.CimplifyAccount = CimplifyAccount;
|
|
15716
15846
|
exports.CimplifyCheckout = CimplifyCheckout;
|
|
15717
15847
|
exports.CimplifyProvider = CimplifyProvider;
|
|
15718
15848
|
exports.CimplifySignInButton = CimplifySignInButton;
|
|
15849
|
+
exports.CimplifyUserButton = CimplifyUserButton;
|
|
15719
15850
|
exports.CollectionPage = CollectionPage;
|
|
15720
15851
|
exports.CollectionTemplate = CollectionTemplate;
|
|
15721
15852
|
exports.CompactCartLayout = CompactCartLayout;
|