@popmenu/common-ui 0.150.2 → 0.151.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/build/cjs/components/FollowerAuthenticationDialog/FollowerAuthenticationContent.d.ts +1 -1
  2. package/build/cjs/components/FollowerAuthenticationDialog/FollowerAuthenticationDialogProps.d.ts +13 -2
  3. package/build/cjs/components/FollowerAuthenticationDialog/FollowerAuthenticationLogoContainer.d.ts +1 -0
  4. package/build/cjs/components/FollowerAuthenticationDialog/FollowerAuthenticationVipBenefitRows.d.ts +1 -0
  5. package/build/cjs/index.js +192 -48
  6. package/build/cjs/index.js.map +1 -1
  7. package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationAltActions.js +13 -5
  8. package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationAltActions.js.map +1 -1
  9. package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationContent.d.ts +1 -1
  10. package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationContent.js +12 -4
  11. package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationContent.js.map +1 -1
  12. package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationDialog.js +20 -10
  13. package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationDialog.js.map +1 -1
  14. package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationDialogProps.d.ts +13 -2
  15. package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationFooter.js +7 -5
  16. package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationFooter.js.map +1 -1
  17. package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationForm.js +79 -15
  18. package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationForm.js.map +1 -1
  19. package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationGraphic.js +4 -2
  20. package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationGraphic.js.map +1 -1
  21. package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationInfo.js +8 -2
  22. package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationInfo.js.map +1 -1
  23. package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationLogoContainer.d.ts +1 -0
  24. package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationLogoContainer.js +30 -0
  25. package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationLogoContainer.js.map +1 -0
  26. package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationVipBenefitRows.d.ts +1 -0
  27. package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationVipBenefitRows.js +33 -0
  28. package/build/esm/components/FollowerAuthenticationDialog/FollowerAuthenticationVipBenefitRows.js.map +1 -0
  29. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- export declare const FollowerAuthenticationContent: (props: {
2
+ export declare const FollowerAuthenticationContent: ({ children }: {
3
3
  children: React.ReactNode;
4
4
  }) => JSX.Element;
@@ -1,4 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
+ import { IconProps } from '../Icon/IconProps';
2
3
  export type FollowerAuthenticationDialogProps = {
3
4
  open: boolean;
4
5
  state: ReducerState;
@@ -9,10 +10,16 @@ export type FollowerAuthenticationDialogProps = {
9
10
  loading: boolean;
10
11
  graphics: Record<`${ReducerStateValue}`, string>;
11
12
  logos: Record<'popmenu' | 'facebook' | 'google' | 'apple', ReactNode>;
13
+ logoUrl?: string;
12
14
  showCloseButton?: boolean;
13
15
  showAppleButton?: boolean;
14
16
  showFacebookButton?: boolean;
15
17
  showGoogleButton?: boolean;
18
+ showV2?: boolean;
19
+ signUpBackgroundImageUrl?: string;
20
+ vipBenefitRows?: FollowerAuthenticationVipBenefitRow[];
21
+ showSubscribeEmail?: boolean;
22
+ showSubscribeSms?: boolean;
16
23
  onActionButtonClick: (eventType: ClickEventType, values?: Record<string, string>) => void;
17
24
  };
18
25
  export type ReducerState = {
@@ -24,10 +31,14 @@ export type ReducerState = {
24
31
  };
25
32
  };
26
33
  export type ReducerStateValue = 'initial' | 'signUp' | 'emailFound' | 'indirectUserFound' | 'emailAuthCode' | 'emailPasswordSignIn' | 'phoneFound' | 'phoneAuthCode' | 'phonePasswordSignIn' | 'welcome' | 'requirePhone';
27
- export type ClickEventType = 'submit-form' | 'click-close' | 'code-sent' | 'request-auth-code-email' | 'request-auth-code-sms' | 'close' | 'use-different-account' | 'sign-in-with-password' | 'sign-in-with-facebook' | 'sign-in-with-google' | 'sign-in-with-apple';
28
- export type MessageKey = `${ReducerStateValue}Title` | `${ReducerStateValue}Info` | 'requirePhoneInputLabel' | 'requirePhoneCtaButtonLabel' | 'indirectUserFoundLabel' | 'indirectUserFoundCtaButtonLabel' | 'indirectUserFoundCtaButtonLabelAlt' | 'signUpPhoneErrorText' | 'signUpPhoneInputLabel' | 'signUpNameInputLabel' | 'signUpEmailErrorText' | 'signUpEmailInputLabel' | 'signUpLocationErrorText' | 'signUpLocationInputLabel' | 'signUpBirthdaySectionLabel' | 'signUpMonthInputLabel' | 'signUpDayInputLabel' | 'signUp' | 'signUpFinePrint' | 'emailFoundInputLabel' | 'emailFoundCtaButtonLabel' | 'phoneFoundInputLabel' | 'phoneFoundCtaButtonLabel' | 'emailAuthCodeInputLabel' | 'phoneAuthCodeInputLabel' | 'resendAuthCode' | 'or' | 'popmenuLogoAlt' | 'continueWithFacebookButtonLabel' | 'continueWithGoogleButtonLabel' | 'continueWithAppleButtonLabel' | 'initialCtaButtonLabel' | 'initialInputLabel' | 'passwordInputLabel' | 'poweredBy' | 'done' | 'signIn' | 'signInWithPassword';
34
+ export type ClickEventType = 'submit-form' | 'click-close' | 'code-sent' | 'request-auth-code-email' | 'request-auth-code-sms' | 'close' | 'use-different-account' | 'sign-in-with-password' | 'sign-in-with-facebook' | 'sign-in-with-google' | 'sign-in-with-apple' | 'open-terms-of-service' | 'open-privacy-policy';
35
+ export type MessageKey = `${ReducerStateValue}Title` | `${ReducerStateValue}Info` | 'requirePhoneInputLabel' | 'requirePhoneCtaButtonLabel' | 'indirectUserFoundLabel' | 'indirectUserFoundCtaButtonLabel' | 'indirectUserFoundCtaButtonLabelAlt' | 'signUpPhoneErrorText' | 'signUpPhoneInputLabel' | 'signUpNameInputLabel' | 'signUpEmailErrorText' | 'signUpEmailInputLabel' | 'signUpLocationErrorText' | 'signUpLocationInputLabel' | 'signUpBirthdaySectionLabel' | 'signUpMonthInputLabel' | 'signUpDayInputLabel' | 'signUp' | 'signUpFinePrint' | 'emailFoundInputLabel' | 'emailFoundCtaButtonLabel' | 'phoneFoundInputLabel' | 'phoneFoundCtaButtonLabel' | 'emailAuthCodeInputLabel' | 'phoneAuthCodeInputLabel' | 'resendAuthCode' | 'or' | 'popmenuLogoAlt' | 'continueWithFacebookButtonLabel' | 'continueWithGoogleButtonLabel' | 'continueWithAppleButtonLabel' | 'initialCtaButtonLabel' | 'initialInputLabel' | 'passwordInputLabel' | 'poweredBy' | 'done' | 'signIn' | 'signInWithPassword' | 'termsOfServiceButtonLabel' | 'subscribeEmailCheckboxLabel' | 'subscribeSmsCheckboxLabel' | 'privacyPolicyText' | 'privacyPolicyButtonLabel';
29
36
  type LocationOption = {
30
37
  label: string;
31
38
  value: string;
32
39
  };
40
+ type FollowerAuthenticationVipBenefitRow = {
41
+ icon: IconProps['icon'];
42
+ text: string;
43
+ };
33
44
  export {};
@@ -0,0 +1 @@
1
+ export declare const FollowerAuthenticationLogoContainer: () => JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const FollowerAuthenticationVipBenefitRows: () => JSX.Element | null;
@@ -426,7 +426,7 @@ var SemanticColors;
426
426
  SemanticColors["SECONDARY_DARK"] = "secondary.dark";
427
427
  SemanticColors["SECONDARY_LIGHT"] = "secondary.light";
428
428
  })(SemanticColors || (SemanticColors = {}));
429
- const useStyles$5 = core.makeStyles((theme) => ({
429
+ const useStyles$7 = core.makeStyles((theme) => ({
430
430
  dividerRoot: {
431
431
  gap: theme.spacing(2),
432
432
  },
@@ -463,7 +463,7 @@ const useStyles$5 = core.makeStyles((theme) => ({
463
463
  },
464
464
  }));
465
465
  const Divider = ({ TypographyProps, className, dividerColor, text, textColor, textTransform = 'lowercase', }) => {
466
- const classes = useStyles$5({ dividerColor, textColor, textTransform });
466
+ const classes = useStyles$7({ dividerColor, textColor, textTransform });
467
467
  const casingOffset = textTransform === 'lowercase' ? '.25rem' : 'unset';
468
468
  return (React.createElement(core.Box, { className: classNames([classes.dividerRoot, className]), display: "flex", alignItems: "center" },
469
469
  React.createElement(core.Box, { className: classes.dividerLine, display: "flex", flexGrow: 1, height: "1px", marginTop: casingOffset }),
@@ -483,15 +483,53 @@ const useFollowerAuthenticationDialogContext = () => {
483
483
  return context;
484
484
  };
485
485
 
486
- const useStyles$4 = core.makeStyles(() => ({
486
+ const useStyles$6 = core.makeStyles((theme) => ({
487
+ checkboxLabel: {
488
+ '& > a': {
489
+ textDecoration: 'underline',
490
+ },
491
+ fontSize: '0.75rem',
492
+ },
487
493
  form: {
494
+ alignItems: 'center',
488
495
  display: 'flex',
489
496
  flexDirection: 'column',
490
- alignItems: 'center',
491
- width: '100%',
492
497
  gridGap: 16,
498
+ width: '100%',
499
+ },
500
+ label: {
501
+ alignSelf: 'start',
502
+ fontSize: '0.85rem',
503
+ },
504
+ privacyPolicyButton: {
505
+ fontSize: '0.75rem',
506
+ margin: theme.spacing(0, 0.5),
507
+ padding: 0,
508
+ textDecoration: 'underline',
509
+ width: 'auto',
510
+ },
511
+ privacyPolicyText: {
512
+ fontSize: '0.75rem',
513
+ textAlign: 'center',
493
514
  },
494
515
  }));
516
+ function LocationAndBirthday({ checkFieldValidity, classes, loading, locationOptions, messages, showLocationErrorText, showV2, }) {
517
+ const locationSelect = (React.createElement(core.TextField, { disabled: loading, select: true, onChange: checkFieldValidity, label: messages.signUpLocationInputLabel, error: showLocationErrorText, helperText: showLocationErrorText && messages.signUpLocationErrorText, id: "location-input", inputProps: { required: true }, name: "location" }, locationOptions.map((locationOption) => (React.createElement(core.MenuItem, { "data-cy": 'option', key: locationOption.value, value: locationOption.value }, locationOption.label)))));
518
+ if (showV2) {
519
+ return (React.createElement(React.Fragment, null,
520
+ React.createElement(core.Box, { display: "flex", flexDirection: "column", gridGap: 4, style: { width: '100%' } },
521
+ React.createElement(core.Typography, { className: classes.label }, messages.signUpBirthdaySectionLabel),
522
+ React.createElement(core.Box, { display: "flex", gridGap: 16 },
523
+ React.createElement(core.TextField, { disabled: loading, label: messages.signUpMonthInputLabel, id: "birthday-month-input", name: "birthdayMonth", style: { flex: 1 } }),
524
+ React.createElement(core.TextField, { disabled: loading, label: messages.signUpDayInputLabel, id: "birthday-date-input", name: "birthdayDate", style: { flex: 1 } }))),
525
+ locationSelect));
526
+ }
527
+ return (React.createElement(React.Fragment, null,
528
+ locationSelect,
529
+ React.createElement(core.Typography, { style: { alignSelf: 'start' } }, messages.signUpBirthdaySectionLabel),
530
+ React.createElement(core.TextField, { disabled: loading, label: messages.signUpMonthInputLabel, id: "birthday-month-input", name: "birthdayMonth" }),
531
+ React.createElement(core.TextField, { disabled: loading, label: messages.signUpDayInputLabel, id: "birthday-date-input", name: "birthdayDate" })));
532
+ }
495
533
  const northAmericanPhoneRegex = /^(\()?[2-9]{1}\d{2}(\))?[-\s.]?[2-9]{1}\d{2}[-\s.]?\d{4}$/;
496
534
  const ukPhoneRegex = /^((\+?44\s?|0044\s?)(\s?\d{3,5}|\(\d{3,5}\))(\s?\d{3,4})(\s?\d{3,4})$|^07\d{9}$)/;
497
535
  const validatePhoneNumber = (phone) => {
@@ -500,20 +538,27 @@ const validatePhoneNumber = (phone) => {
500
538
  return northAmericanPhoneRegex.test(phone) || ukPhoneRegex.test(phone);
501
539
  };
502
540
  const FollowerAuthenticationForm = () => {
503
- const { state, messages, locationOptions, onActionButtonClick, loading } = useFollowerAuthenticationDialogContext();
504
- const classes = useStyles$4();
541
+ const { state, messages, locationOptions, onActionButtonClick, loading, showV2, showSubscribeEmail, showSubscribeSms, } = useFollowerAuthenticationDialogContext();
542
+ const classes = useStyles$6();
505
543
  // sign-up form state
506
544
  const formRef = React.useRef(null);
507
545
  const [formValidity, setFormValidity] = React.useState(false);
546
+ const [showNameErrorText, setShowNameErrorText] = React.useState();
508
547
  const [showPhoneErrorText, setShowPhoneErrorText] = React.useState();
509
548
  const [showEmailErrorText, setShowEmailErrorText] = React.useState();
510
549
  const [showLocationErrorText, setShowLocationErrorText] = React.useState();
550
+ const [signUpNameValue, setSignUpNameValue] = React.useState(state.context.name || '');
511
551
  const [signUpPhoneValue, setSignUpPhoneValue] = React.useState(state.context.phone || '');
512
552
  const [signUpEmailValue, setSignUpEmailValue] = React.useState(state.context.email || '');
513
553
  const checkFieldValidity = (e) => {
514
554
  const fieldName = e.target.name;
515
555
  const fieldValue = e.target.value;
516
556
  switch (fieldName) {
557
+ case 'name':
558
+ const isNameValid = fieldValue.length > 0;
559
+ setSignUpNameValue(fieldValue);
560
+ setShowNameErrorText(!isNameValid);
561
+ break;
517
562
  case 'phone':
518
563
  const isPhoneValid = validatePhoneNumber(fieldValue);
519
564
  setSignUpPhoneValue(fieldValue);
@@ -531,9 +576,10 @@ const FollowerAuthenticationForm = () => {
531
576
  }
532
577
  };
533
578
  React.useEffect(() => {
579
+ setSignUpNameValue(state.context.name || '');
534
580
  setSignUpPhoneValue(state.context.phone || '');
535
581
  setSignUpEmailValue(state.context.email || '');
536
- }, [state.context.phone, state.context.email]);
582
+ }, [state.context.name, state.context.phone, state.context.email]);
537
583
  React.useEffect(() => {
538
584
  // Validate pre-filled values (only in signUp state)
539
585
  if (state.value === 'signUp') {
@@ -547,18 +593,33 @@ const FollowerAuthenticationForm = () => {
547
593
  setShowEmailErrorText(!isEmailValid);
548
594
  }
549
595
  }
596
+ const hasValidName = Boolean(signUpNameValue) && !showNameErrorText;
550
597
  const hasValidPhone = Boolean(signUpPhoneValue) && !showPhoneErrorText;
551
598
  const hasValidEmail = Boolean(signUpEmailValue) && !showEmailErrorText;
552
599
  const locationField = formRef.current?.elements.namedItem('location');
553
600
  const hasValidLocation = locationField ? Boolean(locationField.value) : true;
554
- const hasValidContact = hasValidPhone || hasValidEmail;
601
+ const hasValidContact = showV2 ? hasValidName && hasValidPhone && hasValidEmail : hasValidPhone || hasValidEmail;
555
602
  setFormValidity(hasValidContact && hasValidLocation);
556
- }, [state.value, signUpPhoneValue, signUpEmailValue, showPhoneErrorText, showEmailErrorText, showLocationErrorText]);
603
+ }, [
604
+ showV2,
605
+ state.value,
606
+ signUpPhoneValue,
607
+ signUpEmailValue,
608
+ showPhoneErrorText,
609
+ showEmailErrorText,
610
+ showLocationErrorText,
611
+ signUpNameValue,
612
+ showNameErrorText,
613
+ ]);
557
614
  const handleSubmit = (e) => {
558
615
  e.preventDefault();
559
616
  const form = e.target;
560
617
  const formData = new FormData(form);
561
618
  const values = Object.fromEntries(formData.entries());
619
+ if (state.value === 'signUp') {
620
+ values.subscribeEmail = String(formData.has('subscribeEmail'));
621
+ values.subscribeSms = String(formData.has('subscribeSms'));
622
+ }
562
623
  onActionButtonClick('submit-form', values);
563
624
  };
564
625
  const formProps = {
@@ -576,17 +637,20 @@ const FollowerAuthenticationForm = () => {
576
637
  e.preventDefault();
577
638
  } },
578
639
  React.createElement(core.TextField, { disabled: loading, label: messages.signUpPhoneInputLabel, key: "phone-input", id: "phone-input", name: "phone", onChange: checkFieldValidity, error: showPhoneErrorText, helperText: showPhoneErrorText && messages.signUpPhoneErrorText, inputProps: {
579
- required: signUpEmailValue ? false : true,
640
+ required: showV2 || !signUpEmailValue,
580
641
  }, defaultValue: state.context.phone }),
581
- React.createElement(core.TextField, { disabled: loading, label: messages.signUpNameInputLabel, key: "name-input", id: "name-input", name: "name", inputProps: { required: true } }),
642
+ React.createElement(core.TextField, { disabled: loading, label: messages.signUpNameInputLabel, key: "name-input", id: "name-input", name: "name", onChange: checkFieldValidity, error: showNameErrorText, inputProps: { required: true }, defaultValue: state.context.name }),
582
643
  React.createElement(core.TextField, { disabled: loading, label: messages.signUpEmailInputLabel, key: "email-input", id: "email-input", name: "email", error: showEmailErrorText, helperText: showEmailErrorText && messages.signUpEmailErrorText, onChange: checkFieldValidity, inputProps: {
583
- required: signUpPhoneValue ? false : true,
644
+ required: showV2 || !signUpPhoneValue,
584
645
  type: 'email',
585
646
  }, defaultValue: state.context.email }),
586
- React.createElement(core.TextField, { disabled: loading, select: true, onChange: checkFieldValidity, label: messages.signUpLocationInputLabel, error: showLocationErrorText, helperText: showLocationErrorText && messages.signUpLocationErrorText, key: "location-input", id: "location-input", inputProps: { required: true }, name: "location" }, locationOptions.map((locationOption) => (React.createElement(core.MenuItem, { "data-cy": 'option', key: locationOption.value, value: locationOption.value }, locationOption.label)))),
587
- React.createElement(core.Typography, { style: { alignSelf: 'start' } }, messages.signUpBirthdaySectionLabel),
588
- React.createElement(core.TextField, { disabled: loading, label: messages.signUpMonthInputLabel, key: "birthday-month-input", id: "birthday-month-input", name: "birthdayMonth" }),
589
- React.createElement(core.TextField, { disabled: loading, label: messages.signUpDayInputLabel, key: "birthday-date-input", id: "birthday-date-input", name: "birthdayDate" }),
647
+ React.createElement(LocationAndBirthday, { checkFieldValidity: checkFieldValidity, classes: classes, loading: loading, locationOptions: locationOptions, messages: messages, showLocationErrorText: showLocationErrorText, showV2: showV2 }),
648
+ React.createElement(core.Box, { display: "flex", flexDirection: "column", alignItems: "flex-start", gridGap: 2, width: "100%" },
649
+ showSubscribeEmail && (React.createElement(core.FormControlLabel, { style: { alignItems: 'flex-start' }, control: React.createElement(core.Checkbox, { id: "subscribe-email", name: "subscribeEmail", disabled: loading, color: "primary" }), label: React.createElement(core.Typography, { className: classes.checkboxLabel }, messages.subscribeEmailCheckboxLabel) })),
650
+ showSubscribeSms && (React.createElement(core.FormControlLabel, { style: { alignItems: 'flex-start' }, control: React.createElement(core.Checkbox, { id: "subscribe-sms", name: "subscribeSms", disabled: loading, color: "primary" }), label: React.createElement(core.Typography, { className: classes.checkboxLabel }, messages.subscribeSmsCheckboxLabel) }))),
651
+ showV2 && messages.privacyPolicyText && (React.createElement(core.Typography, { className: classes.privacyPolicyText },
652
+ messages.privacyPolicyText,
653
+ React.createElement(core.Button, { className: classes.privacyPolicyButton, onClick: () => onActionButtonClick('open-privacy-policy'), variant: "text" }, messages.privacyPolicyButtonLabel))),
590
654
  React.createElement(core.Button, { disabled: loading || !formValidity, type: "submit" }, messages.signUp)));
591
655
  case 'emailFound':
592
656
  return (React.createElement("form", { ...formProps },
@@ -639,7 +703,7 @@ const FollowerAuthenticationForm = () => {
639
703
  }
640
704
  };
641
705
 
642
- const useStyles$3 = core.makeStyles(() => ({
706
+ const useStyles$5 = core.makeStyles(() => ({
643
707
  main: {
644
708
  width: '100%',
645
709
  display: 'flex',
@@ -647,16 +711,23 @@ const useStyles$3 = core.makeStyles(() => ({
647
711
  gridGap: 16,
648
712
  },
649
713
  }));
714
+ function AltActionsDivider() {
715
+ const { messages, showV2 } = useFollowerAuthenticationDialogContext();
716
+ if (!showV2 || !messages.or) {
717
+ return React.createElement(core.Divider, null);
718
+ }
719
+ return React.createElement(Divider, { text: messages.or, textTransform: "uppercase" });
720
+ }
650
721
  const FollowerAuthenticationAltActions = () => {
651
722
  const { state, messages, logos, loading, onActionButtonClick, showAppleButton, showFacebookButton = true, showGoogleButton = true, } = useFollowerAuthenticationDialogContext();
652
- const classes = useStyles$3();
723
+ const classes = useStyles$5();
653
724
  switch (state.value) {
654
725
  case 'initial':
655
726
  if (!showFacebookButton && !showGoogleButton && !showAppleButton) {
656
727
  return null;
657
728
  }
658
729
  return (React.createElement(core.Box, { className: classes.main },
659
- React.createElement(core.Divider, null),
730
+ React.createElement(AltActionsDivider, null),
660
731
  showFacebookButton && (React.createElement(core.Button, { variant: "outlined", startIcon: logos.facebook, onClick: () => {
661
732
  onActionButtonClick('sign-in-with-facebook');
662
733
  } }, messages.continueWithFacebookButtonLabel)),
@@ -670,7 +741,7 @@ const FollowerAuthenticationAltActions = () => {
670
741
  return null;
671
742
  case 'emailFound':
672
743
  return (React.createElement(core.Box, { className: classes.main },
673
- React.createElement(core.Divider, null),
744
+ React.createElement(AltActionsDivider, null),
674
745
  React.createElement(core.Button, { variant: "outlined", onClick: () => {
675
746
  onActionButtonClick('sign-in-with-password');
676
747
  } }, messages.signInWithPassword)));
@@ -684,13 +755,13 @@ const FollowerAuthenticationAltActions = () => {
684
755
  } }, messages.resendAuthCode)));
685
756
  case 'indirectUserFound':
686
757
  return (React.createElement(core.Box, { className: classes.main },
687
- React.createElement(core.Divider, null),
758
+ React.createElement(AltActionsDivider, null),
688
759
  React.createElement(core.Button, { variant: "outlined", onClick: () => {
689
760
  onActionButtonClick('use-different-account');
690
761
  } }, messages.indirectUserFoundCtaButtonLabelAlt)));
691
762
  case 'emailPasswordSignIn':
692
763
  return (React.createElement(core.Box, { className: classes.main },
693
- React.createElement(core.Divider, null),
764
+ React.createElement(AltActionsDivider, null),
694
765
  React.createElement(core.Button, { variant: "outlined", onClick: () => {
695
766
  const form = document.querySelector('#follower-authentication-form');
696
767
  const formData = new FormData(form);
@@ -709,7 +780,7 @@ const FollowerAuthenticationAltActions = () => {
709
780
  } }, messages.resendAuthCode)));
710
781
  case 'phonePasswordSignIn':
711
782
  return (React.createElement(core.Box, { className: classes.main },
712
- React.createElement(core.Divider, null),
783
+ React.createElement(AltActionsDivider, null),
713
784
  React.createElement(core.Button, { variant: "outlined", onClick: () => {
714
785
  const form = document.querySelector('#follower-authentication-form');
715
786
  const formData = new FormData(form);
@@ -731,7 +802,7 @@ const FollowerAuthenticationBody = () => {
731
802
  React.createElement(FollowerAuthenticationAltActions, null)));
732
803
  };
733
804
 
734
- const useStyles$2 = core.makeStyles(() => ({
805
+ const useStyles$4 = core.makeStyles(() => ({
735
806
  root: {
736
807
  position: 'absolute',
737
808
  top: 0,
@@ -740,7 +811,7 @@ const useStyles$2 = core.makeStyles(() => ({
740
811
  }));
741
812
  const FollowerAuthenticationCloseButton = ({ show }) => {
742
813
  const { messages, onActionButtonClick } = useFollowerAuthenticationDialogContext();
743
- const classes = useStyles$2();
814
+ const classes = useStyles$4();
744
815
  const handleClose = () => {
745
816
  onActionButtonClick('close');
746
817
  };
@@ -751,42 +822,82 @@ const FollowerAuthenticationCloseButton = ({ show }) => {
751
822
  React.createElement(webIcons.X, null)));
752
823
  };
753
824
 
754
- const useStyles$1 = core.makeStyles(() => ({
825
+ const useStyles$3 = core.makeStyles((theme) => ({
755
826
  root: {
827
+ alignItems: 'center',
756
828
  display: 'flex',
757
829
  flexDirection: 'column',
758
- alignItems: 'center',
759
830
  gridGap: 16,
760
831
  },
832
+ padding: {
833
+ [theme.breakpoints.up('sm')]: {
834
+ padding: theme.spacing(4),
835
+ },
836
+ },
761
837
  }));
762
- const FollowerAuthenticationContent = (props) => {
763
- const classes = useStyles$1();
764
- return React.createElement(core.DialogContent, { classes: classes }, props.children);
838
+ const FollowerAuthenticationContent = ({ children }) => {
839
+ const { showV2 } = useFollowerAuthenticationDialogContext();
840
+ const classes = useStyles$3();
841
+ return React.createElement(core.DialogContent, { className: classNames(classes.root, showV2 && classes.padding) }, children);
765
842
  };
766
843
 
767
844
  const FollowerAuthenticationFooter = () => {
768
- const { messages, logos } = useFollowerAuthenticationDialogContext();
769
- return (React.createElement(core.Box, { display: "flex", gridGap: 8 },
770
- React.createElement(core.Typography, { variant: "body2" }, messages.poweredBy),
771
- logos.popmenu));
845
+ const { messages, logos, onActionButtonClick, showV2 } = useFollowerAuthenticationDialogContext();
846
+ return (React.createElement(core.Box, { display: "flex", flexDirection: "column", gridGap: 4 },
847
+ React.createElement(core.Box, { display: "flex", justifyContent: "center", gridGap: 8 },
848
+ React.createElement(core.Typography, { variant: showV2 ? 'caption' : 'body2' }, messages.poweredBy),
849
+ logos.popmenu),
850
+ showV2 && (React.createElement(core.Button, { onClick: () => onActionButtonClick('open-terms-of-service'), style: { textDecoration: 'underline', fontSize: '0.75rem' }, variant: "text" }, messages.termsOfServiceButtonLabel))));
772
851
  };
773
852
 
774
853
  const FollowerAuthenticationGraphic = () => {
775
- const { state, graphics } = useFollowerAuthenticationDialogContext();
854
+ const { state, graphics, showV2 } = useFollowerAuthenticationDialogContext();
855
+ if (showV2 && state.value === 'signUp')
856
+ return null;
776
857
  const graphic = graphics[state.value];
777
858
  if (!graphic)
778
859
  return null;
779
860
  return (React.createElement(core.Box, null,
780
- React.createElement("img", { src: graphic, alt: "" })));
861
+ React.createElement("img", { src: graphic, alt: "", style: showV2 ? { width: 95, height: 95 } : undefined })));
781
862
  };
782
863
 
783
864
  const FollowerAuthenticationInfo = () => {
784
- const { state, messages } = useFollowerAuthenticationDialogContext();
865
+ const { state, messages, showV2 } = useFollowerAuthenticationDialogContext();
866
+ if (showV2 && state.value === 'signUp')
867
+ return null;
785
868
  const info = messages[`${state.value}Info`];
869
+ const last4Digits = state.context.phone?.slice(-4);
786
870
  if (!info)
787
871
  return null;
788
872
  return (React.createElement(core.Box, null,
789
- React.createElement(core.Typography, { align: "center" }, info)));
873
+ React.createElement(core.Typography, { align: "center" }, info),
874
+ showV2 && state.value === 'phoneAuthCode' && (React.createElement(core.Typography, { align: "center", variant: "h5", style: { marginTop: 16 } },
875
+ "***-***-",
876
+ last4Digits))));
877
+ };
878
+
879
+ const useStyles$2 = core.makeStyles((theme) => ({
880
+ main: {
881
+ [theme.breakpoints.down('sm')]: {
882
+ display: 'none',
883
+ },
884
+ backgroundColor: theme.palette.common.white,
885
+ backgroundPosition: 'center top',
886
+ backgroundSize: 'cover',
887
+ height: '100%',
888
+ padding: theme.spacing(5),
889
+ width: '100%',
890
+ },
891
+ logo: {
892
+ maxWidth: '100%',
893
+ },
894
+ }));
895
+ const FollowerAuthenticationLogoContainer = () => {
896
+ const classes = useStyles$2();
897
+ const { logoUrl, signUpBackgroundImageUrl } = useFollowerAuthenticationDialogContext();
898
+ return (React.createElement(core.Box, { className: classes.main, style: {
899
+ backgroundImage: signUpBackgroundImageUrl ? `url(${JSON.stringify(signUpBackgroundImageUrl)})` : 'none',
900
+ } }, logoUrl && React.createElement("img", { alt: "", className: classes.logo, src: logoUrl })));
790
901
  };
791
902
 
792
903
  const FollowerAuthenticationTitle = () => {
@@ -796,6 +907,31 @@ const FollowerAuthenticationTitle = () => {
796
907
  React.createElement(core.Typography, { variant: "h1", align: "center" }, title)));
797
908
  };
798
909
 
910
+ const useStyles$1 = core.makeStyles((theme) => ({
911
+ main: {
912
+ display: 'flex',
913
+ flexDirection: 'column',
914
+ gridGap: theme.spacing(1.5),
915
+ width: '100%',
916
+ },
917
+ vipBenefitRows: {
918
+ display: 'flex',
919
+ alignItems: 'center',
920
+ flexDirection: 'row',
921
+ gridGap: theme.spacing(2),
922
+ },
923
+ }));
924
+ const FollowerAuthenticationVipBenefitRows = () => {
925
+ const classes = useStyles$1();
926
+ const { vipBenefitRows, showV2, state } = useFollowerAuthenticationDialogContext();
927
+ const isInitialOrSignUpState = state.value === 'initial' || state.value === 'signUp';
928
+ if (!showV2 || !vipBenefitRows || !isInitialOrSignUpState)
929
+ return null;
930
+ return (React.createElement(core.Box, { className: classes.main }, vipBenefitRows.map((row, index) => (React.createElement(core.Box, { key: index, className: classes.vipBenefitRows },
931
+ React.createElement(Icon, { icon: row.icon, size: "large", "aria-hidden": "true" }),
932
+ React.createElement(Typography, null, row.text))))));
933
+ };
934
+
799
935
  const theme = {
800
936
  palette: {
801
937
  primary: { main: '#2E3042' },
@@ -838,19 +974,27 @@ const FollowerAuthenticationDialog = (props) => {
838
974
  restProps.onActionButtonClick('close');
839
975
  };
840
976
  const initialTitle = typeof restProps.messages.initialTitle === 'string' ? restProps.messages.initialTitle : undefined;
977
+ const showV2 = !!restProps.showV2;
978
+ const showSidebar = showV2 && (typeof restProps.logoUrl === 'string' || typeof restProps.signUpBackgroundImageUrl === 'string');
979
+ const dialogInner = (React.createElement(FollowerAuthenticationContent, null,
980
+ React.createElement(FollowerAuthenticationCloseButton, { show: showCloseButton }),
981
+ React.createElement(FollowerAuthenticationGraphic, null),
982
+ React.createElement(FollowerAuthenticationTitle, null),
983
+ React.createElement(FollowerAuthenticationInfo, null),
984
+ React.createElement(FollowerAuthenticationVipBenefitRows, null),
985
+ React.createElement(FollowerAuthenticationBody, null),
986
+ React.createElement(FollowerAuthenticationFooter, null)));
987
+ const dialogContent = showSidebar ? (React.createElement(core.Grid, { container: true },
988
+ React.createElement(core.Grid, { item: true, lg: 4, md: 3, xs: 12 },
989
+ React.createElement(FollowerAuthenticationLogoContainer, null)),
990
+ React.createElement(core.Grid, { item: true, lg: 8, md: 9, xs: 12 }, dialogInner))) : (dialogInner);
841
991
  return (React.createElement(core.ThemeProvider, { theme: theme$1 },
842
992
  React.createElement(FollowerAuthenticationDialogContextProvider, { value: restProps },
843
- React.createElement(core.Dialog, { open: open, fullScreen: fullScreen, onClose: handleClose, PaperProps: {
993
+ React.createElement(core.Dialog, { open: open, fullScreen: fullScreen, maxWidth: showV2 ? false : undefined, onClose: handleClose, PaperProps: {
844
994
  'aria-label': initialTitle,
845
995
  'aria-modal': 'true',
846
- } },
847
- React.createElement(FollowerAuthenticationContent, null,
848
- React.createElement(FollowerAuthenticationCloseButton, { show: showCloseButton }),
849
- React.createElement(FollowerAuthenticationGraphic, null),
850
- React.createElement(FollowerAuthenticationTitle, null),
851
- React.createElement(FollowerAuthenticationInfo, null),
852
- React.createElement(FollowerAuthenticationBody, null),
853
- React.createElement(FollowerAuthenticationFooter, null))))));
996
+ style: showV2 ? { maxWidth: showSidebar ? 800 : 540, width: '100%' } : undefined,
997
+ } }, dialogContent))));
854
998
  };
855
999
 
856
1000
  const IconButton = React.forwardRef((props, ref) => {