sales-frontend-api 0.0.97 → 0.0.99

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/dist/method.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Bridge } from 'sales-frontend-bridge';
2
- import { getDudApiHostNameFromEnvironment, getExt, isDspApp, getDspExecutionEnvironment } from 'sales-frontend-utils';
2
+ import { getDspApiHostNameFromEnvironment, getDudApiHostNameFromEnvironment, getExt, isDspApp, getServiceCode, getDspExecutionEnvironment } from 'sales-frontend-utils';
3
3
  import axios from 'axios';
4
4
  import { addRequestLog, addResponseLog, addErrorLog } from 'sales-frontend-debug';
5
5
  import { useClientSessionStore } from 'sales-frontend-stores';
@@ -9,15 +9,6 @@ var __defProp = Object.defineProperty;
9
9
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
10
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
11
11
 
12
- // src/http-methods/method-util.ts
13
- var getServiceCode = () => {
14
- if (typeof window.isStorybookEnv === "boolean") {
15
- return "";
16
- } else {
17
- return `/${location.pathname.split("/")[1]}`;
18
- }
19
- };
20
-
21
12
  // src/http-client/cookie/cookie-client.ts
22
13
  var cookieClient = {
23
14
  getCookie(name) {
@@ -309,11 +300,8 @@ var getTestMethod = async ({ id, config, setupFn }) => {
309
300
  const res = await httpClient.api.get(testAPI);
310
301
  return res.data;
311
302
  };
312
-
313
- // src/http-methods/search-modal/address/address-search.service.ts
314
303
  var getAddressListMethod = async (params, config) => {
315
- const serviceCode = getServiceCode();
316
- const apiUrl = `${serviceCode}/api/dis/v1/get/codes/address-list`;
304
+ const apiUrl = `${getDspApiHostNameFromEnvironment("dis")}/v1/get/codes/address-list`;
317
305
  const httpClient = new HttpClientAxios(config);
318
306
  const res = await httpClient.api.post(apiUrl, params);
319
307
  return res.data;
@@ -329,11 +317,8 @@ var useSearchAddressQuery = (params, options, config) => {
329
317
  ...options
330
318
  });
331
319
  };
332
-
333
- // src/http-methods/search-modal/address/postal-code.service.ts
334
320
  var getAddressPostalCodeMethod = async (params, config) => {
335
- const serviceCode = getServiceCode();
336
- const apiUrl = `${serviceCode}/api/dis/v1/get/codes/address/postal-code`;
321
+ const apiUrl = `${getDspApiHostNameFromEnvironment("dis")}/v1/get/codes/address/postal-code`;
337
322
  const httpClient = new HttpClientAxios(config);
338
323
  const res = await httpClient.api.post(apiUrl, params);
339
324
  return res.data;
@@ -349,11 +334,8 @@ var useSearchPostalCodeQuery = (params, options, config) => {
349
334
  ...options
350
335
  });
351
336
  };
352
-
353
- // src/http-methods/search-modal/address/address-standardization.service.ts
354
337
  var getAddressStandardizationListMethod = async (params, config) => {
355
- const serviceCode = getServiceCode();
356
- const apiUrl = `${serviceCode}/api/dis/v1/get/codes/address-standardization-list`;
338
+ const apiUrl = `${getDspApiHostNameFromEnvironment("dis")}/v1/get/codes/address-standardization-list`;
357
339
  const httpClient = new HttpClientAxios(config);
358
340
  const res = await httpClient.api.post(apiUrl, params);
359
341
  return res.data;
@@ -369,18 +351,14 @@ var useSearchAddressStandardizationQuery = (params, options, config) => {
369
351
  ...options
370
352
  });
371
353
  };
372
-
373
- // src/http-methods/search-modal/occupation/occupation-search.service.ts
374
354
  var getOccupationListMethod = async (params, config) => {
375
- const serviceCode = getServiceCode();
376
- const apiUrl = `${serviceCode}/api/dis/v1/get/codes/occupation-list`;
355
+ const apiUrl = `${getDspApiHostNameFromEnvironment("dis")}/v1/get/codes/occupation-list`;
377
356
  const httpClient = new HttpClientAxios(config);
378
357
  const res = await httpClient.api.post(apiUrl, params);
379
358
  return res.data;
380
359
  };
381
360
  var getOccupationDetailMethod = async (params, config) => {
382
- const serviceCode = getServiceCode();
383
- const apiUrl = `${serviceCode}/api/dis/v1/get/codes/occupation/detail`;
361
+ const apiUrl = `${getDspApiHostNameFromEnvironment("dis")}/v1/get/codes/occupation/detail`;
384
362
  const httpClient = new HttpClientAxios(config);
385
363
  const res = await httpClient.api.post(apiUrl, params);
386
364
  return res.data;
@@ -407,11 +385,8 @@ var useSearchOccupationDetailQuery = (params, options, config) => {
407
385
  ...options
408
386
  });
409
387
  };
410
-
411
- // src/http-methods/search-modal/vehicle/vehicle-search.service.ts
412
388
  var getVehicleListMethod = async (config) => {
413
- const serviceCode = getServiceCode();
414
- const apiUrl = `${serviceCode}/api/dis/v1/get/codes/vehicle-type-list`;
389
+ const apiUrl = `${getDspApiHostNameFromEnvironment("dis")}/v1/get/codes/vehicle-type-list`;
415
390
  const httpClient = new HttpClientAxios(config);
416
391
  const res = await httpClient.api.post(apiUrl);
417
392
  return res.data;
@@ -427,11 +402,8 @@ var useSearchVehicleQuery = (options, config) => {
427
402
  ...options
428
403
  });
429
404
  };
430
-
431
- // src/http-methods/search-modal/employee/employee-search.service.ts
432
405
  var getEmployeeProfileListMethod = async (params, config) => {
433
- const serviceCode = getServiceCode();
434
- const apiUrl = `${serviceCode}/api/dea/v1/get/participant/profile/employee`;
406
+ const apiUrl = `${getDspApiHostNameFromEnvironment("dea")}/v1/get/participant/profile/employee`;
435
407
  const httpClient = new HttpClientAxios(config);
436
408
  const res = await httpClient.api.post(apiUrl, params);
437
409
  return res.data;
@@ -447,11 +419,8 @@ var useSearchEmployeeProfileQuery = (params, options, config) => {
447
419
  ...options
448
420
  });
449
421
  };
450
-
451
- // src/http-methods/search-modal/organization/organization-search.service.ts
452
422
  var getOrganizationProfileListMethod = async (params, config) => {
453
- const serviceCode = getServiceCode();
454
- const apiUrl = `${serviceCode}/api/dea/v1/get/participant/profile/organization`;
423
+ const apiUrl = `${getDspApiHostNameFromEnvironment("dea")}/v1/get/participant/profile/organization`;
455
424
  const httpClient = new HttpClientAxios(config);
456
425
  const res = await httpClient.api.post(apiUrl, params);
457
426
  return res.data;
@@ -467,11 +436,8 @@ var useSearchOrganizationQuery = (params, options, config) => {
467
436
  ...options
468
437
  });
469
438
  };
470
-
471
- // src/http-methods/search-modal/nationality/nationality-search.service.ts
472
439
  var getNationalityListMethod = async (params, config) => {
473
- const serviceCode = getServiceCode();
474
- const apiUrl = `${serviceCode}/api/dis/v1/get/codes/nationality-list`;
440
+ const apiUrl = `${getDspApiHostNameFromEnvironment("dis")}/v1/get/codes/nationality-list`;
475
441
  const httpClient = new HttpClientAxios(config);
476
442
  const res = await httpClient.api.post(apiUrl, params);
477
443
  return res.data;
@@ -488,11 +454,8 @@ var useSearchNationalityQuery = (params, options, config) => {
488
454
  ...options
489
455
  });
490
456
  };
491
-
492
- // src/http-methods/search-modal/customer-list/customer-list-search.service.ts
493
457
  var getCustomerListMethod = async (params, config) => {
494
- const serviceCode = getServiceCode();
495
- const apiUrl = `${serviceCode}/api/dis/v1/get/customer-list`;
458
+ const apiUrl = `${getDspApiHostNameFromEnvironment("dis")}/v1/get/customer-list`;
496
459
  const httpClient = new HttpClientAxios(config);
497
460
  const res = await httpClient.api.post(apiUrl, params);
498
461
  return res.data;
@@ -508,11 +471,8 @@ var useSearchCustomerListQuery = (params, options, config) => {
508
471
  ...options
509
472
  });
510
473
  };
511
-
512
- // src/http-methods/search-modal/risk-grade/risk-grade-search.service.ts
513
474
  var getRiskGradeMethod = async (params, config) => {
514
- const serviceCode = getServiceCode();
515
- const apiUrl = `${serviceCode}/api/dis/v1/get/codes/risk-grade`;
475
+ const apiUrl = `${getDspApiHostNameFromEnvironment("dis")}/v1/get/codes/risk-grade`;
516
476
  const httpClient = new HttpClientAxios(config);
517
477
  const res = await httpClient.api.post(apiUrl, params);
518
478
  return res.data;
@@ -528,11 +488,8 @@ var useSearchRiskGradeQuery = (params, options, config) => {
528
488
  ...options
529
489
  });
530
490
  };
531
-
532
- // src/http-methods/search-modal/dea-customer-list/dea-customer-list-search.service.ts
533
491
  var getDspCustomerListMethod = async (params, config) => {
534
- const serviceCode = getServiceCode();
535
- const apiUrl = `${serviceCode}/api/dea/v1/get/participant/profile/customer/personal`;
492
+ const apiUrl = `${getDspApiHostNameFromEnvironment("dea")}/v1/get/participant/profile/customer/personal`;
536
493
  const httpClient = new HttpClientAxios(config);
537
494
  const res = await httpClient.api.post(apiUrl, params);
538
495
  return res.data;
@@ -548,11 +505,8 @@ var useSearchDspCustomerListQuery = (params, options, config) => {
548
505
  ...options
549
506
  });
550
507
  };
551
-
552
- // src/http-methods/search-modal/visa/visa-search.service.ts
553
508
  var getVisaListMethod = async (config) => {
554
- const serviceCode = getServiceCode();
555
- const apiUrl = `${serviceCode}/api/dis/v1/get/codes/visa-status-list`;
509
+ const apiUrl = `${getDspApiHostNameFromEnvironment("dis")}/v1/get/codes/visa-status-list`;
556
510
  const httpClient = new HttpClientAxios(config);
557
511
  const res = await httpClient.api.post(apiUrl);
558
512
  return res.data;
@@ -568,11 +522,9 @@ var useSearchVisaQuery = (options, config) => {
568
522
  ...options
569
523
  });
570
524
  };
571
-
572
- // src/http-methods/fp-login/login-dsp.service.ts
573
525
  var postLoginMethod = async (userId) => {
574
526
  console.log("userId", userId);
575
- const apiUrl = "/api/dat/v1/post/login";
527
+ const apiUrl = `${getDspApiHostNameFromEnvironment("dat")}/v1/post/login`;
576
528
  const httpClient = new HttpClientAxios({
577
529
  headers: {
578
530
  "Debug-Refresh-Queue-Off": "true"
@@ -584,19 +536,15 @@ var postLoginMethod = async (userId) => {
584
536
  });
585
537
  return res.data;
586
538
  };
587
-
588
- // src/http-methods/remote-identity-verification/remote-identity-verification.service.ts
589
539
  var getRemoteIdentityVerificationSystemToken = async (params, axiosConfig) => {
590
- const serviceCode = getServiceCode();
591
- const apiUrl = `${serviceCode}/api/dea/v1/post/participant/remote-identity-verification-system/token`;
540
+ const apiUrl = `${getDspApiHostNameFromEnvironment("dea")}/v1/post/participant/remote-identity-verification-system/token`;
592
541
  const response = await new HttpClientAxios({
593
542
  ...axiosConfig
594
543
  }).api.post(apiUrl, params);
595
544
  return response.data;
596
545
  };
597
546
  var confirmRemoteIdentityVerificationSystemIdentificationCard = async (params, axiosConfig) => {
598
- const serviceCode = getServiceCode();
599
- const apiUrl = `${serviceCode}/api/dea/v1/post/participant/remote-identity-verification-system/identification-card/confirm`;
547
+ const apiUrl = `${getDspApiHostNameFromEnvironment("dea")}/v1/post/participant/remote-identity-verification-system/identification-card/confirm`;
600
548
  const response = await new HttpClientAxios({
601
549
  ...axiosConfig
602
550
  }).api.post(apiUrl, params);
@@ -615,11 +563,8 @@ var useConfirmRemoteIdentityVerificationSystemIdentificationCardMutation = (opti
615
563
  ...options
616
564
  });
617
565
  };
618
-
619
- // src/http-methods/common-code/common-code-search.service.ts
620
566
  var getCommonCodeListMethod = async (param, config) => {
621
- const serviceCode = getServiceCode();
622
- const apiUrl = `${serviceCode}/api/dea/v1/get/common-code/list`;
567
+ const apiUrl = `${getDspApiHostNameFromEnvironment("dea")}/v1/get/common-code/list`;
623
568
  const httpClient = new HttpClientAxios(config);
624
569
  const res = await httpClient.api.post(apiUrl, param);
625
570
  return res.data;
@@ -635,11 +580,8 @@ var useSearchCommonCodeQuery = (param, options, config) => {
635
580
  ...options
636
581
  });
637
582
  };
638
-
639
- // src/http-methods/app-config/app-config.service.ts
640
583
  var getUserProfile = async (axiosConfig) => {
641
- const serviceCode = getServiceCode();
642
- const apiUrl = `${serviceCode}/api/dat/v1/get/user/profile`;
584
+ const apiUrl = `${getDspApiHostNameFromEnvironment("dat")}/v1/get/user/profile`;
643
585
  const response = await new HttpClientAxios({
644
586
  ...axiosConfig
645
587
  }).api.post(apiUrl);
@@ -650,7 +592,7 @@ var getDayDiffFromToday = (date) => {
650
592
  return Math.floor(diff / (1e3 * 60 * 60 * 24));
651
593
  };
652
594
  var postFileUploadMethod = async (params, config) => {
653
- const apiUrl = `${getDudApiHostNameFromEnvironment(getServiceCode(), location.hostname)}/v1/post/file`;
595
+ const apiUrl = `${getDudApiHostNameFromEnvironment()}/v1/post/file`;
654
596
  const formData = new FormData();
655
597
  if (params.data instanceof File) {
656
598
  formData.append("data", params.data, params.name || params.data.name);
@@ -663,7 +605,7 @@ var postFileUploadMethod = async (params, config) => {
663
605
  params.expireDate && formData.append("preservationTerm", (getDayDiffFromToday(params.expireDate) + 1).toString() || "1");
664
606
  params.preservationTerm && formData.append("preservationTerm", params.preservationTerm.toString() || "1");
665
607
  formData.append("fileType", params.fileType || params.data.type.split("/").pop() || "png");
666
- const httpClient = new HttpClientAxios(config);
608
+ const httpClient = new HttpClientAxios({ ...config, withCredentials: false });
667
609
  httpClient.api.interceptors.response.use((response) => {
668
610
  const { data } = response;
669
611
  if (data.isSuccess === true && data.code.includes("erro")) {
@@ -675,7 +617,7 @@ var postFileUploadMethod = async (params, config) => {
675
617
  return res.data;
676
618
  };
677
619
  async function postFileDownloadMethod(params, config) {
678
- const apiUrl = `${getServiceCode()}/api/dud/v1/get/file`;
620
+ const apiUrl = `${getDudApiHostNameFromEnvironment()}/v1/get/file`;
679
621
  const httpClient = new HttpClientAxios({
680
622
  ...config,
681
623
  ...params.outputType === "BINARY" && { responseType: "blob" }