@amos.com/react-amos-js 0.11.10 → 0.11.11
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/dist/index.js +1 -1
- package/dist/index.mjs +11 -8
- package/package.json +11 -2
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@amos.com/amos-js"),t=require("react"),n=require("react/jsx-runtime");function r(e){return e?e.current
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@amos.com/amos-js"),t=require("react"),n=require("react/jsx-runtime");function r(e){var t;return e?(t=e.current)==null?null:t:null}function i({iframeRef:t}){return(0,e.validateForm)({iframe:r(t)})}function a({iframeRef:t,token:n,defaultValues:i}){return(0,e.confirmPayment)({iframe:r(t),token:n,defaultValues:i})}function o({iframeRef:t,token:n,defaultValues:i}){return(0,e.confirmSetup)({iframe:r(t),token:n,defaultValues:i})}function s({iframeRef:t}){(0,e.resetForm)({iframe:r(t)})}function c({iframeRef:t,field:n}){(0,e.focusField)({iframe:r(t),field:n})}function l(e,t){typeof e==`function`?e(t):e&&(e.current=t)}function u(e,{style:t,className:n,id:r,...i}){n!=null&&(e.className=n),r!=null&&(e.id=r),Object.assign(e.style,t);for(let[t,n]of Object.entries(i))n!=null&&(t in e?Reflect.set(e,t,n):e.setAttribute(t,String(n)))}function d({containerRef:e,iframeRef:n,mount:r,options:i,remountDeps:a,iframePassthrough:o,updateDeps:s}){let c=(0,t.useRef)(null);(0,t.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let a=r(t,i);return c.current=a,l(n,a.iframe),u(a.iframe,o),()=>{a.destroy(),c.current=null,l(n,null)}},[...a]),(0,t.useEffect)(()=>{var e;(e=c.current)==null||e.update(i)},[...s]),(0,t.useEffect)(()=>{var e;let t=(e=c.current)==null?void 0:e.iframe;t&&u(t,o)})}var f=`oklch(0.97 0 0)`;function p({height:r,borderRadius:i,containerRef:a}){return(0,t.useLayoutEffect)(()=>{(0,e.ensureSkeletonStyles)()},[]),(0,n.jsxs)(`div`,{style:{boxSizing:`border-box`,position:`relative`,width:`100%`,height:r,minHeight:r,overflow:`hidden`},children:[(0,n.jsx)(`div`,{className:`amos-js-form-skeleton-input amos-js-wallet-skeleton`,style:{position:`absolute`,inset:0,height:r,borderRadius:i,background:f,pointerEvents:`none`,zIndex:0},"aria-hidden":!0}),(0,n.jsx)(`div`,{ref:a,style:{position:`absolute`,inset:0,zIndex:1,width:`100%`,height:`100%`}})]})}function m({ref:r,renderToken:i,appearance:a,onValidityChange:o,onCardBrandChanged:s,onEscapeKeyPressed:c,additionalFields:l={cardholderName:!1},billingAddressRequirement:u=`country`,defaultValues:f,style:p,...m}){let h=(0,t.useRef)(null);return d({containerRef:h,iframeRef:r,mount:e.mountAmosCreditCardPaymentMethodForm,options:{renderToken:i,appearance:a,additionalFields:l,billingAddressRequirement:u,defaultValues:f,onValidityChange:o,onCardBrandChanged:s,onEscapeKeyPressed:c},remountDeps:[i,l.cardholderName,u],iframePassthrough:{style:p,...m},updateDeps:[a,l,u,f,o,s,c]}),(0,n.jsx)(`div`,{ref:h})}function h({ref:r,renderToken:i,appearance:a,onValidityChange:o,onEscapeKeyPressed:s,billingAddressRequirement:c=`country`,defaultValues:l,requireAchVerification:u=!1,intent:f=`payment`,style:p,...m}){let h=(0,t.useRef)(null);return d({containerRef:h,iframeRef:r,mount:e.mountAmosBankAccountPaymentMethodForm,options:{renderToken:i,appearance:a,billingAddressRequirement:c,defaultValues:l,requireAchVerification:u,intent:f,onValidityChange:o,onEscapeKeyPressed:s},remountDeps:[i,c,f],iframePassthrough:{style:p,...m},updateDeps:[a,c,l,u,f,o,s]}),(0,n.jsx)(`div`,{ref:h})}function g({ref:r,renderToken:i,amount:a,merchantName:o,height:s=`48px`,buttonProps:c,iframeProps:l,onConfirm:u}){let f=(0,t.useRef)(null),m=(0,e.resolveWalletButtonSkeletonBorderRadius)({iframeStyle:l==null?void 0:l.style,buttonProps:c});return d({containerRef:f,iframeRef:r,mount:e.mountAmosGooglePayButton,options:{renderToken:i,amount:a,merchantName:o,height:s,buttonProps:c,onConfirm:u},remountDeps:[i],iframePassthrough:l==null?{}:l,updateDeps:[a,o,s,c,u]}),(0,n.jsx)(p,{height:s,borderRadius:m,containerRef:f})}function _({ref:r,renderToken:i,amount:a,merchantName:o,height:s=`48px`,buttonProps:c,iframeProps:l,onConfirm:u}){let f=(0,t.useRef)(null),m=(0,e.resolveWalletButtonSkeletonBorderRadius)({iframeStyle:l==null?void 0:l.style,buttonProps:c});return d({containerRef:f,iframeRef:r,mount:e.mountAmosApplePayButton,options:{renderToken:i,amount:a,merchantName:o,height:s,buttonProps:c,onConfirm:u},remountDeps:[i],iframePassthrough:l==null?{}:l,updateDeps:[a,o,s,c,u]}),(0,n.jsx)(p,{height:s,borderRadius:m,containerRef:f})}exports.AmosApplePayButton=_,exports.AmosBankAccountPaymentMethodForm=h,exports.AmosCreditCardPaymentMethodForm=m,exports.AmosGooglePayButton=g,exports.confirmPayment=a,exports.confirmSetup=o,exports.focusField=c,exports.resetForm=s,exports.validateForm=i,Object.keys(e).forEach(function(t){t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});
|
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,8 @@ import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
|
4
4
|
export * from "@amos.com/amos-js";
|
|
5
5
|
//#region src/index.tsx
|
|
6
6
|
function g(e) {
|
|
7
|
-
|
|
7
|
+
var t;
|
|
8
|
+
return e ? (t = e.current) == null ? null : t : null;
|
|
8
9
|
}
|
|
9
10
|
function _({ iframeRef: e }) {
|
|
10
11
|
return u({ iframe: g(e) });
|
|
@@ -49,10 +50,12 @@ function w({ containerRef: e, iframeRef: t, mount: n, options: r, remountDeps: i
|
|
|
49
50
|
o.destroy(), s.current = null, S(t, null);
|
|
50
51
|
};
|
|
51
52
|
}, [...i]), d(() => {
|
|
52
|
-
|
|
53
|
+
var e;
|
|
54
|
+
(e = s.current) == null || e.update(r);
|
|
53
55
|
}, [...o]), d(() => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
var e;
|
|
57
|
+
let t = (e = s.current) == null ? void 0 : e.iframe;
|
|
58
|
+
t && C(t, a);
|
|
56
59
|
});
|
|
57
60
|
}
|
|
58
61
|
var T = "oklch(0.97 0 0)";
|
|
@@ -166,7 +169,7 @@ function O({ ref: e, renderToken: t, appearance: n, onValidityChange: r, onEscap
|
|
|
166
169
|
}
|
|
167
170
|
function k({ ref: e, renderToken: t, amount: n, merchantName: r, height: i = "48px", buttonProps: a, iframeProps: o, onConfirm: c }) {
|
|
168
171
|
let u = p(null), d = l({
|
|
169
|
-
iframeStyle: o
|
|
172
|
+
iframeStyle: o == null ? void 0 : o.style,
|
|
170
173
|
buttonProps: a
|
|
171
174
|
});
|
|
172
175
|
return w({
|
|
@@ -182,7 +185,7 @@ function k({ ref: e, renderToken: t, amount: n, merchantName: r, height: i = "48
|
|
|
182
185
|
onConfirm: c
|
|
183
186
|
},
|
|
184
187
|
remountDeps: [t],
|
|
185
|
-
iframePassthrough: o
|
|
188
|
+
iframePassthrough: o == null ? {} : o,
|
|
186
189
|
updateDeps: [
|
|
187
190
|
n,
|
|
188
191
|
r,
|
|
@@ -198,7 +201,7 @@ function k({ ref: e, renderToken: t, amount: n, merchantName: r, height: i = "48
|
|
|
198
201
|
}
|
|
199
202
|
function A({ ref: e, renderToken: t, amount: n, merchantName: r, height: a = "48px", buttonProps: o, iframeProps: s, onConfirm: c }) {
|
|
200
203
|
let u = p(null), d = l({
|
|
201
|
-
iframeStyle: s
|
|
204
|
+
iframeStyle: s == null ? void 0 : s.style,
|
|
202
205
|
buttonProps: o
|
|
203
206
|
});
|
|
204
207
|
return w({
|
|
@@ -214,7 +217,7 @@ function A({ ref: e, renderToken: t, amount: n, merchantName: r, height: a = "48
|
|
|
214
217
|
onConfirm: c
|
|
215
218
|
},
|
|
216
219
|
remountDeps: [t],
|
|
217
|
-
iframePassthrough: s
|
|
220
|
+
iframePassthrough: s == null ? {} : s,
|
|
218
221
|
updateDeps: [
|
|
219
222
|
n,
|
|
220
223
|
r,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amos.com/react-amos-js",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.11",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,6 +35,15 @@
|
|
|
35
35
|
},
|
|
36
36
|
"author": "Amos",
|
|
37
37
|
"license": "MIT",
|
|
38
|
+
"browserslist": [
|
|
39
|
+
"chrome >= 64",
|
|
40
|
+
"firefox >= 67",
|
|
41
|
+
"safari >= 12",
|
|
42
|
+
"ios >= 12",
|
|
43
|
+
"samsung >= 9",
|
|
44
|
+
"edge >= 79",
|
|
45
|
+
"opera >= 51"
|
|
46
|
+
],
|
|
38
47
|
"description": "React SDK for embedding Amos payment methods via iframes. Wraps @amos.com/amos-js.",
|
|
39
48
|
"devDependencies": {
|
|
40
49
|
"@amos.com/node": "0.1.57",
|
|
@@ -48,7 +57,7 @@
|
|
|
48
57
|
"vite-plugin-dts": "5.0.3"
|
|
49
58
|
},
|
|
50
59
|
"dependencies": {
|
|
51
|
-
"@amos.com/amos-js": "0.11.
|
|
60
|
+
"@amos.com/amos-js": "0.11.13",
|
|
52
61
|
"@types/googlepay": "0.7.12"
|
|
53
62
|
},
|
|
54
63
|
"peerDependencies": {
|