cluedin-widget
Version:
846 lines (699 loc) • 32 kB
JavaScript
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[29],{
/***/ 1927:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/objectSpread.js
var objectSpread = __webpack_require__(2);
var objectSpread_default = /*#__PURE__*/__webpack_require__.n(objectSpread);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/classCallCheck.js
var classCallCheck = __webpack_require__(12);
var classCallCheck_default = /*#__PURE__*/__webpack_require__.n(classCallCheck);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/createClass.js
var createClass = __webpack_require__(13);
var createClass_default = /*#__PURE__*/__webpack_require__.n(createClass);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js
var possibleConstructorReturn = __webpack_require__(14);
var possibleConstructorReturn_default = /*#__PURE__*/__webpack_require__.n(possibleConstructorReturn);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/getPrototypeOf.js
var getPrototypeOf = __webpack_require__(15);
var getPrototypeOf_default = /*#__PURE__*/__webpack_require__.n(getPrototypeOf);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/inherits.js
var inherits = __webpack_require__(16);
var inherits_default = /*#__PURE__*/__webpack_require__.n(inherits);
// EXTERNAL MODULE: ./node_modules/react/index.js
var react = __webpack_require__(0);
var react_default = /*#__PURE__*/__webpack_require__.n(react);
// EXTERNAL MODULE: ./node_modules/react-intl/lib/index.es.js
var index_es = __webpack_require__(4);
// EXTERNAL MODULE: ./node_modules/redux-form/es/index.js
var es = __webpack_require__(66);
// EXTERNAL MODULE: ./node_modules/react-redux/es/index.js + 18 modules
var react_redux_es = __webpack_require__(8);
// EXTERNAL MODULE: ./node_modules/recompose/es/Recompose.js
var Recompose = __webpack_require__(6);
// EXTERNAL MODULE: ./node_modules/connected-react-router/lib/index.js
var lib = __webpack_require__(25);
// EXTERNAL MODULE: ./node_modules/uxi/Widget/index.js
var Widget = __webpack_require__(40);
var Widget_default = /*#__PURE__*/__webpack_require__.n(Widget);
// EXTERNAL MODULE: ./node_modules/uxi/Input/index.js
var Input = __webpack_require__(35);
// EXTERNAL MODULE: ./node_modules/uxi/Indicator/index.js
var Indicator = __webpack_require__(43);
// EXTERNAL MODULE: ./node_modules/uxi/Button/index.js
var Button = __webpack_require__(18);
var Button_default = /*#__PURE__*/__webpack_require__.n(Button);
// EXTERNAL MODULE: ./core/modules/core/components/composites/form/FormDecorator.js
var FormDecorator = __webpack_require__(308);
// EXTERNAL MODULE: ./node_modules/uxi/Icons/index.js
var Icons = __webpack_require__(9);
// EXTERNAL MODULE: ./node_modules/uxi/DataGrid/index.js
var DataGrid = __webpack_require__(144);
var DataGrid_default = /*#__PURE__*/__webpack_require__.n(DataGrid);
// EXTERNAL MODULE: ./core/modules/integration/components/composites/IntegrationNameWithLogo.jsx
var IntegrationNameWithLogo = __webpack_require__(116);
// CONCATENATED MODULE: ./core/modules/consent/components/composites/uniqueIdentifier/UniqueIdentifiersSelection.js
// Why Button Link?
// https://github.com/erikras/redux-form/issues/2235
var UniqueIdentifiersSelection_RenderBoolean = function RenderBoolean(_ref) {
var entity = _ref.entity;
return entity.IsRequired ? react_default.a.createElement("span", null, "True") : react_default.a.createElement("span", null, "No");
};
var UniqueIdentifiersSelection_IntegrationLogoWithName = function IntegrationLogoWithName(_ref2) {
var entity = _ref2.entity;
return react_default.a.createElement("div", null, react_default.a.createElement(IntegrationNameWithLogo["a" /* default */], {
integration: entity.integration
}));
};
var UniqueIdentifiersSelection_IdentifierList = function IdentifierList(_ref3) {
var _ref3$values = _ref3.values,
values = _ref3$values === void 0 ? [] : _ref3$values;
return react_default.a.createElement("div", null, values.map(function (v) {
return react_default.a.createElement("div", {
key: v
}, v);
}));
};
var UniqueIdentifiersSelection_RenderIdentifier = function RenderIdentifier(_ref4) {
var value = _ref4.value;
return react_default.a.createElement("div", null, (!value || value.length === 0) && react_default.a.createElement("span", {
style: {
color: '#ccc'
}
}, "none"), value ? react_default.a.createElement(UniqueIdentifiersSelection_IdentifierList, {
values: value
}) : 'None');
};
var UniqueIdentifiersSelection_UniqueIdentifiersSelection = function UniqueIdentifiersSelection(_ref5) {
var value = _ref5.value,
onClickAddUniqueIdentifier = _ref5.onClickAddUniqueIdentifier,
removeUniqueIdentifierByIndexes = _ref5.removeUniqueIdentifierByIndexes,
disabled = _ref5.disabled,
hasUniqueIdentifier = _ref5.hasUniqueIdentifier;
var content;
if (!value || value.length === 0) {
content = react_default.a.createElement("div", {
style: {
border: '1px solid #ccc',
padding: '15px',
textAlign: 'center'
}
}, react_default.a.createElement("div", null, "No data processor selected"), !disabled && react_default.a.createElement("div", {
style: {
marginTop: '15px'
}
}, react_default.a.createElement(Button["ButtonLink"], {
icon: react_default.a.createElement(Icons["Add"], null),
text: react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-addProcessor"
}),
onClick: function onClick() {
onClickAddUniqueIdentifier();
}
})));
} else {
content = react_default.a.createElement("div", null, !disabled && !hasUniqueIdentifier && react_default.a.createElement(Button["ButtonLink"], {
icon: react_default.a.createElement(Icons["Add"], null),
onClick: onClickAddUniqueIdentifier,
text: "Add Data Processor"
}), react_default.a.createElement("div", {
style: {
borderTop: '1px solid #ccc',
borderLeft: '1px solid #ccc',
borderRight: '1px solid #ccc',
marginTop: '15px'
}
}, react_default.a.createElement(DataGrid_default.a, {
selectable: !disabled,
multiSelecatble: !disabled,
data: value,
properties: [{
isComputed: true,
property: 'Integration',
displayName: react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-application",
defaultMessage: "Data Processor"
}),
Component: UniqueIdentifiersSelection_IntegrationLogoWithName
}, {
property: 'identifiers',
displayName: react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-key",
defaultMessage: "Identifier Key"
}),
Component: UniqueIdentifiersSelection_RenderIdentifier
}, {
property: 'Consent',
displayName: react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-consentExplanation",
defaultMessage: "Explanation"
})
}, {
isComputed: true,
property: 'IsRequired',
displayName: react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-mustBeChecked",
defaultMessage: "Required"
}),
Component: UniqueIdentifiersSelection_RenderBoolean
}],
batchActions: [{
icon: react_default.a.createElement(Icons["Delete"], null),
label: react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-delete",
defaultMessage: "Delete"
}),
clearSelection: true,
onClick: function onClick(e, valuesFromSelection) {
var result = [];
value.forEach(function (i) {
var hasId = valuesFromSelection.find(function (key) {
return key === i.id;
});
if (hasId) {
var index = value.indexOf(i);
result.push(index);
}
});
removeUniqueIdentifierByIndexes(result);
}
}]
})));
}
return react_default.a.createElement("div", null, content);
};
/* harmony default export */ var uniqueIdentifier_UniqueIdentifiersSelection = (UniqueIdentifiersSelection_UniqueIdentifiersSelection);
// EXTERNAL MODULE: ./core/modules/core/components/composites/form/FormWrapper.js + 1 modules
var FormWrapper = __webpack_require__(559);
// EXTERNAL MODULE: ./core/modules/core/helpers/form.js
var helpers_form = __webpack_require__(100);
// CONCATENATED MODULE: ./core/modules/consent/components/composites/UserConsentFormGenerator.js
var ShortExplanation = Object(FormDecorator["a" /* default */])(Input["TextField"], {
label: 'Short Explanation',
helpText: 'Short text describing the reason why you need the data.',
isRequired: true
});
var TitleField = Object(FormDecorator["a" /* default */])(Input["TextField"], {
label: react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-title",
defaultMessage: "Title"
}),
helpText: react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-titleHelp",
defaultMessage: "Short title to ask consent to your user. Default value is 'Do you give CluedIn consent?"
}),
isRequired: true
});
var UniqueIdentifierField = Object(FormDecorator["a" /* default */])(uniqueIdentifier_UniqueIdentifiersSelection, {
label: react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-dataProcessorsConsentConfiguration",
defaultMessage: "Data Processors"
}),
helpText: react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-dataProcessorsConsentConfigurationHelp",
defaultMessage: "Please, choose the processors you are using for this consent."
})
});
var PrivacyField = Object(FormDecorator["a" /* default */])(Input["TextField"], {
label: react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-privacyUrl",
defaultMessage: "Privacy Url"
}),
helpText: react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-privacyUrlHelp",
defaultMessage: "The link to your privacy policy."
})
});
var UserConsentFormGenerator_UserConsentFormGenerator = function UserConsentFormGenerator(_ref) {
var onClickAddUniqueIdentifier = _ref.onClickAddUniqueIdentifier,
handleSubmit = _ref.handleSubmit,
onGenerateForm = _ref.onGenerateForm,
onPreview = _ref.onPreview,
removeUniqueIdentifierByIndexes = _ref.removeUniqueIdentifierByIndexes,
isSaving = _ref.isSaving,
id = _ref.id;
return react_default.a.createElement("div", null, react_default.a.createElement(FormWrapper["a" /* default */], {
withRequiredFields: true
}, react_default.a.createElement(es["Field"], {
name: "title",
validate: [helpers_form["d" /* required */]],
component: TitleField,
disabled: !!id
}), react_default.a.createElement(es["Field"], {
name: "shortExplanation",
validate: [helpers_form["d" /* required */]],
component: ShortExplanation,
disabled: !!id
}), react_default.a.createElement(es["Field"], {
name: "processors",
component: UniqueIdentifierField,
onClickAddUniqueIdentifier: onClickAddUniqueIdentifier,
removeUniqueIdentifierByIndexes: removeUniqueIdentifierByIndexes,
disabled: !!id
}), react_default.a.createElement(es["Field"], {
validate: [helpers_form["e" /* url */]],
name: "privacyLink",
component: PrivacyField,
disabled: !!id
})), react_default.a.createElement("div", {
style: {
marginTop: '15px'
}
}, !id && react_default.a.createElement(Button_default.a, {
onClick: handleSubmit(onGenerateForm),
icon: isSaving ? react_default.a.createElement(Indicator["Loader"], null) : null,
type: "primary"
}, id ? react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-publishChanges",
defaultMessage: "Publish Changes"
}) : react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-create",
defaultMessage: "Create"
})), react_default.a.createElement(Button_default.a, {
style: {
marginLeft: '15px'
},
onClick: handleSubmit(onPreview)
}, react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-previewConsentForm",
defaultMessage: "Preview Consent Form"
})), id && react_default.a.createElement("div", {
style: {
marginLeft: '15px',
marginTop: '5px',
color: 'red'
}
}, react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-noSupportForEdit",
defaultMessage: "We currently do not support form edition. Contact our support if it is causing you troubles."
}))));
};
/* harmony default export */ var composites_UserConsentFormGenerator = (UserConsentFormGenerator_UserConsentFormGenerator);
// CONCATENATED MODULE: ./core/modules/consent/components/containers/UserConsentFormGeneratorContainer.js
var UserConsentFormGeneratorWithReduxForm = Object(es["reduxForm"])({
form: 'UserConsentFormGenerator'
})(composites_UserConsentFormGenerator);
/* harmony default export */ var UserConsentFormGeneratorContainer = (UserConsentFormGeneratorWithReduxForm);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/extends.js
var helpers_extends = __webpack_require__(28);
var extends_default = /*#__PURE__*/__webpack_require__.n(helpers_extends);
// EXTERNAL MODULE: ./node_modules/uxi/Stepper/index.js
var Stepper = __webpack_require__(80);
// EXTERNAL MODULE: ./node_modules/uxi/internal/wrapInClientFormHOC.js
var wrapInClientFormHOC = __webpack_require__(1900);
var wrapInClientFormHOC_default = /*#__PURE__*/__webpack_require__.n(wrapInClientFormHOC);
// EXTERNAL MODULE: ./core/modules/consent/components/composites/uniqueIdentifier/UniqueIdentifiersSelector.js + 2 modules
var UniqueIdentifiersSelector = __webpack_require__(1930);
// EXTERNAL MODULE: ./node_modules/uxi/Drawer/index.js
var Drawer = __webpack_require__(184);
var Drawer_default = /*#__PURE__*/__webpack_require__.n(Drawer);
// EXTERNAL MODULE: ./node_modules/uxi/Panel/index.js
var Panel = __webpack_require__(34);
// CONCATENATED MODULE: ./core/modules/consent/components/composites/uniqueIdentifier/UniqueIdentifierSlidePanel.js
var UniqueIdentifierSlidePanel_UniqueIdentifierSlidePanel = function UniqueIdentifierSlidePanel(_ref) {
var children = _ref.children,
show = _ref.show,
title = _ref.title,
onClose = _ref.onClose;
return react_default.a.createElement(Drawer_default.a, {
style: {
width: '600px'
},
offsetTop: "48px",
onClose: onClose,
open: show
}, react_default.a.createElement(Panel["Panel"], null, title && react_default.a.createElement(Panel["PanelHeader"], {
hasClose: true,
title: title,
onClose: onClose
}), react_default.a.createElement(Panel["PanelContent"], null, children)));
};
/* harmony default export */ var uniqueIdentifier_UniqueIdentifierSlidePanel = (UniqueIdentifierSlidePanel_UniqueIdentifierSlidePanel);
// EXTERNAL MODULE: ./core/modules/consent/components/containers/ProcessorChooserContainer.js + 4 modules
var ProcessorChooserContainer = __webpack_require__(1928);
// CONCATENATED MODULE: ./core/modules/consent/components/containers/UniqueIdentifiersSelectorContainerSlide.js
var UniqueIdentifiersSelectorClientForm = wrapInClientFormHOC_default()(UniqueIdentifiersSelector["a" /* default */]);
var UniqueIdentifiersSelectorContainerWithReduxForm = Object(es["reduxForm"])({
form: 'UniqueIdentifiersSelectorContainer'
})(UniqueIdentifiersSelectorClientForm);
var UniqueIdentifiersSelectorContainerSlide_UniqueIdentifiersSelectorContainerSlide =
/*#__PURE__*/
function (_Component) {
inherits_default()(UniqueIdentifiersSelectorContainerSlide, _Component);
function UniqueIdentifiersSelectorContainerSlide(props) {
var _this;
classCallCheck_default()(this, UniqueIdentifiersSelectorContainerSlide);
_this = possibleConstructorReturn_default()(this, getPrototypeOf_default()(UniqueIdentifiersSelectorContainerSlide).call(this, props));
_this.state = {
selectedIntegration: null,
selectedUniqueIdentifier: {}
};
return _this;
}
createClass_default()(UniqueIdentifiersSelectorContainerSlide, [{
key: "getContent",
value: function getContent() {
var _this2 = this;
var selectedIntegration = this.state.selectedIntegration;
if (!selectedIntegration) {
return react_default.a.createElement(ProcessorChooserContainer["a" /* default */], {
integrationSelected: [],
addProcessor: function addProcessor(integration) {
_this2.addProcessor(integration);
}
});
}
return react_default.a.createElement(UniqueIdentifiersSelectorContainerWithReduxForm, {
integration: selectedIntegration.config,
onClickAddUniqueIdentifier: function onClickAddUniqueIdentifier(identifier) {
_this2.addUniqueIdentifierHandler(identifier);
}
});
}
}, {
key: "addProcessor",
value: function addProcessor(integration) {
this.setState({
selectedIntegration: integration
});
}
}, {
key: "addUniqueIdentifierHandler",
value: function addUniqueIdentifierHandler(identifier) {
var onClickAddUniqueIdentifierFromSelector = this.props.onClickAddUniqueIdentifierFromSelector;
var selectedIntegration = this.state.selectedIntegration;
var providerId = selectedIntegration.Id;
if (onClickAddUniqueIdentifierFromSelector) {
onClickAddUniqueIdentifierFromSelector({
identifiers: identifier.key,
Consent: identifier.explanation,
IsRequired: !!identifier.required,
ProviderId: providerId,
integration: selectedIntegration
});
}
this.setState({
selectedIntegration: null
});
}
}, {
key: "render",
value: function render() {
var selectedIntegration = this.state.selectedIntegration;
var activeStep = selectedIntegration ? 2 : 1;
return react_default.a.createElement(uniqueIdentifier_UniqueIdentifierSlidePanel, extends_default()({}, this.props, {
title: react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-AddUniqueIdentifier",
defaultMessage: "Add Data Processor"
})
}), react_default.a.createElement("div", null, react_default.a.createElement(Stepper["Stepper"], {
linear: true,
activeStep: activeStep
}, react_default.a.createElement(Stepper["Step"], null, react_default.a.createElement(Stepper["StepButton"], null, react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-AddUniqueIdentifier-step1",
defaultMessage: "Choose Data Processor"
}))), react_default.a.createElement(Stepper["Step"], null, react_default.a.createElement(Stepper["StepButton"], null, react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-AddUniqueIdentifier-step2",
defaultMessage: "Setup"
})))), react_default.a.createElement("div", {
style: {
borderTop: '1px solid #ccc'
}
}, this.getContent())));
}
}]);
return UniqueIdentifiersSelectorContainerSlide;
}(react["Component"]);
/* harmony default export */ var containers_UniqueIdentifiersSelectorContainerSlide = (UniqueIdentifiersSelectorContainerSlide_UniqueIdentifiersSelectorContainerSlide);
// EXTERNAL MODULE: ./core/modules/core/components/composites/alerts/DefaultAlert.js
var DefaultAlert = __webpack_require__(115);
// EXTERNAL MODULE: ./node_modules/uxi/Dialog/index.js
var Dialog = __webpack_require__(68);
var Dialog_default = /*#__PURE__*/__webpack_require__.n(Dialog);
// EXTERNAL MODULE: ./core/modules/consent/components/composites/UserConsentForEndUser.js + 1 modules
var UserConsentForEndUser = __webpack_require__(574);
// CONCATENATED MODULE: ./core/modules/consent/components/composites/dialogs/ConsentFormPreviewDialog.js
var ConsentFormPreviewDialog_ConsentFormPreviewDialog = function ConsentFormPreviewDialog(_ref) {
var consent = _ref.consent,
show = _ref.show,
onClose = _ref.onClose;
return react_default.a.createElement(Dialog_default.a, {
style: {
maxWidth: '940px'
},
onClose: onClose,
show: show
}, react_default.a.createElement(UserConsentForEndUser["a" /* default */], {
isPreview: true,
onSaveConsentEntries: function onSaveConsentEntries() {
// eslint-disable-next-line no-alert
alert('This is a preview form to experience what end-users will see, nothing will be saved.');
onClose();
},
consentForm: consent
}));
};
/* harmony default export */ var dialogs_ConsentFormPreviewDialog = (ConsentFormPreviewDialog_ConsentFormPreviewDialog);
// EXTERNAL MODULE: ./core/modules/core/components/composites/PageLoader.js
var PageLoader = __webpack_require__(38);
// EXTERNAL MODULE: ./core/modules/consent/actions.js + 1 modules
var actions = __webpack_require__(42);
// EXTERNAL MODULE: ./core/modules/integration/actions.js + 1 modules
var integration_actions = __webpack_require__(55);
// EXTERNAL MODULE: ./core/modules/consent/converter.js
var converter = __webpack_require__(267);
// CONCATENATED MODULE: ./core/modules/consent/components/containers/WebsiteFormGeneratorContainer.js
var WebsiteFormGeneratorContainer_WebsiteFormGeneratorContainer =
/*#__PURE__*/
function (_Component) {
inherits_default()(WebsiteFormGeneratorContainer, _Component);
function WebsiteFormGeneratorContainer(props) {
var _this;
classCallCheck_default()(this, WebsiteFormGeneratorContainer);
_this = possibleConstructorReturn_default()(this, getPrototypeOf_default()(WebsiteFormGeneratorContainer).call(this, props));
_this.state = {
showUniqueIdentifier: false,
previewConsent: null,
viewCode: false,
selectedUniqueIdentifier: {}
};
return _this;
}
createClass_default()(WebsiteFormGeneratorContainer, [{
key: "onPreviewHandler",
value: function onPreviewHandler(consent) {
this.setState({
previewConsent: consent
});
}
}, {
key: "onAddUniqueIdentifierToForm",
value: function onAddUniqueIdentifierToForm(values) {
var addUniqueIdentifier = this.props.addUniqueIdentifier;
addUniqueIdentifier(values);
this.setState({
showUniqueIdentifier: false
});
}
}, {
key: "addUniqueIdentifier",
value: function addUniqueIdentifier() {
this.setState({
showUniqueIdentifier: true
});
}
}, {
key: "generateFormHandler",
value: function generateFormHandler(value) {
var _this$props = this.props,
generateForm = _this$props.generateForm,
currentOrganization = _this$props.currentOrganization;
if (generateForm) {
generateForm(value, currentOrganization);
}
}
}, {
key: "closeUniqueIdentifierPanel",
value: function closeUniqueIdentifierPanel() {
this.setState({
showUniqueIdentifier: false
});
}
}, {
key: "closePreviewHandler",
value: function closePreviewHandler() {
this.setState({
previewConsent: null
});
}
}, {
key: "closeViewCodeHandler",
value: function closeViewCodeHandler() {
this.setState({
viewCode: false
});
}
}, {
key: "render",
value: function render() {
var _this$state = this.state,
showUniqueIdentifier = _this$state.showUniqueIdentifier,
selectedUniqueIdentifier = _this$state.selectedUniqueIdentifier,
previewConsent = _this$state.previewConsent;
var _this$props2 = this.props,
consentForm = _this$props2.consentForm,
removeUniqueIdentifierByIndexes = _this$props2.removeUniqueIdentifierByIndexes,
id = _this$props2.id,
isSaving = _this$props2.isSaving;
return react_default.a.createElement(Widget_default.a, {
title: id ? react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-editConsentFormTitle",
defaultMessage: "Edit Consent Form"
}) : react_default.a.createElement(index_es["FormattedMessage"], {
id: "module-consent-createConsentFormTitle",
defaultMessage: "Create Consent Form"
})
}, react_default.a.createElement("div", {
style: {
padding: '15px'
}
}, react_default.a.createElement("div", {
style: {
marginTop: '15px'
}
}, react_default.a.createElement(UserConsentFormGeneratorContainer, {
initialValues: consentForm,
onClickAddUniqueIdentifier: this.addUniqueIdentifier.bind(this),
onGenerateForm: this.generateFormHandler.bind(this),
onPreview: this.onPreviewHandler.bind(this),
removeUniqueIdentifierByIndexes: removeUniqueIdentifierByIndexes,
id: id,
isSaving: isSaving
})), react_default.a.createElement(containers_UniqueIdentifiersSelectorContainerSlide, {
onClose: this.closeUniqueIdentifierPanel.bind(this),
show: showUniqueIdentifier,
initialValues: selectedUniqueIdentifier,
onClickAddUniqueIdentifierFromSelector: this.onAddUniqueIdentifierToForm.bind(this)
}), react_default.a.createElement(dialogs_ConsentFormPreviewDialog, {
consent: previewConsent,
show: !!previewConsent,
onClose: this.closePreviewHandler.bind(this)
})));
}
}]);
return WebsiteFormGeneratorContainer;
}(react["Component"]);
var WebsiteFormGeneratorContainerEnhanced = Object(Recompose["b" /* compose */])(Object(Recompose["c" /* lifecycle */])({
componentDidMount: function componentDidMount() {
this.props.fetchConsentConfiguration();
},
componentWillUnmount: function componentWillUnmount() {
this.props.resetForm();
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
var redirectToListAndClearSavingResult = this.props.redirectToListAndClearSavingResult;
if (nextProps.done) {
redirectToListAndClearSavingResult();
}
}
}), Object(Recompose["a" /* branch */])(function (_ref) {
var isFetching = _ref.isFetching;
return isFetching;
}, Object(Recompose["e" /* renderComponent */])(PageLoader["a" /* default */])), Object(Recompose["a" /* branch */])(function (_ref2) {
var invalid = _ref2.invalid;
return invalid;
}, Object(Recompose["e" /* renderComponent */])(DefaultAlert["a" /* default */])))(WebsiteFormGeneratorContainer_WebsiteFormGeneratorContainer);
var WebsiteFormGeneratorContainer_mapToStateProps = function mapToStateProps(state, _ref3) {
var id = _ref3.id;
var _state$integration = state.integration,
allIntegrations = _state$integration.allIntegrations,
isFetchingAllIntegrations = _state$integration.isFetchingAllIntegrations,
_state$consent = state.consent,
isFetchingConsentConfigurationForEdit = _state$consent.isFetchingConsentConfigurationForEdit,
consentConfigurationEdit = _state$consent.consentConfigurationEdit,
invalidConsentConfigurationEdit = _state$consent.invalidConsentConfigurationEdit,
isSavingConsentFormResut = _state$consent.isSavingConsentFormResut,
doneSavingConsentFormResult = _state$consent.doneSavingConsentFormResult,
invaldSavingConsentFormResult = _state$consent.invaldSavingConsentFormResult,
_state$org = state.org,
isFetchingOrganization = _state$org.isFetchingOrganization,
organization = _state$org.organization;
var formValues = Object(es["getFormValues"])('UserConsentFormGenerator')(state);
var integrationSelected = formValues && formValues.processors ? formValues.processors : [];
var isFetching = isFetchingConsentConfigurationForEdit || isFetchingAllIntegrations || isFetchingOrganization;
return {
isSaving: isSavingConsentFormResut,
done: doneSavingConsentFormResult,
isFetching: isFetching,
currentOrganization: organization,
consentForm: id && !isFetching && consentConfigurationEdit ? Object(converter["c" /* toConsentFormViewModel */])(consentConfigurationEdit, allIntegrations) : {
title: '',
shortExplanation: '',
processors: [],
privacyLink: ''
},
invalid: invalidConsentConfigurationEdit || invaldSavingConsentFormResult,
integrationSelected: integrationSelected,
id: id
};
};
var WebsiteFormGeneratorContainer_mapDispatchToProps = function mapDispatchToProps(dispatch, _ref4) {
var id = _ref4.id;
return {
removeUniqueIdentifierByIndexes: function removeUniqueIdentifierByIndexes() {
var indexes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var indexSorted = indexes.sort(function (a, b) {
return a - b;
});
var numberOfRemoved = 0;
indexSorted.forEach(function (index) {
dispatch(Object(es["arrayRemove"])('UserConsentFormGenerator', 'processors', index - numberOfRemoved));
numberOfRemoved += 1;
});
},
resetForm: function resetForm() {
dispatch(Object(es["reset"])('UserConsentFormGenerator'));
},
fetchConsentConfiguration: function fetchConsentConfiguration() {
if (id) {
dispatch(Object(actions["q" /* shouldFetchConsentFormByIdForEdit */])(id));
}
dispatch(Object(integration_actions["n" /* shouldFetchAllIntegrations */])());
},
addUniqueIdentifier: function addUniqueIdentifier(processor) {
dispatch(Object(es["arrayPush"])('UserConsentFormGenerator', 'processors', objectSpread_default()({
id: processor.ProviderId
}, processor, {
identifiers: processor.identifiers ? processor.identifiers.map(function (v) {
return v.value;
}) : []
})));
dispatch(Object(es["reset"])('UniqueIdentifiersSelectorContainer'));
},
generateForm: function generateForm(consentForm, currentOrganization) {
dispatch(Object(actions["C" /* shouldSaveConsentFormOnBackEnd */])(Object(converter["a" /* fromConsentFormViewModelToAPIModel */])(consentForm, currentOrganization.Id)));
},
redirectToListAndClearSavingResult: function redirectToListAndClearSavingResult() {
dispatch(Object(lib["push"])('/consent/forms/'));
dispatch(Object(actions["f" /* clearResult */])());
}
};
};
/* harmony default export */ var containers_WebsiteFormGeneratorContainer = __webpack_exports__["a"] = (Object(react_redux_es["connect"])(WebsiteFormGeneratorContainer_mapToStateProps, WebsiteFormGeneratorContainer_mapDispatchToProps)(WebsiteFormGeneratorContainerEnhanced));
/***/ }),
/***/ 2309:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _containers_WebsiteFormGeneratorContainer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1927);
var WebsiteFormGeneratorEditPage = function WebsiteFormGeneratorEditPage(_ref) {
var id = _ref.match.params.id;
return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_containers_WebsiteFormGeneratorContainer__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"], {
id: id
});
};
/* harmony default export */ __webpack_exports__["default"] = (WebsiteFormGeneratorEditPage);
/***/ })
}]);