@replohq/canopy-sdk 2.5.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 +2 -13
- 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,7 +1,9 @@
|
|
|
1
|
-
export declare function createEventQueue(checkPixelReady: () => boolean, sendEvent: (event: string, params: Record<string, any>) => void, pixelName: string): (event: string, params?: Record<string, any>) => void;
|
|
2
1
|
type MethodQueueOptions = {
|
|
3
2
|
queueName?: string;
|
|
4
3
|
onTimeout?: () => void;
|
|
5
4
|
};
|
|
6
|
-
|
|
5
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; createEventQueue has no direct replacement. */
|
|
6
|
+
export declare function createEventQueue(_checkPixelReady: () => boolean, _sendEvent: (event: string, params: Record<string, any>) => void, _pixelName: string): (event: string, params?: Record<string, any>) => void;
|
|
7
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; createMethodQueue has no direct replacement. */
|
|
8
|
+
export declare function createMethodQueue<InstanceType extends Record<string, (...args: any[]) => any>>(_checkInstanceReady: () => InstanceType | null, _options?: MethodQueueOptions): (method: keyof InstanceType, ...args: any[]) => void;
|
|
7
9
|
export {};
|
|
@@ -1,127 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (timeoutTimer !== null) {
|
|
12
|
-
window.clearTimeout(timeoutTimer);
|
|
13
|
-
timeoutTimer = null;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
const flush = () => {
|
|
17
|
-
if (!checkPixelReady()) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
console.debug(
|
|
21
|
-
`[analytics] flushing ${queue.length} queued events for ${pixelName}`
|
|
22
|
-
);
|
|
23
|
-
try {
|
|
24
|
-
queue.forEach(({ event, params }) => sendEvent(event, params));
|
|
25
|
-
} finally {
|
|
26
|
-
queue.length = 0;
|
|
27
|
-
cleanup();
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
const scheduleFlush = () => {
|
|
31
|
-
if (typeof window === "undefined" || flushTimer !== null) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
flushTimer = window.setInterval(flush, 500);
|
|
35
|
-
timeoutTimer = window.setTimeout(() => {
|
|
36
|
-
queue.length = 0;
|
|
37
|
-
permanentlyDisabled = true;
|
|
38
|
-
console.debug(
|
|
39
|
-
`Analytics queue timed out after 30 seconds for ${pixelName}`
|
|
40
|
-
);
|
|
41
|
-
cleanup();
|
|
42
|
-
}, 3e4);
|
|
43
|
-
};
|
|
44
|
-
return (event, params = {}) => {
|
|
45
|
-
if (permanentlyDisabled) {
|
|
46
|
-
console.debug(
|
|
47
|
-
`[analytics] ${pixelName} queue is disabled, dropping event`,
|
|
48
|
-
event
|
|
49
|
-
);
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
if (checkPixelReady()) {
|
|
53
|
-
sendEvent(event, params);
|
|
54
|
-
} else {
|
|
55
|
-
queue.push({ event, params });
|
|
56
|
-
scheduleFlush();
|
|
57
|
-
}
|
|
58
|
-
};
|
|
1
|
+
import { canopyTombstoneError } from "../../lib/tombstone";
|
|
2
|
+
function createEventQueue(_checkPixelReady, _sendEvent, _pixelName) {
|
|
3
|
+
throw canopyTombstoneError({
|
|
4
|
+
symbol: "createEventQueue",
|
|
5
|
+
subpath: "analytics/utils/analytics-utils",
|
|
6
|
+
replacement: {
|
|
7
|
+
kind: "internal",
|
|
8
|
+
nearestPublicSubpaths: ["analytics/analytics-provider"]
|
|
9
|
+
}
|
|
10
|
+
});
|
|
59
11
|
}
|
|
60
|
-
function createMethodQueue(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
flushTimer = null;
|
|
70
|
-
}
|
|
71
|
-
if (timeoutTimer !== null) {
|
|
72
|
-
window.clearTimeout(timeoutTimer);
|
|
73
|
-
timeoutTimer = null;
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
const flush = () => {
|
|
77
|
-
const instance = checkInstanceReady();
|
|
78
|
-
if (!instance) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
try {
|
|
82
|
-
queue.forEach(({ method, args }) => {
|
|
83
|
-
const methodFunction = instance[method];
|
|
84
|
-
if (typeof methodFunction === "function") {
|
|
85
|
-
void methodFunction.apply(instance, args);
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
} finally {
|
|
89
|
-
queue.length = 0;
|
|
90
|
-
cleanup();
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
const scheduleFlush = () => {
|
|
94
|
-
if (typeof window === "undefined" || flushTimer !== null) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
flushTimer = window.setInterval(flush, 500);
|
|
98
|
-
timeoutTimer = window.setTimeout(() => {
|
|
99
|
-
queue.length = 0;
|
|
100
|
-
permanentlyDisabled = true;
|
|
101
|
-
if (typeof window !== "undefined") {
|
|
102
|
-
console.debug(
|
|
103
|
-
`[analytics] ${queueName} timed out after 30 seconds and has been disabled`
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
options?.onTimeout?.();
|
|
107
|
-
cleanup();
|
|
108
|
-
}, 3e4);
|
|
109
|
-
};
|
|
110
|
-
return (method, ...args) => {
|
|
111
|
-
if (permanentlyDisabled) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
const instance = checkInstanceReady();
|
|
115
|
-
if (instance) {
|
|
116
|
-
const methodFunction = instance[method];
|
|
117
|
-
if (typeof methodFunction === "function") {
|
|
118
|
-
void methodFunction.apply(instance, args);
|
|
119
|
-
}
|
|
120
|
-
} else {
|
|
121
|
-
queue.push({ method, args });
|
|
122
|
-
scheduleFlush();
|
|
123
|
-
}
|
|
124
|
-
};
|
|
12
|
+
function createMethodQueue(_checkInstanceReady, _options) {
|
|
13
|
+
throw canopyTombstoneError({
|
|
14
|
+
symbol: "createMethodQueue",
|
|
15
|
+
subpath: "analytics/utils/analytics-utils",
|
|
16
|
+
replacement: {
|
|
17
|
+
kind: "internal",
|
|
18
|
+
nearestPublicSubpaths: ["analytics/analytics-provider"]
|
|
19
|
+
}
|
|
20
|
+
});
|
|
125
21
|
}
|
|
126
22
|
export {
|
|
127
23
|
createEventQueue,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../analytics/utils/analytics-utils.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/* oxlint-disable typescript/no-explicit-any -- This module's callable type surface requires any for exact type parity. */\nimport { canopyTombstoneError } from \"../../lib/tombstone\";\n\ntype MethodQueueOptions = {\n queueName?: string;\n onTimeout?: () => void;\n};\n\n/** @deprecated Use a supported public @replohq/sdk API for this domain; createEventQueue has no direct replacement. */\nexport function createEventQueue(\n _checkPixelReady: () => boolean,\n _sendEvent: (event: string, params: Record<string, any>) => void,\n _pixelName: string,\n): (event: string, params?: Record<string, any>) => void {\n throw canopyTombstoneError({\n symbol: \"createEventQueue\",\n subpath: \"analytics/utils/analytics-utils\",\n replacement: {\n kind: \"internal\",\n nearestPublicSubpaths: [\"analytics/analytics-provider\"],\n },\n });\n}\n\n/** @deprecated Use a supported public @replohq/sdk API for this domain; createMethodQueue has no direct replacement. */\nexport function createMethodQueue<\n InstanceType extends Record<string, (...args: any[]) => any>,\n>(\n _checkInstanceReady: () => InstanceType | null,\n _options?: MethodQueueOptions,\n): (method: keyof InstanceType, ...args: any[]) => void {\n throw canopyTombstoneError({\n symbol: \"createMethodQueue\",\n subpath: \"analytics/utils/analytics-utils\",\n replacement: {\n kind: \"internal\",\n nearestPublicSubpaths: [\"analytics/analytics-provider\"],\n },\n });\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,4BAA4B;AAQ9B,SAAS,iBACd,kBACA,YACA,YACuD;AACvD,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa;AAAA,MACX,MAAM;AAAA,MACN,uBAAuB,CAAC,8BAA8B;AAAA,IACxD;AAAA,EACF,CAAC;AACH;AAGO,SAAS,kBAGd,qBACA,UACsD;AACtD,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa;AAAA,MACX,MAAM;AAAA,MACN,uBAAuB,CAAC,8BAA8B;AAAA,IACxD;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -4,11 +4,12 @@ export type PageMetadata = {
|
|
|
4
4
|
referrer: string;
|
|
5
5
|
timestamp: number;
|
|
6
6
|
};
|
|
7
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; NavigationTracker has no direct replacement. */
|
|
7
8
|
export declare class NavigationTracker {
|
|
8
9
|
private lastUrl;
|
|
9
10
|
private onNavigate;
|
|
10
11
|
private originalPushState;
|
|
11
|
-
constructor(
|
|
12
|
+
constructor(_onNavigate: (metadata: PageMetadata) => void);
|
|
12
13
|
init(): void;
|
|
13
14
|
private setupSPATracking;
|
|
14
15
|
private handleNavigation;
|
|
@@ -1,41 +1,48 @@
|
|
|
1
|
+
import { canopyTombstoneError } from "../../lib/tombstone";
|
|
1
2
|
class NavigationTracker {
|
|
2
|
-
lastUrl
|
|
3
|
+
lastUrl;
|
|
3
4
|
onNavigate;
|
|
4
|
-
originalPushState
|
|
5
|
-
constructor(
|
|
6
|
-
|
|
5
|
+
originalPushState;
|
|
6
|
+
constructor(_onNavigate) {
|
|
7
|
+
throw canopyTombstoneError({
|
|
8
|
+
symbol: "NavigationTracker",
|
|
9
|
+
subpath: "analytics/utils/navigation-tracker",
|
|
10
|
+
replacement: {
|
|
11
|
+
kind: "internal",
|
|
12
|
+
nearestPublicSubpaths: ["analytics/analytics-provider"]
|
|
13
|
+
}
|
|
14
|
+
});
|
|
7
15
|
}
|
|
8
16
|
init() {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
17
|
+
throw canopyTombstoneError({
|
|
18
|
+
symbol: "NavigationTracker",
|
|
19
|
+
subpath: "analytics/utils/navigation-tracker",
|
|
20
|
+
replacement: {
|
|
21
|
+
kind: "internal",
|
|
22
|
+
nearestPublicSubpaths: ["analytics/analytics-provider"]
|
|
23
|
+
}
|
|
24
|
+
});
|
|
12
25
|
}
|
|
13
26
|
setupSPATracking() {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
27
|
+
throw canopyTombstoneError({
|
|
28
|
+
symbol: "NavigationTracker",
|
|
29
|
+
subpath: "analytics/utils/navigation-tracker",
|
|
30
|
+
replacement: {
|
|
31
|
+
kind: "internal",
|
|
32
|
+
nearestPublicSubpaths: ["analytics/analytics-provider"]
|
|
33
|
+
}
|
|
34
|
+
});
|
|
19
35
|
}
|
|
20
|
-
handleNavigation
|
|
21
|
-
const currentUrl = window.location.href;
|
|
22
|
-
if (this.lastUrl !== null && this.lastUrl === currentUrl) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
this.lastUrl = currentUrl;
|
|
26
|
-
const metadata = {
|
|
27
|
-
url: currentUrl,
|
|
28
|
-
title: document.title,
|
|
29
|
-
referrer: document.referrer,
|
|
30
|
-
timestamp: Date.now()
|
|
31
|
-
};
|
|
32
|
-
this.onNavigate(metadata);
|
|
33
|
-
};
|
|
36
|
+
handleNavigation;
|
|
34
37
|
cleanup() {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
throw canopyTombstoneError({
|
|
39
|
+
symbol: "NavigationTracker",
|
|
40
|
+
subpath: "analytics/utils/navigation-tracker",
|
|
41
|
+
replacement: {
|
|
42
|
+
kind: "internal",
|
|
43
|
+
nearestPublicSubpaths: ["analytics/analytics-provider"]
|
|
44
|
+
}
|
|
45
|
+
});
|
|
39
46
|
}
|
|
40
47
|
}
|
|
41
48
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../analytics/utils/navigation-tracker.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
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\nexport type PageMetadata = {\n url: string;\n title: string;\n referrer: string;\n timestamp: number;\n};\n\n/** @deprecated Use a supported public @replohq/sdk API for this domain; NavigationTracker has no direct replacement. */\nexport class NavigationTracker {\n private lastUrl!: string | null;\n private onNavigate!: (metadata: PageMetadata) => void;\n private originalPushState!: typeof window.history.pushState | null;\n constructor(_onNavigate: (metadata: PageMetadata) => void) {\n throw canopyTombstoneError({\n symbol: \"NavigationTracker\",\n subpath: \"analytics/utils/navigation-tracker\",\n replacement: {\n kind: \"internal\",\n nearestPublicSubpaths: [\"analytics/analytics-provider\"],\n },\n });\n }\n init(): void {\n throw canopyTombstoneError({\n symbol: \"NavigationTracker\",\n subpath: \"analytics/utils/navigation-tracker\",\n replacement: {\n kind: \"internal\",\n nearestPublicSubpaths: [\"analytics/analytics-provider\"],\n },\n });\n }\n private setupSPATracking(): void {\n throw canopyTombstoneError({\n symbol: \"NavigationTracker\",\n subpath: \"analytics/utils/navigation-tracker\",\n replacement: {\n kind: \"internal\",\n nearestPublicSubpaths: [\"analytics/analytics-provider\"],\n },\n });\n }\n private handleNavigation!: () => void;\n cleanup(): void {\n throw canopyTombstoneError({\n symbol: \"NavigationTracker\",\n subpath: \"analytics/utils/navigation-tracker\",\n replacement: {\n kind: \"internal\",\n nearestPublicSubpaths: [\"analytics/analytics-provider\"],\n },\n });\n }\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,4BAA4B;AAU9B,MAAM,kBAAkB;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACR,YAAY,aAA+C;AACzD,UAAM,qBAAqB;AAAA,MACzB,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,aAAa;AAAA,QACX,MAAM;AAAA,QACN,uBAAuB,CAAC,8BAA8B;AAAA,MACxD;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EACA,OAAa;AACX,UAAM,qBAAqB;AAAA,MACzB,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,aAAa;AAAA,QACX,MAAM;AAAA,QACN,uBAAuB,CAAC,8BAA8B;AAAA,MACxD;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EACQ,mBAAyB;AAC/B,UAAM,qBAAqB;AAAA,MACzB,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,aAAa;AAAA,QACX,MAAM;AAAA,QACN,uBAAuB,CAAC,8BAA8B;AAAA,MACxD;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EACQ;AAAA,EACR,UAAgB;AACd,UAAM,qBAAqB;AAAA,MACzB,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,aAAa;AAAA,QACX,MAAM;AAAA,QACN,uBAAuB,CAAC,8BAA8B;AAAA,MACxD;AAAA,IACF,CAAC;AAAA,EACH;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import type { AnalyticsSink } from "../analytics-sink";
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
* become no-ops; every other event passes through untouched. Apply only to
|
|
5
|
-
* third-party pixel sinks — never to the first-party `ReploSink` (the
|
|
6
|
-
* storefront's own record) or the local `WindowSink` event bus.
|
|
7
|
-
*/
|
|
8
|
-
export declare function gateShopifyOwnedFunnelEvents(sink: AnalyticsSink): AnalyticsSink;
|
|
2
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; gateShopifyOwnedFunnelEvents has no direct replacement. */
|
|
3
|
+
export declare function gateShopifyOwnedFunnelEvents(_sink: AnalyticsSink): AnalyticsSink;
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return new Proxy(sink, {
|
|
10
|
-
get(target, property, receiver) {
|
|
11
|
-
if (typeof property === "string" && shopifyOwnedFunnelEvents.has(property)) {
|
|
12
|
-
return async () => {
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
return Reflect.get(target, property, receiver);
|
|
1
|
+
import { canopyTombstoneError } from "../../lib/tombstone";
|
|
2
|
+
function gateShopifyOwnedFunnelEvents(_sink) {
|
|
3
|
+
throw canopyTombstoneError({
|
|
4
|
+
symbol: "gateShopifyOwnedFunnelEvents",
|
|
5
|
+
subpath: "analytics/utils/shopify-funnel-gate",
|
|
6
|
+
replacement: {
|
|
7
|
+
kind: "internal",
|
|
8
|
+
nearestPublicSubpaths: ["analytics/analytics-provider"]
|
|
16
9
|
}
|
|
17
10
|
});
|
|
18
11
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../analytics/utils/shopify-funnel-gate.ts"],
|
|
4
|
-
"sourcesContent": ["import type { AnalyticsSink } from \"../analytics-sink\";\n\
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { AnalyticsSink } from \"../analytics-sink\";\n\nimport { canopyTombstoneError } from \"../../lib/tombstone\";\n\n/** @deprecated Use a supported public @replohq/sdk API for this domain; gateShopifyOwnedFunnelEvents has no direct replacement. */\nexport function gateShopifyOwnedFunnelEvents(\n _sink: AnalyticsSink,\n): AnalyticsSink {\n throw canopyTombstoneError({\n symbol: \"gateShopifyOwnedFunnelEvents\",\n subpath: \"analytics/utils/shopify-funnel-gate\",\n replacement: {\n kind: \"internal\",\n nearestPublicSubpaths: [\"analytics/analytics-provider\"],\n },\n });\n}\n"],
|
|
5
|
+
"mappings": "AAEA,SAAS,4BAA4B;AAG9B,SAAS,6BACd,OACe;AACf,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa;AAAA,MACX,MAAM;AAAA,MACN,uBAAuB,CAAC,8BAA8B;AAAA,IACxD;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/cart/buy-now-action.d.ts
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import type { CartLineAttribute } from "./cart-types";
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
* 1. For Shopify: creates a cart via the canopy-api-backed gateway, returns checkoutUrl.
|
|
5
|
-
* 2. For Stripe: creates a Stripe checkout session via canopy-api, returns session URL.
|
|
6
|
-
*
|
|
7
|
-
* Variant IDs are expected to already be Storefront GIDs (from data loader output).
|
|
8
|
-
* No internal→external ID mapping is needed.
|
|
9
|
-
*/
|
|
10
|
-
export declare function buyNowAction(input: {
|
|
2
|
+
/** @deprecated Use buyNowAction from @replohq/sdk/cart/buy-now-action. */
|
|
3
|
+
export declare function buyNowAction(_input: {
|
|
11
4
|
lineItems: {
|
|
12
5
|
variantId: string;
|
|
13
6
|
quantity: number;
|
package/cart/buy-now-action.js
CHANGED
|
@@ -1,102 +1,10 @@
|
|
|
1
1
|
"use server";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { getCheckoutProvider } from "../lib/integration-utils";
|
|
8
|
-
import { buildBaseUrl } from "../lib/url-utils";
|
|
9
|
-
import { createCartAction } from "./cart-actions";
|
|
10
|
-
import { REPLO_ATTRIBUTION_PROPERTY } from "./cart-types";
|
|
11
|
-
class BuyNowError extends CanopyError {
|
|
12
|
-
}
|
|
13
|
-
class BuyNowCartCreationError extends CanopyError {
|
|
14
|
-
}
|
|
15
|
-
async function buyNowAction(input) {
|
|
16
|
-
const { lineItems, discountCodes, pageUrl } = input;
|
|
17
|
-
const headersList = await headers();
|
|
18
|
-
const host = headersList.get("host");
|
|
19
|
-
if (!host) {
|
|
20
|
-
throw new BuyNowError({ message: "Missing host header" });
|
|
21
|
-
}
|
|
22
|
-
const forwardedProto = headersList.get("x-forwarded-proto");
|
|
23
|
-
const protocol = forwardedProto?.split(",")[0]?.trim() ?? "https";
|
|
24
|
-
const origin = `${protocol}://${host}`;
|
|
25
|
-
const checkoutProvider = await getCheckoutProvider();
|
|
26
|
-
const cartLines = lineItems.map((item) => {
|
|
27
|
-
const hasReploAttribution = item.properties.some(
|
|
28
|
-
(prop) => prop.key === REPLO_ATTRIBUTION_PROPERTY.key
|
|
29
|
-
);
|
|
30
|
-
const properties = hasReploAttribution ? item.properties : [REPLO_ATTRIBUTION_PROPERTY, ...item.properties];
|
|
31
|
-
return {
|
|
32
|
-
id: item.variantId,
|
|
33
|
-
quantity: item.quantity,
|
|
34
|
-
sellingPlanId: item.sellingPlanId,
|
|
35
|
-
properties
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
if (checkoutProvider === "stripe") {
|
|
39
|
-
const env = await getEnv();
|
|
40
|
-
const isSameOrigin = (() => {
|
|
41
|
-
try {
|
|
42
|
-
return Boolean(pageUrl) && new URL(pageUrl).origin === origin;
|
|
43
|
-
} catch {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
})();
|
|
47
|
-
const safePageUrl = isSameOrigin ? pageUrl : origin;
|
|
48
|
-
const cancelUrl = safePageUrl;
|
|
49
|
-
const temporaryCartId = uuidv4();
|
|
50
|
-
const body = {
|
|
51
|
-
cartId: temporaryCartId,
|
|
52
|
-
lines: cartLines.map((line) => ({
|
|
53
|
-
variantId: line.id,
|
|
54
|
-
quantity: line.quantity,
|
|
55
|
-
properties: line.properties
|
|
56
|
-
})),
|
|
57
|
-
projectId: env.PROJECT_ID,
|
|
58
|
-
// canopy appends session_id={CHECKOUT_SESSION_ID} at session creation;
|
|
59
|
-
// the success route resolves it into the order status page.
|
|
60
|
-
successUrl: `${origin}/checkout/success`,
|
|
61
|
-
cancelUrl
|
|
62
|
-
};
|
|
63
|
-
const canopyApiUrl = `${buildBaseUrl(env.CANOPY_API_HOST)}/api/v1/stripe-checkout/create-session`;
|
|
64
|
-
const response = await fetch(canopyApiUrl, {
|
|
65
|
-
method: "POST",
|
|
66
|
-
headers: { "Content-Type": "application/json" },
|
|
67
|
-
body: JSON.stringify(body)
|
|
68
|
-
});
|
|
69
|
-
if (!response.ok) {
|
|
70
|
-
throw new BuyNowCartCreationError({
|
|
71
|
-
message: "Failed to create Stripe checkout session for buy now",
|
|
72
|
-
additionalData: {
|
|
73
|
-
status: response.status,
|
|
74
|
-
statusText: response.statusText
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
const data = z.object({ url: z.string() }).safeParse(await response.json());
|
|
79
|
-
if (!data.success) {
|
|
80
|
-
throw new BuyNowCartCreationError({
|
|
81
|
-
message: "Stripe checkout session response missing redirect URL",
|
|
82
|
-
cause: data.error
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
return { redirectUrl: data.data.url };
|
|
86
|
-
}
|
|
87
|
-
const cart = await createCartAction({
|
|
88
|
-
lines: cartLines,
|
|
89
|
-
skipStoringCart: true,
|
|
90
|
-
discountCodes: discountCodes.length > 0 ? discountCodes : void 0
|
|
2
|
+
import { canopyTombstoneError } from "../lib/tombstone";
|
|
3
|
+
async function buyNowAction(_input) {
|
|
4
|
+
throw canopyTombstoneError({
|
|
5
|
+
symbol: "buyNowAction",
|
|
6
|
+
subpath: "cart/buy-now-action"
|
|
91
7
|
});
|
|
92
|
-
if (!cart?.checkoutUrl) {
|
|
93
|
-
throw new BuyNowCartCreationError({
|
|
94
|
-
message: "Failed to create cart or get checkout URL",
|
|
95
|
-
additionalData: { lineItems, discountCodes }
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
const checkoutUrl = new URL(cart.checkoutUrl, origin);
|
|
99
|
-
return { redirectUrl: checkoutUrl.toString() };
|
|
100
8
|
}
|
|
101
9
|
export {
|
|
102
10
|
buyNowAction
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../cart/buy-now-action.ts"],
|
|
4
|
-
"sourcesContent": ["\"use server\";\n\nimport type { CartLineAttribute } from \"./cart-types\";\n\nimport {
|
|
5
|
-
"mappings": ";AAIA,SAAS,
|
|
4
|
+
"sourcesContent": ["\"use server\";\n\nimport type { CartLineAttribute } from \"./cart-types\";\n\nimport { canopyTombstoneError } from \"../lib/tombstone\";\n\n/** @deprecated Use buyNowAction from @replohq/sdk/cart/buy-now-action. */\nexport async function buyNowAction(_input: {\n lineItems: {\n variantId: string;\n quantity: number;\n sellingPlanId: string | null;\n properties: CartLineAttribute[];\n }[];\n discountCodes: string[];\n pageUrl: string;\n}): Promise<{ redirectUrl: string }> {\n throw canopyTombstoneError({\n symbol: \"buyNowAction\",\n subpath: \"cart/buy-now-action\",\n });\n}\n"],
|
|
5
|
+
"mappings": ";AAIA,SAAS,4BAA4B;AAGrC,eAAsB,aAAa,QASE;AACnC,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,EACX,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/cart/cart-actions.d.ts
CHANGED
|
@@ -1,63 +1,19 @@
|
|
|
1
1
|
import type { AddToCartPayload, Cart, CartLinePayload, RemoveFromCartPayload, UpdateCartLineItemPayload } from "./cart-types";
|
|
2
|
-
/**
|
|
3
|
-
* Gets the existing cart or creates a new one if none exists. This is necessary
|
|
4
|
-
* because we may not have cookies in the server context during initial load.
|
|
5
|
-
*
|
|
6
|
-
* See: https://nextjs.org/docs/app/api-reference/functions/cookies#understanding-cookie-behavior-in-server-components
|
|
7
|
-
*
|
|
8
|
-
* @returns The existing cart or a newly created cart
|
|
9
|
-
*/
|
|
2
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; getOrCreateCartAction has no direct replacement. */
|
|
10
3
|
export declare function getOrCreateCartAction(): Promise<Cart | null>;
|
|
11
|
-
/**
|
|
12
|
-
* Retrieves the current cart from cookies. Returns null if no cart exists or
|
|
13
|
-
* if the cart has expired/been deleted.
|
|
14
|
-
*
|
|
15
|
-
* @returns The current cart or null if none exists
|
|
16
|
-
*/
|
|
4
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; getCartAction has no direct replacement. */
|
|
17
5
|
export declare function getCartAction(): Promise<Cart | null>;
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
* in a cookie for future retrieval.
|
|
21
|
-
*
|
|
22
|
-
* @param options.lines - Optional initial cart line items
|
|
23
|
-
* @param options.skipStoringCart - If true, skips storing the cart in cookies (used for buy-now flows)
|
|
24
|
-
* @param options.discountCodes - Optional discount codes to apply on cart creation
|
|
25
|
-
* @returns The newly created cart
|
|
26
|
-
*/
|
|
27
|
-
export declare function createCartAction(options?: {
|
|
6
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; createCartAction has no direct replacement. */
|
|
7
|
+
export declare function createCartAction(_options?: {
|
|
28
8
|
lines?: CartLinePayload[];
|
|
29
9
|
skipStoringCart?: boolean;
|
|
30
10
|
discountCodes?: string[];
|
|
31
11
|
}): Promise<Cart | null>;
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*/
|
|
39
|
-
export declare function
|
|
40
|
-
/**
|
|
41
|
-
* Updates a cart line item (typically quantity).
|
|
42
|
-
*
|
|
43
|
-
* @param line - The cart line item with updated values
|
|
44
|
-
* @param cartId - The ID of the cart containing the line item
|
|
45
|
-
* @returns The updated cart
|
|
46
|
-
*/
|
|
47
|
-
export declare function updateCartLineItemAction(line: UpdateCartLineItemPayload["line"], cartId: string): Promise<Cart | null>;
|
|
48
|
-
/**
|
|
49
|
-
* Removes one or more line items from the cart.
|
|
50
|
-
*
|
|
51
|
-
* @param lineIds - Array of line item IDs to remove
|
|
52
|
-
* @param cartId - The ID of the cart to remove items from
|
|
53
|
-
* @returns The updated cart
|
|
54
|
-
*/
|
|
55
|
-
export declare function removeCartLineItemsAction(lineIds: RemoveFromCartPayload["lineIds"], cartId: string): Promise<Cart | null>;
|
|
56
|
-
/**
|
|
57
|
-
* Updates discount codes for a cart.
|
|
58
|
-
*
|
|
59
|
-
* @param discountCodes - Array of discount code strings to apply
|
|
60
|
-
* @param cartId - The ID of the cart to update
|
|
61
|
-
* @returns The updated cart
|
|
62
|
-
*/
|
|
63
|
-
export declare function updateCartDiscountCodesAction(discountCodes: string[], cartId: string): Promise<Cart | null>;
|
|
12
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; addToCartAction has no direct replacement. */
|
|
13
|
+
export declare function addToCartAction(_lines: AddToCartPayload["lines"], _cartId: string): Promise<Cart | null>;
|
|
14
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; updateCartLineItemAction has no direct replacement. */
|
|
15
|
+
export declare function updateCartLineItemAction(_line: UpdateCartLineItemPayload["line"], _cartId: string): Promise<Cart | null>;
|
|
16
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; removeCartLineItemsAction has no direct replacement. */
|
|
17
|
+
export declare function removeCartLineItemsAction(_lineIds: RemoveFromCartPayload["lineIds"], _cartId: string): Promise<Cart | null>;
|
|
18
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; updateCartDiscountCodesAction has no direct replacement. */
|
|
19
|
+
export declare function updateCartDiscountCodesAction(_discountCodes: string[], _cartId: string): Promise<Cart | null>;
|