(obj: UrlConfig)
| 35 | type UrlConfig = yup.InferType<typeof urlConfigSchema>; |
| 36 | |
| 37 | const encodeUrlConfig = (obj: UrlConfig): string => { |
| 38 | let str = JSON.stringify(obj, (key, value) => typeof value === 'string' ? he.decode(value.replace(/\\n/g, '\n')) : value); |
| 39 | let encoder = new TextEncoder(); |
| 40 | let data = encoder.encode(str); |
| 41 | let base64 = btoa(String.fromCharCode.apply(null, data as any)); |
| 42 | return encodeURIComponent(base64); |
| 43 | } |
| 44 | |
| 45 | const JSX_TEMPLATE = `<iframe |
| 46 | src="%URL%" |