@bacano/sdk 1.0.1 → 1.1.8

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 (72) hide show
  1. package/README.md +439 -18
  2. package/STOREFRONT_CLARITY.md +140 -0
  3. package/STOREFRONT_CONSTRUCTION.md +105 -0
  4. package/STOREFRONT_LEADS.md +130 -0
  5. package/STOREFRONT_LEGAL.md +66 -0
  6. package/STOREFRONT_MARKETING.md +291 -0
  7. package/STOREFRONT_PERFORMANCE.md +304 -0
  8. package/STOREFRONT_PREVIEW.md +499 -0
  9. package/STOREFRONT_PRODUCT_SPECIFICATIONS.md +127 -0
  10. package/STOREFRONT_VOLUME_PRICING.md +131 -0
  11. package/client.d.ts +8 -1
  12. package/errors.d.ts +9 -1
  13. package/graphql.cjs +266 -3
  14. package/graphql.d.ts +2 -2
  15. package/graphql.js +266 -3
  16. package/index.cjs +2035 -255
  17. package/index.d.ts +8 -6
  18. package/index.js +2035 -255
  19. package/marketing/attribution.d.ts +53 -0
  20. package/marketing/clarity.d.ts +3 -0
  21. package/marketing/domain.d.ts +1 -0
  22. package/marketing/ga4.d.ts +2 -0
  23. package/marketing/index.d.ts +5 -0
  24. package/marketing/runtime.d.ts +2 -0
  25. package/marketing/sanitize.d.ts +2 -0
  26. package/marketing/types.d.ts +111 -0
  27. package/media.d.ts +45 -2
  28. package/modules/auth.d.ts +3 -2
  29. package/modules/availability.d.ts +2 -2
  30. package/modules/cart-errors.d.ts +2 -0
  31. package/modules/cart-session.d.ts +2 -2
  32. package/modules/cart.d.ts +4 -3
  33. package/modules/catalog.d.ts +15 -3
  34. package/modules/content.d.ts +2 -2
  35. package/modules/marketing.d.ts +5 -0
  36. package/modules/orders.d.ts +2 -2
  37. package/modules/profile.d.ts +1 -1
  38. package/modules/static-catalog.d.ts +13 -0
  39. package/modules/website.d.ts +7 -1
  40. package/package.json +14 -3
  41. package/react/context-registry.d.ts +9 -0
  42. package/react/context.d.ts +1 -1
  43. package/react/hooks.d.ts +24 -2
  44. package/react/marketing-context.d.ts +3 -0
  45. package/react/marketing-provider.d.ts +10 -0
  46. package/react/preview/cache.d.ts +23 -0
  47. package/react/preview/context.d.ts +5 -0
  48. package/react/preview/navigation.d.ts +9 -0
  49. package/react/preview/provider.d.ts +3 -0
  50. package/react/preview/shell.d.ts +3 -0
  51. package/react/preview/toolbar.d.ts +3 -0
  52. package/react/preview/types.d.ts +60 -0
  53. package/react/preview.cjs +742 -0
  54. package/react/preview.d.ts +14 -0
  55. package/react/preview.js +730 -0
  56. package/react/website-gate.d.ts +22 -0
  57. package/react.cjs +3893 -1795
  58. package/react.d.ts +8 -4
  59. package/react.js +3891 -1789
  60. package/skills/bacano-web/SKILL.md +116 -0
  61. package/skills/bacano-web/agents/openai.yaml +4 -0
  62. package/skills/bacano-web/references/architecture-runtime.md +109 -0
  63. package/skills/bacano-web/references/common.md +92 -0
  64. package/skills/bacano-web/references/informational.md +39 -0
  65. package/skills/bacano-web/references/report.md +70 -0
  66. package/skills/bacano-web/references/storefront.md +116 -0
  67. package/skills/bacano-web/scripts/audit-http.mjs +284 -0
  68. package/skills/bacano-web/scripts/cli.mjs +222 -0
  69. package/skills/bacano-web/scripts/postinstall.mjs +8 -0
  70. package/transport/documents.d.ts +23 -18
  71. package/transport/graphql.d.ts +13 -1
  72. package/types.d.ts +338 -0
@@ -0,0 +1,60 @@
1
+ import type { CSSProperties, ReactNode } from "react";
2
+ import type { BacanoClient } from "../../client";
3
+ export type BacanoPreviewStatus = "idle" | "loading" | "ready" | "error";
4
+ export type BacanoPreviewToolbarPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right";
5
+ export type BacanoPreviewErrorCode = "CLIENT_UNAVAILABLE" | "EMPTY_DOCUMENT" | "LOADER_FAILED" | "ROUTE_NOT_PREVIEWABLE";
6
+ export interface BacanoPreviewError {
7
+ code: BacanoPreviewErrorCode;
8
+ message: string;
9
+ }
10
+ export type PreviewRouteLoader<TDocument> = (context: {
11
+ route: string;
12
+ force: boolean;
13
+ client: BacanoClient;
14
+ }) => Promise<TDocument>;
15
+ export interface BacanoPreviewContextValue<TDocument> {
16
+ isPreview: true;
17
+ websiteSlug: string;
18
+ route: string;
19
+ status: BacanoPreviewStatus;
20
+ document: TDocument | null;
21
+ error: BacanoPreviewError | null;
22
+ refreshedAt: Date | null;
23
+ isExpanded: boolean;
24
+ position: BacanoPreviewToolbarPosition;
25
+ refresh: () => Promise<void>;
26
+ navigate: (route: string) => void;
27
+ setExpanded: (expanded: boolean) => void;
28
+ setPosition: (position: BacanoPreviewToolbarPosition) => void;
29
+ }
30
+ export interface BacanoPreviewProviderProps<TDocument> {
31
+ websiteSlug: string;
32
+ route: string;
33
+ loadRoute: PreviewRouteLoader<TDocument>;
34
+ navigate: (route: string) => void;
35
+ normalizeRoute?: (route: string) => string;
36
+ isPreviewableRoute?: (route: string) => boolean;
37
+ initialExpanded?: boolean;
38
+ initialPosition?: BacanoPreviewToolbarPosition;
39
+ cacheMaxEntries?: number;
40
+ children: ReactNode;
41
+ }
42
+ export interface BacanoPreviewToolbarProps {
43
+ websiteName?: string;
44
+ logo?: ReactNode;
45
+ primaryColor?: string;
46
+ accentColor?: string;
47
+ backgroundColor?: string;
48
+ locale?: string;
49
+ zIndex?: number;
50
+ suggestedRoutes?: readonly string[];
51
+ }
52
+ export interface BacanoPreviewShellProps<TDocument> extends Omit<BacanoPreviewProviderProps<TDocument>, "children"> {
53
+ toolbar?: BacanoPreviewToolbarProps | false;
54
+ children: (state: BacanoPreviewContextValue<TDocument>) => ReactNode;
55
+ }
56
+ export type BacanoPreviewToolbarStyle = CSSProperties & {
57
+ "--bacano-preview-primary": string;
58
+ "--bacano-preview-accent": string;
59
+ "--bacano-preview-background": string;
60
+ };