@ordergroove/offers 2.27.14 → 2.27.15
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 +2 -2
- package/dist/offers.js +1 -1
- package/dist/offers.js.map +2 -2
- package/package.json +2 -2
- package/src/core/actions-preview.js +65 -57
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ordergroove/offers",
|
|
3
|
-
"version": "2.27.
|
|
3
|
+
"version": "2.27.15",
|
|
4
4
|
"description": "offer state component",
|
|
5
5
|
"author": "Eugenio Lattanzio <eugenio63@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/ordergroove/plush-toys#readme",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@ordergroove/offers-templates": "^0.4.15"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "9ec6370c33f9ac82e46d35f1085e759c8b686a67"
|
|
49
49
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { receiveOffer, receiveOrders, authorize, unauthorized, optinProduct, optoutProduct } from './actions';
|
|
2
2
|
import * as constants from './constants';
|
|
3
3
|
|
|
4
|
-
export const setPreviewStandardOffer = (isPreview, productId) =>
|
|
4
|
+
export const setPreviewStandardOffer = (isPreview, productId, offer) =>
|
|
5
5
|
async function setPreviewStandardOfferThunk(dispatch) {
|
|
6
6
|
await dispatch({
|
|
7
7
|
type: constants.SET_PREVIEW_STANDARD_OFFER,
|
|
@@ -11,69 +11,77 @@ export const setPreviewStandardOffer = (isPreview, productId) =>
|
|
|
11
11
|
type: constants.UNAUTHORIZED
|
|
12
12
|
});
|
|
13
13
|
await dispatch(
|
|
14
|
-
receiveOffer(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
'
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
14
|
+
receiveOffer(
|
|
15
|
+
{
|
|
16
|
+
in_stock: { [productId]: true },
|
|
17
|
+
eligibility_groups: { [productId]: ['subscription', 'upsell'] },
|
|
18
|
+
result: 'success',
|
|
19
|
+
autoship: { [productId]: true },
|
|
20
|
+
autoship_by_default: { [productId]: false },
|
|
21
|
+
modifiers: {},
|
|
22
|
+
module_view: { regular: '096135e6650111e9a444bc764e106cf4' },
|
|
23
|
+
incentives_display: {
|
|
24
|
+
'47c01e9aacbe40389b5c7325d79091aa': {
|
|
25
|
+
field: 'sub_total',
|
|
26
|
+
object: 'order',
|
|
27
|
+
type: 'Discount Percent',
|
|
28
|
+
value: 5
|
|
29
|
+
},
|
|
30
|
+
e6534b9d877f41e586c37b7d8abc3a58: {
|
|
31
|
+
field: 'total_price',
|
|
32
|
+
object: 'item',
|
|
33
|
+
type: 'Discount Percent',
|
|
34
|
+
value: 10
|
|
35
|
+
},
|
|
36
|
+
f35e842710b24929922db4a529eecd40: {
|
|
37
|
+
field: 'total_price',
|
|
38
|
+
object: 'item',
|
|
39
|
+
type: 'Discount Percent',
|
|
40
|
+
value: 10
|
|
41
|
+
},
|
|
42
|
+
'5be321d7c17f4e18a757212b9a20bfcc': {
|
|
43
|
+
field: 'total_price',
|
|
44
|
+
object: 'item',
|
|
45
|
+
type: 'Discount Percent',
|
|
46
|
+
value: 1
|
|
47
|
+
}
|
|
39
48
|
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
incentives: {
|
|
50
|
+
[productId]: {
|
|
51
|
+
initial: ['5be321d7c17f4e18a757212b9a20bfcc'],
|
|
52
|
+
ongoing: [
|
|
53
|
+
'e6534b9d877f41e586c37b7d8abc3a58',
|
|
54
|
+
'47c01e9aacbe40389b5c7325d79091aa',
|
|
55
|
+
'f35e842710b24929922db4a529eecd40'
|
|
56
|
+
]
|
|
57
|
+
}
|
|
45
58
|
}
|
|
46
59
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
initial: ['5be321d7c17f4e18a757212b9a20bfcc'],
|
|
50
|
-
ongoing: [
|
|
51
|
-
'e6534b9d877f41e586c37b7d8abc3a58',
|
|
52
|
-
'47c01e9aacbe40389b5c7325d79091aa',
|
|
53
|
-
'f35e842710b24929922db4a529eecd40'
|
|
54
|
-
]
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
})
|
|
60
|
+
offer
|
|
61
|
+
)
|
|
58
62
|
);
|
|
59
63
|
};
|
|
60
64
|
|
|
61
|
-
export const setPreviewUpsellOffer = (isPreview, productId) =>
|
|
65
|
+
export const setPreviewUpsellOffer = (isPreview, productId, offer) =>
|
|
62
66
|
async function setPreviewUpsellOfferThunk(dispatch, getState) {
|
|
63
67
|
await dispatch({ type: constants.SET_PREVIEW_UPSELL_OFFER, payload: isPreview });
|
|
64
68
|
|
|
65
69
|
const { merchantId } = getState();
|
|
66
70
|
if (isPreview) {
|
|
67
71
|
await dispatch(
|
|
68
|
-
receiveOffer(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
receiveOffer(
|
|
73
|
+
{
|
|
74
|
+
in_stock: { [productId]: true },
|
|
75
|
+
module_view: { regular: '096135e6650111e9a444bc764e106cf4' },
|
|
76
|
+
default_frequencies: { [productId]: { every: 1, every_period: 3 } },
|
|
77
|
+
eligibility_groups: { [productId]: ['subscription', 'upsell'] },
|
|
78
|
+
result: 'success',
|
|
79
|
+
autoship: { [productId]: true },
|
|
80
|
+
autoship_by_default: { [productId]: false },
|
|
81
|
+
modifiers: {}
|
|
82
|
+
},
|
|
83
|
+
offer
|
|
84
|
+
)
|
|
77
85
|
);
|
|
78
86
|
await dispatch(
|
|
79
87
|
receiveOrders({
|
|
@@ -114,7 +122,7 @@ export const setPreviewUpsellOffer = (isPreview, productId) =>
|
|
|
114
122
|
}
|
|
115
123
|
};
|
|
116
124
|
|
|
117
|
-
export const setPreview = (value, oldValue,
|
|
125
|
+
export const setPreview = (value, oldValue, offer) =>
|
|
118
126
|
async function(dispatch, getState) {
|
|
119
127
|
await dispatch({ type: constants.LOCAL_STORAGE_CLEAR });
|
|
120
128
|
await dispatch({
|
|
@@ -128,14 +136,14 @@ export const setPreview = (value, oldValue, ownProps) =>
|
|
|
128
136
|
|
|
129
137
|
switch (value) {
|
|
130
138
|
case 'regular':
|
|
131
|
-
dispatch(setPreviewStandardOffer(true,
|
|
139
|
+
dispatch(setPreviewStandardOffer(true, offer.product.id, offer));
|
|
132
140
|
break;
|
|
133
141
|
case 'upsell':
|
|
134
|
-
dispatch(setPreviewUpsellOffer(true,
|
|
142
|
+
dispatch(setPreviewUpsellOffer(true, offer.product.id, offer));
|
|
135
143
|
break;
|
|
136
144
|
case 'subscribed':
|
|
137
|
-
dispatch(setPreviewStandardOffer(true,
|
|
138
|
-
dispatch(optinProduct(
|
|
145
|
+
dispatch(setPreviewStandardOffer(true, offer.product.id, offer));
|
|
146
|
+
dispatch(optinProduct(offer.product, '2_2'));
|
|
139
147
|
break;
|
|
140
148
|
default:
|
|
141
149
|
}
|