@anpayeras/agnostic-checkout 0.1.0 → 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 (77) 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.cjs +157 -1622
  42. package/dist/index.d.ts +16 -321
  43. package/dist/index.d.ts.map +1 -0
  44. package/dist/index.js +4291 -1025
  45. package/dist/locales/en.d.ts +3 -0
  46. package/dist/locales/en.d.ts.map +1 -0
  47. package/dist/locales/es.d.ts +3 -0
  48. package/dist/locales/es.d.ts.map +1 -0
  49. package/dist/locales/index.d.ts +14 -0
  50. package/dist/locales/index.d.ts.map +1 -0
  51. package/dist/locales/pt-BR.d.ts +3 -0
  52. package/dist/locales/pt-BR.d.ts.map +1 -0
  53. package/dist/locales/types.d.ts +41 -0
  54. package/dist/locales/types.d.ts.map +1 -0
  55. package/dist/plugins/cart-edit-plugin.d.ts +10 -0
  56. package/dist/plugins/cart-edit-plugin.d.ts.map +1 -0
  57. package/dist/plugins/discount-plugin.d.ts +4 -0
  58. package/dist/plugins/discount-plugin.d.ts.map +1 -0
  59. package/dist/plugins/index.d.ts +6 -0
  60. package/dist/plugins/index.d.ts.map +1 -0
  61. package/dist/plugins/plugin-context.d.ts +10 -0
  62. package/dist/plugins/plugin-context.d.ts.map +1 -0
  63. package/dist/plugins/types.d.ts +32 -0
  64. package/dist/plugins/types.d.ts.map +1 -0
  65. package/dist/style.css +1 -0
  66. package/dist/theme/color-utils.d.ts +39 -0
  67. package/dist/theme/color-utils.d.ts.map +1 -0
  68. package/dist/theme/theme-provider.d.ts +11 -0
  69. package/dist/theme/theme-provider.d.ts.map +1 -0
  70. package/dist/theme/tokens.d.ts +30 -0
  71. package/dist/theme/tokens.d.ts.map +1 -0
  72. package/dist/utils/utils.d.ts +6 -0
  73. package/dist/utils/utils.d.ts.map +1 -0
  74. package/package.json +17 -9
  75. package/dist/index.cjs.map +0 -1
  76. package/dist/index.d.cts +0 -321
  77. package/dist/index.js.map +0 -1
@@ -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,MA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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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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"}