export function internationaliseProductAndRatePlan()

in support-frontend/assets/helpers/productCatalog.ts [521:559]


export function internationaliseProductAndRatePlan(
	supportInternationalisationId: SupportInternationalisationId,
	productKey: ActiveProductKey,
	ratePlanKey: string,
): { productKey: ActiveProductKey; ratePlanKey: string } {
	let productKeyToUse = productKey;
	let ratePlanToUse = ratePlanKey;

	if (productKey === 'TierThree') {
		if (supportInternationalisationId === 'int') {
			if (ratePlanKey === 'DomesticAnnual') {
				ratePlanToUse = 'RestOfWorldAnnual';
			}
			if (ratePlanKey === 'DomesticMonthly') {
				ratePlanToUse = 'RestOfWorldMonthly';
			}
		} else {
			if (ratePlanKey === 'RestOfWorldAnnual') {
				ratePlanToUse = 'DomesticAnnual';
			}
			if (ratePlanKey === 'RestOfWorldMonthly') {
				ratePlanToUse = 'DomesticMonthly';
			}
		}
	}

	if (
		productKey === 'GuardianWeeklyDomestic' ||
		productKey === 'GuardianWeeklyRestOfWorld'
	) {
		if (supportInternationalisationId === 'int') {
			productKeyToUse = 'GuardianWeeklyRestOfWorld';
		} else {
			productKeyToUse = 'GuardianWeeklyDomestic';
		}
	}

	return { productKey: productKeyToUse, ratePlanKey: ratePlanToUse };
}