28 lines
1.2 KiB
TypeScript
28 lines
1.2 KiB
TypeScript
// Metro module 16333 (f16334).
|
|
import UserStore from "../../../stores/UserStore";
|
|
import UserOfferStore from "../../../stores/billing/UserOfferStore";
|
|
import { PaymentGateways } from "../../../_bundle/Module505";
|
|
import AutomaticLifecycleManager from "../../../lib/AutomaticLifecycleManager";
|
|
import { NitroACOMSubscriptionExperiment } from "../../billing/native/ACOMExperiments";
|
|
import { isPremium } from "../../../utils/PremiumTypeUtils";
|
|
import { fetchUserOffer } from "../UserOfferActionCreators";
|
|
class UserOfferManager extends AutomaticLifecycleManager {
|
|
actions = {
|
|
POST_CONNECTION_OPEN: () => this.handlePostConnectionOpen()
|
|
};
|
|
handlePostConnectionOpen = () => {
|
|
const currentUser = UserStore.getCurrentUser();
|
|
const r16 = NitroACOMSubscriptionExperiment.getConfig({
|
|
location: "UserOfferManager.handlePostConnectionOpen"
|
|
}).enabled ? {
|
|
offerId: void 0,
|
|
paymentGatewayOverride: PaymentGateways.APPLE_ADVANCED_COMMERCE
|
|
} : void 0;
|
|
if (!(currentUser == null || !currentUser.verified || isPremium(currentUser) || UserOfferStore.isFetchingOffer())) {
|
|
fetchUserOffer("MobilePremiumOfferManager", true, r16);
|
|
}
|
|
};
|
|
}
|
|
const userOfferManager = new UserOfferManager();
|
|
export default userOfferManager;
|