nextemos 5.2.13 → 5.2.15

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.
@@ -38,6 +38,7 @@ const fetchRequest = () => {
38
38
  * @returns {Promise<IApiResponse<T>>} API'den gelen yanıt.
39
39
  */
40
40
  const request = (_a) => __awaiter(void 0, void 0, void 0, function* () {
41
+ var _b;
41
42
  var { url, method, params } = _a, options = __rest(_a, ["url", "method", "params"]);
42
43
  const apiURL = new URL(url);
43
44
  if (params) {
@@ -83,10 +84,9 @@ const fetchRequest = () => {
83
84
  const errorDetail = yield response.text();
84
85
  if (["debug", "info", "trace"].includes(FETCH_OPTIONS.LOG_LEVEL))
85
86
  console.log("Fetch Error: ", {
86
- api: apiURL,
87
87
  apiUrl: apiURL.toString(),
88
88
  status: response.status,
89
- errorMessage: errorDetail,
89
+ errorMessage: ((_b = JSON.parse(errorDetail || "{}")) === null || _b === void 0 ? void 0 : _b.message) || errorDetail,
90
90
  });
91
91
  return {
92
92
  status: response.status,
@@ -115,7 +115,10 @@ const fetchRequest = () => {
115
115
  }
116
116
  catch (error) {
117
117
  if (error instanceof Error) {
118
- console.log(`Fetch Request Exception Error! -> ${apiURL.toString()} -> ${apiURL} -> ${error.name} : ${error.message}`);
118
+ console.log("Fetch Request Exception Error!", {
119
+ apiURL: apiURL.toString(),
120
+ error,
121
+ });
119
122
  return {
120
123
  status: 500,
121
124
  error: error.name,
@@ -93,4 +93,7 @@ exports.ShoppingCartService = {
93
93
  GetSalesAggreementForm: (data, options) => __awaiter(void 0, void 0, void 0, function* () {
94
94
  return (0, __1.fetchRequest)().post(exports.ShoppingCartService.Url(urls_1.default.ShoppingCart.GetSalesAggreementForm, options, data === null || data === void 0 ? void 0 : data.language), Object.assign(Object.assign({}, options), { body: JSON.stringify(data) }));
95
95
  }),
96
+ AddGiftBoxNote: (data, options) => __awaiter(void 0, void 0, void 0, function* () {
97
+ return (0, __1.fetchRequest)().post(exports.ShoppingCartService.Url(urls_1.default.ShoppingCart.AddGiftBoxNote, options, data === null || data === void 0 ? void 0 : data.language), Object.assign(Object.assign({}, options), { body: JSON.stringify(data) }));
98
+ }),
96
99
  };
@@ -102,6 +102,13 @@ export interface IGetPreInfoFormRequest extends Omit<IGetCartRequest, "flags"> {
102
102
  }
103
103
  export interface IGetSalesAggreementFormRequest extends Omit<IGetCartRequest, "flags"> {
104
104
  }
105
+ export interface IAddGiftBoxNoteRequest extends IGetCartRequest {
106
+ giftBoxNotes: {
107
+ documentId: string;
108
+ giftBoxNote: string;
109
+ isGiftBoxRequested: boolean;
110
+ }[];
111
+ }
105
112
  export interface IShoppingCartService extends IService {
106
113
  AddToCart: (data: IAddToCartRequest, options?: IRequestInit) => Promise<IApiResponse<IGetCartResponse>>;
107
114
  GetCartItemCount: (data: IGetCartItemCountRequest, options?: IRequestInit) => Promise<IApiResponse<IGetCartItemCountResponse>>;
@@ -117,4 +124,5 @@ export interface IShoppingCartService extends IService {
117
124
  DoFreeOfChargeTransaction: (data: IDoFreeOfChargeTransactionRequest, options?: IRequestInit) => Promise<IApiResponse<IDoFreeOfChargeTransactionResponse>>;
118
125
  GetPreInfoForm: (data: IGetPreInfoFormRequest, options?: IRequestInit) => Promise<IApiResponse<IGetPreInfoFormResponse>>;
119
126
  GetSalesAggreementForm: (data: IGetSalesAggreementFormRequest, options?: IRequestInit) => Promise<IApiResponse<IGetSalesAggreementFormResponse>>;
127
+ AddGiftBoxNote: (data: IAddGiftBoxNoteRequest, options?: IRequestInit) => Promise<IApiResponse<IGetCartResponse>>;
120
128
  }
@@ -124,6 +124,7 @@ declare const _default: {
124
124
  DoFreeOfChargeTransaction: string;
125
125
  GetPreInfoForm: string;
126
126
  GetSalesAggreementForm: string;
127
+ AddGiftBoxNote: string;
127
128
  };
128
129
  OrderManagement: {
129
130
  GetMemberOrderDetails: string;
@@ -135,6 +135,7 @@ exports.default = {
135
135
  DoFreeOfChargeTransaction: "/{language}/ShoppingCartGateway/v1/DoFreeOfChargeTransaction",
136
136
  GetPreInfoForm: "/{language}/ShoppingCartGateway/v1/GetPreInfoForm",
137
137
  GetSalesAggreementForm: "/{language}/ShoppingCartGateway/v1/GetSalesAggreementForm",
138
+ AddGiftBoxNote: "/{language}/ShoppingCartGateway/v1/AddGiftBoxNote",
138
139
  },
139
140
  OrderManagement: {
140
141
  GetMemberOrderDetails: "/{language}/OrderManagement/v1/GetMemberOrderDetails",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextemos",
3
- "version": "5.2.13",
3
+ "version": "5.2.15",
4
4
  "description": "For helpers and hooks used in NextJS projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",