@redneckz/wildless-cms-uni-blocks 0.14.1006 → 0.14.1007
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 +16 -5
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/retail/api/apiBaseUrl.d.ts +2 -1
- package/bundle/retail/utils/getBaseUrl.d.ts +1 -0
- package/dist/retail/api/apiBaseUrl.d.ts +2 -1
- package/dist/retail/api/apiBaseUrl.js +3 -2
- package/dist/retail/api/apiBaseUrl.js.map +1 -1
- package/dist/retail/api/doRequest.js +3 -4
- package/dist/retail/api/doRequest.js.map +1 -1
- package/dist/retail/hooks/useLeadFormData.js +3 -2
- package/dist/retail/hooks/useLeadFormData.js.map +1 -1
- package/dist/retail/utils/getBaseUrl.d.ts +1 -0
- package/dist/retail/utils/getBaseUrl.js +13 -0
- package/dist/retail/utils/getBaseUrl.js.map +1 -0
- package/lib/components/ApplicationLeadForm/ApplicationLeadForm.fixture.d.ts +1 -0
- package/lib/retail/api/apiBaseUrl.d.ts +2 -1
- package/lib/retail/api/apiBaseUrl.js +2 -1
- package/lib/retail/api/apiBaseUrl.js.map +1 -1
- package/lib/retail/api/doRequest.js +3 -4
- package/lib/retail/api/doRequest.js.map +1 -1
- package/lib/retail/hooks/useLeadFormData.js +3 -2
- package/lib/retail/hooks/useLeadFormData.js.map +1 -1
- package/lib/retail/utils/getBaseUrl.d.ts +1 -0
- package/lib/retail/utils/getBaseUrl.js +10 -0
- package/lib/retail/utils/getBaseUrl.js.map +1 -0
- package/mobile/bundle/bundle.umd.js +16 -5
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/retail/api/apiBaseUrl.d.ts +2 -1
- package/mobile/bundle/retail/utils/getBaseUrl.d.ts +1 -0
- package/mobile/dist/retail/api/apiBaseUrl.d.ts +2 -1
- package/mobile/dist/retail/api/apiBaseUrl.js +3 -2
- package/mobile/dist/retail/api/apiBaseUrl.js.map +1 -1
- package/mobile/dist/retail/api/doRequest.js +3 -4
- package/mobile/dist/retail/api/doRequest.js.map +1 -1
- package/mobile/dist/retail/hooks/useLeadFormData.js +3 -2
- package/mobile/dist/retail/hooks/useLeadFormData.js.map +1 -1
- package/mobile/dist/retail/utils/getBaseUrl.d.ts +1 -0
- package/mobile/dist/retail/utils/getBaseUrl.js +13 -0
- package/mobile/dist/retail/utils/getBaseUrl.js.map +1 -0
- package/mobile/lib/retail/api/apiBaseUrl.d.ts +2 -1
- package/mobile/lib/retail/api/apiBaseUrl.js +2 -1
- package/mobile/lib/retail/api/apiBaseUrl.js.map +1 -1
- package/mobile/lib/retail/api/doRequest.js +3 -4
- package/mobile/lib/retail/api/doRequest.js.map +1 -1
- package/mobile/lib/retail/hooks/useLeadFormData.js +3 -2
- package/mobile/lib/retail/hooks/useLeadFormData.js.map +1 -1
- package/mobile/lib/retail/utils/getBaseUrl.d.ts +1 -0
- package/mobile/lib/retail/utils/getBaseUrl.js +10 -0
- package/mobile/lib/retail/utils/getBaseUrl.js.map +1 -0
- package/mobile/src/retail/api/apiBaseUrl.ts +2 -1
- package/mobile/src/retail/api/doRequest.ts +13 -17
- package/mobile/src/retail/hooks/useLeadFormData.ts +4 -3
- package/mobile/src/retail/utils/getBaseUrl.ts +17 -0
- package/package.json +1 -1
- package/src/components/ApplicationLeadForm/ApplicationLeadForm.fixture.tsx +15 -0
- package/src/retail/api/apiBaseUrl.ts +2 -1
- package/src/retail/api/doRequest.ts +13 -17
- package/src/retail/hooks/useLeadFormData.ts +4 -3
- package/src/retail/utils/getBaseUrl.ts +17 -0
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare const RETAIL_API_BASE_URI = "/light-api-cash/v1";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const NEW_RETAIL_CREDIT_API_BASE_URI = "/api/credit-application";
|
|
3
|
+
export declare const NEW_RETAIL_CREDIT_CARD_API_BASE_URI = "/api/creditcard-application";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getBaseUrl: () => "/light-api-cash/v1" | "/api/credit-application" | "/api/creditcard-application";
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare const RETAIL_API_BASE_URI = "/light-api-cash/v1";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const NEW_RETAIL_CREDIT_API_BASE_URI = "/api/credit-application";
|
|
3
|
+
export declare const NEW_RETAIL_CREDIT_CARD_API_BASE_URI = "/api/creditcard-application";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.
|
|
2
|
+
exports.NEW_RETAIL_CREDIT_CARD_API_BASE_URI = exports.NEW_RETAIL_CREDIT_API_BASE_URI = exports.RETAIL_API_BASE_URI = void 0;
|
|
3
3
|
exports.RETAIL_API_BASE_URI = '/light-api-cash/v1';
|
|
4
|
-
exports.
|
|
4
|
+
exports.NEW_RETAIL_CREDIT_API_BASE_URI = '/api/credit-application';
|
|
5
|
+
exports.NEW_RETAIL_CREDIT_CARD_API_BASE_URI = '/api/creditcard-application';
|
|
5
6
|
//# sourceMappingURL=apiBaseUrl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiBaseUrl.js","sourceRoot":"","sources":["../../../src/retail/api/apiBaseUrl.ts"],"names":[],"mappings":";;AAAa,QAAA,mBAAmB,GAAG,oBAAoB,CAAC;AAC3C,QAAA,
|
|
1
|
+
{"version":3,"file":"apiBaseUrl.js","sourceRoot":"","sources":["../../../src/retail/api/apiBaseUrl.ts"],"names":[],"mappings":";;AAAa,QAAA,mBAAmB,GAAG,oBAAoB,CAAC;AAC3C,QAAA,8BAA8B,GAAG,yBAAyB,CAAC;AAC3D,QAAA,mCAAmC,GAAG,6BAA6B,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
2
|
exports.getAuthorizationHeaders = exports.doRequest = exports.fetchRetailJSON = void 0;
|
|
3
|
-
const
|
|
4
|
-
const apiBaseUrl_1 = require("./apiBaseUrl");
|
|
3
|
+
const getBaseUrl_1 = require("../utils/getBaseUrl");
|
|
5
4
|
const getTraceId_1 = require("./getTraceId");
|
|
6
5
|
const fetchRetailJSON = async (url, method, body) => {
|
|
7
6
|
try {
|
|
@@ -15,9 +14,9 @@ const fetchRetailJSON = async (url, method, body) => {
|
|
|
15
14
|
};
|
|
16
15
|
exports.fetchRetailJSON = fetchRetailJSON;
|
|
17
16
|
async function doRequest(url, method, body) {
|
|
18
|
-
const
|
|
17
|
+
const baseUrl = (0, getBaseUrl_1.getBaseUrl)();
|
|
19
18
|
const traceId = (0, getTraceId_1.getTraceId)();
|
|
20
|
-
return globalThis?.fetch?.(`${
|
|
19
|
+
return globalThis?.fetch?.(`${baseUrl}${url}`, {
|
|
21
20
|
method,
|
|
22
21
|
headers: {
|
|
23
22
|
'Content-Type': 'application/json',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doRequest.js","sourceRoot":"","sources":["../../../src/retail/api/doRequest.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"doRequest.js","sourceRoot":"","sources":["../../../src/retail/api/doRequest.ts"],"names":[],"mappings":";;AAAA,oDAAiD;AACjD,6CAA0C;AAEnC,MAAM,eAAe,GAAG,KAAK,EAClC,GAAW,EACX,MAA8B,EAC9B,IAAU,EACS,EAAE;IACrB,IAAI;QACF,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAEpD,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;KACxB;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEnB,OAAO,IAAI,CAAC;KACb;AACH,CAAC,CAAC;AAdW,QAAA,eAAe,mBAc1B;AAEK,KAAK,UAAU,SAAS,CAC7B,GAAW,EACX,MAA8B,EAC9B,IAAU;IAEV,MAAM,OAAO,GAAG,IAAA,uBAAU,GAAE,CAAC;IAC7B,MAAM,OAAO,GAAG,IAAA,uBAAU,GAAE,CAAC;IAE7B,OAAO,UAAU,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,GAAG,GAAG,EAAE,EAAE;QAC7C,MAAM;QACN,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,cAAc,EAAE,GAAG;YACnB,aAAa,EAAE,OAAO;YACtB,cAAc,EAAE,OAAO;YACvB,GAAG,IAAA,+BAAuB,GAAE;SAC7B;QACD,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI;KACzC,CAAC,CAAC;AACL,CAAC;AApBD,8BAoBC;AAEM,MAAM,uBAAuB,GAAG,GAAG,EAAE;IAC1C,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAEpD,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7D,CAAC,CAAC;AAJW,QAAA,uBAAuB,2BAIlC"}
|
|
@@ -2,11 +2,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
2
2
|
exports.useLeadFormData = void 0;
|
|
3
3
|
const useAsyncData_1 = require("@redneckz/uni-jsx/lib/hooks/useAsyncData");
|
|
4
4
|
const fetchJSON_1 = require("../../utils/fetchJSON");
|
|
5
|
-
const apiBaseUrl_1 = require("../api/apiBaseUrl");
|
|
6
5
|
const checkNewMicroservice_1 = require("../utils/checkNewMicroservice");
|
|
6
|
+
const getBaseUrl_1 = require("../utils/getBaseUrl");
|
|
7
7
|
const useLeadFormData = (typeField) => {
|
|
8
8
|
const isNewMicroservice = (0, checkNewMicroservice_1.checkNewMicroservice)();
|
|
9
|
-
const
|
|
9
|
+
const baseUrl = (0, getBaseUrl_1.getBaseUrl)();
|
|
10
|
+
const { data, error } = (0, useAsyncData_1.useAsyncData)(`${baseUrl}${isNewMicroservice ? `/public-data` : ''}/dictionary?dictionaryType=${encodeURIComponent(typeField)}`, fetchData);
|
|
10
11
|
if (data && 'errorMessage' in data) {
|
|
11
12
|
return { error };
|
|
12
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLeadFormData.js","sourceRoot":"","sources":["../../../src/retail/hooks/useLeadFormData.ts"],"names":[],"mappings":";;AAAA,2EAAwE;AACxE,qDAAkD;
|
|
1
|
+
{"version":3,"file":"useLeadFormData.js","sourceRoot":"","sources":["../../../src/retail/hooks/useLeadFormData.ts"],"names":[],"mappings":";;AAAA,2EAAwE;AACxE,qDAAkD;AAElD,wEAAqE;AACrE,oDAAiD;AAM1C,MAAM,eAAe,GAAG,CAAC,SAAiB,EAAE,EAAE;IACnD,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,GAAE,CAAC;IACjD,MAAM,OAAO,GAAG,IAAA,uBAAU,GAAE,CAAC;IAE7B,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAA,2BAAY,EAClC,GAAG,OAAO,GACR,iBAAiB,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EACvC,8BAA8B,kBAAkB,CAAC,SAAS,CAAC,EAAE,EAC7D,SAAS,CACV,CAAC;IACF,IAAI,IAAI,IAAI,cAAc,IAAI,IAAI,EAAE;QAClC,OAAO,EAAE,KAAK,EAAE,CAAC;KAClB;IAED,OAAO,EAAE,IAAI,EAAE,IAAwB,EAAE,KAAK,EAAE,CAAC;AACnD,CAAC,CAAC;AAfW,QAAA,eAAe,mBAe1B;AAEF,MAAM,SAAS,GAAG,KAAK,EAAE,GAAW,EAA0C,EAAE;IAC9E,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAS,EAAgC,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAEvF,OAAO,MAAM,IAAI,EAAE,CAAC;AACtB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getBaseUrl: () => "/light-api-cash/v1" | "/api/credit-application" | "/api/creditcard-application";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.getBaseUrl = void 0;
|
|
3
|
+
const apiBaseUrl_1 = require("../api/apiBaseUrl");
|
|
4
|
+
const getBaseUrl = () => {
|
|
5
|
+
const isNewMicroservice = globalThis.sessionStorage?.getItem('isNewMicroservice');
|
|
6
|
+
const productType = globalThis.localStorage?.getItem('productType');
|
|
7
|
+
const newRetailApi = productType === '"credit"'
|
|
8
|
+
? apiBaseUrl_1.NEW_RETAIL_CREDIT_API_BASE_URI
|
|
9
|
+
: apiBaseUrl_1.NEW_RETAIL_CREDIT_CARD_API_BASE_URI;
|
|
10
|
+
return isNewMicroservice ? newRetailApi : apiBaseUrl_1.RETAIL_API_BASE_URI;
|
|
11
|
+
};
|
|
12
|
+
exports.getBaseUrl = getBaseUrl;
|
|
13
|
+
//# sourceMappingURL=getBaseUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBaseUrl.js","sourceRoot":"","sources":["../../../src/retail/utils/getBaseUrl.ts"],"names":[],"mappings":";;AAAA,kDAI2B;AAEpB,MAAM,UAAU,GAAG,GAAG,EAAE;IAC7B,MAAM,iBAAiB,GAAG,UAAU,CAAC,cAAc,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAClF,MAAM,WAAW,GAAG,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAEpE,MAAM,YAAY,GAChB,WAAW,KAAK,UAAU;QACxB,CAAC,CAAC,2CAA8B;QAChC,CAAC,CAAC,gDAAmC,CAAC;IAE1C,OAAO,iBAAiB,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,gCAAmB,CAAC;AAChE,CAAC,CAAC;AAVW,QAAA,UAAU,cAUrB"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare const RETAIL_API_BASE_URI = "/light-api-cash/v1";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const NEW_RETAIL_CREDIT_API_BASE_URI = "/api/credit-application";
|
|
3
|
+
export declare const NEW_RETAIL_CREDIT_CARD_API_BASE_URI = "/api/creditcard-application";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export const RETAIL_API_BASE_URI = '/light-api-cash/v1';
|
|
2
|
-
export const
|
|
2
|
+
export const NEW_RETAIL_CREDIT_API_BASE_URI = '/api/credit-application';
|
|
3
|
+
export const NEW_RETAIL_CREDIT_CARD_API_BASE_URI = '/api/creditcard-application';
|
|
3
4
|
//# sourceMappingURL=apiBaseUrl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiBaseUrl.js","sourceRoot":"","sources":["../../../src/retail/api/apiBaseUrl.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AACxD,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"apiBaseUrl.js","sourceRoot":"","sources":["../../../src/retail/api/apiBaseUrl.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AACxD,MAAM,CAAC,MAAM,8BAA8B,GAAG,yBAAyB,CAAC;AACxE,MAAM,CAAC,MAAM,mCAAmC,GAAG,6BAA6B,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { NEW_RETAIL_API_BASE_URI, RETAIL_API_BASE_URI } from './apiBaseUrl.js';
|
|
1
|
+
import { getBaseUrl } from '../utils/getBaseUrl.js';
|
|
3
2
|
import { getTraceId } from './getTraceId.js';
|
|
4
3
|
export const fetchRetailJSON = async (url, method, body) => {
|
|
5
4
|
try {
|
|
@@ -12,9 +11,9 @@ export const fetchRetailJSON = async (url, method, body) => {
|
|
|
12
11
|
}
|
|
13
12
|
};
|
|
14
13
|
export async function doRequest(url, method, body) {
|
|
15
|
-
const
|
|
14
|
+
const baseUrl = getBaseUrl();
|
|
16
15
|
const traceId = getTraceId();
|
|
17
|
-
return globalThis?.fetch?.(`${
|
|
16
|
+
return globalThis?.fetch?.(`${baseUrl}${url}`, {
|
|
18
17
|
method,
|
|
19
18
|
headers: {
|
|
20
19
|
'Content-Type': 'application/json',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doRequest.js","sourceRoot":"","sources":["../../../src/retail/api/doRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"doRequest.js","sourceRoot":"","sources":["../../../src/retail/api/doRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAClC,GAAW,EACX,MAA8B,EAC9B,IAAU,EACS,EAAE;IACrB,IAAI;QACF,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAEpD,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;KACxB;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEnB,OAAO,IAAI,CAAC;KACb;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,GAAW,EACX,MAA8B,EAC9B,IAAU;IAEV,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,OAAO,UAAU,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,GAAG,GAAG,EAAE,EAAE;QAC7C,MAAM;QACN,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,cAAc,EAAE,GAAG;YACnB,aAAa,EAAE,OAAO;YACtB,cAAc,EAAE,OAAO;YACvB,GAAG,uBAAuB,EAAE;SAC7B;QACD,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI;KACzC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,EAAE;IAC1C,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAEpD,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7D,CAAC,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { useAsyncData } from '@redneckz/uni-jsx/lib/hooks/useAsyncData';
|
|
2
2
|
import { fetchJSON } from '../../utils/fetchJSON.js';
|
|
3
|
-
import { NEW_RETAIL_API_BASE_URI, RETAIL_API_BASE_URI } from '../api/apiBaseUrl.js';
|
|
4
3
|
import { checkNewMicroservice } from '../utils/checkNewMicroservice.js';
|
|
4
|
+
import { getBaseUrl } from '../utils/getBaseUrl.js';
|
|
5
5
|
export const useLeadFormData = (typeField) => {
|
|
6
6
|
const isNewMicroservice = checkNewMicroservice();
|
|
7
|
-
const
|
|
7
|
+
const baseUrl = getBaseUrl();
|
|
8
|
+
const { data, error } = useAsyncData(`${baseUrl}${isNewMicroservice ? `/public-data` : ''}/dictionary?dictionaryType=${encodeURIComponent(typeField)}`, fetchData);
|
|
8
9
|
if (data && 'errorMessage' in data) {
|
|
9
10
|
return { error };
|
|
10
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLeadFormData.js","sourceRoot":"","sources":["../../../src/retail/hooks/useLeadFormData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"useLeadFormData.js","sourceRoot":"","sources":["../../../src/retail/hooks/useLeadFormData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAMjD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAiB,EAAE,EAAE;IACnD,MAAM,iBAAiB,GAAG,oBAAoB,EAAE,CAAC;IACjD,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,YAAY,CAClC,GAAG,OAAO,GACR,iBAAiB,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EACvC,8BAA8B,kBAAkB,CAAC,SAAS,CAAC,EAAE,EAC7D,SAAS,CACV,CAAC;IACF,IAAI,IAAI,IAAI,cAAc,IAAI,IAAI,EAAE;QAClC,OAAO,EAAE,KAAK,EAAE,CAAC;KAClB;IAED,OAAO,EAAE,IAAI,EAAE,IAAwB,EAAE,KAAK,EAAE,CAAC;AACnD,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,KAAK,EAAE,GAAW,EAA0C,EAAE;IAC9E,MAAM,MAAM,GAAG,MAAM,SAAS,CAAgC,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAEvF,OAAO,MAAM,IAAI,EAAE,CAAC;AACtB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getBaseUrl: () => "/light-api-cash/v1" | "/api/credit-application" | "/api/creditcard-application";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NEW_RETAIL_CREDIT_API_BASE_URI, NEW_RETAIL_CREDIT_CARD_API_BASE_URI, RETAIL_API_BASE_URI, } from '../api/apiBaseUrl.js';
|
|
2
|
+
export const getBaseUrl = () => {
|
|
3
|
+
const isNewMicroservice = globalThis.sessionStorage?.getItem('isNewMicroservice');
|
|
4
|
+
const productType = globalThis.localStorage?.getItem('productType');
|
|
5
|
+
const newRetailApi = productType === '"credit"'
|
|
6
|
+
? NEW_RETAIL_CREDIT_API_BASE_URI
|
|
7
|
+
: NEW_RETAIL_CREDIT_CARD_API_BASE_URI;
|
|
8
|
+
return isNewMicroservice ? newRetailApi : RETAIL_API_BASE_URI;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=getBaseUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBaseUrl.js","sourceRoot":"","sources":["../../../src/retail/utils/getBaseUrl.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,mCAAmC,EACnC,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAC7B,MAAM,iBAAiB,GAAG,UAAU,CAAC,cAAc,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAClF,MAAM,WAAW,GAAG,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAEpE,MAAM,YAAY,GAChB,WAAW,KAAK,UAAU;QACxB,CAAC,CAAC,8BAA8B;QAChC,CAAC,CAAC,mCAAmC,CAAC;IAE1C,OAAO,iBAAiB,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,mBAAmB,CAAC;AAChE,CAAC,CAAC"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export const RETAIL_API_BASE_URI = '/light-api-cash/v1';
|
|
2
|
-
export const
|
|
2
|
+
export const NEW_RETAIL_CREDIT_API_BASE_URI = '/api/credit-application';
|
|
3
|
+
export const NEW_RETAIL_CREDIT_CARD_API_BASE_URI = '/api/creditcard-application';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { NEW_RETAIL_API_BASE_URI, RETAIL_API_BASE_URI } from './apiBaseUrl';
|
|
1
|
+
import { getBaseUrl } from '../utils/getBaseUrl';
|
|
3
2
|
import { getTraceId } from './getTraceId';
|
|
4
3
|
|
|
5
4
|
export const fetchRetailJSON = async <R>(
|
|
@@ -23,24 +22,21 @@ export async function doRequest(
|
|
|
23
22
|
method: 'POST' | 'GET' | 'PUT',
|
|
24
23
|
body?: any,
|
|
25
24
|
): Promise<Response> {
|
|
26
|
-
const
|
|
25
|
+
const baseUrl = getBaseUrl();
|
|
27
26
|
const traceId = getTraceId();
|
|
28
27
|
|
|
29
|
-
return globalThis?.fetch?.(
|
|
30
|
-
|
|
31
|
-
{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
'X-B3-Traceid': traceId,
|
|
38
|
-
...getAuthorizationHeaders(),
|
|
39
|
-
},
|
|
40
|
-
credentials: 'include',
|
|
41
|
-
body: body ? JSON.stringify(body) : null,
|
|
28
|
+
return globalThis?.fetch?.(`${baseUrl}${url}`, {
|
|
29
|
+
method,
|
|
30
|
+
headers: {
|
|
31
|
+
'Content-Type': 'application/json',
|
|
32
|
+
'X-B3-Sampled': '1',
|
|
33
|
+
'X-B3-Spanid': traceId,
|
|
34
|
+
'X-B3-Traceid': traceId,
|
|
35
|
+
...getAuthorizationHeaders(),
|
|
42
36
|
},
|
|
43
|
-
|
|
37
|
+
credentials: 'include',
|
|
38
|
+
body: body ? JSON.stringify(body) : null,
|
|
39
|
+
});
|
|
44
40
|
}
|
|
45
41
|
|
|
46
42
|
export const getAuthorizationHeaders = () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useAsyncData } from '@redneckz/uni-jsx/lib/hooks/useAsyncData';
|
|
2
2
|
import { fetchJSON } from '../../utils/fetchJSON';
|
|
3
|
-
import { NEW_RETAIL_API_BASE_URI, RETAIL_API_BASE_URI } from '../api/apiBaseUrl';
|
|
4
3
|
import { type DictionaryItem } from '../model/LeadFormData';
|
|
5
4
|
import { checkNewMicroservice } from '../utils/checkNewMicroservice';
|
|
5
|
+
import { getBaseUrl } from '../utils/getBaseUrl';
|
|
6
6
|
|
|
7
7
|
type ErrorProps = {
|
|
8
8
|
errorMessage?: string;
|
|
@@ -10,10 +10,11 @@ type ErrorProps = {
|
|
|
10
10
|
|
|
11
11
|
export const useLeadFormData = (typeField: string) => {
|
|
12
12
|
const isNewMicroservice = checkNewMicroservice();
|
|
13
|
+
const baseUrl = getBaseUrl();
|
|
13
14
|
|
|
14
15
|
const { data, error } = useAsyncData(
|
|
15
|
-
`${
|
|
16
|
-
isNewMicroservice ?
|
|
16
|
+
`${baseUrl}${
|
|
17
|
+
isNewMicroservice ? `/public-data` : ''
|
|
17
18
|
}/dictionary?dictionaryType=${encodeURIComponent(typeField)}`,
|
|
18
19
|
fetchData,
|
|
19
20
|
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NEW_RETAIL_CREDIT_API_BASE_URI,
|
|
3
|
+
NEW_RETAIL_CREDIT_CARD_API_BASE_URI,
|
|
4
|
+
RETAIL_API_BASE_URI,
|
|
5
|
+
} from '../api/apiBaseUrl';
|
|
6
|
+
|
|
7
|
+
export const getBaseUrl = () => {
|
|
8
|
+
const isNewMicroservice = globalThis.sessionStorage?.getItem('isNewMicroservice');
|
|
9
|
+
const productType = globalThis.localStorage?.getItem('productType');
|
|
10
|
+
|
|
11
|
+
const newRetailApi =
|
|
12
|
+
productType === '"credit"'
|
|
13
|
+
? NEW_RETAIL_CREDIT_API_BASE_URI
|
|
14
|
+
: NEW_RETAIL_CREDIT_CARD_API_BASE_URI;
|
|
15
|
+
|
|
16
|
+
return isNewMicroservice ? newRetailApi : RETAIL_API_BASE_URI;
|
|
17
|
+
};
|
package/package.json
CHANGED
|
@@ -39,6 +39,21 @@ export default {
|
|
|
39
39
|
</div>
|
|
40
40
|
),
|
|
41
41
|
|
|
42
|
+
newMicroserviceCC: (
|
|
43
|
+
<div className="container grid grid-cols-12">
|
|
44
|
+
<ApplicationLeadForm
|
|
45
|
+
className="col-span-12"
|
|
46
|
+
title="Заявка на кредит"
|
|
47
|
+
programId="13"
|
|
48
|
+
productType="creditCard"
|
|
49
|
+
button={button}
|
|
50
|
+
isNewMicroservice={true}
|
|
51
|
+
/>
|
|
52
|
+
<PopupManager />
|
|
53
|
+
<DialogManager />
|
|
54
|
+
</div>
|
|
55
|
+
),
|
|
56
|
+
|
|
42
57
|
creditCard: (
|
|
43
58
|
<div className="container grid grid-cols-12">
|
|
44
59
|
<ApplicationLeadForm
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export const RETAIL_API_BASE_URI = '/light-api-cash/v1';
|
|
2
|
-
export const
|
|
2
|
+
export const NEW_RETAIL_CREDIT_API_BASE_URI = '/api/credit-application';
|
|
3
|
+
export const NEW_RETAIL_CREDIT_CARD_API_BASE_URI = '/api/creditcard-application';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { NEW_RETAIL_API_BASE_URI, RETAIL_API_BASE_URI } from './apiBaseUrl';
|
|
1
|
+
import { getBaseUrl } from '../utils/getBaseUrl';
|
|
3
2
|
import { getTraceId } from './getTraceId';
|
|
4
3
|
|
|
5
4
|
export const fetchRetailJSON = async <R>(
|
|
@@ -23,24 +22,21 @@ export async function doRequest(
|
|
|
23
22
|
method: 'POST' | 'GET' | 'PUT',
|
|
24
23
|
body?: any,
|
|
25
24
|
): Promise<Response> {
|
|
26
|
-
const
|
|
25
|
+
const baseUrl = getBaseUrl();
|
|
27
26
|
const traceId = getTraceId();
|
|
28
27
|
|
|
29
|
-
return globalThis?.fetch?.(
|
|
30
|
-
|
|
31
|
-
{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
'X-B3-Traceid': traceId,
|
|
38
|
-
...getAuthorizationHeaders(),
|
|
39
|
-
},
|
|
40
|
-
credentials: 'include',
|
|
41
|
-
body: body ? JSON.stringify(body) : null,
|
|
28
|
+
return globalThis?.fetch?.(`${baseUrl}${url}`, {
|
|
29
|
+
method,
|
|
30
|
+
headers: {
|
|
31
|
+
'Content-Type': 'application/json',
|
|
32
|
+
'X-B3-Sampled': '1',
|
|
33
|
+
'X-B3-Spanid': traceId,
|
|
34
|
+
'X-B3-Traceid': traceId,
|
|
35
|
+
...getAuthorizationHeaders(),
|
|
42
36
|
},
|
|
43
|
-
|
|
37
|
+
credentials: 'include',
|
|
38
|
+
body: body ? JSON.stringify(body) : null,
|
|
39
|
+
});
|
|
44
40
|
}
|
|
45
41
|
|
|
46
42
|
export const getAuthorizationHeaders = () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useAsyncData } from '@redneckz/uni-jsx/lib/hooks/useAsyncData';
|
|
2
2
|
import { fetchJSON } from '../../utils/fetchJSON';
|
|
3
|
-
import { NEW_RETAIL_API_BASE_URI, RETAIL_API_BASE_URI } from '../api/apiBaseUrl';
|
|
4
3
|
import { type DictionaryItem } from '../model/LeadFormData';
|
|
5
4
|
import { checkNewMicroservice } from '../utils/checkNewMicroservice';
|
|
5
|
+
import { getBaseUrl } from '../utils/getBaseUrl';
|
|
6
6
|
|
|
7
7
|
type ErrorProps = {
|
|
8
8
|
errorMessage?: string;
|
|
@@ -10,10 +10,11 @@ type ErrorProps = {
|
|
|
10
10
|
|
|
11
11
|
export const useLeadFormData = (typeField: string) => {
|
|
12
12
|
const isNewMicroservice = checkNewMicroservice();
|
|
13
|
+
const baseUrl = getBaseUrl();
|
|
13
14
|
|
|
14
15
|
const { data, error } = useAsyncData(
|
|
15
|
-
`${
|
|
16
|
-
isNewMicroservice ?
|
|
16
|
+
`${baseUrl}${
|
|
17
|
+
isNewMicroservice ? `/public-data` : ''
|
|
17
18
|
}/dictionary?dictionaryType=${encodeURIComponent(typeField)}`,
|
|
18
19
|
fetchData,
|
|
19
20
|
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NEW_RETAIL_CREDIT_API_BASE_URI,
|
|
3
|
+
NEW_RETAIL_CREDIT_CARD_API_BASE_URI,
|
|
4
|
+
RETAIL_API_BASE_URI,
|
|
5
|
+
} from '../api/apiBaseUrl';
|
|
6
|
+
|
|
7
|
+
export const getBaseUrl = () => {
|
|
8
|
+
const isNewMicroservice = globalThis.sessionStorage?.getItem('isNewMicroservice');
|
|
9
|
+
const productType = globalThis.localStorage?.getItem('productType');
|
|
10
|
+
|
|
11
|
+
const newRetailApi =
|
|
12
|
+
productType === '"credit"'
|
|
13
|
+
? NEW_RETAIL_CREDIT_API_BASE_URI
|
|
14
|
+
: NEW_RETAIL_CREDIT_CARD_API_BASE_URI;
|
|
15
|
+
|
|
16
|
+
return isNewMicroservice ? newRetailApi : RETAIL_API_BASE_URI;
|
|
17
|
+
};
|