swellstores / swell-js

JS library for building storefronts and checkouts with Swell ecommerce.
https://swell.is
MIT License
139 stars 29 forks source link

feat: add setCookie and getCookie options #115

Closed stafyniaksacha closed 1 year ago

stafyniaksacha commented 1 year ago

Closes #82


This PR add setCookie and getCookie option to swell constructor.

This is a first step required to allow using swell-js with SSR


import swell from 'swell-js'

swell.init('store-id', 'public-key', {
  setCookie: (name, value, options = {}) => {
    // set cookies
  },
  getCookie: (name) => {
    // read cookies

    return 'foo'
  },
})
swellmike commented 1 year ago

Looks like this change broke some unit tests.

vstudenichnik-insoft commented 1 year ago

Looks good, failed tests need to be fixed.

stafyniaksacha commented 1 year ago

@swellmike @vstudenichnik-insoft should be ok!

stafyniaksacha commented 1 year ago

Hello @swellmike,

I noticed that you released a patch with this feature in the patch note, but I can not see the related code in the published package content here: https://www.runpkg.com/?swell-js@3.22.4/dist/api-6f09d9cb.js#59

I also noticed that dist package also contains old versions: https://www.runpkg.com/?swell-js@3.22.4/dist/api-ee592898.js Is this expected ?