This repository has been archived by the owner on Apr 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Security fixes for Demo Apps dir (#2)
* Revert "[DEVREL-1180] Refactor: Ticket-merger Freshdesk sample-app (#340)" This reverts commit c068b68. * Revert "👌 IMPROVE: add whitelisting domain support (#342)" This reverts commit 2b451e4. * Revert "🐛 FIX: whitelisting changes (#341)" This reverts commit bc05622. * Revert "[DEVREL-1166] Tweak: Spinner in Joke component (#331)" This reverts commit e42ea10.
- Loading branch information
1 parent
aec4d80
commit 42edb18
Showing
21 changed files
with
182 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
dist | ||
work | ||
build | ||
.frsh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"apiKey": "Enter you API Key" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 26 additions & 33 deletions
59
...elopment-Features/Configuration-Features/config-iparams-html-freshdesk/app/scripts/app.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,49 @@ | ||
function getJoke() { | ||
const JOKE_ENDPOINT = "https://official-joke-api.appspot.com/random_joke"; | ||
client.request.get(JOKE_ENDPOINT).then(function (data) { | ||
showSpinner(data); | ||
const setup = JSON.parse(data.response).setup; | ||
const punchline = JSON.parse(data.response).punchline; | ||
displayPunchline(punchline); | ||
pick(".card").style.display = "block"; | ||
pick( | ||
"#setup" | ||
).innerHTML = `<fw-label value="Question:" color="red"></fw-label> ${setup}`; | ||
}), | ||
function (error) { | ||
console.error("Error fetching data from endpoint", error); | ||
}; | ||
} | ||
|
||
function showSpinner(data) { | ||
if (data) { | ||
pick(".spinner-div").style.display = "none"; | ||
} | ||
} | ||
const JOKE_ENDPOINT = 'https://official-joke-api.appspot.com/random_joke'; | ||
|
||
function displayPunchline(punchline) { | ||
pick("#punchline-btn").addEventListener("click", function () { | ||
pick( | ||
"#punchline" | ||
).innerHTML = `<fw-label value="${punchline}" color="green"></fw-label>`; | ||
}); | ||
function getJoke() { | ||
client.request.get(JOKE_ENDPOINT).then( | ||
function (data) { | ||
let setup = JSON.parse(data.response).setup; | ||
punchline = JSON.parse(data.response).punchline; | ||
document.getElementById('setup').innerHTML = `<fw-label value="Question:" color="red"></fw-label> ${setup}`; | ||
}), function(error) { | ||
console.log(error ) | ||
} | ||
} | ||
|
||
function pick(selector) { | ||
return document.querySelector(selector); | ||
function addListner() { | ||
document.getElementById('punchline-btn').addEventListener('click', function() { | ||
document.getElementById('punchline').innerHTML = `<fw-label value="${punchline}" color="green"></fw-label>` | ||
}) | ||
} | ||
|
||
document.onreadystatechange = function () { | ||
if (document.readyState === "interactive") renderApp(); | ||
if (document.readyState === 'interactive') renderApp(); | ||
|
||
function renderApp() { | ||
var onInit = app.initialized(); | ||
|
||
onInit.then(getClient).catch(handleErr); | ||
|
||
function getClient(_client) { | ||
window.client = _client; | ||
client.events.on("app.activated", onAppActivate); | ||
client.events.on('app.activated', onAppActivate); | ||
} | ||
} | ||
}; | ||
|
||
function onAppActivate() { | ||
var textElement = document.getElementById('apptext'); | ||
var getContact = client.data.get('contact'); | ||
getContact.then(showContact).catch(handleErr); | ||
|
||
function showContact(payload) { | ||
textElement.innerHTML = `Ticket created by ${payload.contact.name}`; | ||
} | ||
getJoke(); | ||
addListner(); | ||
} | ||
|
||
function handleErr(err) { | ||
console.error(`Error occurred. Details:`, err); | ||
console.error(`Error occured. Details:`, err); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 26 additions & 33 deletions
59
...pment-Features/Configuration-Features/config-iparams-html-freshservice/app/scripts/app.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,49 @@ | ||
function getJoke() { | ||
const JOKE_ENDPOINT = "https://official-joke-api.appspot.com/random_joke"; | ||
client.request.get(JOKE_ENDPOINT).then(function (data) { | ||
showSpinner(data); | ||
const setup = JSON.parse(data.response).setup; | ||
const punchline = JSON.parse(data.response).punchline; | ||
displayPunchline(punchline); | ||
pick(".card").style.display = "block"; | ||
pick( | ||
"#setup" | ||
).innerHTML = `<fw-label value="Question:" color="red"></fw-label> ${setup}`; | ||
}), | ||
function (error) { | ||
console.error("Error fetching data from endpoint", error); | ||
}; | ||
} | ||
|
||
function showSpinner(data) { | ||
if (data) { | ||
pick(".spinner-div").style.display = "none"; | ||
} | ||
} | ||
const JOKE_ENDPOINT = 'https://official-joke-api.appspot.com/random_joke'; | ||
|
||
function displayPunchline(punchline) { | ||
pick("#punchline-btn").addEventListener("click", function () { | ||
pick( | ||
"#punchline" | ||
).innerHTML = `<fw-label value="${punchline}" color="green"></fw-label>`; | ||
}); | ||
function getJoke() { | ||
client.request.get(JOKE_ENDPOINT).then( | ||
function (data) { | ||
let setup = JSON.parse(data.response).setup; | ||
punchline = JSON.parse(data.response).punchline; | ||
document.getElementById('setup').innerHTML = `<fw-label value="Question:" color="red"></fw-label> ${setup}`; | ||
}), function(error) { | ||
console.log(error ) | ||
} | ||
} | ||
|
||
function pick(selector) { | ||
return document.querySelector(selector); | ||
function addListner() { | ||
document.getElementById('punchline-btn').addEventListener('click', function() { | ||
document.getElementById('punchline').innerHTML = `<fw-label value="${punchline}" color="green"></fw-label>` | ||
}) | ||
} | ||
|
||
document.onreadystatechange = function () { | ||
if (document.readyState === "interactive") renderApp(); | ||
if (document.readyState === 'interactive') renderApp(); | ||
|
||
function renderApp() { | ||
var onInit = app.initialized(); | ||
|
||
onInit.then(getClient).catch(handleErr); | ||
|
||
function getClient(_client) { | ||
window.client = _client; | ||
client.events.on("app.activated", onAppActivate); | ||
client.events.on('app.activated', onAppActivate); | ||
} | ||
} | ||
}; | ||
|
||
function onAppActivate() { | ||
var textElement = document.getElementById('apptext'); | ||
var getContact = client.data.get('contact'); | ||
getContact.then(showContact).catch(handleErr); | ||
|
||
function showContact(payload) { | ||
textElement.innerHTML = `Ticket created by ${payload.contact.name}`; | ||
} | ||
getJoke(); | ||
addListner(); | ||
} | ||
|
||
function handleErr(err) { | ||
console.error(`Error occurred. Details:`, err); | ||
console.error(`Error occured. Details:`, err); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.