# Release Notes

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## [v1.1.1] - 2025-08-07
### Fixed
* Escape product IDs in CDN request URL.

## [v1.1.0] - 2025-07-24
### Added
* Support developer flags used for integration testing.

## [v1.0.4] - 2025-06-12
### Changed
* Update the SDK to include the organization folder in the CDN path if the organizationId is provided.

## [v1.0.3] - 2024-07-30
### Changed
* Fixed exponential backoff logic for retrying logging errors at runtime

## [v1.0.2] - 2024-07-09
### Added
* Mechanism for logging errors at runtime, which had been temporarily removed in [v1.0.1](https://github.com/salsify/experiences-sdk/blob/master/RELEASE_NOTES.md#v101---2024-06-26)

### Changed
* The `quantity`, `price`, and `currency` event options are now deprecated for the navigation event.

## [v1.0.1] - 2024-06-26
### Removed
- Mechanism for logging errors at runtime, added in [v1.0.0](https://github.com/salsify/experiences-sdk/blob/master/RELEASE_NOTES.md#v100---2024-06-12). Will be restored in a subsequent version.

## [v1.0.0] - 2024-06-12
### Added
* Support for retrieving and validating per-product enhanced content render configuration when `tracking: true` to support computing differential analytics; unique users are always shown the same content for a given product
* When per-product enhanced content render configuration is supplied and `tracking: true`, the content sources and weights from the configuration are applied to control what version of enhanced content is displayed (including optionally holding back published enhanced content)
* Default enhanced content source is set to `index.html`
* New system for logging errors at runtime to improve our ability to track and proactively address consumer issues
* Errors will now be handled if the `enhancedContent.exists` or render configuration retrieval requests fail, and when the render configuration is not able to be parsed or is invalid
* The analytics event context now includes a new `jsSource` field (set to either `'bundle'` or `'npm'`) that indicates the dependency management approach used to initialize the SDK
* Support for a new `currency` field in `EventCallbackOptions`, which should be a [3-character alphabetic ISO-4217 code](https://www.iso.org/iso-4217-currency-codes.html) and used in combination with `price` field
* The `ec_render_iframe`, `add_to_cart`, and `time_on_page` events now include enhanced content render metadata (`idType`, `productId`, `content`, `allContentExists`, `source`, `sourceExists`)

### Removed
* The `contentUrl` method for retrieving the CDN url in the `enhancedContent` module
* The `renderToString` method in the `enhancedContent` module for retrieving HTML content for server-side rendering; with this change, server-side applications are no longer supported by the SDK
* The `EventCallbackOptions#hasEnhancedContent` parameter for `navigation` and `addToCart` events

### Changed
* Replace `uuid` package for computing UUIDs with native `webcrypto.randomUUID`; with this change, sites that do not support HTTPS will no longer generate unique UUIDs for sessions or page sessions that are attached to analytics events
* The Axios client is replaced with native fetch, and with this change the SDK no longer supports Internet Explorer and Opera Mini
* The `renderIframe` method in the `enhancedContent` module is now asynchronous
* The supported browser targets for the SDK have been updated (browserslist: `defaults, not op_mini all`)
* Bundle size has been reduced from 202KB to 29KB
* Widen the type of the `container` argument to `enhancedContent.renderIframe()` to `HTMLElement`

### Fixed
* When the browser attempts to send an analytics event and fails, the events will now be queued and the client will attempt to resend the events with exponential backoff

## [v0.0.57] - 2024-05-17
## Fixed
* Synchronize URL with embedded EC when navigating in a single page application

## [v0.0.56] - 2024-04-29
### Changed
* Added additional flexibility to test endpoints while developing updates to analytics event logging (no impact to consumers - development update only)

## [v0.0.55] - 2024-04-19
### Deprecated
* The `EventCallbackOptions#hasEnhancedContent` parameter is now deprecated, and will be removed in a future release

## [v0.0.54] - 2024-04-16
### Added
* Analytics events now include window vertical scroll position

## [v0.0.53] - 2024-04-05
### Fixed
* On navigation events, the SDK will now send a final Time on Page event and restart the Time on Page tracker

### Removed
* Documentation from package README to migrate toward a single source of truth for integration enablement

### Deprecated
* The `enhancedContent` module methods `renderToString` and `contentUrl` are deprecated in favor of `renderIframe`

## [v0.0.52] - 2024-03-13
### Added
* Ability to point to test endpoint while developing updates to analytics event logging (no impact to consumers - development update only)

## [v0.0.51] - 2024-02-19
### Added
* SDK now throws an error when calling `renderIframe` outside of a web browser
* SDK now throws an error when calling `renderToString` from within a web browser

### Changed
* Standardized logic for identifying when the SDK is invoked from within a web browser and updated all code checks to use the new standard logic, including the check that determines what `page` information is sent with analytics events and the browser check when invoking the SDK bundle
* Update `url`, `sessionID`, and `pageSessionId` to allow `undefined` values when the SDK is invoked outside of a web browser
* Time on page is only tracked for SDK invoked from within a web browser
* The event context listener is only available from within a web browser, which means that outside of a web browser event context is not able to be passed to the rendered enhanced content when requested
* Page session IDs are only set from within a web browser
* Cookies are only set (when allowed by the `tracking` parameter) from within a web browser

## [v0.0.50] - 2024-01-04
### Fixed
* The logic for resetting page session ID values no longer resets only on render; now the page session ID does not reset for first render after SDK initialization or navigation, but does reset on navigation event and on new render requests
* As page session ID is updated, the up-to-date values are now passed to the event handler to properly log the correct value on analytics events

### Changed
* Moved the `Context` interface to the `api` module
* Included page session ID, client ID, and session ID in `Context`

## [v0.0.49] - 2023-11-02
### Fixed
* Update context event listener to properly handle `MessagePort`-based communication

### Added
* Analytics events now include a unique page session ID that is reset each time enhanced content is rendered, enabling events for the same render to be linked
* Created a separate interface for analytics event session `Context` in the `enhancedContent` module

## [v0.0.48] - 2023-09-25
### Added
* New analytics events to track Time on Page, starting as soon as SDK is initialized

## [v0.0.47] - 2023-09-20
### Changed
* Data type of `EventCallbackOptions#category` field now may optionally be an Array, which enables consumers to send multiple categories (ideally from least to most specific) with Navigation or Add to Cart events
* Made the `EventCallbackOptions#hasEnhancedContent` field optional, and expect it to be deprecated in a future release

## [v0.0.46] - 2023-09-20
### Added
* Created new endpoint for logging analytics events

## [v0.0.45] - 2023-09-11
### Fixed
* Updated the method for reading the SDK version to correct issue with transpiled artifacts published to NPM not aligning with `package.json`, causing consumer build failures

## [v0.0.44] - 2023-08-21
### Added
* Included SDK version to analytics event session context

## [v0.0.43] - 2023-08-03
### Fixed
* Re-enabled iframe resizing for enhanced content published before 2023-07-27 (which did not send the message type and was thus incompatible with the updates to the resize logic from the [v0.0.41](https://github.com/salsify/experiences-sdk/blob/hd-6787-changelog-cleanup/CHANGELOG.md#v0041---2023-07-18-yanked) release)

## [v0.0.42] - 2023-07-25
### Fixed
* Reverted update to webpack-dev-server (no impact to consumers - development update only)

## [v0.0.41] - 2023-07-18 [YANKED]
### Added
* Message event listener to serve requests for session context (URL, session ID, `tracking`, `clientId`, `languageCode`, and `idType`) to include in analytics events

### Changed
* Only resize the iframe for message events that are of type `heightUpdateRequest`

## [v0.0.40] - 2023-06-06
### Added
* Add new `enhancedContent.contentUrl` method that returns the CDN url for Enhanced Content

## [v0.0.39] - 2023-02-28
### Changed
* Renamed the `noTracking` initialization parameter to `tracking`, and updated the meaning such that when the `tracking` parameter is `false` the SDK marks all log entries as `NOT_TRACKED`

### Added
* Set the default value for the `tracking` intialization parameter to `true`
* Updated the logic when setting `tracking` to `false` so that any existing `salsify_session_id` cookies will be deleted in addition to marking all log entries as `NOT_TRACKED`

## [v0.0.38] - 2023-02-09
### Added
* New `noTracking` option when initializing the SDK that if set to `true` does not check the `salsify_session_id` cookie, if it exists, but instead just marks the session ID on all log entries as `NOT_TRACKED`

### Changed
* Added `languageCode` and `noTracking` parameters to `init` example in README

## [v0.0.37] - 2022-09-01
### Fixed
* Removed sandbox from iframe so external attachments can be viewed and downloaded

## [v0.0.36] - 2022-03-22
### Fixed
* Typo in the README documentation on the `enhancedContent.renderToString` method

## [v0.0.35] - 2022-03-16
### Fixed
* Added a `localStorage` type check before calling `localStorage?` to avoid errors in server-side environments

## [v0.0.34] - 2022-03-08
### Changed
* Improved typedoc documentation for key methods and classes

### Fixed
* Added a `window` type check before calling `window?` to avoid errors in server-side environments

## [v0.0.33] - 2022-03-08 [YANKED]
### Added
* MIT license [#400](https://github.com/salsify/experiences-sdk/pull/400) @jamescdavis

## [v0.0.32] - 2022-02-02
### Added
* New `enhancedContent.updateLanguageCode` method to reset the page language without re-rendering

## [v0.0.31] - 2021-07-22
### Changed
* Replaced iframe `name` with `title` "Salsify Enhanced Content"
* Edited examples in README to recommend using `await` operator for `exists` requests

## [v0.0.30] - 2021-06-15
### Changed
* Moved contributor-facing documentation out of README.md
* Added `name` "Enhanced Content" to the iframe returned by `enhancedContent.renderIframe`
* Improved typedoc documentation

## [v0.0.29] - 2021-03-03
### Fixed
* Separated the build mechanism for the output bundle so that the NPM package does not depend on`core-js/stable`, which was causing a "Module not found" error for some consumers

## [v0.0.28] - 2021-03-02
### Changed
* Renamed output bundle to `salsify.js` from `main.js`

[v1.0.3]: https://www.npmjs.com/package/salsify-experiences-sdk/v/1.0.3
[v1.0.2]: https://www.npmjs.com/package/salsify-experiences-sdk/v/1.0.2
[v1.0.1]: https://www.npmjs.com/package/salsify-experiences-sdk/v/1.0.1
[v1.0.0]: https://www.npmjs.com/package/salsify-experiences-sdk/v/1.0.0
[v0.0.57]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.57
[v0.0.56]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.56
[v0.0.55]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.55
[v0.0.54]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.54
[v0.0.53]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.53
[v0.0.52]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.52
[v0.0.51]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.51
[v0.0.50]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.50
[v0.0.49]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.49
[v0.0.48]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.48
[v0.0.47]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.47
[v0.0.46]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.46
[v0.0.45]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.45
[v0.0.44]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.44
[v0.0.43]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.43
[v0.0.42]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.42
[v0.0.41]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.41
[v0.0.40]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.40
[v0.0.39]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.39
[v0.0.38]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.38
[v0.0.37]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.37
[v0.0.36]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.36
[v0.0.35]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.35
[v0.0.34]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.34
[v0.0.32]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.32
[v0.0.31]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.31
[v0.0.30]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.30
[v0.0.29]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.29
[v0.0.28]: https://www.npmjs.com/package/salsify-experiences-sdk/v/0.0.28
