@mohasinac/appkit 4.52.5 → 4.53.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/.build-stamp.json +4 -4
- package/dist/_internal/client/features/sticker-trace/canvas-codec.d.ts +2 -0
- package/dist/_internal/client/features/sticker-trace/canvas-codec.js +148 -0
- package/dist/_internal/server/features/auctions/actions.js +1 -1
- package/dist/_internal/server/features/categories/data.js +23 -7
- package/dist/_internal/server/features/checkout/actions.js +10 -3
- package/dist/_internal/server/features/checkout/data.d.ts +15 -0
- package/dist/_internal/server/features/checkout/data.js +20 -3
- package/dist/_internal/server/features/lottery/actions.js +9 -1
- package/dist/_internal/server/features/lottery/og.d.ts +40 -0
- package/dist/_internal/server/features/lottery/og.js +79 -0
- package/dist/_internal/server/features/messages/actions.js +4 -0
- package/dist/_internal/server/features/offers/adapters.js +17 -3
- package/dist/_internal/server/features/orders/actions.js +7 -2
- package/dist/_internal/server/features/raffle/actions.d.ts +19 -0
- package/dist/_internal/server/features/raffle/actions.js +25 -0
- package/dist/_internal/server/features/reviews/actions.js +1 -1
- package/dist/_internal/server/features/reviews/data.d.ts +1 -1
- package/dist/_internal/server/features/search/index-build/artifact-store.d.ts +89 -0
- package/dist/_internal/server/features/search/index-build/artifact-store.js +208 -0
- package/dist/_internal/server/features/search/index-build/build.d.ts +57 -0
- package/dist/_internal/server/features/search/index-build/build.js +285 -0
- package/dist/_internal/server/features/search/index-build/sources.d.ts +53 -0
- package/dist/_internal/server/features/search/index-build/sources.js +385 -0
- package/dist/_internal/server/features/search/search-sources.d.ts +0 -15
- package/dist/_internal/server/features/search/search-sources.js +142 -7
- package/dist/_internal/server/features/seo/robots.js +21 -1
- package/dist/_internal/server/features/seo/sitemap.js +1 -1
- package/dist/_internal/server/features/shared/listing-data-factory.js +16 -4
- package/dist/_internal/server/features/site-settings/adapters.d.ts +1 -1
- package/dist/_internal/server/features/site-settings/adapters.js +26 -0
- package/dist/_internal/server/features/sticker-trace/actions.d.ts +109 -0
- package/dist/_internal/server/features/sticker-trace/actions.js +172 -0
- package/dist/_internal/server/features/sticker-trace/adapters.d.ts +80 -0
- package/dist/_internal/server/features/sticker-trace/adapters.js +174 -0
- package/dist/_internal/server/features/sticker-trace/build-cut-file.d.ts +26 -0
- package/dist/_internal/server/features/sticker-trace/build-cut-file.js +127 -0
- package/dist/_internal/server/features/sticker-trace/coordinator.d.ts +27 -0
- package/dist/_internal/server/features/sticker-trace/coordinator.js +169 -0
- package/dist/_internal/server/features/sticker-trace/fanout.d.ts +43 -0
- package/dist/_internal/server/features/sticker-trace/fanout.js +180 -0
- package/dist/_internal/server/features/sticker-trace/finalizer.d.ts +25 -0
- package/dist/_internal/server/features/sticker-trace/finalizer.js +123 -0
- package/dist/_internal/server/features/sticker-trace/mosaic-inputs.d.ts +30 -0
- package/dist/_internal/server/features/sticker-trace/mosaic-inputs.js +112 -0
- package/dist/_internal/server/features/sticker-trace/progress.d.ts +81 -0
- package/dist/_internal/server/features/sticker-trace/progress.js +198 -0
- package/dist/_internal/server/features/sticker-trace/promote.d.ts +23 -0
- package/dist/_internal/server/features/sticker-trace/promote.js +193 -0
- package/dist/_internal/server/features/sticker-trace/shard.d.ts +50 -0
- package/dist/_internal/server/features/sticker-trace/shard.js +174 -0
- package/dist/_internal/server/features/sticker-trace/sheet-actions.d.ts +141 -0
- package/dist/_internal/server/features/sticker-trace/sheet-actions.js +279 -0
- package/dist/_internal/server/features/sticker-trace/storage.d.ts +135 -0
- package/dist/_internal/server/features/sticker-trace/storage.js +282 -0
- package/dist/_internal/server/functions/scheduled.d.ts +2 -1
- package/dist/_internal/server/functions/scheduled.js +25 -1
- package/dist/_internal/server/jobs/core/_event-ref.d.ts +51 -0
- package/dist/_internal/server/jobs/core/_event-ref.js +63 -0
- package/dist/_internal/server/jobs/core/assignSpinPrize.d.ts +18 -0
- package/dist/_internal/server/jobs/core/assignSpinPrize.js +77 -16
- package/dist/_internal/server/jobs/core/auctionSettlement.js +13 -4
- package/dist/_internal/server/jobs/core/autoPayoutEligibility.js +44 -15
- package/dist/_internal/server/jobs/core/bundleStockSync.js +3 -4
- package/dist/_internal/server/jobs/core/cleanupRtdbEvents.js +44 -0
- package/dist/_internal/server/jobs/core/event-draw-reasons.d.ts +78 -0
- package/dist/_internal/server/jobs/core/event-draw-reasons.js +133 -0
- package/dist/_internal/server/jobs/core/listingProcessor.js +28 -8
- package/dist/_internal/server/jobs/core/onOrderCreate.js +12 -1
- package/dist/_internal/server/jobs/core/onScamReportCreate.js +13 -2
- package/dist/_internal/server/jobs/core/onScamReportRejected.js +8 -2
- package/dist/_internal/server/jobs/core/onScamReportVerified.js +8 -2
- package/dist/_internal/server/jobs/core/onStoreWrite.js +11 -4
- package/dist/_internal/server/jobs/core/prizeDrawAssignWinner.js +5 -4
- package/dist/_internal/server/jobs/core/prizeDrawExpiryReveal.js +1 -4
- package/dist/_internal/server/jobs/core/prizeDrawSoldOutReveal.js +1 -2
- package/dist/_internal/server/jobs/core/promotions.js +7 -4
- package/dist/_internal/server/jobs/core/searchIndexBuild.d.ts +7 -0
- package/dist/_internal/server/jobs/core/searchIndexBuild.js +211 -0
- package/dist/_internal/server/jobs/core/triggerEventRaffle.d.ts +35 -0
- package/dist/_internal/server/jobs/core/triggerEventRaffle.js +213 -31
- package/dist/_internal/server/jobs/core/weeklyPayoutEligibility.js +20 -14
- package/dist/_internal/server/jobs/handlers/assignSpinPrize.d.ts +8 -0
- package/dist/_internal/server/jobs/handlers/assignSpinPrize.js +15 -15
- package/dist/_internal/server/jobs/handlers/index.d.ts +1 -0
- package/dist/_internal/server/jobs/handlers/index.js +1 -0
- package/dist/_internal/server/jobs/handlers/onCategoryWrite.js +18 -0
- package/dist/_internal/server/jobs/handlers/onProductWrite.js +18 -0
- package/dist/_internal/server/jobs/handlers/onReviewWrite.js +18 -0
- package/dist/_internal/server/jobs/handlers/onScamReportUpdate.js +18 -0
- package/dist/_internal/server/jobs/handlers/onStoreWrite.js +18 -0
- package/dist/_internal/server/jobs/handlers/searchIndexBuild.d.ts +2 -0
- package/dist/_internal/server/jobs/handlers/searchIndexBuild.js +2 -0
- package/dist/_internal/server/jobs/handlers/triggerEventRaffle.d.ts +8 -0
- package/dist/_internal/server/jobs/handlers/triggerEventRaffle.js +15 -6
- package/dist/_internal/shared/actions/action-registry.js +29 -0
- package/dist/_internal/shared/cache/revalidate-targets.d.ts +0 -1
- package/dist/_internal/shared/cache/revalidate-targets.js +10 -8
- package/dist/_internal/shared/features/events/config.d.ts +14 -0
- package/dist/_internal/shared/features/events/config.js +14 -0
- package/dist/_internal/shared/features/notifications/action-url.js +8 -0
- package/dist/_internal/shared/features/site-settings/types.d.ts +11 -0
- package/dist/_internal/shared/features/sticker-trace/codec.d.ts +81 -0
- package/dist/_internal/shared/features/sticker-trace/codec.js +30 -0
- package/dist/_internal/shared/features/sticker-trace/config.d.ts +81 -0
- package/dist/_internal/shared/features/sticker-trace/config.js +177 -0
- package/dist/_internal/shared/features/sticker-trace/cut-contour.d.ts +20 -0
- package/dist/_internal/shared/features/sticker-trace/cut-contour.js +60 -0
- package/dist/_internal/shared/features/sticker-trace/export/build-export-set.d.ts +65 -0
- package/dist/_internal/shared/features/sticker-trace/export/build-export-set.js +176 -0
- package/dist/_internal/shared/features/sticker-trace/export/cut-svg.d.ts +56 -0
- package/dist/_internal/shared/features/sticker-trace/export/cut-svg.js +120 -0
- package/dist/_internal/shared/features/sticker-trace/export/machine-profiles.d.ts +92 -0
- package/dist/_internal/shared/features/sticker-trace/export/machine-profiles.js +153 -0
- package/dist/_internal/shared/features/sticker-trace/export/nesting.d.ts +51 -0
- package/dist/_internal/shared/features/sticker-trace/export/nesting.js +110 -0
- package/dist/_internal/shared/features/sticker-trace/export/page-sizes.d.ts +68 -0
- package/dist/_internal/shared/features/sticker-trace/export/page-sizes.js +223 -0
- package/dist/_internal/shared/features/sticker-trace/export/part-tiling.d.ts +51 -0
- package/dist/_internal/shared/features/sticker-trace/export/part-tiling.js +178 -0
- package/dist/_internal/shared/features/sticker-trace/export/simplify-budget.d.ts +26 -0
- package/dist/_internal/shared/features/sticker-trace/export/simplify-budget.js +134 -0
- package/dist/_internal/shared/features/sticker-trace/export/vectorise-art.d.ts +40 -0
- package/dist/_internal/shared/features/sticker-trace/export/vectorise-art.js +195 -0
- package/dist/_internal/shared/features/sticker-trace/index.d.ts +2 -0
- package/dist/_internal/shared/features/sticker-trace/index.js +59 -0
- package/dist/_internal/shared/features/sticker-trace/math/catmull-rom.d.ts +11 -0
- package/dist/_internal/shared/features/sticker-trace/math/catmull-rom.js +66 -0
- package/dist/_internal/shared/features/sticker-trace/math/edt.d.ts +27 -0
- package/dist/_internal/shared/features/sticker-trace/math/edt.js +165 -0
- package/dist/_internal/shared/features/sticker-trace/math/label.d.ts +15 -0
- package/dist/_internal/shared/features/sticker-trace/math/label.js +156 -0
- package/dist/_internal/shared/features/sticker-trace/math/marching-squares.d.ts +16 -0
- package/dist/_internal/shared/features/sticker-trace/math/marching-squares.js +242 -0
- package/dist/_internal/shared/features/sticker-trace/math/morphology.d.ts +46 -0
- package/dist/_internal/shared/features/sticker-trace/math/morphology.js +168 -0
- package/dist/_internal/shared/features/sticker-trace/math/rasterize-path.d.ts +88 -0
- package/dist/_internal/shared/features/sticker-trace/math/rasterize-path.js +286 -0
- package/dist/_internal/shared/features/sticker-trace/math/rdp.d.ts +10 -0
- package/dist/_internal/shared/features/sticker-trace/math/rdp.js +74 -0
- package/dist/_internal/shared/features/sticker-trace/resume.d.ts +50 -0
- package/dist/_internal/shared/features/sticker-trace/resume.js +160 -0
- package/dist/_internal/shared/features/sticker-trace/trace/cluster.d.ts +20 -0
- package/dist/_internal/shared/features/sticker-trace/trace/cluster.js +132 -0
- package/dist/_internal/shared/features/sticker-trace/trace/cross-profile.d.ts +28 -0
- package/dist/_internal/shared/features/sticker-trace/trace/cross-profile.js +120 -0
- package/dist/_internal/shared/features/sticker-trace/trace/flood.d.ts +21 -0
- package/dist/_internal/shared/features/sticker-trace/trace/flood.js +104 -0
- package/dist/_internal/shared/features/sticker-trace/trace/geometry.d.ts +3 -0
- package/dist/_internal/shared/features/sticker-trace/trace/geometry.js +140 -0
- package/dist/_internal/shared/features/sticker-trace/trace/line-filter.d.ts +15 -0
- package/dist/_internal/shared/features/sticker-trace/trace/line-filter.js +138 -0
- package/dist/_internal/shared/features/sticker-trace/trace/merge.d.ts +27 -0
- package/dist/_internal/shared/features/sticker-trace/trace/merge.js +187 -0
- package/dist/_internal/shared/features/sticker-trace/trace/paper.d.ts +32 -0
- package/dist/_internal/shared/features/sticker-trace/trace/paper.js +147 -0
- package/dist/_internal/shared/features/sticker-trace/trace/prefilter.d.ts +30 -0
- package/dist/_internal/shared/features/sticker-trace/trace/prefilter.js +125 -0
- package/dist/_internal/shared/features/sticker-trace/trace/quantise.d.ts +10 -0
- package/dist/_internal/shared/features/sticker-trace/trace/quantise.js +153 -0
- package/dist/_internal/shared/features/sticker-trace/trace/ridge.d.ts +88 -0
- package/dist/_internal/shared/features/sticker-trace/trace/ridge.js +344 -0
- package/dist/_internal/shared/features/sticker-trace/trace/segment.d.ts +10 -0
- package/dist/_internal/shared/features/sticker-trace/trace/segment.js +251 -0
- package/dist/_internal/shared/features/sticker-trace/types.d.ts +197 -0
- package/dist/_internal/shared/features/sticker-trace/types.js +49 -0
- package/dist/_internal/shared/listing-types/_registry.d.ts +11 -0
- package/dist/_internal/shared/listing-types/art/config.d.ts +1 -0
- package/dist/_internal/shared/listing-types/art/config.js +1 -0
- package/dist/_internal/shared/listing-types/auction/config.d.ts +1 -0
- package/dist/_internal/shared/listing-types/auction/config.js +1 -0
- package/dist/_internal/shared/listing-types/classified/config.d.ts +1 -0
- package/dist/_internal/shared/listing-types/classified/config.js +1 -0
- package/dist/_internal/shared/listing-types/digital-code/config.d.ts +1 -0
- package/dist/_internal/shared/listing-types/digital-code/config.js +1 -0
- package/dist/_internal/shared/listing-types/feature-flags.d.ts +7 -0
- package/dist/_internal/shared/listing-types/feature-flags.js +9 -0
- package/dist/_internal/shared/listing-types/live/config.d.ts +1 -0
- package/dist/_internal/shared/listing-types/live/config.js +1 -0
- package/dist/_internal/shared/listing-types/pre-order/config.d.ts +1 -0
- package/dist/_internal/shared/listing-types/pre-order/config.js +1 -0
- package/dist/_internal/shared/listing-types/prize-draw/config.d.ts +1 -0
- package/dist/_internal/shared/listing-types/prize-draw/config.js +1 -0
- package/dist/_internal/shared/listing-types/standard/config.d.ts +1 -0
- package/dist/_internal/shared/listing-types/standard/config.js +1 -0
- package/dist/_internal/shared/listing-types/stickers/config.d.ts +1 -0
- package/dist/_internal/shared/listing-types/stickers/config.js +1 -0
- package/dist/_internal/shared/media/limits.d.ts +12 -2
- package/dist/_internal/shared/media/limits.js +12 -2
- package/dist/_internal/shared/search/artifact-url.d.ts +35 -0
- package/dist/_internal/shared/search/artifact-url.js +119 -0
- package/dist/_internal/shared/search/index-record.d.ts +68 -0
- package/dist/_internal/shared/search/index-record.js +96 -0
- package/dist/_internal/shared/search/match.d.ts +65 -0
- package/dist/_internal/shared/search/match.js +263 -0
- package/dist/client.d.ts +8 -7
- package/dist/client.js +12 -5
- package/dist/configs/eslint.js +22 -2
- package/dist/constants/api-endpoints.d.ts +68 -0
- package/dist/constants/api-endpoints.js +32 -0
- package/dist/constants/field-names.d.ts +7 -1
- package/dist/constants/field-names.js +36 -1
- package/dist/contracts/repository.d.ts +8 -7
- package/dist/contracts/search.d.ts +2 -2
- package/dist/contracts/table.d.ts +3 -3
- package/dist/contracts/table.js +3 -3
- package/dist/core/contact-submissions.repository.js +2 -2
- package/dist/core/integration-keys.js +7 -1
- package/dist/core/newsletter.repository.js +2 -2
- package/dist/core/site-config.js +1 -1
- package/dist/errors/error-codes.d.ts +30 -0
- package/dist/errors/error-codes.js +30 -0
- package/dist/errors/error-display-map.js +40 -1
- package/dist/features/account/api/[userId]/addresses/route.js +1 -1
- package/dist/features/account/components/UserBidsView.js +1 -1
- package/dist/features/account/components/index.d.ts +0 -8
- package/dist/features/account/components/index.js +0 -4
- package/dist/features/addresses/repository/addresses.repository.d.ts +17 -6
- package/dist/features/addresses/repository/addresses.repository.js +65 -9
- package/dist/features/addresses/schemas/firestore.d.ts +17 -6
- package/dist/features/admin/actions/notification-actions.js +15 -6
- package/dist/features/admin/api/bids/route.js +1 -1
- package/dist/features/admin/api/coupons/route.js +1 -1
- package/dist/features/admin/api/products/route.js +1 -1
- package/dist/features/admin/api/reviews/route.js +1 -1
- package/dist/features/admin/components/AdminAdEditorView.js +19 -5
- package/dist/features/admin/components/AdminAuditLogView.js +1 -1
- package/dist/features/admin/components/AdminBlogEditorView.js +0 -1
- package/dist/features/admin/components/AdminBlogView.js +1 -1
- package/dist/features/admin/components/AdminBrandsView.js +17 -1
- package/dist/features/admin/components/AdminCategoryEditorView.js +0 -1
- package/dist/features/admin/components/AdminContactView.js +1 -1
- package/dist/features/admin/components/AdminEmployeeEditorView.js +1 -3
- package/dist/features/admin/components/AdminNewsletterView.js +1 -1
- package/dist/features/admin/components/AdminOrdersView.js +9 -2
- package/dist/features/admin/components/AdminPayoutsView.js +1 -1
- package/dist/features/admin/components/AdminPrizeDrawsView.js +11 -0
- package/dist/features/admin/components/AdminProductEditorView.d.ts +10 -1
- package/dist/features/admin/components/AdminProductEditorView.js +24 -37
- package/dist/features/admin/components/AdminProductsView.js +10 -3
- package/dist/features/admin/components/AdminScammersView.js +1 -1
- package/dist/features/admin/components/AdminSectionsView.js +21 -5
- package/dist/features/admin/components/AdminSessionsView.js +1 -1
- package/dist/features/admin/components/AdminSublistingCategoriesView.js +22 -1
- package/dist/features/admin/components/AdminTeamView.js +1 -1
- package/dist/features/admin/components/AdminTesterChecklistItemEditorView.js +0 -1
- package/dist/features/admin/components/AdminUsersView.js +1 -1
- package/dist/features/admin/components/DataListingView.d.ts +2 -1
- package/dist/features/admin/components/DataListingView.js +9 -4
- package/dist/features/admin/components/analytics/AdminPageViewsReportView.js +0 -2
- package/dist/features/admin/hooks/useAdminListing.d.ts +1 -1
- package/dist/features/admin/repository/site-settings.repository.js +8 -3
- package/dist/features/admin/schemas/firestore.d.ts +62 -1
- package/dist/features/admin/schemas/firestore.js +32 -0
- package/dist/features/admin/types/index.d.ts +1 -1
- package/dist/features/auctions/actions/bid-actions.d.ts +2 -2
- package/dist/features/auctions/actions/bid-actions.js +16 -4
- package/dist/features/auctions/api/route.js +1 -1
- package/dist/features/auctions/components/AuctionBottomActions.js +4 -0
- package/dist/features/auctions/repository/bid.repository.d.ts +46 -4
- package/dist/features/auctions/repository/bid.repository.js +114 -13
- package/dist/features/auctions/schemas/firestore.d.ts +24 -4
- package/dist/features/auctions/schemas/firestore.js +1 -0
- package/dist/features/auth/actions/profile-actions.js +30 -4
- package/dist/features/auth/components/index.d.ts +0 -1
- package/dist/features/auth/components/index.js +0 -1
- package/dist/features/auth/repository/session.repository.d.ts +17 -3
- package/dist/features/auth/repository/session.repository.js +46 -5
- package/dist/features/auth/repository/token.repository.d.ts +27 -4
- package/dist/features/auth/repository/token.repository.js +65 -11
- package/dist/features/auth/repository/user.repository.d.ts +33 -7
- package/dist/features/auth/repository/user.repository.js +100 -15
- package/dist/features/auth/schemas/firestore.d.ts +63 -12
- package/dist/features/auth/schemas/firestore.js +11 -0
- package/dist/features/before-after/api/route.js +1 -1
- package/dist/features/blog/components/BlogListView.js +16 -3
- package/dist/features/blog/components/BlogPostView.js +1 -1
- package/dist/features/blog/schemas/index.d.ts +2 -2
- package/dist/features/cart/api/route.js +1 -1
- package/dist/features/catalogue/repository/catalogue.repository.d.ts +7 -7
- package/dist/features/catalogue/repository/catalogue.repository.js +28 -10
- package/dist/features/catalogue/schemas/firestore.d.ts +11 -0
- package/dist/features/categories/api/route.js +10 -10
- package/dist/features/categories/components/CategoryDetailPageView.js +35 -5
- package/dist/features/categories/components/CategorySelectorCreate.js +0 -1
- package/dist/features/categories/components/index.d.ts +0 -2
- package/dist/features/categories/components/index.js +0 -1
- package/dist/features/categories/repository/categories.repository.d.ts +1 -0
- package/dist/features/categories/repository/categories.repository.js +31 -1
- package/dist/features/categories/schemas/index.d.ts +2 -2
- package/dist/features/categories/utils/taxonomy-visual.d.ts +21 -0
- package/dist/features/categories/utils/taxonomy-visual.js +58 -0
- package/dist/features/checkout/actions/checkout-value-otp-actions.js +8 -1
- package/dist/features/collections/api/[slug]/route.js +3 -3
- package/dist/features/collections/api/route.js +1 -1
- package/dist/features/consultation/api/route.js +1 -1
- package/dist/features/consultation/repository/consultations.repository.js +1 -1
- package/dist/features/consultation/types/index.d.ts +1 -1
- package/dist/features/contact/components/ContactForm.js +1 -3
- package/dist/features/corporate/api/route.js +1 -1
- package/dist/features/corporate/repository/corporate.repository.js +1 -1
- package/dist/features/corporate/types/index.d.ts +1 -1
- package/dist/features/cron/jobs/auction-expiry.job.js +1 -1
- package/dist/features/cron/jobs/preorder-reminder.job.js +1 -1
- package/dist/features/events/actions/event-actions.d.ts +14 -0
- package/dist/features/events/actions/event-actions.js +82 -3
- package/dist/features/events/api/[id]/route.js +2 -2
- package/dist/features/events/components/AdminEventEditorView.js +22 -3
- package/dist/features/events/components/AdminEventsView.js +32 -8
- package/dist/features/events/components/EventRafflesSection.d.ts +34 -1
- package/dist/features/events/components/EventRafflesSection.js +52 -3
- package/dist/features/events/components/SpinWheelView.d.ts +2 -2
- package/dist/features/events/components/SpinWheelView.js +41 -4
- package/dist/features/events/repository/event-entry.repository.d.ts +14 -2
- package/dist/features/events/repository/event-entry.repository.js +41 -7
- package/dist/features/events/schemas/firestore.d.ts +17 -4
- package/dist/features/events/types/index.d.ts +37 -0
- package/dist/features/faq/repository/faqs.repository.js +1 -1
- package/dist/features/faq/schemas/index.d.ts +5 -2
- package/dist/features/faq/schemas/index.js +6 -0
- package/dist/features/faq/types/index.d.ts +0 -1
- package/dist/features/grouped/components/GroupedListingEditorView.js +17 -2
- package/dist/features/homepage/api/carousel/[id]/route.js +1 -1
- package/dist/features/homepage/api/carousel/route.js +4 -4
- package/dist/features/homepage/api/route.js +2 -2
- package/dist/features/homepage/api/sections/route.js +1 -1
- package/dist/features/homepage/components/AnnouncementBar.d.ts +1 -9
- package/dist/features/homepage/components/AnnouncementBar.js +13 -19
- package/dist/features/homepage/components/MarketplaceHomepageView.js +6 -1
- package/dist/features/homepage/components/index.d.ts +0 -2
- package/dist/features/homepage/components/index.js +0 -1
- package/dist/features/homepage/repository/homepage.repository.js +1 -1
- package/dist/features/homepage/schemas/firestore.d.ts +6 -0
- package/dist/features/homepage/schemas/index.d.ts +10 -10
- package/dist/features/layout/AppLayoutShell.d.ts +11 -0
- package/dist/features/layout/AppLayoutShell.js +64 -12
- package/dist/features/layout/BottomActionsContext.d.ts +16 -0
- package/dist/features/layout/BottomActionsContext.js +5 -0
- package/dist/features/layout/BottomChrome.js +48 -9
- package/dist/features/layout/BottomNavbar.d.ts +14 -0
- package/dist/features/layout/BottomNavbar.js +43 -3
- package/dist/features/layout/MainNavbar.d.ts +11 -0
- package/dist/features/layout/NavbarLayout.d.ts +3 -0
- package/dist/features/layout/NavbarLayout.js +88 -11
- package/dist/features/layout/SideActionDock.d.ts +1 -0
- package/dist/features/layout/SideActionDock.js +219 -0
- package/dist/features/layout/TitleBarLayout.js +1 -1
- package/dist/features/layout/cta-anchor.d.ts +31 -0
- package/dist/features/layout/cta-anchor.js +31 -0
- package/dist/features/layout/hooks/useBottomActions.d.ts +7 -0
- package/dist/features/layout/hooks/useBottomActions.js +6 -1
- package/dist/features/layout/index.d.ts +9 -1
- package/dist/features/layout/index.js +9 -1
- package/dist/features/layout/useCtaReveal.d.ts +24 -0
- package/dist/features/layout/useCtaReveal.js +82 -0
- package/dist/features/layout/useHoldToOpen.d.ts +41 -0
- package/dist/features/layout/useHoldToOpen.js +84 -0
- package/dist/features/lottery/repository/lottery-entry.repository.d.ts +18 -3
- package/dist/features/lottery/repository/lottery-entry.repository.js +48 -6
- package/dist/features/lottery/schemas/firestore.d.ts +33 -5
- package/dist/features/loyalty/api/balance/route.js +1 -1
- package/dist/features/loyalty/api/history/route.js +1 -1
- package/dist/features/media/MediaImage.js +0 -1
- package/dist/features/media/MediaPickerModal.js +7 -1
- package/dist/features/media/modals/ImageEditor.js +5 -1
- package/dist/features/media/modals/VideoThumbnailSelector.js +17 -1
- package/dist/features/media/repository/media-assets.repository.d.ts +19 -0
- package/dist/features/media/upload/CameraCapture.js +16 -1
- package/dist/features/media/upload/ImageUpload.js +42 -4
- package/dist/features/media/upload/MediaUploadField.js +69 -13
- package/dist/features/media/upload/downscale-image.d.ts +56 -0
- package/dist/features/media/upload/downscale-image.js +150 -0
- package/dist/features/messages/components/ConversationThreadView.js +45 -2
- package/dist/features/messages/components/MessageSellerButton.d.ts +15 -1
- package/dist/features/messages/components/MessageSellerButton.js +10 -2
- package/dist/features/messages/schemas/firestore.d.ts +15 -0
- package/dist/features/orders/hooks/useOrders.js +4 -2
- package/dist/features/orders/repository/orders.repository.d.ts +15 -4
- package/dist/features/orders/repository/orders.repository.js +52 -20
- package/dist/features/orders/schemas/firestore.d.ts +15 -4
- package/dist/features/orders/schemas/index.d.ts +8 -8
- package/dist/features/orders/types/index.d.ts +2 -2
- package/dist/features/payments/repository/payments.repository.js +2 -2
- package/dist/features/payments/repository/payout.repository.d.ts +23 -6
- package/dist/features/payments/repository/payout.repository.js +63 -23
- package/dist/features/payments/repository/saved-payment-methods.repository.d.ts +17 -6
- package/dist/features/payments/repository/saved-payment-methods.repository.js +59 -11
- package/dist/features/payments/schemas/firestore.d.ts +14 -3
- package/dist/features/payments/schemas/saved-methods-firestore.d.ts +12 -1
- package/dist/features/pre-orders/api/[slug]/route.js +1 -1
- package/dist/features/pre-orders/api/admin/route.js +1 -1
- package/dist/features/pre-orders/api/route.js +1 -1
- package/dist/features/pre-orders/repository/pre-orders.repository.d.ts +3 -3
- package/dist/features/pre-orders/repository/pre-orders.repository.js +6 -6
- package/dist/features/products/api/[id]/route.js +1 -1
- package/dist/features/products/components/ListingBottomActions.js +4 -0
- package/dist/features/products/components/ProductDetailPageView.js +2 -1
- package/dist/features/products/components/ProductGalleryClient.js +2 -2
- package/dist/features/products/components/ProductGrid.js +12 -1
- package/dist/features/products/components/index.d.ts +0 -2
- package/dist/features/products/components/index.js +0 -1
- package/dist/features/products/config/listing-type-listing-config.d.ts +0 -3
- package/dist/features/products/config/listing-type-listing-config.js +27 -2
- package/dist/features/products/constants/listing-tabs.d.ts +9 -0
- package/dist/features/products/constants/listing-tabs.js +3 -2
- package/dist/features/products/hooks/useProducts.js +2 -2
- package/dist/features/products/repository/products.repository.js +13 -1
- package/dist/features/products/schemas/index.d.ts +2 -2
- package/dist/features/products/types/index.d.ts +1 -1
- package/dist/features/promotions/api/route.js +1 -1
- package/dist/features/reviews/actions/review-actions.d.ts +6 -6
- package/dist/features/reviews/actions/review-actions.js +22 -8
- package/dist/features/reviews/components/ReviewDetailPageView.js +13 -1
- package/dist/features/reviews/components/ReviewsIndexPageView.js +21 -4
- package/dist/features/reviews/repository/reviews.repository.d.ts +19 -7
- package/dist/features/reviews/repository/reviews.repository.js +63 -12
- package/dist/features/reviews/schemas/firestore.d.ts +13 -2
- package/dist/features/reviews/schemas/index.d.ts +2 -2
- package/dist/features/scams/actions/scam-actions.js +16 -4
- package/dist/features/search/components/SearchResultsPageView.js +2 -1
- package/dist/features/search/hooks/useSearchIndex.d.ts +34 -0
- package/dist/features/search/hooks/useSearchIndex.js +172 -0
- package/dist/features/search/repository/search.repository.js +2 -2
- package/dist/features/seller/actions/offer-actions.d.ts +5 -5
- package/dist/features/seller/actions/offer-actions.js +38 -8
- package/dist/features/seller/actions/seller-actions.js +34 -7
- package/dist/features/seller/api/coupons/route.js +1 -1
- package/dist/features/seller/api/products/route.js +1 -1
- package/dist/features/seller/api/store/route.js +1 -1
- package/dist/features/seller/components/SellerBidsView.js +1 -1
- package/dist/features/seller/components/SellerCouponsView.js +1 -1
- package/dist/features/seller/components/SellerListingTypeView.js +9 -1
- package/dist/features/seller/components/SellerOrdersView.js +1 -1
- package/dist/features/seller/components/SellerPayoutSettingsView.js +0 -1
- package/dist/features/seller/components/SellerPayoutsView.js +1 -1
- package/dist/features/seller/components/SellerProductShell.js +0 -1
- package/dist/features/seller/components/SellerProductsView.js +1 -1
- package/dist/features/seller/components/SellerShippingView.js +0 -1
- package/dist/features/seller/components/SellerStorefrontView.js +0 -1
- package/dist/features/seller/components/index.d.ts +0 -4
- package/dist/features/seller/components/index.js +0 -2
- package/dist/features/seller/repository/offer.repository.d.ts +15 -3
- package/dist/features/seller/repository/offer.repository.js +43 -7
- package/dist/features/seller/schemas/firestore.d.ts +14 -3
- package/dist/features/seller/schemas/index.d.ts +4 -4
- package/dist/features/seller/schemas/order-forms.d.ts +39 -0
- package/dist/features/seller/schemas/order-forms.js +37 -0
- package/dist/features/shell/FormShell.js +6 -2
- package/dist/features/shell/QuickFormDrawer.js +15 -1
- package/dist/features/shipments/components/AdminShipmentEditorView.js +0 -1
- package/dist/features/shipments/components/AdminShipmentsView.js +1 -1
- package/dist/features/sticker-trace/components/StickerCommitPanel.d.ts +30 -0
- package/dist/features/sticker-trace/components/StickerCommitPanel.js +93 -0
- package/dist/features/sticker-trace/components/StickerPrintPanel.d.ts +33 -0
- package/dist/features/sticker-trace/components/StickerPrintPanel.js +104 -0
- package/dist/features/sticker-trace/components/StickerRetryPanel.d.ts +20 -0
- package/dist/features/sticker-trace/components/StickerRetryPanel.js +128 -0
- package/dist/features/sticker-trace/components/StickerRunHistoryPanel.d.ts +45 -0
- package/dist/features/sticker-trace/components/StickerRunHistoryPanel.js +84 -0
- package/dist/features/sticker-trace/components/StickerTraceStudio.d.ts +27 -0
- package/dist/features/sticker-trace/components/StickerTraceStudio.js +171 -0
- package/dist/features/sticker-trace/constants/help-content.d.ts +23 -0
- package/dist/features/sticker-trace/constants/help-content.js +172 -0
- package/dist/features/sticker-trace/hooks/useLiveTrace.d.ts +27 -0
- package/dist/features/sticker-trace/hooks/useLiveTrace.js +160 -0
- package/dist/features/sticker-trace/hooks/useStickerTraceProgress.d.ts +22 -0
- package/dist/features/sticker-trace/hooks/useStickerTraceProgress.js +106 -0
- package/dist/features/sticker-trace/repository/sticker-sheets.repository.d.ts +113 -0
- package/dist/features/sticker-trace/repository/sticker-sheets.repository.js +146 -0
- package/dist/features/sticker-trace/repository/sticker-trace-runs.repository.d.ts +132 -0
- package/dist/features/sticker-trace/repository/sticker-trace-runs.repository.js +174 -0
- package/dist/features/sticker-trace/schemas/firestore.d.ts +248 -0
- package/dist/features/sticker-trace/schemas/firestore.js +79 -0
- package/dist/features/sticker-trace/server.d.ts +8 -0
- package/dist/features/sticker-trace/server.js +51 -0
- package/dist/features/stores/actions/store-query-actions.d.ts +2 -2
- package/dist/features/stores/actions/store-query-actions.js +7 -2
- package/dist/features/stores/api/[storeSlug]/auctions/route.js +3 -3
- package/dist/features/stores/api/[storeSlug]/products/route.js +3 -3
- package/dist/features/stores/api/[storeSlug]/reviews/route.js +1 -1
- package/dist/features/stores/api/[storeSlug]/route.js +1 -1
- package/dist/features/stores/components/StoreNavTabs.js +17 -2
- package/dist/features/stores/manifest.js +8 -4
- package/dist/features/support/repository/support.repository.d.ts +14 -3
- package/dist/features/support/repository/support.repository.js +93 -13
- package/dist/features/support/schemas/firestore.d.ts +16 -5
- package/dist/features/tester/seed-data/authored/admin__events-raffles-spin.js +61 -19
- package/dist/features/tester/seed-data/authored/buying__browsing-search.js +19 -3
- package/dist/features/tester/seed-data/authored/content-discovery__authenticity-checker.d.ts +2 -0
- package/dist/features/tester/seed-data/authored/content-discovery__authenticity-checker.js +243 -0
- package/dist/features/tester/seed-data/authored/content-discovery__events.js +36 -10
- package/dist/features/tester/seed-data/authored/content-discovery__overflowing-pill-rows.d.ts +2 -0
- package/dist/features/tester/seed-data/authored/content-discovery__overflowing-pill-rows.js +209 -0
- package/dist/features/tester/seed-data/authored/design-ux__header-brand-mark-centring.d.ts +2 -0
- package/dist/features/tester/seed-data/authored/design-ux__header-brand-mark-centring.js +90 -0
- package/dist/features/tester/seed-data/authored/index.js +8 -0
- package/dist/features/tester/seed-data/authored/selling__media-limits.js +19 -17
- package/dist/features/tester/seed-data/authored/selling__product-upload-details.js +10 -5
- package/dist/features/tester/seed-data/authored/tools__sticker-tracer.d.ts +2 -0
- package/dist/features/tester/seed-data/authored/tools__sticker-tracer.js +283 -0
- package/dist/features/tester/seed-data/tester-checklist-seed-data.js +192 -22
- package/dist/index.d.ts +10 -23
- package/dist/index.js +27 -19
- package/dist/next/api/routeHandler.js +9 -0
- package/dist/next/routing/require-record.d.ts +13 -0
- package/dist/next/routing/require-record.js +62 -0
- package/dist/next/routing/route-map.d.ts +4 -4
- package/dist/next/routing/route-map.js +25 -3
- package/dist/providers/db-firebase/base.d.ts +4 -2
- package/dist/providers/db-firebase/base.js +21 -5
- package/dist/providers/db-firebase/base.repository.d.ts +11 -9
- package/dist/providers/db-firebase/base.repository.js +19 -0
- package/dist/providers/db-firebase/rtdb-paths.d.ts +12 -0
- package/dist/providers/db-firebase/rtdb-paths.js +12 -0
- package/dist/react/ErrorBoundary.js +6 -1
- package/dist/react/hooks/realtime-event-constants.d.ts +1 -0
- package/dist/react/hooks/realtime-event-constants.js +8 -0
- package/dist/react/hooks/useEntityDelete.js +5 -1
- package/dist/react/hooks/useMessage.js +5 -1
- package/dist/repositories/index.d.ts +2 -2
- package/dist/repositories/index.js +6 -1
- package/dist/schemas/registry.d.ts +13 -20
- package/dist/schemas/registry.js +31 -14
- package/dist/schemas/webhooks/google-oauth.d.ts +2 -2
- package/dist/security/encrypted.d.ts +117 -0
- package/dist/security/encrypted.js +100 -0
- package/dist/security/index.d.ts +5 -2
- package/dist/security/index.js +16 -2
- package/dist/security/pii-accessors.d.ts +71 -0
- package/dist/security/pii-accessors.js +150 -0
- package/dist/security/pii-encrypt.d.ts +0 -8
- package/dist/security/pii-encrypt.js +22 -15
- package/dist/security/pii-mask.d.ts +18 -0
- package/dist/security/pii-mask.js +27 -0
- package/dist/seed/_helpers/search-txt-wrappers.d.ts +6 -6
- package/dist/seed/_helpers/search-txt-wrappers.js +22 -0
- package/dist/seed/addresses-seed-data.d.ts +2 -2
- package/dist/seed/authenticity-knowledge-seed-data.d.ts +34 -0
- package/dist/seed/authenticity-knowledge-seed-data.js +1277 -0
- package/dist/seed/bids-seed-data.d.ts +2 -2
- package/dist/seed/bids-seed-data.js +23 -2
- package/dist/seed/events-seed-data.d.ts +2 -2
- package/dist/seed/events-seed-data.js +5 -0
- package/dist/seed/faq-seed-data.js +175 -5
- package/dist/seed/homepage-sections-seed-data.js +39 -23
- package/dist/seed/index.d.ts +1 -0
- package/dist/seed/index.js +1 -0
- package/dist/seed/lottery-entries-seed-data.d.ts +2 -2
- package/dist/seed/offers-seed-data.d.ts +2 -2
- package/dist/seed/offers-seed-data.js +1 -1
- package/dist/seed/orders-seed-data.d.ts +2 -2
- package/dist/seed/payouts-seed-data.d.ts +2 -2
- package/dist/seed/payouts-seed-data.js +1 -1
- package/dist/seed/reviews-seed-data.d.ts +1 -2
- package/dist/seed/seed-purpose.js +7 -0
- package/dist/seed/sessions-seed-data.d.ts +2 -2
- package/dist/seed/sessions-seed-data.js +5 -0
- package/dist/seed/site-settings-seed-data.js +1 -1
- package/dist/seed/support-tickets-seed-data.d.ts +2 -2
- package/dist/seed/support-tickets-seed-data.js +1 -1
- package/dist/seed/users-seed-data.d.ts +2 -2
- package/dist/seed/users-seed-data.js +1 -1
- package/dist/seo/json-ld.js +5 -1
- package/dist/server.d.ts +18 -3
- package/dist/server.js +59 -3
- package/dist/styles.css +237 -1
- package/dist/tailwind-utilities.css +1 -1
- package/dist/ui/components/Button.js +7 -1
- package/dist/ui/components/FilterChipGroup.d.ts +11 -0
- package/dist/ui/components/FilterChipGroup.js +1 -1
- package/dist/ui/components/ImageGallery.js +6 -1
- package/dist/ui/components/ListingLayout.js +14 -8
- package/dist/ui/components/OverflowRow.d.ts +92 -0
- package/dist/ui/components/OverflowRow.js +203 -0
- package/dist/ui/components/OverflowRow.style.css +235 -0
- package/dist/ui/components/RecordDetailModal.js +14 -1
- package/dist/ui/components/RowActionMenu.js +5 -1
- package/dist/ui/components/SideDrawer.js +5 -1
- package/dist/ui/components/SideModal.js +9 -1
- package/dist/ui/components/TabBarShell.d.ts +12 -1
- package/dist/ui/components/TabBarShell.js +3 -2
- package/dist/ui/components/Tabs.js +36 -24
- package/dist/ui/components/Toast.d.ts +3 -24
- package/dist/ui/components/Toast.js +2 -19
- package/dist/ui/components/TopBannerPortal.d.ts +15 -0
- package/dist/ui/components/TopBannerPortal.js +19 -0
- package/dist/ui/components/UnsavedChangesModal.js +5 -1
- package/dist/ui/components/index.style.css +1 -0
- package/dist/ui/components/row-collapse.d.ts +15 -0
- package/dist/ui/components/row-collapse.js +127 -0
- package/dist/ui/components/toast-context.d.ts +63 -0
- package/dist/ui/components/toast-context.js +48 -0
- package/dist/ui/components/top-banner-slot.d.ts +37 -0
- package/dist/ui/components/top-banner-slot.js +45 -0
- package/dist/ui/icons/icon-registry.d.ts +6 -0
- package/dist/ui/icons/icon-registry.js +17 -1
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.js +1 -0
- package/dist/utils/array.helper.d.ts +2 -2
- package/dist/utils/array.helper.js +5 -5
- package/dist/utils/id-generators.d.ts +6 -0
- package/dist/utils/id-generators.js +10 -0
- package/dist/utils/media-url.js +0 -2
- package/dist/utils/search-txt-builders.d.ts +28 -4
- package/dist/utils/search-txt-builders.js +41 -1
- package/dist/validation/schemas.d.ts +8 -8
- package/package.json +6 -2
- package/scripts/seed-cli.mjs +3 -0
- package/dist/features/account/components/UserAddressesView.d.ts +0 -13
- package/dist/features/account/components/UserAddressesView.js +0 -5
- package/dist/features/account/components/UserNotificationsView.d.ts +0 -15
- package/dist/features/account/components/UserNotificationsView.js +0 -12
- package/dist/features/account/components/UserSettingsView.d.ts +0 -16
- package/dist/features/account/components/UserSettingsView.js +0 -13
- package/dist/features/account/components/UserSupportView.d.ts +0 -3
- package/dist/features/account/components/UserSupportView.js +0 -166
- package/dist/features/admin/components/DemoSeedView.d.ts +0 -11
- package/dist/features/admin/components/DemoSeedView.js +0 -5
- package/dist/features/auth/components/AuthStatusPanel.d.ts +0 -10
- package/dist/features/auth/components/AuthStatusPanel.js +0 -22
- package/dist/features/categories/components/CategoryProductsView.d.ts +0 -45
- package/dist/features/categories/components/CategoryProductsView.js +0 -21
- package/dist/features/homepage/components/HowItWorksInfoView.d.ts +0 -36
- package/dist/features/homepage/components/HowItWorksInfoView.js +0 -10
- package/dist/features/layout/BottomActions.d.ts +0 -1
- package/dist/features/layout/BottomActions.js +0 -311
- package/dist/features/products/components/ProductsView.d.ts +0 -6
- package/dist/features/products/components/ProductsView.js +0 -5
- package/dist/features/seller/components/SellerStoreView.d.ts +0 -8
- package/dist/features/seller/components/SellerStoreView.js +0 -8
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/*
|
|
4
|
+
* WHY: Up to this point the tracer was logic with no surface — the codec, the
|
|
5
|
+
* core and the live hook all worked and nobody could open them. This is
|
|
6
|
+
* the first thing a human can actually tune a scan with.
|
|
7
|
+
* WHAT: Pick a local file, move the parameters, watch the outlines redraw.
|
|
8
|
+
*
|
|
9
|
+
* 🛑 The bytes NEVER leave the tab. The file goes straight into the canvas
|
|
10
|
+
* codec, so tuning costs no upload, no Storage object and no Function
|
|
11
|
+
* invocation — which is the whole reason the codec is a port. Uploading only
|
|
12
|
+
* happens later, when the operator commits to a run.
|
|
13
|
+
*
|
|
14
|
+
* EXPORTS: StickerTraceStudio
|
|
15
|
+
*
|
|
16
|
+
* @tag domain:sticker-trace
|
|
17
|
+
* @tag layer:feature
|
|
18
|
+
* @tag pattern:none
|
|
19
|
+
* @tag access:client
|
|
20
|
+
* @tag consumers:tools/sticker-tracer
|
|
21
|
+
* @tag sideEffects:none
|
|
22
|
+
*/
|
|
23
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
24
|
+
import { Card, FilePickerButton, Grid, Heading, Row, Section, Span, Stack, Text, } from "../../../ui/index.js";
|
|
25
|
+
import { FieldInput } from "../../../ui/forms/FieldInput.js";
|
|
26
|
+
import { FieldSelect } from "../../../ui/forms/FieldSelect.js";
|
|
27
|
+
import { paramsForTier } from "../../../_internal/shared/features/sticker-trace/config.js";
|
|
28
|
+
import { CUT_CONTOUR_CSS } from "../../../_internal/shared/features/sticker-trace/cut-contour.js";
|
|
29
|
+
import { PARAM_HELP, TIER_HELP } from "../constants/help-content.js";
|
|
30
|
+
import { useLiveTrace } from "../hooks/useLiveTrace.js";
|
|
31
|
+
import { canvasCodec } from "../../../_internal/client/features/sticker-trace/canvas-codec.js";
|
|
32
|
+
import { normalizeError } from "../../../errors/normalize.js";
|
|
33
|
+
/*
|
|
34
|
+
* Only `draft` is offered. The hook runs on the main thread and draft's
|
|
35
|
+
* 1200px cap is what keeps one trace near a second; `standard`'s 3000 would
|
|
36
|
+
* block the tab for several. The heavier tiers are a property of a RUN, chosen
|
|
37
|
+
* when the operator commits — offering them here would be a control that
|
|
38
|
+
* freezes the page.
|
|
39
|
+
*/
|
|
40
|
+
const TIER = "draft";
|
|
41
|
+
/**
|
|
42
|
+
* The four parameters worth a live control.
|
|
43
|
+
*
|
|
44
|
+
* 🛑 Deliberately NOT every parameter. `TraceParams` has two dozen members and
|
|
45
|
+
* a form of two dozen sliders is a form nobody reads — these are the four the
|
|
46
|
+
* corpus work actually moved when a scan came out wrong, and the rest keep
|
|
47
|
+
* their tier defaults. The full set belongs in the run's advanced panel, where
|
|
48
|
+
* it is edited deliberately rather than dragged.
|
|
49
|
+
*/
|
|
50
|
+
/*
|
|
51
|
+
* The four parameters worth a live control.
|
|
52
|
+
*
|
|
53
|
+
* 🛑 Deliberately NOT every parameter. `TraceParams` has two dozen members and
|
|
54
|
+
* a form of two dozen sliders is a form nobody reads — these are the four the
|
|
55
|
+
* corpus work actually moved when a scan came out wrong, and the rest keep
|
|
56
|
+
* their tier defaults.
|
|
57
|
+
*
|
|
58
|
+
* 🛑 The hint text comes from PARAM_HELP, not from a literal here. It used to
|
|
59
|
+
* be a second, shorter paraphrase of the same explanation, which is the copy
|
|
60
|
+
* that drifts: the inline hint is the one people actually read, so it has to be
|
|
61
|
+
* the same words the help panel shows.
|
|
62
|
+
*/
|
|
63
|
+
const CONTROLS = [
|
|
64
|
+
{ key: "ridgeHysteresisLow", step: 0.01 },
|
|
65
|
+
{ key: "ridgeHysteresisHigh", step: 0.01 },
|
|
66
|
+
{ key: "paperTolerance", step: 1 },
|
|
67
|
+
{ key: "minPartAreaMm2", step: 5 },
|
|
68
|
+
];
|
|
69
|
+
export function StickerTraceStudio({ renderCommit }) {
|
|
70
|
+
const [file, setFile] = useState(null);
|
|
71
|
+
const [source, setSource] = useState(null);
|
|
72
|
+
const [params, setParams] = useState(() => paramsForTier(TIER));
|
|
73
|
+
const canvasRef = useRef(null);
|
|
74
|
+
const { parts, diagnostics, raster, tracing, lastMs, error } = useLiveTrace(source, params);
|
|
75
|
+
/*
|
|
76
|
+
* The scan's natural size, probed once per file.
|
|
77
|
+
*
|
|
78
|
+
* Deliberately separate from the trace: `probe` reads the header only and
|
|
79
|
+
* does not decode pixels, so this costs nothing next to the trace itself —
|
|
80
|
+
* and it is the only number the commit flow may record as the scan's size.
|
|
81
|
+
*/
|
|
82
|
+
const [natural, setNatural] = useState(null);
|
|
83
|
+
const [probeError, setProbeError] = useState(null);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (!source) {
|
|
86
|
+
setNatural(null);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
let live = true;
|
|
90
|
+
setProbeError(null);
|
|
91
|
+
void canvasCodec
|
|
92
|
+
.probe(source)
|
|
93
|
+
.then((p) => {
|
|
94
|
+
if (live)
|
|
95
|
+
setNatural({ widthPx: p.width, heightPx: p.height });
|
|
96
|
+
})
|
|
97
|
+
.catch((err) => {
|
|
98
|
+
const n = normalizeError(err);
|
|
99
|
+
// A failed probe must not silently fall back to the raster's size —
|
|
100
|
+
// that is the downscaled one, and a wrong scan size is invisible until
|
|
101
|
+
// a millimetre figure reaches a cut file. Null blocks the commit.
|
|
102
|
+
// Recorded on state rather than logged: this is a client component, and
|
|
103
|
+
// the operator is the one who needs to know the commit is blocked.
|
|
104
|
+
if (live) {
|
|
105
|
+
setNatural(null);
|
|
106
|
+
setProbeError(n.message);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
return () => {
|
|
110
|
+
live = false;
|
|
111
|
+
};
|
|
112
|
+
}, [source]);
|
|
113
|
+
const onFile = useCallback((picked) => {
|
|
114
|
+
setFile(picked);
|
|
115
|
+
void picked.arrayBuffer().then((buf) => setSource(new Uint8Array(buf)));
|
|
116
|
+
}, []);
|
|
117
|
+
const setParam = useCallback((key, value) => {
|
|
118
|
+
setParams((p) => ({ ...p, [key]: value }));
|
|
119
|
+
}, []);
|
|
120
|
+
/*
|
|
121
|
+
* Draw the raster, then stroke every part's outline over it.
|
|
122
|
+
*
|
|
123
|
+
* 🛑 The outlines are stroked from the BÉZIER PATHS, not from the alpha
|
|
124
|
+
* masks. A mask would show what the rasteriser produced; the paths are what
|
|
125
|
+
* the machine will actually cut, and the two can differ — which is precisely
|
|
126
|
+
* what an operator needs to see before committing.
|
|
127
|
+
*/
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
const canvas = canvasRef.current;
|
|
130
|
+
if (!canvas || !raster)
|
|
131
|
+
return;
|
|
132
|
+
canvas.width = raster.width;
|
|
133
|
+
canvas.height = raster.height;
|
|
134
|
+
const ctx = canvas.getContext("2d");
|
|
135
|
+
if (!ctx)
|
|
136
|
+
return;
|
|
137
|
+
ctx.putImageData(new ImageData(new Uint8ClampedArray(raster.data), raster.width, raster.height), 0, 0);
|
|
138
|
+
ctx.lineWidth = Math.max(1, raster.width / 600);
|
|
139
|
+
/*
|
|
140
|
+
* The CutContour spot colour, from the shared domain constant — the same
|
|
141
|
+
* value the print-shop SVG export will carry. A themed stroke would drift
|
|
142
|
+
* from the export and change with the viewer's theme while the cut file
|
|
143
|
+
* did not.
|
|
144
|
+
*/
|
|
145
|
+
ctx.strokeStyle = CUT_CONTOUR_CSS;
|
|
146
|
+
for (const part of parts) {
|
|
147
|
+
const p = part.path;
|
|
148
|
+
ctx.beginPath();
|
|
149
|
+
ctx.moveTo(p.start.x, p.start.y);
|
|
150
|
+
for (const seg of p.segments) {
|
|
151
|
+
ctx.bezierCurveTo(seg.c1.x, seg.c1.y, seg.c2.x, seg.c2.y, seg.to.x, seg.to.y);
|
|
152
|
+
}
|
|
153
|
+
ctx.closePath();
|
|
154
|
+
ctx.stroke();
|
|
155
|
+
}
|
|
156
|
+
}, [raster, parts]);
|
|
157
|
+
const bgLabel = useMemo(() => (diagnostics ? (diagnostics.paperColour ? "paper" : "art") : "—"), [diagnostics]);
|
|
158
|
+
return (_jsx(Section, { children: _jsxs(Stack, { gap: "comfortable", children: [_jsxs(Row, { gap: "comfortable", align: "center", children: [_jsx(FilePickerButton, { onFile: onFile, accept: "image/*", children: file ? "Choose a different scan" : "Choose a scan" }), file ? _jsx(Text, { size: "sm", color: "muted", children: file.name }) : null] }), error ? (_jsx(Card, { variant: "default", children: _jsx(Text, { color: "error", role: "alert", children: error }) })) : null, probeError ? (_jsx(Card, { variant: "default", children: _jsxs(Text, { color: "error", role: "alert", children: ["Could not read this scan's dimensions (", probeError, "). You can still tune it, but it cannot be committed as a run until that works \u2014 a run needs the real pixel size, not the preview's."] }) })) : null, source ? (_jsxs(Grid, { cols: "cards", children: [_jsx(Card, { variant: "default", children: _jsxs(Stack, { gap: "comfortable", children: [_jsx(Heading, { level: 3, children: "Parameters" }), CONTROLS.map((c) => (_jsxs(Stack, { gap: "dense", children: [_jsx(FieldInput, { name: c.key, type: "number", label: PARAM_HELP[c.key]?.title ?? c.key, step: c.step, value: String(params[c.key]), onChange: (v) => {
|
|
159
|
+
const n = Number(v);
|
|
160
|
+
// A half-typed "0." parses NaN; keeping the old value
|
|
161
|
+
// beats re-tracing against a NaN and blanking the canvas.
|
|
162
|
+
if (Number.isFinite(n))
|
|
163
|
+
setParam(c.key, n);
|
|
164
|
+
} }), _jsx(Text, { size: "xs", color: "muted", children: PARAM_HELP[c.key]?.body })] }, c.key))), _jsx(FieldSelect, { name: "tier", label: "Tier", value: TIER, disabled: true, options: [{ value: TIER, label: TIER_HELP[TIER].title }], onChange: () => undefined }), _jsx(Text, { size: "xs", color: "muted", children: TIER_HELP[TIER].body })] }) }), _jsx(Card, { variant: "default", children: _jsxs(Stack, { gap: "dense", children: [_jsx(Heading, { level: 3, children: "Result" }), _jsxs(Text, { children: [_jsx(Span, { weight: "bold", children: parts.length }), " part(s)", diagnostics ? ` · ${diagnostics.droppedSheetSized} sheet-sized` : "", diagnostics ? ` · ${diagnostics.droppedBelowMinArea} too small` : ""] }), _jsxs(Text, { size: "sm", color: "muted", children: ["background: ", bgLabel, diagnostics
|
|
165
|
+
? ` · ridge ${(diagnostics.ridgeCoverage * 100).toFixed(1)}%`
|
|
166
|
+
: "", lastMs !== null ? ` · ${lastMs} ms` : "", tracing ? " · tracing…" : ""] }), diagnostics && parts.length === 0 && diagnostics.droppedSheetSized >= 1 ? (_jsx(Text, { size: "sm", color: "warning", children: "No parts, and one component covers the whole sheet \u2014 this looks like several sheets in one scan, which is unsupported. Scan them individually or crop." })) : null] }) })] })) : (_jsx(Text, { color: "muted", children: "Pick a scanned sticker sheet to trace. Nothing is uploaded \u2014 the trace runs entirely in this tab." })), source ? (_jsx(Card, { variant: "default", children: _jsx("canvas", { ref: canvasRef, className: "w-full h-auto" }) })) : null, renderCommit?.({
|
|
167
|
+
params,
|
|
168
|
+
file,
|
|
169
|
+
dimensions: natural,
|
|
170
|
+
})] }) }));
|
|
171
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PrecisionTier } from "../../../_internal/shared/features/sticker-trace/types";
|
|
2
|
+
export interface HelpEntry {
|
|
3
|
+
title: string;
|
|
4
|
+
body: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* What each tier actually buys, in the terms that decide between them.
|
|
8
|
+
*
|
|
9
|
+
* 🛑 A `Record<PrecisionTier, …>`, so a fifth tier cannot be added without
|
|
10
|
+
* answering "what does it buy" — the thing a tier selector exists to tell you.
|
|
11
|
+
*/
|
|
12
|
+
export declare const TIER_HELP: Record<PrecisionTier, HelpEntry>;
|
|
13
|
+
/**
|
|
14
|
+
* The parameters an operator actually moves.
|
|
15
|
+
*
|
|
16
|
+
* Keyed by the `TraceParams` member name so a field can look its own help up
|
|
17
|
+
* by `name`, which is what makes the inline `?` and the panel the same text.
|
|
18
|
+
*/
|
|
19
|
+
export declare const PARAM_HELP: Record<string, HelpEntry>;
|
|
20
|
+
/** How to read the result panel's numbers. */
|
|
21
|
+
export declare const DIAGNOSTIC_HELP: Record<string, HelpEntry>;
|
|
22
|
+
/** Things the tool cannot do, stated plainly rather than discovered. */
|
|
23
|
+
export declare const LIMITATION_HELP: readonly HelpEntry[];
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* WHY: Every number in this tool has a reason that was measured, and none of
|
|
3
|
+
* them is guessable from the label. An operator deciding between tiers, or
|
|
4
|
+
* staring at a scan that produced nine parts instead of fifteen, needs the
|
|
5
|
+
* reason — not a tooltip restating the field name.
|
|
6
|
+
* WHAT: One source for that copy, rendered by the help panel AND by each
|
|
7
|
+
* field's inline `?`.
|
|
8
|
+
*
|
|
9
|
+
* 🛑 ONE source, two renderers. Two copies drift, and the inline hint is the
|
|
10
|
+
* one people actually read — so it must be the same text as the panel rather
|
|
11
|
+
* than a shortened paraphrase that loses the number.
|
|
12
|
+
*
|
|
13
|
+
* 🛑 Every figure here was MEASURED on the nine reference scans, not estimated.
|
|
14
|
+
* Where a claim is an expectation rather than a measurement it says so. Do not
|
|
15
|
+
* add a confident number to this file without one, because this is the copy an
|
|
16
|
+
* operator will trust over their own eyes.
|
|
17
|
+
*
|
|
18
|
+
* EXPORTS: TIER_HELP, PARAM_HELP, DIAGNOSTIC_HELP, LIMITATION_HELP
|
|
19
|
+
*
|
|
20
|
+
* @tag domain:sticker-trace
|
|
21
|
+
* @tag layer:feature
|
|
22
|
+
* @tag pattern:none
|
|
23
|
+
* @tag access:isomorphic
|
|
24
|
+
* @tag consumers:StickerTraceStudio,StickerTracerHelpPanel
|
|
25
|
+
* @tag sideEffects:none
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* What each tier actually buys, in the terms that decide between them.
|
|
29
|
+
*
|
|
30
|
+
* 🛑 A `Record<PrecisionTier, …>`, so a fifth tier cannot be added without
|
|
31
|
+
* answering "what does it buy" — the thing a tier selector exists to tell you.
|
|
32
|
+
*/
|
|
33
|
+
export const TIER_HELP = {
|
|
34
|
+
draft: {
|
|
35
|
+
title: "Draft — interactive",
|
|
36
|
+
body: "Works at a 1200px long edge, which is what keeps one trace near a second. " +
|
|
37
|
+
"This is the only tier the live tuner offers: the trace runs in your browser " +
|
|
38
|
+
"on the main thread, so a heavier tier would freeze the page while you drag a " +
|
|
39
|
+
"slider. Use it to find parameters that work, then commit a run at a higher " +
|
|
40
|
+
"tier with those parameters.",
|
|
41
|
+
},
|
|
42
|
+
standard: {
|
|
43
|
+
title: "Standard",
|
|
44
|
+
body: "3000px long edge, median prefilter, integer contours. The default for a real " +
|
|
45
|
+
"run, and what the reference corpus was measured at — the part counts you see " +
|
|
46
|
+
"quoted anywhere in this tool are standard-tier counts.",
|
|
47
|
+
},
|
|
48
|
+
precise: {
|
|
49
|
+
title: "Precise",
|
|
50
|
+
body: "5000px (or native, whichever is smaller), bilateral prefilter, and SUB-PIXEL " +
|
|
51
|
+
"contours: the mask is blurred before tracing so an edge lands between pixels " +
|
|
52
|
+
"rather than on one. Reach for it when a halftone scan merges two stickers at " +
|
|
53
|
+
"standard, which is the case it exists for.",
|
|
54
|
+
},
|
|
55
|
+
max: {
|
|
56
|
+
title: "Max",
|
|
57
|
+
body: "Native resolution, with the ridge pass TILED and overlapped so a cut line " +
|
|
58
|
+
"crossing a tile seam is not broken. Expensive in both time and quota, and the " +
|
|
59
|
+
"tier most likely to produce a cut file Design Space cannot open — its finer " +
|
|
60
|
+
"simplify tolerance can push a sheet past the ~50,000-node ceiling. Export " +
|
|
61
|
+
"simplification is a separate budget for exactly that reason.",
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* The parameters an operator actually moves.
|
|
66
|
+
*
|
|
67
|
+
* Keyed by the `TraceParams` member name so a field can look its own help up
|
|
68
|
+
* by `name`, which is what makes the inline `?` and the panel the same text.
|
|
69
|
+
*/
|
|
70
|
+
export const PARAM_HELP = {
|
|
71
|
+
ridgeHysteresisLow: {
|
|
72
|
+
title: "Ridge sensitivity (low)",
|
|
73
|
+
body: "The threshold a pixel must clear to COUNT as part of a cut line once a " +
|
|
74
|
+
"neighbour is already certain. Lower finds fainter lines and more noise with " +
|
|
75
|
+
"them. This is the first thing to try when parts are missing: the detector " +
|
|
76
|
+
"reads an emboss ridge, which on the reference scans sits 10-20x above noise " +
|
|
77
|
+
"even where colour shows nothing at all.",
|
|
78
|
+
},
|
|
79
|
+
ridgeHysteresisHigh: {
|
|
80
|
+
title: "Ridge sensitivity (high)",
|
|
81
|
+
body: "The threshold at which a line is certain enough to start from. Raise it if " +
|
|
82
|
+
"the trace is finding cut lines inside artwork; lower it if whole stickers are " +
|
|
83
|
+
"being missed. The two thresholds work as a pair — a line is kept when it " +
|
|
84
|
+
"clears the low bar AND connects to something that cleared the high one.",
|
|
85
|
+
},
|
|
86
|
+
paperTolerance: {
|
|
87
|
+
title: "Paper tolerance",
|
|
88
|
+
body: "How far a pixel may differ from the sampled paper colour and still count as " +
|
|
89
|
+
"background. Only used on sheets that HAVE a background: a full-bleed art sheet " +
|
|
90
|
+
"is segmented a different way entirely, and this control does nothing there. " +
|
|
91
|
+
"The result panel tells you which model ran.",
|
|
92
|
+
},
|
|
93
|
+
minPartAreaMm2: {
|
|
94
|
+
title: "Minimum part area",
|
|
95
|
+
body: "Anything smaller is dropped as speckle. Raise it when the part count is full " +
|
|
96
|
+
"of fragments. Measured in mm², so it depends on a trustworthy DPI — with no " +
|
|
97
|
+
"confirmed DPI the tool falls back to a fraction of the image instead, which " +
|
|
98
|
+
"still removes dust but cannot honour a figure in millimetres.",
|
|
99
|
+
},
|
|
100
|
+
bridgeMm: {
|
|
101
|
+
title: "Bridge gap",
|
|
102
|
+
body: "Closes small breaks in a cut line before the outline is traced. Useful on a " +
|
|
103
|
+
"scan where the emboss fades; too high and two adjacent stickers fuse into one " +
|
|
104
|
+
"part.",
|
|
105
|
+
},
|
|
106
|
+
simplifyMm: {
|
|
107
|
+
title: "Simplify tolerance",
|
|
108
|
+
body: "How far the final outline may deviate from the traced curve. Tighter means " +
|
|
109
|
+
"more nodes, and node count is what Design Space runs out of — so the Cricut " +
|
|
110
|
+
"export re-simplifies to its own budget and reports the resulting deviation " +
|
|
111
|
+
"rather than inheriting this value.",
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
/** How to read the result panel's numbers. */
|
|
115
|
+
export const DIAGNOSTIC_HELP = {
|
|
116
|
+
background: {
|
|
117
|
+
title: "paper vs art",
|
|
118
|
+
body: "Two completely different segmentation models, chosen automatically. PAPER " +
|
|
119
|
+
"floods inward from the sheet edge, so a sticker is anything the flood cannot " +
|
|
120
|
+
"reach — which is why a region inside a sticker stays opaque no matter what " +
|
|
121
|
+
"colour it is. ART has no background to flood, so it partitions on the cut " +
|
|
122
|
+
"lines and merges back across the weak ones. If the wrong model is chosen, " +
|
|
123
|
+
"paper tolerance will appear to do nothing.",
|
|
124
|
+
},
|
|
125
|
+
sheetSized: {
|
|
126
|
+
title: "sheet-sized",
|
|
127
|
+
body: "Components covering more than 60% of the image. One of these usually means " +
|
|
128
|
+
"the flood never got in — the cut lines sealed the border, or the scan has no " +
|
|
129
|
+
"background at all.",
|
|
130
|
+
},
|
|
131
|
+
tooSmall: {
|
|
132
|
+
title: "too small",
|
|
133
|
+
body: "Components dropped for being under the minimum part area. A large number here " +
|
|
134
|
+
"with few real parts usually means the detector is reading noise as cut lines; " +
|
|
135
|
+
"try a prefilter before raising the minimum.",
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
/** Things the tool cannot do, stated plainly rather than discovered. */
|
|
139
|
+
export const LIMITATION_HELP = Object.freeze([
|
|
140
|
+
{
|
|
141
|
+
title: "Several sheets in one scan",
|
|
142
|
+
body: "Unsupported, and measured rather than assumed: a 2x3 montage of six " +
|
|
143
|
+
"full-bleed sheets returns ZERO parts by both models, because the background " +
|
|
144
|
+
"estimate samples the outer frame and the gutters and gets one colour that is " +
|
|
145
|
+
"wrong for five of the six panels. A projection-profile splitter was built for " +
|
|
146
|
+
"this and removed — it still read the montage as one panel while breaking " +
|
|
147
|
+
"single sheets that had worked. Scan sheets individually, or crop.",
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
title: "No DPI means no millimetres",
|
|
151
|
+
body: "Five of the nine reference scans declare 72 or 96 DPI, which is a number the " +
|
|
152
|
+
"encoder wrote rather than anything about the scanner. When DPI cannot be " +
|
|
153
|
+
"trusted the tool shows sizes in pixels and withholds millimetres entirely — a " +
|
|
154
|
+
"fabricated millimetre on a cut file is a physical production error, not a " +
|
|
155
|
+
"cosmetic one. Confirm or measure the DPI to unlock mm output.",
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
title: "Halftone scans are the hard case",
|
|
159
|
+
body: "A screened (dot-pattern) scan carries the weakest cut-line signal of the " +
|
|
160
|
+
"corpus — roughly 3x noise against 10-20x for the rest. Expect to tune it, and " +
|
|
161
|
+
"expect the bilateral prefilter at `precise` to matter more than any threshold.",
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
title: "Parts wider than the cutter",
|
|
165
|
+
body: "A Cricut Joy 2's Print-Then-Cut area on A4 is a column about 78mm wide, and " +
|
|
166
|
+
"several stickers on a typical sheet are wider than that. Those parts are named " +
|
|
167
|
+
"before export rather than silently scaled — scaling would produce a cut file " +
|
|
168
|
+
"that looks correct and yields stickers the wrong physical size. Oversized parts " +
|
|
169
|
+
"can be tiled across sheets, or sent to the print-shop profile, which has no " +
|
|
170
|
+
"width limit.",
|
|
171
|
+
},
|
|
172
|
+
]);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DecodedRaster, TraceDiagnostics, TraceParams, PartGeometry } from "../../../_internal/shared/features/sticker-trace/types";
|
|
2
|
+
export interface LiveTraceState {
|
|
3
|
+
parts: readonly PartGeometry[];
|
|
4
|
+
diagnostics: TraceDiagnostics | null;
|
|
5
|
+
/** The raster the trace ran on — what a canvas overlay draws under the paths. */
|
|
6
|
+
raster: DecodedRaster | null;
|
|
7
|
+
/** True while a trace is in flight; the previous result stays visible. */
|
|
8
|
+
tracing: boolean;
|
|
9
|
+
/** Wall time of the last trace, so a tier change's cost is visible. */
|
|
10
|
+
lastMs: number | null;
|
|
11
|
+
error: string | null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Re-trace `source` whenever `params` change.
|
|
15
|
+
*
|
|
16
|
+
* 🛑 The previous result is kept on screen while a new trace runs. Blanking to
|
|
17
|
+
* a spinner on every keystroke makes the control feel broken and, worse, hides
|
|
18
|
+
* the thing the operator is comparing against — the point of live tuning is
|
|
19
|
+
* seeing what a change did.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useLiveTrace(source: Uint8Array | null, params: TraceParams, opts?: {
|
|
22
|
+
debounceMs?: number;
|
|
23
|
+
}): LiveTraceState & {
|
|
24
|
+
retrace: () => void;
|
|
25
|
+
};
|
|
26
|
+
/** Draft-tier defaults, the only tier sized for interactive use. */
|
|
27
|
+
export declare function liveTuningDefaults(): TraceParams;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*
|
|
3
|
+
* WHY: Tuning a halftone scan takes several attempts, and a server round trip
|
|
4
|
+
* per attempt makes that unaffordable in both time and quota. The whole
|
|
5
|
+
* reason the codec is a port is so the identical trace runs in the tab.
|
|
6
|
+
* WHAT: Decode once, re-trace on every parameter change, report timing.
|
|
7
|
+
*
|
|
8
|
+
* 🛑 A PARAMETER TWEAK MUST NOT RE-DECODE. Decoding is the expensive half, and
|
|
9
|
+
* only decode-stage parameters can change its output — so the raster is cached
|
|
10
|
+
* and reused, and the decision of when to drop it is DELEGATED to
|
|
11
|
+
* `earliestChangedStage` from resume.ts rather than hand-written here. That is
|
|
12
|
+
* the same clamp the retry panel shows, so the browser and the Function agree
|
|
13
|
+
* on which parameters invalidate what; a second hand-rolled list would be the
|
|
14
|
+
* drift Root Cause #42 describes.
|
|
15
|
+
*
|
|
16
|
+
* 🛑 It runs on the MAIN THREAD, debounced. The `draft` tier caps the working
|
|
17
|
+
* long edge at 1200 (~1.4 Mpx) specifically so one trace stays near a second;
|
|
18
|
+
* at `standard` (3000) it would not, which is why the tier selector and this
|
|
19
|
+
* hook are coupled. If a real session janks, the escalation is a Worker — the
|
|
20
|
+
* core is pure and already worker-safe, so that is a mechanical change rather
|
|
21
|
+
* than a redesign. Do not reach for it before measuring.
|
|
22
|
+
*
|
|
23
|
+
* EXPORTS: useLiveTrace, LiveTraceState
|
|
24
|
+
*
|
|
25
|
+
* @tag domain:sticker-trace
|
|
26
|
+
* @tag layer:feature
|
|
27
|
+
* @tag pattern:hook
|
|
28
|
+
* @tag access:client
|
|
29
|
+
* @tag consumers:sticker-trace/components
|
|
30
|
+
* @tag sideEffects:none
|
|
31
|
+
*/
|
|
32
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
33
|
+
import { normalizeError } from "../../../errors/normalize.js";
|
|
34
|
+
import { canvasCodec } from "../../../_internal/client/features/sticker-trace/canvas-codec.js";
|
|
35
|
+
import { paramsForTier } from "../../../_internal/shared/features/sticker-trace/config.js";
|
|
36
|
+
import { traceStickerSheet } from "../../../_internal/shared/features/sticker-trace/index.js";
|
|
37
|
+
import { earliestChangedStage, stageIndex } from "../../../_internal/shared/features/sticker-trace/resume.js";
|
|
38
|
+
const EMPTY = {
|
|
39
|
+
parts: [],
|
|
40
|
+
diagnostics: null,
|
|
41
|
+
raster: null,
|
|
42
|
+
tracing: false,
|
|
43
|
+
lastMs: null,
|
|
44
|
+
error: null,
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Re-trace `source` whenever `params` change.
|
|
48
|
+
*
|
|
49
|
+
* 🛑 The previous result is kept on screen while a new trace runs. Blanking to
|
|
50
|
+
* a spinner on every keystroke makes the control feel broken and, worse, hides
|
|
51
|
+
* the thing the operator is comparing against — the point of live tuning is
|
|
52
|
+
* seeing what a change did.
|
|
53
|
+
*/
|
|
54
|
+
export function useLiveTrace(source, params, opts) {
|
|
55
|
+
const [state, setState] = useState(EMPTY);
|
|
56
|
+
// The cached decode, plus the params it was produced under.
|
|
57
|
+
const rasterRef = useRef(null);
|
|
58
|
+
const decodedWithRef = useRef(null);
|
|
59
|
+
const sourceRef = useRef(null);
|
|
60
|
+
/*
|
|
61
|
+
* Monotonic token. A slow trace that resolves AFTER a newer one must not
|
|
62
|
+
* overwrite it — without this, dragging a slider lands results out of order
|
|
63
|
+
* and the canvas settles on whichever request happened to finish last.
|
|
64
|
+
*/
|
|
65
|
+
const runRef = useRef(0);
|
|
66
|
+
const run = useCallback(async (src, p) => {
|
|
67
|
+
const token = ++runRef.current;
|
|
68
|
+
setState((s) => ({ ...s, tracing: true, error: null }));
|
|
69
|
+
try {
|
|
70
|
+
/*
|
|
71
|
+
* Reuse the cached raster unless a DECODE-stage parameter moved.
|
|
72
|
+
* `earliestChangedStage` returns the first stage whose params differ;
|
|
73
|
+
* stage index 0 is decode, so anything else leaves the pixels valid.
|
|
74
|
+
*/
|
|
75
|
+
const prior = decodedWithRef.current;
|
|
76
|
+
const sameSource = sourceRef.current === src;
|
|
77
|
+
const changed = prior ? earliestChangedStage(prior, p) : null;
|
|
78
|
+
const mustDecode = !rasterRef.current ||
|
|
79
|
+
!sameSource ||
|
|
80
|
+
!prior ||
|
|
81
|
+
(changed !== null && stageIndex(changed) === 0);
|
|
82
|
+
if (mustDecode) {
|
|
83
|
+
rasterRef.current = await canvasCodec.decode(src, {
|
|
84
|
+
maxLongEdge: p.workingLongEdge,
|
|
85
|
+
});
|
|
86
|
+
decodedWithRef.current = p;
|
|
87
|
+
sourceRef.current = src;
|
|
88
|
+
}
|
|
89
|
+
const raster = rasterRef.current;
|
|
90
|
+
if (token !== runRef.current)
|
|
91
|
+
return;
|
|
92
|
+
const t0 = performance.now();
|
|
93
|
+
/*
|
|
94
|
+
* `fullWidth` is the raster's own width here, not the original file's.
|
|
95
|
+
* In the browser there is no confirmed dpi (the canvas codec cannot read
|
|
96
|
+
* density), so mm-denominated output is withheld anyway — passing a
|
|
97
|
+
* made-up full width would produce confident millimetre figures from a
|
|
98
|
+
* number nobody measured.
|
|
99
|
+
*/
|
|
100
|
+
const result = traceStickerSheet(raster, p, raster.width);
|
|
101
|
+
const ms = performance.now() - t0;
|
|
102
|
+
if (token !== runRef.current)
|
|
103
|
+
return;
|
|
104
|
+
setState({
|
|
105
|
+
parts: result.parts,
|
|
106
|
+
diagnostics: result.diagnostics,
|
|
107
|
+
raster,
|
|
108
|
+
tracing: false,
|
|
109
|
+
lastMs: Math.round(ms),
|
|
110
|
+
error: null,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
catch (err) {
|
|
114
|
+
const n = normalizeError(err);
|
|
115
|
+
/*
|
|
116
|
+
* normalizeError FIRST, before the body touches the value — the
|
|
117
|
+
* project-wide rule (Root Cause #31), and audit-catch-normalize caught
|
|
118
|
+
* this file breaking it twice: once by not calling it at all, then by
|
|
119
|
+
* putting an eight-line comment between the catch and the call, which
|
|
120
|
+
* pushed it outside the audit's window. The rule is about the first
|
|
121
|
+
* STATEMENT, so the explanation belongs after it.
|
|
122
|
+
*
|
|
123
|
+
* It also removes the hand-rolled `instanceof Error ? … : String(err)`
|
|
124
|
+
* narrowing that every catch otherwise reinvents slightly differently.
|
|
125
|
+
*
|
|
126
|
+
* The message reaches an admin tuning their own scan, so the browser's
|
|
127
|
+
* own text is useful rather than dangerous — Root Cause #86 is about
|
|
128
|
+
* SERVER internals reaching a user, which this is not.
|
|
129
|
+
*/
|
|
130
|
+
if (token !== runRef.current)
|
|
131
|
+
return;
|
|
132
|
+
setState((s) => ({ ...s, tracing: false, error: n.message }));
|
|
133
|
+
}
|
|
134
|
+
}, []);
|
|
135
|
+
const retrace = useCallback(() => {
|
|
136
|
+
if (sourceRef.current)
|
|
137
|
+
void run(sourceRef.current, params);
|
|
138
|
+
}, [run, params]);
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
if (!source) {
|
|
141
|
+
setState(EMPTY);
|
|
142
|
+
rasterRef.current = null;
|
|
143
|
+
decodedWithRef.current = null;
|
|
144
|
+
sourceRef.current = null;
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const delay = opts?.debounceMs ?? 250;
|
|
148
|
+
const t = setTimeout(() => void run(source, params), delay);
|
|
149
|
+
return () => clearTimeout(t);
|
|
150
|
+
// `params` is a fresh object each render from the caller's form state, so
|
|
151
|
+
// this intentionally depends on the whole object — the debounce is what
|
|
152
|
+
// makes that affordable, and `run` compares params by VALUE through
|
|
153
|
+
// earliestChangedStage rather than by identity.
|
|
154
|
+
}, [source, params, run, opts?.debounceMs]);
|
|
155
|
+
return { ...state, retrace };
|
|
156
|
+
}
|
|
157
|
+
/** Draft-tier defaults, the only tier sized for interactive use. */
|
|
158
|
+
export function liveTuningDefaults() {
|
|
159
|
+
return paramsForTier("draft");
|
|
160
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { TraceStage } from "../../../_internal/shared/features/sticker-trace/types";
|
|
2
|
+
/** One snapshot of the channel. Every field is optional — see `extract`. */
|
|
3
|
+
export interface StickerTraceProgress {
|
|
4
|
+
stage: TraceStage | "queued" | "done" | null;
|
|
5
|
+
pct: number;
|
|
6
|
+
partsDone: number | null;
|
|
7
|
+
partsTotal: number | null;
|
|
8
|
+
shardsDone: number | null;
|
|
9
|
+
shardsTotal: number | null;
|
|
10
|
+
message: string | null;
|
|
11
|
+
level: "info" | "warn" | "error" | null;
|
|
12
|
+
terminal: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface UseStickerTraceProgressReturn {
|
|
15
|
+
progress: StickerTraceProgress;
|
|
16
|
+
/** Call once with the run id and the token the create route minted. */
|
|
17
|
+
subscribe: (runId: string, customToken: string) => void;
|
|
18
|
+
/** A one-line summary for a status row, or null when there is nothing to say. */
|
|
19
|
+
label: string | null;
|
|
20
|
+
error: string | null;
|
|
21
|
+
}
|
|
22
|
+
export declare function useStickerTraceProgress(): UseStickerTraceProgressReturn;
|