Skip to content

Commit

Permalink
Merge pull request #55 from PrestaShopCorp/feature/install-event-bus
Browse files Browse the repository at this point in the history
Account - Event bus not installed & update Ps Account module alert component
  • Loading branch information
hschoenenberger authored Feb 18, 2021
2 parents 3717698 + fdb0636 commit f098f09
Show file tree
Hide file tree
Showing 12 changed files with 3,122 additions and 2,390 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
],
"scripts": {
"build-lib": "vue-cli-service build --target lib --name psaccountsVue src/full.js",
"build-lib-watch": "vue-cli-service build --target lib --name psaccountsVue src/full.js --watch",
"lint": "vue-cli-service lint",
"storybook": "start-storybook",
"build-storybook": "build-storybook",
Expand All @@ -16,12 +17,12 @@
},
"dependencies": {
"@hapi/joi": "^17.1.1",
"@prestashopcorp/segment-vue": "^1.1.3",
"@prestashopcorp/segment-vue": "1.1.3",
"babel-loader": "^8.1.0",
"bootstrap-vue": "^2.11.0",
"core-js": "^3.6.4",
"deepmerge": "^4.2.2",
"prestakit": "^1.1.0",
"prestakit": "^1.2.1",
"react": "^16.13.1",
"react-is": "^16.13.1",
"v-click-outside": "^3.1.2",
Expand Down
214 changes: 207 additions & 7 deletions src/components/PsAccounts.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,15 @@ Once integrated, the component can show different cases:
onboardingLink: 'http://perdu.com',
superAdminEmail: '[email protected]',
ssoResendVerificationEmail: 'http://perdu.com',
manageAccountLink: 'http://perdu.com'
manageAccountLink: 'http://perdu.com',
dependencies: {
"ps_eventbus": {
"enableLink": "http://localhost:80/admin-dev/index.php/improve/modules/manage/action/enable/ps_eventbus?_token=up_TmQFm66p9dwunsmfNzk2UfDD3a8tsxdW5a7KviKw",
"installLink": "http://localhost:80/admin-dev/index.php/improve/modules/manage/action/install/ps_eventbus?_token=up_TmQFm66p9dwunsmfNzk2UfDD3a8tsxdW5a7KviKw",
"isEnabled": true,
"isInstalled": true,
},
},
})
},
},
Expand Down Expand Up @@ -126,7 +134,15 @@ If the shop is in a multi-store context, the user will have a selector like this
onboardingLink: 'http://perdu.com',
superAdminEmail: '[email protected]',
ssoResendVerificationEmail: 'http://perdu.com',
manageAccountLink: 'http://perdu.com'
manageAccountLink: 'http://perdu.com',
dependencies: {
"ps_eventbus": {
"enableLink": "http://localhost:80/admin-dev/index.php/improve/modules/manage/action/enable/ps_eventbus?_token=up_TmQFm66p9dwunsmfNzk2UfDD3a8tsxdW5a7KviKw",
"installLink": "http://localhost:80/admin-dev/index.php/improve/modules/manage/action/install/ps_eventbus?_token=up_TmQFm66p9dwunsmfNzk2UfDD3a8tsxdW5a7KviKw",
"isEnabled": true,
"isInstalled": true,
},
},
})
},
},
Expand Down Expand Up @@ -189,7 +205,15 @@ If the shop is in a multi-store context, the user will have a selector like this
onboardingLink: 'http://perdu.com',
superAdminEmail: '[email protected]',
ssoResendVerificationEmail: 'http://perdu.com',
manageAccountLink: 'http://perdu.com'
manageAccountLink: 'http://perdu.com',
dependencies: {
"ps_eventbus": {
"enableLink": "http://localhost:80/admin-dev/index.php/improve/modules/manage/action/enable/ps_eventbus?_token=up_TmQFm66p9dwunsmfNzk2UfDD3a8tsxdW5a7KviKw",
"installLink": "http://localhost:80/admin-dev/index.php/improve/modules/manage/action/install/ps_eventbus?_token=up_TmQFm66p9dwunsmfNzk2UfDD3a8tsxdW5a7KviKw",
"isEnabled": true,
"isInstalled": true,
},
},
})
},
},
Expand Down Expand Up @@ -255,7 +279,15 @@ his address from the link received in his mailbox.
onboardingLink: 'http://perdu.com',
superAdminEmail: '[email protected]',
ssoResendVerificationEmail: 'http://perdu.com',
manageAccountLink: 'http://perdu.com'
manageAccountLink: 'http://perdu.com',
dependencies: {
"ps_eventbus": {
"enableLink": "http://localhost:80/admin-dev/index.php/improve/modules/manage/action/enable/ps_eventbus?_token=up_TmQFm66p9dwunsmfNzk2UfDD3a8tsxdW5a7KviKw",
"installLink": "http://localhost:80/admin-dev/index.php/improve/modules/manage/action/install/ps_eventbus?_token=up_TmQFm66p9dwunsmfNzk2UfDD3a8tsxdW5a7KviKw",
"isEnabled": true,
"isInstalled": true,
},
},
})
},
},
Expand Down Expand Up @@ -289,6 +321,8 @@ You can have these different cases when the shop prerequisites are not fully val
psIs17: true,
psAccountsInstallLink: 'http://localhost:8082/admin-dev/index.php/improve/modules/manage/action/install/ps_accounts?_token=dCspOkG6tWwGoJIKdugKufBFtdNF--UPq8NVmyiUKLM',
psAccountsEnableLink: null,
psAccountsNeedsUpgrade: false,
psAccountsUpgradeLink: 'http://localhost:8082/admin-dev/index.php/improve/modules/manage/action/install/ps_accounts?_token=dCspOkG6tWwGoJIKdugKufBFtdNF--UPq8NVmyiUKLM',
currentShop: {
id: 1,
name: 'PrestaShop',
Expand Down Expand Up @@ -326,7 +360,15 @@ You can have these different cases when the shop prerequisites are not fully val
onboardingLink: 'http://perdu.com',
superAdminEmail: '[email protected]',
ssoResendVerificationEmail: 'http://perdu.com',
manageAccountLink: 'http://perdu.com'
manageAccountLink: 'http://perdu.com',
dependencies: {
"ps_eventbus": {
"enableLink": "http://localhost:80/admin-dev/index.php/improve/modules/manage/action/enable/ps_eventbus?_token=up_TmQFm66p9dwunsmfNzk2UfDD3a8tsxdW5a7KviKw",
"installLink": "http://localhost:80/admin-dev/index.php/improve/modules/manage/action/install/ps_eventbus?_token=up_TmQFm66p9dwunsmfNzk2UfDD3a8tsxdW5a7KviKw",
"isEnabled": true,
"isInstalled": true,
},
},
})
},
},
Expand All @@ -349,6 +391,8 @@ You can have these different cases when the shop prerequisites are not fully val
psIs17: true,
psAccountsInstallLink: null,
psAccountsEnableLink: 'http://localhost:8082/admin-dev/index.php/improve/modules/manage/action/enable/ps_accounts?_token=dCspOkG6tWwGoJIKdugKufBFtdNF--UPq8NVmyiUKLM',
psAccountsNeedsUpgrade: false,
psAccountsUpgradeLink: 'http://localhost:8082/admin-dev/index.php/improve/modules/manage/action/install/ps_accounts?_token=dCspOkG6tWwGoJIKdugKufBFtdNF--UPq8NVmyiUKLM',
currentShop: {
id: 1,
name: 'PrestaShop',
Expand Down Expand Up @@ -386,7 +430,15 @@ You can have these different cases when the shop prerequisites are not fully val
onboardingLink: 'http://perdu.com',
superAdminEmail: '[email protected]',
ssoResendVerificationEmail: 'http://perdu.com',
manageAccountLink: 'http://perdu.com'
manageAccountLink: 'http://perdu.com',
dependencies: {
"ps_eventbus": {
"enableLink": "http://localhost:80/admin-dev/index.php/improve/modules/manage/action/enable/ps_eventbus?_token=up_TmQFm66p9dwunsmfNzk2UfDD3a8tsxdW5a7KviKw",
"installLink": "http://localhost:80/admin-dev/index.php/improve/modules/manage/action/install/ps_eventbus?_token=up_TmQFm66p9dwunsmfNzk2UfDD3a8tsxdW5a7KviKw",
"isEnabled": true,
"isInstalled": true,
},
},
})
},
},
Expand All @@ -400,6 +452,132 @@ You can have these different cases when the shop prerequisites are not fully val
}}
</Story>

<Story name='Ps event bus not installed' height='300px'>
{{
components: { PsAccounts },
props: {
context: {
default: object('context', {
psIs17: true,
psAccountsInstallLink: null,
psAccountsEnableLink: null,
psAccountsNeedsUpgrade: false,
psAccountsUpgradeLink: 'http://localhost:8082/admin-dev/index.php/improve/modules/manage/action/install/ps_accounts?_token=dCspOkG6tWwGoJIKdugKufBFtdNF--UPq8NVmyiUKLM',
currentShop: {
id: 1,
name: 'PrestaShop',
url: 'http://localhost:8082/admin-dev/index.php?controller=AdminModules&setShopContext=s-1&token=7e6ed965a445faaa639275d16418264d',
domain: 'my-domain.com',
domainSsl: 'my-secure-domain.com',
},
shops: [
{
id: 1,
name: 'Default',
shops: [
{
id: 1,
name: 'PrestaShop',
url: 'http://localhost:8082/admin-dev/index.php?controller=AdminModules&setShopContext=s-1&token=7e6ed965a445faaa639275d16418264d',
domain: 'my-domain.com',
domainSsl: 'my-secure-domain.com',
}
],
},
],
user: {
email: null,
emailIsValidated: false,
isSuperAdmin: true,
},
onboardingLink: 'http://perdu.com',
superAdminEmail: '[email protected]',
ssoResendVerificationEmail: 'http://perdu.com',
manageAccountLink: 'http://perdu.com',
dependencies: {
"ps_eventbus": {
"enableLink": "http://localhost:80/admin-dev/index.php/improve/modules/manage/action/enable/ps_eventbus?_token=up_TmQFm66p9dwunsmfNzk2UfDD3a8tsxdW5a7KviKw",
"installLink": "http://localhost:80/admin-dev/index.php/improve/modules/manage/action/install/ps_eventbus?_token=up_TmQFm66p9dwunsmfNzk2UfDD3a8tsxdW5a7KviKw",
"isEnabled": false,
"isInstalled": false,
},
},
})
},
},
methods: {
actionEvent: action('actioned'),
viewEvent: action('viewed'),
},
template: '<PsAccounts :context="context" class="m-4" @actioned="actionEvent" @viewed="viewEvent">' +
'<template v-slot:body>- Module settings part, disabled -</template>' +
'</PsAccounts>',
}}
</Story>

<Story name='Ps Accounts needs an update' height='350px'>
{{
components: { PsAccounts },
props: {
context: {
default: object('context', {
psIs17: true,
psAccountsInstallLink: null,
psAccountsEnableLink: null,
psAccountsNeedsUpgrade: true,
psAccountsUpgradeLink: 'http://localhost:8082/admin-dev/index.php/improve/modules/manage/action/install/ps_accounts?_token=dCspOkG6tWwGoJIKdugKufBFtdNF--UPq8NVmyiUKLM',
currentShop: {
id: 1,
name: 'PrestaShop',
url: 'http://localhost:8082/admin-dev/index.php?controller=AdminModules&setShopContext=s-1&token=7e6ed965a445faaa639275d16418264d',
domain: 'my-domain.com',
domainSsl: 'my-secure-domain.com',
},
shops: [
{
id: 1,
name: 'Default',
shops: [
{
id: 1,
name: 'PrestaShop',
url: 'http://localhost:8082/admin-dev/index.php?controller=AdminModules&setShopContext=s-1&token=7e6ed965a445faaa639275d16418264d',
domain: 'my-domain.com',
domainSsl: 'my-secure-domain.com',
}
],
},
],
user: {
email: null,
emailIsValidated: false,
isSuperAdmin: true,
},
onboardingLink: 'http://perdu.com',
superAdminEmail: '[email protected]',
ssoResendVerificationEmail: 'http://perdu.com',
manageAccountLink: 'http://perdu.com',
dependencies: {
"ps_eventbus": {
"enableLink": "http://localhost:80/admin-dev/index.php/improve/modules/manage/action/enable/ps_eventbus?_token=up_TmQFm66p9dwunsmfNzk2UfDD3a8tsxdW5a7KviKw",
"installLink": "http://localhost:80/admin-dev/index.php/improve/modules/manage/action/install/ps_eventbus?_token=up_TmQFm66p9dwunsmfNzk2UfDD3a8tsxdW5a7KviKw",
"isEnabled": false,
"isInstalled": true,
},
},
})
},
},
methods: {
actionEvent: action('actioned'),
viewEvent: action('viewed'),
},
template: '<PsAccounts :context="context" class="m-4" @actioned="actionEvent" @viewed="viewEvent">' +
'<template v-slot:body>- Module settings part, disabled -</template>' +
'</PsAccounts>',
}}
</Story>

<Story name='No admin rights' height='350px'>
{{
components: { PsAccounts },
Expand All @@ -409,6 +587,8 @@ You can have these different cases when the shop prerequisites are not fully val
psIs17: true,
psAccountsInstallLink: null,
psAccountsEnableLink: null,
psAccountsNeedsUpgrade: false,
psAccountsUpgradeLink: 'http://localhost:8082/admin-dev/index.php/improve/modules/manage/action/install/ps_accounts?_token=dCspOkG6tWwGoJIKdugKufBFtdNF--UPq8NVmyiUKLM',
currentShop: {
id: 1,
name: 'PrestaShop',
Expand Down Expand Up @@ -446,7 +626,15 @@ You can have these different cases when the shop prerequisites are not fully val
onboardingLink: 'http://perdu.com',
superAdminEmail: '[email protected]',
ssoResendVerificationEmail: 'http://perdu.com',
manageAccountLink: 'http://perdu.com'
manageAccountLink: 'http://perdu.com',
dependencies: {
"ps_eventbus": {
"enableLink": "http://localhost:80/admin-dev/index.php/improve/modules/manage/action/enable/ps_eventbus?_token=up_TmQFm66p9dwunsmfNzk2UfDD3a8tsxdW5a7KviKw",
"installLink": "http://localhost:80/admin-dev/index.php/improve/modules/manage/action/install/ps_eventbus?_token=up_TmQFm66p9dwunsmfNzk2UfDD3a8tsxdW5a7KviKw",
"isEnabled": true,
"isInstalled": true,
},
},
})
},
},
Expand Down Expand Up @@ -476,6 +664,8 @@ component and the standard behavior won't let the user do anything:
psIs17: true,
psAccountsInstallLink: 'true', // will pass: can be casted to uri by Joi
psAccountsEnableLink: 'ptet-ben-k-non', // will pass: can be casted to uri by Joi
psAccountsNeedsUpgrade: false,
psAccountsUpgradeLink: 'http://localhost:8082/admin-dev/index.php/improve/modules/manage/action/install/ps_accounts?_token=dCspOkG6tWwGoJIKdugKufBFtdNF--UPq8NVmyiUKLM',
currentShop: 42,
shops: [
{
Expand Down Expand Up @@ -567,6 +757,8 @@ If you want to pass something to the component footer like another component you
psIs17: true,
psAccountsInstallLink: null,
psAccountsEnableLink: null,
psAccountsNeedsUpgrade: false,
psAccountsUpgradeLink: 'http://localhost:8082/admin-dev/index.php/improve/modules/manage/action/install/ps_accounts?_token=dCspOkG6tWwGoJIKdugKufBFtdNF--UPq8NVmyiUKLM',
currentShop: {
id: 1,
name: 'PrestaShop',
Expand Down Expand Up @@ -598,6 +790,14 @@ If you want to pass something to the component footer like another component you
superAdminEmail: '[email protected]',
ssoResendVerificationEmail: 'http://perdu.com',
manageAccountLink: 'http://perdu.com',
dependencies: {
"ps_eventbus": {
"enableLink": "http://localhost:80/admin-dev/index.php/improve/modules/manage/action/enable/ps_eventbus?_token=up_TmQFm66p9dwunsmfNzk2UfDD3a8tsxdW5a7KviKw",
"installLink": "http://localhost:80/admin-dev/index.php/improve/modules/manage/action/install/ps_eventbus?_token=up_TmQFm66p9dwunsmfNzk2UfDD3a8tsxdW5a7KviKw",
"isEnabled": true,
"isInstalled": true,
},
},
})
},
},
Expand Down
Loading

0 comments on commit f098f09

Please sign in to comment.