Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Commit

Permalink
add acs as feature flag if no settings provided (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
Borja García authored May 21, 2021
1 parent 3d7aecd commit c3eceae
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ChatBubble extends Component {
summary: "Customer support",
text: "Customer support",
userPhone: "",
webAppMeetingDomain: "tailwindtradersacs.azurewebsites.net",
webAppMeetingDomain: new URL(window.location.href).host,
isVideoCall: isVideo.toString(),
}
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
import React from "react";
import React, { useEffect, useState } from "react";

import { Hero, Recommended, Getapp, Popular } from "./components";
import ChatBubble from './components/chatBubble/chatBubble';
import { ConfigService } from './../../services'

const Home = ({ recommendedProducts, popularProducts, loggedIn }) => {
const [customerSupportEnabled, setCustomerSupportEnabled] = useState(false);
useEffect(() => {
async function loadSettings() {
await ConfigService.loadSettings();
setCustomerSupportEnabled(ConfigService._customerSupportEnabled);
}
loadSettings();
},[])
return (
<div className="home">
<Hero />
<Recommended recommendedProductsData={recommendedProducts} loggedIn={loggedIn} />
<Getapp />
{loggedIn && <Popular popularProductsData={popularProducts} />}
<ChatBubble />
{loggedIn && <Popular popularProductsData={popularProducts} />}
{ customerSupportEnabled && <ChatBubble />}
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const ConfigService = {
_acsResource: "",
_logicAppUrl: "",
_email: "",
_customerSupportEnabled: false,

async loadSettings() {
if (this._needLoadSettings) {
Expand Down Expand Up @@ -77,6 +78,11 @@ const ConfigService = {
this._acsResource = settingsResponse.data.acs.resource;
this._logicAppUrl = settingsResponse.data.logicAppUrl;
this._email = settingsResponse.data.email;
this._customerSupportEnabled =
settingsResponse.data.email
&& settingsResponse.data.acs.resource
&& settingsResponse.data.acs.connectionString
&& settingsResponse.data.logicAppUrl;
}
},

Expand Down
2 changes: 1 addition & 1 deletion TailwindTraders.Website/Source/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
- B2CAuth:ClientId=
- B2CAuth:Authority=
- B2CAuth:Scopes=
- Acs__ConnectionString=endpoint=
- Acs__ConnectionString=
- Acs__Resource=
- Email=
- LogicAppUrl=
Expand Down

0 comments on commit c3eceae

Please sign in to comment.