@longvansoftware/service-js-client 2.5.3 → 2.5.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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DocumentNode } from "graphql";
|
|
2
2
|
export declare const SEARCH_PRODUCT_QUANTITY_PROMOTION_ACTION: DocumentNode;
|
|
3
3
|
export declare const GET_CAMPAIGN_ACTION_BY_ID: DocumentNode;
|
|
4
|
+
export declare const GET_PRODUCT_DISCOUNT_BUY_WITH_DYNAMIC: (fields?: string[]) => DocumentNode;
|
|
4
5
|
export declare const SUGGEST_VOUCHER: DocumentNode;
|
|
5
6
|
export declare const GET_VOUCHERS: DocumentNode;
|
|
6
7
|
export declare const GET_AVERAGE_RATING: DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_VOUCHERS_FOR_USER = exports.GET_CONDITION_BY_ORGID_CAMPAIGN_ACTIONIDS = exports.SEARCH_CAMPAIGN = exports.GET_VOUCHERS_V2 = exports.SEARCH_PRODUCT_GIFT_PROMOTION_RESPONSE = exports.GET_NUMBER_OF_TICKET_EVALUATION = exports.GET_URL_EVALUATION = exports.GET_AVERAGE_RATING = exports.GET_VOUCHERS = exports.SUGGEST_VOUCHER = exports.GET_CAMPAIGN_ACTION_BY_ID = exports.SEARCH_PRODUCT_QUANTITY_PROMOTION_ACTION = void 0;
|
|
3
|
+
exports.GET_VOUCHERS_FOR_USER = exports.GET_CONDITION_BY_ORGID_CAMPAIGN_ACTIONIDS = exports.SEARCH_CAMPAIGN = exports.GET_VOUCHERS_V2 = exports.SEARCH_PRODUCT_GIFT_PROMOTION_RESPONSE = exports.GET_NUMBER_OF_TICKET_EVALUATION = exports.GET_URL_EVALUATION = exports.GET_AVERAGE_RATING = exports.GET_VOUCHERS = exports.SUGGEST_VOUCHER = exports.GET_PRODUCT_DISCOUNT_BUY_WITH_DYNAMIC = 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(
|
|
@@ -41,6 +41,26 @@ exports.GET_CAMPAIGN_ACTION_BY_ID = (0, graphql_tag_1.gql) `
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
`;
|
|
44
|
+
const GET_PRODUCT_DISCOUNT_BUY_WITH_DYNAMIC = (fields = []) => {
|
|
45
|
+
const fieldStr = fields.join('\n ');
|
|
46
|
+
const hasFields = fields.length > 0;
|
|
47
|
+
return (0, graphql_tag_1.gql) `
|
|
48
|
+
query GetProductDiscountBuyWith(
|
|
49
|
+
$partnerId: String!
|
|
50
|
+
$storeId: String!
|
|
51
|
+
$productId: String!
|
|
52
|
+
) {
|
|
53
|
+
getProductDiscountBuyWith(
|
|
54
|
+
partnerId: $partnerId
|
|
55
|
+
storeId: $storeId
|
|
56
|
+
productId: $productId
|
|
57
|
+
) {
|
|
58
|
+
${hasFields ? `${fieldStr}` : ''}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
};
|
|
63
|
+
exports.GET_PRODUCT_DISCOUNT_BUY_WITH_DYNAMIC = GET_PRODUCT_DISCOUNT_BUY_WITH_DYNAMIC;
|
|
44
64
|
// export const SUGGEST_VOUCHER = gql`
|
|
45
65
|
// query SuggestVoucher (
|
|
46
66
|
// searchVoucherRequest: { partyId: String, customerId: String }
|
|
@@ -6,6 +6,7 @@ export declare class CrmCampingService extends Service {
|
|
|
6
6
|
searchProductQuantityPromotionAction(productId: string): Promise<any>;
|
|
7
7
|
addCustomerToVoucher(userId: string, voucherCode: string): Promise<any>;
|
|
8
8
|
getCampaignActionById(campaignActionId: string): Promise<any>;
|
|
9
|
+
getProductDiscountBuyWithDynamic(productId: string, fields: string[]): Promise<any>;
|
|
9
10
|
suggestVoucher(customerId: string, scopeIgnore: string | null, scope: string | null, isNewCustomer: boolean, voucherCode: string | null): Promise<any>;
|
|
10
11
|
searchVouchers(campaignId: String, campaignActionId: String, campaignActionType: String, customerId: String, pageNumber: number, pageSize: number): Promise<any>;
|
|
11
12
|
getAverageRating(targetIds: [string], customerId: string, evaluationType: string): Promise<any>;
|
|
@@ -73,22 +73,24 @@ class CrmCampingService extends serviceSDK_1.Service {
|
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
76
|
+
getProductDiscountBuyWithDynamic(productId, fields) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
const query = (0, queries_1.GET_PRODUCT_DISCOUNT_BUY_WITH_DYNAMIC)(fields);
|
|
79
|
+
const variables = {
|
|
80
|
+
partnerId: this.orgId,
|
|
81
|
+
storeId: this.storeId,
|
|
82
|
+
productId,
|
|
83
|
+
};
|
|
84
|
+
try {
|
|
85
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
|
86
|
+
return response.getProductDiscountBuyWith;
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
console.log(`Error in getProductDiscountBuyWithDynamic: ${error}`);
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
92
94
|
suggestVoucher(customerId, scopeIgnore, scope, isNewCustomer, voucherCode) {
|
|
93
95
|
return __awaiter(this, void 0, void 0, function* () {
|
|
94
96
|
const query = queries_1.SUGGEST_VOUCHER;
|