@ordergroove/offers 2.27.0 → 2.27.1-alpha-PR-634-2.3

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.27.0",
3
+ "version": "2.27.1-alpha-PR-634-2.3+7bfb95ce",
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.12"
47
47
  },
48
- "gitHead": "5494ac90e797dee202a99a40a81a191061a1d042"
48
+ "gitHead": "7bfb95ceb96963ad4571a61c81e0392782ce6f69"
49
49
  }
@@ -20,9 +20,8 @@ export class Price extends withProduct(TemplateElement) {
20
20
  get value() {
21
21
  // when product is in cart, we use item.key for shopify that is composed as <variant_id>:<line_hash>
22
22
  // this code omits the <line_hash>. We dont support colon : in product_id so this hack wont affect other platforms
23
-
24
23
  const realProductId = this.product.id?.split(':')[0];
25
- const frequency = this.frequency || this.offer?.defaultFrequency;
24
+ const frequency = this.frequency || this.configDefaultFrequency || this.offer?.defaultFrequency;
26
25
  const plans = this.productPlans[realProductId] || {};
27
26
  const currentPlan = plans[frequency] || [];
28
27
  if (!currentPlan) return '';
@@ -52,7 +51,8 @@ export class Price extends withProduct(TemplateElement) {
52
51
  }
53
52
  const mapStateToProps = (state, ownProps) => ({
54
53
  productPlans: state.productPlans,
55
- frequency: ownProps.offer?.frequency || makeProductFrequencySelector(ownProps.product)(state)
54
+ configDefaultFrequency: state.config?.defaultFrequency,
55
+ frequency: makeProductFrequencySelector(ownProps.product)(state)
56
56
  });
57
57
 
58
58
  export default connect(mapStateToProps)(Price);