@longvansoftware/storefront-js-client 4.2.6 → 4.2.8

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,4 +1,5 @@
1
1
  export declare const GET_PRODUCT_BY_ID_QUERY: import("graphql").DocumentNode;
2
+ export declare const GET_SIMPLE_PRODUCT_BY_ID_QUERY: import("graphql").DocumentNode;
2
3
  export declare const GET_PRODUCT_BY_SLUG_QUERY: import("graphql").DocumentNode;
3
4
  export declare const GET_SIMPLE_PRODUCTS_QUERY: import("graphql").DocumentNode;
4
5
  export declare const GET_CATEGORIES_QUERY: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GET_CATEGORY_BY_HANDLE = exports.GET_CATEGORY_BY_ID = exports.GET_PRODUCT_BY_GROUPID = exports.GET_TAGS = exports.GET_BRAND = exports.GET_GROUPS = exports.GET_PRODUCT_TEMPLATES = exports.GET_PRODUCT_VARIANT_BY_ID = exports.GET_UNITS = exports.GET_PRODUCT = exports.GET_PRODUCT_IMAGE = exports.GET_DETAIL_STORES = exports.GET_STORES = exports.GET_POLICY = exports.GET_PRODUCT_OPTION = exports.GET_BRAND_DETAIL_QUERY = exports.GET_BRANDS_BY_CATEGORY_QUERY = exports.GET_BRANDS_QUERY = exports.GET_CATEGORY_BY_ID_QUERY = exports.GET_CATEGORY_BY_HANDLE_QUERY = exports.GET_CATEGORIES_QUERY = exports.GET_SIMPLE_PRODUCTS_QUERY = exports.GET_PRODUCT_BY_SLUG_QUERY = exports.GET_PRODUCT_BY_ID_QUERY = void 0;
3
+ exports.GET_CATEGORY_BY_HANDLE = exports.GET_CATEGORY_BY_ID = exports.GET_PRODUCT_BY_GROUPID = exports.GET_TAGS = exports.GET_BRAND = exports.GET_GROUPS = exports.GET_PRODUCT_TEMPLATES = exports.GET_PRODUCT_VARIANT_BY_ID = exports.GET_UNITS = exports.GET_PRODUCT = exports.GET_PRODUCT_IMAGE = exports.GET_DETAIL_STORES = exports.GET_STORES = exports.GET_POLICY = exports.GET_PRODUCT_OPTION = exports.GET_BRAND_DETAIL_QUERY = exports.GET_BRANDS_BY_CATEGORY_QUERY = exports.GET_BRANDS_QUERY = exports.GET_CATEGORY_BY_ID_QUERY = exports.GET_CATEGORY_BY_HANDLE_QUERY = exports.GET_CATEGORIES_QUERY = exports.GET_SIMPLE_PRODUCTS_QUERY = exports.GET_PRODUCT_BY_SLUG_QUERY = exports.GET_SIMPLE_PRODUCT_BY_ID_QUERY = exports.GET_PRODUCT_BY_ID_QUERY = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  // export const GET_PRODUCT_BY_ID_QUERY = gql`
6
6
  // query GetProductById(
@@ -175,6 +175,137 @@ exports.GET_PRODUCT_BY_ID_QUERY = (0, graphql_tag_1.gql) `
175
175
  description
176
176
  createStamp
177
177
  createdBy
178
+ usedCreatedChild
179
+ valuesFull {
180
+ id
181
+ name
182
+ }
183
+ }
184
+ }
185
+ featureTypes {
186
+ id
187
+ name
188
+ values
189
+ valuesFull {
190
+ id
191
+ name
192
+ }
193
+ }
194
+ categories {
195
+ id
196
+ title
197
+ handle
198
+ }
199
+ unitDTO {
200
+ id
201
+ name
202
+ }
203
+ }
204
+ }
205
+ `;
206
+ exports.GET_SIMPLE_PRODUCT_BY_ID_QUERY = (0, graphql_tag_1.gql) `
207
+ query GetSimpleProductById(
208
+ $partnerId: String!
209
+ $storeChannel: String!
210
+ $productId: String!
211
+ ) {
212
+ getSimpleProductById(
213
+ partnerId: $partnerId
214
+ storeChannel: $storeChannel
215
+ productId: $productId
216
+ ) {
217
+ id
218
+ title
219
+ description
220
+ sku
221
+ shortDescription
222
+ weight
223
+ width
224
+ depth
225
+ height
226
+ vat
227
+ priceType
228
+ qualify
229
+ parentId
230
+ handle
231
+ price
232
+ options
233
+ optionsRelationship
234
+ compareAtPrice
235
+ featuredImage
236
+ images
237
+ tags
238
+ brand {
239
+ id
240
+ createStamp
241
+ createdBy
242
+ name
243
+ image
244
+ imageIcon
245
+ }
246
+ featureTypes {
247
+ id
248
+ keyId
249
+ name
250
+ position
251
+ type
252
+ subType
253
+ fill
254
+ requireData
255
+ otherItem
256
+ values
257
+ description
258
+ createStamp
259
+ createdBy
260
+ usedCreatedChild
261
+ }
262
+ attributeDTOS {
263
+ id
264
+ key
265
+ extendFromSource
266
+ value {
267
+ name
268
+ value
269
+ }
270
+ metadata {
271
+ type
272
+ dataFrom
273
+ description
274
+ requiredData
275
+ otherItem
276
+ fill
277
+ }
278
+ }
279
+ productAttributes {
280
+ attributeName
281
+ attributeValue
282
+ }
283
+ variants {
284
+ id
285
+ handle
286
+ title
287
+ price
288
+ compareAtPrice
289
+ options
290
+ optionsIds
291
+ featuredImage
292
+ sku
293
+ priceType
294
+ featureTypeDTOS {
295
+ id
296
+ keyId
297
+ name
298
+ position
299
+ type
300
+ subType
301
+ fill
302
+ requireData
303
+ otherItem
304
+ values
305
+ description
306
+ createStamp
307
+ createdBy
308
+ usedCreatedChild
178
309
  valuesFull {
179
310
  id
180
311
  name
@@ -29,4 +29,5 @@ export declare class PortalService extends Service {
29
29
  updateSchedule(orgId: string, data: Record<string, any>): Promise<any>;
30
30
  getPosition(query?: Record<string, any>): Promise<any>;
31
31
  getPositionForTime(query?: Record<string, any>): Promise<any>;
32
+ getBookingCount(query?: Record<string, any>): Promise<any>;
32
33
  }
@@ -428,5 +428,29 @@ class PortalService extends serviceSDK_1.Service {
428
428
  }
429
429
  });
430
430
  }
431
+ getBookingCount(query) {
432
+ return __awaiter(this, void 0, void 0, function* () {
433
+ const method = "GET";
434
+ const baseUrl = `/dynamic-collection/public/v2/countBooking`;
435
+ const params = new URLSearchParams();
436
+ if (query) {
437
+ Object.entries(query).forEach(([key, value]) => {
438
+ if (value !== undefined && value !== null) {
439
+ params.append(key, String(value));
440
+ }
441
+ });
442
+ }
443
+ const endpoint = params.toString()
444
+ ? `${baseUrl}?${params.toString()}`
445
+ : baseUrl;
446
+ try {
447
+ const response = yield this.restApiCallWithNoToken(endpoint, method);
448
+ return response;
449
+ }
450
+ catch (error) {
451
+ throw error;
452
+ }
453
+ });
454
+ }
431
455
  }
432
456
  exports.PortalService = PortalService;
@@ -18,6 +18,7 @@ export declare class ProductService extends Service {
18
18
  * @throws If an error occurs while fetching the product.
19
19
  */
20
20
  getProductById(productId: string): Promise<any>;
21
+ getSimpleProductById(productId: string): Promise<any>;
21
22
  /**
22
23
  * Retrieves a product by its slug.
23
24
  * @param slug - The slug of the product.
@@ -66,6 +66,24 @@ class ProductService extends serviceSDK_1.Service {
66
66
  }
67
67
  });
68
68
  }
69
+ getSimpleProductById(productId) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ const query = queries_1.GET_SIMPLE_PRODUCT_BY_ID_QUERY;
72
+ const variables = {
73
+ partnerId: this.orgId,
74
+ storeChannel: this.storeId,
75
+ productId,
76
+ };
77
+ try {
78
+ const response = yield this.graphqlQuery(query, variables);
79
+ return response.getSimpleProductById;
80
+ }
81
+ catch (error) {
82
+ console.log(`Error fetching product by ID: ${error}`);
83
+ throw error;
84
+ }
85
+ });
86
+ }
69
87
  /**
70
88
  * Retrieves a product by its slug.
71
89
  * @param slug - The slug of the product.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/storefront-js-client",
3
- "version": "4.2.6",
3
+ "version": "4.2.8",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [