@woosmap/ui 4.162.10 → 4.162.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@woosmap/ui",
3
- "version": "4.162.10",
3
+ "version": "4.162.12",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/WebGeoServices/ui.git"
@@ -15,6 +15,7 @@ class PricingSimulator extends Component {
15
15
  sliders[category][pricingKey] = {
16
16
  queries: PricingData[category].pricings[pricingKey].defaultQueries || 0,
17
17
  amount: 0,
18
+ computedQueries: PricingData[category].pricings[pricingKey].defaultQueries || 0,
18
19
  };
19
20
  });
20
21
  });
@@ -28,27 +29,32 @@ class PricingSimulator extends Component {
28
29
  this.setState({ sliders: newSliders });
29
30
  };
30
31
 
32
+ // eslint-disable-next-line sonarjs/cognitive-complexity
31
33
  computeTotal = () => {
32
34
  let freeQueriesTotal = 0;
33
35
  let eligibleTotal = 0;
34
36
  let notEligibleTotal = 0;
37
+ let contactSale = false;
35
38
 
36
39
  const { sliders } = this.state;
37
40
  Object.keys(sliders).forEach((category) => {
38
41
  Object.keys(sliders[category]).forEach((pricingKey) => {
39
42
  const { discountEligible } = PricingData[category].pricings[pricingKey];
40
- const { amount, queries } = sliders[category][pricingKey];
41
- if (typeof amount !== 'number' || typeof queries !== 'number') {
42
- console.log('REJECT', pricingKey, amount, queries);
43
+ const { amount, computedQueries, queries } = sliders[category][pricingKey];
44
+ if (typeof amount !== 'number' || typeof computedQueries !== 'number') {
45
+ console.log('REJECT', pricingKey, amount, computedQueries);
46
+ if (queries === '∞') {
47
+ contactSale = true;
48
+ }
43
49
  return;
44
50
  }
45
51
  if (discountEligible) {
46
52
  if (typeof freeQueriesTotal === 'number') {
47
- freeQueriesTotal += queries;
53
+ freeQueriesTotal += computedQueries;
48
54
  }
49
- console.log('Eligible', pricingKey, eligibleTotal, amount, queries, freeQueriesTotal);
55
+ console.log('Eligible', pricingKey, eligibleTotal, amount, computedQueries, freeQueriesTotal);
50
56
  eligibleTotal += amount;
51
- } else if (queries > 0) {
57
+ } else if (computedQueries > 0) {
52
58
  freeQueriesTotal = false;
53
59
  notEligibleTotal += amount;
54
60
  console.log('Not Eligible', pricingKey, notEligibleTotal, amount);
@@ -58,16 +64,18 @@ class PricingSimulator extends Component {
58
64
  const { currency } = this.props;
59
65
  const discount = currency === '$' ? 180 : 200;
60
66
  const total = notEligibleTotal + Math.max(eligibleTotal - discount, 0);
61
- return { total, freeQueriesTotal, notEligibleTotal, eligibleTotal };
67
+ return { total, freeQueriesTotal, notEligibleTotal, eligibleTotal, contactSale };
62
68
  };
63
69
 
64
70
  render() {
65
71
  const { sliders } = this.state;
66
72
  const { publicMode, currency } = this.props;
67
- const { total, freeQueriesTotal, notEligibleTotal } = this.computeTotal();
73
+ const { total, freeQueriesTotal, notEligibleTotal, contactSale } = this.computeTotal();
68
74
  let totalDisplayed = total;
69
75
  if (notEligibleTotal === 0 && freeQueriesTotal && freeQueriesTotal < 10000) {
70
76
  totalDisplayed = 0;
77
+ } else if (contactSale) {
78
+ totalDisplayed = 'Contact Sale';
71
79
  }
72
80
  return (
73
81
  <>