@tallyui/connector-shopify 3.20.0 → 4.0.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/dist/index.d.ts +9 -3
- package/dist/index.js +45 -41
- package/package.json +3 -4
- package/src/index.ts +52 -43
package/dist/index.d.ts
CHANGED
|
@@ -48,16 +48,22 @@ declare const shopifyProductReplication: ReplicationAdapter<any, ShopifyProductC
|
|
|
48
48
|
*
|
|
49
49
|
* Connects to Shopify stores via the Admin REST API.
|
|
50
50
|
* Products are stored in RxDB using a schema that mirrors the Shopify API shape.
|
|
51
|
+
* Build one per store session, as the other connectors' factories do.
|
|
51
52
|
*
|
|
52
53
|
* ```ts
|
|
53
|
-
* import {
|
|
54
|
+
* import { createShopifyConnector } from '@tallyui/connector-shopify';
|
|
54
55
|
* import { ConnectorProvider } from '@tallyui/core';
|
|
55
56
|
*
|
|
56
|
-
*
|
|
57
|
+
* const connector = useMemo(() => createShopifyConnector(), [store]);
|
|
58
|
+
* <ConnectorProvider connector={connector}>
|
|
57
59
|
* <App />
|
|
58
60
|
* </ConnectorProvider>
|
|
59
61
|
* ```
|
|
60
62
|
*/
|
|
63
|
+
declare function createShopifyConnector(): TallyConnector;
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated Use createShopifyConnector(), the factory every other connector has.
|
|
66
|
+
*/
|
|
61
67
|
declare const shopifyConnector: TallyConnector;
|
|
62
68
|
|
|
63
|
-
export { shopifyConnector, shopifyProductReplication, shopifyProductSchema, shopifyProductSync, shopifyProductTraits };
|
|
69
|
+
export { createShopifyConnector, shopifyConnector, shopifyProductReplication, shopifyProductSchema, shopifyProductSync, shopifyProductTraits };
|
package/dist/index.js
CHANGED
|
@@ -256,48 +256,52 @@ var shopifyProductSync = {
|
|
|
256
256
|
};
|
|
257
257
|
|
|
258
258
|
// src/index.ts
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}
|
|
259
|
+
function createShopifyConnector() {
|
|
260
|
+
return {
|
|
261
|
+
id: "shopify",
|
|
262
|
+
name: "Shopify",
|
|
263
|
+
description: "Connect to Shopify stores via the Admin REST API",
|
|
264
|
+
icon: void 0,
|
|
265
|
+
auth: {
|
|
266
|
+
type: "Shopify Admin API",
|
|
267
|
+
fields: [
|
|
268
|
+
{
|
|
269
|
+
key: "store",
|
|
270
|
+
label: "Store Name",
|
|
271
|
+
type: "text",
|
|
272
|
+
placeholder: "my-store (from my-store.myshopify.com)",
|
|
273
|
+
required: true
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
key: "access_token",
|
|
277
|
+
label: "Access Token",
|
|
278
|
+
type: "password",
|
|
279
|
+
placeholder: "shpat_...",
|
|
280
|
+
required: true
|
|
281
|
+
}
|
|
282
|
+
],
|
|
283
|
+
getHeaders: (credentials) => ({
|
|
284
|
+
"X-Shopify-Access-Token": credentials.access_token,
|
|
285
|
+
"Content-Type": "application/json"
|
|
286
|
+
})
|
|
287
|
+
},
|
|
288
|
+
schemas: {
|
|
289
|
+
products: shopifyProductSchema
|
|
290
|
+
},
|
|
291
|
+
traits: {
|
|
292
|
+
product: shopifyProductTraits
|
|
293
|
+
},
|
|
294
|
+
sync: {
|
|
295
|
+
products: shopifyProductSync
|
|
296
|
+
},
|
|
297
|
+
replication: {
|
|
298
|
+
products: shopifyProductReplication
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
var shopifyConnector = createShopifyConnector();
|
|
300
303
|
export {
|
|
304
|
+
createShopifyConnector,
|
|
301
305
|
shopifyConnector,
|
|
302
306
|
shopifyProductReplication,
|
|
303
307
|
shopifyProductSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tallyui/connector-shopify",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shopify connector for Tally UI",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -26,14 +26,13 @@
|
|
|
26
26
|
"directory": "connectors/shopify"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@tallyui/core": "^
|
|
29
|
+
"@tallyui/core": "^4.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"rxdb": "17.5.0"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "tsup",
|
|
36
|
-
"typecheck": "tsc --noEmit"
|
|
37
|
-
"test": "echo \"no tests yet\""
|
|
36
|
+
"typecheck": "tsc --noEmit"
|
|
38
37
|
}
|
|
39
38
|
}
|
package/src/index.ts
CHANGED
|
@@ -10,62 +10,71 @@ import { shopifyProductReplication } from './replication/products';
|
|
|
10
10
|
*
|
|
11
11
|
* Connects to Shopify stores via the Admin REST API.
|
|
12
12
|
* Products are stored in RxDB using a schema that mirrors the Shopify API shape.
|
|
13
|
+
* Build one per store session, as the other connectors' factories do.
|
|
13
14
|
*
|
|
14
15
|
* ```ts
|
|
15
|
-
* import {
|
|
16
|
+
* import { createShopifyConnector } from '@tallyui/connector-shopify';
|
|
16
17
|
* import { ConnectorProvider } from '@tallyui/core';
|
|
17
18
|
*
|
|
18
|
-
*
|
|
19
|
+
* const connector = useMemo(() => createShopifyConnector(), [store]);
|
|
20
|
+
* <ConnectorProvider connector={connector}>
|
|
19
21
|
* <App />
|
|
20
22
|
* </ConnectorProvider>
|
|
21
23
|
* ```
|
|
22
24
|
*/
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
export function createShopifyConnector(): TallyConnector {
|
|
26
|
+
return {
|
|
27
|
+
id: 'shopify',
|
|
28
|
+
name: 'Shopify',
|
|
29
|
+
description: 'Connect to Shopify stores via the Admin REST API',
|
|
30
|
+
icon: undefined,
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
32
|
+
auth: {
|
|
33
|
+
type: 'Shopify Admin API',
|
|
34
|
+
fields: [
|
|
35
|
+
{
|
|
36
|
+
key: 'store',
|
|
37
|
+
label: 'Store Name',
|
|
38
|
+
type: 'text',
|
|
39
|
+
placeholder: 'my-store (from my-store.myshopify.com)',
|
|
40
|
+
required: true,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
key: 'access_token',
|
|
44
|
+
label: 'Access Token',
|
|
45
|
+
type: 'password',
|
|
46
|
+
placeholder: 'shpat_...',
|
|
47
|
+
required: true,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
getHeaders: (credentials) => ({
|
|
51
|
+
'X-Shopify-Access-Token': credentials.access_token,
|
|
52
|
+
'Content-Type': 'application/json',
|
|
53
|
+
}),
|
|
54
|
+
},
|
|
52
55
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
schemas: {
|
|
57
|
+
products: shopifyProductSchema,
|
|
58
|
+
},
|
|
56
59
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
traits: {
|
|
61
|
+
product: shopifyProductTraits,
|
|
62
|
+
},
|
|
60
63
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
sync: {
|
|
65
|
+
products: shopifyProductSync,
|
|
66
|
+
},
|
|
64
67
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
};
|
|
68
|
+
replication: {
|
|
69
|
+
products: shopifyProductReplication,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated Use createShopifyConnector(), the factory every other connector has.
|
|
76
|
+
*/
|
|
77
|
+
export const shopifyConnector: TallyConnector = createShopifyConnector();
|
|
69
78
|
|
|
70
79
|
// Re-export pieces for advanced usage
|
|
71
80
|
export { shopifyProductSchema } from './schemas/products';
|