@betterstore/sdk 0.3.19 → 0.3.21

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @betterstore/sdk
2
2
 
3
+ ## 0.3.21
4
+
5
+ ### Patch Changes
6
+
7
+ - params optimalization
8
+
9
+ ## 0.3.20
10
+
11
+ ### Patch Changes
12
+
13
+ - making helpers accesible from client
14
+
3
15
  ## 0.3.19
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -216,8 +216,8 @@ declare class Customer {
216
216
  }
217
217
 
218
218
  declare class Helpers {
219
- private apiClient;
220
- constructor(apiKey: string, proxy?: string);
219
+ proxy?: string;
220
+ constructor(proxy?: string);
221
221
  formatPrice(priceInCents: number, currency: string, exchangeRate?: number): string;
222
222
  getExchangeRate(baseCurrency: string, targetCurrency: string): Promise<number>;
223
223
  }
@@ -236,10 +236,12 @@ declare function betterStore(config: {
236
236
  checkout: Checkout;
237
237
  products: Products;
238
238
  customer: Customer;
239
- helpers: Helpers;
240
239
  };
241
- declare function createStoreClient(config: {
240
+ declare function createStoreClient(config?: {
242
241
  proxy?: string;
243
242
  }): Client;
243
+ declare function createStoreHelpers(config?: {
244
+ proxy?: string;
245
+ }): Helpers;
244
246
 
245
- export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerUpdateParams, type LineItem, type Product, type ProductOption, ProductStatus, type ProductVariant, type VariantOption, createStoreClient, betterStore as default };
247
+ export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerUpdateParams, type LineItem, type Product, type ProductOption, ProductStatus, type ProductVariant, type VariantOption, createStoreClient, createStoreHelpers, betterStore as default };
package/dist/index.d.ts CHANGED
@@ -216,8 +216,8 @@ declare class Customer {
216
216
  }
217
217
 
218
218
  declare class Helpers {
219
- private apiClient;
220
- constructor(apiKey: string, proxy?: string);
219
+ proxy?: string;
220
+ constructor(proxy?: string);
221
221
  formatPrice(priceInCents: number, currency: string, exchangeRate?: number): string;
222
222
  getExchangeRate(baseCurrency: string, targetCurrency: string): Promise<number>;
223
223
  }
@@ -236,10 +236,12 @@ declare function betterStore(config: {
236
236
  checkout: Checkout;
237
237
  products: Products;
238
238
  customer: Customer;
239
- helpers: Helpers;
240
239
  };
241
- declare function createStoreClient(config: {
240
+ declare function createStoreClient(config?: {
242
241
  proxy?: string;
243
242
  }): Client;
243
+ declare function createStoreHelpers(config?: {
244
+ proxy?: string;
245
+ }): Helpers;
244
246
 
245
- export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerUpdateParams, type LineItem, type Product, type ProductOption, ProductStatus, type ProductVariant, type VariantOption, createStoreClient, betterStore as default };
247
+ export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerUpdateParams, type LineItem, type Product, type ProductOption, ProductStatus, type ProductVariant, type VariantOption, createStoreClient, createStoreHelpers, betterStore as default };
package/dist/index.js CHANGED
@@ -53,6 +53,7 @@ __export(index_exports, {
53
53
  ProductStatus: () => ProductStatus,
54
54
  ShippingRate: () => import_shippo.Rate,
55
55
  createStoreClient: () => createStoreClient,
56
+ createStoreHelpers: () => createStoreHelpers,
56
57
  default: () => betterStore
57
58
  });
58
59
  module.exports = __toCommonJS(index_exports);
@@ -313,8 +314,8 @@ var customer_default = Customer;
313
314
  // src/helpers/index.ts
314
315
  var import_axios5 = __toESM(require("axios"));
315
316
  var Helpers = class {
316
- constructor(apiKey, proxy) {
317
- this.apiClient = createApiClient(apiKey, proxy);
317
+ constructor(proxy) {
318
+ this.proxy = proxy;
318
319
  }
319
320
  formatPrice(priceInCents, currency, exchangeRate) {
320
321
  const amount = priceInCents / 100 * (exchangeRate != null ? exchangeRate : 1);
@@ -384,16 +385,19 @@ function betterStore(config) {
384
385
  return {
385
386
  checkout: new checkout_default(config.apiKey, config.proxy),
386
387
  products: new products_default(config.apiKey, config.proxy),
387
- customer: new customer_default(config.apiKey, config.proxy),
388
- helpers: new helpers_default(config.apiKey, config.proxy)
388
+ customer: new customer_default(config.apiKey, config.proxy)
389
389
  };
390
390
  }
391
391
  function createStoreClient(config) {
392
- return new client_default(config.proxy);
392
+ return new client_default(config == null ? void 0 : config.proxy);
393
+ }
394
+ function createStoreHelpers(config) {
395
+ return new helpers_default(config == null ? void 0 : config.proxy);
393
396
  }
394
397
  // Annotate the CommonJS export names for ESM import in node:
395
398
  0 && (module.exports = {
396
399
  ProductStatus,
397
400
  ShippingRate,
398
- createStoreClient
401
+ createStoreClient,
402
+ createStoreHelpers
399
403
  });
package/dist/index.mjs CHANGED
@@ -275,8 +275,8 @@ var customer_default = Customer;
275
275
  // src/helpers/index.ts
276
276
  import axios2 from "axios";
277
277
  var Helpers = class {
278
- constructor(apiKey, proxy) {
279
- this.apiClient = createApiClient(apiKey, proxy);
278
+ constructor(proxy) {
279
+ this.proxy = proxy;
280
280
  }
281
281
  formatPrice(priceInCents, currency, exchangeRate) {
282
282
  const amount = priceInCents / 100 * (exchangeRate != null ? exchangeRate : 1);
@@ -346,16 +346,19 @@ function betterStore(config) {
346
346
  return {
347
347
  checkout: new checkout_default(config.apiKey, config.proxy),
348
348
  products: new products_default(config.apiKey, config.proxy),
349
- customer: new customer_default(config.apiKey, config.proxy),
350
- helpers: new helpers_default(config.apiKey, config.proxy)
349
+ customer: new customer_default(config.apiKey, config.proxy)
351
350
  };
352
351
  }
353
352
  function createStoreClient(config) {
354
- return new client_default(config.proxy);
353
+ return new client_default(config == null ? void 0 : config.proxy);
354
+ }
355
+ function createStoreHelpers(config) {
356
+ return new helpers_default(config == null ? void 0 : config.proxy);
355
357
  }
356
358
  export {
357
359
  ProductStatus,
358
360
  Rate as ShippingRate,
359
361
  createStoreClient,
362
+ createStoreHelpers,
360
363
  betterStore as default
361
364
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/sdk",
3
- "version": "0.3.19",
3
+ "version": "0.3.21",
4
4
  "description": "E-commerce for Developers",
5
5
  "private": false,
6
6
  "publishConfig": {