@longvansoftware/storefront-js-client 3.6.1 → 3.6.3

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.
@@ -7,3 +7,5 @@ export declare const LOGIN_FACEBOOK: import("graphql").DocumentNode;
7
7
  export declare const LOGIN_ZALO: import("graphql").DocumentNode;
8
8
  export declare const CHECK_USER_LOGIN: import("graphql").DocumentNode;
9
9
  export declare const GET_ACCESS_TOKEN_BY_OTP_QUERY: import("graphql").DocumentNode;
10
+ export declare const GET_ORGANIZATIONS_BY_PARTY_ID: import("graphql").DocumentNode;
11
+ export declare const GET_MENUS: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GET_ACCESS_TOKEN_BY_OTP_QUERY = exports.CHECK_USER_LOGIN = exports.LOGIN_ZALO = exports.LOGIN_FACEBOOK = exports.LOGIN_GOOGLE = exports.CHECK_USERNAME_EXISTED = exports.GET_USER_LOGIN_BY_USER_LOGIN_ID = exports.GET_USER_LOGIN_BY_TOKEN = exports.GET_USER_DETAIL = void 0;
3
+ exports.GET_MENUS = exports.GET_ORGANIZATIONS_BY_PARTY_ID = exports.GET_ACCESS_TOKEN_BY_OTP_QUERY = exports.CHECK_USER_LOGIN = exports.LOGIN_ZALO = exports.LOGIN_FACEBOOK = exports.LOGIN_GOOGLE = exports.CHECK_USERNAME_EXISTED = exports.GET_USER_LOGIN_BY_USER_LOGIN_ID = exports.GET_USER_LOGIN_BY_TOKEN = exports.GET_USER_DETAIL = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.GET_USER_DETAIL = (0, graphql_tag_1.gql) `
6
6
  query GetUserDetail($orgId: String!, $accessToken: String!) {
@@ -79,7 +79,64 @@ exports.CHECK_USER_LOGIN = (0, graphql_tag_1.gql) `
79
79
  }
80
80
  `;
81
81
  exports.GET_ACCESS_TOKEN_BY_OTP_QUERY = (0, graphql_tag_1.gql) `
82
- query GetAccessTokenByOTP($otpCode: String!, $phone: String!, $channelType: String) {
83
- getAccessTokenByOTP(otpCode: $otpCode, phone: $phone, channelType: $channelType)
82
+ query GetAccessTokenByOTP(
83
+ $otpCode: String!
84
+ $phone: String!
85
+ $channelType: String
86
+ ) {
87
+ getAccessTokenByOTP(
88
+ otpCode: $otpCode
89
+ phone: $phone
90
+ channelType: $channelType
91
+ )
92
+ }
93
+ `;
94
+ exports.GET_ORGANIZATIONS_BY_PARTY_ID = (0, graphql_tag_1.gql) `
95
+ query GetOrganizationsByPartyId($partyId: String!) {
96
+ getOrganizationsByPartyId(partyId: $partyId) {
97
+ id
98
+ partyId
99
+ codeId
100
+ groupName
101
+ groupType
102
+ shortName
103
+ groupNameLocal
104
+ officeSiteName
105
+ comments
106
+ logoImageUrl
107
+ isIncorporated
108
+ federalTaxId
109
+ description
110
+ deleted
111
+ status
112
+ positionIndexId
113
+ prefix
114
+ }
115
+ }
116
+ `;
117
+ exports.GET_MENUS = (0, graphql_tag_1.gql) `
118
+ query GetMenus(
119
+ $partyId: String!
120
+ $orgId: String!
121
+ $workspaceId: String
122
+ $scope: String
123
+ ) {
124
+ getMenus(
125
+ partyId: $partyId
126
+ orgId: $orgId
127
+ workspaceId: $workspaceId
128
+ scope: $scope
129
+ ) {
130
+ id
131
+ name
132
+ icon
133
+ url
134
+ childrenMenu {
135
+ id
136
+ name
137
+ icon
138
+ url
139
+ }
140
+ }
84
141
  }
85
142
  `;
@@ -22,3 +22,4 @@ export declare const CREATE_UNIT: import("graphql").DocumentNode;
22
22
  export declare const CREATE_PRODUCT_IMAGES: import("graphql").DocumentNode;
23
23
  export declare const BUILD_PRODUCT_PREBUILD_BY_PRODUCT: import("graphql").DocumentNode;
24
24
  export declare const BUILD_PRODUCT_PREBUILD_BY_STORE: import("graphql").DocumentNode;
25
+ export declare const REMOVE_PRODUCT_IMAGES: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BUILD_PRODUCT_PREBUILD_BY_STORE = exports.BUILD_PRODUCT_PREBUILD_BY_PRODUCT = exports.CREATE_PRODUCT_IMAGES = exports.CREATE_UNIT = exports.CREATE_BRAND = exports.CREATE_CATEGORY = exports.CREATE_GROUP = exports.UPDATE_PRODUCT_VAT = exports.UPDATE_PRODUCT_SKU = exports.CREATE_PRODUCT_VARIANT = exports.REMOVE_PRODUCT_ATTRIBUTE = exports.UPDATE_PRODUCT_ATTRIBUTE = exports.UPDATE_PRODUCT_BRAND = exports.SAVE_PRODUCT_DRAFT = exports.ADD_PRODUCT_ATTRIBUTE = exports.CREATE_PRODUCT_FROM_TEMPLATE = exports.CREATE_PRODUCT_TEMPLATES_BY_PARTNER = exports.CLEAR_ALL_CACHES = exports.UPDATE_UNIT = exports.UPDATE_SHORT_DESCRIPTION = exports.UPDATE_CATEGORY = exports.UPDATE_PRICE_PROMOTION = exports.UPDATE_PRICE = exports.UPDATE_PRODUCT_TITLE = void 0;
3
+ exports.REMOVE_PRODUCT_IMAGES = exports.BUILD_PRODUCT_PREBUILD_BY_STORE = exports.BUILD_PRODUCT_PREBUILD_BY_PRODUCT = exports.CREATE_PRODUCT_IMAGES = exports.CREATE_UNIT = exports.CREATE_BRAND = exports.CREATE_CATEGORY = exports.CREATE_GROUP = exports.UPDATE_PRODUCT_VAT = exports.UPDATE_PRODUCT_SKU = exports.CREATE_PRODUCT_VARIANT = exports.REMOVE_PRODUCT_ATTRIBUTE = exports.UPDATE_PRODUCT_ATTRIBUTE = exports.UPDATE_PRODUCT_BRAND = exports.SAVE_PRODUCT_DRAFT = exports.ADD_PRODUCT_ATTRIBUTE = exports.CREATE_PRODUCT_FROM_TEMPLATE = exports.CREATE_PRODUCT_TEMPLATES_BY_PARTNER = exports.CLEAR_ALL_CACHES = exports.UPDATE_UNIT = exports.UPDATE_SHORT_DESCRIPTION = exports.UPDATE_CATEGORY = exports.UPDATE_PRICE_PROMOTION = exports.UPDATE_PRICE = exports.UPDATE_PRODUCT_TITLE = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.UPDATE_PRODUCT_TITLE = (0, graphql_tag_1.gql) `
6
6
  mutation UpdateProductTitle(
@@ -557,3 +557,19 @@ exports.BUILD_PRODUCT_PREBUILD_BY_STORE = (0, graphql_tag_1.gql) `
557
557
  }
558
558
  }
559
559
  `;
560
+ exports.REMOVE_PRODUCT_IMAGES = (0, graphql_tag_1.gql) `
561
+ mutation RemoveProductImages(
562
+ $partnerId: String!
563
+ $productId: String!
564
+ $imageDTO: ImageDTOInput
565
+ ) {
566
+ removeProductImages(
567
+ partnerId: $partnerId
568
+ productId: $productId
569
+ imageDTO: $imageDTO
570
+ ) {
571
+ status
572
+ message
573
+ }
574
+ }
575
+ `;
@@ -138,4 +138,6 @@ export declare class AuthService extends Service {
138
138
  createResetKey(userLoginId: string): Promise<any>;
139
139
  checkResetKey(resetKey: string): Promise<any>;
140
140
  resetPasswordV2(orgId: string, username: string, newPassword: string, accessToken: string): Promise<any>;
141
+ getOrganizationsByPartyId(partyId: String): Promise<any>;
142
+ getMenus(partyId: string, workspaceId: string, scope: string): Promise<any>;
141
143
  }
@@ -581,7 +581,7 @@ class AuthService extends serviceSDK_1.Service {
581
581
  orgId,
582
582
  username,
583
583
  newPassword,
584
- accessToken
584
+ accessToken,
585
585
  };
586
586
  try {
587
587
  const response = yield this.graphqlMutation(mutation, variables);
@@ -592,5 +592,38 @@ class AuthService extends serviceSDK_1.Service {
592
592
  }
593
593
  });
594
594
  }
595
+ getOrganizationsByPartyId(partyId) {
596
+ return __awaiter(this, void 0, void 0, function* () {
597
+ const mutation = queries_1.GET_ORGANIZATIONS_BY_PARTY_ID;
598
+ const variables = {
599
+ partyId,
600
+ };
601
+ try {
602
+ const response = yield this.graphqlQueryV4(mutation, variables);
603
+ return response.getOrganizationsByPartyId;
604
+ }
605
+ catch (error) {
606
+ throw error;
607
+ }
608
+ });
609
+ }
610
+ getMenus(partyId, workspaceId, scope) {
611
+ return __awaiter(this, void 0, void 0, function* () {
612
+ const mutation = queries_1.GET_MENUS;
613
+ const variables = {
614
+ partyId: partyId,
615
+ orgId: this.orgId,
616
+ workspaceId: workspaceId,
617
+ scope: scope,
618
+ };
619
+ try {
620
+ const response = yield this.graphqlQueryV4(mutation, variables);
621
+ return response.getMenus;
622
+ }
623
+ catch (error) {
624
+ throw error;
625
+ }
626
+ });
627
+ }
595
628
  }
596
629
  exports.AuthService = AuthService;
@@ -68,6 +68,7 @@ export declare class ProductService extends Service {
68
68
  createBrand(brandName: string, createdBy: string): Promise<any>;
69
69
  createUnit(name: string): Promise<any>;
70
70
  createProductImages(productId: string, createdBy: string, imageDTO: any): Promise<any>;
71
+ removeProductImages(productId: string, imageDTO: any): Promise<any>;
71
72
  buildProductPreBuildByProduct(productId: string): Promise<any>;
72
73
  buildProductPreBuildByStore(storeIds: [string]): Promise<any>;
73
74
  }
@@ -699,6 +699,23 @@ class ProductService extends serviceSDK_1.Service {
699
699
  }
700
700
  });
701
701
  }
702
+ removeProductImages(productId, imageDTO) {
703
+ return __awaiter(this, void 0, void 0, function* () {
704
+ const mutations = mutations_1.REMOVE_PRODUCT_IMAGES;
705
+ const variables = {
706
+ partnerId: this.orgId,
707
+ productId,
708
+ imageDTO,
709
+ };
710
+ try {
711
+ const response = yield this.graphqlMutation(mutations, variables);
712
+ return response.removeProductImages;
713
+ }
714
+ catch (error) {
715
+ throw error;
716
+ }
717
+ });
718
+ }
702
719
  buildProductPreBuildByProduct(productId) {
703
720
  return __awaiter(this, void 0, void 0, function* () {
704
721
  const mutation = mutations_1.BUILD_PRODUCT_PREBUILD_BY_PRODUCT;
@@ -19,5 +19,6 @@ export declare class Service {
19
19
  protected graphqlQueryV2(query: DocumentNode, variables: any): Promise<any>;
20
20
  protected graphqlMutationV2(mutation: DocumentNode, variables: any): Promise<any>;
21
21
  protected graphqlQueryV3(query: DocumentNode, variables: any): Promise<any>;
22
+ protected graphqlQueryV4(query: DocumentNode, variables: any): Promise<any>;
22
23
  protected graphqlMutationV3(mutation: DocumentNode, variables: any): Promise<any>;
23
24
  }
@@ -248,6 +248,34 @@ class Service {
248
248
  }
249
249
  });
250
250
  }
251
+ graphqlQueryV4(query, variables) {
252
+ return __awaiter(this, void 0, void 0, function* () {
253
+ try {
254
+ const { data, errors } = yield this.client.query({
255
+ query: (0, client_1.gql) `
256
+ ${query}
257
+ `,
258
+ variables,
259
+ context: {
260
+ method: "POST",
261
+ headers: {
262
+ "Content-Type": "application/json",
263
+ partnerId: this.orgId,
264
+ Authorization: "Bearer " + this.token,
265
+ },
266
+ },
267
+ });
268
+ if (errors) {
269
+ throw new Error(`GraphQL error! errors: ${errors}`);
270
+ }
271
+ return data;
272
+ }
273
+ catch (error) {
274
+ console.log(`Error in graphqlQuery: ${error}`);
275
+ throw error;
276
+ }
277
+ });
278
+ }
251
279
  graphqlMutationV3(mutation, variables) {
252
280
  return __awaiter(this, void 0, void 0, function* () {
253
281
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/storefront-js-client",
3
- "version": "3.6.1",
3
+ "version": "3.6.3",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [