@zennify/sdk-js 1.0.0-beta.20 → 1.0.0-beta.22

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
@@ -4,7 +4,10 @@ exports.GetImageURL = GetImageURL;
4
4
  const template = `https://cdn.zennify.app/media/{store_id}/{id}.png`;
5
5
  const sources = {
6
6
  'product_icon': `https://zennify.app/assets/images/emojis/caixa.png`,
7
- 'general': `https://zennify.app/assets/images/icon.png`
7
+ 'general': `https://zennify.app/assets/images/icon.png`,
8
+ 'void': void 0,
9
+ 'null': null,
10
+ 'empty': ""
8
11
  };
9
12
  function GetImageURL(source, store_id, id) {
10
13
  if (!store_id || !id)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zennify/sdk-js",
3
- "version": "1.0.0-beta.20",
3
+ "version": "1.0.0-beta.22",
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,13 +1,26 @@
1
- type ImageSources = 'product_icon' | 'general'
1
+ interface ImageSources {
2
+ void: void,
3
+ null: null,
4
+ empty: string,
5
+ product_icon: string,
6
+ general: string
7
+ }
2
8
 
3
9
  const template = `https://cdn.zennify.app/media/{store_id}/{id}.png`
4
- const sources: Record<ImageSources, string> = {
10
+ const sources: Record<keyof ImageSources, ImageSources[keyof ImageSources]> = {
5
11
  'product_icon': `https://zennify.app/assets/images/emojis/caixa.png`,
6
- 'general': `https://zennify.app/assets/images/icon.png`
12
+ 'general': `https://zennify.app/assets/images/icon.png`,
13
+ 'void': void 0,
14
+ 'null': null,
15
+ 'empty': ""
7
16
  }
8
17
 
9
- export function GetImageURL(source: ImageSources, store_id?: number | null, id?: number | null) {
10
- if (!store_id || !id) return sources[source];
18
+ export function GetImageURL<Source extends keyof ImageSources>(
19
+ source: Source,
20
+ store_id?: number | null,
21
+ id?: number | null
22
+ ) {
23
+ if (!store_id || !id) return sources[source] as ImageSources[Source];
11
24
  else return template
12
25
  .replace("{store_id}", store_id.toString())
13
26
  .replace("{id}", id.toString());
package/types/images.d.ts CHANGED
@@ -1,3 +1,9 @@
1
- type ImageSources = 'product_icon' | 'general';
2
- export declare function GetImageURL(source: ImageSources, store_id?: number | null, id?: number | null): string;
1
+ interface ImageSources {
2
+ void: void;
3
+ null: null;
4
+ empty: string;
5
+ product_icon: string;
6
+ general: string;
7
+ }
8
+ export declare function GetImageURL<Source extends keyof ImageSources>(source: Source, store_id?: number | null, id?: number | null): string | ImageSources[Source];
3
9
  export {};