@diffsome/sdk 3.2.6 → 3.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.
package/dist/index.js CHANGED
@@ -418,7 +418,7 @@ var AuthResource = class {
418
418
  * Get available social login providers
419
419
  */
420
420
  async getSocialProviders() {
421
- return this.http.get("/auth/social");
421
+ return this.http.get("/auth/social/providers");
422
422
  }
423
423
  /**
424
424
  * Get social login redirect URL
@@ -1226,6 +1226,22 @@ var ShopResource = class {
1226
1226
  async createSetupIntent() {
1227
1227
  return this.http.post("/subscriptions/setup-intent");
1228
1228
  }
1229
+ /**
1230
+ * Create Stripe Checkout Session for subscription
1231
+ * Redirects to Stripe Checkout page
1232
+ * Requires authentication
1233
+ */
1234
+ async createSubscriptionCheckout(data) {
1235
+ return this.http.post("/subscriptions/checkout", data);
1236
+ }
1237
+ /**
1238
+ * Verify Stripe Checkout Session for subscription
1239
+ * Call after returning from Stripe Checkout
1240
+ * Requires authentication
1241
+ */
1242
+ async verifySubscriptionCheckout(session_id) {
1243
+ return this.http.post("/subscriptions/verify", { session_id });
1244
+ }
1229
1245
  // ============================================
1230
1246
  // Bundle Products
1231
1247
  // ============================================
@@ -1653,6 +1669,42 @@ var ReservationResource = class {
1653
1669
  }
1654
1670
  };
1655
1671
 
1672
+ // src/resources/site.ts
1673
+ var SiteResource = class {
1674
+ constructor(http) {
1675
+ this.http = http;
1676
+ }
1677
+ /**
1678
+ * Get site information
1679
+ * Returns site settings including currency, SEO, contact info
1680
+ */
1681
+ async getInfo() {
1682
+ return this.http.get("/site");
1683
+ }
1684
+ /**
1685
+ * Get currency info only (lightweight)
1686
+ */
1687
+ async getCurrency() {
1688
+ const response = await this.http.get("/site/currency");
1689
+ return response.currency;
1690
+ }
1691
+ /**
1692
+ * Format price with site's currency settings
1693
+ * @param amount - The amount to format
1694
+ * @param currency - Optional currency info (uses fetched currency if not provided)
1695
+ */
1696
+ formatPrice(amount, currency) {
1697
+ const formatted = amount.toLocaleString(void 0, {
1698
+ minimumFractionDigits: currency.decimals,
1699
+ maximumFractionDigits: currency.decimals
1700
+ });
1701
+ if (currency.position === "after") {
1702
+ return `${formatted}${currency.symbol}`;
1703
+ }
1704
+ return `${currency.symbol}${formatted}`;
1705
+ }
1706
+ };
1707
+
1656
1708
  // src/index.ts
1657
1709
  var Diffsome = class {
1658
1710
  constructor(config) {
@@ -1669,6 +1721,7 @@ var Diffsome = class {
1669
1721
  this.media = new MediaResource(this.http);
1670
1722
  this.entities = new EntitiesResource(this.http);
1671
1723
  this.reservation = new ReservationResource(this.http);
1724
+ this.site = new SiteResource(this.http);
1672
1725
  }
1673
1726
  /**
1674
1727
  * Check if user is authenticated
package/dist/index.mjs CHANGED
@@ -388,7 +388,7 @@ var AuthResource = class {
388
388
  * Get available social login providers
389
389
  */
390
390
  async getSocialProviders() {
391
- return this.http.get("/auth/social");
391
+ return this.http.get("/auth/social/providers");
392
392
  }
393
393
  /**
394
394
  * Get social login redirect URL
@@ -1196,6 +1196,22 @@ var ShopResource = class {
1196
1196
  async createSetupIntent() {
1197
1197
  return this.http.post("/subscriptions/setup-intent");
1198
1198
  }
1199
+ /**
1200
+ * Create Stripe Checkout Session for subscription
1201
+ * Redirects to Stripe Checkout page
1202
+ * Requires authentication
1203
+ */
1204
+ async createSubscriptionCheckout(data) {
1205
+ return this.http.post("/subscriptions/checkout", data);
1206
+ }
1207
+ /**
1208
+ * Verify Stripe Checkout Session for subscription
1209
+ * Call after returning from Stripe Checkout
1210
+ * Requires authentication
1211
+ */
1212
+ async verifySubscriptionCheckout(session_id) {
1213
+ return this.http.post("/subscriptions/verify", { session_id });
1214
+ }
1199
1215
  // ============================================
1200
1216
  // Bundle Products
1201
1217
  // ============================================
@@ -1623,6 +1639,42 @@ var ReservationResource = class {
1623
1639
  }
1624
1640
  };
1625
1641
 
1642
+ // src/resources/site.ts
1643
+ var SiteResource = class {
1644
+ constructor(http) {
1645
+ this.http = http;
1646
+ }
1647
+ /**
1648
+ * Get site information
1649
+ * Returns site settings including currency, SEO, contact info
1650
+ */
1651
+ async getInfo() {
1652
+ return this.http.get("/site");
1653
+ }
1654
+ /**
1655
+ * Get currency info only (lightweight)
1656
+ */
1657
+ async getCurrency() {
1658
+ const response = await this.http.get("/site/currency");
1659
+ return response.currency;
1660
+ }
1661
+ /**
1662
+ * Format price with site's currency settings
1663
+ * @param amount - The amount to format
1664
+ * @param currency - Optional currency info (uses fetched currency if not provided)
1665
+ */
1666
+ formatPrice(amount, currency) {
1667
+ const formatted = amount.toLocaleString(void 0, {
1668
+ minimumFractionDigits: currency.decimals,
1669
+ maximumFractionDigits: currency.decimals
1670
+ });
1671
+ if (currency.position === "after") {
1672
+ return `${formatted}${currency.symbol}`;
1673
+ }
1674
+ return `${currency.symbol}${formatted}`;
1675
+ }
1676
+ };
1677
+
1626
1678
  // src/index.ts
1627
1679
  var Diffsome = class {
1628
1680
  constructor(config) {
@@ -1639,6 +1691,7 @@ var Diffsome = class {
1639
1691
  this.media = new MediaResource(this.http);
1640
1692
  this.entities = new EntitiesResource(this.http);
1641
1693
  this.reservation = new ReservationResource(this.http);
1694
+ this.site = new SiteResource(this.http);
1642
1695
  }
1643
1696
  /**
1644
1697
  * Check if user is authenticated
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diffsome/sdk",
3
- "version": "3.2.6",
3
+ "version": "3.2.8",
4
4
  "description": "Diffsome SDK for JavaScript/TypeScript - Different + Awesome",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -33,7 +33,7 @@
33
33
  "license": "MIT",
34
34
  "repository": {
35
35
  "type": "git",
36
- "url": "https://github.com/diffsome/sdk.git"
36
+ "url": "https://github.com/diffsome/diffsome-sdk.git"
37
37
  },
38
38
  "devDependencies": {
39
39
  "openapi-typescript": "^7.10.1",