Skip to content

Commit

Permalink
chore: merge in develop
Browse files Browse the repository at this point in the history
  • Loading branch information
David Featherston committed Aug 22, 2023
2 parents 469818a + 03b630c commit bac6c72
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 16 deletions.
6 changes: 3 additions & 3 deletions examples/nuxt-app/test/features/search-listing/grants.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Feature: Grants collection
And the search listing layout should be "list"
And the search network request should be called with the "/search-listing/grants/request" fixture
And the grant search listing results should have following items:
| title | url | updated | content | audience | amount | status |
| THIS IS A TEST | /tc-9b-grant-page-closed | Updated: 9 May 2023 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam tincidunt sit amet ligula sit amet lacinia. In a leo nec tortor aliquet faucibus. | Business | $11,326 - $26,494 | Closed |
| TC-9a Grant Simple Test - Date Range | /tc-9a-grant-simple-test-date-range | Updated: 9 May 2023 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam tincidunt sit amet ligula sit amet lacinia. In a leo nec tortor aliquet faucibus. | Not-for-profit groups, government | $11,326 - $26,494 | Open, closing in 163 days |
| title | url | updated | content | audience | amount | status |
| THIS IS A TEST | https://localhost:3000/tc-9b-grant-page-closed | Updated: 9 May 2023 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam tincidunt sit amet ligula sit amet lacinia. In a leo nec tortor aliquet faucibus. | Business | $11,326 - $26,494 | Closed |
| TC-9a Grant Simple Test - Date Range | https://localhost:3000/tc-9a-grant-simple-test-date-range | Updated: 9 May 2023 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam tincidunt sit amet ligula sit amet lacinia. In a leo nec tortor aliquet faucibus. | Not-for-profit groups, government | $11,326 - $26,494 | Open, closing in 163 days |

@mockserver
Example: Grant status filter - Open
Expand Down
3 changes: 2 additions & 1 deletion packages/nuxt-ripple-analytics/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ export default {
'rpl-search-result/navigate': () => {
return (payload: any) => {
trackEvent({
event: `${payload.action}_link`,
event: `${payload.action}_search_result`,
element_id: payload?.id,
element_text: payload?.text,
label: payload?.label,
Expand Down Expand Up @@ -538,6 +538,7 @@ export default {
event: `${payload.action}_menu_item`,
element_id: payload?.id,
element_text: payload?.text,
link_url: payload?.value,
name: payload?.name,
index: payload?.index,
component: 'rpl-vertical-nav',
Expand Down
16 changes: 14 additions & 2 deletions packages/nuxt-ripple-analytics/lib/tracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,17 @@ export interface IRplAnalyticsEventPayload {
}
}

const mapPayload = (payload: IRplAnalyticsEventPayload) =>
Object.fromEntries(
/**
* Maps the payload object to meet analytics requirements.
*/
const mapPayload = (payload: IRplAnalyticsEventPayload) => {
const { $app_origin } = useNuxtApp()

return Object.fromEntries(
Object.entries(payload).map(([key, value]) => {
let newValue = value

// Set 'empty' values to undefined
if (
value === null ||
value === '' ||
Expand All @@ -51,9 +57,15 @@ const mapPayload = (payload: IRplAnalyticsEventPayload) =>
newValue = undefined
}

// Prepend origin to relative link_urls
if (key === 'link_url' && value?.match(/^\//)) {
newValue = `${$app_origin}${value}`
}

return [key, newValue]
})
)
}

export const trackEvent = (payload: IRplAnalyticsEventPayload) => {
if (!window) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import * as rplCypressConfigPkg from '@dpc-sdp/ripple-test-utils'

export default defineConfig({
env: {
searchIndex: process.env.NUXT_PUBLIC_TIDE_APP_SEARCH_ENGINE_NAME
searchIndex: process.env.NUXT_PUBLIC_TIDE_APP_SEARCH_ENGINE_NAME,
NUXT_PUBLIC_TIDE_SITE: process.env.NUXT_PUBLIC_TIDE_SITE
},
e2e: {
baseUrl: 'http://localhost:3000',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
to: .github/PULL_REQUEST_TEMPLATE.yml
to: .github/PULL_REQUEST_TEMPLATE.md
---
<!-- Add link to JIRA eg: https://digital-vic.atlassian.net/browse/SDPAP- or GitHub Issue Number eg: #123 -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ to: package.json
"cy:open": "cypress open",
"cy:run": "cypress run",
"test:unit": "jest --colors --runInBand --passWithNoTests",
"test:integration": "start-test dev:mock tcp:3000 'cy:open'",
"test:integration-ci": "start-test start:mock tcp:3000 'cy:run'"
}
"test:integration": "NUXT_PUBLIC_TIDE_SITE=TEST_SITE NUXT_PUBLIC_TIDE_BASE_URL=https://test.base.url/ start-test dev:mock tcp:3000 'cy:open'",
"test:integration-ci": "NUXT_PUBLIC_TIDE_SITE=TEST_SITE NUXT_PUBLIC_TIDE_BASE_URL=https://test.base.url/ start-test start:mock tcp:3000 'cy:run'"
},
"devDependencies": {
"@babel/plugin-transform-runtime": "^7.22.4",
"@babel/preset-env": "^7.22.4",
Expand Down
1 change: 1 addition & 0 deletions packages/nuxt-ripple/components/TideBaseLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
:secondaryLogo="site?.siteLogo"
:items="site?.menus.menuMain || []"
:showQuickExit="site?.showQuickExit"
:showSearch="!featureFlags?.disablePrimaryNavSearch"
>
</RplPrimaryNav>
</slot>
Expand Down
1 change: 1 addition & 0 deletions packages/nuxt-ripple/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default defineNuxtConfig({
}
},
public: {
siteUrl: '',
apiUrl: '',
tide: {
baseUrl: 'https://develop.content.reference.sdp.vic.gov.au',
Expand Down
7 changes: 6 additions & 1 deletion packages/nuxt-ripple/plugins/app_hostname.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { defineNuxtPlugin } from '#app'

export default defineNuxtPlugin((nuxtApp) => {
let host = ''
let protocol = 'https'

// Get host in case of server side request
if (import.meta.env.SSR) {
Expand All @@ -10,7 +11,11 @@ export default defineNuxtPlugin((nuxtApp) => {
host = window.location.host
}

const origin = new URL(`https://${host}`)
if (process.env.NODE_ENV === 'development' && host.startsWith('localhost')) {
protocol = 'http'
}

const origin = new URL(`${protocol}://${host}`)

// Extract origin and set data in app context
return {
Expand Down
4 changes: 4 additions & 0 deletions packages/ripple-tide-api/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ export interface IRplFeatureFlags {
* @description Option to disable the display of topics and tags on all content types
*/
disableTopicTags?: boolean
/**
* @description Option to disable the display of the search form within the primary navigation
*/
disablePrimaryNavSearch?: boolean
/**
* @description Option to disable the display of coloured/rainbow stripes on top of promo cards
*/
Expand Down
6 changes: 5 additions & 1 deletion packages/ripple-tide-search/composables/useSearchResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface ResultOptions {
}

export default (result, options: ResultOptions = { summaryMaxLength: 150 }) => {
const { $app_origin } = useNuxtApp()
const title = computed(() => getSearchResultValue(result, 'title'))
const url = computed(() => {
const externalURL = getSearchResultValue(result, 'field_node_link')
Expand All @@ -14,7 +15,10 @@ export default (result, options: ResultOptions = { summaryMaxLength: 150 }) => {
return externalURL
}

return getSearchResultValue(result, 'url').replace(/\/site-(\d+)/, '')
return getSearchResultValue(result, 'url').replace(
/\/site-(\d+)/,
$app_origin || ''
)
})
const updated = computed(() => {
const rawDate = getSearchResultValue(result, 'changed')
Expand Down
3 changes: 2 additions & 1 deletion packages/ripple-tide-search/pages/search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const searchDriverOptions = {
}
const searchResultsMappingFn = (item): MappedSearchResult<any> => {
const { $app_origin } = useNuxtApp()
let summaryField =
item.summary_processed?.snippet || item.field_landing_page_summary?.snippet
Expand All @@ -89,7 +90,7 @@ const searchResultsMappingFn = (item): MappedSearchResult<any> => {
component: 'TideAppSearchResult',
props: {
title: item.title?.raw?.[0],
url: item.url?.raw?.[0].replace(/\/site-(\d+)/, ''),
url: item.url?.raw?.[0].replace(/\/site-(\d+)/, $app_origin || ''),
content: summaryField,
updated: rawUpdated ? formatDate(rawUpdated) : ''
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default {

<script setup lang="ts">
import { computed, inject } from 'vue'
import { useDebounceFn } from '@vueuse/core'
import { RplIcon } from '@dpc-sdp/ripple-ui-core/vue'
import RplFormCounter from '../RplFormCounter/RplFormCounter.vue'
import { useRippleEvent } from '@dpc-sdp/ripple-ui-core'
Expand All @@ -31,6 +32,7 @@ interface Props {
required?: boolean
centeredText?: boolean
globalEvents?: boolean
throttle?: number
onInput?: (payload: Event) => void
onBlur?: (payload: Event) => void
}
Expand All @@ -53,6 +55,7 @@ const props = withDefaults(defineProps<Props>(), {
variant: 'default',
centeredText: false,
globalEvents: true,
throttle: 500,
onInput: () => null,
onBlur: () => null
})
Expand Down Expand Up @@ -80,7 +83,7 @@ const classes = computed(() => {
const isWordCounter = computed(() => props.counter === 'word')
const handleChange = () => {
const handleChange = useDebounceFn(() => {
emitRplEvent(
'update',
{
Expand All @@ -93,7 +96,7 @@ const handleChange = () => {
},
{ global: props.globalEvents }
)
}
}, props.throttle)
</script>

<template>
Expand Down

0 comments on commit bac6c72

Please sign in to comment.