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

Update onboarding message #42408

Merged
merged 8 commits into from
May 24, 2024
Merged
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
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3735,6 +3735,7 @@ const CONST = {

WELCOME_VIDEO_URL: `${CLOUDFRONT_URL}/videos/intro-1280.mp4`,

ONBOARDING_INTRODUCTION: 'Let’s get you set up 🔧',
ONBOARDING_CHOICES: {...onboardingChoices},

ONBOARDING_CONCIERGE: {
Expand Down
24 changes: 10 additions & 14 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ import * as EmojiUtils from '@libs/EmojiUtils';
import * as Environment from '@libs/Environment/Environment';
import * as ErrorUtils from '@libs/ErrorUtils';
import Log from '@libs/Log';
import * as LoginUtils from '@libs/LoginUtils';
import Navigation from '@libs/Navigation/Navigation';
import type {NetworkStatus} from '@libs/NetworkConnection';
import LocalNotification from '@libs/Notification/LocalNotification';
Expand Down Expand Up @@ -3068,11 +3067,9 @@ function completeOnboarding(
engagementChoice: OnboardingPurposeType,
data: ValueOf<typeof CONST.ONBOARDING_MESSAGES>,
{
login,
firstName,
lastName,
}: {
login: string;
firstName: string;
lastName: string;
},
Expand All @@ -3083,14 +3080,13 @@ function completeOnboarding(
const targetChatReport = ReportUtils.getChatByParticipants([actorAccountID, currentUserAccountID]);
const {reportID: targetChatReportID = '', policyID: targetChatPolicyID = ''} = targetChatReport ?? {};

// Mention message
const mentionHandle = LoginUtils.isEmailPublicDomain(login) ? login : login.split('@')[0];
const mentionComment = ReportUtils.buildOptimisticAddCommentReportAction(`Hey @${mentionHandle} 👋`, undefined, actorAccountID);
const mentionCommentAction: OptimisticAddCommentReportAction = mentionComment.reportAction;
const mentionMessage: AddCommentOrAttachementParams = {
// Introductory message
const introductionComment = ReportUtils.buildOptimisticAddCommentReportAction(CONST.ONBOARDING_INTRODUCTION, undefined, actorAccountID);
const introductionCommentAction: OptimisticAddCommentReportAction = introductionComment.reportAction;
const introductionMessage: AddCommentOrAttachementParams = {
reportID: targetChatReportID,
reportActionID: mentionCommentAction.reportActionID,
reportComment: mentionComment.commentText,
reportActionID: introductionCommentAction.reportActionID,
reportComment: introductionComment.commentText,
};

// Text message
Expand Down Expand Up @@ -3266,7 +3262,7 @@ function completeOnboarding(
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${targetChatReportID}`,
value: {
[mentionCommentAction.reportActionID]: mentionCommentAction as ReportAction,
[introductionCommentAction.reportActionID]: introductionCommentAction as ReportAction,
[textCommentAction.reportActionID]: textCommentAction as ReportAction,
},
},
Expand All @@ -3281,7 +3277,7 @@ function completeOnboarding(
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${targetChatReportID}`,
value: {
[mentionCommentAction.reportActionID]: {pendingAction: null},
[introductionCommentAction.reportActionID]: {pendingAction: null},
[textCommentAction.reportActionID]: {pendingAction: null},
},
},
Expand Down Expand Up @@ -3315,7 +3311,7 @@ function completeOnboarding(
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${targetChatReportID}`,
value: {
[mentionCommentAction.reportActionID]: {
[introductionCommentAction.reportActionID]: {
errors: ErrorUtils.getMicroSecondOnyxError('report.genericAddCommentFailureMessage'),
} as ReportAction,
[textCommentAction.reportActionID]: {
Expand All @@ -3331,7 +3327,7 @@ function completeOnboarding(
];

const guidedSetupData: GuidedSetupData = [
{type: 'message', ...mentionMessage},
{type: 'message', ...introductionMessage},
{type: 'message', ...textMessage},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ function BaseOnboardingPersonalDetails({currentUserPersonalDetails, shouldUseNat
onboardingPurposeSelected,
CONST.ONBOARDING_MESSAGES[onboardingPurposeSelected],
{
login: currentUserPersonalDetails.login ?? '',
firstName,
lastName,
},
Expand All @@ -80,7 +79,7 @@ function BaseOnboardingPersonalDetails({currentUserPersonalDetails, shouldUseNat
Navigation.navigate(ROUTES.WELCOME_VIDEO_ROOT);
}, variables.welcomeVideoDelay);
},
[currentUserPersonalDetails.login, isSmallScreenWidth, onboardingPurposeSelected, onboardingAdminsChatReportID],
[isSmallScreenWidth, onboardingPurposeSelected, onboardingAdminsChatReportID],
);

const validate = (values: FormOnyxValues<'onboardingPersonalDetailsForm'>) => {
Expand Down
Loading