Download wp-calypso/client/state/selectors/get-current-plan-term.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 708 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/selectors/get-current-plan-term.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/selectors/get-current-plan-term.js
-
curl -L -o get-current-plan-term.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/selectors/get-current-plan-term.js
708 Bytes
| import { getPlan } from '@automattic/calypso-products'; | |
| import { getSitePlan } from 'calypso/state/sites/selectors'; | |
| /** | |
| * Returns term of the active plan for given siteId, e.g. value | |
| * of constant TERM_MONTHLY defined in @automattic/calypso-products | |
| * @param {Object} state Current state | |
| * @param {number} siteId Site ID | |
| * @returns {string} Human-readable interval type | |
| */ | |
| export default function getTermFromCurrentPlan( state, siteId ) { | |
| const currentPlanProduct = getSitePlan( state, siteId ); | |
| if ( ! currentPlanProduct ) { | |
| return null; | |
| } | |
| const currentPlanObject = getPlan( currentPlanProduct.product_slug ); | |
| if ( ! currentPlanObject ) { | |
| return null; | |
| } | |
| return currentPlanObject.term; | |
| } | |