@anpayeras/agnostic-checkout 0.1.1 → 0.1.2

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 (71) hide show
  1. package/dist/components/Checkout.d.ts +4 -0
  2. package/dist/components/Checkout.d.ts.map +1 -0
  3. package/dist/components/CheckoutLayout.d.ts +3 -0
  4. package/dist/components/CheckoutLayout.d.ts.map +1 -0
  5. package/dist/components/FeedbackScreen.d.ts +3 -0
  6. package/dist/components/FeedbackScreen.d.ts.map +1 -0
  7. package/dist/components/MobileOrderBar.d.ts +10 -0
  8. package/dist/components/MobileOrderBar.d.ts.map +1 -0
  9. package/dist/components/OrderSidebarSummary.d.ts +3 -0
  10. package/dist/components/OrderSidebarSummary.d.ts.map +1 -0
  11. package/dist/components/OrderSummary.d.ts +2 -0
  12. package/dist/components/OrderSummary.d.ts.map +1 -0
  13. package/dist/components/PaymentForm.d.ts +2 -0
  14. package/dist/components/PaymentForm.d.ts.map +1 -0
  15. package/dist/components/PaymentMethods.d.ts +2 -0
  16. package/dist/components/PaymentMethods.d.ts.map +1 -0
  17. package/dist/components/button.d.ts +3 -0
  18. package/dist/components/button.d.ts.map +1 -0
  19. package/dist/components/checkout-content.d.ts +4 -0
  20. package/dist/components/checkout-content.d.ts.map +1 -0
  21. package/dist/components/dev-tools.d.ts +3 -0
  22. package/dist/components/dev-tools.d.ts.map +1 -0
  23. package/dist/components/mobile-bar.d.ts +4 -0
  24. package/dist/components/mobile-bar.d.ts.map +1 -0
  25. package/dist/components/types.d.ts +57 -0
  26. package/dist/components/types.d.ts.map +1 -0
  27. package/dist/core/checkout-context.d.ts +56 -0
  28. package/dist/core/checkout-context.d.ts.map +1 -0
  29. package/dist/core/checkout-machine.d.ts +3 -0
  30. package/dist/core/checkout-machine.d.ts.map +1 -0
  31. package/dist/core/event-system.d.ts +32 -0
  32. package/dist/core/event-system.d.ts.map +1 -0
  33. package/dist/core/i18n-context.d.ts +17 -0
  34. package/dist/core/i18n-context.d.ts.map +1 -0
  35. package/dist/core/provider.interface.d.ts +7 -0
  36. package/dist/core/provider.interface.d.ts.map +1 -0
  37. package/dist/core/types.d.ts +74 -0
  38. package/dist/core/types.d.ts.map +1 -0
  39. package/dist/hooks/useCheckout.d.ts +26 -0
  40. package/dist/hooks/useCheckout.d.ts.map +1 -0
  41. package/dist/index.d.ts +16 -360
  42. package/dist/index.d.ts.map +1 -0
  43. package/dist/locales/en.d.ts +3 -0
  44. package/dist/locales/en.d.ts.map +1 -0
  45. package/dist/locales/es.d.ts +3 -0
  46. package/dist/locales/es.d.ts.map +1 -0
  47. package/dist/locales/index.d.ts +14 -0
  48. package/dist/locales/index.d.ts.map +1 -0
  49. package/dist/locales/pt-BR.d.ts +3 -0
  50. package/dist/locales/pt-BR.d.ts.map +1 -0
  51. package/dist/locales/types.d.ts +41 -0
  52. package/dist/locales/types.d.ts.map +1 -0
  53. package/dist/plugins/cart-edit-plugin.d.ts +10 -0
  54. package/dist/plugins/cart-edit-plugin.d.ts.map +1 -0
  55. package/dist/plugins/discount-plugin.d.ts +4 -0
  56. package/dist/plugins/discount-plugin.d.ts.map +1 -0
  57. package/dist/plugins/index.d.ts +6 -0
  58. package/dist/plugins/index.d.ts.map +1 -0
  59. package/dist/plugins/plugin-context.d.ts +10 -0
  60. package/dist/plugins/plugin-context.d.ts.map +1 -0
  61. package/dist/plugins/types.d.ts +32 -0
  62. package/dist/plugins/types.d.ts.map +1 -0
  63. package/dist/theme/color-utils.d.ts +39 -0
  64. package/dist/theme/color-utils.d.ts.map +1 -0
  65. package/dist/theme/theme-provider.d.ts +11 -0
  66. package/dist/theme/theme-provider.d.ts.map +1 -0
  67. package/dist/theme/tokens.d.ts +30 -0
  68. package/dist/theme/tokens.d.ts.map +1 -0
  69. package/dist/utils/utils.d.ts +6 -0
  70. package/dist/utils/utils.d.ts.map +1 -0
  71. package/package.json +6 -3
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { CheckoutProps } from './types';
3
+ export declare const Checkout: React.FC<CheckoutProps>;
4
+ //# sourceMappingURL=Checkout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Checkout.d.ts","sourceRoot":"","sources":["../../src/components/Checkout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAiC5C,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { CheckoutLayoutProps } from './types';
2
+ export declare const CheckoutLayout: ({ children, sidebar, className, ...props }: CheckoutLayoutProps) => import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=CheckoutLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CheckoutLayout.d.ts","sourceRoot":"","sources":["../../src/components/CheckoutLayout.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,eAAO,MAAM,cAAc,GAAI,4CAA4C,mBAAmB,4CA8B7F,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { FeedbackScreenProps } from './types';
2
+ export declare const FeedbackScreen: ({ title, description, actions, variant, children, }: FeedbackScreenProps) => import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=FeedbackScreen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FeedbackScreen.d.ts","sourceRoot":"","sources":["../../src/components/FeedbackScreen.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAiB,MAAM,SAAS,CAAC;AA4BlE,eAAO,MAAM,cAAc,GAAI,qDAM5B,mBAAmB,4CAoFrB,CAAC"}
@@ -0,0 +1,10 @@
1
+ interface MobileOrderBarProps {
2
+ onAction?: () => void;
3
+ actionLabel?: string;
4
+ actionDisabled?: boolean;
5
+ isSubmitting?: boolean;
6
+ showItems?: boolean;
7
+ }
8
+ export declare const MobileOrderBar: ({ onAction, actionLabel, actionDisabled, isSubmitting, showItems, }: MobileOrderBarProps) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
10
+ //# sourceMappingURL=MobileOrderBar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MobileOrderBar.d.ts","sourceRoot":"","sources":["../../src/components/MobileOrderBar.tsx"],"names":[],"mappings":"AAMA,UAAU,mBAAmB;IACzB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,cAAc,GAAI,qEAM5B,mBAAmB,4CAkIrB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { OrderSidebarSummaryProps } from './types';
2
+ export declare const OrderSidebarSummary: ({ showItems: propShowItems, isLoading }: OrderSidebarSummaryProps) => import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=OrderSidebarSummary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrderSidebarSummary.d.ts","sourceRoot":"","sources":["../../src/components/OrderSidebarSummary.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAExD,eAAO,MAAM,mBAAmB,GAAI,yCAAyC,wBAAwB,4CAmHpG,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const OrderSummary: () => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=OrderSummary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrderSummary.d.ts","sourceRoot":"","sources":["../../src/components/OrderSummary.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY,+CA+ExB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const PaymentForm: () => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=PaymentForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaymentForm.d.ts","sourceRoot":"","sources":["../../src/components/PaymentForm.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW,+CAuGvB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const PaymentMethods: () => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=PaymentMethods.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaymentMethods.d.ts","sourceRoot":"","sources":["../../src/components/PaymentMethods.tsx"],"names":[],"mappings":"AAeA,eAAO,MAAM,cAAc,+CAiI1B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { ButtonProps } from './types';
2
+ export declare const Button: ({ label, onPress, variant, icon, disabled, className, type, }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/components/button.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,eAAO,MAAM,MAAM,GAAI,+DAQpB,WAAW,4CAkBb,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const CheckoutContent: ({ devTools }: {
2
+ devTools?: boolean;
3
+ }) => import("react/jsx-runtime").JSX.Element;
4
+ //# sourceMappingURL=checkout-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkout-content.d.ts","sourceRoot":"","sources":["../../src/components/checkout-content.tsx"],"names":[],"mappings":"AAYA,eAAO,MAAM,eAAe,GAAI,cAAc;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,4CAqEnE,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const DevTools: () => import("react/jsx-runtime").JSX.Element;
2
+ export default DevTools;
3
+ //# sourceMappingURL=dev-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev-tools.d.ts","sourceRoot":"","sources":["../../src/components/dev-tools.tsx"],"names":[],"mappings":"AAeA,eAAO,MAAM,QAAQ,+CA6EpB,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const MobileBar: ({ step }: {
2
+ step: string;
3
+ }) => import("react/jsx-runtime").JSX.Element | null;
4
+ //# sourceMappingURL=mobile-bar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mobile-bar.d.ts","sourceRoot":"","sources":["../../src/components/mobile-bar.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS,GAAI,UAAU;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,mDA0BnD,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { ReactNode } from 'react';
2
+ import { EventHandler } from '../core/event-system';
3
+ import { PaymentProvider } from '../core/provider.interface';
4
+ import { CartController, CheckoutItem, CheckoutTotals, FractalButtonVariant, PaymentMethod, PaymentResult } from '../core/types';
5
+ import { CheckoutTheme, CheckoutThemeName } from '../theme/tokens';
6
+ import { CheckoutMessages, CheckoutFormatters, SupportedCurrency, CheckoutLocale } from '../locales/types';
7
+ import { CheckoutPlugin } from '../plugins/types';
8
+ export interface CheckoutProps {
9
+ items: CheckoutItem[];
10
+ totals: CheckoutTotals;
11
+ paymentMethods: PaymentMethod[];
12
+ provider: PaymentProvider;
13
+ currency: SupportedCurrency;
14
+ locale?: CheckoutLocale;
15
+ theme?: CheckoutThemeName | Partial<CheckoutTheme>;
16
+ brandColor?: string;
17
+ customTheme?: Partial<CheckoutTheme>;
18
+ onEvent?: EventHandler;
19
+ cartController?: CartController;
20
+ initialState?: Extract<PaymentResult, {
21
+ status: "success" | "error" | "pending";
22
+ }>;
23
+ devTools?: boolean;
24
+ messages?: Partial<CheckoutMessages>;
25
+ formatters?: CheckoutFormatters;
26
+ plugins?: CheckoutPlugin[];
27
+ }
28
+ export interface CheckoutLayoutProps extends React.HTMLAttributes<HTMLDivElement> {
29
+ children: React.ReactNode;
30
+ sidebar?: React.ReactNode;
31
+ }
32
+ export interface FeedbackScreenProps {
33
+ title: string;
34
+ description?: string;
35
+ actions?: ButtonProps[];
36
+ variant?: PaymentResult["status"];
37
+ children?: ReactNode;
38
+ }
39
+ export type VariantConfig = {
40
+ icon: ReactNode;
41
+ iconBg: string;
42
+ iconColor: string;
43
+ };
44
+ export interface ButtonProps {
45
+ label: string;
46
+ onPress: () => void;
47
+ variant?: FractalButtonVariant;
48
+ icon?: ReactNode;
49
+ disabled?: boolean;
50
+ className?: string;
51
+ type?: "button" | "submit";
52
+ }
53
+ export interface OrderSidebarSummaryProps {
54
+ showItems?: boolean;
55
+ isLoading?: boolean;
56
+ }
57
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACtI,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAChH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,WAAW,aAAa;IAC1B,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,MAAM,EAAE,cAAc,CAAC;IACvB,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,KAAK,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACrC,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,YAAY,CAAC,EAAE,OAAO,CAAC,aAAa,EAAE;QAAE,MAAM,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;KAAE,CAAC,CAAC;IACnF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACrC,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC7E,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB;AAED,MAAM,MAAM,aAAa,GAAG;IACxB,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,WAAW;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC9B;AAED,MAAM,WAAW,wBAAwB;IACrC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB"}
@@ -0,0 +1,56 @@
1
+ import { default as React, ReactNode } from 'react';
2
+ import { CheckoutState } from './checkout-machine';
3
+ import { CheckoutItem, PaymentMethod, CheckoutTotals, CartController, CartState, PaymentResult } from './types';
4
+ import { PaymentProvider } from './provider.interface';
5
+ import { CheckoutEvent, EventHandler } from './event-system';
6
+ import { CheckoutTheme } from '../theme/tokens';
7
+ interface CheckoutContextState {
8
+ items: CheckoutItem[];
9
+ paymentMethods: PaymentMethod[];
10
+ provider: PaymentProvider;
11
+ currency: string;
12
+ locale: string;
13
+ step: CheckoutState;
14
+ selectedMethodId: string | null;
15
+ totals: CheckoutTotals;
16
+ cartController?: CartController;
17
+ theme?: CheckoutTheme;
18
+ error: string | null;
19
+ paymentResult?: PaymentResult;
20
+ }
21
+ type Action = {
22
+ type: "SET_STEP";
23
+ step: CheckoutState;
24
+ } | {
25
+ type: "SELECT_METHOD";
26
+ methodId: string;
27
+ } | {
28
+ type: "SET_ERROR";
29
+ error: string | null;
30
+ } | {
31
+ type: "SET_CART";
32
+ cartState: CartState;
33
+ } | {
34
+ type: "SYNC_PROPS";
35
+ items: CheckoutItem[];
36
+ totals: CheckoutTotals;
37
+ } | {
38
+ type: "SET_PAYMENT_RESULT";
39
+ result: PaymentResult;
40
+ };
41
+ export declare const CheckoutProvider: ({ children, config, initialStatus, onEvent, }: {
42
+ children: ReactNode;
43
+ config: Omit<CheckoutContextState, "step" | "selectedMethodId" | "error" | "paymentResult">;
44
+ initialStatus?: Extract<PaymentResult, {
45
+ status: "success" | "error" | "pending";
46
+ }>;
47
+ onEvent?: EventHandler;
48
+ }) => import("react/jsx-runtime").JSX.Element;
49
+ export declare const useCheckoutContext: () => {
50
+ state: CheckoutContextState;
51
+ dispatch: React.Dispatch<Action>;
52
+ emitEvent: (event: CheckoutEvent) => void;
53
+ eventLog: string[];
54
+ };
55
+ export {};
56
+ //# sourceMappingURL=checkout-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkout-context.d.ts","sourceRoot":"","sources":["../../src/core/checkout-context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwE,MAAM,OAAO,CAAC;AAC7F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,UAAU,oBAAoB;IAC1B,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,aAAa,CAAC;IACpB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,MAAM,EAAE,cAAc,CAAC;IACvB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,aAAa,CAAC,EAAE,aAAa,CAAC;CACjC;AAED,KAAK,MAAM,GACL;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,aAAa,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,SAAS,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,KAAK,EAAE,YAAY,EAAE,CAAC;IAAC,MAAM,EAAE,cAAc,CAAA;CAAE,GACrE;IAAE,IAAI,EAAE,oBAAoB,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,CAAC;AA4B5D,eAAO,MAAM,gBAAgB,GAAI,+CAK9B;IACC,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,IAAI,CAAC,oBAAoB,EAAE,MAAM,GAAG,kBAAkB,GAAG,OAAO,GAAG,eAAe,CAAC,CAAC;IAC5F,aAAa,CAAC,EAAE,OAAO,CAAC,aAAa,EAAE;QAAE,MAAM,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;KAAE,CAAC,CAAC;IACpF,OAAO,CAAC,EAAE,YAAY,CAAC;CAC1B,4CA4BA,CAAC;AAEF,eAAO,MAAM,kBAAkB;WAjEpB,oBAAoB;cACjB,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;eACrB,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI;cAC/B,MAAM,EAAE;CAsErB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export type CheckoutState = "review" | "payment_method" | "payment_details" | "processing" | "pending" | "redirect" | "success" | "error";
2
+ export declare const isValidTransition: (from: CheckoutState, to: CheckoutState) => boolean;
3
+ //# sourceMappingURL=checkout-machine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkout-machine.d.ts","sourceRoot":"","sources":["../../src/core/checkout-machine.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GACnB,QAAQ,GACR,gBAAgB,GAChB,iBAAiB,GACjB,YAAY,GACZ,SAAS,GACT,UAAU,GACV,SAAS,GACT,OAAO,CAAC;AAEd,eAAO,MAAM,iBAAiB,GAAI,MAAM,aAAa,EAAE,IAAI,aAAa,KAAG,OAa1E,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { CheckoutState } from './checkout-machine';
2
+ export type CheckoutEvent = {
3
+ type: "CHECKOUT_VIEWED";
4
+ } | {
5
+ type: "STEP_CHANGED";
6
+ step: CheckoutState;
7
+ } | {
8
+ type: "PAYMENT_METHOD_SELECTED";
9
+ methodId: string;
10
+ } | {
11
+ type: "PAYMENT_SUBMITTED";
12
+ } | {
13
+ type: "PAYMENT_SUCCESS";
14
+ transactionId: string;
15
+ } | {
16
+ type: "PAYMENT_ERROR";
17
+ error: string;
18
+ } | {
19
+ type: "COUPON_APPLY_REQUESTED";
20
+ code: string;
21
+ } | {
22
+ type: "COUPON_REMOVE_REQUESTED";
23
+ } | {
24
+ type: "ITEM_QUANTITY_UPDATE_REQUESTED";
25
+ itemId: string;
26
+ quantity: number;
27
+ } | {
28
+ type: "ITEM_REMOVE_REQUESTED";
29
+ itemId: string;
30
+ };
31
+ export type EventHandler = (event: CheckoutEvent) => void;
32
+ //# sourceMappingURL=event-system.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-system.d.ts","sourceRoot":"","sources":["../../src/core/event-system.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,MAAM,aAAa,GACnB;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE,GAC3B;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,IAAI,EAAE,aAAa,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,yBAAyB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACrD;IAAE,IAAI,EAAE,mBAAmB,CAAA;CAAE,GAC7B;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,wBAAwB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,yBAAyB,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,gCAAgC,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC5E;IAAE,IAAI,EAAE,uBAAuB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAExD,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { ReactNode } from 'react';
2
+ import { CheckoutMessages, CheckoutFormatters } from '../locales/types';
3
+ interface I18nContextValue {
4
+ t: CheckoutMessages;
5
+ fmt: (amount: number) => string;
6
+ }
7
+ export interface I18nProviderProps {
8
+ locale: string;
9
+ currency: string;
10
+ messages?: Partial<CheckoutMessages>;
11
+ formatters?: CheckoutFormatters;
12
+ children: ReactNode;
13
+ }
14
+ export declare const I18nProvider: ({ locale, currency, messages, formatters, children }: I18nProviderProps) => import("react/jsx-runtime").JSX.Element;
15
+ export declare const useI18n: () => I18nContextValue;
16
+ export {};
17
+ //# sourceMappingURL=i18n-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n-context.d.ts","sourceRoot":"","sources":["../../src/core/i18n-context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAI7E,UAAU,gBAAgB;IACtB,CAAC,EAAE,gBAAgB,CAAC;IACpB,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CACnC;AAID,MAAM,WAAW,iBAAiB;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACrC,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,QAAQ,EAAE,SAAS,CAAC;CACvB;AAED,eAAO,MAAM,YAAY,GAAI,sDAAsD,iBAAiB,4CAYnG,CAAC;AAEF,eAAO,MAAM,OAAO,QAAO,gBAM1B,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { PaymentPayload, PaymentResult } from './types';
2
+ export interface PaymentProvider {
3
+ initialize?(config: unknown): Promise<void>;
4
+ createPayment(data: PaymentPayload): Promise<PaymentResult>;
5
+ confirmPayment?(data: unknown): Promise<PaymentResult>;
6
+ }
7
+ //# sourceMappingURL=provider.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.interface.d.ts","sourceRoot":"","sources":["../../src/core/provider.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7D,MAAM,WAAW,eAAe;IAC5B,UAAU,CAAC,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC5D,cAAc,CAAC,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CAC1D"}
@@ -0,0 +1,74 @@
1
+ import { ReactNode } from 'react';
2
+ import { ButtonProps } from '../components/types';
3
+ export interface CheckoutItem {
4
+ id: string;
5
+ name: string;
6
+ quantity: number;
7
+ unitPrice: number;
8
+ discount?: {
9
+ type: "percentage" | "fixed";
10
+ value: number;
11
+ label?: string;
12
+ };
13
+ total: number;
14
+ image?: string;
15
+ }
16
+ export interface CheckoutTotals {
17
+ subtotal: number;
18
+ discount?: number;
19
+ taxes?: number;
20
+ shipping?: number;
21
+ total: number;
22
+ }
23
+ export interface CartState {
24
+ items: CheckoutItem[];
25
+ totals: CheckoutTotals;
26
+ }
27
+ export interface CartController {
28
+ updateQuantity: (id: string, qty: number) => Promise<CartState>;
29
+ removeItem: (id: string) => Promise<CartState>;
30
+ applyCoupon: (code: string) => Promise<CartState>;
31
+ removeCoupon?: () => Promise<CartState>;
32
+ }
33
+ export interface PaymentMethodComponentProps {
34
+ /** Call this to enable or disable the Pay button while the user fills in the form */
35
+ onReadyChange: (ready: boolean) => void;
36
+ }
37
+ export interface PaymentMethod {
38
+ id: string;
39
+ label: string;
40
+ type: string;
41
+ icon?: string;
42
+ /**
43
+ * Optional renderer for inline payment UI (card form, wallet picker, etc.).
44
+ * If provided, the Pay button starts disabled until `onReadyChange(true)` is called.
45
+ */
46
+ renderComponent?: (props: PaymentMethodComponentProps) => ReactNode;
47
+ }
48
+ /**
49
+ * Props the integrator can return from createPayment to control
50
+ * what the FeedbackScreen displays after a payment attempt.
51
+ * `variant` and `children` are always derived by the framework.
52
+ */
53
+ export interface FeedbackProps {
54
+ title: string;
55
+ description?: string;
56
+ actions?: ButtonProps[];
57
+ }
58
+ export type PaymentResult = {
59
+ status: "success";
60
+ feedback?: FeedbackProps;
61
+ } | {
62
+ status: "pending";
63
+ feedback?: FeedbackProps;
64
+ } | {
65
+ status: "error";
66
+ feedback?: FeedbackProps;
67
+ } | {
68
+ status: "redirect";
69
+ url: string;
70
+ feedback?: FeedbackProps;
71
+ };
72
+ export type FractalButtonVariant = "solid" | "outline" | "ghost";
73
+ export type PaymentPayload = unknown;
74
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAIvD,MAAM,WAAW,YAAY;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAElB,QAAQ,CAAC,EAAE;QACP,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC;QAC7B,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IAEF,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACtB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,MAAM,EAAE,cAAc,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC3B,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;IAChE,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;IAC/C,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;IAClD,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;CAC3C;AAID,MAAM,WAAW,2BAA2B;IACxC,qFAAqF;IACrF,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC3C;AAED,MAAM,WAAW,aAAa;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,2BAA2B,KAAK,SAAS,CAAC;CACvE;AAID;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;CAC3B;AAID,MAAM,MAAM,aAAa,GACnB;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,aAAa,CAAA;CAAE,GAC/C;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,aAAa,CAAA;CAAE,GAC/C;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,aAAa,CAAA;CAAE,GAC7C;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,aAAa,CAAA;CAAE,CAAC;AAIpE,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;AAGjE,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { CheckoutState } from '../core/checkout-machine';
2
+ export declare const useCheckout: () => {
3
+ setStep: (step: CheckoutState) => void;
4
+ selectMethod: (methodId: string) => void;
5
+ submitPayment: (data: unknown) => Promise<void>;
6
+ setError: (error: string) => void;
7
+ updateQuantity: (id: string, qty: number) => Promise<void>;
8
+ removeItem: (id: string) => Promise<void>;
9
+ applyCoupon: (code: string) => Promise<boolean>;
10
+ removeCoupon: () => Promise<boolean>;
11
+ hasCartController: boolean;
12
+ hasRemoveCoupon: boolean;
13
+ items: import('..').CheckoutItem[];
14
+ paymentMethods: import('..').PaymentMethod[];
15
+ provider: import('..').PaymentProvider;
16
+ currency: string;
17
+ locale: string;
18
+ step: CheckoutState;
19
+ selectedMethodId: string | null;
20
+ totals: import('..').CheckoutTotals;
21
+ cartController?: import('..').CartController;
22
+ theme?: import('..').CheckoutTheme;
23
+ error: string | null;
24
+ paymentResult?: import('..').PaymentResult;
25
+ };
26
+ //# sourceMappingURL=useCheckout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCheckout.d.ts","sourceRoot":"","sources":["../../src/hooks/useCheckout.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,eAAO,MAAM,WAAW;oBAGG,aAAa;6BAKJ,MAAM;0BAKH,OAAO;sBAyCjB,MAAM;yBAKG,MAAM,OAAO,MAAM;qBAMvB,MAAM;wBAMH,MAAM,KAAG,OAAO,CAAC,OAAO,CAAC;wBAW3B,OAAO,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;CAwBlD,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,360 +1,16 @@
1
- import { ClassValue } from 'clsx';
2
- import { CSSProperties } from 'react';
3
- import { default as default_2 } from 'react';
4
- import { ReactNode } from 'react';
5
-
6
- declare interface ButtonProps {
7
- label: string;
8
- onPress: () => void;
9
- variant?: FractalButtonVariant;
10
- icon?: ReactNode;
11
- disabled?: boolean;
12
- className?: string;
13
- type?: "button" | "submit";
14
- }
15
-
16
- export declare interface CartController {
17
- updateQuantity: (id: string, qty: number) => Promise<CartState>;
18
- removeItem: (id: string) => Promise<CartState>;
19
- applyCoupon: (code: string) => Promise<CartState>;
20
- removeCoupon?: () => Promise<CartState>;
21
- }
22
-
23
- export declare interface CartEditPluginOptions {
24
- allowRemove?: boolean;
25
- allowQuantityEdit?: boolean;
26
- minQuantity?: number;
27
- maxQuantity?: number;
28
- }
29
-
30
- export declare interface CartState {
31
- items: CheckoutItem[];
32
- totals: CheckoutTotals;
33
- }
34
-
35
- export declare const Checkout: default_2.FC<CheckoutProps>;
36
-
37
- export declare type CheckoutEvent = {
38
- type: "CHECKOUT_VIEWED";
39
- } | {
40
- type: "STEP_CHANGED";
41
- step: CheckoutState;
42
- } | {
43
- type: "PAYMENT_METHOD_SELECTED";
44
- methodId: string;
45
- } | {
46
- type: "PAYMENT_SUBMITTED";
47
- } | {
48
- type: "PAYMENT_SUCCESS";
49
- transactionId: string;
50
- } | {
51
- type: "PAYMENT_ERROR";
52
- error: string;
53
- } | {
54
- type: "COUPON_APPLY_REQUESTED";
55
- code: string;
56
- } | {
57
- type: "COUPON_REMOVE_REQUESTED";
58
- } | {
59
- type: "ITEM_QUANTITY_UPDATE_REQUESTED";
60
- itemId: string;
61
- quantity: number;
62
- } | {
63
- type: "ITEM_REMOVE_REQUESTED";
64
- itemId: string;
65
- };
66
-
67
- export declare interface CheckoutFormatters {
68
- currency?: (amount: number) => string;
69
- }
70
-
71
- export declare interface CheckoutItem {
72
- id: string;
73
- name: string;
74
- quantity: number;
75
- unitPrice: number;
76
- discount?: {
77
- type: "percentage" | "fixed";
78
- value: number;
79
- label?: string;
80
- };
81
- total: number;
82
- image?: string;
83
- }
84
-
85
- export declare type CheckoutLocale = "es" | "en" | "pt-BR" | "auto";
86
-
87
- export declare interface CheckoutMessages {
88
- orderSummary: string;
89
- quantity: string;
90
- quantityShort: string;
91
- removeItem: string;
92
- subtotal: string;
93
- discount: string;
94
- shipping: string;
95
- shippingFree: string;
96
- taxes: string;
97
- total: string;
98
- couponPlaceholder: string;
99
- couponApply: string;
100
- couponApplied: string;
101
- couponInvalid: string;
102
- couponRemove: string;
103
- orderSummaryTitle: string;
104
- securePayment: string;
105
- continueToPay: string;
106
- payNow: string;
107
- pay: string;
108
- processing: string;
109
- continueNow: string;
110
- paymentMethod: string;
111
- back: string;
112
- completeDetails: string;
113
- selectMethod: string;
114
- processingPayment: string;
115
- processingDescription: string;
116
- redirecting: string;
117
- redirectDescription: string;
118
- showOrderDetails: string;
119
- hideOrderDetails: string;
120
- continue: string;
121
- }
122
-
123
- export declare interface CheckoutPlugin {
124
- id: string;
125
- slots: PluginSlots;
126
- }
127
-
128
- declare interface CheckoutProps {
129
- items: CheckoutItem[];
130
- totals: CheckoutTotals;
131
- paymentMethods: PaymentMethod[];
132
- provider: PaymentProvider;
133
- currency: SupportedCurrency;
134
- locale?: CheckoutLocale;
135
- theme?: CheckoutThemeName | Partial<CheckoutTheme>;
136
- brandColor?: string;
137
- customTheme?: Partial<CheckoutTheme>;
138
- onEvent?: EventHandler;
139
- cartController?: CartController;
140
- initialState?: Extract<PaymentResult, {
141
- status: "success" | "error" | "pending";
142
- }>;
143
- devTools?: boolean;
144
- messages?: Partial<CheckoutMessages>;
145
- formatters?: CheckoutFormatters;
146
- plugins?: CheckoutPlugin[];
147
- }
148
-
149
- export declare type CheckoutState = "review" | "payment_method" | "payment_details" | "processing" | "pending" | "redirect" | "success" | "error";
150
-
151
- export declare interface CheckoutTheme {
152
- colors: Partial<CheckoutThemeColors>;
153
- radius: string;
154
- fontFamily: string;
155
- }
156
-
157
- export declare interface CheckoutThemeColors {
158
- primary: string;
159
- background: string;
160
- surface: string;
161
- text: string;
162
- border: string;
163
- success: string;
164
- error: string;
165
- }
166
-
167
- export declare type CheckoutThemeName = "light" | "dark" | "minimal" | "corporate" | "neon";
168
-
169
- export declare const checkoutThemes: Record<CheckoutThemeName, CheckoutTheme>;
170
-
171
- export declare interface CheckoutTotals {
172
- subtotal: number;
173
- discount?: number;
174
- taxes?: number;
175
- shipping?: number;
176
- total: number;
177
- }
178
-
179
- export declare function cn(...inputs: ClassValue[]): string;
180
-
181
- export declare function createCartEditPlugin(emit: EventHandler, options?: CartEditPluginOptions): CheckoutPlugin;
182
-
183
- export declare function createCssVars(theme: CheckoutTheme): CSSProperties;
184
-
185
- export declare function createDiscountPlugin(emit: EventHandler): CheckoutPlugin;
186
-
187
- /**
188
- * Darkens a hex color by a given amount (0–100).
189
- */
190
- export declare function darken(hex: string, amount: number): string;
191
-
192
- export declare const defaultTheme: CheckoutTheme;
193
-
194
- export declare type EventHandler = (event: CheckoutEvent) => void;
195
-
196
- /**
197
- * Props the integrator can return from createPayment to control
198
- * what the FeedbackScreen displays after a payment attempt.
199
- * `variant` and `children` are always derived by the framework.
200
- */
201
- export declare interface FeedbackProps {
202
- title: string;
203
- description?: string;
204
- actions?: ButtonProps[];
205
- }
206
-
207
- export declare const formatNumber: (n: number, currency: string) => string;
208
-
209
- export declare type FractalButtonVariant = "solid" | "outline" | "ghost";
210
-
211
- /**
212
- * Generates a complete CheckoutTheme from a single brand color.
213
- * Uses the brand color as `primary` and auto-generates all other tokens.
214
- */
215
- export declare function generateBrandTheme(brandColor: string): CheckoutTheme;
216
-
217
- /**
218
- * Returns #000000 or #FFFFFF based on which provides better contrast
219
- * against the given background color.
220
- */
221
- export declare function getContrastColor(hex: string): string;
222
-
223
- /**
224
- * Calculates relative luminance using sRGB coefficients (W3C formula).
225
- * Returns a value between 0 (black) and 1 (white).
226
- */
227
- export declare function getLuminance(hex: string): number;
228
-
229
- export declare function hexToRgb(hex: string): RGB;
230
-
231
- /**
232
- * Returns true if the color is considered "dark" (luminance < 0.5).
233
- */
234
- export declare function isDark(hex: string): boolean;
235
-
236
- export declare const isPaymentStep: (step: string) => step is "payment_method" | "payment_details";
237
-
238
- export declare const isReviewStep: (step: string) => step is "review";
239
-
240
- /**
241
- * Lightens a hex color by a given amount (0–100).
242
- */
243
- export declare function lighten(hex: string, amount: number): string;
244
-
245
- export declare function mergeTheme(base: CheckoutTheme, overrides?: Partial<CheckoutTheme>): CheckoutTheme;
246
-
247
- /**
248
- * Mixes two hex colors by a given ratio (0 = first color, 1 = second color).
249
- */
250
- export declare function mix(hex1: string, hex2: string, ratio: number): string;
251
-
252
- export declare interface PaymentMethod {
253
- id: string;
254
- label: string;
255
- type: string;
256
- icon?: string;
257
- /**
258
- * Optional renderer for inline payment UI (card form, wallet picker, etc.).
259
- * If provided, the Pay button starts disabled until `onReadyChange(true)` is called.
260
- */
261
- renderComponent?: (props: PaymentMethodComponentProps) => ReactNode;
262
- }
263
-
264
- export declare interface PaymentMethodComponentProps {
265
- /** Call this to enable or disable the Pay button while the user fills in the form */
266
- onReadyChange: (ready: boolean) => void;
267
- }
268
-
269
- export declare type PaymentPayload = unknown;
270
-
271
- export declare interface PaymentProvider {
272
- initialize?(config: unknown): Promise<void>;
273
- createPayment(data: PaymentPayload): Promise<PaymentResult>;
274
- confirmPayment?(data: unknown): Promise<PaymentResult>;
275
- }
276
-
277
- export declare type PaymentResult = {
278
- status: "success";
279
- feedback?: FeedbackProps;
280
- } | {
281
- status: "pending";
282
- feedback?: FeedbackProps;
283
- } | {
284
- status: "error";
285
- feedback?: FeedbackProps;
286
- } | {
287
- status: "redirect";
288
- url: string;
289
- feedback?: FeedbackProps;
290
- };
291
-
292
- export declare interface PluginItemSlotProps extends PluginSlotProps {
293
- item: CheckoutItem;
294
- }
295
-
296
- export declare interface PluginSlotProps {
297
- items: CheckoutItem[];
298
- totals: CheckoutTotals;
299
- step: string;
300
- t: CheckoutMessages;
301
- fmt: (amount: number) => string;
302
- }
303
-
304
- export declare interface PluginSlots {
305
- orderItemActions?: (props: PluginItemSlotProps) => ReactNode;
306
- /** Renders at the end of item row in OrderSummary (e.g. remove icon) */
307
- orderItemEnd?: (props: PluginItemSlotProps) => ReactNode;
308
- /** Renders before totals in sidebar (desktop) — e.g. coupon input */
309
- sidebarBeforeTotals?: (props: PluginSlotProps) => ReactNode;
310
- /** Renders next to discount line in totals — e.g. remove coupon */
311
- totalsDiscountAction?: (props: PluginSlotProps) => ReactNode;
312
- /** Renders inside mobile bar expandable section — e.g. coupon input */
313
- mobileBarExpanded?: (props: PluginSlotProps) => ReactNode;
314
- }
315
-
316
- /**
317
- * Priority chain: customTheme overrides → brandColor theme → preset theme
318
- */
319
- export declare function resolveTheme(theme?: CheckoutThemeName | Partial<CheckoutTheme>, brandColor?: string, customTheme?: Partial<CheckoutTheme>): CheckoutTheme;
320
-
321
- /**
322
- * Color manipulation utilities for the Brand Auto Theme system.
323
- * All functions work with hex color strings (#RRGGBB or #RGB).
324
- */
325
- declare interface RGB {
326
- r: number;
327
- g: number;
328
- b: number;
329
- }
330
-
331
- export declare function rgbToHex({ r, g, b }: RGB): string;
332
-
333
- export declare type SupportedCurrency = "USD" | "EUR" | "GBP" | "BRL" | "ARS" | "MXN" | "CLP" | "COP" | "PEN" | "UYU" | "PYG" | "BOB" | "VES" | "DOP" | "CRC" | "GTQ" | "HNL" | "NIO" | "PAB" | "CAD" | "JPY" | "CNY" | "KRW" | "INR" | "AUD" | (string & {});
334
-
335
- export declare const useCheckout: () => {
336
- setStep: (step: CheckoutState) => void;
337
- selectMethod: (methodId: string) => void;
338
- submitPayment: (data: unknown) => Promise<void>;
339
- setError: (error: string) => void;
340
- updateQuantity: (id: string, qty: number) => Promise<void>;
341
- removeItem: (id: string) => Promise<void>;
342
- applyCoupon: (code: string) => Promise<boolean>;
343
- removeCoupon: () => Promise<boolean>;
344
- hasCartController: boolean;
345
- hasRemoveCoupon: boolean;
346
- items: CheckoutItem[];
347
- paymentMethods: PaymentMethod[];
348
- provider: PaymentProvider;
349
- currency: string;
350
- locale: string;
351
- step: CheckoutState;
352
- selectedMethodId: string | null;
353
- totals: CheckoutTotals;
354
- cartController?: CartController;
355
- theme?: CheckoutTheme;
356
- error: string | null;
357
- paymentResult?: PaymentResult;
358
- };
359
-
360
- export { }
1
+ export type { CheckoutItem, CheckoutTotals, CartState, CartController, PaymentMethod, PaymentMethodComponentProps, PaymentResult, FeedbackProps, PaymentPayload, FractalButtonVariant } from './core/types';
2
+ export type { PaymentProvider } from './core/provider.interface';
3
+ export type { CheckoutEvent, EventHandler } from './core/event-system';
4
+ export type { CheckoutState } from './core/checkout-machine';
5
+ export type { CheckoutTheme, CheckoutThemeColors, CheckoutThemeName } from './theme/tokens';
6
+ export { checkoutThemes, defaultTheme, mergeTheme, createCssVars, generateBrandTheme, resolveTheme } from './theme/tokens';
7
+ export { hexToRgb, rgbToHex, getLuminance, getContrastColor, isDark, darken, lighten, mix } from './theme/color-utils';
8
+ export type { CheckoutMessages, CheckoutFormatters, CheckoutLocale, SupportedCurrency } from './locales/types';
9
+ export type { CheckoutPlugin, PluginSlots, PluginSlotProps, PluginItemSlotProps } from './plugins/types';
10
+ export type { CartEditPluginOptions } from './plugins/cart-edit-plugin';
11
+ export { createDiscountPlugin } from './plugins/discount-plugin';
12
+ export { createCartEditPlugin } from './plugins/cart-edit-plugin';
13
+ export { useCheckout } from './hooks/useCheckout';
14
+ export { cn, formatNumber, isPaymentStep, isReviewStep } from './utils/utils';
15
+ export { Checkout } from './components/Checkout';
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAGtB,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,aAAa,EAAE,2BAA2B,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC5M,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACvE,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC3H,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAGvH,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAG/G,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACzG,YAAY,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGlE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG9E,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { CheckoutMessages } from './types';
2
+ export declare const en: CheckoutMessages;
3
+ //# sourceMappingURL=en.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/locales/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,EAAE,EAAE,gBAmDhB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { CheckoutMessages } from './types';
2
+ export declare const es: CheckoutMessages;
3
+ //# sourceMappingURL=es.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../src/locales/es.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,EAAE,EAAE,gBAmDhB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { CheckoutLocale, CheckoutMessages } from './types';
2
+ export type { CheckoutMessages, CheckoutLocale, CheckoutFormatters, SupportedCurrency } from './types';
3
+ /**
4
+ * Detects the best matching locale from the browser's language settings.
5
+ * Maps browser languages (e.g. "es-AR", "pt-BR", "en-US") to supported locales.
6
+ */
7
+ export declare function detectLocale(): string;
8
+ /**
9
+ * Resolves "auto" to a detected locale, or returns the locale as-is.
10
+ */
11
+ export declare function resolveLocale(locale: CheckoutLocale | string): string;
12
+ export declare function getMessages(locale: CheckoutLocale | string): CheckoutMessages;
13
+ export declare function resolveMessages(locale: CheckoutLocale | string, overrides?: Partial<CheckoutMessages>): CheckoutMessages;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/locales/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhE,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAUvG;;;GAGG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAkBrC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,GAAG,MAAM,CAErE;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,GAAG,gBAAgB,CAG7E;AAED,wBAAgB,eAAe,CAC3B,MAAM,EAAE,cAAc,GAAG,MAAM,EAC/B,SAAS,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GACtC,gBAAgB,CAIlB"}
@@ -0,0 +1,3 @@
1
+ import { CheckoutMessages } from './types';
2
+ export declare const ptBR: CheckoutMessages;
3
+ //# sourceMappingURL=pt-BR.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pt-BR.d.ts","sourceRoot":"","sources":["../../src/locales/pt-BR.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,IAAI,EAAE,gBAmDlB,CAAC"}
@@ -0,0 +1,41 @@
1
+ export interface CheckoutMessages {
2
+ orderSummary: string;
3
+ quantity: string;
4
+ quantityShort: string;
5
+ removeItem: string;
6
+ subtotal: string;
7
+ discount: string;
8
+ shipping: string;
9
+ shippingFree: string;
10
+ taxes: string;
11
+ total: string;
12
+ couponPlaceholder: string;
13
+ couponApply: string;
14
+ couponApplied: string;
15
+ couponInvalid: string;
16
+ couponRemove: string;
17
+ orderSummaryTitle: string;
18
+ securePayment: string;
19
+ continueToPay: string;
20
+ payNow: string;
21
+ pay: string;
22
+ processing: string;
23
+ continueNow: string;
24
+ paymentMethod: string;
25
+ back: string;
26
+ completeDetails: string;
27
+ selectMethod: string;
28
+ processingPayment: string;
29
+ processingDescription: string;
30
+ redirecting: string;
31
+ redirectDescription: string;
32
+ showOrderDetails: string;
33
+ hideOrderDetails: string;
34
+ continue: string;
35
+ }
36
+ export type CheckoutLocale = "es" | "en" | "pt-BR" | "auto";
37
+ export type SupportedCurrency = "USD" | "EUR" | "GBP" | "BRL" | "ARS" | "MXN" | "CLP" | "COP" | "PEN" | "UYU" | "PYG" | "BOB" | "VES" | "DOP" | "CRC" | "GTQ" | "HNL" | "NIO" | "PAB" | "CAD" | "JPY" | "CNY" | "KRW" | "INR" | "AUD" | (string & {});
38
+ export interface CheckoutFormatters {
39
+ currency?: (amount: number) => string;
40
+ }
41
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/locales/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAE7B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IAGnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IAGd,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IAGrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IAGtB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IAGpB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IAGrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,qBAAqB,EAAE,MAAM,CAAC;IAG9B,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;IAG5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,CAAC;AAE5D,MAAM,MAAM,iBAAiB,GACvB,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GACrC,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GACrC,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GACrC,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GACrC,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GACrC,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEpB,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CACzC"}
@@ -0,0 +1,10 @@
1
+ import { CheckoutPlugin } from './types';
2
+ import { EventHandler } from '../core/event-system';
3
+ export interface CartEditPluginOptions {
4
+ allowRemove?: boolean;
5
+ allowQuantityEdit?: boolean;
6
+ minQuantity?: number;
7
+ maxQuantity?: number;
8
+ }
9
+ export declare function createCartEditPlugin(emit: EventHandler, options?: CartEditPluginOptions): CheckoutPlugin;
10
+ //# sourceMappingURL=cart-edit-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart-edit-plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/cart-edit-plugin.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAuB,MAAM,SAAS,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIzD,MAAM,WAAW,qBAAqB;IAClC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AA4ID,wBAAgB,oBAAoB,CAChC,IAAI,EAAE,YAAY,EAClB,OAAO,CAAC,EAAE,qBAAqB,GAChC,cAAc,CAoBhB"}
@@ -0,0 +1,4 @@
1
+ import { CheckoutPlugin } from './types';
2
+ import { EventHandler } from '../core/event-system';
3
+ export declare function createDiscountPlugin(emit: EventHandler): CheckoutPlugin;
4
+ //# sourceMappingURL=discount-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discount-plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/discount-plugin.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAmB,MAAM,SAAS,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AA8DzD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,YAAY,GAAG,cAAc,CA0CvE"}
@@ -0,0 +1,6 @@
1
+ export type { CheckoutPlugin, PluginSlots, PluginSlotProps, PluginItemSlotProps } from './types';
2
+ export type { CartEditPluginOptions } from './cart-edit-plugin';
3
+ export { createDiscountPlugin } from './discount-plugin';
4
+ export { createCartEditPlugin } from './cart-edit-plugin';
5
+ export { PluginProvider, usePlugins, renderSlot, renderItemSlot } from './plugin-context';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AACjG,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ import { CheckoutPlugin, PluginSlotProps, PluginItemSlotProps, PluginContextValue } from './types';
3
+ export declare const PluginProvider: ({ plugins, children }: {
4
+ plugins: CheckoutPlugin[];
5
+ children: ReactNode;
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const usePlugins: () => PluginContextValue;
8
+ export declare function renderSlot(plugins: CheckoutPlugin[], slotName: keyof CheckoutPlugin["slots"], props: PluginSlotProps): ReactNode[];
9
+ export declare function renderItemSlot(plugins: CheckoutPlugin[], slotName: keyof CheckoutPlugin["slots"], props: PluginItemSlotProps): ReactNode[];
10
+ //# sourceMappingURL=plugin-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-context.d.ts","sourceRoot":"","sources":["../../src/plugins/plugin-context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAIxG,eAAO,MAAM,cAAc,GAAI,uBAAuB;IAAE,OAAO,EAAE,cAAc,EAAE,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,4CAGvG,CAAC;AAEF,eAAO,MAAM,UAAU,0BAAkC,CAAC;AAE1D,wBAAgB,UAAU,CACtB,OAAO,EAAE,cAAc,EAAE,EACzB,QAAQ,EAAE,MAAM,cAAc,CAAC,OAAO,CAAC,EACvC,KAAK,EAAE,eAAe,GACvB,SAAS,EAAE,CAOb;AAED,wBAAgB,cAAc,CAC1B,OAAO,EAAE,cAAc,EAAE,EACzB,QAAQ,EAAE,MAAM,cAAc,CAAC,OAAO,CAAC,EACvC,KAAK,EAAE,mBAAmB,GAC3B,SAAS,EAAE,CAOb"}
@@ -0,0 +1,32 @@
1
+ import { ReactNode } from 'react';
2
+ import { CheckoutItem, CheckoutTotals } from '../core/types';
3
+ import { CheckoutMessages } from '../locales/types';
4
+ export interface PluginContextValue {
5
+ plugins: CheckoutPlugin[];
6
+ }
7
+ export interface PluginSlotProps {
8
+ items: CheckoutItem[];
9
+ totals: CheckoutTotals;
10
+ step: string;
11
+ t: CheckoutMessages;
12
+ fmt: (amount: number) => string;
13
+ }
14
+ export interface PluginItemSlotProps extends PluginSlotProps {
15
+ item: CheckoutItem;
16
+ }
17
+ export interface PluginSlots {
18
+ orderItemActions?: (props: PluginItemSlotProps) => ReactNode;
19
+ /** Renders at the end of item row in OrderSummary (e.g. remove icon) */
20
+ orderItemEnd?: (props: PluginItemSlotProps) => ReactNode;
21
+ /** Renders before totals in sidebar (desktop) — e.g. coupon input */
22
+ sidebarBeforeTotals?: (props: PluginSlotProps) => ReactNode;
23
+ /** Renders next to discount line in totals — e.g. remove coupon */
24
+ totalsDiscountAction?: (props: PluginSlotProps) => ReactNode;
25
+ /** Renders inside mobile bar expandable section — e.g. coupon input */
26
+ mobileBarExpanded?: (props: PluginSlotProps) => ReactNode;
27
+ }
28
+ export interface CheckoutPlugin {
29
+ id: string;
30
+ slots: PluginSlots;
31
+ }
32
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/plugins/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,WAAW,kBAAkB;IAC/B,OAAO,EAAE,cAAc,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,eAAe;IAC5B,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,MAAM,EAAE,cAAc,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,gBAAgB,CAAC;IACpB,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IACxD,IAAI,EAAE,YAAY,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IACxB,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,SAAS,CAAC;IAE7D,wEAAwE;IACxE,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,SAAS,CAAC;IAEzD,qEAAqE;IACrE,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,SAAS,CAAC;IAE5D,mEAAmE;IACnE,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,SAAS,CAAC;IAE7D,uEAAuE;IACvE,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,SAAS,CAAC;CAC7D;AAED,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,WAAW,CAAC;CACtB"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Color manipulation utilities for the Brand Auto Theme system.
3
+ * All functions work with hex color strings (#RRGGBB or #RGB).
4
+ */
5
+ interface RGB {
6
+ r: number;
7
+ g: number;
8
+ b: number;
9
+ }
10
+ export declare function hexToRgb(hex: string): RGB;
11
+ export declare function rgbToHex({ r, g, b }: RGB): string;
12
+ /**
13
+ * Calculates relative luminance using sRGB coefficients (W3C formula).
14
+ * Returns a value between 0 (black) and 1 (white).
15
+ */
16
+ export declare function getLuminance(hex: string): number;
17
+ /**
18
+ * Returns #000000 or #FFFFFF based on which provides better contrast
19
+ * against the given background color.
20
+ */
21
+ export declare function getContrastColor(hex: string): string;
22
+ /**
23
+ * Returns true if the color is considered "dark" (luminance < 0.5).
24
+ */
25
+ export declare function isDark(hex: string): boolean;
26
+ /**
27
+ * Darkens a hex color by a given amount (0–100).
28
+ */
29
+ export declare function darken(hex: string, amount: number): string;
30
+ /**
31
+ * Lightens a hex color by a given amount (0–100).
32
+ */
33
+ export declare function lighten(hex: string, amount: number): string;
34
+ /**
35
+ * Mixes two hex colors by a given ratio (0 = first color, 1 = second color).
36
+ */
37
+ export declare function mix(hex1: string, hex2: string, ratio: number): string;
38
+ export {};
39
+ //# sourceMappingURL=color-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-utils.d.ts","sourceRoot":"","sources":["../../src/theme/color-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,UAAU,GAAG;IACT,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACb;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAWzC;AAED,wBAAgB,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,GAAG,MAAM,CAGjD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMhD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE3C;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAQ1D;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAQ3D;AAED;;GAEG;AACH,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAQrE"}
@@ -0,0 +1,11 @@
1
+ import { default as React } from 'react';
2
+ import { CheckoutTheme, CheckoutThemeName } from './tokens';
3
+ interface ThemeProviderProps {
4
+ theme?: CheckoutThemeName | Partial<CheckoutTheme>;
5
+ brandColor?: string;
6
+ customTheme?: Partial<CheckoutTheme>;
7
+ children: React.ReactNode;
8
+ }
9
+ export declare const ThemeProvider: React.FC<ThemeProviderProps>;
10
+ export {};
11
+ //# sourceMappingURL=theme-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-provider.d.ts","sourceRoot":"","sources":["../../src/theme/theme-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGjE,UAAU,kBAAkB;IACxB,KAAK,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAYtD,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { CSSProperties } from 'react';
2
+ export interface CheckoutThemeColors {
3
+ primary: string;
4
+ background: string;
5
+ surface: string;
6
+ text: string;
7
+ border: string;
8
+ success: string;
9
+ error: string;
10
+ }
11
+ export interface CheckoutTheme {
12
+ colors: Partial<CheckoutThemeColors>;
13
+ radius: string;
14
+ fontFamily: string;
15
+ }
16
+ export type CheckoutThemeName = "light" | "dark" | "minimal" | "corporate" | "neon";
17
+ export declare const checkoutThemes: Record<CheckoutThemeName, CheckoutTheme>;
18
+ export declare const defaultTheme: CheckoutTheme;
19
+ export declare function mergeTheme(base: CheckoutTheme, overrides?: Partial<CheckoutTheme>): CheckoutTheme;
20
+ export declare function createCssVars(theme: CheckoutTheme): CSSProperties;
21
+ /**
22
+ * Generates a complete CheckoutTheme from a single brand color.
23
+ * Uses the brand color as `primary` and auto-generates all other tokens.
24
+ */
25
+ export declare function generateBrandTheme(brandColor: string): CheckoutTheme;
26
+ /**
27
+ * Priority chain: customTheme overrides → brandColor theme → preset theme
28
+ */
29
+ export declare function resolveTheme(theme?: CheckoutThemeName | Partial<CheckoutTheme>, brandColor?: string, customTheme?: Partial<CheckoutTheme>): CheckoutTheme;
30
+ //# sourceMappingURL=tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/theme/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAG3C,MAAM,WAAW,mBAAmB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,CAAC;AAwEpF,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,iBAAiB,EAAE,aAAa,CAMnE,CAAC;AAEF,eAAO,MAAM,YAAY,eAAQ,CAAC;AAElC,wBAAgB,UAAU,CACtB,IAAI,EAAE,aAAa,EACnB,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACnC,aAAa,CAQf;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,aAAa,CAYjE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa,CAiBpE;AAED;;GAEG;AACH,wBAAgB,YAAY,CACxB,KAAK,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC,EAClD,UAAU,CAAC,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GACrC,aAAa,CAYf"}
@@ -0,0 +1,6 @@
1
+ import { ClassValue } from 'clsx';
2
+ export declare function cn(...inputs: ClassValue[]): string;
3
+ export declare const isPaymentStep: (step: string) => step is "payment_method" | "payment_details";
4
+ export declare const isReviewStep: (step: string) => step is "review";
5
+ export declare const formatNumber: (n: number, currency: string) => string;
6
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAG7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,iDACiB,CAAC;AAE5D,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,qBAAsB,CAAC;AAEhE,eAAO,MAAM,YAAY,GAAI,GAAG,MAAM,EAAE,UAAU,MAAM,WACqB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anpayeras/agnostic-checkout",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Provider-agnostic, embeddable React checkout component with dynamic theming and plugin architecture",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -13,12 +13,15 @@
13
13
  "import": "./dist/index.js",
14
14
  "require": "./dist/index.cjs"
15
15
  },
16
- "./styles": "./dist/style.css"
16
+ "./styles": "./dist/style.css",
17
+ "./style.css": "./dist/style.css"
17
18
  },
18
19
  "files": [
19
20
  "dist"
20
21
  ],
21
- "sideEffects": false,
22
+ "sideEffects": [
23
+ "./dist/style.css"
24
+ ],
22
25
  "scripts": {
23
26
  "build": "vite build",
24
27
  "lint": "eslint src/",