@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,118 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import Underline from "@tiptap/extension-underline";
|
|
8
|
-
const InlineDocument = Document.extend({
|
|
9
|
-
content: "inline*"
|
|
10
|
-
});
|
|
11
|
-
const InlineLink = Mark.create({
|
|
12
|
-
name: "link",
|
|
13
|
-
inclusive: false,
|
|
14
|
-
addAttributes() {
|
|
15
|
-
return {
|
|
16
|
-
class: { default: null },
|
|
17
|
-
href: { default: null },
|
|
18
|
-
rel: { default: null },
|
|
19
|
-
target: { default: null }
|
|
20
|
-
};
|
|
21
|
-
},
|
|
22
|
-
parseHTML() {
|
|
23
|
-
return [{ tag: "a[href]" }];
|
|
24
|
-
},
|
|
25
|
-
renderHTML({ HTMLAttributes }) {
|
|
26
|
-
return ["a", HTMLAttributes, 0];
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
function createInlineTiptapEditor({
|
|
30
|
-
element,
|
|
31
|
-
content,
|
|
32
|
-
onCommit,
|
|
33
|
-
onEscape,
|
|
34
|
-
onBlur,
|
|
35
|
-
onSelectionUpdate
|
|
36
|
-
}) {
|
|
37
|
-
const originalAttributes = Array.from(
|
|
38
|
-
element.attributes,
|
|
39
|
-
({ name, value }) => ({
|
|
40
|
-
name,
|
|
41
|
-
value
|
|
42
|
-
})
|
|
43
|
-
);
|
|
44
|
-
element.replaceChildren();
|
|
45
|
-
const mount = {
|
|
46
|
-
mount: element
|
|
47
|
-
};
|
|
48
|
-
const editor = new Editor({
|
|
49
|
-
element: mount,
|
|
50
|
-
content,
|
|
51
|
-
extensions: [
|
|
52
|
-
InlineDocument,
|
|
53
|
-
Text,
|
|
54
|
-
Bold,
|
|
55
|
-
Italic,
|
|
56
|
-
Underline,
|
|
57
|
-
Strike,
|
|
58
|
-
InlineLink
|
|
59
|
-
],
|
|
60
|
-
editorProps: {
|
|
61
|
-
// Drop the browser's default focus ring on the contenteditable — the
|
|
62
|
-
// select-mode selection frame already indicates the edit target.
|
|
63
|
-
attributes: { style: "outline: none;" },
|
|
64
|
-
handleKeyDown: (_view, event) => {
|
|
65
|
-
if (event.key === "Enter" && (event.shiftKey || event.metaKey || event.ctrlKey)) {
|
|
66
|
-
event.preventDefault();
|
|
67
|
-
onCommit();
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
if (event.key === "Escape") {
|
|
71
|
-
event.preventDefault();
|
|
72
|
-
onEscape();
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
onSelectionUpdate: ({ editor: activeEditor }) => {
|
|
79
|
-
onSelectionUpdate({
|
|
80
|
-
bold: activeEditor.isActive("bold"),
|
|
81
|
-
italic: activeEditor.isActive("italic"),
|
|
82
|
-
underline: activeEditor.isActive("underline"),
|
|
83
|
-
strike: activeEditor.isActive("strike")
|
|
84
|
-
});
|
|
85
|
-
},
|
|
86
|
-
onBlur: () => {
|
|
87
|
-
onBlur();
|
|
88
|
-
}
|
|
1
|
+
import { canopyTombstoneError } from "../../lib/tombstone";
|
|
2
|
+
function createInlineTiptapEditor(_args) {
|
|
3
|
+
throw canopyTombstoneError({
|
|
4
|
+
symbol: "createInlineTiptapEditor",
|
|
5
|
+
subpath: "editor/select-mode/tiptapInlineEditor",
|
|
6
|
+
replacement: { kind: "sandbox-runtime" }
|
|
89
7
|
});
|
|
90
|
-
return {
|
|
91
|
-
focus: () => editor.commands.focus(),
|
|
92
|
-
// Focus the editor with the full text block selected so the user can type
|
|
93
|
-
// to replace it immediately (or arrow/click to drop the selection).
|
|
94
|
-
focusAndSelectAll: () => editor.chain().focus().selectAll().run(),
|
|
95
|
-
destroy: () => {
|
|
96
|
-
editor.destroy();
|
|
97
|
-
for (const attribute of Array.from(element.attributes)) {
|
|
98
|
-
element.removeAttribute(attribute.name);
|
|
99
|
-
}
|
|
100
|
-
for (const { name, value } of originalAttributes) {
|
|
101
|
-
element.setAttribute(name, value);
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
getHTML: () => editor.getHTML(),
|
|
105
|
-
getJSON: () => editor.getJSON(),
|
|
106
|
-
runFormatCommand: (command) => {
|
|
107
|
-
const commandRunners = {
|
|
108
|
-
toggleBold: () => editor.chain().focus().toggleBold().run(),
|
|
109
|
-
toggleItalic: () => editor.chain().focus().toggleItalic().run(),
|
|
110
|
-
toggleUnderline: () => editor.chain().focus().toggleUnderline().run(),
|
|
111
|
-
toggleStrike: () => editor.chain().focus().toggleStrike().run()
|
|
112
|
-
};
|
|
113
|
-
commandRunners[command]();
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
8
|
}
|
|
117
9
|
export {
|
|
118
10
|
createInlineTiptapEditor
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../editor/select-mode/tiptapInlineEditor.ts"],
|
|
4
|
-
"sourcesContent": ["import type {
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { SelectModeFormatCommand } from \"schemas/generated/selectMode\";\n\nimport { canopyTombstoneError } from \"../../lib/tombstone\";\n\ntype JSONContent = {\n type?: string;\n // oxlint-disable-next-line typescript/no-explicit-any -- Preserves Tiptap's retired public JSON contract.\n attrs?: Record<string, any>;\n content?: JSONContent[];\n marks?: {\n type: string;\n // oxlint-disable-next-line typescript/no-explicit-any -- Preserves Tiptap's retired public JSON contract.\n attrs?: Record<string, any>;\n // oxlint-disable-next-line typescript/no-explicit-any -- Preserves Tiptap's retired public JSON contract.\n [key: string]: any;\n }[];\n text?: string;\n // oxlint-disable-next-line typescript/no-explicit-any -- Preserves Tiptap's retired public JSON contract.\n [key: string]: any;\n};\n\nexport type InlineTiptapEditor = {\n focus: () => void;\n focusAndSelectAll: () => void;\n destroy: () => void;\n getHTML: () => string;\n getJSON: () => JSONContent;\n runFormatCommand: (command: SelectModeFormatCommand) => void;\n};\n\n/** @deprecated Mount SandboxRuntime from @replohq/sandbox-runtime instead. */\nexport function createInlineTiptapEditor(_args: {\n element: HTMLElement;\n content: string;\n onCommit: () => void;\n onEscape: () => void;\n onBlur: () => void;\n onSelectionUpdate: (activeMarks: {\n bold: boolean;\n italic: boolean;\n underline: boolean;\n strike: boolean;\n }) => void;\n}): InlineTiptapEditor {\n throw canopyTombstoneError({\n symbol: \"createInlineTiptapEditor\",\n subpath: \"editor/select-mode/tiptapInlineEditor\",\n replacement: { kind: \"sandbox-runtime\" },\n });\n}\n"],
|
|
5
|
+
"mappings": "AAEA,SAAS,4BAA4B;AA6B9B,SAAS,yBAAyB,OAYlB;AACrB,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa,EAAE,MAAM,kBAAkB;AAAA,EACzC,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/env.d.ts
CHANGED
|
@@ -5,5 +5,6 @@ type Env = {
|
|
|
5
5
|
REPLO_ANALYTICS_PIXEL_URL?: string;
|
|
6
6
|
CHECKOUT_PROVIDER?: "shopify" | "stripe" | "none";
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; getEnv has no direct replacement. */
|
|
9
|
+
export declare function getEnv(): Promise<Env>;
|
|
9
10
|
export {};
|
package/env.js
CHANGED
|
@@ -1,41 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
});
|
|
12
|
-
const wranglerConfigSchema = z.object({ vars: envSchema });
|
|
13
|
-
class MissingWranglerConfigError extends CanopyError {
|
|
1
|
+
import { canopyTombstoneError } from "./lib/tombstone";
|
|
2
|
+
async function getEnv() {
|
|
3
|
+
throw canopyTombstoneError({
|
|
4
|
+
symbol: "getEnv",
|
|
5
|
+
subpath: "env",
|
|
6
|
+
replacement: {
|
|
7
|
+
kind: "internal",
|
|
8
|
+
nearestPublicSubpaths: ["providers/replo-provider"]
|
|
9
|
+
}
|
|
10
|
+
});
|
|
14
11
|
}
|
|
15
|
-
const isDeployedWorker = () => {
|
|
16
|
-
return process.env.NODE_ENV === "production" && process.env.BUILD_ENV !== "build" && process.env.NEXT_PHASE !== "phase-production-build";
|
|
17
|
-
};
|
|
18
|
-
const getEnv = async () => {
|
|
19
|
-
if (isDeployedWorker()) {
|
|
20
|
-
const { env } = await getCloudflareContext({ async: true });
|
|
21
|
-
return envSchema.parse(env);
|
|
22
|
-
}
|
|
23
|
-
const { promises: fs } = await import(
|
|
24
|
-
/* turbopackIgnore: true */
|
|
25
|
-
/* webpackIgnore: true */
|
|
26
|
-
"node:fs"
|
|
27
|
-
);
|
|
28
|
-
let raw;
|
|
29
|
-
try {
|
|
30
|
-
raw = await fs.readFile(`${process.cwd()}/wrangler.jsonc`, "utf8");
|
|
31
|
-
} catch (error) {
|
|
32
|
-
throw new MissingWranglerConfigError({
|
|
33
|
-
message: `wrangler.jsonc not found in ${process.cwd()}. It holds this site's Replo project config (project id, API host) and is required to run outside the deployed worker. If this clone predates the committed config, open the site in Replo once \u2014 the dev server regenerates and commits it \u2014 then git pull.`,
|
|
34
|
-
cause: error
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
return wranglerConfigSchema.parse(JSONC.parse(raw)).vars;
|
|
38
|
-
};
|
|
39
12
|
export {
|
|
40
13
|
getEnv
|
|
41
14
|
};
|
package/env.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../env.ts"],
|
|
4
|
-
"sourcesContent": ["import {
|
|
5
|
-
"mappings": "AAAA,SAAS,4BAA4B;
|
|
4
|
+
"sourcesContent": ["import { canopyTombstoneError } from \"./lib/tombstone\";\n\ntype Env = {\n CANOPY_API_HOST: string;\n PROJECT_ID: string;\n // Base URL of analytics-fire (e.g. https://data.replo.app). Read server-side by\n // the consent action (`consent/consent-actions.ts`) to forward proof-of-consent\n // records. Optional: absent in environments where the audit pipeline isn't\n // wired (e.g. local dev), where consent recording simply no-ops.\n ANALYTICS_FIRE_API_URL?: string;\n // Base URL of the Replo first-party analytics pixel CDN (e.g.\n // https://pixel.replo.app). `<ReploFirstPartyPixel>` loads\n // `${REPLO_ANALYTICS_PIXEL_URL}/latest.js` into the page once analytics consent\n // is granted; the browser fetches it directly. Optional: absent when the pixel\n // isn't configured (e.g. lean local dev), where the pixel simply isn't injected.\n REPLO_ANALYTICS_PIXEL_URL?: string;\n CHECKOUT_PROVIDER?: \"shopify\" | \"stripe\" | \"none\";\n};\n\n/** @deprecated Use a supported public @replohq/sdk API for this domain; getEnv has no direct replacement. */\nexport async function getEnv(): Promise<Env> {\n throw canopyTombstoneError({\n symbol: \"getEnv\",\n subpath: \"env\",\n replacement: {\n kind: \"internal\",\n nearestPublicSubpaths: [\"providers/replo-provider\"],\n },\n });\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,4BAA4B;AAoBrC,eAAsB,SAAuB;AAC3C,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,aAAa;AAAA,MACX,MAAM;AAAA,MACN,uBAAuB,CAAC,0BAA0B;AAAA,IACpD;AAAA,EACF,CAAC;AACH;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/gateways/canopy-api.d.ts
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import type { Cart } from "../cart/cart-schema";
|
|
2
|
-
import {
|
|
2
|
+
import type { CanopyErrorConfig } from "../lib/canopy-error";
|
|
3
3
|
type CanopyApiGatewayErrorConfig = {
|
|
4
4
|
message: string;
|
|
5
5
|
statusCode?: number;
|
|
6
6
|
cause?: unknown;
|
|
7
7
|
additionalData?: Record<string, unknown>;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; CanopyApiGatewayError has no direct replacement. */
|
|
10
|
+
export declare class CanopyApiGatewayError extends Error {
|
|
11
|
+
config: CanopyErrorConfig;
|
|
12
|
+
id: string;
|
|
10
13
|
statusCode: number;
|
|
11
|
-
constructor(
|
|
14
|
+
constructor(_config: CanopyApiGatewayErrorConfig);
|
|
12
15
|
}
|
|
13
16
|
declare class CanopyApiGateway {
|
|
14
17
|
private apiHost;
|
|
15
18
|
private baseUrl;
|
|
16
|
-
constructor(
|
|
17
|
-
private static readonly REQUEST_TIMEOUT_MILLISECONDS;
|
|
19
|
+
constructor(_apiHost: string);
|
|
18
20
|
static setup(): Promise<CanopyApiGateway>;
|
|
19
21
|
private _post;
|
|
20
22
|
private _get;
|
|
21
|
-
invokeLoader(
|
|
23
|
+
invokeLoader(_args: {
|
|
22
24
|
loaderKey: string;
|
|
23
25
|
args: Record<string, unknown>;
|
|
24
26
|
}): Promise<{
|
|
@@ -31,10 +33,10 @@ declare class CanopyApiGateway {
|
|
|
31
33
|
} | undefined;
|
|
32
34
|
}>;
|
|
33
35
|
private _cartPost;
|
|
34
|
-
cartGet(
|
|
36
|
+
cartGet(_args: {
|
|
35
37
|
cartId: string;
|
|
36
38
|
}): Promise<Cart | null>;
|
|
37
|
-
cartCreate(
|
|
39
|
+
cartCreate(_options?: {
|
|
38
40
|
lines?: {
|
|
39
41
|
merchandiseId: string;
|
|
40
42
|
quantity: number;
|
|
@@ -46,7 +48,7 @@ declare class CanopyApiGateway {
|
|
|
46
48
|
}[];
|
|
47
49
|
discountCodes?: string[];
|
|
48
50
|
}): Promise<Cart>;
|
|
49
|
-
cartAddLines(
|
|
51
|
+
cartAddLines(_args: {
|
|
50
52
|
cartId: string;
|
|
51
53
|
lines: {
|
|
52
54
|
merchandiseId: string;
|
|
@@ -58,7 +60,7 @@ declare class CanopyApiGateway {
|
|
|
58
60
|
sellingPlanId?: string | null;
|
|
59
61
|
}[];
|
|
60
62
|
}): Promise<Cart>;
|
|
61
|
-
cartUpdateLines(
|
|
63
|
+
cartUpdateLines(_args: {
|
|
62
64
|
cartId: string;
|
|
63
65
|
lines: {
|
|
64
66
|
lineId: string;
|
|
@@ -70,14 +72,15 @@ declare class CanopyApiGateway {
|
|
|
70
72
|
sellingPlanId?: string | null;
|
|
71
73
|
}[];
|
|
72
74
|
}): Promise<Cart>;
|
|
73
|
-
cartRemoveLines(
|
|
75
|
+
cartRemoveLines(_args: {
|
|
74
76
|
cartId: string;
|
|
75
77
|
lineIds: string[];
|
|
76
78
|
}): Promise<Cart>;
|
|
77
|
-
cartUpdateDiscountCodes(
|
|
79
|
+
cartUpdateDiscountCodes(_args: {
|
|
78
80
|
cartId: string;
|
|
79
81
|
discountCodes: string[];
|
|
80
82
|
}): Promise<Cart>;
|
|
81
83
|
}
|
|
84
|
+
/** @deprecated Use a supported public @replohq/sdk API for this domain; getCanopyApiGateway has no direct replacement. */
|
|
82
85
|
export declare function getCanopyApiGateway(): Promise<CanopyApiGateway>;
|
|
83
86
|
export {};
|
package/gateways/canopy-api.js
CHANGED
|
@@ -1,194 +1,156 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { buildBaseUrl } from "../lib/url-utils";
|
|
6
|
-
class CanopyApiGatewayError extends CanopyError {
|
|
1
|
+
import { canopyTombstoneError } from "../lib/tombstone";
|
|
2
|
+
class CanopyApiGatewayError extends Error {
|
|
3
|
+
config;
|
|
4
|
+
id;
|
|
7
5
|
statusCode;
|
|
8
|
-
constructor(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
constructor(_config) {
|
|
7
|
+
super();
|
|
8
|
+
throw canopyTombstoneError({
|
|
9
|
+
symbol: "CanopyApiGatewayError",
|
|
10
|
+
subpath: "gateways/canopy-api",
|
|
11
|
+
replacement: {
|
|
12
|
+
kind: "internal",
|
|
13
|
+
nearestPublicSubpaths: ["providers/replo-provider"]
|
|
16
14
|
}
|
|
17
15
|
});
|
|
18
|
-
this.statusCode = resolvedStatusCode;
|
|
19
16
|
}
|
|
20
17
|
}
|
|
21
|
-
class UnknownCanopyApiError extends CanopyApiGatewayError {
|
|
22
|
-
constructor(config) {
|
|
23
|
-
super({ ...config, statusCode: 502 });
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
const loaderInvokeResponseSchema = z.object({
|
|
27
|
-
data: z.unknown(),
|
|
28
|
-
meta: z.object({
|
|
29
|
-
cache: z.object({
|
|
30
|
-
hit: z.boolean(),
|
|
31
|
-
ttlSeconds: z.number()
|
|
32
|
-
})
|
|
33
|
-
}).optional()
|
|
34
|
-
});
|
|
35
18
|
class CanopyApiGateway {
|
|
36
19
|
apiHost;
|
|
37
20
|
baseUrl;
|
|
38
|
-
constructor(
|
|
39
|
-
|
|
40
|
-
|
|
21
|
+
constructor(_apiHost) {
|
|
22
|
+
throw canopyTombstoneError({
|
|
23
|
+
symbol: "CanopyApiGateway",
|
|
24
|
+
subpath: "gateways/canopy-api",
|
|
25
|
+
replacement: {
|
|
26
|
+
kind: "internal",
|
|
27
|
+
nearestPublicSubpaths: ["providers/replo-provider"]
|
|
28
|
+
}
|
|
29
|
+
});
|
|
41
30
|
}
|
|
42
|
-
static REQUEST_TIMEOUT_MILLISECONDS = 1e4;
|
|
43
31
|
static async setup() {
|
|
44
|
-
|
|
45
|
-
|
|
32
|
+
throw canopyTombstoneError({
|
|
33
|
+
symbol: "CanopyApiGateway",
|
|
34
|
+
subpath: "gateways/canopy-api",
|
|
35
|
+
replacement: {
|
|
36
|
+
kind: "internal",
|
|
37
|
+
nearestPublicSubpaths: ["providers/replo-provider"]
|
|
38
|
+
}
|
|
39
|
+
});
|
|
46
40
|
}
|
|
47
|
-
async _post(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
method: "POST",
|
|
55
|
-
headers: { "Content-Type": "application/json" },
|
|
56
|
-
body: JSON.stringify(body),
|
|
57
|
-
signal: abortController.signal
|
|
58
|
-
});
|
|
59
|
-
} catch (error) {
|
|
60
|
-
let message = `Failed to POST to canopy-api at ${url}: ${error}`;
|
|
61
|
-
if (process.env.NODE_ENV !== "production") {
|
|
62
|
-
message += `
|
|
63
|
-
|
|
64
|
-
apiHost: ${this.apiHost}
|
|
65
|
-
If you're running locally, make sure the canopy-api cloudflare worker is running. You may need to restart the dev server.`;
|
|
41
|
+
async _post(_url, _body) {
|
|
42
|
+
throw canopyTombstoneError({
|
|
43
|
+
symbol: "CanopyApiGateway",
|
|
44
|
+
subpath: "gateways/canopy-api",
|
|
45
|
+
replacement: {
|
|
46
|
+
kind: "internal",
|
|
47
|
+
nearestPublicSubpaths: ["providers/replo-provider"]
|
|
66
48
|
}
|
|
67
|
-
|
|
68
|
-
} finally {
|
|
69
|
-
clearTimeout(timeoutId);
|
|
70
|
-
}
|
|
49
|
+
});
|
|
71
50
|
}
|
|
72
|
-
async _get(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
} catch (error) {
|
|
80
|
-
let message = `Failed to GET from canopy-api at ${url}: ${error}`;
|
|
81
|
-
if (process.env.NODE_ENV !== "production") {
|
|
82
|
-
message += `
|
|
83
|
-
|
|
84
|
-
apiHost: ${this.apiHost}
|
|
85
|
-
If you're running locally, make sure the canopy-api cloudflare worker is running. You may need to restart the dev server.`;
|
|
51
|
+
async _get(_url) {
|
|
52
|
+
throw canopyTombstoneError({
|
|
53
|
+
symbol: "CanopyApiGateway",
|
|
54
|
+
subpath: "gateways/canopy-api",
|
|
55
|
+
replacement: {
|
|
56
|
+
kind: "internal",
|
|
57
|
+
nearestPublicSubpaths: ["providers/replo-provider"]
|
|
86
58
|
}
|
|
87
|
-
|
|
88
|
-
} finally {
|
|
89
|
-
clearTimeout(timeoutId);
|
|
90
|
-
}
|
|
59
|
+
});
|
|
91
60
|
}
|
|
92
|
-
async invokeLoader({
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
args
|
|
61
|
+
async invokeLoader(_args) {
|
|
62
|
+
throw canopyTombstoneError({
|
|
63
|
+
symbol: "CanopyApiGateway",
|
|
64
|
+
subpath: "gateways/canopy-api",
|
|
65
|
+
replacement: {
|
|
66
|
+
kind: "internal",
|
|
67
|
+
nearestPublicSubpaths: ["providers/replo-provider"]
|
|
68
|
+
}
|
|
101
69
|
});
|
|
102
|
-
if (!response.ok) {
|
|
103
|
-
const errorBody = await response.text().catch(() => "");
|
|
104
|
-
throw new CanopyApiGatewayError({
|
|
105
|
-
message: `Failed to invoke loader ${loaderKey}: ${response.status} ${response.statusText}${errorBody ? ` \u2014 ${errorBody}` : ""}`,
|
|
106
|
-
statusCode: response.status
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
return loaderInvokeResponseSchema.parse(await response.json());
|
|
110
70
|
}
|
|
111
71
|
// ---------------------------------------------------------------------------
|
|
112
72
|
// Cart operations (canopy-api-backed ExternalCart)
|
|
113
73
|
// ---------------------------------------------------------------------------
|
|
114
|
-
async _cartPost(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
response = await fetch(url, {
|
|
124
|
-
method: "POST",
|
|
125
|
-
headers: {
|
|
126
|
-
"Content-Type": "application/json"
|
|
127
|
-
},
|
|
128
|
-
body: JSON.stringify({ ...body, projectId: env.PROJECT_ID }),
|
|
129
|
-
signal: abortController.signal
|
|
130
|
-
});
|
|
131
|
-
} catch (error) {
|
|
132
|
-
throw new UnknownCanopyApiError({
|
|
133
|
-
message: `Failed to POST cart operation to ${url}: ${error}`,
|
|
134
|
-
cause: error
|
|
135
|
-
});
|
|
136
|
-
} finally {
|
|
137
|
-
clearTimeout(timeoutId);
|
|
138
|
-
}
|
|
139
|
-
if (!response.ok) {
|
|
140
|
-
const text = await response.text().catch(() => "");
|
|
141
|
-
throw new CanopyApiGatewayError({
|
|
142
|
-
message: `Cart operation ${path} failed: ${response.status} ${response.statusText} \u2014 ${text}`,
|
|
143
|
-
statusCode: response.status
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
const json = await response.json();
|
|
147
|
-
return cartSchema.parse(json.data);
|
|
74
|
+
async _cartPost(_path, _body) {
|
|
75
|
+
throw canopyTombstoneError({
|
|
76
|
+
symbol: "CanopyApiGateway",
|
|
77
|
+
subpath: "gateways/canopy-api",
|
|
78
|
+
replacement: {
|
|
79
|
+
kind: "internal",
|
|
80
|
+
nearestPublicSubpaths: ["providers/replo-provider"]
|
|
81
|
+
}
|
|
82
|
+
});
|
|
148
83
|
}
|
|
149
|
-
async cartGet(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
84
|
+
async cartGet(_args) {
|
|
85
|
+
throw canopyTombstoneError({
|
|
86
|
+
symbol: "CanopyApiGateway",
|
|
87
|
+
subpath: "gateways/canopy-api",
|
|
88
|
+
replacement: {
|
|
89
|
+
kind: "internal",
|
|
90
|
+
nearestPublicSubpaths: ["providers/replo-provider"]
|
|
155
91
|
}
|
|
156
|
-
|
|
157
|
-
}
|
|
92
|
+
});
|
|
158
93
|
}
|
|
159
|
-
async cartCreate(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
94
|
+
async cartCreate(_options) {
|
|
95
|
+
throw canopyTombstoneError({
|
|
96
|
+
symbol: "CanopyApiGateway",
|
|
97
|
+
subpath: "gateways/canopy-api",
|
|
98
|
+
replacement: {
|
|
99
|
+
kind: "internal",
|
|
100
|
+
nearestPublicSubpaths: ["providers/replo-provider"]
|
|
101
|
+
}
|
|
163
102
|
});
|
|
164
103
|
}
|
|
165
|
-
async cartAddLines({
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
104
|
+
async cartAddLines(_args) {
|
|
105
|
+
throw canopyTombstoneError({
|
|
106
|
+
symbol: "CanopyApiGateway",
|
|
107
|
+
subpath: "gateways/canopy-api",
|
|
108
|
+
replacement: {
|
|
109
|
+
kind: "internal",
|
|
110
|
+
nearestPublicSubpaths: ["providers/replo-provider"]
|
|
111
|
+
}
|
|
112
|
+
});
|
|
170
113
|
}
|
|
171
|
-
async cartUpdateLines({
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
114
|
+
async cartUpdateLines(_args) {
|
|
115
|
+
throw canopyTombstoneError({
|
|
116
|
+
symbol: "CanopyApiGateway",
|
|
117
|
+
subpath: "gateways/canopy-api",
|
|
118
|
+
replacement: {
|
|
119
|
+
kind: "internal",
|
|
120
|
+
nearestPublicSubpaths: ["providers/replo-provider"]
|
|
121
|
+
}
|
|
122
|
+
});
|
|
176
123
|
}
|
|
177
|
-
async cartRemoveLines({
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
124
|
+
async cartRemoveLines(_args) {
|
|
125
|
+
throw canopyTombstoneError({
|
|
126
|
+
symbol: "CanopyApiGateway",
|
|
127
|
+
subpath: "gateways/canopy-api",
|
|
128
|
+
replacement: {
|
|
129
|
+
kind: "internal",
|
|
130
|
+
nearestPublicSubpaths: ["providers/replo-provider"]
|
|
131
|
+
}
|
|
132
|
+
});
|
|
182
133
|
}
|
|
183
|
-
async cartUpdateDiscountCodes({
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
134
|
+
async cartUpdateDiscountCodes(_args) {
|
|
135
|
+
throw canopyTombstoneError({
|
|
136
|
+
symbol: "CanopyApiGateway",
|
|
137
|
+
subpath: "gateways/canopy-api",
|
|
138
|
+
replacement: {
|
|
139
|
+
kind: "internal",
|
|
140
|
+
nearestPublicSubpaths: ["providers/replo-provider"]
|
|
141
|
+
}
|
|
142
|
+
});
|
|
188
143
|
}
|
|
189
144
|
}
|
|
190
145
|
async function getCanopyApiGateway() {
|
|
191
|
-
|
|
146
|
+
throw canopyTombstoneError({
|
|
147
|
+
symbol: "getCanopyApiGateway",
|
|
148
|
+
subpath: "gateways/canopy-api",
|
|
149
|
+
replacement: {
|
|
150
|
+
kind: "internal",
|
|
151
|
+
nearestPublicSubpaths: ["providers/replo-provider"]
|
|
152
|
+
}
|
|
153
|
+
});
|
|
192
154
|
}
|
|
193
155
|
export {
|
|
194
156
|
CanopyApiGatewayError,
|