@redneckz/wildless-cms-uni-blocks 0.16.5-credit → 0.16.7-credit

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 (123) hide show
  1. package/bundle/bundle.umd.js +39 -28
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +3 -1
  4. package/bundle/components/ApplicationLeadForm/useLeadFormStore.d.ts +3 -0
  5. package/bundle/retail/api/saveReferalInfo.d.ts +2 -4
  6. package/bundle/retail/hooks/useRetailFormStore.d.ts +1 -0
  7. package/bundle/retail/model/LeadFormState.d.ts +0 -3
  8. package/bundle/retail/model/ReferalData.d.ts +6 -0
  9. package/bundle/utils/getSessionQuery.d.ts +1 -0
  10. package/dist/components/ApplicationLeadForm/getInitialFormState.js +0 -3
  11. package/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  12. package/dist/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +3 -1
  13. package/dist/components/ApplicationLeadForm/getLeadFormTaskData.js +2 -2
  14. package/dist/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
  15. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +8 -7
  16. package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  17. package/dist/components/ApplicationLeadForm/useInitApplicationLead.js +31 -16
  18. package/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  19. package/dist/components/ApplicationLeadForm/useLeadFormStore.d.ts +3 -0
  20. package/dist/components/ApplicationLeadForm/useLeadFormStore.js.map +1 -1
  21. package/dist/retail/api/saveReferalInfo.d.ts +2 -4
  22. package/dist/retail/api/saveReferalInfo.js.map +1 -1
  23. package/dist/retail/hooks/useRetailFormStore.d.ts +1 -0
  24. package/dist/retail/model/LeadFormState.d.ts +0 -3
  25. package/dist/retail/model/ReferalData.d.ts +6 -0
  26. package/dist/retail/model/ReferalData.js +2 -0
  27. package/dist/retail/model/ReferalData.js.map +1 -0
  28. package/dist/utils/getSessionQuery.d.ts +1 -0
  29. package/dist/utils/getSessionQuery.js +4 -4
  30. package/dist/utils/getSessionQuery.js.map +1 -1
  31. package/lib/components/ApplicationLeadForm/getInitialFormState.js +0 -3
  32. package/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  33. package/lib/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +3 -1
  34. package/lib/components/ApplicationLeadForm/getLeadFormTaskData.js +2 -2
  35. package/lib/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
  36. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +8 -7
  37. package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  38. package/lib/components/ApplicationLeadForm/useInitApplicationLead.js +31 -16
  39. package/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  40. package/lib/components/ApplicationLeadForm/useLeadFormStore.d.ts +3 -0
  41. package/lib/components/ApplicationLeadForm/useLeadFormStore.js.map +1 -1
  42. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +1 -1
  43. package/lib/retail/api/saveReferalInfo.d.ts +2 -4
  44. package/lib/retail/api/saveReferalInfo.js.map +1 -1
  45. package/lib/retail/components/DraftDialog/utils.d.ts +3 -3
  46. package/lib/retail/hooks/useRetailFormStore.d.ts +1 -0
  47. package/lib/retail/model/LeadFormState.d.ts +0 -3
  48. package/lib/retail/model/ReferalData.d.ts +6 -0
  49. package/lib/retail/model/ReferalData.js +2 -0
  50. package/lib/retail/model/ReferalData.js.map +1 -0
  51. package/lib/utils/getSessionQuery.d.ts +1 -0
  52. package/lib/utils/getSessionQuery.js +1 -1
  53. package/lib/utils/getSessionQuery.js.map +1 -1
  54. package/mobile/bundle/bundle.umd.js +39 -28
  55. package/mobile/bundle/bundle.umd.min.js +1 -1
  56. package/mobile/bundle/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +3 -1
  57. package/mobile/bundle/components/ApplicationLeadForm/useLeadFormStore.d.ts +3 -0
  58. package/mobile/bundle/retail/api/saveReferalInfo.d.ts +2 -4
  59. package/mobile/bundle/retail/hooks/useRetailFormStore.d.ts +1 -0
  60. package/mobile/bundle/retail/model/LeadFormState.d.ts +0 -3
  61. package/mobile/bundle/retail/model/ReferalData.d.ts +6 -0
  62. package/mobile/bundle/utils/getSessionQuery.d.ts +1 -0
  63. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js +0 -3
  64. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  65. package/mobile/dist/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +3 -1
  66. package/mobile/dist/components/ApplicationLeadForm/getLeadFormTaskData.js +2 -2
  67. package/mobile/dist/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
  68. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +8 -7
  69. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  70. package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js +31 -16
  71. package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  72. package/mobile/dist/components/ApplicationLeadForm/useLeadFormStore.d.ts +3 -0
  73. package/mobile/dist/components/ApplicationLeadForm/useLeadFormStore.js.map +1 -1
  74. package/mobile/dist/retail/api/saveReferalInfo.d.ts +2 -4
  75. package/mobile/dist/retail/api/saveReferalInfo.js.map +1 -1
  76. package/mobile/dist/retail/hooks/useRetailFormStore.d.ts +1 -0
  77. package/mobile/dist/retail/model/LeadFormState.d.ts +0 -3
  78. package/mobile/dist/retail/model/ReferalData.d.ts +6 -0
  79. package/mobile/dist/retail/model/ReferalData.js +2 -0
  80. package/mobile/dist/retail/model/ReferalData.js.map +1 -0
  81. package/mobile/dist/utils/getSessionQuery.d.ts +1 -0
  82. package/mobile/dist/utils/getSessionQuery.js +4 -4
  83. package/mobile/dist/utils/getSessionQuery.js.map +1 -1
  84. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js +0 -3
  85. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  86. package/mobile/lib/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +3 -1
  87. package/mobile/lib/components/ApplicationLeadForm/getLeadFormTaskData.js +2 -2
  88. package/mobile/lib/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
  89. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +8 -7
  90. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  91. package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js +31 -16
  92. package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  93. package/mobile/lib/components/ApplicationLeadForm/useLeadFormStore.d.ts +3 -0
  94. package/mobile/lib/components/ApplicationLeadForm/useLeadFormStore.js.map +1 -1
  95. package/mobile/lib/retail/api/saveReferalInfo.d.ts +2 -4
  96. package/mobile/lib/retail/api/saveReferalInfo.js.map +1 -1
  97. package/mobile/lib/retail/hooks/useRetailFormStore.d.ts +1 -0
  98. package/mobile/lib/retail/model/LeadFormState.d.ts +0 -3
  99. package/mobile/lib/retail/model/ReferalData.d.ts +6 -0
  100. package/mobile/lib/retail/model/ReferalData.js +2 -0
  101. package/mobile/lib/retail/model/ReferalData.js.map +1 -0
  102. package/mobile/lib/utils/getSessionQuery.d.ts +1 -0
  103. package/mobile/lib/utils/getSessionQuery.js +1 -1
  104. package/mobile/lib/utils/getSessionQuery.js.map +1 -1
  105. package/mobile/src/components/ApplicationLeadForm/getInitialFormState.tsx +0 -3
  106. package/mobile/src/components/ApplicationLeadForm/getLeadFormTaskData.ts +4 -1
  107. package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +11 -6
  108. package/mobile/src/components/ApplicationLeadForm/useInitApplicationLead.ts +38 -20
  109. package/mobile/src/components/ApplicationLeadForm/useLeadFormStore.ts +2 -0
  110. package/mobile/src/retail/api/saveReferalInfo.ts +2 -4
  111. package/mobile/src/retail/model/LeadFormState.ts +0 -3
  112. package/mobile/src/retail/model/ReferalData.ts +7 -0
  113. package/mobile/src/utils/getSessionQuery.ts +1 -1
  114. package/package.json +1 -1
  115. package/src/components/ApplicationLeadForm/getInitialFormState.tsx +0 -3
  116. package/src/components/ApplicationLeadForm/getLeadFormTaskData.ts +4 -1
  117. package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +11 -6
  118. package/src/components/ApplicationLeadForm/useInitApplicationLead.ts +38 -20
  119. package/src/components/ApplicationLeadForm/useLeadFormStore.ts +2 -0
  120. package/src/retail/api/saveReferalInfo.ts +2 -4
  121. package/src/retail/model/LeadFormState.ts +0 -3
  122. package/src/retail/model/ReferalData.ts +7 -0
  123. package/src/utils/getSessionQuery.ts +1 -1
@@ -1,6 +1,8 @@
1
+ /* eslint-disable max-lines-per-function */
1
2
  import { useCallback, useEffect, useMemo } from '@redneckz/uni-jsx/lib/hooks';
2
3
  import { useSetter } from '../../hooks/useSetter.js';
3
4
  import { esiaRequestProfile } from '../../retail/api/esiaRequestProfile.js';
5
+ import { QUERY_STORAGE_KEY } from '../../utils/getSessionQuery.js';
4
6
  import { EsiaStatuses } from './ApplicationLeadFormContent.js';
5
7
  import { getInitialFormState } from './getInitialFormState.js';
6
8
  import { parseEsiaProfile } from './parseEsiaProfile.js';
@@ -31,24 +33,22 @@ export const useInitApplicationLead = ({ inputs, productType, setEsiaStatus, esi
31
33
  setEsiaStatus(EsiaStatuses.Error);
32
34
  }
33
35
  }, []);
34
- const saveReferalData = useCallback(async (refererCode, referalCode, productId) => {
35
- saveForm((_) => ({
36
- ..._,
37
- refererCode,
38
- referalCode,
39
- productId,
40
- }));
41
- }, []);
42
36
  useEffect(() => {
43
37
  leadFormStore.productType = productType;
44
- const params = new URLSearchParams(decodeURIComponent(globalThis.location?.search));
45
- const code = params.get('code');
46
- const state = params.get('state');
47
- const refererCode = params.get('refererCode');
48
- const referalCode = params.get('referalCode');
49
- const productId = params.get('productID');
50
- if (refererCode && referalCode && productId) {
51
- saveReferalData(refererCode, referalCode, productId);
38
+ const { code, state, referalCode, refererCode, productId } = getLeadQueryParams(leadFormStore.referalData);
39
+ if (referalCode) {
40
+ leadFormStore.referalData = {
41
+ refererCode,
42
+ referalCode,
43
+ productId,
44
+ };
45
+ }
46
+ else if (!code) {
47
+ leadFormStore.referalData = {
48
+ refererCode: null,
49
+ referalCode: null,
50
+ productId: null,
51
+ };
52
52
  }
53
53
  if (code && state) {
54
54
  requestEsiaProfile(code, state);
@@ -60,4 +60,19 @@ export const useInitApplicationLead = ({ inputs, productType, setEsiaStatus, esi
60
60
  }, []);
61
61
  return initialFormState;
62
62
  };
63
+ const getLeadQueryParams = (referalData) => {
64
+ const queryStorage = new URLSearchParams(decodeURIComponent(globalThis.sessionStorage?.getItem(QUERY_STORAGE_KEY) || ''));
65
+ const code = queryStorage.get('code');
66
+ const state = queryStorage.get('state');
67
+ const referalCode = code ? referalData?.referalCode : queryStorage.get('referalCode');
68
+ const refererCode = code ? referalData?.refererCode : queryStorage.get('refererCode');
69
+ const productId = code ? referalData?.productId : queryStorage.get('productId');
70
+ return {
71
+ code,
72
+ state,
73
+ referalCode,
74
+ refererCode,
75
+ productId,
76
+ };
77
+ };
63
78
  //# sourceMappingURL=useInitApplicationLead.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useInitApplicationLead.js","sourceRoot":"","sources":["../../../src/components/ApplicationLeadForm/useInitApplicationLead.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAGzE,OAAO,EAAE,YAAY,EAAoB,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,u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O,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAChF,CAAC;IAEF,MAAM,IAAI,GAAG,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACtF,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACtF,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAEhF,OAAO;QACL,IAAI;QACJ,KAAK;QACL,WAAW;QACX,WAAW;QACX,SAAS;KACV,CAAC;AACJ,CAAC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { type LeadFormState } from '../../retail/model/LeadFormState';
2
+ import { type ReferalData } from '../../retail/model/ReferalData';
2
3
  import { type ProductType } from './ApplicationLeadFormContent';
3
4
  export interface LeadFormStoreSlice {
4
5
  leadForm: LeadFormState;
@@ -7,6 +8,7 @@ export interface LeadFormStoreSlice {
7
8
  participantId: number;
8
9
  programId: string;
9
10
  productType: ProductType;
11
+ referalData: ReferalData;
10
12
  }
11
13
  export declare const useLeadFormStore: () => {
12
14
  leadForm: LeadFormState | null;
@@ -15,4 +17,5 @@ export declare const useLeadFormStore: () => {
15
17
  participantId: number | null;
16
18
  programId: string | null;
17
19
  productType: ProductType | null;
20
+ referalData: ReferalData | null;
18
21
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useLeadFormStore.js","sourceRoot":"","sources":["../../../src/components/ApplicationLeadForm/useLeadFormStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAa1E,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,aAAa,EAAsB,CAAC"}
1
+ {"version":3,"file":"useLeadFormStore.js","sourceRoot":"","sources":["../../../src/components/ApplicationLeadForm/useLeadFormStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAe1E,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,aAAa,EAAsB,CAAC"}
@@ -17,5 +17,5 @@ export interface OfficesAtmsMapLayoutProps<T> extends ComponentType, TitleProps
17
17
  initFilterState?: InitFilterState;
18
18
  descriptionData?: AtmsDef;
19
19
  }
20
- export declare const OfficesAtmsMapLayout: import("@redneckz/uni-jsx").UNIComponent<OfficesAtmsMapLayoutProps<Branch | RemoteWorkplace | Atm>, any, any>;
20
+ export declare const OfficesAtmsMapLayout: import("@redneckz/uni-jsx").UNIComponent<OfficesAtmsMapLayoutProps<Atm | Branch | RemoteWorkplace>, any, any>;
21
21
  export declare const getFiltersWithNonEmptyData: (data: (Branch | Atm | RemoteWorkplace)[]) => string[];
@@ -1,7 +1,5 @@
1
- export declare type SaveReferalInfo = {
1
+ import { type ReferalData } from '../model/ReferalData';
2
+ export declare type SaveReferalInfo = ReferalData & {
2
3
  taskId: number;
3
- refererCode?: string;
4
- referalCode?: string;
5
- productId?: string;
6
4
  };
7
5
  export declare const saveReferalInfo: (body: SaveReferalInfo) => Promise<Response>;
@@ -1 +1 @@
1
- {"version":3,"file":"saveReferalInfo.js","sourceRoot":"","sources":["../../../src/retail/api/saveReferalInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AASxC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAqB,EAAE,EAAE,CACvD,SAAS,CAAC,0BAA0B,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"saveReferalInfo.js","sourceRoot":"","sources":["../../../src/retail/api/saveReferalInfo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAMxC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAqB,EAAE,EAAE,CACvD,SAAS,CAAC,0BAA0B,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC"}
@@ -81,7 +81,7 @@ export declare const getParticipantIncomes: (participantIncomes: Participant['pa
81
81
  export declare const getParticipantAddresses: (participantAddresses: Participant['participantAddresses']) => {
82
82
  addressRegistration: {
83
83
  addressType: {
84
- key: "REGISTRATION" | "RESIDENTAL" | "WORK";
84
+ key: "WORK" | "REGISTRATION" | "RESIDENTAL";
85
85
  };
86
86
  apartment: string;
87
87
  block: string;
@@ -100,7 +100,7 @@ export declare const getParticipantAddresses: (participantAddresses: Participant
100
100
  } | undefined;
101
101
  addressFact: {
102
102
  addressType: {
103
- key: "REGISTRATION" | "RESIDENTAL" | "WORK";
103
+ key: "WORK" | "REGISTRATION" | "RESIDENTAL";
104
104
  };
105
105
  apartment: string;
106
106
  block: string;
@@ -119,7 +119,7 @@ export declare const getParticipantAddresses: (participantAddresses: Participant
119
119
  } | undefined;
120
120
  organizationAddress: {
121
121
  addressType: {
122
- key: "REGISTRATION" | "RESIDENTAL" | "WORK";
122
+ key: "WORK" | "REGISTRATION" | "RESIDENTAL";
123
123
  };
124
124
  apartment: string;
125
125
  block: string;
@@ -36,4 +36,5 @@ export declare const useRetailFormStore: () => {
36
36
  participantId: number | null;
37
37
  programId: string | null;
38
38
  productType: import("../../components/ApplicationLeadForm/ApplicationLeadFormContent").ProductType | null;
39
+ referalData: import("../model/ReferalData").ReferalData | null;
39
40
  };
@@ -179,7 +179,4 @@ export interface LeadFormState extends FormRetailConsents, FormStateDeliveryType
179
179
  regionHasDelivery?: boolean;
180
180
  files?: File[];
181
181
  deliveryTime?: string;
182
- refererCode?: string;
183
- referalCode?: string;
184
- productId?: string;
185
182
  }
@@ -0,0 +1,6 @@
1
+ import { type Nullable } from '../../utils/Nullable';
2
+ export declare type ReferalData = {
3
+ refererCode?: Nullable<string>;
4
+ referalCode?: Nullable<string>;
5
+ productId?: Nullable<string>;
6
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ReferalData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReferalData.js","sourceRoot":"","sources":["../../../src/retail/model/ReferalData.ts"],"names":[],"mappings":""}
@@ -1 +1,2 @@
1
+ export declare const QUERY_STORAGE_KEY = "rshb-query-params";
1
2
  export declare function saveSessionQuery(): string;
@@ -1,4 +1,4 @@
1
- const QUERY_STORAGE_KEY = 'rshb-query-params';
1
+ export const QUERY_STORAGE_KEY = 'rshb-query-params';
2
2
  export function saveSessionQuery() {
3
3
  const result = globalThis.location?.search || globalThis.sessionStorage?.getItem(QUERY_STORAGE_KEY) || '';
4
4
  if (result) {
@@ -1 +1 @@
1
- {"version":3,"file":"getSessionQuery.js","sourceRoot":"","sources":["../../src/utils/getSessionQuery.ts"],"names":[],"mappings":"AAAA,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAE9C,MAAM,UAAU,gBAAgB;IAC9B,MAAM,MAAM,GACV,UAAU,CAAC,QAAQ,EAAE,MAAM,IAAI,UAAU,CAAC,cAAc,EAAE,OAAO,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;IAE7F,IAAI,MAAM,EAAE;QACV,UAAU,CAAC,cAAc,EAAE,OAAO,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;KAC/D;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"getSessionQuery.js","sourceRoot":"","sources":["../../src/utils/getSessionQuery.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAErD,MAAM,UAAU,gBAAgB;IAC9B,MAAM,MAAM,GACV,UAAU,CAAC,QAAQ,EAAE,MAAM,IAAI,UAAU,CAAC,cAAc,EAAE,OAAO,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;IAE7F,IAAI,MAAM,EAAE;QACV,UAAU,CAAC,cAAc,EAAE,OAAO,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;KAC/D;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -5658,8 +5658,8 @@
5658
5658
  };
5659
5659
 
5660
5660
  /* eslint-disable camelcase */
5661
- const getCreditLeadFormTaskData = ({ participantId, taskId, profileId, formData, }) => {
5662
- const { name, surname, middleName, limitedBirthday, phone, email, referalCode } = formData;
5661
+ const getCreditLeadFormTaskData = ({ participantId, taskId, profileId, formData, referalCode, }) => {
5662
+ const { name, surname, middleName, limitedBirthday, phone, email } = formData;
5663
5663
  const navigator = locationNavigator();
5664
5664
  const taskSource = referalCode ? 'ReferalSF' : navigator.origin;
5665
5665
  return {
@@ -5766,6 +5766,7 @@
5766
5766
  const [isSending, { setTrue: startSending, setFalse: endSending }] = useBool(false);
5767
5767
  const [ok, setOK] = useState();
5768
5768
  const saveUserData = useSaveUserData();
5769
+ const leadFormStore = useLeadFormStore();
5769
5770
  const sendAspects = useSendLeadFormAspects({ data });
5770
5771
  const navigator = locationNavigator();
5771
5772
  const goToNextStep = useCallback(() => {
@@ -5781,6 +5782,7 @@
5781
5782
  const profileId = await createUserProfile({
5782
5783
  profile: { phone: formatPhone(transformedFormData.phone) },
5783
5784
  });
5785
+ const referalData = leadFormStore.referalData;
5784
5786
  if (!profileId) {
5785
5787
  throw new Error();
5786
5788
  }
@@ -5790,6 +5792,7 @@
5790
5792
  profileId,
5791
5793
  formData: transformedFormData,
5792
5794
  productType,
5795
+ referalData,
5793
5796
  saveUserData,
5794
5797
  sendAspects,
5795
5798
  });
@@ -5844,13 +5847,11 @@
5844
5847
  .filter((_) => formData[_])
5845
5848
  .map((_) => consents[_]?.text);
5846
5849
  };
5847
- const updateUserData = async ({ programId, profileId, formData, productType, saveUserData, sendAspects, }) => {
5850
+ const updateUserData = async ({ programId, profileId, formData, productType, referalData, saveUserData, sendAspects, }) => {
5848
5851
  let taskId;
5849
5852
  let participantId;
5850
- const refererCode = formData.refererCode;
5851
- const referalCode = formData.referalCode;
5852
- const productId = formData.productId;
5853
5853
  const transformedConsents = transformConsentsFields(formData, productType);
5854
+ const referalCode = referalData?.referalCode;
5854
5855
  await updateUserProfile(getUpdateUserProfileData(profileId, formData, transformedConsents));
5855
5856
  try {
5856
5857
  if (productType === 'debitCard') {
@@ -5870,13 +5871,12 @@
5870
5871
  taskId,
5871
5872
  profileId,
5872
5873
  formData,
5874
+ referalCode,
5873
5875
  }));
5874
5876
  if (referalCode) {
5875
5877
  await saveReferalInfo({
5876
5878
  taskId,
5877
- refererCode,
5878
- referalCode,
5879
- productId,
5879
+ ...referalData,
5880
5880
  });
5881
5881
  }
5882
5882
  }
@@ -5955,9 +5955,6 @@
5955
5955
  consentInformMaterialsFlg: false,
5956
5956
  consentPhotoFlg: false,
5957
5957
  consentFATCA: false,
5958
- refererCode: '',
5959
- referalCode: '',
5960
- productId: '',
5961
5958
  };
5962
5959
  const getInitialFormState$1 = (inputs, savedForm, esiaAuthSuccess) => {
5963
5960
  if (savedForm) {
@@ -6146,6 +6143,7 @@
6146
6143
  return data.every(Boolean);
6147
6144
  };
6148
6145
 
6146
+ /* eslint-disable max-lines-per-function */
6149
6147
  const useInitApplicationLead = ({ inputs, productType, setEsiaStatus, esiaAuthSuccess, }) => {
6150
6148
  const leadFormStore = useLeadFormStore();
6151
6149
  const saveForm = useSetter(leadFormStore, 'leadForm');
@@ -6172,24 +6170,22 @@
6172
6170
  setEsiaStatus(EsiaStatuses.Error);
6173
6171
  }
6174
6172
  }, []);
6175
- const saveReferalData = useCallback(async (refererCode, referalCode, productId) => {
6176
- saveForm((_) => ({
6177
- ..._,
6178
- refererCode,
6179
- referalCode,
6180
- productId,
6181
- }));
6182
- }, []);
6183
6173
  useEffect(() => {
6184
6174
  leadFormStore.productType = productType;
6185
- const params = new URLSearchParams(decodeURIComponent(globalThis.location?.search));
6186
- const code = params.get('code');
6187
- const state = params.get('state');
6188
- const refererCode = params.get('refererCode');
6189
- const referalCode = params.get('referalCode');
6190
- const productId = params.get('productID');
6191
- if (refererCode && referalCode && productId) {
6192
- saveReferalData(refererCode, referalCode, productId);
6175
+ const { code, state, referalCode, refererCode, productId } = getLeadQueryParams(leadFormStore.referalData);
6176
+ if (referalCode) {
6177
+ leadFormStore.referalData = {
6178
+ refererCode,
6179
+ referalCode,
6180
+ productId,
6181
+ };
6182
+ }
6183
+ else if (!code) {
6184
+ leadFormStore.referalData = {
6185
+ refererCode: null,
6186
+ referalCode: null,
6187
+ productId: null,
6188
+ };
6193
6189
  }
6194
6190
  if (code && state) {
6195
6191
  requestEsiaProfile(code, state);
@@ -6200,6 +6196,21 @@
6200
6196
  }
6201
6197
  }, []);
6202
6198
  return initialFormState;
6199
+ };
6200
+ const getLeadQueryParams = (referalData) => {
6201
+ const queryStorage = new URLSearchParams(decodeURIComponent(globalThis.sessionStorage?.getItem(QUERY_STORAGE_KEY) || ''));
6202
+ const code = queryStorage.get('code');
6203
+ const state = queryStorage.get('state');
6204
+ const referalCode = code ? referalData?.referalCode : queryStorage.get('referalCode');
6205
+ const refererCode = code ? referalData?.refererCode : queryStorage.get('refererCode');
6206
+ const productId = code ? referalData?.productId : queryStorage.get('productId');
6207
+ return {
6208
+ code,
6209
+ state,
6210
+ referalCode,
6211
+ refererCode,
6212
+ productId,
6213
+ };
6203
6214
  };
6204
6215
 
6205
6216
  const ApplicationLeadForm = JSX(({ className, title, programId = '', nextStepLink = '/credit-lead', button, productType = 'credit', data, ...rest }) => {