@omniumretail/component-library 1.1.83 → 1.1.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/component-library",
3
- "version": "1.1.83",
3
+ "version": "1.1.84",
4
4
  "private": false,
5
5
  "main": "dist/bundle.js",
6
6
  "typings": "./dist/types/index",
@@ -2,9 +2,8 @@ import { DeleteOutlined, HolderOutlined, InfoCircleOutlined } from '@ant-design/
2
2
  import { Checkbox, ColorPicker, Form, Input, Select, Space } from 'antd';
3
3
  import { t } from 'i18next';
4
4
  import styles from './styles.module.scss';
5
- import { useContext, useEffect, useState } from 'react';
5
+ import { useState } from 'react';
6
6
  import classnames from 'classnames';
7
- import { FieldContext } from 'rc-field-form';
8
7
 
9
8
  export const SingleQuestion = ({
10
9
  key,
@@ -27,14 +26,14 @@ export const SingleQuestion = ({
27
26
 
28
27
  const filteredIds = responseTypeOptions
29
28
  ?.filter((item: { IsMultipleChoise: any; }) => item.IsMultipleChoise)
30
- .map((item: { Id: any; }) => item.Id);
29
+ ?.map((item: { Id: any; }) => item.Id);
31
30
 
32
31
  const sortedAnswerTypeOptions = responseTypeOptions?.sort((a: any, b: any) => {
33
32
  return Number(a.IsMultipleChoise) - Number(b.IsMultipleChoise);
34
33
  });
35
34
 
36
35
  const answerTypeOptions = sortedAnswerTypeOptions?.map((answerType: any, index: number) => {
37
- const formattedOptions = answerType.Options.map((option: any, idx: number) => {
36
+ const formattedOptions = answerType.Options?.map((option: any, idx: number) => {
38
37
  const flag = option.NeedsAction ? "🚩" : "";
39
38
  return (
40
39
  <span key={idx} style={{ color: option.Color }}>
@@ -1,10 +1,8 @@
1
- import { Dispatch, SetStateAction, useContext } from 'react';
2
1
  import { PlusOutlined } from '@ant-design/icons';
3
2
  import { Form } from 'antd';
4
3
  import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd";
5
4
  import { SingleQuestion } from "./SingleQuestion";
6
5
  import { Link } from '../Link';
7
- import { FieldContext } from 'rc-field-form';
8
6
  import { t } from 'i18next';
9
7
 
10
8
  export interface QuestionsProps {
@@ -46,7 +44,7 @@ export const Questions = (props: QuestionsProps) => {
46
44
  }, 1);
47
45
  }
48
46
 
49
- const fieldsUpdated = fields.map((field, index) => {
47
+ const fieldsUpdated = fields?.map((field, index) => {
50
48
  return field = { ...field, name: index, key: index, fieldKey: index };
51
49
  })
52
50
 
@@ -57,7 +55,7 @@ export const Questions = (props: QuestionsProps) => {
57
55
  {(provided) => (
58
56
  <div {...provided.droppableProps} ref={provided.innerRef}>
59
57
  <>
60
- {fieldsUpdated.map(({ key, name, ...restField }) => {
58
+ {fieldsUpdated?.map(({ key, name, ...restField }) => {
61
59
  return (
62
60
  <Draggable key={key} draggableId={`${key}`} index={key}>
63
61
  {(provided, snapshot) => (