@automattic/plans-grid-next 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +3 -0
- package/dist/cjs/__mocks__/wpcom-proxy-request.js +17 -0
- package/dist/cjs/__mocks__/wpcom-proxy-request.js.map +1 -0
- package/dist/cjs/_media-queries.scss +14 -0
- package/dist/cjs/_mixins.scss +15 -0
- package/dist/cjs/_shared.scss +174 -0
- package/dist/cjs/components/comparison-grid/index.js +527 -0
- package/dist/cjs/components/comparison-grid/index.js.map +1 -0
- package/dist/cjs/components/comparison-grid/index.stories.js +74 -0
- package/dist/cjs/components/comparison-grid/index.stories.js.map +1 -0
- package/dist/cjs/components/comparison-grid/style.scss +318 -0
- package/dist/cjs/components/dropdown-option.js +33 -0
- package/dist/cjs/components/dropdown-option.js.map +1 -0
- package/dist/cjs/components/features-grid/billing-timeframes.js +15 -0
- package/dist/cjs/components/features-grid/billing-timeframes.js.map +1 -0
- package/dist/cjs/components/features-grid/client-logo-list/client-list.js +106 -0
- package/dist/cjs/components/features-grid/client-logo-list/client-list.js.map +1 -0
- package/dist/cjs/components/features-grid/client-logo-list/index.js +17 -0
- package/dist/cjs/components/features-grid/client-logo-list/index.js.map +1 -0
- package/dist/cjs/components/features-grid/client-logo-list/style.scss +52 -0
- package/dist/cjs/components/features-grid/enterprise-features.js +41 -0
- package/dist/cjs/components/features-grid/enterprise-features.js.map +1 -0
- package/dist/cjs/components/features-grid/index.js +130 -0
- package/dist/cjs/components/features-grid/index.js.map +1 -0
- package/dist/cjs/components/features-grid/index.stories.js +112 -0
- package/dist/cjs/components/features-grid/index.stories.js.map +1 -0
- package/dist/cjs/components/features-grid/mobile-free-domain.js +25 -0
- package/dist/cjs/components/features-grid/mobile-free-domain.js.map +1 -0
- package/dist/cjs/components/features-grid/plan-features-list.js +56 -0
- package/dist/cjs/components/features-grid/plan-features-list.js.map +1 -0
- package/dist/cjs/components/features-grid/plan-headers.js +15 -0
- package/dist/cjs/components/features-grid/plan-headers.js.map +1 -0
- package/dist/cjs/components/features-grid/plan-logos.js +12 -0
- package/dist/cjs/components/features-grid/plan-logos.js.map +1 -0
- package/dist/cjs/components/features-grid/plan-prices.js +14 -0
- package/dist/cjs/components/features-grid/plan-prices.js.map +1 -0
- package/dist/cjs/components/features-grid/plan-tagline.js +12 -0
- package/dist/cjs/components/features-grid/plan-tagline.js.map +1 -0
- package/dist/cjs/components/features-grid/previous-features-included-title.js +36 -0
- package/dist/cjs/components/features-grid/previous-features-included-title.js.map +1 -0
- package/dist/cjs/components/features-grid/spotlight-plan.js +24 -0
- package/dist/cjs/components/features-grid/spotlight-plan.js.map +1 -0
- package/dist/cjs/components/features-grid/spotlight-plan.scss +5 -0
- package/dist/cjs/components/features-grid/style.scss +630 -0
- package/dist/cjs/components/features-grid/table.js +38 -0
- package/dist/cjs/components/features-grid/table.js.map +1 -0
- package/dist/cjs/components/features-grid/top-buttons.js +15 -0
- package/dist/cjs/components/features-grid/top-buttons.js.map +1 -0
- package/dist/cjs/components/features.js +72 -0
- package/dist/cjs/components/features.js.map +1 -0
- package/dist/cjs/components/item.js +9 -0
- package/dist/cjs/components/item.js.map +1 -0
- package/dist/cjs/components/plan-button/index.js +21 -0
- package/dist/cjs/components/plan-button/index.js.map +1 -0
- package/dist/cjs/components/plan-button/style.scss +179 -0
- package/dist/cjs/components/plan-div-td-container.js +9 -0
- package/dist/cjs/components/plan-div-td-container.js.map +1 -0
- package/dist/cjs/components/plan-logo.js +45 -0
- package/dist/cjs/components/plan-logo.js.map +1 -0
- package/dist/cjs/components/plan-type-selector/components/interval-type-dropdown.js +39 -0
- package/dist/cjs/components/plan-type-selector/components/interval-type-dropdown.js.map +1 -0
- package/dist/cjs/components/plan-type-selector/components/interval-type-selector.js +12 -0
- package/dist/cjs/components/plan-type-selector/components/interval-type-selector.js.map +1 -0
- package/dist/cjs/components/plan-type-selector/components/interval-type-toggle.js +55 -0
- package/dist/cjs/components/plan-type-selector/components/interval-type-toggle.js.map +1 -0
- package/dist/cjs/components/plan-type-selector/components/popup-messages.js +108 -0
- package/dist/cjs/components/plan-type-selector/components/popup-messages.js.map +1 -0
- package/dist/cjs/components/plan-type-selector/hooks/use-interval-options.js +56 -0
- package/dist/cjs/components/plan-type-selector/hooks/use-interval-options.js.map +1 -0
- package/dist/cjs/components/plan-type-selector/hooks/use-max-discount.js +45 -0
- package/dist/cjs/components/plan-type-selector/hooks/use-max-discount.js.map +1 -0
- package/dist/cjs/components/plan-type-selector/hooks/use-max-discounts-for-plan-terms.js +68 -0
- package/dist/cjs/components/plan-type-selector/hooks/use-max-discounts-for-plan-terms.js.map +1 -0
- package/dist/cjs/components/plan-type-selector/index.js +27 -0
- package/dist/cjs/components/plan-type-selector/index.js.map +1 -0
- package/dist/cjs/components/plan-type-selector/style.scss +196 -0
- package/dist/cjs/components/plans-2023-tooltip.js +46 -0
- package/dist/cjs/components/plans-2023-tooltip.js.map +1 -0
- package/dist/cjs/components/popular-badge.js +16 -0
- package/dist/cjs/components/popular-badge.js.map +1 -0
- package/dist/cjs/components/shared/action-button/index.js +91 -0
- package/dist/cjs/components/shared/action-button/index.js.map +1 -0
- package/dist/cjs/components/shared/action-button/style.scss +12 -0
- package/dist/cjs/components/shared/billing-timeframe/index.js +58 -0
- package/dist/cjs/components/shared/billing-timeframe/index.js.map +1 -0
- package/dist/cjs/components/shared/header-price/header-price-context.js +14 -0
- package/dist/cjs/components/shared/header-price/header-price-context.js.map +1 -0
- package/dist/cjs/components/shared/header-price/index.js +102 -0
- package/dist/cjs/components/shared/header-price/index.js.map +1 -0
- package/dist/cjs/components/shared/header-price/style.scss +112 -0
- package/dist/cjs/components/shared/plan-pill/index.js +6 -0
- package/dist/cjs/components/shared/plan-pill/index.js.map +1 -0
- package/dist/cjs/components/shared/plan-pill/style.scss +30 -0
- package/dist/cjs/components/shared/storage/components/plan-storage.js +28 -0
- package/dist/cjs/components/shared/storage/components/plan-storage.js.map +1 -0
- package/dist/cjs/components/shared/storage/components/storage-dropdown.js +96 -0
- package/dist/cjs/components/shared/storage/components/storage-dropdown.js.map +1 -0
- package/dist/cjs/components/shared/storage/components/storage-feature-label.js +40 -0
- package/dist/cjs/components/shared/storage/components/storage-feature-label.js.map +1 -0
- package/dist/cjs/components/shared/storage/constants.js +6 -0
- package/dist/cjs/components/shared/storage/constants.js.map +1 -0
- package/dist/cjs/components/shared/storage/hooks/use-default-storage-option.js +26 -0
- package/dist/cjs/components/shared/storage/hooks/use-default-storage-option.js.map +1 -0
- package/dist/cjs/components/shared/storage/hooks/use-plan-storage.js +29 -0
- package/dist/cjs/components/shared/storage/hooks/use-plan-storage.js.map +1 -0
- package/dist/cjs/components/shared/storage/hooks/use-purchased-storage-add-on.js +51 -0
- package/dist/cjs/components/shared/storage/hooks/use-purchased-storage-add-on.js.map +1 -0
- package/dist/cjs/components/shared/storage/hooks/use-storage-string.js +13 -0
- package/dist/cjs/components/shared/storage/hooks/use-storage-string.js.map +1 -0
- package/dist/cjs/components/shared/storage/index.js +14 -0
- package/dist/cjs/components/shared/storage/index.js.map +1 -0
- package/dist/cjs/components/sticky-container.js +74 -0
- package/dist/cjs/components/sticky-container.js.map +1 -0
- package/dist/cjs/constants.js +11 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/css-mixins.js +14 -0
- package/dist/cjs/css-mixins.js.map +1 -0
- package/dist/cjs/fixtures/plans.js +1542 -0
- package/dist/cjs/fixtures/plans.js.map +1 -0
- package/dist/cjs/fixtures/sites-plans.js +458 -0
- package/dist/cjs/fixtures/sites-plans.js.map +1 -0
- package/dist/cjs/fixtures/sites-purchases.js +133 -0
- package/dist/cjs/fixtures/sites-purchases.js.map +1 -0
- package/dist/cjs/grid-context.js +40 -0
- package/dist/cjs/grid-context.js.map +1 -0
- package/dist/cjs/hooks/data-store/is-popular-plan.js +9 -0
- package/dist/cjs/hooks/data-store/is-popular-plan.js.map +1 -0
- package/dist/cjs/hooks/data-store/types.js +3 -0
- package/dist/cjs/hooks/data-store/types.js.map +1 -0
- package/dist/cjs/hooks/data-store/use-grid-plan-for-spotlight.js +18 -0
- package/dist/cjs/hooks/data-store/use-grid-plan-for-spotlight.js.map +1 -0
- package/dist/cjs/hooks/data-store/use-grid-plans-for-comparison-grid.js +55 -0
- package/dist/cjs/hooks/data-store/use-grid-plans-for-comparison-grid.js.map +1 -0
- package/dist/cjs/hooks/data-store/use-grid-plans-for-features-grid.js +56 -0
- package/dist/cjs/hooks/data-store/use-grid-plans-for-features-grid.js.map +1 -0
- package/dist/cjs/hooks/data-store/use-grid-plans.js +254 -0
- package/dist/cjs/hooks/data-store/use-grid-plans.js.map +1 -0
- package/dist/cjs/hooks/data-store/use-highlight-labels.js +60 -0
- package/dist/cjs/hooks/data-store/use-highlight-labels.js.map +1 -0
- package/dist/cjs/hooks/data-store/use-highlighted-features.js +35 -0
- package/dist/cjs/hooks/data-store/use-highlighted-features.js.map +1 -0
- package/dist/cjs/hooks/data-store/use-plan-billing-description.js +216 -0
- package/dist/cjs/hooks/data-store/use-plan-billing-description.js.map +1 -0
- package/dist/cjs/hooks/data-store/use-plan-features-for-grid-plans.js +133 -0
- package/dist/cjs/hooks/data-store/use-plan-features-for-grid-plans.js.map +1 -0
- package/dist/cjs/hooks/data-store/use-plans-from-types.js +30 -0
- package/dist/cjs/hooks/data-store/use-plans-from-types.js.map +1 -0
- package/dist/cjs/hooks/data-store/use-restructured-plan-features-for-comparison-grid.js +90 -0
- package/dist/cjs/hooks/data-store/use-restructured-plan-features-for-comparison-grid.js.map +1 -0
- package/dist/cjs/hooks/use-grid-size.js +33 -0
- package/dist/cjs/hooks/use-grid-size.js.map +1 -0
- package/dist/cjs/hooks/use-highlight-adjacency-matrix.js +31 -0
- package/dist/cjs/hooks/use-highlight-adjacency-matrix.js.map +1 -0
- package/dist/cjs/hooks/use-is-large-currency.js +69 -0
- package/dist/cjs/hooks/use-is-large-currency.js.map +1 -0
- package/dist/cjs/hooks/use-manage-tooltip-toggle.js +29 -0
- package/dist/cjs/hooks/use-manage-tooltip-toggle.js.map +1 -0
- package/dist/cjs/hooks/use-plan-pricing-info-from-grid-plans.js +17 -0
- package/dist/cjs/hooks/use-plan-pricing-info-from-grid-plans.js.map +1 -0
- package/dist/cjs/index.js +36 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/lib/filter-unused-features-object.js +19 -0
- package/dist/cjs/lib/filter-unused-features-object.js.map +1 -0
- package/dist/cjs/lib/get-plan-features-object.js +11 -0
- package/dist/cjs/lib/get-plan-features-object.js.map +1 -0
- package/dist/cjs/lib/get-plan-pricing-info-from-grid-plans.js +16 -0
- package/dist/cjs/lib/get-plan-pricing-info-from-grid-plans.js.map +1 -0
- package/dist/cjs/lib/is-same-plan.js +12 -0
- package/dist/cjs/lib/is-same-plan.js.map +1 -0
- package/dist/cjs/lib/sort-plan-properties.js +39 -0
- package/dist/cjs/lib/sort-plan-properties.js.map +1 -0
- package/dist/cjs/lib/touch-detect/index.js +20 -0
- package/dist/cjs/lib/touch-detect/index.js.map +1 -0
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/__mocks__/wpcom-proxy-request.js +11 -0
- package/dist/esm/__mocks__/wpcom-proxy-request.js.map +1 -0
- package/dist/esm/_media-queries.scss +14 -0
- package/dist/esm/_mixins.scss +15 -0
- package/dist/esm/_shared.scss +174 -0
- package/dist/esm/components/comparison-grid/index.js +524 -0
- package/dist/esm/components/comparison-grid/index.js.map +1 -0
- package/dist/esm/components/comparison-grid/index.stories.js +71 -0
- package/dist/esm/components/comparison-grid/index.stories.js.map +1 -0
- package/dist/esm/components/comparison-grid/style.scss +318 -0
- package/dist/esm/components/dropdown-option.js +30 -0
- package/dist/esm/components/dropdown-option.js.map +1 -0
- package/dist/esm/components/features-grid/billing-timeframes.js +12 -0
- package/dist/esm/components/features-grid/billing-timeframes.js.map +1 -0
- package/dist/esm/components/features-grid/client-logo-list/client-list.js +104 -0
- package/dist/esm/components/features-grid/client-logo-list/client-list.js.map +1 -0
- package/dist/esm/components/features-grid/client-logo-list/index.js +14 -0
- package/dist/esm/components/features-grid/client-logo-list/index.js.map +1 -0
- package/dist/esm/components/features-grid/client-logo-list/style.scss +52 -0
- package/dist/esm/components/features-grid/enterprise-features.js +38 -0
- package/dist/esm/components/features-grid/enterprise-features.js.map +1 -0
- package/dist/esm/components/features-grid/index.js +127 -0
- package/dist/esm/components/features-grid/index.js.map +1 -0
- package/dist/esm/components/features-grid/index.stories.js +109 -0
- package/dist/esm/components/features-grid/index.stories.js.map +1 -0
- package/dist/esm/components/features-grid/mobile-free-domain.js +23 -0
- package/dist/esm/components/features-grid/mobile-free-domain.js.map +1 -0
- package/dist/esm/components/features-grid/plan-features-list.js +53 -0
- package/dist/esm/components/features-grid/plan-features-list.js.map +1 -0
- package/dist/esm/components/features-grid/plan-headers.js +12 -0
- package/dist/esm/components/features-grid/plan-headers.js.map +1 -0
- package/dist/esm/components/features-grid/plan-logos.js +9 -0
- package/dist/esm/components/features-grid/plan-logos.js.map +1 -0
- package/dist/esm/components/features-grid/plan-prices.js +11 -0
- package/dist/esm/components/features-grid/plan-prices.js.map +1 -0
- package/dist/esm/components/features-grid/plan-tagline.js +9 -0
- package/dist/esm/components/features-grid/plan-tagline.js.map +1 -0
- package/dist/esm/components/features-grid/previous-features-included-title.js +33 -0
- package/dist/esm/components/features-grid/previous-features-included-title.js.map +1 -0
- package/dist/esm/components/features-grid/spotlight-plan.js +21 -0
- package/dist/esm/components/features-grid/spotlight-plan.js.map +1 -0
- package/dist/esm/components/features-grid/spotlight-plan.scss +5 -0
- package/dist/esm/components/features-grid/style.scss +630 -0
- package/dist/esm/components/features-grid/table.js +35 -0
- package/dist/esm/components/features-grid/table.js.map +1 -0
- package/dist/esm/components/features-grid/top-buttons.js +12 -0
- package/dist/esm/components/features-grid/top-buttons.js.map +1 -0
- package/dist/esm/components/features.js +69 -0
- package/dist/esm/components/features.js.map +1 -0
- package/dist/esm/components/item.js +5 -0
- package/dist/esm/components/item.js.map +1 -0
- package/dist/esm/components/plan-button/index.js +18 -0
- package/dist/esm/components/plan-button/index.js.map +1 -0
- package/dist/esm/components/plan-button/style.scss +179 -0
- package/dist/esm/components/plan-div-td-container.js +7 -0
- package/dist/esm/components/plan-div-td-container.js.map +1 -0
- package/dist/esm/components/plan-logo.js +42 -0
- package/dist/esm/components/plan-logo.js.map +1 -0
- package/dist/esm/components/plan-type-selector/components/interval-type-dropdown.js +34 -0
- package/dist/esm/components/plan-type-selector/components/interval-type-dropdown.js.map +1 -0
- package/dist/esm/components/plan-type-selector/components/interval-type-selector.js +8 -0
- package/dist/esm/components/plan-type-selector/components/interval-type-selector.js.map +1 -0
- package/dist/esm/components/plan-type-selector/components/interval-type-toggle.js +50 -0
- package/dist/esm/components/plan-type-selector/components/interval-type-toggle.js.map +1 -0
- package/dist/esm/components/plan-type-selector/components/popup-messages.js +105 -0
- package/dist/esm/components/plan-type-selector/components/popup-messages.js.map +1 -0
- package/dist/esm/components/plan-type-selector/hooks/use-interval-options.js +52 -0
- package/dist/esm/components/plan-type-selector/hooks/use-interval-options.js.map +1 -0
- package/dist/esm/components/plan-type-selector/hooks/use-max-discount.js +42 -0
- package/dist/esm/components/plan-type-selector/hooks/use-max-discount.js.map +1 -0
- package/dist/esm/components/plan-type-selector/hooks/use-max-discounts-for-plan-terms.js +65 -0
- package/dist/esm/components/plan-type-selector/hooks/use-max-discounts-for-plan-terms.js.map +1 -0
- package/dist/esm/components/plan-type-selector/index.js +24 -0
- package/dist/esm/components/plan-type-selector/index.js.map +1 -0
- package/dist/esm/components/plan-type-selector/style.scss +196 -0
- package/dist/esm/components/plans-2023-tooltip.js +41 -0
- package/dist/esm/components/plans-2023-tooltip.js.map +1 -0
- package/dist/esm/components/popular-badge.js +13 -0
- package/dist/esm/components/popular-badge.js.map +1 -0
- package/dist/esm/components/shared/action-button/index.js +88 -0
- package/dist/esm/components/shared/action-button/index.js.map +1 -0
- package/dist/esm/components/shared/action-button/style.scss +12 -0
- package/dist/esm/components/shared/billing-timeframe/index.js +55 -0
- package/dist/esm/components/shared/billing-timeframe/index.js.map +1 -0
- package/dist/esm/components/shared/header-price/header-price-context.js +10 -0
- package/dist/esm/components/shared/header-price/header-price-context.js.map +1 -0
- package/dist/esm/components/shared/header-price/index.js +99 -0
- package/dist/esm/components/shared/header-price/index.js.map +1 -0
- package/dist/esm/components/shared/header-price/style.scss +112 -0
- package/dist/esm/components/shared/plan-pill/index.js +4 -0
- package/dist/esm/components/shared/plan-pill/index.js.map +1 -0
- package/dist/esm/components/shared/plan-pill/style.scss +30 -0
- package/dist/esm/components/shared/storage/components/plan-storage.js +25 -0
- package/dist/esm/components/shared/storage/components/plan-storage.js.map +1 -0
- package/dist/esm/components/shared/storage/components/storage-dropdown.js +93 -0
- package/dist/esm/components/shared/storage/components/storage-dropdown.js.map +1 -0
- package/dist/esm/components/shared/storage/components/storage-feature-label.js +37 -0
- package/dist/esm/components/shared/storage/components/storage-feature-label.js.map +1 -0
- package/dist/esm/components/shared/storage/constants.js +3 -0
- package/dist/esm/components/shared/storage/constants.js.map +1 -0
- package/dist/esm/components/shared/storage/hooks/use-default-storage-option.js +22 -0
- package/dist/esm/components/shared/storage/hooks/use-default-storage-option.js.map +1 -0
- package/dist/esm/components/shared/storage/hooks/use-plan-storage.js +27 -0
- package/dist/esm/components/shared/storage/hooks/use-plan-storage.js.map +1 -0
- package/dist/esm/components/shared/storage/hooks/use-purchased-storage-add-on.js +48 -0
- package/dist/esm/components/shared/storage/hooks/use-purchased-storage-add-on.js.map +1 -0
- package/dist/esm/components/shared/storage/hooks/use-storage-string.js +11 -0
- package/dist/esm/components/shared/storage/hooks/use-storage-string.js.map +1 -0
- package/dist/esm/components/shared/storage/index.js +9 -0
- package/dist/esm/components/shared/storage/index.js.map +1 -0
- package/dist/esm/components/sticky-container.js +69 -0
- package/dist/esm/components/sticky-container.js.map +1 -0
- package/dist/esm/constants.js +8 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/css-mixins.js +10 -0
- package/dist/esm/css-mixins.js.map +1 -0
- package/dist/esm/fixtures/plans.js +1540 -0
- package/dist/esm/fixtures/plans.js.map +1 -0
- package/dist/esm/fixtures/sites-plans.js +456 -0
- package/dist/esm/fixtures/sites-plans.js.map +1 -0
- package/dist/esm/fixtures/sites-purchases.js +131 -0
- package/dist/esm/fixtures/sites-purchases.js.map +1 -0
- package/dist/esm/grid-context.js +36 -0
- package/dist/esm/grid-context.js.map +1 -0
- package/dist/esm/hooks/data-store/is-popular-plan.js +5 -0
- package/dist/esm/hooks/data-store/is-popular-plan.js.map +1 -0
- package/dist/esm/hooks/data-store/types.js +2 -0
- package/dist/esm/hooks/data-store/types.js.map +1 -0
- package/dist/esm/hooks/data-store/use-grid-plan-for-spotlight.js +16 -0
- package/dist/esm/hooks/data-store/use-grid-plan-for-spotlight.js.map +1 -0
- package/dist/esm/hooks/data-store/use-grid-plans-for-comparison-grid.js +52 -0
- package/dist/esm/hooks/data-store/use-grid-plans-for-comparison-grid.js.map +1 -0
- package/dist/esm/hooks/data-store/use-grid-plans-for-features-grid.js +53 -0
- package/dist/esm/hooks/data-store/use-grid-plans-for-features-grid.js.map +1 -0
- package/dist/esm/hooks/data-store/use-grid-plans.js +249 -0
- package/dist/esm/hooks/data-store/use-grid-plans.js.map +1 -0
- package/dist/esm/hooks/data-store/use-highlight-labels.js +58 -0
- package/dist/esm/hooks/data-store/use-highlight-labels.js.map +1 -0
- package/dist/esm/hooks/data-store/use-highlighted-features.js +33 -0
- package/dist/esm/hooks/data-store/use-highlighted-features.js.map +1 -0
- package/dist/esm/hooks/data-store/use-plan-billing-description.js +213 -0
- package/dist/esm/hooks/data-store/use-plan-billing-description.js.map +1 -0
- package/dist/esm/hooks/data-store/use-plan-features-for-grid-plans.js +130 -0
- package/dist/esm/hooks/data-store/use-plan-features-for-grid-plans.js.map +1 -0
- package/dist/esm/hooks/data-store/use-plans-from-types.js +27 -0
- package/dist/esm/hooks/data-store/use-plans-from-types.js.map +1 -0
- package/dist/esm/hooks/data-store/use-restructured-plan-features-for-comparison-grid.js +87 -0
- package/dist/esm/hooks/data-store/use-restructured-plan-features-for-comparison-grid.js.map +1 -0
- package/dist/esm/hooks/use-grid-size.js +29 -0
- package/dist/esm/hooks/use-grid-size.js.map +1 -0
- package/dist/esm/hooks/use-highlight-adjacency-matrix.js +29 -0
- package/dist/esm/hooks/use-highlight-adjacency-matrix.js.map +1 -0
- package/dist/esm/hooks/use-is-large-currency.js +66 -0
- package/dist/esm/hooks/use-is-large-currency.js.map +1 -0
- package/dist/esm/hooks/use-manage-tooltip-toggle.js +25 -0
- package/dist/esm/hooks/use-manage-tooltip-toggle.js.map +1 -0
- package/dist/esm/hooks/use-plan-pricing-info-from-grid-plans.js +13 -0
- package/dist/esm/hooks/use-plan-pricing-info-from-grid-plans.js.map +1 -0
- package/dist/esm/index.js +28 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lib/filter-unused-features-object.js +17 -0
- package/dist/esm/lib/filter-unused-features-object.js.map +1 -0
- package/dist/esm/lib/get-plan-features-object.js +9 -0
- package/dist/esm/lib/get-plan-features-object.js.map +1 -0
- package/dist/esm/lib/get-plan-pricing-info-from-grid-plans.js +12 -0
- package/dist/esm/lib/get-plan-pricing-info-from-grid-plans.js.map +1 -0
- package/dist/esm/lib/is-same-plan.js +8 -0
- package/dist/esm/lib/is-same-plan.js.map +1 -0
- package/dist/esm/lib/sort-plan-properties.js +35 -0
- package/dist/esm/lib/sort-plan-properties.js.map +1 -0
- package/dist/esm/lib/touch-detect/index.js +16 -0
- package/dist/esm/lib/touch-detect/index.js.map +1 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/tsconfig-cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/__mocks__/wpcom-proxy-request.d.ts +8 -0
- package/dist/types/__mocks__/wpcom-proxy-request.d.ts.map +1 -0
- package/dist/types/components/comparison-grid/index.d.ts +5 -0
- package/dist/types/components/comparison-grid/index.d.ts.map +1 -0
- package/dist/types/components/comparison-grid/index.stories.d.ts +66 -0
- package/dist/types/components/comparison-grid/index.stories.d.ts.map +1 -0
- package/dist/types/components/dropdown-option.d.ts +10 -0
- package/dist/types/components/dropdown-option.d.ts.map +1 -0
- package/dist/types/components/features-grid/billing-timeframes.d.ts +11 -0
- package/dist/types/components/features-grid/billing-timeframes.d.ts.map +1 -0
- package/dist/types/components/features-grid/client-logo-list/client-list.d.ts +11 -0
- package/dist/types/components/features-grid/client-logo-list/client-list.d.ts.map +1 -0
- package/dist/types/components/features-grid/client-logo-list/index.d.ts +4 -0
- package/dist/types/components/features-grid/client-logo-list/index.d.ts.map +1 -0
- package/dist/types/components/features-grid/enterprise-features.d.ts +11 -0
- package/dist/types/components/features-grid/enterprise-features.d.ts.map +1 -0
- package/dist/types/components/features-grid/index.d.ts +5 -0
- package/dist/types/components/features-grid/index.d.ts.map +1 -0
- package/dist/types/components/features-grid/index.stories.d.ts +173 -0
- package/dist/types/components/features-grid/index.stories.d.ts.map +1 -0
- package/dist/types/components/features-grid/mobile-free-domain.d.ts +8 -0
- package/dist/types/components/features-grid/mobile-free-domain.d.ts.map +1 -0
- package/dist/types/components/features-grid/plan-features-list.d.ts +31 -0
- package/dist/types/components/features-grid/plan-features-list.d.ts.map +1 -0
- package/dist/types/components/features-grid/plan-headers.d.ts +10 -0
- package/dist/types/components/features-grid/plan-headers.d.ts.map +1 -0
- package/dist/types/components/features-grid/plan-logos.d.ts +11 -0
- package/dist/types/components/features-grid/plan-logos.d.ts.map +1 -0
- package/dist/types/components/features-grid/plan-prices.d.ts +11 -0
- package/dist/types/components/features-grid/plan-prices.d.ts.map +1 -0
- package/dist/types/components/features-grid/plan-tagline.d.ts +10 -0
- package/dist/types/components/features-grid/plan-tagline.d.ts.map +1 -0
- package/dist/types/components/features-grid/previous-features-included-title.d.ts +10 -0
- package/dist/types/components/features-grid/previous-features-included-title.d.ts.map +1 -0
- package/dist/types/components/features-grid/spotlight-plan.d.ts +17 -0
- package/dist/types/components/features-grid/spotlight-plan.d.ts.map +1 -0
- package/dist/types/components/features-grid/table.d.ts +26 -0
- package/dist/types/components/features-grid/table.d.ts.map +1 -0
- package/dist/types/components/features-grid/top-buttons.d.ts +14 -0
- package/dist/types/components/features-grid/top-buttons.d.ts.map +1 -0
- package/dist/types/components/features.d.ts +17 -0
- package/dist/types/components/features.d.ts.map +1 -0
- package/dist/types/components/item.d.ts +5 -0
- package/dist/types/components/item.d.ts.map +1 -0
- package/dist/types/components/plan-button/index.d.ts +17 -0
- package/dist/types/components/plan-button/index.d.ts.map +1 -0
- package/dist/types/components/plan-div-td-container.d.ts +7 -0
- package/dist/types/components/plan-div-td-container.d.ts.map +1 -0
- package/dist/types/components/plan-logo.d.ts +12 -0
- package/dist/types/components/plan-logo.d.ts.map +1 -0
- package/dist/types/components/plan-type-selector/components/interval-type-dropdown.d.ts +4 -0
- package/dist/types/components/plan-type-selector/components/interval-type-dropdown.d.ts.map +1 -0
- package/dist/types/components/plan-type-selector/components/interval-type-selector.d.ts +4 -0
- package/dist/types/components/plan-type-selector/components/interval-type-selector.d.ts.map +1 -0
- package/dist/types/components/plan-type-selector/components/interval-type-toggle.d.ts +4 -0
- package/dist/types/components/plan-type-selector/components/interval-type-toggle.d.ts.map +1 -0
- package/dist/types/components/plan-type-selector/components/popup-messages.d.ts +9 -0
- package/dist/types/components/plan-type-selector/components/popup-messages.d.ts.map +1 -0
- package/dist/types/components/plan-type-selector/hooks/use-interval-options.d.ts +11 -0
- package/dist/types/components/plan-type-selector/hooks/use-interval-options.d.ts.map +1 -0
- package/dist/types/components/plan-type-selector/hooks/use-max-discount.d.ts +4 -0
- package/dist/types/components/plan-type-selector/hooks/use-max-discount.d.ts.map +1 -0
- package/dist/types/components/plan-type-selector/hooks/use-max-discounts-for-plan-terms.d.ts +10 -0
- package/dist/types/components/plan-type-selector/hooks/use-max-discounts-for-plan-terms.d.ts.map +1 -0
- package/dist/types/components/plan-type-selector/index.d.ts +6 -0
- package/dist/types/components/plan-type-selector/index.d.ts.map +1 -0
- package/dist/types/components/plans-2023-tooltip.d.ts +11 -0
- package/dist/types/components/plans-2023-tooltip.d.ts.map +1 -0
- package/dist/types/components/popular-badge.d.ts +9 -0
- package/dist/types/components/popular-badge.d.ts.map +1 -0
- package/dist/types/components/shared/action-button/index.d.ts +19 -0
- package/dist/types/components/shared/action-button/index.d.ts.map +1 -0
- package/dist/types/components/shared/billing-timeframe/index.d.ts +8 -0
- package/dist/types/components/shared/billing-timeframe/index.d.ts.map +1 -0
- package/dist/types/components/shared/header-price/header-price-context.d.ts +12 -0
- package/dist/types/components/shared/header-price/header-price-context.d.ts.map +1 -0
- package/dist/types/components/shared/header-price/index.d.ts +11 -0
- package/dist/types/components/shared/header-price/index.d.ts.map +1 -0
- package/dist/types/components/shared/plan-pill/index.d.ts +3 -0
- package/dist/types/components/shared/plan-pill/index.d.ts.map +1 -0
- package/dist/types/components/shared/storage/components/plan-storage.d.ts +13 -0
- package/dist/types/components/shared/storage/components/plan-storage.d.ts.map +1 -0
- package/dist/types/components/shared/storage/components/storage-dropdown.d.ts +9 -0
- package/dist/types/components/shared/storage/components/storage-dropdown.d.ts.map +1 -0
- package/dist/types/components/shared/storage/components/storage-feature-label.d.ts +7 -0
- package/dist/types/components/shared/storage/components/storage-feature-label.d.ts.map +1 -0
- package/dist/types/components/shared/storage/constants.d.ts +2 -0
- package/dist/types/components/shared/storage/constants.d.ts.map +1 -0
- package/dist/types/components/shared/storage/hooks/use-default-storage-option.d.ts +14 -0
- package/dist/types/components/shared/storage/hooks/use-default-storage-option.d.ts.map +1 -0
- package/dist/types/components/shared/storage/hooks/use-plan-storage.d.ts +4 -0
- package/dist/types/components/shared/storage/hooks/use-plan-storage.d.ts.map +1 -0
- package/dist/types/components/shared/storage/hooks/use-purchased-storage-add-on.d.ts +3 -0
- package/dist/types/components/shared/storage/hooks/use-purchased-storage-add-on.d.ts.map +1 -0
- package/dist/types/components/shared/storage/hooks/use-storage-string.d.ts +4 -0
- package/dist/types/components/shared/storage/hooks/use-storage-string.d.ts.map +1 -0
- package/dist/types/components/shared/storage/index.d.ts +9 -0
- package/dist/types/components/shared/storage/index.d.ts.map +1 -0
- package/dist/types/components/sticky-container.d.ts +33 -0
- package/dist/types/components/sticky-container.d.ts.map +1 -0
- package/dist/types/constants.d.ts +2 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/css-mixins.d.ts +3 -0
- package/dist/types/css-mixins.d.ts.map +1 -0
- package/dist/types/fixtures/plans.d.ts +201 -0
- package/dist/types/fixtures/plans.d.ts.map +1 -0
- package/dist/types/fixtures/sites-plans.d.ts +457 -0
- package/dist/types/fixtures/sites-plans.d.ts.map +1 -0
- package/dist/types/fixtures/sites-purchases.d.ts +96 -0
- package/dist/types/fixtures/sites-purchases.d.ts.map +1 -0
- package/dist/types/grid-context.d.ts +40 -0
- package/dist/types/grid-context.d.ts.map +1 -0
- package/dist/types/hooks/data-store/is-popular-plan.d.ts +2 -0
- package/dist/types/hooks/data-store/is-popular-plan.d.ts.map +1 -0
- package/dist/types/hooks/data-store/types.d.ts +40 -0
- package/dist/types/hooks/data-store/types.d.ts.map +1 -0
- package/dist/types/hooks/data-store/use-grid-plan-for-spotlight.d.ts +10 -0
- package/dist/types/hooks/data-store/use-grid-plan-for-spotlight.d.ts.map +1 -0
- package/dist/types/hooks/data-store/use-grid-plans-for-comparison-grid.d.ts +5 -0
- package/dist/types/hooks/data-store/use-grid-plans-for-comparison-grid.d.ts.map +1 -0
- package/dist/types/hooks/data-store/use-grid-plans-for-features-grid.d.ts +5 -0
- package/dist/types/hooks/data-store/use-grid-plans-for-features-grid.d.ts.map +1 -0
- package/dist/types/hooks/data-store/use-grid-plans.d.ts +13 -0
- package/dist/types/hooks/data-store/use-grid-plans.d.ts.map +1 -0
- package/dist/types/hooks/data-store/use-highlight-labels.d.ts +20 -0
- package/dist/types/hooks/data-store/use-highlight-labels.d.ts.map +1 -0
- package/dist/types/hooks/data-store/use-highlighted-features.d.ts +22 -0
- package/dist/types/hooks/data-store/use-highlighted-features.d.ts.map +1 -0
- package/dist/types/hooks/data-store/use-plan-billing-description.d.ts +16 -0
- package/dist/types/hooks/data-store/use-plan-billing-description.d.ts.map +1 -0
- package/dist/types/hooks/data-store/use-plan-features-for-grid-plans.d.ts +21 -0
- package/dist/types/hooks/data-store/use-plan-features-for-grid-plans.d.ts.map +1 -0
- package/dist/types/hooks/data-store/use-plans-from-types.d.ts +10 -0
- package/dist/types/hooks/data-store/use-plans-from-types.d.ts.map +1 -0
- package/dist/types/hooks/data-store/use-restructured-plan-features-for-comparison-grid.d.ts +15 -0
- package/dist/types/hooks/data-store/use-restructured-plan-features-for-comparison-grid.d.ts.map +1 -0
- package/dist/types/hooks/use-grid-size.d.ts +18 -0
- package/dist/types/hooks/use-grid-size.d.ts.map +1 -0
- package/dist/types/hooks/use-highlight-adjacency-matrix.d.ts +15 -0
- package/dist/types/hooks/use-highlight-adjacency-matrix.d.ts.map +1 -0
- package/dist/types/hooks/use-is-large-currency.d.ts +16 -0
- package/dist/types/hooks/use-is-large-currency.d.ts.map +1 -0
- package/dist/types/hooks/use-manage-tooltip-toggle.d.ts +3 -0
- package/dist/types/hooks/use-manage-tooltip-toggle.d.ts.map +1 -0
- package/dist/types/hooks/use-plan-pricing-info-from-grid-plans.d.ts +11 -0
- package/dist/types/hooks/use-plan-pricing-info-from-grid-plans.d.ts.map +1 -0
- package/dist/types/index.d.ts +32 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/lib/filter-unused-features-object.d.ts +8 -0
- package/dist/types/lib/filter-unused-features-object.d.ts.map +1 -0
- package/dist/types/lib/get-plan-features-object.d.ts +4 -0
- package/dist/types/lib/get-plan-features-object.d.ts.map +1 -0
- package/dist/types/lib/get-plan-pricing-info-from-grid-plans.d.ts +9 -0
- package/dist/types/lib/get-plan-pricing-info-from-grid-plans.d.ts.map +1 -0
- package/dist/types/lib/is-same-plan.d.ts +3 -0
- package/dist/types/lib/is-same-plan.d.ts.map +1 -0
- package/dist/types/lib/sort-plan-properties.d.ts +3 -0
- package/dist/types/lib/sort-plan-properties.d.ts.map +1 -0
- package/dist/types/lib/touch-detect/index.d.ts +11 -0
- package/dist/types/lib/touch-detect/index.d.ts.map +1 -0
- package/dist/types/types.d.ts +225 -0
- package/dist/types/types.d.ts.map +1 -0
- package/package.json +83 -0
- package/src/__mocks__/wpcom-proxy-request.js +13 -0
- package/src/_media-queries.scss +14 -0
- package/src/_mixins.scss +15 -0
- package/src/_shared.scss +174 -0
- package/src/components/comparison-grid/README.md +3 -0
- package/src/components/comparison-grid/index.stories.tsx +91 -0
- package/src/components/comparison-grid/index.tsx +1215 -0
- package/src/components/comparison-grid/style.scss +318 -0
- package/src/components/dropdown-option.tsx +44 -0
- package/src/components/features-grid/README.md +3 -0
- package/src/components/features-grid/billing-timeframes.tsx +37 -0
- package/src/components/features-grid/client-logo-list/client-list.tsx +199 -0
- package/src/components/features-grid/client-logo-list/index.tsx +24 -0
- package/src/components/features-grid/client-logo-list/style.scss +52 -0
- package/src/components/features-grid/enterprise-features.tsx +101 -0
- package/src/components/features-grid/index.stories.tsx +143 -0
- package/src/components/features-grid/index.tsx +442 -0
- package/src/components/features-grid/mobile-free-domain.tsx +51 -0
- package/src/components/features-grid/plan-features-list.tsx +187 -0
- package/src/components/features-grid/plan-headers.tsx +31 -0
- package/src/components/features-grid/plan-logos.tsx +27 -0
- package/src/components/features-grid/plan-prices.tsx +37 -0
- package/src/components/features-grid/plan-tagline.tsx +25 -0
- package/src/components/features-grid/previous-features-included-title.tsx +66 -0
- package/src/components/features-grid/spotlight-plan.scss +5 -0
- package/src/components/features-grid/spotlight-plan.tsx +77 -0
- package/src/components/features-grid/style.scss +630 -0
- package/src/components/features-grid/table.tsx +185 -0
- package/src/components/features-grid/top-buttons.tsx +49 -0
- package/src/components/features.tsx +168 -0
- package/src/components/item.tsx +9 -0
- package/src/components/plan-button/index.tsx +59 -0
- package/src/components/plan-button/style.scss +179 -0
- package/src/components/plan-div-td-container.tsx +15 -0
- package/src/components/plan-logo.tsx +111 -0
- package/src/components/plan-type-selector/components/interval-type-dropdown.tsx +70 -0
- package/src/components/plan-type-selector/components/interval-type-selector.tsx +13 -0
- package/src/components/plan-type-selector/components/interval-type-toggle.tsx +100 -0
- package/src/components/plan-type-selector/components/popup-messages.tsx +128 -0
- package/src/components/plan-type-selector/hooks/use-interval-options.tsx +89 -0
- package/src/components/plan-type-selector/hooks/use-max-discount.ts +64 -0
- package/src/components/plan-type-selector/hooks/use-max-discounts-for-plan-terms.ts +99 -0
- package/src/components/plan-type-selector/index.tsx +50 -0
- package/src/components/plan-type-selector/style.scss +196 -0
- package/src/components/plans-2023-tooltip.tsx +85 -0
- package/src/components/popular-badge.tsx +30 -0
- package/src/components/shared/README.md +1 -0
- package/src/components/shared/action-button/index.tsx +205 -0
- package/src/components/shared/action-button/style.scss +12 -0
- package/src/components/shared/billing-timeframe/index.tsx +106 -0
- package/src/components/shared/header-price/header-price-context.tsx +24 -0
- package/src/components/shared/header-price/index.tsx +278 -0
- package/src/components/shared/header-price/style.scss +112 -0
- package/src/components/shared/plan-pill/index.jsx +7 -0
- package/src/components/shared/plan-pill/style.scss +30 -0
- package/src/components/shared/storage/components/plan-storage.tsx +51 -0
- package/src/components/shared/storage/components/storage-dropdown.tsx +187 -0
- package/src/components/shared/storage/components/storage-feature-label.tsx +68 -0
- package/src/components/shared/storage/constants.ts +3 -0
- package/src/components/shared/storage/hooks/use-default-storage-option.ts +34 -0
- package/src/components/shared/storage/hooks/use-plan-storage.ts +41 -0
- package/src/components/shared/storage/hooks/use-purchased-storage-add-on.ts +53 -0
- package/src/components/shared/storage/hooks/use-storage-string.ts +13 -0
- package/src/components/shared/storage/index.ts +9 -0
- package/src/components/sticky-container.tsx +146 -0
- package/src/components/test/actions-button.tsx +397 -0
- package/src/components/test/billing-timeframe.tsx +341 -0
- package/src/components/test/header-price.tsx +189 -0
- package/src/components/test/plan-type-selector.tsx +44 -0
- package/src/constants.ts +13 -0
- package/src/css-mixins.tsx +11 -0
- package/src/fixtures/plans.ts +1539 -0
- package/src/fixtures/sites-plans.ts +455 -0
- package/src/fixtures/sites-purchases.ts +130 -0
- package/src/grid-context.tsx +104 -0
- package/src/hooks/data-store/is-popular-plan.ts +5 -0
- package/src/hooks/data-store/types.ts +41 -0
- package/src/hooks/data-store/use-grid-plan-for-spotlight.ts +35 -0
- package/src/hooks/data-store/use-grid-plans-for-comparison-grid.ts +81 -0
- package/src/hooks/data-store/use-grid-plans-for-features-grid.ts +79 -0
- package/src/hooks/data-store/use-grid-plans.tsx +360 -0
- package/src/hooks/data-store/use-highlight-labels.ts +88 -0
- package/src/hooks/data-store/use-highlighted-features.ts +51 -0
- package/src/hooks/data-store/use-plan-billing-description.tsx +309 -0
- package/src/hooks/data-store/use-plan-features-for-grid-plans.ts +219 -0
- package/src/hooks/data-store/use-plans-from-types.ts +51 -0
- package/src/hooks/data-store/use-restructured-plan-features-for-comparison-grid.ts +158 -0
- package/src/hooks/test/use-is-large-currency.ts +69 -0
- package/src/hooks/use-grid-size.ts +46 -0
- package/src/hooks/use-highlight-adjacency-matrix.ts +48 -0
- package/src/hooks/use-is-large-currency.ts +91 -0
- package/src/hooks/use-manage-tooltip-toggle.ts +30 -0
- package/src/hooks/use-plan-pricing-info-from-grid-plans.ts +36 -0
- package/src/index.tsx +46 -0
- package/src/lib/filter-unused-features-object.ts +31 -0
- package/src/lib/get-plan-features-object.ts +12 -0
- package/src/lib/get-plan-pricing-info-from-grid-plans.ts +31 -0
- package/src/lib/is-same-plan.ts +8 -0
- package/src/lib/sort-plan-properties.ts +46 -0
- package/src/lib/test/filter-plan-features-object.ts +65 -0
- package/src/lib/test/sort-plan-properties.ts +104 -0
- package/src/lib/touch-detect/README.md +11 -0
- package/src/lib/touch-detect/index.js +17 -0
- package/src/types.ts +340 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FEATURE_CUSTOM_DOMAIN,
|
|
3
|
+
FEATURE_NEWSLETTER_IMPORT_SUBSCRIBERS_FREE,
|
|
4
|
+
FEATURE_UNLIMITED_SUBSCRIBERS,
|
|
5
|
+
FEATURE_PAYMENT_TRANSACTION_FEES_10,
|
|
6
|
+
FEATURE_PAYMENT_TRANSACTION_FEES_8,
|
|
7
|
+
FEATURE_PAYMENT_TRANSACTION_FEES_4,
|
|
8
|
+
} from '@automattic/calypso-products';
|
|
9
|
+
import { useMemo } from '@wordpress/element';
|
|
10
|
+
import type { PlansIntent } from '../../types';
|
|
11
|
+
|
|
12
|
+
export type UseHighlightedFeatures = ( {
|
|
13
|
+
intent,
|
|
14
|
+
isInSignup,
|
|
15
|
+
}: {
|
|
16
|
+
intent: PlansIntent | null;
|
|
17
|
+
isInSignup?: boolean;
|
|
18
|
+
} ) => string[] | null;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Returns an array of features that, if they exist for a
|
|
22
|
+
* particular Plan on a pricing table, will be highlighted
|
|
23
|
+
* (ie, moved to the top of the list, and bolded).
|
|
24
|
+
*
|
|
25
|
+
* Will only affect wpcomeFeatures, not jetpackFeatures. And
|
|
26
|
+
* if the specified features don't exist for a particular
|
|
27
|
+
* Plan, they will be ignored.
|
|
28
|
+
*
|
|
29
|
+
* The Logic for processing the highlightedFeatures
|
|
30
|
+
* lives in the adjacent usePlanFeaturesForGridPlans hook.
|
|
31
|
+
*
|
|
32
|
+
* TODO clk: move to plans data store
|
|
33
|
+
*/
|
|
34
|
+
const useHighlightedFeatures: UseHighlightedFeatures = ( { intent, isInSignup } ) => {
|
|
35
|
+
return useMemo( () => {
|
|
36
|
+
if ( isInSignup && intent && 'plans-newsletter' === intent ) {
|
|
37
|
+
return [
|
|
38
|
+
FEATURE_CUSTOM_DOMAIN,
|
|
39
|
+
FEATURE_NEWSLETTER_IMPORT_SUBSCRIBERS_FREE,
|
|
40
|
+
FEATURE_UNLIMITED_SUBSCRIBERS,
|
|
41
|
+
FEATURE_PAYMENT_TRANSACTION_FEES_10,
|
|
42
|
+
FEATURE_PAYMENT_TRANSACTION_FEES_8,
|
|
43
|
+
FEATURE_PAYMENT_TRANSACTION_FEES_4,
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return null;
|
|
48
|
+
}, [ intent, isInSignup ] );
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default useHighlightedFeatures;
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isWpComFreePlan,
|
|
3
|
+
isWpcomEnterpriseGridPlan,
|
|
4
|
+
PLAN_BIENNIAL_PERIOD,
|
|
5
|
+
PLAN_ANNUAL_PERIOD,
|
|
6
|
+
PLAN_TRIENNIAL_PERIOD,
|
|
7
|
+
PlanSlug,
|
|
8
|
+
getPlanSlugForTermVariant,
|
|
9
|
+
TERM_ANNUALLY,
|
|
10
|
+
PLAN_HOSTING_TRIAL_MONTHLY,
|
|
11
|
+
} from '@automattic/calypso-products';
|
|
12
|
+
import { Plans } from '@automattic/data-stores';
|
|
13
|
+
import { useTranslate, formatCurrency } from 'i18n-calypso';
|
|
14
|
+
import { usePlansGridContext } from '../../grid-context';
|
|
15
|
+
import type { GridPlan } from '../../types';
|
|
16
|
+
|
|
17
|
+
interface UsePlanBillingDescriptionProps {
|
|
18
|
+
siteId?: number | null;
|
|
19
|
+
planSlug: PlanSlug;
|
|
20
|
+
pricing: GridPlan[ 'pricing' ] | null;
|
|
21
|
+
isMonthlyPlan?: boolean;
|
|
22
|
+
coupon?: string;
|
|
23
|
+
useCheckPlanAvailabilityForPurchase: Plans.UseCheckPlanAvailabilityForPurchase;
|
|
24
|
+
reflectStorageSelectionInPlanPrices?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default function usePlanBillingDescription( {
|
|
28
|
+
siteId,
|
|
29
|
+
planSlug,
|
|
30
|
+
pricing,
|
|
31
|
+
isMonthlyPlan,
|
|
32
|
+
coupon,
|
|
33
|
+
useCheckPlanAvailabilityForPurchase,
|
|
34
|
+
}: UsePlanBillingDescriptionProps ) {
|
|
35
|
+
const translate = useTranslate();
|
|
36
|
+
const { currencyCode, originalPrice, discountedPrice, billingPeriod, introOffer } = pricing || {};
|
|
37
|
+
const { reflectStorageSelectionInPlanPrices } = usePlansGridContext();
|
|
38
|
+
const yearlyVariantPlanSlug = getPlanSlugForTermVariant( planSlug, TERM_ANNUALLY );
|
|
39
|
+
|
|
40
|
+
const yearlyVariantPricing = Plans.usePricingMetaForGridPlans( {
|
|
41
|
+
planSlugs: yearlyVariantPlanSlug ? [ yearlyVariantPlanSlug ] : [],
|
|
42
|
+
coupon,
|
|
43
|
+
siteId,
|
|
44
|
+
useCheckPlanAvailabilityForPurchase,
|
|
45
|
+
reflectStorageSelectionInPlanPrices,
|
|
46
|
+
} )?.[ yearlyVariantPlanSlug ?? '' ];
|
|
47
|
+
|
|
48
|
+
if ( ! pricing ) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (
|
|
53
|
+
isWpComFreePlan( planSlug ) ||
|
|
54
|
+
isWpcomEnterpriseGridPlan( planSlug ) ||
|
|
55
|
+
planSlug === PLAN_HOSTING_TRIAL_MONTHLY
|
|
56
|
+
) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (
|
|
61
|
+
isMonthlyPlan &&
|
|
62
|
+
originalPrice?.monthly &&
|
|
63
|
+
yearlyVariantPricing &&
|
|
64
|
+
( ! introOffer || introOffer.isOfferComplete )
|
|
65
|
+
) {
|
|
66
|
+
const yearlyVariantMaybeDiscountedPrice = Number.isFinite(
|
|
67
|
+
yearlyVariantPricing.discountedPrice?.monthly
|
|
68
|
+
)
|
|
69
|
+
? yearlyVariantPricing.discountedPrice?.monthly
|
|
70
|
+
: yearlyVariantPricing.originalPrice?.monthly;
|
|
71
|
+
|
|
72
|
+
if (
|
|
73
|
+
yearlyVariantMaybeDiscountedPrice &&
|
|
74
|
+
yearlyVariantMaybeDiscountedPrice < originalPrice.monthly
|
|
75
|
+
) {
|
|
76
|
+
return translate( `Save %(discountRate)s%% by paying annually`, {
|
|
77
|
+
args: {
|
|
78
|
+
discountRate: Math.floor(
|
|
79
|
+
( 100 * ( originalPrice.monthly - yearlyVariantMaybeDiscountedPrice ) ) /
|
|
80
|
+
originalPrice.monthly
|
|
81
|
+
),
|
|
82
|
+
},
|
|
83
|
+
} );
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const discountedPriceFullTermText =
|
|
90
|
+
currencyCode && typeof discountedPrice?.full === 'number'
|
|
91
|
+
? formatCurrency( discountedPrice.full, currencyCode, {
|
|
92
|
+
stripZeros: true,
|
|
93
|
+
isSmallestUnit: true,
|
|
94
|
+
} )
|
|
95
|
+
: null;
|
|
96
|
+
const originalPriceFullTermText =
|
|
97
|
+
currencyCode && originalPrice?.full
|
|
98
|
+
? formatCurrency( originalPrice.full, currencyCode, {
|
|
99
|
+
stripZeros: true,
|
|
100
|
+
isSmallestUnit: true,
|
|
101
|
+
} )
|
|
102
|
+
: null;
|
|
103
|
+
|
|
104
|
+
/*
|
|
105
|
+
* The introOffer billing should fall below into the next block once experiment with Woo plans is finalized.
|
|
106
|
+
* 1. We only expose introOffers to monthly & yearly plans for now (so no need to introduce more translations just yet)
|
|
107
|
+
* 2. We only expose month & year based intervals for now (so no need to introduce more translations just yet)
|
|
108
|
+
*/
|
|
109
|
+
if ( introOffer?.intervalCount && introOffer.intervalUnit && ! introOffer.isOfferComplete ) {
|
|
110
|
+
const discountedPriceFull =
|
|
111
|
+
typeof discountedPrice?.full === 'number' ? discountedPrice.full : introOffer?.rawPrice?.full;
|
|
112
|
+
|
|
113
|
+
const introOfferFullTermText =
|
|
114
|
+
currencyCode && typeof discountedPriceFull === 'number'
|
|
115
|
+
? formatCurrency( discountedPriceFull, currencyCode, {
|
|
116
|
+
stripZeros: true,
|
|
117
|
+
isSmallestUnit: true,
|
|
118
|
+
} )
|
|
119
|
+
: null;
|
|
120
|
+
|
|
121
|
+
if ( originalPriceFullTermText && introOfferFullTermText ) {
|
|
122
|
+
/* Introductory offers for monthly plans */
|
|
123
|
+
if ( isMonthlyPlan ) {
|
|
124
|
+
/* If the offer is for X months */
|
|
125
|
+
if ( 'month' === introOffer.intervalUnit ) {
|
|
126
|
+
if ( 1 === introOffer.intervalCount ) {
|
|
127
|
+
return translate(
|
|
128
|
+
'for your first month,{{br/}}' + 'then %(rawPrice)s billed monthly, excl. taxes',
|
|
129
|
+
{
|
|
130
|
+
args: {
|
|
131
|
+
rawPrice: originalPriceFullTermText,
|
|
132
|
+
},
|
|
133
|
+
components: { br: <br /> },
|
|
134
|
+
comment: 'excl. taxes is short for excluding taxes',
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return translate(
|
|
140
|
+
'for your first %(introOfferIntervalCount)s months,{{br/}}' +
|
|
141
|
+
'then %(rawPrice)s billed monthly, excl. taxes',
|
|
142
|
+
{
|
|
143
|
+
args: {
|
|
144
|
+
rawPrice: originalPriceFullTermText,
|
|
145
|
+
introOfferIntervalCount: introOffer.intervalCount,
|
|
146
|
+
},
|
|
147
|
+
components: { br: <br /> },
|
|
148
|
+
comment: 'excl. taxes is short for excluding taxes',
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* If the offer is for X years of monthly intervals */
|
|
154
|
+
if ( 'year' === introOffer.intervalUnit ) {
|
|
155
|
+
if ( 1 === introOffer.intervalCount ) {
|
|
156
|
+
return translate(
|
|
157
|
+
'for your first year,{{br/}}' + 'then %(rawPrice)s billed monthly, excl. taxes',
|
|
158
|
+
{
|
|
159
|
+
args: {
|
|
160
|
+
rawPrice: originalPriceFullTermText,
|
|
161
|
+
},
|
|
162
|
+
components: { br: <br /> },
|
|
163
|
+
comment: 'excl. taxes is short for excluding taxes',
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return translate(
|
|
169
|
+
'per month, for your first %(introOfferIntervalCount)s years,{{br/}}' +
|
|
170
|
+
'then %(rawPrice)s billed monthly, excl. taxes',
|
|
171
|
+
{
|
|
172
|
+
args: {
|
|
173
|
+
rawPrice: originalPriceFullTermText,
|
|
174
|
+
introOfferIntervalCount: introOffer.intervalCount,
|
|
175
|
+
},
|
|
176
|
+
components: { br: <br /> },
|
|
177
|
+
comment: 'excl. taxes is short for excluding taxes',
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/* Introductory offers for yearly plans */
|
|
184
|
+
if ( PLAN_ANNUAL_PERIOD === billingPeriod ) {
|
|
185
|
+
/* If the offer is for X months of a yearly plan */
|
|
186
|
+
if ( 'month' === introOffer.intervalUnit ) {
|
|
187
|
+
if ( 1 === introOffer.intervalCount ) {
|
|
188
|
+
return translate(
|
|
189
|
+
'for your first month,{{br/}}' + 'then %(rawPrice)s billed annually, excl. taxes',
|
|
190
|
+
{
|
|
191
|
+
args: {
|
|
192
|
+
rawPrice: originalPriceFullTermText,
|
|
193
|
+
introOfferIntervalUnit: introOffer.intervalUnit,
|
|
194
|
+
},
|
|
195
|
+
components: { br: <br /> },
|
|
196
|
+
comment: 'excl. taxes is short for excluding taxes',
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return translate(
|
|
202
|
+
'for your first %(introOfferIntervalCount)s months,{{br/}}' +
|
|
203
|
+
'then %(rawPrice)s billed annually, excl. taxes',
|
|
204
|
+
{
|
|
205
|
+
args: {
|
|
206
|
+
rawPrice: originalPriceFullTermText,
|
|
207
|
+
introOfferIntervalCount: introOffer.intervalCount,
|
|
208
|
+
},
|
|
209
|
+
components: { br: <br /> },
|
|
210
|
+
comment: 'excl. taxes is short for excluding taxes',
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/* If the offer is for X years of a yearly plan */
|
|
216
|
+
if ( 'year' === introOffer.intervalUnit ) {
|
|
217
|
+
if ( 1 === introOffer.intervalCount ) {
|
|
218
|
+
return translate(
|
|
219
|
+
'per month, %(introOfferFormattedPrice)s for your first year,{{br/}}' +
|
|
220
|
+
'then %(rawPrice)s billed annually, excl. taxes',
|
|
221
|
+
{
|
|
222
|
+
args: {
|
|
223
|
+
introOfferFormattedPrice: introOfferFullTermText,
|
|
224
|
+
rawPrice: originalPriceFullTermText,
|
|
225
|
+
},
|
|
226
|
+
components: { br: <br /> },
|
|
227
|
+
comment: 'excl. taxes is short for excluding taxes',
|
|
228
|
+
}
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return translate(
|
|
233
|
+
'per month, %(introOfferFormattedPrice)s for your first %(introOfferIntervalCount)s years,{{br/}}' +
|
|
234
|
+
'then %(rawPrice)s billed annually, excl. taxes',
|
|
235
|
+
{
|
|
236
|
+
args: {
|
|
237
|
+
introOfferFormattedPrice: introOfferFullTermText,
|
|
238
|
+
rawPrice: originalPriceFullTermText,
|
|
239
|
+
introOfferIntervalCount: introOffer.intervalCount,
|
|
240
|
+
},
|
|
241
|
+
components: { br: <br /> },
|
|
242
|
+
comment: 'excl. taxes is short for excluding taxes',
|
|
243
|
+
}
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
/*
|
|
249
|
+
* Early return here is for sanity. We don't want to show regular billing descriptions
|
|
250
|
+
* if there is an introOffer (despite that will not be the case, unless some API-level bug happens)
|
|
251
|
+
*/
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if ( discountedPriceFullTermText ) {
|
|
256
|
+
if ( PLAN_ANNUAL_PERIOD === billingPeriod ) {
|
|
257
|
+
return translate(
|
|
258
|
+
'per month, %(fullTermDiscountedPriceText)s for the first year, excl. taxes',
|
|
259
|
+
{
|
|
260
|
+
args: { fullTermDiscountedPriceText: discountedPriceFullTermText },
|
|
261
|
+
comment: 'Excl. Taxes is short for excluding taxes',
|
|
262
|
+
}
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if ( PLAN_BIENNIAL_PERIOD === billingPeriod ) {
|
|
267
|
+
return translate(
|
|
268
|
+
'per month, %(fullTermDiscountedPriceText)s for the first two years, excl. taxes',
|
|
269
|
+
{
|
|
270
|
+
args: { fullTermDiscountedPriceText: discountedPriceFullTermText },
|
|
271
|
+
comment: 'Excl. Taxes is short for excluding taxes',
|
|
272
|
+
}
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
if ( PLAN_TRIENNIAL_PERIOD === billingPeriod ) {
|
|
277
|
+
return translate(
|
|
278
|
+
'per month, %(fullTermDiscountedPriceText)s for the first three years, excl. taxes',
|
|
279
|
+
{
|
|
280
|
+
args: { fullTermDiscountedPriceText: discountedPriceFullTermText },
|
|
281
|
+
comment: 'Excl. Taxes is short for excluding taxes',
|
|
282
|
+
}
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
} else if ( originalPriceFullTermText ) {
|
|
286
|
+
if ( PLAN_ANNUAL_PERIOD === billingPeriod ) {
|
|
287
|
+
return translate( 'per month, %(rawPrice)s billed annually, excl. taxes', {
|
|
288
|
+
args: { rawPrice: originalPriceFullTermText },
|
|
289
|
+
comment: 'Excl. Taxes is short for excluding taxes',
|
|
290
|
+
} );
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if ( PLAN_BIENNIAL_PERIOD === billingPeriod ) {
|
|
294
|
+
return translate( 'per month, %(rawPrice)s billed every two years, excl. taxes', {
|
|
295
|
+
args: { rawPrice: originalPriceFullTermText },
|
|
296
|
+
comment: 'Excl. Taxes is short for excluding taxes',
|
|
297
|
+
} );
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if ( PLAN_TRIENNIAL_PERIOD === billingPeriod ) {
|
|
301
|
+
return translate( 'per month, %(rawPrice)s billed every three years, excl. taxes', {
|
|
302
|
+
args: { rawPrice: originalPriceFullTermText },
|
|
303
|
+
comment: 'Excl. Taxes is short for excluding taxes',
|
|
304
|
+
} );
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
return null;
|
|
309
|
+
}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FEATURE_CUSTOM_DOMAIN,
|
|
3
|
+
applyTestFiltersToPlansList,
|
|
4
|
+
isMonthly,
|
|
5
|
+
} from '@automattic/calypso-products';
|
|
6
|
+
import { useMemo } from '@wordpress/element';
|
|
7
|
+
import getPlanFeaturesObject from '../../lib/get-plan-features-object';
|
|
8
|
+
import useHighlightedFeatures from './use-highlighted-features';
|
|
9
|
+
import type {
|
|
10
|
+
TransformedFeatureObject,
|
|
11
|
+
PlanFeaturesForGridPlan,
|
|
12
|
+
PlansIntent,
|
|
13
|
+
GridPlan,
|
|
14
|
+
} from '../../types';
|
|
15
|
+
import type { FeatureObject, FeatureList } from '@automattic/calypso-products';
|
|
16
|
+
|
|
17
|
+
export type UsePlanFeaturesForGridPlans = ( {
|
|
18
|
+
gridPlans,
|
|
19
|
+
// allFeaturesList temporary until feature definitions are ported to calypso-products package
|
|
20
|
+
allFeaturesList,
|
|
21
|
+
hasRedeemedDomainCredit,
|
|
22
|
+
intent,
|
|
23
|
+
showLegacyStorageFeature,
|
|
24
|
+
selectedFeature,
|
|
25
|
+
isInSignup,
|
|
26
|
+
}: {
|
|
27
|
+
gridPlans: Omit< GridPlan, 'features' >[];
|
|
28
|
+
allFeaturesList: FeatureList;
|
|
29
|
+
hasRedeemedDomainCredit?: boolean;
|
|
30
|
+
intent?: PlansIntent;
|
|
31
|
+
selectedFeature?: string | null;
|
|
32
|
+
showLegacyStorageFeature?: boolean;
|
|
33
|
+
isInSignup?: boolean;
|
|
34
|
+
} ) => { [ planSlug: string ]: PlanFeaturesForGridPlan };
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* usePlanFeaturesForGridPlans:
|
|
38
|
+
* - these plan features are mainly relevant to FeaturesGrid and Spotlight components
|
|
39
|
+
* - this hook can migrate to data store once features definitions migrate to calypso-products
|
|
40
|
+
*/
|
|
41
|
+
const usePlanFeaturesForGridPlans: UsePlanFeaturesForGridPlans = ( {
|
|
42
|
+
gridPlans,
|
|
43
|
+
allFeaturesList,
|
|
44
|
+
hasRedeemedDomainCredit,
|
|
45
|
+
intent,
|
|
46
|
+
selectedFeature,
|
|
47
|
+
showLegacyStorageFeature,
|
|
48
|
+
isInSignup,
|
|
49
|
+
} ) => {
|
|
50
|
+
const highlightedFeatures = useHighlightedFeatures( { intent: intent ?? null, isInSignup } );
|
|
51
|
+
return useMemo( () => {
|
|
52
|
+
return gridPlans.reduce(
|
|
53
|
+
( acc, gridPlan ) => {
|
|
54
|
+
const planSlug = gridPlan.planSlug;
|
|
55
|
+
const planConstantObj = applyTestFiltersToPlansList( planSlug, undefined );
|
|
56
|
+
const isMonthlyPlan = isMonthly( planSlug );
|
|
57
|
+
|
|
58
|
+
let wpcomFeatures: FeatureObject[] = [];
|
|
59
|
+
let jetpackFeatures: FeatureObject[] = [];
|
|
60
|
+
|
|
61
|
+
if ( 'plans-newsletter' === intent ) {
|
|
62
|
+
wpcomFeatures = getPlanFeaturesObject(
|
|
63
|
+
allFeaturesList,
|
|
64
|
+
planConstantObj?.getNewsletterSignupFeatures?.() ?? []
|
|
65
|
+
);
|
|
66
|
+
} else if ( 'plans-p2' === intent ) {
|
|
67
|
+
wpcomFeatures = getPlanFeaturesObject(
|
|
68
|
+
allFeaturesList,
|
|
69
|
+
planConstantObj?.get2023PricingGridSignupWpcomFeatures?.() ?? []
|
|
70
|
+
);
|
|
71
|
+
} else if ( 'plans-blog-onboarding' === intent ) {
|
|
72
|
+
wpcomFeatures = getPlanFeaturesObject(
|
|
73
|
+
allFeaturesList,
|
|
74
|
+
planConstantObj?.getBlogOnboardingSignupFeatures?.() ?? []
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
jetpackFeatures = getPlanFeaturesObject(
|
|
78
|
+
allFeaturesList,
|
|
79
|
+
planConstantObj.getBlogOnboardingSignupJetpackFeatures?.() ?? []
|
|
80
|
+
);
|
|
81
|
+
} else if ( 'plans-woocommerce' === intent ) {
|
|
82
|
+
wpcomFeatures = getPlanFeaturesObject(
|
|
83
|
+
allFeaturesList,
|
|
84
|
+
planConstantObj?.get2023PricingGridSignupWpcomFeatures?.() ?? []
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
jetpackFeatures = getPlanFeaturesObject(
|
|
88
|
+
allFeaturesList,
|
|
89
|
+
planConstantObj.get2023PricingGridSignupJetpackFeatures?.() ?? []
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
/*
|
|
93
|
+
* Woo Express plans with an introductory offer need some features removed:
|
|
94
|
+
* - custom domain feature removed for all Woo Express plans
|
|
95
|
+
*/
|
|
96
|
+
if ( gridPlan.pricing.introOffer ) {
|
|
97
|
+
wpcomFeatures = wpcomFeatures.filter( ( feature ) => {
|
|
98
|
+
// Remove the custom domain feature for Woo Express plans with an introductory offer.
|
|
99
|
+
if ( FEATURE_CUSTOM_DOMAIN === feature.getSlug() ) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return true;
|
|
104
|
+
} );
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
wpcomFeatures = getPlanFeaturesObject(
|
|
108
|
+
allFeaturesList,
|
|
109
|
+
planConstantObj?.get2023PricingGridSignupWpcomFeatures?.() ?? []
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
jetpackFeatures = getPlanFeaturesObject(
|
|
113
|
+
allFeaturesList,
|
|
114
|
+
planConstantObj.get2023PricingGridSignupJetpackFeatures?.() ?? []
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const annualPlansOnlyFeatures = planConstantObj.getAnnualPlansOnlyFeatures?.() || [];
|
|
119
|
+
const wpcomFeaturesTransformed: TransformedFeatureObject[] = [];
|
|
120
|
+
const jetpackFeaturesTransformed = jetpackFeatures.map( ( feature ) => {
|
|
121
|
+
const availableOnlyForAnnualPlans = annualPlansOnlyFeatures.includes( feature.getSlug() );
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
...feature,
|
|
125
|
+
availableOnlyForAnnualPlans,
|
|
126
|
+
availableForCurrentPlan: ! isMonthlyPlan || ! availableOnlyForAnnualPlans,
|
|
127
|
+
};
|
|
128
|
+
} );
|
|
129
|
+
|
|
130
|
+
if ( highlightedFeatures ) {
|
|
131
|
+
// slice() and reverse() are needed to the preserve order of features
|
|
132
|
+
highlightedFeatures
|
|
133
|
+
.slice()
|
|
134
|
+
.reverse()
|
|
135
|
+
.forEach( ( slug ) => {
|
|
136
|
+
const feature = wpcomFeatures.find( ( feature ) => feature.getSlug() === slug );
|
|
137
|
+
if ( feature ) {
|
|
138
|
+
const availableOnlyForAnnualPlans = annualPlansOnlyFeatures.includes(
|
|
139
|
+
feature.getSlug()
|
|
140
|
+
);
|
|
141
|
+
wpcomFeaturesTransformed.unshift( {
|
|
142
|
+
...feature,
|
|
143
|
+
availableOnlyForAnnualPlans,
|
|
144
|
+
availableForCurrentPlan: ! isMonthlyPlan || ! availableOnlyForAnnualPlans,
|
|
145
|
+
isHighlighted: true,
|
|
146
|
+
} );
|
|
147
|
+
}
|
|
148
|
+
} );
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const topFeature = selectedFeature
|
|
152
|
+
? wpcomFeatures.find( ( feature ) => feature.getSlug() === selectedFeature )
|
|
153
|
+
: undefined;
|
|
154
|
+
|
|
155
|
+
if ( topFeature ) {
|
|
156
|
+
const availableOnlyForAnnualPlans = annualPlansOnlyFeatures.includes(
|
|
157
|
+
topFeature.getSlug()
|
|
158
|
+
);
|
|
159
|
+
wpcomFeaturesTransformed.unshift( {
|
|
160
|
+
...topFeature,
|
|
161
|
+
availableOnlyForAnnualPlans,
|
|
162
|
+
availableForCurrentPlan: ! isMonthlyPlan || ! availableOnlyForAnnualPlans,
|
|
163
|
+
} );
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if ( annualPlansOnlyFeatures.length > 0 ) {
|
|
167
|
+
wpcomFeatures.forEach( ( feature ) => {
|
|
168
|
+
// topFeature and highlightedFeatures are already added to the list above
|
|
169
|
+
const isHighlightedFeature =
|
|
170
|
+
highlightedFeatures && highlightedFeatures.includes( feature.getSlug() );
|
|
171
|
+
if ( feature === topFeature || isHighlightedFeature ) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if ( hasRedeemedDomainCredit && feature.getSlug() === FEATURE_CUSTOM_DOMAIN ) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const availableOnlyForAnnualPlans = annualPlansOnlyFeatures.includes(
|
|
179
|
+
feature.getSlug()
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
wpcomFeaturesTransformed.push( {
|
|
183
|
+
...feature,
|
|
184
|
+
availableOnlyForAnnualPlans,
|
|
185
|
+
availableForCurrentPlan: ! isMonthlyPlan || ! availableOnlyForAnnualPlans,
|
|
186
|
+
} );
|
|
187
|
+
} );
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const storageFeature = planConstantObj.getStorageFeature?.(
|
|
191
|
+
showLegacyStorageFeature,
|
|
192
|
+
gridPlan.current
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
return {
|
|
196
|
+
...acc,
|
|
197
|
+
[ planSlug ]: {
|
|
198
|
+
wpcomFeatures: wpcomFeaturesTransformed,
|
|
199
|
+
jetpackFeatures: jetpackFeaturesTransformed,
|
|
200
|
+
...( storageFeature && {
|
|
201
|
+
storageFeature: getPlanFeaturesObject( allFeaturesList, [ storageFeature ] )?.[ 0 ],
|
|
202
|
+
} ),
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
},
|
|
206
|
+
{} as { [ planSlug: string ]: PlanFeaturesForGridPlan }
|
|
207
|
+
);
|
|
208
|
+
}, [
|
|
209
|
+
gridPlans,
|
|
210
|
+
intent,
|
|
211
|
+
highlightedFeatures,
|
|
212
|
+
selectedFeature,
|
|
213
|
+
showLegacyStorageFeature,
|
|
214
|
+
allFeaturesList,
|
|
215
|
+
hasRedeemedDomainCredit,
|
|
216
|
+
] );
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
export default usePlanFeaturesForGridPlans;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type PlanSlug,
|
|
3
|
+
TYPE_ENTERPRISE_GRID_WPCOM,
|
|
4
|
+
TYPE_FREE,
|
|
5
|
+
TYPE_WOO_EXPRESS_PLUS,
|
|
6
|
+
findPlansKeys,
|
|
7
|
+
TERMS_LIST,
|
|
8
|
+
TYPE_P2_PLUS,
|
|
9
|
+
GROUP_P2,
|
|
10
|
+
} from '@automattic/calypso-products';
|
|
11
|
+
import warn from '@wordpress/warning';
|
|
12
|
+
import type { PlansIntent } from '../../types';
|
|
13
|
+
|
|
14
|
+
interface Props {
|
|
15
|
+
planTypes: string[];
|
|
16
|
+
term: ( typeof TERMS_LIST )[ number ];
|
|
17
|
+
intent?: PlansIntent;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const usePlansFromTypes = ( { planTypes, term, intent }: Props ): PlanSlug[] => {
|
|
21
|
+
const plans = planTypes.reduce( ( accum: PlanSlug[], type ) => {
|
|
22
|
+
// These plans don't have a term.
|
|
23
|
+
// We may consider to move this logic into the underlying `planMatches` function, but that would have wider implication so it's TBD
|
|
24
|
+
const planQuery: { type: string; term?: string; group?: string } = [
|
|
25
|
+
TYPE_FREE,
|
|
26
|
+
TYPE_ENTERPRISE_GRID_WPCOM,
|
|
27
|
+
TYPE_WOO_EXPRESS_PLUS,
|
|
28
|
+
TYPE_P2_PLUS,
|
|
29
|
+
].includes( type )
|
|
30
|
+
? { type }
|
|
31
|
+
: { type, term };
|
|
32
|
+
|
|
33
|
+
if ( intent === 'plans-p2' ) {
|
|
34
|
+
planQuery[ 'group' ] = GROUP_P2;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const plan = findPlansKeys( planQuery )[ 0 ];
|
|
38
|
+
|
|
39
|
+
if ( ! plan ) {
|
|
40
|
+
warn(
|
|
41
|
+
`Invalid plan type, \`${ type }\`, provided to \`PlansFeaturesMain\` component. See plans constants for valid plan types.`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return plan ? [ ...accum, plan as PlanSlug ] : accum;
|
|
46
|
+
}, [] );
|
|
47
|
+
|
|
48
|
+
return plans;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default usePlansFromTypes;
|