-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
64b0ed2
commit be11d84
Showing
2 changed files
with
33 additions
and
20 deletions.
There are no files selected for viewing
20 changes: 0 additions & 20 deletions
20
client/lib/products-values/get-jetpack-product-call-to-action.js
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
client/lib/products-values/get-jetpack-product-call-to-action.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { TranslateResult } from 'i18n-calypso'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { assertValidProduct } from 'lib/products-values/utils/assert-valid-product'; | ||
import { formatProduct } from 'lib/products-values/format-product'; | ||
import { getJetpackProductsCallToAction } from 'lib/products-values/translations'; | ||
|
||
/** | ||
* Type dependencies | ||
*/ | ||
import type { Product } from 'lib/products-values/products-list'; | ||
|
||
/** | ||
* Get Jetpack product call-to-action based on the product purchase object. | ||
* | ||
* @param {object} product Product purchase object | ||
* @returns {TranslateResult} Product display name | ||
*/ | ||
export function getJetpackProductCallToAction( product: object ): TranslateResult | undefined { | ||
product = formatProduct( product ); | ||
assertValidProduct( product ); | ||
const jetpackProductsCallToActions = getJetpackProductsCallToAction() as Record< | ||
string, | ||
TranslateResult | ||
>; | ||
|
||
return jetpackProductsCallToActions?.[ ( product as Product ).product_slug ]; | ||
} |