Skip to content

Commit

Permalink
Merge pull request Expensify#40871 from rezkiy37/feature/38414-onboar…
Browse files Browse the repository at this point in the history
…ding-videos

Onboarding videos
  • Loading branch information
mountiny authored Apr 25, 2024
2 parents 0b96654 + 8bbafc2 commit 9e8d402
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 27 deletions.
17 changes: 5 additions & 12 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3639,7 +3639,7 @@ const CONST = {
[onboardingChoices.TRACK]: {
message: 'Here are some essential tasks to keep your business spend in shape for tax season.',
video: {
url: `${CLOUDFRONT_URL}/videos/intro-1280.mp4`,
url: `${CLOUDFRONT_URL}/videos/guided-setup-track-business.mp4`,
thumbnailUrl: `${CLOUDFRONT_URL}/images/guided-setup-track-business.jpg`,
duration: 55,
width: 1280,
Expand Down Expand Up @@ -3679,7 +3679,7 @@ const CONST = {
[onboardingChoices.EMPLOYER]: {
message: 'Getting paid back is as easy as sending a message. Let’s go over the basics.',
video: {
url: `${CLOUDFRONT_URL}/videos/intro-1280.mp4`,
url: `${CLOUDFRONT_URL}/videos/guided-setup-get-paid-back.mp4`,
thumbnailUrl: `${CLOUDFRONT_URL}/images/guided-setup-get-paid-back.jpg`,
duration: 55,
width: 1280,
Expand Down Expand Up @@ -3720,7 +3720,7 @@ const CONST = {
[onboardingChoices.MANAGE_TEAM]: {
message: 'Here are some important tasks to help get your team’s expenses under control.',
video: {
url: `${CLOUDFRONT_URL}/videos/intro-1280.mp4`,
url: `${CLOUDFRONT_URL}/videos/guided-setup-manage-team.mp4`,
thumbnailUrl: `${CLOUDFRONT_URL}/images/guided-setup-manage-team.jpg`,
duration: 55,
width: 1280,
Expand Down Expand Up @@ -3803,7 +3803,7 @@ const CONST = {
[onboardingChoices.PERSONAL_SPEND]: {
message: 'Here’s how to track your spend in a few clicks.',
video: {
url: `${CLOUDFRONT_URL}/videos/intro-1280.mp4`,
url: `${CLOUDFRONT_URL}/videos/guided-setup-track-personal.mp4`,
thumbnailUrl: `${CLOUDFRONT_URL}/images/guided-setup-track-personal.jpg`,
duration: 55,
width: 1280,
Expand All @@ -3830,7 +3830,7 @@ const CONST = {
[onboardingChoices.CHAT_SPLIT]: {
message: 'Splitting bills with friends is as easy as sending a message. Here’s how.',
video: {
url: `${CLOUDFRONT_URL}/videos/intro-1280.mp4`,
url: `${CLOUDFRONT_URL}/videos/guided-setup-chat-split-bills.mp4`,
thumbnailUrl: `${CLOUDFRONT_URL}/images/guided-setup-chat-split-bills.jpg`,
duration: 55,
width: 1280,
Expand Down Expand Up @@ -3887,13 +3887,6 @@ const CONST = {
[onboardingChoices.LOOKING_AROUND]: {
message:
"Expensify is best known for expense and corporate card management, but we do a lot more than that. Let me know what you're interested in and I'll help get you started.",
video: {
url: `${CLOUDFRONT_URL}/videos/intro-1280.mp4`,
thumbnailUrl: `${CLOUDFRONT_URL}/images/expensify__favicon.png`,
duration: 55,
width: 1280,
height: 960,
},
tasks: [],
},
},
Expand Down
58 changes: 43 additions & 15 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3036,14 +3036,17 @@ function completeOnboarding(
reportComment: textComment.commentText,
};

// Video message
const videoComment = ReportUtils.buildOptimisticAddCommentReportAction(CONST.ATTACHMENT_MESSAGE_TEXT, undefined, actorAccountID, 2);
const videoCommentAction: OptimisticAddCommentReportAction = videoComment.reportAction;
const videoMessage: AddCommentOrAttachementParams = {
reportID: targetChatReportID,
reportActionID: videoCommentAction.reportActionID,
reportComment: videoComment.commentText,
};
let videoCommentAction: OptimisticAddCommentReportAction | null = null;
let videoMessage: AddCommentOrAttachementParams | null = null;
if (data.video) {
const videoComment = ReportUtils.buildOptimisticAddCommentReportAction(CONST.ATTACHMENT_MESSAGE_TEXT, undefined, actorAccountID, 2);
videoCommentAction = videoComment.reportAction;
videoMessage = {
reportID: targetChatReportID,
reportActionID: videoCommentAction.reportActionID,
reportComment: videoComment.commentText,
};
}

const tasksData = data.tasks.map((task, index) => {
const hasSubtitle = !!task.subtitle;
Expand Down Expand Up @@ -3261,7 +3264,6 @@ function completeOnboarding(
value: {
[mentionCommentAction.reportActionID]: mentionCommentAction as ReportAction,
[textCommentAction.reportActionID]: textCommentAction as ReportAction,
[videoCommentAction.reportActionID]: videoCommentAction as ReportAction,
},
},
{
Expand All @@ -3277,7 +3279,6 @@ function completeOnboarding(
value: {
[mentionCommentAction.reportActionID]: {pendingAction: null},
[textCommentAction.reportActionID]: {pendingAction: null},
[videoCommentAction.reportActionID]: {pendingAction: null},
},
},
];
Expand Down Expand Up @@ -3316,9 +3317,6 @@ function completeOnboarding(
[textCommentAction.reportActionID]: {
errors: ErrorUtils.getMicroSecondOnyxError('report.genericAddCommentFailureMessage'),
} as ReportAction,
[videoCommentAction.reportActionID]: {
errors: ErrorUtils.getMicroSecondOnyxError('report.genericAddCommentFailureMessage'),
} as ReportAction,
},
},
{
Expand All @@ -3331,10 +3329,40 @@ function completeOnboarding(
const guidedSetupData: GuidedSetupData = [
{type: 'message', ...mentionMessage},
{type: 'message', ...textMessage},
{type: 'video', ...data.video, ...videoMessage},
...tasksForParameters,
];

if (data.video && videoCommentAction && videoMessage) {
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${targetChatReportID}`,
value: {
[videoCommentAction.reportActionID]: videoCommentAction as ReportAction,
},
});

successData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${targetChatReportID}`,
value: {
[videoCommentAction.reportActionID]: {pendingAction: null},
},
});

failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${targetChatReportID}`,
value: {
[videoCommentAction.reportActionID]: {
errors: ErrorUtils.getMicroSecondOnyxError('report.genericAddCommentFailureMessage'),
} as ReportAction,
},
});

guidedSetupData.push({type: 'video', ...data.video, ...videoMessage});
}

guidedSetupData.push(...tasksForParameters);

const parameters: CompleteGuidedSetupParams = {
engagementChoice,
firstName,
Expand Down

0 comments on commit 9e8d402

Please sign in to comment.