jd_platform_sdk 0.0.3 → 0.0.6
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 +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/sdk/configs/jdConfig.d.ts.map +1 -1
- package/dist/sdk/configs/jdConfig.js +0 -2
- package/dist/sdk/jdConnector.d.ts +2 -2
- package/dist/sdk/jdConnector.d.ts.map +1 -1
- package/dist/sdk/jdConnector.js +1 -1
- package/dist/sdk/models/jdApplication.d.ts +6 -6
- package/dist/sdk/models/jdApplication.d.ts.map +1 -1
- package/dist/sdk/models/jdApplication.js +9 -11
- package/dist/sdk/models/jdResource.d.ts +17 -10
- package/dist/sdk/models/jdResource.d.ts.map +1 -1
- package/dist/sdk/models/jdResource.js +50 -20
- 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 +6 -5
- package/dist/sdk/models/modules/karaoke/jdKtvShop.d.ts.map +1 -1
- package/dist/sdk/models/modules/karaoke/jdKtvShop.js +13 -11
- package/dist/sdk/models/modules/music/jdSong.d.ts +85 -0
- package/dist/sdk/models/modules/music/jdSong.d.ts.map +1 -0
- package/dist/sdk/models/modules/music/jdSong.js +140 -0
- package/dist/sdk/models/modules/user/jdPermission.d.ts +35 -0
- package/dist/sdk/models/modules/user/jdPermission.d.ts.map +1 -0
- package/dist/sdk/models/modules/user/jdPermission.js +73 -0
- 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 +18 -0
- package/dist/sdk/models/modules/user/jdUser.d.ts.map +1 -0
- package/dist/sdk/models/modules/user/jdUser.js +71 -0
- package/dist/sdk/utilities/browserUtils.d.ts +15 -4
- package/dist/sdk/utilities/browserUtils.d.ts.map +1 -1
- package/dist/sdk/utilities/browserUtils.js +102 -21
- package/dist/sdk/utilities/utils.d.ts +22 -10
- package/dist/sdk/utilities/utils.d.ts.map +1 -1
- package/dist/sdk/utilities/utils.js +87 -3
- package/package.json +4 -1
package/dist/index.d.ts
CHANGED
|
@@ -9,5 +9,13 @@ export * from "./sdk/utilities/stringUtils";
|
|
|
9
9
|
export * from "./sdk/utilities/utils";
|
|
10
10
|
export * from "./sdk/models/jdResource";
|
|
11
11
|
export * from "./sdk/models/jdApplication";
|
|
12
|
+
export * from "./sdk/models/modules/user/jdUser";
|
|
13
|
+
export * from "./sdk/models/modules/user/jdSessionUser";
|
|
14
|
+
export * from "./sdk/models/modules/user/jdPermission";
|
|
12
15
|
export * from "./sdk/models/modules/karaoke/jdKtvShop";
|
|
16
|
+
export * from "./sdk/models/modules/music/jdSong";
|
|
17
|
+
export * from "./sdk/models/modules/geolocation/jdCountry";
|
|
18
|
+
export * from "./sdk/models/modules/geolocation/jdState";
|
|
19
|
+
export * from "./sdk/models/modules/geolocation/jdCity";
|
|
20
|
+
export * from "./sdk/models/modules/geolocation/jdDistrict";
|
|
13
21
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AAGvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AACnD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AAGtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AAGvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AACnD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AAGtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAG3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,yCAAyC,CAAC;AACxD,cAAc,wCAAwC,CAAC;AAGvD,cAAc,wCAAwC,CAAC;AAGvD,cAAc,mCAAmC,CAAC;AAGlD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,0CAA0C,CAAC;AACzD,cAAc,yCAAyC,CAAC;AACxD,cAAc,6CAA6C,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11,4 +11,16 @@ export * from "./sdk/utilities/utils";
|
|
|
11
11
|
// Generic Models for different possible modules for all platforms
|
|
12
12
|
export * from "./sdk/models/jdResource";
|
|
13
13
|
export * from "./sdk/models/jdApplication";
|
|
14
|
+
//User
|
|
15
|
+
export * from "./sdk/models/modules/user/jdUser";
|
|
16
|
+
export * from "./sdk/models/modules/user/jdSessionUser";
|
|
17
|
+
export * from "./sdk/models/modules/user/jdPermission";
|
|
18
|
+
//Karaoke
|
|
14
19
|
export * from "./sdk/models/modules/karaoke/jdKtvShop";
|
|
20
|
+
//Music
|
|
21
|
+
export * from "./sdk/models/modules/music/jdSong";
|
|
22
|
+
//Geolocation
|
|
23
|
+
export * from "./sdk/models/modules/geolocation/jdCountry";
|
|
24
|
+
export * from "./sdk/models/modules/geolocation/jdState";
|
|
25
|
+
export * from "./sdk/models/modules/geolocation/jdCity";
|
|
26
|
+
export * from "./sdk/models/modules/geolocation/jdDistrict";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jdConfig.d.ts","sourceRoot":"","sources":["../../../src/sdk/configs/jdConfig.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,OAAO,OAAO,QAAQ;IAC5B,OAAO,CAAC,MAAM,CAAC,SAAS,CAAW;IAGnC,OAAO;IAEP,WAAkB,QAAQ,IAAI,QAAQ,
|
|
1
|
+
{"version":3,"file":"jdConfig.d.ts","sourceRoot":"","sources":["../../../src/sdk/configs/jdConfig.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,OAAO,OAAO,QAAQ;IAC5B,OAAO,CAAC,MAAM,CAAC,SAAS,CAAW;IAGnC,OAAO;IAEP,WAAkB,QAAQ,IAAI,QAAQ,CAKrC;IAED,MAAM,CAAC,UAAU;IAajB,MAAM,CAAC,cAAc;CAYrB"}
|
|
@@ -4,13 +4,11 @@ export default class JDConfig {
|
|
|
4
4
|
constructor() { }
|
|
5
5
|
static get instance() {
|
|
6
6
|
if (!JDConfig._instance) {
|
|
7
|
-
console.log('JDConfig: No instance found and creating new one');
|
|
8
7
|
JDConfig._instance = new JDConfig();
|
|
9
8
|
}
|
|
10
9
|
return JDConfig._instance;
|
|
11
10
|
}
|
|
12
11
|
static getAPIHost() {
|
|
13
|
-
const prConfig = JDConfig.instance;
|
|
14
12
|
if (globalThis.bLocalHost) {
|
|
15
13
|
return globalThis.apiEndPointLocalhost + "/" + globalThis.apiVersion;
|
|
16
14
|
}
|
|
@@ -15,10 +15,10 @@ export declare class JDConnector {
|
|
|
15
15
|
httpPostDirectAsync(url: string, headers: any, body: any, bShowErrorMessage: boolean, bAutoHideBusyIndicator?: boolean, overrideVersion?: string): Promise<SimpleResponse>;
|
|
16
16
|
httpGetRelativeAsync(url: string, headers: any, params: any, bShowErrorMessage: boolean, bForceRefresh?: boolean, bAutoHideBusyIndicator?: boolean, overrideVersion?: string): Promise<SimpleResponse>;
|
|
17
17
|
httpPostRelativeAsync(url: string, headers: any, body: any, bShowErrorMessage: boolean, bAutoHideBusyIndicator?: boolean, overrideVersion?: string): Promise<SimpleResponse>;
|
|
18
|
-
httpASyncCallDirect(httpType:
|
|
18
|
+
httpASyncCallDirect(httpType: JDHttpType, url: string, params: any, headers: any, body: any, bShowErrorMessage: boolean, bBuildParams: boolean, bRelativeURL?: boolean, bForceRefresh?: boolean, bAutoHideBusyIndicator?: boolean, overrideVersion?: string): Promise<SimpleResponse>;
|
|
19
19
|
getDirectURL(baseURL: string, params: any, bRelativeURL?: boolean): string;
|
|
20
20
|
buildParams(params: Record<string, any>): string;
|
|
21
21
|
private buildURL;
|
|
22
|
-
buildDirectURL(httpType:
|
|
22
|
+
buildDirectURL(httpType: JDHttpType, url: string, data: Record<string, any>): string;
|
|
23
23
|
}
|
|
24
24
|
//# sourceMappingURL=jdConnector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jdConnector.d.ts","sourceRoot":"","sources":["../../src/sdk/jdConnector.ts"],"names":[],"mappings":"AAIA,0BAAkB,UAAU;IAC3B,GAAG,IAAA;IACH,IAAI,IAAA;IACJ,GAAG,IAAA;IACH,MAAM,IAAA;CACN;AAED,qBAAa,cAAc;IACxB,IAAI,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;gBACP,IAAI,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM;IAKzC,OAAO;CAGR;AAED,qBAAa,WAAW;IACjB,kBAAkB,CAAC,GAAG,EAAC,MAAM,EAAE,OAAO,EAAC,GAAG,EAAE,MAAM,EAAC,GAAG,EAAE,iBAAiB,EAAE,OAAO,EAAE,aAAa,UAAO,EAAE,sBAAsB,UAAO,EAAE,eAAe,SAAK;IAI7J,mBAAmB,CAAC,GAAG,EAAC,MAAM,EAAE,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,GAAG,EAAE,iBAAiB,EAAC,OAAO,EAAE,sBAAsB,UAAO,EAAE,eAAe,SAAK;IAIrI,oBAAoB,CAAC,GAAG,EAAC,MAAM,EAAE,OAAO,EAAC,GAAG,EAAE,MAAM,EAAC,GAAG,EAAE,iBAAiB,EAAC,OAAO,EAAE,aAAa,UAAQ,EAAE,sBAAsB,UAAO,EAAE,eAAe,SAAK;IAG/J,qBAAqB,CAAC,GAAG,EAAC,MAAM,EAAE,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,GAAG,EAAE,iBAAiB,EAAC,OAAO,EAAE,sBAAsB,UAAO,EAAE,eAAe,SAAK;IAIvI,mBAAmB,CAAC,QAAQ,EAAC,
|
|
1
|
+
{"version":3,"file":"jdConnector.d.ts","sourceRoot":"","sources":["../../src/sdk/jdConnector.ts"],"names":[],"mappings":"AAIA,0BAAkB,UAAU;IAC3B,GAAG,IAAA;IACH,IAAI,IAAA;IACJ,GAAG,IAAA;IACH,MAAM,IAAA;CACN;AAED,qBAAa,cAAc;IACxB,IAAI,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;gBACP,IAAI,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM;IAKzC,OAAO;CAGR;AAED,qBAAa,WAAW;IACjB,kBAAkB,CAAC,GAAG,EAAC,MAAM,EAAE,OAAO,EAAC,GAAG,EAAE,MAAM,EAAC,GAAG,EAAE,iBAAiB,EAAE,OAAO,EAAE,aAAa,UAAO,EAAE,sBAAsB,UAAO,EAAE,eAAe,SAAK;IAI7J,mBAAmB,CAAC,GAAG,EAAC,MAAM,EAAE,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,GAAG,EAAE,iBAAiB,EAAC,OAAO,EAAE,sBAAsB,UAAO,EAAE,eAAe,SAAK;IAIrI,oBAAoB,CAAC,GAAG,EAAC,MAAM,EAAE,OAAO,EAAC,GAAG,EAAE,MAAM,EAAC,GAAG,EAAE,iBAAiB,EAAC,OAAO,EAAE,aAAa,UAAQ,EAAE,sBAAsB,UAAO,EAAE,eAAe,SAAK;IAG/J,qBAAqB,CAAC,GAAG,EAAC,MAAM,EAAE,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,GAAG,EAAE,iBAAiB,EAAC,OAAO,EAAE,sBAAsB,UAAO,EAAE,eAAe,SAAK;IAIvI,mBAAmB,CAAC,QAAQ,EAAC,UAAU,EAAE,GAAG,EAAC,MAAM,EAAE,MAAM,EAAC,GAAG,EAAE,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,GAAG,EAAE,iBAAiB,EAAC,OAAO,EAAE,YAAY,EAAC,OAAO,EAAE,YAAY,UAAO,EAAE,aAAa,UAAO,EAAE,sBAAsB,UAAO,EAAE,eAAe,SAAK;IAgD7O,YAAY,CAAC,OAAO,EAAC,MAAM,EAAE,MAAM,EAAC,GAAG,EAAE,YAAY,UAAQ;IAK7D,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM;IAqBhD,OAAO,CAAC,QAAQ;IAuBhB,cAAc,CAAC,QAAQ,EAAC,UAAU,EAAE,GAAG,EAAC,MAAM,EAAE,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAexE"}
|
package/dist/sdk/jdConnector.js
CHANGED
|
@@ -44,7 +44,7 @@ export class JDConnector {
|
|
|
44
44
|
return __awaiter(this, arguments, void 0, function* (httpType, url, params, headers, body, bShowErrorMessage, bBuildParams, bRelativeURL = true, bForceRefresh = true, bAutoHideBusyIndicator = true, overrideVersion = '') {
|
|
45
45
|
const finalURL = this.buildURL(httpType, url, params, true, bRelativeURL);
|
|
46
46
|
// console.log(bRelativeURL);
|
|
47
|
-
// console.log(finalURL);
|
|
47
|
+
// console.log(`Final URL: ${finalURL}`);
|
|
48
48
|
//Only for debugging purposes only
|
|
49
49
|
if (globalThis.bForceRefreshGetRequests) {
|
|
50
50
|
bForceRefresh = true;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import JDResource from "./jdResource";
|
|
2
|
-
export
|
|
1
|
+
import JDResource, { ConnectorInfo } from "./jdResource";
|
|
2
|
+
export declare class JDApplication extends JDResource {
|
|
3
3
|
appId: string;
|
|
4
4
|
appKey: string;
|
|
5
5
|
appSecret: string;
|
|
@@ -10,12 +10,12 @@ export default class JDApplication extends JDResource {
|
|
|
10
10
|
versionCode: number;
|
|
11
11
|
bundleCodeAndroid: number;
|
|
12
12
|
bundleCodeIos: number;
|
|
13
|
-
constructor(data
|
|
14
|
-
setData(data:
|
|
15
|
-
|
|
13
|
+
constructor(data?: Record<string, any>, connectorInfo?: ConnectorInfo);
|
|
14
|
+
setData(data: Record<string, any>): void;
|
|
15
|
+
getApplications(orderBy: string | undefined, order: string | undefined, pageIndex: number | undefined, countPerPage: number | undefined, fields: string | undefined, { isSandbox, isFeatured, }: {
|
|
16
16
|
isSandbox?: boolean | undefined;
|
|
17
17
|
isFeatured?: boolean | undefined;
|
|
18
18
|
}): Promise<import("../jdConnector").SimpleResponse>;
|
|
19
|
-
|
|
19
|
+
getInfo(id: string): Promise<import("../jdConnector").SimpleResponse>;
|
|
20
20
|
}
|
|
21
21
|
//# sourceMappingURL=jdApplication.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jdApplication.d.ts","sourceRoot":"","sources":["../../../src/sdk/models/jdApplication.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"jdApplication.d.ts","sourceRoot":"","sources":["../../../src/sdk/models/jdApplication.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,EAAE,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAEvD,qBAAa,aAAc,SAAQ,UAAU;IAC5C,KAAK,SAAM;IACX,MAAM,SAAM;IACZ,SAAS,SAAM;IACf,UAAU,EAAE,MAAM,CAAM;IACxB,IAAI,EAAE,MAAM,CAAM;IAClB,WAAW,SAAM;IACjB,OAAO,SAAM;IACb,WAAW,SAAK;IAChB,iBAAiB,SAAK;IACtB,aAAa,SAAK;gBAEN,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAAE,aAAa,GAAE,aAAyC;IAKpG,OAAO,CAAC,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAe1B,eAAe,CAAC,OAAO,oBAAe,EAAE,KAAK,oBAAS,EAAE,SAAS,oBAAI,EAAE,YAAY,oBAAK,EAAE,MAAM,oBAAK,EAAE,EAAC,SAAiB,EAAE,UAAkB,GAAE;;;KAAA;IAc/I,OAAO,CAAC,EAAE,EAAC,MAAM;CAGvB"}
|
|
@@ -8,10 +8,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { Utils } from "../utilities/utils";
|
|
11
|
-
import JDResource from "./jdResource";
|
|
12
|
-
export
|
|
13
|
-
constructor(data) {
|
|
14
|
-
super(
|
|
11
|
+
import JDResource, { ConnectorInfo } from "./jdResource";
|
|
12
|
+
export class JDApplication extends JDResource {
|
|
13
|
+
constructor(data = {}, connectorInfo = new ConnectorInfo("", "")) {
|
|
14
|
+
super(connectorInfo);
|
|
15
15
|
this.appId = '';
|
|
16
16
|
this.appKey = '';
|
|
17
17
|
this.appSecret = '';
|
|
@@ -37,9 +37,9 @@ export default class JDApplication extends JDResource {
|
|
|
37
37
|
this.bundleCodeAndroid = Utils.getInteger(data, 'bundle_code_android');
|
|
38
38
|
this.bundleCodeIos = Utils.getInteger(data, 'bundle_code_ios');
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
getApplications() {
|
|
41
41
|
return __awaiter(this, arguments, void 0, function* (orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '', { isSandbox = false, isFeatured = false, }) {
|
|
42
|
-
const params =
|
|
42
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
43
43
|
if (Utils.isset(isSandbox)) {
|
|
44
44
|
params['sandbox'] = isSandbox ? 'true' : 'false';
|
|
45
45
|
}
|
|
@@ -47,14 +47,12 @@ export default class JDApplication extends JDResource {
|
|
|
47
47
|
params['featured'] = isFeatured ? 'true' : 'false';
|
|
48
48
|
}
|
|
49
49
|
// console.log(params);
|
|
50
|
-
|
|
51
|
-
return response;
|
|
50
|
+
return yield this.getRelative('/applications', params);
|
|
52
51
|
});
|
|
53
52
|
}
|
|
54
|
-
|
|
53
|
+
getInfo(id) {
|
|
55
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
|
|
57
|
-
return response;
|
|
55
|
+
return yield this.getRelative(`/applications/${id}`, {});
|
|
58
56
|
});
|
|
59
57
|
}
|
|
60
58
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { SimpleResponse } from "../jdConnector";
|
|
2
|
+
export declare class ConnectorInfo {
|
|
3
|
+
appId: string;
|
|
4
|
+
token: string;
|
|
5
|
+
constructor(appId: string, token: string);
|
|
6
|
+
}
|
|
2
7
|
export default class JDResource {
|
|
3
8
|
myId: string;
|
|
4
9
|
slug: string;
|
|
@@ -9,6 +14,7 @@ export default class JDResource {
|
|
|
9
14
|
createdAt: Date;
|
|
10
15
|
updatedAt: Date;
|
|
11
16
|
placeholderIconURL: string;
|
|
17
|
+
connectorInfo: ConnectorInfo;
|
|
12
18
|
get localisedTitle(): string;
|
|
13
19
|
get localisedDescription(): string;
|
|
14
20
|
get titleEN(): string;
|
|
@@ -28,16 +34,17 @@ export default class JDResource {
|
|
|
28
34
|
get cdnBannerURL500(): string;
|
|
29
35
|
get cdnBannerURL800(): string;
|
|
30
36
|
getFacebookIconURL(fbId: string): string;
|
|
31
|
-
constructor(
|
|
32
|
-
setData(data:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
constructor(connectorInfo: ConnectorInfo);
|
|
38
|
+
setData(data: Record<string, any>): void;
|
|
39
|
+
getHashBody(remark?: string): Record<string, any>;
|
|
40
|
+
getDefaultHeaders(): Record<string, any>;
|
|
41
|
+
addDefaultParams(params: Record<string, any>): void;
|
|
42
|
+
getSortParameters(orderBy: string, order: string, pageIndex: number, countPerPage: number, fields: string): Record<string, any>;
|
|
37
43
|
static getFieldParameters(fields: string): Record<string, any>;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
getRelative(relativeUrl: string, params: Record<string, any>, bShowErrorToast?: boolean, bForceRefresh?: boolean, overrideVersion?: string): Promise<SimpleResponse>;
|
|
45
|
+
postRelative(relativeUrl: string, body: Record<string, any>, bShowErrorToast?: boolean, overrideVersion?: string): Promise<SimpleResponse>;
|
|
46
|
+
getDirect(directUrl: string, params: Record<string, any>, bShowErrorToast?: boolean, bForceRefresh?: boolean, overrideVersion?: string): Promise<SimpleResponse>;
|
|
47
|
+
postDirect(directUrl: string, body: Record<string, any>, bShowErrorToast?: boolean, overrideVersion?: string): Promise<SimpleResponse>;
|
|
48
|
+
checkUser(response: SimpleResponse): Promise<void>;
|
|
42
49
|
}
|
|
43
50
|
//# sourceMappingURL=jdResource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jdResource.d.ts","sourceRoot":"","sources":["../../../src/sdk/models/jdResource.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,cAAc,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"jdResource.d.ts","sourceRoot":"","sources":["../../../src/sdk/models/jdResource.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAI3D,qBAAa,aAAa;IACzB,KAAK,SAAM;IACX,KAAK,SAAM;gBACC,KAAK,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM;CAItC;AAED,MAAM,CAAC,OAAO,OAAO,UAAU;IAC9B,IAAI,SAAM;IACP,IAAI,SAAM;IACV,KAAK,SAAK;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAC7B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IACtC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IACjC,SAAS,EAAC,IAAI,CAAc;IAC5B,SAAS,EAAC,IAAI,CAAc;IAC5B,kBAAkB,SAAM;IAC3B,aAAa,EAAC,aAAa,CAA6B;IAQxD,IAAI,cAAc,IAAG,MAAM,CAAsE;IACjG,IAAI,oBAAoB,IAAG,MAAM,CAAkF;IACnH,IAAI,OAAO,IAAG,MAAM,CAA8C;IAClE,IAAI,OAAO,IAAG,MAAM,CAA6C;IACjE,IAAI,aAAa,IAAG,MAAM,CAAmD;IAC7E,IAAI,aAAa,IAAG,MAAM,CAAmD;IAE7E,OAAO,KAAK,OAAO,GAA6D;IAChF,OAAO,KAAK,UAAU,GAAiE;IACvF,OAAO,KAAK,UAAU,GAAiE;IAEvF,IAAI,UAAU,IAAG,MAAM,CAA4F;IACnH,IAAI,aAAa,IAAG,MAAM,CAAqG;IAC/H,IAAI,aAAa,IAAG,MAAM,CAAgG;IAE1H,OAAO,KAAK,SAAS,GAA+D;IACpF,OAAO,KAAK,YAAY,GAAmE;IAC3F,OAAO,KAAK,YAAY,GAAmE;IAE3F,IAAI,YAAY,IAAG,MAAM,CAAkG;IAC3H,IAAI,eAAe,IAAG,MAAM,CAA2G;IACvI,IAAI,eAAe,IAAG,MAAM,CAA2G;IACvI,kBAAkB,CAAC,IAAI,EAAC,MAAM;gBAElB,aAAa,EAAC,aAAa;IAIvC,OAAO,CAAC,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAiBhC,WAAW,CAAC,MAAM,SAAK;IAWvB,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAWxC,gBAAgB,CAAC,MAAM,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAI,IAAI;IAMnD,iBAAiB,CAAC,OAAO,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,EAAE,SAAS,EAAC,MAAM,EAAE,YAAY,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM;IA0BpG,MAAM,CAAC,kBAAkB,CAAC,MAAM,EAAC,MAAM;IAOjC,WAAW,CAAC,WAAW,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,eAAe,UAAO,EAAE,aAAa,UAAQ,EAAE,eAAe,SAAK;IAO/H,YAAY,CAAC,WAAW,EAAC,MAAM,EAAE,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAG,eAAe,UAAO,EAAE,eAAe,SAAK;IAQxG,SAAS,CAAC,SAAS,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAG,eAAe,UAAO,EAAE,aAAa,UAAQ,EAAE,eAAe,SAAK;IAK5H,UAAU,CAAC,SAAS,EAAC,MAAM,EAAE,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,eAAe,UAAO,EAAG,eAAe,SAAK;IAOpG,SAAS,CAAC,QAAQ,EAAC,cAAc;CAcvC"}
|
|
@@ -11,6 +11,14 @@ import { Utils } from "../utilities/utils";
|
|
|
11
11
|
import { DateUtils } from "../utilities/dateUtils";
|
|
12
12
|
import { CryptoUtils } from "../utilities/cryptoUtils";
|
|
13
13
|
import { JDConnector, SimpleResponse } from "../jdConnector";
|
|
14
|
+
export class ConnectorInfo {
|
|
15
|
+
constructor(appId, token) {
|
|
16
|
+
this.appId = '';
|
|
17
|
+
this.token = '';
|
|
18
|
+
this.appId = appId;
|
|
19
|
+
this.token = token;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
14
22
|
export default class JDResource {
|
|
15
23
|
// Properties
|
|
16
24
|
// localisedTitle:string = DPUtility.getStringFromField(this.title, 'en');
|
|
@@ -36,7 +44,7 @@ export default class JDResource {
|
|
|
36
44
|
get cdnBannerURL500() { return this.bannerURL800.includes('http') ? this.bannerURL500 : globalThis.cdnHost + this.bannerURL500; }
|
|
37
45
|
get cdnBannerURL800() { return this.bannerURL800.includes('http') ? this.bannerURL800 : globalThis.cdnHost + this.bannerURL800; }
|
|
38
46
|
getFacebookIconURL(fbId) { return 'https://graph.facebook.com/' + fbId + '/picture?type=square'; }
|
|
39
|
-
constructor(
|
|
47
|
+
constructor(connectorInfo) {
|
|
40
48
|
this.myId = '';
|
|
41
49
|
this.slug = '';
|
|
42
50
|
this.index = 0;
|
|
@@ -45,8 +53,9 @@ export default class JDResource {
|
|
|
45
53
|
this.images = {};
|
|
46
54
|
this.createdAt = new Date();
|
|
47
55
|
this.updatedAt = new Date();
|
|
48
|
-
this.placeholderIconURL = 'https://joydash-downloads.b-cdn.net/misc/banner-male-profile-x300.png';
|
|
49
56
|
this.placeholderIconURL = '';
|
|
57
|
+
this.connectorInfo = new ConnectorInfo("", "");
|
|
58
|
+
this.connectorInfo = connectorInfo;
|
|
50
59
|
}
|
|
51
60
|
setData(data) {
|
|
52
61
|
// console.log('Setting super constructor');
|
|
@@ -62,7 +71,7 @@ export default class JDResource {
|
|
|
62
71
|
// console.log(this.createdAt);
|
|
63
72
|
}
|
|
64
73
|
//Get default hash string with remark
|
|
65
|
-
|
|
74
|
+
getHashBody(remark = '') {
|
|
66
75
|
const body = {};
|
|
67
76
|
//Calculate hashes
|
|
68
77
|
const timestamp = DateUtils.getTimeStamp();
|
|
@@ -71,33 +80,38 @@ export default class JDResource {
|
|
|
71
80
|
return body;
|
|
72
81
|
}
|
|
73
82
|
// Other Utilities
|
|
74
|
-
|
|
75
|
-
// console.log(DPProfile.getAccessToken());
|
|
76
|
-
// console.log('Token:' + authToken.get());
|
|
83
|
+
getDefaultHeaders() {
|
|
77
84
|
const finalHeaders = {};
|
|
78
85
|
finalHeaders["Content-Type"] = 'application/json';
|
|
79
|
-
finalHeaders["app_id"] =
|
|
80
|
-
finalHeaders["
|
|
81
|
-
finalHeaders["x-auth-token"] = globalThis.xAuthToken;
|
|
86
|
+
finalHeaders["app_id"] = this.connectorInfo.appId;
|
|
87
|
+
finalHeaders["x-auth-token"] = this.connectorInfo.token;
|
|
82
88
|
finalHeaders["random_seed"] = DateUtils.getTimeStamp();
|
|
83
89
|
return finalHeaders;
|
|
84
90
|
}
|
|
85
91
|
//This is used to make a direct call supported on some APIs
|
|
86
|
-
|
|
87
|
-
params["app_id"] =
|
|
88
|
-
params["token"] =
|
|
92
|
+
addDefaultParams(params) {
|
|
93
|
+
params["app_id"] = this.connectorInfo.appId;
|
|
94
|
+
params["token"] = this.connectorInfo.token;
|
|
89
95
|
params["random_seed"] = Date.now();
|
|
90
96
|
}
|
|
91
|
-
|
|
97
|
+
getSortParameters(orderBy, order, pageIndex, countPerPage, fields) {
|
|
92
98
|
const params = { 'page_index': pageIndex, 'count_per_page': countPerPage, 'fields': fields };
|
|
93
99
|
if (Utils.isset(orderBy) && Utils.isset(order)) {
|
|
94
100
|
params['order_by'] = orderBy;
|
|
95
101
|
params['order'] = order;
|
|
96
102
|
}
|
|
97
|
-
if (pageIndex >= 0
|
|
103
|
+
if (pageIndex >= 0) {
|
|
98
104
|
params["page_index"] = pageIndex;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
params["page_index"] = 0;
|
|
108
|
+
}
|
|
109
|
+
if (countPerPage > 0) {
|
|
99
110
|
params["count_per_page"] = countPerPage;
|
|
100
111
|
}
|
|
112
|
+
else {
|
|
113
|
+
params["count_per_page"] = 10;
|
|
114
|
+
}
|
|
101
115
|
if (Utils.isset(fields)) {
|
|
102
116
|
params["fields"] = fields;
|
|
103
117
|
}
|
|
@@ -109,15 +123,15 @@ export default class JDResource {
|
|
|
109
123
|
return params;
|
|
110
124
|
}
|
|
111
125
|
// HTTP Calls Utilities
|
|
112
|
-
|
|
113
|
-
return __awaiter(this, arguments, void 0, function* (relativeUrl, params, bShowErrorToast = true, bForceRefresh = false, overrideVersion = ''
|
|
114
|
-
const finalHeaders = this.getDefaultHeaders(
|
|
126
|
+
getRelative(relativeUrl_1, params_1) {
|
|
127
|
+
return __awaiter(this, arguments, void 0, function* (relativeUrl, params, bShowErrorToast = true, bForceRefresh = false, overrideVersion = '') {
|
|
128
|
+
const finalHeaders = this.getDefaultHeaders();
|
|
115
129
|
const connector = new JDConnector();
|
|
116
130
|
const response = yield connector.httpGetRelativeAsync(relativeUrl, finalHeaders, params, bShowErrorToast, bForceRefresh, true, overrideVersion);
|
|
117
131
|
return new SimpleResponse(response.body, response.statusCode);
|
|
118
132
|
});
|
|
119
133
|
}
|
|
120
|
-
|
|
134
|
+
postRelative(relativeUrl_1, body_1) {
|
|
121
135
|
return __awaiter(this, arguments, void 0, function* (relativeUrl, body, bShowErrorToast = true, overrideVersion = '') {
|
|
122
136
|
const headers = this.getDefaultHeaders();
|
|
123
137
|
const connector = new JDConnector();
|
|
@@ -126,16 +140,32 @@ export default class JDResource {
|
|
|
126
140
|
});
|
|
127
141
|
}
|
|
128
142
|
// Direct Calls to the URL without using SDK
|
|
129
|
-
|
|
143
|
+
getDirect(directUrl_1, params_1) {
|
|
130
144
|
return __awaiter(this, arguments, void 0, function* (directUrl, params, bShowErrorToast = true, bForceRefresh = false, overrideVersion = '') {
|
|
131
145
|
const response = yield new JDConnector().httpGetDirectAsync(directUrl, {}, params, bShowErrorToast, true, bForceRefresh, overrideVersion);
|
|
132
146
|
return new SimpleResponse(response.body, response.statusCode);
|
|
133
147
|
});
|
|
134
148
|
}
|
|
135
|
-
|
|
149
|
+
postDirect(directUrl_1, body_1) {
|
|
136
150
|
return __awaiter(this, arguments, void 0, function* (directUrl, body, bShowErrorToast = true, overrideVersion = '') {
|
|
137
151
|
const response = yield new JDConnector().httpPostDirectAsync(directUrl, { 'Content-Type': 'application/json' }, body, bShowErrorToast, false, overrideVersion);
|
|
138
152
|
return new SimpleResponse(response.body, response.statusCode);
|
|
139
153
|
});
|
|
140
154
|
}
|
|
155
|
+
// Save the token and user information to globals if successful
|
|
156
|
+
// Since this is called from server-side, saving to global doesn't really matter
|
|
157
|
+
checkUser(response) {
|
|
158
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
159
|
+
if (response.statusCode == 200) {
|
|
160
|
+
// const dataRaw = Utils.stringToObject(response.body);
|
|
161
|
+
// const token = Utils.getString(dataRaw, "token");
|
|
162
|
+
// const dataUser = Utils.getObject(dataRaw, "user");
|
|
163
|
+
// Save to global variables and also in the session so that the user can keep the log in status
|
|
164
|
+
// Note: Do not set the JDUser info as it may lead to circular dependency
|
|
165
|
+
// globalThis.xAuthToken = token;
|
|
166
|
+
// globalThis.userData = dataUser;
|
|
167
|
+
// globalThis.userId = Utils.getString(dataUser, "_id");
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
141
171
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import JDResource, { ConnectorInfo } from "../../jdResource";
|
|
2
|
+
export declare class JDCity extends JDResource {
|
|
3
|
+
stateId: string;
|
|
4
|
+
state: Record<string, any>;
|
|
5
|
+
get localisedStateTitle(): string;
|
|
6
|
+
get stateTitleEN(): string;
|
|
7
|
+
get stateTitleMM(): string;
|
|
8
|
+
constructor(data?: Record<string, any>, connectorInfo?: ConnectorInfo);
|
|
9
|
+
setData(data: Record<string, any>): void;
|
|
10
|
+
getCities(orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
11
|
+
findCities(title: string, orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
12
|
+
getDistricts(stateId: string, orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
13
|
+
getInfo(id: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=jdCity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jdCity.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/geolocation/jdCity.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE3D,qBAAa,MAAO,SAAQ,UAAU;IACrC,OAAO,EAAC,MAAM,CAAM;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAEhC,IAAI,mBAAmB,IAAG,MAAM,CAAgF;IAChH,IAAI,YAAY,IAAG,MAAM,CAAuE;IAChG,IAAI,YAAY,IAAG,MAAM,CAAuE;gBAEpF,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAAE,aAAa,GAAE,aAAyC;IAKpG,OAAO,CAAC,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAM1B,SAAS,CAAC,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;IAK/F,UAAU,CAAC,KAAK,EAAC,MAAM,EAAE,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;IAK9G,YAAY,CAAC,OAAO,EAAC,MAAM,EAAE,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;IAKlH,OAAO,CAAC,EAAE,EAAC,MAAM;CAGvB"}
|
|
@@ -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, { ConnectorInfo } from "../../jdResource";
|
|
11
|
+
import { Utils } from "../../../utilities/utils";
|
|
12
|
+
export class JDCity extends JDResource {
|
|
13
|
+
get localisedStateTitle() { return globalThis.language == 'en' ? this.stateTitleEN : this.stateTitleMM; }
|
|
14
|
+
get stateTitleEN() { return Utils.getString(Utils.getObject(this.state, 'title'), 'en'); }
|
|
15
|
+
get stateTitleMM() { return Utils.getString(Utils.getObject(this.state, 'title'), 'mm'); }
|
|
16
|
+
constructor(data = {}, connectorInfo = new ConnectorInfo("", "")) {
|
|
17
|
+
super(connectorInfo);
|
|
18
|
+
this.stateId = "";
|
|
19
|
+
this.state = {};
|
|
20
|
+
this.setData(data);
|
|
21
|
+
}
|
|
22
|
+
setData(data) {
|
|
23
|
+
super.setData(data);
|
|
24
|
+
this.stateId = Utils.getString(data, "state_id");
|
|
25
|
+
this.state = Utils.getObject(data, "state");
|
|
26
|
+
}
|
|
27
|
+
getCities() {
|
|
28
|
+
return __awaiter(this, arguments, void 0, function* (orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
29
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
30
|
+
return yield this.getRelative('/modules/geolocation/cities', params);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
findCities(title_1) {
|
|
34
|
+
return __awaiter(this, arguments, void 0, function* (title, orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
35
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
36
|
+
return yield this.getRelative('/modules/geolocation/cities/find', params);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
getDistricts(stateId_1) {
|
|
40
|
+
return __awaiter(this, arguments, void 0, function* (stateId, orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
41
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
42
|
+
return yield this.getRelative(`/modules/geolocation/cities/${stateId}/districts`, params);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
getInfo(id) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
return yield this.getRelative(`/modules/geolocation/states/${id}`, {});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import JDResource, { ConnectorInfo } from "../../jdResource";
|
|
2
|
+
export declare class JDCountry extends JDResource {
|
|
3
|
+
constructor(data?: Record<string, any>, connectorInfo?: ConnectorInfo);
|
|
4
|
+
setData(data: Record<string, any>): void;
|
|
5
|
+
getCountries(orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
6
|
+
findCountries(title: string, orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
7
|
+
getStates(countryId: string, orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
8
|
+
getInfo(id: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=jdCountry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jdCountry.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/geolocation/jdCountry.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE3D,qBAAa,SAAU,SAAQ,UAAU;gBAC5B,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAAE,aAAa,GAAE,aAAyC;IAKpG,OAAO,CAAC,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAI1B,YAAY,CAAC,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;IAKlG,aAAa,CAAC,KAAK,EAAC,MAAM,EAAE,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;IAKjH,SAAS,CAAC,SAAS,EAAC,MAAM,EAAE,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;IAKjH,OAAO,CAAC,EAAE,EAAC,MAAM;CAGvB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
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, { ConnectorInfo } from "../../jdResource";
|
|
11
|
+
export class JDCountry extends JDResource {
|
|
12
|
+
constructor(data = {}, connectorInfo = new ConnectorInfo("", "")) {
|
|
13
|
+
super(connectorInfo);
|
|
14
|
+
this.setData(data);
|
|
15
|
+
}
|
|
16
|
+
setData(data) {
|
|
17
|
+
super.setData(data);
|
|
18
|
+
}
|
|
19
|
+
getCountries() {
|
|
20
|
+
return __awaiter(this, arguments, void 0, function* (orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
21
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
22
|
+
return yield this.getRelative('/modules/geolocation/countries', params);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
findCountries(title_1) {
|
|
26
|
+
return __awaiter(this, arguments, void 0, function* (title, orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
27
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
28
|
+
return yield this.getRelative('/modules/geolocation/countries/find', params);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
getStates(countryId_1) {
|
|
32
|
+
return __awaiter(this, arguments, void 0, function* (countryId, orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
33
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
34
|
+
return yield this.getRelative(`/modules/geolocation/countries/${countryId}/states`, params);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
getInfo(id) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
return yield this.getRelative(`/modules/geolocation/countries/${id}`, {});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import JDResource, { ConnectorInfo } from "../../jdResource";
|
|
2
|
+
export declare class JDDistrict extends JDResource {
|
|
3
|
+
cityId: string;
|
|
4
|
+
city: Record<string, any>;
|
|
5
|
+
get localisedCityTitle(): string;
|
|
6
|
+
get cityTitleEN(): string;
|
|
7
|
+
get cityTitleMM(): string;
|
|
8
|
+
constructor(data?: Record<string, any>, connectorInfo?: ConnectorInfo);
|
|
9
|
+
setData(data: Record<string, any>): void;
|
|
10
|
+
getDistricts(orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
11
|
+
findDistricts(title: string, orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
12
|
+
getInfo(id: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=jdDistrict.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jdDistrict.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/geolocation/jdDistrict.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE3D,qBAAa,UAAW,SAAQ,UAAU;IACzC,MAAM,EAAC,MAAM,CAAM;IACnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAE/B,IAAI,kBAAkB,IAAG,MAAM,CAA8E;IAC7G,IAAI,WAAW,IAAG,MAAM,CAAsE;IAC9F,IAAI,WAAW,IAAG,MAAM,CAAsE;gBAElF,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAAE,aAAa,GAAE,aAAyC;IAInG,OAAO,CAAC,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAM3B,YAAY,CAAC,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;IAKlG,aAAa,CAAC,KAAK,EAAC,MAAM,EAAE,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;IAKjH,OAAO,CAAC,EAAE,EAAC,MAAM;CAGvB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
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, { ConnectorInfo } from "../../jdResource";
|
|
11
|
+
import { Utils } from "../../../utilities/utils";
|
|
12
|
+
export class JDDistrict extends JDResource {
|
|
13
|
+
get localisedCityTitle() { return globalThis.language == 'en' ? this.cityTitleEN : this.cityTitleMM; }
|
|
14
|
+
get cityTitleEN() { return Utils.getString(Utils.getObject(this.city, 'title'), 'en'); }
|
|
15
|
+
get cityTitleMM() { return Utils.getString(Utils.getObject(this.city, 'title'), 'mm'); }
|
|
16
|
+
constructor(data = {}, connectorInfo = new ConnectorInfo("", "")) {
|
|
17
|
+
super(connectorInfo);
|
|
18
|
+
this.cityId = "";
|
|
19
|
+
this.city = {};
|
|
20
|
+
this.setData(data);
|
|
21
|
+
}
|
|
22
|
+
setData(data) {
|
|
23
|
+
super.setData(data);
|
|
24
|
+
this.cityId = Utils.getString(data, "city_id");
|
|
25
|
+
this.city = Utils.getObject(data, "city");
|
|
26
|
+
}
|
|
27
|
+
getDistricts() {
|
|
28
|
+
return __awaiter(this, arguments, void 0, function* (orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
29
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
30
|
+
return yield this.getRelative('/modules/geolocation/districts', params);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
findDistricts(title_1) {
|
|
34
|
+
return __awaiter(this, arguments, void 0, function* (title, orderBy = 'updated_at', order = 'desc', pageIndex = 0, countPerPage = 20, fields = '') {
|
|
35
|
+
const params = this.getSortParameters(orderBy, order, pageIndex, countPerPage, fields);
|
|
36
|
+
return yield this.getRelative('/modules/geolocation/districts/find', params);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
getInfo(id) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
return yield this.getRelative(`/modules/geolocation/districts/${id}`, {});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import JDResource, { ConnectorInfo } from "../../jdResource";
|
|
2
|
+
export declare class JDState extends JDResource {
|
|
3
|
+
countryId: string;
|
|
4
|
+
country: Record<string, any>;
|
|
5
|
+
get localisedCountryTitle(): string;
|
|
6
|
+
get countryTitleEN(): string;
|
|
7
|
+
get countryTitleMM(): string;
|
|
8
|
+
constructor(data?: Record<string, any>, connectorInfo?: ConnectorInfo);
|
|
9
|
+
setData(data: Record<string, any>): void;
|
|
10
|
+
getStates(orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
11
|
+
findStates(title: string, orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
12
|
+
getCities(stateId: string, orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
13
|
+
getInfo(id: string): Promise<import("../../../jdConnector").SimpleResponse>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=jdState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jdState.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/models/modules/geolocation/jdState.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,EAAE,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE3D,qBAAa,OAAQ,SAAQ,UAAU;IACtC,SAAS,EAAC,MAAM,CAAM;IACtB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAElC,IAAI,qBAAqB,IAAG,MAAM,CAAoF;IACtH,IAAI,cAAc,IAAG,MAAM,CAAyE;IACpG,IAAI,cAAc,IAAG,MAAM,CAAyE;gBAExF,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAAE,aAAa,GAAE,aAAyC;IAKpG,OAAO,CAAC,IAAI,EAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAM1B,SAAS,CAAC,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;IAK/F,UAAU,CAAC,KAAK,EAAC,MAAM,EAAE,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;IAK9G,SAAS,CAAC,OAAO,EAAC,MAAM,EAAE,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;IAK/G,OAAO,CAAC,EAAE,EAAC,MAAM;CAGvB"}
|