Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UHF-9761: Remove user_inquiry code #713

Merged
merged 5 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 0 additions & 48 deletions assets/js/chat_leijuke.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@
if (chatSelection.indexOf('genesys') != -1) {
return new GenesysAdapter;
}
if (chatSelection.indexOf('user_inquiry') != -1) {
if (UserInquiryAdapter.idScheduled()) {
return new UserInquiryAdapter;
}
}
console.warn(`No adapter found for ${chatSelection}!`);
}

Expand Down Expand Up @@ -88,45 +83,6 @@
}
}

/**
* User inquiry is a popup and it handles the opening and closing logic.
*/
class UserInquiryAdapter {
constructor() {
this.requiredCookies = ['statistics'];
this.bot = false;
this.persist = false;
this.hasButton = false;
}
async getChatExtension() {}
open(callback) {}
onClosed(callback) {}
onLoaded(callback) {}

// Return true or false based on hardcoded dates or value in localstorage.
static idScheduled() {
const now = new Date();

const dates = [
{start: '2024-02-26', end: '2024-03-01'},
{start: '2024-03-04', end: '2024-03-08'},
]

// Run the code below in browser to activate the popup for a minute
// localStorage.setItem('user_inquiry_debug', `{"start": "${new Date((Date.now()-60000)).toString()}", "end": "${new Date((Date.now()+60000))}"}`);
const debug = localStorage.getItem('user_inquiry_debug');
if (debug) {
dates.push(JSON.parse(debug));
}

const date = dates.find((object)=>{
return now >= new Date(object.start) && now < new Date(object.end);
});

return !!date;
}
}

class Leijuke {
constructor(leijukeData, extCookieManager, chatAdapter) {

Expand Down Expand Up @@ -331,10 +287,6 @@
leijukeInstance.id = this.static.selector;
leijukeInstance.classList.add('chat-leijuke')

if (this.static.selector === 'chat-leijuke-user_inquiry') {
leijukeInstance.classList.add('is-hidden');
}

leijukeWrapper.append(leijukeInstance);

this.prepButton(leijukeInstance);
Expand Down
1 change: 0 additions & 1 deletion assets/js/ws-2.3.0.js

This file was deleted.

64 changes: 7 additions & 57 deletions helfi_platform_config.install
Original file line number Diff line number Diff line change
Expand Up @@ -68,64 +68,14 @@ function helfi_platform_config_update_9304() : void {
}

/**
* Enable leijuke-block which contains the user inquiry -popup.
* UHF-9761: Remove the user inquiry -popup that is no longer used.
*/
function helfi_platform_config_update_9305() : void {
function helfi_platform_config_update_9306() : void {
$config_factory = Drupal::configFactory();

if (!\Drupal::moduleHandler()->moduleExists('helfi_api_base')) {
return;
}

$environment_resolver = \Drupal::service('helfi_api_base.environment_resolver');
try {
$environment_resolver->getActiveProject();
}
catch (Exception $exception) {
// No active project found, stop execution.
return;
}

$block_installer = Drupal::service('helfi_platform_config.helper.block_installer');
$theme_handler = \Drupal::service('theme_handler');
if (!str_starts_with($theme_handler->getDefault(), 'hdbt')) {
return;
// Make sure the configuration is present.
if (!$config_factory->get('block.block.hdbt_subtheme_user_inquiry')->isNew()) {
// Remove the user inquiry block.
$config_factory->getEditable('block.block.hdbt_subtheme_user_inquiry')->delete();
}

$theme = $theme_handler->getDefault() === 'hdbt_subtheme' ? 'hdbt_subtheme' : 'hdbt';

$block = [
'id' => 'hdbt_subtheme_user_inquiry',
'plugin' => 'chat_leijuke',
'provider' => 'helfi_platform_config',
'weight' => -19,
'settings' => [
'label' => 'User inquiry',
'label_display' => FALSE,
'chat_title' => '',
'chat_selection' => 'user_inquiry',
],
'visibility' => [
'language' => [
'id' => 'language',
'context_mapping' => [
'language' => '@language.current_language_context:language_interface',
],
'langcodes' => ['fi' => 'fi', 'en' => 'en', 'sv' => 'sv'],
],
'user_role' => [
'id' => 'user_role',
'roles' => ['anonymous' => 'anonymous'],
'context_mapping' => ['user' => '@user.current_user_context:current_user'],
],
],
];

$variations = [
[
'theme' => $theme,
'region' => 'attachments',
],
];

$block_installer->install($block, $variations);
}
13 changes: 1 addition & 12 deletions helfi_platform_config.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,6 @@ react_and_share:
js:
assets/js/reactAndShareSettings.js: {}

user_inquiry:
version: 1.0.0
js:
'https://digitalfeedback.euro.confirmit.com/api/digitalfeedback/loader?programKey=2UqP0u': {
type: external,
minified: false,
attributes: {
async: true
}
}

clear_localstorage:
version: 1.0.x
js:
Expand Down Expand Up @@ -64,7 +53,7 @@ genesys_auth_redirect:
- core/drupalSettings

chat_leijuke:
version: 1.0.1
version: 1.0.2
header: true
js:
assets/js/chat_leijuke.js: {}
Expand Down
2 changes: 1 addition & 1 deletion helfi_platform_config.module
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ function helfi_platform_config_language_switch_links_alter(array &$links): void
* Implements hook_config_ignore_settings_alter().
*/
function helfi_platform_config_config_ignore_settings_alter(array &$settings) {
// Chatleijuke is used in hammashoito chat in Sote and by user_inquiry.
// Chatleijuke is used in hammashoito chat in Sote.
// Genesyschat might be used in palvelukeskus later but
// the block configs already removed from other instances.
$add_ignore = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ _core:
id: statistics
label: Statistics
description:
value: '<p>The information collected by statistics cookies is used for developing the website.</p><figure class="table" tabindex="0"><table><thead><tr><th>Name</th><th>Provider</th><th>Purpose of the cookie</th><th>Validity</th><th>Type</th></tr></thead><tbody><tr><td>nmstat</td><td>hel.fi</td><td>The Siteimprove statistics cookie collects information about the use of the website.</td><td>1000 days</td><td>&nbsp;</td></tr><tr><td>_pk_id.*</td><td>hel.fi</td><td>Matomo Analytics - used to store a few details about the user such as the unique visitor ID</td><td>393 days</td><td>&nbsp;</td></tr><tr><td>_pk_ses.141.89f6</td><td>hel.fi</td><td>-</td><td>1 hour</td><td>&nbsp;</td></tr><tr><td>_pk_id.*</td><td>kartta.hel.fi</td><td>Matomo Analytics - used to store a few details about the user such as the unique visitor ID</td><td>393 days</td><td>&nbsp;</td></tr><tr><td>_pk_ses.*</td><td>kartta.hel.fi</td><td>Matomo Analytics - short lived cookies used to temporarily store data for the visit</td><td>1 hour</td><td>&nbsp;</td></tr><tr><td>_pk_id.*</td><td>palvelukartta.hel.fi</td><td>Matomo Analytics - used to store a few details about the user such as the unique visitor ID</td><td>393 days</td><td>&nbsp;</td></tr><tr><td>_pk_ses.*</td><td>palvelukartta.hel.fi</td><td>Matomo Analytics - short lived cookies used to temporarily store data for the visit</td><td>1 hour</td><td>&nbsp;</td></tr><tr><td>rnsbid</td><td><span>reactandshare.com</span></td><td><p><span>A record related to the operation of the&nbsp;</span></p><p><span>Askem</span></p><p><span>&nbsp;react buttons.</span></p></td><td>-</td><td>Local storage</td></tr><tr><td>rnsbid_ts</td><td><span>reactandshare.com</span></td><td><p><span>A record related to the operation of the&nbsp;</span></p><p><span>Askem</span></p><p><span>&nbsp;react buttons.</span></p></td><td>-</td><td>Local storage</td></tr><tr><td>rns_reaction_*</td><td><span>reactandshare.com</span></td><td><p><span>A record related to the operation of the&nbsp;</span></p><p><span>Askem</span></p><p><span>&nbsp;react buttons.</span></p></td><td>-</td><td>Local storage</td></tr><tr><td>YSC</td><td>youtube.com</td><td>The YouTube cookie facilitates including videos as part of the website''s content.</td><td>Session</td><td>Third party</td></tr><tr><td><span>null_active_survey</span></td><td>Norstat</td><td><span>The id of the survey that is live.</span></td><td>-</td><td>Local storage</td></tr><tr><td><span>null_page_view_count</span></td><td>Norstat</td><td><span dir="ltr" role="presentation">How many City of Helsinki pages have you viewed before seeing the survey</span></td><td>-</td><td>Local storage</td></tr><tr><td><span>null_active_scenario</span></td><td>Norstat</td><td><span dir="ltr" role="presentation">What version of the survey module is live.</span></td><td>-</td><td>Local storage</td></tr><tr><td><span>wsLanguage_p933511862344</span></td><td>Norstat</td><td><span dir="ltr" role="presentation">Language identifier used to select which language of the survey you see.</span></td><td>-</td><td>Local storage</td></tr><tr><td><span>p933511862344_status</span></td><td>Norstat</td><td>Have you already completed the survey.</td><td>-</td><td>Local storage</td></tr><tr><td>p933511862344_complete_date</td><td>Norstat</td><td>Date and time when the survey was submitted</td><td>-</td><td>Localstorage</td></tr></tbody></table></figure>'
value: '<p>The information collected by statistics cookies is used for developing the website.</p><figure class="table" tabindex="0"><table><thead><tr><th>Name</th><th>Provider</th><th>Purpose of the cookie</th><th>Validity</th><th>Type</th></tr></thead><tbody><tr><td>nmstat</td><td>hel.fi</td><td>The Siteimprove statistics cookie collects information about the use of the website.</td><td>1000 days</td><td>&nbsp;</td></tr><tr><td>_pk_id.*</td><td>hel.fi</td><td>Matomo Analytics - used to store a few details about the user such as the unique visitor ID</td><td>393 days</td><td>&nbsp;</td></tr><tr><td>_pk_ses.141.89f6</td><td>hel.fi</td><td>-</td><td>1 hour</td><td>&nbsp;</td></tr><tr><td>_pk_id.*</td><td>kartta.hel.fi</td><td>Matomo Analytics - used to store a few details about the user such as the unique visitor ID</td><td>393 days</td><td>&nbsp;</td></tr><tr><td>_pk_ses.*</td><td>kartta.hel.fi</td><td>Matomo Analytics - short lived cookies used to temporarily store data for the visit</td><td>1 hour</td><td>&nbsp;</td></tr><tr><td>_pk_id.*</td><td>palvelukartta.hel.fi</td><td>Matomo Analytics - used to store a few details about the user such as the unique visitor ID</td><td>393 days</td><td>&nbsp;</td></tr><tr><td>_pk_ses.*</td><td>palvelukartta.hel.fi</td><td>Matomo Analytics - short lived cookies used to temporarily store data for the visit</td><td>1 hour</td><td>&nbsp;</td></tr><tr><td>rnsbid</td><td><span>reactandshare.com</span></td><td><p><span>A record related to the operation of the&nbsp;</span></p><p><span>Askem</span></p><p><span>&nbsp;react buttons.</span></p></td><td>-</td><td>Local storage</td></tr><tr><td>rnsbid_ts</td><td><span>reactandshare.com</span></td><td><p><span>A record related to the operation of the&nbsp;</span></p><p><span>Askem</span></p><p><span>&nbsp;react buttons.</span></p></td><td>-</td><td>Local storage</td></tr><tr><td>rns_reaction_*</td><td><span>reactandshare.com</span></td><td><p><span>A record related to the operation of the&nbsp;</span></p><p><span>Askem</span></p><p><span>&nbsp;react buttons.</span></p></td><td>-</td><td>Local storage</td></tr><tr><td>YSC</td><td>youtube.com</td><td>The YouTube cookie facilitates including videos as part of the website''s content.</td><td>Session</td><td>Third party</td></tr></tbody></table></figure>'
format: full_html
checkbox_default_state: unchecked
weight: -7
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
description:
value: '<p>Tilastointievästeiden keräämää tietoa käytetään verkkosivuston kehittämiseen.</p><figure class="table" tabindex="0"><table><thead><tr><th>Nimi</th><th>Tarjoaja</th><th>Tarkoitus</th><th>Voimassa</th><th>Tyyppi</th></tr></thead><tbody><tr><td>nmstat</td><td>hel.fi</td><td>Siteimproven tilastointieväste kerää tietoa kävijän sivujen käytöstä.</td><td>1000 päivää</td><td>&nbsp;</td></tr><tr><td>_pk_id.*</td><td>hel.fi</td><td>Matomo-tilastointijärjestelmän eväste.</td><td>393 päivää</td><td>&nbsp;</td></tr><tr><td>_pk_ses.141.89f6</td><td>hel.fi</td><td>-</td><td>1 tunti</td><td>&nbsp;</td></tr><tr><td>_pk_id.*</td><td>kartta.hel.fi</td><td>Matomo-tilastointijärjestelmän eväste.</td><td>393 päivää</td><td>&nbsp;</td></tr><tr><td>_pk_ses.*</td><td>kartta.hel.fi</td><td>Matomo-tilastointijärjestelmän eväste.</td><td>1 tunti</td><td>&nbsp;</td></tr><tr><td>_pk_id.*</td><td>palvelukartta.hel.fi</td><td>Matomo-tilastointijärjestelmän eväste.</td><td>393 päivää</td><td>&nbsp;</td></tr><tr><td>_pk_ses.*</td><td>palvelukartta.hel.fi</td><td>Matomo-tilastointijärjestelmän eväste.</td><td>1 tunti</td><td>&nbsp;</td></tr><tr><td>rnsbid</td><td><span>reactandshare.com</span></td><td><span>Askem-reaktionappien toimintaan liittyvä tietue.</span></td><td>-</td><td>Paikallinen muisti</td></tr><tr><td>rnsbid_ts</td><td><span>reactandshare.com</span></td><td><span>Askem-reaktionappien toimintaan liittyvä tietue.</span></td><td>-</td><td>Paikallinen muisti</td></tr><tr><td>rns_reaction_*</td><td><span>reactandshare.com</span></td><td><span>Askem-reaktionappien toimintaan liittyvä tietue.</span></td><td>-</td><td>Paikallinen muisti</td></tr><tr><td>YSC</td><td>youtube.com</td><td>YouTuben eväste mahdollistaa videoiden upottamisen sivustolle.</td><td>Istunto</td><td>Kolmas osapuoli</td></tr><tr><td><span>null_active_survey</span></td><td>Norstat</td><td><span>Käynnissä olevan kyselyn tunnus</span></td><td>-</td><td>Paikallinen muisti</td></tr><tr><td><span>null_page_view_count</span></td><td>Norstat</td><td><span dir="ltr" role="presentation">Kuinka monella Helsingin kaupungin</span><br><span dir="ltr" role="presentation">sivulla käyttäjä on vieraillut</span><br><span dir="ltr" role="presentation">ennen kyselyn näkymistä.</span></td><td>-</td><td>Paikallinen muisti</td></tr><tr><td><span>null_active_scenario</span></td><td>Norstat</td><td><span dir="ltr" role="presentation">Mikä kyselymoduulin versio on käytössä.</span></td><td>-</td><td>Paikallinen muisti</td></tr><tr><td><span>wsLanguage_p933511862344</span></td><td>Norstat</td><td><span dir="ltr" role="presentation">Kielitunniste, joka kertoo minkä kielinen kysely käyttäjälle näkyy</span></td><td>-</td><td>Paikallinen muisti</td></tr><tr><td><span>p933511862344_status</span></td><td>Norstat</td><td>Oletko jo vastannut kyselyyn</td><td>-</td><td>Paikallinen muisti</td></tr><tr><td>p933511862344_complete_date</td><td>Norstat</td><td>Päivämäärä ja aika, jolloin kyselylomake lähetettiin.</td><td>-</td><td>Paikallinen muisti</td></tr></tbody></table></figure>'
value: '<p>Tilastointievästeiden keräämää tietoa käytetään verkkosivuston kehittämiseen.</p><figure class="table" tabindex="0"><table><thead><tr><th>Nimi</th><th>Tarjoaja</th><th>Tarkoitus</th><th>Voimassa</th><th>Tyyppi</th></tr></thead><tbody><tr><td>nmstat</td><td>hel.fi</td><td>Siteimproven tilastointieväste kerää tietoa kävijän sivujen käytöstä.</td><td>1000 päivää</td><td>&nbsp;</td></tr><tr><td>_pk_id.*</td><td>hel.fi</td><td>Matomo-tilastointijärjestelmän eväste.</td><td>393 päivää</td><td>&nbsp;</td></tr><tr><td>_pk_ses.141.89f6</td><td>hel.fi</td><td>-</td><td>1 tunti</td><td>&nbsp;</td></tr><tr><td>_pk_id.*</td><td>kartta.hel.fi</td><td>Matomo-tilastointijärjestelmän eväste.</td><td>393 päivää</td><td>&nbsp;</td></tr><tr><td>_pk_ses.*</td><td>kartta.hel.fi</td><td>Matomo-tilastointijärjestelmän eväste.</td><td>1 tunti</td><td>&nbsp;</td></tr><tr><td>_pk_id.*</td><td>palvelukartta.hel.fi</td><td>Matomo-tilastointijärjestelmän eväste.</td><td>393 päivää</td><td>&nbsp;</td></tr><tr><td>_pk_ses.*</td><td>palvelukartta.hel.fi</td><td>Matomo-tilastointijärjestelmän eväste.</td><td>1 tunti</td><td>&nbsp;</td></tr><tr><td>rnsbid</td><td><span>reactandshare.com</span></td><td><span>Askem-reaktionappien toimintaan liittyvä tietue.</span></td><td>-</td><td>Paikallinen muisti</td></tr><tr><td>rnsbid_ts</td><td><span>reactandshare.com</span></td><td><span>Askem-reaktionappien toimintaan liittyvä tietue.</span></td><td>-</td><td>Paikallinen muisti</td></tr><tr><td>rns_reaction_*</td><td><span>reactandshare.com</span></td><td><span>Askem-reaktionappien toimintaan liittyvä tietue.</span></td><td>-</td><td>Paikallinen muisti</td></tr><tr><td>YSC</td><td>youtube.com</td><td>YouTuben eväste mahdollistaa videoiden upottamisen sivustolle.</td><td>Istunto</td><td>Kolmas osapuoli</td></tr></tbody></table></figure>'
format: full_html
label: Tilastointi
Loading
Loading