@youidian/sdk 3.4.5 → 3.4.6
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 +22 -5
- 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 +21 -5
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +22 -5
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +89 -2
- package/dist/server.d.ts +89 -2
- package/dist/server.js +21 -5
- 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, 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';
|
|
4
|
+
export { ActiveSubscriptionInfo, BillingSnapshot, BindPhoneNumberParams, BindPhoneNumberResponse, CancelOrderResponse, CompleteFreeOrderResponse, CreateBankTransferOrderParams, CreateMiniProgramOrderParams, CreateOrderParams, CreateOrderResponse, CreateWechatMessageBindingParams, CreateWechatMessageBindingResponse, CustomAmountRechargeRule, CustomAmountRechargeValidationResult, DiscountPolicy, GetPhoneBindingParams, MerchantPricing, MerchantPricingBreakdownItem, MerchantPricingSnapshot, MessageTemplateDataValue, OrderDetails, OrderStatus, PaymentApiError, PaymentCallbackData, PaymentClient, PaymentClientOptions, PaymentNotification, PhoneBinding, PricingBreakdown, Product, ProductCustomAmount, ProductCustomAmountCurrency, ProductEntitlements, ProductInventory, ProductMetadata, ProductPrice, ProductResetRule, ProductStock, ProductStockLookupMode, ProductStockQueryOptions, ProductStocksQueryParams, ProductSubscriptionPeriod, SendMessageParams, SendMessageResponse, SendPhoneVerificationCodeParams, SendPhoneVerificationCodeResponse, SubscriptionAction, SubscriptionAutoRefundStatus, SubscriptionBillingSnapshot, SubscriptionDetails, SubscriptionErrorCode, SubscriptionStatus, 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, 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';
|
|
4
|
+
export { ActiveSubscriptionInfo, BillingSnapshot, BindPhoneNumberParams, BindPhoneNumberResponse, CancelOrderResponse, CompleteFreeOrderResponse, CreateBankTransferOrderParams, CreateMiniProgramOrderParams, CreateOrderParams, CreateOrderResponse, CreateWechatMessageBindingParams, CreateWechatMessageBindingResponse, CustomAmountRechargeRule, CustomAmountRechargeValidationResult, DiscountPolicy, GetPhoneBindingParams, MerchantPricing, MerchantPricingBreakdownItem, MerchantPricingSnapshot, MessageTemplateDataValue, OrderDetails, OrderStatus, PaymentApiError, PaymentCallbackData, PaymentClient, PaymentClientOptions, PaymentNotification, PhoneBinding, PricingBreakdown, Product, ProductCustomAmount, ProductCustomAmountCurrency, ProductEntitlements, ProductInventory, ProductMetadata, ProductPrice, ProductResetRule, ProductStock, ProductStockLookupMode, ProductStockQueryOptions, ProductStocksQueryParams, ProductSubscriptionPeriod, SendMessageParams, SendMessageResponse, SendPhoneVerificationCodeParams, SendPhoneVerificationCodeResponse, SubscriptionAction, SubscriptionAutoRefundStatus, SubscriptionBillingSnapshot, SubscriptionDetails, SubscriptionErrorCode, SubscriptionStatus, UpdatePhoneNumberParams, UpdatePhoneNumberResponse, UserProductDiscountEligibility, VerifiedLoginToken, WebhookPayload, WechatJsapiPayParams, getCustomAmountRechargeRule, validateCustomAmountRecharge } from './server.js';
|
package/dist/index.js
CHANGED
|
@@ -2996,6 +2996,16 @@ function mountFeedbackWidget(container, options) {
|
|
|
2996
2996
|
|
|
2997
2997
|
// src/server.ts
|
|
2998
2998
|
import crypto2 from "crypto";
|
|
2999
|
+
var PaymentApiError = class extends Error {
|
|
3000
|
+
constructor(message, status, code) {
|
|
3001
|
+
super(message);
|
|
3002
|
+
__publicField(this, "status");
|
|
3003
|
+
__publicField(this, "code");
|
|
3004
|
+
this.name = "PaymentApiError";
|
|
3005
|
+
this.status = status;
|
|
3006
|
+
this.code = code;
|
|
3007
|
+
}
|
|
3008
|
+
};
|
|
2999
3009
|
function getCustomAmountRechargeRule(product, currency) {
|
|
3000
3010
|
if (!product || product.type !== "CREDIT") return null;
|
|
3001
3011
|
const normalizedCurrency = currency.trim().toUpperCase();
|
|
@@ -3110,14 +3120,19 @@ var PaymentClient = class {
|
|
|
3110
3120
|
} catch {
|
|
3111
3121
|
}
|
|
3112
3122
|
const message = parsedError?.message || parsedError?.error || errorText || "Request failed";
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3123
|
+
throw new PaymentApiError(
|
|
3124
|
+
message,
|
|
3125
|
+
response.status,
|
|
3126
|
+
parsedError?.code || void 0
|
|
3127
|
+
);
|
|
3117
3128
|
}
|
|
3118
3129
|
const json = await response.json();
|
|
3119
3130
|
if (json.error) {
|
|
3120
|
-
throw new
|
|
3131
|
+
throw new PaymentApiError(
|
|
3132
|
+
`Payment API Error: ${json.error}`,
|
|
3133
|
+
response.status,
|
|
3134
|
+
json.code
|
|
3135
|
+
);
|
|
3121
3136
|
}
|
|
3122
3137
|
return json.data;
|
|
3123
3138
|
}
|
|
@@ -3572,6 +3587,7 @@ var PaymentClient = class {
|
|
|
3572
3587
|
export {
|
|
3573
3588
|
LoginUI,
|
|
3574
3589
|
MessageUI,
|
|
3590
|
+
PaymentApiError,
|
|
3575
3591
|
PaymentClient,
|
|
3576
3592
|
PaymentUI,
|
|
3577
3593
|
createFeedbackWidget,
|