@bigbinary/neeto-thank-you-frontend 1.0.7 → 1.0.8

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/index.cjs.js CHANGED
@@ -13682,7 +13682,7 @@ const SvgBrowserControls = props => /*#__PURE__*/React__namespace.createElement(
13682
13682
 
13683
13683
  var SocialShare = function SocialShare(_ref) {
13684
13684
  var socialHandles = _ref.socialHandles,
13685
- entityId = _ref.entityId;
13685
+ publicLinkId = _ref.publicLinkId;
13686
13686
  var _useTranslation = useTranslation(),
13687
13687
  t = _useTranslation.t;
13688
13688
  return /*#__PURE__*/React__default["default"].createElement("div", {
@@ -13698,7 +13698,7 @@ var SocialShare = function SocialShare(_ref) {
13698
13698
  className: "neeto-thank-you-configuration-social-follow__item",
13699
13699
  key: idx
13700
13700
  }, /*#__PURE__*/React__default["default"].createElement("a", {
13701
- href: generateShareUrl(entityId),
13701
+ href: generateShareUrl(publicLinkId),
13702
13702
  rel: "noreferrer",
13703
13703
  target: "_blank"
13704
13704
  }, /*#__PURE__*/React__default["default"].createElement(Icon, null)));
@@ -13711,7 +13711,8 @@ var Preview = function Preview(_ref) {
13711
13711
  var socialHandles = _ref.socialHandles,
13712
13712
  thankYouTextAlignment = _ref.thankYouTextAlignment,
13713
13713
  resubmitLink = _ref.resubmitLink,
13714
- entityId = _ref.entityId;
13714
+ publicLinkId = _ref.publicLinkId,
13715
+ isPublished = _ref.isPublished;
13715
13716
  var _useFormikContext = formik.useFormikContext(),
13716
13717
  values = _useFormikContext.values;
13717
13718
  var _useTranslation = useTranslation(),
@@ -13719,7 +13720,8 @@ var Preview = function Preview(_ref) {
13719
13720
  return /*#__PURE__*/React__default["default"].createElement("div", {
13720
13721
  className: classNames__default["default"]("neeto-thank-you-configuration-preview", {
13721
13722
  "neeto-thank-you-configuration-alignment--left": thankYouTextAlignment === THANK_YOU_TEXT_ALIGNMENTS.left,
13722
- "neeto-thank-you-configuration-alignment--center": thankYouTextAlignment === THANK_YOU_TEXT_ALIGNMENTS.center
13723
+ "neeto-thank-you-configuration-alignment--center": thankYouTextAlignment === THANK_YOU_TEXT_ALIGNMENTS.center,
13724
+ "pointer-events-none": !isPublished
13723
13725
  })
13724
13726
  }, /*#__PURE__*/React__default["default"].createElement("div", {
13725
13727
  className: "neeto-thank-you-configuration-preview__browser-header"
@@ -13744,7 +13746,7 @@ var Preview = function Preview(_ref) {
13744
13746
  className: "neeto-thank-you-configuration__resubmit",
13745
13747
  href: resubmitLink
13746
13748
  }, (_values$resubmitLinkT = values === null || values === void 0 ? void 0 : values.resubmitLinkText) !== null && _values$resubmitLinkT !== void 0 ? _values$resubmitLinkT : t("thankYou.resubmit")), (values === null || values === void 0 ? void 0 : values.socialSharingEnabled) && /*#__PURE__*/React__default["default"].createElement(SocialShare, {
13747
- entityId: entityId,
13749
+ publicLinkId: publicLinkId,
13748
13750
  socialHandles: socialHandles
13749
13751
  }))), (values === null || values === void 0 ? void 0 : values.brandingEnabled) && /*#__PURE__*/React__default["default"].createElement("div", {
13750
13752
  className: "neeto-thank-you-configuration__nav"
@@ -13803,12 +13805,14 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
13803
13805
  var Form = function Form(_ref) {
13804
13806
  var socialHandles = _ref.socialHandles,
13805
13807
  entityId = _ref.entityId,
13808
+ publicLinkId = _ref.publicLinkId,
13806
13809
  hasImageUploader = _ref.hasImageUploader,
13807
13810
  uniqueSubmissionEnabled = _ref.uniqueSubmissionEnabled,
13808
13811
  uniqueSubmissionLink = _ref.uniqueSubmissionLink,
13809
13812
  redirectToOnCancel = _ref.redirectToOnCancel,
13810
13813
  thankYouTextAlignment = _ref.thankYouTextAlignment,
13811
- resubmitLink = _ref.resubmitLink;
13814
+ resubmitLink = _ref.resubmitLink,
13815
+ isPublished = _ref.isPublished;
13812
13816
  var _useTranslation = useTranslation(),
13813
13817
  t = _useTranslation.t;
13814
13818
  var _useShowThankYouConfi = useShowThankYouConfiguration({
@@ -13890,7 +13894,8 @@ var Form = function Form(_ref) {
13890
13894
  style: "text",
13891
13895
  to: redirectToOnCancel
13892
13896
  }))), values.kind === FORM_OPTIONS.customize.kind && /*#__PURE__*/React__default["default"].createElement(Preview, {
13893
- entityId: entityId,
13897
+ isPublished: isPublished,
13898
+ publicLinkId: publicLinkId,
13894
13899
  resubmitLink: resubmitLink,
13895
13900
  socialHandles: socialHandles,
13896
13901
  thankYouTextAlignment: thankYouTextAlignment
@@ -13915,7 +13920,9 @@ var ConfigureThankYou = function ConfigureThankYou(_ref) {
13915
13920
  var breadcrumbs = _ref.breadcrumbs,
13916
13921
  _ref$socialHandles = _ref.socialHandles,
13917
13922
  socialHandles = _ref$socialHandles === void 0 ? [] : _ref$socialHandles,
13923
+ isPublished = _ref.isPublished,
13918
13924
  entityId = _ref.entityId,
13925
+ publicLinkId = _ref.publicLinkId,
13919
13926
  _ref$hasImageUploader = _ref.hasImageUploader,
13920
13927
  hasImageUploader = _ref$hasImageUploader === void 0 ? false : _ref$hasImageUploader,
13921
13928
  _ref$uniqueSubmission = _ref.uniqueSubmissionEnabled,
@@ -13935,6 +13942,8 @@ var ConfigureThankYou = function ConfigureThankYou(_ref) {
13935
13942
  }, /*#__PURE__*/React__default["default"].createElement(Form, {
13936
13943
  entityId: entityId,
13937
13944
  hasImageUploader: hasImageUploader,
13945
+ isPublished: isPublished,
13946
+ publicLinkId: publicLinkId,
13938
13947
  redirectToOnCancel: redirectToOnCancel,
13939
13948
  resubmitLink: resubmitLink,
13940
13949
  socialHandles: socialHandles,
@@ -13945,10 +13954,13 @@ var ConfigureThankYou = function ConfigureThankYou(_ref) {
13945
13954
  };
13946
13955
 
13947
13956
  var baseUrl = "".concat(THANK_YOU_ENGINE_BASE_URL, "/thank_you_page");
13948
- var show = function show(entityId) {
13957
+ var show = function show(_ref) {
13958
+ var entityId = _ref.entityId,
13959
+ isTemplateView = _ref.isTemplateView;
13949
13960
  return axios__default["default"].get(baseUrl, {
13950
13961
  params: {
13951
- entityId: entityId
13962
+ entityId: entityId,
13963
+ isTemplateView: isTemplateView
13952
13964
  }
13953
13965
  });
13954
13966
  };
@@ -13957,19 +13969,28 @@ var thankYouPageApi = {
13957
13969
  };
13958
13970
 
13959
13971
  var useShowThankYouPage = function useShowThankYouPage(_ref) {
13960
- var entityId = _ref.entityId;
13972
+ var entityId = _ref.entityId,
13973
+ isTemplateView = _ref.isTemplateView;
13961
13974
  return reactQuery.useQuery([QUERY_KEYS.THANK_YOU_PAGE, entityId], function () {
13962
- return thankYouPageApi.show(entityId);
13975
+ return thankYouPageApi.show({
13976
+ entityId: entityId,
13977
+ isTemplateView: isTemplateView
13978
+ });
13963
13979
  });
13964
13980
  };
13965
13981
 
13982
+ var buildDraftUrl = function buildDraftUrl(url) {
13983
+ return "".concat(url, "?draftPreview=true");
13984
+ };
13985
+
13966
13986
  var ShowThankYou = function ShowThankYou(_ref) {
13967
13987
  var _thankYouConfiguratio;
13968
13988
  var entityId = _ref.entityId,
13969
13989
  isDraftPreview = _ref.isDraftPreview,
13970
13990
  resubmitLink = _ref.resubmitLink,
13971
13991
  socialHandles = _ref.socialHandles,
13972
- isThankYouPageLoading = _ref.isThankYouPageLoading;
13992
+ isThankYouPageLoading = _ref.isThankYouPageLoading,
13993
+ publicLinkId = _ref.publicLinkId;
13973
13994
  var _useTranslation = useTranslation(),
13974
13995
  t = _useTranslation.t;
13975
13996
  var _useShowThankYouPage = useShowThankYouPage({
@@ -14003,9 +14024,9 @@ var ShowThankYou = function ShowThankYou(_ref) {
14003
14024
  content: thankYouConfiguration.message
14004
14025
  })), (thankYouConfiguration === null || thankYouConfiguration === void 0 ? void 0 : thankYouConfiguration.showResubmitLink) && /*#__PURE__*/React__default["default"].createElement("a", {
14005
14026
  className: "neeto-thank-you-configuration__resubmit",
14006
- href: resubmitLink
14027
+ href: isDraftPreview ? buildDraftUrl(resubmitLink) : resubmitLink
14007
14028
  }, (_thankYouConfiguratio = thankYouConfiguration === null || thankYouConfiguration === void 0 ? void 0 : thankYouConfiguration.resubmitLinkText) !== null && _thankYouConfiguratio !== void 0 ? _thankYouConfiguratio : t("common.resubmit")), (thankYouConfiguration === null || thankYouConfiguration === void 0 ? void 0 : thankYouConfiguration.socialSharingEnabled) && /*#__PURE__*/React__default["default"].createElement(SocialShare, {
14008
- entityId: entityId,
14029
+ publicLinkId: publicLinkId,
14009
14030
  socialHandles: socialHandles
14010
14031
  }), isDraftPreview && /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
14011
14032
  style: "body3"