jd_platform_sdk 0.0.2 → 0.0.3

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.
@@ -12,11 +12,11 @@ export default class JDConfig {
12
12
  static getAPIHost() {
13
13
  const prConfig = JDConfig.instance;
14
14
  if (globalThis.bLocalHost) {
15
- return globalThis.apiEndPointLocalhost + globalThis.apiVersion;
15
+ return globalThis.apiEndPointLocalhost + "/" + globalThis.apiVersion;
16
16
  }
17
17
  else {
18
18
  if (globalThis.bSandboxApi) {
19
- return globalThis.apiEndPointSandbox + globalThis.apiVersion;
19
+ return globalThis.apiEndPointSandbox + "/" + globalThis.apiVersion;
20
20
  }
21
21
  else {
22
22
  return globalThis.apiEndPoint + globalThis.apiVersion;
@@ -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,E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1, bShowErrorMessage_1, bBuildParams_1) {
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
- // console.log(bRelativeURL);
47
- // console.log(finalURL);
46
+ // console.log(bRelativeURL);
47
+ // console.log(finalURL);
48
48
  //Only for debugging purposes only
49
49
  if (globalThis.bForceRefreshGetRequests) {
50
50
  bForceRefresh = true;
@@ -91,7 +91,7 @@ export class JDConnector {
91
91
  // Build a query parameters from a Map type to URL encoded string like ?event=test&type=001
92
92
  buildParams(params) {
93
93
  let finalParams = "";
94
- if (Utils.isset(params)) {
94
+ if (Utils.isNotEmpty(params)) {
95
95
  let index = 0;
96
96
  for (const key in params) {
97
97
  const val = params[key];
@@ -104,6 +104,7 @@ export class JDConnector {
104
104
  index++;
105
105
  }
106
106
  }
107
+ // console.log(`Final params: ${finalParams}`)
107
108
  return finalParams;
108
109
  }
109
110
  //bBuildParams - Whether or not the parameters will be embedded in URL
@@ -116,20 +117,21 @@ export class JDConnector {
116
117
  }
117
118
  // //Add hashtable form values for GET request
118
119
  if (httpType == 0 /* JDHttpType.GET */) {
119
- if (!params.isEmpty() && bBuildParams) {
120
+ if (Utils.isNotEmpty(params) && bBuildParams) {
120
121
  url += this.buildParams(params);
121
122
  }
122
123
  }
123
124
  // Replace all instances of "\r\n" with "\n"
124
- url = url.replace(/\r\n/g, "\n");
125
- // Encode the URL and replace "#" with "%23"
126
- url = encodeURI(url).replace(/#/g, "%23");
125
+ // url = url.replace(/\r\n/g, "\n");
126
+ //
127
+ // // Encode the URL and replace "#" with "%23"
128
+ // url = encodeURI(url).replace(/#/g, "%23");
127
129
  return url;
128
130
  }
129
131
  buildDirectURL(httpType, url, data) {
130
132
  //Add hashtable form values for GET request
131
133
  if (httpType == 0 /* JDHttpType.GET */) {
132
- if (!data.isEmpty())
134
+ if (Utils.isNotEmpty(data))
133
135
  url += this.buildParams(data);
134
136
  }
135
137
  // Replace all instances of "\r\n" with "\n"
@@ -1,6 +1,6 @@
1
1
  export declare class JDSdk {
2
2
  static initialiseApp(applicationId: string, appId: string, appKey: string, appSecret: string): void;
3
- static updateConfigs(apiEndPoint: string, apiEndPointSandbox: string, apiEndPointLocalhost: string, bLocalHost: boolean, bSandboxApi: boolean): void;
3
+ static updateConfigs(apiVersion: string, apiEndPoint: string, apiEndPointSandbox: string, apiEndPointLocalhost: string, bLocalHost: boolean, bSandboxApi: boolean): void;
4
4
  static updateUserId(userId: string): void;
5
5
  }
6
6
  //# sourceMappingURL=jdSdk.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jdSdk.d.ts","sourceRoot":"","sources":["../../src/sdk/jdSdk.ts"],"names":[],"mappings":"AAAA,qBAAa,KAAK;IACjB,MAAM,CAAC,aAAa,CAAC,aAAa,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,EAAE,SAAS,EAAC,MAAM;IAOxF,MAAM,CAAC,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO;IAQ7I,MAAM,CAAC,YAAY,CAAC,MAAM,EAAC,MAAM;CAGjC"}
1
+ {"version":3,"file":"jdSdk.d.ts","sourceRoot":"","sources":["../../src/sdk/jdSdk.ts"],"names":[],"mappings":"AAAA,qBAAa,KAAK;IACjB,MAAM,CAAC,aAAa,CAAC,aAAa,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,EAAE,SAAS,EAAC,MAAM;IAOxF,MAAM,CAAC,aAAa,CAAC,UAAU,EAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO;IAShK,MAAM,CAAC,YAAY,CAAC,MAAM,EAAC,MAAM;CAGjC"}
package/dist/sdk/jdSdk.js CHANGED
@@ -5,7 +5,8 @@ export class JDSdk {
5
5
  globalThis.appKey = appKey;
6
6
  globalThis.appSecret = appSecret;
7
7
  }
8
- static updateConfigs(apiEndPoint, apiEndPointSandbox, apiEndPointLocalhost, bLocalHost, bSandboxApi) {
8
+ static updateConfigs(apiVersion, apiEndPoint, apiEndPointSandbox, apiEndPointLocalhost, bLocalHost, bSandboxApi) {
9
+ globalThis.apiVersion = apiVersion;
9
10
  globalThis.apiEndPoint = apiEndPoint;
10
11
  globalThis.apiEndPointSandbox = apiEndPointSandbox;
11
12
  globalThis.apiEndPointLocalhost = apiEndPointLocalhost;
@@ -3,9 +3,9 @@ export default class JDResource {
3
3
  myId: string;
4
4
  slug: string;
5
5
  index: number;
6
- title: object;
7
- description: object;
8
- images: object;
6
+ title: Record<string, any>;
7
+ description: Record<string, any>;
8
+ images: Record<string, any>;
9
9
  createdAt: Date;
10
10
  updatedAt: Date;
11
11
  placeholderIconURL: string;
@@ -30,11 +30,11 @@ export default class JDResource {
30
30
  getFacebookIconURL(fbId: string): string;
31
31
  constructor(data: Record<string, any>);
32
32
  setData(data: object): void;
33
- static getHashBody(remark?: string): Promise<Record<string, any>>;
33
+ static getHashBody(remark?: string): Record<string, any>;
34
34
  static getDefaultHeaders(headers?: {}): Record<string, any>;
35
- static addDefaultParams(params: any): Promise<void>;
36
- static getSortParameters(orderBy: string, order: string, pageIndex: number, countPerPage: number, fields: string): Promise<Record<string, any>>;
37
- static getFieldParameters(fields: string): Promise<Record<string, any>>;
35
+ static addDefaultParams(params: any): void;
36
+ static getSortParameters(orderBy: string, order: string, pageIndex: number, countPerPage: number, fields: string): Record<string, any>;
37
+ static getFieldParameters(fields: string): Record<string, any>;
38
38
  static getRelative(relativeUrl: string, params: object, bShowErrorToast?: boolean, bForceRefresh?: boolean, overrideVersion?: string, headers?: {}): Promise<SimpleResponse>;
39
39
  static postRelative(relativeUrl: string, body: object, bShowErrorToast?: boolean, overrideVersion?: string): Promise<SimpleResponse>;
40
40
  static getDirect(directUrl: string, params: object, bShowErrorToast?: boolean, bForceRefresh?: boolean, overrideVersion?: string): Promise<SimpleResponse>;
@@ -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;AAE3D,MAAM,CAAC,OAAO,OAAO,UAAU;IAC9B,IAAI,SAAM;IACP,IAAI,SAAM;IACV,KAAK,SAAK;IACb,KAAK,EAAE,MAAM,CAAM;IAChB,WAAW,EAAE,MAAM,CAAM;IACzB,MAAM,EAAE,MAAM,CAAM;IACpB,SAAS,EAAC,IAAI,CAAc;IAC5B,SAAS,EAAC,IAAI,CAAc;IAC5B,kBAAkB,SAA2E;IAQhG,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,eAA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kB3G,MAAM,CAAC,kBAAkB,CAAC,MAAM,EAAC,MAAM;WAO1B,WAAW,CAAC,WAAW,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,EAAE,eAAe,UAAO,EAAE,aAAa,UAAQ,EAAE,eAAe,SAAK,EAAE,OAAO,KAAK;WAOhI,YAAY,CAAC,WAAW,EAAC,MAAM,EAAE,IAAI,EAAC,MAAM,EAAG,eAAe,UAAO,EAAE,eAAe,SAAK;WAQ3F,SAAS,CAAC,SAAS,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,EAAG,eAAe,UAAO,EAAE,aAAa,UAAQ,EAAE,eAAe,SAAK;WAK/G,UAAU,CAAC,SAAS,EAAC,MAAM,EAAE,IAAI,EAAC,MAAM,EAAE,eAAe,UAAO,EAAG,eAAe,SAAK;CAYpG"}
@@ -62,15 +62,13 @@ export default class JDResource {
62
62
  // console.log(this.createdAt);
63
63
  }
64
64
  //Get default hash string with remark
65
- static getHashBody() {
66
- return __awaiter(this, arguments, void 0, function* (remark = '') {
67
- const body = {};
68
- //Calculate hashes
69
- const timestamp = DateUtils.getTimeStamp();
70
- body['timestamp'] = timestamp;
71
- body['hash_before'] = CryptoUtils.generateBeforeHashString([timestamp, remark]);
72
- return body;
73
- });
65
+ static getHashBody(remark = '') {
66
+ const body = {};
67
+ //Calculate hashes
68
+ const timestamp = DateUtils.getTimeStamp();
69
+ body['timestamp'] = timestamp;
70
+ body['hash_before'] = CryptoUtils.generateBeforeHashString([timestamp, remark]);
71
+ return body;
74
72
  }
75
73
  // Other Utilities
76
74
  static getDefaultHeaders(headers = {}) {
@@ -86,35 +84,29 @@ export default class JDResource {
86
84
  }
87
85
  //This is used to make a direct call supported on some APIs
88
86
  static addDefaultParams(params) {
89
- return __awaiter(this, void 0, void 0, function* () {
90
- params["app_id"] = globalThis.appId;
91
- params["token"] = globalThis.xAuthToken;
92
- params["random_seed"] = Date.now();
93
- });
87
+ params["app_id"] = globalThis.appId;
88
+ params["token"] = globalThis.xAuthToken;
89
+ params["random_seed"] = Date.now();
94
90
  }
95
91
  static getSortParameters(orderBy, order, pageIndex, countPerPage, fields) {
96
- return __awaiter(this, void 0, void 0, function* () {
97
- const params = { 'page_index': pageIndex, 'count_per_page': countPerPage, 'fields': fields };
98
- if (Utils.isset(orderBy) && Utils.isset(order)) {
99
- params['order_by'] = orderBy;
100
- params['order'] = order;
101
- }
102
- if (pageIndex >= 0 && countPerPage > 0) {
103
- params["page_index"] = pageIndex;
104
- params["count_per_page"] = countPerPage;
105
- }
106
- if (Utils.isset(fields)) {
107
- params["fields"] = fields;
108
- }
109
- return params;
110
- });
92
+ const params = { 'page_index': pageIndex, 'count_per_page': countPerPage, 'fields': fields };
93
+ if (Utils.isset(orderBy) && Utils.isset(order)) {
94
+ params['order_by'] = orderBy;
95
+ params['order'] = order;
96
+ }
97
+ if (pageIndex >= 0 && countPerPage > 0) {
98
+ params["page_index"] = pageIndex;
99
+ params["count_per_page"] = countPerPage;
100
+ }
101
+ if (Utils.isset(fields)) {
102
+ params["fields"] = fields;
103
+ }
104
+ return params;
111
105
  }
112
106
  static getFieldParameters(fields) {
113
- return __awaiter(this, void 0, void 0, function* () {
114
- const params = {};
115
- params["fields"] = fields;
116
- return params;
117
- });
107
+ const params = {};
108
+ params["fields"] = fields;
109
+ return params;
118
110
  }
119
111
  // HTTP Calls Utilities
120
112
  static getRelative(relativeUrl_1, params_1) {
@@ -1,5 +1,27 @@
1
1
  import JDResource from "../../jdResource";
2
2
  export declare class JDKtvShop extends JDResource {
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;
3
25
  constructor(data: object);
4
26
  setData(data: object): void;
5
27
  static getKtvShops(isRecommended?: boolean, orderBy?: string, order?: string, pageIndex?: number, countPerPage?: number, fields?: string): Promise<import("../../../jdConnector").SimpleResponse>;
@@ -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;gBAC5B,IAAI,EAAC,MAAM;IAKvB,OAAO,CAAC,IAAI,EAAC,MAAM;WAGN,WAAW,CAAC,aAAa,UAAQ,EAAE,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;WAWxH,OAAO,CAAC,EAAE,EAAC,MAAM;CAI9B"}
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;IAKvB,OAAO,CAAC,IAAI,EAAC,MAAM;WAoBN,WAAW,CAAC,aAAa,UAAQ,EAAE,OAAO,SAAe,EAAE,KAAK,SAAS,EAAE,SAAS,SAAI,EAAE,YAAY,SAAK,EAAE,MAAM,SAAK;WAWxH,OAAO,CAAC,EAAE,EAAC,MAAM;CAI9B"}
@@ -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 = '') {
@@ -24,13 +62,13 @@ export class JDKtvShop extends JDResource {
24
62
  params['recommended'] = isRecommended ? 'true' : 'false';
25
63
  }
26
64
  // console.log(params);
27
- const response = yield JDResource.getRelative('/applications', params);
65
+ const response = yield JDResource.getRelative('/modules/karaoke/ktv_shops', params);
28
66
  return response;
29
67
  });
30
68
  }
31
69
  static getInfo(id) {
32
70
  return __awaiter(this, void 0, void 0, function* () {
33
- const response = yield JDResource.getRelative(`/applications/${id}`, {});
71
+ const response = yield JDResource.getRelative(`/modules/karaoke/ktv_shops/${id}`, {});
34
72
  return response;
35
73
  });
36
74
  }
@@ -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;IAInE,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,SAAI,GAAG,MAAM;IAItE,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,SAAM,GAAG,MAAM;IAInE,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAIpD,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAI/E,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM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AM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO;IAKpD,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE;IAKvC,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAM7C,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAKxC,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAU,GAAG,MAAM;IAKtE,MAAM,CAAC,YAAY,CAAC,MAAM,GAAE,MAAU,GAAG,MAAM;IAU/C,MAAM,CAAC,oBAAoB,CAAC,MAAM,GAAE,MAAW,GAAG,MAAM;IAUxD,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG1C"}
@@ -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) {
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "jd_platform_sdk",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
+ "type": "module",
4
5
  "main": "dist/index.js",
5
6
  "types": "dist/index.d.ts",
6
7
  "scripts": {
@@ -21,11 +22,16 @@
21
22
  "license": "MIT",
22
23
  "description": "Collection of utilities classes used in the projects",
23
24
  "devDependencies": {
25
+ "@sveltejs/vite-plugin-svelte": "^4.0.0",
26
+ "@testing-library/jest-dom": "^6.6.3",
27
+ "@testing-library/svelte": "^5.2.4",
24
28
  "@types/crypto-js": "^4.2.2",
25
29
  "@types/jest": "^29.5.14",
26
30
  "jest": "^29.7.0",
31
+ "jsdom": "^25.0.1",
27
32
  "ts-jest": "^29.2.5",
28
- "typescript": "^5.6.3"
33
+ "typescript": "^5.6.3",
34
+ "vitest": "^2.1.4"
29
35
  },
30
36
  "dependencies": {
31
37
  "crypto-js": "^4.2.0"
package/readme.md CHANGED
@@ -27,6 +27,11 @@ npm install --save-dev @types/crypto-js
27
27
  }
28
28
  ````
29
29
 
30
+ ### Unit Tests
31
+ ````
32
+ npx vitest
33
+ ````
34
+
30
35
  ### Linking project
31
36
  ````
32
37
  cd /path/to/my-utils-package
package/dist/globals.d.ts DELETED
@@ -1,7 +0,0 @@
1
- export {};
2
- declare global {
3
- let curApplicationId: string;
4
- let curAppKey: string;
5
- let curAppSecret: string;
6
- }
7
- //# sourceMappingURL=globals.d.ts.map
@@ -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,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=extensions.d.ts.map
@@ -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 {};
@@ -1,5 +0,0 @@
1
- export declare class CryptoUtility {
2
- static generateBeforeHashString(paramsArray: any): any;
3
- static generateHash(strMessage: string, secret: string): any;
4
- }
5
- //# sourceMappingURL=crypto_utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crypto_utils.d.ts","sourceRoot":"","sources":["../../../src/sdk/utilities/crypto_utils.ts"],"names":[],"mappings":"AAIA,qBAAa,aAAa;IAEtB,MAAM,CAAC,wBAAwB,CAAC,WAAW,EAAC,GAAG;IAqB/C,MAAM,CAAC,YAAY,CAAC,UAAU,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM;CAGvD"}
@@ -1,26 +0,0 @@
1
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2
- // @ts-ignore
3
- import hmacSha256 from 'crypto-js/hmac-sha256';
4
- export class CryptoUtility {
5
- // Generate hash string to sign to communicate with the server to allow from this client only
6
- static generateBeforeHashString(paramsArray) {
7
- const curUserId = globalThis.curUserId;
8
- const curApplicationId = globalThis.curApplicationId;
9
- const curAppSecret = globalThis.curAppSecret;
10
- const userId = curUserId.get();
11
- let strBeforeHash = curApplicationId.get() + userId;
12
- const appSecret = curAppSecret.get();
13
- // console.log(`Player ID: ${playerId}`);
14
- for (const param of paramsArray) {
15
- strBeforeHash += param;
16
- }
17
- // console.log(`Cur Application Id: ${curApplicationId.get()}`);
18
- // console.log(`Cur User Id: ${userId}`);
19
- // console.log(`Before Hash: ${strBeforeHash}`);
20
- // console.log(`App Secret: ${appSecret}`);
21
- return hmacSha256(strBeforeHash, appSecret).toString();
22
- }
23
- static generateHash(strMessage, secret) {
24
- return hmacSha256(strMessage, secret).toString();
25
- }
26
- }
@@ -1,3 +0,0 @@
1
- export declare function capitalize(text: string): string;
2
- export declare function lowercase(text: string): string;
3
- //# sourceMappingURL=stringUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stringUtils.d.ts","sourceRoot":"","sources":["../src/stringUtils.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C"}
@@ -1,6 +0,0 @@
1
- export function capitalize(text) {
2
- return text.charAt(0).toUpperCase() + text.slice(1);
3
- }
4
- export function lowercase(text) {
5
- return text.toLowerCase();
6
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=unit_tests.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unit_tests.d.ts","sourceRoot":"","sources":["../src/unit_tests.ts"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
1
- //Testing functions
2
- import { lowercase } from "./sdk/utilities/stringUtils";
3
- console.log(lowercase("Testing lowercase"));
4
- let strTest = "";
5
- console.log(`isset: ${strTest.isset()})`);
6
- strTest = "Now with value";
7
- console.log(`isset: ${strTest.isset()})`);