@shipengine/elements 0.15.0 → 0.16.1

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 (207) hide show
  1. package/components/add-funds-form/add-funds-form.d.ts +22 -0
  2. package/components/add-funds-form/add-funds-form.styles.d.ts +6 -0
  3. package/components/add-funds-form/add-funds-schema.d.ts +37 -0
  4. package/components/add-funds-form/index.d.ts +2 -0
  5. package/components/auto-funding-form/auto-funding-form.d.ts +8 -0
  6. package/components/auto-funding-form/auto-funding-form.styles.d.ts +1 -0
  7. package/components/{organisms/auto-funding-form → auto-funding-form}/auto-funding-schema.d.ts +10 -10
  8. package/components/auto-funding-form/index.d.ts +2 -0
  9. package/components/carrier-balance/carrier-balance.d.ts +4 -0
  10. package/components/carrier-balance/carrier-balance.styles.d.ts +1 -0
  11. package/components/carrier-balance/index.d.ts +1 -0
  12. package/components/field/create-field-controller.d.ts +4 -1
  13. package/components/field/credit-card-input/credit-card-input.d.ts +3 -0
  14. package/components/field/credit-card-input/index.d.ts +1 -0
  15. package/components/field/fields.d.ts +1 -0
  16. package/components/field/money-input/hooks/use-utils.d.ts +1 -1
  17. package/components/field/money-input/money-input.d.ts +1 -1
  18. package/components/field/rate-card/cost-breakdown/cost-breakdown.d.ts +1 -1
  19. package/components/form-portal/form-portal.d.ts +18 -0
  20. package/components/form-portal/index.d.ts +1 -0
  21. package/components/fund-and-purchase/fund-and-purchase.d.ts +15 -0
  22. package/components/fund-and-purchase/fund-and-purchase.styles.d.ts +1 -0
  23. package/components/fund-and-purchase/index.d.ts +1 -0
  24. package/components/index.d.ts +10 -0
  25. package/components/inline-label/index.d.ts +1 -0
  26. package/components/inline-label/inline-label.d.ts +6 -0
  27. package/components/items-breakdown/items-breakdown.d.ts +1 -1
  28. package/components/link-action/index.d.ts +1 -0
  29. package/components/link-action/link-action.d.ts +12 -0
  30. package/components/manage-funding/manage-funding.d.ts +4 -0
  31. package/components/portal/portal.d.ts +1 -1
  32. package/components/settings-card/settings-card.d.ts +6 -1
  33. package/components/settings-card/settings-card.styles.d.ts +1 -6
  34. package/components/spread/index.d.ts +1 -0
  35. package/components/spread/spread.d.ts +5 -0
  36. package/components/story-notes/index.d.ts +1 -0
  37. package/components/story-notes/story-notes.d.ts +11 -0
  38. package/components/templates/{billing-form/billing-schema.d.ts → add-carrier-form/add-carrier-form-schema.d.ts} +38 -109
  39. package/components/templates/add-carrier-form/add-carrier-form-test.d.ts +1 -0
  40. package/components/templates/add-carrier-form/add-carrier-form.d.ts +10 -0
  41. package/components/templates/add-carrier-form/index.d.ts +2 -0
  42. package/components/templates/address-display/address-display.d.ts +1 -1
  43. package/components/templates/address-form/address-fields.d.ts +2 -1
  44. package/components/templates/address-form/address-form-schema.d.ts +0 -9
  45. package/components/templates/address-form/address-form.d.ts +2 -2
  46. package/components/templates/address-form/address-schema.d.ts +2 -3
  47. package/components/templates/address-preference-display/address-preference-display.d.ts +1 -1
  48. package/components/templates/carrier-recovery-form/carrier-recovery-form-schema.d.ts +238 -0
  49. package/components/templates/carrier-recovery-form/carrier-recovery-form.d.ts +10 -0
  50. package/components/templates/carrier-recovery-form/carrier-recovery-form.styles.d.ts +1 -0
  51. package/components/templates/carrier-recovery-form/index.d.ts +2 -0
  52. package/components/templates/carrier-terms-form/carrier-terms-form-schema.d.ts +10 -0
  53. package/components/templates/carrier-terms-form/carrier-terms-form.d.ts +6 -0
  54. package/components/templates/carrier-terms-form/carrier-terms-form.styles.d.ts +1 -0
  55. package/components/templates/carrier-terms-form/index.d.ts +1 -0
  56. package/components/templates/customs-item-form/customs-item-form-schema.d.ts +112 -12
  57. package/components/templates/customs-item-form/customs-item-form.d.ts +3 -2
  58. package/components/templates/customs-items-display/customs-items-display.d.ts +1 -1
  59. package/components/templates/display-carrier-terms/display-carrier-terms.d.ts +6 -0
  60. package/components/templates/display-carrier-terms/index.d.ts +1 -0
  61. package/components/templates/edit-billing-form/edit-billing-form.d.ts +6 -0
  62. package/components/templates/edit-billing-form/edit-billing-form.styles.d.ts +1 -0
  63. package/components/templates/edit-billing-form/index.d.ts +1 -0
  64. package/components/templates/index.d.ts +8 -4
  65. package/components/templates/label/label.d.ts +2 -2
  66. package/components/templates/landing-page/index.d.ts +1 -0
  67. package/components/templates/landing-page/landing-page-form-schema.d.ts +10 -0
  68. package/components/templates/landing-page/landing-page-form.d.ts +4 -0
  69. package/components/templates/landing-page/landing-page.d.ts +4 -0
  70. package/components/templates/landing-page/landing-page.styles.d.ts +1 -0
  71. package/components/templates/list-carriers/index.d.ts +1 -0
  72. package/components/templates/list-carriers/list-carriers.d.ts +9 -0
  73. package/components/templates/list-carriers/list-carriers.styles.d.ts +1 -0
  74. package/components/templates/list-carriers-row/index.d.ts +1 -0
  75. package/components/templates/list-carriers-row/list-carriers-row.d.ts +9 -0
  76. package/components/templates/list-carriers-row/list-carriers-row.styles.d.ts +1 -0
  77. package/components/templates/manage-wallet/index.d.ts +1 -0
  78. package/components/templates/manage-wallet/manage-wallet.d.ts +1 -0
  79. package/components/templates/manage-wallet/manage-wallet.styles.d.ts +1 -0
  80. package/components/templates/manage-warehouses/manage-warehouses.d.ts +7 -2
  81. package/components/templates/onboarding/index.d.ts +1 -0
  82. package/components/templates/onboarding/onboarding.d.ts +18 -0
  83. package/components/templates/onboarding/onboarding.styles.d.ts +1 -0
  84. package/components/templates/rate-form/rate-form.d.ts +2 -2
  85. package/components/templates/rate-form/rate-form.styles.d.ts +1 -0
  86. package/components/templates/sales-order/sales-order.d.ts +1 -1
  87. package/components/templates/shipment/shipment.d.ts +1 -1
  88. package/components/templates/shipment-form/shipment-form.d.ts +3 -3
  89. package/components/templates/shipment-form/shipment-schema.d.ts +11 -11
  90. package/components/templates/void-label/void-label.d.ts +1 -1
  91. package/components/templates/wallet-card/index.d.ts +1 -0
  92. package/components/templates/wallet-card/wallet-card.d.ts +4 -0
  93. package/components/templates/wallet-card/wallet-card.styles.d.ts +1 -0
  94. package/components/templates/wallet-form/billing-fields.d.ts +6 -0
  95. package/components/templates/wallet-form/edit-wallet-address-form.d.ts +16 -0
  96. package/components/templates/wallet-form/index.d.ts +4 -0
  97. package/components/templates/wallet-form/wallet-form.d.ts +11 -0
  98. package/components/templates/wallet-form/wallet-form.styles.d.ts +1 -0
  99. package/components/templates/wallet-form/wallet-schema.d.ts +269 -0
  100. package/components/templates/warehouse-display/warehouse-display.d.ts +1 -1
  101. package/components/templates/warehouse-form/index.d.ts +1 -0
  102. package/components/templates/warehouse-form/warehouse-form-schema.d.ts +503 -0
  103. package/components/templates/warehouse-form/warehouse-form.d.ts +10 -0
  104. package/components/templates/warehouse-form/warehouse-form.styles.d.ts +1 -0
  105. package/constants/shipengine/address.d.ts +4 -0
  106. package/elements/components/configure-shipment/configure-shipment.d.ts +1 -1
  107. package/elements/components/configure-shipment/hooks/use-address.d.ts +3 -3
  108. package/elements/components/configure-shipment/hooks/use-customs.d.ts +3 -3
  109. package/elements/components/configure-shipment/hooks/use-presets.d.ts +2 -2
  110. package/elements/components/configure-shipment/hooks/use-rates-form.d.ts +1 -1
  111. package/elements/components/configure-shipment/hooks/use-request-rates.d.ts +2 -2
  112. package/elements/components/configure-shipment/hooks/use-shipment-form.d.ts +6 -6
  113. package/elements/components/index.d.ts +2 -3
  114. package/elements/components/list-carriers/hooks/use-list-connected-carriers.d.ts +11 -0
  115. package/elements/components/list-carriers/index.d.ts +1 -0
  116. package/elements/components/list-carriers/list-carriers.d.ts +1 -0
  117. package/elements/components/onboarding/index.d.ts +1 -0
  118. package/elements/components/onboarding/onboarding.d.ts +4 -0
  119. package/elements/components/sales-order/hooks/use-configure-shipment.d.ts +3 -1
  120. package/elements/components/sales-order/hooks/use-import-sales-order.d.ts +2 -2
  121. package/elements/components/sales-order/hooks/use-pending-shipment.d.ts +1 -1
  122. package/elements/components/sales-order/sales-order.d.ts +1 -1
  123. package/elements/components/shipment/shipment.d.ts +1 -1
  124. package/elements/components/void-label/void-label.d.ts +1 -1
  125. package/elements/index.d.ts +2 -3
  126. package/elements/onboarding.d.ts +1 -0
  127. package/factories/shipengine/address.d.ts +1 -1
  128. package/factories/shipengine/carrier.d.ts +1 -1
  129. package/factories/shipengine/label.d.ts +1 -1
  130. package/factories/shipengine/money.d.ts +1 -1
  131. package/factories/shipengine/order-source.d.ts +10 -2
  132. package/factories/shipengine/package.d.ts +2 -2
  133. package/factories/shipengine/resource.d.ts +1 -1
  134. package/factories/shipengine/sales-order.d.ts +1 -1
  135. package/factories/shipengine/service.d.ts +2 -2
  136. package/factories/shipengine/shipment.d.ts +4 -4
  137. package/factories/shipengine/warehouse.d.ts +1 -1
  138. package/factories/shipengine/weight.d.ts +1 -1
  139. package/hooks/index.d.ts +1 -0
  140. package/hooks/options/use-confirmation-options.d.ts +1 -1
  141. package/hooks/options/use-customs-contents-options.d.ts +1 -1
  142. package/hooks/options/use-customs-non-delivery-options.d.ts +1 -1
  143. package/hooks/options/use-insurance-provider-options.d.ts +2 -2
  144. package/hooks/options/use-package-options.d.ts +2 -2
  145. package/hooks/options/use-rate-options.d.ts +1 -1
  146. package/hooks/options/use-service-code-options.d.ts +1 -1
  147. package/hooks/options/use-warehouse-options.d.ts +1 -1
  148. package/hooks/use-carrier-metadata.d.ts +2 -5
  149. package/hooks/use-nested-form.d.ts +2 -2
  150. package/hooks/use-toggle.d.ts +12 -0
  151. package/index.cjs +20093 -17773
  152. package/index.js +20769 -18460
  153. package/locales/en/index.d.ts +122 -6
  154. package/mocks/browser.d.ts +1 -0
  155. package/mocks/carriers/handlers.d.ts +12 -0
  156. package/mocks/carriers/index.d.ts +1 -0
  157. package/mocks/index.d.ts +2 -0
  158. package/mocks/server.d.ts +2 -0
  159. package/mocks/warehouses/handlers.d.ts +1 -0
  160. package/mocks/warehouses/index.d.ts +1 -0
  161. package/package.json +10 -7
  162. package/register.d.ts +1 -4
  163. package/schemas/shipengine/index.d.ts +0 -1
  164. package/schemas/shipengine/money.d.ts +1 -1
  165. package/testing/index.d.ts +0 -1
  166. package/testing/render.d.ts +5 -0
  167. package/types/carrier-metadata.d.ts +10 -5
  168. package/types/shipping-preset/shipping-preset.d.ts +2 -2
  169. package/utilities/date.d.ts +13 -1
  170. package/utilities/money.d.ts +2 -1
  171. package/utilities/rates.d.ts +2 -2
  172. package/utilities/shipengine/address.d.ts +1 -1
  173. package/utilities/shipengine/dimensions.d.ts +1 -1
  174. package/utilities/shipengine/sales-order.d.ts +1 -1
  175. package/utilities/shipengine/shipment.d.ts +1 -1
  176. package/utilities/shipengine/weight.d.ts +1 -1
  177. package/components/organisms/auto-funding-form/auto-funding-form.d.ts +0 -15
  178. package/components/organisms/auto-funding-form/index.d.ts +0 -1
  179. package/components/organisms/index.d.ts +0 -2
  180. package/components/organisms/manual-funding-form/index.d.ts +0 -2
  181. package/components/organisms/manual-funding-form/manual-funding-form.d.ts +0 -17
  182. package/components/organisms/manual-funding-form/manual-funding-schema.d.ts +0 -27
  183. package/components/templates/add-carriers/add-carriers.d.ts +0 -5
  184. package/components/templates/add-carriers/index.d.ts +0 -1
  185. package/components/templates/agreement-form/agreement-form-schema.d.ts +0 -10
  186. package/components/templates/agreement-form/agreement-form.d.ts +0 -8
  187. package/components/templates/agreement-form/agreement-form.styles.d.ts +0 -1
  188. package/components/templates/agreement-form/index.d.ts +0 -1
  189. package/components/templates/billing-form/billing-form-stories.d.ts +0 -6
  190. package/components/templates/billing-form/billing-form.d.ts +0 -9
  191. package/components/templates/billing-form/index.d.ts +0 -2
  192. package/components/templates/funding-methods/funding-methods.d.ts +0 -17
  193. package/components/templates/funding-methods/index.d.ts +0 -1
  194. package/components/templates/register-wallet/index.d.ts +0 -1
  195. package/components/templates/register-wallet/register-wallet.d.ts +0 -3
  196. package/components/templates/register-wallet/register-wallet.styles.d.ts +0 -6
  197. package/elements/add-carriers.d.ts +0 -1
  198. package/elements/components/add-carriers/add-carriers.d.ts +0 -8
  199. package/elements/components/add-carriers/index.d.ts +0 -1
  200. package/elements/components/manage-funding/manage-funding.d.ts +0 -2
  201. package/elements/components/register-wallet/index.d.ts +0 -1
  202. package/elements/components/register-wallet/register-wallet.d.ts +0 -9
  203. package/elements/register-wallet.d.ts +0 -1
  204. package/schemas/shipengine/address.d.ts +0 -17
  205. package/testing/swr.d.ts +0 -15
  206. /package/{elements/components → components}/manage-funding/index.d.ts +0 -0
  207. /package/elements/{manage-funding.d.ts → list-carriers.d.ts} +0 -0
@@ -50,11 +50,10 @@ declare const _default: {
50
50
  };
51
51
  };
52
52
  "register-wallet": {
53
- agreeToTerms: string;
54
53
  sections: {
55
54
  setup: {
56
55
  title: string;
57
- subTitle: string;
56
+ subtitle: string;
58
57
  descriptionTitle: string;
59
58
  description: string;
60
59
  };
@@ -62,8 +61,42 @@ declare const _default: {
62
61
  title: string;
63
62
  cardSubTitle: string;
64
63
  addressSubTitle: string;
64
+ info: string;
65
+ };
66
+ carriers: {
67
+ title: string;
68
+ subtitle: string;
69
+ };
70
+ notifications: {
71
+ error: {
72
+ title: string;
73
+ };
74
+ info: {
75
+ title: string;
76
+ description: string;
77
+ };
78
+ poBox: {
79
+ title: string;
80
+ description: string;
81
+ };
82
+ carrier: {
83
+ title: string;
84
+ confirmAddress: string;
85
+ description: string;
86
+ };
65
87
  };
66
88
  };
89
+ settings: {
90
+ title: string;
91
+ billing: {
92
+ title: string;
93
+ subtitle: string;
94
+ };
95
+ };
96
+ };
97
+ "register-carrier": {
98
+ formTitle: string;
99
+ agreeToTerms: string;
67
100
  };
68
101
  "purchase-label": {
69
102
  actions: {
@@ -149,13 +182,53 @@ declare const _default: {
149
182
  rate_other: string;
150
183
  };
151
184
  };
185
+ onboarding: {
186
+ inlineTitle: string;
187
+ landing: {
188
+ action: string;
189
+ title: string;
190
+ subtitle: string;
191
+ descriptionTitle: string;
192
+ description: string;
193
+ };
194
+ steps: {
195
+ login: string;
196
+ carriers: string;
197
+ addresses: string;
198
+ payment: string;
199
+ };
200
+ warehouse: {
201
+ title: string;
202
+ subtitle: string;
203
+ inlineMessage: string;
204
+ };
205
+ success: {
206
+ title: string;
207
+ subtitle: string;
208
+ action: string;
209
+ };
210
+ };
152
211
  "manage-warehouses": {
212
+ addNew: string;
213
+ contactName: string;
214
+ default: string;
215
+ isDefault: string;
216
+ locationName: string;
217
+ residentialAddress: string;
153
218
  returnTo: string;
219
+ returnToAddressIsDifferent: string;
220
+ setDefault: string;
154
221
  shipFrom: string;
155
222
  };
156
223
  "manage-funding": {
157
- addFunds: string;
224
+ actions: {
225
+ addFunds: string;
226
+ addFundsAndPurchase: string;
227
+ addNow: string;
228
+ saveRule: string;
229
+ };
158
230
  autoFunding: {
231
+ addFundsAutomatically: string;
159
232
  error: {
160
233
  title: string;
161
234
  message: string;
@@ -166,7 +239,8 @@ declare const _default: {
166
239
  maximumPurchasesPerDay: string;
167
240
  purchaseAmount: string;
168
241
  };
169
- otp: {
242
+ addFunds: {
243
+ custom: string;
170
244
  error: {
171
245
  title: string;
172
246
  message: string;
@@ -174,17 +248,43 @@ declare const _default: {
174
248
  isLoading: string;
175
249
  labels: {
176
250
  amount: string;
177
- currentBalance: string;
178
- resultingBalance: string;
179
251
  };
180
252
  minimumPurchaseAmount: string;
181
253
  };
254
+ fundAndPurchase: {
255
+ finalBalance: string;
256
+ insufficientFunds: string;
257
+ insufficientFundsTitle: string;
258
+ negativeBalance: string;
259
+ negativeBalanceTitle: string;
260
+ newBalance: string;
261
+ };
262
+ errors: {
263
+ balanceUnknown: string;
264
+ unableToFindBalance: string;
265
+ };
266
+ currentBalance: string;
182
267
  maximumBalanceAmount: string;
183
268
  };
269
+ "list-carriers": {
270
+ headers: {
271
+ accountCarriers: string;
272
+ carriers: string;
273
+ settings: string;
274
+ };
275
+ actions: {
276
+ status: {
277
+ connected: string;
278
+ notConnected: string;
279
+ };
280
+ };
281
+ };
184
282
  common: {
185
283
  actions: {
186
284
  add: string;
187
285
  cancel: string;
286
+ close: string;
287
+ confirm: string;
188
288
  continue: string;
189
289
  delete: string;
190
290
  edit: string;
@@ -195,6 +295,7 @@ declare const _default: {
195
295
  save: string;
196
296
  skipForNow: string;
197
297
  submit: string;
298
+ tryAgain: string;
198
299
  };
199
300
  address: {
200
301
  fields: {
@@ -208,6 +309,7 @@ declare const _default: {
208
309
  postalCode: string;
209
310
  phone: string;
210
311
  email: string;
312
+ addressResidentialIndicator: string;
211
313
  };
212
314
  subFields: {
213
315
  optional: string;
@@ -234,6 +336,7 @@ declare const _default: {
234
336
  };
235
337
  billing: {
236
338
  fields: {
339
+ differentBillingAddress: string;
237
340
  name: string;
238
341
  cardNumber: string;
239
342
  expirationMonth: string;
@@ -245,6 +348,10 @@ declare const _default: {
245
348
  fields: {
246
349
  agreement: string;
247
350
  };
351
+ terms: {
352
+ agreeToTerms: string;
353
+ title: string;
354
+ };
248
355
  };
249
356
  charsetWarnings: {
250
357
  name: {
@@ -297,12 +404,14 @@ declare const _default: {
297
404
  invalidNameOrCompany: string;
298
405
  noWarehouses: string;
299
406
  unableToLoad: {
407
+ carrier: string;
300
408
  carriers: string;
301
409
  salesOrder: string;
302
410
  shipment: string;
303
411
  warehouses: string;
304
412
  };
305
413
  unknown: string;
414
+ noRatesAvailable: string;
306
415
  };
307
416
  errorTypes: {
308
417
  accountStatus: string;
@@ -322,6 +431,7 @@ declare const _default: {
322
431
  thirdParty: string;
323
432
  };
324
433
  loading: {
434
+ carrier: string;
325
435
  carriers: string;
326
436
  data: string;
327
437
  importingSalesOrder: string;
@@ -350,13 +460,18 @@ declare const _default: {
350
460
  packageCodes: {
351
461
  package: string;
352
462
  };
463
+ schema: {
464
+ optionalLabel: string;
465
+ };
353
466
  schemaErrors: {
354
467
  notAValidPhoneNumber: string;
468
+ mustAgreeToTerms: string;
355
469
  group: {
356
470
  allMeasurementsOrNone: string;
357
471
  };
358
472
  invalidAddressName: string;
359
473
  invalidAddressPoBox: string;
474
+ invalidCreditCardType: string;
360
475
  invalidPostalCode: string;
361
476
  invalidStateProvince: string;
362
477
  invalidString: string;
@@ -388,6 +503,7 @@ declare const _default: {
388
503
  "VGhlIHNlbGVjdGVkIHNlcnZpY2UgaW5jbHVkZXMgaW5zdXJhbmNlIGZvciBhbiBpbnN1cmVkIGFtb3VudCB1cCB0byAkNTAuCg==": string;
389
504
  QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBJbnN1ZmZpY2llbnQgYWNjb3VudCBiYWxhbmNlLiBBY2NvdW50IGV4Y2VwdGlvbiBFeGNlcHRpb24gd2l0aCBjb2RlIDB4MDA1NjAxMDE7IG1vZHVsZSA4NiwgY2F0ZWdvcnkgMSwgaXRlbSAx: string;
390
505
  "QWRkcmVzcyBub3QgZm91bmQ=": string;
506
+ QSBzaGlwcGluZyBjYXJyaWVyIGVycm9yIG9jY3VycmVkOiBVUFMgd2VpZ2h0IGxpbWl0IHBlciBwYWNrYWdlIGlzIDE1MCBsYnMu: string;
391
507
  };
392
508
  };
393
509
  export default _default;
@@ -0,0 +1 @@
1
+ export declare const worker: false | import("msw").SetupWorkerApi;
@@ -0,0 +1,12 @@
1
+ import { DeepPartial } from "fishery";
2
+ import { SE } from "@shipengine/api";
3
+ export type CreateCarrierHandlersParams = {
4
+ get?: DeepPartial<SE.Carrier>;
5
+ list?: [count: number, listParams?: DeepPartial<SE.Carrier>];
6
+ };
7
+ export declare const createCarrierHandlers: (params?: CreateCarrierHandlersParams) => {
8
+ database: {
9
+ balanceAmount: number;
10
+ };
11
+ handlers: import("msw").RestHandler<import("msw/lib/glossary-de6278a9").M<import("msw/lib/glossary-de6278a9").h>>[];
12
+ };
@@ -0,0 +1 @@
1
+ export * from "./handlers";
@@ -0,0 +1,2 @@
1
+ export * from "./carriers";
2
+ export * from "./warehouses";
@@ -0,0 +1,2 @@
1
+ declare const _default: import("msw/lib/SetupServerApi-39df862c").S;
2
+ export default _default;
@@ -0,0 +1 @@
1
+ export declare const warehouseHandlers: import("msw").RestHandler<import("msw/lib/glossary-de6278a9").M<import("msw/lib/glossary-de6278a9").h>>[];
@@ -0,0 +1 @@
1
+ export * from "./handlers";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shipengine/elements",
3
- "version": "0.15.0",
3
+ "version": "0.16.1",
4
4
  "typedoc": {
5
5
  "entryPoint": "./src/index.ts",
6
6
  "readmeFile": "../../README.md",
@@ -11,6 +11,9 @@
11
11
  "react-i18next": "*",
12
12
  "i18next": "*"
13
13
  },
14
+ "msw": {
15
+ "workerDirectory": "public"
16
+ },
14
17
  "module": "./index.js",
15
18
  "main": "./index.cjs",
16
19
  "type": "module",
@@ -19,21 +22,21 @@
19
22
  "react": "^18.2.0",
20
23
  "@emotion/react": "^11.10.0",
21
24
  "@packlink/brands": "^3.18.0",
22
- "@shipengine/react": "0.15.0",
23
25
  "react-hook-form": "^7.31.2",
26
+ "@shipengine/api": "0.16.1",
27
+ "@shipengine/react": "0.16.1",
28
+ "zod": "^3.17.3",
24
29
  "@emotion/css": "^11.10.5",
25
30
  "humps": "^2.0.1",
26
31
  "react-datepicker": "^4.8.0",
27
- "@shipengine/types": "0.15.0",
28
- "zod": "^3.17.3",
32
+ "react-query": "^3.39.3",
29
33
  "react-dom": "^18.2.0",
30
34
  "libphonenumber-js": "^1.10.14",
31
- "card-validator": "^8.1.1",
32
- "js-base64": "^3.7.2",
33
35
  "@faker-js/faker": "^7.3.0",
36
+ "js-base64": "^3.7.2",
37
+ "card-validator": "^8.1.1",
34
38
  "i18next-browser-languagedetector": "^6.1.4",
35
39
  "stylis": "^4.1.2",
36
- "swr": "^2.0.0-beta.5",
37
40
  "axios": "^0.26.1",
38
41
  "@hookform/resolvers": "2.9.1"
39
42
  }
package/register.d.ts CHANGED
@@ -8,12 +8,9 @@ export interface ErrorFallbackProps {
8
8
  * @see {@link registerElement}
9
9
  */
10
10
  export declare const ErrorFallback: ({ error }: ErrorFallbackProps) => import("@emotion/react/jsx-runtime").JSX.Element;
11
- type KeyWithStringValue<T> = string & keyof {
12
- [K in keyof Required<T> as Required<T>[K] extends string ? K : never]: T[K] extends string ? T[K] : never;
13
- };
14
11
  type ExtendedElementProps<ElementProps> = ElementProps & Record<string, unknown>;
15
12
  /**
16
13
  * Registers element with all necessary providers and wrappers
17
14
  */
18
- export declare const registerElement: <ElementProps>(name: string, Element: import("react").ComponentType<ElementProps>, invalidationKey?: KeyWithStringValue<ElementProps> | KeyWithStringValue<ElementProps>[] | undefined) => (props: ExtendedElementProps<ElementProps>) => import("@emotion/react/jsx-runtime").JSX.Element;
15
+ export declare const registerElement: <ElementProps>(name: string, Element: import("react").ComponentType<ElementProps>, rootId?: string) => (props: ExtendedElementProps<ElementProps>) => import("@emotion/react/jsx-runtime").JSX.Element;
19
16
  export {};
@@ -1,3 +1,2 @@
1
- export * from "./address";
2
1
  export * from "./money";
3
2
  export * from "./phone";
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import * as SE from "@shipengine/types";
2
+ import { SE } from "@shipengine/api";
3
3
  /**
4
4
  * @category Form Validation
5
5
  */
@@ -1,2 +1 @@
1
1
  export * from "./render";
2
- export * from "./swr";
@@ -1 +1,6 @@
1
1
  export declare const renderWithProviders: (component: any) => import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
2
+ /**
3
+ * Wraps the test with all of the usual Shipengine / Giger / i18 / etc providers that a full, registered "Element" would have.
4
+ * This allows components to simulate usage in an Element via `decorators: [withAllProviders]`
5
+ **/
6
+ export declare const renderWithAllProviders: (component: any) => import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
@@ -1,17 +1,22 @@
1
- import * as SE from "@shipengine/types";
1
+ import { CarrierConnection, SE } from "@shipengine/api";
2
2
  export type CarrierTerm = {
3
3
  description: string;
4
4
  name: string;
5
5
  url: string;
6
6
  };
7
+ export type CarrierTerms = {
8
+ content: string[];
9
+ links: CarrierTerm[];
10
+ title: string;
11
+ };
7
12
  export type CarrierMetadata = {
8
- carrierCode: SE.Carrier["carrierCode"];
13
+ carrierCode: CarrierConnection["carrierCode"];
9
14
  logo: string;
10
15
  name: string;
11
- optionalFields: string[];
12
- requiredFields: string[];
16
+ optionalFields?: string[];
17
+ requiredFields?: string[];
13
18
  shortname: string;
14
- terms: Record<string, CarrierTerm[]> | Record<never, never>;
19
+ terms?: CarrierTerms;
15
20
  };
16
21
  export type CarriersFeatures = {
17
22
  enabledCarriers?: SE.Carrier["carrierCode"][];
@@ -1,8 +1,8 @@
1
- import * as SE from "@shipengine/types";
1
+ import { SE } from "@shipengine/api";
2
2
  export type ShippingPreset = {
3
3
  confirmation?: SE.ConfirmationType;
4
4
  dimensions?: SE.DimensionsWithUnit;
5
- insuranceProvider?: SE.InsuranceProvider;
5
+ insuranceProvider?: SE.InsuranceProviderType;
6
6
  insuredValue?: SE.InsuranceAccount;
7
7
  name: string;
8
8
  packageCode?: string;
@@ -17,8 +17,20 @@ export declare const mostRecent: (...dates: Date[]) => Date;
17
17
  /**
18
18
  * @category Utilities
19
19
  */
20
- export declare const omitTime: (shipDate: string) => Date;
20
+ export declare const omitTime: (shipDate?: string) => Date;
21
21
  /**
22
22
  * @category Utilities
23
23
  */
24
24
  export declare const getExpirationYears: (yearsValid: number) => string[];
25
+ /**
26
+ * @category Utilities
27
+ */
28
+ type HasCreationDate = {
29
+ createdAt: string;
30
+ };
31
+ export declare const sortByCreationDate: (a: HasCreationDate, b: HasCreationDate, order?: "asc" | "desc") => number;
32
+ /**
33
+ * @category Utilities
34
+ */
35
+ export declare const isNowOrInTheFuture: (shipDate?: string) => boolean;
36
+ export {};
@@ -1,4 +1,5 @@
1
- import * as SE from "@shipengine/types";
1
+ import { SE } from "@shipengine/api";
2
2
  export declare const currencySymbol: Record<SE.Currency, string>;
3
3
  export declare const formatMoney: (value: SE.Money, locale?: string) => string;
4
4
  export declare const calculateTotal: (...values: SE.Money[]) => number;
5
+ export declare const formatCreditCardNumber: (cc: string) => string;
@@ -1,6 +1,6 @@
1
- import * as SE from "@shipengine/types";
1
+ import { SE } from "@shipengine/api";
2
2
  export declare const getRateRequiresAcknowledgement: (serviceCode: string) => boolean;
3
- export declare const getTotalRateAmount: (rateCosts: {
3
+ export declare const getTotalRateAmount: (rateCosts?: {
4
4
  confirmationAmount?: SE.Money;
5
5
  insuranceAmount?: SE.Money;
6
6
  otherAmount?: SE.Money;
@@ -1,4 +1,4 @@
1
- import * as SE from "@shipengine/types";
1
+ import { SE } from "@shipengine/api";
2
2
  /**
3
3
  * @category Utilities
4
4
  */
@@ -1,4 +1,4 @@
1
- import * as SE from "@shipengine/types";
1
+ import { SE } from "@shipengine/api";
2
2
  type ConvertDimensionsOptions = {
3
3
  allowAllZeroes?: boolean;
4
4
  };
@@ -1,4 +1,4 @@
1
- import * as SE from "@shipengine/types";
1
+ import { SE } from "@shipengine/api";
2
2
  /**
3
3
  * @category Utilities
4
4
  */
@@ -1,4 +1,4 @@
1
- import * as SE from "@shipengine/types";
1
+ import { SE } from "@shipengine/api";
2
2
  /**
3
3
  * @category Utilities
4
4
  */
@@ -1,4 +1,4 @@
1
- import * as SE from "@shipengine/types";
1
+ import { SE } from "@shipengine/api";
2
2
  /**
3
3
  * @category Utilities
4
4
  */
@@ -1,15 +0,0 @@
1
- import { CarrierAutoFunding } from "@shipengine/types";
2
- import { AutoFundingFormPayload } from "./auto-funding-schema";
3
- export type AutoFundingFormProps = {
4
- defaultValues: CarrierAutoFunding;
5
- errorMessage?: string;
6
- hasError: boolean;
7
- isLoading: boolean;
8
- onSubmit: (payload: AutoFundingFormPayload) => Promise<void> | void;
9
- onToggle: (enabled: boolean) => Promise<void> | void;
10
- };
11
- /**
12
- * This form that allows users to enable or disable auto funding, and
13
- * configure auto funding settings in ShipEngine API.
14
- */
15
- export declare const AutoFundingForm: ({ defaultValues, errorMessage, hasError, isLoading, onSubmit, onToggle, }: AutoFundingFormProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
1
- export * from "./auto-funding-form";
@@ -1,2 +0,0 @@
1
- export * from "./auto-funding-form";
2
- export * from "./manual-funding-form";
@@ -1,2 +0,0 @@
1
- export * from "./manual-funding-form";
2
- export * from "./manual-funding-schema";
@@ -1,17 +0,0 @@
1
- /// <reference types="react" />
2
- import { ManualFundingFormPayload } from "./manual-funding-schema";
3
- export type ManualFundingFormProps<T = undefined> = {
4
- currentBalance: number;
5
- errorMessage?: string;
6
- hasError: boolean;
7
- isLoading: boolean;
8
- onSubmit: (payload: ManualFundingFormPayload) => Promise<void> | void;
9
- requiredAmount?: number;
10
- } & ({
11
- formId: string;
12
- portalRef: React.RefObject<T>;
13
- } | {
14
- formId?: string;
15
- portalRef?: never;
16
- });
17
- export declare const ManualFundingForm: <T extends Element>({ currentBalance, errorMessage, formId, hasError, isLoading, onSubmit, portalRef, requiredAmount, }: ManualFundingFormProps<T>) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,27 +0,0 @@
1
- import { z } from "zod";
2
- export declare const manualFundingSchema: z.ZodObject<{
3
- funds: z.ZodObject<z.extendShape<{
4
- amount: z.ZodNumber;
5
- currency: z.ZodNativeEnum<typeof import("dist/shipengine-types/src").Currency>;
6
- }, {
7
- amount: z.ZodNumber;
8
- }>, "strip", z.ZodTypeAny, {
9
- amount: number;
10
- currency: import("dist/shipengine-types/src").Currency;
11
- }, {
12
- amount: number;
13
- currency: import("dist/shipengine-types/src").Currency;
14
- }>;
15
- }, "strip", z.ZodTypeAny, {
16
- funds: {
17
- amount: number;
18
- currency: import("dist/shipengine-types/src").Currency;
19
- };
20
- }, {
21
- funds: {
22
- amount: number;
23
- currency: import("dist/shipengine-types/src").Currency;
24
- };
25
- }>;
26
- export type ManualFundingFormFields = z.input<typeof manualFundingSchema>;
27
- export type ManualFundingFormPayload = z.output<typeof manualFundingSchema>;
@@ -1,5 +0,0 @@
1
- import { CarriersFeatures } from "../../../types";
2
- export type AddCarriersProps = {
3
- features?: CarriersFeatures;
4
- };
5
- export declare const AddCarriers: ({ features }: AddCarriersProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
1
- export * from './add-carriers';
@@ -1,10 +0,0 @@
1
- import { z } from "zod";
2
- export declare const agreementFormSchema: z.ZodObject<{
3
- agreement: z.ZodLiteral<boolean>;
4
- }, "strip", z.ZodTypeAny, {
5
- agreement: boolean;
6
- }, {
7
- agreement: boolean;
8
- }>;
9
- export type AgreementFormFields = z.input<typeof agreementFormSchema>;
10
- export type AgreementFormPayload = z.output<typeof agreementFormSchema>;
@@ -1,8 +0,0 @@
1
- import { ReactNode } from "react";
2
- import { AgreementFormPayload } from "./agreement-form-schema";
3
- export type AgreementFormProps = {
4
- checkboxLabel: ReactNode;
5
- onAgree: (values: AgreementFormPayload) => Promise<void>;
6
- onSkip?: () => void;
7
- };
8
- export declare const AgreementForm: ({ checkboxLabel, onAgree, onSkip }: AgreementFormProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
1
- export declare const getAgreementStyles: () => import("@emotion/utils").SerializedStyles;
@@ -1 +0,0 @@
1
- export * from "./agreement-form";
@@ -1,6 +0,0 @@
1
- import { ComponentMeta, ComponentStory } from "@storybook/react";
2
- import { BillingFormProps } from "./billing-form";
3
- declare const _default: ComponentMeta<({ onSkip, onSubmit }: BillingFormProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
4
- export default _default;
5
- export declare const Default: ComponentStory<({ onSkip, onSubmit }: BillingFormProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
6
- export declare const WithLabels: ComponentStory<({ onSkip, onSubmit }: BillingFormProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
@@ -1,9 +0,0 @@
1
- import * as SE from "@shipengine/types";
2
- import { BillingFormPayload } from "./billing-schema";
3
- export type BillingFormProps = {
4
- address?: SE.Address;
5
- onCancel?: () => void;
6
- onSkip: () => void;
7
- onSubmit: (billingPayload: BillingFormPayload) => void;
8
- };
9
- export declare const BillingForm: ({ onSkip, onSubmit }: BillingFormProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1,2 +0,0 @@
1
- export * from "./billing-form";
2
- export * from "./billing-form-styles";
@@ -1,17 +0,0 @@
1
- import { CarrierAutoFunding } from "@shipengine/types";
2
- import { ManualFundingFormPayload } from "../../organisms/manual-funding-form/manual-funding-schema";
3
- export type FundingMethodsProps = {
4
- addFundsErrorMessage?: string;
5
- autoFundingData: CarrierAutoFunding;
6
- autoFundingErrorMessage?: string;
7
- hasAutoFundingError: boolean;
8
- hasManualFundingError: boolean;
9
- isAutoFundingLoading: boolean;
10
- isManualFundingLoading: boolean;
11
- manualFundingCurrentBalance: number;
12
- manualFundingRequiredAmount?: number;
13
- onSubmitAutoFunding: (payload: CarrierAutoFunding) => Promise<void> | void;
14
- onSubmitManualFunding: (payload: ManualFundingFormPayload) => Promise<void> | void;
15
- onToggleAutoFunding: (enabled: boolean) => Promise<void> | void;
16
- };
17
- export declare const FundingMethods: ({ addFundsErrorMessage, autoFundingData, autoFundingErrorMessage, hasAutoFundingError, hasManualFundingError, isAutoFundingLoading, isManualFundingLoading, manualFundingCurrentBalance, manualFundingRequiredAmount, onSubmitAutoFunding, onSubmitManualFunding, onToggleAutoFunding, }: FundingMethodsProps) => import("@emotion/react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
1
- export * from "./funding-methods";
@@ -1 +0,0 @@
1
- export * from "./register-wallet";
@@ -1,3 +0,0 @@
1
- export type RegisterWalletFeatures = {};
2
- export type RegisterWalletProps = {};
3
- export declare const RegisterWallet: ({}: RegisterWalletProps) => import("@emotion/react/jsx-runtime").JSX.Element;