@redneckz/wildless-cms-uni-blocks 0.14.972 → 0.14.974

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 (210) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +157 -25
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +7 -1
  5. package/bundle/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
  6. package/bundle/components/GalleryLayout/utils.d.ts +2 -2
  7. package/bundle/components/ProductBlock/ProductBlock.d.ts +4 -0
  8. package/bundle/components/ProductBlock/ProductBlockContent.d.ts +2 -2
  9. package/bundle/model/HeadlineType.d.ts +14 -1
  10. package/bundle/retail/api/createUserTaskDebit.d.ts +1 -0
  11. package/bundle/retail/api/getClaimChannel.d.ts +8 -0
  12. package/bundle/retail/hooks/useBiblioglobusDefaultRegion.d.ts +14 -0
  13. package/bundle/retail/utils/filterPaymentSystems.d.ts +4 -0
  14. package/bundle/retail/utils/hasDelivery.d.ts +10 -0
  15. package/bundle/utils/getSlugFromUrl.d.ts +1 -0
  16. package/dist/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +7 -1
  17. package/dist/components/ApplicationLeadForm/getLeadFormTaskData.js +2 -1
  18. package/dist/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
  19. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +24 -4
  20. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  21. package/dist/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
  22. package/dist/components/ApplicationLeadForm/useInitApplicationLead.js +4 -0
  23. package/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  24. package/dist/components/GalleryLayout/utils.d.ts +2 -2
  25. package/dist/components/ProductBlock/ProductBlock.d.ts +4 -0
  26. package/dist/components/ProductBlock/ProductBlock.js +16 -1
  27. package/dist/components/ProductBlock/ProductBlock.js.map +1 -1
  28. package/dist/components/ProductBlock/ProductBlockContent.d.ts +2 -2
  29. package/dist/model/HeadlineType.d.ts +14 -1
  30. package/dist/retail/api/createUserTaskDebit.d.ts +1 -0
  31. package/dist/retail/api/createUserTaskDebit.js.map +1 -1
  32. package/dist/retail/api/getClaimChannel.d.ts +8 -0
  33. package/dist/retail/api/getClaimChannel.js +9 -0
  34. package/dist/retail/api/getClaimChannel.js.map +1 -0
  35. package/dist/retail/components/Fields/AddressRetailField.js +20 -0
  36. package/dist/retail/components/Fields/AddressRetailField.js.map +1 -1
  37. package/dist/retail/components/Fields/PaymentSystemField.js +14 -2
  38. package/dist/retail/components/Fields/PaymentSystemField.js.map +1 -1
  39. package/dist/retail/components/Fields/RegionRetailField.js +20 -7
  40. package/dist/retail/components/Fields/RegionRetailField.js.map +1 -1
  41. package/dist/retail/hooks/useBiblioglobusDefaultRegion.d.ts +14 -0
  42. package/dist/retail/hooks/useBiblioglobusDefaultRegion.js +34 -0
  43. package/dist/retail/hooks/useBiblioglobusDefaultRegion.js.map +1 -0
  44. package/dist/retail/utils/filterPaymentSystems.d.ts +4 -0
  45. package/dist/retail/utils/filterPaymentSystems.js +13 -0
  46. package/dist/retail/utils/filterPaymentSystems.js.map +1 -0
  47. package/dist/retail/utils/hasDelivery.d.ts +10 -0
  48. package/dist/retail/utils/hasDelivery.js +13 -0
  49. package/dist/retail/utils/hasDelivery.js.map +1 -0
  50. package/dist/utils/getSlugFromUrl.d.ts +1 -0
  51. package/dist/utils/getSlugFromUrl.js +12 -0
  52. package/dist/utils/getSlugFromUrl.js.map +1 -0
  53. package/lib/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +7 -1
  54. package/lib/components/ApplicationLeadForm/getLeadFormTaskData.js +2 -1
  55. package/lib/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
  56. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +24 -4
  57. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  58. package/lib/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
  59. package/lib/components/ApplicationLeadForm/useInitApplicationLead.js +4 -0
  60. package/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  61. package/lib/components/GalleryLayout/utils.d.ts +2 -2
  62. package/lib/components/ProductBlock/ProductBlock.d.ts +4 -0
  63. package/lib/components/ProductBlock/ProductBlock.fixture.d.ts +1 -0
  64. package/lib/components/ProductBlock/ProductBlock.js +16 -1
  65. package/lib/components/ProductBlock/ProductBlock.js.map +1 -1
  66. package/lib/components/ProductBlock/ProductBlockContent.d.ts +2 -2
  67. package/lib/model/HeadlineType.d.ts +14 -1
  68. package/lib/retail/api/createUserTaskDebit.d.ts +1 -0
  69. package/lib/retail/api/createUserTaskDebit.js.map +1 -1
  70. package/lib/retail/api/getClaimChannel.d.ts +8 -0
  71. package/lib/retail/api/getClaimChannel.js +6 -0
  72. package/lib/retail/api/getClaimChannel.js.map +1 -0
  73. package/lib/retail/components/Fields/AddressRetailField.js +20 -0
  74. package/lib/retail/components/Fields/AddressRetailField.js.map +1 -1
  75. package/lib/retail/components/Fields/PaymentSystemField.js +14 -2
  76. package/lib/retail/components/Fields/PaymentSystemField.js.map +1 -1
  77. package/lib/retail/components/Fields/RegionRetailField.js +20 -7
  78. package/lib/retail/components/Fields/RegionRetailField.js.map +1 -1
  79. package/lib/retail/hooks/useBiblioglobusDefaultRegion.d.ts +14 -0
  80. package/lib/retail/hooks/useBiblioglobusDefaultRegion.js +31 -0
  81. package/lib/retail/hooks/useBiblioglobusDefaultRegion.js.map +1 -0
  82. package/lib/retail/utils/filterPaymentSystems.d.ts +4 -0
  83. package/lib/retail/utils/filterPaymentSystems.js +10 -0
  84. package/lib/retail/utils/filterPaymentSystems.js.map +1 -0
  85. package/lib/retail/utils/hasDelivery.d.ts +10 -0
  86. package/lib/retail/utils/hasDelivery.js +9 -0
  87. package/lib/retail/utils/hasDelivery.js.map +1 -0
  88. package/lib/utils/getSlugFromUrl.d.ts +1 -0
  89. package/lib/utils/getSlugFromUrl.js +9 -0
  90. package/lib/utils/getSlugFromUrl.js.map +1 -0
  91. package/mobile/bundle/bundle.umd.js +157 -25
  92. package/mobile/bundle/bundle.umd.min.js +1 -1
  93. package/mobile/bundle/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +7 -1
  94. package/mobile/bundle/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
  95. package/mobile/bundle/components/GalleryLayout/utils.d.ts +2 -2
  96. package/mobile/bundle/components/ProductBlock/ProductBlock.d.ts +4 -0
  97. package/mobile/bundle/components/ProductBlock/ProductBlockContent.d.ts +2 -2
  98. package/mobile/bundle/model/HeadlineType.d.ts +14 -1
  99. package/mobile/bundle/retail/api/createUserTaskDebit.d.ts +1 -0
  100. package/mobile/bundle/retail/api/getClaimChannel.d.ts +8 -0
  101. package/mobile/bundle/retail/hooks/useBiblioglobusDefaultRegion.d.ts +14 -0
  102. package/mobile/bundle/retail/utils/filterPaymentSystems.d.ts +4 -0
  103. package/mobile/bundle/retail/utils/hasDelivery.d.ts +10 -0
  104. package/mobile/bundle/utils/getSlugFromUrl.d.ts +1 -0
  105. package/mobile/dist/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +7 -1
  106. package/mobile/dist/components/ApplicationLeadForm/getLeadFormTaskData.js +2 -1
  107. package/mobile/dist/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
  108. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +24 -4
  109. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  110. package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
  111. package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js +4 -0
  112. package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  113. package/mobile/dist/components/GalleryLayout/utils.d.ts +2 -2
  114. package/mobile/dist/components/ProductBlock/ProductBlock.d.ts +4 -0
  115. package/mobile/dist/components/ProductBlock/ProductBlock.js +16 -1
  116. package/mobile/dist/components/ProductBlock/ProductBlock.js.map +1 -1
  117. package/mobile/dist/components/ProductBlock/ProductBlockContent.d.ts +2 -2
  118. package/mobile/dist/model/HeadlineType.d.ts +14 -1
  119. package/mobile/dist/retail/api/createUserTaskDebit.d.ts +1 -0
  120. package/mobile/dist/retail/api/createUserTaskDebit.js.map +1 -1
  121. package/mobile/dist/retail/api/getClaimChannel.d.ts +8 -0
  122. package/mobile/dist/retail/api/getClaimChannel.js +9 -0
  123. package/mobile/dist/retail/api/getClaimChannel.js.map +1 -0
  124. package/mobile/dist/retail/components/Fields/AddressRetailField.js +20 -0
  125. package/mobile/dist/retail/components/Fields/AddressRetailField.js.map +1 -1
  126. package/mobile/dist/retail/components/Fields/PaymentSystemField.js +14 -2
  127. package/mobile/dist/retail/components/Fields/PaymentSystemField.js.map +1 -1
  128. package/mobile/dist/retail/components/Fields/RegionRetailField.js +20 -7
  129. package/mobile/dist/retail/components/Fields/RegionRetailField.js.map +1 -1
  130. package/mobile/dist/retail/hooks/useBiblioglobusDefaultRegion.d.ts +14 -0
  131. package/mobile/dist/retail/hooks/useBiblioglobusDefaultRegion.js +34 -0
  132. package/mobile/dist/retail/hooks/useBiblioglobusDefaultRegion.js.map +1 -0
  133. package/mobile/dist/retail/utils/filterPaymentSystems.d.ts +4 -0
  134. package/mobile/dist/retail/utils/filterPaymentSystems.js +13 -0
  135. package/mobile/dist/retail/utils/filterPaymentSystems.js.map +1 -0
  136. package/mobile/dist/retail/utils/hasDelivery.d.ts +10 -0
  137. package/mobile/dist/retail/utils/hasDelivery.js +13 -0
  138. package/mobile/dist/retail/utils/hasDelivery.js.map +1 -0
  139. package/mobile/dist/utils/getSlugFromUrl.d.ts +1 -0
  140. package/mobile/dist/utils/getSlugFromUrl.js +12 -0
  141. package/mobile/dist/utils/getSlugFromUrl.js.map +1 -0
  142. package/mobile/lib/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +7 -1
  143. package/mobile/lib/components/ApplicationLeadForm/getLeadFormTaskData.js +2 -1
  144. package/mobile/lib/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
  145. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +24 -4
  146. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  147. package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.d.ts +1 -0
  148. package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js +4 -0
  149. package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  150. package/mobile/lib/components/GalleryLayout/utils.d.ts +2 -2
  151. package/mobile/lib/components/ProductBlock/ProductBlock.d.ts +4 -0
  152. package/mobile/lib/components/ProductBlock/ProductBlock.js +16 -1
  153. package/mobile/lib/components/ProductBlock/ProductBlock.js.map +1 -1
  154. package/mobile/lib/components/ProductBlock/ProductBlockContent.d.ts +2 -2
  155. package/mobile/lib/model/HeadlineType.d.ts +14 -1
  156. package/mobile/lib/retail/api/createUserTaskDebit.d.ts +1 -0
  157. package/mobile/lib/retail/api/createUserTaskDebit.js.map +1 -1
  158. package/mobile/lib/retail/api/getClaimChannel.d.ts +8 -0
  159. package/mobile/lib/retail/api/getClaimChannel.js +6 -0
  160. package/mobile/lib/retail/api/getClaimChannel.js.map +1 -0
  161. package/mobile/lib/retail/components/Fields/AddressRetailField.js +20 -0
  162. package/mobile/lib/retail/components/Fields/AddressRetailField.js.map +1 -1
  163. package/mobile/lib/retail/components/Fields/PaymentSystemField.js +14 -2
  164. package/mobile/lib/retail/components/Fields/PaymentSystemField.js.map +1 -1
  165. package/mobile/lib/retail/components/Fields/RegionRetailField.js +20 -7
  166. package/mobile/lib/retail/components/Fields/RegionRetailField.js.map +1 -1
  167. package/mobile/lib/retail/hooks/useBiblioglobusDefaultRegion.d.ts +14 -0
  168. package/mobile/lib/retail/hooks/useBiblioglobusDefaultRegion.js +31 -0
  169. package/mobile/lib/retail/hooks/useBiblioglobusDefaultRegion.js.map +1 -0
  170. package/mobile/lib/retail/utils/filterPaymentSystems.d.ts +4 -0
  171. package/mobile/lib/retail/utils/filterPaymentSystems.js +10 -0
  172. package/mobile/lib/retail/utils/filterPaymentSystems.js.map +1 -0
  173. package/mobile/lib/retail/utils/hasDelivery.d.ts +10 -0
  174. package/mobile/lib/retail/utils/hasDelivery.js +9 -0
  175. package/mobile/lib/retail/utils/hasDelivery.js.map +1 -0
  176. package/mobile/lib/utils/getSlugFromUrl.d.ts +1 -0
  177. package/mobile/lib/utils/getSlugFromUrl.js +9 -0
  178. package/mobile/lib/utils/getSlugFromUrl.js.map +1 -0
  179. package/mobile/src/components/ApplicationLeadForm/getLeadFormTaskData.ts +14 -5
  180. package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +32 -3
  181. package/mobile/src/components/ApplicationLeadForm/useInitApplicationLead.ts +6 -0
  182. package/mobile/src/components/ProductBlock/ProductBlock.tsx +57 -14
  183. package/mobile/src/components/ProductBlock/ProductBlockContent.ts +6 -2
  184. package/mobile/src/model/HeadlineType.ts +20 -1
  185. package/mobile/src/retail/api/createUserTaskDebit.ts +1 -0
  186. package/mobile/src/retail/api/getClaimChannel.ts +18 -0
  187. package/mobile/src/retail/components/Fields/AddressRetailField.tsx +26 -0
  188. package/mobile/src/retail/components/Fields/PaymentSystemField.tsx +21 -2
  189. package/mobile/src/retail/components/Fields/RegionRetailField.tsx +22 -7
  190. package/mobile/src/retail/hooks/useBiblioglobusDefaultRegion.ts +56 -0
  191. package/mobile/src/retail/utils/filterPaymentSystems.ts +14 -0
  192. package/mobile/src/retail/utils/hasDelivery.ts +22 -0
  193. package/mobile/src/utils/getSlugFromUrl.ts +10 -0
  194. package/package.json +2 -2
  195. package/src/components/ApplicationLeadForm/getLeadFormTaskData.ts +14 -5
  196. package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +32 -3
  197. package/src/components/ApplicationLeadForm/useInitApplicationLead.ts +6 -0
  198. package/src/components/ProductBlock/ProductBlock.fixture.tsx +22 -0
  199. package/src/components/ProductBlock/ProductBlock.tsx +57 -14
  200. package/src/components/ProductBlock/ProductBlockContent.ts +6 -2
  201. package/src/model/HeadlineType.ts +20 -1
  202. package/src/retail/api/createUserTaskDebit.ts +1 -0
  203. package/src/retail/api/getClaimChannel.ts +18 -0
  204. package/src/retail/components/Fields/AddressRetailField.tsx +26 -0
  205. package/src/retail/components/Fields/PaymentSystemField.tsx +21 -2
  206. package/src/retail/components/Fields/RegionRetailField.tsx +22 -7
  207. package/src/retail/hooks/useBiblioglobusDefaultRegion.ts +56 -0
  208. package/src/retail/utils/filterPaymentSystems.ts +14 -0
  209. package/src/retail/utils/hasDelivery.ts +22 -0
  210. package/src/utils/getSlugFromUrl.ts +10 -0
@@ -2,19 +2,31 @@ import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
2
2
  import { JSX } from '@redneckz/uni-jsx';
3
3
  import { useMemo, useState } from '@redneckz/uni-jsx/lib/hooks';
4
4
  import { useLocalStore } from '@redneckz/uni-jsx/lib/Store/useLocalStore';
5
+ import { useSessionStore } from '@redneckz/uni-jsx/lib/Store/useSessionStore';
5
6
  import { useAsyncEffect } from '../../../hooks/useAsyncEffect.js';
6
7
  import { RadioButtonGroupControl } from '../../../ui-kit/RadioButtonGroup/RadioButtonGroupControl.js';
8
+ import { getCardSlugFromUrl } from '../../../utils/getSlugFromUrl.js';
7
9
  import { getPaymentSystems } from '../../api/getPaymentSystems.js';
10
+ import { filterPaymentSystems } from '../../utils/filterPaymentSystems.js';
8
11
  const optionKey = (option) => option?.key;
9
12
  export const PaymentSystemField = JSX(({ field, input }) => {
10
13
  const [paymentSystemOptions, setPaymentSystemOptions] = useState([]);
11
14
  const localStore = useLocalStore();
15
+ const sessionStore = useSessionStore();
12
16
  useAsyncEffect(async () => {
13
17
  const { programId } = localStore;
14
- if (programId) {
15
- const fetchedPaymentSystems = await getPaymentSystems(programId);
18
+ if (!programId) {
19
+ return;
20
+ }
21
+ const fetchedPaymentSystems = await getPaymentSystems(programId);
22
+ const referrerUrl = sessionStore.referrerUrl;
23
+ if (!referrerUrl) {
16
24
  setPaymentSystemOptions(fetchedPaymentSystems ?? []);
25
+ return;
17
26
  }
27
+ const slug = getCardSlugFromUrl(referrerUrl);
28
+ const filteredSystems = filterPaymentSystems(fetchedPaymentSystems ?? [], slug);
29
+ setPaymentSystemOptions(filteredSystems);
18
30
  }, []);
19
31
  const items = useMemo(() => paymentSystemOptions?.map((_) => ({ id: _.key, text: _.text })) ?? [], [paymentSystemOptions]);
20
32
  return (_jsx(RadioButtonGroupControl, { label: "\u041F\u043B\u0430\u0442\u0435\u0436\u043D\u0430\u044F \u0441\u0438\u0441\u0442\u0435\u043C\u0430", orientation: "horizontal", items: items, ...field(input?.name ?? '', {
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentSystemField.js","sourceRoot":"","sources":["../../../../src/retail/components/Fields/PaymentSystemField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,0DAA0D,CAAC;AAEnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,SAAS,GAAG,CAAC,MAAoC,EAAE,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC;AAExE,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAmB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;IAC3E,MAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,GAAG,QAAQ,CAAW,EAAE,CAAC,CAAC;IAE/E,MAAM,UAAU,GAAG,aAAa,EAAyB,CAAC;IAC1D,cAAc,CAAC,KAAK,IAAI,EAAE;QACxB,MAAM,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC;QACjC,IAAI,SAAS,EAAE;YACb,MAAM,qBAAqB,GAAG,MAAM,iBAAiB,CAAC,SAAS,CAAC,CAAC;YACjE,uBAAuB,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC;SACtD;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,EAC3E,CAAC,oBAAoB,CAAC,CACvB,CAAC;IAEF,OAAO,CACL,KAAC,uBAAuB,IACtB,KAAK,EAAC,mGAAmB,EACzB,WAAW,EAAC,YAAY,EACxB,KAAK,EAAE,KAAK,KACR,KAAK,CAAC,KAAK,EAAE,IAAI,IAAI,EAAE,EAAE;YAC3B,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE,CAAC,GAAY,EAAE,EAAE,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC;SAC1E,CAAC,KACE,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"PaymentSystemField.js","sourceRoot":"","sources":["../../../../src/retail/components/Fields/PaymentSystemField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;A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IAEP,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,EAC3E,CAAC,oBAAoB,CAAC,CACvB,CAAC;IAEF,OAAO,CACL,KAAC,uBAAuB,IACtB,KAAK,EAAC,mGAAmB,EACzB,WAAW,EAAC,YAAY,EACxB,KAAK,EAAE,KAAK,KACR,KAAK,CAAC,KAAK,EAAE,IAAI,IAAI,EAAE,EAAE;YAC3B,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE,CAAC,GAAY,EAAE,EAAE,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC;SAC1E,CAAC,KACE,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -2,15 +2,19 @@ import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
2
2
  import { JSX } from '@redneckz/uni-jsx';
3
3
  import { useCallback, useEffect } from '@redneckz/uni-jsx/lib/hooks';
4
4
  import { useAsyncData } from '@redneckz/uni-jsx/lib/hooks/useAsyncData';
5
+ import { useSessionStore } from '@redneckz/uni-jsx/lib/Store/useSessionStore';
5
6
  import { SelectControl } from '../../../ui-kit/Select/SelectControl.js';
6
7
  import { getRegionsCardDelivery } from '../../api/getRegionsCardDelivery.js';
8
+ import { useBiblioglobusDefaultRegion } from '../../hooks/useBiblioglobusDefaultRegion.js';
7
9
  import { useLeadFormData } from '../../hooks/useLeadFormData.js';
8
10
  import { useRetailFormStore } from '../../hooks/useRetailFormStore.js';
11
+ import { calculateRegionHasDelivery, getRegionDeliveryStatus } from '../../utils/hasDelivery.js';
9
12
  export const RegionRetailField = JSX(({ field, input }) => {
10
13
  const { programId, productType } = useRetailFormStore();
11
14
  const { data: regions } = useLeadFormData('REGION_RF');
12
15
  const { data: regionsDelivery } = useAsyncData('regionsDelivery', getRegionsCardDelivery);
13
16
  const { data: productSettings } = useLeadFormData(getCurrentProductSettings(productType));
17
+ const sessionStore = useSessionStore();
14
18
  const isDebit = productType === 'debitCard';
15
19
  const isSalaryCard = programId === '38';
16
20
  const isEsiaAuth = Boolean(field('esiaAccountTypeCd')?.value?.key);
@@ -19,17 +23,26 @@ export const RegionRetailField = JSX(({ field, input }) => {
19
23
  const handleChangeRegion = field('regionRetail')?.onChange;
20
24
  const handleChangeRegionHasDelivery = field('regionHasDelivery')?.onChange;
21
25
  const handleChangeMethodObtain = field('methodObtain')?.onChange;
26
+ useBiblioglobusDefaultRegion({
27
+ referrerUrl: sessionStore.referrerUrl ?? undefined,
28
+ regions,
29
+ regionsDelivery,
30
+ onRegionChange: handleChangeRegion,
31
+ onRegionHasDeliveryChange: handleChangeRegionHasDelivery,
32
+ onMethodObtainChange: handleChangeMethodObtain,
33
+ });
22
34
  const onChange = useCallback((value) => {
23
- const regionHasDelivery = isDebit
24
- ? isEsiaAuth &&
25
- !isSalaryCard &&
26
- isDeliveryActive &&
27
- regionsDelivery?.find((_) => _.regionCode === value.key)?.deliveryFlg
28
- : isDeliveryActive && regionsDelivery?.find((_) => _.regionCode === value.key)?.deliveryFlg;
35
+ const regionHasDelivery = calculateRegionHasDelivery({
36
+ isDebit,
37
+ isEsiaAuth,
38
+ isSalaryCard,
39
+ isDeliveryActive,
40
+ regionDelivery: getRegionDeliveryStatus(regionsDelivery, value),
41
+ });
29
42
  handleChangeRegionHasDelivery?.(regionHasDelivery);
30
43
  handleChangeMethodObtain?.(regionHasDelivery ? 'courier' : 'office');
31
44
  handleChangeRegion?.(value);
32
- }, [regionsDelivery, isDeliveryActive, isEsiaAuth]);
45
+ }, [calculateRegionHasDelivery]);
33
46
  useEffect(() => {
34
47
  if (!isEsiaAuth && isDebit) {
35
48
  handleChangeRegionHasDelivery?.(false);
@@ -1 +1 @@
1
- {"version":3,"file":"RegionRetailField.js","sourceRoot":"","sources":["../../../../src/retail/components/Fields/RegionRetailField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAIxE,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAmB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;IAC1E,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,kBAAkB,EAAE,CAAC;IACxD,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;IACvD,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,YAAY,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,CAAC;IAC1F,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,eAAe,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAC,CAAC;IAC1F,MAAM,OAAO,GAAG,WAAW,KAAK,WAAW,CAAC;IAC5C,MAAM,YAAY,GAAG,SAAS,KAAK,IAAI,CAAC;IACxC,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;IACnE,MAAM,aAAa,GAAG,OAAO,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,C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'../model/LeadFormData';
3
+ export declare type RegionDelivery = {
4
+ regionCode: string;
5
+ deliveryFlg: boolean;
6
+ };
7
+ export declare const useBiblioglobusDefaultRegion: (args: {
8
+ referrerUrl?: string | undefined;
9
+ regions?: DictionaryItem[] | undefined;
10
+ regionsDelivery?: RegionDelivery[] | undefined;
11
+ onRegionChange?: ((option: Option) => void) | undefined;
12
+ onRegionHasDeliveryChange?: ((value: boolean) => void) | undefined;
13
+ onMethodObtainChange?: ((value: string) => void) | undefined;
14
+ }) => void;
@@ -0,0 +1,31 @@
1
+ import { useEffect } from '@redneckz/uni-jsx/lib/hooks';
2
+ import { getCardSlugFromUrl } from '../../utils/getSlugFromUrl.js';
3
+ import { BIBLIOGLOBUS_SLUG } from '../utils/filterPaymentSystems.js';
4
+ export const useBiblioglobusDefaultRegion = (args) => {
5
+ const { referrerUrl, regions, regionsDelivery, onRegionChange, onRegionHasDeliveryChange, onMethodObtainChange, } = args;
6
+ const slug = referrerUrl ? getCardSlugFromUrl(referrerUrl) : '';
7
+ const defaultRegion = regions?.find((region) => region.key === 'REGION_77');
8
+ const regionHasDelivery = Boolean(regionsDelivery?.find((rd) => rd.regionCode === 'REGION_77')?.deliveryFlg);
9
+ const isReady = Boolean(referrerUrl &&
10
+ regions &&
11
+ regionsDelivery &&
12
+ slug === BIBLIOGLOBUS_SLUG &&
13
+ defaultRegion?.key &&
14
+ defaultRegion?.value);
15
+ useEffect(() => {
16
+ if (!isReady || !defaultRegion || !defaultRegion.key || !defaultRegion.value) {
17
+ return;
18
+ }
19
+ onRegionChange?.({ key: defaultRegion.key, text: defaultRegion.value });
20
+ onRegionHasDeliveryChange?.(regionHasDelivery);
21
+ onMethodObtainChange?.(regionHasDelivery ? 'courier' : 'office');
22
+ }, [
23
+ isReady,
24
+ defaultRegion,
25
+ regionHasDelivery,
26
+ onRegionChange,
27
+ onRegionHasDeliveryChange,
28
+ onMethodObtainChange,
29
+ ]);
30
+ };
31
+ //# sourceMappingURL=useBiblioglobusDefaultRegion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBiblioglobusDefaultRegion.js","sourceRoot":"","sources":["../../../src/retail/hooks/useBiblioglobusDefaultRegion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAIlE,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,IAO5C,EAAE,EAAE;IACH,MAAM,EACJ,WAAW,EACX,OAAO,EACP,eAAe,EACf,cAAc,EACd,yBAAyB,EACzB,oBAAoB,GACrB,GAAG,IAAI,CAAC;IAET,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAChE,MAAM,aAAa,GAAG,OAAO,EAAE,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,KAAK,WAAW,CAAC,CAAC;IAC5E,MAAM,iBAAiB,GAAG,OAAO,CAC/B,eAAe,EAAE,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,UAAU,KAAK,WAAW,CAAC,EAAE,WAAW,CAC1E,CAAC;IACF,MAAM,OAAO,GAAG,OAAO,CACrB,WAAW;QACT,OAAO;QACP,eAAe;QACf,IAAI,KAAK,iBAAiB;QAC1B,aAAa,EAAE,GAAG;QAClB,aAAa,EAAE,KAAK,CACvB,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE;YAC5E,OAAO;SACR;QAED,cAAc,EAAE,CAAC,EAAE,GAAG,EAAE,aAAa,CAAC,GAAG,EAAE,IAAI,EAAE,aAAa,CAAC,KAAK,EAAE,CAAC,CAAC;QACxE,yBAAyB,EAAE,CAAC,iBAAiB,CAAC,CAAC;QAC/C,oBAAoB,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IACnE,CAAC,EAAE;QACD,OAAO;QACP,aAAa;QACb,iBAAiB;QACjB,cAAc;QACd,yBAAyB;QACzB,oBAAoB;KACrB,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type Option } from '../../ui-kit/Select/Option';
2
+ declare const BIBLIOGLOBUS_SLUG = "biblioglobus";
3
+ export declare const filterPaymentSystems: (systems: Option[], slug: string | null) => Option[];
4
+ export { BIBLIOGLOBUS_SLUG };
@@ -0,0 +1,10 @@
1
+ const BIBLIOGLOBUS_SLUG = 'biblioglobus';
2
+ const UNIONPAY_TEXT = 'UnionPay';
3
+ export const filterPaymentSystems = (systems, slug) => {
4
+ if (slug !== BIBLIOGLOBUS_SLUG) {
5
+ return systems;
6
+ }
7
+ return systems.filter((system) => system.text === UNIONPAY_TEXT);
8
+ };
9
+ export { BIBLIOGLOBUS_SLUG };
10
+ //# sourceMappingURL=filterPaymentSystems.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterPaymentSystems.js","sourceRoot":"","sources":["../../../src/retail/utils/filterPaymentSystems.ts"],"names":[],"mappings":"AAEA,MAAM,iBAAiB,GAAG,cAAc,CAAC;AACzC,MAAM,aAAa,GAAG,UAAU,CAAC;AAEjC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAiB,EAAE,IAAmB,EAAY,EAAE;IACvF,IAAI,IAAI,KAAK,iBAAiB,EAAE;QAC9B,OAAO,OAAO,CAAC;KAChB;IAED,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC;AACnE,CAAC,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { type Option } from '../../ui-kit/Select/Option';
2
+ import { type RegionDelivery } from '../hooks/useBiblioglobusDefaultRegion';
3
+ export declare const getRegionDeliveryStatus: (regionsDelivery: RegionDelivery[] | undefined, value: Option) => boolean | undefined;
4
+ export declare const calculateRegionHasDelivery: (args: {
5
+ isDebit: boolean;
6
+ isEsiaAuth: boolean;
7
+ isSalaryCard: boolean;
8
+ isDeliveryActive: boolean;
9
+ regionDelivery?: boolean;
10
+ }) => boolean | undefined;
@@ -0,0 +1,9 @@
1
+ export const getRegionDeliveryStatus = (regionsDelivery, value) => regionsDelivery?.find((_) => _.regionCode === String(value.key))?.deliveryFlg;
2
+ export const calculateRegionHasDelivery = (args) => {
3
+ const { isDebit, isEsiaAuth, isSalaryCard, isDeliveryActive, regionDelivery } = args;
4
+ if (isDebit) {
5
+ return isEsiaAuth && !isSalaryCard && isDeliveryActive && regionDelivery;
6
+ }
7
+ return isDeliveryActive && regionDelivery;
8
+ };
9
+ //# sourceMappingURL=hasDelivery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hasDelivery.js","sourceRoot":"","sources":["../../../src/retail/utils/hasDelivery.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,eAA6C,EAC7C,KAAa,EACb,EAAE,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,CAAC;AAEnF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAM1C,EAAE,EAAE;IACH,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;IACrF,IAAI,OAAO,EAAE;QACX,OAAO,UAAU,IAAI,CAAC,YAAY,IAAI,gBAAgB,IAAI,cAAc,CAAC;KAC1E;IAED,OAAO,gBAAgB,IAAI,cAAc,CAAC;AAC5C,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function getCardSlugFromUrl(url: string): string | null;
@@ -0,0 +1,9 @@
1
+ export function getCardSlugFromUrl(url) {
2
+ const lastSegment = url.split('/').filter(Boolean).pop();
3
+ if (!lastSegment) {
4
+ return null;
5
+ }
6
+ const parts = lastSegment.split('-');
7
+ return parts.length > 1 ? parts[parts.length - 1] : null;
8
+ }
9
+ //# sourceMappingURL=getSlugFromUrl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getSlugFromUrl.js","sourceRoot":"","sources":["../../src/utils/getSlugFromUrl.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,kBAAkB,CAAC,GAAW;IAC5C,MAAM,WAAW,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC;IACzD,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,IAAI,CAAC;KACb;IAED,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAErC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3D,CAAC"}
@@ -83,11 +83,19 @@ export const getParticipant = ({
83
83
  };
84
84
  };
85
85
 
86
- export const getDebitLeadFormTaskData = (
87
- formData: LeadFormState,
88
- programId: string,
89
- marketingInfo: MarketingInfo | null,
90
- ): CreateUserTaskDebitBody => {
86
+ type GetDebitLeadFormTaskDataProps = {
87
+ formData: LeadFormState;
88
+ programId: string;
89
+ marketingInfo: MarketingInfo | null;
90
+ claimChannelCode?: string;
91
+ };
92
+
93
+ export const getDebitLeadFormTaskData = ({
94
+ formData,
95
+ programId,
96
+ marketingInfo,
97
+ claimChannelCode,
98
+ }: GetDebitLeadFormTaskDataProps): CreateUserTaskDebitBody => {
91
99
  const { name, surname, middleName, limitedBirthday, phone, email } = formData;
92
100
  const taskSource = getTaskSource(marketingInfo?.utm_source);
93
101
 
@@ -111,6 +119,7 @@ export const getDebitLeadFormTaskData = (
111
119
  ],
112
120
  marketingInfo,
113
121
  },
122
+ ...(claimChannelCode ? { claimChannelCode } : {}),
114
123
  };
115
124
  };
116
125
 
@@ -8,6 +8,7 @@ import { createDraftTask } from '../../retail/api/createDraftTask';
8
8
  import { createParticipant } from '../../retail/api/createParticipant';
9
9
  import { createUserProfile } from '../../retail/api/createUserProfile';
10
10
  import { createUserTaskDebit } from '../../retail/api/createUserTaskDebit';
11
+ import { getClaimChannel } from '../../retail/api/getClaimChannel';
11
12
  import { getLastTaskStatus } from '../../retail/api/getLastTaskStatus';
12
13
  import { getTaskById } from '../../retail/api/getTaskById';
13
14
  import { saveReferalInfo } from '../../retail/api/saveReferalInfo';
@@ -18,9 +19,11 @@ import { useDraftDialog } from '../../retail/components/DraftDialog/useDraftDial
18
19
  import { VerifyPhoneDialog } from '../../retail/components/VerifyPhoneDialog/VerifyPhoneDialog';
19
20
  import { type FormRetailConsents, type LeadFormState } from '../../retail/model/LeadFormState';
20
21
  import { type ReferalData } from '../../retail/model/ReferalData';
22
+ import { BIBLIOGLOBUS_SLUG } from '../../retail/utils/filterPaymentSystems';
21
23
  import { getUpdateUserProfileData } from '../../retail/utils/getUpdateUserProfile';
22
24
  import { useDialog } from '../../ui-kit/DialogManager/useDialog';
23
25
  import { formatPhone } from '../../utils/formatPhone';
26
+ import { getCardSlugFromUrl } from '../../utils/getSlugFromUrl';
24
27
  import { type ProductType } from './ApplicationLeadFormContent';
25
28
  import { productTypeToConsentsMap } from './consents';
26
29
  import { getCreditLeadFormTaskData, getDebitLeadFormTaskData } from './getLeadFormTaskData';
@@ -76,6 +79,7 @@ export const useApplicationLeadApi = ({
76
79
 
77
80
  const referalData = leadFormStore.referalData;
78
81
  const marketingInfo = sessionStore.marketingInfo;
82
+ const referrerUrl = sessionStore.referrerUrl;
79
83
 
80
84
  if (!profileId) {
81
85
  throw new Error();
@@ -91,6 +95,7 @@ export const useApplicationLeadApi = ({
91
95
  marketingInfo,
92
96
  saveUserData,
93
97
  sendAspects,
98
+ referrerUrl,
94
99
  });
95
100
  verifyPhoneDialog.close();
96
101
  if (productType === 'debitCard') {
@@ -214,6 +219,18 @@ const getAcceptedConsents = (formData: LeadFormState, productType: ProductType):
214
219
  .map((_) => consents[_]?.text);
215
220
  };
216
221
 
222
+ // Padding line to fix eslint padding-line-between-statements
223
+
224
+ const computeClaimChannel = async (slug: string | null): Promise<string | undefined> => {
225
+ if (slug !== BIBLIOGLOBUS_SLUG) {
226
+ return undefined;
227
+ }
228
+
229
+ const claimData = await getClaimChannel();
230
+
231
+ return claimData.find((item) => item.key === slug)?.code;
232
+ };
233
+
217
234
  const updateUserData = async ({
218
235
  programId,
219
236
  profileId,
@@ -223,6 +240,7 @@ const updateUserData = async ({
223
240
  marketingInfo,
224
241
  saveUserData,
225
242
  sendAspects,
243
+ referrerUrl,
226
244
  }: {
227
245
  programId: string;
228
246
  profileId: number;
@@ -232,17 +250,27 @@ const updateUserData = async ({
232
250
  marketingInfo: MarketingInfo | null;
233
251
  saveUserData: (userData: UserData) => void;
234
252
  sendAspects: (profileId: number, taskId: number) => void;
253
+ referrerUrl: string | null;
235
254
  }) => {
236
- let taskId: number;
237
- let participantId: number;
238
255
  const transformedConsents = transformConsentsFields(formData, productType);
256
+ const slug = getCardSlugFromUrl(referrerUrl as string);
239
257
 
240
258
  await updateUserProfile(getUpdateUserProfileData(profileId, formData, transformedConsents));
241
259
 
242
260
  try {
261
+ let taskId: number;
262
+ let participantId: number;
263
+
243
264
  if (productType === 'debitCard') {
265
+ const claimChannelCode = await computeClaimChannel(slug);
266
+
244
267
  const debitData = await createUserTaskDebit(
245
- getDebitLeadFormTaskData(formData, programId, marketingInfo),
268
+ getDebitLeadFormTaskData({
269
+ formData,
270
+ programId,
271
+ marketingInfo,
272
+ claimChannelCode,
273
+ }),
246
274
  );
247
275
 
248
276
  taskId = debitData.taskId;
@@ -265,6 +293,7 @@ const updateUserData = async ({
265
293
  }),
266
294
  );
267
295
  }
296
+
268
297
  if (referalData?.referalCode) {
269
298
  await saveReferalInfo({
270
299
  taskId,
@@ -25,6 +25,7 @@ type InitApplicationLeadProps = {
25
25
  export interface ApplicationLeadStore {
26
26
  marketingInfo: MarketingInfo | null;
27
27
  isNewMicroservice: boolean | null;
28
+ referrerUrl: string | null;
28
29
  }
29
30
 
30
31
  export const useInitApplicationLead = ({
@@ -78,6 +79,11 @@ export const useInitApplicationLead = ({
78
79
 
79
80
  sessionStore.marketingInfo = getMarketingInfo(queryFromStorage, sessionStore);
80
81
  sessionStore.isNewMicroservice = isNewMicroservice || null;
82
+
83
+ const referrer = globalThis.document.referrer;
84
+ if (referrer) {
85
+ sessionStore.referrerUrl = referrer as string;
86
+ }
81
87
  }, [queryFromStorage]);
82
88
 
83
89
  useEffect(() => {
@@ -1,25 +1,68 @@
1
+ import type { JSONRefObject } from '../../data/JSONRefObject';
2
+ import { type DynamicDescription } from '../../model/HeadlineType';
1
3
  import { BaseProductTile } from '../../ui-kit/BaseProductTile/BaseProductTile';
2
4
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
3
5
  import { UniBlock } from '../../UniBlock/UniBlock';
4
6
  import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
7
+ import { saveSessionQuery } from '../../utils/getSessionQuery';
5
8
  import { style } from '../../utils/style';
6
9
  import { type ProductBlockContent } from './ProductBlockContent';
7
10
 
8
- export interface ProductBlockProps extends UniBlockProps, ProductBlockContent {}
11
+ export interface ProductBlockProps extends UniBlockProps, ProductBlockContent {
12
+ dynamicDescriptionSource?: JSONRefObject & {
13
+ list?: Record<string, string>[];
14
+ };
15
+ }
9
16
 
10
17
  export const ProductBlock = UniBlock<ProductBlockProps>(
11
- ({ className, padding, defaultPadding, ...rest }) => (
12
- <BlockWrapper
13
- className={style('overflow-hidden flex flex-col gap-3xl box-border', className)}
14
- padding="p-0"
15
- {...rest}
16
- >
17
- <BaseProductTile
18
- defaultPadding={defaultPadding || 'p-6xl'}
19
- padding={padding}
20
- className="grow h-full"
18
+ ({
19
+ className,
20
+ padding,
21
+ defaultPadding,
22
+ dynamicUtmDescription,
23
+ dynamicDescriptionSource,
24
+ description,
25
+ ...rest
26
+ }) => {
27
+ const formatDescription = getFormatDescription(
28
+ dynamicUtmDescription,
29
+ dynamicDescriptionSource?.list,
30
+ description,
31
+ );
32
+
33
+ return (
34
+ <BlockWrapper
35
+ className={style('overflow-hidden flex flex-col gap-3xl box-border', className)}
36
+ padding="p-0"
21
37
  {...rest}
22
- />
23
- </BlockWrapper>
24
- ),
38
+ >
39
+ <BaseProductTile
40
+ defaultPadding={defaultPadding || 'p-6xl'}
41
+ padding={padding}
42
+ description={formatDescription}
43
+ className="grow h-full"
44
+ {...rest}
45
+ />
46
+ </BlockWrapper>
47
+ );
48
+ },
25
49
  );
50
+
51
+ const getFormatDescription = (
52
+ dynamicUtmDescription: DynamicDescription = {},
53
+ valuesList: Record<string, string>[] = [],
54
+ description = '',
55
+ ) => {
56
+ const { utm, value } = dynamicUtmDescription;
57
+ const sessionQuery = saveSessionQuery();
58
+ const utmValue = getUtmValue(utm ?? 'utm_source', sessionQuery);
59
+ const dynamicValue = valuesList.find((item) => item?.id === utmValue)?.value;
60
+
61
+ return dynamicValue ? description.replace(String(value), dynamicValue) : description;
62
+ };
63
+
64
+ const getUtmValue = (utm: string, queryString: string) => {
65
+ const params = new URLSearchParams(queryString);
66
+
67
+ return params.get(utm);
68
+ };
@@ -1,4 +1,7 @@
1
- import { type AdditionalDescriptionProps } from '../../model/HeadlineType';
1
+ import {
2
+ type AdditionalDescriptionProps,
3
+ type DynamicDescriptionProps,
4
+ } from '../../model/HeadlineType';
2
5
  import { type BaseProductTileContent } from '../../ui-kit/BaseProductTile/BaseProductTileContent';
3
6
  import { type UniBlockContent } from '../../UniBlock/UniBlockProps';
4
7
 
@@ -7,7 +10,8 @@ import { type UniBlockContent } from '../../UniBlock/UniBlockProps';
7
10
  */
8
11
  export type ProductBlockContent = UniBlockContent &
9
12
  BaseProductTileContent &
10
- AdditionalDescriptionProps & {
13
+ AdditionalDescriptionProps &
14
+ DynamicDescriptionProps & {
11
15
  /** @title Отображать кнопку возврата */
12
16
  backwardButton?: boolean;
13
17
  };
@@ -1,3 +1,4 @@
1
+ import { type JSONRefObject } from '../data/JSONRefObject';
1
2
  import { type TextAlign } from '../ui-kit/Text/TextProps';
2
3
 
3
4
  /**
@@ -45,8 +46,26 @@ export type AdditionalDescriptionProps = {
45
46
  additionalDescription?: string;
46
47
  };
47
48
 
48
- export type HeadlineCommonProps = TitleProps & DescriptionProps & AlignProps;
49
+ export type DynamicDescriptionProps = {
50
+ /** @title Динамическое описание по значению utm-метки */
51
+ dynamicUtmDescription?: DynamicDescription;
52
+ /** @title Справочник значений */
53
+ dynamicDescriptionSource?: JSONRefObject;
54
+ };
55
+
56
+ export type HeadlineCommonProps = TitleProps &
57
+ DescriptionProps &
58
+ AlignProps &
59
+ AdditionalDescriptionProps &
60
+ DynamicDescriptionProps;
49
61
 
50
62
  export type HeadlineProps = HeadlineCommonProps & {
51
63
  headlineVersion?: HeadlineVersion;
52
64
  };
65
+
66
+ export type DynamicDescription = {
67
+ /** @title utm-метка */
68
+ utm?: string;
69
+ /** @title Заменяемый текст */
70
+ value?: string;
71
+ };
@@ -11,6 +11,7 @@ export type CreateUserTaskDebitBody = {
11
11
  participants: Participant[];
12
12
  marketingInfo?: Nullable<MarketingInfo>;
13
13
  };
14
+ claimChannelCode?: string;
14
15
  };
15
16
 
16
17
  export type CreateUserTaskDebitResponse = {
@@ -0,0 +1,18 @@
1
+ import { fetchRetailJSON } from './doRequest';
2
+
3
+ export type GetClaimChannelResponse = {
4
+ code: string;
5
+ deliveryEmail: string;
6
+ description: string;
7
+ id: number;
8
+ key: string;
9
+ };
10
+
11
+ export const getClaimChannel = async (): Promise<GetClaimChannelResponse[]> => {
12
+ const res = await fetchRetailJSON<GetClaimChannelResponse[]>(
13
+ 'light-api-cash/v1/claimChannel/',
14
+ 'GET',
15
+ );
16
+
17
+ return res || ([] as GetClaimChannelResponse[]);
18
+ };
@@ -1,18 +1,26 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import { useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
3
+ import { useSessionStore } from '@redneckz/uni-jsx/lib/Store/useSessionStore';
3
4
  import { getOfficePoint } from '../../../components/OfficesAtmsMap/renderOfficeCard';
4
5
  import { useOfficesAtmsMapData } from '../../../components/OfficesAtmsMap/useOfficesAtmsMapData';
5
6
  import { ClientOnly } from '../../../ui-kit/ClientOnly';
6
7
  import { type CustomFieldProps } from '../../../ui-kit/FormField/CustomFieldProps';
7
8
  import { SelectControl } from '../../../ui-kit/Select/SelectControl';
8
9
  import { YandexMap } from '../../../ui-kit/YandexMap/YandexMap';
10
+ import { getCardSlugFromUrl } from '../../../utils/getSlugFromUrl';
9
11
  import { fetchRegionOffices, type OfficeType } from '../../api/regionOffices';
10
12
  import { useLeadFormData } from '../../hooks/useLeadFormData';
13
+ import { BIBLIOGLOBUS_SLUG } from '../../utils/filterPaymentSystems';
14
+
15
+ const BIBLIOGLOBUS_OFFICE_ID = '714680716';
11
16
 
12
17
  export const AddressRetailField = JSX<CustomFieldProps>(({ field, input }) => {
13
18
  const [offices, setOffices] = useState<OfficeType[]>([]);
14
19
  const { data } = useLeadFormData('REGION_RF');
15
20
 
21
+ const sessionStore = useSessionStore<{ referrerUrl?: string }>();
22
+ const referrerUrl = sessionStore.referrerUrl;
23
+
16
24
  const regionValue = field('regionRetail')?.value || {};
17
25
  const addressField = field(input?.name ?? '');
18
26
 
@@ -27,6 +35,24 @@ export const AddressRetailField = JSX<CustomFieldProps>(({ field, input }) => {
27
35
  }
28
36
  }, [regionValue.key]);
29
37
 
38
+ // Логика для biblioglobus - выбор отделения по умолчанию
39
+ useEffect(() => {
40
+ if (!referrerUrl || !offices.length) {
41
+ return;
42
+ }
43
+
44
+ const slug = getCardSlugFromUrl(referrerUrl);
45
+ if (slug === BIBLIOGLOBUS_SLUG) {
46
+ const defaultOffice = offices.find(
47
+ (office) => office.id?.toString() === BIBLIOGLOBUS_OFFICE_ID,
48
+ );
49
+ addressField.onChange?.({
50
+ key: defaultOffice?.id?.toString() || '',
51
+ text: defaultOffice?.address || '',
52
+ });
53
+ }
54
+ }, [referrerUrl, offices]);
55
+
30
56
  const { points } = useOfficesAtmsMapData({
31
57
  data: offices,
32
58
  filtrationState: {},