@woosmap/ui 4.226.3 → 4.226.5
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/.idea/prettier.xml +6 -0
- package/data/hl-pricings.json +20265 -0
- package/package.json +1 -1
- package/src/components/PricingSlider/PricingData.js +584 -532
- package/src/components/PricingSlider/PricingSimulator.js +4 -4
- package/src/components/PricingSlider/PricingSimulator.stories.js +3 -1
- package/src/components/PricingSlider/PricingSlider.js +30 -18
- package/src/components/PricingSlider/hl-pricings.json +6462 -0
- package/src/locales/en/translation.json +146 -143
- package/src/locales/fr/translation.json +146 -143
|
@@ -163,7 +163,7 @@ export default class PricingSimulator extends Component {
|
|
|
163
163
|
|
|
164
164
|
render() {
|
|
165
165
|
const { sliders } = this.state;
|
|
166
|
-
const {
|
|
166
|
+
const { currency, hlPricings } = this.props;
|
|
167
167
|
const { total, contactSale, totalBeforeDiscount } = this.computeTotal();
|
|
168
168
|
const totalDisplayed = this.displayAmount(parseInt(total, 10), currency);
|
|
169
169
|
// if (contactSale) {
|
|
@@ -221,10 +221,10 @@ export default class PricingSimulator extends Component {
|
|
|
221
221
|
productPricing={productPricing}
|
|
222
222
|
name={pricingKey}
|
|
223
223
|
key={`pricing_${pricingKey.replace(' ', '')}`}
|
|
224
|
-
publicMode={publicMode}
|
|
225
224
|
currency={currency}
|
|
226
225
|
values={sliders[category][pricingKey]}
|
|
227
226
|
onChange={this.onChange(category, pricingKey)}
|
|
227
|
+
hlPricings={hlPricings}
|
|
228
228
|
/>
|
|
229
229
|
);
|
|
230
230
|
})}
|
|
@@ -261,9 +261,9 @@ export default class PricingSimulator extends Component {
|
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
PricingSimulator.defaultProps = { currency: '€'
|
|
264
|
+
PricingSimulator.defaultProps = { currency: '€' };
|
|
265
265
|
|
|
266
266
|
PricingSimulator.propTypes = {
|
|
267
267
|
currency: PropTypes.string,
|
|
268
|
-
|
|
268
|
+
hlPricings: PropTypes.object.isRequired,
|
|
269
269
|
};
|
|
@@ -6,10 +6,12 @@ const Story = {
|
|
|
6
6
|
component: PricingSimulator,
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
+
const hlPricings = require('./hl-pricings.json');
|
|
10
|
+
|
|
9
11
|
export default Story;
|
|
10
12
|
|
|
11
13
|
function Template() {
|
|
12
|
-
return <PricingSimulator />;
|
|
14
|
+
return <PricingSimulator hlPricings={hlPricings} />;
|
|
13
15
|
}
|
|
14
16
|
export const Default = Template.bind({
|
|
15
17
|
type: 'normal',
|
|
@@ -7,6 +7,12 @@ import Button from '../Button/Button';
|
|
|
7
7
|
import { tr } from '../utils/locale';
|
|
8
8
|
import Icon from '../Icon/Icon';
|
|
9
9
|
|
|
10
|
+
const currencyMap = {
|
|
11
|
+
$: 'USD',
|
|
12
|
+
'€': 'EUR',
|
|
13
|
+
'£': 'GBP',
|
|
14
|
+
};
|
|
15
|
+
|
|
10
16
|
export default class PricingSlider extends Component {
|
|
11
17
|
constructor(props) {
|
|
12
18
|
super(props);
|
|
@@ -15,7 +21,7 @@ export default class PricingSlider extends Component {
|
|
|
15
21
|
|
|
16
22
|
displayAmount = (amount) => {
|
|
17
23
|
const { currency } = this.props;
|
|
18
|
-
return currency === '€' ? `${amount
|
|
24
|
+
return currency === '€' ? `${amount}${currency}` : `${currency}${amount}`;
|
|
19
25
|
};
|
|
20
26
|
|
|
21
27
|
computeAmount = (pricing, queries) => {
|
|
@@ -88,9 +94,8 @@ export default class PricingSlider extends Component {
|
|
|
88
94
|
);
|
|
89
95
|
|
|
90
96
|
renderMarks = (props) => {
|
|
91
|
-
const {
|
|
92
|
-
const
|
|
93
|
-
const displayedPricing = publicMode ? pricing.slice(0, publicTierCount + 1) : pricing;
|
|
97
|
+
const { publicMode } = this.props;
|
|
98
|
+
const displayedPricing = this.getDisplayedPricing();
|
|
94
99
|
|
|
95
100
|
let value;
|
|
96
101
|
if (props.key === 0) {
|
|
@@ -114,10 +119,18 @@ export default class PricingSlider extends Component {
|
|
|
114
119
|
|
|
115
120
|
getMarks = (displayedPricing) => [-1, ...displayedPricing.keys()].map((key) => (key + 1) * 100000);
|
|
116
121
|
|
|
122
|
+
findProduct = (productId) => {
|
|
123
|
+
const { hlPricings } = this.props;
|
|
124
|
+
return hlPricings.find((product) => product.id === productId);
|
|
125
|
+
};
|
|
126
|
+
|
|
117
127
|
getDisplayedPricing = () => {
|
|
118
|
-
const { productPricing,
|
|
119
|
-
const
|
|
120
|
-
|
|
128
|
+
const { productPricing, currency, planId } = this.props;
|
|
129
|
+
const product = this.findProduct(productPricing.productId);
|
|
130
|
+
|
|
131
|
+
return product && product.pricings[planId] && product.pricings[planId][currencyMap[currency]]
|
|
132
|
+
? product.pricings[planId][currencyMap[currency]]
|
|
133
|
+
: [];
|
|
121
134
|
};
|
|
122
135
|
|
|
123
136
|
getDisplayedData = (queries) => {
|
|
@@ -172,26 +185,19 @@ export default class PricingSlider extends Component {
|
|
|
172
185
|
return (
|
|
173
186
|
<tr>
|
|
174
187
|
<td>{`${numeral(lower).format('0.[0]a')}+`}</td>
|
|
175
|
-
<td>{
|
|
176
|
-
</tr>
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
if (index === displayedPricing.length - 2) {
|
|
180
|
-
return (
|
|
181
|
-
<tr>
|
|
182
|
-
<td>{`${numeral(lower).format('0.[0]a')}+`}</td>
|
|
183
|
-
<td>{this.displayAmount(tier[1] / coef)}</td>
|
|
188
|
+
<td>{this.displayAmount((tier[1] / coef).toFixed(2))}</td>
|
|
184
189
|
</tr>
|
|
185
190
|
);
|
|
186
191
|
}
|
|
187
192
|
return (
|
|
188
193
|
<tr>
|
|
189
194
|
<td>{`${numeral(lower).format('0.[0]a')} to ${numeral(tier[0]).format('0.[0]a')}`}</td>
|
|
190
|
-
<td>{this.displayAmount(tier[1] / coef)}</td>
|
|
195
|
+
<td>{this.displayAmount((tier[1] / coef).toFixed(2))}</td>
|
|
191
196
|
</tr>
|
|
192
197
|
);
|
|
193
198
|
})}
|
|
194
199
|
</table>
|
|
200
|
+
{displayedPricing.length === 1 && displayedPricing[0][1] === 0 ? null : tr('For more, contact us')}
|
|
195
201
|
</div>
|
|
196
202
|
);
|
|
197
203
|
};
|
|
@@ -287,7 +293,11 @@ export default class PricingSlider extends Component {
|
|
|
287
293
|
}
|
|
288
294
|
}
|
|
289
295
|
|
|
290
|
-
PricingSlider.defaultProps = {
|
|
296
|
+
PricingSlider.defaultProps = {
|
|
297
|
+
defaultQueries: 1500,
|
|
298
|
+
onChange: null,
|
|
299
|
+
planId: 'plan_ohNpgeVMtJ3veT',
|
|
300
|
+
};
|
|
291
301
|
|
|
292
302
|
PricingSlider.propTypes = {
|
|
293
303
|
productPricing: PropTypes.object.isRequired,
|
|
@@ -298,4 +308,6 @@ PricingSlider.propTypes = {
|
|
|
298
308
|
onChange: PropTypes.func,
|
|
299
309
|
values: PropTypes.object.isRequired,
|
|
300
310
|
id: PropTypes.string.isRequired,
|
|
311
|
+
planId: PropTypes.string,
|
|
312
|
+
hlPricings: PropTypes.object.isRequired,
|
|
301
313
|
};
|