refactor: split raqbUtils into server and client modules to fix RAQB import in server context (#26112)
* refactor: add server and client raqbUtils modules Add two new modules to split RAQB utilities: - raqbUtils.server.ts: Server-safe utilities without RAQB runtime - raqbUtils.client.ts: Client-only utilities requiring RAQB runtime This enables server-side code to import RAQB utilities without pulling in the react-awesome-query-builder runtime library. Co-Authored-By: Volnei Munhoz <[email protected]> * refactor: update imports to use server/client raqbUtils modules and fix lint warnings Co-Authored-By: Volnei Munhoz <[email protected]> * fix: fix type errors in getLuckyUser.ts and remove dead code in RouteBuilder.tsx Co-Authored-By: Volnei Munhoz <[email protected]> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
7 files changed
+292
-313
No files matched your search
@@ -5,7 +5,7 @@ import { Query, Builder, Utils as QbUtils } from "react-awesome-query-builder";
|
||||
import type { ImmutableTree, BuilderProps } from "react-awesome-query-builder";
|
||||
import type { JsonTree } from "react-awesome-query-builder";
|
||||
|
||||
import { buildStateFromQueryValue } from "@calcom/app-store/_utils/raqb/raqbUtils";
|
||||
import { buildStateFromQueryValue } from "@calcom/app-store/_utils/raqb/raqbUtils.client";
|
||||
import {
|
||||
withRaqbSettingsAndWidgets,
|
||||
ConfigFor,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { acrossQueryValueCompatiblity } from "@calcom/app-store/_utils/raqb/raqbUtils";
|
||||
import { acrossQueryValueCompatiblity } from "@calcom/app-store/_utils/raqb/raqbUtils.server";
|
||||
import type { FormResponse, Fields } from "@calcom/app-store/routing-forms/types/types";
|
||||
import { zodRoutes } from "@calcom/app-store/routing-forms/zod";
|
||||
import dayjs from "@calcom/dayjs";
|
||||
@@ -502,10 +502,10 @@ export class LuckyUserService implements ILuckyUserService {
|
||||
type?: string | undefined;
|
||||
properties?:
|
||||
| {
|
||||
field?: any;
|
||||
operator?: any;
|
||||
value?: any;
|
||||
valueSrc?: any;
|
||||
field?: string | null;
|
||||
operator?: string | null;
|
||||
value?: (string | string[])[];
|
||||
valueSrc?: string[];
|
||||
}
|
||||
| undefined;
|
||||
}
|
||||
@@ -523,9 +523,10 @@ export class LuckyUserService implements ILuckyUserService {
|
||||
const attributeId = obj.field;
|
||||
const allRRHostsWeights = new Map<number, number[]>();
|
||||
|
||||
if (attributeId === attributeWithWeights.id) {
|
||||
obj.value.forEach((arrayobj: string[]) => {
|
||||
arrayobj.forEach((attributeOption: string) => {
|
||||
if (attributeId === attributeWithWeights.id && obj.value) {
|
||||
obj.value.forEach((valueItem) => {
|
||||
const attributeOptions = Array.isArray(valueItem) ? valueItem : [valueItem];
|
||||
attributeOptions.forEach((attributeOption: string) => {
|
||||
const attributeOptionWithUsers = attributeWithWeights.options.find(
|
||||
(option) => option.value.toLowerCase() === attributeOption.toLowerCase()
|
||||
);
|
||||
@@ -570,10 +571,10 @@ export class LuckyUserService implements ILuckyUserService {
|
||||
type?: string | undefined;
|
||||
properties?:
|
||||
| {
|
||||
field?: any;
|
||||
operator?: any;
|
||||
value?: any;
|
||||
valueSrc?: any;
|
||||
field?: string | null;
|
||||
operator?: string | null;
|
||||
value?: (string | string[])[];
|
||||
valueSrc?: string[];
|
||||
}
|
||||
| undefined;
|
||||
}
|
||||
@@ -590,9 +591,10 @@ export class LuckyUserService implements ILuckyUserService {
|
||||
fieldValueArray.some((obj) => {
|
||||
const attributeId = obj.field;
|
||||
|
||||
if (attributeId === attributeWithWeights.id) {
|
||||
obj.value.some((arrayobj: string[]) => {
|
||||
arrayobj.some((attributeOptionId: string) => {
|
||||
if (attributeId === attributeWithWeights.id && obj.value) {
|
||||
obj.value.some((valueItem) => {
|
||||
const attributeOptionIds = Array.isArray(valueItem) ? valueItem : [valueItem];
|
||||
return attributeOptionIds.some((attributeOptionId: string) => {
|
||||
const content = attributeOptionId.slice(1, -1);
|
||||
|
||||
const routingFormFieldId = content.includes("field:") ? content.split("field:")[1] : null;
|
||||
@@ -602,6 +604,7 @@ export class LuckyUserService implements ILuckyUserService {
|
||||
selectionOptions = { fieldId: routingFormFieldId, selectedOptionIds: fieldResponse.value };
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { acrossQueryValueCompatiblity } from "@calcom/app-store/_utils/raqb/raqbUtils";
|
||||
import { acrossQueryValueCompatiblity } from "@calcom/app-store/_utils/raqb/raqbUtils.server";
|
||||
import type { FormResponse, Fields } from "@calcom/app-store/routing-forms/types/types";
|
||||
import { zodRoutes } from "@calcom/app-store/routing-forms/zod";
|
||||
import { withReporting } from "@calcom/lib/sentryWrapper";
|
||||
@@ -102,7 +102,7 @@ export default class AssignmentReasonRecorder {
|
||||
|
||||
const attributeValue = attributeToFilter.value;
|
||||
|
||||
if (!userAttribute || !attributeValue || typeof attributeValue[0] === null) continue;
|
||||
if (!userAttribute || !attributeValue || attributeValue[0] === null) continue;
|
||||
|
||||
if (attributeValue && attributeValue[0]) {
|
||||
const attributeValueString = (() => {
|
||||
|
||||
Reference in new issue
Block a user