From 00fcb694231c96f6f4cd3280bf2c5c64ff86bd7f Mon Sep 17 00:00:00 2001 From: Maurice Date: Wed, 2 Dec 2026 10:20:26 +0100 Subject: [PATCH] Show verified store trials in the native cloud purchase flow [skip ci] --- .../com/liketrek/trek/billing/TrekBilling.kt | 70 ++++++++-- client/ios/App/App/TrekShellPlugin.swift | 42 +++++- client/native-shell/main.ts | 123 ++++++++++++++---- client/native-shell/shell.css | 27 ++++ client/src/native/iap.test.ts | 30 ++++- client/src/native/iap.ts | 33 +++-- client/src/native/trekShell.ts | 6 +- .../forgotPassword/useForgotPassword.test.ts | 13 ++ shared/src/i18n/ar/native.ts | 5 + shared/src/i18n/az/native.ts | 6 + shared/src/i18n/br/native.ts | 5 + shared/src/i18n/ca/native.ts | 6 + shared/src/i18n/cs/native.ts | 6 + shared/src/i18n/de/native.ts | 6 + shared/src/i18n/en/native.ts | 6 + shared/src/i18n/es/native.ts | 6 + shared/src/i18n/et/native.ts | 6 + shared/src/i18n/fr/native.ts | 6 + shared/src/i18n/gr/native.ts | 5 + shared/src/i18n/he/native.ts | 5 + shared/src/i18n/hu/native.ts | 5 + shared/src/i18n/id/native.ts | 6 + shared/src/i18n/it/native.ts | 6 + shared/src/i18n/ja/native.ts | 5 + shared/src/i18n/ko/native.ts | 5 + shared/src/i18n/nl/native.ts | 6 + shared/src/i18n/pl/native.ts | 6 + shared/src/i18n/ru/native.ts | 6 + shared/src/i18n/sk/native.ts | 6 + shared/src/i18n/sv/native.ts | 6 + shared/src/i18n/th/native.ts | 5 + shared/src/i18n/tr/native.ts | 5 + shared/src/i18n/uk/native.ts | 6 + shared/src/i18n/vi/native.ts | 6 + shared/src/i18n/zh-TW/native.ts | 5 + shared/src/i18n/zh/native.ts | 5 + 36 files changed, 440 insertions(+), 61 deletions(-) diff --git a/client/android/app/src/main/java/com/liketrek/trek/billing/TrekBilling.kt b/client/android/app/src/main/java/com/liketrek/trek/billing/TrekBilling.kt index 4b2276139..0b8bc541c 100644 --- a/client/android/app/src/main/java/com/liketrek/trek/billing/TrekBilling.kt +++ b/client/android/app/src/main/java/com/liketrek/trek/billing/TrekBilling.kt @@ -102,21 +102,61 @@ object TrekBilling { return offers.firstOrNull { it.offerId == null } ?: offers.firstOrNull() } + /** Play returns eligible offers. The named offer must be configured with Play's new-customer eligibility. */ + private fun trialOffer(product: ProductDetails): ProductDetails.SubscriptionOfferDetails? { + val base = baseOffer(product)?.takeIf { it.offerId == null } ?: return null + val recurring = base.pricingPhases.pricingPhaseList.singleOrNull() ?: return null + return product.subscriptionOfferDetails?.firstOrNull { offer -> + offer.offerId == TRIAL_OFFER_ID && offer.basePlanId == base.basePlanId && + isSevenDayTrial(offer.pricingPhases.pricingPhaseList, recurring) + } + } + + private fun isSevenDayTrial( + phases: List, + recurring: ProductDetails.PricingPhase, + ): Boolean { + if (phases.size != 2) return false + val (trial, renewal) = phases + val once = trial.recurrenceMode == ProductDetails.RecurrenceMode.NON_RECURRING || + (trial.recurrenceMode == ProductDetails.RecurrenceMode.FINITE_RECURRING && trial.billingCycleCount == 1) + return once && trial.priceAmountMicros == 0L && trial.billingPeriod in listOf("P1W", "P7D") && + renewal.recurrenceMode == ProductDetails.RecurrenceMode.INFINITE_RECURRING && + renewal.billingPeriod == recurring.billingPeriod && renewal.priceAmountMicros == recurring.priceAmountMicros && + renewal.priceCurrencyCode == recurring.priceCurrencyCode + } + fun products(context: Context, call: PluginCall) { val ids = call.getArray("ids")?.toList().orEmpty() ready(context) { ok -> val result = JSObject().put("sandbox", BuildConfig.DEBUG) - if (!ok) return@ready call.resolve(result.put("products", JSArray())) + if (!ok || ids.isEmpty()) return@ready call.resolve(result.put("products", JSArray())) details(context, ids) { found -> - val list = JSArray() - for (product in found) displayPrice(product)?.let { list.put(JSObject().put("id", product.productId).put("displayPrice", it)) } - call.resolve(result.put("products", list)) + val candidates = found.filter { trialOffer(it) != null }.map { it.productId }.toSet() + if (candidates.isEmpty()) { + call.resolve(result.put("products", productList(found, emptySet()))) + return@details + } + val params = QueryPurchasesParams.newBuilder().setProductType(BillingClient.ProductType.SUBS).build() + client(context).queryPurchasesAsync(params) { status, purchases -> + val eligible = status.responseCode == BillingClient.BillingResponseCode.OK && purchases.none { purchase -> + purchase.products.any { it.startsWith(PREFIX) } + } + call.resolve(result.put("products", productList(found, if (eligible) candidates else emptySet()))) + } } } } + private fun productList(products: List, freeTrials: Set): JSArray = JSArray().apply { + for (product in products) displayPrice(product)?.let { price -> + put(JSObject().put("id", product.productId).put("displayPrice", price).put("freeTrial", product.productId in freeTrials)) + } + } + fun purchase(activity: Activity, call: PluginCall) { val id = call.getString("productId") ?: return call.reject("productId is required") + val trialRenewalPrice = call.getString("trialRenewalPrice") ready(activity) { ok -> if (!ok) return@ready call.resolve(JSObject().put("kind", "failed")) // One subscription per Google account: a second plan would run beside the first. @@ -126,19 +166,28 @@ object TrekBilling { client(activity).queryPurchasesAsync(params) { result, purchases -> val held = if (result.responseCode == BillingClient.BillingResponseCode.OK) newest(purchases, PREFIX) else null when { - held == null -> launchPurchase(activity, call, id) - held.isAcknowledged -> call.resolve(JSObject().put("kind", "subscribed")) - else -> call.resolve(receipt(held).put("kind", "bought")) + held?.isAcknowledged == true -> call.resolve(JSObject().put("kind", "subscribed")) + held != null -> call.resolve(receipt(held).put("kind", "bought")) + trialRenewalPrice != null && result.responseCode != BillingClient.BillingResponseCode.OK -> + call.resolve(JSObject().put("kind", "offer-changed")) + purchases.any { p -> p.purchaseState == Purchase.PurchaseState.PENDING && p.products.any { it.startsWith(PREFIX) } } -> + call.resolve(JSObject().put("kind", "pending")) + else -> launchPurchase(activity, call, id, trialRenewalPrice) } } } } - private fun launchPurchase(activity: Activity, call: PluginCall, id: String) { + private fun launchPurchase(activity: Activity, call: PluginCall, id: String, trialRenewalPrice: String?) { details(activity, listOf(id)) { found -> val product = found.firstOrNull() - val offer = product?.let(::baseOffer) - if (product == null || offer == null) return@details call.resolve(JSObject().put("kind", "failed")) + val offer = product?.let { listed -> + if (trialRenewalPrice == null) baseOffer(listed) + else trialOffer(listed)?.takeIf { displayPrice(listed) == trialRenewalPrice } + } + if (product == null || offer == null) { + return@details call.resolve(JSObject().put("kind", if (trialRenewalPrice != null) "offer-changed" else "failed")) + } pendingPurchase?.resolve(JSObject().put("kind", "cancelled")) pendingPurchase = call pendingProduct = id @@ -275,6 +324,7 @@ object TrekBilling { newest(purchases.filter { !it.isAcknowledged }, prefix) private const val PREFIX = "cloud." + private const val TRIAL_OFFER_ID = "trek-trial-7-days" internal fun newest(purchases: List, prefix: String): Purchase? = purchases .filter { p -> p.purchaseState == Purchase.PurchaseState.PURCHASED && p.products.any { it.startsWith(prefix) } } diff --git a/client/ios/App/App/TrekShellPlugin.swift b/client/ios/App/App/TrekShellPlugin.swift index d98d35b07..8439172c5 100644 --- a/client/ios/App/App/TrekShellPlugin.swift +++ b/client/ios/App/App/TrekShellPlugin.swift @@ -688,14 +688,40 @@ extension TrekShellPlugin { let ids = call.getArray("ids", String.self) ?? [] Task { let sandbox = await Self.buysInSandbox() - guard AppStore.canMakePayments, let products = try? await Product.products(for: ids) else { + guard !ids.isEmpty, AppStore.canMakePayments, let products = try? await Product.products(for: ids) else { call.resolve(["products": [], "sandbox": sandbox]) return } - call.resolve(["products": products.map { ["id": $0.id, "displayPrice": $0.displayPrice] }, "sandbox": sandbox]) + var canStartTrial = false + if products.contains(where: Self.hasSevenDayFreeTrial) { + canStartTrial = await TrekStore.currentEntitlement(prefix: "cloud.") == nil + } + var groupEligibility: [String: Bool] = [:] + var rows: [[String: Any]] = [] + for product in products { + var freeTrial = false + if canStartTrial, Self.hasSevenDayFreeTrial(product), let subscription = product.subscription { + let group = subscription.subscriptionGroupID + if let cached = groupEligibility[group] { + freeTrial = cached + } else { + freeTrial = await subscription.isEligibleForIntroOffer + groupEligibility[group] = freeTrial + } + } + rows.append(["id": product.id, "displayPrice": product.displayPrice, "freeTrial": freeTrial]) + } + call.resolve(["products": rows, "sandbox": sandbox]) } } + private static func hasSevenDayFreeTrial(_ product: Product) -> Bool { + guard let offer = product.subscription?.introductoryOffer, + offer.paymentMode == .freeTrial, offer.price == 0, offer.periodCount == 1 else { return false } + return (offer.period.unit == .week && offer.period.value == 1) + || (offer.period.unit == .day && offer.period.value == 7) + } + /// Whether this build buys in the App Store sandbox: TestFlight, App Review and /// Xcode builds do, and while TREK Cloud's orders are closed only they may buy. /// The signed app transaction names its environment; the receipt's file name, @@ -726,6 +752,7 @@ extension TrekShellPlugin { call.reject("productId is required") return } + let trialRenewalPrice = call.getString("trialRenewalPrice") Task { // One subscription per Apple ID: another plan would change it, not add one. // A held one that was delivered stops the purchase here. One that was paid @@ -740,9 +767,18 @@ extension TrekShellPlugin { } do { guard let product = try await Product.products(for: [id]).first else { - call.resolve(["kind": "failed"]) + call.resolve(["kind": trialRenewalPrice == nil ? "failed" : "offer-changed"]) return } + if let trialRenewalPrice { + guard product.displayPrice == trialRenewalPrice, Self.hasSevenDayFreeTrial(product), + let subscription = product.subscription, + await subscription.isEligibleForIntroOffer else { + call.resolve(["kind": "offer-changed"]) + return + } + } + // StoreKit applies an eligible introductory offer in its purchase sheet. switch try await product.purchase() { case .success(let verification): guard case .verified(let transaction) = verification else { diff --git a/client/native-shell/main.ts b/client/native-shell/main.ts index 1436be314..9f10fca31 100644 --- a/client/native-shell/main.ts +++ b/client/native-shell/main.ts @@ -8,7 +8,7 @@ import logoWhite from '../public/logo-light.svg'; // #fff wordmark, for the land import { pageUnderStatusBar } from '../src/native/appBoot'; import { AUTH_GATE_NAMES, canSignInInApp, type AuthGate } from '../src/native/authGate'; import { isNewCloudPlan, opensSoon, planForUnclaimedPurchase, refundedBeforeOpening } from '../src/native/cloudOrders'; -import { fakeIapClient, getIapClient, productIdFor, type Purchase } from '../src/native/iap'; +import { fakeIapClient, getIapClient, productIdFor, type IapProduct, type Purchase } from '../src/native/iap'; import { APP_STORE_SUBSCRIPTIONS_URL, AUTH_PROXY_DOCS_URL, @@ -315,7 +315,8 @@ function showWelcome(opts: { back?: boolean } = {}): void { const perk = (glyph: string, title: string, sub: string) => el('div', {}, el('i', {}, icon(glyph, 17)), el('span', {}, el('b', {}, title), el('small', {}, sub))); - const discover = el('button', { type: 'button', className: 'cta' }, t('native.welcome.discover')); + const trial = el('span', { className: 'trial-badge', hidden: true }, icon(I.spark, 12), t('native.trial.badge')); + const discover = el('button', { type: 'button', className: 'cta discover' }, t('native.welcome.discover'), trial); discover.addEventListener('click', () => { void tap(); showPlans(); @@ -326,7 +327,7 @@ function showWelcome(opts: { back?: boolean } = {}): void { showConnect(); }); - show( + const screen = show( 'welcome', WELCOME_CAMERA, { @@ -351,6 +352,9 @@ function showWelcome(opts: { back?: boolean } = {}): void { }, opts ); + void availableWelcomeTrial().then((available) => { + if (screen.node.isConnected) trial.hidden = !available; + }); } // ── Connect (address) ─────────────────────────────────────────────────────── @@ -686,7 +690,7 @@ const SAMPLE_PLANS: CloudPlan[] = [ currency: 'USD', aiDocuments: 0, aiDocumentLimit: 0, - storageGb: 200, + storageGb: 50, }, { id: 'plus', @@ -696,9 +700,9 @@ const SAMPLE_PLANS: CloudPlan[] = [ currency: 'USD', aiDocuments: 100, aiDocumentLimit: null, - aiAssistant: 'planned', + aiAssistant: 'included', bookingMailImport: true, - storageGb: 200, + storageGb: 50, }, ]; @@ -706,6 +710,8 @@ interface CloudPlans { plans: CloudPlan[]; /** Orders are closed: only a test build may buy, and the store charges it nothing. */ closed: boolean; + /** Only the live catalogue's explicit opening permits customer trial advertising. */ + open?: boolean; } async function fetchPlans(): Promise { @@ -714,7 +720,8 @@ async function fetchPlans(): Promise { const data = typeof res.data === 'string' ? JSON.parse(res.data) : res.data; const body = (data ?? {}) as { plans?: CloudPlan[]; ordering?: string }; const plans = Array.isArray(body.plans) ? body.plans.filter((plan) => isNewCloudPlan(plan.id)) : []; - if (plans.length) return { plans, closed: body.ordering === 'closed' }; + if (plans.length) + return { plans, closed: body.ordering === 'closed', open: res.status === 200 && body.ordering === 'open' }; } catch { // Fall through to the preview fallback. } @@ -730,22 +737,44 @@ async function fetchPlans(): Promise { */ interface Offer { canBuy: boolean; - storePrices: Map | null; + storeProducts: Map | null; + canShowTrial: boolean; /** Orders are closed and this is no test build: the plans show, nothing is for sale yet. */ opensSoon: boolean; } -function offerFor(offer: Offer, plan: CloudPlan, interval: 'month' | 'year'): { label: string; buyable: boolean } { - if (!offer.canBuy) return { label: '', buyable: false }; +function offerFor( + offer: Offer, + plan: CloudPlan, + interval: 'month' | 'year' +): { label: string; buyable: boolean; freeTrial: boolean } { + if (!offer.canBuy) return { label: '', buyable: false, freeTrial: false }; if (iap !== fakeIapClient) { - const label = offer.storePrices?.get(productIdFor(plan.id, interval)) ?? ''; - return { label, buyable: label !== '' }; + const product = offer.storeProducts?.get(productIdFor(plan.id, interval)); + const label = product?.displayPrice ?? ''; + return { + label, + buyable: label !== '', + freeTrial: label !== '' && offer.canShowTrial && product?.freeTrial === true, + }; } const cents = interval === 'year' ? plan.yearlyCents : plan.monthlyCents; const currency = plan.currency ?? 'EUR'; const label = typeof cents === 'number' ? new Intl.NumberFormat(locale, { style: 'currency', currency }).format(cents / 100) : ''; - return { label, buyable: label !== '' }; + return { label, buyable: label !== '', freeTrial: false }; +} + +function storeIds(plans: CloudPlan[]): string[] { + return plans.flatMap((p) => [productIdFor(p.id, 'month'), productIdFor(p.id, 'year')]); +} + +async function availableWelcomeTrial(): Promise { + if (iap === fakeIapClient || !(await iapReady)) return false; + const list = await fetchPlans(); + if (!list?.open) return false; + const products = await iap.products(storeIds(list.plans)); + return Array.from(products.values()).some((product) => product.freeTrial && product.displayPrice !== ''); } async function loadOffer(list: CloudPlans): Promise { @@ -755,9 +784,13 @@ async function loadOffer(list: CloudPlans): Promise { const sandbox = list.closed && !onPlay ? await iap.isSandbox().catch(() => false) : false; const soon = opensSoon({ available, closed: list.closed, sandbox, onPlay }); const canBuy = available && !soon; - if (!canBuy || iap === fakeIapClient) return { canBuy, storePrices: null, opensSoon: soon }; - const ids = list.plans.flatMap((p) => [productIdFor(p.id, 'month'), productIdFor(p.id, 'year')]); - return { canBuy, storePrices: await iap.prices(ids), opensSoon: soon }; + if (!canBuy || iap === fakeIapClient) return { canBuy, storeProducts: null, canShowTrial: false, opensSoon: soon }; + return { + canBuy, + storeProducts: await iap.products(storeIds(list.plans)), + canShowTrial: list.open === true, + opensSoon: soon, + }; } /** The plan the picker starts on and marks: the smallest one with AI documents, the one most trips want. */ @@ -782,6 +815,14 @@ function per(interval: 'month' | 'year'): string { return interval === 'year' ? t('native.plans.perYear') : t('native.plans.perMonth'); } +function trialPrice(price: string, interval: 'month' | 'year'): string { + return t('native.trial.price', { price, period: per(interval) }); +} + +function trialCancellation(): string { + return t(onPlay ? 'native.trial.cancelPlay' : 'native.trial.cancelApple'); +} + /** The restore button of the plans on screen, which redeems a payment that cleared later. */ let resumeRestore: (() => void) | null = null; let watchingTransactions = false; @@ -852,7 +893,7 @@ function restoreButton(plans: CloudPlan[]): HTMLButtonElement { function showPlans(opts: { back?: boolean } = {}): void { let interval: 'month' | 'year' = chosenInterval; let plans: CloudPlan[] = []; - let offer: Offer = { canBuy: false, storePrices: null, opensSoon: false }; + let offer: Offer = { canBuy: false, storeProducts: null, canShowTrial: false, opensSoon: false }; let selectedId: string | null = null; const tiers = el('div', { className: 'tiers', role: 'radiogroup', hidden: true }); @@ -876,9 +917,11 @@ function showPlans(opts: { back?: boolean } = {}): void { const pricePer = el('span', {}); const price = el('div', { className: 'price' }, priceValue, pricePer); const equals = el('div', { className: 'equals' }); - const pricebox = el('div', { className: 'pricebox' }, cycle, price, equals); + const trial = el('p', { className: 'trial-price', hidden: true }); + const pricebox = el('div', { className: 'pricebox' }, cycle, price, equals, trial); const specs = el('div', { className: 'specs' }); const foot = el('div', { className: 'pad', hidden: true }); + const legal = el('p', { className: 'legal' }); const loading = el('div', { className: 'loading' }, el('span', { className: 'spin' })); const details = el('div', { className: 'stack', hidden: true }, trip, pricebox, specs); @@ -943,7 +986,7 @@ function showPlans(opts: { back?: boolean } = {}): void { text.textContent = tripText; text.hidden = !tripText; - const { label, buyable } = interval === 'month' ? month : year; + const { label, buyable, freeTrial } = interval === 'month' ? month : year; // No price yet (orders not open): the plan shows without one rather than with an empty one. price.hidden = !label; pricePer.textContent = per(interval); @@ -955,13 +998,18 @@ function showPlans(opts: { back?: boolean } = {}): void { yearBtn.disabled = !year.label; const yearAmount = amountIn(year.label); equals.textContent = - !label || !year.label + !label || !year.label || freeTrial ? '' : interval === 'month' ? t('native.plans.yearlyIs', { price: year.label }) : yearAmount ? t('native.plans.monthlyIs', { price: yearAmount.render(yearAmount.value / 12) }) : ''; + trial.hidden = !freeTrial; + trial.textContent = freeTrial ? trialPrice(label, interval) : ''; + legal.textContent = freeTrial + ? trialCancellation() + : t(onPlay ? 'native.plans.legalAndroid' : 'native.plans.legal'); const gb = plan.storageGb >= 1000 ? `${count(plan.storageGb / 1000)} TB` : `${count(plan.storageGb)} GB`; const notIncluded = t('native.plans.aiNone'); @@ -1042,7 +1090,7 @@ function showPlans(opts: { back?: boolean } = {}): void { showSubscribed(); return; } - showClaim(plan, selectedInterval, price.label); + showClaim(plan, selectedInterval, price.label, { freeTrial: price.freeTrial }); }); const load = async () => { @@ -1083,7 +1131,7 @@ function showPlans(opts: { back?: boolean } = {}): void { ); } else { foot.replaceChildren( - el('p', { className: 'legal' }, t(onPlay ? 'native.plans.legalAndroid' : 'native.plans.legal')), + legal, el( 'div', { className: 'legal-links' }, @@ -1195,7 +1243,7 @@ function showClaim( plan: Pick, interval: 'month' | 'year', priceLabel: string, - opts: { back?: boolean; bought?: Purchase } = {} + opts: { back?: boolean; bought?: Purchase; freeTrial?: boolean } = {} ): void { /** A purchase that went through but whose redeem did not: a retry redeems it again instead of buying twice. */ let bought: Purchase | null = opts.bought ?? null; @@ -1300,7 +1348,11 @@ function showClaim( void loadConsent(); const subscribeLabel = () => - bought ? t('native.claim.completeSetup') : t('native.claim.subscribe', { price: priceLabel }); + bought + ? t('native.claim.completeSetup') + : opts.freeTrial + ? t('native.trial.badge') + : t('native.claim.subscribe', { price: priceLabel }); const submit = el('button', { type: 'button', className: 'cta' }, subscribeLabel()); // What is about to be bought, so nobody pays for a plan they did not mean. const change = el('button', { type: 'button' }, t('native.claim.change')); @@ -1315,7 +1367,13 @@ function showClaim( 'span', {}, el('b', {}, plan.name), - ...(priceLabel ? [el('small', { dir: 'ltr' }, `${priceLabel} ${per(interval)}`)] : []) + ...(priceLabel + ? [ + opts.freeTrial + ? el('small', {}, trialPrice(priceLabel, interval)) + : el('small', { dir: 'ltr' }, `${priceLabel} ${per(interval)}`), + ] + : []) ), // A purchase already made is not a choice any more. ...(bought ? [] : [change]) @@ -1349,7 +1407,12 @@ function showClaim( overlay: [card.node], content: [ form, - el('div', { className: 'dock' }, submit, el('p', { className: 'fine' }, t('native.claim.renews'))), + el( + 'div', + { className: 'dock' }, + submit, + el('p', { className: 'fine' }, opts.freeTrial ? trialCancellation() : t('native.claim.renews')) + ), ], }, opts @@ -1460,7 +1523,13 @@ function showClaim( }; if (!bought) { - const outcome = await iap.purchase(productIdFor(plan.id, interval)); + const trialRenewalPrice = opts.freeTrial ? priceLabel : undefined; + const outcome = await iap.purchase(productIdFor(plan.id, interval), trialRenewalPrice); + if (outcome.kind === 'offer-changed') { + restore(); + setNotice(error, t('native.trial.changed')); + return; + } if (outcome.kind === 'cancelled') { restore(); setNotice(error, t('native.claim.cancelled')); diff --git a/client/native-shell/shell.css b/client/native-shell/shell.css index 71e55501e..506078122 100644 --- a/client/native-shell/shell.css +++ b/client/native-shell/shell.css @@ -628,6 +628,33 @@ h1 { font: 700 17px var(--text-face); box-shadow: 0 14px 28px -14px rgba(17, 24, 39, 0.55); } +.discover { + position: relative; + padding-inline: 16px; +} +.trial-badge { + position: absolute; + inset-block-start: -10px; + inset-inline-end: 10px; + display: inline-flex; + align-items: center; + gap: 5px; + max-inline-size: calc(100% - 20px); + padding: 3px 8px; + border: 1px solid #bee3d7; + border-radius: 999px; + background: #e7f6ef; + color: #195247; + box-shadow: 0 2px 6px #11182720; + font: 700 11px/1.4 var(--text-face); +} +.trial-price { + margin: 6px 12px 0; + color: #195247; + text-align: center; + font-size: 13px; + font-weight: 700; +} .cta2 { min-height: 52px; background: #fff; diff --git a/client/src/native/iap.test.ts b/client/src/native/iap.test.ts index 183371f35..e8b267d90 100644 --- a/client/src/native/iap.test.ts +++ b/client/src/native/iap.test.ts @@ -84,15 +84,22 @@ describe('native client', () => { expect(await fakeIapClient.isSandbox()).toBe(true); }); - it('maps the store price strings by product', async () => { - shell.storeProducts.mockResolvedValue({ products: [{ id: 'cloud.plus.monthly', displayPrice: '9,99 €' }] }); - const prices = await nativeIapClient.prices(['cloud.plus.monthly', 'cloud.pro.monthly']); - expect(shell.storeProducts).toHaveBeenCalledWith({ ids: ['cloud.plus.monthly', 'cloud.pro.monthly'] }); - expect(prices.get('cloud.plus.monthly')).toBe('9,99 €'); - expect(prices.has('cloud.pro.monthly')).toBe(false); + it('maps the regular price and explicitly confirmed trial by product', async () => { + shell.storeProducts.mockResolvedValue({ + products: [ + { id: 'cloud.plus.monthly', displayPrice: '9,99 €', freeTrial: true }, + { id: 'cloud.start.monthly', displayPrice: '4,99 €' }, + ], + }); + const ids = ['cloud.plus.monthly', 'cloud.start.monthly', 'cloud.plus.yearly']; + const products = await nativeIapClient.products(ids); + expect(shell.storeProducts).toHaveBeenCalledWith({ ids }); + expect(products.get('cloud.plus.monthly')).toEqual({ displayPrice: '9,99 €', freeTrial: true }); + expect(products.get('cloud.start.monthly')).toEqual({ displayPrice: '4,99 €', freeTrial: false }); + expect(products.has('cloud.plus.yearly')).toBe(false); shell.storeProducts.mockRejectedValue(new Error('down')); - expect((await nativeIapClient.prices(['cloud.plus.monthly'])).size).toBe(0); + expect((await nativeIapClient.products(['cloud.plus.monthly'])).size).toBe(0); }); it('turns a bought transaction into a receipt', async () => { @@ -124,6 +131,15 @@ describe('native client', () => { expect(await nativeIapClient.held()).toBe(false); }); + it('asks the store to preserve an advertised trial and reports a changed offer without retrying as paid', async () => { + shell.storePurchase.mockResolvedValue({ kind: 'offer-changed' }); + expect(await nativeIapClient.purchase('cloud.plus.monthly', '9,99 €')).toEqual({ kind: 'offer-changed' }); + expect(shell.storePurchase).toHaveBeenCalledExactlyOnceWith({ + productId: 'cloud.plus.monthly', + trialRenewalPrice: '9,99 €', + }); + }); + it('a build without storeHeld counts as holding nothing; the purchase still guards', async () => { shell.storeHeld.mockRejectedValue(new Error('not implemented')); expect(await nativeIapClient.held()).toBe(false); diff --git a/client/src/native/iap.ts b/client/src/native/iap.ts index 294edb62b..9681193b1 100644 --- a/client/src/native/iap.ts +++ b/client/src/native/iap.ts @@ -38,17 +38,23 @@ type PurchaseOutcome = | { kind: 'cancelled' } | { kind: 'pending' } | { kind: 'failed' } + | { kind: 'offer-changed' } | { kind: 'subscribed' }; +export interface IapProduct { + displayPrice: string; + /** The store confirms an eligible first week at no charge. */ + freeTrial: boolean; +} + export interface IapClient { /** Whether this build can take a payment. */ isAvailable(): Promise; /** - * The store's own price strings by product id, in the buyer's currency. A - * product missing from the map cannot be bought here. Empty for the fake, whose - * prices come from the plan list. + * Store pricing and offer eligibility by product id. A missing product cannot + * be bought. Empty for the fake, whose prices come from the plan list. */ - prices(productIds: string[]): Promise>; + products(productIds: string[]): Promise>; /** A test build (TestFlight, App Review), whose purchases cost nothing and may go ahead before the opening. */ isSandbox(): Promise; /** @@ -58,7 +64,7 @@ export interface IapClient { */ held(): Promise; /** Runs the platform's purchase sheet for a product and resolves with what became of it. */ - purchase(productId: string): Promise; + purchase(productId: string, trialRenewalPrice?: string): Promise; /** Tells the store a purchase was delivered, once its instance exists. */ finish(purchase: Purchase): Promise; /** The subscription this store account already holds, for a reinstall or a new device. */ @@ -94,7 +100,7 @@ export const fakeIapClient: IapClient = { async isAvailable() { return true; }, - async prices() { + async products() { return new Map(); }, async isSandbox() { @@ -151,10 +157,10 @@ export const nativeIapClient: IapClient = { return false; } }, - async prices(productIds) { + async products(productIds) { try { const { products } = await TrekShell.storeProducts({ ids: productIds }); - return new Map(products.map((p) => [p.id, p.displayPrice])); + return new Map(products.map((p) => [p.id, { displayPrice: p.displayPrice, freeTrial: p.freeTrial === true }])); } catch { return new Map(); } @@ -166,9 +172,9 @@ export const nativeIapClient: IapClient = { return false; } }, - async purchase(productId) { + async purchase(productId, trialRenewalPrice) { try { - const result = await TrekShell.storePurchase({ productId }); + const result = await TrekShell.storePurchase({ productId, ...(trialRenewalPrice ? { trialRenewalPrice } : {}) }); const receipt = result.jws ?? result.purchaseToken; if (result.kind === 'bought' && receipt && result.transactionId) { return { @@ -181,7 +187,12 @@ export const nativeIapClient: IapClient = { }, }; } - if (result.kind === 'cancelled' || result.kind === 'pending' || result.kind === 'subscribed') { + if ( + result.kind === 'cancelled' || + result.kind === 'pending' || + result.kind === 'subscribed' || + result.kind === 'offer-changed' + ) { return { kind: result.kind }; } return { kind: 'failed' }; diff --git a/client/src/native/trekShell.ts b/client/src/native/trekShell.ts index ea5670079..9f0d22783 100644 --- a/client/src/native/trekShell.ts +++ b/client/src/native/trekShell.ts @@ -128,14 +128,14 @@ export interface TrekShellPlugin { /** Feature storeKit (iOS) or playBilling (Android): the store's price strings for the products it knows. */ storeProducts(options: { ids: string[]; - }): Promise<{ products: { id: string; displayPrice: string }[]; sandbox?: boolean }>; + }): Promise<{ products: { id: string; displayPrice: string; freeTrial?: boolean }[]; sandbox?: boolean }>; /** * The purchase sheet. Set when bought: on iOS `jws`, the signed transaction; on * Android `purchaseToken`, which the control plane verifies with Google Play. */ - storePurchase(options: { productId: string }): Promise<{ + storePurchase(options: { productId: string; trialRenewalPrice?: string }): Promise<{ /** `subscribed`: this store account already holds a delivered subscription, so nothing was bought. */ - kind: 'bought' | 'cancelled' | 'pending' | 'failed' | 'subscribed'; + kind: 'bought' | 'cancelled' | 'pending' | 'failed' | 'subscribed' | 'offer-changed'; jws?: string; purchaseToken?: string; productId?: string; diff --git a/client/src/pages/forgotPassword/useForgotPassword.test.ts b/client/src/pages/forgotPassword/useForgotPassword.test.ts index d4a1045d4..c08d1dbda 100644 --- a/client/src/pages/forgotPassword/useForgotPassword.test.ts +++ b/client/src/pages/forgotPassword/useForgotPassword.test.ts @@ -1,5 +1,6 @@ // FE-PAGE-FORGOT-001 to FE-PAGE-FORGOT-008 import { act, renderHook, waitFor } from '@testing-library/react'; +import { AxiosError } from 'axios'; import type { FormEvent } from 'react'; import { authApi } from '../../api/client'; import { useForgotPassword } from './useForgotPassword'; @@ -72,6 +73,18 @@ describe('useForgotPassword', () => { await act(() => result.current.handleSubmit(submitEvent())); expect(result.current.submitted).toBe(true); + expect(result.current.deliveryIssue).toBeNull(); + }); + + it('distinguishes a lost connection without revealing information about the address', async () => { + vi.mocked(authApi.forgotPassword).mockRejectedValueOnce(new AxiosError('Lost connection', 'ERR_NETWORK')); + const { result } = renderHook(() => useForgotPassword()); + + await act(() => result.current.handleSubmit(submitEvent())); + expect(result.current.deliveryIssue).toBe('connection'); + + await act(() => result.current.handleSubmit(submitEvent())); + expect(result.current.deliveryIssue).toBeNull(); }); it('FE-PAGE-FORGOT-007: ignores a second submit while the first is in flight', async () => { diff --git a/shared/src/i18n/ar/native.ts b/shared/src/i18n/ar/native.ts index ff3e3329d..bd8612b1d 100644 --- a/shared/src/i18n/ar/native.ts +++ b/shared/src/i18n/ar/native.ts @@ -1,6 +1,11 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': 'لتجنب الدفع، ألغِ الاشتراك في App Store قبل نهاية الفترة التجريبية بـ٢٤ ساعة على الأقل.', + 'native.trial.cancelPlay': 'لتجنب الدفع، ألغِ الاشتراك في Google Play قبل نهاية الفترة التجريبية.', + 'native.trial.badge': '٧ أيام مجانًا', + 'native.trial.price': '٧ أيام مجانًا، ثم {price} {period}.', + 'native.trial.changed': 'تغيّر العرض. ارجع إلى الخطط وتحقّق من السعر الحالي.', 'native.connect.title': 'الاتصال بـ TREK', 'native.connect.hint': 'أدخل العنوان الذي تفتح به TREK في متصفحك.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/az/native.ts b/shared/src/i18n/az/native.ts index 0f390828a..1a39e7c90 100644 --- a/shared/src/i18n/az/native.ts +++ b/shared/src/i18n/az/native.ts @@ -1,6 +1,12 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': + 'Ödəniş tutulmaması üçün sınaq bitməzdən ən azı 24 saat əvvəl App Store-da abunəliyi ləğv edin.', + 'native.trial.cancelPlay': 'Ödəniş tutulmaması üçün sınaq bitməzdən əvvəl Google Play-də abunəliyi ləğv edin.', + 'native.trial.badge': '7 gün pulsuz', + 'native.trial.price': '7 gün pulsuz, sonra {period} {price}.', + 'native.trial.changed': 'Təklif dəyişib. Tariflərə qayıdıb cari qiyməti yoxlayın.', 'native.connect.title': 'TREK-ə qoşulun', 'native.connect.hint': 'TREK-i brauzerdə açdığınız ünvanı daxil edin.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/br/native.ts b/shared/src/i18n/br/native.ts index 8be4e6742..2219c0ed5 100644 --- a/shared/src/i18n/br/native.ts +++ b/shared/src/i18n/br/native.ts @@ -1,6 +1,11 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': 'Para evitar cobranças, cancele no App Store pelo menos 24 horas antes do fim do teste.', + 'native.trial.cancelPlay': 'Para evitar cobranças, cancele no Google Play antes do fim do teste.', + 'native.trial.badge': '7 dias grátis', + 'native.trial.price': '7 dias grátis, depois {price} {period}.', + 'native.trial.changed': 'A oferta mudou. Volte aos planos e confira o preço atual.', 'native.connect.title': 'Conectar ao TREK', 'native.connect.hint': 'Digite o endereço em que você abre o TREK no navegador.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/ca/native.ts b/shared/src/i18n/ca/native.ts index ad857e1b6..77cf90ff5 100644 --- a/shared/src/i18n/ca/native.ts +++ b/shared/src/i18n/ca/native.ts @@ -1,6 +1,12 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': + 'Per evitar el cobrament, cancel·la a l’App Store almenys 24 hores abans que acabi la prova.', + 'native.trial.cancelPlay': 'Per evitar el cobrament, cancel·la a Google Play abans que acabi la prova.', + 'native.trial.badge': '7 dies gratis', + 'native.trial.price': '7 dies gratis, després {price} {period}.', + 'native.trial.changed': 'L’oferta ha canviat. Torna als plans i comprova el preu actual.', 'native.connect.title': 'Connecta amb TREK', 'native.connect.hint': 'Introdueix l’adreça amb què obres TREK al navegador.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/cs/native.ts b/shared/src/i18n/cs/native.ts index 55091aea9..4cf1aa60c 100644 --- a/shared/src/i18n/cs/native.ts +++ b/shared/src/i18n/cs/native.ts @@ -1,6 +1,12 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': + 'Platbě předejdete zrušením předplatného v App Storu nejpozději 24 hodin před koncem zkušební doby.', + 'native.trial.cancelPlay': 'Platbě předejdete zrušením předplatného na Google Play před koncem zkušební doby.', + 'native.trial.badge': '7 dní zdarma', + 'native.trial.price': '7 dní zdarma, poté {price} {period}.', + 'native.trial.changed': 'Nabídka se změnila. Vraťte se k tarifům a zkontrolujte aktuální cenu.', 'native.connect.title': 'Připojit k TREK', 'native.connect.hint': 'Zadejte adresu, na které otevíráte TREK v prohlížeči.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/de/native.ts b/shared/src/i18n/de/native.ts index d31636c31..d970dc1ed 100644 --- a/shared/src/i18n/de/native.ts +++ b/shared/src/i18n/de/native.ts @@ -1,6 +1,12 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': + 'Kündige im App Store mindestens 24 Stunden vor Ende der Testphase, um eine Abbuchung zu vermeiden.', + 'native.trial.cancelPlay': 'Kündige bei Google Play vor Ende der Testphase, um eine Abbuchung zu vermeiden.', + 'native.trial.badge': '7 Tage kostenlos', + 'native.trial.price': '7 Tage kostenlos, danach {price} {period}.', + 'native.trial.changed': 'Das Angebot hat sich geändert. Geh zurück zur Tarifauswahl und prüfe den aktuellen Preis.', 'native.connect.title': 'Mit TREK verbinden', 'native.connect.hint': 'Gib die Adresse ein, unter der du TREK im Browser öffnest.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/en/native.ts b/shared/src/i18n/en/native.ts index 1b6465fdc..5be711ef2 100644 --- a/shared/src/i18n/en/native.ts +++ b/shared/src/i18n/en/native.ts @@ -1,6 +1,12 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': + 'To avoid being charged, cancel in the App Store at least 24 hours before the trial ends.', + 'native.trial.cancelPlay': 'To avoid being charged, cancel in Google Play before the trial ends.', + 'native.trial.badge': '7 days free', + 'native.trial.price': '7 days free, then {price} {period}.', + 'native.trial.changed': 'The offer has changed. Go back to your plans and check the current price.', 'native.connect.title': 'Connect to TREK', 'native.connect.hint': 'Enter the address you open TREK at in your browser.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/es/native.ts b/shared/src/i18n/es/native.ts index d8866c617..f596664bc 100644 --- a/shared/src/i18n/es/native.ts +++ b/shared/src/i18n/es/native.ts @@ -1,6 +1,12 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': + 'Para evitar el cobro, cancela en el App Store al menos 24 horas antes de que termine la prueba.', + 'native.trial.cancelPlay': 'Para evitar el cobro, cancela en Google Play antes de que termine la prueba.', + 'native.trial.badge': '7 días gratis', + 'native.trial.price': '7 días gratis, después {price} {period}.', + 'native.trial.changed': 'La oferta ha cambiado. Vuelve a los planes y consulta el precio actual.', 'native.connect.title': 'Conectar con TREK', 'native.connect.hint': 'Introduce la dirección con la que abres TREK en tu navegador.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/et/native.ts b/shared/src/i18n/et/native.ts index febcfa912..264188dfb 100644 --- a/shared/src/i18n/et/native.ts +++ b/shared/src/i18n/et/native.ts @@ -1,6 +1,12 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': + 'Makse vältimiseks tühista tellimus App Store’is vähemalt 24 tundi enne prooviperioodi lõppu.', + 'native.trial.cancelPlay': 'Makse vältimiseks tühista tellimus Google Plays enne prooviperioodi lõppu.', + 'native.trial.badge': '7 päeva tasuta', + 'native.trial.price': '7 päeva tasuta, seejärel {price} {period}.', + 'native.trial.changed': 'Pakkumine on muutunud. Mine tagasi pakettide juurde ja kontrolli praegust hinda.', 'native.connect.title': 'Ühenda TREKiga', 'native.connect.hint': 'Sisesta aadress, millel avad TREKi brauseris.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/fr/native.ts b/shared/src/i18n/fr/native.ts index 5e4e6a3f1..61b53cc43 100644 --- a/shared/src/i18n/fr/native.ts +++ b/shared/src/i18n/fr/native.ts @@ -1,6 +1,12 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': + 'Pour éviter un paiement, résilie dans l’App Store au moins 24 heures avant la fin de l’essai.', + 'native.trial.cancelPlay': 'Pour éviter un paiement, résilie dans Google Play avant la fin de l’essai.', + 'native.trial.badge': '7 jours gratuits', + 'native.trial.price': '7 jours gratuits, puis {price} {period}.', + 'native.trial.changed': 'L’offre a changé. Reviens aux forfaits et vérifie le prix actuel.', 'native.connect.title': 'Se connecter à TREK', 'native.connect.hint': 'Saisissez l’adresse à laquelle vous ouvrez TREK dans votre navigateur.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/gr/native.ts b/shared/src/i18n/gr/native.ts index d8074bf59..3de78b30f 100644 --- a/shared/src/i18n/gr/native.ts +++ b/shared/src/i18n/gr/native.ts @@ -1,6 +1,11 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': 'Για να μη χρεωθείς, ακύρωσε στο App Store τουλάχιστον 24 ώρες πριν λήξει η δοκιμή.', + 'native.trial.cancelPlay': 'Για να μη χρεωθείς, ακύρωσε στο Google Play πριν λήξει η δοκιμή.', + 'native.trial.badge': '7 ημέρες δωρεάν', + 'native.trial.price': '7 ημέρες δωρεάν, μετά {price} {period}.', + 'native.trial.changed': 'Η προσφορά άλλαξε. Γύρισε στα προγράμματα και έλεγξε την τρέχουσα τιμή.', 'native.connect.title': 'Σύνδεση στο TREK', 'native.connect.hint': 'Πληκτρολογήστε τη διεύθυνση με την οποία ανοίγετε το TREK στο πρόγραμμα περιήγησης.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/he/native.ts b/shared/src/i18n/he/native.ts index adc451413..5770907ef 100644 --- a/shared/src/i18n/he/native.ts +++ b/shared/src/i18n/he/native.ts @@ -1,6 +1,11 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': 'כדי להימנע מחיוב, בטלו ב-App Store לפחות 24 שעות לפני סיום תקופת הניסיון.', + 'native.trial.cancelPlay': 'כדי להימנע מחיוב, בטלו ב-Google Play לפני סיום תקופת הניסיון.', + 'native.trial.badge': '7 ימים בחינם', + 'native.trial.price': '7 ימים בחינם, ולאחר מכן {price} {period}.', + 'native.trial.changed': 'המבצע השתנה. חזרו למסלולים ובדקו את המחיר העדכני.', 'native.connect.title': 'התחברות ל-TREK', 'native.connect.hint': 'הזינו את הכתובת שבה אתם פותחים את TREK בדפדפן.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/hu/native.ts b/shared/src/i18n/hu/native.ts index 27ae978c8..a58d6bb82 100644 --- a/shared/src/i18n/hu/native.ts +++ b/shared/src/i18n/hu/native.ts @@ -1,6 +1,11 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': 'A díj elkerüléséhez mondd le az App Store-ban legalább 24 órával a próbaidő vége előtt.', + 'native.trial.cancelPlay': 'A díj elkerüléséhez mondd le a Google Playen a próbaidő vége előtt.', + 'native.trial.badge': '7 nap ingyen', + 'native.trial.price': '7 nap ingyen, utána {price} {period}.', + 'native.trial.changed': 'Az ajánlat megváltozott. Térj vissza a csomagokhoz, és ellenőrizd az aktuális árat.', 'native.connect.title': 'Csatlakozás a TREK-hez', 'native.connect.hint': 'Add meg azt a címet, amelyen a böngésződben megnyitod a TREK-et.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/id/native.ts b/shared/src/i18n/id/native.ts index 4241abe40..e2b61baa5 100644 --- a/shared/src/i18n/id/native.ts +++ b/shared/src/i18n/id/native.ts @@ -1,6 +1,12 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': + 'Untuk menghindari tagihan, batalkan di App Store setidaknya 24 jam sebelum masa uji coba berakhir.', + 'native.trial.cancelPlay': 'Untuk menghindari tagihan, batalkan di Google Play sebelum masa uji coba berakhir.', + 'native.trial.badge': 'Gratis 7 hari', + 'native.trial.price': 'Gratis 7 hari, lalu {price} {period}.', + 'native.trial.changed': 'Penawaran telah berubah. Kembali ke daftar paket dan periksa harga saat ini.', 'native.connect.title': 'Hubungkan ke TREK', 'native.connect.hint': 'Masukkan alamat yang kamu gunakan untuk membuka TREK di browser.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/it/native.ts b/shared/src/i18n/it/native.ts index 1a31268d9..b7108c71f 100644 --- a/shared/src/i18n/it/native.ts +++ b/shared/src/i18n/it/native.ts @@ -1,6 +1,12 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': + 'Per evitare l’addebito, annulla su App Store almeno 24 ore prima della fine della prova.', + 'native.trial.cancelPlay': 'Per evitare l’addebito, annulla su Google Play prima della fine della prova.', + 'native.trial.badge': '7 giorni gratis', + 'native.trial.price': '7 giorni gratis, poi {price} {period}.', + 'native.trial.changed': 'L’offerta è cambiata. Torna ai piani e controlla il prezzo attuale.', 'native.connect.title': 'Connetti a TREK', 'native.connect.hint': 'Inserisci l’indirizzo con cui apri TREK nel browser.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/ja/native.ts b/shared/src/i18n/ja/native.ts index c1d1c3c73..6644f3235 100644 --- a/shared/src/i18n/ja/native.ts +++ b/shared/src/i18n/ja/native.ts @@ -1,6 +1,11 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': '請求を避けるには、無料期間が終わる24時間以上前にApp Storeで解約してください。', + 'native.trial.cancelPlay': '請求を避けるには、無料期間が終わる前にGoogle Playで解約してください。', + 'native.trial.badge': '7日間無料', + 'native.trial.price': '7日間無料。その後は{period}{price}です。', + 'native.trial.changed': 'オファーが変更されました。プラン一覧に戻り、現在の料金をご確認ください。', 'native.connect.title': 'TREK に接続', 'native.connect.hint': 'ブラウザで TREK を開くときのアドレスを入力してください。', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/ko/native.ts b/shared/src/i18n/ko/native.ts index fe7720b50..e1d08f225 100644 --- a/shared/src/i18n/ko/native.ts +++ b/shared/src/i18n/ko/native.ts @@ -1,6 +1,11 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': '요금이 청구되지 않으려면 체험 종료 최소 24시간 전에 App Store에서 구독을 취소하세요.', + 'native.trial.cancelPlay': '요금이 청구되지 않으려면 체험 종료 전에 Google Play에서 구독을 취소하세요.', + 'native.trial.badge': '7일 무료', + 'native.trial.price': '7일 무료 이용 후 {period} {price}가 청구됩니다.', + 'native.trial.changed': '혜택이 변경되었습니다. 요금제 목록으로 돌아가 현재 요금을 확인하세요.', 'native.connect.title': 'TREK에 연결', 'native.connect.hint': '브라우저에서 TREK을 여는 주소를 입력하세요.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/nl/native.ts b/shared/src/i18n/nl/native.ts index f874c06b3..2d47e9920 100644 --- a/shared/src/i18n/nl/native.ts +++ b/shared/src/i18n/nl/native.ts @@ -1,6 +1,12 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': + 'Wil je kosten voorkomen, zeg dan minstens 24 uur voor het einde van de proefperiode op in de App Store.', + 'native.trial.cancelPlay': 'Wil je kosten voorkomen, zeg dan vóór het einde van de proefperiode op in Google Play.', + 'native.trial.badge': '7 dagen gratis', + 'native.trial.price': '7 dagen gratis, daarna {price} {period}.', + 'native.trial.changed': 'Het aanbod is gewijzigd. Ga terug naar de abonnementen en controleer de huidige prijs.', 'native.connect.title': 'Verbinden met TREK', 'native.connect.hint': 'Voer het adres in waarop je TREK in je browser opent.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/pl/native.ts b/shared/src/i18n/pl/native.ts index de5ae7dc1..726501606 100644 --- a/shared/src/i18n/pl/native.ts +++ b/shared/src/i18n/pl/native.ts @@ -1,6 +1,12 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': + 'Aby uniknąć opłaty, anuluj w App Store co najmniej 24 godziny przed końcem okresu próbnego.', + 'native.trial.cancelPlay': 'Aby uniknąć opłaty, anuluj w Google Play przed końcem okresu próbnego.', + 'native.trial.badge': '7 dni za darmo', + 'native.trial.price': '7 dni za darmo, potem {price} {period}.', + 'native.trial.changed': 'Oferta się zmieniła. Wróć do planów i sprawdź aktualną cenę.', 'native.connect.title': 'Połącz z TREK', 'native.connect.hint': 'Wpisz adres, pod którym otwierasz TREK w przeglądarce.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/ru/native.ts b/shared/src/i18n/ru/native.ts index af3217487..84f665650 100644 --- a/shared/src/i18n/ru/native.ts +++ b/shared/src/i18n/ru/native.ts @@ -1,6 +1,12 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': + 'Чтобы избежать списания, отмените подписку в App Store не менее чем за 24 часа до конца пробного периода.', + 'native.trial.cancelPlay': 'Чтобы избежать списания, отмените подписку в Google Play до конца пробного периода.', + 'native.trial.badge': '7 дней бесплатно', + 'native.trial.price': '7 дней бесплатно, затем {price} {period}.', + 'native.trial.changed': 'Предложение изменилось. Вернитесь к тарифам и проверьте актуальную цену.', 'native.connect.title': 'Подключение к TREK', 'native.connect.hint': 'Введите адрес, по которому вы открываете TREK в браузере.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/sk/native.ts b/shared/src/i18n/sk/native.ts index 614f220c2..08fe4521e 100644 --- a/shared/src/i18n/sk/native.ts +++ b/shared/src/i18n/sk/native.ts @@ -1,6 +1,12 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': + 'Poplatku predídete zrušením predplatného v App Store najneskôr 24 hodín pred koncom skúšobnej doby.', + 'native.trial.cancelPlay': 'Poplatku predídete zrušením predplatného v Google Play pred koncom skúšobnej doby.', + 'native.trial.badge': '7 dní zadarmo', + 'native.trial.price': '7 dní zadarmo, potom {price} {period}.', + 'native.trial.changed': 'Ponuka sa zmenila. Vráťte sa k plánom a skontrolujte aktuálnu cenu.', 'native.connect.title': 'Pripojiť k TREK', 'native.connect.hint': 'Zadajte adresu, na ktorej otvárate TREK v prehliadači.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/sv/native.ts b/shared/src/i18n/sv/native.ts index d7423add9..9b88df559 100644 --- a/shared/src/i18n/sv/native.ts +++ b/shared/src/i18n/sv/native.ts @@ -1,6 +1,12 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': + 'För att undvika debitering, säg upp i App Store minst 24 timmar innan provperioden slutar.', + 'native.trial.cancelPlay': 'För att undvika debitering, säg upp i Google Play innan provperioden slutar.', + 'native.trial.badge': '7 dagar gratis', + 'native.trial.price': '7 dagar gratis, därefter {price} {period}.', + 'native.trial.changed': 'Erbjudandet har ändrats. Gå tillbaka till abonnemangen och kontrollera det aktuella priset.', 'native.connect.title': 'Anslut till TREK', 'native.connect.hint': 'Ange adressen du öppnar TREK på i webbläsaren.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/th/native.ts b/shared/src/i18n/th/native.ts index cf1b4dd8d..12a982a9c 100644 --- a/shared/src/i18n/th/native.ts +++ b/shared/src/i18n/th/native.ts @@ -1,6 +1,11 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': 'เพื่อไม่ให้ถูกเรียกเก็บเงิน ให้ยกเลิกใน App Store อย่างน้อย 24 ชั่วโมงก่อนหมดช่วงทดลองใช้ฟรี', + 'native.trial.cancelPlay': 'เพื่อไม่ให้ถูกเรียกเก็บเงิน ให้ยกเลิกใน Google Play ก่อนหมดช่วงทดลองใช้ฟรี', + 'native.trial.badge': 'ฟรี 7 วัน', + 'native.trial.price': 'ฟรี 7 วัน จากนั้น {price} {period}', + 'native.trial.changed': 'ข้อเสนอมีการเปลี่ยนแปลง โปรดกลับไปที่รายการแพ็กเกจและตรวจสอบราคาปัจจุบัน', 'native.connect.title': 'เชื่อมต่อกับ TREK', 'native.connect.hint': 'ป้อนที่อยู่ที่คุณใช้เปิด TREK ในเบราว์เซอร์', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/tr/native.ts b/shared/src/i18n/tr/native.ts index a6d32306f..a9984075b 100644 --- a/shared/src/i18n/tr/native.ts +++ b/shared/src/i18n/tr/native.ts @@ -1,6 +1,11 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': 'Ücret alınmaması için deneme bitmeden en az 24 saat önce App Store’dan iptal et.', + 'native.trial.cancelPlay': 'Ücret alınmaması için deneme bitmeden önce Google Play’den iptal et.', + 'native.trial.badge': '7 gün ücretsiz', + 'native.trial.price': '7 gün ücretsiz, ardından {period} {price}.', + 'native.trial.changed': 'Teklif değişti. Planlara dönüp güncel fiyatı kontrol et.', 'native.connect.title': 'TREK’e bağlan', 'native.connect.hint': 'TREK’i tarayıcında açtığın adresi gir.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/uk/native.ts b/shared/src/i18n/uk/native.ts index 97ce98614..024f08ba0 100644 --- a/shared/src/i18n/uk/native.ts +++ b/shared/src/i18n/uk/native.ts @@ -1,6 +1,12 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': + 'Щоб уникнути списання, скасуйте підписку в App Store щонайменше за 24 години до кінця пробного періоду.', + 'native.trial.cancelPlay': 'Щоб уникнути списання, скасуйте підписку в Google Play до кінця пробного періоду.', + 'native.trial.badge': '7 днів безкоштовно', + 'native.trial.price': '7 днів безкоштовно, потім {price} {period}.', + 'native.trial.changed': 'Пропозиція змінилася. Поверніться до тарифів і перевірте актуальну ціну.', 'native.connect.title': 'Підключення до TREK', 'native.connect.hint': 'Введіть адресу, за якою ви відкриваєте TREK у браузері.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/vi/native.ts b/shared/src/i18n/vi/native.ts index cd8ff7639..9fa8a9e75 100644 --- a/shared/src/i18n/vi/native.ts +++ b/shared/src/i18n/vi/native.ts @@ -1,6 +1,12 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': + 'Để tránh bị tính phí, hãy hủy trong App Store ít nhất 24 giờ trước khi hết thời gian dùng thử.', + 'native.trial.cancelPlay': 'Để tránh bị tính phí, hãy hủy trong Google Play trước khi hết thời gian dùng thử.', + 'native.trial.badge': '7 ngày miễn phí', + 'native.trial.price': '7 ngày miễn phí, sau đó {price} {period}.', + 'native.trial.changed': 'Ưu đãi đã thay đổi. Hãy quay lại danh sách gói và kiểm tra giá hiện tại.', 'native.connect.title': 'Kết nối với TREK', 'native.connect.hint': 'Nhập địa chỉ bạn dùng để mở TREK trong trình duyệt.', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/zh-TW/native.ts b/shared/src/i18n/zh-TW/native.ts index 5ff1a0dda..12d84868c 100644 --- a/shared/src/i18n/zh-TW/native.ts +++ b/shared/src/i18n/zh-TW/native.ts @@ -1,6 +1,11 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': '若要避免扣款,請在試用期結束至少 24 小時前到 App Store 取消訂閱。', + 'native.trial.cancelPlay': '若要避免扣款,請在試用期結束前到 Google Play 取消訂閱。', + 'native.trial.badge': '免費試用 7 天', + 'native.trial.price': '免費試用 7 天,之後{period} {price}。', + 'native.trial.changed': '優惠已有變更。請返回方案列表,查看目前的價格。', 'native.connect.title': '連線到 TREK', 'native.connect.hint': '請輸入你在瀏覽器中開啟 TREK 時使用的網址。', 'native.connect.placeholder': 'https://trek.example.com', diff --git a/shared/src/i18n/zh/native.ts b/shared/src/i18n/zh/native.ts index e0b797d9e..79b504d30 100644 --- a/shared/src/i18n/zh/native.ts +++ b/shared/src/i18n/zh/native.ts @@ -1,6 +1,11 @@ import type { TranslationStrings } from '../types'; const native: TranslationStrings = { + 'native.trial.cancelApple': '若要避免扣费,请在试用期结束至少 24 小时前到 App Store 取消订阅。', + 'native.trial.cancelPlay': '若要避免扣费,请在试用期结束前到 Google Play 取消订阅。', + 'native.trial.badge': '免费试用 7 天', + 'native.trial.price': '免费试用 7 天,之后{period} {price}。', + 'native.trial.changed': '优惠已变更。请返回套餐列表,查看当前价格。', 'native.connect.title': '连接到 TREK', 'native.connect.hint': '请输入你在浏览器中打开 TREK 时使用的地址。', 'native.connect.placeholder': 'https://trek.example.com',