@ordergroove/offers 2.30.7 → 2.30.8-alpha-PR-722-3.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ordergroove/offers",
|
|
3
|
-
"version": "2.30.
|
|
3
|
+
"version": "2.30.8-alpha-PR-722-3.1+5fb7e172",
|
|
4
4
|
"description": "offer state component",
|
|
5
5
|
"author": "Eugenio Lattanzio <eugenio63@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/ordergroove/plush-toys#readme",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@ordergroove/offers-templates": "^0.5.3"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "5fb7e172dd43e53cc4532a948d4af268e29747a3"
|
|
51
51
|
}
|
|
@@ -1309,6 +1309,32 @@ describe('optedin', () => {
|
|
|
1309
1309
|
}
|
|
1310
1310
|
]);
|
|
1311
1311
|
});
|
|
1312
|
+
|
|
1313
|
+
it('should not error and not change state if there are no selling plan groups', () => {
|
|
1314
|
+
const actual = optedin(
|
|
1315
|
+
[
|
|
1316
|
+
{
|
|
1317
|
+
id: 'yum product id 1',
|
|
1318
|
+
frequency: '1_3'
|
|
1319
|
+
}
|
|
1320
|
+
],
|
|
1321
|
+
{
|
|
1322
|
+
type: constants.SETUP_PRODUCT,
|
|
1323
|
+
payload: {
|
|
1324
|
+
product: {
|
|
1325
|
+
selling_plan_groups: []
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
);
|
|
1330
|
+
|
|
1331
|
+
expect(actual).toEqual([
|
|
1332
|
+
{
|
|
1333
|
+
id: 'yum product id 1',
|
|
1334
|
+
frequency: '1_3'
|
|
1335
|
+
}
|
|
1336
|
+
]);
|
|
1337
|
+
});
|
|
1312
1338
|
});
|
|
1313
1339
|
|
|
1314
1340
|
describe('given action is PRODUCT_CHANGE_PREPAID_SHIPMENTS', () => {
|
|
@@ -365,6 +365,9 @@ export const optedin = (state = [], action) => {
|
|
|
365
365
|
if (constants.SETUP_PRODUCT === action.type) {
|
|
366
366
|
const { product } = action.payload;
|
|
367
367
|
const sellingPlanGroup = getOGSellingPlanGroup(product);
|
|
368
|
+
if (!sellingPlanGroup) {
|
|
369
|
+
return state;
|
|
370
|
+
}
|
|
368
371
|
const frequencies = sellingPlansToFrequencies(sellingPlanGroup);
|
|
369
372
|
const frequenciesEveryPeriod = sellingPlansToEveryPeriod(sellingPlanGroup);
|
|
370
373
|
|