Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This will not be hidden behind a LD flag, all markets will have the option in Sanity.

Sanity:

  • rbiintl-whitelabel-cms:

    • Create a new item boolean to enable or disable the complementaryCta:

      • Where: upside complementaryCta;What markets: All markets excluding US and CA (hidden: () => !isIntl)

        Image Removed
        Code Block
        languagetypescript
        {
          title: 'Show Complementary CTA',
          description: 'By checking this, it show the complementary CTA',
          name: 'showComplementaryCTA',
          type: 'boolean',
         
        hidden: () => !isIntl,
        },
    • Change the complementaryCta:

      • from:

        Code Block
        languagetypescript
        {
          title: 'Complementary CTA',
          name: 'complementaryCta',
          type: 'linkAction',
          validation: (Rule: RuleType) => Rule.required(),
        },
      • to:

        Code Block
        languagetypescript
        {
          title: 'Complementary CTA',
          name: 'complementaryCta',
          type: 'linkAction',
          validation: (Rule: RuleType) => {
            if (isIntl) {
              return Rule.required().custom((showComplementaryCTA, context) => {
         
              const showComplementaryText = !!(context.document.complementaryCta?.actionText || {})[
         
                defaultLanguage
        
               ];
                const showComplementaryAction = !!(context.document.complementaryCta?.actionUrl || {})[
                  defaultLanguage
                ];
                if (showComplementaryCTA && !(showComplementaryText || showComplementaryAction)) {
         
                return 'If you want to enable the complementary CTA button, you must either provide "Action Text" and add a "Action url"';
                }
                return true;
              });
            }
            return Rule.required();
          },
          hidden: hideIfNoShowComplementatyCta,
        },
      • The hidden flag will validate the markets (All markets excluding US and CA)

        Image RemovedImage Removed
        Code Block
        languagetypescript
        const hideIfNoShowComplementatyCta = ({ document }: any) => document.showComplementaryCTA === false && isIntl;

Componentctg-components-library :

We have a component button named Hero:

...

  • intl-whitelabel-app:

    • We will create an item (showComplementaryCta) created on sanity (rbiintl-whitelabel-cms)

      • path: intl-whitelabel-app/workspaces/frontend/src/queries/sanity/fragments/hero.graphql

      • On HeroFragmentFragmentDoc

      • Test in another market if it will occur errors.

    • After that, we need to run the command on terminal

      Code Block
      yarn run apollo:generate
    • The command should be success ran and create automatic new items on

      • path: intl-whitelabel-app/workspaces/frontend/src/generated/sanity-graphql.tsx

        • On IHeroFragment

        • On IHero

    • On intl-whitelabel-app/workspaces/frontend/src/components/features/components/hero/hero-container.tsx, we will:

    • Add the created flag (showComplementaryCta) in this file:

      Code Block
      languagetypescript
      const showComplementaryCta = hero?.showComplementaryCta ?? true;
    • Set the flag on Hero component:

      Code Block
      languagetypescript
      showComplementaryCta={showComplementaryCta}
    • If still, there isn’t the attribute showComplementaryCta on HeroProps interface from Hero component, we should create.

      Code Block
      languagetypescript
      showComplementaryCta?: boolean;
      • There is a step to create this attribute on other task (Component: Create a new attribute named: showComplementaryCta as optional, typed as boolean on HeroProps interface)

...