From a6c2b9b6a2af9f2c65e8913c9068aa5fb9f9bd48 Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Fri, 10 May 2024 15:53:24 +0100 Subject: [PATCH 01/18] Latest iOS --- Example/.ruby-version | 2 +- Example/config.xml | 6 +- Example/package-lock.json | 447 ++++++++++++++++------- Example/package.json | 7 +- Example/www/index.html | 7 +- Example/www/js/index.js | 26 +- intercom-plugin/package.json | 4 +- intercom-plugin/plugin.xml | 12 +- intercom-plugin/src/ios/IntercomBridge.h | 35 +- intercom-plugin/src/ios/IntercomBridge.m | 169 ++++++--- intercom-plugin/www/intercom.js | 87 +++-- intercom-plugin/www/intercomContent.js | 46 +++ runiOSSample.sh | 2 +- 13 files changed, 614 insertions(+), 236 deletions(-) create mode 100644 intercom-plugin/www/intercomContent.js diff --git a/Example/.ruby-version b/Example/.ruby-version index 49cdd66..be94e6f 100644 --- a/Example/.ruby-version +++ b/Example/.ruby-version @@ -1 +1 @@ -2.7.6 +3.2.2 diff --git a/Example/config.xml b/Example/config.xml index 1a2e53e..16f5070 100644 --- a/Example/config.xml +++ b/Example/config.xml @@ -33,7 +33,7 @@ - + @@ -47,8 +47,8 @@ - - + + diff --git a/Example/package-lock.json b/Example/package-lock.json index a6773a7..2240a9e 100644 --- a/Example/package-lock.json +++ b/Example/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.1", "dependencies": { "cordova-android": "^10.1.1", - "cordova-ios": "6.2.0" + "cordova-ios": "7.1.0" }, "devDependencies": { "cordova-plugin-intercom": "file:../intercom-plugin" @@ -17,12 +17,12 @@ }, "../intercom-plugin": { "name": "cordova-plugin-intercom", - "version": "13.0.0", + "version": "13.1.0", "dev": true, "engines": [ { "name": "cordova", - "version": ">=9.0.0" + "version": ">=12.0.0" }, { "name": "cordova-android", @@ -30,7 +30,7 @@ }, { "name": "cordova-ios", - "version": ">=6.2.0" + "version": "7.1.0" } ], "license": "MIT License" @@ -77,6 +77,14 @@ "node": ">= 8" } }, + "node_modules/@xmldom/xmldom": { + "version": "0.8.10", + "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz", + "integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==", + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -262,23 +270,113 @@ } }, "node_modules/cordova-ios": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/cordova-ios/-/cordova-ios-6.2.0.tgz", - "integrity": "sha512-sLjZg2QBI1SpQVwfe0MSn89YNVkBGLW9Q1vcFJBsqKBrhvoEOJ5Ytq0gwqdhgTOGzlwJUfxC6OHM3jcsRjtYrw==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/cordova-ios/-/cordova-ios-7.1.0.tgz", + "integrity": "sha512-9/vPU+GWRdfxNIkAc9Gq6yejMIgpy59ycP8WyVJJ7HfuPSTBUQT8AS2h5ZJOeN4Y/URyEwxQCrAqSADDBVCESA==", "dependencies": { - "cordova-common": "^4.0.2", - "fs-extra": "^9.1.0", + "cordova-common": "^5.0.0", + "elementtree": "^0.1.7", + "execa": "^5.1.1", "ios-sim": "^8.0.2", - "nopt": "^5.0.0", - "plist": "^3.0.1", - "semver": "^7.3.4", - "unorm": "^1.6.0", - "which": "^2.0.2", + "plist": "^3.0.6", + "semver": "^7.4.0", + "which": "^4.0.0", "xcode": "^3.0.1", "xml-escape": "^1.1.0" }, "engines": { - "node": ">=10" + "node": ">=16.13.0" + } + }, + "node_modules/cordova-ios/node_modules/bplist-parser": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.3.2.tgz", + "integrity": "sha512-apC2+fspHGI3mMKj+dGevkGo/tCqVB8jMb6i+OX+E29p0Iposz07fABkRIfVUPNd5A5VbuOz1bZbnmkKLYF+wQ==", + "dependencies": { + "big-integer": "1.6.x" + }, + "engines": { + "node": ">= 5.10.0" + } + }, + "node_modules/cordova-ios/node_modules/cordova-common": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cordova-common/-/cordova-common-5.0.0.tgz", + "integrity": "sha512-6Aa7o52/iEvsKx6K94ijzFel5acCULR49KL27OUVhEpJ4oS7Dc3y2eOP1Eu0P4Wmiw/eLEDQjGXGiAa2D5zFZA==", + "dependencies": { + "@netflix/nerror": "^1.1.3", + "ansi": "^0.3.1", + "bplist-parser": "^0.3.2", + "cross-spawn": "^7.0.3", + "elementtree": "^0.1.7", + "endent": "^2.1.0", + "fast-glob": "^3.2.12", + "fs-extra": "^11.1.0", + "glob": "^7.1.6", + "lodash.assign": "^4.2.0", + "lodash.isdate": "^4.0.1", + "lodash.isobject": "^3.0.2", + "lodash.zip": "^4.2.0", + "plist": "^3.0.6", + "q": "^1.5.1", + "read-chunk": "^3.2.0", + "strip-bom": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/cordova-ios/node_modules/endent": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/endent/-/endent-2.1.0.tgz", + "integrity": "sha512-r8VyPX7XL8U01Xgnb1CjZ3XV+z90cXIJ9JPE/R9SEC9vpw2P6CfsRPJmp20DppC5N7ZAMCmjYkJIa744Iyg96w==", + "dependencies": { + "dedent": "^0.7.0", + "fast-json-parse": "^1.0.3", + "objectorarray": "^1.0.5" + } + }, + "node_modules/cordova-ios/node_modules/fs-extra": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", + "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, + "node_modules/cordova-ios/node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "engines": { + "node": ">=16" + } + }, + "node_modules/cordova-ios/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/cordova-ios/node_modules/which": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", + "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", + "dependencies": { + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^16.13.0 || >=18.0.0" } }, "node_modules/cordova-plugin-intercom": { @@ -355,9 +453,9 @@ ] }, "node_modules/fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", @@ -421,9 +519,12 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/get-stream": { "version": "6.0.1", @@ -471,15 +572,15 @@ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==" }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", "dependencies": { - "function-bind": "^1.1.1" + "function-bind": "^1.1.2" }, "engines": { - "node": ">= 0.4.0" + "node": ">= 0.4" } }, "node_modules/human-signals": { @@ -549,11 +650,11 @@ } }, "node_modules/is-core-module": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz", - "integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==", + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", "dependencies": { - "has": "^1.0.3" + "hasown": "^2.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -626,16 +727,25 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } + "node_modules/lodash.assign": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", + "integrity": "sha512-hFuH8TY+Yji7Eja3mGiuAxBqLagejScbG8GbG0j6o9vzn0YL14My+ktnqtZgFTosKymC9/44wP6s7xyuLfnClw==" + }, + "node_modules/lodash.isdate": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isdate/-/lodash.isdate-4.0.1.tgz", + "integrity": "sha512-hg5B1GD+R9egsBgMwmAhk+V53Us03TVvXT4dnyKugEfsD4QKuG9Wlyvxq8OGy2nu7qVGsh4DRSnMk33hoWBq/Q==" + }, + "node_modules/lodash.isobject": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-3.0.2.tgz", + "integrity": "sha512-3/Qptq2vr7WeJbB4KHUSKlq8Pl7ASXi3UG6CMbBm8WRtXi8+GHm7mKaU3urfpSEzWe2wCIChs6/sdocUsTKJiA==" + }, + "node_modules/lodash.zip": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.zip/-/lodash.zip-4.2.0.tgz", + "integrity": "sha512-C7IOaBBK/0gMORRBd8OETNx3kmOkgIWIPvyDpZSCTwUrpYmgZwJkjZeOD8ww4xbOUOs4/attY+pciKvadNfFbg==" }, "node_modules/merge-stream": { "version": "2.0.0", @@ -707,9 +817,9 @@ } }, "node_modules/objectorarray": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/objectorarray/-/objectorarray-1.0.4.tgz", - "integrity": "sha512-91k8bjcldstRz1bG6zJo8lWD7c6QXcB4nTDUqiEvIL1xAsLoZlOOZZG+nd6YPz+V7zY1580J4Xxh1vZtyv4i/w==" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/objectorarray/-/objectorarray-1.0.5.tgz", + "integrity": "sha512-eJJDYkhJFFbBBAxeh8xW+weHlkI28n2ZdQV/J/DNfWfSKlGEf2xcfAbZTv3riEXHAhL9SVOTs2pRmXiSTf78xg==" }, "node_modules/once": { "version": "1.4.0", @@ -790,15 +900,16 @@ } }, "node_modules/plist": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.5.tgz", - "integrity": "sha512-83vX4eYdQp3vP9SxuYgEM/G/pJQqLUz/V/xzPrzruLs7fz7jxGQ1msZ/mg1nwZxUSuOp4sb+/bEIbRrbzZRxDA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/plist/-/plist-3.1.0.tgz", + "integrity": "sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ==", "dependencies": { + "@xmldom/xmldom": "^0.8.8", "base64-js": "^1.5.1", - "xmlbuilder": "^9.0.7" + "xmlbuilder": "^15.1.1" }, "engines": { - "node": ">=6" + "node": ">=10.4.0" } }, "node_modules/properties-parser": { @@ -845,11 +956,11 @@ } }, "node_modules/resolve": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", "dependencies": { - "is-core-module": "^2.9.0", + "is-core-module": "^2.13.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, @@ -880,12 +991,9 @@ "integrity": "sha1-dLbTPJrh4AFRDxeakRaFiPGu2qk=" }, "node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "dependencies": { - "lru-cache": "^6.0.0" - }, + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", "bin": { "semver": "bin/semver.js" }, @@ -1035,14 +1143,6 @@ "node": ">= 10.0.0" } }, - "node_modules/unorm": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/unorm/-/unorm-1.6.0.tgz", - "integrity": "sha512-b2/KCUlYZUeA7JFUuRJZPUtr4gZvBh7tavtv4fvk4+KV9pfGiR6CQAQAWl49ZpR3ts2dk4FYkP7EIgDJoiOLDA==", - "engines": { - "node": ">= 0.4.0" - } - }, "node_modules/untildify": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", @@ -1109,17 +1209,12 @@ "integrity": "sha512-B/T4sDK8Z6aUh/qNr7mjKAwwncIljFuUP+DO/D5hloYFj+90O88z8Wf7oSucZTHxBAsC1/CTP4rtx/x1Uf72Mg==" }, "node_modules/xmlbuilder": { - "version": "9.0.7", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", - "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=", + "version": "15.1.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz", + "integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==", "engines": { - "node": ">=4.0" + "node": ">=8.0" } - }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" } }, "dependencies": { @@ -1156,6 +1251,11 @@ "fastq": "^1.6.0" } }, + "@xmldom/xmldom": { + "version": "0.8.10", + "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz", + "integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==" + }, "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -1301,20 +1401,91 @@ } }, "cordova-ios": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/cordova-ios/-/cordova-ios-6.2.0.tgz", - "integrity": "sha512-sLjZg2QBI1SpQVwfe0MSn89YNVkBGLW9Q1vcFJBsqKBrhvoEOJ5Ytq0gwqdhgTOGzlwJUfxC6OHM3jcsRjtYrw==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/cordova-ios/-/cordova-ios-7.1.0.tgz", + "integrity": "sha512-9/vPU+GWRdfxNIkAc9Gq6yejMIgpy59ycP8WyVJJ7HfuPSTBUQT8AS2h5ZJOeN4Y/URyEwxQCrAqSADDBVCESA==", "requires": { - "cordova-common": "^4.0.2", - "fs-extra": "^9.1.0", + "cordova-common": "^5.0.0", + "elementtree": "^0.1.7", + "execa": "^5.1.1", "ios-sim": "^8.0.2", - "nopt": "^5.0.0", - "plist": "^3.0.1", - "semver": "^7.3.4", - "unorm": "^1.6.0", - "which": "^2.0.2", + "plist": "^3.0.6", + "semver": "^7.4.0", + "which": "^4.0.0", "xcode": "^3.0.1", "xml-escape": "^1.1.0" + }, + "dependencies": { + "bplist-parser": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.3.2.tgz", + "integrity": "sha512-apC2+fspHGI3mMKj+dGevkGo/tCqVB8jMb6i+OX+E29p0Iposz07fABkRIfVUPNd5A5VbuOz1bZbnmkKLYF+wQ==", + "requires": { + "big-integer": "1.6.x" + } + }, + "cordova-common": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cordova-common/-/cordova-common-5.0.0.tgz", + "integrity": "sha512-6Aa7o52/iEvsKx6K94ijzFel5acCULR49KL27OUVhEpJ4oS7Dc3y2eOP1Eu0P4Wmiw/eLEDQjGXGiAa2D5zFZA==", + "requires": { + "@netflix/nerror": "^1.1.3", + "ansi": "^0.3.1", + "bplist-parser": "^0.3.2", + "cross-spawn": "^7.0.3", + "elementtree": "^0.1.7", + "endent": "^2.1.0", + "fast-glob": "^3.2.12", + "fs-extra": "^11.1.0", + "glob": "^7.1.6", + "lodash.assign": "^4.2.0", + "lodash.isdate": "^4.0.1", + "lodash.isobject": "^3.0.2", + "lodash.zip": "^4.2.0", + "plist": "^3.0.6", + "q": "^1.5.1", + "read-chunk": "^3.2.0", + "strip-bom": "^4.0.0" + } + }, + "endent": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/endent/-/endent-2.1.0.tgz", + "integrity": "sha512-r8VyPX7XL8U01Xgnb1CjZ3XV+z90cXIJ9JPE/R9SEC9vpw2P6CfsRPJmp20DppC5N7ZAMCmjYkJIa744Iyg96w==", + "requires": { + "dedent": "^0.7.0", + "fast-json-parse": "^1.0.3", + "objectorarray": "^1.0.5" + } + }, + "fs-extra": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", + "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, + "isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==" + }, + "universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==" + }, + "which": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", + "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", + "requires": { + "isexe": "^3.1.1" + } + } } }, "cordova-plugin-intercom": { @@ -1375,9 +1546,9 @@ "integrity": "sha1-4mifjzVvrWLMplo6kcXfX5VRaS8=" }, "fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", "requires": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", @@ -1431,9 +1602,9 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==" }, "get-stream": { "version": "6.0.1", @@ -1466,12 +1637,12 @@ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==" }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", "requires": { - "function-bind": "^1.1.1" + "function-bind": "^1.1.2" } }, "human-signals": { @@ -1525,11 +1696,11 @@ } }, "is-core-module": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz", - "integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==", + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", "requires": { - "has": "^1.0.3" + "hasown": "^2.0.0" } }, "is-extglob": { @@ -1579,13 +1750,25 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "requires": { - "yallist": "^4.0.0" - } + "lodash.assign": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", + "integrity": "sha512-hFuH8TY+Yji7Eja3mGiuAxBqLagejScbG8GbG0j6o9vzn0YL14My+ktnqtZgFTosKymC9/44wP6s7xyuLfnClw==" + }, + "lodash.isdate": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isdate/-/lodash.isdate-4.0.1.tgz", + "integrity": "sha512-hg5B1GD+R9egsBgMwmAhk+V53Us03TVvXT4dnyKugEfsD4QKuG9Wlyvxq8OGy2nu7qVGsh4DRSnMk33hoWBq/Q==" + }, + "lodash.isobject": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-3.0.2.tgz", + "integrity": "sha512-3/Qptq2vr7WeJbB4KHUSKlq8Pl7ASXi3UG6CMbBm8WRtXi8+GHm7mKaU3urfpSEzWe2wCIChs6/sdocUsTKJiA==" + }, + "lodash.zip": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.zip/-/lodash.zip-4.2.0.tgz", + "integrity": "sha512-C7IOaBBK/0gMORRBd8OETNx3kmOkgIWIPvyDpZSCTwUrpYmgZwJkjZeOD8ww4xbOUOs4/attY+pciKvadNfFbg==" }, "merge-stream": { "version": "2.0.0", @@ -1636,9 +1819,9 @@ } }, "objectorarray": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/objectorarray/-/objectorarray-1.0.4.tgz", - "integrity": "sha512-91k8bjcldstRz1bG6zJo8lWD7c6QXcB4nTDUqiEvIL1xAsLoZlOOZZG+nd6YPz+V7zY1580J4Xxh1vZtyv4i/w==" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/objectorarray/-/objectorarray-1.0.5.tgz", + "integrity": "sha512-eJJDYkhJFFbBBAxeh8xW+weHlkI28n2ZdQV/J/DNfWfSKlGEf2xcfAbZTv3riEXHAhL9SVOTs2pRmXiSTf78xg==" }, "once": { "version": "1.4.0", @@ -1692,12 +1875,13 @@ "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" }, "plist": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/plist/-/plist-3.0.5.tgz", - "integrity": "sha512-83vX4eYdQp3vP9SxuYgEM/G/pJQqLUz/V/xzPrzruLs7fz7jxGQ1msZ/mg1nwZxUSuOp4sb+/bEIbRrbzZRxDA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/plist/-/plist-3.1.0.tgz", + "integrity": "sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ==", "requires": { + "@xmldom/xmldom": "^0.8.8", "base64-js": "^1.5.1", - "xmlbuilder": "^9.0.7" + "xmlbuilder": "^15.1.1" } }, "properties-parser": { @@ -1731,11 +1915,11 @@ } }, "resolve": { - "version": "1.22.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz", - "integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==", + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", "requires": { - "is-core-module": "^2.9.0", + "is-core-module": "^2.13.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" } @@ -1756,12 +1940,9 @@ "integrity": "sha1-dLbTPJrh4AFRDxeakRaFiPGu2qk=" }, "semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "requires": { - "lru-cache": "^6.0.0" - } + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==" }, "shebang-command": { "version": "2.0.0", @@ -1868,11 +2049,6 @@ "resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz", "integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==" }, - "unorm": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/unorm/-/unorm-1.6.0.tgz", - "integrity": "sha512-b2/KCUlYZUeA7JFUuRJZPUtr4gZvBh7tavtv4fvk4+KV9pfGiR6CQAQAWl49ZpR3ts2dk4FYkP7EIgDJoiOLDA==" - }, "untildify": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", @@ -1921,14 +2097,9 @@ "integrity": "sha512-B/T4sDK8Z6aUh/qNr7mjKAwwncIljFuUP+DO/D5hloYFj+90O88z8Wf7oSucZTHxBAsC1/CTP4rtx/x1Uf72Mg==" }, "xmlbuilder": { - "version": "9.0.7", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", - "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=" - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + "version": "15.1.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz", + "integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==" } } } diff --git a/Example/package.json b/Example/package.json index 2883542..74b7baa 100644 --- a/Example/package.json +++ b/Example/package.json @@ -13,6 +13,9 @@ }, "dependencies": { "cordova-android": "^10.1.1", - "cordova-ios": "6.2.0" + "cordova-ios": "7.1.0" + }, + "devDependencies": { + "cordova-plugin-intercom": "file:../intercom-plugin" } -} +} \ No newline at end of file diff --git a/Example/www/index.html b/Example/www/index.html index c6d95a2..74ca195 100644 --- a/Example/www/index.html +++ b/Example/www/index.html @@ -14,9 +14,10 @@

-

-

-

+

+

+

+

Help Center Data API

diff --git a/Example/www/js/index.js b/Example/www/js/index.js index 77f9d29..e53937c 100644 --- a/Example/www/js/index.js +++ b/Example/www/js/index.js @@ -55,16 +55,18 @@ var app = { }, false); document.getElementById("open-intercom-btn").addEventListener("click", function(){ - intercom.displayMessenger(); + intercom.present(); }, false); document.getElementById("open-help-center-btn").addEventListener("click", function(){ - intercom.displayHelpCenter(); + // intercom.displayHelpCenter(); + intercom.presentSpace(intercom.Space.HelpCenter); }, false); document.getElementById("open-help-center-filtered-btn").addEventListener("click", function(){ // Replace this with your own collections - var ids = ["COLLECTION_ID1", "COLLECTION_ID2"]; + var collectionIds = ["COLLECTION_ID1", "COLLECTION_ID2"]; + intercom.displayHelpCenterCollections({collectionIds: ids}); }, false); @@ -103,16 +105,24 @@ var app = { }, false); document.getElementById("display-carousel-btn").addEventListener("click", function(){ - intercom.displayCarousel("carousel-id"); + var carousel = intercomContent.carouselWithCarouselId('32136001') + intercom.presentContent(carousel) }, false); document.getElementById("display-article-btn").addEventListener("click", function(){ - intercom.displayArticle("article-id"); + var article = intercomContent.articleWithArticleId('3969758') + intercom.presentContent(article); }, false); - document.getElementById("display-survey-btn").addEventListener("click", function(){ - intercom.displaySurvey("survey-id"); + document.getElementById("display-survey-btn").addEventListener("click", function(){ + var survey = intercomContent.surveyWithSurveyId('23727915') + intercom.presentContent(survey); }, false); + + document.getElementById("display-conversation-btn").addEventListener("click", function(){ + var conversation = intercomContent.conversationWithConversationId('781200016661') + intercom.presentContent(conversation); + }, false); }, // Update DOM on a Received Event receivedEvent: function(id) { @@ -149,6 +159,7 @@ var app = { document.getElementById("display-carousel-btn").style.visibility = 'visible'; document.getElementById("display-article-btn").style.visibility = 'visible'; document.getElementById("display-survey-btn").style.visibility = 'visible'; + document.getElementById("display-conversation-btn").style.visibility = 'visible'; document.getElementById("login-btn").style.visibility = 'hidden'; }, @@ -159,6 +170,7 @@ var app = { document.getElementById("display-carousel-btn").style.visibility = 'hidden'; document.getElementById("display-article-btn").style.visibility = 'hidden'; document.getElementById("display-survey-btn").style.visibility = 'hidden'; + document.getElementById("display-conversation-btn").style.visibility = 'hidden'; document.getElementById("login-btn").style.visibility = 'visible'; } }; diff --git a/intercom-plugin/package.json b/intercom-plugin/package.json index 07dd3b8..d60e020 100644 --- a/intercom-plugin/package.json +++ b/intercom-plugin/package.json @@ -23,7 +23,7 @@ "engines": [ { "name": "cordova", - "version": ">=9.0.0" + "version": ">=12.0.0" }, { "name": "cordova-android", @@ -31,7 +31,7 @@ }, { "name": "cordova-ios", - "version": ">=6.2.0" + "version": "7.1.0" } ], "author": "Intercom", diff --git a/intercom-plugin/plugin.xml b/intercom-plugin/plugin.xml index 30db693..a33d419 100644 --- a/intercom-plugin/plugin.xml +++ b/intercom-plugin/plugin.xml @@ -8,9 +8,9 @@ intercom,intercom-cordova - + - + @@ -19,6 +19,12 @@ + + + + + + @@ -62,7 +68,7 @@ - + diff --git a/intercom-plugin/src/ios/IntercomBridge.h b/intercom-plugin/src/ios/IntercomBridge.h index f85bac5..1fc901b 100644 --- a/intercom-plugin/src/ios/IntercomBridge.h +++ b/intercom-plugin/src/ios/IntercomBridge.h @@ -15,10 +15,7 @@ - (void)unreadConversationCount:(CDVInvokedUrlCommand*)command; -- (void)displayMessenger:(CDVInvokedUrlCommand*)command; -- (void)displayMessageComposer:(CDVInvokedUrlCommand*)command; -- (void)displayHelpCenter:(CDVInvokedUrlCommand*)command; -- (void)displayHelpCenterCollections:(CDVInvokedUrlCommand*)command; + - (void)fetchHelpCenterCollections:(CDVInvokedUrlCommand*)command; - (void)fetchHelpCenterCollection:(CDVInvokedUrlCommand*)command; - (void)searchHelpCenter:(CDVInvokedUrlCommand*)command; @@ -31,4 +28,34 @@ - (void)registerForPush:(CDVInvokedUrlCommand*)command; +#pragma mark - Deprecated Methods +/** + @deprecated + */ +- (void)displayMessenger:(CDVInvokedUrlCommand*)command DEPRECATED_MSG_ATTRIBUTE("'+[Intercom displayMessenger]' is deprecated and will be removed in a future release. 'Use +[Intercom presentIntercom]' instead.");; +/** + @deprecated + */ +- (void)displayMessageComposer:(CDVInvokedUrlCommand*)command; +/** + @deprecated + */ +- (void)displayHelpCenter:(CDVInvokedUrlCommand*)command; +/** + @deprecated + */ +- (void)displayHelpCenterCollections:(CDVInvokedUrlCommand*)command; +/** + @deprecated + */ +- (void)displayCarousel:(CDVInvokedUrlCommand*)command; +/** + @deprecated + */ +- (void)displayArticle:(CDVInvokedUrlCommand*)command; +/** + @deprecated + */ +- (void)displaySurvey:(CDVInvokedUrlCommand*)command; + @end diff --git a/intercom-plugin/src/ios/IntercomBridge.m b/intercom-plugin/src/ios/IntercomBridge.m index d10264f..2e59c01 100644 --- a/intercom-plugin/src/ios/IntercomBridge.m +++ b/intercom-plugin/src/ios/IntercomBridge.m @@ -11,8 +11,11 @@ + (void)setCordovaVersion:(NSString *)v; @implementation IntercomBridge : CDVPlugin + +#pragma mark - Intercom Initialisation + - (void)pluginInitialize { - [Intercom setCordovaVersion:@"12.4.0"]; + [Intercom setCordovaVersion:@"14.0.0"]; #ifdef DEBUG [Intercom enableLogging]; #endif @@ -24,10 +27,19 @@ - (void)pluginInitialize { [Intercom setApiKey:apiKey forAppId:appId]; } +- (void)setUserHash:(CDVInvokedUrlCommand*)command { + NSString *hmac = command.arguments[0]; + + [Intercom setUserHash:hmac]; + [self sendSuccess:command]; +} + +#pragma mark - User Login + - (void)loginUserWithUserAttributes:(CDVInvokedUrlCommand*)command { NSDictionary* options = command.arguments[0]; - NSString* userId = options[@"userId"]; - NSString* userEmail = options[@"email"]; + NSString* userId = options[@"userId"]; + NSString* userEmail = options[@"email"]; if ([userId isKindOfClass:[NSNumber class]]) { userId = [(NSNumber *)userId stringValue]; @@ -70,12 +82,7 @@ - (void)logout:(CDVInvokedUrlCommand*)command { [self sendSuccess:command]; } -- (void)setUserHash:(CDVInvokedUrlCommand*)command { - NSString *hmac = command.arguments[0]; - [Intercom setUserHash:hmac]; - [self sendSuccess:command]; -} - (void)updateUser:(CDVInvokedUrlCommand*)command { NSDictionary* attributesDict = command.arguments[0]; @@ -87,6 +94,8 @@ - (void)updateUser:(CDVInvokedUrlCommand*)command { [self sendSuccess:command]; } +#pragma mark - Events + - (void)logEvent:(CDVInvokedUrlCommand*)command { NSString *eventName = command.arguments[0]; NSDictionary *metaData = command.arguments[1]; @@ -99,35 +108,60 @@ - (void)logEvent:(CDVInvokedUrlCommand*)command { [self sendSuccess:command]; } -- (void)unreadConversationCount:(CDVInvokedUrlCommand*)command { - NSUInteger count = [Intercom unreadConversationCount]; - CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsNSUInteger:count]; - [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; -} -- (void)displayMessenger:(CDVInvokedUrlCommand*)command { - [Intercom presentMessenger]; +#pragma mark - Present Intercom UI + +- (void)present:(CDVInvokedUrlCommand*)command { + [Intercom presentIntercom]; [self sendSuccess:command]; } -- (void)displayMessageComposer:(CDVInvokedUrlCommand*)command { - NSString *initialMessage = command.arguments[0]; - [Intercom presentMessageComposer:initialMessage]; +- (void)presentIntercomSpace:(CDVInvokedUrlCommand*)command { + NSString *space = command.arguments[0]; + Space selectedSpace = home; + if ([space isEqualToString:@"HOME"]) { + selectedSpace = home; + } else if ([space isEqualToString:@"HELP_CENTER"]) { + selectedSpace = helpCenter; + } else if ([space isEqualToString:@"MESSAGES"]) { + selectedSpace = messages; + } else if ([space isEqualToString:@"TICKETS"]) { + selectedSpace = tickets; + } + [Intercom presentIntercom:selectedSpace]; [self sendSuccess:command]; } -- (void)displayHelpCenter:(CDVInvokedUrlCommand*)command { - [Intercom presentHelpCenter]; - [self sendSuccess:command]; +- (void)presentContent:(CDVInvokedUrlCommand*)command { + NSDictionary *content = command.arguments[0]; + IntercomContent *intercomContent; + NSString *contentType = content[@"type"]; + if ([contentType isEqualToString:@"ARTICLE"]) { + intercomContent = [IntercomContent articleWithId:content[@"id"]]; + } else if ([contentType isEqualToString:@"CAROUSEL"]) { + intercomContent = [IntercomContent carouselWithId:content[@"id"]]; + } else if ([contentType isEqualToString:@"SURVEY"]) { + intercomContent = [IntercomContent surveyWithId:content[@"id"]]; + } else if ([contentType isEqualToString:@"HELP_CENTER_COLLECTIONS"]) { + NSArray *collectionIds = content[@"ids"]; + intercomContent = [IntercomContent helpCenterCollectionsWithIds:collectionIds]; + } else if ([contentType isEqualToString:@"CONVERSATION"]) { + intercomContent = [IntercomContent conversationWithId:content[@"id"]]; + } + if (intercomContent) { + [Intercom presentContent:intercomContent]; + [self sendSuccess:command]; + } } -- (void)displayHelpCenterCollections:(CDVInvokedUrlCommand*)command { - NSDictionary *args = command.arguments[0]; - NSArray* collectionIds = args[@"collectionIds"]; - [Intercom presentHelpCenterCollections:collectionIds]; +- (void)presentMessageComposer:(CDVInvokedUrlCommand*)command { + NSString *initialMessage = command.arguments[0]; + [Intercom presentMessageComposer:initialMessage]; [self sendSuccess:command]; } +#pragma mark - Help Center Data API + - (void)fetchHelpCenterCollections:(CDVInvokedUrlCommand*)command { [Intercom fetchHelpCenterCollectionsWithCompletion:^(NSArray * _Nullable collections, NSError * _Nullable error) { if (error) { @@ -177,6 +211,9 @@ - (void)searchHelpCenter:(CDVInvokedUrlCommand*)command { }]; } + +#pragma mark - Intercom UI Visibility + - (void)hideIntercom:(CDVInvokedUrlCommand*)command { [Intercom hideIntercom]; [self sendSuccess:command]; @@ -202,6 +239,23 @@ - (void)setInAppMessageVisibility:(CDVInvokedUrlCommand*)command { [self sendSuccess:command]; } +- (void)setBottomPadding:(CDVInvokedUrlCommand*)command { + double bottomPadding = [[command.arguments objectAtIndex:0] doubleValue]; + [Intercom setBottomPadding:bottomPadding]; + [self sendSuccess:command]; +} + +#pragma mark - Unread Conversation Count + +- (void)unreadConversationCount:(CDVInvokedUrlCommand*)command { + NSUInteger count = [Intercom unreadConversationCount]; + CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsNSUInteger:count]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; +} + + +#pragma mark - Push Notifications + - (void)registerForPush:(CDVInvokedUrlCommand*)command { UIApplication *application = [UIApplication sharedApplication]; [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:(UNAuthorizationOptionAlert @@ -216,29 +270,9 @@ - (void)sendPushTokenToIntercom:(CDVInvokedUrlCommand*)command { NSLog(@"[Intercom-Cordova] INFO - sendPushTokenToIntercom called"); } -- (void)displayCarousel:(CDVInvokedUrlCommand*)command { - NSString *carouselId = command.arguments[0]; - [Intercom presentCarousel:carouselId]; - [self sendSuccess:command]; -} -- (void)displayArticle:(CDVInvokedUrlCommand*)command { - NSString *articleId = command.arguments[0]; - [Intercom presentArticle:articleId]; - [self sendSuccess:command]; -} -- (void)displaySurvey:(CDVInvokedUrlCommand*)command { - NSString *surveyId = command.arguments[0]; - [Intercom presentSurvey:surveyId]; - [self sendSuccess:command]; -} -- (void)setBottomPadding:(CDVInvokedUrlCommand*)command { - double bottomPadding = [[command.arguments objectAtIndex:0] doubleValue]; - [Intercom setBottomPadding:bottomPadding]; - [self sendSuccess:command]; -} #pragma mark - User attributes @@ -375,4 +409,49 @@ - (void)sendFailure:(CDVInvokedUrlCommand*)command withError:(NSError *)error { messageAsNSInteger:error.code]; [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; } + + +#pragma mark - Deprecate Methods + +- (void)displayMessenger:(CDVInvokedUrlCommand*)command { + [Intercom presentIntercom]; + [self sendSuccess:command]; +} + +- (void)displayMessageComposer:(CDVInvokedUrlCommand*)command { + NSString *initialMessage = command.arguments[0]; + [Intercom presentMessageComposer:initialMessage]; + [self sendSuccess:command]; +} + + +- (void)displayHelpCenter:(CDVInvokedUrlCommand*)command { + [Intercom presentIntercom:helpCenter]; + [self sendSuccess:command]; +} + +- (void)displayHelpCenterCollections:(CDVInvokedUrlCommand*)command { + NSDictionary *args = command.arguments[0]; + NSArray* collectionIds = args[@"collectionIds"]; + [Intercom presentContent:[IntercomContent helpCenterCollectionsWithIds:collectionIds]]; + [self sendSuccess:command]; +} + +- (void)displayCarousel:(CDVInvokedUrlCommand*)command { + NSString *carouselId = command.arguments[0]; + [Intercom presentContent:[IntercomContent carouselWithId:carouselId]]; + [self sendSuccess:command]; +} + +- (void)displayArticle:(CDVInvokedUrlCommand*)command { + NSString *articleId = command.arguments[0]; + [Intercom presentContent:[IntercomContent articleWithId:articleId]]; + [self sendSuccess:command]; +} + +- (void)displaySurvey:(CDVInvokedUrlCommand*)command { + NSString *surveyId = command.arguments[0]; + [Intercom presentContent:[IntercomContent surveyWithId:surveyId]]; + [self sendSuccess:command]; +} @end diff --git a/intercom-plugin/www/intercom.js b/intercom-plugin/www/intercom.js index 8890318..a22705a 100644 --- a/intercom-plugin/www/intercom.js +++ b/intercom-plugin/www/intercom.js @@ -1,28 +1,22 @@ + + +const Space = { + Home: "HOME", + HelpCenter: "HELP_CENTER", + Messages: "MESSAGES", + Tickets: "TICKETS" +} + var intercom = { - registerIdentifiedUser: function(options, success, error) { - cordova.exec(success, error, 'Intercom', 'loginUserWithUserAttributes', [options]); - console.warn('registerIdentifiedUser() is deprecated and will be removed in a future release. Please use loginUserWithUserAttributes()'); - }, - loginUserWithUserAttributes: function(options, success, error) { cordova.exec(success, error, 'Intercom', 'loginUserWithUserAttributes', [options]); }, - - registerUnidentifiedUser: function(options, success, error) { - cordova.exec(success, error, 'Intercom', 'loginUnidentifiedUser', []); - console.warn('registerUnidentifiedUser() is deprecated and will be removed in a future release. Please use loginUnidentifiedUser()'); - }, loginUnidentifiedUser: function(options, success, error) { cordova.exec(success, error, 'Intercom', 'loginUnidentifiedUser', []); }, - reset: function(success, error) { - cordova.exec(success, error, 'Intercom', 'logout', []); - console.warn('reset() is deprecated and will be removed in a future release. Please use logout()'); - }, - logout: function(success, error) { cordova.exec(success, error, 'Intercom', 'logout', []); }, @@ -39,27 +33,24 @@ var intercom = { cordova.exec(success, error, 'Intercom', 'logEvent', [eventName, metaData]); }, - displayMessenger: function(success, error) { - cordova.exec(success, error, 'Intercom', 'displayMessenger', []); + present: function(success, error) { + cordova.exec(success, error, 'Intercom', 'present', []); }, - displayMessageComposer: function(success, error) { - cordova.exec(success, error, 'Intercom', 'displayMessageComposer', []); - console.warn('displayMessageComposer() is deprecated and will be removed in a future release. Please use displayMessageComposer(initialMessage)') + presentSpace: function(space, success, error) { + cordova.exec(success, error, 'Intercom', 'present', [space]); }, - displayMessageComposerWithInitialMessage: function(initialMessage, success, error) { - cordova.exec(success, error, 'Intercom', 'displayMessageComposer', [initialMessage]); - console.warn('displayMessageComposerWithInitialMessage(initialMessage) is deprecated and will be removed in a future release. Please use displayMessageComposer(initialMessage)') + presentContent: function(content, success, error) { + cordova.exec(success, error, 'Intercom', 'presentContent', [content]); }, + displayMessageComposer: function(initialMessage, success, error) { cordova.exec(success, error, 'Intercom', 'displayMessageComposer', [initialMessage]); }, - displayHelpCenter: function(success, error) { - cordova.exec(success, error, 'Intercom', 'displayHelpCenter', []); - }, + fetchHelpCenterCollections: function(success, error) { cordova.exec(success, error, 'Intercom', 'fetchHelpCenterCollections', []); @@ -118,7 +109,49 @@ var intercom = { setBottomPadding: function(bottomPadding, success, error) { cordova.exec(success, error, 'Intercom', 'setBottomPadding', [bottomPadding]); - } + }, + + + + /** + * @deprecated + */ + registerIdentifiedUser: function(options, success, error) { + cordova.exec(success, error, 'Intercom', 'loginUserWithUserAttributes', [options]); + console.warn('registerIdentifiedUser() is deprecated and will be removed in a future release. Please use loginUserWithUserAttributes()'); + }, + + registerUnidentifiedUser: function(options, success, error) { + cordova.exec(success, error, 'Intercom', 'loginUnidentifiedUser', []); + console.warn('registerUnidentifiedUser() is deprecated and will be removed in a future release. Please use loginUnidentifiedUser()'); + }, + + reset: function(success, error) { + cordova.exec(success, error, 'Intercom', 'logout', []); + console.warn('reset() is deprecated and will be removed in a future release. Please use logout()'); + }, + + displayMessenger: function(success, error) { + cordova.exec(success, error, 'Intercom', 'displayMessenger', []); + }, + + displayHelpCenter: function(success, error) { + cordova.exec(success, error, 'Intercom', 'displayHelpCenter', []); + }, + + displayMessageComposerWithInitialMessage: function(initialMessage, success, error) { + cordova.exec(success, error, 'Intercom', 'displayMessageComposer', [initialMessage]); + console.warn('displayMessageComposerWithInitialMessage(initialMessage) is deprecated and will be removed in a future release. Please use displayMessageComposer(initialMessage)') + }, + + displayMessageComposer: function(success, error) { + cordova.exec(success, error, 'Intercom', 'displayMessageComposer', []); + console.warn('displayMessageComposer() is deprecated and will be removed in a future release. Please use displayMessageComposer(initialMessage)') + }, + + getCarouselWithId: function(carouselId) { + return IntercomContent.carouselWithCarouselId(carouselId) + }, } module.exports = intercom; diff --git a/intercom-plugin/www/intercomContent.js b/intercom-plugin/www/intercomContent.js new file mode 100644 index 0000000..e863692 --- /dev/null +++ b/intercom-plugin/www/intercomContent.js @@ -0,0 +1,46 @@ +const ContentType = { + Article: "ARTICLE", + Carousel: "CAROUSEL", + Survey: "SURVEY", + HelpCenterCollections: "HELP_CENTER_COLLECTIONS", + Conversation: "CONVERSATION" +} + +var IntercomContent = { + articleWithArticleId(articleId) { + let articleContent = {}; + articleContent.type = ContentType.Article; + articleContent.id = articleId; + return articleContent; + }, + + carouselWithCarouselId(carouselId) { + let carouselContent = {}; + carouselContent.type = ContentType.Carousel; + carouselContent.id = carouselId; + return carouselContent; + }, + + surveyWithSurveyId(surveyId) { + let surveyContent = {}; + surveyContent.type = ContentType.Survey; + surveyContent.id = surveyId; + return surveyContent; + }, + + helpCenterCollectionsWithIds(collectionIds) { + let helpCenterCollectionsContent = {}; + helpCenterCollectionsContent.type = ContentType.HelpCenterCollections; + helpCenterCollectionsContent.ids = collectionIds; + return helpCenterCollectionsContent; + }, + + conversationWithConversationId(conversationId) { + let conversationContent = {}; + conversationContent.type = ContentType.Conversation; + conversationContent.id = conversationId; + return conversationContent; + }, + }; + + module.exports = IntercomContent; \ No newline at end of file diff --git a/runiOSSample.sh b/runiOSSample.sh index b507e4f..ac1ca88 100755 --- a/runiOSSample.sh +++ b/runiOSSample.sh @@ -4,4 +4,4 @@ cordova plugin remove ../intercom-plugin cordova plugin add ../intercom-plugin cordova platform remove ios cordova platform add ios --save -cordova run ios --stacktrace \ No newline at end of file +#cordova run ios --stacktrace From b795cb99eeff5116dca570befd075df78494cbef Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Mon, 27 May 2024 17:11:26 +0100 Subject: [PATCH 02/18] Updated JS - Updated JS documention - Removed deprecated methods --- .gitignore | 1 + intercom-plugin/src/ios/IntercomBridge.m | 46 ----- intercom-plugin/www/intercom.js | 209 +++++++++++++++++++---- 3 files changed, 178 insertions(+), 78 deletions(-) diff --git a/.gitignore b/.gitignore index e871543..d62f578 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .DS_Store Example/node_modules +intercom-cordova.code-workspace diff --git a/intercom-plugin/src/ios/IntercomBridge.m b/intercom-plugin/src/ios/IntercomBridge.m index 2e59c01..b362c49 100644 --- a/intercom-plugin/src/ios/IntercomBridge.m +++ b/intercom-plugin/src/ios/IntercomBridge.m @@ -82,8 +82,6 @@ - (void)logout:(CDVInvokedUrlCommand*)command { [self sendSuccess:command]; } - - - (void)updateUser:(CDVInvokedUrlCommand*)command { NSDictionary* attributesDict = command.arguments[0]; [Intercom updateUser:[self userAttributesForDictionary:attributesDict] success:^{ @@ -410,48 +408,4 @@ - (void)sendFailure:(CDVInvokedUrlCommand*)command withError:(NSError *)error { [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; } - -#pragma mark - Deprecate Methods - -- (void)displayMessenger:(CDVInvokedUrlCommand*)command { - [Intercom presentIntercom]; - [self sendSuccess:command]; -} - -- (void)displayMessageComposer:(CDVInvokedUrlCommand*)command { - NSString *initialMessage = command.arguments[0]; - [Intercom presentMessageComposer:initialMessage]; - [self sendSuccess:command]; -} - - -- (void)displayHelpCenter:(CDVInvokedUrlCommand*)command { - [Intercom presentIntercom:helpCenter]; - [self sendSuccess:command]; -} - -- (void)displayHelpCenterCollections:(CDVInvokedUrlCommand*)command { - NSDictionary *args = command.arguments[0]; - NSArray* collectionIds = args[@"collectionIds"]; - [Intercom presentContent:[IntercomContent helpCenterCollectionsWithIds:collectionIds]]; - [self sendSuccess:command]; -} - -- (void)displayCarousel:(CDVInvokedUrlCommand*)command { - NSString *carouselId = command.arguments[0]; - [Intercom presentContent:[IntercomContent carouselWithId:carouselId]]; - [self sendSuccess:command]; -} - -- (void)displayArticle:(CDVInvokedUrlCommand*)command { - NSString *articleId = command.arguments[0]; - [Intercom presentContent:[IntercomContent articleWithId:articleId]]; - [self sendSuccess:command]; -} - -- (void)displaySurvey:(CDVInvokedUrlCommand*)command { - NSString *surveyId = command.arguments[0]; - [Intercom presentContent:[IntercomContent surveyWithId:surveyId]]; - [self sendSuccess:command]; -} @end diff --git a/intercom-plugin/www/intercom.js b/intercom-plugin/www/intercom.js index a22705a..5348f92 100644 --- a/intercom-plugin/www/intercom.js +++ b/intercom-plugin/www/intercom.js @@ -9,65 +9,140 @@ const Space = { var intercom = { + /** + * Login a user with identifiable information. + * Valid identifiers are `userId` and `email` which must be set in an object. + * @param options The object that contains the user's `email` or `userId`. + */ loginUserWithUserAttributes: function(options, success, error) { cordova.exec(success, error, 'Intercom', 'loginUserWithUserAttributes', [options]); }, + /** + * Login a unidentified user. + * This is a user that doesn't have any identifiable information such as a `userId` or `email`. + */ loginUnidentifiedUser: function(options, success, error) { cordova.exec(success, error, 'Intercom', 'loginUnidentifiedUser', []); }, + /** + * Log a user out of their Intercom session. + * This will dismiss any Intercom UI and clear Intercom's local cache. + */ logout: function(success, error) { cordova.exec(success, error, 'Intercom', 'logout', []); }, + /** + * Set `hash` string if you are using Identity Verification for your Intercom workspace. + * @note This should be called before any user login takes place. + * + * Identity Verification helps to make sure that conversations between you and your users are kept private, and that one + * user can't impersonate another. If Identity Verification is enabled for your app, Intercom will sign all requests + * going to the Intercom servers with tokens. It requires your mobile application to have its own server which authenticates the app's users, + * and which can store a secret. + * + * @see More information on Identity Verification can be found {@link https://developers.intercom.com/installing-intercom/cordova-phonegap/identity-verification/ here} + * @param secureHash A HMAC digest of the user ID or email. + */ setUserHash: function(secureHash, success, error) { cordova.exec(success, error, 'Intercom', 'setUserHash', [secureHash]); }, + /** + * Update a user in Intercom with data specified in an object. + * + * @param attributes The object with the user data. + */ updateUser: function(attributes, success, error) { cordova.exec(success, error, 'Intercom', 'updateUser', [attributes]); }, + /** + * Log an event with a given name and metaData. + * You can log events in Intercom based on user actions in your app. + * + * @param eventName The name of the event. + * @param metaData Metadata Objects support a few simple types that Intercom can present on your behalf, + * see the @{https://developers.intercom.com/docs/references/rest-api/api.intercom.io/Data-Events/data_event/ Intercom API docs} + */ logEvent: function(eventName, metaData, success, error) { cordova.exec(success, error, 'Intercom', 'logEvent', [eventName, metaData]); }, + /** + * Present Intercom as a modal overlay in your app. + * The `Home` space is displayed by default. + */ present: function(success, error) { cordova.exec(success, error, 'Intercom', 'present', []); }, + /** + * Present an Intercom `space` as a modal overlay in your app + * @see {@link Space} for a list of valid spaces. + * + * @param space The Intercom space to be presented. + */ presentSpace: function(space, success, error) { - cordova.exec(success, error, 'Intercom', 'present', [space]); + cordova.exec(success, error, 'Intercom', 'presentIntercomSpace', [space]); }, + /** + * Present Intercom content. + * + * An IntercomContent object. + */ presentContent: function(content, success, error) { cordova.exec(success, error, 'Intercom', 'presentContent', [content]); }, - + /** + * Present the message composer. + * + * @param initialMessage An optional message that is used to pre-populate the composer with some text. + */ displayMessageComposer: function(initialMessage, success, error) { cordova.exec(success, error, 'Intercom', 'displayMessageComposer', [initialMessage]); }, - - + /** + * Fetch all Help Center collections. + * + * @return An array of HelpCenterCollection objects. + */ fetchHelpCenterCollections: function(success, error) { cordova.exec(success, error, 'Intercom', 'fetchHelpCenterCollections', []); }, - searchHelpCenter: function(searchTerm, success, error) { - cordova.exec(success, error, 'Intercom', 'searchHelpCenter', [searchTerm]); - }, - + /** + * Fetch the contents of a Help Center collection. + * + * @param collectionId The ID of the Help Center collection. + * + * @return A HelpCenterCollectionContent object. + */ fetchHelpCenterCollection: function(collectionId, success, error) { cordova.exec(success, error, 'Intercom', 'fetchHelpCenterCollection', [collectionId]); }, - displayHelpCenterCollections: function(collectionIds, success, error) { - cordova.exec(success, error, 'Intercom', 'displayHelpCenterCollections', [collectionIds]); + /** + * Search the Help Center. + * + * @param searchTerm The search term. + * + * @return An array of HelpCenterArticleSearchResult objects. + */ + searchHelpCenter: function(searchTerm, success, error) { + cordova.exec(success, error, 'Intercom', 'searchHelpCenter', [searchTerm]); }, + + /** + * Fetch the current number of unread conversations for the logged in User. + * @return The number of unread conversations. + */ unreadConversationCount: function(success, error) { cordova.exec(success, error, 'Intercom', 'unreadConversationCount', []); }, @@ -75,43 +150,60 @@ var intercom = { VISIBLE : "VISIBLE", GONE : "GONE", + /** + * Show or hide the Intercom Launcher in your app. + * @note The Launcher is hidden by default. + * + * @param visibility A boolean indicating if the Intercom Launcher should be visible. + */ setLauncherVisibility: function(visibility, success, error) { cordova.exec(success, error, 'Intercom', 'setLauncherVisibility', [visibility]); }, + /** + * Show or hide the Intercom InApp Messages in your app. + * @note All InApp Messages are visible by default. + * + * @param visibility A boolean indicating if the InApps should be visible. + */ setInAppMessageVisibility: function(visibility, success, error) { cordova.exec(success, error, 'Intercom', 'setInAppMessageVisibility', [visibility]); }, + /** + * Hide all Intercom windows that are currently displayed. + * This will hide the Messenger, Help Center, Articles, and in-product messages (eg. Mobile Carousels, chats, and posts). + */ hideIntercom: function(success, error) { cordova.exec(success, error, 'Intercom', 'hideIntercom', []); }, + /** + * Set a fixed bottom padding for in app messages and the Intercom Launcher. + * @param bottomPadding The size of the bottom padding in points. + */ + setBottomPadding: function(bottomPadding, success, error) { + cordova.exec(success, error, 'Intercom', 'setBottomPadding', [bottomPadding]); + }, + + /** + * Register for push notifications + * @note This function is only available for iOS. + */ registerForPush: function(success, error) { cordova.exec(success, error, 'Intercom', 'registerForPush', []); }, + /** + * Send a device token to Intercom to enable push notifications to be sent to the User. + * @param token The device token to send to the server. + * + * @note This function is only available for Android. + */ sendPushTokenToIntercom: function(token, success, error) { cordova.exec(success, error, 'Intercom', 'sendPushTokenToIntercom', [token]); }, - - displayCarousel: function(carouselId, success, error) { - cordova.exec(success, error, 'Intercom', 'displayCarousel', [carouselId]); - }, - - displayArticle: function(articleId, success, error) { - cordova.exec(success, error, 'Intercom', 'displayArticle', [articleId]); - }, - - displaySurvey: function(surveyId, success, error) { - cordova.exec(success, error, 'Intercom', 'displaySurvey', [surveyId]); - }, - - setBottomPadding: function(bottomPadding, success, error) { - cordova.exec(success, error, 'Intercom', 'setBottomPadding', [bottomPadding]); - }, - - + /** * @deprecated @@ -121,37 +213,90 @@ var intercom = { console.warn('registerIdentifiedUser() is deprecated and will be removed in a future release. Please use loginUserWithUserAttributes()'); }, + /** + * @deprecated + */ registerUnidentifiedUser: function(options, success, error) { cordova.exec(success, error, 'Intercom', 'loginUnidentifiedUser', []); console.warn('registerUnidentifiedUser() is deprecated and will be removed in a future release. Please use loginUnidentifiedUser()'); }, + /** + * @deprecated + */ reset: function(success, error) { cordova.exec(success, error, 'Intercom', 'logout', []); console.warn('reset() is deprecated and will be removed in a future release. Please use logout()'); }, + /** + * @deprecated + */ displayMessenger: function(success, error) { - cordova.exec(success, error, 'Intercom', 'displayMessenger', []); + cordova.exec(success, error, 'Intercom', 'present', []); + console.warn('displayMessenger() is deprecated and will be removed in a future release. Please use present()'); }, + /** + * @deprecated + */ displayHelpCenter: function(success, error) { - cordova.exec(success, error, 'Intercom', 'displayHelpCenter', []); + cordova.exec(success, error, 'Intercom', 'presentIntercomSpace', [Space.HelpCenter]); + console.warn('displayHelpCenter() is deprecated and will be removed in a future release. Please use present(intercom.Space.HelpCenter)'); }, + /** + * @deprecated + */ displayMessageComposerWithInitialMessage: function(initialMessage, success, error) { cordova.exec(success, error, 'Intercom', 'displayMessageComposer', [initialMessage]); console.warn('displayMessageComposerWithInitialMessage(initialMessage) is deprecated and will be removed in a future release. Please use displayMessageComposer(initialMessage)') }, + /** + * @deprecated + */ displayMessageComposer: function(success, error) { cordova.exec(success, error, 'Intercom', 'displayMessageComposer', []); console.warn('displayMessageComposer() is deprecated and will be removed in a future release. Please use displayMessageComposer(initialMessage)') }, + + /** + * @deprecated + */ + displayHelpCenterCollections: function(collectionIds, success, error) { + cordova.exec(success, error, 'Intercom', 'displayHelpCenterCollections', [collectionIds]); + console.warn('displayHelpCenterCollections() is deprecated and will be removed in a future release. Please use intercomContent.helpCenterCollectionsWithIds([ids])') + }, + + /** + * @deprecated + */ + displayCarousel: function(carouselId, success, error) { + var carousel = intercomContent.carouselWithCarouselId(carouselId) + cordova.exec(success, error, 'Intercom', 'presentContent', [carousel]); + console.warn('displayCarousel() is deprecated and will be removed in a future release. Please use intercom.presentContent(intercomContent.carouselWithCarouselId(carouselId));'); + }, + + /** + * @deprecated + */ + displayArticle: function(articleId, success, error) { + var article = intercomContent.articleWithArticleId(articleId) + cordova.exec(success, error, 'Intercom', 'presentContent', [article]); + console.warn('displayArticle() is deprecated and will be removed in a future release. Please use intercom.presentContent(intercomContent.articleWithArticleId(articleId));'); + }, - getCarouselWithId: function(carouselId) { - return IntercomContent.carouselWithCarouselId(carouselId) + /** + * @deprecated + */ + displaySurvey: function(surveyId, success, error) { + var survey = intercomContent.surveyWithSurveyId(surveyId) + cordova.exec(success, error, 'Intercom', 'presentContent', [survey]); + console.warn('displaySurvey() is deprecated and will be removed in a future release. Please use intercom.presentContent(intercomContent.surveyWithSurveyId(surveyId));'); + }, + } module.exports = intercom; From 7421b3f7932a35d4e513e434f648713329101785 Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Tue, 28 May 2024 16:33:08 +0100 Subject: [PATCH 03/18] Updated API --- intercom-plugin/www/intercom.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/intercom-plugin/www/intercom.js b/intercom-plugin/www/intercom.js index 5348f92..47ee783 100644 --- a/intercom-plugin/www/intercom.js +++ b/intercom-plugin/www/intercom.js @@ -103,8 +103,8 @@ var intercom = { * * @param initialMessage An optional message that is used to pre-populate the composer with some text. */ - displayMessageComposer: function(initialMessage, success, error) { - cordova.exec(success, error, 'Intercom', 'displayMessageComposer', [initialMessage]); + presentMessageComposer: function(initialMessage, success, error) { + cordova.exec(success, error, 'Intercom', 'presentMessageComposer', [initialMessage]); }, /** @@ -249,24 +249,25 @@ var intercom = { * @deprecated */ displayMessageComposerWithInitialMessage: function(initialMessage, success, error) { - cordova.exec(success, error, 'Intercom', 'displayMessageComposer', [initialMessage]); - console.warn('displayMessageComposerWithInitialMessage(initialMessage) is deprecated and will be removed in a future release. Please use displayMessageComposer(initialMessage)') + cordova.exec(success, error, 'Intercom', 'presentMessageComposer', [initialMessage]); + console.warn('displayMessageComposerWithInitialMessage(initialMessage) is deprecated and will be removed in a future release. Please use presentMessageComposer(initialMessage)') }, /** * @deprecated */ displayMessageComposer: function(success, error) { - cordova.exec(success, error, 'Intercom', 'displayMessageComposer', []); - console.warn('displayMessageComposer() is deprecated and will be removed in a future release. Please use displayMessageComposer(initialMessage)') + cordova.exec(success, error, 'Intercom', 'presentMessageComposer', []); + console.warn('displayMessageComposer() is deprecated and will be removed in a future release. Please use presentMessageComposer()') }, /** * @deprecated */ displayHelpCenterCollections: function(collectionIds, success, error) { - cordova.exec(success, error, 'Intercom', 'displayHelpCenterCollections', [collectionIds]); - console.warn('displayHelpCenterCollections() is deprecated and will be removed in a future release. Please use intercomContent.helpCenterCollectionsWithIds([ids])') + var collections = intercomContent.helpCenterCollectionsWithIds(collectionIds); + cordova.exec(success, error, 'Intercom', 'presentContent', [collections]); + console.warn('displayHelpCenterCollections() is deprecated and will be removed in a future release. Please use intercom.presentContent(intercomContent.helpCenterCollectionsWithIds([ids]))') }, /** @@ -300,3 +301,4 @@ var intercom = { } module.exports = intercom; + From b6de021394e6eec6b26355e978aba891d8f2d66e Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Tue, 28 May 2024 16:37:43 +0100 Subject: [PATCH 04/18] Updated seed data --- Example/config.xml | 4 ++-- Example/www/js/index.js | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Example/config.xml b/Example/config.xml index 16f5070..8e5d927 100644 --- a/Example/config.xml +++ b/Example/config.xml @@ -47,8 +47,8 @@ - - + + diff --git a/Example/www/js/index.js b/Example/www/js/index.js index e53937c..01212d6 100644 --- a/Example/www/js/index.js +++ b/Example/www/js/index.js @@ -59,7 +59,6 @@ var app = { }, false); document.getElementById("open-help-center-btn").addEventListener("click", function(){ - // intercom.displayHelpCenter(); intercom.presentSpace(intercom.Space.HelpCenter); }, false); @@ -110,17 +109,20 @@ var app = { }, false); document.getElementById("display-article-btn").addEventListener("click", function(){ - var article = intercomContent.articleWithArticleId('3969758') + // Replace this with your own article Id + var article = intercomContent.articleWithArticleId('ARTICLE_ID') intercom.presentContent(article); }, false); document.getElementById("display-survey-btn").addEventListener("click", function(){ - var survey = intercomContent.surveyWithSurveyId('23727915') + // Replace this with your own survey Id + var survey = intercomContent.surveyWithSurveyId('SURVEY_ID') intercom.presentContent(survey); }, false); document.getElementById("display-conversation-btn").addEventListener("click", function(){ - var conversation = intercomContent.conversationWithConversationId('781200016661') + // Replace this with your own conversation Id + var conversation = intercomContent.conversationWithConversationId('CONVERSATION_ID') intercom.presentContent(conversation); }, false); }, From 0ac0d5766ca75396a3fb05fb0b1415bd7d4c8979 Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Tue, 28 May 2024 16:38:28 +0100 Subject: [PATCH 05/18] Update index.js --- Example/www/js/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Example/www/js/index.js b/Example/www/js/index.js index 01212d6..916abc3 100644 --- a/Example/www/js/index.js +++ b/Example/www/js/index.js @@ -104,7 +104,8 @@ var app = { }, false); document.getElementById("display-carousel-btn").addEventListener("click", function(){ - var carousel = intercomContent.carouselWithCarouselId('32136001') + // Replace this with your own carousel Id + var carousel = intercomContent.carouselWithCarouselId('CAROUSEL_ID') intercom.presentContent(carousel) }, false); From ec63c3a0d249de3c842fc8329bd0903cc93461be Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Tue, 28 May 2024 16:46:14 +0100 Subject: [PATCH 06/18] Updated API and version numbers --- Example/www/js/index.js | 12 +++--- intercom-plugin/plugin.xml | 4 +- intercom-plugin/src/ios/IntercomBridge.h | 51 +++++++++--------------- runiOSSample.sh | 2 +- 4 files changed, 27 insertions(+), 42 deletions(-) diff --git a/Example/www/js/index.js b/Example/www/js/index.js index 916abc3..53d199b 100644 --- a/Example/www/js/index.js +++ b/Example/www/js/index.js @@ -104,8 +104,8 @@ var app = { }, false); document.getElementById("display-carousel-btn").addEventListener("click", function(){ - // Replace this with your own carousel Id - var carousel = intercomContent.carouselWithCarouselId('CAROUSEL_ID') + // Replace this with your own carousel Id + var carousel = intercomContent.carouselWithCarouselId('CAROUSEL_ID') intercom.presentContent(carousel) }, false); @@ -116,15 +116,15 @@ var app = { }, false); document.getElementById("display-survey-btn").addEventListener("click", function(){ - // Replace this with your own survey Id + // Replace this with your own survey Id var survey = intercomContent.surveyWithSurveyId('SURVEY_ID') intercom.presentContent(survey); }, false); document.getElementById("display-conversation-btn").addEventListener("click", function(){ - // Replace this with your own conversation Id - var conversation = intercomContent.conversationWithConversationId('CONVERSATION_ID') - intercom.presentContent(conversation); + // Replace this with your own conversation Id + var conversation = intercomContent.conversationWithConversationId('CONVERSATION_ID') + intercom.presentContent(conversation); }, false); }, // Update DOM on a Received Event diff --git a/intercom-plugin/plugin.xml b/intercom-plugin/plugin.xml index a33d419..1a53004 100644 --- a/intercom-plugin/plugin.xml +++ b/intercom-plugin/plugin.xml @@ -1,5 +1,5 @@ - + Intercom Intercom MIT License @@ -68,7 +68,7 @@ - + diff --git a/intercom-plugin/src/ios/IntercomBridge.h b/intercom-plugin/src/ios/IntercomBridge.h index 1fc901b..67915d3 100644 --- a/intercom-plugin/src/ios/IntercomBridge.h +++ b/intercom-plugin/src/ios/IntercomBridge.h @@ -4,58 +4,43 @@ @interface IntercomBridge : CDVPlugin +#pragma mark - User Login + - (void)loginUserWithUserAttributes:(CDVInvokedUrlCommand*)command; - (void)loginUnidentifiedUser:(CDVInvokedUrlCommand*)command; - (void)logout:(CDVInvokedUrlCommand*)command; - - (void)setUserHash:(CDVInvokedUrlCommand*)command; - - (void)updateUser:(CDVInvokedUrlCommand*)command; + +#pragma mark - Events + - (void)logEvent:(CDVInvokedUrlCommand*)command; -- (void)unreadConversationCount:(CDVInvokedUrlCommand*)command; +#pragma mark - Present Intercom UI +- (void)present:(CDVInvokedUrlCommand*)command; +- (void)presentIntercomSpace:(CDVInvokedUrlCommand*)command; +- (void)presentContent:(CDVInvokedUrlCommand*)command; +- (void)presentMessageComposer:(CDVInvokedUrlCommand*)command; + +#pragma mark - Help Center Data API - (void)fetchHelpCenterCollections:(CDVInvokedUrlCommand*)command; - (void)fetchHelpCenterCollection:(CDVInvokedUrlCommand*)command; - (void)searchHelpCenter:(CDVInvokedUrlCommand*)command; +#pragma mark - Intercom UI Visibility + - (void)setLauncherVisibility:(CDVInvokedUrlCommand*)command; - (void)setBottomPadding:(CDVInvokedUrlCommand*)command; - (void)setInAppMessageVisibility:(CDVInvokedUrlCommand*)command; - (void)hideIntercom:(CDVInvokedUrlCommand*)command; +#pragma mark - Unread Conversation Count -- (void)registerForPush:(CDVInvokedUrlCommand*)command; +- (void)unreadConversationCount:(CDVInvokedUrlCommand*)command; -#pragma mark - Deprecated Methods -/** - @deprecated - */ -- (void)displayMessenger:(CDVInvokedUrlCommand*)command DEPRECATED_MSG_ATTRIBUTE("'+[Intercom displayMessenger]' is deprecated and will be removed in a future release. 'Use +[Intercom presentIntercom]' instead.");; -/** - @deprecated - */ -- (void)displayMessageComposer:(CDVInvokedUrlCommand*)command; -/** - @deprecated - */ -- (void)displayHelpCenter:(CDVInvokedUrlCommand*)command; -/** - @deprecated - */ -- (void)displayHelpCenterCollections:(CDVInvokedUrlCommand*)command; -/** - @deprecated - */ -- (void)displayCarousel:(CDVInvokedUrlCommand*)command; -/** - @deprecated - */ -- (void)displayArticle:(CDVInvokedUrlCommand*)command; -/** - @deprecated - */ -- (void)displaySurvey:(CDVInvokedUrlCommand*)command; +#pragma mark - Push Notifications +- (void)registerForPush:(CDVInvokedUrlCommand*)command; @end diff --git a/runiOSSample.sh b/runiOSSample.sh index ac1ca88..d990a4f 100755 --- a/runiOSSample.sh +++ b/runiOSSample.sh @@ -4,4 +4,4 @@ cordova plugin remove ../intercom-plugin cordova plugin add ../intercom-plugin cordova platform remove ios cordova platform add ios --save -#cordova run ios --stacktrace +cordova run ios --stacktrace From 74252c152f7593e1c116f57b74848585da961f59 Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Wed, 29 May 2024 10:52:50 +0100 Subject: [PATCH 07/18] formatted code --- intercom-plugin/www/intercom.js | 10 +-- intercom-plugin/www/intercomContent.js | 84 +++++++++++++------------- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/intercom-plugin/www/intercom.js b/intercom-plugin/www/intercom.js index 47ee783..e60066e 100644 --- a/intercom-plugin/www/intercom.js +++ b/intercom-plugin/www/intercom.js @@ -1,11 +1,11 @@ const Space = { - Home: "HOME", - HelpCenter: "HELP_CENTER", - Messages: "MESSAGES", - Tickets: "TICKETS" -} + Home: "HOME", + HelpCenter: "HELP_CENTER", + Messages: "MESSAGES", + Tickets: "TICKETS", +}; var intercom = { diff --git a/intercom-plugin/www/intercomContent.js b/intercom-plugin/www/intercomContent.js index e863692..00cb3f0 100644 --- a/intercom-plugin/www/intercomContent.js +++ b/intercom-plugin/www/intercomContent.js @@ -1,46 +1,46 @@ const ContentType = { - Article: "ARTICLE", - Carousel: "CAROUSEL", - Survey: "SURVEY", - HelpCenterCollections: "HELP_CENTER_COLLECTIONS", - Conversation: "CONVERSATION" -} + Article: "ARTICLE", + Carousel: "CAROUSEL", + Survey: "SURVEY", + HelpCenterCollections: "HELP_CENTER_COLLECTIONS", + Conversation: "CONVERSATION", +}; var IntercomContent = { - articleWithArticleId(articleId) { - let articleContent = {}; - articleContent.type = ContentType.Article; - articleContent.id = articleId; - return articleContent; - }, - - carouselWithCarouselId(carouselId) { - let carouselContent = {}; - carouselContent.type = ContentType.Carousel; - carouselContent.id = carouselId; - return carouselContent; - }, - - surveyWithSurveyId(surveyId) { - let surveyContent = {}; - surveyContent.type = ContentType.Survey; - surveyContent.id = surveyId; - return surveyContent; - }, - - helpCenterCollectionsWithIds(collectionIds) { - let helpCenterCollectionsContent = {}; - helpCenterCollectionsContent.type = ContentType.HelpCenterCollections; - helpCenterCollectionsContent.ids = collectionIds; - return helpCenterCollectionsContent; - }, - - conversationWithConversationId(conversationId) { - let conversationContent = {}; - conversationContent.type = ContentType.Conversation; - conversationContent.id = conversationId; - return conversationContent; - }, - }; + articleWithArticleId(articleId) { + let articleContent = {}; + articleContent.type = ContentType.Article; + articleContent.id = articleId; + return articleContent; + }, - module.exports = IntercomContent; \ No newline at end of file + carouselWithCarouselId(carouselId) { + let carouselContent = {}; + carouselContent.type = ContentType.Carousel; + carouselContent.id = carouselId; + return carouselContent; + }, + + surveyWithSurveyId(surveyId) { + let surveyContent = {}; + surveyContent.type = ContentType.Survey; + surveyContent.id = surveyId; + return surveyContent; + }, + + helpCenterCollectionsWithIds(collectionIds) { + let helpCenterCollectionsContent = {}; + helpCenterCollectionsContent.type = ContentType.HelpCenterCollections; + helpCenterCollectionsContent.ids = collectionIds; + return helpCenterCollectionsContent; + }, + + conversationWithConversationId(conversationId) { + let conversationContent = {}; + conversationContent.type = ContentType.Conversation; + conversationContent.id = conversationId; + return conversationContent; + }, +}; + +module.exports = IntercomContent; From c3ddeeb2b8d58963f001d6fb6b25c377a0de9724 Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Wed, 29 May 2024 11:26:26 +0100 Subject: [PATCH 08/18] Updated Android config --- circle.yml | 8 ++++---- intercom-plugin/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/circle.yml b/circle.yml index 519111b..d854929 100644 --- a/circle.yml +++ b/circle.yml @@ -26,9 +26,9 @@ jobs: android: docker: - - image: circleci/android:api-30 + - image: cimg/android:2023.09 environment: - - JVM_OPTS: -Xmx3200m + GRADLE_OPTS: -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -Dorg.gradle.daemon=false -Dorg.gradle.caching=true -Dorg.gradle.configureondemand=true -Dkotlin.compiler.execution.strategy=in-process -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-XX:MaxMetaspaceSize=512m" -Dorg.gradle.workers.max=2 working_directory: ~/project/Example steps: - checkout @@ -47,10 +47,10 @@ jobs: command: sudo apt-get install gradle - run: name: Install Cordova - command: sudo npm install -g cordova@9.0.0 + command: sudo npm install -g cordova@12.0.0 - run: name: Add Android platform - command: cd Example && cordova platform add android@10.0.0 + command: cd Example && cordova platform add android@13.0.0 - run: name: Install intercom plugin command: cd Example && cordova plugin add ../intercom-plugin diff --git a/intercom-plugin/package.json b/intercom-plugin/package.json index d60e020..502c9e2 100644 --- a/intercom-plugin/package.json +++ b/intercom-plugin/package.json @@ -27,7 +27,7 @@ }, { "name": "cordova-android", - "version": ">=10.0.0" + "version": ">=13.0.0" }, { "name": "cordova-ios", From 5508545eef2345877d29294452ef5e2099947523 Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Wed, 29 May 2024 11:43:24 +0100 Subject: [PATCH 09/18] Update circle.yml --- circle.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/circle.yml b/circle.yml index d854929..c9aaba2 100644 --- a/circle.yml +++ b/circle.yml @@ -1,4 +1,7 @@ -version: 2 +version: 2.1 + +orbs: + node: circleci/node@5.2.0 jobs: ios: @@ -36,12 +39,11 @@ jobs: name: Accept all Android licenses command: | yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses || if [ $? -ne '141' ]; then exit $?; fi; - - run: + - run: name: Install node/npm - command: | - curl -O https://packages.cloud.google.com/apt/doc/apt-key.gpg && sudo apt-key add apt-key.gpg - curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash - - sudo apt install -y nodejs + command: sudo npm install -g npm@latest + - node/install-packages: + cache-path: ~/project/node_modules - run: name: Install gradle command: sudo apt-get install gradle @@ -60,15 +62,14 @@ jobs: publish: docker: - - image: circleci/android:api-28 + - image: cimg/android:2023.09 steps: - checkout - - run: + - run: name: Install node/npm - command: | - curl -O https://packages.cloud.google.com/apt/doc/apt-key.gpg && sudo apt-key add apt-key.gpg - curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash - - sudo apt install -y nodejs + command: sudo npm install -g npm@latest + - node/install-packages: + cache-path: ~/project/node_modules - run: name: Publish to npm command: | From ae08c9a07d03bcfb69fbaed574abc3012ff975ae Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Wed, 29 May 2024 11:51:45 +0100 Subject: [PATCH 10/18] Update circle.yml --- circle.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/circle.yml b/circle.yml index c9aaba2..c71936d 100644 --- a/circle.yml +++ b/circle.yml @@ -1,13 +1,10 @@ version: 2.1 -orbs: - node: circleci/node@5.2.0 - jobs: ios: macos: - xcode: "13.4.1" - resource_class: macos.x86.medium.gen2 + xcode: "15.4.0" + resource_class: macos.m1.large.gen1 shell: /bin/bash --login -eo pipefail steps: - checkout @@ -39,11 +36,9 @@ jobs: name: Accept all Android licenses command: | yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses || if [ $? -ne '141' ]; then exit $?; fi; - - run: + - run: name: Install node/npm - command: sudo npm install -g npm@latest - - node/install-packages: - cache-path: ~/project/node_modules + command: command -v node || brew install node - run: name: Install gradle command: sudo apt-get install gradle @@ -52,7 +47,7 @@ jobs: command: sudo npm install -g cordova@12.0.0 - run: name: Add Android platform - command: cd Example && cordova platform add android@13.0.0 + command: cd Example && cordova platform add android@latest - run: name: Install intercom plugin command: cd Example && cordova plugin add ../intercom-plugin @@ -78,7 +73,7 @@ jobs: cd intercom-plugin && npm publish workflows: - version: 2 + version: 2.1 ios_and_android: jobs: - ios: From 90f4d2b27e0db4ec0734505f09ff7ee6a95e7be9 Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Wed, 29 May 2024 11:52:45 +0100 Subject: [PATCH 11/18] Update circle.yml --- circle.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/circle.yml b/circle.yml index c71936d..44fd50c 100644 --- a/circle.yml +++ b/circle.yml @@ -60,11 +60,9 @@ jobs: - image: cimg/android:2023.09 steps: - checkout - - run: + - run: name: Install node/npm - command: sudo npm install -g npm@latest - - node/install-packages: - cache-path: ~/project/node_modules + command: command -v node || brew install node - run: name: Publish to npm command: | From c44c49f15b82cff5bce802855a65c47ecd77cff3 Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Wed, 29 May 2024 12:00:35 +0100 Subject: [PATCH 12/18] Update circle.yml --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 44fd50c..5a01fc6 100644 --- a/circle.yml +++ b/circle.yml @@ -60,7 +60,7 @@ jobs: - image: cimg/android:2023.09 steps: - checkout - - run: + - run: name: Install node/npm command: command -v node || brew install node - run: From b012a37557872e8f7b10a7a31cd443c15d8ce06c Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Wed, 29 May 2024 12:05:52 +0100 Subject: [PATCH 13/18] Update circle.yml --- circle.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/circle.yml b/circle.yml index 5a01fc6..94f5d21 100644 --- a/circle.yml +++ b/circle.yml @@ -1,5 +1,10 @@ version: 2.1 +setup_ruby: &setup_ruby + run: + name: Setup Ruby + command: sed -i '' 's/.*chruby ruby.*/chruby ruby-3.2.2/' ~/.bash_profile + jobs: ios: macos: @@ -7,6 +12,7 @@ jobs: resource_class: macos.m1.large.gen1 shell: /bin/bash --login -eo pipefail steps: + - <<: *setup_ruby - checkout - run: name: Install node/npm From 214cf109e7a76c2d466e6c36c6dd0c166eca9526 Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Wed, 29 May 2024 16:03:21 +0100 Subject: [PATCH 14/18] updated ruby version --- Example/.ruby-version | 2 +- circle.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Example/.ruby-version b/Example/.ruby-version index be94e6f..b347b11 100644 --- a/Example/.ruby-version +++ b/Example/.ruby-version @@ -1 +1 @@ -3.2.2 +3.2.3 diff --git a/circle.yml b/circle.yml index 94f5d21..cb2a047 100644 --- a/circle.yml +++ b/circle.yml @@ -3,7 +3,7 @@ version: 2.1 setup_ruby: &setup_ruby run: name: Setup Ruby - command: sed -i '' 's/.*chruby ruby.*/chruby ruby-3.2.2/' ~/.bash_profile + command: sed -i '' 's/.*chruby ruby.*/chruby ruby-3.2.3/' ~/.bash_profile jobs: ios: @@ -28,7 +28,7 @@ jobs: command: cd Example && cordova plugin add ../intercom-plugin - run: name: Build - command: cd Example && cordova build ios --buildFlag="-UseModernBuildSystem=0" + command: cd Example && cordova build ios android: docker: From 4761e655c6fabac94f39426af1fe9afd70ff50fb Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Wed, 29 May 2024 17:17:12 +0100 Subject: [PATCH 15/18] update ruby --- Example/.ruby-version | 2 +- circle.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Example/.ruby-version b/Example/.ruby-version index b347b11..b98b3be 100644 --- a/Example/.ruby-version +++ b/Example/.ruby-version @@ -1 +1 @@ -3.2.3 + 3.3.0 diff --git a/circle.yml b/circle.yml index cb2a047..b239918 100644 --- a/circle.yml +++ b/circle.yml @@ -3,7 +3,7 @@ version: 2.1 setup_ruby: &setup_ruby run: name: Setup Ruby - command: sed -i '' 's/.*chruby ruby.*/chruby ruby-3.2.3/' ~/.bash_profile + command: sed -i '' 's/.*chruby ruby.*/chruby ruby-3.3.0/' ~/.bash_profile jobs: ios: From b42b2c90133bb94f90e45228bf5d3eacbef427c8 Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Wed, 29 May 2024 17:28:17 +0100 Subject: [PATCH 16/18] Update circle.yml --- circle.yml | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/circle.yml b/circle.yml index b239918..b01d85e 100644 --- a/circle.yml +++ b/circle.yml @@ -1,5 +1,8 @@ version: 2.1 +orbs: + android: circleci/android@2.5.0 + setup_ruby: &setup_ruby run: name: Setup Ruby @@ -31,8 +34,8 @@ jobs: command: cd Example && cordova build ios android: - docker: - - image: cimg/android:2023.09 + executor: + name: android/android-machine environment: GRADLE_OPTS: -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -Dorg.gradle.daemon=false -Dorg.gradle.caching=true -Dorg.gradle.configureondemand=true -Dkotlin.compiler.execution.strategy=in-process -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-XX:MaxMetaspaceSize=512m" -Dorg.gradle.workers.max=2 working_directory: ~/project/Example @@ -42,12 +45,6 @@ jobs: name: Accept all Android licenses command: | yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses || if [ $? -ne '141' ]; then exit $?; fi; - - run: - name: Install node/npm - command: command -v node || brew install node - - run: - name: Install gradle - command: sudo apt-get install gradle - run: name: Install Cordova command: sudo npm install -g cordova@12.0.0 @@ -62,13 +59,10 @@ jobs: command: cd Example && cordova build android --verbose -- --gradleArg=--stacktrace publish: - docker: - - image: cimg/android:2023.09 + executor: + name: android/android-machine steps: - checkout - - run: - name: Install node/npm - command: command -v node || brew install node - run: name: Publish to npm command: | From 9e9e61fec050f4d19694112abf01db426e5e688c Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Wed, 29 May 2024 17:31:24 +0100 Subject: [PATCH 17/18] Update circle.yml --- circle.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/circle.yml b/circle.yml index b01d85e..751f51d 100644 --- a/circle.yml +++ b/circle.yml @@ -36,6 +36,8 @@ jobs: android: executor: name: android/android-machine + resource-class: large + tag: default environment: GRADLE_OPTS: -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -Dorg.gradle.daemon=false -Dorg.gradle.caching=true -Dorg.gradle.configureondemand=true -Dkotlin.compiler.execution.strategy=in-process -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-XX:MaxMetaspaceSize=512m" -Dorg.gradle.workers.max=2 working_directory: ~/project/Example @@ -61,6 +63,8 @@ jobs: publish: executor: name: android/android-machine + resource-class: large + tag: default steps: - checkout - run: From 05af5071d2b0039e1dc8c170379895f1540be6b7 Mon Sep 17 00:00:00 2001 From: Brian Boyle Date: Wed, 29 May 2024 17:36:13 +0100 Subject: [PATCH 18/18] Update circle.yml --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 751f51d..a67aacb 100644 --- a/circle.yml +++ b/circle.yml @@ -49,7 +49,7 @@ jobs: yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses || if [ $? -ne '141' ]; then exit $?; fi; - run: name: Install Cordova - command: sudo npm install -g cordova@12.0.0 + command: npm install -g cordova@12.0.0 - run: name: Add Android platform command: cd Example && cordova platform add android@latest