@longvansoftware/service-js-client 1.17.9 → 1.18.1

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.
@@ -359,6 +359,7 @@ exports.GET_ELASTIC_CLOUD_RESOURCE = (0, graphql_tag_1.gql) `
359
359
  size
360
360
  used
361
361
  }
362
+ provinces
362
363
  }
363
364
  }
364
365
  `;
@@ -82,24 +82,8 @@ exports.GET_CAMPAIGN_ACTION_BY_ID = (0, graphql_tag_1.gql) `
82
82
  // }
83
83
  // `;
84
84
  exports.SUGGEST_VOUCHER = (0, graphql_tag_1.gql) `
85
- query SuggestVoucher(
86
- $partyId: String
87
- $excludeExpired: Boolean
88
- $customerId: String
89
- $scope: String
90
- $isNewCustomer: Boolean
91
- $scopeIgnore: String
92
- ) {
93
- suggestVoucher(
94
- searchVoucherRequest: {
95
- partyId: $partyId
96
- excludeExpired: $excludeExpired
97
- customerId: $customerId
98
- scope: $scope
99
- isNewCustomer: $isNewCustomer
100
- scopeIgnore: $scopeIgnore
101
- }
102
- ) {
85
+ query SuggestVoucher($searchVoucherRequest: SearchVoucherRequest) {
86
+ suggestVoucher(searchVoucherRequest: $searchVoucherRequest) {
103
87
  total
104
88
  totalPages
105
89
  totalElements
@@ -188,6 +172,12 @@ exports.GET_VOUCHERS = (0, graphql_tag_1.gql) `
188
172
  isBirthday
189
173
  customerId
190
174
  scope
175
+ affiliateId
176
+ description
177
+ usageLimitType
178
+ maximumDiscountType
179
+ customAttribute
180
+ assignUserLimit
191
181
  }
192
182
  }
193
183
  }
@@ -246,9 +236,6 @@ exports.SEARCH_PRODUCT_GIFT_PROMOTION_RESPONSE = (0, graphql_tag_1.gql) `
246
236
  searchProductGiftPromotionResponse(
247
237
  parameterSearchProductGift: $parameterSearchProductGift
248
238
  ) {
249
- total
250
- totalPages
251
- totalElements
252
239
  content {
253
240
  id
254
241
  partyId
@@ -260,20 +247,39 @@ exports.SEARCH_PRODUCT_GIFT_PROMOTION_RESPONSE = (0, graphql_tag_1.gql) `
260
247
  giftPromotions {
261
248
  fromQuantity
262
249
  toProductId
250
+ toProductParentId
263
251
  toQuantity
252
+ priceType
264
253
  productName
265
254
  sku
266
255
  featureImage
256
+ unit
267
257
  }
258
+ unit
268
259
  campaignActionName
269
260
  startDate
270
261
  endDate
271
262
  newCustomer
263
+ minimumSpend
272
264
  createdStamp
273
265
  updatedStamp
274
266
  updatedBy
275
267
  createdBy
276
268
  }
269
+ total
270
+ totalPages
271
+ totalElements
272
+ last
273
+ first
274
+ number
275
+ numberOfElements
276
+ size
277
+ empty
278
+ sort {
279
+ sorted
280
+ unsorted
281
+ empty
282
+ }
277
283
  }
278
284
  }
279
285
  `;
@@ -309,13 +315,18 @@ exports.GET_VOUCHERS_V2 = (0, graphql_tag_1.gql) `
309
315
  isBirthday
310
316
  customerId
311
317
  scope
318
+ affiliateId
319
+ description
320
+ usageLimitType
312
321
  maximumDiscountType
322
+ customAttribute
323
+ assignUserLimit
313
324
  }
314
325
  }
315
326
  }
316
327
  `;
317
328
  exports.SEARCH_CAMPAIGN = (0, graphql_tag_1.gql) `
318
- query SearchCampaign($searchCampaignRequest: SearchCampaignRequest) {
329
+ query SearchCampaign($searchCampaignRequest: SearchCampaignRequest) {
319
330
  searchCampaign(searchCampaignRequest: $searchCampaignRequest) {
320
331
  content {
321
332
  id
@@ -330,6 +330,9 @@ exports.ADD_TO_CART = (0, graphql_tag_1.gql) `
330
330
  quantity
331
331
  unit
332
332
  productId
333
+ unitGift
334
+ giftDuration
335
+ giftDurationUnit
333
336
  }
334
337
  resourceConfigs {
335
338
  name
@@ -113,6 +113,8 @@ exports.GET_ORDER_DETAIL = (0, graphql_tag_1.gql) `
113
113
  currencyCode
114
114
  }
115
115
  orderLineItemParentId
116
+ giftConditionProductId
117
+ giftQuantity
116
118
  variant {
117
119
  id
118
120
  price {
@@ -135,18 +137,47 @@ exports.GET_ORDER_DETAIL = (0, graphql_tag_1.gql) `
135
137
  value
136
138
  title
137
139
  }
138
- resourceItems {
139
- name
140
- quantity
141
- unit
142
- productId
143
- }
144
140
  resourceConfigs {
145
- name
146
- quantity
147
- unit
148
- productId
149
- }
141
+ name
142
+ quantity
143
+ unit
144
+ productId
145
+ giftProductId
146
+ gift
147
+ giftQuantity
148
+ campaignId
149
+ campaignActionId
150
+ qualify
151
+ idParent
152
+ addQuantity
153
+ defaultQuantity
154
+ title
155
+ price
156
+ unitPrice
157
+ totalResource
158
+ }
159
+ resourceItems {
160
+ name
161
+ quantity
162
+ unit
163
+ productId
164
+ giftProductId
165
+ gift
166
+ giftQuantity
167
+ campaignId
168
+ campaignActionId
169
+ qualify
170
+ idParent
171
+ addQuantity
172
+ defaultQuantity
173
+ title
174
+ price
175
+ unitPrice
176
+ totalResource
177
+ unitGift
178
+ giftDuration
179
+ giftDurationUnit
180
+ }
150
181
  itemType
151
182
  }
152
183
  serviceId
@@ -181,6 +212,7 @@ exports.GET_QUANTITY_ORDER_LINEITEMS = (0, graphql_tag_1.gql) `
181
212
  }
182
213
  itemType
183
214
  orderLineItemParentId
215
+ giftConditionProductId
184
216
  }
185
217
  }
186
218
  }
@@ -240,6 +272,8 @@ exports.GET_ORDER_LINE_ITEM_BY_SERVICE_ID = (0, graphql_tag_1.gql) `
240
272
  updatedStamp
241
273
  completedAt
242
274
  orderLineItemParentId
275
+ giftConditionProductId
276
+ giftQuantity
243
277
  orderStatus
244
278
  totalVAT {
245
279
  amount
@@ -93,12 +93,15 @@ class CrmCampingService extends serviceSDK_1.Service {
93
93
  return __awaiter(this, void 0, void 0, function* () {
94
94
  const query = queries_1.SUGGEST_VOUCHER;
95
95
  const variables = {
96
- partyId: this.orgId,
97
- excludeExpired: true,
98
- customerId,
99
- scope,
100
- isNewCustomer,
101
- scopeIgnore,
96
+ searchVoucherRequest: {
97
+ partyId: this.orgId,
98
+ excludeExpired: true,
99
+ customerId,
100
+ scope,
101
+ isNewCustomer,
102
+ scopeIgnore,
103
+ isPageAble: false,
104
+ },
102
105
  };
103
106
  try {
104
107
  const response = yield this.graphqlQueryV2(query, variables);
@@ -471,4 +471,6 @@ export declare class OrderService extends Service {
471
471
  addProductInOrderWithoutLogin(orderId: string, updated_by: string, data: any, store: string): Promise<any>;
472
472
  findCampaignActionGiftVoucher(): Promise<any>;
473
473
  addProductGiftPromotion(orderId: string, updatedBy: string, data: any): Promise<any>;
474
+ removeProductGiftPromotion(orderId: string, orderLineItemId: string, productGiftId: string): Promise<any>;
475
+ checkNewCustomer(orderId: string, customer_id: string): Promise<any>;
474
476
  }
@@ -1295,5 +1295,40 @@ class OrderService extends serviceSDK_1.Service {
1295
1295
  }
1296
1296
  });
1297
1297
  }
1298
+ // https://storefront.dev.longvan.vn/swagger-ui/index.html#/Order%20API/removeGiftQuantity
1299
+ removeProductGiftPromotion(orderId, orderLineItemId, productGiftId) {
1300
+ return __awaiter(this, void 0, void 0, function* () {
1301
+ console.log("🚀 ~ OrderService ~ removeProductGiftPromotion ~ orderLineItemId:", orderLineItemId);
1302
+ console.log("🚀 ~ OrderService ~ removeProductGiftPromotion ~ orderId:", orderId);
1303
+ const endpoint = `/orders/${this.orgId}/${orderId}/${orderLineItemId}/giftQuantity${productGiftId ? `?productGiftId=${productGiftId}` : ""}`;
1304
+ const method = "PUT";
1305
+ try {
1306
+ const response = yield this.restApiCallWithToken(endpoint, method);
1307
+ console.log(response);
1308
+ return response;
1309
+ }
1310
+ catch (error) {
1311
+ console.log(`Error in removeProductGiftPromotion: ${error}`);
1312
+ throw error;
1313
+ }
1314
+ });
1315
+ }
1316
+ checkNewCustomer(orderId, customer_id) {
1317
+ return __awaiter(this, void 0, void 0, function* () {
1318
+ console.log("🚀 ~ OrderService ~ removeProductGiftPromotion ~ orderLineItemId:", customer_id);
1319
+ console.log("🚀 ~ OrderService ~ removeProductGiftPromotion ~ orderId:", orderId);
1320
+ const endpoint = `/front/orders/${this.orgId}/${customer_id}/${orderId}/newCustomer`;
1321
+ const method = "GET";
1322
+ try {
1323
+ const response = yield this.restApiCallWithToken(endpoint, method);
1324
+ console.log(response);
1325
+ return response;
1326
+ }
1327
+ catch (error) {
1328
+ console.log(`Error in removeProductGiftPromotion: ${error}`);
1329
+ throw error;
1330
+ }
1331
+ });
1332
+ }
1298
1333
  }
1299
1334
  exports.OrderService = OrderService;
@@ -3,7 +3,7 @@ export declare class ResourcePermissionService extends Service {
3
3
  constructor(endpoint: string, orgId: string, storeId: string);
4
4
  setToken(token: string): void;
5
5
  setStoreId(storeId: string): void;
6
- shareResource(createModel: any, partnerId: string): Promise<any>;
7
- removeShareParty(resourceId: string, sharePartyId: string, resourceType: string, partnerId: string): Promise<any>;
6
+ shareResource(createModel: any): Promise<any>;
7
+ removeShareParty(resourceId: string, sharePartyId: string, resourceType: string): Promise<any>;
8
8
  getSharedUserByService(resourceType: string, resourceId: string): Promise<any>;
9
9
  }
@@ -23,11 +23,11 @@ class ResourcePermissionService extends serviceSDK_1.Service {
23
23
  setStoreId(storeId) {
24
24
  this.storeId = storeId;
25
25
  }
26
- shareResource(createModel, partnerId) {
26
+ shareResource(createModel) {
27
27
  return __awaiter(this, void 0, void 0, function* () {
28
28
  const mutation = mutations_1.SHARE_RESOURCE;
29
29
  const variables = {
30
- partnerId: partnerId,
30
+ partnerId: this.orgId,
31
31
  createModel,
32
32
  };
33
33
  try {
@@ -40,11 +40,11 @@ class ResourcePermissionService extends serviceSDK_1.Service {
40
40
  }
41
41
  });
42
42
  }
43
- removeShareParty(resourceId, sharePartyId, resourceType, partnerId) {
43
+ removeShareParty(resourceId, sharePartyId, resourceType) {
44
44
  return __awaiter(this, void 0, void 0, function* () {
45
45
  const mutation = mutations_1.REMOVE_SHARE_PARTY;
46
46
  const variables = {
47
- partnerId: partnerId,
47
+ partnerId: this.orgId,
48
48
  orgId: this.orgId,
49
49
  resourceType,
50
50
  resourceId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/service-js-client",
3
- "version": "1.17.9",
3
+ "version": "1.18.1",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [