@capillarytech/creatives-library 7.7.6 → 7.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.7.6",
4
+ "version": "7.7.7",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -814,14 +814,18 @@ export const Advertisement = (props) => {
814
814
  const selectedFacebookAccount = templateData?.edit ? templateData?.selectedFacebookAccount : facebookTemplateData?.selectedFacebookAccount;
815
815
  const {orgUnitFacebookPageSettingsMap = {}, employeeAccessToken: accessToken = "", accountId = "" } = selectedFacebookAccount || {};
816
816
 
817
- const getPageAccessOrgs = useCallback(() => {
818
- const {status, data } = fbADData.orgOuData || {};
819
- const pageAccessOrgsOptions = [];
817
+ const getOrgName =()=>{
820
818
  const { proxyOrgList } = JSON.parse(window.localStorage.getItem('user'));
821
819
  const orgId = window.localStorage.getItem('orgID');
822
820
  const orgName = (
823
821
  proxyOrgList.find(({ orgID }) => orgID === Number(orgId)) || {}
824
822
  ).orgName;
823
+ return orgName;
824
+ }
825
+ const getPageAccessOrgs = useCallback(() => {
826
+ const {status, data } = fbADData.orgOuData || {};
827
+ const pageAccessOrgsOptions = [];
828
+ const orgName = getOrgName()
825
829
  if (!status) {
826
830
  // !status is the case of library
827
831
  //if org id is the parent org
@@ -855,7 +859,11 @@ export const Advertisement = (props) => {
855
859
 
856
860
  const options = getPageAccessOrgs() || [];
857
861
  const { data = {} } = fbADData.orgOuData || {};
858
- const selectedPageName = Object.keys(data).find((key) => data[key] === pageId);
862
+ const orgName = getOrgName()
863
+ let selectedPageName = Object.keys(data).find((key) => data[key] === pageId);
864
+ if(data[selectedPageName] === -1){
865
+ selectedPageName = orgName;
866
+ }
859
867
  return ( (step === 'modeSelection' && (isEmpty(templateData) || templateData?.mode === "create")) ?
860
868
  ( <CapSpin spinning={adSpinLoader} className="add-facebook-ad-section">
861
869
  <div style={{ position: 'fixed', top: '25px', zIndex: 1}}>
@@ -283,7 +283,7 @@ const Facebook = (props) => {
283
283
  fbAdManager={CREATIVE}
284
284
  />
285
285
  ) :
286
- (!isFullMode && (fbAdManager !== CREATIVE && messageStrategy === "DEFAULT" || (templateData?.edit && templateData?.fbContentType !=="CREATIVE")) ) ?
286
+ (!isFullMode && (fbAdManager !== CREATIVE && messageStrategy === "DEFAULT" || (templateData?.edit && templateData?.fbContentType !==CREATIVE)) ) ?
287
287
  (<div className={className}>
288
288
 
289
289
  <div className="is-scrollable-section" >