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+BAAgC,IAC9D,EAEM,2BAA6B,SAAS,EAAO,GAClD,IAAI,EAAc,GAOlB,OANA,EAAM,SAAQ,SAAS,GACnB,cAAc,EAAM,IACtB,EAAY,KAAK,EAEnB,IAEO,CACR,EAEM,cAAgB,SAAS,EAAU,GACxC,OAAO,OAAO,UAAU,SAAS,KAAK,GAAQ,MAAM,GAAI,KAAO,CAChE,gBAEe,CAAE,oBAAW,UAAM,wCAAqB,YAAO","file":"/npm/react-native-communications@2.2.1/AKCommunications.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/react-native-communications@2.2.1/AKCommunications.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\nimport {\n\tLinking,\n\tPlatform,\n} from 'react-native';\n\nexport const phonecall = function(phoneNumber, prompt) {\n\tif(arguments.length !== 2) {\n\t\t\tconsole.log('you must supply exactly 2 arguments');\n\t\t\treturn;\n\t\t}\n\n\t\tif(!isCorrectType('String', phoneNumber)) {\n\t\t\tconsole.log('the phone number must be provided as a String value');\n\t\t\treturn;\n\t\t}\n\n\t\tif(!isCorrectType('Boolean', prompt)) {\n\t\t\tconsole.log('the prompt parameter must be a Boolean');\n\t\t\treturn;\n\t\t}\n\n\t\tlet url;\n\n\t\tif(Platform.OS !== 'android') {\n\t\t\turl = prompt ? 'telprompt:' : 'tel:';\n\t\t}\n\t\telse {\n\t\t\turl = 'tel:';\n\t\t}\n\n\t\turl += phoneNumber;\n\n\t\tLaunchURL(url);\n}\n\nexport const email = function(to, cc, bcc, subject, body) {\n\tlet url = 'mailto:';\n\t\tlet argLength = arguments.length;\n\n\t\tswitch(argLength) {\n\t\t\tcase 0:\n\t\t\t\tLaunchURL(url);\n\t\t\t\treturn;\n\t\t\tcase 5:\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tconsole.log('you must supply either 0 or 5 arguments. You supplied ' + argLength);\n\t\t\t\treturn;\n\t\t}\n\n\t\t// we use this Boolean to keep track of when we add a new parameter to the querystring\n\t\t// it helps us know when we need to add & to separate parameters\n\t\tlet valueAdded = false;\n\n\t\tif(isCorrectType('Array', arguments[0])) {\n\t\t\tlet validAddresses = getValidArgumentsFromArray(arguments[0], 'String');\n\n\t\t\tif(validAddresses.length > 0) {\n\t\t\t\turl += encodeURIComponent(validAddresses.join(','));\n\t\t\t}\n\t\t}\n\n\t\turl += '?';\n\n\t\tif(isCorrectType('Array', arguments[1])) {\n\t\t\tlet validAddresses = getValidArgumentsFromArray(arguments[1], 'String');\n\n\t\t\tif(validAddresses.length > 0) {\n\t\t\t\tvalueAdded = true;\n\t\t\t\turl += 'cc=' + encodeURIComponent(validAddresses.join(','));\n\t\t\t}\n\t\t}\n\n\t\tif(isCorrectType('Array', arguments[2])) {\n\t\t\tif(valueAdded) {\n\t\t\t\turl += '&';\n\t\t\t}\n\n\t\t\tlet validAddresses = getValidArgumentsFromArray(arguments[2], 'String');\n\n\t\t\tif(validAddresses.length > 0) {\n\t\t\t\tvalueAdded = true;\n\t\t\t\turl += 'bcc=' + encodeURIComponent(validAddresses.join(','));\n\t\t\t}\n\t\t}\n\n\t\tif(isCorrectType('String', arguments[3])) {\n\t\t\tif(valueAdded) {\n\t\t\t\turl += '&';\n\t\t\t}\n\n\t\t\tvalueAdded = true;\n\t\t\turl += 'subject=' + encodeURIComponent(arguments[3]);\n\t\t}\n\n\t\tif(isCorrectType('String', arguments[4])) {\n\t\t\tif(valueAdded) {\n\t\t\t\turl += '&';\n\t\t\t}\n\n\t\t\turl += 'body=' + encodeURIComponent(arguments[4]);\n\t\t}\n\n\t\tLaunchURL(url);\n}\n\nexport const text = function(phoneNumber = null, body = null) {\n\tif(arguments.length > 2) {\n\t\t\tconsole.log('you supplied too many arguments. You can either supply 0 or 1 or 2');\n\t\t\treturn;\n\t\t}\n\n\t\tlet url = 'sms:';\n\n\t\tif(phoneNumber) {\n\t\t\tif(isCorrectType('String', phoneNumber)) {\n\t\t\t\turl += phoneNumber;\n\t\t\t} else {\n\t\t\t\tconsole.log('the phone number should be provided as a string. It was provided as '\n\t\t\t\t\t+ Object.prototype.toString.call(phoneNumber).slice(8, -1)\n\t\t\t\t\t+ ',ignoring the value provided');\n\t\t\t}\n\t\t}\n\n\t\tif(body) {\n\t\t\tif(isCorrectType('String', body)) {\n\t\t\t\t// for some strange reason android seems to have issues with ampersands in the body unless it is encoded twice!\n\t\t\t\t// iOS only needs encoding once\n\t\t\t\tif(Platform.OS === 'android') body = encodeURIComponent(body);\n\t\t\t\turl += Platform.OS === 'ios' ? `&body=${encodeURIComponent(body)}` : `?body=${encodeURIComponent(body)}`;\n\t\t\t} else {\n\t\t\t\tconsole.log('the body should be provided as a string. It was provided as '\n\t\t\t\t\t+ Object.prototype.toString.call(body).slice(8, -1)\n\t\t\t\t\t+ ',ignoring the value provided');\n\t\t\t}\n\t\t}\n\n\t\tLaunchURL(url);\n}\n\nexport const textWithoutEncoding = function(phoneNumber = null, body = null) {\n\tif(arguments.length > 2) {\n\t\t\tconsole.log('you supplied too many arguments. You can either supply 0 or 1 or 2');\n\t\t\treturn;\n\t\t}\n\n\t\tlet url = 'sms:';\n\n\t\tif(phoneNumber) {\n\t\t\tif(isCorrectType('String', phoneNumber)) {\n\t\t\t\turl += phoneNumber;\n\t\t\t} else {\n\t\t\t\tconsole.log('the phone number should be provided as a string. It was provided as '\n\t\t\t\t\t+ Object.prototype.toString.call(phoneNumber).slice(8, -1)\n\t\t\t\t\t+ ',ignoring the value provided');\n\t\t\t}\n\t\t}\n\n\t\tif(body) {\n\t\t\tif(isCorrectType('String', body)) {\n\t\t\t\turl += Platform.OS === 'ios' ? `&body=${body}` : `?body=${body}`;\n\t\t\t} else {\n\t\t\t\tconsole.log('the body should be provided as a string. It was provided as '\n\t\t\t\t\t+ Object.prototype.toString.call(body).slice(8, -1)\n\t\t\t\t\t+ ',ignoring the value provided');\n\t\t\t}\n\t\t}\n\n\t\tLaunchURL(url);\n}\n\nexport const web = (address = null) => {\n\tif(!address) {\n      console.log('Missing address argument');\n      return;\n    }\n    if(!isCorrectType('String', address)) {\n    \tconsole.log('address was not provided as a string, it was provided as '\n    \t\t+ Object.prototype.toString.call(address).slice(8, -1));\n    \treturn;\n    }\n    LaunchURL(address);\n}\n\nconst LaunchURL = function(url) {\n\tLinking.canOpenURL(url).then(supported => {\n\t\tif(!supported) {\n\t\t\tconsole.log('Can\\'t handle url: ' + url);\n\t\t} else {\n\t\t\tLinking.openURL(url)\n\t\t\t.catch(err => {\n\t\t\t\tif(url.includes('telprompt')) {\n\t\t\t\t\t// telprompt was cancelled and Linking openURL method sees this as an error\n\t\t\t\t\t// it is not a true error so ignore it to prevent apps crashing\n\t\t\t\t\t// see https://github.com/anarchicknight/react-native-communications/issues/39\n\t\t\t\t} else {\n\t\t\t\t\tconsole.warn('openURL error', err)\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}).catch(err => console.warn('An unexpected error happened', err));\n};\n\nconst getValidArgumentsFromArray = function(array, type) {\n\tvar validValues = [];\n\tarray.forEach(function(value) {\n\t\tif(isCorrectType(type, value)) {\n\t\t\tvalidValues.push(value);\n\t\t}\n\t});\n\n\treturn validValues;\n};\n\nconst isCorrectType = function(expected, actual) {\n\treturn Object.prototype.toString.call(actual).slice(8, -1) === expected;\n};\n\nexport default { phonecall, text, textWithoutEncoding, email, web }\n"]}