@bikdotai/bik-component-library 0.0.499-0 → 0.0.499-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/components/add-variableV2/AddVariableBox.styled.d.ts +1 -3
- package/dist/cjs/components/add-variableV2/AddVariableBox.styled.js +22 -22
- package/dist/cjs/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/cjs/components/input-with-vars/InputWithVariables.d.ts +0 -1
- package/dist/cjs/components/input-with-vars/InputWithVariables.js +2 -1
- package/dist/cjs/components/product-picker-v2/modal.d.ts +1 -0
- package/dist/cjs/components/product-picker-v2/modal.js +1 -1
- package/dist/cjs/components/product-picker-v2/product.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditMediaModal.js +1 -1
- package/dist/esm/components/add-variableV2/AddVariableBox.styled.d.ts +1 -3
- package/dist/esm/components/add-variableV2/AddVariableBox.styled.js +22 -22
- package/dist/esm/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/esm/components/input-with-vars/InputWithVariables.d.ts +0 -1
- package/dist/esm/components/input-with-vars/InputWithVariables.js +2 -1
- package/dist/esm/components/product-picker-v2/modal.d.ts +1 -0
- package/dist/esm/components/product-picker-v2/modal.js +1 -1
- package/dist/esm/components/product-picker-v2/product.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditMediaModal.js +1 -1
- package/package.json +1 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}Object.defineProperty(exports,"__esModule",{value:!0});const e=t(require("styled-components")).default.button`
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
padding: 2px 8px;
|
|
3
|
+
position: absolute;
|
|
4
|
+
right: 0px;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
color: white;
|
|
7
|
+
background-color: black;
|
|
8
|
+
width: fit-content;
|
|
9
|
+
float: right;
|
|
10
|
+
margin-top: 0px;
|
|
11
|
+
font-family: Inter;
|
|
12
|
+
font-style: normal;
|
|
13
|
+
font-weight: 600;
|
|
14
|
+
font-size: 14px;
|
|
15
|
+
line-height: 20px;
|
|
16
|
+
border-radius: 4px;
|
|
17
|
+
border: 1px solid #ccc;
|
|
18
|
+
margin-right: 1px;
|
|
19
|
+
z-index: 100;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
.add {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
}
|
|
25
25
|
`;exports.AddVariableStyled=e;
|
|
@@ -7,7 +7,6 @@ export interface InputWithVariablesProps {
|
|
|
7
7
|
variablesList: any;
|
|
8
8
|
onChange: (val: SelectedVariable) => void;
|
|
9
9
|
onBlur?: (e: Event, val?: SelectedVariable | Variable) => void;
|
|
10
|
-
addVarBoxRight: string;
|
|
11
10
|
allowMix: boolean;
|
|
12
11
|
prevVariable: SelectedVariable;
|
|
13
12
|
showHelp?: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../assets/icons/PlusIcon.js"),l=require("react"),r=require("styled-components"),t=require("uuid"),i=require("../../constants/Theme.js"),d=require("../add-variableV2/AddVariableV2SideModal.js"),s=require("../add-variableV2/AddVariableV2.js"),u=require("../add-variableV2/AddVariableBox.styled.js"),n=require("../input/Input.js"),o=require("../TypographyStyle.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const v=c(r).default.div`
|
|
2
|
+
position: relative;
|
|
2
3
|
margin-bottom: 16px;
|
|
3
4
|
input {
|
|
4
5
|
color: ${e=>e.isVar?i.COLORS.stroke.brand:"black"};
|
|
5
6
|
}
|
|
6
|
-
`;exports.InputWithVariables=r=>{let{type:i,
|
|
7
|
+
`;exports.InputWithVariables=r=>{let{type:i,allowMix:c,onChange:b,prevVariable:h,variablesList:g,onBlur:p,onlyVariables:V,placeHolder:x,showAddButton:T=!0,showHelp:j,showSideVariablePanel:y,errorMessage:f,showSideModal:m,maxCharLimit:S,noMaxCharCheck:q,labelText:C,labelElement:w,isRequired:A=!1,hintText:O}=r;const k=l.useRef(!0),M=l.useRef(null),[B,L]=l.useState(!1),[N]=l.useState(t.v4()),[E,I]=l.useState(),[R,F]=l.useState(h),[P,Z]=l.useState(!1),[$,z]=l.useState(!1),[H,W]=l.useState(0);return l.useEffect((()=>{if(E&&E.actualValue)if(c){if(F((e=>{return{actualValue:(a=e.actualValue,l=E.actualValue,r=H,a.slice(0,r)+l+a.slice(r)),variableType:"string"};var a,l,r})),M.current){W(M.current.selectionStart);const e=H+E.actualValue.length+2;M.current.setSelectionRange(e,e),W(e)}}else F((e=>({actualValue:E.actualValue,variableType:E.variableType,needsFetching:E.needsFetching})))}),[E]),l.useEffect((()=>{k.current?k.current=!1:b(R)}),[R]),e.jsxs(e.Fragment,{children:[e.jsxs(v,Object.assign({isVar:/^{{.*}}$/.test(R.actualValue)},{children:[e.jsx(n.Input,{isRequired:A,hintText:O,type:null!=i?i:"text",id:N,ref:M,skipFocus:!0,isActive:B,value:R.actualValue,validate:e=>[!0,""],errorMessage:f,noMaxCharCheck:q,maxCharLimit:S,labelText:C,labelElement:w,placeholder:x||"Add a value",onClick:e=>{M.current&&W(M.current.selectionStart)},onChangeText:(e,a)=>{if(M.current&&W(M.current.selectionStart),V){const e=(null==a?void 0:a.keyCode)||(null==a?void 0:a.charCode);8!==e&&46!==e||F({actualValue:"",variableType:"string"})}else F(c?{actualValue:e,variableType:"string"}:{actualValue:e.replace(/{{.*}}/,""),variableType:"string"})},onReferenceInit:()=>{},onFocus:e=>{L(!0),z(!0),document.getElementById("varList")&&!P&&Z(!0)},onBlur:e=>{var a,l,r,t,i,d,s;null==p||p(e,R),"addVar"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||"varList"===(null===(l=e.relatedTarget)||void 0===l?void 0:l.id)||(null===(t=null===(r=e.relatedTarget)||void 0===r?void 0:r.className)||void 0===t?void 0:t.includes("exlualr0"))||(null===(d=null===(i=e.relatedTarget)||void 0===i?void 0:i.className)||void 0===d?void 0:d.includes("sc-dZoequ "))?(M.current&&M.current.focus(),L(!0)):"search-bar"===(null===(s=e.relatedTarget)||void 0===s?void 0:s.id)?L(!0):(L(!1),Z(!1),z(!1))}}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"space-between"}},{children:[R.actualValue&&j&&e.jsx("div",Object.assign({style:{marginTop:4}},{children:e.jsx(o.BodyCaption,{children:`This value is of type ${R.variableType}`})})),T&&$&&e.jsx("div",Object.assign({style:{marginTop:f||O?"-24px":"0px"}},{children:e.jsx(u.AddVariableStyled,Object.assign({id:"addVar",onClick:()=>{Z(!P)}},{children:e.jsxs("div",Object.assign({className:"add"},{children:[e.jsx(a.default,{color:"white"}),e.jsx("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))}))]})),!y&&P&&e.jsx(s.AddVariableV2,{data:g,showVariable:!0,setShowVariable:()=>{Z(!1)},variableValue:E,setVariableValue:I,placeholder:"",pickerSize:"large",enableVariable:!0,selectWithTypes:!0,onSearchBlur:e=>{var a,l,r,t,i,d;"varList"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||(null===(r=null===(l=e.relatedTarget)||void 0===l?void 0:l.className)||void 0===r?void 0:r.includes("exlualr0"))||(null===(i=null===(t=e.relatedTarget)||void 0===t?void 0:t.className)||void 0===i?void 0:i.includes("sc-dZoequ "))?M.current.focus():"Enter here"===(null===(d=e.relatedTarget)||void 0===d?void 0:d.placeholder)?e.relatedTarget.id!==N&&(Z(!1),z(!1),L(!1)):(Z(!1),z(!1),L(!1))}})]})),y&&P&&e.jsx(d.AddVariableV2SideModal,{zIndex:2e3,data:null!=g?g:[],showVariable:P,setShowVariable:()=>{Z(!1)},placeholder:"Add a variable",customTrigger:e=>{I({actualValue:e.actualValue,variableType:"string"}),F(e)},onSearchBlur:e=>{var a,l,r,t,i,d;"varList"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||(null===(r=null===(l=e.relatedTarget)||void 0===l?void 0:l.className)||void 0===r?void 0:r.includes("exlualr0"))||(null===(i=null===(t=e.relatedTarget)||void 0===t?void 0:t.className)||void 0===i?void 0:i.includes("sc-dZoequ "))?M.current.focus():"Enter here"===(null===(d=e.relatedTarget)||void 0===d?void 0:d.placeholder)?e.relatedTarget.id!==N&&(Z(!1),z(!1),L(!1)):(Z(!1),z(!1),L(!1))}})]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react/jsx-runtime"),o=require("../../assets/icons/search.svg.js"),c=require("react"),r=require("../../constants/Theme.js"),s=require("../button/Button.js"),n=require("../input/Input.js"),l=require("../modals/styledModal.js"),i=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"),x=require("./selectedScreen.js"),g=require("./style.js"),j=require("./type.js");exports.ScreenName=void 0,(e=exports.ScreenName||(exports.ScreenName={})).Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products";exports.ProductPickerModal=e=>{const{storeId:y,selectedItems:b,onClose:f,visible:m,zIndex:v,exactLimit:P,limit:k,hideCollectionCheckbox:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react/jsx-runtime"),o=require("../../assets/icons/search.svg.js"),c=require("react"),r=require("../../constants/Theme.js"),s=require("../button/Button.js"),n=require("../input/Input.js"),l=require("../modals/styledModal.js"),i=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"),x=require("./selectedScreen.js"),g=require("./style.js"),j=require("./type.js");exports.ScreenName=void 0,(e=exports.ScreenName||(exports.ScreenName={})).Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products";exports.ProductPickerModal=e=>{const{storeId:y,selectedItems:b,onClose:f,visible:m,zIndex:v,exactLimit:P,limit:k,hideCollectionCheckbox:O,hideProductCheckbox:I,outOfStockAction:F=j.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:R,selectProductsFromCustomCollection:T,hideSelectionCount:q,title:E,width:D,renderWithoutModal:w,onClickSave:N,pickerType:A,hideProductVariants:B=!1,startupScreen:M=exports.ScreenName.Collections,rearrangeEnabled:V,selectSingleItem:$=!1,showProductDetails:L,containerStyle:_}=e,[z,W]=c.useReducer(S.collectionsReducer,{}),[G,H]=c.useState([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(M)?M:exports.ScreenName.Collections),[K,U]=c.useState("grid"),[Y,J]=c.useState(""),[Q,X]=c.useState(""),[Z,ee]=c.useState(0),[te,oe]=c.useState(!1),[ce,re]=c.useState(0),[se,ne]=c.useState(""),[le,ie]=c.useState(!1),[ae,de]=c.useState(!1),[ue,he]=c.useReducer(S.searchReducer,{collections:{},products:{}}),[pe,Se]=c.useReducer(S.selectedColectionsReducer,Object.keys(b).length>0?b:{}),Ce=c.useRef(null),[xe,ge]=c.useState(!1),[je,ye]=c.useState();c.useEffect((()=>{oe(!0),de(!0),e.collectionFetcher(Z,y).then((e=>{W({type:"fetched",data:(null==e?void 0:e.collections)||{}}),oe(!1),ee((e=>e+1)),de(!1)})).catch()}),[]),c.useEffect((()=>{let e=0;B?Object.keys(pe||[]).forEach((t=>{var o;Object.keys((null===(o=pe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&pe[-1]&&(null===(c=pe[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(pe||[]).forEach((t=>{var o;Object.keys((null===(o=pe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=pe[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),re(e)}),[z,pe,B]),c.useEffect((()=>{Q&&(oe(!0),e.productFetcher(Q,y).then((e=>{Object.keys(e).length&&W({type:"productsFetched",data:{collectionId:Q,products:e}}),oe(!1)})).catch())}),[Q]),c.useEffect((()=>{const t=setTimeout((()=>{"rearrange"!==G&&(se.length||"collections"!==G)&&(se.length?(ie(!0),e.searchFetcher(y,se).then((e=>{"collections"in e&&"products"in e?(he({type:"set",data:e}),W({type:"searched",data:e.collections})):(he({type:"set",data:{collections:{},products:e}}),W({type:"searched",data:e})),H("searchProducts"),oe(!1),ie(!1)}))):H("collections"))}),800);return()=>clearTimeout(t)}),[se]),c.useEffect((()=>{N&&(e.onAdd(pe,ce),be())}),[N]),c.useEffect((()=>{$&&Object.keys(pe||{}).length&&ce&&(e.onAdd(pe,ce),be())}),[$,pe,ce]);const be=()=>{Se({type:"reset",data:{}})},fe=t.jsxs(g.ContainerStyle,Object.assign({style:null!=_?_:{}},{children:[e.postHeader&&t.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:e.postHeader})),!e.hideGlobalSearch&&t.jsx(t.Fragment,{children:("collections"===G||"searchProducts"===G)&&t.jsx("div",Object.assign({style:{padding:w?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t.jsx(n.Input,{placeholder:"Search Collections or Products",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>le?t.jsx(i.Spinner,{size:"small",color:r.COLORS.content.primary}):t.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:se,onChangeText:e=>{e.length&&e.trim().length?ne(e):ne("")}})}))}),t.jsxs(g.ScrollContainerStyle,Object.assign({ref:Ce,screenName:G},{children:["collections"===G&&t.jsx(d.CollectionsScreen,{customCollectionRestriction:e.customCollectionRestriction,dataLoading:ae,collections:z,selectedCollectionsDispatch:Se,setCollectionId:J,setSelectedCollectionId:X,setScreen:H,selectedCollections:pe,collectionFetcher:e.collectionFetcher,storeId:y,collectionsDispatch:W,setSaveDisabled:oe,pagingControls:{curPage:Z,setCurPage:ee},hideCollectionCheckbox:O,renderWithoutModal:w,pickerType:A}),"products"===G&&Y&&t.jsx(S.CollectionIdContext.Provider,Object.assign({value:Y},{children:t.jsx(h.ProductsScreen,{hideInCollectionSearch:e.hideInCollectionSearch,customCollectionRestriction:e.customCollectionRestriction,productFetcher:e.productFetcher,setScreen:H,storeId:y,data:z[Y],collectionsDispatch:W,selectedCollectionsDispatch:Se,selectedData:pe,setSaveDisabled:oe,searchInCollectionFetcher:e.searchInCollectionFetcher,hideProductCheckbox:I,outOfStockAction:F,hideVariantCheckbox:R,selectProductsFromCustomCollection:T,renderWithoutModal:w,pickerType:A,hideProductVariants:B,fbStatusFetcher:e.fbStatusFetcher,onProductDetailClick:e=>{ge(!0),ye(e)},showProductDetailInfoIcon:L,scrollContainerRef:Ce})})),"view"===G&&t.jsx(x.SelectedScreen,{selectedCollections:pe||{},selectedCollectionsDispatch:Se,setScreen:H,collections:z,hideProductVariants:B,outOfStockAction:F,storeId:y,fbStatusFetcher:e.fbStatusFetcher}),"rearrange"===G&&t.jsx(p.RearrangeScreen,{selectedCollections:pe||{},selectedCollectionsDispatch:Se,setScreen:H,outOfStockAction:F,rearrangeViewType:"grid"===K?"list":"grid",scrollContainerRef:Ce,storeId:y,fbStatusFetcher:e.fbStatusFetcher}),"searchProducts"===G&&t.jsx(C.SearchScreen,{customCollectionRestriction:e.customCollectionRestriction,selectedCollections:pe||{},searchedCollections:ue||{},searchedCollectionsDispatch:he,selectedCollectionsDispatch:Se,setScreen:H,collections:z,onBackPress:()=>{ne(""),he({type:"set",data:{collections:{},products:{}}})},pickerType:A,hideProductCheckbox:I,hideProductVariants:B,hideVariantCheckbox:R,storeId:y,fbStatusFetcher:e.fbStatusFetcher,setCollectionId:J,setSelectedCollectionId:X,renderWithoutModal:w,hideCollectionCheckbox:O,outOfStockAction:F})]}))]}));return t.jsx(t.Fragment,{children:w?fe:t.jsxs(l.StyledModal,Object.assign({zIndex:v,open:m,onClose:()=>{null==f||f(),be()},headingTitle:E||("collections"===G||"products"===G?"Select Products":"view"===G?"Selected Products":"searchProducts"===G?"Searched Results":"rearrange"===G?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:D||"600px"},headerRightCustomElement:"rearrange"===G?(console.log("ignore:",U),t.jsx(t.Fragment,{})):t.jsx(t.Fragment,{}),footerContainerStyle:e.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:r.COLORS.surface.standard}:void 0,primaryButton:{buttonText:te?"Loading...":G===exports.ScreenName.RearrangeProducts?"Done":"Add",disabled:te||ce<1||P&&ce<P||!P&&k&&ce>k||!1,onClick:()=>{e.onAdd(pe,ce),be()}},wrapperStyle:e.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:q?t.jsx(t.Fragment,{}):P&&ce>P?t.jsx(a.Tag,{tagText:`You can only select ${P} products`,type:"negative"}):k&&ce>k?t.jsx(a.Tag,{tagText:`You can only select ${k} products`,type:"negative"}):ce>0?t.jsx(s.Button,{onClick:()=>{H(V?exports.ScreenName.RearrangeProducts:exports.ScreenName.SelectedProducts)},buttonText:P?`${ce}/${P} products selected`:`${ce} products selected`,buttonType:["rearrange","view"].includes(G)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(G)}):t.jsx(s.Button,{disabled:!0,buttonText:P?`${ce}/${P} products selected`:`${ce} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:xe},{children:[fe,xe&&je?t.jsx(u.ProductInfoOverlay,{productData:je,outOfStockAction:F,onClose:()=>{ge(!1)}}):t.jsx(t.Fragment,{})]}))})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react/jsx-runtime"),e=require("../../constants/Theme.js"),i=require("../../assets/icons/info.svg.js"),o=require("../checkBox/CheckBox.js"),c=require("../icon-button/IconButton.js"),d=require("../shimmer-image/ShimmerImage.js"),r=require("../tooltips/Tooltip.js"),n=require("../TypographyStyle.js"),a=require("./ProductPickerTag.js"),l=require("./style.js"),s=require("./utility.js");const u=s=>{const{isVariant:u,data:p,productId:h,collectionId:v,variantId:I,isSelected:j,selectedCollectionsDispatch:k,viewOnly:x,upliftAdditions:y,isPartiallyChecked:P,hideProductCheckbox:C,outOfStockAction:f,hideVariantCheckbox:m,hideProductVariants:g,pickerType:O="PRODUCT",onProductDetailClick:b,showProductDetailInfoIcon:S}=s;return t.jsxs(l.ProductCardStyle,Object.assign({isVariant:u,onClick:t=>{if(t.stopPropagation(),"PRODUCT"===O){const t=Object.keys(p.variants);g?j?k({type:"productUnselected",data:{productId:h,collectionId:v}}):y("productSelected",{productId:h,variantId:I,collectionId:v,product:p}):j?k({type:"variantUnselected",data:{productId:h,variantId:I,collectionId:v}}):y("variantSelected",{productId:h,variantId:I||t[0],collectionId:v,variant:p})}},isActive:j},{children:[u&&!x&&!m||!u&&!x&&!C?t.jsx(o.CheckBox,{isChecked:j,isPartiallyChecked:P||!1,onValueChange:function(t,e,i){null==i||i.stopPropagation(),u?t?y(g?"productSelected":"variantSelected",{productId:h,variantId:I,collectionId:v,variant:p}):k({type:g?"productUnselected":"variantUnselected",data:{productId:h,variantId:I,collectionId:v}}):t?y("productSelected",{productId:h,collectionId:v,product:p}):k({type:"productUnselected",data:{productId:h,collectionId:v}})}}):t.jsx(t.Fragment,{}),t.jsx("div",{children:t.jsx(d.ShimmerImage,{width:40,height:40,imageUrl:p.image,alt:"Item",borderRadius:4})}),t.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:1}},{children:[t.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[t.jsx(r.Tooltip,Object.assign({variant:"light",body:p.name,placement:"bottom",delay:400},{children:t.jsx(n.BodyPrimary,Object.assign({numberOfLines:1},{children:p.name}))})),S&&t.jsx(c.IconButton,{onClick:()=>{null==b||b(p)},Icon:()=>t.jsx(i.default,{width:20,height:20,color:e.COLORS.content.placeholder})})]})),t.jsx(a.ProductPickerTag,{isVariant:u,data:p,outOfStockAction:f})]}))]}))};exports.ProductCard=u,exports.ProductGroup=e=>{const{collectionId:i,productId:o,data:c,selectedData:d,selectedCollectionsDispatch:r,viewOnly:n,upliftAdditions:a,isProductPartiallyChecked:l,hideProductCheckbox:p,outOfStockAction:h,hideVariantCheckbox:v,hideProductVariants:I,pickerType:j,onProductDetailClick:k,showProductDetailInfoIcon:x}=e,y=t=>{var e,c,r,n,a,l;if(!(null===(c=null===(e=null==d?void 0:d[i])||void 0===e?void 0:e.products)||void 0===c?void 0:c[o]))return!1;return!!(null===(l=null===(a=null===(n=null===(r=null==d?void 0:d[i])||void 0===r?void 0:r.products)||void 0===n?void 0:n[o])||void 0===a?void 0:a.variants)||void 0===l?void 0:l[t])};return t.jsxs("div",{children:[t.jsx(u,{isVariant:!1,data:c,productId:o,collectionId:i,isSelected:!!(null===(C=null===(P=null==d?void 0:d[i])||void 0===P?void 0:P.products)||void 0===C?void 0:C[o]),isPartiallyChecked:l,selectedCollectionsDispatch:r,upliftAdditions:a,viewOnly:n,hideProductCheckbox:p,hideVariantCheckbox:v,hideProductVariants:I,pickerType:j,outOfStockAction:h,onProductDetailClick:k,showProductDetailInfoIcon:x},o),I?null:s.shouldShowVariant(c)&&Object.keys(c.variants||[]).map((e=>t.jsx(u,{isVariant:!0,hideVariantCheckbox:v,data:c.variants[e],variantId:e,productId:o,viewOnly:n,upliftAdditions:a,collectionId:i,isSelected:y(e),selectedCollectionsDispatch:r,outOfStockAction:h,onProductDetailClick:k,showProductDetailInfoIcon:x},e)))]});var P,C};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react/jsx-runtime"),e=require("../../constants/Theme.js"),i=require("../../assets/icons/info.svg.js"),o=require("../checkBox/CheckBox.js"),c=require("../icon-button/IconButton.js"),d=require("../shimmer-image/ShimmerImage.js"),r=require("../tooltips/Tooltip.js"),n=require("../TypographyStyle.js"),a=require("./ProductPickerTag.js"),l=require("./style.js"),s=require("./utility.js");const u=s=>{const{isVariant:u,data:p,productId:h,collectionId:v,variantId:I,isSelected:j,selectedCollectionsDispatch:k,viewOnly:x,upliftAdditions:y,isPartiallyChecked:P,hideProductCheckbox:C,outOfStockAction:f,hideVariantCheckbox:m,hideProductVariants:g,pickerType:O="PRODUCT",onProductDetailClick:b,showProductDetailInfoIcon:S}=s;return t.jsxs(l.ProductCardStyle,Object.assign({isVariant:u,onClick:t=>{if(t.stopPropagation(),"PRODUCT"===O&&(C||m)){const t=Object.keys(p.variants);g?j?k({type:"productUnselected",data:{productId:h,collectionId:v}}):y("productSelected",{productId:h,variantId:I,collectionId:v,product:p}):j?k({type:"variantUnselected",data:{productId:h,variantId:I,collectionId:v}}):y("variantSelected",{productId:h,variantId:I||t[0],collectionId:v,variant:p})}},isActive:j},{children:[u&&!x&&!m||!u&&!x&&!C?t.jsx(o.CheckBox,{isChecked:j,isPartiallyChecked:P||!1,onValueChange:function(t,e,i){null==i||i.stopPropagation(),u?t?y(g?"productSelected":"variantSelected",{productId:h,variantId:I,collectionId:v,variant:p}):k({type:g?"productUnselected":"variantUnselected",data:{productId:h,variantId:I,collectionId:v}}):t?y("productSelected",{productId:h,collectionId:v,product:p}):k({type:"productUnselected",data:{productId:h,collectionId:v}})}}):t.jsx(t.Fragment,{}),t.jsx("div",{children:t.jsx(d.ShimmerImage,{width:40,height:40,imageUrl:p.image,alt:"Item",borderRadius:4})}),t.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:1}},{children:[t.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[t.jsx(r.Tooltip,Object.assign({variant:"light",body:p.name,placement:"bottom",delay:400},{children:t.jsx(n.BodyPrimary,Object.assign({numberOfLines:1},{children:p.name}))})),S&&t.jsx(c.IconButton,{onClick:()=>{null==b||b(p)},Icon:()=>t.jsx(i.default,{width:20,height:20,color:e.COLORS.content.placeholder})})]})),t.jsx(a.ProductPickerTag,{isVariant:u,data:p,outOfStockAction:f})]}))]}))};exports.ProductCard=u,exports.ProductGroup=e=>{const{collectionId:i,productId:o,data:c,selectedData:d,selectedCollectionsDispatch:r,viewOnly:n,upliftAdditions:a,isProductPartiallyChecked:l,hideProductCheckbox:p,outOfStockAction:h,hideVariantCheckbox:v,hideProductVariants:I,pickerType:j,onProductDetailClick:k,showProductDetailInfoIcon:x}=e,y=t=>{var e,c,r,n,a,l;if(!(null===(c=null===(e=null==d?void 0:d[i])||void 0===e?void 0:e.products)||void 0===c?void 0:c[o]))return!1;return!!(null===(l=null===(a=null===(n=null===(r=null==d?void 0:d[i])||void 0===r?void 0:r.products)||void 0===n?void 0:n[o])||void 0===a?void 0:a.variants)||void 0===l?void 0:l[t])};return t.jsxs("div",{children:[t.jsx(u,{isVariant:!1,data:c,productId:o,collectionId:i,isSelected:!!(null===(C=null===(P=null==d?void 0:d[i])||void 0===P?void 0:P.products)||void 0===C?void 0:C[o]),isPartiallyChecked:l,selectedCollectionsDispatch:r,upliftAdditions:a,viewOnly:n,hideProductCheckbox:p,hideVariantCheckbox:v,hideProductVariants:I,pickerType:j,outOfStockAction:h,onProductDetailClick:k,showProductDetailInfoIcon:x},o),I?null:s.shouldShowVariant(c)&&Object.keys(c.variants||[]).map((e=>t.jsx(u,{isVariant:!0,hideVariantCheckbox:v,data:c.variants[e],variantId:e,productId:o,viewOnly:n,upliftAdditions:a,collectionId:i,isSelected:y(e),selectedCollectionsDispatch:r,outOfStockAction:h,onProductDetailClick:k,showProductDetailInfoIcon:x},e)))]});var P,C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../button/Button.js"),a=require("../../input-with-vars/InputWithVariables.js"),s=require("../../modals/styledModal.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var i=require("../../../constants/Theme.js");require("../../curtain/CurtainHelper.js");var r=require("../../template-preview/models/TemplateMeta.js"),l=require("../../template-preview/models/WhatsAppTemplate.js"),d=require("../../TypographyStyle.js"),o=require("../../../assets/icons/file.svg.js"),n=require("../../../assets/icons/filePdf.svg.js"),u=require("../../../assets/icons/image.svg.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../button/Button.js"),a=require("../../input-with-vars/InputWithVariables.js"),s=require("../../modals/styledModal.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var i=require("../../../constants/Theme.js");require("../../curtain/CurtainHelper.js");var r=require("../../template-preview/models/TemplateMeta.js"),l=require("../../template-preview/models/WhatsAppTemplate.js"),d=require("../../TypographyStyle.js"),o=require("../../../assets/icons/file.svg.js"),n=require("../../../assets/icons/filePdf.svg.js"),u=require("../../../assets/icons/image.svg.js"),c=require("../../../assets/icons/upload.svg.js"),p=require("../context/templateModalContext.js");exports.default=h=>{let{setOpenEditMedia:j,mediaComponentFormat:x,variableListForImage:g,openEditMedia:m,uploadMedia:E}=h;const{pod:b}=p.useTemplateModalContext();return e.jsx(s.StyledModal,Object.assign({open:m,zIndex:2e3,onClose:()=>j(!1),width:"440px"},{children:e.jsxs("div",Object.assign({style:{padding:24,borderRadius:4}},{children:[e.jsx(d.TitleMedium,Object.assign({style:{marginBottom:16}},{children:"Update media"})),e.jsxs("div",Object.assign({style:{padding:24,border:`1px dashed ${i.DEFAULT_THEME.colorsV2.stroke.primary}`,backgroundColor:i.DEFAULT_THEME.colorsV2.surface.subdued}},{children:[e.jsxs("div",Object.assign({style:{marginBottom:24,display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",gap:16}},{children:[e.jsx("div",Object.assign({style:{height:80,width:80,borderRadius:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:i.DEFAULT_THEME.colorsV2.background.base}},{children:x===r.HEADER_TYPES.IMAGE?e.jsx(u.default,{width:40,height:40}):x===r.HEADER_TYPES.VIDEO?e.jsx(o.default,{width:40,height:40}):e.jsx(n.default,{width:40,height:40})})),e.jsx(d.TitleMedium,{children:x===r.HEADER_TYPES.IMAGE?"Upload an image":x===r.HEADER_TYPES.VIDEO?"Upload a video":"Upload a document"}),e.jsx(d.BodySecondary,{children:x===r.HEADER_TYPES.IMAGE?"JPEG/ PNG format • Max 5MB":x===r.HEADER_TYPES.VIDEO?"MP4 format video • Max 16MB":"PDF format a document • Max 100MB"})]})),e.jsxs("div",Object.assign({style:{marginBottom:16}},{children:[e.jsx(d.BodyRegular,{children:"Media"}),e.jsx(a.InputWithVariables,{noMaxCharCheck:!0,allowMix:!1,onChange:()=>{},prevVariable:{actualValue:"",variableType:"string"},variablesList:g,showSideVariablePanel:!0,placeHolder:"Enter URL or add variable...",onBlur:(e,t)=>{t&&t.actualValue&&E(t.actualValue)},showAddButton:b!==l.POD.CAMPAIGN||x===r.HEADER_TYPES.IMAGE})]})),e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:4}},{children:[e.jsx("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}}),e.jsx(d.BodyCaption,Object.assign({style:{flex:1}},{children:"Or upload media from device"})),e.jsx("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}})]})),e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(t.Button,{matchParentWidth:!0,buttonText:"Upload",buttonType:"secondary",LeadingIcon:c.default,onClick:()=>E()})}))]}))]}))}))};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import t from"styled-components";const o=t.button`
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
padding: 2px 8px;
|
|
3
|
+
position: absolute;
|
|
4
|
+
right: 0px;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
color: white;
|
|
7
|
+
background-color: black;
|
|
8
|
+
width: fit-content;
|
|
9
|
+
float: right;
|
|
10
|
+
margin-top: 0px;
|
|
11
|
+
font-family: Inter;
|
|
12
|
+
font-style: normal;
|
|
13
|
+
font-weight: 600;
|
|
14
|
+
font-size: 14px;
|
|
15
|
+
line-height: 20px;
|
|
16
|
+
border-radius: 4px;
|
|
17
|
+
border: 1px solid #ccc;
|
|
18
|
+
margin-right: 1px;
|
|
19
|
+
z-index: 100;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
.add {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
}
|
|
25
25
|
`;export{o as AddVariableStyled};
|
|
@@ -7,7 +7,6 @@ export interface InputWithVariablesProps {
|
|
|
7
7
|
variablesList: any;
|
|
8
8
|
onChange: (val: SelectedVariable) => void;
|
|
9
9
|
onBlur?: (e: Event, val?: SelectedVariable | Variable) => void;
|
|
10
|
-
addVarBoxRight: string;
|
|
11
10
|
allowMix: boolean;
|
|
12
11
|
prevVariable: SelectedVariable;
|
|
13
12
|
showHelp?: boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import{jsxs as e,Fragment as a,jsx as l}from"react/jsx-runtime";import r from"../../assets/icons/PlusIcon.js";import{useRef as i,useState as t,useEffect as d}from"react";import o from"styled-components";import{v4 as n}from"uuid";import{COLORS as s}from"../../constants/Theme.js";import{AddVariableV2SideModal as c}from"../add-variableV2/AddVariableV2SideModal.js";import{AddVariableV2 as u}from"../add-variableV2/AddVariableV2.js";import{AddVariableStyled as v}from"../add-variableV2/AddVariableBox.styled.js";import{Input as
|
|
1
|
+
import{jsxs as e,Fragment as a,jsx as l}from"react/jsx-runtime";import r from"../../assets/icons/PlusIcon.js";import{useRef as i,useState as t,useEffect as d}from"react";import o from"styled-components";import{v4 as n}from"uuid";import{COLORS as s}from"../../constants/Theme.js";import{AddVariableV2SideModal as c}from"../add-variableV2/AddVariableV2SideModal.js";import{AddVariableV2 as u}from"../add-variableV2/AddVariableV2.js";import{AddVariableStyled as v}from"../add-variableV2/AddVariableBox.styled.js";import{Input as p}from"../input/Input.js";import{BodyCaption as h}from"../TypographyStyle.js";const m=o=>{let{type:s,allowMix:m,onChange:g,prevVariable:V,variablesList:T,onBlur:y,onlyVariables:f,placeHolder:x,showAddButton:j=!0,showHelp:C,showSideVariablePanel:S,errorMessage:w,showSideModal:k,maxCharLimit:A,noMaxCharCheck:N,labelText:B,labelElement:L,isRequired:M=!1,hintText:O}=o;const q=i(!0),E=i(null),[I,F]=t(!1),[R]=t(n()),[Z,$]=t(),[z,H]=t(V),[P,D]=t(!1),[W,G]=t(!1),[J,K]=t(0);return d((()=>{if(Z&&Z.actualValue)if(m){if(H((e=>{return{actualValue:(a=e.actualValue,l=Z.actualValue,r=J,a.slice(0,r)+l+a.slice(r)),variableType:"string"};var a,l,r})),E.current){K(E.current.selectionStart);const e=J+Z.actualValue.length+2;E.current.setSelectionRange(e,e),K(e)}}else H((e=>({actualValue:Z.actualValue,variableType:Z.variableType,needsFetching:Z.needsFetching})))}),[Z]),d((()=>{q.current?q.current=!1:g(z)}),[z]),e(a,{children:[e(b,Object.assign({isVar:/^{{.*}}$/.test(z.actualValue)},{children:[l(p,{isRequired:M,hintText:O,type:null!=s?s:"text",id:R,ref:E,skipFocus:!0,isActive:I,value:z.actualValue,validate:e=>[!0,""],errorMessage:w,noMaxCharCheck:N,maxCharLimit:A,labelText:B,labelElement:L,placeholder:x||"Add a value",onClick:e=>{E.current&&K(E.current.selectionStart)},onChangeText:(e,a)=>{if(E.current&&K(E.current.selectionStart),f){const e=(null==a?void 0:a.keyCode)||(null==a?void 0:a.charCode);8!==e&&46!==e||H({actualValue:"",variableType:"string"})}else H(m?{actualValue:e,variableType:"string"}:{actualValue:e.replace(/{{.*}}/,""),variableType:"string"})},onReferenceInit:()=>{},onFocus:e=>{F(!0),G(!0),document.getElementById("varList")&&!P&&D(!0)},onBlur:e=>{var a,l,r,i,t,d,o;null==y||y(e,z),"addVar"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||"varList"===(null===(l=e.relatedTarget)||void 0===l?void 0:l.id)||(null===(i=null===(r=e.relatedTarget)||void 0===r?void 0:r.className)||void 0===i?void 0:i.includes("exlualr0"))||(null===(d=null===(t=e.relatedTarget)||void 0===t?void 0:t.className)||void 0===d?void 0:d.includes("sc-dZoequ "))?(E.current&&E.current.focus(),F(!0)):"search-bar"===(null===(o=e.relatedTarget)||void 0===o?void 0:o.id)?F(!0):(F(!1),D(!1),G(!1))}}),e("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"space-between"}},{children:[z.actualValue&&C&&l("div",Object.assign({style:{marginTop:4}},{children:l(h,{children:`This value is of type ${z.variableType}`})})),j&&W&&l("div",Object.assign({style:{marginTop:w||O?"-24px":"0px"}},{children:l(v,Object.assign({id:"addVar",onClick:()=>{D(!P)}},{children:e("div",Object.assign({className:"add"},{children:[l(r,{color:"white"}),l("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))}))]})),!S&&P&&l(u,{data:T,showVariable:!0,setShowVariable:()=>{D(!1)},variableValue:Z,setVariableValue:$,placeholder:"",pickerSize:"large",enableVariable:!0,selectWithTypes:!0,onSearchBlur:e=>{var a,l,r,i,t,d;"varList"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||(null===(r=null===(l=e.relatedTarget)||void 0===l?void 0:l.className)||void 0===r?void 0:r.includes("exlualr0"))||(null===(t=null===(i=e.relatedTarget)||void 0===i?void 0:i.className)||void 0===t?void 0:t.includes("sc-dZoequ "))?E.current.focus():"Enter here"===(null===(d=e.relatedTarget)||void 0===d?void 0:d.placeholder)?e.relatedTarget.id!==R&&(D(!1),G(!1),F(!1)):(D(!1),G(!1),F(!1))}})]})),S&&P&&l(c,{zIndex:2e3,data:null!=T?T:[],showVariable:P,setShowVariable:()=>{D(!1)},placeholder:"Add a variable",customTrigger:e=>{$({actualValue:e.actualValue,variableType:"string"}),H(e)},onSearchBlur:e=>{var a,l,r,i,t,d;"varList"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||(null===(r=null===(l=e.relatedTarget)||void 0===l?void 0:l.className)||void 0===r?void 0:r.includes("exlualr0"))||(null===(t=null===(i=e.relatedTarget)||void 0===i?void 0:i.className)||void 0===t?void 0:t.includes("sc-dZoequ "))?E.current.focus():"Enter here"===(null===(d=e.relatedTarget)||void 0===d?void 0:d.placeholder)?e.relatedTarget.id!==R&&(D(!1),G(!1),F(!1)):(D(!1),G(!1),F(!1))}})]})},b=o.div`
|
|
2
|
+
position: relative;
|
|
2
3
|
margin-bottom: 16px;
|
|
3
4
|
input {
|
|
4
5
|
color: ${e=>e.isVar?s.stroke.brand:"black"};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import c from"../../assets/icons/search.svg.js";import{useReducer as r,useState as s,useRef as i,useEffect as l}from"react";import{COLORS as n}from"../../constants/Theme.js";import{Button as d}from"../button/Button.js";import{Input as a}from"../input/Input.js";import{StyledModal as u}from"../modals/styledModal.js";import{Spinner as h}from"../spinner/Spinner.js";import{Tag as p}from"../tag/Tag.js";import{CollectionsScreen as m}from"./collectionScreen.js";import{ProductInfoOverlay as C}from"./productInfoOverlay.js";import{ProductsScreen as g}from"./productScreen.js";import{RearrangeScreen as f}from"./rearrangeScreen.js";import{collectionsReducer as b,searchReducer as y,selectedColectionsReducer as S,CollectionIdContext as v}from"./reducers.js";import{SearchScreen as k}from"./searchScreen.js";import{SelectedScreen as P}from"./selectedScreen.js";import{ContainerStyle as
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import c from"../../assets/icons/search.svg.js";import{useReducer as r,useState as s,useRef as i,useEffect as l}from"react";import{COLORS as n}from"../../constants/Theme.js";import{Button as d}from"../button/Button.js";import{Input as a}from"../input/Input.js";import{StyledModal as u}from"../modals/styledModal.js";import{Spinner as h}from"../spinner/Spinner.js";import{Tag as p}from"../tag/Tag.js";import{CollectionsScreen as m}from"./collectionScreen.js";import{ProductInfoOverlay as C}from"./productInfoOverlay.js";import{ProductsScreen as g}from"./productScreen.js";import{RearrangeScreen as f}from"./rearrangeScreen.js";import{collectionsReducer as b,searchReducer as y,selectedColectionsReducer as S,CollectionIdContext as v}from"./reducers.js";import{SearchScreen as k}from"./searchScreen.js";import{SelectedScreen as P}from"./selectedScreen.js";import{ContainerStyle as j,ScrollContainerStyle as x}from"./style.js";import{OUT_OF_STOCK_ACTION as I}from"./type.js";var F;!function(e){e.Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products"}(F||(F={}));const O=O=>{const{storeId:T,selectedItems:D,onClose:R,visible:w,zIndex:E,exactLimit:A,limit:V,hideCollectionCheckbox:$,hideProductCheckbox:B,outOfStockAction:L=I.BLUR,hideVariantCheckbox:M,selectProductsFromCustomCollection:z,hideSelectionCount:W,title:G,width:H,renderWithoutModal:Y,onClickSave:K,pickerType:N,hideProductVariants:U=!1,startupScreen:q=F.Collections,rearrangeEnabled:J,selectSingleItem:Q=!1,showProductDetails:X,containerStyle:Z}=O,[_,ee]=r(b,{}),[te,oe]=s([F.Collections,F.RearrangeProducts].includes(q)?q:F.Collections),[ce,re]=s("grid"),[se,ie]=s(""),[le,ne]=s(""),[de,ae]=s(0),[ue,he]=s(!1),[pe,me]=s(0),[Ce,ge]=s(""),[fe,be]=s(!1),[ye,Se]=s(!1),[ve,ke]=r(y,{collections:{},products:{}}),[Pe,je]=r(S,Object.keys(D).length>0?D:{}),xe=i(null),[Ie,Fe]=s(!1),[Oe,Te]=s();l((()=>{he(!0),Se(!0),O.collectionFetcher(de,T).then((e=>{ee({type:"fetched",data:(null==e?void 0:e.collections)||{}}),he(!1),ae((e=>e+1)),Se(!1)})).catch()}),[]),l((()=>{let e=0;U?Object.keys(Pe||[]).forEach((t=>{var o;Object.keys((null===(o=Pe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&Pe[-1]&&(null===(c=Pe[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(Pe||[]).forEach((t=>{var o;Object.keys((null===(o=Pe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=Pe[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),me(e)}),[_,Pe,U]),l((()=>{le&&(he(!0),O.productFetcher(le,T).then((e=>{Object.keys(e).length&&ee({type:"productsFetched",data:{collectionId:le,products:e}}),he(!1)})).catch())}),[le]),l((()=>{const e=setTimeout((()=>{"rearrange"!==te&&(Ce.length||"collections"!==te)&&(Ce.length?(be(!0),O.searchFetcher(T,Ce).then((e=>{"collections"in e&&"products"in e?(ke({type:"set",data:e}),ee({type:"searched",data:e.collections})):(ke({type:"set",data:{collections:{},products:e}}),ee({type:"searched",data:e})),oe("searchProducts"),he(!1),be(!1)}))):oe("collections"))}),800);return()=>clearTimeout(e)}),[Ce]),l((()=>{K&&(O.onAdd(Pe,pe),De())}),[K]),l((()=>{Q&&Object.keys(Pe||{}).length&&pe&&(O.onAdd(Pe,pe),De())}),[Q,Pe,pe]);const De=()=>{je({type:"reset",data:{}})},Re=e(j,Object.assign({style:null!=Z?Z:{}},{children:[O.postHeader&&t("div",Object.assign({style:{padding:"0 24px"}},{children:O.postHeader})),!O.hideGlobalSearch&&t(o,{children:("collections"===te||"searchProducts"===te)&&t("div",Object.assign({style:{padding:Y?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t(a,{placeholder:"Search Collections or Products",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>fe?t(h,{size:"small",color:n.content.primary}):t(c,{})},id:"listInput",height:"24px",type:"text",value:Ce,onChangeText:e=>{e.length&&e.trim().length?ge(e):ge("")}})}))}),e(x,Object.assign({ref:xe,screenName:te},{children:["collections"===te&&t(m,{customCollectionRestriction:O.customCollectionRestriction,dataLoading:ye,collections:_,selectedCollectionsDispatch:je,setCollectionId:ie,setSelectedCollectionId:ne,setScreen:oe,selectedCollections:Pe,collectionFetcher:O.collectionFetcher,storeId:T,collectionsDispatch:ee,setSaveDisabled:he,pagingControls:{curPage:de,setCurPage:ae},hideCollectionCheckbox:$,renderWithoutModal:Y,pickerType:N}),"products"===te&&se&&t(v.Provider,Object.assign({value:se},{children:t(g,{hideInCollectionSearch:O.hideInCollectionSearch,customCollectionRestriction:O.customCollectionRestriction,productFetcher:O.productFetcher,setScreen:oe,storeId:T,data:_[se],collectionsDispatch:ee,selectedCollectionsDispatch:je,selectedData:Pe,setSaveDisabled:he,searchInCollectionFetcher:O.searchInCollectionFetcher,hideProductCheckbox:B,outOfStockAction:L,hideVariantCheckbox:M,selectProductsFromCustomCollection:z,renderWithoutModal:Y,pickerType:N,hideProductVariants:U,fbStatusFetcher:O.fbStatusFetcher,onProductDetailClick:e=>{Fe(!0),Te(e)},showProductDetailInfoIcon:X,scrollContainerRef:xe})})),"view"===te&&t(P,{selectedCollections:Pe||{},selectedCollectionsDispatch:je,setScreen:oe,collections:_,hideProductVariants:U,outOfStockAction:L,storeId:T,fbStatusFetcher:O.fbStatusFetcher}),"rearrange"===te&&t(f,{selectedCollections:Pe||{},selectedCollectionsDispatch:je,setScreen:oe,outOfStockAction:L,rearrangeViewType:"grid"===ce?"list":"grid",scrollContainerRef:xe,storeId:T,fbStatusFetcher:O.fbStatusFetcher}),"searchProducts"===te&&t(k,{customCollectionRestriction:O.customCollectionRestriction,selectedCollections:Pe||{},searchedCollections:ve||{},searchedCollectionsDispatch:ke,selectedCollectionsDispatch:je,setScreen:oe,collections:_,onBackPress:()=>{ge(""),ke({type:"set",data:{collections:{},products:{}}})},pickerType:N,hideProductCheckbox:B,hideProductVariants:U,hideVariantCheckbox:M,storeId:T,fbStatusFetcher:O.fbStatusFetcher,setCollectionId:ie,setSelectedCollectionId:ne,renderWithoutModal:Y,hideCollectionCheckbox:$,outOfStockAction:L})]}))]}));return t(o,{children:Y?Re:e(u,Object.assign({zIndex:E,open:w,onClose:()=>{null==R||R(),De()},headingTitle:G||("collections"===te||"products"===te?"Select Products":"view"===te?"Selected Products":"searchProducts"===te?"Searched Results":"rearrange"===te?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:H||"600px"},headerRightCustomElement:"rearrange"===te?(console.log("ignore:",re),t(o,{})):t(o,{}),footerContainerStyle:O.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:n.surface.standard}:void 0,primaryButton:{buttonText:ue?"Loading...":te===F.RearrangeProducts?"Done":"Add",disabled:ue||pe<1||A&&pe<A||!A&&V&&pe>V||!1,onClick:()=>{O.onAdd(Pe,pe),De()}},wrapperStyle:O.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:W?t(o,{}):A&&pe>A?t(p,{tagText:`You can only select ${A} products`,type:"negative"}):V&&pe>V?t(p,{tagText:`You can only select ${V} products`,type:"negative"}):t(d,pe>0?{onClick:()=>{oe(J?F.RearrangeProducts:F.SelectedProducts)},buttonText:A?`${pe}/${A} products selected`:`${pe} products selected`,buttonType:["rearrange","view"].includes(te)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(te)}:{disabled:!0,buttonText:A?`${pe}/${A} products selected`:`${pe} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:Ie},{children:[Re,Ie&&Oe?t(C,{productData:Oe,outOfStockAction:L,onClose:()=>{Fe(!1)}}):t(o,{})]}))})};export{O as ProductPickerModal,F as ScreenName};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as i,Fragment as o}from"react/jsx-runtime";import{COLORS as e}from"../../constants/Theme.js";import c from"../../assets/icons/info.svg.js";import{CheckBox as d}from"../checkBox/CheckBox.js";import{IconButton as n}from"../icon-button/IconButton.js";import{ShimmerImage as l}from"../shimmer-image/ShimmerImage.js";import{Tooltip as a}from"../tooltips/Tooltip.js";import{BodyPrimary as r}from"../TypographyStyle.js";import{ProductPickerTag as s}from"./ProductPickerTag.js";import{ProductCardStyle as u}from"./style.js";import{shouldShowVariant as p}from"./utility.js";const h=o=>{const{collectionId:e,productId:c,data:d,selectedData:n,selectedCollectionsDispatch:l,viewOnly:a,upliftAdditions:r,isProductPartiallyChecked:s,hideProductCheckbox:u,outOfStockAction:h,hideVariantCheckbox:I,hideProductVariants:m,pickerType:f,onProductDetailClick:k,showProductDetailInfoIcon:y}=o,C=t=>{var i,o,d,l,a,r;if(!(null===(o=null===(i=null==n?void 0:n[e])||void 0===i?void 0:i.products)||void 0===o?void 0:o[c]))return!1;return!!(null===(r=null===(a=null===(l=null===(d=null==n?void 0:n[e])||void 0===d?void 0:d.products)||void 0===l?void 0:l[c])||void 0===a?void 0:a.variants)||void 0===r?void 0:r[t])};return t("div",{children:[i(v,{isVariant:!1,data:d,productId:c,collectionId:e,isSelected:!!(null===(b=null===(P=null==n?void 0:n[e])||void 0===P?void 0:P.products)||void 0===b?void 0:b[c]),isPartiallyChecked:s,selectedCollectionsDispatch:l,upliftAdditions:r,viewOnly:a,hideProductCheckbox:u,hideVariantCheckbox:I,hideProductVariants:m,pickerType:f,outOfStockAction:h,onProductDetailClick:k,showProductDetailInfoIcon:y},c),m?null:p(d)&&Object.keys(d.variants||[]).map((t=>i(v,{isVariant:!0,hideVariantCheckbox:I,data:d.variants[t],variantId:t,productId:c,viewOnly:a,upliftAdditions:r,collectionId:e,isSelected:C(t),selectedCollectionsDispatch:l,outOfStockAction:h,onProductDetailClick:k,showProductDetailInfoIcon:y},t)))]});var P,b},v=p=>{const{isVariant:h,data:v,productId:I,collectionId:m,variantId:f,isSelected:k,selectedCollectionsDispatch:y,viewOnly:C,upliftAdditions:P,isPartiallyChecked:b,hideProductCheckbox:g,outOfStockAction:j,hideVariantCheckbox:O,hideProductVariants:D,pickerType:x="PRODUCT",onProductDetailClick:S,showProductDetailInfoIcon:V}=p;return t(u,Object.assign({isVariant:h,onClick:t=>{if(t.stopPropagation(),"PRODUCT"===x){const t=Object.keys(v.variants);D?k?y({type:"productUnselected",data:{productId:I,collectionId:m}}):P("productSelected",{productId:I,variantId:f,collectionId:m,product:v}):k?y({type:"variantUnselected",data:{productId:I,variantId:f,collectionId:m}}):P("variantSelected",{productId:I,variantId:f||t[0],collectionId:m,variant:v})}},isActive:k},{children:[h&&!C&&!O||!h&&!C&&!g?i(d,{isChecked:k,isPartiallyChecked:b||!1,onValueChange:function(t,i,o){null==o||o.stopPropagation(),h?t?P(D?"productSelected":"variantSelected",{productId:I,variantId:f,collectionId:m,variant:v}):y({type:D?"productUnselected":"variantUnselected",data:{productId:I,variantId:f,collectionId:m}}):t?P("productSelected",{productId:I,collectionId:m,product:v}):y({type:"productUnselected",data:{productId:I,collectionId:m}})}}):i(o,{}),i("div",{children:i(l,{width:40,height:40,imageUrl:v.image,alt:"Item",borderRadius:4})}),t("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:1}},{children:[t("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[i(a,Object.assign({variant:"light",body:v.name,placement:"bottom",delay:400},{children:i(r,Object.assign({numberOfLines:1},{children:v.name}))})),V&&i(n,{onClick:()=>{null==S||S(v)},Icon:()=>i(c,{width:20,height:20,color:e.content.placeholder})})]})),i(s,{isVariant:h,data:v,outOfStockAction:j})]}))]}))};export{v as ProductCard,h as ProductGroup};
|
|
1
|
+
import{jsxs as t,jsx as i,Fragment as o}from"react/jsx-runtime";import{COLORS as e}from"../../constants/Theme.js";import c from"../../assets/icons/info.svg.js";import{CheckBox as d}from"../checkBox/CheckBox.js";import{IconButton as n}from"../icon-button/IconButton.js";import{ShimmerImage as l}from"../shimmer-image/ShimmerImage.js";import{Tooltip as a}from"../tooltips/Tooltip.js";import{BodyPrimary as r}from"../TypographyStyle.js";import{ProductPickerTag as s}from"./ProductPickerTag.js";import{ProductCardStyle as u}from"./style.js";import{shouldShowVariant as p}from"./utility.js";const h=o=>{const{collectionId:e,productId:c,data:d,selectedData:n,selectedCollectionsDispatch:l,viewOnly:a,upliftAdditions:r,isProductPartiallyChecked:s,hideProductCheckbox:u,outOfStockAction:h,hideVariantCheckbox:I,hideProductVariants:m,pickerType:f,onProductDetailClick:k,showProductDetailInfoIcon:y}=o,C=t=>{var i,o,d,l,a,r;if(!(null===(o=null===(i=null==n?void 0:n[e])||void 0===i?void 0:i.products)||void 0===o?void 0:o[c]))return!1;return!!(null===(r=null===(a=null===(l=null===(d=null==n?void 0:n[e])||void 0===d?void 0:d.products)||void 0===l?void 0:l[c])||void 0===a?void 0:a.variants)||void 0===r?void 0:r[t])};return t("div",{children:[i(v,{isVariant:!1,data:d,productId:c,collectionId:e,isSelected:!!(null===(b=null===(P=null==n?void 0:n[e])||void 0===P?void 0:P.products)||void 0===b?void 0:b[c]),isPartiallyChecked:s,selectedCollectionsDispatch:l,upliftAdditions:r,viewOnly:a,hideProductCheckbox:u,hideVariantCheckbox:I,hideProductVariants:m,pickerType:f,outOfStockAction:h,onProductDetailClick:k,showProductDetailInfoIcon:y},c),m?null:p(d)&&Object.keys(d.variants||[]).map((t=>i(v,{isVariant:!0,hideVariantCheckbox:I,data:d.variants[t],variantId:t,productId:c,viewOnly:a,upliftAdditions:r,collectionId:e,isSelected:C(t),selectedCollectionsDispatch:l,outOfStockAction:h,onProductDetailClick:k,showProductDetailInfoIcon:y},t)))]});var P,b},v=p=>{const{isVariant:h,data:v,productId:I,collectionId:m,variantId:f,isSelected:k,selectedCollectionsDispatch:y,viewOnly:C,upliftAdditions:P,isPartiallyChecked:b,hideProductCheckbox:g,outOfStockAction:j,hideVariantCheckbox:O,hideProductVariants:D,pickerType:x="PRODUCT",onProductDetailClick:S,showProductDetailInfoIcon:V}=p;return t(u,Object.assign({isVariant:h,onClick:t=>{if(t.stopPropagation(),"PRODUCT"===x&&(g||O)){const t=Object.keys(v.variants);D?k?y({type:"productUnselected",data:{productId:I,collectionId:m}}):P("productSelected",{productId:I,variantId:f,collectionId:m,product:v}):k?y({type:"variantUnselected",data:{productId:I,variantId:f,collectionId:m}}):P("variantSelected",{productId:I,variantId:f||t[0],collectionId:m,variant:v})}},isActive:k},{children:[h&&!C&&!O||!h&&!C&&!g?i(d,{isChecked:k,isPartiallyChecked:b||!1,onValueChange:function(t,i,o){null==o||o.stopPropagation(),h?t?P(D?"productSelected":"variantSelected",{productId:I,variantId:f,collectionId:m,variant:v}):y({type:D?"productUnselected":"variantUnselected",data:{productId:I,variantId:f,collectionId:m}}):t?P("productSelected",{productId:I,collectionId:m,product:v}):y({type:"productUnselected",data:{productId:I,collectionId:m}})}}):i(o,{}),i("div",{children:i(l,{width:40,height:40,imageUrl:v.image,alt:"Item",borderRadius:4})}),t("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:1}},{children:[t("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[i(a,Object.assign({variant:"light",body:v.name,placement:"bottom",delay:400},{children:i(r,Object.assign({numberOfLines:1},{children:v.name}))})),V&&i(n,{onClick:()=>{null==S||S(v)},Icon:()=>i(c,{width:20,height:20,color:e.content.placeholder})})]})),i(s,{isVariant:h,data:v,outOfStockAction:j})]}))]}))};export{v as ProductCard,h as ProductGroup};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Button as a}from"../../button/Button.js";import{InputWithVariables as i}from"../../input-with-vars/InputWithVariables.js";import{StyledModal as o}from"../../modals/styledModal.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import{DEFAULT_THEME as r}from"../../../constants/Theme.js";import"../../curtain/CurtainHelper.js";import{HEADER_TYPES as s}from"../../template-preview/models/TemplateMeta.js";import{POD as l}from"../../template-preview/models/WhatsAppTemplate.js";import{TitleMedium as n,BodySecondary as d,BodyRegular as p,BodyCaption as m}from"../../TypographyStyle.js";import c from"../../../assets/icons/file.svg.js";import h from"../../../assets/icons/filePdf.svg.js";import g from"../../../assets/icons/image.svg.js";import u from"../../../assets/icons/upload.svg.js";import{useTemplateModalContext as b}from"../context/templateModalContext.js";const f=f=>{let{setOpenEditMedia:j,mediaComponentFormat:v,variableListForImage:y,openEditMedia:x,uploadMedia:M}=f;const{pod:w}=b();return e(o,Object.assign({open:x,zIndex:2e3,onClose:()=>j(!1),width:"440px"},{children:t("div",Object.assign({style:{padding:24,borderRadius:4}},{children:[e(n,Object.assign({style:{marginBottom:16}},{children:"Update media"})),t("div",Object.assign({style:{padding:24,border:`1px dashed ${r.colorsV2.stroke.primary}`,backgroundColor:r.colorsV2.surface.subdued}},{children:[t("div",Object.assign({style:{marginBottom:24,display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",gap:16}},{children:[e("div",Object.assign({style:{height:80,width:80,borderRadius:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:r.colorsV2.background.base}},{children:v===s.IMAGE?e(g,{width:40,height:40}):v===s.VIDEO?e(c,{width:40,height:40}):e(h,{width:40,height:40})})),e(n,{children:v===s.IMAGE?"Upload an image":v===s.VIDEO?"Upload a video":"Upload a document"}),e(d,{children:v===s.IMAGE?"JPEG/ PNG format • Max 5MB":v===s.VIDEO?"MP4 format video • Max 16MB":"PDF format a document • Max 100MB"})]})),t("div",Object.assign({style:{marginBottom:16}},{children:[e(p,{children:"Media"}),e(i,{noMaxCharCheck:!0,
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Button as a}from"../../button/Button.js";import{InputWithVariables as i}from"../../input-with-vars/InputWithVariables.js";import{StyledModal as o}from"../../modals/styledModal.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import{DEFAULT_THEME as r}from"../../../constants/Theme.js";import"../../curtain/CurtainHelper.js";import{HEADER_TYPES as s}from"../../template-preview/models/TemplateMeta.js";import{POD as l}from"../../template-preview/models/WhatsAppTemplate.js";import{TitleMedium as n,BodySecondary as d,BodyRegular as p,BodyCaption as m}from"../../TypographyStyle.js";import c from"../../../assets/icons/file.svg.js";import h from"../../../assets/icons/filePdf.svg.js";import g from"../../../assets/icons/image.svg.js";import u from"../../../assets/icons/upload.svg.js";import{useTemplateModalContext as b}from"../context/templateModalContext.js";const f=f=>{let{setOpenEditMedia:j,mediaComponentFormat:v,variableListForImage:y,openEditMedia:x,uploadMedia:M}=f;const{pod:w}=b();return e(o,Object.assign({open:x,zIndex:2e3,onClose:()=>j(!1),width:"440px"},{children:t("div",Object.assign({style:{padding:24,borderRadius:4}},{children:[e(n,Object.assign({style:{marginBottom:16}},{children:"Update media"})),t("div",Object.assign({style:{padding:24,border:`1px dashed ${r.colorsV2.stroke.primary}`,backgroundColor:r.colorsV2.surface.subdued}},{children:[t("div",Object.assign({style:{marginBottom:24,display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",gap:16}},{children:[e("div",Object.assign({style:{height:80,width:80,borderRadius:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:r.colorsV2.background.base}},{children:v===s.IMAGE?e(g,{width:40,height:40}):v===s.VIDEO?e(c,{width:40,height:40}):e(h,{width:40,height:40})})),e(n,{children:v===s.IMAGE?"Upload an image":v===s.VIDEO?"Upload a video":"Upload a document"}),e(d,{children:v===s.IMAGE?"JPEG/ PNG format • Max 5MB":v===s.VIDEO?"MP4 format video • Max 16MB":"PDF format a document • Max 100MB"})]})),t("div",Object.assign({style:{marginBottom:16}},{children:[e(p,{children:"Media"}),e(i,{noMaxCharCheck:!0,allowMix:!1,onChange:()=>{},prevVariable:{actualValue:"",variableType:"string"},variablesList:y,showSideVariablePanel:!0,placeHolder:"Enter URL or add variable...",onBlur:(e,t)=>{t&&t.actualValue&&M(t.actualValue)},showAddButton:w!==l.CAMPAIGN||v===s.IMAGE})]})),t("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:4}},{children:[e("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}}),e(m,Object.assign({style:{flex:1}},{children:"Or upload media from device"})),e("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}})]})),e("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e(a,{matchParentWidth:!0,buttonText:"Upload",buttonType:"secondary",LeadingIcon:u,onClick:()=>M()})}))]}))]}))}))};export{f as default};
|