Repository URL to install this package:
|
Version:
2.1.0 ▾
|
Preview - Proposed paywall library
This library is published to the registry using https://github.com/DoodleScheduling/lib-tagflow.
Publish release candidate:
git tag pub.1.0.0-rc.0 git push origin pub.1.0.0-rc.0
Publish release
git tag pub.1.0.0 git push origin pub.1.0.0
Library provides wrapper component of Paywall, Paywall statuses and process types, functions (actions that should be covered by paywall) used to send requests to the backend. It includes different modals according to user premium segments.
Library use vanilla Fetch API interface for API calls.
Every API call returns Promise. Could be resolved with one of these statuses:
REDIRECT - user clicks on business plan
REJECT - user closes paywall modal
PASS - success flow of paywall
ERROR - error occured
Install the dependencies
yarn
Development mode for testing different paywall modal views
yarn start
Build
yarn build
Create a link for lib-paywall
cd build
yarn link
Use the link in your project
yarn link "@doodle/lib-paywall"
Copy all files from dist folder to the lib-paywall folder in your node_modules/@doodle/.
Import Paywall wrapper to your container.
import { PaywallWrapper } from '@doodle/lib-paywall';
Pass to wrapper 5 properties:
host stringonReject functiononSubscribe functiononModalOpen functionmessages objectUse exported actions in your handlers.
import { duplicateCalendar, createCalendar, unarchiveCalendar } from '@doodle/lib-paywall';
...
createCalendar({ token, captchaToken, trackingEventPrefix }).then(payloadResult => ());
// payloadResult: { payload: {externalId: ""}, status: "PASS" }
...
duplicateCalendar({ token, id, captchaToken, trackingEventPrefix }).then(payloadResult => ()); ;
// payloadResult: { status: "REJECT" }
...
unarchiveCalendar({ token, id, trackingEventPrefix }).then(payloadResult => ()); ;
// payloadResult: { status: "ERROR", code: 'GET_USER_DATA_FAILED' }
token user tokencaptchaToken generated captcha tokenid id of the calendartrackingEventPrefix prefix user for tracking