apirocket 0.10.4 → 0.11.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 ADDED
@@ -0,0 +1,84 @@
1
+ # Uso
2
+
3
+ ```
4
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/apirocket@_VERSION_/dist/ecommerce.css">
5
+ <script src="https://cdn.jsdelivr.net/npm/apirocket@_VERSION/dist/ecommerce.js" defer></script>
6
+ ````
7
+
8
+
9
+ ## Inicializar el ecommerce
10
+
11
+ ```javascript
12
+
13
+ document.addEventListener('apirocket.ecommerce.ready', (event: EcommerceReadyEvent) => {
14
+
15
+ event.ecommerce.config (EcommerceConfig)
16
+ });
17
+ ```
18
+
19
+ ### EcommerceReadyEvent
20
+
21
+ ```javascript
22
+ interface EcommerceReadyEvent extends Event {
23
+ ecommerce: PublicEcommerceService
24
+ }
25
+ ```
26
+
27
+
28
+ ### PublicEcommerceService
29
+
30
+ ```javascript
31
+ type PublicEcommerceService = {
32
+ customer: any,
33
+ cart: any,
34
+ config: (value: EcommerceConfig) => void,
35
+ updateEvents: () => void
36
+ }
37
+ ```
38
+
39
+ ### EcommerceConfig
40
+
41
+ ```javascript
42
+ type EcommerceConfig = {
43
+ countryIso?: string;
44
+ debug?: DebugType | Array <DebugType> = '';
45
+ ecommerceId: string;
46
+ logo?: string;
47
+ legalLinks?: LegalLinks;
48
+ pricesTaxIncluded?: boolean = true;
49
+ stage?: Stage = 'production';
50
+ }
51
+ ```
52
+
53
+ ### DebugType
54
+
55
+ ```javascript
56
+ type DebugType = 'all' | 'analytics'
57
+ ```
58
+
59
+ ### LegalLinks
60
+
61
+ ```javascript
62
+ type LegalLinks = {
63
+ refundPolicy?: LegalLink,
64
+ privacyPolicy?: LegalLink,
65
+ termsAndConditions?: LegalLink
66
+ }
67
+
68
+ type LegalLink = {
69
+ label?: string;
70
+ link?: string;
71
+ }
72
+ ```
73
+
74
+ ### Ejemplo
75
+
76
+ ```javascript
77
+ document.addEventListener('apirocket.ecommerce.ready', (event: EcommerceReadyEvent) => {
78
+
79
+ event.ecommerce.config ({
80
+ ecommerceId: 'ECOMMERCE_ID',
81
+ debug: 'all',
82
+ })
83
+ });
84
+ ```
package/dist/config.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export declare const CONFIG: Config;
2
2
  export declare const apiConfig: (config: Omit<EcommerceConfig, 'countryIso'>) => Promise<void>;
3
3
  export declare const DEBUG_GRAPHQL = false;
4
+ export declare const isDebugType: (debug: DebugType | Array<DebugType> | undefined) => debug is DebugType;