@poap-xyz/drops
Advanced tools
Comparing version 0.5.4 to 0.5.5-beta-v0
@@ -28,2 +28,3 @@ import { DropResponse as ProviderDropResponse } from '@poap-xyz/providers'; | ||
static fromCompass(response: DropResponse): Drop; | ||
private static getDropImageFromCompass; | ||
static fromProvider(response: ProviderDropResponse): Drop; | ||
@@ -30,0 +31,0 @@ constructor(properties: DropProperties); |
@@ -37,3 +37,3 @@ export interface DropResponse { | ||
}>; | ||
}; | ||
} | null; | ||
} |
@@ -28,2 +28,3 @@ import { DropResponse as ProviderDropResponse } from '@poap-xyz/providers'; | ||
static fromCompass(response: DropResponse): Drop; | ||
private static getDropImageFromCompass; | ||
static fromProvider(response: ProviderDropResponse): Drop; | ||
@@ -30,0 +31,0 @@ constructor(properties: DropProperties); |
@@ -37,3 +37,3 @@ export interface DropResponse { | ||
}>; | ||
}; | ||
} | null; | ||
} |
@@ -28,2 +28,3 @@ import { DropResponse as ProviderDropResponse } from '@poap-xyz/providers'; | ||
static fromCompass(response: DropResponse): Drop; | ||
private static getDropImageFromCompass; | ||
static fromProvider(response: ProviderDropResponse): Drop; | ||
@@ -30,0 +31,0 @@ constructor(properties: DropProperties); |
@@ -79,6 +79,2 @@ (function (global, factory) { | ||
function removeSpecialCharacters(str) { | ||
return str.replace(/[^a-zA-Z0-9 ]/g, ''); | ||
} | ||
function toPOAPDate(date) { | ||
@@ -107,9 +103,3 @@ return date | ||
var _a; | ||
const images = response.drop_image.gateways.reduce((images, gateway) => ({ | ||
...images, | ||
[gateway.type.toLowerCase()]: gateway.url, | ||
}), { | ||
crop: response.image_url, | ||
original: response.image_url, | ||
}); | ||
const images = Drop.getDropImageFromCompass(response); | ||
return new Drop({ | ||
@@ -141,2 +131,13 @@ id: Number(response.id), | ||
} | ||
static getDropImageFromCompass(response) { | ||
var _a; | ||
const defaultImage = { | ||
crop: response.image_url, | ||
original: response.image_url, | ||
}; | ||
return (((_a = response.drop_image) === null || _a === void 0 ? void 0 : _a.gateways.reduce((images, gateway) => ({ | ||
...images, | ||
[gateway.type.toLowerCase()]: gateway.url, | ||
}), defaultImage)) || defaultImage); | ||
} | ||
static fromProvider(response) { | ||
@@ -359,3 +360,3 @@ return new Drop({ | ||
args: { | ||
search: removeSpecialCharacters(search), | ||
search, | ||
}, | ||
@@ -362,0 +363,0 @@ }; |
@@ -37,3 +37,3 @@ export interface DropResponse { | ||
}>; | ||
}; | ||
} | null; | ||
} |
{ | ||
"name": "@poap-xyz/drops", | ||
"version": "0.5.4", | ||
"version": "0.5.5-beta-v0", | ||
"description": "Drops module for the poap.js library", | ||
@@ -32,5 +32,6 @@ "main": "dist/cjs/index.cjs", | ||
"dependencies": { | ||
"@poap-xyz/providers": "0.5.4", | ||
"@poap-xyz/utils": "0.5.4" | ||
} | ||
"@poap-xyz/providers": "0.5.5-beta-v0", | ||
"@poap-xyz/utils": "0.5.5-beta-v0" | ||
}, | ||
"stableVersion": "0.5.5" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
182297
1875
+ Added@poap-xyz/providers@0.5.5-beta-v0(transitive)
+ Added@poap-xyz/utils@0.5.5-beta-v0(transitive)
- Removed@poap-xyz/providers@0.5.4(transitive)
- Removed@poap-xyz/utils@0.5.4(transitive)