// Distribution flags for the native builds. Two independent build-time flags hide the in-app-currency // purchase actions: VITE_GP_BUILD marks the Google Play build (Google forbids selling in-app currency // through an external gate — it hides the actions and shows a stub pointing at the RuStore build), and // VITE_PAYMENTS_DISABLED marks the thin native MVP that defers store billing (it hides the actions with // no store pointer). Every other build (web, VK, Telegram, a billing-enabled RuStore native build) sells // normally. purchasesHidden() folds both; isGooglePlayBuild() stays separate for the RuStore-pointer stub. /** * isGooglePlayBuild reports whether this is the Google Play native build, where in-app-currency * purchases are hidden. It reads the build-time flag VITE_GP_BUILD (set to "1" only by the Google * Play build); every other build reads false. Under the mock e2e it can be forced on with a `?gp` * query parameter so the stub path is exercisable without a separate build. */ export function isGooglePlayBuild(): boolean { if ( import.meta.env.MODE === 'mock' && typeof window !== 'undefined' && new URLSearchParams(window.location.search).has('gp') ) { return true; } return (import.meta.env as Record).VITE_GP_BUILD === '1'; } /** * purchasesHidden reports whether this build hides the in-app-currency purchase actions. It is true * for the Google Play build (external-payment policy — see isGooglePlayBuild) and for the thin native * MVP that defers store billing (the build-time flag VITE_PAYMENTS_DISABLED set to "1"). Every other * build sells normally. Under the mock e2e it can be forced on with a `?nopay` query parameter so the * hidden-purchases state is exercisable without a separate build. */ export function purchasesHidden(): boolean { if (isGooglePlayBuild()) return true; if ( import.meta.env.MODE === 'mock' && typeof window !== 'undefined' && new URLSearchParams(window.location.search).has('nopay') ) { return true; } return (import.meta.env as Record).VITE_PAYMENTS_DISABLED === '1'; }