@automattic/plans-grid-next 1.0.1 → 1.0.3
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 -1
- package/dist/cjs/_shared.scss +4 -3
- package/dist/cjs/components/comparison-grid/index.js +101 -71
- package/dist/cjs/components/comparison-grid/index.js.map +1 -1
- package/dist/cjs/components/comparison-grid/index.stories.js.map +1 -1
- package/dist/cjs/components/comparison-grid/style.scss +10 -2
- package/dist/cjs/components/features-grid/client-logo-list/client-list.js +0 -12
- package/dist/cjs/components/features-grid/client-logo-list/client-list.js.map +1 -1
- package/dist/cjs/components/features-grid/index.js +9 -6
- package/dist/cjs/components/features-grid/index.js.map +1 -1
- package/dist/cjs/components/features-grid/plan-features-list.js +10 -3
- package/dist/cjs/components/features-grid/plan-features-list.js.map +1 -1
- package/dist/cjs/components/features-grid/plan-headers.js +2 -2
- package/dist/cjs/components/features-grid/plan-headers.js.map +1 -1
- package/dist/cjs/components/features-grid/plan-tagline.js +1 -1
- package/dist/cjs/components/features-grid/plan-tagline.js.map +1 -1
- package/dist/cjs/components/features-grid/style.scss +111 -21
- package/dist/cjs/components/features-grid/table.js +1 -1
- package/dist/cjs/components/features-grid/table.js.map +1 -1
- package/dist/cjs/components/features.js +43 -4
- package/dist/cjs/components/features.js.map +1 -1
- package/dist/cjs/components/item.js +1 -1
- package/dist/cjs/components/item.js.map +1 -1
- package/dist/cjs/components/plan-button/index.js +5 -3
- package/dist/cjs/components/plan-button/index.js.map +1 -1
- package/dist/cjs/components/plan-button/style.scss +71 -47
- package/dist/cjs/components/plan-div-td-container.js +4 -1
- package/dist/cjs/components/plan-div-td-container.js.map +1 -1
- package/dist/cjs/components/plan-logo.js +6 -3
- package/dist/cjs/components/plan-logo.js.map +1 -1
- package/dist/cjs/components/plan-type-selector/components/interval-type-dropdown.js +12 -1
- package/dist/cjs/components/plan-type-selector/components/interval-type-dropdown.js.map +1 -1
- package/dist/cjs/components/plan-type-selector/hooks/use-max-discount.js +4 -33
- package/dist/cjs/components/plan-type-selector/hooks/use-max-discount.js.map +1 -1
- package/dist/cjs/components/plan-type-selector/hooks/use-max-discounts-for-plan-terms.js +11 -13
- package/dist/cjs/components/plan-type-selector/hooks/use-max-discounts-for-plan-terms.js.map +1 -1
- package/dist/cjs/components/plans-2023-tooltip.js +16 -5
- package/dist/cjs/components/plans-2023-tooltip.js.map +1 -1
- package/dist/cjs/components/shared/action-button/index.js +22 -7
- package/dist/cjs/components/shared/action-button/index.js.map +1 -1
- package/dist/cjs/components/shared/action-button/style.scss +4 -0
- package/dist/cjs/components/shared/billing-timeframe/index.js +8 -4
- package/dist/cjs/components/shared/billing-timeframe/index.js.map +1 -1
- package/dist/cjs/components/shared/header-price/index.js +60 -15
- package/dist/cjs/components/shared/header-price/index.js.map +1 -1
- package/dist/cjs/components/shared/header-price/style.scss +10 -2
- package/dist/cjs/components/shared/storage/components/plan-storage.js +2 -2
- package/dist/cjs/components/shared/storage/components/plan-storage.js.map +1 -1
- package/dist/cjs/components/shared/storage/components/storage-dropdown.js +29 -6
- package/dist/cjs/components/shared/storage/components/storage-dropdown.js.map +1 -1
- package/dist/cjs/components/shared/storage/components/storage-feature-label.js +2 -1
- package/dist/cjs/components/shared/storage/components/storage-feature-label.js.map +1 -1
- package/dist/cjs/components/shared/storage/hooks/use-plan-storage.js +2 -0
- package/dist/cjs/components/shared/storage/hooks/use-plan-storage.js.map +1 -1
- package/dist/cjs/fixtures/sites-purchases.js +2 -4
- package/dist/cjs/fixtures/sites-purchases.js.map +1 -1
- package/dist/cjs/grid-context.js +4 -1
- package/dist/cjs/grid-context.js.map +1 -1
- package/dist/cjs/hooks/data-store/get-renewal-pricing-text.js +50 -0
- package/dist/cjs/hooks/data-store/get-renewal-pricing-text.js.map +1 -0
- package/dist/cjs/hooks/data-store/use-grid-plans-for-comparison-grid.js +6 -1
- package/dist/cjs/hooks/data-store/use-grid-plans-for-comparison-grid.js.map +1 -1
- package/dist/cjs/hooks/data-store/use-grid-plans-for-features-grid.js +6 -1
- package/dist/cjs/hooks/data-store/use-grid-plans-for-features-grid.js.map +1 -1
- package/dist/cjs/hooks/data-store/use-grid-plans.js +175 -21
- package/dist/cjs/hooks/data-store/use-grid-plans.js.map +1 -1
- package/dist/cjs/hooks/data-store/use-highlight-labels.js +13 -4
- package/dist/cjs/hooks/data-store/use-highlight-labels.js.map +1 -1
- package/dist/cjs/hooks/data-store/use-plan-billing-description.js +68 -13
- package/dist/cjs/hooks/data-store/use-plan-billing-description.js.map +1 -1
- package/dist/cjs/hooks/data-store/use-plan-billing-period.js +14 -0
- package/dist/cjs/hooks/data-store/use-plan-billing-period.js.map +1 -0
- package/dist/cjs/hooks/data-store/use-plan-features-for-grid-plans.js +76 -2
- package/dist/cjs/hooks/data-store/use-plan-features-for-grid-plans.js.map +1 -1
- package/dist/cjs/hooks/data-store/use-restructured-plan-features-for-comparison-grid.js +60 -12
- package/dist/cjs/hooks/data-store/use-restructured-plan-features-for-comparison-grid.js.map +1 -1
- package/dist/cjs/hooks/data-store/use-title-badges.js +19 -0
- package/dist/cjs/hooks/data-store/use-title-badges.js.map +1 -0
- package/dist/cjs/hooks/use-grid-size.js.map +1 -1
- package/dist/cjs/hooks/use-is-large-currency.js +2 -2
- package/dist/cjs/hooks/use-is-large-currency.js.map +1 -1
- package/dist/cjs/hooks/use-visible-grid-plans.js +70 -0
- package/dist/cjs/hooks/use-visible-grid-plans.js.map +1 -0
- package/dist/cjs/index.js +8 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/get-plan-features-object.js +15 -2
- package/dist/cjs/lib/get-plan-features-object.js.map +1 -1
- package/dist/cjs/lib/plan-pricing-utils.js +135 -0
- package/dist/cjs/lib/plan-pricing-utils.js.map +1 -0
- package/dist/esm/_shared.scss +4 -3
- package/dist/esm/components/comparison-grid/index.js +102 -72
- package/dist/esm/components/comparison-grid/index.js.map +1 -1
- package/dist/esm/components/comparison-grid/index.stories.js.map +1 -1
- package/dist/esm/components/comparison-grid/style.scss +10 -2
- package/dist/esm/components/features-grid/client-logo-list/client-list.js +0 -12
- package/dist/esm/components/features-grid/client-logo-list/client-list.js.map +1 -1
- package/dist/esm/components/features-grid/index.js +9 -6
- package/dist/esm/components/features-grid/index.js.map +1 -1
- package/dist/esm/components/features-grid/plan-features-list.js +10 -3
- package/dist/esm/components/features-grid/plan-features-list.js.map +1 -1
- package/dist/esm/components/features-grid/plan-headers.js +3 -3
- package/dist/esm/components/features-grid/plan-headers.js.map +1 -1
- package/dist/esm/components/features-grid/plan-tagline.js +1 -1
- package/dist/esm/components/features-grid/plan-tagline.js.map +1 -1
- package/dist/esm/components/features-grid/style.scss +111 -21
- package/dist/esm/components/features-grid/table.js +1 -1
- package/dist/esm/components/features-grid/table.js.map +1 -1
- package/dist/esm/components/features.js +44 -5
- package/dist/esm/components/features.js.map +1 -1
- package/dist/esm/components/item.js +1 -1
- package/dist/esm/components/item.js.map +1 -1
- package/dist/esm/components/plan-button/index.js +5 -3
- package/dist/esm/components/plan-button/index.js.map +1 -1
- package/dist/esm/components/plan-button/style.scss +71 -47
- package/dist/esm/components/plan-div-td-container.js +4 -1
- package/dist/esm/components/plan-div-td-container.js.map +1 -1
- package/dist/esm/components/plan-logo.js +7 -4
- package/dist/esm/components/plan-logo.js.map +1 -1
- package/dist/esm/components/plan-type-selector/components/interval-type-dropdown.js +12 -1
- package/dist/esm/components/plan-type-selector/components/interval-type-dropdown.js.map +1 -1
- package/dist/esm/components/plan-type-selector/hooks/use-max-discount.js +3 -33
- package/dist/esm/components/plan-type-selector/hooks/use-max-discount.js.map +1 -1
- package/dist/esm/components/plan-type-selector/hooks/use-max-discounts-for-plan-terms.js +11 -13
- package/dist/esm/components/plan-type-selector/hooks/use-max-discounts-for-plan-terms.js.map +1 -1
- package/dist/esm/components/plans-2023-tooltip.js +16 -5
- package/dist/esm/components/plans-2023-tooltip.js.map +1 -1
- package/dist/esm/components/shared/action-button/index.js +22 -7
- package/dist/esm/components/shared/action-button/index.js.map +1 -1
- package/dist/esm/components/shared/action-button/style.scss +4 -0
- package/dist/esm/components/shared/billing-timeframe/index.js +8 -4
- package/dist/esm/components/shared/billing-timeframe/index.js.map +1 -1
- package/dist/esm/components/shared/header-price/index.js +60 -15
- package/dist/esm/components/shared/header-price/index.js.map +1 -1
- package/dist/esm/components/shared/header-price/style.scss +10 -2
- package/dist/esm/components/shared/storage/components/plan-storage.js +2 -2
- package/dist/esm/components/shared/storage/components/plan-storage.js.map +1 -1
- package/dist/esm/components/shared/storage/components/storage-dropdown.js +30 -7
- package/dist/esm/components/shared/storage/components/storage-dropdown.js.map +1 -1
- package/dist/esm/components/shared/storage/components/storage-feature-label.js +2 -1
- package/dist/esm/components/shared/storage/components/storage-feature-label.js.map +1 -1
- package/dist/esm/components/shared/storage/hooks/use-plan-storage.js +3 -1
- package/dist/esm/components/shared/storage/hooks/use-plan-storage.js.map +1 -1
- package/dist/esm/fixtures/sites-purchases.js +2 -4
- package/dist/esm/fixtures/sites-purchases.js.map +1 -1
- package/dist/esm/grid-context.js +4 -1
- package/dist/esm/grid-context.js.map +1 -1
- package/dist/esm/hooks/data-store/get-renewal-pricing-text.js +47 -0
- package/dist/esm/hooks/data-store/get-renewal-pricing-text.js.map +1 -0
- package/dist/esm/hooks/data-store/use-grid-plans-for-comparison-grid.js +6 -1
- package/dist/esm/hooks/data-store/use-grid-plans-for-comparison-grid.js.map +1 -1
- package/dist/esm/hooks/data-store/use-grid-plans-for-features-grid.js +6 -1
- package/dist/esm/hooks/data-store/use-grid-plans-for-features-grid.js.map +1 -1
- package/dist/esm/hooks/data-store/use-grid-plans.js +176 -22
- package/dist/esm/hooks/data-store/use-grid-plans.js.map +1 -1
- package/dist/esm/hooks/data-store/use-highlight-labels.js +14 -5
- package/dist/esm/hooks/data-store/use-highlight-labels.js.map +1 -1
- package/dist/esm/hooks/data-store/use-plan-billing-description.js +66 -11
- package/dist/esm/hooks/data-store/use-plan-billing-description.js.map +1 -1
- package/dist/esm/hooks/data-store/use-plan-billing-period.js +12 -0
- package/dist/esm/hooks/data-store/use-plan-billing-period.js.map +1 -0
- package/dist/esm/hooks/data-store/use-plan-features-for-grid-plans.js +77 -3
- package/dist/esm/hooks/data-store/use-plan-features-for-grid-plans.js.map +1 -1
- package/dist/esm/hooks/data-store/use-restructured-plan-features-for-comparison-grid.js +59 -11
- package/dist/esm/hooks/data-store/use-restructured-plan-features-for-comparison-grid.js.map +1 -1
- package/dist/esm/hooks/data-store/use-title-badges.js +17 -0
- package/dist/esm/hooks/data-store/use-title-badges.js.map +1 -0
- package/dist/esm/hooks/use-grid-size.js.map +1 -1
- package/dist/esm/hooks/use-is-large-currency.js +1 -1
- package/dist/esm/hooks/use-is-large-currency.js.map +1 -1
- package/dist/esm/hooks/use-visible-grid-plans.js +66 -0
- package/dist/esm/hooks/use-visible-grid-plans.js.map +1 -0
- package/dist/esm/index.js +4 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/get-plan-features-object.js +15 -2
- package/dist/esm/lib/get-plan-features-object.js.map +1 -1
- package/dist/esm/lib/plan-pricing-utils.js +129 -0
- package/dist/esm/lib/plan-pricing-utils.js.map +1 -0
- package/dist/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/components/comparison-grid/index.d.ts +1 -1
- package/dist/types/components/comparison-grid/index.d.ts.map +1 -1
- package/dist/types/components/comparison-grid/index.stories.d.ts +2 -2
- package/dist/types/components/dropdown-option.d.ts.map +1 -1
- package/dist/types/components/features-grid/billing-timeframes.d.ts.map +1 -1
- package/dist/types/components/features-grid/client-logo-list/client-list.d.ts.map +1 -1
- package/dist/types/components/features-grid/client-logo-list/index.d.ts.map +1 -1
- package/dist/types/components/features-grid/enterprise-features.d.ts.map +1 -1
- package/dist/types/components/features-grid/index.d.ts.map +1 -1
- package/dist/types/components/features-grid/plan-features-list.d.ts.map +1 -1
- package/dist/types/components/features-grid/plan-headers.d.ts +2 -0
- package/dist/types/components/features-grid/plan-headers.d.ts.map +1 -1
- package/dist/types/components/features-grid/plan-logos.d.ts.map +1 -1
- package/dist/types/components/features-grid/plan-prices.d.ts.map +1 -1
- package/dist/types/components/features-grid/plan-tagline.d.ts.map +1 -1
- package/dist/types/components/features-grid/previous-features-included-title.d.ts.map +1 -1
- package/dist/types/components/features-grid/spotlight-plan.d.ts.map +1 -1
- package/dist/types/components/features-grid/table.d.ts.map +1 -1
- package/dist/types/components/features-grid/top-buttons.d.ts.map +1 -1
- package/dist/types/components/features.d.ts.map +1 -1
- package/dist/types/components/item.d.ts +2 -1
- package/dist/types/components/item.d.ts.map +1 -1
- package/dist/types/components/plan-button/index.d.ts +2 -1
- package/dist/types/components/plan-button/index.d.ts.map +1 -1
- package/dist/types/components/plan-div-td-container.d.ts +2 -0
- package/dist/types/components/plan-div-td-container.d.ts.map +1 -1
- package/dist/types/components/plan-logo.d.ts.map +1 -1
- package/dist/types/components/plan-type-selector/components/interval-type-dropdown.d.ts.map +1 -1
- package/dist/types/components/plan-type-selector/hooks/use-max-discount.d.ts.map +1 -1
- package/dist/types/components/plan-type-selector/hooks/use-max-discounts-for-plan-terms.d.ts.map +1 -1
- package/dist/types/components/plans-2023-tooltip.d.ts.map +1 -1
- package/dist/types/components/shared/action-button/index.d.ts +2 -1
- package/dist/types/components/shared/action-button/index.d.ts.map +1 -1
- package/dist/types/components/shared/billing-timeframe/index.d.ts.map +1 -1
- package/dist/types/components/shared/header-price/header-price-context.d.ts.map +1 -1
- package/dist/types/components/shared/header-price/index.d.ts.map +1 -1
- package/dist/types/components/shared/storage/components/plan-storage.d.ts.map +1 -1
- package/dist/types/components/shared/storage/components/storage-dropdown.d.ts.map +1 -1
- package/dist/types/components/shared/storage/components/storage-feature-label.d.ts.map +1 -1
- package/dist/types/components/shared/storage/hooks/use-plan-storage.d.ts +1 -1
- package/dist/types/components/shared/storage/hooks/use-plan-storage.d.ts.map +1 -1
- package/dist/types/css-mixins.d.ts.map +1 -1
- package/dist/types/fixtures/sites-purchases.d.ts +2 -4
- package/dist/types/fixtures/sites-purchases.d.ts.map +1 -1
- package/dist/types/grid-context.d.ts +4 -1
- package/dist/types/grid-context.d.ts.map +1 -1
- package/dist/types/hooks/data-store/get-renewal-pricing-text.d.ts +14 -0
- package/dist/types/hooks/data-store/get-renewal-pricing-text.d.ts.map +1 -0
- package/dist/types/hooks/data-store/types.d.ts +21 -0
- package/dist/types/hooks/data-store/types.d.ts.map +1 -1
- package/dist/types/hooks/data-store/use-grid-plan-for-spotlight.d.ts.map +1 -1
- package/dist/types/hooks/data-store/use-grid-plans-for-comparison-grid.d.ts +1 -1
- package/dist/types/hooks/data-store/use-grid-plans-for-comparison-grid.d.ts.map +1 -1
- package/dist/types/hooks/data-store/use-grid-plans-for-features-grid.d.ts +1 -1
- package/dist/types/hooks/data-store/use-grid-plans-for-features-grid.d.ts.map +1 -1
- package/dist/types/hooks/data-store/use-grid-plans.d.ts.map +1 -1
- package/dist/types/hooks/data-store/use-highlight-labels.d.ts.map +1 -1
- package/dist/types/hooks/data-store/use-plan-billing-description.d.ts.map +1 -1
- package/dist/types/hooks/data-store/use-plan-billing-period.d.ts +8 -0
- package/dist/types/hooks/data-store/use-plan-billing-period.d.ts.map +1 -0
- package/dist/types/hooks/data-store/use-plan-features-for-grid-plans.d.ts +4 -1
- package/dist/types/hooks/data-store/use-plan-features-for-grid-plans.d.ts.map +1 -1
- package/dist/types/hooks/data-store/use-plans-from-types.d.ts.map +1 -1
- package/dist/types/hooks/data-store/use-restructured-plan-features-for-comparison-grid.d.ts +4 -1
- package/dist/types/hooks/data-store/use-restructured-plan-features-for-comparison-grid.d.ts.map +1 -1
- package/dist/types/hooks/data-store/use-title-badges.d.ts +9 -0
- package/dist/types/hooks/data-store/use-title-badges.d.ts.map +1 -0
- package/dist/types/hooks/use-grid-size.d.ts +3 -2
- package/dist/types/hooks/use-grid-size.d.ts.map +1 -1
- package/dist/types/hooks/use-highlight-adjacency-matrix.d.ts.map +1 -1
- package/dist/types/hooks/use-visible-grid-plans.d.ts +14 -0
- package/dist/types/hooks/use-visible-grid-plans.d.ts.map +1 -0
- package/dist/types/index.d.ts +9 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/filter-unused-features-object.d.ts.map +1 -1
- package/dist/types/lib/get-plan-features-object.d.ts +1 -1
- package/dist/types/lib/get-plan-features-object.d.ts.map +1 -1
- package/dist/types/lib/plan-pricing-utils.d.ts +105 -0
- package/dist/types/lib/plan-pricing-utils.d.ts.map +1 -0
- package/dist/types/types.d.ts +33 -6
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +39 -28
- package/src/_shared.scss +4 -3
- package/src/components/comparison-grid/index.stories.tsx +1 -1
- package/src/components/comparison-grid/index.tsx +263 -158
- package/src/components/comparison-grid/style.scss +10 -2
- package/src/components/features-grid/client-logo-list/client-list.tsx +0 -25
- package/src/components/features-grid/index.tsx +37 -19
- package/src/components/features-grid/plan-features-list.tsx +15 -4
- package/src/components/features-grid/plan-headers.tsx +10 -3
- package/src/components/features-grid/plan-tagline.tsx +1 -1
- package/src/components/features-grid/style.scss +111 -21
- package/src/components/features-grid/table.tsx +4 -2
- package/src/components/features.tsx +66 -6
- package/src/components/item.tsx +6 -3
- package/src/components/plan-button/index.tsx +7 -1
- package/src/components/plan-button/style.scss +71 -47
- package/src/components/plan-div-td-container.tsx +6 -2
- package/src/components/plan-logo.tsx +16 -9
- package/src/components/plan-type-selector/components/interval-type-dropdown.tsx +14 -1
- package/src/components/plan-type-selector/hooks/use-max-discount.ts +8 -47
- package/src/components/plan-type-selector/hooks/use-max-discounts-for-plan-terms.ts +19 -17
- package/src/components/plans-2023-tooltip.tsx +17 -5
- package/src/components/shared/action-button/index.tsx +46 -5
- package/src/components/shared/action-button/style.scss +4 -0
- package/src/components/shared/billing-timeframe/index.tsx +12 -7
- package/src/components/shared/header-price/index.tsx +129 -27
- package/src/components/shared/header-price/style.scss +10 -2
- package/src/components/shared/storage/components/plan-storage.tsx +2 -2
- package/src/components/shared/storage/components/storage-dropdown.tsx +36 -15
- package/src/components/shared/storage/components/storage-feature-label.tsx +2 -1
- package/src/components/shared/storage/hooks/use-plan-storage.ts +3 -0
- package/src/components/test/actions-button.tsx +5 -0
- package/src/components/test/billing-timeframe.tsx +1 -1
- package/src/components/test/header-price.tsx +342 -4
- package/src/fixtures/sites-purchases.ts +2 -4
- package/src/grid-context.tsx +9 -0
- package/src/hooks/data-store/get-renewal-pricing-text.ts +73 -0
- package/src/hooks/data-store/types.ts +21 -0
- package/src/hooks/data-store/use-grid-plans-for-comparison-grid.ts +10 -0
- package/src/hooks/data-store/use-grid-plans-for-features-grid.ts +10 -0
- package/src/hooks/data-store/use-grid-plans.tsx +189 -23
- package/src/hooks/data-store/use-highlight-labels.ts +12 -3
- package/src/hooks/data-store/use-plan-billing-description.tsx +80 -15
- package/src/hooks/data-store/use-plan-billing-period.tsx +28 -0
- package/src/hooks/data-store/use-plan-features-for-grid-plans.ts +135 -1
- package/src/hooks/data-store/use-restructured-plan-features-for-comparison-grid.ts +93 -20
- package/src/hooks/data-store/use-title-badges.ts +31 -0
- package/src/hooks/test/use-visible-grid-plans.tsx +116 -0
- package/src/hooks/use-grid-size.ts +3 -2
- package/src/hooks/use-is-large-currency.ts +1 -1
- package/src/hooks/use-visible-grid-plans.tsx +102 -0
- package/src/index.tsx +20 -0
- package/src/lib/get-plan-features-object.ts +23 -2
- package/src/lib/plan-pricing-utils.ts +211 -0
- package/src/lib/test/plan-pricing-utils.ts +594 -0
- package/src/style-imports.d.ts +3 -0
- package/src/types.ts +45 -4
- package/dist/cjs/components/features-grid/mobile-free-domain.js +0 -25
- package/dist/cjs/components/features-grid/mobile-free-domain.js.map +0 -1
- package/dist/cjs/lib/get-plan-pricing-info-from-grid-plans.js +0 -15
- package/dist/cjs/lib/get-plan-pricing-info-from-grid-plans.js.map +0 -1
- package/dist/cjs/lib/sort-plan-properties.js +0 -26
- package/dist/cjs/lib/sort-plan-properties.js.map +0 -1
- package/dist/esm/components/features-grid/mobile-free-domain.js +0 -23
- package/dist/esm/components/features-grid/mobile-free-domain.js.map +0 -1
- package/dist/esm/lib/get-plan-pricing-info-from-grid-plans.js +0 -12
- package/dist/esm/lib/get-plan-pricing-info-from-grid-plans.js.map +0 -1
- package/dist/esm/lib/sort-plan-properties.js +0 -23
- package/dist/esm/lib/sort-plan-properties.js.map +0 -1
- package/dist/types/components/features-grid/mobile-free-domain.d.ts +0 -8
- package/dist/types/components/features-grid/mobile-free-domain.d.ts.map +0 -1
- package/dist/types/lib/get-plan-pricing-info-from-grid-plans.d.ts +0 -9
- package/dist/types/lib/get-plan-pricing-info-from-grid-plans.d.ts.map +0 -1
- package/dist/types/lib/sort-plan-properties.d.ts +0 -3
- package/dist/types/lib/sort-plan-properties.d.ts.map +0 -1
- package/src/components/features-grid/mobile-free-domain.tsx +0 -51
- package/src/lib/get-plan-pricing-info-from-grid-plans.ts +0 -31
- package/src/lib/sort-plan-properties.ts +0 -27
- package/src/lib/test/sort-plan-properties.ts +0 -122
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Default mock implementations
|
|
6
6
|
*/
|
|
7
|
+
const mockUseHeaderPriceContext = jest.fn();
|
|
8
|
+
|
|
7
9
|
jest.mock( '@wordpress/element', () => ( {
|
|
8
10
|
...jest.requireActual( '@wordpress/element' ),
|
|
9
11
|
useCallback: jest.fn(),
|
|
@@ -24,10 +26,7 @@ jest.mock( '@automattic/data-stores', () => ( {
|
|
|
24
26
|
} ) );
|
|
25
27
|
|
|
26
28
|
jest.mock( '../shared/header-price/header-price-context', () => ( {
|
|
27
|
-
useHeaderPriceContext: () => (
|
|
28
|
-
isAnyPlanPriceDiscounted: false,
|
|
29
|
-
setIsAnyPlanPriceDiscounted: jest.fn(),
|
|
30
|
-
} ),
|
|
29
|
+
useHeaderPriceContext: () => mockUseHeaderPriceContext(),
|
|
31
30
|
} ) );
|
|
32
31
|
|
|
33
32
|
import {
|
|
@@ -35,11 +34,14 @@ import {
|
|
|
35
34
|
PLAN_ANNUAL_PERIOD,
|
|
36
35
|
PLAN_ENTERPRISE_GRID_WPCOM,
|
|
37
36
|
PLAN_PERSONAL,
|
|
37
|
+
PLAN_PERSONAL_MONTHLY,
|
|
38
38
|
} from '@automattic/calypso-products';
|
|
39
|
+
import { Plans } from '@automattic/data-stores';
|
|
39
40
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
40
41
|
import { render } from '@testing-library/react';
|
|
41
42
|
import React, { useMemo } from 'react';
|
|
42
43
|
import { usePlansGridContext } from '../../grid-context';
|
|
44
|
+
import { GridPlan } from '../../types';
|
|
43
45
|
import HeaderPrice from '../shared/header-price';
|
|
44
46
|
|
|
45
47
|
const Wrapper = ( { children } ) => {
|
|
@@ -57,6 +59,11 @@ describe( 'HeaderPrice', () => {
|
|
|
57
59
|
|
|
58
60
|
beforeEach( () => {
|
|
59
61
|
jest.clearAllMocks();
|
|
62
|
+
mockUseHeaderPriceContext.mockReturnValue( {
|
|
63
|
+
isAnyPlanPriceDiscounted: false,
|
|
64
|
+
setIsAnyPlanPriceDiscounted: jest.fn(),
|
|
65
|
+
} );
|
|
66
|
+
( Plans.usePricingMetaForGridPlans as jest.Mock ).mockReturnValue( {} );
|
|
60
67
|
} );
|
|
61
68
|
|
|
62
69
|
test( 'should render raw and discounted prices when discount exists', () => {
|
|
@@ -186,4 +193,335 @@ describe( 'HeaderPrice', () => {
|
|
|
186
193
|
|
|
187
194
|
expect( badge ).toHaveTextContent( 'One time discount' );
|
|
188
195
|
} );
|
|
196
|
+
|
|
197
|
+
test( 'should display "Save x%" badge in renewal experiment for downgraded-site style pricing', () => {
|
|
198
|
+
const pricing = {
|
|
199
|
+
currencyCode: 'USD',
|
|
200
|
+
originalPrice: { full: 120, monthly: 10 },
|
|
201
|
+
discountedPrice: { full: null, monthly: null },
|
|
202
|
+
billingPeriod: PLAN_ANNUAL_PERIOD,
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
mockUseHeaderPriceContext.mockReturnValue( {
|
|
206
|
+
isAnyPlanPriceDiscounted: true,
|
|
207
|
+
setIsAnyPlanPriceDiscounted: jest.fn(),
|
|
208
|
+
} );
|
|
209
|
+
( Plans.usePricingMetaForGridPlans as jest.Mock ).mockReturnValue( {
|
|
210
|
+
[ PLAN_PERSONAL_MONTHLY ]: {
|
|
211
|
+
originalPrice: { monthly: 20, full: 240 },
|
|
212
|
+
discountedPrice: { monthly: null, full: null },
|
|
213
|
+
billingPeriod: 31,
|
|
214
|
+
},
|
|
215
|
+
} );
|
|
216
|
+
|
|
217
|
+
usePlansGridContext.mockImplementation( () => ( {
|
|
218
|
+
gridPlansIndex: {
|
|
219
|
+
[ PLAN_PERSONAL ]: {
|
|
220
|
+
current: false,
|
|
221
|
+
isMonthlyPlan: true,
|
|
222
|
+
pricing,
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
showBillingDescriptionForIncreasedRenewalPrice: 'crossed_price',
|
|
226
|
+
} ) );
|
|
227
|
+
|
|
228
|
+
const { container } = render( <HeaderPrice { ...defaultProps } />, { wrapper: Wrapper } );
|
|
229
|
+
const badge = container.querySelector( '.plans-grid-next-header-price__badge' );
|
|
230
|
+
|
|
231
|
+
expect( badge ).toHaveTextContent( 'Save 50%' );
|
|
232
|
+
} );
|
|
233
|
+
|
|
234
|
+
test( 'should show the monthly plan price crossed out and the annual monthly-equivalent as the current price', () => {
|
|
235
|
+
const pricing = {
|
|
236
|
+
currencyCode: 'USD',
|
|
237
|
+
originalPrice: { full: 120, monthly: 10 },
|
|
238
|
+
discountedPrice: { full: null, monthly: null },
|
|
239
|
+
billingPeriod: PLAN_ANNUAL_PERIOD,
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
mockUseHeaderPriceContext.mockReturnValue( {
|
|
243
|
+
isAnyPlanPriceDiscounted: true,
|
|
244
|
+
setIsAnyPlanPriceDiscounted: jest.fn(),
|
|
245
|
+
} );
|
|
246
|
+
( Plans.usePricingMetaForGridPlans as jest.Mock ).mockReturnValue( {
|
|
247
|
+
[ PLAN_PERSONAL_MONTHLY ]: {
|
|
248
|
+
originalPrice: { monthly: 20, full: 240 },
|
|
249
|
+
discountedPrice: { monthly: null, full: null },
|
|
250
|
+
},
|
|
251
|
+
} );
|
|
252
|
+
|
|
253
|
+
usePlansGridContext.mockImplementation( () => ( {
|
|
254
|
+
gridPlansIndex: {
|
|
255
|
+
[ PLAN_PERSONAL ]: {
|
|
256
|
+
current: false,
|
|
257
|
+
isMonthlyPlan: false,
|
|
258
|
+
pricing,
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
showBillingDescriptionForIncreasedRenewalPrice: 'crossed_price',
|
|
262
|
+
} ) );
|
|
263
|
+
|
|
264
|
+
const { container } = render( <HeaderPrice { ...defaultProps } />, { wrapper: Wrapper } );
|
|
265
|
+
const originalPrice = container.querySelector( '.plan-price.is-original' );
|
|
266
|
+
const discountedPrice = container.querySelector( '.plan-price.is-discounted' );
|
|
267
|
+
|
|
268
|
+
expect( originalPrice ).toHaveTextContent( '20' );
|
|
269
|
+
expect( discountedPrice ).toHaveTextContent( '10' );
|
|
270
|
+
} );
|
|
271
|
+
|
|
272
|
+
test( 'should not show a badge when the plan is the current plan', () => {
|
|
273
|
+
const pricing = {
|
|
274
|
+
currencyCode: 'USD',
|
|
275
|
+
originalPrice: { full: 120, monthly: 10 },
|
|
276
|
+
discountedPrice: { full: null, monthly: null },
|
|
277
|
+
billingPeriod: PLAN_ANNUAL_PERIOD,
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
mockUseHeaderPriceContext.mockReturnValue( {
|
|
281
|
+
isAnyPlanPriceDiscounted: true,
|
|
282
|
+
setIsAnyPlanPriceDiscounted: jest.fn(),
|
|
283
|
+
} );
|
|
284
|
+
( Plans.usePricingMetaForGridPlans as jest.Mock ).mockReturnValue( {
|
|
285
|
+
[ PLAN_PERSONAL_MONTHLY ]: {
|
|
286
|
+
originalPrice: { monthly: 20, full: 240 },
|
|
287
|
+
discountedPrice: { monthly: null, full: null },
|
|
288
|
+
},
|
|
289
|
+
} );
|
|
290
|
+
|
|
291
|
+
usePlansGridContext.mockImplementation( () => ( {
|
|
292
|
+
gridPlansIndex: {
|
|
293
|
+
[ PLAN_PERSONAL ]: {
|
|
294
|
+
current: true,
|
|
295
|
+
isMonthlyPlan: false,
|
|
296
|
+
pricing,
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
showBillingDescriptionForIncreasedRenewalPrice: 'crossed_price',
|
|
300
|
+
} ) );
|
|
301
|
+
|
|
302
|
+
const { container } = render( <HeaderPrice { ...defaultProps } />, { wrapper: Wrapper } );
|
|
303
|
+
const badge = container.querySelector( '.plans-grid-next-header-price__badge' );
|
|
304
|
+
|
|
305
|
+
expect( badge ).toBeNull();
|
|
306
|
+
} );
|
|
307
|
+
|
|
308
|
+
test( 'should not show the crossed-out price when monthly plan price does not exceed the annual price', () => {
|
|
309
|
+
const pricing = {
|
|
310
|
+
currencyCode: 'USD',
|
|
311
|
+
originalPrice: { full: 120, monthly: 10 },
|
|
312
|
+
discountedPrice: { full: null, monthly: null },
|
|
313
|
+
billingPeriod: PLAN_ANNUAL_PERIOD,
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
mockUseHeaderPriceContext.mockReturnValue( {
|
|
317
|
+
isAnyPlanPriceDiscounted: true,
|
|
318
|
+
setIsAnyPlanPriceDiscounted: jest.fn(),
|
|
319
|
+
} );
|
|
320
|
+
( Plans.usePricingMetaForGridPlans as jest.Mock ).mockReturnValue( {
|
|
321
|
+
[ PLAN_PERSONAL_MONTHLY ]: {
|
|
322
|
+
originalPrice: { monthly: 10, full: 120 },
|
|
323
|
+
discountedPrice: { monthly: null, full: null },
|
|
324
|
+
},
|
|
325
|
+
} );
|
|
326
|
+
|
|
327
|
+
usePlansGridContext.mockImplementation( () => ( {
|
|
328
|
+
gridPlansIndex: {
|
|
329
|
+
[ PLAN_PERSONAL ]: {
|
|
330
|
+
current: false,
|
|
331
|
+
isMonthlyPlan: false,
|
|
332
|
+
pricing,
|
|
333
|
+
},
|
|
334
|
+
},
|
|
335
|
+
showBillingDescriptionForIncreasedRenewalPrice: 'crossed_price',
|
|
336
|
+
} ) );
|
|
337
|
+
|
|
338
|
+
const { container } = render( <HeaderPrice { ...defaultProps } />, { wrapper: Wrapper } );
|
|
339
|
+
const originalPrice = container.querySelector( '.plan-price.is-original' );
|
|
340
|
+
|
|
341
|
+
expect( originalPrice ).toBeNull();
|
|
342
|
+
} );
|
|
343
|
+
|
|
344
|
+
test( 'should use the monthly plan price as the crossed-out price when intro offer and experiment are both active', () => {
|
|
345
|
+
const pricing = {
|
|
346
|
+
currencyCode: 'USD',
|
|
347
|
+
originalPrice: { full: 120, monthly: 10 },
|
|
348
|
+
discountedPrice: { full: null, monthly: null },
|
|
349
|
+
billingPeriod: PLAN_ANNUAL_PERIOD,
|
|
350
|
+
introOffer: {
|
|
351
|
+
formattedPrice: '$5.00',
|
|
352
|
+
rawPrice: { monthly: 5, full: 60 },
|
|
353
|
+
intervalUnit: 'month',
|
|
354
|
+
intervalCount: 1,
|
|
355
|
+
isOfferComplete: false,
|
|
356
|
+
},
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
mockUseHeaderPriceContext.mockReturnValue( {
|
|
360
|
+
isAnyPlanPriceDiscounted: true,
|
|
361
|
+
setIsAnyPlanPriceDiscounted: jest.fn(),
|
|
362
|
+
} );
|
|
363
|
+
( Plans.usePricingMetaForGridPlans as jest.Mock ).mockReturnValue( {
|
|
364
|
+
[ PLAN_PERSONAL_MONTHLY ]: {
|
|
365
|
+
originalPrice: { monthly: 20, full: 240 },
|
|
366
|
+
discountedPrice: { monthly: null, full: null },
|
|
367
|
+
},
|
|
368
|
+
} );
|
|
369
|
+
|
|
370
|
+
usePlansGridContext.mockImplementation( () => ( {
|
|
371
|
+
gridPlansIndex: {
|
|
372
|
+
[ PLAN_PERSONAL ]: {
|
|
373
|
+
current: false,
|
|
374
|
+
isMonthlyPlan: false,
|
|
375
|
+
pricing,
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
showBillingDescriptionForIncreasedRenewalPrice: 'crossed_price',
|
|
379
|
+
} ) );
|
|
380
|
+
|
|
381
|
+
const { container } = render( <HeaderPrice { ...defaultProps } />, { wrapper: Wrapper } );
|
|
382
|
+
const originalPrice = container.querySelector( '.plan-price.is-original' );
|
|
383
|
+
const discountedPrice = container.querySelector( '.plan-price.is-discounted' );
|
|
384
|
+
|
|
385
|
+
// Crossed-out price should be the monthly plan price (20), not the plan's own original price (10)
|
|
386
|
+
expect( originalPrice ).toHaveTextContent( '20' );
|
|
387
|
+
// Current price should be the intro offer price (5)
|
|
388
|
+
expect( discountedPrice ).toHaveTextContent( '5' );
|
|
389
|
+
} );
|
|
390
|
+
|
|
391
|
+
test( 'should show a hidden badge placeholder for current plan in crossed_price when multiple plans are visible', () => {
|
|
392
|
+
const pricing = {
|
|
393
|
+
currencyCode: 'USD',
|
|
394
|
+
originalPrice: { full: 120, monthly: 10 },
|
|
395
|
+
discountedPrice: { full: null, monthly: null },
|
|
396
|
+
billingPeriod: PLAN_ANNUAL_PERIOD,
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
mockUseHeaderPriceContext.mockReturnValue( {
|
|
400
|
+
isAnyPlanPriceDiscounted: true,
|
|
401
|
+
setIsAnyPlanPriceDiscounted: jest.fn(),
|
|
402
|
+
} );
|
|
403
|
+
( Plans.usePricingMetaForGridPlans as jest.Mock ).mockReturnValue( {
|
|
404
|
+
[ PLAN_PERSONAL_MONTHLY ]: {
|
|
405
|
+
originalPrice: { monthly: 20, full: 240 },
|
|
406
|
+
discountedPrice: { monthly: null, full: null },
|
|
407
|
+
},
|
|
408
|
+
} );
|
|
409
|
+
|
|
410
|
+
usePlansGridContext.mockImplementation( () => ( {
|
|
411
|
+
gridPlansIndex: {
|
|
412
|
+
[ PLAN_PERSONAL ]: {
|
|
413
|
+
current: true,
|
|
414
|
+
isMonthlyPlan: false,
|
|
415
|
+
pricing,
|
|
416
|
+
},
|
|
417
|
+
},
|
|
418
|
+
showBillingDescriptionForIncreasedRenewalPrice: 'crossed_price',
|
|
419
|
+
} ) );
|
|
420
|
+
|
|
421
|
+
const stubPlan = {
|
|
422
|
+
pricing: {
|
|
423
|
+
originalPrice: { full: 0, monthly: 0 },
|
|
424
|
+
discountedPrice: { full: null, monthly: null },
|
|
425
|
+
currencyCode: 'USD',
|
|
426
|
+
},
|
|
427
|
+
} as GridPlan;
|
|
428
|
+
|
|
429
|
+
const { container } = render(
|
|
430
|
+
<HeaderPrice { ...defaultProps } visibleGridPlans={ [ stubPlan, stubPlan ] } />,
|
|
431
|
+
{ wrapper: Wrapper }
|
|
432
|
+
);
|
|
433
|
+
const visibleBadge = container.querySelector(
|
|
434
|
+
'.plans-grid-next-header-price__badge:not(.is-hidden)'
|
|
435
|
+
);
|
|
436
|
+
const hiddenBadge = container.querySelector( '.plans-grid-next-header-price__badge.is-hidden' );
|
|
437
|
+
|
|
438
|
+
expect( visibleBadge ).toBeNull();
|
|
439
|
+
expect( hiddenBadge ).toBeInTheDocument();
|
|
440
|
+
} );
|
|
441
|
+
|
|
442
|
+
test( 'should show a hidden badge placeholder for current plan with intro offer when multiple plans are visible', () => {
|
|
443
|
+
const pricing = {
|
|
444
|
+
currencyCode: 'USD',
|
|
445
|
+
originalPrice: { full: 120, monthly: 10 },
|
|
446
|
+
discountedPrice: { full: null, monthly: null },
|
|
447
|
+
billingPeriod: PLAN_ANNUAL_PERIOD,
|
|
448
|
+
introOffer: {
|
|
449
|
+
formattedPrice: '$5.00',
|
|
450
|
+
rawPrice: { monthly: 5, full: 60 },
|
|
451
|
+
intervalUnit: 'month',
|
|
452
|
+
intervalCount: 1,
|
|
453
|
+
isOfferComplete: false,
|
|
454
|
+
},
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
usePlansGridContext.mockImplementation( () => ( {
|
|
458
|
+
gridPlansIndex: {
|
|
459
|
+
[ PLAN_PERSONAL ]: {
|
|
460
|
+
current: true,
|
|
461
|
+
isMonthlyPlan: false,
|
|
462
|
+
pricing,
|
|
463
|
+
},
|
|
464
|
+
},
|
|
465
|
+
} ) );
|
|
466
|
+
|
|
467
|
+
const stubPlan = {
|
|
468
|
+
pricing: {
|
|
469
|
+
originalPrice: { full: 0, monthly: 0 },
|
|
470
|
+
discountedPrice: { full: null, monthly: null },
|
|
471
|
+
currencyCode: 'USD',
|
|
472
|
+
},
|
|
473
|
+
} as GridPlan;
|
|
474
|
+
|
|
475
|
+
const { container } = render(
|
|
476
|
+
<HeaderPrice { ...defaultProps } visibleGridPlans={ [ stubPlan, stubPlan ] } />,
|
|
477
|
+
{ wrapper: Wrapper }
|
|
478
|
+
);
|
|
479
|
+
const visibleBadge = container.querySelector(
|
|
480
|
+
'.plans-grid-next-header-price__badge:not(.is-hidden)'
|
|
481
|
+
);
|
|
482
|
+
const hiddenBadge = container.querySelector( '.plans-grid-next-header-price__badge.is-hidden' );
|
|
483
|
+
|
|
484
|
+
expect( visibleBadge ).toBeNull();
|
|
485
|
+
expect( hiddenBadge ).toBeInTheDocument();
|
|
486
|
+
} );
|
|
487
|
+
|
|
488
|
+
test( 'should keep the fallback badge hidden in crossed_price when savings is zero', () => {
|
|
489
|
+
const pricing = {
|
|
490
|
+
currencyCode: 'USD',
|
|
491
|
+
originalPrice: { full: 120, monthly: 10 },
|
|
492
|
+
discountedPrice: { full: null, monthly: null },
|
|
493
|
+
billingPeriod: PLAN_ANNUAL_PERIOD,
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
mockUseHeaderPriceContext.mockReturnValue( {
|
|
497
|
+
isAnyPlanPriceDiscounted: true,
|
|
498
|
+
setIsAnyPlanPriceDiscounted: jest.fn(),
|
|
499
|
+
} );
|
|
500
|
+
( Plans.usePricingMetaForGridPlans as jest.Mock ).mockReturnValue( {
|
|
501
|
+
[ PLAN_PERSONAL_MONTHLY ]: {
|
|
502
|
+
originalPrice: { monthly: 10, full: 120 },
|
|
503
|
+
discountedPrice: { monthly: null, full: null },
|
|
504
|
+
},
|
|
505
|
+
} );
|
|
506
|
+
|
|
507
|
+
usePlansGridContext.mockImplementation( () => ( {
|
|
508
|
+
gridPlansIndex: {
|
|
509
|
+
[ PLAN_PERSONAL ]: {
|
|
510
|
+
current: false,
|
|
511
|
+
isMonthlyPlan: true,
|
|
512
|
+
pricing,
|
|
513
|
+
},
|
|
514
|
+
},
|
|
515
|
+
showBillingDescriptionForIncreasedRenewalPrice: 'crossed_price',
|
|
516
|
+
} ) );
|
|
517
|
+
|
|
518
|
+
const { container } = render( <HeaderPrice { ...defaultProps } />, { wrapper: Wrapper } );
|
|
519
|
+
const visibleBadge = container.querySelector(
|
|
520
|
+
'.plans-grid-next-header-price__badge:not(.is-hidden)'
|
|
521
|
+
);
|
|
522
|
+
const hiddenBadge = container.querySelector( '.plans-grid-next-header-price__badge.is-hidden' );
|
|
523
|
+
|
|
524
|
+
expect( visibleBadge ).toBeNull();
|
|
525
|
+
expect( hiddenBadge ).toBeInTheDocument();
|
|
526
|
+
} );
|
|
189
527
|
} );
|
|
@@ -6,7 +6,7 @@ export default [
|
|
|
6
6
|
product_id: '2451',
|
|
7
7
|
subscribed_date: '2024-05-01T00:53:22+00:00',
|
|
8
8
|
renew: '1',
|
|
9
|
-
|
|
9
|
+
is_auto_renew_enabled: true,
|
|
10
10
|
renew_date: '2025-05-01T00:00:00+00:00',
|
|
11
11
|
inactive_date: null,
|
|
12
12
|
active: '1',
|
|
@@ -15,8 +15,6 @@ export default [
|
|
|
15
15
|
most_recent_renew_date: '2024-05-01T00:53:21+00:00',
|
|
16
16
|
amount: 155.4,
|
|
17
17
|
expiry_date: '2025-05-01T00:00:00+00:00',
|
|
18
|
-
expiry_message: 'Renews on May 1, 2025',
|
|
19
|
-
expiry_sub_message: '',
|
|
20
18
|
expiry_status: 'active',
|
|
21
19
|
partner_name: null,
|
|
22
20
|
partner_slug: null,
|
|
@@ -124,7 +122,7 @@ export default [
|
|
|
124
122
|
payment_name: 'Test User',
|
|
125
123
|
payment_country_code: 'US',
|
|
126
124
|
payment_country_name: 'United States',
|
|
127
|
-
|
|
125
|
+
is_rechargeable: true,
|
|
128
126
|
payment_type: 'credit_card',
|
|
129
127
|
},
|
|
130
128
|
];
|
package/src/grid-context.tsx
CHANGED
|
@@ -31,6 +31,9 @@ interface PlansGridContext {
|
|
|
31
31
|
hideFeatureGroupTitles?: boolean;
|
|
32
32
|
enterpriseFeaturesList?: string[];
|
|
33
33
|
reflectStorageSelectionInPlanPrices?: boolean;
|
|
34
|
+
showSimplifiedBillingDescription?: boolean;
|
|
35
|
+
showBillingDescriptionForIncreasedRenewalPrice?: string | null;
|
|
36
|
+
isExperimentVariant?: boolean;
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
const PlansGridContext = createContext< PlansGridContext >( {} as PlansGridContext );
|
|
@@ -56,6 +59,9 @@ const PlansGridContextProvider = ( {
|
|
|
56
59
|
hideFeatureGroupTitles,
|
|
57
60
|
enterpriseFeaturesList,
|
|
58
61
|
reflectStorageSelectionInPlanPrices,
|
|
62
|
+
showSimplifiedBillingDescription,
|
|
63
|
+
showBillingDescriptionForIncreasedRenewalPrice,
|
|
64
|
+
isExperimentVariant,
|
|
59
65
|
}: GridContextProps ) => {
|
|
60
66
|
const gridPlansIndex = gridPlans.reduce(
|
|
61
67
|
( acc, gridPlan ) => ( {
|
|
@@ -90,6 +96,9 @@ const PlansGridContextProvider = ( {
|
|
|
90
96
|
hideFeatureGroupTitles,
|
|
91
97
|
enterpriseFeaturesList,
|
|
92
98
|
reflectStorageSelectionInPlanPrices,
|
|
99
|
+
showSimplifiedBillingDescription,
|
|
100
|
+
showBillingDescriptionForIncreasedRenewalPrice,
|
|
101
|
+
isExperimentVariant,
|
|
93
102
|
} }
|
|
94
103
|
>
|
|
95
104
|
{ children }
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PLAN_ANNUAL_PERIOD,
|
|
3
|
+
PLAN_BIENNIAL_PERIOD,
|
|
4
|
+
PLAN_MONTHLY_PERIOD,
|
|
5
|
+
PLAN_TRIENNIAL_PERIOD,
|
|
6
|
+
} from '@automattic/calypso-products';
|
|
7
|
+
import { formatCurrency } from '@automattic/number-formatters';
|
|
8
|
+
import type { Plans as PlansType } from '@automattic/data-stores';
|
|
9
|
+
import type { TranslateResult } from 'i18n-calypso';
|
|
10
|
+
|
|
11
|
+
interface GetRenewalPricingTextParams {
|
|
12
|
+
pricing: PlansType.PricingMetaForGridPlan;
|
|
13
|
+
showBillingDescriptionForIncreasedRenewalPrice: string | null | undefined;
|
|
14
|
+
translate: ( text: string, options?: any ) => TranslateResult;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Generates renewal pricing text based on the pricing variation.
|
|
19
|
+
* This is shared between use-plan-billing-description and use-renewal-pricing-post-button-text.
|
|
20
|
+
*/
|
|
21
|
+
export function getRenewalPricingText( {
|
|
22
|
+
pricing,
|
|
23
|
+
showBillingDescriptionForIncreasedRenewalPrice,
|
|
24
|
+
translate,
|
|
25
|
+
}: GetRenewalPricingTextParams ): TranslateResult | null {
|
|
26
|
+
const { currencyCode, discountedPrice, originalPrice, billingPeriod, introOffer, renewalPrice } =
|
|
27
|
+
pricing;
|
|
28
|
+
|
|
29
|
+
const monthlyPrice = renewalPrice?.monthly ?? originalPrice?.monthly;
|
|
30
|
+
// Use the discounted price before the intro offer price since the discount is applied on top of it.
|
|
31
|
+
const currentFullPrice =
|
|
32
|
+
discountedPrice?.full || introOffer?.rawPrice?.full || originalPrice?.full;
|
|
33
|
+
|
|
34
|
+
if ( ! monthlyPrice || ! currencyCode || ! currentFullPrice ) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if ( ! showBillingDescriptionForIncreasedRenewalPrice ) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const formattedMonthlyPrice = formatCurrency( monthlyPrice, currencyCode, {
|
|
43
|
+
stripZeros: true,
|
|
44
|
+
isSmallestUnit: true,
|
|
45
|
+
} );
|
|
46
|
+
|
|
47
|
+
if ( billingPeriod === PLAN_MONTHLY_PERIOD ) {
|
|
48
|
+
return translate( 'Auto-renews at %(price)s per month. Billed every month.', {
|
|
49
|
+
args: { price: formattedMonthlyPrice },
|
|
50
|
+
comment: '%(price)s is a formatted price like $10',
|
|
51
|
+
} );
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Determine the billing period in months
|
|
55
|
+
let billingMonths = 12; // default to annual
|
|
56
|
+
|
|
57
|
+
if ( billingPeriod === PLAN_BIENNIAL_PERIOD ) {
|
|
58
|
+
billingMonths = 24;
|
|
59
|
+
} else if ( billingPeriod === PLAN_TRIENNIAL_PERIOD ) {
|
|
60
|
+
billingMonths = 36;
|
|
61
|
+
} else if ( billingPeriod === PLAN_ANNUAL_PERIOD ) {
|
|
62
|
+
billingMonths = 12;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return translate( 'Auto-renews at %(price)s per month. Billed every %(months)s months.', {
|
|
66
|
+
args: {
|
|
67
|
+
price: formattedMonthlyPrice,
|
|
68
|
+
months: billingMonths,
|
|
69
|
+
},
|
|
70
|
+
comment:
|
|
71
|
+
'%(price)s is a formatted price like $10, %(months)s is the billing period in months (12, 24, or 36)',
|
|
72
|
+
} );
|
|
73
|
+
}
|
|
@@ -35,6 +35,27 @@ export interface UseGridPlansParams {
|
|
|
35
35
|
* calculating prices.
|
|
36
36
|
*/
|
|
37
37
|
reflectStorageSelectionInPlanPrices?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* When true, use the no-AI feature set for the rolled-out pricing differentiation cohort.
|
|
40
|
+
*/
|
|
41
|
+
useVar42NoAiFeatures?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* When true, show plan-scoped feature pills. AI-labeled pills are suppressed.
|
|
44
|
+
*/
|
|
45
|
+
showPricingDifferentiationFeaturePills?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* When true, use the focused_new_copy taglines for plan headers.
|
|
48
|
+
*/
|
|
49
|
+
useFocusedNewCopyTaglines?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* When true, use cohort feature lists and comparison grid copy.
|
|
52
|
+
*/
|
|
53
|
+
isExperimentVariant?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Renewal-pricing experiment flag, threaded to the pricing hook so the current
|
|
56
|
+
* plan's headline matches the renewal-vs-intro treatment.
|
|
57
|
+
*/
|
|
58
|
+
showBillingDescriptionForIncreasedRenewalPrice?: string | null;
|
|
38
59
|
}
|
|
39
60
|
|
|
40
61
|
export type UseGridPlansType = (
|
|
@@ -28,6 +28,11 @@ const useGridPlansForComparisonGrid = ( {
|
|
|
28
28
|
useFreeTrialPlanSlugs,
|
|
29
29
|
isDomainOnlySite,
|
|
30
30
|
reflectStorageSelectionInPlanPrices,
|
|
31
|
+
useVar42NoAiFeatures,
|
|
32
|
+
showPricingDifferentiationFeaturePills,
|
|
33
|
+
useFocusedNewCopyTaglines,
|
|
34
|
+
isExperimentVariant,
|
|
35
|
+
showBillingDescriptionForIncreasedRenewalPrice,
|
|
31
36
|
}: UseGridPlansParams ): GridPlan[] | null => {
|
|
32
37
|
const gridPlans = useGridPlans( {
|
|
33
38
|
allFeaturesList,
|
|
@@ -46,6 +51,8 @@ const useGridPlansForComparisonGrid = ( {
|
|
|
46
51
|
useFreeTrialPlanSlugs,
|
|
47
52
|
isDomainOnlySite,
|
|
48
53
|
reflectStorageSelectionInPlanPrices,
|
|
54
|
+
useFocusedNewCopyTaglines,
|
|
55
|
+
showBillingDescriptionForIncreasedRenewalPrice,
|
|
49
56
|
} );
|
|
50
57
|
|
|
51
58
|
const planFeaturesForComparisonGrid = useRestructuredPlanFeaturesForComparisonGrid( {
|
|
@@ -55,6 +62,9 @@ const useGridPlansForComparisonGrid = ( {
|
|
|
55
62
|
intent,
|
|
56
63
|
selectedFeature,
|
|
57
64
|
showLegacyStorageFeature,
|
|
65
|
+
useVar42NoAiFeatures,
|
|
66
|
+
showPricingDifferentiationFeaturePills,
|
|
67
|
+
isExperimentVariant,
|
|
58
68
|
} );
|
|
59
69
|
|
|
60
70
|
return useMemo( () => {
|
|
@@ -25,6 +25,11 @@ const useGridPlansForFeaturesGrid = ( {
|
|
|
25
25
|
highlightLabelOverrides,
|
|
26
26
|
isDomainOnlySite,
|
|
27
27
|
reflectStorageSelectionInPlanPrices,
|
|
28
|
+
useVar42NoAiFeatures,
|
|
29
|
+
showPricingDifferentiationFeaturePills,
|
|
30
|
+
useFocusedNewCopyTaglines,
|
|
31
|
+
isExperimentVariant,
|
|
32
|
+
showBillingDescriptionForIncreasedRenewalPrice,
|
|
28
33
|
}: UseGridPlansParams ): GridPlan[] | null => {
|
|
29
34
|
const gridPlans = useGridPlans( {
|
|
30
35
|
allFeaturesList,
|
|
@@ -45,6 +50,8 @@ const useGridPlansForFeaturesGrid = ( {
|
|
|
45
50
|
highlightLabelOverrides,
|
|
46
51
|
isDomainOnlySite,
|
|
47
52
|
reflectStorageSelectionInPlanPrices,
|
|
53
|
+
useFocusedNewCopyTaglines,
|
|
54
|
+
showBillingDescriptionForIncreasedRenewalPrice,
|
|
48
55
|
} );
|
|
49
56
|
|
|
50
57
|
const planFeaturesForFeaturesGrid = usePlanFeaturesForGridPlans( {
|
|
@@ -55,6 +62,9 @@ const useGridPlansForFeaturesGrid = ( {
|
|
|
55
62
|
isInSignup,
|
|
56
63
|
selectedFeature,
|
|
57
64
|
showLegacyStorageFeature,
|
|
65
|
+
useVar42NoAiFeatures,
|
|
66
|
+
showPricingDifferentiationFeaturePills,
|
|
67
|
+
isExperimentVariant,
|
|
58
68
|
} );
|
|
59
69
|
|
|
60
70
|
return useMemo( () => {
|