@bikdotai/bik-component-library 0.0.211-customSearch.1 → 0.0.211-qb-operators.2

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.
Files changed (59) hide show
  1. package/dist/cjs/components/QueryBuilder/Filters/Event/components/EventFilter.js +1 -1
  2. package/dist/cjs/components/QueryBuilder/Filters/UserProperty/components/UserPropertyFilter.js +1 -1
  3. package/dist/cjs/components/QueryBuilder/components/Connectors/Components/InTwoLast.d.ts +4 -0
  4. package/dist/cjs/components/QueryBuilder/components/Connectors/Components/MultiselectDropdownFreeText.js +1 -1
  5. package/dist/cjs/components/QueryBuilder/components/Connectors/Connector.js +1 -1
  6. package/dist/cjs/components/QueryBuilder/components/DropdownWrapper.d.ts +0 -1
  7. package/dist/cjs/components/QueryBuilder/components/DropdownWrapper.js +1 -1
  8. package/dist/cjs/components/QueryBuilder/components/QueryBuilderNode/Base/BaseQueryBuilderNode.d.ts +1 -5
  9. package/dist/cjs/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.js +1 -1
  10. package/dist/cjs/components/QueryBuilder/constants/DATE_OPERATORS_OPTIONS.d.ts +2 -0
  11. package/dist/cjs/components/QueryBuilder/constants/DATE_OPERATORS_OPTIONS.js +1 -0
  12. package/dist/cjs/components/QueryBuilder/constants/connector.d.ts +17 -7
  13. package/dist/cjs/components/QueryBuilder/constants/connector.js +1 -1
  14. package/dist/cjs/components/QueryBuilder/helpers/Connector.helper.d.ts +2 -0
  15. package/dist/cjs/components/QueryBuilder/helpers/Connector.helper.js +1 -1
  16. package/dist/cjs/components/QueryBuilder/types/QueryBuilderConnector.type.d.ts +1 -3
  17. package/dist/cjs/components/QueryBuilder/types/QueryBuilderOperator.type.d.ts +15 -7
  18. package/dist/cjs/components/QueryBuilder/types/QueryBuilderOperator.type.js +1 -1
  19. package/dist/cjs/components/QueryBuilder/types/QueryBuilderPropertyProps.d.ts +0 -1
  20. package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
  21. package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +1 -1
  22. package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchBox.js +1 -1
  23. package/dist/cjs/components/dropdown/OpenedDropdown/utils/iterationOnOptions.d.ts +0 -1
  24. package/dist/cjs/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js +1 -1
  25. package/dist/cjs/components/dropdown/type.d.ts +0 -1
  26. package/dist/cjs/components/input/Input.d.ts +0 -1
  27. package/dist/cjs/components/input/Input.js +1 -1
  28. package/dist/esm/components/QueryBuilder/Filters/Event/components/EventFilter.js +1 -1
  29. package/dist/esm/components/QueryBuilder/Filters/UserProperty/components/UserPropertyFilter.js +1 -1
  30. package/dist/esm/components/QueryBuilder/components/Connectors/Components/InTwoLast.d.ts +4 -0
  31. package/dist/esm/components/QueryBuilder/components/Connectors/Components/MultiselectDropdownFreeText.js +1 -1
  32. package/dist/esm/components/QueryBuilder/components/Connectors/Connector.js +1 -1
  33. package/dist/esm/components/QueryBuilder/components/DropdownWrapper.d.ts +0 -1
  34. package/dist/esm/components/QueryBuilder/components/DropdownWrapper.js +1 -1
  35. package/dist/esm/components/QueryBuilder/components/QueryBuilderNode/Base/BaseQueryBuilderNode.d.ts +1 -5
  36. package/dist/esm/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.js +1 -1
  37. package/dist/esm/components/QueryBuilder/constants/DATE_OPERATORS_OPTIONS.d.ts +2 -0
  38. package/dist/esm/components/QueryBuilder/constants/DATE_OPERATORS_OPTIONS.js +1 -0
  39. package/dist/esm/components/QueryBuilder/constants/connector.d.ts +17 -7
  40. package/dist/esm/components/QueryBuilder/constants/connector.js +1 -1
  41. package/dist/esm/components/QueryBuilder/helpers/Connector.helper.d.ts +2 -0
  42. package/dist/esm/components/QueryBuilder/helpers/Connector.helper.js +1 -1
  43. package/dist/esm/components/QueryBuilder/types/QueryBuilderConnector.type.d.ts +1 -3
  44. package/dist/esm/components/QueryBuilder/types/QueryBuilderOperator.type.d.ts +15 -7
  45. package/dist/esm/components/QueryBuilder/types/QueryBuilderOperator.type.js +1 -1
  46. package/dist/esm/components/QueryBuilder/types/QueryBuilderPropertyProps.d.ts +0 -1
  47. package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
  48. package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +2 -2
  49. package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchBox.js +1 -1
  50. package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.d.ts +0 -1
  51. package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js +1 -1
  52. package/dist/esm/components/dropdown/type.d.ts +0 -1
  53. package/dist/esm/components/input/Input.d.ts +0 -1
  54. package/dist/esm/components/input/Input.js +1 -1
  55. package/package.json +1 -1
  56. package/dist/cjs/components/dropdown/hooks/useDropdown.d.ts +0 -40
  57. package/dist/cjs/components/dropdown/hooks/useDropdown.js +0 -1
  58. package/dist/esm/components/dropdown/hooks/useDropdown.d.ts +0 -40
  59. package/dist/esm/components/dropdown/hooks/useDropdown.js +0 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),o=require("react"),t=require("../../../components/AllowedListDropdown.js"),a=require("../../../components/Connectors/Connector.js"),l=require("../../../helpers/ApiResponse.helper.js"),u=require("../../../hooks/useQueryBuilder.js"),i=require("../../../hooks/useQueryBuilderCache.js"),n=require("../../../types/QueryBuilder.type.js"),d=require("../../../types/QueryBuilderOperator.type.js"),v=require("../../../components/DropdownWrapper.js"),s=require("../../../components/QueryBuilderNode/Base/BaseQueryBuilderNode.js");const p=new l.ApiResponseHelper;exports.default=l=>{let{node:y,allowedNodes:c,apiHandler:f,mode:T,selectorKey:_}=l;var m,j,h,O,q,C,B,N,S,E,k,x,P,Q,b,g,w,A;const[R,V]=o.useState([]),[D,M]=o.useState(!1),{deleteProperty:L,createProperty:$,selectType:F,createMeta:H,updateMeta:J,updateProperty:K,selectPropertyJoinOperator:U,clearProperty:W}=u.useQueryBuilder(_),{cacheWrap:Y}=i.useQueryBuilderCache(),[G,z]=o.useState(!0),I=null===(m=null==y?void 0:y.metas)||void 0===m?void 0:m.find((e=>"date"===e.key)),X=null===(j=null==y?void 0:y.metas)||void 0===j?void 0:j.find((e=>"frequency"===e.key)),Z=null===(h=null==y?void 0:y.metas)||void 0===h?void 0:h.find((e=>"eventName"===e.key)),[ee,re]=o.useState(!1),[oe,te]=o.useState(!1),[ae,le]=o.useState(!1),ue=e=>Y((()=>f({query:{eventName:e}})),`EVENT_NAMES_${e}`),ie=(e,r)=>Y((()=>f({query:{eventName:e,propertyName:r}})),`EVENT_NAMES_${e}_${r}`),ne=(r,o,t)=>e.__awaiter(void 0,void 0,void 0,(function*(){return yield f({query:{eventName:r,propertyName:o,searchKey:t}})}));return o.useEffect((()=>{Y((()=>f({})),"EVENT_NAMES").then((e=>{z(!1);const r=p.convertToGroupOptions(e,(null==Z?void 0:Z.value)?[Z.value]:void 0);if("create"!==T&&Z)return V([...r]),void M(!0);V([...r]),M(!0)}))}),[]),r.jsx(s.BaseQueryBuilderNode,Object.assign({selectPropertyJoinOperator:U,node:y,addPropertyBtnText:(null==Z?void 0:Z.value)&&"Add event property",deleteProperty:L,createProperty:$,propertySelectorText:"Select property",fetchPropertyData:function(){return e.__awaiter(this,void 0,void 0,(function*(){return yield ue(null==Z?void 0:Z.value)}))},onPropertyNameSelect:function(r,o){return e.__awaiter(this,void 0,void 0,(function*(){K(Object.assign(Object.assign({},o),{name:r.id,dataType:r.type,operator:void 0,value:void 0,error:{}}),y._id);const e=yield ie(null==Z?void 0:Z.value,r.id);return null!=e?e:[]}))},onPropertyOperatorChange:function(e,r){K(Object.assign(Object.assign({},r),{operator:e,value:void 0,error:{}}),y._id)},onPropertyValueChange:function(e,r){K(Object.assign(Object.assign({},r),{value:e,error:{}}),y._id)},mode:T,onPropertyValueSearch:function(r,o){var t,a;return e.__awaiter(this,void 0,void 0,(function*(){const e=yield ne(null==Z?void 0:Z.value,o.name,r);return null!==(a=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.map((e=>({label:e.name,value:e.id,selected:!1}))))&&void 0!==a?a:[]}))}},{children:r.jsxs("div",Object.assign({style:{flexDirection:"column",display:"flex",gap:12}},{children:[r.jsxs("div",Object.assign({style:{flexDirection:"row",display:"flex",gap:12}},{children:[r.jsx(t.default,{disabled:"view"===T,selectedType:y.type,allowedList:c,onSelect:function(e){re(!0),setTimeout((()=>{F(e.value,y._id),re(!1)}),1)}}),!ee&&r.jsx(v.default,{isSearchable:!0,isLoading:G,disabled:"view"===T,width:"200px",dropdownLabel:"Select event name",options:R,selectedValues:(null==Z?void 0:Z.value)?[Z.value]:void 0,onSelect:function(e){Array.isArray(e)||(W(y._id),Z?J({key:"eventName",value:e.value,error:{}},y._id):H({key:"eventName",value:e.value},y._id),X?(te(!0),setTimeout((()=>{J({key:"frequency",value:{dataType:n.QueryBuilderConnectorType.frequency,operator:d.FREQUENCY_OPERATORS.atleast,value:1},error:{}},y._id),te(!1)}),1)):H({key:"frequency",value:{dataType:n.QueryBuilderConnectorType.frequency,operator:d.FREQUENCY_OPERATORS.atleast,value:1}},y._id),I?(le(!0),setTimeout((()=>{J({key:"date",value:{dataType:n.QueryBuilderConnectorType.date,operator:d.DATE_OPERATORS["last month"]},error:{}},y._id),le(!1)}),1)):H({key:"date",value:{dataType:n.QueryBuilderConnectorType.date,operator:d.DATE_OPERATORS["last month"]}},y._id))},error:null!==(S=null!==(B=null===(C=null===(q=null===(O=y.metas)||void 0===O?void 0:O[0])||void 0===q?void 0:q.error)||void 0===C?void 0:C.key)&&void 0!==B?B:null===(N=null==Z?void 0:Z.error)||void 0===N?void 0:N.key)&&void 0!==S?S:null===(E=null==Z?void 0:Z.error)||void 0===E?void 0:E.value})]})),(null==X?void 0:X.key)&&!oe&&r.jsx(a.default,{disabled:"view"===T,extra:{},errors:{val:null===(x=null===(k=X.error)||void 0===k?void 0:k.value)||void 0===x?void 0:x.value,operator:null===(Q=null===(P=X.error)||void 0===P?void 0:P.value)||void 0===Q?void 0:Q.operator},connectorVal:X.value.value,connectorType:X.value.dataType,defaultConnector:X.value.operator,onOperatorChange:function(e){J({key:"frequency",value:{dataType:n.QueryBuilderConnectorType.frequency,operator:e,value:1},error:{}},y._id)},onValueChange:function(e){var r;D&&J({key:"frequency",value:{dataType:n.QueryBuilderConnectorType.frequency,operator:null===(r=null==X?void 0:X.value)||void 0===r?void 0:r.operator,value:e},error:{}},y._id)}}),(null==I?void 0:I.key)&&!ae&&r.jsx(a.default,{disabled:"view"===T,extra:{},errors:{val:null===(g=null===(b=I.error)||void 0===b?void 0:b.value)||void 0===g?void 0:g.value,operator:null===(A=null===(w=I.error)||void 0===w?void 0:w.value)||void 0===A?void 0:A.operator},connectorVal:I.value.value,connectorType:I.value.dataType,defaultConnector:I.value.operator,onOperatorChange:function(e){J({key:"date",value:{dataType:n.QueryBuilderConnectorType.date,operator:e,value:void 0},error:{}},y._id)},onValueChange:function(e){var r;D&&J({key:"date",value:{dataType:n.QueryBuilderConnectorType.date,operator:null===(r=null==I?void 0:I.value)||void 0===r?void 0:r.operator,value:e},error:{}},y._id)}})]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),o=require("react"),t=require("../../../components/AllowedListDropdown.js"),a=require("../../../components/Connectors/Connector.js"),l=require("../../../helpers/ApiResponse.helper.js"),u=require("../../../hooks/useQueryBuilder.js"),i=require("../../../hooks/useQueryBuilderCache.js"),n=require("../../../types/QueryBuilder.type.js"),d=require("../../../types/QueryBuilderOperator.type.js"),v=require("../../../components/DropdownWrapper.js"),s=require("../../../components/QueryBuilderNode/Base/BaseQueryBuilderNode.js");const p=new l.ApiResponseHelper;exports.default=l=>{let{node:y,allowedNodes:c,apiHandler:f,mode:T,selectorKey:_}=l;var j,m,O,h,q,C,B,E,S,k,x,N,Q,g,P,b,w,A;const[R,V]=o.useState([]),[D,M]=o.useState(!1),{deleteProperty:L,createProperty:$,selectType:F,createMeta:H,updateMeta:J,updateProperty:U,selectPropertyJoinOperator:W,clearProperty:Y}=u.useQueryBuilder(_),{cacheWrap:G}=i.useQueryBuilderCache(),[K,z]=o.useState(!0),I=null===(j=null==y?void 0:y.metas)||void 0===j?void 0:j.find((e=>"date"===e.key)),X=null===(m=null==y?void 0:y.metas)||void 0===m?void 0:m.find((e=>"frequency"===e.key)),Z=null===(O=null==y?void 0:y.metas)||void 0===O?void 0:O.find((e=>"eventName"===e.key)),[ee,re]=o.useState(!1),[oe,te]=o.useState(!1),[ae,le]=o.useState(!1),ue=e=>G((()=>f({query:{eventName:e}})),`EVENT_NAMES_${e}`),ie=(e,r)=>G((()=>f({query:{eventName:e,propertyName:r}})),`EVENT_NAMES_${e}_${r}`);return o.useEffect((()=>{G((()=>f({})),"EVENT_NAMES").then((e=>{z(!1);const r=p.convertToGroupOptions(e,(null==Z?void 0:Z.value)?[Z.value]:void 0);if("create"!==T&&Z)return V([...r]),void M(!0);V([...r]),M(!0)}))}),[]),r.jsx(s.BaseQueryBuilderNode,Object.assign({selectPropertyJoinOperator:W,node:y,addPropertyBtnText:(null==Z?void 0:Z.value)&&"Add event property",deleteProperty:L,createProperty:$,propertySelectorText:"Select property",fetchPropertyData:function(){return e.__awaiter(this,void 0,void 0,(function*(){return yield ue(null==Z?void 0:Z.value)}))},onPropertyNameSelect:function(r,o){return e.__awaiter(this,void 0,void 0,(function*(){U(Object.assign(Object.assign({},o),{name:r.id,dataType:r.type,operator:void 0,value:void 0,error:{}}),y._id);const e=yield ie(null==Z?void 0:Z.value,r.id);return null!=e?e:[]}))},onPropertyOperatorChange:function(e,r){U(Object.assign(Object.assign({},r),{operator:e,value:void 0,error:{}}),y._id)},onPropertyValueChange:function(e,r){U(Object.assign(Object.assign({},r),{value:e,error:{}}),y._id)},mode:T},{children:r.jsxs("div",Object.assign({style:{flexDirection:"column",display:"flex",gap:12}},{children:[r.jsxs("div",Object.assign({style:{flexDirection:"row",display:"flex",gap:12}},{children:[r.jsx(t.default,{disabled:"view"===T,selectedType:y.type,allowedList:c,onSelect:function(e){re(!0),setTimeout((()=>{F(e.value,y._id),re(!1)}),1)}}),!ee&&r.jsx(v.default,{isSearchable:!0,isLoading:K,disabled:"view"===T,width:"200px",dropdownLabel:"Select event name",options:R,selectedValues:(null==Z?void 0:Z.value)?[Z.value]:void 0,onSelect:function(e){Array.isArray(e)||(Y(y._id),Z?J({key:"eventName",value:e.value,error:{}},y._id):H({key:"eventName",value:e.value},y._id),X?(te(!0),setTimeout((()=>{J({key:"frequency",value:{dataType:n.QueryBuilderConnectorType.frequency,operator:d.FREQUENCY_OPERATORS.atleast,value:1},error:{}},y._id),te(!1)}),1)):H({key:"frequency",value:{dataType:n.QueryBuilderConnectorType.frequency,operator:d.FREQUENCY_OPERATORS.atleast,value:1}},y._id),I?(le(!0),setTimeout((()=>{J({key:"date",value:{dataType:n.QueryBuilderConnectorType.date,operator:d.DATE_OPERATORS["last month"]},error:{}},y._id),le(!1)}),1)):H({key:"date",value:{dataType:n.QueryBuilderConnectorType.date,operator:d.DATE_OPERATORS["last month"]}},y._id))},error:null!==(S=null!==(B=null===(C=null===(q=null===(h=y.metas)||void 0===h?void 0:h[0])||void 0===q?void 0:q.error)||void 0===C?void 0:C.key)&&void 0!==B?B:null===(E=null==Z?void 0:Z.error)||void 0===E?void 0:E.key)&&void 0!==S?S:null===(k=null==Z?void 0:Z.error)||void 0===k?void 0:k.value})]})),(null==X?void 0:X.key)&&!oe&&r.jsx(a.default,{disabled:"view"===T,extra:{},errors:{val:null===(N=null===(x=X.error)||void 0===x?void 0:x.value)||void 0===N?void 0:N.value,operator:null===(g=null===(Q=X.error)||void 0===Q?void 0:Q.value)||void 0===g?void 0:g.operator},connectorVal:X.value.value,connectorType:X.value.dataType,defaultConnector:X.value.operator,onOperatorChange:function(e){J({key:"frequency",value:{dataType:n.QueryBuilderConnectorType.frequency,operator:e,value:1},error:{}},y._id)},onValueChange:function(e){var r;D&&J({key:"frequency",value:{dataType:n.QueryBuilderConnectorType.frequency,operator:null===(r=null==X?void 0:X.value)||void 0===r?void 0:r.operator,value:e},error:{}},y._id)}}),(null==I?void 0:I.key)&&!ae&&r.jsx(a.default,{disabled:"view"===T,extra:{},errors:{val:null===(b=null===(P=I.error)||void 0===P?void 0:P.value)||void 0===b?void 0:b.value,operator:null===(A=null===(w=I.error)||void 0===w?void 0:w.value)||void 0===A?void 0:A.operator},connectorVal:I.value.value,connectorType:I.value.dataType,defaultConnector:I.value.operator,onOperatorChange:function(e){J({key:"date",value:{dataType:n.QueryBuilderConnectorType.date,operator:e,value:void 0},error:{}},y._id)},onValueChange:function(e){var r;D&&J({key:"date",value:{dataType:n.QueryBuilderConnectorType.date,operator:null===(r=null==I?void 0:I.value)||void 0===r?void 0:r.operator,value:e},error:{}},y._id)}})]}))}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),o=require("../../../components/AllowedListDropdown.js"),i=require("../../../components/QueryBuilderNode/Property/PropertyNode.js"),t=require("../../../hooks/useQueryBuilder.js"),d=require("../../../hooks/useQueryBuilderCache.js"),a=require("../../../components/QueryBuilderNode/Base/BaseQueryBuilderNode.js");exports.default=s=>{let{node:l,allowedNodes:n,apiHandler:u,mode:p,selectorKey:c}=s;var y;const{selectType:v,createProperty:j,updateProperty:_}=t.useQueryBuilder(c),{cacheWrap:m}=d.useQueryBuilderCache(),f=e=>m((()=>u({query:{propertyName:e}})),`USER_PROPERTIES-${e}`),P=(r,o)=>e.__awaiter(void 0,void 0,void 0,(function*(){return yield u({query:{propertyName:r,searchKey:o}})}));return r.jsx(a.BaseQueryBuilderNode,Object.assign({node:l,mode:p},{children:r.jsxs("div",Object.assign({style:{flexDirection:"row",display:"flex",gap:12,alignItems:"flex-start"}},{children:[r.jsx(o.default,{disabled:"view"===p,selectedType:l.type,allowedList:n,onSelect:e=>v(e.value,l._id)}),r.jsx(i.PropertyNodeHeadless,{mode:p,property:null===(y=null==l?void 0:l.properties)||void 0===y?void 0:y[0],fetchPropertyData:()=>m((()=>u({})),"USER_PROPERTIES"),onPropertyNameSelect:function(r){var o,i;return e.__awaiter(this,void 0,void 0,(function*(){if((null===(o=l.properties)||void 0===o?void 0:o[0])?_(Object.assign(Object.assign({},null===(i=l.properties)||void 0===i?void 0:i[0]),{name:r.id,dataType:r.type,operator:void 0,value:void 0,error:{}}),l._id):j({name:r.id,dataType:r.type},l._id),r.needValuesRetrieval){const e=yield f(r.id);return null!=e?e:[]}return[]}))},onPropertyOperatorChange:function(e){_(Object.assign(Object.assign({},l.properties[0]),{operator:e,value:void 0,error:{}}),l._id)},onPropertyValueChange:function(e){_(Object.assign(Object.assign({},l.properties[0]),{value:e,error:{}}),l._id)},onPropertyValueSearch:function(r,o){var i,t;return e.__awaiter(this,void 0,void 0,(function*(){const e=yield P(o.name,r);return null!==(t=null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.map((e=>({label:e.name,value:e.id,selected:!1}))))&&void 0!==t?t:[]}))}})]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),o=require("../../../components/AllowedListDropdown.js"),t=require("../../../components/QueryBuilderNode/Property/PropertyNode.js"),i=require("../../../hooks/useQueryBuilder.js"),s=require("../../../hooks/useQueryBuilderCache.js"),d=require("../../../components/QueryBuilderNode/Base/BaseQueryBuilderNode.js");exports.default=a=>{let{node:l,allowedNodes:u,apiHandler:n,mode:p,selectorKey:c}=a;var y;const{selectType:v,createProperty:j,updateProperty:P}=i.useQueryBuilder(c),{cacheWrap:_}=s.useQueryBuilderCache(),f=e=>_((()=>n({query:{propertyName:e}})),`USER_PROPERTIES-${e}`);return r.jsx(d.BaseQueryBuilderNode,Object.assign({node:l,mode:p},{children:r.jsxs("div",Object.assign({style:{flexDirection:"row",display:"flex",gap:12,alignItems:"flex-start"}},{children:[r.jsx(o.default,{disabled:"view"===p,selectedType:l.type,allowedList:u,onSelect:e=>v(e.value,l._id)}),r.jsx(t.PropertyNodeHeadless,{mode:p,property:null===(y=null==l?void 0:l.properties)||void 0===y?void 0:y[0],fetchPropertyData:()=>_((()=>n({})),"USER_PROPERTIES"),onPropertyNameSelect:function(r){var o,t;return e.__awaiter(this,void 0,void 0,(function*(){if((null===(o=l.properties)||void 0===o?void 0:o[0])?P(Object.assign(Object.assign({},null===(t=l.properties)||void 0===t?void 0:t[0]),{name:r.id,dataType:r.type,operator:void 0,value:void 0,error:{}}),l._id):j({name:r.id,dataType:r.type},l._id),r.needValuesRetrieval){const e=yield f(r.id);return null!=e?e:[]}return[]}))},onPropertyOperatorChange:function(e){P(Object.assign(Object.assign({},l.properties[0]),{operator:e,value:void 0,error:{}}),l._id)},onPropertyValueChange:function(e){P(Object.assign(Object.assign({},l.properties[0]),{value:e,error:{}}),l._id)}})]}))}))};
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { ConnectorComponentProps } from "../../../types/QueryBuilderConnector.type";
3
+ declare const _default: (props: ConnectorComponentProps) => JSX.Element;
4
+ export default _default;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("react"),a=require("../../DropdownWrapper.js");const r=r=>{let{onChange:i,extra:n,val:o,isLoading:t,errors:s,disabled:d,onSearch:u}=r;var c;const[v,p]=l.useState([]),f=o;return l.useEffect((()=>{var e;const l=(null==n?void 0:n.options)&&Array.isArray(n.options)?n.options.filter((e=>!!Object.keys(e).length)).map((e=>({selected:!!(null==f?void 0:f.find((l=>l.id===e.id))),label:e.name,value:e.id}))):[],a=null!==(e=null==f?void 0:f.map((e=>e.id)))&&void 0!==e?e:[],r=[...l.filter((e=>!a.includes(e.value)))].concat((null!=f?f:[]).map((e=>({value:e.id,label:e.name}))));null==f||f.forEach((e=>{let{name:l,id:a}=e;const i=r.findIndex((e=>e.value===a&&e.label===l));-1!==i&&(r[i].selected=!0)})),p([...r])}),[n,f]),e.jsx("div",{children:e.jsx(a.default,{onSearch:u,disabled:d,allowFreeForm:null===(c=null==n?void 0:n.freeForm)||void 0===c||c,isSearchable:!0,isLoading:t,error:null==s?void 0:s.val,isMultiSelect:!0,options:v,onSelect:function(e){if(Array.isArray(e)){const l=[];e.forEach((e=>{var a,r;e.options?null===(a=e.options)||void 0===a||a.forEach((e=>{l.push({name:e.label,id:e.value})})):l.push({name:null!==(r=e.label)&&void 0!==r?r:"",id:e.value})})),null==i||i(l)}}})})};exports.default=l=>e.jsx(r,Object.assign({},l));
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("react"),a=require("../../DropdownWrapper.js");const i=i=>{let{onChange:r,extra:n,val:o,isLoading:t,errors:s,disabled:d}=i;var u;const[c,v]=l.useState([]),p=o;return l.useEffect((()=>{var e;const l=(null==n?void 0:n.options)&&Array.isArray(n.options)?n.options.filter((e=>!!Object.keys(e).length)).map((e=>({selected:!!(null==p?void 0:p.find((l=>l.id===e.id))),label:e.name,value:e.id}))):[],a=null!==(e=null==p?void 0:p.map((e=>e.id)))&&void 0!==e?e:[],i=[...l.filter((e=>!a.includes(e.value)))].concat((null!=p?p:[]).map((e=>({value:e.id,label:e.name}))));null==p||p.forEach((e=>{let{name:l,id:a}=e;const r=i.findIndex((e=>e.value===a&&e.label===l));-1!==r&&(i[r].selected=!0)})),v([...i])}),[n,p]),e.jsx("div",{children:e.jsx(a.default,{disabled:d,allowFreeForm:null===(u=null==n?void 0:n.freeForm)||void 0===u||u,isSearchable:!0,isLoading:t,error:null==s?void 0:s.val,isMultiSelect:!0,options:c,onSelect:function(e){if(Array.isArray(e)){const l=[];e.forEach((e=>{var a,i;e.options?null===(a=e.options)||void 0===a||a.forEach((e=>{l.push({name:e.label,id:e.value})})):l.push({name:null!==(i=e.label)&&void 0!==i?i:"",id:e.value})})),null==r||r(l)}}})})};exports.default=l=>e.jsx(i,Object.assign({},l));
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),n=require("../../../../utils/unCamelCase.js"),t=require("../../constants/connectorPosition.js"),o=require("../../helpers/Connector.helper.js"),i=require("../../types/QueryBuilder.type.js"),l=require("../DropdownWrapper.js"),s=require("./Components/EmojiPicker.js"),u=require("./Components/FreeText.js"),a=require("./Components/FrequencyIntegerPositiveSingle.js"),d=require("./Components/IgPicker.js"),p=require("./Components/IntegerPositiveSingle.js"),c=require("./Components/IntegerSingleValue.js"),g=require("./Components/InTheLast.js"),C=require("./Components/MultiselectDropdownFreeText.js"),m=require("./Components/NoInput.js"),j=require("./Components/NumberTime.js"),q=require("./Components/SingleDate.js"),v=require("./Components/SingleselectDropdownFreeText.js"),S=require("./Components/StringSingleValue.js"),f=require("./Components/TwoDate.js"),I=require("./Components/TwoNumberInputsSeperatedByAnd.js"),P=require("./Connector.styled.js");const T={FreeText:u.default,IntegerPositiveSingle:p.default,IntegerSingleValue:c.default,StringSingleValue:S.default,MultiselectDropdownFreeText:C.default,SingleselectDropdownFreeText:v.default,NoInput:m.default,SingleDate:q.default,TwoNumberInputsSeperatedByAnd:I.default,FrequencyIntegerPositiveSingle:a.default,TwoDate:f.default,NumberTime:j.default,PostIgPicker:d.PostIgPicker,ReelIgPicker:d.ReelIgPicker,StoryIgPicker:d.StoryIgPicker,EmojiPicker:s.default,InTheLast:g.default};exports.default=s=>{let{isLoading:u,noDefault:a,connectorType:d,defaultConnector:p,onOperatorChange:c,onValueChange:g,connectorVal:C,extra:m,errors:j,disabled:q,onSearch:v}=s;var S,f,I;const[y,h]=r.useState(null),[x,b]=r.useState(!1),w=o.ConnectorHelper.getConnectorType(d).map((e=>({selected:e===p,value:e,label:n.unCamelCaseWithFirstUppercase(e)})));function D(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];b(!0);const n=o.ConnectorHelper.getConnectorComponent(d,e.value);void 0!==n?d===i.QueryBuilderConnectorType.frequency&&"IntegerPositiveSingle"===n?h("FrequencyIntegerPositiveSingle"):h(n):h(null),r||c(e.value),setTimeout((()=>{b(!1)}),5)}return r.useEffect((()=>{a||(p?D({value:p,label:p},!0):(null==w?void 0:w[0])&&D(w[0]))}),[p]),e.jsxs(P.Container,{children:[e.jsx("div",{children:!(null===(S=null===t.disableOperatorDropdown||void 0===t.disableOperatorDropdown?void 0:t.disableOperatorDropdown[d])||void 0===S?void 0:S[p])&&e.jsx(l.default,{isSearchable:!0,disabled:q,width:"200px",isLoading:x,options:w,defaultOption:null===(f=w.filter((e=>e.selected)))||void 0===f?void 0:f[0],onSelect:D})}),null!==y&&!x&&(null===(I=T[y])||void 0===I?void 0:I.call(T,{disabled:q,val:C,onChange:g,extra:m,errors:j,isLoading:u,onSearch:v}))]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../../constants/connectorPosition.js"),n=require("../../helpers/Connector.helper.js"),o=require("../../types/QueryBuilder.type.js"),i=require("../DropdownWrapper.js"),l=require("./Components/EmojiPicker.js"),s=require("./Components/FreeText.js"),u=require("./Components/FrequencyIntegerPositiveSingle.js"),a=require("./Components/IgPicker.js"),d=require("./Components/IntegerPositiveSingle.js"),p=require("./Components/IntegerSingleValue.js"),c=require("./Components/InTheLast.js"),g=require("./Components/MultiselectDropdownFreeText.js"),j=require("./Components/NoInput.js"),m=require("./Components/NumberTime.js"),C=require("./Components/SingleDate.js"),q=require("./Components/SingleselectDropdownFreeText.js"),f=require("./Components/StringSingleValue.js"),v=require("./Components/TwoDate.js"),S=require("./Components/TwoNumberInputsSeperatedByAnd.js"),I=require("./Connector.styled.js");const P={FreeText:s.default,IntegerPositiveSingle:d.default,IntegerSingleValue:p.default,StringSingleValue:f.default,MultiselectDropdownFreeText:g.default,SingleselectDropdownFreeText:q.default,NoInput:j.default,SingleDate:C.default,TwoNumberInputsSeperatedByAnd:S.default,FrequencyIntegerPositiveSingle:u.default,TwoDate:v.default,NumberTime:m.default,PostIgPicker:a.PostIgPicker,ReelIgPicker:a.ReelIgPicker,StoryIgPicker:a.StoryIgPicker,EmojiPicker:l.default,InTheLast:c.default};exports.default=l=>{let{isLoading:s,noDefault:u,connectorType:a,defaultConnector:d,onOperatorChange:p,onValueChange:c,connectorVal:g,extra:j,errors:m,disabled:C}=l;var q,f,v;const[S,T]=r.useState(null),[y,x]=r.useState(!1),D=n.ConnectorHelper.getDropdownOptionFromDataType(a,d);function w(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];x(!0);const t=n.ConnectorHelper.getConnectorComponent(a,e.value);void 0!==t?a===o.QueryBuilderConnectorType.frequency&&"IntegerPositiveSingle"===t?T("FrequencyIntegerPositiveSingle"):T(t):T(null),r||p(e.value),setTimeout((()=>{x(!1)}),5)}return r.useEffect((()=>{u||(d?w({value:d,label:d},!0):(null==D?void 0:D[0])&&w(D[0]))}),[d]),e.jsxs(I.Container,{children:[e.jsx("div",{children:!(null===(q=null===t.disableOperatorDropdown||void 0===t.disableOperatorDropdown?void 0:t.disableOperatorDropdown[a])||void 0===q?void 0:q[d])&&e.jsx(i.default,{isSearchable:!0,disabled:C,width:"200px",isLoading:y,options:D,defaultOption:null===(f=D.filter((e=>e.selected)))||void 0===f?void 0:f[0],onSelect:w})}),null!==S&&!y&&(null===(v=P[S])||void 0===v?void 0:v.call(P,{disabled:C,val:g,onChange:c,extra:j,errors:m,isLoading:s}))]})};
@@ -14,6 +14,5 @@ declare const DropdownWrapper: React.FC<{
14
14
  width?: string;
15
15
  disabled?: boolean;
16
16
  selectedValues?: (string | number)[];
17
- onSearch?: (searchKey: string) => DropdownOption[];
18
17
  }>;
19
18
  export default DropdownWrapper;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../dropdown/Dropdown.js"),i=require("./InputLoader.js");exports.default=t=>{let{options:l,onSelect:r,defaultOption:o,isSearchable:a,isLoading:n,error:d,nativeID:c,dropdownLabel:u,isMultiSelect:p,allowFreeForm:j,width:b,disabled:h,selectedValues:g,onSearch:O}=t;return n?e.jsx(i.default,{}):e.jsx("div",Object.assign({style:{maxWidth:200,width:200},id:c},{children:e.jsx(s.Dropdown,{onSearch:O,height:(null==l?void 0:l.length)?void 0:208,disabled:h,allowFreeForm:null!=j&&j,isMultiSelect:p,width:b,size:"small",placeHolder:u,error:d,isSearchable:null!=a&&a,defaultOptions:o?Array.isArray(o)?o:[o]:void 0,options:g?l.map((e=>e.options?Object.assign(Object.assign({},e),{options:e.options.map((e=>Object.assign(Object.assign({},e),{selected:g.includes(e.value)})))}):Object.assign(Object.assign({},e),{selected:g.includes(e.value)}))):l,onSelect:r})}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../dropdown/Dropdown.js"),i=require("./InputLoader.js");exports.default=t=>{let{options:l,onSelect:r,defaultOption:o,isSearchable:a,isLoading:d,error:n,nativeID:c,dropdownLabel:u,isMultiSelect:p,allowFreeForm:j,width:b,disabled:g,selectedValues:h}=t;return d?e.jsx(i.default,{}):e.jsx("div",Object.assign({style:{maxWidth:200,width:200},id:c},{children:e.jsx(s.Dropdown,{height:(null==l?void 0:l.length)?void 0:208,disabled:g,allowFreeForm:null!=j&&j,isMultiSelect:p,width:b,size:"small",placeHolder:u,error:n,isSearchable:null!=a&&a,defaultOptions:o?Array.isArray(o)?o:[o]:void 0,options:h?l.map((e=>e.options?Object.assign(Object.assign({},e),{options:e.options.map((e=>Object.assign(Object.assign({},e),{selected:h.includes(e.value)})))}):Object.assign(Object.assign({},e),{selected:h.includes(e.value)}))):l,onSelect:r})}))};
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { DropdownOption } from "../../../../dropdown/type";
3
2
  import { BaseQueryBuilderNode as BaseQueryBuilderNodeType, QueryBuilderProperty } from "../../../types/QueryBuilder.type";
4
3
  import { QueryBuilderPropertyProps } from "../../../types/QueryBuilderPropertyProps";
5
4
  type BaseQueryBuilderNodeProps = Omit<QueryBuilderPropertyProps, 'property'> & {
@@ -9,7 +8,6 @@ type BaseQueryBuilderNodeProps = Omit<QueryBuilderPropertyProps, 'property'> & {
9
8
  addPropertyBtnText?: string;
10
9
  node: BaseQueryBuilderNodeType;
11
10
  children: React.ReactNode;
12
- onPropertyValueSearch?: (searchKey: string, property: QueryBuilderProperty) => Promise<DropdownOption[]>;
13
11
  };
14
12
  /**
15
13
  * @exported
@@ -17,7 +15,5 @@ type BaseQueryBuilderNodeProps = Omit<QueryBuilderPropertyProps, 'property'> & {
17
15
  * @param param0
18
16
  * @returns
19
17
  */
20
- export declare const BaseQueryBuilderNode: React.FC<BaseQueryBuilderNodeProps & {
21
- children: React.ReactNode;
22
- }>;
18
+ export declare const BaseQueryBuilderNode: React.FC<BaseQueryBuilderNodeProps>;
23
19
  export {};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),o=require("../../../constants/connectorPosition.js"),n=require("../../../helpers/ApiResponse.helper.js"),a=require("../../Connectors/Connector.js"),i=require("../../DropdownWrapper.js"),t=require("./PropertyNode.styled.js"),l=require("./PropertyNodeUIWrapper.js");const s=new n.ApiResponseHelper,d=n=>{let{propertySelectorText:l,fetchPropertyData:d,onPropertyNameSelect:u,onPropertyOperatorChange:c,onPropertyValueChange:p,property:v,mode:y,onPropertyValueSearch:j}=n;var g,m,b,f,h,O,x;const[A,C]=r.useState([]),[P,S]=r.useState({}),[T,w]=r.useState(!0),[q,L]=r.useState("create"===y),N=Array.isArray(A)?A.map((e=>Object.assign(Object.assign({},e),{label:e.name,value:e.id,description:e.description,selected:(null==v?void 0:v.name)===e.id}))):s.convertToGroupOptions(A,(null==v?void 0:v.name)?[v.name.toString()]:void 0);function V(e){if(!Array.isArray(e)){L(!0);let r=null;Array.isArray(A)?r=A.find((r=>{let{id:o}=r;return o===e.value})):Object.keys(A).forEach((o=>{const n=A[o].find((r=>{let{id:o}=r;return o===e.value}));n&&(r=n)})),S({}),r?null==u||u(r,v).then((e=>{const r=e;r.normalized&&r.originalData?S((e=>Object.assign(Object.assign({},e),{options:Array.isArray(r.normalized)?[...r.normalized]:Object.assign({},r.normalized),originalData:r.originalData}))):S((r=>Object.assign(Object.assign({},r),{options:Array.isArray(e)?[...e]:Object.assign({},e)}))),L(!1)})):L(!1)}}return r.useEffect((()=>{d?d().then((e=>{e&&(Array.isArray(e)?C([...e]):C(Object.assign({},e))),w(!1),L(!1)})):(w(!1),L(!1))}),[]),r.useEffect((()=>{if("create"!==y&&A&&(null==v?void 0:v.name)){const e=v,r=Array.isArray(A)?A.find((e=>e.id===(null==v?void 0:v.name))):s.findInGroupedApiResponse(A,null==v?void 0:v.name);r&&V({value:r.id,label:r.name}),null==p||p(null==e?void 0:e.value,v)}}),[A]),r.useEffect((()=>{"iceBreaker"===(null==v?void 0:v.dataType)&&S((e=>Object.assign(Object.assign({},e),{freeForm:!1})))}),[null==v?void 0:v.dataType]),e.jsxs(e.Fragment,{children:[e.jsxs(t.Container,{children:[e.jsx(i.default,{isSearchable:!0,disabled:"view"===y,width:"200px",isLoading:T,dropdownLabel:null!=l?l:"Select property",options:N,onSelect:V,selectedValues:(null==v?void 0:v.name)?[v.name]:void 0,error:null===(g=null==v?void 0:v.error)||void 0===g?void 0:g.name}),(null==v?void 0:v.name)&&!(null===(m=o.isNewLineConnectorPosition[v.dataType])||void 0===m?void 0:m[v.operator])&&e.jsx(a.default,{onSearch:e=>null==j?void 0:j(e,v),isLoading:q,disabled:"view"===y,extra:P,errors:{val:null===(b=v.error)||void 0===b?void 0:b.value,operator:null===(f=v.error)||void 0===f?void 0:f.operator},connectorVal:v.value,connectorType:v.dataType,defaultConnector:v.operator,onOperatorChange:e=>{null==c||c(e,v)},onValueChange:e=>null==p?void 0:p(e,v)})]}),(null==v?void 0:v.name)&&(null===(h=o.isNewLineConnectorPosition[v.dataType])||void 0===h?void 0:h[v.operator])&&e.jsx(a.default,{onSearch:e=>null==j?void 0:j(e,v),isLoading:q,disabled:"view"===y,extra:P,errors:{val:null===(O=v.error)||void 0===O?void 0:O.value,operator:null===(x=v.error)||void 0===x?void 0:x.operator},connectorVal:v.value,connectorType:v.dataType,defaultConnector:v.operator,onOperatorChange:e=>null==c?void 0:c(e,v),onValueChange:e=>null==p?void 0:p(e,v)})]})};exports.PropertyNode=r=>e.jsx(l.default,Object.assign({isLast:r.isLast,mode:r.mode},{children:e.jsx("div",Object.assign({style:{padding:12,maxWidth:"calc(100% - 78px)"}},{children:e.jsx(d,Object.assign({},r))}))})),exports.PropertyNodeHeadless=d;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),o=require("../../../constants/connectorPosition.js"),n=require("../../../helpers/ApiResponse.helper.js"),a=require("../../Connectors/Connector.js"),t=require("../../DropdownWrapper.js"),i=require("./PropertyNode.styled.js"),l=require("./PropertyNodeUIWrapper.js");const s=new n.ApiResponseHelper,d=n=>{let{propertySelectorText:l,fetchPropertyData:d,onPropertyNameSelect:u,onPropertyOperatorChange:c,onPropertyValueChange:p,property:v,mode:y}=n;var j,g,m,b,f,O,h;const[x,A]=r.useState([]),[C,P]=r.useState({}),[S,T]=r.useState(!0),[w,q]=r.useState("create"===y),L=Array.isArray(x)?x.map((e=>Object.assign(Object.assign({},e),{label:e.name,value:e.id,description:e.description,selected:(null==v?void 0:v.name)===e.id}))):s.convertToGroupOptions(x,(null==v?void 0:v.name)?[v.name.toString()]:void 0);function N(e){if(!Array.isArray(e)){q(!0);let r=null;Array.isArray(x)?r=x.find((r=>{let{id:o}=r;return o===e.value})):Object.keys(x).forEach((o=>{const n=x[o].find((r=>{let{id:o}=r;return o===e.value}));n&&(r=n)})),P({}),r?null==u||u(r,v).then((e=>{const r=e;r.normalized&&r.originalData?P((e=>Object.assign(Object.assign({},e),{options:Array.isArray(r.normalized)?[...r.normalized]:Object.assign({},r.normalized),originalData:r.originalData}))):P((r=>Object.assign(Object.assign({},r),{options:Array.isArray(e)?[...e]:Object.assign({},e)}))),q(!1)})):q(!1)}}return r.useEffect((()=>{d?d().then((e=>{e&&(Array.isArray(e)?A([...e]):A(Object.assign({},e))),T(!1),q(!1)})):(T(!1),q(!1))}),[]),r.useEffect((()=>{if("create"!==y&&x&&(null==v?void 0:v.name)){const e=v,r=Array.isArray(x)?x.find((e=>e.id===(null==v?void 0:v.name))):s.findInGroupedApiResponse(x,null==v?void 0:v.name);r&&N({value:r.id,label:r.name}),null==p||p(null==e?void 0:e.value,v)}}),[x]),r.useEffect((()=>{"iceBreaker"===(null==v?void 0:v.dataType)&&P((e=>Object.assign(Object.assign({},e),{freeForm:!1})))}),[null==v?void 0:v.dataType]),e.jsxs(e.Fragment,{children:[e.jsxs(i.Container,{children:[e.jsx(t.default,{isSearchable:!0,disabled:"view"===y,width:"200px",isLoading:S,dropdownLabel:null!=l?l:"Select property",options:L,onSelect:N,selectedValues:(null==v?void 0:v.name)?[v.name]:void 0,error:null===(j=null==v?void 0:v.error)||void 0===j?void 0:j.name}),(null==v?void 0:v.name)&&!(null===(g=o.isNewLineConnectorPosition[v.dataType])||void 0===g?void 0:g[v.operator])&&e.jsx(a.default,{isLoading:w,disabled:"view"===y,extra:C,errors:{val:null===(m=v.error)||void 0===m?void 0:m.value,operator:null===(b=v.error)||void 0===b?void 0:b.operator},connectorVal:v.value,connectorType:v.dataType,defaultConnector:v.operator,onOperatorChange:e=>{null==c||c(e,v)},onValueChange:e=>null==p?void 0:p(e,v)})]}),(null==v?void 0:v.name)&&(null===(f=o.isNewLineConnectorPosition[v.dataType])||void 0===f?void 0:f[v.operator])&&e.jsx(a.default,{isLoading:w,disabled:"view"===y,extra:C,errors:{val:null===(O=v.error)||void 0===O?void 0:O.value,operator:null===(h=v.error)||void 0===h?void 0:h.operator},connectorVal:v.value,connectorType:v.dataType,defaultConnector:v.operator,onOperatorChange:e=>null==c?void 0:c(e,v),onValueChange:e=>null==p?void 0:p(e,v)})]})};exports.PropertyNode=r=>e.jsx(l.default,Object.assign({isLast:r.isLast,mode:r.mode},{children:e.jsx("div",Object.assign({style:{padding:12,maxWidth:"calc(100% - 78px)"}},{children:e.jsx(d,Object.assign({},r))}))})),exports.PropertyNodeHeadless=d;
@@ -0,0 +1,2 @@
1
+ import { GroupedOption } from "../../dropdown/type";
2
+ export declare const DATE_OPERATORS_OPTIONS: GroupedOption[];
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.DATE_OPERATORS_OPTIONS=[{label:"Commonly used",options:[{selected:!1,value:"today",label:"Today"},{selected:!1,value:"yesterday",label:"Yesterday"},{selected:!1,value:"last 7 days",label:"Last 7 days"},{selected:!1,value:"last 30 days",label:"Last 30 days"},{selected:!1,value:"this week",label:"This week"},{selected:!1,value:"last week",label:"Last week"},{selected:!1,value:"this month",label:"This month"},{selected:!0,value:"last month",label:"Last month"}]},{label:"Relative",options:[{selected:!1,value:"exactly",label:"Exactly"},{selected:!1,value:"not exactly",label:"Not exactly"},{selected:!1,value:"in the last",label:"In the last"},{selected:!1,value:"not in the last",label:"Not in the last"},{selected:!1,value:"in between last",label:"In between last"},{selected:!1,value:"not in between last",label:"Not in between last"}]},{label:"Absolute",options:[{selected:!1,value:"on",label:"On"},{selected:!1,value:"notOn",label:"Not On"},{selected:!1,value:"inBetween",label:"In Between"},{selected:!1,value:"notInBetween",label:"Not In Between"},{selected:!1,value:"before",label:"Before"},{selected:!1,value:"after",label:"After"}]}];
@@ -20,7 +20,8 @@ export declare enum CONNECTOR_VALUE_COMPONENT_TYPES {
20
20
  ReelIgPicker = "ReelIgPicker",
21
21
  StoryIgPicker = "StoryIgPicker",
22
22
  EmojiPicker = "EmojiPicker",
23
- InTheLast = "InTheLast"
23
+ InTheLast = "InTheLast",
24
+ InTwoLast = "InTwoLast"
24
25
  }
25
26
  export declare const INTEGER_OPERATORS_COMPONENT: {
26
27
  is: CONNECTOR_VALUE_COMPONENT_TYPES;
@@ -59,18 +60,27 @@ export declare const REACTION_OPERATORS_COMPONENT: {
59
60
  contains: CONNECTOR_VALUE_COMPONENT_TYPES;
60
61
  };
61
62
  export declare const DATE_OPERATORS_COMPONENT: {
63
+ [x: number]: CONNECTOR_VALUE_COMPONENT_TYPES;
64
+ today: CONNECTOR_VALUE_COMPONENT_TYPES;
65
+ yesterday: CONNECTOR_VALUE_COMPONENT_TYPES;
66
+ "last 30 days": CONNECTOR_VALUE_COMPONENT_TYPES;
67
+ "last 7 days": CONNECTOR_VALUE_COMPONENT_TYPES;
68
+ "this month": CONNECTOR_VALUE_COMPONENT_TYPES;
69
+ "this week": CONNECTOR_VALUE_COMPONENT_TYPES;
70
+ "last month": CONNECTOR_VALUE_COMPONENT_TYPES;
71
+ "last week": CONNECTOR_VALUE_COMPONENT_TYPES;
72
+ exactly: CONNECTOR_VALUE_COMPONENT_TYPES;
73
+ "not exactly": CONNECTOR_VALUE_COMPONENT_TYPES;
74
+ "in the last": CONNECTOR_VALUE_COMPONENT_TYPES;
75
+ "not in the last": CONNECTOR_VALUE_COMPONENT_TYPES;
76
+ "in between last": CONNECTOR_VALUE_COMPONENT_TYPES;
77
+ "not in between last": CONNECTOR_VALUE_COMPONENT_TYPES;
62
78
  on: CONNECTOR_VALUE_COMPONENT_TYPES;
63
79
  notOn: CONNECTOR_VALUE_COMPONENT_TYPES;
64
80
  inBetween: CONNECTOR_VALUE_COMPONENT_TYPES;
65
81
  notInBetween: CONNECTOR_VALUE_COMPONENT_TYPES;
66
82
  before: CONNECTOR_VALUE_COMPONENT_TYPES;
67
83
  after: CONNECTOR_VALUE_COMPONENT_TYPES;
68
- today: CONNECTOR_VALUE_COMPONENT_TYPES;
69
- yesterday: CONNECTOR_VALUE_COMPONENT_TYPES;
70
- "last week": CONNECTOR_VALUE_COMPONENT_TYPES;
71
- "last month": CONNECTOR_VALUE_COMPONENT_TYPES;
72
- "last quarter": CONNECTOR_VALUE_COMPONENT_TYPES;
73
- "in the last": CONNECTOR_VALUE_COMPONENT_TYPES;
74
84
  };
75
85
  export declare const SPECIFIC_IG_POST_OPERATORS_COMPONENT: {
76
86
  in: CONNECTOR_VALUE_COMPONENT_TYPES;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../types/QueryBuilder.type.js"),O=require("../types/QueryBuilderOperator.type.js");const E={[e.QueryBuilderConnectorType.boolean]:O.BOOLEAN_OPERATORS,[e.QueryBuilderConnectorType.string]:O.STRING_OPERATORS,[e.QueryBuilderConnectorType.integer]:O.INTEGER_OPERATORS,[e.QueryBuilderConnectorType.frequency]:O.FREQUENCY_OPERATORS,[e.QueryBuilderConnectorType.date]:O.DATE_OPERATORS,[e.QueryBuilderConnectorType.specificPost]:O.SPECIFIC_IG_OPERATORS,[e.QueryBuilderConnectorType.specificReel]:O.SPECIFIC_IG_OPERATORS,[e.QueryBuilderConnectorType.specificStory]:O.SPECIFIC_IG_OPERATORS,[e.QueryBuilderConnectorType.anyIg]:O.ANY_IG_OPERATORS,[e.QueryBuilderConnectorType.reaction]:O.REACTION_OPERATORS,[e.QueryBuilderConnectorType.activityString]:O.IG_STRING_OPERATORS,[e.QueryBuilderConnectorType.anyAd]:O.ANY_AD_OPERATORS,[e.QueryBuilderConnectorType.specificAd]:O.AD_STRING_OPERATORS,[e.QueryBuilderConnectorType.iceBreaker]:O.ICE_BREAKER_OPERATORS};var T;exports.CONNECTOR_VALUE_COMPONENT_TYPES=void 0,(T=exports.CONNECTOR_VALUE_COMPONENT_TYPES||(exports.CONNECTOR_VALUE_COMPONENT_TYPES={})).FreeText="FreeText",T.NoInput="NoInput",T.IntegerSingleValue="IntegerSingleValue",T.StringSingleValue="StringSingleValue",T.TwoNumberInputsSeperatedByAnd="TwoNumberInputsSeperatedByAnd",T.MultiselectDropdownFreeText="MultiselectDropdownFreeText",T.SingleselectDropdownFreeText="SingleselectDropdownFreeText",T.SingleDate="SingleDate",T.TwoDate="TwoDate",T.IntegerPositiveSingle="IntegerPositiveSingle",T.NumberTime="NumberTime",T.PostIgPicker="PostIgPicker",T.ReelIgPicker="ReelIgPicker",T.StoryIgPicker="StoryIgPicker",T.EmojiPicker="EmojiPicker",T.InTheLast="InTheLast";const N={[O.INTEGER_OPERATORS.is]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.FreeText,[O.INTEGER_OPERATORS.isNot]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.FreeText,[O.INTEGER_OPERATORS.exists]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[O.INTEGER_OPERATORS.doesntExist]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[O.INTEGER_OPERATORS.lessThan]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.IntegerSingleValue,[O.INTEGER_OPERATORS.lessThanOrEqualTo]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.IntegerSingleValue,[O.INTEGER_OPERATORS.greaterThan]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.IntegerSingleValue,[O.INTEGER_OPERATORS.greaterThanOrEqualTo]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.IntegerSingleValue},_={[O.STRING_OPERATORS.is]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.MultiselectDropdownFreeText,[O.STRING_OPERATORS.isNot]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.MultiselectDropdownFreeText,[O.STRING_OPERATORS.contains]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.FreeText,[O.STRING_OPERATORS.doesntContain]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.FreeText,[O.STRING_OPERATORS.startsWith]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.FreeText,[O.STRING_OPERATORS.endsWith]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.FreeText,[O.STRING_OPERATORS.exists]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[O.STRING_OPERATORS.doesntExist]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput},t={[O.IG_STRING_OPERATORS.any]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[O.IG_STRING_OPERATORS.is]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.MultiselectDropdownFreeText,[O.IG_STRING_OPERATORS.contains]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.FreeText,[O.IG_STRING_OPERATORS.startsWith]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.FreeText,[O.IG_STRING_OPERATORS.endsWith]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.FreeText},r={[O.AD_STRING_OPERATORS.is]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.SingleselectDropdownFreeText},R={[O.ICE_BREAKER_OPERATORS.is]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.MultiselectDropdownFreeText},C={[O.REACTION_OPERATORS.contains]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.EmojiPicker},P={[O.DATE_OPERATORS.on]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.SingleDate,[O.DATE_OPERATORS.notOn]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.SingleDate,[O.DATE_OPERATORS.inBetween]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.TwoDate,[O.DATE_OPERATORS.notInBetween]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.TwoDate,[O.DATE_OPERATORS.before]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.SingleDate,[O.DATE_OPERATORS.after]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.SingleDate,[O.DATE_OPERATORS.today]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[O.DATE_OPERATORS.yesterday]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[O.DATE_OPERATORS["last week"]]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[O.DATE_OPERATORS["last month"]]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[O.DATE_OPERATORS["last quarter"]]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[O.DATE_OPERATORS["in the last"]]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.InTheLast},o={[O.SPECIFIC_IG_OPERATORS.in]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.PostIgPicker},S={[O.SPECIFIC_IG_OPERATORS.in]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.ReelIgPicker},n={[O.SPECIFIC_IG_OPERATORS.in]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.StoryIgPicker},A={[O.ANY_IG_OPERATORS.in]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput},s={[O.ANY_AD_OPERATORS.in]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput},i={[O.BOOLEAN_OPERATORS.isTrue]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[O.BOOLEAN_OPERATORS.isFalse]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[O.BOOLEAN_OPERATORS.exists]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[O.BOOLEAN_OPERATORS.doesntExist]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput},p={[O.FREQUENCY_OPERATORS.exactly]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.IntegerPositiveSingle,[O.FREQUENCY_OPERATORS.atleast]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.IntegerPositiveSingle,[O.FREQUENCY_OPERATORS.atMost]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.IntegerPositiveSingle},I={[e.QueryBuilderConnectorType.boolean]:i,[e.QueryBuilderConnectorType.string]:_,[e.QueryBuilderConnectorType.integer]:N,[e.QueryBuilderConnectorType.frequency]:p,[e.QueryBuilderConnectorType.date]:P,[e.QueryBuilderConnectorType.specificPost]:o,[e.QueryBuilderConnectorType.specificReel]:S,[e.QueryBuilderConnectorType.specificStory]:n,[e.QueryBuilderConnectorType.anyIg]:A,[e.QueryBuilderConnectorType.reaction]:C,[e.QueryBuilderConnectorType.activityString]:t,[e.QueryBuilderConnectorType.anyAd]:s,[e.QueryBuilderConnectorType.specificAd]:r,[e.QueryBuilderConnectorType.iceBreaker]:R};exports.AD_STRING_OPERATORS_COMPONENT=r,exports.ANY_AD_OPERATORS_COMPONENT=s,exports.ANY_IG_OPERATORS_COMPONENT=A,exports.BOOLEAN_OPERATORS_COMPONENT=i,exports.CONNECTOR_TYPE_TO_COMPONENT_MAP=I,exports.CONNECTOR_TYPE_TO_OPERATORS=E,exports.DATE_OPERATORS_COMPONENT=P,exports.FREQUENCY_OPERATORS_COMPONENT=p,exports.ICE_BREAKER_OPERATORS_COMPONENT=R,exports.IG_STRING_OPERATORS_COMPONENT=t,exports.INTEGER_OPERATORS_COMPONENT=N,exports.REACTION_OPERATORS_COMPONENT=C,exports.SPECIFIC_IG_POST_OPERATORS_COMPONENT=o,exports.SPECIFIC_IG_REEL_OPERATORS_COMPONENT=S,exports.SPECIFIC_IG_STORY_OPERATORS_COMPONENT=n,exports.STRING_OPERATORS_COMPONENT=_;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var O=require("../types/QueryBuilder.type.js"),e=require("../types/QueryBuilderOperator.type.js");const E={[O.QueryBuilderConnectorType.boolean]:e.BOOLEAN_OPERATORS,[O.QueryBuilderConnectorType.string]:e.STRING_OPERATORS,[O.QueryBuilderConnectorType.integer]:e.INTEGER_OPERATORS,[O.QueryBuilderConnectorType.frequency]:e.FREQUENCY_OPERATORS,[O.QueryBuilderConnectorType.date]:e.DATE_OPERATORS,[O.QueryBuilderConnectorType.specificPost]:e.SPECIFIC_IG_OPERATORS,[O.QueryBuilderConnectorType.specificReel]:e.SPECIFIC_IG_OPERATORS,[O.QueryBuilderConnectorType.specificStory]:e.SPECIFIC_IG_OPERATORS,[O.QueryBuilderConnectorType.anyIg]:e.ANY_IG_OPERATORS,[O.QueryBuilderConnectorType.reaction]:e.REACTION_OPERATORS,[O.QueryBuilderConnectorType.activityString]:e.IG_STRING_OPERATORS,[O.QueryBuilderConnectorType.anyAd]:e.ANY_AD_OPERATORS,[O.QueryBuilderConnectorType.specificAd]:e.AD_STRING_OPERATORS,[O.QueryBuilderConnectorType.iceBreaker]:e.ICE_BREAKER_OPERATORS};var T;exports.CONNECTOR_VALUE_COMPONENT_TYPES=void 0,(T=exports.CONNECTOR_VALUE_COMPONENT_TYPES||(exports.CONNECTOR_VALUE_COMPONENT_TYPES={})).FreeText="FreeText",T.NoInput="NoInput",T.IntegerSingleValue="IntegerSingleValue",T.StringSingleValue="StringSingleValue",T.TwoNumberInputsSeperatedByAnd="TwoNumberInputsSeperatedByAnd",T.MultiselectDropdownFreeText="MultiselectDropdownFreeText",T.SingleselectDropdownFreeText="SingleselectDropdownFreeText",T.SingleDate="SingleDate",T.TwoDate="TwoDate",T.IntegerPositiveSingle="IntegerPositiveSingle",T.NumberTime="NumberTime",T.PostIgPicker="PostIgPicker",T.ReelIgPicker="ReelIgPicker",T.StoryIgPicker="StoryIgPicker",T.EmojiPicker="EmojiPicker",T.InTheLast="InTheLast",T.InTwoLast="InTwoLast";const N={[e.INTEGER_OPERATORS.is]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.FreeText,[e.INTEGER_OPERATORS.isNot]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.FreeText,[e.INTEGER_OPERATORS.exists]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[e.INTEGER_OPERATORS.doesntExist]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[e.INTEGER_OPERATORS.lessThan]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.IntegerSingleValue,[e.INTEGER_OPERATORS.lessThanOrEqualTo]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.IntegerSingleValue,[e.INTEGER_OPERATORS.greaterThan]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.IntegerSingleValue,[e.INTEGER_OPERATORS.greaterThanOrEqualTo]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.IntegerSingleValue},_={[e.STRING_OPERATORS.is]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.MultiselectDropdownFreeText,[e.STRING_OPERATORS.isNot]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.MultiselectDropdownFreeText,[e.STRING_OPERATORS.contains]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.FreeText,[e.STRING_OPERATORS.doesntContain]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.FreeText,[e.STRING_OPERATORS.startsWith]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.FreeText,[e.STRING_OPERATORS.endsWith]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.FreeText,[e.STRING_OPERATORS.exists]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[e.STRING_OPERATORS.doesntExist]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput},t={[e.IG_STRING_OPERATORS.any]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[e.IG_STRING_OPERATORS.is]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.MultiselectDropdownFreeText,[e.IG_STRING_OPERATORS.contains]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.FreeText,[e.IG_STRING_OPERATORS.startsWith]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.FreeText,[e.IG_STRING_OPERATORS.endsWith]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.FreeText},R={[e.AD_STRING_OPERATORS.is]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.SingleselectDropdownFreeText},r={[e.ICE_BREAKER_OPERATORS.is]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.MultiselectDropdownFreeText},C={[e.REACTION_OPERATORS.contains]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.EmojiPicker},P={[e.DATE_OPERATORS.today]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[e.DATE_OPERATORS.yesterday]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[e.DATE_OPERATORS["last 30 days"]]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[e.DATE_OPERATORS["last 7 days"]]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[e.DATE_OPERATORS["this month"]]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[e.DATE_OPERATORS["this week"]]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[e.DATE_OPERATORS["last month"]]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[e.DATE_OPERATORS["last week"]]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[e.DATE_OPERATORS.exactly]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.InTheLast,[e.DATE_OPERATORS["not exactly"]]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.InTheLast,[e.DATE_OPERATORS["in the last"]]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.InTheLast,[e.DATE_OPERATORS["not in the last"]]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.InTheLast,[e.DATE_OPERATORS["in between last"]]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.InTwoLast,[e.DATE_OPERATORS["not in between last"]]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.InTwoLast,[e.DATE_OPERATORS.on]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.SingleDate,[e.DATE_OPERATORS.notOn]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.SingleDate,[e.DATE_OPERATORS.inBetween]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.TwoDate,[e.DATE_OPERATORS.notInBetween]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.TwoDate,[e.DATE_OPERATORS.before]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.SingleDate,[e.DATE_OPERATORS.after]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.SingleDate,[e.DATE_OPERATORS.today]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[e.DATE_OPERATORS.yesterday]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[e.DATE_OPERATORS["last week"]]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[e.DATE_OPERATORS["last month"]]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[e.DATE_OPERATORS["last quarter"]]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[e.DATE_OPERATORS["in the last"]]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.InTheLast},o={[e.SPECIFIC_IG_OPERATORS.in]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.PostIgPicker},S={[e.SPECIFIC_IG_OPERATORS.in]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.ReelIgPicker},A={[e.SPECIFIC_IG_OPERATORS.in]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.StoryIgPicker},n={[e.ANY_IG_OPERATORS.in]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput},s={[e.ANY_AD_OPERATORS.in]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput},p={[e.BOOLEAN_OPERATORS.isTrue]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[e.BOOLEAN_OPERATORS.isFalse]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[e.BOOLEAN_OPERATORS.exists]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput,[e.BOOLEAN_OPERATORS.doesntExist]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.NoInput},i={[e.FREQUENCY_OPERATORS.exactly]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.IntegerPositiveSingle,[e.FREQUENCY_OPERATORS.atleast]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.IntegerPositiveSingle,[e.FREQUENCY_OPERATORS.atMost]:exports.CONNECTOR_VALUE_COMPONENT_TYPES.IntegerPositiveSingle},I={[O.QueryBuilderConnectorType.boolean]:p,[O.QueryBuilderConnectorType.string]:_,[O.QueryBuilderConnectorType.integer]:N,[O.QueryBuilderConnectorType.frequency]:i,[O.QueryBuilderConnectorType.date]:P,[O.QueryBuilderConnectorType.specificPost]:o,[O.QueryBuilderConnectorType.specificReel]:S,[O.QueryBuilderConnectorType.specificStory]:A,[O.QueryBuilderConnectorType.anyIg]:n,[O.QueryBuilderConnectorType.reaction]:C,[O.QueryBuilderConnectorType.activityString]:t,[O.QueryBuilderConnectorType.anyAd]:s,[O.QueryBuilderConnectorType.specificAd]:R,[O.QueryBuilderConnectorType.iceBreaker]:r};exports.AD_STRING_OPERATORS_COMPONENT=R,exports.ANY_AD_OPERATORS_COMPONENT=s,exports.ANY_IG_OPERATORS_COMPONENT=n,exports.BOOLEAN_OPERATORS_COMPONENT=p,exports.CONNECTOR_TYPE_TO_COMPONENT_MAP=I,exports.CONNECTOR_TYPE_TO_OPERATORS=E,exports.DATE_OPERATORS_COMPONENT=P,exports.FREQUENCY_OPERATORS_COMPONENT=i,exports.ICE_BREAKER_OPERATORS_COMPONENT=r,exports.IG_STRING_OPERATORS_COMPONENT=t,exports.INTEGER_OPERATORS_COMPONENT=N,exports.REACTION_OPERATORS_COMPONENT=C,exports.SPECIFIC_IG_POST_OPERATORS_COMPONENT=o,exports.SPECIFIC_IG_REEL_OPERATORS_COMPONENT=S,exports.SPECIFIC_IG_STORY_OPERATORS_COMPONENT=A,exports.STRING_OPERATORS_COMPONENT=_;
@@ -1,6 +1,8 @@
1
+ import { DropdownOption } from "../../dropdown/type";
1
2
  import { QueryBuilderConnectorType } from '../types/QueryBuilder.type';
2
3
  import { CONNECTOR_OPERATORS } from '../types/QueryBuilderOperator.type';
3
4
  export declare class ConnectorHelper {
4
5
  static getConnectorType(datatype: QueryBuilderConnectorType): string[];
5
6
  static getConnectorComponent(dataType: QueryBuilderConnectorType, connectorType: CONNECTOR_OPERATORS): "FreeText" | "NoInput" | "IntegerSingleValue" | "StringSingleValue" | "TwoNumberInputsSeperatedByAnd" | "MultiselectDropdownFreeText" | "SingleselectDropdownFreeText" | "SingleDate" | "TwoDate" | "IntegerPositiveSingle" | "NumberTime" | null;
7
+ static getDropdownOptionFromDataType(datatype: QueryBuilderConnectorType, defaultConnector: CONNECTOR_OPERATORS | undefined): DropdownOption[];
6
8
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../constants/connector.js");exports.ConnectorHelper=class{static getConnectorType(t){const r=e.CONNECTOR_TYPE_TO_OPERATORS[t];return r?Object.keys(r):[]}static getConnectorComponent(t,r){if(e.CONNECTOR_TYPE_TO_OPERATORS[t]){return e.CONNECTOR_TYPE_TO_COMPONENT_MAP[t][r]}return null}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../utils/unCamelCase.js"),t=require("../constants/connector.js"),s=require("../constants/DATE_OPERATORS_OPTIONS.js"),r=require("../types/QueryBuilder.type.js");exports.ConnectorHelper=class{static getConnectorType(e){const s=t.CONNECTOR_TYPE_TO_OPERATORS[e];return s?Object.keys(s):[]}static getConnectorComponent(e,s){if(t.CONNECTOR_TYPE_TO_OPERATORS[e]){return t.CONNECTOR_TYPE_TO_COMPONENT_MAP[e][s]}return null}static getDropdownOptionFromDataType(t,n){const o=this.getConnectorType(t);return t===r.QueryBuilderConnectorType.date?s.DATE_OPERATORS_OPTIONS.map((e=>Object.assign(Object.assign({},e),{options:e.options.map((e=>Object.assign(Object.assign({},e),{selected:e.value===n})))}))):o.map((t=>({selected:t===n,value:t,label:e.unCamelCaseWithFirstUppercase(t)})))}};
@@ -19,7 +19,6 @@ export type ConnectorComponentProps = {
19
19
  nativeID?: string;
20
20
  isLoading?: boolean;
21
21
  disabled?: boolean;
22
- onSearch?: (searchKey: string) => Promise<DropdownOption[]>;
23
22
  };
24
23
  export type ConnectorProps = {
25
24
  isLoading?: boolean;
@@ -39,9 +38,8 @@ export type ConnectorProps = {
39
38
  };
40
39
  testID?: string;
41
40
  disabled?: boolean;
42
- onSearch?: (searchKey: string) => Promise<DropdownOption[]>;
43
41
  };
44
- export type CONNECTOR_VALUE_TYPE = string[] | number | Date[] | Date | number[] | number | undefined | /** for multiselect */ QueryBuilderAPIData[] | IG_VALUE[];
42
+ export type CONNECTOR_VALUE_TYPE = object | string[] | number | Date[] | Date | number[] | number | undefined | /** for multiselect */ QueryBuilderAPIData[] | IG_VALUE[];
45
43
  type IG_VALUE = {
46
44
  imageUrl: string;
47
45
  redirectionUrl: string;
@@ -48,18 +48,26 @@ export declare enum REACTION_OPERATORS {
48
48
  contains = "contains"
49
49
  }
50
50
  export declare enum DATE_OPERATORS {
51
+ today = "today",
52
+ yesterday = "yesterday",
53
+ 'last 7 days' = "last 7 days",
54
+ 'last 30 days' = "last 30 days",
55
+ 'this week' = "this week",
56
+ 'last week' = "last week",
57
+ 'this month' = "this month",
58
+ 'last month' = "last month",
59
+ 'exactly' = "exactly",
60
+ 'not exactly' = "not exactly",
61
+ 'in the last' = "in the last",
62
+ 'not in the last' = "not in the last",
63
+ 'in between last' = "in between last",
64
+ 'not in between last' = "not in between last",
51
65
  on = "on",
52
66
  notOn = "notOn",
53
67
  inBetween = "inBetween",
54
68
  notInBetween = "notInBetween",
55
69
  before = "before",
56
- after = "after",
57
- today = "today",
58
- yesterday = "yesterday",
59
- 'last week' = "last week",
60
- 'last month' = "last month",
61
- 'last quarter' = "last quarter",
62
- 'in the last' = "in the last"
70
+ after = "after"
63
71
  }
64
72
  export declare enum BOOLEAN_OPERATORS {
65
73
  isTrue = "isTrue",
@@ -1 +1 @@
1
- "use strict";var e,t,s,o,R,r,i;Object.defineProperty(exports,"__esModule",{value:!0}),exports.INTEGER_OPERATORS=void 0,(e=exports.INTEGER_OPERATORS||(exports.INTEGER_OPERATORS={})).is="is",e.isNot="isNot",e.exists="exists",e.doesntExist="doesntExist",e.lessThan="lessThan",e.lessThanOrEqualTo="lessThanOrEqualTo",e.greaterThan="greaterThan",e.greaterThanOrEqualTo="greaterThanOrEqualTo",exports.STRING_OPERATORS=void 0,(t=exports.STRING_OPERATORS||(exports.STRING_OPERATORS={})).is="is",t.isNot="isNot",t.contains="contains",t.doesntContain="doesntContain",t.startsWith="startsWith",t.endsWith="endsWith",t.exists="exists",t.doesntExist="doesntExist",exports.IG_STRING_OPERATORS=void 0,(s=exports.IG_STRING_OPERATORS||(exports.IG_STRING_OPERATORS={})).any="any",s.is="is",s.contains="contains",s.startsWith="startsWith",s.endsWith="endsWith",exports.AD_STRING_OPERATORS=void 0,(exports.AD_STRING_OPERATORS||(exports.AD_STRING_OPERATORS={})).is="is",exports.SPECIFIC_IG_OPERATORS=void 0,(exports.SPECIFIC_IG_OPERATORS||(exports.SPECIFIC_IG_OPERATORS={})).in="in",exports.ICE_BREAKER_OPERATORS=void 0,(exports.ICE_BREAKER_OPERATORS||(exports.ICE_BREAKER_OPERATORS={})).is="is",exports.ANY_IG_OPERATORS=void 0,(exports.ANY_IG_OPERATORS||(exports.ANY_IG_OPERATORS={})).in="in",exports.ANY_AD_OPERATORS=void 0,(exports.ANY_AD_OPERATORS||(exports.ANY_AD_OPERATORS={})).in="in",exports.REACTION_OPERATORS=void 0,(exports.REACTION_OPERATORS||(exports.REACTION_OPERATORS={})).contains="contains",exports.DATE_OPERATORS=void 0,(o=exports.DATE_OPERATORS||(exports.DATE_OPERATORS={})).on="on",o.notOn="notOn",o.inBetween="inBetween",o.notInBetween="notInBetween",o.before="before",o.after="after",o.today="today",o.yesterday="yesterday",o["last week"]="last week",o["last month"]="last month",o["last quarter"]="last quarter",o["in the last"]="in the last",exports.BOOLEAN_OPERATORS=void 0,(R=exports.BOOLEAN_OPERATORS||(exports.BOOLEAN_OPERATORS={})).isTrue="isTrue",R.isFalse="isFalse",R.exists="exists",R.doesntExist="doesntExist",exports.FREQUENCY_OPERATORS=void 0,(r=exports.FREQUENCY_OPERATORS||(exports.FREQUENCY_OPERATORS={})).exactly="exactly",r.atleast="atleast",r.atMost="atMost",exports.EVENT_VALUES=void 0,(i=exports.EVENT_VALUES||(exports.EVENT_VALUES={})).FreeText="FreeText",i.NoInput="NoInput",i.IntegerSingleValue="IntegerSingleValue",i.StringSingleValue="StringSingleValue",i.TwoNumberInputsSeperatedByAnd="TwoNumberInputsSeperatedByAnd",i.MultiselectDropdownFreeText="MultiselectDropdownFreeText",i.SingleselectDropdownFreeText="SingleselectDropdownFreeText",i.SingleDate="SingleDate",i.TwoDate="TwoDate",i.IntegerPositiveSingle="IntegerPositiveSingle",i.NumberTime="NumberTime";
1
+ "use strict";var e,t,s,o,n,i,R;Object.defineProperty(exports,"__esModule",{value:!0}),exports.INTEGER_OPERATORS=void 0,(e=exports.INTEGER_OPERATORS||(exports.INTEGER_OPERATORS={})).is="is",e.isNot="isNot",e.exists="exists",e.doesntExist="doesntExist",e.lessThan="lessThan",e.lessThanOrEqualTo="lessThanOrEqualTo",e.greaterThan="greaterThan",e.greaterThanOrEqualTo="greaterThanOrEqualTo",exports.STRING_OPERATORS=void 0,(t=exports.STRING_OPERATORS||(exports.STRING_OPERATORS={})).is="is",t.isNot="isNot",t.contains="contains",t.doesntContain="doesntContain",t.startsWith="startsWith",t.endsWith="endsWith",t.exists="exists",t.doesntExist="doesntExist",exports.IG_STRING_OPERATORS=void 0,(s=exports.IG_STRING_OPERATORS||(exports.IG_STRING_OPERATORS={})).any="any",s.is="is",s.contains="contains",s.startsWith="startsWith",s.endsWith="endsWith",exports.AD_STRING_OPERATORS=void 0,(exports.AD_STRING_OPERATORS||(exports.AD_STRING_OPERATORS={})).is="is",exports.SPECIFIC_IG_OPERATORS=void 0,(exports.SPECIFIC_IG_OPERATORS||(exports.SPECIFIC_IG_OPERATORS={})).in="in",exports.ICE_BREAKER_OPERATORS=void 0,(exports.ICE_BREAKER_OPERATORS||(exports.ICE_BREAKER_OPERATORS={})).is="is",exports.ANY_IG_OPERATORS=void 0,(exports.ANY_IG_OPERATORS||(exports.ANY_IG_OPERATORS={})).in="in",exports.ANY_AD_OPERATORS=void 0,(exports.ANY_AD_OPERATORS||(exports.ANY_AD_OPERATORS={})).in="in",exports.REACTION_OPERATORS=void 0,(exports.REACTION_OPERATORS||(exports.REACTION_OPERATORS={})).contains="contains",exports.DATE_OPERATORS=void 0,(o=exports.DATE_OPERATORS||(exports.DATE_OPERATORS={})).today="today",o.yesterday="yesterday",o["last 7 days"]="last 7 days",o["last 30 days"]="last 30 days",o["this week"]="this week",o["last week"]="last week",o["this month"]="this month",o["last month"]="last month",o.exactly="exactly",o["not exactly"]="not exactly",o["in the last"]="in the last",o["not in the last"]="not in the last",o["in between last"]="in between last",o["not in between last"]="not in between last",o.on="on",o.notOn="notOn",o.inBetween="inBetween",o.notInBetween="notInBetween",o.before="before",o.after="after",exports.BOOLEAN_OPERATORS=void 0,(n=exports.BOOLEAN_OPERATORS||(exports.BOOLEAN_OPERATORS={})).isTrue="isTrue",n.isFalse="isFalse",n.exists="exists",n.doesntExist="doesntExist",exports.FREQUENCY_OPERATORS=void 0,(i=exports.FREQUENCY_OPERATORS||(exports.FREQUENCY_OPERATORS={})).exactly="exactly",i.atleast="atleast",i.atMost="atMost",exports.EVENT_VALUES=void 0,(R=exports.EVENT_VALUES||(exports.EVENT_VALUES={})).FreeText="FreeText",R.NoInput="NoInput",R.IntegerSingleValue="IntegerSingleValue",R.StringSingleValue="StringSingleValue",R.TwoNumberInputsSeperatedByAnd="TwoNumberInputsSeperatedByAnd",R.MultiselectDropdownFreeText="MultiselectDropdownFreeText",R.SingleselectDropdownFreeText="SingleselectDropdownFreeText",R.SingleDate="SingleDate",R.TwoDate="TwoDate",R.IntegerPositiveSingle="IntegerPositiveSingle",R.NumberTime="NumberTime";
@@ -16,5 +16,4 @@ export type QueryBuilderPropertyProps = {
16
16
  }>;
17
17
  onPropertyOperatorChange?: (option: CONNECTOR_OPERATORS, property: QueryBuilderProperty) => void;
18
18
  onPropertyValueChange?: (value: CONNECTOR_VALUE_TYPE | /** for multiselect */ QueryBuilderAPIData[], property: QueryBuilderProperty) => void;
19
- onPropertyValueSearch(searchKey: string, property: QueryBuilderProperty): Promise<DropdownOption[]>;
20
19
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),s=require("../../../zeroState/ZeroState.js"),r=require("../../../../hooks/useOutside.js"),n=require("../../hooks/useDropdown.js"),o=require("./description/Description.js"),i=require("./menu/FreeFormMenu.js"),l=require("./menu/MenuList.js"),u=require("./menu/SelectAllMenu.js"),c=require("./multiSelect/MultiSelectDropdownBottomBar.js"),a=require("./OpennedDropdown.styled.js"),p=require("./searchbox/SearchBox.js"),d=require("./searchbox/SearchZeroState.js");const h=304,j=290;exports.OpenedDropdown=S=>{let{options:f,isSearchable:g,isMultiSelect:x,width:b,allowFreeForm:v,height:w,onClose:y,onSelect:O,onSearch:m,version:q,skipSorting:M}=S;const{dropdownOptions:C,search:D,searchedString:L,searchedOptions:F,onApplyHandler:A,selectAllHandler:k,onMultiSelectClear:B,onFreeFormSelect:H,onMultiSelectApply:Z,latestDropdownOptionsRef:E}=n.useDropdown(q,f,O,M,x,m),[P,R]=t.useState(null!=b?b:j),[_,z]=t.useState(null),I=t.useRef(null);r.useOutside(I,(()=>{if(z(null),x&&"2.0"===q){const e=(e=>{const t=[];return e.forEach((e=>{if(e.options){const s=e.options.filter((e=>!0===e.selected));t.push(Object.assign(Object.assign({},e),{options:[...s]}))}else e.selected&&t.push(Object.assign({},e))})),t})(E.current);null==y||y(e)}else null==y||y(C)}));const K=null!=w?w:h,N="number"==typeof K?g&&x?K-96:g&&!x||!g&&x?K-48:K:K;t.useEffect((()=>{const e=null!=b?b:j;if(null===_)R(e);else if("number"==typeof e)R(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));R(t)}}),[_]);const T=[],W=(L&&m?F:C).map((e=>{var t,s;if(L&&!m){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(L.toLowerCase()))&&(T.push(!L||e.label===L),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(L.toLowerCase()))||(null===(s=e.searchKey)||void 0===s?void 0:s.toLowerCase().includes(L.toLowerCase()))?(T.push(!L||e.label===L),e):null}return e})).filter((e=>null!==e)),G=!!g&&L&&0===W.length;return e.jsxs(a.OpennedDropdownContainer,Object.assign({version:q,ref:I,style:{width:P}},{children:[e.jsxs("div",Object.assign({style:{width:_?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!g&&e.jsx(p.SearchBox,{onSearch:D,version:q}),W.length||L?e.jsxs(a.MenuListContainer,Object.assign({minHeight:K,maxHeight:N},{children:[!!x&&!G&&e.jsx(u.SelectAllMenu,{version:q,options:L&&m?F:C,onSelect:k}),!v&&G&&e.jsx(d.SearchZeroState,{height:N,searchedString:L}),v&&(G||!!T.length&&T.every((e=>!1===e)))&&e.jsx(i.FreeFormMenu,{version:q,isMultiSelect:x,onSelect:H,searchedString:L}),e.jsx(l.MenuList,{version:q,onSelect:A,showDescription:function(e,t){z(e&&t?{title:e,description:t}:null)},isMultiSelect:x,options:W})]})):e.jsx("div",Object.assign({style:{height:K,display:"flex"}},{children:e.jsx(s.ZeroState,{title:"No results found",subTitle:"Please try again later or contact us at support@bik.ai if you require further assistance."})})),!!x&&!(!W.length&&!L)&&"2.0"!==q&&e.jsx(c.default,{onClear:B,onApply:Z,list:L&&m?F:C})]})),!!_&&e.jsx(o.Description,{title:_.title,description:_.description,version:q})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),s=require("../../../zeroState/ZeroState.js"),n=require("../../../../hooks/useOutside.js"),i=require("../utils/iterationOnOptions.js"),l=require("./description/Description.js"),o=require("./menu/FreeFormMenu.js"),r=require("./menu/MenuList.js"),u=require("./menu/SelectAllMenu.js"),c=require("./multiSelect/MultiSelectDropdownBottomBar.js"),a=require("./OpennedDropdown.styled.js"),d=require("./searchbox/SearchBox.js"),p=require("./searchbox/SearchZeroState.js");const f=304,h=290;exports.OpenedDropdown=j=>{let{options:b,isSearchable:v,isMultiSelect:S,width:g,allowFreeForm:O,height:x,onClose:m,onSelect:w,version:y,skipSorting:q}=j;const[C,M]=t.useState(null!=b?b:[]);t.useEffect((()=>{if(b){const e=[...b];M(S&&!q?[...e.sort((e=>e.selected?-1:1))]:[...e])}}),[b]);const[L,F]=t.useState(null!=g?g:h),[D,k]=t.useState(""),[A,B]=t.useState(null),E=t.useRef(null),Z=t.useRef(C),H=e=>{const t=[];return e.forEach((e=>{if(e.options){const s=e.options.filter((e=>!0===e.selected));t.push(Object.assign(Object.assign({},e),{options:[...s]}))}else e.selected&&t.push(Object.assign({},e))})),t};t.useEffect((()=>{Z.current=C}),[C]),n.useOutside(E,(()=>{if(B(null),S&&"2.0"===y){const e=H(Z.current);null==m||m(e)}else null==m||m(C)}));const P=null!=x?x:f,R="number"==typeof P?v&&S?P-96:v&&!S||!v&&S?P-48:P:P;function _(e){if(S){const t=i.iterateOnOptions(C,{selected:e.selected},(t=>t.value===e.value));M([...t]),"2.0"===y&&z(t)}else null==w||w(e)}function z(e){const t=H(null!=e?e:Z.current);null==w||w([...t])}t.useEffect((()=>{const e=null!=g?g:h;if(null===A)F(e);else if("number"==typeof e)F(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));F(t)}}),[A]);const I=[],K=C.map((e=>{var t,s;if(D){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(D.toLowerCase()))&&(I.push(!D||e.label===D),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(D.toLowerCase()))||(null===(s=e.searchKey)||void 0===s?void 0:s.toLowerCase().includes(D.toLowerCase()))?(I.push(!D||e.label===D),e):null}return e})).filter((e=>null!==e)),N=!!v&&D&&0===K.length;return e.jsxs(a.OpennedDropdownContainer,Object.assign({version:y,ref:E,style:{width:L}},{children:[e.jsxs("div",Object.assign({style:{width:A?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!v&&e.jsx(d.SearchBox,{onSearch:function(e){k(e)},version:y}),K.length||D?e.jsxs(a.MenuListContainer,Object.assign({minHeight:P,maxHeight:R},{children:[!!S&&!N&&e.jsx(u.SelectAllMenu,{version:y,options:C,onSelect:function(e){if("selectAll"===e){const e=i.iterateOnOptions(C,{selected:!0},(e=>{var t;return D?(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(D.toLowerCase()))&&!e.disabled:!e.disabled}));M([...e]),"2.0"===y&&z(e)}else if("notSelected"===e){const e=i.iterateOnOptions(C,{selected:!1},(e=>!e.disabled));M([...e]),"2.0"===y&&z(e)}}}),!O&&N&&e.jsx(p.SearchZeroState,{height:R,searchedString:D}),O&&(N||!!I.length&&I.every((e=>!1===e)))&&e.jsx(o.FreeFormMenu,{version:y,isMultiSelect:S,onSelect:function(e){if(!S)return void _({label:D,value:D,isFreeForm:!0,selected:!0});const t=C.map((t=>t.options?t:Object.assign(Object.assign({},t),{selected:t.label===D&&t.value===D?e:t.selected})));e&&(t.some((e=>e.label===D&&e.value===D))||t.unshift({label:D,value:D,isFreeForm:!0,selected:!0})),M([...t]),"2.0"===y&&z(t)},searchedString:D}),e.jsx(r.MenuList,{version:y,onSelect:_,showDescription:function(e,t){B(e&&t?{title:e,description:t}:null)},isMultiSelect:S,options:K})]})):e.jsx("div",Object.assign({style:{height:P,display:"flex"}},{children:e.jsx(s.ZeroState,{title:"No results found",subTitle:"Please try again later or contact us at support@bik.ai if you require further assistance."})})),!!S&&!(!K.length&&!D)&&"2.0"!==y&&e.jsx(c.default,{onClear:function(){const e=i.iterateOnOptions(C,{selected:!1});M([...e]),"2.0"===y&&z(e)},onApply:z,list:C})]})),!!A&&e.jsx(l.Description,{title:A.title,description:A.description,version:y})]}))};
@@ -2,4 +2,4 @@
2
2
  padding: ${e=>"2.0"===e.version?"8px 12px":"14px 16px"} !important;
3
3
  cursor: pointer;
4
4
  margin-top: ${e=>"2.0"===e.version?"2px":"0"};
5
- `;exports.MenuItem=t=>{let{option:i,isMultiSelect:l,showDescription:a,onSelect:d,last:u,version:p}=t;var m;function x(e){i.disabled||d(Object.assign(Object.assign({},i),{selected:e}))}return e.jsx(c,{version:p,style:u?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),x(!i.selected)},onMouseOver:function(){i.description?a(i.label,i.description):a()},listItem:{value:i.value,label:i.label},subText:i.subText,leadingIcon:l?e.jsx("div",Object.assign({style:{width:18,display:"flex",alignContent:"center",justifyContent:"center"}},{children:e.jsx(n.CheckBox,{size:"2.0"===p?"SMALL":"DEFAULT",isDisabled:null!==(m=i.disabled)&&void 0!==m&&m,isChecked:!!i.selected,onValueChange:x})})):i.leadingIcon?e.jsx(e.Fragment,{children:i.leadingIcon}):e.jsx(e.Fragment,{}),customComponent:i.customComponent,trailingIcon:i.isFreeForm?e.jsx(o.FreeFormContainer,{children:e.jsx(s.BodyCaption,Object.assign({style:{color:r.COLORS.content.secondary}},{children:"Freeform"}))}):i.trailingIcon?e.jsx(e.Fragment,{children:i.trailingIcon}):e.jsx(e.Fragment,{}),variant:i.disabled?"inactive":i.selected?"selected":"default"})};
5
+ `;exports.MenuItem=t=>{let{option:i,isMultiSelect:l,showDescription:a,onSelect:d,last:u,version:p}=t;var m;function x(e){i.disabled||d(Object.assign(Object.assign({},i),{selected:e}))}return e.jsx(c,{version:p,style:u?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),x(!i.selected)},onMouseOver:function(){i.description?a(i.label,i.description):a()},listItem:{value:i.value,label:i.label},subText:i.subText,leadingIcon:l?e.jsx("div",Object.assign({style:{width:18}},{children:e.jsx(n.CheckBox,{size:"2.0"===p?"SMALL":"DEFAULT",isDisabled:null!==(m=i.disabled)&&void 0!==m&&m,isChecked:!!i.selected,onValueChange:x})})):i.leadingIcon?e.jsx(e.Fragment,{children:i.leadingIcon}):e.jsx(e.Fragment,{}),customComponent:i.customComponent,trailingIcon:i.isFreeForm?e.jsx(o.FreeFormContainer,{children:e.jsx(s.BodyCaption,Object.assign({style:{color:r.COLORS.content.secondary}},{children:"Freeform"}))}):i.trailingIcon?e.jsx(e.Fragment,{children:i.trailingIcon}):e.jsx(e.Fragment,{}),variant:i.disabled?"inactive":i.selected?"selected":"default"})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../../../../input/Input.js"),o=require("../../../../input/context/InputStyleProvider.js"),n=require("../../../../../constants/Theme.js"),s=require("../../../../../assets/icons/cross.svg.js"),i=require("../../../../../assets/icons/search.svg.js");exports.SearchBox=a=>{let{onSearch:c,version:u}=a;const[l,p]=r.useState(""),[d,h]=r.useState(!1);return e.jsx(o.InputStyleContext.Provider,Object.assign({value:{InputWrapper:{borderRadius:0,border:0,borderBottom:`${"2.0"===u?.5:1}px solid ${n.COLORS.stroke.primary}`,padding:""+("2.0"===u?"6px 8px":"14px 16px"),marginBottom:4},IconHolder:{marginLeft:0},input:{marginLeft:4,minHeight:"100%"}}},{children:e.jsx(t.Input,{noKeyDownChange:!0,skipFocus:!0,placeholder:"Search",variant:"2.0"===u?"small":"default",leftIcon:{icon:()=>e.jsx(i.default,{width:"2.0"===u?18:24,height:"2.0"===u?18:24,color:n.COLORS.content.placeholder})},rightIcon:{icon:()=>l?e.jsx(s.default,{onClick:()=>{h(!0),c(""),p("")},width:24,height:24,color:n.COLORS.content.placeholder}):e.jsx(e.Fragment,{})},reset:d,onChangeText:e=>{h(!1),p(e),c(e)}})}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../../../../input/Input.js"),s=require("../../../../input/context/InputStyleProvider.js"),o=require("../../../../../constants/Theme.js"),n=require("../../../../../assets/icons/cross.svg.js"),i=require("../../../../../assets/icons/search.svg.js");exports.SearchBox=a=>{let{onSearch:c,version:u}=a;const[l,p]=r.useState(""),[d,h]=r.useState(!1);return e.jsx(s.InputStyleContext.Provider,Object.assign({value:{InputWrapper:{borderRadius:0,border:0,borderBottom:`${"2.0"===u?.5:1}px solid ${o.COLORS.stroke.primary}`,padding:""+("2.0"===u?"6px 8px":"14px 16px"),marginBottom:4},IconHolder:{marginLeft:0},input:{marginLeft:4,minHeight:"100%"}}},{children:e.jsx(t.Input,{skipFocus:!0,placeholder:"Search",variant:"2.0"===u?"small":"default",leftIcon:{icon:()=>e.jsx(i.default,{width:"2.0"===u?18:24,height:"2.0"===u?18:24,color:o.COLORS.content.placeholder})},rightIcon:{icon:()=>l?e.jsx(n.default,{onClick:()=>{h(!0),c(""),p("")},width:24,height:24,color:o.COLORS.content.placeholder}):e.jsx(e.Fragment,{})},reset:d,onChangeText:e=>{h(!1),p(e),c(e)}})}))};
@@ -26,4 +26,3 @@ export declare function iterateOnOptions(options: DropdownOption[], newVal: Part
26
26
  searchKey?: string | undefined;
27
27
  options: SingleOption[];
28
28
  })[];
29
- export declare function iterateOnOptionsRaw(options: DropdownOption[], cb: (option: SingleOption) => void): void;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.iterateOnOptions=function(t,s,e){return t.map((t=>{if(t.options){const n=t.options.map((t=>!e||e(t)?Object.assign(Object.assign({},t),s):Object.assign({},t)));return Object.assign(Object.assign({},t),{options:[...n]})}return!e||e(t)?Object.assign(Object.assign({},t),s):Object.assign({},t)}))},exports.iterateOnOptionsRaw=function(t,s){t.forEach((t=>{t.options?t.options.forEach(s):s(t)}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.iterateOnOptions=function(s,t,e){return s.map((s=>{if(s.options){const n=s.options.map((s=>!e||e(s)?Object.assign(Object.assign({},s),t):Object.assign({},s)));return Object.assign(Object.assign({},s),{options:[...n]})}return!e||e(s)?Object.assign(Object.assign({},s),t):Object.assign({},s)}))};
@@ -13,7 +13,6 @@ export interface OpenDropdownProps {
13
13
  onSelect?: (option: DropdownOption | DropdownOption[]) => void;
14
14
  placement?: Placement;
15
15
  strategy?: PositioningStrategy;
16
- onSearch?: (key: string) => Promise<DropdownOption[]>;
17
16
  version?: '1.0' | '2.0';
18
17
  skipSorting?: boolean;
19
18
  }
@@ -45,7 +45,6 @@ export interface InputProps {
45
45
  min: number;
46
46
  max: number;
47
47
  };
48
- noKeyDownChange?: boolean;
49
48
  skipFocus?: boolean;
50
49
  }
51
50
  export declare const Input: {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../button/Button.js"),i=require("./Input-helper.js"),r=require("../TypographyStyle.js"),l=require("../../assets/icons/errorInfo.svg.js"),s=require("./context/InputStyleProvider.js"),a=require("./Input.styled.js");const o=o=>{var u,c,d,v,h;const{placeholder:x,leftIcon:p,rightIcon:f,labelText:j,maxCharLimit:g,isRequired:y,hintText:I,type:b,state:C,validate:m,variant:S,button:w,suffixText:E,prefixText:O,onChangeText:q,value:F,noErrorHint:k,reset:H,rangeValidation:T,noKeyDownChange:B}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},o),M=null==p?void 0:p.icon,A=null==f?void 0:f.icon,[L,R]=t.useState(!1),[z,D]=t.useState(!1),[K,P]=t.useState(),W="small"===S?"18px":"22px",_=t.useContext(s.InputStyleContext),[N,V]=t.useState(),G=t.useRef();t.useEffect((()=>{V(F)}),[F]),t.useEffect((()=>{var e;G.current&&(null===(e=o.onReferenceInit)||void 0===e||e.call(o,G.current))}),[G]),t.useEffect((()=>{H&&V("")}),[H]),t.useEffect((()=>{var e;D(!!o.isActive),o.isActive&&(null===(e=G.current)||void 0===e||e.focus())}),[o.isActive]),t.useEffect((()=>{P(o.errorMessage)}),[o.errorMessage]),t.useEffect((()=>{var e;R(!1),("invalid"===o.state||K)&&R(!0),"active"===o.state&&(null===(e=G.current)||void 0===e||e.focus())}),[o.state,K]),t.useEffect((()=>{R(!!K)}),[K]);const J=function(e){if(i.isFunction(e)){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e(...n)}},Q=e=>{const t=g||("zip"===b?6:60);B||q(F||"",e),![8].includes(e.which)&&t>0&&e.target.value.length===t&&e.preventDefault()},U=e=>{const t=e.target.value;q(t,e),V(t);const n=m||i.validateInput;if(!n||!i.isFunction(n))return;const[r,l]=n(t,b,T);R(!r),P(o.errorMessage?o.errorMessage:l)},X=()=>{var t;return e.jsxs(e.Fragment,{children:["multiline"!==b&&e.jsx("input",{id:o.id,style:null!==(t=null==_?void 0:_.input)&&void 0!==t?t:{},ref:G,type:["phonenumber","zip","number"].includes(b)?"number":b,value:N,onFocus:()=>(o.skipFocus||D(!0),void J(o.onFocus)),onBlur:e=>(e=>{var t;D(!1),J(null===(t=o.onBlur)||void 0===t?void 0:t.call(o,e))})(e),placeholder:x||"Enter here",onChange:U,onKeyDown:e=>Q(e)}),"multiline"===b&&e.jsx("textarea",{value:N,ref:G,onFocus:()=>D(!0),onBlur:()=>D(!1),placeholder:x||"Enter here",onChange:U,onKeyDown:e=>Q(e),maxLength:g>0?g:void 0})]})};return e.jsxs(a.RootContainer,Object.assign({width:o.width,height:o.height,state:C,type:b,style:null!==(u=null==_?void 0:_.RootContainer)&&void 0!==u?u:{}},{children:[!k&&(!!I||!!K)&&e.jsxs(a.InputFooter,Object.assign({invalid:!!K},{children:[!!K&&e.jsx(l.default,{width:16,height:16}),K||I]})),e.jsxs(a.InputWrapper,Object.assign({variant:S,state:C,width:o.width,isActive:"active"===C||z,isInvalid:L,style:null!==(c=null==_?void 0:_.InputWrapper)&&void 0!==c?c:{}},{children:[!!M&&e.jsx(a.IconHolder,Object.assign({variant:S,iconSize:W,onClick:()=>J(null==p?void 0:p.callback),isLeft:!0,style:null!==(d=null==_?void 0:_.IconHolder)&&void 0!==d?d:{}},{children:e.jsx(M,{})})),!!O&&e.jsx(a.PrefixHolder,Object.assign({variant:S},{children:O})),"default"===S&&e.jsx(a.InputContainer,{children:X()}),"small"===S&&e.jsx(a.InputContainerSmall,{children:X()}),!!A&&e.jsx(a.IconHolder,Object.assign({variant:S,iconSize:W,onClick:()=>J(null==f?void 0:f.callback),isLeft:!1},{children:e.jsx(A,{})})),!!E&&e.jsx(a.SuffixHolder,Object.assign({variant:S},{children:E})),w&&w.text&&e.jsx(n.Button,{buttonText:w.text,onClick:()=>J(null==w?void 0:w.onClick)})]})),(!!j||!!g)&&e.jsxs(a.InputHeader,Object.assign({invalid:L},{children:[e.jsxs(r.BodySecondary,{children:[j,y?e.jsx("span",{children:"*"}):""]}),g>0&&e.jsxs(a.MaxCharStyle,{children:[null!==(h=null===(v=o.value)||void 0===v?void 0:v.length)&&void 0!==h?h:0,"/",g]})]}))]}))};o.displayName="Input",exports.Input=o;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../button/Button.js"),i=require("./Input-helper.js"),r=require("../TypographyStyle.js"),l=require("../../assets/icons/errorInfo.svg.js"),s=require("./context/InputStyleProvider.js"),a=require("./Input.styled.js");const o=o=>{var u,c,d,v,h;const{placeholder:x,leftIcon:p,rightIcon:f,labelText:j,maxCharLimit:g,isRequired:y,hintText:I,type:b,state:m,validate:C,variant:S,button:E,suffixText:O,prefixText:q,onChangeText:w,value:F,noErrorHint:k,reset:H,rangeValidation:T}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},o),B=null==p?void 0:p.icon,M=null==f?void 0:f.icon,[A,L]=t.useState(!1),[R,z]=t.useState(!1),[D,P]=t.useState(),K="small"===S?"18px":"22px",W=t.useContext(s.InputStyleContext),[_,N]=t.useState(),V=t.useRef();t.useEffect((()=>{N(F)}),[F]),t.useEffect((()=>{var e;V.current&&(null===(e=o.onReferenceInit)||void 0===e||e.call(o,V.current))}),[V]),t.useEffect((()=>{H&&N("")}),[H]),t.useEffect((()=>{var e;z(!!o.isActive),o.isActive&&(null===(e=V.current)||void 0===e||e.focus())}),[o.isActive]),t.useEffect((()=>{P(o.errorMessage)}),[o.errorMessage]),t.useEffect((()=>{var e;L(!1),("invalid"===o.state||D)&&L(!0),"active"===o.state&&(null===(e=V.current)||void 0===e||e.focus())}),[o.state,D]),t.useEffect((()=>{L(!!D)}),[D]);const G=function(e){if(i.isFunction(e)){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e(...n)}},J=e=>{const t=g||("zip"===b?6:60);w(F||"",e),![8].includes(e.which)&&t>0&&e.target.value.length===t&&e.preventDefault()},Q=e=>{const t=e.target.value;w(t,e),N(t);const n=C||i.validateInput;if(!n||!i.isFunction(n))return;const[r,l]=n(t,b,T);L(!r),P(o.errorMessage?o.errorMessage:l)},U=()=>{var t;return e.jsxs(e.Fragment,{children:["multiline"!==b&&e.jsx("input",{id:o.id,style:null!==(t=null==W?void 0:W.input)&&void 0!==t?t:{},ref:V,type:["phonenumber","zip","number"].includes(b)?"number":b,value:_,onFocus:()=>(o.skipFocus||z(!0),void G(o.onFocus)),onBlur:e=>(e=>{var t;z(!1),G(null===(t=o.onBlur)||void 0===t?void 0:t.call(o,e))})(e),placeholder:x||"Enter here",onChange:Q,onKeyDown:e=>J(e)}),"multiline"===b&&e.jsx("textarea",{value:_,ref:V,onFocus:()=>z(!0),onBlur:()=>z(!1),placeholder:x||"Enter here",onChange:Q,onKeyDown:e=>J(e),maxLength:g>0?g:void 0})]})};return e.jsxs(a.RootContainer,Object.assign({width:o.width,height:o.height,state:m,type:b,style:null!==(u=null==W?void 0:W.RootContainer)&&void 0!==u?u:{}},{children:[!k&&(!!I||!!D)&&e.jsxs(a.InputFooter,Object.assign({invalid:!!D},{children:[!!D&&e.jsx(l.default,{width:16,height:16}),D||I]})),e.jsxs(a.InputWrapper,Object.assign({variant:S,state:m,width:o.width,isActive:"active"===m||R,isInvalid:A,style:null!==(c=null==W?void 0:W.InputWrapper)&&void 0!==c?c:{}},{children:[!!B&&e.jsx(a.IconHolder,Object.assign({variant:S,iconSize:K,onClick:()=>G(null==p?void 0:p.callback),isLeft:!0,style:null!==(d=null==W?void 0:W.IconHolder)&&void 0!==d?d:{}},{children:e.jsx(B,{})})),!!q&&e.jsx(a.PrefixHolder,Object.assign({variant:S},{children:q})),"default"===S&&e.jsx(a.InputContainer,{children:U()}),"small"===S&&e.jsx(a.InputContainerSmall,{children:U()}),!!M&&e.jsx(a.IconHolder,Object.assign({variant:S,iconSize:K,onClick:()=>G(null==f?void 0:f.callback),isLeft:!1},{children:e.jsx(M,{})})),!!O&&e.jsx(a.SuffixHolder,Object.assign({variant:S},{children:O})),E&&E.text&&e.jsx(n.Button,{buttonText:E.text,onClick:()=>G(null==E?void 0:E.onClick)})]})),(!!j||!!g)&&e.jsxs(a.InputHeader,Object.assign({invalid:A},{children:[e.jsxs(r.BodySecondary,{children:[j,y?e.jsx("span",{children:"*"}):""]}),g>0&&e.jsxs(a.MaxCharStyle,{children:[null!==(h=null===(v=o.value)||void 0===v?void 0:v.length)&&void 0!==h?h:0,"/",g]})]}))]}))};o.displayName="Input",exports.Input=o;
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../../../../_virtual/_tslib.js";import{jsx as o,jsxs as r}from"react/jsx-runtime";import{useState as t,useEffect as a}from"react";import l from"../../../components/AllowedListDropdown.js";import i from"../../../components/Connectors/Connector.js";import{ApiResponseHelper as n}from"../../../helpers/ApiResponse.helper.js";import{useQueryBuilder as d}from"../../../hooks/useQueryBuilder.js";import{useQueryBuilderCache as u}from"../../../hooks/useQueryBuilderCache.js";import{QueryBuilderConnectorType as v}from"../../../types/QueryBuilder.type.js";import{FREQUENCY_OPERATORS as p,DATE_OPERATORS as s}from"../../../types/QueryBuilderOperator.type.js";import c from"../../../components/DropdownWrapper.js";import{BaseQueryBuilderNode as y}from"../../../components/QueryBuilderNode/Base/BaseQueryBuilderNode.js";const m=new n,f=n=>{let{node:f,allowedNodes:h,apiHandler:T,mode:_,selectorKey:j}=n;var k,g,N,b,O,P,w,q,x,C,S,V,B,E,A,Q,D,M;const[L,$]=t([]),[J,K]=t(!1),{deleteProperty:W,createProperty:G,selectType:H,createMeta:R,updateMeta:z,updateProperty:F,selectPropertyJoinOperator:I,clearProperty:U}=d(j),{cacheWrap:X}=u(),[Y,Z]=t(!0),ee=null===(k=null==f?void 0:f.metas)||void 0===k?void 0:k.find((e=>"date"===e.key)),oe=null===(g=null==f?void 0:f.metas)||void 0===g?void 0:g.find((e=>"frequency"===e.key)),re=null===(N=null==f?void 0:f.metas)||void 0===N?void 0:N.find((e=>"eventName"===e.key)),[te,ae]=t(!1),[le,ie]=t(!1),[ne,de]=t(!1),ue=e=>X((()=>T({query:{eventName:e}})),`EVENT_NAMES_${e}`),ve=(e,o)=>X((()=>T({query:{eventName:e,propertyName:o}})),`EVENT_NAMES_${e}_${o}`),pe=(o,r,t)=>e(void 0,void 0,void 0,(function*(){return yield T({query:{eventName:o,propertyName:r,searchKey:t}})}));return a((()=>{X((()=>T({})),"EVENT_NAMES").then((e=>{Z(!1);const o=m.convertToGroupOptions(e,(null==re?void 0:re.value)?[re.value]:void 0);if("create"!==_&&re)return $([...o]),void K(!0);$([...o]),K(!0)}))}),[]),o(y,Object.assign({selectPropertyJoinOperator:I,node:f,addPropertyBtnText:(null==re?void 0:re.value)&&"Add event property",deleteProperty:W,createProperty:G,propertySelectorText:"Select property",fetchPropertyData:function(){return e(this,void 0,void 0,(function*(){return yield ue(null==re?void 0:re.value)}))},onPropertyNameSelect:function(o,r){return e(this,void 0,void 0,(function*(){F(Object.assign(Object.assign({},r),{name:o.id,dataType:o.type,operator:void 0,value:void 0,error:{}}),f._id);const e=yield ve(null==re?void 0:re.value,o.id);return null!=e?e:[]}))},onPropertyOperatorChange:function(e,o){F(Object.assign(Object.assign({},o),{operator:e,value:void 0,error:{}}),f._id)},onPropertyValueChange:function(e,o){F(Object.assign(Object.assign({},o),{value:e,error:{}}),f._id)},mode:_,onPropertyValueSearch:function(o,r){var t,a;return e(this,void 0,void 0,(function*(){const e=yield pe(null==re?void 0:re.value,r.name,o);return null!==(a=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.map((e=>({label:e.name,value:e.id,selected:!1}))))&&void 0!==a?a:[]}))}},{children:r("div",Object.assign({style:{flexDirection:"column",display:"flex",gap:12}},{children:[r("div",Object.assign({style:{flexDirection:"row",display:"flex",gap:12}},{children:[o(l,{disabled:"view"===_,selectedType:f.type,allowedList:h,onSelect:function(e){ae(!0),setTimeout((()=>{H(e.value,f._id),ae(!1)}),1)}}),!te&&o(c,{isSearchable:!0,isLoading:Y,disabled:"view"===_,width:"200px",dropdownLabel:"Select event name",options:L,selectedValues:(null==re?void 0:re.value)?[re.value]:void 0,onSelect:function(e){Array.isArray(e)||(U(f._id),re?z({key:"eventName",value:e.value,error:{}},f._id):R({key:"eventName",value:e.value},f._id),oe?(ie(!0),setTimeout((()=>{z({key:"frequency",value:{dataType:v.frequency,operator:p.atleast,value:1},error:{}},f._id),ie(!1)}),1)):R({key:"frequency",value:{dataType:v.frequency,operator:p.atleast,value:1}},f._id),ee?(de(!0),setTimeout((()=>{z({key:"date",value:{dataType:v.date,operator:s["last month"]},error:{}},f._id),de(!1)}),1)):R({key:"date",value:{dataType:v.date,operator:s["last month"]}},f._id))},error:null!==(x=null!==(w=null===(P=null===(O=null===(b=f.metas)||void 0===b?void 0:b[0])||void 0===O?void 0:O.error)||void 0===P?void 0:P.key)&&void 0!==w?w:null===(q=null==re?void 0:re.error)||void 0===q?void 0:q.key)&&void 0!==x?x:null===(C=null==re?void 0:re.error)||void 0===C?void 0:C.value})]})),(null==oe?void 0:oe.key)&&!le&&o(i,{disabled:"view"===_,extra:{},errors:{val:null===(V=null===(S=oe.error)||void 0===S?void 0:S.value)||void 0===V?void 0:V.value,operator:null===(E=null===(B=oe.error)||void 0===B?void 0:B.value)||void 0===E?void 0:E.operator},connectorVal:oe.value.value,connectorType:oe.value.dataType,defaultConnector:oe.value.operator,onOperatorChange:function(e){z({key:"frequency",value:{dataType:v.frequency,operator:e,value:1},error:{}},f._id)},onValueChange:function(e){var o;J&&z({key:"frequency",value:{dataType:v.frequency,operator:null===(o=null==oe?void 0:oe.value)||void 0===o?void 0:o.operator,value:e},error:{}},f._id)}}),(null==ee?void 0:ee.key)&&!ne&&o(i,{disabled:"view"===_,extra:{},errors:{val:null===(Q=null===(A=ee.error)||void 0===A?void 0:A.value)||void 0===Q?void 0:Q.value,operator:null===(M=null===(D=ee.error)||void 0===D?void 0:D.value)||void 0===M?void 0:M.operator},connectorVal:ee.value.value,connectorType:ee.value.dataType,defaultConnector:ee.value.operator,onOperatorChange:function(e){z({key:"date",value:{dataType:v.date,operator:e,value:void 0},error:{}},f._id)},onValueChange:function(e){var o;J&&z({key:"date",value:{dataType:v.date,operator:null===(o=null==ee?void 0:ee.value)||void 0===o?void 0:o.operator,value:e},error:{}},f._id)}})]}))}))};export{f as default};
1
+ import{__awaiter as e}from"../../../../../_virtual/_tslib.js";import{jsx as o,jsxs as r}from"react/jsx-runtime";import{useState as t,useEffect as a}from"react";import l from"../../../components/AllowedListDropdown.js";import i from"../../../components/Connectors/Connector.js";import{ApiResponseHelper as n}from"../../../helpers/ApiResponse.helper.js";import{useQueryBuilder as d}from"../../../hooks/useQueryBuilder.js";import{useQueryBuilderCache as u}from"../../../hooks/useQueryBuilderCache.js";import{QueryBuilderConnectorType as v}from"../../../types/QueryBuilder.type.js";import{FREQUENCY_OPERATORS as p,DATE_OPERATORS as s}from"../../../types/QueryBuilderOperator.type.js";import c from"../../../components/DropdownWrapper.js";import{BaseQueryBuilderNode as y}from"../../../components/QueryBuilderNode/Base/BaseQueryBuilderNode.js";const m=new n,f=n=>{let{node:f,allowedNodes:T,apiHandler:h,mode:_,selectorKey:j}=n;var k,g,b,N,O,w,P,q,x,C,S,B,E,V,A,Q,D,M;const[L,$]=t([]),[J,W]=t(!1),{deleteProperty:G,createProperty:H,selectType:K,createMeta:R,updateMeta:z,updateProperty:F,selectPropertyJoinOperator:I,clearProperty:U}=d(j),{cacheWrap:X}=u(),[Y,Z]=t(!0),ee=null===(k=null==f?void 0:f.metas)||void 0===k?void 0:k.find((e=>"date"===e.key)),oe=null===(g=null==f?void 0:f.metas)||void 0===g?void 0:g.find((e=>"frequency"===e.key)),re=null===(b=null==f?void 0:f.metas)||void 0===b?void 0:b.find((e=>"eventName"===e.key)),[te,ae]=t(!1),[le,ie]=t(!1),[ne,de]=t(!1),ue=e=>X((()=>h({query:{eventName:e}})),`EVENT_NAMES_${e}`),ve=(e,o)=>X((()=>h({query:{eventName:e,propertyName:o}})),`EVENT_NAMES_${e}_${o}`);return a((()=>{X((()=>h({})),"EVENT_NAMES").then((e=>{Z(!1);const o=m.convertToGroupOptions(e,(null==re?void 0:re.value)?[re.value]:void 0);if("create"!==_&&re)return $([...o]),void W(!0);$([...o]),W(!0)}))}),[]),o(y,Object.assign({selectPropertyJoinOperator:I,node:f,addPropertyBtnText:(null==re?void 0:re.value)&&"Add event property",deleteProperty:G,createProperty:H,propertySelectorText:"Select property",fetchPropertyData:function(){return e(this,void 0,void 0,(function*(){return yield ue(null==re?void 0:re.value)}))},onPropertyNameSelect:function(o,r){return e(this,void 0,void 0,(function*(){F(Object.assign(Object.assign({},r),{name:o.id,dataType:o.type,operator:void 0,value:void 0,error:{}}),f._id);const e=yield ve(null==re?void 0:re.value,o.id);return null!=e?e:[]}))},onPropertyOperatorChange:function(e,o){F(Object.assign(Object.assign({},o),{operator:e,value:void 0,error:{}}),f._id)},onPropertyValueChange:function(e,o){F(Object.assign(Object.assign({},o),{value:e,error:{}}),f._id)},mode:_},{children:r("div",Object.assign({style:{flexDirection:"column",display:"flex",gap:12}},{children:[r("div",Object.assign({style:{flexDirection:"row",display:"flex",gap:12}},{children:[o(l,{disabled:"view"===_,selectedType:f.type,allowedList:T,onSelect:function(e){ae(!0),setTimeout((()=>{K(e.value,f._id),ae(!1)}),1)}}),!te&&o(c,{isSearchable:!0,isLoading:Y,disabled:"view"===_,width:"200px",dropdownLabel:"Select event name",options:L,selectedValues:(null==re?void 0:re.value)?[re.value]:void 0,onSelect:function(e){Array.isArray(e)||(U(f._id),re?z({key:"eventName",value:e.value,error:{}},f._id):R({key:"eventName",value:e.value},f._id),oe?(ie(!0),setTimeout((()=>{z({key:"frequency",value:{dataType:v.frequency,operator:p.atleast,value:1},error:{}},f._id),ie(!1)}),1)):R({key:"frequency",value:{dataType:v.frequency,operator:p.atleast,value:1}},f._id),ee?(de(!0),setTimeout((()=>{z({key:"date",value:{dataType:v.date,operator:s["last month"]},error:{}},f._id),de(!1)}),1)):R({key:"date",value:{dataType:v.date,operator:s["last month"]}},f._id))},error:null!==(x=null!==(P=null===(w=null===(O=null===(N=f.metas)||void 0===N?void 0:N[0])||void 0===O?void 0:O.error)||void 0===w?void 0:w.key)&&void 0!==P?P:null===(q=null==re?void 0:re.error)||void 0===q?void 0:q.key)&&void 0!==x?x:null===(C=null==re?void 0:re.error)||void 0===C?void 0:C.value})]})),(null==oe?void 0:oe.key)&&!le&&o(i,{disabled:"view"===_,extra:{},errors:{val:null===(B=null===(S=oe.error)||void 0===S?void 0:S.value)||void 0===B?void 0:B.value,operator:null===(V=null===(E=oe.error)||void 0===E?void 0:E.value)||void 0===V?void 0:V.operator},connectorVal:oe.value.value,connectorType:oe.value.dataType,defaultConnector:oe.value.operator,onOperatorChange:function(e){z({key:"frequency",value:{dataType:v.frequency,operator:e,value:1},error:{}},f._id)},onValueChange:function(e){var o;J&&z({key:"frequency",value:{dataType:v.frequency,operator:null===(o=null==oe?void 0:oe.value)||void 0===o?void 0:o.operator,value:e},error:{}},f._id)}}),(null==ee?void 0:ee.key)&&!ne&&o(i,{disabled:"view"===_,extra:{},errors:{val:null===(Q=null===(A=ee.error)||void 0===A?void 0:A.value)||void 0===Q?void 0:Q.value,operator:null===(M=null===(D=ee.error)||void 0===D?void 0:D.value)||void 0===M?void 0:M.operator},connectorVal:ee.value.value,connectorType:ee.value.dataType,defaultConnector:ee.value.operator,onOperatorChange:function(e){z({key:"date",value:{dataType:v.date,operator:e,value:void 0},error:{}},f._id)},onValueChange:function(e){var o;J&&z({key:"date",value:{dataType:v.date,operator:null===(o=null==ee?void 0:ee.value)||void 0===o?void 0:o.operator,value:e},error:{}},f._id)}})]}))}))};export{f as default};
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../../../../_virtual/_tslib.js";import{jsx as r,jsxs as o}from"react/jsx-runtime";import t from"../../../components/AllowedListDropdown.js";import{PropertyNodeHeadless as i}from"../../../components/QueryBuilderNode/Property/PropertyNode.js";import{useQueryBuilder as n}from"../../../hooks/useQueryBuilder.js";import{useQueryBuilderCache as d}from"../../../hooks/useQueryBuilderCache.js";import{BaseQueryBuilderNode as a}from"../../../components/QueryBuilderNode/Base/BaseQueryBuilderNode.js";const l=l=>{let{node:s,allowedNodes:p,apiHandler:u,mode:c,selectorKey:v}=l;var y;const{selectType:m,createProperty:f,updateProperty:j}=n(v),{cacheWrap:h}=d(),P=e=>h((()=>u({query:{propertyName:e}})),`USER_PROPERTIES-${e}`),g=(r,o)=>e(void 0,void 0,void 0,(function*(){return yield u({query:{propertyName:r,searchKey:o}})}));return r(a,Object.assign({node:s,mode:c},{children:o("div",Object.assign({style:{flexDirection:"row",display:"flex",gap:12,alignItems:"flex-start"}},{children:[r(t,{disabled:"view"===c,selectedType:s.type,allowedList:p,onSelect:e=>m(e.value,s._id)}),r(i,{mode:c,property:null===(y=null==s?void 0:s.properties)||void 0===y?void 0:y[0],fetchPropertyData:()=>h((()=>u({})),"USER_PROPERTIES"),onPropertyNameSelect:function(r){var o,t;return e(this,void 0,void 0,(function*(){if((null===(o=s.properties)||void 0===o?void 0:o[0])?j(Object.assign(Object.assign({},null===(t=s.properties)||void 0===t?void 0:t[0]),{name:r.id,dataType:r.type,operator:void 0,value:void 0,error:{}}),s._id):f({name:r.id,dataType:r.type},s._id),r.needValuesRetrieval){const e=yield P(r.id);return null!=e?e:[]}return[]}))},onPropertyOperatorChange:function(e){j(Object.assign(Object.assign({},s.properties[0]),{operator:e,value:void 0,error:{}}),s._id)},onPropertyValueChange:function(e){j(Object.assign(Object.assign({},s.properties[0]),{value:e,error:{}}),s._id)},onPropertyValueSearch:function(r,o){var t,i;return e(this,void 0,void 0,(function*(){const e=yield g(o.name,r);return null!==(i=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.map((e=>({label:e.name,value:e.id,selected:!1}))))&&void 0!==i?i:[]}))}})]}))}))};export{l as default};
1
+ import{__awaiter as e}from"../../../../../_virtual/_tslib.js";import{jsx as r,jsxs as o}from"react/jsx-runtime";import t from"../../../components/AllowedListDropdown.js";import{PropertyNodeHeadless as i}from"../../../components/QueryBuilderNode/Property/PropertyNode.js";import{useQueryBuilder as s}from"../../../hooks/useQueryBuilder.js";import{useQueryBuilderCache as d}from"../../../hooks/useQueryBuilderCache.js";import{BaseQueryBuilderNode as a}from"../../../components/QueryBuilderNode/Base/BaseQueryBuilderNode.js";const n=n=>{let{node:p,allowedNodes:l,apiHandler:u,mode:c,selectorKey:y}=n;var m;const{selectType:v,createProperty:f,updateProperty:j}=s(y),{cacheWrap:g}=d(),P=e=>g((()=>u({query:{propertyName:e}})),`USER_PROPERTIES-${e}`);return r(a,Object.assign({node:p,mode:c},{children:o("div",Object.assign({style:{flexDirection:"row",display:"flex",gap:12,alignItems:"flex-start"}},{children:[r(t,{disabled:"view"===c,selectedType:p.type,allowedList:l,onSelect:e=>v(e.value,p._id)}),r(i,{mode:c,property:null===(m=null==p?void 0:p.properties)||void 0===m?void 0:m[0],fetchPropertyData:()=>g((()=>u({})),"USER_PROPERTIES"),onPropertyNameSelect:function(r){var o,t;return e(this,void 0,void 0,(function*(){if((null===(o=p.properties)||void 0===o?void 0:o[0])?j(Object.assign(Object.assign({},null===(t=p.properties)||void 0===t?void 0:t[0]),{name:r.id,dataType:r.type,operator:void 0,value:void 0,error:{}}),p._id):f({name:r.id,dataType:r.type},p._id),r.needValuesRetrieval){const e=yield P(r.id);return null!=e?e:[]}return[]}))},onPropertyOperatorChange:function(e){j(Object.assign(Object.assign({},p.properties[0]),{operator:e,value:void 0,error:{}}),p._id)},onPropertyValueChange:function(e){j(Object.assign(Object.assign({},p.properties[0]),{value:e,error:{}}),p._id)}})]}))}))};export{n as default};
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { ConnectorComponentProps } from "../../../types/QueryBuilderConnector.type";
3
+ declare const _default: (props: ConnectorComponentProps) => JSX.Element;
4
+ export default _default;
@@ -1 +1 @@
1
- import{jsx as l}from"react/jsx-runtime";import{useState as e,useEffect as o}from"react";import a from"../../DropdownWrapper.js";const i=i=>{let{onChange:n,extra:r,val:t,isLoading:d,errors:s,disabled:u,onSearch:c}=i;var v;const[p,m]=e([]),f=t;return o((()=>{var l;const e=(null==r?void 0:r.options)&&Array.isArray(r.options)?r.options.filter((l=>!!Object.keys(l).length)).map((l=>({selected:!!(null==f?void 0:f.find((e=>e.id===l.id))),label:l.name,value:l.id}))):[],o=null!==(l=null==f?void 0:f.map((l=>l.id)))&&void 0!==l?l:[],a=[...e.filter((l=>!o.includes(l.value)))].concat((null!=f?f:[]).map((l=>({value:l.id,label:l.name}))));null==f||f.forEach((l=>{let{name:e,id:o}=l;const i=a.findIndex((l=>l.value===o&&l.label===e));-1!==i&&(a[i].selected=!0)})),m([...a])}),[r,f]),l("div",{children:l(a,{onSearch:c,disabled:u,allowFreeForm:null===(v=null==r?void 0:r.freeForm)||void 0===v||v,isSearchable:!0,isLoading:d,error:null==s?void 0:s.val,isMultiSelect:!0,options:p,onSelect:function(l){if(Array.isArray(l)){const e=[];l.forEach((l=>{var o,a;l.options?null===(o=l.options)||void 0===o||o.forEach((l=>{e.push({name:l.label,id:l.value})})):e.push({name:null!==(a=l.label)&&void 0!==a?a:"",id:l.value})})),null==n||n(e)}}})})};var n=e=>l(i,Object.assign({},e));export{n as default};
1
+ import{jsx as l}from"react/jsx-runtime";import{useState as e,useEffect as o}from"react";import a from"../../DropdownWrapper.js";const i=i=>{let{onChange:n,extra:r,val:t,isLoading:d,errors:s,disabled:u}=i;var c;const[v,p]=e([]),m=t;return o((()=>{var l;const e=(null==r?void 0:r.options)&&Array.isArray(r.options)?r.options.filter((l=>!!Object.keys(l).length)).map((l=>({selected:!!(null==m?void 0:m.find((e=>e.id===l.id))),label:l.name,value:l.id}))):[],o=null!==(l=null==m?void 0:m.map((l=>l.id)))&&void 0!==l?l:[],a=[...e.filter((l=>!o.includes(l.value)))].concat((null!=m?m:[]).map((l=>({value:l.id,label:l.name}))));null==m||m.forEach((l=>{let{name:e,id:o}=l;const i=a.findIndex((l=>l.value===o&&l.label===e));-1!==i&&(a[i].selected=!0)})),p([...a])}),[r,m]),l("div",{children:l(a,{disabled:u,allowFreeForm:null===(c=null==r?void 0:r.freeForm)||void 0===c||c,isSearchable:!0,isLoading:d,error:null==s?void 0:s.val,isMultiSelect:!0,options:v,onSelect:function(l){if(Array.isArray(l)){const e=[];l.forEach((l=>{var o,a;l.options?null===(o=l.options)||void 0===o||o.forEach((l=>{e.push({name:l.label,id:l.value})})):e.push({name:null!==(a=l.label)&&void 0!==a?a:"",id:l.value})})),null==n||n(e)}}})})};var n=e=>l(i,Object.assign({},e));export{n as default};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useState as n,useEffect as t}from"react";import{unCamelCaseWithFirstUppercase as r}from"../../../../utils/unCamelCase.js";import{disableOperatorDropdown as i}from"../../constants/connectorPosition.js";import{ConnectorHelper as l}from"../../helpers/Connector.helper.js";import{QueryBuilderConnectorType as s}from"../../types/QueryBuilder.type.js";import m from"../DropdownWrapper.js";import p from"./Components/EmojiPicker.js";import a from"./Components/FreeText.js";import u from"./Components/FrequencyIntegerPositiveSingle.js";import{PostIgPicker as c,ReelIgPicker as d,StoryIgPicker as g}from"./Components/IgPicker.js";import f from"./Components/IntegerPositiveSingle.js";import C from"./Components/IntegerSingleValue.js";import j from"./Components/InTheLast.js";import v from"./Components/MultiselectDropdownFreeText.js";import S from"./Components/NoInput.js";import I from"./Components/NumberTime.js";import T from"./Components/SingleDate.js";import h from"./Components/SingleselectDropdownFreeText.js";import P from"./Components/StringSingleValue.js";import y from"./Components/TwoDate.js";import x from"./Components/TwoNumberInputsSeperatedByAnd.js";import{Container as b}from"./Connector.styled.js";const w={FreeText:a,IntegerPositiveSingle:f,IntegerSingleValue:C,StringSingleValue:P,MultiselectDropdownFreeText:v,SingleselectDropdownFreeText:h,NoInput:S,SingleDate:T,TwoNumberInputsSeperatedByAnd:x,FrequencyIntegerPositiveSingle:u,TwoDate:y,NumberTime:I,PostIgPicker:c,ReelIgPicker:d,StoryIgPicker:g,EmojiPicker:p,InTheLast:j},D=p=>{let{isLoading:a,noDefault:u,connectorType:c,defaultConnector:d,onOperatorChange:g,onValueChange:f,connectorVal:C,extra:j,errors:v,disabled:S,onSearch:I}=p;var T,h,P;const[y,x]=n(null),[D,F]=n(!1),k=l.getConnectorType(c).map((e=>({selected:e===d,value:e,label:r(e)})));function N(e){let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];F(!0);const n=l.getConnectorComponent(c,e.value);void 0!==n?c===s.frequency&&"IntegerPositiveSingle"===n?x("FrequencyIntegerPositiveSingle"):x(n):x(null),o||g(e.value),setTimeout((()=>{F(!1)}),5)}return t((()=>{u||(d?N({value:d,label:d},!0):(null==k?void 0:k[0])&&N(k[0]))}),[d]),e(b,{children:[o("div",{children:!(null===(T=null==i?void 0:i[c])||void 0===T?void 0:T[d])&&o(m,{isSearchable:!0,disabled:S,width:"200px",isLoading:D,options:k,defaultOption:null===(h=k.filter((e=>e.selected)))||void 0===h?void 0:h[0],onSelect:N})}),null!==y&&!D&&(null===(P=w[y])||void 0===P?void 0:P.call(w,{disabled:S,val:C,onChange:f,extra:j,errors:v,isLoading:a,onSearch:I}))]})};export{D as default};
1
+ import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useState as t,useEffect as n}from"react";import{disableOperatorDropdown as r}from"../../constants/connectorPosition.js";import{ConnectorHelper as i}from"../../helpers/Connector.helper.js";import{QueryBuilderConnectorType as s}from"../../types/QueryBuilder.type.js";import l from"../DropdownWrapper.js";import m from"./Components/EmojiPicker.js";import p from"./Components/FreeText.js";import a from"./Components/FrequencyIntegerPositiveSingle.js";import{PostIgPicker as u,ReelIgPicker as d,StoryIgPicker as c}from"./Components/IgPicker.js";import g from"./Components/IntegerPositiveSingle.js";import f from"./Components/IntegerSingleValue.js";import j from"./Components/InTheLast.js";import C from"./Components/MultiselectDropdownFreeText.js";import v from"./Components/NoInput.js";import S from"./Components/NumberTime.js";import I from"./Components/SingleDate.js";import T from"./Components/SingleselectDropdownFreeText.js";import P from"./Components/StringSingleValue.js";import y from"./Components/TwoDate.js";import h from"./Components/TwoNumberInputsSeperatedByAnd.js";import{Container as D}from"./Connector.styled.js";const w={FreeText:p,IntegerPositiveSingle:g,IntegerSingleValue:f,StringSingleValue:P,MultiselectDropdownFreeText:C,SingleselectDropdownFreeText:T,NoInput:v,SingleDate:I,TwoNumberInputsSeperatedByAnd:h,FrequencyIntegerPositiveSingle:a,TwoDate:y,NumberTime:S,PostIgPicker:u,ReelIgPicker:d,StoryIgPicker:c,EmojiPicker:m,InTheLast:j},x=m=>{let{isLoading:p,noDefault:a,connectorType:u,defaultConnector:d,onOperatorChange:c,onValueChange:g,connectorVal:f,extra:j,errors:C,disabled:v}=m;var S,I,T;const[P,y]=t(null),[h,x]=t(!1),F=i.getDropdownOptionFromDataType(u,d);function b(e){let o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];x(!0);const t=i.getConnectorComponent(u,e.value);void 0!==t?u===s.frequency&&"IntegerPositiveSingle"===t?y("FrequencyIntegerPositiveSingle"):y(t):y(null),o||c(e.value),setTimeout((()=>{x(!1)}),5)}return n((()=>{a||(d?b({value:d,label:d},!0):(null==F?void 0:F[0])&&b(F[0]))}),[d]),e(D,{children:[o("div",{children:!(null===(S=null==r?void 0:r[u])||void 0===S?void 0:S[d])&&o(l,{isSearchable:!0,disabled:v,width:"200px",isLoading:h,options:F,defaultOption:null===(I=F.filter((e=>e.selected)))||void 0===I?void 0:I[0],onSelect:b})}),null!==P&&!h&&(null===(T=w[P])||void 0===T?void 0:T.call(w,{disabled:v,val:f,onChange:g,extra:j,errors:C,isLoading:p}))]})};export{x as default};
@@ -14,6 +14,5 @@ declare const DropdownWrapper: React.FC<{
14
14
  width?: string;
15
15
  disabled?: boolean;
16
16
  selectedValues?: (string | number)[];
17
- onSearch?: (searchKey: string) => DropdownOption[];
18
17
  }>;
19
18
  export default DropdownWrapper;
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{Dropdown as i}from"../../dropdown/Dropdown.js";import t from"./InputLoader.js";const o=o=>{let{options:s,onSelect:l,defaultOption:a,isSearchable:r,isLoading:n,error:d,nativeID:c,dropdownLabel:p,isMultiSelect:u,allowFreeForm:m,width:b,disabled:h,selectedValues:g,onSearch:j}=o;return n?e(t,{}):e("div",Object.assign({style:{maxWidth:200,width:200},id:c},{children:e(i,{onSearch:j,height:(null==s?void 0:s.length)?void 0:208,disabled:h,allowFreeForm:null!=m&&m,isMultiSelect:u,width:b,size:"small",placeHolder:p,error:d,isSearchable:null!=r&&r,defaultOptions:a?Array.isArray(a)?a:[a]:void 0,options:g?s.map((e=>e.options?Object.assign(Object.assign({},e),{options:e.options.map((e=>Object.assign(Object.assign({},e),{selected:g.includes(e.value)})))}):Object.assign(Object.assign({},e),{selected:g.includes(e.value)}))):s,onSelect:l})}))};export{o as default};
1
+ import{jsx as e}from"react/jsx-runtime";import{Dropdown as i}from"../../dropdown/Dropdown.js";import t from"./InputLoader.js";const s=s=>{let{options:l,onSelect:o,defaultOption:a,isSearchable:r,isLoading:n,error:d,nativeID:c,dropdownLabel:p,isMultiSelect:u,allowFreeForm:m,width:b,disabled:g,selectedValues:h}=s;return n?e(t,{}):e("div",Object.assign({style:{maxWidth:200,width:200},id:c},{children:e(i,{height:(null==l?void 0:l.length)?void 0:208,disabled:g,allowFreeForm:null!=m&&m,isMultiSelect:u,width:b,size:"small",placeHolder:p,error:d,isSearchable:null!=r&&r,defaultOptions:a?Array.isArray(a)?a:[a]:void 0,options:h?l.map((e=>e.options?Object.assign(Object.assign({},e),{options:e.options.map((e=>Object.assign(Object.assign({},e),{selected:h.includes(e.value)})))}):Object.assign(Object.assign({},e),{selected:h.includes(e.value)}))):l,onSelect:o})}))};export{s as default};
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { DropdownOption } from "../../../../dropdown/type";
3
2
  import { BaseQueryBuilderNode as BaseQueryBuilderNodeType, QueryBuilderProperty } from "../../../types/QueryBuilder.type";
4
3
  import { QueryBuilderPropertyProps } from "../../../types/QueryBuilderPropertyProps";
5
4
  type BaseQueryBuilderNodeProps = Omit<QueryBuilderPropertyProps, 'property'> & {
@@ -9,7 +8,6 @@ type BaseQueryBuilderNodeProps = Omit<QueryBuilderPropertyProps, 'property'> & {
9
8
  addPropertyBtnText?: string;
10
9
  node: BaseQueryBuilderNodeType;
11
10
  children: React.ReactNode;
12
- onPropertyValueSearch?: (searchKey: string, property: QueryBuilderProperty) => Promise<DropdownOption[]>;
13
11
  };
14
12
  /**
15
13
  * @exported
@@ -17,7 +15,5 @@ type BaseQueryBuilderNodeProps = Omit<QueryBuilderPropertyProps, 'property'> & {
17
15
  * @param param0
18
16
  * @returns
19
17
  */
20
- export declare const BaseQueryBuilderNode: React.FC<BaseQueryBuilderNodeProps & {
21
- children: React.ReactNode;
22
- }>;
18
+ export declare const BaseQueryBuilderNode: React.FC<BaseQueryBuilderNodeProps>;
23
19
  export {};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as r,Fragment as o}from"react/jsx-runtime";import{useState as n,useEffect as a}from"react";import{isNewLineConnectorPosition as i}from"../../../constants/connectorPosition.js";import{ApiResponseHelper as t}from"../../../helpers/ApiResponse.helper.js";import l from"../../Connectors/Connector.js";import d from"../../DropdownWrapper.js";import{Container as s}from"./PropertyNode.styled.js";import p from"./PropertyNodeUIWrapper.js";const c=new t,u=r=>e(p,Object.assign({isLast:r.isLast,mode:r.mode},{children:e("div",Object.assign({style:{padding:12,maxWidth:"calc(100% - 78px)"}},{children:e(v,Object.assign({},r))}))})),v=t=>{let{propertySelectorText:p,fetchPropertyData:u,onPropertyNameSelect:v,onPropertyOperatorChange:m,onPropertyValueChange:y,property:g,mode:b,onPropertyValueSearch:h}=t;var j,f,O,A,C,T,S;const[x,P]=n([]),[w,V]=n({}),[L,D]=n(!0),[z,N]=n("create"===b),W=Array.isArray(x)?x.map((e=>Object.assign(Object.assign({},e),{label:e.name,value:e.id,description:e.description,selected:(null==g?void 0:g.name)===e.id}))):c.convertToGroupOptions(x,(null==g?void 0:g.name)?[g.name.toString()]:void 0);function k(e){if(!Array.isArray(e)){N(!0);let r=null;Array.isArray(x)?r=x.find((r=>{let{id:o}=r;return o===e.value})):Object.keys(x).forEach((o=>{const n=x[o].find((r=>{let{id:o}=r;return o===e.value}));n&&(r=n)})),V({}),r?null==v||v(r,g).then((e=>{const r=e;r.normalized&&r.originalData?V((e=>Object.assign(Object.assign({},e),{options:Array.isArray(r.normalized)?[...r.normalized]:Object.assign({},r.normalized),originalData:r.originalData}))):V((r=>Object.assign(Object.assign({},r),{options:Array.isArray(e)?[...e]:Object.assign({},e)}))),N(!1)})):N(!1)}}return a((()=>{u?u().then((e=>{e&&(Array.isArray(e)?P([...e]):P(Object.assign({},e))),D(!1),N(!1)})):(D(!1),N(!1))}),[]),a((()=>{if("create"!==b&&x&&(null==g?void 0:g.name)){const e=g,r=Array.isArray(x)?x.find((e=>e.id===(null==g?void 0:g.name))):c.findInGroupedApiResponse(x,null==g?void 0:g.name);r&&k({value:r.id,label:r.name}),null==y||y(null==e?void 0:e.value,g)}}),[x]),a((()=>{"iceBreaker"===(null==g?void 0:g.dataType)&&V((e=>Object.assign(Object.assign({},e),{freeForm:!1})))}),[null==g?void 0:g.dataType]),r(o,{children:[r(s,{children:[e(d,{isSearchable:!0,disabled:"view"===b,width:"200px",isLoading:L,dropdownLabel:null!=p?p:"Select property",options:W,onSelect:k,selectedValues:(null==g?void 0:g.name)?[g.name]:void 0,error:null===(j=null==g?void 0:g.error)||void 0===j?void 0:j.name}),(null==g?void 0:g.name)&&!(null===(f=i[g.dataType])||void 0===f?void 0:f[g.operator])&&e(l,{onSearch:e=>null==h?void 0:h(e,g),isLoading:z,disabled:"view"===b,extra:w,errors:{val:null===(O=g.error)||void 0===O?void 0:O.value,operator:null===(A=g.error)||void 0===A?void 0:A.operator},connectorVal:g.value,connectorType:g.dataType,defaultConnector:g.operator,onOperatorChange:e=>{null==m||m(e,g)},onValueChange:e=>null==y?void 0:y(e,g)})]}),(null==g?void 0:g.name)&&(null===(C=i[g.dataType])||void 0===C?void 0:C[g.operator])&&e(l,{onSearch:e=>null==h?void 0:h(e,g),isLoading:z,disabled:"view"===b,extra:w,errors:{val:null===(T=g.error)||void 0===T?void 0:T.value,operator:null===(S=g.error)||void 0===S?void 0:S.operator},connectorVal:g.value,connectorType:g.dataType,defaultConnector:g.operator,onOperatorChange:e=>null==m?void 0:m(e,g),onValueChange:e=>null==y?void 0:y(e,g)})]})};export{u as PropertyNode,v as PropertyNodeHeadless};
1
+ import{jsx as e,jsxs as r,Fragment as o}from"react/jsx-runtime";import{useState as n,useEffect as a}from"react";import{isNewLineConnectorPosition as i}from"../../../constants/connectorPosition.js";import{ApiResponseHelper as t}from"../../../helpers/ApiResponse.helper.js";import l from"../../Connectors/Connector.js";import d from"../../DropdownWrapper.js";import{Container as s}from"./PropertyNode.styled.js";import p from"./PropertyNodeUIWrapper.js";const c=new t,u=r=>e(p,Object.assign({isLast:r.isLast,mode:r.mode},{children:e("div",Object.assign({style:{padding:12,maxWidth:"calc(100% - 78px)"}},{children:e(v,Object.assign({},r))}))})),v=t=>{let{propertySelectorText:p,fetchPropertyData:u,onPropertyNameSelect:v,onPropertyOperatorChange:m,onPropertyValueChange:y,property:g,mode:b}=t;var j,f,h,O,A,C,T;const[x,w]=n([]),[P,L]=n({}),[S,V]=n(!0),[D,z]=n("create"===b),N=Array.isArray(x)?x.map((e=>Object.assign(Object.assign({},e),{label:e.name,value:e.id,description:e.description,selected:(null==g?void 0:g.name)===e.id}))):c.convertToGroupOptions(x,(null==g?void 0:g.name)?[g.name.toString()]:void 0);function W(e){if(!Array.isArray(e)){z(!0);let r=null;Array.isArray(x)?r=x.find((r=>{let{id:o}=r;return o===e.value})):Object.keys(x).forEach((o=>{const n=x[o].find((r=>{let{id:o}=r;return o===e.value}));n&&(r=n)})),L({}),r?null==v||v(r,g).then((e=>{const r=e;r.normalized&&r.originalData?L((e=>Object.assign(Object.assign({},e),{options:Array.isArray(r.normalized)?[...r.normalized]:Object.assign({},r.normalized),originalData:r.originalData}))):L((r=>Object.assign(Object.assign({},r),{options:Array.isArray(e)?[...e]:Object.assign({},e)}))),z(!1)})):z(!1)}}return a((()=>{u?u().then((e=>{e&&(Array.isArray(e)?w([...e]):w(Object.assign({},e))),V(!1),z(!1)})):(V(!1),z(!1))}),[]),a((()=>{if("create"!==b&&x&&(null==g?void 0:g.name)){const e=g,r=Array.isArray(x)?x.find((e=>e.id===(null==g?void 0:g.name))):c.findInGroupedApiResponse(x,null==g?void 0:g.name);r&&W({value:r.id,label:r.name}),null==y||y(null==e?void 0:e.value,g)}}),[x]),a((()=>{"iceBreaker"===(null==g?void 0:g.dataType)&&L((e=>Object.assign(Object.assign({},e),{freeForm:!1})))}),[null==g?void 0:g.dataType]),r(o,{children:[r(s,{children:[e(d,{isSearchable:!0,disabled:"view"===b,width:"200px",isLoading:S,dropdownLabel:null!=p?p:"Select property",options:N,onSelect:W,selectedValues:(null==g?void 0:g.name)?[g.name]:void 0,error:null===(j=null==g?void 0:g.error)||void 0===j?void 0:j.name}),(null==g?void 0:g.name)&&!(null===(f=i[g.dataType])||void 0===f?void 0:f[g.operator])&&e(l,{isLoading:D,disabled:"view"===b,extra:P,errors:{val:null===(h=g.error)||void 0===h?void 0:h.value,operator:null===(O=g.error)||void 0===O?void 0:O.operator},connectorVal:g.value,connectorType:g.dataType,defaultConnector:g.operator,onOperatorChange:e=>{null==m||m(e,g)},onValueChange:e=>null==y?void 0:y(e,g)})]}),(null==g?void 0:g.name)&&(null===(A=i[g.dataType])||void 0===A?void 0:A[g.operator])&&e(l,{isLoading:D,disabled:"view"===b,extra:P,errors:{val:null===(C=g.error)||void 0===C?void 0:C.value,operator:null===(T=g.error)||void 0===T?void 0:T.operator},connectorVal:g.value,connectorType:g.dataType,defaultConnector:g.operator,onOperatorChange:e=>null==m?void 0:m(e,g),onValueChange:e=>null==y?void 0:y(e,g)})]})};export{u as PropertyNode,v as PropertyNodeHeadless};
@@ -0,0 +1,2 @@
1
+ import { GroupedOption } from "../../dropdown/type";
2
+ export declare const DATE_OPERATORS_OPTIONS: GroupedOption[];
@@ -0,0 +1 @@
1
+ const e=[{label:"Commonly used",options:[{selected:!1,value:"today",label:"Today"},{selected:!1,value:"yesterday",label:"Yesterday"},{selected:!1,value:"last 7 days",label:"Last 7 days"},{selected:!1,value:"last 30 days",label:"Last 30 days"},{selected:!1,value:"this week",label:"This week"},{selected:!1,value:"last week",label:"Last week"},{selected:!1,value:"this month",label:"This month"},{selected:!0,value:"last month",label:"Last month"}]},{label:"Relative",options:[{selected:!1,value:"exactly",label:"Exactly"},{selected:!1,value:"not exactly",label:"Not exactly"},{selected:!1,value:"in the last",label:"In the last"},{selected:!1,value:"not in the last",label:"Not in the last"},{selected:!1,value:"in between last",label:"In between last"},{selected:!1,value:"not in between last",label:"Not in between last"}]},{label:"Absolute",options:[{selected:!1,value:"on",label:"On"},{selected:!1,value:"notOn",label:"Not On"},{selected:!1,value:"inBetween",label:"In Between"},{selected:!1,value:"notInBetween",label:"Not In Between"},{selected:!1,value:"before",label:"Before"},{selected:!1,value:"after",label:"After"}]}];export{e as DATE_OPERATORS_OPTIONS};
@@ -20,7 +20,8 @@ export declare enum CONNECTOR_VALUE_COMPONENT_TYPES {
20
20
  ReelIgPicker = "ReelIgPicker",
21
21
  StoryIgPicker = "StoryIgPicker",
22
22
  EmojiPicker = "EmojiPicker",
23
- InTheLast = "InTheLast"
23
+ InTheLast = "InTheLast",
24
+ InTwoLast = "InTwoLast"
24
25
  }
25
26
  export declare const INTEGER_OPERATORS_COMPONENT: {
26
27
  is: CONNECTOR_VALUE_COMPONENT_TYPES;
@@ -59,18 +60,27 @@ export declare const REACTION_OPERATORS_COMPONENT: {
59
60
  contains: CONNECTOR_VALUE_COMPONENT_TYPES;
60
61
  };
61
62
  export declare const DATE_OPERATORS_COMPONENT: {
63
+ [x: number]: CONNECTOR_VALUE_COMPONENT_TYPES;
64
+ today: CONNECTOR_VALUE_COMPONENT_TYPES;
65
+ yesterday: CONNECTOR_VALUE_COMPONENT_TYPES;
66
+ "last 30 days": CONNECTOR_VALUE_COMPONENT_TYPES;
67
+ "last 7 days": CONNECTOR_VALUE_COMPONENT_TYPES;
68
+ "this month": CONNECTOR_VALUE_COMPONENT_TYPES;
69
+ "this week": CONNECTOR_VALUE_COMPONENT_TYPES;
70
+ "last month": CONNECTOR_VALUE_COMPONENT_TYPES;
71
+ "last week": CONNECTOR_VALUE_COMPONENT_TYPES;
72
+ exactly: CONNECTOR_VALUE_COMPONENT_TYPES;
73
+ "not exactly": CONNECTOR_VALUE_COMPONENT_TYPES;
74
+ "in the last": CONNECTOR_VALUE_COMPONENT_TYPES;
75
+ "not in the last": CONNECTOR_VALUE_COMPONENT_TYPES;
76
+ "in between last": CONNECTOR_VALUE_COMPONENT_TYPES;
77
+ "not in between last": CONNECTOR_VALUE_COMPONENT_TYPES;
62
78
  on: CONNECTOR_VALUE_COMPONENT_TYPES;
63
79
  notOn: CONNECTOR_VALUE_COMPONENT_TYPES;
64
80
  inBetween: CONNECTOR_VALUE_COMPONENT_TYPES;
65
81
  notInBetween: CONNECTOR_VALUE_COMPONENT_TYPES;
66
82
  before: CONNECTOR_VALUE_COMPONENT_TYPES;
67
83
  after: CONNECTOR_VALUE_COMPONENT_TYPES;
68
- today: CONNECTOR_VALUE_COMPONENT_TYPES;
69
- yesterday: CONNECTOR_VALUE_COMPONENT_TYPES;
70
- "last week": CONNECTOR_VALUE_COMPONENT_TYPES;
71
- "last month": CONNECTOR_VALUE_COMPONENT_TYPES;
72
- "last quarter": CONNECTOR_VALUE_COMPONENT_TYPES;
73
- "in the last": CONNECTOR_VALUE_COMPONENT_TYPES;
74
84
  };
75
85
  export declare const SPECIFIC_IG_POST_OPERATORS_COMPONENT: {
76
86
  in: CONNECTOR_VALUE_COMPONENT_TYPES;
@@ -1 +1 @@
1
- import{QueryBuilderConnectorType as e}from"../types/QueryBuilder.type.js";import{BOOLEAN_OPERATORS as t,STRING_OPERATORS as n,INTEGER_OPERATORS as i,FREQUENCY_OPERATORS as r,DATE_OPERATORS as o,SPECIFIC_IG_OPERATORS as s,ANY_IG_OPERATORS as a,REACTION_OPERATORS as l,IG_STRING_OPERATORS as g,ANY_AD_OPERATORS as c,AD_STRING_OPERATORS as u,ICE_BREAKER_OPERATORS as p}from"../types/QueryBuilderOperator.type.js";const I={[e.boolean]:t,[e.string]:n,[e.integer]:i,[e.frequency]:r,[e.date]:o,[e.specificPost]:s,[e.specificReel]:s,[e.specificStory]:s,[e.anyIg]:a,[e.reaction]:l,[e.activityString]:g,[e.anyAd]:c,[e.specificAd]:u,[e.iceBreaker]:p};var T;!function(e){e.FreeText="FreeText",e.NoInput="NoInput",e.IntegerSingleValue="IntegerSingleValue",e.StringSingleValue="StringSingleValue",e.TwoNumberInputsSeperatedByAnd="TwoNumberInputsSeperatedByAnd",e.MultiselectDropdownFreeText="MultiselectDropdownFreeText",e.SingleselectDropdownFreeText="SingleselectDropdownFreeText",e.SingleDate="SingleDate",e.TwoDate="TwoDate",e.IntegerPositiveSingle="IntegerPositiveSingle",e.NumberTime="NumberTime",e.PostIgPicker="PostIgPicker",e.ReelIgPicker="ReelIgPicker",e.StoryIgPicker="StoryIgPicker",e.EmojiPicker="EmojiPicker",e.InTheLast="InTheLast"}(T||(T={}));const S={[i.is]:T.FreeText,[i.isNot]:T.FreeText,[i.exists]:T.NoInput,[i.doesntExist]:T.NoInput,[i.lessThan]:T.IntegerSingleValue,[i.lessThanOrEqualTo]:T.IntegerSingleValue,[i.greaterThan]:T.IntegerSingleValue,[i.greaterThanOrEqualTo]:T.IntegerSingleValue},d={[n.is]:T.MultiselectDropdownFreeText,[n.isNot]:T.MultiselectDropdownFreeText,[n.contains]:T.FreeText,[n.doesntContain]:T.FreeText,[n.startsWith]:T.FreeText,[n.endsWith]:T.FreeText,[n.exists]:T.NoInput,[n.doesntExist]:T.NoInput},x={[g.any]:T.NoInput,[g.is]:T.MultiselectDropdownFreeText,[g.contains]:T.FreeText,[g.startsWith]:T.FreeText,[g.endsWith]:T.FreeText},y={[u.is]:T.SingleselectDropdownFreeText},N={[p.is]:T.MultiselectDropdownFreeText},P={[l.contains]:T.EmojiPicker},F={[o.on]:T.SingleDate,[o.notOn]:T.SingleDate,[o.inBetween]:T.TwoDate,[o.notInBetween]:T.TwoDate,[o.before]:T.SingleDate,[o.after]:T.SingleDate,[o.today]:T.NoInput,[o.yesterday]:T.NoInput,[o["last week"]]:T.NoInput,[o["last month"]]:T.NoInput,[o["last quarter"]]:T.NoInput,[o["in the last"]]:T.InTheLast},D={[s.in]:T.PostIgPicker},w={[s.in]:T.ReelIgPicker},f={[s.in]:T.StoryIgPicker},k={[a.in]:T.NoInput},m={[c.in]:T.NoInput},h={[t.isTrue]:T.NoInput,[t.isFalse]:T.NoInput,[t.exists]:T.NoInput,[t.doesntExist]:T.NoInput},v={[r.exactly]:T.IntegerPositiveSingle,[r.atleast]:T.IntegerPositiveSingle,[r.atMost]:T.IntegerPositiveSingle},B={[e.boolean]:h,[e.string]:d,[e.integer]:S,[e.frequency]:v,[e.date]:F,[e.specificPost]:D,[e.specificReel]:w,[e.specificStory]:f,[e.anyIg]:k,[e.reaction]:P,[e.activityString]:x,[e.anyAd]:m,[e.specificAd]:y,[e.iceBreaker]:N};export{y as AD_STRING_OPERATORS_COMPONENT,m as ANY_AD_OPERATORS_COMPONENT,k as ANY_IG_OPERATORS_COMPONENT,h as BOOLEAN_OPERATORS_COMPONENT,B as CONNECTOR_TYPE_TO_COMPONENT_MAP,I as CONNECTOR_TYPE_TO_OPERATORS,T as CONNECTOR_VALUE_COMPONENT_TYPES,F as DATE_OPERATORS_COMPONENT,v as FREQUENCY_OPERATORS_COMPONENT,N as ICE_BREAKER_OPERATORS_COMPONENT,x as IG_STRING_OPERATORS_COMPONENT,S as INTEGER_OPERATORS_COMPONENT,P as REACTION_OPERATORS_COMPONENT,D as SPECIFIC_IG_POST_OPERATORS_COMPONENT,w as SPECIFIC_IG_REEL_OPERATORS_COMPONENT,f as SPECIFIC_IG_STORY_OPERATORS_COMPONENT,d as STRING_OPERATORS_COMPONENT};
1
+ import{QueryBuilderConnectorType as e}from"../types/QueryBuilder.type.js";import{BOOLEAN_OPERATORS as t,STRING_OPERATORS as n,INTEGER_OPERATORS as i,FREQUENCY_OPERATORS as o,DATE_OPERATORS as r,SPECIFIC_IG_OPERATORS as s,ANY_IG_OPERATORS as a,REACTION_OPERATORS as l,IG_STRING_OPERATORS as I,ANY_AD_OPERATORS as u,AD_STRING_OPERATORS as p,ICE_BREAKER_OPERATORS as c}from"../types/QueryBuilderOperator.type.js";const g={[e.boolean]:t,[e.string]:n,[e.integer]:i,[e.frequency]:o,[e.date]:r,[e.specificPost]:s,[e.specificReel]:s,[e.specificStory]:s,[e.anyIg]:a,[e.reaction]:l,[e.activityString]:I,[e.anyAd]:u,[e.specificAd]:p,[e.iceBreaker]:c};var T;!function(e){e.FreeText="FreeText",e.NoInput="NoInput",e.IntegerSingleValue="IntegerSingleValue",e.StringSingleValue="StringSingleValue",e.TwoNumberInputsSeperatedByAnd="TwoNumberInputsSeperatedByAnd",e.MultiselectDropdownFreeText="MultiselectDropdownFreeText",e.SingleselectDropdownFreeText="SingleselectDropdownFreeText",e.SingleDate="SingleDate",e.TwoDate="TwoDate",e.IntegerPositiveSingle="IntegerPositiveSingle",e.NumberTime="NumberTime",e.PostIgPicker="PostIgPicker",e.ReelIgPicker="ReelIgPicker",e.StoryIgPicker="StoryIgPicker",e.EmojiPicker="EmojiPicker",e.InTheLast="InTheLast",e.InTwoLast="InTwoLast"}(T||(T={}));const d={[i.is]:T.FreeText,[i.isNot]:T.FreeText,[i.exists]:T.NoInput,[i.doesntExist]:T.NoInput,[i.lessThan]:T.IntegerSingleValue,[i.lessThanOrEqualTo]:T.IntegerSingleValue,[i.greaterThan]:T.IntegerSingleValue,[i.greaterThanOrEqualTo]:T.IntegerSingleValue},y={[n.is]:T.MultiselectDropdownFreeText,[n.isNot]:T.MultiselectDropdownFreeText,[n.contains]:T.FreeText,[n.doesntContain]:T.FreeText,[n.startsWith]:T.FreeText,[n.endsWith]:T.FreeText,[n.exists]:T.NoInput,[n.doesntExist]:T.NoInput},S={[I.any]:T.NoInput,[I.is]:T.MultiselectDropdownFreeText,[I.contains]:T.FreeText,[I.startsWith]:T.FreeText,[I.endsWith]:T.FreeText},N={[p.is]:T.SingleselectDropdownFreeText},x={[c.is]:T.MultiselectDropdownFreeText},w={[l.contains]:T.EmojiPicker},h={[r.today]:T.NoInput,[r.yesterday]:T.NoInput,[r["last 30 days"]]:T.NoInput,[r["last 7 days"]]:T.NoInput,[r["this month"]]:T.NoInput,[r["this week"]]:T.NoInput,[r["last month"]]:T.NoInput,[r["last week"]]:T.NoInput,[r.exactly]:T.InTheLast,[r["not exactly"]]:T.InTheLast,[r["in the last"]]:T.InTheLast,[r["not in the last"]]:T.InTheLast,[r["in between last"]]:T.InTwoLast,[r["not in between last"]]:T.InTwoLast,[r.on]:T.SingleDate,[r.notOn]:T.SingleDate,[r.inBetween]:T.TwoDate,[r.notInBetween]:T.TwoDate,[r.before]:T.SingleDate,[r.after]:T.SingleDate,[r.today]:T.NoInput,[r.yesterday]:T.NoInput,[r["last week"]]:T.NoInput,[r["last month"]]:T.NoInput,[r["last quarter"]]:T.NoInput,[r["in the last"]]:T.InTheLast},P={[s.in]:T.PostIgPicker},F={[s.in]:T.ReelIgPicker},D={[s.in]:T.StoryIgPicker},k={[a.in]:T.NoInput},m={[u.in]:T.NoInput},f={[t.isTrue]:T.NoInput,[t.isFalse]:T.NoInput,[t.exists]:T.NoInput,[t.doesntExist]:T.NoInput},L={[o.exactly]:T.IntegerPositiveSingle,[o.atleast]:T.IntegerPositiveSingle,[o.atMost]:T.IntegerPositiveSingle},b={[e.boolean]:f,[e.string]:y,[e.integer]:d,[e.frequency]:L,[e.date]:h,[e.specificPost]:P,[e.specificReel]:F,[e.specificStory]:D,[e.anyIg]:k,[e.reaction]:w,[e.activityString]:S,[e.anyAd]:m,[e.specificAd]:N,[e.iceBreaker]:x};export{N as AD_STRING_OPERATORS_COMPONENT,m as ANY_AD_OPERATORS_COMPONENT,k as ANY_IG_OPERATORS_COMPONENT,f as BOOLEAN_OPERATORS_COMPONENT,b as CONNECTOR_TYPE_TO_COMPONENT_MAP,g as CONNECTOR_TYPE_TO_OPERATORS,T as CONNECTOR_VALUE_COMPONENT_TYPES,h as DATE_OPERATORS_COMPONENT,L as FREQUENCY_OPERATORS_COMPONENT,x as ICE_BREAKER_OPERATORS_COMPONENT,S as IG_STRING_OPERATORS_COMPONENT,d as INTEGER_OPERATORS_COMPONENT,w as REACTION_OPERATORS_COMPONENT,P as SPECIFIC_IG_POST_OPERATORS_COMPONENT,F as SPECIFIC_IG_REEL_OPERATORS_COMPONENT,D as SPECIFIC_IG_STORY_OPERATORS_COMPONENT,y as STRING_OPERATORS_COMPONENT};
@@ -1,6 +1,8 @@
1
+ import { DropdownOption } from "../../dropdown/type";
1
2
  import { QueryBuilderConnectorType } from '../types/QueryBuilder.type';
2
3
  import { CONNECTOR_OPERATORS } from '../types/QueryBuilderOperator.type';
3
4
  export declare class ConnectorHelper {
4
5
  static getConnectorType(datatype: QueryBuilderConnectorType): string[];
5
6
  static getConnectorComponent(dataType: QueryBuilderConnectorType, connectorType: CONNECTOR_OPERATORS): "FreeText" | "NoInput" | "IntegerSingleValue" | "StringSingleValue" | "TwoNumberInputsSeperatedByAnd" | "MultiselectDropdownFreeText" | "SingleselectDropdownFreeText" | "SingleDate" | "TwoDate" | "IntegerPositiveSingle" | "NumberTime" | null;
7
+ static getDropdownOptionFromDataType(datatype: QueryBuilderConnectorType, defaultConnector: CONNECTOR_OPERATORS | undefined): DropdownOption[];
6
8
  }
@@ -1 +1 @@
1
- import{CONNECTOR_TYPE_TO_OPERATORS as t,CONNECTOR_TYPE_TO_COMPONENT_MAP as n}from"../constants/connector.js";class e{static getConnectorType(n){const e=t[n];return e?Object.keys(e):[]}static getConnectorComponent(e,o){if(t[e]){return n[e][o]}return null}}export{e as ConnectorHelper};
1
+ import{unCamelCaseWithFirstUppercase as t}from"../../../utils/unCamelCase.js";import{CONNECTOR_TYPE_TO_OPERATORS as e,CONNECTOR_TYPE_TO_COMPONENT_MAP as s}from"../constants/connector.js";import{DATE_OPERATORS_OPTIONS as o}from"../constants/DATE_OPERATORS_OPTIONS.js";import{QueryBuilderConnectorType as n}from"../types/QueryBuilder.type.js";class r{static getConnectorType(t){const s=e[t];return s?Object.keys(s):[]}static getConnectorComponent(t,o){if(e[t]){return s[t][o]}return null}static getDropdownOptionFromDataType(e,s){const r=this.getConnectorType(e);return e===n.date?o.map((t=>Object.assign(Object.assign({},t),{options:t.options.map((t=>Object.assign(Object.assign({},t),{selected:t.value===s})))}))):r.map((e=>({selected:e===s,value:e,label:t(e)})))}}export{r as ConnectorHelper};
@@ -19,7 +19,6 @@ export type ConnectorComponentProps = {
19
19
  nativeID?: string;
20
20
  isLoading?: boolean;
21
21
  disabled?: boolean;
22
- onSearch?: (searchKey: string) => Promise<DropdownOption[]>;
23
22
  };
24
23
  export type ConnectorProps = {
25
24
  isLoading?: boolean;
@@ -39,9 +38,8 @@ export type ConnectorProps = {
39
38
  };
40
39
  testID?: string;
41
40
  disabled?: boolean;
42
- onSearch?: (searchKey: string) => Promise<DropdownOption[]>;
43
41
  };
44
- export type CONNECTOR_VALUE_TYPE = string[] | number | Date[] | Date | number[] | number | undefined | /** for multiselect */ QueryBuilderAPIData[] | IG_VALUE[];
42
+ export type CONNECTOR_VALUE_TYPE = object | string[] | number | Date[] | Date | number[] | number | undefined | /** for multiselect */ QueryBuilderAPIData[] | IG_VALUE[];
45
43
  type IG_VALUE = {
46
44
  imageUrl: string;
47
45
  redirectionUrl: string;
@@ -48,18 +48,26 @@ export declare enum REACTION_OPERATORS {
48
48
  contains = "contains"
49
49
  }
50
50
  export declare enum DATE_OPERATORS {
51
+ today = "today",
52
+ yesterday = "yesterday",
53
+ 'last 7 days' = "last 7 days",
54
+ 'last 30 days' = "last 30 days",
55
+ 'this week' = "this week",
56
+ 'last week' = "last week",
57
+ 'this month' = "this month",
58
+ 'last month' = "last month",
59
+ 'exactly' = "exactly",
60
+ 'not exactly' = "not exactly",
61
+ 'in the last' = "in the last",
62
+ 'not in the last' = "not in the last",
63
+ 'in between last' = "in between last",
64
+ 'not in between last' = "not in between last",
51
65
  on = "on",
52
66
  notOn = "notOn",
53
67
  inBetween = "inBetween",
54
68
  notInBetween = "notInBetween",
55
69
  before = "before",
56
- after = "after",
57
- today = "today",
58
- yesterday = "yesterday",
59
- 'last week' = "last week",
60
- 'last month' = "last month",
61
- 'last quarter' = "last quarter",
62
- 'in the last' = "in the last"
70
+ after = "after"
63
71
  }
64
72
  export declare enum BOOLEAN_OPERATORS {
65
73
  isTrue = "isTrue",
@@ -1 +1 @@
1
- var e,t,n,s,i,o,a,r,l,u,T,c,d;!function(e){e.is="is",e.isNot="isNot",e.exists="exists",e.doesntExist="doesntExist",e.lessThan="lessThan",e.lessThanOrEqualTo="lessThanOrEqualTo",e.greaterThan="greaterThan",e.greaterThanOrEqualTo="greaterThanOrEqualTo"}(e||(e={})),function(e){e.is="is",e.isNot="isNot",e.contains="contains",e.doesntContain="doesntContain",e.startsWith="startsWith",e.endsWith="endsWith",e.exists="exists",e.doesntExist="doesntExist"}(t||(t={})),function(e){e.any="any",e.is="is",e.contains="contains",e.startsWith="startsWith",e.endsWith="endsWith"}(n||(n={})),function(e){e.is="is"}(s||(s={})),function(e){e.in="in"}(i||(i={})),function(e){e.is="is"}(o||(o={})),function(e){e.in="in"}(a||(a={})),function(e){e.in="in"}(r||(r={})),function(e){e.contains="contains"}(l||(l={})),function(e){e.on="on",e.notOn="notOn",e.inBetween="inBetween",e.notInBetween="notInBetween",e.before="before",e.after="after",e.today="today",e.yesterday="yesterday",e["last week"]="last week",e["last month"]="last month",e["last quarter"]="last quarter",e["in the last"]="in the last"}(u||(u={})),function(e){e.isTrue="isTrue",e.isFalse="isFalse",e.exists="exists",e.doesntExist="doesntExist"}(T||(T={})),function(e){e.exactly="exactly",e.atleast="atleast",e.atMost="atMost"}(c||(c={})),function(e){e.FreeText="FreeText",e.NoInput="NoInput",e.IntegerSingleValue="IntegerSingleValue",e.StringSingleValue="StringSingleValue",e.TwoNumberInputsSeperatedByAnd="TwoNumberInputsSeperatedByAnd",e.MultiselectDropdownFreeText="MultiselectDropdownFreeText",e.SingleselectDropdownFreeText="SingleselectDropdownFreeText",e.SingleDate="SingleDate",e.TwoDate="TwoDate",e.IntegerPositiveSingle="IntegerPositiveSingle",e.NumberTime="NumberTime"}(d||(d={}));export{s as AD_STRING_OPERATORS,r as ANY_AD_OPERATORS,a as ANY_IG_OPERATORS,T as BOOLEAN_OPERATORS,u as DATE_OPERATORS,d as EVENT_VALUES,c as FREQUENCY_OPERATORS,o as ICE_BREAKER_OPERATORS,n as IG_STRING_OPERATORS,e as INTEGER_OPERATORS,l as REACTION_OPERATORS,i as SPECIFIC_IG_OPERATORS,t as STRING_OPERATORS};
1
+ var t,e,n,s,i,a,o,l,r,u,c,d,h;!function(t){t.is="is",t.isNot="isNot",t.exists="exists",t.doesntExist="doesntExist",t.lessThan="lessThan",t.lessThanOrEqualTo="lessThanOrEqualTo",t.greaterThan="greaterThan",t.greaterThanOrEqualTo="greaterThanOrEqualTo"}(t||(t={})),function(t){t.is="is",t.isNot="isNot",t.contains="contains",t.doesntContain="doesntContain",t.startsWith="startsWith",t.endsWith="endsWith",t.exists="exists",t.doesntExist="doesntExist"}(e||(e={})),function(t){t.any="any",t.is="is",t.contains="contains",t.startsWith="startsWith",t.endsWith="endsWith"}(n||(n={})),function(t){t.is="is"}(s||(s={})),function(t){t.in="in"}(i||(i={})),function(t){t.is="is"}(a||(a={})),function(t){t.in="in"}(o||(o={})),function(t){t.in="in"}(l||(l={})),function(t){t.contains="contains"}(r||(r={})),function(t){t.today="today",t.yesterday="yesterday",t["last 7 days"]="last 7 days",t["last 30 days"]="last 30 days",t["this week"]="this week",t["last week"]="last week",t["this month"]="this month",t["last month"]="last month",t.exactly="exactly",t["not exactly"]="not exactly",t["in the last"]="in the last",t["not in the last"]="not in the last",t["in between last"]="in between last",t["not in between last"]="not in between last",t.on="on",t.notOn="notOn",t.inBetween="inBetween",t.notInBetween="notInBetween",t.before="before",t.after="after"}(u||(u={})),function(t){t.isTrue="isTrue",t.isFalse="isFalse",t.exists="exists",t.doesntExist="doesntExist"}(c||(c={})),function(t){t.exactly="exactly",t.atleast="atleast",t.atMost="atMost"}(d||(d={})),function(t){t.FreeText="FreeText",t.NoInput="NoInput",t.IntegerSingleValue="IntegerSingleValue",t.StringSingleValue="StringSingleValue",t.TwoNumberInputsSeperatedByAnd="TwoNumberInputsSeperatedByAnd",t.MultiselectDropdownFreeText="MultiselectDropdownFreeText",t.SingleselectDropdownFreeText="SingleselectDropdownFreeText",t.SingleDate="SingleDate",t.TwoDate="TwoDate",t.IntegerPositiveSingle="IntegerPositiveSingle",t.NumberTime="NumberTime"}(h||(h={}));export{s as AD_STRING_OPERATORS,l as ANY_AD_OPERATORS,o as ANY_IG_OPERATORS,c as BOOLEAN_OPERATORS,u as DATE_OPERATORS,h as EVENT_VALUES,d as FREQUENCY_OPERATORS,a as ICE_BREAKER_OPERATORS,n as IG_STRING_OPERATORS,t as INTEGER_OPERATORS,r as REACTION_OPERATORS,i as SPECIFIC_IG_OPERATORS,e as STRING_OPERATORS};
@@ -16,5 +16,4 @@ export type QueryBuilderPropertyProps = {
16
16
  }>;
17
17
  onPropertyOperatorChange?: (option: CONNECTOR_OPERATORS, property: QueryBuilderProperty) => void;
18
18
  onPropertyValueChange?: (value: CONNECTOR_VALUE_TYPE | /** for multiselect */ QueryBuilderAPIData[], property: QueryBuilderProperty) => void;
19
- onPropertyValueSearch(searchKey: string, property: QueryBuilderProperty): Promise<DropdownOption[]>;
20
19
  };
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useRef as n,useEffect as r}from"react";import{ZeroState as i}from"../../../zeroState/ZeroState.js";import{useOutside as s}from"../../../../hooks/useOutside.js";import{useDropdown as l}from"../../hooks/useDropdown.js";import{Description as c}from"./description/Description.js";import{FreeFormMenu as a}from"./menu/FreeFormMenu.js";import{MenuList as p}from"./menu/MenuList.js";import{SelectAllMenu as u}from"./menu/SelectAllMenu.js";import d from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as h,MenuListContainer as m}from"./OpennedDropdown.styled.js";import{SearchBox as f}from"./searchbox/SearchBox.js";import{SearchZeroState as g}from"./searchbox/SearchZeroState.js";const S=304,b=290,j=j=>{let{options:v,isSearchable:w,isMultiSelect:y,width:O,allowFreeForm:x,height:C,onClose:M,onSelect:D,onSearch:L,version:F,skipSorting:k}=j;const{dropdownOptions:A,search:H,searchedString:B,searchedOptions:Z,onApplyHandler:q,selectAllHandler:z,onMultiSelectClear:E,onFreeFormSelect:I,onMultiSelectApply:K,latestDropdownOptionsRef:N}=l(F,v,D,k,y,L),[P,R]=o(null!=O?O:b),[T,W]=o(null),G=n(null);s(G,(()=>{if(W(null),y&&"2.0"===F){const e=(e=>{const t=[];return e.forEach((e=>{if(e.options){const o=e.options.filter((e=>!0===e.selected));t.push(Object.assign(Object.assign({},e),{options:[...o]}))}else e.selected&&t.push(Object.assign({},e))})),t})(N.current);null==M||M(e)}else null==M||M(A)}));const J=null!=C?C:S,Q="number"==typeof J?w&&y?J-96:w&&!y||!w&&y?J-48:J:J;r((()=>{const e=null!=O?O:b;if(null===T)R(e);else if("number"==typeof e)R(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));R(t)}}),[T]);const U=[],V=(B&&L?Z:A).map((e=>{var t,o;if(B&&!L){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(B.toLowerCase()))&&(U.push(!B||e.label===B),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(B.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(B.toLowerCase()))?(U.push(!B||e.label===B),e):null}return e})).filter((e=>null!==e)),X=!!w&&B&&0===V.length;return e(h,Object.assign({version:F,ref:G,style:{width:P}},{children:[e("div",Object.assign({style:{width:T?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!w&&t(f,{onSearch:H,version:F}),V.length||B?e(m,Object.assign({minHeight:J,maxHeight:Q},{children:[!!y&&!X&&t(u,{version:F,options:B&&L?Z:A,onSelect:z}),!x&&X&&t(g,{height:Q,searchedString:B}),x&&(X||!!U.length&&U.every((e=>!1===e)))&&t(a,{version:F,isMultiSelect:y,onSelect:I,searchedString:B}),t(p,{version:F,onSelect:q,showDescription:function(e,t){W(e&&t?{title:e,description:t}:null)},isMultiSelect:y,options:V})]})):t("div",Object.assign({style:{height:J,display:"flex"}},{children:t(i,{title:"No results found",subTitle:"Please try again later or contact us at support@bik.ai if you require further assistance."})})),!!y&&!(!V.length&&!B)&&"2.0"!==F&&t(d,{onClear:E,onApply:K,list:B&&L?Z:A})]})),!!T&&t(c,{title:T.title,description:T.description,version:F})]}))};export{j as OpenedDropdown};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useEffect as s,useRef as l}from"react";import{ZeroState as n}from"../../../zeroState/ZeroState.js";import{useOutside as i}from"../../../../hooks/useOutside.js";import{iterateOnOptions as r}from"../utils/iterationOnOptions.js";import{Description as c}from"./description/Description.js";import{FreeFormMenu as u}from"./menu/FreeFormMenu.js";import{MenuList as a}from"./menu/MenuList.js";import{SelectAllMenu as d}from"./menu/SelectAllMenu.js";import p from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as f,MenuListContainer as m}from"./OpennedDropdown.styled.js";import{SearchBox as h}from"./searchbox/SearchBox.js";import{SearchZeroState as b}from"./searchbox/SearchZeroState.js";const v=304,g=290,j=j=>{let{options:S,isSearchable:w,isMultiSelect:y,width:O,allowFreeForm:x,height:C,onClose:L,onSelect:F,version:M,skipSorting:D}=j;const[k,A]=o(null!=S?S:[]);s((()=>{if(S){const e=[...S];A(y&&!D?[...e.sort((e=>e.selected?-1:1))]:[...e])}}),[S]);const[B,H]=o(null!=O?O:g),[Z,q]=o(""),[z,E]=o(null),I=l(null),K=l(k),N=e=>{const t=[];return e.forEach((e=>{if(e.options){const o=e.options.filter((e=>!0===e.selected));t.push(Object.assign(Object.assign({},e),{options:[...o]}))}else e.selected&&t.push(Object.assign({},e))})),t};s((()=>{K.current=k}),[k]),i(I,(()=>{if(E(null),y&&"2.0"===M){const e=N(K.current);null==L||L(e)}else null==L||L(k)}));const P=null!=C?C:v,T="number"==typeof P?w&&y?P-96:w&&!y||!w&&y?P-48:P:P;function W(e){if(y){const t=r(k,{selected:e.selected},(t=>t.value===e.value));A([...t]),"2.0"===M&&G(t)}else null==F||F(e)}function G(e){const t=N(null!=e?e:K.current);null==F||F([...t])}s((()=>{const e=null!=O?O:g;if(null===z)H(e);else if("number"==typeof e)H(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));H(t)}}),[z]);const J=[],Q=k.map((e=>{var t,o;if(Z){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(Z.toLowerCase()))&&(J.push(!Z||e.label===Z),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(Z.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(Z.toLowerCase()))?(J.push(!Z||e.label===Z),e):null}return e})).filter((e=>null!==e)),R=!!w&&Z&&0===Q.length;return e(f,Object.assign({version:M,ref:I,style:{width:B}},{children:[e("div",Object.assign({style:{width:z?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!w&&t(h,{onSearch:function(e){q(e)},version:M}),Q.length||Z?e(m,Object.assign({minHeight:P,maxHeight:T},{children:[!!y&&!R&&t(d,{version:M,options:k,onSelect:function(e){if("selectAll"===e){const e=r(k,{selected:!0},(e=>{var t;return Z?(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(Z.toLowerCase()))&&!e.disabled:!e.disabled}));A([...e]),"2.0"===M&&G(e)}else if("notSelected"===e){const e=r(k,{selected:!1},(e=>!e.disabled));A([...e]),"2.0"===M&&G(e)}}}),!x&&R&&t(b,{height:T,searchedString:Z}),x&&(R||!!J.length&&J.every((e=>!1===e)))&&t(u,{version:M,isMultiSelect:y,onSelect:function(e){if(!y)return void W({label:Z,value:Z,isFreeForm:!0,selected:!0});const t=k.map((t=>t.options?t:Object.assign(Object.assign({},t),{selected:t.label===Z&&t.value===Z?e:t.selected})));e&&(t.some((e=>e.label===Z&&e.value===Z))||t.unshift({label:Z,value:Z,isFreeForm:!0,selected:!0})),A([...t]),"2.0"===M&&G(t)},searchedString:Z}),t(a,{version:M,onSelect:W,showDescription:function(e,t){E(e&&t?{title:e,description:t}:null)},isMultiSelect:y,options:Q})]})):t("div",Object.assign({style:{height:P,display:"flex"}},{children:t(n,{title:"No results found",subTitle:"Please try again later or contact us at support@bik.ai if you require further assistance."})})),!!y&&!(!Q.length&&!Z)&&"2.0"!==M&&t(p,{onClear:function(){const e=r(k,{selected:!1});A([...e]),"2.0"===M&&G(e)},onApply:G,list:k})]})),!!z&&t(c,{title:z.title,description:z.description,version:M})]}))};export{j as OpenedDropdown};
@@ -1,5 +1,5 @@
1
- import{jsx as e,Fragment as t}from"react/jsx-runtime";import n from"styled-components";import{CheckBox as o}from"../../../../checkBox/CheckBox.js";import{ListItem as i}from"../../../../list-item/ListItem.js";import{BodyCaption as s}from"../../../../TypographyStyle.js";import{COLORS as r}from"../../../../../constants/Theme.js";import{FreeFormContainer as l}from"./FreeFormMenu.styled.js";const c=n(i)`
1
+ import{jsx as e,Fragment as t}from"react/jsx-runtime";import o from"styled-components";import{CheckBox as i}from"../../../../checkBox/CheckBox.js";import{ListItem as n}from"../../../../list-item/ListItem.js";import{BodyCaption as s}from"../../../../TypographyStyle.js";import{COLORS as r}from"../../../../../constants/Theme.js";import{FreeFormContainer as l}from"./FreeFormMenu.styled.js";const c=o(n)`
2
2
  padding: ${e=>"2.0"===e.version?"8px 12px":"14px 16px"} !important;
3
3
  cursor: pointer;
4
4
  margin-top: ${e=>"2.0"===e.version?"2px":"0"};
5
- `,a=n=>{let{option:i,isMultiSelect:a,showDescription:d,onSelect:m,last:p,version:u}=n;var g;function b(e){i.disabled||m(Object.assign(Object.assign({},i),{selected:e}))}return e(c,{version:u,style:p?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),b(!i.selected)},onMouseOver:function(){i.description?d(i.label,i.description):d()},listItem:{value:i.value,label:i.label},subText:i.subText,leadingIcon:a?e("div",Object.assign({style:{width:18,display:"flex",alignContent:"center",justifyContent:"center"}},{children:e(o,{size:"2.0"===u?"SMALL":"DEFAULT",isDisabled:null!==(g=i.disabled)&&void 0!==g&&g,isChecked:!!i.selected,onValueChange:b})})):i.leadingIcon?e(t,{children:i.leadingIcon}):e(t,{}),customComponent:i.customComponent,trailingIcon:i.isFreeForm?e(l,{children:e(s,Object.assign({style:{color:r.content.secondary}},{children:"Freeform"}))}):i.trailingIcon?e(t,{children:i.trailingIcon}):e(t,{}),variant:i.disabled?"inactive":i.selected?"selected":"default"})};export{a as MenuItem};
5
+ `,a=o=>{let{option:n,isMultiSelect:a,showDescription:d,onSelect:m,last:p,version:u}=o;var b;function g(e){n.disabled||m(Object.assign(Object.assign({},n),{selected:e}))}return e(c,{version:u,style:p?{borderBottom:0}:{},onClick:e=>{e.preventDefault(),g(!n.selected)},onMouseOver:function(){n.description?d(n.label,n.description):d()},listItem:{value:n.value,label:n.label},subText:n.subText,leadingIcon:a?e("div",Object.assign({style:{width:18}},{children:e(i,{size:"2.0"===u?"SMALL":"DEFAULT",isDisabled:null!==(b=n.disabled)&&void 0!==b&&b,isChecked:!!n.selected,onValueChange:g})})):n.leadingIcon?e(t,{children:n.leadingIcon}):e(t,{}),customComponent:n.customComponent,trailingIcon:n.isFreeForm?e(l,{children:e(s,Object.assign({style:{color:r.content.secondary}},{children:"Freeform"}))}):n.trailingIcon?e(t,{children:n.trailingIcon}):e(t,{}),variant:n.disabled?"inactive":n.selected?"selected":"default"})};export{a as MenuItem};
@@ -1 +1 @@
1
- import{jsx as o,Fragment as r}from"react/jsx-runtime";import{useState as t}from"react";import{Input as e}from"../../../../input/Input.js";import{InputStyleContext as n}from"../../../../input/context/InputStyleProvider.js";import{COLORS as i}from"../../../../../constants/Theme.js";import s from"../../../../../assets/icons/cross.svg.js";import c from"../../../../../assets/icons/search.svg.js";const p=p=>{let{onSearch:a,version:m}=p;const[l,h]=t(""),[d,g]=t(!1);return o(n.Provider,Object.assign({value:{InputWrapper:{borderRadius:0,border:0,borderBottom:`${"2.0"===m?.5:1}px solid ${i.stroke.primary}`,padding:""+("2.0"===m?"6px 8px":"14px 16px"),marginBottom:4},IconHolder:{marginLeft:0},input:{marginLeft:4,minHeight:"100%"}}},{children:o(e,{noKeyDownChange:!0,skipFocus:!0,placeholder:"Search",variant:"2.0"===m?"small":"default",leftIcon:{icon:()=>o(c,{width:"2.0"===m?18:24,height:"2.0"===m?18:24,color:i.content.placeholder})},rightIcon:{icon:()=>l?o(s,{onClick:()=>{g(!0),a(""),h("")},width:24,height:24,color:i.content.placeholder}):o(r,{})},reset:d,onChangeText:o=>{g(!1),h(o),a(o)}})}))};export{p as SearchBox};
1
+ import{jsx as o,Fragment as r}from"react/jsx-runtime";import{useState as t}from"react";import{Input as e}from"../../../../input/Input.js";import{InputStyleContext as i}from"../../../../input/context/InputStyleProvider.js";import{COLORS as n}from"../../../../../constants/Theme.js";import s from"../../../../../assets/icons/cross.svg.js";import c from"../../../../../assets/icons/search.svg.js";const p=p=>{let{onSearch:a,version:m}=p;const[l,d]=t(""),[h,g]=t(!1);return o(i.Provider,Object.assign({value:{InputWrapper:{borderRadius:0,border:0,borderBottom:`${"2.0"===m?.5:1}px solid ${n.stroke.primary}`,padding:""+("2.0"===m?"6px 8px":"14px 16px"),marginBottom:4},IconHolder:{marginLeft:0},input:{marginLeft:4,minHeight:"100%"}}},{children:o(e,{skipFocus:!0,placeholder:"Search",variant:"2.0"===m?"small":"default",leftIcon:{icon:()=>o(c,{width:"2.0"===m?18:24,height:"2.0"===m?18:24,color:n.content.placeholder})},rightIcon:{icon:()=>l?o(s,{onClick:()=>{g(!0),a(""),d("")},width:24,height:24,color:n.content.placeholder}):o(r,{})},reset:h,onChangeText:o=>{g(!1),d(o),a(o)}})}))};export{p as SearchBox};
@@ -26,4 +26,3 @@ export declare function iterateOnOptions(options: DropdownOption[], newVal: Part
26
26
  searchKey?: string | undefined;
27
27
  options: SingleOption[];
28
28
  })[];
29
- export declare function iterateOnOptionsRaw(options: DropdownOption[], cb: (option: SingleOption) => void): void;
@@ -1 +1 @@
1
- function s(s,n,t){return s.map((s=>{if(s.options){const i=s.options.map((s=>!t||t(s)?Object.assign(Object.assign({},s),n):Object.assign({},s)));return Object.assign(Object.assign({},s),{options:[...i]})}return!t||t(s)?Object.assign(Object.assign({},s),n):Object.assign({},s)}))}function n(s,n){s.forEach((s=>{s.options?s.options.forEach(n):n(s)}))}export{s as iterateOnOptions,n as iterateOnOptionsRaw};
1
+ function s(s,n,t){return s.map((s=>{if(s.options){const i=s.options.map((s=>!t||t(s)?Object.assign(Object.assign({},s),n):Object.assign({},s)));return Object.assign(Object.assign({},s),{options:[...i]})}return!t||t(s)?Object.assign(Object.assign({},s),n):Object.assign({},s)}))}export{s as iterateOnOptions};
@@ -13,7 +13,6 @@ export interface OpenDropdownProps {
13
13
  onSelect?: (option: DropdownOption | DropdownOption[]) => void;
14
14
  placement?: Placement;
15
15
  strategy?: PositioningStrategy;
16
- onSearch?: (key: string) => Promise<DropdownOption[]>;
17
16
  version?: '1.0' | '2.0';
18
17
  skipSorting?: boolean;
19
18
  }
@@ -45,7 +45,6 @@ export interface InputProps {
45
45
  min: number;
46
46
  max: number;
47
47
  };
48
- noKeyDownChange?: boolean;
49
48
  skipFocus?: boolean;
50
49
  }
51
50
  export declare const Input: {
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useState as i,useContext as r,useRef as l,useEffect as o}from"react";import{Button as a}from"../button/Button.js";import{isFunction as s,validateInput as c}from"./Input-helper.js";import{BodySecondary as u}from"../TypographyStyle.js";import d from"../../assets/icons/errorInfo.svg.js";import{InputStyleContext as v}from"./context/InputStyleProvider.js";import{RootContainer as h,InputFooter as p,InputWrapper as g,IconHolder as m,PrefixHolder as f,InputContainer as x,InputContainerSmall as b,SuffixHolder as y,InputHeader as j,MaxCharStyle as C}from"./Input.styled.js";const I=I=>{var w,O,k,T,A;const{placeholder:L,leftIcon:z,rightIcon:B,labelText:D,maxCharLimit:F,isRequired:M,hintText:S,type:E,state:K,validate:R,variant:H,button:q,suffixText:N,prefixText:P,onChangeText:V,value:W,noErrorHint:G,reset:J,rangeValidation:Q,noKeyDownChange:U}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},I),X=null==z?void 0:z.icon,Y=null==B?void 0:B.icon,[Z,$]=i(!1),[_,ee]=i(!1),[te,ne]=i(),ie="small"===H?"18px":"22px",re=r(v),[le,oe]=i(),ae=l();o((()=>{oe(W)}),[W]),o((()=>{var e;ae.current&&(null===(e=I.onReferenceInit)||void 0===e||e.call(I,ae.current))}),[ae]),o((()=>{J&&oe("")}),[J]),o((()=>{var e;ee(!!I.isActive),I.isActive&&(null===(e=ae.current)||void 0===e||e.focus())}),[I.isActive]),o((()=>{ne(I.errorMessage)}),[I.errorMessage]),o((()=>{var e;$(!1),("invalid"===I.state||te)&&$(!0),"active"===I.state&&(null===(e=ae.current)||void 0===e||e.focus())}),[I.state,te]),o((()=>{$(!!te)}),[te]);const se=function(e){if(s(e)){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];e(...n)}},ce=e=>{const t=F||("zip"===E?6:60);U||V(W||"",e),![8].includes(e.which)&&t>0&&e.target.value.length===t&&e.preventDefault()},ue=e=>{const t=e.target.value;V(t,e),oe(t);const n=R||c;if(!n||!s(n))return;const[i,r]=n(t,E,Q);$(!i),ne(I.errorMessage?I.errorMessage:r)},de=()=>{var i;return e(n,{children:["multiline"!==E&&t("input",{id:I.id,style:null!==(i=null==re?void 0:re.input)&&void 0!==i?i:{},ref:ae,type:["phonenumber","zip","number"].includes(E)?"number":E,value:le,onFocus:()=>(I.skipFocus||ee(!0),void se(I.onFocus)),onBlur:e=>(e=>{var t;ee(!1),se(null===(t=I.onBlur)||void 0===t?void 0:t.call(I,e))})(e),placeholder:L||"Enter here",onChange:ue,onKeyDown:e=>ce(e)}),"multiline"===E&&t("textarea",{value:le,ref:ae,onFocus:()=>ee(!0),onBlur:()=>ee(!1),placeholder:L||"Enter here",onChange:ue,onKeyDown:e=>ce(e),maxLength:F>0?F:void 0})]})};return e(h,Object.assign({width:I.width,height:I.height,state:K,type:E,style:null!==(w=null==re?void 0:re.RootContainer)&&void 0!==w?w:{}},{children:[!G&&(!!S||!!te)&&e(p,Object.assign({invalid:!!te},{children:[!!te&&t(d,{width:16,height:16}),te||S]})),e(g,Object.assign({variant:H,state:K,width:I.width,isActive:"active"===K||_,isInvalid:Z,style:null!==(O=null==re?void 0:re.InputWrapper)&&void 0!==O?O:{}},{children:[!!X&&t(m,Object.assign({variant:H,iconSize:ie,onClick:()=>se(null==z?void 0:z.callback),isLeft:!0,style:null!==(k=null==re?void 0:re.IconHolder)&&void 0!==k?k:{}},{children:t(X,{})})),!!P&&t(f,Object.assign({variant:H},{children:P})),"default"===H&&t(x,{children:de()}),"small"===H&&t(b,{children:de()}),!!Y&&t(m,Object.assign({variant:H,iconSize:ie,onClick:()=>se(null==B?void 0:B.callback),isLeft:!1},{children:t(Y,{})})),!!N&&t(y,Object.assign({variant:H},{children:N})),q&&q.text&&t(a,{buttonText:q.text,onClick:()=>se(null==q?void 0:q.onClick)})]})),(!!D||!!F)&&e(j,Object.assign({invalid:Z},{children:[e(u,{children:[D,M?t("span",{children:"*"}):""]}),F>0&&e(C,{children:[null!==(A=null===(T=I.value)||void 0===T?void 0:T.length)&&void 0!==A?A:0,"/",F]})]}))]}))};I.displayName="Input";export{I as Input};
1
+ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useState as i,useContext as r,useRef as l,useEffect as o}from"react";import{Button as a}from"../button/Button.js";import{isFunction as s,validateInput as c}from"./Input-helper.js";import{BodySecondary as u}from"../TypographyStyle.js";import d from"../../assets/icons/errorInfo.svg.js";import{InputStyleContext as v}from"./context/InputStyleProvider.js";import{RootContainer as h,InputFooter as p,InputWrapper as m,IconHolder as g,PrefixHolder as f,InputContainer as x,InputContainerSmall as b,SuffixHolder as y,InputHeader as j,MaxCharStyle as I}from"./Input.styled.js";const C=C=>{var w,O,k,T,A;const{placeholder:L,leftIcon:z,rightIcon:B,labelText:F,maxCharLimit:M,isRequired:S,hintText:D,type:E,state:R,validate:H,variant:K,button:q,suffixText:N,prefixText:P,onChangeText:V,value:W,noErrorHint:G,reset:J,rangeValidation:Q}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},C),U=null==z?void 0:z.icon,X=null==B?void 0:B.icon,[Y,Z]=i(!1),[$,_]=i(!1),[ee,te]=i(),ne="small"===K?"18px":"22px",ie=r(v),[re,le]=i(),oe=l();o((()=>{le(W)}),[W]),o((()=>{var e;oe.current&&(null===(e=C.onReferenceInit)||void 0===e||e.call(C,oe.current))}),[oe]),o((()=>{J&&le("")}),[J]),o((()=>{var e;_(!!C.isActive),C.isActive&&(null===(e=oe.current)||void 0===e||e.focus())}),[C.isActive]),o((()=>{te(C.errorMessage)}),[C.errorMessage]),o((()=>{var e;Z(!1),("invalid"===C.state||ee)&&Z(!0),"active"===C.state&&(null===(e=oe.current)||void 0===e||e.focus())}),[C.state,ee]),o((()=>{Z(!!ee)}),[ee]);const ae=function(e){if(s(e)){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];e(...n)}},se=e=>{const t=M||("zip"===E?6:60);V(W||"",e),![8].includes(e.which)&&t>0&&e.target.value.length===t&&e.preventDefault()},ce=e=>{const t=e.target.value;V(t,e),le(t);const n=H||c;if(!n||!s(n))return;const[i,r]=n(t,E,Q);Z(!i),te(C.errorMessage?C.errorMessage:r)},ue=()=>{var i;return e(n,{children:["multiline"!==E&&t("input",{id:C.id,style:null!==(i=null==ie?void 0:ie.input)&&void 0!==i?i:{},ref:oe,type:["phonenumber","zip","number"].includes(E)?"number":E,value:re,onFocus:()=>(C.skipFocus||_(!0),void ae(C.onFocus)),onBlur:e=>(e=>{var t;_(!1),ae(null===(t=C.onBlur)||void 0===t?void 0:t.call(C,e))})(e),placeholder:L||"Enter here",onChange:ce,onKeyDown:e=>se(e)}),"multiline"===E&&t("textarea",{value:re,ref:oe,onFocus:()=>_(!0),onBlur:()=>_(!1),placeholder:L||"Enter here",onChange:ce,onKeyDown:e=>se(e),maxLength:M>0?M:void 0})]})};return e(h,Object.assign({width:C.width,height:C.height,state:R,type:E,style:null!==(w=null==ie?void 0:ie.RootContainer)&&void 0!==w?w:{}},{children:[!G&&(!!D||!!ee)&&e(p,Object.assign({invalid:!!ee},{children:[!!ee&&t(d,{width:16,height:16}),ee||D]})),e(m,Object.assign({variant:K,state:R,width:C.width,isActive:"active"===R||$,isInvalid:Y,style:null!==(O=null==ie?void 0:ie.InputWrapper)&&void 0!==O?O:{}},{children:[!!U&&t(g,Object.assign({variant:K,iconSize:ne,onClick:()=>ae(null==z?void 0:z.callback),isLeft:!0,style:null!==(k=null==ie?void 0:ie.IconHolder)&&void 0!==k?k:{}},{children:t(U,{})})),!!P&&t(f,Object.assign({variant:K},{children:P})),"default"===K&&t(x,{children:ue()}),"small"===K&&t(b,{children:ue()}),!!X&&t(g,Object.assign({variant:K,iconSize:ne,onClick:()=>ae(null==B?void 0:B.callback),isLeft:!1},{children:t(X,{})})),!!N&&t(y,Object.assign({variant:K},{children:N})),q&&q.text&&t(a,{buttonText:q.text,onClick:()=>ae(null==q?void 0:q.onClick)})]})),(!!F||!!M)&&e(j,Object.assign({invalid:Y},{children:[e(u,{children:[F,S?t("span",{children:"*"}):""]}),M>0&&e(I,{children:[null!==(A=null===(T=C.value)||void 0===T?void 0:T.length)&&void 0!==A?A:0,"/",M]})]}))]}))};C.displayName="Input";export{C as Input};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.211-customSearch.1",
3
+ "version": "0.0.211-qb-operators.2",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,40 +0,0 @@
1
- /// <reference types="react" />
2
- import { SelectAllCheckboxState } from '../OpenedDropdown/components/menu/SelectAllMenu';
3
- import { DropdownOption, SingleOption } from '../type';
4
- export declare const useDropdown: (version: string | undefined, options: DropdownOption[], onSelect: ((option: DropdownOption | DropdownOption[]) => void) | undefined, skipSorting?: boolean, isMultiSelect?: boolean, onSearch?: ((searchKey: string) => Promise<DropdownOption[]>) | undefined) => {
5
- latestDropdownOptionsRef: import("react").MutableRefObject<DropdownOption[]>;
6
- dropdownOptions: DropdownOption[];
7
- search: (searchKey: string) => void;
8
- searchedString: string;
9
- searchedOptions: DropdownOption[];
10
- onApplyHandler: (optionSelect: SingleOption, returnOnly?: boolean) => ({
11
- label: string;
12
- value: string;
13
- description?: string | null | undefined;
14
- selected?: boolean | undefined;
15
- disabled?: boolean | undefined;
16
- isFreeForm?: boolean | undefined;
17
- subText?: string | undefined;
18
- trailingIcon?: JSX.Element | undefined;
19
- leadingIcon?: JSX.Element | undefined;
20
- customComponent?: JSX.Element | undefined;
21
- searchKey?: string | undefined;
22
- } | {
23
- label?: string | undefined;
24
- value?: string | undefined;
25
- description?: string | null | undefined;
26
- selected?: boolean | undefined;
27
- disabled?: boolean | undefined;
28
- isFreeForm?: boolean | undefined;
29
- subText?: string | undefined;
30
- trailingIcon?: JSX.Element | undefined;
31
- leadingIcon?: JSX.Element | undefined;
32
- customComponent?: JSX.Element | undefined;
33
- searchKey?: string | undefined;
34
- options: SingleOption[];
35
- })[] | undefined;
36
- selectAllHandler: (newState: SelectAllCheckboxState) => void;
37
- onMultiSelectClear: () => void;
38
- onFreeFormSelect: (selected: boolean) => void;
39
- onMultiSelectApply: (options?: DropdownOption[]) => void;
40
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../OpenedDropdown/utils/iterationOnOptions.js");exports.useDropdown=function(){let s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"1.0",l=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,c=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0;const[a,u]=e.useState(null!=l?l:[]),[r,d]=e.useState([]),[p,v]=e.useState(""),O=e.useRef(a);e.useEffect((()=>{if(O.current=a,r.length&&p&&o){let e=[...r];const t=a.map((e=>e.options?e.options.map((e=>({value:e.value,selected:e.selected}))):{value:e.value,selected:e.selected})).flat();e=e.map((e=>{const s=t.find((t=>e.value===t.value));return s?Object.assign(Object.assign({},e),{selected:s.selected}):e})),d([...e])}}),[a]),e.useEffect((()=>{if(l){const e=[...l];u(c&&!i?[...e.sort((e=>e.selected?-1:1))]:[...e])}}),[l]);const f=e=>{const t=[];return e.forEach((e=>{if(e.options){const s=e.options.filter((e=>!0===e.selected));t.push(Object.assign(Object.assign({},e),{options:[...s]}))}else e.selected&&t.push(Object.assign({},e))})),t};function g(e,l){if(c)if(r.length&&p&&o)if(e.selected){let n=!1;const i=t.iterateOnOptions(a,{selected:e.selected},(t=>t.value===e.value&&(n=!0,!0)));if(n||i.push(e),l)return[...i];u([...i]),"2.0"===s&&b(i)}else{let n=!1,i=t.iterateOnOptions(a,{selected:e.selected},(t=>t.value===e.value&&(n=!0,!0)));if(n&&(i=i.filter((t=>t.value!==e.value))),l)return[...i];u([...i]),"2.0"===s&&b(i)}else{const n=t.iterateOnOptions(a,{selected:e.selected},(t=>t.value===e.value));if(l)return[...n];u([...n]),"2.0"===s&&b(n)}else null==n||n(e)}function b(e){const t=f(null!=e?e:O.current);null==n||n([...t])}return{latestDropdownOptionsRef:O,dropdownOptions:a,search:function(e){if(v(e),d([]),e&&o){const s=[];t.iterateOnOptionsRaw(a,(e=>{e.selected&&!s.includes(e.value)&&s.push(e.value)})),o(e).then((e=>{if(e){const t=e.map((e=>{if(e.options){const t=e;return Object.assign(Object.assign({},t),{options:t.options.map((e=>Object.assign(Object.assign({},e),{selected:s.includes(e.value)})))})}return Object.assign(Object.assign({},e),{selected:s.includes(e.value)})}));d([...t])}}))}},searchedString:p,searchedOptions:r,onApplyHandler:g,selectAllHandler:function(e){if(r.length&&p&&o)!function(e){let t=[...a];e?r.forEach((e=>{let s=!1;t=t.map((t=>{const l=e;return void 0!==l.value&&l.value===t.value?(s=!0,Object.assign(Object.assign({},t),{selected:!0})):t})),s||t.push(Object.assign(Object.assign({},e),{selected:!0}))})):r.forEach((e=>{t=t.map((t=>{const s=e;return void 0!==s.value&&s.value===t.value?Object.assign(Object.assign({},t),{selected:!1}):t}))})),u([...t]),"2.0"===s&&b(t)}("selectAll"===e);else if("selectAll"===e){const e=t.iterateOnOptions(a,{selected:!0},(e=>{var t;return p?(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(p.toLowerCase()))&&!e.disabled:!e.disabled}));u([...e]),"2.0"===s&&b(e)}else if("notSelected"===e){const e=t.iterateOnOptions(a,{selected:!1},(e=>!e.disabled));u([...e]),"2.0"===s&&b(e)}},onMultiSelectClear:function(){const e=t.iterateOnOptions(a,{selected:!1});u([...e]),"2.0"===s&&b(e)},onFreeFormSelect:function(e){if(!c)return void g({label:p,value:p,isFreeForm:!0,selected:!0});const t=a.map((t=>t.options?t:Object.assign(Object.assign({},t),{selected:t.label===p&&t.value===p?e:t.selected})));e&&(t.some((e=>e.label===p&&e.value===p))||t.unshift({label:p,value:p,isFreeForm:!0,selected:!0})),u([...t]),"2.0"===s&&b(t)},onMultiSelectApply:b}};
@@ -1,40 +0,0 @@
1
- /// <reference types="react" />
2
- import { SelectAllCheckboxState } from '../OpenedDropdown/components/menu/SelectAllMenu';
3
- import { DropdownOption, SingleOption } from '../type';
4
- export declare const useDropdown: (version: string | undefined, options: DropdownOption[], onSelect: ((option: DropdownOption | DropdownOption[]) => void) | undefined, skipSorting?: boolean, isMultiSelect?: boolean, onSearch?: ((searchKey: string) => Promise<DropdownOption[]>) | undefined) => {
5
- latestDropdownOptionsRef: import("react").MutableRefObject<DropdownOption[]>;
6
- dropdownOptions: DropdownOption[];
7
- search: (searchKey: string) => void;
8
- searchedString: string;
9
- searchedOptions: DropdownOption[];
10
- onApplyHandler: (optionSelect: SingleOption, returnOnly?: boolean) => ({
11
- label: string;
12
- value: string;
13
- description?: string | null | undefined;
14
- selected?: boolean | undefined;
15
- disabled?: boolean | undefined;
16
- isFreeForm?: boolean | undefined;
17
- subText?: string | undefined;
18
- trailingIcon?: JSX.Element | undefined;
19
- leadingIcon?: JSX.Element | undefined;
20
- customComponent?: JSX.Element | undefined;
21
- searchKey?: string | undefined;
22
- } | {
23
- label?: string | undefined;
24
- value?: string | undefined;
25
- description?: string | null | undefined;
26
- selected?: boolean | undefined;
27
- disabled?: boolean | undefined;
28
- isFreeForm?: boolean | undefined;
29
- subText?: string | undefined;
30
- trailingIcon?: JSX.Element | undefined;
31
- leadingIcon?: JSX.Element | undefined;
32
- customComponent?: JSX.Element | undefined;
33
- searchKey?: string | undefined;
34
- options: SingleOption[];
35
- })[] | undefined;
36
- selectAllHandler: (newState: SelectAllCheckboxState) => void;
37
- onMultiSelectClear: () => void;
38
- onFreeFormSelect: (selected: boolean) => void;
39
- onMultiSelectApply: (options?: DropdownOption[]) => void;
40
- };
@@ -1 +0,0 @@
1
- import{useState as e,useRef as t,useEffect as s}from"react";import{iterateOnOptionsRaw as l,iterateOnOptions as n}from"../OpenedDropdown/utils/iterationOnOptions.js";const c=function(){let c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"1.0",o=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,u=arguments.length>4?arguments[4]:void 0,d=arguments.length>5?arguments[5]:void 0;const[r,v]=e(null!=o?o:[]),[p,f]=e([]),[g,b]=e(""),O=t(r);s((()=>{if(O.current=r,p.length&&g&&d){let e=[...p];const t=r.map((e=>e.options?e.options.map((e=>({value:e.value,selected:e.selected}))):{value:e.value,selected:e.selected})).flat();e=e.map((e=>{const s=t.find((t=>e.value===t.value));return s?Object.assign(Object.assign({},e),{selected:s.selected}):e})),f([...e])}}),[r]),s((()=>{if(o){const e=[...o];v(u&&!a?[...e.sort((e=>e.selected?-1:1))]:[...e])}}),[o]);const h=e=>{const t=[];return e.forEach((e=>{if(e.options){const s=e.options.filter((e=>!0===e.selected));t.push(Object.assign(Object.assign({},e),{options:[...s]}))}else e.selected&&t.push(Object.assign({},e))})),t};function j(e,t){if(u)if(p.length&&g&&d)if(e.selected){let s=!1;const l=n(r,{selected:e.selected},(t=>t.value===e.value&&(s=!0,!0)));if(s||l.push(e),t)return[...l];v([...l]),"2.0"===c&&m(l)}else{let s=!1,l=n(r,{selected:e.selected},(t=>t.value===e.value&&(s=!0,!0)));if(s&&(l=l.filter((t=>t.value!==e.value))),t)return[...l];v([...l]),"2.0"===c&&m(l)}else{const s=n(r,{selected:e.selected},(t=>t.value===e.value));if(t)return[...s];v([...s]),"2.0"===c&&m(s)}else null==i||i(e)}function m(e){const t=h(null!=e?e:O.current);null==i||i([...t])}return{latestDropdownOptionsRef:O,dropdownOptions:r,search:function(e){if(b(e),f([]),e&&d){const t=[];l(r,(e=>{e.selected&&!t.includes(e.value)&&t.push(e.value)})),d(e).then((e=>{if(e){const s=e.map((e=>{if(e.options){const s=e;return Object.assign(Object.assign({},s),{options:s.options.map((e=>Object.assign(Object.assign({},e),{selected:t.includes(e.value)})))})}return Object.assign(Object.assign({},e),{selected:t.includes(e.value)})}));f([...s])}}))}},searchedString:g,searchedOptions:p,onApplyHandler:j,selectAllHandler:function(e){if(p.length&&g&&d)!function(e){let t=[...r];e?p.forEach((e=>{let s=!1;t=t.map((t=>{const l=e;return void 0!==l.value&&l.value===t.value?(s=!0,Object.assign(Object.assign({},t),{selected:!0})):t})),s||t.push(Object.assign(Object.assign({},e),{selected:!0}))})):p.forEach((e=>{t=t.map((t=>{const s=e;return void 0!==s.value&&s.value===t.value?Object.assign(Object.assign({},t),{selected:!1}):t}))})),v([...t]),"2.0"===c&&m(t)}("selectAll"===e);else if("selectAll"===e){const e=n(r,{selected:!0},(e=>{var t;return g?(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(g.toLowerCase()))&&!e.disabled:!e.disabled}));v([...e]),"2.0"===c&&m(e)}else if("notSelected"===e){const e=n(r,{selected:!1},(e=>!e.disabled));v([...e]),"2.0"===c&&m(e)}},onMultiSelectClear:function(){const e=n(r,{selected:!1});v([...e]),"2.0"===c&&m(e)},onFreeFormSelect:function(e){if(!u)return void j({label:g,value:g,isFreeForm:!0,selected:!0});const t=r.map((t=>t.options?t:Object.assign(Object.assign({},t),{selected:t.label===g&&t.value===g?e:t.selected})));e&&(t.some((e=>e.label===g&&e.value===g))||t.unshift({label:g,value:g,isFreeForm:!0,selected:!0})),v([...t]),"2.0"===c&&m(t)},onMultiSelectApply:m}};export{c as useDropdown};