@longvansoftware/service-js-client 1.8.9 → 1.9.0
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.
@@ -6,31 +6,32 @@ exports.ADD_CUSTOMER_TO_VOUCHER = (0, graphql_tag_1.gql) `
|
|
6
6
|
mutation AddCustomerToVoucher(
|
7
7
|
$partyId: String!
|
8
8
|
$userId: String!
|
9
|
-
$
|
9
|
+
$voucherCode: String!
|
10
10
|
) {
|
11
11
|
addCustomerToVoucher(
|
12
12
|
partyId: $partyId
|
13
13
|
userId: $userId
|
14
|
-
|
14
|
+
voucherCode: $voucherCode
|
15
15
|
) {
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
16
|
+
campaignActionId
|
17
|
+
campaignId
|
18
|
+
partyId
|
19
|
+
voucherCode
|
20
|
+
voucherType
|
21
|
+
status
|
22
|
+
discountAmount
|
23
|
+
discountPercent
|
24
|
+
usageLimitPerVoucher
|
25
|
+
maximumDiscount
|
26
|
+
numberOfTimeUsed
|
27
|
+
id
|
28
|
+
createdStamp
|
29
|
+
updatedStamp
|
30
|
+
updatedBy
|
31
|
+
createdBy
|
32
|
+
isBirthday
|
33
|
+
customerId
|
34
|
+
scope
|
34
35
|
}
|
35
36
|
}
|
36
37
|
`;
|
@@ -1 +1,4 @@
|
|
1
1
|
export declare const SEARCH_PRODUCT_QUANTITY_PROMOTION_ACTION: import("graphql").DocumentNode;
|
2
|
+
export declare const GET_CAMPAIGN_ACTION_BY_ID: import("graphql").DocumentNode;
|
3
|
+
export declare const SUGGEST_VOUCHER: import("graphql").DocumentNode;
|
4
|
+
export declare const GET_VOUCHERS: import("graphql").DocumentNode;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.SEARCH_PRODUCT_QUANTITY_PROMOTION_ACTION = void 0;
|
3
|
+
exports.GET_VOUCHERS = exports.SUGGEST_VOUCHER = exports.GET_CAMPAIGN_ACTION_BY_ID = exports.SEARCH_PRODUCT_QUANTITY_PROMOTION_ACTION = void 0;
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
5
5
|
exports.SEARCH_PRODUCT_QUANTITY_PROMOTION_ACTION = (0, graphql_tag_1.gql) `
|
6
6
|
query SearchProductQuantityPromotionAction(
|
@@ -15,3 +15,164 @@ exports.SEARCH_PRODUCT_QUANTITY_PROMOTION_ACTION = (0, graphql_tag_1.gql) `
|
|
15
15
|
)
|
16
16
|
}
|
17
17
|
`;
|
18
|
+
exports.GET_CAMPAIGN_ACTION_BY_ID = (0, graphql_tag_1.gql) `
|
19
|
+
query GetCampaignActionById($id: String!) {
|
20
|
+
getCampaignActionById(id: $id) {
|
21
|
+
name
|
22
|
+
description
|
23
|
+
partyId
|
24
|
+
type
|
25
|
+
viewTemplateId
|
26
|
+
urlTemplate
|
27
|
+
shortCode
|
28
|
+
uriPattern
|
29
|
+
parameterPattern
|
30
|
+
status
|
31
|
+
extendDaysForHeadReview
|
32
|
+
priorityLevel
|
33
|
+
positionConnectionType
|
34
|
+
baseCommissionPercent
|
35
|
+
targetType
|
36
|
+
id
|
37
|
+
createdStamp
|
38
|
+
updatedStamp
|
39
|
+
updatedBy
|
40
|
+
createdBy
|
41
|
+
}
|
42
|
+
}
|
43
|
+
`;
|
44
|
+
// export const SUGGEST_VOUCHER = gql`
|
45
|
+
// query SuggestVoucher (
|
46
|
+
// searchVoucherRequest: { partyId: String, customerId: String }
|
47
|
+
// ) {
|
48
|
+
// suggestVoucher(
|
49
|
+
// searchVoucherRequest: { partyId: $partyId, customerId: $customerId }
|
50
|
+
// ) {
|
51
|
+
// total
|
52
|
+
// totalPages
|
53
|
+
// totalElements
|
54
|
+
// last
|
55
|
+
// first
|
56
|
+
// number
|
57
|
+
// numberOfElements
|
58
|
+
// size
|
59
|
+
// empty
|
60
|
+
// content {
|
61
|
+
// campaignActionId
|
62
|
+
// campaignId
|
63
|
+
// partyId
|
64
|
+
// voucherCode
|
65
|
+
// voucherType
|
66
|
+
// status
|
67
|
+
// discountAmount
|
68
|
+
// discountPercent
|
69
|
+
// usageLimitPerVoucher
|
70
|
+
// maximumDiscount
|
71
|
+
// numberOfTimeUsed
|
72
|
+
// id
|
73
|
+
// createdStamp
|
74
|
+
// updatedStamp
|
75
|
+
// updatedBy
|
76
|
+
// createdBy
|
77
|
+
// isBirthday
|
78
|
+
// customerId
|
79
|
+
// scope
|
80
|
+
// }
|
81
|
+
// }
|
82
|
+
// }
|
83
|
+
// `;
|
84
|
+
exports.SUGGEST_VOUCHER = (0, graphql_tag_1.gql) `
|
85
|
+
query SuggestVoucher($partyId: String, $excludeExpired: Boolean) {
|
86
|
+
suggestVoucher(
|
87
|
+
searchVoucherRequest: {
|
88
|
+
partyId: $partyId
|
89
|
+
excludeExpired: $excludeExpired
|
90
|
+
}
|
91
|
+
) {
|
92
|
+
total
|
93
|
+
totalPages
|
94
|
+
totalElements
|
95
|
+
last
|
96
|
+
first
|
97
|
+
number
|
98
|
+
numberOfElements
|
99
|
+
size
|
100
|
+
empty
|
101
|
+
content {
|
102
|
+
campaignActionId
|
103
|
+
campaignId
|
104
|
+
partyId
|
105
|
+
voucherCode
|
106
|
+
voucherType
|
107
|
+
status
|
108
|
+
discountAmount
|
109
|
+
discountPercent
|
110
|
+
usageLimitPerVoucher
|
111
|
+
maximumDiscount
|
112
|
+
numberOfTimeUsed
|
113
|
+
id
|
114
|
+
createdStamp
|
115
|
+
updatedStamp
|
116
|
+
updatedBy
|
117
|
+
createdBy
|
118
|
+
isBirthday
|
119
|
+
customerId
|
120
|
+
scope
|
121
|
+
}
|
122
|
+
}
|
123
|
+
}
|
124
|
+
`;
|
125
|
+
exports.GET_VOUCHERS = (0, graphql_tag_1.gql) `
|
126
|
+
query SearchVoucher(
|
127
|
+
$partyId: String
|
128
|
+
$campaignId: String
|
129
|
+
$campaignActionId: String
|
130
|
+
$campaignActionType: String
|
131
|
+
$customerId: String
|
132
|
+
$pageNumber: Int
|
133
|
+
$pageSize: Int
|
134
|
+
) {
|
135
|
+
searchVoucher(
|
136
|
+
searchVoucherRequest: {
|
137
|
+
partyId: $partyId
|
138
|
+
campaignId: $campaignId
|
139
|
+
campaignActionId: $campaignActionId
|
140
|
+
campaignActionType: $campaignActionType
|
141
|
+
customerId: $customerId
|
142
|
+
pageNumber: $pageNumber
|
143
|
+
pageSize: $pageSize
|
144
|
+
}
|
145
|
+
) {
|
146
|
+
total
|
147
|
+
totalPages
|
148
|
+
totalElements
|
149
|
+
last
|
150
|
+
first
|
151
|
+
number
|
152
|
+
numberOfElements
|
153
|
+
size
|
154
|
+
empty
|
155
|
+
content {
|
156
|
+
campaignActionId
|
157
|
+
campaignId
|
158
|
+
partyId
|
159
|
+
voucherCode
|
160
|
+
voucherType
|
161
|
+
status
|
162
|
+
discountAmount
|
163
|
+
discountPercent
|
164
|
+
usageLimitPerVoucher
|
165
|
+
maximumDiscount
|
166
|
+
numberOfTimeUsed
|
167
|
+
id
|
168
|
+
createdStamp
|
169
|
+
updatedStamp
|
170
|
+
updatedBy
|
171
|
+
createdBy
|
172
|
+
isBirthday
|
173
|
+
customerId
|
174
|
+
scope
|
175
|
+
}
|
176
|
+
}
|
177
|
+
}
|
178
|
+
`;
|
@@ -4,5 +4,8 @@ export declare class CrmCampingService extends Service {
|
|
4
4
|
setToken(token: string): void;
|
5
5
|
setStoreId(storeId: string): void;
|
6
6
|
searchProductQuantityPromotionAction(productId: string): Promise<any>;
|
7
|
-
addCustomerToVoucher(userId: string,
|
7
|
+
addCustomerToVoucher(userId: string, voucherCode: string): Promise<any>;
|
8
|
+
getCampaignActionById(campaignActionId: string): Promise<any>;
|
9
|
+
suggestVoucher(): Promise<any>;
|
10
|
+
searchVouchers(campaignId: String, campaignActionId: String, campaignActionType: String, customerId: String, pageNumber: number, pageSize: number): Promise<any>;
|
8
11
|
}
|
@@ -41,13 +41,13 @@ class CrmCampingService extends serviceSDK_1.Service {
|
|
41
41
|
}
|
42
42
|
});
|
43
43
|
}
|
44
|
-
addCustomerToVoucher(userId,
|
44
|
+
addCustomerToVoucher(userId, voucherCode) {
|
45
45
|
return __awaiter(this, void 0, void 0, function* () {
|
46
46
|
const mutation = mutations_1.ADD_CUSTOMER_TO_VOUCHER;
|
47
47
|
const variables = {
|
48
48
|
partyId: this.orgId,
|
49
49
|
userId,
|
50
|
-
|
50
|
+
voucherCode,
|
51
51
|
};
|
52
52
|
try {
|
53
53
|
const response = yield this.graphqlMutationV2(mutation, variables);
|
@@ -59,5 +59,73 @@ class CrmCampingService extends serviceSDK_1.Service {
|
|
59
59
|
}
|
60
60
|
});
|
61
61
|
}
|
62
|
+
getCampaignActionById(campaignActionId) {
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
64
|
+
const query = queries_1.GET_CAMPAIGN_ACTION_BY_ID;
|
65
|
+
const variables = { id: campaignActionId };
|
66
|
+
try {
|
67
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
68
|
+
return response.getCampaignActionById;
|
69
|
+
}
|
70
|
+
catch (error) {
|
71
|
+
console.log(`Error in getCampaignActionById: ${error}`);
|
72
|
+
throw error;
|
73
|
+
}
|
74
|
+
});
|
75
|
+
}
|
76
|
+
// async suggestVoucher(customerId: String){
|
77
|
+
// const query = SUGGEST_VOUCHER;
|
78
|
+
// const variables = {
|
79
|
+
// partyId: this.orgId,
|
80
|
+
// customerId
|
81
|
+
// };
|
82
|
+
// console.log("🚀 Query:", SUGGEST_VOUCHER);
|
83
|
+
// console.log("🚀 Variables:", { partyId: this.orgId, customerId });
|
84
|
+
// try {
|
85
|
+
// const response = await this.graphqlQueryV2(query, variables);
|
86
|
+
// return response.suggestVoucher;
|
87
|
+
// } catch (error) {
|
88
|
+
// console.log(`Error in suggestVoucher: ${error}`);
|
89
|
+
// throw error;
|
90
|
+
// }
|
91
|
+
// }
|
92
|
+
suggestVoucher() {
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
94
|
+
const query = queries_1.SUGGEST_VOUCHER;
|
95
|
+
const variables = {
|
96
|
+
partyId: this.orgId,
|
97
|
+
excludeExpired: true,
|
98
|
+
};
|
99
|
+
try {
|
100
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
101
|
+
return response.suggestVoucher;
|
102
|
+
}
|
103
|
+
catch (error) {
|
104
|
+
throw error;
|
105
|
+
}
|
106
|
+
});
|
107
|
+
}
|
108
|
+
searchVouchers(campaignId, campaignActionId, campaignActionType, customerId, pageNumber, pageSize) {
|
109
|
+
return __awaiter(this, void 0, void 0, function* () {
|
110
|
+
const query = queries_1.GET_VOUCHERS;
|
111
|
+
const variables = {
|
112
|
+
partyId: this.orgId,
|
113
|
+
campaignId,
|
114
|
+
campaignActionId,
|
115
|
+
campaignActionType,
|
116
|
+
customerId,
|
117
|
+
pageNumber,
|
118
|
+
pageSize,
|
119
|
+
};
|
120
|
+
try {
|
121
|
+
const response = yield this.graphqlQuery(query, variables);
|
122
|
+
return response.searchVoucher;
|
123
|
+
}
|
124
|
+
catch (error) {
|
125
|
+
console.log(`Error fetching searchVoucher: ${error}`);
|
126
|
+
throw error;
|
127
|
+
}
|
128
|
+
});
|
129
|
+
}
|
62
130
|
}
|
63
131
|
exports.CrmCampingService = CrmCampingService;
|