@tokenoftrust/cli 7.5.7 → 7.5.9
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/package.json +1 -1
- package/src/commands/go-live.mjs +34 -2
- package/src/validate.mjs +2 -10
- package/src/known-product-catalog.mjs +0 -1357
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenoftrust/cli",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.9",
|
|
4
4
|
"description": "Token of Trust developer CLI — clone a tenant store, run it locally with save→reload, and submit it for preview. Installs the `tot` command.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Token of Trust",
|
package/src/commands/go-live.mjs
CHANGED
|
@@ -142,15 +142,26 @@ export function normalizeReadiness(r) {
|
|
|
142
142
|
* The server's `checkoutPaymentReadiness` (live checkout posture), or null when the worker does
|
|
143
143
|
* not send it. Informational: it never gates the apex cutover. Pure.
|
|
144
144
|
* @param {any} raw
|
|
145
|
-
* @returns {{ ready: boolean, posture: string, detail: string, remedy: string } | null}
|
|
145
|
+
* @returns {{ ready: boolean, posture: string, detail: string, remedy: string, providerSync: { status: "in-sync"|"drifted", drift: string[] } | null } | null}
|
|
146
146
|
*/
|
|
147
147
|
export function normalizeCheckoutPaymentReadiness(raw) {
|
|
148
148
|
if (!raw || typeof raw !== "object") return null;
|
|
149
|
+
const sync = raw.providerSync && typeof raw.providerSync === "object" ? raw.providerSync : null;
|
|
150
|
+
const providerSync =
|
|
151
|
+
sync && (sync.status === "in-sync" || sync.status === "drifted")
|
|
152
|
+
? {
|
|
153
|
+
status: sync.status,
|
|
154
|
+
drift: Array.isArray(sync.drift)
|
|
155
|
+
? sync.drift.map((d) => (d && typeof d.field === "string" ? d.field : null)).filter(Boolean)
|
|
156
|
+
: [],
|
|
157
|
+
}
|
|
158
|
+
: null;
|
|
149
159
|
return {
|
|
150
160
|
ready: raw.readyForLiveOrders === true,
|
|
151
161
|
posture: typeof raw.posture === "string" ? raw.posture : "unknown",
|
|
152
162
|
detail: typeof raw.detail === "string" ? raw.detail : "",
|
|
153
163
|
remedy: typeof raw.remedy === "string" ? raw.remedy : "",
|
|
164
|
+
providerSync,
|
|
154
165
|
};
|
|
155
166
|
}
|
|
156
167
|
|
|
@@ -185,6 +196,17 @@ export function normalizeDispatch(r) {
|
|
|
185
196
|
runId: typeof o.runId === "string" ? o.runId : null,
|
|
186
197
|
error: typeof o.error === "string" ? o.error : null,
|
|
187
198
|
domain: o.domain && typeof o.domain === "object" ? o.domain : null,
|
|
199
|
+
checkoutProviderConvergence:
|
|
200
|
+
o.checkoutProviderConvergence && typeof o.checkoutProviderConvergence === "object"
|
|
201
|
+
? {
|
|
202
|
+
outcome:
|
|
203
|
+
typeof o.checkoutProviderConvergence.outcome === "string" ? o.checkoutProviderConvergence.outcome : null,
|
|
204
|
+
storeDomain:
|
|
205
|
+
typeof o.checkoutProviderConvergence.storeDomain === "string"
|
|
206
|
+
? o.checkoutProviderConvergence.storeDomain
|
|
207
|
+
: null,
|
|
208
|
+
}
|
|
209
|
+
: null,
|
|
188
210
|
};
|
|
189
211
|
}
|
|
190
212
|
|
|
@@ -264,7 +286,13 @@ export function renderReadiness({ appDomain, readiness, action }) {
|
|
|
264
286
|
}
|
|
265
287
|
const payment = readiness.checkoutPaymentReadiness;
|
|
266
288
|
if (payment && payment.posture !== "no-checkout") {
|
|
267
|
-
|
|
289
|
+
const syncDetail = payment.providerSync
|
|
290
|
+
? payment.providerSync.status === "in-sync"
|
|
291
|
+
? "provider in sync"
|
|
292
|
+
: `provider drifted: ${payment.providerSync.drift.join(", ")}`
|
|
293
|
+
: "";
|
|
294
|
+
const paymentDetail = [payment.detail, syncDetail].filter(Boolean).join("; ");
|
|
295
|
+
lines.push(` ${payment.ready ? "✓" : "✗"} Live payments${paymentDetail ? ` — ${paymentDetail}` : ""}`);
|
|
268
296
|
if (!payment.ready && payment.remedy) lines.push(` → ${payment.remedy}`);
|
|
269
297
|
}
|
|
270
298
|
if (action === "connect") {
|
|
@@ -523,6 +551,10 @@ function rehearsalSetupLines(dnsSetup) {
|
|
|
523
551
|
export function reportGoLive({ status, dispatch, action, rehearsal, domain, noOpen, openUrl, dnsSetup }) {
|
|
524
552
|
const runUrl = status?.runUrl || null;
|
|
525
553
|
const revertHint = " Revert (one line): tot go-live --rollback";
|
|
554
|
+
if (dispatch?.checkoutProviderConvergence?.outcome === "converged") {
|
|
555
|
+
const store = dispatch.checkoutProviderConvergence.storeDomain;
|
|
556
|
+
console.log(`\n ✓ checkout provider converged${store ? ` on ${store}` : ""} — the dedicated store matches your checkout configuration.`);
|
|
557
|
+
}
|
|
526
558
|
|
|
527
559
|
if (status?.status === "succeeded") {
|
|
528
560
|
if (rehearsal) {
|
package/src/validate.mjs
CHANGED
|
@@ -28,7 +28,6 @@ import { createRedirectShadowCollector, shadowedRedirectMessage } from "./redire
|
|
|
28
28
|
import { pageSlugFindings } from "./page-slugs.mjs";
|
|
29
29
|
import { ANALYTICS_DECLARATION_FILE, analyticsDeclarationFindings } from "./analytics-declaration.mjs";
|
|
30
30
|
import { parseSku, skuCollisions, skuFindings } from "./sku.mjs";
|
|
31
|
-
import { resolveKnownProductCompliance } from "./known-product-catalog.mjs";
|
|
32
31
|
|
|
33
32
|
export {
|
|
34
33
|
TOT_CONFIG_KEYS,
|
|
@@ -171,11 +170,7 @@ function productClassificationGaps(product) {
|
|
|
171
170
|
const gaps = new Set();
|
|
172
171
|
for (const variant of variants) {
|
|
173
172
|
const explicitFlavors = collectCatalogFlavorLabels(product, variant);
|
|
174
|
-
const
|
|
175
|
-
(!explicitCategory && merchantType.length === 0) || explicitFlavors.length === 0
|
|
176
|
-
? resolveKnownProductCompliance(product, variant)
|
|
177
|
-
: undefined;
|
|
178
|
-
const category = explicitCategory ?? (merchantType.length === 0 ? known?.category : undefined);
|
|
173
|
+
const category = explicitCategory;
|
|
179
174
|
const categoryClassified = Boolean(category) || merchantType.length > 0;
|
|
180
175
|
if (!categoryClassified) gaps.add("category");
|
|
181
176
|
const haystack = [
|
|
@@ -196,10 +191,7 @@ function productClassificationGaps(product) {
|
|
|
196
191
|
const containsNicotine =
|
|
197
192
|
!isAccessory &&
|
|
198
193
|
(nicOptionSaysNonZero || (!nicOptionSaysZero && CATALOG_NICOTINE_HINTS.some((n) => haystack.includes(n))));
|
|
199
|
-
const
|
|
200
|
-
.map((f) => String(f ?? "").trim().toLowerCase())
|
|
201
|
-
.filter((f) => Boolean(f) && !CATALOG_NICOTINE_FORMAT_LABELS.has(f));
|
|
202
|
-
const flavorClassified = explicitFlavors.length > 0 || knownFlavors.length > 0;
|
|
194
|
+
const flavorClassified = explicitFlavors.length > 0;
|
|
203
195
|
if ((containsNicotine || !categoryClassified) && !flavorClassified) gaps.add("flavor");
|
|
204
196
|
}
|
|
205
197
|
return ["category", "flavor"].filter((g) => gaps.has(g));
|