@ordergroove/offers 2.27.13-alpha-PR-652-3.1 → 2.27.14
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 +22 -0
- package/dist/bundle-report.html +9 -9
- package/dist/examples.js +24 -17
- package/dist/examples.js.map +2 -2
- package/dist/offers.js +2 -1
- package/dist/offers.js.map +2 -2
- package/package.json +3 -3
- package/src/components/OptinStatus.js +1 -0
- package/src/components/SelectFrequency.js +19 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ordergroove/offers",
|
|
3
|
-
"version": "2.27.
|
|
3
|
+
"version": "2.27.14",
|
|
4
4
|
"description": "offer state component",
|
|
5
5
|
"author": "Eugenio Lattanzio <eugenio63@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/ordergroove/plush-toys#readme",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"throttle-debounce": "^2.1.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@ordergroove/offers-templates": "^0.4.
|
|
46
|
+
"@ordergroove/offers-templates": "^0.4.15"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "087e5b417f9d3468b05a89ae4f0a5dd4d10115ca"
|
|
49
49
|
}
|
|
@@ -51,26 +51,26 @@ export class SelectFrequency extends withChildOptions(FrequencyStatus) {
|
|
|
51
51
|
// default frequency comes from redux store first, then default option value, and then finally attribute value.
|
|
52
52
|
get defaultFrequency() {
|
|
53
53
|
const { options, isSelected } = this.childOptions;
|
|
54
|
+
let result;
|
|
54
55
|
|
|
55
|
-
if (isSelected && this.frequencies?.length) {
|
|
56
|
-
const ix = options.findIndex(it => it.value === isSelected) || 0;
|
|
57
|
-
return this.frequencies[ix];
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (this.configDefaultFrequency) {
|
|
61
|
-
return this.configDefaultFrequency;
|
|
62
|
-
}
|
|
63
56
|
if (this.productDefaultFrequency) {
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (
|
|
68
|
-
|
|
57
|
+
result = this.productDefaultFrequency;
|
|
58
|
+
} else if (isSelected) {
|
|
59
|
+
result = isSelected;
|
|
60
|
+
} else if (options.length) {
|
|
61
|
+
result = options[0].value;
|
|
62
|
+
} else {
|
|
63
|
+
result = this._defaultFrequency;
|
|
69
64
|
}
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
// this runs for shopify selling plans translated to freq
|
|
66
|
+
if (this.frequencies?.length && result && this.config?.frequenciesEveryPeriod) {
|
|
67
|
+
const index = this.config.frequenciesEveryPeriod.findIndex(it => it === result);
|
|
68
|
+
if (index >= 0) {
|
|
69
|
+
return this.frequencies[index];
|
|
70
|
+
}
|
|
72
71
|
}
|
|
73
|
-
|
|
72
|
+
|
|
73
|
+
return result;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
get currentFrequency() {
|
|
@@ -86,17 +86,12 @@ export class SelectFrequency extends withChildOptions(FrequencyStatus) {
|
|
|
86
86
|
|
|
87
87
|
render() {
|
|
88
88
|
let options;
|
|
89
|
-
|
|
89
|
+
const defaultFrequency = this.defaultFrequency;
|
|
90
90
|
|
|
91
91
|
if (this.frequencies?.length) {
|
|
92
|
-
const { isSelected } = this.childOptions;
|
|
93
|
-
if (isSelected && this.config.frequenciesEveryPeriod) {
|
|
94
|
-
const index = this.config.frequenciesEveryPeriod.findIndex(it => it === isSelected);
|
|
95
|
-
if (index >= 0) defaultFrequency = this.frequencies[index];
|
|
96
|
-
}
|
|
97
92
|
options = this.frequencies.map((value, ix) => ({
|
|
98
93
|
value,
|
|
99
|
-
text: frequencyText(this.config.frequenciesEveryPeriod[ix], defaultFrequency
|
|
94
|
+
text: frequencyText(this.config.frequenciesEveryPeriod[ix], defaultFrequency)
|
|
100
95
|
}));
|
|
101
96
|
} else {
|
|
102
97
|
({ options } = this.childOptions);
|
|
@@ -118,6 +113,7 @@ export class SelectFrequency extends withChildOptions(FrequencyStatus) {
|
|
|
118
113
|
: text,
|
|
119
114
|
value
|
|
120
115
|
}));
|
|
116
|
+
|
|
121
117
|
return html`
|
|
122
118
|
<og-select
|
|
123
119
|
.options="${options}"
|