@whop/elements-react-native 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +179 -0
- package/android/build.gradle +64 -0
- package/android/consumer-rules.pro +3 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/java/com/whop/elements/WhopAddressSuggestionsModule.kt +102 -0
- package/android/src/main/java/com/whop/elements/WhopAuthSessionModule.kt +126 -0
- package/android/src/main/java/com/whop/elements/WhopElementsPackage.kt +39 -0
- package/android/src/main/java/com/whop/elements/WhopPayButtonManager.kt +74 -0
- package/android/src/main/java/com/whop/elements/WhopPayButtonPressEvent.kt +17 -0
- package/android/src/main/java/com/whop/elements/WhopPayButtonView.kt +178 -0
- package/android/src/main/java/com/whop/elements/WhopPlatformPayModule.kt +212 -0
- package/assets/whop-wordmark-dark.png +0 -0
- package/assets/whop-wordmark-dark@2x.png +0 -0
- package/assets/whop-wordmark-dark@3x.png +0 -0
- package/assets/whop-wordmark-light.png +0 -0
- package/assets/whop-wordmark-light@2x.png +0 -0
- package/assets/whop-wordmark-light@3x.png +0 -0
- package/ios/Package.swift +59 -0
- package/ios/Sources/ElementsReactNative/WhopAddressSuggestionsImpl.swift +189 -0
- package/ios/Sources/ElementsReactNative/WhopAuthSessionImpl.swift +106 -0
- package/ios/Sources/ElementsReactNative/WhopPayButtonImpl.swift +89 -0
- package/ios/Sources/ElementsReactNative/WhopPlatformPayImpl.swift +181 -0
- package/ios/generated/WhopAddressSuggestionsModule.h +11 -0
- package/ios/generated/WhopAddressSuggestionsModule.mm +46 -0
- package/ios/generated/WhopAuthSessionModule.h +11 -0
- package/ios/generated/WhopAuthSessionModule.mm +45 -0
- package/ios/generated/WhopElementsShims.h +35 -0
- package/ios/generated/WhopPayButtonComponentView.h +12 -0
- package/ios/generated/WhopPayButtonComponentView.mm +82 -0
- package/ios/generated/WhopPlatformPayModule.h +11 -0
- package/ios/generated/WhopPlatformPayModule.mm +51 -0
- package/lib/module/api/client.js +139 -0
- package/lib/module/api/client.js.map +1 -0
- package/lib/module/api/client.test.js +137 -0
- package/lib/module/api/client.test.js.map +1 -0
- package/lib/module/api/types.js +2 -0
- package/lib/module/api/types.js.map +1 -0
- package/lib/module/controller/actions.js +148 -0
- package/lib/module/controller/actions.js.map +1 -0
- package/lib/module/controller/actions.test.js +102 -0
- package/lib/module/controller/actions.test.js.map +1 -0
- package/lib/module/controller/store.js +158 -0
- package/lib/module/controller/store.js.map +1 -0
- package/lib/module/core/address/country-data.js +1370 -0
- package/lib/module/core/address/country-data.js.map +1 -0
- package/lib/module/core/address/country-name.js +38 -0
- package/lib/module/core/address/country-name.js.map +1 -0
- package/lib/module/core/address/country-names.generated.js +249 -0
- package/lib/module/core/address/country-names.generated.js.map +1 -0
- package/lib/module/core/address/engine.js +245 -0
- package/lib/module/core/address/engine.js.map +1 -0
- package/lib/module/core/address/engine.test.js +216 -0
- package/lib/module/core/address/engine.test.js.map +1 -0
- package/lib/module/core/address/form-state.js +409 -0
- package/lib/module/core/address/form-state.js.map +1 -0
- package/lib/module/core/address/form-state.test.js +516 -0
- package/lib/module/core/address/form-state.test.js.map +1 -0
- package/lib/module/core/address/places.js +36 -0
- package/lib/module/core/address/places.js.map +1 -0
- package/lib/module/core/address/required-coverage.test.js +57 -0
- package/lib/module/core/address/required-coverage.test.js.map +1 -0
- package/lib/module/core/address/suggest.js +102 -0
- package/lib/module/core/address/suggest.js.map +1 -0
- package/lib/module/core/address/suggest.test.js +156 -0
- package/lib/module/core/address/suggest.test.js.map +1 -0
- package/lib/module/core/address/use-suggestions.js +33 -0
- package/lib/module/core/address/use-suggestions.js.map +1 -0
- package/lib/module/core/payments/address-change.js +91 -0
- package/lib/module/core/payments/address-change.js.map +1 -0
- package/lib/module/core/payments/billing-merge.js +62 -0
- package/lib/module/core/payments/billing-merge.js.map +1 -0
- package/lib/module/core/payments/browser-info.js +42 -0
- package/lib/module/core/payments/browser-info.js.map +1 -0
- package/lib/module/core/payments/bt.js +151 -0
- package/lib/module/core/payments/bt.js.map +1 -0
- package/lib/module/core/payments/bt.test.js +23 -0
- package/lib/module/core/payments/bt.test.js.map +1 -0
- package/lib/module/core/payments/currency.js +37 -0
- package/lib/module/core/payments/currency.js.map +1 -0
- package/lib/module/core/payments/detail.js +159 -0
- package/lib/module/core/payments/detail.js.map +1 -0
- package/lib/module/core/payments/detail.test.js +225 -0
- package/lib/module/core/payments/detail.test.js.map +1 -0
- package/lib/module/core/payments/errors.js +115 -0
- package/lib/module/core/payments/errors.js.map +1 -0
- package/lib/module/core/payments/mint.js +89 -0
- package/lib/module/core/payments/mint.js.map +1 -0
- package/lib/module/core/payments/plan.js +131 -0
- package/lib/module/core/payments/plan.js.map +1 -0
- package/lib/module/core/payments/refusals.js +17 -0
- package/lib/module/core/payments/refusals.js.map +1 -0
- package/lib/module/core/payments/secure-fields.js +87 -0
- package/lib/module/core/payments/secure-fields.js.map +1 -0
- package/lib/module/core/payments/tax-id-catalog.js +616 -0
- package/lib/module/core/payments/tax-id-catalog.js.map +1 -0
- package/lib/module/core/payments/wallet-contact.js +42 -0
- package/lib/module/core/payments/wallet-contact.js.map +1 -0
- package/lib/module/core/payments/wallet-contact.test.js +77 -0
- package/lib/module/core/payments/wallet-contact.test.js.map +1 -0
- package/lib/module/elements/address.js +467 -0
- package/lib/module/elements/address.js.map +1 -0
- package/lib/module/elements/branding.js +114 -0
- package/lib/module/elements/branding.js.map +1 -0
- package/lib/module/elements/card-fields/context.js +254 -0
- package/lib/module/elements/card-fields/context.js.map +1 -0
- package/lib/module/elements/card-fields/fields.js +309 -0
- package/lib/module/elements/card-fields/fields.js.map +1 -0
- package/lib/module/elements/card-fields/index.js +30 -0
- package/lib/module/elements/card-fields/index.js.map +1 -0
- package/lib/module/elements/card.js +107 -0
- package/lib/module/elements/card.js.map +1 -0
- package/lib/module/elements/email.js +84 -0
- package/lib/module/elements/email.js.map +1 -0
- package/lib/module/elements/payment/declared-fields.js +186 -0
- package/lib/module/elements/payment/declared-fields.js.map +1 -0
- package/lib/module/elements/payment/index.js +448 -0
- package/lib/module/elements/payment/index.js.map +1 -0
- package/lib/module/elements/payment/wallet.js +132 -0
- package/lib/module/elements/payment/wallet.js.map +1 -0
- package/lib/module/elements/tax-id.js +100 -0
- package/lib/module/elements/tax-id.js.map +1 -0
- package/lib/module/i18n/catalogs.js +103 -0
- package/lib/module/i18n/catalogs.js.map +1 -0
- package/lib/module/i18n/index.js +45 -0
- package/lib/module/i18n/index.js.map +1 -0
- package/lib/module/index.js +27 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/namespace.js +174 -0
- package/lib/module/namespace.js.map +1 -0
- package/lib/module/native/index.js +128 -0
- package/lib/module/native/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/provider.js +56 -0
- package/lib/module/provider.js.map +1 -0
- package/lib/module/specs/NativeWhopAddressSuggestions.js +6 -0
- package/lib/module/specs/NativeWhopAddressSuggestions.js.map +1 -0
- package/lib/module/specs/NativeWhopAuthSession.js +10 -0
- package/lib/module/specs/NativeWhopAuthSession.js.map +1 -0
- package/lib/module/specs/NativeWhopPlatformPay.js +10 -0
- package/lib/module/specs/NativeWhopPlatformPay.js.map +1 -0
- package/lib/module/specs/WhopPayButtonNativeComponent.ts +22 -0
- package/lib/module/theme/appearance.js +85 -0
- package/lib/module/theme/appearance.js.map +1 -0
- package/lib/module/theme/appearance.test.js +124 -0
- package/lib/module/theme/appearance.test.js.map +1 -0
- package/lib/module/theme/provider.js +25 -0
- package/lib/module/theme/provider.js.map +1 -0
- package/lib/module/theme/resolve.js +69 -0
- package/lib/module/theme/resolve.js.map +1 -0
- package/lib/module/theme/scales.generated.js +419 -0
- package/lib/module/theme/scales.generated.js.map +1 -0
- package/lib/module/ui/element-frame.js +83 -0
- package/lib/module/ui/element-frame.js.map +1 -0
- package/lib/module/ui/payment-method-icon.js +69 -0
- package/lib/module/ui/payment-method-icon.js.map +1 -0
- package/lib/module/ui/primitives.js +266 -0
- package/lib/module/ui/primitives.js.map +1 -0
- package/lib/module/ui/select.js +281 -0
- package/lib/module/ui/select.js.map +1 -0
- package/lib/module/ui/suggestions.js +71 -0
- package/lib/module/ui/suggestions.js.map +1 -0
- package/lib/module/ui/whop-logo.js +42 -0
- package/lib/module/ui/whop-logo.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/api/client.d.ts +87 -0
- package/lib/typescript/src/api/client.d.ts.map +1 -0
- package/lib/typescript/src/api/types.d.ts +175 -0
- package/lib/typescript/src/api/types.d.ts.map +1 -0
- package/lib/typescript/src/controller/actions.d.ts +42 -0
- package/lib/typescript/src/controller/actions.d.ts.map +1 -0
- package/lib/typescript/src/controller/store.d.ts +90 -0
- package/lib/typescript/src/controller/store.d.ts.map +1 -0
- package/lib/typescript/src/core/address/country-data.d.ts +4 -0
- package/lib/typescript/src/core/address/country-data.d.ts.map +1 -0
- package/lib/typescript/src/core/address/country-name.d.ts +2 -0
- package/lib/typescript/src/core/address/country-name.d.ts.map +1 -0
- package/lib/typescript/src/core/address/country-names.generated.d.ts +2 -0
- package/lib/typescript/src/core/address/country-names.generated.d.ts.map +1 -0
- package/lib/typescript/src/core/address/engine.d.ts +97 -0
- package/lib/typescript/src/core/address/engine.d.ts.map +1 -0
- package/lib/typescript/src/core/address/form-state.d.ts +144 -0
- package/lib/typescript/src/core/address/form-state.d.ts.map +1 -0
- package/lib/typescript/src/core/address/places.d.ts +23 -0
- package/lib/typescript/src/core/address/places.d.ts.map +1 -0
- package/lib/typescript/src/core/address/suggest.d.ts +47 -0
- package/lib/typescript/src/core/address/suggest.d.ts.map +1 -0
- package/lib/typescript/src/core/address/use-suggestions.d.ts +3 -0
- package/lib/typescript/src/core/address/use-suggestions.d.ts.map +1 -0
- package/lib/typescript/src/core/payments/address-change.d.ts +52 -0
- package/lib/typescript/src/core/payments/address-change.d.ts.map +1 -0
- package/lib/typescript/src/core/payments/billing-merge.d.ts +39 -0
- package/lib/typescript/src/core/payments/billing-merge.d.ts.map +1 -0
- package/lib/typescript/src/core/payments/browser-info.d.ts +12 -0
- package/lib/typescript/src/core/payments/browser-info.d.ts.map +1 -0
- package/lib/typescript/src/core/payments/bt.d.ts +55 -0
- package/lib/typescript/src/core/payments/bt.d.ts.map +1 -0
- package/lib/typescript/src/core/payments/currency.d.ts +7 -0
- package/lib/typescript/src/core/payments/currency.d.ts.map +1 -0
- package/lib/typescript/src/core/payments/detail.d.ts +53 -0
- package/lib/typescript/src/core/payments/detail.d.ts.map +1 -0
- package/lib/typescript/src/core/payments/errors.d.ts +62 -0
- package/lib/typescript/src/core/payments/errors.d.ts.map +1 -0
- package/lib/typescript/src/core/payments/mint.d.ts +74 -0
- package/lib/typescript/src/core/payments/mint.d.ts.map +1 -0
- package/lib/typescript/src/core/payments/plan.d.ts +69 -0
- package/lib/typescript/src/core/payments/plan.d.ts.map +1 -0
- package/lib/typescript/src/core/payments/refusals.d.ts +12 -0
- package/lib/typescript/src/core/payments/refusals.d.ts.map +1 -0
- package/lib/typescript/src/core/payments/secure-fields.d.ts +33 -0
- package/lib/typescript/src/core/payments/secure-fields.d.ts.map +1 -0
- package/lib/typescript/src/core/payments/tax-id-catalog.d.ts +481 -0
- package/lib/typescript/src/core/payments/tax-id-catalog.d.ts.map +1 -0
- package/lib/typescript/src/core/payments/wallet-contact.d.ts +40 -0
- package/lib/typescript/src/core/payments/wallet-contact.d.ts.map +1 -0
- package/lib/typescript/src/elements/address.d.ts +55 -0
- package/lib/typescript/src/elements/address.d.ts.map +1 -0
- package/lib/typescript/src/elements/branding.d.ts +18 -0
- package/lib/typescript/src/elements/branding.d.ts.map +1 -0
- package/lib/typescript/src/elements/card-fields/context.d.ts +67 -0
- package/lib/typescript/src/elements/card-fields/context.d.ts.map +1 -0
- package/lib/typescript/src/elements/card-fields/fields.d.ts +15 -0
- package/lib/typescript/src/elements/card-fields/fields.d.ts.map +1 -0
- package/lib/typescript/src/elements/card-fields/index.d.ts +21 -0
- package/lib/typescript/src/elements/card-fields/index.d.ts.map +1 -0
- package/lib/typescript/src/elements/card.d.ts +21 -0
- package/lib/typescript/src/elements/card.d.ts.map +1 -0
- package/lib/typescript/src/elements/email.d.ts +31 -0
- package/lib/typescript/src/elements/email.d.ts.map +1 -0
- package/lib/typescript/src/elements/payment/declared-fields.d.ts +43 -0
- package/lib/typescript/src/elements/payment/declared-fields.d.ts.map +1 -0
- package/lib/typescript/src/elements/payment/index.d.ts +37 -0
- package/lib/typescript/src/elements/payment/index.d.ts.map +1 -0
- package/lib/typescript/src/elements/payment/wallet.d.ts +39 -0
- package/lib/typescript/src/elements/payment/wallet.d.ts.map +1 -0
- package/lib/typescript/src/elements/tax-id.d.ts +41 -0
- package/lib/typescript/src/elements/tax-id.d.ts.map +1 -0
- package/lib/typescript/src/i18n/catalogs.d.ts +7 -0
- package/lib/typescript/src/i18n/catalogs.d.ts.map +1 -0
- package/lib/typescript/src/i18n/index.d.ts +17 -0
- package/lib/typescript/src/i18n/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +42 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/namespace.d.ts +36 -0
- package/lib/typescript/src/namespace.d.ts.map +1 -0
- package/lib/typescript/src/native/index.d.ts +62 -0
- package/lib/typescript/src/native/index.d.ts.map +1 -0
- package/lib/typescript/src/provider.d.ts +37 -0
- package/lib/typescript/src/provider.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeWhopAddressSuggestions.d.ts +13 -0
- package/lib/typescript/src/specs/NativeWhopAddressSuggestions.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeWhopAuthSession.d.ts +20 -0
- package/lib/typescript/src/specs/NativeWhopAuthSession.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeWhopPlatformPay.d.ts +24 -0
- package/lib/typescript/src/specs/NativeWhopPlatformPay.d.ts.map +1 -0
- package/lib/typescript/src/specs/WhopPayButtonNativeComponent.d.ts +21 -0
- package/lib/typescript/src/specs/WhopPayButtonNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/theme/appearance.d.ts +71 -0
- package/lib/typescript/src/theme/appearance.d.ts.map +1 -0
- package/lib/typescript/src/theme/provider.d.ts +11 -0
- package/lib/typescript/src/theme/provider.d.ts.map +1 -0
- package/lib/typescript/src/theme/resolve.d.ts +19 -0
- package/lib/typescript/src/theme/resolve.d.ts.map +1 -0
- package/lib/typescript/src/theme/scales.generated.d.ts +18 -0
- package/lib/typescript/src/theme/scales.generated.d.ts.map +1 -0
- package/lib/typescript/src/ui/element-frame.d.ts +32 -0
- package/lib/typescript/src/ui/element-frame.d.ts.map +1 -0
- package/lib/typescript/src/ui/payment-method-icon.d.ts +21 -0
- package/lib/typescript/src/ui/payment-method-icon.d.ts.map +1 -0
- package/lib/typescript/src/ui/primitives.d.ts +94 -0
- package/lib/typescript/src/ui/primitives.d.ts.map +1 -0
- package/lib/typescript/src/ui/select.d.ts +25 -0
- package/lib/typescript/src/ui/select.d.ts.map +1 -0
- package/lib/typescript/src/ui/suggestions.d.ts +15 -0
- package/lib/typescript/src/ui/suggestions.d.ts.map +1 -0
- package/lib/typescript/src/ui/whop-logo.d.ts +4 -0
- package/lib/typescript/src/ui/whop-logo.d.ts.map +1 -0
- package/package.json +121 -0
- package/scripts/check-swift.sh +27 -0
- package/scripts/codegen-shims.mjs +409 -0
- package/scripts/gen-country-names.mjs +58 -0
- package/scripts/gen-theme.mjs +124 -0
- package/scripts/gen-wordmark.mjs +68 -0
- package/scripts/mirror.mjs +112 -0
- package/src/api/client.ts +202 -0
- package/src/api/types.ts +166 -0
- package/src/controller/actions.ts +197 -0
- package/src/controller/store.ts +201 -0
- package/src/core/address/country-data.ts +927 -0
- package/src/core/address/country-name.ts +36 -0
- package/src/core/address/country-names.generated.ts +246 -0
- package/src/core/address/engine.ts +349 -0
- package/src/core/address/form-state.ts +479 -0
- package/src/core/address/places.ts +39 -0
- package/src/core/address/suggest.ts +153 -0
- package/src/core/address/use-suggestions.ts +37 -0
- package/src/core/payments/address-change.ts +121 -0
- package/src/core/payments/billing-merge.ts +91 -0
- package/src/core/payments/browser-info.ts +43 -0
- package/src/core/payments/bt.ts +176 -0
- package/src/core/payments/currency.ts +54 -0
- package/src/core/payments/detail.ts +204 -0
- package/src/core/payments/errors.ts +171 -0
- package/src/core/payments/mint.ts +130 -0
- package/src/core/payments/plan.ts +198 -0
- package/src/core/payments/refusals.ts +24 -0
- package/src/core/payments/secure-fields.ts +85 -0
- package/src/core/payments/tax-id-catalog.ts +320 -0
- package/src/core/payments/wallet-contact.ts +56 -0
- package/src/elements/address.tsx +570 -0
- package/src/elements/branding.tsx +87 -0
- package/src/elements/card-fields/context.tsx +310 -0
- package/src/elements/card-fields/fields.tsx +281 -0
- package/src/elements/card-fields/index.tsx +37 -0
- package/src/elements/card.tsx +101 -0
- package/src/elements/email.tsx +100 -0
- package/src/elements/payment/declared-fields.tsx +238 -0
- package/src/elements/payment/index.tsx +497 -0
- package/src/elements/payment/wallet.tsx +155 -0
- package/src/elements/tax-id.tsx +143 -0
- package/src/i18n/catalogs.ts +100 -0
- package/src/i18n/index.tsx +46 -0
- package/src/index.ts +68 -0
- package/src/namespace.tsx +231 -0
- package/src/native/index.ts +173 -0
- package/src/provider.tsx +76 -0
- package/src/specs/NativeWhopAddressSuggestions.ts +14 -0
- package/src/specs/NativeWhopAuthSession.ts +21 -0
- package/src/specs/NativeWhopPlatformPay.ts +25 -0
- package/src/specs/WhopPayButtonNativeComponent.ts +22 -0
- package/src/theme/appearance.ts +150 -0
- package/src/theme/provider.tsx +28 -0
- package/src/theme/resolve.ts +68 -0
- package/src/theme/scales.generated.ts +427 -0
- package/src/ui/element-frame.tsx +94 -0
- package/src/ui/payment-method-icon.tsx +55 -0
- package/src/ui/primitives.tsx +269 -0
- package/src/ui/select.tsx +255 -0
- package/src/ui/suggestions.tsx +69 -0
- package/src/ui/whop-logo.tsx +37 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Pressable, StyleSheet, Text, View } from 'react-native';
|
|
4
|
+
import { alphaStep, step } from "../theme/provider.js";
|
|
5
|
+
import { part, useFieldStyles } from "./primitives.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The street suggestion list, rendered IN FLOW directly beneath the field rather than floating over
|
|
9
|
+
* the form.
|
|
10
|
+
*
|
|
11
|
+
* An anchored overlay would need the package's first measurement code, its first keyboard
|
|
12
|
+
* avoidance, and an escape from a ScrollView the consumer owns and this SDK cannot configure — and
|
|
13
|
+
* Android clips absolutely-positioned children that leave their parent's bounds regardless of
|
|
14
|
+
* elevation. Pushing the fields below it down costs a little polish and removes all of that.
|
|
15
|
+
*/
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
export function SuggestionList({
|
|
18
|
+
suggestions,
|
|
19
|
+
onPick
|
|
20
|
+
}) {
|
|
21
|
+
const s = useFieldStyles();
|
|
22
|
+
const theme = s.theme;
|
|
23
|
+
if (suggestions.length === 0) return null;
|
|
24
|
+
return /*#__PURE__*/_jsx(View, {
|
|
25
|
+
accessibilityRole: "list",
|
|
26
|
+
style: [styles.list, {
|
|
27
|
+
borderColor: alphaStep(theme.gray, 6),
|
|
28
|
+
borderRadius: theme.tokens.radius
|
|
29
|
+
}, part(theme, 'whop-AddressSuggestions')],
|
|
30
|
+
children: suggestions.map((suggestion, index) => /*#__PURE__*/_jsx(Pressable, {
|
|
31
|
+
accessibilityRole: "button",
|
|
32
|
+
accessibilityLabel: suggestion.label
|
|
33
|
+
// onPressIn, not onPress: the field's blur fires first on a tap, and anything that hides
|
|
34
|
+
// this list on blur would unmount the row before its press ever lands.
|
|
35
|
+
,
|
|
36
|
+
onPressIn: () => onPick(suggestion),
|
|
37
|
+
style: ({
|
|
38
|
+
pressed
|
|
39
|
+
}) => [styles.row, {
|
|
40
|
+
paddingHorizontal: theme.tokens.spacing * 3,
|
|
41
|
+
paddingVertical: theme.tokens.spacing * 3,
|
|
42
|
+
borderTopWidth: index === 0 ? 0 : StyleSheet.hairlineWidth,
|
|
43
|
+
borderTopColor: alphaStep(theme.gray, 5),
|
|
44
|
+
backgroundColor: pressed ? alphaStep(theme.gray, 3) : 'transparent'
|
|
45
|
+
}, part(theme, 'whop-AddressSuggestion')],
|
|
46
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
47
|
+
numberOfLines: 1,
|
|
48
|
+
style: [s.input, styles.label, {
|
|
49
|
+
color: step(theme.gray, 12)
|
|
50
|
+
}],
|
|
51
|
+
children: suggestion.label
|
|
52
|
+
})
|
|
53
|
+
}, `${suggestion.label}:${index}`))
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const styles = StyleSheet.create({
|
|
57
|
+
list: {
|
|
58
|
+
marginTop: 4,
|
|
59
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
60
|
+
overflow: 'hidden'
|
|
61
|
+
},
|
|
62
|
+
row: {
|
|
63
|
+
flexDirection: 'row',
|
|
64
|
+
alignItems: 'center'
|
|
65
|
+
},
|
|
66
|
+
label: {
|
|
67
|
+
flex: 1,
|
|
68
|
+
paddingVertical: 0
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=suggestions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Pressable","StyleSheet","Text","View","alphaStep","step","part","useFieldStyles","jsx","_jsx","SuggestionList","suggestions","onPick","s","theme","length","accessibilityRole","style","styles","list","borderColor","gray","borderRadius","tokens","radius","children","map","suggestion","index","accessibilityLabel","label","onPressIn","pressed","row","paddingHorizontal","spacing","paddingVertical","borderTopWidth","hairlineWidth","borderTopColor","backgroundColor","numberOfLines","input","color","create","marginTop","borderWidth","overflow","flexDirection","alignItems","flex"],"sourceRoot":"../../../src","sources":["ui/suggestions.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,UAAU,EAAEC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAGhE,SAASC,SAAS,EAAEC,IAAI,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,CAAC,CAAC;QACxCmB,eAAe,EAAER,OAAO,GAAG5B,SAAS,CAACU,KAAK,CAACO,IAAI,EAAE,CAAC,CAAC,GAAG;MACvD,CAAC,EACDf,IAAI,CAACQ,KAAK,EAAE,wBAAwB,CAAC,CACpC;MAAAW,QAAA,eAEFhB,IAAA,CAACP,IAAI;QAACuC,aAAa,EAAE,CAAE;QAACxB,KAAK,EAAE,CAACJ,CAAC,CAAC6B,KAAK,EAAExB,MAAM,CAACY,KAAK,EAAE;UAAEa,KAAK,EAAEtC,IAAI,CAACS,KAAK,CAACO,IAAI,EAAE,EAAE;QAAE,CAAC,CAAE;QAAAI,QAAA,EACtFE,UAAU,CAACG;MAAK,CACZ;IAAC,GApBF,GAAGH,UAAU,CAACG,KAAK,IAAIF,KAAK,EAqBvB,CACX;EAAC,CACG,CAAC;AAET;AAEA,MAAMV,MAAM,GAAGjB,UAAU,CAAC2C,MAAM,CAAC;EAChCzB,IAAI,EAAE;IAAE0B,SAAS,EAAE,CAAC;IAAEC,WAAW,EAAE7C,UAAU,CAACqC,aAAa;IAAES,QAAQ,EAAE;EAAS,CAAC;EACjFd,GAAG,EAAE;IAAEe,aAAa,EAAE,KAAK;IAAEC,UAAU,EAAE;EAAS,CAAC;EACnDnB,KAAK,EAAE;IAAEoB,IAAI,EAAE,CAAC;IAAEd,eAAe,EAAE;EAAE;AACtC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Image } from 'react-native';
|
|
4
|
+
import { useTheme } from "../theme/provider.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The Whop wordmark.
|
|
8
|
+
*
|
|
9
|
+
* A bitmap at 1x/2x/3x rather than `react-native-svg`, because a required native peer would have to
|
|
10
|
+
* ship its own `Package.swift` for a Swift-Package-Manager consumer to build at all — and one
|
|
11
|
+
* unbuildable peer blocks every integrator. An optional peer is not an option either: Metro
|
|
12
|
+
* resolves `require` statically, so a missing module is a bundling error rather than something a
|
|
13
|
+
* try/catch can survive.
|
|
14
|
+
*
|
|
15
|
+
* The assets are generated from the same paths the web element draws
|
|
16
|
+
* (frontend/apps/web/src/elements/payments/whop-logo.tsx) by scripts/gen-wordmark.mjs — the mark
|
|
17
|
+
* keeps Whop's orange in both, and only the wordmark's ink changes with the theme.
|
|
18
|
+
*/
|
|
19
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
+
const ASSETS = {
|
|
21
|
+
light: require('../../assets/whop-wordmark-light.png'),
|
|
22
|
+
dark: require('../../assets/whop-wordmark-dark.png')
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** The source artwork's aspect ratio; height drives width so the mark never distorts. */
|
|
26
|
+
const ASPECT = 119 / 26;
|
|
27
|
+
export function WhopLogo({
|
|
28
|
+
height = 12
|
|
29
|
+
}) {
|
|
30
|
+
const theme = useTheme();
|
|
31
|
+
return /*#__PURE__*/_jsx(Image, {
|
|
32
|
+
source: theme.mode === 'dark' ? ASSETS.dark : ASSETS.light,
|
|
33
|
+
style: {
|
|
34
|
+
height,
|
|
35
|
+
width: height * ASPECT
|
|
36
|
+
},
|
|
37
|
+
resizeMode: "contain",
|
|
38
|
+
accessibilityRole: "image",
|
|
39
|
+
accessibilityLabel: "Whop"
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=whop-logo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Image","useTheme","jsx","_jsx","ASSETS","light","require","dark","ASPECT","WhopLogo","height","theme","source","mode","style","width","resizeMode","accessibilityRole","accessibilityLabel"],"sourceRoot":"../../../src","sources":["ui/whop-logo.tsx"],"mappings":";;AAAA,SAASA,KAAK,QAAQ,cAAc;AAEpC,SAASC,QAAQ,QAAQ,sBAAmB;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAZA,SAAAC,GAAA,IAAAC,IAAA;AAaA,MAAMC,MAAM,GAAG;EACdC,KAAK,EAAEC,OAAO,CAAC,sCAAsC,CAAC;EACtDC,IAAI,EAAED,OAAO,CAAC,qCAAqC;AACpD,CAAC;;AAED;AACA,MAAME,MAAM,GAAG,GAAG,GAAG,EAAE;AAEvB,OAAO,SAASC,QAAQA,CAAC;EAAEC,MAAM,GAAG;AAAwB,CAAC,EAAE;EAC9D,MAAMC,KAAK,GAAGV,QAAQ,CAAC,CAAC;EACxB,oBACCE,IAAA,CAACH,KAAK;IACLY,MAAM,EAAED,KAAK,CAACE,IAAI,KAAK,MAAM,GAAGT,MAAM,CAACG,IAAI,GAAGH,MAAM,CAACC,KAAM;IAC3DS,KAAK,EAAE;MAAEJ,MAAM;MAAEK,KAAK,EAAEL,MAAM,GAAGF;IAAO,CAAE;IAC1CQ,UAAU,EAAC,SAAS;IACpBC,iBAAiB,EAAC,OAAO;IACzBC,kBAAkB,EAAC;EAAM,CACzB,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { ConfirmationTokenCreateParams, ConfirmationTokenResource, PageInfo, PaymentMethodTypeResource, PaymentResource, PlanResource } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The API origin is an ENUM over two Whop-owned hosts, never a consumer-supplied string.
|
|
4
|
+
*
|
|
5
|
+
* A consumer-settable origin would let the embedding app point a payment surface at a host it
|
|
6
|
+
* controls and read everything a buyer types into it. The web elements hold the same line
|
|
7
|
+
* (`elements-framework/src/builder/api-base.ts`); this is that rule on React Native.
|
|
8
|
+
*/
|
|
9
|
+
export declare const API_BASES: {
|
|
10
|
+
readonly production: "https://api.whop.com";
|
|
11
|
+
readonly sandbox: "https://api.sandbox.whop.com";
|
|
12
|
+
};
|
|
13
|
+
export type WhopEnvironment = keyof typeof API_BASES;
|
|
14
|
+
export declare class WhopError extends Error {
|
|
15
|
+
readonly status: number;
|
|
16
|
+
/** Alias of `status`; the ported payments error helpers read this name. */
|
|
17
|
+
readonly statusCode: number;
|
|
18
|
+
readonly code: string | undefined;
|
|
19
|
+
readonly body: unknown;
|
|
20
|
+
constructor(message: string, status: number, code?: string, body?: unknown);
|
|
21
|
+
}
|
|
22
|
+
export interface WhopClientOptions {
|
|
23
|
+
environment?: WhopEnvironment;
|
|
24
|
+
/** Resolved per request, so a rotating buyer token is never pinned to boot. */
|
|
25
|
+
getToken?: () => Promise<string | null | undefined> | string | null | undefined;
|
|
26
|
+
/** The Sardine correlation key, stamped as `x-ssk` when a flow surface is armed. */
|
|
27
|
+
getSessionKey?: () => string | null | undefined;
|
|
28
|
+
fetch?: typeof fetch;
|
|
29
|
+
}
|
|
30
|
+
interface RequestOptions {
|
|
31
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
32
|
+
body?: unknown;
|
|
33
|
+
token?: string | null;
|
|
34
|
+
/** The recognition probe is IP-throttled, so retrying a 5xx spends a buyer's budget. */
|
|
35
|
+
maxRetries?: number;
|
|
36
|
+
signal?: AbortSignal;
|
|
37
|
+
}
|
|
38
|
+
export declare class WhopClient {
|
|
39
|
+
readonly baseUrl: string;
|
|
40
|
+
private readonly options;
|
|
41
|
+
private readonly doFetch;
|
|
42
|
+
constructor(options?: WhopClientOptions);
|
|
43
|
+
request<T>(method: string, path: string, opts?: RequestOptions): Promise<T>;
|
|
44
|
+
readonly plans: {
|
|
45
|
+
retrieve: (id: string) => Promise<PlanResource>;
|
|
46
|
+
};
|
|
47
|
+
readonly paymentMethodTypes: {
|
|
48
|
+
list: (query: {
|
|
49
|
+
account_id?: string;
|
|
50
|
+
currency?: string;
|
|
51
|
+
amount?: number;
|
|
52
|
+
surface?: string;
|
|
53
|
+
}) => Promise<{
|
|
54
|
+
data: PaymentMethodTypeResource[];
|
|
55
|
+
page_info: PageInfo;
|
|
56
|
+
}>;
|
|
57
|
+
retrieve: (type: string, query: {
|
|
58
|
+
account_id?: string;
|
|
59
|
+
}) => Promise<PaymentMethodTypeResource>;
|
|
60
|
+
/** Authorizes a Basis Theory session against the nonce-derived card-assembly container. */
|
|
61
|
+
createSession: (type: string, body: {
|
|
62
|
+
account_id: string;
|
|
63
|
+
nonce: string;
|
|
64
|
+
}) => Promise<{
|
|
65
|
+
object: string;
|
|
66
|
+
type: string;
|
|
67
|
+
session: {
|
|
68
|
+
container: string;
|
|
69
|
+
};
|
|
70
|
+
}>;
|
|
71
|
+
};
|
|
72
|
+
readonly confirmationTokens: {
|
|
73
|
+
create: (body: ConfirmationTokenCreateParams) => Promise<ConfirmationTokenResource>;
|
|
74
|
+
retrieve: (id: string) => Promise<ConfirmationTokenResource>;
|
|
75
|
+
};
|
|
76
|
+
readonly payments: {
|
|
77
|
+
/** The client secret both identifies and authorizes, so no payment id is needed. */
|
|
78
|
+
retrieveBySecret: (clientSecret: string) => Promise<PaymentResource>;
|
|
79
|
+
updateBySecret: (clientSecret: string, body: {
|
|
80
|
+
return_url?: string;
|
|
81
|
+
}) => Promise<PaymentResource>;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/** `pay_<tag>_secret_v<n>` — the tag is embedded, which is why the secret is the whole reference. */
|
|
85
|
+
export declare function paymentTagFrom(clientSecret: string): string;
|
|
86
|
+
export {};
|
|
87
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,6BAA6B,EAC7B,yBAAyB,EACzB,QAAQ,EACR,yBAAyB,EACzB,eAAe,EACf,YAAY,EACZ,MAAM,YAAS,CAAC;AAEjB;;;;;;GAMG;AACH,eAAO,MAAM,SAAS;;;CAGZ,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,SAAS,CAAC;AAWrD,qBAAa,SAAU,SAAQ,KAAK;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM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`@whop/sdk`: that client is generated for the web and carries a transport this
|
|
5
|
+
* package does not want. The field names here are the wire names, so a payload built from these
|
|
6
|
+
* types is the payload the backend expects.
|
|
7
|
+
*/
|
|
8
|
+
export type Money = {
|
|
9
|
+
amount: number;
|
|
10
|
+
currency: string;
|
|
11
|
+
};
|
|
12
|
+
/** The API's own `enabled` / `disabled` / `include_platform_defaults` filtering shape. */
|
|
13
|
+
export interface PaymentMethodConfigurationShape {
|
|
14
|
+
enabled?: string[];
|
|
15
|
+
disabled?: string[];
|
|
16
|
+
include_platform_defaults?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface PlanResource {
|
|
19
|
+
id: string;
|
|
20
|
+
object: 'plan';
|
|
21
|
+
currency: string;
|
|
22
|
+
/** MAJOR units, decimal. `chargeFromPlan` converts, truncating the way the backend does. */
|
|
23
|
+
initial_price?: number | null;
|
|
24
|
+
plan_type?: string | null;
|
|
25
|
+
account?: {
|
|
26
|
+
id?: string;
|
|
27
|
+
} | null;
|
|
28
|
+
/**
|
|
29
|
+
* The GOVERNING configuration, already resolved server-side through every layer. `null` means
|
|
30
|
+
* platform defaults; there is deliberately no client-side fallback to the plan's own override.
|
|
31
|
+
*/
|
|
32
|
+
effective_payment_method_configuration?: PaymentMethodConfigurationShape | null;
|
|
33
|
+
trial_period_days?: number | null;
|
|
34
|
+
}
|
|
35
|
+
export interface CountryBound {
|
|
36
|
+
country: string;
|
|
37
|
+
min_amount: number | null;
|
|
38
|
+
max_amount: number | null;
|
|
39
|
+
}
|
|
40
|
+
export interface CurrencyBound {
|
|
41
|
+
min_amount: number | null;
|
|
42
|
+
max_amount: number | null;
|
|
43
|
+
countries: CountryBound[];
|
|
44
|
+
}
|
|
45
|
+
export interface RequiredField {
|
|
46
|
+
name: string;
|
|
47
|
+
kind: 'billing_details' | 'payment_method';
|
|
48
|
+
placeholder?: string;
|
|
49
|
+
secure?: boolean;
|
|
50
|
+
/** Country-keyed validation patterns, with `*` as the fallback. */
|
|
51
|
+
formats?: Record<string, string>;
|
|
52
|
+
input_formats?: Record<string, string>;
|
|
53
|
+
}
|
|
54
|
+
export interface MethodDetail {
|
|
55
|
+
/** `none` | `redirect` | `bank_wire` | `wallet_sheet` */
|
|
56
|
+
template: string;
|
|
57
|
+
icon?: string;
|
|
58
|
+
short_name?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* One colorway of one icon shape. The SVG is the API's preferred file, but React Native's `Image`
|
|
62
|
+
* renders no vectors and every SVG library that could is a native peer this package refuses to
|
|
63
|
+
* take on, so the raster set is what the elements draw.
|
|
64
|
+
*/
|
|
65
|
+
export interface PaymentMethodIconFiles {
|
|
66
|
+
svg?: string;
|
|
67
|
+
/** The shape's native size: 32px square, 48x30 card. */
|
|
68
|
+
png_1x?: string;
|
|
69
|
+
png_2x?: string;
|
|
70
|
+
png_4x?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface PaymentMethodIconVariants {
|
|
73
|
+
light?: PaymentMethodIconFiles | null;
|
|
74
|
+
dark?: PaymentMethodIconFiles | null;
|
|
75
|
+
}
|
|
76
|
+
export interface PaymentMethodIcons {
|
|
77
|
+
/** The square tile (32x32). */
|
|
78
|
+
square?: PaymentMethodIconVariants | null;
|
|
79
|
+
/** The credit-card-proportioned tile (48x30). */
|
|
80
|
+
card?: PaymentMethodIconVariants | null;
|
|
81
|
+
}
|
|
82
|
+
export interface CardNetworkArt {
|
|
83
|
+
brand: string;
|
|
84
|
+
display_name?: string;
|
|
85
|
+
icons?: PaymentMethodIcons;
|
|
86
|
+
}
|
|
87
|
+
export interface PaymentMethodTypeResource {
|
|
88
|
+
object: 'payment_method_type';
|
|
89
|
+
type: string;
|
|
90
|
+
category: 'card' | 'wallet' | 'redirect' | 'bank_debit' | 'bank_transfer' | 'voucher' | 'crypto' | 'balance';
|
|
91
|
+
display_name: string;
|
|
92
|
+
icons?: PaymentMethodIcons;
|
|
93
|
+
detail: MethodDetail;
|
|
94
|
+
required_fields?: RequiredField[];
|
|
95
|
+
currencies?: Record<string, CurrencyBound>;
|
|
96
|
+
platform_default?: boolean;
|
|
97
|
+
usage?: {
|
|
98
|
+
one_time?: boolean;
|
|
99
|
+
off_session?: boolean;
|
|
100
|
+
on_session?: boolean;
|
|
101
|
+
};
|
|
102
|
+
card?: {
|
|
103
|
+
public_key?: string | null;
|
|
104
|
+
networks?: CardNetworkArt[];
|
|
105
|
+
} | null;
|
|
106
|
+
wallet?: {
|
|
107
|
+
public_key?: string | null;
|
|
108
|
+
gateway?: string;
|
|
109
|
+
gateway_merchant_id?: string;
|
|
110
|
+
environment?: string;
|
|
111
|
+
allowed_card_networks?: string[];
|
|
112
|
+
allowed_auth_methods?: string[];
|
|
113
|
+
merchants?: Array<{
|
|
114
|
+
merchant_identifier?: string;
|
|
115
|
+
country?: string;
|
|
116
|
+
domains?: string[];
|
|
117
|
+
}>;
|
|
118
|
+
} | null;
|
|
119
|
+
config?: Record<string, unknown> | null;
|
|
120
|
+
}
|
|
121
|
+
export interface PageInfo {
|
|
122
|
+
end_cursor: string | null;
|
|
123
|
+
has_next_page: boolean;
|
|
124
|
+
has_previous_page: boolean;
|
|
125
|
+
start_cursor: string | null;
|
|
126
|
+
}
|
|
127
|
+
export interface ConfirmationTokenResource {
|
|
128
|
+
id: string;
|
|
129
|
+
object: 'confirmation_token';
|
|
130
|
+
payment_method?: {
|
|
131
|
+
type: string;
|
|
132
|
+
category: string;
|
|
133
|
+
} & Record<string, unknown>;
|
|
134
|
+
}
|
|
135
|
+
export interface PaymentResource {
|
|
136
|
+
id: string;
|
|
137
|
+
object: 'payment';
|
|
138
|
+
status: string;
|
|
139
|
+
client_secret?: string;
|
|
140
|
+
next_action?: {
|
|
141
|
+
type: string;
|
|
142
|
+
redirect?: {
|
|
143
|
+
url: string;
|
|
144
|
+
return_url?: string | null;
|
|
145
|
+
};
|
|
146
|
+
[key: string]: unknown;
|
|
147
|
+
} | null;
|
|
148
|
+
last_payment_error?: {
|
|
149
|
+
code?: string | null;
|
|
150
|
+
decline_code?: string | null;
|
|
151
|
+
message?: string | null;
|
|
152
|
+
} | null;
|
|
153
|
+
}
|
|
154
|
+
export interface BrowserInfo {
|
|
155
|
+
platform?: string;
|
|
156
|
+
color_depth?: number;
|
|
157
|
+
screen_height?: number;
|
|
158
|
+
screen_width?: number;
|
|
159
|
+
language?: string;
|
|
160
|
+
java_enabled?: boolean;
|
|
161
|
+
browser_time_difference?: number;
|
|
162
|
+
user_agent?: string;
|
|
163
|
+
}
|
|
164
|
+
export interface ConfirmationTokenCreateParams {
|
|
165
|
+
account_id: string;
|
|
166
|
+
payment_method: {
|
|
167
|
+
type?: string;
|
|
168
|
+
category: string;
|
|
169
|
+
} & Record<string, unknown>;
|
|
170
|
+
billing_details: Record<string, unknown>;
|
|
171
|
+
return_url?: string;
|
|
172
|
+
setup_future_usage?: 'off_session' | 'on_session';
|
|
173
|
+
browser_info?: BrowserInfo;
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/api/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,KAAK,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzD,0FAA0F;AAC1F,MAAM,WAAW,+BAA+B;IAC/C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,MAAM,WAAW,YAAY;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,4FAA4F;IAC5F,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAA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B,GAAG,IAAI,CAAC;IACT,kBAAkB,CAAC,EAAE;QACpB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACxB,GAAG,IAAI,CAAC;CACT;AAED,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,6BAA6B;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9E,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,aAAa,GAAG,YAAY,CAAC;IAClD,YAAY,CAAC,EAAE,WAAW,CAAC;CAC3B"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { PaymentResource } from '../api/types.js';
|
|
2
|
+
import { type MintBillingDetails } from '../core/payments/mint.js';
|
|
3
|
+
import type { PaymentsStore } from './store.js';
|
|
4
|
+
export interface CreateConfirmationTokenInput {
|
|
5
|
+
billingDetails?: Partial<MintBillingDetails>;
|
|
6
|
+
/** Declared inputs a method requires on `billing_details`. */
|
|
7
|
+
billingExtra?: Record<string, string>;
|
|
8
|
+
}
|
|
9
|
+
export interface CreateConfirmationTokenResult {
|
|
10
|
+
confirmationToken: string;
|
|
11
|
+
type: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The one mint. Resolves the live collection surface, merges the billing block underneath any
|
|
15
|
+
* explicit input, and posts `POST /confirmation_tokens`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createConfirmationToken(store: PaymentsStore, input?: CreateConfirmationTokenInput): Promise<CreateConfirmationTokenResult>;
|
|
18
|
+
export interface HandleNextActionInput {
|
|
19
|
+
/** Identifies AND authorizes the payment — its tag is embedded in the secret. */
|
|
20
|
+
clientSecret: string;
|
|
21
|
+
returnUrl?: string;
|
|
22
|
+
/** @default 2500 */
|
|
23
|
+
pollIntervalMs?: number;
|
|
24
|
+
/** @default 300000 */
|
|
25
|
+
timeoutMs?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface HandleNextActionResult {
|
|
28
|
+
status: string;
|
|
29
|
+
redirected: boolean;
|
|
30
|
+
lastPaymentError: PaymentResource['last_payment_error'];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Completes a confirmed payment's pending step.
|
|
34
|
+
*
|
|
35
|
+
* The redirect leg opens the system browser and then **polls the payment to rest**. Polling is the
|
|
36
|
+
* authority rather than a callback because the API refuses anything but https or loopback for a
|
|
37
|
+
* return URL (`PaymentsApi::ValidateReturnUrl`), so a custom-scheme deep link back into the app is
|
|
38
|
+
* not available. Dismissing the browser therefore returns the payment's current status, which may
|
|
39
|
+
* still be pending — the same contract the web action documents.
|
|
40
|
+
*/
|
|
41
|
+
export declare function handleNextAction(store: PaymentsStore, input: HandleNextActionInput): Promise<HandleNextActionResult>;
|
|
42
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../../src/controller/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAc,CAAC;AAIpD,OAAO,EAAyB,KAAK,kBAAkB,EAAwB,MAAM,0BAAuB,CAAC;AAE7G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAS,CAAC;AAE7C,MAAM,WAAW,4BAA4B;IAC5C,cAAc,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC7C,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,6BAA6B;IAC7C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;CACb;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC5C,KAAK,EAAE,aAAa,EACpB,KAAK,GAAE,4BAAiC,GACtC,OAAO,CAAC,6BAA6B,CAAC,CAiExC;AAED,MAAM,WAAW,qBAAqB;IACrC,iFAAiF;IACjF,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sBAAsB;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,eAAe,CAAC,oBAAoB,CAAC,CAAC;CACxD;AAID;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CACrC,KAAK,EAAE,aAAa,EACpB,KAAK,EAAE,qBAAqB,GAC1B,OAAO,CAAC,sBAAsB,CAAC,CAiBjC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { WhopClient, type WhopEnvironment } from '../api/client.js';
|
|
2
|
+
import type { CollectedAddressSnapshot } from '../core/payments/billing-merge.js';
|
|
3
|
+
import type { CheckoutSurface, MatrixEntry, WalletAvailability } from '../core/payments/detail.js';
|
|
4
|
+
import { type ChargeProps, type ChargeState } from '../core/payments/plan.js';
|
|
5
|
+
import type { CollectedPayment } from '../core/payments/mint.js';
|
|
6
|
+
export interface PaymentsOptions extends ChargeProps {
|
|
7
|
+
accountId?: string;
|
|
8
|
+
returnUrl?: string;
|
|
9
|
+
applePayMerchantId?: string;
|
|
10
|
+
googlePayMerchantName?: string;
|
|
11
|
+
/** The method-tile order, Stripe's `paymentMethodOrder` semantics. */
|
|
12
|
+
order?: string[];
|
|
13
|
+
analytics?: false | {
|
|
14
|
+
writeKey: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The collection surface a `createConfirmationToken` call delegates to.
|
|
19
|
+
*
|
|
20
|
+
* Exactly one is live at a time — the fused card face, the exploded card fields, or the payment
|
|
21
|
+
* element's selected tile — and each registers itself on mount. This is the React Native shape of
|
|
22
|
+
* the web controller's confirm cascade, which resolves the same three in the same order.
|
|
23
|
+
*/
|
|
24
|
+
export interface CollectionSurface {
|
|
25
|
+
kind: 'payment' | 'card' | 'cardFields';
|
|
26
|
+
collect: (input: {
|
|
27
|
+
billingDetails?: Partial<{
|
|
28
|
+
email: string;
|
|
29
|
+
name: string;
|
|
30
|
+
}>;
|
|
31
|
+
}) => Promise<CollectedPayment>;
|
|
32
|
+
}
|
|
33
|
+
export interface PaymentsState {
|
|
34
|
+
charge: ChargeState;
|
|
35
|
+
chargeError: Error | null;
|
|
36
|
+
accountId: string | undefined;
|
|
37
|
+
returnUrl: string | undefined;
|
|
38
|
+
matrix: MatrixEntry[];
|
|
39
|
+
matrixLoading: boolean;
|
|
40
|
+
matrixError: Error | null;
|
|
41
|
+
walletAvailability: WalletAvailability | undefined;
|
|
42
|
+
selectedType: string | undefined;
|
|
43
|
+
selectedCategory: string | undefined;
|
|
44
|
+
selectedTemplate: string | undefined;
|
|
45
|
+
selectedComplete: boolean;
|
|
46
|
+
buyerEmail: string;
|
|
47
|
+
addressCollected: CollectedAddressSnapshot | undefined;
|
|
48
|
+
addressLive: boolean;
|
|
49
|
+
/** The billing-country constraint a picked method imposes; null while unconstrained. */
|
|
50
|
+
methodCountries: string[] | null;
|
|
51
|
+
brandingMounted: boolean;
|
|
52
|
+
confirmInFlight: boolean;
|
|
53
|
+
nextActionInFlight: boolean;
|
|
54
|
+
}
|
|
55
|
+
export declare const SURFACE_KEY = "payments";
|
|
56
|
+
/**
|
|
57
|
+
* The controller, as a plain store.
|
|
58
|
+
*
|
|
59
|
+
* The web controller runs in its own iframe because the embedding page is a different origin. A
|
|
60
|
+
* React Native app has no such boundary — the SDK's JS and the app's JS are the same binary — so
|
|
61
|
+
* the same state lives here in-process. What does not live here is the card number: that stays
|
|
62
|
+
* inside Basis Theory's own components and reaches the vault without passing through this object.
|
|
63
|
+
*/
|
|
64
|
+
export declare class PaymentsStore {
|
|
65
|
+
readonly client: WhopClient;
|
|
66
|
+
readonly surface: CheckoutSurface;
|
|
67
|
+
private state;
|
|
68
|
+
private readonly listeners;
|
|
69
|
+
private readonly surfaces;
|
|
70
|
+
private options;
|
|
71
|
+
private chargeToken;
|
|
72
|
+
private destroyed;
|
|
73
|
+
constructor(options: PaymentsOptions, environment: WhopEnvironment, getToken?: () => Promise<string | null | undefined>);
|
|
74
|
+
getSnapshot: () => PaymentsState;
|
|
75
|
+
subscribe: (listener: () => void) => (() => void);
|
|
76
|
+
getOptions(): PaymentsOptions;
|
|
77
|
+
patch(partial: Partial<PaymentsState>): void;
|
|
78
|
+
/** `handle.update()` — re-derives the charge when a charge-bearing option moved. */
|
|
79
|
+
update(options: PaymentsOptions): void;
|
|
80
|
+
destroy(): void;
|
|
81
|
+
registerSurface(surface: CollectionSurface): () => void;
|
|
82
|
+
/** The confirm cascade's order: a mounted payment element owns the selection, then the fused
|
|
83
|
+
* card face, then the exploded fields. */
|
|
84
|
+
liveSurface(): CollectionSurface | undefined;
|
|
85
|
+
/** One specific surface. The payment element's card tile reaches its own composed CardElement
|
|
86
|
+
* through this — `liveSurface()` would hand it back itself and recurse. */
|
|
87
|
+
surfaceOf(kind: CollectionSurface['kind']): CollectionSurface | undefined;
|
|
88
|
+
private resolveChargeState;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../../src/controller/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAe,CAAC;AACjE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAgC,CAAC;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,4BAAyB,CAAC;AAChG,OAAO,EACN,KAAK,WAAW,EAChB,KAAK,WAAW,EAIhB,MAAM,0BAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAAuB,CAAC;AAE9D,MAAM,WAAW,eAAgB,SAAQ,WAAW;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,CAAC,EAAE,KAAK,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CACzC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,YAAY,CAAC;IACxC,OAAO,EAAE,CAAC,KAAK,EAAE;QAAE,cAAc,CAAC,EAAE,OAAO,CAAC;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC7G;AAED,MAAM,WAAW,aAAa;IAC7B,MAAM,EAAE,WA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S,CAAC;IAOvH,WAAW,QAAO,aAAa,CAAe;IAE9C,SAAS,GAAI,UAAU,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC,CAK9C;IAEF,UAAU,IAAI,eAAe;IAI7B,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI;IAe5C,oFAAoF;IACpF,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAiBtC,OAAO,IAAI,IAAI;IAMf,eAAe,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,IAAI;IAOvD;+CAC2C;IAC3C,WAAW,IAAI,iBAAiB,GAAG,SAAS;IAI5C;gFAC4E;IAC5E,SAAS,CAAC,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC,GAAG,iBAAiB,GAAG,SAAS;YAI3D,kBAAkB;CAkBhC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country-data.d.ts","sourceRoot":"","sources":["../../../../../src/core/address/country-data.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAU,CAAC;AAElD,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAq5BnD,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country-name.d.ts","sourceRoot":"","sources":["../../../../../src/core/address/country-name.ts"],"names":[],"mappings":"AAuBA,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAYhE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"country-names.generated.d.ts","sourceRoot":"","sources":["../../../../../src/core/address/country-names.generated.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAiPnD,CAAC"}
|