@ordergroove/offers 2.28.7 → 2.28.9
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 +23 -0
- package/README.md +117 -122
- package/dist/bundle-report.html +8 -8
- package/dist/examples.js +24 -12
- package/dist/examples.js.map +1 -1
- package/dist/offers.js +33 -28
- package/dist/offers.js.map +2 -2
- package/examples/index.html +2 -0
- package/package.json +3 -3
- package/src/components/OptinButton.js +9 -2
- package/src/components/OptinStatus.js +10 -3
- package/src/components/OptinToggle.js +2 -2
package/examples/index.html
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ordergroove/offers",
|
|
3
|
-
"version": "2.28.
|
|
3
|
+
"version": "2.28.9",
|
|
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,7 @@
|
|
|
45
45
|
"throttle-debounce": "^2.1.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@ordergroove/offers-templates": "^0.4.
|
|
48
|
+
"@ordergroove/offers-templates": "^0.4.20"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "e6ea1ceb9b29e0b63acba4380870c222997baf2b"
|
|
51
51
|
}
|
|
@@ -18,7 +18,12 @@ export class OptinButton extends OptinStatus {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
updated(changed) {
|
|
21
|
-
if (changed.has('subscribed')) {
|
|
21
|
+
if (changed.has('subscribed') || changed.has('frequencies')) {
|
|
22
|
+
if (platform.shopify_selling_plans && this.store) {
|
|
23
|
+
let buttonFreq = this.getAttribute('default-frequency');
|
|
24
|
+
buttonFreq = frequencyToSellingPlan(buttonFreq, this.store.getState().config);
|
|
25
|
+
this.sellingPlanFreq = buttonFreq;
|
|
26
|
+
}
|
|
22
27
|
this.frequencyMatch = this.frequency === this.optinFrequency;
|
|
23
28
|
}
|
|
24
29
|
}
|
|
@@ -27,7 +32,9 @@ export class OptinButton extends OptinStatus {
|
|
|
27
32
|
let freq;
|
|
28
33
|
|
|
29
34
|
// use the attribute since this.defaultFrequency comes from mapStateToProps and contains more logic
|
|
30
|
-
if (this.
|
|
35
|
+
if (this.sellingPlanFreq) {
|
|
36
|
+
freq = this.sellingPlanFreq;
|
|
37
|
+
} else if (this.hasAttribute('default-frequency')) {
|
|
31
38
|
freq = this.getAttribute('default-frequency');
|
|
32
39
|
} else {
|
|
33
40
|
freq = this.offer ? this.offer.defaultFrequency : this.defaultFrequency;
|
|
@@ -17,7 +17,8 @@ export class OptinStatus extends withProduct(TemplateElement) {
|
|
|
17
17
|
subscribed,
|
|
18
18
|
frequencyMatch: { type: Boolean, reflect: true, attribute: 'frequency-match' },
|
|
19
19
|
productDefaultFrequency: { type: String },
|
|
20
|
-
defaultFrequency: { type: String }
|
|
20
|
+
defaultFrequency: { type: String },
|
|
21
|
+
frequencies: { type: Array }
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -53,6 +54,12 @@ export class OptinStatus extends withProduct(TemplateElement) {
|
|
|
53
54
|
.checkbox {
|
|
54
55
|
border-radius: 3px;
|
|
55
56
|
}
|
|
57
|
+
|
|
58
|
+
.radio,
|
|
59
|
+
.checkbox {
|
|
60
|
+
border-color: var(--og-checkbox-border-color, black);
|
|
61
|
+
}
|
|
62
|
+
|
|
56
63
|
.checkbox.active::after,
|
|
57
64
|
.radio.active::after {
|
|
58
65
|
position: absolute;
|
|
@@ -61,12 +68,12 @@ export class OptinStatus extends withProduct(TemplateElement) {
|
|
|
61
68
|
width: 100%;
|
|
62
69
|
height: 100%;
|
|
63
70
|
box-sizing: border-box;
|
|
71
|
+
background: var(--og-checkbox-border-color, black);
|
|
64
72
|
}
|
|
65
73
|
|
|
66
74
|
.radio.active::after {
|
|
67
75
|
content: ' ';
|
|
68
76
|
border-radius: 100%;
|
|
69
|
-
background: var(--og-primary-color, var(--og-radio-background-color, black));
|
|
70
77
|
border: 2px solid #fff;
|
|
71
78
|
}
|
|
72
79
|
|
|
@@ -75,7 +82,6 @@ export class OptinStatus extends withProduct(TemplateElement) {
|
|
|
75
82
|
border-radius: 0;
|
|
76
83
|
background: #fff;
|
|
77
84
|
content: '\\2714';
|
|
78
|
-
color: var(--og-primary-color, var(--og-checkbox-color, black));
|
|
79
85
|
line-height: 1;
|
|
80
86
|
text-align: center;
|
|
81
87
|
overflow: visible;
|
|
@@ -126,6 +132,7 @@ export const mapStateToProps = (state, ownProps = {}) => ({
|
|
|
126
132
|
frequency: makeProductFrequencySelector(ownProps.product)(state),
|
|
127
133
|
productDefaultFrequency: makeProductDefaultFrequencySelector((ownProps.product || {}).id)(state),
|
|
128
134
|
...configSelector(state, ownProps, 'defaultFrequency'),
|
|
135
|
+
...configSelector(state, ownProps, 'frequencies'),
|
|
129
136
|
...templatesSelector(state, ownProps)
|
|
130
137
|
});
|
|
131
138
|
|
|
@@ -25,7 +25,7 @@ export class OptinToggle extends OptinStatus {
|
|
|
25
25
|
height: var(--og-radio-height, 1.4em);
|
|
26
26
|
margin: var(--og-radio-margin, 0);
|
|
27
27
|
padding: 0;
|
|
28
|
-
border: 1px solid var(--og-
|
|
28
|
+
border: 1px solid var(--og-checkbox-border-color, black);
|
|
29
29
|
background: #fff;
|
|
30
30
|
vertical-align: middle;
|
|
31
31
|
color: var(--og-primary-color, black);
|
|
@@ -36,7 +36,7 @@ export class OptinToggle extends OptinStatus {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
.btn.active {
|
|
39
|
-
background:
|
|
39
|
+
background: var(--og-checkbox-border-color, black);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
.btn.active:after {
|