@redneckz/wildless-cms-uni-blocks 0.14.916 → 0.14.917
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.
- package/bundle/bundle.umd.js +43 -23
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationLeadForm/useInitApplicationLead.d.ts +0 -2
- package/bundle/retail/hooks/useReferalProgramm.d.ts +1 -0
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +3 -1
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/dist/components/ApplicationLeadForm/useInitApplicationLead.d.ts +0 -2
- package/dist/components/ApplicationLeadForm/useInitApplicationLead.js +5 -21
- package/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/dist/retail/hooks/useReferalProgramm.d.ts +1 -0
- package/dist/retail/hooks/useReferalProgramm.js +43 -0
- package/dist/retail/hooks/useReferalProgramm.js.map +1 -0
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +3 -1
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/lib/components/ApplicationLeadForm/useInitApplicationLead.d.ts +0 -2
- package/lib/components/ApplicationLeadForm/useInitApplicationLead.js +5 -21
- package/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +1 -1
- package/lib/retail/hooks/useReferalProgramm.d.ts +1 -0
- package/lib/retail/hooks/useReferalProgramm.js +40 -0
- package/lib/retail/hooks/useReferalProgramm.js.map +1 -0
- package/mobile/bundle/bundle.umd.js +43 -23
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/useInitApplicationLead.d.ts +0 -2
- package/mobile/bundle/retail/hooks/useReferalProgramm.d.ts +1 -0
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +3 -1
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.d.ts +0 -2
- package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js +5 -21
- package/mobile/dist/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/mobile/dist/retail/hooks/useReferalProgramm.d.ts +1 -0
- package/mobile/dist/retail/hooks/useReferalProgramm.js +43 -0
- package/mobile/dist/retail/hooks/useReferalProgramm.js.map +1 -0
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +3 -1
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.d.ts +0 -2
- package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js +5 -21
- package/mobile/lib/components/ApplicationLeadForm/useInitApplicationLead.js.map +1 -1
- package/mobile/lib/retail/hooks/useReferalProgramm.d.ts +1 -0
- package/mobile/lib/retail/hooks/useReferalProgramm.js +40 -0
- package/mobile/lib/retail/hooks/useReferalProgramm.js.map +1 -0
- package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +3 -1
- package/mobile/src/components/ApplicationLeadForm/useInitApplicationLead.ts +6 -32
- package/mobile/src/retail/hooks/useReferalProgramm.ts +45 -0
- package/package.json +1 -1
- package/src/components/ApplicationLeadForm/useApplicationLeadApi.tsx +3 -1
- package/src/components/ApplicationLeadForm/useInitApplicationLead.ts +6 -32
- package/src/retail/hooks/useReferalProgramm.ts +45 -0
|
@@ -4,8 +4,8 @@ import { useSessionStore } from '@redneckz/uni-jsx/lib/Store/useSessionStore';
|
|
|
4
4
|
import { useSetter } from '../../hooks/useSetter';
|
|
5
5
|
import { esiaRequestProfile } from '../../retail/api/esiaRequestProfile';
|
|
6
6
|
import { type MarketingInfo } from '../../retail/api/updateUserTask';
|
|
7
|
+
import { useReferalProgramm } from '../../retail/hooks/useReferalProgramm';
|
|
7
8
|
import { type LeadFormState } from '../../retail/model/LeadFormState';
|
|
8
|
-
import { type ReferalData } from '../../retail/model/ReferalData';
|
|
9
9
|
import { type FieldRetailDef } from '../../retail/model/RetailFormContent';
|
|
10
10
|
import { QUERY_STORAGE_KEY } from '../../utils/getSessionQuery';
|
|
11
11
|
import { EsiaStatuses, type ProductType } from './ApplicationLeadFormContent';
|
|
@@ -23,7 +23,6 @@ type InitApplicationLeadProps = {
|
|
|
23
23
|
|
|
24
24
|
export interface ApplicationLeadStore {
|
|
25
25
|
marketingInfo: MarketingInfo | null;
|
|
26
|
-
referalData: ReferalData | null;
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
export const useInitApplicationLead = ({
|
|
@@ -36,6 +35,7 @@ export const useInitApplicationLead = ({
|
|
|
36
35
|
const saveForm = useSetter(leadFormStore, 'leadForm');
|
|
37
36
|
const sessionStore = useSessionStore<ApplicationLeadStore>();
|
|
38
37
|
const queryFromStorage = globalThis.sessionStorage?.getItem(QUERY_STORAGE_KEY);
|
|
38
|
+
useReferalProgramm();
|
|
39
39
|
|
|
40
40
|
const initialFormState = useMemo(
|
|
41
41
|
() => getInitialFormState(inputs, leadFormStore.leadForm, esiaAuthSuccess),
|
|
@@ -69,20 +69,7 @@ export const useInitApplicationLead = ({
|
|
|
69
69
|
useEffect(() => {
|
|
70
70
|
leadFormStore.productType = productType;
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
queryFromStorage,
|
|
74
|
-
sessionStore,
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
if (referalCode) {
|
|
78
|
-
sessionStore.referalData = {
|
|
79
|
-
refererCode,
|
|
80
|
-
referalCode,
|
|
81
|
-
productId,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
sessionStore.marketingInfo = marketingInfo;
|
|
72
|
+
sessionStore.marketingInfo = getMarketingInfo(queryFromStorage, sessionStore);
|
|
86
73
|
}, [queryFromStorage]);
|
|
87
74
|
|
|
88
75
|
useEffect(() => {
|
|
@@ -102,19 +89,13 @@ export const useInitApplicationLead = ({
|
|
|
102
89
|
return initialFormState;
|
|
103
90
|
};
|
|
104
91
|
|
|
105
|
-
const
|
|
106
|
-
queryFromStorage: string | null,
|
|
107
|
-
sessionStore: ApplicationLeadStore,
|
|
108
|
-
) => {
|
|
109
|
-
const referalData = sessionStore.referalData;
|
|
92
|
+
const getMarketingInfo = (queryFromStorage: string | null, sessionStore: ApplicationLeadStore) => {
|
|
110
93
|
const marketingInfoFromStorage = sessionStore.marketingInfo;
|
|
111
94
|
const queryStorage = new URLSearchParams(decodeURIComponent(queryFromStorage || ''));
|
|
112
95
|
|
|
113
96
|
const code = queryStorage.get('code');
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const productId = code ? referalData?.productId : queryStorage.get('productId');
|
|
117
|
-
const marketingInfo = code
|
|
97
|
+
|
|
98
|
+
return code
|
|
118
99
|
? marketingInfoFromStorage
|
|
119
100
|
: {
|
|
120
101
|
utm_campaign: queryStorage.get('utm_campaign'),
|
|
@@ -125,11 +106,4 @@ const getLeadQueryParams = (
|
|
|
125
106
|
bannerId: queryStorage.get('bannerId'),
|
|
126
107
|
userId: queryStorage.get('userId'),
|
|
127
108
|
};
|
|
128
|
-
|
|
129
|
-
return {
|
|
130
|
-
referalCode,
|
|
131
|
-
refererCode,
|
|
132
|
-
productId,
|
|
133
|
-
marketingInfo,
|
|
134
|
-
};
|
|
135
109
|
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useEffect } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
|
+
import { useLeadFormStore } from '../../components/ApplicationLeadForm/useLeadFormStore';
|
|
3
|
+
import { handleAspects } from '../../hooks/useAspects/handleAspects';
|
|
4
|
+
import { useAspects } from '../../hooks/useAspects/useAspects';
|
|
5
|
+
import { type PreventableEventWithTarget } from '../../ui-kit/PreventableEvent';
|
|
6
|
+
|
|
7
|
+
export const useReferalProgramm = () => {
|
|
8
|
+
const leadFormStore = useLeadFormStore();
|
|
9
|
+
const aspects = useAspects();
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const params = new URLSearchParams(decodeURIComponent(globalThis.location?.search));
|
|
13
|
+
|
|
14
|
+
const referalCode = params.get('referalCode');
|
|
15
|
+
const refererCode = params.get('refererCode');
|
|
16
|
+
const productId = params.get('productId');
|
|
17
|
+
|
|
18
|
+
if (referalCode) {
|
|
19
|
+
leadFormStore.referalData = {
|
|
20
|
+
refererCode,
|
|
21
|
+
referalCode,
|
|
22
|
+
productId,
|
|
23
|
+
};
|
|
24
|
+
const eventJSON = JSON.stringify({
|
|
25
|
+
refererCode,
|
|
26
|
+
referalCode,
|
|
27
|
+
productId,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
handleAspects({
|
|
31
|
+
aspectsAttributes: [
|
|
32
|
+
{
|
|
33
|
+
aspectName: 'snowplowEvent',
|
|
34
|
+
params: {
|
|
35
|
+
eventName: 'ownfin_referal_link_attributes',
|
|
36
|
+
eventJSON,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
aspects,
|
|
41
|
+
ev: {} as PreventableEventWithTarget,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}, []);
|
|
45
|
+
};
|