@fayz-ai/plugin-shop 0.9.1 → 0.10.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.
Files changed (119) hide show
  1. package/dist/ShopPage-ZBJRNMKQ.js +2942 -0
  2. package/dist/ShopPage-ZBJRNMKQ.js.map +1 -0
  3. package/dist/analytics/cards.d.ts +3 -0
  4. package/dist/analytics/cards.d.ts.map +1 -0
  5. package/dist/chunk-EW4XJRA2.js +835 -0
  6. package/dist/chunk-EW4XJRA2.js.map +1 -0
  7. package/dist/data/registries.d.ts +53 -0
  8. package/dist/data/registries.d.ts.map +1 -0
  9. package/dist/data/registry-routes.d.ts +21 -0
  10. package/dist/data/registry-routes.d.ts.map +1 -0
  11. package/dist/data/shippingProfileDataProvider.d.ts +19 -0
  12. package/dist/data/shippingProfileDataProvider.d.ts.map +1 -0
  13. package/dist/data/stockLocationDataProvider.d.ts +13 -0
  14. package/dist/data/stockLocationDataProvider.d.ts.map +1 -0
  15. package/dist/index.d.ts +15 -0
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +4446 -504
  18. package/dist/index.js.map +1 -1
  19. package/dist/integrations/abacatepay/connectorDef.d.ts +41 -0
  20. package/dist/integrations/abacatepay/connectorDef.d.ts.map +1 -0
  21. package/dist/integrations/appmax/connectorDef.d.ts +28 -0
  22. package/dist/integrations/appmax/connectorDef.d.ts.map +1 -0
  23. package/dist/integrations/bling/connectorDef.d.ts +10 -0
  24. package/dist/integrations/bling/connectorDef.d.ts.map +1 -0
  25. package/dist/integrations/bling/data.d.ts +61 -0
  26. package/dist/integrations/bling/data.d.ts.map +1 -0
  27. package/dist/integrations/bling/inbound.d.ts +97 -0
  28. package/dist/integrations/bling/inbound.d.ts.map +1 -0
  29. package/dist/integrations/bling/index.d.ts +9 -0
  30. package/dist/integrations/bling/index.d.ts.map +1 -0
  31. package/dist/integrations/bling/limits.d.ts +33 -0
  32. package/dist/integrations/bling/limits.d.ts.map +1 -0
  33. package/dist/integrations/bling/mapping.d.ts +10 -0
  34. package/dist/integrations/bling/mapping.d.ts.map +1 -0
  35. package/dist/integrations/bling/sync.d.ts +70 -0
  36. package/dist/integrations/bling/sync.d.ts.map +1 -0
  37. package/dist/integrations/bling/types.d.ts +59 -0
  38. package/dist/integrations/bling/types.d.ts.map +1 -0
  39. package/dist/integrations/melhor-envio/connectorDef.d.ts +38 -0
  40. package/dist/integrations/melhor-envio/connectorDef.d.ts.map +1 -0
  41. package/dist/integrations/melhor-envio/labelProvider.d.ts +4 -0
  42. package/dist/integrations/melhor-envio/labelProvider.d.ts.map +1 -0
  43. package/dist/integrations/stripe-connect/connectorDef.d.ts +17 -0
  44. package/dist/integrations/stripe-connect/connectorDef.d.ts.map +1 -0
  45. package/dist/settings/CheckoutSettings.d.ts +17 -0
  46. package/dist/settings/CheckoutSettings.d.ts.map +1 -0
  47. package/dist/settings/ChoiceCards.d.ts +23 -0
  48. package/dist/settings/ChoiceCards.d.ts.map +1 -0
  49. package/dist/settings/FulfillmentSettings.d.ts +23 -0
  50. package/dist/settings/FulfillmentSettings.d.ts.map +1 -0
  51. package/dist/settings/HandlingSettings.d.ts +17 -0
  52. package/dist/settings/HandlingSettings.d.ts.map +1 -0
  53. package/dist/settings/PackagesSettings.d.ts +22 -0
  54. package/dist/settings/PackagesSettings.d.ts.map +1 -0
  55. package/dist/settings/PaymentProviderRow.d.ts +28 -0
  56. package/dist/settings/PaymentProviderRow.d.ts.map +1 -0
  57. package/dist/settings/PaymentsSettings.d.ts +7 -0
  58. package/dist/settings/PaymentsSettings.d.ts.map +1 -0
  59. package/dist/settings/SettingsState.d.ts +27 -0
  60. package/dist/settings/SettingsState.d.ts.map +1 -0
  61. package/dist/settings/ShippingSettings.d.ts +27 -0
  62. package/dist/settings/ShippingSettings.d.ts.map +1 -0
  63. package/dist/settings/StoreGeneralSettings.d.ts +19 -0
  64. package/dist/settings/StoreGeneralSettings.d.ts.map +1 -0
  65. package/dist/settings/error-message.d.ts +2 -0
  66. package/dist/settings/error-message.d.ts.map +1 -0
  67. package/dist/settings/index.d.ts +12 -0
  68. package/dist/settings/index.d.ts.map +1 -0
  69. package/dist/settings/payment-provider.d.ts +13 -0
  70. package/dist/settings/payment-provider.d.ts.map +1 -0
  71. package/dist/settings/useStoreSettings.d.ts +30 -0
  72. package/dist/settings/useStoreSettings.d.ts.map +1 -0
  73. package/dist/views/AgencySelect.d.ts +17 -0
  74. package/dist/views/AgencySelect.d.ts.map +1 -0
  75. package/dist/views/ContentPage.d.ts.map +1 -1
  76. package/dist/views/FulfillmentProviderSelect.d.ts +14 -0
  77. package/dist/views/FulfillmentProviderSelect.d.ts.map +1 -0
  78. package/dist/views/NewOrderCharge.d.ts +17 -0
  79. package/dist/views/NewOrderCharge.d.ts.map +1 -0
  80. package/dist/views/NewOrderPage.d.ts +9 -0
  81. package/dist/views/NewOrderPage.d.ts.map +1 -0
  82. package/dist/views/OrderDetailView.d.ts +2 -0
  83. package/dist/views/OrderDetailView.d.ts.map +1 -1
  84. package/dist/views/OrderPaymentDetail.d.ts +5 -0
  85. package/dist/views/OrderPaymentDetail.d.ts.map +1 -0
  86. package/dist/views/OrderProviderLinks.d.ts +5 -0
  87. package/dist/views/OrderProviderLinks.d.ts.map +1 -0
  88. package/dist/views/PackageSelect.d.ts +20 -0
  89. package/dist/views/PackageSelect.d.ts.map +1 -0
  90. package/dist/views/ProductImagesTab.d.ts.map +1 -1
  91. package/dist/views/ProductVariantsTab.d.ts +29 -0
  92. package/dist/views/ProductVariantsTab.d.ts.map +1 -0
  93. package/dist/views/SenderLocationModal.d.ts +20 -0
  94. package/dist/views/SenderLocationModal.d.ts.map +1 -0
  95. package/dist/views/ShipOrderForm.d.ts +10 -0
  96. package/dist/views/ShipOrderForm.d.ts.map +1 -0
  97. package/dist/views/ShipWithCarrier.d.ts +18 -0
  98. package/dist/views/ShipWithCarrier.d.ts.map +1 -0
  99. package/dist/views/ShipmentActions.d.ts +11 -0
  100. package/dist/views/ShipmentActions.d.ts.map +1 -0
  101. package/dist/views/ShippingProfileSelect.d.ts +13 -0
  102. package/dist/views/ShippingProfileSelect.d.ts.map +1 -0
  103. package/dist/views/ShopPage.d.ts.map +1 -1
  104. package/dist/views/customerEntity.d.ts.map +1 -1
  105. package/dist/views/eta-label.d.ts +6 -0
  106. package/dist/views/eta-label.d.ts.map +1 -0
  107. package/dist/views/media-links.d.ts +12 -0
  108. package/dist/views/media-links.d.ts.map +1 -0
  109. package/dist/views/new-order-rules.d.ts +55 -0
  110. package/dist/views/new-order-rules.d.ts.map +1 -0
  111. package/dist/views/order-actions.d.ts +4 -0
  112. package/dist/views/order-actions.d.ts.map +1 -0
  113. package/dist/views/productEntity.d.ts.map +1 -1
  114. package/dist/views/shippingZoneEntity.d.ts.map +1 -1
  115. package/package.json +10 -7
  116. package/dist/ShopPage-PVHFKDF3.js +0 -690
  117. package/dist/ShopPage-PVHFKDF3.js.map +0 -1
  118. package/dist/components/ShopSettings.d.ts +0 -15
  119. package/dist/components/ShopSettings.d.ts.map +0 -1
@@ -0,0 +1,41 @@
1
+ import { type ConnectorDefinition, type ConnectorField, type ConnectorSetting } from '@fayz-ai/core';
2
+ export declare const ABACATEPAY_CONNECTOR_ID = "abacatepay";
3
+ /**
4
+ * Six seconds, the same budget AppMax carries and for the same reason: it is
5
+ * spent after the buyer pressed "pagar", where waiting is expected and a
6
+ * premature refusal costs a sale that was about to happen.
7
+ *
8
+ * Measured, not guessed — `POST /v2/transparents/create` answered in 640–830ms
9
+ * from São Paulo on the dev key, before credential redemption and the two
10
+ * database round trips the checkout needs. The budget sits far above that so it
11
+ * fires on a gateway that is actually down, never on a slow-but-alive one.
12
+ */
13
+ export declare const ABACATEPAY_LATENCY_BUDGET_MS = 6000;
14
+ /**
15
+ * The one thing that authorizes the connection.
16
+ *
17
+ * `type: 'password'` is what routes it to the platform's credential sink
18
+ * (packages/admin/.../connect/credentials.ts) instead of to `saveConnection`;
19
+ * `secret: true` states the same thing on the field itself, so the intent
20
+ * survives a future change of input type. Either flag alone is enough — both
21
+ * are here because a payment credential is the wrong place to be terse.
22
+ *
23
+ * The key is per-STORE and carries its own permissions and its own environment,
24
+ * so nothing about it can be inferred, defaulted or shared across the fleet.
25
+ */
26
+ export declare const ABACATEPAY_FIELDS: ConnectorField[];
27
+ /**
28
+ * Which methods the storefront may offer — commercial policy, not a credential.
29
+ *
30
+ * The three the gateway really has, in AbacatePay's own vocabulary (uppercase),
31
+ * because these values travel to it as `method` / `methods`: a translation
32
+ * table between what the merchant picked and what the wire accepts is one more
33
+ * place for a method to silently stop being offered.
34
+ *
35
+ * Required to OPERATE and not to connect: a gateway with no method selected
36
+ * cannot open a charge, so the connection is made and reported as "conectado,
37
+ * falta configurar" (`plg_connections.status = 'pending'`).
38
+ */
39
+ export declare const ABACATEPAY_SETTINGS: ConnectorSetting[];
40
+ export declare const abacatePayConnectorDef: ConnectorDefinition;
41
+ //# sourceMappingURL=connectorDef.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connectorDef.d.ts","sourceRoot":"","sources":["../../../src/integrations/abacatepay/connectorDef.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAKL,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,eAAe,CAAA;AAEtB,eAAO,MAAM,uBAAuB,eAAe,CAAA;AAEnD;;;;;;;;;GASG;AACH,eAAO,MAAM,4BAA4B,OAAO,CAAA;AAEhD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,EAAE,cAAc,EAQ7C,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,EAAE,gBAAgB,EAajD,CAAA;AAoDD,eAAO,MAAM,sBAAsB,EAAE,mBA2FpC,CAAA"}
@@ -0,0 +1,28 @@
1
+ import { type ConnectorDefinition, type ConnectorSetting } from '@fayz-ai/core';
2
+ export declare const APPMAX_CONNECTOR_ID = "appmax";
3
+ /**
4
+ * Six seconds. Longer than the freight budget on purpose: this one is spent
5
+ * after the buyer pressed "pagar", where waiting is expected and a premature
6
+ * refusal costs a sale that was about to happen. It is still a budget — beyond
7
+ * it the buyer is told the payment did not go through, which is true, instead of
8
+ * watching a spinner that resolves into a charge they already gave up on.
9
+ */
10
+ export declare const APPMAX_LATENCY_BUDGET_MS = 6000;
11
+ /**
12
+ * Which methods the storefront may offer — commercial policy, not a credential
13
+ * and not an authorization.
14
+ *
15
+ * It used to be a `ConnectorField` labelled "Formas de pagamento (pix, boleto,
16
+ * credit_card)": a free-text box on the connect screen, which asked a merchant
17
+ * to decide what they accept before they were allowed to plug the gateway in,
18
+ * and then made "passei a aceitar boleto" look like re-authorizing the account.
19
+ * It is a multi-select over the three methods AppMax actually has, so the
20
+ * misspelling that silently offered nothing is not expressible.
21
+ *
22
+ * Required to OPERATE and not to connect: a gateway with no method selected
23
+ * cannot open a session, so the connection is made and reported as "conectado,
24
+ * falta configurar" (`plg_connections.status = 'pending'`).
25
+ */
26
+ export declare const APPMAX_SETTINGS: ConnectorSetting[];
27
+ export declare const appmaxConnectorDef: ConnectorDefinition;
28
+ //# sourceMappingURL=connectorDef.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connectorDef.d.ts","sourceRoot":"","sources":["../../../src/integrations/appmax/connectorDef.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAKL,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACtB,MAAM,eAAe,CAAA;AAGtB,eAAO,MAAM,mBAAmB,WAAW,CAAA;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,OAAO,CAAA;AAE5C;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,EAAE,gBAAgB,EAa7C,CAAA;AA+CD,eAAO,MAAM,kBAAkB,EAAE,mBAgHhC,CAAA"}
@@ -0,0 +1,10 @@
1
+ import type { ConnectorDefinition } from '@fayz-ai/core';
2
+ /**
3
+ * `settingsKeys` and not `fields`: none of these is asked for in a form. Bling
4
+ * authenticates by OAuth, so the connector's own code never sees a credential —
5
+ * the hub routes secrets to the platform, and this connection has no secret
6
+ * field to route in the first place.
7
+ */
8
+ export declare const blingConnectionStore: () => import("@fayz-ai/core").ConnectionStore;
9
+ export declare const blingConnectorDef: ConnectorDefinition;
10
+ //# sourceMappingURL=connectorDef.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connectorDef.d.ts","sourceRoot":"","sources":["../../../src/integrations/bling/connectorDef.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAqBxD;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,+CAG7B,CAAA;AAEJ,eAAO,MAAM,iBAAiB,EAAE,mBAoR/B,CAAA"}
@@ -0,0 +1,61 @@
1
+ import { type ConnectorDelivery } from '@fayz-ai/core';
2
+ /** The edge function that holds every Bling call this connector makes. */
3
+ export declare const BLING_FUNCTION = "bling-sync";
4
+ /** What a push leg answers with. Every field is a count the merchant can check. */
5
+ export interface BlingPushResult {
6
+ runId?: string;
7
+ /** What the run settled as. The toast reads this, not "it did not throw". */
8
+ status?: 'success' | 'partial' | 'error';
9
+ filed: number;
10
+ skipped?: number;
11
+ stockPending?: number;
12
+ considered: number;
13
+ failures?: number;
14
+ message: string;
15
+ }
16
+ export interface BlingPullResult {
17
+ runId?: string;
18
+ fetched: number;
19
+ inserted: number;
20
+ updated: number;
21
+ untouched: number;
22
+ sample: boolean;
23
+ }
24
+ /** Read one product. Writes nothing anywhere — the probe, not a sync. */
25
+ export declare function testBling(): Promise<{
26
+ ok: boolean;
27
+ message?: string;
28
+ }>;
29
+ /** Bring the catalogue down. `sample` is the seconds-long first answer. */
30
+ export declare function pullCatalogue(mode?: 'sample' | 'full'): Promise<BlingPullResult>;
31
+ /** Send the products that exist only here. They come back linked — see the def. */
32
+ export declare function pushCatalogue(): Promise<BlingPushResult>;
33
+ /** Send the buyers who have ordered, as Bling contacts. */
34
+ export declare function pushCustomers(): Promise<BlingPushResult>;
35
+ /** Send every paid order not filed yet, as a pedido de venda. */
36
+ export declare function pushOrders(): Promise<BlingPushResult>;
37
+ /** Lança o saldo dos produtos já vinculados. O reparo de um estoque que não subiu. */
38
+ export declare function pushStock(): Promise<{
39
+ sent: number;
40
+ considered: number;
41
+ message: string;
42
+ }>;
43
+ export declare function pendingProducts(): Promise<number | null>;
44
+ export declare function pendingCustomers(): Promise<number | null>;
45
+ export declare function pendingOrders(): Promise<number | null>;
46
+ /**
47
+ * Which paid orders actually reached Bling — what a run's "12 de 20" cannot say.
48
+ *
49
+ * Read from the LINK TABLE, the same fact the push queue is built on: the link
50
+ * exists exactly when Bling returned an id, so this screen cannot claim
51
+ * "enviado" about something that was not.
52
+ */
53
+ export declare function listOrderDeliveries(limit?: number): Promise<ConnectorDelivery[]>;
54
+ /** Both directions, everything pending. What the clock runs every fifteen minutes. */
55
+ export declare function reconcile(): Promise<{
56
+ pull: BlingPullResult;
57
+ push: Record<string, BlingPushResult | {
58
+ skipped: string;
59
+ }>;
60
+ }>;
61
+ //# sourceMappingURL=data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../src/integrations/bling/data.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,eAAe,CAAA;AAGtB,0EAA0E;AAC1E,eAAO,MAAM,cAAc,eAAe,CAAA;AAE1C,mFAAmF;AACnF,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6EAA6E;IAC7E,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;IACxC,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAA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I,EAAE,eAAe,CAAA;IACrB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC5D,CAAC,CAED"}
@@ -0,0 +1,97 @@
1
+ /** What the platform learned from a Bling OAuth callback. */
2
+ export interface BlingCallback {
3
+ /** Present only when Fayz started the flow. Absent on the Bling-first path. */
4
+ state?: string | null;
5
+ /** Bling's own id for the authorising account. The only stable handle we get. */
6
+ companyId?: string | null;
7
+ }
8
+ export type CallbackRoute =
9
+ /** Fayz started it: the state names the tenant, and the connection is theirs. */
10
+ {
11
+ mode: 'tenant';
12
+ state: string;
13
+ providerAccountKey: string | null;
14
+ }
15
+ /**
16
+ * Bling started it: park the grant against the account, claimable at signup.
17
+ * `source` is what makes the channel measurable instead of anecdotal.
18
+ */
19
+ | {
20
+ mode: 'orphan';
21
+ providerAccountKey: string;
22
+ source: string;
23
+ }
24
+ /** Nothing identifies the grant. Nothing can be done with it later either. */
25
+ | {
26
+ mode: 'reject';
27
+ reason: string;
28
+ };
29
+ /** Where Bling-first connections are attributed from. */
30
+ export declare const BLING_MARKETPLACE_SOURCE = "bling_marketplace";
31
+ /**
32
+ * Decide what a callback becomes. A missing `state` is NOT an error — treating
33
+ * it as one throws away the shopkeeper who arrived from Bling's own storefront.
34
+ */
35
+ export declare function routeCallback(callback: BlingCallback): CallbackRoute;
36
+ /** The identity an orphan connection is stored under until someone claims it. */
37
+ export declare function orphanConnection(route: Extract<CallbackRoute, {
38
+ mode: 'orphan';
39
+ }>): {
40
+ connectorId: string;
41
+ instanceKey: string;
42
+ providerAccountKey: string;
43
+ status: "pending";
44
+ settings: {
45
+ companyId: string;
46
+ source: string;
47
+ stockOwner: "bling";
48
+ };
49
+ };
50
+ export interface WebhookRequest {
51
+ /** Raw body. Signed bytes, so it is verified before it is parsed. */
52
+ body: string;
53
+ signature: string | null;
54
+ /** The account the event belongs to, read after verification. */
55
+ providerAccountKey?: string | null;
56
+ }
57
+ export interface AcceptWebhookOptions {
58
+ /**
59
+ * Constant-time HMAC-SHA256 comparison, INJECTED. No key, no crypto import and
60
+ * no fixture in this repo ever holds one — the secret lives in the platform
61
+ * credential store and is handed to the edge function per call.
62
+ */
63
+ verify(body: string, signature: string | null): Promise<boolean> | boolean;
64
+ /** Find the tenant behind the account. Backed by uq_plg_connections_account_key. */
65
+ resolve(providerAccountKey: string): Promise<{
66
+ tenantId: string;
67
+ connectionId: string;
68
+ } | null>;
69
+ /** Hand the work to the queue. MUST NOT be awaited on the response path. */
70
+ enqueue(job: {
71
+ tenantId: string;
72
+ connectionId: string;
73
+ body: string;
74
+ }): Promise<void> | void;
75
+ onError?(error: unknown): void;
76
+ }
77
+ export interface WebhookVerdict {
78
+ status: number;
79
+ /** Whether work was handed to the queue and is still outstanding. */
80
+ queued: boolean;
81
+ reason?: string;
82
+ }
83
+ /**
84
+ * Answer Bling, then let the work happen.
85
+ *
86
+ * The 200 is not optimism: an unverified body was already rejected and a routed
87
+ * job is already durable. What the 200 declines to wait for is the processing —
88
+ * because a Bling webhook that has not been answered in 5 seconds does not
89
+ * retry, it turns the tenant's integration off, and the tenant finds out weeks
90
+ * later as "Bling stopped working".
91
+ *
92
+ * An unroutable account still answers 200. A 4xx there would make Bling disable
93
+ * a configuration over an account we simply have not been given yet — the
94
+ * orphan case above, arriving by webhook instead of by callback.
95
+ */
96
+ export declare function acceptWebhook(request: WebhookRequest, options: AcceptWebhookOptions): Promise<WebhookVerdict>;
97
+ //# sourceMappingURL=inbound.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbound.d.ts","sourceRoot":"","sources":["../../../src/integrations/bling/inbound.ts"],"names":[],"mappings":"AAmBA,6DAA6D;AAC7D,MAAM,WAAW,aAAa;IAC5B,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1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;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IAC5F,OAAO,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAA;CAC/B;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,qEAAqE;IACrE,MAAM,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC,CAkCnH"}
@@ -0,0 +1,9 @@
1
+ export { blingConnectorDef, blingConnectionStore } from './connectorDef';
2
+ export { BLING_CONNECTOR_ID, BLING_RATE_LIMIT, BLING_MAX_WINDOW_MS, BLING_WINDOW_OVERLAP_MS, BLING_TOKEN_LEAD_MS, BLING_PAGE_SIZE, BLING_SAMPLE_SIZE, BLING_SIGNATURE_HEADER, BLING_WEBHOOK_DEADLINE_MS, } from './limits';
3
+ export { toMirroredProduct } from './mapping';
4
+ export { pullProducts, sampleProducts, firstWindow, windowFor } from './sync';
5
+ export type { PullProductsOptions, PullProductsResult, BlingPageRequest, BlingProductPage } from './sync';
6
+ export { routeCallback, orphanConnection, acceptWebhook, BLING_MARKETPLACE_SOURCE, } from './inbound';
7
+ export type { BlingCallback, CallbackRoute, WebhookRequest, WebhookVerdict, AcceptWebhookOptions } from './inbound';
8
+ export type { BlingProduto, BlingSettings, MirroredProduct } from './types';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integrations/bling/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AACxE,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAC7E,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAA;AACzG,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,wBAAwB,GACzB,MAAM,WAAW,CAAA;AAClB,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AACnH,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA"}
@@ -0,0 +1,33 @@
1
+ import type { RateLimitBudget } from '@fayz-ai/core/connector-runtime';
2
+ export declare const BLING_CONNECTOR_ID = "bling";
3
+ /** Per ACCOUNT, not per tenant: `instance_key` is the Bling company. */
4
+ export declare const BLING_RATE_LIMIT: RateLimitBudget;
5
+ /** Widest date filter Bling accepts. Anything longer answers 400. */
6
+ export declare const BLING_MAX_WINDOW_MS: number;
7
+ /**
8
+ * Re-read this much before the last window's end.
9
+ *
10
+ * Bling stamps `dataAlteracao` at second precision, so a product changed in the
11
+ * same second the window closed is invisible for ever without an overlap. The
12
+ * cost is an idempotent upsert; the cost of not having it is a price that never
13
+ * updates and nobody can explain.
14
+ */
15
+ export declare const BLING_WINDOW_OVERLAP_MS: number;
16
+ /** Renew the token a week early. See the /oauth/token ban above. */
17
+ export declare const BLING_TOKEN_LEAD_MS: number;
18
+ /** Bling's page size for the list endpoints. */
19
+ export declare const BLING_PAGE_SIZE = 100;
20
+ /**
21
+ * A sample is one page, and one page only.
22
+ *
23
+ * At 3 req/s a ten-thousand-product catalogue is close to an hour. A connect
24
+ * screen that waits for it is a connect screen nobody finishes, so the sample
25
+ * answers with enough to design a storefront against and the backfill finishes
26
+ * the mirror behind it.
27
+ */
28
+ export declare const BLING_SAMPLE_SIZE = 100;
29
+ /** Bling signs its webhooks HMAC-SHA256 with the app's client secret. */
30
+ export declare const BLING_SIGNATURE_HEADER = "x-bling-signature-256";
31
+ /** Bling must see a 2xx before this, or it disables the tenant's webhook. */
32
+ export declare const BLING_WEBHOOK_DEADLINE_MS = 5000;
33
+ //# sourceMappingURL=limits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../../src/integrations/bling/limits.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AAEtE,eAAO,MAAM,kBAAkB,UAAU,CAAA;AAEzC,wEAAwE;AACxE,eAAO,MAAM,gBAAgB,EAAE,eAAmD,CAAA;AAElF,qEAAqE;AACrE,eAAO,MAAM,mBAAmB,QAAyB,CAAA;AAEzD;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,QAAc,CAAA;AAElD,oEAAoE;AACpE,eAAO,MAAM,mBAAmB,QAAuB,CAAA;AAEvD,gDAAgD;AAChD,eAAO,MAAM,eAAe,MAAM,CAAA;AAElC;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAA;AAEpC,yEAAyE;AACzE,eAAO,MAAM,sBAAsB,0BAA0B,CAAA;AAE7D,6EAA6E;AAC7E,eAAO,MAAM,yBAAyB,OAAQ,CAAA"}
@@ -0,0 +1,10 @@
1
+ import type { BlingProduto, MirroredProduct } from './types';
2
+ /**
3
+ * One Bling product as the mirror stores it, or null when it carries no id.
4
+ *
5
+ * `situacao` is Bling's own on/off ('A' = ativo). It maps to archived rather
6
+ * than to a delete: an inactive product in Bling is still a product, and this
7
+ * connector has no vocabulary for deletion at all — see `pullProducts`.
8
+ */
9
+ export declare function toMirroredProduct(raw: BlingProduto | null | undefined): MirroredProduct | null;
10
+ //# sourceMappingURL=mapping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../../../src/integrations/bling/mapping.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAQ5D;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,GAAG,eAAe,GAAG,IAAI,CAkB9F"}
@@ -0,0 +1,70 @@
1
+ import { type Completeness, type Cursor, type MirrorRecord, type RateLimiter } from '@fayz-ai/core/connector-runtime';
2
+ import type { SyncResult } from '@fayz-ai/core';
3
+ import type { BlingProduto, MirroredProduct } from './types';
4
+ /** One page of `GET /produtos`, as the caller's transport hands it over. */
5
+ export interface BlingProductPage {
6
+ items: BlingProduto[];
7
+ /** Bling has no next-page token: a short page is the last page. */
8
+ short?: boolean;
9
+ }
10
+ export interface BlingPageRequest {
11
+ pagina: number;
12
+ from: string;
13
+ to: string;
14
+ limite: number;
15
+ }
16
+ export interface PullProductsOptions {
17
+ /** Where this run resumes. Absent = the first backfill. */
18
+ cursor?: Cursor;
19
+ /** How far back a first run reaches. */
20
+ backfillFrom?: string;
21
+ now?: number;
22
+ fetchPage(request: BlingPageRequest): Promise<BlingProductPage>;
23
+ /** Idempotent upsert into the canonical mirror. Returns whether it wrote. */
24
+ upsert(product: MirroredProduct): Promise<boolean>;
25
+ /** Products already mirrored for this connection, for the reconciliation below. */
26
+ linked?: MirrorRecord[];
27
+ limiter?: RateLimiter;
28
+ pageSize?: number;
29
+ /** Stop after this many records — the `sample` phase. */
30
+ maxRecords?: number;
31
+ maxPages?: number;
32
+ }
33
+ export interface PullProductsResult extends SyncResult {
34
+ completeness: Completeness;
35
+ cursor: Cursor;
36
+ /** Local ids the run did NOT see and deliberately did not touch. */
37
+ keptOutOfRange: string[];
38
+ products: MirroredProduct[];
39
+ pages: number;
40
+ /** Calls actually spent, so a caller can bill them against the daily budget. */
41
+ calls: number;
42
+ }
43
+ /** The window a first run asks for: `backfillFrom` (or a year back) until now. */
44
+ export declare function firstWindow(now: number, backfillFrom?: string): Extract<Cursor, {
45
+ kind: 'window';
46
+ }>;
47
+ /** The window this run should ask for, given what the last one left behind. */
48
+ export declare function windowFor(options: Pick<PullProductsOptions, 'cursor' | 'backfillFrom' | 'now'>): Extract<Cursor, {
49
+ kind: 'window';
50
+ }>;
51
+ /**
52
+ * Pull the products Bling changed inside the window.
53
+ *
54
+ * `completeness` is hard-coded `additive` and it is not a default anyone should
55
+ * "improve": Bling structurally cannot tell us a product was deleted, because
56
+ * the question we asked was "what changed between these two dates". A run that
57
+ * returned `authoritative` here would archive every product the store did not
58
+ * happen to touch this week.
59
+ */
60
+ export declare function pullProducts(options: PullProductsOptions): Promise<PullProductsResult>;
61
+ /**
62
+ * The fast half of the first load: one page, seconds, enough to design against.
63
+ *
64
+ * It is a different call and not a flag because it makes a different promise —
65
+ * `partial` by construction, never a basis for deciding anything is missing.
66
+ */
67
+ export declare function sampleProducts(options: Omit<PullProductsOptions, 'maxRecords' | 'maxPages'> & {
68
+ sampleSize?: number;
69
+ }): Promise<PullProductsResult>;
70
+ //# sourceMappingURL=sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../src/integrations/bling/sync.ts"],"names":[],"mappings":"AAmBA,OAAO,EAOL,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,WAAW,EACjB,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAS/C,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE5D,4EAA4E;AAC5E,MAAM,WAAW,gBAAg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AED,+EAA+E;AAC/E,wBAAgB,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,QAAQ,GAAG,cAAc,GAAG,KAAK,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAOpI;AAED;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAoF5F;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,YAAY,GAAG,UAAU,CAAC,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GACtF,OAAO,CAAC,kBAAkB,CAAC,CAS7B"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * A product as Bling's `GET /produtos` returns it.
3
+ *
4
+ * These are the twelve properties the v3 OpenAPI spec declares for a LIST item,
5
+ * narrowed to the ones this connector reads. Two of them decide the shape of the
6
+ * whole pull:
7
+ *
8
+ * `estoque.saldoVirtualTotal` IS on the list response (changelog v308), so a
9
+ * catalogue-and-stock mirror is one request per PAGE, not per product.
10
+ *
11
+ * `dataAlteracao` is NOT — see {@link BlingProduto.dataAlteracao}.
12
+ */
13
+ export interface BlingProduto {
14
+ id: number | string;
15
+ nome?: string;
16
+ codigo?: string | null;
17
+ preco?: number | string | null;
18
+ situacao?: string | null;
19
+ estoque?: {
20
+ saldoVirtualTotal?: number | null;
21
+ } | null;
22
+ /**
23
+ * Bling FILTERS on the change date (`dataAlteracaoInicial`/`Final`) and never
24
+ * RETURNS it: the field is absent from both the list item and the product
25
+ * detail. It is typed here because an earlier draft read it — it is always
26
+ * undefined, and the run's watermark is the window this client asked for, not
27
+ * anything in the payload.
28
+ */
29
+ dataAlteracao?: string | null;
30
+ descricaoCurta?: string | null;
31
+ imagemURL?: string | null;
32
+ }
33
+ /** What the mirror stores for one product. Canonical Fayz, never Bling's shape. */
34
+ export interface MirroredProduct {
35
+ externalId: string;
36
+ sku: string | null;
37
+ name: string;
38
+ price: number | null;
39
+ /** Bling owns this number. See docs/integrations/bling-integration-brief.md §3. */
40
+ inventoryCount: number | null;
41
+ status: 'active' | 'archived';
42
+ imageUrl: string | null;
43
+ updatedAt: string | null;
44
+ }
45
+ /** Non-secret connection settings. The OAuth credential is never among them. */
46
+ export interface BlingSettings {
47
+ /** Bling's own id for the account — the webhook's only way back to a tenant. */
48
+ companyId?: string;
49
+ /** How far back the first backfill reaches. */
50
+ backfillFrom?: string;
51
+ /**
52
+ * Who owns the stock number once Bling is connected. Always `bling` today;
53
+ * declared so the answer is in the connection and not in someone's memory.
54
+ */
55
+ stockOwner?: 'bling' | 'fayz';
56
+ /** Where the tenant arrived from — Bling's extension centre is an acquisition channel. */
57
+ source?: string;
58
+ }
59
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/integrations/bling/types.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;IAC9B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,OAAO,CAAC,EAAE;QAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAA;IACtD;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B;AAED,mFAAmF;AACnF,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,mFAAmF;IACnF,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAA;IAC7B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB;AAED,gFAAgF;AAChF,MAAM,WAAW,aAAa;IAC5B,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IAC7B,0FAA0F;IAC1F,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB"}
@@ -0,0 +1,38 @@
1
+ import { type ConnectorDefinition, type ConnectorSetting } from '@fayz-ai/core';
2
+ export declare const MELHOR_ENVIO_CONNECTOR_ID = "melhor-envio";
3
+ /**
4
+ * Two and a half seconds, and the number moved because it was MEASURED.
5
+ *
6
+ * It said one second, "chosen against the funnel, not against the carrier",
7
+ * with the claim that "Melhor Envio answers well inside it on a good day". The
8
+ * first real quote refuted that: the carrier alone takes ~610ms from São Paulo
9
+ * to Rio in the sandbox, before the credential redemption (43ms) and the two
10
+ * database round trips the quote needs. Total ~850ms server-side on a GOOD run,
11
+ * which the browser's own hop pushed past 1000ms — so the budget aborted every
12
+ * real quote and the shopper saw the zone price, forever. A budget that only
13
+ * ever fires is not a safety net, it is the feature being off.
14
+ *
15
+ * The funnel reasoning was still right, which is why this is 2.5s and not 10:
16
+ * past a few seconds "calculando" reads as broken, and the zones answer
17
+ * instantly. What changed is the evidence about where the line actually is.
18
+ */
19
+ export declare const MELHOR_ENVIO_LATENCY_BUDGET_MS = 2500;
20
+ /**
21
+ * Where the parcels leave from. The canonical REQUIRED-TO-OPERATE setting:
22
+ * Melhor Envio cannot quote a single price without it, and it is still not what
23
+ * authorizes the connection — that is the OAuth grant, which is asked for on
24
+ * Melhor Envio's own screen and never in this form.
25
+ *
26
+ * It used to be a `ConnectorField`, which meant a merchant had to know which
27
+ * warehouse they ship from before they were allowed to plug the carrier in. Now
28
+ * the connection is made and the store reads "conectado, falta configurar"
29
+ * (`plg_connections.status = 'pending'`) until a postcode is chosen — which is
30
+ * true, and is the difference between an integration that is not ready and one
31
+ * that is broken.
32
+ *
33
+ * The `pattern` is what a free-text box never had: eight digits, checked here
34
+ * rather than discovered by the first buyer who gets no price.
35
+ */
36
+ export declare const MELHOR_ENVIO_SETTINGS: ConnectorSetting[];
37
+ export declare const melhorEnvioConnectorDef: ConnectorDefinition;
38
+ //# sourceMappingURL=connectorDef.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connectorDef.d.ts","sourceRoot":"","sources":["../../../src/integrations/melhor-envio/connectorDef.tsx"],"names":[],"mappings":"AAcA,OAAO,EAKL,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACtB,MAAM,eAAe,CAAA;AAGtB,eAAO,MAAM,yBAAyB,iBAAiB,CAAA;AAEvD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,8BAA8B,OAAO,CAAA;AAElD;;;;;;;;;;;;;;;GAeG;AAKH,eAAO,MAAM,qBAAqB,EAAE,gBAAgB,EAWnD,CAAA;AAsCD,eAAO,MAAM,uBAAuB,EAAE,mBAoGrC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { ShippingLabelProvider, ShopProvider } from '@fayz-ai/shop';
2
+ export declare const MELHOR_ENVIO_CARRIER = "melhor-envio";
3
+ export declare function createMelhorEnvioLabelProvider(resolve: () => ShopProvider): ShippingLabelProvider;
4
+ //# sourceMappingURL=labelProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labelProvider.d.ts","sourceRoot":"","sources":["../../../src/integrations/melhor-envio/labelProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAOxE,eAAO,MAAM,oBAAoB,iBAAiB,CAAA;AAElD,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,MAAM,YAAY,GAC1B,qBAAqB,CAiBvB"}
@@ -0,0 +1,17 @@
1
+ import { type ConnectorDefinition, type ConnectorSetting } from '@fayz-ai/core';
2
+ export declare const STRIPE_CONNECT_CONNECTOR_ID = "stripe-connect";
3
+ /**
4
+ * Six seconds, the same budget the other two gateways carry: it is spent after
5
+ * the buyer pressed "pagar", where waiting is expected and a premature refusal
6
+ * costs a sale that was about to happen.
7
+ */
8
+ export declare const STRIPE_CONNECT_LATENCY_BUDGET_MS = 6000;
9
+ /**
10
+ * Stripe's own vocabulary (lowercase), because these values travel to it as
11
+ * `payment_method_types` — a translation table between what the merchant picked
12
+ * and what the wire accepts is one more place for a method to silently stop
13
+ * being offered.
14
+ */
15
+ export declare const STRIPE_CONNECT_SETTINGS: ConnectorSetting[];
16
+ export declare const stripeConnectConnectorDef: ConnectorDefinition;
17
+ //# sourceMappingURL=connectorDef.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connectorDef.d.ts","sourceRoot":"","sources":["../../../src/integrations/stripe-connect/connectorDef.tsx"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACtB,MAAM,eAAe,CAAA;AAGtB,eAAO,MAAM,2BAA2B,mBAAmB,CAAA;AAE3D;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,OAAO,CAAA;AAEpD;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAAgB,EAiBrD,CAAA;AAsDD,eAAO,MAAM,yBAAyB,EAAE,mBA4EvC,CAAA"}
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import type { ShopProviderResolver } from '../data/shared';
3
+ export interface CheckoutSettingsProps {
4
+ provider?: ShopProviderResolver;
5
+ }
6
+ /**
7
+ * Checkout — quem pode comprar e o que é pedido no caminho.
8
+ *
9
+ * A honestidade sobre quem impõe o quê está nas descrições, e não é detalhe:
10
+ * «compra sem cadastro» é recusada pelo SERVIDOR (trigger da 0045), então
11
+ * desligá-la vale mesmo contra um POST direto no RPC. «Exigir e-mail
12
+ * confirmado» e os campos do formulário são de INTERFACE — a vitrine obedece, e
13
+ * um comprador determinado não é impedido pelo banco. Prometer imposição onde
14
+ * ela não existe é pior do que não ter a opção.
15
+ */
16
+ export declare function CheckoutSettings({ provider }: CheckoutSettingsProps): React.JSX.Element;
17
+ //# sourceMappingURL=CheckoutSettings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CheckoutSettings.d.ts","sourceRoot":"","sources":["../../src/settings/CheckoutSettings.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAI1D,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,oBAAoB,CAAA;CAChC;AAkDD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE,qBAAqB,qBA+EnE"}
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ export interface Choice<T extends string> {
3
+ value: T;
4
+ label: string;
5
+ description: string;
6
+ /** Optional lucide icon component, rendered before the label. */
7
+ Icon?: React.ComponentType<{
8
+ className?: string;
9
+ }>;
10
+ }
11
+ export interface ChoiceCardsProps<T extends string> {
12
+ label: string;
13
+ choices: ReadonlyArray<Choice<T>>;
14
+ value: T | undefined;
15
+ onChange: (value: T) => void;
16
+ disabled?: boolean;
17
+ }
18
+ /**
19
+ * Mutually exclusive policies with a paragraph each — a radio, not a dropdown:
20
+ * choosing between two of these needs both on screen at once.
21
+ */
22
+ export declare function ChoiceCards<T extends string>({ label, choices, value, onChange, disabled, }: ChoiceCardsProps<T>): React.JSX.Element;
23
+ //# sourceMappingURL=ChoiceCards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChoiceCards.d.ts","sourceRoot":"","sources":["../../src/settings/ChoiceCards.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,MAAM,WAAW,MAAM,CAAC,CAAC,SAAS,MAAM;IACtC,KAAK,EAAE,CAAC,CAAA;IACR,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,iEAAiE;IACjE,IAAI,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACnD;AAED,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,MAAM;IAChD,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IACjC,KAAK,EAAE,CAAC,GAAG,SAAS,CAAA;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAA;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,EAC5C,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,GAC1C,EAAE,gBAAgB,CAAC,CAAC,CAAC,qBAsCrB"}
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import type { ShopProviderResolver } from '../data/shared';
3
+ export interface FulfillmentSettingsProps {
4
+ provider?: ShopProviderResolver;
5
+ }
6
+ /**
7
+ * Fulfillment — se a remessa nasce sozinha.
8
+ *
9
+ * Uma decisão só, e ela é sobre QUANDO um registro de remessa passa a existir —
10
+ * não sobre quem entrega. `public.fulfillments` e `fulfillment_items` já existem
11
+ * desde a 0018, com o `fulfillment_status` do pedido DERIVADO deles por trigger;
12
+ * a política escolhida aqui é lida por um trigger da 0045 que insere a remessa
13
+ * com os itens do pedido, exatamente como a tela do pedido faria à mão. Nada
14
+ * aqui escreve `fulfillment_status`: ele continua derivado, que é o que o impede
15
+ * de divergir da realidade.
16
+ *
17
+ * Pedidos que já existem não são afetados. A política vale para o que vem
18
+ * depois, e isso é dito na tela: um lojista que liga a baixa automática
19
+ * esperando ver os pedidos de ontem despacharem tem uma surpresa pior do que a
20
+ * frase.
21
+ */
22
+ export declare function FulfillmentSettings({ provider }: FulfillmentSettingsProps): React.JSX.Element;
23
+ //# sourceMappingURL=FulfillmentSettings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FulfillmentSettings.d.ts","sourceRoot":"","sources":["../../src/settings/FulfillmentSettings.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAK1D,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,oBAAoB,CAAA;CAChC;AA8BD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,QAAQ,EAAE,EAAE,wBAAwB,qBA6BzE"}