nextemos 5.0.33 → 5.0.35

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.
@@ -36,42 +36,5 @@ export declare const defaultConfig: {
36
36
  STOCK: string;
37
37
  };
38
38
  };
39
- declare const NEXTEMOS_CONFIG: {
40
- API_URL: string;
41
- USE_API_URL: boolean;
42
- CDN_URL: string;
43
- CDN_PROVIDER: string;
44
- VIDEO_CDN_URL: string;
45
- THUMBOR_SOURCE: string;
46
- DEFAULT_LANGUAGE: string;
47
- FETCH_OPTIONS: {
48
- LOG_LEVEL: string;
49
- CACHE: string;
50
- };
51
- KEYCLOAK: {
52
- URL: string;
53
- REALM: string;
54
- CLIENT_ID: string;
55
- CLIENT_SECRET: string;
56
- GRANT_TYPE: string;
57
- };
58
- K8S_NAMESPACE: string;
59
- K8S_SERVICE_NAMES: {
60
- ADDRESS: string;
61
- BANNER: string;
62
- BLOG: string;
63
- CAMPAIGN: string;
64
- ENVIRONMENT: string;
65
- LOCALIZATION: string;
66
- MEMBER: string;
67
- NOTIFICATION: string;
68
- ORDER_MANAGEMENT: string;
69
- PAYMENT: string;
70
- PREDICTION: string;
71
- PRODUCT: string;
72
- ROUTE: string;
73
- SHOPPING_CART: string;
74
- STOCK: string;
75
- };
76
- };
77
- export default NEXTEMOS_CONFIG;
39
+ declare const _default: typeof defaultConfig;
40
+ export default _default;
@@ -39,44 +39,16 @@ exports.defaultConfig = {
39
39
  STOCK: "stock",
40
40
  },
41
41
  };
42
- class ConfigStore {
43
- constructor() {
44
- // Constructor'ı private tutuyoruz ama boş bırakıyoruz
45
- }
46
- static initialize() {
47
- if (!this.config) {
48
- try {
49
- const loadedConfig = require("../../../../nextemos-config.json");
50
- console.log("nextemos-config.json Config initialized successfully");
51
- this.config = Object.assign(Object.assign({}, exports.defaultConfig), loadedConfig);
52
- }
53
- catch (error) {
54
- console.warn("nextemos-config.json Config could not be loaded, using defaults:", error);
55
- this.config = exports.defaultConfig;
56
- }
57
- }
58
- }
59
- static getInstance() {
60
- if (!ConfigStore.instance) {
61
- ConfigStore.instance = new ConfigStore();
62
- this.initialize();
63
- }
64
- return ConfigStore.instance;
65
- }
66
- getConfig() {
67
- return ConfigStore.config;
68
- }
69
- // Debug için config'i loglama metodu
70
- logConfig() {
71
- console.log("Current Config:", JSON.stringify(ConfigStore.config, null, 2));
72
- }
42
+ // Try to read the config file synchronously at build time
43
+ let loadedConfig;
44
+ try {
45
+ // Using require to load the config file at build time
46
+ // require will resolve the path relative to the current file
47
+ loadedConfig = require("../../../../nextemos-config.json");
73
48
  }
74
- // Singleton instance'ı oluştur
75
- const configStore = ConfigStore.getInstance();
76
- // Debug için config'i logla (development'ta)
77
- if (process.env.NODE_ENV === "development") {
78
- configStore.logConfig();
49
+ catch (error) {
50
+ loadedConfig = exports.defaultConfig;
79
51
  }
80
- // Final config'i export et
81
- const NEXTEMOS_CONFIG = configStore.getConfig();
52
+ // Merge with default config to ensure all required fields exist
53
+ const NEXTEMOS_CONFIG = Object.assign(Object.assign({}, exports.defaultConfig), loadedConfig);
82
54
  exports.default = NEXTEMOS_CONFIG;
@@ -10,3 +10,10 @@ export interface IGetCampaignBadgesResponse extends IResponse {
10
10
  badgeUrl: string;
11
11
  }[];
12
12
  }
13
+ export interface IGetCampaignsResponse extends IResponse {
14
+ campaigns: {
15
+ id: number;
16
+ name: string;
17
+ explanation: string;
18
+ }[];
19
+ }
@@ -1,7 +1,13 @@
1
- import { IApiResponse, IGetCampaignBadgesResponse, IRequestBase, IRequestInit, IService } from "../..";
1
+ import { IApiResponse, IGetCampaignBadgesResponse, IGetCampaignsResponse, IRequestBase, IRequestInit, IService } from "../..";
2
2
  export interface IGetCampaignBadgesRequest extends IRequestBase {
3
3
  productIds: number[];
4
4
  }
5
+ export interface IGetCampaignsRequest extends IRequestBase {
6
+ id: number;
7
+ culture: string;
8
+ environmentPredicates: number[];
9
+ }
5
10
  export interface ICampaignService extends IService {
6
11
  GetCampaignBadges: (data: IGetCampaignBadgesRequest, options?: IRequestInit) => Promise<IApiResponse<IGetCampaignBadgesResponse>>;
12
+ GetCampaigns: (data: IGetCampaignsRequest, options?: IRequestInit) => Promise<IApiResponse<IGetCampaignsResponse>>;
7
13
  }
@@ -54,4 +54,7 @@ exports.CampaignService = {
54
54
  GetCampaignBadges: (data, options) => __awaiter(void 0, void 0, void 0, function* () {
55
55
  return (0, __1.fetchRequest)().post(exports.CampaignService.Url(urls_1.default.Campaign.GetCampaignBadges, options, data === null || data === void 0 ? void 0 : data.language), Object.assign(Object.assign({}, options), { body: JSON.stringify(data) }));
56
56
  }),
57
+ GetCampaigns: (data, options) => __awaiter(void 0, void 0, void 0, function* () {
58
+ return (0, __1.fetchRequest)().post(exports.CampaignService.Url(urls_1.default.Campaign.GetCampaigns, options, data === null || data === void 0 ? void 0 : data.language), Object.assign(Object.assign({}, options), { body: JSON.stringify(data) }));
59
+ }),
57
60
  };
@@ -138,6 +138,7 @@ declare const _default: {
138
138
  };
139
139
  Campaign: {
140
140
  GetCampaignBadges: string;
141
+ GetCampaigns: string;
141
142
  };
142
143
  };
143
144
  export default _default;
@@ -149,6 +149,7 @@ exports.default = {
149
149
  },
150
150
  Campaign: {
151
151
  GetCampaignBadges: "/{language}/CampaignGateway/v1/GetCampaignBadges",
152
+ GetCampaigns: "/{language}/CampaignGateway/v1/GetCampaigns",
152
153
  },
153
154
  };
154
155
  const getUrl = ({ isClient = false, language = DEFAULT_LANGUAGE || "tr", methodName, serviceUrl, prefix, id = "", }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextemos",
3
- "version": "5.0.33",
3
+ "version": "5.0.35",
4
4
  "description": "For helpers and hooks used in NextJS projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",