@branta-ops/branta 1.0.1 → 1.0.2

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.
@@ -12,6 +12,7 @@ export interface Payment {
12
12
  metadata?: Record<string, string>;
13
13
  verifyUrl?: string;
14
14
  platformLogoUrl?: string;
15
+ platformLogoLightUrl?: string;
15
16
  }
16
17
  interface PaymentResponse extends Payment {
17
18
  createdAt: Date;
package/dist/v2/client.js CHANGED
@@ -11,9 +11,10 @@ export class V2BrantaClient {
11
11
  return [];
12
12
  }
13
13
  const raw = await response.json();
14
- const data = raw.map(({ platform_logo_url: platformLogoUrl, verify_url: verifyUrl, ...rest }) => ({
14
+ const data = raw.map(({ platform_logo_url: platformLogoUrl, platform_logo_light_url: platformLogoLightUrl, verify_url: verifyUrl, ...rest }) => ({
15
15
  ...rest,
16
16
  platformLogoUrl,
17
+ platformLogoLightUrl,
17
18
  verifyUrl,
18
19
  }));
19
20
  const baseUrl = this._resolveBaseUrl(options);
@@ -29,6 +30,15 @@ export class V2BrantaClient {
29
30
  if (!valid)
30
31
  throw new BrantaPaymentException("platformLogoUrl domain does not match the configured baseUrl domain");
31
32
  }
33
+ if (payment.platformLogoLightUrl) {
34
+ let valid = false;
35
+ try {
36
+ valid = new URL(payment.platformLogoLightUrl).origin === baseOrigin;
37
+ }
38
+ catch { /* invalid URL */ }
39
+ if (!valid)
40
+ throw new BrantaPaymentException("platformLogoLightUrl domain does not match the configured baseUrl domain");
41
+ }
32
42
  }
33
43
  return data;
34
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@branta-ops/branta",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "A JavaScript SDK for the Branta API",
5
5
  "homepage": "https://github.com/BrantaOps/branta-js#readme",
6
6
  "bugs": {
@@ -1,11 +0,0 @@
1
- export interface ServerEnvironment {
2
- value: number;
3
- url: string;
4
- }
5
- export interface BrantaServerBaseUrlType {
6
- Staging: ServerEnvironment;
7
- Production: ServerEnvironment;
8
- Localhost: ServerEnvironment;
9
- }
10
- declare const BrantaServerBaseUrl: BrantaServerBaseUrlType;
11
- export default BrantaServerBaseUrl;
@@ -1,6 +0,0 @@
1
- const BrantaServerBaseUrl = {
2
- Staging: { value: 0, url: "https://staging.guardrail.branta.pro" },
3
- Production: { value: 1, url: "https://guardrail.branta.pro" },
4
- Localhost: { value: 2, url: "http://localhost:3000" },
5
- };
6
- export default BrantaServerBaseUrl;