@redneckz/wildless-cms-uni-blocks 0.14.1056 → 0.14.1058

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 (105) hide show
  1. package/bin/migration-scripts/0.14.1058.js +21 -0
  2. package/bundle/blocks.schema.json +1 -1
  3. package/bundle/bundle.umd.js +63 -38
  4. package/bundle/bundle.umd.min.js +1 -1
  5. package/bundle/components/CreditCardForm/getCreditCardFormTaskData.d.ts +3 -2
  6. package/bundle/model/LinkProps.d.ts +0 -2
  7. package/bundle/ui-kit/LinkButton/LinkButtonContent.d.ts +4 -0
  8. package/dist/components/CreditCardForm/CreditCardFormStatusTracker.js +16 -2
  9. package/dist/components/CreditCardForm/CreditCardFormStatusTracker.js.map +1 -1
  10. package/dist/components/CreditCardForm/getCreditCardFormTaskData.d.ts +3 -2
  11. package/dist/components/CreditCardForm/getCreditCardFormTaskData.js +38 -24
  12. package/dist/components/CreditCardForm/getCreditCardFormTaskData.js.map +1 -1
  13. package/dist/components/CreditCardForm/useCreditCardFormAPI.js +1 -1
  14. package/dist/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
  15. package/dist/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
  16. package/dist/model/LinkProps.d.ts +0 -2
  17. package/dist/ui-kit/LinkButton/LinkButton.js +9 -9
  18. package/dist/ui-kit/LinkButton/LinkButton.js.map +1 -1
  19. package/dist/ui-kit/LinkButton/LinkButtonContent.d.ts +4 -0
  20. package/dist/ui-kit/UserSurveyDialog/useUserSurveyDialog.js +1 -1
  21. package/dist/ui-kit/UserSurveyDialog/useUserSurveyDialog.js.map +1 -1
  22. package/lib/components/CreditCardForm/CreditCardFormStatusTracker.js +16 -2
  23. package/lib/components/CreditCardForm/CreditCardFormStatusTracker.js.map +1 -1
  24. package/lib/components/CreditCardForm/getCreditCardFormTaskData.d.ts +3 -2
  25. package/lib/components/CreditCardForm/getCreditCardFormTaskData.js +38 -24
  26. package/lib/components/CreditCardForm/getCreditCardFormTaskData.js.map +1 -1
  27. package/lib/components/CreditCardForm/useCreditCardFormAPI.js +1 -1
  28. package/lib/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
  29. package/lib/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
  30. package/lib/model/LinkProps.d.ts +0 -2
  31. package/lib/ui-kit/LinkButton/LinkButton.js +9 -9
  32. package/lib/ui-kit/LinkButton/LinkButton.js.map +1 -1
  33. package/lib/ui-kit/LinkButton/LinkButtonContent.d.ts +4 -0
  34. package/lib/ui-kit/UserSurveyDialog/useUserSurveyDialog.js +1 -1
  35. package/lib/ui-kit/UserSurveyDialog/useUserSurveyDialog.js.map +1 -1
  36. package/mobile/bundle/bundle.umd.js +63 -38
  37. package/mobile/bundle/bundle.umd.min.js +1 -1
  38. package/mobile/bundle/components/CreditCardForm/getCreditCardFormTaskData.d.ts +3 -2
  39. package/mobile/bundle/model/LinkProps.d.ts +0 -2
  40. package/mobile/bundle/ui-kit/LinkButton/LinkButtonContent.d.ts +4 -0
  41. package/mobile/dist/components/CreditCardForm/CreditCardFormStatusTracker.js +16 -2
  42. package/mobile/dist/components/CreditCardForm/CreditCardFormStatusTracker.js.map +1 -1
  43. package/mobile/dist/components/CreditCardForm/getCreditCardFormTaskData.d.ts +3 -2
  44. package/mobile/dist/components/CreditCardForm/getCreditCardFormTaskData.js +38 -24
  45. package/mobile/dist/components/CreditCardForm/getCreditCardFormTaskData.js.map +1 -1
  46. package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.js +1 -1
  47. package/mobile/dist/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
  48. package/mobile/dist/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
  49. package/mobile/dist/model/LinkProps.d.ts +0 -2
  50. package/mobile/dist/ui-kit/LinkButton/LinkButton.js +9 -9
  51. package/mobile/dist/ui-kit/LinkButton/LinkButton.js.map +1 -1
  52. package/mobile/dist/ui-kit/LinkButton/LinkButtonContent.d.ts +4 -0
  53. package/mobile/dist/ui-kit/UserSurveyDialog/useUserSurveyDialog.js +1 -1
  54. package/mobile/dist/ui-kit/UserSurveyDialog/useUserSurveyDialog.js.map +1 -1
  55. package/mobile/lib/components/CreditCardForm/CreditCardFormStatusTracker.js +16 -2
  56. package/mobile/lib/components/CreditCardForm/CreditCardFormStatusTracker.js.map +1 -1
  57. package/mobile/lib/components/CreditCardForm/getCreditCardFormTaskData.d.ts +3 -2
  58. package/mobile/lib/components/CreditCardForm/getCreditCardFormTaskData.js +38 -24
  59. package/mobile/lib/components/CreditCardForm/getCreditCardFormTaskData.js.map +1 -1
  60. package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.js +1 -1
  61. package/mobile/lib/components/CreditCardForm/useCreditCardFormAPI.js.map +1 -1
  62. package/mobile/lib/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
  63. package/mobile/lib/model/LinkProps.d.ts +0 -2
  64. package/mobile/lib/ui-kit/LinkButton/LinkButton.js +9 -9
  65. package/mobile/lib/ui-kit/LinkButton/LinkButton.js.map +1 -1
  66. package/mobile/lib/ui-kit/LinkButton/LinkButtonContent.d.ts +4 -0
  67. package/mobile/lib/ui-kit/UserSurveyDialog/useUserSurveyDialog.js +1 -1
  68. package/mobile/lib/ui-kit/UserSurveyDialog/useUserSurveyDialog.js.map +1 -1
  69. package/mobile/src/components/CreditCardForm/CreditCardFormStatusTracker.tsx +16 -2
  70. package/mobile/src/components/CreditCardForm/getCreditCardFormTaskData.ts +43 -26
  71. package/mobile/src/components/CreditCardForm/useCreditCardFormAPI.tsx +1 -1
  72. package/mobile/src/components/CreditForm/CreditFormStatusTracker.tsx +1 -0
  73. package/mobile/src/model/LinkProps.ts +0 -2
  74. package/mobile/src/ui-kit/LinkButton/LinkButton.tsx +11 -10
  75. package/mobile/src/ui-kit/LinkButton/LinkButtonContent.ts +4 -0
  76. package/mobile/src/ui-kit/UserSurveyDialog/useUserSurveyDialog.ts +1 -1
  77. package/package.json +1 -1
  78. package/src/components/ButtonsBlock/ButtonsBlock.fixture.tsx +2 -1
  79. package/src/components/CreditCardForm/CreditCardForm.fixture.mobile.tsx +0 -4
  80. package/src/components/CreditCardForm/CreditCardForm.fixture.tsx +7 -13
  81. package/src/components/CreditCardForm/CreditCardFormStatusTracker.tsx +16 -2
  82. package/src/components/CreditCardForm/getCreditCardFormTaskData.ts +43 -26
  83. package/src/components/CreditCardForm/useCreditCardFormAPI.tsx +1 -1
  84. package/src/components/CreditForm/CreditForm.fixture.mobile.tsx +0 -4
  85. package/src/components/CreditForm/CreditFormStatusTracker.tsx +1 -0
  86. package/src/model/LinkProps.ts +0 -2
  87. package/src/ui-kit/LinkButton/LinkButton.tsx +11 -10
  88. package/src/ui-kit/LinkButton/LinkButtonContent.ts +4 -0
  89. package/src/ui-kit/UserSurveyDialog/useUserSurveyDialog.ts +1 -1
  90. package/bundle/retail/utils/mockLocalStorage.d.ts +0 -1
  91. package/dist/retail/utils/mockLocalStorage.d.ts +0 -1
  92. package/dist/retail/utils/mockLocalStorage.js +0 -38
  93. package/dist/retail/utils/mockLocalStorage.js.map +0 -1
  94. package/lib/retail/utils/mockLocalStorage.d.ts +0 -1
  95. package/lib/retail/utils/mockLocalStorage.js +0 -35
  96. package/lib/retail/utils/mockLocalStorage.js.map +0 -1
  97. package/mobile/bundle/retail/utils/mockLocalStorage.d.ts +0 -1
  98. package/mobile/dist/retail/utils/mockLocalStorage.d.ts +0 -1
  99. package/mobile/dist/retail/utils/mockLocalStorage.js +0 -38
  100. package/mobile/dist/retail/utils/mockLocalStorage.js.map +0 -1
  101. package/mobile/lib/retail/utils/mockLocalStorage.d.ts +0 -1
  102. package/mobile/lib/retail/utils/mockLocalStorage.js +0 -35
  103. package/mobile/lib/retail/utils/mockLocalStorage.js.map +0 -1
  104. package/mobile/src/retail/utils/mockLocalStorage.ts +0 -44
  105. package/src/retail/utils/mockLocalStorage.ts +0 -44
@@ -6,6 +6,10 @@ export interface ButtonCommonContent extends LinkProps {
6
6
  version?: LinkButtonVersion;
7
7
  /** @title Метод */
8
8
  method?: 'LINK' | 'POST';
9
+ /** @title Дополнительная ссылка для A/B-тестирования */
10
+ additionalHref?: string;
11
+ /** @title Вероятность перехода по дополнительной ссылке в % */
12
+ chance?: 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 100;
9
13
  }
10
14
  /** @deprecated */
11
15
  /**
@@ -16,7 +16,7 @@ export const useUserSurveyDialog = (withoutTimer = false) => {
16
16
  ? Date.now() - Number.parseInt(sessionStore.surveyTimerStart)
17
17
  : 0;
18
18
  const isShowSurvey = !isSurveySkipped &&
19
- !isOtherLanguagePortal &&
19
+ !isOtherLanguagePortal() &&
20
20
  (!userSurveyStore.userSurvey || userSurveyStore.userSurvey?.nextDueAt <= Date.now());
21
21
  const handleSkipSurvey = useCallback(() => {
22
22
  sessionStore.isSurveySkipped = true;
@@ -1 +1 @@
1
- {"version":3,"file":"useUserSurveyDialog.js","sourceRoot":"","sources":["../../../src/ui-kit/UserSurveyDialog/useUserSurveyDialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAQ5B,4CAA4C;AAC5C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,YAAY,GAAG,KAAK,EAAE,EAAE;IAC1D,MAAM,gBAAgB,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAAC;IACrD,MAAM,eAAe,GAAG,aAAa,EAAwB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AC,CAAC,CAAC;IAEhC,SAAS,CAAC,GAAG,EAAE;QACb,0GAA0G;QAC1G,IAAI,CAAC,YAAY,IAAI,YAAY,EAAE;YACjC,uDAAuD;YACvD,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE;gBAClC,YAAY,CAAC,gBAAgB,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;aACvD;YACD,wDAAwD;YACxD,MAAM,OAAO,GAAG,UAAU,CAAC,oBAAoB,EAAE,KAAK,GAAG,WAAW,CAAC,CAAC;YACtE,YAAY,CAAC,aAAa,GAAG,OAAO,CAAC;YAErC,OAAO,GAAG,EAAE;gBACV,YAAY,CAAC,OAAO,CAAC,CAAC;gBACtB,YAAY,CAAC,aAAa,GAAG,IAAI,CAAC;YACpC,CAAC,CAAC;SACH;QAED,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,OAAO,sBAAsB,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACjC,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAE9C,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACnD,CAAC,CAAC"}
@@ -3,8 +3,10 @@ import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { useInterval } from '../../hooks/useInterval';
4
4
  import { type VNode } from '../../model/VNode';
5
5
  import { getTaskStatus, STATUS_TYPE } from '../../retail/api/getTaskStatus';
6
+ import { sendMessage, type MessageName } from '../../retail/api/sendMessage';
6
7
  import { sendSignalToProcess, type SignalType } from '../../retail/api/sendSignalToProcess';
7
8
  import { useRetailFormStore } from '../../retail/hooks/useRetailFormStore';
9
+ import { checkNewMicroservice } from '../../retail/utils/checkNewMicroservice';
8
10
  import { FailedStatusContent } from './FailedStatusContent';
9
11
  import { PendingStatusContent } from './PendingStatusContent';
10
12
  import { ReworkStatusContent } from './ReworkStatusContent';
@@ -15,14 +17,26 @@ const SIGNAL_TYPES: SignalType[] = [
15
17
  'CREATE_APPLICATION_LOAN_V3_SIGNAL',
16
18
  ];
17
19
 
20
+ const MESSAGE_NAMES: MessageName[] = [
21
+ 'CREATE_APPLICATION_SHORT_MESSAGE',
22
+ // 'CREATE_APPLICATION_LOAN_MESSAGE',
23
+ ];
24
+
18
25
  export const CreditCardFormStatusTracker = JSX(() => {
26
+ const isNewMicroservice = checkNewMicroservice();
19
27
  const [status, setStatus] = useState(STATUS_TYPE.process);
20
28
  const { taskId } = useRetailFormStore();
21
29
 
22
30
  useEffect(() => {
23
31
  (async () => {
24
- for (const signalType of SIGNAL_TYPES) {
25
- await sendSignalToProcess({ signalType, taskId });
32
+ if (isNewMicroservice) {
33
+ for (const messageName of MESSAGE_NAMES) {
34
+ await sendMessage({ messageName, taskId });
35
+ }
36
+ } else {
37
+ for (const signalType of SIGNAL_TYPES) {
38
+ await sendSignalToProcess({ signalType, taskId });
39
+ }
26
40
  }
27
41
  })();
28
42
  }, [taskId]);
@@ -5,6 +5,8 @@ import { getFamilyStatusAndIncomeData } from '../../retail/adaptors/getFamilySta
5
5
  import { getPersonalInfoData } from '../../retail/adaptors/getPersonalInfoData';
6
6
  import { type Participant, type UpdateUserTaskBody } from '../../retail/api/updateUserTask';
7
7
  import { type LeadFormState } from '../../retail/model/LeadFormState';
8
+ import { checkNewMicroservice } from '../../retail/utils/checkNewMicroservice';
9
+ import { type Nullable } from '../../utils/Nullable';
8
10
  import {
9
11
  getDeliveryCreditCardData,
10
12
  getDeliveryData,
@@ -12,9 +14,9 @@ import {
12
14
  } from './getDeliveryCreditCardData';
13
15
 
14
16
  type getCreditCardFormTaskDataProps = {
15
- participantId: string | number;
17
+ participantId: Nullable<string | number>;
16
18
  taskId: number;
17
- profileId: number;
19
+ profileId: Nullable<number>;
18
20
  formData: LeadFormState;
19
21
  step?: number;
20
22
  };
@@ -25,31 +27,46 @@ export const getCreditCardFormTaskData = ({
25
27
  profileId,
26
28
  formData,
27
29
  step = 0,
28
- }: getCreditCardFormTaskDataProps): UpdateUserTaskBody => ({
29
- sendToBank: true,
30
- taskKind: 'UNITED',
31
- task: {
32
- id: taskId,
33
- ...getOfficeCode(formData),
34
- authorizedAgentId: formData?.bankEmployeeCode,
35
- participants: [
36
- {
37
- id: participantId,
38
- profile: {
39
- id: profileId,
40
- },
41
- roleCd: {
42
- key: 'BORROWER',
43
- value: 'Заемщик',
44
- },
45
- ...getCurrentStepData(step, formData),
30
+ }: getCreditCardFormTaskDataProps): UpdateUserTaskBody => {
31
+ const isNewMicroservice = checkNewMicroservice();
32
+
33
+ const participantInfo = {
34
+ id: participantId,
35
+ ...(!isNewMicroservice && {
36
+ profile: {
37
+ id: profileId,
46
38
  },
47
- ],
48
- ...getCardOptionsData(formData),
49
- ...getDeliveryData(formData),
50
- files: formData?.files,
51
- },
52
- });
39
+ }),
40
+ roleCd: {
41
+ key: 'BORROWER',
42
+ value: 'Заемщик',
43
+ },
44
+ ...getCurrentStepData(step, formData),
45
+ };
46
+
47
+ return {
48
+ sendToBank: true,
49
+ taskKind: 'UNITED',
50
+ task: {
51
+ id: taskId,
52
+ ...getOfficeCode(formData),
53
+ authorizedAgentId: formData?.bankEmployeeCode,
54
+ ...(isNewMicroservice
55
+ ? {
56
+ participant: participantInfo,
57
+ }
58
+ : {
59
+ participants: [participantInfo],
60
+ }),
61
+ ...getCardOptionsData(formData),
62
+ ...getDeliveryData(formData),
63
+ esiaAccountTypeCd: {
64
+ key: formData?.esiaAccountTypeCd?.key,
65
+ } as UpdateUserTaskBody['task']['esiaAccountTypeCd'],
66
+ files: formData?.files,
67
+ },
68
+ };
69
+ };
53
70
 
54
71
  const getCurrentStepData = (step: number, formData: LeadFormState): Partial<Participant> => {
55
72
  switch (step) {
@@ -51,7 +51,7 @@ export const useCreditCardFormAPI = ({
51
51
 
52
52
  try {
53
53
  const { taskId, profileId, participantId } = retailFormStore;
54
- if (taskId && profileId && participantId) {
54
+ if (taskId) {
55
55
  const response = await updateUserTask(
56
56
  getCreditCardFormTaskData({
57
57
  participantId,
@@ -11,6 +11,7 @@ import { FailedStatusContent } from './FailedStatusContent';
11
11
  import { PendingStatusContent } from './PendingStatusContent';
12
12
  import { ReworkStatusContent } from './ReworkStatusContent';
13
13
  import { SuccessStatusContent } from './SuccessStatusContent';
14
+
14
15
  const SIGNAL_TYPES: SignalType[] = [
15
16
  'CREATE_APPLICATION_SHORT_SIGNAL',
16
17
  'CREATE_APPLICATION_LOAN_V3_SIGNAL',
@@ -16,8 +16,6 @@ export type Target = '' | '_self' | '_blank' | '_parent' | '_top';
16
16
  export type HrefProps = {
17
17
  /** @title URL (href) */
18
18
  href?: string;
19
- /** @title Дополнительные ссылки для A/B-тестирования */
20
- additionalHrefs?: string[];
21
19
  };
22
20
 
23
21
  export type LinkCommonProps = HrefProps & {
@@ -14,23 +14,24 @@ type SaveLinksProps = {
14
14
  linksStore: LinkStoreSlice;
15
15
  id?: string;
16
16
  href?: string;
17
- additionalHrefs?: string[];
17
+ additionalHref?: string;
18
+ chance: LinkButtonProps['chance'];
18
19
  };
19
20
 
20
21
  /** @deprecated */
21
22
  export const LinkButton = JSX<LinkButtonProps>(
22
- ({ disabled, children, method = 'LINK', href, id, additionalHrefs, ...rest }) => {
23
+ ({ disabled, children, method = 'LINK', href, id, additionalHref, chance, ...rest }) => {
23
24
  const [currentLink, setCurrentLink] = useState<string>();
24
25
  const handleFormSubmit = useFormSubmit({ method, href });
25
26
  const linksStore = useLocalStore<LinkStoreSlice>();
26
27
 
27
28
  useEffect(() => {
28
- additionalHrefs && saveLinksToStore({ linksStore, href, id, additionalHrefs });
29
+ additionalHref && saveLinksToStore({ linksStore, href, id, additionalHref, chance });
29
30
 
30
31
  const adjustedHref = (linksStore.links || []).find((store) => store.id === id)?.lastLink;
31
32
 
32
33
  setCurrentLink(adjustedHref ?? href);
33
- }, [additionalHrefs, href]);
34
+ }, [additionalHref, href]);
34
35
 
35
36
  const link = useLink();
36
37
  const adjustedProps = link({ onClick: handleFormSubmit, href: currentLink, ...rest });
@@ -90,17 +91,17 @@ const DisabledButton = JSX<LinkButtonProps>(
90
91
  ),
91
92
  );
92
93
 
93
- const getRandomHref = (href = '', additionalHrefs: string[] = []) => {
94
- const hrefs = [href, ...additionalHrefs];
94
+ const getRandomHref = (href = '', additionalHref = '', chance = 50) => {
95
+ const randomNumber = Math.random() * 100;
95
96
 
96
- return hrefs[Math.floor(Math.random() * hrefs.length)];
97
+ return randomNumber < chance ? additionalHref : href;
97
98
  };
98
99
 
99
100
  // Отсчитываем 7 длей с текущей даты
100
101
  const getTimeAfter7days = () => Date.now() + 7 * 24 * 60 * 60 * 1000;
101
102
 
102
103
  // Сохраняем или заменяем рандомную ссылку в localStorage
103
- const saveLinksToStore = ({ linksStore, id, href, additionalHrefs }: SaveLinksProps) => {
104
+ const saveLinksToStore = ({ linksStore, id, href, additionalHref, chance }: SaveLinksProps) => {
104
105
  const buttonLinkStore = (linksStore.links || []).find((store) => store.id === id);
105
106
 
106
107
  // Если хранилища вообще нет
@@ -108,9 +109,9 @@ const saveLinksToStore = ({ linksStore, id, href, additionalHrefs }: SaveLinksPr
108
109
  linksStore.links = [];
109
110
  }
110
111
 
111
- if ((!buttonLinkStore || buttonLinkStore.nextDueAt <= Date.now()) && additionalHrefs) {
112
+ if ((!buttonLinkStore || buttonLinkStore.nextDueAt <= Date.now()) && additionalHref) {
112
113
  // Получаем рандомную ссылку
113
- const randomHref = getRandomHref(href, additionalHrefs);
114
+ const randomHref = getRandomHref(href, additionalHref, chance);
114
115
 
115
116
  // При наличии ссылки для этой кнопки в хранилище удаляем этот элемент из массива ссылок
116
117
  const updatedLinks = linksStore.links?.filter((item) => item.id !== id);
@@ -7,6 +7,10 @@ export interface ButtonCommonContent extends LinkProps {
7
7
  version?: LinkButtonVersion;
8
8
  /** @title Метод */
9
9
  method?: 'LINK' | 'POST';
10
+ /** @title Дополнительная ссылка для A/B-тестирования */
11
+ additionalHref?: string;
12
+ /** @title Вероятность перехода по дополнительной ссылке в % */
13
+ chance?: 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 100;
10
14
  }
11
15
 
12
16
  /** @deprecated */
@@ -26,7 +26,7 @@ export const useUserSurveyDialog = (withoutTimer = false) => {
26
26
  : 0;
27
27
  const isShowSurvey =
28
28
  !isSurveySkipped &&
29
- !isOtherLanguagePortal &&
29
+ !isOtherLanguagePortal() &&
30
30
  (!userSurveyStore.userSurvey || userSurveyStore.userSurvey?.nextDueAt <= Date.now());
31
31
 
32
32
  const handleSkipSurvey = useCallback(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.14.1056",
3
+ "version": "0.14.1058",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -21,7 +21,8 @@ const buttons: LinkButtonContent[] = [
21
21
  const buttonsForABTesting: LinkButtonContent[] = [
22
22
  {
23
23
  href: '/premium-cards',
24
- additionalHrefs: ['/debit-cards', '/deposits'],
24
+ additionalHref: '/debit-cards',
25
+ chance: 10,
25
26
  text: 'Оформить',
26
27
  target: '_blank',
27
28
  version: 'primary',
@@ -1,6 +1,4 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { useAsyncEffect } from '../../hooks/useAsyncEffect';
3
- import { mockLocalStorage } from '../../retail/utils/mockLocalStorage';
4
2
  import '../../setup-fixture';
5
3
  import { DialogManager } from '../../ui-kit/DialogManager/DialogManager';
6
4
  import { PopupManager } from '../../ui-kit/PopupManager/PopupManager';
@@ -8,8 +6,6 @@ import { CreditCardForm } from './CreditCardForm';
8
6
 
9
7
  export default {
10
8
  default: JSX(() => {
11
- useAsyncEffect(async () => mockLocalStorage(), []);
12
-
13
9
  return (
14
10
  <div>
15
11
  <CreditCardForm className="col-span-12" />
@@ -1,21 +1,15 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { useAsyncEffect } from '../../hooks/useAsyncEffect';
3
- import { mockLocalStorage } from '../../retail/utils/mockLocalStorage';
4
2
  import '../../setup-fixture';
5
3
  import { DialogManager } from '../../ui-kit/DialogManager/DialogManager';
6
4
  import { PopupManager } from '../../ui-kit/PopupManager/PopupManager';
7
5
  import { CreditCardForm } from './CreditCardForm';
8
6
 
9
7
  export default {
10
- default: JSX(() => {
11
- useAsyncEffect(async () => mockLocalStorage(), []);
12
-
13
- return (
14
- <div>
15
- <CreditCardForm className="col-span-12" />
16
- <PopupManager />
17
- <DialogManager />
18
- </div>
19
- );
20
- }),
8
+ default: JSX(() => (
9
+ <div>
10
+ <CreditCardForm className="col-span-12" />
11
+ <PopupManager />
12
+ <DialogManager />
13
+ </div>
14
+ )),
21
15
  };
@@ -3,8 +3,10 @@ import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { useInterval } from '../../hooks/useInterval';
4
4
  import { type VNode } from '../../model/VNode';
5
5
  import { getTaskStatus, STATUS_TYPE } from '../../retail/api/getTaskStatus';
6
+ import { sendMessage, type MessageName } from '../../retail/api/sendMessage';
6
7
  import { sendSignalToProcess, type SignalType } from '../../retail/api/sendSignalToProcess';
7
8
  import { useRetailFormStore } from '../../retail/hooks/useRetailFormStore';
9
+ import { checkNewMicroservice } from '../../retail/utils/checkNewMicroservice';
8
10
  import { FailedStatusContent } from './FailedStatusContent';
9
11
  import { PendingStatusContent } from './PendingStatusContent';
10
12
  import { ReworkStatusContent } from './ReworkStatusContent';
@@ -15,14 +17,26 @@ const SIGNAL_TYPES: SignalType[] = [
15
17
  'CREATE_APPLICATION_LOAN_V3_SIGNAL',
16
18
  ];
17
19
 
20
+ const MESSAGE_NAMES: MessageName[] = [
21
+ 'CREATE_APPLICATION_SHORT_MESSAGE',
22
+ // 'CREATE_APPLICATION_LOAN_MESSAGE',
23
+ ];
24
+
18
25
  export const CreditCardFormStatusTracker = JSX(() => {
26
+ const isNewMicroservice = checkNewMicroservice();
19
27
  const [status, setStatus] = useState(STATUS_TYPE.process);
20
28
  const { taskId } = useRetailFormStore();
21
29
 
22
30
  useEffect(() => {
23
31
  (async () => {
24
- for (const signalType of SIGNAL_TYPES) {
25
- await sendSignalToProcess({ signalType, taskId });
32
+ if (isNewMicroservice) {
33
+ for (const messageName of MESSAGE_NAMES) {
34
+ await sendMessage({ messageName, taskId });
35
+ }
36
+ } else {
37
+ for (const signalType of SIGNAL_TYPES) {
38
+ await sendSignalToProcess({ signalType, taskId });
39
+ }
26
40
  }
27
41
  })();
28
42
  }, [taskId]);
@@ -5,6 +5,8 @@ import { getFamilyStatusAndIncomeData } from '../../retail/adaptors/getFamilySta
5
5
  import { getPersonalInfoData } from '../../retail/adaptors/getPersonalInfoData';
6
6
  import { type Participant, type UpdateUserTaskBody } from '../../retail/api/updateUserTask';
7
7
  import { type LeadFormState } from '../../retail/model/LeadFormState';
8
+ import { checkNewMicroservice } from '../../retail/utils/checkNewMicroservice';
9
+ import { type Nullable } from '../../utils/Nullable';
8
10
  import {
9
11
  getDeliveryCreditCardData,
10
12
  getDeliveryData,
@@ -12,9 +14,9 @@ import {
12
14
  } from './getDeliveryCreditCardData';
13
15
 
14
16
  type getCreditCardFormTaskDataProps = {
15
- participantId: string | number;
17
+ participantId: Nullable<string | number>;
16
18
  taskId: number;
17
- profileId: number;
19
+ profileId: Nullable<number>;
18
20
  formData: LeadFormState;
19
21
  step?: number;
20
22
  };
@@ -25,31 +27,46 @@ export const getCreditCardFormTaskData = ({
25
27
  profileId,
26
28
  formData,
27
29
  step = 0,
28
- }: getCreditCardFormTaskDataProps): UpdateUserTaskBody => ({
29
- sendToBank: true,
30
- taskKind: 'UNITED',
31
- task: {
32
- id: taskId,
33
- ...getOfficeCode(formData),
34
- authorizedAgentId: formData?.bankEmployeeCode,
35
- participants: [
36
- {
37
- id: participantId,
38
- profile: {
39
- id: profileId,
40
- },
41
- roleCd: {
42
- key: 'BORROWER',
43
- value: 'Заемщик',
44
- },
45
- ...getCurrentStepData(step, formData),
30
+ }: getCreditCardFormTaskDataProps): UpdateUserTaskBody => {
31
+ const isNewMicroservice = checkNewMicroservice();
32
+
33
+ const participantInfo = {
34
+ id: participantId,
35
+ ...(!isNewMicroservice && {
36
+ profile: {
37
+ id: profileId,
46
38
  },
47
- ],
48
- ...getCardOptionsData(formData),
49
- ...getDeliveryData(formData),
50
- files: formData?.files,
51
- },
52
- });
39
+ }),
40
+ roleCd: {
41
+ key: 'BORROWER',
42
+ value: 'Заемщик',
43
+ },
44
+ ...getCurrentStepData(step, formData),
45
+ };
46
+
47
+ return {
48
+ sendToBank: true,
49
+ taskKind: 'UNITED',
50
+ task: {
51
+ id: taskId,
52
+ ...getOfficeCode(formData),
53
+ authorizedAgentId: formData?.bankEmployeeCode,
54
+ ...(isNewMicroservice
55
+ ? {
56
+ participant: participantInfo,
57
+ }
58
+ : {
59
+ participants: [participantInfo],
60
+ }),
61
+ ...getCardOptionsData(formData),
62
+ ...getDeliveryData(formData),
63
+ esiaAccountTypeCd: {
64
+ key: formData?.esiaAccountTypeCd?.key,
65
+ } as UpdateUserTaskBody['task']['esiaAccountTypeCd'],
66
+ files: formData?.files,
67
+ },
68
+ };
69
+ };
53
70
 
54
71
  const getCurrentStepData = (step: number, formData: LeadFormState): Partial<Participant> => {
55
72
  switch (step) {
@@ -51,7 +51,7 @@ export const useCreditCardFormAPI = ({
51
51
 
52
52
  try {
53
53
  const { taskId, profileId, participantId } = retailFormStore;
54
- if (taskId && profileId && participantId) {
54
+ if (taskId) {
55
55
  const response = await updateUserTask(
56
56
  getCreditCardFormTaskData({
57
57
  participantId,
@@ -1,6 +1,4 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { useAsyncEffect } from '../../hooks/useAsyncEffect';
3
- import { mockLocalStorage } from '../../retail/utils/mockLocalStorage';
4
2
  import '../../setup-fixture';
5
3
  import { DialogManager } from '../../ui-kit/DialogManager/DialogManager';
6
4
  import { PopupManager } from '../../ui-kit/PopupManager/PopupManager';
@@ -8,8 +6,6 @@ import { CreditForm } from './CreditForm';
8
6
 
9
7
  export default {
10
8
  default: JSX(() => {
11
- useAsyncEffect(async () => mockLocalStorage(), []);
12
-
13
9
  return (
14
10
  <div>
15
11
  <CreditForm
@@ -11,6 +11,7 @@ import { FailedStatusContent } from './FailedStatusContent';
11
11
  import { PendingStatusContent } from './PendingStatusContent';
12
12
  import { ReworkStatusContent } from './ReworkStatusContent';
13
13
  import { SuccessStatusContent } from './SuccessStatusContent';
14
+
14
15
  const SIGNAL_TYPES: SignalType[] = [
15
16
  'CREATE_APPLICATION_SHORT_SIGNAL',
16
17
  'CREATE_APPLICATION_LOAN_V3_SIGNAL',
@@ -16,8 +16,6 @@ export type Target = '' | '_self' | '_blank' | '_parent' | '_top';
16
16
  export type HrefProps = {
17
17
  /** @title URL (href) */
18
18
  href?: string;
19
- /** @title Дополнительные ссылки для A/B-тестирования */
20
- additionalHrefs?: string[];
21
19
  };
22
20
 
23
21
  export type LinkCommonProps = HrefProps & {
@@ -14,23 +14,24 @@ type SaveLinksProps = {
14
14
  linksStore: LinkStoreSlice;
15
15
  id?: string;
16
16
  href?: string;
17
- additionalHrefs?: string[];
17
+ additionalHref?: string;
18
+ chance: LinkButtonProps['chance'];
18
19
  };
19
20
 
20
21
  /** @deprecated */
21
22
  export const LinkButton = JSX<LinkButtonProps>(
22
- ({ disabled, children, method = 'LINK', href, id, additionalHrefs, ...rest }) => {
23
+ ({ disabled, children, method = 'LINK', href, id, additionalHref, chance, ...rest }) => {
23
24
  const [currentLink, setCurrentLink] = useState<string>();
24
25
  const handleFormSubmit = useFormSubmit({ method, href });
25
26
  const linksStore = useLocalStore<LinkStoreSlice>();
26
27
 
27
28
  useEffect(() => {
28
- additionalHrefs && saveLinksToStore({ linksStore, href, id, additionalHrefs });
29
+ additionalHref && saveLinksToStore({ linksStore, href, id, additionalHref, chance });
29
30
 
30
31
  const adjustedHref = (linksStore.links || []).find((store) => store.id === id)?.lastLink;
31
32
 
32
33
  setCurrentLink(adjustedHref ?? href);
33
- }, [additionalHrefs, href]);
34
+ }, [additionalHref, href]);
34
35
 
35
36
  const link = useLink();
36
37
  const adjustedProps = link({ onClick: handleFormSubmit, href: currentLink, ...rest });
@@ -90,17 +91,17 @@ const DisabledButton = JSX<LinkButtonProps>(
90
91
  ),
91
92
  );
92
93
 
93
- const getRandomHref = (href = '', additionalHrefs: string[] = []) => {
94
- const hrefs = [href, ...additionalHrefs];
94
+ const getRandomHref = (href = '', additionalHref = '', chance = 50) => {
95
+ const randomNumber = Math.random() * 100;
95
96
 
96
- return hrefs[Math.floor(Math.random() * hrefs.length)];
97
+ return randomNumber < chance ? additionalHref : href;
97
98
  };
98
99
 
99
100
  // Отсчитываем 7 длей с текущей даты
100
101
  const getTimeAfter7days = () => Date.now() + 7 * 24 * 60 * 60 * 1000;
101
102
 
102
103
  // Сохраняем или заменяем рандомную ссылку в localStorage
103
- const saveLinksToStore = ({ linksStore, id, href, additionalHrefs }: SaveLinksProps) => {
104
+ const saveLinksToStore = ({ linksStore, id, href, additionalHref, chance }: SaveLinksProps) => {
104
105
  const buttonLinkStore = (linksStore.links || []).find((store) => store.id === id);
105
106
 
106
107
  // Если хранилища вообще нет
@@ -108,9 +109,9 @@ const saveLinksToStore = ({ linksStore, id, href, additionalHrefs }: SaveLinksPr
108
109
  linksStore.links = [];
109
110
  }
110
111
 
111
- if ((!buttonLinkStore || buttonLinkStore.nextDueAt <= Date.now()) && additionalHrefs) {
112
+ if ((!buttonLinkStore || buttonLinkStore.nextDueAt <= Date.now()) && additionalHref) {
112
113
  // Получаем рандомную ссылку
113
- const randomHref = getRandomHref(href, additionalHrefs);
114
+ const randomHref = getRandomHref(href, additionalHref, chance);
114
115
 
115
116
  // При наличии ссылки для этой кнопки в хранилище удаляем этот элемент из массива ссылок
116
117
  const updatedLinks = linksStore.links?.filter((item) => item.id !== id);
@@ -7,6 +7,10 @@ export interface ButtonCommonContent extends LinkProps {
7
7
  version?: LinkButtonVersion;
8
8
  /** @title Метод */
9
9
  method?: 'LINK' | 'POST';
10
+ /** @title Дополнительная ссылка для A/B-тестирования */
11
+ additionalHref?: string;
12
+ /** @title Вероятность перехода по дополнительной ссылке в % */
13
+ chance?: 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 100;
10
14
  }
11
15
 
12
16
  /** @deprecated */
@@ -26,7 +26,7 @@ export const useUserSurveyDialog = (withoutTimer = false) => {
26
26
  : 0;
27
27
  const isShowSurvey =
28
28
  !isSurveySkipped &&
29
- !isOtherLanguagePortal &&
29
+ !isOtherLanguagePortal() &&
30
30
  (!userSurveyStore.userSurvey || userSurveyStore.userSurvey?.nextDueAt <= Date.now());
31
31
 
32
32
  const handleSkipSurvey = useCallback(() => {
@@ -1 +0,0 @@
1
- export declare const mockLocalStorage: () => Promise<void>;
@@ -1 +0,0 @@
1
- export declare const mockLocalStorage: () => Promise<void>;