Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: trustpilot changes #17581

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/core/src/Stores/client-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ export default class ClientStore extends BaseStore {
is_account_to_be_closed_by_residence: computed,
setClientKYCStatus: action.bound,
client_kyc_status: observable,
should_show_trustpilot_notification: computed,
});

reaction(
Expand Down Expand Up @@ -2950,4 +2951,8 @@ export default class ClientStore extends BaseStore {
setClientKYCStatus(client_kyc_status) {
this.client_kyc_status = client_kyc_status;
}

get should_show_trustpilot_notification() {
return this.account_status?.status?.includes('customer_review_eligible');
}
}
17 changes: 9 additions & 8 deletions packages/core/src/Stores/notification-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { action, computed, makeObservable, observable, reaction } from 'mobx';
import { StaticUrl } from '@deriv/components';
import {
checkServerMaintenance,
daysSince,
extractInfoFromShortcode,
formatDate,
formatMoney,
Expand Down Expand Up @@ -322,7 +321,6 @@ export default class NotificationStore extends BaseStore {
account_list,
account_settings,
account_status,
account_open_date,
accounts,
isAccountOfType,
is_eu,
Expand Down Expand Up @@ -353,8 +351,7 @@ export default class NotificationStore extends BaseStore {
const { current_language, selected_contract_type } = this.root_store.common;
const malta_account = landing_company_shortcode === 'maltainvest';
const cr_account = landing_company_shortcode === 'svg';
const is_website_up = website_status.site_status === 'up';
const has_trustpilot = LocalStore.getObject('notification_messages')[loginid]?.includes(
const has_trustpilot = LocalStore.getObject('marked_notifications').includes(
this.client_notifications.trustpilot?.key
);
const is_next_email_attempt_timer_running = shouldShowPhoneVerificationNotification(
Expand Down Expand Up @@ -464,6 +461,10 @@ export default class NotificationStore extends BaseStore {
});
}

if (!has_trustpilot && this.root_store.client.should_show_trustpilot_notification) {
this.addNotificationMessage(this.client_notifications.trustpilot);
}

const client = accounts[loginid];
if (client && !client.is_virtual) {
if (isEmptyObject(account_status)) return;
Expand Down Expand Up @@ -630,9 +631,6 @@ export default class NotificationStore extends BaseStore {
} else {
this.removeNotificationMessageByKey({ key: this.client_notifications.dp2p?.key });
}
if (is_website_up && !has_trustpilot && daysSince(account_open_date) > 7) {
this.addNotificationMessage(this.client_notifications.trustpilot);
}
has_missing_required_field = hasMissingRequiredField(account_settings, client, isAccountOfType);
if (has_missing_required_field) {
this.addNotificationMessage(
Expand Down Expand Up @@ -845,7 +843,10 @@ export default class NotificationStore extends BaseStore {
action: {
onClick: () => {
window.open('https://www.trustpilot.com/evaluate/deriv.com', '_blank');
this.removeNotificationByKey({ key: this.client_notifications.trustpilot.key });
this.markNotificationMessage({ key: this.client_notifications.trustpilot.key });
this.removeNotificationByKey({
key: this.client_notifications.trustpilot.key,
});
this.removeNotificationMessage({
key: this.client_notifications.trustpilot.key,
should_show_again: false,
Expand Down
1 change: 1 addition & 0 deletions packages/stores/src/mockStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ const mock = (): TStores & { is_mock: boolean } => {
account_time_of_closure: undefined,
is_account_to_be_closed_by_residence: false,
statement: {},
should_show_trustpilot_notification: false,
},
common: {
error: common_store_error,
Expand Down
1 change: 1 addition & 0 deletions packages/stores/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ export type TClientStore = {
poi_status: string;
valid_tin: 0 | 1;
};
should_show_trustpilot_notification: boolean;
};

type TCommonStoreError = {
Expand Down
Loading