@ordergroove/offers 2.30.6 → 2.30.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ordergroove/offers",
|
|
3
|
-
"version": "2.30.
|
|
3
|
+
"version": "2.30.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",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@ordergroove/offers-templates": "^0.5.3"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "d49e2b8c8eb28ca878b090fe5342b65d005b48dc"
|
|
51
51
|
}
|
|
@@ -385,6 +385,85 @@ describe('config', () => {
|
|
|
385
385
|
});
|
|
386
386
|
});
|
|
387
387
|
|
|
388
|
+
it('should add prepaidSellingPlans on top of old ones', () => {
|
|
389
|
+
const sellingPlanGroups = [
|
|
390
|
+
{
|
|
391
|
+
name: 'Prepaid-43017264201946',
|
|
392
|
+
selling_plans: [
|
|
393
|
+
{
|
|
394
|
+
id: 2146042072,
|
|
395
|
+
name: 'Delivered every 1 months, prepaid for 3 shipments',
|
|
396
|
+
options: [
|
|
397
|
+
{ name: 'Delivery every', position: 1, value: 'PREPAID-1 months' },
|
|
398
|
+
{ name: 'Shipment amount', position: 2, value: '3 shipments' }
|
|
399
|
+
]
|
|
400
|
+
}
|
|
401
|
+
]
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
name: 'Prepaid-43017264201945',
|
|
405
|
+
selling_plans: [
|
|
406
|
+
{
|
|
407
|
+
id: 2146042073,
|
|
408
|
+
name: 'Delivered every 3 months, prepaid for 5 shipments',
|
|
409
|
+
options: [
|
|
410
|
+
{ name: 'Delivery every', position: 1, value: 'PREPAID-3 months' },
|
|
411
|
+
{ name: 'Shipment amount', position: 2, value: '5 shipments' }
|
|
412
|
+
]
|
|
413
|
+
}
|
|
414
|
+
]
|
|
415
|
+
}
|
|
416
|
+
];
|
|
417
|
+
const actual = config(
|
|
418
|
+
{
|
|
419
|
+
prepaidSellingPlans: {
|
|
420
|
+
'43017264201946': [
|
|
421
|
+
{
|
|
422
|
+
numberShipments: 1,
|
|
423
|
+
sellingPlan: '2146042072'
|
|
424
|
+
}
|
|
425
|
+
],
|
|
426
|
+
'43017264201944': [
|
|
427
|
+
{
|
|
428
|
+
numberShipments: 4,
|
|
429
|
+
sellingPlan: '2146042071'
|
|
430
|
+
}
|
|
431
|
+
]
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
type: constants.SETUP_PRODUCT,
|
|
436
|
+
payload: {
|
|
437
|
+
product: {
|
|
438
|
+
selling_plan_groups: sellingPlanGroups
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
);
|
|
443
|
+
expect(actual).toEqual({
|
|
444
|
+
prepaidSellingPlans: {
|
|
445
|
+
'43017264201944': [
|
|
446
|
+
{
|
|
447
|
+
numberShipments: 4,
|
|
448
|
+
sellingPlan: '2146042071'
|
|
449
|
+
}
|
|
450
|
+
],
|
|
451
|
+
'43017264201946': [
|
|
452
|
+
{
|
|
453
|
+
numberShipments: 3,
|
|
454
|
+
sellingPlan: '2146042072'
|
|
455
|
+
}
|
|
456
|
+
],
|
|
457
|
+
'43017264201945': [
|
|
458
|
+
{
|
|
459
|
+
numberShipments: 5,
|
|
460
|
+
sellingPlan: '2146042073'
|
|
461
|
+
}
|
|
462
|
+
]
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
});
|
|
466
|
+
|
|
388
467
|
it('should return unmodified state given unsupported action', () => {
|
|
389
468
|
const actual = config(
|
|
390
469
|
{ 'yum existing key': 'yum existing value' },
|
|
@@ -266,7 +266,7 @@ export const config = (
|
|
|
266
266
|
if (prepaidSellingPlanGroups.length) {
|
|
267
267
|
configToAdd = {
|
|
268
268
|
...configToAdd,
|
|
269
|
-
prepaidSellingPlans: getPrepaidSellingPlans(prepaidSellingPlanGroups)
|
|
269
|
+
prepaidSellingPlans: { ...state.prepaidSellingPlans, ...getPrepaidSellingPlans(prepaidSellingPlanGroups) }
|
|
270
270
|
};
|
|
271
271
|
}
|
|
272
272
|
return {
|