@automattic/plans-grid-next 1.0.2 → 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 +99 -92
- package/dist/cjs/components/comparison-grid/index.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 +107 -19
- 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 +75 -51
- 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 +9 -3
- 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-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-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 +6 -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 +100 -93
- package/dist/esm/components/comparison-grid/index.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 +107 -19
- 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 +75 -51
- 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 +9 -3
- 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-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-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 +2 -0
- 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/features-grid/client-logo-list/client-list.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/table.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/index.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/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-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-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-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-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 +7 -0
- package/dist/types/index.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 +29 -2
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +38 -28
- package/src/_shared.scss +4 -3
- package/src/components/comparison-grid/index.tsx +258 -181
- 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 +35 -18
- 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 +107 -19
- 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 +75 -51
- 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 +9 -3
- 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-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-is-large-currency.ts +1 -1
- package/src/hooks/use-visible-grid-plans.tsx +102 -0
- package/src/index.tsx +18 -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 +41 -0
- 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/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/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/src/components/features-grid/mobile-free-domain.tsx +0 -51
- package/src/lib/get-plan-pricing-info-from-grid-plans.ts +0 -31
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Plans } from '@automattic/data-stores';
|
|
2
|
+
/**
|
|
3
|
+
* Intermediate structure that normalizes plan pricing from different sources
|
|
4
|
+
* (PricingMetaForGridPlan, WPCOMProductVariant) into a common shape suitable
|
|
5
|
+
* for discount calculations.
|
|
6
|
+
*
|
|
7
|
+
* All prices are in the smallest currency unit (e.g. cents).
|
|
8
|
+
*/
|
|
9
|
+
export interface PlanPriceInfo {
|
|
10
|
+
/** Billing period length in months (1, 12, 24, 36) */
|
|
11
|
+
termMonths: number;
|
|
12
|
+
/** Regular price per month — no intro offer, no site-level discount */
|
|
13
|
+
regularPricePerMonth: number;
|
|
14
|
+
/** Site-level discounted price per month (currency conversion / proration credit), if any */
|
|
15
|
+
discountedPricePerMonth?: number;
|
|
16
|
+
introOffer?: {
|
|
17
|
+
/** Monthly-equivalent price during the intro period */
|
|
18
|
+
pricePerMonth: number;
|
|
19
|
+
/** How many months the intro offer lasts */
|
|
20
|
+
durationMonths: number;
|
|
21
|
+
/** False once the offer has already been used by this user */
|
|
22
|
+
isActive: boolean;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Calculates the total cost of a plan over `durationMonths` months.
|
|
27
|
+
*
|
|
28
|
+
* Handles partial billing periods via pro-ration (e.g. a yearly plan priced at
|
|
29
|
+
* $200/year costs $100 for 6 months).
|
|
30
|
+
*
|
|
31
|
+
* When `useIntroOffer` is true (default) and an active intro offer exists, the
|
|
32
|
+
* intro price is applied for the first `introOffer.durationMonths` months, and
|
|
33
|
+
* the regular (or discounted) price for the remainder.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // Monthly plan: $10 intro for 1 month, then $20/month; cost for 6 months:
|
|
37
|
+
* // 1×$10 + 5×$20 = $110 (in cents: 1100 + 10000 = 11000)
|
|
38
|
+
* getPlanPriceForDuration( info, 6, { useIntroOffer: true } ) // 11000
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* // Yearly plan: $100/yr intro, $200/yr regular; cost for 6 months:
|
|
42
|
+
* // useIntroOffer=true → 6×($100/12) = $50 (5000 cents)
|
|
43
|
+
* // useIntroOffer=false → 6×($200/12) = $100 (10000 cents)
|
|
44
|
+
*/
|
|
45
|
+
export declare function getPlanPriceForDuration(info: PlanPriceInfo, durationMonths: number, { useIntroOffer }?: {
|
|
46
|
+
useIntroOffer?: boolean;
|
|
47
|
+
}): number;
|
|
48
|
+
/**
|
|
49
|
+
* Calculates the percentage discount between a reference price and a cheaper price.
|
|
50
|
+
*
|
|
51
|
+
* Always uses Math.floor — conservative, never overstates savings.
|
|
52
|
+
*
|
|
53
|
+
* Returns `undefined` (not 0) when there is no saving, allowing callers to
|
|
54
|
+
* distinguish "no discount" from a computed "0% discount".
|
|
55
|
+
*/
|
|
56
|
+
export declare function calculateDiscountPercentage(referencePrice: number, cheaperPrice: number): number | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Converts a `PricingMetaForGridPlan` (from @automattic/data-stores Plans hooks)
|
|
59
|
+
* into a `PlanPriceInfo` suitable for use with `getPlanPriceForDuration` and
|
|
60
|
+
* `calculateDiscountPercentage`.
|
|
61
|
+
*
|
|
62
|
+
* Returns null when required pricing data is absent (e.g. free/enterprise plans
|
|
63
|
+
* that have no monthly price, or plans whose billing period is unknown).
|
|
64
|
+
*/
|
|
65
|
+
export declare function fromPricingMetaForGridPlan(meta: Plans.PricingMetaForGridPlan): PlanPriceInfo | null;
|
|
66
|
+
/**
|
|
67
|
+
* Minimal structural type describing the pricing fields needed from a product
|
|
68
|
+
* variant. `WPCOMProductVariant` (defined in checkout) satisfies this interface
|
|
69
|
+
* structurally, so it can be passed directly without importing the checkout type
|
|
70
|
+
* into this package.
|
|
71
|
+
*
|
|
72
|
+
* Key invariants:
|
|
73
|
+
* - `priceBeforeDiscounts` is always the full-term cost at the regular rate.
|
|
74
|
+
* - `priceInteger` is the actual amount charged, which embeds both intro and
|
|
75
|
+
* non-intro portions when an intro offer spans only part of the term
|
|
76
|
+
* (e.g. a 1-year intro on a 2-year plan).
|
|
77
|
+
* - When `priceInteger < priceBeforeDiscounts`, the intro price portion is
|
|
78
|
+
* derived by subtracting the non-intro months at the regular rate.
|
|
79
|
+
*/
|
|
80
|
+
export interface VariantPriceData {
|
|
81
|
+
introductoryInterval: number;
|
|
82
|
+
/** 'month' | 'year' */
|
|
83
|
+
introductoryTerm: string;
|
|
84
|
+
/** Full-term price at the regular (non-intro) rate */
|
|
85
|
+
priceBeforeDiscounts: number;
|
|
86
|
+
/** Actual price charged for the full term (may embed an intro offer) */
|
|
87
|
+
priceInteger: number;
|
|
88
|
+
termIntervalInMonths: number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Converts a variant price data object (structurally compatible with
|
|
92
|
+
* `WPCOMProductVariant`) into a `PlanPriceInfo`.
|
|
93
|
+
*
|
|
94
|
+
* `discountedPricePerMonth` is intentionally not set: `WPCOMProductVariant`
|
|
95
|
+
* does not separate site-level discounts from the intro price. Coupon discounts
|
|
96
|
+
* in checkout are tracked separately via `product.coupon_savings_integer`.
|
|
97
|
+
*
|
|
98
|
+
* Per-month values are derived by dividing full-term prices (integers in the
|
|
99
|
+
* smallest currency unit) by the number of months. The result is rounded to the
|
|
100
|
+
* nearest integer (Math.round) so that all fields in the returned `PlanPriceInfo`
|
|
101
|
+
* remain whole-cent values safe for use with currency formatters. The rounding
|
|
102
|
+
* error is at most 0.5¢ per month and is negligible for percentage comparisons.
|
|
103
|
+
*/
|
|
104
|
+
export declare function fromVariantPriceData(variant: VariantPriceData): PlanPriceInfo;
|
|
105
|
+
//# sourceMappingURL=plan-pricing-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-pricing-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/plan-pricing-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC7B,sDAAsD;IACtD,UAAU,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,oBAAoB,EAAE,MAAM,CAAC;IAC7B,6FAA6F;IAC7F,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,UAAU,CAAC,EAAE;QACZ,uDAAuD;QACvD,aAAa,EAAE,MAAM,CAAC;QACtB,4CAA4C;QAC5C,cAAc,EAAE,MAAM,CAAC;QACvB,8DAA8D;QAC9D,QAAQ,EAAE,OAAO,CAAC;KAClB,CAAC;CACF;AAiBD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,uBAAuB,CACtC,IAAI,EAAE,aAAa,EACnB,cAAc,EAAE,MAAM,EACtB,EAAE,aAAoB,EAAE,GAAE;IAAE,aAAa,CAAC,EAAE,OAAO,CAAA;CAAO,GACxD,MAAM,CAUR;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAC1C,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,MAAM,GAClB,MAAM,GAAG,SAAS,CAKpB;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACzC,IAAI,EAAE,KAAK,CAAC,sBAAsB,GAChC,aAAa,GAAG,IAAI,CA0BtB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,gBAAgB;IAChC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,uBAAuB;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,sDAAsD;IACtD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,wEAAwE;IACxE,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAE,OAAO,EAAE,gBAAgB,GAAI,aAAa,CAsC/E"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -9,6 +9,14 @@ export type TransformedFeatureObject = FeatureObject & {
|
|
|
9
9
|
availableForCurrentPlan: boolean;
|
|
10
10
|
availableOnlyForAnnualPlans: boolean;
|
|
11
11
|
isHighlighted?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* When true, extra bottom margin on the last feature row for pricing experiment variants.
|
|
14
|
+
*/
|
|
15
|
+
isExperimentLastFeature?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Badge text to display after the feature title (e.g. pricing differentiators pills).
|
|
18
|
+
*/
|
|
19
|
+
badgeText?: TranslateResult;
|
|
12
20
|
};
|
|
13
21
|
export interface PlanFeaturesForGridPlan {
|
|
14
22
|
wpcomFeatures: TransformedFeatureObject[];
|
|
@@ -33,12 +41,13 @@ export interface GridPlan {
|
|
|
33
41
|
product_slug: string;
|
|
34
42
|
} | null;
|
|
35
43
|
highlightLabel?: React.ReactNode | null;
|
|
44
|
+
titleBadge?: React.ReactNode | null;
|
|
36
45
|
}
|
|
37
46
|
/***********************
|
|
38
47
|
* Grid Component Types:
|
|
39
48
|
***********************/
|
|
40
49
|
export type GridSize = 'small' | 'smedium' | 'medium' | 'large' | 'xlarge';
|
|
41
|
-
export type PlansIntent = 'plans-affiliate' | 'plans-blog-onboarding' | 'plans-newsletter' | 'plans-new-hosted-site' | 'plans-new-hosted-site-business-only' | 'plans-plugins' | 'plans-jetpack-app' | 'plans-jetpack-app-site-creation' | 'plans-import' | 'plans-woocommerce' | 'plans-p2' | 'plans-default-wpcom' | 'plans-business-trial' | 'plans-videopress' | 'plans-guided-segment-developer-or-agency' | 'plans-guided-segment-merchant' | 'plans-guided-segment-blogger' | 'plans-guided-segment-nonprofit' | 'plans-guided-segment-consumer-or-business' | 'plans-site-selected-legacy' | 'default';
|
|
50
|
+
export type PlansIntent = 'plans-affiliate' | 'plans-ai-assembler-free-trial' | 'plans-blog-onboarding' | 'plans-newsletter' | 'plans-new-hosted-site' | 'plans-new-hosted-site-business-only' | 'plans-plugins' | 'plans-jetpack-app' | 'plans-jetpack-app-site-creation' | 'plans-import' | 'plans-woocommerce' | 'plans-p2' | 'plans-default-wpcom' | 'plans-business-trial' | 'plans-videopress' | 'plans-guided-segment-developer-or-agency' | 'plans-guided-segment-merchant' | 'plans-guided-segment-blogger' | 'plans-guided-segment-nonprofit' | 'plans-guided-segment-consumer-or-business' | 'plans-site-selected-legacy' | 'plans-playground' | 'plans-playground-premium' | 'plans-upgrade' | 'plans-upgrade-or-downgrade' | 'plans-wordpress-hosting' | 'plans-website-builder' | 'plans-woo-hosted' | 'plans-woo-hosting-solutions' | 'plans-migration' | 'default';
|
|
42
51
|
export interface PlanActionOverrides {
|
|
43
52
|
loggedInFreePlan?: {
|
|
44
53
|
text?: TranslateResult;
|
|
@@ -90,6 +99,8 @@ export interface FeaturesGridProps extends CommonGridProps {
|
|
|
90
99
|
export interface ComparisonGridProps extends CommonGridProps {
|
|
91
100
|
selectedPlan?: string;
|
|
92
101
|
intervalType: SupportedUrlFriendlyTermType;
|
|
102
|
+
/** Called when the number of visible plans in the grid changes (e.g. for narrowing the container). */
|
|
103
|
+
onVisiblePlansCountChange?: (count: number) => void;
|
|
93
104
|
}
|
|
94
105
|
export type UseActionCallback = ({ planSlug, cartItemForPlan, selectedStorageAddOn, availableForPurchase, }: {
|
|
95
106
|
planSlug: PlanSlug;
|
|
@@ -100,13 +111,14 @@ export type UseActionCallback = ({ planSlug, cartItemForPlan, selectedStorageAdd
|
|
|
100
111
|
export interface GridAction {
|
|
101
112
|
primary: {
|
|
102
113
|
text: TranslateResult;
|
|
114
|
+
ariaLabel?: TranslateResult;
|
|
103
115
|
callback: () => Promise<void> | void;
|
|
104
116
|
status?: 'disabled' | 'blocked' | 'enabled';
|
|
105
117
|
variant?: 'primary' | 'secondary';
|
|
106
118
|
};
|
|
107
119
|
postButtonText?: TranslateResult;
|
|
108
120
|
}
|
|
109
|
-
export type UseAction = ({ availableForPurchase, billingPeriod, cartItemForPlan, currentPlanBillingPeriod, isFreeTrialAction, isLargeCurrency, isStuck, planSlug, planTitle, priceString, selectedStorageAddOn, }: {
|
|
121
|
+
export type UseAction = ({ availableForPurchase, billingPeriod, cartItemForPlan, currentPlanBillingPeriod, isFreeTrialAction, isLargeCurrency, isStuck, planSlug, planTitle, priceString, selectedStorageAddOn, pricing, isMonthlyPlan, }: {
|
|
110
122
|
availableForPurchase?: boolean;
|
|
111
123
|
billingPeriod?: PlanPricing['billPeriod'];
|
|
112
124
|
cartItemForPlan?: MinimalRequestCartProduct | null;
|
|
@@ -118,6 +130,8 @@ export type UseAction = ({ availableForPurchase, billingPeriod, cartItemForPlan,
|
|
|
118
130
|
planTitle?: TranslateResult;
|
|
119
131
|
priceString?: string;
|
|
120
132
|
selectedStorageAddOn?: AddOns.AddOnMeta | null;
|
|
133
|
+
pricing?: Plans.PricingMetaForGridPlan | null;
|
|
134
|
+
isMonthlyPlan?: boolean;
|
|
121
135
|
}) => GridAction;
|
|
122
136
|
export type GridContextProps = {
|
|
123
137
|
gridPlans: GridPlan[];
|
|
@@ -165,6 +179,19 @@ export type GridContextProps = {
|
|
|
165
179
|
* calculating prices.
|
|
166
180
|
*/
|
|
167
181
|
reflectStorageSelectionInPlanPrices?: boolean;
|
|
182
|
+
/**
|
|
183
|
+
* Enable simplified billing description
|
|
184
|
+
*/
|
|
185
|
+
showSimplifiedBillingDescription?: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* If, and how to present increased renewal pricing (null or the assigned variant name)
|
|
188
|
+
*/
|
|
189
|
+
showBillingDescriptionForIncreasedRenewalPrice?: string | null;
|
|
190
|
+
/**
|
|
191
|
+
* When true, the user is in the rolled-out pricing differentiation cohort.
|
|
192
|
+
* Used to display cohort-specific feature titles in the comparison grid.
|
|
193
|
+
*/
|
|
194
|
+
isExperimentVariant?: boolean;
|
|
168
195
|
};
|
|
169
196
|
export type ComparisonGridExternalProps = Omit<GridContextProps, 'children' | 'enableCategorisedFeatures'> & Omit<ComparisonGridProps, 'onUpgradeClick' | 'gridContainerRef' | 'gridSize'> & {
|
|
170
197
|
className?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EACX,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,aAAa,EACb,eAAe,EACf,OAAO,EACP,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD;;oBAEoB;AAEpB,MAAM,MAAM,wBAAwB,GAAG,aAAa,GAAG;IACtD,uBAAuB,EAAE,OAAO,CAAC;IACjC,2BAA2B,EAAE,OAAO,CAAC;IACrC,aAAa,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EACX,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,aAAa,EACb,eAAe,EACf,OAAO,EACP,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD;;oBAEoB;AAEpB,MAAM,MAAM,wBAAwB,GA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gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/plans-grid-next",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "WordPress.com plans UI grid components and helpers.",
|
|
5
5
|
"homepage": "https://github.com/Automattic/wp-calypso",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -8,6 +8,17 @@
|
|
|
8
8
|
"main": "dist/cjs/index.js",
|
|
9
9
|
"module": "dist/esm/index.js",
|
|
10
10
|
"calypso:src": "src/index.tsx",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"calypso:src": "./src/index.tsx",
|
|
14
|
+
"types": "./dist/types/index.d.ts",
|
|
15
|
+
"import": "./dist/esm/index.js",
|
|
16
|
+
"require": "./dist/cjs/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./src/*": {
|
|
19
|
+
"calypso:src": "./src/*"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
11
22
|
"sideEffects": [
|
|
12
23
|
"*.css",
|
|
13
24
|
"*.scss"
|
|
@@ -32,51 +43,50 @@
|
|
|
32
43
|
"prepare": "yarn run build",
|
|
33
44
|
"prepack": "yarn run clean && yarn run build",
|
|
34
45
|
"watch": "tsc --build ./tsconfig.json --watch",
|
|
35
|
-
"storybook": "yarn msw init &&
|
|
46
|
+
"storybook:start": "yarn msw init && storybook dev"
|
|
36
47
|
},
|
|
37
48
|
"dependencies": {
|
|
38
|
-
"@automattic/calypso-products": "^1.2.
|
|
39
|
-
"@automattic/components": "^
|
|
40
|
-
"@automattic/data-stores": "^3.
|
|
41
|
-
"@automattic/
|
|
49
|
+
"@automattic/calypso-products": "^1.2.3",
|
|
50
|
+
"@automattic/components": "^3.0.4",
|
|
51
|
+
"@automattic/data-stores": "^3.2.1",
|
|
52
|
+
"@automattic/number-formatters": "^1.2.0",
|
|
53
|
+
"@automattic/onboarding": "^1.0.1",
|
|
42
54
|
"@automattic/typography": "^1.0.0",
|
|
43
55
|
"@emotion/react": "11.11.1",
|
|
44
56
|
"@emotion/styled": "^11.11.0",
|
|
45
|
-
"@wordpress/data": "^10.
|
|
46
|
-
"@wordpress/element": "^
|
|
47
|
-
"@wordpress/icons": "^
|
|
48
|
-
"@wordpress/primitives": "^4.
|
|
49
|
-
"@wordpress/url": "^4.
|
|
50
|
-
"@wordpress/warning": "^3.
|
|
57
|
+
"@wordpress/data": "^10.48.0",
|
|
58
|
+
"@wordpress/element": "^8.0.0",
|
|
59
|
+
"@wordpress/icons": "^13.3.0",
|
|
60
|
+
"@wordpress/primitives": "^4.48.0",
|
|
61
|
+
"@wordpress/url": "^4.48.0",
|
|
62
|
+
"@wordpress/warning": "^3.48.0",
|
|
51
63
|
"clsx": "^2.1.1",
|
|
52
|
-
"i18n-calypso": "^7.4.
|
|
64
|
+
"i18n-calypso": "^7.4.1",
|
|
53
65
|
"react-intersection-observer": "^9.4.3",
|
|
54
66
|
"react-transition-group": "^4.3.0"
|
|
55
67
|
},
|
|
56
68
|
"peerDependencies": {
|
|
57
|
-
"@wordpress/i18n": "^
|
|
69
|
+
"@wordpress/i18n": "^6.21.0",
|
|
58
70
|
"postcss": "^8.5.3",
|
|
59
|
-
"react": "^18.3.1",
|
|
60
|
-
"react-dom": "^18.3.1"
|
|
71
|
+
"react": "^18.3.1 || ^19.0.0",
|
|
72
|
+
"react-dom": "^18.3.1 || ^19.0.0"
|
|
61
73
|
},
|
|
62
74
|
"devDependencies": {
|
|
63
|
-
"@automattic/calypso-build": "^
|
|
75
|
+
"@automattic/calypso-build": "^11.0.0",
|
|
64
76
|
"@automattic/calypso-color-schemes": "^4.0.0",
|
|
65
|
-
"@automattic/calypso-storybook": "^1.0.
|
|
77
|
+
"@automattic/calypso-storybook": "^1.0.1",
|
|
66
78
|
"@automattic/calypso-typescript-config": "^1.0.0",
|
|
67
|
-
"@automattic/shopping-cart": "^2.0.
|
|
68
|
-
"@
|
|
69
|
-
"@
|
|
70
|
-
"@
|
|
71
|
-
"@testing-library/dom": "^10.4.0",
|
|
72
|
-
"@testing-library/jest-dom": "^6.6.3",
|
|
73
|
-
"@testing-library/react": "^16.2.0",
|
|
79
|
+
"@automattic/shopping-cart": "^2.0.2",
|
|
80
|
+
"@testing-library/dom": "^10.4.1",
|
|
81
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
82
|
+
"@testing-library/react": "^16.3.2",
|
|
74
83
|
"@testing-library/user-event": "^14.6.1",
|
|
75
84
|
"msw": "^2.2.14",
|
|
76
|
-
"msw-storybook-addon": "^2.0.
|
|
85
|
+
"msw-storybook-addon": "^2.0.7",
|
|
77
86
|
"resize-observer-polyfill": "^1.5.1",
|
|
78
|
-
"
|
|
79
|
-
"
|
|
87
|
+
"storybook": "^9.1.20",
|
|
88
|
+
"typescript": "^6.0.3",
|
|
89
|
+
"webpack": "^5.99.8"
|
|
80
90
|
},
|
|
81
91
|
"msw": {
|
|
82
92
|
"workerDirectory": "static"
|
package/src/_shared.scss
CHANGED
|
@@ -47,10 +47,11 @@ $mobile-card-max-width: 440px;
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
.plans-grid-next-storage-dropdown__option {
|
|
50
|
-
display:
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
flex-wrap: wrap;
|
|
51
53
|
line-height: 20px;
|
|
52
54
|
min-height: 30px;
|
|
53
|
-
padding-top: 5px;
|
|
54
55
|
font-size: 0.75rem;
|
|
55
56
|
text-align: start;
|
|
56
57
|
}
|
|
@@ -130,7 +131,7 @@ $storage-feature-label-y-padding: 4px;
|
|
|
130
131
|
font-size: 0.75rem;
|
|
131
132
|
|
|
132
133
|
/**************
|
|
133
|
-
|
|
134
|
+
* 1. General *
|
|
134
135
|
**************/
|
|
135
136
|
|
|
136
137
|
.components-custom-select-control__label {
|