@youidian/sdk 3.4.6 → 3.5.0

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
@@ -3206,6 +3206,11 @@ var PaymentClient = class {
3206
3206
  const params = new URLSearchParams();
3207
3207
  if (options?.locale) params.append("locale", options.locale);
3208
3208
  if (options?.currency) params.append("currency", options.currency);
3209
+ if (options?.userId !== void 0) {
3210
+ const userId = options.userId.trim();
3211
+ if (!userId) throw new Error("userId must be a non-empty string");
3212
+ params.append("userId", userId);
3213
+ }
3209
3214
  const path = params.toString() ? `/products?${params.toString()}` : "/products";
3210
3215
  return this.request("GET", path);
3211
3216
  }
@@ -3394,6 +3399,18 @@ var PaymentClient = class {
3394
3399
  async getActiveSubscription(userId) {
3395
3400
  return this.request("GET", `/users/${userId}/active-subscription`);
3396
3401
  }
3402
+ async getSubscriptionUpgradeOptions(userId, options) {
3403
+ const value = userId?.trim();
3404
+ if (!value) throw new Error("userId is required");
3405
+ const params = new URLSearchParams();
3406
+ if (options?.locale) params.set("locale", options.locale);
3407
+ if (options?.currency) params.set("currency", options.currency);
3408
+ const query = params.toString() ? `?${params.toString()}` : "";
3409
+ return this.request(
3410
+ "GET",
3411
+ `/users/${encodeURIComponent(value)}/subscription-upgrade-options${query}`
3412
+ );
3413
+ }
3397
3414
  /**
3398
3415
  * Ensure user exists and auto-assign trial product if new user
3399
3416
  * This should be called when user first logs in or registers