@bunnyapp/components 1.5.0-beta.4 → 1.5.0-beta.6

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/cjs/index.js CHANGED
@@ -154,7 +154,7 @@ var BrandContext = react.createContext({
154
154
  });
155
155
 
156
156
  // This will be replaced at build time by rollup-plugin-replace
157
- var PACKAGE_VERSION = '1.5.0-beta.3';
157
+ var PACKAGE_VERSION = '1.5.0-beta.5';
158
158
  var createRequestHeaders = function (token) {
159
159
  var headers = createClientDevHeaders({ token: token });
160
160
  // Add the components version header
@@ -266,7 +266,8 @@ function ContextualWrapper(_a) {
266
266
  var branding = reactQuery.useQuery({
267
267
  queryKey: common.QueryKeyFactory.default.brandingKey(token),
268
268
  queryFn: function () { return getBranding({ token: token, apiHost: apiHost }); },
269
- staleTime: 1000 * 60 * 5, // 5 minutes
269
+ staleTime: 1000 * 60 * 5,
270
+ enabled: !!token && !!apiHost,
270
271
  }).data;
271
272
  var isMobile = common.useIsMobile();
272
273
  var entityBranding = react.useMemo(function () {
@@ -19587,18 +19588,19 @@ var useIsExpired = function (expiresAt) {
19587
19588
  return dayjs(expiresAt).diff(dayjs(dayjs().format("YYYY-MM-DD"))) < 0;
19588
19589
  };
19589
19590
 
19591
+ var POLLING_INTERVAL = 2000;
19590
19592
  var PandadocPollingModal = function (_a) {
19591
19593
  var isVisible = _a.isVisible, setVisible = _a.setVisible, id = _a.id;
19592
19594
  var _b = react.useContext(BunnyContext), apiHost = _b.apiHost, onTokenExpired = _b.onTokenExpired;
19593
19595
  var token = useToken();
19594
19596
  var graphQLMutation = common.useGraphQLmutation(function () {
19595
- console.log("graphQLMutation navigateOnTokenExpired not yet implemented");
19596
- }, apiHost || "", function () {
19597
- console.log("graphQLMutation onError not yet implemented");
19597
+ console.log('graphQLMutation navigateOnTokenExpired not yet implemented');
19598
+ }, apiHost || '', function () {
19599
+ console.log('graphQLMutation onError not yet implemented');
19598
19600
  });
19599
19601
  var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
19600
19602
  var _c = react.useState(0), numberOfPolls = _c[0], setNumberOfPolls = _c[1];
19601
- var _d = react.useState(""), infoMessage = _d[0], setInfoMessage = _d[1];
19603
+ var _d = react.useState(''), infoMessage = _d[0], setInfoMessage = _d[1];
19602
19604
  react.useEffect(function () {
19603
19605
  if (!isVisible)
19604
19606
  return;
@@ -19610,15 +19612,15 @@ var PandadocPollingModal = function (_a) {
19610
19612
  graphQLMutation(mutation, variables, function (rsp) {
19611
19613
  if (rsp.errors)
19612
19614
  handleAllErrorFormats(rsp.errors);
19613
- else if (rsp.data.quotePollSigningUrl.status === "document.sent") {
19615
+ else if (rsp.data.quotePollSigningUrl.status === 'document.sent') {
19614
19616
  setVisible(false);
19615
19617
  window.location.href = rsp.data.quotePollSigningUrl.redirectUri;
19616
19618
  }
19617
- setInfoMessage(rsp.data.quotePollSigningUrl.infoMessage || "");
19619
+ setInfoMessage(rsp.data.quotePollSigningUrl.infoMessage || '');
19618
19620
  }, token);
19619
19621
  setNumberOfPolls(numberOfPolls + 1);
19620
19622
  };
19621
- var interval = setInterval(pollPandadocMutation, 1000);
19623
+ var interval = setInterval(pollPandadocMutation, POLLING_INTERVAL);
19622
19624
  return function () { return clearInterval(interval); };
19623
19625
  }, [
19624
19626
  graphQLMutation,
@@ -19628,7 +19630,7 @@ var PandadocPollingModal = function (_a) {
19628
19630
  isVisible,
19629
19631
  setVisible,
19630
19632
  ]);
19631
- return (jsxRuntime.jsxs(antd.Modal, __assign({ title: "Uploading quote to Pandadoc", open: isVisible, closable: false, footer: null }, { children: [jsxRuntime.jsxs("div", __assign({ className: "bunny-py-4 bunny-text-center" }, { children: ["This may take a few seconds", ".".repeat(numberOfPolls)] })), jsxRuntime.jsx("div", __assign({ className: "bunny-text-center" }, { children: infoMessage }))] })));
19633
+ return (jsxRuntime.jsxs(antd.Modal, __assign({ title: "Uploading quote to Pandadoc", open: isVisible, closable: false, footer: null }, { children: [jsxRuntime.jsxs("div", __assign({ className: "bunny-py-4 bunny-text-center" }, { children: ["This may take a few seconds", '.'.repeat(numberOfPolls)] })), jsxRuntime.jsx("div", __assign({ className: "bunny-text-center" }, { children: infoMessage }))] })));
19632
19634
  };
19633
19635
 
19634
19636
  var ModalOverrideBrandStylings = defaultStyled(antd.Modal)(templateObject_1$8 || (templateObject_1$8 = __makeTemplateObject(["\n .ant-modal-content {\n border-radius: 0.75rem;\n overflow: hidden;\n padding: 0 !important;\n }\n\n .ant-modal-header {\n border-bottom: none;\n padding: 1.5rem 1.5rem 0;\n margin: 0 !important;\n }\n .ant-modal-body {\n padding: 1rem 1.5rem 1.5rem;\n }\n .ant-modal-footer {\n border-top: none;\n padding: 0 1.5rem 1.5rem;\n margin: 0 !important;\n }\n"], ["\n .ant-modal-content {\n border-radius: 0.75rem;\n overflow: hidden;\n padding: 0 !important;\n }\n\n .ant-modal-header {\n border-bottom: none;\n padding: 1.5rem 1.5rem 0;\n margin: 0 !important;\n }\n .ant-modal-body {\n padding: 1rem 1.5rem 1.5rem;\n }\n .ant-modal-footer {\n border-top: none;\n padding: 0 1.5rem 1.5rem;\n margin: 0 !important;\n }\n"])));
@@ -3,5 +3,5 @@ interface PandadocPollingModalProps {
3
3
  setVisible: (visible: boolean) => void;
4
4
  id?: string;
5
5
  }
6
- declare const PandadocPollingModal: ({ isVisible, setVisible, id, }: PandadocPollingModalProps) => import("react/jsx-runtime").JSX.Element;
6
+ declare const PandadocPollingModal: ({ isVisible, setVisible, id }: PandadocPollingModalProps) => import("react/jsx-runtime").JSX.Element;
7
7
  export default PandadocPollingModal;
package/dist/esm/index.js CHANGED
@@ -143,7 +143,7 @@ var BrandContext = createContext({
143
143
  });
144
144
 
145
145
  // This will be replaced at build time by rollup-plugin-replace
146
- var PACKAGE_VERSION = '1.5.0-beta.3';
146
+ var PACKAGE_VERSION = '1.5.0-beta.5';
147
147
  var createRequestHeaders = function (token) {
148
148
  var headers = createClientDevHeaders({ token: token });
149
149
  // Add the components version header
@@ -255,7 +255,8 @@ function ContextualWrapper(_a) {
255
255
  var branding = useQuery({
256
256
  queryKey: QueryKeyFactory.default.brandingKey(token),
257
257
  queryFn: function () { return getBranding({ token: token, apiHost: apiHost }); },
258
- staleTime: 1000 * 60 * 5, // 5 minutes
258
+ staleTime: 1000 * 60 * 5,
259
+ enabled: !!token && !!apiHost,
259
260
  }).data;
260
261
  var isMobile = useIsMobile();
261
262
  var entityBranding = useMemo(function () {
@@ -19576,18 +19577,19 @@ var useIsExpired = function (expiresAt) {
19576
19577
  return dayjs(expiresAt).diff(dayjs(dayjs().format("YYYY-MM-DD"))) < 0;
19577
19578
  };
19578
19579
 
19580
+ var POLLING_INTERVAL = 2000;
19579
19581
  var PandadocPollingModal = function (_a) {
19580
19582
  var isVisible = _a.isVisible, setVisible = _a.setVisible, id = _a.id;
19581
19583
  var _b = useContext(BunnyContext), apiHost = _b.apiHost, onTokenExpired = _b.onTokenExpired;
19582
19584
  var token = useToken();
19583
19585
  var graphQLMutation = useGraphQLmutation(function () {
19584
- console.log("graphQLMutation navigateOnTokenExpired not yet implemented");
19585
- }, apiHost || "", function () {
19586
- console.log("graphQLMutation onError not yet implemented");
19586
+ console.log('graphQLMutation navigateOnTokenExpired not yet implemented');
19587
+ }, apiHost || '', function () {
19588
+ console.log('graphQLMutation onError not yet implemented');
19587
19589
  });
19588
19590
  var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
19589
19591
  var _c = useState(0), numberOfPolls = _c[0], setNumberOfPolls = _c[1];
19590
- var _d = useState(""), infoMessage = _d[0], setInfoMessage = _d[1];
19592
+ var _d = useState(''), infoMessage = _d[0], setInfoMessage = _d[1];
19591
19593
  useEffect(function () {
19592
19594
  if (!isVisible)
19593
19595
  return;
@@ -19599,15 +19601,15 @@ var PandadocPollingModal = function (_a) {
19599
19601
  graphQLMutation(mutation, variables, function (rsp) {
19600
19602
  if (rsp.errors)
19601
19603
  handleAllErrorFormats(rsp.errors);
19602
- else if (rsp.data.quotePollSigningUrl.status === "document.sent") {
19604
+ else if (rsp.data.quotePollSigningUrl.status === 'document.sent') {
19603
19605
  setVisible(false);
19604
19606
  window.location.href = rsp.data.quotePollSigningUrl.redirectUri;
19605
19607
  }
19606
- setInfoMessage(rsp.data.quotePollSigningUrl.infoMessage || "");
19608
+ setInfoMessage(rsp.data.quotePollSigningUrl.infoMessage || '');
19607
19609
  }, token);
19608
19610
  setNumberOfPolls(numberOfPolls + 1);
19609
19611
  };
19610
- var interval = setInterval(pollPandadocMutation, 1000);
19612
+ var interval = setInterval(pollPandadocMutation, POLLING_INTERVAL);
19611
19613
  return function () { return clearInterval(interval); };
19612
19614
  }, [
19613
19615
  graphQLMutation,
@@ -19617,7 +19619,7 @@ var PandadocPollingModal = function (_a) {
19617
19619
  isVisible,
19618
19620
  setVisible,
19619
19621
  ]);
19620
- return (jsxs(Modal, __assign({ title: "Uploading quote to Pandadoc", open: isVisible, closable: false, footer: null }, { children: [jsxs("div", __assign({ className: "bunny-py-4 bunny-text-center" }, { children: ["This may take a few seconds", ".".repeat(numberOfPolls)] })), jsx("div", __assign({ className: "bunny-text-center" }, { children: infoMessage }))] })));
19622
+ return (jsxs(Modal, __assign({ title: "Uploading quote to Pandadoc", open: isVisible, closable: false, footer: null }, { children: [jsxs("div", __assign({ className: "bunny-py-4 bunny-text-center" }, { children: ["This may take a few seconds", '.'.repeat(numberOfPolls)] })), jsx("div", __assign({ className: "bunny-text-center" }, { children: infoMessage }))] })));
19621
19623
  };
19622
19624
 
19623
19625
  var ModalOverrideBrandStylings = defaultStyled(Modal)(templateObject_1$8 || (templateObject_1$8 = __makeTemplateObject(["\n .ant-modal-content {\n border-radius: 0.75rem;\n overflow: hidden;\n padding: 0 !important;\n }\n\n .ant-modal-header {\n border-bottom: none;\n padding: 1.5rem 1.5rem 0;\n margin: 0 !important;\n }\n .ant-modal-body {\n padding: 1rem 1.5rem 1.5rem;\n }\n .ant-modal-footer {\n border-top: none;\n padding: 0 1.5rem 1.5rem;\n margin: 0 !important;\n }\n"], ["\n .ant-modal-content {\n border-radius: 0.75rem;\n overflow: hidden;\n padding: 0 !important;\n }\n\n .ant-modal-header {\n border-bottom: none;\n padding: 1.5rem 1.5rem 0;\n margin: 0 !important;\n }\n .ant-modal-body {\n padding: 1rem 1.5rem 1.5rem;\n }\n .ant-modal-footer {\n border-top: none;\n padding: 0 1.5rem 1.5rem;\n margin: 0 !important;\n }\n"])));
@@ -3,5 +3,5 @@ interface PandadocPollingModalProps {
3
3
  setVisible: (visible: boolean) => void;
4
4
  id?: string;
5
5
  }
6
- declare const PandadocPollingModal: ({ isVisible, setVisible, id, }: PandadocPollingModalProps) => import("react/jsx-runtime").JSX.Element;
6
+ declare const PandadocPollingModal: ({ isVisible, setVisible, id }: PandadocPollingModalProps) => import("react/jsx-runtime").JSX.Element;
7
7
  export default PandadocPollingModal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/components",
3
- "version": "1.5.0-beta.4",
3
+ "version": "1.5.0-beta.6",
4
4
  "description": "Components from the Bunny portal to embed Bunny UI functionality into your application.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",