@capawesome/capacitor-intercom 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/CapawesomeCapacitorIntercom.podspec +19 -0
  2. package/LICENSE +21 -0
  3. package/Package.swift +30 -0
  4. package/README.md +932 -0
  5. package/android/build.gradle +60 -0
  6. package/android/src/main/AndroidManifest.xml +2 -0
  7. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/Intercom.java +441 -0
  8. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/IntercomHelper.java +38 -0
  9. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/IntercomPlugin.java +307 -0
  10. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/classes/CustomException.java +20 -0
  11. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/classes/CustomExceptions.java +23 -0
  12. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/classes/events/UnreadConversationCountChangeEvent.java +22 -0
  13. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/classes/options/HandlePushNotificationOptions.java +25 -0
  14. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/classes/options/InitializeOptions.java +34 -0
  15. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/classes/options/IsIntercomPushNotificationOptions.java +25 -0
  16. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/classes/options/LogEventOptions.java +35 -0
  17. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/classes/options/LoginUserOptions.java +33 -0
  18. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/classes/options/PresentContentOptions.java +71 -0
  19. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/classes/options/PresentMessageComposerOptions.java +20 -0
  20. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/classes/options/PresentOptions.java +19 -0
  21. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/classes/options/SendPushTokenToIntercomOptions.java +24 -0
  22. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/classes/options/SetBottomPaddingOptions.java +22 -0
  23. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/classes/options/SetInAppMessagesVisibleOptions.java +22 -0
  24. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/classes/options/SetLauncherVisibleOptions.java +22 -0
  25. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/classes/options/SetUserHashOptions.java +24 -0
  26. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/classes/options/SetUserJwtOptions.java +24 -0
  27. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/classes/options/UpdateUserOptions.java +108 -0
  28. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/classes/results/GetUnreadConversationCountResult.java +22 -0
  29. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/classes/results/IsIntercomPushNotificationResult.java +22 -0
  30. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/interfaces/Callback.java +5 -0
  31. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/interfaces/EmptyCallback.java +5 -0
  32. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/interfaces/NonEmptyResultCallback.java +7 -0
  33. package/android/src/main/java/io/capawesome/capacitorjs/plugins/intercom/interfaces/Result.java +7 -0
  34. package/android/src/main/res/.gitkeep +0 -0
  35. package/dist/docs.json +1345 -0
  36. package/dist/esm/definitions.d.ts +549 -0
  37. package/dist/esm/definitions.js +27 -0
  38. package/dist/esm/definitions.js.map +1 -0
  39. package/dist/esm/index.d.ts +4 -0
  40. package/dist/esm/index.js +7 -0
  41. package/dist/esm/index.js.map +1 -0
  42. package/dist/esm/web.d.ts +34 -0
  43. package/dist/esm/web.js +175 -0
  44. package/dist/esm/web.js.map +1 -0
  45. package/dist/plugin.cjs.js +215 -0
  46. package/dist/plugin.cjs.js.map +1 -0
  47. package/dist/plugin.js +217 -0
  48. package/dist/plugin.js.map +1 -0
  49. package/ios/Plugin/Classes/Events/UnreadConversationCountChangeEvent.swift +16 -0
  50. package/ios/Plugin/Classes/Options/HandlePushNotificationOptions.swift +13 -0
  51. package/ios/Plugin/Classes/Options/InitializeOptions.swift +15 -0
  52. package/ios/Plugin/Classes/Options/IsIntercomPushNotificationOptions.swift +13 -0
  53. package/ios/Plugin/Classes/Options/LogEventOptions.swift +15 -0
  54. package/ios/Plugin/Classes/Options/LoginUserOptions.swift +17 -0
  55. package/ios/Plugin/Classes/Options/PresentContentOptions.swift +29 -0
  56. package/ios/Plugin/Classes/Options/PresentMessageComposerOptions.swift +10 -0
  57. package/ios/Plugin/Classes/Options/PresentOptions.swift +10 -0
  58. package/ios/Plugin/Classes/Options/SendPushTokenToIntercomOptions.swift +13 -0
  59. package/ios/Plugin/Classes/Options/SetBottomPaddingOptions.swift +13 -0
  60. package/ios/Plugin/Classes/Options/SetInAppMessagesVisibleOptions.swift +13 -0
  61. package/ios/Plugin/Classes/Options/SetLauncherVisibleOptions.swift +13 -0
  62. package/ios/Plugin/Classes/Options/SetUserHashOptions.swift +13 -0
  63. package/ios/Plugin/Classes/Options/SetUserJwtOptions.swift +13 -0
  64. package/ios/Plugin/Classes/Options/UpdateUserOptions.swift +38 -0
  65. package/ios/Plugin/Classes/Results/GetUnreadConversationCountResult.swift +16 -0
  66. package/ios/Plugin/Classes/Results/IsIntercomPushNotificationResult.swift +16 -0
  67. package/ios/Plugin/Enums/CustomError.swift +75 -0
  68. package/ios/Plugin/Info.plist +24 -0
  69. package/ios/Plugin/Intercom.swift +323 -0
  70. package/ios/Plugin/IntercomHelper.swift +17 -0
  71. package/ios/Plugin/IntercomPlugin.swift +261 -0
  72. package/ios/Plugin/Protocols/Result.swift +5 -0
  73. package/package.json +105 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * @since 0.1.0\n */\nexport var ErrorCode;\n(function (ErrorCode) {\n /**\n * The login of the user failed.\n *\n * @since 0.1.0\n */\n ErrorCode[\"LoginFailed\"] = \"LOGIN_FAILED\";\n /**\n * The plugin has not been initialized yet.\n *\n * Call `initialize(...)` before calling any other method.\n *\n * @since 0.1.0\n */\n ErrorCode[\"NotInitialized\"] = \"NOT_INITIALIZED\";\n /**\n * The update of the user failed.\n *\n * @since 0.1.0\n */\n ErrorCode[\"UpdateFailed\"] = \"UPDATE_FAILED\";\n})(ErrorCode || (ErrorCode = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst Intercom = registerPlugin('Intercom', {\n web: () => import('./web').then(m => new m.IntercomWeb()),\n});\nexport * from './definitions';\nexport { Intercom };\n//# sourceMappingURL=index.js.map","import { CapacitorException, WebPlugin } from '@capacitor/core';\nimport IntercomMessenger, { hide, hideNotifications, onHide, onShow, onUnreadCountChange, shutdown, showArticle, showConversation, showNewMessage, showSpace, startSurvey, trackEvent, update, } from '@intercom/messenger-js-sdk';\nimport { ErrorCode } from './definitions';\nexport class IntercomWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.initialized = false;\n this.unreadConversationCount = 0;\n }\n async getUnreadConversationCount() {\n return { count: this.unreadConversationCount };\n }\n async handlePushNotification() {\n throw this.unimplemented('Not implemented on web.');\n }\n async hide() {\n this.throwIfNotInitialized();\n hide();\n }\n async initialize(options) {\n this.appId = options.appId;\n this.boot();\n this.registerEventListeners();\n this.initialized = true;\n }\n async isIntercomPushNotification() {\n throw this.unimplemented('Not implemented on web.');\n }\n async logEvent(options) {\n this.throwIfNotInitialized();\n trackEvent(options.name, options.data);\n }\n async loginUnidentifiedUser() {\n this.throwIfNotInitialized();\n this.boot();\n }\n async loginUser(options) {\n this.throwIfNotInitialized();\n this.boot(options);\n }\n async logout() {\n this.throwIfNotInitialized();\n shutdown();\n this.boot();\n }\n async present(options) {\n var _a;\n this.throwIfNotInitialized();\n showSpace(IntercomWeb.mapSpace((_a = options === null || options === void 0 ? void 0 : options.space) !== null && _a !== void 0 ? _a : 'home'));\n }\n async presentContent(options) {\n var _a, _b, _c;\n this.throwIfNotInitialized();\n switch (options.type) {\n case 'article':\n showArticle((_a = options.id) !== null && _a !== void 0 ? _a : '');\n break;\n case 'survey':\n startSurvey((_b = options.id) !== null && _b !== void 0 ? _b : '');\n break;\n case 'conversation':\n showConversation((_c = options.id) !== null && _c !== void 0 ? _c : '');\n break;\n default:\n throw this.unavailable(IntercomWeb.errorNoWebEquivalent);\n }\n }\n async presentMessageComposer(options) {\n var _a;\n this.throwIfNotInitialized();\n showNewMessage((_a = options === null || options === void 0 ? void 0 : options.initialMessage) !== null && _a !== void 0 ? _a : '');\n }\n async sendPushTokenToIntercom() {\n throw this.unimplemented('Not implemented on web.');\n }\n async setBottomPadding() {\n throw this.unimplemented('Not implemented on web.');\n }\n async setInAppMessagesVisible(options) {\n this.throwIfNotInitialized();\n hideNotifications(!options.visible);\n }\n async setLauncherVisible(options) {\n this.throwIfNotInitialized();\n update({ hide_default_launcher: !options.visible });\n }\n async setUserHash(options) {\n this.userHash = options.userHash;\n }\n async setUserJwt(options) {\n this.userJwt = options.jwt;\n }\n async updateUser(options) {\n this.throwIfNotInitialized();\n const args = {};\n if (options.userId !== undefined) {\n args.user_id = options.userId;\n }\n if (options.email !== undefined) {\n args.email = options.email;\n }\n if (options.name !== undefined) {\n args.name = options.name;\n }\n if (options.phone !== undefined) {\n args.phone = options.phone;\n }\n if (options.languageOverride !== undefined) {\n args.language_override = options.languageOverride;\n }\n if (options.signedUpAt !== undefined) {\n args.created_at = options.signedUpAt;\n }\n if (options.unsubscribedFromEmails !== undefined) {\n args.unsubscribed_from_emails = options.unsubscribedFromEmails;\n }\n if (options.customAttributes !== undefined) {\n Object.assign(args, options.customAttributes);\n }\n if (options.companies !== undefined) {\n args.companies = options.companies.map(company => (Object.assign({ company_id: company.id, name: company.name, plan: company.plan, monthly_spend: company.monthlySpend, created_at: company.createdAt }, company.customAttributes)));\n }\n update(args);\n }\n boot(user) {\n const settings = { app_id: this.appId };\n if ((user === null || user === void 0 ? void 0 : user.userId) !== undefined) {\n settings.user_id = user.userId;\n }\n if ((user === null || user === void 0 ? void 0 : user.email) !== undefined) {\n settings.email = user.email;\n }\n if (this.userHash !== undefined) {\n settings.user_hash = this.userHash;\n }\n if (this.userJwt !== undefined) {\n settings.intercom_user_jwt = this.userJwt;\n }\n IntercomMessenger(settings);\n }\n static mapSpace(space) {\n switch (space) {\n case 'messages':\n return 'messages';\n case 'help-center':\n return 'help';\n case 'tickets':\n return 'tickets';\n default:\n return 'home';\n }\n }\n registerEventListeners() {\n onUnreadCountChange((count) => {\n this.unreadConversationCount = count;\n this.notifyListeners('unreadConversationCountChange', { count });\n });\n onShow(() => {\n this.notifyListeners('messengerShown', {});\n });\n onHide(() => {\n this.notifyListeners('messengerHidden', {});\n });\n }\n throwIfNotInitialized() {\n if (!this.initialized) {\n throw new CapacitorException(IntercomWeb.errorNotInitialized, undefined, {\n code: ErrorCode.NotInitialized,\n });\n }\n }\n}\nIntercomWeb.errorNotInitialized = 'Intercom is not initialized. Call initialize() first.';\nIntercomWeb.errorNoWebEquivalent = 'This content type is not available on the web platform.';\n//# sourceMappingURL=web.js.map"],"names":["ErrorCode","registerPlugin","WebPlugin","hide","trackEvent","shutdown","showSpace","showArticle","startSurvey","showConversation","showNewMessage","hideNotifications","update","onUnreadCountChange","onShow","onHide","CapacitorException"],"mappings":";;;IAAA;IACA;IACA;AACWA;IACX,CAAC,UAAU,SAAS,EAAE;IACtB;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,aAAa,CAAC,GAAG,cAAc;IAC7C;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,gBAAgB,CAAC,GAAG,iBAAiB;IACnD;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,cAAc,CAAC,GAAG,eAAe;IAC/C,CAAC,EAAEA,iBAAS,KAAK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Capacitor
3
+
4
+ @objc public class UnreadConversationCountChangeEvent: NSObject, Result {
5
+ let count: Int
6
+
7
+ init(count: Int) {
8
+ self.count = count
9
+ }
10
+
11
+ @objc public func toJSObject() -> AnyObject {
12
+ var result = JSObject()
13
+ result["count"] = count
14
+ return result as AnyObject
15
+ }
16
+ }
@@ -0,0 +1,13 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc public class HandlePushNotificationOptions: NSObject {
5
+ let data: [String: Any]
6
+
7
+ init(_ call: CAPPluginCall) throws {
8
+ guard let data = call.getObject("data") else {
9
+ throw CustomError.dataMissing
10
+ }
11
+ self.data = data
12
+ }
13
+ }
@@ -0,0 +1,15 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc public class InitializeOptions: NSObject {
5
+ let appId: String
6
+ let iosApiKey: String?
7
+
8
+ init(_ call: CAPPluginCall) throws {
9
+ guard let appId = call.getString("appId") else {
10
+ throw CustomError.appIdMissing
11
+ }
12
+ self.appId = appId
13
+ self.iosApiKey = call.getString("iosApiKey")
14
+ }
15
+ }
@@ -0,0 +1,13 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc public class IsIntercomPushNotificationOptions: NSObject {
5
+ let data: [String: Any]
6
+
7
+ init(_ call: CAPPluginCall) throws {
8
+ guard let data = call.getObject("data") else {
9
+ throw CustomError.dataMissing
10
+ }
11
+ self.data = data
12
+ }
13
+ }
@@ -0,0 +1,15 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc public class LogEventOptions: NSObject {
5
+ let data: [String: Any]?
6
+ let name: String
7
+
8
+ init(_ call: CAPPluginCall) throws {
9
+ guard let name = call.getString("name") else {
10
+ throw CustomError.nameMissing
11
+ }
12
+ self.name = name
13
+ self.data = call.getObject("data")
14
+ }
15
+ }
@@ -0,0 +1,17 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc public class LoginUserOptions: NSObject {
5
+ let email: String?
6
+ let userId: String?
7
+
8
+ init(_ call: CAPPluginCall) throws {
9
+ let userId = call.getString("userId")
10
+ let email = call.getString("email")
11
+ if userId == nil && email == nil {
12
+ throw CustomError.userIdOrEmailMissing
13
+ }
14
+ self.userId = userId
15
+ self.email = email
16
+ }
17
+ }
@@ -0,0 +1,29 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc public class PresentContentOptions: NSObject {
5
+ let id: String?
6
+ let ids: [String]?
7
+ let type: String
8
+
9
+ init(_ call: CAPPluginCall) throws {
10
+ guard let type = call.getString("type") else {
11
+ throw CustomError.typeInvalid
12
+ }
13
+ self.type = type
14
+ self.id = call.getString("id")
15
+ self.ids = call.getArray("ids", String.self)
16
+ switch type {
17
+ case "article", "carousel", "survey", "conversation":
18
+ if id == nil {
19
+ throw CustomError.idMissing
20
+ }
21
+ case "help-center-collections":
22
+ if ids == nil || ids?.isEmpty == true {
23
+ throw CustomError.idsMissing
24
+ }
25
+ default:
26
+ throw CustomError.typeInvalid
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,10 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc public class PresentMessageComposerOptions: NSObject {
5
+ let initialMessage: String?
6
+
7
+ init(_ call: CAPPluginCall) {
8
+ self.initialMessage = call.getString("initialMessage")
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc public class PresentOptions: NSObject {
5
+ let space: String
6
+
7
+ init(_ call: CAPPluginCall) {
8
+ self.space = call.getString("space", "home")
9
+ }
10
+ }
@@ -0,0 +1,13 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc public class SendPushTokenToIntercomOptions: NSObject {
5
+ let token: String
6
+
7
+ init(_ call: CAPPluginCall) throws {
8
+ guard let token = call.getString("token") else {
9
+ throw CustomError.tokenMissing
10
+ }
11
+ self.token = token
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc public class SetBottomPaddingOptions: NSObject {
5
+ let padding: CGFloat
6
+
7
+ init(_ call: CAPPluginCall) throws {
8
+ guard call.hasOption("padding"), let padding = call.getDouble("padding") else {
9
+ throw CustomError.paddingMissing
10
+ }
11
+ self.padding = CGFloat(padding)
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc public class SetInAppMessagesVisibleOptions: NSObject {
5
+ let visible: Bool
6
+
7
+ init(_ call: CAPPluginCall) throws {
8
+ guard call.hasOption("visible"), let visible = call.getBool("visible") else {
9
+ throw CustomError.visibleMissing
10
+ }
11
+ self.visible = visible
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc public class SetLauncherVisibleOptions: NSObject {
5
+ let visible: Bool
6
+
7
+ init(_ call: CAPPluginCall) throws {
8
+ guard call.hasOption("visible"), let visible = call.getBool("visible") else {
9
+ throw CustomError.visibleMissing
10
+ }
11
+ self.visible = visible
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc public class SetUserHashOptions: NSObject {
5
+ let userHash: String
6
+
7
+ init(_ call: CAPPluginCall) throws {
8
+ guard let userHash = call.getString("userHash") else {
9
+ throw CustomError.userHashMissing
10
+ }
11
+ self.userHash = userHash
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc public class SetUserJwtOptions: NSObject {
5
+ let jwt: String
6
+
7
+ init(_ call: CAPPluginCall) throws {
8
+ guard let jwt = call.getString("jwt") else {
9
+ throw CustomError.jwtMissing
10
+ }
11
+ self.jwt = jwt
12
+ }
13
+ }
@@ -0,0 +1,38 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc public class UpdateUserOptions: NSObject {
5
+ let companies: [JSObject]?
6
+ let customAttributes: [String: Any]?
7
+ let email: String?
8
+ let languageOverride: String?
9
+ let name: String?
10
+ let phone: String?
11
+ let signedUpAt: Date?
12
+ let unsubscribedFromEmails: Bool?
13
+ let userId: String?
14
+
15
+ init(_ call: CAPPluginCall) {
16
+ self.userId = call.getString("userId")
17
+ self.email = call.getString("email")
18
+ self.name = call.getString("name")
19
+ self.phone = call.getString("phone")
20
+ self.languageOverride = call.getString("languageOverride")
21
+ if let signedUpAt = call.getDouble("signedUpAt") {
22
+ self.signedUpAt = Date(timeIntervalSince1970: signedUpAt)
23
+ } else {
24
+ self.signedUpAt = nil
25
+ }
26
+ if call.hasOption("unsubscribedFromEmails") {
27
+ self.unsubscribedFromEmails = call.getBool("unsubscribedFromEmails")
28
+ } else {
29
+ self.unsubscribedFromEmails = nil
30
+ }
31
+ self.customAttributes = call.getObject("customAttributes")
32
+ if let companies = call.getArray("companies") {
33
+ self.companies = companies.compactMap { $0 as? JSObject }
34
+ } else {
35
+ self.companies = nil
36
+ }
37
+ }
38
+ }
@@ -0,0 +1,16 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc public class GetUnreadConversationCountResult: NSObject, Result {
5
+ let count: Int
6
+
7
+ init(count: Int) {
8
+ self.count = count
9
+ }
10
+
11
+ @objc public func toJSObject() -> AnyObject {
12
+ var result = JSObject()
13
+ result["count"] = count
14
+ return result as AnyObject
15
+ }
16
+ }
@@ -0,0 +1,16 @@
1
+ import Foundation
2
+ import Capacitor
3
+
4
+ @objc public class IsIntercomPushNotificationResult: NSObject, Result {
5
+ let intercom: Bool
6
+
7
+ init(intercom: Bool) {
8
+ self.intercom = intercom
9
+ }
10
+
11
+ @objc public func toJSObject() -> AnyObject {
12
+ var result = JSObject()
13
+ result["intercom"] = intercom
14
+ return result as AnyObject
15
+ }
16
+ }
@@ -0,0 +1,75 @@
1
+ import Foundation
2
+
3
+ public enum CustomError: Error {
4
+ case appIdMissing
5
+ case companyIdMissing
6
+ case dataMissing
7
+ case idMissing
8
+ case idsMissing
9
+ case iosApiKeyMissing
10
+ case jwtMissing
11
+ case loginFailed(message: String)
12
+ case nameMissing
13
+ case notInitialized
14
+ case paddingMissing
15
+ case tokenMissing
16
+ case typeInvalid
17
+ case updateFailed(message: String)
18
+ case userHashMissing
19
+ case userIdOrEmailMissing
20
+ case visibleMissing
21
+
22
+ public var code: String? {
23
+ switch self {
24
+ case .loginFailed:
25
+ return "LOGIN_FAILED"
26
+ case .notInitialized:
27
+ return "NOT_INITIALIZED"
28
+ case .updateFailed:
29
+ return "UPDATE_FAILED"
30
+ default:
31
+ return nil
32
+ }
33
+ }
34
+ }
35
+
36
+ extension CustomError: LocalizedError {
37
+ public var errorDescription: String? {
38
+ switch self {
39
+ case .appIdMissing:
40
+ return NSLocalizedString("appId must be provided.", comment: "appIdMissing")
41
+ case .companyIdMissing:
42
+ return NSLocalizedString("company id must be provided.", comment: "companyIdMissing")
43
+ case .dataMissing:
44
+ return NSLocalizedString("data must be provided.", comment: "dataMissing")
45
+ case .idMissing:
46
+ return NSLocalizedString("id must be provided.", comment: "idMissing")
47
+ case .idsMissing:
48
+ return NSLocalizedString("ids must be provided.", comment: "idsMissing")
49
+ case .iosApiKeyMissing:
50
+ return NSLocalizedString("iosApiKey must be provided.", comment: "iosApiKeyMissing")
51
+ case .jwtMissing:
52
+ return NSLocalizedString("jwt must be provided.", comment: "jwtMissing")
53
+ case .loginFailed(let message):
54
+ return message
55
+ case .nameMissing:
56
+ return NSLocalizedString("name must be provided.", comment: "nameMissing")
57
+ case .notInitialized:
58
+ return NSLocalizedString("Intercom is not initialized. Call initialize() first.", comment: "notInitialized")
59
+ case .paddingMissing:
60
+ return NSLocalizedString("padding must be provided.", comment: "paddingMissing")
61
+ case .tokenMissing:
62
+ return NSLocalizedString("token must be provided.", comment: "tokenMissing")
63
+ case .typeInvalid:
64
+ return NSLocalizedString("type is invalid.", comment: "typeInvalid")
65
+ case .updateFailed(let message):
66
+ return message
67
+ case .userHashMissing:
68
+ return NSLocalizedString("userHash must be provided.", comment: "userHashMissing")
69
+ case .userIdOrEmailMissing:
70
+ return NSLocalizedString("userId or email must be provided.", comment: "userIdOrEmailMissing")
71
+ case .visibleMissing:
72
+ return NSLocalizedString("visible must be provided.", comment: "visibleMissing")
73
+ }
74
+ }
75
+ }
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleDevelopmentRegion</key>
6
+ <string>$(DEVELOPMENT_LANGUAGE)</string>
7
+ <key>CFBundleExecutable</key>
8
+ <string>$(EXECUTABLE_NAME)</string>
9
+ <key>CFBundleIdentifier</key>
10
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
+ <key>CFBundleInfoDictionaryVersion</key>
12
+ <string>6.0</string>
13
+ <key>CFBundleName</key>
14
+ <string>$(PRODUCT_NAME)</string>
15
+ <key>CFBundlePackageType</key>
16
+ <string>FMWK</string>
17
+ <key>CFBundleShortVersionString</key>
18
+ <string>1.0</string>
19
+ <key>CFBundleVersion</key>
20
+ <string>$(CURRENT_PROJECT_VERSION)</string>
21
+ <key>NSPrincipalClass</key>
22
+ <string></string>
23
+ </dict>
24
+ </plist>