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AU,CAAC,IAAI,EAAE,CAAC;QAChD,MAAM,MAAM,GAAG,UAAU,EAAE,GAAG,cAAc,EAAE,CAAC;QAE/C,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEpB,OAAO,EAAE,MAAM,EAAE,kBAAkB,CAAC,YAAY,EAAE,CAAC;IACrD,CAAC;IACD,KAAK,CAAC,gBAAgB;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC","sourcesContent":["import qs from 'query-string';\n\nimport { MailComposerOptions, MailComposerResult, MailComposerStatus } from './MailComposer.types';\n\nfunction removeNullishValues(obj) {\n for (const propName in obj) {\n if (obj[propName] == null) {\n delete obj[propName];\n }\n }\n return obj;\n}\n\nfunction checkValue(value?: string[] | string): string | null {\n if (!value) {\n return null;\n }\n\n const arr = Array.isArray(value) ? value : [value];\n return arr.join(',');\n}\n\nexport default {\n get name(): string {\n return 'ExpoMailComposer';\n },\n async composeAsync(options: MailComposerOptions): Promise<MailComposerResult> {\n const email = removeNullishValues({\n cc: checkValue(options.ccRecipients),\n bcc: checkValue(options.bccRecipients),\n subject: options.subject,\n body: options.body,\n });\n\n const query = qs.stringify(email);\n const queryComponent = query ? '?' + query : '';\n const to = checkValue(options.recipients) || '';\n const mailto = `mailto:${to}${queryComponent}`;\n\n window.open(mailto);\n\n return { status: MailComposerStatus.UNDETERMINED };\n },\n async isAvailableAsync(): Promise<boolean> {\n return true;\n },\n};\n"]} |