Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gift cards/add recipient #2412

Merged
merged 70 commits into from
Mar 21, 2023
Merged

Gift cards/add recipient #2412

merged 70 commits into from
Mar 21, 2023

Commits on Mar 17, 2023

  1. Gift cards/add recipient add template (#102)

    Implement the recipient form for gift card product
    fredma authored and antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    c49fbe9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e61dbff View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    bc5dead View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e3f0cb5 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    89d3e65 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    41467d2 View commit details
    Browse the repository at this point in the history
  7. feat(#51542) Set the hidden control field in one of two ways

    1. As a hidden form field with a value of "if_present". This will be used by clients without javascript. The 'if_present' flag gives a hint to the backend to only validate email addresses if one is given, blank values are acceptable
    2. As a checkbox. This is a progressive enhancement which replaces the hidden field in 1 when javascript is enabled. The value sent to the backend will be on when the checkbox is checked. No field at all will be sent when it is unchecked. The backend will treat blank email as an error if the value is 'on'
    
    The control field is used by the backend to enable the send to recipient feature validation and processing. It must be present for the feature to do anything. We only need it to be present if the user has elected to fill out the form.
    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    fa1d844 View commit details
    Browse the repository at this point in the history
  8. Remove nested form elements from buy button snippets

    This was a good idea but unfortunately it doesn't work with liquid rendering flow, we need the passed in elements to render within the inner liquid context
    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    a7884a1 View commit details
    Browse the repository at this point in the history
  9. fix(#51542): wrap dummy form in product form class

    The dummy form is generated because we want to use properties from the liquid product from drop. It doesn't serve any actual purpose in the html.
    
    Normally product forms are wrapped in a <product-form> custom element which have some styling applied. We don't want to do that because the custom element also adds a bunch of js that we don't want. Instead we just use a div with the class.
    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    64488ef View commit details
    Browse the repository at this point in the history
  10. feat(#51543): Correct checkbox bahvior in all cases

    When js is disabled the form displays with no checkbox
    When js is enabled the form is hidden at page load and the checkbox is unhidden and enabled
    
    This works well but is susceptible to content flashes as the form is first shown then quickly hidden. Probably unacceptable.
    
    An obvious solution would be to check the checkbox by default which would mean there is no need to hide the form on load.
    
    A more extreme solution is to use a noscript tag to completely sever the link between the two sets of markup. I don't like this solution as it bloats the source but it does neatly take care of the content flash
    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    247a4e9 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    e9380e0 View commit details
    Browse the repository at this point in the history
  12. feat(#51731): Change the label on the recipient email field depending…

    … on wether the client has JS enabled
    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    b9f5486 View commit details
    Browse the repository at this point in the history
  13. feat(#51542): Error formatting for no js recipient form

    When we read errors out of the flash state we want them displayed nicely inline on the recipient form.
    
    We can do this by ripping off the pattern frolm customer registration. There are a few styles which have been implemented as
    specific .customer styles which should really be a generic class but not a huge issue to just use the customer class in our form as well
    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    1e9763f View commit details
    Browse the repository at this point in the history
  14. fix: lower case field names

    This is important as the field names we get from the backend are lower case and we use them to dynamically build selectors
    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    49d19d5 View commit details
    Browse the repository at this point in the history
  15. Restore buy buttons to their own block

    We tried to simplify things by having the recipient form be part of the main product form but it didn't work. We can just use the html form attribute to reassign inputs from a different form to the main product form. Messy from a source view but nicer from a visual editor POV.
    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    793406a View commit details
    Browse the repository at this point in the history
  16. This attempts to standardise error handling between liquid and javasc…

    …ript
    
    Liquid errors already render nicely next to the fields they belong to. We'd eventually like the same behaviour in JS. That will require tweaking the backend error payload a bit but is otherwise achievable.
    
    We first have to disable the existing product form error handling as this appears next to the buy buttons
    
    Instead we publish the error response on the pub/sub bus and display the error at the top of the recipient form.
    
    We have liquid render the error container so it looks roughly the same regardless of whether the error is rendered by liquid or JS.
    
    Next step will be to break the error message down into fields on the backend and unpack the messages on the FE.
    
    Co-authored-by: Frederic Ma <frederic.ma@shopify.com>
    antiBaconMachine and fredma committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    1bb0d96 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    617fc7f View commit details
    Browse the repository at this point in the history
  18. add error handling for name and message.

    There is no validation on these fields yet but there will be
    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    f92b3d4 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    16f7fb2 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    70040ec View commit details
    Browse the repository at this point in the history
  21. remove some form sizing

    Since this was introduced the markup has changed to introduce an extra form wrapper which takes care of what this was trying to achieve
    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    84d8e85 View commit details
    Browse the repository at this point in the history
  22. remove input field styling from form element

    Was throwing the alignment out
    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    46e9e2b View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    517d99c View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    57cb5a7 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    053cf8e View commit details
    Browse the repository at this point in the history
  26. Group repeated css rules

    Co-authored-by: Ludo <ludo.segura@shopify.com>
    antiBaconMachine and ludoboludo committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    d624c4b View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    701e107 View commit details
    Browse the repository at this point in the history
  28. Split up errors into their respective fields

    This mirrors what liquid does to render errors.
    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    73a7cd3 View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    ec25e91 View commit details
    Browse the repository at this point in the history
  30. Configuration menu
    Copy the full SHA
    fbcb62f View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    17defb7 View commit details
    Browse the repository at this point in the history
  32. enumerate errors

    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    ab74e9b View commit details
    Browse the repository at this point in the history
  33. Configuration menu
    Copy the full SHA
    c29e433 View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    a8cea7f View commit details
    Browse the repository at this point in the history
  35. Configuration menu
    Copy the full SHA
    aa7b4e5 View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    e94ecf0 View commit details
    Browse the repository at this point in the history
  37. Read localised field labels from DOM

    Previously we were building error messages using the unlocaised field key
    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    cd8f958 View commit details
    Browse the repository at this point in the history
  38. Save default error message header and restore it when needed

    This is important as the error reporter has to deal with two different types of errors:
    
    * Normal simple product form errors such as adding too many of a varient to cart. These display as a single sentence in the error header, replacing the original liquid rendered header.
    * Gift card recipient errors which arrive as a map of field => error message. These are disgned to mimic the original liquid layout of the page and as such should use the original liquid header, even if it has been previusly replaced by a simple product error
    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    b61ae4a View commit details
    Browse the repository at this point in the history
  39. add period after error message

    This matches how we do it in liquid
    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    9543809 View commit details
    Browse the repository at this point in the history
  40. Configuration menu
    Copy the full SHA
    722bfee View commit details
    Browse the repository at this point in the history
  41. Configuration menu
    Copy the full SHA
    4a2a92f View commit details
    Browse the repository at this point in the history
  42. Configuration menu
    Copy the full SHA
    e698fc0 View commit details
    Browse the repository at this point in the history
  43. Use single line if expressions

    I think the saved few characters are a false economy but it seems to be the style
    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    c251a19 View commit details
    Browse the repository at this point in the history
  44. Configuration menu
    Copy the full SHA
    091373d View commit details
    Browse the repository at this point in the history
  45. PR feedback

    * terse if/else, albeit with an extra assignment
    * remove uneeded form assignment
    * replace a span with a div
    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    b470d20 View commit details
    Browse the repository at this point in the history
  46. Configuration menu
    Copy the full SHA
    f9f50d6 View commit details
    Browse the repository at this point in the history
  47. Configuration menu
    Copy the full SHA
    b656d7a View commit details
    Browse the repository at this point in the history
  48. Add aria-labelledby attributes to form

    This is still not perfect, voiceover on mac will read out:
    
    {aria-labelledby} {placeholder}, edit text {label}
    
    e.g
    
    Recipient's Email Email, edit text Email
    
    I'm not sure it should use the placeholder like that. Ultimately the issue is that we use two labels for the field, perhaps we should scrap that approach and just use one label?
    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    fe869bb View commit details
    Browse the repository at this point in the history
  49. Various whitespace and stylistic fixes

    Co-authored-by: Ludo <ludo.segura@shopify.com>
    antiBaconMachine and ludoboludo committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    6aa7f56 View commit details
    Browse the repository at this point in the history
  50. Configuration menu
    Copy the full SHA
    f753c47 View commit details
    Browse the repository at this point in the history
  51. remove gift card recipient form block

    this has been replaced by a snippet
    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    2a81400 View commit details
    Browse the repository at this point in the history
  52. Remove leading labels from fields

    We felt that extra labels might be redundant. MEant I also had to rejig the spacing of the form but I think it's come out ok. Also emilinated the massive gap under error list.
    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    d30acab View commit details
    Browse the repository at this point in the history
  53. UX feedback fixes

    * Add elipses on field labels at short widths
    * Move max chars message to bottom of textarea
    * Add aria-label to textarea which contains the max chars description
    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    ff95e95 View commit details
    Browse the repository at this point in the history
  54. use plaeholder instead of label as error key

    This is because the label is now a bit wordy to use as an error key
    antiBaconMachine committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    e562f4e View commit details
    Browse the repository at this point in the history
  55. Dynamically calculate available space for label

    Co-authored-by: Ludo <ludo.segura@shopify.com>
    antiBaconMachine and ludoboludo committed Mar 17, 2023
    Configuration menu
    Copy the full SHA
    fd30c0d View commit details
    Browse the repository at this point in the history
  56. Configuration menu
    Copy the full SHA
    405e665 View commit details
    Browse the repository at this point in the history
  57. Configuration menu
    Copy the full SHA
    92380a6 View commit details
    Browse the repository at this point in the history
  58. Configuration menu
    Copy the full SHA
    69b07ee View commit details
    Browse the repository at this point in the history
  59. Configuration menu
    Copy the full SHA
    7cd7e6c View commit details
    Browse the repository at this point in the history
  60. Configuration menu
    Copy the full SHA
    5fd63f7 View commit details
    Browse the repository at this point in the history
  61. Configuration menu
    Copy the full SHA
    f1a3246 View commit details
    Browse the repository at this point in the history
  62. Configuration menu
    Copy the full SHA
    c9b9283 View commit details
    Browse the repository at this point in the history

Commits on Mar 20, 2023

  1. Configuration menu
    Copy the full SHA
    e192755 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    149b323 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0204dfe View commit details
    Browse the repository at this point in the history

Commits on Mar 21, 2023

  1. Update snippets/gift-card-recipient-form.liquid

    Co-authored-by: Ludo <ludo.segura@shopify.com>
    antiBaconMachine and ludoboludo committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    8e29538 View commit details
    Browse the repository at this point in the history
  2. Update snippets/gift-card-recipient-form.liquid

    Co-authored-by: Ludo <ludo.segura@shopify.com>
    antiBaconMachine and ludoboludo committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    f578763 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e720fba View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    d305bac View commit details
    Browse the repository at this point in the history
  5. fix translation file issue

    ludoboludo committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    4cecb78 View commit details
    Browse the repository at this point in the history