@cmssy/react 0.1.8 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.cts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { B as BlockSchema, a as BlockMeta, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup } from './registry-e3O4s_bN.cjs';
3
- import 'react';
2
+ import { B as BlockSchema, a as BlockMeta, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, e as CmssyCart, f as CmssyOrder, g as CmssyProduct } from './commerce-queries-DV7PZlKS.cjs';
3
+ export { h as CmssyCartDiscount, i as CmssyCartItem, j as CmssyCartItemSnapshot, k as CmssyProductVariant } from './commerce-queries-DV7PZlKS.cjs';
4
+ import { ReactNode } from 'react';
4
5
 
5
6
  interface EditBridgeConfig {
6
7
  editorOrigin: string;
@@ -80,4 +81,63 @@ interface CmssyLazyLayoutProps {
80
81
  }
81
82
  declare function CmssyLazyLayout({ load, ...props }: CmssyLazyLayoutProps): react_jsx_runtime.JSX.Element | null;
82
83
 
83
- export { CmssyEditableLayout, type CmssyEditableLayoutProps, CmssyEditablePage, type CmssyEditablePageProps, CmssyLazyEditor, type CmssyLazyEditorProps, CmssyLazyLayout, type CmssyLazyLayoutProps, type EditBridgeConfig, type EditBridgeState, type PatchMap, useEditBridge };
84
+ interface CmssyAuthUser {
85
+ recordId: string;
86
+ email: string;
87
+ }
88
+ interface CmssyAuthActionResult {
89
+ ok: boolean;
90
+ message?: string;
91
+ }
92
+ interface CmssyAuthState {
93
+ user: CmssyAuthUser | null;
94
+ loading: boolean;
95
+ signIn(identity: string, password: string): Promise<CmssyAuthActionResult>;
96
+ register(identity: string, password: string, fields?: Record<string, unknown>): Promise<CmssyAuthActionResult>;
97
+ signOut(): Promise<void>;
98
+ refresh(): Promise<void>;
99
+ }
100
+ interface CmssyAuthProviderProps {
101
+ children: ReactNode;
102
+ basePath?: string;
103
+ initialUser?: CmssyAuthUser | null;
104
+ }
105
+ declare function CmssyAuthProvider({ children, basePath, initialUser, }: CmssyAuthProviderProps): react_jsx_runtime.JSX.Element;
106
+ declare function useCmssyUser(): CmssyAuthState;
107
+
108
+ interface CmssyAddToCartOptions {
109
+ variantSelections?: Record<string, string>;
110
+ notes?: string;
111
+ }
112
+ interface CmssyCommerceState {
113
+ cart: CmssyCart | null;
114
+ loading: boolean;
115
+ error: string | null;
116
+ addToCart(recordId: string, quantity?: number, options?: CmssyAddToCartOptions): Promise<void>;
117
+ updateItem(itemId: string, quantity: number): Promise<void>;
118
+ removeItem(itemId: string): Promise<void>;
119
+ clearCart(): Promise<void>;
120
+ applyDiscount(code: string): Promise<void>;
121
+ removeDiscount(): Promise<void>;
122
+ checkout(customerEmail: string): Promise<CmssyOrder>;
123
+ refresh(): Promise<void>;
124
+ fetchProduct(modelSlug: string, filter: Record<string, unknown>): Promise<CmssyProduct | null>;
125
+ }
126
+ interface CmssyCommerceProviderProps {
127
+ children: ReactNode;
128
+ basePath?: string;
129
+ }
130
+ declare function CmssyCommerceProvider({ children, basePath, }: CmssyCommerceProviderProps): react_jsx_runtime.JSX.Element;
131
+ declare function useCart(): CmssyCommerceState;
132
+
133
+ declare const productBlock: BlockDefinition;
134
+
135
+ declare const cartBlock: BlockDefinition;
136
+
137
+ declare const checkoutBlock: BlockDefinition;
138
+
139
+ declare function fractionDigits(currency: string): number;
140
+ declare function fromMinorUnits(minor: number, currency: string): number;
141
+ declare function formatPrice(minor: number, currency: string | null | undefined): string;
142
+
143
+ export { type CmssyAddToCartOptions, type CmssyAuthActionResult, CmssyAuthProvider, type CmssyAuthProviderProps, type CmssyAuthState, type CmssyAuthUser, CmssyCart, CmssyCommerceProvider, type CmssyCommerceProviderProps, type CmssyCommerceState, CmssyEditableLayout, type CmssyEditableLayoutProps, CmssyEditablePage, type CmssyEditablePageProps, CmssyLazyEditor, type CmssyLazyEditorProps, CmssyLazyLayout, type CmssyLazyLayoutProps, CmssyOrder, CmssyProduct, type EditBridgeConfig, type EditBridgeState, type PatchMap, cartBlock, checkoutBlock, formatPrice, fractionDigits, fromMinorUnits, productBlock, useCart, useCmssyUser, useEditBridge };
package/dist/client.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { B as BlockSchema, a as BlockMeta, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup } from './registry-e3O4s_bN.js';
3
- import 'react';
2
+ import { B as BlockSchema, a as BlockMeta, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, e as CmssyCart, f as CmssyOrder, g as CmssyProduct } from './commerce-queries-DV7PZlKS.js';
3
+ export { h as CmssyCartDiscount, i as CmssyCartItem, j as CmssyCartItemSnapshot, k as CmssyProductVariant } from './commerce-queries-DV7PZlKS.js';
4
+ import { ReactNode } from 'react';
4
5
 
5
6
  interface EditBridgeConfig {
6
7
  editorOrigin: string;
@@ -80,4 +81,63 @@ interface CmssyLazyLayoutProps {
80
81
  }
81
82
  declare function CmssyLazyLayout({ load, ...props }: CmssyLazyLayoutProps): react_jsx_runtime.JSX.Element | null;
82
83
 
83
- export { CmssyEditableLayout, type CmssyEditableLayoutProps, CmssyEditablePage, type CmssyEditablePageProps, CmssyLazyEditor, type CmssyLazyEditorProps, CmssyLazyLayout, type CmssyLazyLayoutProps, type EditBridgeConfig, type EditBridgeState, type PatchMap, useEditBridge };
84
+ interface CmssyAuthUser {
85
+ recordId: string;
86
+ email: string;
87
+ }
88
+ interface CmssyAuthActionResult {
89
+ ok: boolean;
90
+ message?: string;
91
+ }
92
+ interface CmssyAuthState {
93
+ user: CmssyAuthUser | null;
94
+ loading: boolean;
95
+ signIn(identity: string, password: string): Promise<CmssyAuthActionResult>;
96
+ register(identity: string, password: string, fields?: Record<string, unknown>): Promise<CmssyAuthActionResult>;
97
+ signOut(): Promise<void>;
98
+ refresh(): Promise<void>;
99
+ }
100
+ interface CmssyAuthProviderProps {
101
+ children: ReactNode;
102
+ basePath?: string;
103
+ initialUser?: CmssyAuthUser | null;
104
+ }
105
+ declare function CmssyAuthProvider({ children, basePath, initialUser, }: CmssyAuthProviderProps): react_jsx_runtime.JSX.Element;
106
+ declare function useCmssyUser(): CmssyAuthState;
107
+
108
+ interface CmssyAddToCartOptions {
109
+ variantSelections?: Record<string, string>;
110
+ notes?: string;
111
+ }
112
+ interface CmssyCommerceState {
113
+ cart: CmssyCart | null;
114
+ loading: boolean;
115
+ error: string | null;
116
+ addToCart(recordId: string, quantity?: number, options?: CmssyAddToCartOptions): Promise<void>;
117
+ updateItem(itemId: string, quantity: number): Promise<void>;
118
+ removeItem(itemId: string): Promise<void>;
119
+ clearCart(): Promise<void>;
120
+ applyDiscount(code: string): Promise<void>;
121
+ removeDiscount(): Promise<void>;
122
+ checkout(customerEmail: string): Promise<CmssyOrder>;
123
+ refresh(): Promise<void>;
124
+ fetchProduct(modelSlug: string, filter: Record<string, unknown>): Promise<CmssyProduct | null>;
125
+ }
126
+ interface CmssyCommerceProviderProps {
127
+ children: ReactNode;
128
+ basePath?: string;
129
+ }
130
+ declare function CmssyCommerceProvider({ children, basePath, }: CmssyCommerceProviderProps): react_jsx_runtime.JSX.Element;
131
+ declare function useCart(): CmssyCommerceState;
132
+
133
+ declare const productBlock: BlockDefinition;
134
+
135
+ declare const cartBlock: BlockDefinition;
136
+
137
+ declare const checkoutBlock: BlockDefinition;
138
+
139
+ declare function fractionDigits(currency: string): number;
140
+ declare function fromMinorUnits(minor: number, currency: string): number;
141
+ declare function formatPrice(minor: number, currency: string | null | undefined): string;
142
+
143
+ export { type CmssyAddToCartOptions, type CmssyAuthActionResult, CmssyAuthProvider, type CmssyAuthProviderProps, type CmssyAuthState, type CmssyAuthUser, CmssyCart, CmssyCommerceProvider, type CmssyCommerceProviderProps, type CmssyCommerceState, CmssyEditableLayout, type CmssyEditableLayoutProps, CmssyEditablePage, type CmssyEditablePageProps, CmssyLazyEditor, type CmssyLazyEditorProps, CmssyLazyLayout, type CmssyLazyLayoutProps, CmssyOrder, CmssyProduct, type EditBridgeConfig, type EditBridgeState, type PatchMap, cartBlock, checkoutBlock, formatPrice, fractionDigits, fromMinorUnits, productBlock, useCart, useCmssyUser, useEditBridge };