fix temp garbage now lexicons are updated
This commit is contained in:
@@ -55,11 +55,6 @@ export const config: app.bsky.ageassurance.defs.Config = {
|
|||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
/*
|
|
||||||
* `platforms` is not in the generated `ConfigRegion` yet (the server sends
|
|
||||||
* it and `getAgeAssuranceRegionConfigForGeolocation` reads it), so this
|
|
||||||
* fixture asserts the shape until the lexicon carries the field.
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
// On-device verification region, native-only (web users in TX are not
|
// On-device verification region, native-only (web users in TX are not
|
||||||
// age assured). KWS is included as a fallback for when the device
|
// age assured). KWS is included as a fallback for when the device
|
||||||
@@ -78,7 +73,7 @@ export const config: app.bsky.ageassurance.defs.Config = {
|
|||||||
access: 'none',
|
access: 'none',
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
} as app.bsky.ageassurance.defs.ConfigRegion,
|
},
|
||||||
{
|
{
|
||||||
countryCode: 'GB',
|
countryCode: 'GB',
|
||||||
minAccessAge: 13,
|
minAccessAge: 13,
|
||||||
|
|||||||
@@ -12,15 +12,14 @@ describe('getAgeAssuranceRegionConfigForGeolocation', () => {
|
|||||||
const region = (
|
const region = (
|
||||||
countryCode: string,
|
countryCode: string,
|
||||||
regionCode?: string,
|
regionCode?: string,
|
||||||
platforms?: string[],
|
platforms?: app.bsky.ageassurance.defs.ConfigRegion['platforms'],
|
||||||
) =>
|
): app.bsky.ageassurance.defs.ConfigRegion => ({
|
||||||
({
|
countryCode,
|
||||||
countryCode,
|
regionCode,
|
||||||
regionCode,
|
platforms,
|
||||||
platforms,
|
minAccessAge: 13,
|
||||||
minAccessAge: 13,
|
rules: [],
|
||||||
rules: [],
|
})
|
||||||
}) as app.bsky.ageassurance.defs.ConfigRegion
|
|
||||||
|
|
||||||
it('skips regions for other platforms and continues matching', () => {
|
it('skips regions for other platforms and continues matching', () => {
|
||||||
const web = region('US', undefined, ['web'])
|
const web = region('US', undefined, ['web'])
|
||||||
|
|||||||
@@ -46,18 +46,23 @@ export function getAgeAssuranceRegionConfigForGeolocation(
|
|||||||
geolocation: Geolocation,
|
geolocation: Geolocation,
|
||||||
): app.bsky.ageassurance.defs.ConfigRegion | undefined {
|
): app.bsky.ageassurance.defs.ConfigRegion | undefined {
|
||||||
/*
|
/*
|
||||||
* The SDK's region matcher takes no `platform` filter (and the generated
|
* The SDK's region matcher takes no `platform` filter, so platform scoping
|
||||||
* `ConfigRegion` carries no `platforms` field yet), so platform scoping is
|
* is applied here: regions restricted to other platforms are dropped before
|
||||||
* applied here: regions restricted to other platforms are dropped before
|
* matching. Once the SDK accepts a platform, this whole function body
|
||||||
* matching, which is what passing `platform` to the old api helper did.
|
* collapses to:
|
||||||
* Fold this back into the SDK call once it accepts a platform.
|
*
|
||||||
|
* return getAgeAssuranceRegionConfig(config, {
|
||||||
|
* countryCode: geolocation.countryCode ?? '',
|
||||||
|
* regionCode: geolocation.regionCode,
|
||||||
|
* platform: AGE_ASSURANCE_PLATFORM,
|
||||||
|
* })
|
||||||
*/
|
*/
|
||||||
const scoped: app.bsky.ageassurance.defs.Config = {
|
const scoped: app.bsky.ageassurance.defs.Config = {
|
||||||
...config,
|
...config,
|
||||||
regions: config.regions.filter(region => {
|
regions: config.regions.filter(
|
||||||
const platforms = (region as {platforms?: string[]}).platforms
|
region =>
|
||||||
return !platforms || platforms.includes(AGE_ASSURANCE_PLATFORM)
|
!region.platforms || region.platforms.includes(AGE_ASSURANCE_PLATFORM),
|
||||||
}),
|
),
|
||||||
}
|
}
|
||||||
return getAgeAssuranceRegionConfig(scoped, {
|
return getAgeAssuranceRegionConfig(scoped, {
|
||||||
countryCode: geolocation.countryCode ?? '',
|
countryCode: geolocation.countryCode ?? '',
|
||||||
|
|||||||
@@ -1,15 +1,6 @@
|
|||||||
import {type app} from '#/lexicons'
|
import {type app} from '#/lexicons'
|
||||||
|
|
||||||
/**
|
export type Notification = app.bsky.notification.listNotifications.Notification
|
||||||
* A `listNotifications` notification, widened with the `starterPack` the server
|
|
||||||
* attaches to a `follow` notification sourced from a starter pack. The pinned
|
|
||||||
* lexicon does not declare the field yet, so it is added here rather than read
|
|
||||||
* off an `unknown`. Drop this alias once the generated type carries it.
|
|
||||||
*/
|
|
||||||
export type Notification =
|
|
||||||
app.bsky.notification.listNotifications.Notification & {
|
|
||||||
starterPack?: app.bsky.graph.defs.StarterPackViewBasic
|
|
||||||
}
|
|
||||||
|
|
||||||
export type NotificationType =
|
export type NotificationType =
|
||||||
| StarterPackNotificationType
|
| StarterPackNotificationType
|
||||||
|
|||||||
Reference in New Issue
Block a user