@woosmap/ui 4.226.10 → 4.226.12
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
|
@@ -25,8 +25,6 @@ export default class PricingSlider extends Component {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
computeAmount = (pricing, queries) => {
|
|
28
|
-
const { currency } = this.props;
|
|
29
|
-
const coef = currency === '$' ? 0.9 : 1;
|
|
30
28
|
let q = queries;
|
|
31
29
|
let previousPricingTier;
|
|
32
30
|
if (queries === '∞') {
|
|
@@ -39,12 +37,12 @@ export default class PricingSlider extends Component {
|
|
|
39
37
|
const valueToRemove = Math.min(tier[0] - previousPricingTier[0], q);
|
|
40
38
|
if (valueToRemove > 0) {
|
|
41
39
|
q -= valueToRemove;
|
|
42
|
-
return amount + (
|
|
40
|
+
return amount + (valueToRemove / 1000) * (tier[1] / 100);
|
|
43
41
|
}
|
|
44
42
|
} else {
|
|
45
43
|
const valueToRemove = Math.min(tier[0], q);
|
|
46
44
|
q -= valueToRemove;
|
|
47
|
-
return amount + (
|
|
45
|
+
return amount + (valueToRemove / 1000) * (tier[1] / 100);
|
|
48
46
|
}
|
|
49
47
|
return Math.floor(amount);
|
|
50
48
|
}, 0);
|
|
@@ -128,8 +126,10 @@ export default class PricingSlider extends Component {
|
|
|
128
126
|
const product = this.findProduct(productPricing.productId);
|
|
129
127
|
if (product && product.pricings[planId] && product.pricings[planId][currencyMap[currency]]) {
|
|
130
128
|
const displayedPricing = [...product.pricings[planId][currencyMap[currency]]];
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
if (displayedPricing.length > 1) {
|
|
130
|
+
displayedPricing[displayedPricing.length - 1][0] = displayedPricing[displayedPricing.length - 2][0] * 2;
|
|
131
|
+
displayedPricing.push([displayedPricing[displayedPricing.length - 2][0] * 4, null]);
|
|
132
|
+
}
|
|
133
133
|
return displayedPricing;
|
|
134
134
|
}
|
|
135
135
|
return [];
|
|
@@ -167,49 +167,45 @@ export default class PricingSlider extends Component {
|
|
|
167
167
|
}
|
|
168
168
|
};
|
|
169
169
|
|
|
170
|
-
displayDetails = (displayedPricing, unit) =>
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
{displayedPricing.map((tier, index) => {
|
|
185
|
-
const lower = index > 0 ? displayedPricing[index - 1][0] : 0;
|
|
186
|
-
if (index === displayedPricing.length - 1) {
|
|
187
|
-
return (
|
|
188
|
-
<tr>
|
|
189
|
-
<td>{`${numeral(lower).format('0.[0]a')}+`}</td>
|
|
190
|
-
<td>{tr('Contact us for discount')}</td>
|
|
191
|
-
</tr>
|
|
192
|
-
);
|
|
193
|
-
}
|
|
194
|
-
if (index === displayedPricing.length - 2) {
|
|
195
|
-
return (
|
|
196
|
-
<tr>
|
|
197
|
-
<td>{`${numeral(lower).format('0.[0]a')}+`}</td>
|
|
198
|
-
<td>{this.displayAmount((tier[1] / coef).toFixed(2))}</td>
|
|
199
|
-
</tr>
|
|
200
|
-
);
|
|
201
|
-
}
|
|
170
|
+
displayDetails = (displayedPricing, unit) => (
|
|
171
|
+
<div className="pricing-slider__detailed-price">
|
|
172
|
+
<table>
|
|
173
|
+
<tr>
|
|
174
|
+
<td>
|
|
175
|
+
<strong>{unit}</strong>
|
|
176
|
+
</td>
|
|
177
|
+
<td>
|
|
178
|
+
<strong>{tr('Cost per 1000')}</strong>
|
|
179
|
+
</td>
|
|
180
|
+
</tr>
|
|
181
|
+
{displayedPricing.map((tier, index) => {
|
|
182
|
+
const lower = index > 0 ? displayedPricing[index - 1][0] : 0;
|
|
183
|
+
if (index === displayedPricing.length - 1) {
|
|
202
184
|
return (
|
|
203
185
|
<tr>
|
|
204
|
-
<td>{`${numeral(lower).format('0.[0]a')}
|
|
205
|
-
<td>{
|
|
186
|
+
<td>{`${numeral(lower).format('0.[0]a')}+`}</td>
|
|
187
|
+
<td>{tr('Contact us for discount')}</td>
|
|
206
188
|
</tr>
|
|
207
189
|
);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
190
|
+
}
|
|
191
|
+
if (index === displayedPricing.length - 2) {
|
|
192
|
+
return (
|
|
193
|
+
<tr>
|
|
194
|
+
<td>{`${numeral(lower).format('0.[0]a')}+`}</td>
|
|
195
|
+
<td>{this.displayAmount((tier[1] / 100).toFixed(2))}</td>
|
|
196
|
+
</tr>
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
return (
|
|
200
|
+
<tr>
|
|
201
|
+
<td>{`${numeral(lower).format('0.[0]a')} to ${numeral(tier[0]).format('0.[0]a')}`}</td>
|
|
202
|
+
<td>{this.displayAmount((tier[1] / 100).toFixed(2))}</td>
|
|
203
|
+
</tr>
|
|
204
|
+
);
|
|
205
|
+
})}
|
|
206
|
+
</table>
|
|
207
|
+
</div>
|
|
208
|
+
);
|
|
213
209
|
|
|
214
210
|
render() {
|
|
215
211
|
const { name, productPricing, values, id } = this.props;
|
|
@@ -273,7 +269,7 @@ export default class PricingSlider extends Component {
|
|
|
273
269
|
{displayedAmount}
|
|
274
270
|
</div>
|
|
275
271
|
</div>
|
|
276
|
-
{displayedPricing.length >
|
|
272
|
+
{displayedPricing.length > 1 && (
|
|
277
273
|
<div className="pricing-slider__detailed-price-wrapper">
|
|
278
274
|
<Button
|
|
279
275
|
className="pricing-slider__detailed-price-btn"
|