@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,62 @@
|
|
|
1
|
+
export type ChargeConfigErrorCode = 'PLAN_INLINE_CONFLICT' | 'CHARGE_CONFIG_MISSING' | 'PLAN_ACCOUNT_MISMATCH' | 'PLAN_RESOLUTION_FAILED';
|
|
2
|
+
/** The plan/inline charge-config refusals — CODED like the framework's lifecycle refusals
|
|
3
|
+
* (switch on `code`, never string-match). The message carries the code prefix too because a
|
|
4
|
+
* wire boot failure (`controller-failed`) delivers the MESSAGE alone to the handle's onError. */
|
|
5
|
+
export declare class ChargeConfigError extends Error {
|
|
6
|
+
readonly code: ChargeConfigErrorCode;
|
|
7
|
+
constructor(code: ChargeConfigErrorCode, message: string);
|
|
8
|
+
}
|
|
9
|
+
export type BrandingRequiredErrorCode = 'BRANDING_NOT_MOUNTED' | 'BRANDING_HIDDEN';
|
|
10
|
+
/** The merchant-of-record refusal. `BRANDING_NOT_MOUNTED` remains in the error-code contract for
|
|
11
|
+
* clients compiled against 1.0.0-beta.1; the compatibility runtime only emits `BRANDING_HIDDEN`
|
|
12
|
+
* when a mounted notice has been CSS-hidden or shrunk. */
|
|
13
|
+
export declare class BrandingRequiredError extends Error {
|
|
14
|
+
readonly code: BrandingRequiredErrorCode;
|
|
15
|
+
constructor(code: BrandingRequiredErrorCode, message: string);
|
|
16
|
+
}
|
|
17
|
+
export type SelectErrorCode = 'METHOD_NOT_OFFERED';
|
|
18
|
+
/** The `select` action's refusals — the same coded shape as ChargeConfigError (switch on `code`;
|
|
19
|
+
* the message carries the code prefix because the wire rpc rail delivers the message alone). */
|
|
20
|
+
export declare class SelectError extends Error {
|
|
21
|
+
readonly code: SelectErrorCode;
|
|
22
|
+
constructor(code: SelectErrorCode, message: string);
|
|
23
|
+
}
|
|
24
|
+
export type SecureFieldErrorCode = 'SECURE_FIELD_TOKENIZER_UNAVAILABLE' | 'SECURE_FIELD_TOKENIZE_FAILED';
|
|
25
|
+
/** The secure declared-field refusals (a secure value could not be tokenized, so the confirm
|
|
26
|
+
* never ran) — the same coded shape as the other refusal families. */
|
|
27
|
+
export declare class SecureFieldError extends Error {
|
|
28
|
+
readonly code: SecureFieldErrorCode;
|
|
29
|
+
constructor(code: SecureFieldErrorCode, message: string);
|
|
30
|
+
}
|
|
31
|
+
export type PaymentTokenizationFailureStage = 'card_fields' | 'card_tokenizer_session' | 'card_number' | 'card_session_authorization' | 'card_expiry' | 'card_cvc' | 'confirmation_token_create';
|
|
32
|
+
export type PaymentTokenizationErrorCode = 'card_fields_not_ready' | 'card_tokenizer_session_failed' | 'card_number_validation_failed' | 'card_number_tokenization_failed' | 'card_session_authorization_failed' | 'card_expiry_validation_failed' | 'card_expiry_tokenization_failed' | 'card_cvc_validation_failed' | 'card_cvc_tokenization_failed' | 'confirmation_token_create_failed';
|
|
33
|
+
interface PaymentTokenizationFailure {
|
|
34
|
+
code: PaymentTokenizationErrorCode;
|
|
35
|
+
failureStage: PaymentTokenizationFailureStage;
|
|
36
|
+
message: string;
|
|
37
|
+
}
|
|
38
|
+
export declare class PaymentTokenizationError extends Error {
|
|
39
|
+
readonly code: PaymentTokenizationErrorCode;
|
|
40
|
+
readonly failureStage: PaymentTokenizationFailureStage;
|
|
41
|
+
readonly buyerMessage: string;
|
|
42
|
+
constructor(code: PaymentTokenizationErrorCode, message: string);
|
|
43
|
+
}
|
|
44
|
+
export declare function paymentTokenizationFailureOf(error: unknown): PaymentTokenizationFailure | undefined;
|
|
45
|
+
export declare function paymentTokenizationBuyerMessage(error: unknown, fallback: string): string;
|
|
46
|
+
export type NextActionErrorCode = 'FULL_PAGE_STEP_IN_FRAME';
|
|
47
|
+
/** handleNextAction's posture refusal (a full_page-only step reached a document that cannot
|
|
48
|
+
* navigate the whole tab, so nothing ran) — the same coded shape as the other refusal
|
|
49
|
+
* families. */
|
|
50
|
+
export declare class NextActionError extends Error {
|
|
51
|
+
readonly code: NextActionErrorCode;
|
|
52
|
+
constructor(code: NextActionErrorCode, message: string);
|
|
53
|
+
}
|
|
54
|
+
/** Whether a caught error is this family's refusal for `code`, wherever it was caught: the
|
|
55
|
+
* structured `code` survives an in-process throw, and the `[CODE]` message prefix is the
|
|
56
|
+
* family's own WIRE encoding — the rpc rail re-mints a rejection from `.message` alone, which
|
|
57
|
+
* is the whole reason these constructors bake the code into the message. Decoding the prefix
|
|
58
|
+
* here is reading that contract, not string-matching prose. */
|
|
59
|
+
export declare function isNextActionRefusal(error: unknown, code: NextActionErrorCode): boolean;
|
|
60
|
+
export declare function apiErrorMessage(err: unknown, fallback: string): string;
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../../src/core/payments/errors.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,qBAAqB,GAC7B,sBAAsB,GACtB,uBAAuB,GACvB,uBAAuB,GACvB,wBAAwB,CAAC;AAE7B;;kGAEkG;AAClG,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;gBAEzB,IAAI,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM;CAKzD;AAED,MAAM,MAAM,yBAAyB,GAAG,sBAAsB,GAAG,iBAAiB,CAAC;AAEnF;;2DAE2D;AAC3D,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAC;gBAE7B,IAAI,EAAE,yBAAyB,EAAE,OAAO,EAAE,MAAM;CAK7D;AAED,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAC;AAEnD;iGACiG;AACjG,qBAAa,WAAY,SAAQ,KAAK;IACpC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;gBAEnB,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM;CAKnD;AAED,MAAM,MAAM,oBAAoB,GAAG,oCAAoC,GAAG,8BAA8B,CAAC;AAEzG;uEACuE;AACvE,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;gBAExB,IAAI,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QAAQ,EAAE,MAAM,GAAG,MAAM,CAMtE"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { WhopClient } from '../../api/client.js';
|
|
2
|
+
export interface MintBillingDetails {
|
|
3
|
+
email: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
phone?: string;
|
|
6
|
+
address?: {
|
|
7
|
+
country?: string;
|
|
8
|
+
line1?: string;
|
|
9
|
+
city?: string;
|
|
10
|
+
postal_code?: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface MintContext {
|
|
14
|
+
accountId: string | undefined;
|
|
15
|
+
returnUrl: string | undefined;
|
|
16
|
+
setupFutureUsage: 'off_session' | 'on_session' | undefined;
|
|
17
|
+
}
|
|
18
|
+
/** The collected bag a surface's `collect` verb returns — everything the CONTROLLER needs to
|
|
19
|
+
* mint: the assembled payment_method slice, the surface-validated billing block, and any
|
|
20
|
+
* declared inputs that belong on billing_details. Serializable — it crosses the surface's
|
|
21
|
+
* frame into the controller frame. */
|
|
22
|
+
export interface CollectedPayment {
|
|
23
|
+
paymentMethod: {
|
|
24
|
+
type: string;
|
|
25
|
+
category: string;
|
|
26
|
+
} & Record<string, unknown>;
|
|
27
|
+
billingDetails: MintBillingDetails;
|
|
28
|
+
billingExtra?: Record<string, string>;
|
|
29
|
+
}
|
|
30
|
+
/** The ONE confirmation-token mint — run by the CONTROLLER's internal action only, in the
|
|
31
|
+
* controller frame, with the controller's sdk + accountId/returnUrl/setupFutureUsage context.
|
|
32
|
+
* (Exception: WhopPaymentRequest tokenizes + mints host-side — it must run without a mounted
|
|
33
|
+
* controller.) */
|
|
34
|
+
export declare function mintConfirmationToken(sdk: WhopClient, context: MintContext, paymentMethod: {
|
|
35
|
+
type: string;
|
|
36
|
+
category: string;
|
|
37
|
+
} & Record<string, unknown>, billingDetails: MintBillingDetails, billingExtra?: Record<string, string>): Promise<{
|
|
38
|
+
confirmationToken: string;
|
|
39
|
+
type: string;
|
|
40
|
+
}>;
|
|
41
|
+
export declare function validateBillingEmail(billing: {
|
|
42
|
+
email?: string;
|
|
43
|
+
} | undefined): MintBillingDetails;
|
|
44
|
+
export declare function assertCardBilling(billing: MintBillingDetails): void;
|
|
45
|
+
interface CollectionSurface {
|
|
46
|
+
/** advisory CLAIM-axis liveness (`ctx.children.<key>.created`) — "may I address it". */
|
|
47
|
+
created: boolean;
|
|
48
|
+
collect: (input: unknown) => Promise<unknown>;
|
|
49
|
+
}
|
|
50
|
+
export interface CollectionSurfaces {
|
|
51
|
+
/** the payment element's collect (a.controllerOnly — it orchestrates its own selection). */
|
|
52
|
+
payment: CollectionSurface;
|
|
53
|
+
/** the fused card element's collect (a.controllerOnly). */
|
|
54
|
+
card: CollectionSurface;
|
|
55
|
+
/** the exploded card-fields sub's collect (a.controller — the only parent-reachable action
|
|
56
|
+
* kind on a sub: `ctx.children.<sub>` routes through `runtime.dispatch`, which refuses
|
|
57
|
+
* internal). */
|
|
58
|
+
cardFields: CollectionSurface;
|
|
59
|
+
}
|
|
60
|
+
/** The framework's CODED lifecycle refusals (`childRefusal`, controller-core): switch on
|
|
61
|
+
* `code`, never string-match — the message is the human channel. */
|
|
62
|
+
export declare function isChildRefusal(err: unknown): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* The delegation cascade: COLLECTION belongs to the active surface, tried in precedence order —
|
|
65
|
+
* payment element, fused card element, exploded card-fields unit; each validates its own
|
|
66
|
+
* requirements and returns the serializable collected bag, and the CONTROLLER mints from it.
|
|
67
|
+
* Occupancy is DECIDED, not caught: `.created` (the advisory claim-axis probe) picks the live
|
|
68
|
+
* face; a coded lifecycle refusal (the check→invoke race — a face destroyed in between) falls
|
|
69
|
+
* through to the next; a live surface's own error re-throws untouched — its refusal is the
|
|
70
|
+
* answer.
|
|
71
|
+
*/
|
|
72
|
+
export declare function collectThroughLiveSurface(surfaces: CollectionSurfaces, input: unknown): Promise<CollectedPayment>;
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=mint.d.ts.map
|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AC,GACpC,OAAO,CAAC;IAAE,iBAAiB,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAgCtD;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GAAG,kBAAkB,CAGhG;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,CAEnE;AAED,UAAU,iBAAiB;IACzB,wFAAwF;IACxF,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,kBAAkB;IACjC,4FAA4F;IAC5F,OAAO,EAAE,iBAAiB,CAAC;IAC3B,2DAA2D;IAC3D,IAAI,EAAE,iBAAiB,CAAC;IACxB;;qBAEiB;IACjB,UAAU,EAAE,iBAAiB,CAAC;CAC/B;AAED;qEACqE;AACrE,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAGpD;AAED;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC7C,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,gBAAgB,CAAC,CAU3B"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { PaymentMethodConfigurationShape, PlanResource } from '../../api/types.js';
|
|
2
|
+
import type { WhopClient } from '../../api/client.js';
|
|
3
|
+
/** The widened props bag both runtimes hand to the charge resolution — the controller seed's
|
|
4
|
+
* `ctx.props` and the host sources' live props view are each one branch of the plan-vs-inline
|
|
5
|
+
* union, so every key is optional here and `chargeInputOf` decides which branch is in force. */
|
|
6
|
+
export interface ChargeProps {
|
|
7
|
+
accountId?: string;
|
|
8
|
+
plan?: string;
|
|
9
|
+
currency?: string;
|
|
10
|
+
amount?: number;
|
|
11
|
+
setupFutureUsage?: 'off_session' | 'on_session';
|
|
12
|
+
paymentMethodConfiguration?: PaymentMethodConfigurationShape;
|
|
13
|
+
}
|
|
14
|
+
/** `config = resolve(plan)`: the ONE normalized charge config every downstream path consumes —
|
|
15
|
+
* the inline props ARE the degenerate case (`plan` undefined, fields verbatim), and a plan is
|
|
16
|
+
* a preset that resolves to this same shape. */
|
|
17
|
+
export interface ResolvedCharge {
|
|
18
|
+
configured: true;
|
|
19
|
+
plan: string | undefined;
|
|
20
|
+
currency: string;
|
|
21
|
+
amount: number;
|
|
22
|
+
setupFutureUsage: 'off_session' | 'on_session' | undefined;
|
|
23
|
+
paymentMethodConfiguration: PaymentMethodConfigurationShape | undefined;
|
|
24
|
+
}
|
|
25
|
+
/** The optionless statics-rail boot (`WhopElements.payments.handleNextAction` — the namespace
|
|
26
|
+
* handle mounts with an EMPTY options bag): no charge input exists and none is needed, the
|
|
27
|
+
* static flow never collects. Collection-face projections refuse on it, loudly. */
|
|
28
|
+
export interface UnconfiguredCharge {
|
|
29
|
+
configured: false;
|
|
30
|
+
plan: undefined;
|
|
31
|
+
currency: undefined;
|
|
32
|
+
amount: undefined;
|
|
33
|
+
setupFutureUsage: undefined;
|
|
34
|
+
paymentMethodConfiguration: undefined;
|
|
35
|
+
}
|
|
36
|
+
export type ChargeState = ResolvedCharge | UnconfiguredCharge;
|
|
37
|
+
export declare const UNCONFIGURED_CHARGE: UnconfiguredCharge;
|
|
38
|
+
/** ZERO charge inputs mounted — the only shape that resolves to UNCONFIGURED_CHARGE; any
|
|
39
|
+
* PARTIAL config still throws the loud ChargeConfigError (a half-config is a consumer bug). */
|
|
40
|
+
export declare function chargeless(props: ChargeProps): boolean;
|
|
41
|
+
interface ChargeInput {
|
|
42
|
+
accountId: string | undefined;
|
|
43
|
+
plan: string | undefined;
|
|
44
|
+
currency: string | undefined;
|
|
45
|
+
amount: number | undefined;
|
|
46
|
+
setupFutureUsage: 'off_session' | 'on_session' | undefined;
|
|
47
|
+
paymentMethodConfiguration: PaymentMethodConfigurationShape | undefined;
|
|
48
|
+
}
|
|
49
|
+
/** The plan-XOR-inline gate: `plan` alongside any inline charge key is a conflict, and neither
|
|
50
|
+
* is a missing config — both refuse LOUDLY with a coded `ChargeConfigError`. */
|
|
51
|
+
export declare function chargeInputOf(props: ChargeProps): ChargeInput;
|
|
52
|
+
export declare function inlineCharge(input: ChargeInput): ResolvedCharge;
|
|
53
|
+
/** The slice of the SDK's own plan the charge resolution reads — the schema is the author,
|
|
54
|
+
* nothing hand-typed to drift. `effective_payment_method_configuration` is the GOVERNING
|
|
55
|
+
* configuration resolved server-side through every layer; `null` means platform defaults, and
|
|
56
|
+
* there is no fallback to the plan's own editable override — the backend publishing the field
|
|
57
|
+
* deploys BENEATH this code by PR stacking. */
|
|
58
|
+
export type RetrievedPlan = Pick<PlanResource, 'id' | 'currency' | 'initial_price' | 'plan_type' | 'account' | 'effective_payment_method_configuration'>;
|
|
59
|
+
/**
|
|
60
|
+
* Normalize a retrieved plan into the inline shape. The plan's `account_id` must MATCH the
|
|
61
|
+
* mounted `accountId` — the handle's account stays the mount key, and a foreign plan is a coded
|
|
62
|
+
* refusal, never a silent re-key. A renewing plan attests `off_session` save-consent unless the
|
|
63
|
+
* consumer set the attestation explicitly (the charge vaults the method for renewals).
|
|
64
|
+
*/
|
|
65
|
+
export declare function chargeFromPlan(resource: RetrievedPlan, input: ChargeInput): ResolvedCharge;
|
|
66
|
+
/** The one charge resolution. Inline props resolve with no network; a plan costs one GET. */
|
|
67
|
+
export declare function resolveCharge(client: WhopClient, props: ChargeProps): Promise<ChargeState>;
|
|
68
|
+
export {};
|
|
69
|
+
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../../../src/core/payments/plan.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,+BAA+B,EAAE,YAAY,EAAE,MAAM,oBAAiB,CAAC;AACrF,OAAO,KAAK,EAAE,UAA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G,YAAY,GAAG,SAAS,CAAC;IAC3D,0BAA0B,EAAE,+BAA+B,GAAG,SAAS,CAAC;CACzE;AAED;iFACiF;AACjF,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CA4B7D;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,cAAc,CAS/D;AAED;;;;gDAIgD;AAChD,MAAM,MAAM,aAAa,GAAG,IAAI,CAC9B,YAAY,EACZ,IAAI,GAAG,UAAU,GAAG,eAAe,GAAG,WAAW,GAAG,SAAS,GAAG,wCAAwC,CACzG,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,GAAG,cAAc,CA+B1F;AAaD,6FAA6F;AAC7F,wBAAsB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAiBhG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Refusals that exist only on React Native, kept out of the ported `errors.ts` so that file stays a
|
|
3
|
+
* clean mirror of the web element's.
|
|
4
|
+
*
|
|
5
|
+
* Every one is coded, so a caller switches on `code` and never string-matches a message.
|
|
6
|
+
*/
|
|
7
|
+
export type PaymentsRefusalCode = 'CONFIRMATION_IN_FLIGHT' | 'NEXT_ACTION_IN_FLIGHT' | 'NEXT_ACTION_PRESENTATION_FAILED' | 'CHARGE_CONFIG_MISSING' | 'NO_COLLECTION_SURFACE' | 'NATIVE_MODULE_MISSING' | 'WALLET_UNAVAILABLE';
|
|
8
|
+
export declare class PaymentsRefusalError extends Error {
|
|
9
|
+
readonly code: PaymentsRefusalCode;
|
|
10
|
+
constructor(code: PaymentsRefusalCode, message: string);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=refusals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refusals.d.ts","sourceRoot":"","sources":["../../../../../src/core/payments/refusals.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAC5B,wBAAwB,GACxB,uBAAuB,GACvB,iCAAiC,GACjC,uBAAuB,GACvB,uBAAuB,GACvB,uBAAuB,GACvB,oBAAoB,CAAC;AAExB,qBAAa,oBAAqB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;gBAEvB,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM;CAKtD"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The secure declared-field rail (payment-api.md §4): a matrix field marked `secure: true`
|
|
3
|
+
* renders as a Basis Theory hosted text element wearing the suite's input chrome, so the raw
|
|
4
|
+
* value NEVER exists in our JavaScript — at collect time the selected method's element
|
|
5
|
+
* INSTANCES are tokenized into ONE Basis Theory token intent, keyed by field name
|
|
6
|
+
* (`{ type: 'token', data: { bank_account: <element> } }`; BT interpolates each element's value
|
|
7
|
+
* server-side, producing exactly the legacy checkout's additional-data shape, so the
|
|
8
|
+
* checkout.com mandate interpolation `$.data.<name>` consumes it unchanged), and the category
|
|
9
|
+
* payload carries `{ token }`. The create rides the web-elements SDK's element path under the
|
|
10
|
+
* method's config-block publishable key (`tokenizer` + `public_key`, the card block's source).
|
|
11
|
+
* Intents expire on BT's default clock (24h) — the confirm consumes one long before that.
|
|
12
|
+
*/
|
|
13
|
+
import type { BasisTheoryElements } from './bt.js';
|
|
14
|
+
/** A hosted text element instance. Opaque by construction — it carries an id and a formatter, never
|
|
15
|
+
* the value the buyer typed. */
|
|
16
|
+
type ITextElement = unknown;
|
|
17
|
+
/** Applied by BT inside the hosted element at tokenization (String.replace semantics):
|
|
18
|
+
* whitespace stripped — buyers type the spaced IBAN print format, the electronic format rides. */
|
|
19
|
+
export declare const secureValueTransform: RegExp;
|
|
20
|
+
export declare function secureFieldValidation(field: {
|
|
21
|
+
formats?: Record<string, string> | null;
|
|
22
|
+
input_formats?: Record<string, string> | null;
|
|
23
|
+
}): RegExp | undefined;
|
|
24
|
+
/** Raw-data token intents ride BT's REST surface with the publishable key — the wallet sheets'
|
|
25
|
+
* leg alone (Google's tokenizationData.token is a raw string, no hosted element exists to
|
|
26
|
+
* reference). */
|
|
27
|
+
export declare function createRawTokenIntent(publicKey: string, data: unknown): Promise<string>;
|
|
28
|
+
export declare function tokenizeSecureFields(bt: BasisTheoryElements | undefined, elements: Record<string, ITextElement>,
|
|
29
|
+
/** The method's OWN config-block key. Passed per call because Basis Theory's client is a
|
|
30
|
+
* module-level singleton — the first key constructed wins for the whole process. */
|
|
31
|
+
apiKey: string): Promise<string>;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=secure-fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secure-fields.d.ts","sourceRoot":"","sources":["../../../../../src/core/payments/secure-fields.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAM,CAAC;AAIhD;iCACiC;AACjC,KAAK,YAAY,GAAG,OAAO,CAAC;AAI5B;mGACmG;AACnG,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAQ3C,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IACxC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC/C,GAAG,MAAM,GAAG,SAAS,CASrB;AAED;;kBAEkB;AAClB,wBAAsB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAU5F;AAED,wBAAsB,oBAAoB,CACxC,EAAE,EAAE,mBAAmB,GAAG,SAAS,EACnC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC;AACtC;qFACqF;AACrF,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,CAejB"}
|