@amos.com/react-amos-js 0.3.14 → 0.3.15

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.d.ts CHANGED
@@ -2,8 +2,7 @@
2
2
  import { Appearance, CreditCardAdditionalFields } from '@amos.com/amos-js';
3
3
  import { components } from '@amos.com/node';
4
4
  import { ComponentProps, RefObject } from 'react';
5
- export type { Appearance, AppearanceLabels, CreateCustomerInput, CreatePaymentIntentInput, CreateSetupIntentInput, CreditCardAdditionalFields, EmbedToken, EmbedTokenJwt, Message, PaymentIntent, RenderTokenJwt, SetupIntent, ThemeVariable, } from '@amos.com/amos-js';
6
- export { createMessage, decodeJwt, formatGooglePayPaymentData, getEmbedOrigin, } from '@amos.com/amos-js';
5
+ export * from '@amos.com/amos-js';
7
6
  type IframeRef = RefObject<HTMLIFrameElement | null> | undefined;
8
7
  /**
9
8
  * Validate the embedded card/bank iframe form before payment
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??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;
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,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
@@ -1,131 +1,132 @@
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";
1
+ import { confirmPaymentIntent as e, confirmSetupIntent as t, mountAmosBankAccountPaymentMethodForm as n, mountAmosCreditCardPaymentMethodForm as r, mountAmosGooglePayButton as i, validateForm as a } from "@amos.com/amos-js";
2
+ import { useEffect as o, useRef as s } from "react";
3
+ import { jsx as c } from "react/jsx-runtime";
4
+ export * from "@amos.com/amos-js";
4
5
  //#region src/index.tsx
5
- function p(e) {
6
+ function l(e) {
6
7
  return e ? e.current ?? null : null;
7
8
  }
8
- function m({ iframeRef: e }) {
9
- return l({ iframe: p(e) });
9
+ function u({ iframeRef: e }) {
10
+ return a({ iframe: l(e) });
10
11
  }
11
- function h({ iframeRef: t, token: n }) {
12
+ function d({ iframeRef: t, token: n }) {
12
13
  e({
13
- iframe: p(t),
14
+ iframe: l(t),
14
15
  token: n
15
16
  });
16
17
  }
17
- function g({ iframeRef: e, token: n }) {
18
+ function f({ iframeRef: e, token: n }) {
18
19
  t({
19
- iframe: p(e),
20
+ iframe: l(e),
20
21
  token: n
21
22
  });
22
23
  }
23
- function _(e, t) {
24
+ function p(e, t) {
24
25
  typeof e == "function" ? e(t) : e && (e.current = t);
25
26
  }
26
- function v(e, { style: t, className: n, id: r, ...i }) {
27
+ function m(e, { style: t, className: n, id: r, ...i }) {
27
28
  n != null && (e.className = n), r != null && (e.id = r), t != null && Object.assign(e.style, t);
28
29
  for (let [t, n] of Object.entries(i)) n != null && (t in e ? Reflect.set(e, t, n) : e.setAttribute(t, String(n)));
29
30
  }
30
- function y({ containerRef: e, iframeRef: t, mount: n, options: r, remountDeps: i, iframePassthrough: a, updateDeps: o }) {
31
- let s = d(null);
32
- u(() => {
31
+ function h({ containerRef: e, iframeRef: t, mount: n, options: r, remountDeps: i, iframePassthrough: a, updateDeps: c }) {
32
+ let l = s(null);
33
+ o(() => {
33
34
  let i = e.current;
34
35
  if (!i) return;
35
36
  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);
37
+ return l.current = o, p(t, o.iframe), m(o.iframe, a), () => {
38
+ o.destroy(), l.current = null, p(t, null);
38
39
  };
39
- }, [...i]), u(() => {
40
- s.current?.update(r);
41
- }, [...o]), u(() => {
42
- let e = s.current?.iframe;
43
- e && v(e, a);
40
+ }, [...i]), o(() => {
41
+ l.current?.update(r);
42
+ }, [...c]), o(() => {
43
+ let e = l.current?.iframe;
44
+ e && m(e, a);
44
45
  });
45
46
  }
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,
47
+ function g({ ref: e, renderToken: t, appearance: n, onPaymentIntentConfirmationSucceeded: i, onSetupIntentConfirmationSucceeded: a, onConfirmationFailed: o, additionalFields: l = { cardholderName: !1 }, style: u, ...d }) {
48
+ let f = s(null);
49
+ return h({
50
+ containerRef: f,
50
51
  iframeRef: e,
51
- mount: s,
52
+ mount: r,
52
53
  options: {
53
54
  renderToken: t,
54
55
  appearance: n,
55
- additionalFields: o,
56
- onPaymentIntentConfirmationSucceeded: r,
57
- onSetupIntentConfirmationSucceeded: i,
58
- onConfirmationFailed: a
56
+ additionalFields: l,
57
+ onPaymentIntentConfirmationSucceeded: i,
58
+ onSetupIntentConfirmationSucceeded: a,
59
+ onConfirmationFailed: o
59
60
  },
60
- remountDeps: [t, o.cardholderName],
61
+ remountDeps: [t, l.cardholderName],
61
62
  iframePassthrough: {
62
- style: c,
63
- ...l
63
+ style: u,
64
+ ...d
64
65
  },
65
66
  updateDeps: [
66
67
  n,
67
- o,
68
- r,
68
+ l,
69
69
  i,
70
- a
70
+ a,
71
+ o
71
72
  ]
72
- }), /* @__PURE__ */ f("div", { ref: u });
73
+ }), /* @__PURE__ */ c("div", { ref: f });
73
74
  }
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,
75
+ function _({ ref: e, renderToken: t, appearance: r, onPaymentIntentConfirmationSucceeded: i, onSetupIntentConfirmationSucceeded: a, onConfirmationFailed: o, style: l, ...u }) {
76
+ let d = s(null);
77
+ return h({
78
+ containerRef: d,
78
79
  iframeRef: e,
79
- mount: o,
80
+ mount: n,
80
81
  options: {
81
82
  renderToken: t,
82
- appearance: n,
83
- onPaymentIntentConfirmationSucceeded: r,
84
- onSetupIntentConfirmationSucceeded: i,
85
- onConfirmationFailed: a
83
+ appearance: r,
84
+ onPaymentIntentConfirmationSucceeded: i,
85
+ onSetupIntentConfirmationSucceeded: a,
86
+ onConfirmationFailed: o
86
87
  },
87
88
  remountDeps: [t],
88
89
  iframePassthrough: {
89
- style: s,
90
- ...c
90
+ style: l,
91
+ ...u
91
92
  },
92
93
  updateDeps: [
93
- n,
94
94
  r,
95
95
  i,
96
- a
96
+ a,
97
+ o
97
98
  ]
98
- }), /* @__PURE__ */ f("div", { ref: l });
99
+ }), /* @__PURE__ */ c("div", { ref: d });
99
100
  }
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({
101
+ function v({ ref: e, renderToken: t, amount: n, merchantName: r, appearance: a, onInitiatePaymentIntentRequest: o, onPaymentIntentConfirmationSucceeded: l, onConfirmationFailed: u, style: d, ...f }) {
102
+ let p = s(null);
103
+ return h({
103
104
  containerRef: p,
104
105
  iframeRef: e,
105
- mount: c,
106
+ mount: i,
106
107
  options: {
107
108
  renderToken: t,
108
109
  amount: n,
109
110
  merchantName: r,
110
- appearance: i,
111
- onInitiatePaymentIntentRequest: a,
112
- onPaymentIntentConfirmationSucceeded: o,
113
- onConfirmationFailed: s
111
+ appearance: a,
112
+ onInitiatePaymentIntentRequest: o,
113
+ onPaymentIntentConfirmationSucceeded: l,
114
+ onConfirmationFailed: u
114
115
  },
115
116
  remountDeps: [t],
116
117
  iframePassthrough: {
117
- style: l,
118
- ...u
118
+ style: d,
119
+ ...f
119
120
  },
120
121
  updateDeps: [
121
122
  n,
122
123
  r,
123
- i,
124
124
  a,
125
125
  o,
126
- s
126
+ l,
127
+ u
127
128
  ]
128
- }), /* @__PURE__ */ f("div", { ref: p });
129
+ }), /* @__PURE__ */ c("div", { ref: p });
129
130
  }
130
131
  //#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 };
132
+ export { _ as AmosBankAccountPaymentMethodForm, g as AmosCreditCardPaymentMethodForm, v as AmosGooglePayButton, d as confirmPaymentIntent, f as confirmSetupIntent, u as validateForm };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amos.com/react-amos-js",
3
- "version": "0.3.14",
3
+ "version": "0.3.15",
4
4
  "main": "dist/index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -44,8 +44,8 @@
44
44
  "vite-plugin-dts": "5.0.2"
45
45
  },
46
46
  "dependencies": {
47
- "@amos.com/amos-js": "0.3.17",
48
- "@amos.com/node": "0.1.21",
47
+ "@amos.com/amos-js": "0.3.18",
48
+ "@amos.com/node": "0.1.22",
49
49
  "@types/googlepay": "0.7.11"
50
50
  },
51
51
  "peerDependencies": {
package/src/index.tsx CHANGED
@@ -19,27 +19,7 @@ import {
19
19
  useRef,
20
20
  } from "react";
21
21
 
22
- export type {
23
- Appearance,
24
- AppearanceLabels,
25
- CreateCustomerInput,
26
- CreatePaymentIntentInput,
27
- CreateSetupIntentInput,
28
- CreditCardAdditionalFields,
29
- EmbedToken,
30
- EmbedTokenJwt,
31
- Message,
32
- PaymentIntent,
33
- RenderTokenJwt,
34
- SetupIntent,
35
- ThemeVariable,
36
- } from "@amos.com/amos-js";
37
- export {
38
- createMessage,
39
- decodeJwt,
40
- formatGooglePayPaymentData,
41
- getEmbedOrigin,
42
- } from "@amos.com/amos-js";
22
+ export * from "@amos.com/amos-js";
43
23
 
44
24
  type IframeRef = RefObject<HTMLIFrameElement | null> | undefined;
45
25