Skip to content

Commit

Permalink
Release 2.14.0 (#752)
Browse files Browse the repository at this point in the history
* Added Live Step Viewed variable and controller

* Added sourcemap generation on development

* Updated Sentry dependency and refactored plugin installation

* Added action to interact with live step viewed in storage

* Added exception capture on get link onboarding and on account 'false'

* Refactored plugin installation order

* Modified environment variable names

* Modified package version to 2.14.0
  • Loading branch information
Rzial authored Apr 22, 2021
1 parent e6aa5ca commit ce78f57
Show file tree
Hide file tree
Showing 21 changed files with 21,728 additions and 116 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ config_*.xml
### Vuejs ignore build files ###
/views/js/back/
/views/js/app.js
/views/js/app.js.map
/views/js/front.js
/views/js/front.js.LICENSE.txt
/views/img/almost-ready.png
Expand Down
21,593 changes: 21,514 additions & 79 deletions _dev/js/back/package-lock.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions _dev/js/back/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@
},
"dependencies": {
"@femessage/log-viewer": "^1.4.1",
"@prestashopcorp/segment-vue": "^1.2.10",
"@sentry/browser": "^5.18.0",
"@sentry/integrations": "^5.18.0",
"@prestashopcorp/segment-vue": "^1.2.11",
"@sentry/browser": "^6.2.1",
"@sentry/tracing": "^6.2.1",
"@sentry/vue": "^6.2.1",
"axios": "^0.21.1",
"bootstrap-vue": "^2.16.0",
"core-js": "^3.6.5",
Expand Down
4 changes: 4 additions & 0 deletions _dev/js/back/src/components/block/onboarding.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
</template>

<script>
import * as Sentry from '@sentry/vue';
export default {
name: 'Onboarding',
data() {
Expand Down Expand Up @@ -90,6 +92,8 @@
this.$refs.paypalButton.click();
})
.catch(response => {
Sentry.captureException(response);
// eslint-disable-next-line no-console
console.log(response);
});
Expand Down
19 changes: 18 additions & 1 deletion _dev/js/back/src/components/panel/paypal-account.vue
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,11 @@
</template>

<script>
import * as Sentry from '@sentry/vue';
import AccountStatusPayPal from '@/components/block/account-status-paypal.vue';
import Onboarding from '@/components/block/onboarding';
import { PaypalAccountFalseOnboardingException } from '@/exception/paypal-onboarding.exception';
export default {
components: {
Expand All @@ -169,7 +172,21 @@
return this.$store.state.paypal.paypalOnboardingLink === false;
},
paypalEmail() {
return this.$store.state.paypal.emailMerchant;
const emailMerchant = this.$store.state.paypal.emailMerchant;
if (
!this.$store.state.context.liveStepViewed &&
this.paypalAccountStatus
) {
if (!emailMerchant) {
Sentry.captureException(
new PaypalAccountFalseOnboardingException()
);
}
this.$store.dispatch('updatePaypalStatusViewed');
}
return emailMerchant;
},
checkoutAccountStatus() {
return this.$store.state.firebase.onboardingCompleted;
Expand Down
30 changes: 30 additions & 0 deletions _dev/js/back/src/core/plugins/segment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @author PrestaShop SA <[email protected]>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
import Segment from '@prestashopcorp/segment-vue';

export default {
install(Vue, { router }) {
Vue.use(Segment, {
id: process.env.VUE_APP_PS_CHECKOUT_SEGMENT_API_KEY,
router,
debug: process.env.NODE_ENV !== 'production',
pageCategory: 'ps_checkout'
});
}
};
45 changes: 45 additions & 0 deletions _dev/js/back/src/core/plugins/sentry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @author PrestaShop SA <[email protected]>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
import * as Sentry from '@sentry/vue';
import { Integrations } from '@sentry/tracing';

export default {
install(Vue, { store }) {
const correlationId = Math.random()
.toString(36)
.substr(2, 9);

Sentry.init({
Vue,
dsn: `https://${process.env.VUE_APP_PS_CHECKOUT_SENTRY_KEY}@${process.env.VUE_APP_PS_CHECKOUT_SENTRY_ORGANIZATION}.ingest.sentry.io/${process.env.VUE_APP_PS_CHECKOUT_SENTRY_PROJECT}`,
integrations: [new Integrations.BrowserTracing()],

// We recommend adjusting this value in production, or using tracesSampler
// for finer control
tracesSampleRate: 1.0,

logErrors: process.env.NODE_ENV !== 'production'
});

Sentry.configureScope(scope => {
scope.setExtras(store.state);
scope.setTag('transaction_id', correlationId);
});
}
};
24 changes: 24 additions & 0 deletions _dev/js/back/src/exception/paypal-onboarding.exception.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/AFL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @author PrestaShop SA <[email protected]>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
export class PaypalAccountFalseOnboardingException extends Error {
constructor() {
super("PayPal account 'false'");
this.name = 'PaypalAccountFalseOnboardingException';
}
}
32 changes: 7 additions & 25 deletions _dev/js/back/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,42 +17,24 @@
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
import Vue from 'vue';

import Sentry from './core/plugins/sentry';
import Segment from './core/plugins/segment';

Vue.use(Sentry, { store });
Vue.use(Segment, { router });

import BootstrapVue from 'bootstrap-vue';
import VueCollapse from 'vue2-collapse';
import * as Sentry from '@sentry/browser';
import { Vue as VueIntegration } from '@sentry/integrations';

import i18n from './lib/i18n';
import App from './App.vue';
import router from './router';
import store from './store';
import VueSegment from '@prestashopcorp/segment-vue';

Vue.use(BootstrapVue);
Vue.use(VueCollapse);

Vue.use(VueSegment, {
id: 'BftCN3EnnGD1ETnf4FUBxP1WFMQ80JFZ',
router,
debug: process.env.NODE_ENV !== 'production',
pageCategory: 'ps_checkout'
});

Sentry.init({
dsn: `https://${process.env.VUE_APP_SENTRY_KEY}@${process.env.VUE_APP_SENTRY_ORGANIZATION}.ingest.sentry.io/${process.env.VUE_APP_SENTRY_PROJECT}`,
integrations: [new VueIntegration({ Vue, attachProps: true })]
});
Sentry.configureScope(scope => {
scope.setExtra(store.state);
});

const correlationId = Math.random()
.toString(36)
.substr(2, 9);
Sentry.configureScope(scope => {
scope.setTag('transaction_id', correlationId);
});

Vue.config.productionTip = process.env.NODE_ENV === 'production';

window.onload = () => {
Expand Down
13 changes: 13 additions & 0 deletions _dev/js/back/src/store/modules/paypal/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ export default {
throw resp;
});
},
updatePaypalStatusViewed({ commit, getters }) {
return ajax({
url: getters.adminController,
action: 'LiveStepViewed'
}).then(resp => {
if (resp) {
commit(types.UPDATE_VIEWED_LIVE_STEP, true);
return true;
}

throw resp;
});
},
updatePaypalValueBanner({ commit, getters }) {
return ajax({
url: getters.adminController,
Expand Down
1 change: 1 addition & 0 deletions _dev/js/back/src/store/modules/paypal/mutation-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ export const UNLINK_ACCOUNT = 'UNLINK_ACCOUNT';
export const UPDATE_ONBOARDING_LINK = 'UPDATE_ONBOARDING_LINK';
export const UPDATE_PAYPAL_ACCOUNT_STATUS = 'UPDATE_PAYPAL_ACCOUNT_STATUS';
export const UPDATE_CONFIRMED_LIVE_STEP = 'UPDATE_CONFIRMED_LIVE_STEP';
export const UPDATE_VIEWED_LIVE_STEP = 'UPDATE_VIEWED_LIVE_STEP';
export const UPDATE_VALUE_BANNER_CLOSED = 'UPDATE_VALUE_BANNER_CLOSED';
3 changes: 3 additions & 0 deletions _dev/js/back/src/store/modules/paypal/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ export default {
[types.UPDATE_CONFIRMED_LIVE_STEP](state, confirmed) {
state.isLiveStepConfirmed = confirmed;
},
[types.UPDATE_VIEWED_LIVE_STEP](state, viewed) {
state.isLiveStepViewed = viewed;
},
[types.UPDATE_VALUE_BANNER_CLOSED](state, closed) {
state.isValueBannerClosed = closed;
}
Expand Down
7 changes: 7 additions & 0 deletions _dev/js/back/vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
*/
const path = require('path');

module.exports = {
chainWebpack: config => {
config.optimization.delete('splitChunks');
Expand All @@ -25,6 +26,12 @@ module.exports = {
config.plugins.delete('prefetch');
config.resolve.alias.set('@', path.resolve(__dirname, 'src'));
},
configureWebpack:
process.env.NODE_ENV === 'production'
? {}
: {
devtool: 'source-map'
},
css: {
extract: false
},
Expand Down
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>ps_checkout</name>
<displayName><![CDATA[PrestaShop Checkout]]></displayName>
<version><![CDATA[2.13.0]]></version>
<version><![CDATA[2.14.0]]></version>
<description><![CDATA[Provide the most commonly used payment methods to your customers in this all-in-one module, and manage all your sales in a centralized interface.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[payments_gateways]]></tab>
Expand Down
13 changes: 13 additions & 0 deletions controllers/admin/AdminAjaxPrestashopCheckoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,18 @@ public function ajaxProcessLiveStepConfirmed()
$this->ajaxDie(json_encode(true));
}

/**
* AJAX: Confirm PS Live Step fist time
*/
public function ajaxProcessLiveStepViewed()
{
/** @var \PrestaShop\Module\PrestashopCheckout\OnBoarding\Step\LiveStep $stepLive */
$stepLive = $this->module->getService('ps_checkout.step.live');
$stepLive->viewed(true);

$this->ajaxDie(json_encode(true));
}

/**
* AJAX: Confirm PS Value Banner closed
*/
Expand Down Expand Up @@ -136,6 +148,7 @@ public function ajaxProcessLogOutPaypalAccount()
/** @var \PrestaShop\Module\PrestashopCheckout\OnBoarding\Step\LiveStep $stepLive */
$stepLive = $this->module->getService('ps_checkout.step.live');
$stepLive->confirmed(false);
$stepLive->viewed(false);

// we reset the Value banner
/** @var \PrestaShop\Module\PrestashopCheckout\OnBoarding\Step\ValueBanner $valueBanner */
Expand Down
9 changes: 8 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions ps_checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class Ps_checkout extends PaymentModule
'PS_CHECKOUT_LOGGER_LEVEL' => '400',
'PS_CHECKOUT_LOGGER_HTTP' => '0',
'PS_CHECKOUT_LOGGER_HTTP_FORMAT' => 'DEBUG',
'PS_CHECKOUT_LIVE_STEP_VIEWED' => false,
'PS_CHECKOUT_INTEGRATION_DATE' => self::INTEGRATION_DATE,
'PS_CHECKOUT_SHOP_UUID_V4' => '',
];
Expand All @@ -126,7 +127,7 @@ class Ps_checkout extends PaymentModule

// Needed in order to retrieve the module version easier (in api call headers) than instanciate
// the module each time to get the version
const VERSION = '2.13.0';
const VERSION = '2.14.0';

const INTEGRATION_DATE = '2020-07-30';

Expand All @@ -147,7 +148,7 @@ public function __construct()

// We cannot use the const VERSION because the const is not computed by addons marketplace
// when the zip is uploaded
$this->version = '2.13.0';
$this->version = '2.14.0';
$this->author = 'PrestaShop';
$this->need_instance = 0;
$this->currencies = true;
Expand Down
2 changes: 1 addition & 1 deletion src/Environment/SegmentEnv.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct()
{
parent::__construct();

$this->setSegmentApiKey($this->getEnv('SEGMENT_API_KEY'));
$this->setSegmentApiKey($this->getEnv('PS_CHECKOUT_SEGMENT_API_KEY'));
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Environment/SentryEnv.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public function __construct()
{
parent::__construct();

$this->setKey($this->getEnv('VUE_APP_SENTRY_KEY'));
$this->setOrganisation($this->getEnv('VUE_APP_SENTRY_ORGANIZATION'));
$this->setProject($this->getEnv('VUE_APP_SENTRY_PROJECT'));
$this->setKey($this->getEnv('PS_CHECKOUT_SENTRY_KEY'));
$this->setOrganisation($this->getEnv('PS_CHECKOUT_SENTRY_ORGANIZATION'));
$this->setProject($this->getEnv('PS_CHECKOUT_SENTRY_PROJECT'));
}

/**
Expand Down
Loading

0 comments on commit ce78f57

Please sign in to comment.