@ordergroove/offers 2.28.7 → 2.28.8
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 +6 -6
- package/dist/offers.js +22 -22
- package/dist/offers.js.map +2 -2
- package/package.json +2 -2
- package/src/components/OptinButton.js +9 -2
- package/src/components/OptinStatus.js +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ordergroove/offers",
|
|
3
|
-
"version": "2.28.
|
|
3
|
+
"version": "2.28.8",
|
|
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.4.19"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "fa78e5753c7b0bd16ed1201bf8c3ffe5976ccaca"
|
|
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
|
|
|
@@ -126,6 +127,7 @@ export const mapStateToProps = (state, ownProps = {}) => ({
|
|
|
126
127
|
frequency: makeProductFrequencySelector(ownProps.product)(state),
|
|
127
128
|
productDefaultFrequency: makeProductDefaultFrequencySelector((ownProps.product || {}).id)(state),
|
|
128
129
|
...configSelector(state, ownProps, 'defaultFrequency'),
|
|
130
|
+
...configSelector(state, ownProps, 'frequencies'),
|
|
129
131
|
...templatesSelector(state, ownProps)
|
|
130
132
|
});
|
|
131
133
|
|