@ordergroove/offers 2.34.3-alpha-PR-779-4.16 → 2.34.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/CHANGELOG.md +11 -0
- package/dist/bundle-report.html +36 -36
- package/dist/examples.js +35 -35
- package/dist/examples.js.map +2 -2
- package/dist/offers.js +64 -56
- package/dist/offers.js.map +3 -3
- package/package.json +2 -2
- package/src/components/OptinButton.js +1 -6
- package/src/components/OptoutButton.js +1 -6
- package/src/components/Price.js +23 -1
- package/src/components/__tests__/OptinButton.spec.js +0 -16
- package/src/components/__tests__/OptoutButton.spec.js +0 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ordergroove/offers",
|
|
3
|
-
"version": "2.34.3
|
|
3
|
+
"version": "2.34.3",
|
|
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.9.1"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "d3e7deebb63e8f607ca07d7a0f1d298439c81449"
|
|
51
51
|
}
|
|
@@ -54,12 +54,7 @@ export class OptinButton extends OptinStatus {
|
|
|
54
54
|
render() {
|
|
55
55
|
return html`
|
|
56
56
|
<slot name="default">
|
|
57
|
-
<button
|
|
58
|
-
aria-labelledby="ogOfferOptInLabel"
|
|
59
|
-
role="radio"
|
|
60
|
-
aria-checked="${!!this.subscribed}"
|
|
61
|
-
class="btn radio ${this.subscribed ? 'active' : ''}"
|
|
62
|
-
></button>
|
|
57
|
+
<button aria-labelledby="ogOfferOptInLabel" class="btn radio ${this.subscribed ? 'active' : ''}"></button>
|
|
63
58
|
<label id="ogOfferOptInLabel">
|
|
64
59
|
<slot>
|
|
65
60
|
<slot name="label"><og-text key="offerOptInLabel"></og-text></slot>
|
|
@@ -19,12 +19,7 @@ export class OptoutButton extends OptinStatus {
|
|
|
19
19
|
render() {
|
|
20
20
|
return html`
|
|
21
21
|
<slot name="default">
|
|
22
|
-
<button
|
|
23
|
-
aria-labelledby="ogOfferOptOutLabel"
|
|
24
|
-
role="radio"
|
|
25
|
-
aria-checked="${!this.subscribed}"
|
|
26
|
-
class="btn radio ${this.subscribed ? '' : 'active'}"
|
|
27
|
-
></button>
|
|
22
|
+
<button aria-labelledby="ogOfferOptOutLabel" class="btn radio ${this.subscribed ? '' : 'active'}"></button>
|
|
28
23
|
<label id="ogOfferOptOutLabel">
|
|
29
24
|
<slot>
|
|
30
25
|
<og-text key="offerOptOutLabel"></og-text>
|
package/src/components/Price.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { html } from 'lit-element';
|
|
1
|
+
import { html, css } from 'lit-element';
|
|
2
2
|
import { connect } from '../core/connect';
|
|
3
3
|
|
|
4
4
|
import { withProduct } from '../core/resolveProperties';
|
|
@@ -19,6 +19,28 @@ export class Price extends withProduct(TemplateElement) {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
static get styles() {
|
|
23
|
+
return css`
|
|
24
|
+
:host::before {
|
|
25
|
+
clip-path: inset(100%);
|
|
26
|
+
clip: rect(1px, 1px, 1px, 1px);
|
|
27
|
+
height: 1px;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
position: absolute;
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
width: 1px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host([subscription])::before {
|
|
35
|
+
content: 'Discounted subscription price';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:host([regular])::before {
|
|
39
|
+
content: 'Regular price';
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
}
|
|
43
|
+
|
|
22
44
|
get value() {
|
|
23
45
|
const realProductId = safeProductId(this.product);
|
|
24
46
|
const frequency = this.frequency || this.configDefaultFrequency || this.offer?.defaultFrequency;
|
|
@@ -13,22 +13,6 @@ describe('OptinButton', function() {
|
|
|
13
13
|
expect(querySelector(element, 'button.active')).toBeTruthy();
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
it('should be aria-checked if subscribed', async () => {
|
|
17
|
-
const element = new OptinButton();
|
|
18
|
-
element.setAttribute('product', '123');
|
|
19
|
-
element.subscribed = true;
|
|
20
|
-
await appendToBody(element);
|
|
21
|
-
expect(querySelector(element, 'button').getAttribute('aria-checked')).toEqual('true');
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('should not be aria-checked if not subscribed', async () => {
|
|
25
|
-
const element = new OptinButton();
|
|
26
|
-
element.setAttribute('product', '123');
|
|
27
|
-
element.subscribed = false;
|
|
28
|
-
await appendToBody(element);
|
|
29
|
-
expect(querySelector(element, 'button').getAttribute('aria-checked')).toEqual('false');
|
|
30
|
-
});
|
|
31
|
-
|
|
32
16
|
it('should show empty label if not subscribed', async () => {
|
|
33
17
|
const element = new OptinButton();
|
|
34
18
|
element.setAttribute('product', '123');
|
|
@@ -32,20 +32,4 @@ describe('OptoutButton', () => {
|
|
|
32
32
|
await appendToBody(elm);
|
|
33
33
|
expect(querySelector(elm, 'button.active')).toBeTruthy();
|
|
34
34
|
});
|
|
35
|
-
|
|
36
|
-
it('should be aria-checked if subscribed', async () => {
|
|
37
|
-
const element = new OptoutButton();
|
|
38
|
-
element.setAttribute('product', '123');
|
|
39
|
-
element.subscribed = true;
|
|
40
|
-
await appendToBody(element);
|
|
41
|
-
expect(querySelector(element, 'button').getAttribute('aria-checked')).toEqual('false');
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('should not be aria-checked if not subscribed', async () => {
|
|
45
|
-
const element = new OptoutButton();
|
|
46
|
-
element.setAttribute('product', '123');
|
|
47
|
-
element.subscribed = false;
|
|
48
|
-
await appendToBody(element);
|
|
49
|
-
expect(querySelector(element, 'button').getAttribute('aria-checked')).toEqual('true');
|
|
50
|
-
});
|
|
51
35
|
});
|