@dodopayments/sveltekit 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
|
@@ -7257,6 +7257,13 @@ var checkoutSessionCustomizationSchema = objectType({
|
|
|
7257
7257
|
}).optional();
|
|
7258
7258
|
var checkoutSessionFeatureFlagsSchema = objectType({
|
|
7259
7259
|
allow_currency_selection: booleanType().optional(),
|
|
7260
|
+
allow_customer_editing_city: booleanType().optional(),
|
|
7261
|
+
allow_customer_editing_country: booleanType().optional(),
|
|
7262
|
+
allow_customer_editing_email: booleanType().optional(),
|
|
7263
|
+
allow_customer_editing_name: booleanType().optional(),
|
|
7264
|
+
allow_customer_editing_state: booleanType().optional(),
|
|
7265
|
+
allow_customer_editing_street: booleanType().optional(),
|
|
7266
|
+
allow_customer_editing_zipcode: booleanType().optional(),
|
|
7260
7267
|
allow_discount_code: booleanType().optional(),
|
|
7261
7268
|
allow_phone_number_collection: booleanType().optional(),
|
|
7262
7269
|
allow_tax_id: booleanType().optional(),
|
|
@@ -7357,7 +7364,11 @@ var buildCheckoutUrl = async ({
|
|
|
7357
7364
|
if (!sessionPayload) {
|
|
7358
7365
|
throw new Error("sessionPayload is required when type is 'session'");
|
|
7359
7366
|
}
|
|
7360
|
-
const
|
|
7367
|
+
const finalPayload = {
|
|
7368
|
+
...sessionPayload,
|
|
7369
|
+
return_url: sessionPayload.return_url ?? returnUrl
|
|
7370
|
+
};
|
|
7371
|
+
const session = await createCheckoutSession(finalPayload, {
|
|
7361
7372
|
bearerToken,
|
|
7362
7373
|
environment
|
|
7363
7374
|
});
|
|
@@ -7977,6 +7988,12 @@ var SubscriptionExpiredPayloadSchema = objectType({
|
|
|
7977
7988
|
timestamp: stringType().transform((d) => new Date(d)),
|
|
7978
7989
|
data: SubscriptionSchema
|
|
7979
7990
|
});
|
|
7991
|
+
var SubscriptionUpdatedPayloadSchema = objectType({
|
|
7992
|
+
business_id: stringType(),
|
|
7993
|
+
type: literalType("subscription.updated"),
|
|
7994
|
+
timestamp: stringType().transform((d) => new Date(d)),
|
|
7995
|
+
data: SubscriptionSchema
|
|
7996
|
+
});
|
|
7980
7997
|
var LicenseKeyCreatedPayloadSchema = objectType({
|
|
7981
7998
|
business_id: stringType(),
|
|
7982
7999
|
type: literalType("license_key.created"),
|
|
@@ -8005,6 +8022,7 @@ var WebhookPayloadSchema = discriminatedUnionType("type", [
|
|
|
8005
8022
|
SubscriptionCancelledPayloadSchema,
|
|
8006
8023
|
SubscriptionFailedPayloadSchema,
|
|
8007
8024
|
SubscriptionExpiredPayloadSchema,
|
|
8025
|
+
SubscriptionUpdatedPayloadSchema,
|
|
8008
8026
|
LicenseKeyCreatedPayloadSchema
|
|
8009
8027
|
]);
|
|
8010
8028
|
|
|
@@ -8079,6 +8097,9 @@ async function handleWebhookPayload(payload, config, context) {
|
|
|
8079
8097
|
if (payload.type === "subscription.expired") {
|
|
8080
8098
|
await callHandler(config.onSubscriptionExpired, payload);
|
|
8081
8099
|
}
|
|
8100
|
+
if (payload.type === "subscription.updated") {
|
|
8101
|
+
await callHandler(config.onSubscriptionUpdated, payload);
|
|
8102
|
+
}
|
|
8082
8103
|
if (payload.type === "license_key.created") {
|
|
8083
8104
|
await callHandler(config.onLicenseKeyCreated, payload);
|
|
8084
8105
|
}
|