Uploaded image for project: 'Magnolia Frontend Helpers'
  1. Magnolia Frontend Helpers
  2. MGNLFE-124

Move the personalization service from libraries to demos

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Done
    • Neutral
    • 1.1.0
    • None
    • None
    • HL & LD 38, HL & LD 39
    • 1

    Description

      Currently in client side we need to add some parameters to call fetching pages:
      https://git.magnolia-cms.com/projects/MODULES/repos/frontend-helpers/browse/samples/spa-react-minimal/src/App.js#32
      https://git.magnolia-cms.com/projects/MODULES/repos/frontend-helpers/browse/samples/spa-react-minimal/src/App.js#33

      It would be bit easier if could on client side to following:
      add ALL query search parameters when fetching page from delivery endpoint

      If preview iframe URL is: /travel/?mgnlPreview=false&mgnlChannel=desktop
      Then URL to fetch pageswould be: some-url?mgnlPreview=false&mgnlChannel=desktop

      If preview iframe URL is: /travel/?previewPersona=%2FSara-Byrne&mgnlPreviewAsVisitor=true
      Then URL to fetch pages would be: some-url?previewPersona=%2FSara-Byrne&mgnlPreviewAsVisitor=true

      Why it's good?

      • it would allow us to get rid of methods on JS libs
      • it would be future proof. Lets say we develop new feature that would do A, then on Magnolia side we would just attach query param to iframe preview URL, and client side would not have to be modified at all, as it would pass correct params already, and then our rest can look for them (think of it you could have already pass as query params selected variants for specific comps and make pages endpoint resolve it on Magnolia side, and you would avoid the variant choosing logic in client side libs)
      • no extra work needed to support other framewroks/scenarios as it is all about passing query params, so on browser we know to use location.search, on e.g. next.js args.locations.search and so on. Developers would know how to pass the needed bit

      Looks like for personalization you'd have to start adding `variants=all` to iframe preview URL.

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                canh.nguyen Canh Nguyen
                bstaryga Bartosz Staryga
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Task DoD

                    Time Tracking

                      Estimated:
                      Original Estimate - Not Specified
                      Not Specified
                      Remaining:
                      Remaining Estimate - Not Specified
                      Not Specified
                      Logged:
                      Time Spent - 1d 1h
                      1d 1h