@flopay/react 0.5.12 → 0.5.14
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/index.cjs +490 -319
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +62 -1
- package/dist/index.d.ts +62 -1
- package/dist/index.mjs +435 -266
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -576,4 +576,65 @@ interface FloPayAutomaticPaymentButtonProps extends Omit<React.ButtonHTMLAttribu
|
|
|
576
576
|
}
|
|
577
577
|
declare function FloPayAutomaticPaymentButton({ sessionId, createSession, paymentMethodId, checkoutMethod, clientId, items, subscriptions, account, successUrl, cancelUrl, couponCodes, tagsData, utmMetadata, billingApiUrl, locale, buttonsTheme, buttonsStyles: stylesOverride, onSuccess, onError, onDecline, children, disabled, type, style, ...buttonProps }: FloPayAutomaticPaymentButtonProps): react_jsx_runtime.JSX.Element;
|
|
578
578
|
|
|
579
|
-
|
|
579
|
+
interface InAppBrowserNoticeProps {
|
|
580
|
+
/** Custom message override. Defaults to a generic, non-platform-specific copy. */
|
|
581
|
+
message?: React.ReactNode;
|
|
582
|
+
/** Custom button label. Default depends on the detected environment:
|
|
583
|
+
* in-app browser → "Copy link"; other → "Open in browser". */
|
|
584
|
+
openButtonLabel?: string;
|
|
585
|
+
/** Custom copied-state button label. Default depends on environment. */
|
|
586
|
+
copiedButtonLabel?: string;
|
|
587
|
+
/** Custom CSS overrides for the container, message, and button. */
|
|
588
|
+
containerStyle?: React.CSSProperties;
|
|
589
|
+
buttonStyle?: React.CSSProperties;
|
|
590
|
+
/** Called when the user clicks the open-in-browser button. */
|
|
591
|
+
onOpenInBrowser?: (result: {
|
|
592
|
+
opened: boolean;
|
|
593
|
+
copied: boolean;
|
|
594
|
+
}) => void;
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Non-disruptive notice rendered when PayPal and digital wallets fail to load
|
|
598
|
+
* — typically because the buyer is in an in-app browser (Instagram, Facebook,
|
|
599
|
+
* TikTok, etc.) or behind an ad-blocker. The card form remains fully
|
|
600
|
+
* functional; this notice just informs the buyer about the unavailable
|
|
601
|
+
* methods and gives them a way to escape to a real browser.
|
|
602
|
+
*
|
|
603
|
+
* Action behavior is environment-dependent because `window.open` is a known
|
|
604
|
+
* liar inside in-app WebViews:
|
|
605
|
+
*
|
|
606
|
+
* - **Detected in-app browser** (Facebook/Instagram/TikTok/etc. via UA):
|
|
607
|
+
* skip `window.open` entirely. It returns a non-null window but the new
|
|
608
|
+
* page opens *inside the same WebView*, which defeats the entire point
|
|
609
|
+
* and makes us mis-report `opened: true` to `onOpenInBrowser`. Instead,
|
|
610
|
+
* copy the URL to clipboard and surface clear paste-in-Safari/Chrome
|
|
611
|
+
* messaging. There is no reliable cross-platform JS API to force a
|
|
612
|
+
* WebView to defer to the system browser; the buyer must use the host
|
|
613
|
+
* app's "..." / "⋮" menu.
|
|
614
|
+
* - **Other environments** (desktop with ad-blocker, unknown UA):
|
|
615
|
+
* `window.open` may genuinely succeed — try it, fall back to clipboard.
|
|
616
|
+
*/
|
|
617
|
+
declare function InAppBrowserNotice({ message, openButtonLabel, copiedButtonLabel, containerStyle, buttonStyle, onOpenInBrowser, }: InAppBrowserNoticeProps): react_jsx_runtime.JSX.Element;
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Heuristic detector for in-app browser / WebView environments where PayPal
|
|
621
|
+
* and digital wallets often fail to initialize.
|
|
622
|
+
*
|
|
623
|
+
* Pairs with the load-state classifier in `SplitCardForm`: this gives us a
|
|
624
|
+
* proactive signal (we know we're in a hostile environment before Stripe
|
|
625
|
+
* even tries), while load state covers the long tail (ad-blockers, new
|
|
626
|
+
* WebViews we haven't seen, account-misconfig surfacing as `unavailable`).
|
|
627
|
+
*
|
|
628
|
+
* Tradeoffs:
|
|
629
|
+
* - False positives possible. Some modern WebViews (iOS SFSafariViewController
|
|
630
|
+
* on recent iOS, Chrome Custom Tabs) handle PayPal fine but match these
|
|
631
|
+
* patterns. The notice is non-disruptive — card form keeps working — so we
|
|
632
|
+
* accept it.
|
|
633
|
+
* - False negatives possible. New social-app WebViews ship without us knowing.
|
|
634
|
+
* That's why we also keep the reactive load-state signal.
|
|
635
|
+
*
|
|
636
|
+
* SSR-safe: returns `false` when `navigator` is undefined.
|
|
637
|
+
*/
|
|
638
|
+
declare function isInAppBrowser(userAgent?: string): boolean;
|
|
639
|
+
|
|
640
|
+
export { AddressElement, CardCvcElement, CardElement, CardExpiryElement, CardNumberElement, CheckoutForm, type CheckoutFormProps, type CheckoutFormRef, type CheckoutState, type ElementComponentProps, FloPayAutomaticPaymentButton, type FloPayAutomaticPaymentButtonProps, type FloPayAutomaticPaymentSuccessEvent, FloPayCheckout, type FloPayCheckoutProps, FloPayProvider, type FloPayProviderProps, InAppBrowserNotice, type InAppBrowserNoticeProps, PayPalButton, type PayPalButtonProps, PaymentElement, SplitCardForm, type SplitCardFormProps, type SplitCardFormRef, isInAppBrowser, useCheckout, useElements, useFloPay, usePayPalFloPay };
|
package/dist/index.d.ts
CHANGED
|
@@ -576,4 +576,65 @@ interface FloPayAutomaticPaymentButtonProps extends Omit<React.ButtonHTMLAttribu
|
|
|
576
576
|
}
|
|
577
577
|
declare function FloPayAutomaticPaymentButton({ sessionId, createSession, paymentMethodId, checkoutMethod, clientId, items, subscriptions, account, successUrl, cancelUrl, couponCodes, tagsData, utmMetadata, billingApiUrl, locale, buttonsTheme, buttonsStyles: stylesOverride, onSuccess, onError, onDecline, children, disabled, type, style, ...buttonProps }: FloPayAutomaticPaymentButtonProps): react_jsx_runtime.JSX.Element;
|
|
578
578
|
|
|
579
|
-
|
|
579
|
+
interface InAppBrowserNoticeProps {
|
|
580
|
+
/** Custom message override. Defaults to a generic, non-platform-specific copy. */
|
|
581
|
+
message?: React.ReactNode;
|
|
582
|
+
/** Custom button label. Default depends on the detected environment:
|
|
583
|
+
* in-app browser → "Copy link"; other → "Open in browser". */
|
|
584
|
+
openButtonLabel?: string;
|
|
585
|
+
/** Custom copied-state button label. Default depends on environment. */
|
|
586
|
+
copiedButtonLabel?: string;
|
|
587
|
+
/** Custom CSS overrides for the container, message, and button. */
|
|
588
|
+
containerStyle?: React.CSSProperties;
|
|
589
|
+
buttonStyle?: React.CSSProperties;
|
|
590
|
+
/** Called when the user clicks the open-in-browser button. */
|
|
591
|
+
onOpenInBrowser?: (result: {
|
|
592
|
+
opened: boolean;
|
|
593
|
+
copied: boolean;
|
|
594
|
+
}) => void;
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Non-disruptive notice rendered when PayPal and digital wallets fail to load
|
|
598
|
+
* — typically because the buyer is in an in-app browser (Instagram, Facebook,
|
|
599
|
+
* TikTok, etc.) or behind an ad-blocker. The card form remains fully
|
|
600
|
+
* functional; this notice just informs the buyer about the unavailable
|
|
601
|
+
* methods and gives them a way to escape to a real browser.
|
|
602
|
+
*
|
|
603
|
+
* Action behavior is environment-dependent because `window.open` is a known
|
|
604
|
+
* liar inside in-app WebViews:
|
|
605
|
+
*
|
|
606
|
+
* - **Detected in-app browser** (Facebook/Instagram/TikTok/etc. via UA):
|
|
607
|
+
* skip `window.open` entirely. It returns a non-null window but the new
|
|
608
|
+
* page opens *inside the same WebView*, which defeats the entire point
|
|
609
|
+
* and makes us mis-report `opened: true` to `onOpenInBrowser`. Instead,
|
|
610
|
+
* copy the URL to clipboard and surface clear paste-in-Safari/Chrome
|
|
611
|
+
* messaging. There is no reliable cross-platform JS API to force a
|
|
612
|
+
* WebView to defer to the system browser; the buyer must use the host
|
|
613
|
+
* app's "..." / "⋮" menu.
|
|
614
|
+
* - **Other environments** (desktop with ad-blocker, unknown UA):
|
|
615
|
+
* `window.open` may genuinely succeed — try it, fall back to clipboard.
|
|
616
|
+
*/
|
|
617
|
+
declare function InAppBrowserNotice({ message, openButtonLabel, copiedButtonLabel, containerStyle, buttonStyle, onOpenInBrowser, }: InAppBrowserNoticeProps): react_jsx_runtime.JSX.Element;
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Heuristic detector for in-app browser / WebView environments where PayPal
|
|
621
|
+
* and digital wallets often fail to initialize.
|
|
622
|
+
*
|
|
623
|
+
* Pairs with the load-state classifier in `SplitCardForm`: this gives us a
|
|
624
|
+
* proactive signal (we know we're in a hostile environment before Stripe
|
|
625
|
+
* even tries), while load state covers the long tail (ad-blockers, new
|
|
626
|
+
* WebViews we haven't seen, account-misconfig surfacing as `unavailable`).
|
|
627
|
+
*
|
|
628
|
+
* Tradeoffs:
|
|
629
|
+
* - False positives possible. Some modern WebViews (iOS SFSafariViewController
|
|
630
|
+
* on recent iOS, Chrome Custom Tabs) handle PayPal fine but match these
|
|
631
|
+
* patterns. The notice is non-disruptive — card form keeps working — so we
|
|
632
|
+
* accept it.
|
|
633
|
+
* - False negatives possible. New social-app WebViews ship without us knowing.
|
|
634
|
+
* That's why we also keep the reactive load-state signal.
|
|
635
|
+
*
|
|
636
|
+
* SSR-safe: returns `false` when `navigator` is undefined.
|
|
637
|
+
*/
|
|
638
|
+
declare function isInAppBrowser(userAgent?: string): boolean;
|
|
639
|
+
|
|
640
|
+
export { AddressElement, CardCvcElement, CardElement, CardExpiryElement, CardNumberElement, CheckoutForm, type CheckoutFormProps, type CheckoutFormRef, type CheckoutState, type ElementComponentProps, FloPayAutomaticPaymentButton, type FloPayAutomaticPaymentButtonProps, type FloPayAutomaticPaymentSuccessEvent, FloPayCheckout, type FloPayCheckoutProps, FloPayProvider, type FloPayProviderProps, InAppBrowserNotice, type InAppBrowserNoticeProps, PayPalButton, type PayPalButtonProps, PaymentElement, SplitCardForm, type SplitCardFormProps, type SplitCardFormRef, isInAppBrowser, useCheckout, useElements, useFloPay, usePayPalFloPay };
|