@replohq/canopy-sdk 2.6.0 → 3.0.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/_vendor/replo-utils/lib/fonts.mjs +1 -0
- package/_vendor/replo-utils/lib/geometry.mjs +2 -0
- package/_vendor/replo-utils/lib/json.mjs +1 -0
- package/_vendor/replo-utils/lib/misc.mjs +1 -0
- package/_vendor/replo-utils/lib/posthogReplay.mjs +2 -0
- package/_vendor/replo-utils/lib/url.mjs +1 -0
- package/_vendor/replo-utils/react/use-iframe-rpc-channel.mjs +1 -1
- package/_vendor/schemas/designLibrary.mjs +1 -1
- package/_vendor/schemas/generated/consent.d.ts +2 -0
- package/_vendor/schemas/generated/selectModeIframeRpc.d.ts +8 -0
- package/_vendor/schemas/iframeRpcChannel.mjs +2 -1
- package/_vendor/schemas/loaderKeys.d.ts +1 -1
- package/_vendor/schemas/loaderKeys.mjs +103 -23
- package/_vendor/schemas/money.mjs +1860 -3
- package/_vendor/schemas/pageAnnotations.mjs +1 -1
- package/_vendor/schemas/routing/match.mjs +1 -0
- package/_vendor/schemas/routing/rules.mjs +2 -1
- package/_vendor/schemas/selectMode.d.ts +4 -4
- package/_vendor/schemas/selectMode.mjs +1 -0
- package/_vendor/schemas/selectModeIframeRpc.d.ts +25 -5
- package/_vendor/schemas/selectModeIframeRpc.mjs +12 -3
- package/analytics/analytics-provider.d.ts +5 -10
- package/analytics/analytics-provider.js +14 -101
- package/analytics/analytics-provider.js.map +2 -2
- package/analytics/get-analytics-sinks.d.ts +2 -19
- package/analytics/get-analytics-sinks.js +9 -46
- package/analytics/get-analytics-sinks.js.map +2 -2
- package/analytics/hooks/use-product-viewed-analytics.d.ts +2 -6
- package/analytics/hooks/use-product-viewed-analytics.js +6 -28
- package/analytics/hooks/use-product-viewed-analytics.js.map +2 -2
- package/analytics/replo-first-party-pixel.d.ts +3 -12
- package/analytics/replo-first-party-pixel.js +8 -24
- package/analytics/replo-first-party-pixel.js.map +2 -2
- package/analytics/replo-pixel-script.d.ts +4 -10
- package/analytics/replo-pixel-script.js +9 -23
- package/analytics/replo-pixel-script.js.map +2 -2
- package/analytics/sinks/ga4-sink.d.ts +10 -9
- package/analytics/sinks/ga4-sink.js +99 -50
- package/analytics/sinks/ga4-sink.js.map +2 -2
- package/analytics/sinks/meta-sink.d.ts +5 -4
- package/analytics/sinks/meta-sink.js +82 -29
- package/analytics/sinks/meta-sink.js.map +2 -2
- package/analytics/sinks/pinterest-sink.d.ts +7 -6
- package/analytics/sinks/pinterest-sink.js +82 -49
- package/analytics/sinks/pinterest-sink.js.map +2 -2
- package/analytics/sinks/reddit-sink.d.ts +8 -7
- package/analytics/sinks/reddit-sink.js +82 -53
- package/analytics/sinks/reddit-sink.js.map +2 -2
- package/analytics/sinks/replo-sink.d.ts +9 -8
- package/analytics/sinks/replo-sink.js +89 -37
- package/analytics/sinks/replo-sink.js.map +2 -2
- package/analytics/sinks/snapchat-sink.d.ts +6 -5
- package/analytics/sinks/snapchat-sink.js +82 -40
- package/analytics/sinks/snapchat-sink.js.map +2 -2
- package/analytics/sinks/tiktok-sink.d.ts +8 -7
- package/analytics/sinks/tiktok-sink.js +82 -52
- package/analytics/sinks/tiktok-sink.js.map +2 -2
- package/analytics/sinks/window-sink.d.ts +11 -14
- package/analytics/sinks/window-sink.js +101 -28
- package/analytics/sinks/window-sink.js.map +2 -2
- package/analytics/utils/analytics-utils.d.ts +4 -2
- package/analytics/utils/analytics-utils.js +19 -123
- package/analytics/utils/analytics-utils.js.map +2 -2
- package/analytics/utils/navigation-tracker.d.ts +2 -1
- package/analytics/utils/navigation-tracker.js +37 -30
- package/analytics/utils/navigation-tracker.js.map +2 -2
- package/analytics/utils/shopify-funnel-gate.d.ts +2 -7
- package/analytics/utils/shopify-funnel-gate.js +8 -15
- package/analytics/utils/shopify-funnel-gate.js.map +2 -2
- package/cart/buy-now-action.d.ts +2 -9
- package/cart/buy-now-action.js +5 -97
- package/cart/buy-now-action.js.map +2 -2
- package/cart/cart-actions.d.ts +12 -56
- package/cart/cart-actions.js +88 -68
- package/cart/cart-actions.js.map +2 -2
- package/cart/cart-loader.d.ts +3 -9
- package/cart/cart-loader.js +14 -6
- package/cart/cart-loader.js.map +2 -2
- package/cart/cart-provider.d.ts +6 -58
- package/cart/cart-provider.js +13 -359
- package/cart/cart-provider.js.map +3 -3
- package/cart/cart-schema.d.ts +2 -1
- package/cart/cart-schema.js +12 -64
- package/cart/cart-schema.js.map +2 -2
- package/cart/cart-types.d.ts +1 -1
- package/cart/cart-types.js +5 -4
- package/cart/cart-types.js.map +2 -2
- package/cart/gateways/cart-constants.d.ts +1 -0
- package/cart/gateways/cart-constants.js.map +2 -2
- package/cart/gateways/cart-gateway.d.ts +1 -0
- package/cart/gateways/cart-gateway.js +13 -12
- package/cart/gateways/cart-gateway.js.map +2 -2
- package/cart/gateways/cookie-cart-gateway.d.ts +8 -11
- package/cart/gateways/cookie-cart-gateway.js +93 -97
- package/cart/gateways/cookie-cart-gateway.js.map +2 -2
- package/cart/gateways/default-cart-gateway.d.ts +10 -16
- package/cart/gateways/default-cart-gateway.js +13 -23
- package/cart/gateways/default-cart-gateway.js.map +2 -2
- package/cart/gateways/resolver-cart-gateway.d.ts +1 -0
- package/cart/gateways/resolver-cart-gateway.js +13 -102
- package/cart/gateways/resolver-cart-gateway.js.map +2 -2
- package/cart/gateways/stripe-cart-gateway.d.ts +10 -16
- package/cart/gateways/stripe-cart-gateway.js +13 -21
- package/cart/gateways/stripe-cart-gateway.js.map +2 -2
- package/cart/hooks/use-add-to-cart.d.ts +3 -47
- package/cart/hooks/use-add-to-cart.js +10 -115
- package/cart/hooks/use-add-to-cart.js.map +2 -2
- package/cart/hooks/use-buy-now.d.ts +1 -39
- package/cart/hooks/use-buy-now.js +5 -55
- package/cart/hooks/use-buy-now.js.map +2 -2
- package/cart/utils/cart-utils.d.ts +8 -35
- package/cart/utils/cart-utils.js +21 -35
- package/cart/utils/cart-utils.js.map +2 -2
- package/cart/utils/cookie-cart-persistence.d.ts +16 -41
- package/cart/utils/cookie-cart-persistence.js +38 -143
- package/cart/utils/cookie-cart-persistence.js.map +2 -2
- package/cart/utils/variant-to-cart-line.d.ts +12 -42
- package/cart/utils/variant-to-cart-line.js +31 -147
- package/cart/utils/variant-to-cart-line.js.map +2 -2
- package/chunk-UJCSKKID.mjs +27 -0
- package/{chunk-OFU2QEDR.mjs → chunk-ZZPQ3E7S.mjs} +50 -5
- package/consent/consent-action.d.ts +2 -1
- package/consent/consent-action.js +10 -20
- package/consent/consent-action.js.map +2 -2
- package/consent/consent-actions.d.ts +2 -13
- package/consent/consent-actions.js +9 -29
- package/consent/consent-actions.js.map +2 -2
- package/consent/consent-store.d.ts +9 -36
- package/consent/consent-store.js +12 -182
- package/consent/consent-store.js.map +2 -2
- package/consent/cookie.d.ts +9 -12
- package/consent/cookie.js +32 -64
- package/consent/cookie.js.map +2 -2
- package/consent/replo-scripts.d.ts +5 -18
- package/consent/replo-scripts.js +11 -94
- package/consent/replo-scripts.js.map +2 -2
- package/consent/script-registration-store.d.ts +6 -2
- package/consent/script-registration-store.js +33 -47
- package/consent/script-registration-store.js.map +2 -2
- package/consent/script-snippets.d.ts +4 -18
- package/consent/script-snippets.js +19 -127
- package/consent/script-snippets.js.map +2 -2
- package/consent/window-api.d.ts +4 -15
- package/consent/window-api.js +8 -63
- package/consent/window-api.js.map +2 -2
- package/editor/ClientErrorBoundary.d.ts +4 -10
- package/editor/ClientErrorBoundary.js +7 -55
- package/editor/ClientErrorBoundary.js.map +2 -2
- package/editor/DocumentReadyBeacon.d.ts +3 -1
- package/editor/DocumentReadyBeacon.js +6 -3
- package/editor/DocumentReadyBeacon.js.map +2 -2
- package/editor/LinkInterceptor.d.ts +1 -0
- package/editor/LinkInterceptor.js +6 -121
- package/editor/LinkInterceptor.js.map +2 -2
- package/editor/NextErrorReporter.d.ts +1 -0
- package/editor/NextErrorReporter.js +6 -85
- package/editor/NextErrorReporter.js.map +2 -2
- package/editor/annotations/AnnotationLayerMount.d.ts +1 -0
- package/editor/annotations/AnnotationLayerMount.js +6 -6
- package/editor/annotations/AnnotationLayerMount.js.map +2 -2
- package/editor/annotations/annotationController.d.ts +1 -0
- package/editor/annotations/annotationController.js +6 -378
- package/editor/annotations/annotationController.js.map +2 -2
- package/editor/annotations/bridgeGate.d.ts +4 -7
- package/editor/annotations/bridgeGate.js +13 -15
- package/editor/annotations/bridgeGate.js.map +2 -2
- package/editor/design-library-preview/DesignLibraryPreview.d.ts +1 -0
- package/editor/design-library-preview/DesignLibraryPreview.js +6 -86
- package/editor/design-library-preview/DesignLibraryPreview.js.map +2 -2
- package/editor/posthog-relay.d.ts +1 -10
- package/editor/posthog-relay.js +6 -65
- package/editor/posthog-relay.js.map +2 -2
- package/editor/select-mode/EditorSelection.d.ts +1 -23
- package/editor/select-mode/EditorSelection.js +5 -87
- package/editor/select-mode/EditorSelection.js.map +2 -2
- package/editor/select-mode/annotationFrames.d.ts +9 -9
- package/editor/select-mode/annotationFrames.js +22 -103
- package/editor/select-mode/annotationFrames.js.map +2 -2
- package/editor/select-mode/descriptor/elementDescriptor.d.ts +6 -21
- package/editor/select-mode/descriptor/elementDescriptor.js +19 -192
- package/editor/select-mode/descriptor/elementDescriptor.js.map +3 -3
- package/editor/select-mode/descriptor/styleExtraction.d.ts +4 -2
- package/editor/select-mode/descriptor/styleExtraction.js +11 -262
- package/editor/select-mode/descriptor/styleExtraction.js.map +2 -2
- package/editor/select-mode/displayModeStore.d.ts +2 -0
- package/editor/select-mode/displayModeStore.js +14 -39
- package/editor/select-mode/displayModeStore.js.map +2 -2
- package/editor/select-mode/fast-refresh-relay.d.ts +2 -1
- package/editor/select-mode/fast-refresh-relay.js +7 -28
- package/editor/select-mode/fast-refresh-relay.js.map +2 -2
- package/editor/select-mode/fiber.d.ts +14 -7
- package/editor/select-mode/fiber.js +40 -286
- package/editor/select-mode/fiber.js.map +2 -2
- package/editor/select-mode/hooks/useCrosshairCursor.d.ts +2 -9
- package/editor/select-mode/hooks/useCrosshairCursor.js +7 -15
- package/editor/select-mode/hooks/useCrosshairCursor.js.map +2 -2
- package/editor/select-mode/hooks/useEditModeStateMachine.d.ts +5 -3
- package/editor/select-mode/hooks/useEditModeStateMachine.js +13 -228
- package/editor/select-mode/hooks/useEditModeStateMachine.js.map +2 -2
- package/editor/select-mode/hooks/useOptimisticOverrides.d.ts +2 -1
- package/editor/select-mode/hooks/useOptimisticOverrides.js +6 -277
- package/editor/select-mode/hooks/useOptimisticOverrides.js.map +2 -2
- package/editor/select-mode/hooks/useParentMessaging.d.ts +2 -20
- package/editor/select-mode/hooks/useParentMessaging.js +7 -69
- package/editor/select-mode/hooks/useParentMessaging.js.map +2 -2
- package/editor/select-mode/hooks/useSelectModeController.d.ts +2 -1
- package/editor/select-mode/hooks/useSelectModeController.js +6 -40
- package/editor/select-mode/hooks/useSelectModeController.js.map +2 -2
- package/editor/select-mode/hooks/useSelectionHover.d.ts +2 -16
- package/editor/select-mode/hooks/useSelectionHover.js +7 -105
- package/editor/select-mode/hooks/useSelectionHover.js.map +2 -2
- package/editor/select-mode/hooks/useSelectionInteractions.d.ts +2 -26
- package/editor/select-mode/hooks/useSelectionInteractions.js +7 -348
- package/editor/select-mode/hooks/useSelectionInteractions.js.map +2 -2
- package/editor/select-mode/hooks/useSelectionScrollSync.d.ts +2 -22
- package/editor/select-mode/hooks/useSelectionScrollSync.js +7 -65
- package/editor/select-mode/hooks/useSelectionScrollSync.js.map +2 -2
- package/editor/select-mode/hooks/useSiblingResolution.d.ts +4 -2
- package/editor/select-mode/hooks/useSiblingResolution.js +13 -52
- package/editor/select-mode/hooks/useSiblingResolution.js.map +2 -2
- package/editor/select-mode/iframeRpcChannel.d.ts +10 -349
- package/editor/select-mode/iframeRpcChannel.js +23 -79
- package/editor/select-mode/iframeRpcChannel.js.map +2 -2
- package/editor/select-mode/inlineTextMarks.d.ts +4 -6
- package/editor/select-mode/inlineTextMarks.js +13 -18
- package/editor/select-mode/inlineTextMarks.js.map +2 -2
- package/editor/select-mode/interactions/selectionGeometry.d.ts +19 -61
- package/editor/select-mode/interactions/selectionGeometry.js +57 -165
- package/editor/select-mode/interactions/selectionGeometry.js.map +2 -2
- package/editor/select-mode/selectModeSession.d.ts +1 -0
- package/editor/select-mode/selectModeSession.js +6 -3
- package/editor/select-mode/selectModeSession.js.map +2 -2
- package/editor/select-mode/selectionFrame.d.ts +9 -60
- package/editor/select-mode/selectionFrame.js +28 -116
- package/editor/select-mode/selectionFrame.js.map +2 -2
- package/editor/select-mode/symbolicate.d.ts +2 -1
- package/editor/select-mode/symbolicate.js +7 -195
- package/editor/select-mode/symbolicate.js.map +2 -2
- package/editor/select-mode/tiptapInlineEditor.d.ts +15 -2
- package/editor/select-mode/tiptapInlineEditor.js +6 -114
- package/editor/select-mode/tiptapInlineEditor.js.map +2 -2
- package/env.d.ts +2 -1
- package/env.js +10 -37
- package/env.js.map +2 -2
- package/gateways/canopy-api.d.ts +15 -12
- package/gateways/canopy-api.js +122 -160
- package/gateways/canopy-api.js.map +2 -2
- package/hooks/use-client-value.d.ts +2 -10
- package/hooks/use-client-value.js +10 -7
- package/hooks/use-client-value.js.map +2 -2
- package/hooks/use-formatted-price.d.ts +1 -14
- package/hooks/use-formatted-price.js +6 -14
- package/hooks/use-formatted-price.js.map +2 -2
- package/lib/canopy-error.d.ts +2 -5
- package/lib/canopy-error.js +10 -14
- package/lib/canopy-error.js.map +2 -2
- package/lib/get-query-client.d.ts +2 -1
- package/lib/get-query-client.js +8 -27
- package/lib/get-query-client.js.map +2 -2
- package/lib/integration-utils.d.ts +1 -0
- package/lib/integration-utils.js +9 -3
- package/lib/integration-utils.js.map +2 -2
- package/lib/shopify-utils.d.ts +2 -10
- package/lib/shopify-utils.js +10 -2
- package/lib/shopify-utils.js.map +2 -2
- package/lib/tombstone.d.ts +21 -0
- package/lib/tombstone.js +99 -0
- package/lib/tombstone.js.map +7 -0
- package/lib/url-utils.d.ts +2 -4
- package/lib/url-utils.js +10 -3
- package/lib/url-utils.js.map +2 -2
- package/loaders/collection-loader.d.ts +3 -2
- package/loaders/collection-loader.js +5 -48
- package/loaders/collection-loader.js.map +2 -2
- package/loaders/collection-products-loader.d.ts +3 -2
- package/loaders/collection-products-loader.js +5 -51
- package/loaders/collection-products-loader.js.map +2 -2
- package/loaders/contentful-entries-loader.d.ts +3 -2
- package/loaders/contentful-entries-loader.js +5 -71
- package/loaders/contentful-entries-loader.js.map +2 -2
- package/loaders/contentful-entry-loader.d.ts +3 -2
- package/loaders/contentful-entry-loader.js +5 -53
- package/loaders/contentful-entry-loader.js.map +2 -2
- package/loaders/invoke-loader-action.d.ts +2 -8
- package/loaders/invoke-loader-action.js +13 -8
- package/loaders/invoke-loader-action.js.map +2 -2
- package/loaders/invoke-loader-server.d.ts +2 -14
- package/loaders/invoke-loader-server.js +12 -34
- package/loaders/invoke-loader-server.js.map +2 -2
- package/loaders/invoke-loader.d.ts +6 -12
- package/loaders/invoke-loader.js +27 -29
- package/loaders/invoke-loader.js.map +2 -2
- package/loaders/levanta-product-loader.d.ts +3 -2
- package/loaders/levanta-product-loader.js +5 -46
- package/loaders/levanta-product-loader.js.map +2 -2
- package/loaders/loader-error-boundary.d.ts +9 -15
- package/loaders/loader-error-boundary.js +50 -13
- package/loaders/loader-error-boundary.js.map +2 -2
- package/loaders/loader-keys.d.ts +4 -12
- package/loaders/loader-keys.js +6 -1
- package/loaders/loader-keys.js.map +2 -2
- package/loaders/loader-schemas.d.ts +142 -61
- package/loaders/loader-schemas.js +253 -90
- package/loaders/loader-schemas.js.map +2 -2
- package/loaders/metaobject-loader.d.ts +3 -2
- package/loaders/metaobject-loader.js +5 -47
- package/loaders/metaobject-loader.js.map +2 -2
- package/loaders/metaobjects-loader.d.ts +3 -2
- package/loaders/metaobjects-loader.js +5 -53
- package/loaders/metaobjects-loader.js.map +2 -2
- package/loaders/okendo-review-aggregate-loader.d.ts +9 -10
- package/loaders/okendo-review-aggregate-loader.js +5 -49
- package/loaders/okendo-review-aggregate-loader.js.map +2 -2
- package/loaders/okendo-reviews-loader.d.ts +8 -16
- package/loaders/okendo-reviews-loader.js +5 -47
- package/loaders/okendo-reviews-loader.js.map +2 -2
- package/loaders/prefetch-loaders.d.ts +4 -26
- package/loaders/prefetch-loaders.js +5 -40
- package/loaders/prefetch-loaders.js.map +2 -2
- package/loaders/preview-placeholder.d.ts +8 -22
- package/loaders/preview-placeholder.js +47 -209
- package/loaders/preview-placeholder.js.map +2 -2
- package/loaders/product-loader-args.d.ts +2 -11
- package/loaders/product-loader-args.js +6 -12
- package/loaders/product-loader-args.js.map +2 -2
- package/loaders/product-loader.d.ts +3 -2
- package/loaders/product-loader.js +5 -45
- package/loaders/product-loader.js.map +2 -2
- package/loaders/rebuy-recommendations-loader.d.ts +8 -157
- package/loaders/rebuy-recommendations-loader.js +5 -50
- package/loaders/rebuy-recommendations-loader.js.map +2 -2
- package/loaders/reviews-io-review-aggregate-loader.d.ts +5 -4
- package/loaders/reviews-io-review-aggregate-loader.js +5 -36
- package/loaders/reviews-io-review-aggregate-loader.js.map +2 -2
- package/loaders/reviews-io-reviews-loader.d.ts +5 -4
- package/loaders/reviews-io-reviews-loader.js +5 -58
- package/loaders/reviews-io-reviews-loader.js.map +2 -2
- package/loaders/smile-earning-rules-loader.d.ts +10 -11
- package/loaders/smile-earning-rules-loader.js +5 -37
- package/loaders/smile-earning-rules-loader.js.map +2 -2
- package/loaders/smile-rewards-loader.d.ts +10 -11
- package/loaders/smile-rewards-loader.js +5 -37
- package/loaders/smile-rewards-loader.js.map +2 -2
- package/loaders/smile-vip-tiers-loader.d.ts +9 -10
- package/loaders/smile-vip-tiers-loader.js +5 -36
- package/loaders/smile-vip-tiers-loader.js.map +2 -2
- package/loaders/statsig-experiment-loader.d.ts +3 -8
- package/loaders/statsig-experiment-loader.js +5 -74
- package/loaders/statsig-experiment-loader.js.map +2 -2
- package/loaders/vendor-loader-keys.d.ts +4 -0
- package/loaders/vendor-loader-keys.js +9 -0
- package/loaders/vendor-loader-keys.js.map +7 -0
- package/loaders/yotpo-review-aggregate-loader.d.ts +5 -4
- package/loaders/yotpo-review-aggregate-loader.js +5 -43
- package/loaders/yotpo-review-aggregate-loader.js.map +2 -2
- package/loaders/yotpo-reviews-loader.d.ts +5 -4
- package/loaders/yotpo-reviews-loader.js +5 -58
- package/loaders/yotpo-reviews-loader.js.map +2 -2
- package/money.d.ts +9 -9
- package/money.js +25 -6
- package/money.js.map +2 -2
- package/next/config.d.ts +3 -1
- package/next/config.js +11 -85
- package/next/config.js.map +2 -2
- package/next/image-loader.d.ts +2 -1
- package/next/image-loader.js +7 -47
- package/next/image-loader.js.map +2 -2
- package/next/open-next.d.ts +4 -2
- package/next/open-next.js +6 -19
- package/next/open-next.js.map +2 -2
- package/orders/order-status-schema.d.ts +28 -13
- package/orders/order-status-schema.js +45 -13
- package/orders/order-status-schema.js.map +2 -2
- package/orders/order-status.d.ts +2 -8
- package/orders/order-status.js +6 -36
- package/orders/order-status.js.map +2 -2
- package/package.json +1 -12
- package/providers/query-provider.d.ts +3 -1
- package/providers/query-provider.js +10 -6
- package/providers/query-provider.js.map +2 -2
- package/providers/replo-provider.d.ts +3 -1
- package/providers/replo-provider.js +6 -37
- package/providers/replo-provider.js.map +2 -2
- package/routing/evaluate.d.ts +3 -3
- package/routing/evaluate.js +5 -40
- package/routing/evaluate.js.map +2 -2
- package/routing/rules.d.ts +3 -11
- package/routing/rules.js +7 -1
- package/routing/rules.js.map +2 -2
|
@@ -1,44 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "@tanstack/react-query";
|
|
7
|
-
import { invokeLoaderServer } from "./invoke-loader-server";
|
|
8
|
-
async function PrefetchedLoaders({
|
|
9
|
-
queries,
|
|
10
|
-
children
|
|
11
|
-
}) {
|
|
12
|
-
const queryClient = new QueryClient({
|
|
13
|
-
defaultOptions: {
|
|
14
|
-
queries: { staleTime: 60 * 1e3 }
|
|
15
|
-
}
|
|
1
|
+
import { canopyTombstoneError } from "../lib/tombstone";
|
|
2
|
+
async function PrefetchedLoaders(_props) {
|
|
3
|
+
throw canopyTombstoneError({
|
|
4
|
+
symbol: "PrefetchedLoaders",
|
|
5
|
+
subpath: "loaders/prefetch-loaders"
|
|
16
6
|
});
|
|
17
|
-
await Promise.all(
|
|
18
|
-
queries.map((query) => {
|
|
19
|
-
return queryClient.prefetchQuery({
|
|
20
|
-
queryKey: [query.loaderKey, query.args],
|
|
21
|
-
queryFn: () => {
|
|
22
|
-
return invokeLoaderServer({
|
|
23
|
-
loaderKey: query.loaderKey,
|
|
24
|
-
args: query.args,
|
|
25
|
-
revalidateSeconds: query.revalidateSeconds
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
})
|
|
30
|
-
);
|
|
31
|
-
return /* @__PURE__ */ jsx(
|
|
32
|
-
HydrationBoundary,
|
|
33
|
-
{
|
|
34
|
-
state: dehydrate(queryClient, {
|
|
35
|
-
shouldDehydrateQuery: (query) => {
|
|
36
|
-
return query.state.status === "success" || query.state.status === "pending";
|
|
37
|
-
}
|
|
38
|
-
}),
|
|
39
|
-
children
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
7
|
}
|
|
43
8
|
export {
|
|
44
9
|
PrefetchedLoaders
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../loaders/prefetch-loaders.tsx"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type React from \"react\";\n\nimport { canopyTombstoneError } from \"../lib/tombstone\";\n\ntype PrefetchLoaderConfig = {\n loaderKey: string;\n args: Record<string, unknown>;\n revalidateSeconds?: number | false;\n};\n\n/** @deprecated Use PrefetchedLoaders from @replohq/sdk/loaders/prefetch-loaders. */\nexport async function PrefetchedLoaders(\n _props: React.PropsWithChildren<{ queries: PrefetchLoaderConfig[] }>,\n): Promise<React.ReactElement> {\n throw canopyTombstoneError({\n symbol: \"PrefetchedLoaders\",\n subpath: \"loaders/prefetch-loaders\",\n });\n}\n"],
|
|
5
|
+
"mappings": "AAEA,SAAS,4BAA4B;AASrC,eAAsB,kBACpB,QAC6B;AAC7B,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,EACX,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,25 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
* On the server, substitution happens only on dev servers (`next dev` — how
|
|
7
|
-
* every sandbox preview runs); production builds keep fetching so bracket
|
|
8
|
-
* URLs keep their real miss/404 semantics. Substituting during SSR keeps the
|
|
9
|
-
* doomed fetch from erroring the dev overlay mid-stream. In the browser,
|
|
10
|
-
* substitution happens only inside an editor iframe.
|
|
11
|
-
*/
|
|
12
|
-
export declare function resolvePreviewPlaceholderData({ loaderKey, args, }: {
|
|
1
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; hasUnfilledRouteParam has no direct replacement. */
|
|
2
|
+
export declare function hasUnfilledRouteParam(_args: Record<string, unknown>): boolean;
|
|
3
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; resolvePreviewPlaceholderData has no direct replacement. */
|
|
4
|
+
export declare function resolvePreviewPlaceholderData(_args: {
|
|
13
5
|
loaderKey: string;
|
|
14
6
|
args: Record<string, unknown>;
|
|
15
7
|
}): unknown;
|
|
16
|
-
/**
|
|
17
|
-
export declare function isPreviewPlaceholderData(
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
* The single reporting path: inspecting rendered data (rather than hooking
|
|
21
|
-
* loader invocation) covers client fetches and SSR-hydrated data alike —
|
|
22
|
-
* hydration never re-invokes the loader on the client. Receivers treat the
|
|
23
|
-
* message as idempotent, so no dedupe is needed.
|
|
24
|
-
*/
|
|
25
|
-
export declare function useReportPreviewPlaceholderRender(data: unknown): void;
|
|
8
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; isPreviewPlaceholderData has no direct replacement. */
|
|
9
|
+
export declare function isPreviewPlaceholderData(_data: unknown): boolean;
|
|
10
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; useReportPreviewPlaceholderRender has no direct replacement. */
|
|
11
|
+
export declare function useReportPreviewPlaceholderRender(_data: unknown): void;
|
|
@@ -1,217 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
]
|
|
12
|
-
const SAMPLE_COLORS = [
|
|
13
|
-
{ value: "Slate", swatchColor: "#64748b" },
|
|
14
|
-
{ value: "Sand", swatchColor: "#d6bc8a" }
|
|
15
|
-
];
|
|
16
|
-
const SOLD_OUT_COMBINATION = { size: "Large", color: "Sand" };
|
|
17
|
-
function toSampleSlug(value) {
|
|
18
|
-
return value.toLowerCase().replace(/\s+/g, "-");
|
|
19
|
-
}
|
|
20
|
-
const SAMPLE_VARIANTS = SAMPLE_SIZES.flatMap(
|
|
21
|
-
(size) => {
|
|
22
|
-
return SAMPLE_COLORS.map((color) => {
|
|
23
|
-
const isSoldOut = size.value === SOLD_OUT_COMBINATION.size && color.value === SOLD_OUT_COMBINATION.color;
|
|
24
|
-
const slug = `${toSampleSlug(size.value)}-${toSampleSlug(color.value)}`;
|
|
25
|
-
return {
|
|
26
|
-
id: `replo-sample-variant-${slug}`,
|
|
27
|
-
title: `${size.value} / ${color.value}`,
|
|
28
|
-
availableForSale: !isSoldOut,
|
|
29
|
-
sku: `REPLO-SAMPLE-${slug.toUpperCase()}`,
|
|
30
|
-
selectedOptions: [
|
|
31
|
-
{ name: "Size", value: size.value },
|
|
32
|
-
{ name: "Color", value: color.value }
|
|
33
|
-
],
|
|
34
|
-
image: null,
|
|
35
|
-
price: { amount: size.priceAmount, currencyCode: "USD" },
|
|
36
|
-
// Every variant is "on sale" so strikethrough pricing renders.
|
|
37
|
-
compareAtPrice: { amount: "56.00", currencyCode: "USD" },
|
|
38
|
-
sellingPlanIds: []
|
|
39
|
-
};
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
const SAMPLE_PRODUCT = {
|
|
44
|
-
id: "replo-sample-product",
|
|
45
|
-
handle: "sample-product",
|
|
46
|
-
title: "Sample product",
|
|
47
|
-
description: "This is sample product data for previewing this page. Open the page from a real product link to see live details. Sizes, colors, sale pricing, and a sold-out variant are included so every part of the layout has something to show.",
|
|
48
|
-
descriptionHtml: "<p>This is sample product data for previewing this page. Open the page from a real product link to see live details.</p><p>The sample includes:</p><ul><li>Three sizes and two colors to try the option pickers</li><li>Sale pricing with a compare-at price</li><li>One sold-out combination (Large / Sand)</li></ul>",
|
|
49
|
-
availableForSale: true,
|
|
50
|
-
featuredImage: null,
|
|
51
|
-
// `id` is optional in the schema but always present on real data, and
|
|
52
|
-
// generated pages key option lists on it — omit it and previews log React
|
|
53
|
-
// "missing key" console errors, which the dev overlay counts as page errors.
|
|
54
|
-
options: [
|
|
55
|
-
{
|
|
56
|
-
id: "replo-sample-option-size",
|
|
57
|
-
name: "Size",
|
|
58
|
-
values: SAMPLE_SIZES.map((size) => size.value),
|
|
59
|
-
optionValues: SAMPLE_SIZES.map((size) => ({
|
|
60
|
-
id: `replo-sample-option-value-${toSampleSlug(size.value)}`,
|
|
61
|
-
value: size.value,
|
|
62
|
-
swatch: null
|
|
63
|
-
}))
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
id: "replo-sample-option-color",
|
|
67
|
-
name: "Color",
|
|
68
|
-
values: SAMPLE_COLORS.map((color) => color.value),
|
|
69
|
-
optionValues: SAMPLE_COLORS.map((color) => ({
|
|
70
|
-
id: `replo-sample-option-value-${toSampleSlug(color.value)}`,
|
|
71
|
-
value: color.value,
|
|
72
|
-
swatch: { color: color.swatchColor, imageUrl: null }
|
|
73
|
-
}))
|
|
1
|
+
import { canopyTombstoneError } from "../lib/tombstone";
|
|
2
|
+
function hasUnfilledRouteParam(_args) {
|
|
3
|
+
throw canopyTombstoneError({
|
|
4
|
+
symbol: "hasUnfilledRouteParam",
|
|
5
|
+
subpath: "loaders/preview-placeholder",
|
|
6
|
+
replacement: {
|
|
7
|
+
kind: "internal",
|
|
8
|
+
nearestPublicSubpaths: [
|
|
9
|
+
"loaders/product-loader",
|
|
10
|
+
"loaders/prefetch-loaders"
|
|
11
|
+
]
|
|
74
12
|
}
|
|
75
|
-
|
|
76
|
-
variants: SAMPLE_VARIANTS,
|
|
77
|
-
images: [],
|
|
78
|
-
media: [],
|
|
79
|
-
vendor: "Sample Supply Co.",
|
|
80
|
-
productType: "Sample",
|
|
81
|
-
tags: ["sample-data", "new-arrival", "bestseller"],
|
|
82
|
-
sellingPlanGroups: [],
|
|
83
|
-
metafields: []
|
|
84
|
-
};
|
|
85
|
-
const SAMPLE_COLLECTION = {
|
|
86
|
-
id: "replo-sample-collection",
|
|
87
|
-
handle: "sample-collection",
|
|
88
|
-
title: "Sample collection",
|
|
89
|
-
descriptionHtml: "<p>This is sample collection data for previewing this page.</p>",
|
|
90
|
-
image: null
|
|
91
|
-
};
|
|
92
|
-
const SAMPLE_GRID_CARDS = [
|
|
93
|
-
{
|
|
94
|
-
slug: "range",
|
|
95
|
-
title: "Sample product with a price range",
|
|
96
|
-
minAmount: "42.00",
|
|
97
|
-
maxAmount: "50.00",
|
|
98
|
-
compareAtAmount: "0.0",
|
|
99
|
-
availableForSale: true
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
slug: "sale",
|
|
103
|
-
title: "Sample product on sale",
|
|
104
|
-
minAmount: "42.00",
|
|
105
|
-
maxAmount: "42.00",
|
|
106
|
-
compareAtAmount: "56.00",
|
|
107
|
-
availableForSale: true
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
slug: "sold-out",
|
|
111
|
-
title: "Sample product that sold out",
|
|
112
|
-
minAmount: "46.00",
|
|
113
|
-
maxAmount: "46.00",
|
|
114
|
-
compareAtAmount: "0.0",
|
|
115
|
-
availableForSale: false
|
|
116
|
-
}
|
|
117
|
-
];
|
|
118
|
-
const SAMPLE_PAGINATED_PRODUCTS = {
|
|
119
|
-
products: SAMPLE_GRID_CARDS.map((card) => ({
|
|
120
|
-
id: `replo-sample-product-${card.slug}`,
|
|
121
|
-
handle: `sample-product-${card.slug}`,
|
|
122
|
-
title: card.title,
|
|
123
|
-
availableForSale: card.availableForSale,
|
|
124
|
-
featuredImage: null,
|
|
125
|
-
options: [
|
|
126
|
-
{
|
|
127
|
-
id: `replo-sample-option-color-${card.slug}`,
|
|
128
|
-
name: "Color",
|
|
129
|
-
values: SAMPLE_COLORS.map((color) => color.value),
|
|
130
|
-
optionValues: SAMPLE_COLORS.map((color) => ({
|
|
131
|
-
id: `replo-sample-option-value-${card.slug}-${toSampleSlug(color.value)}`,
|
|
132
|
-
value: color.value,
|
|
133
|
-
swatch: { color: color.swatchColor, imageUrl: null }
|
|
134
|
-
}))
|
|
135
|
-
}
|
|
136
|
-
],
|
|
137
|
-
variants: SAMPLE_COLORS.map((color) => ({
|
|
138
|
-
id: `replo-sample-variant-${card.slug}-${toSampleSlug(color.value)}`,
|
|
139
|
-
title: color.value,
|
|
140
|
-
availableForSale: card.availableForSale,
|
|
141
|
-
sku: `REPLO-SAMPLE-${card.slug.toUpperCase()}-${toSampleSlug(color.value).toUpperCase()}`,
|
|
142
|
-
selectedOptions: [{ name: "Color", value: color.value }],
|
|
143
|
-
image: null,
|
|
144
|
-
price: { amount: card.minAmount, currencyCode: "USD" },
|
|
145
|
-
compareAtPrice: Number(card.compareAtAmount) > 0 ? { amount: card.compareAtAmount, currencyCode: "USD" } : null
|
|
146
|
-
})),
|
|
147
|
-
minPrice: { amount: card.minAmount, currencyCode: "USD" },
|
|
148
|
-
maxPrice: { amount: card.maxAmount, currencyCode: "USD" },
|
|
149
|
-
compareAtMinPrice: { amount: card.compareAtAmount, currencyCode: "USD" },
|
|
150
|
-
compareAtMaxPrice: { amount: card.compareAtAmount, currencyCode: "USD" }
|
|
151
|
-
})),
|
|
152
|
-
pageInfo: { hasNextPage: false, endCursor: null }
|
|
153
|
-
};
|
|
154
|
-
const PLACEHOLDER_DATA_BY_LOADER_KEY = {
|
|
155
|
-
[DATA_LOADER_KEYS.SHOPIFY_PRODUCT]: SAMPLE_PRODUCT,
|
|
156
|
-
[DATA_LOADER_KEYS.REPLO_PRODUCT]: SAMPLE_PRODUCT,
|
|
157
|
-
[DATA_LOADER_KEYS.SHOPIFY_COLLECTION]: SAMPLE_COLLECTION,
|
|
158
|
-
[DATA_LOADER_KEYS.SHOPIFY_COLLECTION_PRODUCTS]: SAMPLE_PAGINATED_PRODUCTS
|
|
159
|
-
};
|
|
160
|
-
function isUnfilledRouteParamValue(value) {
|
|
161
|
-
if (UNFILLED_ROUTE_PARAM_RE.test(value)) {
|
|
162
|
-
return true;
|
|
163
|
-
}
|
|
164
|
-
try {
|
|
165
|
-
return UNFILLED_ROUTE_PARAM_RE.test(decodeURIComponent(value));
|
|
166
|
-
} catch {
|
|
167
|
-
return false;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
function hasUnfilledRouteParam(args) {
|
|
171
|
-
return Object.values(args).some(
|
|
172
|
-
(value) => typeof value === "string" && isUnfilledRouteParamValue(value)
|
|
173
|
-
);
|
|
13
|
+
});
|
|
174
14
|
}
|
|
175
|
-
function resolvePreviewPlaceholderData({
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
return process.env.NODE_ENV === "development" ? placeholderData : null;
|
|
188
|
-
}
|
|
189
|
-
return window.parent === window ? null : placeholderData;
|
|
15
|
+
function resolvePreviewPlaceholderData(_args) {
|
|
16
|
+
throw canopyTombstoneError({
|
|
17
|
+
symbol: "resolvePreviewPlaceholderData",
|
|
18
|
+
subpath: "loaders/preview-placeholder",
|
|
19
|
+
replacement: {
|
|
20
|
+
kind: "internal",
|
|
21
|
+
nearestPublicSubpaths: [
|
|
22
|
+
"loaders/product-loader",
|
|
23
|
+
"loaders/prefetch-loaders"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
});
|
|
190
27
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
28
|
+
function isPreviewPlaceholderData(_data) {
|
|
29
|
+
throw canopyTombstoneError({
|
|
30
|
+
symbol: "isPreviewPlaceholderData",
|
|
31
|
+
subpath: "loaders/preview-placeholder",
|
|
32
|
+
replacement: {
|
|
33
|
+
kind: "internal",
|
|
34
|
+
nearestPublicSubpaths: [
|
|
35
|
+
"loaders/product-loader",
|
|
36
|
+
"loaders/prefetch-loaders"
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
});
|
|
202
40
|
}
|
|
203
|
-
function useReportPreviewPlaceholderRender(
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
"
|
|
212
|
-
|
|
41
|
+
function useReportPreviewPlaceholderRender(_data) {
|
|
42
|
+
throw canopyTombstoneError({
|
|
43
|
+
symbol: "useReportPreviewPlaceholderRender",
|
|
44
|
+
subpath: "loaders/preview-placeholder",
|
|
45
|
+
replacement: {
|
|
46
|
+
kind: "internal",
|
|
47
|
+
nearestPublicSubpaths: [
|
|
48
|
+
"loaders/product-loader",
|
|
49
|
+
"loaders/prefetch-loaders"
|
|
50
|
+
]
|
|
213
51
|
}
|
|
214
|
-
}
|
|
52
|
+
});
|
|
215
53
|
}
|
|
216
54
|
export {
|
|
217
55
|
hasUnfilledRouteParam,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../loaders/preview-placeholder.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Sample-data substitution for previewing dynamic routes inside the editor.\n *\n * When the editor previews an unfilled Next.js dynamic route (the literal\n * `/products/[handle]` URL), the page receives the bracket token itself as its\n * param, every lookup misses, and the preview 404s. Loader invocations detect\n * that exact case \u2014 editor iframe + a bracket-token arg \u2014 and substitute a\n * type-correct sample fixture so the page renders its real layout with sample\n * data. A `replo:preview:placeholder-render` message tells the embedding\n * editor the preview is showing sample data (mirrors `replo:preview:status`\n * from NextErrorReporter).\n *\n * Substitution is gated to editor iframes only: production traffic to a\n * bracket URL still misses lookups and 404s, so this can never soft-404 a\n * published site.\n */\nimport type {\n FullCollection,\n FullProduct,\n PaginatedProducts,\n} from \"./loader-schemas\";\n\nimport { useEffect } from \"react\";\n\nimport { z } from \"zod\";\n\nimport { DATA_LOADER_KEYS } from \"./loader-keys\";\n\nconst PLACEHOLDER_RENDER_MESSAGE_TYPE = \"replo:preview:placeholder-render\";\n\n// Matches a literal Next.js dynamic segment passed through as a param value:\n// `[handle]`, `[...slug]`, or `[[...slug]]`.\nconst UNFILLED_ROUTE_PARAM_RE = /^\\[{1,2}(?:\\.\\.\\.)?[^\\]]+\\]{1,2}$/;\n\n// Every fixture id carries this prefix so substituted data is recognizable\n// after it round-trips through SSR + React Query hydration (where the client\n// never re-invokes the loader and can't observe the substitution directly).\nconst SAMPLE_ID_PREFIX = \"replo-sample-\";\n\n// The sample option matrix. Sizes carry the price so switching variants\n// visibly updates pricing; colors carry swatches so pickers render them.\nconst SAMPLE_SIZES = [\n { value: \"Small\", priceAmount: \"42.00\" },\n { value: \"Medium\", priceAmount: \"46.00\" },\n { value: \"Large\", priceAmount: \"50.00\" },\n];\nconst SAMPLE_COLORS = [\n { value: \"Slate\", swatchColor: \"#64748b\" },\n { value: \"Sand\", swatchColor: \"#d6bc8a\" },\n];\n// One sold-out combination so disabled buttons / \"Sold out\" states render.\nconst SOLD_OUT_COMBINATION = { size: \"Large\", color: \"Sand\" };\n\nfunction toSampleSlug(value: string): string {\n return value.toLowerCase().replace(/\\s+/g, \"-\");\n}\n\n// Generated as the full size x color cartesian product: agent-built pages\n// match every selected-options combination to a variant, and a combination\n// with no variant breaks their pickers mid-interaction.\nconst SAMPLE_VARIANTS: FullProduct[\"variants\"] = SAMPLE_SIZES.flatMap(\n (size) => {\n return SAMPLE_COLORS.map((color) => {\n const isSoldOut =\n size.value === SOLD_OUT_COMBINATION.size &&\n color.value === SOLD_OUT_COMBINATION.color;\n const slug = `${toSampleSlug(size.value)}-${toSampleSlug(color.value)}`;\n return {\n id: `replo-sample-variant-${slug}`,\n title: `${size.value} / ${color.value}`,\n availableForSale: !isSoldOut,\n sku: `REPLO-SAMPLE-${slug.toUpperCase()}`,\n selectedOptions: [\n { name: \"Size\", value: size.value },\n { name: \"Color\", value: color.value },\n ],\n image: null,\n price: { amount: size.priceAmount, currencyCode: \"USD\" },\n // Every variant is \"on sale\" so strikethrough pricing renders.\n compareAtPrice: { amount: \"56.00\", currencyCode: \"USD\" },\n sellingPlanIds: [],\n };\n });\n },\n);\n\nconst SAMPLE_PRODUCT: FullProduct = {\n id: \"replo-sample-product\",\n handle: \"sample-product\",\n title: \"Sample product\",\n description:\n \"This is sample product data for previewing this page. Open the page from a real product link to see live details. Sizes, colors, sale pricing, and a sold-out variant are included so every part of the layout has something to show.\",\n descriptionHtml:\n \"<p>This is sample product data for previewing this page. Open the page from a real product link to see live details.</p><p>The sample includes:</p><ul><li>Three sizes and two colors to try the option pickers</li><li>Sale pricing with a compare-at price</li><li>One sold-out combination (Large / Sand)</li></ul>\",\n availableForSale: true,\n featuredImage: null,\n // `id` is optional in the schema but always present on real data, and\n // generated pages key option lists on it \u2014 omit it and previews log React\n // \"missing key\" console errors, which the dev overlay counts as page errors.\n options: [\n {\n id: \"replo-sample-option-size\",\n name: \"Size\",\n values: SAMPLE_SIZES.map((size) => size.value),\n optionValues: SAMPLE_SIZES.map((size) => ({\n id: `replo-sample-option-value-${toSampleSlug(size.value)}`,\n value: size.value,\n swatch: null,\n })),\n },\n {\n id: \"replo-sample-option-color\",\n name: \"Color\",\n values: SAMPLE_COLORS.map((color) => color.value),\n optionValues: SAMPLE_COLORS.map((color) => ({\n id: `replo-sample-option-value-${toSampleSlug(color.value)}`,\n value: color.value,\n swatch: { color: color.swatchColor, imageUrl: null },\n })),\n },\n ],\n variants: SAMPLE_VARIANTS,\n images: [],\n media: [],\n vendor: \"Sample Supply Co.\",\n productType: \"Sample\",\n tags: [\"sample-data\", \"new-arrival\", \"bestseller\"],\n sellingPlanGroups: [],\n metafields: [],\n};\n\nconst SAMPLE_COLLECTION: FullCollection = {\n id: \"replo-sample-collection\",\n handle: \"sample-collection\",\n title: \"Sample collection\",\n descriptionHtml:\n \"<p>This is sample collection data for previewing this page.</p>\",\n image: null,\n};\n\n// Three grid cards, each exercising a distinct card state: a price range, a\n// compare-at sale (grids gate strikethroughs on `amount > 0`, per the loader\n// contract where \"0.0\" means no discount), and a sold-out product.\nconst SAMPLE_GRID_CARDS = [\n {\n slug: \"range\",\n title: \"Sample product with a price range\",\n minAmount: \"42.00\",\n maxAmount: \"50.00\",\n compareAtAmount: \"0.0\",\n availableForSale: true,\n },\n {\n slug: \"sale\",\n title: \"Sample product on sale\",\n minAmount: \"42.00\",\n maxAmount: \"42.00\",\n compareAtAmount: \"56.00\",\n availableForSale: true,\n },\n {\n slug: \"sold-out\",\n title: \"Sample product that sold out\",\n minAmount: \"46.00\",\n maxAmount: \"46.00\",\n compareAtAmount: \"0.0\",\n availableForSale: false,\n },\n];\n\nconst SAMPLE_PAGINATED_PRODUCTS: PaginatedProducts = {\n products: SAMPLE_GRID_CARDS.map((card) => ({\n id: `replo-sample-product-${card.slug}`,\n handle: `sample-product-${card.slug}`,\n title: card.title,\n availableForSale: card.availableForSale,\n featuredImage: null,\n options: [\n {\n id: `replo-sample-option-color-${card.slug}`,\n name: \"Color\",\n values: SAMPLE_COLORS.map((color) => color.value),\n optionValues: SAMPLE_COLORS.map((color) => ({\n id: `replo-sample-option-value-${card.slug}-${toSampleSlug(color.value)}`,\n value: color.value,\n swatch: { color: color.swatchColor, imageUrl: null },\n })),\n },\n ],\n variants: SAMPLE_COLORS.map((color) => ({\n id: `replo-sample-variant-${card.slug}-${toSampleSlug(color.value)}`,\n title: color.value,\n availableForSale: card.availableForSale,\n sku: `REPLO-SAMPLE-${card.slug.toUpperCase()}-${toSampleSlug(color.value).toUpperCase()}`,\n selectedOptions: [{ name: \"Color\", value: color.value }],\n image: null,\n price: { amount: card.minAmount, currencyCode: \"USD\" },\n compareAtPrice:\n Number(card.compareAtAmount) > 0\n ? { amount: card.compareAtAmount, currencyCode: \"USD\" }\n : null,\n })),\n minPrice: { amount: card.minAmount, currencyCode: \"USD\" },\n maxPrice: { amount: card.maxAmount, currencyCode: \"USD\" },\n compareAtMinPrice: { amount: card.compareAtAmount, currencyCode: \"USD\" },\n compareAtMaxPrice: { amount: card.compareAtAmount, currencyCode: \"USD\" },\n })),\n pageInfo: { hasNextPage: false, endCursor: null },\n};\n\nconst PLACEHOLDER_DATA_BY_LOADER_KEY: Record<string, unknown> = {\n [DATA_LOADER_KEYS.SHOPIFY_PRODUCT]: SAMPLE_PRODUCT,\n [DATA_LOADER_KEYS.REPLO_PRODUCT]: SAMPLE_PRODUCT,\n [DATA_LOADER_KEYS.SHOPIFY_COLLECTION]: SAMPLE_COLLECTION,\n [DATA_LOADER_KEYS.SHOPIFY_COLLECTION_PRODUCTS]: SAMPLE_PAGINATED_PRODUCTS,\n};\n\nfunction isUnfilledRouteParamValue(value: string): boolean {\n if (UNFILLED_ROUTE_PARAM_RE.test(value)) {\n return true;\n }\n // Next.js hands params over URL-encoded, so the literal `[handle]` segment\n // arrives as `%5Bhandle%5D`.\n try {\n return UNFILLED_ROUTE_PARAM_RE.test(decodeURIComponent(value));\n } catch {\n return false;\n }\n}\n\nexport function hasUnfilledRouteParam(args: Record<string, unknown>): boolean {\n return Object.values(args).some(\n (value) => typeof value === \"string\" && isUnfilledRouteParamValue(value),\n );\n}\n\n/**\n * Sample data for a loader invoked with an unfilled dynamic-route param, or\n * null when the invocation should proceed normally.\n *\n * On the server, substitution happens only on dev servers (`next dev` \u2014 how\n * every sandbox preview runs); production builds keep fetching so bracket\n * URLs keep their real miss/404 semantics. Substituting during SSR keeps the\n * doomed fetch from erroring the dev overlay mid-stream. In the browser,\n * substitution happens only inside an editor iframe.\n */\nexport function resolvePreviewPlaceholderData({\n loaderKey,\n args,\n}: {\n loaderKey: string;\n args: Record<string, unknown>;\n}): unknown {\n if (!hasUnfilledRouteParam(args)) {\n return null;\n }\n const placeholderData = PLACEHOLDER_DATA_BY_LOADER_KEY[loaderKey];\n if (placeholderData === undefined) {\n return null;\n }\n if (typeof window === \"undefined\") {\n return process.env.NODE_ENV === \"development\" ? placeholderData : null;\n }\n return window.parent === window ? null : placeholderData;\n}\n\nconst placeholderIdSchema = z.object({ id: z.string() });\nconst placeholderProductsSchema = z.object({\n products: z.array(z.object({ id: z.string() })).min(1),\n});\n\n/** Whether loader output is one of this module's sample fixtures. */\nexport function isPreviewPlaceholderData(data: unknown): boolean {\n const withId = placeholderIdSchema.safeParse(data);\n if (withId.success) {\n return withId.data.id.startsWith(SAMPLE_ID_PREFIX);\n }\n const withProducts = placeholderProductsSchema.safeParse(data);\n return (\n withProducts.success &&\n (withProducts.data.products[0]?.id.startsWith(SAMPLE_ID_PREFIX) ?? false)\n );\n}\n\n/**\n * Notify the embedding editor when a loader component rendered sample data.\n * The single reporting path: inspecting rendered data (rather than hooking\n * loader invocation) covers client fetches and SSR-hydrated data alike \u2014\n * hydration never re-invokes the loader on the client. Receivers treat the\n * message as idempotent, so no dedupe is needed.\n */\nexport function useReportPreviewPlaceholderRender(data: unknown) {\n // eslint-disable-next-line replo/no-use-effect -- Posts to the embedding editor window, an external system.\n useEffect(() => {\n if (window.parent !== window && isPreviewPlaceholderData(data)) {\n window.parent.postMessage(\n {\n type: PLACEHOLDER_RENDER_MESSAGE_TYPE,\n route: window.location.pathname,\n },\n \"*\",\n );\n }\n }, [data]);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/* oxlint-disable replo/no-void-return-type -- Tombstone declarations preserve exact return types for consumer compatibility. */\nimport { canopyTombstoneError } from \"../lib/tombstone\";\n\n/** @deprecated Use a supported public @replohq/sdk API for this domain; hasUnfilledRouteParam has no direct replacement. */\nexport function hasUnfilledRouteParam(_args: Record<string, unknown>): boolean {\n throw canopyTombstoneError({\n symbol: \"hasUnfilledRouteParam\",\n subpath: \"loaders/preview-placeholder\",\n replacement: {\n kind: \"internal\",\n nearestPublicSubpaths: [\n \"loaders/product-loader\",\n \"loaders/prefetch-loaders\",\n ],\n },\n });\n}\n\n/** @deprecated Use a supported public @replohq/sdk API for this domain; resolvePreviewPlaceholderData has no direct replacement. */\nexport function resolvePreviewPlaceholderData(_args: {\n loaderKey: string;\n args: Record<string, unknown>;\n}): unknown {\n throw canopyTombstoneError({\n symbol: \"resolvePreviewPlaceholderData\",\n subpath: \"loaders/preview-placeholder\",\n replacement: {\n kind: \"internal\",\n nearestPublicSubpaths: [\n \"loaders/product-loader\",\n \"loaders/prefetch-loaders\",\n ],\n },\n });\n}\n\n/** @deprecated Use a supported public @replohq/sdk API for this domain; isPreviewPlaceholderData has no direct replacement. */\nexport function isPreviewPlaceholderData(_data: unknown): boolean {\n throw canopyTombstoneError({\n symbol: \"isPreviewPlaceholderData\",\n subpath: \"loaders/preview-placeholder\",\n replacement: {\n kind: \"internal\",\n nearestPublicSubpaths: [\n \"loaders/product-loader\",\n \"loaders/prefetch-loaders\",\n ],\n },\n });\n}\n\n/** @deprecated Use a supported public @replohq/sdk API for this domain; useReportPreviewPlaceholderRender has no direct replacement. */\nexport function useReportPreviewPlaceholderRender(_data: unknown): void {\n throw canopyTombstoneError({\n symbol: \"useReportPreviewPlaceholderRender\",\n subpath: \"loaders/preview-placeholder\",\n replacement: {\n kind: \"internal\",\n nearestPublicSubpaths: [\n \"loaders/product-loader\",\n \"loaders/prefetch-loaders\",\n ],\n },\n });\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,4BAA4B;AAG9B,SAAS,sBAAsB,OAAyC;AAC7E,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa;AAAA,MACX,MAAM;AAAA,MACN,uBAAuB;AAAA,QACrB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAGO,SAAS,8BAA8B,OAGlC;AACV,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa;AAAA,MACX,MAAM;AAAA,MACN,uBAAuB;AAAA,QACrB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAGO,SAAS,yBAAyB,OAAyB;AAChE,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa;AAAA,MACX,MAAM;AAAA,MACN,uBAAuB;AAAA,QACrB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAGO,SAAS,kCAAkC,OAAsB;AACtE,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa;AAAA,MACX,MAAM;AAAA,MACN,uBAAuB;AAAA,QACrB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -8,14 +8,5 @@ export type ProductLoaderArgs = {
|
|
|
8
8
|
productMetafieldIdentifiers?: MetafieldIdentifier[];
|
|
9
9
|
variantMetafieldIdentifiers?: MetafieldIdentifier[];
|
|
10
10
|
};
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
* payload. They must stay identical: `PrefetchedLoaders` seeds the cache under
|
|
14
|
-
* `[loaderKey, args]`, so an arg sent to the loader but missing from the key
|
|
15
|
-
* (or vice versa) silently misses the prefetch — the client refetches without
|
|
16
|
-
* it and the page renders incomplete data instead of erroring.
|
|
17
|
-
*
|
|
18
|
-
* Keys left `undefined` drop out of React Query's key hash, so omitting a field
|
|
19
|
-
* here hashes the same as a prefetch that never passed it.
|
|
20
|
-
*/
|
|
21
|
-
export declare function buildProductLoaderArgs({ handle, productId, productMetafieldIdentifiers, variantMetafieldIdentifiers, }: ProductLoaderArgs): ProductLoaderArgs;
|
|
11
|
+
/** @deprecated Use buildProductLoaderArgs from @replohq/sdk/loaders/product-loader-args. */
|
|
12
|
+
export declare function buildProductLoaderArgs(_args: ProductLoaderArgs): ProductLoaderArgs;
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
})
|
|
7
|
-
return {
|
|
8
|
-
handle,
|
|
9
|
-
productId,
|
|
10
|
-
productMetafieldIdentifiers,
|
|
11
|
-
variantMetafieldIdentifiers
|
|
12
|
-
};
|
|
1
|
+
import { canopyTombstoneError } from "../lib/tombstone";
|
|
2
|
+
function buildProductLoaderArgs(_args) {
|
|
3
|
+
throw canopyTombstoneError({
|
|
4
|
+
symbol: "buildProductLoaderArgs",
|
|
5
|
+
subpath: "loaders/product-loader-args"
|
|
6
|
+
});
|
|
13
7
|
}
|
|
14
8
|
export {
|
|
15
9
|
buildProductLoaderArgs
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../loaders/product-loader-args.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { canopyTombstoneError } from \"../lib/tombstone\";\n\nexport type MetafieldIdentifier = {\n namespace: string;\n key: string;\n};\n\nexport type ProductLoaderArgs = {\n handle?: string;\n productId?: string;\n productMetafieldIdentifiers?: MetafieldIdentifier[];\n variantMetafieldIdentifiers?: MetafieldIdentifier[];\n};\n\n/** @deprecated Use buildProductLoaderArgs from @replohq/sdk/loaders/product-loader-args. */\nexport function buildProductLoaderArgs(\n _args: ProductLoaderArgs,\n): ProductLoaderArgs {\n throw canopyTombstoneError({\n symbol: \"buildProductLoaderArgs\",\n subpath: \"loaders/product-loader-args\",\n });\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,4BAA4B;AAe9B,SAAS,uBACd,OACmB;AACnB,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,EACX,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
1
|
+
import type { ReactElement, ReactNode } from "react";
|
|
2
2
|
import type { FullProduct } from "./loader-schemas";
|
|
3
3
|
import type { ProductLoaderArgs } from "./product-loader-args";
|
|
4
4
|
type ProductLoaderProps = ProductLoaderArgs & {
|
|
@@ -6,5 +6,6 @@ type ProductLoaderProps = ProductLoaderArgs & {
|
|
|
6
6
|
children: (data: FullProduct) => ReactNode;
|
|
7
7
|
fallback?: ReactNode;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
/** @deprecated Use ProductLoader from @replohq/sdk/loaders/product-loader. */
|
|
10
|
+
export declare function ProductLoader(_props: ProductLoaderProps): ReactElement;
|
|
10
11
|
export {};
|
|
@@ -1,50 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { fullProductSchema } from "./loader-schemas";
|
|
8
|
-
import { useReportPreviewPlaceholderRender } from "./preview-placeholder";
|
|
9
|
-
import { buildProductLoaderArgs } from "./product-loader-args";
|
|
10
|
-
function ProductLoaderInner({
|
|
11
|
-
loaderKey,
|
|
12
|
-
args,
|
|
13
|
-
children
|
|
14
|
-
}) {
|
|
15
|
-
const queryResult = useSuspenseQuery({
|
|
16
|
-
queryKey: [loaderKey, args],
|
|
17
|
-
queryFn: async () => {
|
|
18
|
-
const loadedData = await invokeLoader({ loaderKey, args });
|
|
19
|
-
return fullProductSchema.parse(loadedData);
|
|
20
|
-
}
|
|
2
|
+
import { canopyTombstoneError } from "../lib/tombstone";
|
|
3
|
+
function ProductLoader(_props) {
|
|
4
|
+
throw canopyTombstoneError({
|
|
5
|
+
symbol: "ProductLoader",
|
|
6
|
+
subpath: "loaders/product-loader"
|
|
21
7
|
});
|
|
22
|
-
useReportPreviewPlaceholderRender(queryResult.data);
|
|
23
|
-
return /* @__PURE__ */ jsx(Fragment, { children: children(queryResult.data) });
|
|
24
|
-
}
|
|
25
|
-
function ProductLoader({
|
|
26
|
-
loaderKey,
|
|
27
|
-
handle,
|
|
28
|
-
productId,
|
|
29
|
-
productMetafieldIdentifiers,
|
|
30
|
-
variantMetafieldIdentifiers,
|
|
31
|
-
children,
|
|
32
|
-
fallback
|
|
33
|
-
}) {
|
|
34
|
-
const args = buildProductLoaderArgs({
|
|
35
|
-
handle,
|
|
36
|
-
productId,
|
|
37
|
-
productMetafieldIdentifiers,
|
|
38
|
-
variantMetafieldIdentifiers
|
|
39
|
-
});
|
|
40
|
-
return /* @__PURE__ */ jsx(
|
|
41
|
-
LoaderErrorBoundary,
|
|
42
|
-
{
|
|
43
|
-
fallback: fallback ?? null,
|
|
44
|
-
resetKey: `${loaderKey}:${JSON.stringify(args)}`,
|
|
45
|
-
children: /* @__PURE__ */ jsx(Suspense, { fallback: fallback ?? null, children: /* @__PURE__ */ jsx(ProductLoaderInner, { loaderKey, args, children }) })
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
8
|
}
|
|
49
9
|
export {
|
|
50
10
|
ProductLoader
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../loaders/product-loader.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport type { FullProduct } from \"./loader-schemas\";\nimport type { ProductLoaderArgs } from \"./product-loader-args\";\n\nimport {
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["\"use client\";\n\nimport type { ReactElement, ReactNode } from \"react\";\nimport type { FullProduct } from \"./loader-schemas\";\nimport type { ProductLoaderArgs } from \"./product-loader-args\";\n\nimport { canopyTombstoneError } from \"../lib/tombstone\";\n\ntype ProductLoaderProps = ProductLoaderArgs & {\n loaderKey: string;\n children: (data: FullProduct) => ReactNode;\n fallback?: ReactNode;\n};\n\n/** @deprecated Use ProductLoader from @replohq/sdk/loaders/product-loader. */\nexport function ProductLoader(_props: ProductLoaderProps): ReactElement {\n throw canopyTombstoneError({\n symbol: \"ProductLoader\",\n subpath: \"loaders/product-loader\",\n });\n}\n"],
|
|
5
|
+
"mappings": ";AAMA,SAAS,4BAA4B;AAS9B,SAAS,cAAc,QAA0C;AACtE,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,EACX,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|