@bigbinary/neeto-molecules 1.0.104 → 1.0.105

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/EmailForm.js CHANGED
@@ -9,10 +9,11 @@ import { prop } from 'ramda';
9
9
  import * as yup from 'yup';
10
10
  import { string } from 'yup';
11
11
  import { isNotEmpty, noop, isPresent } from '@bigbinary/neeto-commons-frontend/pure';
12
- import { Upload } from '@bigbinary/neeto-icons';
12
+ import { Info, Upload } from '@bigbinary/neeto-icons';
13
13
  import require$$0 from 'stream';
14
14
  import { withEventTargetValue } from '@bigbinary/neeto-commons-frontend/utils';
15
15
  import DynamicVariables from '@bigbinary/neeto-molecules/DynamicVariables';
16
+ import { withT } from '@bigbinary/neeto-commons-frontend/react-utils';
16
17
 
17
18
  function _typeof$1(obj) {
18
19
  "@babel/helpers - typeof";
@@ -122,7 +123,7 @@ var INITIAL_FORM_VALUES = {
122
123
  sendTo: [],
123
124
  sendToCc: [],
124
125
  sendToBcc: [],
125
- replyTo: "",
126
+ replyTo: globalProps.user.email,
126
127
  showCopyEmails: false,
127
128
  subject: "",
128
129
  message: ""
@@ -155,6 +156,7 @@ var EmailFormContext = /*#__PURE__*/React.createContext({
155
156
  });
156
157
 
157
158
  var ReplyToField = function ReplyToField(_ref) {
159
+ var _helpIconProps2;
158
160
  var replyToOptions = _ref.replyToOptions;
159
161
  var _useTranslation = useTranslation(),
160
162
  t = _useTranslation.t;
@@ -162,12 +164,20 @@ var ReplyToField = function ReplyToField(_ref) {
162
164
  var _useFormikContext = useFormikContext(),
163
165
  setFieldValue = _useFormikContext.setFieldValue;
164
166
  if (isDropdownField) {
167
+ var _helpIconProps;
165
168
  return /*#__PURE__*/React.createElement(Select, {
166
169
  className: "w-full",
167
170
  "data-testid": "replyToOptions",
168
171
  label: t("neetoMolecules.emailForm.labels.replyTo"),
169
172
  name: "replyTo",
170
173
  options: replyToOptions,
174
+ labelProps: {
175
+ helpIconProps: (_helpIconProps = {
176
+ icon: Info
177
+ }, _defineProperty(_helpIconProps, "data-testid", "reply-to-tooltip"), _defineProperty(_helpIconProps, "tooltipProps", {
178
+ content: t("neetoMolecules.emailForm.tooltips.replyTo")
179
+ }), _helpIconProps)
180
+ },
171
181
  onChange: function onChange(_ref2) {
172
182
  var value = _ref2.value;
173
183
  return setFieldValue("replyTo", value);
@@ -182,7 +192,14 @@ var ReplyToField = function ReplyToField(_ref) {
182
192
  label: t("neetoMolecules.emailForm.labels.replyTo"),
183
193
  name: "replyTo",
184
194
  placeholder: t("neetoMolecules.emailForm.placeholders.emailPlaceholder"),
185
- size: "large"
195
+ size: "large",
196
+ labelProps: {
197
+ helpIconProps: (_helpIconProps2 = {
198
+ icon: Info
199
+ }, _defineProperty(_helpIconProps2, "data-testid", "reply-to-tooltip"), _defineProperty(_helpIconProps2, "tooltipProps", {
200
+ content: t("neetoMolecules.emailForm.tooltips.replyTo")
201
+ }), _helpIconProps2)
202
+ }
186
203
  });
187
204
  };
188
205
 
@@ -2877,15 +2894,1200 @@ var EmailFormProvider = function EmailFormProvider(_ref) {
2877
2894
  showReplyToField: showReplyToField,
2878
2895
  customValidations: customValidations
2879
2896
  }),
2880
- initialValues: initialValues,
2897
+ initialValues: _objectSpread(_objectSpread({}, initialValues), {}, {
2898
+ replyTo: initialValues.replyTo || INITIAL_FORM_VALUES.replyTo
2899
+ }),
2881
2900
  onSubmit: onSubmit
2882
2901
  }, formikProps)
2883
2902
  }, children)));
2884
2903
  };
2885
2904
 
2905
+ var propTypes = {exports: {}};
2906
+
2907
+ var reactIs = {exports: {}};
2908
+
2909
+ var reactIs_production_min = {};
2910
+
2911
+ /** @license React v16.13.1
2912
+ * react-is.production.min.js
2913
+ *
2914
+ * Copyright (c) Facebook, Inc. and its affiliates.
2915
+ *
2916
+ * This source code is licensed under the MIT license found in the
2917
+ * LICENSE file in the root directory of this source tree.
2918
+ */
2919
+
2920
+ var hasRequiredReactIs_production_min;
2921
+
2922
+ function requireReactIs_production_min () {
2923
+ if (hasRequiredReactIs_production_min) return reactIs_production_min;
2924
+ hasRequiredReactIs_production_min = 1;
2925
+ var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
2926
+ Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
2927
+ function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
2928
+ reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
2929
+ reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
2930
+ reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
2931
+ return reactIs_production_min;
2932
+ }
2933
+
2934
+ var reactIs_development = {};
2935
+
2936
+ /** @license React v16.13.1
2937
+ * react-is.development.js
2938
+ *
2939
+ * Copyright (c) Facebook, Inc. and its affiliates.
2940
+ *
2941
+ * This source code is licensed under the MIT license found in the
2942
+ * LICENSE file in the root directory of this source tree.
2943
+ */
2944
+
2945
+ var hasRequiredReactIs_development;
2946
+
2947
+ function requireReactIs_development () {
2948
+ if (hasRequiredReactIs_development) return reactIs_development;
2949
+ hasRequiredReactIs_development = 1;
2950
+
2951
+
2952
+
2953
+ if (process.env.NODE_ENV !== "production") {
2954
+ (function() {
2955
+
2956
+ // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
2957
+ // nor polyfill, then a plain number is used for performance.
2958
+ var hasSymbol = typeof Symbol === 'function' && Symbol.for;
2959
+ var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
2960
+ var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
2961
+ var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
2962
+ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
2963
+ var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
2964
+ var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
2965
+ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
2966
+ // (unstable) APIs that have been removed. Can we remove the symbols?
2967
+
2968
+ var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
2969
+ var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
2970
+ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
2971
+ var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
2972
+ var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
2973
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
2974
+ var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
2975
+ var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
2976
+ var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
2977
+ var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
2978
+ var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
2979
+
2980
+ function isValidElementType(type) {
2981
+ return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
2982
+ type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
2983
+ }
2984
+
2985
+ function typeOf(object) {
2986
+ if (typeof object === 'object' && object !== null) {
2987
+ var $$typeof = object.$$typeof;
2988
+
2989
+ switch ($$typeof) {
2990
+ case REACT_ELEMENT_TYPE:
2991
+ var type = object.type;
2992
+
2993
+ switch (type) {
2994
+ case REACT_ASYNC_MODE_TYPE:
2995
+ case REACT_CONCURRENT_MODE_TYPE:
2996
+ case REACT_FRAGMENT_TYPE:
2997
+ case REACT_PROFILER_TYPE:
2998
+ case REACT_STRICT_MODE_TYPE:
2999
+ case REACT_SUSPENSE_TYPE:
3000
+ return type;
3001
+
3002
+ default:
3003
+ var $$typeofType = type && type.$$typeof;
3004
+
3005
+ switch ($$typeofType) {
3006
+ case REACT_CONTEXT_TYPE:
3007
+ case REACT_FORWARD_REF_TYPE:
3008
+ case REACT_LAZY_TYPE:
3009
+ case REACT_MEMO_TYPE:
3010
+ case REACT_PROVIDER_TYPE:
3011
+ return $$typeofType;
3012
+
3013
+ default:
3014
+ return $$typeof;
3015
+ }
3016
+
3017
+ }
3018
+
3019
+ case REACT_PORTAL_TYPE:
3020
+ return $$typeof;
3021
+ }
3022
+ }
3023
+
3024
+ return undefined;
3025
+ } // AsyncMode is deprecated along with isAsyncMode
3026
+
3027
+ var AsyncMode = REACT_ASYNC_MODE_TYPE;
3028
+ var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
3029
+ var ContextConsumer = REACT_CONTEXT_TYPE;
3030
+ var ContextProvider = REACT_PROVIDER_TYPE;
3031
+ var Element = REACT_ELEMENT_TYPE;
3032
+ var ForwardRef = REACT_FORWARD_REF_TYPE;
3033
+ var Fragment = REACT_FRAGMENT_TYPE;
3034
+ var Lazy = REACT_LAZY_TYPE;
3035
+ var Memo = REACT_MEMO_TYPE;
3036
+ var Portal = REACT_PORTAL_TYPE;
3037
+ var Profiler = REACT_PROFILER_TYPE;
3038
+ var StrictMode = REACT_STRICT_MODE_TYPE;
3039
+ var Suspense = REACT_SUSPENSE_TYPE;
3040
+ var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
3041
+
3042
+ function isAsyncMode(object) {
3043
+ {
3044
+ if (!hasWarnedAboutDeprecatedIsAsyncMode) {
3045
+ hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
3046
+
3047
+ console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
3048
+ }
3049
+ }
3050
+
3051
+ return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
3052
+ }
3053
+ function isConcurrentMode(object) {
3054
+ return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
3055
+ }
3056
+ function isContextConsumer(object) {
3057
+ return typeOf(object) === REACT_CONTEXT_TYPE;
3058
+ }
3059
+ function isContextProvider(object) {
3060
+ return typeOf(object) === REACT_PROVIDER_TYPE;
3061
+ }
3062
+ function isElement(object) {
3063
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
3064
+ }
3065
+ function isForwardRef(object) {
3066
+ return typeOf(object) === REACT_FORWARD_REF_TYPE;
3067
+ }
3068
+ function isFragment(object) {
3069
+ return typeOf(object) === REACT_FRAGMENT_TYPE;
3070
+ }
3071
+ function isLazy(object) {
3072
+ return typeOf(object) === REACT_LAZY_TYPE;
3073
+ }
3074
+ function isMemo(object) {
3075
+ return typeOf(object) === REACT_MEMO_TYPE;
3076
+ }
3077
+ function isPortal(object) {
3078
+ return typeOf(object) === REACT_PORTAL_TYPE;
3079
+ }
3080
+ function isProfiler(object) {
3081
+ return typeOf(object) === REACT_PROFILER_TYPE;
3082
+ }
3083
+ function isStrictMode(object) {
3084
+ return typeOf(object) === REACT_STRICT_MODE_TYPE;
3085
+ }
3086
+ function isSuspense(object) {
3087
+ return typeOf(object) === REACT_SUSPENSE_TYPE;
3088
+ }
3089
+
3090
+ reactIs_development.AsyncMode = AsyncMode;
3091
+ reactIs_development.ConcurrentMode = ConcurrentMode;
3092
+ reactIs_development.ContextConsumer = ContextConsumer;
3093
+ reactIs_development.ContextProvider = ContextProvider;
3094
+ reactIs_development.Element = Element;
3095
+ reactIs_development.ForwardRef = ForwardRef;
3096
+ reactIs_development.Fragment = Fragment;
3097
+ reactIs_development.Lazy = Lazy;
3098
+ reactIs_development.Memo = Memo;
3099
+ reactIs_development.Portal = Portal;
3100
+ reactIs_development.Profiler = Profiler;
3101
+ reactIs_development.StrictMode = StrictMode;
3102
+ reactIs_development.Suspense = Suspense;
3103
+ reactIs_development.isAsyncMode = isAsyncMode;
3104
+ reactIs_development.isConcurrentMode = isConcurrentMode;
3105
+ reactIs_development.isContextConsumer = isContextConsumer;
3106
+ reactIs_development.isContextProvider = isContextProvider;
3107
+ reactIs_development.isElement = isElement;
3108
+ reactIs_development.isForwardRef = isForwardRef;
3109
+ reactIs_development.isFragment = isFragment;
3110
+ reactIs_development.isLazy = isLazy;
3111
+ reactIs_development.isMemo = isMemo;
3112
+ reactIs_development.isPortal = isPortal;
3113
+ reactIs_development.isProfiler = isProfiler;
3114
+ reactIs_development.isStrictMode = isStrictMode;
3115
+ reactIs_development.isSuspense = isSuspense;
3116
+ reactIs_development.isValidElementType = isValidElementType;
3117
+ reactIs_development.typeOf = typeOf;
3118
+ })();
3119
+ }
3120
+ return reactIs_development;
3121
+ }
3122
+
3123
+ var hasRequiredReactIs;
3124
+
3125
+ function requireReactIs () {
3126
+ if (hasRequiredReactIs) return reactIs.exports;
3127
+ hasRequiredReactIs = 1;
3128
+ (function (module) {
3129
+
3130
+ if (process.env.NODE_ENV === 'production') {
3131
+ module.exports = requireReactIs_production_min();
3132
+ } else {
3133
+ module.exports = requireReactIs_development();
3134
+ }
3135
+ } (reactIs));
3136
+ return reactIs.exports;
3137
+ }
3138
+
3139
+ /*
3140
+ object-assign
3141
+ (c) Sindre Sorhus
3142
+ @license MIT
3143
+ */
3144
+
3145
+ var objectAssign;
3146
+ var hasRequiredObjectAssign;
3147
+
3148
+ function requireObjectAssign () {
3149
+ if (hasRequiredObjectAssign) return objectAssign;
3150
+ hasRequiredObjectAssign = 1;
3151
+ /* eslint-disable no-unused-vars */
3152
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
3153
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
3154
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
3155
+
3156
+ function toObject(val) {
3157
+ if (val === null || val === undefined) {
3158
+ throw new TypeError('Object.assign cannot be called with null or undefined');
3159
+ }
3160
+
3161
+ return Object(val);
3162
+ }
3163
+
3164
+ function shouldUseNative() {
3165
+ try {
3166
+ if (!Object.assign) {
3167
+ return false;
3168
+ }
3169
+
3170
+ // Detect buggy property enumeration order in older V8 versions.
3171
+
3172
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
3173
+ var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
3174
+ test1[5] = 'de';
3175
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
3176
+ return false;
3177
+ }
3178
+
3179
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
3180
+ var test2 = {};
3181
+ for (var i = 0; i < 10; i++) {
3182
+ test2['_' + String.fromCharCode(i)] = i;
3183
+ }
3184
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
3185
+ return test2[n];
3186
+ });
3187
+ if (order2.join('') !== '0123456789') {
3188
+ return false;
3189
+ }
3190
+
3191
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
3192
+ var test3 = {};
3193
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
3194
+ test3[letter] = letter;
3195
+ });
3196
+ if (Object.keys(Object.assign({}, test3)).join('') !==
3197
+ 'abcdefghijklmnopqrst') {
3198
+ return false;
3199
+ }
3200
+
3201
+ return true;
3202
+ } catch (err) {
3203
+ // We don't expect any of the above to throw, but better to be safe.
3204
+ return false;
3205
+ }
3206
+ }
3207
+
3208
+ objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
3209
+ var from;
3210
+ var to = toObject(target);
3211
+ var symbols;
3212
+
3213
+ for (var s = 1; s < arguments.length; s++) {
3214
+ from = Object(arguments[s]);
3215
+
3216
+ for (var key in from) {
3217
+ if (hasOwnProperty.call(from, key)) {
3218
+ to[key] = from[key];
3219
+ }
3220
+ }
3221
+
3222
+ if (getOwnPropertySymbols) {
3223
+ symbols = getOwnPropertySymbols(from);
3224
+ for (var i = 0; i < symbols.length; i++) {
3225
+ if (propIsEnumerable.call(from, symbols[i])) {
3226
+ to[symbols[i]] = from[symbols[i]];
3227
+ }
3228
+ }
3229
+ }
3230
+ }
3231
+
3232
+ return to;
3233
+ };
3234
+ return objectAssign;
3235
+ }
3236
+
3237
+ /**
3238
+ * Copyright (c) 2013-present, Facebook, Inc.
3239
+ *
3240
+ * This source code is licensed under the MIT license found in the
3241
+ * LICENSE file in the root directory of this source tree.
3242
+ */
3243
+
3244
+ var ReactPropTypesSecret_1;
3245
+ var hasRequiredReactPropTypesSecret;
3246
+
3247
+ function requireReactPropTypesSecret () {
3248
+ if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
3249
+ hasRequiredReactPropTypesSecret = 1;
3250
+
3251
+ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
3252
+
3253
+ ReactPropTypesSecret_1 = ReactPropTypesSecret;
3254
+ return ReactPropTypesSecret_1;
3255
+ }
3256
+
3257
+ var has;
3258
+ var hasRequiredHas;
3259
+
3260
+ function requireHas () {
3261
+ if (hasRequiredHas) return has;
3262
+ hasRequiredHas = 1;
3263
+ has = Function.call.bind(Object.prototype.hasOwnProperty);
3264
+ return has;
3265
+ }
3266
+
3267
+ /**
3268
+ * Copyright (c) 2013-present, Facebook, Inc.
3269
+ *
3270
+ * This source code is licensed under the MIT license found in the
3271
+ * LICENSE file in the root directory of this source tree.
3272
+ */
3273
+
3274
+ var checkPropTypes_1;
3275
+ var hasRequiredCheckPropTypes;
3276
+
3277
+ function requireCheckPropTypes () {
3278
+ if (hasRequiredCheckPropTypes) return checkPropTypes_1;
3279
+ hasRequiredCheckPropTypes = 1;
3280
+
3281
+ var printWarning = function() {};
3282
+
3283
+ if (process.env.NODE_ENV !== 'production') {
3284
+ var ReactPropTypesSecret = requireReactPropTypesSecret();
3285
+ var loggedTypeFailures = {};
3286
+ var has = requireHas();
3287
+
3288
+ printWarning = function(text) {
3289
+ var message = 'Warning: ' + text;
3290
+ if (typeof console !== 'undefined') {
3291
+ console.error(message);
3292
+ }
3293
+ try {
3294
+ // --- Welcome to debugging React ---
3295
+ // This error was thrown as a convenience so that you can use this stack
3296
+ // to find the callsite that caused this warning to fire.
3297
+ throw new Error(message);
3298
+ } catch (x) { /**/ }
3299
+ };
3300
+ }
3301
+
3302
+ /**
3303
+ * Assert that the values match with the type specs.
3304
+ * Error messages are memorized and will only be shown once.
3305
+ *
3306
+ * @param {object} typeSpecs Map of name to a ReactPropType
3307
+ * @param {object} values Runtime values that need to be type-checked
3308
+ * @param {string} location e.g. "prop", "context", "child context"
3309
+ * @param {string} componentName Name of the component for error messages.
3310
+ * @param {?Function} getStack Returns the component stack.
3311
+ * @private
3312
+ */
3313
+ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
3314
+ if (process.env.NODE_ENV !== 'production') {
3315
+ for (var typeSpecName in typeSpecs) {
3316
+ if (has(typeSpecs, typeSpecName)) {
3317
+ var error;
3318
+ // Prop type validation may throw. In case they do, we don't want to
3319
+ // fail the render phase where it didn't fail before. So we log it.
3320
+ // After these have been cleaned up, we'll let them throw.
3321
+ try {
3322
+ // This is intentionally an invariant that gets caught. It's the same
3323
+ // behavior as without this statement except with a better message.
3324
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
3325
+ var err = Error(
3326
+ (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
3327
+ 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
3328
+ 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
3329
+ );
3330
+ err.name = 'Invariant Violation';
3331
+ throw err;
3332
+ }
3333
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
3334
+ } catch (ex) {
3335
+ error = ex;
3336
+ }
3337
+ if (error && !(error instanceof Error)) {
3338
+ printWarning(
3339
+ (componentName || 'React class') + ': type specification of ' +
3340
+ location + ' `' + typeSpecName + '` is invalid; the type checker ' +
3341
+ 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
3342
+ 'You may have forgotten to pass an argument to the type checker ' +
3343
+ 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
3344
+ 'shape all require an argument).'
3345
+ );
3346
+ }
3347
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
3348
+ // Only monitor this failure once because there tends to be a lot of the
3349
+ // same error.
3350
+ loggedTypeFailures[error.message] = true;
3351
+
3352
+ var stack = getStack ? getStack() : '';
3353
+
3354
+ printWarning(
3355
+ 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
3356
+ );
3357
+ }
3358
+ }
3359
+ }
3360
+ }
3361
+ }
3362
+
3363
+ /**
3364
+ * Resets warning cache when testing.
3365
+ *
3366
+ * @private
3367
+ */
3368
+ checkPropTypes.resetWarningCache = function() {
3369
+ if (process.env.NODE_ENV !== 'production') {
3370
+ loggedTypeFailures = {};
3371
+ }
3372
+ };
3373
+
3374
+ checkPropTypes_1 = checkPropTypes;
3375
+ return checkPropTypes_1;
3376
+ }
3377
+
3378
+ /**
3379
+ * Copyright (c) 2013-present, Facebook, Inc.
3380
+ *
3381
+ * This source code is licensed under the MIT license found in the
3382
+ * LICENSE file in the root directory of this source tree.
3383
+ */
3384
+
3385
+ var factoryWithTypeCheckers;
3386
+ var hasRequiredFactoryWithTypeCheckers;
3387
+
3388
+ function requireFactoryWithTypeCheckers () {
3389
+ if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
3390
+ hasRequiredFactoryWithTypeCheckers = 1;
3391
+
3392
+ var ReactIs = requireReactIs();
3393
+ var assign = requireObjectAssign();
3394
+
3395
+ var ReactPropTypesSecret = requireReactPropTypesSecret();
3396
+ var has = requireHas();
3397
+ var checkPropTypes = requireCheckPropTypes();
3398
+
3399
+ var printWarning = function() {};
3400
+
3401
+ if (process.env.NODE_ENV !== 'production') {
3402
+ printWarning = function(text) {
3403
+ var message = 'Warning: ' + text;
3404
+ if (typeof console !== 'undefined') {
3405
+ console.error(message);
3406
+ }
3407
+ try {
3408
+ // --- Welcome to debugging React ---
3409
+ // This error was thrown as a convenience so that you can use this stack
3410
+ // to find the callsite that caused this warning to fire.
3411
+ throw new Error(message);
3412
+ } catch (x) {}
3413
+ };
3414
+ }
3415
+
3416
+ function emptyFunctionThatReturnsNull() {
3417
+ return null;
3418
+ }
3419
+
3420
+ factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
3421
+ /* global Symbol */
3422
+ var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
3423
+ var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
3424
+
3425
+ /**
3426
+ * Returns the iterator method function contained on the iterable object.
3427
+ *
3428
+ * Be sure to invoke the function with the iterable as context:
3429
+ *
3430
+ * var iteratorFn = getIteratorFn(myIterable);
3431
+ * if (iteratorFn) {
3432
+ * var iterator = iteratorFn.call(myIterable);
3433
+ * ...
3434
+ * }
3435
+ *
3436
+ * @param {?object} maybeIterable
3437
+ * @return {?function}
3438
+ */
3439
+ function getIteratorFn(maybeIterable) {
3440
+ var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
3441
+ if (typeof iteratorFn === 'function') {
3442
+ return iteratorFn;
3443
+ }
3444
+ }
3445
+
3446
+ /**
3447
+ * Collection of methods that allow declaration and validation of props that are
3448
+ * supplied to React components. Example usage:
3449
+ *
3450
+ * var Props = require('ReactPropTypes');
3451
+ * var MyArticle = React.createClass({
3452
+ * propTypes: {
3453
+ * // An optional string prop named "description".
3454
+ * description: Props.string,
3455
+ *
3456
+ * // A required enum prop named "category".
3457
+ * category: Props.oneOf(['News','Photos']).isRequired,
3458
+ *
3459
+ * // A prop named "dialog" that requires an instance of Dialog.
3460
+ * dialog: Props.instanceOf(Dialog).isRequired
3461
+ * },
3462
+ * render: function() { ... }
3463
+ * });
3464
+ *
3465
+ * A more formal specification of how these methods are used:
3466
+ *
3467
+ * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
3468
+ * decl := ReactPropTypes.{type}(.isRequired)?
3469
+ *
3470
+ * Each and every declaration produces a function with the same signature. This
3471
+ * allows the creation of custom validation functions. For example:
3472
+ *
3473
+ * var MyLink = React.createClass({
3474
+ * propTypes: {
3475
+ * // An optional string or URI prop named "href".
3476
+ * href: function(props, propName, componentName) {
3477
+ * var propValue = props[propName];
3478
+ * if (propValue != null && typeof propValue !== 'string' &&
3479
+ * !(propValue instanceof URI)) {
3480
+ * return new Error(
3481
+ * 'Expected a string or an URI for ' + propName + ' in ' +
3482
+ * componentName
3483
+ * );
3484
+ * }
3485
+ * }
3486
+ * },
3487
+ * render: function() {...}
3488
+ * });
3489
+ *
3490
+ * @internal
3491
+ */
3492
+
3493
+ var ANONYMOUS = '<<anonymous>>';
3494
+
3495
+ // Important!
3496
+ // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
3497
+ var ReactPropTypes = {
3498
+ array: createPrimitiveTypeChecker('array'),
3499
+ bigint: createPrimitiveTypeChecker('bigint'),
3500
+ bool: createPrimitiveTypeChecker('boolean'),
3501
+ func: createPrimitiveTypeChecker('function'),
3502
+ number: createPrimitiveTypeChecker('number'),
3503
+ object: createPrimitiveTypeChecker('object'),
3504
+ string: createPrimitiveTypeChecker('string'),
3505
+ symbol: createPrimitiveTypeChecker('symbol'),
3506
+
3507
+ any: createAnyTypeChecker(),
3508
+ arrayOf: createArrayOfTypeChecker,
3509
+ element: createElementTypeChecker(),
3510
+ elementType: createElementTypeTypeChecker(),
3511
+ instanceOf: createInstanceTypeChecker,
3512
+ node: createNodeChecker(),
3513
+ objectOf: createObjectOfTypeChecker,
3514
+ oneOf: createEnumTypeChecker,
3515
+ oneOfType: createUnionTypeChecker,
3516
+ shape: createShapeTypeChecker,
3517
+ exact: createStrictShapeTypeChecker,
3518
+ };
3519
+
3520
+ /**
3521
+ * inlined Object.is polyfill to avoid requiring consumers ship their own
3522
+ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
3523
+ */
3524
+ /*eslint-disable no-self-compare*/
3525
+ function is(x, y) {
3526
+ // SameValue algorithm
3527
+ if (x === y) {
3528
+ // Steps 1-5, 7-10
3529
+ // Steps 6.b-6.e: +0 != -0
3530
+ return x !== 0 || 1 / x === 1 / y;
3531
+ } else {
3532
+ // Step 6.a: NaN == NaN
3533
+ return x !== x && y !== y;
3534
+ }
3535
+ }
3536
+ /*eslint-enable no-self-compare*/
3537
+
3538
+ /**
3539
+ * We use an Error-like object for backward compatibility as people may call
3540
+ * PropTypes directly and inspect their output. However, we don't use real
3541
+ * Errors anymore. We don't inspect their stack anyway, and creating them
3542
+ * is prohibitively expensive if they are created too often, such as what
3543
+ * happens in oneOfType() for any type before the one that matched.
3544
+ */
3545
+ function PropTypeError(message, data) {
3546
+ this.message = message;
3547
+ this.data = data && typeof data === 'object' ? data: {};
3548
+ this.stack = '';
3549
+ }
3550
+ // Make `instanceof Error` still work for returned errors.
3551
+ PropTypeError.prototype = Error.prototype;
3552
+
3553
+ function createChainableTypeChecker(validate) {
3554
+ if (process.env.NODE_ENV !== 'production') {
3555
+ var manualPropTypeCallCache = {};
3556
+ var manualPropTypeWarningCount = 0;
3557
+ }
3558
+ function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
3559
+ componentName = componentName || ANONYMOUS;
3560
+ propFullName = propFullName || propName;
3561
+
3562
+ if (secret !== ReactPropTypesSecret) {
3563
+ if (throwOnDirectAccess) {
3564
+ // New behavior only for users of `prop-types` package
3565
+ var err = new Error(
3566
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
3567
+ 'Use `PropTypes.checkPropTypes()` to call them. ' +
3568
+ 'Read more at http://fb.me/use-check-prop-types'
3569
+ );
3570
+ err.name = 'Invariant Violation';
3571
+ throw err;
3572
+ } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
3573
+ // Old behavior for people using React.PropTypes
3574
+ var cacheKey = componentName + ':' + propName;
3575
+ if (
3576
+ !manualPropTypeCallCache[cacheKey] &&
3577
+ // Avoid spamming the console because they are often not actionable except for lib authors
3578
+ manualPropTypeWarningCount < 3
3579
+ ) {
3580
+ printWarning(
3581
+ 'You are manually calling a React.PropTypes validation ' +
3582
+ 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
3583
+ 'and will throw in the standalone `prop-types` package. ' +
3584
+ 'You may be seeing this warning due to a third-party PropTypes ' +
3585
+ 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
3586
+ );
3587
+ manualPropTypeCallCache[cacheKey] = true;
3588
+ manualPropTypeWarningCount++;
3589
+ }
3590
+ }
3591
+ }
3592
+ if (props[propName] == null) {
3593
+ if (isRequired) {
3594
+ if (props[propName] === null) {
3595
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
3596
+ }
3597
+ return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
3598
+ }
3599
+ return null;
3600
+ } else {
3601
+ return validate(props, propName, componentName, location, propFullName);
3602
+ }
3603
+ }
3604
+
3605
+ var chainedCheckType = checkType.bind(null, false);
3606
+ chainedCheckType.isRequired = checkType.bind(null, true);
3607
+
3608
+ return chainedCheckType;
3609
+ }
3610
+
3611
+ function createPrimitiveTypeChecker(expectedType) {
3612
+ function validate(props, propName, componentName, location, propFullName, secret) {
3613
+ var propValue = props[propName];
3614
+ var propType = getPropType(propValue);
3615
+ if (propType !== expectedType) {
3616
+ // `propValue` being instance of, say, date/regexp, pass the 'object'
3617
+ // check, but we can offer a more precise error message here rather than
3618
+ // 'of type `object`'.
3619
+ var preciseType = getPreciseType(propValue);
3620
+
3621
+ return new PropTypeError(
3622
+ 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
3623
+ {expectedType: expectedType}
3624
+ );
3625
+ }
3626
+ return null;
3627
+ }
3628
+ return createChainableTypeChecker(validate);
3629
+ }
3630
+
3631
+ function createAnyTypeChecker() {
3632
+ return createChainableTypeChecker(emptyFunctionThatReturnsNull);
3633
+ }
3634
+
3635
+ function createArrayOfTypeChecker(typeChecker) {
3636
+ function validate(props, propName, componentName, location, propFullName) {
3637
+ if (typeof typeChecker !== 'function') {
3638
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
3639
+ }
3640
+ var propValue = props[propName];
3641
+ if (!Array.isArray(propValue)) {
3642
+ var propType = getPropType(propValue);
3643
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
3644
+ }
3645
+ for (var i = 0; i < propValue.length; i++) {
3646
+ var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
3647
+ if (error instanceof Error) {
3648
+ return error;
3649
+ }
3650
+ }
3651
+ return null;
3652
+ }
3653
+ return createChainableTypeChecker(validate);
3654
+ }
3655
+
3656
+ function createElementTypeChecker() {
3657
+ function validate(props, propName, componentName, location, propFullName) {
3658
+ var propValue = props[propName];
3659
+ if (!isValidElement(propValue)) {
3660
+ var propType = getPropType(propValue);
3661
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
3662
+ }
3663
+ return null;
3664
+ }
3665
+ return createChainableTypeChecker(validate);
3666
+ }
3667
+
3668
+ function createElementTypeTypeChecker() {
3669
+ function validate(props, propName, componentName, location, propFullName) {
3670
+ var propValue = props[propName];
3671
+ if (!ReactIs.isValidElementType(propValue)) {
3672
+ var propType = getPropType(propValue);
3673
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
3674
+ }
3675
+ return null;
3676
+ }
3677
+ return createChainableTypeChecker(validate);
3678
+ }
3679
+
3680
+ function createInstanceTypeChecker(expectedClass) {
3681
+ function validate(props, propName, componentName, location, propFullName) {
3682
+ if (!(props[propName] instanceof expectedClass)) {
3683
+ var expectedClassName = expectedClass.name || ANONYMOUS;
3684
+ var actualClassName = getClassName(props[propName]);
3685
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
3686
+ }
3687
+ return null;
3688
+ }
3689
+ return createChainableTypeChecker(validate);
3690
+ }
3691
+
3692
+ function createEnumTypeChecker(expectedValues) {
3693
+ if (!Array.isArray(expectedValues)) {
3694
+ if (process.env.NODE_ENV !== 'production') {
3695
+ if (arguments.length > 1) {
3696
+ printWarning(
3697
+ 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
3698
+ 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
3699
+ );
3700
+ } else {
3701
+ printWarning('Invalid argument supplied to oneOf, expected an array.');
3702
+ }
3703
+ }
3704
+ return emptyFunctionThatReturnsNull;
3705
+ }
3706
+
3707
+ function validate(props, propName, componentName, location, propFullName) {
3708
+ var propValue = props[propName];
3709
+ for (var i = 0; i < expectedValues.length; i++) {
3710
+ if (is(propValue, expectedValues[i])) {
3711
+ return null;
3712
+ }
3713
+ }
3714
+
3715
+ var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
3716
+ var type = getPreciseType(value);
3717
+ if (type === 'symbol') {
3718
+ return String(value);
3719
+ }
3720
+ return value;
3721
+ });
3722
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
3723
+ }
3724
+ return createChainableTypeChecker(validate);
3725
+ }
3726
+
3727
+ function createObjectOfTypeChecker(typeChecker) {
3728
+ function validate(props, propName, componentName, location, propFullName) {
3729
+ if (typeof typeChecker !== 'function') {
3730
+ return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
3731
+ }
3732
+ var propValue = props[propName];
3733
+ var propType = getPropType(propValue);
3734
+ if (propType !== 'object') {
3735
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
3736
+ }
3737
+ for (var key in propValue) {
3738
+ if (has(propValue, key)) {
3739
+ var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
3740
+ if (error instanceof Error) {
3741
+ return error;
3742
+ }
3743
+ }
3744
+ }
3745
+ return null;
3746
+ }
3747
+ return createChainableTypeChecker(validate);
3748
+ }
3749
+
3750
+ function createUnionTypeChecker(arrayOfTypeCheckers) {
3751
+ if (!Array.isArray(arrayOfTypeCheckers)) {
3752
+ process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
3753
+ return emptyFunctionThatReturnsNull;
3754
+ }
3755
+
3756
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
3757
+ var checker = arrayOfTypeCheckers[i];
3758
+ if (typeof checker !== 'function') {
3759
+ printWarning(
3760
+ 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
3761
+ 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
3762
+ );
3763
+ return emptyFunctionThatReturnsNull;
3764
+ }
3765
+ }
3766
+
3767
+ function validate(props, propName, componentName, location, propFullName) {
3768
+ var expectedTypes = [];
3769
+ for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
3770
+ var checker = arrayOfTypeCheckers[i];
3771
+ var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
3772
+ if (checkerResult == null) {
3773
+ return null;
3774
+ }
3775
+ if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
3776
+ expectedTypes.push(checkerResult.data.expectedType);
3777
+ }
3778
+ }
3779
+ var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
3780
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
3781
+ }
3782
+ return createChainableTypeChecker(validate);
3783
+ }
3784
+
3785
+ function createNodeChecker() {
3786
+ function validate(props, propName, componentName, location, propFullName) {
3787
+ if (!isNode(props[propName])) {
3788
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
3789
+ }
3790
+ return null;
3791
+ }
3792
+ return createChainableTypeChecker(validate);
3793
+ }
3794
+
3795
+ function invalidValidatorError(componentName, location, propFullName, key, type) {
3796
+ return new PropTypeError(
3797
+ (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
3798
+ 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
3799
+ );
3800
+ }
3801
+
3802
+ function createShapeTypeChecker(shapeTypes) {
3803
+ function validate(props, propName, componentName, location, propFullName) {
3804
+ var propValue = props[propName];
3805
+ var propType = getPropType(propValue);
3806
+ if (propType !== 'object') {
3807
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
3808
+ }
3809
+ for (var key in shapeTypes) {
3810
+ var checker = shapeTypes[key];
3811
+ if (typeof checker !== 'function') {
3812
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
3813
+ }
3814
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
3815
+ if (error) {
3816
+ return error;
3817
+ }
3818
+ }
3819
+ return null;
3820
+ }
3821
+ return createChainableTypeChecker(validate);
3822
+ }
3823
+
3824
+ function createStrictShapeTypeChecker(shapeTypes) {
3825
+ function validate(props, propName, componentName, location, propFullName) {
3826
+ var propValue = props[propName];
3827
+ var propType = getPropType(propValue);
3828
+ if (propType !== 'object') {
3829
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
3830
+ }
3831
+ // We need to check all keys in case some are required but missing from props.
3832
+ var allKeys = assign({}, props[propName], shapeTypes);
3833
+ for (var key in allKeys) {
3834
+ var checker = shapeTypes[key];
3835
+ if (has(shapeTypes, key) && typeof checker !== 'function') {
3836
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
3837
+ }
3838
+ if (!checker) {
3839
+ return new PropTypeError(
3840
+ 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
3841
+ '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
3842
+ '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
3843
+ );
3844
+ }
3845
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
3846
+ if (error) {
3847
+ return error;
3848
+ }
3849
+ }
3850
+ return null;
3851
+ }
3852
+
3853
+ return createChainableTypeChecker(validate);
3854
+ }
3855
+
3856
+ function isNode(propValue) {
3857
+ switch (typeof propValue) {
3858
+ case 'number':
3859
+ case 'string':
3860
+ case 'undefined':
3861
+ return true;
3862
+ case 'boolean':
3863
+ return !propValue;
3864
+ case 'object':
3865
+ if (Array.isArray(propValue)) {
3866
+ return propValue.every(isNode);
3867
+ }
3868
+ if (propValue === null || isValidElement(propValue)) {
3869
+ return true;
3870
+ }
3871
+
3872
+ var iteratorFn = getIteratorFn(propValue);
3873
+ if (iteratorFn) {
3874
+ var iterator = iteratorFn.call(propValue);
3875
+ var step;
3876
+ if (iteratorFn !== propValue.entries) {
3877
+ while (!(step = iterator.next()).done) {
3878
+ if (!isNode(step.value)) {
3879
+ return false;
3880
+ }
3881
+ }
3882
+ } else {
3883
+ // Iterator will provide entry [k,v] tuples rather than values.
3884
+ while (!(step = iterator.next()).done) {
3885
+ var entry = step.value;
3886
+ if (entry) {
3887
+ if (!isNode(entry[1])) {
3888
+ return false;
3889
+ }
3890
+ }
3891
+ }
3892
+ }
3893
+ } else {
3894
+ return false;
3895
+ }
3896
+
3897
+ return true;
3898
+ default:
3899
+ return false;
3900
+ }
3901
+ }
3902
+
3903
+ function isSymbol(propType, propValue) {
3904
+ // Native Symbol.
3905
+ if (propType === 'symbol') {
3906
+ return true;
3907
+ }
3908
+
3909
+ // falsy value can't be a Symbol
3910
+ if (!propValue) {
3911
+ return false;
3912
+ }
3913
+
3914
+ // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
3915
+ if (propValue['@@toStringTag'] === 'Symbol') {
3916
+ return true;
3917
+ }
3918
+
3919
+ // Fallback for non-spec compliant Symbols which are polyfilled.
3920
+ if (typeof Symbol === 'function' && propValue instanceof Symbol) {
3921
+ return true;
3922
+ }
3923
+
3924
+ return false;
3925
+ }
3926
+
3927
+ // Equivalent of `typeof` but with special handling for array and regexp.
3928
+ function getPropType(propValue) {
3929
+ var propType = typeof propValue;
3930
+ if (Array.isArray(propValue)) {
3931
+ return 'array';
3932
+ }
3933
+ if (propValue instanceof RegExp) {
3934
+ // Old webkits (at least until Android 4.0) return 'function' rather than
3935
+ // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
3936
+ // passes PropTypes.object.
3937
+ return 'object';
3938
+ }
3939
+ if (isSymbol(propType, propValue)) {
3940
+ return 'symbol';
3941
+ }
3942
+ return propType;
3943
+ }
3944
+
3945
+ // This handles more types than `getPropType`. Only used for error messages.
3946
+ // See `createPrimitiveTypeChecker`.
3947
+ function getPreciseType(propValue) {
3948
+ if (typeof propValue === 'undefined' || propValue === null) {
3949
+ return '' + propValue;
3950
+ }
3951
+ var propType = getPropType(propValue);
3952
+ if (propType === 'object') {
3953
+ if (propValue instanceof Date) {
3954
+ return 'date';
3955
+ } else if (propValue instanceof RegExp) {
3956
+ return 'regexp';
3957
+ }
3958
+ }
3959
+ return propType;
3960
+ }
3961
+
3962
+ // Returns a string that is postfixed to a warning about an invalid type.
3963
+ // For example, "undefined" or "of type array"
3964
+ function getPostfixForTypeWarning(value) {
3965
+ var type = getPreciseType(value);
3966
+ switch (type) {
3967
+ case 'array':
3968
+ case 'object':
3969
+ return 'an ' + type;
3970
+ case 'boolean':
3971
+ case 'date':
3972
+ case 'regexp':
3973
+ return 'a ' + type;
3974
+ default:
3975
+ return type;
3976
+ }
3977
+ }
3978
+
3979
+ // Returns class name of the object, if any.
3980
+ function getClassName(propValue) {
3981
+ if (!propValue.constructor || !propValue.constructor.name) {
3982
+ return ANONYMOUS;
3983
+ }
3984
+ return propValue.constructor.name;
3985
+ }
3986
+
3987
+ ReactPropTypes.checkPropTypes = checkPropTypes;
3988
+ ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
3989
+ ReactPropTypes.PropTypes = ReactPropTypes;
3990
+
3991
+ return ReactPropTypes;
3992
+ };
3993
+ return factoryWithTypeCheckers;
3994
+ }
3995
+
3996
+ /**
3997
+ * Copyright (c) 2013-present, Facebook, Inc.
3998
+ *
3999
+ * This source code is licensed under the MIT license found in the
4000
+ * LICENSE file in the root directory of this source tree.
4001
+ */
4002
+
4003
+ var factoryWithThrowingShims;
4004
+ var hasRequiredFactoryWithThrowingShims;
4005
+
4006
+ function requireFactoryWithThrowingShims () {
4007
+ if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
4008
+ hasRequiredFactoryWithThrowingShims = 1;
4009
+
4010
+ var ReactPropTypesSecret = requireReactPropTypesSecret();
4011
+
4012
+ function emptyFunction() {}
4013
+ function emptyFunctionWithReset() {}
4014
+ emptyFunctionWithReset.resetWarningCache = emptyFunction;
4015
+
4016
+ factoryWithThrowingShims = function() {
4017
+ function shim(props, propName, componentName, location, propFullName, secret) {
4018
+ if (secret === ReactPropTypesSecret) {
4019
+ // It is still safe when called from React.
4020
+ return;
4021
+ }
4022
+ var err = new Error(
4023
+ 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
4024
+ 'Use PropTypes.checkPropTypes() to call them. ' +
4025
+ 'Read more at http://fb.me/use-check-prop-types'
4026
+ );
4027
+ err.name = 'Invariant Violation';
4028
+ throw err;
4029
+ } shim.isRequired = shim;
4030
+ function getShim() {
4031
+ return shim;
4032
+ } // Important!
4033
+ // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
4034
+ var ReactPropTypes = {
4035
+ array: shim,
4036
+ bigint: shim,
4037
+ bool: shim,
4038
+ func: shim,
4039
+ number: shim,
4040
+ object: shim,
4041
+ string: shim,
4042
+ symbol: shim,
4043
+
4044
+ any: shim,
4045
+ arrayOf: getShim,
4046
+ element: shim,
4047
+ elementType: shim,
4048
+ instanceOf: getShim,
4049
+ node: shim,
4050
+ objectOf: getShim,
4051
+ oneOf: getShim,
4052
+ oneOfType: getShim,
4053
+ shape: getShim,
4054
+ exact: getShim,
4055
+
4056
+ checkPropTypes: emptyFunctionWithReset,
4057
+ resetWarningCache: emptyFunction
4058
+ };
4059
+
4060
+ ReactPropTypes.PropTypes = ReactPropTypes;
4061
+
4062
+ return ReactPropTypes;
4063
+ };
4064
+ return factoryWithThrowingShims;
4065
+ }
4066
+
4067
+ /**
4068
+ * Copyright (c) 2013-present, Facebook, Inc.
4069
+ *
4070
+ * This source code is licensed under the MIT license found in the
4071
+ * LICENSE file in the root directory of this source tree.
4072
+ */
4073
+
4074
+ if (process.env.NODE_ENV !== 'production') {
4075
+ var ReactIs = requireReactIs();
4076
+
4077
+ // By explicitly using `prop-types` you are opting into new development behavior.
4078
+ // http://fb.me/prop-types-in-prod
4079
+ var throwOnDirectAccess = true;
4080
+ propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
4081
+ } else {
4082
+ // By explicitly using `prop-types` you are opting into new production behavior.
4083
+ // http://fb.me/prop-types-in-prod
4084
+ propTypes.exports = requireFactoryWithThrowingShims()();
4085
+ }
4086
+
2886
4087
  var MemoizedEditorContent = /*#__PURE__*/React.memo(EditorContent);
2887
- var EmailPreview = function EmailPreview(_ref) {
2888
- var _ref$to = _ref.to,
4088
+ var EmailPreview = withT(function (_ref) {
4089
+ var t = _ref.t,
4090
+ _ref$to = _ref.to,
2889
4091
  to = _ref$to === void 0 ? [] : _ref$to,
2890
4092
  from = _ref.from,
2891
4093
  subject = _ref.subject,
@@ -2895,8 +4097,6 @@ var EmailPreview = function EmailPreview(_ref) {
2895
4097
  logo = _ref.logo,
2896
4098
  _ref$className = _ref.className,
2897
4099
  className = _ref$className === void 0 ? "" : _ref$className;
2898
- var _useTranslation = useTranslation(),
2899
- t = _useTranslation.t;
2900
4100
  return /*#__PURE__*/React.createElement("div", {
2901
4101
  "data-cy": "email-preview-card",
2902
4102
  "data-testid": "email-preview",
@@ -2973,6 +4173,36 @@ var EmailPreview = function EmailPreview(_ref) {
2973
4173
  }, t("neetoMolecules.emailPreview.poweredBy"), /*#__PURE__*/React.createElement("span", {
2974
4174
  className: "neeto-ui-text-gray-800 font-medium"
2975
4175
  }, productName))));
4176
+ });
4177
+ EmailPreview.propTypes = {
4178
+ /**
4179
+ * The value of the send-to field.
4180
+ */
4181
+ to: propTypes.exports.arrayOf(propTypes.exports.string),
4182
+ /**
4183
+ * The value of the send-from field.
4184
+ */
4185
+ from: propTypes.exports.string,
4186
+ /**
4187
+ * The subject of the email.
4188
+ */
4189
+ subject: propTypes.exports.string,
4190
+ /**
4191
+ * The body of the email.
4192
+ */
4193
+ body: propTypes.exports.string,
4194
+ /**
4195
+ * The name of the neeto product to be previewed.
4196
+ */
4197
+ productName: propTypes.exports.string,
4198
+ /**
4199
+ * The text to be shown in the action button.
4200
+ */
4201
+ actionButtonText: propTypes.exports.string,
4202
+ /**
4203
+ * Source link for the company logo.
4204
+ */
4205
+ logo: propTypes.exports.string
2976
4206
  };
2977
4207
 
2978
4208
  export { EmailForm, EmailFormProvider, EmailPreview };