@rebilly/instruments 3.10.0-beta.0 → 3.12.0-beta.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/dist/index.js +3 -3
- package/dist/index.min.js +3 -3
- package/package.json +1 -1
- package/src/functions/mount/setup-options.js +5 -1
- package/src/storefront/index.js +5 -1
- package/src/storefront/ready-to-pay.js +4 -0
- package/src/storefront/ready-to-pay.spec.js +2 -2
- package/src/views/method-selector/mount-methods.js +9 -2
package/package.json
CHANGED
|
@@ -73,10 +73,14 @@ export default ({
|
|
|
73
73
|
|
|
74
74
|
validateOptions(options);
|
|
75
75
|
|
|
76
|
+
const productionUrl = options.apiMode === 'sandbox'
|
|
77
|
+
? 'https://forms-sandbox.secure-payments.app'
|
|
78
|
+
: 'https://forms.secure-payments.app';
|
|
79
|
+
|
|
76
80
|
const _computed = {
|
|
77
81
|
paymentMethodsUrl: options._dev
|
|
78
82
|
? options._dev.paymentMethodsUrl || 'https://forms.local.rebilly.dev:3000'
|
|
79
|
-
:
|
|
83
|
+
: productionUrl
|
|
80
84
|
};
|
|
81
85
|
|
|
82
86
|
const combinedOptions = merge({...defaults}, {
|
package/src/storefront/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import RebillyApi, {RebillyStorefrontAPI} from 'rebilly-js-sdk';
|
|
1
|
+
import RebillyApi, {RebillyStorefrontAPI, RebillyExperimentalAPI} from 'rebilly-js-sdk';
|
|
2
2
|
|
|
3
3
|
export function validateStateForStorefront({state}) {
|
|
4
4
|
if (!state.storefront) {
|
|
@@ -56,11 +56,15 @@ export class StorefrontInstance {
|
|
|
56
56
|
// TODO: Check why Rollup is making the default as an named export
|
|
57
57
|
const rebilly = typeof RebillyApi.default === 'function' ? RebillyApi.default(config) : RebillyApi(config);
|
|
58
58
|
|
|
59
|
+
const experimental = RebillyExperimentalAPI(config);
|
|
60
|
+
|
|
59
61
|
api.setSessionToken(publishableKey || jwt);
|
|
60
62
|
rebilly.setSessionToken(publishableKey || jwt);
|
|
63
|
+
experimental.setSessionToken(publishableKey || jwt);
|
|
61
64
|
|
|
62
65
|
this.api = api;
|
|
63
66
|
this.api.rebilly = rebilly;
|
|
67
|
+
this.api.rebilly.experimental = experimental;
|
|
64
68
|
|
|
65
69
|
return this.api;
|
|
66
70
|
}
|
|
@@ -33,6 +33,10 @@ export async function fetchReadyToPay({ state, riskMetadata = null }) {
|
|
|
33
33
|
data.currency = money.currency;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
if (state.data?.account?.address) {
|
|
37
|
+
data.billingAddress = state.data.account.address;
|
|
38
|
+
}
|
|
39
|
+
|
|
36
40
|
const [
|
|
37
41
|
{ fields: readyToPayFields },
|
|
38
42
|
{ items: paymentMethodsMetadataItems }
|
|
@@ -41,11 +41,11 @@ describe('Storefront API Ready to Pay', () => {
|
|
|
41
41
|
|
|
42
42
|
expect(instance.storefront.purchase.readyToPay).toBeCalledTimes(1);
|
|
43
43
|
expect(instance.storefront.purchase.readyToPay).toBeCalledWith({
|
|
44
|
-
data: {
|
|
44
|
+
data: expect.objectContaining({
|
|
45
45
|
items: options.items,
|
|
46
46
|
websiteId: options.websiteId,
|
|
47
47
|
riskMetadata: {}
|
|
48
|
-
}
|
|
48
|
+
})
|
|
49
49
|
});
|
|
50
50
|
expect(response).toBeInstanceOf(Array);
|
|
51
51
|
expect(response[0]).toBeInstanceOf(ReadyToPayModel);
|
|
@@ -155,6 +155,7 @@ export function MountMethods({
|
|
|
155
155
|
const details = document.querySelectorAll('.rebilly-instruments-accordion');
|
|
156
156
|
// Add the onclick listeners.
|
|
157
157
|
details.forEach((targetDetail) => {
|
|
158
|
+
targetDetail.open = true;
|
|
158
159
|
targetDetail.querySelector('summary').addEventListener('click', () => {
|
|
159
160
|
// Close all the accordion that are not targetDetail.
|
|
160
161
|
details.forEach((detail) => {
|
|
@@ -163,8 +164,14 @@ export function MountMethods({
|
|
|
163
164
|
});
|
|
164
165
|
});
|
|
165
166
|
|
|
166
|
-
//
|
|
167
|
-
details
|
|
167
|
+
// HOTFIX:
|
|
168
|
+
// All details must be open to connect to Postmate than closed
|
|
169
|
+
setTimeout(() => {
|
|
170
|
+
details.forEach((detail) => {
|
|
171
|
+
detail.removeAttribute('open');
|
|
172
|
+
});
|
|
173
|
+
details[0].open = true;
|
|
174
|
+
}, 100);
|
|
168
175
|
}
|
|
169
176
|
|
|
170
177
|
state.translate.translateItems();
|