@sentecacommerce-theme/lib 0.14.7 → 0.14.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/analytics/purchase.js +10 -10
- package/dist/cjs/product/api/keys.js +6 -4
- package/dist/cjs/product/api/queries/useBnpOffersQuery.js +1 -1
- package/dist/cjs/product/api/queries/useUniCreditOffersQuery.js +1 -1
- package/dist/cjs/user/api/utils/processLoginPayload.js +5 -4
- package/dist/cjs/utils/index.js +0 -12
- package/dist/cjs/utils/tokens.js +1 -1
- package/dist/esm/analytics/purchase.js +10 -10
- package/dist/esm/product/api/keys.js +6 -4
- package/dist/esm/product/api/queries/useBnpOffersQuery.js +1 -1
- package/dist/esm/product/api/queries/useUniCreditOffersQuery.js +1 -1
- package/dist/esm/user/api/utils/processLoginPayload.js +6 -5
- package/dist/esm/utils/index.js +0 -1
- package/dist/esm/utils/tokens.js +1 -1
- package/dist/types/product/api/keys.d.ts +2 -2
- package/dist/types/utils/index.d.ts +0 -1
- package/dist/types/utils/tokens.d.ts +4 -9
- package/package.json +4 -4
- package/dist/cjs/utils/convertDateIntoRemainingDays.js +0 -10
- package/dist/esm/utils/convertDateIntoRemainingDays.js +0 -5
- package/dist/types/utils/convertDateIntoRemainingDays.d.ts +0 -1
| @@ -15,7 +15,7 @@ var purchase = function(order, config) { | |
| 15 15 | 
             
                var isGtagLoaded = Boolean(window.gtag);
         | 
| 16 16 | 
             
                var hasGoogleId = Boolean((ref8 = config.google) === null || ref8 === void 0 ? void 0 : ref8.analytics);
         | 
| 17 17 | 
             
                if (isGtagLoaded && hasGoogleId) {
         | 
| 18 | 
            -
                    var ref9, ref10, ref11;
         | 
| 18 | 
            +
                    var ref9, ref10, ref11, ref12;
         | 
| 19 19 | 
             
                    var items = ((ref9 = order.lineItems) === null || ref9 === void 0 ? void 0 : ref9.map(function(item, i) {
         | 
| 20 20 | 
             
                        return {
         | 
| 21 21 | 
             
                            id: item.variant.sku,
         | 
| @@ -23,36 +23,36 @@ var purchase = function(order, config) { | |
| 23 23 | 
             
                            list_name: config.defaultMerchant,
         | 
| 24 24 | 
             
                            list_position: i + 1,
         | 
| 25 25 | 
             
                            quantity: item.quantity,
         | 
| 26 | 
            -
                            price: (0, _decodePrice).decodePrice(item.totalPrice)
         | 
| 26 | 
            +
                            price: (item === null || item === void 0 ? void 0 : item.totalPrice) && (0, _decodePrice).decodePrice(item.totalPrice)
         | 
| 27 27 | 
             
                        };
         | 
| 28 28 | 
             
                    })) || [];
         | 
| 29 | 
            -
                    ( | 
| 29 | 
            +
                    (ref12 = window.gtag) === null || ref12 === void 0 ? void 0 : ref12.call(window, 'event', 'purchase', {
         | 
| 30 30 | 
             
                        transaction_id: order._id,
         | 
| 31 31 | 
             
                        send_to: (ref10 = config.google) === null || ref10 === void 0 ? void 0 : ref10.analytics,
         | 
| 32 32 | 
             
                        affiliation: config.defaultMerchant,
         | 
| 33 33 | 
             
                        value: (0, _decodePrice).decodePrice(order.grandTotalPrice),
         | 
| 34 34 | 
             
                        currency: order.currencyCode,
         | 
| 35 35 | 
             
                        tax: (0, _decodePrice).decodePrice(centAmount),
         | 
| 36 | 
            -
                        shipping: (order === null || order === void 0 ? void 0 : order.shippings) ? (0, _decodePrice).decodePrice(order.shippings[0].price) : 0,
         | 
| 36 | 
            +
                        shipping: (order === null || order === void 0 ? void 0 : order.shippings) ? (0, _decodePrice).decodePrice((ref11 = order.shippings[0]) === null || ref11 === void 0 ? void 0 : ref11.price) : 0,
         | 
| 37 37 | 
             
                        items: items
         | 
| 38 38 | 
             
                    });
         | 
| 39 39 | 
             
                }
         | 
| 40 40 | 
             
                if (isGtagLoaded && hasGoogleReMarketing) {
         | 
| 41 | 
            -
                    var  | 
| 42 | 
            -
                    ( | 
| 43 | 
            -
                        send_to: "".concat(( | 
| 41 | 
            +
                    var ref13, ref14, ref15, ref16, ref17;
         | 
| 42 | 
            +
                    (ref17 = window.gtag) === null || ref17 === void 0 ? void 0 : ref17.call(window, 'event', 'conversion', {
         | 
| 43 | 
            +
                        send_to: "".concat((ref13 = config.google) === null || ref13 === void 0 ? void 0 : (ref14 = ref13.reMarketing) === null || ref14 === void 0 ? void 0 : ref14.id, "/").concat((ref15 = config.google) === null || ref15 === void 0 ? void 0 : (ref16 = ref15.reMarketing) === null || ref16 === void 0 ? void 0 : ref16.label),
         | 
| 44 44 | 
             
                        value: (0, _decodePrice).decodePrice(order.grandTotalPrice),
         | 
| 45 45 | 
             
                        currency: order.currencyCode,
         | 
| 46 46 | 
             
                        transaction_id: order._id
         | 
| 47 47 | 
             
                    });
         | 
| 48 48 | 
             
                }
         | 
| 49 49 | 
             
                if (facebookPixelLoaded) {
         | 
| 50 | 
            -
                    var  | 
| 51 | 
            -
                    ( | 
| 50 | 
            +
                    var ref18, ref19;
         | 
| 51 | 
            +
                    (ref19 = window.fbq) === null || ref19 === void 0 ? void 0 : ref19.call(window, 'track', 'Purchase', {
         | 
| 52 52 | 
             
                        currency: order.currencyCode,
         | 
| 53 53 | 
             
                        value: (0, _decodePrice).decodePrice(order.grandTotalPrice),
         | 
| 54 54 | 
             
                        content_type: 'product',
         | 
| 55 | 
            -
                        contents: (( | 
| 55 | 
            +
                        contents: ((ref18 = order.lineItems) === null || ref18 === void 0 ? void 0 : ref18.map(function(product) {
         | 
| 56 56 | 
             
                            return {
         | 
| 57 57 | 
             
                                id: product.variant.sku,
         | 
| 58 58 | 
             
                                quantity: product.quantity
         | 
| @@ -2,17 +2,19 @@ Object.defineProperty(exports, "__esModule", { | |
| 2 2 | 
             
                value: true
         | 
| 3 3 | 
             
            });
         | 
| 4 4 | 
             
            exports.getUniCreditProductOffersKey = exports.getBnpProductOffersKey = void 0;
         | 
| 5 | 
            -
            var getBnpProductOffersKey = function(sku) {
         | 
| 5 | 
            +
            var getBnpProductOffersKey = function(sku, downPaymentCentAmount) {
         | 
| 6 6 | 
             
                return [
         | 
| 7 7 | 
             
                    'product-bnp-offers',
         | 
| 8 | 
            -
                    sku
         | 
| 8 | 
            +
                    sku,
         | 
| 9 | 
            +
                    downPaymentCentAmount
         | 
| 9 10 | 
             
                ];
         | 
| 10 11 | 
             
            };
         | 
| 11 12 | 
             
            exports.getBnpProductOffersKey = getBnpProductOffersKey;
         | 
| 12 | 
            -
            var getUniCreditProductOffersKey = function(sku) {
         | 
| 13 | 
            +
            var getUniCreditProductOffersKey = function(sku, downPaymentCentAmount) {
         | 
| 13 14 | 
             
                return [
         | 
| 14 15 | 
             
                    'product-unicredit-offers',
         | 
| 15 | 
            -
                    sku
         | 
| 16 | 
            +
                    sku,
         | 
| 17 | 
            +
                    downPaymentCentAmount
         | 
| 16 18 | 
             
                ];
         | 
| 17 19 | 
             
            };
         | 
| 18 20 | 
             
            exports.getUniCreditProductOffersKey = getUniCreditProductOffersKey;
         | 
| @@ -43,7 +43,7 @@ function _interopRequireDefault(obj) { | |
| 43 43 | 
             
            }
         | 
| 44 44 | 
             
            var useBnpOffersQuery = function(param) {
         | 
| 45 45 | 
             
                var sku = param.sku, _preferredInstallmentCentAmount = param.preferredInstallmentCentAmount, preferredInstallmentCentAmount = _preferredInstallmentCentAmount === void 0 ? 0 : _preferredInstallmentCentAmount, _downPaymentCentAmount = param.downPaymentCentAmount, downPaymentCentAmount = _downPaymentCentAmount === void 0 ? 0 : _downPaymentCentAmount;
         | 
| 46 | 
            -
                return (0, _reactQuery).useQuery((0, _keys).getBnpProductOffersKey(sku), _asyncToGenerator(_regeneratorRuntime.default.mark(function _callee() {
         | 
| 46 | 
            +
                return (0, _reactQuery).useQuery((0, _keys).getBnpProductOffersKey(sku, downPaymentCentAmount), _asyncToGenerator(_regeneratorRuntime.default.mark(function _callee() {
         | 
| 47 47 | 
             
                    return _regeneratorRuntime.default.wrap(function _callee$(_ctx) {
         | 
| 48 48 | 
             
                        while(1)switch(_ctx.prev = _ctx.next){
         | 
| 49 49 | 
             
                            case 0:
         | 
| @@ -43,7 +43,7 @@ function _interopRequireDefault(obj) { | |
| 43 43 | 
             
            }
         | 
| 44 44 | 
             
            var useUniCreditOffersQuery = function(param) {
         | 
| 45 45 | 
             
                var sku = param.sku, _downPaymentCentAmount = param.downPaymentCentAmount, downPaymentCentAmount = _downPaymentCentAmount === void 0 ? 0 : _downPaymentCentAmount;
         | 
| 46 | 
            -
                return (0, _reactQuery).useQuery((0, _keys).getUniCreditProductOffersKey(sku), _asyncToGenerator(_regeneratorRuntime.default.mark(function _callee() {
         | 
| 46 | 
            +
                return (0, _reactQuery).useQuery((0, _keys).getUniCreditProductOffersKey(sku, downPaymentCentAmount), _asyncToGenerator(_regeneratorRuntime.default.mark(function _callee() {
         | 
| 47 47 | 
             
                    return _regeneratorRuntime.default.wrap(function _callee$(_ctx) {
         | 
| 48 48 | 
             
                        while(1)switch(_ctx.prev = _ctx.next){
         | 
| 49 49 | 
             
                            case 0:
         | 
| @@ -8,17 +8,18 @@ var _utils = require("../../../utils"); | |
| 8 8 | 
             
            var processLoginPayload = function(data) {
         | 
| 9 9 | 
             
                var anonymous = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
         | 
| 10 10 | 
             
                var accessTokenExpires = data.expires;
         | 
| 11 | 
            -
                var  | 
| 11 | 
            +
                var _refreshTokenExpires;
         | 
| 12 | 
            +
                var refreshTokenExpires = (_refreshTokenExpires = data.refreshTokenExpires) !== null && _refreshTokenExpires !== void 0 ? _refreshTokenExpires : accessTokenExpires;
         | 
| 12 13 | 
             
                (0, _utils).writeToLocalStorage(_wishlistApi.WISHLIST_STORAGE_KEY, data.wishList);
         | 
| 13 14 | 
             
                (0, _utils).writeToLocalStorage(_myCartApi.BASKET_STORAGE_KEY, data.basket);
         | 
| 14 15 | 
             
                (0, _utils).setAccessToken(data.accessToken, anonymous, {
         | 
| 15 | 
            -
                    expires:  | 
| 16 | 
            +
                    expires: new Date(accessTokenExpires)
         | 
| 16 17 | 
             
                });
         | 
| 17 18 | 
             
                (0, _utils).setExpiryToken(data.expires, {
         | 
| 18 | 
            -
                    expires:  | 
| 19 | 
            +
                    expires: new Date(refreshTokenExpires)
         | 
| 19 20 | 
             
                });
         | 
| 20 21 | 
             
                (0, _utils).setRefreshToken(data.refreshToken, {
         | 
| 21 | 
            -
                    expires:  | 
| 22 | 
            +
                    expires: new Date(refreshTokenExpires)
         | 
| 22 23 | 
             
                });
         | 
| 23 24 | 
             
                !anonymous && (0, _utils).removeAnonToken();
         | 
| 24 25 | 
             
            };
         | 
    
        package/dist/cjs/utils/index.js
    CHANGED
    
    | @@ -410,18 +410,6 @@ Object.keys(_transliterate).forEach(function(key) { | |
| 410 410 | 
             
                    }
         | 
| 411 411 | 
             
                });
         | 
| 412 412 | 
             
            });
         | 
| 413 | 
            -
            var _convertDateIntoRemainingDays = _interopRequireWildcard(require("./convertDateIntoRemainingDays"));
         | 
| 414 | 
            -
            Object.keys(_convertDateIntoRemainingDays).forEach(function(key) {
         | 
| 415 | 
            -
                if (key === "default" || key === "__esModule") return;
         | 
| 416 | 
            -
                if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
         | 
| 417 | 
            -
                if (key in exports && exports[key] === _convertDateIntoRemainingDays[key]) return;
         | 
| 418 | 
            -
                Object.defineProperty(exports, key, {
         | 
| 419 | 
            -
                    enumerable: true,
         | 
| 420 | 
            -
                    get: function() {
         | 
| 421 | 
            -
                        return _convertDateIntoRemainingDays[key];
         | 
| 422 | 
            -
                    }
         | 
| 423 | 
            -
                });
         | 
| 424 | 
            -
            });
         | 
| 425 413 | 
             
            var _prefetchSDKConfig = _interopRequireWildcard(require("./prefetchSDKConfig"));
         | 
| 426 414 | 
             
            Object.keys(_prefetchSDKConfig).forEach(function(key) {
         | 
| 427 415 | 
             
                if (key === "default" || key === "__esModule") return;
         | 
    
        package/dist/cjs/utils/tokens.js
    CHANGED
    
    | @@ -93,7 +93,7 @@ var setAccessToken = function(token, anonymous, options) { | |
| 93 93 | 
             
            };
         | 
| 94 94 | 
             
            exports.setAccessToken = setAccessToken;
         | 
| 95 95 | 
             
            var setRefreshToken = function(token, options) {
         | 
| 96 | 
            -
                _jsCookie.default.set(REFRESH_TOKEN_KEY, token, options);
         | 
| 96 | 
            +
                token && _jsCookie.default.set(REFRESH_TOKEN_KEY, token, options);
         | 
| 97 97 | 
             
            };
         | 
| 98 98 | 
             
            exports.setRefreshToken = setRefreshToken;
         | 
| 99 99 | 
             
            var setExpiryToken = function(timestamp, options) {
         | 
| @@ -11,7 +11,7 @@ export var purchase = function(order, config) { | |
| 11 11 | 
             
                var isGtagLoaded = Boolean(window.gtag);
         | 
| 12 12 | 
             
                var hasGoogleId = Boolean((ref8 = config.google) === null || ref8 === void 0 ? void 0 : ref8.analytics);
         | 
| 13 13 | 
             
                if (isGtagLoaded && hasGoogleId) {
         | 
| 14 | 
            -
                    var ref9, ref10, ref11;
         | 
| 14 | 
            +
                    var ref9, ref10, ref11, ref12;
         | 
| 15 15 | 
             
                    var items = ((ref9 = order.lineItems) === null || ref9 === void 0 ? void 0 : ref9.map(function(item, i) {
         | 
| 16 16 | 
             
                        return {
         | 
| 17 17 | 
             
                            id: item.variant.sku,
         | 
| @@ -19,36 +19,36 @@ export var purchase = function(order, config) { | |
| 19 19 | 
             
                            list_name: config.defaultMerchant,
         | 
| 20 20 | 
             
                            list_position: i + 1,
         | 
| 21 21 | 
             
                            quantity: item.quantity,
         | 
| 22 | 
            -
                            price: decodePrice(item.totalPrice)
         | 
| 22 | 
            +
                            price: (item === null || item === void 0 ? void 0 : item.totalPrice) && decodePrice(item.totalPrice)
         | 
| 23 23 | 
             
                        };
         | 
| 24 24 | 
             
                    })) || [];
         | 
| 25 | 
            -
                    ( | 
| 25 | 
            +
                    (ref12 = window.gtag) === null || ref12 === void 0 ? void 0 : ref12.call(window, 'event', 'purchase', {
         | 
| 26 26 | 
             
                        transaction_id: order._id,
         | 
| 27 27 | 
             
                        send_to: (ref10 = config.google) === null || ref10 === void 0 ? void 0 : ref10.analytics,
         | 
| 28 28 | 
             
                        affiliation: config.defaultMerchant,
         | 
| 29 29 | 
             
                        value: decodePrice(order.grandTotalPrice),
         | 
| 30 30 | 
             
                        currency: order.currencyCode,
         | 
| 31 31 | 
             
                        tax: decodePrice(centAmount),
         | 
| 32 | 
            -
                        shipping: (order === null || order === void 0 ? void 0 : order.shippings) ? decodePrice(order.shippings[0].price) : 0,
         | 
| 32 | 
            +
                        shipping: (order === null || order === void 0 ? void 0 : order.shippings) ? decodePrice((ref11 = order.shippings[0]) === null || ref11 === void 0 ? void 0 : ref11.price) : 0,
         | 
| 33 33 | 
             
                        items: items
         | 
| 34 34 | 
             
                    });
         | 
| 35 35 | 
             
                }
         | 
| 36 36 | 
             
                if (isGtagLoaded && hasGoogleReMarketing) {
         | 
| 37 | 
            -
                    var  | 
| 38 | 
            -
                    ( | 
| 39 | 
            -
                        send_to: "".concat(( | 
| 37 | 
            +
                    var ref13, ref14, ref15, ref16, ref17;
         | 
| 38 | 
            +
                    (ref17 = window.gtag) === null || ref17 === void 0 ? void 0 : ref17.call(window, 'event', 'conversion', {
         | 
| 39 | 
            +
                        send_to: "".concat((ref13 = config.google) === null || ref13 === void 0 ? void 0 : (ref14 = ref13.reMarketing) === null || ref14 === void 0 ? void 0 : ref14.id, "/").concat((ref15 = config.google) === null || ref15 === void 0 ? void 0 : (ref16 = ref15.reMarketing) === null || ref16 === void 0 ? void 0 : ref16.label),
         | 
| 40 40 | 
             
                        value: decodePrice(order.grandTotalPrice),
         | 
| 41 41 | 
             
                        currency: order.currencyCode,
         | 
| 42 42 | 
             
                        transaction_id: order._id
         | 
| 43 43 | 
             
                    });
         | 
| 44 44 | 
             
                }
         | 
| 45 45 | 
             
                if (facebookPixelLoaded) {
         | 
| 46 | 
            -
                    var  | 
| 47 | 
            -
                    ( | 
| 46 | 
            +
                    var ref18, ref19;
         | 
| 47 | 
            +
                    (ref19 = window.fbq) === null || ref19 === void 0 ? void 0 : ref19.call(window, 'track', 'Purchase', {
         | 
| 48 48 | 
             
                        currency: order.currencyCode,
         | 
| 49 49 | 
             
                        value: decodePrice(order.grandTotalPrice),
         | 
| 50 50 | 
             
                        content_type: 'product',
         | 
| 51 | 
            -
                        contents: (( | 
| 51 | 
            +
                        contents: ((ref18 = order.lineItems) === null || ref18 === void 0 ? void 0 : ref18.map(function(product) {
         | 
| 52 52 | 
             
                            return {
         | 
| 53 53 | 
             
                                id: product.variant.sku,
         | 
| 54 54 | 
             
                                quantity: product.quantity
         | 
| @@ -1,12 +1,14 @@ | |
| 1 | 
            -
            export var getBnpProductOffersKey = function(sku) {
         | 
| 1 | 
            +
            export var getBnpProductOffersKey = function(sku, downPaymentCentAmount) {
         | 
| 2 2 | 
             
                return [
         | 
| 3 3 | 
             
                    'product-bnp-offers',
         | 
| 4 | 
            -
                    sku
         | 
| 4 | 
            +
                    sku,
         | 
| 5 | 
            +
                    downPaymentCentAmount
         | 
| 5 6 | 
             
                ];
         | 
| 6 7 | 
             
            };
         | 
| 7 | 
            -
            export var getUniCreditProductOffersKey = function(sku) {
         | 
| 8 | 
            +
            export var getUniCreditProductOffersKey = function(sku, downPaymentCentAmount) {
         | 
| 8 9 | 
             
                return [
         | 
| 9 10 | 
             
                    'product-unicredit-offers',
         | 
| 10 | 
            -
                    sku
         | 
| 11 | 
            +
                    sku,
         | 
| 12 | 
            +
                    downPaymentCentAmount
         | 
| 11 13 | 
             
                ];
         | 
| 12 14 | 
             
            };
         | 
| @@ -34,7 +34,7 @@ function _asyncToGenerator(fn) { | |
| 34 34 | 
             
            }
         | 
| 35 35 | 
             
            export var useBnpOffersQuery = function(param) {
         | 
| 36 36 | 
             
                var sku = param.sku, _preferredInstallmentCentAmount = param.preferredInstallmentCentAmount, preferredInstallmentCentAmount = _preferredInstallmentCentAmount === void 0 ? 0 : _preferredInstallmentCentAmount, _downPaymentCentAmount = param.downPaymentCentAmount, downPaymentCentAmount = _downPaymentCentAmount === void 0 ? 0 : _downPaymentCentAmount;
         | 
| 37 | 
            -
                return useQuery(getBnpProductOffersKey(sku), _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
         | 
| 37 | 
            +
                return useQuery(getBnpProductOffersKey(sku, downPaymentCentAmount), _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
         | 
| 38 38 | 
             
                    return regeneratorRuntime.wrap(function _callee$(_ctx) {
         | 
| 39 39 | 
             
                        while(1)switch(_ctx.prev = _ctx.next){
         | 
| 40 40 | 
             
                            case 0:
         | 
| @@ -34,7 +34,7 @@ function _asyncToGenerator(fn) { | |
| 34 34 | 
             
            }
         | 
| 35 35 | 
             
            export var useUniCreditOffersQuery = function(param) {
         | 
| 36 36 | 
             
                var sku = param.sku, _downPaymentCentAmount = param.downPaymentCentAmount, downPaymentCentAmount = _downPaymentCentAmount === void 0 ? 0 : _downPaymentCentAmount;
         | 
| 37 | 
            -
                return useQuery(getUniCreditProductOffersKey(sku), _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
         | 
| 37 | 
            +
                return useQuery(getUniCreditProductOffersKey(sku, downPaymentCentAmount), _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
         | 
| 38 38 | 
             
                    return regeneratorRuntime.wrap(function _callee$(_ctx) {
         | 
| 39 39 | 
             
                        while(1)switch(_ctx.prev = _ctx.next){
         | 
| 40 40 | 
             
                            case 0:
         | 
| @@ -1,20 +1,21 @@ | |
| 1 1 | 
             
            import { WISHLIST_STORAGE_KEY } from '../../../api/wishlistApi';
         | 
| 2 2 | 
             
            import { BASKET_STORAGE_KEY } from '../../../api/myCartApi';
         | 
| 3 | 
            -
            import {  | 
| 3 | 
            +
            import { removeAnonToken, setAccessToken, setExpiryToken, setRefreshToken, writeToLocalStorage } from '../../../utils';
         | 
| 4 4 | 
             
            export var processLoginPayload = function(data) {
         | 
| 5 5 | 
             
                var anonymous = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
         | 
| 6 6 | 
             
                var accessTokenExpires = data.expires;
         | 
| 7 | 
            -
                var  | 
| 7 | 
            +
                var _refreshTokenExpires;
         | 
| 8 | 
            +
                var refreshTokenExpires = (_refreshTokenExpires = data.refreshTokenExpires) !== null && _refreshTokenExpires !== void 0 ? _refreshTokenExpires : accessTokenExpires;
         | 
| 8 9 | 
             
                writeToLocalStorage(WISHLIST_STORAGE_KEY, data.wishList);
         | 
| 9 10 | 
             
                writeToLocalStorage(BASKET_STORAGE_KEY, data.basket);
         | 
| 10 11 | 
             
                setAccessToken(data.accessToken, anonymous, {
         | 
| 11 | 
            -
                    expires:  | 
| 12 | 
            +
                    expires: new Date(accessTokenExpires)
         | 
| 12 13 | 
             
                });
         | 
| 13 14 | 
             
                setExpiryToken(data.expires, {
         | 
| 14 | 
            -
                    expires:  | 
| 15 | 
            +
                    expires: new Date(refreshTokenExpires)
         | 
| 15 16 | 
             
                });
         | 
| 16 17 | 
             
                setRefreshToken(data.refreshToken, {
         | 
| 17 | 
            -
                    expires:  | 
| 18 | 
            +
                    expires: new Date(refreshTokenExpires)
         | 
| 18 19 | 
             
                });
         | 
| 19 20 | 
             
                !anonymous && removeAnonToken();
         | 
| 20 21 | 
             
            };
         | 
    
        package/dist/esm/utils/index.js
    CHANGED
    
    
    
        package/dist/esm/utils/tokens.js
    CHANGED
    
    | @@ -78,7 +78,7 @@ export var setAccessToken = function(token, anonymous, options) { | |
| 78 78 | 
             
                Cookies.set("".concat(tokenIdentifier), token, options);
         | 
| 79 79 | 
             
            };
         | 
| 80 80 | 
             
            export var setRefreshToken = function(token, options) {
         | 
| 81 | 
            -
                Cookies.set(REFRESH_TOKEN_KEY, token, options);
         | 
| 81 | 
            +
                token && Cookies.set(REFRESH_TOKEN_KEY, token, options);
         | 
| 82 82 | 
             
            };
         | 
| 83 83 | 
             
            export var setExpiryToken = function(timestamp, options) {
         | 
| 84 84 | 
             
                Cookies.set(TOKEN_EXPIRY_KEY, timestamp.toString(), options);
         | 
| @@ -1,2 +1,2 @@ | |
| 1 | 
            -
            export declare const getBnpProductOffersKey: (sku: string) => string[];
         | 
| 2 | 
            -
            export declare const getUniCreditProductOffersKey: (sku: string) => string[];
         | 
| 1 | 
            +
            export declare const getBnpProductOffersKey: (sku: string, downPaymentCentAmount?: number | undefined) => (string | number | undefined)[];
         | 
| 2 | 
            +
            export declare const getUniCreditProductOffersKey: (sku: string, downPaymentCentAmount?: number | undefined) => (string | number | undefined)[];
         | 
| @@ -1,17 +1,12 @@ | |
| 1 | 
            +
            import Cookies from 'js-cookie';
         | 
| 1 2 | 
             
            export declare const AUTH_TOKEN_KEY = "token";
         | 
| 2 3 | 
             
            export declare const ANONYMOUS_TOKEN_KEY = "anonymousToken";
         | 
| 3 4 | 
             
            export declare const TOKEN_EXPIRY_KEY = "tokenExpiry";
         | 
| 4 5 | 
             
            export declare const REFRESH_TOKEN_KEY = "refreshToken";
         | 
| 5 6 | 
             
            export declare const isTokenExpired: () => boolean;
         | 
| 6 | 
            -
            export declare const setAccessToken: (token: string, anonymous: boolean, options?:  | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
            export declare const setRefreshToken: (token: string, options?: {
         | 
| 10 | 
            -
                expires: number;
         | 
| 11 | 
            -
            } | undefined) => void;
         | 
| 12 | 
            -
            export declare const setExpiryToken: (timestamp: number, options?: {
         | 
| 13 | 
            -
                expires: number;
         | 
| 14 | 
            -
            } | undefined) => void;
         | 
| 7 | 
            +
            export declare const setAccessToken: (token: string, anonymous: boolean, options?: Cookies.CookieAttributes | undefined) => void;
         | 
| 8 | 
            +
            export declare const setRefreshToken: (token: string | undefined, options?: Cookies.CookieAttributes | undefined) => void;
         | 
| 9 | 
            +
            export declare const setExpiryToken: (timestamp: number, options?: Cookies.CookieAttributes | undefined) => void;
         | 
| 15 10 | 
             
            export declare const getExpiryToken: () => string | undefined;
         | 
| 16 11 | 
             
            export declare const removeExpiryToken: () => void;
         | 
| 17 12 | 
             
            export declare const getRefreshToken: () => string | undefined;
         | 
    
        package/package.json
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            {
         | 
| 2 2 | 
             
              "name": "@sentecacommerce-theme/lib",
         | 
| 3 3 | 
             
              "sideEffects": false,
         | 
| 4 | 
            -
              "version": "0.14. | 
| 4 | 
            +
              "version": "0.14.10",
         | 
| 5 5 | 
             
              "main": "dist/cjs/index.js",
         | 
| 6 6 | 
             
              "module": "dist/esm/index.js",
         | 
| 7 7 | 
             
              "types": "dist/types/index.d.ts",
         | 
| @@ -31,13 +31,13 @@ | |
| 31 31 | 
             
                "watch:cjs": "swc src --out-dir dist/cjs -w",
         | 
| 32 32 | 
             
                "watch:esm": "swc src --out-dir dist/esm --no-swcrc -w"
         | 
| 33 33 | 
             
              },
         | 
| 34 | 
            -
              "gitHead": " | 
| 34 | 
            +
              "gitHead": "dadc5d65008f28350c280f9ba9ef65d6a2a68773",
         | 
| 35 35 | 
             
              "peerDependencies": {
         | 
| 36 36 | 
             
                "react-query": "^2.26.2"
         | 
| 37 37 | 
             
              },
         | 
| 38 38 | 
             
              "dependencies": {
         | 
| 39 | 
            -
                "@sentecacommerce-theme/base": "^0.14. | 
| 40 | 
            -
                "@sentecacommerce-theme/cms": "^0.14. | 
| 39 | 
            +
                "@sentecacommerce-theme/base": "^0.14.10",
         | 
| 40 | 
            +
                "@sentecacommerce-theme/cms": "^0.14.10",
         | 
| 41 41 | 
             
                "@sentecacommerce/sdk": "2.0.175",
         | 
| 42 42 | 
             
                "body-scroll-lock": "^3.1.5",
         | 
| 43 43 | 
             
                "copy-to-clipboard": "^3.3.1",
         | 
| @@ -1,10 +0,0 @@ | |
| 1 | 
            -
            Object.defineProperty(exports, "__esModule", {
         | 
| 2 | 
            -
                value: true
         | 
| 3 | 
            -
            });
         | 
| 4 | 
            -
            exports.convertDateIntoRemainingDays = void 0;
         | 
| 5 | 
            -
            var convertDateIntoRemainingDays = function(date1, date2) {
         | 
| 6 | 
            -
                var differenceInTime = date2.getTime() - date1.getTime();
         | 
| 7 | 
            -
                var differenceInDays = differenceInTime / (1000 * 3600 * 24);
         | 
| 8 | 
            -
                return Math.floor(differenceInDays);
         | 
| 9 | 
            -
            };
         | 
| 10 | 
            -
            exports.convertDateIntoRemainingDays = convertDateIntoRemainingDays;
         | 
| @@ -1 +0,0 @@ | |
| 1 | 
            -
            export declare const convertDateIntoRemainingDays: (date1: Date, date2: Date) => number;
         |