@webex/internal-plugin-device 3.0.0-beta.3 → 3.0.0-beta.30

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 (40) hide show
  1. package/README.md +10 -6
  2. package/dist/config.js +0 -8
  3. package/dist/config.js.map +1 -1
  4. package/dist/constants.js +2 -3
  5. package/dist/constants.js.map +1 -1
  6. package/dist/device.js +91 -169
  7. package/dist/device.js.map +1 -1
  8. package/dist/features/feature-collection.js +1 -8
  9. package/dist/features/feature-collection.js.map +1 -1
  10. package/dist/features/feature-model.js +15 -42
  11. package/dist/features/feature-model.js.map +1 -1
  12. package/dist/features/features-model.js +9 -21
  13. package/dist/features/features-model.js.map +1 -1
  14. package/dist/features/index.js +0 -8
  15. package/dist/features/index.js.map +1 -1
  16. package/dist/index.js +2 -24
  17. package/dist/index.js.map +1 -1
  18. package/dist/interceptors/device-url.js +12 -33
  19. package/dist/interceptors/device-url.js.map +1 -1
  20. package/dist/metrics.js +0 -2
  21. package/dist/metrics.js.map +1 -1
  22. package/package.json +10 -10
  23. package/src/config.js +8 -9
  24. package/src/constants.js +3 -5
  25. package/src/device.js +140 -144
  26. package/src/features/feature-collection.js +1 -1
  27. package/src/features/feature-model.js +5 -11
  28. package/src/features/features-model.js +3 -9
  29. package/src/features/index.js +1 -5
  30. package/src/index.js +3 -11
  31. package/src/interceptors/device-url.js +5 -7
  32. package/src/metrics.js +1 -2
  33. package/test/integration/spec/device.js +210 -239
  34. package/test/integration/spec/webex.js +9 -9
  35. package/test/unit/spec/device.js +44 -53
  36. package/test/unit/spec/features/feature-collection.js +2 -2
  37. package/test/unit/spec/features/feature-model.js +23 -39
  38. package/test/unit/spec/features/features-model.js +4 -12
  39. package/test/unit/spec/interceptors/device-url.js +69 -109
  40. package/test/unit/spec/wdm-dto.json +5 -13
@@ -1 +1 @@
1
- {"version":3,"names":["decider","config","ephemeral","Device","WebexPlugin","extend","waitForValue","deprecated","persist","namespace","extraProperties","idAttribute","children","features","FeaturesModel","props","clientMessagingGiphy","customerCompanyName","customerLogoUrl","deviceType","helpUrl","intranetInactivityDuration","intranetInactivityCheckUrl","inNetworkInactivityDuration","ecmEnabledForAllUsers","ecmSupportedStorageProviders","modificationTime","navigationBarColor","partnerCompanyName","partnerLogoUrl","peopleInsightsEnabled","reportingSiteDesc","reportingSiteUrl","searchEncryptionKeyUrl","showSupportText","supportProviderCompanyName","supportProviderLogoUrl","url","userId","webFileShareControl","webSocketUrl","whiteboardFileShareControl","derived","registered","deps","fn","session","logoutTimer","lastUserActivityDate","isReachabilityChecked","isInMeeting","isInNetwork","meetingStarted","webex","trigger","meetingEnded","refresh","logger","info","canRegister","then","register","body","serialize","mediaCluster","etag","ttl","ephemeralDeviceTTL","headers","defaults","request","method","uri","response","processRegistrationSuccess","catch","reason","statusCode","clear","reject","service","resource","internal","metrics","submitClientMetrics","METRICS","JS_SDK_WDM_REGISTRATION_SUCCESSFUL","error","JS_SDK_WDM_REGISTRATION_FAILED","fields","unregister","warn","resolve","services","waitForCatalog","canRegisterWaitDuration","get","Error","join","checkNetworkReachability","resetLogoutTimer","trackingid","args","prototype","getWebSocketUrl","wait","waitForRegistration","convertUrlToPriorityHostUrl","message","wsUrl","serviceHostMap","user","reset","entitlement","set","delay","refreshTimer","safeSetTimeout","DEVICE_EVENT_REGISTRATION_SUCCESS","clearTimeout","off","unset","enableInactivityEnforcement","setLogoutTimer","duration","on","logout","timeout","timeoutTimer","once","markUrlFailedAndGetNew","markFailedUrl","initialize","FEATURE_COLLECTION_NAMES","forEach","collectionName","model","value","options","listenTo","oneFlight"],"sources":["device.js"],"sourcesContent":["// Internal Dependencies\nimport {deprecated, oneFlight} from '@webex/common';\nimport {persist, waitForValue, WebexPlugin} from '@webex/webex-core';\nimport {safeSetTimeout} from '@webex/common-timers';\n\nimport METRICS from './metrics';\nimport {\n FEATURE_COLLECTION_NAMES,\n DEVICE_EVENT_REGISTRATION_SUCCESS\n} from './constants';\nimport FeaturesModel from './features/features-model';\n\n/**\n * Determine if the plugin should be initialized based on cached storage.\n *\n * @returns {boolean} - If the device is ephemeral.\n */\nfunction decider() {\n return !this.config.ephemeral;\n}\n\nconst Device = WebexPlugin.extend({\n\n // Ampersand property members.\n\n namespace: 'Device',\n\n // Allow for extra properties to prevent the plugin from failing due to\n // **WDM** service DTO changes.\n extraProperties: 'allow',\n\n idAttribute: 'url',\n\n children: {\n /**\n * The class object that contains all of the feature collections.\n *\n * @type {FeaturesModel}\n */\n features: FeaturesModel\n },\n\n /**\n * A collection of device properties mostly assigned by the retrieved DTO from\n * the **WDM** service that are mapped against the ampersand properties.\n *\n * @type {Object}\n */\n props: {\n /**\n * This property determines whether or not giphy support is enabled.\n *\n * @type {'ALLOW' | 'BLOCK'}\n */\n clientMessagingGiphy: 'string',\n\n /**\n * This property should store the company name.\n *\n * @type {string}\n */\n customerCompanyName: 'string',\n\n /**\n * This property should store the logo url.\n *\n * @type {string}\n */\n customerLogoUrl: 'string',\n\n /**\n * This property doesn't have any real values, but is sent during device\n * refresh to prevent the **wdm** service from falling back to an iOS device\n * type.\n *\n * @type {string}\n */\n deviceType: 'string',\n\n /**\n * This property should store the help url.\n *\n * @type {string}\n */\n helpUrl: 'string',\n\n /**\n * This property should store the intranet inactivity timer duration.\n *\n * @type {number}\n */\n intranetInactivityDuration: 'number',\n\n /**\n * This property stores the url required to validate if the device is able\n * to actively reach the intranet network.\n *\n * @type {string}\n */\n intranetInactivityCheckUrl: 'string',\n\n /**\n * This property stores the inactivity timer duration, and could possibly\n * deprecate the `intranetInactivityDuration` property.\n *\n * @type {number}\n */\n inNetworkInactivityDuration: 'number',\n\n /**\n * This property stores the ECM (external content management) enabled value\n * for the whole organization.\n *\n * @type {boolean}\n */\n ecmEnabledForAllUsers: ['boolean', false, false],\n\n /**\n * This property stores an array of ECM (external content management)\n * providers that are currently available.\n *\n * @returns {Array<string>}\n */\n ecmSupportedStorageProviders: ['array', false, (() => [])],\n\n /**\n * This property stores the modification time value retrieved from the\n * **WDM** endpoint formatted as ISO 8601.\n *\n * @type {string}\n */\n modificationTime: 'string',\n\n /**\n * This property stores the navigation bar color.\n *\n * @type {string}\n */\n navigationBarColor: 'string',\n\n /**\n * This property stores the partner company's name when available.\n *\n * @type {string}\n */\n partnerCompanyName: 'string',\n\n /**\n * This property stores the partner company's logo when available.\n *\n * @type {string}\n */\n partnerLogoUrl: 'string',\n\n /**\n * This property stores the availability of people data from the **WDM**\n * service.\n *\n * @type {boolean}\n */\n peopleInsightsEnabled: 'boolean',\n\n /**\n * This property stores the reporting site's description when available.\n *\n * @type {string}\n */\n reportingSiteDesc: 'string',\n\n /**\n * This property stores the reporting site's access url when available.\n *\n * @type {string}\n */\n reportingSiteUrl: 'string',\n\n /**\n * This property stores the encryption key url when available.\n *\n * @type {string}\n */\n searchEncryptionKeyUrl: 'string',\n\n /**\n * This property stores the availability of support-provided text from the\n * **WDM** service.\n *\n * @type {boolean}\n */\n showSupportText: 'boolean',\n\n /**\n * This property stores the support provider's company name when available.\n *\n * @type {string}\n */\n supportProviderCompanyName: 'string',\n\n /**\n * This property stores the support provider's logo url when available.\n *\n * @type {string}\n */\n supportProviderLogoUrl: 'string',\n\n /**\n * This property stores the device's url retrieved from a registration\n * request. This property gets set via the initial registration process by a\n * `this.set()` method.\n *\n * @type {string}\n */\n url: 'string',\n\n /**\n * This property stores the device's userId uuid value, which can also be\n * derived from the device's registerd user's userId retrieved from\n * the **Hydra** service.\n *\n * @type {string}\n */\n userId: 'string',\n\n /**\n * This property stores whether or not file sharing is enabled\n *\n * @type {'BLOCK_BOTH' | 'BLOCK_UPLOAD'}\n */\n webFileShareControl: 'string',\n\n /**\n * This property stores the current web socket url used by the registered\n * device.\n *\n * @type {string}\n */\n webSocketUrl: 'string',\n\n /**\n * This property stores the value indicating whether or not white board file\n * sharing is enabled for the current device.\n *\n * @type {'ALLOW' | 'BLOCK'}\n */\n whiteboardFileShareControl: 'string'\n },\n\n /**\n * A list of derived properties that populate based when their parent data\n * available via the device's properties.\n *\n * @type {Object}\n */\n derived: {\n /**\n * This property determines if the current device is registered.\n *\n * @type {boolean}\n */\n registered: {\n deps: ['url'],\n\n /**\n * Checks if the device is registered by validating that the url exists.\n * Amperstand does not allow this to method to be written as an arrow\n * function.\n *\n * @returns {boolean}\n */\n fn() {\n return !!(this.url);\n }\n }\n },\n\n /**\n * Stores timer data as well as other state details.\n *\n * @type {Object}\n */\n session: {\n /**\n * This property stores the logout timer object\n *\n * @type {any}\n */\n logoutTimer: 'any',\n\n /**\n * This property stores the date for the last activity the user made\n * with the current device.\n *\n * @type {number}\n */\n lastUserActivityDate: 'number',\n\n /**\n * This property stores whether or not the reachability check has been\n * performed to prevent the reachability check from performing its\n * operation more than once after a successful check.\n *\n * @returns {boolean}\n */\n isReachabilityChecked: ['boolean', false, false],\n\n /**\n * This property stores whether or not the current device is in a meeting\n * to prevent an unneeded timeout of a meeting due to inactivity.\n *\n * @type {boolean}\n */\n isInMeeting: 'boolean',\n\n /**\n * This property identifies if the device is currently in network to prevent\n * the `resetLogoutTimer()` method from being called repeatedly once its\n * known client is connected to the organization's internal network.\n *\n * @type {boolean}\n */\n isInNetwork: 'boolean'\n },\n\n // Event method members.\n\n /**\n * Trigger meeting started event for webex instance. Used by web-client team.\n *\n * @returns {void}\n */\n meetingStarted() {\n this.webex.trigger('meeting started');\n },\n\n /**\n * Trigger meeting ended event for webex instance. Used by web-client team.\n *\n * @returns {void}\n */\n meetingEnded() {\n this.webex.trigger('meeting ended');\n },\n\n // Registration method members\n\n /* eslint-disable require-jsdoc */\n /**\n * Refresh the current registered device if able.\n *\n * @returns {Promise<void, Error>}\n */\n @oneFlight\n @waitForValue('@')\n refresh() {\n this.logger.info('device: refreshing');\n\n // Validate that the device can be registered.\n return this.canRegister()\n .then(() => {\n // Validate if the device is not registered and register instead.\n if (!this.registered) {\n this.logger.info('device: device not registered, registering');\n\n return this.register();\n }\n\n // Merge body configurations, overriding defaults.\n const body = {\n ...(this.serialize()),\n ...(this.config.body ? this.config.body : {})\n };\n\n // Remove unneeded properties from the body object.\n delete body.features;\n delete body.mediaCluster;\n delete body.etag;\n\n // Append a ttl value if the device is marked as ephemeral.\n if (this.config.ephemeral) {\n body.ttl = this.config.ephemeralDeviceTTL;\n }\n\n // Merge header configurations, overriding defaults.\n const headers = {\n ...(this.config.defaults.headers ? this.config.defaults.headers : {}),\n ...(this.config.headers ? this.config.headers : {}),\n // If etag is sent, WDM will not send developer feature toggles unless they have changed\n ...(this.etag ? {'If-None-Match': this.etag} : {})\n };\n\n return this.request({\n method: 'PUT',\n uri: this.url,\n body,\n headers\n })\n .then((response) => this.processRegistrationSuccess(response))\n .catch((reason) => {\n // Handle a 404 error, which indicates that the device is no longer\n // valid and needs to be registered as a new device.\n if (reason.statusCode === 404) {\n this.logger.info('device: refresh failed, device is not valid');\n this.logger.info('device: attempting to register a new device');\n\n this.clear();\n\n return this.register();\n }\n\n return Promise.reject(reason);\n });\n });\n },\n\n /**\n * Register or refresh a device depending on the current device state. Device\n * registration utilizes the services plugin to send the request to the\n * **WDM** service.\n *\n * @returns {Promise<void, Error>}\n */\n @oneFlight\n @waitForValue('@')\n register() {\n this.logger.info('device: registering');\n\n // Validate that the device can be registered.\n return this.canRegister()\n .then(() => {\n // Validate if the device is already registered and refresh instead.\n if (this.registered) {\n this.logger.info('device: device already registered, refreshing');\n\n return this.refresh();\n }\n\n // Merge body configurations, overriding defaults.\n const body = {\n ...(this.config.defaults.body ? this.config.defaults.body : {}),\n ...(this.config.body ? this.config.body : {})\n };\n\n // Merge header configurations, overriding defaults.\n const headers = {\n ...(this.config.defaults.headers ? this.config.defaults.headers : {}),\n ...(this.config.headers ? this.config.headers : {})\n };\n\n // Append a ttl value if the device is marked as ephemeral\n if (this.config.ephemeral) {\n body.ttl = this.config.ephemeralDeviceTTL;\n }\n\n // This will be replaced by a `create()` method.\n return this.request({\n method: 'POST',\n service: 'wdm',\n resource: 'devices',\n body,\n headers\n })\n .then((response) => {\n this.webex.internal.metrics.submitClientMetrics(METRICS.JS_SDK_WDM_REGISTRATION_SUCCESSFUL);\n\n return this.processRegistrationSuccess(response);\n })\n .catch((error) => {\n this.webex.internal.metrics.submitClientMetrics(METRICS.JS_SDK_WDM_REGISTRATION_FAILED, {\n fields: {error}\n });\n throw error;\n });\n });\n },\n\n /**\n * Unregister the current registered device if available. Unregistering a\n * device utilizes the services plugin to send the request to the **WDM**\n * service.\n *\n * @returns {Promise<void, Error>}\n */\n @oneFlight\n @waitForValue('@')\n unregister() {\n this.logger.info('device: unregistering');\n\n if (!this.registered) {\n this.logger.warn('device: not registered');\n\n return Promise.resolve();\n }\n\n return this.request({\n uri: this.url,\n method: 'DELETE'\n })\n .then(() => this.clear());\n },\n /* eslint-enable require-jsdoc */\n\n // Helper method members\n\n /**\n * Determine if registration methods can be performed. This method utilizes\n * the `services` plugin to confirm if the appropriate service urls are\n * available for device registration.\n *\n * @returns {Promise<void, Error>}\n */\n canRegister() {\n this.logger.info('device: validating if registration can occur');\n\n // Destructure the services plugin for ease of reference.\n const {services} = this.webex.internal;\n\n // Wait for the postauth catalog to populate.\n return services.waitForCatalog(\n 'postauth',\n this.config.canRegisterWaitDuration\n )\n .then(() => (\n // Validate that the service exists after waiting for the catalog.\n services.get('wdm') ?\n Promise.resolve() :\n Promise.reject(new Error([\n 'device: cannot register,',\n '\\'wdm\\' service is not available from the postauth catalog'\n ].join(' ')))\n ));\n },\n\n /**\n * Check if the device can currently reach the inactivity check url.\n *\n * @returns {Promise<void, Error>}\n */\n checkNetworkReachability() {\n this.logger.info('device: checking network reachability');\n\n // Validate if the device has been checked and reset the logout timer.\n if (this.isReachabilityChecked) {\n return Promise.resolve(this.resetLogoutTimer());\n }\n\n this.isReachabilityChecked = true;\n\n // Validate if the device has a intranet checking url.\n if (!this.intranetInactivityCheckUrl) {\n this.isInNetwork = false;\n\n return Promise.resolve(this.resetLogoutTimer());\n }\n\n // Clear unnecessary headers for reachability request.\n const headers = {\n 'cisco-no-http-redirect': null,\n 'spark-user-agent': null,\n trackingid: null\n };\n\n // Send the network reachability request.\n return this.request({\n headers,\n method: 'GET',\n uri: this.intranetInactivityCheckUrl\n })\n .then(() => {\n this.isInNetwork = true;\n\n return Promise.resolve(this.resetLogoutTimer());\n })\n .catch(() => {\n this.logger.info('device: did not reach ping endpoint');\n this.logger.info('device: triggering off-network timer');\n\n this.isInNetwork = false;\n\n return Promise.resolve(this.resetLogoutTimer());\n });\n },\n\n /**\n * Clears the registration ttl value if available.\n *\n * @param {Object} options - Values to be cleared.\n * @returns {void}\n */\n clear(...args) {\n this.logger.info('device: clearing registered device');\n\n // Prototype the extended class in order to preserve the parent member.\n Reflect.apply(WebexPlugin.prototype.clear, this, args);\n },\n\n /**\n * Get the current websocket url with the appropriate priority host.\n *\n * @param {boolean} [wait=false] - Willing to wait on a valid url.\n * @returns {Promise<string, Error>} - The priority-mapped web socket url.\n */\n getWebSocketUrl(wait = false) {\n this.logger.info('device: getting the current websocket url');\n\n // Destructure the services plugin for ease of reference.\n const {services} = this.webex.internal;\n\n // Validate if the method should wait for registration.\n if (wait) {\n return this.waitForRegistration()\n .then(() => services.convertUrlToPriorityHostUrl(this.webSocketUrl))\n .catch((error) => {\n this.logger.warn(error.message);\n\n return Promise.reject(new Error(\n 'device: failed to get the current websocket url'\n ));\n });\n }\n\n // Validate if the device is registered.\n if (!this.registered) {\n return Promise.reject(new Error(\n 'device: cannot get websocket url, device is not registered'\n ));\n }\n\n // Attempt to collect the priority-host-mapped web socket URL.\n const wsUrl = services.convertUrlToPriorityHostUrl(this.webSocketUrl);\n\n // Validate that the url was collected.\n if (wsUrl) {\n return Promise.resolve(wsUrl);\n }\n\n return Promise.reject(new Error(\n 'device: failed to get the current websocket url'\n ));\n },\n\n /**\n * Process a successful device registration.\n *\n * @param {Object} response - response object from registration success.\n * @returns {void}\n */\n processRegistrationSuccess(response) {\n this.logger.info('device: received registration payload');\n\n // Clone the response body for service cleaning.\n const body = {...response.body};\n\n // Clean service data.\n delete body.services;\n delete body.serviceHostMap;\n\n const {etag} = response.headers;\n\n if (this.etag && this.etag === etag) {\n // If current etag matches the previous one and we have sent\n // If-None-Match header the developer and entitlement feature\n // toggles will not be returned\n const {features} = body;\n\n delete body.features;\n // When using the etag feature cache, user and entitlement features are still returned\n this.features.user.reset(features.user);\n this.features.entitlement.reset(features.entitlement);\n }\n\n // Assign the recieved DTO from **WDM** to this device.\n this.set(body);\n\n // Assign the new etag to this device.\n this.set({etag});\n\n // Validate if device is ephemeral and setup refresh timer.\n if (this.config.ephemeral) {\n this.logger.info('device: enqueuing device refresh');\n\n const delay = (this.config.ephemeralDeviceTTL / 2 + 60) * 1000;\n\n this.refreshTimer = safeSetTimeout(() => this.refresh(), delay);\n }\n\n // Emit the registration:success event.\n this.trigger(DEVICE_EVENT_REGISTRATION_SUCCESS, this);\n },\n\n /**\n * Reset the current local logout timer for the registered device if\n * registered.\n *\n * @returns {void}\n */\n resetLogoutTimer() {\n this.logger.info('device: resetting logout timer');\n\n // Clear current logout timer.\n clearTimeout(this.logoutTimer);\n\n // Remove last activity date event listener.\n this.off('change:lastUserActivityDate');\n\n // Remove the logout timer.\n this.unset('logoutTimer');\n\n // Validate if the device is currently in a meeting and is configured to\n // required inactivity enforcement.\n if (!this.isInMeeting && this.config.enableInactivityEnforcement &&\n this.isReachabilityChecked) {\n if (this.isInNetwork) {\n this.setLogoutTimer(this.inNetworkInactivityDuration);\n }\n else {\n this.setLogoutTimer(this.intranetInactivityDuration);\n }\n }\n },\n\n /**\n * Set the value of the logout timer for the current registered device.\n *\n * @param {number} duration - Value in seconds of the new logout timer.\n * @returns {void}\n */\n setLogoutTimer(duration) {\n this.logger.info('device: setting logout timer');\n\n if (!duration || duration <= 0) {\n return;\n }\n\n // Setup user activity date event listener.\n this.on('change:lastUserActivityDate', () => { this.resetLogoutTimer(); });\n\n // Initialize a new timer.\n this.logoutTimer = safeSetTimeout(() => {\n this.webex.logout();\n }, duration * 1000);\n },\n\n /**\n * Wait for the device to be registered.\n *\n * @param {number} [timeout=10] - The maximum duration to wait, in seconds.\n * @returns {Promise<void, Error>}\n */\n waitForRegistration(timeout = 10) {\n this.logger.info('device: waiting for registration');\n\n return new Promise((resolve, reject) => {\n if (this.registered) {\n resolve();\n }\n\n const timeoutTimer = safeSetTimeout(() => reject(\n new Error('device: timeout occured while waiting for registration')\n ), timeout * 1000);\n\n this.once(DEVICE_EVENT_REGISTRATION_SUCCESS, () => {\n clearTimeout(timeoutTimer);\n resolve();\n });\n });\n },\n\n // Deprecated methods.\n\n /**\n * Mark a url as failed and get the next priority host url.\n *\n * @param {string} url - The url to mark as failed.\n * @returns {Promise<string>} - The next priority url.\n */\n @deprecated('device#markUrlFailedAndGetNew(): Use services#markFailedUrl()')\n markUrlFailedAndGetNew(url) {\n return Promise.resolve(this.webex.internal.services.markFailedUrl(url));\n },\n\n // Ampersand method members\n\n /* eslint-disable require-jsdoc */\n /**\n * Initializer method for the device plugin.\n *\n * @override\n * @param {Array<any>} args - An array of items to be mapped as properties.\n * @returns {void}\n */\n @persist('@', decider)\n initialize(...args) {\n // Prototype the extended class in order to preserve the parent member.\n Reflect.apply(WebexPlugin.prototype.initialize, this, args);\n\n // Initialize feature events and listeners.\n FEATURE_COLLECTION_NAMES.forEach((collectionName) => {\n this.features.on(`change:${collectionName}`, (model, value, options) => {\n this.trigger('change', this, options);\n this.trigger('change:features', this, this.features, options);\n });\n });\n\n // Initialize network reachability checking event for url change.\n this.on('change:intranetInactivityCheckUrl', () => {\n this.checkNetworkReachability();\n });\n\n // Initialize network reachability checking event for duration change.\n this.on('change:intranetInactivityDuration', () => {\n this.checkNetworkReachability();\n });\n\n // Initialize network reachability checking event for duration change.\n this.on('change:inNetworkInactivityDuration', () => {\n this.checkNetworkReachability();\n });\n\n // Initialize listener for activity checking.\n this.listenTo(this.webex, 'user-activity', () => {\n this.lastUserActivityDate = Date.now();\n });\n\n // Initialize listener for meeting started event.\n this.listenTo(this.webex, 'meeting started', () => {\n this.isInMeeting = true;\n this.resetLogoutTimer();\n });\n\n // Initialize listener for meeting ended event.\n this.listenTo(this.webex, 'meeting ended', () => {\n this.isInMeeting = false;\n this.resetLogoutTimer();\n });\n }\n /* eslint-enable require-jsdoc */\n});\n\nexport default Device;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAIA;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASA,OAAT,GAAmB;EACjB,OAAO,CAAC,KAAKC,MAAL,CAAYC,SAApB;AACD;;AAED,IAAMC,MAAM,GAAGC,sBAAA,CAAYC,MAAZ,SA2UZ,IAAAC,uBAAA,EAAa,GAAb,CA3UY,UAiZZ,IAAAA,uBAAA,EAAa,GAAb,CAjZY,UA8cZ,IAAAA,uBAAA,EAAa,GAAb,CA9cY,UAkvBZ,IAAAC,kBAAA,EAAW,+DAAX,CAlvBY,UAiwBZ,IAAAC,kBAAA,EAAQ,GAAR,EAAaR,OAAb,CAjwBY,UAAmB;EAEhC;EAEAS,SAAS,EAAE,QAJqB;EAMhC;EACA;EACAC,eAAe,EAAE,OARe;EAUhCC,WAAW,EAAE,KAVmB;EAYhCC,QAAQ,EAAE;IACR;AACJ;AACA;AACA;AACA;IACIC,QAAQ,EAAEC;EANF,CAZsB;;EAqBhC;AACF;AACA;AACA;AACA;AACA;EACEC,KAAK,EAAE;IACL;AACJ;AACA;AACA;AACA;IACIC,oBAAoB,EAAE,QANjB;;IAQL;AACJ;AACA;AACA;AACA;IACIC,mBAAmB,EAAE,QAbhB;;IAeL;AACJ;AACA;AACA;AACA;IACIC,eAAe,EAAE,QApBZ;;IAsBL;AACJ;AACA;AACA;AACA;AACA;AACA;IACIC,UAAU,EAAE,QA7BP;;IA+BL;AACJ;AACA;AACA;AACA;IACIC,OAAO,EAAE,QApCJ;;IAsCL;AACJ;AACA;AACA;AACA;IACIC,0BAA0B,EAAE,QA3CvB;;IA6CL;AACJ;AACA;AACA;AACA;AACA;IACIC,0B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AqD6H,OAArD;MACD,CAHD;IAID,CALD,EALkB,CAYlB;;;IACA,KAAKb,EAAL,CAAQ,mCAAR,EAA6C,YAAM;MACjD,MAAI,CAAC1B,wBAAL;IACD,CAFD,EAbkB,CAiBlB;;IACA,KAAK0B,EAAL,CAAQ,mCAAR,EAA6C,YAAM;MACjD,MAAI,CAAC1B,wBAAL;IACD,CAFD,EAlBkB,CAsBlB;;IACA,KAAK0B,EAAL,CAAQ,oCAAR,EAA8C,YAAM;MAClD,MAAI,CAAC1B,wBAAL;IACD,CAFD,EAvBkB,CA2BlB;;IACA,KAAKwC,QAAL,CAAc,KAAKtF,KAAnB,EAA0B,eAA1B,EAA2C,YAAM;MAC/C,MAAI,CAACL,oBAAL,GAA4B,mBAA5B;IACD,CAFD,EA5BkB,CAgClB;;IACA,KAAK2F,QAAL,CAAc,KAAKtF,KAAnB,EAA0B,iBAA1B,EAA6C,YAAM;MACjD,MAAI,CAACH,WAAL,GAAmB,IAAnB;;MACA,MAAI,CAACkD,gBAAL;IACD,CAHD,EAjCkB,CAsClB;;IACA,KAAKuC,QAAL,CAAc,KAAKtF,KAAnB,EAA0B,eAA1B,EAA2C,YAAM;MAC/C,MAAI,CAACH,WAAL,GAAmB,KAAnB;;MACA,MAAI,CAACkD,gBAAL;IACD,CAHD;EAID;EACD;EA9yBgC;EAAA;AAAA,CAAnB,6DA0UZwC,iBA1UY,oIAgZZA,iBAhZY,wIA6cZA,iBA7cY,6XAAf;;eAizBezI,M"}
1
+ {"version":3,"names":["decider","config","ephemeral","Device","WebexPlugin","extend","waitForValue","deprecated","persist","namespace","extraProperties","idAttribute","children","features","FeaturesModel","props","clientMessagingGiphy","customerCompanyName","customerLogoUrl","deviceType","helpUrl","intranetInactivityDuration","intranetInactivityCheckUrl","inNetworkInactivityDuration","ecmEnabledForAllUsers","ecmSupportedStorageProviders","modificationTime","navigationBarColor","partnerCompanyName","partnerLogoUrl","peopleInsightsEnabled","reportingSiteDesc","reportingSiteUrl","searchEncryptionKeyUrl","showSupportText","supportProviderCompanyName","supportProviderLogoUrl","url","userId","webFileShareControl","webSocketUrl","whiteboardFileShareControl","derived","registered","deps","fn","session","logoutTimer","lastUserActivityDate","isReachabilityChecked","isInMeeting","isInNetwork","meetingStarted","webex","trigger","meetingEnded","refresh","logger","info","canRegister","then","register","body","serialize","mediaCluster","etag","ttl","ephemeralDeviceTTL","headers","defaults","request","method","uri","response","processRegistrationSuccess","catch","reason","statusCode","clear","reject","service","resource","internal","metrics","submitClientMetrics","METRICS","JS_SDK_WDM_REGISTRATION_SUCCESSFUL","error","JS_SDK_WDM_REGISTRATION_FAILED","fields","unregister","warn","resolve","services","waitForCatalog","canRegisterWaitDuration","get","Error","join","checkNetworkReachability","resetLogoutTimer","trackingid","args","prototype","getWebSocketUrl","wait","waitForRegistration","convertUrlToPriorityHostUrl","message","wsUrl","serviceHostMap","user","reset","entitlement","set","delay","refreshTimer","safeSetTimeout","DEVICE_EVENT_REGISTRATION_SUCCESS","clearTimeout","off","unset","enableInactivityEnforcement","setLogoutTimer","duration","on","logout","timeout","timeoutTimer","once","markUrlFailedAndGetNew","markFailedUrl","initialize","FEATURE_COLLECTION_NAMES","forEach","collectionName","model","value","options","listenTo","oneFlight"],"sources":["device.js"],"sourcesContent":["// Internal Dependencies\nimport {deprecated, oneFlight} from '@webex/common';\nimport {persist, waitForValue, WebexPlugin} from '@webex/webex-core';\nimport {safeSetTimeout} from '@webex/common-timers';\n\nimport METRICS from './metrics';\nimport {FEATURE_COLLECTION_NAMES, DEVICE_EVENT_REGISTRATION_SUCCESS} from './constants';\nimport FeaturesModel from './features/features-model';\n\n/**\n * Determine if the plugin should be initialized based on cached storage.\n *\n * @returns {boolean} - If the device is ephemeral.\n */\nfunction decider() {\n return !this.config.ephemeral;\n}\n\nconst Device = WebexPlugin.extend({\n // Ampersand property members.\n\n namespace: 'Device',\n\n // Allow for extra properties to prevent the plugin from failing due to\n // **WDM** service DTO changes.\n extraProperties: 'allow',\n\n idAttribute: 'url',\n\n children: {\n /**\n * The class object that contains all of the feature collections.\n *\n * @type {FeaturesModel}\n */\n features: FeaturesModel,\n },\n\n /**\n * A collection of device properties mostly assigned by the retrieved DTO from\n * the **WDM** service that are mapped against the ampersand properties.\n *\n * @type {Object}\n */\n props: {\n /**\n * This property determines whether or not giphy support is enabled.\n *\n * @type {'ALLOW' | 'BLOCK'}\n */\n clientMessagingGiphy: 'string',\n\n /**\n * This property should store the company name.\n *\n * @type {string}\n */\n customerCompanyName: 'string',\n\n /**\n * This property should store the logo url.\n *\n * @type {string}\n */\n customerLogoUrl: 'string',\n\n /**\n * This property doesn't have any real values, but is sent during device\n * refresh to prevent the **wdm** service from falling back to an iOS device\n * type.\n *\n * @type {string}\n */\n deviceType: 'string',\n\n /**\n * This property should store the help url.\n *\n * @type {string}\n */\n helpUrl: 'string',\n\n /**\n * This property should store the intranet inactivity timer duration.\n *\n * @type {number}\n */\n intranetInactivityDuration: 'number',\n\n /**\n * This property stores the url required to validate if the device is able\n * to actively reach the intranet network.\n *\n * @type {string}\n */\n intranetInactivityCheckUrl: 'string',\n\n /**\n * This property stores the inactivity timer duration, and could possibly\n * deprecate the `intranetInactivityDuration` property.\n *\n * @type {number}\n */\n inNetworkInactivityDuration: 'number',\n\n /**\n * This property stores the ECM (external content management) enabled value\n * for the whole organization.\n *\n * @type {boolean}\n */\n ecmEnabledForAllUsers: ['boolean', false, false],\n\n /**\n * This property stores an array of ECM (external content management)\n * providers that are currently available.\n *\n * @returns {Array<string>}\n */\n ecmSupportedStorageProviders: ['array', false, () => []],\n\n /**\n * This property stores the modification time value retrieved from the\n * **WDM** endpoint formatted as ISO 8601.\n *\n * @type {string}\n */\n modificationTime: 'string',\n\n /**\n * This property stores the navigation bar color.\n *\n * @type {string}\n */\n navigationBarColor: 'string',\n\n /**\n * This property stores the partner company's name when available.\n *\n * @type {string}\n */\n partnerCompanyName: 'string',\n\n /**\n * This property stores the partner company's logo when available.\n *\n * @type {string}\n */\n partnerLogoUrl: 'string',\n\n /**\n * This property stores the availability of people data from the **WDM**\n * service.\n *\n * @type {boolean}\n */\n peopleInsightsEnabled: 'boolean',\n\n /**\n * This property stores the reporting site's description when available.\n *\n * @type {string}\n */\n reportingSiteDesc: 'string',\n\n /**\n * This property stores the reporting site's access url when available.\n *\n * @type {string}\n */\n reportingSiteUrl: 'string',\n\n /**\n * This property stores the encryption key url when available.\n *\n * @type {string}\n */\n searchEncryptionKeyUrl: 'string',\n\n /**\n * This property stores the availability of support-provided text from the\n * **WDM** service.\n *\n * @type {boolean}\n */\n showSupportText: 'boolean',\n\n /**\n * This property stores the support provider's company name when available.\n *\n * @type {string}\n */\n supportProviderCompanyName: 'string',\n\n /**\n * This property stores the support provider's logo url when available.\n *\n * @type {string}\n */\n supportProviderLogoUrl: 'string',\n\n /**\n * This property stores the device's url retrieved from a registration\n * request. This property gets set via the initial registration process by a\n * `this.set()` method.\n *\n * @type {string}\n */\n url: 'string',\n\n /**\n * This property stores the device's userId uuid value, which can also be\n * derived from the device's registerd user's userId retrieved from\n * the **Hydra** service.\n *\n * @type {string}\n */\n userId: 'string',\n\n /**\n * This property stores whether or not file sharing is enabled\n *\n * @type {'BLOCK_BOTH' | 'BLOCK_UPLOAD'}\n */\n webFileShareControl: 'string',\n\n /**\n * This property stores the current web socket url used by the registered\n * device.\n *\n * @type {string}\n */\n webSocketUrl: 'string',\n\n /**\n * This property stores the value indicating whether or not white board file\n * sharing is enabled for the current device.\n *\n * @type {'ALLOW' | 'BLOCK'}\n */\n whiteboardFileShareControl: 'string',\n },\n\n /**\n * A list of derived properties that populate based when their parent data\n * available via the device's properties.\n *\n * @type {Object}\n */\n derived: {\n /**\n * This property determines if the current device is registered.\n *\n * @type {boolean}\n */\n registered: {\n deps: ['url'],\n\n /**\n * Checks if the device is registered by validating that the url exists.\n * Amperstand does not allow this to method to be written as an arrow\n * function.\n *\n * @returns {boolean}\n */\n fn() {\n return !!this.url;\n },\n },\n },\n\n /**\n * Stores timer data as well as other state details.\n *\n * @type {Object}\n */\n session: {\n /**\n * This property stores the logout timer object\n *\n * @type {any}\n */\n logoutTimer: 'any',\n\n /**\n * This property stores the date for the last activity the user made\n * with the current device.\n *\n * @type {number}\n */\n lastUserActivityDate: 'number',\n\n /**\n * This property stores whether or not the reachability check has been\n * performed to prevent the reachability check from performing its\n * operation more than once after a successful check.\n *\n * @returns {boolean}\n */\n isReachabilityChecked: ['boolean', false, false],\n\n /**\n * This property stores whether or not the current device is in a meeting\n * to prevent an unneeded timeout of a meeting due to inactivity.\n *\n * @type {boolean}\n */\n isInMeeting: 'boolean',\n\n /**\n * This property identifies if the device is currently in network to prevent\n * the `resetLogoutTimer()` method from being called repeatedly once its\n * known client is connected to the organization's internal network.\n *\n * @type {boolean}\n */\n isInNetwork: 'boolean',\n },\n\n // Event method members.\n\n /**\n * Trigger meeting started event for webex instance. Used by web-client team.\n *\n * @returns {void}\n */\n meetingStarted() {\n this.webex.trigger('meeting started');\n },\n\n /**\n * Trigger meeting ended event for webex instance. Used by web-client team.\n *\n * @returns {void}\n */\n meetingEnded() {\n this.webex.trigger('meeting ended');\n },\n\n // Registration method members\n\n /* eslint-disable require-jsdoc */\n /**\n * Refresh the current registered device if able.\n *\n * @returns {Promise<void, Error>}\n */\n @oneFlight\n @waitForValue('@')\n refresh() {\n this.logger.info('device: refreshing');\n\n // Validate that the device can be registered.\n return this.canRegister().then(() => {\n // Validate if the device is not registered and register instead.\n if (!this.registered) {\n this.logger.info('device: device not registered, registering');\n\n return this.register();\n }\n\n // Merge body configurations, overriding defaults.\n const body = {\n ...this.serialize(),\n ...(this.config.body ? this.config.body : {}),\n };\n\n // Remove unneeded properties from the body object.\n delete body.features;\n delete body.mediaCluster;\n delete body.etag;\n\n // Append a ttl value if the device is marked as ephemeral.\n if (this.config.ephemeral) {\n body.ttl = this.config.ephemeralDeviceTTL;\n }\n\n // Merge header configurations, overriding defaults.\n const headers = {\n ...(this.config.defaults.headers ? this.config.defaults.headers : {}),\n ...(this.config.headers ? this.config.headers : {}),\n // If etag is sent, WDM will not send developer feature toggles unless they have changed\n ...(this.etag ? {'If-None-Match': this.etag} : {}),\n };\n\n return this.request({\n method: 'PUT',\n uri: this.url,\n body,\n headers,\n })\n .then((response) => this.processRegistrationSuccess(response))\n .catch((reason) => {\n // Handle a 404 error, which indicates that the device is no longer\n // valid and needs to be registered as a new device.\n if (reason.statusCode === 404) {\n this.logger.info('device: refresh failed, device is not valid');\n this.logger.info('device: attempting to register a new device');\n\n this.clear();\n\n return this.register();\n }\n\n return Promise.reject(reason);\n });\n });\n },\n\n /**\n * Register or refresh a device depending on the current device state. Device\n * registration utilizes the services plugin to send the request to the\n * **WDM** service.\n *\n * @returns {Promise<void, Error>}\n */\n @oneFlight\n @waitForValue('@')\n register() {\n this.logger.info('device: registering');\n\n // Validate that the device can be registered.\n return this.canRegister().then(() => {\n // Validate if the device is already registered and refresh instead.\n if (this.registered) {\n this.logger.info('device: device already registered, refreshing');\n\n return this.refresh();\n }\n\n // Merge body configurations, overriding defaults.\n const body = {\n ...(this.config.defaults.body ? this.config.defaults.body : {}),\n ...(this.config.body ? this.config.body : {}),\n };\n\n // Merge header configurations, overriding defaults.\n const headers = {\n ...(this.config.defaults.headers ? this.config.defaults.headers : {}),\n ...(this.config.headers ? this.config.headers : {}),\n };\n\n // Append a ttl value if the device is marked as ephemeral\n if (this.config.ephemeral) {\n body.ttl = this.config.ephemeralDeviceTTL;\n }\n\n // This will be replaced by a `create()` method.\n return this.request({\n method: 'POST',\n service: 'wdm',\n resource: 'devices',\n body,\n headers,\n })\n .then((response) => {\n this.webex.internal.metrics.submitClientMetrics(\n METRICS.JS_SDK_WDM_REGISTRATION_SUCCESSFUL\n );\n\n return this.processRegistrationSuccess(response);\n })\n .catch((error) => {\n this.webex.internal.metrics.submitClientMetrics(METRICS.JS_SDK_WDM_REGISTRATION_FAILED, {\n fields: {error},\n });\n throw error;\n });\n });\n },\n\n /**\n * Unregister the current registered device if available. Unregistering a\n * device utilizes the services plugin to send the request to the **WDM**\n * service.\n *\n * @returns {Promise<void, Error>}\n */\n @oneFlight\n @waitForValue('@')\n unregister() {\n this.logger.info('device: unregistering');\n\n if (!this.registered) {\n this.logger.warn('device: not registered');\n\n return Promise.resolve();\n }\n\n return this.request({\n uri: this.url,\n method: 'DELETE',\n }).then(() => this.clear());\n },\n /* eslint-enable require-jsdoc */\n\n // Helper method members\n\n /**\n * Determine if registration methods can be performed. This method utilizes\n * the `services` plugin to confirm if the appropriate service urls are\n * available for device registration.\n *\n * @returns {Promise<void, Error>}\n */\n canRegister() {\n this.logger.info('device: validating if registration can occur');\n\n // Destructure the services plugin for ease of reference.\n const {services} = this.webex.internal;\n\n // Wait for the postauth catalog to populate.\n return services.waitForCatalog('postauth', this.config.canRegisterWaitDuration).then(() =>\n // Validate that the service exists after waiting for the catalog.\n services.get('wdm')\n ? Promise.resolve()\n : Promise.reject(\n new Error(\n [\n 'device: cannot register,',\n \"'wdm' service is not available from the postauth catalog\",\n ].join(' ')\n )\n )\n );\n },\n\n /**\n * Check if the device can currently reach the inactivity check url.\n *\n * @returns {Promise<void, Error>}\n */\n checkNetworkReachability() {\n this.logger.info('device: checking network reachability');\n\n // Validate if the device has been checked and reset the logout timer.\n if (this.isReachabilityChecked) {\n return Promise.resolve(this.resetLogoutTimer());\n }\n\n this.isReachabilityChecked = true;\n\n // Validate if the device has a intranet checking url.\n if (!this.intranetInactivityCheckUrl) {\n this.isInNetwork = false;\n\n return Promise.resolve(this.resetLogoutTimer());\n }\n\n // Clear unnecessary headers for reachability request.\n const headers = {\n 'cisco-no-http-redirect': null,\n 'spark-user-agent': null,\n trackingid: null,\n };\n\n // Send the network reachability request.\n return this.request({\n headers,\n method: 'GET',\n uri: this.intranetInactivityCheckUrl,\n })\n .then(() => {\n this.isInNetwork = true;\n\n return Promise.resolve(this.resetLogoutTimer());\n })\n .catch(() => {\n this.logger.info('device: did not reach ping endpoint');\n this.logger.info('device: triggering off-network timer');\n\n this.isInNetwork = false;\n\n return Promise.resolve(this.resetLogoutTimer());\n });\n },\n\n /**\n * Clears the registration ttl value if available.\n *\n * @param {Object} options - Values to be cleared.\n * @returns {void}\n */\n clear(...args) {\n this.logger.info('device: clearing registered device');\n\n // Prototype the extended class in order to preserve the parent member.\n Reflect.apply(WebexPlugin.prototype.clear, this, args);\n },\n\n /**\n * Get the current websocket url with the appropriate priority host.\n *\n * @param {boolean} [wait=false] - Willing to wait on a valid url.\n * @returns {Promise<string, Error>} - The priority-mapped web socket url.\n */\n getWebSocketUrl(wait = false) {\n this.logger.info('device: getting the current websocket url');\n\n // Destructure the services plugin for ease of reference.\n const {services} = this.webex.internal;\n\n // Validate if the method should wait for registration.\n if (wait) {\n return this.waitForRegistration()\n .then(() => services.convertUrlToPriorityHostUrl(this.webSocketUrl))\n .catch((error) => {\n this.logger.warn(error.message);\n\n return Promise.reject(new Error('device: failed to get the current websocket url'));\n });\n }\n\n // Validate if the device is registered.\n if (!this.registered) {\n return Promise.reject(\n new Error('device: cannot get websocket url, device is not registered')\n );\n }\n\n // Attempt to collect the priority-host-mapped web socket URL.\n const wsUrl = services.convertUrlToPriorityHostUrl(this.webSocketUrl);\n\n // Validate that the url was collected.\n if (wsUrl) {\n return Promise.resolve(wsUrl);\n }\n\n return Promise.reject(new Error('device: failed to get the current websocket url'));\n },\n\n /**\n * Process a successful device registration.\n *\n * @param {Object} response - response object from registration success.\n * @returns {void}\n */\n processRegistrationSuccess(response) {\n this.logger.info('device: received registration payload');\n\n // Clone the response body for service cleaning.\n const body = {...response.body};\n\n // Clean service data.\n delete body.services;\n delete body.serviceHostMap;\n\n const {etag} = response.headers;\n\n if (this.etag && this.etag === etag) {\n // If current etag matches the previous one and we have sent\n // If-None-Match header the developer and entitlement feature\n // toggles will not be returned\n const {features} = body;\n\n delete body.features;\n // When using the etag feature cache, user and entitlement features are still returned\n this.features.user.reset(features.user);\n this.features.entitlement.reset(features.entitlement);\n }\n\n // Assign the recieved DTO from **WDM** to this device.\n this.set(body);\n\n // Assign the new etag to this device.\n this.set({etag});\n\n // Validate if device is ephemeral and setup refresh timer.\n if (this.config.ephemeral) {\n this.logger.info('device: enqueuing device refresh');\n\n const delay = (this.config.ephemeralDeviceTTL / 2 + 60) * 1000;\n\n this.refreshTimer = safeSetTimeout(() => this.refresh(), delay);\n }\n\n // Emit the registration:success event.\n this.trigger(DEVICE_EVENT_REGISTRATION_SUCCESS, this);\n },\n\n /**\n * Reset the current local logout timer for the registered device if\n * registered.\n *\n * @returns {void}\n */\n resetLogoutTimer() {\n this.logger.info('device: resetting logout timer');\n\n // Clear current logout timer.\n clearTimeout(this.logoutTimer);\n\n // Remove last activity date event listener.\n this.off('change:lastUserActivityDate');\n\n // Remove the logout timer.\n this.unset('logoutTimer');\n\n // Validate if the device is currently in a meeting and is configured to\n // required inactivity enforcement.\n if (\n !this.isInMeeting &&\n this.config.enableInactivityEnforcement &&\n this.isReachabilityChecked\n ) {\n if (this.isInNetwork) {\n this.setLogoutTimer(this.inNetworkInactivityDuration);\n } else {\n this.setLogoutTimer(this.intranetInactivityDuration);\n }\n }\n },\n\n /**\n * Set the value of the logout timer for the current registered device.\n *\n * @param {number} duration - Value in seconds of the new logout timer.\n * @returns {void}\n */\n setLogoutTimer(duration) {\n this.logger.info('device: setting logout timer');\n\n if (!duration || duration <= 0) {\n return;\n }\n\n // Setup user activity date event listener.\n this.on('change:lastUserActivityDate', () => {\n this.resetLogoutTimer();\n });\n\n // Initialize a new timer.\n this.logoutTimer = safeSetTimeout(() => {\n this.webex.logout();\n }, duration * 1000);\n },\n\n /**\n * Wait for the device to be registered.\n *\n * @param {number} [timeout=10] - The maximum duration to wait, in seconds.\n * @returns {Promise<void, Error>}\n */\n waitForRegistration(timeout = 10) {\n this.logger.info('device: waiting for registration');\n\n return new Promise((resolve, reject) => {\n if (this.registered) {\n resolve();\n }\n\n const timeoutTimer = safeSetTimeout(\n () => reject(new Error('device: timeout occured while waiting for registration')),\n timeout * 1000\n );\n\n this.once(DEVICE_EVENT_REGISTRATION_SUCCESS, () => {\n clearTimeout(timeoutTimer);\n resolve();\n });\n });\n },\n\n // Deprecated methods.\n\n /**\n * Mark a url as failed and get the next priority host url.\n *\n * @param {string} url - The url to mark as failed.\n * @returns {Promise<string>} - The next priority url.\n */\n @deprecated('device#markUrlFailedAndGetNew(): Use services#markFailedUrl()')\n markUrlFailedAndGetNew(url) {\n return Promise.resolve(this.webex.internal.services.markFailedUrl(url));\n },\n\n // Ampersand method members\n\n /* eslint-disable require-jsdoc */\n /**\n * Initializer method for the device plugin.\n *\n * @override\n * @param {Array<any>} args - An array of items to be mapped as properties.\n * @returns {void}\n */\n @persist('@', decider)\n initialize(...args) {\n // Prototype the extended class in order to preserve the parent member.\n Reflect.apply(WebexPlugin.prototype.initialize, this, args);\n\n // Initialize feature events and listeners.\n FEATURE_COLLECTION_NAMES.forEach((collectionName) => {\n this.features.on(`change:${collectionName}`, (model, value, options) => {\n this.trigger('change', this, options);\n this.trigger('change:features', this, this.features, options);\n });\n });\n\n // Initialize network reachability checking event for url change.\n this.on('change:intranetInactivityCheckUrl', () => {\n this.checkNetworkReachability();\n });\n\n // Initialize network reachability checking event for duration change.\n this.on('change:intranetInactivityDuration', () => {\n this.checkNetworkReachability();\n });\n\n // Initialize network reachability checking event for duration change.\n this.on('change:inNetworkInactivityDuration', () => {\n this.checkNetworkReachability();\n });\n\n // Initialize listener for activity checking.\n this.listenTo(this.webex, 'user-activity', () => {\n this.lastUserActivityDate = Date.now();\n });\n\n // Initialize listener for meeting started event.\n this.listenTo(this.webex, 'meeting started', () => {\n this.isInMeeting = true;\n this.resetLogoutTimer();\n });\n\n // Initialize listener for meeting ended event.\n this.listenTo(this.webex, 'meeting ended', () => {\n this.isInMeeting = false;\n this.resetLogoutTimer();\n });\n },\n /* eslint-enable require-jsdoc */\n});\n\nexport default Device;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AACA;AACA;AACA;AAEA;AACA;AACA;AAAsD;AAAA;AAAA;AAEtD;AACA;AACA;AACA;AACA;AACA,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AACL,oBAAoB,GAAG,mBAAU;IACxC,CAAC,CAAC;;IAEF;IACA,IAAI,CAAC2F,QAAQ,CAAC,IAAI,CAACtF,KAAK,EAAE,iBAAiB,EAAE,YAAM;MACjD,MAAI,CAACH,WAAW,GAAG,IAAI;MACvB,MAAI,CAACkD,gBAAgB,EAAE;IACzB,CAAC,CAAC;;IAEF;IACA,IAAI,CAACuC,QAAQ,CAAC,IAAI,CAACtF,KAAK,EAAE,eAAe,EAAE,YAAM;MAC/C,MAAI,CAACH,WAAW,GAAG,KAAK;MACxB,MAAI,CAACkD,gBAAgB,EAAE;IACzB,CAAC,CAAC;EACJ,CAAC,CACD;EAAA;AACF,CAAC,6DAreEwC,iBAAS,oIAqETA,iBAAS,wIA8DTA,iBAAS,6XAkWV;AAAC,eAEYzI,MAAM;AAAA"}
@@ -1,20 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
-
5
4
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
6
-
7
5
  _Object$defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
-
11
8
  exports.default = void 0;
12
-
13
9
  var _ampersandCollection = _interopRequireDefault(require("ampersand-collection"));
14
-
15
10
  var _featureModel = _interopRequireDefault(require("./feature-model"));
16
-
17
11
  // External dependencies.
12
+
18
13
  // Local Dependencies
19
14
 
20
15
  /**
@@ -31,7 +26,6 @@ var FeatureCollection = _ampersandCollection.default.extend({
31
26
  * @type {string}
32
27
  */
33
28
  mainIndex: 'key',
34
-
35
29
  /**
36
30
  * The type of model this collection can contain.
37
31
  *
@@ -39,7 +33,6 @@ var FeatureCollection = _ampersandCollection.default.extend({
39
33
  */
40
34
  model: _featureModel.default
41
35
  });
42
-
43
36
  var _default = FeatureCollection;
44
37
  exports.default = _default;
45
38
  //# sourceMappingURL=feature-collection.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["FeatureCollection","AmpCollection","extend","mainIndex","model","FeatureModel"],"sources":["feature-collection.js"],"sourcesContent":["// External dependencies.\nimport AmpCollection from 'ampersand-collection';\n\n// Local Dependencies\nimport FeatureModel from './feature-model';\n\n/**\n * Feature collection model.\n *\n * @description\n * This model contains a collection of features under a specific collection\n * group.\n */\nconst FeatureCollection = AmpCollection.extend({\n /**\n * The unique identifier for the models in this collection.\n *\n * @type {string}\n */\n mainIndex: 'key',\n\n /**\n * The type of model this collection can contain.\n *\n * @type {Class}\n */\n model: FeatureModel\n});\n\nexport default FeatureCollection;\n"],"mappings":";;;;;;;;;;;;AACA;;AAGA;;AAJA;AAGA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,iBAAiB,GAAGC,4BAAA,CAAcC,MAAd,CAAqB;EAC7C;AACF;AACA;AACA;AACA;EACEC,SAAS,EAAE,KANkC;;EAQ7C;AACF;AACA;AACA;AACA;EACEC,KAAK,EAAEC;AAbsC,CAArB,CAA1B;;eAgBeL,iB"}
1
+ {"version":3,"names":["FeatureCollection","AmpCollection","extend","mainIndex","model","FeatureModel"],"sources":["feature-collection.js"],"sourcesContent":["// External dependencies.\nimport AmpCollection from 'ampersand-collection';\n\n// Local Dependencies\nimport FeatureModel from './feature-model';\n\n/**\n * Feature collection model.\n *\n * @description\n * This model contains a collection of features under a specific collection\n * group.\n */\nconst FeatureCollection = AmpCollection.extend({\n /**\n * The unique identifier for the models in this collection.\n *\n * @type {string}\n */\n mainIndex: 'key',\n\n /**\n * The type of model this collection can contain.\n *\n * @type {Class}\n */\n model: FeatureModel,\n});\n\nexport default FeatureCollection;\n"],"mappings":";;;;;;;;AACA;AAGA;AAJA;;AAGA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,iBAAiB,GAAGC,4BAAa,CAACC,MAAM,CAAC;EAC7C;AACF;AACA;AACA;AACA;EACEC,SAAS,EAAE,KAAK;EAEhB;AACF;AACA;AACA;AACA;EACEC,KAAK,EAAEC;AACT,CAAC,CAAC;AAAC,eAEYL,iBAAiB;AAAA"}
@@ -1,45 +1,26 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$keys = require("@babel/runtime-corejs2/core-js/object/keys");
4
-
5
4
  var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
6
-
7
5
  var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
8
-
9
6
  var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
10
-
11
7
  var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
12
-
13
8
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
14
-
15
9
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
16
-
17
10
  _Object$defineProperty(exports, "__esModule", {
18
11
  value: true
19
12
  });
20
-
21
13
  exports.default = void 0;
22
-
23
14
  var _apply = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/reflect/apply"));
24
-
25
15
  var _isNan = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/number/is-nan"));
26
-
27
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
28
-
29
17
  var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/typeof"));
30
-
31
18
  var _isObject2 = _interopRequireDefault(require("lodash/isObject"));
32
-
33
19
  var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
34
-
35
20
  var _ampersandState = _interopRequireDefault(require("ampersand-state"));
36
-
37
21
  var _constants = require("../constants");
38
-
39
22
  function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
40
-
41
23
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
42
-
43
24
  /**
44
25
  * The model returned from the {@link FeatureModel#parse} method.
45
26
  *
@@ -58,7 +39,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
58
39
  var FeatureModel = _ampersandState.default.extend({
59
40
  idAttribute: 'key',
60
41
  // needed by Ampersand to determine unique item
42
+
61
43
  // Ampersand property members.
44
+
62
45
  props: {
63
46
  /**
64
47
  * Contains the unique identifier for this feature to be addressed by.
@@ -66,21 +49,18 @@ var FeatureModel = _ampersandState.default.extend({
66
49
  * @type {string}
67
50
  */
68
51
  key: 'string',
69
-
70
52
  /**
71
53
  * This property contains the date in which this feature was last modified.
72
54
  *
73
55
  * @type {date}
74
56
  */
75
57
  lastModified: 'date',
76
-
77
58
  /**
78
59
  * This property defines whether or not the feature is mutable.
79
60
  *
80
61
  * @type {boolean}
81
62
  */
82
63
  mutable: 'boolean',
83
-
84
64
  /**
85
65
  * This property contains the data type the string value should be
86
66
  * interpreted as.
@@ -88,14 +68,12 @@ var FeatureModel = _ampersandState.default.extend({
88
68
  * @type {FEATURE_TYPES}
89
69
  */
90
70
  type: 'string',
91
-
92
71
  /**
93
72
  * This property contains the string value of this feature.
94
73
  *
95
74
  * @type {string}
96
75
  */
97
76
  val: 'string',
98
-
99
77
  /**
100
78
  * This property contains the interpreted value of this feature.
101
79
  *
@@ -103,7 +81,6 @@ var FeatureModel = _ampersandState.default.extend({
103
81
  */
104
82
  value: 'any'
105
83
  },
106
-
107
84
  /**
108
85
  * Class object constructor. This method safely initializes the class object
109
86
  * prior to it fully loading to allow data to be accessed and modified
@@ -121,7 +98,6 @@ var FeatureModel = _ampersandState.default.extend({
121
98
  return (0, _apply.default)(_ampersandState.default.prototype.constructor, this, [attrs, options]);
122
99
  },
123
100
  // Ampsersand method members.
124
-
125
101
  /**
126
102
  * Parse {@link FeatureModel} properties recieved as strings from **WDM**
127
103
  * and cast them as their appropriate types.
@@ -138,31 +114,31 @@ var FeatureModel = _ampersandState.default.extend({
138
114
  // Return an empty object to satisfy the requirements of `Ampersand`.
139
115
  return {};
140
116
  }
141
-
142
117
  var parsedModel = _objectSpread({}, model);
118
+ var val = parsedModel.val;
143
119
 
144
- var val = parsedModel.val; // Validate that the value is a number.
145
-
120
+ // Validate that the value is a number.
146
121
  if (!(0, _isNan.default)(Number(val))) {
147
122
  parsedModel.type = _constants.FEATURE_TYPES.NUMBER;
148
123
  parsedModel.value = Number(val);
149
- } // Validate if the value should be a true boolean.
124
+ }
125
+ // Validate if the value should be a true boolean.
150
126
  else if (typeof val === 'string' && val.toLowerCase() === 'true') {
151
127
  parsedModel.type = _constants.FEATURE_TYPES.BOOLEAN;
152
128
  parsedModel.value = true;
153
- } // Validate if the value should be a false boolean.
129
+ }
130
+ // Validate if the value should be a false boolean.
154
131
  else if (typeof val === 'string' && val.toLowerCase() === 'false') {
155
132
  parsedModel.type = _constants.FEATURE_TYPES.BOOLEAN;
156
133
  parsedModel.value = false;
157
- } // In all other cases, the value is string, even if it is undefined.
134
+ }
135
+ // In all other cases, the value is string, even if it is undefined.
158
136
  else {
159
137
  parsedModel.type = _constants.FEATURE_TYPES.STRING;
160
138
  parsedModel.value = val;
161
139
  }
162
-
163
140
  return parsedModel;
164
141
  },
165
-
166
142
  /**
167
143
  * Serialize the feature using the parent ampersand method with its date as an
168
144
  * ISO string. This converts the feature into a request-transportable object.
@@ -175,18 +151,16 @@ var FeatureModel = _ampersandState.default.extend({
175
151
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
176
152
  args[_key] = arguments[_key];
177
153
  }
178
-
179
154
  // Call the overloaded class member.
180
- var attrs = (0, _apply.default)(_ampersandState.default.prototype.serialize, this, args); // Validate that the overloaded class member returned an object with the
181
- // `lastModified` key-value pair and instance it as an ISO string.
155
+ var attrs = (0, _apply.default)(_ampersandState.default.prototype.serialize, this, args);
182
156
 
157
+ // Validate that the overloaded class member returned an object with the
158
+ // `lastModified` key-value pair and instance it as an ISO string.
183
159
  if (attrs.lastModified) {
184
160
  attrs.lastModified = new Date(attrs.lastModified).toISOString();
185
161
  }
186
-
187
162
  return attrs;
188
163
  },
189
-
190
164
  /**
191
165
  * Set a property of this object to a specific value. This method utilizes
192
166
  * code that exists within the `ampersand-state` dependency to handle
@@ -204,8 +178,9 @@ var FeatureModel = _ampersandState.default.extend({
204
178
  // Declare formatted output variables for properly setting the targetted
205
179
  // property for this method.
206
180
  var attrs;
207
- var optns; // Validate if the key is an instance of any object or not.
181
+ var optns;
208
182
 
183
+ // Validate if the key is an instance of any object or not.
209
184
  if ((0, _isObject2.default)(key) || key === null) {
210
185
  attrs = key;
211
186
  optns = value;
@@ -214,12 +189,10 @@ var FeatureModel = _ampersandState.default.extend({
214
189
  attrs[key] = value;
215
190
  optns = options;
216
191
  }
217
-
218
192
  attrs = this.parse(attrs, optns);
219
193
  return (0, _apply.default)(_ampersandState.default.prototype.set, this, [attrs, optns]);
220
194
  }
221
195
  });
222
-
223
196
  var _default = FeatureModel;
224
197
  exports.default = _default;
225
198
  //# sourceMappingURL=feature-model.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["FeatureModel","AmpState","extend","idAttribute","props","key","lastModified","mutable","type","val","value","constructor","attrs","options","parse","prototype","model","parsedModel","Number","FEATURE_TYPES","NUMBER","toLowerCase","BOOLEAN","STRING","serialize","args","Date","toISOString","set","optns"],"sources":["feature-model.js"],"sourcesContent":["// External dependencies.\nimport AmpState from 'ampersand-state';\nimport {defaults, isObject} from 'lodash';\n\nimport {FEATURE_TYPES} from '../constants';\n\n/**\n * The model returned from the {@link FeatureModel#parse} method.\n *\n * @typedef {Object} ParsedFeatureModel\n * @property {boolean|number|string} ParsedFeatureModel.value - The parsed val.\n * @property {string} ParsedFeatureModel.type - The type of the parsed val.\n */\n\n/**\n * Feature model.\n *\n * @description\n * This model contains details on a single feature and is received from the\n * **WDM** service upon registration.\n */\nconst FeatureModel = AmpState.extend({\n\n idAttribute: 'key', // needed by Ampersand to determine unique item\n\n // Ampersand property members.\n\n props: {\n /**\n * Contains the unique identifier for this feature to be addressed by.\n *\n * @type {string}\n */\n key: 'string',\n\n /**\n * This property contains the date in which this feature was last modified.\n *\n * @type {date}\n */\n lastModified: 'date',\n\n /**\n * This property defines whether or not the feature is mutable.\n *\n * @type {boolean}\n */\n mutable: 'boolean',\n\n /**\n * This property contains the data type the string value should be\n * interpreted as.\n *\n * @type {FEATURE_TYPES}\n */\n type: 'string',\n\n /**\n * This property contains the string value of this feature.\n *\n * @type {string}\n */\n val: 'string',\n\n /**\n * This property contains the interpreted value of this feature.\n *\n * @type {any}\n */\n value: 'any'\n },\n\n /**\n * Class object constructor. This method safely initializes the class object\n * prior to it fully loading to allow data to be accessed and modified\n * immediately after construction instead of initialization.\n *\n * @override\n * @param {Object} attrs - An object to map against the feature's properties.\n * @param {Object} [options={}] - Ampersand options for `parse` and `parent`.\n */\n constructor(attrs, options = {}) {\n defaults(options, {parse: true});\n\n return Reflect.apply(\n AmpState.prototype.constructor,\n this,\n [attrs, options]\n );\n },\n\n // Ampsersand method members.\n\n /**\n * Parse {@link FeatureModel} properties recieved as strings from **WDM**\n * and cast them as their appropriate types.\n *\n * @private\n * @memberof FeatureModel\n * @param {Object} model - The model to parse.\n * @property {string} model.val - The value to be parsed.\n * @returns {ParsedFeatureModel} - The parsed model.\n */\n parse(model) {\n // Validate that a model was provided and that it is an object.\n if (!model || typeof model !== 'object') {\n // Return an empty object to satisfy the requirements of `Ampersand`.\n return {};\n }\n\n const parsedModel = {...model};\n const {val} = parsedModel;\n\n // Validate that the value is a number.\n if (!Number.isNaN(Number(val))) {\n parsedModel.type = FEATURE_TYPES.NUMBER;\n parsedModel.value = Number(val);\n }\n // Validate if the value should be a true boolean.\n else if (typeof val === 'string' && val.toLowerCase() === 'true') {\n parsedModel.type = FEATURE_TYPES.BOOLEAN;\n parsedModel.value = true;\n }\n // Validate if the value should be a false boolean.\n else if (typeof val === 'string' && val.toLowerCase() === 'false') {\n parsedModel.type = FEATURE_TYPES.BOOLEAN;\n parsedModel.value = false;\n }\n // In all other cases, the value is string, even if it is undefined.\n else {\n parsedModel.type = FEATURE_TYPES.STRING;\n parsedModel.value = val;\n }\n\n return parsedModel;\n },\n\n /**\n * Serialize the feature using the parent ampersand method with its date as an\n * ISO string. This converts the feature into a request-transportable object.\n *\n * @override\n * @param {Record<string,boolean>} [args] - List of properties to serialize.\n * @returns {Object} - The request-ready transport object.\n */\n serialize(...args) {\n // Call the overloaded class member.\n const attrs = Reflect.apply(AmpState.prototype.serialize, this, args);\n\n // Validate that the overloaded class member returned an object with the\n // `lastModified` key-value pair and instance it as an ISO string.\n if (attrs.lastModified) {\n attrs.lastModified = (new Date(attrs.lastModified).toISOString());\n }\n\n return attrs;\n },\n\n /**\n * Set a property of this object to a specific value. This method utilizes\n * code that exists within the `ampersand-state` dependency to handle\n * scenarios in which `key = {\"key\": \"value\"}` or\n * `key = \"key\", value = \"value\"`. Since the snippet is pulled directly from\n * `ampersand-state`, there is no need to test both scenarios.\n *\n * @override\n * @param {object | string} key - The key value, or object to be set.\n * @param {any} value - The key value or object to set the keyed pair to.\n * @param {any} options - The object to set the keyed pair to.\n * @returns {any} - The changed property.\n */\n set(key, value, options) {\n // Declare formatted output variables for properly setting the targetted\n // property for this method.\n let attrs;\n let optns;\n\n // Validate if the key is an instance of any object or not.\n if (isObject(key) || key === null) {\n attrs = key;\n optns = value;\n }\n else {\n attrs = {};\n attrs[key] = value;\n optns = options;\n }\n\n attrs = this.parse(attrs, optns);\n\n return Reflect.apply(AmpState.prototype.set, this, [attrs, optns]);\n }\n});\n\nexport default FeatureModel;\n"],"mappings":";;;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tJmB,EAsJV;IACvB;IACA;IACA,IAAID,KAAJ;IACA,IAAIiB,KAAJ,CAJuB,CAMvB;;IACA,IAAI,wBAASxB,GAAT,KAAiBA,GAAG,KAAK,IAA7B,EAAmC;MACjCO,KAAK,GAAGP,GAAR;MACAwB,KAAK,GAAGnB,KAAR;IACD,CAHD,MAIK;MACHE,KAAK,GAAG,EAAR;MACAA,KAAK,CAACP,GAAD,CAAL,GAAaK,KAAb;MACAmB,KAAK,GAAGhB,OAAR;IACD;;IAEDD,KAAK,GAAG,KAAKE,KAAL,CAAWF,KAAX,EAAkBiB,KAAlB,CAAR;IAEA,OAAO,oBAAc5B,uBAAA,CAASc,SAAT,CAAmBa,GAAjC,EAAsC,IAAtC,EAA4C,CAAChB,KAAD,EAAQiB,KAAR,CAA5C,CAAP;EACD;AA1KkC,CAAhB,CAArB;;eA6Ke7B,Y"}
1
+ {"version":3,"names":["FeatureModel","AmpState","extend","idAttribute","props","key","lastModified","mutable","type","val","value","constructor","attrs","options","parse","prototype","model","parsedModel","Number","FEATURE_TYPES","NUMBER","toLowerCase","BOOLEAN","STRING","serialize","args","Date","toISOString","set","optns"],"sources":["feature-model.js"],"sourcesContent":["// External dependencies.\nimport AmpState from 'ampersand-state';\nimport {defaults, isObject} from 'lodash';\n\nimport {FEATURE_TYPES} from '../constants';\n\n/**\n * The model returned from the {@link FeatureModel#parse} method.\n *\n * @typedef {Object} ParsedFeatureModel\n * @property {boolean|number|string} ParsedFeatureModel.value - The parsed val.\n * @property {string} ParsedFeatureModel.type - The type of the parsed val.\n */\n\n/**\n * Feature model.\n *\n * @description\n * This model contains details on a single feature and is received from the\n * **WDM** service upon registration.\n */\nconst FeatureModel = AmpState.extend({\n idAttribute: 'key', // needed by Ampersand to determine unique item\n\n // Ampersand property members.\n\n props: {\n /**\n * Contains the unique identifier for this feature to be addressed by.\n *\n * @type {string}\n */\n key: 'string',\n\n /**\n * This property contains the date in which this feature was last modified.\n *\n * @type {date}\n */\n lastModified: 'date',\n\n /**\n * This property defines whether or not the feature is mutable.\n *\n * @type {boolean}\n */\n mutable: 'boolean',\n\n /**\n * This property contains the data type the string value should be\n * interpreted as.\n *\n * @type {FEATURE_TYPES}\n */\n type: 'string',\n\n /**\n * This property contains the string value of this feature.\n *\n * @type {string}\n */\n val: 'string',\n\n /**\n * This property contains the interpreted value of this feature.\n *\n * @type {any}\n */\n value: 'any',\n },\n\n /**\n * Class object constructor. This method safely initializes the class object\n * prior to it fully loading to allow data to be accessed and modified\n * immediately after construction instead of initialization.\n *\n * @override\n * @param {Object} attrs - An object to map against the feature's properties.\n * @param {Object} [options={}] - Ampersand options for `parse` and `parent`.\n */\n constructor(attrs, options = {}) {\n defaults(options, {parse: true});\n\n return Reflect.apply(AmpState.prototype.constructor, this, [attrs, options]);\n },\n\n // Ampsersand method members.\n\n /**\n * Parse {@link FeatureModel} properties recieved as strings from **WDM**\n * and cast them as their appropriate types.\n *\n * @private\n * @memberof FeatureModel\n * @param {Object} model - The model to parse.\n * @property {string} model.val - The value to be parsed.\n * @returns {ParsedFeatureModel} - The parsed model.\n */\n parse(model) {\n // Validate that a model was provided and that it is an object.\n if (!model || typeof model !== 'object') {\n // Return an empty object to satisfy the requirements of `Ampersand`.\n return {};\n }\n\n const parsedModel = {...model};\n const {val} = parsedModel;\n\n // Validate that the value is a number.\n if (!Number.isNaN(Number(val))) {\n parsedModel.type = FEATURE_TYPES.NUMBER;\n parsedModel.value = Number(val);\n }\n // Validate if the value should be a true boolean.\n else if (typeof val === 'string' && val.toLowerCase() === 'true') {\n parsedModel.type = FEATURE_TYPES.BOOLEAN;\n parsedModel.value = true;\n }\n // Validate if the value should be a false boolean.\n else if (typeof val === 'string' && val.toLowerCase() === 'false') {\n parsedModel.type = FEATURE_TYPES.BOOLEAN;\n parsedModel.value = false;\n }\n // In all other cases, the value is string, even if it is undefined.\n else {\n parsedModel.type = FEATURE_TYPES.STRING;\n parsedModel.value = val;\n }\n\n return parsedModel;\n },\n\n /**\n * Serialize the feature using the parent ampersand method with its date as an\n * ISO string. This converts the feature into a request-transportable object.\n *\n * @override\n * @param {Record<string,boolean>} [args] - List of properties to serialize.\n * @returns {Object} - The request-ready transport object.\n */\n serialize(...args) {\n // Call the overloaded class member.\n const attrs = Reflect.apply(AmpState.prototype.serialize, this, args);\n\n // Validate that the overloaded class member returned an object with the\n // `lastModified` key-value pair and instance it as an ISO string.\n if (attrs.lastModified) {\n attrs.lastModified = new Date(attrs.lastModified).toISOString();\n }\n\n return attrs;\n },\n\n /**\n * Set a property of this object to a specific value. This method utilizes\n * code that exists within the `ampersand-state` dependency to handle\n * scenarios in which `key = {\"key\": \"value\"}` or\n * `key = \"key\", value = \"value\"`. Since the snippet is pulled directly from\n * `ampersand-state`, there is no need to test both scenarios.\n *\n * @override\n * @param {object | string} key - The key value, or object to be set.\n * @param {any} value - The key value or object to set the keyed pair to.\n * @param {any} options - The object to set the keyed pair to.\n * @returns {any} - The changed property.\n */\n set(key, value, options) {\n // Declare formatted output variables for properly setting the targetted\n // property for this method.\n let attrs;\n let optns;\n\n // Validate if the key is an instance of any object or not.\n if (isObject(key) || key === null) {\n attrs = key;\n optns = value;\n } else {\n attrs = {};\n attrs[key] = value;\n optns = options;\n }\n\n attrs = this.parse(attrs, optns);\n\n return Reflect.apply(AmpState.prototype.set, this, [attrs, optns]);\n },\n});\n\nexport default FeatureModel;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AACA;AAGA;AAA2C;AAAA;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,YAAY,GAAGC,uBAAQ,CAACC,MAAM,CAAC;EACnCC,WAAW,EAAE,KAAK;EAAE;;EAEpB;;EAEAC,KAAK,EAAE;IACL;AACJ;AACA;AACA;AACA;IACIC,GAAG,EAAE,QAAQ;IAEb;AACJ;AACA;AACA;AACA;IACIC,YAAY,EAAE,MAAM;IAEpB;AACJ;AACA;AACA;AACA;IACIC,OAAO,EAAE,SA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AC,eAEY7B,YAAY;AAAA"}
@@ -1,24 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
-
5
4
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
6
-
7
5
  _Object$defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
-
11
8
  exports.default = void 0;
12
-
13
9
  var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
14
-
15
10
  var _ampersandState = _interopRequireDefault(require("ampersand-state"));
16
-
17
11
  var _constants = require("../constants");
18
-
19
12
  var _featureCollection = _interopRequireDefault(require("./feature-collection"));
20
-
21
13
  // External dependencies.
14
+
22
15
  // Local Dependencies
23
16
 
24
17
  /**
@@ -30,6 +23,7 @@ var _featureCollection = _interopRequireDefault(require("./feature-collection"))
30
23
  */
31
24
  var FeaturesModel = _ampersandState.default.extend({
32
25
  // Ampersand property members.
26
+
33
27
  collections: {
34
28
  /**
35
29
  * This collection contains the developer feature collection.
@@ -37,14 +31,12 @@ var FeaturesModel = _ampersandState.default.extend({
37
31
  * @type {FeatureCollection}
38
32
  */
39
33
  developer: _featureCollection.default,
40
-
41
34
  /**
42
35
  * This collection contains the entitlement feature collection.
43
36
  *
44
37
  * @type {FeatureCollection}
45
38
  */
46
39
  entitlement: _featureCollection.default,
47
-
48
40
  /**
49
41
  * This collection contains the user feature collection.
50
42
  *
@@ -53,7 +45,6 @@ var FeaturesModel = _ampersandState.default.extend({
53
45
  user: _featureCollection.default
54
46
  },
55
47
  // Helper method members.
56
-
57
48
  /**
58
49
  * Recursively clear attributes, children, and collections.
59
50
  *
@@ -62,29 +53,27 @@ var FeaturesModel = _ampersandState.default.extend({
62
53
  */
63
54
  clear: function clear(options) {
64
55
  var _this = this;
65
-
66
56
  // Clear the ampersand attributes safely if there are any. This class should
67
57
  // never have any attributes.
68
58
  (0, _keys.default)(this.attributes).forEach(function (key) {
69
59
  _this.unset(key, options);
70
- }); // Clear the ampersand children safely if there are any. This class should
71
- // never have any children.
60
+ });
72
61
 
62
+ // Clear the ampersand children safely if there are any. This class should
63
+ // never have any children.
73
64
  /* eslint-disable-next-line no-underscore-dangle */
74
-
75
65
  (0, _keys.default)(this._children).forEach(function (key) {
76
66
  _this[key].clear();
77
- }); // Clear the ampersand collections safely.
67
+ });
78
68
 
69
+ // Clear the ampersand collections safely.
79
70
  /* eslint-disable-next-line no-underscore-dangle */
80
-
81
71
  (0, _keys.default)(this._collections).forEach(function (key) {
82
72
  _this[key].reset();
83
73
  });
84
74
  return this;
85
75
  },
86
76
  // Ampersand method members.
87
-
88
77
  /**
89
78
  * Initializer method for FeatureModel class object.
90
79
  *
@@ -93,10 +82,10 @@ var FeaturesModel = _ampersandState.default.extend({
93
82
  */
94
83
  initialize: function initialize() {
95
84
  var _this2 = this;
96
-
97
85
  // Declare the collection event names.
98
- var eventNames = ['change:value', 'add', 'remove']; // Initialize collection event listeners.
86
+ var eventNames = ['change:value', 'add', 'remove'];
99
87
 
88
+ // Initialize collection event listeners.
100
89
  eventNames.forEach(function (eventName) {
101
90
  _constants.FEATURE_COLLECTION_NAMES.forEach(function (collectionName) {
102
91
  _this2[collectionName].on(eventName, function (model, options) {
@@ -106,7 +95,6 @@ var FeaturesModel = _ampersandState.default.extend({
106
95
  });
107
96
  }
108
97
  });
109
-
110
98
  var _default = FeaturesModel;
111
99
  exports.default = _default;
112
100
  //# sourceMappingURL=features-model.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["FeaturesModel","AmpState","extend","collections","developer","FeatureCollection","entitlement","user","clear","options","attributes","forEach","key","unset","_children","_collections","reset","initialize","eventNames","eventName","FEATURE_COLLECTION_NAMES","collectionName","on","model","trigger"],"sources":["features-model.js"],"sourcesContent":["// External dependencies.\nimport AmpState from 'ampersand-state';\n\n// Local Dependencies\nimport {FEATURE_COLLECTION_NAMES} from '../constants';\n\nimport FeatureCollection from './feature-collection';\n\n/**\n * Feature collection parent container.\n *\n * @description\n * This class contains all of the feature collection class objects to help\n * organize the data retrieved from the **wdm** service on device registration.\n */\nconst FeaturesModel = AmpState.extend({\n\n // Ampersand property members.\n\n collections: {\n /**\n * This collection contains the developer feature collection.\n *\n * @type {FeatureCollection}\n */\n developer: FeatureCollection,\n\n /**\n * This collection contains the entitlement feature collection.\n *\n * @type {FeatureCollection}\n */\n entitlement: FeatureCollection,\n\n /**\n * This collection contains the user feature collection.\n *\n * @type {FeatureCollection}\n */\n user: FeatureCollection\n },\n\n // Helper method members.\n\n /**\n * Recursively clear attributes, children, and collections.\n *\n * @param {Object} options - Attribute options to unset.\n * @returns {this}\n */\n clear(options) {\n // Clear the ampersand attributes safely if there are any. This class should\n // never have any attributes.\n Object.keys(this.attributes).forEach((key) => {\n this.unset(key, options);\n });\n\n // Clear the ampersand children safely if there are any. This class should\n // never have any children.\n /* eslint-disable-next-line no-underscore-dangle */\n Object.keys(this._children).forEach((key) => {\n this[key].clear();\n });\n\n // Clear the ampersand collections safely.\n /* eslint-disable-next-line no-underscore-dangle */\n Object.keys(this._collections).forEach((key) => {\n this[key].reset();\n });\n\n return this;\n },\n\n // Ampersand method members.\n\n /**\n * Initializer method for FeatureModel class object.\n *\n * @override\n * @returns {void}\n */\n initialize() {\n // Declare the collection event names.\n const eventNames = ['change:value', 'add', 'remove'];\n\n // Initialize collection event listeners.\n eventNames.forEach((eventName) => {\n FEATURE_COLLECTION_NAMES.forEach((collectionName) => {\n this[collectionName].on(eventName, (model, options) => {\n this.trigger(\n `change:${collectionName}`,\n this,\n this[collectionName],\n options\n );\n });\n });\n });\n }\n});\n\nexport default FeaturesModel;\n"],"mappings":";;;;;;;;;;;;;;AACA;;AAGA;;AAEA;;AANA;AAGA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,aAAa,GAAGC,uBAAA,CAASC,MAAT,CAAgB;EAEpC;EAEAC,WAAW,EAAE;IACX;AACJ;AACA;AACA;AACA;IACIC,SAAS,EAAEC,0BAN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aturesModel","AmpState","extend","collections","developer","FeatureCollection","entitlement","user","clear","options","attributes","forEach","key","unset","_children","_collections","reset","initialize","eventNames","eventName","FEATURE_COLLECTION_NAMES","collectionName","on","model","trigger"],"sources":["features-model.js"],"sourcesContent":["// External dependencies.\nimport AmpState from 'ampersand-state';\n\n// Local Dependencies\nimport {FEATURE_COLLECTION_NAMES} from '../constants';\n\nimport FeatureCollection from './feature-collection';\n\n/**\n * Feature collection parent container.\n *\n * @description\n * This class contains all of the feature collection class objects to help\n * organize the data retrieved from the **wdm** service on device registration.\n */\nconst FeaturesModel = AmpState.extend({\n // Ampersand property members.\n\n collections: {\n /**\n * This collection contains the developer feature collection.\n *\n * @type {FeatureCollection}\n */\n developer: FeatureCollection,\n\n /**\n * This collection contains the entitlement feature collection.\n *\n * @type {FeatureCollection}\n */\n entitlement: FeatureCollection,\n\n /**\n * This collection contains the user feature collection.\n *\n * @type {FeatureCollection}\n */\n user: FeatureCollection,\n },\n\n // Helper method members.\n\n /**\n * Recursively clear attributes, children, and collections.\n *\n * @param {Object} options - Attribute options to unset.\n * @returns {this}\n */\n clear(options) {\n // Clear the ampersand attributes safely if there are any. This class should\n // never have any attributes.\n Object.keys(this.attributes).forEach((key) => {\n this.unset(key, options);\n });\n\n // Clear the ampersand children safely if there are any. This class should\n // never have any children.\n /* eslint-disable-next-line no-underscore-dangle */\n Object.keys(this._children).forEach((key) => {\n this[key].clear();\n });\n\n // Clear the ampersand collections safely.\n /* eslint-disable-next-line no-underscore-dangle */\n Object.keys(this._collections).forEach((key) => {\n this[key].reset();\n });\n\n return this;\n },\n\n // Ampersand method members.\n\n /**\n * Initializer method for FeatureModel class object.\n *\n * @override\n * @returns {void}\n */\n initialize() {\n // Declare the collection event names.\n const eventNames = ['change:value', 'add', 'remove'];\n\n // Initialize collection event listeners.\n eventNames.forEach((eventName) => {\n FEATURE_COLLECTION_NAMES.forEach((collectionName) => {\n this[collectionName].on(eventName, (model, options) => {\n this.trigger(`change:${collectionName}`, this, this[collectionName], options);\n });\n });\n });\n },\n});\n\nexport default FeaturesModel;\n"],"mappings":";;;;;;;;;AACA;AAGA;AAEA;AANA;;AAGA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMA,aAAa,GAAGC,uBAAQ,CAACC,MAAM,CAAC;EACpC;;EAEAC,WAAW,EAAE;IACX;AACJ;AACA;AACA;AACA;IACIC,SAAS,EAAEC,0BAAiB;IAE5B;AACJ;AACA;AACA;AACA;IACIC,WAAW,EAAED,0BAAiB;IAE9B;AACJ;AACA;AACA;AACA;IACIE,IAAI,EAAEF;EACR,CAAC;EAED;EAEA;AACF;AACA;AACA;AACA;AACA;EACEG,KAAK,iBAACC,OAAO,EAAE;IAAA;IACb;IACA;IACA,mBAAY,IAAI,CAACC,UAAU,CAAC,CAACC,OAAO,CAAC,UAACC,GAAG,EAAK;MAC5C,KAAI,CAACC,KAAK,CAACD,GAAG,EAAEH,OAAO,CAAC;IAC1B,CAAC,CAAC;;IAEF;IACA;IACA;IACA,mBAAY,IAAI,CAACK,SAAS,CAAC,CAACH,OAAO,CAAC,UAACC,GAAG,EAAK;MAC3C,KAAI,CAACA,GAAG,CAAC,CAACJ,KAAK,EAAE;IACnB,CAAC,CAAC;;IAEF;IACA;IACA,mBAAY,IAAI,CAACO,YAAY,CAAC,CAACJ,OAAO,CAAC,UAACC,GAAG,EAAK;MAC9C,KAAI,CAACA,GAAG,CAAC,CAACI,KAAK,EAAE;IACnB,CAAC,CAAC;IAEF,OAAO,IAAI;EACb,CAAC;EAED;EAEA;AACF;AACA;AACA;AACA;AACA;EACEC,UAAU,wBAAG;IAAA;IACX;IACA,IAAMC,UAAU,GAAG,CAAC,cAAc,EAAE,KAAK,EAAE,QAAQ,CAAC;;IAEpD;IACAA,UAAU,CAACP,OAAO,CAAC,UAACQ,SAAS,EAAK;MAChCC,mCAAwB,CAACT,OAAO,CAAC,UAACU,cAAc,EAAK;QACnD,MAAI,CAACA,cAAc,CAAC,CAACC,EAAE,CA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