@embeddable/sdk 1.0.33 → 1.0.38
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/{EmbeddableProvider-DgC0c6sJ.js → EmbeddableProvider-BguXRq2X.js} +151 -5
- package/dist/EmbeddableProvider-Du4YSod8.cjs +10 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useReviews.d.ts +32 -0
- package/dist/hooks/useReviews.d.ts.map +1 -0
- package/dist/hooks.cjs +1 -1
- package/dist/hooks.js +7 -6
- package/dist/index.cjs +1 -1
- package/dist/index.js +7 -6
- package/dist/types/index.d.ts +67 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/EmbeddableProvider-Bv1NMHnn.cjs +0 -10
|
@@ -1948,6 +1948,151 @@ function usePublicSubmissions(options) {
|
|
|
1948
1948
|
reset
|
|
1949
1949
|
};
|
|
1950
1950
|
}
|
|
1951
|
+
function useReviews(options) {
|
|
1952
|
+
const { widgetId } = useEmbeddableConfig();
|
|
1953
|
+
const optionsRef = useRef(options);
|
|
1954
|
+
optionsRef.current = options;
|
|
1955
|
+
const [state, setState] = useState({
|
|
1956
|
+
loading: false,
|
|
1957
|
+
error: null,
|
|
1958
|
+
reviews: null,
|
|
1959
|
+
stats: null,
|
|
1960
|
+
total: 0,
|
|
1961
|
+
limit: (options == null ? void 0 : options.limit) || 50,
|
|
1962
|
+
offset: (options == null ? void 0 : options.offset) || 0
|
|
1963
|
+
});
|
|
1964
|
+
const fetchReviews = useCallback(
|
|
1965
|
+
async (customOptions) => {
|
|
1966
|
+
var _a, _b;
|
|
1967
|
+
setState((prev) => ({ ...prev, loading: true, error: null }));
|
|
1968
|
+
try {
|
|
1969
|
+
const finalOptions = { ...optionsRef.current, ...customOptions };
|
|
1970
|
+
const queryParams = new URLSearchParams();
|
|
1971
|
+
if (finalOptions == null ? void 0 : finalOptions.source) {
|
|
1972
|
+
queryParams.append("source", finalOptions.source);
|
|
1973
|
+
}
|
|
1974
|
+
if ((finalOptions == null ? void 0 : finalOptions.minRating) !== void 0) {
|
|
1975
|
+
queryParams.append("minRating", String(finalOptions.minRating));
|
|
1976
|
+
}
|
|
1977
|
+
queryParams.append("limit", String((finalOptions == null ? void 0 : finalOptions.limit) || 50));
|
|
1978
|
+
queryParams.append("offset", String((finalOptions == null ? void 0 : finalOptions.offset) || 0));
|
|
1979
|
+
queryParams.append("sortBy", (finalOptions == null ? void 0 : finalOptions.sortBy) || "reviewDate");
|
|
1980
|
+
queryParams.append("sortOrder", (finalOptions == null ? void 0 : finalOptions.sortOrder) || "desc");
|
|
1981
|
+
const response = await fetch(
|
|
1982
|
+
`${EVENTS_BASE_URL}/api/reviews/${widgetId}?${queryParams.toString()}`,
|
|
1983
|
+
{
|
|
1984
|
+
method: "GET",
|
|
1985
|
+
headers: {
|
|
1986
|
+
"Content-Type": "application/json"
|
|
1987
|
+
},
|
|
1988
|
+
// Explicitly set credentials to 'omit' for CORS support
|
|
1989
|
+
credentials: "omit"
|
|
1990
|
+
}
|
|
1991
|
+
);
|
|
1992
|
+
const responseData = await response.json();
|
|
1993
|
+
if (!response.ok) {
|
|
1994
|
+
const errorMessage = responseData.message || responseData.error || `HTTP ${response.status}`;
|
|
1995
|
+
setState((prev) => ({ ...prev, loading: false, error: errorMessage }));
|
|
1996
|
+
return {
|
|
1997
|
+
success: false,
|
|
1998
|
+
data: {
|
|
1999
|
+
reviews: [],
|
|
2000
|
+
total: 0,
|
|
2001
|
+
limit: (finalOptions == null ? void 0 : finalOptions.limit) || 50,
|
|
2002
|
+
offset: (finalOptions == null ? void 0 : finalOptions.offset) || 0,
|
|
2003
|
+
stats: {
|
|
2004
|
+
totalReviews: 0,
|
|
2005
|
+
averageRating: 0,
|
|
2006
|
+
ratingDistribution: { 1: 0, 2: 0, 3: 0, 4: 0, 5: 0 }
|
|
2007
|
+
}
|
|
2008
|
+
},
|
|
2009
|
+
message: errorMessage
|
|
2010
|
+
};
|
|
2011
|
+
}
|
|
2012
|
+
if (responseData.success && responseData.data) {
|
|
2013
|
+
setState((prev) => ({
|
|
2014
|
+
...prev,
|
|
2015
|
+
loading: false,
|
|
2016
|
+
error: null,
|
|
2017
|
+
reviews: responseData.data.reviews || [],
|
|
2018
|
+
stats: responseData.data.stats || {
|
|
2019
|
+
totalReviews: 0,
|
|
2020
|
+
averageRating: 0,
|
|
2021
|
+
ratingDistribution: { 1: 0, 2: 0, 3: 0, 4: 0, 5: 0 }
|
|
2022
|
+
},
|
|
2023
|
+
total: responseData.data.total || 0,
|
|
2024
|
+
limit: responseData.data.limit || (finalOptions == null ? void 0 : finalOptions.limit) || 50,
|
|
2025
|
+
offset: responseData.data.offset || (finalOptions == null ? void 0 : finalOptions.offset) || 0
|
|
2026
|
+
}));
|
|
2027
|
+
return {
|
|
2028
|
+
success: true,
|
|
2029
|
+
data: responseData.data
|
|
2030
|
+
};
|
|
2031
|
+
} else {
|
|
2032
|
+
const errorMessage = responseData.message || responseData.error || "Failed to fetch reviews";
|
|
2033
|
+
setState((prev) => ({ ...prev, loading: false, error: errorMessage }));
|
|
2034
|
+
return {
|
|
2035
|
+
success: false,
|
|
2036
|
+
data: {
|
|
2037
|
+
reviews: [],
|
|
2038
|
+
total: 0,
|
|
2039
|
+
limit: (finalOptions == null ? void 0 : finalOptions.limit) || 50,
|
|
2040
|
+
offset: (finalOptions == null ? void 0 : finalOptions.offset) || 0,
|
|
2041
|
+
stats: {
|
|
2042
|
+
totalReviews: 0,
|
|
2043
|
+
averageRating: 0,
|
|
2044
|
+
ratingDistribution: { 1: 0, 2: 0, 3: 0, 4: 0, 5: 0 }
|
|
2045
|
+
}
|
|
2046
|
+
},
|
|
2047
|
+
message: errorMessage
|
|
2048
|
+
};
|
|
2049
|
+
}
|
|
2050
|
+
} catch (error) {
|
|
2051
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
2052
|
+
setState((prev) => ({ ...prev, loading: false, error: errorMessage }));
|
|
2053
|
+
return {
|
|
2054
|
+
success: false,
|
|
2055
|
+
data: {
|
|
2056
|
+
reviews: [],
|
|
2057
|
+
total: 0,
|
|
2058
|
+
limit: ((_a = optionsRef.current) == null ? void 0 : _a.limit) || 50,
|
|
2059
|
+
offset: ((_b = optionsRef.current) == null ? void 0 : _b.offset) || 0,
|
|
2060
|
+
stats: {
|
|
2061
|
+
totalReviews: 0,
|
|
2062
|
+
averageRating: 0,
|
|
2063
|
+
ratingDistribution: { 1: 0, 2: 0, 3: 0, 4: 0, 5: 0 }
|
|
2064
|
+
}
|
|
2065
|
+
},
|
|
2066
|
+
message: errorMessage
|
|
2067
|
+
};
|
|
2068
|
+
}
|
|
2069
|
+
},
|
|
2070
|
+
[widgetId]
|
|
2071
|
+
);
|
|
2072
|
+
const reset = useCallback(() => {
|
|
2073
|
+
var _a, _b;
|
|
2074
|
+
setState({
|
|
2075
|
+
loading: false,
|
|
2076
|
+
error: null,
|
|
2077
|
+
reviews: null,
|
|
2078
|
+
stats: null,
|
|
2079
|
+
total: 0,
|
|
2080
|
+
limit: ((_a = optionsRef.current) == null ? void 0 : _a.limit) || 50,
|
|
2081
|
+
offset: ((_b = optionsRef.current) == null ? void 0 : _b.offset) || 0
|
|
2082
|
+
});
|
|
2083
|
+
}, []);
|
|
2084
|
+
useEffect(() => {
|
|
2085
|
+
const currentOptions = optionsRef.current;
|
|
2086
|
+
if ((currentOptions == null ? void 0 : currentOptions.autoFetch) !== false) {
|
|
2087
|
+
fetchReviews();
|
|
2088
|
+
}
|
|
2089
|
+
}, [fetchReviews]);
|
|
2090
|
+
return {
|
|
2091
|
+
...state,
|
|
2092
|
+
fetchReviews,
|
|
2093
|
+
reset
|
|
2094
|
+
};
|
|
2095
|
+
}
|
|
1951
2096
|
function useScraping() {
|
|
1952
2097
|
const { widgetId } = useEmbeddableConfig();
|
|
1953
2098
|
const [state, setState] = useState({
|
|
@@ -2413,10 +2558,11 @@ export {
|
|
|
2413
2558
|
useLocalStorage as j,
|
|
2414
2559
|
usePayment as k,
|
|
2415
2560
|
usePublicSubmissions as l,
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2561
|
+
useReviews as m,
|
|
2562
|
+
useScraping as n,
|
|
2563
|
+
useVote as o,
|
|
2564
|
+
useVoteAggregations as p,
|
|
2565
|
+
useYouTube as q,
|
|
2566
|
+
useZoom as r,
|
|
2421
2567
|
useEmbeddableContext as u
|
|
2422
2568
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";const e=require("react"),t=require("./storage-BtXo3gya.cjs");var r,s={exports:{}},n={};var a,o={};
|
|
2
|
+
/**
|
|
3
|
+
* @license React
|
|
4
|
+
* react-jsx-runtime.development.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/"production"===process.env.NODE_ENV?s.exports=function(){if(r)return n;r=1;var t=e,s=Symbol.for("react.element"),a=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,c=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function l(e,t,r){var n,a={},l=null,u=null;for(n in void 0!==r&&(l=""+r),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(u=t.ref),t)o.call(t,n)&&!i.hasOwnProperty(n)&&(a[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===a[n]&&(a[n]=t[n]);return{$$typeof:s,type:e,key:l,ref:u,props:a,_owner:c.current}}return n.Fragment=a,n.jsx=l,n.jsxs=l,n}():s.exports=(a||(a=1,"production"!==process.env.NODE_ENV&&function(){var t,r=e,s=Symbol.for("react.element"),n=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen"),v=Symbol.iterator,b=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function h(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];!function(e,t,r){var s=b.ReactDebugCurrentFrame.getStackAddendum();""!==s&&(t+="%s",r=r.concat([s]));var n=r.map(function(e){return String(e)});n.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,n)}("error",e,r)}function w(e){return e.displayName||"Context"}function k(e){if(null==e)return null;if("number"==typeof e.tag&&h("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case a:return"Fragment";case n:return"Portal";case i:return"Profiler";case c:return"StrictMode";case f:return"Suspense";case p:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case u:return w(e)+".Consumer";case l:return w(e._context)+".Provider";case d:return function(e,t,r){var s=e.displayName;if(s)return s;var n=t.displayName||t.name||"";return""!==n?r+"("+n+")":r}(e,e.render,"ForwardRef");case g:var t=e.displayName||null;return null!==t?t:k(e.type)||"Memo";case m:var r=e,s=r._payload,o=r._init;try{return k(o(s))}catch(y){return null}}return null}t=Symbol.for("react.module.reference");var S,_,C,E,T,I,j,O=Object.assign,P=0;function x(){}x.__reactDisabledLog=!0;var R,$=b.ReactCurrentDispatcher;function D(e,t,r){if(void 0===R)try{throw Error()}catch(n){var s=n.stack.trim().match(/\n( *(at )?)/);R=s&&s[1]||""}return"\n"+R+e}var N,F=!1,U="function"==typeof WeakMap?WeakMap:Map;function L(e,t){if(!e||F)return"";var r,s=N.get(e);if(void 0!==s)return s;F=!0;var n,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,n=$.current,$.current=null,function(){if(0===P){S=console.log,_=console.info,C=console.warn,E=console.error,T=console.group,I=console.groupCollapsed,j=console.groupEnd;var e={configurable:!0,enumerable:!0,value:x,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}P++}();try{if(t){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(o,[])}catch(g){r=g}Reflect.construct(e,[],o)}else{try{o.call()}catch(g){r=g}e.call(o.prototype)}}else{try{throw Error()}catch(g){r=g}e()}}catch(m){if(m&&r&&"string"==typeof m.stack){for(var c=m.stack.split("\n"),i=r.stack.split("\n"),l=c.length-1,u=i.length-1;l>=1&&u>=0&&c[l]!==i[u];)u--;for(;l>=1&&u>=0;l--,u--)if(c[l]!==i[u]){if(1!==l||1!==u)do{if(l--,--u<0||c[l]!==i[u]){var d="\n"+c[l].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),"function"==typeof e&&N.set(e,d),d}}while(l>=1&&u>=0);break}}}finally{F=!1,$.current=n,function(){if(0===--P){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:O({},e,{value:S}),info:O({},e,{value:_}),warn:O({},e,{value:C}),error:O({},e,{value:E}),group:O({},e,{value:T}),groupCollapsed:O({},e,{value:I}),groupEnd:O({},e,{value:j})})}P<0&&h("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=a}var f=e?e.displayName||e.name:"",p=f?D(f):"";return"function"==typeof e&&N.set(e,p),p}function A(e,t,r){if(null==e)return"";if("function"==typeof e)return L(e,!(!(s=e.prototype)||!s.isReactComponent));var s;if("string"==typeof e)return D(e);switch(e){case f:return D("Suspense");case p:return D("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case d:return L(e.render,!1);case g:return A(e.type,t,r);case m:var n=e,a=n._payload,o=n._init;try{return A(o(a),t,r)}catch(c){}}return""}N=new U;var V=Object.prototype.hasOwnProperty,J={},z=b.ReactDebugCurrentFrame;function H(e){if(e){var t=e._owner,r=A(e.type,e._source,t?t.type:null);z.setExtraStackFrame(r)}else z.setExtraStackFrame(null)}var W=Array.isArray;function B(e){return W(e)}function K(e){return""+e}function M(e){if(function(e){try{return K(e),!1}catch(t){return!0}}(e))return h("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),K(e)}var Y,q,G=b.ReactCurrentOwner,X={key:!0,ref:!0,__self:!0,__source:!0};function Z(e,t,r,n,a){var o,c={},i=null,l=null;for(o in void 0!==r&&(M(r),i=""+r),function(e){if(V.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(M(t.key),i=""+t.key),function(e){if(V.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(l=t.ref,function(e){"string"==typeof e.ref&&G.current}(t)),t)V.call(t,o)&&!X.hasOwnProperty(o)&&(c[o]=t[o]);if(e&&e.defaultProps){var u=e.defaultProps;for(o in u)void 0===c[o]&&(c[o]=u[o])}if(i||l){var d="function"==typeof e?e.displayName||e.name||"Unknown":e;i&&function(e,t){var r=function(){Y||(Y=!0,h("%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)",t))};r.isReactWarning=!0,Object.defineProperty(e,"key",{get:r,configurable:!0})}(c,d),l&&function(e,t){var r=function(){q||(q=!0,h("%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)",t))};r.isReactWarning=!0,Object.defineProperty(e,"ref",{get:r,configurable:!0})}(c,d)}return function(e,t,r,n,a,o,c){var i={$$typeof:s,type:e,key:t,ref:r,props:c,_owner:o,_store:{}};return Object.defineProperty(i._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(i,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(i,"_source",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.freeze&&(Object.freeze(i.props),Object.freeze(i)),i}(e,i,l,a,n,G.current,c)}var Q,ee=b.ReactCurrentOwner,te=b.ReactDebugCurrentFrame;function re(e){if(e){var t=e._owner,r=A(e.type,e._source,t?t.type:null);te.setExtraStackFrame(r)}else te.setExtraStackFrame(null)}function se(e){return"object"==typeof e&&null!==e&&e.$$typeof===s}function ne(){if(ee.current){var e=k(ee.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}Q=!1;var ae={};function oe(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var r=function(e){var t=ne();if(!t){var r="string"==typeof e?e:e.displayName||e.name;r&&(t="\n\nCheck the top-level render call using <"+r+">.")}return t}(t);if(!ae[r]){ae[r]=!0;var s="";e&&e._owner&&e._owner!==ee.current&&(s=" It was passed a child from "+k(e._owner.type)+"."),re(e),h('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,s),re(null)}}}function ce(e,t){if("object"==typeof e)if(B(e))for(var r=0;r<e.length;r++){var s=e[r];se(s)&&oe(s,t)}else if(se(e))e._store&&(e._store.validated=!0);else if(e){var n=function(e){if(null===e||"object"!=typeof e)return null;var t=v&&e[v]||e["@@iterator"];return"function"==typeof t?t:null}(e);if("function"==typeof n&&n!==e.entries)for(var a,o=n.call(e);!(a=o.next()).done;)se(a.value)&&oe(a.value,t)}}function ie(e){var t,r=e.type;if(null!=r&&"string"!=typeof r){if("function"==typeof r)t=r.propTypes;else{if("object"!=typeof r||r.$$typeof!==d&&r.$$typeof!==g)return;t=r.propTypes}if(t){var s=k(r);!function(e,t,r,s,n){var a=Function.call.bind(V);for(var o in e)if(a(e,o)){var c=void 0;try{if("function"!=typeof e[o]){var i=Error((s||"React class")+": "+r+" 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 i.name="Invariant Violation",i}c=e[o](t,o,s,r,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(l){c=l}!c||c instanceof Error||(H(n),h("%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).",s||"React class",r,o,typeof c),H(null)),c instanceof Error&&!(c.message in J)&&(J[c.message]=!0,H(n),h("Failed %s type: %s",r,c.message),H(null))}}(t,e.props,"prop",s,e)}else void 0===r.PropTypes||Q||(Q=!0,h("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",k(r)||"Unknown"));"function"!=typeof r.getDefaultProps||r.getDefaultProps.isReactClassApproved||h("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}var le={};function ue(e,r,n,o,v,b){var w=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===i||e===c||e===f||e===p||e===y||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===g||e.$$typeof===l||e.$$typeof===u||e.$$typeof===d||e.$$typeof===t||void 0!==e.getModuleId)}(e);if(!w){var S,_="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(_+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),_+=ne(),null===e?S="null":B(e)?S="array":void 0!==e&&e.$$typeof===s?(S="<"+(k(e.type)||"Unknown")+" />",_=" Did you accidentally export a JSX literal instead of a component?"):S=typeof e,h("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",S,_)}var C=Z(e,r,n,v,b);if(null==C)return C;if(w){var E=r.children;if(void 0!==E)if(o)if(B(E)){for(var T=0;T<E.length;T++)ce(E[T],e);Object.freeze&&Object.freeze(E)}else h("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 ce(E,e)}if(V.call(r,"key")){var I=k(e),j=Object.keys(r).filter(function(e){return"key"!==e}),O=j.length>0?"{key: someKey, "+j.join(": ..., ")+": ...}":"{key: someKey}";le[I+O]||(h('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',O,I,j.length>0?"{"+j.join(": ..., ")+": ...}":"{}",I),le[I+O]=!0)}return e===a?function(e){for(var t=Object.keys(e.props),r=0;r<t.length;r++){var s=t[r];if("children"!==s&&"key"!==s){re(e),h("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",s),re(null);break}}null!==e.ref&&(re(e),h("Invalid attribute `ref` supplied to `React.Fragment`."),re(null))}(C):ie(C),C}var de=function(e,t,r){return ue(e,t,r,!1)},fe=function(e,t,r){return ue(e,t,r,!0)};o.Fragment=a,o.jsx=de,o.jsxs=fe}()),o);var c=s.exports;const i="https://events.embeddable.co";function l(){const{config:e}=g();if(!e)throw new Error("No Embeddable configuration found. Make sure to wrap your app with EmbeddableProvider and provide a valid config.");return e}const u=()=>{const{widgetId:t,mode:r}=l(),s=`${i}/api`,[n,a]=e.useState(!1),o=e.useCallback(async e=>{if(!t||"preview"===r)return[];const n=[];try{a(!0);const r=(e=>{try{for(let t=0;t<localStorage.length;t++){const r=localStorage.key(t);if(null==r?void 0:r.startsWith(`embeddable_test_${e}_`)){const e=JSON.parse(localStorage.getItem(r)||"{}");if(e.expires&&Date.now()<e.expires)return{testId:e.testId,variantId:e.variantId,isControl:"control"===e.variantId}}}}catch(t){}return null})(t),o=await fetch(`${s}/marketing/track`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify({widgetId:t,capabilityId:"trackEvent",inputs:e,...r&&{testId:r.testId,variantId:r.variantId}})}),c=await o.json();c.success?c.results?c.results.forEach(e=>{n.push({success:e.success,integrationKey:e.integrationKey,data:e.data,error:e.error})}):n.push({success:!0,data:c.data}):n.push({success:!1,error:c.error||"Unknown error"})}catch(o){n.push({success:!1,error:o instanceof Error?o.message:"Network error"})}finally{a(!1)}return n},[t,s,r]),c=e.useCallback(async(e={})=>o({event_name:"page_view",event_category:"engagement",custom_parameters:{page_url:window.location.href,page_title:document.title,referrer:document.referrer,...e}}),[o]),u=e.useCallback(async(e,t={})=>o({event_name:"form_submit",event_category:"conversion",custom_parameters:{form_data:e,...t}}),[o]),d=e.useCallback(async(e,t={})=>{var r;let s={};return s="string"==typeof e?{element_selector:e}:{element_id:e.id,element_class:e.className,element_text:e.textContent||e.innerText,element_tag:null==(r=e.tagName)?void 0:r.toLowerCase()},o({event_name:"button_click",event_category:"interaction",custom_parameters:{...s,...t}})},[o]),f=e.useCallback(async(e,t,r={})=>o({event_name:"conversion",event_category:"conversion",value:t,custom_parameters:{conversion_type:e,currency:r.currency||"USD",...r}}),[o]),p=e.useCallback(async(e,t={})=>o({event_name:"signup",event_category:"conversion",user_data:e,custom_parameters:t}),[o]),g=e.useCallback(async(e,t={})=>o({event_name:"purchase",event_category:"ecommerce",value:e.amount,custom_parameters:{transaction_id:e.id,currency:e.currency||"USD",items:e.items||[],...t}}),[o]),m=e.useCallback(()=>{c()},[c]),y=e.useCallback(()=>{const e=async e=>{try{const t=e.target,r=new FormData(t),s=Object.fromEntries(r.entries());await u(s,{form_id:t.id,form_class:t.className,form_action:t.action,form_method:t.method})}catch(t){}};return document.addEventListener("submit",e),()=>{document.removeEventListener("submit",e)}},[u]),v=e.useCallback((e='button, .btn, [role="button"], a, input[type="submit"]')=>{const t=async t=>{const r=t.target.closest(e);if(r)try{await d(r)}catch(s){}};return document.addEventListener("click",t),()=>{document.removeEventListener("click",t)}},[d]);return{isLoading:n,track:o,trackPageView:c,trackFormSubmit:u,trackClick:d,trackConversion:f,trackSignup:p,trackPurchase:g,enableAutoPageView:m,enableAutoFormTracking:y,enableAutoClickTracking:v}};const d={version:"latest",mode:"embeddable",ignoreCache:!1,lazyLoad:!1,loader:!0,widgetId:"",_containerId:"",_shadowRoot:void 0},f=e.createContext({config:{...d},setConfig:()=>{},data:{},setData:()=>{}});function p(){const{trackPageView:t}=u(),{config:r}=g();return e.useEffect(()=>{(null==r?void 0:r.widgetId)&&"preview"!==(null==r?void 0:r.mode)&&t()},[null==r?void 0:r.widgetId,null==r?void 0:r.mode,t]),null}function g(){const t=e.useContext(f);if(!t)throw new Error("useEmbeddableContext must be used within an EmbeddableProvider");return t}exports.EmbeddableProvider=function({config:t,data:r,children:s}){const[n,a]=e.useState(d),[o,i]=e.useState(r||{});return e.useEffect(()=>{const e={...d,...t};a(e)},[t]),e.useEffect(()=>{const e=e=>{("https://embeddable.co"===e.origin||e.origin.includes("localhost"))&&e.data&&"object"==typeof e.data&&"embeddable-update-data"===e.data.type&&i(e.data.data||{})};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}},[]),c.jsxs(f.Provider,{value:{config:n,setConfig:a,data:o,setData:i},children:[c.jsx(p,{}),s]})},exports.useAI=function(t){const{widgetId:r}=l(),s=e.useRef(t);s.current=t;const[n,a]=e.useState({loading:!1,error:null,success:!1});return{...n,callAI:e.useCallback(async(e,t)=>{var n;a({loading:!0,error:null,success:!1});try{const o={widgetId:r,capabilityId:"aiCall",integrationKey:s.current.platform,prompt:e,history:t||[],inputs:s.current.inputs||{}};"embeddable-ai"!==s.current.platform&&(delete o.inputs.systemPrompt,delete o.inputs.maxTokens);const c=await fetch(`${i}/api/execute/ai`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify(o)}),l=await c.json();if(!c.ok){const e=l.message||l.error||`HTTP ${c.status}`;return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}if(l.success)return a({loading:!1,error:null,success:!0}),{success:!0,message:(null==(n=l.data)?void 0:n.response)||"AI call completed successfully",data:l.data,metadata:l.metadata};{const e=l.message||l.error||"AI call failed";return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}}catch(o){const e=o instanceof Error?o.message:"Unknown error occurred";return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}},[r]),reset:e.useCallback(()=>{a({loading:!1,error:null,success:!1})},[])}},exports.useCalendar=function(t={}){const{widgetId:r}=l(),[s,n]=e.useState({loading:!1,error:null,success:!1}),a=e.useCallback(async(e,s={})=>{var a,o,c,l;n({loading:!0,error:null,success:!1});try{const l={widgetId:r,action:e,...s},u=await fetch(`${i}/api/execute/google-calendar`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify(l)}),d=await u.json();if(!u.ok){const e=d.message||d.error||`HTTP ${u.status}`;return n({loading:!1,error:e,success:!1}),null==(a=t.onError)||a.call(t,e),{success:!1,message:e}}if(d.success)return n({loading:!1,error:null,success:!0}),null==(o=t.onSuccess)||o.call(t,d.data),{success:!0,message:"Calendar operation completed successfully",data:d.data,metadata:d.metadata};{const e=d.message||d.error||"Calendar operation failed";return n({loading:!1,error:e,success:!1}),null==(c=t.onError)||c.call(t,e),{success:!1,message:e}}}catch(u){const e=u instanceof Error?u.message:"Unknown error occurred";return n({loading:!1,error:e,success:!1}),null==(l=t.onError)||l.call(t,e),{success:!1,message:e}}},[r,t]);return{...s,getCalendar:e.useCallback(async()=>a("get_calendar"),[a]),listEvents:e.useCallback(async(e={})=>a("list_events",{options:e}),[a]),getEvent:e.useCallback(async e=>a("get_event",{eventId:e}),[a]),createEvent:e.useCallback(async e=>a("create_event",{eventData:e}),[a]),updateEvent:e.useCallback(async(e,t)=>a("update_event",{eventId:e,eventData:t}),[a]),deleteEvent:e.useCallback(async e=>a("delete_event",{eventId:e}),[a]),getFreeBusy:e.useCallback(async e=>a("get_freebusy",{options:e}),[a]),reset:e.useCallback(()=>{n({loading:!1,error:null,success:!1})},[])}},exports.useDataIntegration=function(t={}){const{widgetId:r}=l(),s=e.useRef(t);s.current=t;const[n,a]=e.useState({loading:!1,error:null,success:!1});return{...n,fetchData:e.useCallback(async()=>{a({loading:!0,error:null,success:!1});try{const e={widgetId:r,capabilityId:s.current.capabilityId||"fetchData",integrationKey:s.current.integrationKey||"sheets"},t=await fetch(`${i}/api/execute/data`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify(e)}),n=await t.json();if(!t.ok){const e=n.message||n.error||`HTTP ${t.status}`;return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}if(n.success)return a({loading:!1,error:null,success:!0}),{success:!0,message:"Data fetched successfully",data:n.data,metadata:n.metadata};{const e=n.message||n.error||"Data fetch failed";return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}}catch(e){const t=e instanceof Error?e.message:"Unknown error occurred";return a({loading:!1,error:t,success:!1}),{success:!1,message:t}}},[r]),reset:e.useCallback(()=>{a({loading:!1,error:null,success:!1})},[])}},exports.useDebounce=function(t,r){const[s,n]=e.useState(t);return e.useEffect(()=>{const e=setTimeout(()=>{n(t)},r);return()=>{clearTimeout(e)}},[t,r]),s},exports.useEmbeddableConfig=l,exports.useEmbeddableContext=g,exports.useEmbeddableData=function(){const{data:e}=g();return{data:e}},exports.useEventTracking=u,exports.useFileUpload=function(){const{widgetId:t}=l(),[r,s]=e.useState({loading:!1,error:null,success:!1});return{...r,uploadFile:e.useCallback(async e=>{s({loading:!0,error:null,success:!1});try{const r=new FormData;r.append("file",e),r.append("widgetId",t);const n=await fetch(`${i}/api/execute/uploads`,{method:"POST",credentials:"omit",body:r}),a=await n.json();if(!n.ok){const e=a.message||a.error||`HTTP ${n.status}`;return s({loading:!1,error:e,success:!1}),{success:!1,message:e}}if(a.success)return s({loading:!1,error:null,success:!0}),{success:!0,message:a.message||"File uploaded successfully",data:a.data};{const e=a.message||a.error||"File upload failed";return s({loading:!1,error:e,success:!1}),{success:!1,message:e}}}catch(r){const e=r instanceof Error?r.message:"Unknown error occurred";return s({loading:!1,error:e,success:!1}),{success:!1,message:e}}},[t]),reset:e.useCallback(()=>{s({loading:!1,error:null,success:!1})},[])}},exports.useFormSubmission=function(t){const{widgetId:r}=l(),s=e.useRef(t);s.current=t;const[n,a]=e.useState({loading:!1,error:null,success:!1});return{...n,submit:e.useCallback(async e=>{var t,n,o,c,l;a({loading:!0,error:null,success:!1});try{if(null==(t=s.current)?void 0:t.validatePayload){const t=s.current.validatePayload(e);if(t)return a({loading:!1,error:t,success:!1}),{success:!1,message:t}}const u={payload:e,widgetId:r,collectionName:(null==(n=s.current)?void 0:n.collectionName)||"submissions"},d=await fetch(`${i}/api/submissions`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify(u)}),f=await d.json();if(!d.ok){const e=f.message||f.error||`HTTP ${d.status}`;return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}if(f.success)return a({loading:!1,error:null,success:!0}),{id:(null==(o=f.data)?void 0:o.id)||(null==(c=f.data)?void 0:c._id),success:!0,message:(null==(l=f.data)?void 0:l.message)||"Submission successful"};{const e=f.message||f.error||"Submission failed";return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}}catch(u){const e=u instanceof Error?u.message:"Unknown error occurred";return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}},[r]),reset:e.useCallback(()=>{a({loading:!1,error:null,success:!1})},[])}},exports.useLocalStorage=function(r,s,n={}){const{widgetId:a}=l(),o=e.useMemo(()=>({...n,prefix:`embd-${a}-${n.prefix||""}`}),[a,n]),[c,i]=e.useState(()=>{const e=t.storage.get(r,o);return null!==e?e:s}),u=e.useCallback(e=>{try{const s=e instanceof Function?e(c):e;i(s),t.storage.set(r,s,o)}catch(s){}},[r,c,o]),d=e.useCallback(()=>{try{i(s),t.storage.remove(r,o)}catch(e){}},[r,s,o]);return e.useEffect(()=>{const e=e=>{const t=o.prefix+r;if(e.key===t&&null!==e.newValue)try{const{deserialize:t=JSON.parse}=o,r=t(e.newValue);i(r)}catch(s){}};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[r,o]),[c,u,d]},exports.usePayment=function(t={}){const{widgetId:r}=l(),s=e.useRef(t);s.current=t;const[n,a]=e.useState({loading:!1,error:null,success:!1}),o=e.useRef(null);e.useEffect(()=>()=>{o.current&&window.clearInterval(o.current)},[]);const c=e.useCallback(async e=>{var t,n,c,l;try{const u=await fetch(`${i}/api/execute/payments/session/${e}?widgetId=${r}`,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"omit"}),d=await u.json();if(!u.ok)return;if(d.success&&d.session){const{status:e,payment_status:r}=d.session;"paid"===r&&"complete"===e?(o.current&&(window.clearInterval(o.current),o.current=null),a({loading:!1,error:null,success:!0}),null==(n=(t=s.current).onSuccess)||n.call(t,d.session)):"expired"===e&&(o.current&&(window.clearInterval(o.current),o.current=null),a({loading:!1,error:"Payment session expired",success:!1}),null==(l=(c=s.current).onFailure)||l.call(c,d.session))}}catch(u){}},[r]),u=e.useCallback(e=>{o.current&&window.clearInterval(o.current),o.current=window.setInterval(()=>{c(e)},1e4),c(e)},[c]);return{...n,createCheckout:e.useCallback(async e=>{var t;a({loading:!0,error:null,success:!1});try{const n={widgetId:r,capabilityId:s.current.capabilityId||"getCheckout",integrationKey:s.current.integrationKey||"stripe",inputs:e},o=await fetch(`${i}/api/execute/payments`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify(n)}),c=await o.json();if(!o.ok){const e=c.message||c.error||`HTTP ${o.status}`;return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}if(c.success)return(null==(t=c.data)?void 0:t.sessionId)&&u(c.data.sessionId),a({loading:!1,error:null,success:!1}),{success:!0,message:"Checkout session created successfully",data:c.data,metadata:c.metadata};{const e=c.message||c.error||"Payment checkout failed";return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}}catch(n){const e=n instanceof Error?n.message:"Unknown error occurred";return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}},[r,u]),reset:e.useCallback(()=>{o.current&&(window.clearInterval(o.current),o.current=null),a({loading:!1,error:null,success:!1})},[])}},exports.usePublicSubmissions=function(t){const{widgetId:r}=l(),s=e.useRef(t);s.current=t;const[n,a]=e.useState({loading:!1,error:null,data:null,pagination:null}),o=e.useCallback(async e=>{a(e=>({...e,loading:!0,error:null}));try{const t={...s.current,...e},n=new URLSearchParams;n.append("widgetId",r),(null==t?void 0:t.collectionName)&&n.append("collectionName",t.collectionName),n.append("page",String((null==t?void 0:t.page)||1)),n.append("limit",String((null==t?void 0:t.limit)||10)),n.append("sortBy",(null==t?void 0:t.sortBy)||"createdAt"),n.append("sortOrder",(null==t?void 0:t.sortOrder)||"desc"),(null==t?void 0:t.fromDate)&&n.append("fromDate",t.fromDate),(null==t?void 0:t.toDate)&&n.append("toDate",t.toDate);const o=await fetch(`${i}/api/submissions/public?${n.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"omit"}),c=await o.json();if(!o.ok){const e=c.message||c.error||`HTTP ${o.status}`;return a(t=>({...t,loading:!1,error:e})),{success:!1,data:[],pagination:{page:1,limit:10,total:0,pages:0},message:e}}if(c.success)return a(e=>({...e,loading:!1,error:null,data:c.data||[],pagination:c.pagination||{page:1,limit:10,total:0,pages:0}})),{success:!0,data:c.data||[],pagination:c.pagination||{page:1,limit:10,total:0,pages:0}};{const e=c.message||c.error||"Failed to fetch submissions";return a(t=>({...t,loading:!1,error:e})),{success:!1,data:[],pagination:{page:1,limit:10,total:0,pages:0},message:e}}}catch(t){const e=t instanceof Error?t.message:"Unknown error occurred";return a(t=>({...t,loading:!1,error:e})),{success:!1,data:[],pagination:{page:1,limit:10,total:0,pages:0},message:e}}},[r]),c=e.useCallback(()=>{a({loading:!1,error:null,data:null,pagination:null})},[]);return e.useEffect(()=>{const e=s.current;e&&void 0===e.page&&void 0===e.limit||o()},[o]),{...n,fetchSubmissions:o,reset:c}},exports.useReviews=function(t){const{widgetId:r}=l(),s=e.useRef(t);s.current=t;const[n,a]=e.useState({loading:!1,error:null,reviews:null,stats:null,total:0,limit:(null==t?void 0:t.limit)||50,offset:(null==t?void 0:t.offset)||0}),o=e.useCallback(async e=>{var t,n;a(e=>({...e,loading:!0,error:null}));try{const t={...s.current,...e},n=new URLSearchParams;(null==t?void 0:t.source)&&n.append("source",t.source),void 0!==(null==t?void 0:t.minRating)&&n.append("minRating",String(t.minRating)),n.append("limit",String((null==t?void 0:t.limit)||50)),n.append("offset",String((null==t?void 0:t.offset)||0)),n.append("sortBy",(null==t?void 0:t.sortBy)||"reviewDate"),n.append("sortOrder",(null==t?void 0:t.sortOrder)||"desc");const o=await fetch(`${i}/api/reviews/${r}?${n.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"omit"}),c=await o.json();if(!o.ok){const e=c.message||c.error||`HTTP ${o.status}`;return a(t=>({...t,loading:!1,error:e})),{success:!1,data:{reviews:[],total:0,limit:(null==t?void 0:t.limit)||50,offset:(null==t?void 0:t.offset)||0,stats:{totalReviews:0,averageRating:0,ratingDistribution:{1:0,2:0,3:0,4:0,5:0}}},message:e}}if(c.success&&c.data)return a(e=>({...e,loading:!1,error:null,reviews:c.data.reviews||[],stats:c.data.stats||{totalReviews:0,averageRating:0,ratingDistribution:{1:0,2:0,3:0,4:0,5:0}},total:c.data.total||0,limit:c.data.limit||(null==t?void 0:t.limit)||50,offset:c.data.offset||(null==t?void 0:t.offset)||0})),{success:!0,data:c.data};{const e=c.message||c.error||"Failed to fetch reviews";return a(t=>({...t,loading:!1,error:e})),{success:!1,data:{reviews:[],total:0,limit:(null==t?void 0:t.limit)||50,offset:(null==t?void 0:t.offset)||0,stats:{totalReviews:0,averageRating:0,ratingDistribution:{1:0,2:0,3:0,4:0,5:0}}},message:e}}}catch(o){const e=o instanceof Error?o.message:"Unknown error occurred";return a(t=>({...t,loading:!1,error:e})),{success:!1,data:{reviews:[],total:0,limit:(null==(t=s.current)?void 0:t.limit)||50,offset:(null==(n=s.current)?void 0:n.offset)||0,stats:{totalReviews:0,averageRating:0,ratingDistribution:{1:0,2:0,3:0,4:0,5:0}}},message:e}}},[r]),c=e.useCallback(()=>{var e,t;a({loading:!1,error:null,reviews:null,stats:null,total:0,limit:(null==(e=s.current)?void 0:e.limit)||50,offset:(null==(t=s.current)?void 0:t.offset)||0})},[]);return e.useEffect(()=>{const e=s.current;!1!==(null==e?void 0:e.autoFetch)&&o()},[o]),{...n,fetchReviews:o,reset:c}},exports.useScraping=function(){const{widgetId:t}=l(),[r,s]=e.useState({loading:!1,error:null,success:!1});return{...r,scrapeWebsite:e.useCallback(async e=>{s({loading:!0,error:null,success:!1});try{const r={url:e.url,format:e.format||"markdown",options:e.options||{},widgetId:t},n=await fetch(`${i}/api/execute/scraping`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify(r)}),a=await n.json();if(!n.ok){const e=a.message||a.error||`HTTP ${n.status}`;return s({loading:!1,error:e,success:!1}),{success:!1,message:e}}if(a.success)return s({loading:!1,error:null,success:!0}),{success:!0,message:"Website scraped successfully",data:a.data,metadata:a.metadata};{const e=a.message||a.error||"Scraping failed";return s({loading:!1,error:e,success:!1}),{success:!1,message:e}}}catch(r){const e=r instanceof Error?r.message:"Unknown error occurred";return s({loading:!1,error:e,success:!1}),{success:!1,message:e}}},[t]),reset:e.useCallback(()=>{s({loading:!1,error:null,success:!1})},[])}},exports.useVote=function(t){const{widgetId:r}=l(),s=e.useRef(t);s.current=t;const[n,a]=e.useState({loading:!1,error:null,success:!1});return{...n,vote:e.useCallback(async e=>{var t,n,o,c;a({loading:!0,error:null,success:!1});try{const l={voteFor:e,widgetId:r,collectionName:(null==(t=s.current)?void 0:t.collectionName)||"votes"},u=await fetch(`${i}/api/votes`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify(l)}),d=await u.json();if(!u.ok){const e=d.message||d.error||`HTTP ${u.status}`;return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}if(d.success)return a({loading:!1,error:null,success:!0}),{id:(null==(n=d.data)?void 0:n.id)||(null==(o=d.data)?void 0:o._id),success:!0,message:(null==(c=d.data)?void 0:c.message)||"Vote submitted successfully"};{const e=d.message||d.error||"Vote submission failed";return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}}catch(l){const e=l instanceof Error?l.message:"Unknown error occurred";return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}},[r]),reset:e.useCallback(()=>{a({loading:!1,error:null,success:!1})},[])}},exports.useVoteAggregations=function(t){const{widgetId:r}=l(),s=e.useRef(t);s.current=t;const[n,a]=e.useState({data:null,loading:!1,error:null}),o=e.useCallback(async()=>{var e;if(!r)return a({data:null,loading:!1,error:"Widget ID is required"}),{success:!1,data:{results:[],summary:{totalVotes:0,totalOptions:0,groupBy:""}}};a(e=>({...e,loading:!0,error:null}));try{const t=(null==(e=s.current)?void 0:e.collectionName)||"votes",n=new URL(`${i}/api/votes/aggregations`);n.searchParams.append("widgetId",r),n.searchParams.append("collectionName",t);const o=await fetch(n.toString(),{method:"GET",headers:{"Content-Type":"application/json"},credentials:"omit"}),c=await o.json();if(!o.ok){const e=c.message||c.error||`HTTP ${o.status}`;return a({data:null,loading:!1,error:e}),{success:!1,data:{results:[],summary:{totalVotes:0,totalOptions:0,groupBy:""}}}}return a({data:c.data,loading:!1,error:null}),c}catch(t){const e=t instanceof Error?t.message:"Unknown error occurred";return a({data:null,loading:!1,error:e}),{success:!1,data:{results:[],summary:{totalVotes:0,totalOptions:0,groupBy:""}}}}},[r]),c=e.useCallback(()=>o(),[o]),u=e.useCallback(()=>{a({data:null,loading:!1,error:null})},[]);return e.useEffect(()=>{const e=s.current;!1!==(null==e?void 0:e.autoFetch)&&r&&o()},[o,r]),e.useEffect(()=>{const e=s.current;if((null==e?void 0:e.refetchInterval)&&e.refetchInterval>0&&r){const t=setInterval(()=>{o()},e.refetchInterval);return()=>clearInterval(t)}},[o,r]),{...n,fetch:o,refetch:c,reset:u}},exports.useYouTube=function(){const{widgetId:t}=l(),[r,s]=e.useState({loading:!1,error:null,success:!1}),n=e.useCallback(async e=>{s({loading:!0,error:null,success:!1});try{const r={widgetId:t,url:e.url,action:e.action,options:e.options||{}},n=await fetch(`${i}/api/execute/youtube`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify(r)}),a=await n.json();if(!n.ok){const e=a.message||a.error||`HTTP ${n.status}`;return s({loading:!1,error:e,success:!1}),{success:!1,message:e}}if(a.success)return s({loading:!1,error:null,success:!0}),{success:!0,message:"YouTube video analyzed successfully",data:a.data,metadata:a.metadata};{const e=a.message||a.error||"YouTube analysis failed";return s({loading:!1,error:e,success:!1}),{success:!1,message:e}}}catch(r){const e=r instanceof Error?r.message:"Unknown error occurred";return s({loading:!1,error:e,success:!1}),{success:!1,message:e}}},[t]),a=e.useCallback(async(e,t)=>n({url:e,action:"summarize",options:t}),[n]),o=e.useCallback(async e=>n({url:e,action:"transcript"}),[n]),c=e.useCallback(async e=>n({url:e,action:"stats"}),[n]),u=e.useCallback(()=>{s({loading:!1,error:null,success:!1})},[]);return{...r,analyzeVideo:n,summarizeVideo:a,getTranscript:o,getStats:c,reset:u}},exports.useZoom=function(t={}){const{widgetId:r}=l(),[s,n]=e.useState({loading:!1,error:null,success:!1});return{...s,createMeeting:e.useCallback(async(e={})=>{var s,a,o,c;n({loading:!0,error:null,success:!1});try{const c={widgetId:r,options:e},l=await fetch(`${i}/api/execute/zoom`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify(c)}),u=await l.json();if(!l.ok){const e=u.message||u.error||`HTTP ${l.status}`;return n({loading:!1,error:e,success:!1}),null==(s=t.onError)||s.call(t,e),{success:!1,message:e}}if(u.success)return n({loading:!1,error:null,success:!0}),null==(a=t.onSuccess)||a.call(t,u.data),{success:!0,message:"Zoom meeting created successfully",data:u.data};{const e=u.message||u.error||"Failed to create Zoom meeting";return n({loading:!1,error:e,success:!1}),null==(o=t.onError)||o.call(t,e),{success:!1,message:e}}}catch(l){const e=l instanceof Error?l.message:"Unknown error occurred";return n({loading:!1,error:e,success:!1}),null==(c=t.onError)||c.call(t,e),{success:!1,message:e}}},[r,t]),reset:e.useCallback(()=>{n({loading:!1,error:null,success:!1})},[])}};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { useFormSubmission } from './useFormSubmission';
|
|
|
10
10
|
export { useLocalStorage } from './useLocalStorage';
|
|
11
11
|
export { usePayment } from './usePayment';
|
|
12
12
|
export { usePublicSubmissions } from './usePublicSubmissions';
|
|
13
|
+
export { useReviews } from './useReviews';
|
|
13
14
|
export { useScraping } from './useScraping';
|
|
14
15
|
export { useVote } from './useVote';
|
|
15
16
|
export { useVoteAggregations } from './useVoteAggregations';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,WAA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@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Review, ReviewStats, ReviewsResponse, UseReviewsOptions } from '../types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* React hook for fetching reviews from various platforms (Google, Yelp, Trustpilot, etc.)
|
|
5
|
+
* @param options - Optional configuration for filtering, pagination, and sorting
|
|
6
|
+
* @returns Object with fetch function, reviews data, stats, and state management
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // Fetch all reviews with auto-fetch
|
|
10
|
+
* const { reviews, stats, loading } = useReviews();
|
|
11
|
+
*
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Fetch only Google reviews with minimum rating
|
|
15
|
+
* const { reviews, stats, loading } = useReviews({
|
|
16
|
+
* source: 'google',
|
|
17
|
+
* minRating: 4,
|
|
18
|
+
* limit: 20
|
|
19
|
+
* });
|
|
20
|
+
*/
|
|
21
|
+
export declare function useReviews(options?: UseReviewsOptions): {
|
|
22
|
+
fetchReviews: (customOptions?: UseReviewsOptions) => Promise<ReviewsResponse>;
|
|
23
|
+
reset: () => void;
|
|
24
|
+
loading: boolean;
|
|
25
|
+
error: string | null;
|
|
26
|
+
reviews: Review[] | null;
|
|
27
|
+
stats: ReviewStats | null;
|
|
28
|
+
total: number;
|
|
29
|
+
limit: number;
|
|
30
|
+
offset: number;
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=useReviews.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReviews.d.ts","sourceRoot":"","sources":["../../src/hooks/useReviews.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAcxF;;;;;;;;;;;;;;;;;GAiBG;AAEH,wBAAgB,UAAU,CAAC,OAAO,CAAC,EAAE,iBAAiB;mCAkB3B,iBAAiB,KAAG,OAAO,CAAC,eAAe,CAAC;;aA9C5D,OAAO;WACT,MAAM,GAAG,IAAI;aACX,MAAM,EAAE,GAAG,IAAI;WACjB,WAAW,GAAG,IAAI;WAClB,MAAM;WACN,MAAM;YACL,MAAM;EA4Lf"}
|
package/dist/hooks.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./EmbeddableProvider-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./EmbeddableProvider-Du4YSod8.cjs");exports.useAI=e.useAI,exports.useCalendar=e.useCalendar,exports.useDataIntegration=e.useDataIntegration,exports.useDebounce=e.useDebounce,exports.useEmbeddableConfig=e.useEmbeddableConfig,exports.useEmbeddableData=e.useEmbeddableData,exports.useEventTracking=e.useEventTracking,exports.useFileUpload=e.useFileUpload,exports.useFormSubmission=e.useFormSubmission,exports.useLocalStorage=e.useLocalStorage,exports.usePayment=e.usePayment,exports.usePublicSubmissions=e.usePublicSubmissions,exports.useReviews=e.useReviews,exports.useScraping=e.useScraping,exports.useVote=e.useVote,exports.useVoteAggregations=e.useVoteAggregations,exports.useYouTube=e.useYouTube,exports.useZoom=e.useZoom;
|
package/dist/hooks.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a, b, c, d, e, g, h, f, i, j, k, l, m, n, o, p, q } from "./EmbeddableProvider-
|
|
1
|
+
import { a, b, c, d, e, g, h, f, i, j, k, l, m, n, o, p, q, r } from "./EmbeddableProvider-BguXRq2X.js";
|
|
2
2
|
export {
|
|
3
3
|
a as useAI,
|
|
4
4
|
b as useCalendar,
|
|
@@ -12,9 +12,10 @@ export {
|
|
|
12
12
|
j as useLocalStorage,
|
|
13
13
|
k as usePayment,
|
|
14
14
|
l as usePublicSubmissions,
|
|
15
|
-
m as
|
|
16
|
-
n as
|
|
17
|
-
o as
|
|
18
|
-
p as
|
|
19
|
-
q as
|
|
15
|
+
m as useReviews,
|
|
16
|
+
n as useScraping,
|
|
17
|
+
o as useVote,
|
|
18
|
+
p as useVoteAggregations,
|
|
19
|
+
q as useYouTube,
|
|
20
|
+
r as useZoom
|
|
20
21
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./EmbeddableProvider-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./EmbeddableProvider-Du4YSod8.cjs"),s=require("./utils.cjs"),o=require("./storage-BtXo3gya.cjs");exports.EmbeddableProvider=e.EmbeddableProvider,exports.useAI=e.useAI,exports.useCalendar=e.useCalendar,exports.useDataIntegration=e.useDataIntegration,exports.useDebounce=e.useDebounce,exports.useEmbeddableConfig=e.useEmbeddableConfig,exports.useEmbeddableContext=e.useEmbeddableContext,exports.useEmbeddableData=e.useEmbeddableData,exports.useEventTracking=e.useEventTracking,exports.useFileUpload=e.useFileUpload,exports.useFormSubmission=e.useFormSubmission,exports.useLocalStorage=e.useLocalStorage,exports.usePayment=e.usePayment,exports.usePublicSubmissions=e.usePublicSubmissions,exports.useReviews=e.useReviews,exports.useScraping=e.useScraping,exports.useVote=e.useVote,exports.useVoteAggregations=e.useVoteAggregations,exports.useYouTube=e.useYouTube,exports.useZoom=e.useZoom,exports.createApiClient=s.createApiClient,exports.debounce=s.debounce,exports.storage=o.storage;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E, a, b, c, d, e, u, g, h, f, i, j, k, l, m, n, o, p, q } from "./EmbeddableProvider-
|
|
1
|
+
import { E, a, b, c, d, e, u, g, h, f, i, j, k, l, m, n, o, p, q, r } from "./EmbeddableProvider-BguXRq2X.js";
|
|
2
2
|
import { createApiClient, debounce } from "./utils.js";
|
|
3
3
|
import { s } from "./storage-B4eeCFyo.js";
|
|
4
4
|
export {
|
|
@@ -19,9 +19,10 @@ export {
|
|
|
19
19
|
j as useLocalStorage,
|
|
20
20
|
k as usePayment,
|
|
21
21
|
l as usePublicSubmissions,
|
|
22
|
-
m as
|
|
23
|
-
n as
|
|
24
|
-
o as
|
|
25
|
-
p as
|
|
26
|
-
q as
|
|
22
|
+
m as useReviews,
|
|
23
|
+
n as useScraping,
|
|
24
|
+
o as useVote,
|
|
25
|
+
p as useVoteAggregations,
|
|
26
|
+
q as useYouTube,
|
|
27
|
+
r as useZoom
|
|
27
28
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -114,4 +114,71 @@ export interface PublicSubmissionsOptions {
|
|
|
114
114
|
fromDate?: string;
|
|
115
115
|
toDate?: string;
|
|
116
116
|
}
|
|
117
|
+
export type ReviewSource = 'google' | 'yelp' | 'trustpilot' | 'facebook';
|
|
118
|
+
export interface ReviewSourceMetadata {
|
|
119
|
+
reviewUrl?: string;
|
|
120
|
+
profileUrl?: string;
|
|
121
|
+
language?: string;
|
|
122
|
+
localGuide?: boolean;
|
|
123
|
+
timeAgo?: string;
|
|
124
|
+
reviewerReviewsCount?: number;
|
|
125
|
+
reviewerPhotosCount?: number;
|
|
126
|
+
imagesCount?: number;
|
|
127
|
+
images?: string[];
|
|
128
|
+
ownerAnswer?: string;
|
|
129
|
+
ownerAnswerTimestamp?: string;
|
|
130
|
+
ownerAnswerTimeAgo?: string;
|
|
131
|
+
[key: string]: any;
|
|
132
|
+
}
|
|
133
|
+
export interface Review {
|
|
134
|
+
_id?: string;
|
|
135
|
+
widgetId: string;
|
|
136
|
+
organizationId: string;
|
|
137
|
+
integrationId: string;
|
|
138
|
+
source: ReviewSource;
|
|
139
|
+
reviewId: string;
|
|
140
|
+
authorName: string;
|
|
141
|
+
authorImage?: string;
|
|
142
|
+
rating: number;
|
|
143
|
+
text?: string;
|
|
144
|
+
reviewDate: Date | string;
|
|
145
|
+
sourceMetadata?: ReviewSourceMetadata;
|
|
146
|
+
status: 'active' | 'hidden' | 'deleted';
|
|
147
|
+
syncedAt: Date | string;
|
|
148
|
+
createdAt: Date | string;
|
|
149
|
+
updatedAt: Date | string;
|
|
150
|
+
}
|
|
151
|
+
export interface ReviewStats {
|
|
152
|
+
totalReviews: number;
|
|
153
|
+
averageRating: number;
|
|
154
|
+
ratingDistribution: {
|
|
155
|
+
1: number;
|
|
156
|
+
2: number;
|
|
157
|
+
3: number;
|
|
158
|
+
4: number;
|
|
159
|
+
5: number;
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
export interface ReviewsData {
|
|
163
|
+
reviews: Review[];
|
|
164
|
+
total: number;
|
|
165
|
+
limit: number;
|
|
166
|
+
offset: number;
|
|
167
|
+
stats: ReviewStats;
|
|
168
|
+
}
|
|
169
|
+
export interface ReviewsResponse {
|
|
170
|
+
success: boolean;
|
|
171
|
+
data: ReviewsData;
|
|
172
|
+
message?: string;
|
|
173
|
+
error?: string;
|
|
174
|
+
}
|
|
175
|
+
export interface UseReviewsOptions {
|
|
176
|
+
source?: ReviewSource;
|
|
177
|
+
minRating?: number;
|
|
178
|
+
limit?: number;
|
|
179
|
+
offset?: number;
|
|
180
|
+
sortBy?: string;
|
|
181
|
+
sortOrder?: 'asc' | 'desc';
|
|
182
|
+
autoFetch?: boolean;
|
|
183
|
+
}
|
|
117
184
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,GAAG;IAClC,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,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MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB"}
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("react"),r=require("./storage-BtXo3gya.cjs");var t,s={exports:{}},n={};var a,o={};
|
|
2
|
-
/**
|
|
3
|
-
* @license React
|
|
4
|
-
* react-jsx-runtime.development.js
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the MIT license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/"production"===process.env.NODE_ENV?s.exports=function(){if(t)return n;t=1;var r=e,s=Symbol.for("react.element"),a=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,c=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function u(e,r,t){var n,a={},u=null,l=null;for(n in void 0!==t&&(u=""+t),void 0!==r.key&&(u=""+r.key),void 0!==r.ref&&(l=r.ref),r)o.call(r,n)&&!i.hasOwnProperty(n)&&(a[n]=r[n]);if(e&&e.defaultProps)for(n in r=e.defaultProps)void 0===a[n]&&(a[n]=r[n]);return{$$typeof:s,type:e,key:u,ref:l,props:a,_owner:c.current}}return n.Fragment=a,n.jsx=u,n.jsxs=u,n}():s.exports=(a||(a=1,"production"!==process.env.NODE_ENV&&function(){var r,t=e,s=Symbol.for("react.element"),n=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),l=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen"),v=Symbol.iterator,b=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function h(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),s=1;s<r;s++)t[s-1]=arguments[s];!function(e,r,t){var s=b.ReactDebugCurrentFrame.getStackAddendum();""!==s&&(r+="%s",t=t.concat([s]));var n=t.map(function(e){return String(e)});n.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,n)}("error",e,t)}function w(e){return e.displayName||"Context"}function k(e){if(null==e)return null;if("number"==typeof e.tag&&h("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case a:return"Fragment";case n:return"Portal";case i:return"Profiler";case c:return"StrictMode";case p:return"Suspense";case f:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case l:return w(e)+".Consumer";case u:return w(e._context)+".Provider";case d:return function(e,r,t){var s=e.displayName;if(s)return s;var n=r.displayName||r.name||"";return""!==n?t+"("+n+")":t}(e,e.render,"ForwardRef");case g:var r=e.displayName||null;return null!==r?r:k(e.type)||"Memo";case m:var t=e,s=t._payload,o=t._init;try{return k(o(s))}catch(y){return null}}return null}r=Symbol.for("react.module.reference");var _,S,C,E,T,I,j,O=Object.assign,P=0;function x(){}x.__reactDisabledLog=!0;var $,R=b.ReactCurrentDispatcher;function N(e,r,t){if(void 0===$)try{throw Error()}catch(n){var s=n.stack.trim().match(/\n( *(at )?)/);$=s&&s[1]||""}return"\n"+$+e}var D,F=!1,U="function"==typeof WeakMap?WeakMap:Map;function L(e,r){if(!e||F)return"";var t,s=D.get(e);if(void 0!==s)return s;F=!0;var n,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,n=R.current,R.current=null,function(){if(0===P){_=console.log,S=console.info,C=console.warn,E=console.error,T=console.group,I=console.groupCollapsed,j=console.groupEnd;var e={configurable:!0,enumerable:!0,value:x,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}P++}();try{if(r){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(o,[])}catch(g){t=g}Reflect.construct(e,[],o)}else{try{o.call()}catch(g){t=g}e.call(o.prototype)}}else{try{throw Error()}catch(g){t=g}e()}}catch(m){if(m&&t&&"string"==typeof m.stack){for(var c=m.stack.split("\n"),i=t.stack.split("\n"),u=c.length-1,l=i.length-1;u>=1&&l>=0&&c[u]!==i[l];)l--;for(;u>=1&&l>=0;u--,l--)if(c[u]!==i[l]){if(1!==u||1!==l)do{if(u--,--l<0||c[u]!==i[l]){var d="\n"+c[u].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),"function"==typeof e&&D.set(e,d),d}}while(u>=1&&l>=0);break}}}finally{F=!1,R.current=n,function(){if(0===--P){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:O({},e,{value:_}),info:O({},e,{value:S}),warn:O({},e,{value:C}),error:O({},e,{value:E}),group:O({},e,{value:T}),groupCollapsed:O({},e,{value:I}),groupEnd:O({},e,{value:j})})}P<0&&h("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=a}var p=e?e.displayName||e.name:"",f=p?N(p):"";return"function"==typeof e&&D.set(e,f),f}function A(e,r,t){if(null==e)return"";if("function"==typeof e)return L(e,!(!(s=e.prototype)||!s.isReactComponent));var s;if("string"==typeof e)return N(e);switch(e){case p:return N("Suspense");case f:return N("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case d:return L(e.render,!1);case g:return A(e.type,r,t);case m:var n=e,a=n._payload,o=n._init;try{return A(o(a),r,t)}catch(c){}}return""}D=new U;var V=Object.prototype.hasOwnProperty,J={},z=b.ReactDebugCurrentFrame;function W(e){if(e){var r=e._owner,t=A(e.type,e._source,r?r.type:null);z.setExtraStackFrame(t)}else z.setExtraStackFrame(null)}var H=Array.isArray;function B(e){return H(e)}function K(e){return""+e}function M(e){if(function(e){try{return K(e),!1}catch(r){return!0}}(e))return h("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),K(e)}var Y,q,G=b.ReactCurrentOwner,X={key:!0,ref:!0,__self:!0,__source:!0};function Z(e,r,t,n,a){var o,c={},i=null,u=null;for(o in void 0!==t&&(M(t),i=""+t),function(e){if(V.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return void 0!==e.key}(r)&&(M(r.key),i=""+r.key),function(e){if(V.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return void 0!==e.ref}(r)&&(u=r.ref,function(e){"string"==typeof e.ref&&G.current}(r)),r)V.call(r,o)&&!X.hasOwnProperty(o)&&(c[o]=r[o]);if(e&&e.defaultProps){var l=e.defaultProps;for(o in l)void 0===c[o]&&(c[o]=l[o])}if(i||u){var d="function"==typeof e?e.displayName||e.name||"Unknown":e;i&&function(e,r){var t=function(){Y||(Y=!0,h("%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})}(c,d),u&&function(e,r){var t=function(){q||(q=!0,h("%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})}(c,d)}return function(e,r,t,n,a,o,c){var i={$$typeof:s,type:e,key:r,ref:t,props:c,_owner:o,_store:{}};return Object.defineProperty(i._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(i,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(i,"_source",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.freeze&&(Object.freeze(i.props),Object.freeze(i)),i}(e,i,u,a,n,G.current,c)}var Q,ee=b.ReactCurrentOwner,re=b.ReactDebugCurrentFrame;function te(e){if(e){var r=e._owner,t=A(e.type,e._source,r?r.type:null);re.setExtraStackFrame(t)}else re.setExtraStackFrame(null)}function se(e){return"object"==typeof e&&null!==e&&e.$$typeof===s}function ne(){if(ee.current){var e=k(ee.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}Q=!1;var ae={};function oe(e,r){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var t=function(e){var r=ne();if(!r){var t="string"==typeof e?e:e.displayName||e.name;t&&(r="\n\nCheck the top-level render call using <"+t+">.")}return r}(r);if(!ae[t]){ae[t]=!0;var s="";e&&e._owner&&e._owner!==ee.current&&(s=" It was passed a child from "+k(e._owner.type)+"."),te(e),h('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,s),te(null)}}}function ce(e,r){if("object"==typeof e)if(B(e))for(var t=0;t<e.length;t++){var s=e[t];se(s)&&oe(s,r)}else if(se(e))e._store&&(e._store.validated=!0);else if(e){var n=function(e){if(null===e||"object"!=typeof e)return null;var r=v&&e[v]||e["@@iterator"];return"function"==typeof r?r:null}(e);if("function"==typeof n&&n!==e.entries)for(var a,o=n.call(e);!(a=o.next()).done;)se(a.value)&&oe(a.value,r)}}function ie(e){var r,t=e.type;if(null!=t&&"string"!=typeof t){if("function"==typeof t)r=t.propTypes;else{if("object"!=typeof t||t.$$typeof!==d&&t.$$typeof!==g)return;r=t.propTypes}if(r){var s=k(t);!function(e,r,t,s,n){var a=Function.call.bind(V);for(var o in e)if(a(e,o)){var c=void 0;try{if("function"!=typeof e[o]){var i=Error((s||"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 i.name="Invariant Violation",i}c=e[o](r,o,s,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(u){c=u}!c||c instanceof Error||(W(n),h("%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).",s||"React class",t,o,typeof c),W(null)),c instanceof Error&&!(c.message in J)&&(J[c.message]=!0,W(n),h("Failed %s type: %s",t,c.message),W(null))}}(r,e.props,"prop",s,e)}else void 0===t.PropTypes||Q||(Q=!0,h("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",k(t)||"Unknown"));"function"!=typeof t.getDefaultProps||t.getDefaultProps.isReactClassApproved||h("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}var ue={};function le(e,t,n,o,v,b){var w=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===i||e===c||e===p||e===f||e===y||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===g||e.$$typeof===u||e.$$typeof===l||e.$$typeof===d||e.$$typeof===r||void 0!==e.getModuleId)}(e);if(!w){var _,S="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(S+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),S+=ne(),null===e?_="null":B(e)?_="array":void 0!==e&&e.$$typeof===s?(_="<"+(k(e.type)||"Unknown")+" />",S=" Did you accidentally export a JSX literal instead of a component?"):_=typeof e,h("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",_,S)}var C=Z(e,t,n,v,b);if(null==C)return C;if(w){var E=t.children;if(void 0!==E)if(o)if(B(E)){for(var T=0;T<E.length;T++)ce(E[T],e);Object.freeze&&Object.freeze(E)}else h("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 ce(E,e)}if(V.call(t,"key")){var I=k(e),j=Object.keys(t).filter(function(e){return"key"!==e}),O=j.length>0?"{key: someKey, "+j.join(": ..., ")+": ...}":"{key: someKey}";ue[I+O]||(h('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',O,I,j.length>0?"{"+j.join(": ..., ")+": ...}":"{}",I),ue[I+O]=!0)}return e===a?function(e){for(var r=Object.keys(e.props),t=0;t<r.length;t++){var s=r[t];if("children"!==s&&"key"!==s){te(e),h("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",s),te(null);break}}null!==e.ref&&(te(e),h("Invalid attribute `ref` supplied to `React.Fragment`."),te(null))}(C):ie(C),C}var de=function(e,r,t){return le(e,r,t,!1)},pe=function(e,r,t){return le(e,r,t,!0)};o.Fragment=a,o.jsx=de,o.jsxs=pe}()),o);var c=s.exports;const i="https://events.embeddable.co";function u(){const{config:e}=g();if(!e)throw new Error("No Embeddable configuration found. Make sure to wrap your app with EmbeddableProvider and provide a valid config.");return e}const l=()=>{const{widgetId:r,mode:t}=u(),s=`${i}/api`,[n,a]=e.useState(!1),o=e.useCallback(async e=>{if(!r||"preview"===t)return[];const n=[];try{a(!0);const t=(e=>{try{for(let r=0;r<localStorage.length;r++){const t=localStorage.key(r);if(null==t?void 0:t.startsWith(`embeddable_test_${e}_`)){const e=JSON.parse(localStorage.getItem(t)||"{}");if(e.expires&&Date.now()<e.expires)return{testId:e.testId,variantId:e.variantId,isControl:"control"===e.variantId}}}}catch(r){}return null})(r),o=await fetch(`${s}/marketing/track`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify({widgetId:r,capabilityId:"trackEvent",inputs:e,...t&&{testId:t.testId,variantId:t.variantId}})}),c=await o.json();c.success?c.results?c.results.forEach(e=>{n.push({success:e.success,integrationKey:e.integrationKey,data:e.data,error:e.error})}):n.push({success:!0,data:c.data}):n.push({success:!1,error:c.error||"Unknown error"})}catch(o){n.push({success:!1,error:o instanceof Error?o.message:"Network error"})}finally{a(!1)}return n},[r,s,t]),c=e.useCallback(async(e={})=>o({event_name:"page_view",event_category:"engagement",custom_parameters:{page_url:window.location.href,page_title:document.title,referrer:document.referrer,...e}}),[o]),l=e.useCallback(async(e,r={})=>o({event_name:"form_submit",event_category:"conversion",custom_parameters:{form_data:e,...r}}),[o]),d=e.useCallback(async(e,r={})=>{var t;let s={};return s="string"==typeof e?{element_selector:e}:{element_id:e.id,element_class:e.className,element_text:e.textContent||e.innerText,element_tag:null==(t=e.tagName)?void 0:t.toLowerCase()},o({event_name:"button_click",event_category:"interaction",custom_parameters:{...s,...r}})},[o]),p=e.useCallback(async(e,r,t={})=>o({event_name:"conversion",event_category:"conversion",value:r,custom_parameters:{conversion_type:e,currency:t.currency||"USD",...t}}),[o]),f=e.useCallback(async(e,r={})=>o({event_name:"signup",event_category:"conversion",user_data:e,custom_parameters:r}),[o]),g=e.useCallback(async(e,r={})=>o({event_name:"purchase",event_category:"ecommerce",value:e.amount,custom_parameters:{transaction_id:e.id,currency:e.currency||"USD",items:e.items||[],...r}}),[o]),m=e.useCallback(()=>{c()},[c]),y=e.useCallback(()=>{const e=async e=>{try{const r=e.target,t=new FormData(r),s=Object.fromEntries(t.entries());await l(s,{form_id:r.id,form_class:r.className,form_action:r.action,form_method:r.method})}catch(r){}};return document.addEventListener("submit",e),()=>{document.removeEventListener("submit",e)}},[l]),v=e.useCallback((e='button, .btn, [role="button"], a, input[type="submit"]')=>{const r=async r=>{const t=r.target.closest(e);if(t)try{await d(t)}catch(s){}};return document.addEventListener("click",r),()=>{document.removeEventListener("click",r)}},[d]);return{isLoading:n,track:o,trackPageView:c,trackFormSubmit:l,trackClick:d,trackConversion:p,trackSignup:f,trackPurchase:g,enableAutoPageView:m,enableAutoFormTracking:y,enableAutoClickTracking:v}};const d={version:"latest",mode:"embeddable",ignoreCache:!1,lazyLoad:!1,loader:!0,widgetId:"",_containerId:"",_shadowRoot:void 0},p=e.createContext({config:{...d},setConfig:()=>{},data:{},setData:()=>{}});function f(){const{trackPageView:r}=l(),{config:t}=g();return e.useEffect(()=>{(null==t?void 0:t.widgetId)&&"preview"!==(null==t?void 0:t.mode)&&r()},[null==t?void 0:t.widgetId,null==t?void 0:t.mode,r]),null}function g(){const r=e.useContext(p);if(!r)throw new Error("useEmbeddableContext must be used within an EmbeddableProvider");return r}exports.EmbeddableProvider=function({config:r,data:t,children:s}){const[n,a]=e.useState(d),[o,i]=e.useState(t||{});return e.useEffect(()=>{const e={...d,...r};a(e)},[r]),e.useEffect(()=>{const e=e=>{("https://embeddable.co"===e.origin||e.origin.includes("localhost"))&&e.data&&"object"==typeof e.data&&"embeddable-update-data"===e.data.type&&i(e.data.data||{})};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}},[]),c.jsxs(p.Provider,{value:{config:n,setConfig:a,data:o,setData:i},children:[c.jsx(f,{}),s]})},exports.useAI=function(r){const{widgetId:t}=u(),s=e.useRef(r);s.current=r;const[n,a]=e.useState({loading:!1,error:null,success:!1});return{...n,callAI:e.useCallback(async(e,r)=>{var n;a({loading:!0,error:null,success:!1});try{const o={widgetId:t,capabilityId:"aiCall",integrationKey:s.current.platform,prompt:e,history:r||[],inputs:s.current.inputs||{}};"embeddable-ai"!==s.current.platform&&(delete o.inputs.systemPrompt,delete o.inputs.maxTokens);const c=await fetch(`${i}/api/execute/ai`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify(o)}),u=await c.json();if(!c.ok){const e=u.message||u.error||`HTTP ${c.status}`;return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}if(u.success)return a({loading:!1,error:null,success:!0}),{success:!0,message:(null==(n=u.data)?void 0:n.response)||"AI call completed successfully",data:u.data,metadata:u.metadata};{const e=u.message||u.error||"AI call failed";return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}}catch(o){const e=o instanceof Error?o.message:"Unknown error occurred";return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}},[t]),reset:e.useCallback(()=>{a({loading:!1,error:null,success:!1})},[])}},exports.useCalendar=function(r={}){const{widgetId:t}=u(),[s,n]=e.useState({loading:!1,error:null,success:!1}),a=e.useCallback(async(e,s={})=>{var a,o,c,u;n({loading:!0,error:null,success:!1});try{const u={widgetId:t,action:e,...s},l=await fetch(`${i}/api/execute/google-calendar`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify(u)}),d=await l.json();if(!l.ok){const e=d.message||d.error||`HTTP ${l.status}`;return n({loading:!1,error:e,success:!1}),null==(a=r.onError)||a.call(r,e),{success:!1,message:e}}if(d.success)return n({loading:!1,error:null,success:!0}),null==(o=r.onSuccess)||o.call(r,d.data),{success:!0,message:"Calendar operation completed successfully",data:d.data,metadata:d.metadata};{const e=d.message||d.error||"Calendar operation failed";return n({loading:!1,error:e,success:!1}),null==(c=r.onError)||c.call(r,e),{success:!1,message:e}}}catch(l){const e=l instanceof Error?l.message:"Unknown error occurred";return n({loading:!1,error:e,success:!1}),null==(u=r.onError)||u.call(r,e),{success:!1,message:e}}},[t,r]);return{...s,getCalendar:e.useCallback(async()=>a("get_calendar"),[a]),listEvents:e.useCallback(async(e={})=>a("list_events",{options:e}),[a]),getEvent:e.useCallback(async e=>a("get_event",{eventId:e}),[a]),createEvent:e.useCallback(async e=>a("create_event",{eventData:e}),[a]),updateEvent:e.useCallback(async(e,r)=>a("update_event",{eventId:e,eventData:r}),[a]),deleteEvent:e.useCallback(async e=>a("delete_event",{eventId:e}),[a]),getFreeBusy:e.useCallback(async e=>a("get_freebusy",{options:e}),[a]),reset:e.useCallback(()=>{n({loading:!1,error:null,success:!1})},[])}},exports.useDataIntegration=function(r={}){const{widgetId:t}=u(),s=e.useRef(r);s.current=r;const[n,a]=e.useState({loading:!1,error:null,success:!1});return{...n,fetchData:e.useCallback(async()=>{a({loading:!0,error:null,success:!1});try{const e={widgetId:t,capabilityId:s.current.capabilityId||"fetchData",integrationKey:s.current.integrationKey||"sheets"},r=await fetch(`${i}/api/execute/data`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify(e)}),n=await r.json();if(!r.ok){const e=n.message||n.error||`HTTP ${r.status}`;return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}if(n.success)return a({loading:!1,error:null,success:!0}),{success:!0,message:"Data fetched successfully",data:n.data,metadata:n.metadata};{const e=n.message||n.error||"Data fetch failed";return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}}catch(e){const r=e instanceof Error?e.message:"Unknown error occurred";return a({loading:!1,error:r,success:!1}),{success:!1,message:r}}},[t]),reset:e.useCallback(()=>{a({loading:!1,error:null,success:!1})},[])}},exports.useDebounce=function(r,t){const[s,n]=e.useState(r);return e.useEffect(()=>{const e=setTimeout(()=>{n(r)},t);return()=>{clearTimeout(e)}},[r,t]),s},exports.useEmbeddableConfig=u,exports.useEmbeddableContext=g,exports.useEmbeddableData=function(){const{data:e}=g();return{data:e}},exports.useEventTracking=l,exports.useFileUpload=function(){const{widgetId:r}=u(),[t,s]=e.useState({loading:!1,error:null,success:!1});return{...t,uploadFile:e.useCallback(async e=>{s({loading:!0,error:null,success:!1});try{const t=new FormData;t.append("file",e),t.append("widgetId",r);const n=await fetch(`${i}/api/execute/uploads`,{method:"POST",credentials:"omit",body:t}),a=await n.json();if(!n.ok){const e=a.message||a.error||`HTTP ${n.status}`;return s({loading:!1,error:e,success:!1}),{success:!1,message:e}}if(a.success)return s({loading:!1,error:null,success:!0}),{success:!0,message:a.message||"File uploaded successfully",data:a.data};{const e=a.message||a.error||"File upload failed";return s({loading:!1,error:e,success:!1}),{success:!1,message:e}}}catch(t){const e=t instanceof Error?t.message:"Unknown error occurred";return s({loading:!1,error:e,success:!1}),{success:!1,message:e}}},[r]),reset:e.useCallback(()=>{s({loading:!1,error:null,success:!1})},[])}},exports.useFormSubmission=function(r){const{widgetId:t}=u(),s=e.useRef(r);s.current=r;const[n,a]=e.useState({loading:!1,error:null,success:!1});return{...n,submit:e.useCallback(async e=>{var r,n,o,c,u;a({loading:!0,error:null,success:!1});try{if(null==(r=s.current)?void 0:r.validatePayload){const r=s.current.validatePayload(e);if(r)return a({loading:!1,error:r,success:!1}),{success:!1,message:r}}const l={payload:e,widgetId:t,collectionName:(null==(n=s.current)?void 0:n.collectionName)||"submissions"},d=await fetch(`${i}/api/submissions`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify(l)}),p=await d.json();if(!d.ok){const e=p.message||p.error||`HTTP ${d.status}`;return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}if(p.success)return a({loading:!1,error:null,success:!0}),{id:(null==(o=p.data)?void 0:o.id)||(null==(c=p.data)?void 0:c._id),success:!0,message:(null==(u=p.data)?void 0:u.message)||"Submission successful"};{const e=p.message||p.error||"Submission failed";return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}}catch(l){const e=l instanceof Error?l.message:"Unknown error occurred";return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}},[t]),reset:e.useCallback(()=>{a({loading:!1,error:null,success:!1})},[])}},exports.useLocalStorage=function(t,s,n={}){const{widgetId:a}=u(),o=e.useMemo(()=>({...n,prefix:`embd-${a}-${n.prefix||""}`}),[a,n]),[c,i]=e.useState(()=>{const e=r.storage.get(t,o);return null!==e?e:s}),l=e.useCallback(e=>{try{const s=e instanceof Function?e(c):e;i(s),r.storage.set(t,s,o)}catch(s){}},[t,c,o]),d=e.useCallback(()=>{try{i(s),r.storage.remove(t,o)}catch(e){}},[t,s,o]);return e.useEffect(()=>{const e=e=>{const r=o.prefix+t;if(e.key===r&&null!==e.newValue)try{const{deserialize:r=JSON.parse}=o,t=r(e.newValue);i(t)}catch(s){}};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[t,o]),[c,l,d]},exports.usePayment=function(r={}){const{widgetId:t}=u(),s=e.useRef(r);s.current=r;const[n,a]=e.useState({loading:!1,error:null,success:!1}),o=e.useRef(null);e.useEffect(()=>()=>{o.current&&window.clearInterval(o.current)},[]);const c=e.useCallback(async e=>{var r,n,c,u;try{const l=await fetch(`${i}/api/execute/payments/session/${e}?widgetId=${t}`,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"omit"}),d=await l.json();if(!l.ok)return;if(d.success&&d.session){const{status:e,payment_status:t}=d.session;"paid"===t&&"complete"===e?(o.current&&(window.clearInterval(o.current),o.current=null),a({loading:!1,error:null,success:!0}),null==(n=(r=s.current).onSuccess)||n.call(r,d.session)):"expired"===e&&(o.current&&(window.clearInterval(o.current),o.current=null),a({loading:!1,error:"Payment session expired",success:!1}),null==(u=(c=s.current).onFailure)||u.call(c,d.session))}}catch(l){}},[t]),l=e.useCallback(e=>{o.current&&window.clearInterval(o.current),o.current=window.setInterval(()=>{c(e)},1e4),c(e)},[c]);return{...n,createCheckout:e.useCallback(async e=>{var r;a({loading:!0,error:null,success:!1});try{const n={widgetId:t,capabilityId:s.current.capabilityId||"getCheckout",integrationKey:s.current.integrationKey||"stripe",inputs:e},o=await fetch(`${i}/api/execute/payments`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify(n)}),c=await o.json();if(!o.ok){const e=c.message||c.error||`HTTP ${o.status}`;return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}if(c.success)return(null==(r=c.data)?void 0:r.sessionId)&&l(c.data.sessionId),a({loading:!1,error:null,success:!1}),{success:!0,message:"Checkout session created successfully",data:c.data,metadata:c.metadata};{const e=c.message||c.error||"Payment checkout failed";return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}}catch(n){const e=n instanceof Error?n.message:"Unknown error occurred";return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}},[t,l]),reset:e.useCallback(()=>{o.current&&(window.clearInterval(o.current),o.current=null),a({loading:!1,error:null,success:!1})},[])}},exports.usePublicSubmissions=function(r){const{widgetId:t}=u(),s=e.useRef(r);s.current=r;const[n,a]=e.useState({loading:!1,error:null,data:null,pagination:null}),o=e.useCallback(async e=>{a(e=>({...e,loading:!0,error:null}));try{const r={...s.current,...e},n=new URLSearchParams;n.append("widgetId",t),(null==r?void 0:r.collectionName)&&n.append("collectionName",r.collectionName),n.append("page",String((null==r?void 0:r.page)||1)),n.append("limit",String((null==r?void 0:r.limit)||10)),n.append("sortBy",(null==r?void 0:r.sortBy)||"createdAt"),n.append("sortOrder",(null==r?void 0:r.sortOrder)||"desc"),(null==r?void 0:r.fromDate)&&n.append("fromDate",r.fromDate),(null==r?void 0:r.toDate)&&n.append("toDate",r.toDate);const o=await fetch(`${i}/api/submissions/public?${n.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"},credentials:"omit"}),c=await o.json();if(!o.ok){const e=c.message||c.error||`HTTP ${o.status}`;return a(r=>({...r,loading:!1,error:e})),{success:!1,data:[],pagination:{page:1,limit:10,total:0,pages:0},message:e}}if(c.success)return a(e=>({...e,loading:!1,error:null,data:c.data||[],pagination:c.pagination||{page:1,limit:10,total:0,pages:0}})),{success:!0,data:c.data||[],pagination:c.pagination||{page:1,limit:10,total:0,pages:0}};{const e=c.message||c.error||"Failed to fetch submissions";return a(r=>({...r,loading:!1,error:e})),{success:!1,data:[],pagination:{page:1,limit:10,total:0,pages:0},message:e}}}catch(r){const e=r instanceof Error?r.message:"Unknown error occurred";return a(r=>({...r,loading:!1,error:e})),{success:!1,data:[],pagination:{page:1,limit:10,total:0,pages:0},message:e}}},[t]),c=e.useCallback(()=>{a({loading:!1,error:null,data:null,pagination:null})},[]);return e.useEffect(()=>{const e=s.current;e&&void 0===e.page&&void 0===e.limit||o()},[o]),{...n,fetchSubmissions:o,reset:c}},exports.useScraping=function(){const{widgetId:r}=u(),[t,s]=e.useState({loading:!1,error:null,success:!1});return{...t,scrapeWebsite:e.useCallback(async e=>{s({loading:!0,error:null,success:!1});try{const t={url:e.url,format:e.format||"markdown",options:e.options||{},widgetId:r},n=await fetch(`${i}/api/execute/scraping`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify(t)}),a=await n.json();if(!n.ok){const e=a.message||a.error||`HTTP ${n.status}`;return s({loading:!1,error:e,success:!1}),{success:!1,message:e}}if(a.success)return s({loading:!1,error:null,success:!0}),{success:!0,message:"Website scraped successfully",data:a.data,metadata:a.metadata};{const e=a.message||a.error||"Scraping failed";return s({loading:!1,error:e,success:!1}),{success:!1,message:e}}}catch(t){const e=t instanceof Error?t.message:"Unknown error occurred";return s({loading:!1,error:e,success:!1}),{success:!1,message:e}}},[r]),reset:e.useCallback(()=>{s({loading:!1,error:null,success:!1})},[])}},exports.useVote=function(r){const{widgetId:t}=u(),s=e.useRef(r);s.current=r;const[n,a]=e.useState({loading:!1,error:null,success:!1});return{...n,vote:e.useCallback(async e=>{var r,n,o,c;a({loading:!0,error:null,success:!1});try{const u={voteFor:e,widgetId:t,collectionName:(null==(r=s.current)?void 0:r.collectionName)||"votes"},l=await fetch(`${i}/api/votes`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify(u)}),d=await l.json();if(!l.ok){const e=d.message||d.error||`HTTP ${l.status}`;return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}if(d.success)return a({loading:!1,error:null,success:!0}),{id:(null==(n=d.data)?void 0:n.id)||(null==(o=d.data)?void 0:o._id),success:!0,message:(null==(c=d.data)?void 0:c.message)||"Vote submitted successfully"};{const e=d.message||d.error||"Vote submission failed";return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}}catch(u){const e=u instanceof Error?u.message:"Unknown error occurred";return a({loading:!1,error:e,success:!1}),{success:!1,message:e}}},[t]),reset:e.useCallback(()=>{a({loading:!1,error:null,success:!1})},[])}},exports.useVoteAggregations=function(r){const{widgetId:t}=u(),s=e.useRef(r);s.current=r;const[n,a]=e.useState({data:null,loading:!1,error:null}),o=e.useCallback(async()=>{var e;if(!t)return a({data:null,loading:!1,error:"Widget ID is required"}),{success:!1,data:{results:[],summary:{totalVotes:0,totalOptions:0,groupBy:""}}};a(e=>({...e,loading:!0,error:null}));try{const r=(null==(e=s.current)?void 0:e.collectionName)||"votes",n=new URL(`${i}/api/votes/aggregations`);n.searchParams.append("widgetId",t),n.searchParams.append("collectionName",r);const o=await fetch(n.toString(),{method:"GET",headers:{"Content-Type":"application/json"},credentials:"omit"}),c=await o.json();if(!o.ok){const e=c.message||c.error||`HTTP ${o.status}`;return a({data:null,loading:!1,error:e}),{success:!1,data:{results:[],summary:{totalVotes:0,totalOptions:0,groupBy:""}}}}return a({data:c.data,loading:!1,error:null}),c}catch(r){const e=r instanceof Error?r.message:"Unknown error occurred";return a({data:null,loading:!1,error:e}),{success:!1,data:{results:[],summary:{totalVotes:0,totalOptions:0,groupBy:""}}}}},[t]),c=e.useCallback(()=>o(),[o]),l=e.useCallback(()=>{a({data:null,loading:!1,error:null})},[]);return e.useEffect(()=>{const e=s.current;!1!==(null==e?void 0:e.autoFetch)&&t&&o()},[o,t]),e.useEffect(()=>{const e=s.current;if((null==e?void 0:e.refetchInterval)&&e.refetchInterval>0&&t){const r=setInterval(()=>{o()},e.refetchInterval);return()=>clearInterval(r)}},[o,t]),{...n,fetch:o,refetch:c,reset:l}},exports.useYouTube=function(){const{widgetId:r}=u(),[t,s]=e.useState({loading:!1,error:null,success:!1}),n=e.useCallback(async e=>{s({loading:!0,error:null,success:!1});try{const t={widgetId:r,url:e.url,action:e.action,options:e.options||{}},n=await fetch(`${i}/api/execute/youtube`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify(t)}),a=await n.json();if(!n.ok){const e=a.message||a.error||`HTTP ${n.status}`;return s({loading:!1,error:e,success:!1}),{success:!1,message:e}}if(a.success)return s({loading:!1,error:null,success:!0}),{success:!0,message:"YouTube video analyzed successfully",data:a.data,metadata:a.metadata};{const e=a.message||a.error||"YouTube analysis failed";return s({loading:!1,error:e,success:!1}),{success:!1,message:e}}}catch(t){const e=t instanceof Error?t.message:"Unknown error occurred";return s({loading:!1,error:e,success:!1}),{success:!1,message:e}}},[r]),a=e.useCallback(async(e,r)=>n({url:e,action:"summarize",options:r}),[n]),o=e.useCallback(async e=>n({url:e,action:"transcript"}),[n]),c=e.useCallback(async e=>n({url:e,action:"stats"}),[n]),l=e.useCallback(()=>{s({loading:!1,error:null,success:!1})},[]);return{...t,analyzeVideo:n,summarizeVideo:a,getTranscript:o,getStats:c,reset:l}},exports.useZoom=function(r={}){const{widgetId:t}=u(),[s,n]=e.useState({loading:!1,error:null,success:!1});return{...s,createMeeting:e.useCallback(async(e={})=>{var s,a,o,c;n({loading:!0,error:null,success:!1});try{const c={widgetId:t,options:e},u=await fetch(`${i}/api/execute/zoom`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify(c)}),l=await u.json();if(!u.ok){const e=l.message||l.error||`HTTP ${u.status}`;return n({loading:!1,error:e,success:!1}),null==(s=r.onError)||s.call(r,e),{success:!1,message:e}}if(l.success)return n({loading:!1,error:null,success:!0}),null==(a=r.onSuccess)||a.call(r,l.data),{success:!0,message:"Zoom meeting created successfully",data:l.data};{const e=l.message||l.error||"Failed to create Zoom meeting";return n({loading:!1,error:e,success:!1}),null==(o=r.onError)||o.call(r,e),{success:!1,message:e}}}catch(u){const e=u instanceof Error?u.message:"Unknown error occurred";return n({loading:!1,error:e,success:!1}),null==(c=r.onError)||c.call(r,e),{success:!1,message:e}}},[t,r]),reset:e.useCallback(()=>{n({loading:!1,error:null,success:!1})},[])}};
|