@@ -10,7 +10,6 @@ import {
1010import type { Polar } from "@polar-sh/sdk" ;
1111import type { Timeframe } from "@polar-sh/sdk/models/components/benefitlicensekeyexpirationproperties.js" ;
1212import type { BenefitLicenseKeyExpirationProperties } from "@polar-sh/sdk/models/components/benefitlicensekeyexpirationproperties.js" ;
13- import type { Interval } from "@polar-sh/sdk/models/components/interval.js" ;
1413import type { FileRead } from "@polar-sh/sdk/models/components/listresourcefileread.js" ;
1514import type { Organization } from "@polar-sh/sdk/models/components/organization.js" ;
1615import type { Product } from "@polar-sh/sdk/models/components/product.js" ;
@@ -24,21 +23,18 @@ import type { ProductRecurringCreate } from "@polar-sh/sdk/models/components/pro
2423import mime from "mime-types" ;
2524import { uploadFailedMessage , uploadMessage } from "./ui/upload.js" ;
2625import { Upload } from "./upload.js" ;
26+ import type { SubscriptionRecurringInterval } from "@polar-sh/sdk/models/components/subscriptionrecurringinterval.js" ;
2727
2828const resolveInterval = (
2929 interval : ListVariants [ "data" ] [ number ] [ "attributes" ] [ "interval" ] ,
30- ) : Interval => {
30+ ) : SubscriptionRecurringInterval => {
3131 switch ( interval ) {
32- case "day" :
33- return "day" ;
34- case "week" :
35- return "week" ;
3632 case "month" :
3733 return "month" ;
3834 case "year" :
3935 return "year" ;
4036 default :
41- throw new Error ( `Unknown interval: ${ interval } ` ) ;
37+ return "month" ;
4238 }
4339} ;
4440
@@ -161,12 +157,12 @@ export const createProduct = async (
161157 expires : variant . attributes . is_license_length_unlimited
162158 ? undefined
163159 : resolveLicenseKeyExpiration ( variant ) ,
164- activations : variant . attributes . license_activation_limit
165- ? {
160+ activations : variant . attributes . is_license_limit_unlimited
161+ ? undefined
162+ : {
166163 limit : variant . attributes . license_activation_limit ,
167164 enableCustomerAdmin : true ,
168- }
169- : undefined ,
165+ } ,
170166 } ,
171167 organizationId : organization . id ,
172168 } ) ;
0 commit comments