diff --git a/imports/plugins/core/accounts/client/components/updateEmail.js b/imports/plugins/core/accounts/client/components/updateEmail.js index c4d2cbef75d..4f3f05af2ca 100644 --- a/imports/plugins/core/accounts/client/components/updateEmail.js +++ b/imports/plugins/core/accounts/client/components/updateEmail.js @@ -50,7 +50,7 @@ class UpdateEmail extends Component { /> Your Orders {{> addressBookPanel}} - {{#if isMarketplaceGuest }} + {{#if showMerchantSignup }}
@@ -57,18 +57,6 @@

Become a Seller

- -
-
-
-

Start Accepting Payments

-
- -
- {{> stripeConnectSignupButton}} -
-
-
{{/if}}
diff --git a/imports/plugins/core/accounts/client/templates/profile/profile.js b/imports/plugins/core/accounts/client/templates/profile/profile.js index 88c4c0f0c26..a6ec8b2dbf9 100644 --- a/imports/plugins/core/accounts/client/templates/profile/profile.js +++ b/imports/plugins/core/accounts/client/templates/profile/profile.js @@ -1,6 +1,5 @@ import { Meteor } from "meteor/meteor"; import { Template } from "meteor/templating"; -import { Roles } from "meteor/alanning:roles"; import { ReactiveVar } from "meteor/reactive-var"; import { Reaction } from "/client/api"; import { i18next } from "/client/api"; @@ -66,55 +65,38 @@ Template.accountProfile.helpers({ } }, - /** - * User's account profile - * @return {Object} account profile - */ - account() { - return Collections.Accounts.findOne(); - }, - /** * User's display name * @return {String} display name */ displayName() { - const userId = Meteor.userId() || {}; - const user = Collections.Accounts.findOne(userId); - - if (user) { - if (user.name) { - return user.name; - } else if (user.username) { - return user.username; - } else if (user.profile && user.profile.name) { - return user.profile.name; + if (Reaction.Subscriptions && Reaction.Subscriptions.Account && Reaction.Subscriptions.Account.ready()) { + const account = Collections.Accounts.findOne(Meteor.userId()); + if (account) { + if (account.name) { + return account.name; + } else if (account.username) { + return account.username; + } else if (account.profile && account.profile.name) { + return account.profile.name; + } } } - if (Roles.userIsInRole(user._id || user.userId, "account/profile", - Reaction.getShopId())) { + if (Reaction.hasPermission("account/profile")) { return i18next.t("accountsUI.guest", { defaultValue: "Guest" }); } }, - /** - * Returns the address book default view - * @return {String} "addressBookGrid" || "addressBookAdd" - */ - addressBookView: function () { - const account = Collections.Accounts.findOne(); - if (account.profile) { - return "addressBookGrid"; + showMerchantSignup: function () { + if (Reaction.Subscriptions && Reaction.Subscriptions.Account && Reaction.Subscriptions.Account.ready()) { + const account = Collections.Accounts.findOne({ _id: Meteor.userId() }); + const marketplaceEnabled = Reaction.marketplace && Reaction.marketplace.enabled === true; + const allowMerchantSignup = Reaction.marketplace && Reaction.marketplace.allowMerchantSignup === true; + // A user has the primaryShopId until a shop is created for them. + const userHasShop = account.shopId !== Reaction.getPrimaryShopId(); + return marketplaceEnabled && allowMerchantSignup && !userHasShop; } - return "addressBookAdd"; - }, - - isMarketplaceGuest: function () { - return (Reaction.hasMarketplaceAccess("guest") && !Reaction.hasAdminAccess()); - }, - - isMarketplaceSeller: function () { - return (Reaction.hasMarketplaceAccess() && !Reaction.hasOwnerAccess()); + return false; } }); diff --git a/imports/plugins/included/marketplace/client/templates/becomeSellerButton/becomeSellerButton.html b/imports/plugins/included/marketplace/client/templates/becomeSellerButton/becomeSellerButton.html index c1dd773326f..7e51c1f9cca 100644 --- a/imports/plugins/included/marketplace/client/templates/becomeSellerButton/becomeSellerButton.html +++ b/imports/plugins/included/marketplace/client/templates/becomeSellerButton/becomeSellerButton.html @@ -1,6 +1,6 @@ -