@woosmap/ui 4.164.4 → 4.164.6

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@woosmap/ui",
3
- "version": "4.164.4",
3
+ "version": "4.164.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/WebGeoServices/ui.git"
@@ -95,9 +95,7 @@ const Pricing = {
95
95
  unit: "Monthly Requests",
96
96
  description:
97
97
  "Get suggestions on addresses, localities, postcodes and more. Search on full words as well as substrings, with high flexibility on typos",
98
- pricing: [
99
- [50000000, 0],
100
- ],
98
+ pricing: [],
101
99
  discountEligible: true,
102
100
  },
103
101
  'Details': {
@@ -13,7 +13,7 @@ class PricingSimulator extends Component {
13
13
  sliders[category] = {};
14
14
  }
15
15
  sliders[category][pricingKey] = {
16
- queries: PricingData[category].pricings[pricingKey].defaultQueries || 0,
16
+ queries: 0,
17
17
  amount: 0,
18
18
  computedQueries: PricingData[category].pricings[pricingKey].defaultQueries || 0,
19
19
  };
@@ -14,28 +14,31 @@ class PricingSlider extends Component {
14
14
  return queries;
15
15
  }
16
16
  return pricing.reduce((amount, tier, index) => {
17
- previousPricingTier = index > 0 ? pricing[index - 1] : null;
18
-
19
- if (previousPricingTier !== null) {
20
- const valueToRemove = Math.min(tier[0] - previousPricingTier[0], q);
21
- if (valueToRemove > 0) {
22
- q -= valueToRemove;
23
- return amount + (valueToRemove / 100000) * tier[1] * coef;
24
- }
25
- } else {
26
- const valueToRemove = Math.min(tier[0], q);
17
+ previousPricingTier = index > 0 ? pricing[index - 1] : null;
18
+
19
+ if (previousPricingTier !== null) {
20
+ const valueToRemove = Math.min(tier[0] - previousPricingTier[0], q);
21
+ if (valueToRemove > 0) {
27
22
  q -= valueToRemove;
28
- return amount + (valueToRemove / 100000) * tier[1] * coef;
23
+ return amount + (valueToRemove / 1000) * tier[1] * coef;
29
24
  }
30
- return amount;
31
- }, 0)
32
-
25
+ } else {
26
+ const valueToRemove = Math.min(tier[0], q);
27
+ q -= valueToRemove;
28
+ return amount + (valueToRemove / 1000) * tier[1] * coef;
29
+ }
30
+ return Math.floor(amount);
31
+ }, 0);
33
32
  };
34
33
 
35
34
  computeQueries = (valueNow) => {
36
35
  const { productPricing, publicMode } = this.props;
37
36
  const { pricing, publicTierCount } = productPricing;
37
+ if (pricing.length === 0) {
38
+ return valueNow;
39
+ }
38
40
  const tierIndex = Math.min(Math.floor(valueNow / 100000), pricing.length - 1);
41
+
39
42
  // eslint-disable-next-line prefer-destructuring
40
43
  const tier = pricing[tierIndex][0];
41
44
  const value = valueNow - tierIndex * 100000;
@@ -140,7 +143,7 @@ class PricingSlider extends Component {
140
143
  displayedAmount = this.contactSalesButton();
141
144
  } else if (amount > 0) {
142
145
  displayedAmount = <span className="amount">{`${parseInt(amount, 10)}${currency}`}</span>;
143
- } else if (amount === 0 && computedQueries > 0) {
146
+ } else if (displayedPricing.length === 0) {
144
147
  displayedAmount = <span className="free-label">FREE</span>;
145
148
  }
146
149
  return (
@@ -167,10 +170,11 @@ class PricingSlider extends Component {
167
170
  renderMark={this.renderMarks}
168
171
  pearling
169
172
  min={0}
173
+ step={1000}
170
174
  onChange={(_queries) => {
171
175
  this.onChange(_queries);
172
176
  }}
173
- max={displayedPricing.length * 100000}
177
+ max={displayedPricing.length * 100000 || 50000000}
174
178
  />
175
179
  <div className="pricing-slider__queries">
176
180
  <div className="pricing-slider__queries__label">{productPricing.unit}</div>