@rebilly/instruments 3.26.3-beta.0 → 3.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/index.js +15 -13
- package/dist/index.min.js +51 -49
- package/package.json +6 -6
- package/project.json +11 -0
- package/{rollup.config.js → rollup.config.mjs} +1 -1
- package/src/data/payment-methods.json +19 -0
- package/src/storefront/models/ready-to-pay-model.js +19 -0
- package/src/views/method-selector/express-methods.js +1 -11
- package/src/views/method-selector/mount-express-methods.js +25 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebilly/instruments",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.27.0",
|
|
4
4
|
"author": "Rebilly",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@babel/cli": "^7.14.5",
|
|
17
17
|
"@babel/core": "^7.14.6",
|
|
18
18
|
"@babel/preset-env": "^7.14.7",
|
|
19
|
-
"@rebilly/risk-data-collector": "
|
|
19
|
+
"@rebilly/risk-data-collector": "*",
|
|
20
20
|
"@vue/reactivity": "^3.2.39",
|
|
21
21
|
"jwt-decode": "^3.1.2",
|
|
22
22
|
"lodash.camelcase": "^4.3.0",
|
|
@@ -30,20 +30,20 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@rollup/plugin-babel": "^5.1.0",
|
|
33
|
-
"@rollup/plugin-commonjs": "^
|
|
33
|
+
"@rollup/plugin-commonjs": "^15.0.0",
|
|
34
34
|
"@rollup/plugin-json": "^4.1.0",
|
|
35
|
-
"@rollup/plugin-node-resolve": "^
|
|
35
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
36
36
|
"@rollup/plugin-replace": "^3.0.0",
|
|
37
37
|
"axios": "^0.27.2",
|
|
38
38
|
"babel-plugin-module-resolver": "^4.1.0",
|
|
39
39
|
"component-emitter": "^1.3.0",
|
|
40
|
-
"core-js": "3.23.3",
|
|
40
|
+
"core-js": "^3.23.3",
|
|
41
41
|
"jest": "^27.0.6",
|
|
42
42
|
"msw": "0.45.0",
|
|
43
43
|
"msw-when-then": "^1.5.1",
|
|
44
44
|
"rollup": "^2.35.1",
|
|
45
45
|
"rollup-plugin-ignore": "^1.0.10",
|
|
46
|
-
"rollup-plugin-polyfill-node": "^0.
|
|
46
|
+
"rollup-plugin-polyfill-node": "^0.12.0",
|
|
47
47
|
"rollup-plugin-terser": "^7.0.2",
|
|
48
48
|
"rollup-plugin-version-injector": "^1.3.3"
|
|
49
49
|
}
|
package/project.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "instruments/core",
|
|
3
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"projectType": "library",
|
|
5
|
+
"sourceRoot": "packages/instruments/core",
|
|
6
|
+
"targets": {
|
|
7
|
+
"semantic-release": {
|
|
8
|
+
"executor": "@theunderscorer/nx-semantic-release:semantic-release"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -1616,6 +1616,25 @@
|
|
|
1616
1616
|
}
|
|
1617
1617
|
]
|
|
1618
1618
|
},
|
|
1619
|
+
{
|
|
1620
|
+
"apiName": "NordikCoin",
|
|
1621
|
+
"name": "NordikCoin",
|
|
1622
|
+
"landscapeLogo": null,
|
|
1623
|
+
"portraitLogo": "https://app.rebilly.com/static/payment-methods/portrait/NordikCoin.svg",
|
|
1624
|
+
"summary": "NordikCoin customers can buy Bitcoin in under 5 minutes.",
|
|
1625
|
+
"description": "NordikCoin is a crypto currency exchange that specializes in Bitcoin.",
|
|
1626
|
+
"countries": {
|
|
1627
|
+
"mode": "unknown",
|
|
1628
|
+
"values": []
|
|
1629
|
+
},
|
|
1630
|
+
"storefrontEnabled": true,
|
|
1631
|
+
"_links": [
|
|
1632
|
+
{
|
|
1633
|
+
"rel": "self",
|
|
1634
|
+
"href": "https://api.rebilly.com/payment-methods/NordikCoin"
|
|
1635
|
+
}
|
|
1636
|
+
]
|
|
1637
|
+
},
|
|
1619
1638
|
{
|
|
1620
1639
|
"apiName": "OXXO",
|
|
1621
1640
|
"name": "OXXO",
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import PaymentMetadataModel from './payment-metadata';
|
|
2
2
|
|
|
3
3
|
export class ReadyToPayFeatureModel {
|
|
4
|
+
static FeatureName = {
|
|
5
|
+
paypalBillingAgreement: 'PayPal billing agreement',
|
|
6
|
+
googlePay: 'Google Pay',
|
|
7
|
+
applePay: 'Apple Pay',
|
|
8
|
+
};
|
|
9
|
+
|
|
4
10
|
constructor({
|
|
5
11
|
name = '',
|
|
6
12
|
expirationTime = '',
|
|
@@ -54,4 +60,17 @@ export default class ReadyToPayModel {
|
|
|
54
60
|
this.filters = filters;
|
|
55
61
|
this.metadata = metadata ? new PaymentMetadataModel(metadata) : null;
|
|
56
62
|
}
|
|
63
|
+
|
|
64
|
+
get optionsPaymentInstrumentsKey() {
|
|
65
|
+
switch (this.feature?.name) {
|
|
66
|
+
case ReadyToPayFeatureModel.FeatureName.paypalBillingAgreement:
|
|
67
|
+
return 'paypal';
|
|
68
|
+
case ReadyToPayFeatureModel.FeatureName.googlePay:
|
|
69
|
+
return 'googlePay';
|
|
70
|
+
case ReadyToPayFeatureModel.FeatureName.applePay:
|
|
71
|
+
return 'applePay';
|
|
72
|
+
default:
|
|
73
|
+
return undefined
|
|
74
|
+
}
|
|
75
|
+
}
|
|
57
76
|
}
|
|
@@ -21,14 +21,6 @@ export default function mountExpressMethod({
|
|
|
21
21
|
applePayButton.style.cursor = 'pointer';
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
// Update height of the container to match the height of the button
|
|
25
|
-
function updatePayPalStyling() {
|
|
26
|
-
const {
|
|
27
|
-
buttonHeight
|
|
28
|
-
} = state.options.paymentInstruments.paypal;
|
|
29
|
-
container.style.height = `${buttonHeight}px`;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
24
|
function mountButton() {
|
|
33
25
|
if(!container.children.length) {
|
|
34
26
|
const rebillyMountFunction = {
|
|
@@ -43,9 +35,7 @@ export default function mountExpressMethod({
|
|
|
43
35
|
if (id === 'apple-pay') {
|
|
44
36
|
updateApplePayStyling();
|
|
45
37
|
}
|
|
46
|
-
|
|
47
|
-
updatePayPalStyling();
|
|
48
|
-
}
|
|
38
|
+
|
|
49
39
|
} else {
|
|
50
40
|
console.warn(`method '${id}' is not supported`);
|
|
51
41
|
}
|
|
@@ -24,12 +24,35 @@ export async function mountExpressMethods({
|
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
function generateExpressMethodHeight(method) {
|
|
28
|
+
let height;
|
|
29
|
+
const optionId = method.optionsPaymentInstrumentsKey;
|
|
30
|
+
|
|
31
|
+
// Return the default size of express methods if no id is found
|
|
32
|
+
if (!optionId) return '48px';
|
|
33
|
+
|
|
34
|
+
const {buttonHeight, displayOptions} = state.options.paymentInstruments?.[optionId];
|
|
35
|
+
|
|
36
|
+
if (displayOptions) {
|
|
37
|
+
height = displayOptions.buttonHeight;
|
|
38
|
+
} else {
|
|
39
|
+
height = buttonHeight;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (typeof height === 'number') {
|
|
43
|
+
height = `${buttonHeight}px`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return height;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
methods.forEach(method => {
|
|
50
|
+
const {METHOD_ID: id} = getMethodData(method);
|
|
28
51
|
// filter out apple pay unless in safari
|
|
29
52
|
if (id === 'apple-pay' && !browserIsSafari()) return
|
|
30
53
|
|
|
31
54
|
container.innerHTML += `
|
|
32
|
-
<div class="rebilly-instruments-${id}-method"></div>
|
|
55
|
+
<div class="rebilly-instruments-${id}-method" style="height: ${generateExpressMethodHeight(method)}"></div>
|
|
33
56
|
`;
|
|
34
57
|
mountExpressMethod({
|
|
35
58
|
state,
|