@tapcart/app-studio-sdk 1.16.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/README.md +77 -0
- package/dist/app-studio-sdk.es.js +3586 -0
- package/dist/app-studio-sdk.umd.js +4 -0
- package/package.json +70 -0
package/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Tapcart App Studio
|
|
2
|
+
|
|
3
|
+
#### Example Usage
|
|
4
|
+
|
|
5
|
+
```javascript
|
|
6
|
+
// App.js
|
|
7
|
+
|
|
8
|
+
import { TapcartProvider,createClient } from "@tapcart/app-studio-sdk";
|
|
9
|
+
import InnerComponent from "./InnerComponent";
|
|
10
|
+
|
|
11
|
+
function App() {
|
|
12
|
+
|
|
13
|
+
const tapcartClient = createClient({test: false});
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<div className="App">
|
|
17
|
+
<WebbridgeProvider webbridgeClient={webbridgeClient}>
|
|
18
|
+
<TapcartBlock /> {/* this is your apps main entry point*/}
|
|
19
|
+
</WebbridgeProvider>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default App;
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
// InnerComponent.js
|
|
31
|
+
|
|
32
|
+
import { useActions } from "@tapcart/app-studio-sdk";
|
|
33
|
+
|
|
34
|
+
function InnerComponent(props) {
|
|
35
|
+
let { openProduct, openCollection, openCart } = useActions();
|
|
36
|
+
return <button onClick={() => openProduct("1232242232132")}>Inner Component</button>
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default InnerComponent;
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Docs
|
|
43
|
+
To see the public facing documentation : https://docs.tapcart.com/docs/app-actions
|
|
44
|
+
|
|
45
|
+
The SDK acts as a communication bridge between the native iOS/Android Webviews and the Web Apps built by the merchants. This two way communication is powered by `events` and `actions`.
|
|
46
|
+
|
|
47
|
+
Actions allow the SDK users to interact with native app functionality via JS. The following actions are supported currently:
|
|
48
|
+
|
|
49
|
+
```javascript
|
|
50
|
+
Tapcart.actions.addToCart(...)
|
|
51
|
+
Tapcart.actions.applyDiscount(...)
|
|
52
|
+
Tapcart.actions.applyGiftCard(...)
|
|
53
|
+
Tapcart.actions.cartBuyerIdentity(...)
|
|
54
|
+
Tapcart.actions.cartUpdateDeliveryOptions(...)
|
|
55
|
+
Tapcart.actions.getCustomerIdentity()
|
|
56
|
+
Tapcart.actions.openCart()
|
|
57
|
+
Tapcart.actions.openCollection(...)
|
|
58
|
+
Tapcart.actions.openProduct(...)
|
|
59
|
+
Tapcart.actions.openScreen(...)
|
|
60
|
+
Tapcart.actions.removeFromCart(...)
|
|
61
|
+
Tapcart.actions.renderView()
|
|
62
|
+
Tapcart.actions.scrollToBlockBottom()
|
|
63
|
+
Tapcart.actions.scrollToBlockTop()
|
|
64
|
+
Tapcart.actions.showToast(...)
|
|
65
|
+
Tapcart.actions.updateCartAttributes(...)
|
|
66
|
+
Tapcart.actions.updateCartNote(...)
|
|
67
|
+
Tapcart.actions.updateView(...)
|
|
68
|
+
Tapcart.actions.vault.initialize(...)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Events allow SDK users to respond to changes in the native apps; The following events are supported currently:
|
|
72
|
+
|
|
73
|
+
- `cart/updated`
|
|
74
|
+
- `discount/applied`
|
|
75
|
+
- `giftcard/applied`
|
|
76
|
+
- `product/opened`
|
|
77
|
+
- `collection/opened`
|