restructure local modules setup

This commit is contained in:
David Remer 2020-06-29 11:26:18 +03:00
parent e61ea5f735
commit 011a4d2d45
12 changed files with 9360 additions and 13532 deletions

View file

@ -15,18 +15,14 @@
{ {
"type": "composer", "type": "composer",
"url": "https://repo.packagist.com/inpsyde/ppc-platform/" "url": "https://repo.packagist.com/inpsyde/ppc-platform/"
},
{
"type": "path",
"url": "modules.local/ppcp-onboarding"
} }
], ],
"require": { "require": {
"dhii/module-interface": "0.2.x-dev", "dhii/module-interface": "0.2.x-dev",
"psr/container": "^1.0", "psr/container": "^1.0",
"inpsyde/ppcp-onboarding": "dev-master", "inpsyde/ppcp-admin-notices": "dev-master",
"inpsyde/ppcp-button": "dev-master", "inpsyde/ppcp-api-client": "dev-master",
"inpsyde/ppcp-wc-gateway": "dev-master", "inpsyde/ppcp-session": "dev-master",
"oomphinc/composer-installers-extender": "^1.1", "oomphinc/composer-installers-extender": "^1.1",
"container-interop/service-provider": "^0.4.0", "container-interop/service-provider": "^0.4.0",
"dhii/containers": "dev-develop", "dhii/containers": "dev-develop",
@ -41,7 +37,8 @@
"psr-4": { "psr-4": {
"Inpsyde\\PayPalCommerce\\": "src/", "Inpsyde\\PayPalCommerce\\": "src/",
"Inpsyde\\PayPalCommerce\\Button\\": "modules.local/ppcp-button/src/", "Inpsyde\\PayPalCommerce\\Button\\": "modules.local/ppcp-button/src/",
"Inpsyde\\PayPalCommerce\\WcGateway\\": "modules.local/ppcp-wc-gateway/src/" "Inpsyde\\PayPalCommerce\\WcGateway\\": "modules.local/ppcp-wc-gateway/src/",
"Inpsyde\\PayPalCommerce\\Onboarding\\": "modules.local/ppcp-onboarding/src/"
} }
}, },
"autoload-dev": { "autoload-dev": {

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -44,7 +44,7 @@ return [
}, },
'button.url' => static function (ContainerInterface $container): string { 'button.url' => static function (ContainerInterface $container): string {
return plugins_url( return plugins_url(
'/modules/ppcp-button/', '/modules.local/ppcp-button/',
dirname(__FILE__, 3) . '/woocommerce-paypal-commerce-gateway.php' dirname(__FILE__, 3) . '/woocommerce-paypal-commerce-gateway.php'
); );
}, },

View file

@ -175,7 +175,6 @@ class SmartButton implements SmartButtonInterface
private function localizeScript(): array private function localizeScript(): array
{ {
the_post_thumbnail();
$localize = [ $localize = [
'script_attributes' => $this->attributes(), 'script_attributes' => $this->attributes(),
'redirect' => wc_get_checkout_url(), 'redirect' => wc_get_checkout_url(),

File diff suppressed because it is too large Load diff

View file

@ -1,50 +1,2 @@
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t){(()=>{const e=document.createElement("a");e.innerText=PayPalCommerceGatewayOnboarding.link.text,Object.entries(PayPalCommerceGatewayOnboarding.link.attributes).forEach(t=>{e.setAttribute(t[0],t[1])});e.setAttribute("data-paypal-onboard-complete",(e,t)=>{console.log(e),console.log(t),fetch(PayPalCommerceGatewayOnboarding.endpoint,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({authCode:e,sharedId:t,nonce:PayPalCommerceGatewayOnboarding.nonce})}).then((function(e){response.ok||alert("Something went wrong!")}))});const t=document.querySelector(".form-table");t.parentNode.insertBefore(e,t);const n=document.createElement("script");Object.entries(PayPalCommerceGatewayOnboarding.script.attributes).forEach(e=>{n.setAttribute(e[0],e[1])}),document.body.append(n)})()}]);
//# sourceMappingURL=onboarding.js.map
const onboardingCallback = (authCode, sharedId) => {
console.log(authCode);
console.log(sharedId);
fetch(PayPalCommerceGatewayOnboarding.endpoint, {
method: 'POST',
headers: {
'content-type': 'application/json'
},
body: JSON.stringify({
authCode: authCode,
sharedId: sharedId,
nonce: PayPalCommerceGatewayOnboarding.nonce
})
});
}
/*
const bootstrap = () => {
if (!typeof (PayPalCommerceGatewayOnboarding)) {
console.error('PayPal onboarding could not be configured.');
return;
}
const link = document.createElement('a');
link.innerText = PayPalCommerceGatewayOnboarding.link.text;
Object.entries(PayPalCommerceGatewayOnboarding.link.attributes).forEach(
(keyValue) => {
link.setAttribute(keyValue[0], keyValue[1]);
}
);
link.setAttribute('data-paypal-onboard-complete', 'onboardingCallback');
const table = document.querySelector('.form-table');
const wrapper = table.parentNode;
//wrapper.insertBefore(link, table);
const script = document.createElement('script');
Object.entries(PayPalCommerceGatewayOnboarding.script.attributes).forEach(
(keyValue) => {
script.setAttribute(keyValue[0], keyValue[1]);
}
);
wrapper.insertBefore(script, table);
};
bootstrap();
*/

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -66,7 +66,7 @@ return [
'onboarding.url' => static function (ContainerInterface $container): string { 'onboarding.url' => static function (ContainerInterface $container): string {
return plugins_url( return plugins_url(
'/modules/ppcp-onboarding/', '/modules.local/ppcp-onboarding/',
dirname(__FILE__, 3) . '/woocommerce-paypal-commerce-gateway.php' dirname(__FILE__, 3) . '/woocommerce-paypal-commerce-gateway.php'
); );
}, },

File diff suppressed because it is too large Load diff

21
package.json Normal file
View file

@ -0,0 +1,21 @@
{
"name": "izettle-woocommerce",
"version": "0.1.0",
"description": "iZettle WooCommerce",
"repository": "https://github.com/inpsyde/izettle-woocommerce",
"license": "GPL-2.0",
"author": "Inpsyde GmbH",
"scripts": {
"install:assets:ppcp-button": "cd modules.local/ppcp-button && yarn install",
"install:assets:ppcp-onboarding" : "cd modules.local/ppcp-onboarding && yarn install",
"install:assets": "yarn run install:assets:ppcp-button && yarn run install:assets:ppcp-onboarding",
"build:assets:ppcp-button": "cd modules.local/ppcp-button && yarn run build",
"build:assets:ppcp-onboarding" : "cd modules.local/ppcp-onboarding && yarn run build",
"build:assets": "yarn run build:assets:ppcp-button && yarn run build:assets:ppcp-onboarding",
"build": "yarn run install:assets && yarn run build:assets"
},
"dependencies": {
},
"devDependencies": {
}
}