@customerglu/react-web-sdk
Version:
This React Component allows developers to integrate with CustomerGlu Gamification Platform easily
1,348 lines (1,345 loc) • 46.6 kB
JavaScript
import pr, { useState as rr, useEffect as Wr } from "react";
function Lr(o) {
return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
}
var We = { exports: {} }, he = {};
/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var tr;
function qr() {
if (tr)
return he;
tr = 1;
var o = pr, j = Symbol.for("react.element"), S = Symbol.for("react.fragment"), u = Object.prototype.hasOwnProperty, E = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, l = { key: !0, ref: !0, __self: !0, __source: !0 };
function O(d, p, P) {
var c, g = {}, $ = null, F = null;
P !== void 0 && ($ = "" + P), p.key !== void 0 && ($ = "" + p.key), p.ref !== void 0 && (F = p.ref);
for (c in p)
u.call(p, c) && !l.hasOwnProperty(c) && (g[c] = p[c]);
if (d && d.defaultProps)
for (c in p = d.defaultProps, p)
g[c] === void 0 && (g[c] = p[c]);
return { $$typeof: j, type: d, key: $, ref: F, props: g, _owner: E.current };
}
return he.Fragment = S, he.jsx = O, he.jsxs = O, he;
}
var Ee = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var nr;
function Ur() {
return nr || (nr = 1, process.env.NODE_ENV !== "production" && function() {
var o = pr, j = Symbol.for("react.element"), S = Symbol.for("react.portal"), u = Symbol.for("react.fragment"), E = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"), O = Symbol.for("react.provider"), d = Symbol.for("react.context"), p = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), c = Symbol.for("react.suspense_list"), g = Symbol.for("react.memo"), $ = Symbol.for("react.lazy"), F = Symbol.for("react.offscreen"), N = Symbol.iterator, M = "@@iterator";
function V(e) {
if (e === null || typeof e != "object")
return null;
var r = N && e[N] || e[M];
return typeof r == "function" ? r : null;
}
var U = o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
function Y(e) {
{
for (var r = arguments.length, a = new Array(r > 1 ? r - 1 : 0), f = 1; f < r; f++)
a[f - 1] = arguments[f];
z("error", e, a);
}
}
function z(e, r, a) {
{
var f = U.ReactDebugCurrentFrame, A = f.getStackAddendum();
A !== "" && (r += "%s", a = a.concat([A]));
var D = a.map(function(w) {
return String(w);
});
D.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, D);
}
}
var L = !1, i = !1, re = !1, ve = !1, pe = !1, ie;
ie = Symbol.for("react.module.reference");
function ye(e) {
return !!(typeof e == "string" || typeof e == "function" || e === u || e === l || pe || e === E || e === P || e === c || ve || e === F || L || i || re || typeof e == "object" && e !== null && (e.$$typeof === $ || e.$$typeof === g || e.$$typeof === O || e.$$typeof === d || e.$$typeof === p || // This needs to include all possible module reference object
// types supported by any Flight configuration anywhere since
// we don't know which Flight build this will end up being used
// with.
e.$$typeof === ie || e.getModuleId !== void 0));
}
function se(e, r, a) {
var f = e.displayName;
if (f)
return f;
var A = r.displayName || r.name || "";
return A !== "" ? a + "(" + A + ")" : a;
}
function ue(e) {
return e.displayName || "Context";
}
function J(e) {
if (e == null)
return null;
if (typeof e.tag == "number" && Y("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 u:
return "Fragment";
case S:
return "Portal";
case l:
return "Profiler";
case E:
return "StrictMode";
case P:
return "Suspense";
case c:
return "SuspenseList";
}
if (typeof e == "object")
switch (e.$$typeof) {
case d:
var r = e;
return ue(r) + ".Consumer";
case O:
var a = e;
return ue(a._context) + ".Provider";
case p:
return se(e, e.render, "ForwardRef");
case g:
var f = e.displayName || null;
return f !== null ? f : J(e.type) || "Memo";
case $: {
var A = e, D = A._payload, w = A._init;
try {
return J(w(D));
} catch {
return null;
}
}
}
return null;
}
var K = Object.assign, te = 0, H, ee, ne, ce, t, s, h;
function b() {
}
b.__reactDisabledLog = !0;
function v() {
{
if (te === 0) {
H = console.log, ee = console.info, ne = console.warn, ce = console.error, t = console.group, s = console.groupCollapsed, h = console.groupEnd;
var e = {
configurable: !0,
enumerable: !0,
value: b,
writable: !0
};
Object.defineProperties(console, {
info: e,
log: e,
warn: e,
error: e,
group: e,
groupCollapsed: e,
groupEnd: e
});
}
te++;
}
}
function C() {
{
if (te--, te === 0) {
var e = {
configurable: !0,
enumerable: !0,
writable: !0
};
Object.defineProperties(console, {
log: K({}, e, {
value: H
}),
info: K({}, e, {
value: ee
}),
warn: K({}, e, {
value: ne
}),
error: K({}, e, {
value: ce
}),
group: K({}, e, {
value: t
}),
groupCollapsed: K({}, e, {
value: s
}),
groupEnd: K({}, e, {
value: h
})
});
}
te < 0 && Y("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
}
}
var y = U.ReactCurrentDispatcher, m;
function T(e, r, a) {
{
if (m === void 0)
try {
throw Error();
} catch (A) {
var f = A.stack.trim().match(/\n( *(at )?)/);
m = f && f[1] || "";
}
return `
` + m + e;
}
}
var x = !1, _;
{
var B = typeof WeakMap == "function" ? WeakMap : Map;
_ = new B();
}
function n(e, r) {
if (!e || x)
return "";
{
var a = _.get(e);
if (a !== void 0)
return a;
}
var f;
x = !0;
var A = Error.prepareStackTrace;
Error.prepareStackTrace = void 0;
var D;
D = y.current, y.current = null, v();
try {
if (r) {
var w = function() {
throw Error();
};
if (Object.defineProperty(w.prototype, "props", {
set: function() {
throw Error();
}
}), typeof Reflect == "object" && Reflect.construct) {
try {
Reflect.construct(w, []);
} catch (X) {
f = X;
}
Reflect.construct(e, [], w);
} else {
try {
w.call();
} catch (X) {
f = X;
}
e.call(w.prototype);
}
} else {
try {
throw Error();
} catch (X) {
f = X;
}
e();
}
} catch (X) {
if (X && f && typeof X.stack == "string") {
for (var R = X.stack.split(`
`), G = f.stack.split(`
`), W = R.length - 1, q = G.length - 1; W >= 1 && q >= 0 && R[W] !== G[q]; )
q--;
for (; W >= 1 && q >= 0; W--, q--)
if (R[W] !== G[q]) {
if (W !== 1 || q !== 1)
do
if (W--, q--, q < 0 || R[W] !== G[q]) {
var Q = `
` + R[W].replace(" at new ", " at ");
return e.displayName && Q.includes("<anonymous>") && (Q = Q.replace("<anonymous>", e.displayName)), typeof e == "function" && _.set(e, Q), Q;
}
while (W >= 1 && q >= 0);
break;
}
}
} finally {
x = !1, y.current = D, C(), Error.prepareStackTrace = A;
}
var de = e ? e.displayName || e.name : "", oe = de ? T(de) : "";
return typeof e == "function" && _.set(e, oe), oe;
}
function Z(e, r, a) {
return n(e, !1);
}
function fe(e) {
var r = e.prototype;
return !!(r && r.isReactComponent);
}
function ae(e, r, a) {
if (e == null)
return "";
if (typeof e == "function")
return n(e, fe(e));
if (typeof e == "string")
return T(e);
switch (e) {
case P:
return T("Suspense");
case c:
return T("SuspenseList");
}
if (typeof e == "object")
switch (e.$$typeof) {
case p:
return Z(e.render);
case g:
return ae(e.type, r, a);
case $: {
var f = e, A = f._payload, D = f._init;
try {
return ae(D(A), r, a);
} catch {
}
}
}
return "";
}
var me = Object.prototype.hasOwnProperty, Ue = {}, ze = U.ReactDebugCurrentFrame;
function Te(e) {
if (e) {
var r = e._owner, a = ae(e.type, e._source, r ? r.type : null);
ze.setExtraStackFrame(a);
} else
ze.setExtraStackFrame(null);
}
function br(e, r, a, f, A) {
{
var D = Function.call.bind(me);
for (var w in e)
if (D(e, w)) {
var R = void 0;
try {
if (typeof e[w] != "function") {
var G = Error((f || "React class") + ": " + a + " type `" + w + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[w] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
throw G.name = "Invariant Violation", G;
}
R = e[w](r, w, f, a, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
} catch (W) {
R = W;
}
R && !(R instanceof Error) && (Te(A), Y("%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).", f || "React class", a, w, typeof R), Te(null)), R instanceof Error && !(R.message in Ue) && (Ue[R.message] = !0, Te(A), Y("Failed %s type: %s", a, R.message), Te(null));
}
}
}
var hr = Array.isArray;
function Oe(e) {
return hr(e);
}
function Er(e) {
{
var r = typeof Symbol == "function" && Symbol.toStringTag, a = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
return a;
}
}
function gr(e) {
try {
return Ve(e), !1;
} catch {
return !0;
}
}
function Ve(e) {
return "" + e;
}
function Ne(e) {
if (gr(e))
return Y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Er(e)), Ve(e);
}
var be = U.ReactCurrentOwner, Tr = {
key: !0,
ref: !0,
__self: !0,
__source: !0
}, Be, Ge, Pe;
Pe = {};
function _r(e) {
if (me.call(e, "ref")) {
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
if (r && r.isReactWarning)
return !1;
}
return e.ref !== void 0;
}
function Rr(e) {
if (me.call(e, "key")) {
var r = Object.getOwnPropertyDescriptor(e, "key").get;
if (r && r.isReactWarning)
return !1;
}
return e.key !== void 0;
}
function Sr(e, r) {
if (typeof e.ref == "string" && be.current && r && be.current.stateNode !== r) {
var a = J(be.current.type);
Pe[a] || (Y('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', J(be.current.type), e.ref), Pe[a] = !0);
}
}
function Or(e, r) {
{
var a = function() {
Be || (Be = !0, Y("%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));
};
a.isReactWarning = !0, Object.defineProperty(e, "key", {
get: a,
configurable: !0
});
}
}
function Pr(e, r) {
{
var a = function() {
Ge || (Ge = !0, Y("%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));
};
a.isReactWarning = !0, Object.defineProperty(e, "ref", {
get: a,
configurable: !0
});
}
}
var Cr = function(e, r, a, f, A, D, w) {
var R = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: j,
// Built-in properties that belong on the element
type: e,
key: r,
ref: a,
props: w,
// Record the component responsible for creating this element.
_owner: D
};
return R._store = {}, Object.defineProperty(R._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: !1
}), Object.defineProperty(R, "_self", {
configurable: !1,
enumerable: !1,
writable: !1,
value: f
}), Object.defineProperty(R, "_source", {
configurable: !1,
enumerable: !1,
writable: !1,
value: A
}), Object.freeze && (Object.freeze(R.props), Object.freeze(R)), R;
};
function wr(e, r, a, f, A) {
{
var D, w = {}, R = null, G = null;
a !== void 0 && (Ne(a), R = "" + a), Rr(r) && (Ne(r.key), R = "" + r.key), _r(r) && (G = r.ref, Sr(r, A));
for (D in r)
me.call(r, D) && !Tr.hasOwnProperty(D) && (w[D] = r[D]);
if (e && e.defaultProps) {
var W = e.defaultProps;
for (D in W)
w[D] === void 0 && (w[D] = W[D]);
}
if (R || G) {
var q = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
R && Or(w, q), G && Pr(w, q);
}
return Cr(e, R, G, A, f, be.current, w);
}
}
var Ce = U.ReactCurrentOwner, Je = U.ReactDebugCurrentFrame;
function le(e) {
if (e) {
var r = e._owner, a = ae(e.type, e._source, r ? r.type : null);
Je.setExtraStackFrame(a);
} else
Je.setExtraStackFrame(null);
}
var we;
we = !1;
function xe(e) {
return typeof e == "object" && e !== null && e.$$typeof === j;
}
function Ke() {
{
if (Ce.current) {
var e = J(Ce.current.type);
if (e)
return `
Check the render method of \`` + e + "`.";
}
return "";
}
}
function xr(e) {
return "";
}
var Xe = {};
function jr(e) {
{
var r = Ke();
if (!r) {
var a = typeof e == "string" ? e : e.displayName || e.name;
a && (r = `
Check the top-level render call using <` + a + ">.");
}
return r;
}
}
function He(e, r) {
{
if (!e._store || e._store.validated || e.key != null)
return;
e._store.validated = !0;
var a = jr(r);
if (Xe[a])
return;
Xe[a] = !0;
var f = "";
e && e._owner && e._owner !== Ce.current && (f = " It was passed a child from " + J(e._owner.type) + "."), le(e), Y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', a, f), le(null);
}
}
function Ze(e, r) {
{
if (typeof e != "object")
return;
if (Oe(e))
for (var a = 0; a < e.length; a++) {
var f = e[a];
xe(f) && He(f, r);
}
else if (xe(e))
e._store && (e._store.validated = !0);
else if (e) {
var A = V(e);
if (typeof A == "function" && A !== e.entries)
for (var D = A.call(e), w; !(w = D.next()).done; )
xe(w.value) && He(w.value, r);
}
}
}
function Ar(e) {
{
var r = e.type;
if (r == null || typeof r == "string")
return;
var a;
if (typeof r == "function")
a = r.propTypes;
else if (typeof r == "object" && (r.$$typeof === p || // Note: Memo only checks outer props here.
// Inner props are checked in the reconciler.
r.$$typeof === g))
a = r.propTypes;
else
return;
if (a) {
var f = J(r);
br(a, e.props, "prop", f, e);
} else if (r.PropTypes !== void 0 && !we) {
we = !0;
var A = J(r);
Y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", A || "Unknown");
}
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && Y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
}
}
function kr(e) {
{
for (var r = Object.keys(e.props), a = 0; a < r.length; a++) {
var f = r[a];
if (f !== "children" && f !== "key") {
le(e), Y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", f), le(null);
break;
}
}
e.ref !== null && (le(e), Y("Invalid attribute `ref` supplied to `React.Fragment`."), le(null));
}
}
var Qe = {};
function er(e, r, a, f, A, D) {
{
var w = ye(e);
if (!w) {
var R = "";
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (R += " 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 G = xr();
G ? R += G : R += Ke();
var W;
e === null ? W = "null" : Oe(e) ? W = "array" : e !== void 0 && e.$$typeof === j ? (W = "<" + (J(e.type) || "Unknown") + " />", R = " Did you accidentally export a JSX literal instead of a component?") : W = typeof e, Y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", W, R);
}
var q = wr(e, r, a, A, D);
if (q == null)
return q;
if (w) {
var Q = r.children;
if (Q !== void 0)
if (f)
if (Oe(Q)) {
for (var de = 0; de < Q.length; de++)
Ze(Q[de], e);
Object.freeze && Object.freeze(Q);
} else
Y("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
Ze(Q, e);
}
if (me.call(r, "key")) {
var oe = J(e), X = Object.keys(r).filter(function(Yr) {
return Yr !== "key";
}), je = X.length > 0 ? "{key: someKey, " + X.join(": ..., ") + ": ...}" : "{key: someKey}";
if (!Qe[oe + je]) {
var Fr = X.length > 0 ? "{" + X.join(": ..., ") + ": ...}" : "{}";
Y(`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`, je, oe, Fr, oe), Qe[oe + je] = !0;
}
}
return e === u ? kr(q) : Ar(q), q;
}
}
function Ir(e, r, a) {
return er(e, r, a, !0);
}
function $r(e, r, a) {
return er(e, r, a, !1);
}
var Dr = $r, Mr = Ir;
Ee.Fragment = u, Ee.jsx = Dr, Ee.jsxs = Mr;
}()), Ee;
}
process.env.NODE_ENV === "production" ? We.exports = qr() : We.exports = Ur();
var _e = We.exports, Le = { exports: {} }, Re = { exports: {} }, k = {};
/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ar;
function zr() {
if (ar)
return k;
ar = 1;
var o = typeof Symbol == "function" && Symbol.for, j = o ? Symbol.for("react.element") : 60103, S = o ? Symbol.for("react.portal") : 60106, u = o ? Symbol.for("react.fragment") : 60107, E = o ? Symbol.for("react.strict_mode") : 60108, l = o ? Symbol.for("react.profiler") : 60114, O = o ? Symbol.for("react.provider") : 60109, d = o ? Symbol.for("react.context") : 60110, p = o ? Symbol.for("react.async_mode") : 60111, P = o ? Symbol.for("react.concurrent_mode") : 60111, c = o ? Symbol.for("react.forward_ref") : 60112, g = o ? Symbol.for("react.suspense") : 60113, $ = o ? Symbol.for("react.suspense_list") : 60120, F = o ? Symbol.for("react.memo") : 60115, N = o ? Symbol.for("react.lazy") : 60116, M = o ? Symbol.for("react.block") : 60121, V = o ? Symbol.for("react.fundamental") : 60117, U = o ? Symbol.for("react.responder") : 60118, Y = o ? Symbol.for("react.scope") : 60119;
function z(i) {
if (typeof i == "object" && i !== null) {
var re = i.$$typeof;
switch (re) {
case j:
switch (i = i.type, i) {
case p:
case P:
case u:
case l:
case E:
case g:
return i;
default:
switch (i = i && i.$$typeof, i) {
case d:
case c:
case N:
case F:
case O:
return i;
default:
return re;
}
}
case S:
return re;
}
}
}
function L(i) {
return z(i) === P;
}
return k.AsyncMode = p, k.ConcurrentMode = P, k.ContextConsumer = d, k.ContextProvider = O, k.Element = j, k.ForwardRef = c, k.Fragment = u, k.Lazy = N, k.Memo = F, k.Portal = S, k.Profiler = l, k.StrictMode = E, k.Suspense = g, k.isAsyncMode = function(i) {
return L(i) || z(i) === p;
}, k.isConcurrentMode = L, k.isContextConsumer = function(i) {
return z(i) === d;
}, k.isContextProvider = function(i) {
return z(i) === O;
}, k.isElement = function(i) {
return typeof i == "object" && i !== null && i.$$typeof === j;
}, k.isForwardRef = function(i) {
return z(i) === c;
}, k.isFragment = function(i) {
return z(i) === u;
}, k.isLazy = function(i) {
return z(i) === N;
}, k.isMemo = function(i) {
return z(i) === F;
}, k.isPortal = function(i) {
return z(i) === S;
}, k.isProfiler = function(i) {
return z(i) === l;
}, k.isStrictMode = function(i) {
return z(i) === E;
}, k.isSuspense = function(i) {
return z(i) === g;
}, k.isValidElementType = function(i) {
return typeof i == "string" || typeof i == "function" || i === u || i === P || i === l || i === E || i === g || i === $ || typeof i == "object" && i !== null && (i.$$typeof === N || i.$$typeof === F || i.$$typeof === O || i.$$typeof === d || i.$$typeof === c || i.$$typeof === V || i.$$typeof === U || i.$$typeof === Y || i.$$typeof === M);
}, k.typeOf = z, k;
}
var I = {};
/** @license React v16.13.1
* react-is.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var or;
function Vr() {
return or || (or = 1, process.env.NODE_ENV !== "production" && function() {
var o = typeof Symbol == "function" && Symbol.for, j = o ? Symbol.for("react.element") : 60103, S = o ? Symbol.for("react.portal") : 60106, u = o ? Symbol.for("react.fragment") : 60107, E = o ? Symbol.for("react.strict_mode") : 60108, l = o ? Symbol.for("react.profiler") : 60114, O = o ? Symbol.for("react.provider") : 60109, d = o ? Symbol.for("react.context") : 60110, p = o ? Symbol.for("react.async_mode") : 60111, P = o ? Symbol.for("react.concurrent_mode") : 60111, c = o ? Symbol.for("react.forward_ref") : 60112, g = o ? Symbol.for("react.suspense") : 60113, $ = o ? Symbol.for("react.suspense_list") : 60120, F = o ? Symbol.for("react.memo") : 60115, N = o ? Symbol.for("react.lazy") : 60116, M = o ? Symbol.for("react.block") : 60121, V = o ? Symbol.for("react.fundamental") : 60117, U = o ? Symbol.for("react.responder") : 60118, Y = o ? Symbol.for("react.scope") : 60119;
function z(n) {
return typeof n == "string" || typeof n == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
n === u || n === P || n === l || n === E || n === g || n === $ || typeof n == "object" && n !== null && (n.$$typeof === N || n.$$typeof === F || n.$$typeof === O || n.$$typeof === d || n.$$typeof === c || n.$$typeof === V || n.$$typeof === U || n.$$typeof === Y || n.$$typeof === M);
}
function L(n) {
if (typeof n == "object" && n !== null) {
var Z = n.$$typeof;
switch (Z) {
case j:
var fe = n.type;
switch (fe) {
case p:
case P:
case u:
case l:
case E:
case g:
return fe;
default:
var ae = fe && fe.$$typeof;
switch (ae) {
case d:
case c:
case N:
case F:
case O:
return ae;
default:
return Z;
}
}
case S:
return Z;
}
}
}
var i = p, re = P, ve = d, pe = O, ie = j, ye = c, se = u, ue = N, J = F, K = S, te = l, H = E, ee = g, ne = !1;
function ce(n) {
return ne || (ne = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), t(n) || L(n) === p;
}
function t(n) {
return L(n) === P;
}
function s(n) {
return L(n) === d;
}
function h(n) {
return L(n) === O;
}
function b(n) {
return typeof n == "object" && n !== null && n.$$typeof === j;
}
function v(n) {
return L(n) === c;
}
function C(n) {
return L(n) === u;
}
function y(n) {
return L(n) === N;
}
function m(n) {
return L(n) === F;
}
function T(n) {
return L(n) === S;
}
function x(n) {
return L(n) === l;
}
function _(n) {
return L(n) === E;
}
function B(n) {
return L(n) === g;
}
I.AsyncMode = i, I.ConcurrentMode = re, I.ContextConsumer = ve, I.ContextProvider = pe, I.Element = ie, I.ForwardRef = ye, I.Fragment = se, I.Lazy = ue, I.Memo = J, I.Portal = K, I.Profiler = te, I.StrictMode = H, I.Suspense = ee, I.isAsyncMode = ce, I.isConcurrentMode = t, I.isContextConsumer = s, I.isContextProvider = h, I.isElement = b, I.isForwardRef = v, I.isFragment = C, I.isLazy = y, I.isMemo = m, I.isPortal = T, I.isProfiler = x, I.isStrictMode = _, I.isSuspense = B, I.isValidElementType = z, I.typeOf = L;
}()), I;
}
var ir;
function yr() {
return ir || (ir = 1, process.env.NODE_ENV === "production" ? Re.exports = zr() : Re.exports = Vr()), Re.exports;
}
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
var Ae, sr;
function Nr() {
if (sr)
return Ae;
sr = 1;
var o = Object.getOwnPropertySymbols, j = Object.prototype.hasOwnProperty, S = Object.prototype.propertyIsEnumerable;
function u(l) {
if (l == null)
throw new TypeError("Object.assign cannot be called with null or undefined");
return Object(l);
}
function E() {
try {
if (!Object.assign)
return !1;
var l = new String("abc");
if (l[5] = "de", Object.getOwnPropertyNames(l)[0] === "5")
return !1;
for (var O = {}, d = 0; d < 10; d++)
O["_" + String.fromCharCode(d)] = d;
var p = Object.getOwnPropertyNames(O).map(function(c) {
return O[c];
});
if (p.join("") !== "0123456789")
return !1;
var P = {};
return "abcdefghijklmnopqrst".split("").forEach(function(c) {
P[c] = c;
}), Object.keys(Object.assign({}, P)).join("") === "abcdefghijklmnopqrst";
} catch {
return !1;
}
}
return Ae = E() ? Object.assign : function(l, O) {
for (var d, p = u(l), P, c = 1; c < arguments.length; c++) {
d = Object(arguments[c]);
for (var g in d)
j.call(d, g) && (p[g] = d[g]);
if (o) {
P = o(d);
for (var $ = 0; $ < P.length; $++)
S.call(d, P[$]) && (p[P[$]] = d[P[$]]);
}
}
return p;
}, Ae;
}
var ke, ur;
function qe() {
if (ur)
return ke;
ur = 1;
var o = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
return ke = o, ke;
}
var Ie, cr;
function mr() {
return cr || (cr = 1, Ie = Function.call.bind(Object.prototype.hasOwnProperty)), Ie;
}
var $e, fr;
function Br() {
if (fr)
return $e;
fr = 1;
var o = function() {
};
if (process.env.NODE_ENV !== "production") {
var j = qe(), S = {}, u = mr();
o = function(l) {
var O = "Warning: " + l;
typeof console < "u" && console.error(O);
try {
throw new Error(O);
} catch {
}
};
}
function E(l, O, d, p, P) {
if (process.env.NODE_ENV !== "production") {
for (var c in l)
if (u(l, c)) {
var g;
try {
if (typeof l[c] != "function") {
var $ = Error(
(p || "React class") + ": " + d + " type `" + c + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof l[c] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
);
throw $.name = "Invariant Violation", $;
}
g = l[c](O, c, p, d, null, j);
} catch (N) {
g = N;
}
if (g && !(g instanceof Error) && o(
(p || "React class") + ": type specification of " + d + " `" + c + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof g + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
), g instanceof Error && !(g.message in S)) {
S[g.message] = !0;
var F = P ? P() : "";
o(
"Failed " + d + " type: " + g.message + (F ?? "")
);
}
}
}
}
return E.resetWarningCache = function() {
process.env.NODE_ENV !== "production" && (S = {});
}, $e = E, $e;
}
var De, lr;
function Gr() {
if (lr)
return De;
lr = 1;
var o = yr(), j = Nr(), S = qe(), u = mr(), E = Br(), l = function() {
};
process.env.NODE_ENV !== "production" && (l = function(d) {
var p = "Warning: " + d;
typeof console < "u" && console.error(p);
try {
throw new Error(p);
} catch {
}
});
function O() {
return null;
}
return De = function(d, p) {
var P = typeof Symbol == "function" && Symbol.iterator, c = "@@iterator";
function g(t) {
var s = t && (P && t[P] || t[c]);
if (typeof s == "function")
return s;
}
var $ = "<<anonymous>>", F = {
array: U("array"),
bigint: U("bigint"),
bool: U("boolean"),
func: U("function"),
number: U("number"),
object: U("object"),
string: U("string"),
symbol: U("symbol"),
any: Y(),
arrayOf: z,
element: L(),
elementType: i(),
instanceOf: re,
node: ye(),
objectOf: pe,
oneOf: ve,
oneOfType: ie,
shape: ue,
exact: J
};
function N(t, s) {
return t === s ? t !== 0 || 1 / t === 1 / s : t !== t && s !== s;
}
function M(t, s) {
this.message = t, this.data = s && typeof s == "object" ? s : {}, this.stack = "";
}
M.prototype = Error.prototype;
function V(t) {
if (process.env.NODE_ENV !== "production")
var s = {}, h = 0;
function b(C, y, m, T, x, _, B) {
if (T = T || $, _ = _ || m, B !== S) {
if (p) {
var n = new Error(
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
);
throw n.name = "Invariant Violation", n;
} else if (process.env.NODE_ENV !== "production" && typeof console < "u") {
var Z = T + ":" + m;
!s[Z] && // Avoid spamming the console because they are often not actionable except for lib authors
h < 3 && (l(
"You are manually calling a React.PropTypes validation function for the `" + _ + "` prop on `" + T + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
), s[Z] = !0, h++);
}
}
return y[m] == null ? C ? y[m] === null ? new M("The " + x + " `" + _ + "` is marked as required " + ("in `" + T + "`, but its value is `null`.")) : new M("The " + x + " `" + _ + "` is marked as required in " + ("`" + T + "`, but its value is `undefined`.")) : null : t(y, m, T, x, _);
}
var v = b.bind(null, !1);
return v.isRequired = b.bind(null, !0), v;
}
function U(t) {
function s(h, b, v, C, y, m) {
var T = h[b], x = H(T);
if (x !== t) {
var _ = ee(T);
return new M(
"Invalid " + C + " `" + y + "` of type " + ("`" + _ + "` supplied to `" + v + "`, expected ") + ("`" + t + "`."),
{ expectedType: t }
);
}
return null;
}
return V(s);
}
function Y() {
return V(O);
}
function z(t) {
function s(h, b, v, C, y) {
if (typeof t != "function")
return new M("Property `" + y + "` of component `" + v + "` has invalid PropType notation inside arrayOf.");
var m = h[b];
if (!Array.isArray(m)) {
var T = H(m);
return new M("Invalid " + C + " `" + y + "` of type " + ("`" + T + "` supplied to `" + v + "`, expected an array."));
}
for (var x = 0; x < m.length; x++) {
var _ = t(m, x, v, C, y + "[" + x + "]", S);
if (_ instanceof Error)
return _;
}
return null;
}
return V(s);
}
function L() {
function t(s, h, b, v, C) {
var y = s[h];
if (!d(y)) {
var m = H(y);
return new M("Invalid " + v + " `" + C + "` of type " + ("`" + m + "` supplied to `" + b + "`, expected a single ReactElement."));
}
return null;
}
return V(t);
}
function i() {
function t(s, h, b, v, C) {
var y = s[h];
if (!o.isValidElementType(y)) {
var m = H(y);
return new M("Invalid " + v + " `" + C + "` of type " + ("`" + m + "` supplied to `" + b + "`, expected a single ReactElement type."));
}
return null;
}
return V(t);
}
function re(t) {
function s(h, b, v, C, y) {
if (!(h[b] instanceof t)) {
var m = t.name || $, T = ce(h[b]);
return new M("Invalid " + C + " `" + y + "` of type " + ("`" + T + "` supplied to `" + v + "`, expected ") + ("instance of `" + m + "`."));
}
return null;
}
return V(s);
}
function ve(t) {
if (!Array.isArray(t))
return process.env.NODE_ENV !== "production" && (arguments.length > 1 ? l(
"Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
) : l("Invalid argument supplied to oneOf, expected an array.")), O;
function s(h, b, v, C, y) {
for (var m = h[b], T = 0; T < t.length; T++)
if (N(m, t[T]))
return null;
var x = JSON.stringify(t, function(B, n) {
var Z = ee(n);
return Z === "symbol" ? String(n) : n;
});
return new M("Invalid " + C + " `" + y + "` of value `" + String(m) + "` " + ("supplied to `" + v + "`, expected one of " + x + "."));
}
return V(s);
}
function pe(t) {
function s(h, b, v, C, y) {
if (typeof t != "function")
return new M("Property `" + y + "` of component `" + v + "` has invalid PropType notation inside objectOf.");
var m = h[b], T = H(m);
if (T !== "object")
return new M("Invalid " + C + " `" + y + "` of type " + ("`" + T + "` supplied to `" + v + "`, expected an object."));
for (var x in m)
if (u(m, x)) {
var _ = t(m, x, v, C, y + "." + x, S);
if (_ instanceof Error)
return _;
}
return null;
}
return V(s);
}
function ie(t) {
if (!Array.isArray(t))
return process.env.NODE_ENV !== "production" && l("Invalid argument supplied to oneOfType, expected an instance of array."), O;
for (var s = 0; s < t.length; s++) {
var h = t[s];
if (typeof h != "function")
return l(
"Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + ne(h) + " at index " + s + "."
), O;
}
function b(v, C, y, m, T) {
for (var x = [], _ = 0; _ < t.length; _++) {
var B = t[_], n = B(v, C, y, m, T, S);
if (n == null)
return null;
n.data && u(n.data, "expectedType") && x.push(n.data.expectedType);
}
var Z = x.length > 0 ? ", expected one of type [" + x.join(", ") + "]" : "";
return new M("Invalid " + m + " `" + T + "` supplied to " + ("`" + y + "`" + Z + "."));
}
return V(b);
}
function ye() {
function t(s, h, b, v, C) {
return K(s[h]) ? null : new M("Invalid " + v + " `" + C + "` supplied to " + ("`" + b + "`, expected a ReactNode."));
}
return V(t);
}
function se(t, s, h, b, v) {
return new M(
(t || "React class") + ": " + s + " type `" + h + "." + b + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + v + "`."
);
}
function ue(t) {
function s(h, b, v, C, y) {
var m = h[b], T = H(m);
if (T !== "object")
return new M("Invalid " + C + " `" + y + "` of type `" + T + "` " + ("supplied to `" + v + "`, expected `object`."));
for (var x in t) {
var _ = t[x];
if (typeof _ != "function")
return se(v, C, y, x, ee(_));
var B = _(m, x, v, C, y + "." + x, S);
if (B)
return B;
}
return null;
}
return V(s);
}
function J(t) {
function s(h, b, v, C, y) {
var m = h[b], T = H(m);
if (T !== "object")
return new M("Invalid " + C + " `" + y + "` of type `" + T + "` " + ("supplied to `" + v + "`, expected `object`."));
var x = j({}, h[b], t);
for (var _ in x) {
var B = t[_];
if (u(t, _) && typeof B != "function")
return se(v, C, y, _, ee(B));
if (!B)
return new M(
"Invalid " + C + " `" + y + "` key `" + _ + "` supplied to `" + v + "`.\nBad object: " + JSON.stringify(h[b], null, " ") + `
Valid keys: ` + JSON.stringify(Object.keys(t), null, " ")
);
var n = B(m, _, v, C, y + "." + _, S);
if (n)
return n;
}
return null;
}
return V(s);
}
function K(t) {
switch (typeof t) {
case "number":
case "string":
case "undefined":
return !0;
case "boolean":
return !t;
case "object":
if (Array.isArray(t))
return t.every(K);
if (t === null || d(t))
return !0;
var s = g(t);
if (s) {
var h = s.call(t), b;
if (s !== t.entries) {
for (; !(b = h.next()).done; )
if (!K(b.value))
return !1;
} else
for (; !(b = h.next()).done; ) {
var v = b.value;
if (v && !K(v[1]))
return !1;
}
} else
return !1;
return !0;
default:
return !1;
}
}
function te(t, s) {
return t === "symbol" ? !0 : s ? s["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && s instanceof Symbol : !1;
}
function H(t) {
var s = typeof t;
return Array.isArray(t) ? "array" : t instanceof RegExp ? "object" : te(s, t) ? "symbol" : s;
}
function ee(t) {
if (typeof t > "u" || t === null)
return "" + t;
var s = H(t);
if (s === "object") {
if (t instanceof Date)
return "date";
if (t instanceof RegExp)
return "regexp";
}
return s;
}
function ne(t) {
var s = ee(t);
switch (s) {
case "array":
case "object":
return "an " + s;
case "boolean":
case "date":
case "regexp":
return "a " + s;
default:
return s;
}
}
function ce(t) {
return !t.constructor || !t.constructor.name ? $ : t.constructor.name;
}
return F.checkPropTypes = E, F.resetWarningCache = E.resetWarningCache, F.PropTypes = F, F;
}, De;
}
var Me, dr;
function Jr() {
if (dr)
return Me;
dr = 1;
var o = qe();
function j() {
}
function S() {
}
return S.resetWarningCache = j, Me = function() {
function u(O, d, p, P, c, g) {
if (g !== o) {
var $ = new Error(
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
);
throw $.name = "Invariant Violation", $;
}
}
u.isRequired = u;
function E() {
return u;
}
var l = {
array: u,
bigint: u,
bool: u,
func: u,
number: u,
object: u,
string: u,
symbol: u,
any: u,
arrayOf: E,
element: u,
elementType: u,
instanceOf: E,
node: u,
objectOf: E,
oneOf: E,
oneOfType: E,
shape: E,
exact: E,
checkPropTypes: S,
resetWarningCache: j
};
return l.PropTypes = l, l;
}, Me;
}
if (process.env.NODE_ENV !== "production") {
var Kr = yr(), Xr = !0;
Le.exports = Gr()(Kr.isElement, Xr);
} else
Le.exports = Jr()();
var Hr = Le.exports;
const ge = /* @__PURE__ */ Lr(Hr);
let Se = null, vr = !1, Fe = !1, Ye = null;
const Zr = (o) => new Promise((j, S) => {
if (document.querySelector(`script[src="${o}"]`)) {
j();
return;
}
const u = document.createElement("script");
u.src = o, u.async = !0, u.onload = j, u.onerror = S, document.body.appendChild(u);
}), Qr = async (o, j, S, u = "in") => vr ? (Se.register(o, { userId: j, userToken: S }, {}), Se) : (Fe || (Fe = !0, Ye = (async () => {
try {
if (await Zr(u === "us" ? "https://assets-us.customerglu.com/scripts/sdk/v6.0/sdk.js" : u === "me" ? "https://assets-me.customerglu.com/scripts/sdk/v0.0.1/sdk.js" : "https://assets.customerglu.com/scripts/sdk/v5.5/sdk.js"), !window.CustomerGlu)
throw new Error("CustomerGlu failed to load");
return Se = new window.CustomerGlu(o, { userId: j, userToken: S }, {}), vr = !0, Se;
} catch (E) {
throw console.error("Error initializing CustomerGlu:", E), E;
} finally {
Fe = !1;
}
})()), Ye), et = ({
userId: o = "",
gluToken: j,
children: S,
region: u = "in",
writeKey: E = ""
}) => {
const [l, O] = rr(!0), [d, p] = rr(null);
return Wr(() => {
(async () => {
try {
console.log("initializeCustomerGlu React Component"), await Qr(E, o, j, u), O(!1);
} catch (c) {
p(c), O(!1);
}
})();
}, [o, j, u, E]), d ? /* @__PURE__ */ _e.jsx(_e.Fragment, {}) : l ? /* @__PURE__ */ _e.jsx(_e.Fragment, {}) : S;
};
et.propTypes = {
userId: ge.string,
gluToken: ge.string.isRequired,
children: ge.node,
region: ge.oneOf(["in", "us", "me"]),
writeKey: ge.string
};
export {
et as CustomerGluComponent
};