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.