@rovela-ai/sdk 0.17.0 → 0.18.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.
Files changed (126) hide show
  1. package/dist/admin/api/orders.d.ts.map +1 -1
  2. package/dist/admin/api/orders.js +10 -3
  3. package/dist/admin/api/orders.js.map +1 -1
  4. package/dist/admin/api/refund.d.ts.map +1 -1
  5. package/dist/admin/api/refund.js +1 -0
  6. package/dist/admin/api/refund.js.map +1 -1
  7. package/dist/admin/api/return.d.ts.map +1 -1
  8. package/dist/admin/api/return.js +1 -0
  9. package/dist/admin/api/return.js.map +1 -1
  10. package/dist/admin/api/settings.d.ts.map +1 -1
  11. package/dist/admin/api/settings.js +27 -4
  12. package/dist/admin/api/settings.js.map +1 -1
  13. package/dist/admin/api/stats.d.ts.map +1 -1
  14. package/dist/admin/api/stats.js +5 -2
  15. package/dist/admin/api/stats.js.map +1 -1
  16. package/dist/admin/components/CookieBannerConfigurator.d.ts +9 -0
  17. package/dist/admin/components/CookieBannerConfigurator.d.ts.map +1 -0
  18. package/dist/admin/components/CookieBannerConfigurator.js +97 -0
  19. package/dist/admin/components/CookieBannerConfigurator.js.map +1 -0
  20. package/dist/admin/components/CustomerDetails.d.ts.map +1 -1
  21. package/dist/admin/components/CustomerDetails.js +5 -17
  22. package/dist/admin/components/CustomerDetails.js.map +1 -1
  23. package/dist/admin/components/CustomerTable.d.ts.map +1 -1
  24. package/dist/admin/components/CustomerTable.js +4 -8
  25. package/dist/admin/components/CustomerTable.js.map +1 -1
  26. package/dist/admin/components/FilesManager.d.ts.map +1 -1
  27. package/dist/admin/components/FilesManager.js +7 -3
  28. package/dist/admin/components/FilesManager.js.map +1 -1
  29. package/dist/admin/components/OrderDetails.d.ts.map +1 -1
  30. package/dist/admin/components/OrderDetails.js +4 -10
  31. package/dist/admin/components/OrderDetails.js.map +1 -1
  32. package/dist/admin/components/OrderTable.d.ts.map +1 -1
  33. package/dist/admin/components/OrderTable.js +4 -10
  34. package/dist/admin/components/OrderTable.js.map +1 -1
  35. package/dist/admin/components/RecentOrders.d.ts.map +1 -1
  36. package/dist/admin/components/RecentOrders.js +4 -9
  37. package/dist/admin/components/RecentOrders.js.map +1 -1
  38. package/dist/admin/components/RevenueChart.d.ts.map +1 -1
  39. package/dist/admin/components/RevenueChart.js +6 -11
  40. package/dist/admin/components/RevenueChart.js.map +1 -1
  41. package/dist/admin/components/StoreSettings.d.ts.map +1 -1
  42. package/dist/admin/components/StoreSettings.js +54 -15
  43. package/dist/admin/components/StoreSettings.js.map +1 -1
  44. package/dist/admin/components/UsersTable.d.ts.map +1 -1
  45. package/dist/admin/components/UsersTable.js +5 -7
  46. package/dist/admin/components/UsersTable.js.map +1 -1
  47. package/dist/admin/components/index.d.ts +2 -0
  48. package/dist/admin/components/index.d.ts.map +1 -1
  49. package/dist/admin/components/index.js +1 -0
  50. package/dist/admin/components/index.js.map +1 -1
  51. package/dist/admin/hooks/useAdminDates.d.ts +11 -0
  52. package/dist/admin/hooks/useAdminDates.d.ts.map +1 -0
  53. package/dist/admin/hooks/useAdminDates.js +46 -0
  54. package/dist/admin/hooks/useAdminDates.js.map +1 -0
  55. package/dist/admin/types.d.ts +3 -0
  56. package/dist/admin/types.d.ts.map +1 -1
  57. package/dist/analytics/api/dashboard.d.ts.map +1 -1
  58. package/dist/analytics/api/dashboard.js +4 -1
  59. package/dist/analytics/api/dashboard.js.map +1 -1
  60. package/dist/analytics/server/queries.d.ts +1 -1
  61. package/dist/analytics/server/queries.d.ts.map +1 -1
  62. package/dist/analytics/server/queries.js +6 -4
  63. package/dist/analytics/server/queries.js.map +1 -1
  64. package/dist/analytics/views/DashboardsView.d.ts.map +1 -1
  65. package/dist/analytics/views/DashboardsView.js +5 -7
  66. package/dist/analytics/views/DashboardsView.js.map +1 -1
  67. package/dist/analytics/views/EventsView.d.ts.map +1 -1
  68. package/dist/analytics/views/EventsView.js +7 -2
  69. package/dist/analytics/views/EventsView.js.map +1 -1
  70. package/dist/analytics/views/VisitorsView.d.ts.map +1 -1
  71. package/dist/analytics/views/VisitorsView.js +6 -2
  72. package/dist/analytics/views/VisitorsView.js.map +1 -1
  73. package/dist/core/StoreSettingsProvider.js +1 -1
  74. package/dist/core/StoreSettingsProvider.js.map +1 -1
  75. package/dist/core/api/settings.d.ts.map +1 -1
  76. package/dist/core/api/settings.js +4 -2
  77. package/dist/core/api/settings.js.map +1 -1
  78. package/dist/core/cookie-consent/CookieBanner.d.ts.map +1 -1
  79. package/dist/core/cookie-consent/CookieBanner.js +266 -92
  80. package/dist/core/cookie-consent/CookieBanner.js.map +1 -1
  81. package/dist/core/cookie-consent/CookieConsentProvider.d.ts +11 -2
  82. package/dist/core/cookie-consent/CookieConsentProvider.d.ts.map +1 -1
  83. package/dist/core/cookie-consent/CookieConsentProvider.js +26 -7
  84. package/dist/core/cookie-consent/CookieConsentProvider.js.map +1 -1
  85. package/dist/core/cookie-consent/CookiePreferencesLink.d.ts.map +1 -1
  86. package/dist/core/cookie-consent/CookiePreferencesLink.js +5 -3
  87. package/dist/core/cookie-consent/CookiePreferencesLink.js.map +1 -1
  88. package/dist/core/cookie-consent/index.d.ts +2 -1
  89. package/dist/core/cookie-consent/index.d.ts.map +1 -1
  90. package/dist/core/cookie-consent/index.js +1 -0
  91. package/dist/core/cookie-consent/index.js.map +1 -1
  92. package/dist/core/cookie-consent/types.d.ts +70 -4
  93. package/dist/core/cookie-consent/types.d.ts.map +1 -1
  94. package/dist/core/cookie-consent/types.js +117 -5
  95. package/dist/core/cookie-consent/types.js.map +1 -1
  96. package/dist/core/dates.d.ts +15 -0
  97. package/dist/core/dates.d.ts.map +1 -0
  98. package/dist/core/dates.js +22 -0
  99. package/dist/core/dates.js.map +1 -0
  100. package/dist/core/db/queries.d.ts +7 -5
  101. package/dist/core/db/queries.d.ts.map +1 -1
  102. package/dist/core/db/queries.js +35 -16
  103. package/dist/core/db/queries.js.map +1 -1
  104. package/dist/core/db/schema.d.ts +19 -0
  105. package/dist/core/db/schema.d.ts.map +1 -1
  106. package/dist/core/db/schema.js +7 -1
  107. package/dist/core/db/schema.js.map +1 -1
  108. package/dist/core/index.d.ts +1 -0
  109. package/dist/core/index.d.ts.map +1 -1
  110. package/dist/core/index.js +2 -0
  111. package/dist/core/index.js.map +1 -1
  112. package/dist/core/useStoreFormatting.js +1 -1
  113. package/dist/core/useStoreFormatting.js.map +1 -1
  114. package/dist/emails/config.d.ts +6 -0
  115. package/dist/emails/config.d.ts.map +1 -1
  116. package/dist/emails/config.js +19 -1
  117. package/dist/emails/config.js.map +1 -1
  118. package/dist/emails/send/auth.js +1 -1
  119. package/dist/emails/send/auth.js.map +1 -1
  120. package/dist/emails/types.d.ts +2 -0
  121. package/dist/emails/types.d.ts.map +1 -1
  122. package/dist/emails/utils.d.ts +2 -2
  123. package/dist/emails/utils.d.ts.map +1 -1
  124. package/dist/emails/utils.js +8 -2
  125. package/dist/emails/utils.js.map +1 -1
  126. package/package.json +1 -1
@@ -17,7 +17,7 @@
17
17
  * and want scripts to run unconditionally.
18
18
  */
19
19
  import * as React from 'react';
20
- import type { ConsentCategories, ConsentRecord } from './types';
20
+ import type { ConsentCategories, ConsentRecord, CookieConsentConfig } from './types';
21
21
  interface CookieConsentContextValue {
22
22
  /** The current consent record. `decidedAt === null` means the user
23
23
  * has not yet chosen. */
@@ -40,14 +40,23 @@ interface CookieConsentContextValue {
40
40
  preferencesOpen: boolean;
41
41
  /** Banner uses this to close its own preferences layer after Save. */
42
42
  closePreferences: () => void;
43
+ /** Merchant banner configuration (layout / theme / copy / reopen). */
44
+ config: CookieConsentConfig;
43
45
  }
44
46
  export interface CookieConsentProviderProps {
45
47
  /** Master toggle from store_settings.cookie_banner_enabled. When
46
48
  * `false`, the banner never renders and scripts get implicit grant. */
47
49
  enabled: boolean;
50
+ /** Merchant banner configuration (store_settings.cookie_consent,
51
+ * sanitized server-side). Absent = every default = pre-config behavior. */
52
+ config?: CookieConsentConfig | null;
53
+ /** Region rule verdict, computed SERVER-side from the visitor's IP
54
+ * country (config.region === 'eu-only' + non-EU visitor). Exempt
55
+ * visitors get the same implicit-grant path as a disabled banner. */
56
+ regionExempt?: boolean;
48
57
  children: React.ReactNode;
49
58
  }
50
- export declare function CookieConsentProvider({ enabled, children, }: CookieConsentProviderProps): import("react/jsx-runtime").JSX.Element;
59
+ export declare function CookieConsentProvider({ enabled, config, regionExempt, children, }: CookieConsentProviderProps): import("react/jsx-runtime").JSX.Element;
51
60
  export declare function useConsentContext(): CookieConsentContextValue;
52
61
  export {};
53
62
  //# sourceMappingURL=CookieConsentProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CookieConsentProvider.d.ts","sourceRoot":"","sources":["../../../src/core/cookie-consent/CookieConsentProvider.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAsB/D,UAAU,yBAAyB;IACjC;8BAC0B;IAC1B,OAAO,EAAE,aAAa,CAAA;IACtB;;mEAE+D;IAC/D,UAAU,EAAE,OAAO,CAAA;IACnB;kEAC8D;IAC9D,cAAc,EAAE,OAAO,CAAA;IACvB;iCAC6B;IAC7B,MAAM,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IACxD;qCACiC;IACjC,eAAe,EAAE,MAAM,IAAI,CAAA;IAC3B;yEACqE;IACrE,eAAe,EAAE,OAAO,CAAA;IACxB,sEAAsE;IACtE,gBAAgB,EAAE,MAAM,IAAI,CAAA;CAC7B;AA6ED,MAAM,WAAW,0BAA0B;IACzC;4EACwE;IACxE,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED,wBAAgB,qBAAqB,CAAC,EACpC,OAAO,EACP,QAAQ,GACT,EAAE,0BAA0B,2CAgE5B;AAMD,wBAAgB,iBAAiB,IAAI,yBAAyB,CAQ7D"}
1
+ {"version":3,"file":"CookieConsentProvider.d.ts","sourceRoot":"","sources":["../../../src/core/cookie-consent/CookieConsentProvider.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAsBpF,UAAU,yBAAyB;IACjC;8BAC0B;IAC1B,OAAO,EAAE,aAAa,CAAA;IACtB;;mEAE+D;IAC/D,UAAU,EAAE,OAAO,CAAA;IACnB;kEAC8D;IAC9D,cAAc,EAAE,OAAO,CAAA;IACvB;iCAC6B;IAC7B,MAAM,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IACxD;qCACiC;IACjC,eAAe,EAAE,MAAM,IAAI,CAAA;IAC3B;yEACqE;IACrE,eAAe,EAAE,OAAO,CAAA;IACxB,sEAAsE;IACtE,gBAAgB,EAAE,MAAM,IAAI,CAAA;IAC5B,sEAAsE;IACtE,MAAM,EAAE,mBAAmB,CAAA;CAC5B;AA6ED,MAAM,WAAW,0BAA0B;IACzC;4EACwE;IACxE,OAAO,EAAE,OAAO,CAAA;IAChB;gFAC4E;IAC5E,MAAM,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACnC;;0EAEsE;IACtE,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED,wBAAgB,qBAAqB,CAAC,EACpC,OAAO,EACP,MAAM,EACN,YAAoB,EACpB,QAAQ,GACT,EAAE,0BAA0B,2CAmF5B;AAMD,wBAAgB,iBAAiB,IAAI,yBAAyB,CAQ7D"}
@@ -97,7 +97,10 @@ function writeStoredConsent(record) {
97
97
  // for the session; user re-prompts next visit.
98
98
  }
99
99
  }
100
- export function CookieConsentProvider({ enabled, children, }) {
100
+ export function CookieConsentProvider({ enabled, config, regionExempt = false, children, }) {
101
+ // Region-exempt visitors follow the exact disabled-banner path: implicit
102
+ // grant, no banner, no preferences affordances.
103
+ const effectiveEnabled = enabled && !regionExempt;
101
104
  // SSR-safe initial state — provider always starts with "not decided";
102
105
  // the post-mount effect reads localStorage and updates. Means we don't
103
106
  // hydration-mismatch between server and client.
@@ -106,9 +109,9 @@ export function CookieConsentProvider({ enabled, children, }) {
106
109
  const [preferencesOpen, setPreferencesOpen] = React.useState(false);
107
110
  // On mount, read the stored decision (if any within re-prompt window).
108
111
  React.useEffect(() => {
109
- if (!enabled) {
110
- // Admin disabled the banner grant everything so analytics/
111
- // marketing scripts can run. This is the merchant's call.
112
+ if (!effectiveEnabled) {
113
+ // Admin disabled the banner (or the visitor is outside the configured
114
+ // region) grant everything so analytics/marketing scripts can run.
112
115
  setConsent(fullGrant());
113
116
  setHydrated(true);
114
117
  return;
@@ -117,7 +120,22 @@ export function CookieConsentProvider({ enabled, children, }) {
117
120
  if (stored)
118
121
  setConsent(stored);
119
122
  setHydrated(true);
120
- }, [enabled]);
123
+ }, [effectiveEnabled]);
124
+ // Pixel bridge: expose the consent state to NON-React scripts (CC-installed
125
+ // pixel tags, Google Consent Mode wiring). `window.rovelaConsent` is the
126
+ // current state; 'rovela:consent-changed' fires on every change so tags can
127
+ // gate + update consent-mode signals without importing the hook.
128
+ React.useEffect(() => {
129
+ if (typeof window === 'undefined')
130
+ return;
131
+ const detail = {
132
+ analytics: consent.analytics,
133
+ marketing: consent.marketing,
134
+ decided: consent.decidedAt !== null,
135
+ };
136
+ window.rovelaConsent = detail;
137
+ window.dispatchEvent(new CustomEvent('rovela:consent-changed', { detail }));
138
+ }, [consent]);
121
139
  const update = React.useCallback((categories) => {
122
140
  const next = {
123
141
  essential: true,
@@ -138,12 +156,13 @@ export function CookieConsentProvider({ enabled, children, }) {
138
156
  const value = React.useMemo(() => ({
139
157
  consent,
140
158
  hasDecided: consent.decidedAt !== null,
141
- bannerDisabled: !enabled,
159
+ bannerDisabled: !effectiveEnabled,
142
160
  update,
143
161
  openPreferences,
144
162
  preferencesOpen,
145
163
  closePreferences,
146
- }), [consent, enabled, update, openPreferences, preferencesOpen, closePreferences]);
164
+ config: config ?? {},
165
+ }), [consent, effectiveEnabled, config, update, openPreferences, preferencesOpen, closePreferences]);
147
166
  // Don't flash children with stale SSR state → the first client render
148
167
  // is default (not-decided) which is safe: no scripts gate on it yet.
149
168
  void hydrated;
@@ -1 +1 @@
1
- {"version":3,"file":"CookieConsentProvider.js","sourceRoot":"","sources":["../../../src/core/cookie-consent/CookieConsentProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,sDAAsD;AACtD,MAAM,WAAW,GAAG,uBAAuB,CAAA;AAE3C;;mCAEmC;AACnC,MAAM,OAAO,GAAG,CAAC,CAAA;AAEjB;oCACoC;AACpC,MAAM,mBAAmB,GAAG,GAAG,CAAA;AA8B/B,MAAM,oBAAoB,GACxB,KAAK,CAAC,aAAa,CAAmC,IAAI,CAAC,CAAA;AAE7D,gFAAgF;AAChF,WAAW;AACX,gFAAgF;AAEhF,SAAS,cAAc;IACrB,OAAO;QACL,SAAS,EAAE,IAAI;QACf,SAAS,EAAE,KAAK;QAChB,SAAS,EAAE,KAAK;QAChB,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,OAAO;KACjB,CAAA;AACH,CAAC;AAED,SAAS,SAAS;IAChB,OAAO;QACL,SAAS,EAAE,IAAI;QACf,SAAS,EAAE,IAAI;QACf,SAAS,EAAE,IAAI;QACf,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,OAAO,EAAE,OAAO;KACjB,CAAA;AACH,CAAC;AAED,g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AAI,CAAC,CAAA;IAC1B,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,MAAM,eAAe,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QAC7C,kBAAkB,CAAC,IAAI,CAAC,CAAA;IAC1B,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,MAAM,gBAAgB,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QAC9C,kBAAkB,CAAC,KAAK,CAAC,CAAA;IAC3B,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,MAAM,KAAK,GAA8B,KAAK,CAAC,OAAO,CACpD,GAAG,EAAE,CAAC,CAAC;QACL,OAAO;QACP,UAAU,EAAE,OAAO,CAAC,SAAS,KAAK,IAAI;QACtC,cAAc,EAAE,CAAC,OAAO;QACxB,MAAM;QACN,eAAe;QACf,eAAe;QACf,gBAAgB;KACjB,CAAC,EACF,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,CAAC,CAC/E,CAAA;IAED,sEAAsE;IACtE,qEAAqE;IACrE,KAAK,QAAQ,CAAA;IAEb,OAAO,CACL,KAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACxC,QAAQ,GACqB,CACjC,CAAA;AACH,CAAC;AAED,gFAAgF;AAChF,gBAAgB;AAChB,gFAAgF;AAEhF,MAAM,UAAU,iBAAiB;IAC/B,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAA;IAClD,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAAA;IACH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
1
+ {"version":3,"file":"CookieConsentProvider.js","sourceRoot":"","sources":["../../../src/core/cookie-consent/CookieConsentProvider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;;GAiB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OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CookiePreferencesLink.d.ts","sourceRoot":"","sources":["../../../src/core/cookie-consent/CookiePreferencesLink.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAC3C,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAC7C,SAAS,GAAG,MAAM,CACnB,CAAA;AAED,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,0BAA0B,kDAa5B"}
1
+ {"version":3,"file":"CookiePreferencesLink.d.ts","sourceRoot":"","sources":["../../../src/core/cookie-consent/CookiePreferencesLink.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAC3C,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAC7C,SAAS,GAAG,MAAM,CACnB,CAAA;AAED,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,0BAA0B,kDAe5B"}
@@ -4,10 +4,12 @@ import { useConsentContext } from './CookieConsentProvider';
4
4
  import { useT } from '../i18n';
5
5
  export function CookiePreferencesLink({ children, ...props }) {
6
6
  const t = useT();
7
- const { openPreferences, bannerDisabled } = useConsentContext();
7
+ const { openPreferences, bannerDisabled, config } = useConsentContext();
8
8
  // If the merchant has disabled the banner entirely, there are no
9
- // preferences to manage — don't render the link at all.
10
- if (bannerDisabled)
9
+ // preferences to manage — don't render the link at all. Same when the
10
+ // reopen affordance is configured as badge-ONLY (the floating badge is
11
+ // the sole reopen surface then).
12
+ if (bannerDisabled || config.reopen === 'badge')
11
13
  return null;
12
14
  return (_jsx("button", { type: "button", onClick: openPreferences, ...props, children: children ?? t('consent.title') }));
13
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CookiePreferencesLink.js","sourceRoot":"","sources":["../../../src/core/cookie-consent/CookiePreferencesLink.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAeZ,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAO9B,MAAM,UAAU,qBAAqB,CAAC,EACpC,QAAQ,EACR,GAAG,KAAK,EACmB;IAC3B,MAAM,CAAC,GAAG,IAAI,EAAE,CAAA;IAChB,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,GAAG,iBAAiB,EAAE,CAAA;IAE/D,iEAAiE;IACjE,wDAAwD;IACxD,IAAI,cAAc;QAAE,OAAO,IAAI,CAAA;IAE/B,OAAO,CACL,iBAAQ,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,eAAe,KAAM,KAAK,YACtD,QAAQ,IAAI,CAAC,CAAC,eAAe,CAAC,GACxB,CACV,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"CookiePreferencesLink.js","sourceRoot":"","sources":["../../../src/core/cookie-consent/CookiePreferencesLink.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAeZ,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAO9B,MAAM,UAAU,qBAAqB,CAAC,EACpC,QAAQ,EACR,GAAG,KAAK,EACmB;IAC3B,MAAM,CAAC,GAAG,IAAI,EAAE,CAAA;IAChB,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAA;IAEvE,iEAAiE;IACjE,sEAAsE;IACtE,uEAAuE;IACvE,iCAAiC;IACjC,IAAI,cAAc,IAAI,MAAM,CAAC,MAAM,KAAK,OAAO;QAAE,OAAO,IAAI,CAAA;IAE5D,OAAO,CACL,iBAAQ,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,eAAe,KAAM,KAAK,YACtD,QAAQ,IAAI,CAAC,CAAC,eAAe,CAAC,GACxB,CACV,CAAA;AACH,CAAC"}
@@ -13,5 +13,6 @@ export { CookieConsentProvider, type CookieConsentProviderProps, } from './Cooki
13
13
  export { CookieBanner } from './CookieBanner';
14
14
  export { CookiePreferencesLink, type CookiePreferencesLinkProps, } from './CookiePreferencesLink';
15
15
  export { useCookieConsent, type UseCookieConsentReturn } from './useCookieConsent';
16
- export type { ConsentCategories, ConsentRecord, CategoryKey } from './types';
16
+ export type { ConsentCategories, ConsentRecord, CategoryKey, CookieConsentConfig, ConsentBannerLayout, ConsentBannerPosition, ConsentBannerTheme, ConsentBannerColors, ConsentCopyOverrides, ConsentRegionRule, ConsentReopenAffordance, } from './types';
17
+ export { CONSENT_EU_REGION, consentRegionExempt, sanitizeCookieConsentConfig, } from './types';
17
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/cookie-consent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EACL,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAClF,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/cookie-consent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EACL,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAClF,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,2BAA2B,GAC5B,MAAM,SAAS,CAAA"}
@@ -13,4 +13,5 @@ export { CookieConsentProvider, } from './CookieConsentProvider';
13
13
  export { CookieBanner } from './CookieBanner';
14
14
  export { CookiePreferencesLink, } from './CookiePreferencesLink';
15
15
  export { useCookieConsent } from './useCookieConsent';
16
+ export { CONSENT_EU_REGION, consentRegionExempt, sanitizeCookieConsentConfig, } from './types';
16
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/cookie-consent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,qBAAqB,GAEtB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EACL,qBAAqB,GAEtB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,gBAAgB,EAA+B,MAAM,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/cookie-consent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,qBAAqB,GAEtB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EACL,qBAAqB,GAEtB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,gBAAgB,EAA+B,MAAM,oBAAoB,CAAA;AAclF,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,2BAA2B,GAC5B,MAAM,SAAS,CAAA"}
@@ -1,10 +1,16 @@
1
1
  /**
2
- * Cookie consent types (R021).
2
+ * Cookie consent types + banner configuration (R021).
3
3
  *
4
- * Shared shape between provider, banner, hook. Keep lean — the minimum
5
- * viable EDPB-compliant categorization is Essential / Analytics /
6
- * Marketing. We do NOT ship per-vendor granularity; categories are the
4
+ * Consent state stays lean — the minimum viable EDPB-compliant
5
+ * categorization is Essential / Analytics / Marketing; categories are the
7
6
  * contract any storefront script follows via `useCookieConsent()`.
7
+ *
8
+ * COMPLIANCE GUARDRAILS ARE NOT CONFIGURABLE — reject parity, no pre-ticked
9
+ * boxes, close-equals-refusal, the three-category model and the 12-month
10
+ * re-consent window are hard-coded in the banner. The config below only
11
+ * shapes presentation (layout, colors, copy), audience (region rule) and
12
+ * the reopen affordance. That is the guarantee: when the merchant enables
13
+ * the banner, the compliant behavior cannot be configured away.
8
14
  */
9
15
  export interface ConsentCategories {
10
16
  /** Strictly necessary (cart, session, login). Always on, never
@@ -28,4 +34,64 @@ export interface ConsentRecord extends ConsentCategories {
28
34
  version: number;
29
35
  }
30
36
  export type CategoryKey = 'analytics' | 'marketing';
37
+ export type ConsentBannerLayout = 'card' | 'bar' | 'modal';
38
+ export type ConsentBannerPosition = 'bottom-left' | 'bottom-right' | 'bottom-center';
39
+ export type ConsentBannerTheme = 'auto' | 'light' | 'dark' | 'custom';
40
+ export type ConsentRegionRule = 'worldwide' | 'eu-only';
41
+ export type ConsentReopenAffordance = 'link' | 'badge' | 'both';
42
+ export interface ConsentBannerColors {
43
+ /** Card/bar background. */
44
+ background?: string;
45
+ /** Body text color. */
46
+ text?: string;
47
+ /** Accept-all button background. */
48
+ accent?: string;
49
+ /** Accept-all button text. */
50
+ accentText?: string;
51
+ }
52
+ /** Per-locale copy overrides. Missing keys fall back to the i18n catalog. */
53
+ export interface ConsentCopyOverrides {
54
+ title?: string;
55
+ intro?: string;
56
+ acceptAll?: string;
57
+ rejectAll?: string;
58
+ customize?: string;
59
+ }
60
+ export interface CookieConsentConfig {
61
+ /** Banner shell: floating card (default) / full-width bar / centered modal. */
62
+ layout?: ConsentBannerLayout;
63
+ /** Corner for the card layout (bar is always bottom, modal always center). */
64
+ position?: ConsentBannerPosition;
65
+ /** 'auto' (default) derives from the store's CSS tokens; light/dark fix
66
+ * the neutrals; 'custom' uses `colors`. */
67
+ theme?: ConsentBannerTheme;
68
+ colors?: ConsentBannerColors;
69
+ /** Per-locale copy overrides keyed by locale code ('en', 'fr', ...). */
70
+ copy?: Record<string, ConsentCopyOverrides>;
71
+ /** Who sees the banner. 'eu-only' shows it to EU/EEA/UK/CH visitors and
72
+ * grants-by-default elsewhere; 'worldwide' (default) shows it to everyone. */
73
+ region?: ConsentRegionRule;
74
+ /** How users re-open preferences after deciding: footer link (default),
75
+ * a floating badge, or both. */
76
+ reopen?: ConsentReopenAffordance;
77
+ }
78
+ /**
79
+ * ISO-3166-1 alpha-2 countries where GDPR/ePrivacy-style prior consent
80
+ * applies: all 27 EU members + EEA (IS, LI, NO) + UK + Switzerland.
81
+ * (Deliberately broader than the seed's banner-default heuristic — this set
82
+ * gates a compliance RULE, not a default.)
83
+ */
84
+ export declare const CONSENT_EU_REGION: Set<string>;
85
+ /**
86
+ * Whether a visitor is exempt from the banner under the config's region
87
+ * rule. Unknown country (no geo header — sandbox, self-hosted, bots) is
88
+ * NEVER exempt: fail closed toward showing the banner.
89
+ */
90
+ export declare function consentRegionExempt(config: CookieConsentConfig | null | undefined, country: string | null | undefined): boolean;
91
+ /**
92
+ * Validate + strip unknown keys from a raw config object (admin PUT body or
93
+ * a store_settings row). Never throws; anything unrecognized is dropped so
94
+ * a hand-edited row can degrade but never break the storefront.
95
+ */
96
+ export declare function sanitizeCookieConsentConfig(raw: unknown): CookieConsentConfig;
31
97
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/cookie-consent/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,iBAAiB;IAChC;;8DAE0D;IAC1D,SAAS,EAAE,IAAI,CAAA;IACf;4BACwB;IACxB,SAAS,EAAE,OAAO,CAAA;IAClB;sDACkD;IAClD,SAAS,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD;+CAC2C;IAC3C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB;;4EAEwE;IACxE,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,WAAW,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/cookie-consent/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,MAAM,WAAW,iBAAiB;IAChC;;8DAE0D;IAC1D,SAAS,EAAE,IAAI,CAAA;IACf;4BACwB;IACxB,SAAS,EAAE,OAAO,CAAA;IAClB;sDACkD;IAClD,SAAS,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD;+CAC2C;IAC3C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB;;4EAEwE;IACxE,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,WAAW,CAAA;AAMnD,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,CAAA;AAC1D,MAAM,MAAM,qBAAqB,GAAG,aAAa,GAAG,cAAc,GAAG,eAAe,CAAA;AACpF,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,Q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AIT;AAwBD;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,OAAO,GAAG,mBAAmB,CA6C7E"}
@@ -1,10 +1,122 @@
1
1
  /**
2
- * Cookie consent types (R021).
2
+ * Cookie consent types + banner configuration (R021).
3
3
  *
4
- * Shared shape between provider, banner, hook. Keep lean — the minimum
5
- * viable EDPB-compliant categorization is Essential / Analytics /
6
- * Marketing. We do NOT ship per-vendor granularity; categories are the
4
+ * Consent state stays lean — the minimum viable EDPB-compliant
5
+ * categorization is Essential / Analytics / Marketing; categories are the
7
6
  * contract any storefront script follows via `useCookieConsent()`.
7
+ *
8
+ * COMPLIANCE GUARDRAILS ARE NOT CONFIGURABLE — reject parity, no pre-ticked
9
+ * boxes, close-equals-refusal, the three-category model and the 12-month
10
+ * re-consent window are hard-coded in the banner. The config below only
11
+ * shapes presentation (layout, colors, copy), audience (region rule) and
12
+ * the reopen affordance. That is the guarantee: when the merchant enables
13
+ * the banner, the compliant behavior cannot be configured away.
14
+ */
15
+ // =============================================================================
16
+ // Region rule — the compliance-correct EU/EEA + UK + CH set
17
+ // =============================================================================
18
+ /**
19
+ * ISO-3166-1 alpha-2 countries where GDPR/ePrivacy-style prior consent
20
+ * applies: all 27 EU members + EEA (IS, LI, NO) + UK + Switzerland.
21
+ * (Deliberately broader than the seed's banner-default heuristic — this set
22
+ * gates a compliance RULE, not a default.)
23
+ */
24
+ export const CONSENT_EU_REGION = new Set([
25
+ 'AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR',
26
+ 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL',
27
+ 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE',
28
+ 'IS', 'LI', 'NO',
29
+ 'GB', 'CH',
30
+ ]);
31
+ /**
32
+ * Whether a visitor is exempt from the banner under the config's region
33
+ * rule. Unknown country (no geo header — sandbox, self-hosted, bots) is
34
+ * NEVER exempt: fail closed toward showing the banner.
35
+ */
36
+ export function consentRegionExempt(config, country) {
37
+ if (config?.region !== 'eu-only')
38
+ return false;
39
+ if (!country)
40
+ return false;
41
+ return !CONSENT_EU_REGION.has(country.toUpperCase());
42
+ }
43
+ // =============================================================================
44
+ // Config sanitizer — the ONLY ingress for merchant-supplied config JSON
45
+ // =============================================================================
46
+ const LAYOUTS = ['card', 'bar', 'modal'];
47
+ const POSITIONS = ['bottom-left', 'bottom-right', 'bottom-center'];
48
+ const THEMES = ['auto', 'light', 'dark', 'custom'];
49
+ const REGIONS = ['worldwide', 'eu-only'];
50
+ const REOPENS = ['link', 'badge', 'both'];
51
+ const COPY_KEYS = [
52
+ 'title', 'intro', 'acceptAll', 'rejectAll', 'customize',
53
+ ];
54
+ const HEX_RE = /^#[0-9a-fA-F]{3,8}$/;
55
+ const MAX_COPY = 500;
56
+ const MAX_LOCALES = 12;
57
+ function pickEnum(value, allowed) {
58
+ return typeof value === 'string' && allowed.includes(value)
59
+ ? value
60
+ : undefined;
61
+ }
62
+ /**
63
+ * Validate + strip unknown keys from a raw config object (admin PUT body or
64
+ * a store_settings row). Never throws; anything unrecognized is dropped so
65
+ * a hand-edited row can degrade but never break the storefront.
8
66
  */
9
- export {};
67
+ export function sanitizeCookieConsentConfig(raw) {
68
+ if (!raw || typeof raw !== 'object' || Array.isArray(raw))
69
+ return {};
70
+ const r = raw;
71
+ const out = {};
72
+ const layout = pickEnum(r.layout, LAYOUTS);
73
+ if (layout)
74
+ out.layout = layout;
75
+ const position = pickEnum(r.position, POSITIONS);
76
+ if (position)
77
+ out.position = position;
78
+ const theme = pickEnum(r.theme, THEMES);
79
+ if (theme)
80
+ out.theme = theme;
81
+ const region = pickEnum(r.region, REGIONS);
82
+ if (region)
83
+ out.region = region;
84
+ const reopen = pickEnum(r.reopen, REOPENS);
85
+ if (reopen)
86
+ out.reopen = reopen;
87
+ if (r.colors && typeof r.colors === 'object' && !Array.isArray(r.colors)) {
88
+ const c = r.colors;
89
+ const colors = {};
90
+ for (const key of ['background', 'text', 'accent', 'accentText']) {
91
+ const v = c[key];
92
+ if (typeof v === 'string' && HEX_RE.test(v))
93
+ colors[key] = v;
94
+ }
95
+ if (Object.keys(colors).length > 0)
96
+ out.colors = colors;
97
+ }
98
+ if (r.copy && typeof r.copy === 'object' && !Array.isArray(r.copy)) {
99
+ const copy = {};
100
+ for (const [locale, entry] of Object.entries(r.copy)) {
101
+ if (Object.keys(copy).length >= MAX_LOCALES)
102
+ break;
103
+ if (!/^[a-z]{2}(-[A-Z]{2})?$/.test(locale))
104
+ continue;
105
+ if (!entry || typeof entry !== 'object' || Array.isArray(entry))
106
+ continue;
107
+ const clean = {};
108
+ for (const key of COPY_KEYS) {
109
+ const v = entry[key];
110
+ if (typeof v === 'string' && v.trim() !== '') {
111
+ clean[key] = v.slice(0, MAX_COPY);
112
+ }
113
+ }
114
+ if (Object.keys(clean).length > 0)
115
+ copy[locale] = clean;
116
+ }
117
+ if (Object.keys(copy).length > 0)
118
+ out.copy = copy;
119
+ }
120
+ return out;
121
+ }
10
122
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/cookie-consent/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/cookie-consent/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAgFH,gFAAgF;AAChF,4DAA4D;AAC5D,gFAAgF;AAEhF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IACvC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IAC1D,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,I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,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAA;gBACnC,CAAC;YACH,CAAC;YACD,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC;gBAAE,IAAI,CAAC,MAAM,CAAC,GAAG,KAAK,CAAA;QACzD,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC;YAAE,GAAG,CAAC,IAAI,GAAG,IAAI,CAAA;IACnD,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @rovela/sdk/core/dates
3
+ *
4
+ * Timezone-safe date rendering helpers shared across modules (admin +
5
+ * analytics views). Pure functions — no React, safe on server and client.
6
+ */
7
+ /**
8
+ * Format a server-produced plain day key ('YYYY-MM-DD') for display WITHOUT
9
+ * timezone shifting. `new Date('2026-07-10')` parses as UTC midnight, so
10
+ * `toLocaleDateString` in a negative-offset browser zone renders Jul 9 —
11
+ * off by one. Server day buckets are already computed in the store's
12
+ * timezone; this renders the key verbatim as a calendar date.
13
+ */
14
+ export declare function formatDayLabel(dayKey: string, locale?: string, options?: Intl.DateTimeFormatOptions): string;
15
+ //# sourceMappingURL=dates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dates.d.ts","sourceRoot":"","sources":["../../src/core/dates.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,MAAgB,EACxB,OAAO,GAAE,IAAI,CAAC,qBAA0D,GACvE,MAAM,CAMR"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @rovela/sdk/core/dates
3
+ *
4
+ * Timezone-safe date rendering helpers shared across modules (admin +
5
+ * analytics views). Pure functions — no React, safe on server and client.
6
+ */
7
+ /**
8
+ * Format a server-produced plain day key ('YYYY-MM-DD') for display WITHOUT
9
+ * timezone shifting. `new Date('2026-07-10')` parses as UTC midnight, so
10
+ * `toLocaleDateString` in a negative-offset browser zone renders Jul 9 —
11
+ * off by one. Server day buckets are already computed in the store's
12
+ * timezone; this renders the key verbatim as a calendar date.
13
+ */
14
+ export function formatDayLabel(dayKey, locale = 'en-US', options = { month: 'short', day: 'numeric' }) {
15
+ const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(dayKey);
16
+ if (!m)
17
+ return dayKey;
18
+ // Construct at UTC noon + format in UTC — immune to any zone shift.
19
+ const d = new Date(Date.UTC(Number(m[1]), Number(m[2]) - 1, Number(m[3]), 12));
20
+ return d.toLocaleDateString(locale, { ...options, timeZone: 'UTC' });
21
+ }
22
+ //# sourceMappingURL=dates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dates.js","sourceRoot":"","sources":["../../src/core/dates.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAc,EACd,SAAiB,OAAO,EACxB,UAAsC,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE;IAExE,MAAM,CAAC,GAAG,0BAA0B,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACjD,IAAI,CAAC,CAAC;QAAE,OAAO,MAAM,CAAA;IACrB,oEAAoE;IACpE,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;IAC9E,OAAO,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAA;AACtE,CAAC"}
@@ -538,12 +538,12 @@ export declare const GUEST_PASSWORD_HASH = "";
538
538
  * for the duplicate case, so it is safe to call inline in the checkout webhook.
539
539
  */
540
540
  export declare function findOrCreateGuestCustomer(email: string, name?: string | null): Promise<{
541
- locale: string | null;
542
541
  id: string;
543
542
  name: string | null;
544
543
  createdAt: Date;
545
544
  updatedAt: Date;
546
545
  email: string;
546
+ locale: string | null;
547
547
  phone: string | null;
548
548
  passwordHash: string;
549
549
  stripeCustomerId: string | null;
@@ -803,8 +803,6 @@ export declare function getRecentOrders(limit?: number, periodDays?: number): Pr
803
803
  * Create a new order
804
804
  */
805
805
  export declare function createOrder(data: schema.NewOrder): Promise<{
806
- currency: string | null;
807
- locale: string | null;
808
806
  id: string;
809
807
  status: "pending" | "paid" | "shipped" | "delivered" | "cancelled" | "refunded" | "return_requested";
810
808
  createdAt: Date;
@@ -815,6 +813,8 @@ export declare function createOrder(data: schema.NewOrder): Promise<{
815
813
  tax: string;
816
814
  shipping: string;
817
815
  total: string;
816
+ currency: string | null;
817
+ locale: string | null;
818
818
  refundAmount: string | null;
819
819
  returnReason: string | null;
820
820
  discountCode: string | null;
@@ -1659,7 +1659,6 @@ export interface DiscountInput {
1659
1659
  sortOrder?: number;
1660
1660
  }
1661
1661
  export declare function createDiscount(data: DiscountInput): Promise<{
1662
- value: string;
1663
1662
  id: string;
1664
1663
  createdAt: Date;
1665
1664
  updatedAt: Date;
@@ -1669,6 +1668,7 @@ export declare function createDiscount(data: DiscountInput): Promise<{
1669
1668
  method: string;
1670
1669
  title: string;
1671
1670
  type: string;
1671
+ value: string;
1672
1672
  appliesTo: string;
1673
1673
  targetIds: string[];
1674
1674
  minSubtotal: string | null;
@@ -1917,7 +1917,7 @@ export declare function countOrders(options?: {
1917
1917
  *
1918
1918
  * Date format is `YYYY-MM-DD` in UTC (matches Postgres `DATE()` output).
1919
1919
  */
1920
- export declare function getRevenueByPeriod(days: number): Promise<{
1920
+ export declare function getRevenueByPeriod(days: number, timeZone?: string): Promise<{
1921
1921
  date: string;
1922
1922
  revenue: number;
1923
1923
  }[]>;
@@ -1951,6 +1951,8 @@ export interface StoreSettingsData {
1951
1951
  enabledLocales: string[] | null;
1952
1952
  /** Email theme (Phase D). NULL = derive from the store's brand. */
1953
1953
  emailTheme: Record<string, unknown> | null;
1954
+ /** Cookie-banner configuration (SDK 0.18.0). NULL/{} = defaults. */
1955
+ cookieConsent: Record<string, unknown> | null;
1954
1956
  taxIncludedInPrices: boolean | null;
1955
1957
  shippingEnabled: boolean | null;
1956
1958
  freeShippingThreshold: number | null;