Skip to content

Commit

Permalink
Merge pull request #145 from poap-xyz/fix-drop-image-without-gateways
Browse files Browse the repository at this point in the history
Fix Drop from Compass without Image
  • Loading branch information
jm42 authored Nov 19, 2024
2 parents 2df3ee9 + 3673fba commit fc6bc58
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 34 deletions.
6 changes: 3 additions & 3 deletions packages/drops/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/drops",
"version": "0.7.2",
"version": "0.7.3",
"description": "Drops module for the poap.js library",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
Expand Down Expand Up @@ -29,7 +29,7 @@
"node": ">=18"
},
"dependencies": {
"@poap-xyz/providers": "0.7.2",
"@poap-xyz/utils": "0.7.2"
"@poap-xyz/providers": "0.7.3",
"@poap-xyz/utils": "0.7.3"
}
}
26 changes: 13 additions & 13 deletions packages/drops/src/domain/Drop.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { DropResponse as ProviderDropResponse } from '@poap-xyz/providers';
import { DropResponse } from '../types/DropResponse';
import { DropImage } from './DropImage';

export class Drop {
id: number;
Expand Down Expand Up @@ -60,23 +61,22 @@ export class Drop {
});
}

private static getDropImageFromCompass(response: DropResponse): {
crop: string;
original: string;
} {
const defaultImage = {
private static getDropImageFromCompass(response: DropResponse): DropImage {
const defaultImage: DropImage = {
crop: response.image_url,
original: response.image_url,
};

return (
response.drop_image?.gateways.reduce(
(images, gateway) => ({
...images,
[gateway.type.toLowerCase()]: gateway.url,
}),
defaultImage,
) || defaultImage
if (!response.drop_image) {
return defaultImage;
}

return response.drop_image.gateways.reduce(
(images, gateway) => ({
...images,
[gateway.type.toLowerCase()]: gateway.url,
}),
defaultImage,
);
}

Expand Down
4 changes: 4 additions & 0 deletions packages/drops/src/domain/DropImage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface DropImage {
crop: string;
original: string;
}
6 changes: 3 additions & 3 deletions packages/moments/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/moments",
"version": "0.7.2",
"version": "0.7.3",
"description": "Moments module for the poap.js library",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
Expand All @@ -26,8 +26,8 @@
"build": "rollup -c --bundleConfigAsCjs"
},
"dependencies": {
"@poap-xyz/providers": "0.7.2",
"@poap-xyz/utils": "0.7.2",
"@poap-xyz/providers": "0.7.3",
"@poap-xyz/utils": "0.7.3",
"uuid": "^9.0.0"
},
"engines": {
Expand Down
6 changes: 3 additions & 3 deletions packages/poaps/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/poaps",
"version": "0.7.2",
"version": "0.7.3",
"description": "Poaps module for the poap.js library",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
Expand All @@ -26,8 +26,8 @@
"build": "rollup -c --bundleConfigAsCjs"
},
"dependencies": {
"@poap-xyz/providers": "0.7.2",
"@poap-xyz/utils": "0.7.2"
"@poap-xyz/providers": "0.7.3",
"@poap-xyz/utils": "0.7.3"
},
"engines": {
"node": ">=18"
Expand Down
4 changes: 2 additions & 2 deletions packages/providers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/providers",
"version": "0.7.2",
"version": "0.7.3",
"description": "Providers module for the poap.js library",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
Expand All @@ -26,7 +26,7 @@
"build": "rollup -c --bundleConfigAsCjs"
},
"dependencies": {
"@poap-xyz/utils": "0.7.2",
"@poap-xyz/utils": "0.7.3",
"axios": "^1.6.8",
"lodash.chunk": "^4.2.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/utils",
"version": "0.7.2",
"version": "0.7.3",
"description": "Utils module for the poap.js library",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -884,8 +884,8 @@ __metadata:
version: 0.0.0-use.local
resolution: "@poap-xyz/drops@workspace:packages/drops"
dependencies:
"@poap-xyz/providers": 0.7.2
"@poap-xyz/utils": 0.7.2
"@poap-xyz/providers": 0.7.3
"@poap-xyz/utils": 0.7.3
languageName: unknown
linkType: soft

Expand All @@ -901,8 +901,8 @@ __metadata:
version: 0.0.0-use.local
resolution: "@poap-xyz/moments@workspace:packages/moments"
dependencies:
"@poap-xyz/providers": 0.7.2
"@poap-xyz/utils": 0.7.2
"@poap-xyz/providers": 0.7.3
"@poap-xyz/utils": 0.7.3
"@types/uuid": ^9.0.2
uuid: ^9.0.0
languageName: unknown
Expand All @@ -912,24 +912,24 @@ __metadata:
version: 0.0.0-use.local
resolution: "@poap-xyz/poaps@workspace:packages/poaps"
dependencies:
"@poap-xyz/providers": 0.7.2
"@poap-xyz/utils": 0.7.2
"@poap-xyz/providers": 0.7.3
"@poap-xyz/utils": 0.7.3
languageName: unknown
linkType: soft

"@poap-xyz/providers@0.7.2, @poap-xyz/providers@workspace:packages/providers":
"@poap-xyz/providers@0.7.3, @poap-xyz/providers@workspace:packages/providers":
version: 0.0.0-use.local
resolution: "@poap-xyz/providers@workspace:packages/providers"
dependencies:
"@poap-xyz/utils": 0.7.2
"@poap-xyz/utils": 0.7.3
axios: ^1.6.8
axios-mock-adapter: ^1.21.4
jest-fetch-mock: ^3.0.3
lodash.chunk: ^4.2.0
languageName: unknown
linkType: soft

"@poap-xyz/utils@0.7.2, @poap-xyz/utils@workspace:packages/utils":
"@poap-xyz/utils@0.7.3, @poap-xyz/utils@workspace:packages/utils":
version: 0.0.0-use.local
resolution: "@poap-xyz/utils@workspace:packages/utils"
languageName: unknown
Expand Down

0 comments on commit fc6bc58

Please sign in to comment.