@reactionary/source 0.3.0 → 0.3.1
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/core/src/client/client-builder.ts +3 -7
- package/core/src/client/client.ts +2 -3
- package/core/src/decorators/reactionary.decorator.ts +2 -2
- package/core/src/initialization.ts +8 -3
- package/core/src/providers/analytics.provider.ts +75 -0
- package/core/src/providers/cart.provider.ts +3 -0
- package/core/src/providers/category.provider.ts +1 -0
- package/core/src/schemas/errors/invalid-input.error.ts +1 -1
- package/core/src/schemas/errors/invalid-output.error.ts +1 -1
- package/core/src/schemas/models/identifiers.model.ts +3 -0
- package/core/src/schemas/models/order.model.ts +2 -2
- package/core/src/schemas/mutations/analytics/index.ts +23 -0
- package/core/src/schemas/mutations/analytics/product-add-to-cart.mutation.ts +25 -0
- package/core/src/schemas/mutations/analytics/product-details-view.mutation.ts +14 -0
- package/core/src/schemas/mutations/analytics/product-summary-click.mutation.ts +26 -0
- package/core/src/schemas/mutations/analytics/product-summary-view.mutation.ts +25 -0
- package/core/src/schemas/mutations/analytics/purchase.mutation.ts +14 -0
- package/core/src/schemas/mutations/index.ts +1 -1
- package/core/src/schemas/queries/order-search.query.ts +3 -0
- package/core/src/schemas/session.schema.ts +20 -9
- package/core/src/test/client-builder.spec.ts +60 -0
- package/core/src/zod-utils.ts +3 -1
- package/documentation/{1-purpose.md → docs/1-purpose.md} +4 -0
- package/documentation/docs/8-tracking.md +9 -0
- package/documentation/docs/providers/analytics.provider.md +297 -0
- package/documentation/docs/providers/base.provider.md +118 -0
- package/documentation/docs/providers/cart.provider.md +305 -0
- package/documentation/docs/providers/category.provider.md +244 -0
- package/documentation/docs/providers/checkout.provider.md +315 -0
- package/documentation/docs/providers/identity.provider.md +194 -0
- package/documentation/docs/providers/inventory.provider.md +162 -0
- package/documentation/docs/providers/order-search.provider.md +155 -0
- package/documentation/docs/providers/order.provider.md +160 -0
- package/documentation/docs/providers/price.provider.md +197 -0
- package/documentation/docs/providers/product-search.provider.md +265 -0
- package/documentation/docs/providers/product.provider.md +204 -0
- package/documentation/docs/providers/profile.provider.md +283 -0
- package/documentation/docs/providers/store.provider.md +146 -0
- package/documentation/docs/schemas/schemas.md +1862 -0
- package/documentation/docusaurus.config.js +33 -0
- package/documentation/scripts/generate.ts +52 -0
- package/documentation/sidebars.js +8 -0
- package/documentation/src/css/custom.css +3 -0
- package/documentation/src/pages/index.js +12 -0
- package/eslint.config.mjs +1 -1
- package/examples/node/package.json +6 -6
- package/examples/node/src/basic/basic-node-provider-model-extension.spec.ts +0 -2
- package/package.json +19 -5
- package/providers/algolia/project.json +1 -1
- package/providers/algolia/src/core/initialize.ts +5 -0
- package/providers/algolia/src/providers/analytics.provider.ts +112 -0
- package/providers/algolia/src/providers/index.ts +1 -0
- package/providers/commercetools/project.json +1 -1
- package/providers/commercetools/src/providers/profile.provider.ts +1 -4
- package/providers/fake/project.json +1 -1
- package/providers/fake/src/providers/analytics.provider.ts +5 -0
- package/providers/fake/src/providers/checkout.provider.ts +5 -2
- package/providers/fake/src/providers/product.provider.ts +18 -8
- package/providers/fake/src/test/cart.provider.spec.ts +0 -2
- package/providers/fake/src/test/category.provider.spec.ts +3 -3
- package/providers/fake/src/test/checkout.provider.spec.ts +3 -7
- package/providers/google-analytics/README.md +11 -0
- package/providers/google-analytics/eslint.config.mjs +25 -0
- package/providers/google-analytics/package.json +18 -0
- package/providers/google-analytics/project.json +33 -0
- package/providers/google-analytics/src/core/initialize.ts +16 -0
- package/providers/google-analytics/src/index.ts +4 -0
- package/providers/google-analytics/src/providers/analytics.provider.ts +162 -0
- package/providers/google-analytics/src/schema/capabilities.schema.ts +10 -0
- package/providers/google-analytics/src/schema/configuration.schema.ts +9 -0
- package/providers/google-analytics/src/test/analytics.provider.spec.ts +93 -0
- package/providers/google-analytics/tsconfig.json +24 -0
- package/providers/google-analytics/tsconfig.lib.json +23 -0
- package/providers/google-analytics/tsconfig.spec.json +28 -0
- package/providers/google-analytics/vite.config.ts +26 -0
- package/providers/google-analytics/vitest.config.mts +21 -0
- package/providers/medusa/package.json +3 -10
- package/providers/medusa/project.json +1 -1
- package/providers/medusa/src/providers/profile.provider.ts +5 -15
- package/providers/medusa/src/test/test-utils.ts +0 -1
- package/providers/medusa/tsconfig.json +3 -0
- package/providers/medusa/tsconfig.lib.json +16 -1
- package/providers/meilisearch/project.json +1 -1
- package/providers/posthog/project.json +1 -1
- package/tsconfig.base.json +4 -1
- package/.claude/settings.local.json +0 -28
- package/core/src/schemas/mutations/analytics.mutation.ts +0 -23
- package/providers/algolia/src/test/test-utils.ts +0 -31
- /package/documentation/{2-getting-started.md → docs/2-getting-started.md} +0 -0
- /package/documentation/{3-querying-and-changing-data.md → docs/3-querying-and-changing-data.md} +0 -0
- /package/documentation/{4-product-data.md → docs/4-product-data.md} +0 -0
- /package/documentation/{5-cart-and-checkout.md → docs/5-cart-and-checkout.md} +0 -0
- /package/documentation/{6-product-search.md → docs/6-product-search.md} +0 -0
- /package/documentation/{7-marketing.md → docs/7-marketing.md} +0 -0
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
[**@reactionary/core**](README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@reactionary/core](README.md) / category.provider
|
|
6
|
+
|
|
7
|
+
# category.provider
|
|
8
|
+
|
|
9
|
+
## Foo
|
|
10
|
+
|
|
11
|
+
### `abstract` CategoryProvider
|
|
12
|
+
|
|
13
|
+
Defined in: [category.provider.ts:16](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/category.provider.ts#L16)
|
|
14
|
+
|
|
15
|
+
CategoryProvider
|
|
16
|
+
|
|
17
|
+
This provider allows fetching of single or sets of categories.
|
|
18
|
+
|
|
19
|
+
We only allow fetching one hierachy level at a time, for now. This is to avoid development patterns of "fetch 5000 categories in one go.."
|
|
20
|
+
|
|
21
|
+
#### Extends
|
|
22
|
+
|
|
23
|
+
- [`BaseProvider`](base.provider.md#baseprovider)
|
|
24
|
+
|
|
25
|
+
#### Constructors
|
|
26
|
+
|
|
27
|
+
##### Constructor
|
|
28
|
+
|
|
29
|
+
> **new CategoryProvider**(`cache`, `context`): [`CategoryProvider`](#categoryprovider)
|
|
30
|
+
|
|
31
|
+
Defined in: [base.provider.ts:13](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/base.provider.ts#L13)
|
|
32
|
+
|
|
33
|
+
###### Parameters
|
|
34
|
+
|
|
35
|
+
###### cache
|
|
36
|
+
|
|
37
|
+
`Cache`
|
|
38
|
+
|
|
39
|
+
###### context
|
|
40
|
+
|
|
41
|
+
`RequestContext`
|
|
42
|
+
|
|
43
|
+
###### Returns
|
|
44
|
+
|
|
45
|
+
[`CategoryProvider`](#categoryprovider)
|
|
46
|
+
|
|
47
|
+
###### Inherited from
|
|
48
|
+
|
|
49
|
+
[`BaseProvider`](base.provider.md#baseprovider).[`constructor`](base.provider.md#constructor)
|
|
50
|
+
|
|
51
|
+
#### Properties
|
|
52
|
+
|
|
53
|
+
##### cache
|
|
54
|
+
|
|
55
|
+
> `protected` **cache**: `Cache`
|
|
56
|
+
|
|
57
|
+
Defined in: [base.provider.ts:10](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/base.provider.ts#L10)
|
|
58
|
+
|
|
59
|
+
###### Inherited from
|
|
60
|
+
|
|
61
|
+
[`BaseProvider`](base.provider.md#baseprovider).[`cache`](base.provider.md#cache)
|
|
62
|
+
|
|
63
|
+
##### context
|
|
64
|
+
|
|
65
|
+
> `protected` **context**: `RequestContext`
|
|
66
|
+
|
|
67
|
+
Defined in: [base.provider.ts:11](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/base.provider.ts#L11)
|
|
68
|
+
|
|
69
|
+
###### Inherited from
|
|
70
|
+
|
|
71
|
+
[`BaseProvider`](base.provider.md#baseprovider).[`context`](base.provider.md#context)
|
|
72
|
+
|
|
73
|
+
#### Methods
|
|
74
|
+
|
|
75
|
+
##### findChildCategories()
|
|
76
|
+
|
|
77
|
+
> `abstract` **findChildCategories**(`payload`): `Promise`\<`Result`\<`CategoryPaginatedResult`\>\>
|
|
78
|
+
|
|
79
|
+
Defined in: [category.provider.ts:66](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/category.provider.ts#L66)
|
|
80
|
+
|
|
81
|
+
Finds all child categories of a given category.
|
|
82
|
+
|
|
83
|
+
Usecase: You are rendering a top menu, or mega menu, and you need the show the child categories of a given category.
|
|
84
|
+
|
|
85
|
+
NOTE: it is recommended to create a navigational service, that allows combining CMS and Static pages into this, rather than fetching categories directly.
|
|
86
|
+
|
|
87
|
+
###### Parameters
|
|
88
|
+
|
|
89
|
+
###### payload
|
|
90
|
+
|
|
91
|
+
`CategoryQueryForChildCategories`
|
|
92
|
+
|
|
93
|
+
###### Returns
|
|
94
|
+
|
|
95
|
+
`Promise`\<`Result`\<`CategoryPaginatedResult`\>\>
|
|
96
|
+
|
|
97
|
+
##### findTopCategories()
|
|
98
|
+
|
|
99
|
+
> `abstract` **findTopCategories**(`payload`): `Promise`\<`Result`\<`CategoryPaginatedResult`\>\>
|
|
100
|
+
|
|
101
|
+
Defined in: [category.provider.ts:75](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/category.provider.ts#L75)
|
|
102
|
+
|
|
103
|
+
Returns all top categories, i.e. categories without a parent.
|
|
104
|
+
|
|
105
|
+
Usecase: You are rendering a top menu, or mega menu, and you need the show the top level categories.
|
|
106
|
+
|
|
107
|
+
###### Parameters
|
|
108
|
+
|
|
109
|
+
###### payload
|
|
110
|
+
|
|
111
|
+
`CategoryQueryForTopCategories`
|
|
112
|
+
|
|
113
|
+
###### Returns
|
|
114
|
+
|
|
115
|
+
`Promise`\<`Result`\<`CategoryPaginatedResult`\>\>
|
|
116
|
+
|
|
117
|
+
##### generateCacheKeyForQuery()
|
|
118
|
+
|
|
119
|
+
> `protected` **generateCacheKeyForQuery**(`scope`, `query`): `string`
|
|
120
|
+
|
|
121
|
+
Defined in: [base.provider.ts:32](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/base.provider.ts#L32)
|
|
122
|
+
|
|
123
|
+
###### Parameters
|
|
124
|
+
|
|
125
|
+
###### scope
|
|
126
|
+
|
|
127
|
+
`string`
|
|
128
|
+
|
|
129
|
+
###### query
|
|
130
|
+
|
|
131
|
+
`object`
|
|
132
|
+
|
|
133
|
+
###### Returns
|
|
134
|
+
|
|
135
|
+
`string`
|
|
136
|
+
|
|
137
|
+
###### Inherited from
|
|
138
|
+
|
|
139
|
+
[`BaseProvider`](base.provider.md#baseprovider).[`generateCacheKeyForQuery`](base.provider.md#generatecachekeyforquery)
|
|
140
|
+
|
|
141
|
+
##### generateDependencyIdsForModel()
|
|
142
|
+
|
|
143
|
+
> **generateDependencyIdsForModel**(`model`): `string`[]
|
|
144
|
+
|
|
145
|
+
Defined in: [base.provider.ts:18](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/base.provider.ts#L18)
|
|
146
|
+
|
|
147
|
+
###### Parameters
|
|
148
|
+
|
|
149
|
+
###### model
|
|
150
|
+
|
|
151
|
+
`unknown`
|
|
152
|
+
|
|
153
|
+
###### Returns
|
|
154
|
+
|
|
155
|
+
`string`[]
|
|
156
|
+
|
|
157
|
+
###### Inherited from
|
|
158
|
+
|
|
159
|
+
[`BaseProvider`](base.provider.md#baseprovider).[`generateDependencyIdsForModel`](base.provider.md#generatedependencyidsformodel)
|
|
160
|
+
|
|
161
|
+
##### getBreadcrumbPathToCategory()
|
|
162
|
+
|
|
163
|
+
> `abstract` **getBreadcrumbPathToCategory**(`payload`): `Promise`\<`Result`\<`Category`[]\>\>
|
|
164
|
+
|
|
165
|
+
Defined in: [category.provider.ts:51](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/category.provider.ts#L51)
|
|
166
|
+
|
|
167
|
+
Gets the breadcrumb path to the category, i.e. all parents up to the root.
|
|
168
|
+
The returned order is from root to leaf.
|
|
169
|
+
|
|
170
|
+
Usecase: You are rendering a category or product page, and you need to show the breadcrumb path.
|
|
171
|
+
|
|
172
|
+
###### Parameters
|
|
173
|
+
|
|
174
|
+
###### payload
|
|
175
|
+
|
|
176
|
+
`CategoryQueryForBreadcrumb`
|
|
177
|
+
|
|
178
|
+
###### Returns
|
|
179
|
+
|
|
180
|
+
`Promise`\<`Result`\<`Category`[]\>\>
|
|
181
|
+
|
|
182
|
+
##### getById()
|
|
183
|
+
|
|
184
|
+
> `abstract` **getById**(`payload`): `Promise`\<`Result`\<`Category`, `NotFoundError`\>\>
|
|
185
|
+
|
|
186
|
+
Defined in: [category.provider.ts:32](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/category.provider.ts#L32)
|
|
187
|
+
|
|
188
|
+
Get a single category by its ID. Cannot return null, because HOW did you come across a categories ID that does not exist?
|
|
189
|
+
|
|
190
|
+
DISCUSSION: What do you persist in, say, a CMS or Recommendation engine? The seo slug or the ID?
|
|
191
|
+
We have previous discussed, that the ID is not necessarily the DATABASE id, but rather an externally unique identifier for the category.
|
|
192
|
+
|
|
193
|
+
So, if you persist that externally, you could actually end up with an ID that does not exist in the current system.
|
|
194
|
+
|
|
195
|
+
For now, the result will be en empty category, but we should probably throw an error instead.
|
|
196
|
+
|
|
197
|
+
Use case: You have received a list of category ids from a recommendation engine, and you need to show a tile of this.
|
|
198
|
+
Future optimization: getByIds(ids: CategoryIdentifier[], reqCtx: RequestContext): Promise<T[]>
|
|
199
|
+
|
|
200
|
+
###### Parameters
|
|
201
|
+
|
|
202
|
+
###### payload
|
|
203
|
+
|
|
204
|
+
`CategoryQueryById`
|
|
205
|
+
|
|
206
|
+
###### Returns
|
|
207
|
+
|
|
208
|
+
`Promise`\<`Result`\<`Category`, `NotFoundError`\>\>
|
|
209
|
+
|
|
210
|
+
##### getBySlug()
|
|
211
|
+
|
|
212
|
+
> `abstract` **getBySlug**(`payload`): `Promise`\<`Result`\<`Category`, `NotFoundError`\>\>
|
|
213
|
+
|
|
214
|
+
Defined in: [category.provider.ts:41](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/category.provider.ts#L41)
|
|
215
|
+
|
|
216
|
+
Gets a single category by its seo slug
|
|
217
|
+
|
|
218
|
+
Usecase: You are rendering a category page, and you have the slug from the URL.
|
|
219
|
+
|
|
220
|
+
###### Parameters
|
|
221
|
+
|
|
222
|
+
###### payload
|
|
223
|
+
|
|
224
|
+
`CategoryQueryBySlug`
|
|
225
|
+
|
|
226
|
+
###### Returns
|
|
227
|
+
|
|
228
|
+
`Promise`\<`Result`\<`Category`, `NotFoundError`\>\>
|
|
229
|
+
|
|
230
|
+
##### getResourceName()
|
|
231
|
+
|
|
232
|
+
> `protected` **getResourceName**(): `string`
|
|
233
|
+
|
|
234
|
+
Defined in: [category.provider.ts:78](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/category.provider.ts#L78)
|
|
235
|
+
|
|
236
|
+
Returns the abstract resource name provided by the remote system.
|
|
237
|
+
|
|
238
|
+
###### Returns
|
|
239
|
+
|
|
240
|
+
`string`
|
|
241
|
+
|
|
242
|
+
###### Overrides
|
|
243
|
+
|
|
244
|
+
[`BaseProvider`](base.provider.md#baseprovider).[`getResourceName`](base.provider.md#getresourcename)
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
[**@reactionary/core**](README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@reactionary/core](README.md) / checkout.provider
|
|
6
|
+
|
|
7
|
+
# checkout.provider
|
|
8
|
+
|
|
9
|
+
## Classes
|
|
10
|
+
|
|
11
|
+
### `abstract` CheckoutProvider
|
|
12
|
+
|
|
13
|
+
Defined in: [checkout.provider.ts:8](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/checkout.provider.ts#L8)
|
|
14
|
+
|
|
15
|
+
Base capability provider, responsible for mutations (changes) and queries (fetches)
|
|
16
|
+
for a given business object domain.
|
|
17
|
+
|
|
18
|
+
#### Extends
|
|
19
|
+
|
|
20
|
+
- [`BaseProvider`](base.provider.md#baseprovider)
|
|
21
|
+
|
|
22
|
+
#### Constructors
|
|
23
|
+
|
|
24
|
+
##### Constructor
|
|
25
|
+
|
|
26
|
+
> **new CheckoutProvider**(`cache`, `context`): [`CheckoutProvider`](#checkoutprovider)
|
|
27
|
+
|
|
28
|
+
Defined in: [base.provider.ts:13](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/base.provider.ts#L13)
|
|
29
|
+
|
|
30
|
+
###### Parameters
|
|
31
|
+
|
|
32
|
+
###### cache
|
|
33
|
+
|
|
34
|
+
`Cache`
|
|
35
|
+
|
|
36
|
+
###### context
|
|
37
|
+
|
|
38
|
+
`RequestContext`
|
|
39
|
+
|
|
40
|
+
###### Returns
|
|
41
|
+
|
|
42
|
+
[`CheckoutProvider`](#checkoutprovider)
|
|
43
|
+
|
|
44
|
+
###### Inherited from
|
|
45
|
+
|
|
46
|
+
[`BaseProvider`](base.provider.md#baseprovider).[`constructor`](base.provider.md#constructor)
|
|
47
|
+
|
|
48
|
+
#### Properties
|
|
49
|
+
|
|
50
|
+
##### cache
|
|
51
|
+
|
|
52
|
+
> `protected` **cache**: `Cache`
|
|
53
|
+
|
|
54
|
+
Defined in: [base.provider.ts:10](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/base.provider.ts#L10)
|
|
55
|
+
|
|
56
|
+
###### Inherited from
|
|
57
|
+
|
|
58
|
+
[`BaseProvider`](base.provider.md#baseprovider).[`cache`](base.provider.md#cache)
|
|
59
|
+
|
|
60
|
+
##### context
|
|
61
|
+
|
|
62
|
+
> `protected` **context**: `RequestContext`
|
|
63
|
+
|
|
64
|
+
Defined in: [base.provider.ts:11](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/base.provider.ts#L11)
|
|
65
|
+
|
|
66
|
+
###### Inherited from
|
|
67
|
+
|
|
68
|
+
[`BaseProvider`](base.provider.md#baseprovider).[`context`](base.provider.md#context)
|
|
69
|
+
|
|
70
|
+
#### Methods
|
|
71
|
+
|
|
72
|
+
##### addPaymentInstruction()
|
|
73
|
+
|
|
74
|
+
> `abstract` **addPaymentInstruction**(`payload`): `Promise`\<`Result`\<`Checkout`\>\>
|
|
75
|
+
|
|
76
|
+
Defined in: [checkout.provider.ts:68](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/checkout.provider.ts#L68)
|
|
77
|
+
|
|
78
|
+
Adds a payment instruction to the checkout. This will typically create a payment intent in the payment provider, and return whatever is needed to continue the payment process, e.g. a client secret for Stripe, or a redirect URL for PayPal.
|
|
79
|
+
|
|
80
|
+
Usecase: User has chosen a payment method, and you need to start the payment process.
|
|
81
|
+
|
|
82
|
+
###### Parameters
|
|
83
|
+
|
|
84
|
+
###### payload
|
|
85
|
+
|
|
86
|
+
`CheckoutMutationAddPaymentInstruction`
|
|
87
|
+
|
|
88
|
+
###### Returns
|
|
89
|
+
|
|
90
|
+
`Promise`\<`Result`\<`Checkout`\>\>
|
|
91
|
+
|
|
92
|
+
##### finalizeCheckout()
|
|
93
|
+
|
|
94
|
+
> `abstract` **finalizeCheckout**(`payload`): `Promise`\<`Result`\<`Checkout`\>\>
|
|
95
|
+
|
|
96
|
+
Defined in: [checkout.provider.ts:100](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/checkout.provider.ts#L100)
|
|
97
|
+
|
|
98
|
+
Finalizes the checkout process. This typically involves creating an order from the checkout and processing payment.
|
|
99
|
+
|
|
100
|
+
Usecase: User has completed all necessary steps in the checkout process and is ready to place the order.
|
|
101
|
+
|
|
102
|
+
###### Parameters
|
|
103
|
+
|
|
104
|
+
###### payload
|
|
105
|
+
|
|
106
|
+
`CheckoutMutationFinalizeCheckout`
|
|
107
|
+
|
|
108
|
+
###### Returns
|
|
109
|
+
|
|
110
|
+
`Promise`\<`Result`\<`Checkout`\>\>
|
|
111
|
+
|
|
112
|
+
##### generateCacheKeyForQuery()
|
|
113
|
+
|
|
114
|
+
> `protected` **generateCacheKeyForQuery**(`scope`, `query`): `string`
|
|
115
|
+
|
|
116
|
+
Defined in: [base.provider.ts:32](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/base.provider.ts#L32)
|
|
117
|
+
|
|
118
|
+
###### Parameters
|
|
119
|
+
|
|
120
|
+
###### scope
|
|
121
|
+
|
|
122
|
+
`string`
|
|
123
|
+
|
|
124
|
+
###### query
|
|
125
|
+
|
|
126
|
+
`object`
|
|
127
|
+
|
|
128
|
+
###### Returns
|
|
129
|
+
|
|
130
|
+
`string`
|
|
131
|
+
|
|
132
|
+
###### Inherited from
|
|
133
|
+
|
|
134
|
+
[`BaseProvider`](base.provider.md#baseprovider).[`generateCacheKeyForQuery`](base.provider.md#generatecachekeyforquery)
|
|
135
|
+
|
|
136
|
+
##### generateDependencyIdsForModel()
|
|
137
|
+
|
|
138
|
+
> **generateDependencyIdsForModel**(`model`): `string`[]
|
|
139
|
+
|
|
140
|
+
Defined in: [base.provider.ts:18](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/base.provider.ts#L18)
|
|
141
|
+
|
|
142
|
+
###### Parameters
|
|
143
|
+
|
|
144
|
+
###### model
|
|
145
|
+
|
|
146
|
+
`unknown`
|
|
147
|
+
|
|
148
|
+
###### Returns
|
|
149
|
+
|
|
150
|
+
`string`[]
|
|
151
|
+
|
|
152
|
+
###### Inherited from
|
|
153
|
+
|
|
154
|
+
[`BaseProvider`](base.provider.md#baseprovider).[`generateDependencyIdsForModel`](base.provider.md#generatedependencyidsformodel)
|
|
155
|
+
|
|
156
|
+
##### getAvailablePaymentMethods()
|
|
157
|
+
|
|
158
|
+
> `abstract` **getAvailablePaymentMethods**(`payload`): `Promise`\<`Result`\<`PaymentMethod`[]\>\>
|
|
159
|
+
|
|
160
|
+
Defined in: [checkout.provider.ts:60](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/checkout.provider.ts#L60)
|
|
161
|
+
|
|
162
|
+
Returns all available payment methods for the given checkout. This will typically depend mostly on the billing address and jurisdiction.
|
|
163
|
+
|
|
164
|
+
Usecase: User has chosen shipping method, and you need to show available payment methods.
|
|
165
|
+
|
|
166
|
+
###### Parameters
|
|
167
|
+
|
|
168
|
+
###### payload
|
|
169
|
+
|
|
170
|
+
`CheckoutQueryForAvailablePaymentMethods`
|
|
171
|
+
|
|
172
|
+
###### Returns
|
|
173
|
+
|
|
174
|
+
`Promise`\<`Result`\<`PaymentMethod`[]\>\>
|
|
175
|
+
|
|
176
|
+
##### getAvailableShippingMethods()
|
|
177
|
+
|
|
178
|
+
> `abstract` **getAvailableShippingMethods**(`payload`): `Promise`\<`Result`\<`ShippingMethod`[]\>\>
|
|
179
|
+
|
|
180
|
+
Defined in: [checkout.provider.ts:50](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/checkout.provider.ts#L50)
|
|
181
|
+
|
|
182
|
+
Returns all available shipping methods for the given checkout. This will typically depend on the shipping address, and possibly also the items in the checkout.
|
|
183
|
+
|
|
184
|
+
Usecase: User has filled out shipping address, and you need to show available shipping methods.
|
|
185
|
+
|
|
186
|
+
###### Parameters
|
|
187
|
+
|
|
188
|
+
###### payload
|
|
189
|
+
|
|
190
|
+
`CheckoutQueryForAvailableShippingMethods`
|
|
191
|
+
|
|
192
|
+
###### Returns
|
|
193
|
+
|
|
194
|
+
`Promise`\<`Result`\<`ShippingMethod`[]\>\>
|
|
195
|
+
|
|
196
|
+
##### getById()
|
|
197
|
+
|
|
198
|
+
> `abstract` **getById**(`payload`): `Promise`\<`Result`\<`Checkout`, `NotFoundError`\>\>
|
|
199
|
+
|
|
200
|
+
Defined in: [checkout.provider.ts:30](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/checkout.provider.ts#L30)
|
|
201
|
+
|
|
202
|
+
Fetches an existing checkout by its identifier.
|
|
203
|
+
|
|
204
|
+
Usecase: User has navigated to the checkout page, or reloaded on it , or has been redirected back from the payment provider.
|
|
205
|
+
|
|
206
|
+
###### Parameters
|
|
207
|
+
|
|
208
|
+
###### payload
|
|
209
|
+
|
|
210
|
+
`CheckoutQueryById`
|
|
211
|
+
|
|
212
|
+
###### Returns
|
|
213
|
+
|
|
214
|
+
`Promise`\<`Result`\<`Checkout`, `NotFoundError`\>\>
|
|
215
|
+
|
|
216
|
+
##### getResourceName()
|
|
217
|
+
|
|
218
|
+
> **getResourceName**(): `string`
|
|
219
|
+
|
|
220
|
+
Defined in: [checkout.provider.ts:103](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/checkout.provider.ts#L103)
|
|
221
|
+
|
|
222
|
+
Returns the abstract resource name provided by the remote system.
|
|
223
|
+
|
|
224
|
+
###### Returns
|
|
225
|
+
|
|
226
|
+
`string`
|
|
227
|
+
|
|
228
|
+
###### Overrides
|
|
229
|
+
|
|
230
|
+
[`BaseProvider`](base.provider.md#baseprovider).[`getResourceName`](base.provider.md#getresourcename)
|
|
231
|
+
|
|
232
|
+
##### initiateCheckoutForCart()
|
|
233
|
+
|
|
234
|
+
> `abstract` **initiateCheckoutForCart**(`payload`): `Promise`\<`Result`\<`Checkout`\>\>
|
|
235
|
+
|
|
236
|
+
Defined in: [checkout.provider.ts:20](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/checkout.provider.ts#L20)
|
|
237
|
+
|
|
238
|
+
This starts a new checkout session for the given cart. The checkout might duplicate the cart, or just reference it, depending on implementation, but changes to the cart,
|
|
239
|
+
is not reflected in the checkout, and vice versa. The checkout is a snapshot of the cart at the time of initiation.
|
|
240
|
+
The checkout will typically copy over addresses from the user profile, if available, or from the anonymous profile in the session.
|
|
241
|
+
|
|
242
|
+
Usecase: User has filled out cart, and is ready to checkout. You call this to create a checkout object, that you can then use to set shipping method, payment method etc.
|
|
243
|
+
|
|
244
|
+
###### Parameters
|
|
245
|
+
|
|
246
|
+
###### payload
|
|
247
|
+
|
|
248
|
+
`CheckoutMutationInitiateCheckout`
|
|
249
|
+
|
|
250
|
+
###### Returns
|
|
251
|
+
|
|
252
|
+
`Promise`\<`Result`\<`Checkout`\>\>
|
|
253
|
+
|
|
254
|
+
##### removePaymentInstruction()
|
|
255
|
+
|
|
256
|
+
> `abstract` **removePaymentInstruction**(`payload`): `Promise`\<`Result`\<`Checkout`\>\>
|
|
257
|
+
|
|
258
|
+
Defined in: [checkout.provider.ts:76](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/checkout.provider.ts#L76)
|
|
259
|
+
|
|
260
|
+
Removes a payment instruction from the checkout. This will typically void the payment intent in the payment provider, and remove the payment instruction from the checkout.
|
|
261
|
+
|
|
262
|
+
Usecase: User has decided to change payment method, or has cancelled the payment process.
|
|
263
|
+
|
|
264
|
+
###### Parameters
|
|
265
|
+
|
|
266
|
+
###### payload
|
|
267
|
+
|
|
268
|
+
`CheckoutMutationRemovePaymentInstruction`
|
|
269
|
+
|
|
270
|
+
###### Returns
|
|
271
|
+
|
|
272
|
+
`Promise`\<`Result`\<`Checkout`\>\>
|
|
273
|
+
|
|
274
|
+
##### setShippingAddress()
|
|
275
|
+
|
|
276
|
+
> `abstract` **setShippingAddress**(`payload`): `Promise`\<`Result`\<`Checkout`\>\>
|
|
277
|
+
|
|
278
|
+
Defined in: [checkout.provider.ts:40](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/checkout.provider.ts#L40)
|
|
279
|
+
|
|
280
|
+
Updates the shipping address for the checkout and recalculates the shipping methods and totals.
|
|
281
|
+
|
|
282
|
+
Usecase: User has chosen home delivery and you have allowed them to change the address on the checkout page.
|
|
283
|
+
|
|
284
|
+
NOTE: Unsure this is really needed.
|
|
285
|
+
|
|
286
|
+
###### Parameters
|
|
287
|
+
|
|
288
|
+
###### payload
|
|
289
|
+
|
|
290
|
+
`CheckoutMutationSetShippingAddress`
|
|
291
|
+
|
|
292
|
+
###### Returns
|
|
293
|
+
|
|
294
|
+
`Promise`\<`Result`\<`Checkout`\>\>
|
|
295
|
+
|
|
296
|
+
##### setShippingInstruction()
|
|
297
|
+
|
|
298
|
+
> `abstract` **setShippingInstruction**(`payload`): `Promise`\<`Result`\<`Checkout`\>\>
|
|
299
|
+
|
|
300
|
+
Defined in: [checkout.provider.ts:90](https://github.com/Solteq/reactionary/blob/ca9304f3dfc56eb7283e5bdf90b26f13d42dce7d/core/src/providers/checkout.provider.ts#L90)
|
|
301
|
+
|
|
302
|
+
Sets the shipping method and optional pickup point for the checkout. The pickup point can be a physical store, a locker, or similar.
|
|
303
|
+
If it is unset, it means home delivery to the shipping address.
|
|
304
|
+
|
|
305
|
+
Usecase: record all the users shipping choices, and any special instructions they may have added.
|
|
306
|
+
|
|
307
|
+
###### Parameters
|
|
308
|
+
|
|
309
|
+
###### payload
|
|
310
|
+
|
|
311
|
+
`CheckoutMutationSetShippingInstruction`
|
|
312
|
+
|
|
313
|
+
###### Returns
|
|
314
|
+
|
|
315
|
+
`Promise`\<`Result`\<`Checkout`\>\>
|