This repository has been archived by the owner on Apr 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
180 lines (168 loc) · 5.35 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
/*
* Copyright (c) TIKI Inc.
* MIT license. See LICENSE file in root directory.
*/
/**
* Interfaces for configuration of this library.
*
* Define during app registration. Start with the top-level interface: {@link Options}
* @module
*/
import type { Key } from "./key";
import type { Offer } from "./offer";
import type { Theme } from "./theme";
import type { Company } from "./company";
import type { Receipt } from "@mytiki/capture-receipt-capacitor";
/**
* The top-level configuration object for this library. Define during app registration.
*
* @example
* For Vue >=3.0.0
* ```
* import { createApp } from "vue";
* import App from "@/app.vue";
* import Tiki from "@mytiki/receipt-capacitor";
* import ProgramImage from "@/assets/images/program.png";
* import LearnMore from "@/assets/md/learn-more.md?raw";
*
* createApp(App)
* .use(Tiki, {
* company: {
* name: "Company Inc.",
* jurisdiction: "Tennessee, USA",
* privacy: "https://your-co.com/privacy",
* terms: "https://your-co.com/terms",
* },
* key: {
* publishingId: "YOUR TIKI PUBLISHING ID",
* android: "YOUR MICROBLINK ANDROID LICENSE KEY",
* ios: "YOUR MICROBLINK IOS LICENSE KEY",
* product: "YOUR MICROBLINK PRODUCT INTELLIGENCE KEY",
* },
* offer: {
* image: ProgramImage,
* description: "Connect your accounts to turn your receipts into real cash each month!",
* bullets: [
* "Link a Gmail account",
* "Link a supported retailer account",
* "Open and use the app each week",
* "Share 5 new receipts",
* ],
* },
* theme: {
* fontFamily: "'Space Grotesk', sans-serif",
* primaryTextColor: "rgb(28 0 0)",
* secondaryTextColor: "rgb(28 0 0 / 60%)",
* successColor: "rgb(0 178 114)",
* errorColor: "rgb(199, 48, 0)",
* primaryBackgroundColor: "rgb(255 255 255)",
* secondaryBackgroundColor: "rgb(246 246 246)",
* },
* learn: LearnMore,
* onWithdrawl: (_total: number): number | undefined => total,
* onReceipt: (receipt: Receipt) => console.log(receipt),
* })
* .mount("#app");
* ```
* @example
* For Vue 2.7.14
* ```
* import { createApp } from "vue";
* import Vue from "vue";
* import Tiki from "@mytiki/receipt-capacitor-vue2";
* import ProgramImage from "@/assets/images/program.png";
* import LearnMore from "@/assets/md/learn-more.md?raw";
*
* Vue.use(Tiki, {
* company: {
* name: "Company Inc.",
* jurisdiction: "Tennessee, USA",
* privacy: "https://your-co.com/privacy",
* terms: "https://your-co.com/terms",
* },
* key: {
* publishingId: "YOUR TIKI PUBLISHING ID",
* android: "YOUR MICROBLINK ANDROID LICENSE KEY",
* ios: "YOUR MICROBLINK IOS LICENSE KEY",
* product: "YOUR MICROBLINK PRODUCT INTELLIGENCE KEY",
* },
* offer: {
* image: ProgramImage,
* description: "Connect your accounts to turn your receipts into real cash each month!",
* bullets: [
* "Link a Gmail account",
* "Link a supported retailer account",
* "Open and use the app each week",
* "Share 5 new receipts",
* ],
* },
* theme: {
* fontFamily: "'Space Grotesk', sans-serif",
* primaryTextColor: "rgb(28 0 0)",
* secondaryTextColor: "rgb(28 0 0 / 60%)",
* successColor: "rgb(0 178 114)",
* errorColor: "rgb(199, 48, 0)",
* primaryBackgroundColor: "rgb(255 255 255)",
* secondaryBackgroundColor: "rgb(246 246 246)",
* },
* learn: LearnMore,
* onWithdrawl: (_total: number): number | undefined => total,
* onReceipt: (receipt: Receipt) => console.log(receipt);
*
* });
*
* new Vue({ render: (h) => h(App) }).$mount("#app");
* ```
*/
export interface Options {
/**
* Your company's information. Required for data licensing agreements.
*/
company: Company;
/**
* The license keys required to use this Library. Sign up at [mytiki.com](https://mytiki.com).
*/
key: Key;
/**
* Override the default offer content presented to the user.
*/
offer?: Offer;
/**
* Configure the UI styling to fit your application's look and feel.
*/
theme?: Theme;
/**
* An optional function to execute when a user presses the cash-out button. Use
* this to create a partial withdrawal, check if a user's account meets minimum
* withdrawal requirements, etc.
*
* For the UI to correctly reflect the users balance, the callback should return
* the total amount withdrawn.
*
* @param total - The user's current cash balance.
* @returns The amount of cash withdrawn or undefined if nothing withdrawn.
*/
onWithdrawl?: (total: number) => number | undefined;
/**
* An optional function to execute after a receipt be published in Tiki Backend. Use
* this to log and debug receipts.
*
*
* @param receipt - A Receipt Object.
* @returns The receipt object.
*/
onReceipt?: (receipt: Receipt) => void;
/**
* The learn more page content in [Markdown](https://www.markdownguide.org) format.
* Shown whenever a user clicks the ? button.
*
* Overrides the
* [default page](https://github.com/tiki/apps-receipt-capacitor/blob/main/src/assets/md/learn-more.md)
* found under `src/assets/md/learn-more.md`
*/
learn?: string;
}
export * from "./key";
export * from "./theme";
export * from "./offer";
export * from "./company";