[MGNLFE-103] Preview as visitor support for custom traits Created: 27/Jul/21  Updated: 16/Aug/21  Resolved: 04/Aug/21

Status: Closed
Project: Magnolia Frontend Helpers
Component/s: None
Affects Version/s: None
Fix Version/s: 1.1.0

Type: New Feature Priority: Neutral
Reporter: Canh Nguyen Assignee: Canh Nguyen
Resolution: Fixed Votes: 0
Labels: VN-Implementation
Remaining Estimate: 0d
Time Spent: 2d 4.25h
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Release notes required:
Yes
Documentation update required:
Yes
Date of First Response:
Epic Link: Headless p13n
Sprint: HL & LD 34
Story Points: 3

 Description   

Developers can create more traits so SPA editor needs to forward all parameters in Preview as Visitor app to the REST endpoints for fetching personalization contents.



 Comments   
Comment by Christopher Zimmermann [ 27/Jul/21 ]

Can we expand the scope of this ticket a bit - or should this be a new ticket? Because we also simply want the 'stateless' p13n to work, also when not in "Preview as Visitor app.

Here's the two cases I am thinking about: 

Issue with P13n in SPA

Update SPA demo projects.

  • By default, the SPA should pass any querystring or body parameters, or headers that were used when requesting it -  on to the Delivery endpoint call.
  • Otherwise if a link included a querystring, it won't be passed to the delivery endpoint, and so the SPA would not show any personalized content.
  • Question - should this be in the helper libraries or in the project code?
    • should helper libraries supply a helper function: ie getDeliveryURL()

 

Issue with Preview as Visitor

  • Preview as Visitor works by appending querystrings to the request to the page: &preview-gender=male. So the SPA must always append the querystring that it gets if it has &previewAsVisitor=true. Then the trait filter will handle the rest without any change (it will set the hardcode the gender trait to male). 
  • Question - should this be in helper libraries or in project code?
    • How would we put it in helper libraries? Maybe a little helper function. ie getDeliveryURL()?
Comment by Canh Nguyen [ 28/Jul/21 ]

The library only helps extract all query params regarding p13n if it's in the page editor (in an iframe). The library don't know any REST endpoints, they are managed by SPA applications and developers can freely add additional params, headers...

Without p13n parameters, the REST endpoints should be stateful, so developers should handle cookies, headers or other data to fetch p13n data.

Generated at Mon Feb 12 05:44:16 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.