@fluid-app/portal-sdk 0.1.209 → 0.1.210
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/{FluidProvider-CVYSJW9G.cjs → FluidProvider-CZSbUoDH.cjs} +3 -3
- package/dist/{FluidProvider-CVYSJW9G.cjs.map → FluidProvider-CZSbUoDH.cjs.map} +1 -1
- package/dist/{FluidProvider-BhXU4mXn.mjs → FluidProvider-DBh92Dz3.mjs} +3 -3
- package/dist/{FluidProvider-BhXU4mXn.mjs.map → FluidProvider-DBh92Dz3.mjs.map} +1 -1
- package/dist/{MessagingScreen-lOhqghg5.cjs → MessagingScreen-C9pAZqA0.cjs} +2 -2
- package/dist/{MessagingScreen-lOhqghg5.cjs.map → MessagingScreen-C9pAZqA0.cjs.map} +1 -1
- package/dist/{MessagingScreen-DZPzRM2a.mjs → MessagingScreen-DhtepYkU.mjs} +2 -2
- package/dist/{MessagingScreen-DZPzRM2a.mjs.map → MessagingScreen-DhtepYkU.mjs.map} +1 -1
- package/dist/{MessagingScreen-CneT3yWA.cjs → MessagingScreen-FyP5WFDU.cjs} +3 -3
- package/dist/{ProfileScreen-CJlMCpIM.cjs → ProfileScreen-0ZfgjXvC.cjs} +3 -3
- package/dist/{ProfileScreen-BVlyq4I8.mjs → ProfileScreen-BEZneAry.mjs} +2 -2
- package/dist/{ProfileScreen-BVlyq4I8.mjs.map → ProfileScreen-BEZneAry.mjs.map} +1 -1
- package/dist/{ProfileScreen-DToaxnsZ.cjs → ProfileScreen-Dyh4GP76.cjs} +2 -2
- package/dist/{ProfileScreen-DToaxnsZ.cjs.map → ProfileScreen-Dyh4GP76.cjs.map} +1 -1
- package/dist/QuickShareWidget-BdAgexWk.cjs +583 -0
- package/dist/QuickShareWidget-BdAgexWk.cjs.map +1 -0
- package/dist/QuickShareWidget-CunkC1r8.mjs +566 -0
- package/dist/QuickShareWidget-CunkC1r8.mjs.map +1 -0
- package/dist/{ShopScreen-dkt4YuUO.cjs → ShopScreen-D06ln7AW.cjs} +2 -2
- package/dist/{ShopScreen-dkt4YuUO.cjs.map → ShopScreen-D06ln7AW.cjs.map} +1 -1
- package/dist/{ShopScreen-7s5O5oFR.cjs → ShopScreen-DTtw168w.cjs} +3 -3
- package/dist/{ShopScreen-DAZC9E9E.mjs → ShopScreen-DeVoH7co.mjs} +2 -2
- package/dist/{ShopScreen-DAZC9E9E.mjs.map → ShopScreen-DeVoH7co.mjs.map} +1 -1
- package/dist/index.cjs +11 -11
- package/dist/index.d.cts +7 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +7 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +11 -11
- package/package.json +17 -17
- package/dist/QuickShareWidget-DRbErOlt.cjs +0 -268
- package/dist/QuickShareWidget-DRbErOlt.cjs.map +0 -1
- package/dist/QuickShareWidget-Dbjueevf.mjs +0 -251
- package/dist/QuickShareWidget-Dbjueevf.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuickShareWidget-BdAgexWk.cjs","names":["Package","FileText","Ticket","ImageIcon","BookOpen","CircleDot","borderWidthClasses","borderColorClasses","QRCodeSVG","Check","Copy","ShoppingCart","Mail","MessageCircle","Share2","getFontSizeField","getColorField","getPaddingField","getBorderRadiusField","getBorderWidthField","getBorderColorField"],"sources":["../../widgets/src/widgets/QuickShareWidget.tsx"],"sourcesContent":["import {\n useEffect,\n useState,\n type ComponentProps,\n type CSSProperties,\n} from \"react\";\nimport type React from \"react\";\nimport type {\n BorderRadiusOptions,\n BorderWidthOptions,\n ColorOptions,\n FontSizeOptions,\n PaddingOptions,\n ShareableItem,\n} from \"@fluid-app/portal-core/types\";\nimport type { WidgetPropertySchema } from \"@fluid-app/portal-core/registries\";\nimport {\n borderColorClasses,\n borderWidthClasses,\n getBorderColorField,\n getBorderRadiusField,\n getBorderWidthField,\n getColorField,\n getFontSizeField,\n getPaddingField,\n} from \"../core/fields\";\nimport { QRCodeSVG } from \"qrcode.react\";\nimport {\n BookOpen,\n Check,\n CircleDot,\n Copy,\n FileText,\n Image as ImageIcon,\n Mail,\n MessageCircle,\n Package,\n Share2,\n ShoppingCart,\n Ticket,\n type LucideIcon,\n} from \"lucide-react\";\n\ntype QuickShareWidgetProps = ComponentProps<\"div\"> & {\n // Resource\n shareableResource?: ShareableItem;\n\n // Title\n titleEnabled?: boolean;\n titleText?: string;\n titleFontSize?: FontSizeOptions;\n titleColor?: ColorOptions;\n\n // Styling\n textColor?: ColorOptions;\n accentColor?: ColorOptions;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n borderWidth?: BorderWidthOptions;\n borderColor?: ColorOptions;\n\n // Overlay\n overlayEnabled?: boolean;\n overlayType?: \"solid\" | \"gradient\";\n overlayIntensity?: number;\n\n // Actions\n showBuyButton?: boolean;\n\n // Polish (new, additive)\n showResourceType?: boolean;\n showShareActions?: boolean;\n showDomainPrefix?: boolean;\n};\n\ntype ResourceDescriptor = {\n label: string;\n icon: LucideIcon;\n};\n\ntype QuickShareCSSProperties = CSSProperties &\n Record<`--${string}`, string | number | undefined>;\n\nconst RESOURCE_TYPE_MAP: Record<string, ResourceDescriptor> = {\n Product: { label: \"Product\", icon: Package },\n Page: { label: \"Page\", icon: FileText },\n EnrollmentPack: { label: \"Enrollment\", icon: Ticket },\n Medium: { label: \"Media\", icon: ImageIcon },\n Library: { label: \"Library\", icon: BookOpen },\n};\n\nconst getResourceDescriptor = (\n resource: ShareableItem | undefined,\n): ResourceDescriptor | null => {\n const rawType = (resource?.type || resource?.shareableType || \"\") as string;\n if (!rawType) return null;\n return RESOURCE_TYPE_MAP[rawType] ?? { label: rawType, icon: CircleDot };\n};\n\nconst splitUrl = (url: string): { prefix: string; path: string } => {\n try {\n const parsed = new URL(url);\n return {\n prefix: `${parsed.protocol}//${parsed.host}`,\n path: `${parsed.pathname}${parsed.search}${parsed.hash}`,\n };\n } catch {\n return { prefix: \"\", path: url };\n }\n};\n\nconst CURRENCY_FIELD_KEYS = [\n \"currency\",\n \"currency_code\",\n \"currencyCode\",\n \"currencyIso\",\n \"currency_iso\",\n] as const;\n\nconst getResourceCurrency = (\n resource: ShareableItem | undefined,\n): string | null => {\n if (!resource) return null;\n for (const key of CURRENCY_FIELD_KEYS) {\n const value = resource[key];\n if (typeof value === \"string\" && /^[A-Z]{3}$/i.test(value)) {\n return value.toUpperCase();\n }\n }\n return null;\n};\n\nconst formatNumericPrice = (price: number, resource: ShareableItem): string => {\n const currency = getResourceCurrency(resource);\n if (!currency) return String(price);\n try {\n return price.toLocaleString(undefined, { style: \"currency\", currency });\n } catch {\n return String(price);\n }\n};\n\nconst getDisplayPrice = (\n resource: ShareableItem | undefined,\n): string | null => {\n if (!resource) return null;\n if (typeof resource.display_price === \"string\" && resource.display_price) {\n return resource.display_price;\n }\n if (resource.price != null) {\n return typeof resource.price === \"number\"\n ? formatNumericPrice(resource.price, resource)\n : String(resource.price);\n }\n return null;\n};\n\nconst getColorCssValue = (color: ColorOptions): string =>\n color === \"transparent\" ? \"transparent\" : `var(--color-${color})`;\n\nconst colorMix = (color: ColorOptions, amount: number): string =>\n color === \"transparent\"\n ? \"transparent\"\n : `color-mix(in oklch, ${getColorCssValue(color)} ${amount}%, transparent)`;\n\nconst insetBorder = (color: ColorOptions, amount: number): string =>\n `inset 0 0 0 1px ${colorMix(color, amount)}`;\n\nexport function QuickShareWidget({\n shareableResource,\n\n titleEnabled = true,\n titleText = \"\",\n titleFontSize = \"2xl\",\n titleColor = \"background\",\n\n textColor = \"background\",\n accentColor = \"primary\",\n padding = 6,\n borderRadius = \"xl\",\n borderWidth = \"none\",\n borderColor = \"muted\",\n\n overlayEnabled = true,\n overlayType = \"gradient\",\n overlayIntensity = 70,\n\n showBuyButton = false,\n\n showResourceType = true,\n showShareActions = true,\n showDomainPrefix = true,\n\n className,\n style,\n ...props\n}: QuickShareWidgetProps): React.JSX.Element {\n const [copyState, setCopyState] = useState<\"idle\" | \"copied\">(\"idle\");\n // Hero image fallback: if the resource image 404s or fails to decode, flip\n // to the EmptyHero treatment instead of rendering a broken image.\n const [imageFailed, setImageFailed] = useState(false);\n\n useEffect(() => {\n if (copyState !== \"copied\") return;\n const id = window.setTimeout(() => setCopyState(\"idle\"), 1600);\n return () => window.clearTimeout(id);\n }, [copyState]);\n\n const backgroundImageUrl =\n shareableResource?.image_url || shareableResource?.imageUrl || \"\";\n\n // Reset the failed-image state when the resource (and thus the image URL)\n // changes — otherwise switching to a new resource keeps showing EmptyHero\n // because the React state outlives the previous load failure.\n useEffect(() => {\n setImageFailed(false);\n }, [backgroundImageUrl]);\n\n const showHeroImage = Boolean(backgroundImageUrl) && !imageFailed;\n const shareLink = shareableResource?.share_link || \"\";\n const hasShareLink = !!shareLink;\n\n const displayTitle =\n titleText || shareableResource?.title || \"Select content to share\";\n const resourceDescriptor = getResourceDescriptor(shareableResource);\n const displayPrice = getDisplayPrice(shareableResource);\n\n const isProduct =\n shareableResource?.type === \"Product\" ||\n shareableResource?.shareableType === \"Product\";\n const shouldShowBuyButton = showBuyButton && isProduct;\n\n const parsedOverlayIntensity = Number(\n String(overlayIntensity).replace(\"%\", \"\"),\n );\n const overlayOpacity =\n (Number.isFinite(parsedOverlayIntensity)\n ? Math.min(100, Math.max(0, parsedOverlayIntensity))\n : 70) / 100;\n\n const editorialGradient: CSSProperties | undefined =\n overlayEnabled && showHeroImage\n ? {\n background: `linear-gradient(to top, color-mix(in oklch, var(--color-foreground) ${Math.round(overlayOpacity * 100)}%, transparent), color-mix(in oklch, var(--color-foreground) ${Math.round(overlayOpacity * 55)}%, transparent) 45%, transparent 85%)`,\n }\n : undefined;\n\n const handleCopy = async () => {\n if (!hasShareLink) return;\n try {\n await navigator.clipboard.writeText(shareLink);\n setCopyState(\"copied\");\n } catch (error) {\n console.error(\"Failed to copy to clipboard:\", error);\n }\n };\n\n const handleNativeShare = async () => {\n if (!hasShareLink) return;\n if (typeof navigator.share === \"function\") {\n try {\n await navigator.share({\n title: displayTitle,\n url: shareLink,\n });\n } catch {\n // Ignore abort\n }\n } else {\n await handleCopy();\n }\n };\n\n const { prefix, path } = hasShareLink\n ? splitUrl(shareLink)\n : { prefix: \"\", path: \"\" };\n\n return (\n <div\n className={`relative isolate overflow-hidden rounded-${borderRadius} ${borderWidthClasses[borderWidth]} ${borderWidth !== \"none\" ? borderColorClasses[borderColor] : \"\"} bg-muted text-${textColor} ${className ?? \"\"}`}\n style={{\n // Themed dual-shadow (crisp + soft ambient), derived from the\n // foreground token so the lift reads in both light and dark.\n boxShadow: `0 1px 2px color-mix(in oklch, var(--color-foreground) 4%, transparent), 0 20px 40px -20px color-mix(in oklch, var(--color-foreground) 25%, transparent)`,\n ...style,\n }}\n {...props}\n >\n {/* Hero image or empty-state surface */}\n {showHeroImage ? (\n <div className=\"absolute inset-0\">\n <img\n src={backgroundImageUrl}\n alt=\"\"\n loading=\"lazy\"\n onError={() => setImageFailed(true)}\n className=\"h-full w-full object-cover\"\n />\n {overlayEnabled && (\n <>\n {/* Layer 1 — main bottom-to-top legibility gradient */}\n <div\n className=\"pointer-events-none absolute inset-0\"\n style={editorialGradient}\n />\n {/* Layer 2 — diagonal bottom-left anchor (image reads top-right, content reads bottom-left) */}\n <div\n className=\"pointer-events-none absolute inset-0\"\n style={{\n background: `linear-gradient(to top right, color-mix(in oklch, var(--color-foreground) ${Math.round(overlayOpacity * 65)}%, transparent), color-mix(in oklch, var(--color-foreground) ${Math.round(overlayOpacity * 25)}%, transparent) 35%, transparent 65%)`,\n }}\n />\n {/* Layer 3 — radial pool anchoring the bottom-left share panel */}\n <div\n className=\"pointer-events-none absolute inset-0\"\n style={{\n background: `radial-gradient(ellipse 70% 55% at 15% 100%, color-mix(in oklch, var(--color-foreground) ${Math.round(overlayOpacity * 45)}%, transparent), transparent 70%)`,\n }}\n />\n {overlayType === \"solid\" && (\n <div\n className=\"bg-foreground pointer-events-none absolute inset-0\"\n style={{ opacity: overlayOpacity * 0.35 }}\n />\n )}\n </>\n )}\n </div>\n ) : (\n <EmptyHero accentColor={accentColor} textColor={textColor} />\n )}\n\n {/* Content */}\n <div className={`relative flex min-h-[440px] flex-col p-${padding}`}>\n {/* Top row: resource type eyebrow + optional price chip */}\n {(showResourceType && resourceDescriptor) || displayPrice ? (\n <div className=\"flex items-start justify-between gap-3\">\n {showResourceType && resourceDescriptor ? (\n (() => {\n const { icon: ResourceIcon, label } = resourceDescriptor;\n return (\n <span\n className={`inline-flex items-center gap-1.5 rounded-${borderRadius} bg-${textColor}/15 px-2.5 py-1 text-[10px] font-bold tracking-[0.18em] uppercase text-${textColor} backdrop-blur-sm`}\n style={{\n boxShadow: insetBorder(textColor, 15),\n }}\n >\n <ResourceIcon className=\"size-3\" />\n {label}\n </span>\n );\n })()\n ) : (\n <span />\n )}\n {displayPrice && (\n <span\n className={`inline-flex items-center rounded-${borderRadius} bg-${accentColor} px-2.5 py-1 text-[11px] font-bold tabular-nums text-${accentColor}-foreground`}\n style={{\n boxShadow: `0 4px 14px -4px color-mix(in oklch, var(--color-foreground) 30%, transparent)`,\n }}\n >\n {displayPrice}\n </span>\n )}\n </div>\n ) : null}\n\n {/* Middle: spacer that keeps share panel bottom-anchored.\n Optional title renders inside it without changing layout rhythm. */}\n <div className=\"mt-4 flex flex-1 flex-col justify-end\">\n {titleEnabled && displayTitle && (\n <h2\n className={`text-${titleFontSize} font-header leading-[1.12] font-bold tracking-[-0.015em] text-${titleColor}`}\n style={{\n // Themed via foreground so the legibility shadow flips with\n // the title color when the theme switches to dark mode.\n textShadow: showHeroImage\n ? `0 2px 12px color-mix(in oklch, var(--color-foreground) 40%, transparent)`\n : undefined,\n }}\n >\n {displayTitle}\n </h2>\n )}\n </div>\n\n {/* Bottom: share panel */}\n <div className=\"mt-6 flex flex-col gap-3\">\n <div className=\"flex items-stretch gap-3\">\n {/* QR card */}\n <div\n className={`group relative shrink-0 rounded-${borderRadius} bg-white p-2.5 transition-transform duration-300 hover:scale-[1.02]`}\n style={{\n // QR card stays white for scanner contrast; lift shadow is\n // themed via foreground so it reads in dark mode too.\n boxShadow: `0 4px 16px -4px color-mix(in oklch, var(--color-foreground) 25%, transparent), inset 0 0 0 1px rgba(255,255,255,0.4)`,\n }}\n aria-label=\"QR code for share link\"\n >\n <QRCodeSVG\n value={shareLink || \"https://example.com\"}\n size={96}\n level=\"H\"\n bgColor=\"#ffffff\"\n fgColor=\"#0f172a\"\n />\n </div>\n\n {/* URL chip + share actions rail */}\n <div className=\"flex min-w-0 flex-1 flex-col gap-2\">\n <span\n className={`text-[10px] font-bold tracking-[0.16em] uppercase text-${textColor}/70`}\n >\n Share link\n </span>\n <button\n type=\"button\"\n onClick={handleCopy}\n disabled={!hasShareLink}\n aria-label={\n copyState === \"copied\" ? \"Copied to clipboard\" : \"Copy link\"\n }\n className={`group flex items-center justify-between gap-2 rounded-${borderRadius} bg-${textColor}/10 px-3 py-2 text-left text-[12px] backdrop-blur-sm transition-all duration-300 hover:bg-${textColor}/15 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--quick-share-focus-ring)] disabled:opacity-50 ${copyState === \"copied\" ? `bg-${accentColor}/20` : \"\"}`}\n style={\n {\n \"--quick-share-focus-ring\": colorMix(accentColor, 40),\n boxShadow: insetBorder(textColor, 15),\n } as QuickShareCSSProperties\n }\n >\n <span\n className={`min-w-0 flex-1 truncate font-medium tabular-nums text-${textColor}`}\n >\n {hasShareLink ? (\n <>\n {showDomainPrefix && prefix && (\n <span className={`opacity-60`}>{prefix}</span>\n )}\n <span className=\"font-semibold\">{path}</span>\n </>\n ) : (\n <span className={`opacity-60`}>No link yet</span>\n )}\n </span>\n <span\n className={`flex size-7 shrink-0 items-center justify-center rounded-full transition-all duration-300 ${copyState === \"copied\" ? `bg-${accentColor} text-${accentColor}-foreground scale-110` : `bg-${textColor}/15 text-${textColor}`}`}\n >\n {copyState === \"copied\" ? (\n <Check className=\"size-3.5\" />\n ) : (\n <Copy className=\"size-3.5\" />\n )}\n </span>\n </button>\n <span className=\"sr-only\" aria-live=\"polite\" role=\"status\">\n {copyState === \"copied\" ? \"Copied to clipboard\" : \"\"}\n </span>\n\n {showShareActions && (\n <ShareActionRow\n shareLink={shareLink}\n displayTitle={displayTitle}\n accentColor={accentColor}\n textColor={textColor}\n borderRadius={borderRadius}\n onNative={handleNativeShare}\n />\n )}\n </div>\n </div>\n\n {shouldShowBuyButton &&\n (hasShareLink ? (\n <a\n href={shareLink}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={`flex w-full items-center justify-center gap-2 rounded-${borderRadius} bg-${accentColor} px-4 py-3 text-[13px] font-bold text-${accentColor}-foreground transition-transform hover:scale-[1.01]`}\n style={{\n boxShadow: `0 8px 22px -8px color-mix(in oklch, var(--color-foreground) 35%, transparent)`,\n }}\n >\n <ShoppingCart className=\"size-4\" />\n <span>Buy now</span>\n </a>\n ) : (\n <button\n type=\"button\"\n disabled\n className={`flex w-full cursor-not-allowed items-center justify-center gap-2 rounded-${borderRadius} bg-${accentColor} px-4 py-3 text-[13px] font-bold text-${accentColor}-foreground opacity-50`}\n style={{\n boxShadow: `0 8px 22px -8px color-mix(in oklch, var(--color-foreground) 35%, transparent)`,\n }}\n >\n <ShoppingCart className=\"size-4\" />\n <span>Buy now</span>\n </button>\n ))}\n </div>\n </div>\n </div>\n );\n}\n\ntype ShareActionRowProps = {\n shareLink: string;\n displayTitle: string;\n accentColor: ColorOptions;\n textColor: ColorOptions;\n borderRadius: BorderRadiusOptions;\n onNative: () => void;\n};\n\nfunction ShareActionRow({\n shareLink,\n displayTitle,\n accentColor,\n textColor,\n borderRadius,\n onNative,\n}: ShareActionRowProps) {\n const disabled = !shareLink;\n const [canNativeShare, setCanNativeShare] = useState(false);\n const [canSendSms, setCanSendSms] = useState(false);\n\n useEffect(() => {\n setCanNativeShare(\n typeof navigator !== \"undefined\" && typeof navigator.share === \"function\",\n );\n setCanSendSms(\n typeof navigator !== \"undefined\" &&\n (/Android|iPhone|iPad|iPod/i.test(navigator.userAgent) ||\n (/Macintosh/i.test(navigator.userAgent) &&\n navigator.maxTouchPoints > 1)),\n );\n }, []);\n\n const emailHref = shareLink\n ? `mailto:?subject=${encodeURIComponent(displayTitle)}&body=${encodeURIComponent(shareLink)}`\n : undefined;\n const smsHref = shareLink\n ? `sms:?body=${encodeURIComponent(`${displayTitle} — ${shareLink}`)}`\n : undefined;\n\n return (\n <div className=\"flex items-center gap-1.5\">\n <ShareActionButton\n icon={Mail}\n label=\"Email\"\n href={emailHref}\n disabled={disabled}\n accentColor={accentColor}\n textColor={textColor}\n borderRadius={borderRadius}\n />\n {canSendSms && (\n <ShareActionButton\n icon={MessageCircle}\n label=\"Text\"\n href={smsHref}\n disabled={disabled}\n accentColor={accentColor}\n textColor={textColor}\n borderRadius={borderRadius}\n />\n )}\n {canNativeShare && (\n <ShareActionButton\n icon={Share2}\n label=\"Share\"\n onClick={onNative}\n disabled={disabled}\n accentColor={accentColor}\n textColor={textColor}\n borderRadius={borderRadius}\n />\n )}\n </div>\n );\n}\n\ntype ShareActionButtonProps = {\n icon: LucideIcon;\n label: string;\n href?: string | undefined;\n onClick?: () => void;\n disabled: boolean;\n accentColor: ColorOptions;\n textColor: ColorOptions;\n borderRadius: BorderRadiusOptions;\n};\n\nfunction ShareActionButton({\n icon: Icon,\n label,\n href,\n onClick,\n disabled,\n accentColor,\n textColor,\n borderRadius,\n}: ShareActionButtonProps) {\n const className = `group inline-flex items-center gap-1.5 rounded-${borderRadius} bg-${textColor}/10 px-2.5 py-1.5 text-[11px] font-semibold text-${textColor} backdrop-blur-sm transition-all duration-200 hover:-translate-y-0.5 hover:bg-${accentColor} hover:text-${accentColor}-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--quick-share-focus-ring)] disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:translate-y-0`;\n const style: QuickShareCSSProperties = {\n \"--quick-share-focus-ring\": colorMix(accentColor, 40),\n boxShadow: insetBorder(textColor, 15),\n };\n\n const content = (\n <>\n <Icon className=\"size-3\" />\n <span>{label}</span>\n </>\n );\n\n if (href && !disabled) {\n return (\n <a href={href} className={className} style={style} aria-label={label}>\n {content}\n </a>\n );\n }\n\n return (\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n className={className}\n style={style}\n aria-label={label}\n >\n {content}\n </button>\n );\n}\n\nfunction EmptyHero({\n accentColor,\n textColor,\n}: {\n accentColor: ColorOptions;\n textColor: ColorOptions;\n}) {\n return (\n <div className={`bg-muted absolute inset-0`}>\n <div\n className=\"absolute inset-0\"\n style={{\n background: `radial-gradient(circle at 30% 20%, ${colorMix(accentColor, 15)}, transparent 60%), radial-gradient(circle at 80% 90%, ${colorMix(accentColor, 10)}, transparent 55%)`,\n }}\n />\n <div className=\"absolute inset-0 flex flex-col items-center justify-center gap-3\">\n <div\n className={`flex size-14 items-center justify-center rounded-2xl bg-${textColor}/5`}\n style={{ boxShadow: insetBorder(textColor, 10) }}\n >\n <ImageIcon className={`size-6 text-${textColor}/40`} />\n </div>\n <span\n className={`text-[10px] font-bold tracking-[0.2em] uppercase text-${textColor}/45`}\n >\n Nothing selected\n </span>\n </div>\n </div>\n );\n}\n\nexport const quickShareWidgetPropertySchema: WidgetPropertySchema = {\n widgetType: \"QuickShareWidget\",\n displayName: \"Quick Share Widget\",\n tabsConfig: [{ id: \"styling\", label: \"Styling\" }],\n fields: [\n // Content\n {\n key: \"shareableResource\",\n label: \"Shareable Content\",\n type: \"resource\",\n description: \"Select the content to generate a share link for\",\n allowedTypes: [\"Product\", \"Page\", \"EnrollmentPack\", \"Medium\", \"Library\"],\n tab: \"styling\",\n group: \"Content\",\n },\n\n // Title\n {\n key: \"titleEnabled\",\n label: \"Show Title\",\n type: \"boolean\",\n description: \"Display a title on the hero\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Title\",\n },\n {\n key: \"titleText\",\n label: \"Title\",\n type: \"text\",\n description:\n \"Custom title text (defaults to the resource title if empty)\",\n defaultValue: \"\",\n tab: \"styling\",\n group: \"Title\",\n requiresKeyToBeTrue: \"titleEnabled\",\n },\n getFontSizeField({\n key: \"titleFontSize\",\n label: \"Title Font Size\",\n description: \"Font size for the title\",\n defaultValue: \"2xl\",\n tab: \"styling\",\n group: \"Title\",\n requiresKeyToBeTrue: \"titleEnabled\",\n }),\n getColorField({\n key: \"titleColor\",\n label: \"Title Color\",\n description: \"Color for the title\",\n defaultValue: \"background\",\n tab: \"styling\",\n group: \"Title\",\n requiresKeyToBeTrue: \"titleEnabled\",\n }),\n\n // Share panel polish (new)\n {\n key: \"showResourceType\",\n label: \"Show Resource Type Pill\",\n type: \"boolean\",\n description:\n \"Display a small type eyebrow chip (Product · Page · Media…)\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Share Panel\",\n },\n {\n key: \"showShareActions\",\n label: \"Show Share Actions\",\n type: \"boolean\",\n description:\n \"Show Email, Text, and native Share buttons under the link chip\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Share Panel\",\n },\n {\n key: \"showDomainPrefix\",\n label: \"Show Domain Prefix\",\n type: \"boolean\",\n description:\n \"Include the domain in the link chip (dimmed) with the path emphasized\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Share Panel\",\n },\n {\n key: \"showBuyButton\",\n label: \"Show Buy Button\",\n type: \"boolean\",\n description: \"Display the Buy button (only shown for Product resources)\",\n defaultValue: false,\n tab: \"styling\",\n group: \"Share Panel\",\n },\n\n // Design\n getColorField({\n key: \"textColor\",\n label: \"Text Color\",\n description: \"Default text color for widget content (over the hero)\",\n defaultValue: \"background\",\n tab: \"styling\",\n group: \"Design\",\n }),\n getColorField({\n key: \"accentColor\",\n label: \"Accent Color\",\n description:\n \"Drives the price chip, primary button, and copy-success flash\",\n defaultValue: \"primary\",\n tab: \"styling\",\n group: \"Design\",\n }),\n {\n key: \"overlayEnabled\",\n label: \"Enable Overlay\",\n type: \"boolean\",\n description: \"Add editorial gradient stack for legibility over the hero\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"overlayType\",\n label: \"Overlay Type\",\n type: \"buttonGroup\",\n description:\n \"Gradient only (recommended) or gradient + solid wash (heavier)\",\n defaultValue: \"gradient\",\n options: [\n { label: \"Gradient\", value: \"gradient\" },\n { label: \"Solid\", value: \"solid\" },\n ],\n tab: \"styling\",\n group: \"Design\",\n requiresKeyToBeTrue: \"overlayEnabled\",\n },\n {\n key: \"overlayIntensity\",\n label: \"Overlay Intensity\",\n type: \"slider\",\n description: \"Opacity of the overlay (0-100)\",\n min: 0,\n max: 100,\n step: 5,\n defaultValue: 70,\n unit: \"%\",\n tab: \"styling\",\n group: \"Design\",\n requiresKeyToBeTrue: \"overlayEnabled\",\n },\n {\n key: \"separator\",\n type: \"separator\",\n label: \"Separator\",\n tab: \"styling\",\n group: \"Design\",\n },\n getPaddingField({\n key: \"padding\",\n label: \"Padding\",\n description: \"Padding around the widget content\",\n defaultValue: 6,\n tab: \"styling\",\n group: \"Design\",\n }),\n getBorderRadiusField({\n key: \"borderRadius\",\n label: \"Border Radius\",\n description: \"Border radius for the widget container\",\n defaultValue: \"xl\",\n tab: \"styling\",\n group: \"Design\",\n }),\n getBorderWidthField({\n key: \"borderWidth\",\n label: \"Border Width\",\n description: \"Border width for the widget container\",\n defaultValue: \"none\",\n tab: \"styling\",\n group: \"Design\",\n }),\n getBorderColorField({\n key: \"borderColor\",\n label: \"Border Color\",\n description: \"Border color for the widget container\",\n defaultValue: \"muted\",\n tab: \"styling\",\n group: \"Design\",\n }),\n ],\n} as const satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;;;;;AAmFA,MAAM,oBAAwD;CAC5D,SAAS;EAAE,OAAO;EAAW,MAAMA,aAAAA;EAAS;CAC5C,MAAM;EAAE,OAAO;EAAQ,MAAMC,aAAAA;EAAU;CACvC,gBAAgB;EAAE,OAAO;EAAc,MAAMC,aAAAA;EAAQ;CACrD,QAAQ;EAAE,OAAO;EAAS,MAAMC,aAAAA;EAAW;CAC3C,SAAS;EAAE,OAAO;EAAW,MAAMC,aAAAA;EAAU;C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AAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aACE;GACF,cAAc;GACd,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB;EACDY,mBAAAA,iBAAiB;GACf,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB,CAAC;EACFC,mBAAAA,cAAc;GACZ,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB,CAAC;EAGF;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aACE;GACF,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aACE;GACF,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aACE;GACF,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EAGDA,mBAAAA,cAAc;GACZ,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;EACFA,mBAAAA,cAAc;GACZ,KAAK;GACL,OAAO;GACP,aACE;GACF,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;EACF;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aACE;GACF,cAAc;GACd,SAAS,CACP;IAAE,OAAO;IAAY,OAAO;IAAY,EACxC;IAAE,OAAO;IAAS,OAAO;IAAS,CACnC;GACD,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,KAAK;GACL,KAAK;GACL,MAAM;GACN,cAAc;GACd,MAAM;GACN,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB;EACD;GACE,KAAK;GACL,MAAM;GACN,OAAO;GACP,KAAK;GACL,OAAO;GACR;EACDC,mBAAAA,gBAAgB;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;EACFC,mBAAAA,qBAAqB;GACnB,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;EACFC,mBAAAA,oBAAoB;GAClB,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;EACFC,mBAAAA,oBAAoB;GAClB,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;EACH;CACF"}
|
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
import { r as __exportAll } from "./es-DmEK0Umf.mjs";
|
|
2
|
+
import { i as getBorderColorField, l as getColorField, m as getPaddingField, n as borderWidthClasses, o as getBorderRadiusField, s as getBorderWidthField, t as borderColorClasses, u as getFontSizeField } from "./registries-DT36l-bR.mjs";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { BookOpen, Check, CircleDot, Copy, FileText, Image, Mail, MessageCircle, Package, Share2, ShoppingCart, Ticket } from "lucide-react";
|
|
6
|
+
import { QRCodeSVG } from "qrcode.react";
|
|
7
|
+
//#region ../widgets/src/widgets/QuickShareWidget.tsx
|
|
8
|
+
var QuickShareWidget_exports = /* @__PURE__ */ __exportAll({
|
|
9
|
+
QuickShareWidget: () => QuickShareWidget,
|
|
10
|
+
quickShareWidgetPropertySchema: () => quickShareWidgetPropertySchema
|
|
11
|
+
});
|
|
12
|
+
const RESOURCE_TYPE_MAP = {
|
|
13
|
+
Product: {
|
|
14
|
+
label: "Product",
|
|
15
|
+
icon: Package
|
|
16
|
+
},
|
|
17
|
+
Page: {
|
|
18
|
+
label: "Page",
|
|
19
|
+
icon: FileText
|
|
20
|
+
},
|
|
21
|
+
EnrollmentPack: {
|
|
22
|
+
label: "Enrollment",
|
|
23
|
+
icon: Ticket
|
|
24
|
+
},
|
|
25
|
+
Medium: {
|
|
26
|
+
label: "Media",
|
|
27
|
+
icon: Image
|
|
28
|
+
},
|
|
29
|
+
Library: {
|
|
30
|
+
label: "Library",
|
|
31
|
+
icon: BookOpen
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const getResourceDescriptor = (resource) => {
|
|
35
|
+
const rawType = resource?.type || resource?.shareableType || "";
|
|
36
|
+
if (!rawType) return null;
|
|
37
|
+
return RESOURCE_TYPE_MAP[rawType] ?? {
|
|
38
|
+
label: rawType,
|
|
39
|
+
icon: CircleDot
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
const splitUrl = (url) => {
|
|
43
|
+
try {
|
|
44
|
+
const parsed = new URL(url);
|
|
45
|
+
return {
|
|
46
|
+
prefix: `${parsed.protocol}//${parsed.host}`,
|
|
47
|
+
path: `${parsed.pathname}${parsed.search}${parsed.hash}`
|
|
48
|
+
};
|
|
49
|
+
} catch {
|
|
50
|
+
return {
|
|
51
|
+
prefix: "",
|
|
52
|
+
path: url
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const CURRENCY_FIELD_KEYS = [
|
|
57
|
+
"currency",
|
|
58
|
+
"currency_code",
|
|
59
|
+
"currencyCode",
|
|
60
|
+
"currencyIso",
|
|
61
|
+
"currency_iso"
|
|
62
|
+
];
|
|
63
|
+
const getResourceCurrency = (resource) => {
|
|
64
|
+
if (!resource) return null;
|
|
65
|
+
for (const key of CURRENCY_FIELD_KEYS) {
|
|
66
|
+
const value = resource[key];
|
|
67
|
+
if (typeof value === "string" && /^[A-Z]{3}$/i.test(value)) return value.toUpperCase();
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
};
|
|
71
|
+
const formatNumericPrice = (price, resource) => {
|
|
72
|
+
const currency = getResourceCurrency(resource);
|
|
73
|
+
if (!currency) return String(price);
|
|
74
|
+
try {
|
|
75
|
+
return price.toLocaleString(void 0, {
|
|
76
|
+
style: "currency",
|
|
77
|
+
currency
|
|
78
|
+
});
|
|
79
|
+
} catch {
|
|
80
|
+
return String(price);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const getDisplayPrice = (resource) => {
|
|
84
|
+
if (!resource) return null;
|
|
85
|
+
if (typeof resource.display_price === "string" && resource.display_price) return resource.display_price;
|
|
86
|
+
if (resource.price != null) return typeof resource.price === "number" ? formatNumericPrice(resource.price, resource) : String(resource.price);
|
|
87
|
+
return null;
|
|
88
|
+
};
|
|
89
|
+
const getColorCssValue = (color) => color === "transparent" ? "transparent" : `var(--color-${color})`;
|
|
90
|
+
const colorMix = (color, amount) => color === "transparent" ? "transparent" : `color-mix(in oklch, ${getColorCssValue(color)} ${amount}%, transparent)`;
|
|
91
|
+
const insetBorder = (color, amount) => `inset 0 0 0 1px ${colorMix(color, amount)}`;
|
|
92
|
+
function QuickShareWidget({ shareableResource, titleEnabled = true, titleText = "", titleFontSize = "2xl", titleColor = "background", textColor = "background", accentColor = "primary", padding = 6, borderRadius = "xl", borderWidth = "none", borderColor = "muted", overlayEnabled = true, overlayType = "gradient", overlayIntensity = 70, showBuyButton = false, showResourceType = true, showShareActions = true, showDomainPrefix = true, className, style, ...props }) {
|
|
93
|
+
const [copyState, setCopyState] = useState("idle");
|
|
94
|
+
const [imageFailed, setImageFailed] = useState(false);
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
if (copyState !== "copied") return;
|
|
97
|
+
const id = window.setTimeout(() => setCopyState("idle"), 1600);
|
|
98
|
+
return () => window.clearTimeout(id);
|
|
99
|
+
}, [copyState]);
|
|
100
|
+
const backgroundImageUrl = shareableResource?.image_url || shareableResource?.imageUrl || "";
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
setImageFailed(false);
|
|
103
|
+
}, [backgroundImageUrl]);
|
|
104
|
+
const showHeroImage = Boolean(backgroundImageUrl) && !imageFailed;
|
|
105
|
+
const shareLink = shareableResource?.share_link || "";
|
|
106
|
+
const hasShareLink = !!shareLink;
|
|
107
|
+
const displayTitle = titleText || shareableResource?.title || "Select content to share";
|
|
108
|
+
const resourceDescriptor = getResourceDescriptor(shareableResource);
|
|
109
|
+
const displayPrice = getDisplayPrice(shareableResource);
|
|
110
|
+
const isProduct = shareableResource?.type === "Product" || shareableResource?.shareableType === "Product";
|
|
111
|
+
const shouldShowBuyButton = showBuyButton && isProduct;
|
|
112
|
+
const parsedOverlayIntensity = Number(String(overlayIntensity).replace("%", ""));
|
|
113
|
+
const overlayOpacity = (Number.isFinite(parsedOverlayIntensity) ? Math.min(100, Math.max(0, parsedOverlayIntensity)) : 70) / 100;
|
|
114
|
+
const editorialGradient = overlayEnabled && showHeroImage ? { background: `linear-gradient(to top, color-mix(in oklch, var(--color-foreground) ${Math.round(overlayOpacity * 100)}%, transparent), color-mix(in oklch, var(--color-foreground) ${Math.round(overlayOpacity * 55)}%, transparent) 45%, transparent 85%)` } : void 0;
|
|
115
|
+
const handleCopy = async () => {
|
|
116
|
+
if (!hasShareLink) return;
|
|
117
|
+
try {
|
|
118
|
+
await navigator.clipboard.writeText(shareLink);
|
|
119
|
+
setCopyState("copied");
|
|
120
|
+
} catch (error) {
|
|
121
|
+
console.error("Failed to copy to clipboard:", error);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const handleNativeShare = async () => {
|
|
125
|
+
if (!hasShareLink) return;
|
|
126
|
+
if (typeof navigator.share === "function") try {
|
|
127
|
+
await navigator.share({
|
|
128
|
+
title: displayTitle,
|
|
129
|
+
url: shareLink
|
|
130
|
+
});
|
|
131
|
+
} catch {}
|
|
132
|
+
else await handleCopy();
|
|
133
|
+
};
|
|
134
|
+
const { prefix, path } = hasShareLink ? splitUrl(shareLink) : {
|
|
135
|
+
prefix: "",
|
|
136
|
+
path: ""
|
|
137
|
+
};
|
|
138
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
139
|
+
className: `relative isolate overflow-hidden rounded-${borderRadius} ${borderWidthClasses[borderWidth]} ${borderWidth !== "none" ? borderColorClasses[borderColor] : ""} bg-muted text-${textColor} ${className ?? ""}`,
|
|
140
|
+
style: {
|
|
141
|
+
boxShadow: `0 1px 2px color-mix(in oklch, var(--color-foreground) 4%, transparent), 0 20px 40px -20px color-mix(in oklch, var(--color-foreground) 25%, transparent)`,
|
|
142
|
+
...style
|
|
143
|
+
},
|
|
144
|
+
...props,
|
|
145
|
+
children: [showHeroImage ? /* @__PURE__ */ jsxs("div", {
|
|
146
|
+
className: "absolute inset-0",
|
|
147
|
+
children: [/* @__PURE__ */ jsx("img", {
|
|
148
|
+
src: backgroundImageUrl,
|
|
149
|
+
alt: "",
|
|
150
|
+
loading: "lazy",
|
|
151
|
+
onError: () => setImageFailed(true),
|
|
152
|
+
className: "h-full w-full object-cover"
|
|
153
|
+
}), overlayEnabled && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
154
|
+
/* @__PURE__ */ jsx("div", {
|
|
155
|
+
className: "pointer-events-none absolute inset-0",
|
|
156
|
+
style: editorialGradient
|
|
157
|
+
}),
|
|
158
|
+
/* @__PURE__ */ jsx("div", {
|
|
159
|
+
className: "pointer-events-none absolute inset-0",
|
|
160
|
+
style: { background: `linear-gradient(to top right, color-mix(in oklch, var(--color-foreground) ${Math.round(overlayOpacity * 65)}%, transparent), color-mix(in oklch, var(--color-foreground) ${Math.round(overlayOpacity * 25)}%, transparent) 35%, transparent 65%)` }
|
|
161
|
+
}),
|
|
162
|
+
/* @__PURE__ */ jsx("div", {
|
|
163
|
+
className: "pointer-events-none absolute inset-0",
|
|
164
|
+
style: { background: `radial-gradient(ellipse 70% 55% at 15% 100%, color-mix(in oklch, var(--color-foreground) ${Math.round(overlayOpacity * 45)}%, transparent), transparent 70%)` }
|
|
165
|
+
}),
|
|
166
|
+
overlayType === "solid" && /* @__PURE__ */ jsx("div", {
|
|
167
|
+
className: "bg-foreground pointer-events-none absolute inset-0",
|
|
168
|
+
style: { opacity: overlayOpacity * .35 }
|
|
169
|
+
})
|
|
170
|
+
] })]
|
|
171
|
+
}) : /* @__PURE__ */ jsx(EmptyHero, {
|
|
172
|
+
accentColor,
|
|
173
|
+
textColor
|
|
174
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
175
|
+
className: `relative flex min-h-[440px] flex-col p-${padding}`,
|
|
176
|
+
children: [
|
|
177
|
+
showResourceType && resourceDescriptor || displayPrice ? /* @__PURE__ */ jsxs("div", {
|
|
178
|
+
className: "flex items-start justify-between gap-3",
|
|
179
|
+
children: [showResourceType && resourceDescriptor ? (() => {
|
|
180
|
+
const { icon: ResourceIcon, label } = resourceDescriptor;
|
|
181
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
182
|
+
className: `inline-flex items-center gap-1.5 rounded-${borderRadius} bg-${textColor}/15 px-2.5 py-1 text-[10px] font-bold tracking-[0.18em] uppercase text-${textColor} backdrop-blur-sm`,
|
|
183
|
+
style: { boxShadow: insetBorder(textColor, 15) },
|
|
184
|
+
children: [/* @__PURE__ */ jsx(ResourceIcon, { className: "size-3" }), label]
|
|
185
|
+
});
|
|
186
|
+
})() : /* @__PURE__ */ jsx("span", {}), displayPrice && /* @__PURE__ */ jsx("span", {
|
|
187
|
+
className: `inline-flex items-center rounded-${borderRadius} bg-${accentColor} px-2.5 py-1 text-[11px] font-bold tabular-nums text-${accentColor}-foreground`,
|
|
188
|
+
style: { boxShadow: `0 4px 14px -4px color-mix(in oklch, var(--color-foreground) 30%, transparent)` },
|
|
189
|
+
children: displayPrice
|
|
190
|
+
})]
|
|
191
|
+
}) : null,
|
|
192
|
+
/* @__PURE__ */ jsx("div", {
|
|
193
|
+
className: "mt-4 flex flex-1 flex-col justify-end",
|
|
194
|
+
children: titleEnabled && displayTitle && /* @__PURE__ */ jsx("h2", {
|
|
195
|
+
className: `text-${titleFontSize} font-header leading-[1.12] font-bold tracking-[-0.015em] text-${titleColor}`,
|
|
196
|
+
style: { textShadow: showHeroImage ? `0 2px 12px color-mix(in oklch, var(--color-foreground) 40%, transparent)` : void 0 },
|
|
197
|
+
children: displayTitle
|
|
198
|
+
})
|
|
199
|
+
}),
|
|
200
|
+
/* @__PURE__ */ jsxs("div", {
|
|
201
|
+
className: "mt-6 flex flex-col gap-3",
|
|
202
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
203
|
+
className: "flex items-stretch gap-3",
|
|
204
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
205
|
+
className: `group relative shrink-0 rounded-${borderRadius} bg-white p-2.5 transition-transform duration-300 hover:scale-[1.02]`,
|
|
206
|
+
style: { boxShadow: `0 4px 16px -4px color-mix(in oklch, var(--color-foreground) 25%, transparent), inset 0 0 0 1px rgba(255,255,255,0.4)` },
|
|
207
|
+
"aria-label": "QR code for share link",
|
|
208
|
+
children: /* @__PURE__ */ jsx(QRCodeSVG, {
|
|
209
|
+
value: shareLink || "https://example.com",
|
|
210
|
+
size: 96,
|
|
211
|
+
level: "H",
|
|
212
|
+
bgColor: "#ffffff",
|
|
213
|
+
fgColor: "#0f172a"
|
|
214
|
+
})
|
|
215
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
216
|
+
className: "flex min-w-0 flex-1 flex-col gap-2",
|
|
217
|
+
children: [
|
|
218
|
+
/* @__PURE__ */ jsx("span", {
|
|
219
|
+
className: `text-[10px] font-bold tracking-[0.16em] uppercase text-${textColor}/70`,
|
|
220
|
+
children: "Share link"
|
|
221
|
+
}),
|
|
222
|
+
/* @__PURE__ */ jsxs("button", {
|
|
223
|
+
type: "button",
|
|
224
|
+
onClick: handleCopy,
|
|
225
|
+
disabled: !hasShareLink,
|
|
226
|
+
"aria-label": copyState === "copied" ? "Copied to clipboard" : "Copy link",
|
|
227
|
+
className: `group flex items-center justify-between gap-2 rounded-${borderRadius} bg-${textColor}/10 px-3 py-2 text-left text-[12px] backdrop-blur-sm transition-all duration-300 hover:bg-${textColor}/15 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--quick-share-focus-ring)] disabled:opacity-50 ${copyState === "copied" ? `bg-${accentColor}/20` : ""}`,
|
|
228
|
+
style: {
|
|
229
|
+
"--quick-share-focus-ring": colorMix(accentColor, 40),
|
|
230
|
+
boxShadow: insetBorder(textColor, 15)
|
|
231
|
+
},
|
|
232
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
233
|
+
className: `min-w-0 flex-1 truncate font-medium tabular-nums text-${textColor}`,
|
|
234
|
+
children: hasShareLink ? /* @__PURE__ */ jsxs(Fragment$1, { children: [showDomainPrefix && prefix && /* @__PURE__ */ jsx("span", {
|
|
235
|
+
className: `opacity-60`,
|
|
236
|
+
children: prefix
|
|
237
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
238
|
+
className: "font-semibold",
|
|
239
|
+
children: path
|
|
240
|
+
})] }) : /* @__PURE__ */ jsx("span", {
|
|
241
|
+
className: `opacity-60`,
|
|
242
|
+
children: "No link yet"
|
|
243
|
+
})
|
|
244
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
245
|
+
className: `flex size-7 shrink-0 items-center justify-center rounded-full transition-all duration-300 ${copyState === "copied" ? `bg-${accentColor} text-${accentColor}-foreground scale-110` : `bg-${textColor}/15 text-${textColor}`}`,
|
|
246
|
+
children: copyState === "copied" ? /* @__PURE__ */ jsx(Check, { className: "size-3.5" }) : /* @__PURE__ */ jsx(Copy, { className: "size-3.5" })
|
|
247
|
+
})]
|
|
248
|
+
}),
|
|
249
|
+
/* @__PURE__ */ jsx("span", {
|
|
250
|
+
className: "sr-only",
|
|
251
|
+
"aria-live": "polite",
|
|
252
|
+
role: "status",
|
|
253
|
+
children: copyState === "copied" ? "Copied to clipboard" : ""
|
|
254
|
+
}),
|
|
255
|
+
showShareActions && /* @__PURE__ */ jsx(ShareActionRow, {
|
|
256
|
+
shareLink,
|
|
257
|
+
displayTitle,
|
|
258
|
+
accentColor,
|
|
259
|
+
textColor,
|
|
260
|
+
borderRadius,
|
|
261
|
+
onNative: handleNativeShare
|
|
262
|
+
})
|
|
263
|
+
]
|
|
264
|
+
})]
|
|
265
|
+
}), shouldShowBuyButton && (hasShareLink ? /* @__PURE__ */ jsxs("a", {
|
|
266
|
+
href: shareLink,
|
|
267
|
+
target: "_blank",
|
|
268
|
+
rel: "noopener noreferrer",
|
|
269
|
+
className: `flex w-full items-center justify-center gap-2 rounded-${borderRadius} bg-${accentColor} px-4 py-3 text-[13px] font-bold text-${accentColor}-foreground transition-transform hover:scale-[1.01]`,
|
|
270
|
+
style: { boxShadow: `0 8px 22px -8px color-mix(in oklch, var(--color-foreground) 35%, transparent)` },
|
|
271
|
+
children: [/* @__PURE__ */ jsx(ShoppingCart, { className: "size-4" }), /* @__PURE__ */ jsx("span", { children: "Buy now" })]
|
|
272
|
+
}) : /* @__PURE__ */ jsxs("button", {
|
|
273
|
+
type: "button",
|
|
274
|
+
disabled: true,
|
|
275
|
+
className: `flex w-full cursor-not-allowed items-center justify-center gap-2 rounded-${borderRadius} bg-${accentColor} px-4 py-3 text-[13px] font-bold text-${accentColor}-foreground opacity-50`,
|
|
276
|
+
style: { boxShadow: `0 8px 22px -8px color-mix(in oklch, var(--color-foreground) 35%, transparent)` },
|
|
277
|
+
children: [/* @__PURE__ */ jsx(ShoppingCart, { className: "size-4" }), /* @__PURE__ */ jsx("span", { children: "Buy now" })]
|
|
278
|
+
}))]
|
|
279
|
+
})
|
|
280
|
+
]
|
|
281
|
+
})]
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
function ShareActionRow({ shareLink, displayTitle, accentColor, textColor, borderRadius, onNative }) {
|
|
285
|
+
const disabled = !shareLink;
|
|
286
|
+
const [canNativeShare, setCanNativeShare] = useState(false);
|
|
287
|
+
const [canSendSms, setCanSendSms] = useState(false);
|
|
288
|
+
useEffect(() => {
|
|
289
|
+
setCanNativeShare(typeof navigator !== "undefined" && typeof navigator.share === "function");
|
|
290
|
+
setCanSendSms(typeof navigator !== "undefined" && (/Android|iPhone|iPad|iPod/i.test(navigator.userAgent) || /Macintosh/i.test(navigator.userAgent) && navigator.maxTouchPoints > 1));
|
|
291
|
+
}, []);
|
|
292
|
+
const emailHref = shareLink ? `mailto:?subject=${encodeURIComponent(displayTitle)}&body=${encodeURIComponent(shareLink)}` : void 0;
|
|
293
|
+
const smsHref = shareLink ? `sms:?body=${encodeURIComponent(`${displayTitle} — ${shareLink}`)}` : void 0;
|
|
294
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
295
|
+
className: "flex items-center gap-1.5",
|
|
296
|
+
children: [
|
|
297
|
+
/* @__PURE__ */ jsx(ShareActionButton, {
|
|
298
|
+
icon: Mail,
|
|
299
|
+
label: "Email",
|
|
300
|
+
href: emailHref,
|
|
301
|
+
disabled,
|
|
302
|
+
accentColor,
|
|
303
|
+
textColor,
|
|
304
|
+
borderRadius
|
|
305
|
+
}),
|
|
306
|
+
canSendSms && /* @__PURE__ */ jsx(ShareActionButton, {
|
|
307
|
+
icon: MessageCircle,
|
|
308
|
+
label: "Text",
|
|
309
|
+
href: smsHref,
|
|
310
|
+
disabled,
|
|
311
|
+
accentColor,
|
|
312
|
+
textColor,
|
|
313
|
+
borderRadius
|
|
314
|
+
}),
|
|
315
|
+
canNativeShare && /* @__PURE__ */ jsx(ShareActionButton, {
|
|
316
|
+
icon: Share2,
|
|
317
|
+
label: "Share",
|
|
318
|
+
onClick: onNative,
|
|
319
|
+
disabled,
|
|
320
|
+
accentColor,
|
|
321
|
+
textColor,
|
|
322
|
+
borderRadius
|
|
323
|
+
})
|
|
324
|
+
]
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
function ShareActionButton({ icon: Icon, label, href, onClick, disabled, accentColor, textColor, borderRadius }) {
|
|
328
|
+
const className = `group inline-flex items-center gap-1.5 rounded-${borderRadius} bg-${textColor}/10 px-2.5 py-1.5 text-[11px] font-semibold text-${textColor} backdrop-blur-sm transition-all duration-200 hover:-translate-y-0.5 hover:bg-${accentColor} hover:text-${accentColor}-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--quick-share-focus-ring)] disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:translate-y-0`;
|
|
329
|
+
const style = {
|
|
330
|
+
"--quick-share-focus-ring": colorMix(accentColor, 40),
|
|
331
|
+
boxShadow: insetBorder(textColor, 15)
|
|
332
|
+
};
|
|
333
|
+
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Icon, { className: "size-3" }), /* @__PURE__ */ jsx("span", { children: label })] });
|
|
334
|
+
if (href && !disabled) return /* @__PURE__ */ jsx("a", {
|
|
335
|
+
href,
|
|
336
|
+
className,
|
|
337
|
+
style,
|
|
338
|
+
"aria-label": label,
|
|
339
|
+
children: content
|
|
340
|
+
});
|
|
341
|
+
return /* @__PURE__ */ jsx("button", {
|
|
342
|
+
type: "button",
|
|
343
|
+
onClick,
|
|
344
|
+
disabled,
|
|
345
|
+
className,
|
|
346
|
+
style,
|
|
347
|
+
"aria-label": label,
|
|
348
|
+
children: content
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
function EmptyHero({ accentColor, textColor }) {
|
|
352
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
353
|
+
className: `bg-muted absolute inset-0`,
|
|
354
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
355
|
+
className: "absolute inset-0",
|
|
356
|
+
style: { background: `radial-gradient(circle at 30% 20%, ${colorMix(accentColor, 15)}, transparent 60%), radial-gradient(circle at 80% 90%, ${colorMix(accentColor, 10)}, transparent 55%)` }
|
|
357
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
358
|
+
className: "absolute inset-0 flex flex-col items-center justify-center gap-3",
|
|
359
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
360
|
+
className: `flex size-14 items-center justify-center rounded-2xl bg-${textColor}/5`,
|
|
361
|
+
style: { boxShadow: insetBorder(textColor, 10) },
|
|
362
|
+
children: /* @__PURE__ */ jsx(Image, { className: `size-6 text-${textColor}/40` })
|
|
363
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
364
|
+
className: `text-[10px] font-bold tracking-[0.2em] uppercase text-${textColor}/45`,
|
|
365
|
+
children: "Nothing selected"
|
|
366
|
+
})]
|
|
367
|
+
})]
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
const quickShareWidgetPropertySchema = {
|
|
371
|
+
widgetType: "QuickShareWidget",
|
|
372
|
+
displayName: "Quick Share Widget",
|
|
373
|
+
tabsConfig: [{
|
|
374
|
+
id: "styling",
|
|
375
|
+
label: "Styling"
|
|
376
|
+
}],
|
|
377
|
+
fields: [
|
|
378
|
+
{
|
|
379
|
+
key: "shareableResource",
|
|
380
|
+
label: "Shareable Content",
|
|
381
|
+
type: "resource",
|
|
382
|
+
description: "Select the content to generate a share link for",
|
|
383
|
+
allowedTypes: [
|
|
384
|
+
"Product",
|
|
385
|
+
"Page",
|
|
386
|
+
"EnrollmentPack",
|
|
387
|
+
"Medium",
|
|
388
|
+
"Library"
|
|
389
|
+
],
|
|
390
|
+
tab: "styling",
|
|
391
|
+
group: "Content"
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
key: "titleEnabled",
|
|
395
|
+
label: "Show Title",
|
|
396
|
+
type: "boolean",
|
|
397
|
+
description: "Display a title on the hero",
|
|
398
|
+
defaultValue: true,
|
|
399
|
+
tab: "styling",
|
|
400
|
+
group: "Title"
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
key: "titleText",
|
|
404
|
+
label: "Title",
|
|
405
|
+
type: "text",
|
|
406
|
+
description: "Custom title text (defaults to the resource title if empty)",
|
|
407
|
+
defaultValue: "",
|
|
408
|
+
tab: "styling",
|
|
409
|
+
group: "Title",
|
|
410
|
+
requiresKeyToBeTrue: "titleEnabled"
|
|
411
|
+
},
|
|
412
|
+
getFontSizeField({
|
|
413
|
+
key: "titleFontSize",
|
|
414
|
+
label: "Title Font Size",
|
|
415
|
+
description: "Font size for the title",
|
|
416
|
+
defaultValue: "2xl",
|
|
417
|
+
tab: "styling",
|
|
418
|
+
group: "Title",
|
|
419
|
+
requiresKeyToBeTrue: "titleEnabled"
|
|
420
|
+
}),
|
|
421
|
+
getColorField({
|
|
422
|
+
key: "titleColor",
|
|
423
|
+
label: "Title Color",
|
|
424
|
+
description: "Color for the title",
|
|
425
|
+
defaultValue: "background",
|
|
426
|
+
tab: "styling",
|
|
427
|
+
group: "Title",
|
|
428
|
+
requiresKeyToBeTrue: "titleEnabled"
|
|
429
|
+
}),
|
|
430
|
+
{
|
|
431
|
+
key: "showResourceType",
|
|
432
|
+
label: "Show Resource Type Pill",
|
|
433
|
+
type: "boolean",
|
|
434
|
+
description: "Display a small type eyebrow chip (Product · Page · Media…)",
|
|
435
|
+
defaultValue: true,
|
|
436
|
+
tab: "styling",
|
|
437
|
+
group: "Share Panel"
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
key: "showShareActions",
|
|
441
|
+
label: "Show Share Actions",
|
|
442
|
+
type: "boolean",
|
|
443
|
+
description: "Show Email, Text, and native Share buttons under the link chip",
|
|
444
|
+
defaultValue: true,
|
|
445
|
+
tab: "styling",
|
|
446
|
+
group: "Share Panel"
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
key: "showDomainPrefix",
|
|
450
|
+
label: "Show Domain Prefix",
|
|
451
|
+
type: "boolean",
|
|
452
|
+
description: "Include the domain in the link chip (dimmed) with the path emphasized",
|
|
453
|
+
defaultValue: true,
|
|
454
|
+
tab: "styling",
|
|
455
|
+
group: "Share Panel"
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
key: "showBuyButton",
|
|
459
|
+
label: "Show Buy Button",
|
|
460
|
+
type: "boolean",
|
|
461
|
+
description: "Display the Buy button (only shown for Product resources)",
|
|
462
|
+
defaultValue: false,
|
|
463
|
+
tab: "styling",
|
|
464
|
+
group: "Share Panel"
|
|
465
|
+
},
|
|
466
|
+
getColorField({
|
|
467
|
+
key: "textColor",
|
|
468
|
+
label: "Text Color",
|
|
469
|
+
description: "Default text color for widget content (over the hero)",
|
|
470
|
+
defaultValue: "background",
|
|
471
|
+
tab: "styling",
|
|
472
|
+
group: "Design"
|
|
473
|
+
}),
|
|
474
|
+
getColorField({
|
|
475
|
+
key: "accentColor",
|
|
476
|
+
label: "Accent Color",
|
|
477
|
+
description: "Drives the price chip, primary button, and copy-success flash",
|
|
478
|
+
defaultValue: "primary",
|
|
479
|
+
tab: "styling",
|
|
480
|
+
group: "Design"
|
|
481
|
+
}),
|
|
482
|
+
{
|
|
483
|
+
key: "overlayEnabled",
|
|
484
|
+
label: "Enable Overlay",
|
|
485
|
+
type: "boolean",
|
|
486
|
+
description: "Add editorial gradient stack for legibility over the hero",
|
|
487
|
+
defaultValue: true,
|
|
488
|
+
tab: "styling",
|
|
489
|
+
group: "Design"
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
key: "overlayType",
|
|
493
|
+
label: "Overlay Type",
|
|
494
|
+
type: "buttonGroup",
|
|
495
|
+
description: "Gradient only (recommended) or gradient + solid wash (heavier)",
|
|
496
|
+
defaultValue: "gradient",
|
|
497
|
+
options: [{
|
|
498
|
+
label: "Gradient",
|
|
499
|
+
value: "gradient"
|
|
500
|
+
}, {
|
|
501
|
+
label: "Solid",
|
|
502
|
+
value: "solid"
|
|
503
|
+
}],
|
|
504
|
+
tab: "styling",
|
|
505
|
+
group: "Design",
|
|
506
|
+
requiresKeyToBeTrue: "overlayEnabled"
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
key: "overlayIntensity",
|
|
510
|
+
label: "Overlay Intensity",
|
|
511
|
+
type: "slider",
|
|
512
|
+
description: "Opacity of the overlay (0-100)",
|
|
513
|
+
min: 0,
|
|
514
|
+
max: 100,
|
|
515
|
+
step: 5,
|
|
516
|
+
defaultValue: 70,
|
|
517
|
+
unit: "%",
|
|
518
|
+
tab: "styling",
|
|
519
|
+
group: "Design",
|
|
520
|
+
requiresKeyToBeTrue: "overlayEnabled"
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
key: "separator",
|
|
524
|
+
type: "separator",
|
|
525
|
+
label: "Separator",
|
|
526
|
+
tab: "styling",
|
|
527
|
+
group: "Design"
|
|
528
|
+
},
|
|
529
|
+
getPaddingField({
|
|
530
|
+
key: "padding",
|
|
531
|
+
label: "Padding",
|
|
532
|
+
description: "Padding around the widget content",
|
|
533
|
+
defaultValue: 6,
|
|
534
|
+
tab: "styling",
|
|
535
|
+
group: "Design"
|
|
536
|
+
}),
|
|
537
|
+
getBorderRadiusField({
|
|
538
|
+
key: "borderRadius",
|
|
539
|
+
label: "Border Radius",
|
|
540
|
+
description: "Border radius for the widget container",
|
|
541
|
+
defaultValue: "xl",
|
|
542
|
+
tab: "styling",
|
|
543
|
+
group: "Design"
|
|
544
|
+
}),
|
|
545
|
+
getBorderWidthField({
|
|
546
|
+
key: "borderWidth",
|
|
547
|
+
label: "Border Width",
|
|
548
|
+
description: "Border width for the widget container",
|
|
549
|
+
defaultValue: "none",
|
|
550
|
+
tab: "styling",
|
|
551
|
+
group: "Design"
|
|
552
|
+
}),
|
|
553
|
+
getBorderColorField({
|
|
554
|
+
key: "borderColor",
|
|
555
|
+
label: "Border Color",
|
|
556
|
+
description: "Border color for the widget container",
|
|
557
|
+
defaultValue: "muted",
|
|
558
|
+
tab: "styling",
|
|
559
|
+
group: "Design"
|
|
560
|
+
})
|
|
561
|
+
]
|
|
562
|
+
};
|
|
563
|
+
//#endregion
|
|
564
|
+
export { QuickShareWidget_exports as n, quickShareWidgetPropertySchema as r, QuickShareWidget as t };
|
|
565
|
+
|
|
566
|
+
//# sourceMappingURL=QuickShareWidget-CunkC1r8.mjs.map
|