@kasuvia/sdk 0.0.8 → 0.0.9

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 (176) hide show
  1. package/README.md +42 -15
  2. package/dist/AddressAutocomplete-CjcqPElD.d.mts +46 -0
  3. package/dist/AddressAutocomplete-CvJHuRkf.d.ts +46 -0
  4. package/dist/components/index.d.mts +497 -0
  5. package/dist/components/index.d.ts +497 -0
  6. package/dist/components/index.js +4217 -0
  7. package/dist/components/index.js.map +1 -0
  8. package/dist/components/index.mjs +4194 -0
  9. package/dist/components/index.mjs.map +1 -0
  10. package/dist/config/server.d.mts +26 -0
  11. package/dist/config/server.d.ts +26 -0
  12. package/dist/config/server.js +38 -0
  13. package/dist/config/server.js.map +1 -0
  14. package/dist/config/server.mjs +13 -0
  15. package/dist/config/server.mjs.map +1 -0
  16. package/dist/hooks/index.d.mts +393 -160
  17. package/dist/hooks/index.d.ts +393 -160
  18. package/dist/hooks/index.js +2792 -2137
  19. package/dist/hooks/index.js.map +1 -1
  20. package/dist/hooks/index.mjs +2734 -2121
  21. package/dist/hooks/index.mjs.map +1 -1
  22. package/dist/index-CNW_LINy.d.mts +578 -0
  23. package/dist/index-CNW_LINy.d.ts +578 -0
  24. package/dist/{index-C1chUA3P.d.mts → index-F7N6UItS.d.mts} +1 -1
  25. package/dist/{index-C1chUA3P.d.ts → index-F7N6UItS.d.ts} +1 -1
  26. package/dist/index-NkI10J_E.d.mts +40 -0
  27. package/dist/index-NkI10J_E.d.ts +40 -0
  28. package/dist/index.d.mts +20437 -103
  29. package/dist/index.d.ts +20437 -103
  30. package/dist/index.js +2111 -1802
  31. package/dist/index.js.map +1 -1
  32. package/dist/index.mjs +2006 -1786
  33. package/dist/index.mjs.map +1 -1
  34. package/dist/media.service-Cx7dQjzX.d.mts +1393 -0
  35. package/dist/media.service-mrBFJ2UQ.d.ts +1393 -0
  36. package/dist/services/index.d.mts +908 -2
  37. package/dist/services/index.d.ts +908 -2
  38. package/dist/services/index.js +1492 -1686
  39. package/dist/services/index.js.map +1 -1
  40. package/dist/services/index.mjs +1431 -1670
  41. package/dist/services/index.mjs.map +1 -1
  42. package/package.json +46 -6
  43. package/src/components/bespoke/BespokeAvailabilityBadge.tsx +32 -0
  44. package/src/components/bespoke/BespokeProgressTracker.tsx +58 -0
  45. package/src/components/bespoke/index.ts +3 -0
  46. package/src/components/booking/SlotPicker.tsx +97 -0
  47. package/src/components/booking/index.ts +1 -0
  48. package/src/components/cart/CartItem.tsx +81 -0
  49. package/src/components/cart/CartSidebar.tsx +115 -0
  50. package/src/components/cart/CartTypeMismatchBanner.tsx +55 -0
  51. package/src/components/cart/index.ts +3 -0
  52. package/src/components/index.ts +8 -0
  53. package/src/components/orders/DeliverableReviewer.tsx +139 -0
  54. package/src/components/orders/index.ts +1 -0
  55. package/src/components/product/ProductCard.tsx +350 -0
  56. package/src/components/product/ProductGrid.tsx +84 -0
  57. package/src/components/product/index.ts +2 -0
  58. package/src/components/shared/AddressAutocomplete.tsx +212 -0
  59. package/src/components/shared/AnalyticsScripts.tsx +56 -0
  60. package/src/components/shared/CookieConsentBanner.tsx +98 -0
  61. package/src/components/shared/ImageEditorModal.tsx +1066 -0
  62. package/src/components/shared/ImageViewerModal.tsx +598 -0
  63. package/src/components/shared/LucideReactIcon.tsx +52 -0
  64. package/src/components/shared/MapPinDrop.tsx +101 -0
  65. package/src/components/shared/MultiSelectPicker.tsx +193 -0
  66. package/src/components/shared/OfflineBanner.tsx +46 -0
  67. package/src/components/shared/SearchableInput.tsx +153 -0
  68. package/src/components/shared/SearchablePopover.tsx +166 -0
  69. package/src/components/shared/SmartImage.tsx +311 -0
  70. package/src/components/shared/TruncatedValue.tsx +27 -0
  71. package/src/components/shared/UnsavedChangesGuard.tsx +138 -0
  72. package/src/components/shared/index.ts +15 -0
  73. package/src/components/skeletons/CardSkeleton.tsx +26 -0
  74. package/src/components/skeletons/CartItemSkeleton.tsx +26 -0
  75. package/src/components/skeletons/OrderItemSkeleton.tsx +26 -0
  76. package/src/components/skeletons/ProductCardSkeleton.tsx +26 -0
  77. package/src/components/skeletons/TableSkeleton.tsx +42 -0
  78. package/src/components/skeletons/index.ts +5 -0
  79. package/src/config/index.ts +22 -4
  80. package/src/config/server.ts +45 -0
  81. package/src/context/sdk-context.tsx +5 -2
  82. package/src/generated/auth-openapi.ts +2935 -0
  83. package/src/generated/cart-openapi.ts +652 -0
  84. package/src/generated/cms-openapi.ts +1668 -0
  85. package/src/generated/crm-openapi.ts +986 -0
  86. package/src/generated/graphql.ts +126 -0
  87. package/src/generated/index.ts +11 -0
  88. package/src/generated/media-openapi.ts +613 -0
  89. package/src/generated/notification-openapi.ts +862 -0
  90. package/src/generated/payment-openapi.ts +2713 -0
  91. package/src/generated/store-openapi.ts +9510 -0
  92. package/src/graphql/operations/collections.graphql +32 -0
  93. package/src/graphql/operations/products.graphql +197 -0
  94. package/src/graphql/operations/wishlist.graphql +25 -0
  95. package/src/hooks/index.ts +9 -2
  96. package/src/hooks/use-auth.ts +163 -69
  97. package/src/hooks/use-bespoke-availability.ts +39 -22
  98. package/src/hooks/use-business-config.ts +51 -0
  99. package/src/hooks/use-cart.ts +310 -238
  100. package/src/hooks/use-cms.ts +107 -127
  101. package/src/hooks/use-collections.ts +35 -55
  102. package/src/hooks/use-consultations.ts +9 -136
  103. package/src/hooks/use-countries.ts +19 -28
  104. package/src/hooks/use-currencies.ts +8 -20
  105. package/src/hooks/use-customer-address.ts +64 -0
  106. package/src/hooks/use-feedback.ts +34 -0
  107. package/src/hooks/use-languages.ts +26 -39
  108. package/src/hooks/use-media-upload.ts +23 -0
  109. package/src/hooks/use-notification-stream.ts +88 -0
  110. package/src/hooks/use-notifications.ts +163 -0
  111. package/src/hooks/use-order-stream.ts +29 -29
  112. package/src/hooks/use-orders.ts +91 -73
  113. package/src/hooks/use-payment.ts +116 -84
  114. package/src/hooks/use-products.ts +65 -269
  115. package/src/hooks/use-push-notifications.ts +122 -0
  116. package/src/hooks/use-reviews.ts +175 -0
  117. package/src/hooks/use-service-booking.ts +109 -132
  118. package/src/hooks/use-states.ts +16 -30
  119. package/src/hooks/use-wishlist.ts +44 -69
  120. package/src/index.ts +15 -11
  121. package/src/services/auth.service.ts +422 -132
  122. package/src/services/bespoke.service.ts +69 -10
  123. package/src/services/cart.service.ts +155 -186
  124. package/src/services/cms.service.ts +41 -50
  125. package/src/services/collection.service.ts +25 -63
  126. package/src/services/config.service.ts +10 -21
  127. package/src/services/consultation.service.ts +36 -93
  128. package/src/services/feedback.service.ts +76 -0
  129. package/src/services/index.ts +7 -1
  130. package/src/services/legal.service.ts +62 -0
  131. package/src/services/logistics.service.ts +235 -53
  132. package/src/services/media.service.ts +115 -0
  133. package/src/services/notifications.service.ts +204 -20
  134. package/src/services/order.service.ts +498 -127
  135. package/src/services/payment.service.ts +149 -100
  136. package/src/services/product.service.ts +157 -814
  137. package/src/services/review.service.ts +211 -0
  138. package/src/services/service-booking.service.ts +198 -99
  139. package/src/services/wishlist.service.ts +27 -74
  140. package/src/types/auth/index.ts +161 -18
  141. package/src/types/business/index.ts +9 -1
  142. package/src/types/cms/index.ts +91 -6
  143. package/src/types/cms/legal.ts +18 -0
  144. package/src/types/consultations/index.ts +60 -68
  145. package/src/types/index.ts +5 -3
  146. package/src/types/media/index.ts +35 -3
  147. package/src/types/payments/index.ts +80 -16
  148. package/src/types/reviews/index.ts +116 -0
  149. package/src/types/services/index.ts +113 -38
  150. package/src/types/store/checkout.ts +53 -0
  151. package/src/types/store/index.ts +273 -52
  152. package/src/types/store/invoice.ts +31 -0
  153. package/src/types/store/shipping.ts +84 -3
  154. package/src/types/ui/index.ts +1 -1
  155. package/src/utils/checkout.ts +19 -3
  156. package/src/utils/cookieConsent.ts +34 -0
  157. package/src/utils/format.ts +408 -0
  158. package/src/utils/geolocation.ts +134 -0
  159. package/src/utils/graphql-url.ts +47 -0
  160. package/src/utils/guest-session.ts +59 -0
  161. package/src/utils/http-client.ts +147 -0
  162. package/src/utils/index.ts +11 -4
  163. package/src/utils/status-colors.ts +79 -0
  164. package/src/utils/token-refresh.ts +115 -0
  165. package/src/utils/validators.ts +13 -0
  166. package/src/utils/youtube.ts +18 -0
  167. package/dist/index-C5YO9gTl.d.mts +0 -507
  168. package/dist/index-C5YO9gTl.d.ts +0 -507
  169. package/dist/index-CefG7_xq.d.mts +0 -793
  170. package/dist/index-DeHCf3zI.d.ts +0 -793
  171. package/src/graphql/collections.graphql.ts +0 -48
  172. package/src/graphql/index.ts +0 -7
  173. package/src/graphql/products.graphql.ts +0 -860
  174. package/src/graphql/wishlist.graphql.ts +0 -34
  175. package/src/hooks/use-consultation-stream.ts +0 -142
  176. package/src/types/bespoke/index.ts +0 -39
@@ -0,0 +1,26 @@
1
+ import { S as SdkConfig } from '../index-NkI10J_E.mjs';
2
+
3
+ interface ServerBackendUrls {
4
+ auth: string;
5
+ store: string;
6
+ cart: string;
7
+ payment: string;
8
+ notifications: string;
9
+ cms: string;
10
+ crm: string;
11
+ }
12
+ /**
13
+ * Build the SERVER-side SdkConfig instance — real backend URLs, for Next.js
14
+ * API route handlers / Server Components only. Importing this function (or
15
+ * this module at all) from a "use client" file is a build error by design.
16
+ * For the client-safe instance (same-origin proxy paths), just construct a
17
+ * plain SdkConfig object directly — no factory needed, nothing to guard
18
+ * against, since there's no secret/real-host material in it.
19
+ */
20
+ declare function createServerSdkConfig(params: {
21
+ businessId: string;
22
+ storefrontApiKey: string;
23
+ backendUrls: ServerBackendUrls;
24
+ }): SdkConfig;
25
+
26
+ export { type ServerBackendUrls, createServerSdkConfig };
@@ -0,0 +1,26 @@
1
+ import { S as SdkConfig } from '../index-NkI10J_E.js';
2
+
3
+ interface ServerBackendUrls {
4
+ auth: string;
5
+ store: string;
6
+ cart: string;
7
+ payment: string;
8
+ notifications: string;
9
+ cms: string;
10
+ crm: string;
11
+ }
12
+ /**
13
+ * Build the SERVER-side SdkConfig instance — real backend URLs, for Next.js
14
+ * API route handlers / Server Components only. Importing this function (or
15
+ * this module at all) from a "use client" file is a build error by design.
16
+ * For the client-safe instance (same-origin proxy paths), just construct a
17
+ * plain SdkConfig object directly — no factory needed, nothing to guard
18
+ * against, since there's no secret/real-host material in it.
19
+ */
20
+ declare function createServerSdkConfig(params: {
21
+ businessId: string;
22
+ storefrontApiKey: string;
23
+ backendUrls: ServerBackendUrls;
24
+ }): SdkConfig;
25
+
26
+ export { type ServerBackendUrls, createServerSdkConfig };
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/config/server.ts
21
+ var server_exports = {};
22
+ __export(server_exports, {
23
+ createServerSdkConfig: () => createServerSdkConfig
24
+ });
25
+ module.exports = __toCommonJS(server_exports);
26
+ var import_server_only = require("server-only");
27
+ function createServerSdkConfig(params) {
28
+ return {
29
+ businessId: params.businessId,
30
+ storefrontApiKey: params.storefrontApiKey,
31
+ backendUrls: params.backendUrls
32
+ };
33
+ }
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ createServerSdkConfig
37
+ });
38
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/config/server.ts"],"sourcesContent":["// REAL GAP CLOSED (2026-09-17): SdkConfig's own file documents a real\n// incident (kasuvia-storefront's ProductsListing.tsx importing the SERVER\n// config instance — real backend URLs — into a \"use client\" file, silently\n// resolving to '' in the browser bundle rather than failing loudly) and\n// admits \"This type alone can't enforce that distinction\". A plain\n// TypeScript interface can't — but `server-only` (the same sentinel package\n// Next.js's own docs recommend for exactly this problem) can, at BUILD\n// TIME: this file's mere existence as a leaf module, isolated on its own\n// tsup entry/exports subpath (never re-exported from the main '@kasuvia/sdk'\n// or '@kasuvia/sdk/config' entry, which would taint that whole module graph\n// as server-only for every consumer), means importing it from a \"use client\"\n// file makes Next.js's build fail immediately with a clear, actionable\n// error — not a silent empty string discovered in production.\nimport 'server-only'\nimport type { SdkConfig } from './index'\n\nexport interface ServerBackendUrls {\n auth: string\n store: string\n cart: string\n payment: string\n notifications: string\n cms: string\n crm: string\n}\n\n/**\n * Build the SERVER-side SdkConfig instance — real backend URLs, for Next.js\n * API route handlers / Server Components only. Importing this function (or\n * this module at all) from a \"use client\" file is a build error by design.\n * For the client-safe instance (same-origin proxy paths), just construct a\n * plain SdkConfig object directly — no factory needed, nothing to guard\n * against, since there's no secret/real-host material in it.\n */\nexport function createServerSdkConfig(params: {\n businessId: string\n storefrontApiKey: string\n backendUrls: ServerBackendUrls\n}): SdkConfig {\n return {\n businessId: params.businessId,\n storefrontApiKey: params.storefrontApiKey,\n backendUrls: params.backendUrls,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAaA,yBAAO;AAqBA,SAAS,sBAAsB,QAIxB;AACZ,SAAO;AAAA,IACL,YAAY,OAAO;AAAA,IACnB,kBAAkB,OAAO;AAAA,IACzB,aAAa,OAAO;AAAA,EACtB;AACF;","names":[]}
@@ -0,0 +1,13 @@
1
+ // src/config/server.ts
2
+ import "server-only";
3
+ function createServerSdkConfig(params) {
4
+ return {
5
+ businessId: params.businessId,
6
+ storefrontApiKey: params.storefrontApiKey,
7
+ backendUrls: params.backendUrls
8
+ };
9
+ }
10
+ export {
11
+ createServerSdkConfig
12
+ };
13
+ //# sourceMappingURL=server.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/config/server.ts"],"sourcesContent":["// REAL GAP CLOSED (2026-09-17): SdkConfig's own file documents a real\n// incident (kasuvia-storefront's ProductsListing.tsx importing the SERVER\n// config instance — real backend URLs — into a \"use client\" file, silently\n// resolving to '' in the browser bundle rather than failing loudly) and\n// admits \"This type alone can't enforce that distinction\". A plain\n// TypeScript interface can't — but `server-only` (the same sentinel package\n// Next.js's own docs recommend for exactly this problem) can, at BUILD\n// TIME: this file's mere existence as a leaf module, isolated on its own\n// tsup entry/exports subpath (never re-exported from the main '@kasuvia/sdk'\n// or '@kasuvia/sdk/config' entry, which would taint that whole module graph\n// as server-only for every consumer), means importing it from a \"use client\"\n// file makes Next.js's build fail immediately with a clear, actionable\n// error — not a silent empty string discovered in production.\nimport 'server-only'\nimport type { SdkConfig } from './index'\n\nexport interface ServerBackendUrls {\n auth: string\n store: string\n cart: string\n payment: string\n notifications: string\n cms: string\n crm: string\n}\n\n/**\n * Build the SERVER-side SdkConfig instance — real backend URLs, for Next.js\n * API route handlers / Server Components only. Importing this function (or\n * this module at all) from a \"use client\" file is a build error by design.\n * For the client-safe instance (same-origin proxy paths), just construct a\n * plain SdkConfig object directly — no factory needed, nothing to guard\n * against, since there's no secret/real-host material in it.\n */\nexport function createServerSdkConfig(params: {\n businessId: string\n storefrontApiKey: string\n backendUrls: ServerBackendUrls\n}): SdkConfig {\n return {\n businessId: params.businessId,\n storefrontApiKey: params.storefrontApiKey,\n backendUrls: params.backendUrls,\n }\n}\n"],"mappings":";AAaA,OAAO;AAqBA,SAAS,sBAAsB,QAIxB;AACZ,SAAO;AAAA,IACL,YAAY,OAAO;AAAA,IACnB,kBAAkB,OAAO;AAAA,IACzB,aAAa,OAAO;AAAA,EACtB;AACF;","names":[]}