@zennify/sdk-js 1.0.0-beta.19 → 1.0.0-beta.21

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 ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetImageURL = GetImageURL;
4
+ const template = `https://cdn.zennify.app/media/{store_id}/{id}.png`;
5
+ const sources = {
6
+ 'product_icon': `https://zennify.app/assets/images/emojis/caixa.png`,
7
+ 'general': `https://zennify.app/assets/images/icon.png`,
8
+ 'void': void 0,
9
+ 'null': null,
10
+ 'empty': ""
11
+ };
12
+ function GetImageURL(source, store_id, id) {
13
+ if (!store_id || !id)
14
+ return sources[source];
15
+ else
16
+ return template
17
+ .replace("{store_id}", store_id.toString())
18
+ .replace("{id}", id.toString());
19
+ }
package/dist/main.js CHANGED
@@ -18,6 +18,7 @@ __exportStar(require("./var"), exports);
18
18
  __exportStar(require("./errors"), exports);
19
19
  __exportStar(require("./utils"), exports);
20
20
  __exportStar(require("./RequestError"), exports);
21
+ __exportStar(require("./images"), exports);
21
22
  __exportStar(require("./interfaces/Media"), exports);
22
23
  __exportStar(require("./interfaces/Panels"), exports);
23
24
  __exportStar(require("./interfaces/Products"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zennify/sdk-js",
3
- "version": "1.0.0-beta.19",
3
+ "version": "1.0.0-beta.21",
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 ADDED
@@ -0,0 +1,17 @@
1
+ type ImageSources = 'void' | 'null' | 'empty' | 'product_icon' | 'general'
2
+
3
+ const template = `https://cdn.zennify.app/media/{store_id}/{id}.png`
4
+ const sources: Record<ImageSources, string | void | null> = {
5
+ 'product_icon': `https://zennify.app/assets/images/emojis/caixa.png`,
6
+ 'general': `https://zennify.app/assets/images/icon.png`,
7
+ 'void': void 0,
8
+ 'null': null,
9
+ 'empty': ""
10
+ }
11
+
12
+ export function GetImageURL(source: ImageSources, store_id?: number | null, id?: number | null) {
13
+ if (!store_id || !id) return sources[source];
14
+ else return template
15
+ .replace("{store_id}", store_id.toString())
16
+ .replace("{id}", id.toString());
17
+ }
package/src/main.ts CHANGED
@@ -2,6 +2,7 @@ export * from './var';
2
2
  export * from './errors';
3
3
  export * from './utils';
4
4
  export * from './RequestError';
5
+ export * from './images'
5
6
 
6
7
  export * from './interfaces/Media';
7
8
  export * from './interfaces/Panels';
@@ -0,0 +1,3 @@
1
+ type ImageSources = 'void' | 'null' | 'empty' | 'product_icon' | 'general';
2
+ export declare function GetImageURL(source: ImageSources, store_id?: number | null, id?: number | null): string | void | null;
3
+ export {};
package/types/main.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from './var';
2
2
  export * from './errors';
3
3
  export * from './utils';
4
4
  export * from './RequestError';
5
+ export * from './images';
5
6
  export * from './interfaces/Media';
6
7
  export * from './interfaces/Panels';
7
8
  export * from './interfaces/Products';