@procraft/widget-order 2.31.2 → 2.32.0

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.
Files changed (31) hide show
  1. package/dist/CourseItem/FieldValues/index.js +12 -4
  2. package/dist/CourseItem/FieldValues/index.js.map +1 -1
  3. package/dist/CourseItem/OrderButton/index.js.map +1 -1
  4. package/dist/CourseItem/Reviews/ReviewsPopup/Review/index.js.map +1 -1
  5. package/dist/CourseItem/Reviews/ReviewsPopup/Review/styles.js +5 -5
  6. package/dist/CourseItem/Sales/Sale/index.js +1 -3
  7. package/dist/CourseItem/Sales/Sale/index.js.map +1 -1
  8. package/dist/CourseItem/index.js +25 -15
  9. package/dist/CourseItem/index.js.map +1 -1
  10. package/dist/hooks/usePrices/index.js +0 -8
  11. package/dist/hooks/usePrices/index.js.map +1 -1
  12. package/dist/modules/gql/generated/helpers/apollo-helpers.d.ts +8 -4
  13. package/dist/modules/gql/generated/types.d.ts +15 -0
  14. package/dist/modules/gql/generated/types.js +2 -0
  15. package/dist/modules/gql/generated/types.js.map +1 -1
  16. package/dist/tsconfig.build.tsbuildinfo +1 -1
  17. package/dist/utils.js +4 -2
  18. package/dist/utils.js.map +1 -1
  19. package/package.json +1 -1
  20. package/src/CourseItem/FieldValues/index.tsx +12 -4
  21. package/src/CourseItem/OrderButton/index.tsx +5 -1
  22. package/src/CourseItem/Reviews/ReviewsPopup/Review/index.tsx +6 -3
  23. package/src/CourseItem/Reviews/ReviewsPopup/Review/styles.ts +5 -5
  24. package/src/CourseItem/Sales/Sale/index.tsx +26 -8
  25. package/src/CourseItem/index.tsx +37 -16
  26. package/src/PriceFormat.tsx +3 -3
  27. package/src/hooks/usePrices/index.tsx +0 -12
  28. package/src/modules/gql/generated/helpers/apollo-helpers.ts +9 -5
  29. package/src/modules/gql/generated/schema.json +143 -0
  30. package/src/modules/gql/generated/types.ts +16 -0
  31. package/src/utils.ts +4 -2
package/dist/utils.js CHANGED
@@ -18,8 +18,10 @@ const roundStd = (num, decimalPlaces) => {
18
18
  exports.roundStd = roundStd;
19
19
  const getCurrencyPrefix = (currency) => {
20
20
  switch (currency) {
21
- case 'USD': return '$';
22
- default: return '';
21
+ case 'USD':
22
+ return '$';
23
+ default:
24
+ return '';
23
25
  }
24
26
  };
25
27
  exports.getCurrencyPrefix = getCurrencyPrefix;
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;IACpD,QAAQ,QAAQ,EAAE;QAChB,KAAK,KAAK,CAAC,CAAC,OAAO,GAAG,CAAA;QACtB,OAAO,CAAC,CAAC,OAAO,EAAE,CAAA;KACnB;AACH,CAAC,CAAA;AALY,QAAA,iBAAiB,qBAK7B;AAEM,MAAM,iBAAiB,GAAG,CAAC,QAAgB,EAAE,EAAE;IACpD,QAAQ,QAAQ,EAAE;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O;IAE9D,IAAI,uBAAuB,IAAI,OAAO,EAAE;QACtC,OAAO,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,UAAU,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC,CAAA;KACnE;SAAM;QACL,OAAO,UAAU,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;KAC1D;AACH,CAAC;AATD,0BASC;AAED,SAAgB,sBAAsB,CAAC,UAA2B;IAChE,IAAI,UAAU,EAAE;QACd,OAAO,gBAAM,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;KAC1C;SAAM;QACL,OAAO,EAAE,CAAA;KACV;AACH,CAAC;AAND,wDAMC;AAED,SAAgB,sBAAsB,CACpC,UAA2B,EAC3B,SAAS,GAAG,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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@procraft/widget-order",
3
3
  "description": "Order widget for landing",
4
- "version": "2.31.2",
4
+ "version": "2.32.0",
5
5
  "private": false,
6
6
  "main": "dist",
7
7
  "scripts": {
@@ -31,10 +31,10 @@ export const FieldValues: React.FC<FieldValuesProps> = ({
31
31
  /**
32
32
  * Если есть хоть один пустой элемент, не набиваем группы.
33
33
  */
34
- if (fieldValues.findIndex((n) => !n.groupName) === -1) {
35
- fieldValues.map((n) => {
36
- if (n.groupName && !groupNames.includes(n.groupName)) {
37
- groupNames.push(n.groupName)
34
+ if (!fieldValues.some((x) => !x.groupName)) {
35
+ fieldValues.map((fv) => {
36
+ if (fv.groupName && !groupNames.includes(fv.groupName)) {
37
+ groupNames.push(fv.groupName)
38
38
  }
39
39
  })
40
40
  }
@@ -93,6 +93,14 @@ export const FieldValues: React.FC<FieldValuesProps> = ({
93
93
  ) {
94
94
  return
95
95
  }
96
+ //
97
+ // if (fieldValue.parents) {
98
+ // const parents = fieldValue.parents.split(',')
99
+ // console.log('%cindex:parents', 'color: #339966;', parents, fieldsValueSelected.map(x => x.uid))
100
+ // if (!fieldsValueSelected.some(x => parents.includes(x.uid))) {
101
+ // return
102
+ // }
103
+ // }
96
104
 
97
105
  /**
98
106
  * Добавляем элемент к конечному массиву
@@ -238,7 +238,11 @@ export const OrderButton: React.FC<OrderButtonProps> = ({
238
238
  {price ? (
239
239
  <>
240
240
  {promoCode ? 'По промо за ' : 'Купить за '}
241
- <PriceFormat prefix={currencyPrefix} suffix={currencySuffix} value={price} />
241
+ <PriceFormat
242
+ prefix={currencyPrefix}
243
+ suffix={currencySuffix}
244
+ value={price}
245
+ />
242
246
  </>
243
247
  ) : (
244
248
  'Зарегистрироваться'
@@ -48,9 +48,12 @@ export const Review: React.FC<ReviewProps> = ({ review, ...other }) => {
48
48
  {review.reply && (
49
49
  <div className="reply">
50
50
  <div className="replyTitle">Ответ школы</div>
51
- <div className="replyText" dangerouslySetInnerHTML={{
52
- __html: review.reply.replace(/\n/gm, '<br/>'),
53
- }}/>
51
+ <div
52
+ className="replyText"
53
+ dangerouslySetInnerHTML={{
54
+ __html: review.reply.replace(/\n/gm, '<br/>'),
55
+ }}
56
+ />
54
57
  </div>
55
58
  )}
56
59
  </ReviewTextStyled>
@@ -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;
@@ -44,13 +44,13 @@ export const ReviewTextStyled = styled.div`
44
44
  }
45
45
 
46
46
  .reply {
47
- margin-top: 10px;
47
+ margin-top: 10px;
48
48
  }
49
49
 
50
50
  .replyTitle {
51
- color: #8398ac;
52
- font-weight: 500;
53
- font-size: 14px;
51
+ color: #8398ac;
52
+ font-weight: 500;
53
+ font-size: 14px;
54
54
  }
55
55
  `
56
56
 
@@ -56,7 +56,6 @@ const Sale: React.FC<SaleProps> = ({
56
56
  titleTextColor,
57
57
  ...other
58
58
  }) => {
59
-
60
59
  const currencyPrefix = getCurrencyPrefix(catalogItem.master?.currency || '')
61
60
  const currencySuffix = getCurrencySuffix(catalogItem.master?.currency || '')
62
61
 
@@ -183,7 +182,11 @@ const Sale: React.FC<SaleProps> = ({
183
182
  {n.name}
184
183
  </span>{' '}
185
184
  {priceWithDiscount && (
186
- <PriceFormat prefix={currencyPrefix} suffix={currencySuffix} value={price} />
185
+ <PriceFormat
186
+ prefix={currencyPrefix}
187
+ suffix={currencySuffix}
188
+ value={price}
189
+ />
187
190
  )}
188
191
  </span>
189
192
  )
@@ -240,17 +243,28 @@ const Sale: React.FC<SaleProps> = ({
240
243
  <div className="content">
241
244
  <p style={{ color: titleTextColor }} className="title">
242
245
  Дополнительно скидка{' '}
243
- {sale.benefitUnit === 'Percent'
244
- ? `${Math.round(((totalPriceOriginal - totalPrice) / totalPriceOriginal) * 100)}%`
245
- : <PriceFormat value={totalPriceOriginal - totalPrice} prefix={currencyPrefix} suffix={currencySuffix} />
246
- }
246
+ {sale.benefitUnit === 'Percent' ? (
247
+ `${Math.round(
248
+ ((totalPriceOriginal - totalPrice) / totalPriceOriginal) * 100
249
+ )}%`
250
+ ) : (
251
+ <PriceFormat
252
+ value={totalPriceOriginal - totalPrice}
253
+ prefix={currencyPrefix}
254
+ suffix={currencySuffix}
255
+ />
256
+ )}
247
257
  </p>
248
258
 
249
259
  <div className="items">{items}</div>
250
260
 
251
261
  <div className="prices">
252
262
  <div>
253
- <OldPrice price={totalPriceOriginal} prefix={currencyPrefix} suffix={currencySuffix} />
263
+ <OldPrice
264
+ price={totalPriceOriginal}
265
+ prefix={currencyPrefix}
266
+ suffix={currencySuffix}
267
+ />
254
268
  </div>
255
269
 
256
270
  <a href={uri.toString()}>
@@ -262,7 +276,11 @@ const Sale: React.FC<SaleProps> = ({
262
276
  className="buy-link"
263
277
  >
264
278
  Купить за{' '}
265
- <PriceFormat prefix={currencyPrefix} suffix={currencySuffix} value={totalPrice} />
279
+ <PriceFormat
280
+ prefix={currencyPrefix}
281
+ suffix={currencySuffix}
282
+ value={totalPrice}
283
+ />
266
284
  </Button>
267
285
  </a>
268
286
  </div>
@@ -74,34 +74,54 @@ const CourseItem: React.FC<CourseItemComponentProps> = (props) => {
74
74
  item.course?.tariffId,
75
75
  ])
76
76
 
77
- const fieldValuesInfo = usePrices({
78
- fieldValues: item.fieldValues || [],
79
- fieldsValueSelected,
80
- })
77
+ // Делаем строку, чтобы при отсутствии изменений не было пересчета
78
+ const selectedUids =
79
+ ',' + fieldsValueSelected.map((fv) => fv.uid).join(',') + ','
80
+
81
+ // Фильтруем элементы по их родителям: если родители не выбраны, то не показываем
82
+ const fieldValues = useMemo(
83
+ () =>
84
+ (item.fieldValues || []).filter((fv) => {
85
+ if (fv.parents) {
86
+ const parents = fv.parents.split(',')
87
+ if (!parents.some((x) => selectedUids.includes(`,${x},`))) {
88
+ return false
89
+ }
90
+ }
91
+ return true
92
+ }),
93
+ [item.fieldValues, selectedUids]
94
+ )
81
95
 
82
96
  /**
83
- * При инициализации надо сразу задать дефолтные выбранные элементы
97
+ * Выбираем первый элемент в группе при отображении
84
98
  */
85
99
  useEffect(() => {
86
- const fieldsValueSelected: FieldValuesProps['fieldsValueSelected'] = []
100
+ const fvSelected: FieldValuesProps['fieldsValueSelected'] = []
87
101
 
88
102
  /**
89
- * Для каждого типа поля устанавливаем по одному выбранному элементу
103
+ * Для каждого типа поля выбираем первый, если еще ничего не выбрано
90
104
  */
91
105
  for (const typeKey in CatalogFieldValueType) {
92
- const fieldValue = item.fieldValues?.find(
93
- (n) =>
94
- n.type ===
95
- CatalogFieldValueType[typeKey as keyof typeof CatalogFieldValueType]
106
+ const t =
107
+ CatalogFieldValueType[typeKey as keyof typeof CatalogFieldValueType]
108
+ const selectedByType = fieldValues.filter(
109
+ (x) => x.type === t && selectedUids.includes(`,${x.uid},`)
96
110
  )
97
111
 
98
- if (fieldValue) {
99
- fieldsValueSelected.push(fieldValue)
112
+ if (!selectedByType.length) {
113
+ selectedByType.push(
114
+ ...fieldValues.filter((x) => x.type === t).slice(0, 1)
115
+ )
100
116
  }
117
+
118
+ fvSelected.push(...selectedByType)
101
119
  }
102
120
 
103
- fieldsValueSelectedSetter(fieldsValueSelected)
104
- }, [item.fieldValues])
121
+ fieldsValueSelectedSetter(fvSelected)
122
+ }, [fieldValues, selectedUids])
123
+
124
+ const fieldValuesInfo = usePrices({ fieldValues, fieldsValueSelected })
105
125
 
106
126
  const fieldValuesByType = useMemo(() => {
107
127
  const content: JSX.Element[] = []
@@ -161,7 +181,8 @@ const CourseItem: React.FC<CourseItemComponentProps> = (props) => {
161
181
  </Typography>
162
182
 
163
183
  {item.course?.courseMeta?.courseKind === CourseKind.WEBINAR &&
164
- item.course.courseMeta.webinarStartsAt && (
184
+ item.course.courseMeta.webinarStartsAt &&
185
+ !item.course.courseMeta.webinarHasPassed && (
165
186
  <WebinarDate>
166
187
  Начало{' '}
167
188
  {formatDateOptionalTime(
@@ -2,9 +2,9 @@ import NumberFormat from 'react-number-format'
2
2
  import React from 'react'
3
3
 
4
4
  export const PriceFormat: React.FC<{
5
- prefix: string | undefined,
6
- suffix: string | undefined,
7
- value: number,
5
+ prefix: string | undefined
6
+ suffix: string | undefined
7
+ value: number
8
8
  }> = ({ prefix, suffix, value }) => (
9
9
  <NumberFormat
10
10
  value={value}
@@ -9,12 +9,6 @@ export const usePrices = ({
9
9
  fieldValues,
10
10
  fieldsValueSelected,
11
11
  }: usePricesProps) => {
12
- // const fieldValuesGroups = useMemo(() => {
13
- // return fieldValuesGroups
14
- // }, [fieldValues])
15
-
16
- // console.log('fieldValuesGroups', fieldValuesGroups)
17
-
18
12
  return useMemo(() => {
19
13
  let price = 0
20
14
  let oldPrice = 0
@@ -35,8 +29,6 @@ export const usePrices = ({
35
29
  }
36
30
 
37
31
  for (const typeKey in CatalogFieldValueType) {
38
- // console.log('typeKey', typeKey)
39
-
40
32
  fieldValues
41
33
  .filter(
42
34
  (n) =>
@@ -48,10 +40,6 @@ export const usePrices = ({
48
40
 
49
41
  fieldValuesGroups[type].fieldValues.push(fieldValue)
50
42
 
51
- // if(!fieldValuesGroups[type].fieldValueSelected) {
52
- // fieldValuesGroups[type].fieldValueSelected = fieldValue
53
- // }
54
-
55
43
  if (fieldsValueSelected.findIndex((n) => n.uid === fieldValue.uid)) {
56
44
  price += extraPay
57
45
  oldPrice += extraPayOriginal || extraPay
@@ -8,7 +8,7 @@ export type CashPaymentAliasFieldPolicy = {
8
8
  description?: FieldPolicy<any> | FieldReadFunction<any>,
9
9
  showInCart?: FieldPolicy<any> | FieldReadFunction<any>
10
10
  };
11
- export type CatalogFieldValueKeySpecifier = ('uid' | 'fieldId' | 'fieldName' | 'optionName' | 'optionValue' | 'isSelected' | 'isDisplayRemainder' | 'isDefault' | 'groupName' | 'extraPay' | 'extraPayOriginal' | 'extraPayPercentage' | 'extraWork' | 'extraWorkPercentage' | 'availableCount' | 'params' | 'type' | CatalogFieldValueKeySpecifier)[];
11
+ export type CatalogFieldValueKeySpecifier = ('uid' | 'fieldId' | 'fieldName' | 'optionName' | 'optionValue' | 'isSelected' | 'isDisplayRemainder' | 'isDefault' | 'groupName' | 'extraPay' | 'extraPayOriginal' | 'extraPayPercentage' | 'extraWork' | 'extraWorkPercentage' | 'availableCount' | 'params' | 'parents' | 'type' | CatalogFieldValueKeySpecifier)[];
12
12
  export type CatalogFieldValueFieldPolicy = {
13
13
  uid?: FieldPolicy<any> | FieldReadFunction<any>,
14
14
  fieldId?: FieldPolicy<any> | FieldReadFunction<any>,
@@ -26,6 +26,7 @@ export type CatalogFieldValueFieldPolicy = {
26
26
  extraWorkPercentage?: FieldPolicy<any> | FieldReadFunction<any>,
27
27
  availableCount?: FieldPolicy<any> | FieldReadFunction<any>,
28
28
  params?: FieldPolicy<any> | FieldReadFunction<any>,
29
+ parents?: FieldPolicy<any> | FieldReadFunction<any>,
29
30
  type?: FieldPolicy<any> | FieldReadFunction<any>
30
31
  };
31
32
  export type CatalogItemKeySpecifier = ('internalId' | CatalogItemKeySpecifier)[];
@@ -38,8 +39,9 @@ export type CheckoutPositionFieldPolicy = {
38
39
  catalogItemId?: FieldPolicy<any> | FieldReadFunction<any>,
39
40
  products?: FieldPolicy<any> | FieldReadFunction<any>
40
41
  };
41
- export type CheckoutPriceDetailsKeySpecifier = ('catalogPrice' | 'price' | 'saleDiscount' | 'promoCodeDiscount' | 'subscriptionPrice' | 'subscriptionFirstPrice' | 'hasInstallment' | 'denyReason' | CheckoutPriceDetailsKeySpecifier)[];
42
+ export type CheckoutPriceDetailsKeySpecifier = ('strokePrice' | 'catalogPrice' | 'price' | 'saleDiscount' | 'promoCodeDiscount' | 'subscriptionPrice' | 'subscriptionFirstPrice' | 'hasInstallment' | 'denyReason' | CheckoutPriceDetailsKeySpecifier)[];
42
43
  export type CheckoutPriceDetailsFieldPolicy = {
44
+ strokePrice?: FieldPolicy<any> | FieldReadFunction<any>,
43
45
  catalogPrice?: FieldPolicy<any> | FieldReadFunction<any>,
44
46
  price?: FieldPolicy<any> | FieldReadFunction<any>,
45
47
  saleDiscount?: FieldPolicy<any> | FieldReadFunction<any>,
@@ -118,13 +120,14 @@ export type CourseItemFieldPolicy = {
118
120
  prolongationDays?: FieldPolicy<any> | FieldReadFunction<any>,
119
121
  courseMeta?: FieldPolicy<any> | FieldReadFunction<any>
120
122
  };
121
- export type CourseItemMetaKeySpecifier = ('courseName' | 'courseKind' | 'courseSubKindLabel' | 'courseSubKind' | 'webinarStartsAt' | CourseItemMetaKeySpecifier)[];
123
+ export type CourseItemMetaKeySpecifier = ('courseName' | 'courseKind' | 'courseSubKindLabel' | 'courseSubKind' | 'webinarStartsAt' | 'webinarHasPassed' | CourseItemMetaKeySpecifier)[];
122
124
  export type CourseItemMetaFieldPolicy = {
123
125
  courseName?: FieldPolicy<any> | FieldReadFunction<any>,
124
126
  courseKind?: FieldPolicy<any> | FieldReadFunction<any>,
125
127
  courseSubKindLabel?: FieldPolicy<any> | FieldReadFunction<any>,
126
128
  courseSubKind?: FieldPolicy<any> | FieldReadFunction<any>,
127
- webinarStartsAt?: FieldPolicy<any> | FieldReadFunction<any>
129
+ webinarStartsAt?: FieldPolicy<any> | FieldReadFunction<any>,
130
+ webinarHasPassed?: FieldPolicy<any> | FieldReadFunction<any>
128
131
  };
129
132
  export type CoursePublicCustomKeySpecifier = ('id' | 'name' | 'uid' | 'catalogItems' | 'tariffs' | 'tariffPerFlowDataItems' | 'kind' | 'subKind' | 'subKindLabel' | CoursePublicCustomKeySpecifier)[];
130
133
  export type CoursePublicCustomFieldPolicy = {
@@ -378,12 +381,13 @@ export type OrderConditionFieldPolicy = {
378
381
  kind?: FieldPolicy<any> | FieldReadFunction<any>,
379
382
  data?: FieldPolicy<any> | FieldReadFunction<any>
380
383
  };
381
- export type OrderCustomKeySpecifier = ('id' | 'uid' | 'price' | 'salePrice' | 'catalogPrice' | 'saleDiscount' | 'promoCodeDiscount' | 'availableBonusDiscount' | 'subscriptionPrice' | 'subscriptionFirstPrice' | 'status' | 'paymentUrl' | 'partialPrices' | 'isMultiday' | 'contractOfferIds' | 'usedPartialPayment' | 'positions' | 'promoCode' | OrderCustomKeySpecifier)[];
384
+ export type OrderCustomKeySpecifier = ('id' | 'uid' | 'price' | 'salePrice' | 'strokePrice' | 'catalogPrice' | 'saleDiscount' | 'promoCodeDiscount' | 'availableBonusDiscount' | 'subscriptionPrice' | 'subscriptionFirstPrice' | 'status' | 'paymentUrl' | 'partialPrices' | 'isMultiday' | 'contractOfferIds' | 'usedPartialPayment' | 'positions' | 'promoCode' | OrderCustomKeySpecifier)[];
382
385
  export type OrderCustomFieldPolicy = {
383
386
  id?: FieldPolicy<any> | FieldReadFunction<any>,
384
387
  uid?: FieldPolicy<any> | FieldReadFunction<any>,
385
388
  price?: FieldPolicy<any> | FieldReadFunction<any>,
386
389
  salePrice?: FieldPolicy<any> | FieldReadFunction<any>,
390
+ strokePrice?: FieldPolicy<any> | FieldReadFunction<any>,
387
391
  catalogPrice?: FieldPolicy<any> | FieldReadFunction<any>,
388
392
  saleDiscount?: FieldPolicy<any> | FieldReadFunction<any>,
389
393
  promoCodeDiscount?: FieldPolicy<any> | FieldReadFunction<any>,
@@ -520,6 +520,12 @@
520
520
  "isDeprecated": false,
521
521
  "deprecationReason": null
522
522
  },
523
+ {
524
+ "name": "ChildPhone",
525
+ "description": null,
526
+ "isDeprecated": false,
527
+ "deprecationReason": null
528
+ },
523
529
  {
524
530
  "name": "Comment",
525
531
  "description": null,
@@ -532,6 +538,12 @@
532
538
  "isDeprecated": false,
533
539
  "deprecationReason": null
534
540
  },
541
+ {
542
+ "name": "ChildEmail",
543
+ "description": null,
544
+ "isDeprecated": false,
545
+ "deprecationReason": null
546
+ },
535
547
  {
536
548
  "name": "LastName",
537
549
  "description": null,
@@ -944,6 +956,18 @@
944
956
  "isDeprecated": false,
945
957
  "deprecationReason": null
946
958
  },
959
+ {
960
+ "name": "parents",
961
+ "description": null,
962
+ "args": [],
963
+ "type": {
964
+ "kind": "SCALAR",
965
+ "name": "String",
966
+ "ofType": null
967
+ },
968
+ "isDeprecated": false,
969
+ "deprecationReason": null
970
+ },
947
971
  {
948
972
  "name": "type",
949
973
  "description": "Кастомный признак типа записи",
@@ -1087,6 +1111,65 @@
1087
1111
  "defaultValue": null,
1088
1112
  "isDeprecated": false,
1089
1113
  "deprecationReason": null
1114
+ },
1115
+ {
1116
+ "name": "params",
1117
+ "description": null,
1118
+ "type": {
1119
+ "kind": "INPUT_OBJECT",
1120
+ "name": "CatalogFieldValueParamsInput",
1121
+ "ofType": null
1122
+ },
1123
+ "defaultValue": null,
1124
+ "isDeprecated": false,
1125
+ "deprecationReason": null
1126
+ }
1127
+ ],
1128
+ "interfaces": null,
1129
+ "enumValues": null,
1130
+ "possibleTypes": null
1131
+ },
1132
+ {
1133
+ "kind": "INPUT_OBJECT",
1134
+ "name": "CatalogFieldValueParamsInput",
1135
+ "description": null,
1136
+ "fields": null,
1137
+ "inputFields": [
1138
+ {
1139
+ "name": "optionUid",
1140
+ "description": null,
1141
+ "type": {
1142
+ "kind": "SCALAR",
1143
+ "name": "String",
1144
+ "ofType": null
1145
+ },
1146
+ "defaultValue": null,
1147
+ "isDeprecated": false,
1148
+ "deprecationReason": null
1149
+ },
1150
+ {
1151
+ "name": "exactDay",
1152
+ "description": null,
1153
+ "type": {
1154
+ "kind": "SCALAR",
1155
+ "name": "Int",
1156
+ "ofType": null
1157
+ },
1158
+ "defaultValue": null,
1159
+ "isDeprecated": false,
1160
+ "deprecationReason": null
1161
+ },
1162
+ {
1163
+ "name": "trialDays",
1164
+ "description": null,
1165
+ "type": {
1166
+ "kind": "SCALAR",
1167
+ "name": "Int",
1168
+ "ofType": null
1169
+ },
1170
+ "defaultValue": null,
1171
+ "isDeprecated": false,
1172
+ "deprecationReason": null
1090
1173
  }
1091
1174
  ],
1092
1175
  "interfaces": null,
@@ -1215,6 +1298,18 @@
1215
1298
  "name": "CheckoutPriceDetails",
1216
1299
  "description": null,
1217
1300
  "fields": [
1301
+ {
1302
+ "name": "strokePrice",
1303
+ "description": null,
1304
+ "args": [],
1305
+ "type": {
1306
+ "kind": "SCALAR",
1307
+ "name": "BigDecimal",
1308
+ "ofType": null
1309
+ },
1310
+ "isDeprecated": false,
1311
+ "deprecationReason": null
1312
+ },
1218
1313
  {
1219
1314
  "name": "catalogPrice",
1220
1315
  "description": null,
@@ -2454,6 +2549,18 @@
2454
2549
  },
2455
2550
  "isDeprecated": false,
2456
2551
  "deprecationReason": null
2552
+ },
2553
+ {
2554
+ "name": "webinarHasPassed",
2555
+ "description": null,
2556
+ "args": [],
2557
+ "type": {
2558
+ "kind": "SCALAR",
2559
+ "name": "String",
2560
+ "ofType": null
2561
+ },
2562
+ "isDeprecated": false,
2563
+ "deprecationReason": null
2457
2564
  }
2458
2565
  ],
2459
2566
  "inputFields": null,
@@ -5532,6 +5639,18 @@
5532
5639
  "name": "sendSmsCode",
5533
5640
  "description": "Запрос СМС кода для авторизации для существующих клиентов",
5534
5641
  "args": [
5642
+ {
5643
+ "name": "token",
5644
+ "description": "Токен Google ReCaptcha",
5645
+ "type": {
5646
+ "kind": "SCALAR",
5647
+ "name": "String",
5648
+ "ofType": null
5649
+ },
5650
+ "defaultValue": null,
5651
+ "isDeprecated": false,
5652
+ "deprecationReason": null
5653
+ },
5535
5654
  {
5536
5655
  "name": "shouldExist",
5537
5656
  "description": "Пользователь должен существовать",
@@ -6630,6 +6749,18 @@
6630
6749
  "isDeprecated": false,
6631
6750
  "deprecationReason": null
6632
6751
  },
6752
+ {
6753
+ "name": "strokePrice",
6754
+ "description": "Оригинальная цена без каких-либо скидок",
6755
+ "args": [],
6756
+ "type": {
6757
+ "kind": "SCALAR",
6758
+ "name": "Float",
6759
+ "ofType": null
6760
+ },
6761
+ "isDeprecated": false,
6762
+ "deprecationReason": null
6763
+ },
6633
6764
  {
6634
6765
  "name": "catalogPrice",
6635
6766
  "description": "Оригинальная цена без каких-либо скидок",
@@ -8805,6 +8936,18 @@
8805
8936
  "isDeprecated": false,
8806
8937
  "deprecationReason": null
8807
8938
  },
8939
+ {
8940
+ "name": "fieldValues",
8941
+ "description": "Опции товара",
8942
+ "type": {
8943
+ "kind": "SCALAR",
8944
+ "name": "String",
8945
+ "ofType": null
8946
+ },
8947
+ "defaultValue": null,
8948
+ "isDeprecated": false,
8949
+ "deprecationReason": null
8950
+ },
8808
8951
  {
8809
8952
  "name": "code",
8810
8953
  "description": "Код",
@@ -78,8 +78,10 @@ export enum CardFieldName {
78
78
  MESSENGERFACEBOOK = 'MessengerFacebook',
79
79
  ATTACHMENTS = 'Attachments',
80
80
  PHONE = 'Phone',
81
+ CHILDPHONE = 'ChildPhone',
81
82
  COMMENT = 'Comment',
82
83
  EMAIL = 'Email',
84
+ CHILDEMAIL = 'ChildEmail',
83
85
  LASTNAME = 'LastName',
84
86
  MIDDLENAME = 'MiddleName',
85
87
  ACCEPTAGREEMENTBYDEFAULT = 'AcceptAgreementByDefault',
@@ -124,6 +126,7 @@ export interface CatalogFieldValue {
124
126
  /** Количество оставшихся мест */
125
127
  availableCount?: Maybe<Scalars['Int']>;
126
128
  params?: Maybe<Scalars['String']>;
129
+ parents?: Maybe<Scalars['String']>;
127
130
  /** Кастомный признак типа записи */
128
131
  type: CatalogFieldValueType;
129
132
  }
@@ -138,6 +141,13 @@ export interface CatalogFieldValueInput {
138
141
  extraPayPercentage?: Maybe<Scalars['BigDecimal']>;
139
142
  extraWork?: Maybe<Scalars['BigDecimal']>;
140
143
  extraWorkPercentage?: Maybe<Scalars['BigDecimal']>;
144
+ params?: Maybe<CatalogFieldValueParamsInput>;
145
+ }
146
+
147
+ export interface CatalogFieldValueParamsInput {
148
+ optionUid?: Maybe<Scalars['String']>;
149
+ exactDay?: Maybe<Scalars['Int']>;
150
+ trialDays?: Maybe<Scalars['Int']>;
141
151
  }
142
152
 
143
153
  /** Тип поля */
@@ -166,6 +176,7 @@ export interface CheckoutPosition {
166
176
 
167
177
  export interface CheckoutPriceDetails {
168
178
  __typename?: 'CheckoutPriceDetails';
179
+ strokePrice?: Maybe<Scalars['BigDecimal']>;
169
180
  catalogPrice?: Maybe<Scalars['BigDecimal']>;
170
181
  price?: Maybe<Scalars['BigDecimal']>;
171
182
  saleDiscount?: Maybe<Scalars['BigDecimal']>;
@@ -295,6 +306,7 @@ export interface CourseItemMeta {
295
306
  courseSubKindLabel?: Maybe<LangRussianNoun>;
296
307
  courseSubKind: CourseSubKind;
297
308
  webinarStartsAt?: Maybe<Scalars['String']>;
309
+ webinarHasPassed?: Maybe<Scalars['String']>;
298
310
  }
299
311
 
300
312
  export enum CourseKind {
@@ -689,6 +701,7 @@ export type MutationSubmitLandingOrderArgs = {
689
701
 
690
702
 
691
703
  export type MutationSendSmsCodeArgs = {
704
+ token?: Maybe<Scalars['String']>;
692
705
  shouldExist?: Maybe<Scalars['Boolean']>;
693
706
  phone: Scalars['String'];
694
707
  promoCode?: Maybe<Scalars['String']>;
@@ -841,6 +854,8 @@ export interface OrderCustom {
841
854
  /** Цена с учетом всех скидок */
842
855
  salePrice?: Maybe<Scalars['Float']>;
843
856
  /** Оригинальная цена без каких-либо скидок */
857
+ strokePrice?: Maybe<Scalars['Float']>;
858
+ /** Оригинальная цена без каких-либо скидок */
844
859
  catalogPrice?: Maybe<Scalars['Float']>;
845
860
  saleDiscount?: Maybe<Scalars['BigDecimal']>;
846
861
  promoCodeDiscount?: Maybe<Scalars['BigDecimal']>;
@@ -1108,6 +1123,7 @@ export type QueryStaticFilesArgs = {
1108
1123
 
1109
1124
  export type QueryPromoCodeArgs = {
1110
1125
  catalogItemGid: Scalars['ID'];
1126
+ fieldValues?: Maybe<Scalars['String']>;
1111
1127
  code: Scalars['String'];
1112
1128
  saleId?: Maybe<Scalars['ID']>;
1113
1129
  };