@procraft/widget-order 2.30.14 → 2.30.16
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/README.md +4 -0
- 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 +6 -13
- 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 +16 -15
- 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 +1 -1
- package/dist/CourseItem/Reviews/ReviewsPopup/Review/index.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 +6 -6
- package/dist/CourseItem/Reviews/index.js.map +1 -1
- package/dist/CourseItem/Sales/Sale/index.js +9 -8
- 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 +19 -12
- package/dist/CourseItem/index.js.map +1 -1
- package/dist/components/DateFormat/index.js +1 -1
- package/dist/components/DateFormat/index.js.map +1 -1
- 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 -10
- 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 +12 -4
- 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 +2 -2
- 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 +25 -4
- package/dist/modules/gql/generated/types.d.ts +15 -5
- package/dist/modules/gql/generated/types.js +1 -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 +18 -12
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/CourseItem/Materials/index.tsx +1 -8
- package/src/CourseItem/OrderButton/index.tsx +4 -3
- package/src/CourseItem/OrderButton/interfaces.ts +1 -1
- package/src/CourseItem/Reviews/index.tsx +1 -2
- package/src/CourseItem/Sales/Sale/index.tsx +8 -3
- package/src/CourseItem/index.tsx +47 -22
- package/src/components/OldPrice/index.tsx +6 -1
- package/src/components/RadioGroup/index.tsx +9 -1
- package/src/hooks/usePrices/index.tsx +1 -1
- package/src/interfaces/CourseFragment.ts +7 -6
- package/src/modules/gql/generated/helpers/apollo-helpers.ts +25 -4
- package/src/modules/gql/generated/schema.json +59 -32
- package/src/modules/gql/generated/types.ts +18 -5
- package/src/utils.ts +21 -11
package/dist/utils.js
CHANGED
|
@@ -18,17 +18,23 @@ const roundStd = (num, decimalPlaces) => {
|
|
|
18
18
|
exports.roundStd = roundStd;
|
|
19
19
|
const getCurrencyPrefix = (currency) => {
|
|
20
20
|
switch (currency) {
|
|
21
|
-
case 'USD':
|
|
22
|
-
|
|
21
|
+
case 'USD':
|
|
22
|
+
return '$';
|
|
23
|
+
default:
|
|
24
|
+
return '';
|
|
23
25
|
}
|
|
24
26
|
};
|
|
25
27
|
exports.getCurrencyPrefix = getCurrencyPrefix;
|
|
26
28
|
const getCurrencySuffix = (currency) => {
|
|
27
29
|
switch (currency) {
|
|
28
|
-
case 'RUB':
|
|
29
|
-
|
|
30
|
-
case '
|
|
31
|
-
|
|
30
|
+
case 'RUB':
|
|
31
|
+
return ' ₽';
|
|
32
|
+
case 'USD':
|
|
33
|
+
return '';
|
|
34
|
+
case 'KZT':
|
|
35
|
+
return ' ₸';
|
|
36
|
+
case 'UAH':
|
|
37
|
+
return ' ₴';
|
|
32
38
|
default:
|
|
33
39
|
return ` ${currency}`;
|
|
34
40
|
}
|
|
@@ -36,8 +42,8 @@ const getCurrencySuffix = (currency) => {
|
|
|
36
42
|
exports.getCurrencySuffix = getCurrencySuffix;
|
|
37
43
|
function isNowYear(dateMoment) {
|
|
38
44
|
if (dateMoment) {
|
|
39
|
-
dateMoment = moment_1.default(dateMoment);
|
|
40
|
-
return moment_1.default().year() === dateMoment.year();
|
|
45
|
+
dateMoment = (0, moment_1.default)(dateMoment);
|
|
46
|
+
return (0, moment_1.default)().year() === dateMoment.year();
|
|
41
47
|
}
|
|
42
48
|
else {
|
|
43
49
|
return false;
|
|
@@ -49,7 +55,7 @@ exports.isNowYear = isNowYear;
|
|
|
49
55
|
*/
|
|
50
56
|
function formatDate(dateMoment) {
|
|
51
57
|
if (dateMoment) {
|
|
52
|
-
dateMoment = moment_1.default(dateMoment);
|
|
58
|
+
dateMoment = (0, moment_1.default)(dateMoment);
|
|
53
59
|
if (!isNowYear(dateMoment)) {
|
|
54
60
|
return dateMoment.format('D MMMM YYYY');
|
|
55
61
|
}
|
|
@@ -67,13 +73,13 @@ function hasTime(dateMoment, optionalTimeReplacement = '00:00') {
|
|
|
67
73
|
return !(dateMoment.hours() === 23 && dateMoment.minutes() === 59);
|
|
68
74
|
}
|
|
69
75
|
else {
|
|
70
|
-
return
|
|
76
|
+
return dateMoment.hours() * 60 + dateMoment.minutes() > 0;
|
|
71
77
|
}
|
|
72
78
|
}
|
|
73
79
|
exports.hasTime = hasTime;
|
|
74
80
|
function formatTimeHoursMinutes(dateMoment) {
|
|
75
81
|
if (dateMoment) {
|
|
76
|
-
return moment_1.default(dateMoment).format('HH:mm');
|
|
82
|
+
return (0, moment_1.default)(dateMoment).format('HH:mm');
|
|
77
83
|
}
|
|
78
84
|
else {
|
|
79
85
|
return '';
|
|
@@ -82,7 +88,7 @@ function formatTimeHoursMinutes(dateMoment) {
|
|
|
82
88
|
exports.formatTimeHoursMinutes = formatTimeHoursMinutes;
|
|
83
89
|
function formatDateOptionalTime(dateMoment, separator = ' в ', optionalTimeReplacement = '00:00') {
|
|
84
90
|
if (dateMoment) {
|
|
85
|
-
const timestamp = moment_1.default(dateMoment);
|
|
91
|
+
const timestamp = (0, moment_1.default)(dateMoment);
|
|
86
92
|
if (hasTime(timestamp, optionalTimeReplacement)) {
|
|
87
93
|
return `${formatDate(timestamp)}${separator}${formatTimeHoursMinutes(timestamp)}`;
|
|
88
94
|
}
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuC;
|
|
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,G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CAAC,CAAA;SAC7B;KACF;SAAM;QACL,OAAO,EAAE,CAAA;KACV;AACH,CAAC;AAlBD,wDAkBC"}
|
package/package.json
CHANGED
|
@@ -106,14 +106,7 @@ const Materials: React.FC<MaterialsProps> = ({
|
|
|
106
106
|
{showAllButton}
|
|
107
107
|
</MaterialsStyled>
|
|
108
108
|
)
|
|
109
|
-
}, [
|
|
110
|
-
materials,
|
|
111
|
-
renderBenefit,
|
|
112
|
-
showAllButton,
|
|
113
|
-
backgroundColor,
|
|
114
|
-
textColor,
|
|
115
|
-
linkColor,
|
|
116
|
-
])
|
|
109
|
+
}, [materials, renderBenefit, showAllButton, backgroundColor, textColor])
|
|
117
110
|
}
|
|
118
111
|
|
|
119
112
|
export default Materials
|
|
@@ -4,7 +4,7 @@ import React, {
|
|
|
4
4
|
useCallback,
|
|
5
5
|
useEffect,
|
|
6
6
|
useMemo,
|
|
7
|
-
useState
|
|
7
|
+
useState,
|
|
8
8
|
} from 'react'
|
|
9
9
|
import NumberFormat from 'react-number-format'
|
|
10
10
|
import Button from '../../components/Button'
|
|
@@ -14,13 +14,13 @@ import Typography from '../../components/Typography'
|
|
|
14
14
|
import {
|
|
15
15
|
COLORED_TEXT_DEFAULT_COLOR,
|
|
16
16
|
TITLE_BG_DEFAULT_COLOR,
|
|
17
|
-
TITLE_TEXT_DEFAULT_COLOR
|
|
17
|
+
TITLE_TEXT_DEFAULT_COLOR,
|
|
18
18
|
} from '../../constants/colors'
|
|
19
19
|
import { useOrderLink } from '../../hooks/useOrderLink'
|
|
20
20
|
import { formatFreeLabel } from '../../models/Course'
|
|
21
21
|
import {
|
|
22
22
|
CourseTariffPriceDetailsChangeByTimeItem,
|
|
23
|
-
CourseTariffPriceKind
|
|
23
|
+
CourseTariffPriceKind,
|
|
24
24
|
} from '../../modules/gql/generated/types'
|
|
25
25
|
import { getCurrencyPrefix, getCurrencySuffix } from '../../utils'
|
|
26
26
|
import { OrderButtonProps } from './interfaces'
|
|
@@ -196,6 +196,7 @@ export const OrderButton: React.FC<OrderButtonProps> = ({
|
|
|
196
196
|
if (catalogItem.priceWithPromoCode && catalogItem.promoCode?.code) {
|
|
197
197
|
price = catalogItem.priceWithPromoCode
|
|
198
198
|
promoCode = catalogItem.promoCode.code
|
|
199
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
199
200
|
uri = `${uri}&promoCode=${promoCode}`
|
|
200
201
|
}
|
|
201
202
|
|
|
@@ -14,7 +14,6 @@ export const Reviews: React.FC<ReviewsProps> = ({
|
|
|
14
14
|
textColor,
|
|
15
15
|
...other
|
|
16
16
|
}) => {
|
|
17
|
-
|
|
18
17
|
const [active, activeSetter] = useState(false)
|
|
19
18
|
|
|
20
19
|
useEffect(() => {
|
|
@@ -71,5 +70,5 @@ export const Reviews: React.FC<ReviewsProps> = ({
|
|
|
71
70
|
/>
|
|
72
71
|
</>
|
|
73
72
|
)
|
|
74
|
-
}, [
|
|
73
|
+
}, [reviewsCount, item, other, toggleActive, textColor, active])
|
|
75
74
|
}
|
|
@@ -175,7 +175,8 @@ const Sale: React.FC<SaleProps> = ({
|
|
|
175
175
|
items.push(
|
|
176
176
|
<span key={n.id} className="item">
|
|
177
177
|
<span className="item--name">
|
|
178
|
-
{index > 0 ? '+ ' : ''}
|
|
178
|
+
{index > 0 ? '+ ' : ''}
|
|
179
|
+
{n.name}
|
|
179
180
|
</span>{' '}
|
|
180
181
|
{priceWithDiscount ? (
|
|
181
182
|
<span>
|
|
@@ -241,8 +242,12 @@ const Sale: React.FC<SaleProps> = ({
|
|
|
241
242
|
</div>
|
|
242
243
|
<div className="content">
|
|
243
244
|
<p style={{ color: titleTextColor }} className="title">
|
|
244
|
-
Дополнительно Скидка
|
|
245
|
-
{sale.benefitUnit === 'Percent'
|
|
245
|
+
Дополнительно Скидка
|
|
246
|
+
{sale.benefitUnit === 'Percent'
|
|
247
|
+
? `${Math.round(
|
|
248
|
+
((totalPriceOriginal - totalPrice) / totalPriceOriginal) * 100
|
|
249
|
+
)}%`
|
|
250
|
+
: `${totalPriceOriginal - totalPrice} ₽`}
|
|
246
251
|
</p>
|
|
247
252
|
|
|
248
253
|
<div className="items">{items}</div>
|
package/src/CourseItem/index.tsx
CHANGED
|
@@ -1,19 +1,31 @@
|
|
|
1
|
-
import React, {useEffect, useMemo, useState} from 'react'
|
|
1
|
+
import React, { useEffect, useMemo, useState } from 'react'
|
|
2
2
|
import Typography from '../components/Typography'
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import {
|
|
4
|
+
COLORED_TEXT_DEFAULT_COLOR,
|
|
5
|
+
CONTENT_BG_DEFAULT_COLOR,
|
|
6
|
+
CONTENT_TEXT_DEFAULT_COLOR,
|
|
7
|
+
EXTRA_BG_DEFAULT_COLOR,
|
|
8
|
+
MAIN_BG_DEFAULT_COLOR,
|
|
9
|
+
TITLE_BG_DEFAULT_COLOR,
|
|
10
|
+
TITLE_TEXT_DEFAULT_COLOR,
|
|
11
|
+
} from '../constants/colors'
|
|
12
|
+
import { usePrices } from '../hooks/usePrices'
|
|
13
|
+
import {
|
|
14
|
+
CatalogFieldValueType,
|
|
15
|
+
CourseKind,
|
|
16
|
+
CourseSubKind,
|
|
17
|
+
} from '../modules/gql/generated/types'
|
|
18
|
+
import { FieldValuesProps } from './FieldValues/interfaces'
|
|
19
|
+
import { FieldValuesByType } from './FieldValuesByType'
|
|
20
|
+
import { CourseItemComponentProps } from './interfaces'
|
|
9
21
|
import Materials from './Materials'
|
|
10
|
-
import {OrderButton} from './OrderButton'
|
|
11
|
-
import {Reviews} from './Reviews'
|
|
22
|
+
import { OrderButton } from './OrderButton'
|
|
23
|
+
import { Reviews } from './Reviews'
|
|
12
24
|
import Sales from './Sales'
|
|
13
|
-
import {BoxStyled, NavigationStyled, WidgetStyled} from './styles'
|
|
14
|
-
import {formatCourseSubKindLabel} from '../models/Course'
|
|
15
|
-
import styled from 'styled-components'
|
|
16
|
-
import {formatDateOptionalTime} from '../utils'
|
|
25
|
+
import { BoxStyled, NavigationStyled, WidgetStyled } from './styles'
|
|
26
|
+
import { formatCourseSubKindLabel } from '../models/Course'
|
|
27
|
+
import styled from 'styled-components'
|
|
28
|
+
import { formatDateOptionalTime } from '../utils'
|
|
17
29
|
|
|
18
30
|
const CourseItem: React.FC<CourseItemComponentProps> = (props) => {
|
|
19
31
|
const {
|
|
@@ -137,9 +149,7 @@ const CourseItem: React.FC<CourseItemComponentProps> = (props) => {
|
|
|
137
149
|
<WidgetStyled style={{ backgroundColor: mainBgColor }}>
|
|
138
150
|
<NavigationStyled style={{ backgroundColor: titleBgColor }}>
|
|
139
151
|
<Typography>
|
|
140
|
-
<span style={{ color: titleTextColor }}>
|
|
141
|
-
{title}
|
|
142
|
-
</span>
|
|
152
|
+
<span style={{ color: titleTextColor }}>{title}</span>
|
|
143
153
|
</Typography>
|
|
144
154
|
</NavigationStyled>
|
|
145
155
|
|
|
@@ -150,12 +160,22 @@ const CourseItem: React.FC<CourseItemComponentProps> = (props) => {
|
|
|
150
160
|
: course.name}
|
|
151
161
|
</Typography>
|
|
152
162
|
|
|
153
|
-
{
|
|
154
|
-
|
|
155
|
-
|
|
163
|
+
{item.course?.courseMeta?.courseKind === CourseKind.WEBINAR &&
|
|
164
|
+
item.course.courseMeta.webinarStartsAt && (
|
|
165
|
+
<WebinarDate>
|
|
166
|
+
Начало{' '}
|
|
167
|
+
{formatDateOptionalTime(
|
|
168
|
+
item.course.courseMeta.webinarStartsAt
|
|
169
|
+
)}
|
|
170
|
+
</WebinarDate>
|
|
171
|
+
)}
|
|
156
172
|
|
|
157
173
|
{ratesVisible && item.reviewsCount ? (
|
|
158
|
-
<Reviews
|
|
174
|
+
<Reviews
|
|
175
|
+
textColor={coloredTextColor}
|
|
176
|
+
reviewsCount={item.reviewsCount}
|
|
177
|
+
item={item}
|
|
178
|
+
/>
|
|
159
179
|
) : null}
|
|
160
180
|
|
|
161
181
|
{tariff ? (
|
|
@@ -201,13 +221,18 @@ const CourseItem: React.FC<CourseItemComponentProps> = (props) => {
|
|
|
201
221
|
}, [
|
|
202
222
|
item,
|
|
203
223
|
course,
|
|
224
|
+
mainBgColor,
|
|
225
|
+
titleBgColor,
|
|
226
|
+
titleTextColor,
|
|
227
|
+
ratesVisible,
|
|
228
|
+
coloredTextColor,
|
|
229
|
+
contentBgColor,
|
|
230
|
+
contentTextColor,
|
|
204
231
|
extraBenefits,
|
|
205
232
|
materialsLimit,
|
|
206
233
|
fieldValuesByType,
|
|
207
234
|
orderLink,
|
|
208
235
|
fieldsValueSelected,
|
|
209
|
-
ratesVisible,
|
|
210
|
-
style,
|
|
211
236
|
])
|
|
212
237
|
}
|
|
213
238
|
|
|
@@ -3,7 +3,12 @@ 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> = ({
|
|
6
|
+
const OldPrice: React.FC<OldPriceProps> = ({
|
|
7
|
+
price,
|
|
8
|
+
prefix,
|
|
9
|
+
suffix,
|
|
10
|
+
...other
|
|
11
|
+
}) => {
|
|
7
12
|
return (
|
|
8
13
|
<OldPriceStyled component="span" {...other}>
|
|
9
14
|
<NumberFormat
|
|
@@ -58,5 +58,13 @@ export const RadioGroup: React.FC<RadioGroupProps> = ({
|
|
|
58
58
|
})}
|
|
59
59
|
</RadioGroupStyled>
|
|
60
60
|
)
|
|
61
|
-
}, [
|
|
61
|
+
}, [
|
|
62
|
+
items,
|
|
63
|
+
other,
|
|
64
|
+
value,
|
|
65
|
+
onRowClick,
|
|
66
|
+
checkedBgColor,
|
|
67
|
+
checkedTextColor,
|
|
68
|
+
onChange,
|
|
69
|
+
])
|
|
62
70
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
Maybe,
|
|
3
|
+
OrderCatalogItemFragment,
|
|
4
|
+
CourseTariffFlowPublic,
|
|
5
|
+
CourseTariffFlowBehaviour,
|
|
6
|
+
CourseKind,
|
|
7
|
+
CourseSubKind,
|
|
8
|
+
LangRussianNoun,
|
|
8
9
|
} from '../modules/gql/generated/types'
|
|
9
10
|
|
|
10
11
|
export type CourseFragmentCatalogItem = {
|
|
@@ -336,14 +336,23 @@ export type OrderCatalogItemMasterFieldPolicy = {
|
|
|
336
336
|
uid?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
337
337
|
currency?: FieldPolicy<any> | FieldReadFunction<any>
|
|
338
338
|
};
|
|
339
|
-
export type OrderCatalogItemOrgKeySpecifier = ('
|
|
339
|
+
export type OrderCatalogItemOrgKeySpecifier = ('contacts' | 'sendingTransport' | OrderCatalogItemOrgKeySpecifier)[];
|
|
340
340
|
export type OrderCatalogItemOrgFieldPolicy = {
|
|
341
|
-
id?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
342
|
-
uid?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
343
|
-
currency?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
344
341
|
contacts?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
345
342
|
sendingTransport?: FieldPolicy<any> | FieldReadFunction<any>
|
|
346
343
|
};
|
|
344
|
+
export type OrderCatalogItemOrgContactsKeySpecifier = ('primaryEmail' | OrderCatalogItemOrgContactsKeySpecifier)[];
|
|
345
|
+
export type OrderCatalogItemOrgContactsFieldPolicy = {
|
|
346
|
+
primaryEmail?: FieldPolicy<any> | FieldReadFunction<any>
|
|
347
|
+
};
|
|
348
|
+
export type OrderCatalogItemOrgEmailTransportKeySpecifier = ('email' | OrderCatalogItemOrgEmailTransportKeySpecifier)[];
|
|
349
|
+
export type OrderCatalogItemOrgEmailTransportFieldPolicy = {
|
|
350
|
+
email?: FieldPolicy<any> | FieldReadFunction<any>
|
|
351
|
+
};
|
|
352
|
+
export type OrderCatalogItemOrgSendingTransportKeySpecifier = ('emailTransport' | OrderCatalogItemOrgSendingTransportKeySpecifier)[];
|
|
353
|
+
export type OrderCatalogItemOrgSendingTransportFieldPolicy = {
|
|
354
|
+
emailTransport?: FieldPolicy<any> | FieldReadFunction<any>
|
|
355
|
+
};
|
|
347
356
|
export type OrderCatalogItem_FragmentKeySpecifier = ('id' | 'uid' | 'name' | 'title' | 'unitPrice' | 'unitPriceOriginal' | 'org' | 'master' | 'course' | 'Tariff' | 'sales' | 'promoCode' | 'priceWithPromoCode' | 'reviewsCount' | 'reviews' | 'fieldValues' | 'partialPayment' | OrderCatalogItem_FragmentKeySpecifier)[];
|
|
348
357
|
export type OrderCatalogItem_FragmentFieldPolicy = {
|
|
349
358
|
id?: FieldPolicy<any> | FieldReadFunction<any>,
|
|
@@ -776,6 +785,18 @@ export type TypedTypePolicies = TypePolicies & {
|
|
|
776
785
|
keyFields?: false | OrderCatalogItemOrgKeySpecifier | (() => undefined | OrderCatalogItemOrgKeySpecifier),
|
|
777
786
|
fields?: OrderCatalogItemOrgFieldPolicy,
|
|
778
787
|
},
|
|
788
|
+
OrderCatalogItemOrgContacts?: Omit<TypePolicy, "fields" | "keyFields"> & {
|
|
789
|
+
keyFields?: false | OrderCatalogItemOrgContactsKeySpecifier | (() => undefined | OrderCatalogItemOrgContactsKeySpecifier),
|
|
790
|
+
fields?: OrderCatalogItemOrgContactsFieldPolicy,
|
|
791
|
+
},
|
|
792
|
+
OrderCatalogItemOrgEmailTransport?: Omit<TypePolicy, "fields" | "keyFields"> & {
|
|
793
|
+
keyFields?: false | OrderCatalogItemOrgEmailTransportKeySpecifier | (() => undefined | OrderCatalogItemOrgEmailTransportKeySpecifier),
|
|
794
|
+
fields?: OrderCatalogItemOrgEmailTransportFieldPolicy,
|
|
795
|
+
},
|
|
796
|
+
OrderCatalogItemOrgSendingTransport?: Omit<TypePolicy, "fields" | "keyFields"> & {
|
|
797
|
+
keyFields?: false | OrderCatalogItemOrgSendingTransportKeySpecifier | (() => undefined | OrderCatalogItemOrgSendingTransportKeySpecifier),
|
|
798
|
+
fields?: OrderCatalogItemOrgSendingTransportFieldPolicy,
|
|
799
|
+
},
|
|
779
800
|
OrderCatalogItem_Fragment?: Omit<TypePolicy, "fields" | "keyFields"> & {
|
|
780
801
|
keyFields?: false | OrderCatalogItem_FragmentKeySpecifier | (() => undefined | OrderCatalogItem_FragmentKeySpecifier),
|
|
781
802
|
fields?: OrderCatalogItem_FragmentFieldPolicy,
|
|
@@ -520,6 +520,12 @@
|
|
|
520
520
|
"isDeprecated": false,
|
|
521
521
|
"deprecationReason": null
|
|
522
522
|
},
|
|
523
|
+
{
|
|
524
|
+
"name": "Comment",
|
|
525
|
+
"description": null,
|
|
526
|
+
"isDeprecated": false,
|
|
527
|
+
"deprecationReason": null
|
|
528
|
+
},
|
|
523
529
|
{
|
|
524
530
|
"name": "Email",
|
|
525
531
|
"description": null,
|
|
@@ -6075,15 +6081,15 @@
|
|
|
6075
6081
|
"description": null,
|
|
6076
6082
|
"fields": [
|
|
6077
6083
|
{
|
|
6078
|
-
"name": "
|
|
6084
|
+
"name": "contacts",
|
|
6079
6085
|
"description": null,
|
|
6080
6086
|
"args": [],
|
|
6081
6087
|
"type": {
|
|
6082
6088
|
"kind": "NON_NULL",
|
|
6083
6089
|
"name": null,
|
|
6084
6090
|
"ofType": {
|
|
6085
|
-
"kind": "
|
|
6086
|
-
"name": "
|
|
6091
|
+
"kind": "OBJECT",
|
|
6092
|
+
"name": "OrderCatalogItemOrgContacts",
|
|
6087
6093
|
"ofType": null
|
|
6088
6094
|
}
|
|
6089
6095
|
},
|
|
@@ -6091,60 +6097,81 @@
|
|
|
6091
6097
|
"deprecationReason": null
|
|
6092
6098
|
},
|
|
6093
6099
|
{
|
|
6094
|
-
"name": "
|
|
6100
|
+
"name": "sendingTransport",
|
|
6095
6101
|
"description": null,
|
|
6096
6102
|
"args": [],
|
|
6097
6103
|
"type": {
|
|
6098
|
-
"kind": "
|
|
6099
|
-
"name":
|
|
6100
|
-
"ofType":
|
|
6101
|
-
"kind": "SCALAR",
|
|
6102
|
-
"name": "Int",
|
|
6103
|
-
"ofType": null
|
|
6104
|
-
}
|
|
6104
|
+
"kind": "OBJECT",
|
|
6105
|
+
"name": "OrderCatalogItemOrgSendingTransport",
|
|
6106
|
+
"ofType": null
|
|
6105
6107
|
},
|
|
6106
6108
|
"isDeprecated": false,
|
|
6107
6109
|
"deprecationReason": null
|
|
6108
|
-
}
|
|
6110
|
+
}
|
|
6111
|
+
],
|
|
6112
|
+
"inputFields": null,
|
|
6113
|
+
"interfaces": [],
|
|
6114
|
+
"enumValues": null,
|
|
6115
|
+
"possibleTypes": null
|
|
6116
|
+
},
|
|
6117
|
+
{
|
|
6118
|
+
"kind": "OBJECT",
|
|
6119
|
+
"name": "OrderCatalogItemOrgContacts",
|
|
6120
|
+
"description": null,
|
|
6121
|
+
"fields": [
|
|
6109
6122
|
{
|
|
6110
|
-
"name": "
|
|
6123
|
+
"name": "primaryEmail",
|
|
6111
6124
|
"description": null,
|
|
6112
6125
|
"args": [],
|
|
6113
6126
|
"type": {
|
|
6114
|
-
"kind": "
|
|
6115
|
-
"name":
|
|
6116
|
-
"ofType":
|
|
6117
|
-
"kind": "SCALAR",
|
|
6118
|
-
"name": "String",
|
|
6119
|
-
"ofType": null
|
|
6120
|
-
}
|
|
6127
|
+
"kind": "SCALAR",
|
|
6128
|
+
"name": "String",
|
|
6129
|
+
"ofType": null
|
|
6121
6130
|
},
|
|
6122
6131
|
"isDeprecated": false,
|
|
6123
6132
|
"deprecationReason": null
|
|
6124
|
-
}
|
|
6133
|
+
}
|
|
6134
|
+
],
|
|
6135
|
+
"inputFields": null,
|
|
6136
|
+
"interfaces": [],
|
|
6137
|
+
"enumValues": null,
|
|
6138
|
+
"possibleTypes": null
|
|
6139
|
+
},
|
|
6140
|
+
{
|
|
6141
|
+
"kind": "OBJECT",
|
|
6142
|
+
"name": "OrderCatalogItemOrgEmailTransport",
|
|
6143
|
+
"description": null,
|
|
6144
|
+
"fields": [
|
|
6125
6145
|
{
|
|
6126
|
-
"name": "
|
|
6146
|
+
"name": "email",
|
|
6127
6147
|
"description": null,
|
|
6128
6148
|
"args": [],
|
|
6129
6149
|
"type": {
|
|
6130
|
-
"kind": "
|
|
6131
|
-
"name":
|
|
6132
|
-
"ofType":
|
|
6133
|
-
"kind": "OBJECT",
|
|
6134
|
-
"name": "ContactsProfile",
|
|
6135
|
-
"ofType": null
|
|
6136
|
-
}
|
|
6150
|
+
"kind": "SCALAR",
|
|
6151
|
+
"name": "String",
|
|
6152
|
+
"ofType": null
|
|
6137
6153
|
},
|
|
6138
6154
|
"isDeprecated": false,
|
|
6139
6155
|
"deprecationReason": null
|
|
6140
|
-
}
|
|
6156
|
+
}
|
|
6157
|
+
],
|
|
6158
|
+
"inputFields": null,
|
|
6159
|
+
"interfaces": [],
|
|
6160
|
+
"enumValues": null,
|
|
6161
|
+
"possibleTypes": null
|
|
6162
|
+
},
|
|
6163
|
+
{
|
|
6164
|
+
"kind": "OBJECT",
|
|
6165
|
+
"name": "OrderCatalogItemOrgSendingTransport",
|
|
6166
|
+
"description": null,
|
|
6167
|
+
"fields": [
|
|
6141
6168
|
{
|
|
6142
|
-
"name": "
|
|
6169
|
+
"name": "emailTransport",
|
|
6143
6170
|
"description": null,
|
|
6144
6171
|
"args": [],
|
|
6145
6172
|
"type": {
|
|
6146
6173
|
"kind": "OBJECT",
|
|
6147
|
-
"name": "
|
|
6174
|
+
"name": "OrderCatalogItemOrgEmailTransport",
|
|
6148
6175
|
"ofType": null
|
|
6149
6176
|
},
|
|
6150
6177
|
"isDeprecated": false,
|
|
@@ -78,6 +78,7 @@ export enum CardFieldName {
|
|
|
78
78
|
MESSENGERFACEBOOK = 'MessengerFacebook',
|
|
79
79
|
ATTACHMENTS = 'Attachments',
|
|
80
80
|
PHONE = 'Phone',
|
|
81
|
+
COMMENT = 'Comment',
|
|
81
82
|
EMAIL = 'Email',
|
|
82
83
|
LASTNAME = 'LastName',
|
|
83
84
|
MIDDLENAME = 'MiddleName',
|
|
@@ -757,11 +758,23 @@ export interface OrderCatalogItemMaster {
|
|
|
757
758
|
|
|
758
759
|
export interface OrderCatalogItemOrg {
|
|
759
760
|
__typename?: 'OrderCatalogItemOrg';
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
761
|
+
contacts: OrderCatalogItemOrgContacts;
|
|
762
|
+
sendingTransport?: Maybe<OrderCatalogItemOrgSendingTransport>;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
export interface OrderCatalogItemOrgContacts {
|
|
766
|
+
__typename?: 'OrderCatalogItemOrgContacts';
|
|
767
|
+
primaryEmail?: Maybe<Scalars['String']>;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
export interface OrderCatalogItemOrgEmailTransport {
|
|
771
|
+
__typename?: 'OrderCatalogItemOrgEmailTransport';
|
|
772
|
+
email?: Maybe<Scalars['String']>;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
export interface OrderCatalogItemOrgSendingTransport {
|
|
776
|
+
__typename?: 'OrderCatalogItemOrgSendingTransport';
|
|
777
|
+
emailTransport?: Maybe<OrderCatalogItemOrgEmailTransport>;
|
|
765
778
|
}
|
|
766
779
|
|
|
767
780
|
export interface OrderCatalogItemFragment {
|
package/src/utils.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import moment, { Moment } from 'moment'
|
|
2
2
|
type DateTime = Moment | Date | string
|
|
3
3
|
|
|
4
|
-
|
|
5
4
|
export const roundByStep = (v: number, s = 1.0) => {
|
|
6
5
|
const inv = 1.0 / s
|
|
7
6
|
return Math.round(v * inv) / inv
|
|
@@ -16,17 +15,23 @@ export const roundStd = (num: number, decimalPlaces: number) => {
|
|
|
16
15
|
|
|
17
16
|
export const getCurrencyPrefix = (currency: string) => {
|
|
18
17
|
switch (currency) {
|
|
19
|
-
case 'USD':
|
|
20
|
-
|
|
18
|
+
case 'USD':
|
|
19
|
+
return '$'
|
|
20
|
+
default:
|
|
21
|
+
return ''
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
export const getCurrencySuffix = (currency: string) => {
|
|
25
26
|
switch (currency) {
|
|
26
|
-
case 'RUB':
|
|
27
|
-
|
|
28
|
-
case '
|
|
29
|
-
|
|
27
|
+
case 'RUB':
|
|
28
|
+
return ' ₽'
|
|
29
|
+
case 'USD':
|
|
30
|
+
return ''
|
|
31
|
+
case 'KZT':
|
|
32
|
+
return ' ₸'
|
|
33
|
+
case 'UAH':
|
|
34
|
+
return ' ₴'
|
|
30
35
|
default:
|
|
31
36
|
return ` ${currency}`
|
|
32
37
|
}
|
|
@@ -60,11 +65,14 @@ export function formatDate(dateMoment: DateTime | null): string {
|
|
|
60
65
|
}
|
|
61
66
|
}
|
|
62
67
|
|
|
63
|
-
export function hasTime(
|
|
68
|
+
export function hasTime(
|
|
69
|
+
dateMoment: Moment,
|
|
70
|
+
optionalTimeReplacement: DateOptionalTimeReplacement = '00:00'
|
|
71
|
+
): boolean {
|
|
64
72
|
if (optionalTimeReplacement == '23:59') {
|
|
65
73
|
return !(dateMoment.hours() === 23 && dateMoment.minutes() === 59)
|
|
66
74
|
} else {
|
|
67
|
-
return
|
|
75
|
+
return dateMoment.hours() * 60 + dateMoment.minutes() > 0
|
|
68
76
|
}
|
|
69
77
|
}
|
|
70
78
|
|
|
@@ -79,13 +87,15 @@ export function formatTimeHoursMinutes(dateMoment: DateTime | null): string {
|
|
|
79
87
|
export function formatDateOptionalTime(
|
|
80
88
|
dateMoment: DateTime | null,
|
|
81
89
|
separator = ' в ',
|
|
82
|
-
optionalTimeReplacement: DateOptionalTimeReplacement = '00:00'
|
|
90
|
+
optionalTimeReplacement: DateOptionalTimeReplacement = '00:00'
|
|
83
91
|
): string {
|
|
84
92
|
if (dateMoment) {
|
|
85
93
|
const timestamp = moment(dateMoment)
|
|
86
94
|
|
|
87
95
|
if (hasTime(timestamp, optionalTimeReplacement)) {
|
|
88
|
-
return `${formatDate(timestamp)}${separator}${formatTimeHoursMinutes(
|
|
96
|
+
return `${formatDate(timestamp)}${separator}${formatTimeHoursMinutes(
|
|
97
|
+
timestamp
|
|
98
|
+
)}`
|
|
89
99
|
} else {
|
|
90
100
|
return formatDate(timestamp)
|
|
91
101
|
}
|