From affe6743e5171be4d6c54508d98f855a4c61940f Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Wed, 11 May 2022 18:11:54 +0100 Subject: [PATCH] Renamed products to tiers (#2372) refs: https://github.com/TryGhost/Team/issues/1145 - this should allow us to remove the /products endpoint in v5 It avoids: - `kg-product-card`, that really is meant to say product - `product-cadence` on offers Co-authored-by: Rishabh --- ghost/admin/.lint-todo | 48 ++++ .../app/adapters/{product.js => tier.js} | 3 +- .../components/dashboard/members-graphs.js | 6 +- .../admin/app/components/gh-benefit-item.hbs | 2 +- .../gh-launch-wizard/connect-stripe.js | 20 +- .../components/gh-launch-wizard/finalise.js | 18 +- .../gh-launch-wizard/set-pricing.js | 28 +-- .../components/gh-member-settings-form.hbs | 82 +++---- .../app/components/gh-member-settings-form.js | 60 ++--- .../gh-members-list-item-column.hbs | 4 +- .../components/gh-members-list-item-column.js | 6 +- .../app/components/gh-members-list-item.hbs | 4 +- .../app/components/gh-members-list-item.js | 10 +- .../components/gh-members-payments-setting.js | 22 +- .../components/gh-members-recipient-select.js | 22 +- .../components/gh-members-segment-select.js | 26 +- ...lpha.hbs => gh-membership-tiers-alpha.hbs} | 28 +-- ...-alpha.js => gh-membership-tiers-alpha.js} | 34 +-- .../admin/app/components/gh-portal-links.hbs | 100 ++++---- ghost/admin/app/components/gh-portal-links.js | 50 ++-- .../visibility-segment-select.js | 44 ++-- ghost/admin/app/components/gh-product-card.js | 52 ---- .../{gh-product-card.hbs => gh-tier-card.hbs} | 70 +++--- ghost/admin/app/components/gh-tier-card.js | 52 ++++ ...d.hbs => gh-tiers-price-billingperiod.hbs} | 0 ...iod.js => gh-tiers-price-billingperiod.js} | 2 +- .../app/components/members/filter-value.hbs | 6 +- .../app/components/members/filter-value.js | 6 +- ghost/admin/app/components/members/filter.js | 22 +- .../modal-free-membership-settings.hbs | 2 +- ...mber-product.hbs => modal-member-tier.hbs} | 22 +- ...member-product.js => modal-member-tier.js} | 38 +-- .../app/components/modal-portal-settings.hbs | 14 +- .../app/components/modal-portal-settings.js | 80 +++---- ...product-price.hbs => modal-tier-price.hbs} | 6 +- ...l-product-price.js => modal-tier-price.js} | 2 +- .../{modal-product.hbs => modal-tier.hbs} | 100 ++++---- .../{modal-product.js => modal-tier.js} | 70 +++--- .../app/components/modals/tiers/archive.hbs | 2 +- .../app/components/modals/tiers/archive.js | 14 +- .../app/components/modals/tiers/unarchive.hbs | 4 +- .../app/components/modals/tiers/unarchive.js | 12 +- .../settings/members-default-post-access.hbs | 2 +- .../settings/members-default-post-access.js | 6 +- .../settings/members/archive-tier.hbs | 4 +- .../settings/members/archive-tier.js | 16 +- .../newsletters/newsletter-management.hbs | 2 +- .../app/components/tiers/segment-select.js | 44 ++-- ghost/admin/app/controllers/member.js | 2 +- ghost/admin/app/controllers/members.js | 10 +- ghost/admin/app/controllers/offer.js | 42 ++-- ghost/admin/app/controllers/offers.js | 12 +- .../app/controllers/settings/membership.js | 100 ++++---- .../settings/{product.js => tier.js} | 18 +- .../settings/{products.js => tiers.js} | 4 +- ghost/admin/app/mixins/validation-engine.js | 8 +- .../{member-product.js => member-tier.js} | 4 +- ghost/admin/app/models/member.js | 2 +- ghost/admin/app/models/post.js | 4 +- ghost/admin/app/models/setting.js | 2 +- ...t-benefit-item.js => tier-benefit-item.js} | 2 +- .../admin/app/models/{product.js => tier.js} | 4 +- ghost/admin/app/routes/member.js | 2 +- ghost/admin/app/routes/settings/product.js | 67 ------ .../admin/app/routes/settings/product/new.js | 6 - ghost/admin/app/routes/settings/products.js | 16 -- ghost/admin/app/routes/settings/tier/new.js | 6 + .../app/serializers/{product.js => tier.js} | 2 +- ghost/admin/app/services/dashboard-stats.js | 40 ++-- ghost/admin/app/services/members-utils.js | 10 +- ghost/admin/app/styles/app-dark.css | 8 +- ghost/admin/app/styles/app.css | 2 +- .../app/styles/components/filter-builder.css | 4 +- .../app/styles/components/power-select.css | 6 +- ghost/admin/app/styles/layouts/members.css | 82 +++---- .../layouts/{products.css => tiers.css} | 226 +++++++++--------- .../app/templates/settings/membership.hbs | 34 +-- .../admin/app/templates/settings/product.hbs | 158 ------------ .../admin/app/templates/settings/products.hbs | 48 ---- .../{member-product.js => member-tier.js} | 7 +- .../{product-benefits.js => tier-benefits.js} | 6 +- ...t-benefit-item.js => tier-benefit-item.js} | 0 .../app/validators/{product.js => tier.js} | 0 ghost/admin/mirage/config.js | 4 +- ghost/admin/mirage/config/members.js | 40 ++-- ghost/admin/mirage/config/offers.js | 4 +- ghost/admin/mirage/config/products.js | 44 ---- ghost/admin/mirage/config/tiers.js | 44 ++++ .../mirage/factories/{product.js => tier.js} | 6 +- ghost/admin/mirage/fixtures/settings.js | 2 +- .../mirage/fixtures/{products.js => tiers.js} | 4 +- ghost/admin/mirage/models/member.js | 2 +- ghost/admin/mirage/models/subscription.js | 2 +- .../{product-benefit.js => tier-benefit.js} | 2 +- .../mirage/models/{product.js => tier.js} | 2 +- .../admin/mirage/serializers/subscription.js | 4 +- .../{product-benefit.js => tier-benefit.js} | 0 .../serializers/{product.js => tier.js} | 4 +- .../tests/acceptance/members/details-test.js | 82 +++---- .../tests/acceptance/members/filter-test.js | 18 +- ghost/admin/tests/acceptance/offers-test.js | 8 +- .../acceptance/settings/membership-test.js | 54 ++--- 102 files changed, 1148 insertions(+), 1389 deletions(-) rename ghost/admin/app/adapters/{product.js => tier.js} (91%) rename ghost/admin/app/components/{gh-membership-products-alpha.hbs => gh-membership-tiers-alpha.hbs} (70%) rename ghost/admin/app/components/{gh-membership-products-alpha.js => gh-membership-tiers-alpha.js} (64%) delete mode 100644 ghost/admin/app/components/gh-product-card.js rename ghost/admin/app/components/{gh-product-card.hbs => gh-tier-card.hbs} (55%) create mode 100644 ghost/admin/app/components/gh-tier-card.js rename ghost/admin/app/components/{gh-products-price-billingperiod.hbs => gh-tiers-price-billingperiod.hbs} (100%) rename ghost/admin/app/components/{gh-products-price-billingperiod.js => gh-tiers-price-billingperiod.js} (90%) rename ghost/admin/app/components/{modal-member-product.hbs => modal-member-tier.hbs} (76%) rename ghost/admin/app/components/{modal-member-product.js => modal-member-tier.js} (72%) rename ghost/admin/app/components/{modal-product-price.hbs => modal-tier-price.hbs} (95%) rename ghost/admin/app/components/{modal-product-price.js => modal-tier-price.js} (98%) rename ghost/admin/app/components/{modal-product.hbs => modal-tier.hbs} (78%) rename ghost/admin/app/components/{modal-product.js => modal-tier.js} (78%) rename ghost/admin/app/controllers/settings/{product.js => tier.js} (92%) rename ghost/admin/app/controllers/settings/{products.js => tiers.js} (91%) rename ghost/admin/app/models/{member-product.js => member-tier.js} (55%) rename ghost/admin/app/models/{product-benefit-item.js => tier-benefit-item.js} (91%) rename ghost/admin/app/models/{product.js => tier.js} (87%) delete mode 100644 ghost/admin/app/routes/settings/product.js delete mode 100644 ghost/admin/app/routes/settings/product/new.js delete mode 100644 ghost/admin/app/routes/settings/products.js create mode 100644 ghost/admin/app/routes/settings/tier/new.js rename ghost/admin/app/serializers/{product.js => tier.js} (85%) rename ghost/admin/app/styles/layouts/{products.css => tiers.css} (70%) delete mode 100644 ghost/admin/app/templates/settings/product.hbs delete mode 100644 ghost/admin/app/templates/settings/products.hbs rename ghost/admin/app/transforms/{member-product.js => member-tier.js} (80%) rename ghost/admin/app/transforms/{product-benefits.js => tier-benefits.js} (80%) rename ghost/admin/app/validators/{product-benefit-item.js => tier-benefit-item.js} (100%) rename ghost/admin/app/validators/{product.js => tier.js} (100%) delete mode 100644 ghost/admin/mirage/config/products.js create mode 100644 ghost/admin/mirage/config/tiers.js rename ghost/admin/mirage/factories/{product.js => tier.js} (77%) rename ghost/admin/mirage/fixtures/{products.js => tiers.js} (91%) rename ghost/admin/mirage/models/{product-benefit.js => tier-benefit.js} (69%) rename ghost/admin/mirage/models/{product.js => tier.js} (86%) rename ghost/admin/mirage/serializers/{product-benefit.js => tier-benefit.js} (100%) rename ghost/admin/mirage/serializers/{product.js => tier.js} (79%) diff --git a/ghost/admin/.lint-todo b/ghost/admin/.lint-todo index 8bf26b94c1..2101b31341 100644 --- a/ghost/admin/.lint-todo +++ b/ghost/admin/.lint-todo @@ -1088,3 +1088,51 @@ add|ember-template-lint|require-valid-alt-text|3|44|3|44|a7f0566c430150bae4153e0 add|ember-template-lint|require-valid-alt-text|8|20|8|20|9d0c591086dc9139ff38a7b385c3367a83438786|1652054400000|1662422400000|1665014400000|lib/koenig-editor/addon/components/koenig-card-embed/nft.hbs add|ember-template-lint|require-input-label|10|12|10|12|8c3c0ea315ff4da828363989a45fa11256a78796|1652054400000|1662422400000|1665014400000|lib/koenig-editor/addon/components/koenig-card-image/selector-tenor.hbs remove|ember-template-lint|require-valid-alt-text|5|4|5|4|527936d4c6b3d34855a99669f0b8ae690094bc8e|1652054400000|1662422400000|1665014400000|app/components/gh-member-avatar.hbs +add|ember-template-lint|no-action|38|107|38|107|79d2eeaed67e929e989261416abd3cd2dbbf4861|1652140800000|1662508800000|1667692800000|app/components/gh-membership-tiers-alpha.hbs +add|ember-template-lint|no-action|125|48|125|48|01f579966c325cf66d3a87799e8cea7dd1fded81|1652140800000|1662508800000|1667692800000|app/components/gh-portal-links.hbs +add|ember-template-lint|no-action|148|54|148|54|884d0df74365d794c99bb098e72dc267bd0fbc46|1652140800000|1662508800000|1667692800000|app/components/gh-portal-links.hbs +add|ember-template-lint|no-action|175|54|175|54|b51c80e0c3de828988f74017ab7e383552f48648|1652140800000|1662508800000|1667692800000|app/components/gh-portal-links.hbs +remove|ember-template-lint|no-action|125|48|125|48|c4ecbbcf9092307d8bb2cd5c9e386d2e549a9f26|1652054400000|1662422400000|1665014400000|app/components/gh-portal-links.hbs +remove|ember-template-lint|no-action|148|54|148|54|e7798f471d8eb8d396fa02de55fc9710ad783158|1652054400000|1662422400000|1665014400000|app/components/gh-portal-links.hbs +remove|ember-template-lint|no-action|175|54|175|54|0f158251c4558c601318d60d1237d5e2c3d2bd60|1652054400000|1662422400000|1665014400000|app/components/gh-portal-links.hbs +add|ember-template-lint|no-invalid-interactive|28|24|28|24|42a29ae16e22270f0590c9ce5caa7bfec541ca0b|1652140800000|1662508800000|1667692800000|app/components/modal-member-tier.hbs +add|ember-template-lint|no-action|88|77|88|77|437199817818c66e4539bbc8501bd73148b521fd|1652140800000|1662508800000|1667692800000|app/components/modal-portal-settings.hbs +remove|ember-template-lint|no-action|88|77|88|77|9e5e50275cb198c163f5da82335957b69255ac1a|1652054400000|1662422400000|1665014400000|app/components/modal-portal-settings.hbs +add|ember-template-lint|no-action|4|55|4|55|141d456b03124abca146e58e4ae15825fdd040bb|1652140800000|1662508800000|1667692800000|app/components/modal-tier-price.hbs +add|ember-template-lint|no-action|4|79|4|79|d465b362b15b90cf42a093e72895155f49cdf6f2|1652140800000|1662508800000|1667692800000|app/components/modal-tier-price.hbs +add|ember-template-lint|no-action|16|27|16|27|64b13853afb27bd49f8fc782b7d19786a502e8d1|1652140800000|1662508800000|1667692800000|app/components/modal-tier-price.hbs +add|ember-template-lint|no-action|26|27|26|27|8291585f81599303bc73e45cb65d725f054ae414|1652140800000|1662508800000|1667692800000|app/components/modal-tier-price.hbs +add|ember-template-lint|no-action|41|35|41|35|0d52869a7137b90cd482896151c974aff53287f8|1652140800000|1662508800000|1667692800000|app/components/modal-tier-price.hbs +add|ember-template-lint|no-action|56|35|56|35|9d61f56816a4b85a97cf9ba7af28bbcf08f29d05|1652140800000|1662508800000|1667692800000|app/components/modal-tier-price.hbs +add|ember-template-lint|no-action|65|34|65|34|40e7337ccf8501ef3b2fea94812d4de8435286da|1652140800000|1662508800000|1667692800000|app/components/modal-tier-price.hbs +add|ember-template-lint|no-action|78|71|78|71|141d456b03124abca146e58e4ae15825fdd040bb|1652140800000|1662508800000|1667692800000|app/components/modal-tier-price.hbs +add|ember-template-lint|no-action|80|8|80|8|d465b362b15b90cf42a093e72895155f49cdf6f2|1652140800000|1662508800000|1667692800000|app/components/modal-tier-price.hbs +add|ember-template-lint|no-down-event-binding|4|112|4|112|b3e87879e52edc06bb07f1ad0becc6ec762bbb39|1652140800000|1662508800000|1667692800000|app/components/modal-tier-price.hbs +add|ember-template-lint|no-down-event-binding|80|41|80|41|b3e87879e52edc06bb07f1ad0becc6ec762bbb39|1652140800000|1662508800000|1667692800000|app/components/modal-tier-price.hbs +add|ember-template-lint|no-passed-in-event-handlers|16|20|16|20|22bf28ec6b8ce5c52ffdb872a465b684319bb7c3|1652140800000|1662508800000|1667692800000|app/components/modal-tier-price.hbs +add|ember-template-lint|no-passed-in-event-handlers|26|20|26|20|4b2258e98403a4296a1796a6c7f2639f8bb5fb9c|1652140800000|1662508800000|1667692800000|app/components/modal-tier-price.hbs +add|ember-template-lint|no-passed-in-event-handlers|41|28|41|28|c74704c059987f5454146dd0efc9cbc9e0279b7c|1652140800000|1662508800000|1667692800000|app/components/modal-tier-price.hbs +add|ember-template-lint|no-action|21|39|21|39|c1c116347fcaf9f69d60fa7ae58d746e9994cdbd|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|no-action|36|39|36|39|7307d2c5d78fa732b959ced6823b3d82dcc07446|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|no-action|45|39|45|39|7307d2c5d78fa732b959ced6823b3d82dcc07446|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|no-action|73|52|73|52|fa36149ee581ce634903cef877ccfdc133aa67ec|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|no-action|85|47|85|47|dcc09bb23a476d5b83b273b693cd8cb2aba68365|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|no-action|95|47|95|47|a80dd18e18dda6fb6f1f97d87bef2b8c2ce3d847|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|no-action|135|47|135|47|73ac7d3892fcbcf15c3d5c44fca14dd21016daea|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|no-action|141|53|141|53|c76b92d7bdb6ed498238b647928748aa4146dc24|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|no-action|142|55|142|55|02efc45b808f4cfdbe5f7b72b784337aef4e98a7|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|no-action|143|56|143|56|4227b643fe44a6c343b819bbee7eecdfb7916ccc|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|no-action|144|57|144|57|115cc8adc4c0f98e2d93a59ff8efbee711541336|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|no-action|152|41|152|41|c76b92d7bdb6ed498238b647928748aa4146dc24|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|no-action|153|44|153|44|4227b643fe44a6c343b819bbee7eecdfb7916ccc|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|no-action|154|45|154|45|115cc8adc4c0f98e2d93a59ff8efbee711541336|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|no-action|269|71|269|71|141d456b03124abca146e58e4ae15825fdd040bb|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|no-action|271|8|271|8|d465b362b15b90cf42a093e72895155f49cdf6f2|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|no-down-event-binding|271|41|271|41|b3e87879e52edc06bb07f1ad0becc6ec762bbb39|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|no-passed-in-event-handlers|21|32|21|32|f69395e36c890a23e3f603ad3fd2cb384932af93|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|no-passed-in-event-handlers|36|32|36|32|86b5983929a27ca8d458ff051c95a50a406fbe57|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|no-passed-in-event-handlers|45|32|45|32|86b5983929a27ca8d458ff051c95a50a406fbe57|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|no-passed-in-event-handlers|85|40|85|40|dcb4785647a50814bcfce82f8d68ac8dd8f54ec2|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|no-passed-in-event-handlers|95|40|95|40|70487c008d7dda453fef82f0140699ee93c0055c|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|style-concatenation|205|54|205|54|23293f0c3838b23432d2b2daaf04b34504896d91|1652140800000|1662508800000|1667692800000|app/components/modal-tier.hbs +add|ember-template-lint|no-action|12|16|12|16|40e7337ccf8501ef3b2fea94812d4de8435286da|1652227200000|1662595200000|1667779200000|app/components/gh-tiers-price-billingperiod.hbs diff --git a/ghost/admin/app/adapters/product.js b/ghost/admin/app/adapters/tier.js similarity index 91% rename from ghost/admin/app/adapters/product.js rename to ghost/admin/app/adapters/tier.js index b6e0927956..52f48ec6bc 100644 --- a/ghost/admin/app/adapters/product.js +++ b/ghost/admin/app/adapters/tier.js @@ -2,7 +2,8 @@ import ApplicationAdapter from 'ghost-admin/adapters/application'; import classic from 'ember-classic-decorator'; @classic -export default class Product extends ApplicationAdapter { + +export default class Tier extends ApplicationAdapter { queryRecord(store, type, query) { if (query && query.id) { let {id} = query; diff --git a/ghost/admin/app/components/dashboard/members-graphs.js b/ghost/admin/app/components/dashboard/members-graphs.js index ef4a360f52..8393045a7f 100644 --- a/ghost/admin/app/components/dashboard/members-graphs.js +++ b/ghost/admin/app/components/dashboard/members-graphs.js @@ -31,16 +31,16 @@ export default class DashboardMembersGraphs extends Component { } async loadMRRStats() { - const products = await this.store.query('product', { + const tiers = await this.store.query('tier', { filter: 'type:paid', include: 'monthly_price,yearly_price', limit: 'all' }); - const defaultProduct = products?.firstObject; + const defaultTier = tiers?.firstObject; this.mrrStatsLoading = true; this.membersStats.fetchMRR().then((stats) => { this.mrrStatsLoading = false; const statsData = stats.data || []; - const defaultCurrency = defaultProduct?.monthlyPrice?.currency || 'usd'; + const defaultCurrency = defaultTier?.monthlyPrice?.currency || 'usd'; let currencyStats = statsData.find((stat) => { return stat.currency === defaultCurrency; }); diff --git a/ghost/admin/app/components/gh-benefit-item.hbs b/ghost/admin/app/components/gh-benefit-item.hbs index 64b6300c16..cf1d14dc99 100644 --- a/ghost/admin/app/components/gh-benefit-item.hbs +++ b/ghost/admin/app/components/gh-benefit-item.hbs @@ -16,7 +16,7 @@ > Subscriptions - {{#unless this.products}} + {{#unless this.tiers}}
-
+
{{#unless this.isCreatingComplimentary}}
{{svg-jar "no-data-subscription"}} @@ -119,8 +119,8 @@ {{else}}
{{/unless}} - {{#each this.products as |product|}} -
-
-

- {{product.name}} - {{#if (gt product.subscriptions.length 1)}} - {{product.subscriptions.length}} subscriptions + {{#each this.tiers as |tier|}} +
+
+

+ {{tier.name}} + {{#if (gt tier.subscriptions.length 1)}} + {{tier.subscriptions.length}} subscriptions {{/if}}

- {{#each product.subscriptions as |sub index|}} -
+ {{#each tier.subscriptions as |sub index|}} +
- {{sub.price.nickname}} + {{sub.price.nickname}} – {{#if (eq sub.status "canceled")}} - Ended {{sub.validUntil}} + Ended {{sub.validUntil}} Cancelled {{else if sub.cancel_at_period_end}} - Has access until {{sub.validUntil}} + Has access until {{sub.validUntil}} Cancelled {{else}} - Renews {{sub.validUntil}} + Renews {{sub.validUntil}} Active {{/if}}
{{#if sub.cancellationReason}} -
Cancellation reason: {{sub.cancellationReason}}
+
Cancellation reason: {{sub.cancellationReason}}
{{/if}} {{#if sub.offer}}
- {{sub.offer.name}} + {{sub.offer.name}} offer {{#if (eq sub.offer.type 'fixed')}} ({{currency-symbol sub.offer.currency}}{{gh-price-amount sub.offer.amount}} off) @@ -173,13 +173,13 @@ applied to subscription
{{/if}} -
+
Created on {{sub.startDate}}
-
-
+
+
{{sub.price.currencySymbol}} {{sub.price.nonDecimalAmount}} @@ -203,12 +203,12 @@
  • {{/each}} - {{#if (eq product.subscriptions.length 0)}} -
    + {{#if (eq tier.subscriptions.length 0)}} +
    - Complimentary + Complimentary Active
    -
    Created on
    +
    Created on
    -
    +
    $ 0 @@ -280,9 +280,9 @@ - +
  • -
  • @@ -295,15 +295,15 @@
    {{/each}} - {{#if (and this.products this.isAddComplimentaryAllowed)}} - {{#if (feature "membersTableStatus")}} - {{#if this.hasMultipleProducts}} + {{#if this.hasMultipleTiers}} {{#if (not (is-empty @member.status))}} {{capitalize @member.status}} {{else}} - {{/if}} -
    {{this.products}}
    +
    {{this.tiers}}
    {{else}} diff --git a/ghost/admin/app/components/gh-members-list-item.js b/ghost/admin/app/components/gh-members-list-item.js index a1a8e0d8a0..9330a59c51 100644 --- a/ghost/admin/app/components/gh-members-list-item.js +++ b/ghost/admin/app/components/gh-members-list-item.js @@ -9,12 +9,12 @@ export default class GhMembersListItem extends Component { super(...args); } - get hasMultipleProducts() { - return this.store.peekAll('product')?.length > 1; + get hasMultipleTiers() { + return this.store.peekAll('tier')?.length > 1; } - get products() { - const productData = get(this.args.member, 'products') || []; - return productData.map(product => product.name).join(', '); + get tiers() { + const tierData = get(this.args.member, 'tiers') || []; + return tierData.map(tier => tier.name).join(', '); } } diff --git a/ghost/admin/app/components/gh-members-payments-setting.js b/ghost/admin/app/components/gh-members-payments-setting.js index 6c7a0510c5..7822e75d2c 100644 --- a/ghost/admin/app/components/gh-members-payments-setting.js +++ b/ghost/admin/app/components/gh-members-payments-setting.js @@ -250,12 +250,12 @@ export default Component.extend({ }); }, - saveProduct: task(function* () { - const products = yield this.store.query('product', {filter: 'type:paid', include: 'monthly_price, yearly_price'}); - this.product = products.firstObject; - if (this.product) { + saveTier: task(function* () { + const tiers = yield this.store.query('tier', {filter: 'type:paid', include: 'monthly_price, yearly_price'}); + this.tier = tiers.firstObject; + if (this.tier) { const yearlyDiscount = this.calculateDiscount(5, 50); - this.product.set('monthlyPrice', { + this.tier.set('monthlyPrice', { nickname: 'Monthly', amount: 500, active: 1, @@ -264,7 +264,7 @@ export default Component.extend({ interval: 'month', type: 'recurring' }); - this.product.set('yearlyPrice', { + this.tier.set('yearlyPrice', { nickname: 'Yearly', amount: 5000, active: 1, @@ -275,13 +275,13 @@ export default Component.extend({ }); let pollTimeout = 0; - /** To allow Stripe config to be ready in backend, we poll the save product request */ + /** To allow Stripe config to be ready in backend, we poll the save tier request */ while (pollTimeout < RETRY_PRODUCT_SAVE_MAX_POLL) { yield timeout(RETRY_PRODUCT_SAVE_POLL_LENGTH); try { - const updatedProduct = yield this.product.save(); - return updatedProduct; + const updatedTier = yield this.tier.save(); + return updatedTier; } catch (error) { if (error.payload?.errors && error.payload.errors[0].code === 'STRIPE_NOT_CONFIGURED') { pollTimeout += RETRY_PRODUCT_SAVE_POLL_LENGTH; @@ -293,7 +293,7 @@ export default Component.extend({ } } } - return this.product; + return this.tier; }), saveStripeSettings: task(function* () { @@ -303,7 +303,7 @@ export default Component.extend({ try { let response = yield this.settings.save(); - yield this.saveProduct.perform(); + yield this.saveTier.perform(); this.settings.set('portalPlans', ['free', 'monthly', 'yearly']); response = yield this.settings.save(); diff --git a/ghost/admin/app/components/gh-members-recipient-select.js b/ghost/admin/app/components/gh-members-recipient-select.js index 61839f155b..158badcda8 100644 --- a/ghost/admin/app/components/gh-members-recipient-select.js +++ b/ghost/admin/app/components/gh-members-recipient-select.js @@ -151,26 +151,26 @@ export default class GhMembersRecipientSelect extends Component { options.push(labelsGroup); } - // fetch all products w̶i̶t̶h̶ c̶o̶u̶n̶t̶s̶ + // fetch all tiers w̶i̶t̶h̶ c̶o̶u̶n̶t̶s̶ // TODO: add `include: 'count.members` to query once API supports - const products = yield this.store.query('product', {filter: 'type:paid', limit: 'all'}); + const tiers = yield this.store.query('tier', {filter: 'type:paid', limit: 'all'}); - if (products.length > 1) { - const productsGroup = { + if (tiers.length > 1) { + const tiersGroup = { groupName: 'Tiers', options: [] }; - products.forEach((product) => { - productsGroup.options.push({ - name: product.name, - segment: `product:${product.slug}`, - count: product.count?.members, - class: 'segment-product' + tiers.forEach((tier) => { + tiersGroup.options.push({ + name: tier.name, + segment: `tier:${tier.slug}`, + count: tier.count?.members, + class: 'segment-tier' }); }); - options.push(productsGroup); + options.push(tiersGroup); } this.specificOptions = options; diff --git a/ghost/admin/app/components/gh-members-segment-select.js b/ghost/admin/app/components/gh-members-segment-select.js index 8c545571af..27daeef372 100644 --- a/ghost/admin/app/components/gh-members-segment-select.js +++ b/ghost/admin/app/components/gh-members-segment-select.js @@ -74,28 +74,28 @@ export default class GhMembersSegmentSelect extends Component { } if (this.feature.get('multipleProducts')) { - // fetch all products w̶i̶t̶h̶ c̶o̶u̶n̶t̶s̶ + // fetch all tiers w̶i̶t̶h̶ c̶o̶u̶n̶t̶s̶ // TODO: add `include: 'count.members` to query once API supports - const products = yield this.store.query('product', {filter: 'type:paid', limit: 'all', include: 'monthly_price,yearly_price,benefits'}); + const tiers = yield this.store.query('tier', {filter: 'type:paid', limit: 'all', include: 'monthly_price,yearly_price,benefits'}); - if (products.length > 0) { - const productsGroup = { + if (tiers.length > 0) { + const tiersGroup = { groupName: 'Tiers', options: [] }; - products.forEach((product) => { - productsGroup.options.push({ - name: product.name, - segment: `product:${product.slug}`, - count: product.count?.members, - class: 'segment-product' + tiers.forEach((tier) => { + tiersGroup.options.push({ + name: tier.name, + segment: `tier:${tier.slug}`, + count: tier.count?.members, + class: 'segment-tier' }); }); - options.push(productsGroup); - if (this.args.selectDefaultProduct && !this.args.segment) { - this.args.onChange?.(productsGroup.options[0].segment); + options.push(tiersGroup); + if (this.args.selectDefaultTier && !this.args.segment) { + this.args.onChange?.(tiersGroup.options[0].segment); } } } diff --git a/ghost/admin/app/components/gh-membership-products-alpha.hbs b/ghost/admin/app/components/gh-membership-tiers-alpha.hbs similarity index 70% rename from ghost/admin/app/components/gh-membership-products-alpha.hbs rename to ghost/admin/app/components/gh-membership-tiers-alpha.hbs index d641e70920..b4b2755122 100644 --- a/ghost/admin/app/components/gh-membership-products-alpha.hbs +++ b/ghost/admin/app/components/gh-membership-tiers-alpha.hbs @@ -18,37 +18,37 @@
    -
    +
    {{#if this.isEmptyList}} -
    +

    You have no {{this.selectedType.value}} tiers.

    {{/if}} - {{#each this.products as |product|}} - {{/each}} {{#if (eq this.type "active" )}} - {{/if}}
    -{{#if this.showProductModal}} +{{#if this.showTierModal}} + @confirm={{this.confirmTierSave}} + @close={{this.closeTierModal}} + @modifier="edit-tier action wide" /> {{/if}} diff --git a/ghost/admin/app/components/gh-membership-products-alpha.js b/ghost/admin/app/components/gh-membership-tiers-alpha.js similarity index 64% rename from ghost/admin/app/components/gh-membership-products-alpha.js rename to ghost/admin/app/components/gh-membership-tiers-alpha.js index 7b8c8f597c..9b4af16e5f 100644 --- a/ghost/admin/app/components/gh-membership-products-alpha.js +++ b/ghost/admin/app/components/gh-membership-tiers-alpha.js @@ -18,16 +18,16 @@ export default class extends Component { @service store; @service config; - @tracked showProductModal = false; - @tracked productModel = null; + @tracked showTierModal = false; + @tracked tierModel = null; @tracked type = 'active'; - get products() { - return this.args.products.filter((product) => { + get tiers() { + return this.args.tiers.filter((tier) => { if (this.type === 'active') { - return !!product.active; + return !!tier.active; } else if (this.type === 'archived') { - return !product.active; + return !tier.active; } }); } @@ -43,7 +43,7 @@ export default class extends Component { } get isEmptyList() { - return this.products.length === 0; + return this.tiers.length === 0; } @action @@ -52,9 +52,9 @@ export default class extends Component { } @action - async openEditProduct(product) { - this.productModel = product; - this.showProductModal = true; + async openEditTier(tier) { + this.tierModel = tier; + this.showTierModal = true; } @action @@ -69,18 +69,18 @@ export default class extends Component { } @action - async openNewProduct() { - this.productModel = this.store.createRecord('product'); - this.showProductModal = true; + async openNewTier() { + this.tierModel = this.store.createRecord('tier'); + this.showTierModal = true; } @action - closeProductModal() { - this.showProductModal = false; + closeTierModal() { + this.showTierModal = false; } @action - confirmProductSave() { - this.args.confirmProductSave(); + confirmTierSave() { + this.args.confirmTierSave(); } } diff --git a/ghost/admin/app/components/gh-portal-links.hbs b/ghost/admin/app/components/gh-portal-links.hbs index 20a09d38bd..d236a18087 100644 --- a/ghost/admin/app/components/gh-portal-links.hbs +++ b/ghost/admin/app/components/gh-portal-links.hbs @@ -1,4 +1,4 @@ -