-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCapiCommunity.ts
69 lines (55 loc) · 3.24 KB
/
CapiCommunity.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* Copyright (c) 2023. Selldone® Business OS™
*
* Author: M.Pajuhaan
* Web: https://selldone.com
* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
*
* All rights reserved. In the weave of time, where traditions and innovations intermingle, this content was crafted.
* From the essence of thought, through the corridors of creativity, each word, and sentiment has been molded.
* Not just to exist, but to inspire. Like an artist's stroke or a sculptor's chisel, every nuance is deliberate.
* Our journey is not just about reaching a destination, but about creating a masterpiece.
* Tread carefully, for you're treading on dreams.
*/
import { APIAbstract } from "@selldone/core-js/server/APIAbstract";
import { CAPI } from "./apis/CAPI";
import getInfo from "./requests/capi.community.get";
import type { Shop } from "@selldone/core-js/models/shop/shop.model";
import type { Community } from "@selldone/core-js/models/community/community.model";
import { CapiPost } from "./post/CapiPost";
import { CommunityRoutesName } from "@selldone/core-js/enums/route/CommunityRoutesName";
const SDK_VERSION = "0.02";
export class CapiCommunity extends APIAbstract {
public routes = CommunityRoutesName;
static Setup(): void {
console.log("┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓");
console.log(`┣━━━ Selldone® Community SDK | V${SDK_VERSION} ━━━┫`);
console.log("┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛");
window.CAPI = new CAPI(); // Community API
window.$community = new CapiCommunity();
}
constructor() {
super();
}
public getInfo = getInfo;
public post = new CapiPost();
public getCommunityID(shop?: (Shop & { community?: Community }) | null) {
return shop
? shop.community && shop.community.id
: 1; /* 1 : Main Selldone official community */
}
}
//█████████████████████████████████████████████████████████████
//―――――――――――――――― 🦫 Types ――――――――――――――――
//█████████████████████████████████████████████████████████████
export namespace CapiCommunity {}
//█████████████████████████████████████████████████████████████
//―――――――――――――― Global Types ―――――――――――――――
//█████████████████████████████████████████████████████████████
// Extend the Window interface to recognize the properties you add to the global window object.
declare global {
interface Window {
CAPI: CAPI;
$community: CapiCommunity;
}
}