@ic-pay/icpay-widget 1.1.3 → 1.1.6

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.
@@ -0,0 +1,13 @@
1
+ import '../amount-input-B399OwiA.js';
2
+ import 'lit';
3
+
4
+ declare const IcpayPayButton: any;
5
+ declare const IcpayAmountInput: any;
6
+ declare const IcpayPremiumContent: any;
7
+ declare const IcpayTipJar: any;
8
+ declare const IcpayArticlePaywall: any;
9
+ declare const IcpayCoffeeShop: any;
10
+ declare const IcpayDonationThermometer: any;
11
+ declare const IcpayProgressBar: any;
12
+
13
+ export { IcpayAmountInput, IcpayArticlePaywall, IcpayCoffeeShop, IcpayDonationThermometer, IcpayPayButton, IcpayPremiumContent, IcpayProgressBar, IcpayTipJar };
@@ -0,0 +1,2 @@
1
+ import"../chunk-PK6L5TPW.js";import y,{forwardRef as u,useEffect as g,useRef as C}from"react";function e(r){let i=u((o,n)=>{let a=C(null);g(()=>{let t=a.current;if(!t)return;let{children:T,className:E,style:b,id:h,role:P,tabIndex:d,title:x,ref:I,...l}=o;for(let[s,f]of Object.entries(l))try{t[s]=f}catch{}},[o]);let c=t=>{a.current=t,typeof n=="function"?n(t):n&&typeof n=="object"&&(n.current=t)},{children:p,...m}=o;return y.createElement(r,{ref:c,...m},p)});return i.displayName=`ICPay(${r})`,i}var H=e("icpay-pay-button"),L=e("icpay-amount-input"),w=e("icpay-premium-content"),j=e("icpay-tip-jar"),B=e("icpay-article-paywall"),S=e("icpay-coffee-shop"),k=e("icpay-donation-thermometer"),D=e("icpay-progress-bar");export{L as IcpayAmountInput,B as IcpayArticlePaywall,S as IcpayCoffeeShop,k as IcpayDonationThermometer,H as IcpayPayButton,w as IcpayPremiumContent,D as IcpayProgressBar,j as IcpayTipJar};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/react/createWrapper.tsx","../../src/react/widgets.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef } from 'react';\n\ntype AnyProps = Record<string, unknown> & { children?: React.ReactNode };\n\n// Generic React wrapper for ICPay custom elements.\n// - Assigns all non-React props as properties on the underlying element\n// - Leaves events to be handled via config callbacks (recommended)\nexport function createWebComponent<TElement extends HTMLElement, TProps extends AnyProps>(\n tagName: string\n) {\n const Component = forwardRef<TElement, TProps>((props, ref) => {\n const innerRef = useRef<TElement | null>(null);\n\n useEffect(() => {\n const el = innerRef.current as any;\n if (!el) return;\n\n // Assign props as element properties (exclude standard React DOM props)\n const {\n children,\n className,\n style,\n id,\n role,\n tabIndex,\n title,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ref: _ignoredRef,\n ...rest\n } = props as any;\n\n for (const [key, value] of Object.entries(rest)) {\n try {\n (el as any)[key] = value;\n } catch {\n // no-op if property assignment fails\n }\n }\n }, [props]);\n\n // Merge forwarded ref\n const setRef = (node: TElement | null) => {\n innerRef.current = node;\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref && typeof ref === 'object') {\n (ref as React.MutableRefObject<TElement | null>).current = node;\n }\n };\n\n const { children, ...rest } = props as any;\n return React.createElement(tagName, { ref: setRef, ...rest }, children);\n });\n\n Component.displayName = `ICPay(${tagName})`;\n return Component;\n}\n\n\n","import { createWebComponent } from './createWrapper';\nimport type {\n PayButtonConfig,\n AmountInputConfig,\n PremiumContentConfig,\n TipJarConfig,\n ArticlePaywallConfig,\n CoffeeShopConfig,\n DonationThermometerConfig,\n ThemeConfig\n} from '../types';\n\n// Public React components\nexport const IcpayPayButton = createWebComponent<HTMLElement, { config?: PayButtonConfig }>('icpay-pay-button');\nexport const IcpayAmountInput = createWebComponent<HTMLElement, { config?: AmountInputConfig }>('icpay-amount-input');\nexport const IcpayPremiumContent = createWebComponent<HTMLElement, { config?: PremiumContentConfig }>('icpay-premium-content');\nexport const IcpayTipJar = createWebComponent<HTMLElement, { config?: TipJarConfig }>('icpay-tip-jar');\nexport const IcpayArticlePaywall = createWebComponent<HTMLElement, { config?: ArticlePaywallConfig }>('icpay-article-paywall');\nexport const IcpayCoffeeShop = createWebComponent<HTMLElement, { config?: CoffeeShopConfig }>('icpay-coffee-shop');\nexport const IcpayDonationThermometer = createWebComponent<HTMLElement, { config?: DonationThermometerConfig }>('icpay-donation-thermometer');\nexport const IcpayProgressBar = createWebComponent<HTMLElement, {\n open?: boolean;\n steps?: Array<{ key: string; label: string; tooltip: string; status: string }>;\n amount?: number;\n currency?: string;\n ledgerSymbol?: string;\n debug?: boolean;\n theme?: ThemeConfig;\n}>('icpay-progress-bar');\n\n// Internal helpers (not exported): wallet selector is not a standalone element.\n\n\n"],"mappings":"6BAAA,OAAOA,GAAS,cAAAC,EAAY,aAAAC,EAAW,UAAAC,MAAc,QAO9C,SAASC,EACdC,EACA,CACA,IAAMC,EAAYL,EAA6B,CAACM,EAAOC,IAAQ,CAC7D,IAAMC,EAAWN,EAAwB,IAAI,EAE7CD,EAAU,IAAM,CACd,IAAMQ,EAAKD,EAAS,QACpB,GAAI,CAACC,EAAI,OAGT,GAAM,CACJ,SAAAC,EACA,UAAAC,EACA,MAAAC,EACA,GAAAC,EACA,KAAAC,EACA,SAAAC,EACA,MAAAC,EAEA,IAAKC,EACL,GAAGC,CACL,EAAIZ,EAEJ,OAAW,CAACa,EAAKC,CAAK,IAAK,OAAO,QAAQF,CAAI,EAC5C,GAAI,CACDT,EAAWU,CAAG,EAAIC,CACrB,MAAQ,CAER,CAEJ,EAAG,CAACd,CAAK,CAAC,EAGV,IAAMe,EAAUC,GAA0B,CACxCd,EAAS,QAAUc,EACf,OAAOf,GAAQ,WACjBA,EAAIe,CAAI,EACCf,GAAO,OAAOA,GAAQ,WAC9BA,EAAgD,QAAUe,EAE/D,EAEM,CAAE,SAAAZ,EAAU,GAAGQ,CAAK,EAAIZ,EAC9B,OAAOP,EAAM,cAAcK,EAAS,CAAE,IAAKiB,EAAQ,GAAGH,CAAK,EAAGR,CAAQ,CACxE,CAAC,EAED,OAAAL,EAAU,YAAc,SAASD,CAAO,IACjCC,CACT,CC3CO,IAAMkB,EAAiBC,EAA8D,kBAAkB,EACjGC,EAAmBD,EAAgE,oBAAoB,EACvGE,EAAsBF,EAAmE,uBAAuB,EAChHG,EAAcH,EAA2D,eAAe,EACxFI,EAAsBJ,EAAmE,uBAAuB,EAChHK,EAAkBL,EAA+D,mBAAmB,EACpGM,EAA2BN,EAAwE,4BAA4B,EAC/HO,EAAmBP,EAQ7B,oBAAoB","names":["React","forwardRef","useEffect","useRef","createWebComponent","tagName","Component","props","ref","innerRef","el","children","className","style","id","role","tabIndex","title","_ignoredRef","rest","key","value","setRef","node","IcpayPayButton","createWebComponent","IcpayAmountInput","IcpayPremiumContent","IcpayTipJar","IcpayArticlePaywall","IcpayCoffeeShop","IcpayDonationThermometer","IcpayProgressBar"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ic-pay/icpay-widget",
3
- "version": "1.1.3",
3
+ "version": "1.1.6",
4
4
  "description": "ICPay embeddable payment widgets as framework-agnostic Web Components",
5
5
  "homepage": "https://github.com/icpay/icpay-widget#readme",
6
6
  "bugs": {
@@ -17,6 +17,10 @@
17
17
  ".": {
18
18
  "import": "./dist/index.js",
19
19
  "types": "./dist/index.d.ts"
20
+ },
21
+ "./react": {
22
+ "import": "./dist/react/index.js",
23
+ "types": "./dist/react/index.d.ts"
20
24
  }
21
25
  },
22
26
  "main": "dist/index.js",
@@ -25,7 +29,7 @@
25
29
  "dist"
26
30
  ],
27
31
  "scripts": {
28
- "build": "tsup src/index.ts --format esm,iife --global-name ICPayWidget --dts --minify --sourcemap --clean --external @ic-pay/icpay-sdk && pnpm build:css",
32
+ "build": "tsup src/index.ts src/react/index.ts --format esm --dts --minify --sourcemap --clean --external @ic-pay/icpay-sdk,react,react-dom && pnpm build:css",
29
33
  "build:css": "tailwindcss -i src/styles/tailwind.css -o dist/tailwind.css --minify",
30
34
  "dev": "tsup src/index.ts --watch --format esm,iife --global-name ICPayWidget --dts --external @ic-pay/icpay-sdk",
31
35
  "build:embed": "tsup src/index.ts --format iife --global-name ICPayWidget --minify --sourcemap --no-splitting --platform=browser && node -e \"const fs=require('fs');if(fs.existsSync('dist/index.global.js')){fs.renameSync('dist/index.global.js','dist/index.embed.js');if(fs.existsSync('dist/index.global.js.map'))fs.renameSync('dist/index.global.js.map','dist/index.embed.js.map');}\"",
@@ -44,6 +48,8 @@
44
48
  "typescript": "^5.9.2"
45
49
  },
46
50
  "peerDependencies": {
51
+ "react": ">=18",
52
+ "react-dom": ">=18",
47
53
  "@ic-pay/icpay-sdk": "*"
48
54
  },
49
55
  "module": "dist/index.js",