@zennify/sdk-js 1.25.0 → 1.25.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.
package/dist/images.js CHANGED
@@ -12,5 +12,5 @@ function GetImageURL(fallback, hash) {
12
12
  if (!hash)
13
13
  return fallbacks[fallback];
14
14
  else
15
- return "https://cdn.zennify.app/media/" + hash;
15
+ return `https://cdn.${this.domain}/media/${hash}`;
16
16
  }
package/dist/main.js CHANGED
@@ -36,10 +36,6 @@ class ZennifySDK {
36
36
  // this.language = options?.language ?? "en_US";
37
37
  // this.token = options?.token ?? null;
38
38
  }
39
- media = {
40
- get_url: async (...options) => {
41
- return (0, images_1.GetImageURL)(...options)?.replace("zennify.app", this.domain);
42
- }
43
- };
39
+ media = { get_url: images_1.GetImageURL };
44
40
  }
45
41
  exports.ZennifySDK = ZennifySDK;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zennify/sdk-js",
3
- "version": "1.25.0",
3
+ "version": "1.25.2",
4
4
  "description": "A simple package to work with https://api.zennify.app",
5
5
  "main": "dist/main.js",
6
6
  "keywords": [],
package/src/images.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { ZennifySDK } from "./main";
2
+
1
3
  const fallbacks = {
2
4
  'product_icon': `https://zennify.app/assets/images/emojis/caixa.png`,
3
5
  'general': `https://zennify.app/assets/images/icon.png`,
@@ -9,9 +11,10 @@ const fallbacks = {
9
11
  type Fallbacks = typeof fallbacks;
10
12
 
11
13
  export function GetImageURL<Fallback extends keyof Fallbacks>(
14
+ this: ZennifySDK,
12
15
  fallback: Fallback,
13
16
  hash?: string | null
14
17
  ): Fallbacks[Fallback] | string {
15
18
  if (!hash) return fallbacks[fallback];
16
- else return "https://cdn.zennify.app/media/" + hash
19
+ else return `https://cdn.${this.domain}/media/${hash}`
17
20
  }
package/src/main.ts CHANGED
@@ -30,10 +30,7 @@ export class ZennifySDK {
30
30
  // this.language = options?.language ?? "en_US";
31
31
  // this.token = options?.token ?? null;
32
32
  }
33
- media = {
34
- get_url: async (...options: Parameters<typeof GetImageURL>) => {
35
- return GetImageURL(...options)?.replace("zennify.app", this.domain)
36
- }
37
- }
33
+
34
+ media = { get_url: GetImageURL }
38
35
 
39
36
  }
package/types/images.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { ZennifySDK } from "./main";
1
2
  declare const fallbacks: {
2
3
  readonly product_icon: "https://zennify.app/assets/images/emojis/caixa.png";
3
4
  readonly general: "https://zennify.app/assets/images/icon.png";
@@ -6,5 +7,5 @@ declare const fallbacks: {
6
7
  readonly empty: "";
7
8
  };
8
9
  type Fallbacks = typeof fallbacks;
9
- export declare function GetImageURL<Fallback extends keyof Fallbacks>(fallback: Fallback, hash?: string | null): Fallbacks[Fallback] | string;
10
+ export declare function GetImageURL<Fallback extends keyof Fallbacks>(this: ZennifySDK, fallback: Fallback, hash?: string | null): Fallbacks[Fallback] | string;
10
11
  export {};
package/types/main.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { GetImageURL } from './images';
1
2
  export * from './var';
2
3
  export * from './errors';
3
4
  export * from './utils';
@@ -16,6 +17,6 @@ export declare class ZennifySDK {
16
17
  protected readonly token: string | null;
17
18
  constructor(options?: SDKOptions);
18
19
  media: {
19
- get_url: (fallback: "product_icon" | "general" | "void" | "null" | "empty", hash?: string | null | undefined) => Promise<string | undefined>;
20
+ get_url: typeof GetImageURL;
20
21
  };
21
22
  }