b2b-platform-utils 1.1.59 → 1.1.61

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/errorsMap.js CHANGED
@@ -928,6 +928,13 @@ const STATIC_ERRORS = [
928
928
  httpCode: 422,
929
929
  description: "Promo code is not active.",
930
930
  },
931
+ {
932
+ errorCode: 1152,
933
+ errorKey: "withdrawalWagerNotCompleted",
934
+ httpCode: 422,
935
+ description:
936
+ "Withdrawal wager requirements are not completed for the requested amount.",
937
+ },
931
938
  ];
932
939
 
933
940
  const STATIC_BY_KEY = Object.fromEntries(
package/optimizeMedia.js CHANGED
@@ -190,8 +190,8 @@ async function optimizeImageBufferByFormat(fileDataBuffer, originalFileType, opt
190
190
  let normalizedType = normalizeImageFileType(originalFileType);
191
191
 
192
192
  try {
193
- if (normalizedType === 'gif') {
194
- return { buffer: fileDataBuffer, fileType: 'gif', optimized: false };
193
+ if (normalizedType === 'gif' || normalizedType === 'avif') {
194
+ return { buffer: fileDataBuffer, fileType: normalizedType, optimized: false };
195
195
  }
196
196
 
197
197
  if (!normalizedType || !isKnownFormat(normalizedType)) {
@@ -203,29 +203,8 @@ async function optimizeImageBufferByFormat(fileDataBuffer, originalFileType, opt
203
203
  }
204
204
  }
205
205
 
206
- if (normalizedType === 'gif') {
207
- return { buffer: fileDataBuffer, fileType: 'gif', optimized: false };
208
- }
209
-
210
- if (normalizedType === 'avif') {
211
- try {
212
- let pipeline = sharp(fileDataBuffer);
213
-
214
- if (hasResizeOptions(opts)) {
215
- pipeline = pipeline.resize(buildResizeOptions(opts));
216
- }
217
-
218
- const buffer = await pipeline
219
- .avif({
220
- quality: opts.quality,
221
- effort: opts.effort
222
- })
223
- .toBuffer();
224
-
225
- return { buffer, fileType: 'avif', optimized: true };
226
- } catch {
227
- return { buffer: fileDataBuffer, fileType: 'avif', optimized: false };
228
- }
206
+ if (normalizedType === 'gif' || normalizedType === 'avif') {
207
+ return { buffer: fileDataBuffer, fileType: normalizedType, optimized: false };
229
208
  }
230
209
 
231
210
  if (WEBP_CONVERSION_FORMATS.has(normalizedType)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "b2b-platform-utils",
3
- "version": "1.1.59",
3
+ "version": "1.1.61",
4
4
  "description": "Shared utilities for Node.js microservices: errors map, local cache, logger, numbers, dates, filesystem, media optimization, paginator, slugger, crypto wrapper, sanitize HTML, sorting.",
5
5
  "type": "commonjs",
6
6
  "license": "KingSizer",