@back23/promptly-sdk 2.13.0 → 2.14.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.
package/dist/index.d.mts CHANGED
@@ -103,6 +103,8 @@ interface Member {
103
103
  interface AuthResponse {
104
104
  token: string;
105
105
  user: Member;
106
+ /** @alias user - for backward compatibility */
107
+ member: Member;
106
108
  }
107
109
  interface ForgotPasswordData {
108
110
  email: string;
@@ -473,6 +475,8 @@ interface OrderItem {
473
475
  order_id: number;
474
476
  product_id: number;
475
477
  variant_id?: number;
478
+ /** Product relation - populated when fetching order details */
479
+ product?: Product;
476
480
  product_name: string;
477
481
  variant_name?: string;
478
482
  thumbnail?: string;
@@ -1294,9 +1298,9 @@ declare class ShopResource {
1294
1298
  searchProducts(query: string, params?: Omit<ProductListParams, 'search'>): Promise<ListResponse<Product>>;
1295
1299
  /**
1296
1300
  * List product categories
1297
- * @returns Array of categories (always an array)
1301
+ * @returns ListResponse with data array and pagination meta
1298
1302
  */
1299
- listCategories(): Promise<ProductCategory[]>;
1303
+ listCategories(): Promise<ListResponse<ProductCategory>>;
1300
1304
  /**
1301
1305
  * Get category by ID or slug
1302
1306
  */
package/dist/index.d.ts CHANGED
@@ -103,6 +103,8 @@ interface Member {
103
103
  interface AuthResponse {
104
104
  token: string;
105
105
  user: Member;
106
+ /** @alias user - for backward compatibility */
107
+ member: Member;
106
108
  }
107
109
  interface ForgotPasswordData {
108
110
  email: string;
@@ -473,6 +475,8 @@ interface OrderItem {
473
475
  order_id: number;
474
476
  product_id: number;
475
477
  variant_id?: number;
478
+ /** Product relation - populated when fetching order details */
479
+ product?: Product;
476
480
  product_name: string;
477
481
  variant_name?: string;
478
482
  thumbnail?: string;
@@ -1294,9 +1298,9 @@ declare class ShopResource {
1294
1298
  searchProducts(query: string, params?: Omit<ProductListParams, 'search'>): Promise<ListResponse<Product>>;
1295
1299
  /**
1296
1300
  * List product categories
1297
- * @returns Array of categories (always an array)
1301
+ * @returns ListResponse with data array and pagination meta
1298
1302
  */
1299
- listCategories(): Promise<ProductCategory[]>;
1303
+ listCategories(): Promise<ListResponse<ProductCategory>>;
1300
1304
  /**
1301
1305
  * Get category by ID or slug
1302
1306
  */
package/dist/index.js CHANGED
@@ -294,6 +294,13 @@ var HttpClient = class {
294
294
  };
295
295
 
296
296
  // src/resources/auth.ts
297
+ function transformAuthResponse(response) {
298
+ return {
299
+ ...response,
300
+ // Add member alias for backward compatibility (same as user)
301
+ member: response.member ?? response.user
302
+ };
303
+ }
297
304
  var AuthResource = class {
298
305
  constructor(http) {
299
306
  this.http = http;
@@ -306,7 +313,7 @@ var AuthResource = class {
306
313
  if (response.token) {
307
314
  this.http.setToken(response.token);
308
315
  }
309
- return response;
316
+ return transformAuthResponse(response);
310
317
  }
311
318
  /**
312
319
  * Register new member
@@ -316,7 +323,7 @@ var AuthResource = class {
316
323
  if (response.token) {
317
324
  this.http.setToken(response.token);
318
325
  }
319
- return response;
326
+ return transformAuthResponse(response);
320
327
  }
321
328
  /**
322
329
  * Logout current user
@@ -372,7 +379,7 @@ var AuthResource = class {
372
379
  if (response.token) {
373
380
  this.http.setToken(response.token);
374
381
  }
375
- return response;
382
+ return transformAuthResponse(response);
376
383
  }
377
384
  /**
378
385
  * Set token manually (e.g., from localStorage)
@@ -716,11 +723,10 @@ var ShopResource = class {
716
723
  // ============================================
717
724
  /**
718
725
  * List product categories
719
- * @returns Array of categories (always an array)
726
+ * @returns ListResponse with data array and pagination meta
720
727
  */
721
728
  async listCategories() {
722
- const response = await this.http.getList("/categories");
723
- return response.data;
729
+ return this.http.getList("/categories");
724
730
  }
725
731
  /**
726
732
  * Get category by ID or slug
package/dist/index.mjs CHANGED
@@ -266,6 +266,13 @@ var HttpClient = class {
266
266
  };
267
267
 
268
268
  // src/resources/auth.ts
269
+ function transformAuthResponse(response) {
270
+ return {
271
+ ...response,
272
+ // Add member alias for backward compatibility (same as user)
273
+ member: response.member ?? response.user
274
+ };
275
+ }
269
276
  var AuthResource = class {
270
277
  constructor(http) {
271
278
  this.http = http;
@@ -278,7 +285,7 @@ var AuthResource = class {
278
285
  if (response.token) {
279
286
  this.http.setToken(response.token);
280
287
  }
281
- return response;
288
+ return transformAuthResponse(response);
282
289
  }
283
290
  /**
284
291
  * Register new member
@@ -288,7 +295,7 @@ var AuthResource = class {
288
295
  if (response.token) {
289
296
  this.http.setToken(response.token);
290
297
  }
291
- return response;
298
+ return transformAuthResponse(response);
292
299
  }
293
300
  /**
294
301
  * Logout current user
@@ -344,7 +351,7 @@ var AuthResource = class {
344
351
  if (response.token) {
345
352
  this.http.setToken(response.token);
346
353
  }
347
- return response;
354
+ return transformAuthResponse(response);
348
355
  }
349
356
  /**
350
357
  * Set token manually (e.g., from localStorage)
@@ -688,11 +695,10 @@ var ShopResource = class {
688
695
  // ============================================
689
696
  /**
690
697
  * List product categories
691
- * @returns Array of categories (always an array)
698
+ * @returns ListResponse with data array and pagination meta
692
699
  */
693
700
  async listCategories() {
694
- const response = await this.http.getList("/categories");
695
- return response.data;
701
+ return this.http.getList("/categories");
696
702
  }
697
703
  /**
698
704
  * Get category by ID or slug
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@back23/promptly-sdk",
3
- "version": "2.13.0",
3
+ "version": "2.14.1",
4
4
  "description": "Promptly AI CMS SDK for JavaScript/TypeScript",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",