itube-specs 0.0.400 → 0.0.402

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "itube-specs",
3
3
  "type": "module",
4
- "version": "0.0.400",
4
+ "version": "0.0.402",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "./types/index.d.ts",
7
7
  "scripts": {
@@ -1,9 +1,8 @@
1
1
  import { getCookie } from 'h3';
2
2
  import { getGeoHeaders } from './geo';
3
- import { useRuntimeConfig } from '#imports';
4
3
 
5
- export async function isGeoMatch(event) {
6
- const data = await getGeoHeaders(event);
4
+ export async function isGeoMatch(event, config) {
5
+ const data = await getGeoHeaders(event, config);
7
6
 
8
7
  const AGE_VERIFY_REGIONS = ['KS'];
9
8
  const AGE_VERIFY_COUNTRIES = ['GB'];
@@ -11,13 +10,11 @@ export async function isGeoMatch(event) {
11
10
  const countryCode = data?.data[ 'X-Country-Code' ]?.[ 0 ];
12
11
  const stateCode = data?.data[ 'X-Region-Code' ]?.[ 0 ];
13
12
 
14
- // return AGE_VERIFY_COUNTRIES.includes(countryCode)
15
- // || AGE_VERIFY_REGIONS.includes(stateCode);
16
- return true;
13
+ return AGE_VERIFY_COUNTRIES.includes(countryCode)
14
+ || AGE_VERIFY_REGIONS.includes(stateCode);
17
15
  }
18
16
 
19
- export async function isAgeVerified(event) {
20
- const config = useRuntimeConfig();
17
+ export async function isAgeVerified(event, config) {
21
18
  const apiUrl = config.public.apiDomain;
22
19
  const sessionId = getCookie(event, 'session_id') || event?.context.sessionId;
23
20
 
@@ -37,9 +34,8 @@ export async function isAgeVerified(event) {
37
34
  return res.data === true;
38
35
  }
39
36
 
40
- export async function getAgeValidationUrl(event, backPath: string) {
37
+ export async function getAgeValidationUrl(event, backPath: string, config) {
41
38
  const sessionId = event.context?.sessionId || getCookie(event, 'session_id');
42
- const config = useRuntimeConfig();
43
39
  const apiUrl = config.public.apiDomain;
44
40
 
45
41
  const data = await getGeoHeaders(event);
@@ -1,10 +1,7 @@
1
- import { useRuntimeConfig } from '#imports';
2
-
3
- export async function getGeoHeaders(event) {
1
+ export async function getGeoHeaders(event, config) {
4
2
  if (event.context.geoHeaders) {
5
3
  return event.context.geoHeaders;
6
4
  }
7
- const config = useRuntimeConfig();
8
5
  const apiUrl = config.public.apiDomain;
9
6
 
10
7
  const data = await $fetch(`${apiUrl}/v1/tools/headers`, {