@purpleturret/cli 0.5.0 → 0.6.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.
package/README.md CHANGED
@@ -97,6 +97,7 @@ The CLI finds `purpleturret.config.{ts,mts,js,mjs,json}` in the current director
97
97
  | `stripe` | `{ priceId }` | Optional. Adopt an existing Stripe price on create. Immutable. |
98
98
  | `active` | `boolean` | Optional. Inactive products stop accepting checkouts. |
99
99
  | `buyerEmails` | `boolean` | Optional. `false` turns off Purpleturret's receipt, delivery and refund emails. |
100
+ | `tabTitle` | `string` | Optional. The checkout page's browser tab title, in place of `<name> — Purpleturret`. |
100
101
  | `offers` | `{ [key]: { title, subtitle? } }` | Optional. A note shown under the price when the link carries `?offer=<key>`. |
101
102
 
102
103
  **Rules to know before you edit:**
package/dist/cli.js CHANGED
@@ -9,7 +9,7 @@ import { existsSync } from "fs";
9
9
  import { join as join2 } from "path";
10
10
 
11
11
  // ../sdk/src/version.ts
12
- var SDK_VERSION = "0.5.0";
12
+ var SDK_VERSION = "0.6.0";
13
13
 
14
14
  // ../sdk/src/config/schema.ts
15
15
  import { z } from "zod";
@@ -82,7 +82,8 @@ var productInputSchema = z.strictObject({
82
82
  offers: z.record(
83
83
  z.string().regex(/^[a-z0-9-]{1,32}$/, "must be 1-32 characters of lowercase letters, digits, or '-'"),
84
84
  z.strictObject({ title: z.string().trim().min(1, "must not be empty").max(120), subtitle: z.string().trim().max(120).optional() })
85
- ).refine((offers) => Object.keys(offers).length <= 10, "must have 10 entries or fewer").optional()
85
+ ).refine((offers) => Object.keys(offers).length <= 10, "must have 10 entries or fewer").optional(),
86
+ tabTitle: z.string().trim().max(80).optional()
86
87
  });
87
88
  var configSchema = z.strictObject({
88
89
  products: z.array(productInputSchema)
@@ -177,7 +178,8 @@ function toWireProduct(input) {
177
178
  stripe: input.stripe ? { price_id: input.stripe.priceId } : void 0,
178
179
  active: input.active,
179
180
  buyer_emails: input.buyerEmails,
180
- offers: input.offers
181
+ offers: input.offers,
182
+ tab_title: input.tabTitle
181
183
  };
182
184
  return omitUndefined(wire);
183
185
  }
@@ -227,6 +229,7 @@ function fromWireProduct(wire) {
227
229
  active: wire.active,
228
230
  buyerEmails: wire.buyer_emails ?? void 0,
229
231
  offers: wire.offers,
232
+ tabTitle: wire.tab_title ?? void 0,
230
233
  bumps: wire.bumps ? camelizeKeys(wire.bumps) : void 0,
231
234
  upsell: wire.upsell === void 0 ? void 0 : wire.upsell && camelizeKeys(wire.upsell),
232
235
  pixelId: wire.pixel_id,
@@ -289,7 +292,8 @@ function productToInput(product3) {
289
292
  active: product3.active,
290
293
  // The API always reports buyer_emails; only the opt-out is worth writing into a config.
291
294
  buyerEmails: product3.buyerEmails === false ? false : void 0,
292
- offers: product3.offers && Object.keys(product3.offers).length > 0 ? product3.offers : void 0
295
+ offers: product3.offers && Object.keys(product3.offers).length > 0 ? product3.offers : void 0,
296
+ tabTitle: product3.tabTitle || void 0
293
297
  });
294
298
  }
295
299
  function fromWirePlanItem(item) {
@@ -1101,7 +1105,7 @@ function stripUndefined(value) {
1101
1105
  import dotenv from "dotenv";
1102
1106
 
1103
1107
  // src/version.ts
1104
- var CLI_VERSION = "0.5.0";
1108
+ var CLI_VERSION = "0.6.0";
1105
1109
 
1106
1110
  // src/lib/credentials.ts
1107
1111
  import { chmod, mkdir, readFile, rename, writeFile } from "fs/promises";
@@ -3040,7 +3044,8 @@ var PRODUCT_KEY_ORDER = [
3040
3044
  "stripe",
3041
3045
  "active",
3042
3046
  "buyerEmails",
3043
- "offers"
3047
+ "offers",
3048
+ "tabTitle"
3044
3049
  ];
3045
3050
  var IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
3046
3051
  function renderConfigSource(products2, format = "ts") {