@purpleturret/cli 0.6.0 → 0.7.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 +1 -0
- package/dist/cli.js +28 -6
- package/dist/cli.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -98,6 +98,7 @@ The CLI finds `purpleturret.config.{ts,mts,js,mjs,json}` in the current director
|
|
|
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
100
|
| `tabTitle` | `string` | Optional. The checkout page's browser tab title, in place of `<name> — Purpleturret`. |
|
|
101
|
+
| `trustBadge` | `{ title?, caption?, logos: [{ imageUrl, alt }] }` | Optional. A row of https logos under the pay button (press, seals). `null` clears it. |
|
|
101
102
|
| `offers` | `{ [key]: { title, subtitle? } }` | Optional. A note shown under the price when the link carries `?offer=<key>`. |
|
|
102
103
|
|
|
103
104
|
**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.
|
|
12
|
+
var SDK_VERSION = "0.7.0";
|
|
13
13
|
|
|
14
14
|
// ../sdk/src/config/schema.ts
|
|
15
15
|
import { z } from "zod";
|
|
@@ -83,7 +83,17 @@ var productInputSchema = z.strictObject({
|
|
|
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
85
|
).refine((offers) => Object.keys(offers).length <= 10, "must have 10 entries or fewer").optional(),
|
|
86
|
-
tabTitle: z.string().trim().max(80).optional()
|
|
86
|
+
tabTitle: z.string().trim().max(80).optional(),
|
|
87
|
+
trustBadge: z.strictObject({
|
|
88
|
+
title: z.string().trim().max(80).optional(),
|
|
89
|
+
caption: z.string().trim().max(80).optional(),
|
|
90
|
+
logos: z.array(
|
|
91
|
+
z.strictObject({
|
|
92
|
+
imageUrl: z.string().trim().max(500).regex(/^https:\/\/\S+$/, "must be an https URL"),
|
|
93
|
+
alt: z.string().trim().min(1).max(80)
|
|
94
|
+
})
|
|
95
|
+
).min(1).max(12)
|
|
96
|
+
}).nullable().optional()
|
|
87
97
|
});
|
|
88
98
|
var configSchema = z.strictObject({
|
|
89
99
|
products: z.array(productInputSchema)
|
|
@@ -179,7 +189,12 @@ function toWireProduct(input) {
|
|
|
179
189
|
active: input.active,
|
|
180
190
|
buyer_emails: input.buyerEmails,
|
|
181
191
|
offers: input.offers,
|
|
182
|
-
tab_title: input.tabTitle
|
|
192
|
+
tab_title: input.tabTitle,
|
|
193
|
+
trust_badge: input.trustBadge && {
|
|
194
|
+
title: input.trustBadge.title,
|
|
195
|
+
caption: input.trustBadge.caption,
|
|
196
|
+
logos: input.trustBadge.logos.map((logo) => ({ image_url: logo.imageUrl, alt: logo.alt }))
|
|
197
|
+
}
|
|
183
198
|
};
|
|
184
199
|
return omitUndefined(wire);
|
|
185
200
|
}
|
|
@@ -230,6 +245,11 @@ function fromWireProduct(wire) {
|
|
|
230
245
|
buyerEmails: wire.buyer_emails ?? void 0,
|
|
231
246
|
offers: wire.offers,
|
|
232
247
|
tabTitle: wire.tab_title ?? void 0,
|
|
248
|
+
trustBadge: wire.trust_badge ? omitUndefined({
|
|
249
|
+
title: wire.trust_badge.title ?? void 0,
|
|
250
|
+
caption: wire.trust_badge.caption ?? void 0,
|
|
251
|
+
logos: wire.trust_badge.logos.map((logo) => ({ imageUrl: logo.image_url, alt: logo.alt }))
|
|
252
|
+
}) : void 0,
|
|
233
253
|
bumps: wire.bumps ? camelizeKeys(wire.bumps) : void 0,
|
|
234
254
|
upsell: wire.upsell === void 0 ? void 0 : wire.upsell && camelizeKeys(wire.upsell),
|
|
235
255
|
pixelId: wire.pixel_id,
|
|
@@ -293,7 +313,8 @@ function productToInput(product3) {
|
|
|
293
313
|
// The API always reports buyer_emails; only the opt-out is worth writing into a config.
|
|
294
314
|
buyerEmails: product3.buyerEmails === false ? false : void 0,
|
|
295
315
|
offers: product3.offers && Object.keys(product3.offers).length > 0 ? product3.offers : void 0,
|
|
296
|
-
tabTitle: product3.tabTitle || void 0
|
|
316
|
+
tabTitle: product3.tabTitle || void 0,
|
|
317
|
+
trustBadge: product3.trustBadge || void 0
|
|
297
318
|
});
|
|
298
319
|
}
|
|
299
320
|
function fromWirePlanItem(item) {
|
|
@@ -1105,7 +1126,7 @@ function stripUndefined(value) {
|
|
|
1105
1126
|
import dotenv from "dotenv";
|
|
1106
1127
|
|
|
1107
1128
|
// src/version.ts
|
|
1108
|
-
var CLI_VERSION = "0.
|
|
1129
|
+
var CLI_VERSION = "0.7.0";
|
|
1109
1130
|
|
|
1110
1131
|
// src/lib/credentials.ts
|
|
1111
1132
|
import { chmod, mkdir, readFile, rename, writeFile } from "fs/promises";
|
|
@@ -3045,7 +3066,8 @@ var PRODUCT_KEY_ORDER = [
|
|
|
3045
3066
|
"active",
|
|
3046
3067
|
"buyerEmails",
|
|
3047
3068
|
"offers",
|
|
3048
|
-
"tabTitle"
|
|
3069
|
+
"tabTitle",
|
|
3070
|
+
"trustBadge"
|
|
3049
3071
|
];
|
|
3050
3072
|
var IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
3051
3073
|
function renderConfigSource(products2, format = "ts") {
|