@bunnyapp/components 1.5.0-beta.5 → 1.5.0-beta.7

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.4';
157
+ var PACKAGE_VERSION = '1.5.0-beta.6';
158
158
  var createRequestHeaders = function (token) {
159
159
  var headers = createClientDevHeaders({ token: token });
160
160
  // Add the components version header
@@ -19588,18 +19588,19 @@ var useIsExpired = function (expiresAt) {
19588
19588
  return dayjs(expiresAt).diff(dayjs(dayjs().format("YYYY-MM-DD"))) < 0;
19589
19589
  };
19590
19590
 
19591
+ var POLLING_INTERVAL = 2000;
19591
19592
  var PandadocPollingModal = function (_a) {
19592
19593
  var isVisible = _a.isVisible, setVisible = _a.setVisible, id = _a.id;
19593
19594
  var _b = react.useContext(BunnyContext), apiHost = _b.apiHost, onTokenExpired = _b.onTokenExpired;
19594
19595
  var token = useToken();
19595
19596
  var graphQLMutation = common.useGraphQLmutation(function () {
19596
- console.log("graphQLMutation navigateOnTokenExpired not yet implemented");
19597
- }, apiHost || "", function () {
19598
- 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');
19599
19600
  });
19600
19601
  var handleAllErrorFormats = common.useAllErrorFormats(onTokenExpired);
19601
19602
  var _c = react.useState(0), numberOfPolls = _c[0], setNumberOfPolls = _c[1];
19602
- var _d = react.useState(""), infoMessage = _d[0], setInfoMessage = _d[1];
19603
+ var _d = react.useState(''), infoMessage = _d[0], setInfoMessage = _d[1];
19603
19604
  react.useEffect(function () {
19604
19605
  if (!isVisible)
19605
19606
  return;
@@ -19611,15 +19612,15 @@ var PandadocPollingModal = function (_a) {
19611
19612
  graphQLMutation(mutation, variables, function (rsp) {
19612
19613
  if (rsp.errors)
19613
19614
  handleAllErrorFormats(rsp.errors);
19614
- else if (rsp.data.quotePollSigningUrl.status === "document.sent") {
19615
+ else if (rsp.data.quotePollSigningUrl.status === 'document.sent') {
19615
19616
  setVisible(false);
19616
19617
  window.location.href = rsp.data.quotePollSigningUrl.redirectUri;
19617
19618
  }
19618
- setInfoMessage(rsp.data.quotePollSigningUrl.infoMessage || "");
19619
+ setInfoMessage(rsp.data.quotePollSigningUrl.infoMessage || '');
19619
19620
  }, token);
19620
19621
  setNumberOfPolls(numberOfPolls + 1);
19621
19622
  };
19622
- var interval = setInterval(pollPandadocMutation, 1000);
19623
+ var interval = setInterval(pollPandadocMutation, POLLING_INTERVAL);
19623
19624
  return function () { return clearInterval(interval); };
19624
19625
  }, [
19625
19626
  graphQLMutation,
@@ -19629,7 +19630,7 @@ var PandadocPollingModal = function (_a) {
19629
19630
  isVisible,
19630
19631
  setVisible,
19631
19632
  ]);
19632
- 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 }))] })));
19633
19634
  };
19634
19635
 
19635
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"])));
@@ -22923,8 +22924,11 @@ var isPriceListDisabled = function (_a) {
22923
22924
  !canPurchaseFeatureAddons &&
22924
22925
  !canPurchasePlanAddons);
22925
22926
  }
22927
+ else if (existingSubscriptionInTrialExpired) {
22928
+ return true;
22929
+ }
22926
22930
  else {
22927
- return existingSubscriptionInTrialExpired !== undefined;
22931
+ return false;
22928
22932
  }
22929
22933
  };
22930
22934
 
@@ -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.4';
146
+ var PACKAGE_VERSION = '1.5.0-beta.6';
147
147
  var createRequestHeaders = function (token) {
148
148
  var headers = createClientDevHeaders({ token: token });
149
149
  // Add the components version header
@@ -19577,18 +19577,19 @@ var useIsExpired = function (expiresAt) {
19577
19577
  return dayjs(expiresAt).diff(dayjs(dayjs().format("YYYY-MM-DD"))) < 0;
19578
19578
  };
19579
19579
 
19580
+ var POLLING_INTERVAL = 2000;
19580
19581
  var PandadocPollingModal = function (_a) {
19581
19582
  var isVisible = _a.isVisible, setVisible = _a.setVisible, id = _a.id;
19582
19583
  var _b = useContext(BunnyContext), apiHost = _b.apiHost, onTokenExpired = _b.onTokenExpired;
19583
19584
  var token = useToken();
19584
19585
  var graphQLMutation = useGraphQLmutation(function () {
19585
- console.log("graphQLMutation navigateOnTokenExpired not yet implemented");
19586
- }, apiHost || "", function () {
19587
- 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');
19588
19589
  });
19589
19590
  var handleAllErrorFormats = useAllErrorFormats(onTokenExpired);
19590
19591
  var _c = useState(0), numberOfPolls = _c[0], setNumberOfPolls = _c[1];
19591
- var _d = useState(""), infoMessage = _d[0], setInfoMessage = _d[1];
19592
+ var _d = useState(''), infoMessage = _d[0], setInfoMessage = _d[1];
19592
19593
  useEffect(function () {
19593
19594
  if (!isVisible)
19594
19595
  return;
@@ -19600,15 +19601,15 @@ var PandadocPollingModal = function (_a) {
19600
19601
  graphQLMutation(mutation, variables, function (rsp) {
19601
19602
  if (rsp.errors)
19602
19603
  handleAllErrorFormats(rsp.errors);
19603
- else if (rsp.data.quotePollSigningUrl.status === "document.sent") {
19604
+ else if (rsp.data.quotePollSigningUrl.status === 'document.sent') {
19604
19605
  setVisible(false);
19605
19606
  window.location.href = rsp.data.quotePollSigningUrl.redirectUri;
19606
19607
  }
19607
- setInfoMessage(rsp.data.quotePollSigningUrl.infoMessage || "");
19608
+ setInfoMessage(rsp.data.quotePollSigningUrl.infoMessage || '');
19608
19609
  }, token);
19609
19610
  setNumberOfPolls(numberOfPolls + 1);
19610
19611
  };
19611
- var interval = setInterval(pollPandadocMutation, 1000);
19612
+ var interval = setInterval(pollPandadocMutation, POLLING_INTERVAL);
19612
19613
  return function () { return clearInterval(interval); };
19613
19614
  }, [
19614
19615
  graphQLMutation,
@@ -19618,7 +19619,7 @@ var PandadocPollingModal = function (_a) {
19618
19619
  isVisible,
19619
19620
  setVisible,
19620
19621
  ]);
19621
- 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 }))] })));
19622
19623
  };
19623
19624
 
19624
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"])));
@@ -22912,8 +22913,11 @@ var isPriceListDisabled = function (_a) {
22912
22913
  !canPurchaseFeatureAddons &&
22913
22914
  !canPurchasePlanAddons);
22914
22915
  }
22916
+ else if (existingSubscriptionInTrialExpired) {
22917
+ return true;
22918
+ }
22915
22919
  else {
22916
- return existingSubscriptionInTrialExpired !== undefined;
22920
+ return false;
22917
22921
  }
22918
22922
  };
22919
22923
 
@@ -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.5",
3
+ "version": "1.5.0-beta.7",
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",