glib-web 0.5.77 → 0.5.78

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 (130) hide show
  1. package/README.md +0 -0
  2. package/action.js +167 -167
  3. package/actions/analytics/logEvent.js +0 -0
  4. package/actions/cables/push.js +0 -0
  5. package/actions/dialogs/notification.js +0 -0
  6. package/actions/http/patch.js +0 -0
  7. package/actions/panels/scrollTo.js +18 -18
  8. package/actions/panels/scrollToBottom.js +0 -0
  9. package/actions/timeouts/set.js +20 -20
  10. package/actions/windows/close.js +0 -0
  11. package/actions/windows/closeAll.js +0 -0
  12. package/actions/windows/closeWithReload.js +0 -0
  13. package/actions/windows/refreshState.js +5 -5
  14. package/actions/windows/reload.js +0 -0
  15. package/actions/ws/push.js +0 -0
  16. package/app.vue +180 -180
  17. package/components/_button.vue +101 -101
  18. package/components/_dropdownMenu.vue +76 -76
  19. package/components/_icon.vue +50 -50
  20. package/components/avatar.vue +16 -16
  21. package/components/banners/alert.vue +0 -0
  22. package/components/banners/select.vue +82 -82
  23. package/components/component.vue +222 -222
  24. package/components/fields/_patternText.vue +61 -61
  25. package/components/fields/_select.vue +86 -86
  26. package/components/fields/autocomplete.vue +73 -73
  27. package/components/fields/check.vue +104 -104
  28. package/components/fields/creditCard.vue +0 -0
  29. package/components/fields/dynamicGroup.vue +0 -0
  30. package/components/fields/hidden.vue +0 -0
  31. package/components/fields/location.vue +0 -0
  32. package/components/fields/newRichText.vue +0 -0
  33. package/components/fields/phone/countries.js +315 -315
  34. package/components/fields/phone/field.vue +348 -348
  35. package/components/fields/phone/sprite.css +1071 -1071
  36. package/components/fields/radio.vue +64 -64
  37. package/components/fields/radioGroup.vue +0 -0
  38. package/components/fields/rating.vue +0 -0
  39. package/components/fields/richText.vue +0 -0
  40. package/components/fields/select.vue +17 -17
  41. package/components/fields/stripe/stripeFields.vue +93 -93
  42. package/components/fields/stripe/stripeIndividualFields.vue +207 -207
  43. package/components/fields/stripeExternalAccount.vue +135 -135
  44. package/components/fields/text.vue +0 -0
  45. package/components/fields/textarea.vue +0 -0
  46. package/components/fields/timeZone.vue +22 -22
  47. package/components/fields/timer.vue +83 -83
  48. package/components/h1.vue +28 -28
  49. package/components/h2.vue +20 -20
  50. package/components/h3.vue +22 -22
  51. package/components/h4.vue +20 -20
  52. package/components/h5.vue +20 -20
  53. package/components/h6.vue +20 -20
  54. package/components/icon.vue +25 -25
  55. package/components/label.vue +62 -62
  56. package/components/map.vue +0 -0
  57. package/components/mixins/events.js +178 -178
  58. package/components/mixins/generic.js +0 -0
  59. package/components/mixins/list/autoload.js +0 -0
  60. package/components/mixins/styles.js +221 -221
  61. package/components/mixins/table/autoload.js +0 -0
  62. package/components/mixins/text.js +20 -20
  63. package/components/mixins/ws/actionCable.js +48 -48
  64. package/components/mixins/ws/phoenixSocket.js +0 -0
  65. package/components/panels/carousel.vue +55 -55
  66. package/components/panels/flow.vue +81 -81
  67. package/components/panels/form.vue +126 -126
  68. package/components/panels/list.vue +0 -0
  69. package/components/panels/scroll.vue +0 -0
  70. package/components/panels/table.vue +0 -0
  71. package/components/panels/ul.vue +34 -34
  72. package/components/panels/vertical.vue +0 -0
  73. package/components/panels/web.vue +11 -11
  74. package/components/spacer.vue +0 -0
  75. package/components/switch.vue +42 -42
  76. package/extensions/string.js +21 -21
  77. package/index.js +195 -195
  78. package/nav/content.vue +0 -0
  79. package/nav/dialog.vue +127 -127
  80. package/nav/snackbar.vue +0 -0
  81. package/package.json +42 -42
  82. package/static/plugins/alignment/alignment.js +0 -0
  83. package/static/plugins/alignment/alignment.min.js +0 -0
  84. package/static/plugins/beyondgrammar/beyondgrammar.js +0 -0
  85. package/static/plugins/beyondgrammar/beyondgrammar.min.js +0 -0
  86. package/static/plugins/blockcode/blockcode.js +0 -0
  87. package/static/plugins/blockcode/blockcode.min.js +0 -0
  88. package/static/plugins/clips/clips.js +0 -0
  89. package/static/plugins/clips/clips.min.js +0 -0
  90. package/static/plugins/counter/counter.js +0 -0
  91. package/static/plugins/counter/counter.min.js +0 -0
  92. package/static/plugins/definedlinks/definedlinks.js +0 -0
  93. package/static/plugins/definedlinks/definedlinks.min.js +0 -0
  94. package/static/plugins/handle/handle.js +0 -0
  95. package/static/plugins/handle/handle.min.js +0 -0
  96. package/static/plugins/icons/icons.js +0 -0
  97. package/static/plugins/icons/icons.min.js +0 -0
  98. package/static/plugins/imageposition/imageposition.js +0 -0
  99. package/static/plugins/imageposition/imageposition.min.js +0 -0
  100. package/static/plugins/inlineformat/inlineformat.js +0 -0
  101. package/static/plugins/inlineformat/inlineformat.min.js +0 -0
  102. package/static/plugins/removeformat/removeformat.js +0 -0
  103. package/static/plugins/removeformat/removeformat.min.js +0 -0
  104. package/static/plugins/selector/selector.js +0 -0
  105. package/static/plugins/selector/selector.min.js +0 -0
  106. package/static/plugins/specialchars/specialchars.js +0 -0
  107. package/static/plugins/specialchars/specialchars.min.js +0 -0
  108. package/static/plugins/textdirection/textdirection.js +0 -0
  109. package/static/plugins/textdirection/textdirection.min.js +0 -0
  110. package/static/plugins/textexpander/textexpander.js +0 -0
  111. package/static/plugins/textexpander/textexpander.min.js +0 -0
  112. package/static/plugins/underline/underline.js +0 -0
  113. package/static/plugins/underline/underline.min.js +0 -0
  114. package/static/redactorx.css +0 -0
  115. package/static/redactorx.js +0 -0
  116. package/static/redactorx.min.css +0 -0
  117. package/static/redactorx.min.js +0 -0
  118. package/static/redactorx.usm.min.js +0 -0
  119. package/templates/_menu.vue +38 -38
  120. package/templates/comment.vue +202 -202
  121. package/templates/featured.vue +32 -32
  122. package/templates/thumbnail.vue +138 -138
  123. package/templates/unsupported.vue +12 -12
  124. package/utils/app.js +0 -0
  125. package/utils/hash.js +0 -0
  126. package/utils/helper.js +0 -0
  127. package/utils/history.js +70 -70
  128. package/utils/http.js +209 -209
  129. package/utils/launch.js +135 -135
  130. package/utils/private/ws.js +0 -0
@@ -1,207 +1,207 @@
1
- <template>
2
- <div>
3
- <div class="field">
4
- <div class="outlined">
5
- <div id="cardNumber" ref="cardNumber" class="input"></div>
6
- <label for="cardNumber">{{ spec.label || "Card Number" }}</label>
7
- <div class="baseline"></div>
8
- </div>
9
- </div>
10
- <v-row>
11
- <v-col>
12
- <div class="field">
13
- <div class="outlined">
14
- <div id="cardExpiry" ref="cardExpiry" class="input"></div>
15
- <label for="cardExpiry">Expiry Date</label>
16
- <div class="baseline"></div>
17
- </div>
18
- </div>
19
- </v-col>
20
- <v-col>
21
- <div class="field">
22
- <div class="outlined">
23
- <div id="cardCvc" ref="cardCvc" class="input"></div>
24
- <label for="cardCvc">CVC</label>
25
- <div class="baseline"></div>
26
- </div>
27
- </div>
28
- </v-col>
29
- </v-row>
30
- </div>
31
- </template>
32
-
33
- <script>
34
- export default {
35
- props: {
36
- spec: { type: Object, required: true },
37
- onComplete: {
38
- type: Function,
39
- required: true
40
- },
41
- onError: {
42
- type: Function,
43
- required: true
44
- }
45
- },
46
- data() {
47
- return {
48
- stripe: null,
49
- card: null,
50
- errorMessages: []
51
- };
52
- },
53
- watch: {
54
- "$root.vueApp.stateUpdatedAt": function(val, oldVal) {
55
- this.onComplete(this.stripe, this.card);
56
- }
57
- },
58
- methods: {
59
- $ready() {
60
- this.stripe = Stripe(this.spec.publicKey);
61
- const elements = this.stripe.elements();
62
-
63
- const style = {
64
- base: {
65
- fontSize: "16px",
66
- color: "#32325d"
67
- }
68
- };
69
-
70
- const cardNumber = elements.create("cardNumber", {
71
- showIcon: true,
72
- style
73
- });
74
- cardNumber.mount(this.$refs.cardNumber);
75
-
76
- const cardExpiry = elements.create("cardExpiry", {
77
- style
78
- });
79
- cardExpiry.mount(this.$refs.cardExpiry);
80
-
81
- const cardCvc = elements.create("cardCvc", {
82
- style
83
- });
84
- cardCvc.mount(this.$refs.cardCvc);
85
-
86
- this.card = cardNumber;
87
- this._registerEvent([cardNumber, cardExpiry, cardCvc]);
88
- },
89
- _registerEvent(elements) {
90
- elements.forEach((el, index) => {
91
- el.addEventListener("change", event => {
92
- const error = event.error;
93
- if (error) {
94
- this.errorMessages[index] = error.message;
95
- } else {
96
- this.errorMessages[index] = null;
97
- }
98
-
99
- this.onError(this.errorMessages.join(" "));
100
- if (event.complete) {
101
- this.onComplete(this.stripe, this.card);
102
- }
103
- });
104
- });
105
- }
106
- }
107
- };
108
- </script>
109
-
110
- <style lang="scss" scoped>
111
- .field {
112
- position: relative;
113
- width: 100%;
114
- height: 60px;
115
-
116
- label {
117
- font-size: 16px;
118
- font-weight: bolder;
119
- color: #000000;
120
- position: absolute;
121
- left: 0;
122
- bottom: 8px;
123
- color: rgba(0, 0, 0, 0.6);
124
- overflow: hidden;
125
- text-overflow: ellipsis;
126
- white-space: nowrap;
127
- transform-origin: 0 50%;
128
- cursor: text;
129
- pointer-events: none;
130
- }
131
-
132
- .input {
133
- position: absolute;
134
- width: 100%;
135
- left: 0;
136
- bottom: 0;
137
- padding-bottom: 7px;
138
- color: #32325d;
139
- background-color: transparent;
140
- }
141
-
142
- .baseline {
143
- position: absolute;
144
- width: 100%;
145
- }
146
-
147
- .input.StripeElement--focus + label {
148
- color: #1976d2 !important;
149
- }
150
-
151
- .input.StripeElement--invalid + label {
152
- color: #f44336 !important;
153
- }
154
-
155
- .input:hover + label + .baseline {
156
- border-color: #000000;
157
- }
158
-
159
- .input.StripeElement--focus + label + .baseline {
160
- border-color: #1976d2;
161
- border-width: 2px;
162
- }
163
-
164
- .input.StripeElement--invalid + label + .baseline {
165
- border-color: #f44336;
166
- border-width: 2px;
167
- }
168
-
169
- .individual {
170
- &:not(.outlined) {
171
- label {
172
- width: 100%;
173
- transform: scale(0.75) translateY(-25px);
174
- }
175
-
176
- .baseline {
177
- height: 1px;
178
- left: 0;
179
- bottom: 0;
180
- border-bottom: solid 1px #999999;
181
- }
182
- }
183
- }
184
-
185
- .outlined {
186
- label {
187
- transform: scale(0.75) translateY(-52px);
188
- background: white;
189
- padding: 0 5px;
190
- margin-left: 10px;
191
- z-index: 10;
192
- }
193
-
194
- .baseline {
195
- height: 60px;
196
- border: solid 1px #999999;
197
- border-radius: 4px;
198
- }
199
-
200
- .input {
201
- padding: 0 12px;
202
- transform: translateY(-20px);
203
- z-index: 8;
204
- }
205
- }
206
- }
207
- </style>
1
+ <template>
2
+ <div>
3
+ <div class="field">
4
+ <div class="outlined">
5
+ <div id="cardNumber" ref="cardNumber" class="input"></div>
6
+ <label for="cardNumber">{{ spec.label || "Card Number" }}</label>
7
+ <div class="baseline"></div>
8
+ </div>
9
+ </div>
10
+ <v-row>
11
+ <v-col>
12
+ <div class="field">
13
+ <div class="outlined">
14
+ <div id="cardExpiry" ref="cardExpiry" class="input"></div>
15
+ <label for="cardExpiry">Expiry Date</label>
16
+ <div class="baseline"></div>
17
+ </div>
18
+ </div>
19
+ </v-col>
20
+ <v-col>
21
+ <div class="field">
22
+ <div class="outlined">
23
+ <div id="cardCvc" ref="cardCvc" class="input"></div>
24
+ <label for="cardCvc">CVC</label>
25
+ <div class="baseline"></div>
26
+ </div>
27
+ </div>
28
+ </v-col>
29
+ </v-row>
30
+ </div>
31
+ </template>
32
+
33
+ <script>
34
+ export default {
35
+ props: {
36
+ spec: { type: Object, required: true },
37
+ onComplete: {
38
+ type: Function,
39
+ required: true
40
+ },
41
+ onError: {
42
+ type: Function,
43
+ required: true
44
+ }
45
+ },
46
+ data() {
47
+ return {
48
+ stripe: null,
49
+ card: null,
50
+ errorMessages: []
51
+ };
52
+ },
53
+ watch: {
54
+ "$root.vueApp.stateUpdatedAt": function(val, oldVal) {
55
+ this.onComplete(this.stripe, this.card);
56
+ }
57
+ },
58
+ methods: {
59
+ $ready() {
60
+ this.stripe = Stripe(this.spec.publicKey);
61
+ const elements = this.stripe.elements();
62
+
63
+ const style = {
64
+ base: {
65
+ fontSize: "16px",
66
+ color: "#32325d"
67
+ }
68
+ };
69
+
70
+ const cardNumber = elements.create("cardNumber", {
71
+ showIcon: true,
72
+ style
73
+ });
74
+ cardNumber.mount(this.$refs.cardNumber);
75
+
76
+ const cardExpiry = elements.create("cardExpiry", {
77
+ style
78
+ });
79
+ cardExpiry.mount(this.$refs.cardExpiry);
80
+
81
+ const cardCvc = elements.create("cardCvc", {
82
+ style
83
+ });
84
+ cardCvc.mount(this.$refs.cardCvc);
85
+
86
+ this.card = cardNumber;
87
+ this._registerEvent([cardNumber, cardExpiry, cardCvc]);
88
+ },
89
+ _registerEvent(elements) {
90
+ elements.forEach((el, index) => {
91
+ el.addEventListener("change", event => {
92
+ const error = event.error;
93
+ if (error) {
94
+ this.errorMessages[index] = error.message;
95
+ } else {
96
+ this.errorMessages[index] = null;
97
+ }
98
+
99
+ this.onError(this.errorMessages.join(" "));
100
+ if (event.complete) {
101
+ this.onComplete(this.stripe, this.card);
102
+ }
103
+ });
104
+ });
105
+ }
106
+ }
107
+ };
108
+ </script>
109
+
110
+ <style lang="scss" scoped>
111
+ .field {
112
+ position: relative;
113
+ width: 100%;
114
+ height: 60px;
115
+
116
+ label {
117
+ font-size: 16px;
118
+ font-weight: bolder;
119
+ color: #000000;
120
+ position: absolute;
121
+ left: 0;
122
+ bottom: 8px;
123
+ color: rgba(0, 0, 0, 0.6);
124
+ overflow: hidden;
125
+ text-overflow: ellipsis;
126
+ white-space: nowrap;
127
+ transform-origin: 0 50%;
128
+ cursor: text;
129
+ pointer-events: none;
130
+ }
131
+
132
+ .input {
133
+ position: absolute;
134
+ width: 100%;
135
+ left: 0;
136
+ bottom: 0;
137
+ padding-bottom: 7px;
138
+ color: #32325d;
139
+ background-color: transparent;
140
+ }
141
+
142
+ .baseline {
143
+ position: absolute;
144
+ width: 100%;
145
+ }
146
+
147
+ .input.StripeElement--focus + label {
148
+ color: #1976d2 !important;
149
+ }
150
+
151
+ .input.StripeElement--invalid + label {
152
+ color: #f44336 !important;
153
+ }
154
+
155
+ .input:hover + label + .baseline {
156
+ border-color: #000000;
157
+ }
158
+
159
+ .input.StripeElement--focus + label + .baseline {
160
+ border-color: #1976d2;
161
+ border-width: 2px;
162
+ }
163
+
164
+ .input.StripeElement--invalid + label + .baseline {
165
+ border-color: #f44336;
166
+ border-width: 2px;
167
+ }
168
+
169
+ .individual {
170
+ &:not(.outlined) {
171
+ label {
172
+ width: 100%;
173
+ transform: scale(0.75) translateY(-25px);
174
+ }
175
+
176
+ .baseline {
177
+ height: 1px;
178
+ left: 0;
179
+ bottom: 0;
180
+ border-bottom: solid 1px #999999;
181
+ }
182
+ }
183
+ }
184
+
185
+ .outlined {
186
+ label {
187
+ transform: scale(0.75) translateY(-52px);
188
+ background: white;
189
+ padding: 0 5px;
190
+ margin-left: 10px;
191
+ z-index: 10;
192
+ }
193
+
194
+ .baseline {
195
+ height: 60px;
196
+ border: solid 1px #999999;
197
+ border-radius: 4px;
198
+ }
199
+
200
+ .input {
201
+ padding: 0 12px;
202
+ transform: translateY(-20px);
203
+ z-index: 8;
204
+ }
205
+ }
206
+ }
207
+ </style>
@@ -1,135 +1,135 @@
1
- <template>
2
- <div :style="genericStyles()" :class="$classes()">
3
- <v-text-field
4
- v-model="accountNumber"
5
- label="Account Number"
6
- placeholder="000123456"
7
- :outlined="$classes().includes('outlined')"
8
- :rounded="$classes().includes('rounded')"
9
- :dense="$classes().includes('dense')"
10
- :rules="accountNumberRules"
11
- :error-messages="errorMessages"
12
- @keyup="$onTyping({ duration: 200 })"
13
- />
14
-
15
- <div v-if="spec.country">
16
- <div v-for="field in inputs[country].fields" :key="field.label">
17
- <v-text-field
18
- v-model="field.model"
19
- :label="field.label"
20
- :placeholder="field.placeholder"
21
- :outlined="$classes().includes('outlined')"
22
- :rounded="$classes().includes('rounded')"
23
- :dense="$classes().includes('dense')"
24
- :rules="field.rules"
25
- @keyup="$onTyping({ duration: 200 })"
26
- />
27
- </div>
28
- </div>
29
-
30
- <input ref="token" type="hidden" :name="spec.name" />
31
- </div>
32
- </template>
33
- <script>
34
- export default {
35
- props: {
36
- spec: { type: Object, required: true }
37
- },
38
- data() {
39
- return {
40
- routingNumber: null,
41
- accountNumber: null,
42
- inputs: {},
43
- accountNumberRules: [value => !!value || "Account number required"],
44
- errorMessages: null
45
- };
46
- },
47
- created() {
48
- this.country = this.spec.country.toLowerCase();
49
- this.stripe = Stripe(this.spec.publicKey);
50
- this.spec.onTypeEnd = { action: "component/createToken" };
51
- this.registerCountry("nz", [], function() {
52
- return "";
53
- });
54
- this.registerCountry(
55
- "au",
56
- [
57
- {
58
- label: "Bank State Number",
59
- placeholder: "110000",
60
- model: "",
61
- rules: [value => !!value || "Bank state number required"]
62
- }
63
- ],
64
- function() {
65
- return this.fields[0].model;
66
- }
67
- );
68
- this.registerCountry(
69
- "ca",
70
- [
71
- {
72
- label: "Transit",
73
- placeholder: "12345",
74
- model: "",
75
- rules: [value => !!value || "Transit number required"]
76
- },
77
- {
78
- label: "Institution",
79
- placeholder: "678",
80
- model: "",
81
- rules: [value => !!value || "Institution number required"]
82
- }
83
- ],
84
- function() {
85
- return `${this.fields[0].model}-${this.fields[1].model}`;
86
- }
87
- );
88
- },
89
- methods: {
90
- action_createToken() {
91
- const token = this.$refs.token;
92
- this.errorMessages = null;
93
- this.routingNumber = this.inputs[this.country].makeRoutingNumber();
94
- if (this.accountNumber) {
95
- this.$dispatchEvent("forms/setBusy", { value: true });
96
- const vm = this;
97
- const bank = {
98
- country: this.spec.country,
99
- currency: this.spec.currency,
100
- account_number: this.accountNumber,
101
- account_holder_name: this.spec.accountHolderName,
102
- account_holder_type: this.spec.accountHolderType
103
- };
104
-
105
- if (this.routingNumber) {
106
- bank["routing_number"] = this.routingNumber;
107
- }
108
-
109
- this.stripe.createToken("bank_account", bank).then(response => {
110
- if (response.token) {
111
- token.value = response.token.id;
112
- } else {
113
- this.errorMessages = [response.error.message];
114
- token.value = "";
115
- }
116
- vm.$dispatchEvent("forms/setBusy", { value: false });
117
- });
118
- }
119
- },
120
- /**
121
- * Different countries have different ways of creating routing numbers.
122
- * Canada, for example, requires transit numbers and institution numbers and then combined to create a routing number,
123
- * while New Zealand does not use a routing number.
124
- */
125
- registerCountry(country = "", fields = [], makeRoutingNumber) {
126
- this.inputs[country] = { fields, makeRoutingNumber };
127
- }
128
- }
129
- };
130
- </script>
131
- <style lang="scss" scoped>
132
- v-text-field {
133
- padding: 0 8px 0 8px;
134
- }
135
- </style>
1
+ <template>
2
+ <div :style="genericStyles()" :class="$classes()">
3
+ <v-text-field
4
+ v-model="accountNumber"
5
+ label="Account Number"
6
+ placeholder="000123456"
7
+ :outlined="$classes().includes('outlined')"
8
+ :rounded="$classes().includes('rounded')"
9
+ :dense="$classes().includes('dense')"
10
+ :rules="accountNumberRules"
11
+ :error-messages="errorMessages"
12
+ @keyup="$onTyping({ duration: 200 })"
13
+ />
14
+
15
+ <div v-if="spec.country">
16
+ <div v-for="field in inputs[country].fields" :key="field.label">
17
+ <v-text-field
18
+ v-model="field.model"
19
+ :label="field.label"
20
+ :placeholder="field.placeholder"
21
+ :outlined="$classes().includes('outlined')"
22
+ :rounded="$classes().includes('rounded')"
23
+ :dense="$classes().includes('dense')"
24
+ :rules="field.rules"
25
+ @keyup="$onTyping({ duration: 200 })"
26
+ />
27
+ </div>
28
+ </div>
29
+
30
+ <input ref="token" type="hidden" :name="spec.name" />
31
+ </div>
32
+ </template>
33
+ <script>
34
+ export default {
35
+ props: {
36
+ spec: { type: Object, required: true }
37
+ },
38
+ data() {
39
+ return {
40
+ routingNumber: null,
41
+ accountNumber: null,
42
+ inputs: {},
43
+ accountNumberRules: [value => !!value || "Account number required"],
44
+ errorMessages: null
45
+ };
46
+ },
47
+ created() {
48
+ this.country = this.spec.country.toLowerCase();
49
+ this.stripe = Stripe(this.spec.publicKey);
50
+ this.spec.onTypeEnd = { action: "component/createToken" };
51
+ this.registerCountry("nz", [], function() {
52
+ return "";
53
+ });
54
+ this.registerCountry(
55
+ "au",
56
+ [
57
+ {
58
+ label: "Bank State Number",
59
+ placeholder: "110000",
60
+ model: "",
61
+ rules: [value => !!value || "Bank state number required"]
62
+ }
63
+ ],
64
+ function() {
65
+ return this.fields[0].model;
66
+ }
67
+ );
68
+ this.registerCountry(
69
+ "ca",
70
+ [
71
+ {
72
+ label: "Transit",
73
+ placeholder: "12345",
74
+ model: "",
75
+ rules: [value => !!value || "Transit number required"]
76
+ },
77
+ {
78
+ label: "Institution",
79
+ placeholder: "678",
80
+ model: "",
81
+ rules: [value => !!value || "Institution number required"]
82
+ }
83
+ ],
84
+ function() {
85
+ return `${this.fields[0].model}-${this.fields[1].model}`;
86
+ }
87
+ );
88
+ },
89
+ methods: {
90
+ action_createToken() {
91
+ const token = this.$refs.token;
92
+ this.errorMessages = null;
93
+ this.routingNumber = this.inputs[this.country].makeRoutingNumber();
94
+ if (this.accountNumber) {
95
+ this.$dispatchEvent("forms/setBusy", { value: true });
96
+ const vm = this;
97
+ const bank = {
98
+ country: this.spec.country,
99
+ currency: this.spec.currency,
100
+ account_number: this.accountNumber,
101
+ account_holder_name: this.spec.accountHolderName,
102
+ account_holder_type: this.spec.accountHolderType
103
+ };
104
+
105
+ if (this.routingNumber) {
106
+ bank["routing_number"] = this.routingNumber;
107
+ }
108
+
109
+ this.stripe.createToken("bank_account", bank).then(response => {
110
+ if (response.token) {
111
+ token.value = response.token.id;
112
+ } else {
113
+ this.errorMessages = [response.error.message];
114
+ token.value = "";
115
+ }
116
+ vm.$dispatchEvent("forms/setBusy", { value: false });
117
+ });
118
+ }
119
+ },
120
+ /**
121
+ * Different countries have different ways of creating routing numbers.
122
+ * Canada, for example, requires transit numbers and institution numbers and then combined to create a routing number,
123
+ * while New Zealand does not use a routing number.
124
+ */
125
+ registerCountry(country = "", fields = [], makeRoutingNumber) {
126
+ this.inputs[country] = { fields, makeRoutingNumber };
127
+ }
128
+ }
129
+ };
130
+ </script>
131
+ <style lang="scss" scoped>
132
+ v-text-field {
133
+ padding: 0 8px 0 8px;
134
+ }
135
+ </style>
File without changes