@c15t/backend 1.4.2 → 1.5.0-canary-20250722085128

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.
Files changed (36) hide show
  1. package/.turbo/turbo-build.log +11 -11
  2. package/CHANGELOG.md +6 -0
  3. package/dist/core.cjs +94 -49
  4. package/dist/core.d.ts +2 -1
  5. package/dist/core.d.ts.map +1 -1
  6. package/dist/core.js +92 -48
  7. package/dist/handlers/consent/show-banner/geo.d.ts +10 -0
  8. package/dist/handlers/consent/show-banner/geo.d.ts.map +1 -0
  9. package/dist/handlers/consent/show-banner/geo.test.d.ts +2 -0
  10. package/dist/handlers/consent/show-banner/geo.test.d.ts.map +1 -0
  11. package/dist/handlers/consent/{show-banner.handler.d.ts → show-banner/handler.d.ts} +1 -10
  12. package/dist/handlers/consent/{show-banner.handler.d.ts.map → show-banner/handler.d.ts.map} +1 -1
  13. package/dist/handlers/consent/show-banner/handler.test.d.ts +2 -0
  14. package/dist/handlers/consent/show-banner/handler.test.d.ts.map +1 -0
  15. package/dist/handlers/consent/show-banner/translations.d.ts +13 -0
  16. package/dist/handlers/consent/show-banner/translations.d.ts.map +1 -0
  17. package/dist/handlers/consent/show-banner/translations.test.d.ts +2 -0
  18. package/dist/handlers/consent/show-banner/translations.test.d.ts.map +1 -0
  19. package/dist/pkgs/types/options.d.ts +10 -0
  20. package/dist/pkgs/types/options.d.ts.map +1 -1
  21. package/dist/router.cjs +89 -45
  22. package/dist/router.js +88 -44
  23. package/package.json +1 -1
  24. package/src/core.ts +10 -3
  25. package/src/handlers/consent/index.ts +1 -1
  26. package/src/handlers/consent/show-banner/geo.test.ts +281 -0
  27. package/src/handlers/consent/show-banner/geo.ts +96 -0
  28. package/src/handlers/consent/show-banner/handler.test.ts +376 -0
  29. package/src/handlers/consent/show-banner/handler.ts +120 -0
  30. package/src/handlers/consent/show-banner/translations.test.ts +121 -0
  31. package/src/handlers/consent/show-banner/translations.ts +79 -0
  32. package/src/pkgs/types/options.ts +13 -0
  33. package/dist/handlers/consent/show-banner.handler.test.d.ts +0 -2
  34. package/dist/handlers/consent/show-banner.handler.test.d.ts.map +0 -1
  35. package/src/handlers/consent/show-banner.handler.test.ts +0 -194
  36. package/src/handlers/consent/show-banner.handler.ts +0 -190
@@ -1,15 +1,15 @@
1
1
 
2
- > @c15t/backend@1.4.2 build /home/runner/work/c15t/c15t/packages/backend
2
+ > @c15t/backend@1.5.0-canary-20250722085128 build /home/runner/work/c15t/c15t/packages/backend
3
3
  > rslib build
4
4
 
5
5
  Rslib v0.6.2
6
6
 
7
- ready built in 0.71 s (esm)
8
- ready built in 0.71 s (cjs)
7
+ ready built in 0.70 s (esm)
8
+ ready built in 0.70 s (cjs)
9
9
  start generating declaration files... (esm)
10
10
  start generating declaration files... (cjs)
11
- ready declaration files generated in 8.69 s (esm)
12
- ready declaration files generated in 8.69 s (cjs)
11
+ ready declaration files generated in 8.79 s (esm)
12
+ ready declaration files generated in 8.72 s (cjs)
13
13
 
14
14
   File (esm) Size 
15
15
  dist/pkgs/types/index.js 0.00 kB
@@ -19,16 +19,16 @@ ready declaration files generated in 8.69 s (cjs)
19
19
  dist/pkgs/db-adapters/adapters/memory-adapter/index.js 44.3 kB
20
20
  dist/pkgs/db-adapters/adapters/prisma-adapter/index.js 47.5 kB
21
21
  dist/pkgs/db-adapters/adapters/drizzle-adapter/index.js 50.0 kB
22
- dist/router.js 50.4 kB
23
22
  dist/pkgs/migrations/index.js 50.7 kB
23
+ dist/router.js 52.4 kB
24
24
  dist/pkgs/db-adapters/adapters/kysely-adapter/index.js 55.3 kB
25
25
  dist/pkgs/data-model/schema/index.js 60.9 kB
26
26
  dist/schema/index.js 61.2 kB
27
27
  dist/pkgs/data-model/index.js 61.8 kB
28
28
  dist/pkgs/db-adapters/index.js 89.6 kB
29
- dist/core.js 155.2 kB
29
+ dist/core.js 157.2 kB
30
30
 
31
- Total: 780.1 kB
31
+ Total: 784.1 kB
32
32
 
33
33
   -----
34
34
 
@@ -39,15 +39,15 @@ ready declaration files generated in 8.69 s (cjs)
39
39
  dist/contracts.cjs 31.7 kB
40
40
  dist/pkgs/db-adapters/adapters/memory-adapter/index.cjs 45.3 kB
41
41
  dist/pkgs/db-adapters/adapters/prisma-adapter/index.cjs 48.4 kB
42
- dist/router.cjs 50.2 kB
43
42
  dist/pkgs/db-adapters/adapters/drizzle-adapter/index.cjs 50.7 kB
43
+ dist/router.cjs 52.1 kB
44
44
  dist/pkgs/migrations/index.cjs 52.3 kB
45
45
  dist/pkgs/db-adapters/adapters/kysely-adapter/index.cjs 56.3 kB
46
46
  dist/pkgs/data-model/schema/index.cjs 64.0 kB
47
47
  dist/schema/index.cjs 64.5 kB
48
48
  dist/pkgs/data-model/index.cjs 66.0 kB
49
49
  dist/pkgs/db-adapters/index.cjs 90.8 kB
50
- dist/core.cjs 154.1 kB
50
+ dist/core.cjs 156.1 kB
51
51
 
52
- Total: 800.7 kB
52
+ Total: 804.6 kB
53
53
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @c15t/backend
2
2
 
3
+ ## 1.5.0-canary-20250722085128
4
+
5
+ ### Minor Changes
6
+
7
+ - 74e1825: feat(backend): added advanced overrides for disabling geo-location & adding custom translations
8
+
3
9
  ## 1.4.2
4
10
 
5
11
  ### Patch Changes
package/dist/core.cjs CHANGED
@@ -38,6 +38,8 @@ __webpack_require__.d(__webpack_exports__, {
38
38
  const logger_namespaceObject = require("@doubletie/logger");
39
39
  const fetch_namespaceObject = require("@orpc/openapi/fetch");
40
40
  const plugins_namespaceObject = require("@orpc/server/plugins");
41
+ const external_defu_namespaceObject = require("defu");
42
+ var external_defu_default = /*#__PURE__*/ __webpack_require__.n(external_defu_namespaceObject);
41
43
  const external_neverthrow_namespaceObject = require("neverthrow");
42
44
  const server_namespaceObject = require("@orpc/server");
43
45
  const error_codes_ERROR_CODES = Object.freeze({
@@ -288,7 +290,6 @@ function createTelemetryOptions(appName = 'c15t', telemetryConfig) {
288
290
  const resources_namespaceObject = require("@opentelemetry/resources");
289
291
  const sdk_node_namespaceObject = require("@opentelemetry/sdk-node");
290
292
  const sdk_trace_base_namespaceObject = require("@opentelemetry/sdk-trace-base");
291
- const external_defu_namespaceObject = require("defu");
292
293
  function utils_applyDefaultValue(inputValue, field, operation) {
293
294
  if ('update' === operation) return inputValue;
294
295
  if (null == inputValue && field.defaultValue) {
@@ -2233,9 +2234,7 @@ function getBaseURL(url, path) {
2233
2234
  const fromEnv = env.C15T_URL || env.NEXT_PUBLIC_C15T_URL || env.PUBLIC_C15T_URL || env.NUXT_PUBLIC_C15T_URL || env.NUXT_PUBLIC_AUTH_URL || ('/' !== env.BASE_URL ? env.BASE_URL : void 0);
2234
2235
  if (fromEnv) return withPath(fromEnv, path);
2235
2236
  }
2236
- var package_namespaceObject = {
2237
- i8: "1.4.2"
2238
- };
2237
+ var package_namespaceObject = JSON.parse('{"i8":"1.5.0-canary-20250722085128"}');
2239
2238
  const createRegistry = (ctx)=>({
2240
2239
  ...auditLogRegistry(ctx),
2241
2240
  ...consentRegistry(ctx),
@@ -3076,46 +3075,6 @@ const postConsent = os.consent.post.handler(async ({ input, context })=>{
3076
3075
  });
3077
3076
  }
3078
3077
  });
3079
- const translations_namespaceObject = require("@c15t/translations");
3080
- function getPreferredLanguage(acceptLanguage) {
3081
- if (!acceptLanguage) return 'en';
3082
- const primaryLang = acceptLanguage.split(',')[0]?.split(';')[0]?.split('-')[0]?.toLowerCase();
3083
- if (primaryLang && primaryLang in translations_namespaceObject.baseTranslations) return primaryLang;
3084
- return 'en';
3085
- }
3086
- const show_banner_handler_showConsentBanner = os.consent.showBanner.handler(({ context })=>{
3087
- const typedContext = context;
3088
- const headers = typedContext.headers;
3089
- if (!headers) throw new server_namespaceObject.ORPCError('LOCATION_DETECTION_FAILED', {
3090
- data: {
3091
- reason: 'No headers found in request context'
3092
- }
3093
- });
3094
- const normalizeHeader = (value)=>{
3095
- if (!value) return null;
3096
- return Array.isArray(value) ? value[0] ?? null : value;
3097
- };
3098
- const countryCode = normalizeHeader(headers.get('x-c15t-country')) ?? normalizeHeader(headers.get('cf-ipcountry')) ?? normalizeHeader(headers.get('x-vercel-ip-country')) ?? normalizeHeader(headers.get('x-amz-cf-ipcountry')) ?? normalizeHeader(headers.get('x-country-code'));
3099
- const regionCode = normalizeHeader(headers.get('x-c15t-region')) ?? normalizeHeader(headers.get('x-vercel-ip-country-region')) ?? normalizeHeader(headers.get('x-region-code'));
3100
- const acceptLanguage = normalizeHeader(headers.get('accept-language'));
3101
- const preferredLanguage = getPreferredLanguage(acceptLanguage);
3102
- const { showConsentBanner, jurisdictionCode, message } = checkJurisdiction(countryCode);
3103
- return {
3104
- showConsentBanner,
3105
- jurisdiction: {
3106
- code: jurisdictionCode,
3107
- message
3108
- },
3109
- location: {
3110
- countryCode,
3111
- regionCode
3112
- },
3113
- translations: {
3114
- translations: translations_namespaceObject.baseTranslations[preferredLanguage],
3115
- language: preferredLanguage
3116
- }
3117
- };
3118
- });
3119
3078
  function checkJurisdiction(countryCode) {
3120
3079
  const jurisdictions = {
3121
3080
  EU: new Set([
@@ -3177,6 +3136,7 @@ function checkJurisdiction(countryCode) {
3177
3136
  let showConsentBanner = true;
3178
3137
  let jurisdictionCode = 'NONE';
3179
3138
  if (countryCode) {
3139
+ const normalizedCountryCode = countryCode.toUpperCase();
3180
3140
  showConsentBanner = false;
3181
3141
  const jurisdictionMap = [
3182
3142
  {
@@ -3224,7 +3184,7 @@ function checkJurisdiction(countryCode) {
3224
3184
  code: 'PIPA'
3225
3185
  }
3226
3186
  ];
3227
- for (const { sets, code } of jurisdictionMap)if (sets.some((set)=>set.has(countryCode))) {
3187
+ for (const { sets, code } of jurisdictionMap)if (sets.some((set)=>set.has(normalizedCountryCode))) {
3228
3188
  jurisdictionCode = code;
3229
3189
  showConsentBanner = true;
3230
3190
  break;
@@ -3237,6 +3197,91 @@ function checkJurisdiction(countryCode) {
3237
3197
  message
3238
3198
  };
3239
3199
  }
3200
+ const translations_namespaceObject = require("@c15t/translations");
3201
+ function isSupportedBaseLanguage(lang) {
3202
+ return lang in translations_namespaceObject.baseTranslations;
3203
+ }
3204
+ function getPreferredLanguage(acceptLanguage, supportedLanguages) {
3205
+ if (!acceptLanguage) return 'en';
3206
+ const primaryLang = acceptLanguage.split(',')[0]?.split(';')[0]?.split('-')[0]?.toLowerCase();
3207
+ if (primaryLang && supportedLanguages.includes(primaryLang)) return primaryLang;
3208
+ return 'en';
3209
+ }
3210
+ function getTranslations(acceptLanguage, customTranslations) {
3211
+ const supportedDefaultLanguages = Object.keys(translations_namespaceObject.baseTranslations);
3212
+ const supportedCustomLanguages = Object.keys(customTranslations || {});
3213
+ const supportedLanguages = [
3214
+ ...supportedDefaultLanguages,
3215
+ ...supportedCustomLanguages
3216
+ ];
3217
+ const preferredLanguage = getPreferredLanguage(acceptLanguage, supportedLanguages);
3218
+ const base = isSupportedBaseLanguage(preferredLanguage) ? translations_namespaceObject.baseTranslations[preferredLanguage] : translations_namespaceObject.baseTranslations.en;
3219
+ const custom = supportedCustomLanguages.includes(preferredLanguage) ? customTranslations?.[preferredLanguage] : {};
3220
+ const translations = custom ? (0, translations_namespaceObject.deepMergeTranslations)(base, custom) : base;
3221
+ return {
3222
+ translations: translations,
3223
+ language: preferredLanguage
3224
+ };
3225
+ }
3226
+ function getHeaders(headers) {
3227
+ if (!headers) throw new server_namespaceObject.ORPCError('LOCATION_DETECTION_FAILED', {
3228
+ data: {
3229
+ reason: 'No headers found in request context'
3230
+ }
3231
+ });
3232
+ const normalizeHeader = (value)=>{
3233
+ if (!value) return null;
3234
+ return Array.isArray(value) ? value[0] ?? null : value;
3235
+ };
3236
+ const countryCode = normalizeHeader(headers.get('x-c15t-country')) ?? normalizeHeader(headers.get('cf-ipcountry')) ?? normalizeHeader(headers.get('x-vercel-ip-country')) ?? normalizeHeader(headers.get('x-amz-cf-ipcountry')) ?? normalizeHeader(headers.get('x-country-code'));
3237
+ const regionCode = normalizeHeader(headers.get('x-c15t-region')) ?? normalizeHeader(headers.get('x-vercel-ip-country-region')) ?? normalizeHeader(headers.get('x-region-code'));
3238
+ const acceptLanguage = normalizeHeader(headers.get('accept-language'));
3239
+ return {
3240
+ countryCode,
3241
+ regionCode,
3242
+ acceptLanguage
3243
+ };
3244
+ }
3245
+ function buildResponse({ shouldShowBanner, jurisdiction, location, acceptLanguage, customTranslations }) {
3246
+ return {
3247
+ showConsentBanner: shouldShowBanner,
3248
+ jurisdiction,
3249
+ location,
3250
+ translations: getTranslations(acceptLanguage, customTranslations)
3251
+ };
3252
+ }
3253
+ const handler_showConsentBanner = os.consent.showBanner.handler(({ context })=>{
3254
+ const typedContext = context;
3255
+ const { customTranslations, disableGeoLocation } = typedContext.options.advanced ?? {};
3256
+ const { countryCode, regionCode, acceptLanguage } = getHeaders(typedContext.headers);
3257
+ if (disableGeoLocation) return buildResponse({
3258
+ shouldShowBanner: true,
3259
+ jurisdiction: {
3260
+ code: 'NONE',
3261
+ message: JurisdictionMessages.NONE
3262
+ },
3263
+ location: {
3264
+ countryCode: null,
3265
+ regionCode: null
3266
+ },
3267
+ acceptLanguage,
3268
+ customTranslations
3269
+ });
3270
+ const { showConsentBanner, jurisdictionCode, message } = checkJurisdiction(countryCode);
3271
+ return buildResponse({
3272
+ shouldShowBanner: showConsentBanner,
3273
+ jurisdiction: {
3274
+ code: jurisdictionCode,
3275
+ message
3276
+ },
3277
+ location: {
3278
+ countryCode,
3279
+ regionCode
3280
+ },
3281
+ acceptLanguage,
3282
+ customTranslations
3283
+ });
3284
+ });
3240
3285
  const verifyConsent = os.consent.verify.handler(async ({ input, context })=>{
3241
3286
  const typedContext = context;
3242
3287
  const logger = typedContext.logger;
@@ -3388,7 +3433,7 @@ async function checkPolicyConsent({ policyId, subjectId, domainId, purposeIds, t
3388
3433
  }
3389
3434
  const consentHandlers = {
3390
3435
  post: postConsent,
3391
- showBanner: show_banner_handler_showConsentBanner,
3436
+ showBanner: handler_showConsentBanner,
3392
3437
  verify: verifyConsent
3393
3438
  };
3394
3439
  const statusHandler = os.meta.status.handler(({ context })=>{
@@ -3668,7 +3713,7 @@ const c15tInstance = (options)=>{
3668
3713
  headers: request.headers,
3669
3714
  userAgent: request.headers.get('user-agent') || void 0,
3670
3715
  appName: options.appName || 'c15t',
3671
- options,
3716
+ options: ctx.options,
3672
3717
  trustedOrigins: options.trustedOrigins || [],
3673
3718
  baseURL: options.baseURL || '/',
3674
3719
  tables: ctx.tables
@@ -3701,7 +3746,7 @@ const c15tInstance = (options)=>{
3701
3746
  status: 404
3702
3747
  });
3703
3748
  };
3704
- const handler = async (request)=>{
3749
+ const handler = async (request, ctxOverride)=>{
3705
3750
  try {
3706
3751
  const url = new URL(request.url);
3707
3752
  (0, logger_namespaceObject.createLogger)(options.logger)?.debug?.('Incoming request', {
@@ -3714,7 +3759,7 @@ const c15tInstance = (options)=>{
3714
3759
  if (docsResponse) return docsResponse;
3715
3760
  const ctxResult = await contextPromise;
3716
3761
  if (!ctxResult.isOk()) throw ctxResult.error;
3717
- const ctx = ctxResult.value;
3762
+ const ctx = external_defu_default()(ctxOverride || {}, ctxResult.value);
3718
3763
  const basePath = options.basePath || options.baseURL || '/';
3719
3764
  (0, logger_namespaceObject.createLogger)(options.logger)?.debug?.('[c15t] Using basePath/baseURL', {
3720
3765
  basePath
package/dist/core.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { DeepPartial } from './pkgs/types/helper';
1
2
  import type { C15TContext, C15TOptions, C15TPlugin } from './types';
2
3
  import { router } from './router';
3
4
  /**
@@ -941,7 +942,7 @@ export declare const c15tInstance: <PluginTypes extends C15TPlugin[] = C15TPlugi
941
942
  }>, import("@orpc/contract").MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
942
943
  };
943
944
  };
944
- handler: (request: Request) => Promise<Response>;
945
+ handler: (request: Request, ctxOverride?: DeepPartial<C15TContext>) => Promise<Response>;
945
946
  };
946
947
  export type { C15TPlugin, C15TOptions, C15TContext };
947
948
  export type { ContractsInputs, ContractsOutputs } from './contracts';
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAUpE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,YAAY,CAAC,WAAW,SAAS,UAAU,EAAE,GAAG,UAAU,EAAE;IAC5E;;;;;;;;;;;;;;;OAeG;IACH,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEjD;;OAEG;IACH,OAAO,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAElC;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAE/B;;OAEG;IACH,MAAM,EAAE,OAAO,MAAM,CAAC;IAEtB;;;;OAIG;IACH,cAAc,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAEvD;;;;OAIG;IACH,SAAS,EAAE,MAAM,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,WAAW,SAAS,UAAU,EAAE,GAAG,UAAU,EAAE,EAC3E,SAAS,WAAW,CAAC,WAAW,CAAC;;;mBA6RI,OAAO;oBAAP,OAAO;mBAAP,OAAO;qBAAP,OAAO;sBAAP,OAAO;uBAAP,OAAO;oBAAP,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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__ from "@orpc/openapi/fetch";
3
3
  import * as __WEBPACK_EXTERNAL_MODULE__orpc_server_plugins_e445fd4f__ from "@orpc/server/plugins";
4
+ import * as __WEBPACK_EXTERNAL_MODULE_defu__ from "defu";
4
5
  import * as __WEBPACK_EXTERNAL_MODULE_neverthrow__ from "neverthrow";
5
6
  import * as __WEBPACK_EXTERNAL_MODULE__orpc_server_0dae8408__ from "@orpc/server";
6
7
  import * as __WEBPACK_EXTERNAL_MODULE__opentelemetry_api_87359e78__ from "@opentelemetry/api";
7
8
  import * as __WEBPACK_EXTERNAL_MODULE__opentelemetry_resources_c7ac8648__ from "@opentelemetry/resources";
8
9
  import * as __WEBPACK_EXTERNAL_MODULE__opentelemetry_sdk_node_50b75088__ from "@opentelemetry/sdk-node";
9
10
  import * as __WEBPACK_EXTERNAL_MODULE__opentelemetry_sdk_trace_base_5031a705__ from "@opentelemetry/sdk-trace-base";
10
- import * as __WEBPACK_EXTERNAL_MODULE_defu__ from "defu";
11
11
  import * as __WEBPACK_EXTERNAL_MODULE_superjson__ from "superjson";
12
12
  import * as __WEBPACK_EXTERNAL_MODULE_base_x_aeb88370__ from "base-x";
13
13
  import * as __WEBPACK_EXTERNAL_MODULE_zod__ from "zod";
@@ -2198,9 +2198,7 @@ function getBaseURL(url, path) {
2198
2198
  const fromEnv = env.C15T_URL || env.NEXT_PUBLIC_C15T_URL || env.PUBLIC_C15T_URL || env.NUXT_PUBLIC_C15T_URL || env.NUXT_PUBLIC_AUTH_URL || ('/' !== env.BASE_URL ? env.BASE_URL : void 0);
2199
2199
  if (fromEnv) return withPath(fromEnv, path);
2200
2200
  }
2201
- var package_namespaceObject = {
2202
- i8: "1.4.2"
2203
- };
2201
+ var package_namespaceObject = JSON.parse('{"i8":"1.5.0-canary-20250722085128"}');
2204
2202
  const createRegistry = (ctx)=>({
2205
2203
  ...auditLogRegistry(ctx),
2206
2204
  ...consentRegistry(ctx),
@@ -3038,45 +3036,6 @@ const postConsent = os.consent.post.handler(async ({ input, context })=>{
3038
3036
  });
3039
3037
  }
3040
3038
  });
3041
- function getPreferredLanguage(acceptLanguage) {
3042
- if (!acceptLanguage) return 'en';
3043
- const primaryLang = acceptLanguage.split(',')[0]?.split(';')[0]?.split('-')[0]?.toLowerCase();
3044
- if (primaryLang && primaryLang in __WEBPACK_EXTERNAL_MODULE__c15t_translations_cdae900b__.baseTranslations) return primaryLang;
3045
- return 'en';
3046
- }
3047
- const show_banner_handler_showConsentBanner = os.consent.showBanner.handler(({ context })=>{
3048
- const typedContext = context;
3049
- const headers = typedContext.headers;
3050
- if (!headers) throw new __WEBPACK_EXTERNAL_MODULE__orpc_server_0dae8408__.ORPCError('LOCATION_DETECTION_FAILED', {
3051
- data: {
3052
- reason: 'No headers found in request context'
3053
- }
3054
- });
3055
- const normalizeHeader = (value)=>{
3056
- if (!value) return null;
3057
- return Array.isArray(value) ? value[0] ?? null : value;
3058
- };
3059
- const countryCode = normalizeHeader(headers.get('x-c15t-country')) ?? normalizeHeader(headers.get('cf-ipcountry')) ?? normalizeHeader(headers.get('x-vercel-ip-country')) ?? normalizeHeader(headers.get('x-amz-cf-ipcountry')) ?? normalizeHeader(headers.get('x-country-code'));
3060
- const regionCode = normalizeHeader(headers.get('x-c15t-region')) ?? normalizeHeader(headers.get('x-vercel-ip-country-region')) ?? normalizeHeader(headers.get('x-region-code'));
3061
- const acceptLanguage = normalizeHeader(headers.get('accept-language'));
3062
- const preferredLanguage = getPreferredLanguage(acceptLanguage);
3063
- const { showConsentBanner, jurisdictionCode, message } = checkJurisdiction(countryCode);
3064
- return {
3065
- showConsentBanner,
3066
- jurisdiction: {
3067
- code: jurisdictionCode,
3068
- message
3069
- },
3070
- location: {
3071
- countryCode,
3072
- regionCode
3073
- },
3074
- translations: {
3075
- translations: __WEBPACK_EXTERNAL_MODULE__c15t_translations_cdae900b__.baseTranslations[preferredLanguage],
3076
- language: preferredLanguage
3077
- }
3078
- };
3079
- });
3080
3039
  function checkJurisdiction(countryCode) {
3081
3040
  const jurisdictions = {
3082
3041
  EU: new Set([
@@ -3138,6 +3097,7 @@ function checkJurisdiction(countryCode) {
3138
3097
  let showConsentBanner = true;
3139
3098
  let jurisdictionCode = 'NONE';
3140
3099
  if (countryCode) {
3100
+ const normalizedCountryCode = countryCode.toUpperCase();
3141
3101
  showConsentBanner = false;
3142
3102
  const jurisdictionMap = [
3143
3103
  {
@@ -3185,7 +3145,7 @@ function checkJurisdiction(countryCode) {
3185
3145
  code: 'PIPA'
3186
3146
  }
3187
3147
  ];
3188
- for (const { sets, code } of jurisdictionMap)if (sets.some((set)=>set.has(countryCode))) {
3148
+ for (const { sets, code } of jurisdictionMap)if (sets.some((set)=>set.has(normalizedCountryCode))) {
3189
3149
  jurisdictionCode = code;
3190
3150
  showConsentBanner = true;
3191
3151
  break;
@@ -3198,6 +3158,90 @@ function checkJurisdiction(countryCode) {
3198
3158
  message
3199
3159
  };
3200
3160
  }
3161
+ function isSupportedBaseLanguage(lang) {
3162
+ return lang in __WEBPACK_EXTERNAL_MODULE__c15t_translations_cdae900b__.baseTranslations;
3163
+ }
3164
+ function getPreferredLanguage(acceptLanguage, supportedLanguages) {
3165
+ if (!acceptLanguage) return 'en';
3166
+ const primaryLang = acceptLanguage.split(',')[0]?.split(';')[0]?.split('-')[0]?.toLowerCase();
3167
+ if (primaryLang && supportedLanguages.includes(primaryLang)) return primaryLang;
3168
+ return 'en';
3169
+ }
3170
+ function getTranslations(acceptLanguage, customTranslations) {
3171
+ const supportedDefaultLanguages = Object.keys(__WEBPACK_EXTERNAL_MODULE__c15t_translations_cdae900b__.baseTranslations);
3172
+ const supportedCustomLanguages = Object.keys(customTranslations || {});
3173
+ const supportedLanguages = [
3174
+ ...supportedDefaultLanguages,
3175
+ ...supportedCustomLanguages
3176
+ ];
3177
+ const preferredLanguage = getPreferredLanguage(acceptLanguage, supportedLanguages);
3178
+ const base = isSupportedBaseLanguage(preferredLanguage) ? __WEBPACK_EXTERNAL_MODULE__c15t_translations_cdae900b__.baseTranslations[preferredLanguage] : __WEBPACK_EXTERNAL_MODULE__c15t_translations_cdae900b__.baseTranslations.en;
3179
+ const custom = supportedCustomLanguages.includes(preferredLanguage) ? customTranslations?.[preferredLanguage] : {};
3180
+ const translations = custom ? (0, __WEBPACK_EXTERNAL_MODULE__c15t_translations_cdae900b__.deepMergeTranslations)(base, custom) : base;
3181
+ return {
3182
+ translations: translations,
3183
+ language: preferredLanguage
3184
+ };
3185
+ }
3186
+ function getHeaders(headers) {
3187
+ if (!headers) throw new __WEBPACK_EXTERNAL_MODULE__orpc_server_0dae8408__.ORPCError('LOCATION_DETECTION_FAILED', {
3188
+ data: {
3189
+ reason: 'No headers found in request context'
3190
+ }
3191
+ });
3192
+ const normalizeHeader = (value)=>{
3193
+ if (!value) return null;
3194
+ return Array.isArray(value) ? value[0] ?? null : value;
3195
+ };
3196
+ const countryCode = normalizeHeader(headers.get('x-c15t-country')) ?? normalizeHeader(headers.get('cf-ipcountry')) ?? normalizeHeader(headers.get('x-vercel-ip-country')) ?? normalizeHeader(headers.get('x-amz-cf-ipcountry')) ?? normalizeHeader(headers.get('x-country-code'));
3197
+ const regionCode = normalizeHeader(headers.get('x-c15t-region')) ?? normalizeHeader(headers.get('x-vercel-ip-country-region')) ?? normalizeHeader(headers.get('x-region-code'));
3198
+ const acceptLanguage = normalizeHeader(headers.get('accept-language'));
3199
+ return {
3200
+ countryCode,
3201
+ regionCode,
3202
+ acceptLanguage
3203
+ };
3204
+ }
3205
+ function buildResponse({ shouldShowBanner, jurisdiction, location, acceptLanguage, customTranslations }) {
3206
+ return {
3207
+ showConsentBanner: shouldShowBanner,
3208
+ jurisdiction,
3209
+ location,
3210
+ translations: getTranslations(acceptLanguage, customTranslations)
3211
+ };
3212
+ }
3213
+ const handler_showConsentBanner = os.consent.showBanner.handler(({ context })=>{
3214
+ const typedContext = context;
3215
+ const { customTranslations, disableGeoLocation } = typedContext.options.advanced ?? {};
3216
+ const { countryCode, regionCode, acceptLanguage } = getHeaders(typedContext.headers);
3217
+ if (disableGeoLocation) return buildResponse({
3218
+ shouldShowBanner: true,
3219
+ jurisdiction: {
3220
+ code: 'NONE',
3221
+ message: JurisdictionMessages.NONE
3222
+ },
3223
+ location: {
3224
+ countryCode: null,
3225
+ regionCode: null
3226
+ },
3227
+ acceptLanguage,
3228
+ customTranslations
3229
+ });
3230
+ const { showConsentBanner, jurisdictionCode, message } = checkJurisdiction(countryCode);
3231
+ return buildResponse({
3232
+ shouldShowBanner: showConsentBanner,
3233
+ jurisdiction: {
3234
+ code: jurisdictionCode,
3235
+ message
3236
+ },
3237
+ location: {
3238
+ countryCode,
3239
+ regionCode
3240
+ },
3241
+ acceptLanguage,
3242
+ customTranslations
3243
+ });
3244
+ });
3201
3245
  const verifyConsent = os.consent.verify.handler(async ({ input, context })=>{
3202
3246
  const typedContext = context;
3203
3247
  const logger = typedContext.logger;
@@ -3349,7 +3393,7 @@ async function checkPolicyConsent({ policyId, subjectId, domainId, purposeIds, t
3349
3393
  }
3350
3394
  const consentHandlers = {
3351
3395
  post: postConsent,
3352
- showBanner: show_banner_handler_showConsentBanner,
3396
+ showBanner: handler_showConsentBanner,
3353
3397
  verify: verifyConsent
3354
3398
  };
3355
3399
  const statusHandler = os.meta.status.handler(({ context })=>{
@@ -3629,7 +3673,7 @@ const c15tInstance = (options)=>{
3629
3673
  headers: request.headers,
3630
3674
  userAgent: request.headers.get('user-agent') || void 0,
3631
3675
  appName: options.appName || 'c15t',
3632
- options,
3676
+ options: ctx.options,
3633
3677
  trustedOrigins: options.trustedOrigins || [],
3634
3678
  baseURL: options.baseURL || '/',
3635
3679
  tables: ctx.tables
@@ -3662,7 +3706,7 @@ const c15tInstance = (options)=>{
3662
3706
  status: 404
3663
3707
  });
3664
3708
  };
3665
- const handler = async (request)=>{
3709
+ const handler = async (request, ctxOverride)=>{
3666
3710
  try {
3667
3711
  const url = new URL(request.url);
3668
3712
  (0, __WEBPACK_EXTERNAL_MODULE__doubletie_logger_91c58a8f__.createLogger)(options.logger)?.debug?.('Incoming request', {
@@ -3675,7 +3719,7 @@ const c15tInstance = (options)=>{
3675
3719
  if (docsResponse) return docsResponse;
3676
3720
  const ctxResult = await contextPromise;
3677
3721
  if (!ctxResult.isOk()) throw ctxResult.error;
3678
- const ctx = ctxResult.value;
3722
+ const ctx = (0, __WEBPACK_EXTERNAL_MODULE_defu__["default"])(ctxOverride || {}, ctxResult.value);
3679
3723
  const basePath = options.basePath || options.baseURL || '/';
3680
3724
  (0, __WEBPACK_EXTERNAL_MODULE__doubletie_logger_91c58a8f__.createLogger)(options.logger)?.debug?.('[c15t] Using basePath/baseURL', {
3681
3725
  basePath
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Determines if a consent banner should be shown based on country code
3
+ * and returns appropriate jurisdiction information
4
+ */
5
+ export declare function checkJurisdiction(countryCode: string | null): {
6
+ showConsentBanner: boolean;
7
+ jurisdictionCode: "GDPR" | "CH" | "BR" | "PIPEDA" | "AU" | "APPI" | "PIPA" | "NONE";
8
+ message: "GDPR or equivalent regulations require a cookie banner." | "Switzerland requires similar data protection measures." | "Brazil's LGPD requires consent for cookies." | "PIPEDA requires consent for data collection." | "Australia's Privacy Act mandates transparency about data collection." | "Japan's APPI requires consent for data collection." | "South Korea's PIPA requires consent for data collection." | "No specific requirements";
9
+ };
10
+ //# sourceMappingURL=geo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geo.d.ts","sourceRoot":"","sources":["../../../../src/handlers/consent/show-banner/geo.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;;;;EAsF3D"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=geo.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geo.test.d.ts","sourceRoot":"","sources":["../../../../src/handlers/consent/show-banner/geo.test.ts"],"names":[],"mappings":""}
@@ -416,13 +416,4 @@ export declare const showConsentBanner: import("@orpc/server").ImplementedProced
416
416
  language: string;
417
417
  };
418
418
  }>, Record<never, never>, Record<never, never>>;
419
- /**
420
- * Determines if a consent banner should be shown based on country code
421
- * and returns appropriate jurisdiction information
422
- */
423
- export declare function checkJurisdiction(countryCode: string | null): {
424
- showConsentBanner: boolean;
425
- jurisdictionCode: "GDPR" | "CH" | "BR" | "PIPEDA" | "AU" | "APPI" | "PIPA" | "NONE";
426
- message: "GDPR or equivalent regulations require a cookie banner." | "Switzerland requires similar data protection measures." | "Brazil's LGPD requires consent for cookies." | "PIPEDA requires consent for data collection." | "Australia's Privacy Act mandates transparency about data collection." | "Japan's APPI requires consent for data collection." | "South Korea's PIPA requires consent for data collection." | "No specific requirements";
427
- };
428
- //# sourceMappingURL=show-banner.handler.d.ts.map
419
+ //# sourceMappingURL=handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"show-banner.handler.d.ts","sourceRoot":"","sources":["../../../src/handlers/consent/show-banner.handler.ts"],"names":[],"mappings":"AAqCA;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+CA2D7B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;;;;EAmF3D"}
1
+ {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../src/handlers/consent/show-banner/handler.ts"],"names":[],"mappings":"AA8EA;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+CAqC7B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=handler.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.test.d.ts","sourceRoot":"","sources":["../../../../src/handlers/consent/show-banner/handler.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import { type CompleteTranslations, type Translations } from '@c15t/translations';
2
+ /**
3
+ * Gets the translations for a given language, merging custom translations if provided.
4
+ *
5
+ * @param acceptLanguage - The `Accept-Language` header from the request.
6
+ * @param customTranslations - An object containing custom translations to merge with the base translations.
7
+ * @returns An object containing the final translations and the determined language.
8
+ */
9
+ export declare function getTranslations(acceptLanguage: string | null, customTranslations?: Record<string, Partial<Translations>>): {
10
+ translations: CompleteTranslations;
11
+ language: string;
12
+ };
13
+ //# sourceMappingURL=translations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../../src/handlers/consent/show-banner/translations.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,oBAAoB,EACzB,KAAK,YAAY,EAGjB,MAAM,oBAAoB,CAAC;AAmC5B;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC9B,cAAc,EAAE,MAAM,GAAG,IAAI,EAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;kBA0B3B,oBAAoB;;EAGnD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=translations.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translations.test.d.ts","sourceRoot":"","sources":["../../../../src/handlers/consent/show-banner/translations.test.ts"],"names":[],"mappings":""}
@@ -1,5 +1,6 @@
1
1
  import type { DatabaseHook } from '../data-model';
2
2
  import type { DatabaseConfiguration } from '../db-adapters/adapters/kysely-adapter/types';
3
+ import type { Translations } from '@c15t/translations';
3
4
  import type { LoggerOptions } from '@doubletie/logger';
4
5
  import type { Tracer } from '@opentelemetry/api';
5
6
  import type { TablesConfig } from '../../schema/types';
@@ -81,6 +82,15 @@ export interface DoubleTieOptions {
81
82
  * Settings for specialized use cases
82
83
  */
83
84
  advanced?: {
85
+ /**
86
+ * Disable Geo-Location detection
87
+ */
88
+ disableGeoLocation?: boolean;
89
+ /**
90
+ * Custom Translation Strings
91
+ * Override the default translations with your own
92
+ */
93
+ customTranslations?: Record<string, Partial<Translations>>;
84
94
  /**
85
95
  * Ip address configuration
86
96
  */
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/pkgs/types/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kDAAkD,CAAC;AAE9F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KA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