@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.js CHANGED
@@ -13650,7 +13650,7 @@ const SvgBrowserControls = props => /*#__PURE__*/React.createElement("svg", _ext
13650
13650
 
13651
13651
  var SocialShare = function SocialShare(_ref) {
13652
13652
  var socialHandles = _ref.socialHandles,
13653
- entityId = _ref.entityId;
13653
+ publicLinkId = _ref.publicLinkId;
13654
13654
  var _useTranslation = useTranslation(),
13655
13655
  t = _useTranslation.t;
13656
13656
  return /*#__PURE__*/React__default.createElement("div", {
@@ -13666,7 +13666,7 @@ var SocialShare = function SocialShare(_ref) {
13666
13666
  className: "neeto-thank-you-configuration-social-follow__item",
13667
13667
  key: idx
13668
13668
  }, /*#__PURE__*/React__default.createElement("a", {
13669
- href: generateShareUrl(entityId),
13669
+ href: generateShareUrl(publicLinkId),
13670
13670
  rel: "noreferrer",
13671
13671
  target: "_blank"
13672
13672
  }, /*#__PURE__*/React__default.createElement(Icon, null)));
@@ -13679,7 +13679,8 @@ var Preview = function Preview(_ref) {
13679
13679
  var socialHandles = _ref.socialHandles,
13680
13680
  thankYouTextAlignment = _ref.thankYouTextAlignment,
13681
13681
  resubmitLink = _ref.resubmitLink,
13682
- entityId = _ref.entityId;
13682
+ publicLinkId = _ref.publicLinkId,
13683
+ isPublished = _ref.isPublished;
13683
13684
  var _useFormikContext = useFormikContext(),
13684
13685
  values = _useFormikContext.values;
13685
13686
  var _useTranslation = useTranslation(),
@@ -13687,7 +13688,8 @@ var Preview = function Preview(_ref) {
13687
13688
  return /*#__PURE__*/React__default.createElement("div", {
13688
13689
  className: classNames("neeto-thank-you-configuration-preview", {
13689
13690
  "neeto-thank-you-configuration-alignment--left": thankYouTextAlignment === THANK_YOU_TEXT_ALIGNMENTS.left,
13690
- "neeto-thank-you-configuration-alignment--center": thankYouTextAlignment === THANK_YOU_TEXT_ALIGNMENTS.center
13691
+ "neeto-thank-you-configuration-alignment--center": thankYouTextAlignment === THANK_YOU_TEXT_ALIGNMENTS.center,
13692
+ "pointer-events-none": !isPublished
13691
13693
  })
13692
13694
  }, /*#__PURE__*/React__default.createElement("div", {
13693
13695
  className: "neeto-thank-you-configuration-preview__browser-header"
@@ -13712,7 +13714,7 @@ var Preview = function Preview(_ref) {
13712
13714
  className: "neeto-thank-you-configuration__resubmit",
13713
13715
  href: resubmitLink
13714
13716
  }, (_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.createElement(SocialShare, {
13715
- entityId: entityId,
13717
+ publicLinkId: publicLinkId,
13716
13718
  socialHandles: socialHandles
13717
13719
  }))), (values === null || values === void 0 ? void 0 : values.brandingEnabled) && /*#__PURE__*/React__default.createElement("div", {
13718
13720
  className: "neeto-thank-you-configuration__nav"
@@ -13771,12 +13773,14 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
13771
13773
  var Form = function Form(_ref) {
13772
13774
  var socialHandles = _ref.socialHandles,
13773
13775
  entityId = _ref.entityId,
13776
+ publicLinkId = _ref.publicLinkId,
13774
13777
  hasImageUploader = _ref.hasImageUploader,
13775
13778
  uniqueSubmissionEnabled = _ref.uniqueSubmissionEnabled,
13776
13779
  uniqueSubmissionLink = _ref.uniqueSubmissionLink,
13777
13780
  redirectToOnCancel = _ref.redirectToOnCancel,
13778
13781
  thankYouTextAlignment = _ref.thankYouTextAlignment,
13779
- resubmitLink = _ref.resubmitLink;
13782
+ resubmitLink = _ref.resubmitLink,
13783
+ isPublished = _ref.isPublished;
13780
13784
  var _useTranslation = useTranslation(),
13781
13785
  t = _useTranslation.t;
13782
13786
  var _useShowThankYouConfi = useShowThankYouConfiguration({
@@ -13858,7 +13862,8 @@ var Form = function Form(_ref) {
13858
13862
  style: "text",
13859
13863
  to: redirectToOnCancel
13860
13864
  }))), values.kind === FORM_OPTIONS.customize.kind && /*#__PURE__*/React__default.createElement(Preview, {
13861
- entityId: entityId,
13865
+ isPublished: isPublished,
13866
+ publicLinkId: publicLinkId,
13862
13867
  resubmitLink: resubmitLink,
13863
13868
  socialHandles: socialHandles,
13864
13869
  thankYouTextAlignment: thankYouTextAlignment
@@ -13883,7 +13888,9 @@ var ConfigureThankYou = function ConfigureThankYou(_ref) {
13883
13888
  var breadcrumbs = _ref.breadcrumbs,
13884
13889
  _ref$socialHandles = _ref.socialHandles,
13885
13890
  socialHandles = _ref$socialHandles === void 0 ? [] : _ref$socialHandles,
13891
+ isPublished = _ref.isPublished,
13886
13892
  entityId = _ref.entityId,
13893
+ publicLinkId = _ref.publicLinkId,
13887
13894
  _ref$hasImageUploader = _ref.hasImageUploader,
13888
13895
  hasImageUploader = _ref$hasImageUploader === void 0 ? false : _ref$hasImageUploader,
13889
13896
  _ref$uniqueSubmission = _ref.uniqueSubmissionEnabled,
@@ -13903,6 +13910,8 @@ var ConfigureThankYou = function ConfigureThankYou(_ref) {
13903
13910
  }, /*#__PURE__*/React__default.createElement(Form, {
13904
13911
  entityId: entityId,
13905
13912
  hasImageUploader: hasImageUploader,
13913
+ isPublished: isPublished,
13914
+ publicLinkId: publicLinkId,
13906
13915
  redirectToOnCancel: redirectToOnCancel,
13907
13916
  resubmitLink: resubmitLink,
13908
13917
  socialHandles: socialHandles,
@@ -13913,10 +13922,13 @@ var ConfigureThankYou = function ConfigureThankYou(_ref) {
13913
13922
  };
13914
13923
 
13915
13924
  var baseUrl = "".concat(THANK_YOU_ENGINE_BASE_URL, "/thank_you_page");
13916
- var show = function show(entityId) {
13925
+ var show = function show(_ref) {
13926
+ var entityId = _ref.entityId,
13927
+ isTemplateView = _ref.isTemplateView;
13917
13928
  return axios.get(baseUrl, {
13918
13929
  params: {
13919
- entityId: entityId
13930
+ entityId: entityId,
13931
+ isTemplateView: isTemplateView
13920
13932
  }
13921
13933
  });
13922
13934
  };
@@ -13925,19 +13937,28 @@ var thankYouPageApi = {
13925
13937
  };
13926
13938
 
13927
13939
  var useShowThankYouPage = function useShowThankYouPage(_ref) {
13928
- var entityId = _ref.entityId;
13940
+ var entityId = _ref.entityId,
13941
+ isTemplateView = _ref.isTemplateView;
13929
13942
  return useQuery([QUERY_KEYS.THANK_YOU_PAGE, entityId], function () {
13930
- return thankYouPageApi.show(entityId);
13943
+ return thankYouPageApi.show({
13944
+ entityId: entityId,
13945
+ isTemplateView: isTemplateView
13946
+ });
13931
13947
  });
13932
13948
  };
13933
13949
 
13950
+ var buildDraftUrl = function buildDraftUrl(url) {
13951
+ return "".concat(url, "?draftPreview=true");
13952
+ };
13953
+
13934
13954
  var ShowThankYou = function ShowThankYou(_ref) {
13935
13955
  var _thankYouConfiguratio;
13936
13956
  var entityId = _ref.entityId,
13937
13957
  isDraftPreview = _ref.isDraftPreview,
13938
13958
  resubmitLink = _ref.resubmitLink,
13939
13959
  socialHandles = _ref.socialHandles,
13940
- isThankYouPageLoading = _ref.isThankYouPageLoading;
13960
+ isThankYouPageLoading = _ref.isThankYouPageLoading,
13961
+ publicLinkId = _ref.publicLinkId;
13941
13962
  var _useTranslation = useTranslation(),
13942
13963
  t = _useTranslation.t;
13943
13964
  var _useShowThankYouPage = useShowThankYouPage({
@@ -13971,9 +13992,9 @@ var ShowThankYou = function ShowThankYou(_ref) {
13971
13992
  content: thankYouConfiguration.message
13972
13993
  })), (thankYouConfiguration === null || thankYouConfiguration === void 0 ? void 0 : thankYouConfiguration.showResubmitLink) && /*#__PURE__*/React__default.createElement("a", {
13973
13994
  className: "neeto-thank-you-configuration__resubmit",
13974
- href: resubmitLink
13995
+ href: isDraftPreview ? buildDraftUrl(resubmitLink) : resubmitLink
13975
13996
  }, (_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.createElement(SocialShare, {
13976
- entityId: entityId,
13997
+ publicLinkId: publicLinkId,
13977
13998
  socialHandles: socialHandles
13978
13999
  }), isDraftPreview && /*#__PURE__*/React__default.createElement(Typography, {
13979
14000
  style: "body3"