@longvansoftware/storefront-js-client 1.5.8 → 1.5.9
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.js
CHANGED
|
@@ -9,7 +9,6 @@ exports.environmentEndpoints = {
|
|
|
9
9
|
order: "https://storefront.dev.longvan.vn/v2",
|
|
10
10
|
user: "https://user.dev.longvan.vn/user-gateway/graphql",
|
|
11
11
|
payment: "https://portal.dev.longvan.vn/invoice-gateway/graphql",
|
|
12
|
-
// service: "https://local.huyvd.xyz/service-api/graphql",
|
|
13
12
|
service: "https://portal.dev.longvan.vn/service-api/graphql",
|
|
14
13
|
warehouse: "https://portal.dev.longvan.vn/facility-api/public-facility/1.0.0",
|
|
15
14
|
computing: "https://api-gateway.dev.longvan.vn/computing-service/graphql",
|
|
@@ -23,8 +22,8 @@ exports.environmentEndpoints = {
|
|
|
23
22
|
user: "https://user.longvan.vn/user-gateway/graphql",
|
|
24
23
|
payment: "https://portal.longvan.vn/invoice-gateway/graphql",
|
|
25
24
|
service: "https://portal.longvan.vn/service-api/graphql",
|
|
26
|
-
warehouse: "https://portal.
|
|
25
|
+
warehouse: "https://portal.longvan.vn/facility-api/public-facility/1.0.0",
|
|
27
26
|
computing: "https://api-gateway.longvan.vn/computing-service/graphql",
|
|
28
|
-
campaign: "https://crm.
|
|
27
|
+
campaign: "https://crm.longvan.vn/campaign-gateway/graphql",
|
|
29
28
|
},
|
|
30
29
|
};
|
package/dist/src/lib/SDK.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface Endpoints {
|
|
|
23
23
|
export declare class SDK {
|
|
24
24
|
orgId: string;
|
|
25
25
|
storeId: string;
|
|
26
|
-
|
|
26
|
+
environment: "dev" | "live";
|
|
27
27
|
product: ProductService;
|
|
28
28
|
auth: AuthService;
|
|
29
29
|
order: OrderService;
|
|
@@ -35,7 +35,7 @@ export declare class SDK {
|
|
|
35
35
|
computing: ComputingService;
|
|
36
36
|
campaign: CampaignService;
|
|
37
37
|
token: string | null;
|
|
38
|
-
constructor(orgId: string, storeId: string,
|
|
38
|
+
constructor(orgId: string, storeId: string, environment: "dev" | "live");
|
|
39
39
|
setToken(token: string): void;
|
|
40
40
|
setStoreId(storeId: string): void;
|
|
41
41
|
}
|
package/dist/src/lib/SDK.js
CHANGED
|
@@ -8,21 +8,18 @@ const index_3 = require("../lib/order/index");
|
|
|
8
8
|
const index_4 = require("./service/index");
|
|
9
9
|
const index_5 = require("../lib/user/index");
|
|
10
10
|
const config_1 = require("../../config/config");
|
|
11
|
-
const helpers_1 = require("../utils/helpers");
|
|
12
11
|
const index_6 = require("../lib/payment/index");
|
|
13
12
|
const index_7 = require("../lib/crm/index");
|
|
14
13
|
const index_8 = require("../lib/warehouse/index");
|
|
15
14
|
const index_9 = require("../lib/computing/index");
|
|
16
15
|
const campaign_1 = require("./campaign");
|
|
17
16
|
class SDK {
|
|
18
|
-
constructor(orgId, storeId,
|
|
17
|
+
constructor(orgId, storeId, environment) {
|
|
19
18
|
this.orgId = orgId;
|
|
20
19
|
this.storeId = storeId;
|
|
21
|
-
this.
|
|
20
|
+
this.environment = environment;
|
|
22
21
|
this.token = null;
|
|
23
|
-
|
|
24
|
-
const endpoints = config_1.environmentEndpoints.dev;
|
|
25
|
-
console.log("🚀 ~ SDK ~ endpoints:", endpoints.computing);
|
|
22
|
+
const endpoints = config_1.environmentEndpoints[environment];
|
|
26
23
|
this.product = new index_1.ProductService(endpoints.product, orgId, storeId);
|
|
27
24
|
this.auth = new index_2.AuthService(endpoints.auth, orgId, storeId);
|
|
28
25
|
this.order = new index_3.OrderService(endpoints.order, orgId, storeId);
|
|
@@ -96,7 +96,7 @@ class Service {
|
|
|
96
96
|
restApiCallWithToken(path, method, data, headers) {
|
|
97
97
|
return __awaiter(this, void 0, void 0, function* () {
|
|
98
98
|
try {
|
|
99
|
-
const modifiedHeaders = Object.assign(Object.assign({}, headers), { PartnerId: this.orgId, Authorization: "Bearer " + this.token });
|
|
99
|
+
const modifiedHeaders = Object.assign(Object.assign({}, headers), { PartnerId: this.orgId, Authorization: "Bearer " + this.token, "X-Ecomos-Access-Token": this.token, "Partner-Id": this.orgId });
|
|
100
100
|
const response = yield (0, axios_1.default)({
|
|
101
101
|
url: this.endpoint + path,
|
|
102
102
|
method,
|
|
@@ -140,8 +140,8 @@ class Service {
|
|
|
140
140
|
method: "POST",
|
|
141
141
|
headers: {
|
|
142
142
|
"Content-Type": "application/json",
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
PartnerId: this.orgId,
|
|
144
|
+
Authorization: "Bearer " + this.token,
|
|
145
145
|
},
|
|
146
146
|
},
|
|
147
147
|
});
|
|
@@ -168,8 +168,8 @@ class Service {
|
|
|
168
168
|
method: "POST",
|
|
169
169
|
headers: {
|
|
170
170
|
"Content-Type": "application/json",
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
PartnerId: this.orgId,
|
|
172
|
+
Authorization: "Bearer " + this.token,
|
|
173
173
|
},
|
|
174
174
|
},
|
|
175
175
|
});
|