@zappie/sdk 0.18.0 → 0.19.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/CHANGELOG.md +14 -0
- package/dist/account/index.js +1 -5
- package/dist/account/index.js.map +1 -1
- package/dist/account/url.js +1 -23
- package/dist/account/url.js.map +1 -1
- package/dist/branches/index.js +1 -43
- package/dist/branches/index.js.map +1 -1
- package/dist/cart/branch.js +1 -82
- package/dist/cart/branch.js.map +1 -1
- package/dist/cart/errors.js +1 -12
- package/dist/cart/errors.js.map +1 -1
- package/dist/cart/held.js +1 -17
- package/dist/cart/held.js.map +1 -1
- package/dist/cart/index.js +1 -782
- package/dist/cart/index.js.map +1 -1
- package/dist/cart/item.js +1 -11
- package/dist/cart/item.js.map +1 -1
- package/dist/cart/preview.js +1 -31
- package/dist/cart/preview.js.map +1 -1
- package/dist/cart/price.js +1 -24
- package/dist/cart/price.js.map +1 -1
- package/dist/cart/quote-client.js +1 -107
- package/dist/cart/quote-client.js.map +1 -1
- package/dist/cart/quote-response.js +1 -214
- package/dist/cart/quote-response.js.map +1 -1
- package/dist/cart/reconcile.js +1 -107
- package/dist/cart/reconcile.js.map +1 -1
- package/dist/cart/source-menu.js +1 -20
- package/dist/cart/source-menu.js.map +1 -1
- package/dist/cart/storage.js +1 -175
- package/dist/cart/storage.js.map +1 -1
- package/dist/cart/validate.js +1 -270
- package/dist/cart/validate.js.map +1 -1
- package/dist/cart/wire.js +1 -42
- package/dist/cart/wire.js.map +1 -1
- package/dist/cart/working-set.js +1 -79
- package/dist/cart/working-set.js.map +1 -1
- package/dist/checkout/client.js +1 -116
- package/dist/checkout/client.js.map +1 -1
- package/dist/checkout/embed.js +1 -247
- package/dist/checkout/embed.js.map +1 -1
- package/dist/checkout/error.js +1 -19
- package/dist/checkout/error.js.map +1 -1
- package/dist/checkout/index.js +1 -12
- package/dist/checkout/index.js.map +1 -1
- package/dist/checkout/react.js +1 -45
- package/dist/checkout/react.js.map +1 -1
- package/dist/checkout/readiness.js +1 -35
- package/dist/checkout/readiness.js.map +1 -1
- package/dist/checkout/sdk.js +1 -8
- package/dist/checkout/sdk.js.map +1 -1
- package/dist/checkout/session.js +1 -57
- package/dist/checkout/session.js.map +1 -1
- package/dist/checkout-defaults/index.js +1 -205
- package/dist/checkout-defaults/index.js.map +1 -1
- package/dist/client.js +1 -255
- package/dist/client.js.map +1 -1
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.js +1 -12
- package/dist/config/index.js.map +1 -1
- package/dist/config.js +1 -27
- package/dist/config.js.map +1 -1
- package/dist/customer/client.js +1 -180
- package/dist/customer/client.js.map +1 -1
- package/dist/customer/error.js +1 -18
- package/dist/customer/error.js.map +1 -1
- package/dist/customer/index.js +1 -7
- package/dist/customer/index.js.map +1 -1
- package/dist/customer/navigation.js +1 -39
- package/dist/customer/navigation.js.map +1 -1
- package/dist/customer/react.js +1 -69
- package/dist/customer/react.js.map +1 -1
- package/dist/customer/reorder.js +1 -60
- package/dist/customer/reorder.js.map +1 -1
- package/dist/customer/request.js +1 -37
- package/dist/customer/request.js.map +1 -1
- package/dist/customer/watch-order.js +1 -79
- package/dist/customer/watch-order.js.map +1 -1
- package/dist/debug.js +1 -77
- package/dist/debug.js.map +1 -1
- package/dist/display/index.js +1 -30
- package/dist/display/index.js.map +1 -1
- package/dist/error-pages/art.js +1 -10
- package/dist/error-pages/art.js.map +1 -1
- package/dist/error-pages/index.js +2 -103
- package/dist/error-pages/index.js.map +1 -1
- package/dist/error-pages/react.js +1 -65
- package/dist/error-pages/react.js.map +1 -1
- package/dist/errors.js +1 -70
- package/dist/errors.js.map +1 -1
- package/dist/in-venue/bill.js +1 -69
- package/dist/in-venue/bill.js.map +1 -1
- package/dist/in-venue/client.js +1 -119
- package/dist/in-venue/client.js.map +1 -1
- package/dist/in-venue/error.js +1 -18
- package/dist/in-venue/error.js.map +1 -1
- package/dist/in-venue/index.js +1 -23
- package/dist/in-venue/index.js.map +1 -1
- package/dist/in-venue/react/bill-page.js +1 -350
- package/dist/in-venue/react/bill-page.js.map +1 -1
- package/dist/in-venue/react/in-venue-page.js +1 -102
- package/dist/in-venue/react/in-venue-page.js.map +1 -1
- package/dist/in-venue/react/order-panel.js +1 -283
- package/dist/in-venue/react/order-panel.js.map +1 -1
- package/dist/in-venue/react/pay-point-page.js +1 -50
- package/dist/in-venue/react/pay-point-page.js.map +1 -1
- package/dist/in-venue/react/shared.js +2 -171
- package/dist/in-venue/react/shared.js.map +1 -1
- package/dist/in-venue/react/table-menus-page.js +1 -151
- package/dist/in-venue/react/table-menus-page.js.map +1 -1
- package/dist/in-venue/react.js +1 -14
- package/dist/in-venue/react.js.map +1 -1
- package/dist/in-venue/table.js +1 -62
- package/dist/in-venue/table.js.map +1 -1
- package/dist/in-venue/watch.js +1 -82
- package/dist/in-venue/watch.js.map +1 -1
- package/dist/index.js +1 -31
- package/dist/index.js.map +1 -1
- package/dist/integrations/index.js +1 -78
- package/dist/integrations/index.js.map +1 -1
- package/dist/internal/abort.js +1 -28
- package/dist/internal/abort.js.map +1 -1
- package/dist/internal/cache.js +1 -141
- package/dist/internal/cache.js.map +1 -1
- package/dist/internal/customer-http.js +1 -75
- package/dist/internal/customer-http.js.map +1 -1
- package/dist/internal/emitter.js +1 -26
- package/dist/internal/emitter.js.map +1 -1
- package/dist/internal/image-widths.js +1 -5
- package/dist/internal/image-widths.js.map +1 -1
- package/dist/internal/money-math.js +1 -29
- package/dist/internal/money-math.js.map +1 -1
- package/dist/internal/perk-hold.js +1 -34
- package/dist/internal/perk-hold.js.map +1 -1
- package/dist/internal/remembered-address.js +1 -68
- package/dist/internal/remembered-address.js.map +1 -1
- package/dist/internal/return-path.js +1 -16
- package/dist/internal/return-path.js.map +1 -1
- package/dist/internal/service-url.js +1 -10
- package/dist/internal/service-url.js.map +1 -1
- package/dist/internal.js +1 -8
- package/dist/internal.js.map +1 -1
- package/dist/loyalty/cart.js +1 -55
- package/dist/loyalty/cart.js.map +1 -1
- package/dist/loyalty/client.js +1 -88
- package/dist/loyalty/client.js.map +1 -1
- package/dist/loyalty/index.js +1 -12
- package/dist/loyalty/index.js.map +1 -1
- package/dist/loyalty/react.js +1 -199
- package/dist/loyalty/react.js.map +1 -1
- package/dist/loyalty/release.js +1 -42
- package/dist/loyalty/release.js.map +1 -1
- package/dist/money.js +1 -46
- package/dist/money.js.map +1 -1
- package/dist/navigation/index.js +1 -55
- package/dist/navigation/index.js.map +1 -1
- package/dist/navigation/react.js +1 -17
- package/dist/navigation/react.js.map +1 -1
- package/dist/navigation-progress/index.js +1 -41
- package/dist/navigation-progress/index.js.map +1 -1
- package/dist/options/index.js +1 -103
- package/dist/options/index.js.map +1 -1
- package/dist/persist/catalogue.js +1 -205
- package/dist/persist/catalogue.js.map +1 -1
- package/dist/places/client.js +1 -96
- package/dist/places/client.js.map +1 -1
- package/dist/places/error.js +1 -18
- package/dist/places/error.js.map +1 -1
- package/dist/places/index.js +1 -7
- package/dist/places/index.js.map +1 -1
- package/dist/places/request.js +1 -39
- package/dist/places/request.js.map +1 -1
- package/dist/places/sdk.js +1 -9
- package/dist/places/sdk.js.map +1 -1
- package/dist/places/search.js +1 -79
- package/dist/places/search.js.map +1 -1
- package/dist/pricing/index.js +1 -80
- package/dist/pricing/index.js.map +1 -1
- package/dist/react/cart.js +1 -40
- package/dist/react/cart.js.map +1 -1
- package/dist/react/changes.js +1 -93
- package/dist/react/changes.js.map +1 -1
- package/dist/react/hooks.js +1 -90
- package/dist/react/hooks.js.map +1 -1
- package/dist/react/index.js +1 -19
- package/dist/react/index.js.map +1 -1
- package/dist/react/provider.js +1 -33
- package/dist/react/provider.js.map +1 -1
- package/dist/react/rollback.js +1 -89
- package/dist/react/rollback.js.map +1 -1
- package/dist/receipts/index.js +1 -48
- package/dist/receipts/index.js.map +1 -1
- package/dist/redirect/index.js +1 -30
- package/dist/redirect/index.js.map +1 -1
- package/dist/server/auth/crypto.js +1 -105
- package/dist/server/auth/crypto.js.map +1 -1
- package/dist/server/auth/jwt.js +1 -203
- package/dist/server/auth/jwt.js.map +1 -1
- package/dist/server/auth/session-store.js +1 -45
- package/dist/server/auth/session-store.js.map +1 -1
- package/dist/server/chosen-branch.js +1 -69
- package/dist/server/chosen-branch.js.map +1 -1
- package/dist/server/edge-cache.js +1 -394
- package/dist/server/edge-cache.js.map +1 -1
- package/dist/server/edge-snapshot.js +1 -199
- package/dist/server/edge-snapshot.js.map +1 -1
- package/dist/server/index.d.ts +5 -0
- package/dist/server/index.js +1 -113
- package/dist/server/index.js.map +1 -1
- package/dist/server/security.js +1 -135
- package/dist/server/security.js.map +1 -1
- package/dist/server/sign-in.js +1 -17
- package/dist/server/sign-in.js.map +1 -1
- package/dist/server/storefront-url/build-v1.js +1 -65
- package/dist/server/storefront-url/build-v1.js.map +1 -1
- package/dist/server/storefront-url/build-v2.js +1 -50
- package/dist/server/storefront-url/build-v2.js.map +1 -1
- package/dist/server/storefront-url/build.js +1 -18
- package/dist/server/storefront-url/build.js.map +1 -1
- package/dist/server/storefront-url/canonical.js +1 -35
- package/dist/server/storefront-url/canonical.js.map +1 -1
- package/dist/server/storefront-url/contract.js +1 -24
- package/dist/server/storefront-url/contract.js.map +1 -1
- package/dist/server/storefront-url/index.js +1 -15
- package/dist/server/storefront-url/index.js.map +1 -1
- package/dist/server/storefront-url/installation.js +1 -57
- package/dist/server/storefront-url/installation.js.map +1 -1
- package/dist/server/storefront-url/params.js +1 -88
- package/dist/server/storefront-url/params.js.map +1 -1
- package/dist/server/storefront-url/parse-v1.js +1 -137
- package/dist/server/storefront-url/parse-v1.js.map +1 -1
- package/dist/server/storefront-url/parse-v2.js +1 -84
- package/dist/server/storefront-url/parse-v2.js.map +1 -1
- package/dist/server/storefront-url/parse.js +1 -8
- package/dist/server/storefront-url/parse.js.map +1 -1
- package/dist/server/storefront-url/public-id.js +1 -7
- package/dist/server/storefront-url/public-id.js.map +1 -1
- package/dist/server/storefront-url/redirect.js +1 -43
- package/dist/server/storefront-url/redirect.js.map +1 -1
- package/dist/server/storefront-url/sign-in.js +1 -17
- package/dist/server/storefront-url/sign-in.js.map +1 -1
- package/dist/server/storefront-url/types.js +1 -55
- package/dist/server/storefront-url/types.js.map +1 -1
- package/dist/server/storefront-url/url.js +1 -73
- package/dist/server/storefront-url/url.js.map +1 -1
- package/dist/server/webhook.js +1 -95
- package/dist/server/webhook.js.map +1 -1
- package/dist/services/index.js +1 -18
- package/dist/services/index.js.map +1 -1
- package/dist/site-closed/index.js +1 -38
- package/dist/site-closed/index.js.map +1 -1
- package/dist/site-config/helpers.js +1 -58
- package/dist/site-config/helpers.js.map +1 -1
- package/dist/site-config/sections.js +1 -114
- package/dist/site-config/sections.js.map +1 -1
- package/dist/site-config/types.js +1 -31
- package/dist/site-config/types.js.map +1 -1
- package/dist/site-config/validate.js +1 -215
- package/dist/site-config/validate.js.map +1 -1
- package/dist/site-error/index.js +1 -32
- package/dist/site-error/index.js.map +1 -1
- package/dist/site-error/react.js +1 -14
- package/dist/site-error/react.js.map +1 -1
- package/dist/studio/index.js +1 -315
- package/dist/template/index.js +1 -88
- package/dist/template/index.js.map +1 -1
- package/dist/template/react.js +1 -111
- package/dist/template/react.js.map +1 -1
- package/dist/testing/index.js +1 -459
- package/dist/testing/loyalty.js +1 -109
- package/dist/testing/loyalty.js.map +1 -1
- package/dist/transport/category-page.js +1 -24
- package/dist/transport/category-page.js.map +1 -1
- package/dist/transport/mappers.js +1 -356
- package/dist/transport/mappers.js.map +1 -1
- package/dist/transport/presentation.js +1 -67
- package/dist/transport/presentation.js.map +1 -1
- package/dist/transport/quote-body.js +1 -23
- package/dist/transport/quote-body.js.map +1 -1
- package/dist/transport/rest.js +1 -327
- package/dist/transport/rest.js.map +1 -1
- package/dist/transport/search.js +1 -36
- package/dist/transport/search.js.map +1 -1
- package/dist/transport/selected-menu.js +1 -83
- package/dist/transport/selected-menu.js.map +1 -1
- package/dist/transport/store.js +1 -132
- package/dist/transport/store.js.map +1 -1
- package/dist/uploads/index.js +1 -36
- package/dist/uploads/index.js.map +1 -1
- package/dist/url/index.js +1 -15
- package/dist/url/index.js.map +1 -1
- package/dist/visits/index.js +1 -61
- package/dist/visits/index.js.map +1 -1
- package/dist/visits/page-views.js +1 -102
- package/dist/visits/page-views.js.map +1 -1
- package/dist/vite/index.js +3 -373
- package/package.json +1 -1
package/dist/server/webhook.js
CHANGED
|
@@ -1,96 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { ZappieError } from "../errors.js";
|
|
3
|
-
var ZappieWebhookSignatureError = class extends ZappieError {
|
|
4
|
-
constructor() {
|
|
5
|
-
super("invalid_request", "Zappie could not verify this webhook signature.");
|
|
6
|
-
this.name = "ZappieWebhookSignatureError";
|
|
7
|
-
}
|
|
8
|
-
};
|
|
9
|
-
var encoder = new TextEncoder();
|
|
10
|
-
async function verifyWebhook({
|
|
11
|
-
payload,
|
|
12
|
-
header,
|
|
13
|
-
secret,
|
|
14
|
-
toleranceSec = 300,
|
|
15
|
-
now = /* @__PURE__ */ new Date()
|
|
16
|
-
}) {
|
|
17
|
-
const parsed = signatureHeader(header);
|
|
18
|
-
if (secret.length === 0 || !parsed || !Number.isFinite(toleranceSec) || toleranceSec < 0 || Math.abs(now.getTime() / 1e3 - parsed.seconds) > toleranceSec) {
|
|
19
|
-
throw new ZappieWebhookSignatureError();
|
|
20
|
-
}
|
|
21
|
-
const body = typeof payload === "string" ? encoder.encode(payload) : payload;
|
|
22
|
-
const prefix = encoder.encode(`${parsed.timestamp}.`);
|
|
23
|
-
const signed = new Uint8Array(prefix.length + body.length);
|
|
24
|
-
signed.set(prefix);
|
|
25
|
-
signed.set(body, prefix.length);
|
|
26
|
-
const key = await crypto.subtle.importKey(
|
|
27
|
-
"raw",
|
|
28
|
-
encoder.encode(secret),
|
|
29
|
-
{ name: "HMAC", hash: "SHA-256" },
|
|
30
|
-
false,
|
|
31
|
-
["verify"]
|
|
32
|
-
);
|
|
33
|
-
const matches = await Promise.all(
|
|
34
|
-
parsed.signatures.map(async (candidate) => {
|
|
35
|
-
const valid = /^[0-9a-f]{64}$/.test(candidate);
|
|
36
|
-
const bytes = valid ? hex(candidate) : new Uint8Array(32);
|
|
37
|
-
const match = await crypto.subtle.verify("HMAC", key, bytes, signed);
|
|
38
|
-
return valid && match;
|
|
39
|
-
})
|
|
40
|
-
);
|
|
41
|
-
if (!matches.some(Boolean)) {
|
|
42
|
-
throw new ZappieWebhookSignatureError();
|
|
43
|
-
}
|
|
44
|
-
let event;
|
|
45
|
-
try {
|
|
46
|
-
event = JSON.parse(new TextDecoder().decode(body));
|
|
47
|
-
} catch (cause) {
|
|
48
|
-
throw new ZappieError(
|
|
49
|
-
"invalid_request",
|
|
50
|
-
"The verified webhook payload is not valid JSON.",
|
|
51
|
-
{ cause }
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
if (!event || typeof event !== "object" || Array.isArray(event)) {
|
|
55
|
-
throw new ZappieError(
|
|
56
|
-
"invalid_request",
|
|
57
|
-
"The verified webhook payload is not a JSON object."
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
return event;
|
|
61
|
-
}
|
|
62
|
-
function signatureHeader(header) {
|
|
63
|
-
let timestamp = "";
|
|
64
|
-
const signatures = [];
|
|
65
|
-
for (const part of header?.split(",") ?? []) {
|
|
66
|
-
const value = part.trim();
|
|
67
|
-
const separator = value.indexOf("=");
|
|
68
|
-
if (separator < 0) {
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
const key = value.slice(0, separator);
|
|
72
|
-
const item = value.slice(separator + 1);
|
|
73
|
-
if (key === "t") {
|
|
74
|
-
timestamp = item;
|
|
75
|
-
} else if (key === "v1") {
|
|
76
|
-
signatures.push(item);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
if (!/^[+-]?\d+$/.test(timestamp) || signatures.length === 0) {
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
const seconds = Number(timestamp);
|
|
83
|
-
return Number.isSafeInteger(seconds) ? { timestamp, seconds, signatures } : null;
|
|
84
|
-
}
|
|
85
|
-
function hex(value) {
|
|
86
|
-
const bytes = new Uint8Array(value.length / 2);
|
|
87
|
-
for (let index = 0; index < bytes.length; index += 1) {
|
|
88
|
-
bytes[index] = Number.parseInt(value.slice(index * 2, index * 2 + 2), 16);
|
|
89
|
-
}
|
|
90
|
-
return bytes;
|
|
91
|
-
}
|
|
92
|
-
export {
|
|
93
|
-
ZappieWebhookSignatureError,
|
|
94
|
-
verifyWebhook
|
|
95
|
-
};
|
|
1
|
+
import{ZappieError}from"../errors.js";var ZappieWebhookSignatureError=class extends ZappieError{constructor(){super("invalid_request","Zappie could not verify this webhook signature.");this.name="ZappieWebhookSignatureError"}};var encoder=new TextEncoder;async function verifyWebhook({payload,header,secret,toleranceSec=300,now=new Date}){const parsed=signatureHeader(header);if(secret.length===0||!parsed||!Number.isFinite(toleranceSec)||toleranceSec<0||Math.abs(now.getTime()/1e3-parsed.seconds)>toleranceSec){throw new ZappieWebhookSignatureError}const body=typeof payload==="string"?encoder.encode(payload):payload;const prefix=encoder.encode(`${parsed.timestamp}.`);const signed=new Uint8Array(prefix.length+body.length);signed.set(prefix);signed.set(body,prefix.length);const key=await crypto.subtle.importKey("raw",encoder.encode(secret),{name:"HMAC",hash:"SHA-256"},false,["verify"]);const matches=await Promise.all(parsed.signatures.map(async candidate=>{const valid=/^[0-9a-f]{64}$/.test(candidate);const bytes=valid?hex(candidate):new Uint8Array(32);const match=await crypto.subtle.verify("HMAC",key,bytes,signed);return valid&&match}));if(!matches.some(Boolean)){throw new ZappieWebhookSignatureError}let event;try{event=JSON.parse(new TextDecoder().decode(body))}catch(cause){throw new ZappieError("invalid_request","The verified webhook payload is not valid JSON.",{cause})}if(!event||typeof event!=="object"||Array.isArray(event)){throw new ZappieError("invalid_request","The verified webhook payload is not a JSON object.")}return event}function signatureHeader(header){let timestamp="";const signatures=[];for(const part of header?.split(",")??[]){const value=part.trim();const separator=value.indexOf("=");if(separator<0){continue}const key=value.slice(0,separator);const item=value.slice(separator+1);if(key==="t"){timestamp=item}else if(key==="v1"){signatures.push(item)}}if(!/^[+-]?\d+$/.test(timestamp)||signatures.length===0){return null}const seconds=Number(timestamp);return Number.isSafeInteger(seconds)?{timestamp,seconds,signatures}:null}function hex(value){const bytes=new Uint8Array(value.length/2);for(let index=0;index<bytes.length;index+=1){bytes[index]=Number.parseInt(value.slice(index*2,index*2+2),16)}return bytes}export{ZappieWebhookSignatureError,verifyWebhook};
|
|
96
2
|
//# sourceMappingURL=webhook.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/server/webhook.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA,OAAS,gBAAmB,eA6CrB,IAAM,4BAAN,cAA0C,WAAY,CAC3D,aAAc,CACZ,MAAM,kBAAmB,iDAAiD,EAC1E,KAAK,KAAO,6BACd,CACF,EAEA,IAAM,QAAU,IAAI,YAGpB,eAAsB,cAAc,CAClC,QACA,OACA,OACA,aAAe,IACf,IAAM,IAAI,IACZ,EAAgD,CAC9C,MAAM,OAAS,gBAAgB,MAAM,EACrC,GACE,OAAO,SAAW,GAClB,CAAC,QACD,CAAC,OAAO,SAAS,YAAY,GAC7B,aAAe,GACf,KAAK,IAAI,IAAI,QAAQ,EAAI,IAAO,OAAO,OAAO,EAAI,aAClD,CACA,MAAM,IAAI,2BACZ,CACA,MAAM,KAAO,OAAO,UAAY,SAAW,QAAQ,OAAO,OAAO,EAAI,QACrE,MAAM,OAAS,QAAQ,OAAO,GAAG,OAAO,SAAS,GAAG,EACpD,MAAM,OAAS,IAAI,WAAW,OAAO,OAAS,KAAK,MAAM,EACzD,OAAO,IAAI,MAAM,EACjB,OAAO,IAAI,KAAM,OAAO,MAAM,EAC9B,MAAM,IAAM,MAAM,OAAO,OAAO,UAC9B,MACA,QAAQ,OAAO,MAAM,EACrB,CAAE,KAAM,OAAQ,KAAM,SAAU,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ACjC,IACN,CAEA,SAAS,IAAI,MAAe,CAC1B,MAAM,MAAQ,IAAI,WAAW,MAAM,OAAS,CAAC,EAC7C,QAAS,MAAQ,EAAG,MAAQ,MAAM,OAAQ,OAAS,EAAG,CACpD,MAAM,KAAK,EAAI,OAAO,SAAS,MAAM,MAAM,MAAQ,EAAG,MAAQ,EAAI,CAAC,EAAG,EAAE,CAC1E,CACA,OAAO,KACT",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/services/index.js
CHANGED
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { serviceUrl } from "../internal/service-url.js";
|
|
3
|
-
var CHECKOUT = {
|
|
4
|
-
production: "https://checkout.zappie.ai",
|
|
5
|
-
staging: "https://checkout.stg.zappie.ai"
|
|
6
|
-
};
|
|
7
|
-
var APP = {
|
|
8
|
-
production: "https://app.zappie.ai",
|
|
9
|
-
staging: "https://app.stg.zappie.ai"
|
|
10
|
-
};
|
|
11
|
-
var checkoutUrl = (path, environment = "production") => serviceUrl(CHECKOUT, path, environment);
|
|
12
|
-
var appUrl = (path, environment = "production") => serviceUrl(APP, path, environment);
|
|
13
|
-
var ZAPPIE_SUPPORT_WHATSAPP = "15558956471";
|
|
14
|
-
export {
|
|
15
|
-
ZAPPIE_SUPPORT_WHATSAPP,
|
|
16
|
-
appUrl,
|
|
17
|
-
checkoutUrl
|
|
18
|
-
};
|
|
1
|
+
import{serviceUrl}from"../internal/service-url.js";var CHECKOUT={production:"https://checkout.zappie.ai",staging:"https://checkout.stg.zappie.ai"};var APP={production:"https://app.zappie.ai",staging:"https://app.stg.zappie.ai"};var checkoutUrl=(path,environment="production")=>serviceUrl(CHECKOUT,path,environment);var appUrl=(path,environment="production")=>serviceUrl(APP,path,environment);var ZAPPIE_SUPPORT_WHATSAPP="15558956471";export{ZAPPIE_SUPPORT_WHATSAPP,appUrl,checkoutUrl};
|
|
19
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/services/index.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA,OAAS,eAA0C,6BAKnD,IAAM,SAAW,CACf,WAAY,6BACZ,QAAS,gCACX,EACA,IAAM,IAAM,CACV,WAAY,wBACZ,QAAS,2BACX,EASO,IAAM,YAAc,CACzB,KACA,YAAiC,eACtB,WAAW,SAAU,KAAM,WAAW,EAS5C,IAAM,OAAS,CACpB,KACA,YAAiC,eACtB,WAAW,IAAK,KAAM,WAAW,EAGvC,IAAM,wBAA0B",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,39 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var CLOSED_MESSAGE_LIMIT = 280;
|
|
3
|
-
var CLOSED_PAGE_HEADER = "x-zappie-closed-page";
|
|
4
|
-
var COPY = {
|
|
5
|
-
title: "Closed for now",
|
|
6
|
-
message: "We're closed for now. Please check back soon."
|
|
7
|
-
};
|
|
8
|
-
function siteClosed(request) {
|
|
9
|
-
if (request.headers.get("x-zappie-site-state") !== "closed") {
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
let message = null;
|
|
13
|
-
try {
|
|
14
|
-
message = Array.from(
|
|
15
|
-
decodeURIComponent(
|
|
16
|
-
request.headers.get("x-zappie-closed-message") ?? ""
|
|
17
|
-
).trim()
|
|
18
|
-
).slice(0, CLOSED_MESSAGE_LIMIT).join("").trim() || null;
|
|
19
|
-
} catch {
|
|
20
|
-
}
|
|
21
|
-
return { closed: true, message };
|
|
22
|
-
}
|
|
23
|
-
function siteClosedCopy(closed, copy) {
|
|
24
|
-
const page = { ...COPY, ...copy };
|
|
25
|
-
return { title: page.title, message: closed.message ?? page.message };
|
|
26
|
-
}
|
|
27
|
-
function markClosedPage(response) {
|
|
28
|
-
const marked = new Response(response.body, response);
|
|
29
|
-
marked.headers.set(CLOSED_PAGE_HEADER, "1");
|
|
30
|
-
return marked;
|
|
31
|
-
}
|
|
32
|
-
export {
|
|
33
|
-
CLOSED_MESSAGE_LIMIT,
|
|
34
|
-
CLOSED_PAGE_HEADER,
|
|
35
|
-
markClosedPage,
|
|
36
|
-
siteClosed,
|
|
37
|
-
siteClosedCopy
|
|
38
|
-
};
|
|
1
|
+
var CLOSED_MESSAGE_LIMIT=280;var CLOSED_PAGE_HEADER="x-zappie-closed-page";var COPY={title:"Closed for now",message:"We're closed for now. Please check back soon."};function siteClosed(request){if(request.headers.get("x-zappie-site-state")!=="closed"){return null}let message=null;try{message=Array.from(decodeURIComponent(request.headers.get("x-zappie-closed-message")??"").trim()).slice(0,CLOSED_MESSAGE_LIMIT).join("").trim()||null}catch{}return{closed:true,message}}function siteClosedCopy(closed,copy){const page={...COPY,...copy};return{title:page.title,message:closed.message??page.message}}function markClosedPage(response){const marked=new Response(response.body,response);marked.headers.set(CLOSED_PAGE_HEADER,"1");return marked}export{CLOSED_MESSAGE_LIMIT,CLOSED_PAGE_HEADER,markClosedPage,siteClosed,siteClosedCopy};
|
|
39
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/site-closed/index.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAWO,IAAM,qBAAuB,IAG7B,IAAM,mBAAqB,uBAElC,IAAM,KAAuB,CAC3B,MAAO,iBACP,QAAS,+CACX,EAUO,SAAS,WAAW,QAAqC,CAC9D,GAAI,QAAQ,QAAQ,IAAI,qBAAqB,IAAM,SAAU,CAC3D,OAAO,IACT,CACA,IAAI,QAAyB,KAC7B,GAAI,CACF,QACE,MAAM,KACJ,mBACE,QAAQ,QAAQ,IAAI,yBAAyB,GAAK,EACpD,EAAE,KAAK,CACT,EACG,MAAM,EAAG,oBAAoB,EAC7B,KAAK,EAAE,EACP,KAAK,GAAK,IACjB,MAAQ,CAER,CACA,MAAO,CAAE,OAAQ,KAAM,OAAQ,CACjC,CASO,SAAS,eACd,OACA,KACgB,CAChB,MAAM,KAAO,CAAE,GAAG,KAAM,GAAG,IAAK,EAChC,MAAO,CAAE,MAAO,KAAK,MAAO,QAAS,OAAO,SAAW,KAAK,OAAQ,CACtE,CAUO,SAAS,eAAe,SAA8B,CAC3D,MAAM,OAAS,IAAI,SAAS,SAAS,KAAM,QAAQ,EACnD,OAAO,QAAQ,IAAI,mBAAoB,GAAG,EAC1C,OAAO,MACT",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,59 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { GLOBAL_PACKAGE_ALLOWLIST } from "./types.js";
|
|
3
|
-
var record = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4
|
-
function distance(left, right) {
|
|
5
|
-
let row = Array.from({ length: right.length + 1 }, (_, index) => index);
|
|
6
|
-
for (let leftIndex = 1; leftIndex <= left.length; leftIndex += 1) {
|
|
7
|
-
const next = [leftIndex];
|
|
8
|
-
for (let rightIndex = 1; rightIndex <= right.length; rightIndex += 1) {
|
|
9
|
-
next[rightIndex] = Math.min(
|
|
10
|
-
(next[rightIndex - 1] ?? 0) + 1,
|
|
11
|
-
(row[rightIndex] ?? 0) + 1,
|
|
12
|
-
(row[rightIndex - 1] ?? 0) + (left[leftIndex - 1] === right[rightIndex - 1] ? 0 : 1)
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
row = next;
|
|
16
|
-
}
|
|
17
|
-
return row[right.length] ?? Infinity;
|
|
18
|
-
}
|
|
19
|
-
function unknownKeys(value, allowed, path, issue) {
|
|
20
|
-
for (const key of Object.keys(value)) {
|
|
21
|
-
if (allowed.includes(key)) {
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
const closest = allowed.map((candidate) => ({ candidate, score: distance(key, candidate) })).sort((left, right) => left.score - right.score)[0];
|
|
25
|
-
const hint = closest && closest.score <= 2 ? closest.candidate : void 0;
|
|
26
|
-
issue({
|
|
27
|
-
path: path ? `${path}.${key}` : key,
|
|
28
|
-
code: "unknown_key",
|
|
29
|
-
message: hint ? `Unknown field "${key}". Rename it to "${hint}".` : `Unknown field "${key}". Remove it from the configuration.`,
|
|
30
|
-
severity: "error"
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
var nonblank = (value) => typeof value === "string" && value.trim().length > 0;
|
|
35
|
-
var packageName = (value) => value.length <= 214 && /^(?:@[a-z0-9][a-z0-9._~-]*\/[a-z0-9][a-z0-9._~-]*|[a-z0-9][a-z0-9._~-]*)$/.test(
|
|
36
|
-
value
|
|
37
|
-
);
|
|
38
|
-
var globallyAllowed = (value) => GLOBAL_PACKAGE_ALLOWLIST.some(
|
|
39
|
-
(allowed) => allowed.endsWith("/*") ? value.startsWith(allowed.slice(0, -1)) : value === allowed
|
|
40
|
-
);
|
|
41
|
-
function hostname(value) {
|
|
42
|
-
const wildcard = value.startsWith("*.");
|
|
43
|
-
const host = wildcard ? value.slice(2) : value;
|
|
44
|
-
if (!host.includes(".") || /^\d+(?:\.\d+){3}$/.test(host) || host.length > 253 || host.includes("..") || wildcard && /^(?:ac|co|com|edu|gov|net|org)\.[^.]+$/i.test(host)) {
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
return host.split(".").every(
|
|
48
|
-
(label) => label.length > 0 && label.length <= 63 && /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test(label)
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
export {
|
|
52
|
-
globallyAllowed,
|
|
53
|
-
hostname,
|
|
54
|
-
nonblank,
|
|
55
|
-
packageName,
|
|
56
|
-
record,
|
|
57
|
-
unknownKeys
|
|
58
|
-
};
|
|
1
|
+
import{GLOBAL_PACKAGE_ALLOWLIST}from"./types.js";var record=value=>!!value&&typeof value==="object"&&!Array.isArray(value);function distance(left,right){let row=[...Array(right.length+1).keys()];for(let leftIndex=1;leftIndex<=left.length;leftIndex+=1){const next=[leftIndex];for(let rightIndex=1;rightIndex<=right.length;rightIndex+=1){next[rightIndex]=Math.min(next[rightIndex-1]+1,row[rightIndex]+1,row[rightIndex-1]+(left[leftIndex-1]===right[rightIndex-1]?0:1))}row=next}return row[right.length]}function unknownKeys(value,allowed,path,issue){for(const key of Object.keys(value)){if(allowed.includes(key)){continue}let hint;let best=3;for(const candidate of allowed){const score=distance(key,candidate);if(score<best){best=score;hint=candidate}}issue({path:path?`${path}.${key}`:key,code:"unknown_key",message:hint?`Unknown field "${key}". Rename it to "${hint}".`:`Unknown field "${key}". Remove it from the configuration.`,severity:"error"})}}var nonblank=value=>typeof value==="string"&&value.trim().length>0;var packageName=value=>value.length<=214&&/^(?:@[a-z0-9][a-z0-9._~-]*\/[a-z0-9][a-z0-9._~-]*|[a-z0-9][a-z0-9._~-]*)$/.test(value);var globallyAllowed=value=>GLOBAL_PACKAGE_ALLOWLIST.some(allowed=>allowed.endsWith("/*")?value.startsWith(allowed.slice(0,-1)):value===allowed);function hostname(value){const wildcard=value.startsWith("*.");const host=wildcard?value.slice(2):value;if(!host.includes(".")||/^\d+(?:\.\d+){3}$/.test(host)||host.length>253||wildcard&&/^(?:ac|co|com|edu|gov|net|org)\.[^.]+$/i.test(host)){return false}return host.split(".").every(label=>/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i.test(label))}export{globallyAllowed,hostname,nonblank,packageName,record,unknownKeys};
|
|
59
2
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/site-config/helpers.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA,OAAS,6BAAkD,aAEpD,IAAM,OAAU,OACrB,CAAC,CAAC,OAAS,OAAO,QAAU,UAAY,CAAC,MAAM,QAAQ,KAAK,EAE9D,SAAS,SAAS,KAAc,MAAe,CAC7C,IAAI,IAAM,CAAC,GAAG,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I,MACzC,GACE,CAAC,KAAK,SAAS,GAAG,GAClB,oBAAoB,KAAK,IAAI,GAC7B,KAAK,OAAS,KACb,UAAY,0CAA0C,KAAK,IAAI,EAChE,CACA,MAAO,MACT,CAEA,OAAO,KACJ,MAAM,GAAG,EACT,MAAO,OAAU,0CAA0C,KAAK,KAAK,CAAC,CAC3E",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,115 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { nonblank, record, unknownKeys } from "./helpers.js";
|
|
3
|
-
import { DEFAULT_BUDGETS } from "./types.js";
|
|
4
|
-
var budgetKeys = [
|
|
5
|
-
...Object.keys(DEFAULT_BUDGETS),
|
|
6
|
-
"routeCssKbGz",
|
|
7
|
-
"unusedCssPercent"
|
|
8
|
-
];
|
|
9
|
-
function nested(value, path, keys, issue, validate) {
|
|
10
|
-
if (value === void 0) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
if (!record(value)) {
|
|
14
|
-
issue({
|
|
15
|
-
path,
|
|
16
|
-
code: "invalid_type",
|
|
17
|
-
message: `Expected an object. Set ${path} to an object or remove it.`,
|
|
18
|
-
severity: "error"
|
|
19
|
-
});
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
unknownKeys(value, keys, path, issue);
|
|
23
|
-
validate(value);
|
|
24
|
-
}
|
|
25
|
-
function budgets(value, issue, error) {
|
|
26
|
-
nested(value, "budgets", [...budgetKeys, "override"], issue, (budget) => {
|
|
27
|
-
nested(
|
|
28
|
-
budget.override,
|
|
29
|
-
"budgets.override",
|
|
30
|
-
["reason"],
|
|
31
|
-
issue,
|
|
32
|
-
(override) => {
|
|
33
|
-
if (!nonblank(override.reason)) {
|
|
34
|
-
error(
|
|
35
|
-
"budgets.override.reason",
|
|
36
|
-
"invalid_format",
|
|
37
|
-
"Expected a non-blank reason. Explain why the default budget must be raised."
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
for (const key of budgetKeys) {
|
|
43
|
-
const value2 = budget[key];
|
|
44
|
-
for (const [route, amount] of Object.entries(
|
|
45
|
-
key === "routeCssKbGz" && record(value2) ? value2 : { "": value2 }
|
|
46
|
-
)) {
|
|
47
|
-
const path = `budgets.${key}${route && `.${route}`}`;
|
|
48
|
-
if (amount === void 0) {
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
if (!Number.isFinite(amount) || amount <= 0) {
|
|
52
|
-
error(
|
|
53
|
-
path,
|
|
54
|
-
"invalid_type",
|
|
55
|
-
`Expected a positive finite number. Set ${path} to a number greater than zero.`
|
|
56
|
-
);
|
|
57
|
-
} else if (key === "tappableMs" && amount > 5e3) {
|
|
58
|
-
error(
|
|
59
|
-
path,
|
|
60
|
-
"invalid_format",
|
|
61
|
-
`The ${key} budget cannot exceed 5000. Set ${path} to 5000 or less.`
|
|
62
|
-
);
|
|
63
|
-
} else if (amount > DEFAULT_BUDGETS[key]) {
|
|
64
|
-
const message = `The ${key} budget exceeds the ${DEFAULT_BUDGETS[key]} default.`;
|
|
65
|
-
if (!budget.override) {
|
|
66
|
-
error(
|
|
67
|
-
path,
|
|
68
|
-
"budget_override",
|
|
69
|
-
`${message} Add budgets.override.reason to explain the increase.`
|
|
70
|
-
);
|
|
71
|
-
} else {
|
|
72
|
-
issue({
|
|
73
|
-
path,
|
|
74
|
-
code: "budget_override",
|
|
75
|
-
message: `${message} Lower it to the default when the exception is no longer needed.`,
|
|
76
|
-
severity: "warning"
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
function analytics(value, issue, error) {
|
|
85
|
-
nested(value, "analytics", ["forward"], issue, (analyticsValue) => {
|
|
86
|
-
nested(
|
|
87
|
-
analyticsValue.forward,
|
|
88
|
-
"analytics.forward",
|
|
89
|
-
["ga4", "metaPixel"],
|
|
90
|
-
issue,
|
|
91
|
-
(forward) => {
|
|
92
|
-
if (forward.ga4 !== void 0 && (typeof forward.ga4 !== "string" || !/^G-[A-Z0-9]+$/.test(forward.ga4))) {
|
|
93
|
-
error(
|
|
94
|
-
"analytics.forward.ga4",
|
|
95
|
-
"invalid_format",
|
|
96
|
-
"Expected a GA4 measurement id beginning with G-. Use a value such as G-XXXXXXXXXX."
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
if (forward.metaPixel !== void 0 && (typeof forward.metaPixel !== "string" || !/^\d+$/.test(forward.metaPixel))) {
|
|
100
|
-
error(
|
|
101
|
-
"analytics.forward.metaPixel",
|
|
102
|
-
"invalid_format",
|
|
103
|
-
"Expected a numeric Meta Pixel id. Use digits only."
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
);
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
export {
|
|
111
|
-
analytics,
|
|
112
|
-
budgets,
|
|
113
|
-
nested
|
|
114
|
-
};
|
|
1
|
+
import{nonblank,record,unknownKeys}from"./helpers.js";import{DEFAULT_BUDGETS}from"./types.js";var budgetKeys=[...Object.keys(DEFAULT_BUDGETS),"routeCssKbGz","unusedCssPercent"];function nested(value,path,keys,issue,validate){if(value===void 0){return}if(!record(value)){issue({path,code:"invalid_type",message:`Expected an object. Set ${path} to an object or remove it.`,severity:"error"});return}unknownKeys(value,keys,path,issue);validate(value)}function budgets(value,issue,error){nested(value,"budgets",[...budgetKeys,"override"],issue,budget=>{nested(budget.override,"budgets.override",["reason"],issue,override=>{if(!nonblank(override.reason)){error("budgets.override.reason","invalid_format","Expected a non-blank reason. Explain why the default budget must be raised.")}});for(const key of budgetKeys){const value2=budget[key];for(const[route,amount]of Object.entries(key==="routeCssKbGz"&&record(value2)?value2:{"":value2})){const path=`budgets.${key}${route&&`.${route}`}`;if(amount===void 0){continue}if(!Number.isFinite(amount)||amount<=0){error(path,"invalid_type",`Expected a positive finite number. Set ${path} to a number greater than zero.`)}else if(key==="tappableMs"&&amount>5e3){error(path,"invalid_format",`The ${key} budget cannot exceed 5000. Set ${path} to 5000 or less.`)}else if(amount>DEFAULT_BUDGETS[key]){const message=`The ${key} budget exceeds the ${DEFAULT_BUDGETS[key]} default.`;if(!budget.override){error(path,"budget_override",`${message} Add budgets.override.reason to explain the increase.`)}else{issue({path,code:"budget_override",message:`${message} Lower it to the default when the exception is no longer needed.`,severity:"warning"})}}}}})}function analytics(value,issue,error){nested(value,"analytics",["forward"],issue,analyticsValue=>{nested(analyticsValue.forward,"analytics.forward",["ga4","metaPixel"],issue,forward=>{if(forward.ga4!==void 0&&(typeof forward.ga4!=="string"||!/^G-[A-Z0-9]+$/.test(forward.ga4))){error("analytics.forward.ga4","invalid_format","Expected a GA4 measurement id beginning with G-. Use a value such as G-XXXXXXXXXX.")}if(forward.metaPixel!==void 0&&(typeof forward.metaPixel!=="string"||!/^\d+$/.test(forward.metaPixel))){error("analytics.forward.metaPixel","invalid_format","Expected a numeric Meta Pixel id. Use digits only.")}})})}export{analytics,budgets,nested};
|
|
115
2
|
//# sourceMappingURL=sections.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/site-config/sections.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA,OAAS,SAAU,OAAQ,gBAAmB,eAC9C,OAAS,oBAAyC,aAGlD,IAAM,WAAa,CACjB,GAAG,OAAO,KAAK,eAAe,EAC9B,eACA,kBACF,EASO,SAAS,OACd,MACA,KACA,KACA,MACA,SACA,CACA,GAAI,QAAU,OAAW,CACvB,MACF,CACA,GAAI,CAAC,OAAO,KAAK,EAAG,CAClB,MAAM,CACJ,KACA,KAAM,eACN,QAAS,2BAA2B,IAAI,8BACxC,SAAU,OACZ,CAAC,EACD,MACF,CACA,YAAY,MAAO,KAAM,KAAM,KAAK,EACpC,SAAS,KAAK,CAChB,CAEO,SAAS,QAAQ,MAAgB,MAAiB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A,MACE,wBACA,iBACA,oFACF,CACF,CACA,GACE,QAAQ,YAAc,SACrB,OAAO,QAAQ,YAAc,UAC5B,CAAC,QAAQ,KAAK,QAAQ,SAAS,GACjC,CACA,MACE,8BACA,iBACA,oDACF,CACF,CACF,CACF,CACF,CAAC,CACH",
|
|
5
5
|
"names": ["value"]
|
|
6
6
|
}
|
|
@@ -1,32 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var DEFAULT_BUDGETS = {
|
|
3
|
-
jsKbGz: 200,
|
|
4
|
-
cssKbGz: 50,
|
|
5
|
-
lcpMs: 2500,
|
|
6
|
-
tappableMs: 3e3
|
|
7
|
-
};
|
|
8
|
-
var GLOBAL_PACKAGE_ALLOWLIST = [
|
|
9
|
-
"react",
|
|
10
|
-
"react-dom",
|
|
11
|
-
"react-router",
|
|
12
|
-
"@react-router/*",
|
|
13
|
-
"@zappie/*",
|
|
14
|
-
"tailwindcss",
|
|
15
|
-
"@tailwindcss/*",
|
|
16
|
-
"clsx",
|
|
17
|
-
"tailwind-merge",
|
|
18
|
-
"class-variance-authority",
|
|
19
|
-
"lucide-react",
|
|
20
|
-
"date-fns",
|
|
21
|
-
"embla-carousel-react",
|
|
22
|
-
"framer-motion/motion",
|
|
23
|
-
"zod",
|
|
24
|
-
"@radix-ui/*",
|
|
25
|
-
"sonner",
|
|
26
|
-
"vaul"
|
|
27
|
-
];
|
|
28
|
-
export {
|
|
29
|
-
DEFAULT_BUDGETS,
|
|
30
|
-
GLOBAL_PACKAGE_ALLOWLIST
|
|
31
|
-
};
|
|
1
|
+
var DEFAULT_BUDGETS={jsKbGz:200,cssKbGz:50,lcpMs:2500,tappableMs:3e3};var GLOBAL_PACKAGE_ALLOWLIST=["react","react-dom","react-router","@react-router/*","@zappie/*","tailwindcss","@tailwindcss/*","clsx","tailwind-merge","class-variance-authority","lucide-react","date-fns","embla-carousel-react","framer-motion/motion","zod","@radix-ui/*","sonner","vaul"];export{DEFAULT_BUDGETS,GLOBAL_PACKAGE_ALLOWLIST};
|
|
32
2
|
//# sourceMappingURL=types.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/site-config/types.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAGO,IAAM,gBAAkB,CAC7B,OAAQ,IACR,QAAS,GACT,MAAO,KACP,WAAY,GACd,EAKO,IAAM,yBAA2B,CACtC,QACA,YACA,eACA,kBACA,YACA,cACA,iBACA,OACA,iBACA,2BACA,eACA,WACA,uBACA,uBACA,MACA,cACA,SACA,MACF",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|