@rebilly/instruments 4.4.0 → 4.6.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.
Files changed (134) hide show
  1. package/.babelrc +24 -26
  2. package/CHANGELOG.md +14 -0
  3. package/dist/index.js +14 -40
  4. package/dist/index.min.js +14 -40
  5. package/package.json +16 -5
  6. package/project.json +9 -0
  7. package/rollup.config.mjs +21 -26
  8. package/src/data/options-schema/index.js +94 -78
  9. package/src/data/options-schema/schemas/options-schema.js +420 -408
  10. package/src/events/base-event.js +34 -34
  11. package/src/events/events.spec.js +6 -6
  12. package/src/events/index.js +5 -5
  13. package/src/functions/destroy.js +19 -19
  14. package/src/functions/destroy.spec.js +41 -41
  15. package/src/functions/mount/fetch-data.js +200 -193
  16. package/src/functions/mount/fetch-data.spec.js +287 -285
  17. package/src/functions/mount/get-lead-source-data.js +31 -31
  18. package/src/functions/mount/get-lead-source-data.spec.js +19 -19
  19. package/src/functions/mount/index.js +73 -65
  20. package/src/functions/mount/mount.spec.js +77 -66
  21. package/src/functions/mount/setup-element.js +23 -23
  22. package/src/functions/mount/setup-framepay-theme.js +86 -68
  23. package/src/functions/mount/setup-framepay.js +9 -5
  24. package/src/functions/mount/setup-i18n.js +15 -15
  25. package/src/functions/mount/setup-options.js +74 -74
  26. package/src/functions/mount/setup-options.spec.js +325 -289
  27. package/src/functions/mount/setup-storefront.js +15 -20
  28. package/src/functions/mount/setup-styles-vars.js +19 -22
  29. package/src/functions/mount/setup-user-flow.js +51 -47
  30. package/src/functions/on.js +5 -5
  31. package/src/functions/on.spec.js +60 -51
  32. package/src/functions/purchase.js +149 -134
  33. package/src/functions/purchase.spec.js +59 -56
  34. package/src/functions/setup.js +53 -49
  35. package/src/functions/setup.spec.js +88 -75
  36. package/src/functions/show.js +13 -14
  37. package/src/functions/show.spec.js +53 -53
  38. package/src/functions/update.js +30 -28
  39. package/src/functions/update.spec.js +94 -93
  40. package/src/i18n/en.json +32 -32
  41. package/src/i18n/es.json +29 -29
  42. package/src/i18n/i18n.spec.js +18 -18
  43. package/src/i18n/index.js +48 -48
  44. package/src/instance.js +36 -36
  45. package/src/instance.spec.js +29 -27
  46. package/src/loader/index.js +95 -70
  47. package/src/loader/loader.spec.js +63 -63
  48. package/src/state/iframes.js +21 -21
  49. package/src/state/index.js +56 -54
  50. package/src/storefront/account-and-website.js +10 -8
  51. package/src/storefront/account-and-website.spec.js +55 -55
  52. package/src/storefront/deposit-requests.js +6 -6
  53. package/src/storefront/fetch-plans-from-addons-bumpOffer.js +21 -19
  54. package/src/storefront/fetch-products-from-plans.js +52 -51
  55. package/src/storefront/fetch-products-from-plans.spec.js +90 -87
  56. package/src/storefront/index.js +56 -49
  57. package/src/storefront/invoices.js +15 -15
  58. package/src/storefront/invoices.spec.js +69 -65
  59. package/src/storefront/models/account-model.js +29 -32
  60. package/src/storefront/models/base-model.js +6 -9
  61. package/src/storefront/models/deposit-request-model.js +22 -13
  62. package/src/storefront/models/invoice-model.js +16 -16
  63. package/src/storefront/models/payment-metadata.js +4 -4
  64. package/src/storefront/models/plan-model.js +73 -64
  65. package/src/storefront/models/ready-to-pay-model.js +59 -59
  66. package/src/storefront/models/summary-model.js +43 -46
  67. package/src/storefront/models/transaction-model.js +11 -14
  68. package/src/storefront/payment-instruments.js +38 -35
  69. package/src/storefront/payment-instruments.spec.js +81 -62
  70. package/src/storefront/purchase.js +50 -44
  71. package/src/storefront/purchase.spec.js +40 -40
  72. package/src/storefront/ready-to-pay.js +75 -77
  73. package/src/storefront/ready-to-pay.spec.js +59 -54
  74. package/src/storefront/storefront.spec.js +9 -9
  75. package/src/storefront/summary.js +93 -67
  76. package/src/storefront/summary.spec.js +108 -106
  77. package/src/storefront/transactions.js +6 -6
  78. package/src/style/base/default-theme.js +928 -923
  79. package/src/style/base/theme.js +21 -21
  80. package/src/style/base/theme.spec.js +13 -13
  81. package/src/style/index.js +3 -3
  82. package/src/style/utils/border.js +40 -27
  83. package/src/style/utils/color-values.js +18 -18
  84. package/src/style/utils/minifyCss.js +6 -6
  85. package/src/utils/add-dom-element.js +14 -14
  86. package/src/utils/format-currency.js +6 -5
  87. package/src/utils/has-valid-css-selector.js +2 -2
  88. package/src/utils/index.js +6 -6
  89. package/src/utils/is-dom-element.js +1 -1
  90. package/src/utils/process-property-as-dom-element.js +22 -22
  91. package/src/utils/quantity.js +26 -28
  92. package/src/utils/sleep.js +3 -1
  93. package/src/views/amount-selector.js +37 -36
  94. package/src/views/common/iframe/base-iframe.js +53 -52
  95. package/src/views/common/iframe/events/change-iframe-src-handler.js +5 -5
  96. package/src/views/common/iframe/events/dispatch-event-handler.js +4 -4
  97. package/src/views/common/iframe/events/resize-component-handler.js +8 -8
  98. package/src/views/common/iframe/events/show-error-handler.js +2 -2
  99. package/src/views/common/iframe/events/stop-loader-handler.js +8 -8
  100. package/src/views/common/iframe/events/update-addons-handler.js +20 -13
  101. package/src/views/common/iframe/events/update-coupons-handler.js +9 -9
  102. package/src/views/common/iframe/events/update-items-handler.js +26 -22
  103. package/src/views/common/iframe/modal-iframe.js +67 -56
  104. package/src/views/common/iframe/view-iframe.js +11 -11
  105. package/src/views/common/render-utilities.js +2 -2
  106. package/src/views/confirmation.js +33 -30
  107. package/src/views/errors.js +89 -79
  108. package/src/views/form.js +41 -37
  109. package/src/views/method-selector/express-methods.js +46 -46
  110. package/src/views/method-selector/generate-digital-wallet.js +46 -45
  111. package/src/views/method-selector/generate-digital-wallet.spec.js +104 -102
  112. package/src/views/method-selector/generate-framepay-config.js +53 -51
  113. package/src/views/method-selector/generate-framepay-config.spec.js +197 -173
  114. package/src/views/method-selector/get-method-data.js +5 -6
  115. package/src/views/method-selector/get-payment-methods.js +18 -16
  116. package/src/views/method-selector/get-payment-methods.spec.js +29 -27
  117. package/src/views/method-selector/index.js +154 -139
  118. package/src/views/method-selector/method-selector.spec.js +13 -13
  119. package/src/views/method-selector/mount-bump-offer.js +65 -49
  120. package/src/views/method-selector/mount-express-methods.js +89 -85
  121. package/src/views/modal.js +74 -67
  122. package/src/views/result.js +14 -14
  123. package/src/views/summary.js +25 -26
  124. package/tests/async-utilities.js +13 -13
  125. package/tests/mocks/framepay-mock.js +9 -8
  126. package/tests/mocks/rebilly-api-mock.js +5 -3
  127. package/tests/mocks/rebilly-instruments-mock.js +121 -117
  128. package/tests/mocks/storefront-api-mock.js +55 -48
  129. package/tests/mocks/storefront-mock.js +10 -14
  130. package/tests/msw/server.js +6 -6
  131. package/tests/setup-test.js +14 -16
  132. package/vitest.config.js +14 -14
  133. package/.eslintrc.js +0 -34
  134. package/.prettierrc.js +0 -11
@@ -1,436 +1,448 @@
1
1
  export default {
2
- title: 'Mount Options Schema',
3
- type: 'object',
4
- properties: {
5
- form: {
6
- type: 'string',
7
- default: '.rebilly-instruments',
8
- },
9
- summary: {
10
- type: 'string',
11
- default: '.rebilly-instruments-summary',
12
- },
13
- apiMode: {
14
- type: 'string',
15
- enum: ['sandbox', 'live'],
16
- },
17
- publishableKey: {type: 'string',},
18
- jwt: {type: 'string'},
19
- websiteId: {type: 'string',},
20
- organizationId: {type: 'string',},
21
- items: {
22
- type: 'array',
23
- items: {
24
- type: 'object',
25
- properties: {
26
- planId: {type: 'string'},
27
- thumbnail: {type: 'string'},
2
+ title: 'Mount Options Schema',
3
+ type: 'object',
4
+ properties: {
5
+ form: {
6
+ type: 'string',
7
+ default: '.rebilly-instruments',
28
8
  },
29
- oneOf: [
30
- {
31
- properties: {
32
- quantity: { type: 'number' },
9
+ summary: {
10
+ type: 'string',
11
+ default: '.rebilly-instruments-summary',
12
+ },
13
+ apiMode: {
14
+ type: 'string',
15
+ enum: ['sandbox', 'live'],
16
+ },
17
+ publishableKey: { type: 'string' },
18
+ jwt: { type: 'string' },
19
+ websiteId: { type: 'string' },
20
+ organizationId: { type: 'string' },
21
+ items: {
22
+ type: 'array',
23
+ items: {
24
+ type: 'object',
25
+ properties: {
26
+ planId: { type: 'string' },
27
+ thumbnail: { type: 'string' },
28
+ },
29
+ oneOf: [
30
+ {
31
+ properties: {
32
+ quantity: { type: 'number' },
33
+ },
34
+ },
35
+ {
36
+ properties: {
37
+ quantity: {
38
+ type: 'object',
39
+ properties: {
40
+ default: { type: 'number' },
41
+ minimum: { type: 'number' },
42
+ maximum: { type: 'number' },
43
+ multipleOf: { type: 'number' },
44
+ },
45
+ },
46
+ },
47
+ },
48
+ ],
49
+ required: ['planId', 'quantity'],
33
50
  },
34
- }, {
35
- properties: {
36
- quantity: {
51
+ minItems: 1,
52
+ },
53
+ addons: {
54
+ type: 'array',
55
+ items: {
37
56
  type: 'object',
38
57
  properties: {
39
- default: {type: 'number'},
40
- minimum: {type: 'number'},
41
- maximum: {type: 'number'},
42
- multipleOf: {type: 'number'}
43
- }
44
- }
45
- }
46
- }
47
- ],
48
- required: ['planId', 'quantity'],
49
- },
50
- minItems: 1,
51
- },
52
- addons: {
53
- type: 'array',
54
- items: {
55
- type: 'object',
56
- properties: {
57
- planId: {type: 'string'},
58
- quantity: {type: 'number'},
59
- thumbnail: {type: 'string'},
58
+ planId: { type: 'string' },
59
+ quantity: { type: 'number' },
60
+ thumbnail: { type: 'string' },
61
+ },
62
+ required: ['planId', 'quantity'],
63
+ },
64
+ default: [],
60
65
  },
61
- required: ['planId', 'quantity']
62
- },
63
- default: [],
64
- },
65
- bumpOffer: {
66
- type: 'array',
67
- items: {
68
- type: 'object',
69
- properties: {
70
- planId: {type: 'string'},
71
- quantity: {type: 'number'},
72
- thumbnail: {type: 'string'},
66
+ bumpOffer: {
67
+ type: 'array',
68
+ items: {
69
+ type: 'object',
70
+ properties: {
71
+ planId: { type: 'string' },
72
+ quantity: { type: 'number' },
73
+ thumbnail: { type: 'string' },
74
+ },
75
+ required: ['planId', 'quantity'],
76
+ },
77
+ default: [],
73
78
  },
74
- required: ['planId', 'quantity']
75
- },
76
- default: [],
77
- },
78
- money: {
79
- type: 'object',
80
- properties: {
81
- amount: {
82
- type: 'number'
79
+ money: {
80
+ type: 'object',
81
+ properties: {
82
+ amount: {
83
+ type: 'number',
84
+ },
85
+ currency: {
86
+ type: 'string',
87
+ minLength: 3,
88
+ maxLength: 3,
89
+ },
90
+ },
91
+ required: ['amount', 'currency'],
83
92
  },
84
- currency: {
85
- type: 'string',
86
- minLength: 3,
87
- maxLength: 3,
93
+ invoiceId: { type: 'string' },
94
+ transactionId: { type: 'string' },
95
+ deposit: {
96
+ oneOf: [
97
+ {
98
+ type: 'object',
99
+ properties: {
100
+ depositRequestId: { type: 'string' },
101
+ },
102
+ required: ['depositRequestId'],
103
+ },
104
+ {
105
+ type: 'object',
106
+ properties: {
107
+ currency: {
108
+ type: 'string',
109
+ minLength: 3,
110
+ maxLength: 3,
111
+ },
112
+ amount: {
113
+ type: 'number',
114
+ },
115
+ buttons: {
116
+ type: 'array',
117
+ items: {
118
+ type: 'number',
119
+ },
120
+ },
121
+ editable: { type: 'boolean' },
122
+ customAmount: {
123
+ type: 'object',
124
+ properties: {
125
+ minimum: { type: 'number' },
126
+ maximum: { type: 'number' },
127
+ multipleOf: { type: 'number' },
128
+ },
129
+ },
130
+ },
131
+ anyOf: [
132
+ {
133
+ required: ['amount'],
134
+ },
135
+ {
136
+ required: ['buttons'],
137
+ },
138
+ ],
139
+ required: ['currency'],
140
+ },
141
+ ],
88
142
  },
89
- },
90
- required: ['amount', 'currency'],
91
- },
92
- invoiceId: {type: 'string'},
93
- transactionId: {type: 'string'},
94
- deposit: {
95
- oneOf: [
96
- {
97
- type: 'object',
98
- properties: {
99
- depositRequestId: {type: 'string'},
100
- },
101
- required: ['depositRequestId']
102
- }, {
103
- type: 'object',
104
- properties: {
105
- currency: {
106
- type: 'string',
107
- minLength: 3,
108
- maxLength: 3,
109
- },
110
- amount: {
111
- type: 'number'
112
- },
113
- buttons: {
114
- type: 'array',
115
- items: {
116
- type: 'number'
117
- }
143
+ transactionType: {
144
+ type: 'string',
145
+ enum: ['purchase', 'setup'],
146
+ default: 'purchase',
147
+ },
148
+ css: { type: 'string' },
149
+ theme: {
150
+ type: 'object',
151
+ properties: {
152
+ labels: {
153
+ type: 'string',
154
+ enum: ['stacked', 'floating'],
155
+ default: 'stacked',
156
+ },
157
+ // TODO: split file add schema for all tokens
118
158
  },
119
- editable: {type: 'boolean'},
120
- customAmount: {
121
- type: 'object',
122
- properties: {
123
- minimum: {type: 'number'},
124
- maximum: {type: 'number'},
125
- multipleOf: {type: 'number'}
126
- },
127
- }
128
- },
129
- anyOf: [
130
- {
131
- required: ['amount'],
132
- }, {
133
- required: ['buttons']
134
- }
135
- ],
136
- required: ['currency']
137
- }
138
- ]
139
- },
140
- transactionType: {
141
- type: 'string',
142
- enum: ['purchase', 'setup'],
143
- default: 'purchase',
144
- },
145
- css: {type: 'string'},
146
- theme: {
147
- type: 'object',
148
- properties: {
149
- labels: {
150
- type: 'string',
151
- enum: ['stacked', 'floating'],
152
- default: 'stacked'
159
+ default: {},
153
160
  },
154
- // TODO: split file add schema for all tokens
155
- },
156
- default: {},
157
- },
158
- countryCode: {
159
- type: 'string',
160
- default: 'US',
161
- },
162
- locale: {
163
- type: 'string',
164
- default: 'auto',
165
- },
166
- i18n: {
167
- type: 'object',
168
- patternProperties: {
169
- "^[a-z]{2}(-[A-Z]{2})?$": {
170
- type: "object",
171
- properties: {
172
- // TODO: split file add schema for all translation keys
173
- summary: {type: 'object'},
174
- form: {type: 'object'},
175
- confirmation: {type: 'object'},
176
- result: {type: 'object'},
177
- validations: {type: 'object'},
178
- paymentMethods: {type: 'object'},
179
- }
161
+ countryCode: {
162
+ type: 'string',
163
+ default: 'US',
180
164
  },
181
- }
182
- },
183
- paymentInstruments: {
184
- type: 'object',
185
- properties: {
186
- compactExpressInstruments: {
187
- type: 'boolean',
188
- default: false
165
+ locale: {
166
+ type: 'string',
167
+ default: 'auto',
189
168
  },
190
- address: {
191
- type: 'object',
192
- properties: {
193
- name: {
194
- type: 'string',
195
- enum: ['default', 'combined', 'stacked'],
196
- default: 'default',
197
- },
198
- region: {
199
- type: 'string',
200
- enum: ['default', 'split', 'stacked'],
201
- default: 'default',
202
- },
203
- show: {
204
- type: 'array',
205
- default: [],
206
- items: {
207
- type: 'string',
208
- enum: [
209
- 'all',
210
- 'email',
211
- 'organization',
212
- 'phoneNumber',
213
- 'city',
214
- 'country',
215
- 'region',
216
- 'postalCode',
217
- 'address',
218
- 'address2'
219
- ]
220
- }
221
- },
222
- hide: {
223
- type: 'array',
224
- default: [],
225
- items: {
226
- type: 'string',
227
- enum: [
228
- 'all',
229
- 'email',
230
- 'organization',
231
- 'phoneNumber',
232
- 'city',
233
- 'country',
234
- 'region',
235
- 'postalCode',
236
- 'address',
237
- 'address2'
238
- ]
239
- }
240
- },
241
- require: {
242
- type: 'array',
243
- default: [],
244
- items: {
245
- type: 'string',
246
- enum: [
247
- 'organization',
248
- 'email',
249
- 'phoneNumber',
250
- 'address',
251
- 'address2',
252
- 'city',
253
- 'country',
254
- 'region',
255
- 'postalCode'
256
- ]
257
- }
169
+ i18n: {
170
+ type: 'object',
171
+ patternProperties: {
172
+ '^[a-z]{2}(-[A-Z]{2})?$': {
173
+ type: 'object',
174
+ properties: {
175
+ // TODO: split file add schema for all translation keys
176
+ summary: { type: 'object' },
177
+ form: { type: 'object' },
178
+ confirmation: { type: 'object' },
179
+ result: { type: 'object' },
180
+ validations: { type: 'object' },
181
+ paymentMethods: { type: 'object' },
182
+ },
183
+ },
258
184
  },
259
- },
260
- default: {},
261
185
  },
262
- paypal: {
263
- type: 'object',
264
- properties: {
265
- buttonHeight: {
266
- type: 'number',
267
- default: 48
186
+ paymentInstruments: {
187
+ type: 'object',
188
+ properties: {
189
+ compactExpressInstruments: {
190
+ type: 'boolean',
191
+ default: false,
192
+ },
193
+ address: {
194
+ type: 'object',
195
+ properties: {
196
+ name: {
197
+ type: 'string',
198
+ enum: ['default', 'combined', 'stacked'],
199
+ default: 'default',
200
+ },
201
+ region: {
202
+ type: 'string',
203
+ enum: ['default', 'split', 'stacked'],
204
+ default: 'default',
205
+ },
206
+ show: {
207
+ type: 'array',
208
+ default: [],
209
+ items: {
210
+ type: 'string',
211
+ enum: [
212
+ 'all',
213
+ 'email',
214
+ 'organization',
215
+ 'phoneNumber',
216
+ 'city',
217
+ 'country',
218
+ 'region',
219
+ 'postalCode',
220
+ 'address',
221
+ 'address2',
222
+ ],
223
+ },
224
+ },
225
+ hide: {
226
+ type: 'array',
227
+ default: [],
228
+ items: {
229
+ type: 'string',
230
+ enum: [
231
+ 'all',
232
+ 'email',
233
+ 'organization',
234
+ 'phoneNumber',
235
+ 'city',
236
+ 'country',
237
+ 'region',
238
+ 'postalCode',
239
+ 'address',
240
+ 'address2',
241
+ ],
242
+ },
243
+ },
244
+ require: {
245
+ type: 'array',
246
+ default: [],
247
+ items: {
248
+ type: 'string',
249
+ enum: [
250
+ 'organization',
251
+ 'email',
252
+ 'phoneNumber',
253
+ 'address',
254
+ 'address2',
255
+ 'city',
256
+ 'country',
257
+ 'region',
258
+ 'postalCode',
259
+ ],
260
+ },
261
+ },
262
+ },
263
+ default: {},
264
+ },
265
+ paypal: {
266
+ type: 'object',
267
+ properties: {
268
+ buttonHeight: {
269
+ type: 'number',
270
+ default: 48,
271
+ },
272
+ },
273
+ default: {},
274
+ },
275
+ googlePay: {
276
+ type: 'object',
277
+ properties: {
278
+ displayOptions: {
279
+ type: 'object',
280
+ properties: {
281
+ buttonColor: {
282
+ type: 'string',
283
+ default: 'black',
284
+ },
285
+ buttonHeight: {
286
+ type: 'string',
287
+ pattern: '^[0-9]+px$',
288
+ default: '48px',
289
+ },
290
+ buttonType: {
291
+ type: 'string',
292
+ default: 'plain',
293
+ },
294
+ },
295
+ default: {},
296
+ },
297
+ },
298
+ default: {},
299
+ },
300
+ applePay: {
301
+ type: 'object',
302
+ properties: {
303
+ displayOptions: {
304
+ type: 'object',
305
+ properties: {
306
+ buttonColor: {
307
+ type: 'string',
308
+ default: 'black',
309
+ },
310
+ buttonHeight: {
311
+ type: 'string',
312
+ pattern: '^[0-9]+px$',
313
+ default: '48px',
314
+ },
315
+ buttonType: {
316
+ type: 'string',
317
+ default: 'plain',
318
+ },
319
+ },
320
+ default: {},
321
+ },
322
+ },
323
+ default: {},
324
+ },
325
+ paymentCard: {
326
+ type: 'object',
327
+ properties: {
328
+ popup: {
329
+ type: 'boolean',
330
+ default: false,
331
+ },
332
+ },
333
+ default: {},
334
+ },
268
335
  },
269
- },
270
- default: {}
336
+ default: {},
271
337
  },
272
- googlePay: {
273
- type: 'object',
274
- properties: {
275
- displayOptions: {
276
- type: 'object',
277
- properties: {
278
- buttonColor: {
279
- type: 'string',
280
- default: 'black',
338
+ features: {
339
+ type: 'object',
340
+ properties: {
341
+ autoConfirmation: {
342
+ type: 'boolean',
343
+ default: true,
281
344
  },
282
- buttonHeight: {
283
- type: 'string',
284
- pattern: '^[0-9]+px$',
285
- default: '48px',
345
+ autoResult: {
346
+ type: 'boolean',
347
+ default: true,
286
348
  },
287
- buttonType: {
288
- type: 'string',
289
- default: 'plain',
290
- }
291
- },
292
- default: {},
293
- }
294
- },
295
- default: {},
296
- },
297
- applePay: {
298
- type: 'object',
299
- properties: {
300
- displayOptions: {
301
- type: 'object',
302
- properties: {
303
- buttonColor: {
304
- type: 'string',
305
- default: 'black',
349
+ fullPageRedirect: {
350
+ type: 'boolean',
351
+ default: false,
306
352
  },
307
- buttonHeight: {
308
- type: 'string',
309
- pattern: '^[0-9]+px$',
310
- default: '48px',
353
+ showCoupons: {
354
+ type: 'array',
355
+ items: {
356
+ type: 'string',
357
+ enum: ['summary', 'confirmation'],
358
+ },
311
359
  },
312
- buttonType: {
313
- type: 'string',
314
- default: 'plain',
315
- }
316
- },
317
- default: {},
318
- }
319
- },
320
- default: {},
360
+ },
361
+ default: {},
321
362
  },
322
- paymentCard: {
323
- type: 'object',
324
- properties: {
325
- popup: {
326
- type: 'boolean',
327
- default: false,
363
+ _dev: {
364
+ type: 'object',
365
+ properties: {
366
+ paymentMethodsUrl: {
367
+ type: 'string',
368
+ default: 'https://forms.local.rebilly.dev:3000',
369
+ },
370
+ liveUrl: { type: 'string' },
371
+ sandboxUrl: { type: 'string' },
372
+ framePayScriptLink: { type: 'string' },
373
+ framePayStyleLink: { type: 'string' },
328
374
  },
329
- },
330
- default: {},
331
375
  },
332
- },
333
- default: {},
334
376
  },
335
- features: {
336
- type: 'object',
337
- properties: {
338
- autoConfirmation: {
339
- type: 'boolean',
340
- default: true,
377
+ required: ['apiMode'],
378
+ dependentRequired: {
379
+ invoiceId: ['jwt'],
380
+ transactionId: ['jwt'],
381
+ deposit: ['jwt'],
382
+ },
383
+ anyOf: [
384
+ {
385
+ if: { required: ['items'] },
386
+ then: {
387
+ properties: {
388
+ transactionId: false,
389
+ invoiceId: false,
390
+ deposit: false,
391
+ money: false,
392
+ },
393
+ },
394
+ else: false,
341
395
  },
342
- autoResult: {
343
- type: 'boolean',
344
- default: true,
396
+ {
397
+ if: { required: ['money'] },
398
+ then: {
399
+ properties: {
400
+ transactionId: false,
401
+ invoiceId: false,
402
+ deposit: false,
403
+ items: false,
404
+ },
405
+ },
406
+ else: false,
345
407
  },
346
- showCoupons: {
347
- type: 'array',
348
- items: {
349
- type: 'string',
350
- enum: ['summary', 'confirmation']
351
- }
352
- }
353
- },
354
- default: {},
355
- },
356
- _dev: {
357
- type: 'object',
358
- properties: {
359
- paymentMethodsUrl: {
360
- type: 'string',
361
- default: 'https://forms.local.rebilly.dev:3000',
408
+ {
409
+ if: { required: ['transactionId'] },
410
+ then: {
411
+ properties: {
412
+ invoiceId: false,
413
+ deposit: false,
414
+ items: false,
415
+ money: false,
416
+ },
417
+ },
418
+ else: false,
419
+ },
420
+ {
421
+ if: { required: ['invoiceId'] },
422
+ then: {
423
+ properties: {
424
+ transactionId: false,
425
+ deposit: false,
426
+ items: false,
427
+ money: false,
428
+ },
429
+ },
430
+ else: false,
431
+ },
432
+ {
433
+ if: { required: ['deposit'] },
434
+ then: {
435
+ properties: {
436
+ invoiceId: false,
437
+ transactionId: false,
438
+ items: false,
439
+ money: false,
440
+ },
441
+ },
442
+ else: false,
443
+ },
444
+ {
445
+ required: ['jwt'],
362
446
  },
363
- liveUrl: {type: 'string'},
364
- sandboxUrl: {type: 'string'},
365
- framePayScriptLink: {type: 'string'},
366
- framePayStyleLink: {type: 'string'},
367
- },
368
- }
369
- },
370
- required: ['apiMode'],
371
- dependentRequired: {
372
- invoiceId: ['jwt'],
373
- transactionId: ['jwt'],
374
- deposit: ['jwt'],
375
- },
376
- anyOf: [
377
- {
378
- if: {required: ['items']},
379
- then: {
380
- properties: {
381
- transactionId: false,
382
- invoiceId: false,
383
- deposit: false,
384
- money: false,
385
- }
386
- },
387
- else: false
388
- }, {
389
- if: {required: ['money']},
390
- then: {
391
- properties: {
392
- transactionId: false,
393
- invoiceId: false,
394
- deposit: false,
395
- items: false,
396
- }
397
- },
398
- else: false
399
- }, {
400
- if: {required: ['transactionId']},
401
- then: {
402
- properties: {
403
- invoiceId: false,
404
- deposit: false,
405
- items: false,
406
- money: false,
407
- }
408
- },
409
- else: false
410
- },{
411
- if: {required: ['invoiceId']},
412
- then: {
413
- properties: {
414
- transactionId: false,
415
- deposit: false,
416
- items: false,
417
- money: false,
418
- }
419
- },
420
- else: false
421
- }, {
422
- if: {required: ['deposit']},
423
- then: {
424
- properties: {
425
- invoiceId: false,
426
- transactionId: false,
427
- items: false,
428
- money: false,
429
- }
430
- },
431
- else: false
432
- }, {
433
- required: ['jwt']
434
- }
435
- ]
436
- }
447
+ ],
448
+ };