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