@longvansoftware/storefront-js-client 1.8.2 → 1.8.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/config/config.d.ts +2 -0
- package/dist/config/config.js +2 -0
- package/dist/src/lib/SDK.d.ts +3 -0
- package/dist/src/lib/SDK.js +3 -0
- package/dist/src/lib/serviceSDK.d.ts +1 -0
- package/dist/src/lib/serviceSDK.js +23 -0
- package/dist/src/lib/shareZalo/index.d.ts +5 -0
- package/dist/src/lib/shareZalo/index.js +32 -0
- package/package.json +1 -1
package/dist/config/config.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare const environmentEndpoints: {
|
|
|
14
14
|
paymentV2: string;
|
|
15
15
|
warehouseV2: string;
|
|
16
16
|
deepLinkVietQr: string;
|
|
17
|
+
shareZalo: string;
|
|
17
18
|
};
|
|
18
19
|
live: {
|
|
19
20
|
product: string;
|
|
@@ -30,5 +31,6 @@ export declare const environmentEndpoints: {
|
|
|
30
31
|
paymentV2: string;
|
|
31
32
|
warehouseV2: string;
|
|
32
33
|
deepLinkVietQr: string;
|
|
34
|
+
shareZalo: string;
|
|
33
35
|
};
|
|
34
36
|
};
|
package/dist/config/config.js
CHANGED
|
@@ -17,6 +17,7 @@ exports.environmentEndpoints = {
|
|
|
17
17
|
paymentV2: "https://payment.dev.longvan.vn/graphql",
|
|
18
18
|
warehouseV2: "https://portal.dev.longvan.vn/facility-api",
|
|
19
19
|
deepLinkVietQr: "https://api.vietqr.io/v2",
|
|
20
|
+
shareZalo: "https://com-hub.longvan.vn/com-hub/v1/web-hook/zalo/zns/62661ed100adf430d79fb9e5"
|
|
20
21
|
},
|
|
21
22
|
live: {
|
|
22
23
|
product: "https://product-service.longvan.vn/product-service/graphql",
|
|
@@ -33,5 +34,6 @@ exports.environmentEndpoints = {
|
|
|
33
34
|
paymentV2: "https://payment-staging.longvan.vn/graphql",
|
|
34
35
|
warehouseV2: "https://portal.longvan.vn/facility-api/public-facility/1.0.0/product-inventory",
|
|
35
36
|
deepLinkVietQr: "https://api.vietqr.io/v2",
|
|
37
|
+
shareZalo: "https://com-hub.longvan.vn/com-hub/v1/web-hook/zalo/zns/62661ed100adf430d79fb9e5"
|
|
36
38
|
},
|
|
37
39
|
};
|
package/dist/src/lib/SDK.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { ImageService } from "./image";
|
|
|
12
12
|
import { PaymentServiceV2 } from "./paymentV2";
|
|
13
13
|
import { WarehouseServiceV2 } from "./warehouseV2";
|
|
14
14
|
import { DeepLinkVietQrService } from "./deepLinkVietQr";
|
|
15
|
+
import { ShareZaloService } from "./shareZalo";
|
|
15
16
|
export interface Endpoints {
|
|
16
17
|
product: string;
|
|
17
18
|
crm: string;
|
|
@@ -27,6 +28,7 @@ export interface Endpoints {
|
|
|
27
28
|
paymentV2: string;
|
|
28
29
|
warehouseV2: string;
|
|
29
30
|
deepLinkVietQr: string;
|
|
31
|
+
shareZalo: string;
|
|
30
32
|
}
|
|
31
33
|
export declare class SDK {
|
|
32
34
|
orgId: string;
|
|
@@ -46,6 +48,7 @@ export declare class SDK {
|
|
|
46
48
|
paymentV2: PaymentServiceV2;
|
|
47
49
|
warehouseV2: WarehouseServiceV2;
|
|
48
50
|
deepLinkVietQr: DeepLinkVietQrService;
|
|
51
|
+
shareZalo: ShareZaloService;
|
|
49
52
|
token: string | null;
|
|
50
53
|
constructor(orgId: string, storeId: string, environment: "dev" | "live");
|
|
51
54
|
setToken(token: string): void;
|
package/dist/src/lib/SDK.js
CHANGED
|
@@ -17,6 +17,7 @@ const image_1 = require("./image");
|
|
|
17
17
|
const paymentV2_1 = require("./paymentV2");
|
|
18
18
|
const warehouseV2_1 = require("./warehouseV2");
|
|
19
19
|
const deepLinkVietQr_1 = require("./deepLinkVietQr");
|
|
20
|
+
const shareZalo_1 = require("./shareZalo");
|
|
20
21
|
class SDK {
|
|
21
22
|
constructor(orgId, storeId, environment) {
|
|
22
23
|
this.orgId = orgId;
|
|
@@ -38,6 +39,7 @@ class SDK {
|
|
|
38
39
|
this.paymentV2 = new paymentV2_1.PaymentServiceV2(endpoints.paymentV2, orgId, storeId);
|
|
39
40
|
this.warehouseV2 = new warehouseV2_1.WarehouseServiceV2(endpoints.warehouseV2, orgId, storeId);
|
|
40
41
|
this.deepLinkVietQr = new deepLinkVietQr_1.DeepLinkVietQrService(endpoints.deepLinkVietQr, orgId, storeId);
|
|
42
|
+
this.shareZalo = new shareZalo_1.ShareZaloService(endpoints.shareZalo, orgId, storeId);
|
|
41
43
|
// Initialize other services here
|
|
42
44
|
}
|
|
43
45
|
setToken(token) {
|
|
@@ -57,6 +59,7 @@ class SDK {
|
|
|
57
59
|
this.warehouseV2.setToken(token);
|
|
58
60
|
this.deepLinkVietQr.setToken(token);
|
|
59
61
|
this.campaign.setToken(token);
|
|
62
|
+
// this.shareZalo.setToken(token)
|
|
60
63
|
// Set token for other services here
|
|
61
64
|
}
|
|
62
65
|
// các module export từ serviceSDK.ts set storeId vào serviceSDK.ts
|
|
@@ -15,6 +15,7 @@ export declare class Service {
|
|
|
15
15
|
protected graphqlMutation(mutation: DocumentNode, variables: any): Promise<any>;
|
|
16
16
|
protected restApiCallWithToken(path: string, method: "GET" | "POST" | "PUT" | "DELETE", data?: any, headers?: any): Promise<any>;
|
|
17
17
|
protected restApiCallWithNoToken(path: string, method: "GET" | "POST" | "PUT" | "DELETE", data?: any, headers?: any): Promise<any>;
|
|
18
|
+
protected restApiCallWithNoHeader(path: string, method: "GET" | "POST" | "PUT" | "DELETE", data?: any, headers?: any): Promise<any>;
|
|
18
19
|
protected graphqlQueryV2(query: DocumentNode, variables: any): Promise<any>;
|
|
19
20
|
protected graphqlMutationV2(mutation: DocumentNode, variables: any): Promise<any>;
|
|
20
21
|
protected graphqlQueryV3(query: DocumentNode, variables: any): Promise<any>;
|
|
@@ -142,6 +142,29 @@ class Service {
|
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
|
+
// call api no header
|
|
146
|
+
restApiCallWithNoHeader(path, method, data, headers) {
|
|
147
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
try {
|
|
149
|
+
// const modifiedHeaders = {
|
|
150
|
+
// ...headers,
|
|
151
|
+
// Partnerid: this.orgId,
|
|
152
|
+
// };
|
|
153
|
+
const response = yield (0, axios_1.default)({
|
|
154
|
+
url: this.endpoint + path,
|
|
155
|
+
method,
|
|
156
|
+
data,
|
|
157
|
+
// headers: modifiedHeaders,
|
|
158
|
+
});
|
|
159
|
+
return response.data;
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
console.log(`Error in restApiCallWithNoToken: ${error}`);
|
|
163
|
+
throw error;
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
//
|
|
145
168
|
graphqlQueryV2(query, variables) {
|
|
146
169
|
return __awaiter(this, void 0, void 0, function* () {
|
|
147
170
|
try {
|
|
@@ -0,0 +1,32 @@
|
|
|
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.ShareZaloService = void 0;
|
|
13
|
+
const serviceSDK_1 = require("../serviceSDK");
|
|
14
|
+
class ShareZaloService extends serviceSDK_1.Service {
|
|
15
|
+
constructor(endpoint, orgId, storeId) {
|
|
16
|
+
super(endpoint, orgId, storeId);
|
|
17
|
+
}
|
|
18
|
+
shareOrder(dataRequet) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
const endpoint = ``;
|
|
21
|
+
const method = "POST";
|
|
22
|
+
try {
|
|
23
|
+
const response = yield this.restApiCallWithNoHeader(endpoint, method, dataRequet);
|
|
24
|
+
return response;
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.ShareZaloService = ShareZaloService;
|