# subscribe-msg-svelte

> International subscription message component, Supports HTML pages, including Vue, React, Angular, etc. # Install npm install subscribe-msg-svelte --save # Usage ## step 1: ``` import SubscribeMsg from "subscribe-msg-svelte";

Latest version **1.1.2** (published 2022-04-01) · 0 weekly downloads

## Install

```sh
npm install subscribe-msg-svelte
pnpm add subscribe-msg-svelte
yarn add subscribe-msg-svelte
bun add subscribe-msg-svelte
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2022-04-01 |
| First published | 2021-12-17 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 88.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | lynne.xu0 |
| Keywords | svelte |

## Links

- npm: https://www.npmjs.com/package/subscribe-msg-svelte
- npm.io page: https://npm.io/package/subscribe-msg-svelte

## Dependencies (1)

- [hylid-bridge](https://npm.io/package/hylid-bridge.md) ^1.0.5

## Recent versions

- 1.1.2 (latest) — 2022-04-01
- 1.1.1 — 2022-03-22
- 1.1.0 — 2022-01-18
- 1.0.1 — 2021-12-18
- 1.0.0 — 2021-12-17

## README

International subscription message component, Supports HTML pages, including Vue, React, Angular, etc.
# Install
npm install subscribe-msg-svelte --save
# Usage
## step 1:
```
import SubscribeMsg from "subscribe-msg-svelte";

```

## step 2:

```
const subscribeMsg = new SubscribeMsg({
    target: document.body,
    props: {
        appId: '${appId}',
        authCode: '${authCode}',
        templateIds: ${templateIds},
        callback: this.handleCallback,
    }
});
```

## step 3:

```
subscribeMsg.requestSubscribeMessage();
```
# Component API

| attribute name | default value | type |  description |
| --- | --- | --- | --- |
| requestSubscribeMessage |  | Function | request subscribe message. |
| authCode |  | String | auth token |
| templateIds |  | Array | templateIds |
| animation | false | Boolean | Whether to enable animation effects. |
| callback | null | Function | callback method will get the return result. |

# Return value Description
## success
+ indicates whether the subscription action is successful.
+ the user clicks Cancel to return false.（Click mask to cancel subscription process, and return errorCode）
+ The user clicks Reject to return true.（Click Reject actually performs the subscription process, but the submission type is unsubscribe, so it returns true）.
+ Other exceptions also return false.

## type
+ 'AGREE': Agree to subscribe.
+ 'REJECT': reject to subscribe.

## errorCode
| Code | description |
| --- | --- |
| CANCELLED | User cancelled |
| NETWORK | network error |
| SYSTEM | system error |
| INCONSISTENT_TEMPLATE_TYPE | Templates type must be same. |
| INVALID_TEMPLATE_CODE | Invalid template code. |
| EXCEEDING_SUBSCRIPTION_LIMIT | Templates count out of max bounds. |
| INCOMING_EXCEEDED_THE_UPPER_LIMIT | The number of incoming templates exceeded the upper limit. |

# Changelog
Detailed changes for each release are documented in the release notes.

## v1.0.0
add subscribe message component.

## v1.1.0
Dynamically acquire subscription channels.

## v1.1.1
delete hylid-bridge for BurgerKing.

## v1.1.2
revert hylid-bridge.

---
_Source: https://npm.io/package/subscribe-msg-svelte · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
