@siglume/api-sdk 0.10.5 → 0.10.7

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.
@@ -1334,6 +1334,8 @@ function parseListing(data) {
1334
1334
  price_model: stringOrNull(data.price_model),
1335
1335
  price_value_minor: Number(data.price_value_minor ?? 0),
1336
1336
  currency: String(data.currency ?? "USD"),
1337
+ allow_free_trial: Boolean(data.allow_free_trial ?? false),
1338
+ free_trial_duration_days: Number(data.free_trial_duration_days ?? 30),
1337
1339
  short_description: stringOrNull(data.short_description),
1338
1340
  description: stringOrNull(data.description),
1339
1341
  docs_url: stringOrNull(data.docs_url),
@@ -2533,6 +2535,8 @@ var init_client = __esm({
2533
2535
  "price_model",
2534
2536
  "price_value_minor",
2535
2537
  "currency",
2538
+ "allow_free_trial",
2539
+ "free_trial_duration_days",
2536
2540
  "permission_class",
2537
2541
  "approval_mode",
2538
2542
  "dry_run_supported",
@@ -2560,6 +2564,24 @@ var init_client = __esm({
2560
2564
  throw new SiglumeClientError(`AppManifest.currency must be 'USD' or 'JPY'. Got ${String(payload.currency)}.`);
2561
2565
  }
2562
2566
  payload.currency = currency;
2567
+ if (payload.allow_free_trial === void 0 || payload.allow_free_trial === null) {
2568
+ throw new SiglumeClientError(
2569
+ "AppManifest.allow_free_trial is required. Pass true to offer a Plus/Pro buyer free trial or false to disable trials."
2570
+ );
2571
+ }
2572
+ if (Boolean(payload.allow_free_trial)) {
2573
+ const duration = payload.free_trial_duration_days ?? 30;
2574
+ if (typeof duration !== "number" || !Number.isInteger(duration)) {
2575
+ throw new SiglumeClientError(
2576
+ "AppManifest.free_trial_duration_days must be an integer when allow_free_trial=true."
2577
+ );
2578
+ }
2579
+ if (duration < 1 || duration > 90) {
2580
+ throw new SiglumeClientError(
2581
+ `AppManifest.free_trial_duration_days must be between 1 and 90 when allow_free_trial=true, got: ${duration}.`
2582
+ );
2583
+ }
2584
+ }
2563
2585
  if (payload.manifest && typeof payload.manifest === "object") {
2564
2586
  delete payload.manifest.version;
2565
2587
  }
@@ -5135,10 +5157,14 @@ function appendValueChange(changes, emittedKeys, level, key, oldValue, newValue,
5135
5157
  }
5136
5158
  function normalizeManifest(value) {
5137
5159
  const payload = coerceMapping(value, "manifest");
5160
+ const rawDuration = payload.free_trial_duration_days;
5161
+ const duration = rawDuration === void 0 || rawDuration === null ? 30 : Number(rawDuration);
5138
5162
  return {
5139
5163
  ...payload,
5140
5164
  price_model: payload.price_model ?? "free",
5141
5165
  currency: payload.currency ?? "USD",
5166
+ allow_free_trial: Boolean(payload.allow_free_trial ?? false),
5167
+ free_trial_duration_days: Number.isFinite(duration) ? Math.trunc(duration) : 30,
5142
5168
  // AppManifest defaults permission_class to "read-only" (hyphen form,
5143
5169
  // PermissionClass.READ_ONLY). Without this default, a legacy / minimal
5144
5170
  // manifest without permission_class compared against an upgraded one
@@ -7690,6 +7716,7 @@ function buildOperationManifest(operation, capability_key_override) {
7690
7716
  required_connected_accounts: [],
7691
7717
  price_model: PriceModel.FREE,
7692
7718
  currency: "USD",
7719
+ allow_free_trial: false,
7693
7720
  jurisdiction: "US",
7694
7721
  short_description: operation.summary,
7695
7722
  docs_url: "https://example.com/docs",
@@ -7768,6 +7795,7 @@ function operationAdapterSource(operation, manifest) {
7768
7795
  " required_connected_accounts: [],",
7769
7796
  " price_model: PriceModel.FREE,",
7770
7797
  " currency: 'USD' as const,",
7798
+ " allow_free_trial: false,",
7771
7799
  ` jurisdiction: ${JSON.stringify(manifest.jurisdiction)},`,
7772
7800
  ` short_description: ${JSON.stringify(manifest.short_description ?? "")},`,
7773
7801
  ` support_contact: ${JSON.stringify(manifest.support_contact ?? "")},`,
@@ -8448,6 +8476,7 @@ function fallbackTemplateSource(template) {
8448
8476
  " required_connected_accounts: [],",
8449
8477
  " price_model: PriceModel.FREE,",
8450
8478
  " currency: 'USD' as const,",
8479
+ " allow_free_trial: false,",
8451
8480
  ' jurisdiction: "US",',
8452
8481
  ' short_description: "Starter template generated by siglume init.",',
8453
8482
  ' support_contact: "support@example.com",',
@@ -8502,6 +8531,7 @@ function starterManifest(template) {
8502
8531
  required_connected_accounts: [],
8503
8532
  price_model: "free",
8504
8533
  currency: "USD",
8534
+ allow_free_trial: false,
8505
8535
  jurisdiction: "US",
8506
8536
  short_description: "Starter template generated by siglume init.",
8507
8537
  support_contact: "support@example.com",