@gait-financial/react 0.0.16 → 0.1.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/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  React wrappers for Gait Web Components. Thin, type-safe bindings that map React props to the underlying custom elements.
4
4
 
5
+ The button always shows **"Gait"** with the Gait logo icon and uses brand color **#4147BF**. No `label`, `theme`, or `brandColor` props.
6
+
5
7
  ## Installation
6
8
 
7
9
  ```bash
@@ -34,11 +36,8 @@ import { GaitButton } from '@gait-financial/react';
34
36
  function Checkout() {
35
37
  return (
36
38
  <GaitButton
37
- label="Checkout"
38
- theme="dark"
39
39
  data-id="your-checkout-id"
40
40
  totalCost={99.99}
41
- brandColor="#e91e63"
42
41
  onClick={(detail) => console.log('Clicked', detail)}
43
42
  onSplitFeedback={(detail) => {
44
43
  if (detail.success) console.log('Split sent!');
@@ -53,8 +52,6 @@ function Checkout() {
53
52
 
54
53
  | Prop | Type | Description |
55
54
  |------|------|-------------|
56
- | `label` | `string` | Button label (default: "Button") |
57
- | `theme` | `'dark' \| 'light'` | Theme variant |
58
55
  | `data-id` | `string` | Checkout/data identity (required for payments) |
59
56
  | `disabled` | `boolean` | Disable the button |
60
57
  | `size` | `'small' \| 'medium' \| 'large'` | Button size |
@@ -62,7 +59,6 @@ function Checkout() {
62
59
  | `items` | `GaitButtonItem[] \| string` | Cart items for split payment modal |
63
60
  | `priceBreakdown` | `GaitPriceBreakdownItem[] \| string` | Price breakdown |
64
61
  | `totalCost` | `number \| string` | Total cost |
65
- | `brandColor` | `string` | Brand/accent color |
66
62
  | `customer` | `GaitCustomer \| string` | Customer info for split payment |
67
63
  | `webhook` | `GaitWebhook \| string` | Webhook config for split callbacks |
68
64
  | `merchantStoreUrl` | `string` | Merchant store URL |
@@ -73,6 +69,8 @@ function Checkout() {
73
69
  | `onMerchantIdError` | `(detail) => void` | Merchant ID lookup failed |
74
70
  | `onConfirm` | `(detail) => void` | Pay remaining confirmed |
75
71
 
72
+ The button label is always **"Gait"** (with icon). Brand color is fixed to **#4147BF**; split-option styling uses **#F3F2FF**.
73
+
76
74
  ## Next.js
77
75
 
78
76
  The package uses `"use client"` directives. Import and use in Client Components:
@@ -84,7 +82,7 @@ import '@gait-financial/react/register';
84
82
  import { GaitButton } from '@gait-financial/react';
85
83
 
86
84
  export default function CheckoutPage() {
87
- return <GaitButton data-id="..." label="Pay" />;
85
+ return <GaitButton data-id="your-checkout-id" />;
88
86
  }
89
87
  ```
90
88
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gait-financial/react",
3
- "version": "0.0.16",
3
+ "version": "0.1.0",
4
4
  "private": false,
5
5
  "description": "React wrappers for Gait Web Components",
6
6
  "type": "module",
@@ -29,10 +29,7 @@
29
29
  }
30
30
  }
31
31
  },
32
- "files": [
33
- "dist",
34
- "wc"
35
- ],
32
+ "files": [],
36
33
  "scripts": {
37
34
  "build": "npm run copy:wc && tsup && npm run copy:wc-to-dist",
38
35
  "copy:wc": "mkdir -p wc && cp ../../dist-web-component/button.js wc/button.js 2>/dev/null || echo 'Web component not built - run npm run build:web-component from root'",
package/dist/index.cjs DELETED
@@ -1,199 +0,0 @@
1
- "use strict";
2
- "use client";
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
-
31
- // src/index.ts
32
- var src_exports = {};
33
- __export(src_exports, {
34
- GaitButton: () => GaitButton
35
- });
36
- module.exports = __toCommonJS(src_exports);
37
-
38
- // src/components/GaitButton.tsx
39
- var import_react = __toESM(require("react"), 1);
40
- var GaitButton = (0, import_react.forwardRef)(function GaitButton2({
41
- label,
42
- theme,
43
- "data-id": dataId,
44
- disabled,
45
- size,
46
- style,
47
- items,
48
- priceBreakdown,
49
- totalCost,
50
- brandColor,
51
- customer,
52
- webhook,
53
- merchantStoreUrl,
54
- onClick,
55
- onLoaded,
56
- onDataProcessed,
57
- onSplitFeedback,
58
- onMerchantIdError,
59
- onConfirm,
60
- className,
61
- id,
62
- ...rest
63
- }, ref) {
64
- const elementRef = (0, import_react.useRef)(null);
65
- (0, import_react.useImperativeHandle)(ref, () => elementRef.current, []);
66
- (0, import_react.useEffect)(() => {
67
- const el = elementRef.current;
68
- if (!el) return;
69
- if (label !== void 0) el.setAttribute("label", label);
70
- if (theme !== void 0) el.setAttribute("theme", theme);
71
- if (dataId !== void 0) el.setAttribute("data-id", dataId);
72
- if (size !== void 0) el.setAttribute("size", size);
73
- if (disabled) {
74
- el.setAttribute("disabled", "");
75
- } else {
76
- el.removeAttribute("disabled");
77
- }
78
- if (style !== void 0) {
79
- const styleStr = typeof style === "string" ? style : Object.entries(style).map(
80
- ([k, v]) => `${k.replace(/([A-Z])/g, "-$1").toLowerCase()}: ${v}`
81
- ).join("; ");
82
- el.setAttribute("style", styleStr);
83
- }
84
- if (items !== void 0) {
85
- el.setAttribute(
86
- "items",
87
- typeof items === "string" ? items : JSON.stringify(items)
88
- );
89
- }
90
- if (priceBreakdown !== void 0) {
91
- el.setAttribute(
92
- "price-breakdown",
93
- typeof priceBreakdown === "string" ? priceBreakdown : JSON.stringify(priceBreakdown)
94
- );
95
- }
96
- if (totalCost !== void 0) {
97
- el.setAttribute("total-cost", String(totalCost));
98
- }
99
- if (brandColor !== void 0) el.setAttribute("brand-color", brandColor);
100
- if (customer !== void 0) {
101
- el.setAttribute(
102
- "customer",
103
- typeof customer === "string" ? customer : JSON.stringify(customer)
104
- );
105
- }
106
- if (webhook !== void 0) {
107
- el.setAttribute(
108
- "webhook",
109
- typeof webhook === "string" ? webhook : JSON.stringify(webhook)
110
- );
111
- }
112
- if (merchantStoreUrl !== void 0) {
113
- el.setAttribute("merchant-store-url", merchantStoreUrl);
114
- }
115
- }, [
116
- label,
117
- theme,
118
- dataId,
119
- disabled,
120
- size,
121
- style,
122
- items,
123
- priceBreakdown,
124
- totalCost,
125
- brandColor,
126
- customer,
127
- webhook,
128
- merchantStoreUrl
129
- ]);
130
- (0, import_react.useEffect)(() => {
131
- const el = elementRef.current;
132
- if (!el) return;
133
- const handleClick = (e) => {
134
- if (onClick && e instanceof CustomEvent && e.detail) {
135
- onClick(e.detail);
136
- }
137
- };
138
- const handleLoaded = (e) => {
139
- if (onLoaded && e instanceof CustomEvent && e.detail) {
140
- onLoaded(e.detail);
141
- }
142
- };
143
- const handleDataProcessed = (e) => {
144
- if (onDataProcessed && e instanceof CustomEvent && e.detail) {
145
- onDataProcessed(e.detail);
146
- }
147
- };
148
- const handleSplitFeedback = (e) => {
149
- if (onSplitFeedback && e instanceof CustomEvent && e.detail) {
150
- onSplitFeedback(e.detail);
151
- }
152
- };
153
- const handleMerchantIdError = (e) => {
154
- if (onMerchantIdError && e instanceof CustomEvent && e.detail) {
155
- onMerchantIdError(e.detail);
156
- }
157
- };
158
- const handleConfirm = (e) => {
159
- if (onConfirm && e instanceof CustomEvent && e.detail) {
160
- onConfirm(e.detail);
161
- }
162
- };
163
- el.addEventListener("gait-click", handleClick);
164
- el.addEventListener("gait-loaded", handleLoaded);
165
- el.addEventListener("gait-data-processed", handleDataProcessed);
166
- el.addEventListener("gait-split-feedback", handleSplitFeedback);
167
- el.addEventListener("gait-merchant-id-error", handleMerchantIdError);
168
- el.addEventListener("gait-confirm", handleConfirm);
169
- return () => {
170
- el.removeEventListener("gait-click", handleClick);
171
- el.removeEventListener("gait-loaded", handleLoaded);
172
- el.removeEventListener("gait-data-processed", handleDataProcessed);
173
- el.removeEventListener("gait-split-feedback", handleSplitFeedback);
174
- el.removeEventListener("gait-merchant-id-error", handleMerchantIdError);
175
- el.removeEventListener("gait-confirm", handleConfirm);
176
- };
177
- }, [
178
- onClick,
179
- onLoaded,
180
- onDataProcessed,
181
- onSplitFeedback,
182
- onMerchantIdError,
183
- onConfirm
184
- ]);
185
- const passthrough = {};
186
- if (className) passthrough.className = className;
187
- if (id) passthrough.id = id;
188
- Object.assign(passthrough, rest);
189
- return import_react.default.createElement("gait-button", {
190
- ref: elementRef,
191
- ...passthrough
192
- });
193
- });
194
- GaitButton.displayName = "GaitButton";
195
- // Annotate the CommonJS export names for ESM import in node:
196
- 0 && (module.exports = {
197
- GaitButton
198
- });
199
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts","../src/components/GaitButton.tsx"],"sourcesContent":["'use client';\n\n/**\n * @gait/react - React wrappers for Gait Web Components\n *\n * Usage:\n * 1. Register the Web Component (run once, e.g. in _app.tsx or layout):\n * import '@gait/react/register';\n *\n * 2. Use the React components:\n * import { GaitButton } from '@gait/react';\n */\n\nexport { GaitButton } from './components/GaitButton';\nexport type { GaitButtonProps } from './components/GaitButton';\n\nexport type {\n ButtonTheme,\n ButtonSize,\n GaitButtonItem,\n GaitPriceBreakdownItem,\n GaitCustomer,\n GaitWebhook,\n GaitClickDetail,\n GaitLoadedDetail,\n GaitDataProcessedDetail,\n GaitSplitFeedbackDetail,\n GaitMerchantIdErrorDetail,\n GaitConfirmDetail,\n} from './types';\n","'use client';\n\n/**\n * React wrapper for GaitButton Web Component\n * Maps React props to element attributes (WC uses attributes as source of truth).\n * Uses ref + useEffect for binding - no direct JSX attribute spread to avoid React's\n * string coercion of booleans/objects.\n */\n\nimport React, {\n forwardRef,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport type {\n GaitButtonItem,\n GaitPriceBreakdownItem,\n GaitCustomer,\n GaitWebhook,\n GaitClickDetail,\n GaitLoadedDetail,\n GaitDataProcessedDetail,\n GaitSplitFeedbackDetail,\n GaitMerchantIdErrorDetail,\n GaitConfirmDetail,\n} from '../types';\n\nexport interface GaitButtonProps\n extends Omit<React.HTMLAttributes<HTMLElement>, 'onClick' | 'style'> {\n /** Button label (default: \"Button\") */\n label?: string;\n /** Theme variant */\n theme?: 'dark' | 'light';\n /** Checkout/data identity (required for payment flow) */\n 'data-id'?: string;\n /** Disable the button */\n disabled?: boolean;\n /** Button size */\n size?: 'small' | 'medium' | 'large';\n /** Inline styles - string (for WC) or React.CSSProperties */\n style?: React.CSSProperties | string;\n /** Cart/order items for split payment modal */\n items?: GaitButtonItem[] | string;\n /** Price breakdown items */\n priceBreakdown?: GaitPriceBreakdownItem[] | string;\n /** Total cost */\n totalCost?: number | string;\n /** Brand/accent color */\n brandColor?: string;\n /** Customer info for split payment */\n customer?: GaitCustomer | string;\n /** Webhook config for split payment callbacks */\n webhook?: GaitWebhook | string;\n /** Merchant store URL (defaults to window.location.origin) */\n merchantStoreUrl?: string;\n\n /** Button clicked */\n onClick?: (detail: GaitClickDetail) => void;\n /** Component loaded/rendered */\n onLoaded?: (detail: GaitLoadedDetail) => void;\n /** Data processed (e.g. checkoutId resolved) */\n onDataProcessed?: (detail: GaitDataProcessedDetail) => void;\n /** Split payment API feedback (success/failure) */\n onSplitFeedback?: (detail: GaitSplitFeedbackDetail) => void;\n /** Merchant ID lookup failed */\n onMerchantIdError?: (detail: GaitMerchantIdErrorDetail) => void;\n /** Pay remaining confirmed */\n onConfirm?: (detail: GaitConfirmDetail) => void;\n}\n\nconst GaitButton = forwardRef<HTMLElement, GaitButtonProps>(function GaitButton(\n {\n label,\n theme,\n 'data-id': dataId,\n disabled,\n size,\n style,\n items,\n priceBreakdown,\n totalCost,\n brandColor,\n customer,\n webhook,\n merchantStoreUrl,\n onClick,\n onLoaded,\n onDataProcessed,\n onSplitFeedback,\n onMerchantIdError,\n onConfirm,\n className,\n id,\n ...rest\n },\n ref\n) {\n const elementRef = useRef<HTMLElement>(null);\n\n useImperativeHandle(ref, () => elementRef.current as HTMLElement, []);\n\n // Sync props to element attributes via ref (WC reads attributes)\n useEffect(() => {\n const el = elementRef.current;\n if (!el) return;\n\n if (label !== undefined) el.setAttribute('label', label);\n if (theme !== undefined) el.setAttribute('theme', theme);\n if (dataId !== undefined) el.setAttribute('data-id', dataId);\n if (size !== undefined) el.setAttribute('size', size);\n\n if (disabled) {\n el.setAttribute('disabled', '');\n } else {\n el.removeAttribute('disabled');\n }\n\n if (style !== undefined) {\n const styleStr =\n typeof style === 'string'\n ? style\n : Object.entries(style)\n .map(\n ([k, v]) =>\n `${k.replace(/([A-Z])/g, '-$1').toLowerCase()}: ${v}`\n )\n .join('; ');\n el.setAttribute('style', styleStr);\n }\n\n if (items !== undefined) {\n el.setAttribute(\n 'items',\n typeof items === 'string' ? items : JSON.stringify(items)\n );\n }\n\n if (priceBreakdown !== undefined) {\n el.setAttribute(\n 'price-breakdown',\n typeof priceBreakdown === 'string'\n ? priceBreakdown\n : JSON.stringify(priceBreakdown)\n );\n }\n\n if (totalCost !== undefined) {\n el.setAttribute('total-cost', String(totalCost));\n }\n\n if (brandColor !== undefined) el.setAttribute('brand-color', brandColor);\n\n if (customer !== undefined) {\n el.setAttribute(\n 'customer',\n typeof customer === 'string' ? customer : JSON.stringify(customer)\n );\n }\n\n if (webhook !== undefined) {\n el.setAttribute(\n 'webhook',\n typeof webhook === 'string' ? webhook : JSON.stringify(webhook)\n );\n }\n\n if (merchantStoreUrl !== undefined) {\n el.setAttribute('merchant-store-url', merchantStoreUrl);\n }\n }, [\n label,\n theme,\n dataId,\n disabled,\n size,\n style,\n items,\n priceBreakdown,\n totalCost,\n brandColor,\n customer,\n webhook,\n merchantStoreUrl,\n ]);\n\n // Event listeners\n useEffect(() => {\n const el = elementRef.current;\n if (!el) return;\n\n const handleClick = (e: Event) => {\n if (onClick && e instanceof CustomEvent && e.detail) {\n onClick(e.detail as GaitClickDetail);\n }\n };\n const handleLoaded = (e: Event) => {\n if (onLoaded && e instanceof CustomEvent && e.detail) {\n onLoaded(e.detail as GaitLoadedDetail);\n }\n };\n const handleDataProcessed = (e: Event) => {\n if (onDataProcessed && e instanceof CustomEvent && e.detail) {\n onDataProcessed(e.detail as GaitDataProcessedDetail);\n }\n };\n const handleSplitFeedback = (e: Event) => {\n if (onSplitFeedback && e instanceof CustomEvent && e.detail) {\n onSplitFeedback(e.detail as GaitSplitFeedbackDetail);\n }\n };\n const handleMerchantIdError = (e: Event) => {\n if (onMerchantIdError && e instanceof CustomEvent && e.detail) {\n onMerchantIdError(e.detail as GaitMerchantIdErrorDetail);\n }\n };\n const handleConfirm = (e: Event) => {\n if (onConfirm && e instanceof CustomEvent && e.detail) {\n onConfirm(e.detail as GaitConfirmDetail);\n }\n };\n\n el.addEventListener('gait-click', handleClick as EventListener);\n el.addEventListener('gait-loaded', handleLoaded as EventListener);\n el.addEventListener('gait-data-processed', handleDataProcessed as EventListener);\n el.addEventListener('gait-split-feedback', handleSplitFeedback as EventListener);\n el.addEventListener('gait-merchant-id-error', handleMerchantIdError as EventListener);\n el.addEventListener('gait-confirm', handleConfirm as EventListener);\n\n return () => {\n el.removeEventListener('gait-click', handleClick as EventListener);\n el.removeEventListener('gait-loaded', handleLoaded as EventListener);\n el.removeEventListener('gait-data-processed', handleDataProcessed as EventListener);\n el.removeEventListener('gait-split-feedback', handleSplitFeedback as EventListener);\n el.removeEventListener('gait-merchant-id-error', handleMerchantIdError as EventListener);\n el.removeEventListener('gait-confirm', handleConfirm as EventListener);\n };\n }, [\n onClick,\n onLoaded,\n onDataProcessed,\n onSplitFeedback,\n onMerchantIdError,\n onConfirm,\n ]);\n\n const passthrough: Record<string, unknown> = {};\n if (className) passthrough.className = className;\n if (id) passthrough.id = id;\n Object.assign(passthrough, rest);\n\n return React.createElement('gait-button', {\n ref: elementRef,\n ...passthrough,\n });\n});\n\nGaitButton.displayName = 'GaitButton';\n\nexport { GaitButton };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACSA,mBAKO;AAyDP,IAAM,iBAAa,yBAAyC,SAASA,YACnE;AAAA,EACE;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GACA,KACA;AACA,QAAM,iBAAa,qBAAoB,IAAI;AAE3C,wCAAoB,KAAK,MAAM,WAAW,SAAwB,CAAC,CAAC;AAGpE,8BAAU,MAAM;AACd,UAAM,KAAK,WAAW;AACtB,QAAI,CAAC,GAAI;AAET,QAAI,UAAU,OAAW,IAAG,aAAa,SAAS,KAAK;AACvD,QAAI,UAAU,OAAW,IAAG,aAAa,SAAS,KAAK;AACvD,QAAI,WAAW,OAAW,IAAG,aAAa,WAAW,MAAM;AAC3D,QAAI,SAAS,OAAW,IAAG,aAAa,QAAQ,IAAI;AAEpD,QAAI,UAAU;AACZ,SAAG,aAAa,YAAY,EAAE;AAAA,IAChC,OAAO;AACL,SAAG,gBAAgB,UAAU;AAAA,IAC/B;AA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AA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,cAAuC,CAAC;AAC9C,MAAI,UAAW,aAAY,YAAY;AACvC,MAAI,GAAI,aAAY,KAAK;AACzB,SAAO,OAAO,aAAa,IAAI;AAE/B,SAAO,aAAAC,QAAM,cAAc,eAAe;AAAA,IACxC,KAAK;AAAA,IACL,GAAG;AAAA,EACL,CAAC;AACH,CAAC;AAED,WAAW,cAAc;","names":["GaitButton","React"]}
package/dist/index.d.cts DELETED
@@ -1,123 +0,0 @@
1
- import React from 'react';
2
-
3
- /**
4
- * Shared types for Gait React components
5
- * Mirrors the Web Component API (source of truth)
6
- */
7
- type ButtonTheme = 'dark' | 'light';
8
- type ButtonSize = 'small' | 'medium' | 'large';
9
- interface GaitButtonItem {
10
- name: string;
11
- image: string;
12
- id: string;
13
- quantity: number;
14
- category?: string;
15
- price: number;
16
- }
17
- interface GaitPriceBreakdownItem {
18
- name: string;
19
- price: number | string;
20
- }
21
- interface GaitCustomer {
22
- email: string;
23
- name?: string;
24
- }
25
- interface GaitWebhook {
26
- url: string;
27
- body?: Record<string, unknown>;
28
- }
29
- /** gait-click event detail */
30
- interface GaitClickDetail {
31
- label: string;
32
- theme: ButtonTheme;
33
- dataId: string | null;
34
- dataAttributes: Record<string, string>;
35
- timestamp: string;
36
- }
37
- /** gait-loaded event detail */
38
- interface GaitLoadedDetail {
39
- attributes: Record<string, string | null>;
40
- dataId: string | null;
41
- dataAttributes: Record<string, string>;
42
- label: string;
43
- theme: ButtonTheme;
44
- size: ButtonSize;
45
- disabled: boolean;
46
- timestamp: string;
47
- }
48
- /** gait-data-processed event detail */
49
- interface GaitDataProcessedDetail {
50
- id?: string;
51
- timestamp: string;
52
- [key: string]: unknown;
53
- }
54
- /** gait-split-feedback event detail */
55
- interface GaitSplitFeedbackDetail {
56
- success: boolean;
57
- message?: string;
58
- data?: unknown;
59
- error?: string;
60
- timestamp: string;
61
- }
62
- /** gait-merchant-id-error event detail */
63
- interface GaitMerchantIdErrorDetail {
64
- message: string;
65
- timestamp: string;
66
- }
67
- /** gait-confirm event detail */
68
- interface GaitConfirmDetail {
69
- merchantId: string;
70
- splitId: string;
71
- paymentId: string;
72
- }
73
-
74
- /**
75
- * React wrapper for GaitButton Web Component
76
- * Maps React props to element attributes (WC uses attributes as source of truth).
77
- * Uses ref + useEffect for binding - no direct JSX attribute spread to avoid React's
78
- * string coercion of booleans/objects.
79
- */
80
-
81
- interface GaitButtonProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onClick' | 'style'> {
82
- /** Button label (default: "Button") */
83
- label?: string;
84
- /** Theme variant */
85
- theme?: 'dark' | 'light';
86
- /** Checkout/data identity (required for payment flow) */
87
- 'data-id'?: string;
88
- /** Disable the button */
89
- disabled?: boolean;
90
- /** Button size */
91
- size?: 'small' | 'medium' | 'large';
92
- /** Inline styles - string (for WC) or React.CSSProperties */
93
- style?: React.CSSProperties | string;
94
- /** Cart/order items for split payment modal */
95
- items?: GaitButtonItem[] | string;
96
- /** Price breakdown items */
97
- priceBreakdown?: GaitPriceBreakdownItem[] | string;
98
- /** Total cost */
99
- totalCost?: number | string;
100
- /** Brand/accent color */
101
- brandColor?: string;
102
- /** Customer info for split payment */
103
- customer?: GaitCustomer | string;
104
- /** Webhook config for split payment callbacks */
105
- webhook?: GaitWebhook | string;
106
- /** Merchant store URL (defaults to window.location.origin) */
107
- merchantStoreUrl?: string;
108
- /** Button clicked */
109
- onClick?: (detail: GaitClickDetail) => void;
110
- /** Component loaded/rendered */
111
- onLoaded?: (detail: GaitLoadedDetail) => void;
112
- /** Data processed (e.g. checkoutId resolved) */
113
- onDataProcessed?: (detail: GaitDataProcessedDetail) => void;
114
- /** Split payment API feedback (success/failure) */
115
- onSplitFeedback?: (detail: GaitSplitFeedbackDetail) => void;
116
- /** Merchant ID lookup failed */
117
- onMerchantIdError?: (detail: GaitMerchantIdErrorDetail) => void;
118
- /** Pay remaining confirmed */
119
- onConfirm?: (detail: GaitConfirmDetail) => void;
120
- }
121
- declare const GaitButton: React.ForwardRefExoticComponent<GaitButtonProps & React.RefAttributes<HTMLElement>>;
122
-
123
- export { type ButtonSize, type ButtonTheme, GaitButton, type GaitButtonItem, type GaitButtonProps, type GaitClickDetail, type GaitConfirmDetail, type GaitCustomer, type GaitDataProcessedDetail, type GaitLoadedDetail, type GaitMerchantIdErrorDetail, type GaitPriceBreakdownItem, type GaitSplitFeedbackDetail, type GaitWebhook };
package/dist/index.d.ts DELETED
@@ -1,123 +0,0 @@
1
- import React from 'react';
2
-
3
- /**
4
- * Shared types for Gait React components
5
- * Mirrors the Web Component API (source of truth)
6
- */
7
- type ButtonTheme = 'dark' | 'light';
8
- type ButtonSize = 'small' | 'medium' | 'large';
9
- interface GaitButtonItem {
10
- name: string;
11
- image: string;
12
- id: string;
13
- quantity: number;
14
- category?: string;
15
- price: number;
16
- }
17
- interface GaitPriceBreakdownItem {
18
- name: string;
19
- price: number | string;
20
- }
21
- interface GaitCustomer {
22
- email: string;
23
- name?: string;
24
- }
25
- interface GaitWebhook {
26
- url: string;
27
- body?: Record<string, unknown>;
28
- }
29
- /** gait-click event detail */
30
- interface GaitClickDetail {
31
- label: string;
32
- theme: ButtonTheme;
33
- dataId: string | null;
34
- dataAttributes: Record<string, string>;
35
- timestamp: string;
36
- }
37
- /** gait-loaded event detail */
38
- interface GaitLoadedDetail {
39
- attributes: Record<string, string | null>;
40
- dataId: string | null;
41
- dataAttributes: Record<string, string>;
42
- label: string;
43
- theme: ButtonTheme;
44
- size: ButtonSize;
45
- disabled: boolean;
46
- timestamp: string;
47
- }
48
- /** gait-data-processed event detail */
49
- interface GaitDataProcessedDetail {
50
- id?: string;
51
- timestamp: string;
52
- [key: string]: unknown;
53
- }
54
- /** gait-split-feedback event detail */
55
- interface GaitSplitFeedbackDetail {
56
- success: boolean;
57
- message?: string;
58
- data?: unknown;
59
- error?: string;
60
- timestamp: string;
61
- }
62
- /** gait-merchant-id-error event detail */
63
- interface GaitMerchantIdErrorDetail {
64
- message: string;
65
- timestamp: string;
66
- }
67
- /** gait-confirm event detail */
68
- interface GaitConfirmDetail {
69
- merchantId: string;
70
- splitId: string;
71
- paymentId: string;
72
- }
73
-
74
- /**
75
- * React wrapper for GaitButton Web Component
76
- * Maps React props to element attributes (WC uses attributes as source of truth).
77
- * Uses ref + useEffect for binding - no direct JSX attribute spread to avoid React's
78
- * string coercion of booleans/objects.
79
- */
80
-
81
- interface GaitButtonProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onClick' | 'style'> {
82
- /** Button label (default: "Button") */
83
- label?: string;
84
- /** Theme variant */
85
- theme?: 'dark' | 'light';
86
- /** Checkout/data identity (required for payment flow) */
87
- 'data-id'?: string;
88
- /** Disable the button */
89
- disabled?: boolean;
90
- /** Button size */
91
- size?: 'small' | 'medium' | 'large';
92
- /** Inline styles - string (for WC) or React.CSSProperties */
93
- style?: React.CSSProperties | string;
94
- /** Cart/order items for split payment modal */
95
- items?: GaitButtonItem[] | string;
96
- /** Price breakdown items */
97
- priceBreakdown?: GaitPriceBreakdownItem[] | string;
98
- /** Total cost */
99
- totalCost?: number | string;
100
- /** Brand/accent color */
101
- brandColor?: string;
102
- /** Customer info for split payment */
103
- customer?: GaitCustomer | string;
104
- /** Webhook config for split payment callbacks */
105
- webhook?: GaitWebhook | string;
106
- /** Merchant store URL (defaults to window.location.origin) */
107
- merchantStoreUrl?: string;
108
- /** Button clicked */
109
- onClick?: (detail: GaitClickDetail) => void;
110
- /** Component loaded/rendered */
111
- onLoaded?: (detail: GaitLoadedDetail) => void;
112
- /** Data processed (e.g. checkoutId resolved) */
113
- onDataProcessed?: (detail: GaitDataProcessedDetail) => void;
114
- /** Split payment API feedback (success/failure) */
115
- onSplitFeedback?: (detail: GaitSplitFeedbackDetail) => void;
116
- /** Merchant ID lookup failed */
117
- onMerchantIdError?: (detail: GaitMerchantIdErrorDetail) => void;
118
- /** Pay remaining confirmed */
119
- onConfirm?: (detail: GaitConfirmDetail) => void;
120
- }
121
- declare const GaitButton: React.ForwardRefExoticComponent<GaitButtonProps & React.RefAttributes<HTMLElement>>;
122
-
123
- export { type ButtonSize, type ButtonTheme, GaitButton, type GaitButtonItem, type GaitButtonProps, type GaitClickDetail, type GaitConfirmDetail, type GaitCustomer, type GaitDataProcessedDetail, type GaitLoadedDetail, type GaitMerchantIdErrorDetail, type GaitPriceBreakdownItem, type GaitSplitFeedbackDetail, type GaitWebhook };