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

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,16 @@
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
+ };
9
+ function GetImageURL(source, store_id, id) {
10
+ if (!store_id || !id)
11
+ return sources[source];
12
+ else
13
+ return template
14
+ .replace("{store_id}", store_id.toString())
15
+ .replace("{id}", id.toString());
16
+ }
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.20",
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,14 @@
1
+ type ImageSources = 'product_icon' | 'general'
2
+
3
+ const template = `https://cdn.zennify.app/media/{store_id}/{id}.png`
4
+ const sources: Record<ImageSources, string> = {
5
+ 'product_icon': `https://zennify.app/assets/images/emojis/caixa.png`,
6
+ 'general': `https://zennify.app/assets/images/icon.png`
7
+ }
8
+
9
+ export function GetImageURL(source: ImageSources, store_id?: number | null, id?: number | null) {
10
+ if (!store_id || !id) return sources[source];
11
+ else return template
12
+ .replace("{store_id}", store_id.toString())
13
+ .replace("{id}", id.toString());
14
+ }
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 = 'product_icon' | 'general';
2
+ export declare function GetImageURL(source: ImageSources, store_id?: number | null, id?: number | null): string;
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';