{"id":23131252,"url":"https://github.com/emartech/emarsys-integration-client-js","last_synced_at":"2025-08-17T08:31:17.616Z","repository":{"id":57222894,"uuid":"43820530","full_name":"emartech/emarsys-integration-client-js","owner":"emartech","description":"Emarsys integration (iframe) side JavaScript integration library","archived":false,"fork":false,"pushed_at":"2023-09-08T17:53:04.000Z","size":619,"stargazers_count":2,"open_issues_count":6,"forks_count":4,"subscribers_count":37,"default_branch":"master","last_synced_at":"2024-04-14T07:40:55.806Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emartech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-07T14:16:40.000Z","updated_at":"2022-01-12T14:52:46.000Z","dependencies_parsed_at":"2023-02-19T09:31:03.038Z","dependency_job_id":null,"html_url":"https://github.com/emartech/emarsys-integration-client-js","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emartech%2Femarsys-integration-client-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emartech%2Femarsys-integration-client-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emartech%2Femarsys-integration-client-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emartech%2Femarsys-integration-client-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emartech","download_url":"https://codeload.github.com/emartech/emarsys-integration-client-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230105996,"owners_count":18173954,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-17T11:12:23.479Z","updated_at":"2025-08-17T08:31:17.607Z","avatar_url":"https://github.com/emartech.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# emarsys-integration-client-js\n\n\u003e [!CAUTION]\n\u003e This project is under sunset. Please migrate you application for using [EDS Utils](https://designsystem.emarsys.net/utilities/functions)\n\nEmarsys Integration Client JS is a library providing methods of communication between Emarsys and integrated services running in an iframe.\n\n# Requirements\n\n- [Node.js](https://nodejs.org/en) \u003e= 16.14.2\n\n# Install\n\n```bash\nnpm install emarsys-integration-client --save\n```\n\n# Usage\n\n```javascript\nconst { integrationClient } = require('emarsys-integration-client');\n\nconst result = await itegrationClient.getUrl({ target: 'email_analysis/list' });\nconst href = result.data.url;\n\n```\n\n# Legacy usage\n\nEarlier versions of this package required you to create an instance with custom config.\nMost methods now work without this, but if you are using `messageToService` explicitly,\nyou might still need to instantiate like this:\n\n```javascript\nvar IntegrationClient = require('emarsys-integration-client');\nvar integrationClient = IntegrationClient.init({\n  global: window,\n  integrationId: 'my-integration',\n  integrationInstanceId: 1234567\n});\n```\n\nIn the code above, integrationId and integrationInstanceId should have the values passed in the iframe URL.\n\n# Library methods\n\n## alert.error(text: String)\n## alert.info(text: String)\n## alert.log(text: String)\n## alert.success(text: String)\n## alert.warn(text: String)\n\nCalling the methods above will render different types of Emarsys UI alerts with the `text` given.\n\n## alert.send(options: Object)\n\nIt's a lower level method for displaying custom alerts.\n\n__Options__\n\n|Field|Role|Mandatory|Default|\n|-----|----|---------|-------|\n|text: String|Alert message.|YES|\n|icon: String|Icon class of the icon to be rendered on the left side of the alert. Eg. 'check' for a check mark or 'exclamation-circle' for an exclamation mark in a circle.|NO|\n|className: String|Alert sub-class to use when rendering the alert. Eg. 'e-alert-success' for a green bar, 'e-alert-danger' for a red one.|NO|\n|timeout: Int|Amount of time after the alert will fade out and get removed from the DOM, in milliseconds.|NO|1500|\n\n## enableButton(selector: String)\n\nThis will enable a button selected.\n\n## dialog.close()\n\nClosing the dialog and removing it from DOM.\n\n## dialog.confirm(options: Object)\n\nRendering a confirm dialog.\n\n__Options__\n\n|Field|Role|Mandatory|Default|\n|-----|----|---------|-------|\n|title: String|Title of the confirm dialog.|YES||\n|body: String|Body text of the confirm dialog.|NO||\n|cancel: String|Text of Cancel button.|YES||\n|ok: String|Text of OK button.|YES||\n\n## dialog.modal(options: Object)\n\nRendering a modal dialog with it's content in an iframe.\n\n__Options__\n\n|Field|Role|Mandatory|Default|\n|-----|----|---------|-------|\n|src: String|URL for the iframe providing the modal content.|YES||\n|width: Int|Width of the modal.|NO|650|\n|height: Int|Height of the modal.|NO|500|\n\n## dialog.submit(success: Boolean, data: Object)\n\nSubmitting a dialog.\n\n__Options__\n\n|Field|Role|Mandatory|Default|\n|-----|----|---------|-------|\n|success: Boolean|True if the result of the dialog is truthy.|YES||\n|data: Object|Arbitrary object to send to the originating service.|NO|{}|\n\n## getUrl(options: Object)\n\nReturns the url of a preset page. [Available targets](https://github.com/emartech/emarsys-integration-js#navigate)\n\n__Options__\n\n|Field|Role|Mandatory|\n|-----|----|---------|\n|target: String|The prespecified target you would like a link to.|YES|\n|params.foo: Object|The general param the actual target needs.|MIXED|\n\n## navigate(options: Object)\n\nNavigating the browser to a preset page. [Available targets](https://github.com/emartech/emarsys-integration-js#navigate)\n\n__Options__\n\n|Field|Role|Mandatory|\n|-----|----|---------|\n|target: String|The prespecified target you would like to head to.|YES|\n|params.foo: Object|The general param the actual target needs.|MIXED|\n\n## refresh()\n\nReloading the whole page.\n\n## resize(height: Int)\n\nResizing the iframe.\n\n## track(options: Object)\n\nSending a track message.\n\n## unload:init(options: Object)\n\nSetting up click handler for `\u003ca\u003e` elements, popping a navigation confirm dialog when clicked. It makes sense to call this method right after your content gets dirty.\n\n__Options__\n\n|Field|Role|Mandatory|Default|\n|-----|----|---------|-------|\n|selector: String|Selector for ancestor elements of `\u003ca\u003e` elements.|YES||\n|confirm: Object|Options for confirm dialog. See `dialog.confirm()`.|NO|Options for a general unload confirm dialog.|\n\n## unload:reset(selector: String)\n\nStopping to watch click events of elements selected by `selector`.  It makes sense to call this method right after your content gets clean (ie. saved).\n\n# Contributing\n\nSee [Contribution guideline](https://github.com/emartech/emarsys-integration-client-js/blob/master/CONTRIBUTING.md).\n\n# Code of Conduct\n\nSee [Code of Conduct here](https://github.com/emartech/.github/blob/main/CODE_OF_CONDUCT.md).\n\n# Licensing\n\n[MIT](https://github.com/emartech/emarsys-integration-client-js/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femartech%2Femarsys-integration-client-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femartech%2Femarsys-integration-client-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femartech%2Femarsys-integration-client-js/lists"}