@replohq/canopy-sdk 2.6.0 → 3.0.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/_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/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 +4 -4
- package/_vendor/schemas/selectModeIframeRpc.mjs +1 -0
- 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
package/consent/cookie.js
CHANGED
|
@@ -1,74 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { z } from "zod";
|
|
1
|
+
import { canopyTombstoneError, canopyTombstoneObject } from "../lib/tombstone";
|
|
3
2
|
const CONSENT_COOKIE_NAME = "replo_consent";
|
|
4
3
|
const CONSENT_COOKIE_VERSION = 1;
|
|
5
4
|
const CONSENT_COOKIE_MAX_AGE_SECONDS = 60 * 60 * 24 * 180;
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
marketing: z.boolean(),
|
|
13
|
-
preferences: z.boolean(),
|
|
14
|
-
sale_of_data: z.boolean()
|
|
15
|
-
})
|
|
16
|
-
});
|
|
17
|
-
const DENIED_CATEGORIES = {
|
|
18
|
-
necessary: true,
|
|
19
|
-
analytics: false,
|
|
20
|
-
marketing: false,
|
|
21
|
-
preferences: false,
|
|
22
|
-
sale_of_data: false
|
|
23
|
-
};
|
|
24
|
-
const GRANTED_CATEGORIES = {
|
|
25
|
-
necessary: true,
|
|
26
|
-
analytics: true,
|
|
27
|
-
marketing: true,
|
|
28
|
-
preferences: true,
|
|
29
|
-
sale_of_data: true
|
|
30
|
-
};
|
|
31
|
-
function parseConsentCookie(rawCookie) {
|
|
32
|
-
if (!rawCookie) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
const match = rawCookie.split("; ").find((entry) => entry.startsWith(`${CONSENT_COOKIE_NAME}=`));
|
|
36
|
-
const encoded = match ? match.slice(CONSENT_COOKIE_NAME.length + 1) : rawCookie;
|
|
37
|
-
let decoded;
|
|
38
|
-
try {
|
|
39
|
-
decoded = decodeURIComponent(encoded);
|
|
40
|
-
} catch {
|
|
41
|
-
return null;
|
|
5
|
+
const DENIED_CATEGORIES = canopyTombstoneObject({
|
|
6
|
+
symbol: "DENIED_CATEGORIES",
|
|
7
|
+
subpath: "consent/cookie",
|
|
8
|
+
replacement: {
|
|
9
|
+
kind: "internal",
|
|
10
|
+
nearestPublicSubpaths: ["consent/consent-store", "consent/replo-scripts"]
|
|
42
11
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
12
|
+
});
|
|
13
|
+
const GRANTED_CATEGORIES = canopyTombstoneObject({
|
|
14
|
+
symbol: "GRANTED_CATEGORIES",
|
|
15
|
+
subpath: "consent/cookie",
|
|
16
|
+
replacement: {
|
|
17
|
+
kind: "internal",
|
|
18
|
+
nearestPublicSubpaths: ["consent/consent-store", "consent/replo-scripts"]
|
|
46
19
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
20
|
+
});
|
|
21
|
+
function parseConsentCookie(_rawCookie) {
|
|
22
|
+
throw canopyTombstoneError({
|
|
23
|
+
symbol: "parseConsentCookie",
|
|
24
|
+
subpath: "consent/cookie",
|
|
25
|
+
replacement: {
|
|
26
|
+
kind: "internal",
|
|
27
|
+
nearestPublicSubpaths: ["consent/consent-store", "consent/replo-scripts"]
|
|
28
|
+
}
|
|
29
|
+
});
|
|
54
30
|
}
|
|
55
|
-
function serializeConsentCookieValue({
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
decidedAt,
|
|
63
|
-
consentId,
|
|
64
|
-
categories: {
|
|
65
|
-
analytics: categories.analytics,
|
|
66
|
-
marketing: categories.marketing,
|
|
67
|
-
preferences: categories.preferences,
|
|
68
|
-
sale_of_data: categories.sale_of_data
|
|
31
|
+
function serializeConsentCookieValue(_args) {
|
|
32
|
+
throw canopyTombstoneError({
|
|
33
|
+
symbol: "serializeConsentCookieValue",
|
|
34
|
+
subpath: "consent/cookie",
|
|
35
|
+
replacement: {
|
|
36
|
+
kind: "internal",
|
|
37
|
+
nearestPublicSubpaths: ["consent/consent-store", "consent/replo-scripts"]
|
|
69
38
|
}
|
|
70
|
-
};
|
|
71
|
-
return encodeURIComponent(JSON.stringify(payload));
|
|
39
|
+
});
|
|
72
40
|
}
|
|
73
41
|
export {
|
|
74
42
|
CONSENT_COOKIE_MAX_AGE_SECONDS,
|
package/consent/cookie.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../consent/cookie.ts"],
|
|
4
|
-
"sourcesContent": ["import type { ConsentCategory } from \"schemas/generated/consent\";\n\nimport {
|
|
5
|
-
"mappings": "AAEA,SAAS,
|
|
4
|
+
"sourcesContent": ["import type { ConsentCategory } from \"schemas/generated/consent\";\n\nimport { canopyTombstoneError, canopyTombstoneObject } from \"../lib/tombstone\";\n\n/** @deprecated Use a supported public @replohq/sdk API for this domain; CONSENT_COOKIE_NAME remains only for primitive compatibility. */\nexport const CONSENT_COOKIE_NAME = \"replo_consent\";\n\n/** @deprecated Use a supported public @replohq/sdk API for this domain; CONSENT_COOKIE_VERSION remains only for primitive compatibility. */\nexport const CONSENT_COOKIE_VERSION = 1;\n\n/** @deprecated Use a supported public @replohq/sdk API for this domain; CONSENT_COOKIE_MAX_AGE_SECONDS remains only for primitive compatibility. */\nexport const CONSENT_COOKIE_MAX_AGE_SECONDS = 60 * 60 * 24 * 180;\n\nexport type ConsentCategories = Record<ConsentCategory, boolean>;\n\n/** Persisted cookie payload. `necessary` is always granted and never stored. */\nexport interface ConsentCookiePayload {\n version: number;\n decidedAt: number;\n /** Persistent pseudonymous per-browser id; absent on pre-id (legacy) cookies. */\n consentId?: string;\n categories: {\n analytics: boolean;\n marketing: boolean;\n preferences: boolean;\n sale_of_data: boolean;\n };\n}\n\n/** @deprecated Use a supported public @replohq/sdk API for this domain; DENIED_CATEGORIES has no direct replacement. */\nexport const DENIED_CATEGORIES: ConsentCategories =\n canopyTombstoneObject<ConsentCategories>({\n symbol: \"DENIED_CATEGORIES\",\n subpath: \"consent/cookie\",\n replacement: {\n kind: \"internal\",\n nearestPublicSubpaths: [\"consent/consent-store\", \"consent/replo-scripts\"],\n },\n });\n\n/** @deprecated Use a supported public @replohq/sdk API for this domain; GRANTED_CATEGORIES has no direct replacement. */\nexport const GRANTED_CATEGORIES: ConsentCategories =\n canopyTombstoneObject<ConsentCategories>({\n symbol: \"GRANTED_CATEGORIES\",\n subpath: \"consent/cookie\",\n replacement: {\n kind: \"internal\",\n nearestPublicSubpaths: [\"consent/consent-store\", \"consent/replo-scripts\"],\n },\n });\n\n/** @deprecated Use a supported public @replohq/sdk API for this domain; parseConsentCookie has no direct replacement. */\nexport function parseConsentCookie(\n _rawCookie: string | undefined,\n): ConsentCookiePayload | null {\n throw canopyTombstoneError({\n symbol: \"parseConsentCookie\",\n subpath: \"consent/cookie\",\n replacement: {\n kind: \"internal\",\n nearestPublicSubpaths: [\"consent/consent-store\", \"consent/replo-scripts\"],\n },\n });\n}\n\n/** @deprecated Use a supported public @replohq/sdk API for this domain; serializeConsentCookieValue has no direct replacement. */\nexport function serializeConsentCookieValue(_args: {\n categories: ConsentCategories;\n decidedAt: number;\n consentId?: string;\n}): string {\n throw canopyTombstoneError({\n symbol: \"serializeConsentCookieValue\",\n subpath: \"consent/cookie\",\n replacement: {\n kind: \"internal\",\n nearestPublicSubpaths: [\"consent/consent-store\", \"consent/replo-scripts\"],\n },\n });\n}\n"],
|
|
5
|
+
"mappings": "AAEA,SAAS,sBAAsB,6BAA6B;AAGrD,MAAM,sBAAsB;AAG5B,MAAM,yBAAyB;AAG/B,MAAM,iCAAiC,KAAK,KAAK,KAAK;AAmBtD,MAAM,oBACX,sBAAyC;AAAA,EACvC,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,aAAa;AAAA,IACX,MAAM;AAAA,IACN,uBAAuB,CAAC,yBAAyB,uBAAuB;AAAA,EAC1E;AACF,CAAC;AAGI,MAAM,qBACX,sBAAyC;AAAA,EACvC,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,aAAa;AAAA,IACX,MAAM;AAAA,IACN,uBAAuB,CAAC,yBAAyB,uBAAuB;AAAA,EAC1E;AACF,CAAC;AAGI,SAAS,mBACd,YAC6B;AAC7B,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa;AAAA,MACX,MAAM;AAAA,MACN,uBAAuB,CAAC,yBAAyB,uBAAuB;AAAA,IAC1E;AAAA,EACF,CAAC;AACH;AAGO,SAAS,4BAA4B,OAIjC;AACT,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa;AAAA,MACX,MAAM;AAAA,MACN,uBAAuB,CAAC,yBAAyB,uBAAuB;AAAA,IAC1E;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,23 +1,10 @@
|
|
|
1
1
|
import type { ReploScriptEntry, ScriptTagDescriptor } from "../_vendor/schemas/generated/consent";
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
* consent allows it. Reused both for author-managed `ReploScripts` entries and
|
|
5
|
-
* for the implicit Replo first-party pixel.
|
|
6
|
-
*
|
|
7
|
-
* DOM insertion (not JSX) is required because inline `<script>` bodies set via
|
|
8
|
-
* React's `dangerouslySetInnerHTML` never execute. Each node is tagged with
|
|
9
|
-
* `data-replo-script-id` (plus a per-tag index) so re-renders and React Strict
|
|
10
|
-
* Mode double-invokes do not double-inject.
|
|
11
|
-
*/
|
|
12
|
-
export declare function InjectedScript({ baseId, descriptors, }: {
|
|
2
|
+
/** @deprecated Use InjectedScript from @replohq/sdk/consent/replo-scripts. */
|
|
3
|
+
export declare function InjectedScript(_props: {
|
|
13
4
|
baseId: string;
|
|
14
5
|
descriptors: ScriptTagDescriptor[];
|
|
15
6
|
}): null;
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
* Authored once in `app/layout.tsx`; the agent/miniapp only edit the `scripts`
|
|
19
|
-
* array. Each entry registers itself and is gated + injected per consent.
|
|
20
|
-
*/
|
|
21
|
-
export declare function ReploScripts({ scripts }: {
|
|
7
|
+
/** @deprecated Use ReploScripts from @replohq/sdk/consent/replo-scripts. */
|
|
8
|
+
export declare function ReploScripts(_props: {
|
|
22
9
|
scripts: ReploScriptEntry[];
|
|
23
|
-
}):
|
|
10
|
+
}): React.ReactElement;
|
package/consent/replo-scripts.js
CHANGED
|
@@ -1,99 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function scriptId(entry) {
|
|
9
|
-
if (entry.type === "custom") {
|
|
10
|
-
return `custom:${entry.id}`;
|
|
11
|
-
}
|
|
12
|
-
if (entry.type === "snippet") {
|
|
13
|
-
return `snippet:${entry.id}`;
|
|
14
|
-
}
|
|
15
|
-
return `${entry.type}:${entry.identifier}`;
|
|
2
|
+
import { canopyTombstoneError } from "../lib/tombstone";
|
|
3
|
+
function InjectedScript(_props) {
|
|
4
|
+
throw canopyTombstoneError({
|
|
5
|
+
symbol: "InjectedScript",
|
|
6
|
+
subpath: "consent/replo-scripts"
|
|
7
|
+
});
|
|
16
8
|
}
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
function descriptorsFor(entry) {
|
|
24
|
-
if (entry.type === "custom") {
|
|
25
|
-
if (entry.src) {
|
|
26
|
-
return [{ kind: "external", src: entry.src }];
|
|
27
|
-
}
|
|
28
|
-
if (entry.body) {
|
|
29
|
-
return [{ kind: "inline", body: entry.body }];
|
|
30
|
-
}
|
|
31
|
-
return [];
|
|
32
|
-
}
|
|
33
|
-
if (entry.type === "snippet") {
|
|
34
|
-
return [{ kind: "inline", body: entry.body }];
|
|
35
|
-
}
|
|
36
|
-
return buildScriptTags({ type: entry.type, identifier: entry.identifier });
|
|
37
|
-
}
|
|
38
|
-
function InjectedScript({
|
|
39
|
-
baseId,
|
|
40
|
-
descriptors
|
|
41
|
-
}) {
|
|
42
|
-
const injectionKey = `${baseId}|${JSON.stringify(descriptors)}`;
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
if (typeof document === "undefined") {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const createdNodes = [];
|
|
48
|
-
descriptors.forEach((descriptor, index) => {
|
|
49
|
-
const nodeId = `${baseId}#${index}`;
|
|
50
|
-
const existing = document.querySelector(
|
|
51
|
-
`script[data-replo-script-id="${nodeId}"]`
|
|
52
|
-
);
|
|
53
|
-
if (existing) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const scriptElement = document.createElement("script");
|
|
57
|
-
scriptElement.dataset.reploScriptId = nodeId;
|
|
58
|
-
if (descriptor.kind === "external") {
|
|
59
|
-
scriptElement.src = descriptor.src;
|
|
60
|
-
scriptElement.async = true;
|
|
61
|
-
for (const [attributeName, attributeValue] of Object.entries(
|
|
62
|
-
descriptor.attributes ?? {}
|
|
63
|
-
)) {
|
|
64
|
-
scriptElement.setAttribute(attributeName, attributeValue);
|
|
65
|
-
}
|
|
66
|
-
} else {
|
|
67
|
-
scriptElement.textContent = descriptor.body;
|
|
68
|
-
}
|
|
69
|
-
document.head.append(scriptElement);
|
|
70
|
-
createdNodes.push(scriptElement);
|
|
71
|
-
});
|
|
72
|
-
return () => {
|
|
73
|
-
for (const node of createdNodes) {
|
|
74
|
-
node.remove();
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
}, [injectionKey]);
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
function ManagedScript({ entry }) {
|
|
81
|
-
const consent = useConsent();
|
|
82
|
-
const requiredConsent = requiredConsentFor(entry);
|
|
83
|
-
const id = scriptId(entry);
|
|
84
|
-
const consentKey = requiredConsent.join(",");
|
|
85
|
-
useEffect(() => {
|
|
86
|
-
registerScript({ id, type: entry.type, requiredConsent });
|
|
87
|
-
return () => unregisterScript(id);
|
|
88
|
-
}, [id, entry.type, consentKey]);
|
|
89
|
-
if (!isConsentAllowed({ state: consent, requiredConsent })) {
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
return /* @__PURE__ */ jsx(InjectedScript, { baseId: id, descriptors: descriptorsFor(entry) });
|
|
93
|
-
}
|
|
94
|
-
function ReploScripts({ scripts }) {
|
|
95
|
-
useEffect(() => installConsentWindowApi(), []);
|
|
96
|
-
return /* @__PURE__ */ jsx(Fragment, { children: scripts.map((entry) => /* @__PURE__ */ jsx(ManagedScript, { entry }, scriptId(entry))) });
|
|
9
|
+
function ReploScripts(_props) {
|
|
10
|
+
throw canopyTombstoneError({
|
|
11
|
+
symbol: "ReploScripts",
|
|
12
|
+
subpath: "consent/replo-scripts"
|
|
13
|
+
});
|
|
97
14
|
}
|
|
98
15
|
export {
|
|
99
16
|
InjectedScript,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../consent/replo-scripts.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\";\n\nimport type {\n
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["\"use client\";\n\nimport type {\n ReploScriptEntry,\n ScriptTagDescriptor,\n} from \"schemas/generated/consent\";\n\nimport { canopyTombstoneError } from \"../lib/tombstone\";\n\n/** @deprecated Use InjectedScript from @replohq/sdk/consent/replo-scripts. */\nexport function InjectedScript(_props: {\n baseId: string;\n descriptors: ScriptTagDescriptor[];\n}): null {\n throw canopyTombstoneError({\n symbol: \"InjectedScript\",\n subpath: \"consent/replo-scripts\",\n });\n}\n\n/** @deprecated Use ReploScripts from @replohq/sdk/consent/replo-scripts. */\nexport function ReploScripts(_props: {\n scripts: ReploScriptEntry[];\n}): React.ReactElement {\n throw canopyTombstoneError({\n symbol: \"ReploScripts\",\n subpath: \"consent/replo-scripts\",\n });\n}\n"],
|
|
5
|
+
"mappings": ";AAOA,SAAS,4BAA4B;AAG9B,SAAS,eAAe,QAGtB;AACP,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,EACX,CAAC;AACH;AAGO,SAAS,aAAa,QAEN;AACrB,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,EACX,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -11,6 +11,7 @@ export interface RegisteredScript {
|
|
|
11
11
|
type: ReploScriptType;
|
|
12
12
|
requiredConsent: ConsentCategory[];
|
|
13
13
|
}
|
|
14
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; scriptRegistrationStore has no direct replacement. */
|
|
14
15
|
export declare const scriptRegistrationStore: {
|
|
15
16
|
register(script: RegisteredScript): void;
|
|
16
17
|
unregister(id: string): void;
|
|
@@ -20,6 +21,9 @@ export declare const scriptRegistrationStore: {
|
|
|
20
21
|
/** Test-only: clear the registry between cases. */
|
|
21
22
|
reset(): void;
|
|
22
23
|
};
|
|
23
|
-
|
|
24
|
-
export declare function
|
|
24
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; registerScript has no direct replacement. */
|
|
25
|
+
export declare function registerScript(_script: RegisteredScript): void;
|
|
26
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; unregisterScript has no direct replacement. */
|
|
27
|
+
export declare function unregisterScript(_id: string): void;
|
|
28
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; useRegisteredScripts has no direct replacement. */
|
|
25
29
|
export declare function useRegisteredScripts(): RegisteredScript[];
|
|
@@ -1,56 +1,42 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
for (const listener of listeners) {
|
|
10
|
-
listener();
|
|
2
|
+
import { canopyTombstoneError, canopyTombstoneObject } from "../lib/tombstone";
|
|
3
|
+
const scriptRegistrationStore = canopyTombstoneObject({
|
|
4
|
+
symbol: "scriptRegistrationStore",
|
|
5
|
+
subpath: "consent/script-registration-store",
|
|
6
|
+
replacement: {
|
|
7
|
+
kind: "internal",
|
|
8
|
+
nearestPublicSubpaths: ["consent/consent-store", "consent/replo-scripts"]
|
|
11
9
|
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
emit();
|
|
10
|
+
});
|
|
11
|
+
function registerScript(_script) {
|
|
12
|
+
throw canopyTombstoneError({
|
|
13
|
+
symbol: "registerScript",
|
|
14
|
+
subpath: "consent/script-registration-store",
|
|
15
|
+
replacement: {
|
|
16
|
+
kind: "internal",
|
|
17
|
+
nearestPublicSubpaths: ["consent/consent-store", "consent/replo-scripts"]
|
|
21
18
|
}
|
|
22
|
-
}
|
|
23
|
-
getSnapshot() {
|
|
24
|
-
return snapshot;
|
|
25
|
-
},
|
|
26
|
-
getServerSnapshot() {
|
|
27
|
-
return SERVER_SNAPSHOT;
|
|
28
|
-
},
|
|
29
|
-
subscribe(listener) {
|
|
30
|
-
listeners.add(listener);
|
|
31
|
-
return () => {
|
|
32
|
-
listeners.delete(listener);
|
|
33
|
-
};
|
|
34
|
-
},
|
|
35
|
-
/** Test-only: clear the registry between cases. */
|
|
36
|
-
reset() {
|
|
37
|
-
registry.clear();
|
|
38
|
-
listeners.clear();
|
|
39
|
-
snapshot = [];
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
function registerScript(script) {
|
|
43
|
-
scriptRegistrationStore.register(script);
|
|
19
|
+
});
|
|
44
20
|
}
|
|
45
|
-
function unregisterScript(
|
|
46
|
-
|
|
21
|
+
function unregisterScript(_id) {
|
|
22
|
+
throw canopyTombstoneError({
|
|
23
|
+
symbol: "unregisterScript",
|
|
24
|
+
subpath: "consent/script-registration-store",
|
|
25
|
+
replacement: {
|
|
26
|
+
kind: "internal",
|
|
27
|
+
nearestPublicSubpaths: ["consent/consent-store", "consent/replo-scripts"]
|
|
28
|
+
}
|
|
29
|
+
});
|
|
47
30
|
}
|
|
48
31
|
function useRegisteredScripts() {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
32
|
+
throw canopyTombstoneError({
|
|
33
|
+
symbol: "useRegisteredScripts",
|
|
34
|
+
subpath: "consent/script-registration-store",
|
|
35
|
+
replacement: {
|
|
36
|
+
kind: "internal",
|
|
37
|
+
nearestPublicSubpaths: ["consent/consent-store", "consent/replo-scripts"]
|
|
38
|
+
}
|
|
39
|
+
});
|
|
54
40
|
}
|
|
55
41
|
export {
|
|
56
42
|
registerScript,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../consent/script-registration-store.ts"],
|
|
4
|
-
"sourcesContent": ["\"use client\";\n\nimport type {\n ConsentCategory,\n ReploScriptType,\n} from \"schemas/generated/consent\";\n\nimport {
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["\"use client\";\n\n/* oxlint-disable replo/no-void-return-type -- Tombstone declarations preserve exact return types for consumer compatibility. */\nimport type {\n ConsentCategory,\n ReploScriptType,\n} from \"schemas/generated/consent\";\n\nimport { canopyTombstoneError, canopyTombstoneObject } from \"../lib/tombstone\";\n\n/**\n * Tracks which managed scripts are currently mounted on the page. Each\n * `ReploScripts` entry registers itself here on mount, so the analytics provider\n * can create sinks only for providers that are actually present (and consented),\n * without importing a static list. Like the consent store, this is a singleton\n * rather than React context so it works regardless of tree position.\n */\nexport interface RegisteredScript {\n id: string;\n type: ReploScriptType;\n requiredConsent: ConsentCategory[];\n}\n\n/** @deprecated Use a supported public @replohq/sdk API for this domain; scriptRegistrationStore has no direct replacement. */\nexport const scriptRegistrationStore: {\n register(script: RegisteredScript): void;\n unregister(id: string): void;\n getSnapshot(): RegisteredScript[];\n getServerSnapshot(): RegisteredScript[];\n subscribe(listener: () => void): () => void;\n /** Test-only: clear the registry between cases. */\n reset(): void;\n} = canopyTombstoneObject<{\n register(script: RegisteredScript): void;\n unregister(id: string): void;\n getSnapshot(): RegisteredScript[];\n getServerSnapshot(): RegisteredScript[];\n subscribe(listener: () => void): () => void;\n /** Test-only: clear the registry between cases. */\n reset(): void;\n}>({\n symbol: \"scriptRegistrationStore\",\n subpath: \"consent/script-registration-store\",\n replacement: {\n kind: \"internal\",\n nearestPublicSubpaths: [\"consent/consent-store\", \"consent/replo-scripts\"],\n },\n});\n\n/** @deprecated Use a supported public @replohq/sdk API for this domain; registerScript has no direct replacement. */\nexport function registerScript(_script: RegisteredScript): void {\n throw canopyTombstoneError({\n symbol: \"registerScript\",\n subpath: \"consent/script-registration-store\",\n replacement: {\n kind: \"internal\",\n nearestPublicSubpaths: [\"consent/consent-store\", \"consent/replo-scripts\"],\n },\n });\n}\n\n/** @deprecated Use a supported public @replohq/sdk API for this domain; unregisterScript has no direct replacement. */\nexport function unregisterScript(_id: string): void {\n throw canopyTombstoneError({\n symbol: \"unregisterScript\",\n subpath: \"consent/script-registration-store\",\n replacement: {\n kind: \"internal\",\n nearestPublicSubpaths: [\"consent/consent-store\", \"consent/replo-scripts\"],\n },\n });\n}\n\n/** @deprecated Use a supported public @replohq/sdk API for this domain; useRegisteredScripts has no direct replacement. */\nexport function useRegisteredScripts(): RegisteredScript[] {\n throw canopyTombstoneError({\n symbol: \"useRegisteredScripts\",\n subpath: \"consent/script-registration-store\",\n replacement: {\n kind: \"internal\",\n nearestPublicSubpaths: [\"consent/consent-store\", \"consent/replo-scripts\"],\n },\n });\n}\n"],
|
|
5
|
+
"mappings": ";AAQA,SAAS,sBAAsB,6BAA6B;AAgBrD,MAAM,0BAQT,sBAQD;AAAA,EACD,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,aAAa;AAAA,IACX,MAAM;AAAA,IACN,uBAAuB,CAAC,yBAAyB,uBAAuB;AAAA,EAC1E;AACF,CAAC;AAGM,SAAS,eAAe,SAAiC;AAC9D,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa;AAAA,MACX,MAAM;AAAA,MACN,uBAAuB,CAAC,yBAAyB,uBAAuB;AAAA,IAC1E;AAAA,EACF,CAAC;AACH;AAGO,SAAS,iBAAiB,KAAmB;AAClD,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa;AAAA,MACX,MAAM;AAAA,MACN,uBAAuB,CAAC,yBAAyB,uBAAuB;AAAA,IAC1E;AAAA,EACF,CAAC;AACH;AAGO,SAAS,uBAA2C;AACzD,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa;AAAA,MACX,MAAM;AAAA,MACN,uBAAuB,CAAC,yBAAyB,uBAAuB;AAAA,IAC1E;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,24 +1,10 @@
|
|
|
1
1
|
import type { ConsentCategory, ReploScriptType, ScriptTagDescriptor } from "../_vendor/schemas/generated/consent";
|
|
2
2
|
type ProviderType = Exclude<ReploScriptType, "custom" | "snippet">;
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
* snippet as the entry's `body`), but they still get a first-class default
|
|
6
|
-
* consent categorization like identifier providers.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Returns the structured tag descriptors for a named provider. A single provider
|
|
10
|
-
* can produce multiple tags (e.g. GA4 = external loader + inline config), which
|
|
11
|
-
* the runtime injects in order.
|
|
12
|
-
*/
|
|
13
|
-
export declare function buildScriptTags({ type, identifier, }: {
|
|
3
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; buildScriptTags has no direct replacement. */
|
|
4
|
+
export declare function buildScriptTags(_args: {
|
|
14
5
|
type: ProviderType;
|
|
15
6
|
identifier: string;
|
|
16
7
|
}): ScriptTagDescriptor[];
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
* entry does not specify `requiredConsent`. `snippet` and `custom` entries carry
|
|
20
|
-
* `requiredConsent` explicitly (the runtime has no default for them), so this is
|
|
21
|
-
* only consulted for identifier providers. Overridable per entry by the customer.
|
|
22
|
-
*/
|
|
23
|
-
export declare function defaultConsentFor(type: ProviderType): ConsentCategory[];
|
|
8
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; defaultConsentFor has no direct replacement. */
|
|
9
|
+
export declare function defaultConsentFor(_type: ProviderType): ConsentCategory[];
|
|
24
10
|
export {};
|