@longvansoftware/storefront-js-client 4.3.5 → 4.3.7-beta.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.
Files changed (41) hide show
  1. package/README.md +221 -221
  2. package/dist/index.d.ts +1698 -0
  3. package/dist/index.js +13673 -0
  4. package/dist/src/graphql/auth/mutations.js +309 -309
  5. package/dist/src/graphql/auth/queries.js +209 -209
  6. package/dist/src/graphql/campaign/mutations.js +26 -26
  7. package/dist/src/graphql/campaign/queries.d.ts +1 -0
  8. package/dist/src/graphql/campaign/queries.js +459 -410
  9. package/dist/src/graphql/cashbook/queries.js +93 -93
  10. package/dist/src/graphql/cloud/mutations.js +103 -103
  11. package/dist/src/graphql/cloud/queries.js +112 -112
  12. package/dist/src/graphql/cloudCloud/mutations.js +12 -12
  13. package/dist/src/graphql/cloudCloud/queries.js +117 -117
  14. package/dist/src/graphql/computing/mutations.js +96 -96
  15. package/dist/src/graphql/computing/queries.js +41 -41
  16. package/dist/src/graphql/crm/mutations.js +1064 -1064
  17. package/dist/src/graphql/crm/queries.js +920 -920
  18. package/dist/src/graphql/orderCloud/mutations.js +7 -7
  19. package/dist/src/graphql/orderCloud/queries.js +7 -7
  20. package/dist/src/graphql/payment/mutations.js +194 -194
  21. package/dist/src/graphql/payment/queries.js +117 -117
  22. package/dist/src/graphql/paymentV2/mutations.js +115 -115
  23. package/dist/src/graphql/paymentV2/queries.js +263 -263
  24. package/dist/src/graphql/product/mutations.js +652 -652
  25. package/dist/src/graphql/product/queries.js +989 -989
  26. package/dist/src/graphql/service/mutations.js +304 -304
  27. package/dist/src/graphql/service/queries.js +131 -131
  28. package/dist/src/graphql/store/mutations.js +24 -24
  29. package/dist/src/graphql/store/queries.js +24 -24
  30. package/dist/src/graphql/user/mutations.js +201 -201
  31. package/dist/src/graphql/user/queries.js +339 -339
  32. package/dist/src/lib/campaign/index.d.ts +1 -0
  33. package/dist/src/lib/campaign/index.js +19 -0
  34. package/dist/src/lib/order/index.d.ts +10 -0
  35. package/dist/src/lib/order/index.js +34 -0
  36. package/dist/src/lib/serviceSDK.js +14 -14
  37. package/package.json +43 -43
  38. package/dist/src/graphql/cloudService/queries.d.ts +0 -1
  39. package/dist/src/graphql/cloudService/queries.js +0 -71
  40. package/dist/src/lib/cloudService/index.d.ts +0 -5
  41. package/dist/src/lib/cloudService/index.js +0 -35
@@ -18,4 +18,5 @@ export declare class CampaignService extends Service {
18
18
  getCampaignActionById(id: string): Promise<any>;
19
19
  searchProductGiftPromotionResponse(productIds: string[], campaignActionId: string): Promise<any>;
20
20
  getCampaign(id: string): Promise<any>;
21
+ searchProductPricePromotionResponse(campaignId: string, campaignActionId: string, statusActive: string): Promise<any>;
21
22
  }
@@ -229,5 +229,24 @@ class CampaignService extends serviceSDK_1.Service {
229
229
  }
230
230
  });
231
231
  }
232
+ searchProductPricePromotionResponse(campaignId, campaignActionId, statusActive) {
233
+ return __awaiter(this, void 0, void 0, function* () {
234
+ const query = queries_1.SEARCH_PRODUCT_PRICE_PROMOTION_RESPONSE;
235
+ const variables = {
236
+ partyId: this.orgId,
237
+ campaignId,
238
+ campaignActionId,
239
+ statusActive,
240
+ sort: { asc: true, key: "productId" },
241
+ };
242
+ try {
243
+ const response = yield this.graphqlQuery(query, variables);
244
+ return response.searchProductPricePromotionResponse;
245
+ }
246
+ catch (error) {
247
+ throw error;
248
+ }
249
+ });
250
+ }
232
251
  }
233
252
  exports.CampaignService = CampaignService;
@@ -518,6 +518,15 @@ export declare class OrderService extends Service {
518
518
  removeShippingAddress(orderId: string, updateBy: string): Promise<any>;
519
519
  removeShippingInfo(orderId: string, updateBy: string): Promise<any>;
520
520
  updateVatInorder(orderId: string, orderItemId: string, vatRate: string): Promise<any>;
521
+ /**
522
+ * Updates VAT for an order item by VAT rate name
523
+ * @param orderId - The ID of the order
524
+ * @param orderItemId - The ID of the order item
525
+ * @param vatRateName - The VAT rate name to update
526
+ * @returns A promise that resolves when the VAT is updated
527
+ * @throws If an error occurs while updating the VAT
528
+ */
529
+ updateVatByRateName(orderId: string, orderItemId: string, vatRateName: string): Promise<any>;
521
530
  /**
522
531
  * Updates the referral code for an order
523
532
  * @param orderId - The ID of the order
@@ -552,4 +561,5 @@ export declare class OrderService extends Service {
552
561
  }): Promise<any>;
553
562
  addEmployeeToStore(employeeId: string): Promise<any>;
554
563
  deleteEmployeeToStore(employeeId: string): Promise<any>;
564
+ checkNewCustomer(customerId: string, orderId: string): Promise<any>;
555
565
  }
@@ -1599,6 +1599,27 @@ class OrderService extends serviceSDK_1.Service {
1599
1599
  }
1600
1600
  });
1601
1601
  }
1602
+ /**
1603
+ * Updates VAT for an order item by VAT rate name
1604
+ * @param orderId - The ID of the order
1605
+ * @param orderItemId - The ID of the order item
1606
+ * @param vatRateName - The VAT rate name to update
1607
+ * @returns A promise that resolves when the VAT is updated
1608
+ * @throws If an error occurs while updating the VAT
1609
+ */
1610
+ updateVatByRateName(orderId, orderItemId, vatRateName) {
1611
+ return __awaiter(this, void 0, void 0, function* () {
1612
+ const endpoint = `/v2/orders/${this.orgId}/${this.storeId}/${orderId}/${orderItemId}/vat-rate-name/${vatRateName}`;
1613
+ const method = "PUT";
1614
+ try {
1615
+ const response = yield this.restApiCallWithToken(endpoint, method);
1616
+ return response;
1617
+ }
1618
+ catch (error) {
1619
+ throw error;
1620
+ }
1621
+ });
1622
+ }
1602
1623
  /**
1603
1624
  * Updates the referral code for an order
1604
1625
  * @param orderId - The ID of the order
@@ -1752,5 +1773,18 @@ class OrderService extends serviceSDK_1.Service {
1752
1773
  }
1753
1774
  });
1754
1775
  }
1776
+ checkNewCustomer(customerId, orderId) {
1777
+ return __awaiter(this, void 0, void 0, function* () {
1778
+ const endpoint = `/front/orders/${this.orgId}/${customerId}/${orderId}/newCustomer`;
1779
+ const method = "GET";
1780
+ try {
1781
+ const response = yield this.restApiCallWithToken(endpoint, method);
1782
+ return response;
1783
+ }
1784
+ catch (error) {
1785
+ throw error;
1786
+ }
1787
+ });
1788
+ }
1755
1789
  }
1756
1790
  exports.OrderService = OrderService;
@@ -58,8 +58,8 @@ class Service {
58
58
  return __awaiter(this, void 0, void 0, function* () {
59
59
  try {
60
60
  const { data, errors } = yield this.client.query({
61
- query: (0, client_1.gql) `
62
- ${query}
61
+ query: (0, client_1.gql) `
62
+ ${query}
63
63
  `,
64
64
  variables,
65
65
  context: {
@@ -85,8 +85,8 @@ class Service {
85
85
  return __awaiter(this, void 0, void 0, function* () {
86
86
  try {
87
87
  const { data, errors } = yield this.client.mutate({
88
- mutation: (0, client_1.gql) `
89
- ${mutation}
88
+ mutation: (0, client_1.gql) `
89
+ ${mutation}
90
90
  `,
91
91
  variables,
92
92
  context: {
@@ -170,8 +170,8 @@ class Service {
170
170
  return __awaiter(this, void 0, void 0, function* () {
171
171
  try {
172
172
  const { data, errors } = yield this.client.query({
173
- query: (0, client_1.gql) `
174
- ${query}
173
+ query: (0, client_1.gql) `
174
+ ${query}
175
175
  `,
176
176
  variables,
177
177
  context: {
@@ -198,8 +198,8 @@ class Service {
198
198
  return __awaiter(this, void 0, void 0, function* () {
199
199
  try {
200
200
  const { data, errors } = yield this.client.mutate({
201
- mutation: (0, client_1.gql) `
202
- ${mutation}
201
+ mutation: (0, client_1.gql) `
202
+ ${mutation}
203
203
  `,
204
204
  variables,
205
205
  context: {
@@ -225,8 +225,8 @@ class Service {
225
225
  return __awaiter(this, void 0, void 0, function* () {
226
226
  try {
227
227
  const { data, errors } = yield this.client.query({
228
- query: (0, client_1.gql) `
229
- ${query}
228
+ query: (0, client_1.gql) `
229
+ ${query}
230
230
  `,
231
231
  variables,
232
232
  context: {
@@ -253,8 +253,8 @@ class Service {
253
253
  return __awaiter(this, void 0, void 0, function* () {
254
254
  try {
255
255
  const { data, errors } = yield this.client.query({
256
- query: (0, client_1.gql) `
257
- ${query}
256
+ query: (0, client_1.gql) `
257
+ ${query}
258
258
  `,
259
259
  variables,
260
260
  context: {
@@ -281,8 +281,8 @@ class Service {
281
281
  return __awaiter(this, void 0, void 0, function* () {
282
282
  try {
283
283
  const { data, errors } = yield this.client.mutate({
284
- mutation: (0, client_1.gql) `
285
- ${mutation}
284
+ mutation: (0, client_1.gql) `
285
+ ${mutation}
286
286
  `,
287
287
  variables,
288
288
  context: {
package/package.json CHANGED
@@ -1,43 +1,43 @@
1
- {
2
- "name": "@longvansoftware/storefront-js-client",
3
- "version": "4.3.5",
4
- "main": "dist/src/index.js",
5
- "types": "dist/src/index.d.ts",
6
- "files": [
7
- "dist/**/*.d.ts",
8
- "dist/**/*.js"
9
- ],
10
- "directories": {
11
- "test": "jest"
12
- },
13
- "scripts": {
14
- "test": "jest",
15
- "build": "tsc",
16
- "publish": "npm run build && npm publish"
17
- },
18
- "keywords": [],
19
- "author": "",
20
- "license": "ISC",
21
- "dependencies": {
22
- "@apollo/client": "3.9.11",
23
- "apollo-boost": "^0.4.9",
24
- "axios": "^1.6.8",
25
- "cross-fetch": "^4.0.0",
26
- "crypto-js": "^4.2.0",
27
- "graphql": "^15.8.0",
28
- "graphql-request": "^6.1.0",
29
- "graphql-tag": "^2.12.6",
30
- "react": "^18.2.0",
31
- "ts-node": "^10.9.2"
32
- },
33
- "devDependencies": {
34
- "@types/axios": "^0.14.0",
35
- "@types/crypto-js": "^4.2.2",
36
- "@types/jest": "^29.5.12",
37
- "@types/node": "^20.12.7",
38
- "jest": "^29.7.0",
39
- "ts-jest": "^29.1.2",
40
- "typescript": "^5.4.5"
41
- },
42
- "description": ""
43
- }
1
+ {
2
+ "name": "@longvansoftware/storefront-js-client",
3
+ "version": "4.3.7-beta.0",
4
+ "main": "dist/src/index.js",
5
+ "types": "dist/src/index.d.ts",
6
+ "files": [
7
+ "dist/**/*.d.ts",
8
+ "dist/**/*.js"
9
+ ],
10
+ "directories": {
11
+ "test": "jest"
12
+ },
13
+ "scripts": {
14
+ "test": "jest",
15
+ "build": "tsc",
16
+ "publish": "npm run build && npm publish"
17
+ },
18
+ "keywords": [],
19
+ "author": "",
20
+ "license": "ISC",
21
+ "dependencies": {
22
+ "@apollo/client": "3.9.11",
23
+ "apollo-boost": "^0.4.9",
24
+ "axios": "^1.6.8",
25
+ "cross-fetch": "^4.0.0",
26
+ "crypto-js": "^4.2.0",
27
+ "graphql": "^15.8.0",
28
+ "graphql-request": "^6.1.0",
29
+ "graphql-tag": "^2.12.6",
30
+ "react": "^18.2.0",
31
+ "ts-node": "^10.9.2"
32
+ },
33
+ "devDependencies": {
34
+ "@types/axios": "^0.14.0",
35
+ "@types/crypto-js": "^4.2.2",
36
+ "@types/jest": "^29.5.12",
37
+ "@types/node": "^20.12.7",
38
+ "jest": "^29.7.0",
39
+ "ts-jest": "^29.1.2",
40
+ "typescript": "^5.4.5"
41
+ },
42
+ "description": ""
43
+ }
@@ -1 +0,0 @@
1
- export declare const SEARCH_SERVICE: import("graphql").DocumentNode;
@@ -1,71 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SEARCH_SERVICE = void 0;
4
- const graphql_tag_1 = require("graphql-tag");
5
- exports.SEARCH_SERVICE = (0, graphql_tag_1.gql) `
6
- query SearchService($filter: CloudServiceFilterInput) {
7
- searchService(filter: $filter) {
8
- total
9
- offset
10
- maxResult
11
- resultList {
12
- supplierId
13
- serviceId
14
- partnerId
15
- serviceName
16
- type
17
- typeName
18
- status
19
- statusFulfillment
20
- ownerId
21
- startDate
22
- endDate
23
- serviceType
24
- urlPrivate
25
- urlPublic
26
- username
27
- password
28
- attrs
29
- description
30
- productGroupId
31
- orderId
32
- actionRequest {
33
- id
34
- name
35
- uri
36
- type
37
- }
38
- billingCycle {
39
- quantity
40
- unit
41
- }
42
- productConfiguration {
43
- productId
44
- productTitle
45
- productResources {
46
- name
47
- quantity
48
- unit
49
- productId
50
- giftProductId
51
- gift
52
- giftQuantity
53
- campaignId
54
- campaignActionId
55
- qualify
56
- idParent
57
- addQuantity
58
- defaultQuantity
59
- title
60
- price
61
- unitPrice
62
- totalResource
63
- unitGift
64
- giftDuration
65
- giftDurationUnit
66
- }
67
- }
68
- }
69
- }
70
- }
71
- `;
@@ -1,5 +0,0 @@
1
- import { Service } from "../serviceSDK";
2
- export declare class CloudServiceService extends Service {
3
- constructor(endpoint: string, orgId: string, storeId: string);
4
- searchService(data: any): Promise<any>;
5
- }
@@ -1,35 +0,0 @@
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.CloudServiceService = void 0;
13
- const serviceSDK_1 = require("../serviceSDK");
14
- const queries_1 = require("../../graphql/cloudService/queries");
15
- class CloudServiceService extends serviceSDK_1.Service {
16
- constructor(endpoint, orgId, storeId) {
17
- super(endpoint, orgId, storeId);
18
- }
19
- searchService(data) {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- const query = queries_1.SEARCH_SERVICE;
22
- const variables = {
23
- filter: data,
24
- };
25
- try {
26
- const response = yield this.graphqlQueryV4(query, variables);
27
- return response.searchService;
28
- }
29
- catch (error) {
30
- throw error;
31
- }
32
- });
33
- }
34
- }
35
- exports.CloudServiceService = CloudServiceService;