@youidian/sdk 3.4.3 → 3.4.5
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 +55 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +55 -0
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +74 -2
- package/dist/server.d.ts +74 -2
- package/dist/server.js +55 -0
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { OrderStatus as ClientOrderStatus, LoginDeviceType, LoginEnvironment, LoginEnvironmentInput, MessageUI, PaymentEventData, PaymentEventType, PaymentParams, PaymentUI, PaymentUIOptions, PollOptions, WechatMessageBindingUIOptions, createMessageUI, createPaymentUI, detectLoginEnvironment } from './client.cjs';
|
|
2
2
|
export { FeedbackActor, FeedbackCategoryOption, FeedbackIdentityKind, FeedbackWidgetController, FeedbackWidgetOptions, createFeedbackWidget, mountFeedbackWidget } from './feedback.cjs';
|
|
3
3
|
export { L as LoginCallbackOptions, a as LoginDisplayMode, b as LoginEventData, c as LoginEventType, d as LoginFallbackRedirectMode, e as LoginParams, f as LoginResult, g as LoginUI, h as LoginUIOptions, i as createLoginUI, j as handleLoginCallbackIfPresent } from './login-Dqemys65.cjs';
|
|
4
|
-
export { ActiveSubscriptionInfo, BindPhoneNumberParams, BindPhoneNumberResponse, CancelOrderResponse, CompleteFreeOrderResponse, CreateBankTransferOrderParams, CreateMiniProgramOrderParams, CreateOrderParams, CreateOrderResponse, CreateWechatMessageBindingParams, CreateWechatMessageBindingResponse, CustomAmountRechargeRule, CustomAmountRechargeValidationResult, MerchantPricing, MerchantPricingBreakdownItem, MerchantPricingSnapshot, MessageTemplateDataValue, OrderDetails, OrderStatus, PaymentCallbackData, PaymentClient, PaymentClientOptions, PaymentNotification, PricingBreakdown, Product, ProductCustomAmount, ProductCustomAmountCurrency, ProductEntitlements, ProductInventory, ProductMetadata, ProductPrice, ProductResetRule, ProductStock, ProductStockLookupMode, ProductStockQueryOptions, ProductStocksQueryParams, ProductSubscriptionPeriod, SendMessageParams, SendMessageResponse, SendPhoneVerificationCodeParams, SendPhoneVerificationCodeResponse, VerifiedLoginToken, WebhookPayload, WechatJsapiPayParams, getCustomAmountRechargeRule, validateCustomAmountRecharge } from './server.cjs';
|
|
4
|
+
export { ActiveSubscriptionInfo, BindPhoneNumberParams, BindPhoneNumberResponse, CancelOrderResponse, CompleteFreeOrderResponse, CreateBankTransferOrderParams, CreateMiniProgramOrderParams, CreateOrderParams, CreateOrderResponse, CreateWechatMessageBindingParams, CreateWechatMessageBindingResponse, CustomAmountRechargeRule, CustomAmountRechargeValidationResult, DiscountPolicy, GetPhoneBindingParams, MerchantPricing, MerchantPricingBreakdownItem, MerchantPricingSnapshot, MessageTemplateDataValue, OrderDetails, OrderStatus, PaymentCallbackData, PaymentClient, PaymentClientOptions, PaymentNotification, PhoneBinding, PricingBreakdown, Product, ProductCustomAmount, ProductCustomAmountCurrency, ProductEntitlements, ProductInventory, ProductMetadata, ProductPrice, ProductResetRule, ProductStock, ProductStockLookupMode, ProductStockQueryOptions, ProductStocksQueryParams, ProductSubscriptionPeriod, SendMessageParams, SendMessageResponse, SendPhoneVerificationCodeParams, SendPhoneVerificationCodeResponse, UpdatePhoneNumberParams, UpdatePhoneNumberResponse, UserProductDiscountEligibility, VerifiedLoginToken, WebhookPayload, WechatJsapiPayParams, getCustomAmountRechargeRule, validateCustomAmountRecharge } from './server.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { OrderStatus as ClientOrderStatus, LoginDeviceType, LoginEnvironment, LoginEnvironmentInput, MessageUI, PaymentEventData, PaymentEventType, PaymentParams, PaymentUI, PaymentUIOptions, PollOptions, WechatMessageBindingUIOptions, createMessageUI, createPaymentUI, detectLoginEnvironment } from './client.js';
|
|
2
2
|
export { FeedbackActor, FeedbackCategoryOption, FeedbackIdentityKind, FeedbackWidgetController, FeedbackWidgetOptions, createFeedbackWidget, mountFeedbackWidget } from './feedback.js';
|
|
3
3
|
export { L as LoginCallbackOptions, a as LoginDisplayMode, b as LoginEventData, c as LoginEventType, d as LoginFallbackRedirectMode, e as LoginParams, f as LoginResult, g as LoginUI, h as LoginUIOptions, i as createLoginUI, j as handleLoginCallbackIfPresent } from './login-Dqemys65.js';
|
|
4
|
-
export { ActiveSubscriptionInfo, BindPhoneNumberParams, BindPhoneNumberResponse, CancelOrderResponse, CompleteFreeOrderResponse, CreateBankTransferOrderParams, CreateMiniProgramOrderParams, CreateOrderParams, CreateOrderResponse, CreateWechatMessageBindingParams, CreateWechatMessageBindingResponse, CustomAmountRechargeRule, CustomAmountRechargeValidationResult, MerchantPricing, MerchantPricingBreakdownItem, MerchantPricingSnapshot, MessageTemplateDataValue, OrderDetails, OrderStatus, PaymentCallbackData, PaymentClient, PaymentClientOptions, PaymentNotification, PricingBreakdown, Product, ProductCustomAmount, ProductCustomAmountCurrency, ProductEntitlements, ProductInventory, ProductMetadata, ProductPrice, ProductResetRule, ProductStock, ProductStockLookupMode, ProductStockQueryOptions, ProductStocksQueryParams, ProductSubscriptionPeriod, SendMessageParams, SendMessageResponse, SendPhoneVerificationCodeParams, SendPhoneVerificationCodeResponse, VerifiedLoginToken, WebhookPayload, WechatJsapiPayParams, getCustomAmountRechargeRule, validateCustomAmountRecharge } from './server.js';
|
|
4
|
+
export { ActiveSubscriptionInfo, BindPhoneNumberParams, BindPhoneNumberResponse, CancelOrderResponse, CompleteFreeOrderResponse, CreateBankTransferOrderParams, CreateMiniProgramOrderParams, CreateOrderParams, CreateOrderResponse, CreateWechatMessageBindingParams, CreateWechatMessageBindingResponse, CustomAmountRechargeRule, CustomAmountRechargeValidationResult, DiscountPolicy, GetPhoneBindingParams, MerchantPricing, MerchantPricingBreakdownItem, MerchantPricingSnapshot, MessageTemplateDataValue, OrderDetails, OrderStatus, PaymentCallbackData, PaymentClient, PaymentClientOptions, PaymentNotification, PhoneBinding, PricingBreakdown, Product, ProductCustomAmount, ProductCustomAmountCurrency, ProductEntitlements, ProductInventory, ProductMetadata, ProductPrice, ProductResetRule, ProductStock, ProductStockLookupMode, ProductStockQueryOptions, ProductStocksQueryParams, ProductSubscriptionPeriod, SendMessageParams, SendMessageResponse, SendPhoneVerificationCodeParams, SendPhoneVerificationCodeResponse, UpdatePhoneNumberParams, UpdatePhoneNumberResponse, UserProductDiscountEligibility, VerifiedLoginToken, WebhookPayload, WechatJsapiPayParams, getCustomAmountRechargeRule, validateCustomAmountRecharge } from './server.js';
|
package/dist/index.js
CHANGED
|
@@ -3194,6 +3194,30 @@ var PaymentClient = class {
|
|
|
3194
3194
|
const path = params.toString() ? `/products?${params.toString()}` : "/products";
|
|
3195
3195
|
return this.request("GET", path);
|
|
3196
3196
|
}
|
|
3197
|
+
/** Fetch all currently active discount policies for the configured app. */
|
|
3198
|
+
async getDiscountPolicies() {
|
|
3199
|
+
return this.request("GET", "/discount-policies");
|
|
3200
|
+
}
|
|
3201
|
+
/** Fetch currently active discount policies for one product. */
|
|
3202
|
+
async getProductDiscountPolicies(productIdOrCode) {
|
|
3203
|
+
const value = productIdOrCode?.trim();
|
|
3204
|
+
if (!value) throw new Error("productIdOrCode is required");
|
|
3205
|
+
return this.request(
|
|
3206
|
+
"GET",
|
|
3207
|
+
`/products/${encodeURIComponent(value)}/discount-policies`
|
|
3208
|
+
);
|
|
3209
|
+
}
|
|
3210
|
+
/** Query one user's discount eligibility for one product. */
|
|
3211
|
+
async getUserProductDiscountEligibility(userId, productIdOrCode) {
|
|
3212
|
+
const userValue = userId?.trim();
|
|
3213
|
+
const productValue = productIdOrCode?.trim();
|
|
3214
|
+
if (!userValue) throw new Error("userId is required");
|
|
3215
|
+
if (!productValue) throw new Error("productIdOrCode is required");
|
|
3216
|
+
return this.request(
|
|
3217
|
+
"GET",
|
|
3218
|
+
`/users/${encodeURIComponent(userValue)}/products/${encodeURIComponent(productValue)}/discount-eligibility`
|
|
3219
|
+
);
|
|
3220
|
+
}
|
|
3197
3221
|
/**
|
|
3198
3222
|
* Fetch the realtime stock snapshot for a single product.
|
|
3199
3223
|
*/
|
|
@@ -3466,6 +3490,17 @@ var PaymentClient = class {
|
|
|
3466
3490
|
}
|
|
3467
3491
|
);
|
|
3468
3492
|
}
|
|
3493
|
+
/**
|
|
3494
|
+
* Query the verified phone binding for a hosted login user.
|
|
3495
|
+
*/
|
|
3496
|
+
async getPhoneBinding(params) {
|
|
3497
|
+
const userId = params.userId?.trim();
|
|
3498
|
+
if (!userId) throw new Error("userId is required");
|
|
3499
|
+
return this.request(
|
|
3500
|
+
"GET",
|
|
3501
|
+
`/login/users/${encodeURIComponent(userId)}/phone`
|
|
3502
|
+
);
|
|
3503
|
+
}
|
|
3469
3504
|
/**
|
|
3470
3505
|
* Bind a verified phone number to a hosted login user, merging existing accounts when needed.
|
|
3471
3506
|
*/
|
|
@@ -3486,6 +3521,26 @@ var PaymentClient = class {
|
|
|
3486
3521
|
}
|
|
3487
3522
|
);
|
|
3488
3523
|
}
|
|
3524
|
+
/**
|
|
3525
|
+
* Update a hosted login user's phone number after verifying the new number by SMS code.
|
|
3526
|
+
*/
|
|
3527
|
+
async updatePhoneNumber(params) {
|
|
3528
|
+
const userId = params.userId?.trim();
|
|
3529
|
+
const phoneNumber = params.phoneNumber?.trim();
|
|
3530
|
+
const code = params.code?.trim();
|
|
3531
|
+
if (!userId) throw new Error("userId is required");
|
|
3532
|
+
if (!phoneNumber) throw new Error("phoneNumber is required");
|
|
3533
|
+
if (!code) throw new Error("code is required");
|
|
3534
|
+
return this.request(
|
|
3535
|
+
"PUT",
|
|
3536
|
+
`/login/users/${encodeURIComponent(userId)}/phone`,
|
|
3537
|
+
{
|
|
3538
|
+
code,
|
|
3539
|
+
phoneCountryCode: params.phoneCountryCode || params.countryCode,
|
|
3540
|
+
phoneNumber
|
|
3541
|
+
}
|
|
3542
|
+
);
|
|
3543
|
+
}
|
|
3489
3544
|
/**
|
|
3490
3545
|
* Create a hosted WeChat official account binding URL for a user.
|
|
3491
3546
|
*/
|