@asteby/storefront 0.11.0 → 0.11.2

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/mock.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as IdentityRulesV1, aS as RegionFiscalId, Z as IdentityDocumentSpec, aQ as Region, b0 as Shop, aE as Product, x as Collection, b7 as Theme, am as Page, af as Menu, b as Article, C as Cart, A as Address, a5 as InvoiceRequest, z as Customer, ak as Order, ap as PaymentAttemptResult, a7 as InvoiceStage, B as CustomerCapabilities, aL as PromotionAnnouncement, a$ as ShippingRate, av as PaymentMethod } from './types-C-Ley-Mt.cjs';
1
+ import { $ as IdentityRulesV1, aS as RegionFiscalId, Z as IdentityDocumentSpec, aQ as Region, b0 as Shop, aE as Product, x as Collection, b7 as Theme, am as Page, af as Menu, b as Article, C as Cart, A as Address, a5 as InvoiceRequest, z as Customer, ak as Order, ap as PaymentAttemptResult, a7 as InvoiceStage, B as CustomerCapabilities, aL as PromotionAnnouncement, a$ as ShippingRate, av as PaymentMethod } from './types-BQ7k6DwG.cjs';
2
2
  import './geo.cjs';
3
3
 
4
4
  /**
package/dist/mock.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as IdentityRulesV1, aS as RegionFiscalId, Z as IdentityDocumentSpec, aQ as Region, b0 as Shop, aE as Product, x as Collection, b7 as Theme, am as Page, af as Menu, b as Article, C as Cart, A as Address, a5 as InvoiceRequest, z as Customer, ak as Order, ap as PaymentAttemptResult, a7 as InvoiceStage, B as CustomerCapabilities, aL as PromotionAnnouncement, a$ as ShippingRate, av as PaymentMethod } from './types-D7UJxrba.js';
1
+ import { $ as IdentityRulesV1, aS as RegionFiscalId, Z as IdentityDocumentSpec, aQ as Region, b0 as Shop, aE as Product, x as Collection, b7 as Theme, am as Page, af as Menu, b as Article, C as Cart, A as Address, a5 as InvoiceRequest, z as Customer, ak as Order, ap as PaymentAttemptResult, a7 as InvoiceStage, B as CustomerCapabilities, aL as PromotionAnnouncement, a$ as ShippingRate, av as PaymentMethod } from './types-D8nLoKyk.js';
2
2
  import './geo.js';
3
3
 
4
4
  /**
package/dist/mock.js CHANGED
@@ -916,8 +916,8 @@ function validateInvoiceRequest(region, input, prefix = "invoice") {
916
916
  const taxId = text(input.tax_id, input.rfc).toUpperCase();
917
917
  const name = text(input.legal_name, input.razon_social);
918
918
  const regime = text(input.tax_regime, input.regimen);
919
- const use = text(input.use, input.uso_cfdi);
920
- const postal = text(input.postal_code, input.cp);
919
+ const use = text(input.use, input.uso_cfdi, input.invoice_use, input.cfdi_use);
920
+ const postal = text(input.postal_code, input.cp, input.zip);
921
921
  const bad = (field, message) => ({ field: `${prefix}.${field}`, message });
922
922
  if (!taxId) return bad("tax_id", "The tax id is required");
923
923
  if (fid?.pattern && !fid.generic_ids.includes(taxId) && !new RegExp(fid.pattern).test(taxId)) return bad("tax_id", `Not a valid ${fid.kind}`);
@@ -2271,7 +2271,7 @@ function createMockStorefront(options = {}) {
2271
2271
  legal_name: String(fiscal.legal_name ?? fiscal.razon_social),
2272
2272
  tax_regime: String(fiscal.tax_regime ?? fiscal.regimen),
2273
2273
  postal_code: String(fiscal.postal_code ?? fiscal.cp),
2274
- invoice_use: String(fiscal.use ?? fiscal.uso_cfdi ?? "") || null,
2274
+ invoice_use: String(fiscal.use ?? fiscal.uso_cfdi ?? fiscal.invoice_use ?? "") || null,
2275
2275
  document: fiscal.document ?? null,
2276
2276
  verification: { status: "reviewed", checked_at: now() }
2277
2277
  };
@@ -2385,7 +2385,7 @@ function createMockStorefront(options = {}) {
2385
2385
  const tok = request.headers.get("authorization")?.match(/^Bearer\s+(.+)$/i)?.[1] ?? null;
2386
2386
  const granted = scopesFor(tok);
2387
2387
  if (!tok || !granted) return errorResponse(new HttpError(401, "unauthorized", "Missing or invalid storefront token"));
2388
- return json(200, { kind: tok.startsWith("pk_") ? "publishable" : "secret", environment: "sandbox", scopes: [...granted], missing_scopes: missingScopes, connection_id: "conn_mock", expires_at: null }, { "Cache-Control": PRIVATE_CACHE });
2388
+ return json(200, { success: true, data: { kind: tok.startsWith("pk_") ? "publishable" : "secret", environment: "sandbox", scopes: [...granted], missing_scopes: missingScopes, connection_id: "conn_mock", expires_at: null } }, { "Cache-Control": PRIVATE_CACHE });
2389
2389
  }
2390
2390
  const idx = url.pathname.indexOf("/storefront/");
2391
2391
  if (idx < 0) return errorResponse(new HttpError(404, "not_found", `No route for ${url.pathname}`));