78 lines
1.9 KiB
TypeScript
78 lines
1.9 KiB
TypeScript
// Metro module 6291 (f6292).
|
|
import { createExperiment } from "../../experiments/index";
|
|
import { createApexExperiment } from "../../experiments/apex/index";
|
|
import useGeoForUser_native from "../../premium/hooks/useGeoForUser.native";
|
|
const experiment = createExperiment({
|
|
kind: "user",
|
|
id: "2022-03_block_russian_purchases",
|
|
label: "Block purchases based on country",
|
|
defaultConfig: {
|
|
paymentsBlocked: false
|
|
},
|
|
treatments: [{
|
|
id: 1,
|
|
label: "Payments Blocked",
|
|
config: {
|
|
paymentsBlocked: true
|
|
}
|
|
}]
|
|
});
|
|
const apexExperiment = createApexExperiment({
|
|
name: "2026-03-block-purchases",
|
|
kind: "user",
|
|
defaultConfig: {
|
|
enabled: false
|
|
},
|
|
variations: {
|
|
1: {
|
|
enabled: true
|
|
}
|
|
}
|
|
});
|
|
export function useBlockedPaymentsConfig() {
|
|
let paymentsBlocked = experiment.useExperiment({
|
|
location: "c519a9_1"
|
|
}, {
|
|
autoTrackExposure: false
|
|
}).paymentsBlocked;
|
|
const enabled = apexExperiment.useConfig({
|
|
location: "c519a9_1"
|
|
}).enabled;
|
|
const defaultBillingCountryCode = useGeoForUser_native().defaultBillingCountryCode;
|
|
if (!paymentsBlocked) {
|
|
paymentsBlocked = enabled;
|
|
}
|
|
if (!paymentsBlocked) {
|
|
paymentsBlocked = defaultBillingCountryCode === "RU";
|
|
}
|
|
return paymentsBlocked;
|
|
}
|
|
export function useIsPaymentsBlocked() {
|
|
let paymentsBlocked = experiment.useExperiment({
|
|
location: "dc120b_3"
|
|
}, {
|
|
autoTrackExposure: false
|
|
}).paymentsBlocked;
|
|
const enabled = apexExperiment.useConfig({
|
|
location: "dc120b_3"
|
|
}).enabled;
|
|
if (!paymentsBlocked) {
|
|
paymentsBlocked = enabled;
|
|
}
|
|
return paymentsBlocked;
|
|
}
|
|
export function getIsPaymentsBlocked() {
|
|
let paymentsBlocked = experiment.getCurrentConfig({
|
|
location: "1ee357_1"
|
|
}, {
|
|
autoTrackExposure: false
|
|
}).paymentsBlocked;
|
|
const enabled = apexExperiment.getConfig({
|
|
location: "1ee357_1"
|
|
}).enabled;
|
|
if (!paymentsBlocked) {
|
|
paymentsBlocked = enabled;
|
|
}
|
|
return paymentsBlocked;
|
|
}
|