@artaio/arta-browser 2.11.0 → 2.12.0-color-fixes1e62d279800a90b258bb6b27be7e06e513e5ca65

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/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # arta-browser
2
2
 
3
- arta-browser is a TypeScript SDK providing easy setup for Arta's Estimates widget.
3
+ arta-browser is a TypeScript SDK providing easy setup for Arta's Estimates and Tracking widgets.
4
4
 
5
- [Arta Estimates](https://manual.arta.io/guides/solutions/no-code/estimates/estimates-widget) enables Arta's clients to dynamically generate shipping estimates (non-bookable) for their customers.
5
+ * Use [Arta Estimates](https://manual.arta.io/guides/solutions/no-code/estimates/estimates-widget) to dynamically generate shipping estimates (non-bookable) on your own website.
6
+ * Use [Arta Tracking](https://manual.arta.io/guides/solutions/no-code/post-sale/tracking) to easily present clear and up-to-date tracking information on your own website.
6
7
 
7
8
  ## Installation
8
9
 
@@ -29,41 +30,113 @@ And you can then import `Arta` object for example:
29
30
  import Arta from '@artaio/arta-browser';
30
31
  ```
31
32
 
32
- ### Basic Usage
33
- ```jsx
34
- import Arta from '@artaio/arta-browser';
33
+ ## Basic Usage
35
34
 
36
- // On load
37
- Arta.init('<YOUR_API_KEY>');
38
- ... // Your code
39
- ```
35
+ ### For the Estimates widget
40
36
 
41
- #### For Estimates widget
42
37
  ```jsx
43
- // On widget display
44
- const estimate = Arta.estimate({origin, objects}, config); // check types for more details
45
- await esimate.validate(); // mandatory for setting estimate.isReady
38
+ // On page load, initialize the Arta SDK with your publishable API key
39
+ Arta.init('<YOUR_API_KEY>');
40
+
41
+ // Set up origin and object details, request preferences as well as
42
+ // your widget configuration overrides
43
+ const origin = {
44
+ city: 'Brooklyn',
45
+ region: 'NY',
46
+ country: 'US',
47
+ postal_code: '11249',
48
+ };
49
+
50
+ const objects = [
51
+ {
52
+ depth: 2,
53
+ width: 36,
54
+ height: 24,
55
+ subtype: 'painting_unframed',
56
+ unit_of_measurement: 'in',
57
+ value_currency: 'USD',
58
+ value: 500.0,
59
+ },
60
+ ];
61
+
62
+ const requestPreferences = { currency: 'EUR' };
63
+
64
+ const widgetConfig = {
65
+ style: {
66
+ position: 'center',
67
+ pricingDisplay: 'range',
68
+ },
69
+ };
70
+
71
+ // Setup an instance of the estimates widget
72
+ const estimate = Arta.estimate(
73
+ { origin, objects, requestPreferences },
74
+ widgetConfig
75
+ );
76
+
77
+ // Validate the widget before rendering it
78
+ await esimate.validate();
79
+
80
+ // `estimate.isReady` will be true if validations pass and false if
81
+ // they do not. You can choose to render a button to open the widget
82
+ // when the widget has been validated.
83
+ //
84
+ // `estimate.open()` will render the widget on your page.
85
+ esimate.isReady && (
86
+ <Button onClick={() => estimate.open()}>Estimate Shipping</Button>
87
+ );
46
88
 
47
- // estimate.open() will render the widget
48
- esimate.isReady && <Button onClick={() => estimate.open()}>
49
89
  ```
50
90
 
51
- #### For Tracking widget
91
+ The Arta Estimates widget has many configuration options to customize the look and feel of the widget. You can view the full list of options in [/lib/estimateConfig.ts](/lib/estimateConfig.ts) and view a live demo at [manual.arta.io/estimates-demo](https://manual.arta.io/estimates-demo/).
92
+
93
+ For additional examples using different frontend frameworks please check out [artaio/arta-browser-examples on GitHub](https://github.com/artaio/arta-browser-examples).
94
+
95
+ ### For the Tracking widget
96
+
52
97
  ```jsx
53
- // On widget display
54
- const shipmentId = '450727fa-9036-4252-8a86-02af6f09caa6'; // arta shipment UUId
55
- const tracking = Arta.tracking(shipmentId, config); // check types for more details
56
- await esimate.validate(); // mandatory for setting tracking.isReady
98
+ // On page load, initialize the Arta SDK with your publishable API key
99
+ Arta.init('<YOUR_API_KEY>');
57
100
 
58
- // tracking.open() will render the widget
59
- esimate.isReady && <Button onClick={() => tracking.open()}>
101
+ // Optionally, build your Tracking widget configuration
102
+ const config = {
103
+ animation: {
104
+ in: {
105
+ type: 'slide',
106
+ duration: 500,
107
+ easing: 'ease-in-out',
108
+ },
109
+ out: {
110
+ type: 'slide',
111
+ duration: 250,
112
+ easing: 'ease-in-out',
113
+ },
114
+ },
115
+ style: {
116
+ color: {
117
+ iconPrimary: 'blue',
118
+ },
119
+ },
120
+ };
121
+
122
+ // Setup an instance of the tracking widget
123
+ const tracking = Arta.tracking('<SHIPMENT_ID>', config);
124
+
125
+ // Validate the widget before rendering it
126
+ await tracking.validate();
127
+ // `tracking.isReady` will be true if validations pass and false if
128
+ // they do not. You can choose to render a button to open the widget
129
+ // when the widget has been validated.
130
+ //
131
+ // `tracking.open()` will render the widget on your page.
132
+ tracking.isReady && <Button onClick={() => tracking.open()}>Track</Button>;
60
133
  ```
61
134
 
62
- For more details and examples using different frontend frameworks please check https://github.com/artaio/arta-browser-examples.
135
+ The Arta Tracking widget has many configuration options to customize the look and feel of the widget. You can view the full list of options in [/lib/trackingConfig.ts](/lib/trackingConfig.ts).
63
136
 
64
137
  ## Contributing
65
138
 
66
- Please ensure that all the examples available on https://github.com/artaio/arta-browser-examples are still working before opening a PR.
139
+ Please ensure that all the examples available on [github.com/artaio/arta-browser-examples](https://github.com/artaio/arta-browser-examples) are still working before opening a PR.
67
140
 
68
141
  ### Development
69
142