@bigbinary/neeto-commons-frontend 2.0.20 → 2.0.21

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/README.md CHANGED
@@ -8,7 +8,7 @@ products.
8
8
  Install from npm:
9
9
 
10
10
  ```bash
11
- yarn add "@bigbinary/neeto-commons-frontend@2.0.20"
11
+ yarn add "@bigbinary/neeto-commons-frontend@2.0.21"
12
12
  ```
13
13
 
14
14
  This package relies on the host project's tailwind configuration. So add
@@ -824,10 +824,13 @@ var transformResponseKeysToCamelCase = function transformResponseKeysToCamelCase
824
824
  };
825
825
 
826
826
  var transformErrorKeysToCamelCase = function transformErrorKeysToCamelCase(error) {
827
- var _error$config$transfo = error.config.transformResponseCase,
828
- transformResponseCase = _error$config$transfo === void 0 ? true : _error$config$transfo;
827
+ var _error$config, _error$response;
829
828
 
830
- if (error.response.data && transformResponseCase) {
829
+ var _ref = (_error$config = error.config) !== null && _error$config !== void 0 ? _error$config : {},
830
+ _ref$transformRespons = _ref.transformResponseCase,
831
+ transformResponseCase = _ref$transformRespons === void 0 ? true : _ref$transformRespons;
832
+
833
+ if ((_error$response = error.response) !== null && _error$response !== void 0 && _error$response.data && transformResponseCase) {
831
834
  error.response.data = keysToCamelCase(error.response.data);
832
835
  }
833
836
 
@@ -860,12 +863,14 @@ var buildSuccessResponseHandler = function buildSuccessResponseHandler(skip) {
860
863
  };
861
864
 
862
865
  var handleUnauthorizedErrorResponse = function handleUnauthorizedErrorResponse(error) {
863
- var _error$response;
866
+ var _error$response2, _error$config2;
864
867
 
865
- if (((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.status) !== 401) return error;
868
+ if (((_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.status) !== 401) return error;
866
869
  resetAuthTokens();
867
- var _error$config$redirec = error.config.redirectOnError,
868
- redirectOnError = _error$config$redirec === void 0 ? true : _error$config$redirec;
870
+
871
+ var _ref2 = (_error$config2 = error.config) !== null && _error$config2 !== void 0 ? _error$config2 : {},
872
+ _ref2$redirectOnError = _ref2.redirectOnError,
873
+ redirectOnError = _ref2$redirectOnError === void 0 ? true : _ref2$redirectOnError;
869
874
 
870
875
  if (redirectOnError) {
871
876
  setTimeout(function () {
@@ -878,8 +883,12 @@ var handleUnauthorizedErrorResponse = function handleUnauthorizedErrorResponse(e
878
883
  };
879
884
 
880
885
  var showErrorToastr = function showErrorToastr(error) {
881
- var _error$config$showToa = error.config.showToastr,
882
- showToastr = _error$config$showToa === void 0 ? true : _error$config$showToa;
886
+ var _error$config3;
887
+
888
+ var _ref3 = (_error$config3 = error.config) !== null && _error$config3 !== void 0 ? _error$config3 : {},
889
+ _ref3$showToastr = _ref3.showToastr,
890
+ showToastr = _ref3$showToastr === void 0 ? true : _ref3$showToastr;
891
+
883
892
  if (!showToastr) return error;
884
893
 
885
894
  if (axios__default["default"].isCancel(error)) {
@@ -894,11 +903,13 @@ var showErrorToastr = function showErrorToastr(error) {
894
903
  };
895
904
 
896
905
  var handle404ErrorResponse = function handle404ErrorResponse(error) {
897
- var _error$response2;
906
+ var _error$response3, _error$config4;
898
907
 
899
- if (((_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.status) !== 404) return error;
900
- var _error$config$show = error.config.show404ErrorPage,
901
- show404ErrorPage = _error$config$show === void 0 ? true : _error$config$show;
908
+ if (((_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.status) !== 404) return error;
909
+
910
+ var _ref4 = (_error$config4 = error.config) !== null && _error$config4 !== void 0 ? _error$config4 : {},
911
+ _ref4$show404ErrorPag = _ref4.show404ErrorPage,
912
+ show404ErrorPage = _ref4$show404ErrorPag === void 0 ? true : _ref4$show404ErrorPag;
902
913
 
903
914
  if (show404ErrorPage) {
904
915
  useErrorDisplayStore.setState({
@@ -930,8 +941,11 @@ var cleanupCredentialsForCrossOrigin = function cleanupCredentialsForCrossOrigin
930
941
  var transformDataToSnakeCase = function transformDataToSnakeCase(request) {
931
942
  var _request$transformReq = request.transformRequestCase,
932
943
  transformRequestCase = _request$transformReq === void 0 ? true : _request$transformReq;
933
- if (!transformRequestCase || !request.data) return request;
934
- return ramda.modify("data", serializeKeysToSnakeCase, request);
944
+ if (!transformRequestCase) return request;
945
+ return ramda.evolve({
946
+ data: serializeKeysToSnakeCase,
947
+ params: serializeKeysToSnakeCase
948
+ }, request);
935
949
  };
936
950
 
937
951
  var addRequestInterceptors = function addRequestInterceptors(skip) {
@@ -1035,7 +1049,7 @@ var neetoCommons = {
1035
1049
  }
1036
1050
  },
1037
1051
  email: {
1038
- title: "Widget installation script",
1052
+ title: "Widget installation instructions",
1039
1053
  fields: {
1040
1054
  emails: {
1041
1055
  label: "Emails",
@@ -1045,7 +1059,7 @@ var neetoCommons = {
1045
1059
  subject: {
1046
1060
  label: "Subject",
1047
1061
  values: {
1048
- embedCode: "neetoWidget script for installing {{selectedWidgets}}",
1062
+ embedCode: "Widget installation instructions",
1049
1063
  userIdentity: "neetoWidget user identity object to specify user details",
1050
1064
  sessionContext: "neetoReplay session context object to save contextual information"
1051
1065
  }
@@ -1053,7 +1067,7 @@ var neetoCommons = {
1053
1067
  },
1054
1068
  body: {
1055
1069
  values: {
1056
- embedCode: "Hey there. We're going to use {{selectedWidgets}} on our website and I was hoping you could help us with the installation steps. Please find the code snippet for widget installation attached below. You can find the documentation at - {{neetoKbUrl}}.",
1070
+ embedCode: "<p>Hi,</p> <p>We are going to use {{selectedWidgets}}. Please find the code snippet for the installation of the {{selectedWidgets}} widget. You can find the documentation regarding this at <configureLink>{{neetoKbUrl}}</configureLink>.</p> <p>If you still need help then send an email to <mail>{{helpEmail}}</mail>.</p>",
1057
1071
  userIdentity: "Hey there. This is the object structure that you can use to specify the user identity for neetoWidget. You can find the documentation at - {{userIdentityKbUrl}}.",
1058
1072
  sessionContext: "Hey there. This is the object structure that you can use to specify the contextual values for neetoReplay sessions. You can find the documentation at - {{sessionContextKbUrl}}."
1059
1073
  }
@@ -1065,19 +1079,37 @@ var neetoCommons = {
1065
1079
  }
1066
1080
  },
1067
1081
  customDomain: {
1068
- customDomain_one: "custom domain",
1069
- customDomain_other: "custom domains",
1082
+ customDomain_one: "Custom domain",
1083
+ customDomain_other: "Custom domains",
1070
1084
  customDomainWithCount_one: "{{count}} custom domain",
1071
1085
  customDomainWithCount_other: "{{count}} custom domains",
1072
1086
  placeholder: "Type domain here...",
1087
+ label: "Enter Custom domain",
1073
1088
  validation: {
1074
- buttonLabel: "Validate domain",
1075
- desc: {
1076
- txt: "Please add following {{record}} record in your domains DNS dashboard and then request for domain validation.",
1077
- cname: "Please add following {{record}} record in your domain’s DNS dashboard."
1089
+ buttonLabel: {
1090
+ txt: "Validate TXT record entries",
1091
+ cnameAdded: "Ive added CNAME records",
1092
+ cnameCheck: "Validate CNAME record"
1078
1093
  },
1094
+ desc: "Please add following {{record}} record in your domain’s DNS dashboard and then request for {{record}} validation.",
1079
1095
  record: "{{record}} record {{type}}"
1080
1096
  },
1097
+ status: {
1098
+ txt: {
1099
+ active: "TXT record validated",
1100
+ pendingCnameValidation: "TXT record validated",
1101
+ pendingTxtValidation: "TXT record validation pending"
1102
+ },
1103
+ cname: {
1104
+ active: "CNAME record validated",
1105
+ pendingCnameValidation: "CNAME record validation pending"
1106
+ },
1107
+ failed: "Failed"
1108
+ },
1109
+ messageBlock: {
1110
+ dnsStatus: "<p>Typically, it will take 2 hours to 24 hours for the new custom domain to start working.</p><br><p> An email will be sent when the custom domain starts working.</p><br>If, after 24 hours, your custom domain is still not working, then please send an email to ",
1111
+ cnameAddedTime: " You added CNAME records {{time}}"
1112
+ },
1081
1113
  alertMessage: "You're about to delete the custom domain <strong>{{hostname}}</strong>. This action will permanently delete the domain and <strong>{{hostname}}</strong> will no longer point to your default domain.",
1082
1114
  formikValidation: {
1083
1115
  required: "Custom domain is required",
@@ -1110,6 +1142,18 @@ var neetoCommons = {
1110
1142
  sameTime: "Periods start and end time cannot be same"
1111
1143
  }
1112
1144
  }
1145
+ },
1146
+ browserSupport: {
1147
+ unsupportedBrowserVersion: "You are using {{browserName}} {{browserVersion}}. neeto requires {{browserName}} {{requiredMinBrowserVersion}} or later to perform reliably. <downloadLink></downloadLink><contactUs></contactUs>",
1148
+ unsupportedBrowser: "You are using {{browserName}} {{browserVersion}}. neeto requires a modern browser to perform reliably. <contactUs></contactUs>",
1149
+ downloadLink: {
1150
+ main: "Please <button></button> the latest browser.",
1151
+ buttonLabel: "download and install"
1152
+ },
1153
+ contactUs: {
1154
+ main: "<button></button> if you need any help.",
1155
+ buttonLabel: "Contact us"
1156
+ }
1113
1157
  }
1114
1158
  };
1115
1159
  var en = {
package/initializers.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Toastr } from '@bigbinary/neetoui';
2
2
  import axios from 'axios';
3
3
  import i18next from 'i18next';
4
- import { curryN, isNil, values, prop, evolve, omit, modify, mergeDeepLeft, either, isEmpty } from 'ramda';
4
+ import { curryN, isNil, values, prop, evolve, omit, mergeDeepLeft, either, isEmpty } from 'ramda';
5
5
  import require$$0, { useDebugValue } from 'react';
6
6
  import { initReactI18next } from 'react-i18next';
7
7
  import Logger from 'js-logger';
@@ -812,10 +812,13 @@ var transformResponseKeysToCamelCase = function transformResponseKeysToCamelCase
812
812
  };
813
813
 
814
814
  var transformErrorKeysToCamelCase = function transformErrorKeysToCamelCase(error) {
815
- var _error$config$transfo = error.config.transformResponseCase,
816
- transformResponseCase = _error$config$transfo === void 0 ? true : _error$config$transfo;
815
+ var _error$config, _error$response;
817
816
 
818
- if (error.response.data && transformResponseCase) {
817
+ var _ref = (_error$config = error.config) !== null && _error$config !== void 0 ? _error$config : {},
818
+ _ref$transformRespons = _ref.transformResponseCase,
819
+ transformResponseCase = _ref$transformRespons === void 0 ? true : _ref$transformRespons;
820
+
821
+ if ((_error$response = error.response) !== null && _error$response !== void 0 && _error$response.data && transformResponseCase) {
819
822
  error.response.data = keysToCamelCase(error.response.data);
820
823
  }
821
824
 
@@ -848,12 +851,14 @@ var buildSuccessResponseHandler = function buildSuccessResponseHandler(skip) {
848
851
  };
849
852
 
850
853
  var handleUnauthorizedErrorResponse = function handleUnauthorizedErrorResponse(error) {
851
- var _error$response;
854
+ var _error$response2, _error$config2;
852
855
 
853
- if (((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.status) !== 401) return error;
856
+ if (((_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.status) !== 401) return error;
854
857
  resetAuthTokens();
855
- var _error$config$redirec = error.config.redirectOnError,
856
- redirectOnError = _error$config$redirec === void 0 ? true : _error$config$redirec;
858
+
859
+ var _ref2 = (_error$config2 = error.config) !== null && _error$config2 !== void 0 ? _error$config2 : {},
860
+ _ref2$redirectOnError = _ref2.redirectOnError,
861
+ redirectOnError = _ref2$redirectOnError === void 0 ? true : _ref2$redirectOnError;
857
862
 
858
863
  if (redirectOnError) {
859
864
  setTimeout(function () {
@@ -866,8 +871,12 @@ var handleUnauthorizedErrorResponse = function handleUnauthorizedErrorResponse(e
866
871
  };
867
872
 
868
873
  var showErrorToastr = function showErrorToastr(error) {
869
- var _error$config$showToa = error.config.showToastr,
870
- showToastr = _error$config$showToa === void 0 ? true : _error$config$showToa;
874
+ var _error$config3;
875
+
876
+ var _ref3 = (_error$config3 = error.config) !== null && _error$config3 !== void 0 ? _error$config3 : {},
877
+ _ref3$showToastr = _ref3.showToastr,
878
+ showToastr = _ref3$showToastr === void 0 ? true : _ref3$showToastr;
879
+
871
880
  if (!showToastr) return error;
872
881
 
873
882
  if (axios.isCancel(error)) {
@@ -882,11 +891,13 @@ var showErrorToastr = function showErrorToastr(error) {
882
891
  };
883
892
 
884
893
  var handle404ErrorResponse = function handle404ErrorResponse(error) {
885
- var _error$response2;
894
+ var _error$response3, _error$config4;
886
895
 
887
- if (((_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.status) !== 404) return error;
888
- var _error$config$show = error.config.show404ErrorPage,
889
- show404ErrorPage = _error$config$show === void 0 ? true : _error$config$show;
896
+ if (((_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.status) !== 404) return error;
897
+
898
+ var _ref4 = (_error$config4 = error.config) !== null && _error$config4 !== void 0 ? _error$config4 : {},
899
+ _ref4$show404ErrorPag = _ref4.show404ErrorPage,
900
+ show404ErrorPage = _ref4$show404ErrorPag === void 0 ? true : _ref4$show404ErrorPag;
890
901
 
891
902
  if (show404ErrorPage) {
892
903
  useErrorDisplayStore.setState({
@@ -918,8 +929,11 @@ var cleanupCredentialsForCrossOrigin = function cleanupCredentialsForCrossOrigin
918
929
  var transformDataToSnakeCase = function transformDataToSnakeCase(request) {
919
930
  var _request$transformReq = request.transformRequestCase,
920
931
  transformRequestCase = _request$transformReq === void 0 ? true : _request$transformReq;
921
- if (!transformRequestCase || !request.data) return request;
922
- return modify("data", serializeKeysToSnakeCase, request);
932
+ if (!transformRequestCase) return request;
933
+ return evolve({
934
+ data: serializeKeysToSnakeCase,
935
+ params: serializeKeysToSnakeCase
936
+ }, request);
923
937
  };
924
938
 
925
939
  var addRequestInterceptors = function addRequestInterceptors(skip) {
@@ -1023,7 +1037,7 @@ var neetoCommons = {
1023
1037
  }
1024
1038
  },
1025
1039
  email: {
1026
- title: "Widget installation script",
1040
+ title: "Widget installation instructions",
1027
1041
  fields: {
1028
1042
  emails: {
1029
1043
  label: "Emails",
@@ -1033,7 +1047,7 @@ var neetoCommons = {
1033
1047
  subject: {
1034
1048
  label: "Subject",
1035
1049
  values: {
1036
- embedCode: "neetoWidget script for installing {{selectedWidgets}}",
1050
+ embedCode: "Widget installation instructions",
1037
1051
  userIdentity: "neetoWidget user identity object to specify user details",
1038
1052
  sessionContext: "neetoReplay session context object to save contextual information"
1039
1053
  }
@@ -1041,7 +1055,7 @@ var neetoCommons = {
1041
1055
  },
1042
1056
  body: {
1043
1057
  values: {
1044
- embedCode: "Hey there. We're going to use {{selectedWidgets}} on our website and I was hoping you could help us with the installation steps. Please find the code snippet for widget installation attached below. You can find the documentation at - {{neetoKbUrl}}.",
1058
+ embedCode: "<p>Hi,</p> <p>We are going to use {{selectedWidgets}}. Please find the code snippet for the installation of the {{selectedWidgets}} widget. You can find the documentation regarding this at <configureLink>{{neetoKbUrl}}</configureLink>.</p> <p>If you still need help then send an email to <mail>{{helpEmail}}</mail>.</p>",
1045
1059
  userIdentity: "Hey there. This is the object structure that you can use to specify the user identity for neetoWidget. You can find the documentation at - {{userIdentityKbUrl}}.",
1046
1060
  sessionContext: "Hey there. This is the object structure that you can use to specify the contextual values for neetoReplay sessions. You can find the documentation at - {{sessionContextKbUrl}}."
1047
1061
  }
@@ -1053,19 +1067,37 @@ var neetoCommons = {
1053
1067
  }
1054
1068
  },
1055
1069
  customDomain: {
1056
- customDomain_one: "custom domain",
1057
- customDomain_other: "custom domains",
1070
+ customDomain_one: "Custom domain",
1071
+ customDomain_other: "Custom domains",
1058
1072
  customDomainWithCount_one: "{{count}} custom domain",
1059
1073
  customDomainWithCount_other: "{{count}} custom domains",
1060
1074
  placeholder: "Type domain here...",
1075
+ label: "Enter Custom domain",
1061
1076
  validation: {
1062
- buttonLabel: "Validate domain",
1063
- desc: {
1064
- txt: "Please add following {{record}} record in your domains DNS dashboard and then request for domain validation.",
1065
- cname: "Please add following {{record}} record in your domain’s DNS dashboard."
1077
+ buttonLabel: {
1078
+ txt: "Validate TXT record entries",
1079
+ cnameAdded: "Ive added CNAME records",
1080
+ cnameCheck: "Validate CNAME record"
1066
1081
  },
1082
+ desc: "Please add following {{record}} record in your domain’s DNS dashboard and then request for {{record}} validation.",
1067
1083
  record: "{{record}} record {{type}}"
1068
1084
  },
1085
+ status: {
1086
+ txt: {
1087
+ active: "TXT record validated",
1088
+ pendingCnameValidation: "TXT record validated",
1089
+ pendingTxtValidation: "TXT record validation pending"
1090
+ },
1091
+ cname: {
1092
+ active: "CNAME record validated",
1093
+ pendingCnameValidation: "CNAME record validation pending"
1094
+ },
1095
+ failed: "Failed"
1096
+ },
1097
+ messageBlock: {
1098
+ dnsStatus: "<p>Typically, it will take 2 hours to 24 hours for the new custom domain to start working.</p><br><p> An email will be sent when the custom domain starts working.</p><br>If, after 24 hours, your custom domain is still not working, then please send an email to ",
1099
+ cnameAddedTime: " You added CNAME records {{time}}"
1100
+ },
1069
1101
  alertMessage: "You're about to delete the custom domain <strong>{{hostname}}</strong>. This action will permanently delete the domain and <strong>{{hostname}}</strong> will no longer point to your default domain.",
1070
1102
  formikValidation: {
1071
1103
  required: "Custom domain is required",
@@ -1098,6 +1130,18 @@ var neetoCommons = {
1098
1130
  sameTime: "Periods start and end time cannot be same"
1099
1131
  }
1100
1132
  }
1133
+ },
1134
+ browserSupport: {
1135
+ unsupportedBrowserVersion: "You are using {{browserName}} {{browserVersion}}. neeto requires {{browserName}} {{requiredMinBrowserVersion}} or later to perform reliably. <downloadLink></downloadLink><contactUs></contactUs>",
1136
+ unsupportedBrowser: "You are using {{browserName}} {{browserVersion}}. neeto requires a modern browser to perform reliably. <contactUs></contactUs>",
1137
+ downloadLink: {
1138
+ main: "Please <button></button> the latest browser.",
1139
+ buttonLabel: "download and install"
1140
+ },
1141
+ contactUs: {
1142
+ main: "<button></button> if you need any help.",
1143
+ buttonLabel: "Contact us"
1144
+ }
1101
1145
  }
1102
1146
  };
1103
1147
  var en = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-commons-frontend",
3
- "version": "2.0.20",
3
+ "version": "2.0.21",
4
4
  "description": "A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.",
5
5
  "repository": "git@github.com:bigbinary/neeto-commons-frontend.git",
6
6
  "author": "Amaljith K <amaljith.k@bigbinary.com>",
@@ -98,7 +98,8 @@
98
98
  "rollup-plugin-cleaner": "^1.0.0",
99
99
  "rollup-plugin-peer-deps-external": "^2.2.4",
100
100
  "yup": "^0.32.11",
101
- "zustand": "^4.1.2"
101
+ "zustand": "^4.1.2",
102
+ "platform": "^1.3.6"
102
103
  },
103
104
  "dependencies": {},
104
105
  "peerDependencies": {