@procraft/widget-order 2.31.0 → 2.31.2
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/dist/CourseItem/AltItem/index.js +3 -3
- package/dist/CourseItem/AltItem/index.js.map +1 -1
- package/dist/CourseItem/AltItemText/index.js +1 -1
- package/dist/CourseItem/AltItemText/index.js.map +1 -1
- package/dist/CourseItem/FieldValues/index.js +6 -6
- package/dist/CourseItem/FieldValues/index.js.map +1 -1
- package/dist/CourseItem/FieldValuesByType/index.js +2 -2
- package/dist/CourseItem/FieldValuesByType/index.js.map +1 -1
- package/dist/CourseItem/Materials/index.js +5 -5
- package/dist/CourseItem/Materials/index.js.map +1 -1
- package/dist/CourseItem/Materials/styles.js +1 -1
- package/dist/CourseItem/Materials/styles.js.map +1 -1
- package/dist/CourseItem/OrderButton/index.js +17 -17
- package/dist/CourseItem/OrderButton/index.js.map +1 -1
- package/dist/CourseItem/OrderButton/styles.js +1 -1
- package/dist/CourseItem/OrderButton/styles.js.map +1 -1
- package/dist/CourseItem/PlacesLeft/index.js +1 -1
- package/dist/CourseItem/PlacesLeft/index.js.map +1 -1
- package/dist/CourseItem/Reviews/ReviewsPopup/Filters/index.js +7 -7
- package/dist/CourseItem/Reviews/ReviewsPopup/Filters/index.js.map +1 -1
- package/dist/CourseItem/Reviews/ReviewsPopup/ProgressBar/index.js +1 -1
- package/dist/CourseItem/Reviews/ReviewsPopup/ProgressBar/index.js.map +1 -1
- package/dist/CourseItem/Reviews/ReviewsPopup/Review/index.js +7 -2
- package/dist/CourseItem/Reviews/ReviewsPopup/Review/index.js.map +1 -1
- package/dist/CourseItem/Reviews/ReviewsPopup/Review/styles.js +11 -1
- package/dist/CourseItem/Reviews/ReviewsPopup/Review/styles.js.map +1 -1
- package/dist/CourseItem/Reviews/ReviewsPopup/Stats/index.js +6 -6
- package/dist/CourseItem/Reviews/ReviewsPopup/Stats/index.js.map +1 -1
- package/dist/CourseItem/Reviews/ReviewsPopup/index.js +10 -10
- package/dist/CourseItem/Reviews/ReviewsPopup/index.js.map +1 -1
- package/dist/CourseItem/Reviews/Stars/index.js +1 -1
- package/dist/CourseItem/Reviews/Stars/index.js.map +1 -1
- package/dist/CourseItem/Reviews/index.js +5 -5
- package/dist/CourseItem/Reviews/index.js.map +1 -1
- package/dist/CourseItem/Sales/Sale/index.js +17 -15
- package/dist/CourseItem/Sales/Sale/index.js.map +1 -1
- package/dist/CourseItem/Sales/index.js +1 -1
- package/dist/CourseItem/Sales/index.js.map +1 -1
- package/dist/CourseItem/Subscriptions/index.js +3 -3
- package/dist/CourseItem/Subscriptions/index.js.map +1 -1
- package/dist/CourseItem/Subscriptions/styles.js +1 -1
- package/dist/CourseItem/Subscriptions/styles.js.map +1 -1
- package/dist/CourseItem/index.js +8 -8
- package/dist/CourseItem/index.js.map +1 -1
- package/dist/PriceFormat.d.ts +6 -0
- package/dist/PriceFormat.js +11 -0
- package/dist/PriceFormat.js.map +1 -0
- package/dist/components/DateFormat/index.js +1 -1
- package/dist/components/DateFormat/index.js.map +1 -1
- package/dist/components/OldPrice/index.js +2 -3
- package/dist/components/OldPrice/index.js.map +1 -1
- package/dist/components/OldPrice/styles.js +1 -1
- package/dist/components/OldPrice/styles.js.map +1 -1
- package/dist/components/ProlongationWidget/index.js +10 -12
- package/dist/components/ProlongationWidget/index.js.map +1 -1
- package/dist/components/ProlongationWidget/styles.js +1 -1
- package/dist/components/ProlongationWidget/styles.js.map +1 -1
- package/dist/components/RadioGroup/index.js +3 -3
- package/dist/components/RadioGroup/index.js.map +1 -1
- package/dist/components/RadioGroup/styles.js +1 -1
- package/dist/components/RadioGroup/styles.js.map +1 -1
- package/dist/components/Tabs/index.js +2 -2
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/styles.js +1 -1
- package/dist/components/Tabs/styles.js.map +1 -1
- package/dist/components/Typography/index.js +1 -1
- package/dist/components/Typography/index.js.map +1 -1
- package/dist/components/Typography/styles.js +2 -2
- package/dist/components/Typography/styles.js.map +1 -1
- package/dist/helpers/getCatalogItems/index.js +1 -1
- package/dist/helpers/getCatalogItems/index.js.map +1 -1
- package/dist/hooks/useCatalogItemSubscription/index.js +3 -3
- package/dist/hooks/useCatalogItemSubscription/index.js.map +1 -1
- package/dist/hooks/useOrderLink/index.js +3 -3
- package/dist/hooks/useOrderLink/index.js.map +1 -1
- package/dist/hooks/usePrices/index.js +1 -1
- package/dist/hooks/usePrices/index.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/models/Course.js +4 -4
- package/dist/models/Course.js.map +1 -1
- package/dist/modules/gql/cli/generateTypes/generateTypes.js +2 -2
- package/dist/modules/gql/cli/generateTypes/generateTypes.js.map +1 -1
- package/dist/modules/gql/cli/generateTypes/run.js +1 -1
- package/dist/modules/gql/cli/generateTypes/run.js.map +1 -1
- package/dist/modules/gql/cli/generateTypes/types.js +7 -7
- package/dist/modules/gql/cli/generateTypes/types.js.map +1 -1
- package/dist/modules/gql/generated/helpers/apollo-helpers.d.ts +4 -2
- package/dist/modules/gql/generated/types.d.ts +9 -0
- package/dist/modules/gql/generated/types.js +2 -0
- package/dist/modules/gql/generated/types.js.map +1 -1
- package/dist/styles/GlobalStyle/index.js +1 -1
- package/dist/styles/GlobalStyle/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils.js +8 -10
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/CourseItem/OrderButton/index.tsx +2 -8
- package/src/CourseItem/Reviews/ReviewsPopup/Review/index.tsx +8 -0
- package/src/CourseItem/Reviews/ReviewsPopup/Review/styles.ts +11 -1
- package/src/CourseItem/Sales/Sale/index.tsx +17 -26
- package/src/PriceFormat.tsx +17 -0
- package/src/components/OldPrice/index.tsx +2 -9
- package/src/components/ProlongationWidget/index.tsx +0 -2
- package/src/modules/gql/generated/helpers/apollo-helpers.ts +4 -2
- package/src/modules/gql/generated/schema.json +74 -1
- package/src/modules/gql/generated/types.ts +11 -0
- package/src/utils.ts +3 -5
package/dist/utils.js
CHANGED
|
@@ -18,10 +18,8 @@ const roundStd = (num, decimalPlaces) => {
|
|
|
18
18
|
exports.roundStd = roundStd;
|
|
19
19
|
const getCurrencyPrefix = (currency) => {
|
|
20
20
|
switch (currency) {
|
|
21
|
-
case 'USD':
|
|
22
|
-
|
|
23
|
-
default:
|
|
24
|
-
return '';
|
|
21
|
+
case 'USD': return '$';
|
|
22
|
+
default: return '';
|
|
25
23
|
}
|
|
26
24
|
};
|
|
27
25
|
exports.getCurrencyPrefix = getCurrencyPrefix;
|
|
@@ -36,14 +34,14 @@ const getCurrencySuffix = (currency) => {
|
|
|
36
34
|
case 'UAH':
|
|
37
35
|
return ' ₴';
|
|
38
36
|
default:
|
|
39
|
-
return
|
|
37
|
+
return `\u202F${currency}`;
|
|
40
38
|
}
|
|
41
39
|
};
|
|
42
40
|
exports.getCurrencySuffix = getCurrencySuffix;
|
|
43
41
|
function isNowYear(dateMoment) {
|
|
44
42
|
if (dateMoment) {
|
|
45
|
-
dateMoment =
|
|
46
|
-
return
|
|
43
|
+
dateMoment = moment_1.default(dateMoment);
|
|
44
|
+
return moment_1.default().year() === dateMoment.year();
|
|
47
45
|
}
|
|
48
46
|
else {
|
|
49
47
|
return false;
|
|
@@ -55,7 +53,7 @@ exports.isNowYear = isNowYear;
|
|
|
55
53
|
*/
|
|
56
54
|
function formatDate(dateMoment) {
|
|
57
55
|
if (dateMoment) {
|
|
58
|
-
dateMoment =
|
|
56
|
+
dateMoment = moment_1.default(dateMoment);
|
|
59
57
|
if (!isNowYear(dateMoment)) {
|
|
60
58
|
return dateMoment.format('D MMMM YYYY');
|
|
61
59
|
}
|
|
@@ -79,7 +77,7 @@ function hasTime(dateMoment, optionalTimeReplacement = '00:00') {
|
|
|
79
77
|
exports.hasTime = hasTime;
|
|
80
78
|
function formatTimeHoursMinutes(dateMoment) {
|
|
81
79
|
if (dateMoment) {
|
|
82
|
-
return
|
|
80
|
+
return moment_1.default(dateMoment).format('HH:mm');
|
|
83
81
|
}
|
|
84
82
|
else {
|
|
85
83
|
return '';
|
|
@@ -88,7 +86,7 @@ function formatTimeHoursMinutes(dateMoment) {
|
|
|
88
86
|
exports.formatTimeHoursMinutes = formatTimeHoursMinutes;
|
|
89
87
|
function formatDateOptionalTime(dateMoment, separator = ' в ', optionalTimeReplacement = '00:00') {
|
|
90
88
|
if (dateMoment) {
|
|
91
|
-
const timestamp =
|
|
89
|
+
const timestamp = moment_1.default(dateMoment);
|
|
92
90
|
if (hasTime(timestamp, optionalTimeReplacement)) {
|
|
93
91
|
return `${formatDate(timestamp)}${separator}${formatTimeHoursMinutes(timestamp)}`;
|
|
94
92
|
}
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuC;AAGhC,MAAM,WAAW,GAAG,CAAC,CAAS,EAAE,CAAC,GAAG,GAAG,EAAE,EAAE;IAChD,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC,CAAA;IACnB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAA;AAClC,CAAC,CAAA;AAHY,QAAA,WAAW,eAGvB;AAEM,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,aAAqB,EAAE,EAAE;IAC7D,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,aAAa,CAAC,CAAA;IACrC,MAAM,CAAC,GAAG,MAAM,CAAC,OAAO,GAAG,GAAG,GAAG,CAAC,CAAA;IAElC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;AACpC,CAAC,CAAA;AALY,QAAA,QAAQ,YAKpB;AAEM,MAAM,iBAAiB,GAAG,CAAC,QAAgB,EAAE,EAAE;IACp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G,KAAK,EACjB,0BAAuD,OAAO;IAE9D,IAAI,UAAU,EAAE;QACd,MAAM,SAAS,GAAG,gBAAM,CAAC,UAAU,CAAC,CAAA;QAEpC,IAAI,OAAO,CAAC,SAAS,EAAE,uBAAuB,CAAC,EAAE;YAC/C,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,GAAG,SAAS,GAAG,sBAAsB,CAClE,SAAS,CACV,EAAE,CAAA;SACJ;aAAM;YACL,OAAO,UAAU,CAAC,SAAS,CAAC,CAAA;SAC7B;KACF;SAAM;QACL,OAAO,EAAE,CAAA;KACV;AACH,CAAC;AAlBD,wDAkBC"}
|
package/package.json
CHANGED
|
@@ -6,7 +6,6 @@ import React, {
|
|
|
6
6
|
useMemo,
|
|
7
7
|
useState,
|
|
8
8
|
} from 'react'
|
|
9
|
-
import NumberFormat from 'react-number-format'
|
|
10
9
|
import Button from '../../components/Button'
|
|
11
10
|
import Container from '../../components/Container'
|
|
12
11
|
import OldPrice from '../../components/OldPrice'
|
|
@@ -25,6 +24,7 @@ import {
|
|
|
25
24
|
import { getCurrencyPrefix, getCurrencySuffix } from '../../utils'
|
|
26
25
|
import { OrderButtonProps } from './interfaces'
|
|
27
26
|
import { OrderButtonByDateSalesStyled } from './styles'
|
|
27
|
+
import { PriceFormat } from '../../PriceFormat'
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Кнопка заказа
|
|
@@ -238,13 +238,7 @@ export const OrderButton: React.FC<OrderButtonProps> = ({
|
|
|
238
238
|
{price ? (
|
|
239
239
|
<>
|
|
240
240
|
{promoCode ? 'По промо за ' : 'Купить за '}
|
|
241
|
-
<
|
|
242
|
-
value={price}
|
|
243
|
-
displayType="text"
|
|
244
|
-
thousandSeparator={' '}
|
|
245
|
-
prefix={currencyPrefix}
|
|
246
|
-
suffix={currencySuffix}
|
|
247
|
-
/>
|
|
241
|
+
<PriceFormat prefix={currencyPrefix} suffix={currencySuffix} value={price} />
|
|
248
242
|
</>
|
|
249
243
|
) : (
|
|
250
244
|
'Зарегистрироваться'
|
|
@@ -45,6 +45,14 @@ export const Review: React.FC<ReviewProps> = ({ review, ...other }) => {
|
|
|
45
45
|
{meetExpectation ? (
|
|
46
46
|
<div className="meetExpectation">{meetExpectation}</div>
|
|
47
47
|
) : null}
|
|
48
|
+
{review.reply && (
|
|
49
|
+
<div className="reply">
|
|
50
|
+
<div className="replyTitle">Ответ школы</div>
|
|
51
|
+
<div className="replyText" dangerouslySetInnerHTML={{
|
|
52
|
+
__html: review.reply.replace(/\n/gm, '<br/>'),
|
|
53
|
+
}}/>
|
|
54
|
+
</div>
|
|
55
|
+
)}
|
|
48
56
|
</ReviewTextStyled>
|
|
49
57
|
</ReviewStyled>
|
|
50
58
|
)
|
|
@@ -22,7 +22,7 @@ export const ReviewHeaderStyled = styled.div`
|
|
|
22
22
|
font-weight: 500;
|
|
23
23
|
font-size: 14px;
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
${StarsStyled} {
|
|
27
27
|
svg {
|
|
28
28
|
width: 18px;
|
|
@@ -42,6 +42,16 @@ export const ReviewTextStyled = styled.div`
|
|
|
42
42
|
font-weight: 500;
|
|
43
43
|
font-size: 14px;
|
|
44
44
|
}
|
|
45
|
+
|
|
46
|
+
.reply {
|
|
47
|
+
margin-top: 10px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.replyTitle {
|
|
51
|
+
color: #8398ac;
|
|
52
|
+
font-weight: 500;
|
|
53
|
+
font-size: 14px;
|
|
54
|
+
}
|
|
45
55
|
`
|
|
46
56
|
|
|
47
57
|
export const ReviewStyled = styled.div`
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useMemo } from 'react'
|
|
2
|
-
import NumberFormat from 'react-number-format'
|
|
3
2
|
import Button from '../../../components/Button'
|
|
4
3
|
import OldPrice from '../../../components/OldPrice'
|
|
5
4
|
import {
|
|
@@ -12,6 +11,7 @@ import { CatalogFieldValue } from '../../../modules/gql/generated/types'
|
|
|
12
11
|
import { getCurrencyPrefix, getCurrencySuffix } from '../../../utils'
|
|
13
12
|
import { SaleProps } from './interfaces'
|
|
14
13
|
import { SaleStyled } from './styles'
|
|
14
|
+
import { PriceFormat } from '../../../PriceFormat'
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Считаем стоимость с учетом скидки
|
|
@@ -56,6 +56,10 @@ const Sale: React.FC<SaleProps> = ({
|
|
|
56
56
|
titleTextColor,
|
|
57
57
|
...other
|
|
58
58
|
}) => {
|
|
59
|
+
|
|
60
|
+
const currencyPrefix = getCurrencyPrefix(catalogItem.master?.currency || '')
|
|
61
|
+
const currencySuffix = getCurrencySuffix(catalogItem.master?.currency || '')
|
|
62
|
+
|
|
59
63
|
const {
|
|
60
64
|
canOrder,
|
|
61
65
|
items,
|
|
@@ -178,16 +182,9 @@ const Sale: React.FC<SaleProps> = ({
|
|
|
178
182
|
{index > 0 ? '+ ' : ''}
|
|
179
183
|
{n.name}
|
|
180
184
|
</span>{' '}
|
|
181
|
-
{priceWithDiscount
|
|
182
|
-
<
|
|
183
|
-
|
|
184
|
-
value={priceWithDiscount}
|
|
185
|
-
displayType="text"
|
|
186
|
-
thousandSeparator=" "
|
|
187
|
-
/>{' '}
|
|
188
|
-
₽
|
|
189
|
-
</span>
|
|
190
|
-
) : null}
|
|
185
|
+
{priceWithDiscount && (
|
|
186
|
+
<PriceFormat prefix={currencyPrefix} suffix={currencySuffix} value={price} />
|
|
187
|
+
)}
|
|
191
188
|
</span>
|
|
192
189
|
)
|
|
193
190
|
})
|
|
@@ -199,7 +196,7 @@ const Sale: React.FC<SaleProps> = ({
|
|
|
199
196
|
totalPrice,
|
|
200
197
|
saleFieldsValueSelected,
|
|
201
198
|
}
|
|
202
|
-
}, [fieldsValueSelected, sale])
|
|
199
|
+
}, [fieldsValueSelected, sale, currencyPrefix, currencySuffix])
|
|
203
200
|
|
|
204
201
|
const uri = useOrderLink({
|
|
205
202
|
catalogItem,
|
|
@@ -242,19 +239,18 @@ const Sale: React.FC<SaleProps> = ({
|
|
|
242
239
|
</div>
|
|
243
240
|
<div className="content">
|
|
244
241
|
<p style={{ color: titleTextColor }} className="title">
|
|
245
|
-
Дополнительно
|
|
242
|
+
Дополнительно скидка{' '}
|
|
246
243
|
{sale.benefitUnit === 'Percent'
|
|
247
|
-
? `${Math.round(
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
: `${totalPriceOriginal - totalPrice} ₽`}
|
|
244
|
+
? `${Math.round(((totalPriceOriginal - totalPrice) / totalPriceOriginal) * 100)}%`
|
|
245
|
+
: <PriceFormat value={totalPriceOriginal - totalPrice} prefix={currencyPrefix} suffix={currencySuffix} />
|
|
246
|
+
}
|
|
251
247
|
</p>
|
|
252
248
|
|
|
253
249
|
<div className="items">{items}</div>
|
|
254
250
|
|
|
255
251
|
<div className="prices">
|
|
256
252
|
<div>
|
|
257
|
-
<OldPrice price={totalPriceOriginal} />
|
|
253
|
+
<OldPrice price={totalPriceOriginal} prefix={currencyPrefix} suffix={currencySuffix} />
|
|
258
254
|
</div>
|
|
259
255
|
|
|
260
256
|
<a href={uri.toString()}>
|
|
@@ -266,14 +262,7 @@ const Sale: React.FC<SaleProps> = ({
|
|
|
266
262
|
className="buy-link"
|
|
267
263
|
>
|
|
268
264
|
Купить за{' '}
|
|
269
|
-
<
|
|
270
|
-
value={totalPrice}
|
|
271
|
-
displayType="text"
|
|
272
|
-
thousandSeparator={' '}
|
|
273
|
-
decimalScale={0}
|
|
274
|
-
prefix={getCurrencyPrefix(catalogItem.master?.currency || '')}
|
|
275
|
-
suffix={getCurrencySuffix(catalogItem.master?.currency || '')}
|
|
276
|
-
/>
|
|
265
|
+
<PriceFormat prefix={currencyPrefix} suffix={currencySuffix} value={totalPrice} />
|
|
277
266
|
</Button>
|
|
278
267
|
</a>
|
|
279
268
|
</div>
|
|
@@ -293,6 +282,8 @@ const Sale: React.FC<SaleProps> = ({
|
|
|
293
282
|
buttonColor,
|
|
294
283
|
buttonTextColor,
|
|
295
284
|
titleTextColor,
|
|
285
|
+
currencyPrefix,
|
|
286
|
+
currencySuffix,
|
|
296
287
|
])
|
|
297
288
|
}
|
|
298
289
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import NumberFormat from 'react-number-format'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
export const PriceFormat: React.FC<{
|
|
5
|
+
prefix: string | undefined,
|
|
6
|
+
suffix: string | undefined,
|
|
7
|
+
value: number,
|
|
8
|
+
}> = ({ prefix, suffix, value }) => (
|
|
9
|
+
<NumberFormat
|
|
10
|
+
value={value}
|
|
11
|
+
displayType="text"
|
|
12
|
+
thousandSeparator={'\u202F'}
|
|
13
|
+
decimalScale={0}
|
|
14
|
+
prefix={prefix}
|
|
15
|
+
suffix={suffix}
|
|
16
|
+
/>
|
|
17
|
+
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import NumberFormat from 'react-number-format'
|
|
3
2
|
import { OldPriceProps } from './interfaces'
|
|
4
3
|
import { OldPriceStyled } from './styles'
|
|
4
|
+
import { PriceFormat } from '../../PriceFormat'
|
|
5
5
|
|
|
6
6
|
const OldPrice: React.FC<OldPriceProps> = ({
|
|
7
7
|
price,
|
|
@@ -11,14 +11,7 @@ const OldPrice: React.FC<OldPriceProps> = ({
|
|
|
11
11
|
}) => {
|
|
12
12
|
return (
|
|
13
13
|
<OldPriceStyled component="span" {...other}>
|
|
14
|
-
<
|
|
15
|
-
value={price}
|
|
16
|
-
displayType={'text'}
|
|
17
|
-
thousandSeparator={' '}
|
|
18
|
-
decimalScale={0}
|
|
19
|
-
prefix={prefix}
|
|
20
|
-
suffix={suffix}
|
|
21
|
-
/>{' '}
|
|
14
|
+
<PriceFormat prefix={prefix} suffix={suffix} value={price} />
|
|
22
15
|
</OldPriceStyled>
|
|
23
16
|
)
|
|
24
17
|
}
|
|
@@ -14,8 +14,6 @@ import { ContainerStyled } from '../Container/styles'
|
|
|
14
14
|
import Button from '../Button'
|
|
15
15
|
import NumberFormat from 'react-number-format'
|
|
16
16
|
import { RadioGroup, RadioGroupItem } from '../RadioGroup'
|
|
17
|
-
// import { ProlongationCoursesProps } from './ProlongationCourse/interfaces'
|
|
18
|
-
// import { ProlongationCourses } from './ProlongationCourse'
|
|
19
17
|
|
|
20
18
|
/**
|
|
21
19
|
* Виджет заказа продления курса
|
|
@@ -378,7 +378,7 @@ export type OrderConditionFieldPolicy = {
|
|
|
378
378
|
kind?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
379
379
|
data?: FieldPolicy<any> | FieldReadFunction<any>
|
|
380
380
|
};
|
|
381
|
-
export type OrderCustomKeySpecifier = ('id' | 'uid' | 'price' | 'salePrice' | 'catalogPrice' | 'saleDiscount' | 'promoCodeDiscount' | 'subscriptionPrice' | 'subscriptionFirstPrice' | 'status' | 'paymentUrl' | 'partialPrices' | 'isMultiday' | 'contractOfferIds' | 'usedPartialPayment' | 'positions' | 'promoCode' | OrderCustomKeySpecifier)[];
|
|
381
|
+
export type OrderCustomKeySpecifier = ('id' | 'uid' | 'price' | 'salePrice' | 'catalogPrice' | 'saleDiscount' | 'promoCodeDiscount' | 'availableBonusDiscount' | 'subscriptionPrice' | 'subscriptionFirstPrice' | 'status' | 'paymentUrl' | 'partialPrices' | 'isMultiday' | 'contractOfferIds' | 'usedPartialPayment' | 'positions' | 'promoCode' | OrderCustomKeySpecifier)[];
|
|
382
382
|
export type OrderCustomFieldPolicy = {
|
|
383
383
|
id?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
384
384
|
uid?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
@@ -387,6 +387,7 @@ export type OrderCustomFieldPolicy = {
|
|
|
387
387
|
catalogPrice?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
388
388
|
saleDiscount?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
389
389
|
promoCodeDiscount?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
390
|
+
availableBonusDiscount?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
390
391
|
subscriptionPrice?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
391
392
|
subscriptionFirstPrice?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
392
393
|
status?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
@@ -413,13 +414,14 @@ export type OrderPositionFieldPolicy = {
|
|
|
413
414
|
item?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
414
415
|
checkoutProducts?: FieldPolicy<any> | FieldReadFunction<any>
|
|
415
416
|
};
|
|
416
|
-
export type OrderReviewCustomKeySpecifier = ('id' | 'uid' | 'rating' | 'timeCreated' | 'text' | 'meetExpectation' | 'client' | OrderReviewCustomKeySpecifier)[];
|
|
417
|
+
export type OrderReviewCustomKeySpecifier = ('id' | 'uid' | 'rating' | 'timeCreated' | 'text' | 'reply' | 'meetExpectation' | 'client' | OrderReviewCustomKeySpecifier)[];
|
|
417
418
|
export type OrderReviewCustomFieldPolicy = {
|
|
418
419
|
id?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
419
420
|
uid?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
420
421
|
rating?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
421
422
|
timeCreated?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
422
423
|
text?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
424
|
+
reply?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
423
425
|
meetExpectation?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
424
426
|
client?: FieldPolicy<any> | FieldReadFunction<any>
|
|
425
427
|
};
|
|
@@ -1885,6 +1885,18 @@
|
|
|
1885
1885
|
"inputFields": null,
|
|
1886
1886
|
"interfaces": null,
|
|
1887
1887
|
"enumValues": [
|
|
1888
|
+
{
|
|
1889
|
+
"name": "Int",
|
|
1890
|
+
"description": null,
|
|
1891
|
+
"isDeprecated": false,
|
|
1892
|
+
"deprecationReason": null
|
|
1893
|
+
},
|
|
1894
|
+
{
|
|
1895
|
+
"name": "Number",
|
|
1896
|
+
"description": null,
|
|
1897
|
+
"isDeprecated": false,
|
|
1898
|
+
"deprecationReason": null
|
|
1899
|
+
},
|
|
1888
1900
|
{
|
|
1889
1901
|
"name": "FileList",
|
|
1890
1902
|
"description": null,
|
|
@@ -3522,6 +3534,18 @@
|
|
|
3522
3534
|
"defaultValue": null,
|
|
3523
3535
|
"isDeprecated": false,
|
|
3524
3536
|
"deprecationReason": null
|
|
3537
|
+
},
|
|
3538
|
+
{
|
|
3539
|
+
"name": "timezoneName",
|
|
3540
|
+
"description": null,
|
|
3541
|
+
"type": {
|
|
3542
|
+
"kind": "SCALAR",
|
|
3543
|
+
"name": "String",
|
|
3544
|
+
"ofType": null
|
|
3545
|
+
},
|
|
3546
|
+
"defaultValue": null,
|
|
3547
|
+
"isDeprecated": false,
|
|
3548
|
+
"deprecationReason": null
|
|
3525
3549
|
}
|
|
3526
3550
|
],
|
|
3527
3551
|
"interfaces": null,
|
|
@@ -6457,7 +6481,20 @@
|
|
|
6457
6481
|
{
|
|
6458
6482
|
"name": "partialPayment",
|
|
6459
6483
|
"description": null,
|
|
6460
|
-
"args": [
|
|
6484
|
+
"args": [
|
|
6485
|
+
{
|
|
6486
|
+
"name": "fieldValues",
|
|
6487
|
+
"description": null,
|
|
6488
|
+
"type": {
|
|
6489
|
+
"kind": "SCALAR",
|
|
6490
|
+
"name": "String",
|
|
6491
|
+
"ofType": null
|
|
6492
|
+
},
|
|
6493
|
+
"defaultValue": null,
|
|
6494
|
+
"isDeprecated": false,
|
|
6495
|
+
"deprecationReason": null
|
|
6496
|
+
}
|
|
6497
|
+
],
|
|
6461
6498
|
"type": {
|
|
6462
6499
|
"kind": "OBJECT",
|
|
6463
6500
|
"name": "PartialPayment",
|
|
@@ -6629,6 +6666,18 @@
|
|
|
6629
6666
|
"isDeprecated": false,
|
|
6630
6667
|
"deprecationReason": null
|
|
6631
6668
|
},
|
|
6669
|
+
{
|
|
6670
|
+
"name": "availableBonusDiscount",
|
|
6671
|
+
"description": null,
|
|
6672
|
+
"args": [],
|
|
6673
|
+
"type": {
|
|
6674
|
+
"kind": "SCALAR",
|
|
6675
|
+
"name": "BigDecimal",
|
|
6676
|
+
"ofType": null
|
|
6677
|
+
},
|
|
6678
|
+
"isDeprecated": false,
|
|
6679
|
+
"deprecationReason": null
|
|
6680
|
+
},
|
|
6632
6681
|
{
|
|
6633
6682
|
"name": "subscriptionPrice",
|
|
6634
6683
|
"description": null,
|
|
@@ -7262,6 +7311,18 @@
|
|
|
7262
7311
|
"isDeprecated": false,
|
|
7263
7312
|
"deprecationReason": null
|
|
7264
7313
|
},
|
|
7314
|
+
{
|
|
7315
|
+
"name": "reply",
|
|
7316
|
+
"description": null,
|
|
7317
|
+
"args": [],
|
|
7318
|
+
"type": {
|
|
7319
|
+
"kind": "SCALAR",
|
|
7320
|
+
"name": "String",
|
|
7321
|
+
"ofType": null
|
|
7322
|
+
},
|
|
7323
|
+
"isDeprecated": false,
|
|
7324
|
+
"deprecationReason": null
|
|
7325
|
+
},
|
|
7265
7326
|
{
|
|
7266
7327
|
"name": "meetExpectation",
|
|
7267
7328
|
"description": null,
|
|
@@ -8645,6 +8706,18 @@
|
|
|
8645
8706
|
"defaultValue": null,
|
|
8646
8707
|
"isDeprecated": false,
|
|
8647
8708
|
"deprecationReason": null
|
|
8709
|
+
},
|
|
8710
|
+
{
|
|
8711
|
+
"name": "fieldValues",
|
|
8712
|
+
"description": null,
|
|
8713
|
+
"type": {
|
|
8714
|
+
"kind": "SCALAR",
|
|
8715
|
+
"name": "String",
|
|
8716
|
+
"ofType": null
|
|
8717
|
+
},
|
|
8718
|
+
"defaultValue": null,
|
|
8719
|
+
"isDeprecated": false,
|
|
8720
|
+
"deprecationReason": null
|
|
8648
8721
|
}
|
|
8649
8722
|
],
|
|
8650
8723
|
"type": {
|
|
@@ -230,6 +230,8 @@ export interface ClientFormQuestion {
|
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
export enum ClientFormQuestionKind {
|
|
233
|
+
INT = 'Int',
|
|
234
|
+
NUMBER = 'Number',
|
|
233
235
|
FILELIST = 'FileList',
|
|
234
236
|
MULTIVARIANT = 'MultiVariant',
|
|
235
237
|
SINGLEVARIANT = 'SingleVariant',
|
|
@@ -420,6 +422,7 @@ export interface CreateLandingOrderInput {
|
|
|
420
422
|
partialPayment?: Maybe<Scalars['Boolean']>;
|
|
421
423
|
sourceUrl: Scalars['String'];
|
|
422
424
|
timezoneOffset?: Maybe<Scalars['Int']>;
|
|
425
|
+
timezoneName?: Maybe<Scalars['String']>;
|
|
423
426
|
}
|
|
424
427
|
|
|
425
428
|
export interface CreateLandingTemplateInput {
|
|
@@ -817,6 +820,11 @@ export type OrderCatalogItemFragmentPriceWithPromoCodeArgs = {
|
|
|
817
820
|
code: Scalars['String'];
|
|
818
821
|
};
|
|
819
822
|
|
|
823
|
+
|
|
824
|
+
export type OrderCatalogItemFragmentPartialPaymentArgs = {
|
|
825
|
+
fieldValues?: Maybe<Scalars['String']>;
|
|
826
|
+
};
|
|
827
|
+
|
|
820
828
|
export interface OrderCondition {
|
|
821
829
|
__typename?: 'OrderCondition';
|
|
822
830
|
kind: Scalars['String'];
|
|
@@ -836,6 +844,7 @@ export interface OrderCustom {
|
|
|
836
844
|
catalogPrice?: Maybe<Scalars['Float']>;
|
|
837
845
|
saleDiscount?: Maybe<Scalars['BigDecimal']>;
|
|
838
846
|
promoCodeDiscount?: Maybe<Scalars['BigDecimal']>;
|
|
847
|
+
availableBonusDiscount?: Maybe<Scalars['BigDecimal']>;
|
|
839
848
|
subscriptionPrice?: Maybe<Scalars['BigDecimal']>;
|
|
840
849
|
subscriptionFirstPrice?: Maybe<Scalars['BigDecimal']>;
|
|
841
850
|
status: OrderStatus;
|
|
@@ -888,6 +897,7 @@ export interface OrderReviewCustom {
|
|
|
888
897
|
rating: Scalars['Int'];
|
|
889
898
|
timeCreated: Scalars['DateTime'];
|
|
890
899
|
text?: Maybe<Scalars['String']>;
|
|
900
|
+
reply?: Maybe<Scalars['String']>;
|
|
891
901
|
meetExpectation?: Maybe<MeetExpectation>;
|
|
892
902
|
client: Scalars['String'];
|
|
893
903
|
}
|
|
@@ -1087,6 +1097,7 @@ export type QueryCourseArgs = {
|
|
|
1087
1097
|
export type QueryOrderCatalogItemArgs = {
|
|
1088
1098
|
gid: Scalars['ID'];
|
|
1089
1099
|
code: Scalars['String'];
|
|
1100
|
+
fieldValues?: Maybe<Scalars['String']>;
|
|
1090
1101
|
};
|
|
1091
1102
|
|
|
1092
1103
|
|
package/src/utils.ts
CHANGED
|
@@ -15,10 +15,8 @@ export const roundStd = (num: number, decimalPlaces: number) => {
|
|
|
15
15
|
|
|
16
16
|
export const getCurrencyPrefix = (currency: string) => {
|
|
17
17
|
switch (currency) {
|
|
18
|
-
case 'USD':
|
|
19
|
-
|
|
20
|
-
default:
|
|
21
|
-
return ''
|
|
18
|
+
case 'USD': return '$'
|
|
19
|
+
default: return ''
|
|
22
20
|
}
|
|
23
21
|
}
|
|
24
22
|
|
|
@@ -33,7 +31,7 @@ export const getCurrencySuffix = (currency: string) => {
|
|
|
33
31
|
case 'UAH':
|
|
34
32
|
return ' ₴'
|
|
35
33
|
default:
|
|
36
|
-
return
|
|
34
|
+
return `\u202F${currency}`
|
|
37
35
|
}
|
|
38
36
|
}
|
|
39
37
|
|