@ordergroove/offers 2.34.7 → 2.34.8-alpha-PR-784-4.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/dist/bundle-report.html +12 -12
- package/dist/examples.js.map +2 -2
- package/dist/offers.js +36 -36
- package/dist/offers.js.map +3 -3
- package/examples/index.js +0 -1
- package/package.json +4 -3
- package/src/shopify/__tests__/productPlan.spec.js +13 -13
- package/src/shopify/__tests__/shopifyReducer.spec.js +417 -350
- package/src/shopify/__tests__/utils.spec.js +7 -3
- package/src/shopify/reducers/productPlans.ts +26 -22
- package/src/shopify/shopifyBootstrap.ts +9 -1
- package/src/shopify/shopifyMiddleware.ts +38 -9
- package/src/shopify/shopifyReducer.js +3 -3
- package/src/shopify/types/shopify.ts +133 -0
- package/src/shopify/utils.ts +7 -1
package/examples/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ordergroove/offers",
|
|
3
|
-
"version": "2.34.7",
|
|
3
|
+
"version": "2.34.8-alpha-PR-784-4.7+d4e19d1f",
|
|
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,7 +45,8 @@
|
|
|
45
45
|
"throttle-debounce": "^2.1.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@ordergroove/offers-templates": "^0.9.2"
|
|
48
|
+
"@ordergroove/offers-templates": "^0.9.2",
|
|
49
|
+
"@types/lodash.memoize": "^4.1.9"
|
|
49
50
|
},
|
|
50
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "d4e19d1f1d83426ff60c7264549ab96f5b03c91c"
|
|
51
52
|
}
|
|
@@ -98,7 +98,7 @@ describe('Shopify productPlan Reducer', () => {
|
|
|
98
98
|
const allocation = {
|
|
99
99
|
price: 1350
|
|
100
100
|
};
|
|
101
|
-
expect(getAllocationSubscriptionPrice(allocation)).toBe('$13.50');
|
|
101
|
+
expect(getAllocationSubscriptionPrice(allocation, 'USD')).toBe('$13.50');
|
|
102
102
|
});
|
|
103
103
|
|
|
104
104
|
it('should return per delivery money price for prepaid subscription', () => {
|
|
@@ -119,7 +119,7 @@ describe('Shopify productPlan Reducer', () => {
|
|
|
119
119
|
]
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
|
-
expect(getAllocationSubscriptionPrice(allocation)).toBe('$10.00');
|
|
122
|
+
expect(getAllocationSubscriptionPrice(allocation, 'USD')).toBe('$10.00');
|
|
123
123
|
});
|
|
124
124
|
});
|
|
125
125
|
|
|
@@ -128,14 +128,14 @@ describe('Shopify productPlan Reducer', () => {
|
|
|
128
128
|
const allocation = {
|
|
129
129
|
price_adjustments: [{ position: 1, value: 10, value_type: 'percentage' }]
|
|
130
130
|
};
|
|
131
|
-
expect(getAllocationDiscountRate(allocation)).toBe('10%');
|
|
131
|
+
expect(getAllocationDiscountRate(allocation, 'USD')).toBe('10%');
|
|
132
132
|
});
|
|
133
133
|
|
|
134
134
|
it('should return discount for pay-as-you-go subscription from price adjustment', () => {
|
|
135
135
|
const allocation = {
|
|
136
136
|
price_adjustments: [{ position: 1, value: 1050 }]
|
|
137
137
|
};
|
|
138
|
-
expect(getAllocationDiscountRate(allocation)).toBe('$10.50');
|
|
138
|
+
expect(getAllocationDiscountRate(allocation, 'USD')).toBe('$10.50');
|
|
139
139
|
});
|
|
140
140
|
|
|
141
141
|
it('should return discount for pay-as-you-go subscription from compare_at_price', () => {
|
|
@@ -144,7 +144,7 @@ describe('Shopify productPlan Reducer', () => {
|
|
|
144
144
|
price: 1200,
|
|
145
145
|
price_adjustments: []
|
|
146
146
|
};
|
|
147
|
-
expect(getAllocationDiscountRate(allocation)).toBe('$1.50');
|
|
147
|
+
expect(getAllocationDiscountRate(allocation, 'USD')).toBe('$1.50');
|
|
148
148
|
});
|
|
149
149
|
|
|
150
150
|
it('should return prepaid percentage discount when prepaid options are present - 3 shipments', () => {
|
|
@@ -166,7 +166,7 @@ describe('Shopify productPlan Reducer', () => {
|
|
|
166
166
|
]
|
|
167
167
|
}
|
|
168
168
|
};
|
|
169
|
-
expect(getAllocationDiscountRate(allocation)).toBe('20%');
|
|
169
|
+
expect(getAllocationDiscountRate(allocation, 'USD')).toBe('20%');
|
|
170
170
|
});
|
|
171
171
|
|
|
172
172
|
it('should return prepaid percentage discount when prepaid options are present - 12 shipments', () => {
|
|
@@ -232,7 +232,7 @@ describe('Shopify productPlan Reducer', () => {
|
|
|
232
232
|
prepaidSavingsTotal: '$6.00'
|
|
233
233
|
};
|
|
234
234
|
|
|
235
|
-
const newProductPlan = addPrepaidPriceAndSavings(allocation, productPlan);
|
|
235
|
+
const newProductPlan = addPrepaidPriceAndSavings(allocation, productPlan, null, 'USD');
|
|
236
236
|
|
|
237
237
|
expect(newProductPlan).toEqual(expectedProductPlan);
|
|
238
238
|
});
|
|
@@ -276,7 +276,7 @@ describe('Shopify productPlan Reducer', () => {
|
|
|
276
276
|
prepaidSavingsTotal: '$11.99'
|
|
277
277
|
};
|
|
278
278
|
|
|
279
|
-
const newProductPlan = addPrepaidPriceAndSavings(allocation, productPlan);
|
|
279
|
+
const newProductPlan = addPrepaidPriceAndSavings(allocation, productPlan, null, 'USD');
|
|
280
280
|
|
|
281
281
|
expect(newProductPlan).toEqual(expectedProductPlan);
|
|
282
282
|
});
|
|
@@ -302,11 +302,11 @@ describe('Shopify productPlan Reducer', () => {
|
|
|
302
302
|
frequency: '688412655892',
|
|
303
303
|
regularPrice: '$5.00',
|
|
304
304
|
subscriptionPrice: '$4.50',
|
|
305
|
-
discountRate: '
|
|
305
|
+
discountRate: '$0.50',
|
|
306
306
|
prepaidShipments: null
|
|
307
307
|
};
|
|
308
308
|
|
|
309
|
-
const productPlanCreated = mapSellingPlanToDiscount(allocation);
|
|
309
|
+
const productPlanCreated = mapSellingPlanToDiscount(allocation, [], 'USD');
|
|
310
310
|
|
|
311
311
|
expect(productPlanCreated).toEqual(expectedProductPlan);
|
|
312
312
|
});
|
|
@@ -366,7 +366,7 @@ describe('Shopify productPlan Reducer', () => {
|
|
|
366
366
|
prepaidSavingsTotal: '$12.00'
|
|
367
367
|
};
|
|
368
368
|
|
|
369
|
-
const productPlanCreated = mapSellingPlanToDiscount(allocation, sellingPlans);
|
|
369
|
+
const productPlanCreated = mapSellingPlanToDiscount(allocation, sellingPlans, 'USD');
|
|
370
370
|
|
|
371
371
|
expect(productPlanCreated).toEqual(expectedProductPlan);
|
|
372
372
|
});
|
|
@@ -416,7 +416,7 @@ describe('Shopify productPlan Reducer', () => {
|
|
|
416
416
|
|
|
417
417
|
const expectedsubscriptionPrice = '$15.99';
|
|
418
418
|
|
|
419
|
-
const productPlanCreated = mapSellingPlanToDiscount(allocation, sellingPlans);
|
|
419
|
+
const productPlanCreated = mapSellingPlanToDiscount(allocation, sellingPlans, 'USD');
|
|
420
420
|
|
|
421
421
|
expect(productPlanCreated.subscriptionPrice).toEqual(expectedsubscriptionPrice);
|
|
422
422
|
});
|
|
@@ -500,7 +500,7 @@ describe('Shopify productPlan Reducer', () => {
|
|
|
500
500
|
prepaidExtraSavingsPercentage: '10%'
|
|
501
501
|
};
|
|
502
502
|
|
|
503
|
-
const productPlanCreated = mapSellingPlanToDiscount(allocation, sellingPlans);
|
|
503
|
+
const productPlanCreated = mapSellingPlanToDiscount(allocation, sellingPlans, 'USD');
|
|
504
504
|
|
|
505
505
|
expect(productPlanCreated).toEqual(expectedProductPlan);
|
|
506
506
|
});
|