@procraft/widget-order 2.26.0 → 2.27.1

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@procraft/widget-order",
3
3
  "description": "Order widget for landing",
4
- "version": "2.26.0",
4
+ "version": "2.27.1",
5
5
  "private": false,
6
6
  "main": "dist",
7
7
  "scripts": {
@@ -244,9 +244,12 @@ export const OrderButton: React.FC<OrderButtonProps> = ({
244
244
  break
245
245
  }
246
246
 
247
+ const currencyPrefix = getCurrencyPrefix(catalogItem.master?.currency || '')
248
+ const currencySuffix = getCurrencySuffix(catalogItem.master?.currency || '')
249
+
247
250
  content.push(
248
251
  <Container key="buy" variant="white" className="buy">
249
- {oldPrice && oldPrice > price ? <OldPrice price={oldPrice} /> : null}
252
+ {oldPrice && oldPrice > price ? <OldPrice prefix={currencyPrefix} suffix={currencySuffix} price={oldPrice} /> : null}
250
253
 
251
254
  {!price ? (
252
255
  <Typography className="free" component="span">
@@ -268,8 +271,8 @@ export const OrderButton: React.FC<OrderButtonProps> = ({
268
271
  value={price}
269
272
  displayType="text"
270
273
  thousandSeparator={' '}
271
- prefix={getCurrencyPrefix(catalogItem.master?.currency || '')}
272
- suffix={getCurrencySuffix(catalogItem.master?.currency || '')}
274
+ prefix={currencyPrefix}
275
+ suffix={currencySuffix}
273
276
  />
274
277
  </>
275
278
  ) : (
@@ -38,10 +38,13 @@ const CourseItem: React.FC<CourseItemComponentProps> = (props) => {
38
38
 
39
39
  const {extraBenefits} = useMemo(() => {
40
40
  const flowId = fieldsValueSelected.filter(x => x.fieldId === -1808).map(fv => +fv.uid.substr(6))[0]
41
- const extraBenefits = (course.tariffPerFlowDataItems || []).filter(x => x.flowId === flowId)
41
+ const tariffId = item.course?.tariffId
42
+
43
+ const extraBenefits = (course.tariffPerFlowDataItems || [])
44
+ .filter(x => x.flowId === flowId && (!tariffId || x.courseTariffId === tariffId))
42
45
  .map(pfdi => pfdi.marketingBenefitsComputed)[0] || []
43
46
  return {extraBenefits}
44
- }, [fieldsValueSelected, course.tariffPerFlowDataItems])
47
+ }, [fieldsValueSelected, course.tariffPerFlowDataItems, item.course?.tariffId])
45
48
 
46
49
 
47
50
  // console.log('useEffect fieldsValueSelected', [...fieldsValueSelected]);
@@ -3,7 +3,7 @@ import NumberFormat from 'react-number-format'
3
3
  import { OldPriceProps } from './interfaces'
4
4
  import { OldPriceStyled } from './styles'
5
5
 
6
- const OldPrice: React.FC<OldPriceProps> = ({ price, ...other }) => {
6
+ const OldPrice: React.FC<OldPriceProps> = ({ price, prefix, suffix, ...other }) => {
7
7
  return (
8
8
  <OldPriceStyled component="span" {...other}>
9
9
  <NumberFormat
@@ -11,8 +11,9 @@ const OldPrice: React.FC<OldPriceProps> = ({ price, ...other }) => {
11
11
  displayType={'text'}
12
12
  thousandSeparator={' '}
13
13
  decimalScale={0}
14
+ prefix={prefix}
15
+ suffix={suffix}
14
16
  />{' '}
15
- ₽
16
17
  </OldPriceStyled>
17
18
  )
18
19
  }
@@ -1,3 +1,5 @@
1
1
  export type OldPriceProps = {
2
2
  price: number
3
+ prefix?: string
4
+ suffix?: string
3
5
  }