Merge branch 'trunk' into PCP-688-add-functionality-to-choose-subscription-failure-behavior

This commit is contained in:
dinamiko 2022-09-15 11:47:17 +02:00
commit 3382654c0a
42 changed files with 5324 additions and 2491 deletions

View file

@ -0,0 +1,11 @@
{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "usage",
"corejs": "3.25.0"
}
]
]
}

3
modules/ppcp-onboarding/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
node_modules
/assets/js
/assets/css

View file

@ -0,0 +1,32 @@
{
"name": "ppcp-onboarding",
"version": "1.0.0",
"license": "GPL-3.0-or-later",
"main": "resources/js/order-edit-page.js",
"browserslist": [
"> 0.5%",
"Safari >= 8",
"Chrome >= 41",
"Firefox >= 43",
"Edge >= 14"
],
"dependencies": {
"core-js": "^3.25.0"
},
"devDependencies": {
"@babel/core": "^7.19",
"@babel/preset-env": "^7.19",
"babel-loader": "^8.2",
"cross-env": "^7.0.3",
"file-loader": "^6.2.0",
"sass": "^1.42.1",
"sass-loader": "^12.1.0",
"webpack": "^5.74",
"webpack-cli": "^4.10"
},
"scripts": {
"build": "cross-env BABEL_ENV=default NODE_ENV=production webpack",
"watch": "cross-env BABEL_ENV=default NODE_ENV=production webpack --watch",
"dev": "cross-env BABEL_ENV=default webpack --watch"
}
}

View file

@ -54,7 +54,7 @@ const ppcp_onboarding = {
const paypalScriptTag = document.createElement('script');
paypalScriptTag.id = ppcp_onboarding.PAYPAL_JS_ID;
paypalScriptTag.src = PayPalCommerceGatewayOnboarding.paypal_js_url;
document.body.append(paypalScriptTag);
document.body.appendChild(paypalScriptTag);
if (ppcp_onboarding._timeout) {
clearTimeout(ppcp_onboarding._timeout);
@ -80,6 +80,7 @@ const ppcp_onboarding = {
fetch(PayPalCommerceGatewayOnboarding.pui_endpoint, {
method: 'POST',
credentials: 'same-origin',
body: JSON.stringify({
nonce: PayPalCommerceGatewayOnboarding.pui_nonce,
checked: onboard_pui.checked

View file

@ -215,12 +215,12 @@ document.addEventListener(
if(Array.isArray(option)){
option.forEach(
(option) => {
target.append(option);
target.appendChild(option);
}
)
}
target.append(option);
target.appendChild(option);
}
);
};

View file

@ -12,7 +12,6 @@ namespace WooCommerce\PayPalCommerce\Onboarding\Assets;
use WooCommerce\PayPalCommerce\Onboarding\Endpoint\LoginSellerEndpoint;
use WooCommerce\PayPalCommerce\Onboarding\Environment;
use WooCommerce\PayPalCommerce\Onboarding\State;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
/**
@ -173,6 +172,6 @@ class OnboardingAssets {
* @return bool
*/
private function should_render_onboarding_script(): bool {
return PayPalGateway::ID === $this->page_id || Settings::CONNECTION_TAB_ID === $this->page_id;
return Settings::CONNECTION_TAB_ID === $this->page_id;
}
}

View file

@ -0,0 +1,37 @@
const path = require('path');
const isProduction = process.env.NODE_ENV === 'production';
module.exports = {
devtool: isProduction ? 'source-map' : 'eval-source-map',
mode: isProduction ? 'production' : 'development',
target: 'web',
entry: {
'settings': path.resolve('./resources/js/settings.js'),
'onboarding': path.resolve('./resources/js/onboarding.js'),
'onboarding-style': path.resolve('./resources/css/onboarding.scss'),
},
output: {
path: path.resolve(__dirname, 'assets/'),
filename: 'js/[name].js',
},
module: {
rules: [{
test: /\.js?$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
{
test: /\.scss$/,
exclude: /node_modules/,
use: [
{
loader: 'file-loader',
options: {
name: 'css/[name].css',
}
},
{loader:'sass-loader'}
]
}]
}
};

File diff suppressed because it is too large Load diff