Skip to content

Commit

Permalink
Merge pull request #1398 from dpc-sdp/release/2.22.0
Browse files Browse the repository at this point in the history
Release/2.22.0
  • Loading branch information
lambry authored Dec 9, 2024
2 parents e00351b + 838cb24 commit d428e69
Show file tree
Hide file tree
Showing 73 changed files with 2,596 additions and 1,667 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v2.22.0

[compare changes](https://github.com/dpc-sdp/ripple-framework/compare/2.22.0...v2.22.0)

## v2.21.0

[compare changes](https://github.com/dpc-sdp/ripple-framework/compare/2.21.0...v2.21.0)
Expand Down
11 changes: 4 additions & 7 deletions examples/nuxt-app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,16 +207,13 @@ export default defineAppConfig({
}
},
mapResultHooks: {
exampleMapResultsHook: (map, results, locationQuery) => {
if (!map || !results || !locationQuery) return
exampleMapResultsHook: (map, results) => {
if (!map || !results) return

centerMap(
map,
[
parseFloat(locationQuery?.center[0]),
parseFloat(locationQuery?.center[1])
],
13,
[15809362.126037747, -4543542.166789566],
8,
{},
'popover'
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const lgaShapeURL = computed(() => {
const defaultStyleFn = (feature: Feature, style: Style) => {
style.getFill().setColor([255, 255, 255, 0.5])
return style
}
const layerIdentifier = 'shapeLayer'
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 12 additions & 11 deletions examples/nuxt-app/test/features/maps/maps.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Feature: Custom collection map component
Given I visit the page "/map"
And the map is loaded
When I click the map component at coordinates 517 242
When I wait 2 seconds
When I wait 4 seconds
Then the map matches the image snapshot "map-popup-type-popover"

@mockserver
Expand All @@ -45,7 +45,7 @@ Feature: Custom collection map component
Given I visit the page "/map"
And the map is loaded
When I click the map component at coordinates 517 242
When I wait 2 seconds
When I wait 4 seconds
Then the map matches the image snapshot "map-popup-type-sidebar"

@mockserver
Expand All @@ -58,7 +58,7 @@ Feature: Custom collection map component
Given I visit the page "/map"
And the map is loaded
When I click the map component at coordinates 663 242
When I wait 2 seconds
When I wait 4 seconds
Then the map matches the image snapshot "map-popup-type-popover-with-sidepanel"

@mockserver
Expand All @@ -71,7 +71,7 @@ Feature: Custom collection map component
Given I visit the page "/map"
And the map is loaded
When I click the map component at coordinates 663 242
When I wait 2 seconds
When I wait 4 seconds
Then the map matches the image snapshot "map-popup-type-sidebar-with-sidepanel"

@mockserver
Expand All @@ -82,8 +82,8 @@ Feature: Custom collection map component
Given the "/api/tide/elasticsearch/elasticsearch_index_develop_node/_search" network request is stubbed with fixture "/maps/simple-map-results" and status 200 as alias "searchReq"
Given I visit the page "/map"
And the map is loaded
When I click the map component at coordinates 606 424
When I wait 2 seconds
When I click the map component at coordinates 606 442
When I wait 4 seconds
Then the map matches the image snapshot "map-popup-type-sidebar-with-sidepanel-double-pin"

@mockserver
Expand All @@ -96,7 +96,7 @@ Feature: Custom collection map component
Given I visit the page "/map"
And the map is loaded
Given I click the side panel item with text "Single Pin Test"
When I wait 2 seconds
When I wait 4 seconds
Then the map matches the image snapshot "map-sidepanel-item-click"

@mockserver
Expand All @@ -111,18 +111,19 @@ Feature: Custom collection map component
And the map is loaded
Then I click the map component at coordinates 545 385
And I wait 1 seconds
Then I click the map component at coordinates 660 320
And I wait 2 seconds
Then I click the map component at coordinates 650 320
And I wait 4 seconds
Then the map matches the image snapshot "map-popover-max-zoom-cluster"

@mockserver
Scenario: Map zooms to intended initial location with results hook
Given I load the page fixture with "/maps/basic-page"
And a custom map results hook called "exampleMapResultsHook" is used
Then the page endpoint for path "/map" returns the loaded fixture
And the "/api/tide/elasticsearch/elasticsearch_index_develop_node/_search" network request is stubbed with fixture "/maps/simple-map-results" and status 200 as alias "searchReq"
Given I visit the page "/map?location[center]=15809362.126037747&location[center]=-4543542.166789566"
And the "/api/tide/elasticsearch/elasticsearch_index_develop_node/_search" network request is delayed by 500 milliseconds and stubbed with fixture "/maps/simple-map-results", status 200 and alias "searchReq"
Given I visit the page "/map"
And the map is loaded
When I wait 4 seconds
Then the map matches the image snapshot "map-initial-location-results-hook"

@mockserver
Expand Down
2 changes: 1 addition & 1 deletion examples/nuxt-app/test/features/maps/vsba.feature
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Feature: School buildings map
Given the "/api/tide/elasticsearch/elasticsearch_index_develop_node/_search" network request is stubbed with fixture "/map-table/vsba/response-all" and status 200 as alias "searchReq"
And I visit the page "/map"
When the map is loaded
When I click the map component at coordinates 650 429
When I click the map component at coordinates 630 440
When I wait 4 seconds
Then the map matches the image snapshot "map-cluster-zoom"

Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.21.0",
"version": "2.22.0",
"npmClient": "pnpm",
"exact": true,
"command": {
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config-ripple/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@dpc-sdp/eslint-config-ripple",
"description": "ESLint config for Ripple projects",
"version": "2.21.0",
"version": "2.22.0",
"license": "Apache-2.0",
"repository": "https://github.com/dpc-sdp/ripple-framework",
"main": "index.js",
Expand Down
7 changes: 7 additions & 0 deletions packages/nuxt-ripple-analytics/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ export default defineAppConfig({
ripple: {
analytics: {
eventListeners
},
featureFlags: {
newRelicBrowserBeacon: 'bam.nr-data.net',
newRelicBrowserJSErrorsEnabled: true,
newRelicBrowserCookiesEnabled: false,
newRelicBrowserDistributedTracingEnabled: false,
newRelicBrowserAjaxDenyList: ['bam.nr-data.net']
}
}
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import type { IRplFeatureFlags } from '@dpc-sdp/ripple-tide-api/types'

export default () => {
const config = useRuntimeConfig()
const browserAgentConfig = config?.public?.newRelic?.browser

if (!browserAgentConfig.enabled) {
return
}

const featureFlags: IRplFeatureFlags = inject('featureFlags', {
newRelicBrowserBeacon: 'bam.nr-data.net',
newRelicBrowserJSErrorsEnabled: true,
newRelicBrowserCookiesEnabled: false,
newRelicBrowserDistributedTracingEnabled: false,
newRelicBrowserAjaxDenyList: ['bam.nr-data.net']
})

// Scripts from new relic need to be dynamically imported, otherwise they will throw an error
const initBrowserAgent = async () => {
// Error module has to be manually added when using new relic via npm
const { JSErrors } = await import(
'@newrelic/browser-agent/features/jserrors'
)

const options = {
info: {
beacon: featureFlags.newRelicBrowserBeacon,
licenseKey: browserAgentConfig.licenseKey,
applicationID: browserAgentConfig.applicationID,
sa: 1 // 'sa' stands for 'standalone' https://github.com/newrelic/newrelic-browser-agent/blob/bbf414c0d6a483141f32e2dd31b1f8a23ad1dda5/src/features/logging/aggregate/index.js#L100
},
init: {
distributed_tracing: {
enabled: featureFlags.newRelicBrowserDistributedTracingEnabled
},
privacy: {
cookies_enabled: featureFlags.newRelicBrowserCookiesEnabled
},
jserrors: { enabled: featureFlags.newRelicBrowserJSErrorsEnabled },
ajax: { deny_list: featureFlags.newRelicBrowserAjaxDenyList }
},
loader_config: {
accountID: browserAgentConfig.accountID,
trustKey: browserAgentConfig.trustKey,
agentID: browserAgentConfig.agentID,
licenseKey: browserAgentConfig.licenseKey,
applicationID: browserAgentConfig.applicationID
},
features: [JSErrors]
}

const { BrowserAgent } = await import(
'@newrelic/browser-agent/loaders/browser-agent'
)

new BrowserAgent(options)
}

if (process.client) {
initBrowserAgent()
}
}
10 changes: 10 additions & 0 deletions packages/nuxt-ripple-analytics/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ export default defineNuxtConfig({
analytics: {
GTM: 'GTM-KF8NCW2'
}
},
newRelic: {
browser: {
enabled: false,
accountID: '',
trustKey: '',
agentID: '',
licenseKey: '',
applicationID: ''
}
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions packages/nuxt-ripple-analytics/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@dpc-sdp/nuxt-ripple-analytics",
"description": "Nuxt module for handling event tracking.",
"version": "2.21.0",
"version": "2.22.0",
"license": "Apache-2.0",
"main": "./nuxt.config.ts",
"repository": "https://github.com/dpc-sdp/ripple-framework",
Expand All @@ -11,7 +11,8 @@
},
"dependencies": {
"@dpc-sdp/ripple-ui-core": "workspace:*",
"@gtm-support/core": "^2.0.0"
"@gtm-support/core": "^2.0.0",
"@newrelic/browser-agent": "^1.273.0"
},
"devDependencies": {
"@dpc-sdp/nuxt-ripple": "workspace:*",
Expand Down
29 changes: 29 additions & 0 deletions packages/nuxt-ripple-analytics/plugins/newRelicBrowser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { defineNuxtPlugin } from '#app'
import trackError from '../utils/trackError'

export default defineNuxtPlugin((nuxtApp) => {
/* @ts-ignore process is extended by webpack */
if (process.client) {
nuxtApp.vueApp.use({
install(app: any) {
useNewRelicBrowserAgent()

const existingErrorHandler = app.config.errorHandler

// Catch all vue errors
app.config.errorHandler = (error: Error) => {
console.error(error)
trackError(error)

// Allow multiple error handlers to run
if (
existingErrorHandler &&
typeof existingErrorHandler === 'function'
) {
existingErrorHandler(error)
}
}
}
})
}
})
15 changes: 15 additions & 0 deletions packages/nuxt-ripple-analytics/utils/trackError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
declare global {
interface Window {
newrelic?: {
noticeError: (error: any) => void
}
}
}

const trackError = (error: any) => {
if (window?.newrelic?.noticeError) {
window.newrelic.noticeError(error)
}
}

export default trackError
2 changes: 1 addition & 1 deletion packages/nuxt-ripple-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@dpc-sdp/nuxt-ripple-cli",
"description": "A CLI for simplifying common setup and scaffolding tasks",
"version": "2.21.0",
"version": "2.22.0",
"license": "Apache-2.0",
"repository": "https://github.com/dpc-sdp/ripple-framework",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt-ripple-preview/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@dpc-sdp/nuxt-ripple-preview",
"description": "Adds support for drupal preview links in Ripple frontend sites",
"version": "2.21.0",
"version": "2.22.0",
"license": "Apache-2.0",
"main": "./nuxt.config.ts",
"repository": "https://github.com/dpc-sdp/ripple-framework",
Expand Down
1 change: 1 addition & 0 deletions packages/nuxt-ripple/components/TideAlerts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const filteredAlerts = computed(() => {
return !dismissedIds.includes(alert.alertId)
})
} catch (e) {
trackError(e)
console.error(
'Something went wrong when trying to get dismissed alerts cookie'
)
Expand Down
9 changes: 8 additions & 1 deletion packages/nuxt-ripple/composables/use-tide-error.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export const useTideError = (statusCode: number): void => {
export const useTideError = (
statusCode: number,
originalError?: Error
): void => {
if (statusCode) {
switch (statusCode) {
case 404:
Expand Down Expand Up @@ -28,6 +31,10 @@ export const useTideError = (statusCode: number): void => {
break

default:
if (originalError) {
trackError(originalError)
}

throw createError({
statusCode: 500,
statusMessage: 'We have a glitch in our system.',
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt-ripple/composables/use-tide-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const useTidePage = async (
}

if (error && error.value?.statusCode) {
useTideError(error.value?.statusCode)
useTideError(error.value?.statusCode, error.value)
}

debugLogger('Page data fetched', {
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt-ripple/composables/use-tide-site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const useTideSite = async (id?: number): Promise<TideSiteData> => {
if (error && error.value?.statusCode) {
console.log(error)
console.log('API error fetching site data')
useTideError(500)
useTideError(500, error.value)
}

// Section.io cache tags must be set on the response header to invalidate the cache after a change in drupal
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt-ripple/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@dpc-sdp/nuxt-ripple",
"description": "Nuxt module for integrating Ripple and Tide",
"version": "2.21.0",
"version": "2.22.0",
"license": "Apache-2.0",
"main": "./nuxt.config.ts",
"repository": "https://github.com/dpc-sdp/ripple-framework",
Expand Down
2 changes: 1 addition & 1 deletion packages/ripple-sdp-core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@dpc-sdp/ripple-sdp-core",
"description": "SDP core content types",
"version": "2.21.0",
"version": "2.22.0",
"license": "Apache-2.0",
"repository": "https://github.com/dpc-sdp/ripple-framework",
"main": "./nuxt.config.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/ripple-storybook/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ripple-storybook",
"description": "Ripple Storybook instance",
"version": "2.21.0",
"version": "2.22.0",
"license": "Apache-2.0",
"private": true,
"repository": "https://github.com/dpc-sdp/ripple-framework",
Expand Down
Loading

0 comments on commit d428e69

Please sign in to comment.