wpdesk / wp-nps
显示插件中NPS的库。
1.3.0
2022-07-13 14:11 UTC
Requires
- php: >=7.0
- wpdesk/wp-builder: ^1.4|^2
- wpdesk/wpdesk-packer: ^2
Requires (Dev)
- 10up/wp_mock: *
- mockery/mockery: *
- phpunit/phpunit: <7
- squizlabs/php_codesniffer: ^3.0.2
- wimg/php-compatibility: ^8
- wp-coding-standards/wpcs: ^0.14.1
This package is auto-updated.
Last update: 2024-09-13 18:43:56 UTC
README
NPS
一个WordPress库,包含接口、抽象和基本实现,用于显示针对插件的Net Promoter Score调查表单。
要求
PHP 7.0或更高版本。
通过Composer安装
为了通过 Composer 安装绑定,请运行以下命令
composer reqiure wpdesk/wp-nps
示例用法
在 Flexible Shipping 运输方式设置屏幕上显示NPS
$user_meta_name = 'fs_nps';
$nps = new \WPDesk\Nps\Nps(
'fs_nps',
'satismeter_write_key_here',
'satismeter_campaign_id_here',
'satismeter_feedback_id',
new \WPDesk\Nps\UuidUserId(),
$this->get_plugin_assets_url() . '../vendor_prefixed/wpdesk/wp-nps/assets/',
$this->scripts_version,
new \WPDesk\Nps\DisplayDecisions\DisplayNpsLocationsAndUserDecisions(
[
new \WPDesk\Nps\DisplayDecisions\ShippingMethodDisplayNpsDecision( 'flexible_shipping_single' ),
new \WPDesk\Nps\DisplayDecisions\AdminPageDisplayNpsDecision( [
'page' => 'wc-settings',
'tab' => 'shipping',
'section' => 'flexible_shipping_info',
] ),
],
[
new \WPDesk\Nps\DisplayDecisions\ShippingMethodDisplayNpsDecision( new \WPDesk\Nps\DisplayDecisions\UserDisplayNpsDecision( $user_meta_name ) ),
]
),
$user_meta_name,
admin_url( 'admin-ajax.php' )
);
$nps->set_question( __( 'Hey, we are curious how would you grade your first impression on Flexible Shipping so far?', 'flexible-shipping' ) );
$nps->set_best_label( __( 'Wow, it\'s awesome!', 'flexible-shipping' ) );
$nps->set_worst_label( __( 'Really poor', 'flexible-shipping' ) );
$nps->set_disclaimer(
sprintf(
__( 'By using the \'Send feedback\' button I hereby agree and consent to the terms of %1$sPrivacy Policy%2$s.', 'flexible-shipping' ),
'<a target="_blank" href="https://octolize.com/terms-of-service/privacy-policy/">',
'</a>'
)
);
$nps->add_feedback_option( new FeedbackOption( __( 'More calculation conditions', 'flexible-shipping' ), __( 'What exactly should the conditions you need be based on?', 'flexible-shipping' ) ) )
->add_feedback_option( new FeedbackOption( __( 'More detailed documentation', 'flexible-shipping' ) ) )
->add_feedback_option( new FeedbackOption( __( 'Easier contact with support', 'flexible-shipping' ) ) )
->add_feedback_option( new FeedbackOption( __( 'More user-friendly interface', 'flexible-shipping' ) ) )
->add_feedback_option( new FeedbackOption( __( 'Less complicated settings', 'flexible-shipping' ) ) )
->add_feedback_option( new FeedbackOption( __( 'Too soon to say', 'flexible-shipping' ) ) )
->add_feedback_option( new FeedbackOption( __( 'Other', 'flexible-shipping' ), __( 'Please tell us what exactly can we do to improve our plugin?', 'flexible-shipping' ) ) );
$nps->hooks();
开发者
请记住,在提交之前执行:npm run prod
!