@heliofi/checkout-react 1.3.1 → 1.4.0
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare interface CustomTextsInterface {
|
|
2
2
|
mainButtonTitle?: string;
|
|
3
|
+
payButtonTitle?: string;
|
|
3
4
|
}
|
|
4
5
|
|
|
5
6
|
declare type DisplayType = 'button' | 'inline';
|
|
@@ -21,10 +22,12 @@ declare interface HelioEmbedConfig {
|
|
|
21
22
|
customTexts?: CustomTextsInterface;
|
|
22
23
|
primaryPaymentMethod?: PrimaryPaymentMethod;
|
|
23
24
|
theme?: HelioEmbedTheme;
|
|
25
|
+
stretchFullWidth?: boolean;
|
|
24
26
|
paymentType?: EmbedPaymentType;
|
|
25
27
|
platform?: WidgetPlatform;
|
|
26
28
|
display?: DisplayType;
|
|
27
29
|
amount?: string;
|
|
30
|
+
quantity?: number;
|
|
28
31
|
additionalJSON?: Json;
|
|
29
32
|
onSuccess?: (event: {
|
|
30
33
|
data: unknown;
|
|
@@ -32,6 +35,7 @@ declare interface HelioEmbedConfig {
|
|
|
32
35
|
paymentPK?: string;
|
|
33
36
|
swapTransactionSignature?: string;
|
|
34
37
|
blockchainSymbol?: string;
|
|
38
|
+
redirectUrl?: string;
|
|
35
39
|
}) => void;
|
|
36
40
|
onError?: (event: {
|
|
37
41
|
transaction?: string;
|
|
@@ -50,10 +54,21 @@ declare interface HelioEmbedConfig {
|
|
|
50
54
|
declare interface HelioEmbedTheme {
|
|
51
55
|
themeMode: EmbedThemeMode;
|
|
52
56
|
colors: {
|
|
53
|
-
primaryButtonBackground
|
|
57
|
+
primaryButtonBackground?: string;
|
|
54
58
|
/** @deprecated - for internal use only */
|
|
55
|
-
primaryButtonBackgroundHover
|
|
56
|
-
primaryButtonText
|
|
59
|
+
primaryButtonBackgroundHover?: string;
|
|
60
|
+
primaryButtonText?: string;
|
|
61
|
+
backgroundLoadingModal?: string;
|
|
62
|
+
backgroundPrimary?: string;
|
|
63
|
+
textPriceBanner?: string;
|
|
64
|
+
backgroundContainer?: string;
|
|
65
|
+
backgroundSecondary?: string;
|
|
66
|
+
primaryButtonShadow?: string;
|
|
67
|
+
/** @deprecated - use primaryButtonShadow instead. We should be able to remove this */
|
|
68
|
+
shadowPrimaryGray?: string;
|
|
69
|
+
shadowWalletButton?: string;
|
|
70
|
+
textLabel?: string;
|
|
71
|
+
iconFillColor?: string;
|
|
57
72
|
};
|
|
58
73
|
}
|
|
59
74
|
|
|
@@ -12,14 +12,14 @@ var Q = { exports: {} }, L = {};
|
|
|
12
12
|
var Se;
|
|
13
13
|
function pr() {
|
|
14
14
|
return Se || (Se = 1, process.env.NODE_ENV !== "production" && function() {
|
|
15
|
-
var
|
|
15
|
+
var l = we, d = Symbol.for("react.element"), j = Symbol.for("react.portal"), O = Symbol.for("react.fragment"), b = Symbol.for("react.strict_mode"), P = Symbol.for("react.profiler"), w = Symbol.for("react.provider"), R = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), v = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), m = Symbol.for("react.offscreen"), A = Symbol.iterator, Pe = "@@iterator";
|
|
16
16
|
function ke(e) {
|
|
17
17
|
if (e === null || typeof e != "object")
|
|
18
18
|
return null;
|
|
19
|
-
var r = A && e[A] || e[
|
|
19
|
+
var r = A && e[A] || e[Pe];
|
|
20
20
|
return typeof r == "function" ? r : null;
|
|
21
21
|
}
|
|
22
|
-
var k =
|
|
22
|
+
var k = l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
23
23
|
function p(e) {
|
|
24
24
|
{
|
|
25
25
|
for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
|
|
@@ -40,7 +40,7 @@ function pr() {
|
|
|
40
40
|
var De = !1, Ae = !1, Ie = !1, $e = !1, Le = !1, ee;
|
|
41
41
|
ee = Symbol.for("react.module.reference");
|
|
42
42
|
function We(e) {
|
|
43
|
-
return !!(typeof e == "string" || typeof e == "function" || e ===
|
|
43
|
+
return !!(typeof e == "string" || typeof e == "function" || e === O || e === P || Le || e === b || e === y || e === v || $e || e === m || De || Ae || Ie || typeof e == "object" && e !== null && (e.$$typeof === _ || e.$$typeof === E || e.$$typeof === w || e.$$typeof === R || e.$$typeof === f || // This needs to include all possible module reference object
|
|
44
44
|
// types supported by any Flight configuration anywhere since
|
|
45
45
|
// we don't know which Flight build this will end up being used
|
|
46
46
|
// with.
|
|
@@ -64,11 +64,11 @@ function pr() {
|
|
|
64
64
|
if (typeof e == "string")
|
|
65
65
|
return e;
|
|
66
66
|
switch (e) {
|
|
67
|
-
case
|
|
67
|
+
case O:
|
|
68
68
|
return "Fragment";
|
|
69
|
-
case P:
|
|
70
|
-
return "Portal";
|
|
71
69
|
case j:
|
|
70
|
+
return "Portal";
|
|
71
|
+
case P:
|
|
72
72
|
return "Profiler";
|
|
73
73
|
case b:
|
|
74
74
|
return "StrictMode";
|
|
@@ -82,10 +82,10 @@ function pr() {
|
|
|
82
82
|
case R:
|
|
83
83
|
var r = e;
|
|
84
84
|
return re(r) + ".Consumer";
|
|
85
|
-
case
|
|
85
|
+
case w:
|
|
86
86
|
var t = e;
|
|
87
87
|
return re(t._context) + ".Provider";
|
|
88
|
-
case
|
|
88
|
+
case f:
|
|
89
89
|
return Ye(e, e.render, "ForwardRef");
|
|
90
90
|
case E:
|
|
91
91
|
var n = e.displayName || null;
|
|
@@ -275,7 +275,7 @@ function pr() {
|
|
|
275
275
|
}
|
|
276
276
|
if (typeof e == "object")
|
|
277
277
|
switch (e.$$typeof) {
|
|
278
|
-
case
|
|
278
|
+
case f:
|
|
279
279
|
return Ve(e.render);
|
|
280
280
|
case E:
|
|
281
281
|
return U(e.type, r, t);
|
|
@@ -394,7 +394,7 @@ function pr() {
|
|
|
394
394
|
var rr = function(e, r, t, n, i, u, o) {
|
|
395
395
|
var a = {
|
|
396
396
|
// This tag allows us to uniquely identify this as a React Element
|
|
397
|
-
$$typeof:
|
|
397
|
+
$$typeof: d,
|
|
398
398
|
// Built-in properties that belong on the element
|
|
399
399
|
type: e,
|
|
400
400
|
key: r,
|
|
@@ -449,7 +449,7 @@ function pr() {
|
|
|
449
449
|
var K;
|
|
450
450
|
K = !1;
|
|
451
451
|
function X(e) {
|
|
452
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
452
|
+
return typeof e == "object" && e !== null && e.$$typeof === d;
|
|
453
453
|
}
|
|
454
454
|
function ge() {
|
|
455
455
|
{
|
|
@@ -527,7 +527,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
527
527
|
var t;
|
|
528
528
|
if (typeof r == "function")
|
|
529
529
|
t = r.propTypes;
|
|
530
|
-
else if (typeof r == "object" && (r.$$typeof ===
|
|
530
|
+
else if (typeof r == "object" && (r.$$typeof === f || // Note: Memo only checks outer props here.
|
|
531
531
|
// Inner props are checked in the reconciler.
|
|
532
532
|
r.$$typeof === E))
|
|
533
533
|
t = r.propTypes;
|
|
@@ -565,7 +565,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
565
565
|
var h = nr(i);
|
|
566
566
|
h ? a += h : a += ge();
|
|
567
567
|
var s;
|
|
568
|
-
e === null ? s = "null" : J(e) ? s = "array" : e !== void 0 && e.$$typeof ===
|
|
568
|
+
e === null ? s = "null" : J(e) ? s = "array" : e !== void 0 && e.$$typeof === d ? (s = "<" + (C(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : s = typeof e, p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", s, a);
|
|
569
569
|
}
|
|
570
570
|
var c = tr(e, r, t, i, u);
|
|
571
571
|
if (c == null)
|
|
@@ -583,7 +583,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
583
583
|
else
|
|
584
584
|
ye(g, e);
|
|
585
585
|
}
|
|
586
|
-
return e ===
|
|
586
|
+
return e === O ? ir(c) : or(c), c;
|
|
587
587
|
}
|
|
588
588
|
}
|
|
589
589
|
function ur(e, r, t) {
|
|
@@ -593,7 +593,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
593
593
|
return _e(e, r, t, !1);
|
|
594
594
|
}
|
|
595
595
|
var cr = sr, lr = ur;
|
|
596
|
-
L.Fragment =
|
|
596
|
+
L.Fragment = O, L.jsx = cr, L.jsxs = lr;
|
|
597
597
|
}()), L;
|
|
598
598
|
}
|
|
599
599
|
var W = {};
|
|
@@ -611,47 +611,47 @@ function hr() {
|
|
|
611
611
|
if (Oe)
|
|
612
612
|
return W;
|
|
613
613
|
Oe = 1;
|
|
614
|
-
var
|
|
615
|
-
function
|
|
614
|
+
var l = we, d = Symbol.for("react.element"), j = Symbol.for("react.fragment"), O = Object.prototype.hasOwnProperty, b = l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, P = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
615
|
+
function w(R, f, y) {
|
|
616
616
|
var v, E = {}, _ = null, m = null;
|
|
617
|
-
y !== void 0 && (_ = "" + y),
|
|
618
|
-
for (v in
|
|
619
|
-
|
|
617
|
+
y !== void 0 && (_ = "" + y), f.key !== void 0 && (_ = "" + f.key), f.ref !== void 0 && (m = f.ref);
|
|
618
|
+
for (v in f)
|
|
619
|
+
O.call(f, v) && !P.hasOwnProperty(v) && (E[v] = f[v]);
|
|
620
620
|
if (R && R.defaultProps)
|
|
621
|
-
for (v in
|
|
622
|
-
E[v] === void 0 && (E[v] =
|
|
623
|
-
return { $$typeof:
|
|
621
|
+
for (v in f = R.defaultProps, f)
|
|
622
|
+
E[v] === void 0 && (E[v] = f[v]);
|
|
623
|
+
return { $$typeof: d, type: R, key: _, ref: m, props: E, _owner: b.current };
|
|
624
624
|
}
|
|
625
|
-
return W.Fragment =
|
|
625
|
+
return W.Fragment = j, W.jsx = w, W.jsxs = w, W;
|
|
626
626
|
}
|
|
627
627
|
process.env.NODE_ENV === "production" ? Q.exports = hr() : Q.exports = pr();
|
|
628
|
-
var
|
|
629
|
-
const xe = ({ children:
|
|
628
|
+
var S = Q.exports;
|
|
629
|
+
const xe = ({ children: l }) => /* @__PURE__ */ S.jsxs("div", { children: [
|
|
630
630
|
"Error loading Helio Checkout for React",
|
|
631
|
-
|
|
631
|
+
l ? `: ${l}` : ""
|
|
632
632
|
] });
|
|
633
633
|
class Er extends fr {
|
|
634
|
-
constructor(
|
|
635
|
-
super(
|
|
634
|
+
constructor(d) {
|
|
635
|
+
super(d), this.state = { hasError: !1 };
|
|
636
636
|
}
|
|
637
637
|
static getDerivedStateFromError() {
|
|
638
638
|
return { hasError: !0 };
|
|
639
639
|
}
|
|
640
640
|
render() {
|
|
641
|
-
return this.state.hasError ? /* @__PURE__ */
|
|
641
|
+
return this.state.hasError ? /* @__PURE__ */ S.jsx(xe, {}) : this.props.children;
|
|
642
642
|
}
|
|
643
643
|
}
|
|
644
|
-
const mr = () => /* @__PURE__ */
|
|
645
|
-
const
|
|
646
|
-
return
|
|
647
|
-
}, Rr = ({ config:
|
|
648
|
-
const
|
|
649
|
-
return Te(() =>
|
|
650
|
-
let
|
|
644
|
+
const mr = "https://embed.hel.io/assets/index-v1.js", je = "helio-checkout-react-v1", gr = () => /* @__PURE__ */ S.jsx("div", { children: "Loading Helio Checkout..." }), br = (l = mr) => {
|
|
645
|
+
const d = document.createElement("script");
|
|
646
|
+
return d.setAttribute("type", "module"), d.setAttribute("id", je), d.setAttribute("src", l), document.body.appendChild(d), d;
|
|
647
|
+
}, Rr = ({ config: l }) => {
|
|
648
|
+
const d = dr(null), [j, O] = Z(!1), [b, P] = Z(), [w, R] = Z("");
|
|
649
|
+
return Te(() => O(!0), []), Te(() => {
|
|
650
|
+
let f = !1;
|
|
651
651
|
if (b)
|
|
652
652
|
return;
|
|
653
653
|
const y = () => {
|
|
654
|
-
if (
|
|
654
|
+
if (f)
|
|
655
655
|
return;
|
|
656
656
|
const m = window.helioCheckout;
|
|
657
657
|
if (!m) {
|
|
@@ -660,31 +660,31 @@ const mr = () => /* @__PURE__ */ w.jsx("div", { children: "Loading Helio Checkou
|
|
|
660
660
|
);
|
|
661
661
|
return;
|
|
662
662
|
}
|
|
663
|
-
|
|
663
|
+
P(() => m);
|
|
664
664
|
}, v = (m) => {
|
|
665
665
|
const A = () => R("Error loading script tag");
|
|
666
666
|
return m.addEventListener("load", y), m.addEventListener("error", A), () => {
|
|
667
|
-
|
|
667
|
+
f = !0, m.removeEventListener("load", y), m.removeEventListener("error", A);
|
|
668
668
|
};
|
|
669
669
|
}, E = document.querySelector(
|
|
670
|
-
`script#${
|
|
670
|
+
`script#${je}`
|
|
671
671
|
);
|
|
672
672
|
if (E) {
|
|
673
673
|
window.helioCheckout ? y() : v(E);
|
|
674
674
|
return;
|
|
675
675
|
}
|
|
676
|
-
const _ = br(
|
|
676
|
+
const _ = br(l.embedScriptSource);
|
|
677
677
|
return v(_);
|
|
678
|
-
}, [b,
|
|
679
|
-
if (!(!b || !
|
|
680
|
-
if (!
|
|
678
|
+
}, [b, l.embedScriptSource]), vr(() => {
|
|
679
|
+
if (!(!b || !j)) {
|
|
680
|
+
if (!d.current) {
|
|
681
681
|
R("Missing element to mount Helio checkout");
|
|
682
682
|
return;
|
|
683
683
|
}
|
|
684
|
-
b(
|
|
684
|
+
b(d.current, l);
|
|
685
685
|
}
|
|
686
|
-
}, [b,
|
|
687
|
-
},
|
|
686
|
+
}, [b, j, l]), w ? /* @__PURE__ */ S.jsx(xe, { children: w }) : b ? /* @__PURE__ */ S.jsx("div", { ref: d }) : /* @__PURE__ */ S.jsx(gr, {});
|
|
687
|
+
}, yr = (l) => /* @__PURE__ */ S.jsx(Er, { children: /* @__PURE__ */ S.jsx(Rr, { config: l.config }) }), Cr = (l) => /* @__PURE__ */ S.jsx(yr, { config: l.config });
|
|
688
688
|
export {
|
|
689
|
-
|
|
689
|
+
Cr as HelioCheckout
|
|
690
690
|
};
|
|
@@ -6,17 +6,17 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var re;function je(){return re||(re=1,process.env.NODE_ENV!=="production"&&function(){var
|
|
10
|
-
`+z+e}}var K=!1,V;{var
|
|
9
|
+
*/var re;function je(){return re||(re=1,process.env.NODE_ENV!=="production"&&function(){var f=E,d=Symbol.for("react.element"),k=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),F=Symbol.for("react.profiler"),x=Symbol.for("react.provider"),R=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen"),Y=Symbol.iterator,Ye="@@iterator";function Me(e){if(e===null||typeof e!="object")return null;var r=Y&&e[Y]||e[Ye];return typeof r=="function"?r:null}var D=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function p(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];Ue("error",e,t)}}function Ue(e,r,t){{var n=D.ReactDebugCurrentFrame,i=n.getStackAddendum();i!==""&&(r+="%s",t=t.concat([i]));var u=t.map(function(o){return String(o)});u.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,u)}}var Ne=!1,Ve=!1,Be=!1,He=!1,$e=!1,oe;oe=Symbol.for("react.module.reference");function Je(e){return!!(typeof e=="string"||typeof e=="function"||e===w||e===F||$e||e===y||e===_||e===v||He||e===g||Ne||Ve||Be||typeof e=="object"&&e!==null&&(e.$$typeof===S||e.$$typeof===m||e.$$typeof===x||e.$$typeof===R||e.$$typeof===l||e.$$typeof===oe||e.getModuleId!==void 0))}function Ge(e,r,t){var n=e.displayName;if(n)return n;var i=r.displayName||r.name||"";return i!==""?t+"("+i+")":t}function ie(e){return e.displayName||"Context"}function T(e){if(e==null)return null;if(typeof e.tag=="number"&&p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case w:return"Fragment";case k:return"Portal";case F:return"Profiler";case y:return"StrictMode";case _:return"Suspense";case v:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case R:var r=e;return ie(r)+".Consumer";case x:var t=e;return ie(t._context)+".Provider";case l:return Ge(e,e.render,"ForwardRef");case m:var n=e.displayName||null;return n!==null?n:T(e.type)||"Memo";case S:{var i=e,u=i._payload,o=i._init;try{return T(o(u))}catch{return null}}}return null}var P=Object.assign,M=0,ue,se,ce,fe,le,de,ve;function pe(){}pe.__reactDisabledLog=!0;function ze(){{if(M===0){ue=console.log,se=console.info,ce=console.warn,fe=console.error,le=console.group,de=console.groupCollapsed,ve=console.groupEnd;var e={configurable:!0,enumerable:!0,value:pe,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}M++}}function Ke(){{if(M--,M===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:P({},e,{value:ue}),info:P({},e,{value:se}),warn:P({},e,{value:ce}),error:P({},e,{value:fe}),group:P({},e,{value:le}),groupCollapsed:P({},e,{value:de}),groupEnd:P({},e,{value:ve})})}M<0&&p("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var G=D.ReactCurrentDispatcher,z;function N(e,r,t){{if(z===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);z=n&&n[1]||""}return`
|
|
10
|
+
`+z+e}}var K=!1,V;{var Xe=typeof WeakMap=="function"?WeakMap:Map;V=new Xe}function he(e,r){if(!e||K)return"";{var t=V.get(e);if(t!==void 0)return t}var n;K=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var u;u=G.current,G.current=null,ze();try{if(r){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(O){n=O}Reflect.construct(e,[],o)}else{try{o.call()}catch(O){n=O}e.call(o.prototype)}}else{try{throw Error()}catch(O){n=O}e()}}catch(O){if(O&&n&&typeof O.stack=="string"){for(var a=O.stack.split(`
|
|
11
11
|
`),h=n.stack.split(`
|
|
12
12
|
`),s=a.length-1,c=h.length-1;s>=1&&c>=0&&a[s]!==h[c];)c--;for(;s>=1&&c>=0;s--,c--)if(a[s]!==h[c]){if(s!==1||c!==1)do if(s--,c--,c<0||a[s]!==h[c]){var b=`
|
|
13
|
-
`+a[s].replace(" at new "," at ");return e.displayName&&b.includes("<anonymous>")&&(b=b.replace("<anonymous>",e.displayName)),typeof e=="function"&&V.set(e,b),b}while(s>=1&&c>=0);break}}}finally{K=!1,G.current=u,
|
|
13
|
+
`+a[s].replace(" at new "," at ");return e.displayName&&b.includes("<anonymous>")&&(b=b.replace("<anonymous>",e.displayName)),typeof e=="function"&&V.set(e,b),b}while(s>=1&&c>=0);break}}}finally{K=!1,G.current=u,Ke(),Error.prepareStackTrace=i}var I=e?e.displayName||e.name:"",xe=I?N(I):"";return typeof e=="function"&&V.set(e,xe),xe}function Ze(e,r,t){return he(e,!1)}function qe(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function B(e,r,t){if(e==null)return"";if(typeof e=="function")return he(e,qe(e));if(typeof e=="string")return N(e);switch(e){case _:return N("Suspense");case v:return N("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case l:return Ze(e.render);case m:return B(e.type,r,t);case S:{var n=e,i=n._payload,u=n._init;try{return B(u(i),r,t)}catch{}}}return""}var H=Object.prototype.hasOwnProperty,Ee={},me=D.ReactDebugCurrentFrame;function $(e){if(e){var r=e._owner,t=B(e.type,e._source,r?r.type:null);me.setExtraStackFrame(t)}else me.setExtraStackFrame(null)}function Qe(e,r,t,n,i){{var u=Function.call.bind(H);for(var o in e)if(u(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var h=Error((n||"React class")+": "+t+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}a=e[o](r,o,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(s){a=s}a&&!(a instanceof Error)&&($(i),p("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,o,typeof a),$(null)),a instanceof Error&&!(a.message in Ee)&&(Ee[a.message]=!0,$(i),p("Failed %s type: %s",t,a.message),$(null))}}}var er=Array.isArray;function X(e){return er(e)}function rr(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function tr(e){try{return ge(e),!1}catch{return!0}}function ge(e){return""+e}function be(e){if(tr(e))return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",rr(e)),ge(e)}var U=D.ReactCurrentOwner,nr={key:!0,ref:!0,__self:!0,__source:!0},ye,Re,Z;Z={};function ar(e){if(H.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function or(e){if(H.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function ir(e,r){if(typeof e.ref=="string"&&U.current&&r&&U.current.stateNode!==r){var t=T(U.current.type);Z[t]||(p('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',T(U.current.type),e.ref),Z[t]=!0)}}function ur(e,r){{var t=function(){ye||(ye=!0,p("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function sr(e,r){{var t=function(){Re||(Re=!0,p("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var cr=function(e,r,t,n,i,u,o){var a={$$typeof:d,type:e,key:r,ref:t,props:o,_owner:u};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function fr(e,r,t,n,i){{var u,o={},a=null,h=null;t!==void 0&&(be(t),a=""+t),or(r)&&(be(r.key),a=""+r.key),ar(r)&&(h=r.ref,ir(r,i));for(u in r)H.call(r,u)&&!nr.hasOwnProperty(u)&&(o[u]=r[u]);if(e&&e.defaultProps){var s=e.defaultProps;for(u in s)o[u]===void 0&&(o[u]=s[u])}if(a||h){var c=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&ur(o,c),h&&sr(o,c)}return cr(e,a,h,i,n,U.current,o)}}var q=D.ReactCurrentOwner,_e=D.ReactDebugCurrentFrame;function A(e){if(e){var r=e._owner,t=B(e.type,e._source,r?r.type:null);_e.setExtraStackFrame(t)}else _e.setExtraStackFrame(null)}var Q;Q=!1;function ee(e){return typeof e=="object"&&e!==null&&e.$$typeof===d}function Ce(){{if(q.current){var e=T(q.current.type);if(e)return`
|
|
14
14
|
|
|
15
|
-
Check the render method of \``+e+"`."}return""}}function
|
|
15
|
+
Check the render method of \``+e+"`."}return""}}function lr(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return`
|
|
16
16
|
|
|
17
|
-
Check your code at `+r+":"+t+"."}return""}}var
|
|
17
|
+
Check your code at `+r+":"+t+"."}return""}}var Se={};function dr(e){{var r=Ce();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
|
18
18
|
|
|
19
|
-
Check the top-level render call using <`+t+">.")}return r}}function
|
|
19
|
+
Check the top-level render call using <`+t+">.")}return r}}function Te(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=dr(r);if(Se[t])return;Se[t]=!0;var n="";e&&e._owner&&e._owner!==q.current&&(n=" It was passed a child from "+T(e._owner.type)+"."),A(e),p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),A(null)}}function Oe(e,r){{if(typeof e!="object")return;if(X(e))for(var t=0;t<e.length;t++){var n=e[t];ee(n)&&Te(n,r)}else if(ee(e))e._store&&(e._store.validated=!0);else if(e){var i=Me(e);if(typeof i=="function"&&i!==e.entries)for(var u=i.call(e),o;!(o=u.next()).done;)ee(o.value)&&Te(o.value,r)}}}function vr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===l||r.$$typeof===m))t=r.propTypes;else return;if(t){var n=T(r);Qe(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!Q){Q=!0;var i=T(r);p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",i||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function pr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){A(e),p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),A(null);break}}e.ref!==null&&(A(e),p("Invalid attribute `ref` supplied to `React.Fragment`."),A(null))}}function we(e,r,t,n,i,u){{var o=Je(e);if(!o){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var h=lr(i);h?a+=h:a+=Ce();var s;e===null?s="null":X(e)?s="array":e!==void 0&&e.$$typeof===d?(s="<"+(T(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):s=typeof e,p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",s,a)}var c=fr(e,r,t,i,u);if(c==null)return c;if(o){var b=r.children;if(b!==void 0)if(n)if(X(b)){for(var I=0;I<b.length;I++)Oe(b[I],e);Object.freeze&&Object.freeze(b)}else p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Oe(b,e)}return e===w?pr(c):vr(c),c}}function hr(e,r,t){return we(e,r,t,!0)}function Er(e,r,t){return we(e,r,t,!1)}var mr=Er,gr=hr;L.Fragment=w,L.jsx=mr,L.jsxs=gr}()),L}var W={};/**
|
|
20
20
|
* @license React
|
|
21
21
|
* react-jsx-runtime.production.min.js
|
|
22
22
|
*
|
|
@@ -24,4 +24,4 @@ Check the top-level render call using <`+t+">.")}return r}}function Ce(e,r){{if(
|
|
|
24
24
|
*
|
|
25
25
|
* This source code is licensed under the MIT license found in the
|
|
26
26
|
* LICENSE file in the root directory of this source tree.
|
|
27
|
-
*/var te;function Pe(){if(te)return W;te=1;var
|
|
27
|
+
*/var te;function Pe(){if(te)return W;te=1;var f=E,d=Symbol.for("react.element"),k=Symbol.for("react.fragment"),w=Object.prototype.hasOwnProperty,y=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,F={key:!0,ref:!0,__self:!0,__source:!0};function x(R,l,_){var v,m={},S=null,g=null;_!==void 0&&(S=""+_),l.key!==void 0&&(S=""+l.key),l.ref!==void 0&&(g=l.ref);for(v in l)w.call(l,v)&&!F.hasOwnProperty(v)&&(m[v]=l[v]);if(R&&R.defaultProps)for(v in l=R.defaultProps,l)m[v]===void 0&&(m[v]=l[v]);return{$$typeof:d,type:R,key:S,ref:g,props:m,_owner:y.current}}return W.Fragment=k,W.jsx=x,W.jsxs=x,W}process.env.NODE_ENV==="production"?J.exports=Pe():J.exports=je();var C=J.exports;const ne=({children:f})=>C.jsxs("div",{children:["Error loading Helio Checkout for React",f?`: ${f}`:""]});class ke extends E.Component{constructor(d){super(d),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?C.jsx(ne,{}):this.props.children}}const Fe="https://embed.hel.io/assets/index-v1.js",ae="helio-checkout-react-v1",De=()=>C.jsx("div",{children:"Loading Helio Checkout..."}),Ae=(f=Fe)=>{const d=document.createElement("script");return d.setAttribute("type","module"),d.setAttribute("id",ae),d.setAttribute("src",f),document.body.appendChild(d),d},Ie=({config:f})=>{const d=E.useRef(null),[k,w]=E.useState(!1),[y,F]=E.useState(),[x,R]=E.useState("");return E.useEffect(()=>w(!0),[]),E.useEffect(()=>{let l=!1;if(y)return;const _=()=>{if(l)return;const g=window.helioCheckout;if(!g){R("Unable to load helio checkout - missing init function on window.helioCheckout");return}F(()=>g)},v=g=>{const Y=()=>R("Error loading script tag");return g.addEventListener("load",_),g.addEventListener("error",Y),()=>{l=!0,g.removeEventListener("load",_),g.removeEventListener("error",Y)}},m=document.querySelector(`script#${ae}`);if(m){window.helioCheckout?_():v(m);return}const S=Ae(f.embedScriptSource);return v(S)},[y,f.embedScriptSource]),E.useLayoutEffect(()=>{if(!(!y||!k)){if(!d.current){R("Missing element to mount Helio checkout");return}y(d.current,f)}},[y,k,f]),x?C.jsx(ne,{children:x}):y?C.jsx("div",{ref:d}):C.jsx(De,{})},Le=f=>C.jsx(ke,{children:C.jsx(Ie,{config:f.config})}),We=f=>C.jsx(Le,{config:f.config});j.HelioCheckout=We,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heliofi/checkout-react",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
8
8
|
"build": "tsc && vite build",
|
|
9
9
|
"build:vercel": "tsc && vite build --config vite-vercel.config.ts",
|
|
10
10
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
11
|
+
"lint:strict": "yarn lint",
|
|
11
12
|
"lint:fix": "yarn lint --fix",
|
|
12
13
|
"format": "prettier -w .",
|
|
13
14
|
"format:check": "prettier -c .",
|