@amos.com/react-amos-js 0.3.5 → 0.3.7
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 +121 -176
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1 +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??null:null}function i({iframeRef:t}){return(0,e.validateForm)({iframe:r(t)})}function a({iframeRef:t,token:n}){(0,e.confirmPaymentIntent)({iframe:r(t),token:n})}function o({iframeRef:t,token:n}){(0,e.confirmSetupIntent)({iframe:r(t),token:n})}function s(e,t){typeof e==`function`?e(t):e&&(e.current=t)}function c(e,{style:t,className:n,id:r,...i}){n!=null&&(e.className=n),r!=null&&(e.id=r),t!=null&&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 l({containerRef:e,iframeRef:n,mount:r,options:i,remountDeps:a,iframePassthrough:o,updateDeps:l}){let u=(0,t.useRef)(null);(0,t.useEffect)(()=>{let t=e.current;if(!t)return;let a=r(t,i);return u.current=a,s(n,a.iframe),c(a.iframe,o),()=>{a.destroy(),u.current=null,s(n,null)}},[...a]),(0,t.useEffect)(()=>{u.current?.update(i)},[...l]),(0,t.useEffect)(()=>{let e=u.current?.iframe;e&&c(e,o)})}function u({ref:r,renderToken:i,appearance:a,onPaymentIntentConfirmationSucceeded:o,onSetupIntentConfirmationSucceeded:s,onConfirmationFailed:c,additionalFields:u={cardholderName:!1},style:d,...f}){let p=(0,t.useRef)(null);return l({containerRef:p,iframeRef:r,mount:e.mountAmosCreditCardPaymentMethodForm,options:{renderToken:i,appearance:a,additionalFields:u,onPaymentIntentConfirmationSucceeded:o,onSetupIntentConfirmationSucceeded:s,onConfirmationFailed:c},remountDeps:[i,u.cardholderName],iframePassthrough:{style:d,...f},updateDeps:[a,u,o,s,c]}),(0,n.jsx)(`div`,{ref:p})}function d({ref:r,renderToken:i,appearance:a,onPaymentIntentConfirmationSucceeded:o,onSetupIntentConfirmationSucceeded:s,onConfirmationFailed:c,style:u,...d}){let f=(0,t.useRef)(null);return l({containerRef:f,iframeRef:r,mount:e.mountAmosBankAccountPaymentMethodForm,options:{renderToken:i,appearance:a,onPaymentIntentConfirmationSucceeded:o,onSetupIntentConfirmationSucceeded:s,onConfirmationFailed:c},remountDeps:[i],iframePassthrough:{style:u,...d},updateDeps:[a,o,s,c]}),(0,n.jsx)(`div`,{ref:f})}function f({ref:r,renderToken:i,amount:a,merchantName:o,appearance:s,onInitiatePaymentIntentRequest:c,onPaymentIntentConfirmationSucceeded:u,onConfirmationFailed:d,style:f,...p}){let m=(0,t.useRef)(null);return l({containerRef:m,iframeRef:r,mount:e.mountAmosGooglePayButton,options:{renderToken:i,amount:a,merchantName:o,appearance:s,onInitiatePaymentIntentRequest:c,onPaymentIntentConfirmationSucceeded:u,onConfirmationFailed:d},remountDeps:[i],iframePassthrough:{style:f,...p},updateDeps:[a,o,s,c,u,d]}),(0,n.jsx)(`div`,{ref:m})}exports.AmosBankAccountPaymentMethodForm=d,exports.AmosCreditCardPaymentMethodForm=u,exports.AmosGooglePayButton=f,exports.confirmPaymentIntent=a,exports.confirmSetupIntent=o,Object.defineProperty(exports,"createMessage",{enumerable:!0,get:function(){return e.createMessage}}),Object.defineProperty(exports,"decodeJwt",{enumerable:!0,get:function(){return e.decodeJwt}}),Object.defineProperty(exports,"formatGooglePayPaymentData",{enumerable:!0,get:function(){return e.formatGooglePayPaymentData}}),Object.defineProperty(exports,"getEmbedOrigin",{enumerable:!0,get:function(){return e.getEmbedOrigin}}),exports.validateForm=i;
|
package/dist/index.mjs
CHANGED
|
@@ -1,186 +1,131 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { jsx as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function g(t) {
|
|
8
|
-
return t ? t.current ?? null : null;
|
|
1
|
+
import { confirmPaymentIntent as e, confirmSetupIntent as t, createMessage as n, decodeJwt as r, formatGooglePayPaymentData as i, getEmbedOrigin as a, mountAmosBankAccountPaymentMethodForm as o, mountAmosCreditCardPaymentMethodForm as s, mountAmosGooglePayButton as c, validateForm as l } from "@amos.com/amos-js";
|
|
2
|
+
import { useEffect as u, useRef as d } from "react";
|
|
3
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
4
|
+
//#region src/index.tsx
|
|
5
|
+
function p(e) {
|
|
6
|
+
return e ? e.current ?? null : null;
|
|
9
7
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
iframeRef: t
|
|
13
|
-
}) {
|
|
14
|
-
return D({ iframe: g(t) });
|
|
8
|
+
function m({ iframeRef: e }) {
|
|
9
|
+
return l({ iframe: p(e) });
|
|
15
10
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
})
|
|
21
|
-
R({ iframe: g(t), token: r });
|
|
11
|
+
function h({ iframeRef: t, token: n }) {
|
|
12
|
+
e({
|
|
13
|
+
iframe: p(t),
|
|
14
|
+
token: n
|
|
15
|
+
});
|
|
22
16
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
})
|
|
28
|
-
d({ iframe: g(t), token: r });
|
|
17
|
+
function g({ iframeRef: e, token: n }) {
|
|
18
|
+
t({
|
|
19
|
+
iframe: p(e),
|
|
20
|
+
token: n
|
|
21
|
+
});
|
|
29
22
|
}
|
|
30
|
-
|
|
31
|
-
function
|
|
32
|
-
typeof t == "function" ? t(r) : t && (t.current = r);
|
|
23
|
+
function _(e, t) {
|
|
24
|
+
typeof e == "function" ? e(t) : e && (e.current = t);
|
|
33
25
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
for (const [e, n] of Object.entries(s))
|
|
38
|
-
n != null && (e in t ? Reflect.set(t, e, n) : t.setAttribute(e, String(n)));
|
|
26
|
+
function v(e, { style: t, className: n, id: r, ...i }) {
|
|
27
|
+
n != null && (e.className = n), r != null && (e.id = r), t != null && Object.assign(e.style, t);
|
|
28
|
+
for (let [t, n] of Object.entries(i)) n != null && (t in e ? Reflect.set(e, t, n) : e.setAttribute(t, String(n)));
|
|
39
29
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const l = u(f, o);
|
|
56
|
-
return m.current = l, A(r, l.iframe), P(l.iframe, e), () => {
|
|
57
|
-
l.destroy(), m.current = null, A(r, null);
|
|
58
|
-
};
|
|
59
|
-
}, [...s]), a(() => {
|
|
60
|
-
m.current?.update(o);
|
|
61
|
-
}, [...n]), a(() => {
|
|
62
|
-
const f = m.current?.iframe;
|
|
63
|
-
f && P(f, e);
|
|
64
|
-
});
|
|
30
|
+
function y({ containerRef: e, iframeRef: t, mount: n, options: r, remountDeps: i, iframePassthrough: a, updateDeps: o }) {
|
|
31
|
+
let s = d(null);
|
|
32
|
+
u(() => {
|
|
33
|
+
let i = e.current;
|
|
34
|
+
if (!i) return;
|
|
35
|
+
let o = n(i, r);
|
|
36
|
+
return s.current = o, _(t, o.iframe), v(o.iframe, a), () => {
|
|
37
|
+
o.destroy(), s.current = null, _(t, null);
|
|
38
|
+
};
|
|
39
|
+
}, [...i]), u(() => {
|
|
40
|
+
s.current?.update(r);
|
|
41
|
+
}, [...o]), u(() => {
|
|
42
|
+
let e = s.current?.iframe;
|
|
43
|
+
e && v(e, a);
|
|
44
|
+
});
|
|
65
45
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
updateDeps: [
|
|
94
|
-
u,
|
|
95
|
-
n,
|
|
96
|
-
o,
|
|
97
|
-
s,
|
|
98
|
-
e
|
|
99
|
-
]
|
|
100
|
-
}), /* @__PURE__ */ p("div", { ref: l });
|
|
46
|
+
function b({ ref: e, renderToken: t, appearance: n, onPaymentIntentConfirmationSucceeded: r, onSetupIntentConfirmationSucceeded: i, onConfirmationFailed: a, additionalFields: o = { cardholderName: !1 }, style: c, ...l }) {
|
|
47
|
+
let u = d(null);
|
|
48
|
+
return y({
|
|
49
|
+
containerRef: u,
|
|
50
|
+
iframeRef: e,
|
|
51
|
+
mount: s,
|
|
52
|
+
options: {
|
|
53
|
+
renderToken: t,
|
|
54
|
+
appearance: n,
|
|
55
|
+
additionalFields: o,
|
|
56
|
+
onPaymentIntentConfirmationSucceeded: r,
|
|
57
|
+
onSetupIntentConfirmationSucceeded: i,
|
|
58
|
+
onConfirmationFailed: a
|
|
59
|
+
},
|
|
60
|
+
remountDeps: [t, o.cardholderName],
|
|
61
|
+
iframePassthrough: {
|
|
62
|
+
style: c,
|
|
63
|
+
...l
|
|
64
|
+
},
|
|
65
|
+
updateDeps: [
|
|
66
|
+
n,
|
|
67
|
+
o,
|
|
68
|
+
r,
|
|
69
|
+
i,
|
|
70
|
+
a
|
|
71
|
+
]
|
|
72
|
+
}), /* @__PURE__ */ f("div", { ref: u });
|
|
101
73
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
updateDeps: [
|
|
128
|
-
u,
|
|
129
|
-
o,
|
|
130
|
-
s,
|
|
131
|
-
e
|
|
132
|
-
]
|
|
133
|
-
}), /* @__PURE__ */ p("div", { ref: f });
|
|
74
|
+
function x({ ref: e, renderToken: t, appearance: n, onPaymentIntentConfirmationSucceeded: r, onSetupIntentConfirmationSucceeded: i, onConfirmationFailed: a, style: s, ...c }) {
|
|
75
|
+
let l = d(null);
|
|
76
|
+
return y({
|
|
77
|
+
containerRef: l,
|
|
78
|
+
iframeRef: e,
|
|
79
|
+
mount: o,
|
|
80
|
+
options: {
|
|
81
|
+
renderToken: t,
|
|
82
|
+
appearance: n,
|
|
83
|
+
onPaymentIntentConfirmationSucceeded: r,
|
|
84
|
+
onSetupIntentConfirmationSucceeded: i,
|
|
85
|
+
onConfirmationFailed: a
|
|
86
|
+
},
|
|
87
|
+
remountDeps: [t],
|
|
88
|
+
iframePassthrough: {
|
|
89
|
+
style: s,
|
|
90
|
+
...c
|
|
91
|
+
},
|
|
92
|
+
updateDeps: [
|
|
93
|
+
n,
|
|
94
|
+
r,
|
|
95
|
+
i,
|
|
96
|
+
a
|
|
97
|
+
]
|
|
98
|
+
}), /* @__PURE__ */ f("div", { ref: l });
|
|
134
99
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
updateDeps: [
|
|
165
|
-
u,
|
|
166
|
-
o,
|
|
167
|
-
s,
|
|
168
|
-
e,
|
|
169
|
-
n,
|
|
170
|
-
m
|
|
171
|
-
]
|
|
172
|
-
}), /* @__PURE__ */ p("div", { ref: y });
|
|
100
|
+
function S({ ref: e, renderToken: t, amount: n, merchantName: r, appearance: i, onInitiatePaymentIntentRequest: a, onPaymentIntentConfirmationSucceeded: o, onConfirmationFailed: s, style: l, ...u }) {
|
|
101
|
+
let p = d(null);
|
|
102
|
+
return y({
|
|
103
|
+
containerRef: p,
|
|
104
|
+
iframeRef: e,
|
|
105
|
+
mount: c,
|
|
106
|
+
options: {
|
|
107
|
+
renderToken: t,
|
|
108
|
+
amount: n,
|
|
109
|
+
merchantName: r,
|
|
110
|
+
appearance: i,
|
|
111
|
+
onInitiatePaymentIntentRequest: a,
|
|
112
|
+
onPaymentIntentConfirmationSucceeded: o,
|
|
113
|
+
onConfirmationFailed: s
|
|
114
|
+
},
|
|
115
|
+
remountDeps: [t],
|
|
116
|
+
iframePassthrough: {
|
|
117
|
+
style: l,
|
|
118
|
+
...u
|
|
119
|
+
},
|
|
120
|
+
updateDeps: [
|
|
121
|
+
n,
|
|
122
|
+
r,
|
|
123
|
+
i,
|
|
124
|
+
a,
|
|
125
|
+
o,
|
|
126
|
+
s
|
|
127
|
+
]
|
|
128
|
+
}), /* @__PURE__ */ f("div", { ref: p });
|
|
173
129
|
}
|
|
174
|
-
|
|
175
|
-
export {
|
|
176
|
-
I as AmosBankAccountPaymentMethodForm,
|
|
177
|
-
w as AmosCreditCardPaymentMethodForm,
|
|
178
|
-
J as AmosGooglePayButton,
|
|
179
|
-
O as confirmPaymentIntent,
|
|
180
|
-
$ as confirmSetupIntent,
|
|
181
|
-
z as createMessage,
|
|
182
|
-
H as decodeJwt,
|
|
183
|
-
K as formatGooglePayPaymentData,
|
|
184
|
-
L as getEmbedOrigin,
|
|
185
|
-
G as validateForm
|
|
186
|
-
};
|
|
130
|
+
//#endregion
|
|
131
|
+
export { x as AmosBankAccountPaymentMethodForm, b as AmosCreditCardPaymentMethodForm, S as AmosGooglePayButton, h as confirmPaymentIntent, g as confirmSetupIntent, n as createMessage, r as decodeJwt, i as formatGooglePayPaymentData, a as getEmbedOrigin, m as validateForm };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amos.com/react-amos-js",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,16 +36,16 @@
|
|
|
36
36
|
"description": "React SDK for embedding Amos payment methods via iframes. Wraps @amos.com/amos-js.",
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@biomejs/biome": "2.4.15",
|
|
39
|
-
"@changesets/cli": "2.
|
|
39
|
+
"@changesets/cli": "^2.6.0",
|
|
40
40
|
"@types/node": "25.9.1",
|
|
41
41
|
"@types/react": "19.2.15",
|
|
42
42
|
"typescript": "6.0.3",
|
|
43
|
-
"vite": "
|
|
43
|
+
"vite": "8.0.16",
|
|
44
44
|
"vite-plugin-dts": "4.5.4"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@amos.com/amos-js": "0.3.
|
|
48
|
-
"@amos.com/node": "0.1.
|
|
47
|
+
"@amos.com/amos-js": "0.3.7",
|
|
48
|
+
"@amos.com/node": "0.1.12",
|
|
49
49
|
"@types/googlepay": "0.7.10"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|