@djust-b2b/djust-front-sdk 2.1.1 → 2.3.0
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/lib/index.d.ts +4 -8
- package/lib/index.js +2 -2
- package/lib/interfaces/index.d.ts +0 -1
- package/lib/interfaces/index.js +0 -1
- package/lib/services/auth/__mocks__/auth.mocks.d.ts +248 -0
- package/lib/services/auth/__mocks__/auth.mocks.js +220 -0
- package/lib/services/auth/index.d.ts +2 -2
- package/lib/services/auth/index.js +2 -2
- package/lib/services/custom-field/index.d.ts +2 -1
- package/lib/services/custom-field/index.js +2 -1
- package/lib/services/customer-account/index.d.ts +47 -70
- package/lib/services/customer-account/index.js +47 -70
- package/lib/services/incident/definitions.d.ts +1 -0
- package/lib/services/incident/index.d.ts +41 -1
- package/lib/services/incident/index.js +60 -1
- package/lib/services/offer-prices/__mocks__/offer-prices.mocks.d.ts +108 -0
- package/lib/services/offer-prices/__mocks__/offer-prices.mocks.js +200 -0
- package/lib/services/payment/index.js +1 -1
- package/lib/services/supplier/__mocks__/supplier-mocks.d.ts +48 -0
- package/lib/services/supplier/__mocks__/supplier-mocks.js +167 -0
- package/lib/services/supplier/definitions.d.ts +3 -3
- package/lib/services/supplier/index.js +0 -2
- package/package.json +4 -3
- package/lib/interfaces/models/buying-list.d.ts +0 -16
- package/lib/interfaces/models/buying-list.js +0 -2
- package/lib/services/buying-list/definitions.d.ts +0 -43
- package/lib/services/buying-list/definitions.js +0 -2
- package/lib/services/buying-list/index.d.ts +0 -33
- package/lib/services/buying-list/index.js +0 -104
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export declare const DjustSDK: {
|
|
2
2
|
initialize: (initConfig: import("./settings/fetch-instance").ClientConfig) => void;
|
|
3
3
|
updateConfiguration: (newConfig: Partial<import("./settings/fetch-instance").ClientConfig>) => void;
|
|
4
|
+
getCustomFields(params: import("./services/custom-field/definitions").GetCustomFieldParameters): Promise<import("./services/custom-field/definitions").GetCustomFieldResponse>;
|
|
5
|
+
postMediaCustomField(params: import("./services/custom-field/definitions").PostMediaCustomFieldParameters): Promise<string>;
|
|
6
|
+
getMediaUrl(params: import("./services/custom-field/definitions").GetMediaUrlParameters): Promise<string>;
|
|
4
7
|
getPaginatedOfferInventories({ page, size, sort, productStatus, offerInventoryStatus, variantStatus, offerPriceStatus, supplierId, offersIds, offerPriceIds, currency, hasStock, idType, }: import("./services/offer-inventories/definitions").GetPaginatedOfferInventoriesParameters): Promise<import("./services/offer-inventories/definitions").GetOfferInventoriesResponse>;
|
|
5
8
|
getPaginatedOfferInventoriesV2({ page, size, sort, variantExternalId, }: import("./services/offer-inventories/definitions").GetPaginatedOfferInventoriesV2Parameters): Promise<import("./services/offer-inventories/definitions").GetOfferInventoriesV2Response>;
|
|
6
9
|
getOfferInventoryCustomFields({ externalId, page, size, sort, locale, }: import("./services/offer-inventories/definitions").GetOfferInventoryCustomFieldsParameters): Promise<import("./services/offer-inventories/definitions").GetOfferInventoryCustomFieldsResponse>;
|
|
@@ -10,6 +13,7 @@ export declare const DjustSDK: {
|
|
|
10
13
|
createOrderLogisticLineIncident({ logisticOrderId, idType, customFieldIdType, orderLines, reasonCode, }: import("./services/incident/definitions").createOrderLogisticLineIncidentParameters): Promise<import("./services/incident/definitions").createOrderLogisticLineIncidentResponse>;
|
|
11
14
|
createOrderLogisticIncidentThread({ logisticOrderId, incidentId, idType, customField, message, name, reasonCode, }: import("./services/incident/definitions").createOrderLogisticIncidentThreadParameters): Promise<import("./services/incident/definitions").createOrderLogisticIncidentThreadResponse>;
|
|
12
15
|
createIncident({ customField, externalId, logisticOrderId, reasonCodes, idType, }: import("./services/incident/definitions").createIncidentParameters): Promise<import("./services/incident/definitions").createIncidentResponse>;
|
|
16
|
+
getIncidentsV2({ customerAccountIds, linkedType, ids, status, idType, page, size, sort, supplierIds, }: import("./services/incident/definitions").getIncidentsParameters): Promise<import("./services/incident/definitions").getIncidentsResponse>;
|
|
13
17
|
getCommercialOrders({ locale, nbPreviewLines, page, size, sort, connectedUserOnly, customerAccountIds, isValidated, }: import("./interfaces").GetCommercialOrdersParameters): Promise<import("./interfaces").GetCommercialOrdersResponse>;
|
|
14
18
|
createCommercialOrder({ nbPreviewLines, channel, customFields, locale, origin, originId, paymentInfo, }: import("./interfaces").CreateCommercialOrderParameters): Promise<import("./interfaces").CreateCommercialOrderResponse>;
|
|
15
19
|
createCommercialOrderV2({ customFieldIdType, customFields, }: import("./interfaces").CreateCommercialOrderV2Parameters): Promise<import("./interfaces").CreateCommercialOrderV2Response>;
|
|
@@ -143,14 +147,6 @@ export declare const DjustSDK: {
|
|
|
143
147
|
getCartLines(params: import("./interfaces").GetCartLinesParameters): Promise<import("./interfaces").GetCartLinesResponse>;
|
|
144
148
|
updateCartLines(params: import("./interfaces").UpdateCartLinesParameters): Promise<import("./interfaces").UpdateCartLinesResponse>;
|
|
145
149
|
updateCartLinesByVariant(params: import("./interfaces").UpdateCartLinesByVariantParameters): Promise<import("./interfaces").UpdateCartLinesByVariantResponse>;
|
|
146
|
-
getBuyingList({ buyingListId, locale, }: import("./interfaces").GetBuyingListParameters): Promise<import("./interfaces").GetBuyingListResponse>;
|
|
147
|
-
getBuyingLists(): Promise<import("./interfaces").GetBuyingListsResponse>;
|
|
148
|
-
createBuyingList({ name, }: import("./interfaces").CreateBuyingListParameters): Promise<import("./interfaces").CreateBuyingListResponse>;
|
|
149
|
-
updateBuyingList({ buyingListId, name, }: import("./interfaces").UpdateBuyingListParameters): Promise<import("./interfaces").UpdateBuyingListResponse>;
|
|
150
|
-
updateBuyingListItems({ buyingListId, products, }: import("./interfaces").UpdateBuyingListItemsParameters): Promise<import("./interfaces").UpdateBuyingListItemsResponse>;
|
|
151
|
-
deleteBuyingList({ buyingListId, }: import("./interfaces").DeleteBuyingListParameters): Promise<void>;
|
|
152
|
-
deleteBuyingListItems({ buyingListId, itemIds, }: import("./interfaces").DeleteBuyingListItemsParameters): Promise<void>;
|
|
153
|
-
updateBuyingListOwner({ buyingListId, newOwnerEmail, }: import("./interfaces").UpdateBuyingListOwnerParameters): Promise<void>;
|
|
154
150
|
isTokenValid({ token, }: import("./services/auth/definitions.requests").IsTokenValidParameters): Promise<boolean>;
|
|
155
151
|
refreshToken({ refreshToken, }: import("./services/auth/definitions.requests").RefreshTokenParameters): Promise<import("./interfaces").RefreshTokenResponse>;
|
|
156
152
|
resetPassword({ newPassword, resetPasswordToken, }: import("./services/auth/definitions.requests").ResetPasswordParameters): Promise<void>;
|
package/lib/index.js
CHANGED
|
@@ -38,7 +38,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.DjustSDK = void 0;
|
|
40
40
|
const AuthServices = __importStar(require("./services/auth"));
|
|
41
|
-
const BuyingListServices = __importStar(require("./services/buying-list"));
|
|
42
41
|
const CartServices = __importStar(require("./services/cart"));
|
|
43
42
|
const CustomerAccountServices = __importStar(require("./services/customer-account"));
|
|
44
43
|
const CustomerUserServices = __importStar(require("./services/customer-user"));
|
|
@@ -50,10 +49,10 @@ const CommercialOrderServices = __importStar(require("./services/commercial-orde
|
|
|
50
49
|
const LogisticOrderServices = __importStar(require("./services/logistic-order"));
|
|
51
50
|
const IncidentServices = __importStar(require("./services/incident"));
|
|
52
51
|
const OfferServices = __importStar(require("./services/offer-inventories"));
|
|
52
|
+
const CustomFieldServices = __importStar(require("./services/custom-field"));
|
|
53
53
|
const fetch_instance_1 = require("./settings/fetch-instance");
|
|
54
54
|
exports.DjustSDK = {
|
|
55
55
|
...AuthServices,
|
|
56
|
-
...BuyingListServices,
|
|
57
56
|
...CartServices,
|
|
58
57
|
...CustomerAccountServices,
|
|
59
58
|
...CustomerUserServices,
|
|
@@ -65,6 +64,7 @@ exports.DjustSDK = {
|
|
|
65
64
|
...CommercialOrderServices,
|
|
66
65
|
...IncidentServices,
|
|
67
66
|
...OfferServices,
|
|
67
|
+
...CustomFieldServices,
|
|
68
68
|
initialize: fetch_instance_1.initialize,
|
|
69
69
|
updateConfiguration: fetch_instance_1.updateConfiguration,
|
|
70
70
|
};
|
package/lib/interfaces/index.js
CHANGED
|
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("../services/auth/definitions"), exports);
|
|
18
|
-
__exportStar(require("../services/buying-list/definitions"), exports);
|
|
19
18
|
__exportStar(require("../services/cart/definitions"), exports);
|
|
20
19
|
__exportStar(require("../services/customer-account/definitions"), exports);
|
|
21
20
|
__exportStar(require("../services/customer-user/definitions"), exports);
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mocks centralisés pour les tests du module auth
|
|
3
|
+
*/
|
|
4
|
+
export declare const mockTokens: {
|
|
5
|
+
validToken: string;
|
|
6
|
+
invalidToken: string;
|
|
7
|
+
refreshToken: string;
|
|
8
|
+
resetPasswordToken: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const mockUsers: {
|
|
11
|
+
validUser: {
|
|
12
|
+
username: string;
|
|
13
|
+
password: string;
|
|
14
|
+
};
|
|
15
|
+
invalidUser: {
|
|
16
|
+
username: string;
|
|
17
|
+
password: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare const mockAuthResponses: {
|
|
21
|
+
loginSuccess: {
|
|
22
|
+
token: {
|
|
23
|
+
accessToken: string;
|
|
24
|
+
expireAt: number;
|
|
25
|
+
refreshToken: string;
|
|
26
|
+
};
|
|
27
|
+
user: {
|
|
28
|
+
id: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
refreshTokenSuccess: {
|
|
32
|
+
token: {
|
|
33
|
+
accessToken: string;
|
|
34
|
+
expireAt: number;
|
|
35
|
+
refreshToken: string;
|
|
36
|
+
};
|
|
37
|
+
user: {
|
|
38
|
+
id: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export declare const mockParameters: {
|
|
43
|
+
isTokenValid: {
|
|
44
|
+
valid: {
|
|
45
|
+
token: string;
|
|
46
|
+
};
|
|
47
|
+
invalid: {
|
|
48
|
+
token: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
refreshToken: {
|
|
52
|
+
valid: {
|
|
53
|
+
refreshToken: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
resetPassword: {
|
|
57
|
+
valid: {
|
|
58
|
+
newPassword: string;
|
|
59
|
+
resetPasswordToken: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
sendResetPasswordEmail: {
|
|
63
|
+
valid: {
|
|
64
|
+
email: string;
|
|
65
|
+
};
|
|
66
|
+
invalid: {
|
|
67
|
+
email: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
login: {
|
|
71
|
+
valid: {
|
|
72
|
+
username: string;
|
|
73
|
+
password: string;
|
|
74
|
+
};
|
|
75
|
+
withUserFalse: {
|
|
76
|
+
username: string;
|
|
77
|
+
password: string;
|
|
78
|
+
withUser: boolean;
|
|
79
|
+
};
|
|
80
|
+
invalid: {
|
|
81
|
+
username: string;
|
|
82
|
+
password: string;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
getStore: {
|
|
86
|
+
valid: {
|
|
87
|
+
storeId: string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
export declare const mockResponses: {
|
|
92
|
+
isTokenValid: {
|
|
93
|
+
success: {
|
|
94
|
+
data: boolean;
|
|
95
|
+
headers: Headers;
|
|
96
|
+
status: number;
|
|
97
|
+
};
|
|
98
|
+
failure: {
|
|
99
|
+
data: boolean;
|
|
100
|
+
headers: Headers;
|
|
101
|
+
status: number;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
refreshToken: {
|
|
105
|
+
success: {
|
|
106
|
+
data: {
|
|
107
|
+
token: {
|
|
108
|
+
accessToken: string;
|
|
109
|
+
expireAt: number;
|
|
110
|
+
refreshToken: string;
|
|
111
|
+
};
|
|
112
|
+
user: {
|
|
113
|
+
id: string;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
headers: Headers;
|
|
117
|
+
status: number;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
resetPassword: {
|
|
121
|
+
success: {
|
|
122
|
+
data: undefined;
|
|
123
|
+
headers: Headers;
|
|
124
|
+
status: number;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
sendResetPasswordEmail: {
|
|
128
|
+
success: {
|
|
129
|
+
data: undefined;
|
|
130
|
+
headers: Headers;
|
|
131
|
+
status: number;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
login: {
|
|
135
|
+
success: {
|
|
136
|
+
data: {
|
|
137
|
+
token: {
|
|
138
|
+
accessToken: string;
|
|
139
|
+
expireAt: number;
|
|
140
|
+
refreshToken: string;
|
|
141
|
+
};
|
|
142
|
+
user: {
|
|
143
|
+
id: string;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
headers: Headers;
|
|
147
|
+
status: number;
|
|
148
|
+
};
|
|
149
|
+
withUserFalse: {
|
|
150
|
+
data: {
|
|
151
|
+
token: {
|
|
152
|
+
accessToken: string;
|
|
153
|
+
expireAt: number;
|
|
154
|
+
refreshToken: string;
|
|
155
|
+
};
|
|
156
|
+
user: {
|
|
157
|
+
id: string;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
headers: Headers;
|
|
161
|
+
status: number;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
logout: {
|
|
165
|
+
success: {
|
|
166
|
+
data: undefined;
|
|
167
|
+
headers: Headers;
|
|
168
|
+
status: number;
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
getSettings: {
|
|
172
|
+
success: {
|
|
173
|
+
data: {
|
|
174
|
+
manualAccountCheck: boolean;
|
|
175
|
+
};
|
|
176
|
+
headers: Headers;
|
|
177
|
+
status: number;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
getStore: {
|
|
181
|
+
success: {
|
|
182
|
+
data: {
|
|
183
|
+
active: boolean;
|
|
184
|
+
customFieldValues: {
|
|
185
|
+
customField: {
|
|
186
|
+
externalId: string;
|
|
187
|
+
externalSource: string;
|
|
188
|
+
faceted: boolean;
|
|
189
|
+
id: string;
|
|
190
|
+
indexable: boolean;
|
|
191
|
+
mandatory: boolean;
|
|
192
|
+
name: {
|
|
193
|
+
fr: string;
|
|
194
|
+
en: string;
|
|
195
|
+
};
|
|
196
|
+
role: string;
|
|
197
|
+
sealedTarget: string;
|
|
198
|
+
searchable: boolean;
|
|
199
|
+
sortable: boolean;
|
|
200
|
+
status: string;
|
|
201
|
+
};
|
|
202
|
+
value: {
|
|
203
|
+
fr: string;
|
|
204
|
+
en: string;
|
|
205
|
+
};
|
|
206
|
+
}[];
|
|
207
|
+
description: string;
|
|
208
|
+
externalId: string;
|
|
209
|
+
id: string;
|
|
210
|
+
name: string;
|
|
211
|
+
storeLocales: {
|
|
212
|
+
active: boolean;
|
|
213
|
+
code: string;
|
|
214
|
+
id: string;
|
|
215
|
+
label: string;
|
|
216
|
+
main: boolean;
|
|
217
|
+
}[];
|
|
218
|
+
};
|
|
219
|
+
headers: Headers;
|
|
220
|
+
status: number;
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
export declare const mockErrors: {
|
|
225
|
+
networkError: Error;
|
|
226
|
+
unauthorized: Error;
|
|
227
|
+
badRequest: Error;
|
|
228
|
+
notFound: Error;
|
|
229
|
+
serverError: Error;
|
|
230
|
+
};
|
|
231
|
+
export declare const mockHttpErrors: {
|
|
232
|
+
400: {
|
|
233
|
+
status: number;
|
|
234
|
+
message: string;
|
|
235
|
+
};
|
|
236
|
+
401: {
|
|
237
|
+
status: number;
|
|
238
|
+
message: string;
|
|
239
|
+
};
|
|
240
|
+
404: {
|
|
241
|
+
status: number;
|
|
242
|
+
message: string;
|
|
243
|
+
};
|
|
244
|
+
500: {
|
|
245
|
+
status: number;
|
|
246
|
+
message: string;
|
|
247
|
+
};
|
|
248
|
+
};
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Mocks centralisés pour les tests du module auth
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.mockHttpErrors = exports.mockErrors = exports.mockResponses = exports.mockParameters = exports.mockAuthResponses = exports.mockUsers = exports.mockTokens = void 0;
|
|
7
|
+
// Mock data pour les tokens
|
|
8
|
+
exports.mockTokens = {
|
|
9
|
+
validToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
|
|
10
|
+
invalidToken: "invalid_token_123",
|
|
11
|
+
refreshToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
|
|
12
|
+
resetPasswordToken: "reset_password_token_123",
|
|
13
|
+
};
|
|
14
|
+
// Mock data pour les utilisateurs
|
|
15
|
+
exports.mockUsers = {
|
|
16
|
+
validUser: {
|
|
17
|
+
username: "test@example.com",
|
|
18
|
+
password: "password123",
|
|
19
|
+
},
|
|
20
|
+
invalidUser: {
|
|
21
|
+
username: "invalid@example.com",
|
|
22
|
+
password: "wrongpassword",
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
// Mock data pour les réponses d'authentification
|
|
26
|
+
exports.mockAuthResponses = {
|
|
27
|
+
loginSuccess: {
|
|
28
|
+
token: {
|
|
29
|
+
accessToken: "new_access_token_123",
|
|
30
|
+
expireAt: 1735689600000, // 2025-01-01
|
|
31
|
+
refreshToken: "new_refresh_token_123",
|
|
32
|
+
},
|
|
33
|
+
user: {
|
|
34
|
+
id: "user_123",
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
refreshTokenSuccess: {
|
|
38
|
+
token: {
|
|
39
|
+
accessToken: "refreshed_access_token_456",
|
|
40
|
+
expireAt: 1735689600000, // 2025-01-01
|
|
41
|
+
refreshToken: "new_refresh_token_456",
|
|
42
|
+
},
|
|
43
|
+
user: {
|
|
44
|
+
id: "user_123",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
// Mock data pour les paramètres de test
|
|
49
|
+
exports.mockParameters = {
|
|
50
|
+
isTokenValid: {
|
|
51
|
+
valid: { token: exports.mockTokens.validToken },
|
|
52
|
+
invalid: { token: exports.mockTokens.invalidToken },
|
|
53
|
+
},
|
|
54
|
+
refreshToken: {
|
|
55
|
+
valid: { refreshToken: exports.mockTokens.refreshToken },
|
|
56
|
+
},
|
|
57
|
+
resetPassword: {
|
|
58
|
+
valid: {
|
|
59
|
+
newPassword: "newSecurePassword2025!",
|
|
60
|
+
resetPasswordToken: exports.mockTokens.resetPasswordToken,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
sendResetPasswordEmail: {
|
|
64
|
+
valid: { email: "user@example.com" },
|
|
65
|
+
invalid: { email: "invalid-email" },
|
|
66
|
+
},
|
|
67
|
+
login: {
|
|
68
|
+
valid: {
|
|
69
|
+
username: exports.mockUsers.validUser.username,
|
|
70
|
+
password: exports.mockUsers.validUser.password,
|
|
71
|
+
},
|
|
72
|
+
withUserFalse: {
|
|
73
|
+
username: exports.mockUsers.validUser.username,
|
|
74
|
+
password: exports.mockUsers.validUser.password,
|
|
75
|
+
withUser: false,
|
|
76
|
+
},
|
|
77
|
+
invalid: {
|
|
78
|
+
username: exports.mockUsers.invalidUser.username,
|
|
79
|
+
password: exports.mockUsers.invalidUser.password,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
getStore: {
|
|
83
|
+
valid: { storeId: "store_123" },
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
// Mock Headers pour les tests
|
|
87
|
+
const createMockHeaders = () => {
|
|
88
|
+
const headers = new Headers();
|
|
89
|
+
headers.append("Content-Type", "application/json");
|
|
90
|
+
headers.append("dj-client", "test-client");
|
|
91
|
+
headers.append("dj-api-key", "test-api-key");
|
|
92
|
+
return headers;
|
|
93
|
+
};
|
|
94
|
+
// Mock data pour les réponses des endpoints
|
|
95
|
+
exports.mockResponses = {
|
|
96
|
+
isTokenValid: {
|
|
97
|
+
success: {
|
|
98
|
+
data: true,
|
|
99
|
+
headers: createMockHeaders(),
|
|
100
|
+
status: 200,
|
|
101
|
+
},
|
|
102
|
+
failure: {
|
|
103
|
+
data: false,
|
|
104
|
+
headers: createMockHeaders(),
|
|
105
|
+
status: 200,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
refreshToken: {
|
|
109
|
+
success: {
|
|
110
|
+
data: exports.mockAuthResponses.refreshTokenSuccess,
|
|
111
|
+
headers: createMockHeaders(),
|
|
112
|
+
status: 200,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
resetPassword: {
|
|
116
|
+
success: {
|
|
117
|
+
data: undefined,
|
|
118
|
+
headers: createMockHeaders(),
|
|
119
|
+
status: 200,
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
sendResetPasswordEmail: {
|
|
123
|
+
success: {
|
|
124
|
+
data: undefined,
|
|
125
|
+
headers: createMockHeaders(),
|
|
126
|
+
status: 200,
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
login: {
|
|
130
|
+
success: {
|
|
131
|
+
data: exports.mockAuthResponses.loginSuccess,
|
|
132
|
+
headers: createMockHeaders(),
|
|
133
|
+
status: 200,
|
|
134
|
+
},
|
|
135
|
+
withUserFalse: {
|
|
136
|
+
data: exports.mockAuthResponses.loginSuccess,
|
|
137
|
+
headers: createMockHeaders(),
|
|
138
|
+
status: 200,
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
logout: {
|
|
142
|
+
success: {
|
|
143
|
+
data: undefined,
|
|
144
|
+
headers: createMockHeaders(),
|
|
145
|
+
status: 200,
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
getSettings: {
|
|
149
|
+
success: {
|
|
150
|
+
data: {
|
|
151
|
+
manualAccountCheck: true,
|
|
152
|
+
},
|
|
153
|
+
headers: createMockHeaders(),
|
|
154
|
+
status: 200,
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
getStore: {
|
|
158
|
+
success: {
|
|
159
|
+
data: {
|
|
160
|
+
active: true,
|
|
161
|
+
customFieldValues: [
|
|
162
|
+
{
|
|
163
|
+
customField: {
|
|
164
|
+
externalId: "field_1",
|
|
165
|
+
externalSource: "manual",
|
|
166
|
+
faceted: false,
|
|
167
|
+
id: "cf_1",
|
|
168
|
+
indexable: true,
|
|
169
|
+
mandatory: false,
|
|
170
|
+
name: { fr: "Champ personnalisé", en: "Custom field" },
|
|
171
|
+
role: "store",
|
|
172
|
+
sealedTarget: "store",
|
|
173
|
+
searchable: true,
|
|
174
|
+
sortable: true,
|
|
175
|
+
status: "active",
|
|
176
|
+
},
|
|
177
|
+
value: { fr: "Valeur test", en: "Test value" },
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
description: "Description du magasin",
|
|
181
|
+
externalId: "store_ext_123",
|
|
182
|
+
id: "store_123",
|
|
183
|
+
name: "Mon Magasin",
|
|
184
|
+
storeLocales: [
|
|
185
|
+
{
|
|
186
|
+
active: true,
|
|
187
|
+
code: "fr",
|
|
188
|
+
id: "locale_fr",
|
|
189
|
+
label: "Français",
|
|
190
|
+
main: true,
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
active: true,
|
|
194
|
+
code: "en",
|
|
195
|
+
id: "locale_en",
|
|
196
|
+
label: "English",
|
|
197
|
+
main: false,
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
},
|
|
201
|
+
headers: createMockHeaders(),
|
|
202
|
+
status: 200,
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
// Mock data pour les erreurs
|
|
207
|
+
exports.mockErrors = {
|
|
208
|
+
networkError: new Error("Network error"),
|
|
209
|
+
unauthorized: new Error("Unauthorized"),
|
|
210
|
+
badRequest: new Error("Bad request"),
|
|
211
|
+
notFound: new Error("Not found"),
|
|
212
|
+
serverError: new Error("Internal server error"),
|
|
213
|
+
};
|
|
214
|
+
// Mock data pour les cas d'erreur HTTP
|
|
215
|
+
exports.mockHttpErrors = {
|
|
216
|
+
400: { status: 400, message: "Bad Request" },
|
|
217
|
+
401: { status: 401, message: "Unauthorized" },
|
|
218
|
+
404: { status: 404, message: "Not Found" },
|
|
219
|
+
500: { status: 500, message: "Internal Server Error" },
|
|
220
|
+
};
|
|
@@ -180,7 +180,7 @@ export declare function logout(): Promise<void>;
|
|
|
180
180
|
*
|
|
181
181
|
* Cette fonction permet d'obtenir les paramètres de configuration du shop.
|
|
182
182
|
*
|
|
183
|
-
* 🛠 **Endpoint**: `GET /v1/shop/settings`
|
|
183
|
+
* 🛠 **Endpoint**: `GET /v1/shop/settings` [SETTINGS-500]
|
|
184
184
|
*
|
|
185
185
|
* 📤 **Returns**:
|
|
186
186
|
* A `Promise<SettingsResponse>` contenant les paramètres du shop, notamment:
|
|
@@ -200,7 +200,7 @@ export declare function getSettings(): Promise<SettingsResponse>;
|
|
|
200
200
|
*
|
|
201
201
|
* Cette fonction permet d'obtenir les détails d'un magasin à partir de son identifiant.
|
|
202
202
|
*
|
|
203
|
-
* 🛠 **Endpoint**: `GET /v1/shop/stores/{storeId}`
|
|
203
|
+
* 🛠 **Endpoint**: `GET /v1/shop/stores/{storeId}` [STORE-500]
|
|
204
204
|
*
|
|
205
205
|
* | Parameter | Type | Required | Description |
|
|
206
206
|
* |------------|----------|----------|--------------------------------------|
|
|
@@ -245,7 +245,7 @@ async function logout() {
|
|
|
245
245
|
*
|
|
246
246
|
* Cette fonction permet d'obtenir les paramètres de configuration du shop.
|
|
247
247
|
*
|
|
248
|
-
* 🛠 **Endpoint**: `GET /v1/shop/settings`
|
|
248
|
+
* 🛠 **Endpoint**: `GET /v1/shop/settings` [SETTINGS-500]
|
|
249
249
|
*
|
|
250
250
|
* 📤 **Returns**:
|
|
251
251
|
* A `Promise<SettingsResponse>` contenant les paramètres du shop, notamment:
|
|
@@ -271,7 +271,7 @@ async function getSettings() {
|
|
|
271
271
|
*
|
|
272
272
|
* Cette fonction permet d'obtenir les détails d'un magasin à partir de son identifiant.
|
|
273
273
|
*
|
|
274
|
-
* 🛠 **Endpoint**: `GET /v1/shop/stores/{storeId}`
|
|
274
|
+
* 🛠 **Endpoint**: `GET /v1/shop/stores/{storeId}` [STORE-500]
|
|
275
275
|
*
|
|
276
276
|
* | Parameter | Type | Required | Description |
|
|
277
277
|
* |------------|----------|----------|--------------------------------------|
|
|
@@ -4,7 +4,7 @@ import type { GetCustomFieldParameters, GetCustomFieldResponse, PostMediaCustomF
|
|
|
4
4
|
*
|
|
5
5
|
* This function fetches custom fields based on the provided parameters.
|
|
6
6
|
*
|
|
7
|
-
* 🛠 **Endpoint**: `GET /
|
|
7
|
+
* 🛠 **Endpoint**: `GET /v1/shop/custom-fields`
|
|
8
8
|
*
|
|
9
9
|
* | **Parameter** | **Type** | **Required** | **Description** |
|
|
10
10
|
* |----------------------|------------|--------------|---------------------------------------------------------------------------|
|
|
@@ -12,6 +12,7 @@ import type { GetCustomFieldParameters, GetCustomFieldResponse, PostMediaCustomF
|
|
|
12
12
|
* | `includeInactive` | `boolean` | | Whether to include inactive custom fields in the response. |
|
|
13
13
|
* | `limit` | `number` | | The maximum number of custom fields to return. |
|
|
14
14
|
* | `offset` | `number` | | The number of custom fields to skip before starting to collect results. |
|
|
15
|
+
* | `sealedTarget` | `string` | | Indicates whether the media should be sealed. |
|
|
15
16
|
*
|
|
16
17
|
* 📤 **Returns**:
|
|
17
18
|
* A `Promise<GetCustomFieldResponse>` containing the retrieved custom fields.
|
|
@@ -9,7 +9,7 @@ const fetch_instance_1 = require("../../settings/fetch-instance");
|
|
|
9
9
|
*
|
|
10
10
|
* This function fetches custom fields based on the provided parameters.
|
|
11
11
|
*
|
|
12
|
-
* 🛠 **Endpoint**: `GET /
|
|
12
|
+
* 🛠 **Endpoint**: `GET /v1/shop/custom-fields`
|
|
13
13
|
*
|
|
14
14
|
* | **Parameter** | **Type** | **Required** | **Description** |
|
|
15
15
|
* |----------------------|------------|--------------|---------------------------------------------------------------------------|
|
|
@@ -17,6 +17,7 @@ const fetch_instance_1 = require("../../settings/fetch-instance");
|
|
|
17
17
|
* | `includeInactive` | `boolean` | | Whether to include inactive custom fields in the response. |
|
|
18
18
|
* | `limit` | `number` | | The maximum number of custom fields to return. |
|
|
19
19
|
* | `offset` | `number` | | The number of custom fields to skip before starting to collect results. |
|
|
20
|
+
* | `sealedTarget` | `string` | | Indicates whether the media should be sealed. |
|
|
20
21
|
*
|
|
21
22
|
* 📤 **Returns**:
|
|
22
23
|
* A `Promise<GetCustomFieldResponse>` containing the retrieved custom fields.
|