jd_platform_sdk 0.0.2 → 0.0.4
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/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/sdk/configs/jdConfig.js +2 -2
- package/dist/sdk/jdConnector.d.ts +2 -2
- package/dist/sdk/jdConnector.d.ts.map +1 -1
- package/dist/sdk/jdConnector.js +10 -8
- package/dist/sdk/jdSdk.d.ts +1 -1
- package/dist/sdk/jdSdk.d.ts.map +1 -1
- package/dist/sdk/jdSdk.js +2 -1
- package/dist/sdk/models/jdApplication.d.ts +3 -3
- package/dist/sdk/models/jdApplication.d.ts.map +1 -1
- package/dist/sdk/models/jdApplication.js +3 -5
- package/dist/sdk/models/jdResource.d.ts +13 -12
- package/dist/sdk/models/jdResource.d.ts.map +1 -1
- package/dist/sdk/models/jdResource.js +46 -34
- package/dist/sdk/models/modules/geolocation/jdCity.d.ts +15 -0
- package/dist/sdk/models/modules/geolocation/jdCity.d.ts.map +1 -0
- package/dist/sdk/models/modules/geolocation/jdCity.js +50 -0
- package/dist/sdk/models/modules/geolocation/jdCountry.d.ts +10 -0
- package/dist/sdk/models/modules/geolocation/jdCountry.d.ts.map +1 -0
- package/dist/sdk/models/modules/geolocation/jdCountry.js +42 -0
- package/dist/sdk/models/modules/geolocation/jdDistrict.d.ts +14 -0
- package/dist/sdk/models/modules/geolocation/jdDistrict.d.ts.map +1 -0
- package/dist/sdk/models/modules/geolocation/jdDistrict.js +44 -0
- package/dist/sdk/models/modules/geolocation/jdState.d.ts +15 -0
- package/dist/sdk/models/modules/geolocation/jdState.d.ts.map +1 -0
- package/dist/sdk/models/modules/geolocation/jdState.js +50 -0
- package/dist/sdk/models/modules/karaoke/jdKtvShop.d.ts +24 -2
- package/dist/sdk/models/modules/karaoke/jdKtvShop.d.ts.map +1 -1
- package/dist/sdk/models/modules/karaoke/jdKtvShop.js +40 -5
- package/dist/sdk/models/modules/user/jdSessionUser.d.ts +17 -0
- package/dist/sdk/models/modules/user/jdSessionUser.d.ts.map +1 -0
- package/dist/sdk/models/modules/user/jdSessionUser.js +62 -0
- package/dist/sdk/models/modules/user/jdUser.d.ts +17 -0
- package/dist/sdk/models/modules/user/jdUser.d.ts.map +1 -0
- package/dist/sdk/models/modules/user/jdUser.js +72 -0
- package/dist/sdk/utilities/browserUtils.d.ts +6 -4
- package/dist/sdk/utilities/browserUtils.d.ts.map +1 -1
- package/dist/sdk/utilities/browserUtils.js +23 -21
- package/dist/sdk/utilities/utils.d.ts +2 -0
- package/dist/sdk/utilities/utils.d.ts.map +1 -1
- package/dist/sdk/utilities/utils.js +18 -0
- package/package.json +11 -2
- package/readme.md +5 -0
- package/dist/globals.d.ts +0 -7
- package/dist/globals.d.ts.map +0 -1
- package/dist/globals.js +0 -1
- package/dist/sdk/configs/dpConfig.d.ts +0 -15
- package/dist/sdk/configs/dpConfig.d.ts.map +0 -1
- package/dist/sdk/configs/dpConfig.js +0 -49
- package/dist/sdk/extensions/extensions.d.ts +0 -2
- package/dist/sdk/extensions/extensions.d.ts.map +0 -1
- package/dist/sdk/extensions/extensions.js +0 -23
- package/dist/sdk/utilities/crypto_utils.d.ts +0 -5
- package/dist/sdk/utilities/crypto_utils.d.ts.map +0 -1
- package/dist/sdk/utilities/crypto_utils.js +0 -26
- package/dist/stringUtils.d.ts +0 -3
- package/dist/stringUtils.d.ts.map +0 -1
- package/dist/stringUtils.js +0 -6
- package/dist/unit_tests.d.ts +0 -2
- package/dist/unit_tests.d.ts.map +0 -1
- package/dist/unit_tests.js +0 -7
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import JDResource from "../../jdResource";
|
|
11
|
+
import { Utils } from "../../../utilities/utils";
|
|
12
|
+
export class JDState extends JDResource {
|
|
13
|
+
get localisedCountryTitle() { return globalThis.language == 'en' ? this.countryTitleEN : this.countryTitleMM; }
|
|
14
|
+
get countryTitleEN() { return Utils.getString(Utils.getObject(this.country, 'title'), 'en'); }
|
|
15
|
+
get countryTitleMM() { return Utils.getString(Utils.getObject(this.country, 'title'), 'mm'); }
|
|
16
|
+
constructor(data) {
|
|
17
|
+
super(data);
|
|
18
|
+
this.countryId = "";
|
|
19
|
+
this.country = {};
|
|
20
|
+
this.setData(data);
|
|
21
|
+
}
|
|
22
|
+
setData(data) {
|
|
23
|
+
super.setData(data);
|
|
24
|
+
this.countryId = Utils.getString(data, "country_id");
|
|
25
|
+
this.country = Utils.getObject(data, "country");
|
|
26
|
+
}
|
|
27
|
+
static getStates() {
|
|
28
|
+
return __awaiter(this, arguments, void 0, function* (orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
29
|
+
const params = JDResource.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
30
|
+
return yield JDResource.getRelative('/modules/geolocation/states', params);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
static findStates(title_1) {
|
|
34
|
+
return __awaiter(this, arguments, void 0, function* (title, orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
35
|
+
const params = JDResource.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
36
|
+
return yield JDResource.getRelative('/modules/geolocation/states/find', params);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
static getCities(stateId_1) {
|
|
40
|
+
return __awaiter(this, arguments, void 0, function* (stateId, orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
41
|
+
const params = JDResource.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
42
|
+
return yield JDResource.getRelative(`/modules/geolocation/states/${stateId}/cities`, params);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
static getInfo(id) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
return yield JDResource.getRelative(`/modules/geolocation/states/${id}`, {});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
import JDResource from "../../jdResource";
|
|
2
2
|
export declare class JDKtvShop extends JDResource {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
licenseKey: string;
|
|
4
|
+
activationsCount: number;
|
|
5
|
+
maxActivationsCount: number;
|
|
6
|
+
countryId: string;
|
|
7
|
+
stateId: string;
|
|
8
|
+
cityId: string;
|
|
9
|
+
districtId: string;
|
|
10
|
+
address: Record<string, any>;
|
|
11
|
+
country: Record<string, any>;
|
|
12
|
+
state: Record<string, any>;
|
|
13
|
+
city: Record<string, any>;
|
|
14
|
+
district: Record<string, any>;
|
|
15
|
+
get localisedAddress(): string;
|
|
16
|
+
get countryTitleEN(): string;
|
|
17
|
+
get countryTitleMM(): string;
|
|
18
|
+
get stateTitleEN(): string;
|
|
19
|
+
get stateTitleMM(): string;
|
|
20
|
+
get cityTitleEN(): string;
|
|
21
|
+
get cityTitleMM(): string;
|
|
22
|
+
get districtTitleEN(): string;
|
|
23
|
+
get districtTitleMM(): string;
|
|
24
|
+
expiryDate: Date;
|
|
25
|
+
constructor(data: Record<string, any>);
|
|
26
|
+
setData(data: Record<string, any>): void;
|
|
5
27
|
static getKtvShops(isRecommended?: boolean, orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
6
28
|
static getInfo(id: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
7
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jdKtvShop.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/karaoke/jdKtvShop.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAE1C,qBAAa,SAAU,SAAQ,UAAU;
|
|
1
|
+
{"version":3,"file":"jdKtvShop.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/karaoke/jdKtvShop.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAE1C,qBAAa,SAAU,SAAQ,UAAU;IACxC,UAAU,EAAC,MAAM,CAAM;IACvB,gBAAgB,EAAC,MAAM,CAAK;IAC5B,mBAAmB,EAAC,MAAM,CAAK;IAE/B,SAAS,EAAC,MAAM,CAAM;IACtB,OAAO,EAAC,MAAM,CAAM;IACpB,MAAM,EAAC,MAAM,CAAM;IACnB,UAAU,EAAC,MAAM,CAAM;IAEvB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAClC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAClC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAChC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAC/B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAEnC,IAAI,gBAAgB,IAAG,MAAM,CAG5B;IAED,IAAI,cAAc,IAAG,MAAM,CAAyE;IACpG,IAAI,cAAc,IAAG,MAAM,CAAyE;IAEpG,IAAI,YAAY,IAAG,MAAM,CAAuE;IAChG,IAAI,YAAY,IAAG,MAAM,CAAuE;IAEhG,IAAI,WAAW,IAAG,MAAM,CAAsE;IAC9F,IAAI,WAAW,IAAG,MAAM,CAAsE;IAE9F,IAAI,eAAe,IAAG,MAAM,CAA0E;IACtG,IAAI,eAAe,IAAG,MAAM,CAA0E;IAEtG,UAAU,EAAC,IAAI,CAAc;gBAEjB,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAKpC,OAAO,CAAC,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;WAoBnB,WAAW,CAAC,aAAa,UAAQ,EAAE,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;WASxH,OAAO,CAAC,EAAE,EAAC,MAAM;CAG9B"}
|
|
@@ -10,12 +10,50 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import JDResource from "../../jdResource";
|
|
11
11
|
import { Utils } from "../../../utilities/utils";
|
|
12
12
|
export class JDKtvShop extends JDResource {
|
|
13
|
+
get localisedAddress() {
|
|
14
|
+
return globalThis.language != 'en' ? `${this.districtTitleMM}, ${this.stateTitleMM}, ${this.cityTitleMM}, ${this.countryTitleMM},` :
|
|
15
|
+
`${this.districtTitleEN}, ${this.stateTitleEN}, ${this.cityTitleEN}, ${this.countryTitleEN},`;
|
|
16
|
+
}
|
|
17
|
+
get countryTitleEN() { return Utils.getString(Utils.getObject(this.country, 'title'), 'en'); }
|
|
18
|
+
get countryTitleMM() { return Utils.getString(Utils.getObject(this.country, 'title'), 'mm'); }
|
|
19
|
+
get stateTitleEN() { return Utils.getString(Utils.getObject(this.state, 'title'), 'en'); }
|
|
20
|
+
get stateTitleMM() { return Utils.getString(Utils.getObject(this.state, 'title'), 'mm'); }
|
|
21
|
+
get cityTitleEN() { return Utils.getString(Utils.getObject(this.city, 'title'), 'en'); }
|
|
22
|
+
get cityTitleMM() { return Utils.getString(Utils.getObject(this.city, 'title'), 'mm'); }
|
|
23
|
+
get districtTitleEN() { return Utils.getString(Utils.getObject(this.district, 'title'), 'en'); }
|
|
24
|
+
get districtTitleMM() { return Utils.getString(Utils.getObject(this.district, 'title'), 'mm'); }
|
|
13
25
|
constructor(data) {
|
|
14
26
|
super(data);
|
|
27
|
+
this.licenseKey = "";
|
|
28
|
+
this.activationsCount = 0;
|
|
29
|
+
this.maxActivationsCount = 0;
|
|
30
|
+
this.countryId = "";
|
|
31
|
+
this.stateId = "";
|
|
32
|
+
this.cityId = "";
|
|
33
|
+
this.districtId = "";
|
|
34
|
+
this.address = {};
|
|
35
|
+
this.country = {};
|
|
36
|
+
this.state = {};
|
|
37
|
+
this.city = {};
|
|
38
|
+
this.district = {};
|
|
39
|
+
this.expiryDate = new Date();
|
|
15
40
|
this.setData(data);
|
|
16
41
|
}
|
|
17
42
|
setData(data) {
|
|
18
43
|
super.setData(data);
|
|
44
|
+
this.licenseKey = Utils.getString(data, "license_key");
|
|
45
|
+
this.activationsCount = Utils.getInteger(data, "activations_count");
|
|
46
|
+
this.maxActivationsCount = Utils.getInteger(data, "max_activations_count");
|
|
47
|
+
this.countryId = Utils.getString(data, "country_id");
|
|
48
|
+
this.stateId = Utils.getString(data, "state_id");
|
|
49
|
+
this.cityId = Utils.getString(data, "city_id");
|
|
50
|
+
this.districtId = Utils.getString(data, "district_id");
|
|
51
|
+
this.address = Utils.getObject(data, "address");
|
|
52
|
+
this.country = Utils.getObject(data, "country");
|
|
53
|
+
this.state = Utils.getObject(data, "state");
|
|
54
|
+
this.city = Utils.getObject(data, "city");
|
|
55
|
+
this.district = Utils.getObject(data, "district");
|
|
56
|
+
this.expiryDate = Utils.getDate(data, "expiry_date");
|
|
19
57
|
}
|
|
20
58
|
static getKtvShops() {
|
|
21
59
|
return __awaiter(this, arguments, void 0, function* (isRecommended = false, orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
@@ -23,15 +61,12 @@ export class JDKtvShop extends JDResource {
|
|
|
23
61
|
if (Utils.isset(isRecommended)) {
|
|
24
62
|
params['recommended'] = isRecommended ? 'true' : 'false';
|
|
25
63
|
}
|
|
26
|
-
|
|
27
|
-
const response = yield JDResource.getRelative('/applications', params);
|
|
28
|
-
return response;
|
|
64
|
+
return yield JDResource.getRelative('/modules/karaoke/ktv_shops', params);
|
|
29
65
|
});
|
|
30
66
|
}
|
|
31
67
|
static getInfo(id) {
|
|
32
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
|
|
34
|
-
return response;
|
|
69
|
+
return yield JDResource.getRelative(`/modules/karaoke/ktv_shops/${id}`, {});
|
|
35
70
|
});
|
|
36
71
|
}
|
|
37
72
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import JDResource from "../../jdResource";
|
|
2
|
+
export declare class JDSessionUser extends JDResource {
|
|
3
|
+
cloudSessionId: string;
|
|
4
|
+
name: string;
|
|
5
|
+
username: string;
|
|
6
|
+
phone: string;
|
|
7
|
+
searchTokens: any[];
|
|
8
|
+
get isLoggedIn(): boolean;
|
|
9
|
+
constructor(data: Record<string, any>);
|
|
10
|
+
setData(data: Record<string, any>): void;
|
|
11
|
+
static findSessionUsers(name: string, orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
12
|
+
static authenticate(username: string, password: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
13
|
+
static register(name: string, username: string, email: string, phone: string, password: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
14
|
+
static logout(name: string, username: string, email: string, phone: string, password: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
15
|
+
static getInfo(id: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=jdSessionUser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jdSessionUser.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/user/jdSessionUser.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAE1C,qBAAa,aAAc,SAAQ,UAAU;IAC5C,cAAc,EAAC,MAAM,CAAM;IAC3B,IAAI,EAAC,MAAM,CAAM;IACjB,QAAQ,EAAC,MAAM,CAAM;IACrB,KAAK,EAAC,MAAM,CAAM;IAClB,YAAY,EAAE,GAAG,EAAE,CAAM;IAEzB,IAAI,UAAU,IAAG,OAAO,CAA+C;gBAE3D,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAKpC,OAAO,CAAC,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;WASnB,gBAAgB,CAAC,IAAI,EAAC,MAAM,EAAE,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;WAMnH,YAAY,CAAC,QAAQ,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM;WAK7C,QAAQ,CAAC,IAAI,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM;WAKlF,MAAM,CAAC,IAAI,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM;WAMhF,OAAO,CAAC,EAAE,EAAC,MAAM;CAG9B"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import JDResource from "../../jdResource";
|
|
11
|
+
import { Utils } from "../../../utilities/utils";
|
|
12
|
+
export class JDSessionUser extends JDResource {
|
|
13
|
+
get isLoggedIn() { return Utils.isset(globalThis.xAuthToken); }
|
|
14
|
+
constructor(data) {
|
|
15
|
+
super(data);
|
|
16
|
+
this.cloudSessionId = "";
|
|
17
|
+
this.name = "";
|
|
18
|
+
this.username = "";
|
|
19
|
+
this.phone = "";
|
|
20
|
+
this.searchTokens = [];
|
|
21
|
+
this.setData(data);
|
|
22
|
+
}
|
|
23
|
+
setData(data) {
|
|
24
|
+
super.setData(data);
|
|
25
|
+
this.cloudSessionId = Utils.getString(data, "cloud_session_id");
|
|
26
|
+
this.name = Utils.getString(data, "name");
|
|
27
|
+
this.username = Utils.getString(data, "username");
|
|
28
|
+
this.phone = Utils.getString(data, "phone");
|
|
29
|
+
this.searchTokens = Utils.getArray(data, "search_tokens");
|
|
30
|
+
}
|
|
31
|
+
static findSessionUsers(name_1) {
|
|
32
|
+
return __awaiter(this, arguments, void 0, function* (name, orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
33
|
+
const params = JDResource.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
34
|
+
return yield JDResource.getRelative('/modules/user/session_users/find', params);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
// TODO: Sign the API calls to only be able to call from this client only
|
|
38
|
+
static authenticate(username, password) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const body = { username, password };
|
|
41
|
+
return yield JDResource.postRelative('/modules/user/session_users/authenticate', body);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
static register(name, username, email, phone, password) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const body = { name, username, email, phone, password };
|
|
47
|
+
return yield JDResource.postRelative('/modules/user/session_users/register', body);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
static logout(name, username, email, phone, password) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const body = { name, username, email, phone, password };
|
|
53
|
+
return yield JDResource.postRelative('/modules/user/session_users/register', body);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
// Get the user information
|
|
57
|
+
static getInfo(id) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
return yield JDResource.getRelative(`/modules/user/session_users/${id}`, {});
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import JDResource from "../../jdResource";
|
|
2
|
+
export declare class JDUser extends JDResource {
|
|
3
|
+
name: string;
|
|
4
|
+
username: string;
|
|
5
|
+
phone: string;
|
|
6
|
+
email: string;
|
|
7
|
+
searchTokens: any[];
|
|
8
|
+
get isLoggedIn(): boolean;
|
|
9
|
+
constructor(data: Record<string, any>);
|
|
10
|
+
setData(data: Record<string, any>): void;
|
|
11
|
+
static findUsers(name: string, orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
12
|
+
static authenticate(username: string, password: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
13
|
+
static register(name: string, username: string, email: string, phone: string, password: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
14
|
+
static logout(name: string, username: string, email: string, phone: string, password: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
15
|
+
static getInfo(id: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=jdUser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jdUser.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/user/jdUser.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAE1C,qBAAa,MAAO,SAAQ,UAAU;IACrC,IAAI,EAAC,MAAM,CAAM;IACjB,QAAQ,EAAC,MAAM,CAAM;IACrB,KAAK,EAAC,MAAM,CAAM;IAClB,KAAK,EAAC,MAAM,CAAM;IAClB,YAAY,EAAE,GAAG,EAAE,CAAM;IAEzB,IAAI,UAAU,IAAG,OAAO,CAA+C;gBAE3D,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAKpC,OAAO,CAAC,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;WASnB,SAAS,CAAC,IAAI,EAAC,MAAM,EAAE,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;WAM5G,YAAY,CAAC,QAAQ,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM;WAO7C,QAAQ,CAAC,IAAI,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM;WAOlF,MAAM,CAAC,IAAI,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM;WAahF,OAAO,CAAC,EAAE,EAAC,MAAM;CAG9B"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import JDResource from "../../jdResource";
|
|
11
|
+
import { Utils } from "../../../utilities/utils";
|
|
12
|
+
export class JDUser extends JDResource {
|
|
13
|
+
get isLoggedIn() { return Utils.isset(globalThis.xAuthToken); }
|
|
14
|
+
constructor(data) {
|
|
15
|
+
super(data);
|
|
16
|
+
this.name = "";
|
|
17
|
+
this.username = "";
|
|
18
|
+
this.phone = "";
|
|
19
|
+
this.email = "";
|
|
20
|
+
this.searchTokens = [];
|
|
21
|
+
this.setData(data);
|
|
22
|
+
}
|
|
23
|
+
setData(data) {
|
|
24
|
+
super.setData(data);
|
|
25
|
+
this.name = Utils.getString(data, "name");
|
|
26
|
+
this.username = Utils.getString(data, "username");
|
|
27
|
+
this.phone = Utils.getString(data, "phone");
|
|
28
|
+
this.email = Utils.getString(data, "email");
|
|
29
|
+
this.searchTokens = Utils.getArray(data, "search_tokens");
|
|
30
|
+
}
|
|
31
|
+
static findUsers(name_1) {
|
|
32
|
+
return __awaiter(this, arguments, void 0, function* (name, orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
33
|
+
const params = JDResource.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
34
|
+
return yield JDResource.getRelative('/modules/user/users/find', params);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
// TODO: Sign the API calls to only be able to call from this client only
|
|
38
|
+
static authenticate(username, password) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const body = { username, password };
|
|
41
|
+
const response = yield JDResource.postRelative('/modules/user/users/authenticate', body);
|
|
42
|
+
yield JDResource.checkUser(response);
|
|
43
|
+
return response;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
static register(name, username, email, phone, password) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const body = { name, username, email, phone, password };
|
|
49
|
+
const response = yield JDResource.postRelative('/modules/user/users/register', body);
|
|
50
|
+
yield JDResource.checkUser(response);
|
|
51
|
+
return response;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
static logout(name, username, email, phone, password) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const body = { name, username, email, phone, password };
|
|
57
|
+
const response = yield JDResource.postRelative('/modules/user/users/register', body);
|
|
58
|
+
// Reset the auth token information
|
|
59
|
+
if (response.statusCode == 200) {
|
|
60
|
+
globalThis.xAuthToken = "";
|
|
61
|
+
globalThis.user = new JDUser({});
|
|
62
|
+
}
|
|
63
|
+
return response;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
// Get the user information
|
|
67
|
+
static getInfo(id) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
return yield JDResource.getRelative(`/modules/user/users/${id}`, {});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export declare class BrowserUtils {
|
|
2
|
+
static setSessionItem(key: string, val: string): void;
|
|
3
|
+
static getSessionItem(key: string): string | null;
|
|
4
|
+
static setStorageItem(key: string, val: string): void;
|
|
5
|
+
static getStorageItem(key: string): string | null;
|
|
6
|
+
}
|
|
5
7
|
//# sourceMappingURL=browserUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browserUtils.d.ts","sourceRoot":"","sources":["../../../src/sdk/utilities/browserUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"browserUtils.d.ts","sourceRoot":"","sources":["../../../src/sdk/utilities/browserUtils.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAY;IAErB,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAOrD,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAQjD,MAAM,CAAE,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAOtD,MAAM,CAAE,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAMrD"}
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export class BrowserUtils {
|
|
2
|
+
// Set a session storage item
|
|
3
|
+
static setSessionItem(key, val) {
|
|
4
|
+
if (typeof window !== "undefined") {
|
|
5
|
+
window.sessionStorage.setItem(key, val);
|
|
6
|
+
}
|
|
5
7
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
// Get a session storage item
|
|
9
|
+
static getSessionItem(key) {
|
|
10
|
+
if (typeof window !== "undefined") {
|
|
11
|
+
return window.sessionStorage.getItem(key);
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
11
14
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
window.localStorage.setItem(key, val);
|
|
15
|
+
// Set a local storage item
|
|
16
|
+
static setStorageItem(key, val) {
|
|
17
|
+
if (typeof window !== "undefined") {
|
|
18
|
+
window.localStorage.setItem(key, val);
|
|
19
|
+
}
|
|
18
20
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
// Get a local storage item
|
|
22
|
+
static getStorageItem(key) {
|
|
23
|
+
if (typeof window !== "undefined") {
|
|
24
|
+
return window.localStorage.getItem(key);
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
24
27
|
}
|
|
25
|
-
return null;
|
|
26
28
|
}
|
|
@@ -15,6 +15,8 @@ export declare class Utils {
|
|
|
15
15
|
static addFloatToField(data: any, field: string, amount: number): number;
|
|
16
16
|
static stringToObject(strData: string): any;
|
|
17
17
|
static stringToArray(strData: string): any[];
|
|
18
|
+
static objectToString(data: object): string;
|
|
19
|
+
static arrayToString(dataArray: object): string;
|
|
18
20
|
static copyToClipboard(val: string, message?: string): void;
|
|
19
21
|
static isset(obj: Record<string, any> | null | undefined | string | boolean): boolean;
|
|
20
22
|
static issetNum(val: any): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/sdk/utilities/utils.ts"],"names":[],"mappings":"AAEA,qBAAa,KAAK;IACd,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAIlD,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,SAAK,GAAG,MAAM;IAInE,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAIlE,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,SAAI,GAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/sdk/utilities/utils.ts"],"names":[],"mappings":"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"}
|
|
@@ -10,6 +10,8 @@ export class Utils {
|
|
|
10
10
|
return this.hasField(data, field) ? data[field] : 0;
|
|
11
11
|
}
|
|
12
12
|
static getInteger(data, field, defaultVal = 0) {
|
|
13
|
+
const fieldExist = this.hasField(data, field);
|
|
14
|
+
console.log(`Field Exist: ${fieldExist}`);
|
|
13
15
|
return this.hasField(data, field) ? parseInt(data[field]) : defaultVal;
|
|
14
16
|
}
|
|
15
17
|
static getBigInteger(data, field, defaultVal = 0) {
|
|
@@ -64,6 +66,22 @@ export class Utils {
|
|
|
64
66
|
return [];
|
|
65
67
|
}
|
|
66
68
|
}
|
|
69
|
+
static objectToString(data) {
|
|
70
|
+
try {
|
|
71
|
+
return JSON.stringify(data);
|
|
72
|
+
}
|
|
73
|
+
catch (ex) {
|
|
74
|
+
return "{}";
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
static arrayToString(dataArray) {
|
|
78
|
+
try {
|
|
79
|
+
return JSON.stringify(dataArray);
|
|
80
|
+
}
|
|
81
|
+
catch (ex) {
|
|
82
|
+
return "[]";
|
|
83
|
+
}
|
|
84
|
+
}
|
|
67
85
|
static copyToClipboard(val, message = 'Text copied') {
|
|
68
86
|
navigator.clipboard.writeText(val)
|
|
69
87
|
.then(() => {
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jd_platform_sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"main": "dist/index.js",
|
|
5
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./dist/index.js"
|
|
9
|
+
},
|
|
6
10
|
"scripts": {
|
|
7
11
|
"build": "tsc",
|
|
8
12
|
"test": "jest"
|
|
@@ -21,11 +25,16 @@
|
|
|
21
25
|
"license": "MIT",
|
|
22
26
|
"description": "Collection of utilities classes used in the projects",
|
|
23
27
|
"devDependencies": {
|
|
28
|
+
"@sveltejs/vite-plugin-svelte": "^4.0.0",
|
|
29
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
30
|
+
"@testing-library/svelte": "^5.2.4",
|
|
24
31
|
"@types/crypto-js": "^4.2.2",
|
|
25
32
|
"@types/jest": "^29.5.14",
|
|
26
33
|
"jest": "^29.7.0",
|
|
34
|
+
"jsdom": "^25.0.1",
|
|
27
35
|
"ts-jest": "^29.2.5",
|
|
28
|
-
"typescript": "^5.6.3"
|
|
36
|
+
"typescript": "^5.6.3",
|
|
37
|
+
"vitest": "^2.1.4"
|
|
29
38
|
},
|
|
30
39
|
"dependencies": {
|
|
31
40
|
"crypto-js": "^4.2.0"
|
package/readme.md
CHANGED
package/dist/globals.d.ts
DELETED
package/dist/globals.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../src/globals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AAEV,OAAO,CAAC,MAAM,CAAC;IACX,IAAI,gBAAgB,EAAE,MAAM,CAAC;IAC7B,IAAI,SAAS,EAAE,MAAM,CAAC;IACtB,IAAI,YAAY,EAAE,MAAM,CAAC;CAC5B"}
|
package/dist/globals.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export default class JDConfig {
|
|
2
|
-
private static _instance;
|
|
3
|
-
cdnHost: string;
|
|
4
|
-
private _localHost;
|
|
5
|
-
private _localVersion;
|
|
6
|
-
private _sandboxHost;
|
|
7
|
-
private _sandboxVersion;
|
|
8
|
-
private _productionHost;
|
|
9
|
-
private _productionVersion;
|
|
10
|
-
private constructor();
|
|
11
|
-
static get instance(): JDConfig;
|
|
12
|
-
static getAPIHost(): string;
|
|
13
|
-
static getAPIHostOnly(): string;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=dpConfig.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dpConfig.d.ts","sourceRoot":"","sources":["../../../src/sdk/configs/dpConfig.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,OAAO,OAAO,QAAQ;IAC5B,OAAO,CAAC,MAAM,CAAC,SAAS,CAAW;IAEnC,OAAO,SAAuC;IAC9C,OAAO,CAAC,UAAU,CAA4B;IAC9C,OAAO,CAAC,aAAa,CAAQ;IAC7B,OAAO,CAAC,YAAY,CAAqC;IACzD,OAAO,CAAC,eAAe,CAAQ;IAC/B,OAAO,CAAC,eAAe,CAAkC;IACzD,OAAO,CAAC,kBAAkB,CAAQ;IAIlC,OAAO;IAEP,WAAkB,QAAQ,IAAI,QAAQ,CAMrC;IAED,MAAM,CAAC,UAAU;IAajB,MAAM,CAAC,cAAc;CAYrB"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// Singleton class to be able to called from everywhere with minify compatible
|
|
2
|
-
export default class JDConfig {
|
|
3
|
-
//Singleton constructor shouldn't be called directly and use JDConfig.instance
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
5
|
-
constructor() {
|
|
6
|
-
this.cdnHost = 'https://deskprox-public.b-cdn.net';
|
|
7
|
-
this._localHost = 'http://localhost:8080/';
|
|
8
|
-
this._localVersion = 'v1';
|
|
9
|
-
this._sandboxHost = 'https://api-sb.karaokeprox.com/';
|
|
10
|
-
this._sandboxVersion = 'v1';
|
|
11
|
-
this._productionHost = 'https://api.karaokeprox.com/';
|
|
12
|
-
this._productionVersion = 'v1';
|
|
13
|
-
}
|
|
14
|
-
static get instance() {
|
|
15
|
-
if (!JDConfig._instance) {
|
|
16
|
-
console.log('JDConfig: No instance found and creating new one');
|
|
17
|
-
JDConfig._instance = new JDConfig();
|
|
18
|
-
}
|
|
19
|
-
return JDConfig._instance;
|
|
20
|
-
}
|
|
21
|
-
static getAPIHost() {
|
|
22
|
-
const prConfig = JDConfig.instance;
|
|
23
|
-
if (globalThis.bLocalHost) {
|
|
24
|
-
return prConfig._localHost + prConfig._localVersion;
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
if (globalThis.bSandboxApi) {
|
|
28
|
-
return prConfig._sandboxHost + prConfig._sandboxVersion;
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
return prConfig._productionHost + prConfig._productionVersion;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
static getAPIHostOnly() {
|
|
36
|
-
const prConfig = JDConfig.instance;
|
|
37
|
-
if (globalThis.bLocalHost) {
|
|
38
|
-
return prConfig._localHost;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
if (globalThis.bSandboxApi) {
|
|
42
|
-
return prConfig._sandboxHost;
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
return prConfig._productionHost;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../../src/sdk/extensions/extensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
String.prototype.isset = function () {
|
|
2
|
-
return this != null && this !== "";
|
|
3
|
-
};
|
|
4
|
-
String.prototype.extractNumbers = function () {
|
|
5
|
-
const num = this.match(/\d/g);
|
|
6
|
-
return num ? parseInt(num.join(""), 10) : NaN;
|
|
7
|
-
};
|
|
8
|
-
Number.prototype.format = function () {
|
|
9
|
-
return this.toLocaleString("en-US");
|
|
10
|
-
};
|
|
11
|
-
// Number.prototype.formatDecimals = function (decimals: number = 2): string {
|
|
12
|
-
// return this.toFixed(decimals);
|
|
13
|
-
// };
|
|
14
|
-
Object.prototype.isset = function () {
|
|
15
|
-
return this != null && Object.keys(this).length > 0;
|
|
16
|
-
};
|
|
17
|
-
Object.prototype.isEmpty = function () {
|
|
18
|
-
return this == null || Object.keys(this).length <= 0;
|
|
19
|
-
};
|
|
20
|
-
Array.prototype.shuffle = function () {
|
|
21
|
-
return this.sort(() => Math.random() - 0.5);
|
|
22
|
-
};
|
|
23
|
-
export {};
|