@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 +19 -0
- package/dist/main.js +1 -0
- package/package.json +1 -1
- package/src/images.ts +17 -0
- package/src/main.ts +1 -0
- package/types/images.d.ts +3 -0
- package/types/main.d.ts +1 -0
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
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
package/types/main.d.ts
CHANGED