@automattic/data-stores 3.1.1 → 3.2.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.
Files changed (318) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/README.md +10 -9
  3. package/dist/cjs/add-ons/hooks/use-add-on-prices.js +3 -3
  4. package/dist/cjs/add-ons/hooks/use-add-on-prices.js.map +1 -1
  5. package/dist/cjs/add-ons/icons/custom-design.js +1 -1
  6. package/dist/cjs/add-ons/icons/custom-design.js.map +1 -1
  7. package/dist/cjs/add-ons/icons/unlimited-themes.js +1 -1
  8. package/dist/cjs/add-ons/icons/unlimited-themes.js.map +1 -1
  9. package/dist/cjs/contextual-help/admin-sections.js +2 -2
  10. package/dist/cjs/contextual-help/admin-sections.js.map +1 -1
  11. package/dist/cjs/help-center/actions.js +89 -62
  12. package/dist/cjs/help-center/actions.js.map +1 -1
  13. package/dist/cjs/help-center/index.js +13 -12
  14. package/dist/cjs/help-center/index.js.map +1 -1
  15. package/dist/cjs/help-center/reducer.js +32 -16
  16. package/dist/cjs/help-center/reducer.js.map +1 -1
  17. package/dist/cjs/help-center/resolvers.js +6 -1
  18. package/dist/cjs/help-center/resolvers.js.map +1 -1
  19. package/dist/cjs/help-center/selectors.js +11 -7
  20. package/dist/cjs/help-center/selectors.js.map +1 -1
  21. package/dist/cjs/index.js +3 -6
  22. package/dist/cjs/index.js.map +1 -1
  23. package/dist/cjs/onboard/actions.js +10 -10
  24. package/dist/cjs/onboard/actions.js.map +1 -1
  25. package/dist/cjs/onboard/index.js +0 -1
  26. package/dist/cjs/onboard/index.js.map +1 -1
  27. package/dist/cjs/onboard/reducer.js +18 -16
  28. package/dist/cjs/onboard/reducer.js.map +1 -1
  29. package/dist/cjs/onboard/selectors.js +5 -5
  30. package/dist/cjs/onboard/selectors.js.map +1 -1
  31. package/dist/cjs/plans/queries/use-plans.js +20 -1
  32. package/dist/cjs/plans/queries/use-plans.js.map +1 -1
  33. package/dist/cjs/plans/resolvers.js +4 -4
  34. package/dist/cjs/plans/resolvers.js.map +1 -1
  35. package/dist/cjs/purchases/lib/assembler.js +7 -13
  36. package/dist/cjs/purchases/lib/assembler.js.map +1 -1
  37. package/dist/cjs/purchases/queries/lib/use-query-keys-factory.js +1 -0
  38. package/dist/cjs/purchases/queries/lib/use-query-keys-factory.js.map +1 -1
  39. package/dist/cjs/purchases/queries/use-get-jetpack-transferred-license-purchases.js +33 -0
  40. package/dist/cjs/purchases/queries/use-get-jetpack-transferred-license-purchases.js.map +1 -0
  41. package/dist/cjs/queries/use-launchpad.js +3 -2
  42. package/dist/cjs/queries/use-launchpad.js.map +1 -1
  43. package/dist/cjs/queries/use-site-domains-query.js.map +1 -1
  44. package/dist/cjs/queries/use-site-intent.js.map +1 -1
  45. package/dist/cjs/reader/mutations/use-site-subscribe-mutation.js +1 -1
  46. package/dist/cjs/reader/mutations/use-site-subscribe-mutation.js.map +1 -1
  47. package/dist/cjs/reader/mutations/use-site-unsubscribe-mutation.js +4 -0
  48. package/dist/cjs/reader/mutations/use-site-unsubscribe-mutation.js.map +1 -1
  49. package/dist/cjs/site/actions.js +1 -1
  50. package/dist/cjs/site/actions.js.map +1 -1
  51. package/dist/cjs/site/constants.js +2 -1
  52. package/dist/cjs/site/constants.js.map +1 -1
  53. package/dist/cjs/site/types.js.map +1 -1
  54. package/dist/esm/add-ons/hooks/use-add-on-prices.js +1 -1
  55. package/dist/esm/add-ons/hooks/use-add-on-prices.js.map +1 -1
  56. package/dist/esm/add-ons/icons/custom-design.js +2 -2
  57. package/dist/esm/add-ons/icons/custom-design.js.map +1 -1
  58. package/dist/esm/add-ons/icons/unlimited-themes.js +2 -2
  59. package/dist/esm/add-ons/icons/unlimited-themes.js.map +1 -1
  60. package/dist/esm/contextual-help/admin-sections.js +2 -2
  61. package/dist/esm/contextual-help/admin-sections.js.map +1 -1
  62. package/dist/esm/help-center/actions.js +81 -57
  63. package/dist/esm/help-center/actions.js.map +1 -1
  64. package/dist/esm/help-center/index.js +11 -10
  65. package/dist/esm/help-center/index.js.map +1 -1
  66. package/dist/esm/help-center/reducer.js +32 -16
  67. package/dist/esm/help-center/reducer.js.map +1 -1
  68. package/dist/esm/help-center/resolvers.js +6 -1
  69. package/dist/esm/help-center/resolvers.js.map +1 -1
  70. package/dist/esm/help-center/selectors.js +5 -3
  71. package/dist/esm/help-center/selectors.js.map +1 -1
  72. package/dist/esm/index.js +2 -4
  73. package/dist/esm/index.js.map +1 -1
  74. package/dist/esm/onboard/actions.js +7 -7
  75. package/dist/esm/onboard/actions.js.map +1 -1
  76. package/dist/esm/onboard/index.js +0 -1
  77. package/dist/esm/onboard/index.js.map +1 -1
  78. package/dist/esm/onboard/reducer.js +15 -15
  79. package/dist/esm/onboard/reducer.js.map +1 -1
  80. package/dist/esm/onboard/selectors.js +2 -2
  81. package/dist/esm/onboard/selectors.js.map +1 -1
  82. package/dist/esm/plans/queries/use-plans.js +20 -1
  83. package/dist/esm/plans/queries/use-plans.js.map +1 -1
  84. package/dist/esm/plans/resolvers.js +1 -1
  85. package/dist/esm/plans/resolvers.js.map +1 -1
  86. package/dist/esm/purchases/lib/assembler.js +7 -13
  87. package/dist/esm/purchases/lib/assembler.js.map +1 -1
  88. package/dist/esm/purchases/queries/lib/use-query-keys-factory.js +1 -0
  89. package/dist/esm/purchases/queries/lib/use-query-keys-factory.js.map +1 -1
  90. package/dist/esm/purchases/queries/use-get-jetpack-transferred-license-purchases.js +29 -0
  91. package/dist/esm/purchases/queries/use-get-jetpack-transferred-license-purchases.js.map +1 -0
  92. package/dist/esm/queries/use-launchpad.js +2 -2
  93. package/dist/esm/queries/use-launchpad.js.map +1 -1
  94. package/dist/esm/queries/use-site-domains-query.js.map +1 -1
  95. package/dist/esm/queries/use-site-intent.js.map +1 -1
  96. package/dist/esm/reader/mutations/use-site-subscribe-mutation.js +1 -1
  97. package/dist/esm/reader/mutations/use-site-subscribe-mutation.js.map +1 -1
  98. package/dist/esm/reader/mutations/use-site-unsubscribe-mutation.js +4 -0
  99. package/dist/esm/reader/mutations/use-site-unsubscribe-mutation.js.map +1 -1
  100. package/dist/esm/site/actions.js +1 -1
  101. package/dist/esm/site/actions.js.map +1 -1
  102. package/dist/esm/site/constants.js +1 -0
  103. package/dist/esm/site/constants.js.map +1 -1
  104. package/dist/esm/site/types.js.map +1 -1
  105. package/dist/tsconfig-cjs.tsbuildinfo +1 -1
  106. package/dist/tsconfig.tsbuildinfo +1 -1
  107. package/dist/types/add-ons/icons/custom-design.d.ts.map +1 -1
  108. package/dist/types/add-ons/icons/unlimited-themes.d.ts.map +1 -1
  109. package/dist/types/help-center/actions.d.ts +53 -30
  110. package/dist/types/help-center/actions.d.ts.map +1 -1
  111. package/dist/types/help-center/index.d.ts +1 -1
  112. package/dist/types/help-center/index.d.ts.map +1 -1
  113. package/dist/types/help-center/reducer.d.ts +14 -7
  114. package/dist/types/help-center/reducer.d.ts.map +1 -1
  115. package/dist/types/help-center/resolvers.d.ts +22 -3
  116. package/dist/types/help-center/resolvers.d.ts.map +1 -1
  117. package/dist/types/help-center/selectors.d.ts +8 -3
  118. package/dist/types/help-center/selectors.d.ts.map +1 -1
  119. package/dist/types/help-center/types.d.ts +3 -1
  120. package/dist/types/help-center/types.d.ts.map +1 -1
  121. package/dist/types/index.d.ts +478 -46
  122. package/dist/types/index.d.ts.map +1 -1
  123. package/dist/types/onboard/actions.d.ts +13 -24
  124. package/dist/types/onboard/actions.d.ts.map +1 -1
  125. package/dist/types/onboard/index.d.ts.map +1 -1
  126. package/dist/types/onboard/reducer.d.ts +7 -5
  127. package/dist/types/onboard/reducer.d.ts.map +1 -1
  128. package/dist/types/onboard/selectors.d.ts +6 -6
  129. package/dist/types/onboard/selectors.d.ts.map +1 -1
  130. package/dist/types/onboard/types.d.ts +1 -1
  131. package/dist/types/onboard/types.d.ts.map +1 -1
  132. package/dist/types/plans/queries/use-plans.d.ts.map +1 -1
  133. package/dist/types/purchases/lib/assembler.d.ts +3 -3
  134. package/dist/types/purchases/lib/assembler.d.ts.map +1 -1
  135. package/dist/types/purchases/queries/lib/use-query-keys-factory.d.ts +1 -0
  136. package/dist/types/purchases/queries/lib/use-query-keys-factory.d.ts.map +1 -1
  137. package/dist/types/purchases/queries/use-get-jetpack-transferred-license-purchases.d.ts +18 -0
  138. package/dist/types/purchases/queries/use-get-jetpack-transferred-license-purchases.d.ts.map +1 -0
  139. package/dist/types/purchases/types.d.ts +16 -106
  140. package/dist/types/purchases/types.d.ts.map +1 -1
  141. package/dist/types/queries/use-all-domains-query.d.ts +1 -1
  142. package/dist/types/queries/use-all-domains-query.d.ts.map +1 -1
  143. package/dist/types/queries/use-launchpad.d.ts +1 -0
  144. package/dist/types/queries/use-launchpad.d.ts.map +1 -1
  145. package/dist/types/queries/use-site-domains-query.d.ts +2 -1
  146. package/dist/types/queries/use-site-domains-query.d.ts.map +1 -1
  147. package/dist/types/queries/use-site-intent.d.ts +2 -1
  148. package/dist/types/queries/use-site-intent.d.ts.map +1 -1
  149. package/dist/types/queries/use-site-query.d.ts +1 -1
  150. package/dist/types/queries/use-site-query.d.ts.map +1 -1
  151. package/dist/types/reader/index.d.ts +475 -41
  152. package/dist/types/reader/index.d.ts.map +1 -1
  153. package/dist/types/reader/mutations/use-site-subscribe-mutation.d.ts +1 -1
  154. package/dist/types/reader/mutations/use-site-subscribe-mutation.d.ts.map +1 -1
  155. package/dist/types/reader/mutations/use-site-unsubscribe-mutation.d.ts +2 -0
  156. package/dist/types/reader/mutations/use-site-unsubscribe-mutation.d.ts.map +1 -1
  157. package/dist/types/reader/queries/use-pending-post-subscriptions-query.d.ts +75 -7
  158. package/dist/types/reader/queries/use-pending-post-subscriptions-query.d.ts.map +1 -1
  159. package/dist/types/reader/queries/use-pending-site-subscriptions-query.d.ts +75 -7
  160. package/dist/types/reader/queries/use-pending-site-subscriptions-query.d.ts.map +1 -1
  161. package/dist/types/reader/queries/use-post-subscriptions-query.d.ts +143 -13
  162. package/dist/types/reader/queries/use-post-subscriptions-query.d.ts.map +1 -1
  163. package/dist/types/reader/queries/use-site-subscriptions-query.d.ts +103 -13
  164. package/dist/types/reader/queries/use-site-subscriptions-query.d.ts.map +1 -1
  165. package/dist/types/site/actions.d.ts.map +1 -1
  166. package/dist/types/site/constants.d.ts +1 -0
  167. package/dist/types/site/constants.d.ts.map +1 -1
  168. package/dist/types/site/types.d.ts +12 -2
  169. package/dist/types/site/types.d.ts.map +1 -1
  170. package/dist/types/user/actions.d.ts +1 -1
  171. package/dist/types/user/reducer.d.ts +1 -1
  172. package/dist/types/user/resolvers.d.ts +2 -2
  173. package/dist/types/user/selectors.d.ts +2 -2
  174. package/dist/types/user/selectors.d.ts.map +1 -1
  175. package/dist/types/user/types.d.ts +2 -31
  176. package/dist/types/user/types.d.ts.map +1 -1
  177. package/package.json +28 -21
  178. package/src/add-ons/hooks/use-add-on-prices.ts +1 -1
  179. package/src/add-ons/icons/custom-design.tsx +3 -11
  180. package/src/add-ons/icons/unlimited-themes.tsx +3 -12
  181. package/src/contextual-help/admin-sections.ts +2 -2
  182. package/src/help-center/actions.ts +101 -65
  183. package/src/help-center/index.ts +10 -8
  184. package/src/help-center/reducer.ts +45 -24
  185. package/src/help-center/resolvers.ts +20 -3
  186. package/src/help-center/selectors.ts +6 -3
  187. package/src/help-center/types.ts +3 -1
  188. package/src/index.ts +6 -6
  189. package/src/newsletter-categories/test/index.tsx +5 -7
  190. package/src/onboard/actions.ts +11 -24
  191. package/src/onboard/index.ts +0 -1
  192. package/src/onboard/reducer.ts +18 -19
  193. package/src/onboard/selectors.ts +2 -2
  194. package/src/onboard/types.ts +1 -1
  195. package/src/plans/queries/use-plans.ts +29 -1
  196. package/src/plans/resolvers.ts +1 -1
  197. package/src/purchases/lib/assembler.ts +11 -21
  198. package/src/purchases/queries/lib/use-query-keys-factory.ts +1 -0
  199. package/src/purchases/queries/use-get-jetpack-transferred-license-purchases.tsx +43 -0
  200. package/src/purchases/types.ts +21 -113
  201. package/src/queries/use-launchpad.ts +2 -2
  202. package/src/queries/use-site-domains-query.ts +1 -0
  203. package/src/queries/use-site-intent.ts +2 -1
  204. package/src/reader/mutations/use-site-subscribe-mutation.ts +2 -2
  205. package/src/reader/mutations/use-site-unsubscribe-mutation.ts +7 -0
  206. package/src/reader/queries/test/use-read-feed-search-query.tsx +1 -1
  207. package/src/site/actions.ts +1 -1
  208. package/src/site/constants.ts +1 -0
  209. package/src/site/test/selectors.ts +0 -1
  210. package/src/site/types.ts +12 -2
  211. package/src/user/types.ts +2 -36
  212. package/dist/cjs/analyzer/actions.js +0 -38
  213. package/dist/cjs/analyzer/actions.js.map +0 -1
  214. package/dist/cjs/analyzer/constants.js +0 -5
  215. package/dist/cjs/analyzer/constants.js.map +0 -1
  216. package/dist/cjs/analyzer/index.js +0 -19
  217. package/dist/cjs/analyzer/index.js.map +0 -1
  218. package/dist/cjs/analyzer/reducers.js +0 -27
  219. package/dist/cjs/analyzer/reducers.js.map +0 -1
  220. package/dist/cjs/analyzer/selectors.js +0 -15
  221. package/dist/cjs/analyzer/selectors.js.map +0 -1
  222. package/dist/cjs/analyzer/types.js +0 -3
  223. package/dist/cjs/analyzer/types.js.map +0 -1
  224. package/dist/cjs/domain-suggestions/actions.js +0 -33
  225. package/dist/cjs/domain-suggestions/actions.js.map +0 -1
  226. package/dist/cjs/domain-suggestions/constants.js +0 -12
  227. package/dist/cjs/domain-suggestions/constants.js.map +0 -1
  228. package/dist/cjs/domain-suggestions/index.js +0 -25
  229. package/dist/cjs/domain-suggestions/index.js.map +0 -1
  230. package/dist/cjs/domain-suggestions/queries.js +0 -78
  231. package/dist/cjs/domain-suggestions/queries.js.map +0 -1
  232. package/dist/cjs/domain-suggestions/reducer.js +0 -65
  233. package/dist/cjs/domain-suggestions/reducer.js.map +0 -1
  234. package/dist/cjs/domain-suggestions/resolvers.js +0 -91
  235. package/dist/cjs/domain-suggestions/resolvers.js.map +0 -1
  236. package/dist/cjs/domain-suggestions/selectors.js +0 -58
  237. package/dist/cjs/domain-suggestions/selectors.js.map +0 -1
  238. package/dist/cjs/domain-suggestions/types.js +0 -3
  239. package/dist/cjs/domain-suggestions/types.js.map +0 -1
  240. package/dist/cjs/domain-suggestions/utils.js +0 -47
  241. package/dist/cjs/domain-suggestions/utils.js.map +0 -1
  242. package/dist/esm/analyzer/actions.js +0 -35
  243. package/dist/esm/analyzer/actions.js.map +0 -1
  244. package/dist/esm/analyzer/constants.js +0 -2
  245. package/dist/esm/analyzer/constants.js.map +0 -1
  246. package/dist/esm/analyzer/index.js +0 -15
  247. package/dist/esm/analyzer/index.js.map +0 -1
  248. package/dist/esm/analyzer/reducers.js +0 -25
  249. package/dist/esm/analyzer/reducers.js.map +0 -1
  250. package/dist/esm/analyzer/selectors.js +0 -9
  251. package/dist/esm/analyzer/selectors.js.map +0 -1
  252. package/dist/esm/analyzer/types.js +0 -2
  253. package/dist/esm/analyzer/types.js.map +0 -1
  254. package/dist/esm/domain-suggestions/actions.js +0 -25
  255. package/dist/esm/domain-suggestions/actions.js.map +0 -1
  256. package/dist/esm/domain-suggestions/constants.js +0 -9
  257. package/dist/esm/domain-suggestions/constants.js.map +0 -1
  258. package/dist/esm/domain-suggestions/index.js +0 -20
  259. package/dist/esm/domain-suggestions/index.js.map +0 -1
  260. package/dist/esm/domain-suggestions/queries.js +0 -72
  261. package/dist/esm/domain-suggestions/queries.js.map +0 -1
  262. package/dist/esm/domain-suggestions/reducer.js +0 -61
  263. package/dist/esm/domain-suggestions/reducer.js.map +0 -1
  264. package/dist/esm/domain-suggestions/resolvers.js +0 -84
  265. package/dist/esm/domain-suggestions/resolvers.js.map +0 -1
  266. package/dist/esm/domain-suggestions/selectors.js +0 -47
  267. package/dist/esm/domain-suggestions/selectors.js.map +0 -1
  268. package/dist/esm/domain-suggestions/types.js +0 -2
  269. package/dist/esm/domain-suggestions/types.js.map +0 -1
  270. package/dist/esm/domain-suggestions/utils.js +0 -41
  271. package/dist/esm/domain-suggestions/utils.js.map +0 -1
  272. package/dist/types/analyzer/actions.d.ts +0 -37
  273. package/dist/types/analyzer/actions.d.ts.map +0 -1
  274. package/dist/types/analyzer/constants.d.ts +0 -2
  275. package/dist/types/analyzer/constants.d.ts.map +0 -1
  276. package/dist/types/analyzer/index.d.ts +0 -38
  277. package/dist/types/analyzer/index.d.ts.map +0 -1
  278. package/dist/types/analyzer/reducers.d.ts +0 -11
  279. package/dist/types/analyzer/reducers.d.ts.map +0 -1
  280. package/dist/types/analyzer/selectors.d.ts +0 -7
  281. package/dist/types/analyzer/selectors.d.ts.map +0 -1
  282. package/dist/types/analyzer/types.d.ts +0 -35
  283. package/dist/types/analyzer/types.d.ts.map +0 -1
  284. package/dist/types/domain-suggestions/actions.d.ts +0 -27
  285. package/dist/types/domain-suggestions/actions.d.ts.map +0 -1
  286. package/dist/types/domain-suggestions/constants.d.ts +0 -8
  287. package/dist/types/domain-suggestions/constants.d.ts.map +0 -1
  288. package/dist/types/domain-suggestions/index.d.ts +0 -10
  289. package/dist/types/domain-suggestions/index.d.ts.map +0 -1
  290. package/dist/types/domain-suggestions/queries.d.ts +0 -323
  291. package/dist/types/domain-suggestions/queries.d.ts.map +0 -1
  292. package/dist/types/domain-suggestions/reducer.d.ts +0 -16
  293. package/dist/types/domain-suggestions/reducer.d.ts.map +0 -1
  294. package/dist/types/domain-suggestions/resolvers.d.ts +0 -39
  295. package/dist/types/domain-suggestions/resolvers.d.ts.map +0 -1
  296. package/dist/types/domain-suggestions/selectors.d.ts +0 -18
  297. package/dist/types/domain-suggestions/selectors.d.ts.map +0 -1
  298. package/dist/types/domain-suggestions/types.d.ts +0 -206
  299. package/dist/types/domain-suggestions/types.d.ts.map +0 -1
  300. package/dist/types/domain-suggestions/utils.d.ts +0 -23
  301. package/dist/types/domain-suggestions/utils.d.ts.map +0 -1
  302. package/src/analyzer/actions.ts +0 -49
  303. package/src/analyzer/constants.ts +0 -1
  304. package/src/analyzer/index.ts +0 -17
  305. package/src/analyzer/reducers.ts +0 -36
  306. package/src/analyzer/selectors.ts +0 -11
  307. package/src/analyzer/types.ts +0 -37
  308. package/src/domain-suggestions/actions.ts +0 -51
  309. package/src/domain-suggestions/constants.ts +0 -8
  310. package/src/domain-suggestions/index.ts +0 -22
  311. package/src/domain-suggestions/queries.ts +0 -85
  312. package/src/domain-suggestions/reducer.ts +0 -77
  313. package/src/domain-suggestions/resolvers.ts +0 -110
  314. package/src/domain-suggestions/selectors.ts +0 -86
  315. package/src/domain-suggestions/test/reducer.ts +0 -105
  316. package/src/domain-suggestions/test/selectors.ts +0 -127
  317. package/src/domain-suggestions/types.ts +0 -254
  318. package/src/domain-suggestions/utils.ts +0 -50
@@ -6,8 +6,8 @@ import { Visibility, GlobalStyles } from '../site/types';
6
6
  import { SiteGoal, STORE_KEY } from './constants';
7
7
  import { ProfilerData, ReadymadeTemplate } from './types';
8
8
  import type { DomainTransferData, State } from '.';
9
- import type { DomainSuggestion } from '../domain-suggestions';
10
9
  import type { FeatureId } from '../shared-types';
10
+ import type { DomainSuggestion } from '@automattic/api-core';
11
11
  // somewhat hacky, but resolves the circular dependency issue
12
12
  import type { Design, StyleVariation } from '@automattic/design-picker/src/types';
13
13
  import type { MinimalRequestCartProduct } from '@automattic/shopping-cart';
@@ -34,19 +34,6 @@ export const setSiteUrl = ( siteUrl: string ) => ( {
34
34
  siteUrl,
35
35
  } );
36
36
 
37
- export interface CreateSiteBaseActionParameters {
38
- username: string;
39
- languageSlug: string;
40
- visibility: number;
41
- }
42
-
43
- export interface CreateSiteActionParameters extends CreateSiteBaseActionParameters {
44
- bearerToken?: string;
45
- anchorFmPodcastId: string | null;
46
- anchorFmEpisodeId: string | null;
47
- anchorFmSpotifyUrl: string | null;
48
- }
49
-
50
37
  export function* createSenseiSite( {
51
38
  username = '',
52
39
  languageSlug = '',
@@ -356,11 +343,6 @@ export const setHidePlansFeatureComparison = ( hidePlansFeatureComparison: boole
356
343
  hidePlansFeatureComparison,
357
344
  } );
358
345
 
359
- export const setIsMigrateFromWp = ( isMigrateFromWp: boolean ) => ( {
360
- type: 'SET_IS_MIGRATE_FROM_WP' as const,
361
- isMigrateFromWp,
362
- } );
363
-
364
346
  export const setPluginsToVerify = ( pluginSlugs: string[] ) => ( {
365
347
  type: 'SET_PLUGIN_SLUGS_TO_VERIFY' as const,
366
348
  pluginSlugs,
@@ -381,9 +363,14 @@ export const setPartnerBundle = ( partnerBundle: string | null ) => ( {
381
363
  partnerBundle,
382
364
  } );
383
365
 
384
- export const setCreateWithBigSky = ( createWithBigSky: boolean ) => ( {
385
- type: 'SET_CREATE_WITH_BIG_SKY' as const,
386
- createWithBigSky,
366
+ export const setGardenName = ( gardenName: string | null ) => ( {
367
+ type: 'SET_GARDEN_NAME' as const,
368
+ gardenName,
369
+ } );
370
+
371
+ export const setGardenPartnerName = ( gardenPartnerName: string | null ) => ( {
372
+ type: 'SET_GARDEN_PARTNER_NAME' as const,
373
+ gardenPartnerName,
387
374
  } );
388
375
 
389
376
  export type OnboardAction = ReturnType<
@@ -442,9 +429,9 @@ export type OnboardAction = ReturnType<
442
429
  | typeof setHidePlansFeatureComparison
443
430
  | typeof setProductCartItems
444
431
  | typeof setPlanCartItem
445
- | typeof setIsMigrateFromWp
446
432
  | typeof setPaidSubscribers
447
433
  | typeof setPartnerBundle
448
434
  | typeof setSignupDomainOrigin
449
- | typeof setCreateWithBigSky
435
+ | typeof setGardenName
436
+ | typeof setGardenPartnerName
450
437
  >;
@@ -62,7 +62,6 @@ export function register(): typeof STORE_KEY {
62
62
  'domainCartItem',
63
63
  'planCartItem',
64
64
  'productCartItems',
65
- 'createWithBigSky',
66
65
  'partnerBundle',
67
66
  ],
68
67
  } );
@@ -8,9 +8,9 @@ import type {
8
8
  DomainTransferAuthCodes,
9
9
  ReadymadeTemplate,
10
10
  } from './types';
11
- import type { DomainSuggestion } from '../domain-suggestions';
12
11
  import type { FeatureId } from '../shared-types';
13
12
  import type { GlobalStyles } from '../site';
13
+ import type { DomainSuggestion } from '@automattic/api-core';
14
14
  // somewhat hacky, but resolves the circular dependency issue
15
15
  import type { Design, StyleVariation } from '@automattic/design-picker/src/types';
16
16
  import type { MinimalRequestCartProduct } from '@automattic/shopping-cart';
@@ -489,16 +489,6 @@ const domainCartItems: Reducer< MinimalRequestCartProduct[] | undefined, Onboard
489
489
  return state;
490
490
  };
491
491
 
492
- const isMigrateFromWp: Reducer< boolean, OnboardAction > = ( state = false, action ) => {
493
- if ( action.type === 'SET_IS_MIGRATE_FROM_WP' ) {
494
- return action.isMigrateFromWp;
495
- }
496
- if ( action.type === 'RESET_ONBOARD_STORE' ) {
497
- return false;
498
- }
499
- return state;
500
- };
501
-
502
492
  const pluginsToVerify: Reducer< string[] | undefined, OnboardAction > = ( state, action ) => {
503
493
  if ( action.type === 'SET_PLUGIN_SLUGS_TO_VERIFY' ) {
504
494
  return action.pluginSlugs;
@@ -622,17 +612,26 @@ const signupDomainOrigin: Reducer< string | undefined, OnboardAction > = (
622
612
  return state;
623
613
  };
624
614
 
625
- const createWithBigSky: Reducer< boolean | undefined, OnboardAction > = (
626
- state = undefined,
615
+ export const gardenName: Reducer< string | null, OnboardAction > = ( state = null, action ) => {
616
+ if ( action.type === 'SET_GARDEN_NAME' ) {
617
+ return action.gardenName;
618
+ }
619
+ if ( action.type === 'RESET_ONBOARD_STORE' ) {
620
+ return null;
621
+ }
622
+ return state;
623
+ };
624
+
625
+ export const gardenPartnerName: Reducer< string | null, OnboardAction > = (
626
+ state = null,
627
627
  action
628
628
  ) => {
629
- if ( action.type === 'SET_CREATE_WITH_BIG_SKY' ) {
630
- return action.createWithBigSky;
629
+ if ( action.type === 'SET_GARDEN_PARTNER_NAME' ) {
630
+ return action.gardenPartnerName;
631
631
  }
632
632
  if ( action.type === 'RESET_ONBOARD_STORE' ) {
633
- return undefined;
633
+ return null;
634
634
  }
635
-
636
635
  return state;
637
636
  };
638
637
 
@@ -678,14 +677,14 @@ const reducer = combineReducers( {
678
677
  storageAddonSlug,
679
678
  planCartItem,
680
679
  productCartItems,
681
- isMigrateFromWp,
682
680
  domainCartItems,
683
681
  pluginsToVerify,
684
682
  profilerData,
685
683
  paidSubscribers,
686
684
  partnerBundle,
687
685
  signupDomainOrigin,
688
- createWithBigSky,
686
+ gardenName,
687
+ gardenPartnerName,
689
688
  } );
690
689
 
691
690
  export type State = ReturnType< typeof reducer >;
@@ -77,9 +77,9 @@ export const getSignupDomainOrigin = ( state: State ) => state.signupDomainOrigi
77
77
  export const getSiteUrl = ( state: State ) => state.siteUrl;
78
78
  export const getHideFreePlan = ( state: State ) => state.hideFreePlan;
79
79
  export const getHidePlansFeatureComparison = ( state: State ) => state.hidePlansFeatureComparison;
80
- export const getIsMigrateFromWp = ( state: State ) => state.isMigrateFromWp;
81
80
  export const getPluginsToVerify = ( state: State ) => state.pluginsToVerify;
82
81
  export const getProfilerData = ( state: State ) => state.profilerData;
83
82
  export const getPaidSubscribers = ( state: State ) => state.paidSubscribers;
84
83
  export const getPartnerBundle = ( state: State ) => state.partnerBundle;
85
- export const getCreateWithBigSky = ( state: State ) => state.createWithBigSky;
84
+ export const getGardenName = ( state: State ) => state.gardenName;
85
+ export const getGardenPartnerName = ( state: State ) => state.gardenPartnerName;
@@ -1,5 +1,5 @@
1
1
  import { GlobalStyles } from '../site';
2
- import type { DomainSuggestion } from '../domain-suggestions';
2
+ import type { DomainSuggestion } from '@automattic/api-core';
3
3
 
4
4
  export type DomainForm = {
5
5
  lastQuery?: string;
@@ -1,3 +1,4 @@
1
+ import { isEnabled } from '@automattic/calypso-config';
1
2
  import { calculateMonthlyPriceForPlan } from '@automattic/calypso-products';
2
3
  import { useLocale } from '@automattic/i18n-utils';
3
4
  import { useQuery, type UseQueryResult } from '@tanstack/react-query';
@@ -10,6 +11,28 @@ interface PlansIndex {
10
11
  [ planSlug: string ]: PlanNext;
11
12
  }
12
13
 
14
+ type RequestFunction = ( params: {
15
+ path: string;
16
+ apiVersion: string;
17
+ query: string;
18
+ } ) => Promise< PricedAPIPlan[] >;
19
+
20
+ /**
21
+ * Request function for Jetpack that bypasses proxy and goes directly to WordPress.com
22
+ */
23
+ const jetpackRequestFunction: RequestFunction = async ( params ) => {
24
+ const queryParams = params.query ? `?${ params.query }` : '';
25
+ const url = `https://public-api.wordpress.com/rest/v${ params.apiVersion }${ params.path }${ queryParams }`;
26
+ const response = await fetch( url, {
27
+ method: 'GET',
28
+ credentials: 'omit', // Don't send cookies to avoid CORS issues
29
+ } );
30
+ if ( ! response.ok ) {
31
+ throw new Error( `API request failed: ${ response.status }` );
32
+ }
33
+ return response.json();
34
+ };
35
+
13
36
  /**
14
37
  * Plans from `/plans` endpoint, transformed into a map of planSlug => PlanNext
15
38
  */
@@ -27,10 +50,15 @@ function usePlans( {
27
50
  coupon && params.append( 'coupon_code', coupon );
28
51
  params.append( 'locale', locale );
29
52
 
53
+ // Auto-detect Jetpack context and use appropriate request function
54
+ const isJetpack = isEnabled( 'is_running_in_jetpack_site' );
55
+
56
+ const requestFn = isJetpack ? jetpackRequestFunction : wpcomRequest;
57
+
30
58
  return useQuery( {
31
59
  queryKey: queryKeys.plans( coupon ),
32
60
  queryFn: async (): Promise< PlansIndex > => {
33
- const data: PricedAPIPlan[] = await wpcomRequest( {
61
+ const data: PricedAPIPlan[] = await requestFn( {
34
62
  path: '/plans',
35
63
  apiVersion: '1.5',
36
64
  query: params.toString(),
@@ -1,4 +1,4 @@
1
- import { formatCurrency } from 'i18n-calypso';
1
+ import { formatCurrency } from '@automattic/number-formatters';
2
2
  import { stringify } from 'qs';
3
3
  import { fetchAndParse, wpcomRequest } from '../wpcom-request-controls';
4
4
  import { setFeatures, setFeaturesByType, setPlanProducts, setPlans } from './actions';
@@ -1,10 +1,9 @@
1
1
  import { snakeToCamelCase } from '@automattic/js-utils';
2
- import type { PurchasePriceTier, Purchase, RawPurchase, RawPurchaseCreditCard } from '../types';
2
+ import type { PurchasePriceTier, Purchase, RawPurchase } from '../types';
3
3
 
4
- export function createPurchaseObject( purchase: RawPurchase | RawPurchaseCreditCard ): Purchase {
4
+ export function createPurchaseObject( purchase: RawPurchase ): Purchase {
5
5
  const object: Purchase = {
6
6
  id: Number( purchase.ID ),
7
- active: Boolean( purchase.active ),
8
7
  amount: Number( purchase.amount ),
9
8
  attachedToPurchaseId: Number( purchase.attached_to_purchase_id ),
10
9
  autoRenewCouponCode: purchase.auto_renew_coupon_code,
@@ -16,9 +15,6 @@ export function createPurchaseObject( purchase: RawPurchase | RawPurchaseCreditC
16
15
  canDisableAutoRenew: Boolean( purchase.can_disable_auto_renew ),
17
16
  canReenableAutoRenewal: Boolean( purchase.can_reenable_auto_renewal ),
18
17
  canExplicitRenew: Boolean( purchase.can_explicit_renew ),
19
- costToUnbundle: purchase.cost_to_unbundle
20
- ? Number( purchase.cost_to_unbundle )
21
- : Number( purchase.amount ),
22
18
  costToUnbundleText: purchase.cost_to_unbundle_display
23
19
  ? purchase.cost_to_unbundle_display
24
20
  : purchase.price_text,
@@ -27,7 +23,6 @@ export function createPurchaseObject( purchase: RawPurchase | RawPurchaseCreditC
27
23
  description: purchase.description,
28
24
  domain: purchase.domain,
29
25
  domainRegistrationAgreementUrl: purchase.domain_registration_agreement_url || null,
30
- error: null,
31
26
  blogCreatedDate: purchase.blog_created_date,
32
27
  expiryDate: purchase.expiry_date,
33
28
  expiryStatus: snakeToCamelCase( purchase.expiry_status ),
@@ -114,24 +109,23 @@ export function createPurchaseObject( purchase: RawPurchase | RawPurchaseCreditC
114
109
  saleAmountInteger: purchase.sale_amount_integer,
115
110
  siteId: Number( purchase.blog_id ),
116
111
  siteName: purchase.blogname,
112
+ siteSlug: purchase.site_slug,
117
113
  subscribedDate: purchase.subscribed_date,
118
114
  subscriptionStatus: purchase.subscription_status,
119
- tagLine: purchase.tag_line,
120
- taxAmount: purchase.tax_amount,
121
- taxText: purchase.tax_text,
122
115
  purchaseRenewalQuantity: purchase.renewal_price_tier_usage_quantity || null,
123
116
  userId: Number( purchase.user_id ),
124
- isAutoRenewEnabled: parseInt( purchase.auto_renew ?? '' ) === 1,
117
+ isAutoRenewEnabled: purchase.is_auto_renew_enabled,
118
+ isJetpackPlanOrProduct: purchase.is_jetpack_plan_or_product,
125
119
  };
126
120
 
127
121
  if ( isCreditCardPurchase( purchase ) ) {
128
122
  object.payment.creditCard = {
129
123
  id: Number( purchase.payment_card_id ),
130
- type: purchase.payment_card_type,
124
+ type: purchase.payment_card_type ?? '',
131
125
  displayBrand: purchase.payment_card_display_brand,
132
- processor: purchase.payment_card_processor,
133
- number: purchase.payment_details,
134
- expiryDate: purchase.payment_expiry,
126
+ processor: purchase.payment_card_processor ?? '',
127
+ number: purchase.payment_details ?? '',
128
+ expiryDate: purchase.payment_expiry ?? '',
135
129
  };
136
130
  }
137
131
 
@@ -142,15 +136,11 @@ export function createPurchaseObject( purchase: RawPurchase | RawPurchaseCreditC
142
136
  return object;
143
137
  }
144
138
 
145
- function isCreditCardPurchase(
146
- purchase: RawPurchase | RawPurchaseCreditCard
147
- ): purchase is RawPurchaseCreditCard {
139
+ function isCreditCardPurchase( purchase: RawPurchase ): boolean {
148
140
  return purchase.payment_type === 'credit_card';
149
141
  }
150
142
 
151
- export function createPurchasesArray(
152
- dataTransferObject: undefined | ( RawPurchase | RawPurchaseCreditCard )[]
153
- ): Purchase[] {
143
+ export function createPurchasesArray( dataTransferObject: undefined | RawPurchase[] ): Purchase[] {
154
144
  if ( ! Array.isArray( dataTransferObject ) ) {
155
145
  return [];
156
146
  }
@@ -1,5 +1,6 @@
1
1
  const useQueryKeysFactory = () => ( {
2
2
  sitePurchases: ( siteId?: string | number | null ) => [ 'site-purchases', siteId ],
3
+ transferredPurchases: ( userId?: string | number | null ) => [ 'transferred-purchases', userId ],
3
4
  } );
4
5
 
5
6
  export default useQueryKeysFactory;
@@ -0,0 +1,43 @@
1
+ import { useQuery } from '@tanstack/react-query';
2
+ import wpcomRequest from 'wpcom-proxy-request';
3
+ import { createPurchaseObject } from '../lib/assembler';
4
+ import useQueryKeysFactory from './lib/use-query-keys-factory';
5
+ import type { RawPurchase, Purchase } from '../types';
6
+
7
+ interface Props {
8
+ userId?: string | number;
9
+ }
10
+
11
+ export function getUseTransferredPurchasesOptions(
12
+ { userId }: Props,
13
+ queryKey: ( string | number | null | undefined )[]
14
+ ) {
15
+ return {
16
+ queryKey,
17
+ queryFn: async (): Promise< Purchase[] > => {
18
+ const purchases: RawPurchase[] = await wpcomRequest( {
19
+ path: '/me/purchases/transferred',
20
+ apiVersion: '1.1',
21
+ } );
22
+
23
+ return purchases.map( ( rawPurchase ) => createPurchaseObject( rawPurchase ) );
24
+ },
25
+ enabled: !! userId,
26
+ };
27
+ }
28
+
29
+ /**
30
+ * Fetches all purchases for a given site, transformed into a map of purchaseId => Purchase
31
+ * @param {Object} props - The properties for the function
32
+ * @param props.userId Site ID
33
+ * @returns Query result
34
+ */
35
+ function useGetJetpackTransferredLicensePurchases( { userId }: Props ) {
36
+ const queryKeys = useQueryKeysFactory();
37
+
38
+ return useQuery< Purchase[] >(
39
+ getUseTransferredPurchasesOptions( { userId }, queryKeys.transferredPurchases( userId ) )
40
+ );
41
+ }
42
+
43
+ export default useGetJetpackTransferredLicensePurchases;
@@ -1,7 +1,6 @@
1
1
  import { PriceTierEntry } from '@automattic/calypso-products';
2
2
 
3
3
  export interface Purchase {
4
- active?: boolean;
5
4
  amount: number;
6
5
  attachedToPurchaseId: number;
7
6
  billPeriodDays: number;
@@ -11,14 +10,23 @@ export interface Purchase {
11
10
  asyncPendingPaymentBlockIsSet: boolean;
12
11
  canExplicitRenew: boolean;
13
12
  canReenableAutoRenewal: boolean;
14
- costToUnbundle: number;
15
13
  costToUnbundleText: string;
16
14
  currencyCode: string;
17
15
  currencySymbol: string;
18
16
  description: string;
17
+
18
+ /**
19
+ * The domain name of the site associated with the purchase.
20
+ *
21
+ * IMPORTANT: this is not necessarily the primary domain of the site. This
22
+ * can cause issues for Atomic sites if you try to use it for things that
23
+ * expect the primary domain, like routing.
24
+ *
25
+ * To get the primary domain instead, use `siteSlug`.
26
+ */
19
27
  domain: string;
28
+
20
29
  domainRegistrationAgreementUrl: string | null;
21
- error: null;
22
30
  expiryDate: string;
23
31
  expiryStatus: string;
24
32
  iapPurchaseManagementLink: string | null;
@@ -80,7 +88,7 @@ export interface Purchase {
80
88
  */
81
89
  refundInteger: number;
82
90
 
83
- refundOptions: RefundOptions | null;
91
+ refundOptions: RefundOptions[] | null;
84
92
  refundPeriodInDays: number;
85
93
 
86
94
  /**
@@ -106,6 +114,12 @@ export interface Purchase {
106
114
  saleAmountInteger?: number;
107
115
  siteId: number;
108
116
  siteName: string;
117
+
118
+ /**
119
+ * The primary domain for the site that owns this purchase.
120
+ */
121
+ siteSlug?: string;
122
+
109
123
  subscribedDate: string;
110
124
  subscriptionStatus: 'active' | 'inactive';
111
125
 
@@ -144,9 +158,6 @@ export interface Purchase {
144
158
  userId: number;
145
159
  userIsOwner?: boolean;
146
160
  partnerKeyId: number | undefined;
147
- tagLine: string;
148
- taxAmount: number | string | undefined;
149
- taxText: string | undefined;
150
161
 
151
162
  /**
152
163
  * The coupon code that will automatically apply on the next renewal.
@@ -157,6 +168,8 @@ export interface Purchase {
157
168
  * Example: If the discount is 10%, this will have the value `10`.
158
169
  */
159
170
  autoRenewCouponDiscountPercentage: number | null;
171
+
172
+ isJetpackPlanOrProduct: boolean;
160
173
  }
161
174
 
162
175
  export interface PurchasePriceTier {
@@ -173,112 +186,7 @@ export interface RawPurchasePriceTierEntry extends PriceTierEntry {
173
186
  maximum_price_monthly_display: never;
174
187
  }
175
188
 
176
- export interface RawPurchase {
177
- ID: number | string;
178
- active: boolean;
179
- amount: number | string;
180
- attached_to_purchase_id: number | string;
181
- auto_renew_coupon_code: string | null;
182
- auto_renew_coupon_discount_percentage: number | null;
183
- bill_period_days: number | string;
184
- bill_period_label: string;
185
- most_recent_renew_date: string;
186
- can_disable_auto_renew: boolean;
187
- can_reenable_auto_renewal: boolean;
188
- async_pending_payment_block_is_set: boolean;
189
- can_explicit_renew: boolean;
190
- cost_to_unbundle: undefined | number | string;
191
- cost_to_unbundle_display: undefined | string;
192
- price_text: string;
193
- price_tier_list?: Array< RawPurchasePriceTierEntry >;
194
- currency_code: string;
195
- currency_symbol: string;
196
- description: string;
197
- domain: string;
198
- domain_registration_agreement_url: string | undefined;
199
- blog_created_date: string;
200
- expiry_date: string;
201
- expiry_status: string;
202
- iap_purchase_management_link: string | null;
203
- included_domain: string;
204
- included_domain_purchase_amount: number;
205
- introductory_offer: RawPurchaseIntroductoryOffer | null;
206
- is_cancelable: boolean;
207
- is_domain: boolean;
208
- is_domain_registration: boolean;
209
- is_hundred_year_domain: boolean;
210
- is_locked: boolean;
211
- is_iap_purchase: boolean;
212
- is_rechargable: boolean;
213
- is_refundable: boolean;
214
- is_renewable: boolean;
215
- is_renewal: boolean;
216
- is_woo_express_trial: boolean;
217
- meta: string | undefined;
218
- ownership_id: number | undefined;
219
- partner_name: string | undefined;
220
- partner_slug: string | undefined;
221
- partner_type: string | undefined;
222
- partner_key_id: number | undefined;
223
- payment_name: string;
224
- payment_type:
225
- | 'credit_card'
226
- | 'paypal_direct'
227
- | 'paypal'
228
- | 'emergent-paywall'
229
- | 'brazil-tef'
230
- | string;
231
- payment_card_display_brand: string | null;
232
- payment_country_name: string;
233
- payment_country_code: string | null;
234
- stored_details_id: string | null;
235
- pending_transfer: boolean;
236
- product_id: number | string;
237
- product_name: string;
238
- product_slug: string;
239
- product_type: string;
240
- product_display_price: string;
241
- price_integer: number;
242
- total_refund_amount: number | undefined;
243
- total_refund_currency: string;
244
- total_refund_integer: number;
245
- total_refund_text: string;
246
- refund_amount: number;
247
- refund_integer: number;
248
- refund_text: string;
249
- refund_currency_symbol: string;
250
- refund_options: RefundOptions | null;
251
- refund_period_in_days: number;
252
- regular_price_text: string;
253
- regular_price_integer: number;
254
- renew_date: string;
255
- sale_amount: number | undefined;
256
- sale_amount_integer: number | undefined;
257
- blog_id: number | string;
258
- blogname: string;
259
- subscribed_date: string;
260
- subscription_status: 'active' | 'inactive';
261
- tag_line: string;
262
- tax_amount: number | string | undefined;
263
- tax_text: string | undefined;
264
- renewal_price_tier_usage_quantity: number | undefined | null;
265
- user_id: number | string;
266
- auto_renew: '1' | '0' | null;
267
- payment_card_id: number | string | undefined;
268
- payment_card_type: string | undefined;
269
- payment_card_processor: string | undefined;
270
- payment_details: string | undefined;
271
- payment_expiry: string | undefined;
272
- }
273
-
274
- export type RawPurchaseCreditCard = RawPurchase & {
275
- payment_type: 'credit_card';
276
- payment_card_type: string;
277
- payment_card_display_brand: string | null;
278
- payment_card_processor: string;
279
- payment_details: string | number;
280
- payment_expiry: string;
281
- };
189
+ export type { RawPurchase } from '@automattic/api-core';
282
190
 
283
191
  export interface RefundOptions {
284
192
  to_product_id: number;
@@ -106,12 +106,12 @@ export function sortLaunchpadTasksByCompletionStatus( response: LaunchpadRespons
106
106
  return response;
107
107
  }
108
108
 
109
- const defaultSuccessCallback = ( response: LaunchpadResponse ) => {
109
+ export function defaultSuccessCallback( response: LaunchpadResponse ) {
110
110
  const tasks = response.checklist || [];
111
111
  response.checklist = tasks.map( addOrderToTask );
112
112
 
113
113
  return response;
114
- };
114
+ }
115
115
 
116
116
  type SiteSlug = string | number | null;
117
117
 
@@ -106,6 +106,7 @@ export interface DomainData {
106
106
  has_private_registration: boolean;
107
107
  is_pending_icann_verification: boolean;
108
108
  is_icann_verification_suspended: boolean;
109
+ is_root_domain_registered_with_automattic: boolean;
109
110
  manual_transfer_required: boolean;
110
111
  registrar: string;
111
112
  domain_locking_available: boolean;
@@ -1,9 +1,10 @@
1
1
  import { useQuery } from '@tanstack/react-query';
2
2
  import wpcomRequest from 'wpcom-proxy-request';
3
+ import { SiteIntent } from '../onboard';
3
4
 
4
5
  export function useSiteIntent( siteId: string | number | undefined ) {
5
6
  return useQuery< {
6
- site_intent: '';
7
+ site_intent: SiteIntent;
7
8
  } >( {
8
9
  queryKey: [ 'site-intent', siteId ],
9
10
  queryFn: async () =>
@@ -10,7 +10,7 @@ type SubscribeParams = {
10
10
  url?: string;
11
11
  doNotInvalidateSiteSubscriptions?: boolean;
12
12
  onSuccess?: () => void;
13
- onError?: () => void;
13
+ onError?: ( e: Error ) => void;
14
14
  subscriptionId?: number;
15
15
  resubscribed?: boolean;
16
16
  };
@@ -144,7 +144,7 @@ const useSiteSubscribeMutation = () => {
144
144
  );
145
145
  }
146
146
 
147
- params.onError?.();
147
+ params.onError?.( _error );
148
148
  },
149
149
  onSettled: ( _data, _error, params: SubscribeParams ) => {
150
150
  if ( params.doNotInvalidateSiteSubscriptions !== true ) {
@@ -13,6 +13,8 @@ type UnsubscribeParams = {
13
13
  blog_id?: number | string;
14
14
  doNotInvalidateSiteSubscriptions?: boolean;
15
15
  emailId?: string;
16
+ onSuccess?: () => void;
17
+ onError?: ( e: Error ) => void;
16
18
  };
17
19
 
18
20
  type UnsubscribeResponse = {
@@ -201,6 +203,8 @@ const useSiteUnsubscribeMutation = () => {
201
203
  context.previousSiteSubscriptionDetailsByBlogId
202
204
  );
203
205
  }
206
+
207
+ params.onError?.( _error );
204
208
  },
205
209
  onSettled: ( _data, _error, params ) => {
206
210
  if ( params.doNotInvalidateSiteSubscriptions !== true ) {
@@ -227,6 +231,9 @@ const useSiteUnsubscribeMutation = () => {
227
231
  queryKey: buildSiteSubscriptionDetailsQueryKey( params.subscriptionId, isLoggedIn, userId ),
228
232
  } );
229
233
  },
234
+ onSuccess: ( data, params ) => {
235
+ params.onSuccess?.();
236
+ },
230
237
  } );
231
238
  };
232
239
 
@@ -11,7 +11,7 @@ jest.mock( 'wpcom-proxy-request', () => jest.fn() );
11
11
 
12
12
  describe( 'useReadFeedSearchQuery', () => {
13
13
  beforeEach( () => {
14
- ( wpcomRequest as jest.MockedFunction< typeof wpcomRequest > ).mockResolvedValue( {
14
+ jest.mocked( wpcomRequest ).mockResolvedValue( {
15
15
  algorithm: 'example_algorithm',
16
16
  feeds: [],
17
17
  next_page: 'example_next_page',
@@ -1,7 +1,7 @@
1
- import { DEFAULT_GLOBAL_STYLES_VARIATION_SLUG } from '@automattic/global-styles/src/constants';
2
1
  import { __ } from '@wordpress/i18n';
3
2
  import { SiteGoal } from '../onboard';
4
3
  import { wpcomRequest } from '../wpcom-request-controls';
4
+ import { DEFAULT_GLOBAL_STYLES_VARIATION_SLUG } from './constants';
5
5
  import {
6
6
  SiteLaunchError,
7
7
  AtomicTransferError,
@@ -1,2 +1,3 @@
1
1
  export const STORE_KEY = 'automattic/site';
2
2
  export const getPlaceholderSiteID = () => '226011606'; // assemblerdemo
3
+ export const DEFAULT_GLOBAL_STYLES_VARIATION_SLUG = 'default';
@@ -382,7 +382,6 @@ describe( 'getSiteOptions', () => {
382
382
  delete_users: true,
383
383
  remove_users: true,
384
384
  own_site: true,
385
- view_hosting: true,
386
385
  view_stats: true,
387
386
  activate_plugins: true,
388
387
  },