@wf-financing/ui-assets 1.0.0 → 1.0.2
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/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +13 -12
- package/dist/index.es.js.map +1 -1
- package/dist/schemas/completeApplication.d.ts +3 -0
- package/dist/schemas/completeKyc.d.ts +3 -0
- package/dist/schemas/consentModal.d.ts +3 -0
- package/dist/schemas/copyBundle.d.ts +90 -0
- package/dist/schemas/genericOffer.d.ts +3 -0
- package/dist/schemas/indicativeOffer.d.ts +3 -0
- package/dist/schemas/partnerTemplate.d.ts +3 -0
- package/dist/schemas/provideAdditionalInfo.d.ts +3 -0
- package/dist/schemas/selectOffer.d.ts +3 -0
- package/dist/schemas/signContract.d.ts +3 -0
- package/dist/schemas/wayflyerDocument.d.ts +3 -0
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var U=Object.defineProperty;var j=(r,t,e)=>t in r?U(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var g=(r,t,e)=>j(r,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("zod"),m=n.z.object({version:n.z.string().min(1),language:n.z.string().min(2),cohort:n.z.string().min(1)}),y=m.extend({partnerLogoUrl:n.z.string().trim().url()}),p=m.extend({mainText:n.z.string().min(1).max(150),bulletPoints:n.z.array(n.z.string().min(1)).length(3),buttonText:n.z.string().min(1).max(25)}),f=r=>t=>r.every(e=>t.includes(`{${e}}`)),P=r=>n.z.record(n.z.string(),r),l=r=>n.z.record(n.z.string(),P(r)),M=(r,t)=>{const e=(t==null?void 0:t.language)??"en",o="default",a=Object.keys(r);let c={};return a.forEach(i=>{const s=r[i];if(s){let u;const
|
|
1
|
+
"use strict";var U=Object.defineProperty;var j=(r,t,e)=>t in r?U(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var g=(r,t,e)=>j(r,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("zod"),m=n.z.object({version:n.z.string().min(1),language:n.z.string().min(2),cohort:n.z.string().min(1),type:n.z.string().min(1)}),y=m.extend({partnerLogoUrl:n.z.string().trim().url()}),p=m.extend({mainText:n.z.string().min(1).max(150),bulletPoints:n.z.array(n.z.string().min(1)).length(3),buttonText:n.z.string().min(1).max(25)}),f=r=>t=>r.every(e=>t.includes(`{${e}}`)),P=r=>n.z.record(n.z.string(),r),l=r=>n.z.record(n.z.string(),P(r)),M=(r,t)=>{const e=(t==null?void 0:t.language)??"en",o="default",a=Object.keys(r);let c={};return a.forEach(i=>{const s=r[i];if(s){let u;const C=s[e]??s.en,I=C[o]??C.default;if(I?u=I:u=s.en.default,!u)throw new Error("Cohorted document doesn't exist");c={...c,[i]:u}}}),c};var $=Object.defineProperty,N=(r,t,e)=>t in r?$(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,h=(r,t,e)=>N(r,typeof t!="symbol"?t+"":t,e);const L="https://api.wayflyer.com",R="https://sandbox-api.wayflyer.com",G=r=>{try{return JSON.parse(atob(r.split(".")[1]))}catch{return null}},A={"Content-Type":"application/json"},O={event:"/financing/v1/company/event/",error:"/financing/v1/error/"},E="wf_session_v1",B=1800*1e3,_=1440*60*1e3;class k{getSessionId(){const t=Date.now();let e=this.loadSession();return(!e||this.isSessionExpired(e,t))&&(e=this.mintNewSession(t)),e.lastActivity=t,this.saveSession(e),e.sessionId}isSessionExpired(t,e){const o=e-t.lastActivity>B,a=e-t.createdAt>_;return o||a}mintNewSession(t){return{sessionId:crypto.randomUUID(),createdAt:t,lastActivity:t}}loadSession(){try{const t=sessionStorage.getItem(E);return t?JSON.parse(t):null}catch{return null}}saveSession(t){try{sessionStorage.setItem(E,JSON.stringify(t))}catch{console.warn("Failed to save session context")}}}const D=class d{constructor(t,e){h(this,"baseUrl",null),h(this,"sessionManager"),this.companyToken=t,this.baseUrl=e?R:L,this.sessionManager=new k}static getGlobalInstance(){return window.WayflyerLogger||null}static setGlobalInstance(t){window.WayflyerLogger=t}static initialize(t,e){d.getGlobalInstance()&&console.warn("Logger re-initialized");const o=new d(t,e==null?void 0:e.isSandbox);d.setGlobalInstance(o)}static getMandatoryProperties(t){const e=G(t),[o,a]=(e==null?void 0:e.sub.split("|"))||[],c=e==null?void 0:e.user_id;return{partner_id:o,company_id:a,user_id:c}}static getInstance(){const t=d.getGlobalInstance();if(!t)throw new Error("Logger not initialized. Call initialize() first.");return t}static async logEvent(t,e){if(this.isDevEnvironment)return;const o=d.getInstance(),a=o.sessionManager.getSessionId(),c={...A,Authorization:`Bearer ${o.companyToken}`,"X-Session-ID":a};try{const i={...d.getMandatoryProperties(o.companyToken),...e},s=await fetch(o.baseUrl+O.event,{method:"POST",headers:c,body:JSON.stringify({timestamp:new Date().toISOString(),event_name:t,properties:i})});if(s.status===200)return await s.json()}catch(i){console.error("Failed to log event",i)}}static async logError(t,e){if(this.isDevEnvironment){console.error(t);return}const o=d.getInstance(),a=o.sessionManager.getSessionId(),c={...A,"X-Session-ID":a};try{const i={...d.getMandatoryProperties(o.companyToken),...e},s=await fetch(o.baseUrl+O.error,{method:"POST",headers:c,body:JSON.stringify({timestamp:new Date().toISOString(),message:t,properties:i})});if(s.status===200)return await s.json()}catch(i){console.warn("Failed to log error",i)}}};h(D,"isDevEnvironment",!1);let J=D;const K="https://partner-assets.wayflyer.com",q="https://partner-assets-sandbox.wayflyer.com";class W extends Error{constructor(e,o){super(`Request to ${o} failed with status ${e.status} ${e.statusText}`);g(this,"status");g(this,"statusText");g(this,"url");this.name="HttpError",this.status=e.status,this.statusText=e.statusText,this.url=o}}const F=async r=>{const t=r.partnerId,e=r==null?void 0:r.version,o=r==null?void 0:r.options,i=`${(o==null?void 0:o.isSandbox)?q:K}/${t}/copy/${e}/copy.json`;try{const s=await fetch(i);if(!s.ok)throw new W(s,i);const u=await s.json();return M(u,o)}catch(s){const u=navigator.userAgent;throw J.logError(`Error in partner copy loading from ${i} by userAgent: ${u}: ${s}`),s}},S=m.extend({mainText:n.z.string().trim().min(1).max(160).refine(f(["amount"]),{message:"mainText must include {amount}"}),bulletPoints:n.z.array(n.z.string().min(1)).length(3),buttonText:n.z.string().min(1).max(25)}),x=m.extend({logoUrl:n.z.string().trim().url(),title:n.z.string().trim().min(1),bulletPoints:n.z.array(n.z.string().min(1)).length(3),button:n.z.string().trim().min(1),termsAndConditions:n.z.string().trim().min(1).refine(f(["termsUrl"]),{message:"termsUrl is required"})}),b=m.extend({mainText:n.z.string().min(1).max(150),buttonText:n.z.string().min(1).max(25)}),z=m.extend({mainText:n.z.string().trim().min(1).max(160).refine(f(["amount"]),{message:"mainText must include {amount}"}),buttonText:n.z.string().min(1).max(25)}),v=m.extend({mainText:n.z.string().min(1).max(150),buttonText:n.z.string().min(1).max(25)}),T=m.extend({mainText:n.z.string().min(1).max(150),buttonText:n.z.string().min(1).max(25)}),w=m.extend({mainText:n.z.string().min(1).max(150),buttonText:n.z.string().min(1).max(25)}),X=n.z.object({genericOffer:l(p),indicativeOffer:l(S),consentModal:l(x),completeApplication:l(b),completeKyc:l(v),signContract:l(T),selectOffer:l(z),provideAdditionalInfo:l(w),partnerTemplate:l(y).optional()}),H=n.z.object({genericOffer:p,indicativeOffer:S,consentModal:x,completeApplication:b,completeKyc:v,signContract:T,selectOffer:z,provideAdditionalInfo:w,partnerTemplate:y.optional()});exports.CohortMap=P;exports.CompleteApplicationSchema=b;exports.CompleteKycSchema=v;exports.ConsentModalSchema=x;exports.CopyBundleSchema=X;exports.CopySchema=H;exports.GenericOfferSchema=p;exports.IndicativeOfferSchema=S;exports.LanguageMap=l;exports.PartnerTemplateSchema=y;exports.ProvideAdditionalInfoSchema=w;exports.SelectOfferSchema=z;exports.SignContractSchema=T;exports.WayflyerDocumentSchema=m;exports.filterCopy=M;exports.loadAndConfigureCopy=F;exports.mustContainPlaceholders=f;
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +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","../../logger/dist/index.es.js","../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 partnerLogoUrl: z.string().trim().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)).length(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 { UiSdkOptions } from '@wf-financing/embedded-types';\n\nimport type { CopyBundle, Copy } from '../schemas';\n\ntype FilterCopy = (copy: CopyBundle, options?: UiSdkOptions) => Copy;\n\nexport const filterCopy: FilterCopy = (copy, options) => {\n const language = options?.language ?? 'en';\n // TODO: Unblock after cohort selection becomes available for SDK users\n // const cohort = options?.cohort ?? 'default';\n const 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","var y = Object.defineProperty;\nvar p = (o, t, e) => t in o ? y(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;\nvar l = (o, t, e) => p(o, typeof t != \"symbol\" ? t + \"\" : t, e);\nconst u = \"https://api.wayflyer.com\", h = \"https://sandbox-api.wayflyer.com\", w = (o) => {\n try {\n return JSON.parse(atob(o.split(\".\")[1]));\n } catch {\n return null;\n }\n}, d = {\n \"Content-Type\": \"application/json\"\n}, g = {\n event: \"/financing/v1/company/event/\",\n error: \"/financing/v1/error/\"\n}, I = \"wf_session_v1\", f = 1800 * 1e3, m = 1440 * 60 * 1e3;\nclass v {\n getSessionId() {\n const t = Date.now();\n let e = this.loadSession();\n return (!e || this.isSessionExpired(e, t)) && (e = this.mintNewSession(t)), e.lastActivity = t, this.saveSession(e), e.sessionId;\n }\n isSessionExpired(t, e) {\n const s = e - t.lastActivity > f, r = e - t.createdAt > m;\n return s || r;\n }\n mintNewSession(t) {\n return {\n sessionId: crypto.randomUUID(),\n createdAt: t,\n lastActivity: t\n };\n }\n loadSession() {\n try {\n const t = sessionStorage.getItem(I);\n return t ? JSON.parse(t) : null;\n } catch {\n return null;\n }\n }\n saveSession(t) {\n try {\n sessionStorage.setItem(I, JSON.stringify(t));\n } catch {\n console.warn(\"Failed to save session context\");\n }\n }\n}\nconst n = class n {\n constructor(t, e) {\n l(this, \"baseUrl\", null);\n l(this, \"sessionManager\");\n this.companyToken = t, this.baseUrl = e ? h : u, this.sessionManager = new v();\n }\n static getGlobalInstance() {\n return window.WayflyerLogger || null;\n }\n static setGlobalInstance(t) {\n window.WayflyerLogger = t;\n }\n static initialize(t, e) {\n n.getGlobalInstance() && console.warn(\"Logger re-initialized\");\n const s = new n(t, e == null ? void 0 : e.isSandbox);\n n.setGlobalInstance(s);\n }\n static getMandatoryProperties(t) {\n const e = w(t), [s, r] = (e == null ? void 0 : e.sub.split(\"|\")) || [], a = e == null ? void 0 : e.user_id;\n return { partnerId: s, companyId: r, userId: a };\n }\n static getInstance() {\n const t = n.getGlobalInstance();\n if (!t)\n throw new Error(\"Logger not initialized. Call initialize() first.\");\n return t;\n }\n static async logEvent(t, e) {\n if (this.isDevEnvironment) return;\n const s = n.getInstance(), r = s.sessionManager.getSessionId(), a = {\n ...d,\n Authorization: `Bearer ${s.companyToken}`,\n \"X-Session-ID\": r\n };\n try {\n const i = {\n ...n.getMandatoryProperties(s.companyToken),\n ...e\n }, c = await fetch(s.baseUrl + g.event, {\n method: \"POST\",\n headers: a,\n body: JSON.stringify({\n timestamp: (/* @__PURE__ */ new Date()).toISOString(),\n event_name: t,\n properties: i\n })\n });\n if (c.status === 200)\n return await c.json();\n } catch (i) {\n console.error(\"Failed to log event\", i);\n }\n }\n static async logError(t, e) {\n if (this.isDevEnvironment) {\n console.error(t);\n return;\n }\n const s = n.getInstance(), r = s.sessionManager.getSessionId(), a = {\n ...d,\n \"X-Session-ID\": r\n };\n try {\n const i = {\n ...n.getMandatoryProperties(s.companyToken),\n ...e\n }, c = await fetch(s.baseUrl + g.error, {\n method: \"POST\",\n headers: a,\n body: JSON.stringify({\n timestamp: (/* @__PURE__ */ new Date()).toISOString(),\n message: t,\n properties: i\n })\n });\n if (c.status === 200)\n return await c.json();\n } catch (i) {\n console.warn(\"Failed to log error\", i);\n }\n }\n};\nl(n, \"isDevEnvironment\", !1);\nlet S = n;\nexport {\n S as Logger\n};\n","export const PARTNER_ASSETS_BASE_URL =\n import.meta.env?.VITE_PARTNER_ASSETS_BASE_URL ?? process.env.VITE_PARTNER_ASSETS_BASE_URL;\nexport const SANDBOX_PARTNER_ASSETS_BASE_URL =\n import.meta.env?.VITE_SANDBOX_PARTNER_ASSETS_BASE_URL ?? process.env.VITE_SANDBOX_PARTNER_ASSETS_BASE_URL;\n","import { UiSdkOptions } from '@wf-financing/embedded-types';\nimport { Logger } from '@wf-financing/logger';\n\nimport { PARTNER_ASSETS_BASE_URL, SANDBOX_PARTNER_ASSETS_BASE_URL } from '../config';\nimport type { Copy } from '../schemas';\nimport { filterCopy } from './filterCopy';\n\ntype LoadCopyParams = {\n partnerId: string;\n companyId?: string;\n version?: string;\n options?: UiSdkOptions;\n};\ntype LoadCopy = (params: LoadCopyParams) => Promise<Copy>;\n\nclass HttpError extends Error {\n status: number;\n statusText: string;\n url: string;\n\n constructor(response: Response, url: string) {\n super(`Request to ${url} failed with status ${response.status} ${response.statusText}`);\n\n this.name = 'HttpError';\n this.status = response.status;\n this.statusText = response.statusText;\n this.url = url;\n }\n}\n\nexport const loadAndConfigureCopy: LoadCopy = async (params) => {\n const partnerId = params.partnerId;\n const version = params?.version;\n const options = params?.options;\n const isSandbox = options?.isSandbox;\n const baseUrl = isSandbox ? SANDBOX_PARTNER_ASSETS_BASE_URL : PARTNER_ASSETS_BASE_URL;\n\n const requestUrl = `${baseUrl}/${partnerId}/copy/${version}/copy.json`;\n\n try {\n const documentResponse = await fetch(requestUrl);\n\n if (!documentResponse.ok) {\n throw new HttpError(documentResponse, requestUrl);\n }\n\n const document = await documentResponse.json();\n\n return filterCopy(document, options);\n } catch (error) {\n const userAgent = navigator.userAgent;\n\n Logger.logError(`Error in partner copy loading from ${requestUrl} by userAgent: ${userAgent}: ${error}`);\n throw error;\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']), {\n message: 'mainText must include {amount}',\n }),\n bulletPoints: z.array(z.string().min(1)).length(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 logoUrl: z.string().trim().url(),\n title: z.string().trim().min(1),\n bulletPoints: z.array(z.string().min(1)).length(3),\n button: z.string().trim().min(1),\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']), {\n message: 'mainText must include {amount}',\n }),\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","y","p","o","l","u","h","w","d","g","I","f","m","v","s","r","n","a","c","S","PARTNER_ASSETS_BASE_URL","SANDBOX_PARTNER_ASSETS_BASE_URL","HttpError","response","url","__publicField","loadAndConfigureCopy","params","partnerId","version","requestUrl","documentResponse","error","userAgent","Logger","IndicativeOfferSchema","ConsentModalSchema","CompleteApplicationSchema","SelectOfferSchema","CompleteKycSchema","SignContractSchema","ProvideAdditionalInfoSchema","CopyBundleSchema","CopySchema"],"mappings":"2QAEaA,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,eAAgBC,EAAAA,EAAE,SAAS,KAAA,EAAO,IAAA,CACpC,CAAC,ECFYE,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,OAAO,CAAC,EACjD,WAAYA,EAAAA,EAAE,OAAA,EAAS,IAAI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src/schemas/wayflyerDocument.ts","../src/schemas/partnerTemplate.ts","../src/schemas/genericOffer.ts","../src/utils/validators.ts","../src/utils/normalizers.ts","../src/utils/filterCopy.ts","../../logger/dist/index.es.js","../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 type: 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 partnerLogoUrl: z.string().trim().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)).length(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 { UiSdkOptions } from '@wf-financing/embedded-types';\n\nimport type { CopyBundle, Copy } from '../schemas';\n\ntype FilterCopy = (copy: CopyBundle, options?: UiSdkOptions) => Copy;\n\nexport const filterCopy: FilterCopy = (copy, options) => {\n const language = options?.language ?? 'en';\n // TODO: Unblock after cohort selection becomes available for SDK users\n // const cohort = options?.cohort ?? 'default';\n const 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","var I = Object.defineProperty;\nvar p = (o, t, e) => t in o ? I(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;\nvar l = (o, t, e) => p(o, typeof t != \"symbol\" ? t + \"\" : t, e);\nconst u = \"https://api.wayflyer.com\", h = \"https://sandbox-api.wayflyer.com\", w = (o) => {\n try {\n return JSON.parse(atob(o.split(\".\")[1]));\n } catch {\n return null;\n }\n}, d = {\n \"Content-Type\": \"application/json\"\n}, g = {\n event: \"/financing/v1/company/event/\",\n error: \"/financing/v1/error/\"\n}, S = \"wf_session_v1\", f = 1800 * 1e3, m = 1440 * 60 * 1e3;\nclass v {\n getSessionId() {\n const t = Date.now();\n let e = this.loadSession();\n return (!e || this.isSessionExpired(e, t)) && (e = this.mintNewSession(t)), e.lastActivity = t, this.saveSession(e), e.sessionId;\n }\n isSessionExpired(t, e) {\n const s = e - t.lastActivity > f, i = e - t.createdAt > m;\n return s || i;\n }\n mintNewSession(t) {\n return {\n sessionId: crypto.randomUUID(),\n createdAt: t,\n lastActivity: t\n };\n }\n loadSession() {\n try {\n const t = sessionStorage.getItem(S);\n return t ? JSON.parse(t) : null;\n } catch {\n return null;\n }\n }\n saveSession(t) {\n try {\n sessionStorage.setItem(S, JSON.stringify(t));\n } catch {\n console.warn(\"Failed to save session context\");\n }\n }\n}\nconst n = class n {\n constructor(t, e) {\n l(this, \"baseUrl\", null);\n l(this, \"sessionManager\");\n this.companyToken = t, this.baseUrl = e ? h : u, this.sessionManager = new v();\n }\n static getGlobalInstance() {\n return window.WayflyerLogger || null;\n }\n static setGlobalInstance(t) {\n window.WayflyerLogger = t;\n }\n static initialize(t, e) {\n n.getGlobalInstance() && console.warn(\"Logger re-initialized\");\n const s = new n(t, e == null ? void 0 : e.isSandbox);\n n.setGlobalInstance(s);\n }\n static getMandatoryProperties(t) {\n const e = w(t), [s, i] = (e == null ? void 0 : e.sub.split(\"|\")) || [], a = e == null ? void 0 : e.user_id;\n return { partner_id: s, company_id: i, user_id: a };\n }\n static getInstance() {\n const t = n.getGlobalInstance();\n if (!t)\n throw new Error(\"Logger not initialized. Call initialize() first.\");\n return t;\n }\n static async logEvent(t, e) {\n if (this.isDevEnvironment) return;\n const s = n.getInstance(), i = s.sessionManager.getSessionId(), a = {\n ...d,\n Authorization: `Bearer ${s.companyToken}`,\n \"X-Session-ID\": i\n };\n try {\n const r = {\n ...n.getMandatoryProperties(s.companyToken),\n ...e\n }, c = await fetch(s.baseUrl + g.event, {\n method: \"POST\",\n headers: a,\n body: JSON.stringify({\n timestamp: (/* @__PURE__ */ new Date()).toISOString(),\n event_name: t,\n properties: r\n })\n });\n if (c.status === 200)\n return await c.json();\n } catch (r) {\n console.error(\"Failed to log event\", r);\n }\n }\n static async logError(t, e) {\n if (this.isDevEnvironment) {\n console.error(t);\n return;\n }\n const s = n.getInstance(), i = s.sessionManager.getSessionId(), a = {\n ...d,\n \"X-Session-ID\": i\n };\n try {\n const r = {\n ...n.getMandatoryProperties(s.companyToken),\n ...e\n }, c = await fetch(s.baseUrl + g.error, {\n method: \"POST\",\n headers: a,\n body: JSON.stringify({\n timestamp: (/* @__PURE__ */ new Date()).toISOString(),\n message: t,\n properties: r\n })\n });\n if (c.status === 200)\n return await c.json();\n } catch (r) {\n console.warn(\"Failed to log error\", r);\n }\n }\n};\nl(n, \"isDevEnvironment\", !1);\nlet y = n;\nexport {\n y as Logger\n};\n","export const PARTNER_ASSETS_BASE_URL =\n import.meta.env?.VITE_PARTNER_ASSETS_BASE_URL ?? process.env.VITE_PARTNER_ASSETS_BASE_URL;\nexport const SANDBOX_PARTNER_ASSETS_BASE_URL =\n import.meta.env?.VITE_SANDBOX_PARTNER_ASSETS_BASE_URL ?? process.env.VITE_SANDBOX_PARTNER_ASSETS_BASE_URL;\n","import { UiSdkOptions } from '@wf-financing/embedded-types';\nimport { Logger } from '@wf-financing/logger';\n\nimport { PARTNER_ASSETS_BASE_URL, SANDBOX_PARTNER_ASSETS_BASE_URL } from '../config';\nimport type { Copy } from '../schemas';\nimport { filterCopy } from './filterCopy';\n\ntype LoadCopyParams = {\n partnerId: string;\n companyId?: string;\n version?: string;\n options?: UiSdkOptions;\n};\ntype LoadCopy = (params: LoadCopyParams) => Promise<Copy>;\n\nclass HttpError extends Error {\n status: number;\n statusText: string;\n url: string;\n\n constructor(response: Response, url: string) {\n super(`Request to ${url} failed with status ${response.status} ${response.statusText}`);\n\n this.name = 'HttpError';\n this.status = response.status;\n this.statusText = response.statusText;\n this.url = url;\n }\n}\n\nexport const loadAndConfigureCopy: LoadCopy = async (params) => {\n const partnerId = params.partnerId;\n const version = params?.version;\n const options = params?.options;\n const isSandbox = options?.isSandbox;\n const baseUrl = isSandbox ? SANDBOX_PARTNER_ASSETS_BASE_URL : PARTNER_ASSETS_BASE_URL;\n\n const requestUrl = `${baseUrl}/${partnerId}/copy/${version}/copy.json`;\n\n try {\n const documentResponse = await fetch(requestUrl);\n\n if (!documentResponse.ok) {\n throw new HttpError(documentResponse, requestUrl);\n }\n\n const document = await documentResponse.json();\n\n return filterCopy(document, options);\n } catch (error) {\n const userAgent = navigator.userAgent;\n\n Logger.logError(`Error in partner copy loading from ${requestUrl} by userAgent: ${userAgent}: ${error}`);\n throw error;\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']), {\n message: 'mainText must include {amount}',\n }),\n bulletPoints: z.array(z.string().min(1)).length(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 logoUrl: z.string().trim().url(),\n title: z.string().trim().min(1),\n bulletPoints: z.array(z.string().min(1)).length(3),\n button: z.string().trim().min(1),\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']), {\n message: 'mainText must include {amount}',\n }),\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","I","p","o","l","u","h","w","d","g","S","f","m","v","s","i","n","a","r","c","y","PARTNER_ASSETS_BASE_URL","SANDBOX_PARTNER_ASSETS_BASE_URL","HttpError","response","url","__publicField","loadAndConfigureCopy","params","partnerId","version","requestUrl","documentResponse","error","userAgent","Logger","IndicativeOfferSchema","ConsentModalSchema","CompleteApplicationSchema","SelectOfferSchema","CompleteKycSchema","SignContractSchema","ProvideAdditionalInfoSchema","CopyBundleSchema","CopySchema"],"mappings":"2QAEaA,EAAyBC,EAAAA,EAAE,OAAO,CAC7C,QAASA,EAAAA,EAAE,SAAS,IAAI,CAAC,EACzB,SAAUA,EAAAA,EAAE,SAAS,IAAI,CAAC,EAC1B,OAAQA,EAAAA,EAAE,SAAS,IAAI,CAAC,EACxB,KAAMA,EAAAA,EAAE,OAAA,EAAS,IAAI,CAAC,CACxB,CAAC,ECHYC,EAAwBF,EAAuB,OAAO,CACjE,eAAgBC,EAAAA,EAAE,SAAS,KAAA,EAAO,IAAA,CACpC,CAAC,ECFYE,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,OAAO,CAAC,EACjD,WAAYA,EAAAA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,CACtC,CAAC,ECRYG,EAA2BC,GAC9BC,GAAkBD,EAAa,MAAOE,GAAgBD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,EAAE,IAAI,EAAE,CACtC,CAAC,ECXY6D,EAAoB9D,EAAuB,OAAO,CAC7D,SAAUC,EAAAA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,GAAG,EACnC,WAAYA,EAAAA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE,CACtC,CAAC,ECHY8D,EAAqB/D,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,ECHY+D,EAA8BhE,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,ECMYgE,EAAmBhE,EAAAA,EAAE,OAAO,CACvC,aAAcS,EAAYP,CAAkB,EAC5C,gBAAiBO,EAAYgD,CAAqB,EAClD,aAAchD,EAAYiD,CAAkB,EAC5C,oBAAqBjD,EAAYkD,CAAyB,EAC1D,YAAalD,EAAYoD,CAAiB,EAC1C,aAAcpD,EAAYqD,CAAkB,EAC5C,YAAarD,EAAYmD,CAAiB,EAC1C,sBAAuBnD,EAAYsD,CAA2B,EAC9D,gBAAiBtD,EAAYR,CAAqB,EAAE,SAAA,CACtD,CAAC,EACYgE,EAAajE,EAAAA,EAAE,OAAO,CACjC,aAAcE,EACd,gBAAiBuD,EACjB,aAAcC,EACd,oBAAqBC,EACrB,YAAaE,EACb,aAAcC,EACd,YAAaF,EACb,sBAAuBG,EACvB,gBAAiB9D,EAAsB,SAAA,CACzC,CAAC"}
|
package/dist/index.es.js
CHANGED
|
@@ -5,7 +5,8 @@ import { z as n } from "zod";
|
|
|
5
5
|
const d = n.object({
|
|
6
6
|
version: n.string().min(1),
|
|
7
7
|
language: n.string().min(2),
|
|
8
|
-
cohort: n.string().min(1)
|
|
8
|
+
cohort: n.string().min(1),
|
|
9
|
+
type: n.string().min(1)
|
|
9
10
|
}), v = d.extend({
|
|
10
11
|
partnerLogoUrl: n.string().trim().url()
|
|
11
12
|
}), w = d.extend({
|
|
@@ -41,15 +42,15 @@ const L = "https://api.wayflyer.com", R = "https://sandbox-api.wayflyer.com", G
|
|
|
41
42
|
}, S = {
|
|
42
43
|
event: "/financing/v1/company/event/",
|
|
43
44
|
error: "/financing/v1/error/"
|
|
44
|
-
}, b = "wf_session_v1",
|
|
45
|
-
class
|
|
45
|
+
}, b = "wf_session_v1", _ = 1800 * 1e3, k = 1440 * 60 * 1e3;
|
|
46
|
+
class B {
|
|
46
47
|
getSessionId() {
|
|
47
48
|
const t = Date.now();
|
|
48
49
|
let e = this.loadSession();
|
|
49
50
|
return (!e || this.isSessionExpired(e, t)) && (e = this.mintNewSession(t)), e.lastActivity = t, this.saveSession(e), e.sessionId;
|
|
50
51
|
}
|
|
51
52
|
isSessionExpired(t, e) {
|
|
52
|
-
const r = e - t.lastActivity >
|
|
53
|
+
const r = e - t.lastActivity > _, a = e - t.createdAt > k;
|
|
53
54
|
return r || a;
|
|
54
55
|
}
|
|
55
56
|
mintNewSession(t) {
|
|
@@ -77,7 +78,7 @@ class J {
|
|
|
77
78
|
}
|
|
78
79
|
const T = class m {
|
|
79
80
|
constructor(t, e) {
|
|
80
|
-
f(this, "baseUrl", null), f(this, "sessionManager"), this.companyToken = t, this.baseUrl = e ? R : L, this.sessionManager = new
|
|
81
|
+
f(this, "baseUrl", null), f(this, "sessionManager"), this.companyToken = t, this.baseUrl = e ? R : L, this.sessionManager = new B();
|
|
81
82
|
}
|
|
82
83
|
static getGlobalInstance() {
|
|
83
84
|
return window.WayflyerLogger || null;
|
|
@@ -92,7 +93,7 @@ const T = class m {
|
|
|
92
93
|
}
|
|
93
94
|
static getMandatoryProperties(t) {
|
|
94
95
|
const e = G(t), [r, a] = (e == null ? void 0 : e.sub.split("|")) || [], c = e == null ? void 0 : e.user_id;
|
|
95
|
-
return {
|
|
96
|
+
return { partner_id: r, company_id: a, user_id: c };
|
|
96
97
|
}
|
|
97
98
|
static getInstance() {
|
|
98
99
|
const t = m.getGlobalInstance();
|
|
@@ -156,9 +157,9 @@ const T = class m {
|
|
|
156
157
|
}
|
|
157
158
|
};
|
|
158
159
|
f(T, "isDevEnvironment", !1);
|
|
159
|
-
let
|
|
160
|
-
const
|
|
161
|
-
class
|
|
160
|
+
let J = T;
|
|
161
|
+
const K = "https://partner-assets.wayflyer.com", q = "https://partner-assets-sandbox.wayflyer.com";
|
|
162
|
+
class F extends Error {
|
|
162
163
|
constructor(e, r) {
|
|
163
164
|
super(`Request to ${r} failed with status ${e.status} ${e.statusText}`);
|
|
164
165
|
g(this, "status");
|
|
@@ -168,16 +169,16 @@ class W extends Error {
|
|
|
168
169
|
}
|
|
169
170
|
}
|
|
170
171
|
const H = async (s) => {
|
|
171
|
-
const t = s.partnerId, e = s == null ? void 0 : s.version, r = s == null ? void 0 : s.options, i = `${(r == null ? void 0 : r.isSandbox) ?
|
|
172
|
+
const t = s.partnerId, e = s == null ? void 0 : s.version, r = s == null ? void 0 : s.options, i = `${(r == null ? void 0 : r.isSandbox) ? q : K}/${t}/copy/${e}/copy.json`;
|
|
172
173
|
try {
|
|
173
174
|
const o = await fetch(i);
|
|
174
175
|
if (!o.ok)
|
|
175
|
-
throw new
|
|
176
|
+
throw new F(o, i);
|
|
176
177
|
const u = await o.json();
|
|
177
178
|
return j(u, r);
|
|
178
179
|
} catch (o) {
|
|
179
180
|
const u = navigator.userAgent;
|
|
180
|
-
throw
|
|
181
|
+
throw J.logError(`Error in partner copy loading from ${i} by userAgent: ${u}: ${o}`), o;
|
|
181
182
|
}
|
|
182
183
|
}, I = d.extend({
|
|
183
184
|
mainText: n.string().trim().min(1).max(160).refine(y(["amount"]), {
|
package/dist/index.es.js.map
CHANGED
|
@@ -1 +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","../../logger/dist/index.es.js","../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 partnerLogoUrl: z.string().trim().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)).length(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 { UiSdkOptions } from '@wf-financing/embedded-types';\n\nimport type { CopyBundle, Copy } from '../schemas';\n\ntype FilterCopy = (copy: CopyBundle, options?: UiSdkOptions) => Copy;\n\nexport const filterCopy: FilterCopy = (copy, options) => {\n const language = options?.language ?? 'en';\n // TODO: Unblock after cohort selection becomes available for SDK users\n // const cohort = options?.cohort ?? 'default';\n const 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","var y = Object.defineProperty;\nvar p = (o, t, e) => t in o ? y(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;\nvar l = (o, t, e) => p(o, typeof t != \"symbol\" ? t + \"\" : t, e);\nconst u = \"https://api.wayflyer.com\", h = \"https://sandbox-api.wayflyer.com\", w = (o) => {\n try {\n return JSON.parse(atob(o.split(\".\")[1]));\n } catch {\n return null;\n }\n}, d = {\n \"Content-Type\": \"application/json\"\n}, g = {\n event: \"/financing/v1/company/event/\",\n error: \"/financing/v1/error/\"\n}, I = \"wf_session_v1\", f = 1800 * 1e3, m = 1440 * 60 * 1e3;\nclass v {\n getSessionId() {\n const t = Date.now();\n let e = this.loadSession();\n return (!e || this.isSessionExpired(e, t)) && (e = this.mintNewSession(t)), e.lastActivity = t, this.saveSession(e), e.sessionId;\n }\n isSessionExpired(t, e) {\n const s = e - t.lastActivity > f, r = e - t.createdAt > m;\n return s || r;\n }\n mintNewSession(t) {\n return {\n sessionId: crypto.randomUUID(),\n createdAt: t,\n lastActivity: t\n };\n }\n loadSession() {\n try {\n const t = sessionStorage.getItem(I);\n return t ? JSON.parse(t) : null;\n } catch {\n return null;\n }\n }\n saveSession(t) {\n try {\n sessionStorage.setItem(I, JSON.stringify(t));\n } catch {\n console.warn(\"Failed to save session context\");\n }\n }\n}\nconst n = class n {\n constructor(t, e) {\n l(this, \"baseUrl\", null);\n l(this, \"sessionManager\");\n this.companyToken = t, this.baseUrl = e ? h : u, this.sessionManager = new v();\n }\n static getGlobalInstance() {\n return window.WayflyerLogger || null;\n }\n static setGlobalInstance(t) {\n window.WayflyerLogger = t;\n }\n static initialize(t, e) {\n n.getGlobalInstance() && console.warn(\"Logger re-initialized\");\n const s = new n(t, e == null ? void 0 : e.isSandbox);\n n.setGlobalInstance(s);\n }\n static getMandatoryProperties(t) {\n const e = w(t), [s, r] = (e == null ? void 0 : e.sub.split(\"|\")) || [], a = e == null ? void 0 : e.user_id;\n return { partnerId: s, companyId: r, userId: a };\n }\n static getInstance() {\n const t = n.getGlobalInstance();\n if (!t)\n throw new Error(\"Logger not initialized. Call initialize() first.\");\n return t;\n }\n static async logEvent(t, e) {\n if (this.isDevEnvironment) return;\n const s = n.getInstance(), r = s.sessionManager.getSessionId(), a = {\n ...d,\n Authorization: `Bearer ${s.companyToken}`,\n \"X-Session-ID\": r\n };\n try {\n const i = {\n ...n.getMandatoryProperties(s.companyToken),\n ...e\n }, c = await fetch(s.baseUrl + g.event, {\n method: \"POST\",\n headers: a,\n body: JSON.stringify({\n timestamp: (/* @__PURE__ */ new Date()).toISOString(),\n event_name: t,\n properties: i\n })\n });\n if (c.status === 200)\n return await c.json();\n } catch (i) {\n console.error(\"Failed to log event\", i);\n }\n }\n static async logError(t, e) {\n if (this.isDevEnvironment) {\n console.error(t);\n return;\n }\n const s = n.getInstance(), r = s.sessionManager.getSessionId(), a = {\n ...d,\n \"X-Session-ID\": r\n };\n try {\n const i = {\n ...n.getMandatoryProperties(s.companyToken),\n ...e\n }, c = await fetch(s.baseUrl + g.error, {\n method: \"POST\",\n headers: a,\n body: JSON.stringify({\n timestamp: (/* @__PURE__ */ new Date()).toISOString(),\n message: t,\n properties: i\n })\n });\n if (c.status === 200)\n return await c.json();\n } catch (i) {\n console.warn(\"Failed to log error\", i);\n }\n }\n};\nl(n, \"isDevEnvironment\", !1);\nlet S = n;\nexport {\n S as Logger\n};\n","export const PARTNER_ASSETS_BASE_URL =\n import.meta.env?.VITE_PARTNER_ASSETS_BASE_URL ?? process.env.VITE_PARTNER_ASSETS_BASE_URL;\nexport const SANDBOX_PARTNER_ASSETS_BASE_URL =\n import.meta.env?.VITE_SANDBOX_PARTNER_ASSETS_BASE_URL ?? process.env.VITE_SANDBOX_PARTNER_ASSETS_BASE_URL;\n","import { UiSdkOptions } from '@wf-financing/embedded-types';\nimport { Logger } from '@wf-financing/logger';\n\nimport { PARTNER_ASSETS_BASE_URL, SANDBOX_PARTNER_ASSETS_BASE_URL } from '../config';\nimport type { Copy } from '../schemas';\nimport { filterCopy } from './filterCopy';\n\ntype LoadCopyParams = {\n partnerId: string;\n companyId?: string;\n version?: string;\n options?: UiSdkOptions;\n};\ntype LoadCopy = (params: LoadCopyParams) => Promise<Copy>;\n\nclass HttpError extends Error {\n status: number;\n statusText: string;\n url: string;\n\n constructor(response: Response, url: string) {\n super(`Request to ${url} failed with status ${response.status} ${response.statusText}`);\n\n this.name = 'HttpError';\n this.status = response.status;\n this.statusText = response.statusText;\n this.url = url;\n }\n}\n\nexport const loadAndConfigureCopy: LoadCopy = async (params) => {\n const partnerId = params.partnerId;\n const version = params?.version;\n const options = params?.options;\n const isSandbox = options?.isSandbox;\n const baseUrl = isSandbox ? SANDBOX_PARTNER_ASSETS_BASE_URL : PARTNER_ASSETS_BASE_URL;\n\n const requestUrl = `${baseUrl}/${partnerId}/copy/${version}/copy.json`;\n\n try {\n const documentResponse = await fetch(requestUrl);\n\n if (!documentResponse.ok) {\n throw new HttpError(documentResponse, requestUrl);\n }\n\n const document = await documentResponse.json();\n\n return filterCopy(document, options);\n } catch (error) {\n const userAgent = navigator.userAgent;\n\n Logger.logError(`Error in partner copy loading from ${requestUrl} by userAgent: ${userAgent}: ${error}`);\n throw error;\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']), {\n message: 'mainText must include {amount}',\n }),\n bulletPoints: z.array(z.string().min(1)).length(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 logoUrl: z.string().trim().url(),\n title: z.string().trim().min(1),\n bulletPoints: z.array(z.string().min(1)).length(3),\n button: z.string().trim().min(1),\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']), {\n message: 'mainText must include {amount}',\n }),\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","y","p","o","l","u","h","w","d","g","I","f","m","v","s","r","n","a","c","S","PARTNER_ASSETS_BASE_URL","SANDBOX_PARTNER_ASSETS_BASE_URL","HttpError","response","url","__publicField","loadAndConfigureCopy","params","partnerId","version","requestUrl","documentResponse","error","userAgent","Logger","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,gBAAgBC,EAAE,SAAS,KAAA,EAAO,IAAA;AACpC,CAAC,GCFYE,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,OAAO,CAAC;AAAA,EACjD,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,GC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,qBAAqBhD,EAAYiD,CAAyB;AAAA,EAC1D,aAAajD,EAAYmD,CAAiB;AAAA,EAC1C,cAAcnD,EAAYoD,CAAkB;AAAA,EAC5C,aAAapD,EAAYkD,CAAiB;AAAA,EAC1C,uBAAuBlD,EAAYqD,CAA2B;AAAA,EAC9D,iBAAiBrD,EAAYR,CAAqB,EAAE,SAAA;AACtD,CAAC,GACY+D,IAAahE,EAAE,OAAO;AAAA,EACjC,cAAcE;AAAA,EACd,iBAAiBsD;AAAA,EACjB,cAAcC;AAAA,EACd,qBAAqBC;AAAA,EACrB,aAAaE;AAAA,EACb,cAAcC;AAAA,EACd,aAAaF;AAAA,EACb,uBAAuBG;AAAA,EACvB,iBAAiB7D,EAAsB,SAAA;AACzC,CAAC;"}
|
|
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","../../logger/dist/index.es.js","../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 type: 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 partnerLogoUrl: z.string().trim().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)).length(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 { UiSdkOptions } from '@wf-financing/embedded-types';\n\nimport type { CopyBundle, Copy } from '../schemas';\n\ntype FilterCopy = (copy: CopyBundle, options?: UiSdkOptions) => Copy;\n\nexport const filterCopy: FilterCopy = (copy, options) => {\n const language = options?.language ?? 'en';\n // TODO: Unblock after cohort selection becomes available for SDK users\n // const cohort = options?.cohort ?? 'default';\n const 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","var I = Object.defineProperty;\nvar p = (o, t, e) => t in o ? I(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;\nvar l = (o, t, e) => p(o, typeof t != \"symbol\" ? t + \"\" : t, e);\nconst u = \"https://api.wayflyer.com\", h = \"https://sandbox-api.wayflyer.com\", w = (o) => {\n try {\n return JSON.parse(atob(o.split(\".\")[1]));\n } catch {\n return null;\n }\n}, d = {\n \"Content-Type\": \"application/json\"\n}, g = {\n event: \"/financing/v1/company/event/\",\n error: \"/financing/v1/error/\"\n}, S = \"wf_session_v1\", f = 1800 * 1e3, m = 1440 * 60 * 1e3;\nclass v {\n getSessionId() {\n const t = Date.now();\n let e = this.loadSession();\n return (!e || this.isSessionExpired(e, t)) && (e = this.mintNewSession(t)), e.lastActivity = t, this.saveSession(e), e.sessionId;\n }\n isSessionExpired(t, e) {\n const s = e - t.lastActivity > f, i = e - t.createdAt > m;\n return s || i;\n }\n mintNewSession(t) {\n return {\n sessionId: crypto.randomUUID(),\n createdAt: t,\n lastActivity: t\n };\n }\n loadSession() {\n try {\n const t = sessionStorage.getItem(S);\n return t ? JSON.parse(t) : null;\n } catch {\n return null;\n }\n }\n saveSession(t) {\n try {\n sessionStorage.setItem(S, JSON.stringify(t));\n } catch {\n console.warn(\"Failed to save session context\");\n }\n }\n}\nconst n = class n {\n constructor(t, e) {\n l(this, \"baseUrl\", null);\n l(this, \"sessionManager\");\n this.companyToken = t, this.baseUrl = e ? h : u, this.sessionManager = new v();\n }\n static getGlobalInstance() {\n return window.WayflyerLogger || null;\n }\n static setGlobalInstance(t) {\n window.WayflyerLogger = t;\n }\n static initialize(t, e) {\n n.getGlobalInstance() && console.warn(\"Logger re-initialized\");\n const s = new n(t, e == null ? void 0 : e.isSandbox);\n n.setGlobalInstance(s);\n }\n static getMandatoryProperties(t) {\n const e = w(t), [s, i] = (e == null ? void 0 : e.sub.split(\"|\")) || [], a = e == null ? void 0 : e.user_id;\n return { partner_id: s, company_id: i, user_id: a };\n }\n static getInstance() {\n const t = n.getGlobalInstance();\n if (!t)\n throw new Error(\"Logger not initialized. Call initialize() first.\");\n return t;\n }\n static async logEvent(t, e) {\n if (this.isDevEnvironment) return;\n const s = n.getInstance(), i = s.sessionManager.getSessionId(), a = {\n ...d,\n Authorization: `Bearer ${s.companyToken}`,\n \"X-Session-ID\": i\n };\n try {\n const r = {\n ...n.getMandatoryProperties(s.companyToken),\n ...e\n }, c = await fetch(s.baseUrl + g.event, {\n method: \"POST\",\n headers: a,\n body: JSON.stringify({\n timestamp: (/* @__PURE__ */ new Date()).toISOString(),\n event_name: t,\n properties: r\n })\n });\n if (c.status === 200)\n return await c.json();\n } catch (r) {\n console.error(\"Failed to log event\", r);\n }\n }\n static async logError(t, e) {\n if (this.isDevEnvironment) {\n console.error(t);\n return;\n }\n const s = n.getInstance(), i = s.sessionManager.getSessionId(), a = {\n ...d,\n \"X-Session-ID\": i\n };\n try {\n const r = {\n ...n.getMandatoryProperties(s.companyToken),\n ...e\n }, c = await fetch(s.baseUrl + g.error, {\n method: \"POST\",\n headers: a,\n body: JSON.stringify({\n timestamp: (/* @__PURE__ */ new Date()).toISOString(),\n message: t,\n properties: r\n })\n });\n if (c.status === 200)\n return await c.json();\n } catch (r) {\n console.warn(\"Failed to log error\", r);\n }\n }\n};\nl(n, \"isDevEnvironment\", !1);\nlet y = n;\nexport {\n y as Logger\n};\n","export const PARTNER_ASSETS_BASE_URL =\n import.meta.env?.VITE_PARTNER_ASSETS_BASE_URL ?? process.env.VITE_PARTNER_ASSETS_BASE_URL;\nexport const SANDBOX_PARTNER_ASSETS_BASE_URL =\n import.meta.env?.VITE_SANDBOX_PARTNER_ASSETS_BASE_URL ?? process.env.VITE_SANDBOX_PARTNER_ASSETS_BASE_URL;\n","import { UiSdkOptions } from '@wf-financing/embedded-types';\nimport { Logger } from '@wf-financing/logger';\n\nimport { PARTNER_ASSETS_BASE_URL, SANDBOX_PARTNER_ASSETS_BASE_URL } from '../config';\nimport type { Copy } from '../schemas';\nimport { filterCopy } from './filterCopy';\n\ntype LoadCopyParams = {\n partnerId: string;\n companyId?: string;\n version?: string;\n options?: UiSdkOptions;\n};\ntype LoadCopy = (params: LoadCopyParams) => Promise<Copy>;\n\nclass HttpError extends Error {\n status: number;\n statusText: string;\n url: string;\n\n constructor(response: Response, url: string) {\n super(`Request to ${url} failed with status ${response.status} ${response.statusText}`);\n\n this.name = 'HttpError';\n this.status = response.status;\n this.statusText = response.statusText;\n this.url = url;\n }\n}\n\nexport const loadAndConfigureCopy: LoadCopy = async (params) => {\n const partnerId = params.partnerId;\n const version = params?.version;\n const options = params?.options;\n const isSandbox = options?.isSandbox;\n const baseUrl = isSandbox ? SANDBOX_PARTNER_ASSETS_BASE_URL : PARTNER_ASSETS_BASE_URL;\n\n const requestUrl = `${baseUrl}/${partnerId}/copy/${version}/copy.json`;\n\n try {\n const documentResponse = await fetch(requestUrl);\n\n if (!documentResponse.ok) {\n throw new HttpError(documentResponse, requestUrl);\n }\n\n const document = await documentResponse.json();\n\n return filterCopy(document, options);\n } catch (error) {\n const userAgent = navigator.userAgent;\n\n Logger.logError(`Error in partner copy loading from ${requestUrl} by userAgent: ${userAgent}: ${error}`);\n throw error;\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']), {\n message: 'mainText must include {amount}',\n }),\n bulletPoints: z.array(z.string().min(1)).length(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 logoUrl: z.string().trim().url(),\n title: z.string().trim().min(1),\n bulletPoints: z.array(z.string().min(1)).length(3),\n button: z.string().trim().min(1),\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']), {\n message: 'mainText must include {amount}',\n }),\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","I","p","o","l","u","h","w","d","g","S","f","m","v","s","i","n","a","r","c","y","PARTNER_ASSETS_BASE_URL","SANDBOX_PARTNER_ASSETS_BASE_URL","HttpError","response","url","__publicField","loadAndConfigureCopy","params","partnerId","version","requestUrl","documentResponse","error","userAgent","Logger","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,QAAQ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AAS,IAAI,CAAC,EAAE,IAAI,EAAE;AACtC,CAAC,GCHY8D,IAAqB/D,EAAuB,OAAO;AAAA,EAC9D,UAAUC,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EACnC,YAAYA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE;AACtC,CAAC,GCHY+D,IAA8BhE,EAAuB,OAAO;AAAA,EACvE,UAAUC,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EACnC,YAAYA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,IAAI,EAAE;AACtC,CAAC,GCMYgE,IAAmBhE,EAAE,OAAO;AAAA,EACvC,cAAcS,EAAYP,CAAkB;AAAA,EAC5C,iBAAiBO,EAAYgD,CAAqB;AAAA,EAClD,cAAchD,EAAYiD,CAAkB;AAAA,EAC5C,qBAAqBjD,EAAYkD,CAAyB;AAAA,EAC1D,aAAalD,EAAYoD,CAAiB;AAAA,EAC1C,cAAcpD,EAAYqD,CAAkB;AAAA,EAC5C,aAAarD,EAAYmD,CAAiB;AAAA,EAC1C,uBAAuBnD,EAAYsD,CAA2B;AAAA,EAC9D,iBAAiBtD,EAAYR,CAAqB,EAAE,SAAA;AACtD,CAAC,GACYgE,IAAajE,EAAE,OAAO;AAAA,EACjC,cAAcE;AAAA,EACd,iBAAiBuD;AAAA,EACjB,cAAcC;AAAA,EACd,qBAAqBC;AAAA,EACrB,aAAaE;AAAA,EACb,cAAcC;AAAA,EACd,aAAaF;AAAA,EACb,uBAAuBG;AAAA,EACvB,iBAAiB9D,EAAsB,SAAA;AACzC,CAAC;"}
|
|
@@ -4,6 +4,7 @@ export declare const CompleteApplicationSchema: z.ZodObject<{
|
|
|
4
4
|
version: z.ZodString;
|
|
5
5
|
language: z.ZodString;
|
|
6
6
|
cohort: z.ZodString;
|
|
7
|
+
type: z.ZodString;
|
|
7
8
|
} & {
|
|
8
9
|
mainText: z.ZodString;
|
|
9
10
|
buttonText: z.ZodString;
|
|
@@ -11,12 +12,14 @@ export declare const CompleteApplicationSchema: z.ZodObject<{
|
|
|
11
12
|
version: string;
|
|
12
13
|
language: string;
|
|
13
14
|
cohort: string;
|
|
15
|
+
type: string;
|
|
14
16
|
mainText: string;
|
|
15
17
|
buttonText: string;
|
|
16
18
|
}, {
|
|
17
19
|
version: string;
|
|
18
20
|
language: string;
|
|
19
21
|
cohort: string;
|
|
22
|
+
type: string;
|
|
20
23
|
mainText: string;
|
|
21
24
|
buttonText: string;
|
|
22
25
|
}>;
|
|
@@ -4,6 +4,7 @@ export declare const CompleteKycSchema: z.ZodObject<{
|
|
|
4
4
|
version: z.ZodString;
|
|
5
5
|
language: z.ZodString;
|
|
6
6
|
cohort: z.ZodString;
|
|
7
|
+
type: z.ZodString;
|
|
7
8
|
} & {
|
|
8
9
|
mainText: z.ZodString;
|
|
9
10
|
buttonText: z.ZodString;
|
|
@@ -11,12 +12,14 @@ export declare const CompleteKycSchema: z.ZodObject<{
|
|
|
11
12
|
version: string;
|
|
12
13
|
language: string;
|
|
13
14
|
cohort: string;
|
|
15
|
+
type: string;
|
|
14
16
|
mainText: string;
|
|
15
17
|
buttonText: string;
|
|
16
18
|
}, {
|
|
17
19
|
version: string;
|
|
18
20
|
language: string;
|
|
19
21
|
cohort: string;
|
|
22
|
+
type: string;
|
|
20
23
|
mainText: string;
|
|
21
24
|
buttonText: string;
|
|
22
25
|
}>;
|
|
@@ -4,6 +4,7 @@ export declare const ConsentModalSchema: z.ZodObject<{
|
|
|
4
4
|
version: z.ZodString;
|
|
5
5
|
language: z.ZodString;
|
|
6
6
|
cohort: z.ZodString;
|
|
7
|
+
type: z.ZodString;
|
|
7
8
|
} & {
|
|
8
9
|
logoUrl: z.ZodString;
|
|
9
10
|
title: z.ZodString;
|
|
@@ -14,6 +15,7 @@ export declare const ConsentModalSchema: z.ZodObject<{
|
|
|
14
15
|
version: string;
|
|
15
16
|
language: string;
|
|
16
17
|
cohort: string;
|
|
18
|
+
type: string;
|
|
17
19
|
bulletPoints: string[];
|
|
18
20
|
logoUrl: string;
|
|
19
21
|
title: string;
|
|
@@ -23,6 +25,7 @@ export declare const ConsentModalSchema: z.ZodObject<{
|
|
|
23
25
|
version: string;
|
|
24
26
|
language: string;
|
|
25
27
|
cohort: string;
|
|
28
|
+
type: string;
|
|
26
29
|
bulletPoints: string[];
|
|
27
30
|
logoUrl: string;
|
|
28
31
|
title: string;
|
|
@@ -5,6 +5,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
5
5
|
version: z.ZodString;
|
|
6
6
|
language: z.ZodString;
|
|
7
7
|
cohort: z.ZodString;
|
|
8
|
+
type: z.ZodString;
|
|
8
9
|
} & {
|
|
9
10
|
mainText: z.ZodString;
|
|
10
11
|
bulletPoints: z.ZodArray<z.ZodString, "many">;
|
|
@@ -13,6 +14,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
13
14
|
version: string;
|
|
14
15
|
language: string;
|
|
15
16
|
cohort: string;
|
|
17
|
+
type: string;
|
|
16
18
|
mainText: string;
|
|
17
19
|
bulletPoints: string[];
|
|
18
20
|
buttonText: string;
|
|
@@ -20,6 +22,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
20
22
|
version: string;
|
|
21
23
|
language: string;
|
|
22
24
|
cohort: string;
|
|
25
|
+
type: string;
|
|
23
26
|
mainText: string;
|
|
24
27
|
bulletPoints: string[];
|
|
25
28
|
buttonText: string;
|
|
@@ -28,6 +31,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
28
31
|
version: z.ZodString;
|
|
29
32
|
language: z.ZodString;
|
|
30
33
|
cohort: z.ZodString;
|
|
34
|
+
type: z.ZodString;
|
|
31
35
|
} & {
|
|
32
36
|
mainText: z.ZodEffects<z.ZodString, string, string>;
|
|
33
37
|
bulletPoints: z.ZodArray<z.ZodString, "many">;
|
|
@@ -36,6 +40,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
36
40
|
version: string;
|
|
37
41
|
language: string;
|
|
38
42
|
cohort: string;
|
|
43
|
+
type: string;
|
|
39
44
|
mainText: string;
|
|
40
45
|
bulletPoints: string[];
|
|
41
46
|
buttonText: string;
|
|
@@ -43,6 +48,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
43
48
|
version: string;
|
|
44
49
|
language: string;
|
|
45
50
|
cohort: string;
|
|
51
|
+
type: string;
|
|
46
52
|
mainText: string;
|
|
47
53
|
bulletPoints: string[];
|
|
48
54
|
buttonText: string;
|
|
@@ -51,6 +57,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
51
57
|
version: z.ZodString;
|
|
52
58
|
language: z.ZodString;
|
|
53
59
|
cohort: z.ZodString;
|
|
60
|
+
type: z.ZodString;
|
|
54
61
|
} & {
|
|
55
62
|
logoUrl: z.ZodString;
|
|
56
63
|
title: z.ZodString;
|
|
@@ -61,6 +68,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
61
68
|
version: string;
|
|
62
69
|
language: string;
|
|
63
70
|
cohort: string;
|
|
71
|
+
type: string;
|
|
64
72
|
bulletPoints: string[];
|
|
65
73
|
logoUrl: string;
|
|
66
74
|
title: string;
|
|
@@ -70,6 +78,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
70
78
|
version: string;
|
|
71
79
|
language: string;
|
|
72
80
|
cohort: string;
|
|
81
|
+
type: string;
|
|
73
82
|
bulletPoints: string[];
|
|
74
83
|
logoUrl: string;
|
|
75
84
|
title: string;
|
|
@@ -80,6 +89,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
80
89
|
version: z.ZodString;
|
|
81
90
|
language: z.ZodString;
|
|
82
91
|
cohort: z.ZodString;
|
|
92
|
+
type: z.ZodString;
|
|
83
93
|
} & {
|
|
84
94
|
mainText: z.ZodString;
|
|
85
95
|
buttonText: z.ZodString;
|
|
@@ -87,12 +97,14 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
87
97
|
version: string;
|
|
88
98
|
language: string;
|
|
89
99
|
cohort: string;
|
|
100
|
+
type: string;
|
|
90
101
|
mainText: string;
|
|
91
102
|
buttonText: string;
|
|
92
103
|
}, {
|
|
93
104
|
version: string;
|
|
94
105
|
language: string;
|
|
95
106
|
cohort: string;
|
|
107
|
+
type: string;
|
|
96
108
|
mainText: string;
|
|
97
109
|
buttonText: string;
|
|
98
110
|
}>>>;
|
|
@@ -100,6 +112,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
100
112
|
version: z.ZodString;
|
|
101
113
|
language: z.ZodString;
|
|
102
114
|
cohort: z.ZodString;
|
|
115
|
+
type: z.ZodString;
|
|
103
116
|
} & {
|
|
104
117
|
mainText: z.ZodString;
|
|
105
118
|
buttonText: z.ZodString;
|
|
@@ -107,12 +120,14 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
107
120
|
version: string;
|
|
108
121
|
language: string;
|
|
109
122
|
cohort: string;
|
|
123
|
+
type: string;
|
|
110
124
|
mainText: string;
|
|
111
125
|
buttonText: string;
|
|
112
126
|
}, {
|
|
113
127
|
version: string;
|
|
114
128
|
language: string;
|
|
115
129
|
cohort: string;
|
|
130
|
+
type: string;
|
|
116
131
|
mainText: string;
|
|
117
132
|
buttonText: string;
|
|
118
133
|
}>>>;
|
|
@@ -120,6 +135,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
120
135
|
version: z.ZodString;
|
|
121
136
|
language: z.ZodString;
|
|
122
137
|
cohort: z.ZodString;
|
|
138
|
+
type: z.ZodString;
|
|
123
139
|
} & {
|
|
124
140
|
mainText: z.ZodString;
|
|
125
141
|
buttonText: z.ZodString;
|
|
@@ -127,12 +143,14 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
127
143
|
version: string;
|
|
128
144
|
language: string;
|
|
129
145
|
cohort: string;
|
|
146
|
+
type: string;
|
|
130
147
|
mainText: string;
|
|
131
148
|
buttonText: string;
|
|
132
149
|
}, {
|
|
133
150
|
version: string;
|
|
134
151
|
language: string;
|
|
135
152
|
cohort: string;
|
|
153
|
+
type: string;
|
|
136
154
|
mainText: string;
|
|
137
155
|
buttonText: string;
|
|
138
156
|
}>>>;
|
|
@@ -140,6 +158,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
140
158
|
version: z.ZodString;
|
|
141
159
|
language: z.ZodString;
|
|
142
160
|
cohort: z.ZodString;
|
|
161
|
+
type: z.ZodString;
|
|
143
162
|
} & {
|
|
144
163
|
mainText: z.ZodEffects<z.ZodString, string, string>;
|
|
145
164
|
buttonText: z.ZodString;
|
|
@@ -147,12 +166,14 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
147
166
|
version: string;
|
|
148
167
|
language: string;
|
|
149
168
|
cohort: string;
|
|
169
|
+
type: string;
|
|
150
170
|
mainText: string;
|
|
151
171
|
buttonText: string;
|
|
152
172
|
}, {
|
|
153
173
|
version: string;
|
|
154
174
|
language: string;
|
|
155
175
|
cohort: string;
|
|
176
|
+
type: string;
|
|
156
177
|
mainText: string;
|
|
157
178
|
buttonText: string;
|
|
158
179
|
}>>>;
|
|
@@ -160,6 +181,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
160
181
|
version: z.ZodString;
|
|
161
182
|
language: z.ZodString;
|
|
162
183
|
cohort: z.ZodString;
|
|
184
|
+
type: z.ZodString;
|
|
163
185
|
} & {
|
|
164
186
|
mainText: z.ZodString;
|
|
165
187
|
buttonText: z.ZodString;
|
|
@@ -167,12 +189,14 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
167
189
|
version: string;
|
|
168
190
|
language: string;
|
|
169
191
|
cohort: string;
|
|
192
|
+
type: string;
|
|
170
193
|
mainText: string;
|
|
171
194
|
buttonText: string;
|
|
172
195
|
}, {
|
|
173
196
|
version: string;
|
|
174
197
|
language: string;
|
|
175
198
|
cohort: string;
|
|
199
|
+
type: string;
|
|
176
200
|
mainText: string;
|
|
177
201
|
buttonText: string;
|
|
178
202
|
}>>>;
|
|
@@ -180,17 +204,20 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
180
204
|
version: z.ZodString;
|
|
181
205
|
language: z.ZodString;
|
|
182
206
|
cohort: z.ZodString;
|
|
207
|
+
type: z.ZodString;
|
|
183
208
|
} & {
|
|
184
209
|
partnerLogoUrl: z.ZodString;
|
|
185
210
|
}, "strip", z.ZodTypeAny, {
|
|
186
211
|
version: string;
|
|
187
212
|
language: string;
|
|
188
213
|
cohort: string;
|
|
214
|
+
type: string;
|
|
189
215
|
partnerLogoUrl: string;
|
|
190
216
|
}, {
|
|
191
217
|
version: string;
|
|
192
218
|
language: string;
|
|
193
219
|
cohort: string;
|
|
220
|
+
type: string;
|
|
194
221
|
partnerLogoUrl: string;
|
|
195
222
|
}>>>>;
|
|
196
223
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -198,6 +225,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
198
225
|
version: string;
|
|
199
226
|
language: string;
|
|
200
227
|
cohort: string;
|
|
228
|
+
type: string;
|
|
201
229
|
mainText: string;
|
|
202
230
|
bulletPoints: string[];
|
|
203
231
|
buttonText: string;
|
|
@@ -206,6 +234,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
206
234
|
version: string;
|
|
207
235
|
language: string;
|
|
208
236
|
cohort: string;
|
|
237
|
+
type: string;
|
|
209
238
|
mainText: string;
|
|
210
239
|
bulletPoints: string[];
|
|
211
240
|
buttonText: string;
|
|
@@ -214,6 +243,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
214
243
|
version: string;
|
|
215
244
|
language: string;
|
|
216
245
|
cohort: string;
|
|
246
|
+
type: string;
|
|
217
247
|
bulletPoints: string[];
|
|
218
248
|
logoUrl: string;
|
|
219
249
|
title: string;
|
|
@@ -224,6 +254,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
224
254
|
version: string;
|
|
225
255
|
language: string;
|
|
226
256
|
cohort: string;
|
|
257
|
+
type: string;
|
|
227
258
|
mainText: string;
|
|
228
259
|
buttonText: string;
|
|
229
260
|
}>>;
|
|
@@ -231,6 +262,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
231
262
|
version: string;
|
|
232
263
|
language: string;
|
|
233
264
|
cohort: string;
|
|
265
|
+
type: string;
|
|
234
266
|
mainText: string;
|
|
235
267
|
buttonText: string;
|
|
236
268
|
}>>;
|
|
@@ -238,6 +270,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
238
270
|
version: string;
|
|
239
271
|
language: string;
|
|
240
272
|
cohort: string;
|
|
273
|
+
type: string;
|
|
241
274
|
mainText: string;
|
|
242
275
|
buttonText: string;
|
|
243
276
|
}>>;
|
|
@@ -245,6 +278,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
245
278
|
version: string;
|
|
246
279
|
language: string;
|
|
247
280
|
cohort: string;
|
|
281
|
+
type: string;
|
|
248
282
|
mainText: string;
|
|
249
283
|
buttonText: string;
|
|
250
284
|
}>>;
|
|
@@ -252,6 +286,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
252
286
|
version: string;
|
|
253
287
|
language: string;
|
|
254
288
|
cohort: string;
|
|
289
|
+
type: string;
|
|
255
290
|
mainText: string;
|
|
256
291
|
buttonText: string;
|
|
257
292
|
}>>;
|
|
@@ -259,6 +294,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
259
294
|
version: string;
|
|
260
295
|
language: string;
|
|
261
296
|
cohort: string;
|
|
297
|
+
type: string;
|
|
262
298
|
partnerLogoUrl: string;
|
|
263
299
|
}>> | undefined;
|
|
264
300
|
}, {
|
|
@@ -266,6 +302,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
266
302
|
version: string;
|
|
267
303
|
language: string;
|
|
268
304
|
cohort: string;
|
|
305
|
+
type: string;
|
|
269
306
|
mainText: string;
|
|
270
307
|
bulletPoints: string[];
|
|
271
308
|
buttonText: string;
|
|
@@ -274,6 +311,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
274
311
|
version: string;
|
|
275
312
|
language: string;
|
|
276
313
|
cohort: string;
|
|
314
|
+
type: string;
|
|
277
315
|
mainText: string;
|
|
278
316
|
bulletPoints: string[];
|
|
279
317
|
buttonText: string;
|
|
@@ -282,6 +320,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
282
320
|
version: string;
|
|
283
321
|
language: string;
|
|
284
322
|
cohort: string;
|
|
323
|
+
type: string;
|
|
285
324
|
bulletPoints: string[];
|
|
286
325
|
logoUrl: string;
|
|
287
326
|
title: string;
|
|
@@ -292,6 +331,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
292
331
|
version: string;
|
|
293
332
|
language: string;
|
|
294
333
|
cohort: string;
|
|
334
|
+
type: string;
|
|
295
335
|
mainText: string;
|
|
296
336
|
buttonText: string;
|
|
297
337
|
}>>;
|
|
@@ -299,6 +339,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
299
339
|
version: string;
|
|
300
340
|
language: string;
|
|
301
341
|
cohort: string;
|
|
342
|
+
type: string;
|
|
302
343
|
mainText: string;
|
|
303
344
|
buttonText: string;
|
|
304
345
|
}>>;
|
|
@@ -306,6 +347,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
306
347
|
version: string;
|
|
307
348
|
language: string;
|
|
308
349
|
cohort: string;
|
|
350
|
+
type: string;
|
|
309
351
|
mainText: string;
|
|
310
352
|
buttonText: string;
|
|
311
353
|
}>>;
|
|
@@ -313,6 +355,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
313
355
|
version: string;
|
|
314
356
|
language: string;
|
|
315
357
|
cohort: string;
|
|
358
|
+
type: string;
|
|
316
359
|
mainText: string;
|
|
317
360
|
buttonText: string;
|
|
318
361
|
}>>;
|
|
@@ -320,6 +363,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
320
363
|
version: string;
|
|
321
364
|
language: string;
|
|
322
365
|
cohort: string;
|
|
366
|
+
type: string;
|
|
323
367
|
mainText: string;
|
|
324
368
|
buttonText: string;
|
|
325
369
|
}>>;
|
|
@@ -327,6 +371,7 @@ export declare const CopyBundleSchema: z.ZodObject<{
|
|
|
327
371
|
version: string;
|
|
328
372
|
language: string;
|
|
329
373
|
cohort: string;
|
|
374
|
+
type: string;
|
|
330
375
|
partnerLogoUrl: string;
|
|
331
376
|
}>> | undefined;
|
|
332
377
|
}>;
|
|
@@ -335,6 +380,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
335
380
|
version: z.ZodString;
|
|
336
381
|
language: z.ZodString;
|
|
337
382
|
cohort: z.ZodString;
|
|
383
|
+
type: z.ZodString;
|
|
338
384
|
} & {
|
|
339
385
|
mainText: z.ZodString;
|
|
340
386
|
bulletPoints: z.ZodArray<z.ZodString, "many">;
|
|
@@ -343,6 +389,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
343
389
|
version: string;
|
|
344
390
|
language: string;
|
|
345
391
|
cohort: string;
|
|
392
|
+
type: string;
|
|
346
393
|
mainText: string;
|
|
347
394
|
bulletPoints: string[];
|
|
348
395
|
buttonText: string;
|
|
@@ -350,6 +397,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
350
397
|
version: string;
|
|
351
398
|
language: string;
|
|
352
399
|
cohort: string;
|
|
400
|
+
type: string;
|
|
353
401
|
mainText: string;
|
|
354
402
|
bulletPoints: string[];
|
|
355
403
|
buttonText: string;
|
|
@@ -358,6 +406,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
358
406
|
version: z.ZodString;
|
|
359
407
|
language: z.ZodString;
|
|
360
408
|
cohort: z.ZodString;
|
|
409
|
+
type: z.ZodString;
|
|
361
410
|
} & {
|
|
362
411
|
mainText: z.ZodEffects<z.ZodString, string, string>;
|
|
363
412
|
bulletPoints: z.ZodArray<z.ZodString, "many">;
|
|
@@ -366,6 +415,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
366
415
|
version: string;
|
|
367
416
|
language: string;
|
|
368
417
|
cohort: string;
|
|
418
|
+
type: string;
|
|
369
419
|
mainText: string;
|
|
370
420
|
bulletPoints: string[];
|
|
371
421
|
buttonText: string;
|
|
@@ -373,6 +423,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
373
423
|
version: string;
|
|
374
424
|
language: string;
|
|
375
425
|
cohort: string;
|
|
426
|
+
type: string;
|
|
376
427
|
mainText: string;
|
|
377
428
|
bulletPoints: string[];
|
|
378
429
|
buttonText: string;
|
|
@@ -381,6 +432,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
381
432
|
version: z.ZodString;
|
|
382
433
|
language: z.ZodString;
|
|
383
434
|
cohort: z.ZodString;
|
|
435
|
+
type: z.ZodString;
|
|
384
436
|
} & {
|
|
385
437
|
logoUrl: z.ZodString;
|
|
386
438
|
title: z.ZodString;
|
|
@@ -391,6 +443,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
391
443
|
version: string;
|
|
392
444
|
language: string;
|
|
393
445
|
cohort: string;
|
|
446
|
+
type: string;
|
|
394
447
|
bulletPoints: string[];
|
|
395
448
|
logoUrl: string;
|
|
396
449
|
title: string;
|
|
@@ -400,6 +453,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
400
453
|
version: string;
|
|
401
454
|
language: string;
|
|
402
455
|
cohort: string;
|
|
456
|
+
type: string;
|
|
403
457
|
bulletPoints: string[];
|
|
404
458
|
logoUrl: string;
|
|
405
459
|
title: string;
|
|
@@ -410,6 +464,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
410
464
|
version: z.ZodString;
|
|
411
465
|
language: z.ZodString;
|
|
412
466
|
cohort: z.ZodString;
|
|
467
|
+
type: z.ZodString;
|
|
413
468
|
} & {
|
|
414
469
|
mainText: z.ZodString;
|
|
415
470
|
buttonText: z.ZodString;
|
|
@@ -417,12 +472,14 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
417
472
|
version: string;
|
|
418
473
|
language: string;
|
|
419
474
|
cohort: string;
|
|
475
|
+
type: string;
|
|
420
476
|
mainText: string;
|
|
421
477
|
buttonText: string;
|
|
422
478
|
}, {
|
|
423
479
|
version: string;
|
|
424
480
|
language: string;
|
|
425
481
|
cohort: string;
|
|
482
|
+
type: string;
|
|
426
483
|
mainText: string;
|
|
427
484
|
buttonText: string;
|
|
428
485
|
}>;
|
|
@@ -430,6 +487,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
430
487
|
version: z.ZodString;
|
|
431
488
|
language: z.ZodString;
|
|
432
489
|
cohort: z.ZodString;
|
|
490
|
+
type: z.ZodString;
|
|
433
491
|
} & {
|
|
434
492
|
mainText: z.ZodString;
|
|
435
493
|
buttonText: z.ZodString;
|
|
@@ -437,12 +495,14 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
437
495
|
version: string;
|
|
438
496
|
language: string;
|
|
439
497
|
cohort: string;
|
|
498
|
+
type: string;
|
|
440
499
|
mainText: string;
|
|
441
500
|
buttonText: string;
|
|
442
501
|
}, {
|
|
443
502
|
version: string;
|
|
444
503
|
language: string;
|
|
445
504
|
cohort: string;
|
|
505
|
+
type: string;
|
|
446
506
|
mainText: string;
|
|
447
507
|
buttonText: string;
|
|
448
508
|
}>;
|
|
@@ -450,6 +510,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
450
510
|
version: z.ZodString;
|
|
451
511
|
language: z.ZodString;
|
|
452
512
|
cohort: z.ZodString;
|
|
513
|
+
type: z.ZodString;
|
|
453
514
|
} & {
|
|
454
515
|
mainText: z.ZodString;
|
|
455
516
|
buttonText: z.ZodString;
|
|
@@ -457,12 +518,14 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
457
518
|
version: string;
|
|
458
519
|
language: string;
|
|
459
520
|
cohort: string;
|
|
521
|
+
type: string;
|
|
460
522
|
mainText: string;
|
|
461
523
|
buttonText: string;
|
|
462
524
|
}, {
|
|
463
525
|
version: string;
|
|
464
526
|
language: string;
|
|
465
527
|
cohort: string;
|
|
528
|
+
type: string;
|
|
466
529
|
mainText: string;
|
|
467
530
|
buttonText: string;
|
|
468
531
|
}>;
|
|
@@ -470,6 +533,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
470
533
|
version: z.ZodString;
|
|
471
534
|
language: z.ZodString;
|
|
472
535
|
cohort: z.ZodString;
|
|
536
|
+
type: z.ZodString;
|
|
473
537
|
} & {
|
|
474
538
|
mainText: z.ZodEffects<z.ZodString, string, string>;
|
|
475
539
|
buttonText: z.ZodString;
|
|
@@ -477,12 +541,14 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
477
541
|
version: string;
|
|
478
542
|
language: string;
|
|
479
543
|
cohort: string;
|
|
544
|
+
type: string;
|
|
480
545
|
mainText: string;
|
|
481
546
|
buttonText: string;
|
|
482
547
|
}, {
|
|
483
548
|
version: string;
|
|
484
549
|
language: string;
|
|
485
550
|
cohort: string;
|
|
551
|
+
type: string;
|
|
486
552
|
mainText: string;
|
|
487
553
|
buttonText: string;
|
|
488
554
|
}>;
|
|
@@ -490,6 +556,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
490
556
|
version: z.ZodString;
|
|
491
557
|
language: z.ZodString;
|
|
492
558
|
cohort: z.ZodString;
|
|
559
|
+
type: z.ZodString;
|
|
493
560
|
} & {
|
|
494
561
|
mainText: z.ZodString;
|
|
495
562
|
buttonText: z.ZodString;
|
|
@@ -497,12 +564,14 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
497
564
|
version: string;
|
|
498
565
|
language: string;
|
|
499
566
|
cohort: string;
|
|
567
|
+
type: string;
|
|
500
568
|
mainText: string;
|
|
501
569
|
buttonText: string;
|
|
502
570
|
}, {
|
|
503
571
|
version: string;
|
|
504
572
|
language: string;
|
|
505
573
|
cohort: string;
|
|
574
|
+
type: string;
|
|
506
575
|
mainText: string;
|
|
507
576
|
buttonText: string;
|
|
508
577
|
}>;
|
|
@@ -510,17 +579,20 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
510
579
|
version: z.ZodString;
|
|
511
580
|
language: z.ZodString;
|
|
512
581
|
cohort: z.ZodString;
|
|
582
|
+
type: z.ZodString;
|
|
513
583
|
} & {
|
|
514
584
|
partnerLogoUrl: z.ZodString;
|
|
515
585
|
}, "strip", z.ZodTypeAny, {
|
|
516
586
|
version: string;
|
|
517
587
|
language: string;
|
|
518
588
|
cohort: string;
|
|
589
|
+
type: string;
|
|
519
590
|
partnerLogoUrl: string;
|
|
520
591
|
}, {
|
|
521
592
|
version: string;
|
|
522
593
|
language: string;
|
|
523
594
|
cohort: string;
|
|
595
|
+
type: string;
|
|
524
596
|
partnerLogoUrl: string;
|
|
525
597
|
}>>;
|
|
526
598
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -528,6 +600,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
528
600
|
version: string;
|
|
529
601
|
language: string;
|
|
530
602
|
cohort: string;
|
|
603
|
+
type: string;
|
|
531
604
|
mainText: string;
|
|
532
605
|
bulletPoints: string[];
|
|
533
606
|
buttonText: string;
|
|
@@ -536,6 +609,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
536
609
|
version: string;
|
|
537
610
|
language: string;
|
|
538
611
|
cohort: string;
|
|
612
|
+
type: string;
|
|
539
613
|
mainText: string;
|
|
540
614
|
bulletPoints: string[];
|
|
541
615
|
buttonText: string;
|
|
@@ -544,6 +618,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
544
618
|
version: string;
|
|
545
619
|
language: string;
|
|
546
620
|
cohort: string;
|
|
621
|
+
type: string;
|
|
547
622
|
bulletPoints: string[];
|
|
548
623
|
logoUrl: string;
|
|
549
624
|
title: string;
|
|
@@ -554,6 +629,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
554
629
|
version: string;
|
|
555
630
|
language: string;
|
|
556
631
|
cohort: string;
|
|
632
|
+
type: string;
|
|
557
633
|
mainText: string;
|
|
558
634
|
buttonText: string;
|
|
559
635
|
};
|
|
@@ -561,6 +637,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
561
637
|
version: string;
|
|
562
638
|
language: string;
|
|
563
639
|
cohort: string;
|
|
640
|
+
type: string;
|
|
564
641
|
mainText: string;
|
|
565
642
|
buttonText: string;
|
|
566
643
|
};
|
|
@@ -568,6 +645,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
568
645
|
version: string;
|
|
569
646
|
language: string;
|
|
570
647
|
cohort: string;
|
|
648
|
+
type: string;
|
|
571
649
|
mainText: string;
|
|
572
650
|
buttonText: string;
|
|
573
651
|
};
|
|
@@ -575,6 +653,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
575
653
|
version: string;
|
|
576
654
|
language: string;
|
|
577
655
|
cohort: string;
|
|
656
|
+
type: string;
|
|
578
657
|
mainText: string;
|
|
579
658
|
buttonText: string;
|
|
580
659
|
};
|
|
@@ -582,6 +661,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
582
661
|
version: string;
|
|
583
662
|
language: string;
|
|
584
663
|
cohort: string;
|
|
664
|
+
type: string;
|
|
585
665
|
mainText: string;
|
|
586
666
|
buttonText: string;
|
|
587
667
|
};
|
|
@@ -589,6 +669,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
589
669
|
version: string;
|
|
590
670
|
language: string;
|
|
591
671
|
cohort: string;
|
|
672
|
+
type: string;
|
|
592
673
|
partnerLogoUrl: string;
|
|
593
674
|
} | undefined;
|
|
594
675
|
}, {
|
|
@@ -596,6 +677,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
596
677
|
version: string;
|
|
597
678
|
language: string;
|
|
598
679
|
cohort: string;
|
|
680
|
+
type: string;
|
|
599
681
|
mainText: string;
|
|
600
682
|
bulletPoints: string[];
|
|
601
683
|
buttonText: string;
|
|
@@ -604,6 +686,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
604
686
|
version: string;
|
|
605
687
|
language: string;
|
|
606
688
|
cohort: string;
|
|
689
|
+
type: string;
|
|
607
690
|
mainText: string;
|
|
608
691
|
bulletPoints: string[];
|
|
609
692
|
buttonText: string;
|
|
@@ -612,6 +695,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
612
695
|
version: string;
|
|
613
696
|
language: string;
|
|
614
697
|
cohort: string;
|
|
698
|
+
type: string;
|
|
615
699
|
bulletPoints: string[];
|
|
616
700
|
logoUrl: string;
|
|
617
701
|
title: string;
|
|
@@ -622,6 +706,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
622
706
|
version: string;
|
|
623
707
|
language: string;
|
|
624
708
|
cohort: string;
|
|
709
|
+
type: string;
|
|
625
710
|
mainText: string;
|
|
626
711
|
buttonText: string;
|
|
627
712
|
};
|
|
@@ -629,6 +714,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
629
714
|
version: string;
|
|
630
715
|
language: string;
|
|
631
716
|
cohort: string;
|
|
717
|
+
type: string;
|
|
632
718
|
mainText: string;
|
|
633
719
|
buttonText: string;
|
|
634
720
|
};
|
|
@@ -636,6 +722,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
636
722
|
version: string;
|
|
637
723
|
language: string;
|
|
638
724
|
cohort: string;
|
|
725
|
+
type: string;
|
|
639
726
|
mainText: string;
|
|
640
727
|
buttonText: string;
|
|
641
728
|
};
|
|
@@ -643,6 +730,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
643
730
|
version: string;
|
|
644
731
|
language: string;
|
|
645
732
|
cohort: string;
|
|
733
|
+
type: string;
|
|
646
734
|
mainText: string;
|
|
647
735
|
buttonText: string;
|
|
648
736
|
};
|
|
@@ -650,6 +738,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
650
738
|
version: string;
|
|
651
739
|
language: string;
|
|
652
740
|
cohort: string;
|
|
741
|
+
type: string;
|
|
653
742
|
mainText: string;
|
|
654
743
|
buttonText: string;
|
|
655
744
|
};
|
|
@@ -657,6 +746,7 @@ export declare const CopySchema: z.ZodObject<{
|
|
|
657
746
|
version: string;
|
|
658
747
|
language: string;
|
|
659
748
|
cohort: string;
|
|
749
|
+
type: string;
|
|
660
750
|
partnerLogoUrl: string;
|
|
661
751
|
} | undefined;
|
|
662
752
|
}>;
|
|
@@ -4,6 +4,7 @@ export declare const GenericOfferSchema: z.ZodObject<{
|
|
|
4
4
|
version: z.ZodString;
|
|
5
5
|
language: z.ZodString;
|
|
6
6
|
cohort: z.ZodString;
|
|
7
|
+
type: z.ZodString;
|
|
7
8
|
} & {
|
|
8
9
|
mainText: z.ZodString;
|
|
9
10
|
bulletPoints: z.ZodArray<z.ZodString, "many">;
|
|
@@ -12,6 +13,7 @@ export declare const GenericOfferSchema: z.ZodObject<{
|
|
|
12
13
|
version: string;
|
|
13
14
|
language: string;
|
|
14
15
|
cohort: string;
|
|
16
|
+
type: string;
|
|
15
17
|
mainText: string;
|
|
16
18
|
bulletPoints: string[];
|
|
17
19
|
buttonText: string;
|
|
@@ -19,6 +21,7 @@ export declare const GenericOfferSchema: z.ZodObject<{
|
|
|
19
21
|
version: string;
|
|
20
22
|
language: string;
|
|
21
23
|
cohort: string;
|
|
24
|
+
type: string;
|
|
22
25
|
mainText: string;
|
|
23
26
|
bulletPoints: string[];
|
|
24
27
|
buttonText: string;
|
|
@@ -4,6 +4,7 @@ export declare const IndicativeOfferSchema: z.ZodObject<{
|
|
|
4
4
|
version: z.ZodString;
|
|
5
5
|
language: z.ZodString;
|
|
6
6
|
cohort: z.ZodString;
|
|
7
|
+
type: z.ZodString;
|
|
7
8
|
} & {
|
|
8
9
|
mainText: z.ZodEffects<z.ZodString, string, string>;
|
|
9
10
|
bulletPoints: z.ZodArray<z.ZodString, "many">;
|
|
@@ -12,6 +13,7 @@ export declare const IndicativeOfferSchema: z.ZodObject<{
|
|
|
12
13
|
version: string;
|
|
13
14
|
language: string;
|
|
14
15
|
cohort: string;
|
|
16
|
+
type: string;
|
|
15
17
|
mainText: string;
|
|
16
18
|
bulletPoints: string[];
|
|
17
19
|
buttonText: string;
|
|
@@ -19,6 +21,7 @@ export declare const IndicativeOfferSchema: z.ZodObject<{
|
|
|
19
21
|
version: string;
|
|
20
22
|
language: string;
|
|
21
23
|
cohort: string;
|
|
24
|
+
type: string;
|
|
22
25
|
mainText: string;
|
|
23
26
|
bulletPoints: string[];
|
|
24
27
|
buttonText: string;
|
|
@@ -4,17 +4,20 @@ export declare const PartnerTemplateSchema: z.ZodObject<{
|
|
|
4
4
|
version: z.ZodString;
|
|
5
5
|
language: z.ZodString;
|
|
6
6
|
cohort: z.ZodString;
|
|
7
|
+
type: z.ZodString;
|
|
7
8
|
} & {
|
|
8
9
|
partnerLogoUrl: z.ZodString;
|
|
9
10
|
}, "strip", z.ZodTypeAny, {
|
|
10
11
|
version: string;
|
|
11
12
|
language: string;
|
|
12
13
|
cohort: string;
|
|
14
|
+
type: string;
|
|
13
15
|
partnerLogoUrl: string;
|
|
14
16
|
}, {
|
|
15
17
|
version: string;
|
|
16
18
|
language: string;
|
|
17
19
|
cohort: string;
|
|
20
|
+
type: string;
|
|
18
21
|
partnerLogoUrl: string;
|
|
19
22
|
}>;
|
|
20
23
|
export type PartnerTemplate = z.infer<typeof PartnerTemplateSchema>;
|
|
@@ -4,6 +4,7 @@ export declare const ProvideAdditionalInfoSchema: z.ZodObject<{
|
|
|
4
4
|
version: z.ZodString;
|
|
5
5
|
language: z.ZodString;
|
|
6
6
|
cohort: z.ZodString;
|
|
7
|
+
type: z.ZodString;
|
|
7
8
|
} & {
|
|
8
9
|
mainText: z.ZodString;
|
|
9
10
|
buttonText: z.ZodString;
|
|
@@ -11,12 +12,14 @@ export declare const ProvideAdditionalInfoSchema: z.ZodObject<{
|
|
|
11
12
|
version: string;
|
|
12
13
|
language: string;
|
|
13
14
|
cohort: string;
|
|
15
|
+
type: string;
|
|
14
16
|
mainText: string;
|
|
15
17
|
buttonText: string;
|
|
16
18
|
}, {
|
|
17
19
|
version: string;
|
|
18
20
|
language: string;
|
|
19
21
|
cohort: string;
|
|
22
|
+
type: string;
|
|
20
23
|
mainText: string;
|
|
21
24
|
buttonText: string;
|
|
22
25
|
}>;
|
|
@@ -4,6 +4,7 @@ export declare const SelectOfferSchema: z.ZodObject<{
|
|
|
4
4
|
version: z.ZodString;
|
|
5
5
|
language: z.ZodString;
|
|
6
6
|
cohort: z.ZodString;
|
|
7
|
+
type: z.ZodString;
|
|
7
8
|
} & {
|
|
8
9
|
mainText: z.ZodEffects<z.ZodString, string, string>;
|
|
9
10
|
buttonText: z.ZodString;
|
|
@@ -11,12 +12,14 @@ export declare const SelectOfferSchema: z.ZodObject<{
|
|
|
11
12
|
version: string;
|
|
12
13
|
language: string;
|
|
13
14
|
cohort: string;
|
|
15
|
+
type: string;
|
|
14
16
|
mainText: string;
|
|
15
17
|
buttonText: string;
|
|
16
18
|
}, {
|
|
17
19
|
version: string;
|
|
18
20
|
language: string;
|
|
19
21
|
cohort: string;
|
|
22
|
+
type: string;
|
|
20
23
|
mainText: string;
|
|
21
24
|
buttonText: string;
|
|
22
25
|
}>;
|
|
@@ -4,6 +4,7 @@ export declare const SignContractSchema: z.ZodObject<{
|
|
|
4
4
|
version: z.ZodString;
|
|
5
5
|
language: z.ZodString;
|
|
6
6
|
cohort: z.ZodString;
|
|
7
|
+
type: z.ZodString;
|
|
7
8
|
} & {
|
|
8
9
|
mainText: z.ZodString;
|
|
9
10
|
buttonText: z.ZodString;
|
|
@@ -11,12 +12,14 @@ export declare const SignContractSchema: z.ZodObject<{
|
|
|
11
12
|
version: string;
|
|
12
13
|
language: string;
|
|
13
14
|
cohort: string;
|
|
15
|
+
type: string;
|
|
14
16
|
mainText: string;
|
|
15
17
|
buttonText: string;
|
|
16
18
|
}, {
|
|
17
19
|
version: string;
|
|
18
20
|
language: string;
|
|
19
21
|
cohort: string;
|
|
22
|
+
type: string;
|
|
20
23
|
mainText: string;
|
|
21
24
|
buttonText: string;
|
|
22
25
|
}>;
|
|
@@ -4,13 +4,16 @@ export declare const WayflyerDocumentSchema: z.ZodObject<{
|
|
|
4
4
|
version: z.ZodString;
|
|
5
5
|
language: z.ZodString;
|
|
6
6
|
cohort: z.ZodString;
|
|
7
|
+
type: z.ZodString;
|
|
7
8
|
}, "strip", z.ZodTypeAny, {
|
|
8
9
|
version: string;
|
|
9
10
|
language: string;
|
|
10
11
|
cohort: string;
|
|
12
|
+
type: string;
|
|
11
13
|
}, {
|
|
12
14
|
version: string;
|
|
13
15
|
language: string;
|
|
14
16
|
cohort: string;
|
|
17
|
+
type: string;
|
|
15
18
|
}>;
|
|
16
19
|
export type WayflyerDocument = z.infer<typeof WayflyerDocumentSchema>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wf-financing/ui-assets",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"main": "dist/index.cjs.js",
|
|
5
5
|
"module": "dist/index.es.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"zod": "^3.23.8",
|
|
22
|
-
"@wf-financing/embedded-types": "1.
|
|
23
|
-
"@wf-financing/logger": "2.
|
|
22
|
+
"@wf-financing/embedded-types": "1.1.0",
|
|
23
|
+
"@wf-financing/logger": "2.1.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"dotenv": "^17.2.3"
|