@ordergroove/offers 2.34.7-alpha-PR-789-9.10 → 2.34.7
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/CHANGELOG.md +8 -0
- package/dist/bundle-report.html +119 -119
- package/dist/examples.js.map +3 -3
- package/dist/offers.js +134 -134
- package/dist/offers.js.map +4 -4
- package/package.json +5 -5
- package/src/components/FrequencyStatus.js +0 -1
- package/src/components/PrepaidStatus.js +1 -1
- package/src/components/__tests__/OG.fspec.js +2 -2
- package/src/components/__tests__/Offer.spec.js +0 -1
- package/src/components/__tests__/Price.spec.js +1 -1
- package/src/components/__tests__/SelectFrequency.spec.js +0 -1
- package/src/core/__tests__/connect.spec.js +0 -4
- package/src/core/__tests__/localStorage.spec.js +1 -2
- package/src/core/__tests__/middleware.spec.js +1 -1
- package/src/core/actions-preview.js +1 -1
- package/src/core/actions.js +0 -2
- package/src/core/adapters.js +0 -1
- package/src/core/api.js +0 -1
- package/src/core/connect.js +1 -3
- package/src/core/middleware.js +2 -4
- package/src/core/reducer.js +6 -4
- package/src/core/resolveProperties.js +0 -1
- package/src/core/selectors.js +0 -1
- package/src/core/store.js +1 -3
- package/src/make-api.js +3 -4
- package/src/run-tests.js +1 -1
- package/src/shopify/__tests__/shopifyMiddleware.spec.js +1 -1
- package/src/shopify/reducers/productPlans.ts +1 -1
- package/src/shopify/shopifyBootstrap.ts +2 -2
- package/src/shopify/shopifyMiddleware.ts +4 -4
- package/src/shopify/shopifyReducer.js +5 -6
- package/src/shopify/shopifyTrackingMiddleware.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ordergroove/offers",
|
|
3
|
-
"version": "2.34.7
|
|
3
|
+
"version": "2.34.7",
|
|
4
4
|
"description": "offer state component",
|
|
5
5
|
"author": "Eugenio Lattanzio <eugenio63@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/ordergroove/plush-toys#readme",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
}
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@ordergroove/auth": "^2.3.
|
|
39
|
-
"@ordergroove/offers-live-editor": "^0.6.3
|
|
38
|
+
"@ordergroove/auth": "^2.3.1",
|
|
39
|
+
"@ordergroove/offers-live-editor": "^0.6.3",
|
|
40
40
|
"lit-element": "^2.1.0",
|
|
41
41
|
"lodash.memoize": "^4.1.2",
|
|
42
42
|
"logical-expression-parser": "1.0.0",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"throttle-debounce": "^2.1.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@ordergroove/offers-templates": "^0.9.
|
|
48
|
+
"@ordergroove/offers-templates": "^0.9.2"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "1b08ceb2cca573488a040e8645304a446d72cd31"
|
|
51
51
|
}
|
|
@@ -8,11 +8,11 @@ async function simulateChange(element, value) {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
const expectToBeVisible = offer => {
|
|
11
|
-
const {
|
|
11
|
+
const { height } = offer.getClientRects()[0];
|
|
12
12
|
expect(height).toBeGreaterThan(30);
|
|
13
13
|
};
|
|
14
14
|
const expectNotToBeVisible = offer => {
|
|
15
|
-
const {
|
|
15
|
+
const { height } = offer.getClientRects()[0];
|
|
16
16
|
expect(height).toBeLessThan(30);
|
|
17
17
|
};
|
|
18
18
|
const waitUpdate = async offer => {
|
|
@@ -76,7 +76,7 @@ describe('Price', () => {
|
|
|
76
76
|
const template = html`
|
|
77
77
|
<og-some-price pay-as-you-go product="yum id"> </og-some-price>
|
|
78
78
|
`;
|
|
79
|
-
|
|
79
|
+
await renderPriceTemplate(template, {
|
|
80
80
|
frequency: '1_3',
|
|
81
81
|
productPlans: {
|
|
82
82
|
'yum id': [
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/* eslint-disable jasmine/no-unsafe-spy */
|
|
2
|
-
/* eslint-disable object-shorthand */
|
|
3
|
-
/* eslint-disable no-underscore-dangle */
|
|
4
1
|
import { connect, createRecalcProps, resolveStore, setStore, unsetStore } from '../connect';
|
|
5
2
|
|
|
6
3
|
describe('connect', () => {
|
|
@@ -73,7 +70,6 @@ describe('connect', () => {
|
|
|
73
70
|
});
|
|
74
71
|
|
|
75
72
|
it('should call mapStateToProps with state and ownProps', () => {
|
|
76
|
-
// eslint-disable-next-line no-shadow
|
|
77
73
|
const getState = jasmine.createSpy('getState').and.returnValue({ the: 'state' });
|
|
78
74
|
const _enqueueUpdate = jasmine.createSpy('_enqueueUpdate');
|
|
79
75
|
setStore({ subscribe, getState, dispatch });
|
|
@@ -36,10 +36,9 @@ describe('serializeState', () => {
|
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
describe('loadState', () => {
|
|
39
|
-
let getItemSpy
|
|
39
|
+
let getItemSpy;
|
|
40
40
|
beforeEach(() => {
|
|
41
41
|
getItemSpy = spyOn(Object.getPrototypeOf(localStorage), 'getItem');
|
|
42
|
-
setItemSpy = spyOn(Object.getPrototypeOf(localStorage), 'setItem');
|
|
43
42
|
});
|
|
44
43
|
|
|
45
44
|
it('should return undefined on empty state', () => {
|
|
@@ -169,7 +169,7 @@ describe('middleware', () => {
|
|
|
169
169
|
});
|
|
170
170
|
|
|
171
171
|
describe('localStorageMiddleware', () => {
|
|
172
|
-
let
|
|
172
|
+
let setItemSpy;
|
|
173
173
|
beforeEach(() => {
|
|
174
174
|
// getItemSpy = spyOn(Object.getPrototypeOf(localStorage), 'getItem');
|
|
175
175
|
setItemSpy = spyOn(Object.getPrototypeOf(localStorage), 'setItem');
|
|
@@ -264,7 +264,7 @@ export const setPreviewPrepaid = (isPreview, productId, offer) =>
|
|
|
264
264
|
};
|
|
265
265
|
|
|
266
266
|
export const setPreview = (value, oldValue, offer) =>
|
|
267
|
-
async function(dispatch,
|
|
267
|
+
async function(dispatch, _getState) {
|
|
268
268
|
await dispatch({ type: constants.LOCAL_STORAGE_CLEAR });
|
|
269
269
|
await dispatch({
|
|
270
270
|
type: constants.SET_PREVIEW_STANDARD_OFFER,
|
package/src/core/actions.js
CHANGED
|
@@ -89,7 +89,6 @@ export const fetchAuth = (authResolver = resolveAuth) =>
|
|
|
89
89
|
|
|
90
90
|
return authResolver(authUrl)
|
|
91
91
|
.then(
|
|
92
|
-
// eslint-disable-next-line camelcase
|
|
93
92
|
({ sig_field, ts, sig }) => dispatch(authorize(merchantId, sig_field, ts, sig)),
|
|
94
93
|
err => dispatch(unauthorized(err))
|
|
95
94
|
)
|
|
@@ -130,7 +129,6 @@ export const fetchOrders = (status = 1, ordering = 'place') =>
|
|
|
130
129
|
return api
|
|
131
130
|
.fetchOrders(legoUrl, auth, status, ordering)
|
|
132
131
|
.then(
|
|
133
|
-
// eslint-disable-next-line camelcase
|
|
134
132
|
response => {
|
|
135
133
|
if (response.results) {
|
|
136
134
|
dispatch(receiveOrders(response));
|
package/src/core/adapters.js
CHANGED
package/src/core/api.js
CHANGED
package/src/core/connect.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
/* eslint-disable no-underscore-dangle */
|
|
2
1
|
import { bindActionCreators } from 'redux';
|
|
3
2
|
|
|
4
3
|
let storeInstance = null;
|
|
5
4
|
|
|
6
5
|
const defaultMapDispatchToProps = dispatch => ({ dispatch });
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
export const resolveStore = obj => {
|
|
7
|
+
export const resolveStore = _obj => {
|
|
10
8
|
if (!storeInstance) throw new Error('Missing redux store.');
|
|
11
9
|
return storeInstance;
|
|
12
10
|
};
|
package/src/core/middleware.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
/* eslint-disable no-fallthrough */
|
|
2
1
|
import { throttle } from 'throttle-debounce';
|
|
3
2
|
import * as constants from './constants';
|
|
4
|
-
import { isSameProduct, kebabCase } from './selectors';
|
|
5
3
|
import { saveState } from './localStorage';
|
|
6
4
|
|
|
7
5
|
export const dispatchEvent = (name, detail, el = document) =>
|
|
@@ -61,9 +59,9 @@ export const dispatchMiddleware = store => next => action => {
|
|
|
61
59
|
* @param {*} store
|
|
62
60
|
* @returns
|
|
63
61
|
*/
|
|
64
|
-
export const offerEvents =
|
|
62
|
+
export const offerEvents = _store => next => action => {
|
|
65
63
|
let ev;
|
|
66
|
-
|
|
64
|
+
/* eslint-disable no-fallthrough */
|
|
67
65
|
switch (action.type) {
|
|
68
66
|
// event: og-receive-offer
|
|
69
67
|
case constants.RECEIVE_OFFER:
|
package/src/core/reducer.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-case-declarations */
|
|
2
1
|
import { combineReducers } from 'redux';
|
|
3
2
|
import * as constants from './constants';
|
|
4
3
|
import { isSameProduct } from './selectors';
|
|
@@ -22,7 +21,7 @@ export const optedin = (state = [], action) => {
|
|
|
22
21
|
frequency: action.payload.frequency
|
|
23
22
|
});
|
|
24
23
|
}
|
|
25
|
-
case constants.PRODUCT_CHANGE_PREPAID_SHIPMENTS:
|
|
24
|
+
case constants.PRODUCT_CHANGE_PREPAID_SHIPMENTS: {
|
|
26
25
|
const { payload } = action;
|
|
27
26
|
const [{ prepaidShipments, ...oldone }, rest] = getMatchingProductIfExists(state, payload.product);
|
|
28
27
|
const newState = {
|
|
@@ -33,6 +32,7 @@ export const optedin = (state = [], action) => {
|
|
|
33
32
|
newState.prepaidShipments = payload.prepaidShipments;
|
|
34
33
|
}
|
|
35
34
|
return rest.concat(newState);
|
|
35
|
+
}
|
|
36
36
|
case constants.OPTOUT_PRODUCT:
|
|
37
37
|
return state.filter(a => !isSameProduct(action.payload.product, a));
|
|
38
38
|
case constants.PRODUCT_HAS_CHANGED:
|
|
@@ -57,13 +57,14 @@ export const optedout = (state = [], action) => {
|
|
|
57
57
|
case constants.OPTIN_PRODUCT:
|
|
58
58
|
case constants.PRODUCT_CHANGE_FREQUENCY:
|
|
59
59
|
return state.filter(a => !isSameProduct(action.payload.product, a));
|
|
60
|
-
case constants.OPTOUT_PRODUCT:
|
|
60
|
+
case constants.OPTOUT_PRODUCT: {
|
|
61
61
|
const [oldone, rest] = getMatchingProductIfExists(state, action.payload.product);
|
|
62
62
|
return rest.concat({
|
|
63
63
|
...oldone,
|
|
64
64
|
...action.payload.product,
|
|
65
65
|
frequency: action.payload.frequency
|
|
66
66
|
});
|
|
67
|
+
}
|
|
67
68
|
case constants.PRODUCT_HAS_CHANGED:
|
|
68
69
|
return state.map(product =>
|
|
69
70
|
isSameProduct(action.payload.product, product) ? { ...product, ...action.payload.newProduct } : product
|
|
@@ -482,9 +483,10 @@ export const prepaidShipmentsSelected = (state = {}, action) => {
|
|
|
482
483
|
// a product changes in the cart we need to sync these changes back with the eComm platform, this operation
|
|
483
484
|
// may result in a new cartId that needs to replace the old product's cartId in order to have the
|
|
484
485
|
// prepaidShipmentsSelected object up-to-date
|
|
485
|
-
case constants.CART_PRODUCT_KEY_HAS_CHANGED:
|
|
486
|
+
case constants.CART_PRODUCT_KEY_HAS_CHANGED: {
|
|
486
487
|
const { [action.payload.oldCartProductKey]: preservedPrepaidShipments, ...stateWithoutOldCartProductKey } = state;
|
|
487
488
|
return { ...stateWithoutOldCartProductKey, [action.payload.newCartProductKey]: preservedPrepaidShipments };
|
|
489
|
+
}
|
|
488
490
|
case constants.PRODUCT_CHANGE_PREPAID_SHIPMENTS:
|
|
489
491
|
if (action.payload.prepaidShipments) {
|
|
490
492
|
return { ...state, [action.payload.product.id]: action.payload.prepaidShipments };
|
package/src/core/selectors.js
CHANGED
|
@@ -16,7 +16,6 @@ function arraysEqual(a, b) {
|
|
|
16
16
|
// Please note that calling sort on an array will modify that array.
|
|
17
17
|
// you might want to clone your array first.
|
|
18
18
|
|
|
19
|
-
// eslint-disable-next-line no-plusplus
|
|
20
19
|
for (let i = 0; i < a.length; ++i) {
|
|
21
20
|
if (a[i] !== b[i]) return false;
|
|
22
21
|
}
|
package/src/core/store.js
CHANGED
|
@@ -11,10 +11,8 @@ export function makeStore(reducer, ...extraMiddlewares) {
|
|
|
11
11
|
const isPreviewMode = window.og && window.og.previewMode;
|
|
12
12
|
|
|
13
13
|
const composeEnhancers =
|
|
14
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
15
14
|
typeof window === 'object' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
|
16
|
-
?
|
|
17
|
-
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
|
|
15
|
+
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
|
|
18
16
|
name: 'Ordergroove Offers'
|
|
19
17
|
})
|
|
20
18
|
: compose;
|
package/src/make-api.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { offersLiveEditor } from '@ordergroove/offers-live-editor';
|
|
2
2
|
import { setStore } from './core/connect';
|
|
3
|
-
import { listenLocalStorageChanges } from './core/localStorage';
|
|
4
3
|
import * as adapters from './core/adapters';
|
|
5
4
|
import * as actions from './core/actions';
|
|
6
5
|
import { ConnectedWhen } from './components/When';
|
|
@@ -27,8 +26,8 @@ import { ConnectedPrepaidSelect } from './components/PrepaidSelect';
|
|
|
27
26
|
import { ConnectedSubscriptionButton } from './components/SubscriptionButton';
|
|
28
27
|
import * as testMode from './test-mode';
|
|
29
28
|
import { api } from './core/api';
|
|
30
|
-
import { environment
|
|
31
|
-
import { DEFAULT_OFFER_MODULE, RECEIVE_PRODUCT_PLANS
|
|
29
|
+
import { environment } from './core/reducer';
|
|
30
|
+
import { DEFAULT_OFFER_MODULE, RECEIVE_PRODUCT_PLANS } from './core/constants';
|
|
32
31
|
import ConnectedPrice from './components/Price';
|
|
33
32
|
import { safeProductId } from './core/utils';
|
|
34
33
|
|
|
@@ -131,7 +130,7 @@ export default function makeApi(store) {
|
|
|
131
130
|
return this;
|
|
132
131
|
},
|
|
133
132
|
|
|
134
|
-
setPublicPath(
|
|
133
|
+
setPublicPath(_publicPath) {
|
|
135
134
|
return this;
|
|
136
135
|
},
|
|
137
136
|
|
package/src/run-tests.js
CHANGED
|
@@ -152,7 +152,7 @@ describe('synchronizeCartOptin', () => {
|
|
|
152
152
|
|
|
153
153
|
it('should dispatch cart updated event', async () => {
|
|
154
154
|
let called;
|
|
155
|
-
document.addEventListener(CART_UPDATED_EVENT,
|
|
155
|
+
document.addEventListener(CART_UPDATED_EVENT, () => {
|
|
156
156
|
called = true;
|
|
157
157
|
});
|
|
158
158
|
|
|
@@ -17,7 +17,7 @@ export const getPrepaidShipmentsNumberFromOptions = options => {
|
|
|
17
17
|
|
|
18
18
|
export const getAllocationFrequency = (allocation: ShopifySellingPlanAllocationsEntity) => {
|
|
19
19
|
// now frequency every_period will match with selling_plan_id so no need to convert it
|
|
20
|
-
return (allocation.selling_plan_id || allocation.selling_plan?.id).toString();
|
|
20
|
+
return (allocation.selling_plan_id || (allocation.selling_plan?.id ?? '')).toString();
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
export const getAllocationRegularPrice = (allocation: ShopifySellingPlanAllocationsEntity) => {
|
|
@@ -7,7 +7,7 @@ const SHOPIFY_OG_AUTH_END = 'og_auth_end';
|
|
|
7
7
|
|
|
8
8
|
type ShopifyOGAuth = {
|
|
9
9
|
customerId: string;
|
|
10
|
-
timestamp:
|
|
10
|
+
timestamp: number;
|
|
11
11
|
signature: string;
|
|
12
12
|
};
|
|
13
13
|
|
|
@@ -45,7 +45,7 @@ declare global {
|
|
|
45
45
|
previewMode: boolean;
|
|
46
46
|
};
|
|
47
47
|
ogShopifyConfig: OgShopifyConfig;
|
|
48
|
-
Shopify: { routes?: { root:
|
|
48
|
+
Shopify: { routes?: { root: string } };
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -71,7 +71,7 @@ async function setupPdp(store, offer) {
|
|
|
71
71
|
if (form) {
|
|
72
72
|
// since syncProductId is debounced not matter which comes first mutation or onchange
|
|
73
73
|
const syncProductId = makeSyncProductId(offer);
|
|
74
|
-
form.addEventListener('change',
|
|
74
|
+
form.addEventListener('change', () => syncProductId(form));
|
|
75
75
|
const mo = new MutationObserver(() => syncProductId(form));
|
|
76
76
|
mo.observe(form, { subtree: true, childList: true });
|
|
77
77
|
} else {
|
|
@@ -85,7 +85,7 @@ const getCart = async () => await (await fetch(CART_JS_URL)).json();
|
|
|
85
85
|
* Attemps to guess the product handle o
|
|
86
86
|
* @returns
|
|
87
87
|
*/
|
|
88
|
-
export function guessProductHandle(offer):
|
|
88
|
+
export function guessProductHandle(offer): string {
|
|
89
89
|
return (
|
|
90
90
|
[
|
|
91
91
|
// Allow specify data-shopify-product-handle attribute offer level so it will work on category qv
|
|
@@ -98,7 +98,7 @@ export function guessProductHandle(offer): String {
|
|
|
98
98
|
(document
|
|
99
99
|
.querySelector('[href$=".oembed"]')
|
|
100
100
|
?.getAttribute('href')
|
|
101
|
-
?.match(/\/([
|
|
101
|
+
?.match(/\/([^/]+)\.oembed$/) || [])[1],
|
|
102
102
|
|
|
103
103
|
() =>
|
|
104
104
|
// Use the open graph og:type==product and og:url to get the product handle
|
|
@@ -106,7 +106,7 @@ export function guessProductHandle(offer): String {
|
|
|
106
106
|
document
|
|
107
107
|
.querySelector('meta[property="og:url"][content]')
|
|
108
108
|
?.getAttribute('content')
|
|
109
|
-
?.match(/\/([
|
|
109
|
+
?.match(/\/([^/]+)$/)) ||
|
|
110
110
|
[])[1],
|
|
111
111
|
|
|
112
112
|
() =>
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-case-declarations */
|
|
2
1
|
import { combineReducers } from 'redux';
|
|
3
2
|
import * as constants from '../core/constants';
|
|
4
3
|
|
|
@@ -262,7 +261,7 @@ export const config = (
|
|
|
262
261
|
|
|
263
262
|
if (constants.SETUP_PRODUCT === action.type) {
|
|
264
263
|
const {
|
|
265
|
-
payload: {
|
|
264
|
+
payload: { product }
|
|
266
265
|
} = action;
|
|
267
266
|
let configToAdd = {};
|
|
268
267
|
// pay as you go selling plans
|
|
@@ -349,7 +348,7 @@ export const inStock = (state = {}, action) => {
|
|
|
349
348
|
const {
|
|
350
349
|
payload: { product }
|
|
351
350
|
} = action;
|
|
352
|
-
return [product, ...product?.variants]?.reduce(productOrVariantInStockReducer, state) || state;
|
|
351
|
+
return [product, ...(product?.variants ?? [])]?.reduce(productOrVariantInStockReducer, state) || state;
|
|
353
352
|
}
|
|
354
353
|
// force offer to refresh when requesting a new one
|
|
355
354
|
if (constants.REQUEST_OFFER === action.type && action.payload.product === null) {
|
|
@@ -358,7 +357,7 @@ export const inStock = (state = {}, action) => {
|
|
|
358
357
|
return state;
|
|
359
358
|
};
|
|
360
359
|
|
|
361
|
-
export const offer = (state = {},
|
|
360
|
+
export const offer = (state = {}, _action) => state;
|
|
362
361
|
|
|
363
362
|
function getFrequencyForPrepaidShipments({ prepaidShipments, offer: offerEl, product }) {
|
|
364
363
|
if (prepaidShipments) {
|
|
@@ -436,7 +435,7 @@ export const optedin = (state = [], action) => {
|
|
|
436
435
|
return coreOptedin(state, action);
|
|
437
436
|
};
|
|
438
437
|
|
|
439
|
-
export const productOffer = (state = {},
|
|
438
|
+
export const productOffer = (state = {}, _action) => state;
|
|
440
439
|
|
|
441
440
|
export const productPlans = (state = {}, action) => {
|
|
442
441
|
if (constants.SETUP_PRODUCT === action.type) {
|
|
@@ -448,7 +447,7 @@ export const productPlans = (state = {}, action) => {
|
|
|
448
447
|
|
|
449
448
|
return (
|
|
450
449
|
// We consider the product here as well for cases where we don't have any variants
|
|
451
|
-
[product, ...product?.variants]?.reduce(
|
|
450
|
+
[product, ...(product?.variants ?? [])]?.reduce(
|
|
452
451
|
(acc, cur) => ({
|
|
453
452
|
...acc,
|
|
454
453
|
[cur.id]: cur.selling_plan_allocations?.reduce(
|
|
@@ -49,7 +49,6 @@ export function addDefaultToSubTracking(action, store) {
|
|
|
49
49
|
const value = [productId, OPTIN_PRODUCT.toLowerCase(), location, frequency, variation];
|
|
50
50
|
const inputValue = value.join(',');
|
|
51
51
|
updateTrackingInputs(productId, key, inputValue);
|
|
52
|
-
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
export default function shopifyTrackingMiddleware(store) {
|
|
@@ -59,7 +58,7 @@ export default function shopifyTrackingMiddleware(store) {
|
|
|
59
58
|
switch (action.type) {
|
|
60
59
|
case OPTIN_PRODUCT:
|
|
61
60
|
case OPTOUT_PRODUCT:
|
|
62
|
-
case PRODUCT_CHANGE_FREQUENCY:
|
|
61
|
+
case PRODUCT_CHANGE_FREQUENCY: {
|
|
63
62
|
const offerElement = action.payload.offer;
|
|
64
63
|
const trackingEvent = getTrackingEvent(action);
|
|
65
64
|
|
|
@@ -67,6 +66,7 @@ export default function shopifyTrackingMiddleware(store) {
|
|
|
67
66
|
updateTrackingInputs(offerElement.product.id, trackingEvent[0], trackingEvent[1]);
|
|
68
67
|
}
|
|
69
68
|
break;
|
|
69
|
+
}
|
|
70
70
|
case RECEIVE_OFFER:
|
|
71
71
|
addDefaultToSubTracking(action, store);
|
|
72
72
|
break;
|