@bisondesk/website-commons-sdk 1.0.33 → 1.0.35
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/lib/types/mailing-list.d.ts +65 -0
- package/lib/types/mailing-list.d.ts.map +1 -0
- package/lib/types/mailing-list.js +27 -0
- package/lib/types/mailing-list.js.map +1 -0
- package/lib/types/seo-stock-path.d.ts +23 -0
- package/lib/types/seo-stock-path.d.ts.map +1 -0
- package/lib/types/seo-stock-path.js +2 -0
- package/lib/types/seo-stock-path.js.map +1 -0
- package/lib/types/user-searches.d.ts +49 -6
- package/lib/types/user-searches.d.ts.map +1 -1
- package/lib/types/user-searches.js +1 -1
- package/lib/types/user-searches.js.map +1 -1
- package/lib/types/user.d.ts +159 -10
- package/lib/types/user.d.ts.map +1 -1
- package/lib/types/user.js +23 -0
- package/lib/types/user.js.map +1 -1
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js +46 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/vehicle.d.ts.map +1 -1
- package/package.json +8 -4
- package/src/types/mailing-list.ts +44 -0
- package/src/types/seo-stock-path.ts +30 -0
- package/src/types/user-searches.ts +1 -1
- package/src/types/user.ts +27 -17
- package/src/utils/index.ts +53 -0
- package/src/utils/utils.test.ts +29 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const Contact: z.ZodObject<{
|
|
3
|
+
email: z.ZodString;
|
|
4
|
+
fields: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
5
|
+
Country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
6
|
+
PreferredLanguage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
7
|
+
FirstName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
8
|
+
LastName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
Country?: string | null | undefined;
|
|
11
|
+
PreferredLanguage?: string | null | undefined;
|
|
12
|
+
FirstName?: string | null | undefined;
|
|
13
|
+
LastName?: string | null | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
Country?: string | null | undefined;
|
|
16
|
+
PreferredLanguage?: string | null | undefined;
|
|
17
|
+
FirstName?: string | null | undefined;
|
|
18
|
+
LastName?: string | null | undefined;
|
|
19
|
+
}>, {
|
|
20
|
+
[k: string]: string | null;
|
|
21
|
+
}, {
|
|
22
|
+
Country?: string | null | undefined;
|
|
23
|
+
PreferredLanguage?: string | null | undefined;
|
|
24
|
+
FirstName?: string | null | undefined;
|
|
25
|
+
LastName?: string | null | undefined;
|
|
26
|
+
}>>;
|
|
27
|
+
tags: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
email: string;
|
|
30
|
+
fields?: {
|
|
31
|
+
[k: string]: string | null;
|
|
32
|
+
} | undefined;
|
|
33
|
+
tags?: Record<string, boolean> | undefined;
|
|
34
|
+
}, {
|
|
35
|
+
email: string;
|
|
36
|
+
fields?: {
|
|
37
|
+
Country?: string | null | undefined;
|
|
38
|
+
PreferredLanguage?: string | null | undefined;
|
|
39
|
+
FirstName?: string | null | undefined;
|
|
40
|
+
LastName?: string | null | undefined;
|
|
41
|
+
} | undefined;
|
|
42
|
+
tags?: Record<string, boolean> | undefined;
|
|
43
|
+
}>;
|
|
44
|
+
export type Contact = z.input<typeof Contact>;
|
|
45
|
+
export declare const CheckUserIsSubscribedRequest: z.ZodObject<{
|
|
46
|
+
email: z.ZodString;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
email: string;
|
|
49
|
+
}, {
|
|
50
|
+
email: string;
|
|
51
|
+
}>;
|
|
52
|
+
export type CheckUserIsSubscribedRequest = z.infer<typeof CheckUserIsSubscribedRequest>;
|
|
53
|
+
export declare enum ContactStatus {
|
|
54
|
+
Pending = "pending",
|
|
55
|
+
Unsubscribed = "unsubscribed",
|
|
56
|
+
Subscribed = "subscribed"
|
|
57
|
+
}
|
|
58
|
+
export type CheckUSerIsSubscribedResponse = {
|
|
59
|
+
createdAt?: string;
|
|
60
|
+
status?: ContactStatus;
|
|
61
|
+
};
|
|
62
|
+
export type UpsertContactResponse = {
|
|
63
|
+
subscribed: boolean;
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=mailing-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mailing-list.d.ts","sourceRoot":"/","sources":["types/mailing-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBlB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;AAE9C,eAAO,MAAM,4BAA4B;;;;;;EAEvC,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAExF,oBAAY,aAAa;IACvB,OAAO,YAAY;IACnB,YAAY,iBAAiB;IAC7B,UAAU,eAAe;CAC1B;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const Contact = z.object({
|
|
3
|
+
email: z.string().email(),
|
|
4
|
+
fields: z
|
|
5
|
+
.object({
|
|
6
|
+
Country: z.string().nullable().optional(),
|
|
7
|
+
PreferredLanguage: z.string().nullable().optional(),
|
|
8
|
+
FirstName: z.string().nullable().optional(),
|
|
9
|
+
LastName: z.string().nullable().optional(),
|
|
10
|
+
})
|
|
11
|
+
.transform((data) => {
|
|
12
|
+
const normalizedData = Object.fromEntries(Object.entries(data).filter(([, value]) => value !== undefined));
|
|
13
|
+
return normalizedData;
|
|
14
|
+
})
|
|
15
|
+
.optional(),
|
|
16
|
+
tags: z.record(z.string(), z.boolean()).optional(),
|
|
17
|
+
});
|
|
18
|
+
export const CheckUserIsSubscribedRequest = z.object({
|
|
19
|
+
email: z.string().email(),
|
|
20
|
+
});
|
|
21
|
+
export var ContactStatus;
|
|
22
|
+
(function (ContactStatus) {
|
|
23
|
+
ContactStatus["Pending"] = "pending";
|
|
24
|
+
ContactStatus["Unsubscribed"] = "unsubscribed";
|
|
25
|
+
ContactStatus["Subscribed"] = "subscribed";
|
|
26
|
+
})(ContactStatus || (ContactStatus = {}));
|
|
27
|
+
//# sourceMappingURL=mailing-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mailing-list.js","sourceRoot":"/","sources":["types/mailing-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;IACzB,MAAM,EAAE,CAAC;SACN,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QACzC,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QACnD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QAC3C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;KAC3C,CAAC;SACD,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE;QAClB,MAAM,cAAc,GAAG,MAAM,CAAC,WAAW,CACvC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAChE,CAAC;QAEF,OAAO,cAAc,CAAC;IACxB,CAAC,CAAC;SACD,QAAQ,EAAE;IACb,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;CACnD,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE;CAC1B,CAAC,CAAC;AAIH,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,8CAA6B,CAAA;IAC7B,0CAAyB,CAAA;AAC3B,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB","sourcesContent":["import { z } from 'zod';\n\nexport const Contact = z.object({\n email: z.string().email(),\n fields: z\n .object({\n Country: z.string().nullable().optional(),\n PreferredLanguage: z.string().nullable().optional(),\n FirstName: z.string().nullable().optional(),\n LastName: z.string().nullable().optional(),\n })\n .transform((data) => {\n const normalizedData = Object.fromEntries(\n Object.entries(data).filter(([, value]) => value !== undefined)\n );\n\n return normalizedData;\n })\n .optional(),\n tags: z.record(z.string(), z.boolean()).optional(),\n});\n\nexport type Contact = z.input<typeof Contact>;\n\nexport const CheckUserIsSubscribedRequest = z.object({\n email: z.string().email(),\n});\n\nexport type CheckUserIsSubscribedRequest = z.infer<typeof CheckUserIsSubscribedRequest>;\n\nexport enum ContactStatus {\n Pending = 'pending',\n Unsubscribed = 'unsubscribed',\n Subscribed = 'subscribed',\n}\n\nexport type CheckUSerIsSubscribedResponse = {\n createdAt?: string;\n status?: ContactStatus;\n};\n\nexport type UpsertContactResponse = {\n subscribed: boolean;\n};\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
type BaseSEOStockPath = {
|
|
2
|
+
id: string;
|
|
3
|
+
};
|
|
4
|
+
export type CanonicalSEOStockPath = BaseSEOStockPath & {
|
|
5
|
+
filters: Record<string, unknown>;
|
|
6
|
+
canonical?: undefined;
|
|
7
|
+
seoPath: string;
|
|
8
|
+
};
|
|
9
|
+
export type LocalizedSEOStockPath = BaseSEOStockPath & {
|
|
10
|
+
language: string;
|
|
11
|
+
canonical: string;
|
|
12
|
+
};
|
|
13
|
+
export type SEOStockPath = CanonicalSEOStockPath | LocalizedSEOStockPath;
|
|
14
|
+
export type GroupedSEOStockPaths = {
|
|
15
|
+
canonical: CanonicalSEOStockPath;
|
|
16
|
+
localizations: LocalizedSEOStockPath[];
|
|
17
|
+
}[];
|
|
18
|
+
export type LocalizedSEOStockPathWithCanonical = {
|
|
19
|
+
localizedData?: LocalizedSEOStockPath;
|
|
20
|
+
canonicalData?: CanonicalSEOStockPath;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=seo-stock-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seo-stock-path.d.ts","sourceRoot":"/","sources":["types/seo-stock-path.ts"],"names":[],"mappings":"AAAA,KAAK,gBAAgB,GAAG;IAEtB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,gBAAgB,GAAG;IACrD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,SAAS,CAAC;IAGtB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,gBAAgB,GAAG;IAErD,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,qBAAqB,GAAG,qBAAqB,CAAC;AAEzE,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,qBAAqB,CAAC;IACjC,aAAa,EAAE,qBAAqB,EAAE,CAAC;CACxC,EAAE,CAAC;AAEJ,MAAM,MAAM,kCAAkC,GAAG;IAC/C,aAAa,CAAC,EAAE,qBAAqB,CAAC;IACtC,aAAa,CAAC,EAAE,qBAAqB,CAAC;CACvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seo-stock-path.js","sourceRoot":"/","sources":["types/seo-stock-path.ts"],"names":[],"mappings":"","sourcesContent":["type BaseSEOStockPath = {\n /* The path i.e /truck */\n id: string;\n};\n\nexport type CanonicalSEOStockPath = BaseSEOStockPath & {\n filters: Record<string, unknown>;\n canonical?: undefined;\n\n /* The SEO path for markdown content i.e /truck/daf */\n seoPath: string;\n};\n\nexport type LocalizedSEOStockPath = BaseSEOStockPath & {\n /* The canonical id for the localised stock path, null if canonical */\n language: string;\n canonical: string;\n};\n\nexport type SEOStockPath = CanonicalSEOStockPath | LocalizedSEOStockPath;\n\nexport type GroupedSEOStockPaths = {\n canonical: CanonicalSEOStockPath;\n localizations: LocalizedSEOStockPath[];\n}[];\n\nexport type LocalizedSEOStockPathWithCanonical = {\n localizedData?: LocalizedSEOStockPath;\n canonicalData?: CanonicalSEOStockPath;\n};\n"]}
|
|
@@ -1,27 +1,70 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const UserSearch: z.ZodObject<{
|
|
2
|
+
export declare const UserSearch: z.ZodObject<z.objectUtil.extendShape<{
|
|
3
3
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
4
|
-
filters: z.ZodRecord<z.ZodString, z.ZodUnknown
|
|
4
|
+
filters: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnknown>, Record<string, unknown>, Record<string, unknown>>;
|
|
5
5
|
queryString: z.ZodString;
|
|
6
6
|
resultCount: z.ZodNumber;
|
|
7
7
|
countryCode: z.ZodOptional<z.ZodString>;
|
|
8
8
|
language: z.ZodOptional<z.ZodString>;
|
|
9
9
|
browserLocale: z.ZodOptional<z.ZodString>;
|
|
10
10
|
origin: z.ZodOptional<z.ZodString>;
|
|
11
|
-
|
|
11
|
+
}, {
|
|
12
|
+
id: z.ZodString;
|
|
12
13
|
createdBy: z.ZodString;
|
|
13
14
|
createdAt: z.ZodString;
|
|
14
|
-
}, z.
|
|
15
|
+
}>, "strict", z.ZodTypeAny, {
|
|
16
|
+
filters: Record<string, unknown>;
|
|
17
|
+
queryString: string;
|
|
18
|
+
resultCount: number;
|
|
19
|
+
id: string;
|
|
20
|
+
createdBy: string;
|
|
21
|
+
createdAt: string;
|
|
22
|
+
sessionId?: string | undefined;
|
|
23
|
+
countryCode?: string | undefined;
|
|
24
|
+
language?: string | undefined;
|
|
25
|
+
browserLocale?: string | undefined;
|
|
26
|
+
origin?: string | undefined;
|
|
27
|
+
}, {
|
|
28
|
+
filters: Record<string, unknown>;
|
|
29
|
+
queryString: string;
|
|
30
|
+
resultCount: number;
|
|
31
|
+
id: string;
|
|
32
|
+
createdBy: string;
|
|
33
|
+
createdAt: string;
|
|
34
|
+
sessionId?: string | undefined;
|
|
35
|
+
countryCode?: string | undefined;
|
|
36
|
+
language?: string | undefined;
|
|
37
|
+
browserLocale?: string | undefined;
|
|
38
|
+
origin?: string | undefined;
|
|
39
|
+
}>;
|
|
15
40
|
export type UserSearch = z.infer<typeof UserSearch>;
|
|
16
41
|
export declare const NewUserSearch: z.ZodObject<{
|
|
17
42
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
18
|
-
filters: z.ZodRecord<z.ZodString, z.ZodUnknown
|
|
43
|
+
filters: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnknown>, Record<string, unknown>, Record<string, unknown>>;
|
|
19
44
|
queryString: z.ZodString;
|
|
20
45
|
resultCount: z.ZodNumber;
|
|
21
46
|
countryCode: z.ZodOptional<z.ZodString>;
|
|
22
47
|
language: z.ZodOptional<z.ZodString>;
|
|
23
48
|
browserLocale: z.ZodOptional<z.ZodString>;
|
|
24
49
|
origin: z.ZodOptional<z.ZodString>;
|
|
25
|
-
}, z.
|
|
50
|
+
}, "strict", z.ZodTypeAny, {
|
|
51
|
+
filters: Record<string, unknown>;
|
|
52
|
+
queryString: string;
|
|
53
|
+
resultCount: number;
|
|
54
|
+
sessionId?: string | undefined;
|
|
55
|
+
countryCode?: string | undefined;
|
|
56
|
+
language?: string | undefined;
|
|
57
|
+
browserLocale?: string | undefined;
|
|
58
|
+
origin?: string | undefined;
|
|
59
|
+
}, {
|
|
60
|
+
filters: Record<string, unknown>;
|
|
61
|
+
queryString: string;
|
|
62
|
+
resultCount: number;
|
|
63
|
+
sessionId?: string | undefined;
|
|
64
|
+
countryCode?: string | undefined;
|
|
65
|
+
language?: string | undefined;
|
|
66
|
+
browserLocale?: string | undefined;
|
|
67
|
+
origin?: string | undefined;
|
|
68
|
+
}>;
|
|
26
69
|
export type NewUserSearch = z.infer<typeof NewUserSearch>;
|
|
27
70
|
//# sourceMappingURL=user-searches.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-searches.d.ts","sourceRoot":"/","sources":["types/user-searches.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"user-searches.d.ts","sourceRoot":"/","sources":["types/user-searches.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIrB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAiB,CAAC;AAE5C,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-searches.js","sourceRoot":"/","sources":["types/user-searches.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,cAAc,GAAG,CAAC;KACrB,MAAM,CAAC;IACN,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,OAAO,EAAE,CAAC;SACP,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;SAC/B,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAC;IACvF,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAC;KACD,MAAM,EAAE,CAAC;AAIZ,MAAM,CAAC,MAAM,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC;IAC9C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;
|
|
1
|
+
{"version":3,"file":"user-searches.js","sourceRoot":"/","sources":["types/user-searches.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,cAAc,GAAG,CAAC;KACrB,MAAM,CAAC;IACN,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,OAAO,EAAE,CAAC;SACP,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;SAC/B,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAC;IACvF,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAC;KACD,MAAM,EAAE,CAAC;AAIZ,MAAM,CAAC,MAAM,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC;IAC9C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,aAAa,GAAG,cAAc,CAAC","sourcesContent":["import { z } from 'zod';\n\nconst BaseUserSearch = z\n .object({\n sessionId: z.string().optional(),\n filters: z\n .record(z.string(), z.unknown())\n .refine((obj) => Object.keys(obj).length > 0, { message: 'filters cannot be empty' }),\n queryString: z.string(),\n resultCount: z.number(),\n countryCode: z.string().optional(),\n language: z.string().optional(),\n browserLocale: z.string().optional(),\n origin: z.string().optional(),\n })\n .strict();\n\ntype BaseUserSearch = z.infer<typeof BaseUserSearch>;\n\nexport const UserSearch = BaseUserSearch.extend({\n id: z.string().uuid(),\n createdBy: z.string(),\n createdAt: z.string(),\n});\n\nexport type UserSearch = z.infer<typeof UserSearch>;\n\nexport const NewUserSearch = BaseUserSearch;\n\nexport type NewUserSearch = z.infer<typeof NewUserSearch>;\n"]}
|
package/lib/types/user.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
import { MarketingChannel } from './index.js';
|
|
2
3
|
export type AuthRequest = {
|
|
3
4
|
userId: string;
|
|
@@ -7,21 +8,169 @@ export declare enum FleetSize {
|
|
|
7
8
|
Medium = "2-5",
|
|
8
9
|
Large = "6+"
|
|
9
10
|
}
|
|
10
|
-
export
|
|
11
|
-
firstName
|
|
12
|
-
lastName
|
|
13
|
-
phone
|
|
14
|
-
preferredLanguage
|
|
15
|
-
fleetSize
|
|
16
|
-
trader
|
|
17
|
-
email
|
|
11
|
+
export declare const UserDetails: z.ZodObject<{
|
|
12
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
13
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
14
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
15
|
+
preferredLanguage: z.ZodOptional<z.ZodString>;
|
|
16
|
+
fleetSize: z.ZodOptional<z.ZodNativeEnum<typeof FleetSize>>;
|
|
17
|
+
trader: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
email: z.ZodOptional<z.ZodString>;
|
|
19
|
+
company: z.ZodObject<{
|
|
20
|
+
country: z.ZodOptional<z.ZodString>;
|
|
21
|
+
city: z.ZodOptional<z.ZodString>;
|
|
22
|
+
name: z.ZodOptional<z.ZodString>;
|
|
23
|
+
vat: z.ZodOptional<z.ZodString>;
|
|
24
|
+
postalCode: z.ZodOptional<z.ZodString>;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
country?: string | undefined;
|
|
27
|
+
city?: string | undefined;
|
|
28
|
+
name?: string | undefined;
|
|
29
|
+
vat?: string | undefined;
|
|
30
|
+
postalCode?: string | undefined;
|
|
31
|
+
}, {
|
|
32
|
+
country?: string | undefined;
|
|
33
|
+
city?: string | undefined;
|
|
34
|
+
name?: string | undefined;
|
|
35
|
+
vat?: string | undefined;
|
|
36
|
+
postalCode?: string | undefined;
|
|
37
|
+
}>;
|
|
38
|
+
marketingChannels: z.ZodArray<z.ZodNativeEnum<typeof MarketingChannel>, "many">;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
40
|
company: {
|
|
19
|
-
country?: string;
|
|
41
|
+
country?: string | undefined;
|
|
20
42
|
city?: string | undefined;
|
|
21
43
|
name?: string | undefined;
|
|
22
44
|
vat?: string | undefined;
|
|
23
45
|
postalCode?: string | undefined;
|
|
24
46
|
};
|
|
25
47
|
marketingChannels: MarketingChannel[];
|
|
26
|
-
|
|
48
|
+
email?: string | undefined;
|
|
49
|
+
phone?: string | undefined;
|
|
50
|
+
firstName?: string | undefined;
|
|
51
|
+
lastName?: string | undefined;
|
|
52
|
+
preferredLanguage?: string | undefined;
|
|
53
|
+
fleetSize?: FleetSize | undefined;
|
|
54
|
+
trader?: boolean | undefined;
|
|
55
|
+
}, {
|
|
56
|
+
company: {
|
|
57
|
+
country?: string | undefined;
|
|
58
|
+
city?: string | undefined;
|
|
59
|
+
name?: string | undefined;
|
|
60
|
+
vat?: string | undefined;
|
|
61
|
+
postalCode?: string | undefined;
|
|
62
|
+
};
|
|
63
|
+
marketingChannels: MarketingChannel[];
|
|
64
|
+
email?: string | undefined;
|
|
65
|
+
phone?: string | undefined;
|
|
66
|
+
firstName?: string | undefined;
|
|
67
|
+
lastName?: string | undefined;
|
|
68
|
+
preferredLanguage?: string | undefined;
|
|
69
|
+
fleetSize?: FleetSize | undefined;
|
|
70
|
+
trader?: boolean | undefined;
|
|
71
|
+
}>;
|
|
72
|
+
export type UserDetails = z.infer<typeof UserDetails>;
|
|
73
|
+
export declare const UserDetailsRequest: z.ZodObject<{
|
|
74
|
+
subsribeToNewsletter: z.ZodOptional<z.ZodBoolean>;
|
|
75
|
+
data: z.ZodObject<{
|
|
76
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
77
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
78
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
79
|
+
preferredLanguage: z.ZodOptional<z.ZodString>;
|
|
80
|
+
fleetSize: z.ZodOptional<z.ZodNativeEnum<typeof FleetSize>>;
|
|
81
|
+
trader: z.ZodOptional<z.ZodBoolean>;
|
|
82
|
+
email: z.ZodOptional<z.ZodString>;
|
|
83
|
+
company: z.ZodObject<{
|
|
84
|
+
country: z.ZodOptional<z.ZodString>;
|
|
85
|
+
city: z.ZodOptional<z.ZodString>;
|
|
86
|
+
name: z.ZodOptional<z.ZodString>;
|
|
87
|
+
vat: z.ZodOptional<z.ZodString>;
|
|
88
|
+
postalCode: z.ZodOptional<z.ZodString>;
|
|
89
|
+
}, "strip", z.ZodTypeAny, {
|
|
90
|
+
country?: string | undefined;
|
|
91
|
+
city?: string | undefined;
|
|
92
|
+
name?: string | undefined;
|
|
93
|
+
vat?: string | undefined;
|
|
94
|
+
postalCode?: string | undefined;
|
|
95
|
+
}, {
|
|
96
|
+
country?: string | undefined;
|
|
97
|
+
city?: string | undefined;
|
|
98
|
+
name?: string | undefined;
|
|
99
|
+
vat?: string | undefined;
|
|
100
|
+
postalCode?: string | undefined;
|
|
101
|
+
}>;
|
|
102
|
+
marketingChannels: z.ZodArray<z.ZodNativeEnum<typeof MarketingChannel>, "many">;
|
|
103
|
+
}, "strip", z.ZodTypeAny, {
|
|
104
|
+
company: {
|
|
105
|
+
country?: string | undefined;
|
|
106
|
+
city?: string | undefined;
|
|
107
|
+
name?: string | undefined;
|
|
108
|
+
vat?: string | undefined;
|
|
109
|
+
postalCode?: string | undefined;
|
|
110
|
+
};
|
|
111
|
+
marketingChannels: MarketingChannel[];
|
|
112
|
+
email?: string | undefined;
|
|
113
|
+
phone?: string | undefined;
|
|
114
|
+
firstName?: string | undefined;
|
|
115
|
+
lastName?: string | undefined;
|
|
116
|
+
preferredLanguage?: string | undefined;
|
|
117
|
+
fleetSize?: FleetSize | undefined;
|
|
118
|
+
trader?: boolean | undefined;
|
|
119
|
+
}, {
|
|
120
|
+
company: {
|
|
121
|
+
country?: string | undefined;
|
|
122
|
+
city?: string | undefined;
|
|
123
|
+
name?: string | undefined;
|
|
124
|
+
vat?: string | undefined;
|
|
125
|
+
postalCode?: string | undefined;
|
|
126
|
+
};
|
|
127
|
+
marketingChannels: MarketingChannel[];
|
|
128
|
+
email?: string | undefined;
|
|
129
|
+
phone?: string | undefined;
|
|
130
|
+
firstName?: string | undefined;
|
|
131
|
+
lastName?: string | undefined;
|
|
132
|
+
preferredLanguage?: string | undefined;
|
|
133
|
+
fleetSize?: FleetSize | undefined;
|
|
134
|
+
trader?: boolean | undefined;
|
|
135
|
+
}>;
|
|
136
|
+
}, "strip", z.ZodTypeAny, {
|
|
137
|
+
data: {
|
|
138
|
+
company: {
|
|
139
|
+
country?: string | undefined;
|
|
140
|
+
city?: string | undefined;
|
|
141
|
+
name?: string | undefined;
|
|
142
|
+
vat?: string | undefined;
|
|
143
|
+
postalCode?: string | undefined;
|
|
144
|
+
};
|
|
145
|
+
marketingChannels: MarketingChannel[];
|
|
146
|
+
email?: string | undefined;
|
|
147
|
+
phone?: string | undefined;
|
|
148
|
+
firstName?: string | undefined;
|
|
149
|
+
lastName?: string | undefined;
|
|
150
|
+
preferredLanguage?: string | undefined;
|
|
151
|
+
fleetSize?: FleetSize | undefined;
|
|
152
|
+
trader?: boolean | undefined;
|
|
153
|
+
};
|
|
154
|
+
subsribeToNewsletter?: boolean | undefined;
|
|
155
|
+
}, {
|
|
156
|
+
data: {
|
|
157
|
+
company: {
|
|
158
|
+
country?: string | undefined;
|
|
159
|
+
city?: string | undefined;
|
|
160
|
+
name?: string | undefined;
|
|
161
|
+
vat?: string | undefined;
|
|
162
|
+
postalCode?: string | undefined;
|
|
163
|
+
};
|
|
164
|
+
marketingChannels: MarketingChannel[];
|
|
165
|
+
email?: string | undefined;
|
|
166
|
+
phone?: string | undefined;
|
|
167
|
+
firstName?: string | undefined;
|
|
168
|
+
lastName?: string | undefined;
|
|
169
|
+
preferredLanguage?: string | undefined;
|
|
170
|
+
fleetSize?: FleetSize | undefined;
|
|
171
|
+
trader?: boolean | undefined;
|
|
172
|
+
};
|
|
173
|
+
subsribeToNewsletter?: boolean | undefined;
|
|
174
|
+
}>;
|
|
175
|
+
export type UserDetailsRequest = z.infer<typeof UserDetailsRequest>;
|
|
27
176
|
//# sourceMappingURL=user.d.ts.map
|
package/lib/types/user.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"/","sources":["types/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,oBAAY,SAAS;IACnB,KAAK,MAAM;IACX,MAAM,QAAQ;IACd,KAAK,OAAO;CACb;AAED,
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"/","sources":["types/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,oBAAY,SAAS;IACnB,KAAK,MAAM;IACX,MAAM,QAAQ;IACd,KAAK,OAAO;CACb;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBtB,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG7B,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
package/lib/types/user.js
CHANGED
|
@@ -1,7 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MarketingChannel } from './index.js';
|
|
1
3
|
export var FleetSize;
|
|
2
4
|
(function (FleetSize) {
|
|
3
5
|
FleetSize["Small"] = "1";
|
|
4
6
|
FleetSize["Medium"] = "2-5";
|
|
5
7
|
FleetSize["Large"] = "6+";
|
|
6
8
|
})(FleetSize || (FleetSize = {}));
|
|
9
|
+
export const UserDetails = z.object({
|
|
10
|
+
firstName: z.string().optional(),
|
|
11
|
+
lastName: z.string().optional(),
|
|
12
|
+
phone: z.string().optional(),
|
|
13
|
+
preferredLanguage: z.string().optional(),
|
|
14
|
+
fleetSize: z.nativeEnum(FleetSize).optional(),
|
|
15
|
+
trader: z.boolean().optional(),
|
|
16
|
+
email: z.string().email().optional(),
|
|
17
|
+
company: z.object({
|
|
18
|
+
country: z.string().optional(),
|
|
19
|
+
city: z.string().optional(),
|
|
20
|
+
name: z.string().optional(),
|
|
21
|
+
vat: z.string().optional(),
|
|
22
|
+
postalCode: z.string().optional(),
|
|
23
|
+
}),
|
|
24
|
+
marketingChannels: z.array(z.nativeEnum(MarketingChannel)),
|
|
25
|
+
});
|
|
26
|
+
export const UserDetailsRequest = z.object({
|
|
27
|
+
subsribeToNewsletter: z.boolean().optional(),
|
|
28
|
+
data: UserDetails,
|
|
29
|
+
});
|
|
7
30
|
//# sourceMappingURL=user.js.map
|
package/lib/types/user.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.js","sourceRoot":"/","sources":["types/user.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"user.js","sourceRoot":"/","sources":["types/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAM9C,MAAM,CAAN,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,2BAAc,CAAA;IACd,yBAAY,CAAA;AACd,CAAC,EAJW,SAAS,KAAT,SAAS,QAIpB;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACxC,SAAS,EAAE,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE;IAC7C,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC9B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;IACpC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;QAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC9B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC3B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC3B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC1B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAClC,CAAC;IACF,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;CAC3D,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,oBAAoB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC5C,IAAI,EAAE,WAAW;CAClB,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { MarketingChannel } from './index.js';\n\nexport type AuthRequest = {\n userId: string;\n};\n\nexport enum FleetSize {\n Small = '1',\n Medium = '2-5',\n Large = '6+',\n}\n\nexport const UserDetails = z.object({\n firstName: z.string().optional(),\n lastName: z.string().optional(),\n phone: z.string().optional(),\n preferredLanguage: z.string().optional(),\n fleetSize: z.nativeEnum(FleetSize).optional(),\n trader: z.boolean().optional(),\n email: z.string().email().optional(),\n company: z.object({\n country: z.string().optional(),\n city: z.string().optional(),\n name: z.string().optional(),\n vat: z.string().optional(),\n postalCode: z.string().optional(),\n }),\n marketingChannels: z.array(z.nativeEnum(MarketingChannel)),\n});\n\nexport type UserDetails = z.infer<typeof UserDetails>;\n\nexport const UserDetailsRequest = z.object({\n subsribeToNewsletter: z.boolean().optional(),\n data: UserDetails,\n});\n\nexport type UserDetailsRequest = z.infer<typeof UserDetailsRequest>;\n"]}
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import slug from 'slug';
|
|
1
2
|
export declare enum Alphabet {
|
|
2
3
|
Full = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_",
|
|
3
4
|
Alphanumeric = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
|
@@ -6,4 +7,6 @@ export declare enum Alphabet {
|
|
|
6
7
|
ReferenceCode = "123456789ABCDEFGHJKMNPQRSTUVWXYZ"
|
|
7
8
|
}
|
|
8
9
|
export declare const generateId: (idLength?: number, alphabet?: Alphabet) => string;
|
|
10
|
+
export declare const slugify: (str: string, opts?: slug.Options) => string;
|
|
11
|
+
export declare const normalizeSlug: (slug: (string | undefined)[], locale?: string) => string[];
|
|
9
12
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/utils/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,oBAAY,QAAQ;IAClB,IAAI,oEAAoE;IACxE,YAAY,mEAAmE;IAC/E,SAAS,+BAA+B;IACxC,iBAAiB,yCAAyC;IAC1D,aAAa,qCAAqC;CACnD;AAED,eAAO,MAAM,UAAU,GAAI,WAAU,MAAW,EAAE,WAAU,QAAwB,KAAG,MAQtF,CAAC;AA2DF,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,EAAE,OAAO,IAAI,CAAC,OAAO,WAMpD,CAAC;AAEL,eAAO,MAAM,aAAa,GAAI,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,EAAE,SAAS,MAAM,aACkB,CAAC"}
|
package/lib/utils/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { customAlphabet } from 'nanoid';
|
|
2
|
+
import slug from 'slug';
|
|
2
3
|
export var Alphabet;
|
|
3
4
|
(function (Alphabet) {
|
|
4
5
|
Alphabet["Full"] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_";
|
|
@@ -28,4 +29,49 @@ const isValid = (id) => {
|
|
|
28
29
|
}
|
|
29
30
|
return true;
|
|
30
31
|
};
|
|
32
|
+
const arabic = {
|
|
33
|
+
ء: 'ء',
|
|
34
|
+
ا: 'ا',
|
|
35
|
+
أ: 'أ',
|
|
36
|
+
إ: 'إ',
|
|
37
|
+
آ: 'آ',
|
|
38
|
+
ؤ: 'ؤ',
|
|
39
|
+
ئ: 'ئ',
|
|
40
|
+
ب: 'ب',
|
|
41
|
+
ت: 'ت',
|
|
42
|
+
ث: 'ث',
|
|
43
|
+
ج: 'ج',
|
|
44
|
+
ح: 'ح',
|
|
45
|
+
خ: 'خ',
|
|
46
|
+
د: 'د',
|
|
47
|
+
ذ: 'ذ',
|
|
48
|
+
ر: 'ر',
|
|
49
|
+
ز: 'ز',
|
|
50
|
+
س: 'س',
|
|
51
|
+
ش: 'ش',
|
|
52
|
+
ص: 'ص',
|
|
53
|
+
ض: 'ض',
|
|
54
|
+
ط: 'ط',
|
|
55
|
+
ظ: 'ظ',
|
|
56
|
+
ع: 'ع',
|
|
57
|
+
غ: 'غ',
|
|
58
|
+
ف: 'ف',
|
|
59
|
+
ق: 'ق',
|
|
60
|
+
ك: 'ك',
|
|
61
|
+
ل: 'ل',
|
|
62
|
+
م: 'م',
|
|
63
|
+
ن: 'ن',
|
|
64
|
+
ه: 'ه',
|
|
65
|
+
و: 'و',
|
|
66
|
+
ي: 'ي',
|
|
67
|
+
ة: 'ة',
|
|
68
|
+
ى: 'ى',
|
|
69
|
+
};
|
|
70
|
+
slug.extend(arabic);
|
|
71
|
+
export const slugify = (str, opts) => slug(str, {
|
|
72
|
+
lower: true,
|
|
73
|
+
remove: /[$*_+~.()'"!\-:@]+/g,
|
|
74
|
+
...opts,
|
|
75
|
+
});
|
|
76
|
+
export const normalizeSlug = (slug, locale) => slug.filter((v) => !!v).map((s) => slugify(s, { locale }));
|
|
31
77
|
//# sourceMappingURL=index.js.map
|
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["utils/index.ts"],"names":[],"mappings":"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","sourcesContent":["import { customAlphabet } from 'nanoid';\nimport slug from 'slug';\n\nexport enum Alphabet {\n Full = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_',\n Alphanumeric = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',\n Lowercase = 'abcdefghijklmnopqrstuvwxyz',\n LowerAlphanumeric = '0123456789abcdefghijklmnopqrstuvwxyz',\n ReferenceCode = '123456789ABCDEFGHJKMNPQRSTUVWXYZ',\n}\n\nexport const generateId = (idLength: number = 15, alphabet: Alphabet = Alphabet.Full): string => {\n const nanoid = customAlphabet(alphabet, idLength);\n while (true) {\n const id = nanoid();\n if (isValid(id)) {\n return id;\n }\n }\n};\n\nconst isValid = (id: string): boolean => {\n if (!Number.isNaN(Number.parseInt(id[0]))) {\n return false;\n }\n\n if (id.endsWith('_') || id.startsWith('_')) {\n return false;\n }\n\n if (id.includes('__')) {\n return false;\n }\n\n return true;\n};\n\nconst arabic = {\n ء: 'ء',\n ا: 'ا',\n أ: 'أ',\n إ: 'إ',\n آ: 'آ',\n ؤ: 'ؤ',\n ئ: 'ئ',\n ب: 'ب',\n ت: 'ت',\n ث: 'ث',\n ج: 'ج',\n ح: 'ح',\n خ: 'خ',\n د: 'د',\n ذ: 'ذ',\n ر: 'ر',\n ز: 'ز',\n س: 'س',\n ش: 'ش',\n ص: 'ص',\n ض: 'ض',\n ط: 'ط',\n ظ: 'ظ',\n ع: 'ع',\n غ: 'غ',\n ف: 'ف',\n ق: 'ق',\n ك: 'ك',\n ل: 'ل',\n م: 'م',\n ن: 'ن',\n ه: 'ه',\n و: 'و',\n ي: 'ي',\n ة: 'ة',\n ى: 'ى',\n};\n\nslug.extend(arabic);\n\nexport const slugify = (str: string, opts?: slug.Options) =>\n slug(str, {\n lower: true,\n // Preserve Arabic characters\n remove: /[$*_+~.()'\"!\\-:@]+/g,\n ...opts,\n });\n\nexport const normalizeSlug = (slug: (string | undefined)[], locale?: string) =>\n slug.filter((v: string | undefined): v is string => !!v).map((s) => slugify(s, { locale }));\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vehicle.d.ts","sourceRoot":"/","sources":["utils/vehicle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"vehicle.d.ts","sourceRoot":"/","sources":["utils/vehicle.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,eAAO,MAAM,qBAAqB,GAAI,WAAW,MAAM,WAA0B,CAAC;AAElF,eAAO,MAAM,iBAAiB,GAAI,SAAS,cAAc,YAGV,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bisondesk/website-commons-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.35",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npx tsc --build",
|
|
@@ -18,12 +18,16 @@
|
|
|
18
18
|
"node-fetch": "3.3.2",
|
|
19
19
|
"pino": "9.8.0",
|
|
20
20
|
"pino-pretty": "13.1.1",
|
|
21
|
-
"
|
|
22
|
-
"zod": "
|
|
21
|
+
"slug": "11.0.1",
|
|
22
|
+
"zod": "3.23.8"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/lodash-es": "4.17.12",
|
|
26
|
-
"
|
|
26
|
+
"@types/slug": "5.0.9",
|
|
27
|
+
"typescript": "5.8.3"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"zod": ">=3.23.8 <4.0.0"
|
|
27
31
|
},
|
|
28
32
|
"typesVersions": {
|
|
29
33
|
"*": {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const Contact = z.object({
|
|
4
|
+
email: z.string().email(),
|
|
5
|
+
fields: z
|
|
6
|
+
.object({
|
|
7
|
+
Country: z.string().nullable().optional(),
|
|
8
|
+
PreferredLanguage: z.string().nullable().optional(),
|
|
9
|
+
FirstName: z.string().nullable().optional(),
|
|
10
|
+
LastName: z.string().nullable().optional(),
|
|
11
|
+
})
|
|
12
|
+
.transform((data) => {
|
|
13
|
+
const normalizedData = Object.fromEntries(
|
|
14
|
+
Object.entries(data).filter(([, value]) => value !== undefined)
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
return normalizedData;
|
|
18
|
+
})
|
|
19
|
+
.optional(),
|
|
20
|
+
tags: z.record(z.string(), z.boolean()).optional(),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export type Contact = z.input<typeof Contact>;
|
|
24
|
+
|
|
25
|
+
export const CheckUserIsSubscribedRequest = z.object({
|
|
26
|
+
email: z.string().email(),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export type CheckUserIsSubscribedRequest = z.infer<typeof CheckUserIsSubscribedRequest>;
|
|
30
|
+
|
|
31
|
+
export enum ContactStatus {
|
|
32
|
+
Pending = 'pending',
|
|
33
|
+
Unsubscribed = 'unsubscribed',
|
|
34
|
+
Subscribed = 'subscribed',
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type CheckUSerIsSubscribedResponse = {
|
|
38
|
+
createdAt?: string;
|
|
39
|
+
status?: ContactStatus;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type UpsertContactResponse = {
|
|
43
|
+
subscribed: boolean;
|
|
44
|
+
};
|