@arquimedes.co/eureka-forms 1.9.118-test → 1.9.119

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.
@@ -0,0 +1,13 @@
1
+ export interface Branding {
2
+ name: string;
3
+ images: {
4
+ logoUrl: string;
5
+ iconUrl: string;
6
+ };
7
+ colors: {
8
+ primaryColor: string;
9
+ secondaryColor: string;
10
+ contrastColor: string;
11
+ navbarColor?: string;
12
+ };
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
1
  import { FormStyleTypes, FormTypes } from '../constants/FormStepTypes';
2
+ import { Branding } from './Branding';
2
3
  import { FormStep } from './FormStep';
3
4
  export interface Form {
4
5
  apiKey?: string;
@@ -11,6 +12,7 @@ export interface Form {
11
12
  hasCaptcha?: boolean;
12
13
  isStandAlone?: boolean;
13
14
  style?: FormStyle;
15
+ Branding?: Branding;
14
16
  classifiers?: Record<string, Classifier>;
15
17
  terms?: Term[];
16
18
  }
@@ -1,17 +1,9 @@
1
+ import { Branding } from './Branding';
1
2
  export interface Organization {
2
3
  /** The Organization's id */
3
4
  idOrganization: string;
4
5
  /** The Organization's name */
5
6
  name: string;
6
- /** The organization Logo url */
7
- logoUrl: string;
8
- /** The organization Favicon url */
9
- iconUrl?: string;
10
- mainCity?: string;
11
- styles?: {
12
- primaryColor: string;
13
- secondaryColor: string;
14
- contrastColor: string;
15
- navbarColor?: string;
16
- };
7
+ branding: Branding;
8
+ customBrandings: boolean;
17
9
  }
package/dist/App.js CHANGED
@@ -76,6 +76,7 @@ function App(_a) {
76
76
  var _g = useState(undefined), form = _g[0], setForm = _g[1];
77
77
  var _h = useState({}), originalValues = _h[0], setOriginalValues = _h[1];
78
78
  var _j = useState(undefined), organizationInfo = _j[0], setOrganizationInfo = _j[1];
79
+ var _k = useState(), branding = _k[0], setBranding = _k[1];
79
80
  var migrateFormData = function (formData, valuesData) {
80
81
  var form = migrateForm(formData, classifiers);
81
82
  var steps = Object.values(form.steps);
@@ -100,6 +101,9 @@ function App(_a) {
100
101
  case 1:
101
102
  response = _a.sent();
102
103
  if (response.data) {
104
+ if (!response.data.customBrandings) {
105
+ setBranding(response.data.branding);
106
+ }
103
107
  setOrganizationInfo(response.data);
104
108
  migrateFormData(formData, valuesData);
105
109
  }
@@ -115,6 +119,7 @@ function App(_a) {
115
119
  }
116
120
  else {
117
121
  migrateFormData(__assign({}, formData), valuesData);
122
+ setBranding(undefined);
118
123
  setOrganizationInfo(null);
119
124
  }
120
125
  }
@@ -132,6 +137,7 @@ function App(_a) {
132
137
  console.error('ERROREMBED');
133
138
  //Error in embed
134
139
  setForm(null);
140
+ setBranding(undefined);
135
141
  setOrganizationInfo(null);
136
142
  }
137
143
  }, []);
@@ -190,25 +196,27 @@ function App(_a) {
190
196
  case 4:
191
197
  response = _a;
192
198
  if (response === null || response === void 0 ? void 0 : response.data) {
193
- if (response === null || response === void 0 ? void 0 : response.data) {
194
- // document.title = currentOrg.name;
195
- // const favicon: any = document.getElementById('favicon');
196
- // if (favicon !== undefined) {
197
- // favicon.href = currentOrg.partialLogoUrl;
198
- // }
199
- //TODO cambiar el color del navbar en movil
200
- // eslint-disable-next-line no-console
201
- console.log(response === null || response === void 0 ? void 0 : response.data);
202
- setOrganizationInfo(response === null || response === void 0 ? void 0 : response.data);
203
- }
204
- else {
205
- setOrganizationInfo(null);
199
+ // document.title = currentOrg.name;
200
+ // const favicon: any = document.getElementById('favicon');
201
+ // if (favicon !== undefined) {
202
+ // favicon.href = currentOrg.partialLogoUrl;
203
+ // }
204
+ //TODO cambiar el color del navbar en movil
205
+ // eslint-disable-next-line no-console
206
+ setOrganizationInfo(response === null || response === void 0 ? void 0 : response.data);
207
+ if (!response.data.customBrandings) {
208
+ setBranding(response === null || response === void 0 ? void 0 : response.data.branding);
206
209
  }
207
210
  }
211
+ else {
212
+ setBranding(undefined);
213
+ setOrganizationInfo(null);
214
+ }
208
215
  return [3 /*break*/, 6];
209
216
  case 5:
210
217
  error_2 = _b.sent();
211
218
  console.error(error_2);
219
+ setBranding(undefined);
212
220
  setOrganizationInfo(null);
213
221
  return [3 /*break*/, 6];
214
222
  case 6: return [2 /*return*/];
@@ -227,6 +235,8 @@ function App(_a) {
227
235
  case 1:
228
236
  response = _a.sent();
229
237
  if (response) {
238
+ if (response.data.branding)
239
+ setBranding(response.data.branding);
230
240
  migrateFormData(response.data, valuesData);
231
241
  }
232
242
  return [3 /*break*/, 3];
@@ -241,9 +251,9 @@ function App(_a) {
241
251
  }); };
242
252
  if (form === undefined || organizationInfo === undefined) {
243
253
  if (isWidget) {
244
- return (_jsx("div", __assign({ className: styles.widgetContainer }, { children: _jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50, color: (_c = (_b = organizationInfo === null || organizationInfo === void 0 ? void 0 : organizationInfo.styles) === null || _b === void 0 ? void 0 : _b.primaryColor) !== null && _c !== void 0 ? _c : '#b8b8b8' }) })) })));
254
+ return (_jsx("div", __assign({ className: styles.widgetContainer }, { children: _jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50, color: (_c = (_b = branding === null || branding === void 0 ? void 0 : branding.colors) === null || _b === void 0 ? void 0 : _b.primaryColor) !== null && _c !== void 0 ? _c : '#b8b8b8' }) })) })));
245
255
  }
246
- return (_jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50, color: (_e = (_d = organizationInfo === null || organizationInfo === void 0 ? void 0 : organizationInfo.styles) === null || _d === void 0 ? void 0 : _d.primaryColor) !== null && _e !== void 0 ? _e : '#b8b8b8' }) })));
256
+ return (_jsx("div", __assign({ className: styles.curtain }, { children: _jsx(Loader, { size: 50, color: (_e = (_d = branding === null || branding === void 0 ? void 0 : branding.colors) === null || _d === void 0 ? void 0 : _d.primaryColor) !== null && _e !== void 0 ? _e : '#b8b8b8' }) })));
247
257
  }
248
258
  else if (form === null) {
249
259
  if (organizationInfo === null) {
@@ -260,7 +270,7 @@ function App(_a) {
260
270
  }
261
271
  }
262
272
  else {
263
- return (_jsx("div", __assign({ ref: containerRef, className: styles.container }, { children: _jsx(FormComponent, __assign({}, others, { form: form, reload: function () {
273
+ return (_jsx("div", __assign({ ref: containerRef, className: styles.container }, { children: _jsx(FormComponent, __assign({}, others, { form: form, branding: branding, reload: function () {
264
274
  var tempForm = __assign({}, form);
265
275
  setForm(undefined);
266
276
  setTimeout(function () {
@@ -2,6 +2,7 @@
2
2
  import { Organization } from '../../@Types/@Types';
3
3
  import { Form, FormStyle } from '../../@Types/Form';
4
4
  import { CustomStep } from '../../App';
5
+ import { Branding } from '../../@Types/Branding';
5
6
  export declare const getLocale: () => any;
6
7
  export interface WidthStats {
7
8
  currentBreakPoint: number;
@@ -11,6 +12,7 @@ export interface WidthStats {
11
12
  export interface FormComponentProps {
12
13
  form: Form;
13
14
  organization: Organization;
15
+ branding?: Branding;
14
16
  originalValues: Record<string, unknown>;
15
17
  customSteps: Record<string, CustomStep>;
16
18
  customStepProps: Record<string, any>;
@@ -34,7 +36,7 @@ export interface FormComponentProps {
34
36
  /** The custom send label to display */
35
37
  sendLabel?: string;
36
38
  }
37
- declare function FormComponent({ form, isWidget, internal, postview, organization, containerRef, ...others }: Omit<FormComponentProps, 'widthStats' | 'formStyle' | 'handleLoaded'> & {
39
+ declare function FormComponent({ form, isWidget, internal, postview, branding, organization, containerRef, ...others }: Omit<FormComponentProps, 'widthStats' | 'formStyle' | 'handleLoaded'> & {
38
40
  containerRef: any;
39
41
  organization: Organization | null;
40
42
  isWidget: boolean;
@@ -49,7 +49,7 @@ export var getLocale = function () {
49
49
  };
50
50
  function FormComponent(_a) {
51
51
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
52
- var form = _a.form, isWidget = _a.isWidget, internal = _a.internal, postview = _a.postview, organization = _a.organization, containerRef = _a.containerRef, others = __rest(_a, ["form", "isWidget", "internal", "postview", "organization", "containerRef"]);
52
+ var form = _a.form, isWidget = _a.isWidget, internal = _a.internal, postview = _a.postview, branding = _a.branding, organization = _a.organization, containerRef = _a.containerRef, others = __rest(_a, ["form", "isWidget", "internal", "postview", "branding", "organization", "containerRef"]);
53
53
  var _p = useState(false), loaded = _p[0], setLoaded = _p[1];
54
54
  var _q = useState(undefined), widthStats = _q[0], setWidthStats = _q[1];
55
55
  /** Calcs the currentBreakPoint and if is mobile */
@@ -92,22 +92,22 @@ function FormComponent(_a) {
92
92
  ? 'transparent'
93
93
  : (_d = (_c = form.style) === null || _c === void 0 ? void 0 : _c.backgroundColor) !== null && _d !== void 0 ? _d : InternalFormStyle.backgroundColor,
94
94
  minHeight: form.isStandAlone && !isWidget ? '100vh' : '100%',
95
- } }, { children: _jsx("div", __assign({ className: styles.widgetFormContainer, ref: containerRef }, { children: _jsx(FormTypeComponent, __assign({}, others, { handleLoaded: function () {
95
+ } }, { children: _jsx("div", __assign({ className: styles.widgetFormContainer, ref: containerRef }, { children: _jsx(FormTypeComponent, __assign({}, others, { branding: branding, handleLoaded: function () {
96
96
  setLoaded(true);
97
97
  }, widthStats: widthStats, form: form, internal: internal, postview: postview, organization: organization, formStyle: internal
98
98
  ? InternalFormStyle
99
99
  : __assign(__assign({}, InternalFormStyle), ((_e = form.style) !== null && _e !== void 0 ? _e : {})) })) })) })));
100
100
  }
101
- else if (organization && widthStats !== undefined) {
101
+ else if (organization && branding && widthStats !== undefined) {
102
102
  //Standalone cant have widget
103
- return (_jsxs(React.Fragment, { children: [_jsx(Navbar, { logo: organization.logoUrl, color: (_g = (_f = organization.styles) === null || _f === void 0 ? void 0 : _f.navbarColor) !== null && _g !== void 0 ? _g : (_h = organization.styles) === null || _h === void 0 ? void 0 : _h.primaryColor }), _jsx("div", __assign({ className: styles.standAloneFormContainer, ref: containerRef, style: {
103
+ return (_jsxs(React.Fragment, { children: [_jsx(Navbar, { logo: branding.images.logoUrl, color: (_g = (_f = branding.colors) === null || _f === void 0 ? void 0 : _f.navbarColor) !== null && _g !== void 0 ? _g : (_h = branding.colors) === null || _h === void 0 ? void 0 : _h.primaryColor }), _jsx("div", __assign({ className: styles.standAloneFormContainer, ref: containerRef, style: {
104
104
  background: (_k = (_j = form.style) === null || _j === void 0 ? void 0 : _j.standAloneBackgroundColor) !== null && _k !== void 0 ? _k : '#ffffff',
105
105
  } }, { children: _jsx("div", __assign({ className: widthStats.isResponsive
106
106
  ? styles.fullScreenStandAloneForm
107
107
  : styles.standAloneFormCard, style: {
108
108
  backgroundColor: (_m = (_l = form.style) === null || _l === void 0 ? void 0 : _l.backgroundColor) !== null && _m !== void 0 ? _m : InternalFormStyle.backgroundColor,
109
109
  visibility: loaded ? 'visible' : 'hidden',
110
- } }, { children: _jsx(FormTypeComponent, __assign({}, others, { internal: internal, postview: postview, widthStats: widthStats, form: form, formStyle: (_o = form.style) !== null && _o !== void 0 ? _o : InternalFormStyle, organization: organization, handleLoaded: function () {
110
+ } }, { children: _jsx(FormTypeComponent, __assign({}, others, { branding: branding, internal: internal, postview: postview, widthStats: widthStats, form: form, formStyle: (_o = form.style) !== null && _o !== void 0 ? _o : InternalFormStyle, organization: organization, handleLoaded: function () {
111
111
  setLoaded(true);
112
112
  } })) })) }))] }));
113
113
  }
@@ -76,7 +76,7 @@ function AYFStepMapper(props) {
76
76
  });
77
77
  }); };
78
78
  var getCiudadesOptions = function (_a, step, dependencyStore) {
79
- var idOrganization = _a.idOrganization, mainCity = _a.mainCity;
79
+ var idOrganization = _a.idOrganization;
80
80
  return __awaiter(_this, void 0, void 0, function () {
81
81
  var nit, params, _i, _b, dep, value, error_1;
82
82
  var _c, _d;
@@ -84,9 +84,6 @@ function AYFStepMapper(props) {
84
84
  switch (_e.label) {
85
85
  case 0:
86
86
  nit = dependencyStore[step.idNitStep];
87
- if (!nit) {
88
- return [2 /*return*/, [mainCity !== null && mainCity !== void 0 ? mainCity : 'BOGOTA']];
89
- }
90
87
  params = new URLSearchParams({
91
88
  idOrganization: idOrganization,
92
89
  idCompany: nit,
@@ -118,7 +115,7 @@ function AYFStepMapper(props) {
118
115
  case 2: return [2 /*return*/, (_e.sent()).data];
119
116
  case 3:
120
117
  error_1 = _e.sent();
121
- return [2 /*return*/, [mainCity !== null && mainCity !== void 0 ? mainCity : 'BOGOTA']];
118
+ return [2 /*return*/, null];
122
119
  case 4: return [2 /*return*/];
123
120
  }
124
121
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arquimedes.co/eureka-forms",
3
3
  "repository": "git://github.com/Arquimede5/Eureka-Forms.git",
4
- "version":"1.9.118-test",
4
+ "version": "1.9.119",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",