@tokenoftrust/storefront-runner 7.3.2 → 7.5.1
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/agency-kit/tools/lib/catalog-model/files.mjs +11 -4
- package/agency-kit/tools/lib/catalog-model/model.mjs +5 -1
- package/agency-kit/tools/lib/redirect-shadows.mjs +261 -0
- package/apps/storefront/astro.config.mjs +8 -2
- package/apps/storefront/package.json +1 -2
- package/apps/storefront/src/components/catalog/storefront/ProductCard.astro +20 -6
- package/apps/storefront/src/components/catalog/storefront/islands/ImageGallery.tsx +17 -6
- package/apps/storefront/src/components/compliance/storefront/islands/CheckoutComplianceGate.tsx +1 -32
- package/apps/storefront/src/config/compliance/rulesets.ts +1 -1
- package/apps/storefront/src/layouts/Layout.astro +17 -0
- package/apps/storefront/src/lib/access/auth/agentRoles.ts +20 -0
- package/apps/storefront/src/lib/access/auth/agentSessionGate.ts +32 -8
- package/apps/storefront/src/lib/access/auth/brokerAssertion.ts +16 -2
- package/apps/storefront/src/lib/access/auth/contactReaderAuthority.ts +39 -0
- package/apps/storefront/src/lib/access/auth/loginGate.ts +15 -17
- package/apps/storefront/src/lib/access/dashboard/staffAdmission.ts +5 -0
- package/apps/storefront/src/lib/access/dashboard/tenantSelection.ts +2 -0
- package/apps/storefront/src/lib/access/shared/capability.ts +14 -6
- package/apps/storefront/src/lib/access/shared/generated/capabilityCatalog.generated.ts +161 -0
- package/apps/storefront/src/lib/activity/activityScope.ts +36 -0
- package/apps/storefront/src/lib/activity/recordActivity.ts +23 -1
- package/apps/storefront/src/lib/activity/serverFanOut.ts +31 -0
- package/apps/storefront/src/lib/activity/store.ts +9 -3
- package/apps/storefront/src/lib/checkout/agent/checkoutProtocol.ts +196 -0
- package/apps/storefront/src/lib/checkout/agent/checkoutSession.ts +296 -0
- package/apps/storefront/src/lib/checkout/agent/webBotAuth.ts +347 -0
- package/apps/storefront/src/lib/checkout/commerce/cardCartForm.ts +2 -0
- package/apps/storefront/src/lib/checkout/commerce/cartSession.ts +109 -12
- package/apps/storefront/src/lib/checkout/commerce/checkoutHandoffRoute.ts +53 -25
- package/apps/storefront/src/lib/checkout/commerce/finalCartAuthorization.ts +48 -6
- package/apps/storefront/src/lib/checkout/proposal/cartProposal.ts +388 -0
- package/apps/storefront/src/lib/checkout/proposal/listMatcher.ts +149 -0
- package/apps/storefront/src/lib/checkout/proposal/proposalRoutes.ts +522 -0
- package/apps/storefront/src/lib/checkout/proposal/reviewHtml.ts +100 -0
- package/apps/storefront/src/lib/compliance/browser/checkoutVerificationFlow.ts +26 -2
- package/apps/storefront/src/lib/content/shared/redirects.ts +21 -4
- package/apps/storefront/src/lib/publication/shared/edgeCache.ts +5 -2
- package/apps/storefront/src/lib/publication/shared/previewAnnotations/renderDecorator.ts +15 -8
- package/apps/storefront/src/lib/publication/shared/runtimeEnv.ts +1 -1
- package/apps/storefront/src/middleware/controlPlane.ts +15 -1
- package/apps/storefront/src/middleware/index.ts +7 -3
- package/apps/storefront/src/middleware/renderChain.ts +46 -33
- package/apps/storefront/src/pages/api/cart-proposal/confirm.ts +12 -0
- package/apps/storefront/src/pages/api/cart-proposal/review.ts +26 -0
- package/apps/storefront/src/pages/api/commerce/checkout-sessions/[id].ts +9 -0
- package/apps/storefront/src/pages/api/commerce/checkout-sessions.ts +8 -0
- package/apps/storefront/src/pages/api/commerce/final-cart-authorization.ts +29 -6
- package/apps/storefront/src/pages/api/compliance/preflight.ts +25 -1
- package/apps/storefront/src/pages/products/[handle].astro +2 -15
- package/apps/storefront/tsconfig.astro.json +11 -0
- package/package.json +1 -1
- package/packages/public-runtime/src/activity/README.md +12 -0
- package/packages/public-runtime/src/activity/catalog.ts +7 -0
- package/packages/public-runtime/src/activity/event.ts +19 -0
- package/packages/public-runtime/src/activity/redaction.ts +31 -2
- package/packages/public-runtime/src/catalog-files.ts +3 -2
- package/packages/public-runtime/src/checkout-orders.ts +18 -19
- package/packages/public-runtime/src/checkout.ts +70 -0
- package/packages/public-runtime/src/compliance/evaluate.ts +60 -1
- package/packages/public-runtime/src/compliance/index.ts +1 -1
- package/packages/public-runtime/src/compliance/pact-report.ts +184 -3
- package/packages/public-runtime/src/compliance/profile.ts +268 -20
- package/packages/public-runtime/src/compliance/ruleset.ts +42 -0
- package/packages/public-runtime/src/customization-runtime.ts +1 -1
- package/packages/public-runtime/src/product.ts +9 -1
- package/packages/public-runtime/src/publication-content-redirects.ts +16 -3
- package/packages/public-runtime/tests/fixtures/compliance-decisions.golden.json +252 -52
- package/pnpm-lock.runner.yaml +0 -15
- package/scripts/tenant/materialize-tenant-content.mjs +3 -0
- package/scripts/tenant/validate.mjs +128 -0
- package/apps/storefront/dev-plugins/dev-publish.mjs +0 -55
- package/apps/storefront/drizzle.config.apps.ts +0 -13
- package/apps/storefront/integrations/preview-annotations-client-bundle.mjs +0 -80
- package/apps/storefront/migrations-apps/0000_fast_millenium_guard.sql +0 -129
- package/apps/storefront/migrations-apps/0001_woozy_lyja.sql +0 -22
- package/apps/storefront/migrations-apps/0002_good_switch.sql +0 -26
- package/apps/storefront/migrations-apps/0003_mute_marauders.sql +0 -12
- package/apps/storefront/migrations-apps/0004_deep_morph.sql +0 -36
- package/apps/storefront/migrations-apps/0005_common_mystique.sql +0 -23
- package/apps/storefront/migrations-apps/0006_broad_microchip.sql +0 -16
- package/apps/storefront/migrations-apps/0007_brave_outlaw_kid.sql +0 -15
- package/apps/storefront/migrations-apps/0008_blue_dazzler.sql +0 -11
- package/apps/storefront/migrations-apps/0009_bored_shinobi_shaw.sql +0 -15
- package/apps/storefront/migrations-apps/0010_ws4_verified_provider_measurement.sql +0 -35
- package/apps/storefront/migrations-apps/0011_dt_tracking_tenant_databases.sql +0 -23
- package/apps/storefront/migrations-apps/0012_test_destinations.sql +0 -29
- package/apps/storefront/migrations-apps/0013_publication_space_editorial.sql +0 -64
- package/apps/storefront/migrations-apps/0014_retire_candidate_ledger.sql +0 -12
- package/apps/storefront/migrations-apps/0015_merchant_calculation_settings.sql +0 -31
- package/apps/storefront/migrations-apps/0016_scrappy_commerce_contract.sql +0 -166
- package/apps/storefront/migrations-apps/0017_commerce_durable_projection.sql +0 -28
- package/apps/storefront/migrations-apps/0018_commerce_provider_cart_identity.sql +0 -13
- package/apps/storefront/migrations-apps/0019_commerce_source_authority.sql +0 -23
- package/apps/storefront/migrations-apps/0020_contact_messages.sql +0 -18
- package/apps/storefront/migrations-apps/0021_contact_vault.sql +0 -166
- package/apps/storefront/migrations-apps/0022_contact_vault_fields.sql +0 -342
- package/apps/storefront/migrations-apps/0023_principal_grant_contacts.sql +0 -15
- package/apps/storefront/migrations-apps/0024_order_contact_erasure_state.sql +0 -22
- package/apps/storefront/migrations-apps/0025_shipment_audit_order_lookup.sql +0 -2
- package/apps/storefront/migrations-apps/0026_fulfillment_assignment.sql +0 -44
- package/apps/storefront/migrations-apps/0027_app_contact_authority.sql +0 -70
- package/apps/storefront/migrations-apps/0028_app_jwk_and_candidates.sql +0 -133
- package/apps/storefront/migrations-apps/0029_inventory_locations_wms.sql +0 -38
- package/apps/storefront/migrations-apps/0030_assignment_split_shipments.sql +0 -149
- package/apps/storefront/migrations-apps/meta/0000_snapshot.json +0 -843
- package/apps/storefront/migrations-apps/meta/0001_snapshot.json +0 -990
- package/apps/storefront/migrations-apps/meta/0002_snapshot.json +0 -1160
- package/apps/storefront/migrations-apps/meta/0003_snapshot.json +0 -1235
- package/apps/storefront/migrations-apps/meta/0004_snapshot.json +0 -1474
- package/apps/storefront/migrations-apps/meta/0005_snapshot.json +0 -1617
- package/apps/storefront/migrations-apps/meta/0006_snapshot.json +0 -1716
- package/apps/storefront/migrations-apps/meta/0007_snapshot.json +0 -1812
- package/apps/storefront/migrations-apps/meta/0008_snapshot.json +0 -1881
- package/apps/storefront/migrations-apps/meta/0009_snapshot.json +0 -1979
- package/apps/storefront/migrations-apps/meta/_journal.json +0 -76
- package/apps/storefront/perf/README.md +0 -64
- package/apps/storefront/perf/assert-budgets.ts +0 -159
- package/apps/storefront/platform-reconcile-tenants.json +0 -3
- package/apps/storefront/playwright.config.ts +0 -23
- package/apps/storefront/public/js/dashboard-access-banner.js +0 -53
- package/apps/storefront/public/js/dashboard-apps.js +0 -183
- package/apps/storefront/public/js/dashboard-contact-capture.js +0 -52
- package/apps/storefront/public/js/dashboard-delegate.js +0 -167
- package/apps/storefront/public/js/dashboard-team.js +0 -356
- package/apps/storefront/public/js/dashboard-vendor-search.js +0 -115
- package/apps/storefront/src/components/content/storefront/AsyncStylesheet.astro +0 -26
- package/apps/storefront/src/components/integrations/storefront/WidgetFrame.astro +0 -34
- package/apps/storefront/src/config/adminTenantLookup.ts +0 -35
- package/apps/storefront/src/config/evidenceTenantRoster.ts +0 -25
- package/apps/storefront/src/config/staffProvisionProjection.ts +0 -24
- package/apps/storefront/src/config/storeName.ts +0 -34
- package/apps/storefront/src/lib/access/admin/README.md +0 -122
- package/apps/storefront/src/lib/access/admin/adminShell.ts +0 -281
- package/apps/storefront/src/lib/access/admin/envelope.ts +0 -9
- package/apps/storefront/src/lib/access/admin/viewmodels/settings.ts +0 -64
- package/apps/storefront/src/lib/access/auth/adminApiGuard.ts +0 -66
- package/apps/storefront/src/lib/access/auth/adminEntry.ts +0 -126
- package/apps/storefront/src/lib/access/auth/mcpClientAssertion.ts +0 -217
- package/apps/storefront/src/lib/access/auth/operatorSession.ts +0 -120
- package/apps/storefront/src/lib/access/dashboard/agentStoreEntry.ts +0 -253
- package/apps/storefront/src/lib/access/dashboard/delegateGate.ts +0 -130
- package/apps/storefront/src/lib/access/dashboard/staffStoreEntry.ts +0 -153
- package/apps/storefront/src/lib/access/dashboard/staffVendorAccess.ts +0 -474
- package/apps/storefront/src/lib/access/dashboard/vendorQuery.ts +0 -61
- package/apps/storefront/src/lib/access/fixtures/settings.ts +0 -67
- package/apps/storefront/src/lib/access/fixtures/tenants.ts +0 -29
- package/apps/storefront/src/lib/access/notifications/magicLinkInviteEmail.ts +0 -62
- package/apps/storefront/src/lib/access/shared/grantContactLookup.ts +0 -97
- package/apps/storefront/src/lib/access/shared/principalGrants.ts +0 -775
- package/apps/storefront/src/lib/activity/alerts.ts +0 -426
- package/apps/storefront/src/lib/activity/candidateSubmitLease.ts +0 -87
- package/apps/storefront/src/lib/activity/changeActorAttribution.ts +0 -181
- package/apps/storefront/src/lib/activity/evidence/evidenceReference.ts +0 -32
- package/apps/storefront/src/lib/activity/fixtures/evidence.ts +0 -99
- package/apps/storefront/src/lib/activity/query.ts +0 -403
- package/apps/storefront/src/lib/activity/uiActor.ts +0 -152
- package/apps/storefront/src/lib/admin/services/mock/index.ts +0 -12
- package/apps/storefront/src/lib/assets/addons/catalog.ts +0 -60
- package/apps/storefront/src/lib/assets/addons/storeEntitlements.ts +0 -260
- package/apps/storefront/src/lib/assets/durableAssetsRoute.ts +0 -65
- package/apps/storefront/src/lib/assets/durableR2.ts +0 -473
- package/apps/storefront/src/lib/assets/durableR2Bindings.ts +0 -33
- package/apps/storefront/src/lib/automation/admin/viewmodels/aiWorkflows.ts +0 -65
- package/apps/storefront/src/lib/automation/ai/approvalMode.ts +0 -20
- package/apps/storefront/src/lib/automation/ai/askEnvelope.ts +0 -47
- package/apps/storefront/src/lib/automation/ai/audit.ts +0 -12
- package/apps/storefront/src/lib/automation/ai/operationalRuns.ts +0 -155
- package/apps/storefront/src/lib/automation/ai/recommendation.ts +0 -20
- package/apps/storefront/src/lib/automation/fixtures/aiWorkflows.ts +0 -59
- package/apps/storefront/src/lib/catalog/admin/catalogSettingsClient.ts +0 -250
- package/apps/storefront/src/lib/catalog/admin/catalogSettingsFields.ts +0 -134
- package/apps/storefront/src/lib/catalog/admin/catalogSettingsPreview.ts +0 -37
- package/apps/storefront/src/lib/catalog/admin/catalogSettingsPricingView.ts +0 -39
- package/apps/storefront/src/lib/catalog/admin/catalogSettingsRuleView.ts +0 -44
- package/apps/storefront/src/lib/catalog/admin/catalogSettingsSkuView.ts +0 -21
- package/apps/storefront/src/lib/catalog/admin/catalogSettingsState.ts +0 -132
- package/apps/storefront/src/lib/catalog/admin/productSetupPhoto.ts +0 -23
- package/apps/storefront/src/lib/catalog/admin/productsTabClient.ts +0 -193
- package/apps/storefront/src/lib/catalog/admin/services/catalogProducts.ts +0 -32
- package/apps/storefront/src/lib/catalog/admin/viewmodels/catalogProducts.ts +0 -164
- package/apps/storefront/src/lib/catalog/admin/viewmodels/products.ts +0 -267
- package/apps/storefront/src/lib/catalog/fixtures/products.ts +0 -105
- package/apps/storefront/src/lib/catalog/tot/syncState.ts +0 -111
- package/apps/storefront/src/lib/checkout/admin/checkoutStyleInput.ts +0 -172
- package/apps/storefront/src/lib/checkout/admin/checkoutStyleTarget.ts +0 -65
- package/apps/storefront/src/lib/checkout/browser/checkoutExciseForm.ts +0 -152
- package/apps/storefront/src/lib/checkout/browser/checkoutRequirementsForm.ts +0 -72
- package/apps/storefront/src/lib/checkout/browser/checkoutStyleForm.ts +0 -110
- package/apps/storefront/src/lib/checkout/browser/settingDraftActions.ts +0 -367
- package/apps/storefront/src/lib/checkout/commerce/checkoutSettings.ts +0 -246
- package/apps/storefront/src/lib/checkout/fixtures/checkoutSettings.ts +0 -77
- package/apps/storefront/src/lib/content/blog/markdown.ts +0 -174
- package/apps/storefront/src/lib/content/chrome/examples/tokenoftrust.chrome-assignments.example.json +0 -6
- package/apps/storefront/src/lib/content/chrome/examples/tokenoftrust.chrome.example.json +0 -79
- package/apps/storefront/src/lib/content/index.ts +0 -27
- package/apps/storefront/src/lib/content/the-build/readingTime.ts +0 -35
- package/apps/storefront/src/lib/content/the-build/toc.ts +0 -95
- package/apps/storefront/src/lib/customers/admin/viewmodels/customers.ts +0 -56
- package/apps/storefront/src/lib/customers/contactVault/blindIndex.ts +0 -28
- package/apps/storefront/src/lib/customers/contactVault/contactAudit.ts +0 -149
- package/apps/storefront/src/lib/customers/contactVault/dataKeys.ts +0 -283
- package/apps/storefront/src/lib/customers/contactVault/fieldEnvelope.ts +0 -88
- package/apps/storefront/src/lib/customers/contactVault/isolateMetrics.ts +0 -37
- package/apps/storefront/src/lib/customers/contactVault/kms.ts +0 -292
- package/apps/storefront/src/lib/customers/contactVault/retention.ts +0 -302
- package/apps/storefront/src/lib/customers/contactVault/retentionPolicy.ts +0 -290
- package/apps/storefront/src/lib/customers/contactVault/zip3.ts +0 -24
- package/apps/storefront/src/lib/customers/fixtures/customers.ts +0 -86
- package/apps/storefront/src/lib/developer-experience/admin/memoizeByEnvelope.ts +0 -27
- package/apps/storefront/src/lib/developer-experience/admin/seed.ts +0 -54
- package/apps/storefront/src/lib/developer-experience/dev/activityIngestToken.ts +0 -85
- package/apps/storefront/src/lib/developer-experience/dev/activityStore.ts +0 -82
- package/apps/storefront/src/lib/developer-experience/dev/agentGrantAttestation.ts +0 -74
- package/apps/storefront/src/lib/developer-experience/dev/ai-widget-client.js +0 -308
- package/apps/storefront/src/lib/developer-experience/dev/apiBase.ts +0 -17
- package/apps/storefront/src/lib/developer-experience/dev/cliSignInCode.ts +0 -124
- package/apps/storefront/src/lib/developer-experience/dev/cockpit/ask.ts +0 -49
- package/apps/storefront/src/lib/developer-experience/dev/cockpit/clickToSource.ts +0 -71
- package/apps/storefront/src/lib/developer-experience/dev/cockpit/copyCommand.ts +0 -227
- package/apps/storefront/src/lib/developer-experience/dev/cockpit/files.ts +0 -249
- package/apps/storefront/src/lib/developer-experience/dev/cockpit/hostedActivity.ts +0 -500
- package/apps/storefront/src/lib/developer-experience/dev/cockpit/infoPopover.ts +0 -12
- package/apps/storefront/src/lib/developer-experience/dev/cockpit/mcpCopy.ts +0 -34
- package/apps/storefront/src/lib/developer-experience/dev/cockpit/monitor.ts +0 -107
- package/apps/storefront/src/lib/developer-experience/dev/cockpit/stepper.ts +0 -116
- package/apps/storefront/src/lib/developer-experience/dev/cockpit/themeToggle.ts +0 -23
- package/apps/storefront/src/lib/developer-experience/dev/livePreview.ts +0 -77
- package/apps/storefront/src/lib/developer-experience/dev/obstacleStore.ts +0 -214
- package/apps/storefront/src/lib/developer-experience/dev/previewStatus.ts +0 -87
- package/apps/storefront/src/lib/developer-experience/dev/rendezvousBroker.ts +0 -226
- package/apps/storefront/src/lib/developer-experience/dev/runtimeStore.ts +0 -291
- package/apps/storefront/src/lib/developer-experience/dev/storeStatus.ts +0 -142
- package/apps/storefront/src/lib/developer-experience/dev/subjectReissue.ts +0 -67
- package/apps/storefront/src/lib/developer-experience/fixtures/regulated-commerce-truth/index.ts +0 -540
- package/apps/storefront/src/lib/developer-experience/fixtures/ws3-readonly-clone-preflight/index.ts +0 -495
- package/apps/storefront/src/lib/engagement/contact/contactMessages.ts +0 -671
- package/apps/storefront/src/lib/engagement/contact/messagesTabClient.ts +0 -175
- package/apps/storefront/src/lib/engagement/contact/submission.ts +0 -112
- package/apps/storefront/src/lib/engagement/messaging/messagesClient.ts +0 -149
- package/apps/storefront/src/lib/engagement/newsletter/digest.ts +0 -117
- package/apps/storefront/src/lib/engagement/newsletter/resendClient.ts +0 -79
- package/apps/storefront/src/lib/engagement/newsletter/send.ts +0 -265
- package/apps/storefront/src/lib/engagement/social/golive.ts +0 -212
- package/apps/storefront/src/lib/engagement/social/notify.ts +0 -32
- package/apps/storefront/src/lib/engagement/social/tokenStore.ts +0 -171
- package/apps/storefront/src/lib/fulfillment/admin/commerceDesk.ts +0 -180
- package/apps/storefront/src/lib/fulfillment/admin/commerceDeskRouting.ts +0 -45
- package/apps/storefront/src/lib/fulfillment/admin/viewmodels/fulfillment.ts +0 -1071
- package/apps/storefront/src/lib/fulfillment/appShipmentEvidence.ts +0 -271
- package/apps/storefront/src/lib/fulfillment/carrierEvidence.ts +0 -105
- package/apps/storefront/src/lib/fulfillment/commerceProjection.ts +0 -157
- package/apps/storefront/src/lib/fulfillment/commerceReadback.ts +0 -60
- package/apps/storefront/src/lib/fulfillment/commerceRecovery.ts +0 -84
- package/apps/storefront/src/lib/fulfillment/commerceRuntime.ts +0 -41
- package/apps/storefront/src/lib/fulfillment/fulfillmentService.ts +0 -2842
- package/apps/storefront/src/lib/fulfillment/readiness.ts +0 -217
- package/apps/storefront/src/lib/fulfillment/splitShipments.ts +0 -388
- package/apps/storefront/src/lib/fulfillment/syntheticPreviewOrders.ts +0 -292
- package/apps/storefront/src/lib/integrations/apps/appContactAuthority.ts +0 -27
- package/apps/storefront/src/lib/integrations/apps/appContactConsents.ts +0 -118
- package/apps/storefront/src/lib/integrations/apps/appInstallEnv.ts +0 -28
- package/apps/storefront/src/lib/integrations/apps/gtmMigrationDraft.ts +0 -103
- package/apps/storefront/src/lib/integrations/apps/inventoryWrite.ts +0 -906
- package/apps/storefront/src/lib/integrations/apps/orders/customerHash.ts +0 -28
- package/apps/storefront/src/lib/integrations/apps/orders/idempotency.ts +0 -100
- package/apps/storefront/src/lib/integrations/apps/reports/salesVelocityReport.ts +0 -96
- package/apps/storefront/src/lib/integrations/apps/routeParams.ts +0 -45
- package/apps/storefront/src/lib/integrations/webhooks/cloudflareQueueDispatcher.ts +0 -82
- package/apps/storefront/src/lib/integrations/webhooks/commercePayloads.ts +0 -159
- package/apps/storefront/src/lib/integrations/webhooks/deliveryEngine.ts +0 -379
- package/apps/storefront/src/lib/integrations/webhooks/deliveryMapper.ts +0 -34
- package/apps/storefront/src/lib/integrations/webhooks/deliveryStore.ts +0 -903
- package/apps/storefront/src/lib/integrations/webhooks/dispatcher.ts +0 -168
- package/apps/storefront/src/lib/integrations/webhooks/emit.ts +0 -245
- package/apps/storefront/src/lib/integrations/webhooks/events.ts +0 -105
- package/apps/storefront/src/lib/integrations/webhooks/getDispatcher.ts +0 -77
- package/apps/storefront/src/lib/integrations/webhooks/orderFulfilledClaim.ts +0 -75
- package/apps/storefront/src/lib/measurement/admin/analyticsRegionPolicy.ts +0 -151
- package/apps/storefront/src/lib/measurement/admin/analyticsRegionsClient.ts +0 -84
- package/apps/storefront/src/lib/measurement/admin/consentSettingsClient.ts +0 -113
- package/apps/storefront/src/lib/measurement/analytics/index.ts +0 -44
- package/apps/storefront/src/lib/measurement/attribution/attributionService.ts +0 -206
- package/apps/storefront/src/lib/measurement/attribution/orderConversionD1.ts +0 -150
- package/apps/storefront/src/lib/measurement/attribution/verifiedProviderMeasurement.ts +0 -118
- package/apps/storefront/src/lib/measurement/tracking/interactionCollector.ts +0 -205
- package/apps/storefront/src/lib/measurement/tracking/pruneRollup.ts +0 -260
- package/apps/storefront/src/lib/measurement/tracking/tenantReadAccess.ts +0 -138
- package/apps/storefront/src/lib/measurement/tracking-writeback/rewriteTrackingIds.ts +0 -175
- package/apps/storefront/src/lib/measurement/tracking-writeback/writebackCandidate.ts +0 -110
- package/apps/storefront/src/lib/observability/diag/capture.ts +0 -162
- package/apps/storefront/src/lib/observability/diag/consoleLine.ts +0 -76
- package/apps/storefront/src/lib/observability/diag/debugConsole.ts +0 -118
- package/apps/storefront/src/lib/observability/diag/debugMode.ts +0 -163
- package/apps/storefront/src/lib/observability/diag/debugWindow.ts +0 -111
- package/apps/storefront/src/lib/observability/diag/redact.ts +0 -17
- package/apps/storefront/src/lib/observability/diag/reference.ts +0 -148
- package/apps/storefront/src/lib/observability/diag/referenceStore.ts +0 -113
- package/apps/storefront/src/lib/observability/diag/report.ts +0 -110
- package/apps/storefront/src/lib/observability/diag/serverResponseTime.ts +0 -91
- package/apps/storefront/src/lib/observability/diag/session.ts +0 -93
- package/apps/storefront/src/lib/observability/monitoring/manifest.ts +0 -301
- package/apps/storefront/src/lib/observability/performance/lighthouseReport.ts +0 -109
- package/apps/storefront/src/lib/observability/performance/rumAlert.ts +0 -179
- package/apps/storefront/src/lib/orders/admin/orderActions.ts +0 -556
- package/apps/storefront/src/lib/orders/admin/orderClient.ts +0 -248
- package/apps/storefront/src/lib/orders/admin/orderSource.ts +0 -410
- package/apps/storefront/src/lib/orders/admin/services/orders.ts +0 -922
- package/apps/storefront/src/lib/orders/admin/viewmodels/orders.ts +0 -135
- package/apps/storefront/src/lib/orders/data/commerceCallerConfig.ts +0 -37
- package/apps/storefront/src/lib/orders/data/ledgerContractOrders.ts +0 -148
- package/apps/storefront/src/lib/orders/data/orderForwardReceiver.ts +0 -532
- package/apps/storefront/src/lib/orders/data/orderMapper.ts +0 -454
- package/apps/storefront/src/lib/orders/data/ordersStore.ts +0 -623
- package/apps/storefront/src/lib/orders/data/sourceAuthorityContract.ts +0 -380
- package/apps/storefront/src/lib/orders/data/sourceAuthorityStore.ts +0 -830
- package/apps/storefront/src/lib/orders/fixtures/orders.ts +0 -186
- package/apps/storefront/src/lib/orders/providers/foxyOrderClient.ts +0 -207
- package/apps/storefront/src/lib/orders/vault/appRecipientRead.ts +0 -222
- package/apps/storefront/src/lib/orders/vault/contactIntake.ts +0 -63
- package/apps/storefront/src/lib/orders/vault/contactRoutes.ts +0 -110
- package/apps/storefront/src/lib/orders/vault/kmsEnv.ts +0 -11
- package/apps/storefront/src/lib/orders/vault/orderContact.ts +0 -96
- package/apps/storefront/src/lib/orders/vault/orderContactVault.ts +0 -1427
- package/apps/storefront/src/lib/orders/vault/vault-test-support.ts +0 -258
- package/apps/storefront/src/lib/publication/d1/schema-apps.ts +0 -808
- package/apps/storefront/src/lib/publication/notifications/candidateConflictEmail.ts +0 -80
- package/apps/storefront/src/lib/publication/servingMode.ts +0 -52
- package/apps/storefront/src/lib/publication/shared/previewAnnotations/moduleAsset.ts +0 -65
- package/apps/storefront/src/lib/publication/shared/routedApiParam.ts +0 -38
- package/apps/storefront/src/lib/reporting/admin/viewmodels/reporting.ts +0 -34
- package/apps/storefront/src/lib/reporting/fixtures/reporting.ts +0 -51
- package/apps/storefront/src/lib/subscriptions/admin/viewmodels/subscriptions.ts +0 -106
- package/apps/storefront/src/lib/subscriptions/fixtures/subscriptions.ts +0 -398
- package/apps/storefront/src/pages/api/admin/activity-alerts.ts +0 -58
- package/apps/storefront/src/pages/api/admin/commerce-readiness.ts +0 -172
- package/apps/storefront/src/pages/api/admin/fulfillment/batches.ts +0 -59
- package/apps/storefront/src/pages/api/admin/fulfillment/orders/[id]/address.ts +0 -66
- package/apps/storefront/src/pages/api/admin/fulfillment/orders/[id].ts +0 -118
- package/apps/storefront/src/pages/api/admin/fulfillment/orders/contact-search.ts +0 -26
- package/apps/storefront/src/pages/api/admin/fulfillment/orders/contacts.ts +0 -22
- package/apps/storefront/src/pages/api/admin/interaction-insights.ts +0 -101
- package/apps/storefront/src/pages/api/admin/orders/[id].ts +0 -63
- package/apps/storefront/src/pages/api/admin/orders.ts +0 -65
- package/apps/storefront/src/pages/api/contact.ts +0 -144
- package/apps/storefront/src/scheduled/contactVaultSweep.ts +0 -113
- package/apps/storefront/src/styles/admin.css +0 -1161
- package/apps/storefront/test/pipeline/fake-preview-services.ts +0 -288
- package/apps/storefront/test/pipeline/harness.ts +0 -209
- package/apps/storefront/test/pipeline/intake-worker.mjs +0 -14
- package/apps/storefront/test/pipeline/matrix-faults.ts +0 -366
- package/apps/storefront/test/pipeline/pipeline-host.ts +0 -418
- package/apps/storefront/test/pipeline/pool-config.cjs +0 -85
- package/apps/storefront/test/pipeline/publish-kinds.ts +0 -279
- package/apps/storefront/test/pipeline/synthetic-job.ts +0 -303
- package/apps/storefront/test/pipeline-faults/matrix-lib.ts +0 -696
- package/apps/storefront/vitest.config.cts +0 -44
- package/apps/storefront/vitest.faults.config.cts +0 -13
- package/apps/storefront/vitest.workers.config.cts +0 -7
- package/packages/feedback/fixtures/v1/expected-findings.json +0 -16
- package/packages/feedback/fixtures/v1/feedback-action/invalid/carries-transport-credential.json +0 -14
- package/packages/feedback/fixtures/v1/feedback-action/invalid/control-char-in-description.json +0 -13
- package/packages/feedback/fixtures/v1/feedback-action/invalid/legacy-schema-version.json +0 -13
- package/packages/feedback/fixtures/v1/feedback-action/invalid/page-path-with-query.json +0 -14
- package/packages/feedback/fixtures/v1/feedback-action/invalid/title-too-short.json +0 -13
- package/packages/feedback/fixtures/v1/feedback-action/valid/element-problem.json +0 -33
- package/packages/feedback/fixtures/v1/feedback-action/valid/page-comment.json +0 -20
- package/packages/feedback/fixtures/v1/feedback-action/valid/region-improvement.json +0 -24
- package/packages/feedback/fixtures/v1/feedback-action/valid/text-selection-feature.json +0 -30
- package/packages/feedback/fixtures/v1/submission-receipt/invalid/accepted-at-not-utc.json +0 -9
- package/packages/feedback/fixtures/v1/submission-receipt/invalid/bad-feedback-id.json +0 -9
- package/packages/feedback/fixtures/v1/submission-receipt/invalid/legacy-contract-version.json +0 -9
- package/packages/feedback/fixtures/v1/submission-receipt/invalid/missing-replayed.json +0 -8
- package/packages/feedback/fixtures/v1/submission-receipt/valid/accepted.json +0 -9
- package/packages/feedback/fixtures/v1/submission-receipt/valid/fractional-seconds.json +0 -9
- package/packages/feedback/fixtures/v1/submission-receipt/valid/replayed.json +0 -9
- package/packages/feedback/fixtures/v1/target-evidence/invalid/page-kind-claims-structure.json +0 -6
- package/packages/feedback/fixtures/v1/target-evidence/invalid/path-too-deep.json +0 -17
- package/packages/feedback/fixtures/v1/target-evidence/invalid/relative-region-out-of-range.json +0 -11
- package/packages/feedback/fixtures/v1/target-evidence/invalid/selector-uses-class.json +0 -7
- package/packages/feedback/fixtures/v1/target-evidence/invalid/source-precision-without-anchor.json +0 -6
- package/packages/feedback/fixtures/v1/target-evidence/valid/element-structure.json +0 -21
- package/packages/feedback/fixtures/v1/target-evidence/valid/host-iframe.json +0 -14
- package/packages/feedback/fixtures/v1/target-evidence/valid/source-anchor.json +0 -12
- package/packages/feedback/fixtures/v1/target-evidence/valid/text-selection.json +0 -26
- package/packages/feedback/package.json +0 -35
- package/packages/feedback/scripts/build-player.mjs +0 -28
- package/packages/feedback/src/index.ts +0 -1
- package/packages/feedback/src/primitives/composer.ts +0 -639
- package/packages/feedback/src/primitives/dialog.ts +0 -263
- package/packages/feedback/src/primitives/hostAdapter.ts +0 -116
- package/packages/feedback/src/primitives/index.ts +0 -10
- package/packages/feedback/src/primitives/launcher.ts +0 -200
- package/packages/feedback/src/primitives/picker.ts +0 -663
- package/packages/feedback/src/primitives/redaction.ts +0 -204
- package/packages/feedback/src/primitives/selection.ts +0 -49
- package/packages/feedback/src/primitives/shiftAccelerator.ts +0 -160
- package/packages/feedback/src/primitives/styles.ts +0 -77
- package/packages/feedback/src/primitives/surface.ts +0 -124
- package/packages/feedback/src/primitives/target.ts +0 -293
- package/packages/feedback/src/tour/canonical.ts +0 -27
- package/packages/feedback/src/tour/index.ts +0 -3
- package/packages/feedback/src/tour/player/browser.ts +0 -5
- package/packages/feedback/src/tour/player/host.ts +0 -12
- package/packages/feedback/src/tour/player/index.ts +0 -205
- package/packages/feedback/src/tour/player/manifest.ts +0 -76
- package/packages/feedback/src/tour/player/player.css +0 -130
- package/packages/feedback/src/tour/player/resolver.ts +0 -12
- package/packages/feedback/src/tour/player/surface.ts +0 -295
- package/packages/feedback/src/tour/player/types.ts +0 -8
- package/packages/feedback/src/tour/resolve/core.ts +0 -267
- package/packages/feedback/src/tour/resolve/dom.ts +0 -115
- package/packages/feedback/src/tour/resolve/index.ts +0 -29
- package/packages/feedback/src/tour/sanitize.ts +0 -76
- package/packages/feedback/src/tour/schema.ts +0 -362
- package/packages/feedback/src/v1/guards.ts +0 -335
- package/packages/feedback/src/v1/index.ts +0 -3
- package/packages/feedback/src/v1/protectedSurfaces.ts +0 -32
- package/packages/feedback/src/v1/types.ts +0 -177
- package/packages/feedback/tsconfig.json +0 -9
- package/packages/feedback/vitest.config.cts +0 -21
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The feedback dialog: a non-blocking panel that opens from the launcher, the API, or a guarded
|
|
3
|
-
* double-Shift, and hands focus back to where it came from when it closes.
|
|
4
|
-
*
|
|
5
|
-
* The double-Shift guard (see shiftAccelerator.ts) ignores key repeat, modifier combinations, IME
|
|
6
|
-
* composition, typing in inputs/textareas/contenteditable, the dialog's own events, and any Shift
|
|
7
|
-
* tap while the dialog is already open. It never calls preventDefault.
|
|
8
|
-
*/
|
|
9
|
-
import { isSurfacePermitted, type HostAdapter } from "./hostAdapter.js";
|
|
10
|
-
import { attachDoubleShift, type DoubleShiftBinding } from "./shiftAccelerator.js";
|
|
11
|
-
import { createSurface, eventFromHost, h } from "./surface.js";
|
|
12
|
-
|
|
13
|
-
export type DialogTrigger = "shortcut" | "api";
|
|
14
|
-
export type DialogCloseReason = "escape" | "close-button" | "api" | "unmount";
|
|
15
|
-
|
|
16
|
-
export interface DialogOptions {
|
|
17
|
-
win: Window;
|
|
18
|
-
doc: Document;
|
|
19
|
-
adapter?: HostAdapter;
|
|
20
|
-
title: string;
|
|
21
|
-
/**
|
|
22
|
-
* Trap Tab inside the dialog and mark it `aria-modal`. `"narrow"` does so only while the viewport
|
|
23
|
-
* is in the narrow bottom-sheet layout, re-evaluated on resize. Default false.
|
|
24
|
-
*/
|
|
25
|
-
modal?: boolean | "narrow";
|
|
26
|
-
/** Install the guarded double-Shift opener on mount. Default true (also needs the "shortcut" surface). */
|
|
27
|
-
shortcut?: boolean | { windowMs?: number; cooldownMs?: number };
|
|
28
|
-
/**
|
|
29
|
-
* Offer Move left / Move right / Reset position buttons and a title-bar drag so the dialog can be
|
|
30
|
-
* shifted off whatever it covers. Inactive in the narrow bottom-sheet layout. Default false.
|
|
31
|
-
*/
|
|
32
|
-
movable?: boolean;
|
|
33
|
-
/** Extra veto for the shortcut (for example, while the picker is active). */
|
|
34
|
-
isShortcutBlocked?(): boolean;
|
|
35
|
-
/** Where focus goes on close when the element that had it is gone (usually the launcher button). */
|
|
36
|
-
focusFallback?(): HTMLElement | null;
|
|
37
|
-
onOpen?(trigger: DialogTrigger): void;
|
|
38
|
-
onClose?(reason: DialogCloseReason): void;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface Dialog {
|
|
42
|
-
/** Attach the surface and install listeners. Idempotent. Returns false when not permitted. */
|
|
43
|
-
mount(): boolean;
|
|
44
|
-
/** Close if open, remove listeners and the surface. Idempotent. */
|
|
45
|
-
unmount(): void;
|
|
46
|
-
/**
|
|
47
|
-
* Open. `returnFocus` names the element to refocus on close; default is the page element that
|
|
48
|
-
* had focus. A no-op that returns false when already open or not permitted.
|
|
49
|
-
*/
|
|
50
|
-
open(trigger?: DialogTrigger, returnFocus?: HTMLElement | null): boolean;
|
|
51
|
-
close(reason?: DialogCloseReason): void;
|
|
52
|
-
readonly isOpen: boolean;
|
|
53
|
-
readonly isMounted: boolean;
|
|
54
|
-
/** Container for the dialog's content. */
|
|
55
|
-
readonly body: HTMLElement;
|
|
56
|
-
/** The dialog element itself (role="dialog"). */
|
|
57
|
-
readonly element: HTMLElement;
|
|
58
|
-
/** The element placed in the page. */
|
|
59
|
-
readonly host: HTMLElement;
|
|
60
|
-
setTitle(title: string): void;
|
|
61
|
-
setShortcutEnabled(enabled: boolean): void;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const FOCUSABLE =
|
|
65
|
-
"button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), summary, [tabindex]:not([tabindex='-1'])";
|
|
66
|
-
|
|
67
|
-
export function createDialog(options: DialogOptions): Dialog {
|
|
68
|
-
const { win, doc, adapter } = options;
|
|
69
|
-
const surface = createSurface({ win, doc, adapter, tag: "feedback-dialog" });
|
|
70
|
-
const titleId = "fb-dialog-title";
|
|
71
|
-
const titleEl = h(doc, "h2", { id: titleId, text: options.title });
|
|
72
|
-
const closeBtn = h(doc, "button", { type: "button", "aria-label": "Close", text: "✕" });
|
|
73
|
-
const body = h(doc, "div", { class: "body" });
|
|
74
|
-
const element = h(doc, "div", { class: "dialog", role: "dialog", "aria-labelledby": titleId, hidden: true });
|
|
75
|
-
const NARROW_PX = 600;
|
|
76
|
-
const isModal = () => options.modal === true || (options.modal === "narrow" && win.innerWidth <= NARROW_PX);
|
|
77
|
-
const syncModal = () => {
|
|
78
|
-
if (isModal()) element.setAttribute("aria-modal", "true");
|
|
79
|
-
else element.removeAttribute("aria-modal");
|
|
80
|
-
};
|
|
81
|
-
syncModal();
|
|
82
|
-
const titlebar = h(doc, "div", { class: "titlebar" }, titleEl);
|
|
83
|
-
element.append(titlebar, body);
|
|
84
|
-
surface.root.append(element);
|
|
85
|
-
|
|
86
|
-
// ---- optional movement: a pure offset, so Reset is exact and the layout CSS stays the source of position
|
|
87
|
-
const MOVE_STEP = 48;
|
|
88
|
-
let offset = { dx: 0, dy: 0 };
|
|
89
|
-
const applyOffset = () => {
|
|
90
|
-
// Keep the dialog on screen: clamp against its un-offset position.
|
|
91
|
-
const r = element.getBoundingClientRect();
|
|
92
|
-
const baseLeft = r.left - offset.dx;
|
|
93
|
-
const baseTop = r.top - offset.dy;
|
|
94
|
-
const dx = Math.min(Math.max(8 - baseLeft, offset.dx), win.innerWidth - 8 - (baseLeft + r.width));
|
|
95
|
-
const dy = Math.min(Math.max(8 - baseTop, offset.dy), win.innerHeight - 8 - (baseTop + r.height));
|
|
96
|
-
offset = { dx: Number.isFinite(dx) ? dx : 0, dy: Number.isFinite(dy) ? dy : 0 };
|
|
97
|
-
element.style.setProperty("translate", offset.dx === 0 && offset.dy === 0 ? "none" : `${offset.dx}px ${offset.dy}px`);
|
|
98
|
-
};
|
|
99
|
-
const moveBy = (dx: number, reset = false) => {
|
|
100
|
-
if (win.innerWidth <= NARROW_PX) return;
|
|
101
|
-
offset = reset ? { dx: 0, dy: 0 } : { dx: offset.dx + dx, dy: offset.dy };
|
|
102
|
-
applyOffset();
|
|
103
|
-
};
|
|
104
|
-
if (options.movable) {
|
|
105
|
-
const move = (label: string, text: string, onClick: () => void) => {
|
|
106
|
-
const b = h(doc, "button", { type: "button", class: "move", "aria-label": label, text });
|
|
107
|
-
b.addEventListener("click", (e) => {
|
|
108
|
-
e.preventDefault();
|
|
109
|
-
onClick();
|
|
110
|
-
});
|
|
111
|
-
return b;
|
|
112
|
-
};
|
|
113
|
-
titlebar.append(
|
|
114
|
-
move("Move left", "◀", () => moveBy(-MOVE_STEP)),
|
|
115
|
-
move("Move right", "▶", () => moveBy(MOVE_STEP)),
|
|
116
|
-
move("Reset position", "Reset", () => moveBy(0, true)),
|
|
117
|
-
);
|
|
118
|
-
titlebar.addEventListener("pointerdown", (e) => {
|
|
119
|
-
const pe = e as PointerEvent;
|
|
120
|
-
if (pe.button > 0 || win.innerWidth <= NARROW_PX || (pe.target as Element).closest?.("button")) return;
|
|
121
|
-
const start = { x: pe.clientX, y: pe.clientY, base: { ...offset } };
|
|
122
|
-
const onMove = (ev: Event) => {
|
|
123
|
-
const m = ev as PointerEvent;
|
|
124
|
-
offset = { dx: start.base.dx + m.clientX - start.x, dy: start.base.dy + m.clientY - start.y };
|
|
125
|
-
applyOffset();
|
|
126
|
-
};
|
|
127
|
-
const onUp = () => {
|
|
128
|
-
win.removeEventListener("pointermove", onMove, true);
|
|
129
|
-
win.removeEventListener("pointerup", onUp, true);
|
|
130
|
-
win.removeEventListener("pointercancel", onUp, true);
|
|
131
|
-
};
|
|
132
|
-
win.addEventListener("pointermove", onMove, true);
|
|
133
|
-
win.addEventListener("pointerup", onUp, true);
|
|
134
|
-
win.addEventListener("pointercancel", onUp, true);
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
let open = false;
|
|
139
|
-
let mounted = false;
|
|
140
|
-
let returnFocus: HTMLElement | null = null;
|
|
141
|
-
let shortcutEnabled = options.shortcut !== false;
|
|
142
|
-
let binding: DoubleShiftBinding | null = null;
|
|
143
|
-
|
|
144
|
-
const own = (e: Event) => eventFromHost(e, surface.host);
|
|
145
|
-
|
|
146
|
-
const restoreFocus = () => {
|
|
147
|
-
const target = returnFocus;
|
|
148
|
-
returnFocus = null;
|
|
149
|
-
const usable = target && target.isConnected && target !== doc.body && target !== doc.documentElement;
|
|
150
|
-
(usable ? target : (options.focusFallback?.() ?? null))?.focus();
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
const focusInitial = () => {
|
|
154
|
-
const first = body.querySelector<HTMLElement>(FOCUSABLE);
|
|
155
|
-
(first ?? closeBtn).focus();
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
const onKeyDown = (e: Event) => {
|
|
159
|
-
const ke = e as KeyboardEvent;
|
|
160
|
-
if (!open) return;
|
|
161
|
-
if (ke.key === "Escape" && !ke.defaultPrevented) {
|
|
162
|
-
ke.preventDefault();
|
|
163
|
-
api.close("escape");
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
if (ke.key === "Tab" && isModal() && own(ke)) {
|
|
167
|
-
const items = Array.from(element.querySelectorAll<HTMLElement>(FOCUSABLE));
|
|
168
|
-
const first = items[0];
|
|
169
|
-
const last = items[items.length - 1];
|
|
170
|
-
const active = surface.shadow.activeElement;
|
|
171
|
-
if (ke.shiftKey && active === first) {
|
|
172
|
-
ke.preventDefault();
|
|
173
|
-
last?.focus();
|
|
174
|
-
} else if (!ke.shiftKey && active === last) {
|
|
175
|
-
ke.preventDefault();
|
|
176
|
-
first?.focus();
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
titlebar.append(closeBtn);
|
|
182
|
-
closeBtn.addEventListener("click", (e) => {
|
|
183
|
-
e.preventDefault();
|
|
184
|
-
api.close("close-button");
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
const syncShortcut = () => {
|
|
188
|
-
const want = mounted && shortcutEnabled && isSurfacePermitted(adapter, "shortcut") && isSurfacePermitted(adapter, "dialog");
|
|
189
|
-
if (want && !binding) {
|
|
190
|
-
const cfg = typeof options.shortcut === "object" ? options.shortcut : {};
|
|
191
|
-
binding = attachDoubleShift(win, {
|
|
192
|
-
...cfg,
|
|
193
|
-
isOwnEvent: own,
|
|
194
|
-
isSuppressed: () => open || (options.isShortcutBlocked?.() ?? false),
|
|
195
|
-
onActivate: () => {
|
|
196
|
-
api.open("shortcut");
|
|
197
|
-
},
|
|
198
|
-
});
|
|
199
|
-
} else if (!want && binding) {
|
|
200
|
-
binding.detach();
|
|
201
|
-
binding = null;
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
const api: Dialog = {
|
|
206
|
-
mount() {
|
|
207
|
-
if (!isSurfacePermitted(adapter, "dialog")) return false;
|
|
208
|
-
if (mounted) return true;
|
|
209
|
-
mounted = true;
|
|
210
|
-
surface.attach();
|
|
211
|
-
win.addEventListener("keydown", onKeyDown, true);
|
|
212
|
-
if (options.modal === "narrow") win.addEventListener("resize", syncModal);
|
|
213
|
-
syncModal();
|
|
214
|
-
syncShortcut();
|
|
215
|
-
return true;
|
|
216
|
-
},
|
|
217
|
-
unmount() {
|
|
218
|
-
if (!mounted) return;
|
|
219
|
-
if (open) api.close("unmount");
|
|
220
|
-
mounted = false;
|
|
221
|
-
win.removeEventListener("keydown", onKeyDown, true);
|
|
222
|
-
win.removeEventListener("resize", syncModal);
|
|
223
|
-
syncShortcut();
|
|
224
|
-
surface.detach();
|
|
225
|
-
},
|
|
226
|
-
open(trigger = "api", explicitReturnFocus) {
|
|
227
|
-
if (open || !api.mount()) return false;
|
|
228
|
-
const active = doc.activeElement as HTMLElement | null;
|
|
229
|
-
returnFocus =
|
|
230
|
-
explicitReturnFocus ??
|
|
231
|
-
(active && active !== doc.body && active !== doc.documentElement && active !== surface.host ? active : null);
|
|
232
|
-
open = true;
|
|
233
|
-
element.hidden = false;
|
|
234
|
-
focusInitial();
|
|
235
|
-
options.onOpen?.(trigger);
|
|
236
|
-
return true;
|
|
237
|
-
},
|
|
238
|
-
close(reason = "api") {
|
|
239
|
-
if (!open) return;
|
|
240
|
-
open = false;
|
|
241
|
-
element.hidden = true;
|
|
242
|
-
restoreFocus();
|
|
243
|
-
options.onClose?.(reason);
|
|
244
|
-
},
|
|
245
|
-
get isOpen() {
|
|
246
|
-
return open;
|
|
247
|
-
},
|
|
248
|
-
get isMounted() {
|
|
249
|
-
return mounted;
|
|
250
|
-
},
|
|
251
|
-
body,
|
|
252
|
-
element,
|
|
253
|
-
host: surface.host,
|
|
254
|
-
setTitle(title) {
|
|
255
|
-
titleEl.textContent = title;
|
|
256
|
-
},
|
|
257
|
-
setShortcutEnabled(enabled) {
|
|
258
|
-
shortcutEnabled = enabled;
|
|
259
|
-
syncShortcut();
|
|
260
|
-
},
|
|
261
|
-
};
|
|
262
|
-
return api;
|
|
263
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The seam between the framework-agnostic primitives and whatever page embeds them.
|
|
3
|
-
*
|
|
4
|
-
* Every host concern is injected here: where the UI mounts, how it looks, which surfaces may
|
|
5
|
-
* appear, what page context to attach, and how a finished action reaches the host's intake. The
|
|
6
|
-
* primitives import nothing from a host and use pure DOM APIs only.
|
|
7
|
-
*/
|
|
8
|
-
import type { FeedbackActionV1, FeedbackImpact, FeedbackIntent, PageContext, SubmissionReceiptV1 } from "../v1/types.js";
|
|
9
|
-
|
|
10
|
-
/** The independently permissible pieces of UI. A host lists the ones it allows. */
|
|
11
|
-
export type FeedbackSurface = "launcher" | "shortcut" | "dialog" | "picker";
|
|
12
|
-
|
|
13
|
-
export const ALL_SURFACES: readonly FeedbackSurface[] = ["launcher", "shortcut", "dialog", "picker"];
|
|
14
|
-
|
|
15
|
-
/** Theme tokens, applied as CSS custom properties on each primitive's root. Values are CSS text. */
|
|
16
|
-
export interface ThemeTokens {
|
|
17
|
-
accent?: string;
|
|
18
|
-
accentInk?: string;
|
|
19
|
-
ink?: string;
|
|
20
|
-
muted?: string;
|
|
21
|
-
background?: string;
|
|
22
|
-
line?: string;
|
|
23
|
-
error?: string;
|
|
24
|
-
ok?: string;
|
|
25
|
-
fontFamily?: string;
|
|
26
|
-
/** Stacking order of the launcher; the dialog and picker chrome sit above it. */
|
|
27
|
-
zIndex?: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface HostTheme {
|
|
31
|
-
tokens?: ThemeTokens;
|
|
32
|
-
/** CSP nonce for the fallback `<style>` element when constructable stylesheets are unavailable. */
|
|
33
|
-
nonce?: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/** A report the intake rewrote (for example after its own redaction) and wants the reviewer to approve. */
|
|
37
|
-
export interface SanitizedReportV1 {
|
|
38
|
-
intent: FeedbackIntent;
|
|
39
|
-
impact: FeedbackImpact;
|
|
40
|
-
title: string;
|
|
41
|
-
description: string;
|
|
42
|
-
suggestedFix?: string;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export type TransportResult =
|
|
46
|
-
| { ok: true; receipt: SubmissionReceiptV1 }
|
|
47
|
-
| { ok: false; outcome?: undefined; code: string; retryable: boolean; retryAfterSeconds?: number }
|
|
48
|
-
/** Nothing was stored; the intake returned a version for the reviewer to approve. Sending it is a new submission. */
|
|
49
|
-
| {
|
|
50
|
-
ok: false;
|
|
51
|
-
outcome: "needs_review";
|
|
52
|
-
code: string;
|
|
53
|
-
retryable: false;
|
|
54
|
-
sanitized: SanitizedReportV1;
|
|
55
|
-
policyVersion: string;
|
|
56
|
-
redactions: Record<string, number>;
|
|
57
|
-
}
|
|
58
|
-
/** The submission id was already used for different content. It is shown and never resubmitted. */
|
|
59
|
-
| { ok: false; outcome: "conflict"; code: string; retryable: false };
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Delivers a finished action to the host's intake. The host owns same-origin routing and
|
|
63
|
-
* authorization (credentials, headers, receipts); the primitives never see a credential. The
|
|
64
|
-
* action's `submissionId` is stable across retries, so a transport may be called again with the
|
|
65
|
-
* same action after a retryable failure.
|
|
66
|
-
*/
|
|
67
|
-
export type FeedbackTransport = (
|
|
68
|
-
action: FeedbackActionV1,
|
|
69
|
-
options: { signal?: AbortSignal },
|
|
70
|
-
) => Promise<TransportResult>;
|
|
71
|
-
|
|
72
|
-
export interface HostAdapter {
|
|
73
|
-
/**
|
|
74
|
-
* Attach the primitive's root element to the page. Called with the element each time a
|
|
75
|
-
* primitive mounts; may return a cleanup, which runs on unmount before the element is removed.
|
|
76
|
-
* Default: append to `document.documentElement`.
|
|
77
|
-
*/
|
|
78
|
-
mount?(root: HTMLElement): void | (() => void);
|
|
79
|
-
theme?: HostTheme;
|
|
80
|
-
/** Surfaces the host allows. Default: all. A primitive for a refused surface does not mount. */
|
|
81
|
-
permittedSurfaces?: readonly FeedbackSurface[];
|
|
82
|
-
/** Page context attached to target evidence. Path only; the host must not include query or fragment. */
|
|
83
|
-
context?(): PageContext | undefined;
|
|
84
|
-
transport?: FeedbackTransport;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export function isSurfacePermitted(adapter: HostAdapter | undefined, surface: FeedbackSurface): boolean {
|
|
88
|
-
const list = adapter?.permittedSurfaces;
|
|
89
|
-
return list === undefined || list.includes(surface);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const TOKEN_VARS: Record<keyof ThemeTokens, string> = {
|
|
93
|
-
accent: "--fb-acc",
|
|
94
|
-
accentInk: "--fb-acc-ink",
|
|
95
|
-
ink: "--fb-ink",
|
|
96
|
-
muted: "--fb-muted",
|
|
97
|
-
background: "--fb-bg",
|
|
98
|
-
line: "--fb-line",
|
|
99
|
-
error: "--fb-err",
|
|
100
|
-
ok: "--fb-ok",
|
|
101
|
-
fontFamily: "--fb-font",
|
|
102
|
-
zIndex: "--fb-z",
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
/** Write the host's theme tokens onto an element as custom properties. */
|
|
106
|
-
export function applyTheme(el: HTMLElement, theme: HostTheme | undefined): void {
|
|
107
|
-
const tokens = theme?.tokens;
|
|
108
|
-
if (!tokens) return;
|
|
109
|
-
for (const key of Object.keys(TOKEN_VARS) as (keyof ThemeTokens)[]) {
|
|
110
|
-
const value = tokens[key];
|
|
111
|
-
// Custom property values are CSS text; refuse anything that could close the declaration.
|
|
112
|
-
if (typeof value === "string" && value.length > 0 && value.length <= 200 && !/[;{}<>]/.test(value)) {
|
|
113
|
-
el.style.setProperty(TOKEN_VARS[key], value);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from "./composer.js";
|
|
2
|
-
export * from "./dialog.js";
|
|
3
|
-
export * from "./hostAdapter.js";
|
|
4
|
-
export * from "./launcher.js";
|
|
5
|
-
export * from "./picker.js";
|
|
6
|
-
export * from "./redaction.js";
|
|
7
|
-
export * from "./selection.js";
|
|
8
|
-
export * from "./shiftAccelerator.js";
|
|
9
|
-
export * from "./surface.js";
|
|
10
|
-
export * from "./target.js";
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The preview cue. Mounts one quiet edge tab in its own isolated surface. Activating the tab expands
|
|
3
|
-
* it to a strip with "Give feedback" and "Hide"; "Hide" collapses it to a smaller nub for the browser
|
|
4
|
-
* session. `mount` and `unmount` are idempotent and never leave a stray element behind.
|
|
5
|
-
*/
|
|
6
|
-
import { isSurfacePermitted, type HostAdapter } from "./hostAdapter.js";
|
|
7
|
-
import { createSurface, h } from "./surface.js";
|
|
8
|
-
|
|
9
|
-
export const LAUNCHER_HIDDEN_KEY = "tot-preview-launcher-hidden";
|
|
10
|
-
|
|
11
|
-
export interface LauncherOptions {
|
|
12
|
-
win: Window;
|
|
13
|
-
doc: Document;
|
|
14
|
-
adapter?: HostAdapter;
|
|
15
|
-
label?: string;
|
|
16
|
-
ariaLabel?: string;
|
|
17
|
-
/** Called when "Give feedback" is activated (click, Enter or Space). */
|
|
18
|
-
onActivate(): void;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface Launcher {
|
|
22
|
-
/** Mount into the page. Returns false (and mounts nothing) when the host does not permit the launcher. */
|
|
23
|
-
mount(): boolean;
|
|
24
|
-
unmount(): void;
|
|
25
|
-
readonly isMounted: boolean;
|
|
26
|
-
/** The always-present edge tab (or nub); the focus anchor. Activating it toggles the strip. */
|
|
27
|
-
readonly button: HTMLButtonElement;
|
|
28
|
-
/** "Give feedback" inside the expanded strip. */
|
|
29
|
-
readonly actionButton: HTMLButtonElement;
|
|
30
|
-
/** "Hide" inside the expanded strip. */
|
|
31
|
-
readonly hideButton: HTMLButtonElement;
|
|
32
|
-
/** The element placed in the page. */
|
|
33
|
-
readonly host: HTMLElement;
|
|
34
|
-
setLabel(label: string): void;
|
|
35
|
-
/** Reflect whether the dialog it controls is open (`aria-expanded` on the action). */
|
|
36
|
-
setExpanded(expanded: boolean): void;
|
|
37
|
-
/** Show or hide a small attention dot. */
|
|
38
|
-
setBadge(on: boolean): void;
|
|
39
|
-
/** Hide the whole cue (while the page is being picked, say). */
|
|
40
|
-
setSuppressed(suppressed: boolean): void;
|
|
41
|
-
readonly isStripOpen: boolean;
|
|
42
|
-
readonly isNub: boolean;
|
|
43
|
-
openStrip(): void;
|
|
44
|
-
closeStrip(): void;
|
|
45
|
-
focus(): void;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function readHidden(win: Window): boolean {
|
|
49
|
-
try {
|
|
50
|
-
return win.sessionStorage.getItem(LAUNCHER_HIDDEN_KEY) === "1";
|
|
51
|
-
} catch {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function writeHidden(win: Window, hidden: boolean): boolean {
|
|
57
|
-
try {
|
|
58
|
-
if (hidden) win.sessionStorage.setItem(LAUNCHER_HIDDEN_KEY, "1");
|
|
59
|
-
else win.sessionStorage.removeItem(LAUNCHER_HIDDEN_KEY);
|
|
60
|
-
return true;
|
|
61
|
-
} catch {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export function createLauncher(options: LauncherOptions): Launcher {
|
|
67
|
-
const { win, doc, adapter } = options;
|
|
68
|
-
const surface = createSurface({ win, doc, adapter, tag: "feedback-launcher" });
|
|
69
|
-
const baseLabel = options.label ?? "ToT preview";
|
|
70
|
-
const detail = options.ariaLabel ?? "Token of Trust preview — feedback options";
|
|
71
|
-
let label = baseLabel;
|
|
72
|
-
let stripOpen = false;
|
|
73
|
-
let nub = readHidden(win);
|
|
74
|
-
let suppressed = false;
|
|
75
|
-
|
|
76
|
-
const wrap = h(doc, "div", { class: "cue" });
|
|
77
|
-
const button = h(doc, "button", {
|
|
78
|
-
class: "fab",
|
|
79
|
-
type: "button",
|
|
80
|
-
"aria-haspopup": "true",
|
|
81
|
-
"aria-expanded": "false",
|
|
82
|
-
});
|
|
83
|
-
const labelEl = h(doc, "span", { class: "tab-label", text: baseLabel });
|
|
84
|
-
const dot = h(doc, "span", { class: "dot", "aria-hidden": "true", hidden: true });
|
|
85
|
-
button.append(labelEl, dot);
|
|
86
|
-
|
|
87
|
-
const strip = h(doc, "div", { class: "strip", role: "group", "aria-label": "Token of Trust preview", hidden: true });
|
|
88
|
-
const title = h(doc, "span", { class: "strip-title", text: "Token of Trust preview" });
|
|
89
|
-
const actionButton = h(doc, "button", { class: "strip-act", type: "button", "aria-haspopup": "dialog", "aria-expanded": "false", text: "Give feedback" });
|
|
90
|
-
const hideButton = h(doc, "button", { class: "strip-hide", type: "button", text: "Hide" });
|
|
91
|
-
strip.append(title, actionButton, hideButton);
|
|
92
|
-
wrap.append(button, strip);
|
|
93
|
-
surface.root.append(wrap);
|
|
94
|
-
|
|
95
|
-
function render() {
|
|
96
|
-
wrap.hidden = suppressed;
|
|
97
|
-
wrap.dataset.nub = String(nub && !stripOpen);
|
|
98
|
-
strip.hidden = !stripOpen;
|
|
99
|
-
button.hidden = stripOpen;
|
|
100
|
-
button.setAttribute("aria-expanded", String(stripOpen));
|
|
101
|
-
const name = nub && !stripOpen ? `Show ${detail}` : `${label} — ${detail}`;
|
|
102
|
-
button.setAttribute("aria-label", name);
|
|
103
|
-
labelEl.hidden = nub && !stripOpen;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function openStrip() {
|
|
107
|
-
stripOpen = true;
|
|
108
|
-
render();
|
|
109
|
-
actionButton.focus();
|
|
110
|
-
}
|
|
111
|
-
function closeStrip(restoreFocus = true) {
|
|
112
|
-
if (!stripOpen) return;
|
|
113
|
-
stripOpen = false;
|
|
114
|
-
render();
|
|
115
|
-
if (restoreFocus) button.focus();
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
button.addEventListener("click", (e) => {
|
|
119
|
-
e.preventDefault();
|
|
120
|
-
if (stripOpen) closeStrip();
|
|
121
|
-
else openStrip();
|
|
122
|
-
});
|
|
123
|
-
actionButton.addEventListener("click", (e) => {
|
|
124
|
-
e.preventDefault();
|
|
125
|
-
closeStrip(false);
|
|
126
|
-
options.onActivate();
|
|
127
|
-
});
|
|
128
|
-
hideButton.addEventListener("click", (e) => {
|
|
129
|
-
e.preventDefault();
|
|
130
|
-
nub = writeHidden(win, true);
|
|
131
|
-
closeStrip();
|
|
132
|
-
});
|
|
133
|
-
// A nub restores to the full tab when tapped; the tap on a nub also opens the strip.
|
|
134
|
-
button.addEventListener("click", () => {
|
|
135
|
-
if (nub && stripOpen) {
|
|
136
|
-
nub = false;
|
|
137
|
-
writeHidden(win, false);
|
|
138
|
-
render();
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
const onKey = (e: Event) => {
|
|
142
|
-
if ((e as KeyboardEvent).key === "Escape" && stripOpen) {
|
|
143
|
-
e.stopPropagation();
|
|
144
|
-
closeStrip();
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
surface.root.addEventListener("keydown", onKey);
|
|
148
|
-
const onOutside = (e: Event) => {
|
|
149
|
-
if (stripOpen && !e.composedPath().includes(surface.host)) closeStrip(false);
|
|
150
|
-
};
|
|
151
|
-
render();
|
|
152
|
-
|
|
153
|
-
return {
|
|
154
|
-
mount() {
|
|
155
|
-
if (!isSurfacePermitted(adapter, "launcher")) return false;
|
|
156
|
-
surface.attach();
|
|
157
|
-
doc.addEventListener("pointerdown", onOutside, true);
|
|
158
|
-
return true;
|
|
159
|
-
},
|
|
160
|
-
unmount() {
|
|
161
|
-
doc.removeEventListener("pointerdown", onOutside, true);
|
|
162
|
-
surface.detach();
|
|
163
|
-
},
|
|
164
|
-
get isMounted() {
|
|
165
|
-
return surface.isAttached;
|
|
166
|
-
},
|
|
167
|
-
button,
|
|
168
|
-
actionButton,
|
|
169
|
-
hideButton,
|
|
170
|
-
host: surface.host,
|
|
171
|
-
setLabel(next) {
|
|
172
|
-
label = next;
|
|
173
|
-
labelEl.textContent = next;
|
|
174
|
-
render();
|
|
175
|
-
},
|
|
176
|
-
setExpanded(expanded) {
|
|
177
|
-
actionButton.setAttribute("aria-expanded", String(expanded));
|
|
178
|
-
},
|
|
179
|
-
setBadge(on) {
|
|
180
|
-
dot.hidden = !on;
|
|
181
|
-
},
|
|
182
|
-
setSuppressed(next) {
|
|
183
|
-
suppressed = next;
|
|
184
|
-
if (next) stripOpen = false;
|
|
185
|
-
render();
|
|
186
|
-
},
|
|
187
|
-
get isStripOpen() {
|
|
188
|
-
return stripOpen;
|
|
189
|
-
},
|
|
190
|
-
get isNub() {
|
|
191
|
-
return nub && !stripOpen;
|
|
192
|
-
},
|
|
193
|
-
openStrip,
|
|
194
|
-
closeStrip: () => closeStrip(),
|
|
195
|
-
focus() {
|
|
196
|
-
if (stripOpen) actionButton.focus();
|
|
197
|
-
else button.focus();
|
|
198
|
-
},
|
|
199
|
-
};
|
|
200
|
-
}
|