@dodopayments/astro 0.2.4 → 0.2.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 +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.cjs
CHANGED
|
@@ -7165,6 +7165,13 @@ var checkoutSessionCustomizationSchema = objectType({
|
|
|
7165
7165
|
}).optional();
|
|
7166
7166
|
var checkoutSessionFeatureFlagsSchema = objectType({
|
|
7167
7167
|
allow_currency_selection: booleanType().optional(),
|
|
7168
|
+
allow_customer_editing_city: booleanType().optional(),
|
|
7169
|
+
allow_customer_editing_country: booleanType().optional(),
|
|
7170
|
+
allow_customer_editing_email: booleanType().optional(),
|
|
7171
|
+
allow_customer_editing_name: booleanType().optional(),
|
|
7172
|
+
allow_customer_editing_state: booleanType().optional(),
|
|
7173
|
+
allow_customer_editing_street: booleanType().optional(),
|
|
7174
|
+
allow_customer_editing_zipcode: booleanType().optional(),
|
|
7168
7175
|
allow_discount_code: booleanType().optional(),
|
|
7169
7176
|
allow_phone_number_collection: booleanType().optional(),
|
|
7170
7177
|
allow_tax_id: booleanType().optional(),
|
|
@@ -7265,7 +7272,11 @@ var buildCheckoutUrl = async ({
|
|
|
7265
7272
|
if (!sessionPayload) {
|
|
7266
7273
|
throw new Error("sessionPayload is required when type is 'session'");
|
|
7267
7274
|
}
|
|
7268
|
-
const
|
|
7275
|
+
const finalPayload = {
|
|
7276
|
+
...sessionPayload,
|
|
7277
|
+
return_url: sessionPayload.return_url ?? returnUrl
|
|
7278
|
+
};
|
|
7279
|
+
const session = await createCheckoutSession(finalPayload, {
|
|
7269
7280
|
bearerToken,
|
|
7270
7281
|
environment
|
|
7271
7282
|
});
|
|
@@ -7930,6 +7941,12 @@ var SubscriptionExpiredPayloadSchema = objectType({
|
|
|
7930
7941
|
timestamp: stringType().transform((d) => new Date(d)),
|
|
7931
7942
|
data: SubscriptionSchema
|
|
7932
7943
|
});
|
|
7944
|
+
var SubscriptionUpdatedPayloadSchema = objectType({
|
|
7945
|
+
business_id: stringType(),
|
|
7946
|
+
type: literalType("subscription.updated"),
|
|
7947
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
7948
|
+
data: SubscriptionSchema
|
|
7949
|
+
});
|
|
7933
7950
|
var LicenseKeyCreatedPayloadSchema = objectType({
|
|
7934
7951
|
business_id: stringType(),
|
|
7935
7952
|
type: literalType("license_key.created"),
|
|
@@ -7958,6 +7975,7 @@ var WebhookPayloadSchema = discriminatedUnionType("type", [
|
|
|
7958
7975
|
SubscriptionCancelledPayloadSchema,
|
|
7959
7976
|
SubscriptionFailedPayloadSchema,
|
|
7960
7977
|
SubscriptionExpiredPayloadSchema,
|
|
7978
|
+
SubscriptionUpdatedPayloadSchema,
|
|
7961
7979
|
LicenseKeyCreatedPayloadSchema
|
|
7962
7980
|
]);
|
|
7963
7981
|
|
|
@@ -8032,6 +8050,9 @@ async function handleWebhookPayload(payload, config, context) {
|
|
|
8032
8050
|
if (payload.type === "subscription.expired") {
|
|
8033
8051
|
await callHandler(config.onSubscriptionExpired, payload);
|
|
8034
8052
|
}
|
|
8053
|
+
if (payload.type === "subscription.updated") {
|
|
8054
|
+
await callHandler(config.onSubscriptionUpdated, payload);
|
|
8055
|
+
}
|
|
8035
8056
|
if (payload.type === "license_key.created") {
|
|
8036
8057
|
await callHandler(config.onLicenseKeyCreated, payload);
|
|
8037
8058
|
}
|