@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.cjs CHANGED
@@ -3253,6 +3253,11 @@ var PaymentClient = class {
3253
3253
  const params = new URLSearchParams();
3254
3254
  if (options?.locale) params.append("locale", options.locale);
3255
3255
  if (options?.currency) params.append("currency", options.currency);
3256
+ if (options?.userId !== void 0) {
3257
+ const userId = options.userId.trim();
3258
+ if (!userId) throw new Error("userId must be a non-empty string");
3259
+ params.append("userId", userId);
3260
+ }
3256
3261
  const path = params.toString() ? `/products?${params.toString()}` : "/products";
3257
3262
  return this.request("GET", path);
3258
3263
  }
@@ -3441,6 +3446,18 @@ var PaymentClient = class {
3441
3446
  async getActiveSubscription(userId) {
3442
3447
  return this.request("GET", `/users/${userId}/active-subscription`);
3443
3448
  }
3449
+ async getSubscriptionUpgradeOptions(userId, options) {
3450
+ const value = userId?.trim();
3451
+ if (!value) throw new Error("userId is required");
3452
+ const params = new URLSearchParams();
3453
+ if (options?.locale) params.set("locale", options.locale);
3454
+ if (options?.currency) params.set("currency", options.currency);
3455
+ const query = params.toString() ? `?${params.toString()}` : "";
3456
+ return this.request(
3457
+ "GET",
3458
+ `/users/${encodeURIComponent(value)}/subscription-upgrade-options${query}`
3459
+ );
3460
+ }
3444
3461
  /**
3445
3462
  * Ensure user exists and auto-assign trial product if new user
3446
3463
  * This should be called when user first logs in or registers