@siglume/api-sdk 1.1.0 → 1.2.0

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.
@@ -123,6 +123,7 @@ declare const PriceModel: {
123
123
  readonly PER_ACTION: "per_action";
124
124
  };
125
125
  type PriceModel = (typeof PriceModel)[keyof typeof PriceModel];
126
+ type BillingTiming = "post" | "prepay";
126
127
  declare const AppCategory: {
127
128
  readonly COMMERCE: "commerce";
128
129
  readonly BOOKING: "booking";
@@ -179,6 +180,7 @@ interface AppManifest {
179
180
  price_model?: PriceModel;
180
181
  price_value_minor?: number;
181
182
  pricing_plan?: PricingPlan;
183
+ billing_timing?: BillingTiming;
182
184
  currency: ListingCurrency;
183
185
  allow_free_trial: boolean;
184
186
  free_trial_duration_days?: number;
@@ -306,6 +308,7 @@ interface AppListingRecord {
306
308
  price_model?: string | null;
307
309
  price_value_minor: number;
308
310
  pricing_plan?: PricingPlan | null;
311
+ billing_timing?: BillingTiming | string | null;
309
312
  currency: string;
310
313
  allow_free_trial: boolean;
311
314
  free_trial_duration_days: number;
@@ -123,6 +123,7 @@ declare const PriceModel: {
123
123
  readonly PER_ACTION: "per_action";
124
124
  };
125
125
  type PriceModel = (typeof PriceModel)[keyof typeof PriceModel];
126
+ type BillingTiming = "post" | "prepay";
126
127
  declare const AppCategory: {
127
128
  readonly COMMERCE: "commerce";
128
129
  readonly BOOKING: "booking";
@@ -179,6 +180,7 @@ interface AppManifest {
179
180
  price_model?: PriceModel;
180
181
  price_value_minor?: number;
181
182
  pricing_plan?: PricingPlan;
183
+ billing_timing?: BillingTiming;
182
184
  currency: ListingCurrency;
183
185
  allow_free_trial: boolean;
184
186
  free_trial_duration_days?: number;
@@ -306,6 +308,7 @@ interface AppListingRecord {
306
308
  price_model?: string | null;
307
309
  price_value_minor: number;
308
310
  pricing_plan?: PricingPlan | null;
311
+ billing_timing?: BillingTiming | string | null;
309
312
  currency: string;
310
313
  allow_free_trial: boolean;
311
314
  free_trial_duration_days: number;
package/dist/cli/index.js CHANGED
@@ -1473,6 +1473,7 @@ function parseListing(data) {
1473
1473
  price_model: stringOrNull(data.price_model),
1474
1474
  price_value_minor: Number(data.price_value_minor ?? 0),
1475
1475
  pricing_plan,
1476
+ billing_timing: String(data.billing_timing ?? metadata.billing_timing ?? "post"),
1476
1477
  currency: String(data.currency ?? "USD"),
1477
1478
  allow_free_trial: Boolean(data.allow_free_trial ?? false),
1478
1479
  free_trial_duration_days: Number(data.free_trial_duration_days ?? 30),
@@ -2691,6 +2692,7 @@ var init_client = __esm({
2691
2692
  "price_model",
2692
2693
  "price_value_minor",
2693
2694
  "pricing_plan",
2695
+ "billing_timing",
2694
2696
  "currency",
2695
2697
  "allow_free_trial",
2696
2698
  "free_trial_duration_days",
@@ -2710,6 +2712,13 @@ var init_client = __esm({
2710
2712
  if (payload.pricing_plan !== void 0 && (typeof payload.pricing_plan !== "object" || Array.isArray(payload.pricing_plan))) {
2711
2713
  throw new SiglumeClientError("AppManifest.pricing_plan must be an object when provided.");
2712
2714
  }
2715
+ if (payload.billing_timing !== void 0 && payload.billing_timing !== null) {
2716
+ const billingTiming = String(payload.billing_timing || "post").trim().toLowerCase();
2717
+ if (billingTiming !== "post" && billingTiming !== "prepay") {
2718
+ throw new SiglumeClientError("AppManifest.billing_timing must be 'post' or 'prepay'.");
2719
+ }
2720
+ payload.billing_timing = billingTiming;
2721
+ }
2713
2722
  if (payload.store_vertical === void 0 || payload.store_vertical === null) {
2714
2723
  throw new SiglumeClientError(
2715
2724
  "AppManifest.store_vertical is required. Choose 'api' for normal API Store listings or 'game' for API games."
@@ -6217,6 +6226,9 @@ var AppTestHarness = class {
6217
6226
  issues.push("at least one example_prompt is recommended");
6218
6227
  }
6219
6228
  issues.push(...pricingPlanFloorIssues(manifest.pricing_plan, String(manifest.currency ?? "USD")));
6229
+ if (manifest.billing_timing !== void 0 && manifest.billing_timing !== "post" && manifest.billing_timing !== "prepay") {
6230
+ issues.push("billing_timing must be 'post' or 'prepay'");
6231
+ }
6220
6232
  if ((manifest.price_model === PriceModel.USAGE_BASED || manifest.price_model === PriceModel.PER_ACTION) && (!manifest.pricing_plan || !Array.isArray(manifest.pricing_plan.items) || manifest.pricing_plan.items.length === 0)) {
6221
6233
  issues.push("pricing_plan.items is required for usage_based/per_action pricing");
6222
6234
  }