@longvansoftware/storefront-js-client 3.6.2 → 3.6.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.
@@ -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
  `;
@@ -169,6 +169,14 @@ exports.CREATE_PRODUCT_FROM_TEMPLATE = (0, graphql_tag_1.gql) `
169
169
  price
170
170
  displayPrice
171
171
  hint
172
+ brand {
173
+ id
174
+ createStamp
175
+ createdBy
176
+ name
177
+ image
178
+ imageIcon
179
+ }
172
180
  attributeDTOS {
173
181
  id
174
182
  key
@@ -119,6 +119,15 @@ exports.GET_PRODUCT_BY_ID_QUERY = (0, graphql_tag_1.gql) `
119
119
  compareAtPrice
120
120
  featuredImage
121
121
  images
122
+ tags
123
+ brand {
124
+ id
125
+ createStamp
126
+ createdBy
127
+ name
128
+ image
129
+ imageIcon
130
+ }
122
131
  productAttributes {
123
132
  attributeName
124
133
  attributeValue
@@ -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;
@@ -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.2",
3
+ "version": "3.6.4",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [