@saastemly/voidcommerce 0.12.0 → 0.13.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/dist/catalog.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  SIGN_IN,
15
15
  TAX,
16
16
  UI
17
- } from "./index-7xwcv2cj.js";
17
+ } from "./index-0je92d88.js";
18
18
  import"./index-0v6na3yp.js";
19
19
  export {
20
20
  UI,
package/dist/cli.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  runVoid,
22
22
  version,
23
23
  voidAppsIn
24
- } from "./index-g0p3kk0f.js";
24
+ } from "./index-ze4z3n5q.js";
25
25
  import {
26
26
  LOCAL_KEY_FILE,
27
27
  PRIVATE_KEY_VAR,
@@ -50,7 +50,7 @@ import {
50
50
  setVariable,
51
51
  variableNames,
52
52
  verifyCloudflareToken
53
- } from "./index-a279r74m.js";
53
+ } from "./index-cxse24q6.js";
54
54
  import {
55
55
  LAYOUTS,
56
56
  oneOrigin,
@@ -58,10 +58,10 @@ import {
58
58
  validate,
59
59
  writeManifest,
60
60
  zoneOf
61
- } from "./index-ym88atwf.js";
61
+ } from "./index-727eybzt.js";
62
62
  import {
63
63
  GROUPS
64
- } from "./index-7xwcv2cj.js";
64
+ } from "./index-0je92d88.js";
65
65
  import {
66
66
  __require
67
67
  } from "./index-0v6na3yp.js";
@@ -10,6 +10,6 @@ import { type Manifest } from "../manifest";
10
10
  * The token needs nothing: no origin, no tariff. Everything else needs one or
11
11
  * the other, so the rule is simply "any carrier but the token".
12
12
  */
13
- export declare const WIRED_CARRIERS: readonly ["royal-mail", "dhl-express", "shippo", "easypost", "ups", "fedex", "nft"];
13
+ export declare const WIRED_CARRIERS: readonly ["parcel2go", "royal-mail", "dhl-express", "shippo", "easypost", "ups", "fedex", "nft"];
14
14
  export declare const needsShippingConfig: (id: string) => boolean;
15
15
  export declare function renderAuthTs(manifest: Manifest): string;
@@ -440,6 +440,16 @@ var CARRIERS = {
440
440
  intro: "Live rates at checkout, quoted per carrier. Flat-rate shipping needs none of these.",
441
441
  kind: "multiselect",
442
442
  choices: [
443
+ {
444
+ id: "parcel2go",
445
+ label: "Parcel2Go — a courier collects from your door",
446
+ hint: "the only one here a private individual can use end to end: live prices, a collection booked by API, and label-free services where the driver brings it. No business account, no volume minimum, no monthly fee",
447
+ recommended: true,
448
+ env: [
449
+ { key: "PARCEL2GO_CLIENT_ID", breaks: "no rates are quoted and no collection is ever booked", where: "parcel2go.com/myaccount/api → Client Credentials" },
450
+ { key: "PARCEL2GO_CLIENT_SECRET", breaks: "the same — and Parcel2Go will not show it twice, so keep it when you make it", where: "you choose this value when creating the credentials" }
451
+ ]
452
+ },
443
453
  { id: "shippo", label: "Shippo", hint: "many carriers through one API", env: [{ key: "SHIPPO_API_TOKEN", breaks: "calculated rates fall back to flat" }] },
444
454
  { id: "easypost", label: "EasyPost", hint: "the same, US-leaning", env: [{ key: "EASYPOST_API_KEY", breaks: "calculated rates fall back to flat" }] },
445
455
  { id: "ups", label: "UPS", hint: "your own UPS account, for negotiated rates an aggregator cannot see", env: [{ key: "UPS_CLIENT_ID", breaks: "UPS rates are not quoted" }, { key: "UPS_CLIENT_SECRET", breaks: "the same" }, { key: "UPS_ACCOUNT_NUMBER", breaks: "UPS has no account to bill the transport to" }] },
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  CHOICES,
3
3
  GROUPS
4
- } from "./index-7xwcv2cj.js";
4
+ } from "./index-0je92d88.js";
5
5
 
6
6
  // src/manifest.ts
7
7
  import { readFile, writeFile } from "node:fs/promises";
@@ -4,7 +4,7 @@ import {
4
4
  isApex,
5
5
  oneOrigin,
6
6
  zone
7
- } from "./index-ym88atwf.js";
7
+ } from "./index-727eybzt.js";
8
8
  import {
9
9
  __require,
10
10
  __toESM
@@ -389,7 +389,7 @@ async function decryptSecrets(project) {
389
389
  }
390
390
  const expected = committedPublicKey(root);
391
391
  if (expected) {
392
- const { publicKeyFor } = await import("./keys-px5maaj1.js");
392
+ const { publicKeyFor } = await import("./keys-9efk9rdz.js");
393
393
  const derived = await publicKeyFor(privateKey);
394
394
  if (derived && derived.toLowerCase() !== expected.toLowerCase()) {
395
395
  return {
@@ -11,7 +11,7 @@ import {
11
11
  renderEnvLocal,
12
12
  renderEnvProduction,
13
13
  renderEnvTs
14
- } from "./index-a279r74m.js";
14
+ } from "./index-cxse24q6.js";
15
15
  import {
16
16
  MANIFEST_FILE,
17
17
  has,
@@ -24,10 +24,10 @@ import {
24
24
  workerHosts,
25
25
  writeManifest,
26
26
  zone
27
- } from "./index-ym88atwf.js";
27
+ } from "./index-727eybzt.js";
28
28
  import {
29
29
  CHOICES
30
- } from "./index-7xwcv2cj.js";
30
+ } from "./index-0je92d88.js";
31
31
  import {
32
32
  __require
33
33
  } from "./index-0v6na3yp.js";
@@ -50,12 +50,17 @@ var VAT = {
50
50
  PL: { rate: 2300, name: "VAT" }
51
51
  };
52
52
  var social = (manifest, id, envPrefix) => has(manifest, id) ? ` ${id}: { clientId: must(env, "${envPrefix}_CLIENT_ID"), clientSecret: must(env, "${envPrefix}_CLIENT_SECRET") },` : null;
53
- var WIRED_CARRIERS = ["royal-mail", "dhl-express", "shippo", "easypost", "ups", "fedex", "nft"];
53
+ var WIRED_CARRIERS = ["parcel2go", "royal-mail", "dhl-express", "shippo", "easypost", "ups", "fedex", "nft"];
54
54
  var needsShippingConfig = (id) => WIRED_CARRIERS.includes(id) && id !== "nft";
55
55
  function renderAuthTs(manifest) {
56
56
  const { shop } = manifest;
57
57
  const lines = [];
58
58
  const CARRIER_CALLS = {
59
+ parcel2go: {
60
+ label: "Parcel2Go",
61
+ call: `parcel2goProvider({ clientId: must(env, "PARCEL2GO_CLIENT_ID"), clientSecret: must(env, "PARCEL2GO_CLIENT_SECRET"), from: shipFrom, customer: parcel2goCustomer, currency: "${shop.currency}" })`,
62
+ import: `import { parcel2goProvider } from "@saastemly/better-commerce/providers/parcel2go";`
63
+ },
59
64
  "royal-mail": {
60
65
  label: "Royal Mail",
61
66
  call: `royalMailProvider({ apiKey: must(env, "CLICK_DROP_AUTH_KEY"), services: royalMailServices, currency: "${shop.currency}", carrierName: "Royal Mail" })`,
@@ -97,7 +102,8 @@ import { mintProvider, destinationFor } from "./lib/mint.ts";`
97
102
  const carrierImports = carriers.map((id) => CARRIER_CALLS[id].import);
98
103
  const shipping = [
99
104
  ...carriers.some((id) => id !== "nft" && id !== "royal-mail") ? ["shipFrom"] : [],
100
- ...carriers.includes("royal-mail") ? ["royalMailServices"] : []
105
+ ...carriers.includes("royal-mail") ? ["royalMailServices"] : [],
106
+ ...carriers.includes("parcel2go") ? ["parcel2goCustomer"] : []
101
107
  ];
102
108
  if (shipping.length > 0)
103
109
  carrierImports.push(`import { ${shipping.join(", ")} } from "./lib/shipping.ts";`);
@@ -1372,7 +1378,7 @@ import color from "picocolors";
1372
1378
  // package.json
1373
1379
  var package_default = {
1374
1380
  name: "@saastemly/voidcommerce",
1375
- version: "0.12.0",
1381
+ version: "0.13.0",
1376
1382
  description: "Void, with a shop in it. `vc init` walks you through Better Auth, betterCommerce and every plugin; everything else passes through to `void`.",
1377
1383
  type: "module",
1378
1384
  license: "MIT",
@@ -2223,7 +2229,8 @@ export async function destinationFor(orderId: string): Promise<string | null> {
2223
2229
  }
2224
2230
  function renderShippingTs(manifest) {
2225
2231
  const royalMail = has(manifest, "royal-mail");
2226
- const origin = ["dhl-express", "shippo", "easypost", "ups", "fedex"].some((id) => has(manifest, id));
2232
+ const parcel2go = has(manifest, "parcel2go");
2233
+ const origin = ["parcel2go", "dhl-express", "shippo", "easypost", "ups", "fedex"].some((id) => has(manifest, id));
2227
2234
  const imports = [
2228
2235
  ...origin ? [`import type { DeliveryAddress } from "@saastemly/better-commerce/providers/delivery";`] : [],
2229
2236
  ...royalMail ? [`import type { RoyalMailService } from "@saastemly/better-commerce/providers/royal-mail";`] : []
@@ -2243,10 +2250,26 @@ export const shipFrom: DeliveryAddress = {
2243
2250
  country: "${manifest.shop.country}",
2244
2251
  phone: "TODO VERIFY: +44…",
2245
2252
  };
2253
+ `;
2254
+ const parcel2goBlock = `
2255
+ /**
2256
+ * Who the Parcel2Go account belongs to.
2257
+ *
2258
+ * Every order carries it: Parcel2Go books a courier to come to a real person
2259
+ * at a real door, and needs to know whose door. This is the ACCOUNT holder,
2260
+ * not the buyer — the buyer's details ride on the parcel.
2261
+ *
2262
+ * TODO VERIFY: these are placeholders.
2263
+ */
2264
+ export const parcel2goCustomer = {
2265
+ email: "TODO VERIFY: the email on your Parcel2Go account",
2266
+ forename: "TODO VERIFY",
2267
+ surname: "TODO VERIFY",
2268
+ };
2246
2269
  `;
2247
2270
  return `${imports.join(`
2248
2271
  `)}
2249
- ${origin ? originBlock : ""}${royalMail ? ROYAL_MAIL_SERVICES() : ""}`;
2272
+ ${origin ? originBlock : ""}${parcel2go ? parcel2goBlock : ""}${royalMail ? ROYAL_MAIL_SERVICES() : ""}`;
2250
2273
  }
2251
2274
  function renderErpTs() {
2252
2275
  return `import { businessCentralProvider } from "@saastemly/better-commerce/providers/business-central";
package/dist/index.js CHANGED
@@ -52,7 +52,7 @@ import {
52
52
  routeProblem,
53
53
  strictDependencies,
54
54
  upsertJsonc
55
- } from "./index-g0p3kk0f.js";
55
+ } from "./index-ze4z3n5q.js";
56
56
  import {
57
57
  allEnvKeys,
58
58
  envSummary,
@@ -60,7 +60,7 @@ import {
60
60
  renderEnvLocal,
61
61
  renderEnvProduction,
62
62
  renderEnvTs
63
- } from "./index-a279r74m.js";
63
+ } from "./index-cxse24q6.js";
64
64
  import {
65
65
  LAYOUTS,
66
66
  MANIFEST_FILE,
@@ -81,7 +81,7 @@ import {
81
81
  writeManifest,
82
82
  zone,
83
83
  zoneOf
84
- } from "./index-ym88atwf.js";
84
+ } from "./index-727eybzt.js";
85
85
  import {
86
86
  AUTH_PLUGINS,
87
87
  CARRIERS,
@@ -98,7 +98,7 @@ import {
98
98
  SIGN_IN,
99
99
  TAX,
100
100
  UI
101
- } from "./index-7xwcv2cj.js";
101
+ } from "./index-0je92d88.js";
102
102
  import"./index-0v6na3yp.js";
103
103
  export {
104
104
  zoneOf,
@@ -8,9 +8,9 @@ import {
8
8
  localPrivateKey,
9
9
  provisionKey,
10
10
  publicKeyFor
11
- } from "./index-a279r74m.js";
12
- import"./index-ym88atwf.js";
13
- import"./index-7xwcv2cj.js";
11
+ } from "./index-cxse24q6.js";
12
+ import"./index-727eybzt.js";
13
+ import"./index-0je92d88.js";
14
14
  import"./index-0v6na3yp.js";
15
15
  export {
16
16
  publicKeyFor,
package/dist/manifest.js CHANGED
@@ -18,8 +18,8 @@ import {
18
18
  writeManifest,
19
19
  zone,
20
20
  zoneOf
21
- } from "./index-ym88atwf.js";
22
- import"./index-7xwcv2cj.js";
21
+ } from "./index-727eybzt.js";
22
+ import"./index-0je92d88.js";
23
23
  import"./index-0v6na3yp.js";
24
24
  export {
25
25
  zoneOf,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saastemly/voidcommerce",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Void, with a shop in it. `vc init` walks you through Better Auth, betterCommerce and every plugin; everything else passes through to `void`.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/catalog.ts CHANGED
@@ -513,6 +513,16 @@ export const CARRIERS: Group = {
513
513
  intro: "Live rates at checkout, quoted per carrier. Flat-rate shipping needs none of these.",
514
514
  kind: "multiselect",
515
515
  choices: [
516
+ {
517
+ id: "parcel2go",
518
+ label: "Parcel2Go — a courier collects from your door",
519
+ hint: "the only one here a private individual can use end to end: live prices, a collection booked by API, and label-free services where the driver brings it. No business account, no volume minimum, no monthly fee",
520
+ recommended: true,
521
+ env: [
522
+ { key: "PARCEL2GO_CLIENT_ID", breaks: "no rates are quoted and no collection is ever booked", where: "parcel2go.com/myaccount/api → Client Credentials" },
523
+ { key: "PARCEL2GO_CLIENT_SECRET", breaks: "the same — and Parcel2Go will not show it twice, so keep it when you make it", where: "you choose this value when creating the credentials" },
524
+ ],
525
+ },
516
526
  { id: "shippo", label: "Shippo", hint: "many carriers through one API", env: [{ key: "SHIPPO_API_TOKEN", breaks: "calculated rates fall back to flat" }] },
517
527
  { id: "easypost", label: "EasyPost", hint: "the same, US-leaning", env: [{ key: "EASYPOST_API_KEY", breaks: "calculated rates fall back to flat" }] },
518
528
  { id: "ups", label: "UPS", hint: "your own UPS account, for negotiated rates an aggregator cannot see", env: [{ key: "UPS_CLIENT_ID", breaks: "UPS rates are not quoted" }, { key: "UPS_CLIENT_SECRET", breaks: "the same" }, { key: "UPS_ACCOUNT_NUMBER", breaks: "UPS has no account to bill the transport to" }] },
@@ -60,7 +60,7 @@ const social = (manifest: Manifest, id: string, envPrefix: string) =>
60
60
  * The token needs nothing: no origin, no tariff. Everything else needs one or
61
61
  * the other, so the rule is simply "any carrier but the token".
62
62
  */
63
- export const WIRED_CARRIERS = ["royal-mail", "dhl-express", "shippo", "easypost", "ups", "fedex", "nft"] as const;
63
+ export const WIRED_CARRIERS = ["parcel2go", "royal-mail", "dhl-express", "shippo", "easypost", "ups", "fedex", "nft"] as const;
64
64
  export const needsShippingConfig = (id: string): boolean => WIRED_CARRIERS.includes(id as never) && id !== "nft";
65
65
 
66
66
  export function renderAuthTs(manifest: Manifest): string {
@@ -82,6 +82,13 @@ export function renderAuthTs(manifest: Manifest): string {
82
82
  const CARRIER_CALLS: Record<string, { call: string; label: string; import: string }> = {
83
83
  // Every real carrier needs the ORIGIN it ships from, which is shop data
84
84
  // rather than a credential — so it lives in an owned lib/shipping.ts.
85
+ parcel2go: {
86
+ label: "Parcel2Go",
87
+ // `from` is the collection address: Parcel2Go requires one on every
88
+ // order, because a courier is being sent to it.
89
+ call: `parcel2goProvider({ clientId: must(env, "PARCEL2GO_CLIENT_ID"), clientSecret: must(env, "PARCEL2GO_CLIENT_SECRET"), from: shipFrom, customer: parcel2goCustomer, currency: "${shop.currency}" })`,
90
+ import: `import { parcel2goProvider } from "@saastemly/better-commerce/providers/parcel2go";`,
91
+ },
85
92
  "royal-mail": {
86
93
  label: "Royal Mail",
87
94
  // No `from`: Click & Drop posts from the account's registered
@@ -133,6 +140,7 @@ export function renderAuthTs(manifest: Manifest): string {
133
140
  const shipping = [
134
141
  ...(carriers.some((id) => id !== "nft" && id !== "royal-mail") ? ["shipFrom"] : []),
135
142
  ...(carriers.includes("royal-mail") ? ["royalMailServices"] : []),
143
+ ...(carriers.includes("parcel2go") ? ["parcel2goCustomer"] : []),
136
144
  ];
137
145
  if (shipping.length > 0) carrierImports.push(`import { ${shipping.join(", ")} } from "./lib/shipping.ts";`);
138
146
  const wantsNft = has(manifest, "nft");
@@ -275,9 +275,10 @@ export async function destinationFor(orderId: string): Promise<string | null> {
275
275
  */
276
276
  export function renderShippingTs(manifest: Manifest): string {
277
277
  const royalMail = has(manifest, "royal-mail");
278
+ const parcel2go = has(manifest, "parcel2go");
278
279
  // Royal Mail posts from the address registered on the Click & Drop account,
279
280
  // so an origin here would be ignored. Only carriers that QUOTE need one.
280
- const origin = ["dhl-express", "shippo", "easypost", "ups", "fedex"].some((id) => has(manifest, id));
281
+ const origin = ["parcel2go", "dhl-express", "shippo", "easypost", "ups", "fedex"].some((id) => has(manifest, id));
281
282
 
282
283
  const imports = [
283
284
  ...(origin ? [`import type { DeliveryAddress } from "@saastemly/better-commerce/providers/delivery";`] : []),
@@ -301,7 +302,23 @@ export const shipFrom: DeliveryAddress = {
301
302
  };
302
303
  `;
303
304
 
304
- return `${imports.join("\n")}\n${origin ? originBlock : ""}${royalMail ? ROYAL_MAIL_SERVICES() : ""}`;
305
+ const parcel2goBlock = `
306
+ /**
307
+ * Who the Parcel2Go account belongs to.
308
+ *
309
+ * Every order carries it: Parcel2Go books a courier to come to a real person
310
+ * at a real door, and needs to know whose door. This is the ACCOUNT holder,
311
+ * not the buyer — the buyer's details ride on the parcel.
312
+ *
313
+ * TODO VERIFY: these are placeholders.
314
+ */
315
+ export const parcel2goCustomer = {
316
+ email: "TODO VERIFY: the email on your Parcel2Go account",
317
+ forename: "TODO VERIFY",
318
+ surname: "TODO VERIFY",
319
+ };
320
+ `;
321
+ return `${imports.join("\n")}\n${origin ? originBlock : ""}${parcel2go ? parcel2goBlock : ""}${royalMail ? ROYAL_MAIL_SERVICES() : ""}`;
305
322
  }
306
323
 
307
324
  export function renderErpTs(): string {