@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.
@@ -1495,6 +1495,7 @@ function parseListing(data) {
1495
1495
  price_model: stringOrNull(data.price_model),
1496
1496
  price_value_minor: Number(data.price_value_minor ?? 0),
1497
1497
  pricing_plan,
1498
+ billing_timing: String(data.billing_timing ?? metadata.billing_timing ?? "post"),
1498
1499
  currency: String(data.currency ?? "USD"),
1499
1500
  allow_free_trial: Boolean(data.allow_free_trial ?? false),
1500
1501
  free_trial_duration_days: Number(data.free_trial_duration_days ?? 30),
@@ -2713,6 +2714,7 @@ var init_client = __esm({
2713
2714
  "price_model",
2714
2715
  "price_value_minor",
2715
2716
  "pricing_plan",
2717
+ "billing_timing",
2716
2718
  "currency",
2717
2719
  "allow_free_trial",
2718
2720
  "free_trial_duration_days",
@@ -2732,6 +2734,13 @@ var init_client = __esm({
2732
2734
  if (payload.pricing_plan !== void 0 && (typeof payload.pricing_plan !== "object" || Array.isArray(payload.pricing_plan))) {
2733
2735
  throw new SiglumeClientError("AppManifest.pricing_plan must be an object when provided.");
2734
2736
  }
2737
+ if (payload.billing_timing !== void 0 && payload.billing_timing !== null) {
2738
+ const billingTiming = String(payload.billing_timing || "post").trim().toLowerCase();
2739
+ if (billingTiming !== "post" && billingTiming !== "prepay") {
2740
+ throw new SiglumeClientError("AppManifest.billing_timing must be 'post' or 'prepay'.");
2741
+ }
2742
+ payload.billing_timing = billingTiming;
2743
+ }
2735
2744
  if (payload.store_vertical === void 0 || payload.store_vertical === null) {
2736
2745
  throw new SiglumeClientError(
2737
2746
  "AppManifest.store_vertical is required. Choose 'api' for normal API Store listings or 'game' for API games."
@@ -6244,6 +6253,9 @@ var AppTestHarness = class {
6244
6253
  issues.push("at least one example_prompt is recommended");
6245
6254
  }
6246
6255
  issues.push(...pricingPlanFloorIssues(manifest.pricing_plan, String(manifest.currency ?? "USD")));
6256
+ if (manifest.billing_timing !== void 0 && manifest.billing_timing !== "post" && manifest.billing_timing !== "prepay") {
6257
+ issues.push("billing_timing must be 'post' or 'prepay'");
6258
+ }
6247
6259
  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)) {
6248
6260
  issues.push("pricing_plan.items is required for usage_based/per_action pricing");
6249
6261
  }