nextemos 4.2.4 → 4.2.6

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.
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const html_entities_1 = require("html-entities");
4
- const nextemos_config_1 = require("../nextemos-config");
5
- const { CdnUrl, CdnProvider, VideoCdnUrl, ThumborSource } = (0, nextemos_config_1.getConfigs)();
6
- const CDN_URL = CdnUrl || '';
7
- const VIDEO_CDN_URL = VideoCdnUrl || CDN_URL;
8
- const CDN_PROVIDER = CdnProvider;
9
- const THUMBOR_SOURCE = ThumborSource;
4
+ const CDN_URL = process.env.CDN_URL || 'https://images.proj-e.com';
5
+ const VIDEO_CDN_URL = process.env.VIDEO_CDN_URL || CDN_URL;
6
+ const CDN_PROVIDER = process.env.CDN_PROVIDER || 'thumbor';
7
+ const THUMBOR_SOURCE = process.env.THUMBOR_SOURCE;
10
8
  // CDN işlemleri için kullanılan nesne
11
9
  const cdn = {
12
10
  // CDN URL'sini döndüren özellik
@@ -52,6 +52,12 @@ const fetchRequest = () => {
52
52
  }
53
53
  if (!response.ok) {
54
54
  const errorDetail = yield response.text();
55
+ console.log("Fetch Error: ", {
56
+ api: apiURL,
57
+ status: response.status,
58
+ errorMessage: errorDetail,
59
+ headers
60
+ });
55
61
  return {
56
62
  status: response.status,
57
63
  errorMessage: errorDetail,
@@ -60,6 +66,10 @@ const fetchRequest = () => {
60
66
  }
61
67
  // response data nesnesini JSON'a dönüştürme.
62
68
  const responseData = yield response.json().catch(() => ({}));
69
+ console.log("Fetch Success: ", {
70
+ api: apiURL,
71
+ status: response.status
72
+ });
63
73
  return {
64
74
  status: response.status,
65
75
  data: responseData,
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- export * from './nextemos-config';
2
1
  export * from './helpers';
3
2
  export * from './interfaces';
4
3
  export * from './enums';
package/dist/index.js CHANGED
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./nextemos-config"), exports);
18
17
  __exportStar(require("./helpers"), exports);
19
18
  __exportStar(require("./interfaces"), exports);
20
19
  __exportStar(require("./enums"), exports);
@@ -8,6 +8,9 @@ export interface IProductCategoryResponse extends IResponse {
8
8
  export interface IProductCategoryAllResponse extends IResponse {
9
9
  categories: ICategory[];
10
10
  }
11
+ export interface IProductCategoryHierarchyResponse extends IResponse {
12
+ categories: ICategory[];
13
+ }
11
14
  export interface ICategoryTreeResponse extends IResponse {
12
15
  category: ICategoryWithChilds;
13
16
  }
@@ -95,6 +95,17 @@ exports.ProductService = {
95
95
  }), Object.assign(Object.assign({}, options), { params: data }));
96
96
  });
97
97
  },
98
+ Hierarchy: function (data, options) {
99
+ return __awaiter(this, void 0, void 0, function* () {
100
+ return yield (0, __1.fetchRequest)().get((0, urls_1.getUrl)({
101
+ serviceUrl: this.ServiceUrl,
102
+ prefix: this.Prefix,
103
+ isClient: options === null || options === void 0 ? void 0 : options.useClient,
104
+ language: data === null || data === void 0 ? void 0 : data.language,
105
+ methodName: urls_1.default.ProductCategory.Hierarchy
106
+ }), Object.assign(Object.assign({}, options), { params: data }));
107
+ });
108
+ },
98
109
  ProductCategory: function (data, options) {
99
110
  return __awaiter(this, void 0, void 0, function* () {
100
111
  return yield (0, __1.fetchRequest)().get((0, urls_1.getUrl)({
@@ -1,4 +1,4 @@
1
- import { IApiResponse, IRequestInit, ICategoryTreeResponse, IGetAllProductsResponse, IProductCategoryResponse, IProductResponse, ISearchProductsResponse, IProductCategoryAllResponse } from '../..';
1
+ import { IApiResponse, IRequestInit, ICategoryTreeResponse, IGetAllProductsResponse, IProductCategoryResponse, IProductResponse, ISearchProductsResponse, IProductCategoryAllResponse, IProductCategoryHierarchyResponse } from '../..';
2
2
  export interface IProductRequest {
3
3
  id: number;
4
4
  flags?: number;
@@ -86,6 +86,13 @@ export interface IAllCategoriesRequest {
86
86
  tags?: string[];
87
87
  language?: string;
88
88
  }
89
+ export interface IHierarchyCategoriesRequest {
90
+ id?: number;
91
+ isPreview?: boolean;
92
+ includes?: string[];
93
+ tags?: string[];
94
+ language?: string;
95
+ }
89
96
  export interface IProductService {
90
97
  ServiceUrl: string;
91
98
  Prefix: string;
@@ -95,5 +102,6 @@ export interface IProductService {
95
102
  ProductCategory: (data: IProductCategoryRequest, options?: IRequestInit) => Promise<IApiResponse<IProductCategoryResponse>>;
96
103
  CategoryTree: (data: ICategoryTreeRequest, options?: IRequestInit) => Promise<IApiResponse<ICategoryTreeResponse>>;
97
104
  AllCategories: (data: IAllCategoriesRequest, options?: IRequestInit) => Promise<IApiResponse<IProductCategoryAllResponse>>;
105
+ Hierarchy: (data: IHierarchyCategoriesRequest, options?: IRequestInit) => Promise<IApiResponse<IProductCategoryHierarchyResponse>>;
98
106
  }
99
107
  export {};
@@ -32,6 +32,7 @@ declare const _default: {
32
32
  };
33
33
  ProductCategory: {
34
34
  All: string;
35
+ Hierarchy: string;
35
36
  ProductCategory: string;
36
37
  CategoryTree: string;
37
38
  };
@@ -38,6 +38,7 @@ exports.default = {
38
38
  },
39
39
  ProductCategory: {
40
40
  All: '/live/{language}/ProductCategory/v1/All',
41
+ Hierarchy: '/live/{language}/ProductCategory/v1/Hierarchy',
41
42
  ProductCategory: '/live/{language}/ProductCategory/v1/{id}',
42
43
  CategoryTree: '/live/{language}/ProductCategory/v1/CategoryTree',
43
44
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextemos",
3
- "version": "4.2.4",
3
+ "version": "4.2.6",
4
4
  "description": "For helpers and hooks used in NextJS projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,9 +0,0 @@
1
- export interface IConfigs {
2
- ApiUrl?: string;
3
- CdnUrl?: string;
4
- CdnProvider?: string | null | undefined;
5
- VideoCdnUrl?: string | null | undefined;
6
- ThumborSource?: string | null | undefined;
7
- }
8
- export declare const setConfigs: (configs: IConfigs) => void;
9
- export declare const getConfigs: () => IConfigs;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getConfigs = exports.setConfigs = void 0;
4
- ;
5
- let defaultConfigs = {
6
- ApiUrl: process.env.API_URL || '',
7
- CdnUrl: process.env.CDN_URL || 'https://images.proj-e.com',
8
- CdnProvider: process.env.CDN_PROVIDER || 'thumbor',
9
- VideoCdnUrl: process.env.VIDEO_CDN_URL,
10
- ThumborSource: process.env.THUMBOR_SOURCE
11
- };
12
- const setConfigs = (configs) => {
13
- defaultConfigs = Object.assign(Object.assign({}, defaultConfigs), configs);
14
- };
15
- exports.setConfigs = setConfigs;
16
- const getConfigs = () => defaultConfigs;
17
- exports.getConfigs = getConfigs;