@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,50 @@
|
|
|
1
|
+
import { useEffect } from '@wordpress/element';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { StickyContainer } from '../sticky-container';
|
|
5
|
+
import { IntervalTypeSelector } from './components/interval-type-selector';
|
|
6
|
+
import type { PlanTypeSelectorProps } from '../../types';
|
|
7
|
+
|
|
8
|
+
import './style.scss';
|
|
9
|
+
|
|
10
|
+
const PlanTypeSelector: React.FunctionComponent< PlanTypeSelectorProps > = ( {
|
|
11
|
+
kind,
|
|
12
|
+
enableStickyBehavior = false,
|
|
13
|
+
layoutClassName,
|
|
14
|
+
stickyPlanTypeSelectorOffset = 0,
|
|
15
|
+
...props
|
|
16
|
+
} ) => {
|
|
17
|
+
useEffect( () => {
|
|
18
|
+
props.recordTracksEvent?.( 'calypso_plans_plan_type_selector_view', {
|
|
19
|
+
kind,
|
|
20
|
+
} );
|
|
21
|
+
}, [] );
|
|
22
|
+
|
|
23
|
+
if ( kind === 'interval' ) {
|
|
24
|
+
return (
|
|
25
|
+
<StickyContainer
|
|
26
|
+
stickyClass="is-sticky-plan-type-selector"
|
|
27
|
+
disabled={ ! enableStickyBehavior }
|
|
28
|
+
stickyOffset={ stickyPlanTypeSelectorOffset }
|
|
29
|
+
zIndex={ 2 }
|
|
30
|
+
>
|
|
31
|
+
{ () => (
|
|
32
|
+
<div className={ clsx( layoutClassName ) }>
|
|
33
|
+
<div className="plan-type-selector">
|
|
34
|
+
<IntervalTypeSelector { ...props } />
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
) }
|
|
38
|
+
</StickyContainer>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Allowance for other types of toggles that maybe based on other plan attributes such as customer types
|
|
43
|
+
* Eg: Customer type toggle https://github.com/Automattic/wp-calypso/pull/27125
|
|
44
|
+
* Potential for a cleanup if such a dynamic is not required and plan type selector will always be based on time intervals, i.e. YAGNI.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
return null;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default PlanTypeSelector;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
@import "../../media-queries";
|
|
2
|
+
|
|
3
|
+
.plan-type-selector {
|
|
4
|
+
width: fit-content;
|
|
5
|
+
min-width: 275px;
|
|
6
|
+
background-color: var(--studio-white);
|
|
7
|
+
z-index: 2;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.is-sticky-plan-type-selector {
|
|
11
|
+
.plan-type-selector {
|
|
12
|
+
@include plan-type-selector-custom-mobile-breakpoint {
|
|
13
|
+
width: 100%;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.plan-type-selector__title {
|
|
19
|
+
margin-bottom: 20px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.plan-type-selector .plan-type-selector__interval-type {
|
|
23
|
+
width: fit-content;
|
|
24
|
+
margin: 0 auto;
|
|
25
|
+
.is-sticky-header-row & {
|
|
26
|
+
margin: unset;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.segmented-control.price-toggle {
|
|
30
|
+
background-color: #f2f2f2;
|
|
31
|
+
border-radius: 6px; /* stylelint-disable-line scales/radii */
|
|
32
|
+
margin-top: 16px;
|
|
33
|
+
margin-top: 0;
|
|
34
|
+
|
|
35
|
+
.segmented-control__item {
|
|
36
|
+
border: 6px;
|
|
37
|
+
padding: 2px;
|
|
38
|
+
|
|
39
|
+
&.is-selected + .segmented-control__item .segmented-control__link {
|
|
40
|
+
border-left-color: #f2f2f2;
|
|
41
|
+
&:hover {
|
|
42
|
+
border-left-color: var(--studio-gray-10);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.segmented-control__link {
|
|
47
|
+
color: var(--studio-gray-90);
|
|
48
|
+
font-weight: 500;
|
|
49
|
+
padding: 6px 11px;
|
|
50
|
+
border: 1px solid #f2f2f2;
|
|
51
|
+
border-radius: 5px; /* stylelint-disable-line scales/radii */
|
|
52
|
+
&:hover {
|
|
53
|
+
border: 1px solid var(--studio-gray-10);
|
|
54
|
+
background-color: unset;
|
|
55
|
+
border-radius: 5px; /* stylelint-disable-line scales/radii */
|
|
56
|
+
}
|
|
57
|
+
&:focus {
|
|
58
|
+
box-shadow: 0 0 0 1px var(--studio-gray-90);
|
|
59
|
+
outline: none;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&.is-selected .segmented-control__link {
|
|
64
|
+
color: var(--studio-gray-80);
|
|
65
|
+
font-weight: 400;
|
|
66
|
+
border: 0.5px solid rgba(0, 0, 0, 0.04);
|
|
67
|
+
box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04);
|
|
68
|
+
border-radius: 5px; /* stylelint-disable-line scales/radii */
|
|
69
|
+
background-color: var(--studio-white);
|
|
70
|
+
&:hover {
|
|
71
|
+
background-color: var(--studio-white);
|
|
72
|
+
border-color: rgba(0, 0, 0, 0.04);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.segmented-control__text {
|
|
77
|
+
white-space: initial;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.plan-type-selector .plan-type-selector__interval-type-dropdown-container {
|
|
84
|
+
margin: 0 auto;
|
|
85
|
+
.is-sticky-plan-type-selector & {
|
|
86
|
+
width: 100%;
|
|
87
|
+
margin: unset;
|
|
88
|
+
}
|
|
89
|
+
.plan-type-selector__interval-type-dropdown {
|
|
90
|
+
&,
|
|
91
|
+
&:visited,
|
|
92
|
+
&:hover span.name {
|
|
93
|
+
color: var(--color-text);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
button {
|
|
97
|
+
height: auto;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
button .plan-type-selector__interval-type-dropdown-option {
|
|
101
|
+
padding-right: 32px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.plan-type-selector__interval-type-dropdown-option {
|
|
105
|
+
display: flex;
|
|
106
|
+
padding: 13px 13px 13px 16px;
|
|
107
|
+
font-size: 0.875rem;
|
|
108
|
+
text-wrap: nowrap;
|
|
109
|
+
|
|
110
|
+
.discount {
|
|
111
|
+
display: flex;
|
|
112
|
+
border-radius: 3px;
|
|
113
|
+
line-height: 20px;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.components-flex {
|
|
118
|
+
width: 100%;
|
|
119
|
+
.components-input-control__container {
|
|
120
|
+
.components-custom-select-control__button {
|
|
121
|
+
min-width: 225px;
|
|
122
|
+
padding: 0;
|
|
123
|
+
height: auto;
|
|
124
|
+
.is-sticky-plan-type-selector & {
|
|
125
|
+
height: 64px;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
.components-input-control__backdrop {
|
|
129
|
+
border-color: var(--studio-gray-10);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.components-input-control__suffix > div {
|
|
133
|
+
padding-right: 13px;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
.components-custom-select-control__menu {
|
|
138
|
+
margin: 0;
|
|
139
|
+
border-radius: 0;
|
|
140
|
+
border-bottom-right-radius: 2px;
|
|
141
|
+
border-bottom-left-radius: 2px;
|
|
142
|
+
box-sizing: border-box;
|
|
143
|
+
border: 1px solid var(--studio-gray-10);
|
|
144
|
+
margin-top: -2px;
|
|
145
|
+
|
|
146
|
+
.is-sticky-plan-type-selector & {
|
|
147
|
+
border-bottom-right-radius: 0;
|
|
148
|
+
border-bottom-left-radius: 0;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
.components-custom-select-control__item {
|
|
152
|
+
grid-template-columns: auto min-content;
|
|
153
|
+
padding: 0;
|
|
154
|
+
.is-highlighted {
|
|
155
|
+
background-color: var(--studio-gray-0);
|
|
156
|
+
}
|
|
157
|
+
.a {
|
|
158
|
+
padding: 11.5px 16px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.components-custom-select-control__item-icon {
|
|
162
|
+
display: none;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
.components-custom-select-control__label {
|
|
166
|
+
display: none;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
div.is-sticky-plan-type-selector .plan-type-selector__interval-type-dropdown {
|
|
172
|
+
width: 100%;
|
|
173
|
+
@include plan-type-selector-custom-mobile-breakpoint {
|
|
174
|
+
// Display above sticky feature and comparison grid plan headers
|
|
175
|
+
.components-flex {
|
|
176
|
+
width: 100vw;
|
|
177
|
+
padding: 0;
|
|
178
|
+
border-bottom: 1px solid #e0e0e0;
|
|
179
|
+
border-bottom-right-radius: 0;
|
|
180
|
+
border-bottom-left-radius: 0;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.components-custom-select-control__menu {
|
|
184
|
+
width: 100%;
|
|
185
|
+
border: 1px solid #e0e0e0;
|
|
186
|
+
/*
|
|
187
|
+
* Override the default popup menu z index so that it does not appear above other sticky elements.
|
|
188
|
+
* The default z-index is 1_000_000 which is too high
|
|
189
|
+
*/
|
|
190
|
+
z-index: 3;
|
|
191
|
+
}
|
|
192
|
+
.components-input-control__backdrop.components-input-control__backdrop {
|
|
193
|
+
border: none;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Tooltip } from '@automattic/components';
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import { TranslateResult } from 'i18n-calypso';
|
|
4
|
+
import { Dispatch, PropsWithChildren, SetStateAction, useRef } from 'react';
|
|
5
|
+
import { hasTouch } from '../lib/touch-detect';
|
|
6
|
+
|
|
7
|
+
const HoverAreaContainer = styled.span`
|
|
8
|
+
max-width: 220px;
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
const StyledTooltip = styled( Tooltip )`
|
|
12
|
+
&.tooltip.popover .popover__inner {
|
|
13
|
+
background: var( --color-masterbar-background );
|
|
14
|
+
text-align: start;
|
|
15
|
+
border-radius: 4px;
|
|
16
|
+
min-height: 32px;
|
|
17
|
+
width: 210px;
|
|
18
|
+
align-items: center;
|
|
19
|
+
font-style: normal;
|
|
20
|
+
font-weight: 400;
|
|
21
|
+
font-size: 1em;
|
|
22
|
+
padding: 8px 10px;
|
|
23
|
+
top: -8px;
|
|
24
|
+
overflow-wrap: break-word;
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
export type Plans2023TooltipProps = PropsWithChildren< {
|
|
29
|
+
text?: TranslateResult;
|
|
30
|
+
setActiveTooltipId: Dispatch< SetStateAction< string > >;
|
|
31
|
+
activeTooltipId: string;
|
|
32
|
+
id: string;
|
|
33
|
+
showOnMobile?: boolean;
|
|
34
|
+
} >;
|
|
35
|
+
|
|
36
|
+
export const Plans2023Tooltip = ( {
|
|
37
|
+
showOnMobile = true,
|
|
38
|
+
activeTooltipId,
|
|
39
|
+
setActiveTooltipId,
|
|
40
|
+
id,
|
|
41
|
+
text,
|
|
42
|
+
children,
|
|
43
|
+
}: Plans2023TooltipProps ) => {
|
|
44
|
+
const tooltipRef = useRef< HTMLDivElement >( null );
|
|
45
|
+
const isTouch = hasTouch();
|
|
46
|
+
|
|
47
|
+
if ( ! text ) {
|
|
48
|
+
return <>{ children }</>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const getMobileActiveTooltip = () => {
|
|
52
|
+
// Close tooltip if the user clicks on an open tooltip.
|
|
53
|
+
if ( activeTooltipId === id ) {
|
|
54
|
+
return '';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return id;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const isVisible = activeTooltipId === id;
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<>
|
|
64
|
+
<HoverAreaContainer
|
|
65
|
+
className="plans-2023-tooltip__hover-area-container"
|
|
66
|
+
ref={ tooltipRef }
|
|
67
|
+
onMouseEnter={ () => ! isTouch && setActiveTooltipId( id ) }
|
|
68
|
+
onMouseLeave={ () => ! isTouch && setActiveTooltipId( '' ) }
|
|
69
|
+
onTouchStart={ () => isTouch && setActiveTooltipId( getMobileActiveTooltip() ) }
|
|
70
|
+
id={ id }
|
|
71
|
+
>
|
|
72
|
+
{ children }
|
|
73
|
+
</HoverAreaContainer>
|
|
74
|
+
<StyledTooltip
|
|
75
|
+
isVisible={ isVisible }
|
|
76
|
+
position="top"
|
|
77
|
+
context={ tooltipRef.current }
|
|
78
|
+
hideArrow
|
|
79
|
+
showOnMobile={ showOnMobile }
|
|
80
|
+
>
|
|
81
|
+
{ text }
|
|
82
|
+
</StyledTooltip>
|
|
83
|
+
</>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { getPlanClass, PlanSlug } from '@automattic/calypso-products';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { usePlansGridContext } from '../grid-context';
|
|
4
|
+
import PlanPill from './shared/plan-pill';
|
|
5
|
+
|
|
6
|
+
const PopularBadge: React.FunctionComponent< {
|
|
7
|
+
isInSignup?: boolean;
|
|
8
|
+
planSlug: PlanSlug;
|
|
9
|
+
additionalClassName?: string;
|
|
10
|
+
} > = ( { isInSignup, planSlug, additionalClassName } ) => {
|
|
11
|
+
const { gridPlansIndex } = usePlansGridContext();
|
|
12
|
+
const classes = clsx(
|
|
13
|
+
'plan-features-2023-grid__popular-badge',
|
|
14
|
+
getPlanClass( planSlug ),
|
|
15
|
+
additionalClassName
|
|
16
|
+
);
|
|
17
|
+
const highlightLabel = gridPlansIndex[ planSlug ]?.highlightLabel;
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<>
|
|
21
|
+
{ highlightLabel && (
|
|
22
|
+
<div className={ classes }>
|
|
23
|
+
<PlanPill isInSignup={ isInSignup }>{ highlightLabel }</PlanPill>
|
|
24
|
+
</div>
|
|
25
|
+
) }
|
|
26
|
+
</>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default PopularBadge;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Shared components
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type PlanSlug,
|
|
3
|
+
isP2FreePlan,
|
|
4
|
+
isFreePlan,
|
|
5
|
+
PLAN_FREE,
|
|
6
|
+
isWpcomEnterpriseGridPlan,
|
|
7
|
+
} from '@automattic/calypso-products';
|
|
8
|
+
import { AddOns, WpcomPlansUI } from '@automattic/data-stores';
|
|
9
|
+
import { useSelect } from '@wordpress/data';
|
|
10
|
+
import { formatCurrency, useTranslate } from 'i18n-calypso';
|
|
11
|
+
import { usePlansGridContext } from '../../../grid-context';
|
|
12
|
+
import useIsLargeCurrency from '../../../hooks/use-is-large-currency';
|
|
13
|
+
import { usePlanPricingInfoFromGridPlans } from '../../../hooks/use-plan-pricing-info-from-grid-plans';
|
|
14
|
+
import PlanButton from '../../plan-button';
|
|
15
|
+
import { useDefaultStorageOption } from '../../shared/storage';
|
|
16
|
+
import type { GridPlan, PlanActionOverrides } from '../../../types';
|
|
17
|
+
import './style.scss';
|
|
18
|
+
|
|
19
|
+
type ActionButtonProps = {
|
|
20
|
+
availableForPurchase: boolean;
|
|
21
|
+
currentSitePlanSlug?: string | null;
|
|
22
|
+
isPopular?: boolean;
|
|
23
|
+
isInSignup?: boolean;
|
|
24
|
+
isMonthlyPlan?: boolean;
|
|
25
|
+
planSlug: PlanSlug;
|
|
26
|
+
buttonText?: string;
|
|
27
|
+
planActionOverrides?: PlanActionOverrides;
|
|
28
|
+
showMonthlyPrice: boolean;
|
|
29
|
+
isStuck: boolean;
|
|
30
|
+
visibleGridPlans: GridPlan[];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const ActionButton = ( {
|
|
34
|
+
planSlug,
|
|
35
|
+
currentSitePlanSlug,
|
|
36
|
+
visibleGridPlans,
|
|
37
|
+
availableForPurchase,
|
|
38
|
+
isStuck,
|
|
39
|
+
isInSignup,
|
|
40
|
+
isMonthlyPlan,
|
|
41
|
+
}: ActionButtonProps ) => {
|
|
42
|
+
const translate = useTranslate();
|
|
43
|
+
const {
|
|
44
|
+
gridPlansIndex,
|
|
45
|
+
siteId,
|
|
46
|
+
helpers: { useAction },
|
|
47
|
+
} = usePlansGridContext();
|
|
48
|
+
const {
|
|
49
|
+
current,
|
|
50
|
+
planTitle,
|
|
51
|
+
pricing: { billingPeriod, currencyCode, originalPrice, discountedPrice },
|
|
52
|
+
freeTrialPlanSlug,
|
|
53
|
+
cartItemForPlan,
|
|
54
|
+
} = gridPlansIndex[ planSlug ];
|
|
55
|
+
const currentPlanBillingPeriod = currentSitePlanSlug
|
|
56
|
+
? gridPlansIndex[ currentSitePlanSlug ]?.pricing.billingPeriod
|
|
57
|
+
: undefined;
|
|
58
|
+
const { prices } = usePlanPricingInfoFromGridPlans( {
|
|
59
|
+
gridPlans: visibleGridPlans,
|
|
60
|
+
} );
|
|
61
|
+
const isLargeCurrency = useIsLargeCurrency( { prices, currencyCode: currencyCode || 'USD' } );
|
|
62
|
+
const storageAddOns = AddOns.useStorageAddOns( { siteId } );
|
|
63
|
+
const selectedStorageOptionForPlan = useSelect(
|
|
64
|
+
( select ) => select( WpcomPlansUI.store ).getSelectedStorageOptionForPlan( planSlug, siteId ),
|
|
65
|
+
[ planSlug, siteId ]
|
|
66
|
+
);
|
|
67
|
+
const selectedStorageAddOn = storageAddOns?.find( ( addOn ) => {
|
|
68
|
+
return selectedStorageOptionForPlan && addOn
|
|
69
|
+
? addOn.addOnSlug === selectedStorageOptionForPlan
|
|
70
|
+
: false;
|
|
71
|
+
} );
|
|
72
|
+
|
|
73
|
+
const priceString = formatCurrency(
|
|
74
|
+
( discountedPrice.monthly || originalPrice.monthly ) ?? 0,
|
|
75
|
+
currencyCode || 'USD',
|
|
76
|
+
{
|
|
77
|
+
stripZeros: true,
|
|
78
|
+
isSmallestUnit: true,
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const {
|
|
83
|
+
primary: { callback, text, status, variant },
|
|
84
|
+
postButtonText,
|
|
85
|
+
} = useAction( {
|
|
86
|
+
availableForPurchase,
|
|
87
|
+
billingPeriod,
|
|
88
|
+
isLargeCurrency,
|
|
89
|
+
isStuck,
|
|
90
|
+
planSlug,
|
|
91
|
+
planTitle,
|
|
92
|
+
priceString,
|
|
93
|
+
cartItemForPlan,
|
|
94
|
+
currentPlanBillingPeriod,
|
|
95
|
+
selectedStorageAddOn,
|
|
96
|
+
} );
|
|
97
|
+
const {
|
|
98
|
+
primary: { callback: freeTrialCallback, text: freeTrialText },
|
|
99
|
+
} = useAction( {
|
|
100
|
+
billingPeriod,
|
|
101
|
+
isFreeTrialAction: true,
|
|
102
|
+
isLargeCurrency,
|
|
103
|
+
isStuck,
|
|
104
|
+
// TODO: Unsure about using free plan as a fallback. We should revisit.
|
|
105
|
+
planSlug: freeTrialPlanSlug ?? PLAN_FREE,
|
|
106
|
+
planTitle,
|
|
107
|
+
priceString,
|
|
108
|
+
cartItemForPlan: { product_slug: freeTrialPlanSlug ?? PLAN_FREE },
|
|
109
|
+
currentPlanBillingPeriod,
|
|
110
|
+
selectedStorageAddOn,
|
|
111
|
+
} );
|
|
112
|
+
|
|
113
|
+
const busy = status === 'blocked';
|
|
114
|
+
|
|
115
|
+
const defaultStorageOption = useDefaultStorageOption( { planSlug } );
|
|
116
|
+
const canPurchaseStorageAddOns = storageAddOns?.some(
|
|
117
|
+
( storageAddOn ) => ! storageAddOn?.purchased
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
const storageAddOnCheckoutHref = storageAddOns?.find(
|
|
121
|
+
( addOn ) => selectedStorageOptionForPlan && addOn?.addOnSlug === selectedStorageOptionForPlan
|
|
122
|
+
)?.checkoutLink;
|
|
123
|
+
|
|
124
|
+
const nonDefaultStorageOptionSelected =
|
|
125
|
+
selectedStorageOptionForPlan && defaultStorageOption !== selectedStorageOptionForPlan;
|
|
126
|
+
|
|
127
|
+
let actionButton = (
|
|
128
|
+
<PlanButton
|
|
129
|
+
planSlug={ planSlug }
|
|
130
|
+
onClick={ callback }
|
|
131
|
+
busy={ busy }
|
|
132
|
+
disabled={ ! callback || 'disabled' === status }
|
|
133
|
+
classes={ variant === 'secondary' ? 'is-secondary' : '' }
|
|
134
|
+
>
|
|
135
|
+
{ text }
|
|
136
|
+
</PlanButton>
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
if (
|
|
140
|
+
( isFreePlan( planSlug ) ||
|
|
141
|
+
( storageAddOns && ! canPurchaseStorageAddOns && nonDefaultStorageOptionSelected ) ) &&
|
|
142
|
+
isP2FreePlan( planSlug ) &&
|
|
143
|
+
current
|
|
144
|
+
) {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if ( availableForPurchase || current || isWpcomEnterpriseGridPlan( planSlug ) ) {
|
|
149
|
+
// TODO: Move the condition below into the useAction hook
|
|
150
|
+
if (
|
|
151
|
+
current &&
|
|
152
|
+
canPurchaseStorageAddOns &&
|
|
153
|
+
nonDefaultStorageOptionSelected &&
|
|
154
|
+
! isMonthlyPlan
|
|
155
|
+
) {
|
|
156
|
+
actionButton = (
|
|
157
|
+
<PlanButton
|
|
158
|
+
planSlug={ planSlug }
|
|
159
|
+
classes="is-storage-upgradeable"
|
|
160
|
+
href={ storageAddOnCheckoutHref }
|
|
161
|
+
busy={ busy }
|
|
162
|
+
>
|
|
163
|
+
{ translate( 'Upgrade' ) }
|
|
164
|
+
</PlanButton>
|
|
165
|
+
);
|
|
166
|
+
} else {
|
|
167
|
+
const hasFreeTrialPlan = isInSignup ? !! freeTrialPlanSlug : false;
|
|
168
|
+
actionButton = hasFreeTrialPlan ? (
|
|
169
|
+
<div className="plans-grid-next-action-button__multi">
|
|
170
|
+
<PlanButton planSlug={ planSlug } onClick={ () => freeTrialCallback() } busy={ busy }>
|
|
171
|
+
{ freeTrialText }
|
|
172
|
+
</PlanButton>
|
|
173
|
+
{ ! isStuck && ( // along side with the free trial CTA, we also provide an option for purchasing the plan directly here
|
|
174
|
+
<PlanButton planSlug={ planSlug } onClick={ callback } busy={ busy } borderless>
|
|
175
|
+
{ text }
|
|
176
|
+
</PlanButton>
|
|
177
|
+
) }
|
|
178
|
+
</div>
|
|
179
|
+
) : (
|
|
180
|
+
<>
|
|
181
|
+
<PlanButton
|
|
182
|
+
planSlug={ planSlug }
|
|
183
|
+
disabled={ ! callback || 'disabled' === status }
|
|
184
|
+
busy={ busy }
|
|
185
|
+
onClick={ callback }
|
|
186
|
+
current={ current }
|
|
187
|
+
>
|
|
188
|
+
{ text }
|
|
189
|
+
</PlanButton>
|
|
190
|
+
{ postButtonText && (
|
|
191
|
+
<span className="plans-grid-next-action-button__label">{ postButtonText }</span>
|
|
192
|
+
) }
|
|
193
|
+
</>
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return (
|
|
199
|
+
<div className="plans-grid-next-action-button">
|
|
200
|
+
<div className="plans-grid-next-action-button__content">{ actionButton }</div>
|
|
201
|
+
</div>
|
|
202
|
+
);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export default ActionButton;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isWpcomEnterpriseGridPlan,
|
|
3
|
+
PlanSlug,
|
|
4
|
+
isWooExpressPlan,
|
|
5
|
+
isFreePlan,
|
|
6
|
+
} from '@automattic/calypso-products';
|
|
7
|
+
import styled from '@emotion/styled';
|
|
8
|
+
import { useTranslate, formatCurrency } from 'i18n-calypso';
|
|
9
|
+
import { usePlansGridContext } from '../../../grid-context';
|
|
10
|
+
import usePlanBillingDescription from '../../../hooks/data-store/use-plan-billing-description';
|
|
11
|
+
import type { GridPlan } from '../../../types';
|
|
12
|
+
|
|
13
|
+
const DiscountPromotion = styled.div`
|
|
14
|
+
text-transform: uppercase;
|
|
15
|
+
font-weight: 600;
|
|
16
|
+
color: #306e27;
|
|
17
|
+
font-size: $font-body-extra-small;
|
|
18
|
+
margin-top: 6px;
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
interface RefundNoticeProps {
|
|
22
|
+
showRefundPeriod?: boolean;
|
|
23
|
+
planSlug: string;
|
|
24
|
+
billingPeriod: GridPlan[ 'pricing' ][ 'billingPeriod' ];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const RefundNotice = ( { planSlug, showRefundPeriod, billingPeriod }: RefundNoticeProps ) => {
|
|
28
|
+
const translate = useTranslate();
|
|
29
|
+
|
|
30
|
+
if ( ! showRefundPeriod || isFreePlan( planSlug ) ) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<>
|
|
36
|
+
<br />
|
|
37
|
+
{ translate( 'Refundable within %(dayCount)s days. No questions asked.', {
|
|
38
|
+
args: {
|
|
39
|
+
dayCount: billingPeriod === 31 ? 7 : 14,
|
|
40
|
+
},
|
|
41
|
+
} ) }
|
|
42
|
+
</>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
interface Props {
|
|
47
|
+
planSlug: PlanSlug;
|
|
48
|
+
showRefundPeriod?: boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const BillingTimeframe = ( { showRefundPeriod, planSlug }: Props ) => {
|
|
52
|
+
const translate = useTranslate();
|
|
53
|
+
const { helpers, gridPlansIndex, coupon, siteId } = usePlansGridContext();
|
|
54
|
+
const { isMonthlyPlan, billingTimeframe, pricing } = gridPlansIndex[ planSlug ];
|
|
55
|
+
|
|
56
|
+
const { introOffer, billingPeriod } = pricing;
|
|
57
|
+
const planBillingDescription = usePlanBillingDescription( {
|
|
58
|
+
siteId,
|
|
59
|
+
planSlug,
|
|
60
|
+
pricing,
|
|
61
|
+
isMonthlyPlan,
|
|
62
|
+
coupon,
|
|
63
|
+
useCheckPlanAvailabilityForPurchase: helpers?.useCheckPlanAvailabilityForPurchase,
|
|
64
|
+
} );
|
|
65
|
+
const description = planBillingDescription || billingTimeframe;
|
|
66
|
+
|
|
67
|
+
if (
|
|
68
|
+
isWooExpressPlan( planSlug ) &&
|
|
69
|
+
isMonthlyPlan &&
|
|
70
|
+
( ! introOffer || introOffer.isOfferComplete )
|
|
71
|
+
) {
|
|
72
|
+
return (
|
|
73
|
+
<div>
|
|
74
|
+
<div>{ billingTimeframe }</div>
|
|
75
|
+
<DiscountPromotion>{ planBillingDescription }</DiscountPromotion>
|
|
76
|
+
</div>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if ( isWpcomEnterpriseGridPlan( planSlug ) ) {
|
|
81
|
+
const price = formatCurrency( 25000, 'USD' );
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<div className="plans-grid-next__billing-timeframe-vip-price">
|
|
85
|
+
{ translate( 'Starts at {{b}}%(price)s{{/b}} yearly', {
|
|
86
|
+
args: { price },
|
|
87
|
+
components: { b: <b /> },
|
|
88
|
+
comment: 'Translators: the price is in US dollars for all users (US$25,000)',
|
|
89
|
+
} ) }
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<div>
|
|
96
|
+
{ description }
|
|
97
|
+
<RefundNotice
|
|
98
|
+
showRefundPeriod={ showRefundPeriod }
|
|
99
|
+
planSlug={ planSlug }
|
|
100
|
+
billingPeriod={ billingPeriod }
|
|
101
|
+
/>
|
|
102
|
+
</div>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export default BillingTimeframe;
|