@wf-financing/ui-assets 0.1.0

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.
@@ -0,0 +1 @@
1
+ export { PARTNER_ASSETS_BASE_URL } from './urls';
@@ -0,0 +1 @@
1
+ export declare const PARTNER_ASSETS_BASE_URL: any;
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("zod"),i=e.z.object({version:e.z.string().min(1),language:e.z.string().min(2),cohort:e.z.string().min(1)}),g=i.extend({partnerName:e.z.string().trim(),termsOfServiceTitle:e.z.string().trim().max(120),termsAndServiceUrl:e.z.string().url()}),f=i.extend({mainText:e.z.string().min(1).max(150),bulletPoints:e.z.array(e.z.string().min(1)).max(3),buttonText:e.z.string().min(1).max(25)}),l=t=>n=>t.every(c=>n.includes(`{${c}}`)),v=t=>e.z.record(e.z.string(),t),r=t=>e.z.record(e.z.string(),v(t)),A=(t,n)=>{const c=(n==null?void 0:n.language)??"en",d=(n==null?void 0:n.cohort)??"default",u=Object.keys(t);let o={};return u.forEach(a=>{const m=t[a];if(m){let s;const T=m[c]??m.en,b=T[d]??T.default;if(b?s=b:s=m.en.default,!s)throw new Error("Cohorted document doesn't exist");o={...o,[a]:s}}}),o},O="http://partner-assets.wayflyer.com",P=async t=>{const n=t.partnerId,c=t==null?void 0:t.version,d=t==null?void 0:t.options,u=`${O}/${n}/copy/${c}/copy.json`;try{const a=await(await fetch(u)).json();return A(a,d)}catch(o){return console.error(o),null}},z=i.extend({mainText:e.z.string().trim().min(1).max(160).refine(l(["amount","currency"]),{message:"mainText must include {amount} and {currency}"}),bulletPoints:e.z.array(e.z.string().min(1)).max(3),buttonText:e.z.string().min(1).max(25)}),x=i.extend({imageUrl:e.z.string().trim().url(),title:e.z.string().trim().min(1),descriptions:e.z.array(e.z.object({title:e.z.string().trim().min(1),description:e.z.string().trim().min(1)})).length(3),buttons:e.z.object({accept:e.z.string().trim().min(1),close:e.z.string().trim().min(1)}),termsAndConditions:e.z.string().trim().min(1).refine(l(["termsUrl"]),{message:"termsUrl is required"})}),h=i.extend({mainText:e.z.string().min(1).max(150),buttonText:e.z.string().min(1).max(25)}),S=i.extend({mainText:e.z.string().trim().min(1).max(160).refine(l(["amount","currency"]),{message:"mainText must include {amount} and {currency}"}),bulletPoints:e.z.array(e.z.string().min(1)).max(3),buttonText:e.z.string().min(1).max(25)}),p=i.extend({mainText:e.z.string().min(1).max(150),buttonText:e.z.string().min(1).max(25)}),y=i.extend({mainText:e.z.string().min(1).max(150),buttonText:e.z.string().min(1).max(25)}),C=i.extend({mainText:e.z.string().min(1).max(150),buttonText:e.z.string().min(1).max(25)}),j=e.z.object({genericOffer:r(f),indicativeOffer:r(z),consentModal:r(x),completeApplication:r(h),completeKyc:r(p),signContract:r(y),selectOffer:r(S),provideAdditionalInfo:r(C),partnerTemplate:r(g).optional()}),M=e.z.object({genericOffer:f,indicativeOffer:z,consentModal:x,completeApplication:h,completeKyc:p,signContract:y,selectOffer:S,provideAdditionalInfo:C,partnerTemplate:g.optional()});exports.CohortMap=v;exports.CompleteApplicationSchema=h;exports.CompleteKycSchema=p;exports.ConsentModalSchema=x;exports.CopyBundleSchema=j;exports.CopySchema=M;exports.GenericOfferSchema=f;exports.IndicativeOfferSchema=z;exports.LanguageMap=r;exports.PartnerTemplateSchema=g;exports.ProvideAdditionalInfoSchema=C;exports.SelectOfferSchema=S;exports.SignContractSchema=y;exports.WayflyerDocumentSchema=i;exports.filterCopy=A;exports.loadAndConfigureCopy=P;exports.mustContainPlaceholders=l;
2
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/schemas/wayflyerDocument.ts","../src/schemas/partnerTemplate.ts","../src/schemas/genericOffer.ts","../src/utils/validators.ts","../src/utils/normalizers.ts","../src/utils/filterCopy.ts","../src/config/urls.ts","../src/utils/loadCopy.ts","../src/schemas/indicativeOffer.ts","../src/schemas/consentModal.ts","../src/schemas/completeApplication.ts","../src/schemas/selectOffer.ts","../src/schemas/completeKyc.ts","../src/schemas/signContract.ts","../src/schemas/provideAdditionalInfo.ts","../src/schemas/copyBundle.ts"],"sourcesContent":["import { z } from 'zod';\n\nexport const WayflyerDocumentSchema = z.object({\n version: z.string().min(1),\n language: z.string().min(2),\n cohort: z.string().min(1),\n});\nexport type WayflyerDocument = z.infer<typeof WayflyerDocumentSchema>;\n","import { z } from 'zod';\n\nimport { WayflyerDocumentSchema } from './wayflyerDocument';\n\nexport const PartnerTemplateSchema = WayflyerDocumentSchema.extend({\n partnerName: z.string().trim(),\n termsOfServiceTitle: z.string().trim().max(120),\n termsAndServiceUrl: z.string().url(),\n});\nexport type PartnerTemplate = z.infer<typeof PartnerTemplateSchema>;\n","import { z } from 'zod';\n\nimport { WayflyerDocumentSchema } from './wayflyerDocument';\n\nexport const GenericOfferSchema = WayflyerDocumentSchema.extend({\n mainText: z.string().min(1).max(150),\n bulletPoints: z.array(z.string().min(1)).max(3),\n buttonText: z.string().min(1).max(25),\n});\nexport type GenericOffer = z.infer<typeof GenericOfferSchema>;\n","export const mustContainPlaceholders = (placeholders: string[]) => {\n return (value: string) => placeholders.every((placeholder) => value.includes(`{${placeholder}}`));\n};\n","import { z } from 'zod';\n\nexport const CohortMap = <T extends z.ZodTypeAny>(schema: T) => z.record(z.string(), schema);\nexport const LanguageMap = <T extends z.ZodTypeAny>(schema: T) => z.record(z.string(), CohortMap(schema));\n","import type { CopyBundle, Copy } from '../schemas';\nimport type { Options } from '../types';\n\ntype FilterCopy = (copy: CopyBundle, options?: Options) => Copy;\n\nexport const filterCopy: FilterCopy = (copy, options) => {\n const language = options?.language ?? 'en';\n const cohort = options?.cohort ?? 'default';\n const documentKeys = Object.keys(copy) as Array<keyof typeof copy>;\n let normalizedCopy = {};\n\n documentKeys.forEach((key) => {\n const document = copy[key];\n\n if (document) {\n let filteredDocument;\n const localizedDocument = document[language] ?? document.en;\n const cohortedDocument = localizedDocument[cohort] ?? localizedDocument.default;\n\n if (!cohortedDocument) {\n filteredDocument = document.en.default;\n } else {\n filteredDocument = cohortedDocument;\n }\n\n if (!filteredDocument) {\n throw new Error(\"Cohorted document doesn't exist\");\n }\n\n normalizedCopy = {\n ...normalizedCopy,\n [key]: filteredDocument,\n };\n }\n });\n\n return normalizedCopy as Copy;\n};\n","export const PARTNER_ASSETS_BASE_URL =\n import.meta.env?.VITE_PARTNER_ASSETS_BASE_URL ?? process.env.VITE_PARTNER_ASSETS_BASE_URL;\n","import { PARTNER_ASSETS_BASE_URL } from '../config';\nimport type { Copy, CopyBundle } from '../schemas';\nimport type { Options } from '../types';\nimport { filterCopy } from './filterCopy';\n\ntype LoadCopyParams = {\n partnerId: string;\n companyId?: string;\n version?: string;\n options?: Options;\n};\ntype LoadCopy = (params: LoadCopyParams) => Promise<Copy | null>;\n\nexport const loadAndConfigureCopy: LoadCopy = async (params) => {\n const partnerId = params.partnerId;\n const version = params?.version;\n const options = params?.options;\n\n const requestUrl = `${PARTNER_ASSETS_BASE_URL}/${partnerId}/copy/${version}/copy.json`;\n\n try {\n const documentResponse = await fetch(requestUrl);\n const document = (await documentResponse.json()) as CopyBundle;\n\n return filterCopy(document, options);\n } catch (err) {\n console.error(err);\n\n return null;\n }\n};\n","import { z } from 'zod';\n\nimport { WayflyerDocumentSchema } from './wayflyerDocument';\nimport { mustContainPlaceholders } from '../utils';\n\nexport const IndicativeOfferSchema = WayflyerDocumentSchema.extend({\n mainText: z\n .string()\n .trim()\n .min(1)\n .max(160)\n .refine(mustContainPlaceholders(['amount', 'currency']), {\n message: 'mainText must include {amount} and {currency}',\n }),\n bulletPoints: z.array(z.string().min(1)).max(3),\n buttonText: z.string().min(1).max(25),\n});\nexport type IndicativeOffer = z.infer<typeof IndicativeOfferSchema>;\n","import { z } from 'zod';\n\nimport { WayflyerDocumentSchema } from './wayflyerDocument';\nimport { mustContainPlaceholders } from '../utils';\n\nexport const ConsentModalSchema = WayflyerDocumentSchema.extend({\n imageUrl: z.string().trim().url(),\n title: z.string().trim().min(1),\n descriptions: z\n .array(\n z.object({\n title: z.string().trim().min(1),\n description: z.string().trim().min(1),\n }),\n )\n .length(3),\n buttons: z.object({\n accept: z.string().trim().min(1),\n close: z.string().trim().min(1),\n }),\n termsAndConditions: z\n .string()\n .trim()\n .min(1)\n .refine(mustContainPlaceholders(['termsUrl']), {\n message: 'termsUrl is required',\n }),\n});\nexport type ConsentModal = z.infer<typeof ConsentModalSchema>;\n","import { z } from 'zod';\n\nimport { WayflyerDocumentSchema } from './wayflyerDocument';\n\nexport const CompleteApplicationSchema = WayflyerDocumentSchema.extend({\n mainText: z.string().min(1).max(150),\n buttonText: z.string().min(1).max(25),\n});\nexport type CompleteApplication = z.infer<typeof CompleteApplicationSchema>;\n","import { z } from 'zod';\n\nimport { WayflyerDocumentSchema } from './wayflyerDocument';\nimport { mustContainPlaceholders } from '../utils';\n\nexport const SelectOfferSchema = WayflyerDocumentSchema.extend({\n mainText: z\n .string()\n .trim()\n .min(1)\n .max(160)\n .refine(mustContainPlaceholders(['amount', 'currency']), {\n message: 'mainText must include {amount} and {currency}',\n }),\n bulletPoints: z.array(z.string().min(1)).max(3),\n buttonText: z.string().min(1).max(25),\n});\nexport type SelectOffer = z.infer<typeof SelectOfferSchema>;\n","import { z } from 'zod';\n\nimport { WayflyerDocumentSchema } from './wayflyerDocument';\n\nexport const CompleteKycSchema = WayflyerDocumentSchema.extend({\n mainText: z.string().min(1).max(150),\n buttonText: z.string().min(1).max(25),\n});\nexport type CompleteKyc = z.infer<typeof CompleteKycSchema>;\n","import { z } from 'zod';\n\nimport { WayflyerDocumentSchema } from './wayflyerDocument';\n\nexport const SignContractSchema = WayflyerDocumentSchema.extend({\n mainText: z.string().min(1).max(150),\n buttonText: z.string().min(1).max(25),\n});\nexport type SignContract = z.infer<typeof SignContractSchema>;\n","import { z } from 'zod';\n\nimport { WayflyerDocumentSchema } from './wayflyerDocument';\n\nexport const ProvideAdditionalInfoSchema = WayflyerDocumentSchema.extend({\n mainText: z.string().min(1).max(150),\n buttonText: z.string().min(1).max(25),\n});\nexport type ProvideAdditionalInfo = z.infer<typeof ProvideAdditionalInfoSchema>;\n","import { z } from 'zod';\n\nimport { LanguageMap } from '../utils';\nimport { GenericOfferSchema } from './genericOffer';\nimport { IndicativeOfferSchema } from './indicativeOffer';\nimport { CompleteApplicationSchema } from './completeApplication.ts';\nimport { CompleteKycSchema } from './completeKyc.ts';\nimport { SelectOfferSchema } from './selectOffer.ts';\nimport { SignContractSchema } from './signContract';\nimport { ConsentModalSchema } from './consentModal';\nimport { PartnerTemplateSchema } from './partnerTemplate';\nimport { ProvideAdditionalInfoSchema } from './provideAdditionalInfo';\n\nexport const CopyBundleSchema = z.object({\n genericOffer: LanguageMap(GenericOfferSchema),\n indicativeOffer: LanguageMap(IndicativeOfferSchema),\n consentModal: LanguageMap(ConsentModalSchema),\n completeApplication: LanguageMap(CompleteApplicationSchema),\n completeKyc: LanguageMap(CompleteKycSchema),\n signContract: LanguageMap(SignContractSchema),\n selectOffer: LanguageMap(SelectOfferSchema),\n provideAdditionalInfo: LanguageMap(ProvideAdditionalInfoSchema),\n partnerTemplate: LanguageMap(PartnerTemplateSchema).optional(),\n});\nexport const CopySchema = z.object({\n genericOffer: GenericOfferSchema,\n indicativeOffer: IndicativeOfferSchema,\n consentModal: ConsentModalSchema,\n completeApplication: CompleteApplicationSchema,\n completeKyc: CompleteKycSchema,\n signContract: SignContractSchema,\n selectOffer: SelectOfferSchema,\n provideAdditionalInfo: ProvideAdditionalInfoSchema,\n partnerTemplate: PartnerTemplateSchema.optional(),\n});\nexport type Copy = z.infer<typeof CopySchema>;\nexport type CopyBundle = z.infer<typeof CopyBundleSchema>;\n"],"names":["WayflyerDocumentSchema","z","PartnerTemplateSchema","GenericOfferSchema","mustContainPlaceholders","placeholders","value","placeholder","CohortMap","schema","LanguageMap","filterCopy","copy","options","language","cohort","documentKeys","normalizedCopy","key","document","filteredDocument","localizedDocument","cohortedDocument","PARTNER_ASSETS_BASE_URL","loadAndConfigureCopy","params","partnerId","version","requestUrl","err","IndicativeOfferSchema","ConsentModalSchema","CompleteApplicationSchema","SelectOfferSchema","CompleteKycSchema","SignContractSchema","ProvideAdditionalInfoSchema","CopyBundleSchema","CopySchema"],"mappings":"uGAEaA,EAAyBC,EAAAA,EAAE,OAAO,CAC7C,QAASA,EAAAA,EAAE,SAAS,IAAI,CAAC,EACzB,SAAUA,EAAAA,EAAE,SAAS,IAAI,CAAC,EAC1B,OAAQA,EAAAA,EAAE,OAAA,EAAS,IAAI,CAAC,CAC1B,CAAC,ECFYC,EAAwBF,EAAuB,OAAO,CACjE,YAAaC,EAAAA,EAAE,OAAA,EAAS,KAAA,EACxB,oBAAqBA,EAAAA,EAAE,OAAA,EAAS,KAAA,EAAO,IAAI,GAAG,EAC9C,mBAAoBA,EAAAA,EAAE,OAAA,EAAS,IAAA,CACjC,CAAC,ECJYE,EAAqBH,EAAuB,OAAO,CAC9D,SAAUC,EAAAA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,GAAG,EACnC,aAAcA,EAAAA,EAAE,MAAMA,EAAAA,EAAE,OAAA,EAAS,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,EAC9C,WAAYA,EAAAA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,CACtC,CAAC,ECRYG,EAA2BC,GAC9BC,GAAkBD,EAAa,MAAOE,GAAgBD,EAAM,SAAS,IAAIC,CAAW,GAAG,CAAC,ECCrFC,EAAqCC,GAAcR,EAAAA,EAAE,OAAOA,EAAAA,EAAE,OAAA,EAAUQ,CAAM,EAC9EC,EAAuCD,GAAcR,IAAE,OAAOA,EAAAA,EAAE,OAAA,EAAUO,EAAUC,CAAM,CAAC,ECE3FE,EAAyB,CAACC,EAAMC,IAAY,CACvD,MAAMC,GAAWD,GAAA,YAAAA,EAAS,WAAY,KAChCE,GAASF,GAAA,YAAAA,EAAS,SAAU,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GAAG,EACnC,WAAYA,EAAAA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,CACtC,CAAC,ECHYkC,EAAqBnC,EAAuB,OAAO,CAC9D,SAAUC,EAAAA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,GAAG,EACnC,WAAYA,EAAAA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,CACtC,CAAC,ECHYmC,EAA8BpC,EAAuB,OAAO,CACvE,SAAUC,EAAAA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,GAAG,EACnC,WAAYA,EAAAA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,CACtC,CAAC,ECMYoC,EAAmBpC,EAAAA,EAAE,OAAO,CACvC,aAAcS,EAAYP,CAAkB,EAC5C,gBAAiBO,EAAYoB,CAAqB,EAClD,aAAcpB,EAAYqB,CAAkB,EAC5C,oBAAqBrB,EAAYsB,CAAyB,EAC1D,YAAatB,EAAYwB,CAAiB,EAC1C,aAAcxB,EAAYyB,CAAkB,EAC5C,YAAazB,EAAYuB,CAAiB,EAC1C,sBAAuBvB,EAAY0B,CAA2B,EAC9D,gBAAiB1B,EAAYR,CAAqB,EAAE,SAAA,CACtD,CAAC,EACYoC,EAAarC,EAAAA,EAAE,OAAO,CACjC,aAAcE,EACd,gBAAiB2B,EACjB,aAAcC,EACd,oBAAqBC,EACrB,YAAaE,EACb,aAAcC,EACd,YAAaF,EACb,sBAAuBG,EACvB,gBAAiBlC,EAAsB,SAAA,CACzC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './schemas';
2
+ export * from './utils';
@@ -0,0 +1,118 @@
1
+ import { z as t } from "zod";
2
+ const i = t.object({
3
+ version: t.string().min(1),
4
+ language: t.string().min(2),
5
+ cohort: t.string().min(1)
6
+ }), f = i.extend({
7
+ partnerName: t.string().trim(),
8
+ termsOfServiceTitle: t.string().trim().max(120),
9
+ termsAndServiceUrl: t.string().url()
10
+ }), h = i.extend({
11
+ mainText: t.string().min(1).max(150),
12
+ bulletPoints: t.array(t.string().min(1)).max(3),
13
+ buttonText: t.string().min(1).max(25)
14
+ }), u = (e) => (n) => e.every((c) => n.includes(`{${c}}`)), A = (e) => t.record(t.string(), e), r = (e) => t.record(t.string(), A(e)), O = (e, n) => {
15
+ const c = (n == null ? void 0 : n.language) ?? "en", l = (n == null ? void 0 : n.cohort) ?? "default", d = Object.keys(e);
16
+ let o = {};
17
+ return d.forEach((m) => {
18
+ const s = e[m];
19
+ if (s) {
20
+ let a;
21
+ const g = s[c] ?? s.en, x = g[l] ?? g.default;
22
+ if (x ? a = x : a = s.en.default, !a)
23
+ throw new Error("Cohorted document doesn't exist");
24
+ o = {
25
+ ...o,
26
+ [m]: a
27
+ };
28
+ }
29
+ }), o;
30
+ }, j = "http://partner-assets.wayflyer.com", I = async (e) => {
31
+ const n = e.partnerId, c = e == null ? void 0 : e.version, l = e == null ? void 0 : e.options, d = `${j}/${n}/copy/${c}/copy.json`;
32
+ try {
33
+ const m = await (await fetch(d)).json();
34
+ return O(m, l);
35
+ } catch (o) {
36
+ return console.error(o), null;
37
+ }
38
+ }, y = i.extend({
39
+ mainText: t.string().trim().min(1).max(160).refine(u(["amount", "currency"]), {
40
+ message: "mainText must include {amount} and {currency}"
41
+ }),
42
+ bulletPoints: t.array(t.string().min(1)).max(3),
43
+ buttonText: t.string().min(1).max(25)
44
+ }), p = i.extend({
45
+ imageUrl: t.string().trim().url(),
46
+ title: t.string().trim().min(1),
47
+ descriptions: t.array(
48
+ t.object({
49
+ title: t.string().trim().min(1),
50
+ description: t.string().trim().min(1)
51
+ })
52
+ ).length(3),
53
+ buttons: t.object({
54
+ accept: t.string().trim().min(1),
55
+ close: t.string().trim().min(1)
56
+ }),
57
+ termsAndConditions: t.string().trim().min(1).refine(u(["termsUrl"]), {
58
+ message: "termsUrl is required"
59
+ })
60
+ }), T = i.extend({
61
+ mainText: t.string().min(1).max(150),
62
+ buttonText: t.string().min(1).max(25)
63
+ }), S = i.extend({
64
+ mainText: t.string().trim().min(1).max(160).refine(u(["amount", "currency"]), {
65
+ message: "mainText must include {amount} and {currency}"
66
+ }),
67
+ bulletPoints: t.array(t.string().min(1)).max(3),
68
+ buttonText: t.string().min(1).max(25)
69
+ }), b = i.extend({
70
+ mainText: t.string().min(1).max(150),
71
+ buttonText: t.string().min(1).max(25)
72
+ }), C = i.extend({
73
+ mainText: t.string().min(1).max(150),
74
+ buttonText: t.string().min(1).max(25)
75
+ }), v = i.extend({
76
+ mainText: t.string().min(1).max(150),
77
+ buttonText: t.string().min(1).max(25)
78
+ }), U = t.object({
79
+ genericOffer: r(h),
80
+ indicativeOffer: r(y),
81
+ consentModal: r(p),
82
+ completeApplication: r(T),
83
+ completeKyc: r(b),
84
+ signContract: r(C),
85
+ selectOffer: r(S),
86
+ provideAdditionalInfo: r(v),
87
+ partnerTemplate: r(f).optional()
88
+ }), w = t.object({
89
+ genericOffer: h,
90
+ indicativeOffer: y,
91
+ consentModal: p,
92
+ completeApplication: T,
93
+ completeKyc: b,
94
+ signContract: C,
95
+ selectOffer: S,
96
+ provideAdditionalInfo: v,
97
+ partnerTemplate: f.optional()
98
+ });
99
+ export {
100
+ A as CohortMap,
101
+ T as CompleteApplicationSchema,
102
+ b as CompleteKycSchema,
103
+ p as ConsentModalSchema,
104
+ U as CopyBundleSchema,
105
+ w as CopySchema,
106
+ h as GenericOfferSchema,
107
+ y as IndicativeOfferSchema,
108
+ r as LanguageMap,
109
+ f as PartnerTemplateSchema,
110
+ v as ProvideAdditionalInfoSchema,
111
+ S as SelectOfferSchema,
112
+ C as SignContractSchema,
113
+ i as WayflyerDocumentSchema,
114
+ O as filterCopy,
115
+ I as loadAndConfigureCopy,
116
+ u as mustContainPlaceholders
117
+ };
118
+ //# sourceMappingURL=index.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.es.js","sources":["../src/schemas/wayflyerDocument.ts","../src/schemas/partnerTemplate.ts","../src/schemas/genericOffer.ts","../src/utils/validators.ts","../src/utils/normalizers.ts","../src/utils/filterCopy.ts","../src/config/urls.ts","../src/utils/loadCopy.ts","../src/schemas/indicativeOffer.ts","../src/schemas/consentModal.ts","../src/schemas/completeApplication.ts","../src/schemas/selectOffer.ts","../src/schemas/completeKyc.ts","../src/schemas/signContract.ts","../src/schemas/provideAdditionalInfo.ts","../src/schemas/copyBundle.ts"],"sourcesContent":["import { z } from 'zod';\n\nexport const WayflyerDocumentSchema = z.object({\n version: z.string().min(1),\n language: z.string().min(2),\n cohort: z.string().min(1),\n});\nexport type WayflyerDocument = z.infer<typeof WayflyerDocumentSchema>;\n","import { z } from 'zod';\n\nimport { WayflyerDocumentSchema } from './wayflyerDocument';\n\nexport const PartnerTemplateSchema = WayflyerDocumentSchema.extend({\n partnerName: z.string().trim(),\n termsOfServiceTitle: z.string().trim().max(120),\n termsAndServiceUrl: z.string().url(),\n});\nexport type PartnerTemplate = z.infer<typeof PartnerTemplateSchema>;\n","import { z } from 'zod';\n\nimport { WayflyerDocumentSchema } from './wayflyerDocument';\n\nexport const GenericOfferSchema = WayflyerDocumentSchema.extend({\n mainText: z.string().min(1).max(150),\n bulletPoints: z.array(z.string().min(1)).max(3),\n buttonText: z.string().min(1).max(25),\n});\nexport type GenericOffer = z.infer<typeof GenericOfferSchema>;\n","export const mustContainPlaceholders = (placeholders: string[]) => {\n return (value: string) => placeholders.every((placeholder) => value.includes(`{${placeholder}}`));\n};\n","import { z } from 'zod';\n\nexport const CohortMap = <T extends z.ZodTypeAny>(schema: T) => z.record(z.string(), schema);\nexport const LanguageMap = <T extends z.ZodTypeAny>(schema: T) => z.record(z.string(), CohortMap(schema));\n","import type { CopyBundle, Copy } from '../schemas';\nimport type { Options } from '../types';\n\ntype FilterCopy = (copy: CopyBundle, options?: Options) => Copy;\n\nexport const filterCopy: FilterCopy = (copy, options) => {\n const language = options?.language ?? 'en';\n const cohort = options?.cohort ?? 'default';\n const documentKeys = Object.keys(copy) as Array<keyof typeof copy>;\n let normalizedCopy = {};\n\n documentKeys.forEach((key) => {\n const document = copy[key];\n\n if (document) {\n let filteredDocument;\n const localizedDocument = document[language] ?? document.en;\n const cohortedDocument = localizedDocument[cohort] ?? localizedDocument.default;\n\n if (!cohortedDocument) {\n filteredDocument = document.en.default;\n } else {\n filteredDocument = cohortedDocument;\n }\n\n if (!filteredDocument) {\n throw new Error(\"Cohorted document doesn't exist\");\n }\n\n normalizedCopy = {\n ...normalizedCopy,\n [key]: filteredDocument,\n };\n }\n });\n\n return normalizedCopy as Copy;\n};\n","export const PARTNER_ASSETS_BASE_URL =\n import.meta.env?.VITE_PARTNER_ASSETS_BASE_URL ?? process.env.VITE_PARTNER_ASSETS_BASE_URL;\n","import { PARTNER_ASSETS_BASE_URL } from '../config';\nimport type { Copy, CopyBundle } from '../schemas';\nimport type { Options } from '../types';\nimport { filterCopy } from './filterCopy';\n\ntype LoadCopyParams = {\n partnerId: string;\n companyId?: string;\n version?: string;\n options?: Options;\n};\ntype LoadCopy = (params: LoadCopyParams) => Promise<Copy | null>;\n\nexport const loadAndConfigureCopy: LoadCopy = async (params) => {\n const partnerId = params.partnerId;\n const version = params?.version;\n const options = params?.options;\n\n const requestUrl = `${PARTNER_ASSETS_BASE_URL}/${partnerId}/copy/${version}/copy.json`;\n\n try {\n const documentResponse = await fetch(requestUrl);\n const document = (await documentResponse.json()) as CopyBundle;\n\n return filterCopy(document, options);\n } catch (err) {\n console.error(err);\n\n return null;\n }\n};\n","import { z } from 'zod';\n\nimport { WayflyerDocumentSchema } from './wayflyerDocument';\nimport { mustContainPlaceholders } from '../utils';\n\nexport const IndicativeOfferSchema = WayflyerDocumentSchema.extend({\n mainText: z\n .string()\n .trim()\n .min(1)\n .max(160)\n .refine(mustContainPlaceholders(['amount', 'currency']), {\n message: 'mainText must include {amount} and {currency}',\n }),\n bulletPoints: z.array(z.string().min(1)).max(3),\n buttonText: z.string().min(1).max(25),\n});\nexport type IndicativeOffer = z.infer<typeof IndicativeOfferSchema>;\n","import { z } from 'zod';\n\nimport { WayflyerDocumentSchema } from './wayflyerDocument';\nimport { mustContainPlaceholders } from '../utils';\n\nexport const ConsentModalSchema = WayflyerDocumentSchema.extend({\n imageUrl: z.string().trim().url(),\n title: z.string().trim().min(1),\n descriptions: z\n .array(\n z.object({\n title: z.string().trim().min(1),\n description: z.string().trim().min(1),\n }),\n )\n .length(3),\n buttons: z.object({\n accept: z.string().trim().min(1),\n close: z.string().trim().min(1),\n }),\n termsAndConditions: z\n .string()\n .trim()\n .min(1)\n .refine(mustContainPlaceholders(['termsUrl']), {\n message: 'termsUrl is required',\n }),\n});\nexport type ConsentModal = z.infer<typeof ConsentModalSchema>;\n","import { z } from 'zod';\n\nimport { WayflyerDocumentSchema } from './wayflyerDocument';\n\nexport const CompleteApplicationSchema = WayflyerDocumentSchema.extend({\n mainText: z.string().min(1).max(150),\n buttonText: z.string().min(1).max(25),\n});\nexport type CompleteApplication = z.infer<typeof CompleteApplicationSchema>;\n","import { z } from 'zod';\n\nimport { WayflyerDocumentSchema } from './wayflyerDocument';\nimport { mustContainPlaceholders } from '../utils';\n\nexport const SelectOfferSchema = WayflyerDocumentSchema.extend({\n mainText: z\n .string()\n .trim()\n .min(1)\n .max(160)\n .refine(mustContainPlaceholders(['amount', 'currency']), {\n message: 'mainText must include {amount} and {currency}',\n }),\n bulletPoints: z.array(z.string().min(1)).max(3),\n buttonText: z.string().min(1).max(25),\n});\nexport type SelectOffer = z.infer<typeof SelectOfferSchema>;\n","import { z } from 'zod';\n\nimport { WayflyerDocumentSchema } from './wayflyerDocument';\n\nexport const CompleteKycSchema = WayflyerDocumentSchema.extend({\n mainText: z.string().min(1).max(150),\n buttonText: z.string().min(1).max(25),\n});\nexport type CompleteKyc = z.infer<typeof CompleteKycSchema>;\n","import { z } from 'zod';\n\nimport { WayflyerDocumentSchema } from './wayflyerDocument';\n\nexport const SignContractSchema = WayflyerDocumentSchema.extend({\n mainText: z.string().min(1).max(150),\n buttonText: z.string().min(1).max(25),\n});\nexport type SignContract = z.infer<typeof SignContractSchema>;\n","import { z } from 'zod';\n\nimport { WayflyerDocumentSchema } from './wayflyerDocument';\n\nexport const ProvideAdditionalInfoSchema = WayflyerDocumentSchema.extend({\n mainText: z.string().min(1).max(150),\n buttonText: z.string().min(1).max(25),\n});\nexport type ProvideAdditionalInfo = z.infer<typeof ProvideAdditionalInfoSchema>;\n","import { z } from 'zod';\n\nimport { LanguageMap } from '../utils';\nimport { GenericOfferSchema } from './genericOffer';\nimport { IndicativeOfferSchema } from './indicativeOffer';\nimport { CompleteApplicationSchema } from './completeApplication.ts';\nimport { CompleteKycSchema } from './completeKyc.ts';\nimport { SelectOfferSchema } from './selectOffer.ts';\nimport { SignContractSchema } from './signContract';\nimport { ConsentModalSchema } from './consentModal';\nimport { PartnerTemplateSchema } from './partnerTemplate';\nimport { ProvideAdditionalInfoSchema } from './provideAdditionalInfo';\n\nexport const CopyBundleSchema = z.object({\n genericOffer: LanguageMap(GenericOfferSchema),\n indicativeOffer: LanguageMap(IndicativeOfferSchema),\n consentModal: LanguageMap(ConsentModalSchema),\n completeApplication: LanguageMap(CompleteApplicationSchema),\n completeKyc: LanguageMap(CompleteKycSchema),\n signContract: LanguageMap(SignContractSchema),\n selectOffer: LanguageMap(SelectOfferSchema),\n provideAdditionalInfo: LanguageMap(ProvideAdditionalInfoSchema),\n partnerTemplate: LanguageMap(PartnerTemplateSchema).optional(),\n});\nexport const CopySchema = z.object({\n genericOffer: GenericOfferSchema,\n indicativeOffer: IndicativeOfferSchema,\n consentModal: ConsentModalSchema,\n completeApplication: CompleteApplicationSchema,\n completeKyc: CompleteKycSchema,\n signContract: SignContractSchema,\n selectOffer: SelectOfferSchema,\n provideAdditionalInfo: ProvideAdditionalInfoSchema,\n partnerTemplate: PartnerTemplateSchema.optional(),\n});\nexport type Copy = z.infer<typeof CopySchema>;\nexport type CopyBundle = z.infer<typeof CopyBundleSchema>;\n"],"names":["WayflyerDocumentSchema","z","PartnerTemplateSchema","GenericOfferSchema","mustContainPlaceholders","placeholders","value","placeholder","CohortMap","schema","LanguageMap","filterCopy","copy","options","language","cohort","documentKeys","normalizedCopy","key","document","filteredDocument","localizedDocument","cohortedDocument","PARTNER_ASSETS_BASE_URL","loadAndConfigureCopy","params","partnerId","version","requestUrl","err","IndicativeOfferSchema","ConsentModalSchema","CompleteApplicationSchema","SelectOfferSchema","CompleteKycSchema","SignContractSchema","ProvideAdditionalInfoSchema","CopyBundleSchema","CopySchema"],"mappings":";AAEO,MAAMA,IAAyBC,EAAE,OAAO;AAAA,EAC7C,SAASA,EAAE,SAAS,IAAI,CAAC;AAAA,EACzB,UAAUA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC1B,QAAQA,EAAE,OAAA,EAAS,IAAI,CAAC;AAC1B,CAAC,GCFYC,IAAwBF,EAAuB,OAAO;AAAA,EACjE,aAAaC,EAAE,OAAA,EAAS,KAAA;AAAA,EACxB,qBAAqBA,EAAE,OAAA,EAAS,KAAA,EAAO,IAAI,GAAG;AAAA,EAC9C,oBAAoBA,EAAE,OAAA,EAAS,IAAA;AACjC,CAAC,GCJYE,IAAqBH,EAAuB,OAAO;AAAA,EAC9D,UAAUC,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EACnC,cAAcA,EAAE,MAAMA,EAAE,OAAA,EAAS,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAAA,EAC9C,YAAYA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE;AACtC,CAAC,GCRYG,IAA0B,CAACC,MAC/B,CAACC,MAAkBD,EAAa,MAAM,CAACE,MAAgBD,EAAM,SAAS,IAAIC,CAAW,GAAG,CAAC,GCCrFC,IAAY,CAAyBC,MAAcR,EAAE,OAAOA,EAAE,OAAA,GAAUQ,CAAM,GAC9EC,IAAc,CAAyBD,MAAcR,EAAE,OAAOA,EAAE,OAAA,GAAUO,EAAUC,CAAM,CAAC,GCE3FE,IAAyB,CAACC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AAC;"}
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+
3
+ export declare const CompleteApplicationSchema: z.ZodObject<{
4
+ version: z.ZodString;
5
+ language: z.ZodString;
6
+ cohort: z.ZodString;
7
+ } & {
8
+ mainText: z.ZodString;
9
+ buttonText: z.ZodString;
10
+ }, "strip", z.ZodTypeAny, {
11
+ version: string;
12
+ language: string;
13
+ cohort: string;
14
+ mainText: string;
15
+ buttonText: string;
16
+ }, {
17
+ version: string;
18
+ language: string;
19
+ cohort: string;
20
+ mainText: string;
21
+ buttonText: string;
22
+ }>;
23
+ export type CompleteApplication = z.infer<typeof CompleteApplicationSchema>;
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+
3
+ export declare const CompleteKycSchema: z.ZodObject<{
4
+ version: z.ZodString;
5
+ language: z.ZodString;
6
+ cohort: z.ZodString;
7
+ } & {
8
+ mainText: z.ZodString;
9
+ buttonText: z.ZodString;
10
+ }, "strip", z.ZodTypeAny, {
11
+ version: string;
12
+ language: string;
13
+ cohort: string;
14
+ mainText: string;
15
+ buttonText: string;
16
+ }, {
17
+ version: string;
18
+ language: string;
19
+ cohort: string;
20
+ mainText: string;
21
+ buttonText: string;
22
+ }>;
23
+ export type CompleteKyc = z.infer<typeof CompleteKycSchema>;
@@ -0,0 +1,62 @@
1
+ import { z } from 'zod';
2
+
3
+ export declare const ConsentModalSchema: z.ZodObject<{
4
+ version: z.ZodString;
5
+ language: z.ZodString;
6
+ cohort: z.ZodString;
7
+ } & {
8
+ imageUrl: z.ZodString;
9
+ title: z.ZodString;
10
+ descriptions: z.ZodArray<z.ZodObject<{
11
+ title: z.ZodString;
12
+ description: z.ZodString;
13
+ }, "strip", z.ZodTypeAny, {
14
+ title: string;
15
+ description: string;
16
+ }, {
17
+ title: string;
18
+ description: string;
19
+ }>, "many">;
20
+ buttons: z.ZodObject<{
21
+ accept: z.ZodString;
22
+ close: z.ZodString;
23
+ }, "strip", z.ZodTypeAny, {
24
+ accept: string;
25
+ close: string;
26
+ }, {
27
+ accept: string;
28
+ close: string;
29
+ }>;
30
+ termsAndConditions: z.ZodEffects<z.ZodString, string, string>;
31
+ }, "strip", z.ZodTypeAny, {
32
+ version: string;
33
+ language: string;
34
+ cohort: string;
35
+ imageUrl: string;
36
+ title: string;
37
+ descriptions: {
38
+ title: string;
39
+ description: string;
40
+ }[];
41
+ buttons: {
42
+ accept: string;
43
+ close: string;
44
+ };
45
+ termsAndConditions: string;
46
+ }, {
47
+ version: string;
48
+ language: string;
49
+ cohort: string;
50
+ imageUrl: string;
51
+ title: string;
52
+ descriptions: {
53
+ title: string;
54
+ description: string;
55
+ }[];
56
+ buttons: {
57
+ accept: string;
58
+ close: string;
59
+ };
60
+ termsAndConditions: string;
61
+ }>;
62
+ export type ConsentModal = z.infer<typeof ConsentModalSchema>;