@replohq/canopy-sdk 2.6.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (389) hide show
  1. package/_vendor/replo-utils/lib/fonts.mjs +1 -0
  2. package/_vendor/replo-utils/lib/geometry.mjs +2 -0
  3. package/_vendor/replo-utils/lib/json.mjs +1 -0
  4. package/_vendor/replo-utils/lib/misc.mjs +1 -0
  5. package/_vendor/replo-utils/lib/posthogReplay.mjs +2 -0
  6. package/_vendor/replo-utils/lib/url.mjs +1 -0
  7. package/_vendor/replo-utils/react/use-iframe-rpc-channel.mjs +1 -1
  8. package/_vendor/schemas/designLibrary.mjs +1 -1
  9. package/_vendor/schemas/generated/consent.d.ts +2 -0
  10. package/_vendor/schemas/generated/selectModeIframeRpc.d.ts +8 -0
  11. package/_vendor/schemas/iframeRpcChannel.mjs +2 -1
  12. package/_vendor/schemas/loaderKeys.d.ts +1 -1
  13. package/_vendor/schemas/loaderKeys.mjs +103 -23
  14. package/_vendor/schemas/money.mjs +1860 -3
  15. package/_vendor/schemas/pageAnnotations.mjs +1 -1
  16. package/_vendor/schemas/routing/match.mjs +1 -0
  17. package/_vendor/schemas/routing/rules.mjs +2 -1
  18. package/_vendor/schemas/selectMode.d.ts +4 -4
  19. package/_vendor/schemas/selectMode.mjs +1 -0
  20. package/_vendor/schemas/selectModeIframeRpc.d.ts +25 -5
  21. package/_vendor/schemas/selectModeIframeRpc.mjs +12 -3
  22. package/analytics/analytics-provider.d.ts +5 -10
  23. package/analytics/analytics-provider.js +14 -101
  24. package/analytics/analytics-provider.js.map +2 -2
  25. package/analytics/get-analytics-sinks.d.ts +2 -19
  26. package/analytics/get-analytics-sinks.js +9 -46
  27. package/analytics/get-analytics-sinks.js.map +2 -2
  28. package/analytics/hooks/use-product-viewed-analytics.d.ts +2 -6
  29. package/analytics/hooks/use-product-viewed-analytics.js +6 -28
  30. package/analytics/hooks/use-product-viewed-analytics.js.map +2 -2
  31. package/analytics/replo-first-party-pixel.d.ts +3 -12
  32. package/analytics/replo-first-party-pixel.js +8 -24
  33. package/analytics/replo-first-party-pixel.js.map +2 -2
  34. package/analytics/replo-pixel-script.d.ts +4 -10
  35. package/analytics/replo-pixel-script.js +9 -23
  36. package/analytics/replo-pixel-script.js.map +2 -2
  37. package/analytics/sinks/ga4-sink.d.ts +10 -9
  38. package/analytics/sinks/ga4-sink.js +99 -50
  39. package/analytics/sinks/ga4-sink.js.map +2 -2
  40. package/analytics/sinks/meta-sink.d.ts +5 -4
  41. package/analytics/sinks/meta-sink.js +82 -29
  42. package/analytics/sinks/meta-sink.js.map +2 -2
  43. package/analytics/sinks/pinterest-sink.d.ts +7 -6
  44. package/analytics/sinks/pinterest-sink.js +82 -49
  45. package/analytics/sinks/pinterest-sink.js.map +2 -2
  46. package/analytics/sinks/reddit-sink.d.ts +8 -7
  47. package/analytics/sinks/reddit-sink.js +82 -53
  48. package/analytics/sinks/reddit-sink.js.map +2 -2
  49. package/analytics/sinks/replo-sink.d.ts +9 -8
  50. package/analytics/sinks/replo-sink.js +89 -37
  51. package/analytics/sinks/replo-sink.js.map +2 -2
  52. package/analytics/sinks/snapchat-sink.d.ts +6 -5
  53. package/analytics/sinks/snapchat-sink.js +82 -40
  54. package/analytics/sinks/snapchat-sink.js.map +2 -2
  55. package/analytics/sinks/tiktok-sink.d.ts +8 -7
  56. package/analytics/sinks/tiktok-sink.js +82 -52
  57. package/analytics/sinks/tiktok-sink.js.map +2 -2
  58. package/analytics/sinks/window-sink.d.ts +11 -14
  59. package/analytics/sinks/window-sink.js +101 -28
  60. package/analytics/sinks/window-sink.js.map +2 -2
  61. package/analytics/utils/analytics-utils.d.ts +4 -2
  62. package/analytics/utils/analytics-utils.js +19 -123
  63. package/analytics/utils/analytics-utils.js.map +2 -2
  64. package/analytics/utils/navigation-tracker.d.ts +2 -1
  65. package/analytics/utils/navigation-tracker.js +37 -30
  66. package/analytics/utils/navigation-tracker.js.map +2 -2
  67. package/analytics/utils/shopify-funnel-gate.d.ts +2 -7
  68. package/analytics/utils/shopify-funnel-gate.js +8 -15
  69. package/analytics/utils/shopify-funnel-gate.js.map +2 -2
  70. package/cart/buy-now-action.d.ts +2 -9
  71. package/cart/buy-now-action.js +5 -97
  72. package/cart/buy-now-action.js.map +2 -2
  73. package/cart/cart-actions.d.ts +12 -56
  74. package/cart/cart-actions.js +88 -68
  75. package/cart/cart-actions.js.map +2 -2
  76. package/cart/cart-loader.d.ts +3 -9
  77. package/cart/cart-loader.js +14 -6
  78. package/cart/cart-loader.js.map +2 -2
  79. package/cart/cart-provider.d.ts +6 -58
  80. package/cart/cart-provider.js +13 -359
  81. package/cart/cart-provider.js.map +3 -3
  82. package/cart/cart-schema.d.ts +2 -1
  83. package/cart/cart-schema.js +12 -64
  84. package/cart/cart-schema.js.map +2 -2
  85. package/cart/cart-types.d.ts +1 -1
  86. package/cart/cart-types.js +5 -4
  87. package/cart/cart-types.js.map +2 -2
  88. package/cart/gateways/cart-constants.d.ts +1 -0
  89. package/cart/gateways/cart-constants.js.map +2 -2
  90. package/cart/gateways/cart-gateway.d.ts +1 -0
  91. package/cart/gateways/cart-gateway.js +13 -12
  92. package/cart/gateways/cart-gateway.js.map +2 -2
  93. package/cart/gateways/cookie-cart-gateway.d.ts +8 -11
  94. package/cart/gateways/cookie-cart-gateway.js +93 -97
  95. package/cart/gateways/cookie-cart-gateway.js.map +2 -2
  96. package/cart/gateways/default-cart-gateway.d.ts +10 -16
  97. package/cart/gateways/default-cart-gateway.js +13 -23
  98. package/cart/gateways/default-cart-gateway.js.map +2 -2
  99. package/cart/gateways/resolver-cart-gateway.d.ts +1 -0
  100. package/cart/gateways/resolver-cart-gateway.js +13 -102
  101. package/cart/gateways/resolver-cart-gateway.js.map +2 -2
  102. package/cart/gateways/stripe-cart-gateway.d.ts +10 -16
  103. package/cart/gateways/stripe-cart-gateway.js +13 -21
  104. package/cart/gateways/stripe-cart-gateway.js.map +2 -2
  105. package/cart/hooks/use-add-to-cart.d.ts +3 -47
  106. package/cart/hooks/use-add-to-cart.js +10 -115
  107. package/cart/hooks/use-add-to-cart.js.map +2 -2
  108. package/cart/hooks/use-buy-now.d.ts +1 -39
  109. package/cart/hooks/use-buy-now.js +5 -55
  110. package/cart/hooks/use-buy-now.js.map +2 -2
  111. package/cart/utils/cart-utils.d.ts +8 -35
  112. package/cart/utils/cart-utils.js +21 -35
  113. package/cart/utils/cart-utils.js.map +2 -2
  114. package/cart/utils/cookie-cart-persistence.d.ts +16 -41
  115. package/cart/utils/cookie-cart-persistence.js +38 -143
  116. package/cart/utils/cookie-cart-persistence.js.map +2 -2
  117. package/cart/utils/variant-to-cart-line.d.ts +12 -42
  118. package/cart/utils/variant-to-cart-line.js +31 -147
  119. package/cart/utils/variant-to-cart-line.js.map +2 -2
  120. package/chunk-UJCSKKID.mjs +27 -0
  121. package/{chunk-OFU2QEDR.mjs → chunk-ZZPQ3E7S.mjs} +50 -5
  122. package/consent/consent-action.d.ts +2 -1
  123. package/consent/consent-action.js +10 -20
  124. package/consent/consent-action.js.map +2 -2
  125. package/consent/consent-actions.d.ts +2 -13
  126. package/consent/consent-actions.js +9 -29
  127. package/consent/consent-actions.js.map +2 -2
  128. package/consent/consent-store.d.ts +9 -36
  129. package/consent/consent-store.js +12 -182
  130. package/consent/consent-store.js.map +2 -2
  131. package/consent/cookie.d.ts +9 -12
  132. package/consent/cookie.js +32 -64
  133. package/consent/cookie.js.map +2 -2
  134. package/consent/replo-scripts.d.ts +5 -18
  135. package/consent/replo-scripts.js +11 -94
  136. package/consent/replo-scripts.js.map +2 -2
  137. package/consent/script-registration-store.d.ts +6 -2
  138. package/consent/script-registration-store.js +33 -47
  139. package/consent/script-registration-store.js.map +2 -2
  140. package/consent/script-snippets.d.ts +4 -18
  141. package/consent/script-snippets.js +19 -127
  142. package/consent/script-snippets.js.map +2 -2
  143. package/consent/window-api.d.ts +4 -15
  144. package/consent/window-api.js +8 -63
  145. package/consent/window-api.js.map +2 -2
  146. package/editor/ClientErrorBoundary.d.ts +4 -10
  147. package/editor/ClientErrorBoundary.js +7 -55
  148. package/editor/ClientErrorBoundary.js.map +2 -2
  149. package/editor/DocumentReadyBeacon.d.ts +3 -1
  150. package/editor/DocumentReadyBeacon.js +6 -3
  151. package/editor/DocumentReadyBeacon.js.map +2 -2
  152. package/editor/LinkInterceptor.d.ts +1 -0
  153. package/editor/LinkInterceptor.js +6 -121
  154. package/editor/LinkInterceptor.js.map +2 -2
  155. package/editor/NextErrorReporter.d.ts +1 -0
  156. package/editor/NextErrorReporter.js +6 -85
  157. package/editor/NextErrorReporter.js.map +2 -2
  158. package/editor/annotations/AnnotationLayerMount.d.ts +1 -0
  159. package/editor/annotations/AnnotationLayerMount.js +6 -6
  160. package/editor/annotations/AnnotationLayerMount.js.map +2 -2
  161. package/editor/annotations/annotationController.d.ts +1 -0
  162. package/editor/annotations/annotationController.js +6 -378
  163. package/editor/annotations/annotationController.js.map +2 -2
  164. package/editor/annotations/bridgeGate.d.ts +4 -7
  165. package/editor/annotations/bridgeGate.js +13 -15
  166. package/editor/annotations/bridgeGate.js.map +2 -2
  167. package/editor/design-library-preview/DesignLibraryPreview.d.ts +1 -0
  168. package/editor/design-library-preview/DesignLibraryPreview.js +6 -86
  169. package/editor/design-library-preview/DesignLibraryPreview.js.map +2 -2
  170. package/editor/posthog-relay.d.ts +1 -10
  171. package/editor/posthog-relay.js +6 -65
  172. package/editor/posthog-relay.js.map +2 -2
  173. package/editor/select-mode/EditorSelection.d.ts +1 -23
  174. package/editor/select-mode/EditorSelection.js +5 -87
  175. package/editor/select-mode/EditorSelection.js.map +2 -2
  176. package/editor/select-mode/annotationFrames.d.ts +9 -9
  177. package/editor/select-mode/annotationFrames.js +22 -103
  178. package/editor/select-mode/annotationFrames.js.map +2 -2
  179. package/editor/select-mode/descriptor/elementDescriptor.d.ts +6 -21
  180. package/editor/select-mode/descriptor/elementDescriptor.js +19 -192
  181. package/editor/select-mode/descriptor/elementDescriptor.js.map +3 -3
  182. package/editor/select-mode/descriptor/styleExtraction.d.ts +4 -2
  183. package/editor/select-mode/descriptor/styleExtraction.js +11 -262
  184. package/editor/select-mode/descriptor/styleExtraction.js.map +2 -2
  185. package/editor/select-mode/displayModeStore.d.ts +2 -0
  186. package/editor/select-mode/displayModeStore.js +14 -39
  187. package/editor/select-mode/displayModeStore.js.map +2 -2
  188. package/editor/select-mode/fast-refresh-relay.d.ts +2 -1
  189. package/editor/select-mode/fast-refresh-relay.js +7 -28
  190. package/editor/select-mode/fast-refresh-relay.js.map +2 -2
  191. package/editor/select-mode/fiber.d.ts +14 -7
  192. package/editor/select-mode/fiber.js +40 -286
  193. package/editor/select-mode/fiber.js.map +2 -2
  194. package/editor/select-mode/hooks/useCrosshairCursor.d.ts +2 -9
  195. package/editor/select-mode/hooks/useCrosshairCursor.js +7 -15
  196. package/editor/select-mode/hooks/useCrosshairCursor.js.map +2 -2
  197. package/editor/select-mode/hooks/useEditModeStateMachine.d.ts +5 -3
  198. package/editor/select-mode/hooks/useEditModeStateMachine.js +13 -228
  199. package/editor/select-mode/hooks/useEditModeStateMachine.js.map +2 -2
  200. package/editor/select-mode/hooks/useOptimisticOverrides.d.ts +2 -1
  201. package/editor/select-mode/hooks/useOptimisticOverrides.js +6 -277
  202. package/editor/select-mode/hooks/useOptimisticOverrides.js.map +2 -2
  203. package/editor/select-mode/hooks/useParentMessaging.d.ts +2 -20
  204. package/editor/select-mode/hooks/useParentMessaging.js +7 -69
  205. package/editor/select-mode/hooks/useParentMessaging.js.map +2 -2
  206. package/editor/select-mode/hooks/useSelectModeController.d.ts +2 -1
  207. package/editor/select-mode/hooks/useSelectModeController.js +6 -40
  208. package/editor/select-mode/hooks/useSelectModeController.js.map +2 -2
  209. package/editor/select-mode/hooks/useSelectionHover.d.ts +2 -16
  210. package/editor/select-mode/hooks/useSelectionHover.js +7 -105
  211. package/editor/select-mode/hooks/useSelectionHover.js.map +2 -2
  212. package/editor/select-mode/hooks/useSelectionInteractions.d.ts +2 -26
  213. package/editor/select-mode/hooks/useSelectionInteractions.js +7 -348
  214. package/editor/select-mode/hooks/useSelectionInteractions.js.map +2 -2
  215. package/editor/select-mode/hooks/useSelectionScrollSync.d.ts +2 -22
  216. package/editor/select-mode/hooks/useSelectionScrollSync.js +7 -65
  217. package/editor/select-mode/hooks/useSelectionScrollSync.js.map +2 -2
  218. package/editor/select-mode/hooks/useSiblingResolution.d.ts +4 -2
  219. package/editor/select-mode/hooks/useSiblingResolution.js +13 -52
  220. package/editor/select-mode/hooks/useSiblingResolution.js.map +2 -2
  221. package/editor/select-mode/iframeRpcChannel.d.ts +10 -349
  222. package/editor/select-mode/iframeRpcChannel.js +23 -79
  223. package/editor/select-mode/iframeRpcChannel.js.map +2 -2
  224. package/editor/select-mode/inlineTextMarks.d.ts +4 -6
  225. package/editor/select-mode/inlineTextMarks.js +13 -18
  226. package/editor/select-mode/inlineTextMarks.js.map +2 -2
  227. package/editor/select-mode/interactions/selectionGeometry.d.ts +19 -61
  228. package/editor/select-mode/interactions/selectionGeometry.js +57 -165
  229. package/editor/select-mode/interactions/selectionGeometry.js.map +2 -2
  230. package/editor/select-mode/selectModeSession.d.ts +1 -0
  231. package/editor/select-mode/selectModeSession.js +6 -3
  232. package/editor/select-mode/selectModeSession.js.map +2 -2
  233. package/editor/select-mode/selectionFrame.d.ts +9 -60
  234. package/editor/select-mode/selectionFrame.js +28 -116
  235. package/editor/select-mode/selectionFrame.js.map +2 -2
  236. package/editor/select-mode/symbolicate.d.ts +2 -1
  237. package/editor/select-mode/symbolicate.js +7 -195
  238. package/editor/select-mode/symbolicate.js.map +2 -2
  239. package/editor/select-mode/tiptapInlineEditor.d.ts +15 -2
  240. package/editor/select-mode/tiptapInlineEditor.js +6 -114
  241. package/editor/select-mode/tiptapInlineEditor.js.map +2 -2
  242. package/env.d.ts +2 -1
  243. package/env.js +10 -37
  244. package/env.js.map +2 -2
  245. package/gateways/canopy-api.d.ts +15 -12
  246. package/gateways/canopy-api.js +122 -160
  247. package/gateways/canopy-api.js.map +2 -2
  248. package/hooks/use-client-value.d.ts +2 -10
  249. package/hooks/use-client-value.js +10 -7
  250. package/hooks/use-client-value.js.map +2 -2
  251. package/hooks/use-formatted-price.d.ts +1 -14
  252. package/hooks/use-formatted-price.js +6 -14
  253. package/hooks/use-formatted-price.js.map +2 -2
  254. package/lib/canopy-error.d.ts +2 -5
  255. package/lib/canopy-error.js +10 -14
  256. package/lib/canopy-error.js.map +2 -2
  257. package/lib/get-query-client.d.ts +2 -1
  258. package/lib/get-query-client.js +8 -27
  259. package/lib/get-query-client.js.map +2 -2
  260. package/lib/integration-utils.d.ts +1 -0
  261. package/lib/integration-utils.js +9 -3
  262. package/lib/integration-utils.js.map +2 -2
  263. package/lib/shopify-utils.d.ts +2 -10
  264. package/lib/shopify-utils.js +10 -2
  265. package/lib/shopify-utils.js.map +2 -2
  266. package/lib/tombstone.d.ts +21 -0
  267. package/lib/tombstone.js +99 -0
  268. package/lib/tombstone.js.map +7 -0
  269. package/lib/url-utils.d.ts +2 -4
  270. package/lib/url-utils.js +10 -3
  271. package/lib/url-utils.js.map +2 -2
  272. package/loaders/collection-loader.d.ts +3 -2
  273. package/loaders/collection-loader.js +5 -48
  274. package/loaders/collection-loader.js.map +2 -2
  275. package/loaders/collection-products-loader.d.ts +3 -2
  276. package/loaders/collection-products-loader.js +5 -51
  277. package/loaders/collection-products-loader.js.map +2 -2
  278. package/loaders/contentful-entries-loader.d.ts +3 -2
  279. package/loaders/contentful-entries-loader.js +5 -71
  280. package/loaders/contentful-entries-loader.js.map +2 -2
  281. package/loaders/contentful-entry-loader.d.ts +3 -2
  282. package/loaders/contentful-entry-loader.js +5 -53
  283. package/loaders/contentful-entry-loader.js.map +2 -2
  284. package/loaders/invoke-loader-action.d.ts +2 -8
  285. package/loaders/invoke-loader-action.js +13 -8
  286. package/loaders/invoke-loader-action.js.map +2 -2
  287. package/loaders/invoke-loader-server.d.ts +2 -14
  288. package/loaders/invoke-loader-server.js +12 -34
  289. package/loaders/invoke-loader-server.js.map +2 -2
  290. package/loaders/invoke-loader.d.ts +6 -12
  291. package/loaders/invoke-loader.js +27 -29
  292. package/loaders/invoke-loader.js.map +2 -2
  293. package/loaders/levanta-product-loader.d.ts +3 -2
  294. package/loaders/levanta-product-loader.js +5 -46
  295. package/loaders/levanta-product-loader.js.map +2 -2
  296. package/loaders/loader-error-boundary.d.ts +9 -15
  297. package/loaders/loader-error-boundary.js +50 -13
  298. package/loaders/loader-error-boundary.js.map +2 -2
  299. package/loaders/loader-keys.d.ts +4 -12
  300. package/loaders/loader-keys.js +6 -1
  301. package/loaders/loader-keys.js.map +2 -2
  302. package/loaders/loader-schemas.d.ts +142 -61
  303. package/loaders/loader-schemas.js +253 -90
  304. package/loaders/loader-schemas.js.map +2 -2
  305. package/loaders/metaobject-loader.d.ts +3 -2
  306. package/loaders/metaobject-loader.js +5 -47
  307. package/loaders/metaobject-loader.js.map +2 -2
  308. package/loaders/metaobjects-loader.d.ts +3 -2
  309. package/loaders/metaobjects-loader.js +5 -53
  310. package/loaders/metaobjects-loader.js.map +2 -2
  311. package/loaders/okendo-review-aggregate-loader.d.ts +9 -10
  312. package/loaders/okendo-review-aggregate-loader.js +5 -49
  313. package/loaders/okendo-review-aggregate-loader.js.map +2 -2
  314. package/loaders/okendo-reviews-loader.d.ts +8 -16
  315. package/loaders/okendo-reviews-loader.js +5 -47
  316. package/loaders/okendo-reviews-loader.js.map +2 -2
  317. package/loaders/prefetch-loaders.d.ts +4 -26
  318. package/loaders/prefetch-loaders.js +5 -40
  319. package/loaders/prefetch-loaders.js.map +2 -2
  320. package/loaders/preview-placeholder.d.ts +8 -22
  321. package/loaders/preview-placeholder.js +47 -209
  322. package/loaders/preview-placeholder.js.map +2 -2
  323. package/loaders/product-loader-args.d.ts +2 -11
  324. package/loaders/product-loader-args.js +6 -12
  325. package/loaders/product-loader-args.js.map +2 -2
  326. package/loaders/product-loader.d.ts +3 -2
  327. package/loaders/product-loader.js +5 -45
  328. package/loaders/product-loader.js.map +2 -2
  329. package/loaders/rebuy-recommendations-loader.d.ts +8 -157
  330. package/loaders/rebuy-recommendations-loader.js +5 -50
  331. package/loaders/rebuy-recommendations-loader.js.map +2 -2
  332. package/loaders/reviews-io-review-aggregate-loader.d.ts +5 -4
  333. package/loaders/reviews-io-review-aggregate-loader.js +5 -36
  334. package/loaders/reviews-io-review-aggregate-loader.js.map +2 -2
  335. package/loaders/reviews-io-reviews-loader.d.ts +5 -4
  336. package/loaders/reviews-io-reviews-loader.js +5 -58
  337. package/loaders/reviews-io-reviews-loader.js.map +2 -2
  338. package/loaders/smile-earning-rules-loader.d.ts +10 -11
  339. package/loaders/smile-earning-rules-loader.js +5 -37
  340. package/loaders/smile-earning-rules-loader.js.map +2 -2
  341. package/loaders/smile-rewards-loader.d.ts +10 -11
  342. package/loaders/smile-rewards-loader.js +5 -37
  343. package/loaders/smile-rewards-loader.js.map +2 -2
  344. package/loaders/smile-vip-tiers-loader.d.ts +9 -10
  345. package/loaders/smile-vip-tiers-loader.js +5 -36
  346. package/loaders/smile-vip-tiers-loader.js.map +2 -2
  347. package/loaders/statsig-experiment-loader.d.ts +3 -8
  348. package/loaders/statsig-experiment-loader.js +5 -74
  349. package/loaders/statsig-experiment-loader.js.map +2 -2
  350. package/loaders/vendor-loader-keys.d.ts +4 -0
  351. package/loaders/vendor-loader-keys.js +9 -0
  352. package/loaders/vendor-loader-keys.js.map +7 -0
  353. package/loaders/yotpo-review-aggregate-loader.d.ts +5 -4
  354. package/loaders/yotpo-review-aggregate-loader.js +5 -43
  355. package/loaders/yotpo-review-aggregate-loader.js.map +2 -2
  356. package/loaders/yotpo-reviews-loader.d.ts +5 -4
  357. package/loaders/yotpo-reviews-loader.js +5 -58
  358. package/loaders/yotpo-reviews-loader.js.map +2 -2
  359. package/money.d.ts +9 -9
  360. package/money.js +25 -6
  361. package/money.js.map +2 -2
  362. package/next/config.d.ts +3 -1
  363. package/next/config.js +11 -85
  364. package/next/config.js.map +2 -2
  365. package/next/image-loader.d.ts +2 -1
  366. package/next/image-loader.js +7 -47
  367. package/next/image-loader.js.map +2 -2
  368. package/next/open-next.d.ts +4 -2
  369. package/next/open-next.js +6 -19
  370. package/next/open-next.js.map +2 -2
  371. package/orders/order-status-schema.d.ts +28 -13
  372. package/orders/order-status-schema.js +45 -13
  373. package/orders/order-status-schema.js.map +2 -2
  374. package/orders/order-status.d.ts +2 -8
  375. package/orders/order-status.js +6 -36
  376. package/orders/order-status.js.map +2 -2
  377. package/package.json +1 -12
  378. package/providers/query-provider.d.ts +3 -1
  379. package/providers/query-provider.js +10 -6
  380. package/providers/query-provider.js.map +2 -2
  381. package/providers/replo-provider.d.ts +3 -1
  382. package/providers/replo-provider.js +6 -37
  383. package/providers/replo-provider.js.map +2 -2
  384. package/routing/evaluate.d.ts +3 -3
  385. package/routing/evaluate.js +5 -40
  386. package/routing/evaluate.js.map +2 -2
  387. package/routing/rules.d.ts +3 -11
  388. package/routing/rules.js +7 -1
  389. package/routing/rules.js.map +2 -2
@@ -0,0 +1,27 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ export { __commonJS, __toESM };
@@ -1,9 +1,54 @@
1
- import { v4 } from 'uuid';
1
+ import { randomUUID, randomFillSync } from 'crypto';
2
2
  import { z } from 'zod';
3
3
 
4
+ // ../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm/stringify.js
5
+ var byteToHex = [];
6
+ for (let i = 0; i < 256; ++i) {
7
+ byteToHex.push((i + 256).toString(16).slice(1));
8
+ }
9
+ function unsafeStringify(arr, offset = 0) {
10
+ return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
11
+ }
12
+ var rnds8Pool = new Uint8Array(256);
13
+ var poolPtr = rnds8Pool.length;
14
+ function rng() {
15
+ if (poolPtr > rnds8Pool.length - 16) {
16
+ randomFillSync(rnds8Pool);
17
+ poolPtr = 0;
18
+ }
19
+ return rnds8Pool.slice(poolPtr, poolPtr += 16);
20
+ }
21
+ var native_default = { randomUUID };
22
+
23
+ // ../../node_modules/.pnpm/uuid@11.1.0/node_modules/uuid/dist/esm/v4.js
24
+ function v4(options, buf, offset) {
25
+ if (native_default.randomUUID && !buf && !options) {
26
+ return native_default.randomUUID();
27
+ }
28
+ options = options || {};
29
+ const rnds = options.random ?? options.rng?.() ?? rng();
30
+ if (rnds.length < 16) {
31
+ throw new Error("Random bytes length must be >= 16");
32
+ }
33
+ rnds[6] = rnds[6] & 15 | 64;
34
+ rnds[8] = rnds[8] & 63 | 128;
35
+ if (buf) {
36
+ offset = offset || 0;
37
+ if (offset < 0 || offset + 16 > buf.length) {
38
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
39
+ }
40
+ for (let i = 0; i < 16; ++i) {
41
+ buf[offset + i] = rnds[i];
42
+ }
43
+ return buf;
44
+ }
45
+ return unsafeStringify(rnds);
46
+ }
47
+ var v4_default = v4;
48
+
4
49
  // ../replo-utils/lib/crypto.ts
5
- function randomUUID() {
6
- return v4();
50
+ function randomUUID2() {
51
+ return v4_default();
7
52
  }
8
53
  var ReploError = class _ReploError extends Error {
9
54
  config;
@@ -12,7 +57,7 @@ var ReploError = class _ReploError extends Error {
12
57
  super(config.message);
13
58
  this.message = config.message ?? this.constructor.name;
14
59
  this.config = config;
15
- this.id = randomUUID();
60
+ this.id = randomUUID2();
16
61
  const cause = config.cause;
17
62
  if (cause) {
18
63
  this.cause = cause;
@@ -160,4 +205,4 @@ var IframeRpcChannelInvalidInputError = class extends IframeRpcChannelError {
160
205
  }
161
206
  };
162
207
 
163
- export { IframeRpcChannelConfigurationError, IframeRpcChannelInvalidInputError, IframeRpcChannelRemoteError, IframeRpcChannelTimeoutError, IframeRpcChannelUnknownMethodError, IframeRpcChannelUnsubscribedError, ReploError, randomUUID };
208
+ export { IframeRpcChannelConfigurationError, IframeRpcChannelInvalidInputError, IframeRpcChannelRemoteError, IframeRpcChannelTimeoutError, IframeRpcChannelUnknownMethodError, IframeRpcChannelUnsubscribedError, ReploError, randomUUID2 as randomUUID };
@@ -1,6 +1,7 @@
1
1
  import type { ConsentAction } from "../_vendor/schemas/generated/consent";
2
2
  import type { ConsentCategories } from "./cookie";
3
- export declare function deriveConsentAction({ previous, next, }: {
3
+ /** @deprecated Use a supported public @replohq/sdk API for this domain; deriveConsentAction has no direct replacement. */
4
+ export declare function deriveConsentAction(_args: {
4
5
  previous: {
5
6
  decidedAt: number | null;
6
7
  categories: ConsentCategories;
@@ -1,23 +1,13 @@
1
- const NON_NECESSARY_CATEGORIES = [
2
- "analytics",
3
- "marketing",
4
- "preferences",
5
- "sale_of_data"
6
- ];
7
- function deriveConsentAction({
8
- previous,
9
- next
10
- }) {
11
- const anyGranted = NON_NECESSARY_CATEGORIES.some(
12
- (category) => next[category]
13
- );
14
- if (previous.decidedAt === null) {
15
- return anyGranted ? "accept" : "reject";
16
- }
17
- if (!anyGranted) {
18
- return "withdraw";
19
- }
20
- return "update";
1
+ import { canopyTombstoneError } from "../lib/tombstone";
2
+ function deriveConsentAction(_args) {
3
+ throw canopyTombstoneError({
4
+ symbol: "deriveConsentAction",
5
+ subpath: "consent/consent-action",
6
+ replacement: {
7
+ kind: "internal",
8
+ nearestPublicSubpaths: ["consent/consent-store", "consent/replo-scripts"]
9
+ }
10
+ });
21
11
  }
22
12
  export {
23
13
  deriveConsentAction
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../consent/consent-action.ts"],
4
- "sourcesContent": ["import type { ConsentAction, ConsentCategory } from \"schemas/generated/consent\";\nimport type { ConsentCategories } from \"./cookie\";\n\n/**\n * Pure mapping from a consent decision (previous state vs the resulting state)\n * to the legal-record `action` written to the proof-of-consent audit log.\n *\n * Only non-necessary categories matter (`necessary` is always granted). The\n * mapping is:\n * - first decision (`decidedAt === null`), some category granted -> \"accept\"\n * - first decision, nothing granted -> \"reject\"\n * - later decision that leaves nothing granted -> \"withdraw\"\n * - any other later change -> \"update\"\n *\n * `withdraw` is reserved for going from some consent to none (the GDPR\n * withdrawal right); a partial reduction that still leaves something granted is\n * an `update`.\n */\nconst NON_NECESSARY_CATEGORIES: Exclude<ConsentCategory, \"necessary\">[] = [\n \"analytics\",\n \"marketing\",\n \"preferences\",\n \"sale_of_data\",\n];\n\nexport function deriveConsentAction({\n previous,\n next,\n}: {\n previous: { decidedAt: number | null; categories: ConsentCategories };\n next: ConsentCategories;\n}): ConsentAction {\n const anyGranted = NON_NECESSARY_CATEGORIES.some(\n (category) => next[category],\n );\n\n if (previous.decidedAt === null) {\n return anyGranted ? \"accept\" : \"reject\";\n }\n if (!anyGranted) {\n return \"withdraw\";\n }\n return \"update\";\n}\n"],
5
- "mappings": "AAkBA,MAAM,2BAAoE;AAAA,EACxE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AACF,GAGkB;AAChB,QAAM,aAAa,yBAAyB;AAAA,IAC1C,CAAC,aAAa,KAAK,QAAQ;AAAA,EAC7B;AAEA,MAAI,SAAS,cAAc,MAAM;AAC/B,WAAO,aAAa,WAAW;AAAA,EACjC;AACA,MAAI,CAAC,YAAY;AACf,WAAO;AAAA,EACT;AACA,SAAO;AACT;",
4
+ "sourcesContent": ["import type { ConsentAction } from \"schemas/generated/consent\";\nimport type { ConsentCategories } from \"./cookie\";\n\nimport { canopyTombstoneError } from \"../lib/tombstone\";\n\n/** @deprecated Use a supported public @replohq/sdk API for this domain; deriveConsentAction has no direct replacement. */\nexport function deriveConsentAction(_args: {\n previous: {\n decidedAt: number | null;\n categories: ConsentCategories;\n };\n next: ConsentCategories;\n}): ConsentAction {\n throw canopyTombstoneError({\n symbol: \"deriveConsentAction\",\n subpath: \"consent/consent-action\",\n replacement: {\n kind: \"internal\",\n nearestPublicSubpaths: [\"consent/consent-store\", \"consent/replo-scripts\"],\n },\n });\n}\n"],
5
+ "mappings": "AAGA,SAAS,4BAA4B;AAG9B,SAAS,oBAAoB,OAMlB;AAChB,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,18 +1,7 @@
1
1
  import type { ConsentAction, ConsentMode } from "../_vendor/schemas/generated/consent";
2
2
  import type { ConsentCategories } from "./cookie";
3
- /**
4
- * Records a proof-of-consent decision by forwarding it to analytics-fire.
5
- *
6
- * Runs server-side — exactly like the cart's actions — so the browser never needs
7
- * the project id or the analytics-fire URL: both are read from the worker env
8
- * here via `getEnv()`. The visitor's user-agent / referrer / coarse geo come from
9
- * the incoming request headers and are forwarded so analytics-fire derives them
10
- * the same way it does for the legacy pixel.
11
- *
12
- * Best-effort and self-disabling: no-ops when analytics-fire isn't configured
13
- * (e.g. lean local dev) and never throws into the page.
14
- */
15
- export declare function recordConsentAction(decision: {
3
+ /** @deprecated Use a supported public @replohq/sdk API for this domain; recordConsentAction has no direct replacement. */
4
+ export declare function recordConsentAction(_decision: {
16
5
  consentId: string;
17
6
  action: ConsentAction;
18
7
  /** Full resulting consent state (all categories), not a diff. */
@@ -1,34 +1,14 @@
1
1
  "use server";
2
- import { headers } from "next/headers";
3
- import { getEnv } from "../env";
4
- async function recordConsentAction(decision) {
5
- try {
6
- const { PROJECT_ID, ANALYTICS_FIRE_API_URL } = await getEnv();
7
- if (!ANALYTICS_FIRE_API_URL) {
8
- return;
2
+ import { canopyTombstoneError } from "../lib/tombstone";
3
+ async function recordConsentAction(_decision) {
4
+ throw canopyTombstoneError({
5
+ symbol: "recordConsentAction",
6
+ subpath: "consent/consent-actions",
7
+ replacement: {
8
+ kind: "internal",
9
+ nearestPublicSubpaths: ["consent/consent-store", "consent/replo-scripts"]
9
10
  }
10
- const incoming = await headers();
11
- const body = {
12
- consentId: decision.consentId,
13
- projectId: PROJECT_ID,
14
- decidedAt: decision.decidedAt,
15
- action: decision.action,
16
- categories: decision.categories,
17
- consentMode: decision.consentMode,
18
- policyVersion: decision.policyVersion
19
- };
20
- await fetch(`${ANALYTICS_FIRE_API_URL}/api/v1/consent`, {
21
- method: "POST",
22
- headers: {
23
- "content-type": "application/json",
24
- "user-agent": incoming.get("user-agent") ?? "",
25
- referer: incoming.get("referer") ?? "",
26
- "cf-ipcountry": incoming.get("cf-ipcountry") ?? ""
27
- },
28
- body: JSON.stringify(body)
29
- });
30
- } catch {
31
- }
11
+ });
32
12
  }
33
13
  export {
34
14
  recordConsentAction
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../consent/consent-actions.ts"],
4
- "sourcesContent": ["\"use server\";\n\nimport type {\n ConsentAction,\n ConsentMode,\n ConsentRecordRequest,\n} from \"schemas/generated/consent\";\nimport type { ConsentCategories } from \"./cookie\";\n\nimport { headers } from \"next/headers\";\n\nimport { getEnv } from \"../env\";\n\n/**\n * Records a proof-of-consent decision by forwarding it to analytics-fire.\n *\n * Runs server-side \u2014 exactly like the cart's actions \u2014 so the browser never needs\n * the project id or the analytics-fire URL: both are read from the worker env\n * here via `getEnv()`. The visitor's user-agent / referrer / coarse geo come from\n * the incoming request headers and are forwarded so analytics-fire derives them\n * the same way it does for the legacy pixel.\n *\n * Best-effort and self-disabling: no-ops when analytics-fire isn't configured\n * (e.g. lean local dev) and never throws into the page.\n */\nexport async function recordConsentAction(decision: {\n consentId: string;\n action: ConsentAction;\n /** Full resulting consent state (all categories), not a diff. */\n categories: ConsentCategories;\n consentMode: ConsentMode;\n decidedAt: number;\n /**\n * Site-owned policy version declared by the consent caller (via\n * `useConsent({ version })`); the site bumps it when the banner copy or\n * category set changes.\n */\n policyVersion: number;\n}) {\n // Best-effort and total: never reject (the caller fire-and-forgets it), even if\n // the Cloudflare env / request context is unavailable.\n try {\n const { PROJECT_ID, ANALYTICS_FIRE_API_URL } = await getEnv();\n if (!ANALYTICS_FIRE_API_URL) {\n return;\n }\n\n const incoming = await headers();\n const body: ConsentRecordRequest = {\n consentId: decision.consentId,\n projectId: PROJECT_ID,\n decidedAt: decision.decidedAt,\n action: decision.action,\n categories: decision.categories,\n consentMode: decision.consentMode,\n policyVersion: decision.policyVersion,\n };\n\n await fetch(`${ANALYTICS_FIRE_API_URL}/api/v1/consent`, {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n \"user-agent\": incoming.get(\"user-agent\") ?? \"\",\n referer: incoming.get(\"referer\") ?? \"\",\n \"cf-ipcountry\": incoming.get(\"cf-ipcountry\") ?? \"\",\n },\n body: JSON.stringify(body),\n });\n } catch {\n // Consent logging must never surface an error in the page.\n }\n}\n"],
5
- "mappings": ";AASA,SAAS,eAAe;AAExB,SAAS,cAAc;AAcvB,eAAsB,oBAAoB,UAavC;AAGD,MAAI;AACF,UAAM,EAAE,YAAY,uBAAuB,IAAI,MAAM,OAAO;AAC5D,QAAI,CAAC,wBAAwB;AAC3B;AAAA,IACF;AAEA,UAAM,WAAW,MAAM,QAAQ;AAC/B,UAAM,OAA6B;AAAA,MACjC,WAAW,SAAS;AAAA,MACpB,WAAW;AAAA,MACX,WAAW,SAAS;AAAA,MACpB,QAAQ,SAAS;AAAA,MACjB,YAAY,SAAS;AAAA,MACrB,aAAa,SAAS;AAAA,MACtB,eAAe,SAAS;AAAA,IAC1B;AAEA,UAAM,MAAM,GAAG,sBAAsB,mBAAmB;AAAA,MACtD,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,gBAAgB;AAAA,QAChB,cAAc,SAAS,IAAI,YAAY,KAAK;AAAA,QAC5C,SAAS,SAAS,IAAI,SAAS,KAAK;AAAA,QACpC,gBAAgB,SAAS,IAAI,cAAc,KAAK;AAAA,MAClD;AAAA,MACA,MAAM,KAAK,UAAU,IAAI;AAAA,IAC3B,CAAC;AAAA,EACH,QAAQ;AAAA,EAER;AACF;",
4
+ "sourcesContent": ["\"use server\";\n\n/* oxlint-disable replo/no-void-return-type -- Tombstone declarations preserve exact return types for consumer compatibility. */\nimport type { ConsentAction, ConsentMode } from \"schemas/generated/consent\";\nimport type { ConsentCategories } from \"./cookie\";\n\nimport { canopyTombstoneError } from \"../lib/tombstone\";\n\n/** @deprecated Use a supported public @replohq/sdk API for this domain; recordConsentAction has no direct replacement. */\nexport async function recordConsentAction(_decision: {\n consentId: string;\n action: ConsentAction;\n /** Full resulting consent state (all categories), not a diff. */\n categories: ConsentCategories;\n consentMode: ConsentMode;\n decidedAt: number;\n /**\n * Site-owned policy version declared by the consent caller (via\n * `useConsent({ version })`); the site bumps it when the banner copy or\n * category set changes.\n */\n policyVersion: number;\n}): Promise<void> {\n throw canopyTombstoneError({\n symbol: \"recordConsentAction\",\n subpath: \"consent/consent-actions\",\n replacement: {\n kind: \"internal\",\n nearestPublicSubpaths: [\"consent/consent-store\", \"consent/replo-scripts\"],\n },\n });\n}\n"],
5
+ "mappings": ";AAMA,SAAS,4BAA4B;AAGrC,eAAsB,oBAAoB,WAaxB;AAChB,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,55 +1,30 @@
1
1
  import type { ConsentCategory, ConsentMode } from "../_vendor/schemas/generated/consent";
2
2
  import type { ConsentCategories } from "./cookie";
3
- /**
4
- * Framework-agnostic, cookie-backed consent store. Lives as a single module
5
- * singleton so `ReploScripts`, the site's consent banner, and `AnalyticsProvider`
6
- * all share the same state regardless of where they sit in the React tree — no
7
- * provider-ancestor relationship is required.
8
- *
9
- * Consent-dependent work (script injection, banner visibility) happens on the
10
- * client (effects / post-mount), so there is no SSR/hydration mismatch. The
11
- * client reads the (non-httpOnly) consent cookie directly, so no server seed is
12
- * needed. The whole-site `mode` comes from the `data-replo-consent-mode`
13
- * attribute on `<html>`.
14
- */
15
3
  export interface ConsentState {
16
4
  mode: ConsentMode;
17
5
  categories: ConsentCategories;
18
- /** Epoch ms when the visitor last made a choice, or null if undecided. */
19
6
  decidedAt: number | null;
20
- /**
21
- * Persistent pseudonymous per-browser id linking a visitor's consent history.
22
- * Absent until the first `commit()` (and on legacy pre-id cookies, until the
23
- * next interaction lazily backfills it).
24
- */
25
7
  consentId?: string;
26
8
  }
27
- export declare const consentStore: {
9
+ type ConsentStore = {
28
10
  getSnapshot(): ConsentState;
29
11
  getServerSnapshot(): ConsentState;
30
12
  subscribe(listener: () => void): () => void;
31
- /** Grant every consent category. */
32
13
  accept(options?: {
33
14
  policyVersion?: number;
34
15
  }): void;
35
- /** Deny every non-necessary category. */
36
16
  reject(options?: {
37
17
  policyVersion?: number;
38
18
  }): void;
39
- /** Set a subset of categories, leaving the rest at their current value. */
40
- updateCategories({ next, policyVersion, }: {
19
+ updateCategories(options: {
41
20
  next: Partial<ConsentCategories>;
42
21
  policyVersion?: number;
43
22
  }): void;
44
- /** Test-only: reset cached state so the next read recomputes. */
45
23
  reset(): void;
46
24
  };
25
+ /** @deprecated Use consentStore from @replohq/sdk/consent/consent-store. */
26
+ export declare const consentStore: ConsentStore;
47
27
  export interface UseConsentOptions {
48
- /**
49
- * Site-owned consent policy version, stamped onto each proof-of-consent
50
- * record so a decision can be tied to the exact banner the visitor saw.
51
- * Bump it whenever the banner copy or category set changes. Defaults to 1.
52
- */
53
28
  version?: number;
54
29
  }
55
30
  export interface UseConsentResult extends ConsentState {
@@ -57,13 +32,11 @@ export interface UseConsentResult extends ConsentState {
57
32
  reject(): void;
58
33
  updateCategories(next: Partial<ConsentCategories>): void;
59
34
  }
60
- export declare function useConsent(options?: UseConsentOptions): UseConsentResult;
61
- /**
62
- * Whether a script requiring `requiredConsent` is allowed to load right now.
63
- * `mode === "off"` always allows; otherwise every required category must be
64
- * granted. An empty requirement list is always allowed.
65
- */
66
- export declare function isConsentAllowed({ state, requiredConsent, }: {
35
+ /** @deprecated Use useConsent from @replohq/sdk/consent/consent-store. */
36
+ export declare function useConsent(_options?: UseConsentOptions): UseConsentResult;
37
+ /** @deprecated Use isConsentAllowed from @replohq/sdk/consent/consent-store. */
38
+ export declare function isConsentAllowed(_options: {
67
39
  state: ConsentState;
68
40
  requiredConsent: ConsentCategory[];
69
41
  }): boolean;
42
+ export {};
@@ -1,190 +1,20 @@
1
1
  "use client";
2
- import { useSyncExternalStore } from "react";
3
- import { deriveConsentAction } from "./consent-action";
4
- import { recordConsentAction } from "./consent-actions";
5
- import {
6
- CONSENT_COOKIE_MAX_AGE_SECONDS,
7
- CONSENT_COOKIE_NAME,
8
- DENIED_CATEGORIES,
9
- GRANTED_CATEGORIES,
10
- parseConsentCookie,
11
- serializeConsentCookieValue
12
- } from "./cookie";
13
- const TOGGLEABLE_CATEGORIES = [
14
- "analytics",
15
- "marketing",
16
- "preferences",
17
- "sale_of_data"
18
- ];
19
- const SERVER_SNAPSHOT = Object.freeze({
20
- mode: "off",
21
- categories: DENIED_CATEGORIES,
22
- decidedAt: null
2
+ import { canopyTombstoneError, canopyTombstoneObject } from "../lib/tombstone";
3
+ const consentStore = canopyTombstoneObject({
4
+ symbol: "consentStore",
5
+ subpath: "consent/consent-store"
23
6
  });
24
- const listeners = /* @__PURE__ */ new Set();
25
- let snapshot = null;
26
- function isConsentMode(value) {
27
- return value === "off" || value === "simple" || value === "per-category";
28
- }
29
- function resolveMode() {
30
- if (typeof window === "undefined") {
31
- return "off";
32
- }
33
- const attribute = document.documentElement.dataset.reploConsentMode;
34
- return isConsentMode(attribute) ? attribute : "off";
35
- }
36
- const DEFAULT_CONSENT_POLICY_VERSION = 1;
37
- function computeSnapshot() {
38
- if (typeof window === "undefined") {
39
- return SERVER_SNAPSHOT;
40
- }
41
- const mode = resolveMode();
42
- const fromCookie = parseConsentCookie(document.cookie);
43
- if (fromCookie) {
44
- return {
45
- mode,
46
- categories: {
47
- necessary: true,
48
- analytics: fromCookie.categories.analytics,
49
- marketing: fromCookie.categories.marketing,
50
- preferences: fromCookie.categories.preferences,
51
- sale_of_data: fromCookie.categories.sale_of_data
52
- },
53
- decidedAt: fromCookie.decidedAt,
54
- consentId: fromCookie.consentId
55
- };
56
- }
57
- return { mode, categories: DENIED_CATEGORIES, decidedAt: null };
58
- }
59
- function writeCookie(categories, decidedAt, consentId) {
60
- if (typeof document === "undefined") {
61
- return;
62
- }
63
- const value = serializeConsentCookieValue({
64
- categories,
65
- decidedAt,
66
- consentId
7
+ function useConsent(_options = {}) {
8
+ throw canopyTombstoneError({
9
+ symbol: "useConsent",
10
+ subpath: "consent/consent-store"
67
11
  });
68
- document.cookie = `${CONSENT_COOKIE_NAME}=${value}; path=/; max-age=${CONSENT_COOKIE_MAX_AGE_SECONDS}; SameSite=Lax`;
69
- }
70
- function notify() {
71
- for (const listener of listeners) {
72
- listener();
73
- }
74
12
  }
75
- function commit({
76
- categories,
77
- policyVersion = DEFAULT_CONSENT_POLICY_VERSION
78
- }) {
79
- const previous = consentStore.getSnapshot();
80
- const decidedAt = Date.now();
81
- const consentId = previous.consentId ?? crypto.randomUUID();
82
- const resultingCategories = {
83
- ...categories,
84
- necessary: true
85
- };
86
- writeCookie(categories, decidedAt, consentId);
87
- snapshot = {
88
- mode: previous.mode,
89
- categories: resultingCategories,
90
- decidedAt,
91
- consentId
92
- };
93
- notify();
94
- const wasDowngrade = previous.decidedAt !== null && TOGGLEABLE_CATEGORIES.some((category) => {
95
- return previous.categories[category] && !categories[category];
13
+ function isConsentAllowed(_options) {
14
+ throw canopyTombstoneError({
15
+ symbol: "isConsentAllowed",
16
+ subpath: "consent/consent-store"
96
17
  });
97
- const reloadIfDowngraded = () => {
98
- if (wasDowngrade && typeof window !== "undefined") {
99
- window.location.reload();
100
- }
101
- };
102
- if (previous.mode !== "off") {
103
- void recordConsentAction({
104
- consentId,
105
- action: deriveConsentAction({ previous, next: resultingCategories }),
106
- categories: resultingCategories,
107
- consentMode: previous.mode,
108
- decidedAt,
109
- policyVersion
110
- }).finally(reloadIfDowngraded);
111
- } else {
112
- reloadIfDowngraded();
113
- }
114
- }
115
- const consentStore = {
116
- getSnapshot() {
117
- if (!snapshot) {
118
- snapshot = computeSnapshot();
119
- }
120
- return snapshot;
121
- },
122
- getServerSnapshot() {
123
- return SERVER_SNAPSHOT;
124
- },
125
- subscribe(listener) {
126
- listeners.add(listener);
127
- return () => {
128
- listeners.delete(listener);
129
- };
130
- },
131
- /** Grant every consent category. */
132
- accept(options = {}) {
133
- commit({
134
- categories: GRANTED_CATEGORIES,
135
- policyVersion: options.policyVersion
136
- });
137
- },
138
- /** Deny every non-necessary category. */
139
- reject(options = {}) {
140
- commit({
141
- categories: DENIED_CATEGORIES,
142
- policyVersion: options.policyVersion
143
- });
144
- },
145
- /** Set a subset of categories, leaving the rest at their current value. */
146
- updateCategories({
147
- next,
148
- policyVersion
149
- }) {
150
- const current = consentStore.getSnapshot().categories;
151
- commit({
152
- categories: { ...current, ...next, necessary: true },
153
- policyVersion
154
- });
155
- },
156
- /** Test-only: reset cached state so the next read recomputes. */
157
- reset() {
158
- snapshot = null;
159
- }
160
- };
161
- function useConsent(options = {}) {
162
- const policyVersion = options.version;
163
- const state = useSyncExternalStore(
164
- consentStore.subscribe,
165
- consentStore.getSnapshot,
166
- consentStore.getServerSnapshot
167
- );
168
- return {
169
- ...state,
170
- accept: () => consentStore.accept({ policyVersion }),
171
- reject: () => consentStore.reject({ policyVersion }),
172
- updateCategories: (next) => {
173
- consentStore.updateCategories({ next, policyVersion });
174
- }
175
- };
176
- }
177
- function isConsentAllowed({
178
- state,
179
- requiredConsent
180
- }) {
181
- if (state.mode === "off") {
182
- return true;
183
- }
184
- if (requiredConsent.length === 0) {
185
- return true;
186
- }
187
- return requiredConsent.every((category) => state.categories[category]);
188
18
  }
189
19
  export {
190
20
  consentStore,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../consent/consent-store.ts"],
4
- "sourcesContent": ["\"use client\";\n\nimport type { ConsentCategory, ConsentMode } from \"schemas/generated/consent\";\nimport type { ConsentCategories } from \"./cookie\";\n\nimport { useSyncExternalStore } from \"react\";\n\nimport { deriveConsentAction } from \"./consent-action\";\nimport { recordConsentAction } from \"./consent-actions\";\nimport {\n CONSENT_COOKIE_MAX_AGE_SECONDS,\n CONSENT_COOKIE_NAME,\n DENIED_CATEGORIES,\n GRANTED_CATEGORIES,\n parseConsentCookie,\n serializeConsentCookieValue,\n} from \"./cookie\";\n\n/**\n * Framework-agnostic, cookie-backed consent store. Lives as a single module\n * singleton so `ReploScripts`, the site's consent banner, and `AnalyticsProvider`\n * all share the same state regardless of where they sit in the React tree \u2014 no\n * provider-ancestor relationship is required.\n *\n * Consent-dependent work (script injection, banner visibility) happens on the\n * client (effects / post-mount), so there is no SSR/hydration mismatch. The\n * client reads the (non-httpOnly) consent cookie directly, so no server seed is\n * needed. The whole-site `mode` comes from the `data-replo-consent-mode`\n * attribute on `<html>`.\n */\n\nexport interface ConsentState {\n mode: ConsentMode;\n categories: ConsentCategories;\n /** Epoch ms when the visitor last made a choice, or null if undecided. */\n decidedAt: number | null;\n /**\n * Persistent pseudonymous per-browser id linking a visitor's consent history.\n * Absent until the first `commit()` (and on legacy pre-id cookies, until the\n * next interaction lazily backfills it).\n */\n consentId?: string;\n}\n\n// The non-necessary categories a visitor can grant or revoke. `necessary` is\n// always granted and never toggled.\nconst TOGGLEABLE_CATEGORIES: Exclude<ConsentCategory, \"necessary\">[] = [\n \"analytics\",\n \"marketing\",\n \"preferences\",\n \"sale_of_data\",\n];\n\n// A stable reference for SSR / first hydration render. Consent-dependent DOM is\n// only produced on the client, so this constant never causes a mismatch.\nconst SERVER_SNAPSHOT: ConsentState = Object.freeze({\n mode: \"off\",\n categories: DENIED_CATEGORIES,\n decidedAt: null,\n});\n\nconst listeners = new Set<() => void>();\nlet snapshot: ConsentState | null = null;\n\nfunction isConsentMode(value: string | null | undefined): value is ConsentMode {\n return value === \"off\" || value === \"simple\" || value === \"per-category\";\n}\n\nfunction resolveMode(): ConsentMode {\n if (typeof window === \"undefined\") {\n return \"off\";\n }\n const attribute = document.documentElement.dataset.reploConsentMode;\n return isConsentMode(attribute) ? attribute : \"off\";\n}\n\n// Used when the consent caller doesn't declare a policy version via\n// `useConsent({ version })` or the store method options.\nconst DEFAULT_CONSENT_POLICY_VERSION = 1;\n\nfunction computeSnapshot(): ConsentState {\n if (typeof window === \"undefined\") {\n return SERVER_SNAPSHOT;\n }\n\n const mode = resolveMode();\n\n const fromCookie = parseConsentCookie(document.cookie);\n if (fromCookie) {\n return {\n mode,\n categories: {\n necessary: true,\n analytics: fromCookie.categories.analytics,\n marketing: fromCookie.categories.marketing,\n preferences: fromCookie.categories.preferences,\n sale_of_data: fromCookie.categories.sale_of_data,\n },\n decidedAt: fromCookie.decidedAt,\n consentId: fromCookie.consentId,\n };\n }\n\n return { mode, categories: DENIED_CATEGORIES, decidedAt: null };\n}\n\nfunction writeCookie(\n categories: ConsentCategories,\n decidedAt: number,\n consentId: string,\n) {\n if (typeof document === \"undefined\") {\n return;\n }\n const value = serializeConsentCookieValue({\n categories,\n decidedAt,\n consentId,\n });\n document.cookie = `${CONSENT_COOKIE_NAME}=${value}; path=/; max-age=${CONSENT_COOKIE_MAX_AGE_SECONDS}; SameSite=Lax`;\n}\n\nfunction notify() {\n for (const listener of listeners) {\n listener();\n }\n}\n\nfunction commit({\n categories,\n policyVersion = DEFAULT_CONSENT_POLICY_VERSION,\n}: {\n categories: ConsentCategories;\n policyVersion?: number;\n}) {\n const previous = consentStore.getSnapshot();\n const decidedAt = Date.now();\n // Reuse the visitor's existing id, or mint one on the first decision (also\n // lazily backfills legacy pre-id cookies). `crypto.randomUUID` is available in\n // every browser we target and on the server (where commit() never runs).\n const consentId = previous.consentId ?? crypto.randomUUID();\n const resultingCategories: ConsentCategories = {\n ...categories,\n necessary: true,\n };\n writeCookie(categories, decidedAt, consentId);\n snapshot = {\n mode: previous.mode,\n categories: resultingCategories,\n decidedAt,\n consentId,\n };\n notify();\n\n // Revocation cannot unload an already-loaded vendor. If the visitor had\n // previously decided and is now turning a granted category off, reload so the\n // page renders without those scripts. Deferred until after the audit record is\n // sent so the reload doesn't cancel the in-flight server action.\n const wasDowngrade =\n previous.decidedAt !== null &&\n TOGGLEABLE_CATEGORIES.some((category) => {\n return previous.categories[category] && !categories[category];\n });\n const reloadIfDowngraded = () => {\n if (wasDowngrade && typeof window !== \"undefined\") {\n window.location.reload();\n }\n };\n\n // Proof-of-consent audit record (ungated by consent, but only on managed\n // sites). On `mode === \"off\"` there is no banner/consent UX, so a\n // `setTrackingConsent()` call from a third-party script would only produce\n // meaningless `consent_mode: \"off\"` noise \u2014 skip it. Egress runs through a\n // server action (like the cart) so the client never needs the project id or\n // analytics-fire URL.\n if (previous.mode !== \"off\") {\n void recordConsentAction({\n consentId,\n action: deriveConsentAction({ previous, next: resultingCategories }),\n categories: resultingCategories,\n consentMode: previous.mode,\n decidedAt,\n policyVersion,\n }).finally(reloadIfDowngraded);\n } else {\n reloadIfDowngraded();\n }\n}\n\nexport const consentStore = {\n getSnapshot(): ConsentState {\n if (!snapshot) {\n snapshot = computeSnapshot();\n }\n return snapshot;\n },\n getServerSnapshot(): ConsentState {\n return SERVER_SNAPSHOT;\n },\n subscribe(listener: () => void): () => void {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n /** Grant every consent category. */\n accept(options: { policyVersion?: number } = {}) {\n commit({\n categories: GRANTED_CATEGORIES,\n policyVersion: options.policyVersion,\n });\n },\n /** Deny every non-necessary category. */\n reject(options: { policyVersion?: number } = {}) {\n commit({\n categories: DENIED_CATEGORIES,\n policyVersion: options.policyVersion,\n });\n },\n /** Set a subset of categories, leaving the rest at their current value. */\n updateCategories({\n next,\n policyVersion,\n }: {\n next: Partial<ConsentCategories>;\n policyVersion?: number;\n }) {\n const current = consentStore.getSnapshot().categories;\n commit({\n categories: { ...current, ...next, necessary: true },\n policyVersion,\n });\n },\n /** Test-only: reset cached state so the next read recomputes. */\n reset() {\n snapshot = null;\n },\n};\n\nexport interface UseConsentOptions {\n /**\n * Site-owned consent policy version, stamped onto each proof-of-consent\n * record so a decision can be tied to the exact banner the visitor saw.\n * Bump it whenever the banner copy or category set changes. Defaults to 1.\n */\n version?: number;\n}\n\nexport interface UseConsentResult extends ConsentState {\n accept(): void;\n reject(): void;\n updateCategories(next: Partial<ConsentCategories>): void;\n}\n\nexport function useConsent(options: UseConsentOptions = {}): UseConsentResult {\n const policyVersion = options.version;\n const state = useSyncExternalStore(\n consentStore.subscribe,\n consentStore.getSnapshot,\n consentStore.getServerSnapshot,\n );\n return {\n ...state,\n accept: () => consentStore.accept({ policyVersion }),\n reject: () => consentStore.reject({ policyVersion }),\n updateCategories: (next) => {\n consentStore.updateCategories({ next, policyVersion });\n },\n };\n}\n\n/**\n * Whether a script requiring `requiredConsent` is allowed to load right now.\n * `mode === \"off\"` always allows; otherwise every required category must be\n * granted. An empty requirement list is always allowed.\n */\nexport function isConsentAllowed({\n state,\n requiredConsent,\n}: {\n state: ConsentState;\n requiredConsent: ConsentCategory[];\n}): boolean {\n if (state.mode === \"off\") {\n return true;\n }\n if (requiredConsent.length === 0) {\n return true;\n }\n return requiredConsent.every((category) => state.categories[category]);\n}\n"],
5
- "mappings": "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",
4
+ "sourcesContent": ["\"use client\";\n\nimport type { ConsentCategory, ConsentMode } from \"schemas/generated/consent\";\nimport type { ConsentCategories } from \"./cookie\";\n\nimport { canopyTombstoneError, canopyTombstoneObject } from \"../lib/tombstone\";\n\nexport interface ConsentState {\n mode: ConsentMode;\n categories: ConsentCategories;\n decidedAt: number | null;\n consentId?: string;\n}\n\ntype ConsentStore = {\n getSnapshot(): ConsentState;\n getServerSnapshot(): ConsentState;\n subscribe(listener: () => void): () => void;\n accept(options?: { policyVersion?: number }): void;\n reject(options?: { policyVersion?: number }): void;\n updateCategories(options: {\n next: Partial<ConsentCategories>;\n policyVersion?: number;\n }): void;\n reset(): void;\n};\n\n/** @deprecated Use consentStore from @replohq/sdk/consent/consent-store. */\nexport const consentStore: ConsentStore = canopyTombstoneObject<ConsentStore>({\n symbol: \"consentStore\",\n subpath: \"consent/consent-store\",\n});\n\nexport interface UseConsentOptions {\n version?: number;\n}\n\nexport interface UseConsentResult extends ConsentState {\n accept(): void;\n reject(): void;\n updateCategories(next: Partial<ConsentCategories>): void;\n}\n\n/** @deprecated Use useConsent from @replohq/sdk/consent/consent-store. */\nexport function useConsent(_options: UseConsentOptions = {}): UseConsentResult {\n throw canopyTombstoneError({\n symbol: \"useConsent\",\n subpath: \"consent/consent-store\",\n });\n}\n\n/** @deprecated Use isConsentAllowed from @replohq/sdk/consent/consent-store. */\nexport function isConsentAllowed(_options: {\n state: ConsentState;\n requiredConsent: ConsentCategory[];\n}): boolean {\n throw canopyTombstoneError({\n symbol: \"isConsentAllowed\",\n subpath: \"consent/consent-store\",\n });\n}\n"],
5
+ "mappings": ";AAKA,SAAS,sBAAsB,6BAA6B;AAuBrD,MAAM,eAA6B,sBAAoC;AAAA,EAC5E,QAAQ;AAAA,EACR,SAAS;AACX,CAAC;AAaM,SAAS,WAAW,WAA8B,CAAC,GAAqB;AAC7E,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,EACX,CAAC;AACH;AAGO,SAAS,iBAAiB,UAGrB;AACV,QAAM,qBAAqB;AAAA,IACzB,QAAQ;AAAA,IACR,SAAS;AAAA,EACX,CAAC;AACH;",
6
6
  "names": []
7
7
  }
@@ -1,10 +1,9 @@
1
1
  import type { ConsentCategory } from "../_vendor/schemas/generated/consent";
2
- /**
3
- * Pure (non-React, framework-agnostic) consent cookie helpers used by the client
4
- * store (`consent-store.ts`).
5
- */
2
+ /** @deprecated Use a supported public @replohq/sdk API for this domain; CONSENT_COOKIE_NAME remains only for primitive compatibility. */
6
3
  export declare const CONSENT_COOKIE_NAME = "replo_consent";
4
+ /** @deprecated Use a supported public @replohq/sdk API for this domain; CONSENT_COOKIE_VERSION remains only for primitive compatibility. */
7
5
  export declare const CONSENT_COOKIE_VERSION = 1;
6
+ /** @deprecated Use a supported public @replohq/sdk API for this domain; CONSENT_COOKIE_MAX_AGE_SECONDS remains only for primitive compatibility. */
8
7
  export declare const CONSENT_COOKIE_MAX_AGE_SECONDS: number;
9
8
  export type ConsentCategories = Record<ConsentCategory, boolean>;
10
9
  /** Persisted cookie payload. `necessary` is always granted and never stored. */
@@ -20,16 +19,14 @@ export interface ConsentCookiePayload {
20
19
  sale_of_data: boolean;
21
20
  };
22
21
  }
22
+ /** @deprecated Use a supported public @replohq/sdk API for this domain; DENIED_CATEGORIES has no direct replacement. */
23
23
  export declare const DENIED_CATEGORIES: ConsentCategories;
24
+ /** @deprecated Use a supported public @replohq/sdk API for this domain; GRANTED_CATEGORIES has no direct replacement. */
24
25
  export declare const GRANTED_CATEGORIES: ConsentCategories;
25
- /**
26
- * Parse a raw `document.cookie` (or a single cookie value) into a payload.
27
- * Returns null for missing, malformed, or stale-version cookies so callers
28
- * treat the visitor as undecided and re-prompt.
29
- */
30
- export declare function parseConsentCookie(rawCookie: string | undefined): ConsentCookiePayload | null;
31
- /** Serialize categories into the JSON-encoded cookie value (not the full Set-Cookie line). */
32
- export declare function serializeConsentCookieValue({ categories, decidedAt, consentId, }: {
26
+ /** @deprecated Use a supported public @replohq/sdk API for this domain; parseConsentCookie has no direct replacement. */
27
+ export declare function parseConsentCookie(_rawCookie: string | undefined): ConsentCookiePayload | null;
28
+ /** @deprecated Use a supported public @replohq/sdk API for this domain; serializeConsentCookieValue has no direct replacement. */
29
+ export declare function serializeConsentCookieValue(_args: {
33
30
  categories: ConsentCategories;
34
31
  decidedAt: number;
35
32
  consentId?: string;