# sweetalert

![Screenshot](images/screenshot.png)

Provides support for the [sweetalert2 library](https://sweetalert2.github.io/), a "beautiful, responsive, customizable, accessible (WAI-ARIA) replacement for JavaScript's popup boxes".

The extension is licensed under [AGPL-3.0](LICENSE.txt). sweetalert2 is available under the MIT license.

## Requirements

* PHP v7.2+
* CiviCRM 5.latest

## Installation

Install as a regular extension.

## Packaging / Updating

1. If updating the sweetalert libraries, run `npm install`.
1. Then copy `node_modules/sweetalert2/dist/sweetalert2*.css ./css` and `node_modules/sweetalert2/dist/sweetalert2*.js ./js`

## Usage

This extension does not do anything out of the box. It is available for other extensions.

## Changelog

#### 1.8.0 (2025-10-27)

* [!8](https://lab.civicrm.org/extensions/sweetalert/-/merge_requests/8) Adds a CiviRules display-message action.
* [!11](https://lab.civicrm.org/extensions/sweetalert/-/merge_requests/11) Overload CRM.alert. This adds a setting to "Display Settings" and defaults to replacing CRM.alert with Sweetalert on the frontend for much prettier messages.

#### 1.7.1 (2025-10-23)

* Fix for SweetAlert library update

#### 1.7 (2025-10-14)

* Update SweetAlert from 10.16.7 to 11.26.2 -  [Changelog](https://github.com/sweetalert2/sweetalert2/blob/master/CHANGELOG.md)
* Add composer.json
* Upgrade civix

#### 1.6

* Upgrade Civix

#### 1.5
*SweetAlert introduces a number of breaking changes from release 11. Release 10 provides both legacy methods and new methods so allows existing integrations to transition.*
*
* Update SweetAlert from 9.17.1 to 10.16.7. [Changelog](https://github.com/sweetalert2/sweetalert2/blob/master/CHANGELOG.md).

#### 1.4.1

* Regenerate autogenerated code for PHP7.4 support.

#### 1.4

Load libraries via `civicrm_coreResourceList` hook instead of buildForm/pageRun. This allows it to work everywhere and (eg) makes it available with Stripe + drupal `webform_civicrm`.

#### 1.3

Update to SweetAlert2 version 9.17.1 - https://github.com/sweetalert2/sweetalert2/blob/master/CHANGELOG.md

#### 1.2

Load libraries in `page-header` region instead of `page-footer` so it is always available for libraries loaded in later regions.

#### 1.1

Switch to SweetAlert2 version 9.7.1 - see "Breaking Changes" at https://github.com/sweetalert2/sweetalert2/releases/tag/v9.0.0
