@redneckz/wildless-cms-uni-blocks 0.16.6-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 (122) hide show
  1. package/bundle/bundle.umd.js +36 -26
  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 +28 -14
  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 +28 -14
  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/hooks/useRetailFormStore.d.ts +1 -0
  46. package/lib/retail/model/LeadFormState.d.ts +0 -3
  47. package/lib/retail/model/ReferalData.d.ts +6 -0
  48. package/lib/retail/model/ReferalData.js +2 -0
  49. package/lib/retail/model/ReferalData.js.map +1 -0
  50. package/lib/utils/getSessionQuery.d.ts +1 -0
  51. package/lib/utils/getSessionQuery.js +1 -1
  52. package/lib/utils/getSessionQuery.js.map +1 -1
  53. package/mobile/bundle/bundle.umd.js +36 -26
  54. package/mobile/bundle/bundle.umd.min.js +1 -1
  55. package/mobile/bundle/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +3 -1
  56. package/mobile/bundle/components/ApplicationLeadForm/useLeadFormStore.d.ts +3 -0
  57. package/mobile/bundle/retail/api/saveReferalInfo.d.ts +2 -4
  58. package/mobile/bundle/retail/hooks/useRetailFormStore.d.ts +1 -0
  59. package/mobile/bundle/retail/model/LeadFormState.d.ts +0 -3
  60. package/mobile/bundle/retail/model/ReferalData.d.ts +6 -0
  61. package/mobile/bundle/utils/getSessionQuery.d.ts +1 -0
  62. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js +0 -3
  63. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  64. package/mobile/dist/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +3 -1
  65. package/mobile/dist/components/ApplicationLeadForm/getLeadFormTaskData.js +2 -2
  66. package/mobile/dist/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
  67. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +8 -7
  68. package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  69. package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js +28 -14
  70. package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  71. package/mobile/dist/components/ApplicationLeadForm/useLeadFormStore.d.ts +3 -0
  72. package/mobile/dist/components/ApplicationLeadForm/useLeadFormStore.js.map +1 -1
  73. package/mobile/dist/retail/api/saveReferalInfo.d.ts +2 -4
  74. package/mobile/dist/retail/api/saveReferalInfo.js.map +1 -1
  75. package/mobile/dist/retail/hooks/useRetailFormStore.d.ts +1 -0
  76. package/mobile/dist/retail/model/LeadFormState.d.ts +0 -3
  77. package/mobile/dist/retail/model/ReferalData.d.ts +6 -0
  78. package/mobile/dist/retail/model/ReferalData.js +2 -0
  79. package/mobile/dist/retail/model/ReferalData.js.map +1 -0
  80. package/mobile/dist/utils/getSessionQuery.d.ts +1 -0
  81. package/mobile/dist/utils/getSessionQuery.js +4 -4
  82. package/mobile/dist/utils/getSessionQuery.js.map +1 -1
  83. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js +0 -3
  84. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  85. package/mobile/lib/components/ApplicationLeadForm/getLeadFormTaskData.d.ts +3 -1
  86. package/mobile/lib/components/ApplicationLeadForm/getLeadFormTaskData.js +2 -2
  87. package/mobile/lib/components/ApplicationLeadForm/getLeadFormTaskData.js.map +1 -1
  88. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +8 -7
  89. package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
  90. package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js +28 -14
  91. package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
  92. package/mobile/lib/components/ApplicationLeadForm/useLeadFormStore.d.ts +3 -0
  93. package/mobile/lib/components/ApplicationLeadForm/useLeadFormStore.js.map +1 -1
  94. package/mobile/lib/retail/api/saveReferalInfo.d.ts +2 -4
  95. package/mobile/lib/retail/api/saveReferalInfo.js.map +1 -1
  96. package/mobile/lib/retail/hooks/useRetailFormStore.d.ts +1 -0
  97. package/mobile/lib/retail/model/LeadFormState.d.ts +0 -3
  98. package/mobile/lib/retail/model/ReferalData.d.ts +6 -0
  99. package/mobile/lib/retail/model/ReferalData.js +2 -0
  100. package/mobile/lib/retail/model/ReferalData.js.map +1 -0
  101. package/mobile/lib/utils/getSessionQuery.d.ts +1 -0
  102. package/mobile/lib/utils/getSessionQuery.js +1 -1
  103. package/mobile/lib/utils/getSessionQuery.js.map +1 -1
  104. package/mobile/src/components/ApplicationLeadForm/getInitialFormState.tsx +0 -3
  105. package/mobile/src/components/ApplicationLeadForm/getLeadFormTaskData.ts +4 -1
  106. package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +11 -6
  107. package/mobile/src/components/ApplicationLeadForm/useInitApplicationLead.ts +35 -15
  108. package/mobile/src/components/ApplicationLeadForm/useLeadFormStore.ts +2 -0
  109. package/mobile/src/retail/api/saveReferalInfo.ts +2 -4
  110. package/mobile/src/retail/model/LeadFormState.ts +0 -3
  111. package/mobile/src/retail/model/ReferalData.ts +7 -0
  112. package/mobile/src/utils/getSessionQuery.ts +1 -1
  113. package/package.json +1 -1
  114. package/src/components/ApplicationLeadForm/getInitialFormState.tsx +0 -3
  115. package/src/components/ApplicationLeadForm/getLeadFormTaskData.ts +4 -1
  116. package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +11 -6
  117. package/src/components/ApplicationLeadForm/useInitApplicationLead.ts +35 -15
  118. package/src/components/ApplicationLeadForm/useLeadFormStore.ts +2 -0
  119. package/src/retail/api/saveReferalInfo.ts +2 -4
  120. package/src/retail/model/LeadFormState.ts +0 -3
  121. package/src/retail/model/ReferalData.ts +7 -0
  122. 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,25 +33,22 @@ export const useInitApplicationLead = ({ inputs, productType, setEsiaStatus, esi
31
33
  setEsiaStatus(EsiaStatuses.Error);
32
34
  }
33
35
  }, []);
34
- const saveReferalData = useCallback((referalData) => {
35
- saveForm((_) => ({
36
- ..._,
37
- ...referalData,
38
- }));
39
- }, []);
40
36
  useEffect(() => {
41
37
  leadFormStore.productType = productType;
42
- const params = new URLSearchParams(decodeURIComponent(globalThis.location?.search));
43
- const code = params.get('code');
44
- const state = params.get('state');
45
- const referalCode = params.get('referalCode');
38
+ const { code, state, referalCode, refererCode, productId } = getLeadQueryParams(leadFormStore.referalData);
46
39
  if (referalCode) {
47
- const referalData = {
48
- refererCode: params.get('refererCode'),
40
+ leadFormStore.referalData = {
41
+ refererCode,
49
42
  referalCode,
50
- productId: params.get('productId'),
43
+ productId,
44
+ };
45
+ }
46
+ else if (!code) {
47
+ leadFormStore.referalData = {
48
+ refererCode: null,
49
+ referalCode: null,
50
+ productId: null,
51
51
  };
52
- saveReferalData(referalData);
53
52
  }
54
53
  if (code && state) {
55
54
  requestEsiaProfile(code, state);
@@ -61,4 +60,19 @@ export const useInitApplicationLead = ({ inputs, productType, setEsiaStatus, esi
61
60
  }, []);
62
61
  return initialFormState;
63
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
+ };
64
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,uBAAuB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAA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AE,CAAC,CAAC;YACf,GAAG,CAAC;YACJ,GAAG,WAAW;SACf,CAAC,CAAC,CAAC;IACN,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACb,aAAa,CAAC,WAAW,GAAG,WAAW,CAAC;QAExC,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,kBAAkB,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;QACpF,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAChC,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAClC,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAE9C,IAAI,WAAW,EAAE;YACf,MAAM,WAAW,GAAG;gBAClB,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC;gBACtC,WAAW;gBACX,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC;aACnC,CAAC;YACF,eAAe,CAAC,WAAW,CAAC,CAAC;SAC9B;QAED,IAAI,IAAI,IAAI,KAAK,EAAE;YACjB,kBAAkB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;SACjC;aAAM;YACL,cAAc,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;YACzC,cAAc,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;SAC3C;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC"}
1
+ {"version":3,"file":"useInitApplicationLead.js","sourceRoot":"","sources":["../../../src/components/ApplicationLeadForm/useInitApplicationLead.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;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AAC,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"}
@@ -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,25 +6170,22 @@
6172
6170
  setEsiaStatus(EsiaStatuses.Error);
6173
6171
  }
6174
6172
  }, []);
6175
- const saveReferalData = useCallback((referalData) => {
6176
- saveForm((_) => ({
6177
- ..._,
6178
- ...referalData,
6179
- }));
6180
- }, []);
6181
6173
  useEffect(() => {
6182
6174
  leadFormStore.productType = productType;
6183
- const params = new URLSearchParams(decodeURIComponent(globalThis.location?.search));
6184
- const code = params.get('code');
6185
- const state = params.get('state');
6186
- const referalCode = params.get('referalCode');
6175
+ const { code, state, referalCode, refererCode, productId } = getLeadQueryParams(leadFormStore.referalData);
6187
6176
  if (referalCode) {
6188
- const referalData = {
6189
- refererCode: params.get('refererCode'),
6177
+ leadFormStore.referalData = {
6178
+ refererCode,
6190
6179
  referalCode,
6191
- productId: params.get('productId'),
6180
+ productId,
6181
+ };
6182
+ }
6183
+ else if (!code) {
6184
+ leadFormStore.referalData = {
6185
+ refererCode: null,
6186
+ referalCode: null,
6187
+ productId: null,
6192
6188
  };
6193
- saveReferalData(referalData);
6194
6189
  }
6195
6190
  if (code && state) {
6196
6191
  requestEsiaProfile(code, state);
@@ -6201,6 +6196,21 @@
6201
6196
  }
6202
6197
  }, []);
6203
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
+ };
6204
6214
  };
6205
6215
 
6206
6216
  const ApplicationLeadForm = JSX(({ className, title, programId = '', nextStepLink = '/credit-lead', button, productType = 'credit', data, ...rest }) => {