@longvansoftware/service-js-client 2.7.0 → 2.7.2
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/src/graphql/campaign/queries.d.ts +13 -11
- package/dist/src/graphql/campaign/queries.js +39 -111
- package/dist/src/graphql/crm_camping/queries.js +17 -59
- package/dist/src/graphql/marketplace/mutations.d.ts +3 -0
- package/dist/src/graphql/marketplace/mutations.js +54 -0
- package/dist/src/graphql/marketplace/queries.d.ts +2 -0
- package/dist/src/graphql/marketplace/queries.js +42 -0
- package/dist/src/graphql/paymentV2/mutations.d.ts +1 -0
- package/dist/src/graphql/paymentV2/mutations.js +15 -1
- package/dist/src/graphql/paymentV2/queries.d.ts +2 -0
- package/dist/src/graphql/paymentV2/queries.js +58 -1
- package/dist/src/graphql/storefont/mutation.d.ts +0 -0
- package/dist/src/graphql/storefont/mutation.js +1 -0
- package/dist/src/graphql/storefont/queries.d.ts +2 -0
- package/dist/src/graphql/storefont/queries.js +46 -0
- package/dist/src/graphql/tag/mutations.d.ts +2 -0
- package/dist/src/graphql/tag/mutations.js +44 -0
- package/dist/src/graphql/tag/queries.d.ts +1 -0
- package/dist/src/graphql/tag/queries.js +20 -0
- package/dist/src/lib/campaign/index.d.ts +1 -0
- package/dist/src/lib/campaign/index.js +69 -12
- package/dist/src/lib/marketplace/index.d.ts +9 -0
- package/dist/src/lib/marketplace/index.js +106 -0
- package/dist/src/lib/paymentV2/index.d.ts +10 -0
- package/dist/src/lib/paymentV2/index.js +39 -0
- package/dist/src/lib/portal/index.d.ts +3 -0
- package/dist/src/lib/portal/index.js +50 -0
- package/dist/src/lib/storefont/index.d.ts +6 -0
- package/dist/src/lib/storefont/index.js +51 -0
- package/dist/src/lib/tag/index.d.ts +7 -0
- package/dist/src/lib/tag/index.js +61 -0
- package/package.json +1 -1
- package/dist/src/lib/service.d.ts +0 -14
- package/dist/src/lib/service.js +0 -101
- package/dist/src/utils/build-field-string.d.ts +0 -1
- package/dist/src/utils/build-field-string.js +0 -16
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REMOVE_TAG_TO_TAG_GROUP = exports.ADD_TAG_TO_TAG_GROUP = void 0;
|
|
4
|
+
const graphql_tag_1 = require("graphql-tag");
|
|
5
|
+
exports.ADD_TAG_TO_TAG_GROUP = (0, graphql_tag_1.gql) `
|
|
6
|
+
mutation AddTagToTagGroup(
|
|
7
|
+
$resourceId: String!
|
|
8
|
+
$resourceType: String!
|
|
9
|
+
$tagId: String!
|
|
10
|
+
$tagGroupId: String
|
|
11
|
+
$addedBy: String!
|
|
12
|
+
) {
|
|
13
|
+
addTagToTagGroup(
|
|
14
|
+
resourceId: $resourceId
|
|
15
|
+
resourceType: $resourceType
|
|
16
|
+
tagId: $tagId
|
|
17
|
+
tagGroupId: $tagGroupId
|
|
18
|
+
addedBy: $addedBy
|
|
19
|
+
) {
|
|
20
|
+
code
|
|
21
|
+
message
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
exports.REMOVE_TAG_TO_TAG_GROUP = (0, graphql_tag_1.gql) `
|
|
26
|
+
mutation RemoveTagToTagGroup(
|
|
27
|
+
$resourceId: String!
|
|
28
|
+
$resourceType: String!
|
|
29
|
+
$tagId: String!
|
|
30
|
+
$tagGroupId: String
|
|
31
|
+
$updateBy: String!
|
|
32
|
+
) {
|
|
33
|
+
removeTagToTagGroup(
|
|
34
|
+
resourceId: $resourceId
|
|
35
|
+
resourceType: $resourceType
|
|
36
|
+
tagId: $tagId
|
|
37
|
+
tagGroupId: $tagGroupId
|
|
38
|
+
updateBy: $updateBy
|
|
39
|
+
) {
|
|
40
|
+
code
|
|
41
|
+
message
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GET_RESULT_TAG: import("graphql").DocumentNode;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GET_RESULT_TAG = void 0;
|
|
4
|
+
const graphql_tag_1 = require("graphql-tag");
|
|
5
|
+
exports.GET_RESULT_TAG = (0, graphql_tag_1.gql) `
|
|
6
|
+
query GetResultTag($resourceId: String!, $resourceType: String!) {
|
|
7
|
+
getResultTag(resourceId: $resourceId, resourceType: $resourceType) {
|
|
8
|
+
id
|
|
9
|
+
title
|
|
10
|
+
items {
|
|
11
|
+
id
|
|
12
|
+
title
|
|
13
|
+
items {
|
|
14
|
+
id
|
|
15
|
+
title
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
@@ -19,4 +19,5 @@ export declare class CampaignService extends Service {
|
|
|
19
19
|
searchProductGiftPromotionResponse(productIds: string[], campaignActionId: string): Promise<any>;
|
|
20
20
|
getCampaign(id: string): Promise<any>;
|
|
21
21
|
searchProductPricePromotionResponse(campaignId: string, campaignActionId: string, statusActive: string): Promise<any>;
|
|
22
|
+
voucherForUserRequest(orderId: string, customerId?: string, paymentMethodId?: string, shippingCompanyId?: string, pageNumber?: number, pageSize?: number, fields?: string[]): Promise<any>;
|
|
22
23
|
}
|
|
@@ -30,7 +30,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
30
30
|
partyId: this.orgId,
|
|
31
31
|
productStoreId: this.storeId,
|
|
32
32
|
customerId,
|
|
33
|
-
campaignActionType
|
|
33
|
+
campaignActionType
|
|
34
34
|
};
|
|
35
35
|
try {
|
|
36
36
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -54,7 +54,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
54
54
|
customerId,
|
|
55
55
|
excludeExpired,
|
|
56
56
|
pageNumber,
|
|
57
|
-
pageSize
|
|
57
|
+
pageSize
|
|
58
58
|
};
|
|
59
59
|
try {
|
|
60
60
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -73,7 +73,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
73
73
|
partyId: this.orgId,
|
|
74
74
|
productStoreId: this.storeId,
|
|
75
75
|
customerId,
|
|
76
|
-
voucherCode
|
|
76
|
+
voucherCode
|
|
77
77
|
};
|
|
78
78
|
try {
|
|
79
79
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -92,7 +92,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
92
92
|
partyId: this.orgId,
|
|
93
93
|
productStoreId: this.storeId,
|
|
94
94
|
campaignActionType,
|
|
95
|
-
customerId
|
|
95
|
+
customerId
|
|
96
96
|
};
|
|
97
97
|
try {
|
|
98
98
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -110,7 +110,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
110
110
|
partyId: this.orgId,
|
|
111
111
|
productStoreId: this.storeId,
|
|
112
112
|
productId,
|
|
113
|
-
productPrice
|
|
113
|
+
productPrice
|
|
114
114
|
};
|
|
115
115
|
try {
|
|
116
116
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -131,7 +131,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
131
131
|
campaignActionId,
|
|
132
132
|
customerId,
|
|
133
133
|
excludeExpired,
|
|
134
|
-
isPageAble
|
|
134
|
+
isPageAble
|
|
135
135
|
};
|
|
136
136
|
try {
|
|
137
137
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -149,7 +149,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
149
149
|
partyId: this.orgId,
|
|
150
150
|
voucherCode,
|
|
151
151
|
userId,
|
|
152
|
-
affiliateId
|
|
152
|
+
affiliateId
|
|
153
153
|
};
|
|
154
154
|
try {
|
|
155
155
|
const response = yield this.graphqlMutation(query, variables);
|
|
@@ -169,7 +169,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
169
169
|
campaignId: campaignId,
|
|
170
170
|
campaignActionId: campaignActionId,
|
|
171
171
|
excludeExpired: true,
|
|
172
|
-
isBirthday: isBirthday
|
|
172
|
+
isBirthday: isBirthday
|
|
173
173
|
};
|
|
174
174
|
try {
|
|
175
175
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -184,7 +184,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
184
184
|
return __awaiter(this, void 0, void 0, function* () {
|
|
185
185
|
const query = queries_1.GET_CAMPAIGN_ACTION_BY_ID;
|
|
186
186
|
const variables = {
|
|
187
|
-
id
|
|
187
|
+
id
|
|
188
188
|
};
|
|
189
189
|
try {
|
|
190
190
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -203,7 +203,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
203
203
|
storeId: this.storeId,
|
|
204
204
|
productIds: productIds,
|
|
205
205
|
campaignActionId: campaignActionId,
|
|
206
|
-
sort: { asc: true, key: "createdStamp" }
|
|
206
|
+
sort: { asc: true, key: "createdStamp" }
|
|
207
207
|
};
|
|
208
208
|
try {
|
|
209
209
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -218,7 +218,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
218
218
|
return __awaiter(this, void 0, void 0, function* () {
|
|
219
219
|
const query = queries_1.GET_CAMPAIGN;
|
|
220
220
|
const variables = {
|
|
221
|
-
id
|
|
221
|
+
id
|
|
222
222
|
};
|
|
223
223
|
try {
|
|
224
224
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -237,7 +237,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
237
237
|
campaignId,
|
|
238
238
|
campaignActionId,
|
|
239
239
|
statusActive,
|
|
240
|
-
sort: { asc: true, key: "productId" }
|
|
240
|
+
sort: { asc: true, key: "productId" }
|
|
241
241
|
};
|
|
242
242
|
try {
|
|
243
243
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -248,5 +248,62 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
248
248
|
}
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
|
+
voucherForUserRequest(orderId_1) {
|
|
252
|
+
return __awaiter(this, arguments, void 0, function* (orderId, customerId = "", paymentMethodId, shippingCompanyId, pageNumber = 0, pageSize = 20, fields = [
|
|
253
|
+
`content {
|
|
254
|
+
id
|
|
255
|
+
voucherCode
|
|
256
|
+
isBirthday
|
|
257
|
+
discountAmount
|
|
258
|
+
discountPercent
|
|
259
|
+
usageLimitPerVoucher
|
|
260
|
+
numberOfTimeUsed
|
|
261
|
+
maximumDiscount
|
|
262
|
+
maximumDiscountType
|
|
263
|
+
memberLevel
|
|
264
|
+
affiliateId
|
|
265
|
+
description
|
|
266
|
+
usageLimitType
|
|
267
|
+
minimumSpend
|
|
268
|
+
maximumSpend
|
|
269
|
+
expiryDate
|
|
270
|
+
isUsable
|
|
271
|
+
unusableReasons
|
|
272
|
+
remainingAmount
|
|
273
|
+
discountType
|
|
274
|
+
discountValue
|
|
275
|
+
ownerPartyId
|
|
276
|
+
rewardType
|
|
277
|
+
voucherType
|
|
278
|
+
}`,
|
|
279
|
+
"total",
|
|
280
|
+
"pageNumber",
|
|
281
|
+
"pageSize",
|
|
282
|
+
"totalPages",
|
|
283
|
+
"numberOfElements",
|
|
284
|
+
"first",
|
|
285
|
+
"last"
|
|
286
|
+
]) {
|
|
287
|
+
const query = (0, queries_1.GET_VOUCHER_FOR_USER)(fields);
|
|
288
|
+
const variables = {
|
|
289
|
+
voucherForUserRequest: {
|
|
290
|
+
orderId,
|
|
291
|
+
customerId,
|
|
292
|
+
storeId: this.storeId,
|
|
293
|
+
paymentMethodId,
|
|
294
|
+
shippingCompanyId,
|
|
295
|
+
pageNumber,
|
|
296
|
+
pageSize
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
try {
|
|
300
|
+
const res = yield this.graphqlQuery(query, variables);
|
|
301
|
+
return res.getVouchersForUser;
|
|
302
|
+
}
|
|
303
|
+
catch (error) {
|
|
304
|
+
throw error;
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
}
|
|
251
308
|
}
|
|
252
309
|
exports.CampaignService = CampaignService;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Service } from "../serviceSDK";
|
|
2
|
+
export declare class MarketPlaceService extends Service {
|
|
3
|
+
constructor(endpoint: string, orgId: string, storeId: string);
|
|
4
|
+
createTag(name: string, slug: string, createdBy: string): Promise<any>;
|
|
5
|
+
searchTag(keyword: string, currentPage: number, maxResult: number): Promise<any>;
|
|
6
|
+
getTagsByProductId(productId: string): Promise<any>;
|
|
7
|
+
removeProductTag(productId: string, tagId: string, updatedBy: string, tagGroupId?: string): Promise<any>;
|
|
8
|
+
addProductTag(productId: string, tagId: string, createBy: string, tagGroupId?: string): Promise<any>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
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.MarketPlaceService = void 0;
|
|
13
|
+
const serviceSDK_1 = require("../serviceSDK");
|
|
14
|
+
const queries_1 = require("../../graphql/marketplace/queries");
|
|
15
|
+
const mutations_1 = require("../../graphql/marketplace/mutations");
|
|
16
|
+
class MarketPlaceService extends serviceSDK_1.Service {
|
|
17
|
+
constructor(endpoint, orgId, storeId) {
|
|
18
|
+
super(endpoint, orgId, storeId);
|
|
19
|
+
}
|
|
20
|
+
createTag(name, slug, createdBy) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const mutation = mutations_1.CREATE_TAG;
|
|
23
|
+
const variables = {
|
|
24
|
+
name,
|
|
25
|
+
slug,
|
|
26
|
+
createdBy,
|
|
27
|
+
};
|
|
28
|
+
try {
|
|
29
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
|
30
|
+
return response.createTag;
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
searchTag(keyword, currentPage, maxResult) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const queries = queries_1.SEARCH_TAG;
|
|
40
|
+
const variables = {
|
|
41
|
+
keyword,
|
|
42
|
+
currentPage,
|
|
43
|
+
maxResult,
|
|
44
|
+
};
|
|
45
|
+
try {
|
|
46
|
+
const response = yield this.graphqlQuery(queries, variables);
|
|
47
|
+
return response.searchTag;
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
getTagsByProductId(productId) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const queries = queries_1.GET_TAGS_BY_PRODUCT_ID;
|
|
57
|
+
const variables = {
|
|
58
|
+
productId,
|
|
59
|
+
};
|
|
60
|
+
try {
|
|
61
|
+
const response = yield this.graphqlQuery(queries, variables);
|
|
62
|
+
return response.getTagsByProductId;
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
removeProductTag(productId, tagId, updatedBy, tagGroupId) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
const mutation = mutations_1.REMOVE_PRODUCT_TAG;
|
|
72
|
+
const variables = {
|
|
73
|
+
productId,
|
|
74
|
+
tagId,
|
|
75
|
+
updatedBy,
|
|
76
|
+
tagGroupId,
|
|
77
|
+
};
|
|
78
|
+
try {
|
|
79
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
|
80
|
+
return response.removeProductTag;
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
addProductTag(productId, tagId, createBy, tagGroupId) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
const mutation = mutations_1.ADD_PRODUCT_TAG;
|
|
90
|
+
const variables = {
|
|
91
|
+
productId,
|
|
92
|
+
tagId,
|
|
93
|
+
createBy,
|
|
94
|
+
tagGroupId,
|
|
95
|
+
};
|
|
96
|
+
try {
|
|
97
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
|
98
|
+
return response.addProductTag;
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.MarketPlaceService = MarketPlaceService;
|
|
@@ -16,4 +16,14 @@ export declare class PaymentServiceV2 extends Service {
|
|
|
16
16
|
getPaymentGatewaysByMethodCode(methodCode: string): Promise<any>;
|
|
17
17
|
getPaymentMethodTypesV2(storeActive: any, allMethodTypes: boolean): Promise<any>;
|
|
18
18
|
getTransferInfo(storeId: string, paymentId: string): Promise<any>;
|
|
19
|
+
createPayment(paymentData: {
|
|
20
|
+
totalAmount: number;
|
|
21
|
+
storeID: string;
|
|
22
|
+
partnerCode: string;
|
|
23
|
+
methodCode: string;
|
|
24
|
+
phone?: string;
|
|
25
|
+
email?: string;
|
|
26
|
+
}): Promise<any>;
|
|
27
|
+
paymentMethodsByPartner(partnerCode?: string): Promise<any>;
|
|
28
|
+
getPaymentMethodTypesWithGatewayConfig(partnerId?: string, storeId?: string): Promise<any>;
|
|
19
29
|
}
|
|
@@ -260,5 +260,44 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
|
|
|
260
260
|
}
|
|
261
261
|
});
|
|
262
262
|
}
|
|
263
|
+
createPayment(paymentData) {
|
|
264
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
265
|
+
const mutation = mutations_1.CREATE_PAYMENT;
|
|
266
|
+
const variables = { paymentData };
|
|
267
|
+
try {
|
|
268
|
+
const response = yield this.graphqlMutationV3(mutation, variables);
|
|
269
|
+
return response.createPayment;
|
|
270
|
+
}
|
|
271
|
+
catch (error) {
|
|
272
|
+
throw error;
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
paymentMethodsByPartner(partnerCode) {
|
|
277
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
278
|
+
const query = queries_1.PAYMENT_METHODS_BY_PARTNER;
|
|
279
|
+
const variables = { partnerCode };
|
|
280
|
+
try {
|
|
281
|
+
const response = yield this.graphqlQueryV3(query, variables);
|
|
282
|
+
return response.paymentMethods;
|
|
283
|
+
}
|
|
284
|
+
catch (error) {
|
|
285
|
+
throw error;
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
getPaymentMethodTypesWithGatewayConfig(partnerId, storeId) {
|
|
290
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
291
|
+
const query = queries_1.GET_PAYMENT_METHOD_TYPES_WITH_GATEWAY_CONFIG;
|
|
292
|
+
const variables = { partnerId, storeId };
|
|
293
|
+
try {
|
|
294
|
+
const response = yield this.graphqlQueryV3(query, variables);
|
|
295
|
+
return response.getPaymentMethodTypes;
|
|
296
|
+
}
|
|
297
|
+
catch (error) {
|
|
298
|
+
throw error;
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
}
|
|
263
302
|
}
|
|
264
303
|
exports.PaymentServiceV2 = PaymentServiceV2;
|
|
@@ -30,4 +30,7 @@ export declare class PortalService extends Service {
|
|
|
30
30
|
getPosition(query?: Record<string, any>): Promise<any>;
|
|
31
31
|
getPositionForTime(query?: Record<string, any>): Promise<any>;
|
|
32
32
|
getBookingCount(query?: Record<string, any>): Promise<any>;
|
|
33
|
+
getSlugPathFromDynamicFrom(query?: Record<string, any>): Promise<any>;
|
|
34
|
+
putSlugPathFromDynamicFrom(data: any): Promise<any>;
|
|
35
|
+
postSlugPathFromDynamicFrom(data: any): Promise<any>;
|
|
33
36
|
}
|
|
@@ -452,5 +452,55 @@ class PortalService extends serviceSDK_1.Service {
|
|
|
452
452
|
}
|
|
453
453
|
});
|
|
454
454
|
}
|
|
455
|
+
getSlugPathFromDynamicFrom(query) {
|
|
456
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
457
|
+
const method = "GET";
|
|
458
|
+
const baseUrl = `/dynamic-collection/public/v2/records/slug_path/slug_path_view`;
|
|
459
|
+
const params = new URLSearchParams();
|
|
460
|
+
if (query) {
|
|
461
|
+
Object.entries(query).forEach(([key, value]) => {
|
|
462
|
+
if (value !== undefined && value !== null) {
|
|
463
|
+
params.append(key, String(value));
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
const endpoint = params.toString()
|
|
468
|
+
? `${baseUrl}?${params.toString()}`
|
|
469
|
+
: baseUrl;
|
|
470
|
+
try {
|
|
471
|
+
const response = yield this.restApiCallWithNoToken(endpoint, method);
|
|
472
|
+
return response;
|
|
473
|
+
}
|
|
474
|
+
catch (error) {
|
|
475
|
+
throw error;
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
putSlugPathFromDynamicFrom(data) {
|
|
480
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
481
|
+
const method = "PUT";
|
|
482
|
+
const endpoint = `/dynamic-collection/public/v2/records/slug_path/slug_path_form`;
|
|
483
|
+
try {
|
|
484
|
+
const response = yield this.restApiCallWithNoToken(endpoint, method, data);
|
|
485
|
+
return response;
|
|
486
|
+
}
|
|
487
|
+
catch (error) {
|
|
488
|
+
throw error;
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
postSlugPathFromDynamicFrom(data) {
|
|
493
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
494
|
+
const method = "POST";
|
|
495
|
+
const endpoint = `/dynamic-collection/public/v2/records/slug_path/slug_path_form`;
|
|
496
|
+
try {
|
|
497
|
+
const response = yield this.restApiCallWithNoHeader(endpoint, method, data);
|
|
498
|
+
return response;
|
|
499
|
+
}
|
|
500
|
+
catch (error) {
|
|
501
|
+
throw error;
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
}
|
|
455
505
|
}
|
|
456
506
|
exports.PortalService = PortalService;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Service } from "../serviceSDK";
|
|
2
|
+
export declare class StorefontService extends Service {
|
|
3
|
+
constructor(endpoint: string, orgId: string, storeId: string);
|
|
4
|
+
getRevenueStatisticByGroupOrCategory(dataQuery: any, groupBy: any): Promise<any>;
|
|
5
|
+
getRevenueStatisticByProduct(dataQuery: any): Promise<any>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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.StorefontService = void 0;
|
|
13
|
+
const serviceSDK_1 = require("../serviceSDK");
|
|
14
|
+
const queries_1 = require("../../graphql/storefont/queries");
|
|
15
|
+
class StorefontService extends serviceSDK_1.Service {
|
|
16
|
+
constructor(endpoint, orgId, storeId) {
|
|
17
|
+
super(endpoint, orgId, storeId);
|
|
18
|
+
}
|
|
19
|
+
getRevenueStatisticByGroupOrCategory(dataQuery, groupBy) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const query = queries_1.GET_REVENUE_STATISTIC_BY_GROUP_OR_CATEGORY;
|
|
22
|
+
const variables = {
|
|
23
|
+
input: dataQuery,
|
|
24
|
+
groupBy,
|
|
25
|
+
};
|
|
26
|
+
try {
|
|
27
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
28
|
+
return response.getRevenueStatisticByGroupOrCategory;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
getRevenueStatisticByProduct(dataQuery) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const query = queries_1.GET_REVENUE_STATISTIC_BY_PRODUCT;
|
|
38
|
+
const variables = {
|
|
39
|
+
input: dataQuery,
|
|
40
|
+
};
|
|
41
|
+
try {
|
|
42
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
43
|
+
return response.getRevenueStatisticByProduct;
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.StorefontService = StorefontService;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Service } from "../serviceSDK";
|
|
2
|
+
export declare class TagService extends Service {
|
|
3
|
+
constructor(endpoint: string, orgId: string, storeId: string);
|
|
4
|
+
addTagToTagGroup(data: any): Promise<any>;
|
|
5
|
+
removeTagToTagGroup(data: any): Promise<any>;
|
|
6
|
+
getResultTag(resourceId: string, resourceType: string): Promise<any>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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.TagService = void 0;
|
|
13
|
+
const serviceSDK_1 = require("../serviceSDK");
|
|
14
|
+
const mutations_1 = require("../../graphql/tag/mutations");
|
|
15
|
+
const queries_1 = require("../../graphql/tag/queries");
|
|
16
|
+
class TagService extends serviceSDK_1.Service {
|
|
17
|
+
constructor(endpoint, orgId, storeId) {
|
|
18
|
+
super(endpoint, orgId, storeId);
|
|
19
|
+
}
|
|
20
|
+
addTagToTagGroup(data) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const mutation = mutations_1.ADD_TAG_TO_TAG_GROUP;
|
|
23
|
+
try {
|
|
24
|
+
const response = yield this.graphqlMutation(mutation, data);
|
|
25
|
+
return response.addTagToTagGroup;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
removeTagToTagGroup(data) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const mutation = mutations_1.REMOVE_TAG_TO_TAG_GROUP;
|
|
35
|
+
try {
|
|
36
|
+
const response = yield this.graphqlMutation(mutation, data);
|
|
37
|
+
return response.removeTagToTagGroup;
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
getResultTag(resourceId, resourceType) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const queries = queries_1.GET_RESULT_TAG;
|
|
47
|
+
const variables = {
|
|
48
|
+
resourceId,
|
|
49
|
+
resourceType,
|
|
50
|
+
};
|
|
51
|
+
try {
|
|
52
|
+
const response = yield this.graphqlMutationV3(queries, variables);
|
|
53
|
+
return response.getResultTag;
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.TagService = TagService;
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ApolloClient, NormalizedCacheObject } from "@apollo/client";
|
|
2
|
-
import { DocumentNode } from "graphql";
|
|
3
|
-
export declare class Service {
|
|
4
|
-
protected token: string | null;
|
|
5
|
-
protected client: ApolloClient<NormalizedCacheObject>;
|
|
6
|
-
protected orgId: string;
|
|
7
|
-
protected storeId: string;
|
|
8
|
-
protected endpoint: string;
|
|
9
|
-
constructor(endpoint: string, orgId: string, storeId: string);
|
|
10
|
-
setToken(token: string): void;
|
|
11
|
-
protected graphqlQuery(query: DocumentNode, variables: any): Promise<any>;
|
|
12
|
-
protected graphqlMutation(mutation: DocumentNode, variables: any): Promise<any>;
|
|
13
|
-
protected restApiCallWithToken(path: string, method: "GET" | "POST" | "PUT" | "DELETE", data?: any, headers?: any): Promise<any>;
|
|
14
|
-
}
|