@ordergroove/offers 2.35.4 → 2.35.5
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 +11 -0
- package/dist/bundle-report.html +8 -8
- package/dist/offers.js +27 -27
- package/dist/offers.js.map +3 -3
- package/package.json +2 -2
- package/src/core/actions-preview.js +5 -5
- package/src/core/reducer.js +3 -3
- package/src/shopify/shopifyReducer.js +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ordergroove/offers",
|
|
3
|
-
"version": "2.35.
|
|
3
|
+
"version": "2.35.5",
|
|
4
4
|
"description": "offer state component",
|
|
5
5
|
"author": "Eugenio Lattanzio <eugenio63@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/ordergroove/plush-toys#readme",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"@ordergroove/offers-templates": "^0.9.4",
|
|
49
49
|
"@types/lodash.memoize": "^4.1.9"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "5432b8ebde1143e902d6fd8e2d5b8fed549f0a1d"
|
|
52
52
|
}
|
|
@@ -6,7 +6,7 @@ export const setPreviewStandardOffer = (isPreview, productId, offer) =>
|
|
|
6
6
|
async function setPreviewStandardOfferThunk(dispatch) {
|
|
7
7
|
await dispatch({
|
|
8
8
|
type: constants.SET_PREVIEW_STANDARD_OFFER,
|
|
9
|
-
payload: isPreview
|
|
9
|
+
payload: { isPreview, productId }
|
|
10
10
|
});
|
|
11
11
|
await dispatch({
|
|
12
12
|
type: constants.UNAUTHORIZED
|
|
@@ -78,7 +78,7 @@ export const mergeProductPlansToState = (state, newProductPlans) => {
|
|
|
78
78
|
|
|
79
79
|
export const setPreviewUpsellOffer = (isPreview, productId, offer) =>
|
|
80
80
|
async function setPreviewUpsellOfferThunk(dispatch, getState) {
|
|
81
|
-
await dispatch({ type: constants.SET_PREVIEW_UPSELL_OFFER, payload: isPreview });
|
|
81
|
+
await dispatch({ type: constants.SET_PREVIEW_UPSELL_OFFER, payload: { isPreview, productId } });
|
|
82
82
|
|
|
83
83
|
const { merchantId } = getState();
|
|
84
84
|
if (isPreview) {
|
|
@@ -142,7 +142,7 @@ export const setPreviewPrepaid = (isPreview, productId, offer) =>
|
|
|
142
142
|
|
|
143
143
|
await dispatch({
|
|
144
144
|
type: constants.SET_PREVIEW_PREPAID_OFFER,
|
|
145
|
-
payload: isPreview
|
|
145
|
+
payload: { isPreview, productId }
|
|
146
146
|
});
|
|
147
147
|
await dispatch({
|
|
148
148
|
type: constants.UNAUTHORIZED
|
|
@@ -268,11 +268,11 @@ export const setPreview = (value, oldValue, offer) =>
|
|
|
268
268
|
await dispatch({ type: constants.LOCAL_STORAGE_CLEAR });
|
|
269
269
|
await dispatch({
|
|
270
270
|
type: constants.SET_PREVIEW_STANDARD_OFFER,
|
|
271
|
-
payload: false
|
|
271
|
+
payload: { isPreview: false, productId: offer.product.id }
|
|
272
272
|
});
|
|
273
273
|
await dispatch({
|
|
274
274
|
type: constants.SET_PREVIEW_UPSELL_OFFER,
|
|
275
|
-
payload: false
|
|
275
|
+
payload: { isPreview: false, productId: offer.product.id }
|
|
276
276
|
});
|
|
277
277
|
|
|
278
278
|
switch (value) {
|
package/src/core/reducer.js
CHANGED
|
@@ -408,7 +408,7 @@ export const config = (
|
|
|
408
408
|
export const previewStandardOffer = (state = false, action) => {
|
|
409
409
|
switch (action.type) {
|
|
410
410
|
case constants.SET_PREVIEW_STANDARD_OFFER:
|
|
411
|
-
return action.payload;
|
|
411
|
+
return action.payload.isPreview;
|
|
412
412
|
default:
|
|
413
413
|
return state;
|
|
414
414
|
}
|
|
@@ -417,7 +417,7 @@ export const previewStandardOffer = (state = false, action) => {
|
|
|
417
417
|
export const previewUpsellOffer = (state = false, action) => {
|
|
418
418
|
switch (action.type) {
|
|
419
419
|
case constants.SET_PREVIEW_UPSELL_OFFER:
|
|
420
|
-
return action.payload;
|
|
420
|
+
return action.payload.isPreview;
|
|
421
421
|
default:
|
|
422
422
|
return state;
|
|
423
423
|
}
|
|
@@ -426,7 +426,7 @@ export const previewUpsellOffer = (state = false, action) => {
|
|
|
426
426
|
export const previewPrepaidOffer = (state = false, action) => {
|
|
427
427
|
switch (action.type) {
|
|
428
428
|
case constants.SET_PREVIEW_PREPAID_OFFER:
|
|
429
|
-
return action.payload;
|
|
429
|
+
return action.payload.isPreview;
|
|
430
430
|
default:
|
|
431
431
|
return state;
|
|
432
432
|
}
|
|
@@ -190,6 +190,10 @@ export const autoshipEligible = (state = {}, action) => {
|
|
|
190
190
|
};
|
|
191
191
|
}, state);
|
|
192
192
|
}
|
|
193
|
+
if (constants.SET_PREVIEW_STANDARD_OFFER === action.type) {
|
|
194
|
+
if (action.payload.isPreview !== true) return state;
|
|
195
|
+
return { ...state, ...{ [action.payload.productId]: true } };
|
|
196
|
+
}
|
|
193
197
|
return state;
|
|
194
198
|
};
|
|
195
199
|
|
|
@@ -348,6 +352,10 @@ export const inStock = (state = {}, action) => {
|
|
|
348
352
|
if (constants.REQUEST_OFFER === action.type && action.payload.product === null) {
|
|
349
353
|
return { ...state };
|
|
350
354
|
}
|
|
355
|
+
if (constants.SET_PREVIEW_STANDARD_OFFER === action.type) {
|
|
356
|
+
if (action.payload.isPreview !== true) return state;
|
|
357
|
+
return { ...state, ...{ [action.payload.productId]: true } };
|
|
358
|
+
}
|
|
351
359
|
return state;
|
|
352
360
|
};
|
|
353
361
|
|