@dintero/discounts-web-sdk 0.2.4 → 0.2.6
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/.github/CODEOWNERS +3 -0
- package/.github/workflows/build.yml +16 -11
- package/.github/workflows/release.yml +8 -7
- package/.prettierrc.yml +8 -0
- package/README.md +45 -44
- package/dist/declarations/src/index.d.ts +1 -1
- package/dist/declarations/src/types.d.ts +95 -86
- package/dist/dintero-discounts-web-sdk.cjs.d.ts +1 -0
- package/dist/dintero-discounts-web-sdk.cjs.dev.js +35 -47
- package/dist/dintero-discounts-web-sdk.cjs.prod.js +35 -47
- package/dist/dintero-discounts-web-sdk.esm.js +35 -47
- package/dist/dintero-discounts-web-sdk.umd.min.js +1 -1
- package/dist/dintero-discounts-web-sdk.umd.min.js.map +1 -1
- package/index.html +89 -68
- package/package.json +13 -21
- package/dist/declarations/src/discounts.d.ts +0 -7
- package/dist/declarations/src/dom.d.ts +0 -15
- package/dist/declarations/src/error.d.ts +0 -2
- package/dist/declarations/src/fetch.d.ts +0 -2
- package/dist/declarations/src/formatters.d.ts +0 -7
- package/dist/declarations/src/loading.d.ts +0 -2
- package/dist/declarations/src/normalize.d.ts +0 -1
- package/dist/declarations/src/translations.d.ts +0 -25
- package/karma.conf.js +0 -33
|
@@ -2,7 +2,7 @@ name: CI
|
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
pull_request:
|
|
5
|
-
branches: [
|
|
5
|
+
branches: [master]
|
|
6
6
|
push:
|
|
7
7
|
branches:
|
|
8
8
|
- master
|
|
@@ -11,13 +11,18 @@ jobs:
|
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
12
|
|
|
13
13
|
steps:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
- name: Checkout
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Setup Node.js
|
|
18
|
+
uses: actions/setup-node@v4
|
|
19
|
+
with:
|
|
20
|
+
node-version: "20.x"
|
|
21
|
+
cache: yarn
|
|
22
|
+
|
|
23
|
+
- name: yarn install, build, test and lint
|
|
24
|
+
run: |
|
|
25
|
+
yarn install
|
|
26
|
+
yarn run test
|
|
27
|
+
yarn run build
|
|
28
|
+
yarn run lint
|
|
@@ -18,22 +18,23 @@ jobs:
|
|
|
18
18
|
|
|
19
19
|
steps:
|
|
20
20
|
- name: Checkout
|
|
21
|
-
uses: actions/checkout@
|
|
21
|
+
uses: actions/checkout@v4
|
|
22
22
|
with:
|
|
23
23
|
fetch-depth: 0
|
|
24
24
|
|
|
25
25
|
- name: Setup Node.js
|
|
26
|
-
uses: actions/setup-node@
|
|
26
|
+
uses: actions/setup-node@v4
|
|
27
27
|
with:
|
|
28
|
-
node-version:
|
|
28
|
+
node-version: "20.x"
|
|
29
29
|
|
|
30
|
-
- name:
|
|
30
|
+
- name: yarn install, test and lint
|
|
31
31
|
run: |
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
yarn install
|
|
33
|
+
yarn run test
|
|
34
|
+
yarn run lint
|
|
34
35
|
|
|
35
36
|
- name: Release
|
|
36
37
|
env:
|
|
37
38
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
38
39
|
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
|
39
|
-
run:
|
|
40
|
+
run: yarn run semantic-release
|
package/.prettierrc.yml
ADDED
package/README.md
CHANGED
|
@@ -26,10 +26,10 @@ Make sure to configure the plugin with an API client that only has grants giving
|
|
|
26
26
|
const container = document.getElementById("checkout-container");
|
|
27
27
|
discounts.embed({
|
|
28
28
|
container: document.getElementById("deals-container"),
|
|
29
|
-
api:{
|
|
30
|
-
account:
|
|
31
|
-
key:
|
|
32
|
-
secret:
|
|
29
|
+
api: {
|
|
30
|
+
account: "P00000000",
|
|
31
|
+
key: "public_api_key",
|
|
32
|
+
secret: "abcdef01-2345-6789-abcd-ef0123456789",
|
|
33
33
|
},
|
|
34
34
|
theme: {
|
|
35
35
|
fontSize: "14px",
|
|
@@ -37,7 +37,7 @@ Make sure to configure the plugin with an API client that only has grants giving
|
|
|
37
37
|
primary: "hotpink",
|
|
38
38
|
secondary: "aqua",
|
|
39
39
|
background: "#fff",
|
|
40
|
-
}
|
|
40
|
+
},
|
|
41
41
|
});
|
|
42
42
|
</script>
|
|
43
43
|
```
|
|
@@ -53,11 +53,11 @@ Make sure to configure the plugin with an API client that only has grants giving
|
|
|
53
53
|
const container = document.getElementById("checkout-container");
|
|
54
54
|
discounts.embed({
|
|
55
55
|
container: document.getElementById("deals-container"),
|
|
56
|
-
api:{
|
|
57
|
-
account:
|
|
58
|
-
key:
|
|
59
|
-
secret:
|
|
60
|
-
discountId:
|
|
56
|
+
api: {
|
|
57
|
+
account: "P00000000",
|
|
58
|
+
key: "public_api_key",
|
|
59
|
+
secret: "abcdef01-2345-6789-abcd-ef0123456789",
|
|
60
|
+
discountId: "1234",
|
|
61
61
|
},
|
|
62
62
|
theme: {
|
|
63
63
|
fontSize: "14px",
|
|
@@ -65,7 +65,7 @@ Make sure to configure the plugin with an API client that only has grants giving
|
|
|
65
65
|
primary: "hotpink",
|
|
66
66
|
secondary: "aqua",
|
|
67
67
|
background: "#fff",
|
|
68
|
-
}
|
|
68
|
+
},
|
|
69
69
|
});
|
|
70
70
|
</script>
|
|
71
71
|
```
|
|
@@ -86,37 +86,39 @@ In this example the SDK is supplied with a list of discount objects directly.
|
|
|
86
86
|
secondary: "aqua",
|
|
87
87
|
background: "#fff",
|
|
88
88
|
},
|
|
89
|
-
discounts:[
|
|
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
|
-
|
|
89
|
+
discounts: [
|
|
90
|
+
{
|
|
91
|
+
id: "1",
|
|
92
|
+
name: "Testvare",
|
|
93
|
+
description: "Beskrivelse av testvare",
|
|
94
|
+
requirement: {
|
|
95
|
+
item: { items: [{ id: "testvare-1" }] },
|
|
96
|
+
customer: {},
|
|
97
|
+
store_ids: ["*"],
|
|
98
|
+
purchase_to: "2030-06-13T21:59:00Z",
|
|
99
|
+
purchase_from: "2080-06-06T22:00:00Z",
|
|
100
|
+
},
|
|
101
|
+
limitation: {},
|
|
102
|
+
reward: { type: "discount_item_new_price", value: 5000 },
|
|
103
|
+
created_by: "DinteroTest",
|
|
104
|
+
created_at: "2021-06-04T10:21:18.029Z",
|
|
105
|
+
updated_at: "2021-06-04T10:21:18.029Z",
|
|
106
|
+
receipt_text: "Ukens tilbud",
|
|
107
|
+
type: "item",
|
|
108
|
+
links: [
|
|
109
|
+
{
|
|
110
|
+
rel: "medium_discount_image",
|
|
111
|
+
href: "https://uploads-ssl.webflow.com/5f023ba9549ac22870f32943/5f1333ae5a496b0e0476975e_dintero-logo.svg",
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
metadata: {
|
|
115
|
+
label: "Før: 100,-",
|
|
116
|
+
subtitle: "Ukens tilbud",
|
|
117
|
+
campaign_id: 1,
|
|
118
|
+
},
|
|
119
|
+
active: true,
|
|
117
120
|
},
|
|
118
|
-
|
|
119
|
-
}]
|
|
121
|
+
],
|
|
120
122
|
});
|
|
121
123
|
</script>
|
|
122
124
|
```
|
|
@@ -131,7 +133,6 @@ The behaviour of opening links can be adjusted using `linkTarget` in the configu
|
|
|
131
133
|
|
|
132
134
|
`_blank` will open the webshop link in a new tab.
|
|
133
135
|
|
|
134
|
-
|
|
135
136
|
```html
|
|
136
137
|
<script type="text/javascript">
|
|
137
138
|
const container = document.getElementById("checkout-container");
|
|
@@ -169,8 +170,8 @@ All major modern browsers above version `N - 1`, where `N` is the most recent ve
|
|
|
169
170
|
## Building from source
|
|
170
171
|
|
|
171
172
|
```bash
|
|
172
|
-
|
|
173
|
-
|
|
173
|
+
yarn install
|
|
174
|
+
yarn run build
|
|
174
175
|
```
|
|
175
176
|
|
|
176
177
|
### Creating a new release
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Configuration, Embed } from "./types";
|
|
1
|
+
import { Configuration, Embed } from "./types.js";
|
|
2
2
|
export declare const embed: (configuration: Configuration) => Promise<Embed>;
|
|
@@ -13,21 +13,21 @@ export interface Item {
|
|
|
13
13
|
export interface Limitation {
|
|
14
14
|
/**
|
|
15
15
|
* Limit the discount to hours of the day
|
|
16
|
-
*
|
|
16
|
+
*
|
|
17
17
|
*/
|
|
18
18
|
discount_hours?: {
|
|
19
19
|
/**
|
|
20
20
|
* The timezone identifier for the hour start/end, see
|
|
21
21
|
* https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
|
22
22
|
* for examples. DST is handled when using a Timezone with DST.
|
|
23
|
-
*
|
|
23
|
+
*
|
|
24
24
|
*/
|
|
25
25
|
timezone?: string;
|
|
26
26
|
/**
|
|
27
27
|
* an array of periods, day and time when discount will be
|
|
28
28
|
* available. Multiple periods for one day is accepted.
|
|
29
29
|
* Any hour of purchase is accepted if the array is empty.
|
|
30
|
-
*
|
|
30
|
+
*
|
|
31
31
|
*/
|
|
32
32
|
hours: {
|
|
33
33
|
day: "mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun";
|
|
@@ -46,7 +46,7 @@ export interface Limitation {
|
|
|
46
46
|
/**
|
|
47
47
|
* Limit the number of rewards to be given in a purchase
|
|
48
48
|
* where multiple receipt items match the requirement
|
|
49
|
-
*
|
|
49
|
+
*
|
|
50
50
|
* example:
|
|
51
51
|
* 1
|
|
52
52
|
*/
|
|
@@ -54,30 +54,33 @@ export interface Limitation {
|
|
|
54
54
|
/**
|
|
55
55
|
* Limit how many other discounts can be combined in a purchase
|
|
56
56
|
* where multiple discounts are applicable.
|
|
57
|
-
*
|
|
57
|
+
*
|
|
58
58
|
*/
|
|
59
59
|
discount_combination?: -1 | 0;
|
|
60
60
|
/**
|
|
61
61
|
* Limit what items in the purchase is eligible for this discount
|
|
62
|
-
*
|
|
62
|
+
*
|
|
63
63
|
*/
|
|
64
|
-
discount_eligible?:
|
|
64
|
+
discount_eligible?:
|
|
65
|
+
| "item_eligible_for_discount"
|
|
66
|
+
| "item_eligible_for_discount_no_discount"
|
|
67
|
+
| "receipt_no_discount";
|
|
65
68
|
/**
|
|
66
69
|
* Limit how many purchases the discount can be used
|
|
67
|
-
*
|
|
70
|
+
*
|
|
68
71
|
*/
|
|
69
72
|
discount_repeat_usage?: number;
|
|
70
73
|
/**
|
|
71
74
|
* Number of days between first and last (exceeding count) stamp
|
|
72
75
|
* where reward will be given
|
|
73
|
-
*
|
|
76
|
+
*
|
|
74
77
|
* example:
|
|
75
78
|
* 100
|
|
76
79
|
*/
|
|
77
80
|
stamp_expire_days?: number;
|
|
78
81
|
/**
|
|
79
82
|
* items not eligible for discount.
|
|
80
|
-
*
|
|
83
|
+
*
|
|
81
84
|
*/
|
|
82
85
|
blacklist?: Item[];
|
|
83
86
|
}
|
|
@@ -93,14 +96,14 @@ export type Links = {
|
|
|
93
96
|
href: string; // uri
|
|
94
97
|
/**
|
|
95
98
|
* Specifies the relationship between the discount and the link
|
|
96
|
-
*
|
|
99
|
+
*
|
|
97
100
|
* Following `rel` values are reserved for specific usage
|
|
98
|
-
*
|
|
101
|
+
*
|
|
99
102
|
* - thumbnail_discount_image: link to discount image
|
|
100
103
|
* - medium_discount_image: link to discount image
|
|
101
104
|
* - large_discount_image: link to discount image
|
|
102
105
|
* - webshop: link to site where the discount may be used
|
|
103
|
-
*
|
|
106
|
+
*
|
|
104
107
|
*/
|
|
105
108
|
rel?: string;
|
|
106
109
|
/**
|
|
@@ -112,12 +115,12 @@ export interface StoreRequirement {
|
|
|
112
115
|
id?: string[];
|
|
113
116
|
/**
|
|
114
117
|
* name of the store, aka trade name of the store
|
|
115
|
-
*
|
|
118
|
+
*
|
|
116
119
|
*/
|
|
117
120
|
name?: string[];
|
|
118
121
|
/**
|
|
119
122
|
* Official name of the person or entity that owns the store.
|
|
120
|
-
*
|
|
123
|
+
*
|
|
121
124
|
*/
|
|
122
125
|
business_name?: string[];
|
|
123
126
|
/**
|
|
@@ -148,14 +151,14 @@ export interface StoreRequirement {
|
|
|
148
151
|
/**
|
|
149
152
|
* A four-digit Merchant Category Code (MCC) for the store
|
|
150
153
|
* [ISO 18245:2003](https://www.iso.org/standard/33365.html)
|
|
151
|
-
*
|
|
154
|
+
*
|
|
152
155
|
*/
|
|
153
|
-
mcc?: string /* iso-18245 */
|
|
156
|
+
mcc?: string /* iso-18245 */[];
|
|
154
157
|
/**
|
|
155
158
|
* Ranges of MCC codes to accept the discount for.
|
|
156
159
|
* Multiple ranges are possible.
|
|
157
160
|
* Prefer `mcc` if not a range.
|
|
158
|
-
*
|
|
161
|
+
*
|
|
159
162
|
*/
|
|
160
163
|
mcc_ranges?: {
|
|
161
164
|
/**
|
|
@@ -172,13 +175,13 @@ export interface StoreRequirement {
|
|
|
172
175
|
/**
|
|
173
176
|
* Merchant number associated with the stores
|
|
174
177
|
* payment terminal
|
|
175
|
-
*
|
|
178
|
+
*
|
|
176
179
|
*/
|
|
177
180
|
bax?: string[];
|
|
178
181
|
/**
|
|
179
182
|
* Id to a specific point-of-sale (POS) terminal
|
|
180
183
|
* or workstation
|
|
181
|
-
*
|
|
184
|
+
*
|
|
182
185
|
*/
|
|
183
186
|
terminal_id?: string[];
|
|
184
187
|
}
|
|
@@ -186,7 +189,7 @@ export interface ItemMixProperty {
|
|
|
186
189
|
/**
|
|
187
190
|
* Acceptable items for the mix "item" (`any`). No wildcard `*` is
|
|
188
191
|
* accepted.
|
|
189
|
-
*
|
|
192
|
+
*
|
|
190
193
|
* example:
|
|
191
194
|
* [object Object],[object Object]
|
|
192
195
|
*/
|
|
@@ -204,14 +207,14 @@ export interface ItemMixProperty {
|
|
|
204
207
|
}[];
|
|
205
208
|
/**
|
|
206
209
|
* minimum quantity of given item (match by id or group) by the mix
|
|
207
|
-
*
|
|
210
|
+
*
|
|
208
211
|
*/
|
|
209
212
|
quantity: number;
|
|
210
213
|
/**
|
|
211
214
|
* The item will be eligible for discount when calculating the reward
|
|
212
215
|
* Example: The value of `discount_item_new_price` reward will be the
|
|
213
216
|
* total price of all items in a mix that has the applicable set to `true`
|
|
214
|
-
*
|
|
217
|
+
*
|
|
215
218
|
*/
|
|
216
219
|
reward_eligible: boolean;
|
|
217
220
|
}
|
|
@@ -249,7 +252,7 @@ export interface CustomerRequirement {
|
|
|
249
252
|
}[];
|
|
250
253
|
/**
|
|
251
254
|
* Require customer to be a company matching all properties defined.
|
|
252
|
-
*
|
|
255
|
+
*
|
|
253
256
|
*/
|
|
254
257
|
company?: {
|
|
255
258
|
/**
|
|
@@ -340,7 +343,7 @@ export interface CustomerRequirement {
|
|
|
340
343
|
* limit discount to only receipt where customer status
|
|
341
344
|
* is included in the receipt and match one of the status
|
|
342
345
|
* values required by the discount
|
|
343
|
-
*
|
|
346
|
+
*
|
|
344
347
|
* example:
|
|
345
348
|
* vip
|
|
346
349
|
*/
|
|
@@ -355,23 +358,23 @@ export interface Requirement {
|
|
|
355
358
|
item?: {
|
|
356
359
|
/**
|
|
357
360
|
* minimum number of items
|
|
358
|
-
*
|
|
361
|
+
*
|
|
359
362
|
*/
|
|
360
363
|
quantity?: number;
|
|
361
364
|
/**
|
|
362
365
|
* Required mix items for the discount.
|
|
363
|
-
*
|
|
366
|
+
*
|
|
364
367
|
* A purchase must include `all` the items to fulfill the `item.mixes`
|
|
365
368
|
* requirement.
|
|
366
|
-
*
|
|
369
|
+
*
|
|
367
370
|
*/
|
|
368
371
|
mixes?: ItemMixProperty[];
|
|
369
372
|
/**
|
|
370
373
|
* Required items for the discount
|
|
371
|
-
*
|
|
374
|
+
*
|
|
372
375
|
* A purchase can include `any` of the items to fulfill the `item.items`
|
|
373
376
|
* requirement.
|
|
374
|
-
*
|
|
377
|
+
*
|
|
375
378
|
*/
|
|
376
379
|
items?: Item[];
|
|
377
380
|
};
|
|
@@ -379,18 +382,18 @@ export interface Requirement {
|
|
|
379
382
|
/**
|
|
380
383
|
* Minimum gross amount on purchase.
|
|
381
384
|
* Monetary amount in smallest unit for the currency
|
|
382
|
-
*
|
|
385
|
+
*
|
|
383
386
|
*/
|
|
384
387
|
gross_amount?: number;
|
|
385
388
|
/**
|
|
386
389
|
* List of valid currencies, or `[{"anything-but": ["NOK"]}]` to exclude currencies.
|
|
387
390
|
* Currency format is the three-character [ISO-4217 currency](https://en.wikipedia.org/wiki/ISO_4217).
|
|
388
|
-
*
|
|
391
|
+
*
|
|
389
392
|
*/
|
|
390
393
|
currencies?: any[];
|
|
391
394
|
/**
|
|
392
395
|
* Stamp count required for the reward
|
|
393
|
-
*
|
|
396
|
+
*
|
|
394
397
|
* example:
|
|
395
398
|
* 5
|
|
396
399
|
*/
|
|
@@ -399,7 +402,7 @@ export interface Requirement {
|
|
|
399
402
|
* A code required for the reward. The purchase must include the
|
|
400
403
|
* promotion code in the `receipt.discount_code` property or as
|
|
401
404
|
* an `receipt.item` where the `item.id` is the promotion code.
|
|
402
|
-
*
|
|
405
|
+
*
|
|
403
406
|
* example:
|
|
404
407
|
* TACO
|
|
405
408
|
*/
|
|
@@ -410,7 +413,7 @@ export interface Requirement {
|
|
|
410
413
|
}
|
|
411
414
|
export interface Reward {
|
|
412
415
|
/**
|
|
413
|
-
*
|
|
416
|
+
*
|
|
414
417
|
* Reward Type:
|
|
415
418
|
* * `discount_amount` - value as discount
|
|
416
419
|
* * `discount_percent` - value percentage of gross amount
|
|
@@ -423,18 +426,25 @@ export interface Reward {
|
|
|
423
426
|
* purchase will be available in future purchases (if not limited by usage)
|
|
424
427
|
* * `discount_mix_new_price` - discount as old mix total value (reward_eligible=true)
|
|
425
428
|
* subtracted with value
|
|
426
|
-
*
|
|
429
|
+
*
|
|
427
430
|
*/
|
|
428
|
-
type:
|
|
431
|
+
type:
|
|
432
|
+
| "discount_amount"
|
|
433
|
+
| "discount_percent"
|
|
434
|
+
| "discount_item_new_price"
|
|
435
|
+
| "discount_item_quantity"
|
|
436
|
+
| "discount_item_percent"
|
|
437
|
+
| "discount_mix_new_price"
|
|
438
|
+
| "discount_debit";
|
|
429
439
|
/**
|
|
430
440
|
* The reward value, unit of the value is resolved
|
|
431
441
|
* from the reward type
|
|
432
|
-
*
|
|
442
|
+
*
|
|
433
443
|
* Examples:
|
|
434
444
|
* - Percent: 10.5
|
|
435
445
|
* - Amount: 10000 (amount in smallest unit for the currency)
|
|
436
446
|
* - Quantity: 1
|
|
437
|
-
*
|
|
447
|
+
*
|
|
438
448
|
* example:
|
|
439
449
|
* 10000
|
|
440
450
|
*/
|
|
@@ -442,45 +452,45 @@ export interface Reward {
|
|
|
442
452
|
/**
|
|
443
453
|
* Let the discount reward be calculated from net or gross price.
|
|
444
454
|
* Not applicable for `discount_item_new_price`
|
|
445
|
-
*
|
|
455
|
+
*
|
|
446
456
|
* *Example*:
|
|
447
457
|
* item A à 100,- NOK with existing rebate of 20,-
|
|
448
|
-
*
|
|
458
|
+
*
|
|
449
459
|
* - 10% net reward is 10% of 80,- : 8,-
|
|
450
460
|
* - 10% gross reward is 10% of 100,- : 10,-
|
|
451
|
-
*
|
|
461
|
+
*
|
|
452
462
|
* * *net*: `gross - "any existing discounts"`
|
|
453
463
|
* * *gross*: `"total expense amount, including taxes"`
|
|
454
|
-
*
|
|
464
|
+
*
|
|
455
465
|
*/
|
|
456
466
|
base?: "net" | "gross";
|
|
457
467
|
}
|
|
458
468
|
export interface Discount {
|
|
459
469
|
/**
|
|
460
470
|
* An UUID that uniquely identifies the resource
|
|
461
|
-
*
|
|
471
|
+
*
|
|
462
472
|
*/
|
|
463
473
|
readonly id?: string; // uuid
|
|
464
474
|
/**
|
|
465
475
|
* The date-time when the resource was created
|
|
466
|
-
*
|
|
476
|
+
*
|
|
467
477
|
*/
|
|
468
478
|
readonly created_at?: string; // date-time
|
|
469
479
|
/**
|
|
470
480
|
* The ID of the user/client created the resource
|
|
471
|
-
*
|
|
481
|
+
*
|
|
472
482
|
* example:
|
|
473
483
|
* 1c92f7e1-2897-4d46-bdcc-c127a914fb4e
|
|
474
484
|
*/
|
|
475
485
|
readonly created_by?: string;
|
|
476
486
|
/**
|
|
477
487
|
* The date-time when the resource was last updated
|
|
478
|
-
*
|
|
488
|
+
*
|
|
479
489
|
*/
|
|
480
490
|
readonly updated_at?: string; // date-time
|
|
481
491
|
/**
|
|
482
492
|
* The ID of the user/client created the resource
|
|
483
|
-
*
|
|
493
|
+
*
|
|
484
494
|
* example:
|
|
485
495
|
* 1c92f7e1-2897-4d46-bdcc-c127a914fb4e
|
|
486
496
|
*/
|
|
@@ -488,24 +498,24 @@ export interface Discount {
|
|
|
488
498
|
readonly deleted_at?: string; // date-time
|
|
489
499
|
/**
|
|
490
500
|
* The campaign the rule belongs to
|
|
491
|
-
*
|
|
501
|
+
*
|
|
492
502
|
*/
|
|
493
503
|
campaign_id?: string;
|
|
494
504
|
/**
|
|
495
505
|
* the discount is active and can be available
|
|
496
506
|
* for purchase (if given to any or all customers)
|
|
497
|
-
*
|
|
507
|
+
*
|
|
498
508
|
*/
|
|
499
509
|
active?: boolean;
|
|
500
510
|
/**
|
|
501
511
|
* the discount will be exluded from public discount collection
|
|
502
512
|
* (GET /discounts/public/rules).
|
|
503
|
-
*
|
|
513
|
+
*
|
|
504
514
|
*/
|
|
505
515
|
private?: boolean;
|
|
506
516
|
/**
|
|
507
517
|
* The ID of the user/client that last updated the resource
|
|
508
|
-
*
|
|
518
|
+
*
|
|
509
519
|
* example:
|
|
510
520
|
* 3d1e4824-5474-48e7-a369-4f603fa4c5b8
|
|
511
521
|
*/
|
|
@@ -522,7 +532,7 @@ export interface Discount {
|
|
|
522
532
|
/**
|
|
523
533
|
* Text that should be used when displaying
|
|
524
534
|
* the discount, e.g. on receipt
|
|
525
|
-
*
|
|
535
|
+
*
|
|
526
536
|
* example:
|
|
527
537
|
* Mai Salg
|
|
528
538
|
*/
|
|
@@ -532,7 +542,7 @@ export interface Discount {
|
|
|
532
542
|
* given date. Default behavior is to only return
|
|
533
543
|
* discount to the customer where the current time
|
|
534
544
|
* is between purchase_from and purchase_to
|
|
535
|
-
*
|
|
545
|
+
*
|
|
536
546
|
*/
|
|
537
547
|
visible_from?: string; // date-time
|
|
538
548
|
/**
|
|
@@ -545,53 +555,52 @@ export interface Discount {
|
|
|
545
555
|
reward: Reward;
|
|
546
556
|
/**
|
|
547
557
|
* Additional metadata about the discount
|
|
548
|
-
*
|
|
558
|
+
*
|
|
549
559
|
* example:
|
|
550
560
|
* [object Object]
|
|
551
561
|
*/
|
|
552
562
|
metadata?: {
|
|
553
|
-
[key: string]: any
|
|
563
|
+
[key: string]: any;
|
|
554
564
|
};
|
|
555
565
|
links?: Links;
|
|
556
566
|
}
|
|
557
567
|
|
|
558
568
|
export type Theme = {
|
|
559
|
-
color?: string
|
|
560
|
-
background?: string
|
|
561
|
-
primary?: string
|
|
562
|
-
secondary?: string
|
|
563
|
-
borderRadius?: string
|
|
564
|
-
fontSize?: string
|
|
565
|
-
}
|
|
569
|
+
color?: string;
|
|
570
|
+
background?: string;
|
|
571
|
+
primary?: string;
|
|
572
|
+
secondary?: string;
|
|
573
|
+
borderRadius?: string;
|
|
574
|
+
fontSize?: string;
|
|
575
|
+
};
|
|
566
576
|
|
|
567
577
|
export type Configuration = {
|
|
568
|
-
container: HTMLElement
|
|
569
|
-
language?: string
|
|
578
|
+
container: HTMLElement;
|
|
579
|
+
language?: string;
|
|
570
580
|
currency?: {
|
|
571
|
-
value: string
|
|
572
|
-
position:
|
|
573
|
-
exponent: 2
|
|
574
|
-
}
|
|
575
|
-
theme?: Theme
|
|
581
|
+
value: string;
|
|
582
|
+
position: "prefix" | "suffix";
|
|
583
|
+
exponent: 2;
|
|
584
|
+
};
|
|
585
|
+
theme?: Theme;
|
|
576
586
|
api?: {
|
|
577
|
-
account: string
|
|
578
|
-
key: string
|
|
579
|
-
secret: string
|
|
580
|
-
url: string
|
|
581
|
-
limit?: number
|
|
582
|
-
discountId?: string
|
|
583
|
-
}
|
|
584
|
-
linkTarget?:
|
|
585
|
-
version?: string
|
|
586
|
-
discounts?: Discount[]
|
|
587
|
-
|
|
588
|
-
}
|
|
587
|
+
account: string;
|
|
588
|
+
key: string;
|
|
589
|
+
secret: string;
|
|
590
|
+
url: string;
|
|
591
|
+
limit?: number;
|
|
592
|
+
discountId?: string;
|
|
593
|
+
};
|
|
594
|
+
linkTarget?: "_blank" | "_self";
|
|
595
|
+
version?: string;
|
|
596
|
+
discounts?: Discount[];
|
|
597
|
+
};
|
|
589
598
|
|
|
590
599
|
type TokenResponse = {
|
|
591
|
-
access_token: string
|
|
592
|
-
token_type: string
|
|
593
|
-
}
|
|
600
|
+
access_token: string;
|
|
601
|
+
token_type: string;
|
|
602
|
+
};
|
|
594
603
|
|
|
595
604
|
export type Embed = {
|
|
596
605
|
destroy: () => void;
|
|
597
|
-
}
|
|
606
|
+
};
|