@bikdotai/bik-component-library 0.0.552-beta.113 → 0.0.552-beta.12
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/alerts/Alert.d.ts +1 -2
- package/dist/cjs/components/alerts/Alert.js +1 -1
- package/dist/cjs/components/icon-button/IconButton.js +1 -1
- package/dist/cjs/components/icon-button/model.d.ts +0 -1
- package/dist/cjs/components/product-picker-v2/modal.d.ts +0 -2
- package/dist/cjs/components/product-picker-v2/modal.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
- package/dist/cjs/components/template-preview/models/WhatsAppTemplate.d.ts +1 -1
- package/dist/esm/components/alerts/Alert.d.ts +1 -2
- package/dist/esm/components/alerts/Alert.js +1 -1
- package/dist/esm/components/icon-button/IconButton.js +1 -1
- package/dist/esm/components/icon-button/model.d.ts +0 -1
- package/dist/esm/components/product-picker-v2/modal.d.ts +0 -2
- package/dist/esm/components/product-picker-v2/modal.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
- package/dist/esm/components/template-preview/models/WhatsAppTemplate.d.ts +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { ALERT_TYPES, CONTENT_POSITION } from "./AlertHelper";
|
|
3
3
|
export type AlertProps = {
|
|
4
4
|
type: ALERT_TYPES;
|
|
5
|
-
text: string
|
|
5
|
+
text: string;
|
|
6
6
|
icon?: React.FC<{
|
|
7
7
|
width: number;
|
|
8
8
|
height: number;
|
|
@@ -11,6 +11,5 @@ export type AlertProps = {
|
|
|
11
11
|
textColor?: string;
|
|
12
12
|
contentPosition?: CONTENT_POSITION;
|
|
13
13
|
containerStyle?: React.CSSProperties;
|
|
14
|
-
iconStyle?: React.CSSProperties;
|
|
15
14
|
};
|
|
16
15
|
export declare const Alert: React.FC<AlertProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("./Alert.styled.js"),r=require("./AlertHelper.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("./Alert.styled.js"),r=require("./AlertHelper.js"),s=require("../TypographyStyle.js");exports.Alert=i=>e.jsxs(t.AlertStyle,Object.assign({type:i.type,contentPosition:i.contentPosition,style:i.containerStyle},{children:[i.icon&&e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(i.icon,{color:r.COLOR_CONFIG_MAP[i.type].textColor,height:20,width:20})})),e.jsx(s.BodyCaption,Object.assign({style:{color:i.textColor||r.COLOR_CONFIG_MAP[i.type].textColor,marginLeft:12}},{children:i.text}))]}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),r=require("react"),
|
|
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("./IconButton.styled.js"),o=require("./theme.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=s(r);const n=r.forwardRef(((r,s)=>{var{id:n,iconButtonType:l="default",Icon:c,height:u=20,width:a=20,bordered:y,disabled:b,isSelected:h,style:f,svgStyle:j}=r,p=e.__rest(r,["id","iconButtonType","Icon","height","width","bordered","disabled","isSelected","style","svgStyle"]);const g=o.getIconColor(l,b,h);return t.jsx(i.IconButton,Object.assign({id:n,ref:s,style:f,iconButtonType:l,bordered:y,disabled:b,isSelected:h},p,{children:d.default.createElement(c,{height:u,width:a,color:g,style:Object.assign({display:"block"},null!=j?j:{})})}))}));n.displayName="IconButton",exports.IconButton=n;
|
|
@@ -82,7 +82,6 @@ export type ProductPickerInterface = {
|
|
|
82
82
|
title?: string;
|
|
83
83
|
postHeader?: React.ReactNode;
|
|
84
84
|
width?: string;
|
|
85
|
-
left?: string;
|
|
86
85
|
renderWithoutModal?: boolean;
|
|
87
86
|
onClickSave?: number;
|
|
88
87
|
pickerType?: 'COLLECTION' | 'PRODUCT';
|
|
@@ -92,7 +91,6 @@ export type ProductPickerInterface = {
|
|
|
92
91
|
stickyFooter?: boolean;
|
|
93
92
|
showProductDetails?: boolean;
|
|
94
93
|
containerStyle?: React.CSSProperties;
|
|
95
|
-
crossButtonInsideHeader?: boolean;
|
|
96
94
|
} & ({
|
|
97
95
|
startupScreen: ScreenName.RearrangeProducts;
|
|
98
96
|
rearrangeEnabled: true;
|
|
@@ -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")
|
|
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,scrollContainerRef:Ce}),"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: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,{})]}))})};
|
package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),l=require("react"),s=require("../../dropdown/Dropdown.js"),a=require("../../input/Input.js"),n=require("../../template-preview/constants/regexPatterns.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("lodash"),l=require("react"),s=require("../../dropdown/Dropdown.js"),a=require("../../input/Input.js"),n=require("../../template-preview/constants/regexPatterns.js"),o=require("../../template-preview/models/TemplateMeta.js"),i=require("../../template-preview/models/WhatsAppTemplate.js"),r=require("../../TypographyStyle.js"),u=require("../../../constants/Theme.js"),c=require("../context/templateModalContext.js"),d=require("../utils/validateIsUrl.js"),b=require("./VariableConnector.js");exports.default=p=>{let{variableListIndex:j,button:m,updateSelectedURLTemplateBtn:g,updateSelectedQRBTemplateBtn:O,currentVariableList:v,CTAoptions:x,QRBoptions:f}=p;var y,L,h,R,U;const[V,T]=l.useState(""),[C,I]=l.useState(),{isError:q,disableEditVariable:w,pod:P,selectedCarouselIndex:E,originalVariableList:N,setOriginalVariableList:S,isProductCarouselType:_}=c.useTemplateModalContext();function B(e){if(T(e),null!=E&&E>-1&&_){const l=t.cloneDeep(N);if("URL"===m.type){const t=l.cards.map((t=>{let l=t.buttons.filter((e=>"URL"===e.type))[j];l=Object.assign(Object.assign({},l),{buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]});const s=t.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==l?void 0:l.text)?l:e));return Object.assign(Object.assign({},t),{buttons:s})}));null==S||S((e=>Object.assign(Object.assign({},e),{cards:t}))),null==g||g(`https://${e}`,"custom",j)}return}let l=v.buttons.filter((e=>"URL"===e.type))[j];l=Object.assign(Object.assign({},l),{buttonVariable:"((customPlaceholderName))",example:[`https://${e}`]});const s=v.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==l?void 0:l.text)?l:e)),a=Object.assign({},null!=E&&E>-1?N.cards[E]:N);if(a.buttons=s,null!=E&&E>-1){const e=[...N.cards];e[E]=a,null==S||S((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==S||S((e=>Object.assign(Object.assign({},e),{buttons:[...s]})));null==g||g(`https://${e}`,"custom",j)}function H(e,l){const s=e;I(s);const a=("URL"===m.type?x:f).find((e=>e.placeHolder===s.placeHolder));if(a)if("custom_link"!==a.value){if(null!=E&&E>-1&&_){const e=t.cloneDeep(N);if("URL"===m.type){const t=e.cards.map((e=>{let t=e.buttons.filter((e=>"URL"===e.type))[j];t=Object.assign(Object.assign({},t),{buttonVariable:s.placeHolder});const l=e.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e));return Object.assign(Object.assign({},e),{buttons:l})}));null==g||g({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder",j),null==S||S((e=>Object.assign(Object.assign({},e),{cards:t})))}else if("QUICK_REPLY"===m.type){const t=e.cards.map((e=>{let t=e.buttons.filter((e=>"QUICK_REPLY"===e.type))[j];t=Object.assign(Object.assign({},t),{flowName:s.label,flowId:s.value});const l=e.buttons.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e));return Object.assign(Object.assign({},e),{buttons:l})}));null==O||O({flowName:s.label,flowId:s.value},"placeholder",j),null==S||S((e=>Object.assign(Object.assign({},e),{cards:t})))}return}let e;if("URL"===m.type){let t=v.buttons.filter((e=>"URL"===e.type))[j];t=Object.assign(Object.assign({},t),{buttonVariable:s.placeHolder}),e=v.buttons.map((e=>"URL"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),null==g||g({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder",j)}else{let t=v.buttons.filter((e=>"QUICK_REPLY"===e.type))[j];t=Object.assign(Object.assign({},t),{flowName:s.label,flowId:s.value}),e=v.buttons.map((e=>"QUICK_REPLY"===e.type&&(null==e?void 0:e.text)===(null==t?void 0:t.text)?t:e)),null==O||O({flowName:s.label,flowId:s.value},"placeholder",j)}const l=Object.assign({},null!=E&&E>-1?N.cards[E]:N);if(l.buttons=e,null!=E&&E>-1){const e=[...N.cards];e[E]=l,null==S||S((t=>Object.assign(Object.assign({},t),{cards:e})))}else null==S||S((t=>Object.assign(Object.assign({},t),{buttons:[...e]})))}else B("")}return l.useEffect((()=>{var e;if(console.log("button: ",m),m.buttonVariable&&n.editableVarPattern.test(m.buttonVariable))console.log("button pattern match: ",!0),I(o.CUSTOM_URL_NAME),T((null===(e=m.example)||void 0===e?void 0:e[0].split("https://")[1])||"");else{let e=-1;const t="URL"===m.type?x:f;e="URL"===m.type?t.findIndex((e=>e.placeHolder===m.buttonVariable)):t.findIndex((e=>e.label===m.flowName)),console.log("button index: ",e,t[e],t[0]),e>-1?I(t[e]):H(t[0])}}),[]),P!==i.POD.CHATBOT?e.jsxs(b.Container,{children:[e.jsx("div",Object.assign({style:{marginBottom:8}},{children:e.jsxs(r.BodySecondary,Object.assign({style:{color:u.COLORS.content.primary}},{children:[m.text," button"]}))})),e.jsx("div",Object.assign({style:{marginBottom:12}},{children:e.jsx(s.Dropdown,{disabled:w,options:"URL"===m.type?x:f,isSearchable:!0,onSelect:H,defaultOptions:C?[Object.assign(Object.assign({},C),{selected:!0})]:[]})})),"custom_link"===(null==C?void 0:C.value)&&e.jsx("div",Object.assign({style:{marginBottom:20}},{children:e.jsx(a.Input,{state:w?"disabled":"none",errorMessage:q?V?d.validateIsUrl(V)?"":"Enter valid URL":"Required field":"",value:V,prefixText:"https://",placeholder:"Enter custom URL here",onChangeText:B,maxCharLimit:2e3})}))]}):e.jsx(b.default,{index:j,variable:{variableName:null!==(y=m.text)&&void 0!==y?y:"",updatedValue:"((customPlaceholderName))"===m.buttonVariable?`${null===(L=m.example)||void 0===L?void 0:L[0]}`:null!==(h=m.buttonVariable)&&void 0!==h?h:"",type:"link",isEditableVariable:!0,index:null!==(R=m.index)&&void 0!==R?R:0,queryParams:null!==(U=m.queryParams)&&void 0!==U?U:[]},showVariableModal:!0,componentType:"BUTTONS",buttonType:m.type,CTAoptions:x})};
|
|
@@ -213,7 +213,7 @@ export interface IMimeTypeResponse {
|
|
|
213
213
|
export type WhatsAppPickerMeta = {
|
|
214
214
|
uploadMediaFiles: (params: WhatsAppMediaUploadRequest, index?: number) => Promise<WhatsAppMediaUploadResponse>;
|
|
215
215
|
uploadMediaLink?: (link: string) => Promise<MediaLinkUploadResponse>;
|
|
216
|
-
validateMimeType
|
|
216
|
+
validateMimeType: (file: File | Blob) => Promise<IMimeTypeResponse>;
|
|
217
217
|
CTAoptions?: ButtonPlaceHolderOptions[];
|
|
218
218
|
QRBoptions?: ButtonPlaceHolderOptions[];
|
|
219
219
|
};
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { ALERT_TYPES, CONTENT_POSITION } from "./AlertHelper";
|
|
3
3
|
export type AlertProps = {
|
|
4
4
|
type: ALERT_TYPES;
|
|
5
|
-
text: string
|
|
5
|
+
text: string;
|
|
6
6
|
icon?: React.FC<{
|
|
7
7
|
width: number;
|
|
8
8
|
height: number;
|
|
@@ -11,6 +11,5 @@ export type AlertProps = {
|
|
|
11
11
|
textColor?: string;
|
|
12
12
|
contentPosition?: CONTENT_POSITION;
|
|
13
13
|
containerStyle?: React.CSSProperties;
|
|
14
|
-
iconStyle?: React.CSSProperties;
|
|
15
14
|
};
|
|
16
15
|
export declare const Alert: React.FC<AlertProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e}from"react/jsx-runtime";import{AlertStyle as o}from"./Alert.styled.js";import{COLOR_CONFIG_MAP as r}from"./AlertHelper.js";import{BodyCaption as i}from"../TypographyStyle.js";const l=l=>t(o,Object.assign({type:l.type,contentPosition:l.contentPosition,style:l.containerStyle},{children:[l.icon&&e("div",Object.assign({style:
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import{AlertStyle as o}from"./Alert.styled.js";import{COLOR_CONFIG_MAP as r}from"./AlertHelper.js";import{BodyCaption as i}from"../TypographyStyle.js";const l=l=>t(o,Object.assign({type:l.type,contentPosition:l.contentPosition,style:l.containerStyle},{children:[l.icon&&e("div",Object.assign({style:{display:"flex"}},{children:e(l.icon,{color:r[l.type].textColor,height:20,width:20})})),e(i,Object.assign({style:{color:l.textColor||r[l.type].textColor,marginLeft:12}},{children:l.text}))]}));export{l as Alert};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as t}from"react/jsx-runtime";import o,{forwardRef as i}from"react";import{IconButton as r}from"./IconButton.styled.js";import{getIconColor as s}from"./theme.js";const d=i(((i,d)=>{var{id:l,iconButtonType:n="default",Icon:c,height:a=20,width:m=20,bordered:y,disabled:h,isSelected:p,style:u,svgStyle:b
|
|
1
|
+
import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as t}from"react/jsx-runtime";import o,{forwardRef as i}from"react";import{IconButton as r}from"./IconButton.styled.js";import{getIconColor as s}from"./theme.js";const d=i(((i,d)=>{var{id:l,iconButtonType:n="default",Icon:c,height:a=20,width:m=20,bordered:y,disabled:h,isSelected:p,style:u,svgStyle:b}=i,f=e(i,["id","iconButtonType","Icon","height","width","bordered","disabled","isSelected","style","svgStyle"]);const g=s(n,h,p);return t(r,Object.assign({id:l,ref:d,style:u,iconButtonType:n,bordered:y,disabled:h,isSelected:p},f,{children:o.createElement(c,{height:a,width:m,color:g,style:Object.assign({display:"block"},null!=b?b:{})})}))}));d.displayName="IconButton";export{d as IconButton};
|
|
@@ -82,7 +82,6 @@ export type ProductPickerInterface = {
|
|
|
82
82
|
title?: string;
|
|
83
83
|
postHeader?: React.ReactNode;
|
|
84
84
|
width?: string;
|
|
85
|
-
left?: string;
|
|
86
85
|
renderWithoutModal?: boolean;
|
|
87
86
|
onClickSave?: number;
|
|
88
87
|
pickerType?: 'COLLECTION' | 'PRODUCT';
|
|
@@ -92,7 +91,6 @@ export type ProductPickerInterface = {
|
|
|
92
91
|
stickyFooter?: boolean;
|
|
93
92
|
showProductDetails?: boolean;
|
|
94
93
|
containerStyle?: React.CSSProperties;
|
|
95
|
-
crossButtonInsideHeader?: boolean;
|
|
96
94
|
} & ({
|
|
97
95
|
startupScreen: ScreenName.RearrangeProducts;
|
|
98
96
|
rearrangeEnabled: true;
|
|
@@ -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
|
|
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,scrollContainerRef:xe}),"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: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};
|
package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e}from"react/jsx-runtime";import{cloneDeep as l}from"lodash";import{useState as s,useEffect as a}from"react";import{Dropdown as n}from"../../dropdown/Dropdown.js";import{Input as o}from"../../input/Input.js";import{editableVarPattern as i}from"../../template-preview/constants/regexPatterns.js";import{CUSTOM_URL_NAME as r}from"../../template-preview/models/TemplateMeta.js";import{POD as c}from"../../template-preview/models/WhatsAppTemplate.js";import{BodySecondary as u}from"../../TypographyStyle.js";import{COLORS as d}from"../../../constants/Theme.js";import{useTemplateModalContext as p}from"../context/templateModalContext.js";import{validateIsUrl as b}from"../utils/validateIsUrl.js";import m,{Container as
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import{cloneDeep as l}from"lodash";import{useState as s,useEffect as a}from"react";import{Dropdown as n}from"../../dropdown/Dropdown.js";import{Input as o}from"../../input/Input.js";import{editableVarPattern as i}from"../../template-preview/constants/regexPatterns.js";import{CUSTOM_URL_NAME as r}from"../../template-preview/models/TemplateMeta.js";import{POD as c}from"../../template-preview/models/WhatsAppTemplate.js";import{BodySecondary as u}from"../../TypographyStyle.js";import{COLORS as d}from"../../../constants/Theme.js";import{useTemplateModalContext as p}from"../context/templateModalContext.js";import{validateIsUrl as b}from"../utils/validateIsUrl.js";import m,{Container as g}from"./VariableConnector.js";const j=j=>{let{variableListIndex:f,button:O,updateSelectedURLTemplateBtn:v,updateSelectedQRBTemplateBtn:x,currentVariableList:y,CTAoptions:h,QRBoptions:L}=j;var R,U,V,T,w;const[I,C]=s(""),[P,E]=s(),{isError:H,disableEditVariable:N,pod:B,selectedCarouselIndex:Q,originalVariableList:_,setOriginalVariableList:S,isProductCarouselType:K}=p();function Y(t){if(C(t),null!=Q&&Q>-1&&K){const e=l(_);if("URL"===O.type){const l=e.cards.map((e=>{let l=e.buttons.filter((t=>"URL"===t.type))[f];l=Object.assign(Object.assign({},l),{buttonVariable:"((customPlaceholderName))",example:[`https://${t}`]});const s=e.buttons.map((t=>"URL"===t.type&&(null==t?void 0:t.text)===(null==l?void 0:l.text)?l:t));return Object.assign(Object.assign({},e),{buttons:s})}));null==S||S((t=>Object.assign(Object.assign({},t),{cards:l}))),null==v||v(`https://${t}`,"custom",f)}return}let e=y.buttons.filter((t=>"URL"===t.type))[f];e=Object.assign(Object.assign({},e),{buttonVariable:"((customPlaceholderName))",example:[`https://${t}`]});const s=y.buttons.map((t=>"URL"===t.type&&(null==t?void 0:t.text)===(null==e?void 0:e.text)?e:t)),a=Object.assign({},null!=Q&&Q>-1?_.cards[Q]:_);if(a.buttons=s,null!=Q&&Q>-1){const t=[..._.cards];t[Q]=a,null==S||S((e=>Object.assign(Object.assign({},e),{cards:t})))}else null==S||S((t=>Object.assign(Object.assign({},t),{buttons:[...s]})));null==v||v(`https://${t}`,"custom",f)}function $(t,e){const s=t;E(s);const a=("URL"===O.type?h:L).find((t=>t.placeHolder===s.placeHolder));if(a)if("custom_link"!==a.value){if(null!=Q&&Q>-1&&K){const t=l(_);if("URL"===O.type){const e=t.cards.map((t=>{let e=t.buttons.filter((t=>"URL"===t.type))[f];e=Object.assign(Object.assign({},e),{buttonVariable:s.placeHolder});const l=t.buttons.map((t=>"URL"===t.type&&(null==t?void 0:t.text)===(null==e?void 0:e.text)?e:t));return Object.assign(Object.assign({},t),{buttons:l})}));null==v||v({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder",f),null==S||S((t=>Object.assign(Object.assign({},t),{cards:e})))}else if("QUICK_REPLY"===O.type){const e=t.cards.map((t=>{let e=t.buttons.filter((t=>"QUICK_REPLY"===t.type))[f];e=Object.assign(Object.assign({},e),{flowName:s.label,flowId:s.value});const l=t.buttons.map((t=>"QUICK_REPLY"===t.type&&(null==t?void 0:t.text)===(null==e?void 0:e.text)?e:t));return Object.assign(Object.assign({},t),{buttons:l})}));null==x||x({flowName:s.label,flowId:s.value},"placeholder",f),null==S||S((t=>Object.assign(Object.assign({},t),{cards:e})))}return}let t;if("URL"===O.type){let e=y.buttons.filter((t=>"URL"===t.type))[f];e=Object.assign(Object.assign({},e),{buttonVariable:s.placeHolder}),t=y.buttons.map((t=>"URL"===t.type&&(null==t?void 0:t.text)===(null==e?void 0:e.text)?e:t)),null==v||v({defaultValue:a.value,placeHolder:a.placeHolder},"placeholder",f)}else{let e=y.buttons.filter((t=>"QUICK_REPLY"===t.type))[f];e=Object.assign(Object.assign({},e),{flowName:s.label,flowId:s.value}),t=y.buttons.map((t=>"QUICK_REPLY"===t.type&&(null==t?void 0:t.text)===(null==e?void 0:e.text)?e:t)),null==x||x({flowName:s.label,flowId:s.value},"placeholder",f)}const e=Object.assign({},null!=Q&&Q>-1?_.cards[Q]:_);if(e.buttons=t,null!=Q&&Q>-1){const t=[..._.cards];t[Q]=e,null==S||S((e=>Object.assign(Object.assign({},e),{cards:t})))}else null==S||S((e=>Object.assign(Object.assign({},e),{buttons:[...t]})))}else Y("")}return a((()=>{var t;if(console.log("button: ",O),O.buttonVariable&&i.test(O.buttonVariable))console.log("button pattern match: ",!0),E(r),C((null===(t=O.example)||void 0===t?void 0:t[0].split("https://")[1])||"");else{let t=-1;const e="URL"===O.type?h:L;t="URL"===O.type?e.findIndex((t=>t.placeHolder===O.buttonVariable)):e.findIndex((t=>t.label===O.flowName)),console.log("button index: ",t,e[t],e[0]),t>-1?E(e[t]):$(e[0])}}),[]),B!==c.CHATBOT?t(g,{children:[e("div",Object.assign({style:{marginBottom:8}},{children:t(u,Object.assign({style:{color:d.content.primary}},{children:[O.text," button"]}))})),e("div",Object.assign({style:{marginBottom:12}},{children:e(n,{disabled:N,options:"URL"===O.type?h:L,isSearchable:!0,onSelect:$,defaultOptions:P?[Object.assign(Object.assign({},P),{selected:!0})]:[]})})),"custom_link"===(null==P?void 0:P.value)&&e("div",Object.assign({style:{marginBottom:20}},{children:e(o,{state:N?"disabled":"none",errorMessage:H?I?b(I)?"":"Enter valid URL":"Required field":"",value:I,prefixText:"https://",placeholder:"Enter custom URL here",onChangeText:Y,maxCharLimit:2e3})}))]}):e(m,{index:f,variable:{variableName:null!==(R=O.text)&&void 0!==R?R:"",updatedValue:"((customPlaceholderName))"===O.buttonVariable?`${null===(U=O.example)||void 0===U?void 0:U[0]}`:null!==(V=O.buttonVariable)&&void 0!==V?V:"",type:"link",isEditableVariable:!0,index:null!==(T=O.index)&&void 0!==T?T:0,queryParams:null!==(w=O.queryParams)&&void 0!==w?w:[]},showVariableModal:!0,componentType:"BUTTONS",buttonType:O.type,CTAoptions:h})};export{j as default};
|
|
@@ -213,7 +213,7 @@ export interface IMimeTypeResponse {
|
|
|
213
213
|
export type WhatsAppPickerMeta = {
|
|
214
214
|
uploadMediaFiles: (params: WhatsAppMediaUploadRequest, index?: number) => Promise<WhatsAppMediaUploadResponse>;
|
|
215
215
|
uploadMediaLink?: (link: string) => Promise<MediaLinkUploadResponse>;
|
|
216
|
-
validateMimeType
|
|
216
|
+
validateMimeType: (file: File | Blob) => Promise<IMimeTypeResponse>;
|
|
217
217
|
CTAoptions?: ButtonPlaceHolderOptions[];
|
|
218
218
|
QRBoptions?: ButtonPlaceHolderOptions[];
|
|
219
219
|
};
|