@automattic/plans-grid-next 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (339) hide show
  1. package/CHANGELOG.md +4 -1
  2. package/dist/cjs/_shared.scss +4 -3
  3. package/dist/cjs/components/comparison-grid/index.js +101 -71
  4. package/dist/cjs/components/comparison-grid/index.js.map +1 -1
  5. package/dist/cjs/components/comparison-grid/index.stories.js.map +1 -1
  6. package/dist/cjs/components/comparison-grid/style.scss +10 -2
  7. package/dist/cjs/components/features-grid/client-logo-list/client-list.js +0 -12
  8. package/dist/cjs/components/features-grid/client-logo-list/client-list.js.map +1 -1
  9. package/dist/cjs/components/features-grid/index.js +9 -6
  10. package/dist/cjs/components/features-grid/index.js.map +1 -1
  11. package/dist/cjs/components/features-grid/plan-features-list.js +10 -3
  12. package/dist/cjs/components/features-grid/plan-features-list.js.map +1 -1
  13. package/dist/cjs/components/features-grid/plan-headers.js +2 -2
  14. package/dist/cjs/components/features-grid/plan-headers.js.map +1 -1
  15. package/dist/cjs/components/features-grid/plan-tagline.js +1 -1
  16. package/dist/cjs/components/features-grid/plan-tagline.js.map +1 -1
  17. package/dist/cjs/components/features-grid/style.scss +111 -21
  18. package/dist/cjs/components/features-grid/table.js +1 -1
  19. package/dist/cjs/components/features-grid/table.js.map +1 -1
  20. package/dist/cjs/components/features.js +43 -4
  21. package/dist/cjs/components/features.js.map +1 -1
  22. package/dist/cjs/components/item.js +1 -1
  23. package/dist/cjs/components/item.js.map +1 -1
  24. package/dist/cjs/components/plan-button/index.js +5 -3
  25. package/dist/cjs/components/plan-button/index.js.map +1 -1
  26. package/dist/cjs/components/plan-button/style.scss +71 -47
  27. package/dist/cjs/components/plan-div-td-container.js +4 -1
  28. package/dist/cjs/components/plan-div-td-container.js.map +1 -1
  29. package/dist/cjs/components/plan-logo.js +6 -3
  30. package/dist/cjs/components/plan-logo.js.map +1 -1
  31. package/dist/cjs/components/plan-type-selector/components/interval-type-dropdown.js +12 -1
  32. package/dist/cjs/components/plan-type-selector/components/interval-type-dropdown.js.map +1 -1
  33. package/dist/cjs/components/plan-type-selector/hooks/use-max-discount.js +4 -33
  34. package/dist/cjs/components/plan-type-selector/hooks/use-max-discount.js.map +1 -1
  35. package/dist/cjs/components/plan-type-selector/hooks/use-max-discounts-for-plan-terms.js +11 -13
  36. package/dist/cjs/components/plan-type-selector/hooks/use-max-discounts-for-plan-terms.js.map +1 -1
  37. package/dist/cjs/components/plans-2023-tooltip.js +16 -5
  38. package/dist/cjs/components/plans-2023-tooltip.js.map +1 -1
  39. package/dist/cjs/components/shared/action-button/index.js +22 -7
  40. package/dist/cjs/components/shared/action-button/index.js.map +1 -1
  41. package/dist/cjs/components/shared/action-button/style.scss +4 -0
  42. package/dist/cjs/components/shared/billing-timeframe/index.js +8 -4
  43. package/dist/cjs/components/shared/billing-timeframe/index.js.map +1 -1
  44. package/dist/cjs/components/shared/header-price/index.js +60 -15
  45. package/dist/cjs/components/shared/header-price/index.js.map +1 -1
  46. package/dist/cjs/components/shared/header-price/style.scss +10 -2
  47. package/dist/cjs/components/shared/storage/components/plan-storage.js +2 -2
  48. package/dist/cjs/components/shared/storage/components/plan-storage.js.map +1 -1
  49. package/dist/cjs/components/shared/storage/components/storage-dropdown.js +29 -6
  50. package/dist/cjs/components/shared/storage/components/storage-dropdown.js.map +1 -1
  51. package/dist/cjs/components/shared/storage/components/storage-feature-label.js +2 -1
  52. package/dist/cjs/components/shared/storage/components/storage-feature-label.js.map +1 -1
  53. package/dist/cjs/components/shared/storage/hooks/use-plan-storage.js +2 -0
  54. package/dist/cjs/components/shared/storage/hooks/use-plan-storage.js.map +1 -1
  55. package/dist/cjs/fixtures/sites-purchases.js +2 -4
  56. package/dist/cjs/fixtures/sites-purchases.js.map +1 -1
  57. package/dist/cjs/grid-context.js +4 -1
  58. package/dist/cjs/grid-context.js.map +1 -1
  59. package/dist/cjs/hooks/data-store/get-renewal-pricing-text.js +50 -0
  60. package/dist/cjs/hooks/data-store/get-renewal-pricing-text.js.map +1 -0
  61. package/dist/cjs/hooks/data-store/use-grid-plans-for-comparison-grid.js +6 -1
  62. package/dist/cjs/hooks/data-store/use-grid-plans-for-comparison-grid.js.map +1 -1
  63. package/dist/cjs/hooks/data-store/use-grid-plans-for-features-grid.js +6 -1
  64. package/dist/cjs/hooks/data-store/use-grid-plans-for-features-grid.js.map +1 -1
  65. package/dist/cjs/hooks/data-store/use-grid-plans.js +175 -21
  66. package/dist/cjs/hooks/data-store/use-grid-plans.js.map +1 -1
  67. package/dist/cjs/hooks/data-store/use-highlight-labels.js +13 -4
  68. package/dist/cjs/hooks/data-store/use-highlight-labels.js.map +1 -1
  69. package/dist/cjs/hooks/data-store/use-plan-billing-description.js +68 -13
  70. package/dist/cjs/hooks/data-store/use-plan-billing-description.js.map +1 -1
  71. package/dist/cjs/hooks/data-store/use-plan-billing-period.js +14 -0
  72. package/dist/cjs/hooks/data-store/use-plan-billing-period.js.map +1 -0
  73. package/dist/cjs/hooks/data-store/use-plan-features-for-grid-plans.js +76 -2
  74. package/dist/cjs/hooks/data-store/use-plan-features-for-grid-plans.js.map +1 -1
  75. package/dist/cjs/hooks/data-store/use-restructured-plan-features-for-comparison-grid.js +60 -12
  76. package/dist/cjs/hooks/data-store/use-restructured-plan-features-for-comparison-grid.js.map +1 -1
  77. package/dist/cjs/hooks/data-store/use-title-badges.js +19 -0
  78. package/dist/cjs/hooks/data-store/use-title-badges.js.map +1 -0
  79. package/dist/cjs/hooks/use-grid-size.js.map +1 -1
  80. package/dist/cjs/hooks/use-is-large-currency.js +2 -2
  81. package/dist/cjs/hooks/use-is-large-currency.js.map +1 -1
  82. package/dist/cjs/hooks/use-visible-grid-plans.js +70 -0
  83. package/dist/cjs/hooks/use-visible-grid-plans.js.map +1 -0
  84. package/dist/cjs/index.js +8 -1
  85. package/dist/cjs/index.js.map +1 -1
  86. package/dist/cjs/lib/get-plan-features-object.js +15 -2
  87. package/dist/cjs/lib/get-plan-features-object.js.map +1 -1
  88. package/dist/cjs/lib/plan-pricing-utils.js +135 -0
  89. package/dist/cjs/lib/plan-pricing-utils.js.map +1 -0
  90. package/dist/esm/_shared.scss +4 -3
  91. package/dist/esm/components/comparison-grid/index.js +102 -72
  92. package/dist/esm/components/comparison-grid/index.js.map +1 -1
  93. package/dist/esm/components/comparison-grid/index.stories.js.map +1 -1
  94. package/dist/esm/components/comparison-grid/style.scss +10 -2
  95. package/dist/esm/components/features-grid/client-logo-list/client-list.js +0 -12
  96. package/dist/esm/components/features-grid/client-logo-list/client-list.js.map +1 -1
  97. package/dist/esm/components/features-grid/index.js +9 -6
  98. package/dist/esm/components/features-grid/index.js.map +1 -1
  99. package/dist/esm/components/features-grid/plan-features-list.js +10 -3
  100. package/dist/esm/components/features-grid/plan-features-list.js.map +1 -1
  101. package/dist/esm/components/features-grid/plan-headers.js +3 -3
  102. package/dist/esm/components/features-grid/plan-headers.js.map +1 -1
  103. package/dist/esm/components/features-grid/plan-tagline.js +1 -1
  104. package/dist/esm/components/features-grid/plan-tagline.js.map +1 -1
  105. package/dist/esm/components/features-grid/style.scss +111 -21
  106. package/dist/esm/components/features-grid/table.js +1 -1
  107. package/dist/esm/components/features-grid/table.js.map +1 -1
  108. package/dist/esm/components/features.js +44 -5
  109. package/dist/esm/components/features.js.map +1 -1
  110. package/dist/esm/components/item.js +1 -1
  111. package/dist/esm/components/item.js.map +1 -1
  112. package/dist/esm/components/plan-button/index.js +5 -3
  113. package/dist/esm/components/plan-button/index.js.map +1 -1
  114. package/dist/esm/components/plan-button/style.scss +71 -47
  115. package/dist/esm/components/plan-div-td-container.js +4 -1
  116. package/dist/esm/components/plan-div-td-container.js.map +1 -1
  117. package/dist/esm/components/plan-logo.js +7 -4
  118. package/dist/esm/components/plan-logo.js.map +1 -1
  119. package/dist/esm/components/plan-type-selector/components/interval-type-dropdown.js +12 -1
  120. package/dist/esm/components/plan-type-selector/components/interval-type-dropdown.js.map +1 -1
  121. package/dist/esm/components/plan-type-selector/hooks/use-max-discount.js +3 -33
  122. package/dist/esm/components/plan-type-selector/hooks/use-max-discount.js.map +1 -1
  123. package/dist/esm/components/plan-type-selector/hooks/use-max-discounts-for-plan-terms.js +11 -13
  124. package/dist/esm/components/plan-type-selector/hooks/use-max-discounts-for-plan-terms.js.map +1 -1
  125. package/dist/esm/components/plans-2023-tooltip.js +16 -5
  126. package/dist/esm/components/plans-2023-tooltip.js.map +1 -1
  127. package/dist/esm/components/shared/action-button/index.js +22 -7
  128. package/dist/esm/components/shared/action-button/index.js.map +1 -1
  129. package/dist/esm/components/shared/action-button/style.scss +4 -0
  130. package/dist/esm/components/shared/billing-timeframe/index.js +8 -4
  131. package/dist/esm/components/shared/billing-timeframe/index.js.map +1 -1
  132. package/dist/esm/components/shared/header-price/index.js +60 -15
  133. package/dist/esm/components/shared/header-price/index.js.map +1 -1
  134. package/dist/esm/components/shared/header-price/style.scss +10 -2
  135. package/dist/esm/components/shared/storage/components/plan-storage.js +2 -2
  136. package/dist/esm/components/shared/storage/components/plan-storage.js.map +1 -1
  137. package/dist/esm/components/shared/storage/components/storage-dropdown.js +30 -7
  138. package/dist/esm/components/shared/storage/components/storage-dropdown.js.map +1 -1
  139. package/dist/esm/components/shared/storage/components/storage-feature-label.js +2 -1
  140. package/dist/esm/components/shared/storage/components/storage-feature-label.js.map +1 -1
  141. package/dist/esm/components/shared/storage/hooks/use-plan-storage.js +3 -1
  142. package/dist/esm/components/shared/storage/hooks/use-plan-storage.js.map +1 -1
  143. package/dist/esm/fixtures/sites-purchases.js +2 -4
  144. package/dist/esm/fixtures/sites-purchases.js.map +1 -1
  145. package/dist/esm/grid-context.js +4 -1
  146. package/dist/esm/grid-context.js.map +1 -1
  147. package/dist/esm/hooks/data-store/get-renewal-pricing-text.js +47 -0
  148. package/dist/esm/hooks/data-store/get-renewal-pricing-text.js.map +1 -0
  149. package/dist/esm/hooks/data-store/use-grid-plans-for-comparison-grid.js +6 -1
  150. package/dist/esm/hooks/data-store/use-grid-plans-for-comparison-grid.js.map +1 -1
  151. package/dist/esm/hooks/data-store/use-grid-plans-for-features-grid.js +6 -1
  152. package/dist/esm/hooks/data-store/use-grid-plans-for-features-grid.js.map +1 -1
  153. package/dist/esm/hooks/data-store/use-grid-plans.js +176 -22
  154. package/dist/esm/hooks/data-store/use-grid-plans.js.map +1 -1
  155. package/dist/esm/hooks/data-store/use-highlight-labels.js +14 -5
  156. package/dist/esm/hooks/data-store/use-highlight-labels.js.map +1 -1
  157. package/dist/esm/hooks/data-store/use-plan-billing-description.js +66 -11
  158. package/dist/esm/hooks/data-store/use-plan-billing-description.js.map +1 -1
  159. package/dist/esm/hooks/data-store/use-plan-billing-period.js +12 -0
  160. package/dist/esm/hooks/data-store/use-plan-billing-period.js.map +1 -0
  161. package/dist/esm/hooks/data-store/use-plan-features-for-grid-plans.js +77 -3
  162. package/dist/esm/hooks/data-store/use-plan-features-for-grid-plans.js.map +1 -1
  163. package/dist/esm/hooks/data-store/use-restructured-plan-features-for-comparison-grid.js +59 -11
  164. package/dist/esm/hooks/data-store/use-restructured-plan-features-for-comparison-grid.js.map +1 -1
  165. package/dist/esm/hooks/data-store/use-title-badges.js +17 -0
  166. package/dist/esm/hooks/data-store/use-title-badges.js.map +1 -0
  167. package/dist/esm/hooks/use-grid-size.js.map +1 -1
  168. package/dist/esm/hooks/use-is-large-currency.js +1 -1
  169. package/dist/esm/hooks/use-is-large-currency.js.map +1 -1
  170. package/dist/esm/hooks/use-visible-grid-plans.js +66 -0
  171. package/dist/esm/hooks/use-visible-grid-plans.js.map +1 -0
  172. package/dist/esm/index.js +4 -1
  173. package/dist/esm/index.js.map +1 -1
  174. package/dist/esm/lib/get-plan-features-object.js +15 -2
  175. package/dist/esm/lib/get-plan-features-object.js.map +1 -1
  176. package/dist/esm/lib/plan-pricing-utils.js +129 -0
  177. package/dist/esm/lib/plan-pricing-utils.js.map +1 -0
  178. package/dist/tsconfig-cjs.tsbuildinfo +1 -1
  179. package/dist/tsconfig.tsbuildinfo +1 -1
  180. package/dist/types/components/comparison-grid/index.d.ts +1 -1
  181. package/dist/types/components/comparison-grid/index.d.ts.map +1 -1
  182. package/dist/types/components/comparison-grid/index.stories.d.ts +2 -2
  183. package/dist/types/components/dropdown-option.d.ts.map +1 -1
  184. package/dist/types/components/features-grid/billing-timeframes.d.ts.map +1 -1
  185. package/dist/types/components/features-grid/client-logo-list/client-list.d.ts.map +1 -1
  186. package/dist/types/components/features-grid/client-logo-list/index.d.ts.map +1 -1
  187. package/dist/types/components/features-grid/enterprise-features.d.ts.map +1 -1
  188. package/dist/types/components/features-grid/index.d.ts.map +1 -1
  189. package/dist/types/components/features-grid/plan-features-list.d.ts.map +1 -1
  190. package/dist/types/components/features-grid/plan-headers.d.ts +2 -0
  191. package/dist/types/components/features-grid/plan-headers.d.ts.map +1 -1
  192. package/dist/types/components/features-grid/plan-logos.d.ts.map +1 -1
  193. package/dist/types/components/features-grid/plan-prices.d.ts.map +1 -1
  194. package/dist/types/components/features-grid/plan-tagline.d.ts.map +1 -1
  195. package/dist/types/components/features-grid/previous-features-included-title.d.ts.map +1 -1
  196. package/dist/types/components/features-grid/spotlight-plan.d.ts.map +1 -1
  197. package/dist/types/components/features-grid/table.d.ts.map +1 -1
  198. package/dist/types/components/features-grid/top-buttons.d.ts.map +1 -1
  199. package/dist/types/components/features.d.ts.map +1 -1
  200. package/dist/types/components/item.d.ts +2 -1
  201. package/dist/types/components/item.d.ts.map +1 -1
  202. package/dist/types/components/plan-button/index.d.ts +2 -1
  203. package/dist/types/components/plan-button/index.d.ts.map +1 -1
  204. package/dist/types/components/plan-div-td-container.d.ts +2 -0
  205. package/dist/types/components/plan-div-td-container.d.ts.map +1 -1
  206. package/dist/types/components/plan-logo.d.ts.map +1 -1
  207. package/dist/types/components/plan-type-selector/components/interval-type-dropdown.d.ts.map +1 -1
  208. package/dist/types/components/plan-type-selector/hooks/use-max-discount.d.ts.map +1 -1
  209. package/dist/types/components/plan-type-selector/hooks/use-max-discounts-for-plan-terms.d.ts.map +1 -1
  210. package/dist/types/components/plans-2023-tooltip.d.ts.map +1 -1
  211. package/dist/types/components/shared/action-button/index.d.ts +2 -1
  212. package/dist/types/components/shared/action-button/index.d.ts.map +1 -1
  213. package/dist/types/components/shared/billing-timeframe/index.d.ts.map +1 -1
  214. package/dist/types/components/shared/header-price/header-price-context.d.ts.map +1 -1
  215. package/dist/types/components/shared/header-price/index.d.ts.map +1 -1
  216. package/dist/types/components/shared/storage/components/plan-storage.d.ts.map +1 -1
  217. package/dist/types/components/shared/storage/components/storage-dropdown.d.ts.map +1 -1
  218. package/dist/types/components/shared/storage/components/storage-feature-label.d.ts.map +1 -1
  219. package/dist/types/components/shared/storage/hooks/use-plan-storage.d.ts +1 -1
  220. package/dist/types/components/shared/storage/hooks/use-plan-storage.d.ts.map +1 -1
  221. package/dist/types/css-mixins.d.ts.map +1 -1
  222. package/dist/types/fixtures/sites-purchases.d.ts +2 -4
  223. package/dist/types/fixtures/sites-purchases.d.ts.map +1 -1
  224. package/dist/types/grid-context.d.ts +4 -1
  225. package/dist/types/grid-context.d.ts.map +1 -1
  226. package/dist/types/hooks/data-store/get-renewal-pricing-text.d.ts +14 -0
  227. package/dist/types/hooks/data-store/get-renewal-pricing-text.d.ts.map +1 -0
  228. package/dist/types/hooks/data-store/types.d.ts +21 -0
  229. package/dist/types/hooks/data-store/types.d.ts.map +1 -1
  230. package/dist/types/hooks/data-store/use-grid-plan-for-spotlight.d.ts.map +1 -1
  231. package/dist/types/hooks/data-store/use-grid-plans-for-comparison-grid.d.ts +1 -1
  232. package/dist/types/hooks/data-store/use-grid-plans-for-comparison-grid.d.ts.map +1 -1
  233. package/dist/types/hooks/data-store/use-grid-plans-for-features-grid.d.ts +1 -1
  234. package/dist/types/hooks/data-store/use-grid-plans-for-features-grid.d.ts.map +1 -1
  235. package/dist/types/hooks/data-store/use-grid-plans.d.ts.map +1 -1
  236. package/dist/types/hooks/data-store/use-highlight-labels.d.ts.map +1 -1
  237. package/dist/types/hooks/data-store/use-plan-billing-description.d.ts.map +1 -1
  238. package/dist/types/hooks/data-store/use-plan-billing-period.d.ts +8 -0
  239. package/dist/types/hooks/data-store/use-plan-billing-period.d.ts.map +1 -0
  240. package/dist/types/hooks/data-store/use-plan-features-for-grid-plans.d.ts +4 -1
  241. package/dist/types/hooks/data-store/use-plan-features-for-grid-plans.d.ts.map +1 -1
  242. package/dist/types/hooks/data-store/use-plans-from-types.d.ts.map +1 -1
  243. package/dist/types/hooks/data-store/use-restructured-plan-features-for-comparison-grid.d.ts +4 -1
  244. package/dist/types/hooks/data-store/use-restructured-plan-features-for-comparison-grid.d.ts.map +1 -1
  245. package/dist/types/hooks/data-store/use-title-badges.d.ts +9 -0
  246. package/dist/types/hooks/data-store/use-title-badges.d.ts.map +1 -0
  247. package/dist/types/hooks/use-grid-size.d.ts +3 -2
  248. package/dist/types/hooks/use-grid-size.d.ts.map +1 -1
  249. package/dist/types/hooks/use-highlight-adjacency-matrix.d.ts.map +1 -1
  250. package/dist/types/hooks/use-visible-grid-plans.d.ts +14 -0
  251. package/dist/types/hooks/use-visible-grid-plans.d.ts.map +1 -0
  252. package/dist/types/index.d.ts +9 -1
  253. package/dist/types/index.d.ts.map +1 -1
  254. package/dist/types/lib/filter-unused-features-object.d.ts.map +1 -1
  255. package/dist/types/lib/get-plan-features-object.d.ts +1 -1
  256. package/dist/types/lib/get-plan-features-object.d.ts.map +1 -1
  257. package/dist/types/lib/plan-pricing-utils.d.ts +105 -0
  258. package/dist/types/lib/plan-pricing-utils.d.ts.map +1 -0
  259. package/dist/types/types.d.ts +33 -6
  260. package/dist/types/types.d.ts.map +1 -1
  261. package/package.json +39 -28
  262. package/src/_shared.scss +4 -3
  263. package/src/components/comparison-grid/index.stories.tsx +1 -1
  264. package/src/components/comparison-grid/index.tsx +263 -158
  265. package/src/components/comparison-grid/style.scss +10 -2
  266. package/src/components/features-grid/client-logo-list/client-list.tsx +0 -25
  267. package/src/components/features-grid/index.tsx +37 -19
  268. package/src/components/features-grid/plan-features-list.tsx +15 -4
  269. package/src/components/features-grid/plan-headers.tsx +10 -3
  270. package/src/components/features-grid/plan-tagline.tsx +1 -1
  271. package/src/components/features-grid/style.scss +111 -21
  272. package/src/components/features-grid/table.tsx +4 -2
  273. package/src/components/features.tsx +66 -6
  274. package/src/components/item.tsx +6 -3
  275. package/src/components/plan-button/index.tsx +7 -1
  276. package/src/components/plan-button/style.scss +71 -47
  277. package/src/components/plan-div-td-container.tsx +6 -2
  278. package/src/components/plan-logo.tsx +16 -9
  279. package/src/components/plan-type-selector/components/interval-type-dropdown.tsx +14 -1
  280. package/src/components/plan-type-selector/hooks/use-max-discount.ts +8 -47
  281. package/src/components/plan-type-selector/hooks/use-max-discounts-for-plan-terms.ts +19 -17
  282. package/src/components/plans-2023-tooltip.tsx +17 -5
  283. package/src/components/shared/action-button/index.tsx +46 -5
  284. package/src/components/shared/action-button/style.scss +4 -0
  285. package/src/components/shared/billing-timeframe/index.tsx +12 -7
  286. package/src/components/shared/header-price/index.tsx +129 -27
  287. package/src/components/shared/header-price/style.scss +10 -2
  288. package/src/components/shared/storage/components/plan-storage.tsx +2 -2
  289. package/src/components/shared/storage/components/storage-dropdown.tsx +36 -15
  290. package/src/components/shared/storage/components/storage-feature-label.tsx +2 -1
  291. package/src/components/shared/storage/hooks/use-plan-storage.ts +3 -0
  292. package/src/components/test/actions-button.tsx +5 -0
  293. package/src/components/test/billing-timeframe.tsx +1 -1
  294. package/src/components/test/header-price.tsx +342 -4
  295. package/src/fixtures/sites-purchases.ts +2 -4
  296. package/src/grid-context.tsx +9 -0
  297. package/src/hooks/data-store/get-renewal-pricing-text.ts +73 -0
  298. package/src/hooks/data-store/types.ts +21 -0
  299. package/src/hooks/data-store/use-grid-plans-for-comparison-grid.ts +10 -0
  300. package/src/hooks/data-store/use-grid-plans-for-features-grid.ts +10 -0
  301. package/src/hooks/data-store/use-grid-plans.tsx +189 -23
  302. package/src/hooks/data-store/use-highlight-labels.ts +12 -3
  303. package/src/hooks/data-store/use-plan-billing-description.tsx +80 -15
  304. package/src/hooks/data-store/use-plan-billing-period.tsx +28 -0
  305. package/src/hooks/data-store/use-plan-features-for-grid-plans.ts +135 -1
  306. package/src/hooks/data-store/use-restructured-plan-features-for-comparison-grid.ts +93 -20
  307. package/src/hooks/data-store/use-title-badges.ts +31 -0
  308. package/src/hooks/test/use-visible-grid-plans.tsx +116 -0
  309. package/src/hooks/use-grid-size.ts +3 -2
  310. package/src/hooks/use-is-large-currency.ts +1 -1
  311. package/src/hooks/use-visible-grid-plans.tsx +102 -0
  312. package/src/index.tsx +20 -0
  313. package/src/lib/get-plan-features-object.ts +23 -2
  314. package/src/lib/plan-pricing-utils.ts +211 -0
  315. package/src/lib/test/plan-pricing-utils.ts +594 -0
  316. package/src/style-imports.d.ts +3 -0
  317. package/src/types.ts +45 -4
  318. package/dist/cjs/components/features-grid/mobile-free-domain.js +0 -25
  319. package/dist/cjs/components/features-grid/mobile-free-domain.js.map +0 -1
  320. package/dist/cjs/lib/get-plan-pricing-info-from-grid-plans.js +0 -15
  321. package/dist/cjs/lib/get-plan-pricing-info-from-grid-plans.js.map +0 -1
  322. package/dist/cjs/lib/sort-plan-properties.js +0 -26
  323. package/dist/cjs/lib/sort-plan-properties.js.map +0 -1
  324. package/dist/esm/components/features-grid/mobile-free-domain.js +0 -23
  325. package/dist/esm/components/features-grid/mobile-free-domain.js.map +0 -1
  326. package/dist/esm/lib/get-plan-pricing-info-from-grid-plans.js +0 -12
  327. package/dist/esm/lib/get-plan-pricing-info-from-grid-plans.js.map +0 -1
  328. package/dist/esm/lib/sort-plan-properties.js +0 -23
  329. package/dist/esm/lib/sort-plan-properties.js.map +0 -1
  330. package/dist/types/components/features-grid/mobile-free-domain.d.ts +0 -8
  331. package/dist/types/components/features-grid/mobile-free-domain.d.ts.map +0 -1
  332. package/dist/types/lib/get-plan-pricing-info-from-grid-plans.d.ts +0 -9
  333. package/dist/types/lib/get-plan-pricing-info-from-grid-plans.d.ts.map +0 -1
  334. package/dist/types/lib/sort-plan-properties.d.ts +0 -3
  335. package/dist/types/lib/sort-plan-properties.d.ts.map +0 -1
  336. package/src/components/features-grid/mobile-free-domain.tsx +0 -51
  337. package/src/lib/get-plan-pricing-info-from-grid-plans.ts +0 -31
  338. package/src/lib/sort-plan-properties.ts +0 -27
  339. package/src/lib/test/sort-plan-properties.ts +0 -122
package/src/types.ts CHANGED
@@ -18,6 +18,14 @@ export type TransformedFeatureObject = FeatureObject & {
18
18
  availableForCurrentPlan: boolean;
19
19
  availableOnlyForAnnualPlans: boolean;
20
20
  isHighlighted?: boolean;
21
+ /**
22
+ * When true, extra bottom margin on the last feature row for pricing experiment variants.
23
+ */
24
+ isExperimentLastFeature?: boolean;
25
+ /**
26
+ * Badge text to display after the feature title (e.g. pricing differentiators pills).
27
+ */
28
+ badgeText?: TranslateResult;
21
29
  };
22
30
 
23
31
  export interface PlanFeaturesForGridPlan {
@@ -45,16 +53,18 @@ export interface GridPlan {
45
53
  product_slug: string;
46
54
  } | null;
47
55
  highlightLabel?: React.ReactNode | null;
56
+ titleBadge?: React.ReactNode | null;
48
57
  }
49
58
 
50
59
  /***********************
51
60
  * Grid Component Types:
52
61
  ***********************/
53
62
 
54
- export type GridSize = 'small' | 'medium' | 'large';
63
+ export type GridSize = 'small' | 'smedium' | 'medium' | 'large' | 'xlarge';
55
64
 
56
65
  export type PlansIntent =
57
66
  | 'plans-affiliate'
67
+ | 'plans-ai-assembler-free-trial'
58
68
  | 'plans-blog-onboarding'
59
69
  | 'plans-newsletter'
60
70
  | 'plans-new-hosted-site'
@@ -74,6 +84,15 @@ export type PlansIntent =
74
84
  | 'plans-guided-segment-nonprofit'
75
85
  | 'plans-guided-segment-consumer-or-business'
76
86
  | 'plans-site-selected-legacy'
87
+ | 'plans-playground'
88
+ | 'plans-playground-premium' // This plan intent is currently not utilized but will be soon
89
+ | 'plans-upgrade'
90
+ | 'plans-upgrade-or-downgrade'
91
+ | 'plans-wordpress-hosting'
92
+ | 'plans-website-builder'
93
+ | 'plans-woo-hosted'
94
+ | 'plans-woo-hosting-solutions'
95
+ | 'plans-migration'
77
96
  | 'default';
78
97
 
79
98
  export interface PlanActionOverrides {
@@ -106,7 +125,7 @@ export interface CommonGridProps {
106
125
  isInAdmin: boolean;
107
126
  isInSiteDashboard: boolean;
108
127
  onStorageAddOnClick?: ( addOnSlug: AddOns.StorageAddOnSlug ) => void;
109
- currentSitePlanSlug?: string | null;
128
+ currentSitePlanSlug?: PlanSlug | null;
110
129
  hideUnavailableFeatures?: boolean; // used to hide features that are not available, instead of strike-through as explained in #76206
111
130
  planActionOverrides?: PlanActionOverrides;
112
131
  // Value of the `?feature=` query param, so we can highlight a given feature and hide plans without it.
@@ -117,7 +136,7 @@ export interface CommonGridProps {
117
136
  // only used for comparison grid
118
137
  planTypeSelectorProps?: PlanTypeSelectorProps;
119
138
  gridContainerRef?: React.MutableRefObject< HTMLDivElement | null >;
120
- gridSize?: string;
139
+ gridSize?: GridSize;
121
140
  }
122
141
 
123
142
  export interface FeaturesGridProps extends CommonGridProps {
@@ -134,7 +153,9 @@ export interface FeaturesGridProps extends CommonGridProps {
134
153
  export interface ComparisonGridProps extends CommonGridProps {
135
154
  // Value of the `?plan=` query param, so we can highlight a given plan.
136
155
  selectedPlan?: string;
137
- intervalType: string;
156
+ intervalType: SupportedUrlFriendlyTermType;
157
+ /** Called when the number of visible plans in the grid changes (e.g. for narrowing the container). */
158
+ onVisiblePlansCountChange?: ( count: number ) => void;
138
159
  }
139
160
 
140
161
  export type UseActionCallback = ( {
@@ -152,6 +173,7 @@ export type UseActionCallback = ( {
152
173
  export interface GridAction {
153
174
  primary: {
154
175
  text: TranslateResult;
176
+ ariaLabel?: TranslateResult;
155
177
  callback: () => Promise< void > | void;
156
178
  // TODO: It's not clear if status is ever actually set to 'blocked'. Investigate and remove if not.
157
179
  status?: 'disabled' | 'blocked' | 'enabled';
@@ -172,6 +194,8 @@ export type UseAction = ( {
172
194
  planTitle,
173
195
  priceString,
174
196
  selectedStorageAddOn,
197
+ pricing,
198
+ isMonthlyPlan,
175
199
  }: {
176
200
  availableForPurchase?: boolean;
177
201
  billingPeriod?: PlanPricing[ 'billPeriod' ];
@@ -184,6 +208,8 @@ export type UseAction = ( {
184
208
  planTitle?: TranslateResult;
185
209
  priceString?: string;
186
210
  selectedStorageAddOn?: AddOns.AddOnMeta | null;
211
+ pricing?: Plans.PricingMetaForGridPlan | null;
212
+ isMonthlyPlan?: boolean;
187
213
  } ) => GridAction;
188
214
 
189
215
  export type GridContextProps = {
@@ -239,6 +265,21 @@ export type GridContextProps = {
239
265
  * calculating prices.
240
266
  */
241
267
  reflectStorageSelectionInPlanPrices?: boolean;
268
+
269
+ /**
270
+ * Enable simplified billing description
271
+ */
272
+ showSimplifiedBillingDescription?: boolean;
273
+ /**
274
+ * If, and how to present increased renewal pricing (null or the assigned variant name)
275
+ */
276
+ showBillingDescriptionForIncreasedRenewalPrice?: string | null;
277
+
278
+ /**
279
+ * When true, the user is in the rolled-out pricing differentiation cohort.
280
+ * Used to display cohort-specific feature titles in the comparison grid.
281
+ */
282
+ isExperimentVariant?: boolean;
242
283
  };
243
284
 
244
285
  export type ComparisonGridExternalProps = Omit<
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsx_runtime_1 = require("react/jsx-runtime");
4
- const calypso_products_1 = require("@automattic/calypso-products");
5
- const i18n_calypso_1 = require("i18n-calypso");
6
- const item_1 = require("../item");
7
- const MobileFreeDomain = ({ gridPlan: { planSlug, isMonthlyPlan, features }, paidDomainName, }) => {
8
- const translate = (0, i18n_calypso_1.useTranslate)();
9
- if (isMonthlyPlan || (0, calypso_products_1.isWpComFreePlan)(planSlug) || (0, calypso_products_1.isWpcomEnterpriseGridPlan)(planSlug)) {
10
- return null;
11
- }
12
- // Remove the custom domain feature for Woo Express plans with introductory offer.
13
- if ((0, calypso_products_1.isWooExpressPlan)(planSlug) &&
14
- !features.wpcomFeatures.some((feature) => feature.getSlug() === calypso_products_1.FEATURE_CUSTOM_DOMAIN)) {
15
- return null;
16
- }
17
- const displayText = paidDomainName
18
- ? translate('%(paidDomainName)s is included', {
19
- args: { paidDomainName },
20
- })
21
- : translate('Free domain for one year');
22
- return ((0, jsx_runtime_1.jsx)("div", { className: "plan-features-2023-grid__highlighted-feature", children: (0, jsx_runtime_1.jsx)(item_1.PlanFeaturesItem, { children: (0, jsx_runtime_1.jsx)("span", { className: "plan-features-2023-grid__item-info is-annual-plan-feature is-available", children: (0, jsx_runtime_1.jsx)("span", { className: "plan-features-2023-grid__item-title is-bold", children: displayText }) }) }) }));
23
- };
24
- exports.default = MobileFreeDomain;
25
- //# sourceMappingURL=mobile-free-domain.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mobile-free-domain.js","sourceRoot":"","sources":["../../../../src/components/features-grid/mobile-free-domain.tsx"],"names":[],"mappings":";;;AAAA,mEAKsC;AACtC,+CAA4C;AAE5C,kCAA2C;AAO3C,MAAM,gBAAgB,GAAG,CAAE,EAC1B,QAAQ,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,EAC/C,cAAc,GACS,EAAG,EAAE;IAC5B,MAAM,SAAS,GAAG,IAAA,2BAAY,GAAE,CAAC;IAEjC,IAAK,aAAa,IAAI,IAAA,kCAAe,EAAE,QAAQ,CAAE,IAAI,IAAA,4CAAyB,EAAE,QAAQ,CAAE,EAAG,CAAC;QAC7F,OAAO,IAAI,CAAC;IACb,CAAC;IAED,kFAAkF;IAClF,IACC,IAAA,mCAAgB,EAAE,QAAQ,CAAE;QAC5B,CAAE,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAE,CAAE,OAAO,EAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,wCAAqB,CAAE,EAC1F,CAAC;QACF,OAAO,IAAI,CAAC;IACb,CAAC;IAED,MAAM,WAAW,GAAG,cAAc;QACjC,CAAC,CAAC,SAAS,CAAE,gCAAgC,EAAE;YAC7C,IAAI,EAAE,EAAE,cAAc,EAAE;SACvB,CAAE;QACL,CAAC,CAAC,SAAS,CAAE,0BAA0B,CAAE,CAAC;IAE3C,OAAO,CACN,gCAAK,SAAS,EAAC,8CAA8C,YAC5D,uBAAC,uBAAgB,cAChB,iCAAM,SAAS,EAAC,wEAAwE,YACvF,iCAAM,SAAS,EAAC,6CAA6C,YAAG,WAAW,GAAS,GAC9E,GACW,GACd,CACN,CAAC;AACH,CAAC,CAAC;AAEF,kBAAe,gBAAgB,CAAC"}
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPlanPricingInfoFromGridPlans = getPlanPricingInfoFromGridPlans;
4
- function getPlanPricingInfoFromGridPlans({ gridPlans, returnMonthly = true, }) {
5
- return gridPlans.reduce((acc, gridPlan) => {
6
- const { pricing: { originalPrice, discountedPrice, currencyCode }, } = gridPlan;
7
- const originalPriceForTerm = originalPrice[returnMonthly ? 'monthly' : 'full'] || 0;
8
- const discountedPriceForTerm = discountedPrice[returnMonthly ? 'monthly' : 'full'] || 0;
9
- return {
10
- prices: [...acc.prices, originalPriceForTerm, discountedPriceForTerm],
11
- ...(currencyCode && { currencyCode }),
12
- };
13
- }, { prices: [], currencyCode: 'USD' });
14
- }
15
- //# sourceMappingURL=get-plan-pricing-info-from-grid-plans.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-plan-pricing-info-from-grid-plans.js","sourceRoot":"","sources":["../../../src/lib/get-plan-pricing-info-from-grid-plans.ts"],"names":[],"mappings":";;AAOA,0EAuBC;AAvBD,SAAgB,+BAA+B,CAAE,EAChD,SAAS,EACT,aAAa,GAAG,IAAI,GAIpB;IACA,OAAO,SAAS,CAAC,MAAM,CACtB,CAAE,GAAgB,EAAE,QAAQ,EAAG,EAAE;QAChC,MAAM,EACL,OAAO,EAAE,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,GACzD,GAAG,QAAQ,CAAC;QAEb,MAAM,oBAAoB,GAAG,aAAa,CAAE,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAE,IAAI,CAAC,CAAC;QACtF,MAAM,sBAAsB,GAAG,eAAe,CAAE,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAE,IAAI,CAAC,CAAC;QAE1F,OAAO;YACN,MAAM,EAAE,CAAE,GAAG,GAAG,CAAC,MAAM,EAAE,oBAAoB,EAAE,sBAAsB,CAAE;YACvE,GAAG,CAAE,YAAY,IAAI,EAAE,YAAY,EAAE,CAAE;SACvC,CAAC;IACH,CAAC,EACD,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,CACnC,CAAC;AACH,CAAC"}
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sortPlans = sortPlans;
4
- function sortPlans(gridPlans, currentSitePlanProductSlug) {
5
- // If we don't have plans to sort, return empty array
6
- if (!gridPlans.length) {
7
- return [];
8
- }
9
- // If we have a current site plan and we're on mobile, sort to prioritize it
10
- if (currentSitePlanProductSlug) {
11
- return [...gridPlans].sort((planA, planB) => {
12
- // If planA is the current plan, it should come first (-1 moves it up)
13
- if (planA.planSlug === currentSitePlanProductSlug) {
14
- return -1;
15
- }
16
- // If planB is the current plan, it should come first (1 moves planA down)
17
- if (planB.planSlug === currentSitePlanProductSlug) {
18
- return 1;
19
- }
20
- // Otherwise, maintain original order
21
- return 0;
22
- });
23
- }
24
- return [...gridPlans];
25
- }
26
- //# sourceMappingURL=sort-plan-properties.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sort-plan-properties.js","sourceRoot":"","sources":["../../../src/lib/sort-plan-properties.ts"],"names":[],"mappings":";;AAEA,8BAwBC;AAxBD,SAAgB,SAAS,CACxB,SAAqB,EACrB,0BAA0C;IAE1C,qDAAqD;IACrD,IAAK,CAAE,SAAS,CAAC,MAAM,EAAG,CAAC;QAC1B,OAAO,EAAE,CAAC;IACX,CAAC;IACD,4EAA4E;IAC5E,IAAK,0BAA0B,EAAG,CAAC;QAClC,OAAO,CAAE,GAAG,SAAS,CAAE,CAAC,IAAI,CAAE,CAAE,KAAK,EAAE,KAAK,EAAG,EAAE;YAChD,sEAAsE;YACtE,IAAK,KAAK,CAAC,QAAQ,KAAK,0BAA0B,EAAG,CAAC;gBACrD,OAAO,CAAC,CAAC,CAAC;YACX,CAAC;YACD,0EAA0E;YAC1E,IAAK,KAAK,CAAC,QAAQ,KAAK,0BAA0B,EAAG,CAAC;gBACrD,OAAO,CAAC,CAAC;YACV,CAAC;YACD,qCAAqC;YACrC,OAAO,CAAC,CAAC;QACV,CAAC,CAAE,CAAC;IACL,CAAC;IACD,OAAO,CAAE,GAAG,SAAS,CAAE,CAAC;AACzB,CAAC"}
@@ -1,23 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { FEATURE_CUSTOM_DOMAIN, isWooExpressPlan, isWpComFreePlan, isWpcomEnterpriseGridPlan, } from '@automattic/calypso-products';
3
- import { useTranslate } from 'i18n-calypso';
4
- import { PlanFeaturesItem } from '../item';
5
- const MobileFreeDomain = ({ gridPlan: { planSlug, isMonthlyPlan, features }, paidDomainName, }) => {
6
- const translate = useTranslate();
7
- if (isMonthlyPlan || isWpComFreePlan(planSlug) || isWpcomEnterpriseGridPlan(planSlug)) {
8
- return null;
9
- }
10
- // Remove the custom domain feature for Woo Express plans with introductory offer.
11
- if (isWooExpressPlan(planSlug) &&
12
- !features.wpcomFeatures.some((feature) => feature.getSlug() === FEATURE_CUSTOM_DOMAIN)) {
13
- return null;
14
- }
15
- const displayText = paidDomainName
16
- ? translate('%(paidDomainName)s is included', {
17
- args: { paidDomainName },
18
- })
19
- : translate('Free domain for one year');
20
- return (_jsx("div", { className: "plan-features-2023-grid__highlighted-feature", children: _jsx(PlanFeaturesItem, { children: _jsx("span", { className: "plan-features-2023-grid__item-info is-annual-plan-feature is-available", children: _jsx("span", { className: "plan-features-2023-grid__item-title is-bold", children: displayText }) }) }) }));
21
- };
22
- export default MobileFreeDomain;
23
- //# sourceMappingURL=mobile-free-domain.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mobile-free-domain.js","sourceRoot":"","sources":["../../../../src/components/features-grid/mobile-free-domain.tsx"],"names":[],"mappings":";AAAA,OAAO,EACN,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EACf,yBAAyB,GACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAO3C,MAAM,gBAAgB,GAAG,CAAE,EAC1B,QAAQ,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,EAC/C,cAAc,GACS,EAAG,EAAE;IAC5B,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IAEjC,IAAK,aAAa,IAAI,eAAe,CAAE,QAAQ,CAAE,IAAI,yBAAyB,CAAE,QAAQ,CAAE,EAAG,CAAC;QAC7F,OAAO,IAAI,CAAC;IACb,CAAC;IAED,kFAAkF;IAClF,IACC,gBAAgB,CAAE,QAAQ,CAAE;QAC5B,CAAE,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAE,CAAE,OAAO,EAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,qBAAqB,CAAE,EAC1F,CAAC;QACF,OAAO,IAAI,CAAC;IACb,CAAC;IAED,MAAM,WAAW,GAAG,cAAc;QACjC,CAAC,CAAC,SAAS,CAAE,gCAAgC,EAAE;YAC7C,IAAI,EAAE,EAAE,cAAc,EAAE;SACvB,CAAE;QACL,CAAC,CAAC,SAAS,CAAE,0BAA0B,CAAE,CAAC;IAE3C,OAAO,CACN,cAAK,SAAS,EAAC,8CAA8C,YAC5D,KAAC,gBAAgB,cAChB,eAAM,SAAS,EAAC,wEAAwE,YACvF,eAAM,SAAS,EAAC,6CAA6C,YAAG,WAAW,GAAS,GAC9E,GACW,GACd,CACN,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -1,12 +0,0 @@
1
- export function getPlanPricingInfoFromGridPlans({ gridPlans, returnMonthly = true, }) {
2
- return gridPlans.reduce((acc, gridPlan) => {
3
- const { pricing: { originalPrice, discountedPrice, currencyCode }, } = gridPlan;
4
- const originalPriceForTerm = originalPrice[returnMonthly ? 'monthly' : 'full'] || 0;
5
- const discountedPriceForTerm = discountedPrice[returnMonthly ? 'monthly' : 'full'] || 0;
6
- return {
7
- prices: [...acc.prices, originalPriceForTerm, discountedPriceForTerm],
8
- ...(currencyCode && { currencyCode }),
9
- };
10
- }, { prices: [], currencyCode: 'USD' });
11
- }
12
- //# sourceMappingURL=get-plan-pricing-info-from-grid-plans.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-plan-pricing-info-from-grid-plans.js","sourceRoot":"","sources":["../../../src/lib/get-plan-pricing-info-from-grid-plans.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,+BAA+B,CAAE,EAChD,SAAS,EACT,aAAa,GAAG,IAAI,GAIpB;IACA,OAAO,SAAS,CAAC,MAAM,CACtB,CAAE,GAAgB,EAAE,QAAQ,EAAG,EAAE;QAChC,MAAM,EACL,OAAO,EAAE,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,GACzD,GAAG,QAAQ,CAAC;QAEb,MAAM,oBAAoB,GAAG,aAAa,CAAE,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAE,IAAI,CAAC,CAAC;QACtF,MAAM,sBAAsB,GAAG,eAAe,CAAE,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAE,IAAI,CAAC,CAAC;QAE1F,OAAO;YACN,MAAM,EAAE,CAAE,GAAG,GAAG,CAAC,MAAM,EAAE,oBAAoB,EAAE,sBAAsB,CAAE;YACvE,GAAG,CAAE,YAAY,IAAI,EAAE,YAAY,EAAE,CAAE;SACvC,CAAC;IACH,CAAC,EACD,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,CACnC,CAAC;AACH,CAAC"}
@@ -1,23 +0,0 @@
1
- export function sortPlans(gridPlans, currentSitePlanProductSlug) {
2
- // If we don't have plans to sort, return empty array
3
- if (!gridPlans.length) {
4
- return [];
5
- }
6
- // If we have a current site plan and we're on mobile, sort to prioritize it
7
- if (currentSitePlanProductSlug) {
8
- return [...gridPlans].sort((planA, planB) => {
9
- // If planA is the current plan, it should come first (-1 moves it up)
10
- if (planA.planSlug === currentSitePlanProductSlug) {
11
- return -1;
12
- }
13
- // If planB is the current plan, it should come first (1 moves planA down)
14
- if (planB.planSlug === currentSitePlanProductSlug) {
15
- return 1;
16
- }
17
- // Otherwise, maintain original order
18
- return 0;
19
- });
20
- }
21
- return [...gridPlans];
22
- }
23
- //# sourceMappingURL=sort-plan-properties.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sort-plan-properties.js","sourceRoot":"","sources":["../../../src/lib/sort-plan-properties.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,SAAS,CACxB,SAAqB,EACrB,0BAA0C;IAE1C,qDAAqD;IACrD,IAAK,CAAE,SAAS,CAAC,MAAM,EAAG,CAAC;QAC1B,OAAO,EAAE,CAAC;IACX,CAAC;IACD,4EAA4E;IAC5E,IAAK,0BAA0B,EAAG,CAAC;QAClC,OAAO,CAAE,GAAG,SAAS,CAAE,CAAC,IAAI,CAAE,CAAE,KAAK,EAAE,KAAK,EAAG,EAAE;YAChD,sEAAsE;YACtE,IAAK,KAAK,CAAC,QAAQ,KAAK,0BAA0B,EAAG,CAAC;gBACrD,OAAO,CAAC,CAAC,CAAC;YACX,CAAC;YACD,0EAA0E;YAC1E,IAAK,KAAK,CAAC,QAAQ,KAAK,0BAA0B,EAAG,CAAC;gBACrD,OAAO,CAAC,CAAC;YACV,CAAC;YACD,qCAAqC;YACrC,OAAO,CAAC,CAAC;QACV,CAAC,CAAE,CAAC;IACL,CAAC;IACD,OAAO,CAAE,GAAG,SAAS,CAAE,CAAC;AACzB,CAAC"}
@@ -1,8 +0,0 @@
1
- import { GridPlan } from '../../types';
2
- type MobileFreeDomainProps = {
3
- gridPlan: GridPlan;
4
- paidDomainName?: string;
5
- };
6
- declare const MobileFreeDomain: ({ gridPlan: { planSlug, isMonthlyPlan, features }, paidDomainName, }: MobileFreeDomainProps) => import("react/jsx-runtime").JSX.Element | null;
7
- export default MobileFreeDomain;
8
- //# sourceMappingURL=mobile-free-domain.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mobile-free-domain.d.ts","sourceRoot":"","sources":["../../../../src/components/features-grid/mobile-free-domain.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,KAAK,qBAAqB,GAAG;IAC5B,QAAQ,EAAE,QAAQ,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,QAAA,MAAM,gBAAgB,yEAGnB,qBAAqB,mDA8BvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -1,9 +0,0 @@
1
- import type { GridPlan } from '../types';
2
- export declare function getPlanPricingInfoFromGridPlans({ gridPlans, returnMonthly, }: {
3
- gridPlans: GridPlan[];
4
- returnMonthly?: boolean;
5
- }): {
6
- currencyCode?: string | undefined;
7
- prices: number[];
8
- };
9
- //# sourceMappingURL=get-plan-pricing-info-from-grid-plans.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-plan-pricing-info-from-grid-plans.d.ts","sourceRoot":"","sources":["../../../src/lib/get-plan-pricing-info-from-grid-plans.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAOzC,wBAAgB,+BAA+B,CAAE,EAChD,SAAS,EACT,aAAoB,GACpB,EAAE;IACF,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB;;;EAiBA"}
@@ -1,3 +0,0 @@
1
- import type { GridPlan } from '../types';
2
- export declare function sortPlans(gridPlans: GridPlan[], currentSitePlanProductSlug?: string | null): GridPlan[];
3
- //# sourceMappingURL=sort-plan-properties.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sort-plan-properties.d.ts","sourceRoot":"","sources":["../../../src/lib/sort-plan-properties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,wBAAgB,SAAS,CACxB,SAAS,EAAE,QAAQ,EAAE,EACrB,0BAA0B,CAAC,EAAE,MAAM,GAAG,IAAI,GACxC,QAAQ,EAAE,CAqBZ"}
@@ -1,51 +0,0 @@
1
- import {
2
- FEATURE_CUSTOM_DOMAIN,
3
- isWooExpressPlan,
4
- isWpComFreePlan,
5
- isWpcomEnterpriseGridPlan,
6
- } from '@automattic/calypso-products';
7
- import { useTranslate } from 'i18n-calypso';
8
- import { GridPlan } from '../../types';
9
- import { PlanFeaturesItem } from '../item';
10
-
11
- type MobileFreeDomainProps = {
12
- gridPlan: GridPlan;
13
- paidDomainName?: string;
14
- };
15
-
16
- const MobileFreeDomain = ( {
17
- gridPlan: { planSlug, isMonthlyPlan, features },
18
- paidDomainName,
19
- }: MobileFreeDomainProps ) => {
20
- const translate = useTranslate();
21
-
22
- if ( isMonthlyPlan || isWpComFreePlan( planSlug ) || isWpcomEnterpriseGridPlan( planSlug ) ) {
23
- return null;
24
- }
25
-
26
- // Remove the custom domain feature for Woo Express plans with introductory offer.
27
- if (
28
- isWooExpressPlan( planSlug ) &&
29
- ! features.wpcomFeatures.some( ( feature ) => feature.getSlug() === FEATURE_CUSTOM_DOMAIN )
30
- ) {
31
- return null;
32
- }
33
-
34
- const displayText = paidDomainName
35
- ? translate( '%(paidDomainName)s is included', {
36
- args: { paidDomainName },
37
- } )
38
- : translate( 'Free domain for one year' );
39
-
40
- return (
41
- <div className="plan-features-2023-grid__highlighted-feature">
42
- <PlanFeaturesItem>
43
- <span className="plan-features-2023-grid__item-info is-annual-plan-feature is-available">
44
- <span className="plan-features-2023-grid__item-title is-bold">{ displayText }</span>
45
- </span>
46
- </PlanFeaturesItem>
47
- </div>
48
- );
49
- };
50
-
51
- export default MobileFreeDomain;
@@ -1,31 +0,0 @@
1
- import type { GridPlan } from '../types';
2
-
3
- type PricingInfo = {
4
- prices: number[];
5
- currencyCode?: string;
6
- };
7
-
8
- export function getPlanPricingInfoFromGridPlans( {
9
- gridPlans,
10
- returnMonthly = true,
11
- }: {
12
- gridPlans: GridPlan[];
13
- returnMonthly?: boolean;
14
- } ) {
15
- return gridPlans.reduce(
16
- ( acc: PricingInfo, gridPlan ) => {
17
- const {
18
- pricing: { originalPrice, discountedPrice, currencyCode },
19
- } = gridPlan;
20
-
21
- const originalPriceForTerm = originalPrice[ returnMonthly ? 'monthly' : 'full' ] || 0;
22
- const discountedPriceForTerm = discountedPrice[ returnMonthly ? 'monthly' : 'full' ] || 0;
23
-
24
- return {
25
- prices: [ ...acc.prices, originalPriceForTerm, discountedPriceForTerm ],
26
- ...( currencyCode && { currencyCode } ),
27
- };
28
- },
29
- { prices: [], currencyCode: 'USD' }
30
- );
31
- }
@@ -1,27 +0,0 @@
1
- import type { GridPlan } from '../types';
2
-
3
- export function sortPlans(
4
- gridPlans: GridPlan[],
5
- currentSitePlanProductSlug?: string | null
6
- ): GridPlan[] {
7
- // If we don't have plans to sort, return empty array
8
- if ( ! gridPlans.length ) {
9
- return [];
10
- }
11
- // If we have a current site plan and we're on mobile, sort to prioritize it
12
- if ( currentSitePlanProductSlug ) {
13
- return [ ...gridPlans ].sort( ( planA, planB ) => {
14
- // If planA is the current plan, it should come first (-1 moves it up)
15
- if ( planA.planSlug === currentSitePlanProductSlug ) {
16
- return -1;
17
- }
18
- // If planB is the current plan, it should come first (1 moves planA down)
19
- if ( planB.planSlug === currentSitePlanProductSlug ) {
20
- return 1;
21
- }
22
- // Otherwise, maintain original order
23
- return 0;
24
- } );
25
- }
26
- return [ ...gridPlans ];
27
- }
@@ -1,122 +0,0 @@
1
- /**
2
- * @jest-environment jsdom
3
- */
4
- /**
5
- * Default mock implementations
6
- */
7
- jest.mock( '../../hooks/data-store/is-popular-plan', () => ( {
8
- isPopularPlan: ( planSlug ) => planSlug === 'value_bundle',
9
- } ) );
10
- jest.mock( '@automattic/calypso-products', () => ( {
11
- isFreePlan: ( planSlug ) => planSlug === 'free_plan',
12
- } ) );
13
-
14
- import { sortPlans } from '../sort-plan-properties';
15
- import type { GridPlan } from '../../types';
16
-
17
- const planFree = {
18
- pricing: { originalPrice: { full: 0, monthly: 0 } },
19
- planSlug: 'free_plan',
20
- } as GridPlan;
21
-
22
- const planPersonal = {
23
- pricing: { originalPrice: { full: 100, monthly: 0 } },
24
- planSlug: 'personal-bundle',
25
- } as GridPlan;
26
-
27
- const planPremium = {
28
- pricing: { originalPrice: { full: 200, monthly: 0 } },
29
- planSlug: 'value_bundle',
30
- } as GridPlan;
31
-
32
- const planBusiness = {
33
- pricing: { originalPrice: { full: 300, monthly: 0 } },
34
- planSlug: 'business-bundle',
35
- } as GridPlan;
36
-
37
- const planEcommerce = {
38
- pricing: { originalPrice: { full: 500, monthly: 0 } },
39
- planSlug: 'ecommerce-bundle',
40
- } as GridPlan;
41
-
42
- const plansInDefaultOrder = [ planFree, planPersonal, planPremium, planBusiness, planEcommerce ];
43
-
44
- describe( 'sortPlans', () => {
45
- it( 'should return an empty array if no plans are provided', () => {
46
- expect( sortPlans( [] ) ).toEqual( [] );
47
- } );
48
-
49
- it( 'should return the original order if no current plan is specified', () => {
50
- expect( sortPlans( plansInDefaultOrder ) ).toEqual( plansInDefaultOrder );
51
- } );
52
-
53
- it( 'should return the original order if current plan is null', () => {
54
- expect( sortPlans( plansInDefaultOrder, null ) ).toEqual( plansInDefaultOrder );
55
- } );
56
-
57
- it( 'should return the original order if current plan is undefined', () => {
58
- expect( sortPlans( plansInDefaultOrder, undefined ) ).toEqual( plansInDefaultOrder );
59
- } );
60
-
61
- it( 'should return the original order if current plan is not found in the plans array', () => {
62
- expect( sortPlans( plansInDefaultOrder, 'non-existent-plan' ) ).toEqual( plansInDefaultOrder );
63
- } );
64
-
65
- it( 'should prioritize the current plan when specified', () => {
66
- // When personal plan is current
67
- expect( sortPlans( plansInDefaultOrder, 'personal-bundle' ) ).toEqual( [
68
- planPersonal,
69
- planFree,
70
- planPremium,
71
- planBusiness,
72
- planEcommerce,
73
- ] );
74
-
75
- // When premium plan is current
76
- expect( sortPlans( plansInDefaultOrder, 'value_bundle' ) ).toEqual( [
77
- planPremium,
78
- planFree,
79
- planPersonal,
80
- planBusiness,
81
- planEcommerce,
82
- ] );
83
-
84
- // When business plan is current
85
- expect( sortPlans( plansInDefaultOrder, 'business-bundle' ) ).toEqual( [
86
- planBusiness,
87
- planFree,
88
- planPersonal,
89
- planPremium,
90
- planEcommerce,
91
- ] );
92
-
93
- // When ecommerce plan is current
94
- expect( sortPlans( plansInDefaultOrder, 'ecommerce-bundle' ) ).toEqual( [
95
- planEcommerce,
96
- planFree,
97
- planPersonal,
98
- planPremium,
99
- planBusiness,
100
- ] );
101
-
102
- // When free plan is current
103
- expect( sortPlans( plansInDefaultOrder, 'free_plan' ) ).toEqual( [
104
- planFree,
105
- planPersonal,
106
- planPremium,
107
- planBusiness,
108
- planEcommerce,
109
- ] );
110
- } );
111
-
112
- it( 'should work with a single plan', () => {
113
- const singlePlan = [ planFree ];
114
- expect( sortPlans( singlePlan, 'free_plan' ) ).toEqual( [ planFree ] );
115
- } );
116
-
117
- it( 'should preserve the original array', () => {
118
- const originalArray = [ ...plansInDefaultOrder ];
119
- sortPlans( plansInDefaultOrder, 'personal-bundle' );
120
- expect( plansInDefaultOrder ).toEqual( originalArray );
121
- } );
122
- } );