@ordergroove/offers 2.45.6-alpha-PR-1241-2.6 → 2.46.0

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.45.6-alpha-PR-1241-2.6+370a7cae",
3
+ "version": "2.46.0",
4
4
  "description": "offer state component",
5
5
  "author": "Eugenio Lattanzio <eugenio63@gmail.com>",
6
6
  "homepage": "https://github.com/ordergroove/plush-toys#readme",
@@ -46,8 +46,8 @@
46
46
  "throttle-debounce": "^2.1.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@ordergroove/offers-templates": "^0.9.8",
49
+ "@ordergroove/offers-templates": "^0.10.0",
50
50
  "@types/lodash.memoize": "^4.1.9"
51
51
  },
52
- "gitHead": "370a7cae4b24ebc33219ca374ae22f8eaa51a5f2"
52
+ "gitHead": "29fe0f44f5d9dc13b9c8a150b894b5a99c31cd8d"
53
53
  }
@@ -218,6 +218,7 @@ export class Tooltip extends LitElement {
218
218
  async recalculatePosition() {
219
219
  // wait for state changes to apply
220
220
  await this.updateComplete;
221
+ if (!this.open) return;
221
222
  const trigger = this.shadowRoot.querySelector('.trigger');
222
223
  const triggerRect = trigger.getBoundingClientRect();
223
224
  const content = this.shadowRoot.querySelector('.content');
@@ -39,6 +39,7 @@ describe('Tooltip', () => {
39
39
  });
40
40
  }
41
41
 
42
+ element.open = true;
42
43
  await element.recalculatePosition();
43
44
  Object.keys(expectedStyles).forEach(key => expect(contentDiv.style[key]).toEqual(expectedStyles[key]));
44
45
  };
@@ -97,7 +97,11 @@ describe('experiments', () => {
97
97
  }
98
98
  inputs.forEach(weights =>
99
99
  it(`should roll the dice ${weights}`, () => {
100
- expect(test(weights)).toEqual(weights);
100
+ const results = test(weights);
101
+ results.forEach((result, index) => {
102
+ // since this is random, we give it +-1 margin of error
103
+ expect(Math.abs(result - weights[index])).toBeLessThanOrEqual(1);
104
+ });
101
105
  })
102
106
  );
103
107
  });
package/src/make-api.js CHANGED
@@ -109,6 +109,7 @@ export default function makeApi(store) {
109
109
  delete window.og;
110
110
  } else {
111
111
  window.og.previewMode = true;
112
+ console.log('OG Offers preview mode enabled');
112
113
  }
113
114
  return this;
114
115
  },