@gait-financial/react 0.0.16 → 0.1.1

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/dist/index.cjs CHANGED
@@ -38,8 +38,6 @@ module.exports = __toCommonJS(src_exports);
38
38
  // src/components/GaitButton.tsx
39
39
  var import_react = __toESM(require("react"), 1);
40
40
  var GaitButton = (0, import_react.forwardRef)(function GaitButton2({
41
- label,
42
- theme,
43
41
  "data-id": dataId,
44
42
  disabled,
45
43
  size,
@@ -47,7 +45,6 @@ var GaitButton = (0, import_react.forwardRef)(function GaitButton2({
47
45
  items,
48
46
  priceBreakdown,
49
47
  totalCost,
50
- brandColor,
51
48
  customer,
52
49
  webhook,
53
50
  merchantStoreUrl,
@@ -66,8 +63,6 @@ var GaitButton = (0, import_react.forwardRef)(function GaitButton2({
66
63
  (0, import_react.useEffect)(() => {
67
64
  const el = elementRef.current;
68
65
  if (!el) return;
69
- if (label !== void 0) el.setAttribute("label", label);
70
- if (theme !== void 0) el.setAttribute("theme", theme);
71
66
  if (dataId !== void 0) el.setAttribute("data-id", dataId);
72
67
  if (size !== void 0) el.setAttribute("size", size);
73
68
  if (disabled) {
@@ -96,7 +91,6 @@ var GaitButton = (0, import_react.forwardRef)(function GaitButton2({
96
91
  if (totalCost !== void 0) {
97
92
  el.setAttribute("total-cost", String(totalCost));
98
93
  }
99
- if (brandColor !== void 0) el.setAttribute("brand-color", brandColor);
100
94
  if (customer !== void 0) {
101
95
  el.setAttribute(
102
96
  "customer",
@@ -113,8 +107,6 @@ var GaitButton = (0, import_react.forwardRef)(function GaitButton2({
113
107
  el.setAttribute("merchant-store-url", merchantStoreUrl);
114
108
  }
115
109
  }, [
116
- label,
117
- theme,
118
110
  dataId,
119
111
  disabled,
120
112
  size,
@@ -122,7 +114,6 @@ var GaitButton = (0, import_react.forwardRef)(function GaitButton2({
122
114
  items,
123
115
  priceBreakdown,
124
116
  totalCost,
125
- brandColor,
126
117
  customer,
127
118
  webhook,
128
119
  merchantStoreUrl
@@ -1 +1 @@
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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AC,MAAa;AAClC,UAAI,aAAa,aAAa,eAAe,EAAE,QAAQ;AACrD,kBAAU,EAAE,MAA2B;AAAA,MACzC;AAAA,IACF;AAEA,OAAG,iBAAiB,cAAc,WAA4B;AAC9D,OAAG,iBAAiB,eAAe,YAA6B;AAChE,OAAG,iBAAiB,uBAAuB,mBAAoC;AAC/E,OAAG,iBAAiB,uBAAuB,mBAAoC;AAC/E,OAAG,iBAAiB,0BAA0B,qBAAsC;AACpF,OAAG,iBAAiB,gBAAgB,aAA8B;AAElE,WAAO,MAAM;AACX,SAAG,oBAAoB,cAAc,WAA4B;AACjE,SAAG,oBAAoB,eAAe,YAA6B;AACnE,SAAG,oBAAoB,uBAAuB,mBAAoC;AAClF,SAAG,oBAAoB,uBAAuB,mBAAoC;AAClF,SAAG,oBAAoB,0BAA0B,qBAAsC;AACvF,SAAG,oBAAoB,gBAAgB,aAA8B;AAAA,IACvE;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,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"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/components/GaitButton.tsx"],"sourcesContent":["'use client';\n\n/**\n * @gait-financial/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-financial/react/register';\n *\n * 2. Use the React components:\n * import { GaitButton } from '@gait-financial/react';\n */\n\nexport { GaitButton } from './components/GaitButton';\nexport type { GaitButtonProps } from './components/GaitButton';\n\nexport type {\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 /** 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 /** 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 'data-id': dataId,\n disabled,\n size,\n style,\n items,\n priceBreakdown,\n totalCost,\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 (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 (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 dataId,\n disabled,\n size,\n style,\n items,\n priceBreakdown,\n totalCost,\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;AAmDP,IAAM,iBAAa,yBAAyC,SAASA,YACnE;AAAA,EACE,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,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,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;AAEA,QAAI,UAAU,QAAW;AACvB,YAAM,WACJ,OAAO,UAAU,WACb,QACA,OAAO,QAAQ,KAAK,EACjB;AAAA,QACC,CAAC,CAAC,GAAG,CAAC,MACJ,GAAG,EAAE,QAAQ,YAAY,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC;AAAA,MACvD,EACC,KAAK,IAAI;AAClB,SAAG,aAAa,SAAS,QAAQ;AAAA,IACnC;AAEA,QAAI,UAAU,QAAW;AACvB,SAAG;AAAA,QACD;AAAA,QACA,OAAO,UAA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AAE,QAAQ;AAC3D,wBAAgB,EAAE,MAAiC;AAAA,MACrD;AAAA,IACF;AACA,UAAM,wBAAwB,CAAC,MAAa;AAC1C,UAAI,qBAAqB,aAAa,eAAe,EAAE,QAAQ;AAC7D,0BAAkB,EAAE,MAAmC;AAAA,MACzD;AAAA,IACF;AACA,UAAM,gBAAgB,CAAC,MAAa;AAClC,UAAI,aAAa,aAAa,eAAe,EAAE,QAAQ;AACrD,kBAAU,EAAE,MAA2B;AAAA,MACzC;AAAA,IACF;AAEA,OAAG,iBAAiB,cAAc,WAA4B;AAC9D,OAAG,iBAAiB,eAAe,YAA6B;AAChE,OAAG,iBAAiB,uBAAuB,mBAAoC;AAC/E,OAAG,iBAAiB,uBAAuB,mBAAoC;AAC/E,OAAG,iBAAiB,0BAA0B,qBAAsC;AACpF,OAAG,iBAAiB,gBAAgB,aAA8B;AAElE,WAAO,MAAM;AACX,SAAG,oBAAoB,cAAc,WAA4B;AACjE,SAAG,oBAAoB,eAAe,YAA6B;AACnE,SAAG,oBAAoB,uBAAuB,mBAAoC;AAClF,SAAG,oBAAoB,uBAAuB,mBAAoC;AAClF,SAAG,oBAAoB,0BAA0B,qBAAsC;AACvF,SAAG,oBAAoB,gBAAgB,aAA8B;AAAA,IACvE;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,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 CHANGED
@@ -4,7 +4,6 @@ import React from 'react';
4
4
  * Shared types for Gait React components
5
5
  * Mirrors the Web Component API (source of truth)
6
6
  */
7
- type ButtonTheme = 'dark' | 'light';
8
7
  type ButtonSize = 'small' | 'medium' | 'large';
9
8
  interface GaitButtonItem {
10
9
  name: string;
@@ -29,7 +28,6 @@ interface GaitWebhook {
29
28
  /** gait-click event detail */
30
29
  interface GaitClickDetail {
31
30
  label: string;
32
- theme: ButtonTheme;
33
31
  dataId: string | null;
34
32
  dataAttributes: Record<string, string>;
35
33
  timestamp: string;
@@ -40,7 +38,6 @@ interface GaitLoadedDetail {
40
38
  dataId: string | null;
41
39
  dataAttributes: Record<string, string>;
42
40
  label: string;
43
- theme: ButtonTheme;
44
41
  size: ButtonSize;
45
42
  disabled: boolean;
46
43
  timestamp: string;
@@ -79,10 +76,6 @@ interface GaitConfirmDetail {
79
76
  */
80
77
 
81
78
  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
79
  /** Checkout/data identity (required for payment flow) */
87
80
  'data-id'?: string;
88
81
  /** Disable the button */
@@ -97,8 +90,6 @@ interface GaitButtonProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onCli
97
90
  priceBreakdown?: GaitPriceBreakdownItem[] | string;
98
91
  /** Total cost */
99
92
  totalCost?: number | string;
100
- /** Brand/accent color */
101
- brandColor?: string;
102
93
  /** Customer info for split payment */
103
94
  customer?: GaitCustomer | string;
104
95
  /** Webhook config for split payment callbacks */
@@ -120,4 +111,4 @@ interface GaitButtonProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onCli
120
111
  }
121
112
  declare const GaitButton: React.ForwardRefExoticComponent<GaitButtonProps & React.RefAttributes<HTMLElement>>;
122
113
 
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 };
114
+ export { type ButtonSize, 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 CHANGED
@@ -4,7 +4,6 @@ import React from 'react';
4
4
  * Shared types for Gait React components
5
5
  * Mirrors the Web Component API (source of truth)
6
6
  */
7
- type ButtonTheme = 'dark' | 'light';
8
7
  type ButtonSize = 'small' | 'medium' | 'large';
9
8
  interface GaitButtonItem {
10
9
  name: string;
@@ -29,7 +28,6 @@ interface GaitWebhook {
29
28
  /** gait-click event detail */
30
29
  interface GaitClickDetail {
31
30
  label: string;
32
- theme: ButtonTheme;
33
31
  dataId: string | null;
34
32
  dataAttributes: Record<string, string>;
35
33
  timestamp: string;
@@ -40,7 +38,6 @@ interface GaitLoadedDetail {
40
38
  dataId: string | null;
41
39
  dataAttributes: Record<string, string>;
42
40
  label: string;
43
- theme: ButtonTheme;
44
41
  size: ButtonSize;
45
42
  disabled: boolean;
46
43
  timestamp: string;
@@ -79,10 +76,6 @@ interface GaitConfirmDetail {
79
76
  */
80
77
 
81
78
  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
79
  /** Checkout/data identity (required for payment flow) */
87
80
  'data-id'?: string;
88
81
  /** Disable the button */
@@ -97,8 +90,6 @@ interface GaitButtonProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onCli
97
90
  priceBreakdown?: GaitPriceBreakdownItem[] | string;
98
91
  /** Total cost */
99
92
  totalCost?: number | string;
100
- /** Brand/accent color */
101
- brandColor?: string;
102
93
  /** Customer info for split payment */
103
94
  customer?: GaitCustomer | string;
104
95
  /** Webhook config for split payment callbacks */
@@ -120,4 +111,4 @@ interface GaitButtonProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onCli
120
111
  }
121
112
  declare const GaitButton: React.ForwardRefExoticComponent<GaitButtonProps & React.RefAttributes<HTMLElement>>;
122
113
 
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 };
114
+ export { type ButtonSize, 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.js CHANGED
@@ -8,8 +8,6 @@ import React, {
8
8
  useRef
9
9
  } from "react";
10
10
  var GaitButton = forwardRef(function GaitButton2({
11
- label,
12
- theme,
13
11
  "data-id": dataId,
14
12
  disabled,
15
13
  size,
@@ -17,7 +15,6 @@ var GaitButton = forwardRef(function GaitButton2({
17
15
  items,
18
16
  priceBreakdown,
19
17
  totalCost,
20
- brandColor,
21
18
  customer,
22
19
  webhook,
23
20
  merchantStoreUrl,
@@ -36,8 +33,6 @@ var GaitButton = forwardRef(function GaitButton2({
36
33
  useEffect(() => {
37
34
  const el = elementRef.current;
38
35
  if (!el) return;
39
- if (label !== void 0) el.setAttribute("label", label);
40
- if (theme !== void 0) el.setAttribute("theme", theme);
41
36
  if (dataId !== void 0) el.setAttribute("data-id", dataId);
42
37
  if (size !== void 0) el.setAttribute("size", size);
43
38
  if (disabled) {
@@ -66,7 +61,6 @@ var GaitButton = forwardRef(function GaitButton2({
66
61
  if (totalCost !== void 0) {
67
62
  el.setAttribute("total-cost", String(totalCost));
68
63
  }
69
- if (brandColor !== void 0) el.setAttribute("brand-color", brandColor);
70
64
  if (customer !== void 0) {
71
65
  el.setAttribute(
72
66
  "customer",
@@ -83,8 +77,6 @@ var GaitButton = forwardRef(function GaitButton2({
83
77
  el.setAttribute("merchant-store-url", merchantStoreUrl);
84
78
  }
85
79
  }, [
86
- label,
87
- theme,
88
80
  dataId,
89
81
  disabled,
90
82
  size,
@@ -92,7 +84,6 @@ var GaitButton = forwardRef(function GaitButton2({
92
84
  items,
93
85
  priceBreakdown,
94
86
  totalCost,
95
- brandColor,
96
87
  customer,
97
88
  webhook,
98
89
  merchantStoreUrl
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/GaitButton.tsx"],"sourcesContent":["'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":";;;AASA,OAAO;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAyDP,IAAM,aAAa,WAAyC,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,aAAa,OAAoB,IAAI;AAE3C,sBAAoB,KAAK,MAAM,WAAW,SAAwB,CAAC,CAAC;AAGpE,YAAU,MAAM;AACd,UAAM,KAAK,WAAW;AACtB,QAAI,CAAC,GAAI;AAET,QAAI,UAAU,OAAW,IAAG,aAAa,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ACX,SAAG,oBAAoB,cAAc,WAA4B;AACjE,SAAG,oBAAoB,eAAe,YAA6B;AACnE,SAAG,oBAAoB,uBAAuB,mBAAoC;AAClF,SAAG,oBAAoB,uBAAuB,mBAAoC;AAClF,SAAG,oBAAoB,0BAA0B,qBAAsC;AACvF,SAAG,oBAAoB,gBAAgB,aAA8B;AAAA,IACvE;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,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,MAAM,cAAc,eAAe;AAAA,IACxC,KAAK;AAAA,IACL,GAAG;AAAA,EACL,CAAC;AACH,CAAC;AAED,WAAW,cAAc;","names":["GaitButton"]}
1
+ {"version":3,"sources":["../src/components/GaitButton.tsx"],"sourcesContent":["'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 /** 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 /** 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 'data-id': dataId,\n disabled,\n size,\n style,\n items,\n priceBreakdown,\n totalCost,\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 (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 (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 dataId,\n disabled,\n size,\n style,\n items,\n priceBreakdown,\n totalCost,\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":";;;AASA,OAAO;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAmDP,IAAM,aAAa,WAAyC,SAASA,YACnE;AAAA,EACE,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,GAAG;AACL,GACA,KACA;AACA,QAAM,aAAa,OAAoB,IAAI;AAE3C,sBAAoB,KAAK,MAAM,WAAW,SAAwB,CAAC,CAAC;AAGpE,YAAU,MAAM;AACd,UAAM,KAAK,WAAW;AACtB,QAAI,CAAC,GAAI;AAET,QAAI,WAAW,OAAW,IAAG,aAAa,WAAW,MAAM;AAC3D,QAAI,SAAS,OAAW,IAAG,aAAa,QAAQ,IA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AAG;AAAA,IACD;AAAA,IACA;AAAA,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,MAAM,cAAc,eAAe;AAAA,IACxC,KAAK;AAAA,IACL,GAAG;AAAA,EACL,CAAC;AACH,CAAC;AAED,WAAW,cAAc;","names":["GaitButton"]}
package/dist/register.cjs CHANGED
@@ -40,12 +40,12 @@ async function defineCustomElements(scriptUrl) {
40
40
  try {
41
41
  script.src = new URL("./wc/button.js", import_meta.url).href;
42
42
  } catch {
43
- reject(new Error("[@gait/react] Could not resolve bundled script. Load the web component via script tag or pass scriptUrl."));
43
+ reject(new Error("[@gait-financial/react] Could not resolve bundled script. Load the web component via script tag or pass scriptUrl."));
44
44
  return;
45
45
  }
46
46
  }
47
47
  script.onload = () => resolve();
48
- script.onerror = () => reject(new Error("[@gait/react] Failed to load Gait web component script."));
48
+ script.onerror = () => reject(new Error("[@gait-financial/react] Failed to load Gait web component script."));
49
49
  document.head.appendChild(script);
50
50
  });
51
51
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/register.ts"],"sourcesContent":["/**\n * Registers Gait Web Components in the browser.\n * Safe to call in SSR environments - no-op when window/customElements unavailable.\n *\n * Usage:\n * import '@gait/react/register'; // Side-effect: registers when in browser\n * // or\n * import { defineCustomElements } from '@gait/react/register';\n * await defineCustomElements(); // Optional: load from custom URL\n */\n\n/**\n * Loads and registers Gait Web Components.\n * In browser: loads the WC script if not already registered.\n * In SSR: no-op.\n *\n * @param scriptUrl - Optional URL to the button.js script. If omitted, uses the bundled script.\n */\nexport async function defineCustomElements(\n scriptUrl?: string\n): Promise<void> {\n if (typeof window === 'undefined' || typeof customElements === 'undefined') {\n return;\n }\n if (customElements.get('gait-button')) {\n return;\n }\n\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.async = true;\n\n if (scriptUrl) {\n script.src = scriptUrl;\n } else {\n // Use bundled script - path relative to this module\n try {\n script.src = new URL('./wc/button.js', import.meta.url).href;\n } catch {\n reject(new Error('[@gait/react] Could not resolve bundled script. Load the web component via script tag or pass scriptUrl.'));\n return;\n }\n }\n\n script.onload = () => resolve();\n script.onerror = () =>\n reject(new Error('[@gait/react] Failed to load Gait web component script.'));\n document.head.appendChild(script);\n });\n}\n\n// Side-effect: auto-register when imported in browser (SSR-safe)\nif (typeof window !== 'undefined' && typeof customElements !== 'undefined') {\n void defineCustomElements();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBA,eAAsB,qBACpB,WACe;AACf,MAAI,OAAO,WAAW,eAAe,OAAO,mBAAmB,aAAa;AAC1E;AAAA,EACF;AACA,MAAI,eAAe,IAAI,aAAa,GAAG;AACrC;AAAA,EACF;AAEA,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,UAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,WAAO,QAAQ;AAEf,QAAI,WAAW;AACb,aAAO,MAAM;AAAA,IACf,OAAO;AAEL,UAAI;AACF,eAAO,MAAM,IAAI,IAAI,kBAAkB,YAAY,GAAG,EAAE;AAAA,MAC1D,QAAQ;AACN,eAAO,IAAI,MAAM,0GAA0G,CAAC;AAC5H;AAAA,MACF;AAAA,IACF;AAEA,WAAO,SAAS,MAAM,QAAQ;AAC9B,WAAO,UAAU,MACf,OAAO,IAAI,MAAM,yDAAyD,CAAC;AAC7E,aAAS,KAAK,YAAY,MAAM;AAAA,EAClC,CAAC;AACH;AAGA,IAAI,OAAO,WAAW,eAAe,OAAO,mBAAmB,aAAa;AAC1E,OAAK,qBAAqB;AAC5B;","names":[]}
1
+ {"version":3,"sources":["../src/register.ts"],"sourcesContent":["/**\n * Registers Gait Web Components in the browser.\n * Safe to call in SSR environments - no-op when window/customElements unavailable.\n *\n * Usage:\n * import '@gait-financial/react/register'; // Side-effect: registers when in browser\n * // or\n * import { defineCustomElements } from '@gait-financial/react/register';\n * await defineCustomElements(); // Optional: load from custom URL\n */\n\n/**\n * Loads and registers Gait Web Components.\n * In browser: loads the WC script if not already registered.\n * In SSR: no-op.\n *\n * @param scriptUrl - Optional URL to the button.js script. If omitted, uses the bundled script.\n */\nexport async function defineCustomElements(\n scriptUrl?: string\n): Promise<void> {\n if (typeof window === 'undefined' || typeof customElements === 'undefined') {\n return;\n }\n if (customElements.get('gait-button')) {\n return;\n }\n\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.async = true;\n\n if (scriptUrl) {\n script.src = scriptUrl;\n } else {\n // Use bundled script - path relative to this module\n try {\n script.src = new URL('./wc/button.js', import.meta.url).href;\n } catch {\n reject(new Error('[@gait-financial/react] Could not resolve bundled script. Load the web component via script tag or pass scriptUrl.'));\n return;\n }\n }\n\n script.onload = () => resolve();\n script.onerror = () =>\n reject(new Error('[@gait-financial/react] Failed to load Gait web component script.'));\n document.head.appendChild(script);\n });\n}\n\n// Side-effect: auto-register when imported in browser (SSR-safe)\nif (typeof window !== 'undefined' && typeof customElements !== 'undefined') {\n void defineCustomElements();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBA,eAAsB,qBACpB,WACe;AACf,MAAI,OAAO,WAAW,eAAe,OAAO,mBAAmB,aAAa;AAC1E;AAAA,EACF;AACA,MAAI,eAAe,IAAI,aAAa,GAAG;AACrC;AAAA,EACF;AAEA,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,UAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,WAAO,QAAQ;AAEf,QAAI,WAAW;AACb,aAAO,MAAM;AAAA,IACf,OAAO;AAEL,UAAI;AACF,eAAO,MAAM,IAAI,IAAI,kBAAkB,YAAY,GAAG,EAAE;AAAA,MAC1D,QAAQ;AACN,eAAO,IAAI,MAAM,oHAAoH,CAAC;AACtI;AAAA,MACF;AAAA,IACF;AAEA,WAAO,SAAS,MAAM,QAAQ;AAC9B,WAAO,UAAU,MACf,OAAO,IAAI,MAAM,mEAAmE,CAAC;AACvF,aAAS,KAAK,YAAY,MAAM;AAAA,EAClC,CAAC;AACH;AAGA,IAAI,OAAO,WAAW,eAAe,OAAO,mBAAmB,aAAa;AAC1E,OAAK,qBAAqB;AAC5B;","names":[]}
@@ -3,9 +3,9 @@
3
3
  * Safe to call in SSR environments - no-op when window/customElements unavailable.
4
4
  *
5
5
  * Usage:
6
- * import '@gait/react/register'; // Side-effect: registers when in browser
6
+ * import '@gait-financial/react/register'; // Side-effect: registers when in browser
7
7
  * // or
8
- * import { defineCustomElements } from '@gait/react/register';
8
+ * import { defineCustomElements } from '@gait-financial/react/register';
9
9
  * await defineCustomElements(); // Optional: load from custom URL
10
10
  */
11
11
  /**
@@ -3,9 +3,9 @@
3
3
  * Safe to call in SSR environments - no-op when window/customElements unavailable.
4
4
  *
5
5
  * Usage:
6
- * import '@gait/react/register'; // Side-effect: registers when in browser
6
+ * import '@gait-financial/react/register'; // Side-effect: registers when in browser
7
7
  * // or
8
- * import { defineCustomElements } from '@gait/react/register';
8
+ * import { defineCustomElements } from '@gait-financial/react/register';
9
9
  * await defineCustomElements(); // Optional: load from custom URL
10
10
  */
11
11
  /**
package/dist/register.js CHANGED
@@ -15,12 +15,12 @@ async function defineCustomElements(scriptUrl) {
15
15
  try {
16
16
  script.src = new URL("./wc/button.js", import.meta.url).href;
17
17
  } catch {
18
- reject(new Error("[@gait/react] Could not resolve bundled script. Load the web component via script tag or pass scriptUrl."));
18
+ reject(new Error("[@gait-financial/react] Could not resolve bundled script. Load the web component via script tag or pass scriptUrl."));
19
19
  return;
20
20
  }
21
21
  }
22
22
  script.onload = () => resolve();
23
- script.onerror = () => reject(new Error("[@gait/react] Failed to load Gait web component script."));
23
+ script.onerror = () => reject(new Error("[@gait-financial/react] Failed to load Gait web component script."));
24
24
  document.head.appendChild(script);
25
25
  });
26
26
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/register.ts"],"sourcesContent":["/**\n * Registers Gait Web Components in the browser.\n * Safe to call in SSR environments - no-op when window/customElements unavailable.\n *\n * Usage:\n * import '@gait/react/register'; // Side-effect: registers when in browser\n * // or\n * import { defineCustomElements } from '@gait/react/register';\n * await defineCustomElements(); // Optional: load from custom URL\n */\n\n/**\n * Loads and registers Gait Web Components.\n * In browser: loads the WC script if not already registered.\n * In SSR: no-op.\n *\n * @param scriptUrl - Optional URL to the button.js script. If omitted, uses the bundled script.\n */\nexport async function defineCustomElements(\n scriptUrl?: string\n): Promise<void> {\n if (typeof window === 'undefined' || typeof customElements === 'undefined') {\n return;\n }\n if (customElements.get('gait-button')) {\n return;\n }\n\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.async = true;\n\n if (scriptUrl) {\n script.src = scriptUrl;\n } else {\n // Use bundled script - path relative to this module\n try {\n script.src = new URL('./wc/button.js', import.meta.url).href;\n } catch {\n reject(new Error('[@gait/react] Could not resolve bundled script. Load the web component via script tag or pass scriptUrl.'));\n return;\n }\n }\n\n script.onload = () => resolve();\n script.onerror = () =>\n reject(new Error('[@gait/react] Failed to load Gait web component script.'));\n document.head.appendChild(script);\n });\n}\n\n// Side-effect: auto-register when imported in browser (SSR-safe)\nif (typeof window !== 'undefined' && typeof customElements !== 'undefined') {\n void defineCustomElements();\n}\n"],"mappings":";AAkBA,eAAsB,qBACpB,WACe;AACf,MAAI,OAAO,WAAW,eAAe,OAAO,mBAAmB,aAAa;AAC1E;AAAA,EACF;AACA,MAAI,eAAe,IAAI,aAAa,GAAG;AACrC;AAAA,EACF;AAEA,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,UAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,WAAO,QAAQ;AAEf,QAAI,WAAW;AACb,aAAO,MAAM;AAAA,IACf,OAAO;AAEL,UAAI;AACF,eAAO,MAAM,IAAI,IAAI,kBAAkB,YAAY,GAAG,EAAE;AAAA,MAC1D,QAAQ;AACN,eAAO,IAAI,MAAM,0GAA0G,CAAC;AAC5H;AAAA,MACF;AAAA,IACF;AAEA,WAAO,SAAS,MAAM,QAAQ;AAC9B,WAAO,UAAU,MACf,OAAO,IAAI,MAAM,yDAAyD,CAAC;AAC7E,aAAS,KAAK,YAAY,MAAM;AAAA,EAClC,CAAC;AACH;AAGA,IAAI,OAAO,WAAW,eAAe,OAAO,mBAAmB,aAAa;AAC1E,OAAK,qBAAqB;AAC5B;","names":[]}
1
+ {"version":3,"sources":["../src/register.ts"],"sourcesContent":["/**\n * Registers Gait Web Components in the browser.\n * Safe to call in SSR environments - no-op when window/customElements unavailable.\n *\n * Usage:\n * import '@gait-financial/react/register'; // Side-effect: registers when in browser\n * // or\n * import { defineCustomElements } from '@gait-financial/react/register';\n * await defineCustomElements(); // Optional: load from custom URL\n */\n\n/**\n * Loads and registers Gait Web Components.\n * In browser: loads the WC script if not already registered.\n * In SSR: no-op.\n *\n * @param scriptUrl - Optional URL to the button.js script. If omitted, uses the bundled script.\n */\nexport async function defineCustomElements(\n scriptUrl?: string\n): Promise<void> {\n if (typeof window === 'undefined' || typeof customElements === 'undefined') {\n return;\n }\n if (customElements.get('gait-button')) {\n return;\n }\n\n return new Promise((resolve, reject) => {\n const script = document.createElement('script');\n script.async = true;\n\n if (scriptUrl) {\n script.src = scriptUrl;\n } else {\n // Use bundled script - path relative to this module\n try {\n script.src = new URL('./wc/button.js', import.meta.url).href;\n } catch {\n reject(new Error('[@gait-financial/react] Could not resolve bundled script. Load the web component via script tag or pass scriptUrl.'));\n return;\n }\n }\n\n script.onload = () => resolve();\n script.onerror = () =>\n reject(new Error('[@gait-financial/react] Failed to load Gait web component script.'));\n document.head.appendChild(script);\n });\n}\n\n// Side-effect: auto-register when imported in browser (SSR-safe)\nif (typeof window !== 'undefined' && typeof customElements !== 'undefined') {\n void defineCustomElements();\n}\n"],"mappings":";AAkBA,eAAsB,qBACpB,WACe;AACf,MAAI,OAAO,WAAW,eAAe,OAAO,mBAAmB,aAAa;AAC1E;AAAA,EACF;AACA,MAAI,eAAe,IAAI,aAAa,GAAG;AACrC;AAAA,EACF;AAEA,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,UAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,WAAO,QAAQ;AAEf,QAAI,WAAW;AACb,aAAO,MAAM;AAAA,IACf,OAAO;AAEL,UAAI;AACF,eAAO,MAAM,IAAI,IAAI,kBAAkB,YAAY,GAAG,EAAE;AAAA,MAC1D,QAAQ;AACN,eAAO,IAAI,MAAM,oHAAoH,CAAC;AACtI;AAAA,MACF;AAAA,IACF;AAEA,WAAO,SAAS,MAAM,QAAQ;AAC9B,WAAO,UAAU,MACf,OAAO,IAAI,MAAM,mEAAmE,CAAC;AACvF,aAAS,KAAK,YAAY,MAAM;AAAA,EAClC,CAAC;AACH;AAGA,IAAI,OAAO,WAAW,eAAe,OAAO,mBAAmB,aAAa;AAC1E,OAAK,qBAAqB;AAC5B;","names":[]}