@bikdotai/bik-component-library 0.0.683 → 0.0.684-beta.ai-content-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.
- package/dist/cjs/assets/icons/aiContentIcon.svg.js +1 -0
- package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
- package/dist/cjs/components/SearchFilter/components/DatePickerButton.js +1 -1
- package/dist/cjs/components/SearchFilter/components/DateRangeOnlyButton.js +1 -1
- package/dist/cjs/components/TablePagination/TablePagination.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js +1 -1
- package/dist/cjs/components/carousel-secondary/CarouselSecondary.d.ts +2 -4
- package/dist/cjs/components/carousel-secondary/CarouselSecondary.js +1 -1
- package/dist/cjs/components/carousel-secondary/CarouselSecondary.style.d.ts +1 -1
- package/dist/cjs/components/carousel-secondary/CarouselSecondary.style.js +1 -1
- package/dist/cjs/components/carousel-secondary/model.d.ts +4 -0
- package/dist/cjs/components/carousel-secondary/model.js +1 -0
- package/dist/cjs/components/custom-date-time/DateSelector/DateSelector.js +1 -1
- package/dist/cjs/components/data-source-panel/DataSourceInfoFooter.d.ts +2 -0
- package/dist/cjs/components/data-source-panel/DataSourceInfoFooter.js +1 -1
- package/dist/cjs/components/data-source-panel/DataSourcePanel.d.ts +9 -0
- package/dist/cjs/components/data-source-panel/DataSourcePanel.js +1 -1
- package/dist/cjs/components/data-source-panel/DataSourcePanel.style.d.ts +1 -0
- package/dist/cjs/components/data-source-panel/DataSourcePanel.style.js +12 -3
- package/dist/cjs/components/datePicker/DatePickerWrapper.d.ts +1 -4
- package/dist/cjs/components/datePicker/DatePickerWrapper.js +1 -1
- package/dist/cjs/components/datePicker/DatePickerWrapper.styled.d.ts +1 -1
- package/dist/cjs/components/datePicker/DatePickerWrapper.styled.js +2 -2
- package/dist/cjs/components/datePicker/model.d.ts +4 -0
- package/dist/cjs/components/datePicker/model.js +1 -0
- package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +1 -2
- package/dist/cjs/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/cjs/components/dropdown/ChipDropdown.d.ts +1 -1
- package/dist/cjs/components/dropdown/ChipDropdown.js +3 -3
- package/dist/cjs/components/dropdown/MenuItem/MenuItem.d.ts +1 -1
- package/dist/cjs/components/dropdown/MenuItem/MenuItem.js +5 -5
- package/dist/cjs/components/multi-level-dropdown/MenuItem.js +1 -1
- package/dist/cjs/components/product-picker-v2/modal.d.ts +1 -8
- package/dist/cjs/components/product-picker-v2/modal.js +1 -1
- package/dist/cjs/components/product-picker-v2/style.js +1 -1
- package/dist/cjs/components/product-picker-v2/type.d.ts +7 -0
- package/dist/cjs/components/product-picker-v2/type.js +1 -1
- package/dist/cjs/components/product-picker-v2/variant.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/BackTrackComponent.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditWebpushTemplate.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
- package/dist/cjs/components/template-preview/RCS/RCSMediaCard.d.ts +1 -1
- package/dist/cjs/components/template-preview/RCS/RCSMediaCard.js +1 -1
- package/dist/cjs/components/template-preview/TemplatePreview.js +1 -1
- package/dist/cjs/components/template-preview/WhatsApp/MediaCard.js +1 -1
- package/dist/cjs/components/template-preview/models/WhatsAppTemplate.d.ts +1 -0
- package/dist/cjs/components/variable-picker-v3/Content.d.ts +0 -1
- package/dist/cjs/components/variable-picker-v3/Content.js +1 -1
- package/dist/cjs/components/variable-picker-v3/SubHeaderItems.js +1 -1
- package/dist/cjs/components/variable-picker-v3/highlightSearchText.d.ts +1 -0
- package/dist/cjs/components/variable-picker-v3/highlightSearchText.js +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/esm/assets/icons/aiContentIcon.svg.js +1 -0
- package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
- package/dist/esm/components/SearchFilter/components/DatePickerButton.js +1 -1
- package/dist/esm/components/SearchFilter/components/DateRangeOnlyButton.js +1 -1
- package/dist/esm/components/TablePagination/TablePagination.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js +1 -1
- package/dist/esm/components/carousel-secondary/CarouselSecondary.d.ts +2 -4
- package/dist/esm/components/carousel-secondary/CarouselSecondary.js +1 -1
- package/dist/esm/components/carousel-secondary/CarouselSecondary.style.d.ts +1 -1
- package/dist/esm/components/carousel-secondary/CarouselSecondary.style.js +1 -1
- package/dist/esm/components/carousel-secondary/model.d.ts +4 -0
- package/dist/esm/components/carousel-secondary/model.js +1 -0
- package/dist/esm/components/custom-date-time/DateSelector/DateSelector.js +1 -1
- package/dist/esm/components/data-source-panel/DataSourceInfoFooter.d.ts +2 -0
- package/dist/esm/components/data-source-panel/DataSourceInfoFooter.js +1 -1
- package/dist/esm/components/data-source-panel/DataSourcePanel.d.ts +9 -0
- package/dist/esm/components/data-source-panel/DataSourcePanel.js +1 -1
- package/dist/esm/components/data-source-panel/DataSourcePanel.style.d.ts +1 -0
- package/dist/esm/components/data-source-panel/DataSourcePanel.style.js +11 -2
- package/dist/esm/components/datePicker/DatePickerWrapper.d.ts +1 -4
- package/dist/esm/components/datePicker/DatePickerWrapper.js +1 -1
- package/dist/esm/components/datePicker/DatePickerWrapper.styled.d.ts +1 -1
- package/dist/esm/components/datePicker/DatePickerWrapper.styled.js +11 -11
- package/dist/esm/components/datePicker/model.d.ts +4 -0
- package/dist/esm/components/datePicker/model.js +1 -0
- package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.d.ts +1 -2
- package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.js +1 -1
- package/dist/esm/components/dropdown/ChipDropdown.d.ts +1 -1
- package/dist/esm/components/dropdown/ChipDropdown.js +3 -3
- package/dist/esm/components/dropdown/MenuItem/MenuItem.d.ts +1 -1
- package/dist/esm/components/dropdown/MenuItem/MenuItem.js +5 -5
- package/dist/esm/components/multi-level-dropdown/MenuItem.js +1 -1
- package/dist/esm/components/product-picker-v2/modal.d.ts +1 -8
- package/dist/esm/components/product-picker-v2/modal.js +1 -1
- package/dist/esm/components/product-picker-v2/style.js +4 -4
- package/dist/esm/components/product-picker-v2/type.d.ts +7 -0
- package/dist/esm/components/product-picker-v2/type.js +1 -1
- package/dist/esm/components/product-picker-v2/variant.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/BackTrackComponent.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditWebpushTemplate.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
- package/dist/esm/components/template-preview/RCS/RCSMediaCard.d.ts +1 -1
- package/dist/esm/components/template-preview/RCS/RCSMediaCard.js +1 -1
- package/dist/esm/components/template-preview/TemplatePreview.js +1 -1
- package/dist/esm/components/template-preview/WhatsApp/MediaCard.js +1 -1
- package/dist/esm/components/template-preview/models/WhatsAppTemplate.d.ts +1 -0
- package/dist/esm/components/variable-picker-v3/Content.d.ts +0 -1
- package/dist/esm/components/variable-picker-v3/Content.js +1 -1
- package/dist/esm/components/variable-picker-v3/SubHeaderItems.js +1 -1
- package/dist/esm/components/variable-picker-v3/highlightSearchText.d.ts +1 -0
- package/dist/esm/components/variable-picker-v3/highlightSearchText.js +1 -0
- package/dist/esm/index.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t=require("../../assets/icons/boxV2.svg.js"),i=require("../../assets/icons/cross.svg.js"),s=require("../../assets/icons/edit.svg.js"),o=require("../../assets/icons/filePdf.svg.js"),n=require("../../assets/icons/help.svg.js"),l=require("../../assets/icons/info.svg.js"),a=require("../../assets/icons/openai.svg.js"),r=require("../../assets/icons/plus.svg.js"),d=require("../../assets/icons/redirect.svg.js"),c=require("../../assets/icons/text_t9.svg.js"),u=require("../../assets/icons/website.svg.js"),p=require("react"),h=require("../../constants/Theme.js"),g=require("../button/Button.js"),x=require("../icon-button/IconButton.js"),C=require("../shimmer/ShimmerComponent/BikShimmer.js"),j=require("../side-modal/SideModal.js"),y=require("../tag/Tag.js"),m=require("../tooltips/Tooltip.js"),O=require("../TypographyStyle.js"),v=require("./DataSourceInfoFooter.js"),f=require("./DataSourcePanel.style.js"),S=require("./IntentConfig.js"),T=require("./Modals/DescriptionModal.js"),I=require("./model.js"),L=require("../../_virtual/bik-store.js");exports.DataSourcePanel=b=>{var E,w;const{appType:D,storeId:N,messageSource:R,setMessageSourcePanel:_,hideCloseButton:q,isSourceInfoFetched:B,allSourceInfoDetail:A,ChecklistType:k,title:F,zeroStateButton:P,editableSources:M,preFillTrainingSourceCount:U,redirect:K,footerButtonOption:W,fetchTrainingSourceCount:H,fetchProductFAQCount:$,productSourceData:Q}=b,{sources:Y}=R,G=["blog","article","page","policy"],[X,z]=p.useState(!1),[V,J]=p.useState(!1),[Z,ee]=p.useState(!1),[te,ie]=p.useState(0),[se,oe]=p.useState(),[ne,le]=p.useState(null!=U?U:{}),ae={};S.intentConfig.forEach((t=>{let{key:i,type:s,tagText:o}=t;k[i]&&(ae[k[i]]=e.jsx(y.Tag,{theme:"light",type:s,tagText:o,cursor:"pointer"}))}));const re=Y.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),de=Y.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),ce=p.useMemo((()=>{const e={};return["STORE_INFORMATION","CONTACT_INFO","STORE_LOCATION","SHIPPING_POLICY","RETURN_AND_REFUND","SALES_AND_OFFERS","SALES_AND_OFFERS_ISSUES","PRODUCT_CUSTOMISATION","PAYMENT_METHODS","CHECKOUT_ENQUIRY","ORDER_ENQUIRY"].forEach((t=>{k[t]&&(e[k[t]]=k[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[k]);p.useEffect((()=>{var e,t,i,s;if(!(null==R?void 0:R.messageId))return;z(!0),J(!0),ee(!1!==(null===(t=null===(e=R.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(s=null===(i=R.sources)||void 0===i?void 0:i[0])||void 0===s?void 0:s.insights));const o=R.sources.filter((e=>!!e.productId)).map((e=>e.productId)),n=Array.from(new Set(o)).filter((e=>!!e));$(N,n).then((e=>ie(e))).then((()=>{U?(le(U),setTimeout((()=>{z(!1),J(!1)}),100)):(setTimeout((()=>z(!1)),100),H(N).then((e=>le(e))).then((()=>setTimeout((()=>{J(!1)}),100))))}))}),[$,H,null==R?void 0:R.messageId,R.sources,U,N]);const ue=e=>!!(e&&0===e.length||(null==R?void 0:R.isUnsatisfactoryAnswer)),pe=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;return"custom"==e?e=I.CustomDataType.FILES:G.includes(e)?e=I.CustomDataType.FETCHED_LINKS:"url"==e?e=I.CustomDataType.WEBSITE_LINKS:"text"===e?e=I.CustomDataType.TEXTS:"faq"===e&&(e=I.CustomDataType.FAQ),t?e:null===(i=null==e?void 0:e.toLowerCase())||void 0===i?void 0:i.replace(/_/g," ")},he=e=>e?"faq"==e.toLocaleLowerCase()?"FAQ":"openai"==e.toLocaleLowerCase()?"OPENAI":"files"==e.toLocaleLowerCase()?"PDF":"texts"==e.toLocaleLowerCase()?"Custom text":((e=(e=e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(e=e.slice(0,-1)),e.replace("Website","Manual")):"",ge=i=>"products"==i||"product"==i?e.jsx(t.default,{height:16,width:16,color:h.COLORS.content.secondary}):"files"==i?e.jsx(o.default,{height:16,width:16,color:h.COLORS.content.secondary}):"website links"==i||"fetched links"==i?e.jsx(u.default,{height:16,width:16,color:h.COLORS.content.secondary}):"faq"==i?e.jsx(n.default,{height:16,width:16,color:h.COLORS.content.secondary}):"texts"==i?e.jsx(c.default,{height:16,width:16,color:h.COLORS.content.secondary}):e.jsx(a.default,{height:16,width:16,color:h.COLORS.content.secondary}),xe=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),i=document.createElement("textarea");return i.innerHTML=t,i.value};return X||!B?e.jsx(f.SourceInfoDetailsStyle,{children:e.jsx(C.BikShimmer,{boxes:[{width:"100px",height:"16px"},{width:"0",height:"4px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"0",height:"4px"},{width:"100%",height:"16px"}]})}):e.jsxs(e.Fragment,{children:[e.jsx(f.SourceInfoDetailsStyle,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!F&&e.jsx(O.TitleSmall,{children:F}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(O.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:"Intent"})),null!==(E=ae[R.intent])&&void 0!==E?E:ae.GENERIC,!q&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>_(void 0)},{children:e.jsx(i.default,{height:20,width:20,color:h.COLORS.content.secondary})}))]})),ue(Y)?e.jsx("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,i;return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e.jsx("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${h.COLORS.background.negative.light}`,borderRadius:"100px"}},{children:e.jsx(l.default,{width:24,height:24,color:h.COLORS.stroke.negative.vibrant})})),e.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsx(O.TitleSmall,{children:"Insufficient data"})})),e.jsx(O.BodySecondary,Object.assign({color:h.COLORS.content.secondary,style:{display:"flex",justifyContent:"center",textAlign:"center"}},{children:"No data available to answer this query. Add an FAQ to address it in the future"})),P&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(g.Button,{LeadingIcon:null!==(t=P.leadingIcon)&&void 0!==t?t:r.default,buttonText:null!==(i=P.title)&&void 0!==i?i:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{P.onClick()}})}))]}))})()})):e.jsx(y.Tag,{LeadingIcon:l.default,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:R.isEditable?`If any of the information is incorrect, update the original data source and sync it again. Alternatively, you can make local corrections directly in ${D===L.__exports.ApplicationType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!ue(Y)&&e.jsxs("div",Object.assign({className:"info-container"},{children:[re.length>0&&e.jsxs("div",Object.assign({className:"info-product-source"},{children:[e.jsx(O.BodyCaption,{children:"Product Source"}),e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:re.map(((t,i)=>{var o,n,l,a;const r=pe(t.type||t.subTitle||"OpenAI"),c=pe(t.type||t.subTitle||"OpenAI",!0),u=he(r),p=null==M?void 0:M.includes(c),g=A[null!==(o=t.productId)&&void 0!==o?o:"Products"],C=t.title,j=t.productId&&(null==Q?void 0:Q[t.productId]),y=j&&j.metafield.join(", ");return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:i+1<(null==re?void 0:re.length)?`1px solid ${h.COLORS.stroke.primary}`:"none"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[ge(r),e.jsx(m.Tooltip,Object.assign({body:C,placement:"top"},{children:e.jsx(O.BodySecondary,Object.assign({style:c==I.CustomDataType.FETCHED_LINKS||c==I.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>c==I.CustomDataType.FETCHED_LINKS||c==I.CustomDataType.WEBSITE_LINKS?K(t):{}},{children:C}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==k.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(O.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:u}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:p?e.jsx(x.IconButton,{Icon:s.default,height:16,width:16,iconColor:h.COLORS.content.secondary,onClick:()=>null==g?void 0:g.onEditClick(g.data,g.type),disabled:!g,disabledTooltip:"This source is deleted"}):e.jsx(x.IconButton,{Icon:d.default,height:16,width:16,iconColor:h.COLORS.content.secondary,disabled:"custom"===t.type&&!g,disabledTooltip:"This source is deleted",onClick:()=>K(t)})}))]}))]})),j&&e.jsxs(O.BodyCaption,{children:[e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;oe({title:C,description:xe(j.description),imageUrl:null!==(e=t.imageUrl)&&void 0!==e?e:"",onClose:()=>oe(void 0)})}},{children:`${null===(n=j.description)||void 0===n?void 0:n.length} characters description,`})),e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>j.onEditFaqClick(j.faqs)},{children:`${null===(l=j.faqs)||void 0===l?void 0:l.length} FAQs, `})),e.jsx("span",Object.assign({className:"product-data-text2"},{children:"and"})),e.jsx(m.Tooltip,Object.assign({body:y,placement:"top"},{children:e.jsx("span",Object.assign({className:"product-data-text1"},{children:`${null===(a=j.metafield)||void 0===a?void 0:a.length} metafields`}))}))]})]}),`info-${i}`)}))}))]})),de.length>0&&e.jsxs("div",Object.assign({className:"info-content-source"},{children:[e.jsx(O.BodyCaption,{children:"Content Source"}),e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:de.map(((t,i)=>{var o,n,l,a,r,c,u,p,g,C,j,y,v,f,S,T,L;const b=pe(t.type||t.subTitle||"OpenAI"),E=pe(t.type||t.subTitle||"OpenAI",!0),w=he(b),D=null==M?void 0:M.includes(E),N="Products"===t.subTitle?A[null!==(o=t.productId)&&void 0!==o?o:"Products"]:A[null!==(n=t.docId)&&void 0!==n?n:""],R=E.toLowerCase()===(null===(l=I.CustomDataType.FAQ)||void 0===l?void 0:l.toLowerCase())?"faq"===(null===(a=t.title)||void 0===a?void 0:a.toLowerCase())?t.subTitle:t.title:E.toLowerCase()===(null===(r=I.CustomDataType.FILES)||void 0===r?void 0:r.toLowerCase())||E.toLowerCase()===(null===(c=I.CustomDataType.FETCHED_LINKS)||void 0===c?void 0:c.toLowerCase())||E.toLowerCase()===(null===(u=I.CustomDataType.TEXTS)||void 0===u?void 0:u.toLowerCase())?t.title:E.toLowerCase()===(null===(p=I.CustomDataType.WEBSITE_LINKS)||void 0===p?void 0:p.toLowerCase())?t.title.split("/")[t.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,i)=>t.toUpperCase()+i)):t.intent===k.EMAIL_COLLECTION?w:t.title,_="faq"===E.toLowerCase()?null!==(j=null!==(g=null==N?void 0:N.content)&&void 0!==g?g:null===(C=null==N?void 0:N.data)||void 0===C?void 0:C.answer)&&void 0!==j?j:"":E.toLowerCase()===(null===(y=I.CustomDataType.FETCHED_LINKS)||void 0===y?void 0:y.toLowerCase())||E.toLowerCase()===(null===(v=I.CustomDataType.WEBSITE_LINKS)||void 0===v?void 0:v.toLowerCase())||E.toLowerCase()===(null===(f=I.CustomDataType.TEXTS)||void 0===f?void 0:f.toLowerCase())?null!==(L=null!==(S=null==N?void 0:N.content)&&void 0!==S?S:null===(T=null==N?void 0:N.data)||void 0===T?void 0:T.fileContentText)&&void 0!==L?L:"":t.intent===k.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:i+1<(null==de?void 0:de.length)?`1px solid ${h.COLORS.stroke.primary}`:"none"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[ge(b),e.jsx(m.Tooltip,Object.assign({body:R,placement:"top"},{children:e.jsx(O.BodySecondary,Object.assign({style:E==I.CustomDataType.FETCHED_LINKS||E==I.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:h.COLORS.content.primary,className:"clamp-title",onClick:()=>E==I.CustomDataType.FETCHED_LINKS||E==I.CustomDataType.WEBSITE_LINKS?K(t):{}},{children:R}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==k.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(O.BodyCaption,Object.assign({color:h.COLORS.content.secondary},{children:w}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:D?e.jsx(x.IconButton,{Icon:s.default,height:16,width:16,iconColor:h.COLORS.content.secondary,onClick:()=>null==N?void 0:N.onEditClick(N.data,N.type),disabled:!N,disabledTooltip:"This source is deleted"}):e.jsx(x.IconButton,{Icon:d.default,height:16,width:16,iconColor:h.COLORS.content.secondary,disabled:"custom"===t.type&&!N,disabledTooltip:"This source is deleted",onClick:()=>K(t)})}))]}))]})),(null!=_?_:"").trim()&&e.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${h.COLORS.stroke.primary}`,borderRadius:"4px",backgroundColor:h.COLORS.surface.subdued}},{children:e.jsx(O.BodyCaption,Object.assign({color:h.COLORS.content.primary,className:"clamp-description"},{children:xe(null!=_?_:"").trim()}))}))]}),`info-${i}`)}))}))]}))]})),Z&&!ue(Y)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(v.default,{appType:D,storeId:N,messageSource:R,sourceIntent:null!==(w=R.intent)&&void 0!==w?w:k.GENERIC,faqCount:te,trainingSourceCount:ne,ShowTrainingDataSource:ce,ChecklistType:k,footerButtonOption:W,isFooterLoading:V})}))]})}),se&&e.jsx(j.SideModal,Object.assign({header:"Product description",onClose:()=>oe(void 0),width:"30%"},{children:e.jsx(T.DescriptionModal,{title:se.title,description:se.description,imageUrl:se.imageUrl,onClose:se.onClose})}))]})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t=require("../../assets/icons/boxV2.svg.js"),s=require("../../assets/icons/chevronDownOutline.svg.js"),i=require("../../assets/icons/chevronUpOutline.svg.js"),o=require("../../assets/icons/cross.svg.js"),n=require("../../assets/icons/edit.svg.js"),l=require("../../assets/icons/filePdf.svg.js"),a=require("../../assets/icons/help.svg.js"),r=require("../../assets/icons/info.svg.js"),d=require("../../assets/icons/openai.svg.js"),c=require("../../assets/icons/plus.svg.js"),u=require("../../assets/icons/redirect.svg.js"),p=require("../../assets/icons/text_t9.svg.js"),g=require("../../assets/icons/website.svg.js"),h=require("react"),x=require("../../constants/Theme.js"),j=require("../button/Button.js"),C=require("../icon-button/IconButton.js"),y=require("../shimmer/ShimmerComponent/BikShimmer.js"),O=require("../side-modal/SideModal.js"),m=require("../tag/Tag.js"),v=require("../tooltips/Tooltip.js"),f=require("../TypographyStyle.js"),S=require("./DataSourceInfoFooter.js"),T=require("./DataSourcePanel.style.js"),I=require("./IntentConfig.js"),b=require("./Modals/DescriptionModal.js"),L=require("./model.js"),E=require("../../_virtual/bik-store.js");exports.DataSourcePanel=w=>{var D,N;const{appType:R,storeId:_,messageSource:A,setMessageSourcePanel:F,hideCloseButton:q,isSourceInfoFetched:B,allSourceInfoDetail:k,ChecklistType:P,title:M,zeroStateButton:U,editableSources:K,preFillTrainingSourceCount:W,redirect:H,footerButtonOption:$,fetchTrainingSourceCount:Q,fetchProductFAQCount:G,productSourceData:Y,reasonForAiGeneratedResponse:z,showAiResponseReason:X}=w,{sources:V}=A,J=["blog","article","page","policy"],[Z,ee]=h.useState(!1),[te,se]=h.useState(!1),[ie,oe]=h.useState(!1),[ne,le]=h.useState(0),[ae,re]=h.useState(),[de,ce]=h.useState(null!=W?W:{}),[ue,pe]=h.useState(!1),[ge,he]=h.useState(!1),xe={};I.intentConfig.forEach((t=>{let{key:s,type:i,tagText:o}=t;P[s]&&(xe[P[s]]=e.jsx(m.Tag,{theme:"light",type:i,tagText:o,cursor:"pointer"}))}));const je=V.filter((e=>"PRODUCTS"==e.type||"Products"==e.subTitle||e.productId)),Ce=V.filter((e=>"PRODUCTS"!=e.type&&"Products"!=e.subTitle&&!e.productId)),ye=h.useMemo((()=>{const e={};return["STORE_INFORMATION","CONTACT_INFO","STORE_LOCATION","SHIPPING_POLICY","RETURN_AND_REFUND","SALES_AND_OFFERS","SALES_AND_OFFERS_ISSUES","PRODUCT_CUSTOMISATION","PAYMENT_METHODS","CHECKOUT_ENQUIRY","ORDER_ENQUIRY"].forEach((t=>{P[t]&&(e[P[t]]=P[t])})),["COLLABORATION","SUBSCRIPTION_ENQUIRY"].forEach((t=>{e[t]=t})),e}),[P]);h.useEffect((()=>{var e,t,s,i;if(!(null==A?void 0:A.messageId))return;ee(!0),se(!0),oe(!1!==(null===(t=null===(e=A.sources)||void 0===e?void 0:e[0])||void 0===t?void 0:t.isTrainable)||!!(null===(i=null===(s=A.sources)||void 0===s?void 0:s[0])||void 0===i?void 0:i.insights));const o=A.sources.filter((e=>!!e.productId)).map((e=>e.productId)),n=Array.from(new Set(o)).filter((e=>!!e));G(_,n).then((e=>le(e))).then((()=>{W?(ce(W),setTimeout((()=>{ee(!1),se(!1)}),100)):(setTimeout((()=>ee(!1)),100),Q(_).then((e=>ce(e))).then((()=>setTimeout((()=>{se(!1)}),100))))}))}),[G,Q,null==A?void 0:A.messageId,A.sources,W,_]);const Oe=e=>!!(e&&0===e.length||(null==A?void 0:A.isUnsatisfactoryAnswer)),me=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;return"custom"==e?e=L.CustomDataType.FILES:J.includes(e)?e=L.CustomDataType.FETCHED_LINKS:"url"==e?e=L.CustomDataType.WEBSITE_LINKS:"text"===e?e=L.CustomDataType.TEXTS:"faq"===e&&(e=L.CustomDataType.FAQ),t?e:null===(s=null==e?void 0:e.toLowerCase())||void 0===s?void 0:s.replace(/_/g," ")},ve=e=>e?"faq"==e.toLocaleLowerCase()?"FAQ":"openai"==e.toLocaleLowerCase()?"OPENAI":"files"==e.toLocaleLowerCase()?"PDF":"texts"==e.toLocaleLowerCase()?"Custom text":((e=(e=e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).replace("_"," ")).endsWith("s")&&(e=e.slice(0,-1)),e.replace("Website","Manual")):"",fe=s=>"products"==s||"product"==s?e.jsx(t.default,{height:16,width:16,color:x.COLORS.content.secondary}):"files"==s?e.jsx(l.default,{height:16,width:16,color:x.COLORS.content.secondary}):"website links"==s||"fetched links"==s?e.jsx(g.default,{height:16,width:16,color:x.COLORS.content.secondary}):"faq"==s?e.jsx(a.default,{height:16,width:16,color:x.COLORS.content.secondary}):"texts"==s?e.jsx(p.default,{height:16,width:16,color:x.COLORS.content.secondary}):e.jsx(d.default,{height:16,width:16,color:x.COLORS.content.secondary}),Se=e=>{const t=e.replace(/(<([^>]+)>)/gi,""),s=document.createElement("textarea");return s.innerHTML=t,s.value};if(Z||!B)return e.jsx(T.SourceInfoDetailsStyle,{children:e.jsx(y.BikShimmer,{boxes:[{width:"100px",height:"16px"},{width:"0",height:"4px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"100%",height:"32px"},{width:"0",height:"4px"},{width:"100%",height:"16px"}]})});const Te=t=>{const{title:o,count:n,isExpanded:l,onToggle:a,children:r}=t;return e.jsxs("div",{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",cursor:"pointer"},onClick:a},{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[e.jsx(f.BodyCaption,Object.assign({style:{fontWeight:"600"}},{children:o})),R===E.__exports.ApplicationType.MANIFEST?e.jsx("div",Object.assign({style:{backgroundColor:x.COLORS.surface.subdued,color:x.COLORS.content.secondary,padding:"2px 8px",borderRadius:"12px",fontSize:"12px",fontWeight:"500"}},{children:n})):e.jsx(e.Fragment,{})]})),e.jsx(e.Fragment,{children:R===E.__exports.ApplicationType.BIK?e.jsx(e.Fragment,{}):l?e.jsx(s.default,{width:20,height:20,color:x.COLORS.content.primary}):e.jsx(i.default,{width:20,height:20,color:x.COLORS.content.primary})})]})),l&&r]})};return e.jsxs(e.Fragment,{children:[e.jsx(T.SourceInfoDetailsStyle,{children:e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({className:"pop-up-header",style:{display:"flex",flexDirection:"column",paddingBottom:"12px"}},{children:[!!M&&e.jsx(f.TitleSmall,{children:M}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",alignItems:"center"}},{children:[e.jsx(f.BodyCaption,Object.assign({color:x.COLORS.content.secondary},{children:"Intent"})),null!==(D=xe[A.intent])&&void 0!==D?D:xe.GENERIC,!q&&e.jsx("div",Object.assign({style:{display:"flex",marginLeft:"auto",cursor:"pointer"},onClick:()=>F(void 0)},{children:e.jsx(o.default,{height:20,width:20,color:x.COLORS.content.secondary})}))]})),Oe(V)?e.jsx("div",Object.assign({style:{display:"flex",margin:"auto",justifyContent:"center",alignItems:"center",height:"calc(100vh - 300px)"}},{children:(()=>{var t,s;return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",margin:"0px 30px",gap:"8px"}},{children:[e.jsx("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"12px",backgroundColor:`${x.COLORS.background.negative.light}`,borderRadius:"100px"}},{children:e.jsx(r.default,{width:24,height:24,color:x.COLORS.stroke.negative.vibrant})})),e.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",marginBottom:"-4px"}},{children:e.jsx(f.TitleSmall,{children:"Insufficient data"})})),e.jsx(f.BodySecondary,Object.assign({color:x.COLORS.content.secondary,style:{display:"flex",justifyContent:"center",textAlign:"center"}},{children:"No data available to answer this query. Add an FAQ to address it in the future"})),U&&e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(j.Button,{LeadingIcon:null!==(t=U.leadingIcon)&&void 0!==t?t:c.default,buttonText:null!==(s=U.title)&&void 0!==s?s:"Add FAQ",buttonType:"secondary",size:"small",matchParentWidth:!0,onClick:()=>{U.onClick()}})}))]}))})()})):e.jsx(m.Tag,{LeadingIcon:r.default,version:"2.0",type:"grey",theme:"light",alignIcon:"start",contentPadding:12,tagText:A.isEditable?`If any of the information is incorrect, update the original data source and sync it again. Alternatively, you can make local corrections directly in ${R===E.__exports.ApplicationType.BIK?"BIK":"Manifest"}.`:"Edit the original source and save again to update the response"})]})),!Oe(V)&&e.jsxs("div",Object.assign({className:"info-container"},{children:[e.jsx(e.Fragment,{children:je.length>0&&e.jsx("div",Object.assign({className:"info-product-source"},{children:e.jsx(Te,Object.assign({title:"Product Sources",count:je.length,isExpanded:R!==E.__exports.ApplicationType.MANIFEST||ue,onToggle:()=>pe(!ue)},{children:e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:je.map(((t,s)=>{var i,o,l,a;const r=me(t.type||t.subTitle||"OpenAI"),d=me(t.type||t.subTitle||"OpenAI",!0),c=ve(r),p=null==K?void 0:K.includes(d),g=k[null!==(i=t.productId)&&void 0!==i?i:"Products"],h=t.title,j=t.productId&&(null==Y?void 0:Y[t.productId]),y=j&&j.metafield.join(", ");return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:s+1<(null==je?void 0:je.length)?`1px solid ${x.COLORS.stroke.primary}`:"none"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[fe(r),e.jsx(v.Tooltip,Object.assign({body:h,placement:"top"},{children:e.jsx(f.BodySecondary,Object.assign({style:d==L.CustomDataType.FETCHED_LINKS||d==L.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:x.COLORS.content.primary,className:"clamp-title",onClick:()=>d==L.CustomDataType.FETCHED_LINKS||d==L.CustomDataType.WEBSITE_LINKS?H(t):{}},{children:h}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==P.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(f.BodyCaption,Object.assign({color:x.COLORS.content.secondary},{children:c}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:p?e.jsx(C.IconButton,{Icon:n.default,height:16,width:16,iconColor:x.COLORS.content.secondary,onClick:()=>null==g?void 0:g.onEditClick(g.data,g.type),disabled:!g,disabledTooltip:"This source is deleted"}):e.jsx(C.IconButton,{Icon:u.default,height:16,width:16,iconColor:x.COLORS.content.secondary,disabled:"custom"===t.type&&!g,disabledTooltip:"This source is deleted",onClick:()=>H(t)})}))]}))]})),j&&e.jsxs(f.BodyCaption,{children:[e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>{var e;re({title:h,description:Se(j.description),imageUrl:null!==(e=t.imageUrl)&&void 0!==e?e:"",onClose:()=>re(void 0)})}},{children:`${null===(o=j.description)||void 0===o?void 0:o.length} characters description,`})),e.jsx("span",Object.assign({className:"product-data-text1",onClick:()=>j.onEditFaqClick(j.faqs)},{children:`${null===(l=j.faqs)||void 0===l?void 0:l.length} FAQs, `})),e.jsx("span",Object.assign({className:"product-data-text2"},{children:"and"})),e.jsx(v.Tooltip,Object.assign({body:y,placement:"top"},{children:e.jsx("span",Object.assign({className:"product-data-text1"},{children:`${null===(a=j.metafield)||void 0===a?void 0:a.length} metafields`}))}))]})]}),`info-${s}`)}))}))}))}))}),e.jsx(e.Fragment,{children:Ce.length>0&&e.jsx("div",Object.assign({className:"info-content-source"},{children:e.jsx(Te,Object.assign({title:"Content Sources",count:Ce.length,isExpanded:R!==E.__exports.ApplicationType.MANIFEST||ge,onToggle:()=>he(!ge)},{children:e.jsx("div",Object.assign({className:"source",style:{padding:"0 12px",maxWidth:"100%"}},{children:Ce.map(((t,s)=>{var i,o,l,a,r,d,c,p,g,h,j,y,O,m,S,T,I;const b=me(t.type||t.subTitle||"OpenAI"),E=me(t.type||t.subTitle||"OpenAI",!0),w=ve(b),D=null==K?void 0:K.includes(E),N="Products"===t.subTitle?k[null!==(i=t.productId)&&void 0!==i?i:"Products"]:k[null!==(o=t.docId)&&void 0!==o?o:""],R=E.toLowerCase()===(null===(l=L.CustomDataType.FAQ)||void 0===l?void 0:l.toLowerCase())?"faq"===(null===(a=t.title)||void 0===a?void 0:a.toLowerCase())?t.subTitle:t.title:E.toLowerCase()===(null===(r=L.CustomDataType.FILES)||void 0===r?void 0:r.toLowerCase())||E.toLowerCase()===(null===(d=L.CustomDataType.FETCHED_LINKS)||void 0===d?void 0:d.toLowerCase())||E.toLowerCase()===(null===(c=L.CustomDataType.TEXTS)||void 0===c?void 0:c.toLowerCase())?t.title:E.toLowerCase()===(null===(p=L.CustomDataType.WEBSITE_LINKS)||void 0===p?void 0:p.toLowerCase())?t.title.split("/")[t.title.split("/").length-1].replace(/[^\w\s]/gi," ").replace(/^(.)(.*)$/,((e,t,s)=>t.toUpperCase()+s)):t.intent===P.EMAIL_COLLECTION?w:t.title,_="faq"===E.toLowerCase()?null!==(j=null!==(g=null==N?void 0:N.content)&&void 0!==g?g:null===(h=null==N?void 0:N.data)||void 0===h?void 0:h.answer)&&void 0!==j?j:"":E.toLowerCase()===(null===(y=L.CustomDataType.FETCHED_LINKS)||void 0===y?void 0:y.toLowerCase())||E.toLowerCase()===(null===(O=L.CustomDataType.WEBSITE_LINKS)||void 0===O?void 0:O.toLowerCase())||E.toLowerCase()===(null===(m=L.CustomDataType.TEXTS)||void 0===m?void 0:m.toLowerCase())?null!==(I=null!==(S=null==N?void 0:N.content)&&void 0!==S?S:null===(T=null==N?void 0:N.data)||void 0===T?void 0:T.fileContentText)&&void 0!==I?I:"":t.intent===P.EMAIL_COLLECTION?"Collect leads before replying to messages":"";return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"8px",padding:"16px 0px",borderBottom:s+1<(null==Ce?void 0:Ce.length)?`1px solid ${x.COLORS.stroke.primary}`:"none"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:"12px",justifyContent:"space-between",alignItems:"center"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,gap:"8px",flexDirection:"row",alignItems:"center",justifyContent:"flex-start"}},{children:[fe(b),e.jsx(v.Tooltip,Object.assign({body:R,placement:"top"},{children:e.jsx(f.BodySecondary,Object.assign({style:E==L.CustomDataType.FETCHED_LINKS||E==L.CustomDataType.WEBSITE_LINKS?{cursor:"pointer",textDecoration:"underline"}:{},color:x.COLORS.content.primary,className:"clamp-title",onClick:()=>E==L.CustomDataType.FETCHED_LINKS||E==L.CustomDataType.WEBSITE_LINKS?H(t):{}},{children:R}))}))]})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",alignItems:"center",gap:"4px",flex:"none"}},{children:[t.intent!==P.EMAIL_COLLECTION&&e.jsx(e.Fragment,{children:e.jsx(f.BodyCaption,Object.assign({color:x.COLORS.content.secondary},{children:w}))}),(t.link||t.docId)&&e.jsx("div",Object.assign({style:{cursor:"pointer",marginLeft:"0px"}},{children:D?e.jsx(C.IconButton,{Icon:n.default,height:16,width:16,iconColor:x.COLORS.content.secondary,onClick:()=>null==N?void 0:N.onEditClick(N.data,N.type),disabled:!N,disabledTooltip:"This source is deleted"}):e.jsx(C.IconButton,{Icon:u.default,height:16,width:16,iconColor:x.COLORS.content.secondary,disabled:"custom"===t.type&&!N,disabledTooltip:"This source is deleted",onClick:()=>H(t)})}))]}))]})),(null!=_?_:"").trim()&&e.jsx("div",Object.assign({style:{padding:"4px 8px",border:`1px dashed ${x.COLORS.stroke.primary}`,borderRadius:"4px",backgroundColor:x.COLORS.surface.subdued}},{children:e.jsx(f.BodyCaption,Object.assign({color:x.COLORS.content.primary,className:"clamp-description"},{children:Se(null!=_?_:"").trim()}))}))]}),`info-${s}`)}))}))}))}))})]})),ie&&!Oe(V)&&e.jsx("div",Object.assign({className:"footer"},{children:e.jsx(S.default,{appType:R,storeId:_,messageSource:A,sourceIntent:null!==(N=A.intent)&&void 0!==N?N:P.GENERIC,faqCount:ne,trainingSourceCount:de,ShowTrainingDataSource:ye,ChecklistType:P,footerButtonOption:$,isFooterLoading:te,reasonForAiGeneratedResponse:z,showAiResponseReason:X})}))]})}),ae&&e.jsx(O.SideModal,Object.assign({header:"Product description",onClose:()=>re(void 0),width:"30%"},{children:e.jsx(b.DescriptionModal,{title:ae.title,description:ae.description,imageUrl:ae.imageUrl,onClose:ae.onClose})}))]})};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const SourceInfoDetailsStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
2
|
export declare const WithoutContentSourceInfoDetailsStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
3
|
export declare const SourceInfoFooterStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
+
export declare const DataSourceCountStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
display: flex;
|
|
16
16
|
flex-direction: column;
|
|
17
17
|
gap: 8px;
|
|
18
|
+
background-color: ${o.COLORS.surface.hovered};
|
|
18
19
|
.source {
|
|
19
20
|
border-radius: 12px;
|
|
20
|
-
background-color: ${o.COLORS.surface.subdued};
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
.info-product-source {
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
display: flex;
|
|
26
26
|
flex-direction: column;
|
|
27
27
|
gap: 8px;
|
|
28
|
+
background-color: ${o.COLORS.surface.hovered};
|
|
28
29
|
|
|
29
30
|
.product-data-text1 {
|
|
30
31
|
padding: 2px;
|
|
@@ -41,7 +42,6 @@
|
|
|
41
42
|
}
|
|
42
43
|
.source {
|
|
43
44
|
border-radius: 12px;
|
|
44
|
-
background-color: ${o.COLORS.surface.subdued};
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
.pop-up-header {
|
|
@@ -157,4 +157,13 @@
|
|
|
157
157
|
display: flex;
|
|
158
158
|
gap: 8px;
|
|
159
159
|
}
|
|
160
|
-
`;
|
|
160
|
+
`;i.default.div`
|
|
161
|
+
display: flex;
|
|
162
|
+
align-items: center;
|
|
163
|
+
justify-content: center;
|
|
164
|
+
width: 24px;
|
|
165
|
+
height: 24px;
|
|
166
|
+
background-color: ${o.COLORS.surface.subdued};
|
|
167
|
+
border-radius: 22px;
|
|
168
|
+
border: 1px solid ${o.COLORS.stroke.primary};
|
|
169
|
+
`,exports.SourceInfoDetailsStyle=l,exports.SourceInfoFooterStyle=p;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CalendarProps } from 'react-calendar';
|
|
3
3
|
import { CSSProperties } from 'styled-components';
|
|
4
|
-
|
|
5
|
-
DEFAULT = "default",
|
|
6
|
-
LARGE = "large"
|
|
7
|
-
}
|
|
4
|
+
import { DateButtonType } from './model';
|
|
8
5
|
export declare const DatePickerWrapper: React.FC<{
|
|
9
6
|
val?: Date | Date[];
|
|
10
7
|
onChange: (val: Date | Date[]) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("react-calendar"),a=require("../../hooks/useOutside.js"),n=require("../../utils/DateUtils.js"),o=require("../../constants/Theme.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("react-calendar"),a=require("../../hooks/useOutside.js"),n=require("../../utils/DateUtils.js"),o=require("../../constants/Theme.js"),i=require("../../assets/icons/calendar.svg.js"),s=require("../TypographyStyle.js"),l=require("./DatePickerWrapper.styled.js"),u=require("./model.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=c(r);exports.DatePickerWrapper=r=>{let{val:c,onChange:O,calendarProps:y,disabled:D,pickerStyles:S,nativeID:g,maxDate:p,minDate:C,dateButtonType:L,dateButtonStyles:j}=r;const[v,b]=t.useState(!1),m=t.useRef(null),R=t.useRef(null);a.useOutside(R,(()=>{b(!1)}));const f=()=>{var e,t,r,a;return c?Array.isArray(c)?(null===(e=null==c?void 0:c[0])||void 0===e?void 0:e.toString())&&(null===(t=null==c?void 0:c[1])||void 0===t?void 0:t.toString())?`${new Date(null===(r=null==c?void 0:c[0])||void 0===r?void 0:r.toString()).toLocaleDateString()}-${new Date(null===(a=null==c?void 0:c[1])||void 0===a?void 0:a.toString()).toLocaleDateString()}`:`${n.default.getPastDate(new Date,30).toLocaleDateString()}-${(new Date).toLocaleDateString()}`:new Date(c.toString()).toLocaleDateString():(new Date).toLocaleDateString()};return e.jsxs(e.Fragment,{children:[e.jsxs(l.DateBtn,Object.assign({id:g,ref:m,bgColor:D?o.COLORS.background.base:o.COLORS.surface.standard,borderColor:o.COLORS.stroke.primary,onClick:()=>b(!v),dateButtonType:L||u.DateButtonType.DEFAULT,style:j},{children:[L===u.DateButtonType.LARGE?e.jsx(s.BodyPrimary,Object.assign({style:{color:D?o.COLORS.content.inactive:o.COLORS.content.primary,flex:1}},{children:f()})):e.jsx(s.BodySecondary,Object.assign({style:{color:D?o.COLORS.content.inactive:o.COLORS.content.primary,flex:1}},{children:f()})),e.jsx(i.default,{width:L===u.DateButtonType.LARGE?24:20,height:L===u.DateButtonType.LARGE?24:20,color:D?o.COLORS.content.inactive:o.COLORS.content.primary})]})),v&&!D&&e.jsx(l.PickerContainer,Object.assign({ref:R,style:Object.assign({},S),contentPrimary:o.COLORS.content.primary,subDued:o.COLORS.surface.subdued,brandColor:o.COLORS.background.brand,bgColor:o.COLORS.surface.standard,borderColor:o.COLORS.stroke.primary},{children:e.jsx(d.default,Object.assign({tileClassName:["custom__tile"],className:["custom__calendar"],onChange:e=>{O(e),b(!1)},maxDate:p,minDate:C,value:c?Array.isArray(c)?2===c.length?[new Date(c[0]),new Date(c[1])]:null:new Date(c):null},y))}))]})};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),r=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),r=require("./model.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=o(e);const a=t.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
padding: 5px 8px;
|
|
4
4
|
background: ${e=>e.bgColor};
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
gap: 8px;
|
|
12
12
|
position: relative;
|
|
13
13
|
height: ${e=>e.dateButtonType===r.DateButtonType.LARGE?"48px":"32px"};
|
|
14
|
-
`,n=
|
|
14
|
+
`,n=t.default.div`
|
|
15
15
|
position: absolute;
|
|
16
16
|
top: calc(100% + 8px);
|
|
17
17
|
zindex: 9;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e;Object.defineProperty(exports,"__esModule",{value:!0}),exports.DateButtonType=void 0,(e=exports.DateButtonType||(exports.DateButtonType={})).DEFAULT="default",e.LARGE="large";
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DISCOUNT_TYPES } from "..";
|
|
3
2
|
import { COUPON_EXPIRATION, DISCOUNT_APPLIES_TO, ICouponData, IDynamicDiscountValidationError, MIN_PURCHASE_REQUIREMENT, OFFER_APPLIES_TO } from "../type";
|
|
4
3
|
import { SingleOption } from "../../dropdown/type";
|
|
5
4
|
import { Collection, Product } from "../../product-picker/type";
|
|
6
5
|
import { VariableListInterfaceV3 } from '../../variable-picker-v3/model';
|
|
7
|
-
import { ProductVariable } from '../type';
|
|
6
|
+
import { DISCOUNT_TYPES, ProductVariable } from '../type';
|
|
8
7
|
export declare enum DISCOUNT_PRODUCTS {
|
|
9
8
|
ENTITLED = "entitled",
|
|
10
9
|
PREREQUISITE = "prerequisite"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),i=require("react/jsx-runtime"),t=require("../../../assets/icons/info.svg.js"),o=require("../../alerts/Alert.js"),s=require("../../alerts/AlertHelper.js"),n=require("../../button/Button.js"),r=require("../../checkBox/CheckBox.js");require("../../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js"),require("react");var l=require("../type.js");require("../../dropdown/DropdownPopover/index.js");var a=require("../../dropdown/Dropdown.js");require("../../dropdown/ChipDropdown.js"),require("../../zeroState/ZeroState.js");var d=require("../../TypographyStyle.js"),c=require("../../../constants/Theme.js");require("../../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../../list-item/ListItem.js"),require("../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../../icon-button/IconButton.js");var u=require("../../input/Input.js"),p=require("../../../assets/icons/cross.svg.js");require("../../dropdown/MenuItem/MenuItem.js"),require("../../modals/styledModal.js"),require("../../../node_modules/lodash.debounce/index.js"),require("../../bik-layout/CommonStyles.js"),require("../../product-picker/ProductPicker.styled.js"),require("../../../utils/DateUtils.js"),require("../../tag/Tag.js"),require("../../tooltips/Tooltip.js"),require("../../product-picker-v2/modal.js"),require("../../variable-picker-v3/model.js"),require("../../modals/modal.styled.js");var T=require("../../../assets/icons/plus.svg.js");require("../../accordion/Accordion.style.js"),require("../../accordion/AccordionArrow.js"),require("../../switch/Switch.js"),require("../../variable-picker-v3/NoResult.js"),require("../../variable-picker-v3/styles.js"),require("lodash");var C,E=require("../DiscountModal.styled.js"),D=require("../CouponExpiration/CouponExpiration.js"),O=require("../../radioButton/RadioButton.js"),S=require("../../../assets/icons/cubeIcon.svg.js"),P=require("../../../assets/icons/delete.svg.js"),I=require("../../../assets/icons/edit.svg.js"),x=require("./DynamicCoupon.styled.js"),v=require("./MinimumRequirementComponent.js"),j=require("./ZeroState.js");exports.DISCOUNT_PRODUCTS=void 0,(C=exports.DISCOUNT_PRODUCTS||(exports.DISCOUNT_PRODUCTS={})).ENTITLED="entitled",C.PREREQUISITE="prerequisite";exports.default=C=>{var _,b,m,g,y,h,U,R;const N=[{selected:C.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER,label:"Entire Order",value:l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER},{selected:C.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS,label:"Specific Product",value:l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS},{selected:C.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS}],V=[{selected:C.offerAppliesToBuy===l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS,label:"Specific Product",value:l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS},{selected:C.offerAppliesToBuy===l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS}],A=[{selected:C.offerAppliesToGet===l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS,label:"Specific Product",value:l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS},{selected:C.offerAppliesToGet===l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS}],q=(e,r,a)=>{var u,E,D,O,v,j,_,b,m,g,y,h;let U=[],R=[],N={},V={};C.useNewPicker?(N=r===exports.DISCOUNT_PRODUCTS.ENTITLED?C.entitledProducts:C.prerequisiteProducts,V=null!==(u=r===exports.DISCOUNT_PRODUCTS.ENTITLED?C.entitledCollections:C.prerequisiteCollections)&&void 0!==u?u:[],(null==N?void 0:N.isCustom)&&delete N.isCustom,(null==V?void 0:V.isCustom)&&delete V.isCustom,Object.values(N).forEach((e=>{Object.keys(e.products).forEach((i=>{U.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(V).forEach((e=>{"isCustom"!==e&&R.push({id:e,name:V[e].name,image:V[e].image})}))):(U=r===exports.DISCOUNT_PRODUCTS.ENTITLED?C.entitledProducts:C.prerequisiteProducts,R=null!==(E=r===exports.DISCOUNT_PRODUCTS.ENTITLED?C.entitledCollections:C.prerequisiteCollections)&&void 0!==E?E:[]);const A=[null===(D=C.dynamicDiscountValidationError)||void 0===D?void 0:D.inValidProductSelection,null===(O=C.dynamicDiscountValidationError)||void 0===O?void 0:O.inValidProductVariableSelection,null===(v=C.dynamicDiscountValidationError)||void 0===v?void 0:v.inValidCollectionSelection],q=[null===(j=C.dynamicDiscountValidationError)||void 0===j?void 0:j.inValidBuyXCollectionSelection,null===(_=C.dynamicDiscountValidationError)||void 0===_?void 0:_.inValidBuyXProductSelection,null===(b=C.dynamicDiscountValidationError)||void 0===b?void 0:b.inValidBuyXProductVariableSelection],L=[null===(m=C.dynamicDiscountValidationError)||void 0===m?void 0:m.inValidGetYCollectionSelection,null===(g=C.dynamicDiscountValidationError)||void 0===g?void 0:g.inValidGetYProductSelection,null===(y=C.dynamicDiscountValidationError)||void 0===y?void 0:y.inValidGetYProductVariableSelection];let f=!1;return"couponAppliesTo"===a&&(f=A.some(Boolean)),"buyX"===a&&(f=q.some(Boolean)),"getY"===a&&(f=L.some(Boolean)),i.jsxs(i.Fragment,{children:[i.jsxs("div",Object.assign({style:{display:"flex",gap:18}},{children:[e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS&&0===U.length&&(r===exports.DISCOUNT_PRODUCTS.ENTITLED&&!C.entitledProductVariable||r===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&!C.preRequisiteProductVariable)&&!(null==R?void 0:R.length)&&i.jsxs(x.AddProductButtonsContainer,{children:[i.jsx("div",Object.assign({style:{width:C.isProductVariableSupported?"284px":"300px",display:"flex"}},{children:i.jsx(n.Button,{buttonText:"Add Product(s)",buttonType:"dashRegular",LeadingIcon:T.default,matchParentWidth:!0,onClick:()=>{C.setIsProductPickerOpen(r)},error:f})})),C.isProductVariableSupported&&C.productVariableList&&i.jsxs(i.Fragment,{children:[i.jsx(d.BodySecondary,Object.assign({color:c.DEFAULT_THEME.colorsV2.content.placeholder},{children:"OR"})),i.jsx(n.Button,{buttonText:"Add Product(s) Variable",buttonType:"dashRegular",LeadingIcon:T.default,matchParentWidth:!0,onClick:()=>{C.setIsProductVariablePickerOpen(r)},error:f})]})]}),e===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS&&0===R.length&&!(null==U?void 0:U.length)&&i.jsx("div",Object.assign({style:{width:"300px",display:"flex"}},{children:i.jsx(n.Button,{buttonText:"Add collection(s)",buttonType:"dashRegular",LeadingIcon:T.default,matchParentWidth:!0,onClick:()=>{C.setIsCollectionPickerOpen(r)},style:{marginTop:"16px"},error:f})}))]})),f&&i.jsx("div",Object.assign({style:{margin:"8px 0 0"}},{children:i.jsx(o.Alert,{type:s.ALERT_TYPES.NEGATIVE,text:"Required Field",contentPosition:s.CONTENT_POSITION.START,icon:()=>i.jsx(t.default,{width:16,height:16,color:c.DEFAULT_THEME.colorsV2.content.negative})})})),U.length||R.length?i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{margin:"8px 0"}},{children:e===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS?"Collection(s)":"Product(s)"})),i.jsxs(x.ProductCollectionCard,{children:[i.jsx(x.CubeIconContainer,{children:i.jsx(S.default,{width:20,height:20,color:c.DEFAULT_THEME.colorsV2.content.secondary})}),i.jsxs(d.TitleSmall,{children:[e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?U.length:R.length," ",e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?"Product(s)":"Collection(s)"," ","added"]}),i.jsxs("div",Object.assign({style:{display:"flex",gap:4}},{children:[i.jsx(x.IconContainer,Object.assign({onClick:()=>{e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?C.setIsProductPickerOpen(r):C.setIsCollectionPickerOpen(r)}},{children:i.jsx(I.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.placeholder})})),i.jsx(x.IconContainer,Object.assign({onClick:()=>{e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?r===exports.DISCOUNT_PRODUCTS.ENTITLED?C.setEntitledProducts([]):C.setPrerequisiteProducts([]):r===exports.DISCOUNT_PRODUCTS.ENTITLED?C.setEntitledCollections([]):C.setPrerequisiteCollections([])}},{children:i.jsx(P.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.placeholder})}))]}))]})]}):r===exports.DISCOUNT_PRODUCTS.ENTITLED&&C.entitledProductVariable?i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i.jsxs(x.ProductVariableCard,{children:[i.jsx(d.TitleSmall,{children:C.entitledProductVariable.displayName}),i.jsx("div",Object.assign({style:{display:"flex",gap:4}},{children:i.jsx(x.IconContainer,Object.assign({onClick:()=>{C.setEntitledProductVariable(void 0)}},{children:i.jsx(p.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.primary})}))}))]})]}):r===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&(null===(h=C.preRequisiteProductVariable)||void 0===h?void 0:h.displayName)?i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i.jsxs(x.ProductVariableCard,{children:[i.jsx(d.TitleSmall,{children:C.preRequisiteProductVariable.displayName}),i.jsx("div",Object.assign({style:{display:"flex",gap:4}},{children:i.jsx(x.IconContainer,Object.assign({onClick:()=>{C.setPreRequisiteProductVariable(void 0)}},{children:i.jsx(p.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.primary})}))}))]})]}):i.jsx(i.Fragment,{children:" "})]})},L=(e,t)=>{var o,s,n,r,c,p,T,E,D,O;let S=[],P=[],I={},x={};C.useNewPicker?(I=e===exports.DISCOUNT_PRODUCTS.ENTITLED?C.entitledProducts:C.prerequisiteProducts,x=null!==(o=e===exports.DISCOUNT_PRODUCTS.ENTITLED?C.entitledCollections:C.prerequisiteCollections)&&void 0!==o?o:[],(null==I?void 0:I.isCustom)&&delete I.isCustom,(null==x?void 0:x.isCustom)&&delete x.isCustom,Object.values(I).forEach((e=>{Object.keys(e.products).forEach((i=>{S.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(x).forEach((e=>{"isCustom"!==e&&P.push({id:e,name:x[e].name,image:x[e].image})}))):(S=e===exports.DISCOUNT_PRODUCTS.ENTITLED?C.entitledProducts:C.prerequisiteProducts,P=null!==(s=e===exports.DISCOUNT_PRODUCTS.ENTITLED?C.entitledCollections:C.prerequisiteCollections)&&void 0!==s?s:[]);const v=e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?C.offerAppliesToBuy:C.offerAppliesToGet,j=e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?exports.DISCOUNT_PRODUCTS.PREREQUISITE:exports.DISCOUNT_PRODUCTS.ENTITLED,_=v===l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS?l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS:l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS;return i.jsxs("div",{children:[i.jsx(d.TitleSmall,Object.assign({style:{marginBottom:16}},{children:e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?"Customer buys":"Customer gets"})),i.jsxs("div",Object.assign({style:{display:"flex"}},{children:[!t&&i.jsx("div",{children:i.jsxs("div",Object.assign({className:"input__rows"},{children:[i.jsx("div",Object.assign({className:"input__wrapper"},{children:i.jsx(u.Input,{value:e===exports.DISCOUNT_PRODUCTS.ENTITLED?null!==(r=null===(n=C.discountData.entitledQuantity)||void 0===n?void 0:n.toString())&&void 0!==r?r:"":null!==(p=null===(c=C.discountData.prerequisiteQuantity)||void 0===c?void 0:c.toString())&&void 0!==p?p:"",type:"number",onChangeText:i=>{e===exports.DISCOUNT_PRODUCTS.ENTITLED?C.setDiscountData(Object.assign(Object.assign({},C.discountData),{entitledQuantity:parseInt(i)})):C.setDiscountData(Object.assign(Object.assign({},C.discountData),{prerequisiteQuantity:parseInt(i)}))},labelText:"Quantity of products",placeholder:"Eg. 2",width:"300px",errorMessage:e===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&(null===(T=C.dynamicDiscountValidationError)||void 0===T?void 0:T.inValidBuyXValue)||e===exports.DISCOUNT_PRODUCTS.ENTITLED&&(null===(E=C.dynamicDiscountValidationError)||void 0===E?void 0:E.inValidGetYValue)?"Required Field":"",state:e===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&(null===(D=C.dynamicDiscountValidationError)||void 0===D?void 0:D.inValidBuyXValue)||e===exports.DISCOUNT_PRODUCTS.ENTITLED&&(null===(O=C.dynamicDiscountValidationError)||void 0===O?void 0:O.inValidGetYValue)?"invalid":"none"})})),i.jsx("div",{className:"input__wrapper"})]}))}),i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{marginBottom:8}},{children:"Any items from"})),e===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&i.jsx(a.Dropdown,{width:"244px",options:V,placement:"bottom-start",onSelect:e=>{var i,t,o;C.setOfferAppliesToBuy(e.value),C.setPrerequisiteProducts([]),C.setPrerequisiteCollections([]),C.setPreRequisiteProductVariable(void 0),C.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidBuyXCollectionSelection:!1,inValidBuyXProductSelection:!1,inValidBuyXProductVariableSelection:!1}))),C.setDiscountData(Object.assign(Object.assign({},C.discountData),{prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:null===(i=C.discountData.collectionsConf)||void 0===i?void 0:i.entitledCollections,prerequisiteCollections:{}},productsConf:{entitledProducts:null===(t=C.discountData.productsConf)||void 0===t?void 0:t.entitledProducts,prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:null===(o=C.discountData.productVariableConf)||void 0===o?void 0:o.entitledProductVariable,prerequisiteProductVariable:{}}}))}}),e===exports.DISCOUNT_PRODUCTS.ENTITLED&&i.jsx(a.Dropdown,{width:"244px",options:A,placement:"bottom-start",onSelect:e=>{var i,t,o;C.setOfferAppliesToGet(e.value),C.setEntitledProducts([]),C.setEntitledCollections([]),C.setEntitledProductVariable(void 0),C.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidGetYCollectionSelection:!1,inValidGetYProductSelection:!1,inValidGetYProductVariableSelection:!1}))),C.setDiscountData(Object.assign(Object.assign({},C.discountData),{entitledCollectionIds:[],entitledProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:null===(i=C.discountData.collectionsConf)||void 0===i?void 0:i.prerequisiteCollections},productsConf:{entitledProducts:{},prerequisiteProducts:null===(t=C.discountData.productsConf)||void 0===t?void 0:t.prerequisiteProducts},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:null===(o=C.discountData.productVariableConf)||void 0===o?void 0:o.prerequisiteProductVariable}}))}})]})]})),q(_,j,e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?"buyX":"getY")]})};return i.jsxs(E.DynamicCouponContainer,{children:[i.jsxs("div",{children:[i.jsxs("div",Object.assign({style:{display:"flex",gap:16}},{children:[i.jsx("div",Object.assign({className:"input__wrapper"},{children:i.jsx(u.Input,{value:null!==(_=C.discountData.title)&&void 0!==_?_:"",onChangeText:e=>{var i;C.setDiscountData(Object.assign(Object.assign({},C.discountData),{title:null!==(i=null==e?void 0:e.trim())&&void 0!==i?i:""}))},maxCharLimit:30,labelText:"Discount Coupon Title",placeholder:`Eg. “Flat ${null!==(b=C.currency)&&void 0!==b?b:""} 15 Off”`,hintText:"Will be same for everyone. Can’t be changed later",width:"300px",isRequired:!0,errorMessage:(null===(m=C.dynamicDiscountValidationError)||void 0===m?void 0:m.invalidCouponTitle)?"Required Field":"",state:(null===(g=C.dynamicDiscountValidationError)||void 0===g?void 0:g.invalidCouponTitle)?"invalid":"none"})})),!C.hideProbability&&i.jsx(u.Input,{value:null!==(h=null===(y=C.discountData.probability)||void 0===y?void 0:y.toString())&&void 0!==h?h:"",type:"number",onChangeText:e=>{C.setDiscountData(Object.assign(Object.assign({},C.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability of getting coupon ",hintText:"Enter a decimal value between 0-1",placeholder:"Eg. 0.5",maxCharLimit:4,width:"300px",isRequired:!0,errorMessage:(null===(U=C.dynamicDiscountValidationError)||void 0===U?void 0:U.inValidProbability)?"Required Field":"",state:(null===(R=C.dynamicDiscountValidationError)||void 0===R?void 0:R.inValidProbability)?"invalid":"none"})]})),i.jsx("div",{style:{height:"1px",width:"100%",background:c.DEFAULT_THEME.colorsV2.stroke.primary,margin:"24px 0 8px"}})]}),C.allowStaticCoupon&&i.jsx((()=>i.jsxs("div",{children:[i.jsx(d.TitleRegular,{children:"Discount Details"}),i.jsx(x.DiscountOptionsContainer,{children:C.discountDetailsOptions.map((t=>{return i.jsxs(x.DiscountDetailsOption,Object.assign({selected:C.selectedDiscountDetails.id===t.id,onClick:()=>(i=>{if(C.selectedDiscountDetails.id!==i.id)if(C.resetValidationErrors(),C.setValidationErrorMessage(""),C.setDiscountCouponAppliesTo(l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER),C.setSelectedDiscountDetails(i),C.setDiscountData(Object.assign(Object.assign({},C.discountData),{value:void 0})),C.setPreRequisiteProductVariable(void 0),C.setEntitledProductVariable(void 0),["percentage","amount"].includes(i.value)){C.onChangeCouponType({label:"Amount off on order",selected:!0,value:l.DISCOUNT_TYPES.AMOUNT_OFF_ORDER});const t=Object.assign(Object.assign({},C.discountData),{valueType:"percentage"===i.value?l.DISCOUNT_VALUE_TYPES.PERCENTAGE:l.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,value:void 0,targetType:l.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:l.DISCOUNT_TARGET_SELECTION.ALL,entitledCollectionIds:[],entitledProductIds:[],prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:{}},productsConf:{entitledProducts:{},prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:{}}}),o=e.__rest(t,["entitledQuantity","prerequisiteQuantity"]);C.setDiscountData(o)}else C.onChangeCouponType({label:i.label,selected:!0,value:i.value})})(t)},{children:[t.icon((o=t.id,C.selectedDiscountDetails.id===o?c.DEFAULT_THEME.colorsV2.stroke.brand:c.DEFAULT_THEME.colorsV2.text.secondary)),t.label]}),t.id);var o}))})]})),{}),(C.selectedCouponType===l.DISCOUNT_TYPES.AMOUNT_OFF_ORDER||C.selectedCouponType===l.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS)&&(()=>{var e,t,o,s,n,r;return i.jsxs(i.Fragment,{children:[i.jsx("div",Object.assign({className:"input__rows"},{children:i.jsx("div",Object.assign({className:"input__wrapper"},{children:i.jsx(u.Input,{value:null!==(o=null===(t=null===(e=C.discountData)||void 0===e?void 0:e.value)||void 0===t?void 0:t.toString())&&void 0!==o?o:"",labelText:"Discount amount",type:"number",width:"300px",onChangeText:e=>{C.setDiscountData(Object.assign(Object.assign({},C.discountData),{value:parseInt(e)}))},placeholder:"15",prefixText:C.discountData.valueType===l.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?null!==(s=C.currency)&&void 0!==s?s:"":void 0,suffixText:C.discountData.valueType===l.DISCOUNT_VALUE_TYPES.PERCENTAGE?"%":void 0,errorMessage:(null===(n=C.dynamicDiscountValidationError)||void 0===n?void 0:n.inValidDiscountAmount)?"Required Field":"",state:(null===(r=C.dynamicDiscountValidationError)||void 0===r?void 0:r.inValidDiscountAmount)?"invalid":"none"})}))})),i.jsx("div",Object.assign({style:{paddingTop:"24px",marginTop:16,borderTop:`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`}},{children:i.jsxs("div",Object.assign({className:"input__wrapper"},{children:[i.jsx(d.TitleRegular,Object.assign({style:{marginBottom:10}},{children:"Applies to"})),i.jsx("div",Object.assign({style:{display:"flex",flexGrow:0,flexShrink:0,flexBasis:"auto"}},{children:i.jsx(a.Dropdown,{width:"300px",options:N,placement:"bottom-start",onSelect:e=>{const i="value"in e&&e.value===l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER?{label:"Amount off on order",selected:!0,value:l.DISCOUNT_TYPES.AMOUNT_OFF_ORDER}:{label:"Amount off on products",selected:!0,value:l.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS};C.onChangeCouponType(i),C.setDiscountCouponAppliesTo(e.value),C.setEntitledProductVariable(void 0),C.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidProductVariableSelection:!1,inValidProductSelection:!1,inValidCollectionSelection:!1})))}})})),(C.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS||C.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS)&&q(C.discountCouponAppliesTo,exports.DISCOUNT_PRODUCTS.ENTITLED,"couponAppliesTo")]}))}))]})})(),C.selectedCouponType===l.DISCOUNT_TYPES.BUY_X_GET_Y&&(()=>{var e,t,o,s,n;return i.jsxs(E.DynamicCouponContainer,Object.assign({style:{border:`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`,padding:"16px",borderRadius:"4px",margin:0}},{children:[L(exports.DISCOUNT_PRODUCTS.PREREQUISITE),i.jsx("div",{style:{width:"100%",height:"1px",backgroundColor:c.DEFAULT_THEME.colorsV2.stroke.primary,margin:"8px 0"}}),L(exports.DISCOUNT_PRODUCTS.ENTITLED),i.jsx(d.BodySecondary,Object.assign({style:{marginTop:"8px"}},{children:"At a discounted value"})),i.jsx("div",{children:i.jsx(O.RadioButton,{label:"Free",isActive:100===C.discountData.value,onValueChange:e=>{e?C.setDiscountData(Object.assign(Object.assign({},C.discountData),{value:100})):C.setDiscountData(Object.assign(Object.assign({},C.discountData),{value:void 0}))}})}),i.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[i.jsx(O.RadioButton,{label:"Percentage off",isActive:100!==C.discountData.value,onValueChange:()=>{C.setDiscountData(Object.assign(Object.assign({},C.discountData),{value:void 0}))}}),100!==C.discountData.value&&i.jsx("div",Object.assign({style:{marginTop:8}},{children:i.jsx(u.Input,{value:null!==(o=null===(t=null===(e=C.discountData)||void 0===e?void 0:e.value)||void 0===t?void 0:t.toString())&&void 0!==o?o:"",onChangeText:e=>{C.setDiscountData(Object.assign(Object.assign({},C.discountData),{value:parseInt(e)}))},type:"number",placeholder:"Eg. 50",suffixText:"%",width:"300px",errorMessage:(null===(s=C.dynamicDiscountValidationError)||void 0===s?void 0:s.inValidDiscountAmount)?"Required Field":"",state:(null===(n=C.dynamicDiscountValidationError)||void 0===n?void 0:n.inValidDiscountAmount)?"invalid":"none"})}))]}))]}))})(),!C.selectedCouponType&&i.jsx(j.default,{}),C.allowStaticCoupon&&C.selectedCouponType!==l.DISCOUNT_TYPES.BUY_X_GET_Y&&i.jsx("div",Object.assign({style:{padding:"24px 0 16px",marginTop:16,borderTop:`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`}},{children:i.jsx(v.default,{selectedMinimumRequirement:C.selectedMinimumRequirement,setSelectedMinimumRequirement:C.setSelectedMinimumRequirement,discountData:C.discountData,setDiscountData:C.setDiscountData,currency:C.currency,dynamicDiscountValidationError:C.dynamicDiscountValidationError})})),C.selectedCouponType&&!C.hideExpiration&&i.jsxs("div",Object.assign({style:{padding:C.selectedCouponType!==l.DISCOUNT_TYPES.BUY_X_GET_Y?"24px 0 16px":"8px 0",borderTop:C.selectedCouponType!==l.DISCOUNT_TYPES.BUY_X_GET_Y?`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`:"none"}},{children:[i.jsx(r.CheckBox,{label:"Add expiration",isDisabled:!!C.makeExpiryMandatory,isChecked:C.isAddExpirationChecked,onValueChange:e=>{C.setIsAddExpirationChecked(e),C.setDiscountData(Object.assign(Object.assign({},C.discountData),{expireAfter:void 0,expireAt:void 0})),C.setSelectedExpiration(l.COUPON_EXPIRATION.DYNAMIC_EXPIRATION)},boldOnChecked:!0,labelSize:"DEFAULT"}),i.jsx(d.BodySecondary,Object.assign({style:{color:c.DEFAULT_THEME.colorsV2.text.secondary,marginLeft:28}},{children:"Make coupon only valid till a certain time"})),C.isAddExpirationChecked&&i.jsx(D.CouponExpiration,{discountData:C.discountData,setDiscountData:C.setDiscountData,isAddExpirationChecked:C.isAddExpirationChecked,inValidCouponExpiry:C.dynamicDiscountValidationError.inValidCouponExpiry,selectedExpiration:C.selectedExpiration,setSelectedExpiration:C.setSelectedExpiration})]}))]})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),i=require("react/jsx-runtime"),t=require("../../../assets/icons/info.svg.js"),o=require("../../alerts/Alert.js"),s=require("../../alerts/AlertHelper.js"),n=require("../../button/Button.js"),r=require("../../checkBox/CheckBox.js"),l=require("../type.js");require("../../dropdown/DropdownPopover/index.js");var a=require("../../dropdown/Dropdown.js");require("../../dropdown/ChipDropdown.js"),require("react"),require("../../zeroState/ZeroState.js");var d=require("../../TypographyStyle.js"),c=require("../../../constants/Theme.js");require("../../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../../list-item/ListItem.js"),require("../../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../../icon-button/IconButton.js");var u=require("../../input/Input.js"),p=require("../../../assets/icons/cross.svg.js");require("../../dropdown/MenuItem/MenuItem.js");var T,C=require("../../radioButton/RadioButton.js"),E=require("../../../assets/icons/cubeIcon.svg.js"),D=require("../../../assets/icons/delete.svg.js"),O=require("../../../assets/icons/edit.svg.js"),S=require("../../../assets/icons/plus.svg.js"),P=require("../CouponExpiration/CouponExpiration.js"),I=require("../DiscountModal.styled.js"),x=require("./DynamicCoupon.styled.js"),v=require("./MinimumRequirementComponent.js"),_=require("./ZeroState.js");exports.DISCOUNT_PRODUCTS=void 0,(T=exports.DISCOUNT_PRODUCTS||(exports.DISCOUNT_PRODUCTS={})).ENTITLED="entitled",T.PREREQUISITE="prerequisite";exports.default=T=>{var j,b,g,m,y,U,h,R;const N=[{selected:T.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER,label:"Entire Order",value:l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER},{selected:T.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS,label:"Specific Product",value:l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS},{selected:T.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS}],V=[{selected:T.offerAppliesToBuy===l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS,label:"Specific Product",value:l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS},{selected:T.offerAppliesToBuy===l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS}],A=[{selected:T.offerAppliesToGet===l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS,label:"Specific Product",value:l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS},{selected:T.offerAppliesToGet===l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS,label:"Specific Collections",value:l.OFFER_APPLIES_TO.SPECIFIC_COLLECTIONS}],L=(e,r,a)=>{var u,C,P,I,v,_,j,b,g,m,y,U;let h=[],R=[],N={},V={};T.useNewPicker?(N=r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledProducts:T.prerequisiteProducts,V=null!==(u=r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledCollections:T.prerequisiteCollections)&&void 0!==u?u:[],(null==N?void 0:N.isCustom)&&delete N.isCustom,(null==V?void 0:V.isCustom)&&delete V.isCustom,Object.values(N).forEach((e=>{Object.keys(e.products).forEach((i=>{h.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(V).forEach((e=>{"isCustom"!==e&&R.push({id:e,name:V[e].name,image:V[e].image})}))):(h=r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledProducts:T.prerequisiteProducts,R=null!==(C=r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledCollections:T.prerequisiteCollections)&&void 0!==C?C:[]);const A=[null===(P=T.dynamicDiscountValidationError)||void 0===P?void 0:P.inValidProductSelection,null===(I=T.dynamicDiscountValidationError)||void 0===I?void 0:I.inValidProductVariableSelection,null===(v=T.dynamicDiscountValidationError)||void 0===v?void 0:v.inValidCollectionSelection],L=[null===(_=T.dynamicDiscountValidationError)||void 0===_?void 0:_.inValidBuyXCollectionSelection,null===(j=T.dynamicDiscountValidationError)||void 0===j?void 0:j.inValidBuyXProductSelection,null===(b=T.dynamicDiscountValidationError)||void 0===b?void 0:b.inValidBuyXProductVariableSelection],f=[null===(g=T.dynamicDiscountValidationError)||void 0===g?void 0:g.inValidGetYCollectionSelection,null===(m=T.dynamicDiscountValidationError)||void 0===m?void 0:m.inValidGetYProductSelection,null===(y=T.dynamicDiscountValidationError)||void 0===y?void 0:y.inValidGetYProductVariableSelection];let F=!1;return"couponAppliesTo"===a&&(F=A.some(Boolean)),"buyX"===a&&(F=L.some(Boolean)),"getY"===a&&(F=f.some(Boolean)),i.jsxs(i.Fragment,{children:[i.jsxs("div",Object.assign({style:{display:"flex",gap:18}},{children:[e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS&&0===h.length&&(r===exports.DISCOUNT_PRODUCTS.ENTITLED&&!T.entitledProductVariable||r===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&!T.preRequisiteProductVariable)&&!(null==R?void 0:R.length)&&i.jsxs(x.AddProductButtonsContainer,{children:[i.jsx("div",Object.assign({style:{width:T.isProductVariableSupported?"284px":"300px",display:"flex"}},{children:i.jsx(n.Button,{buttonText:"Add Product(s)",buttonType:"dashRegular",LeadingIcon:S.default,matchParentWidth:!0,onClick:()=>{T.setIsProductPickerOpen(r)},error:F})})),T.isProductVariableSupported&&T.productVariableList&&i.jsxs(i.Fragment,{children:[i.jsx(d.BodySecondary,Object.assign({color:c.DEFAULT_THEME.colorsV2.content.placeholder},{children:"OR"})),i.jsx(n.Button,{buttonText:"Add Product(s) Variable",buttonType:"dashRegular",LeadingIcon:S.default,matchParentWidth:!0,onClick:()=>{T.setIsProductVariablePickerOpen(r)},error:F})]})]}),e===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS&&0===R.length&&!(null==h?void 0:h.length)&&i.jsx("div",Object.assign({style:{width:"300px",display:"flex"}},{children:i.jsx(n.Button,{buttonText:"Add collection(s)",buttonType:"dashRegular",LeadingIcon:S.default,matchParentWidth:!0,onClick:()=>{T.setIsCollectionPickerOpen(r)},style:{marginTop:"16px"},error:F})}))]})),F&&i.jsx("div",Object.assign({style:{margin:"8px 0 0"}},{children:i.jsx(o.Alert,{type:s.ALERT_TYPES.NEGATIVE,text:"Required Field",contentPosition:s.CONTENT_POSITION.START,icon:()=>i.jsx(t.default,{width:16,height:16,color:c.DEFAULT_THEME.colorsV2.content.negative})})})),h.length||R.length?i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{margin:"8px 0"}},{children:e===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS?"Collection(s)":"Product(s)"})),i.jsxs(x.ProductCollectionCard,{children:[i.jsx(x.CubeIconContainer,{children:i.jsx(E.default,{width:20,height:20,color:c.DEFAULT_THEME.colorsV2.content.secondary})}),i.jsxs(d.TitleSmall,{children:[e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?h.length:R.length," ",e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?"Product(s)":"Collection(s)"," ","added"]}),i.jsxs("div",Object.assign({style:{display:"flex",gap:4}},{children:[i.jsx(x.IconContainer,Object.assign({onClick:()=>{e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?T.setIsProductPickerOpen(r):T.setIsCollectionPickerOpen(r)}},{children:i.jsx(O.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.placeholder})})),i.jsx(x.IconContainer,Object.assign({onClick:()=>{e===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS?r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.setEntitledProducts([]):T.setPrerequisiteProducts([]):r===exports.DISCOUNT_PRODUCTS.ENTITLED?T.setEntitledCollections([]):T.setPrerequisiteCollections([])}},{children:i.jsx(D.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.placeholder})}))]}))]})]}):r===exports.DISCOUNT_PRODUCTS.ENTITLED&&T.entitledProductVariable?i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i.jsxs(x.ProductVariableCard,{children:[i.jsx(d.TitleSmall,{children:T.entitledProductVariable.displayName}),i.jsx("div",Object.assign({style:{display:"flex",gap:4}},{children:i.jsx(x.IconContainer,Object.assign({onClick:()=>{T.setEntitledProductVariable(void 0)}},{children:i.jsx(p.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.primary})}))}))]})]}):r===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&(null===(U=T.preRequisiteProductVariable)||void 0===U?void 0:U.displayName)?i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{margin:"16px 0 8px"}},{children:"Product Variable"})),i.jsxs(x.ProductVariableCard,{children:[i.jsx(d.TitleSmall,{children:T.preRequisiteProductVariable.displayName}),i.jsx("div",Object.assign({style:{display:"flex",gap:4}},{children:i.jsx(x.IconContainer,Object.assign({onClick:()=>{T.setPreRequisiteProductVariable(void 0)}},{children:i.jsx(p.default,{width:24,height:24,color:c.DEFAULT_THEME.colorsV2.content.primary})}))}))]})]}):i.jsx(i.Fragment,{children:" "})]})},f=(e,t)=>{var o,s,n,r,c,p,C,E,D,O;let S=[],P=[],I={},x={};T.useNewPicker?(I=e===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledProducts:T.prerequisiteProducts,x=null!==(o=e===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledCollections:T.prerequisiteCollections)&&void 0!==o?o:[],(null==I?void 0:I.isCustom)&&delete I.isCustom,(null==x?void 0:x.isCustom)&&delete x.isCustom,Object.values(I).forEach((e=>{Object.keys(e.products).forEach((i=>{S.push({id:i,name:e.products[i].name,image:e.products[i].image})}))})),Object.keys(x).forEach((e=>{"isCustom"!==e&&P.push({id:e,name:x[e].name,image:x[e].image})}))):(S=e===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledProducts:T.prerequisiteProducts,P=null!==(s=e===exports.DISCOUNT_PRODUCTS.ENTITLED?T.entitledCollections:T.prerequisiteCollections)&&void 0!==s?s:[]);const v=e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?T.offerAppliesToBuy:T.offerAppliesToGet,_=e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?exports.DISCOUNT_PRODUCTS.PREREQUISITE:exports.DISCOUNT_PRODUCTS.ENTITLED,j=v===l.OFFER_APPLIES_TO.SPECIFIC_PRODUCTS?l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS:l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS;return i.jsxs("div",{children:[i.jsx(d.TitleSmall,Object.assign({style:{marginBottom:16}},{children:e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?"Customer buys":"Customer gets"})),i.jsxs("div",Object.assign({style:{display:"flex"}},{children:[!t&&i.jsx("div",{children:i.jsxs("div",Object.assign({className:"input__rows"},{children:[i.jsx("div",Object.assign({className:"input__wrapper"},{children:i.jsx(u.Input,{value:e===exports.DISCOUNT_PRODUCTS.ENTITLED?null!==(r=null===(n=T.discountData.entitledQuantity)||void 0===n?void 0:n.toString())&&void 0!==r?r:"":null!==(p=null===(c=T.discountData.prerequisiteQuantity)||void 0===c?void 0:c.toString())&&void 0!==p?p:"",type:"number",onChangeText:i=>{e===exports.DISCOUNT_PRODUCTS.ENTITLED?T.setDiscountData(Object.assign(Object.assign({},T.discountData),{entitledQuantity:parseInt(i)})):T.setDiscountData(Object.assign(Object.assign({},T.discountData),{prerequisiteQuantity:parseInt(i)}))},labelText:"Quantity of products",placeholder:"Eg. 2",width:"300px",errorMessage:e===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&(null===(C=T.dynamicDiscountValidationError)||void 0===C?void 0:C.inValidBuyXValue)||e===exports.DISCOUNT_PRODUCTS.ENTITLED&&(null===(E=T.dynamicDiscountValidationError)||void 0===E?void 0:E.inValidGetYValue)?"Required Field":"",state:e===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&(null===(D=T.dynamicDiscountValidationError)||void 0===D?void 0:D.inValidBuyXValue)||e===exports.DISCOUNT_PRODUCTS.ENTITLED&&(null===(O=T.dynamicDiscountValidationError)||void 0===O?void 0:O.inValidGetYValue)?"invalid":"none"})})),i.jsx("div",{className:"input__wrapper"})]}))}),i.jsxs("div",{children:[i.jsx(d.BodySecondary,Object.assign({style:{marginBottom:8}},{children:"Any items from"})),e===exports.DISCOUNT_PRODUCTS.PREREQUISITE&&i.jsx(a.Dropdown,{width:"244px",options:V,placement:"bottom-start",onSelect:e=>{var i,t,o;T.setOfferAppliesToBuy(e.value),T.setPrerequisiteProducts([]),T.setPrerequisiteCollections([]),T.setPreRequisiteProductVariable(void 0),T.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidBuyXCollectionSelection:!1,inValidBuyXProductSelection:!1,inValidBuyXProductVariableSelection:!1}))),T.setDiscountData(Object.assign(Object.assign({},T.discountData),{prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:null===(i=T.discountData.collectionsConf)||void 0===i?void 0:i.entitledCollections,prerequisiteCollections:{}},productsConf:{entitledProducts:null===(t=T.discountData.productsConf)||void 0===t?void 0:t.entitledProducts,prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:null===(o=T.discountData.productVariableConf)||void 0===o?void 0:o.entitledProductVariable,prerequisiteProductVariable:{}}}))}}),e===exports.DISCOUNT_PRODUCTS.ENTITLED&&i.jsx(a.Dropdown,{width:"244px",options:A,placement:"bottom-start",onSelect:e=>{var i,t,o;T.setOfferAppliesToGet(e.value),T.setEntitledProducts([]),T.setEntitledCollections([]),T.setEntitledProductVariable(void 0),T.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidGetYCollectionSelection:!1,inValidGetYProductSelection:!1,inValidGetYProductVariableSelection:!1}))),T.setDiscountData(Object.assign(Object.assign({},T.discountData),{entitledCollectionIds:[],entitledProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:null===(i=T.discountData.collectionsConf)||void 0===i?void 0:i.prerequisiteCollections},productsConf:{entitledProducts:{},prerequisiteProducts:null===(t=T.discountData.productsConf)||void 0===t?void 0:t.prerequisiteProducts},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:null===(o=T.discountData.productVariableConf)||void 0===o?void 0:o.prerequisiteProductVariable}}))}})]})]})),L(j,_,e===exports.DISCOUNT_PRODUCTS.PREREQUISITE?"buyX":"getY")]})};return i.jsxs(I.DynamicCouponContainer,{children:[i.jsxs("div",{children:[i.jsxs("div",Object.assign({style:{display:"flex",gap:16}},{children:[i.jsx("div",Object.assign({className:"input__wrapper"},{children:i.jsx(u.Input,{value:null!==(j=T.discountData.title)&&void 0!==j?j:"",onChangeText:e=>{var i;T.setDiscountData(Object.assign(Object.assign({},T.discountData),{title:null!==(i=null==e?void 0:e.trim())&&void 0!==i?i:""}))},maxCharLimit:30,labelText:"Discount Coupon Title",placeholder:`Eg. “Flat ${null!==(b=T.currency)&&void 0!==b?b:""} 15 Off”`,hintText:"Will be same for everyone. Can’t be changed later",width:"300px",isRequired:!0,errorMessage:(null===(g=T.dynamicDiscountValidationError)||void 0===g?void 0:g.invalidCouponTitle)?"Required Field":"",state:(null===(m=T.dynamicDiscountValidationError)||void 0===m?void 0:m.invalidCouponTitle)?"invalid":"none"})})),!T.hideProbability&&i.jsx(u.Input,{value:null!==(U=null===(y=T.discountData.probability)||void 0===y?void 0:y.toString())&&void 0!==U?U:"",type:"number",onChangeText:e=>{T.setDiscountData(Object.assign(Object.assign({},T.discountData),{probability:e.startsWith(".")?parseFloat(parseFloat(`0${e}`).toFixed(2)):parseFloat(parseFloat(e).toFixed(2))}))},labelText:"Probability of getting coupon ",hintText:"Enter a decimal value between 0-1",placeholder:"Eg. 0.5",maxCharLimit:4,width:"300px",isRequired:!0,errorMessage:(null===(h=T.dynamicDiscountValidationError)||void 0===h?void 0:h.inValidProbability)?"Required Field":"",state:(null===(R=T.dynamicDiscountValidationError)||void 0===R?void 0:R.inValidProbability)?"invalid":"none"})]})),i.jsx("div",{style:{height:"1px",width:"100%",background:c.DEFAULT_THEME.colorsV2.stroke.primary,margin:"24px 0 8px"}})]}),T.allowStaticCoupon&&i.jsx((()=>i.jsxs("div",{children:[i.jsx(d.TitleRegular,{children:"Discount Details"}),i.jsx(x.DiscountOptionsContainer,{children:T.discountDetailsOptions.map((t=>{return i.jsxs(x.DiscountDetailsOption,Object.assign({selected:T.selectedDiscountDetails.id===t.id,onClick:()=>(i=>{if(T.selectedDiscountDetails.id!==i.id)if(T.resetValidationErrors(),T.setValidationErrorMessage(""),T.setDiscountCouponAppliesTo(l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER),T.setSelectedDiscountDetails(i),T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:void 0})),T.setPreRequisiteProductVariable(void 0),T.setEntitledProductVariable(void 0),["percentage","amount"].includes(i.value)){T.onChangeCouponType({label:"Amount off on order",selected:!0,value:l.DISCOUNT_TYPES.AMOUNT_OFF_ORDER});const t=Object.assign(Object.assign({},T.discountData),{valueType:"percentage"===i.value?l.DISCOUNT_VALUE_TYPES.PERCENTAGE:l.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT,value:void 0,targetType:l.DISCOUNT_TARGET_TYPES.LINE_ITEM,targetSelection:l.DISCOUNT_TARGET_SELECTION.ALL,entitledCollectionIds:[],entitledProductIds:[],prerequisiteCollectionIds:[],prerequisiteProductIds:[],collectionsConf:{entitledCollections:{},prerequisiteCollections:{}},productsConf:{entitledProducts:{},prerequisiteProducts:{}},productVariableConf:{entitledProductVariable:{},prerequisiteProductVariable:{}}}),o=e.__rest(t,["entitledQuantity","prerequisiteQuantity"]);T.setDiscountData(o)}else T.onChangeCouponType({label:i.label,selected:!0,value:i.value})})(t)},{children:[t.icon((o=t.id,T.selectedDiscountDetails.id===o?c.DEFAULT_THEME.colorsV2.stroke.brand:c.DEFAULT_THEME.colorsV2.text.secondary)),t.label]}),t.id);var o}))})]})),{}),(T.selectedCouponType===l.DISCOUNT_TYPES.AMOUNT_OFF_ORDER||T.selectedCouponType===l.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS)&&(()=>{var e,t,o,s,n,r;return i.jsxs(i.Fragment,{children:[i.jsx("div",Object.assign({className:"input__rows"},{children:i.jsx("div",Object.assign({className:"input__wrapper"},{children:i.jsx(u.Input,{value:null!==(o=null===(t=null===(e=T.discountData)||void 0===e?void 0:e.value)||void 0===t?void 0:t.toString())&&void 0!==o?o:"",labelText:"Discount amount",type:"number",width:"300px",onChangeText:e=>{T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:parseInt(e)}))},placeholder:"15",prefixText:T.discountData.valueType===l.DISCOUNT_VALUE_TYPES.FIXED_AMOUNT?null!==(s=T.currency)&&void 0!==s?s:"":void 0,suffixText:T.discountData.valueType===l.DISCOUNT_VALUE_TYPES.PERCENTAGE?"%":void 0,errorMessage:(null===(n=T.dynamicDiscountValidationError)||void 0===n?void 0:n.inValidDiscountAmount)?"Required Field":"",state:(null===(r=T.dynamicDiscountValidationError)||void 0===r?void 0:r.inValidDiscountAmount)?"invalid":"none"})}))})),i.jsx("div",Object.assign({style:{paddingTop:"24px",marginTop:16,borderTop:`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`}},{children:i.jsxs("div",Object.assign({className:"input__wrapper"},{children:[i.jsx(d.TitleRegular,Object.assign({style:{marginBottom:10}},{children:"Applies to"})),i.jsx("div",Object.assign({style:{display:"flex",flexGrow:0,flexShrink:0,flexBasis:"auto"}},{children:i.jsx(a.Dropdown,{width:"300px",options:N,placement:"bottom-start",onSelect:e=>{const i="value"in e&&e.value===l.DISCOUNT_APPLIES_TO.ENTIRE_ORDER?{label:"Amount off on order",selected:!0,value:l.DISCOUNT_TYPES.AMOUNT_OFF_ORDER}:{label:"Amount off on products",selected:!0,value:l.DISCOUNT_TYPES.AMOUNT_OFF_PRODUCTS};T.onChangeCouponType(i),T.setDiscountCouponAppliesTo(e.value),T.setEntitledProductVariable(void 0),T.setDynamicDiscountValidationError((e=>Object.assign(Object.assign({},e),{inValidProductVariableSelection:!1,inValidProductSelection:!1,inValidCollectionSelection:!1})))}})})),(T.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_PRODUCTS||T.discountCouponAppliesTo===l.DISCOUNT_APPLIES_TO.SPECIFIC_COLLECTIONS)&&L(T.discountCouponAppliesTo,exports.DISCOUNT_PRODUCTS.ENTITLED,"couponAppliesTo")]}))}))]})})(),T.selectedCouponType===l.DISCOUNT_TYPES.BUY_X_GET_Y&&(()=>{var e,t,o,s,n;return i.jsxs(I.DynamicCouponContainer,Object.assign({style:{border:`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`,padding:"16px",borderRadius:"4px",margin:0}},{children:[f(exports.DISCOUNT_PRODUCTS.PREREQUISITE),i.jsx("div",{style:{width:"100%",height:"1px",backgroundColor:c.DEFAULT_THEME.colorsV2.stroke.primary,margin:"8px 0"}}),f(exports.DISCOUNT_PRODUCTS.ENTITLED),i.jsx(d.BodySecondary,Object.assign({style:{marginTop:"8px"}},{children:"At a discounted value"})),i.jsx("div",{children:i.jsx(C.RadioButton,{label:"Free",isActive:100===T.discountData.value,onValueChange:e=>{e?T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:100})):T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:void 0}))}})}),i.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[i.jsx(C.RadioButton,{label:"Percentage off",isActive:100!==T.discountData.value,onValueChange:()=>{T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:void 0}))}}),100!==T.discountData.value&&i.jsx("div",Object.assign({style:{marginTop:8}},{children:i.jsx(u.Input,{value:null!==(o=null===(t=null===(e=T.discountData)||void 0===e?void 0:e.value)||void 0===t?void 0:t.toString())&&void 0!==o?o:"",onChangeText:e=>{T.setDiscountData(Object.assign(Object.assign({},T.discountData),{value:parseInt(e)}))},type:"number",placeholder:"Eg. 50",suffixText:"%",width:"300px",errorMessage:(null===(s=T.dynamicDiscountValidationError)||void 0===s?void 0:s.inValidDiscountAmount)?"Required Field":"",state:(null===(n=T.dynamicDiscountValidationError)||void 0===n?void 0:n.inValidDiscountAmount)?"invalid":"none"})}))]}))]}))})(),!T.selectedCouponType&&i.jsx(_.default,{}),T.allowStaticCoupon&&T.selectedCouponType!==l.DISCOUNT_TYPES.BUY_X_GET_Y&&i.jsx("div",Object.assign({style:{padding:"24px 0 16px",marginTop:16,borderTop:`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`}},{children:i.jsx(v.default,{selectedMinimumRequirement:T.selectedMinimumRequirement,setSelectedMinimumRequirement:T.setSelectedMinimumRequirement,discountData:T.discountData,setDiscountData:T.setDiscountData,currency:T.currency,dynamicDiscountValidationError:T.dynamicDiscountValidationError})})),T.selectedCouponType&&!T.hideExpiration&&i.jsxs("div",Object.assign({style:{padding:T.selectedCouponType!==l.DISCOUNT_TYPES.BUY_X_GET_Y?"24px 0 16px":"8px 0",borderTop:T.selectedCouponType!==l.DISCOUNT_TYPES.BUY_X_GET_Y?`1px solid ${c.DEFAULT_THEME.colorsV2.stroke.primary}`:"none"}},{children:[i.jsx(r.CheckBox,{label:"Add expiration",isDisabled:!!T.makeExpiryMandatory,isChecked:T.isAddExpirationChecked,onValueChange:e=>{T.setIsAddExpirationChecked(e),T.setDiscountData(Object.assign(Object.assign({},T.discountData),{expireAfter:void 0,expireAt:void 0})),T.setSelectedExpiration(l.COUPON_EXPIRATION.DYNAMIC_EXPIRATION)},boldOnChecked:!0,labelSize:"DEFAULT"}),i.jsx(d.BodySecondary,Object.assign({style:{color:c.DEFAULT_THEME.colorsV2.text.secondary,marginLeft:28}},{children:"Make coupon only valid till a certain time"})),T.isAddExpirationChecked&&i.jsx(P.CouponExpiration,{discountData:T.discountData,setDiscountData:T.setDiscountData,isAddExpirationChecked:T.isAddExpirationChecked,inValidCouponExpiry:T.dynamicDiscountValidationError.inValidCouponExpiry,selectedExpiration:T.selectedExpiration,setSelectedExpiration:T.setSelectedExpiration})]}))]})};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { DropdownProps } from
|
|
2
|
+
import { DropdownProps } from './Dropdown';
|
|
3
3
|
export declare const ChipDropdown: React.FC<DropdownProps>;
|
|
4
4
|
export declare const ChipDropdownContainer: import("styled-components").StyledComponent<"div", any, {
|
|
5
5
|
width?: string | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),r=require("react"),i=require("styled-components"),o=require("../tag/Tag.js"),n=require("../../constants/Theme.js"),s=require("../../assets/icons/chevronDown.svg.js"),l=require("../../assets/icons/chevronDownOutline.svg.js"),a=require("../../assets/icons/chevronUpOutline.svg.js"),d=require("../TypographyStyle.js"),u=require("./DropdownPopover/index.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=p(i);const h=i=>{var{placeHolder:p,onSelect:c}=i,h=e.__rest(i,["placeHolder","onSelect"]);const[j,x]=r.useState(!1),v=r.useRef();return t.jsx(u.DropdownPopover,Object.assign({ref:v,onDropdownVisbilityChange:e=>x(e),onSelect:function(e){null==c||c(e)}},h,{children:"default"==h.inputType?t.jsxs(g,Object.assign({width:null==h?void 0:h.width,height:null==h?void 0:h.height},{children:[t.jsx(d.BodySecondary,Object.assign({color:n.COLORS.content.placeholder},{children:p})),t.jsx(s.default,{style:{transform:j?"rotate(180deg)":"rotate(0deg)"},width:20,height:20,color:n.COLORS.content.primary})]})):t.jsx(o.Tag,{tagText:null!=p?p:"",theme:"light",type:"neutral",variant:"regular",TrailingIcon:j?a.default:l.default})}))};h.displayName="ChipDropdown";const g=c.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: row;
|
|
4
4
|
width: ${e=>(null==e?void 0:e.width)?e.width:"240px"};
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
gap: 8px;
|
|
7
7
|
justify-content: space-between;
|
|
8
8
|
align-items: center;
|
|
9
|
-
border: 1px solid ${
|
|
9
|
+
border: 1px solid ${n.COLORS.stroke.primary};
|
|
10
10
|
border-radius: 4px;
|
|
11
11
|
padding-left: 8px;
|
|
12
12
|
padding-right: 8px;
|
|
13
13
|
cursor: pointer;
|
|
14
|
-
`;exports.ChipDropdown=h,exports.ChipDropdownContainer=
|
|
14
|
+
`;exports.ChipDropdown=h,exports.ChipDropdownContainer=g;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("../../../assets/icons/horizontal_dots.svg.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("../../../assets/icons/horizontal_dots.svg.js"),s=require("../../../assets/icons/vertical_dots.svg.js"),o=require("styled-components"),t=require("../../icon-button/IconButton.js"),i=require("../../../constants/Theme.js"),n=require("../DropdownPopover/index.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const a=d(o).default.div`
|
|
2
2
|
:hover {
|
|
3
|
-
background: ${
|
|
3
|
+
background: ${i.COLORS.surface.subdued};
|
|
4
4
|
}
|
|
5
5
|
position: ${e=>e.isNewTag?"relative":""};
|
|
6
6
|
.new--tag {
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
border-radius: 50%;
|
|
12
12
|
width: 14px;
|
|
13
13
|
height: 14px;
|
|
14
|
-
background: ${
|
|
15
|
-
border: 1.25px solid ${
|
|
14
|
+
background: ${i.COLORS.background.negative.vibrant};
|
|
15
|
+
border: 1.25px solid ${i.COLORS.surface.standard};
|
|
16
16
|
display: flex;
|
|
17
17
|
justify-content: center;
|
|
18
18
|
align-items: center;
|
|
19
19
|
}
|
|
20
|
-
`,
|
|
20
|
+
`,u=o=>e.jsx(a,Object.assign({isNewTag:o.isNewTag},{children:e.jsxs(n.DropdownPopover,Object.assign({},o,{children:[e.jsx("div",{children:e.jsx(t.IconButton,{Icon:o.isHorizontal?r.default:s.default,bordered:!(null==o?void 0:o.hideBorder)})}),o.isNewTag?e.jsx("div",{className:"new--tag"}):null]}))}));u.displayName="MenuItemDropdown",exports.MenuItemDropdown=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("../../assets/icons/chevronRight2.svg.js"),t=require("react"),i=require("../../constants/Theme.js"),o=require("../TypographyStyle.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),n=require("../../assets/icons/chevronRight2.svg.js"),t=require("react"),i=require("../../constants/Theme.js"),o=require("../TypographyStyle.js"),s=require("./MultiLevelDropdown.styled.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=r(t);const d=l.default.lazy((()=>Promise.resolve().then((function(){return require("./MenuList.js")})).then((e=>({default:e.MenuList})))));exports.MenuItem=r=>{let{width:a,onDropdownItemClick:c,option:u,parents:p}=r;var h,j,g,v,O,b,C;const[x,f]=l.default.useState(!1),[S,m]=l.default.useState(!1),[L,y]=l.default.useState({top:0,left:0}),M=t.useRef({top:0,left:0});return e.jsxs(s.MenuItemWrapper,Object.assign({onMouseEnter:e=>{f(!0),(e=>{const n=e.currentTarget.getBoundingClientRect();y({top:n.top,left:n.right}),M.current={top:n.top,left:n.right}})(e)},onMouseLeave:()=>{f(!1)},onClick:()=>{var e,n;!c||null!==(e=u.disabled)&&void 0!==e&&e||(null===(n=u.children)||void 0===n?void 0:n.length)||c(u,p)},id:"menuItemWrapper",style:{cursor:null!==(h=u.disabled)&&void 0!==h&&h?"not-allowed":"pointer",backgroundColor:null!==(j=u.disabled)&&void 0!==j&&j?i.COLORS.surface.standard:"transparent"}},{children:[u.customComponent?u.customComponent:e.jsxs(s.MenuItemContainer,Object.assign({isSelected:u.selected,isSubMenuOpen:x,isHovered:S,isDisabled:null!==(g=u.disabled)&&void 0!==g&&g},{children:[e.jsxs(s.ContentContainer,{children:[u.leadingIcon&&e.jsx(s.LeadingIconContainer,{children:u.leadingIcon}),e.jsxs("div",{children:[e.jsx(o.BodyCaption,Object.assign({style:{color:null!==(v=u.disabled)&&void 0!==v&&v?i.COLORS.content.inactive:u.selected||S?i.COLORS.content.positive:i.COLORS.content.primary}},{children:u.label})),u.subText&&e.jsx(o.BodyTiny,Object.assign({style:{color:null!==(O=u.disabled)&&void 0!==O&&O?i.COLORS.content.inactive:u.selected||S?i.COLORS.content.positive:i.COLORS.content.secondary,marginTop:"2px"}},{children:u.subText}))]})]}),u.children&&u.children.length>0?e.jsx(s.TrailingIconContainer,{children:e.jsx(n.default,{width:16,height:16,color:null!==(b=u.disabled)&&void 0!==b&&b?i.COLORS.content.inactive:u.selected||S?i.COLORS.content.positive:i.COLORS.content.primary})}):u.trailingIcon?e.jsx(s.TrailingIconContainer,{children:u.trailingIcon}):e.jsx(e.Fragment,{})]})),!(null!==(C=u.disabled)&&void 0!==C&&C)&&u.children&&u.children.length>0&&x&&e.jsx(s.SubMenuContainer,Object.assign({width:a,className:"submenu",onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1)},{children:e.jsx(s.StyledSubMenuWrapper,Object.assign({width:a,top:L.top,left:L.left},{children:e.jsx(s.SubMenuListContainer,{children:e.jsx(t.Suspense,Object.assign({fallback:e.jsx("div",{children:"Loading..."})},{children:e.jsx(d,{width:a,onDropdownItemClick:c,options:u.children,parents:[...p,u]})}))})}))}))]}))};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ApplicationType } from '@bikdotai/bik-models/growth/models/bik-store';
|
|
3
3
|
import { ButtonProps } from '../button/model';
|
|
4
|
-
import { FooterForNonModalI, OUT_OF_STOCK_ACTION } from './type';
|
|
4
|
+
import { FooterForNonModalI, OUT_OF_STOCK_ACTION, ScreenName } from './type';
|
|
5
5
|
export interface ProductVariant {
|
|
6
6
|
name: string;
|
|
7
7
|
price: string;
|
|
@@ -58,13 +58,6 @@ export type FbStatusFetcherReturn = Promise<{
|
|
|
58
58
|
[key: string]: FbProductStatus;
|
|
59
59
|
}>;
|
|
60
60
|
export type FbProductStatus = 'APPROVED' | 'REJECTED';
|
|
61
|
-
export declare enum ScreenName {
|
|
62
|
-
Collections = "collections",
|
|
63
|
-
RearrangeProducts = "rearrange",
|
|
64
|
-
SelectedProducts = "view",
|
|
65
|
-
SearchProducts = "searchProducts",
|
|
66
|
-
Products = "products"
|
|
67
|
-
}
|
|
68
61
|
export type ProductPickerInterface = {
|
|
69
62
|
hideGlobalSearch?: boolean;
|
|
70
63
|
hideInCollectionSearch?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");require("../../node_modules/@bikdotai/bik-models/growth/models/bik-store.js");var t=require("../../assets/icons/search.svg.js"),o=require("react"),c=require("../../constants/Theme.js"),r=require("../../assets/icons/cross.svg.js"),s=require("../button/Button.js"),n=require("../input/Input.js"),i=require("../modals/styledModal.js"),l=require("../spinner/Spinner.js"),a=require("../tag/Tag.js"),d=require("./collectionScreen.js"),u=require("./productInfoOverlay.js"),h=require("./productScreen.js"),p=require("./rearrangeScreen.js"),S=require("./reducers.js"),C=require("./searchScreen.js"),g=require("./selectedScreen.js"),y=require("./style.js"),j=require("./type.js"),x=require("./utility.js"),b=require("../../_virtual/bik-store.js");exports.ProductPickerModal=m=>{const{storeId:f,selectedItems:v,onClose:k,visible:I,zIndex:O,exactLimit:F,limit:P,hideCollectionCheckbox:T,hideProductCheckbox:R,outOfStockAction:D=j.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:q,selectProductsFromCustomCollection:E,hideSelectionCount:N,title:A,width:B,left:w,renderWithoutModal:L,onClickSave:M,pickerType:V,hideProductVariants:_=!1,startupScreen:z=j.ScreenName.Collections,rearrangeEnabled:$,selectSingleItem:H=!1,showProductDetails:K,containerStyle:W,crossButtonInsideHeader:G=!1,footerForNonModal:U={},primaryButton:Y,secondaryButton:J,subtitle:Q}=m,X=m.appType||b.__exports.ApplicationType.BIK,[Z,ee]=o.useReducer(S.collectionsReducer,{}),[te,oe]=o.useState([j.ScreenName.Collections,j.ScreenName.RearrangeProducts].includes(z)?z:j.ScreenName.Collections),[ce,re]=o.useState("grid"),[se,ne]=o.useState(""),[ie,le]=o.useState(""),[ae,de]=o.useState(0),[ue,he]=o.useState(!1),[pe,Se]=o.useState(0),[Ce,ge]=o.useState(""),[ye,je]=o.useState(!1),[xe,be]=o.useState(!1),[me,fe]=o.useReducer(S.searchReducer,{collections:{},products:{}}),[ve,ke]=o.useReducer(S.selectedColectionsReducer,Object.keys(v).length>0?v:{}),Ie=o.useRef(null),[Oe,Fe]=o.useState(!1),[Pe,Te]=o.useState();o.useEffect((()=>{he(!0),be(!0),m.collectionFetcher(ae,f,X).then((e=>{ee({type:"fetched",data:(null==e?void 0:e.collections)||{}}),he(!1),de((e=>e+1)),be(!1)})).catch()}),[]),o.useEffect((()=>{let e=0;_?Object.keys(ve||[]).forEach((t=>{var o;Object.keys((null===(o=ve[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&ve[-1]&&(null===(c=ve[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(ve||[]).forEach((t=>{var o;Object.keys((null===(o=ve[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=ve[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),Se(e)}),[Z,ve,_]),o.useEffect((()=>{ie&&(he(!0),m.productFetcher(ie,f,X).then((e=>{Object.keys(e).length&&ee({type:"productsFetched",data:{collectionId:ie,products:e}}),he(!1)})).catch())}),[ie]),o.useEffect((()=>{const e=setTimeout((()=>{"rearrange"!==te&&(Ce.length||"collections"!==te)&&(Ce.length?(je(!0),m.searchFetcher(f,Ce,X).then((e=>{"collections"in e&&"products"in e?(fe({type:"set",data:e}),ee({type:"searched",data:e.collections}),ee({type:"searched",data:e.products})):(fe({type:"set",data:{collections:{},products:e}}),ee({type:"searched",data:e})),oe("searchProducts"),he(!1),je(!1)}))):oe("collections"))}),800);return()=>clearTimeout(e)}),[Ce]),o.useEffect((()=>{M&&(m.onAdd(ve,pe),Re())}),[M]),o.useEffect((()=>{H&&Object.keys(ve||{}).length&&pe&&(m.onAdd(ve,pe),Re())}),[H,ve,pe]);const Re=()=>{ke({type:"reset",data:{}})},De=()=>F&&pe>F?e.jsx(a.Tag,{tagText:`You can only select ${F} products`,type:"negative"}):P&&pe>P?e.jsx(a.Tag,{tagText:`You can only select ${P} products`,type:"negative"}):pe>0?e.jsx(s.Button,{onClick:()=>{oe($?j.ScreenName.RearrangeProducts:j.ScreenName.SelectedProducts)},buttonText:F?`${pe}/${F} products selected`:`${pe} products selected`,buttonType:["rearrange","view"].includes(te)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(te)}):e.jsx(s.Button,{disabled:!0,buttonText:F?`${pe}/${F} products selected`:`${pe} products selected`,buttonType:"tertiaryGray"}),qe=e=>ue?"Loading...":te===j.ScreenName.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",Ee=e.jsxs(y.ContainerStyle,Object.assign({style:null!=W?W:{}},{children:[m.postHeader&&e.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:m.postHeader})),!m.hideGlobalSearch&&e.jsx(e.Fragment,{children:("collections"===te||"searchProducts"===te)&&e.jsx("div",Object.assign({style:{padding:L?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(n.Input,{placeholder:"Search using ID, Name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>ye?e.jsx(l.Spinner,{size:"small",color:c.COLORS.content.primary}):e.jsx(t.default,{})},id:"listInput",height:"24px",type:"text",value:Ce,onChangeText:e=>{e.length&&e.trim().length?ge(e):ge("")}})}))}),e.jsxs(y.ScrollContainerStyle,Object.assign({ref:Ie,screenName:te},{children:["collections"===te&&e.jsx(d.CollectionsScreen,{customCollectionRestriction:m.customCollectionRestriction,dataLoading:xe,collections:Z,selectedCollectionsDispatch:ke,setCollectionId:ne,setSelectedCollectionId:le,setScreen:oe,selectedCollections:ve,collectionFetcher:m.collectionFetcher,storeId:f,appType:X,collectionsDispatch:ee,setSaveDisabled:he,pagingControls:{curPage:ae,setCurPage:de},hideCollectionCheckbox:T,renderWithoutModal:L,pickerType:V,scrollContainerRef:Ie}),"products"===te&&se&&e.jsx(S.CollectionIdContext.Provider,Object.assign({value:se},{children:e.jsx(h.ProductsScreen,{hideInCollectionSearch:m.hideInCollectionSearch,customCollectionRestriction:m.customCollectionRestriction,productFetcher:m.productFetcher,setScreen:oe,storeId:f,appType:X,data:Z[se],collectionsDispatch:ee,selectedCollectionsDispatch:ke,selectedData:ve,setSaveDisabled:he,searchInCollectionFetcher:m.searchInCollectionFetcher,hideProductCheckbox:R,outOfStockAction:D,hideVariantCheckbox:q,selectProductsFromCustomCollection:E,renderWithoutModal:L,pickerType:V,hideProductVariants:_,fbStatusFetcher:m.fbStatusFetcher,onProductDetailClick:e=>{Fe(!0),Te(e)},showProductDetailInfoIcon:K,scrollContainerRef:Ie})})),"view"===te&&e.jsx(g.SelectedScreen,{selectedCollections:ve||{},selectedCollectionsDispatch:ke,setScreen:oe,collections:Z,hideProductVariants:_,outOfStockAction:D,storeId:f,appType:X,fbStatusFetcher:m.fbStatusFetcher}),"rearrange"===te&&e.jsx(p.RearrangeScreen,{selectedCollections:ve||{},selectedCollectionsDispatch:ke,setScreen:oe,outOfStockAction:D,rearrangeViewType:"grid"===ce?"list":"grid",scrollContainerRef:Ie,storeId:f,appType:X,fbStatusFetcher:m.fbStatusFetcher}),"searchProducts"===te&&e.jsx(C.SearchScreen,{customCollectionRestriction:m.customCollectionRestriction,selectedCollections:ve||{},searchedCollections:me||{},searchedCollectionsDispatch:fe,selectedCollectionsDispatch:ke,setScreen:oe,collections:Z,onBackPress:()=>{ge(""),fe({type:"set",data:{collections:{},products:{}}})},pickerType:V,hideProductCheckbox:R,hideProductVariants:_,hideVariantCheckbox:q,storeId:f,appType:X,fbStatusFetcher:m.fbStatusFetcher,setCollectionId:ne,setSelectedCollectionId:le,renderWithoutModal:L,hideCollectionCheckbox:T,outOfStockAction:D})]}))]}));return e.jsx(e.Fragment,{children:L?e.jsxs(e.Fragment,{children:[Ee,U.renderFooter?e.jsxs(y.StyledFooterForNonModal,{children:[De(),e.jsx(s.Button,{buttonText:qe(U.primaryButtonText),disabled:!U.isLoading&&(ue||pe<1||F&&pe<F||!F&&P&&pe>P)||U.primaryButtonDisabled,isLoading:U.isLoading,onClick:()=>{m.onAdd(ve,pe),Re(),oe([j.ScreenName.Collections,j.ScreenName.RearrangeProducts].includes(z)?z:j.ScreenName.Collections)}})]}):e.jsx(e.Fragment,{}),Oe&&Pe?e.jsx(u.ProductInfoOverlay,{productData:Pe,outOfStockAction:D,useDynamicInfoImageSize:m.useDynamicInfoImageSize,onClose:()=>{Fe(!1)}}):e.jsx(e.Fragment,{})]}):e.jsxs(i.StyledModal,Object.assign({zIndex:O,open:I,onClose:()=>{null==k||k(),Re()},headingTitle:A||("collections"===te||"products"===te?"Select Products":"view"===te?"Selected Products":"searchProducts"===te?"Searched Results":"rearrange"===te?"Rearrange Products":void 0),headingSubtitle:Q,footerShadow:!0,centralContainerStyles:{width:B||"600px",left:w||"auto"},headerRightCustomElement:G?e.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:k},{children:e.jsx(r.default,{width:20,height:20,color:c.COLORS.content.secondary})})):e.jsx(e.Fragment,{}),footerContainerStyle:m.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:c.COLORS.surface.standard}:void 0,primaryButton:Y?(e=>Object.assign(Object.assign({},e),{disabled:!e.isLoading&&(ue||pe<1||F&&pe<F||!F&&P&&pe>P)||e.disabled,onClick:()=>{m.onAdd(ve,pe),Re(),oe([j.ScreenName.Collections,j.ScreenName.RearrangeProducts].includes(z)?z:j.ScreenName.Collections)}}))(Y):{buttonText:qe(),disabled:ue||pe<1||F&&pe<F||!F&&P&&pe>P||!1,onClick:()=>{m.onAdd(ve,pe),Re()}},secondaryButton:J?(e=>Object.assign(Object.assign({},e),{disabled:ue||pe<1||F&&pe<F||!F&&P&&pe>P||!1,onClick:()=>{const e=x.updateAllVariantsForSelectedProducts(ve,Z,me);m.onAdd(e,pe,!0)}}))(J):void 0,wrapperStyle:m.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:N?e.jsx(e.Fragment,{}):De(),hideCrossButton:Oe||G},{children:[Ee,Oe&&Pe?e.jsx(u.ProductInfoOverlay,{productData:Pe,useDynamicInfoImageSize:m.useDynamicInfoImageSize,outOfStockAction:D,onClose:()=>{Fe(!1)}}):e.jsx(e.Fragment,{})]}))})};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js"),i=require("../TypographyStyle.js"),o=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js"),i=require("../TypographyStyle.js"),o=require("./type.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=r(e);const d=l.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
background-color: white;
|
|
4
4
|
height: ${e=>e.renderWithoutModal?"90%":"75vh"};
|
|
@@ -10,3 +10,10 @@ export interface FooterForNonModalI {
|
|
|
10
10
|
primaryButtonDisabled?: boolean;
|
|
11
11
|
isLoading?: boolean;
|
|
12
12
|
}
|
|
13
|
+
export declare enum ScreenName {
|
|
14
|
+
Collections = "collections",
|
|
15
|
+
RearrangeProducts = "rearrange",
|
|
16
|
+
SelectedProducts = "view",
|
|
17
|
+
SearchProducts = "searchProducts",
|
|
18
|
+
Products = "products"
|
|
19
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var e,r;Object.defineProperty(exports,"__esModule",{value:!0}),exports.OUT_OF_STOCK_ACTION=void 0,(e=exports.OUT_OF_STOCK_ACTION||(exports.OUT_OF_STOCK_ACTION={})).HIDE="HIDE",e.NORMAL="NORMAL",e.BLUR="BLUR",exports.ScreenName=void 0,(r=exports.ScreenName||(exports.ScreenName={})).Collections="collections",r.RearrangeProducts="rearrange",r.SelectedProducts="view",r.SearchProducts="searchProducts",r.Products="products";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/delete.svg.js"),r=require("../../assets/icons/drag_handle.svg.js"),i=require("../../constants/Theme.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/delete.svg.js"),r=require("../../assets/icons/drag_handle.svg.js"),i=require("../tooltips/Tooltip.js"),a=require("../../constants/Theme.js"),s=require("../icon-button/IconButton.js"),n=require("../shimmer-image/ShimmerImage.js"),o=require("../TypographyStyle.js"),c=require("./constants.js"),l=require("./helpers/ProductHelper.js"),d=require("./ProductPickerTag.js"),u=require("./style.js");exports.VariantCardGridView=t=>{const{data:r}=t;return e.jsx(u.VariantCardGridStyle,{children:e.jsx(i.Tooltip,Object.assign({body:r.name,alwaysVisible:!1,variant:"dark",placement:"bottom"},{children:e.jsx(n.ShimmerImage,{width:72,height:72,imageUrl:r.image,alt:"Item",borderRadius:4})}))})},exports.VariantCardListView=j=>{var h,m,g;const{data:p,selectedCollectionsDispatch:x,outOfStockAction:y}=j,b=()=>{let e;return e=p.name.includes(p.productName)?p.name:`${p.productName} ${p.name}`,e},{dataForProductPickerTag:v,tagText:I,tagType:O}=l.ProductHelper.getDataForProductPickerTag(p,!0,y),T=`${p.currency&&null!==(h=c.CurrencySymbols[p.currency])&&void 0!==h?h:""}${null!==(g=null!==(m=p.price)&&void 0!==m?m:p.actualPrice)&&void 0!==g?g:""}`,S=p.skuId;return e.jsx(u.VariantCardListStyle,{children:e.jsxs("div",Object.assign({className:"text-container"},{children:[e.jsx(r.default,{width:24,height:24,color:a.COLORS.content.placeholder}),e.jsx("div",{children:e.jsx(n.ShimmerImage,{width:40,height:40,imageUrl:p.image,alt:"Item",borderRadius:4},p.variantId)}),e.jsxs("div",Object.assign({className:"info-container"},{children:[e.jsxs("div",Object.assign({className:"tooltip-title-tag"},{children:[e.jsx(i.Tooltip,Object.assign({body:b(),placement:"bottom",delay:400,variant:"light"},{children:e.jsx(o.TitleSmall,Object.assign({numberOfLines:1,style:{flex:1,minWidth:0}},{children:b()}))})),e.jsxs(u.ProductInfo,{children:[e.jsx(d.ProductPickerTag,{isVariant:!0,data:v,tagText:I,tagType:O}),e.jsx(s.IconButton,{Icon:()=>e.jsx(t.default,{width:24,height:24,color:a.COLORS.content.placeholder}),onClick:()=>{x&&x({type:"variantUnselected",data:{productId:p.productId,variantId:p.variantId,collectionId:p.collectionId}}),j.onDelete&&j.onDelete()}})]})]})),e.jsxs(u.ProductSubTitle,{children:[e.jsx(o.BodyCaption,Object.assign({color:a.COLORS.content.secondary},{children:!(null==v?void 0:v.fbStatus)||I?null:T})),S&&e.jsx(i.Tooltip,Object.assign({body:S,placement:"top"},{children:e.jsx(u.SKUIDBadge,{children:e.jsx(u.EllipsedBodyTiny,{children:`SKU ID: ${S}`})})}))]})]}))]}))})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../../checkBox/CheckBox.js"),a=require("../../
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../../checkBox/CheckBox.js"),a=require("../../input/Input.js"),i=require("../../TypographyStyle.js");exports.BackTrackComponent=s=>{const{backTrackMessage:n,setBackTrackMessage:c}=s,[l,x]=r.useState(!!n);return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",marginLeft:10,marginTop:8,width:"300px",padding:"20px 0px"}},{children:[e.jsx(t.CheckBox,{isChecked:l,onValueChange:()=>{l&&c&&c(""),x(!l)}}),e.jsx(i.TitleSmall,Object.assign({style:{marginLeft:8}},{children:"Prevent BackTracking"}))]})),l&&e.jsx("div",Object.assign({style:{margin:10}},{children:e.jsx(a.Input,{type:"multiline",placeholder:"Enter your text here",labelText:"Message if user tries backtracking",onChangeText:e=>{c&&c(e)},height:"120px",maxCharLimit:1024,value:n,noErrorHint:!0,validate:e=>[!0,""]})}))]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../assets/icons/PlusIcon.js"),t=require("react"),r=require("../../checkBox/CheckBox.js"),a=require("../../
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../assets/icons/PlusIcon.js"),t=require("react"),r=require("../../checkBox/CheckBox.js"),a=require("../../input/Input.js"),i=require("../../TypographyStyle.js"),n=require("../context/templateModalContext.js"),o=require("./VariableConnectorsPanel.js");exports.DiscountCodeComponent=l=>{const{discountCode:c,setDiscountCode:d}=l,[u,j]=t.useState(""),[x,h]=t.useState(!!c),[g,p]=t.useState(!1),{setVariableCallback:b,setShowVariablePicker:C}=n.useTemplateModalContext(),f=t.useRef(),v=t.useRef();t.useEffect((()=>{d&&u&&d(c+u)}),[u]);const m=e=>{j(e.actualValue)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",marginLeft:10,marginTop:8}},{children:[e.jsx(r.CheckBox,{isChecked:x,onValueChange:()=>{x&&d&&(d(""),j("")),h(!x)}}),e.jsx(i.TitleSmall,Object.assign({style:{marginLeft:8}},{children:"Add discount code"}))]})),x&&e.jsxs("div",Object.assign({ref:f,style:{margin:10}},{children:[e.jsx(a.Input,{placeholder:"Enter your discount code",onChangeText:e=>{d&&d(e)},value:c,onFocus:()=>{p(!0)},onBlur:e=>{var s;"addVar"===(null===(s=e.relatedTarget)||void 0===s?void 0:s.id)?(f.current&&f.current.focus(),p(!0)):p(!1)},noErrorHint:!0,validate:e=>[!0,""]}),g&&e.jsx(o.AddVariableStyled,Object.assign({ref:v,id:"addVar",onClick:e=>{e.stopPropagation(),b((()=>m)),C(!0)}},{children:e.jsxs("div",Object.assign({className:"add"},{children:[e.jsx(s.default,{width:14,height:14,color:"white"}),e.jsx("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))]}))]})};
|