@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 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 { shopifyConnector } from '@tallyui/connector-shopify';
54
+ * import { createShopifyConnector } from '@tallyui/connector-shopify';
54
55
  * import { ConnectorProvider } from '@tallyui/core';
55
56
  *
56
- * <ConnectorProvider connector={shopifyConnector}>
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
- var shopifyConnector = {
260
- id: "shopify",
261
- name: "Shopify",
262
- description: "Connect to Shopify stores via the Admin REST API",
263
- icon: void 0,
264
- auth: {
265
- type: "Shopify Admin API",
266
- fields: [
267
- {
268
- key: "store",
269
- label: "Store Name",
270
- type: "text",
271
- placeholder: "my-store (from my-store.myshopify.com)",
272
- required: true
273
- },
274
- {
275
- key: "access_token",
276
- label: "Access Token",
277
- type: "password",
278
- placeholder: "shpat_...",
279
- required: true
280
- }
281
- ],
282
- getHeaders: (credentials) => ({
283
- "X-Shopify-Access-Token": credentials.access_token,
284
- "Content-Type": "application/json"
285
- })
286
- },
287
- schemas: {
288
- products: shopifyProductSchema
289
- },
290
- traits: {
291
- product: shopifyProductTraits
292
- },
293
- sync: {
294
- products: shopifyProductSync
295
- },
296
- replication: {
297
- products: shopifyProductReplication
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.20.0",
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": "^3.20.0"
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 { shopifyConnector } from '@tallyui/connector-shopify';
16
+ * import { createShopifyConnector } from '@tallyui/connector-shopify';
16
17
  * import { ConnectorProvider } from '@tallyui/core';
17
18
  *
18
- * <ConnectorProvider connector={shopifyConnector}>
19
+ * const connector = useMemo(() => createShopifyConnector(), [store]);
20
+ * <ConnectorProvider connector={connector}>
19
21
  * <App />
20
22
  * </ConnectorProvider>
21
23
  * ```
22
24
  */
23
- export const shopifyConnector: TallyConnector = {
24
- id: 'shopify',
25
- name: 'Shopify',
26
- description: 'Connect to Shopify stores via the Admin REST API',
27
- icon: undefined,
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
- auth: {
30
- type: 'Shopify Admin API',
31
- fields: [
32
- {
33
- key: 'store',
34
- label: 'Store Name',
35
- type: 'text',
36
- placeholder: 'my-store (from my-store.myshopify.com)',
37
- required: true,
38
- },
39
- {
40
- key: 'access_token',
41
- label: 'Access Token',
42
- type: 'password',
43
- placeholder: 'shpat_...',
44
- required: true,
45
- },
46
- ],
47
- getHeaders: (credentials) => ({
48
- 'X-Shopify-Access-Token': credentials.access_token,
49
- 'Content-Type': 'application/json',
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
- schemas: {
54
- products: shopifyProductSchema,
55
- },
56
+ schemas: {
57
+ products: shopifyProductSchema,
58
+ },
56
59
 
57
- traits: {
58
- product: shopifyProductTraits,
59
- },
60
+ traits: {
61
+ product: shopifyProductTraits,
62
+ },
60
63
 
61
- sync: {
62
- products: shopifyProductSync,
63
- },
64
+ sync: {
65
+ products: shopifyProductSync,
66
+ },
64
67
 
65
- replication: {
66
- products: shopifyProductReplication,
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';