@dodopayments/hono 0.2.3 → 0.2.4
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 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -3
package/dist/index.js
CHANGED
|
@@ -7163,6 +7163,13 @@ var checkoutSessionCustomizationSchema = objectType({
|
|
|
7163
7163
|
}).optional();
|
|
7164
7164
|
var checkoutSessionFeatureFlagsSchema = objectType({
|
|
7165
7165
|
allow_currency_selection: booleanType().optional(),
|
|
7166
|
+
allow_customer_editing_city: booleanType().optional(),
|
|
7167
|
+
allow_customer_editing_country: booleanType().optional(),
|
|
7168
|
+
allow_customer_editing_email: booleanType().optional(),
|
|
7169
|
+
allow_customer_editing_name: booleanType().optional(),
|
|
7170
|
+
allow_customer_editing_state: booleanType().optional(),
|
|
7171
|
+
allow_customer_editing_street: booleanType().optional(),
|
|
7172
|
+
allow_customer_editing_zipcode: booleanType().optional(),
|
|
7166
7173
|
allow_discount_code: booleanType().optional(),
|
|
7167
7174
|
allow_phone_number_collection: booleanType().optional(),
|
|
7168
7175
|
allow_tax_id: booleanType().optional(),
|
|
@@ -7263,7 +7270,11 @@ var buildCheckoutUrl = async ({
|
|
|
7263
7270
|
if (!sessionPayload) {
|
|
7264
7271
|
throw new Error("sessionPayload is required when type is 'session'");
|
|
7265
7272
|
}
|
|
7266
|
-
const
|
|
7273
|
+
const finalPayload = {
|
|
7274
|
+
...sessionPayload,
|
|
7275
|
+
return_url: sessionPayload.return_url ?? returnUrl
|
|
7276
|
+
};
|
|
7277
|
+
const session = await createCheckoutSession(finalPayload, {
|
|
7267
7278
|
bearerToken,
|
|
7268
7279
|
environment
|
|
7269
7280
|
});
|
|
@@ -7913,6 +7924,12 @@ var SubscriptionExpiredPayloadSchema = objectType({
|
|
|
7913
7924
|
timestamp: stringType().transform((d) => new Date(d)),
|
|
7914
7925
|
data: SubscriptionSchema
|
|
7915
7926
|
});
|
|
7927
|
+
var SubscriptionUpdatedPayloadSchema = objectType({
|
|
7928
|
+
business_id: stringType(),
|
|
7929
|
+
type: literalType("subscription.updated"),
|
|
7930
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
7931
|
+
data: SubscriptionSchema
|
|
7932
|
+
});
|
|
7916
7933
|
var LicenseKeyCreatedPayloadSchema = objectType({
|
|
7917
7934
|
business_id: stringType(),
|
|
7918
7935
|
type: literalType("license_key.created"),
|
|
@@ -7941,6 +7958,7 @@ var WebhookPayloadSchema = discriminatedUnionType("type", [
|
|
|
7941
7958
|
SubscriptionCancelledPayloadSchema,
|
|
7942
7959
|
SubscriptionFailedPayloadSchema,
|
|
7943
7960
|
SubscriptionExpiredPayloadSchema,
|
|
7961
|
+
SubscriptionUpdatedPayloadSchema,
|
|
7944
7962
|
LicenseKeyCreatedPayloadSchema
|
|
7945
7963
|
]);
|
|
7946
7964
|
|
|
@@ -8015,6 +8033,9 @@ async function handleWebhookPayload(payload, config, context) {
|
|
|
8015
8033
|
if (payload.type === "subscription.expired") {
|
|
8016
8034
|
await callHandler(config.onSubscriptionExpired, payload);
|
|
8017
8035
|
}
|
|
8036
|
+
if (payload.type === "subscription.updated") {
|
|
8037
|
+
await callHandler(config.onSubscriptionUpdated, payload);
|
|
8038
|
+
}
|
|
8018
8039
|
if (payload.type === "license_key.created") {
|
|
8019
8040
|
await callHandler(config.onLicenseKeyCreated, payload);
|
|
8020
8041
|
}
|