adding attach preview

This commit is contained in:
John Yeo
2025-06-03 08:07:41 +01:00
parent f109524377
commit efeaace7b0
100 changed files with 2382 additions and 1227 deletions

View File

@@ -0,0 +1,21 @@
export enum AttachBranch {
MultiProduct = "multi_product",
OneOff = "one_off",
New = "new",
AddOn = "add_on",
// Same product
NewVersion = "new_version",
SameCustomEnts = "same_custom_ents",
SameCustom = "same_custom",
UpdatePrepaidQuantity = "update_prepaid_quantity",
Renew = "renew",
// Handle upgrades / downgrades
MainIsFree = "main_is_free",
MainIsTrial = "main_is_trial",
Upgrade = "upgrade",
Downgrade = "downgrade",
}

View File

@@ -0,0 +1,15 @@
import { AttachBranch } from "./AttachBranch.js";
export enum ProrationBehavior {
Immediately = "immediately",
NextBilling = "next_billing",
None = "none",
}
export interface AttachConfig {
onlyCheckout: boolean;
carryUsage: boolean; // Whether to carry over existing usages
branch: AttachBranch;
proration: ProrationBehavior;
disableTrial: boolean;
}

View File

@@ -0,0 +1,15 @@
export enum AttachFunction {
CreateCheckout = "create_checkout",
AddProduct = "add_product",
UpdateEnts = "update_ents", // only update entitlements
UpdateProduct = "update_product", // update product
ScheduleProduct = "schedule_product",
UpdatePrepaidQuantity = "update_prepaid_quantity",
Renew = "renew",
}
/* Handle checkout / public error:
1. New version, same custom, same custom ents, renew, update prepaid quantity
2.
*/

View File

@@ -0,0 +1,7 @@
import { AttachBranch } from "./attachEnums/AttachBranch.js";
export interface AttachPreview {
branch: AttachBranch;
options: any;
new_items: any;
}