@automattic/data-stores 3.1.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/add-ons/add-ons-list.js +92 -0
- package/dist/cjs/add-ons/add-ons-list.js.map +1 -0
- package/dist/cjs/add-ons/constants.js +21 -3
- package/dist/cjs/add-ons/constants.js.map +1 -1
- package/dist/cjs/add-ons/hooks/use-add-on-prices.js +55 -54
- package/dist/cjs/add-ons/hooks/use-add-on-prices.js.map +1 -1
- package/dist/cjs/add-ons/hooks/use-add-on-purchase-status.js +14 -6
- package/dist/cjs/add-ons/hooks/use-add-on-purchase-status.js.map +1 -1
- package/dist/cjs/add-ons/hooks/use-add-ons.js +35 -193
- package/dist/cjs/add-ons/hooks/use-add-ons.js.map +1 -1
- package/dist/cjs/add-ons/hooks/use-available-storage-add-ons.js +19 -12
- package/dist/cjs/add-ons/hooks/use-available-storage-add-ons.js.map +1 -1
- package/dist/cjs/add-ons/hooks/use-get-purchased-storage-add-on.js +21 -0
- package/dist/cjs/add-ons/hooks/use-get-purchased-storage-add-on.js.map +1 -0
- package/dist/cjs/add-ons/hooks/use-storage-add-on-availability.js +30 -0
- package/dist/cjs/add-ons/hooks/use-storage-add-on-availability.js.map +1 -0
- package/dist/cjs/add-ons/index.js +6 -1
- package/dist/cjs/add-ons/index.js.map +1 -1
- package/dist/cjs/add-ons/mocks.js +31 -0
- package/dist/cjs/add-ons/mocks.js.map +1 -0
- package/dist/cjs/analyzer/actions.js +1 -3
- package/dist/cjs/analyzer/actions.js.map +1 -1
- package/dist/cjs/contextual-help/admin-sections.js +4 -5
- package/dist/cjs/contextual-help/admin-sections.js.map +1 -1
- package/dist/cjs/contextual-help/contextual-help.js +6 -4
- package/dist/cjs/contextual-help/contextual-help.js.map +1 -1
- package/dist/cjs/domain-suggestions/index.js +9 -16
- package/dist/cjs/domain-suggestions/index.js.map +1 -1
- package/dist/cjs/domain-suggestions/queries.js +3 -4
- package/dist/cjs/domain-suggestions/queries.js.map +1 -1
- package/dist/cjs/domain-suggestions/resolvers.js +3 -3
- package/dist/cjs/domain-suggestions/resolvers.js.map +1 -1
- package/dist/cjs/domain-suggestions/utils.js +5 -8
- package/dist/cjs/domain-suggestions/utils.js.map +1 -1
- package/dist/cjs/help-center/actions.js +92 -17
- package/dist/cjs/help-center/actions.js.map +1 -1
- package/dist/cjs/help-center/index.js +27 -2
- package/dist/cjs/help-center/index.js.map +1 -1
- package/dist/cjs/help-center/reducer.js +38 -0
- package/dist/cjs/help-center/reducer.js.map +1 -1
- package/dist/cjs/help-center/resolvers.js +28 -0
- package/dist/cjs/help-center/resolvers.js.map +1 -0
- package/dist/cjs/help-center/selectors.js +11 -1
- package/dist/cjs/help-center/selectors.js.map +1 -1
- package/dist/cjs/index.js +3 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/mutations/use-domains-bulk-actions-mutation.js +1 -2
- package/dist/cjs/mutations/use-domains-bulk-actions-mutation.js.map +1 -1
- package/dist/cjs/newsletter-categories/index.js +36 -0
- package/dist/cjs/newsletter-categories/index.js.map +1 -0
- package/dist/cjs/onboard/actions.js +14 -79
- package/dist/cjs/onboard/actions.js.map +1 -1
- package/dist/cjs/onboard/constants.js +18 -7
- package/dist/cjs/onboard/constants.js.map +1 -1
- package/dist/cjs/onboard/index.js +6 -4
- package/dist/cjs/onboard/index.js.map +1 -1
- package/dist/cjs/onboard/reducer.js +31 -23
- package/dist/cjs/onboard/reducer.js.map +1 -1
- package/dist/cjs/onboard/selectors.js +5 -3
- package/dist/cjs/onboard/selectors.js.map +1 -1
- package/dist/cjs/onboard/utils.js +12 -11
- package/dist/cjs/onboard/utils.js.map +1 -1
- package/dist/cjs/plans/constants.js +1 -0
- package/dist/cjs/plans/constants.js.map +1 -1
- package/dist/cjs/plans/hooks/use-current-plan.js +1 -1
- package/dist/cjs/plans/hooks/use-current-plan.js.map +1 -1
- package/dist/cjs/plans/hooks/use-intro-offers.js +1 -1
- package/dist/cjs/plans/hooks/use-intro-offers.js.map +1 -1
- package/dist/cjs/plans/hooks/use-pricing-meta-for-grid-plans.js +52 -9
- package/dist/cjs/plans/hooks/use-pricing-meta-for-grid-plans.js.map +1 -1
- package/dist/cjs/plans/index.js +2 -2
- package/dist/cjs/plans/index.js.map +1 -1
- package/dist/cjs/plans/mock/next/store/plans.js +12 -6
- package/dist/cjs/plans/mock/next/store/plans.js.map +1 -1
- package/dist/cjs/plans/queries/lib/unpack-cost-overrides.js +1 -1
- package/dist/cjs/plans/queries/lib/unpack-cost-overrides.js.map +1 -1
- package/dist/cjs/plans/queries/lib/unpack-intro-offer.js +16 -3
- package/dist/cjs/plans/queries/lib/unpack-intro-offer.js.map +1 -1
- package/dist/cjs/plans/queries/lib/use-query-keys-factory.js +5 -1
- package/dist/cjs/plans/queries/lib/use-query-keys-factory.js.map +1 -1
- package/dist/cjs/plans/queries/use-plans.js +1 -1
- package/dist/cjs/plans/queries/use-site-plans.js +6 -2
- package/dist/cjs/plans/queries/use-site-plans.js.map +1 -1
- package/dist/cjs/plans/resolvers.js +5 -7
- package/dist/cjs/plans/resolvers.js.map +1 -1
- package/dist/cjs/products-list/queries/use-products.js +1 -1
- package/dist/cjs/purchases/lib/assembler.js +4 -3
- package/dist/cjs/purchases/lib/assembler.js.map +1 -1
- package/dist/cjs/purchases/queries/use-site-purchases.js +1 -2
- package/dist/cjs/purchases/queries/use-site-purchases.js.map +1 -1
- package/dist/cjs/queries/use-all-domains-query.js +2 -2
- package/dist/cjs/queries/use-all-domains-query.js.map +1 -1
- package/dist/cjs/queries/use-bulk-domain-update-status-query.js +7 -7
- package/dist/cjs/queries/use-bulk-domain-update-status-query.js.map +1 -1
- package/dist/cjs/queries/use-launchpad.js +13 -8
- package/dist/cjs/queries/use-launchpad.js.map +1 -1
- package/dist/cjs/queries/use-site-domains-query.js +3 -3
- package/dist/cjs/queries/use-site-domains-query.js.map +1 -1
- package/dist/cjs/queries/use-site-intent.js +1 -2
- package/dist/cjs/queries/use-site-intent.js.map +1 -1
- package/dist/cjs/queries/use-site-query.js +2 -3
- package/dist/cjs/queries/use-site-query.js.map +1 -1
- package/dist/cjs/reader/contexts/site-subscriptions-query-props.js +11 -10
- package/dist/cjs/reader/contexts/site-subscriptions-query-props.js.map +1 -1
- package/dist/cjs/reader/helpers/index.js +2 -2
- package/dist/cjs/reader/helpers/index.js.map +1 -1
- package/dist/cjs/reader/hooks/index.js +5 -4
- package/dist/cjs/reader/hooks/index.js.map +1 -1
- package/dist/cjs/reader/hooks/use-is-logged-in.js +10 -8
- package/dist/cjs/reader/hooks/use-is-logged-in.js.map +1 -1
- package/dist/cjs/reader/mutations/index.js +14 -13
- package/dist/cjs/reader/mutations/index.js.map +1 -1
- package/dist/cjs/reader/queries/index.js +11 -10
- package/dist/cjs/reader/queries/index.js.map +1 -1
- package/dist/cjs/reader/queries/use-read-feed-query.js +2 -2
- package/dist/cjs/reader/queries/use-read-feed-query.js.map +1 -1
- package/dist/cjs/reader/queries/use-read-feed-site-query.js +1 -1
- package/dist/cjs/reader/queries/use-read-feed-site-query.js.map +1 -1
- package/dist/cjs/site/actions.js +37 -11
- package/dist/cjs/site/actions.js.map +1 -1
- package/dist/cjs/site/constants.js +1 -4
- package/dist/cjs/site/constants.js.map +1 -1
- package/dist/cjs/site/index.js +2 -2
- package/dist/cjs/site/index.js.map +1 -1
- package/dist/cjs/site/queries/use-site-media-storage.js +1 -0
- package/dist/cjs/site/queries/use-site-media-storage.js.map +1 -1
- package/dist/cjs/site/queries/use-site-user-query.js +1 -2
- package/dist/cjs/site/queries/use-site-user-query.js.map +1 -1
- package/dist/cjs/site/selectors.js +2 -2
- package/dist/cjs/site/selectors.js.map +1 -1
- package/dist/cjs/site/types.js.map +1 -1
- package/dist/cjs/starter-designs-queries/use-starter-design-by-slug.js +1 -2
- package/dist/cjs/starter-designs-queries/use-starter-design-by-slug.js.map +1 -1
- package/dist/cjs/starter-designs-queries/use-starter-designs-query.js +3 -3
- package/dist/cjs/starter-designs-queries/use-starter-designs-query.js.map +1 -1
- package/dist/cjs/stepper-internal/index.js +1 -2
- package/dist/cjs/stepper-internal/index.js.map +1 -1
- package/dist/cjs/stepper-internal/reducer.js.map +1 -1
- package/dist/cjs/subscriber/actions.js +39 -31
- package/dist/cjs/subscriber/actions.js.map +1 -1
- package/dist/cjs/subscriber/index.js +0 -2
- package/dist/cjs/subscriber/index.js.map +1 -1
- package/dist/cjs/subscriber/selectors.js +5 -0
- package/dist/cjs/subscriber/selectors.js.map +1 -1
- package/dist/cjs/templates/index.js +2 -1
- package/dist/cjs/templates/index.js.map +1 -1
- package/dist/cjs/user/actions.js +1 -2
- package/dist/cjs/user/actions.js.map +1 -1
- package/dist/cjs/user/index.js +1 -2
- package/dist/cjs/user/index.js.map +1 -1
- package/dist/cjs/user/resolvers.js +1 -2
- package/dist/cjs/user/resolvers.js.map +1 -1
- package/dist/cjs/users/use-send-invites.js +2 -4
- package/dist/cjs/users/use-send-invites.js.map +1 -1
- package/dist/esm/add-ons/add-ons-list.js +86 -0
- package/dist/esm/add-ons/add-ons-list.js.map +1 -0
- package/dist/esm/add-ons/constants.js +20 -2
- package/dist/esm/add-ons/constants.js.map +1 -1
- package/dist/esm/add-ons/hooks/use-add-on-prices.js +51 -53
- package/dist/esm/add-ons/hooks/use-add-on-prices.js.map +1 -1
- package/dist/esm/add-ons/hooks/use-add-on-purchase-status.js +14 -6
- package/dist/esm/add-ons/hooks/use-add-on-purchase-status.js.map +1 -1
- package/dist/esm/add-ons/hooks/use-add-ons.js +36 -194
- package/dist/esm/add-ons/hooks/use-add-ons.js.map +1 -1
- package/dist/esm/add-ons/hooks/use-available-storage-add-ons.js +18 -12
- package/dist/esm/add-ons/hooks/use-available-storage-add-ons.js.map +1 -1
- package/dist/esm/add-ons/hooks/use-get-purchased-storage-add-on.js +17 -0
- package/dist/esm/add-ons/hooks/use-get-purchased-storage-add-on.js.map +1 -0
- package/dist/esm/add-ons/hooks/use-storage-add-on-availability.js +26 -0
- package/dist/esm/add-ons/hooks/use-storage-add-on-availability.js.map +1 -0
- package/dist/esm/add-ons/index.js +2 -0
- package/dist/esm/add-ons/index.js.map +1 -1
- package/dist/esm/add-ons/mocks.js +27 -0
- package/dist/esm/add-ons/mocks.js.map +1 -0
- package/dist/esm/analyzer/actions.js +0 -1
- package/dist/esm/analyzer/actions.js.map +1 -1
- package/dist/esm/contextual-help/admin-sections.js +3 -3
- package/dist/esm/contextual-help/contextual-help.js +3 -2
- package/dist/esm/contextual-help/contextual-help.js.map +1 -1
- package/dist/esm/domain-suggestions/index.js +9 -15
- package/dist/esm/domain-suggestions/index.js.map +1 -1
- package/dist/esm/domain-suggestions/utils.js +1 -4
- package/dist/esm/domain-suggestions/utils.js.map +1 -1
- package/dist/esm/help-center/actions.js +82 -13
- package/dist/esm/help-center/actions.js.map +1 -1
- package/dist/esm/help-center/index.js +23 -0
- package/dist/esm/help-center/index.js.map +1 -1
- package/dist/esm/help-center/reducer.js +38 -0
- package/dist/esm/help-center/reducer.js.map +1 -1
- package/dist/esm/help-center/resolvers.js +25 -0
- package/dist/esm/help-center/resolvers.js.map +1 -0
- package/dist/esm/help-center/selectors.js +5 -0
- package/dist/esm/help-center/selectors.js.map +1 -1
- package/dist/esm/index.js +2 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/newsletter-categories/index.js +31 -0
- package/dist/esm/newsletter-categories/index.js.map +1 -0
- package/dist/esm/onboard/actions.js +8 -70
- package/dist/esm/onboard/actions.js.map +1 -1
- package/dist/esm/onboard/constants.js +18 -7
- package/dist/esm/onboard/constants.js.map +1 -1
- package/dist/esm/onboard/index.js +4 -2
- package/dist/esm/onboard/index.js.map +1 -1
- package/dist/esm/onboard/reducer.js +31 -23
- package/dist/esm/onboard/reducer.js.map +1 -1
- package/dist/esm/onboard/selectors.js +2 -1
- package/dist/esm/onboard/selectors.js.map +1 -1
- package/dist/esm/onboard/utils.js +12 -11
- package/dist/esm/onboard/utils.js.map +1 -1
- package/dist/esm/plans/constants.js +1 -0
- package/dist/esm/plans/constants.js.map +1 -1
- package/dist/esm/plans/hooks/use-current-plan.js +1 -1
- package/dist/esm/plans/hooks/use-current-plan.js.map +1 -1
- package/dist/esm/plans/hooks/use-intro-offers.js +1 -1
- package/dist/esm/plans/hooks/use-intro-offers.js.map +1 -1
- package/dist/esm/plans/hooks/use-pricing-meta-for-grid-plans.js +52 -9
- package/dist/esm/plans/hooks/use-pricing-meta-for-grid-plans.js.map +1 -1
- package/dist/esm/plans/mock/next/store/plans.js +12 -6
- package/dist/esm/plans/mock/next/store/plans.js.map +1 -1
- package/dist/esm/plans/queries/lib/unpack-intro-offer.js +16 -3
- package/dist/esm/plans/queries/lib/unpack-intro-offer.js.map +1 -1
- package/dist/esm/plans/queries/lib/use-query-keys-factory.js +5 -1
- package/dist/esm/plans/queries/lib/use-query-keys-factory.js.map +1 -1
- package/dist/esm/plans/queries/use-plans.js +1 -1
- package/dist/esm/plans/queries/use-site-plans.js +6 -2
- package/dist/esm/plans/queries/use-site-plans.js.map +1 -1
- package/dist/esm/plans/resolvers.js +1 -1
- package/dist/esm/plans/resolvers.js.map +1 -1
- package/dist/esm/products-list/queries/use-products.js +1 -1
- package/dist/esm/purchases/lib/assembler.js +2 -0
- package/dist/esm/purchases/lib/assembler.js.map +1 -1
- package/dist/esm/queries/use-all-domains-query.js.map +1 -1
- package/dist/esm/queries/use-bulk-domain-update-status-query.js +5 -5
- package/dist/esm/queries/use-bulk-domain-update-status-query.js.map +1 -1
- package/dist/esm/queries/use-launchpad.js +11 -6
- package/dist/esm/queries/use-launchpad.js.map +1 -1
- package/dist/esm/queries/use-site-domains-query.js.map +1 -1
- package/dist/esm/reader/contexts/site-subscriptions-query-props.js +12 -11
- package/dist/esm/reader/contexts/site-subscriptions-query-props.js.map +1 -1
- package/dist/esm/reader/hooks/use-is-logged-in.js +9 -8
- package/dist/esm/reader/hooks/use-is-logged-in.js.map +1 -1
- package/dist/esm/reader/queries/use-read-feed-query.js +2 -2
- package/dist/esm/reader/queries/use-read-feed-query.js.map +1 -1
- package/dist/esm/reader/queries/use-read-feed-site-query.js +1 -1
- package/dist/esm/reader/queries/use-read-feed-site-query.js.map +1 -1
- package/dist/esm/site/actions.js +36 -9
- package/dist/esm/site/actions.js.map +1 -1
- package/dist/esm/site/constants.js +1 -4
- package/dist/esm/site/constants.js.map +1 -1
- package/dist/esm/site/queries/use-site-media-storage.js +1 -0
- package/dist/esm/site/queries/use-site-media-storage.js.map +1 -1
- package/dist/esm/site/types.js.map +1 -1
- package/dist/esm/starter-designs-queries/use-starter-designs-query.js +2 -1
- package/dist/esm/starter-designs-queries/use-starter-designs-query.js.map +1 -1
- package/dist/esm/stepper-internal/reducer.js.map +1 -1
- package/dist/esm/subscriber/actions.js +38 -29
- package/dist/esm/subscriber/actions.js.map +1 -1
- package/dist/esm/subscriber/index.js +0 -2
- package/dist/esm/subscriber/index.js.map +1 -1
- package/dist/esm/subscriber/selectors.js +4 -0
- package/dist/esm/subscriber/selectors.js.map +1 -1
- package/dist/esm/users/use-send-invites.js +1 -2
- package/dist/esm/users/use-send-invites.js.map +1 -1
- package/dist/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/add-ons/add-ons-list.d.ts +4 -0
- package/dist/types/add-ons/add-ons-list.d.ts.map +1 -0
- package/dist/types/add-ons/constants.d.ts +8 -3
- package/dist/types/add-ons/constants.d.ts.map +1 -1
- package/dist/types/add-ons/hooks/use-add-on-checkout-link.d.ts +1 -1
- package/dist/types/add-ons/hooks/use-add-on-checkout-link.d.ts.map +1 -1
- package/dist/types/add-ons/hooks/use-add-on-prices.d.ts +12 -7
- package/dist/types/add-ons/hooks/use-add-on-prices.d.ts.map +1 -1
- package/dist/types/add-ons/hooks/use-add-on-purchase-status.d.ts +7 -8
- package/dist/types/add-ons/hooks/use-add-on-purchase-status.d.ts.map +1 -1
- package/dist/types/add-ons/hooks/use-add-ons.d.ts +1 -2
- package/dist/types/add-ons/hooks/use-add-ons.d.ts.map +1 -1
- package/dist/types/add-ons/hooks/use-available-storage-add-ons.d.ts +9 -2
- package/dist/types/add-ons/hooks/use-available-storage-add-ons.d.ts.map +1 -1
- package/dist/types/add-ons/hooks/use-get-purchased-storage-add-on.d.ts +5 -0
- package/dist/types/add-ons/hooks/use-get-purchased-storage-add-on.d.ts.map +1 -0
- package/dist/types/add-ons/hooks/use-storage-add-on-availability.d.ts +17 -0
- package/dist/types/add-ons/hooks/use-storage-add-on-availability.d.ts.map +1 -0
- package/dist/types/add-ons/hooks/use-storage-add-ons.d.ts.map +1 -1
- package/dist/types/add-ons/index.d.ts +2 -0
- package/dist/types/add-ons/index.d.ts.map +1 -1
- package/dist/types/add-ons/mocks.d.ts +4 -0
- package/dist/types/add-ons/mocks.d.ts.map +1 -0
- package/dist/types/add-ons/types.d.ts +6 -7
- package/dist/types/add-ons/types.d.ts.map +1 -1
- package/dist/types/analyzer/actions.d.ts.map +1 -1
- package/dist/types/analyzer/reducers.d.ts +4 -2
- package/dist/types/analyzer/reducers.d.ts.map +1 -1
- package/dist/types/analyzer/selectors.d.ts +2 -2
- package/dist/types/analyzer/selectors.d.ts.map +1 -1
- package/dist/types/contextual-help/contextual-help.d.ts.map +1 -1
- package/dist/types/domain-suggestions/actions.d.ts.map +1 -1
- package/dist/types/domain-suggestions/index.d.ts +3 -2
- package/dist/types/domain-suggestions/index.d.ts.map +1 -1
- package/dist/types/domain-suggestions/queries.d.ts +24 -24
- package/dist/types/domain-suggestions/reducer.d.ts +6 -2
- package/dist/types/domain-suggestions/reducer.d.ts.map +1 -1
- package/dist/types/domain-suggestions/resolvers.d.ts.map +1 -1
- package/dist/types/domain-suggestions/selectors.d.ts.map +1 -1
- package/dist/types/domain-suggestions/types.d.ts +0 -3
- package/dist/types/domain-suggestions/types.d.ts.map +1 -1
- package/dist/types/domain-suggestions/utils.d.ts +0 -3
- package/dist/types/domain-suggestions/utils.d.ts.map +1 -1
- package/dist/types/help-center/actions.d.ts +42 -47
- package/dist/types/help-center/actions.d.ts.map +1 -1
- package/dist/types/help-center/index.d.ts +2 -0
- package/dist/types/help-center/index.d.ts.map +1 -1
- package/dist/types/help-center/reducer.d.ts +29 -2
- package/dist/types/help-center/reducer.d.ts.map +1 -1
- package/dist/types/help-center/resolvers.d.ts +13 -0
- package/dist/types/help-center/resolvers.d.ts.map +1 -0
- package/dist/types/help-center/selectors.d.ts +5 -0
- package/dist/types/help-center/selectors.d.ts.map +1 -1
- package/dist/types/help-center/types.d.ts +8 -0
- package/dist/types/help-center/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +105 -110
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/mutations/use-domains-bulk-actions-mutation.d.ts +4 -4
- package/dist/types/mutations/use-domains-bulk-actions-mutation.d.ts.map +1 -1
- package/dist/types/newsletter-categories/index.d.ts +21 -0
- package/dist/types/newsletter-categories/index.d.ts.map +1 -0
- package/dist/types/onboard/actions.d.ts +23 -77
- package/dist/types/onboard/actions.d.ts.map +1 -1
- package/dist/types/onboard/constants.d.ts +16 -7
- package/dist/types/onboard/constants.d.ts.map +1 -1
- package/dist/types/onboard/index.d.ts.map +1 -1
- package/dist/types/onboard/reducer.d.ts +56 -5
- package/dist/types/onboard/reducer.d.ts.map +1 -1
- package/dist/types/onboard/selectors.d.ts +8 -7
- package/dist/types/onboard/selectors.d.ts.map +1 -1
- package/dist/types/onboard/utils.d.ts +5 -1
- package/dist/types/onboard/utils.d.ts.map +1 -1
- package/dist/types/plans/actions.d.ts.map +1 -1
- package/dist/types/plans/constants.d.ts +1 -0
- package/dist/types/plans/constants.d.ts.map +1 -1
- package/dist/types/plans/hooks/use-current-plan-expiry-date.d.ts.map +1 -1
- package/dist/types/plans/hooks/use-current-plan-term.d.ts +1 -1
- package/dist/types/plans/hooks/use-current-plan-term.d.ts.map +1 -1
- package/dist/types/plans/hooks/use-current-plan.d.ts.map +1 -1
- package/dist/types/plans/hooks/use-intro-offers-for-woo-express.d.ts.map +1 -1
- package/dist/types/plans/hooks/use-intro-offers.d.ts.map +1 -1
- package/dist/types/plans/hooks/use-pricing-meta-for-grid-plans.d.ts +7 -6
- package/dist/types/plans/hooks/use-pricing-meta-for-grid-plans.d.ts.map +1 -1
- package/dist/types/plans/mock/next/store/plans.d.ts.map +1 -1
- package/dist/types/plans/queries/lib/unpack-intro-offer.d.ts.map +1 -1
- package/dist/types/plans/queries/lib/use-query-keys-factory.d.ts +1 -1
- package/dist/types/plans/queries/lib/use-query-keys-factory.d.ts.map +1 -1
- package/dist/types/plans/queries/use-site-plans.d.ts +6 -1
- package/dist/types/plans/queries/use-site-plans.d.ts.map +1 -1
- package/dist/types/plans/reducer.d.ts +7 -2
- package/dist/types/plans/reducer.d.ts.map +1 -1
- package/dist/types/plans/resolvers.d.ts +1 -1
- package/dist/types/plans/selectors.d.ts +1 -1
- package/dist/types/plans/selectors.d.ts.map +1 -1
- package/dist/types/plans/test-utils/index.d.ts.map +1 -1
- package/dist/types/plans/types.d.ts +24 -2
- package/dist/types/plans/types.d.ts.map +1 -1
- package/dist/types/products-list/actions.d.ts.map +1 -1
- package/dist/types/products-list/reducer.d.ts +5 -2
- package/dist/types/products-list/reducer.d.ts.map +1 -1
- package/dist/types/products-list/resolvers.d.ts.map +1 -1
- package/dist/types/products-list/selectors.d.ts +2 -2
- package/dist/types/products-list/selectors.d.ts.map +1 -1
- package/dist/types/products-list/types.d.ts +1 -0
- package/dist/types/products-list/types.d.ts.map +1 -1
- package/dist/types/purchases/hooks/use-site-purchase-by-id.d.ts.map +1 -1
- package/dist/types/purchases/hooks/use-site-purchases-by-product-slug.d.ts.map +1 -1
- package/dist/types/purchases/lib/assembler.d.ts.map +1 -1
- package/dist/types/purchases/queries/use-site-purchases.d.ts +1 -1
- package/dist/types/purchases/queries/use-site-purchases.d.ts.map +1 -1
- package/dist/types/purchases/types.d.ts +5 -0
- package/dist/types/purchases/types.d.ts.map +1 -1
- package/dist/types/queries/use-all-domains-query.d.ts +3 -2
- package/dist/types/queries/use-all-domains-query.d.ts.map +1 -1
- package/dist/types/queries/use-bulk-domain-update-status-query.d.ts +6 -1
- package/dist/types/queries/use-bulk-domain-update-status-query.d.ts.map +1 -1
- package/dist/types/queries/use-happiness-engineers-query.d.ts +1 -1
- package/dist/types/queries/use-launchpad.d.ts +3 -3
- package/dist/types/queries/use-launchpad.d.ts.map +1 -1
- package/dist/types/queries/use-site-domains-query.d.ts +8 -2
- package/dist/types/queries/use-site-domains-query.d.ts.map +1 -1
- package/dist/types/queries/use-site-intent.d.ts +2 -2
- package/dist/types/queries/use-site-query.d.ts +1 -1
- package/dist/types/queries/use-site-query.d.ts.map +1 -1
- package/dist/types/reader/contexts/site-subscriptions-query-props.d.ts +4 -2
- package/dist/types/reader/contexts/site-subscriptions-query-props.d.ts.map +1 -1
- package/dist/types/reader/helpers/index.d.ts +1 -1
- package/dist/types/reader/helpers/index.d.ts.map +1 -1
- package/dist/types/reader/helpers/optimistic-update.d.ts.map +1 -1
- package/dist/types/reader/helpers/query-key.d.ts.map +1 -1
- package/dist/types/reader/helpers/type-guards.d.ts.map +1 -1
- package/dist/types/reader/helpers/validators.d.ts +1 -1
- package/dist/types/reader/helpers/validators.d.ts.map +1 -1
- package/dist/types/reader/hooks/use-cache-key.d.ts.map +1 -1
- package/dist/types/reader/hooks/use-is-logged-in.d.ts +1 -2
- package/dist/types/reader/hooks/use-is-logged-in.d.ts.map +1 -1
- package/dist/types/reader/index.d.ts +103 -106
- package/dist/types/reader/index.d.ts.map +1 -1
- package/dist/types/reader/mutations/use-pending-post-confirm-mutation.d.ts +1 -1
- package/dist/types/reader/mutations/use-pending-post-delete-mutation.d.ts +1 -1
- package/dist/types/reader/mutations/use-pending-site-confirm-mutation.d.ts +1 -1
- package/dist/types/reader/mutations/use-pending-site-delete-mutation.d.ts +1 -1
- package/dist/types/reader/mutations/use-post-notify-me-of-new-comments-mutation.d.ts +1 -1
- package/dist/types/reader/mutations/use-post-unsubscribe-mutation.d.ts +1 -1
- package/dist/types/reader/mutations/use-site-delivery-frequency-mutation.d.ts +1 -1
- package/dist/types/reader/mutations/use-site-email-me-new-comments-mutation.d.ts +1 -1
- package/dist/types/reader/mutations/use-site-email-me-new-posts-mutation.d.ts +1 -1
- package/dist/types/reader/mutations/use-site-notify-me-of-new-posts-mutation.d.ts +1 -1
- package/dist/types/reader/mutations/use-site-subscribe-mutation.d.ts +1 -1
- package/dist/types/reader/mutations/use-site-unsubscribe-mutation.d.ts +1 -1
- package/dist/types/reader/mutations/use-user-settings-mutation.d.ts +1 -1
- package/dist/types/reader/queries/use-pending-post-subscriptions-query.d.ts +8 -8
- package/dist/types/reader/queries/use-pending-post-subscriptions-query.d.ts.map +1 -1
- package/dist/types/reader/queries/use-pending-site-subscriptions-query.d.ts +8 -8
- package/dist/types/reader/queries/use-pending-site-subscriptions-query.d.ts.map +1 -1
- package/dist/types/reader/queries/use-post-subscriptions-query.d.ts +16 -16
- package/dist/types/reader/queries/use-post-subscriptions-query.d.ts.map +1 -1
- package/dist/types/reader/queries/use-read-feed-query.d.ts +3 -1
- package/dist/types/reader/queries/use-read-feed-query.d.ts.map +1 -1
- package/dist/types/reader/queries/use-read-feed-search-query.d.ts +1 -1
- package/dist/types/reader/queries/use-read-feed-search-query.d.ts.map +1 -1
- package/dist/types/reader/queries/use-read-feed-site-query.d.ts +1 -1
- package/dist/types/reader/queries/use-read-feed-site-query.d.ts.map +1 -1
- package/dist/types/reader/queries/use-site-subscription-details-query.d.ts +1 -1
- package/dist/types/reader/queries/use-site-subscription-details-query.d.ts.map +1 -1
- package/dist/types/reader/queries/use-site-subscriptions-query.d.ts +12 -12
- package/dist/types/reader/queries/use-site-subscriptions-query.d.ts.map +1 -1
- package/dist/types/reader/queries/use-subscriptions-count-query.d.ts +1 -1
- package/dist/types/reader/queries/use-subscriptions-count-query.d.ts.map +1 -1
- package/dist/types/reader/queries/use-user-settings-query.d.ts +1 -1
- package/dist/types/site/actions.d.ts +11 -11
- package/dist/types/site/actions.d.ts.map +1 -1
- package/dist/types/site/constants.d.ts +1 -1
- package/dist/types/site/constants.d.ts.map +1 -1
- package/dist/types/site/queries/use-site-media-storage.d.ts.map +1 -1
- package/dist/types/site/queries/use-site-user-query.d.ts +1 -1
- package/dist/types/site/queries/use-site-user-query.d.ts.map +1 -1
- package/dist/types/site/reducer.d.ts +28 -9
- package/dist/types/site/reducer.d.ts.map +1 -1
- package/dist/types/site/resolvers.d.ts.map +1 -1
- package/dist/types/site/selectors.d.ts +8 -8
- package/dist/types/site/selectors.d.ts.map +1 -1
- package/dist/types/site/types.d.ts +16 -37
- package/dist/types/site/types.d.ts.map +1 -1
- package/dist/types/site/utils.d.ts.map +1 -1
- package/dist/types/site-reset/use-site-reset-content-summary-query.d.ts.map +1 -1
- package/dist/types/site-reset/use-site-reset-mutation.d.ts +4 -4
- package/dist/types/site-reset/use-site-reset-mutation.d.ts.map +1 -1
- package/dist/types/site-reset/use-site-reset-status-query.d.ts.map +1 -1
- package/dist/types/starter-designs-queries/types.d.ts +1 -10
- package/dist/types/starter-designs-queries/types.d.ts.map +1 -1
- package/dist/types/starter-designs-queries/use-starter-designs-query.d.ts +2 -0
- package/dist/types/starter-designs-queries/use-starter-designs-query.d.ts.map +1 -1
- package/dist/types/stepper-internal/actions.d.ts.map +1 -1
- package/dist/types/stepper-internal/reducer.d.ts +5 -2
- package/dist/types/stepper-internal/reducer.d.ts.map +1 -1
- package/dist/types/stepper-internal/selectors.d.ts +4 -2
- package/dist/types/stepper-internal/selectors.d.ts.map +1 -1
- package/dist/types/subscriber/actions.d.ts +11 -53
- package/dist/types/subscriber/actions.d.ts.map +1 -1
- package/dist/types/subscriber/index.d.ts +14 -52
- package/dist/types/subscriber/index.d.ts.map +1 -1
- package/dist/types/subscriber/reducers.d.ts +4 -2
- package/dist/types/subscriber/reducers.d.ts.map +1 -1
- package/dist/types/subscriber/selectors.d.ts +7 -5
- package/dist/types/subscriber/selectors.d.ts.map +1 -1
- package/dist/types/subscriber/types.d.ts +17 -1
- package/dist/types/subscriber/types.d.ts.map +1 -1
- package/dist/types/templates/use-template.d.ts +1 -1
- package/dist/types/templates/use-template.d.ts.map +1 -1
- package/dist/types/theme/utils.d.ts.map +1 -1
- package/dist/types/user/reducer.d.ts +4 -2
- package/dist/types/user/reducer.d.ts.map +1 -1
- package/dist/types/user/selectors.d.ts +2 -2
- package/dist/types/user/selectors.d.ts.map +1 -1
- package/dist/types/users/use-send-invites.d.ts +1 -1
- package/dist/types/users/use-send-invites.d.ts.map +1 -1
- package/dist/types/wpcom-plans-ui/actions.d.ts +2 -2
- package/dist/types/wpcom-plans-ui/actions.d.ts.map +1 -1
- package/dist/types/wpcom-plans-ui/reducer.d.ts +5 -2
- package/dist/types/wpcom-plans-ui/reducer.d.ts.map +1 -1
- package/dist/types/wpcom-plans-ui/selectors.d.ts.map +1 -1
- package/dist/types/wpcom-request-controls/index.d.ts +2 -2
- package/dist/types/wpcom-request-controls/index.d.ts.map +1 -1
- package/package.json +17 -18
- package/src/add-ons/add-ons-list.ts +109 -0
- package/src/add-ons/constants.ts +20 -2
- package/src/add-ons/hooks/use-add-on-prices.ts +67 -54
- package/src/add-ons/hooks/use-add-on-purchase-status.ts +21 -10
- package/src/add-ons/hooks/use-add-ons.ts +53 -251
- package/src/add-ons/hooks/use-available-storage-add-ons.ts +26 -16
- package/src/add-ons/hooks/use-get-purchased-storage-add-on.ts +24 -0
- package/src/add-ons/hooks/use-storage-add-on-availability.ts +38 -0
- package/src/add-ons/index.ts +5 -0
- package/src/add-ons/mocks.ts +29 -0
- package/src/add-ons/types.ts +6 -6
- package/src/analyzer/actions.ts +0 -1
- package/src/contextual-help/admin-sections.ts +3 -3
- package/src/contextual-help/contextual-help.tsx +4 -2
- package/src/domain-suggestions/index.ts +9 -16
- package/src/domain-suggestions/test/selectors.ts +12 -12
- package/src/domain-suggestions/types.ts +0 -4
- package/src/domain-suggestions/utils.ts +1 -4
- package/src/help-center/actions.ts +123 -16
- package/src/help-center/index.ts +32 -0
- package/src/help-center/reducer.ts +54 -0
- package/src/help-center/resolvers.ts +28 -0
- package/src/help-center/selectors.ts +6 -0
- package/src/help-center/types.ts +9 -1
- package/src/index.ts +1 -5
- package/src/newsletter-categories/index.ts +54 -0
- package/src/newsletter-categories/test/index.tsx +105 -0
- package/src/onboard/actions.ts +13 -103
- package/src/onboard/constants.ts +19 -7
- package/src/onboard/index.ts +4 -2
- package/src/onboard/reducer.ts +48 -24
- package/src/onboard/selectors.ts +2 -1
- package/src/onboard/test/utils.ts +36 -3
- package/src/onboard/utils.ts +21 -15
- package/src/plans/constants.ts +1 -0
- package/src/plans/hooks/test/use-pricing-meta-for-grid-plans.ts +241 -122
- package/src/plans/hooks/use-current-plan.ts +1 -1
- package/src/plans/hooks/use-intro-offers.ts +1 -1
- package/src/plans/hooks/use-pricing-meta-for-grid-plans.ts +69 -18
- package/src/plans/mock/next/store/plans.ts +12 -6
- package/src/plans/queries/lib/unpack-intro-offer.ts +23 -4
- package/src/plans/queries/lib/use-query-keys-factory.ts +5 -1
- package/src/plans/queries/use-plans.ts +1 -1
- package/src/plans/queries/use-site-plans.ts +11 -2
- package/src/plans/resolvers.ts +1 -1
- package/src/plans/types.ts +24 -2
- package/src/products-list/queries/use-products.ts +1 -1
- package/src/products-list/types.ts +1 -0
- package/src/purchases/lib/assembler.ts +2 -0
- package/src/purchases/types.ts +5 -0
- package/src/queries/use-all-domains-query.ts +3 -0
- package/src/queries/use-bulk-domain-update-status-query.ts +10 -5
- package/src/queries/use-launchpad.ts +15 -8
- package/src/queries/use-site-domains-query.ts +7 -1
- package/src/reader/contexts/site-subscriptions-query-props.tsx +23 -14
- package/src/reader/hooks/use-is-logged-in.ts +9 -16
- package/src/reader/queries/use-read-feed-query.ts +4 -2
- package/src/reader/queries/use-read-feed-site-query.ts +2 -2
- package/src/site/actions.ts +44 -15
- package/src/site/constants.ts +1 -7
- package/src/site/queries/use-site-media-storage.ts +1 -0
- package/src/site/test/actions.ts +73 -7
- package/src/site/types.ts +16 -41
- package/src/starter-designs-queries/types.ts +1 -12
- package/src/starter-designs-queries/use-starter-designs-query.ts +4 -0
- package/src/stepper-internal/reducer.ts +1 -0
- package/src/subscriber/actions.ts +111 -79
- package/src/subscriber/index.ts +0 -2
- package/src/subscriber/selectors.ts +6 -0
- package/src/subscriber/types.ts +18 -1
- package/src/users/use-send-invites.ts +1 -2
- package/dist/cjs/add-ons/hooks/use-add-on-display-cost.js +0 -29
- package/dist/cjs/add-ons/hooks/use-add-on-display-cost.js.map +0 -1
- package/dist/cjs/add-ons/lib/is-storage-addon-enabled.js +0 -11
- package/dist/cjs/add-ons/lib/is-storage-addon-enabled.js.map +0 -1
- package/dist/cjs/automated-transfer-eligibility/actions.js +0 -10
- package/dist/cjs/automated-transfer-eligibility/actions.js.map +0 -1
- package/dist/cjs/automated-transfer-eligibility/constants.js +0 -43
- package/dist/cjs/automated-transfer-eligibility/constants.js.map +0 -1
- package/dist/cjs/automated-transfer-eligibility/index.js +0 -27
- package/dist/cjs/automated-transfer-eligibility/index.js.map +0 -1
- package/dist/cjs/automated-transfer-eligibility/reducer.js +0 -17
- package/dist/cjs/automated-transfer-eligibility/reducer.js.map +0 -1
- package/dist/cjs/automated-transfer-eligibility/resolvers.js +0 -18
- package/dist/cjs/automated-transfer-eligibility/resolvers.js.map +0 -1
- package/dist/cjs/automated-transfer-eligibility/selectors.js +0 -60
- package/dist/cjs/automated-transfer-eligibility/selectors.js.map +0 -1
- package/dist/cjs/automated-transfer-eligibility/types.js +0 -3
- package/dist/cjs/automated-transfer-eligibility/types.js.map +0 -1
- package/dist/cjs/launchpad-navigator/actions.js +0 -71
- package/dist/cjs/launchpad-navigator/actions.js.map +0 -1
- package/dist/cjs/launchpad-navigator/constants.js +0 -7
- package/dist/cjs/launchpad-navigator/constants.js.map +0 -1
- package/dist/cjs/launchpad-navigator/index.js +0 -19
- package/dist/cjs/launchpad-navigator/index.js.map +0 -1
- package/dist/cjs/launchpad-navigator/reducer.js +0 -24
- package/dist/cjs/launchpad-navigator/reducer.js.map +0 -1
- package/dist/cjs/launchpad-navigator/selectors.js +0 -8
- package/dist/cjs/launchpad-navigator/selectors.js.map +0 -1
- package/dist/cjs/queries/use-launchpad-navigator.js +0 -39
- package/dist/cjs/queries/use-launchpad-navigator.js.map +0 -1
- package/dist/esm/add-ons/hooks/use-add-on-display-cost.js +0 -26
- package/dist/esm/add-ons/hooks/use-add-on-display-cost.js.map +0 -1
- package/dist/esm/add-ons/lib/is-storage-addon-enabled.js +0 -8
- package/dist/esm/add-ons/lib/is-storage-addon-enabled.js.map +0 -1
- package/dist/esm/automated-transfer-eligibility/actions.js +0 -6
- package/dist/esm/automated-transfer-eligibility/actions.js.map +0 -1
- package/dist/esm/automated-transfer-eligibility/constants.js +0 -40
- package/dist/esm/automated-transfer-eligibility/constants.js.map +0 -1
- package/dist/esm/automated-transfer-eligibility/index.js +0 -22
- package/dist/esm/automated-transfer-eligibility/index.js.map +0 -1
- package/dist/esm/automated-transfer-eligibility/reducer.js +0 -13
- package/dist/esm/automated-transfer-eligibility/reducer.js.map +0 -1
- package/dist/esm/automated-transfer-eligibility/resolvers.js +0 -13
- package/dist/esm/automated-transfer-eligibility/resolvers.js.map +0 -1
- package/dist/esm/automated-transfer-eligibility/selectors.js +0 -56
- package/dist/esm/automated-transfer-eligibility/selectors.js.map +0 -1
- package/dist/esm/automated-transfer-eligibility/types.js +0 -2
- package/dist/esm/automated-transfer-eligibility/types.js.map +0 -1
- package/dist/esm/launchpad-navigator/actions.js +0 -63
- package/dist/esm/launchpad-navigator/actions.js.map +0 -1
- package/dist/esm/launchpad-navigator/constants.js +0 -4
- package/dist/esm/launchpad-navigator/constants.js.map +0 -1
- package/dist/esm/launchpad-navigator/index.js +0 -15
- package/dist/esm/launchpad-navigator/index.js.map +0 -1
- package/dist/esm/launchpad-navigator/reducer.js +0 -22
- package/dist/esm/launchpad-navigator/reducer.js.map +0 -1
- package/dist/esm/launchpad-navigator/selectors.js +0 -3
- package/dist/esm/launchpad-navigator/selectors.js.map +0 -1
- package/dist/esm/queries/use-launchpad-navigator.js +0 -33
- package/dist/esm/queries/use-launchpad-navigator.js.map +0 -1
- package/dist/types/add-ons/hooks/use-add-on-display-cost.d.ts +0 -5
- package/dist/types/add-ons/hooks/use-add-on-display-cost.d.ts.map +0 -1
- package/dist/types/add-ons/lib/is-storage-addon-enabled.d.ts +0 -7
- package/dist/types/add-ons/lib/is-storage-addon-enabled.d.ts.map +0 -1
- package/dist/types/automated-transfer-eligibility/actions.d.ts +0 -10
- package/dist/types/automated-transfer-eligibility/actions.d.ts.map +0 -1
- package/dist/types/automated-transfer-eligibility/constants.d.ts +0 -11
- package/dist/types/automated-transfer-eligibility/constants.d.ts.map +0 -1
- package/dist/types/automated-transfer-eligibility/index.d.ts +0 -7
- package/dist/types/automated-transfer-eligibility/index.d.ts.map +0 -1
- package/dist/types/automated-transfer-eligibility/reducer.d.ts +0 -6
- package/dist/types/automated-transfer-eligibility/reducer.d.ts.map +0 -1
- package/dist/types/automated-transfer-eligibility/resolvers.d.ts +0 -7
- package/dist/types/automated-transfer-eligibility/resolvers.d.ts.map +0 -1
- package/dist/types/automated-transfer-eligibility/selectors.d.ts +0 -7
- package/dist/types/automated-transfer-eligibility/selectors.d.ts.map +0 -1
- package/dist/types/automated-transfer-eligibility/types.d.ts +0 -36
- package/dist/types/automated-transfer-eligibility/types.d.ts.map +0 -1
- package/dist/types/launchpad-navigator/actions.d.ts +0 -22
- package/dist/types/launchpad-navigator/actions.d.ts.map +0 -1
- package/dist/types/launchpad-navigator/constants.d.ts +0 -4
- package/dist/types/launchpad-navigator/constants.d.ts.map +0 -1
- package/dist/types/launchpad-navigator/index.d.ts +0 -4
- package/dist/types/launchpad-navigator/index.d.ts.map +0 -1
- package/dist/types/launchpad-navigator/reducer.d.ts +0 -9
- package/dist/types/launchpad-navigator/reducer.d.ts.map +0 -1
- package/dist/types/launchpad-navigator/selectors.d.ts +0 -4
- package/dist/types/launchpad-navigator/selectors.d.ts.map +0 -1
- package/dist/types/queries/use-launchpad-navigator.d.ts +0 -15
- package/dist/types/queries/use-launchpad-navigator.d.ts.map +0 -1
- package/src/add-ons/hooks/use-add-on-display-cost.ts +0 -28
- package/src/add-ons/lib/is-storage-addon-enabled.ts +0 -9
- package/src/automated-transfer-eligibility/actions.ts +0 -15
- package/src/automated-transfer-eligibility/constants.ts +0 -44
- package/src/automated-transfer-eligibility/index.ts +0 -25
- package/src/automated-transfer-eligibility/reducer.ts +0 -18
- package/src/automated-transfer-eligibility/resolvers.ts +0 -16
- package/src/automated-transfer-eligibility/selectors.ts +0 -94
- package/src/automated-transfer-eligibility/test/reducer.ts +0 -60
- package/src/automated-transfer-eligibility/types.ts +0 -45
- package/src/launchpad-navigator/actions.ts +0 -85
- package/src/launchpad-navigator/constants.ts +0 -4
- package/src/launchpad-navigator/index.ts +0 -16
- package/src/launchpad-navigator/reducer.ts +0 -35
- package/src/launchpad-navigator/selectors.ts +0 -6
- package/src/queries/use-launchpad-navigator.ts +0 -56
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PRODUCT_1GB_SPACE } from '@automattic/calypso-products';
|
|
2
|
+
import { ADD_ON_50GB_STORAGE } from './constants';
|
|
3
|
+
import spaceUpgradeIcon from './icons/space-upgrade';
|
|
4
|
+
import type { AddOnMeta } from './types';
|
|
5
|
+
|
|
6
|
+
const STORAGE_ADD_ONS_MOCK: AddOnMeta[] = [
|
|
7
|
+
{
|
|
8
|
+
addOnSlug: ADD_ON_50GB_STORAGE,
|
|
9
|
+
productSlug: PRODUCT_1GB_SPACE,
|
|
10
|
+
featureSlugs: null,
|
|
11
|
+
icon: spaceUpgradeIcon,
|
|
12
|
+
quantity: 50,
|
|
13
|
+
name: '50 GB Storage',
|
|
14
|
+
displayCost: '50',
|
|
15
|
+
prices: {
|
|
16
|
+
monthlyPrice: 10,
|
|
17
|
+
yearlyPrice: 120,
|
|
18
|
+
formattedMonthlyPrice: 'USD10',
|
|
19
|
+
formattedYearlyPrice: 'USD120',
|
|
20
|
+
currencyCode: 'USD',
|
|
21
|
+
},
|
|
22
|
+
description: 'Make more space for high-quality photos, videos, and other media. ',
|
|
23
|
+
featured: false,
|
|
24
|
+
purchased: false,
|
|
25
|
+
checkoutLink: 'checkout:storage-50gb',
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
export { STORAGE_ADD_ONS_MOCK };
|
package/src/add-ons/types.ts
CHANGED
|
@@ -6,12 +6,11 @@ export interface AddOnMeta {
|
|
|
6
6
|
addOnSlug: AddOnSlug;
|
|
7
7
|
productSlug: StoreProductSlug;
|
|
8
8
|
featureSlugs?: string[] | null;
|
|
9
|
-
icon
|
|
9
|
+
icon?: JSX.Element;
|
|
10
10
|
featured?: boolean; // used to display the popular badge in the add-ons grid
|
|
11
|
-
name
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
displayCost: TranslateResult | null;
|
|
11
|
+
name?: TranslateResult; // when the name is optional, it will be filled by the product list data
|
|
12
|
+
description?: TranslateResult; // same as the above.
|
|
13
|
+
displayCost?: TranslateResult;
|
|
15
14
|
purchased?: boolean;
|
|
16
15
|
isLoading?: boolean;
|
|
17
16
|
prices?: {
|
|
@@ -19,9 +18,10 @@ export interface AddOnMeta {
|
|
|
19
18
|
yearlyPrice: number;
|
|
20
19
|
formattedMonthlyPrice: string;
|
|
21
20
|
formattedYearlyPrice: string;
|
|
21
|
+
currencyCode: string;
|
|
22
22
|
} | null;
|
|
23
|
+
quantity?: number; // used for determining checkout costs for quantity based products
|
|
23
24
|
checkoutLink?: string;
|
|
24
|
-
exceedsSiteStorageLimits?: boolean;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export type AddOnSlug = ( typeof ADD_ONS )[ number ];
|
package/src/analyzer/actions.ts
CHANGED
|
@@ -24,7 +24,6 @@ export function createActions() {
|
|
|
24
24
|
const data: AnalyzeColorsResponse = yield wpcomRequest( {
|
|
25
25
|
path: '/imports/url-analyzer/colors/?url=' + encodeURIComponent( url ),
|
|
26
26
|
apiNamespace: 'wpcom/v2',
|
|
27
|
-
apiVersion: '2',
|
|
28
27
|
} );
|
|
29
28
|
|
|
30
29
|
yield colorsAnalyzeSuccess( url, data );
|
|
@@ -91,7 +91,7 @@ export function generateAdminSections(
|
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
title: __( 'Cancel my plan', __i18n_text_domain__ ),
|
|
94
|
-
link:
|
|
94
|
+
link: '/me/purchases',
|
|
95
95
|
synonyms: [ 'upgrade', 'business', 'professional', 'personal' ],
|
|
96
96
|
icon: 'plans',
|
|
97
97
|
},
|
|
@@ -104,7 +104,7 @@ export function generateAdminSections(
|
|
|
104
104
|
{
|
|
105
105
|
/* translators: %(googleMailService)s can be either "G Suite" or "Google Workspace */
|
|
106
106
|
title: sprintf( __( 'Cancel %s', __i18n_text_domain__ ), googleMailService ),
|
|
107
|
-
link:
|
|
107
|
+
link: '/me/purchases',
|
|
108
108
|
synonyms: [ 'upgrade', 'business', 'professional', 'personal', 'google' ],
|
|
109
109
|
icon: 'plans',
|
|
110
110
|
},
|
|
@@ -353,7 +353,7 @@ export function generateAdminSections(
|
|
|
353
353
|
},
|
|
354
354
|
{
|
|
355
355
|
title: __( 'New post', __i18n_text_domain__ ),
|
|
356
|
-
description: __(
|
|
356
|
+
description: __( 'Create a new blog post on your site.' ),
|
|
357
357
|
link: `/post/${ siteSlug }`,
|
|
358
358
|
synonyms: [ 'lists', 'posts' ],
|
|
359
359
|
icon: 'my-sites',
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { __ } from '@wordpress/i18n';
|
|
2
|
+
import debugFactory from 'debug';
|
|
2
3
|
import { RESULT_TOUR, RESULT_VIDEO } from './constants';
|
|
3
4
|
|
|
5
|
+
const debug = debugFactory( 'calypso:data-stores:contextual-help' );
|
|
6
|
+
|
|
4
7
|
export type LinksForSection = {
|
|
5
8
|
readonly link: string;
|
|
6
9
|
post_id?: number;
|
|
@@ -611,8 +614,7 @@ export function getContextResults( section: string, siteIntent: string ) {
|
|
|
611
614
|
}
|
|
612
615
|
|
|
613
616
|
if ( siteIntent ) {
|
|
614
|
-
|
|
615
|
-
console.warn( 'Site intent is', siteIntent );
|
|
617
|
+
debug( `Site intent: ${ siteIntent }` );
|
|
616
618
|
}
|
|
617
619
|
|
|
618
620
|
// make sure editorially to show at most one tour and one video at once
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { register, createReduxStore } from '@wordpress/data';
|
|
2
2
|
import { controls } from '../wpcom-request-controls';
|
|
3
3
|
import * as actions from './actions';
|
|
4
4
|
import { STORE_KEY } from './constants';
|
|
@@ -12,18 +12,11 @@ export * from './queries';
|
|
|
12
12
|
export { getFormattedPrice } from './utils';
|
|
13
13
|
export type { State };
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
reducer,
|
|
24
|
-
resolvers,
|
|
25
|
-
selectors,
|
|
26
|
-
} );
|
|
27
|
-
}
|
|
28
|
-
return STORE_KEY;
|
|
29
|
-
}
|
|
15
|
+
export const store = createReduxStore( STORE_KEY, {
|
|
16
|
+
actions,
|
|
17
|
+
controls,
|
|
18
|
+
reducer,
|
|
19
|
+
resolvers,
|
|
20
|
+
selectors,
|
|
21
|
+
} );
|
|
22
|
+
register( store );
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { select, subscribe } from '@wordpress/data';
|
|
2
2
|
import wpcomRequest from 'wpcom-proxy-request';
|
|
3
|
-
import {
|
|
3
|
+
import { store } from '..';
|
|
4
4
|
import { DataStatus } from '../constants';
|
|
5
5
|
|
|
6
6
|
jest.mock( 'wpcom-proxy-request', () => ( {
|
|
@@ -9,8 +9,6 @@ jest.mock( 'wpcom-proxy-request', () => ( {
|
|
|
9
9
|
requestAllBlogsAccess: jest.fn( () => Promise.resolve() ),
|
|
10
10
|
} ) );
|
|
11
11
|
|
|
12
|
-
let store: ReturnType< typeof register >;
|
|
13
|
-
|
|
14
12
|
const options = {
|
|
15
13
|
category_slug: undefined,
|
|
16
14
|
include_dotblogsubdomain: false,
|
|
@@ -27,7 +25,10 @@ const apiResponse = [
|
|
|
27
25
|
match_reasons: [ 'tld-common', 'tld-exact' ],
|
|
28
26
|
product_id: 78,
|
|
29
27
|
product_slug: 'dotsite_domain',
|
|
30
|
-
cost: '$25
|
|
28
|
+
cost: '$25',
|
|
29
|
+
raw_price: 25,
|
|
30
|
+
currency_code: 'USD',
|
|
31
|
+
unavailable: false,
|
|
31
32
|
},
|
|
32
33
|
{
|
|
33
34
|
domain_name: 'hot-test-site.com',
|
|
@@ -37,14 +38,13 @@ const apiResponse = [
|
|
|
37
38
|
match_reasons: [ 'tld-common' ],
|
|
38
39
|
product_id: 6,
|
|
39
40
|
product_slug: 'domain_reg',
|
|
40
|
-
cost: '$18
|
|
41
|
+
cost: '$18',
|
|
42
|
+
raw_price: 18,
|
|
43
|
+
currency_code: 'USD',
|
|
44
|
+
unavailable: false,
|
|
41
45
|
},
|
|
42
46
|
];
|
|
43
47
|
|
|
44
|
-
beforeAll( () => {
|
|
45
|
-
store = register();
|
|
46
|
-
} );
|
|
47
|
-
|
|
48
48
|
beforeEach( () => {
|
|
49
49
|
( wpcomRequest as jest.Mock ).mockReset();
|
|
50
50
|
} );
|
|
@@ -55,7 +55,7 @@ describe( 'getDomainSuggestions', () => {
|
|
|
55
55
|
|
|
56
56
|
const query = 'test query one';
|
|
57
57
|
const listenForStateUpdate = () => {
|
|
58
|
-
return new Promise( ( resolve ) => {
|
|
58
|
+
return new Promise< void >( ( resolve ) => {
|
|
59
59
|
const unsubscribe = subscribe( () => {
|
|
60
60
|
unsubscribe();
|
|
61
61
|
resolve();
|
|
@@ -88,7 +88,7 @@ describe( 'getDomainSuggestions', () => {
|
|
|
88
88
|
|
|
89
89
|
expect(
|
|
90
90
|
select( 'core/data' ).isResolving( store, 'getDomainSuggestions', [ query, options ] )
|
|
91
|
-
).
|
|
91
|
+
).toEqual( false );
|
|
92
92
|
} );
|
|
93
93
|
} );
|
|
94
94
|
|
|
@@ -102,7 +102,7 @@ describe( 'getDomainErrorMessage', () => {
|
|
|
102
102
|
|
|
103
103
|
const query = 'test query two';
|
|
104
104
|
const listenForStateUpdate = () => {
|
|
105
|
-
return new Promise( ( resolve ) => {
|
|
105
|
+
return new Promise< void >( ( resolve ) => {
|
|
106
106
|
const unsubscribe = subscribe( () => {
|
|
107
107
|
unsubscribe();
|
|
108
108
|
resolve();
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import * as selectors from './selectors';
|
|
2
1
|
import type { DataStatus } from './constants';
|
|
3
|
-
import type { SelectFromMap } from '../mapped-types';
|
|
4
2
|
|
|
5
3
|
export interface DomainSuggestionQuery {
|
|
6
4
|
/**
|
|
@@ -254,5 +252,3 @@ export interface DomainSuggestionState {
|
|
|
254
252
|
export type DomainAvailabilities = Record< string, DomainAvailability | undefined >;
|
|
255
253
|
|
|
256
254
|
export type DomainSuggestionSelectorOptions = Partial< Exclude< DomainSuggestionQuery, 'query' > >;
|
|
257
|
-
|
|
258
|
-
export type DomainSuggestionsSelect = SelectFromMap< typeof selectors >;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import formatCurrency from '@automattic/format-currency';
|
|
2
1
|
import deterministicStringify from 'fast-json-stable-stringify';
|
|
2
|
+
import { formatCurrency } from 'i18n-calypso';
|
|
3
3
|
import type { DomainSuggestionQuery, DomainSuggestionSelectorOptions } from './types';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Stable transform to an object key for storage and access.
|
|
7
|
-
* @see client/state/domains/suggestions/utils.js
|
|
8
7
|
*/
|
|
9
8
|
export const stringifyDomainQueryObject: ( q: DomainSuggestionQuery ) => string =
|
|
10
9
|
deterministicStringify;
|
|
@@ -26,8 +25,6 @@ export function getFormattedPrice( price: number, currencyCode: string ): string
|
|
|
26
25
|
*
|
|
27
26
|
* It's important to have a consistent, reproduceable representation of a domains query so that the result can be
|
|
28
27
|
* stored and retrieved.
|
|
29
|
-
* @see client/state/domains/suggestions/utils.js
|
|
30
|
-
* @see client/components/data/query-domains-suggestions/index.jsx
|
|
31
28
|
* @param search Domain search string
|
|
32
29
|
* @param queryOptions Optional paramaters for the query
|
|
33
30
|
* @returns Normalized query object
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
+
import { default as apiFetchPromise } from '@wordpress/api-fetch';
|
|
2
|
+
import { select } from '@wordpress/data';
|
|
1
3
|
import { apiFetch } from '@wordpress/data-controls';
|
|
2
|
-
import {
|
|
4
|
+
import { addQueryArgs } from '@wordpress/url';
|
|
5
|
+
import { default as wpcomRequestPromise, canAccessWpcomApis } from 'wpcom-proxy-request';
|
|
3
6
|
import { GeneratorReturnType } from '../mapped-types';
|
|
4
7
|
import { SiteDetails } from '../site';
|
|
5
8
|
import { wpcomRequest } from '../wpcom-request-controls';
|
|
6
|
-
import
|
|
9
|
+
import { STORE_KEY } from './constants';
|
|
10
|
+
import { isE2ETest } from '.';
|
|
11
|
+
import type {
|
|
12
|
+
APIFetchOptions,
|
|
13
|
+
HelpCenterOptions,
|
|
14
|
+
HelpCenterSelect,
|
|
15
|
+
HelpCenterShowOptions,
|
|
16
|
+
} from './types';
|
|
17
|
+
import type { SupportInteraction } from '@automattic/odie-client/src/types';
|
|
7
18
|
|
|
8
19
|
export const receiveHasSeenWhatsNewModal = ( value: boolean | undefined ) =>
|
|
9
20
|
( {
|
|
@@ -17,7 +28,7 @@ export function* setHasSeenWhatsNewModal( value: boolean ) {
|
|
|
17
28
|
};
|
|
18
29
|
if ( canAccessWpcomApis() ) {
|
|
19
30
|
response = yield wpcomRequest( {
|
|
20
|
-
path:
|
|
31
|
+
path: '/block-editor/has-seen-whats-new-modal',
|
|
21
32
|
apiNamespace: 'wpcom/v2',
|
|
22
33
|
method: 'PUT',
|
|
23
34
|
body: {
|
|
@@ -27,7 +38,7 @@ export function* setHasSeenWhatsNewModal( value: boolean ) {
|
|
|
27
38
|
} else {
|
|
28
39
|
response = yield apiFetch( {
|
|
29
40
|
global: true,
|
|
30
|
-
path:
|
|
41
|
+
path: '/wpcom/v2/block-editor/has-seen-whats-new-modal',
|
|
31
42
|
method: 'PUT',
|
|
32
43
|
data: { has_seen_whats_new_modal: value },
|
|
33
44
|
} as APIFetchOptions );
|
|
@@ -36,6 +47,13 @@ export function* setHasSeenWhatsNewModal( value: boolean ) {
|
|
|
36
47
|
return receiveHasSeenWhatsNewModal( response.has_seen_whats_new_modal );
|
|
37
48
|
}
|
|
38
49
|
|
|
50
|
+
export function setCurrentSupportInteraction( supportInteraction: SupportInteraction ) {
|
|
51
|
+
return {
|
|
52
|
+
type: 'HELP_CENTER_SET_CURRENT_SUPPORT_INTERACTION',
|
|
53
|
+
supportInteraction,
|
|
54
|
+
} as const;
|
|
55
|
+
}
|
|
56
|
+
|
|
39
57
|
export const setNavigateToRoute = ( route?: string ) =>
|
|
40
58
|
( {
|
|
41
59
|
type: 'HELP_CENTER_SET_NAVIGATE_TO_ROUTE',
|
|
@@ -72,6 +90,18 @@ export const setIsChatLoaded = ( isChatLoaded: boolean ) =>
|
|
|
72
90
|
isChatLoaded,
|
|
73
91
|
} ) as const;
|
|
74
92
|
|
|
93
|
+
export const setAreSoundNotificationsEnabled = ( areSoundNotificationsEnabled: boolean ) =>
|
|
94
|
+
( {
|
|
95
|
+
type: 'HELP_CENTER_SET_ARE_SOUND_NOTIFICATIONS_ENABLED',
|
|
96
|
+
areSoundNotificationsEnabled,
|
|
97
|
+
} ) as const;
|
|
98
|
+
|
|
99
|
+
export const setZendeskClientId = ( zendeskClientId: string ) =>
|
|
100
|
+
( {
|
|
101
|
+
type: 'HELP_CENTER_SET_ZENDESK_CLIENT_ID',
|
|
102
|
+
zendeskClientId,
|
|
103
|
+
} ) as const;
|
|
104
|
+
|
|
75
105
|
export const setShowMessagingLauncher = ( show: boolean ) =>
|
|
76
106
|
( {
|
|
77
107
|
type: 'HELP_CENTER_SET_SHOW_MESSAGING_LAUNCHER',
|
|
@@ -84,15 +114,78 @@ export const setShowMessagingWidget = ( show: boolean ) =>
|
|
|
84
114
|
show,
|
|
85
115
|
} ) as const;
|
|
86
116
|
|
|
87
|
-
export const
|
|
117
|
+
export const setMessage = ( message: string ) =>
|
|
118
|
+
( {
|
|
119
|
+
type: 'HELP_CENTER_SET_MESSAGE',
|
|
120
|
+
message,
|
|
121
|
+
} ) as const;
|
|
122
|
+
|
|
123
|
+
export const setAllowPremiumSupport = ( allow: boolean ) =>
|
|
124
|
+
( {
|
|
125
|
+
type: 'HELP_CENTER_SET_ALLOW_PREMIUM_SUPPORT',
|
|
126
|
+
allow,
|
|
127
|
+
} ) as const;
|
|
128
|
+
|
|
129
|
+
export const setHelpCenterOptions = ( options: HelpCenterOptions ) => ( {
|
|
130
|
+
type: 'HELP_CENTER_SET_OPTIONS' as const,
|
|
131
|
+
options,
|
|
132
|
+
} );
|
|
133
|
+
|
|
134
|
+
export const setShowHelpCenter = function* (
|
|
135
|
+
show: boolean,
|
|
136
|
+
allowPremiumSupport = false,
|
|
137
|
+
options: HelpCenterShowOptions = { hideBackButton: false, searchTerm: '' }
|
|
138
|
+
): Generator< unknown, { type: 'HELP_CENTER_SET_SHOW'; show: boolean }, unknown > {
|
|
139
|
+
const isMinimized = ( select( STORE_KEY ) as HelpCenterSelect ).getIsMinimized();
|
|
140
|
+
|
|
141
|
+
if ( ! show && isMinimized ) {
|
|
142
|
+
yield setIsMinimized( false );
|
|
143
|
+
|
|
144
|
+
return {
|
|
145
|
+
type: 'HELP_CENTER_SET_SHOW',
|
|
146
|
+
show: true,
|
|
147
|
+
} as const;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if ( ! isE2ETest() ) {
|
|
151
|
+
if ( canAccessWpcomApis() ) {
|
|
152
|
+
// Use the promise version to do that action without waiting for the result.
|
|
153
|
+
wpcomRequestPromise( {
|
|
154
|
+
path: '/me/preferences',
|
|
155
|
+
apiNamespace: 'wpcom/v2',
|
|
156
|
+
method: 'PUT',
|
|
157
|
+
body: {
|
|
158
|
+
calypso_preferences: { help_center_open: show },
|
|
159
|
+
},
|
|
160
|
+
} ).catch( () => {} );
|
|
161
|
+
} else {
|
|
162
|
+
// Use the promise version to do that action without waiting for the result.
|
|
163
|
+
apiFetchPromise( {
|
|
164
|
+
global: true,
|
|
165
|
+
path: '/help-center/open-state',
|
|
166
|
+
method: 'PUT',
|
|
167
|
+
data: { help_center_open: show },
|
|
168
|
+
} as APIFetchOptions ).catch( () => {} );
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
88
172
|
if ( ! show ) {
|
|
89
173
|
yield setNavigateToRoute( undefined );
|
|
90
174
|
} else {
|
|
91
175
|
yield setShowMessagingWidget( false );
|
|
92
176
|
}
|
|
93
177
|
|
|
178
|
+
yield setMessage( options?.searchTerm || '' );
|
|
94
179
|
yield setIsMinimized( false );
|
|
95
180
|
|
|
181
|
+
if ( allowPremiumSupport ) {
|
|
182
|
+
yield setAllowPremiumSupport( true );
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if ( options?.hideBackButton ) {
|
|
186
|
+
yield setHelpCenterOptions( options );
|
|
187
|
+
}
|
|
188
|
+
|
|
96
189
|
return {
|
|
97
190
|
type: 'HELP_CENTER_SET_SHOW',
|
|
98
191
|
show,
|
|
@@ -105,12 +198,6 @@ export const setSubject = ( subject: string ) =>
|
|
|
105
198
|
subject,
|
|
106
199
|
} ) as const;
|
|
107
200
|
|
|
108
|
-
export const setMessage = ( message: string ) =>
|
|
109
|
-
( {
|
|
110
|
-
type: 'HELP_CENTER_SET_MESSAGE',
|
|
111
|
-
message,
|
|
112
|
-
} ) as const;
|
|
113
|
-
|
|
114
201
|
export const setUserDeclaredSiteUrl = ( url: string ) =>
|
|
115
202
|
( {
|
|
116
203
|
type: 'HELP_CENTER_SET_USER_DECLARED_SITE_URL',
|
|
@@ -128,11 +215,26 @@ export const resetStore = () =>
|
|
|
128
215
|
type: 'HELP_CENTER_RESET_STORE',
|
|
129
216
|
} ) as const;
|
|
130
217
|
|
|
131
|
-
export const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
218
|
+
export const setNewMessagingChat = function* ( {
|
|
219
|
+
initialMessage,
|
|
220
|
+
section,
|
|
221
|
+
siteUrl,
|
|
222
|
+
siteId,
|
|
223
|
+
}: {
|
|
224
|
+
initialMessage: string;
|
|
225
|
+
section?: string;
|
|
226
|
+
siteUrl?: string;
|
|
227
|
+
siteId?: string;
|
|
228
|
+
} ) {
|
|
229
|
+
const url = addQueryArgs( '/odie', {
|
|
230
|
+
provider: 'zendesk',
|
|
231
|
+
userFieldMessage: initialMessage,
|
|
232
|
+
section,
|
|
233
|
+
siteUrl,
|
|
234
|
+
siteId,
|
|
235
|
+
} );
|
|
236
|
+
yield setNavigateToRoute( url );
|
|
237
|
+
yield setShowHelpCenter( true );
|
|
136
238
|
};
|
|
137
239
|
|
|
138
240
|
export const setShowSupportDoc = function* ( link: string, postId?: number, blogId?: number ) {
|
|
@@ -160,8 +262,13 @@ export type HelpCenterAction =
|
|
|
160
262
|
| typeof setUnreadCount
|
|
161
263
|
| typeof setIsMinimized
|
|
162
264
|
| typeof setIsChatLoaded
|
|
265
|
+
| typeof setAreSoundNotificationsEnabled
|
|
266
|
+
| typeof setZendeskClientId
|
|
163
267
|
| typeof setNavigateToRoute
|
|
164
268
|
| typeof setOdieInitialPromptText
|
|
165
269
|
| typeof setOdieBotNameSlug
|
|
270
|
+
| typeof setCurrentSupportInteraction
|
|
271
|
+
| typeof setAllowPremiumSupport
|
|
272
|
+
| typeof setHelpCenterOptions
|
|
166
273
|
>
|
|
167
274
|
| GeneratorReturnType< typeof setShowHelpCenter | typeof setHasSeenWhatsNewModal >;
|
package/src/help-center/index.ts
CHANGED
|
@@ -5,12 +5,42 @@ import { controls as wpcomRequestControls } from '../wpcom-request-controls';
|
|
|
5
5
|
import * as actions from './actions';
|
|
6
6
|
import { STORE_KEY } from './constants';
|
|
7
7
|
import reducer, { State } from './reducer';
|
|
8
|
+
import { isHelpCenterShown } from './resolvers';
|
|
8
9
|
import * as selectors from './selectors';
|
|
9
10
|
export type { State };
|
|
10
11
|
|
|
12
|
+
declare const helpCenterData: { isProxied: boolean } | undefined;
|
|
13
|
+
|
|
11
14
|
let isRegistered = false;
|
|
12
15
|
|
|
16
|
+
// All end-to-end tests use a custom user agent containing this string.
|
|
17
|
+
const E2E_USER_AGENT = 'wp-e2e-tests';
|
|
18
|
+
|
|
19
|
+
export const isE2ETest = () =>
|
|
20
|
+
typeof window !== 'undefined' && window.navigator.userAgent.includes( E2E_USER_AGENT );
|
|
21
|
+
|
|
22
|
+
export const isSupportSession = () => {
|
|
23
|
+
if ( typeof window !== 'undefined' ) {
|
|
24
|
+
return (
|
|
25
|
+
'disableHelpCenterAutoOpen' in window ||
|
|
26
|
+
// A bit hacky but much easier than passing down data from PHP in Jetpack
|
|
27
|
+
// Simple
|
|
28
|
+
!! document.querySelector( '#wp-admin-bar-support-session-details' ) ||
|
|
29
|
+
!! document.querySelector( '#a8c-support-session-overlay' ) ||
|
|
30
|
+
// Atomic
|
|
31
|
+
document.body.classList.contains( 'support-session' ) ||
|
|
32
|
+
document.querySelector( '#wpcom > .is-support-session' ) ||
|
|
33
|
+
// Our failover last hope, don't re-open when proxied.
|
|
34
|
+
// This is not the same `window.helpCenterData`, because it's defined as `const helpCenterData`
|
|
35
|
+
( typeof helpCenterData !== 'undefined' && helpCenterData?.isProxied )
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
return false;
|
|
39
|
+
};
|
|
40
|
+
|
|
13
41
|
export function register(): typeof STORE_KEY {
|
|
42
|
+
const enabledPesistedOpenState = ! isE2ETest() && ! isSupportSession();
|
|
43
|
+
|
|
14
44
|
registerPlugins();
|
|
15
45
|
|
|
16
46
|
if ( ! isRegistered ) {
|
|
@@ -20,6 +50,8 @@ export function register(): typeof STORE_KEY {
|
|
|
20
50
|
controls: { ...controls, ...wpcomRequestControls },
|
|
21
51
|
selectors,
|
|
22
52
|
persist: [ 'message', 'userDeclaredSite', 'userDeclaredSiteUrl', 'subject' ],
|
|
53
|
+
// Don't persist the open state for e2e users, because parallel tests will start interfering with each other.
|
|
54
|
+
resolvers: enabledPesistedOpenState ? { isHelpCenterShown } : undefined,
|
|
23
55
|
} );
|
|
24
56
|
isRegistered = true;
|
|
25
57
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { combineReducers } from '@wordpress/data';
|
|
2
2
|
import { SiteDetails } from '../site';
|
|
3
3
|
import type { HelpCenterAction } from './actions';
|
|
4
|
+
import type { HelpCenterOptions } from './types';
|
|
5
|
+
import type { SupportInteraction } from '@automattic/odie-client/src/types';
|
|
4
6
|
import type { Reducer } from 'redux';
|
|
5
7
|
|
|
6
8
|
const showHelpCenter: Reducer< boolean | undefined, HelpCenterAction > = ( state, action ) => {
|
|
@@ -41,6 +43,16 @@ const hasSeenWhatsNewModal: Reducer< boolean | undefined, HelpCenterAction > = (
|
|
|
41
43
|
return state;
|
|
42
44
|
};
|
|
43
45
|
|
|
46
|
+
const currentSupportInteraction: Reducer< SupportInteraction | undefined, HelpCenterAction > = (
|
|
47
|
+
state,
|
|
48
|
+
action
|
|
49
|
+
) => {
|
|
50
|
+
if ( action.type === 'HELP_CENTER_SET_CURRENT_SUPPORT_INTERACTION' ) {
|
|
51
|
+
return action.supportInteraction;
|
|
52
|
+
}
|
|
53
|
+
return state;
|
|
54
|
+
};
|
|
55
|
+
|
|
44
56
|
const isMinimized: Reducer< boolean, HelpCenterAction > = ( state = false, action ) => {
|
|
45
57
|
switch ( action.type ) {
|
|
46
58
|
case 'HELP_CENTER_SET_MINIMIZED':
|
|
@@ -57,6 +69,25 @@ const isChatLoaded: Reducer< boolean, HelpCenterAction > = ( state = false, acti
|
|
|
57
69
|
return state;
|
|
58
70
|
};
|
|
59
71
|
|
|
72
|
+
const areSoundNotificationsEnabled: Reducer< boolean, HelpCenterAction > = (
|
|
73
|
+
state = true,
|
|
74
|
+
action
|
|
75
|
+
) => {
|
|
76
|
+
switch ( action.type ) {
|
|
77
|
+
case 'HELP_CENTER_SET_ARE_SOUND_NOTIFICATIONS_ENABLED':
|
|
78
|
+
return action.areSoundNotificationsEnabled;
|
|
79
|
+
}
|
|
80
|
+
return state;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const zendeskClientId: Reducer< string, HelpCenterAction > = ( state = '', action ) => {
|
|
84
|
+
switch ( action.type ) {
|
|
85
|
+
case 'HELP_CENTER_SET_ZENDESK_CLIENT_ID':
|
|
86
|
+
return action.zendeskClientId;
|
|
87
|
+
}
|
|
88
|
+
return state;
|
|
89
|
+
};
|
|
90
|
+
|
|
60
91
|
const subject: Reducer< string | undefined, HelpCenterAction > = ( state, action ) => {
|
|
61
92
|
if ( action.type === 'HELP_CENTER_RESET_STORE' ) {
|
|
62
93
|
return undefined;
|
|
@@ -129,7 +160,26 @@ const odieBotNameSlug: Reducer< string | undefined, HelpCenterAction > = ( state
|
|
|
129
160
|
return state;
|
|
130
161
|
};
|
|
131
162
|
|
|
163
|
+
const allowPremiumSupport: Reducer< boolean, HelpCenterAction > = ( state = false, action ) => {
|
|
164
|
+
switch ( action.type ) {
|
|
165
|
+
case 'HELP_CENTER_SET_ALLOW_PREMIUM_SUPPORT':
|
|
166
|
+
return action.allow;
|
|
167
|
+
}
|
|
168
|
+
return state;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const helpCenterOptions: Reducer< HelpCenterOptions, HelpCenterAction > = (
|
|
172
|
+
state = {},
|
|
173
|
+
action
|
|
174
|
+
) => {
|
|
175
|
+
if ( action.type === 'HELP_CENTER_SET_OPTIONS' ) {
|
|
176
|
+
return { ...state, ...action.options };
|
|
177
|
+
}
|
|
178
|
+
return state;
|
|
179
|
+
};
|
|
180
|
+
|
|
132
181
|
const reducer = combineReducers( {
|
|
182
|
+
currentSupportInteraction,
|
|
133
183
|
showHelpCenter,
|
|
134
184
|
showMessagingLauncher,
|
|
135
185
|
showMessagingWidget,
|
|
@@ -140,10 +190,14 @@ const reducer = combineReducers( {
|
|
|
140
190
|
hasSeenWhatsNewModal,
|
|
141
191
|
isMinimized,
|
|
142
192
|
isChatLoaded,
|
|
193
|
+
areSoundNotificationsEnabled,
|
|
194
|
+
zendeskClientId,
|
|
143
195
|
unreadCount,
|
|
144
196
|
navigateToRoute,
|
|
145
197
|
odieInitialPromptText,
|
|
146
198
|
odieBotNameSlug,
|
|
199
|
+
allowPremiumSupport,
|
|
200
|
+
helpCenterOptions,
|
|
147
201
|
} );
|
|
148
202
|
|
|
149
203
|
export type State = ReturnType< typeof reducer >;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { apiFetch } from '@wordpress/data-controls';
|
|
2
|
+
import { canAccessWpcomApis } from 'wpcom-proxy-request';
|
|
3
|
+
import { wpcomRequest } from '../wpcom-request-controls';
|
|
4
|
+
import type { APIFetchOptions } from './types';
|
|
5
|
+
|
|
6
|
+
export function* isHelpCenterShown() {
|
|
7
|
+
try {
|
|
8
|
+
const preferences: {
|
|
9
|
+
help_center_open: boolean;
|
|
10
|
+
} = canAccessWpcomApis()
|
|
11
|
+
? yield wpcomRequest( {
|
|
12
|
+
path: '/me/preferences',
|
|
13
|
+
apiNamespace: 'wpcom/v2',
|
|
14
|
+
} )
|
|
15
|
+
: yield apiFetch( {
|
|
16
|
+
global: true,
|
|
17
|
+
path: '/help-center/open-state',
|
|
18
|
+
} as APIFetchOptions );
|
|
19
|
+
|
|
20
|
+
// We only want to auto-open, we don't want to auto-close (and potentially overrule the user's action).
|
|
21
|
+
if ( preferences.help_center_open ) {
|
|
22
|
+
return {
|
|
23
|
+
type: 'HELP_CENTER_SET_SHOW',
|
|
24
|
+
show: true,
|
|
25
|
+
} as const;
|
|
26
|
+
}
|
|
27
|
+
} catch {}
|
|
28
|
+
}
|
|
@@ -10,7 +10,13 @@ export const getUserDeclaredSite = ( state: State ) => state.userDeclaredSite;
|
|
|
10
10
|
export const getUnreadCount = ( state: State ) => state.unreadCount;
|
|
11
11
|
export const getIsMinimized = ( state: State ) => state.isMinimized;
|
|
12
12
|
export const getIsChatLoaded = ( state: State ) => state.isChatLoaded;
|
|
13
|
+
export const getAreSoundNotificationsEnabled = ( state: State ) =>
|
|
14
|
+
state.areSoundNotificationsEnabled;
|
|
15
|
+
export const getZendeskClientId = ( state: State ) => state.zendeskClientId;
|
|
13
16
|
export const getHasSeenWhatsNewModal = ( state: State ) => state.hasSeenWhatsNewModal;
|
|
14
17
|
export const getNavigateToRoute = ( state: State ) => state.navigateToRoute;
|
|
15
18
|
export const getOdieInitialPromptText = ( state: State ) => state.odieInitialPromptText;
|
|
16
19
|
export const getOdieBotNameSlug = ( state: State ) => state.odieBotNameSlug;
|
|
20
|
+
export const getCurrentSupportInteraction = ( state: State ) => state.currentSupportInteraction;
|
|
21
|
+
export const getAllowPremiumSupport = ( state: State ) => state.allowPremiumSupport;
|
|
22
|
+
export const getHelpCenterOptions = ( state: State ) => state.helpCenterOptions;
|
package/src/help-center/types.ts
CHANGED
|
@@ -9,7 +9,10 @@ export type Location = {
|
|
|
9
9
|
state?: unknown;
|
|
10
10
|
key?: string;
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
export interface HelpCenterShowOptions {
|
|
13
|
+
hideBackButton: boolean;
|
|
14
|
+
searchTerm: string;
|
|
15
|
+
}
|
|
13
16
|
export interface SiteLogo {
|
|
14
17
|
id: number;
|
|
15
18
|
sizes: never[];
|
|
@@ -24,6 +27,7 @@ export interface HelpCenterSite {
|
|
|
24
27
|
ID: number | string;
|
|
25
28
|
name: string;
|
|
26
29
|
URL: string;
|
|
30
|
+
domain: string;
|
|
27
31
|
plan: Plan;
|
|
28
32
|
is_wpcom_atomic: boolean;
|
|
29
33
|
jetpack: boolean;
|
|
@@ -45,3 +49,7 @@ export interface APIFetchOptions {
|
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
export type HelpCenterSelect = SelectFromMap< typeof selectors >;
|
|
52
|
+
|
|
53
|
+
export interface HelpCenterOptions {
|
|
54
|
+
hideBackButton?: boolean;
|
|
55
|
+
}
|