// Metro module 8764 (f8765). import { useEffect } from "react"; import SubscriptionPlanStore from "../../../stores/billing/SubscriptionPlanStore"; import { PaymentGateways } from "../../../_bundle/Module505"; import ContextUtils from "../../../utils/ContextUtils"; import NativePaymentHooks_android from "./hooks/NativePaymentHooks.android"; import { fetchSubscriptionPlansBySKUs } from "../../../actions/SubscriptionPlanActionCreators"; import useSubscriptionSelection from "../hooks/useSubscriptionSelection"; import { useStateFromStores } from "../../../_bundle/Module589"; let [Component, r31, r32] = ContextUtils(); export function NativePaymentContextProvider(props) { let selectedPlanId; const { children, skuIDs, activeSubscription } = props; selectedPlanId = void 0; const nativeIAPPayments = NativePaymentHooks_android.useNativeIAPPayments(); const { nativePaymentsConnected, storeFront } = nativeIAPPayments; useEffect(() => { if (!(storeFront == null || SubscriptionPlanStore.isFetchingForSKUs(skuIDs))) { fetchSubscriptionPlansBySKUs(skuIDs, storeFront.country, PaymentGateways.APPLE_ADVANCED_COMMERCE); } }, [storeFront, skuIDs]); const subscriptionSelection = useSubscriptionSelection(); selectedPlanId = subscriptionSelection.selectedPlanId; return selectedPlanId != null ? SubscriptionPlanStore.get(selectedPlanId) : null, [selectedPlanId]), storeFront, activeSubscription }}>{children}; } export { r31 as useNativeIAPPaymentContext }; export { r32 as useForwardedNativePaymentContext };