@longvansoftware/storefront-js-client 2.6.1 → 2.6.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.
- package/dist/config/config.d.ts +2 -0
- package/dist/config/config.js +4 -2
- package/dist/src/lib/SDK.d.ts +4 -1
- package/dist/src/lib/SDK.js +5 -0
- package/dist/src/lib/portal/index.d.ts +1 -0
- package/dist/src/lib/portal/index.js +15 -0
- package/dist/src/lib/zca/index.d.ts +12 -0
- package/dist/src/lib/zca/index.js +41 -0
- package/package.json +1 -1
package/dist/config/config.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export declare const environmentEndpoints: {
|
|
|
21
21
|
accounting: string;
|
|
22
22
|
omnigateway: string;
|
|
23
23
|
authorization: string;
|
|
24
|
+
zca: string;
|
|
24
25
|
};
|
|
25
26
|
live: {
|
|
26
27
|
product: string;
|
|
@@ -44,5 +45,6 @@ export declare const environmentEndpoints: {
|
|
|
44
45
|
accounting: string;
|
|
45
46
|
omnigateway: string;
|
|
46
47
|
authorization: string;
|
|
48
|
+
zca: string;
|
|
47
49
|
};
|
|
48
50
|
};
|
package/dist/config/config.js
CHANGED
|
@@ -23,7 +23,8 @@ exports.environmentEndpoints = {
|
|
|
23
23
|
getImage: "https://s3-img-gw.longvan.net/img/omnichannel",
|
|
24
24
|
accounting: "https://api-gateway.dev.longvan.vn/accounting-service",
|
|
25
25
|
omnigateway: "https://omni-gateway.dev.longvan.vn/omni-gateway/v1",
|
|
26
|
-
authorization: "https://id.dev.longvan.vn/authorization/public"
|
|
26
|
+
authorization: "https://id.dev.longvan.vn/authorization/public",
|
|
27
|
+
zca: "https://zca.dev.longvan.vn",
|
|
27
28
|
},
|
|
28
29
|
live: {
|
|
29
30
|
product: "https://product-service.longvan.vn/product-service/graphql",
|
|
@@ -46,6 +47,7 @@ exports.environmentEndpoints = {
|
|
|
46
47
|
getImage: "https://s3-img-gw.longvan.net/img/omnichannel",
|
|
47
48
|
accounting: "https://api-gateway.dev.longvan.vn/accounting-service",
|
|
48
49
|
omnigateway: "https://omni-gateway.longvan.vn/omni-gateway/v1",
|
|
49
|
-
authorization: "https://id.longvan.vn/authorization/public"
|
|
50
|
+
authorization: "https://id.longvan.vn/authorization/public",
|
|
51
|
+
zca: "https://zca.longvan.vn",
|
|
50
52
|
},
|
|
51
53
|
};
|
package/dist/src/lib/SDK.d.ts
CHANGED
|
@@ -17,8 +17,9 @@ import { PortalService } from "./portal";
|
|
|
17
17
|
import { UploadService } from "./upload";
|
|
18
18
|
import { GetImageService } from "./getImage";
|
|
19
19
|
import { AccountingService } from "./accounting";
|
|
20
|
-
import { OmnigatewayService } from
|
|
20
|
+
import { OmnigatewayService } from "./omnigateway";
|
|
21
21
|
import { AuthorizationService } from "./token";
|
|
22
|
+
import { ZcaService } from "./zca";
|
|
22
23
|
export interface Endpoints {
|
|
23
24
|
product: string;
|
|
24
25
|
crm: string;
|
|
@@ -41,6 +42,7 @@ export interface Endpoints {
|
|
|
41
42
|
accounting: string;
|
|
42
43
|
omnigateway: string;
|
|
43
44
|
authorization: string;
|
|
45
|
+
zca: string;
|
|
44
46
|
}
|
|
45
47
|
export declare class SDK {
|
|
46
48
|
orgId: string;
|
|
@@ -67,6 +69,7 @@ export declare class SDK {
|
|
|
67
69
|
accounting: AccountingService;
|
|
68
70
|
omnigateway: OmnigatewayService;
|
|
69
71
|
authorization: AuthorizationService;
|
|
72
|
+
zca: ZcaService;
|
|
70
73
|
token: string | null;
|
|
71
74
|
constructor(orgId: string, storeId: string, environment: "dev" | "live");
|
|
72
75
|
setToken(token: string): void;
|
package/dist/src/lib/SDK.js
CHANGED
|
@@ -24,6 +24,7 @@ const getImage_1 = require("./getImage");
|
|
|
24
24
|
const accounting_1 = require("./accounting");
|
|
25
25
|
const omnigateway_1 = require("./omnigateway");
|
|
26
26
|
const token_1 = require("./token");
|
|
27
|
+
const zca_1 = require("./zca");
|
|
27
28
|
class SDK {
|
|
28
29
|
constructor(orgId, storeId, environment) {
|
|
29
30
|
this.orgId = orgId;
|
|
@@ -52,6 +53,7 @@ class SDK {
|
|
|
52
53
|
this.accounting = new accounting_1.AccountingService(endpoints.accounting, orgId, storeId);
|
|
53
54
|
this.omnigateway = new omnigateway_1.OmnigatewayService(endpoints.omnigateway, orgId, storeId);
|
|
54
55
|
this.authorization = new token_1.AuthorizationService(endpoints.authorization, orgId, storeId);
|
|
56
|
+
this.zca = new zca_1.ZcaService(endpoints.zca, orgId, storeId);
|
|
55
57
|
// Initialize other services here
|
|
56
58
|
}
|
|
57
59
|
setToken(token) {
|
|
@@ -79,6 +81,7 @@ class SDK {
|
|
|
79
81
|
this.accounting.setToken(token);
|
|
80
82
|
this.omnigateway.setToken(token);
|
|
81
83
|
this.authorization.setToken(token);
|
|
84
|
+
this.zca.setToken(token);
|
|
82
85
|
}
|
|
83
86
|
// các module export từ serviceSDK.ts set storeId vào serviceSDK.ts
|
|
84
87
|
// src/service.ts
|
|
@@ -103,6 +106,7 @@ class SDK {
|
|
|
103
106
|
this.accounting.setStoreId(storeId);
|
|
104
107
|
this.omnigateway.setStoreId(storeId);
|
|
105
108
|
this.auth.setStoreId(storeId);
|
|
109
|
+
this.zca.setStoreId(storeId);
|
|
106
110
|
// Set storeId for other services here
|
|
107
111
|
}
|
|
108
112
|
setOrgId(orgId) {
|
|
@@ -126,6 +130,7 @@ class SDK {
|
|
|
126
130
|
this.accounting.setOrgId(orgId);
|
|
127
131
|
this.omnigateway.setOrgId(orgId);
|
|
128
132
|
this.auth.setOrgId(orgId);
|
|
133
|
+
this.zca.setOrgId(orgId);
|
|
129
134
|
}
|
|
130
135
|
}
|
|
131
136
|
exports.SDK = SDK;
|
|
@@ -9,4 +9,5 @@ export declare class PortalService extends Service {
|
|
|
9
9
|
imageProduct(parentId: string, parentType: string, width?: number, height?: number): string;
|
|
10
10
|
imagesProduct(parentId: string, parentType: string, width?: number, height?: number): string;
|
|
11
11
|
completeOrder(orderId: string, byUser: string): Promise<any>;
|
|
12
|
+
pushMessage(message: any): Promise<any>;
|
|
12
13
|
}
|
|
@@ -98,5 +98,20 @@ class PortalService extends serviceSDK_1.Service {
|
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
|
+
pushMessage(message) {
|
|
102
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
const endpoint = `/dynamic-collection/public/v2/webhook/push_message`;
|
|
104
|
+
const method = "POST";
|
|
105
|
+
console.log("endpoint", endpoint);
|
|
106
|
+
const data = message;
|
|
107
|
+
try {
|
|
108
|
+
const response = yield this.restApiCallWithNoToken(endpoint, method, message);
|
|
109
|
+
return response;
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
throw error;
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
101
116
|
}
|
|
102
117
|
exports.PortalService = PortalService;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Service } from "../serviceSDK";
|
|
2
|
+
export declare class ZcaService extends Service {
|
|
3
|
+
/**
|
|
4
|
+
* Constructs a new OrderService instance.
|
|
5
|
+
* @param endpoint - The endpoint URL for the service.
|
|
6
|
+
* @param orgId - The organization ID.
|
|
7
|
+
* @param storeId - The store ID.
|
|
8
|
+
*/
|
|
9
|
+
constructor(endpoint: string, orgId: string, storeId: string);
|
|
10
|
+
setToken(token: string): void;
|
|
11
|
+
loginQR(): Promise<any>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ZcaService = void 0;
|
|
13
|
+
const serviceSDK_1 = require("../serviceSDK");
|
|
14
|
+
class ZcaService extends serviceSDK_1.Service {
|
|
15
|
+
/**
|
|
16
|
+
* Constructs a new OrderService instance.
|
|
17
|
+
* @param endpoint - The endpoint URL for the service.
|
|
18
|
+
* @param orgId - The organization ID.
|
|
19
|
+
* @param storeId - The store ID.
|
|
20
|
+
*/
|
|
21
|
+
constructor(endpoint, orgId, storeId) {
|
|
22
|
+
super(endpoint, orgId, storeId);
|
|
23
|
+
}
|
|
24
|
+
setToken(token) {
|
|
25
|
+
this.token = token;
|
|
26
|
+
}
|
|
27
|
+
loginQR() {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const endpoint = `/login`;
|
|
30
|
+
const method = "GET";
|
|
31
|
+
try {
|
|
32
|
+
const response = yield this.restApiCallWithNoHeader(endpoint, method);
|
|
33
|
+
return response;
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
throw error;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.ZcaService = ZcaService;
|