@schematichq/schematic-components 0.7.1 → 0.7.4
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/schematic-components.cjs.js +911 -730
- package/dist/schematic-components.d.ts +316 -71
- package/dist/schematic-components.esm.js +823 -642
- package/package.json +3 -3
|
@@ -30,28 +30,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
// node_modules/void-elements/index.js
|
|
34
|
-
var require_void_elements = __commonJS({
|
|
35
|
-
"node_modules/void-elements/index.js"(exports, module2) {
|
|
36
|
-
module2.exports = {
|
|
37
|
-
"area": true,
|
|
38
|
-
"base": true,
|
|
39
|
-
"br": true,
|
|
40
|
-
"col": true,
|
|
41
|
-
"embed": true,
|
|
42
|
-
"hr": true,
|
|
43
|
-
"img": true,
|
|
44
|
-
"input": true,
|
|
45
|
-
"link": true,
|
|
46
|
-
"meta": true,
|
|
47
|
-
"param": true,
|
|
48
|
-
"source": true,
|
|
49
|
-
"track": true,
|
|
50
|
-
"wbr": true
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
33
|
// node_modules/shallowequal/index.js
|
|
56
34
|
var require_shallowequal = __commonJS({
|
|
57
35
|
"node_modules/shallowequal/index.js"(exports, module2) {
|
|
@@ -1664,6 +1642,28 @@ var require_merge = __commonJS({
|
|
|
1664
1642
|
}
|
|
1665
1643
|
});
|
|
1666
1644
|
|
|
1645
|
+
// node_modules/void-elements/index.js
|
|
1646
|
+
var require_void_elements = __commonJS({
|
|
1647
|
+
"node_modules/void-elements/index.js"(exports, module2) {
|
|
1648
|
+
module2.exports = {
|
|
1649
|
+
"area": true,
|
|
1650
|
+
"base": true,
|
|
1651
|
+
"br": true,
|
|
1652
|
+
"col": true,
|
|
1653
|
+
"embed": true,
|
|
1654
|
+
"hr": true,
|
|
1655
|
+
"img": true,
|
|
1656
|
+
"input": true,
|
|
1657
|
+
"link": true,
|
|
1658
|
+
"meta": true,
|
|
1659
|
+
"param": true,
|
|
1660
|
+
"source": true,
|
|
1661
|
+
"track": true,
|
|
1662
|
+
"wbr": true
|
|
1663
|
+
};
|
|
1664
|
+
}
|
|
1665
|
+
});
|
|
1666
|
+
|
|
1667
1667
|
// node_modules/pluralize/pluralize.js
|
|
1668
1668
|
var require_pluralize = __commonJS({
|
|
1669
1669
|
"node_modules/pluralize/pluralize.js"(exports, module2) {
|
|
@@ -2257,6 +2257,7 @@ var index_exports = {};
|
|
|
2257
2257
|
__export(index_exports, {
|
|
2258
2258
|
Box: () => Box,
|
|
2259
2259
|
Button: () => Button2,
|
|
2260
|
+
ButtonElement: () => ButtonElement,
|
|
2260
2261
|
Card: () => Card,
|
|
2261
2262
|
Column: () => Column,
|
|
2262
2263
|
Container: () => Container2,
|
|
@@ -2285,6 +2286,7 @@ __export(index_exports, {
|
|
|
2285
2286
|
SchematicEmbed: () => SchematicEmbed,
|
|
2286
2287
|
StyledCard: () => StyledCard,
|
|
2287
2288
|
Text: () => Text,
|
|
2289
|
+
TextElement: () => TextElement,
|
|
2288
2290
|
TextPropNames: () => TextPropNames,
|
|
2289
2291
|
Tooltip: () => Tooltip,
|
|
2290
2292
|
UnsubscribeButton: () => UnsubscribeButton,
|
|
@@ -2303,280 +2305,11 @@ __export(index_exports, {
|
|
|
2303
2305
|
});
|
|
2304
2306
|
module.exports = __toCommonJS(index_exports);
|
|
2305
2307
|
|
|
2306
|
-
// src/components/elements/
|
|
2307
|
-
var
|
|
2308
|
-
|
|
2309
|
-
// node_modules/react-i18next/dist/es/Trans.js
|
|
2310
|
-
var import_react3 = require("react");
|
|
2311
|
-
|
|
2312
|
-
// node_modules/react-i18next/dist/es/TransWithoutContext.js
|
|
2313
|
-
var import_react = require("react");
|
|
2314
|
-
|
|
2315
|
-
// node_modules/html-parse-stringify/dist/html-parse-stringify.module.js
|
|
2316
|
-
var import_void_elements = __toESM(require_void_elements());
|
|
2317
|
-
|
|
2318
|
-
// node_modules/react-i18next/dist/es/utils.js
|
|
2319
|
-
var warn = (i18n, code, msg, rest) => {
|
|
2320
|
-
const args = [msg, {
|
|
2321
|
-
code,
|
|
2322
|
-
...rest || {}
|
|
2323
|
-
}];
|
|
2324
|
-
if (i18n?.services?.logger?.forward) {
|
|
2325
|
-
return i18n.services.logger.forward(args, "warn", "react-i18next::", true);
|
|
2326
|
-
}
|
|
2327
|
-
if (isString(args[0])) args[0] = `react-i18next:: ${args[0]}`;
|
|
2328
|
-
if (i18n?.services?.logger?.warn) {
|
|
2329
|
-
i18n.services.logger.warn(...args);
|
|
2330
|
-
} else if (console?.warn) {
|
|
2331
|
-
console.warn(...args);
|
|
2332
|
-
}
|
|
2333
|
-
};
|
|
2334
|
-
var alreadyWarned = {};
|
|
2335
|
-
var warnOnce = (i18n, code, msg, rest) => {
|
|
2336
|
-
if (isString(msg) && alreadyWarned[msg]) return;
|
|
2337
|
-
if (isString(msg)) alreadyWarned[msg] = /* @__PURE__ */ new Date();
|
|
2338
|
-
warn(i18n, code, msg, rest);
|
|
2339
|
-
};
|
|
2340
|
-
var loadedClb = (i18n, cb) => () => {
|
|
2341
|
-
if (i18n.isInitialized) {
|
|
2342
|
-
cb();
|
|
2343
|
-
} else {
|
|
2344
|
-
const initialized = () => {
|
|
2345
|
-
setTimeout(() => {
|
|
2346
|
-
i18n.off("initialized", initialized);
|
|
2347
|
-
}, 0);
|
|
2348
|
-
cb();
|
|
2349
|
-
};
|
|
2350
|
-
i18n.on("initialized", initialized);
|
|
2351
|
-
}
|
|
2352
|
-
};
|
|
2353
|
-
var loadNamespaces = (i18n, ns, cb) => {
|
|
2354
|
-
i18n.loadNamespaces(ns, loadedClb(i18n, cb));
|
|
2355
|
-
};
|
|
2356
|
-
var loadLanguages = (i18n, lng, ns, cb) => {
|
|
2357
|
-
if (isString(ns)) ns = [ns];
|
|
2358
|
-
if (i18n.options.preload && i18n.options.preload.indexOf(lng) > -1) return loadNamespaces(i18n, ns, cb);
|
|
2359
|
-
ns.forEach((n) => {
|
|
2360
|
-
if (i18n.options.ns.indexOf(n) < 0) i18n.options.ns.push(n);
|
|
2361
|
-
});
|
|
2362
|
-
i18n.loadLanguages(lng, loadedClb(i18n, cb));
|
|
2363
|
-
};
|
|
2364
|
-
var hasLoadedNamespace = (ns, i18n, options = {}) => {
|
|
2365
|
-
if (!i18n.languages || !i18n.languages.length) {
|
|
2366
|
-
warnOnce(i18n, "NO_LANGUAGES", "i18n.languages were undefined or empty", {
|
|
2367
|
-
languages: i18n.languages
|
|
2368
|
-
});
|
|
2369
|
-
return true;
|
|
2370
|
-
}
|
|
2371
|
-
return i18n.hasLoadedNamespace(ns, {
|
|
2372
|
-
lng: options.lng,
|
|
2373
|
-
precheck: (i18nInstance2, loadNotPending) => {
|
|
2374
|
-
if (options.bindI18n?.indexOf("languageChanging") > -1 && i18nInstance2.services.backendConnector.backend && i18nInstance2.isLanguageChangingTo && !loadNotPending(i18nInstance2.isLanguageChangingTo, ns)) return false;
|
|
2375
|
-
}
|
|
2376
|
-
});
|
|
2377
|
-
};
|
|
2378
|
-
var isString = (obj) => typeof obj === "string";
|
|
2379
|
-
var isObject = (obj) => typeof obj === "object" && obj !== null;
|
|
2380
|
-
|
|
2381
|
-
// node_modules/react-i18next/dist/es/unescape.js
|
|
2382
|
-
var matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
|
|
2383
|
-
var htmlEntities = {
|
|
2384
|
-
"&": "&",
|
|
2385
|
-
"&": "&",
|
|
2386
|
-
"<": "<",
|
|
2387
|
-
"<": "<",
|
|
2388
|
-
">": ">",
|
|
2389
|
-
">": ">",
|
|
2390
|
-
"'": "'",
|
|
2391
|
-
"'": "'",
|
|
2392
|
-
""": '"',
|
|
2393
|
-
""": '"',
|
|
2394
|
-
" ": " ",
|
|
2395
|
-
" ": " ",
|
|
2396
|
-
"©": "\xA9",
|
|
2397
|
-
"©": "\xA9",
|
|
2398
|
-
"®": "\xAE",
|
|
2399
|
-
"®": "\xAE",
|
|
2400
|
-
"…": "\u2026",
|
|
2401
|
-
"…": "\u2026",
|
|
2402
|
-
"/": "/",
|
|
2403
|
-
"/": "/"
|
|
2404
|
-
};
|
|
2405
|
-
var unescapeHtmlEntity = (m2) => htmlEntities[m2];
|
|
2406
|
-
var unescape = (text) => text.replace(matchHtmlEntity, unescapeHtmlEntity);
|
|
2407
|
-
|
|
2408
|
-
// node_modules/react-i18next/dist/es/defaults.js
|
|
2409
|
-
var defaultOptions = {
|
|
2410
|
-
bindI18n: "languageChanged",
|
|
2411
|
-
bindI18nStore: "",
|
|
2412
|
-
transEmptyNodeValue: "",
|
|
2413
|
-
transSupportBasicHtmlNodes: true,
|
|
2414
|
-
transWrapTextNodes: "",
|
|
2415
|
-
transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
|
|
2416
|
-
useSuspense: true,
|
|
2417
|
-
unescape
|
|
2418
|
-
};
|
|
2419
|
-
var setDefaults = (options = {}) => {
|
|
2420
|
-
defaultOptions = {
|
|
2421
|
-
...defaultOptions,
|
|
2422
|
-
...options
|
|
2423
|
-
};
|
|
2424
|
-
};
|
|
2425
|
-
var getDefaults = () => defaultOptions;
|
|
2426
|
-
|
|
2427
|
-
// node_modules/react-i18next/dist/es/i18nInstance.js
|
|
2428
|
-
var i18nInstance;
|
|
2429
|
-
var setI18n = (instance2) => {
|
|
2430
|
-
i18nInstance = instance2;
|
|
2431
|
-
};
|
|
2432
|
-
var getI18n = () => i18nInstance;
|
|
2433
|
-
|
|
2434
|
-
// node_modules/react-i18next/dist/es/context.js
|
|
2435
|
-
var import_react2 = require("react");
|
|
2436
|
-
|
|
2437
|
-
// node_modules/react-i18next/dist/es/initReactI18next.js
|
|
2438
|
-
var initReactI18next = {
|
|
2439
|
-
type: "3rdParty",
|
|
2440
|
-
init(instance2) {
|
|
2441
|
-
setDefaults(instance2.options.react);
|
|
2442
|
-
setI18n(instance2);
|
|
2443
|
-
}
|
|
2444
|
-
};
|
|
2445
|
-
|
|
2446
|
-
// node_modules/react-i18next/dist/es/context.js
|
|
2447
|
-
var I18nContext = (0, import_react2.createContext)();
|
|
2448
|
-
var ReportNamespaces = class {
|
|
2449
|
-
constructor() {
|
|
2450
|
-
this.usedNamespaces = {};
|
|
2451
|
-
}
|
|
2452
|
-
addUsedNamespaces(namespaces) {
|
|
2453
|
-
namespaces.forEach((ns) => {
|
|
2454
|
-
if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true;
|
|
2455
|
-
});
|
|
2456
|
-
}
|
|
2457
|
-
getUsedNamespaces() {
|
|
2458
|
-
return Object.keys(this.usedNamespaces);
|
|
2459
|
-
}
|
|
2460
|
-
};
|
|
2461
|
-
|
|
2462
|
-
// node_modules/react-i18next/dist/es/useTranslation.js
|
|
2463
|
-
var import_react4 = require("react");
|
|
2464
|
-
var usePrevious = (value, ignore) => {
|
|
2465
|
-
const ref = (0, import_react4.useRef)();
|
|
2466
|
-
(0, import_react4.useEffect)(() => {
|
|
2467
|
-
ref.current = ignore ? ref.current : value;
|
|
2468
|
-
}, [value, ignore]);
|
|
2469
|
-
return ref.current;
|
|
2470
|
-
};
|
|
2471
|
-
var alwaysNewT = (i18n, language, namespace, keyPrefix) => i18n.getFixedT(language, namespace, keyPrefix);
|
|
2472
|
-
var useMemoizedT = (i18n, language, namespace, keyPrefix) => (0, import_react4.useCallback)(alwaysNewT(i18n, language, namespace, keyPrefix), [i18n, language, namespace, keyPrefix]);
|
|
2473
|
-
var useTranslation = (ns, props = {}) => {
|
|
2474
|
-
const {
|
|
2475
|
-
i18n: i18nFromProps
|
|
2476
|
-
} = props;
|
|
2477
|
-
const {
|
|
2478
|
-
i18n: i18nFromContext,
|
|
2479
|
-
defaultNS: defaultNSFromContext
|
|
2480
|
-
} = (0, import_react4.useContext)(I18nContext) || {};
|
|
2481
|
-
const i18n = i18nFromProps || i18nFromContext || getI18n();
|
|
2482
|
-
if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();
|
|
2483
|
-
if (!i18n) {
|
|
2484
|
-
warnOnce(i18n, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
|
|
2485
|
-
const notReadyT = (k2, optsOrDefaultValue) => {
|
|
2486
|
-
if (isString(optsOrDefaultValue)) return optsOrDefaultValue;
|
|
2487
|
-
if (isObject(optsOrDefaultValue) && isString(optsOrDefaultValue.defaultValue)) return optsOrDefaultValue.defaultValue;
|
|
2488
|
-
return Array.isArray(k2) ? k2[k2.length - 1] : k2;
|
|
2489
|
-
};
|
|
2490
|
-
const retNotReady = [notReadyT, {}, false];
|
|
2491
|
-
retNotReady.t = notReadyT;
|
|
2492
|
-
retNotReady.i18n = {};
|
|
2493
|
-
retNotReady.ready = false;
|
|
2494
|
-
return retNotReady;
|
|
2495
|
-
}
|
|
2496
|
-
if (i18n.options.react?.wait) warnOnce(i18n, "DEPRECATED_OPTION", "useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
|
|
2497
|
-
const i18nOptions = {
|
|
2498
|
-
...getDefaults(),
|
|
2499
|
-
...i18n.options.react,
|
|
2500
|
-
...props
|
|
2501
|
-
};
|
|
2502
|
-
const {
|
|
2503
|
-
useSuspense,
|
|
2504
|
-
keyPrefix
|
|
2505
|
-
} = i18nOptions;
|
|
2506
|
-
let namespaces = ns || defaultNSFromContext || i18n.options?.defaultNS;
|
|
2507
|
-
namespaces = isString(namespaces) ? [namespaces] : namespaces || ["translation"];
|
|
2508
|
-
i18n.reportNamespaces.addUsedNamespaces?.(namespaces);
|
|
2509
|
-
const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every((n) => hasLoadedNamespace(n, i18n, i18nOptions));
|
|
2510
|
-
const memoGetT = useMemoizedT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
|
|
2511
|
-
const getT = () => memoGetT;
|
|
2512
|
-
const getNewT = () => alwaysNewT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
|
|
2513
|
-
const [t2, setT] = (0, import_react4.useState)(getT);
|
|
2514
|
-
let joinedNS = namespaces.join();
|
|
2515
|
-
if (props.lng) joinedNS = `${props.lng}${joinedNS}`;
|
|
2516
|
-
const previousJoinedNS = usePrevious(joinedNS);
|
|
2517
|
-
const isMounted = (0, import_react4.useRef)(true);
|
|
2518
|
-
(0, import_react4.useEffect)(() => {
|
|
2519
|
-
const {
|
|
2520
|
-
bindI18n,
|
|
2521
|
-
bindI18nStore
|
|
2522
|
-
} = i18nOptions;
|
|
2523
|
-
isMounted.current = true;
|
|
2524
|
-
if (!ready && !useSuspense) {
|
|
2525
|
-
if (props.lng) {
|
|
2526
|
-
loadLanguages(i18n, props.lng, namespaces, () => {
|
|
2527
|
-
if (isMounted.current) setT(getNewT);
|
|
2528
|
-
});
|
|
2529
|
-
} else {
|
|
2530
|
-
loadNamespaces(i18n, namespaces, () => {
|
|
2531
|
-
if (isMounted.current) setT(getNewT);
|
|
2532
|
-
});
|
|
2533
|
-
}
|
|
2534
|
-
}
|
|
2535
|
-
if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
|
|
2536
|
-
setT(getNewT);
|
|
2537
|
-
}
|
|
2538
|
-
const boundReset = () => {
|
|
2539
|
-
if (isMounted.current) setT(getNewT);
|
|
2540
|
-
};
|
|
2541
|
-
if (bindI18n) i18n?.on(bindI18n, boundReset);
|
|
2542
|
-
if (bindI18nStore) i18n?.store.on(bindI18nStore, boundReset);
|
|
2543
|
-
return () => {
|
|
2544
|
-
isMounted.current = false;
|
|
2545
|
-
if (i18n) bindI18n?.split(" ").forEach((e2) => i18n.off(e2, boundReset));
|
|
2546
|
-
if (bindI18nStore && i18n) bindI18nStore.split(" ").forEach((e2) => i18n.store.off(e2, boundReset));
|
|
2547
|
-
};
|
|
2548
|
-
}, [i18n, joinedNS]);
|
|
2549
|
-
(0, import_react4.useEffect)(() => {
|
|
2550
|
-
if (isMounted.current && ready) {
|
|
2551
|
-
setT(getT);
|
|
2552
|
-
}
|
|
2553
|
-
}, [i18n, keyPrefix, ready]);
|
|
2554
|
-
const ret = [t2, i18n, ready];
|
|
2555
|
-
ret.t = t2;
|
|
2556
|
-
ret.i18n = i18n;
|
|
2557
|
-
ret.ready = ready;
|
|
2558
|
-
if (ready) return ret;
|
|
2559
|
-
if (!ready && !useSuspense) return ret;
|
|
2560
|
-
throw new Promise((resolve) => {
|
|
2561
|
-
if (props.lng) {
|
|
2562
|
-
loadLanguages(i18n, props.lng, namespaces, () => resolve());
|
|
2563
|
-
} else {
|
|
2564
|
-
loadNamespaces(i18n, namespaces, () => resolve());
|
|
2565
|
-
}
|
|
2566
|
-
});
|
|
2567
|
-
};
|
|
2568
|
-
|
|
2569
|
-
// node_modules/react-i18next/dist/es/withTranslation.js
|
|
2570
|
-
var import_react5 = require("react");
|
|
2571
|
-
|
|
2572
|
-
// node_modules/react-i18next/dist/es/I18nextProvider.js
|
|
2573
|
-
var import_react6 = require("react");
|
|
2574
|
-
|
|
2575
|
-
// node_modules/react-i18next/dist/es/withSSR.js
|
|
2576
|
-
var import_react8 = require("react");
|
|
2308
|
+
// src/components/elements/button/Button.tsx
|
|
2309
|
+
var import_react31 = require("react");
|
|
2577
2310
|
|
|
2578
|
-
//
|
|
2579
|
-
var
|
|
2311
|
+
// src/components/layout/card/Card.tsx
|
|
2312
|
+
var import_react20 = require("react");
|
|
2580
2313
|
|
|
2581
2314
|
// node_modules/styled-components/node_modules/tslib/tslib.es6.mjs
|
|
2582
2315
|
var __assign = function() {
|
|
@@ -2618,7 +2351,7 @@ var isPropValid = /* @__PURE__ */ memoize(
|
|
|
2618
2351
|
);
|
|
2619
2352
|
|
|
2620
2353
|
// node_modules/styled-components/dist/styled-components.browser.esm.js
|
|
2621
|
-
var
|
|
2354
|
+
var import_react = __toESM(require("react"));
|
|
2622
2355
|
var import_shallowequal = __toESM(require_shallowequal());
|
|
2623
2356
|
|
|
2624
2357
|
// node_modules/stylis/src/Enum.js
|
|
@@ -3284,7 +3017,7 @@ var unitlessKeys = {
|
|
|
3284
3017
|
var f = "undefined" != typeof process && void 0 !== process.env && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || "data-styled";
|
|
3285
3018
|
var m = "active";
|
|
3286
3019
|
var y = "data-styled-version";
|
|
3287
|
-
var v = "6.1.
|
|
3020
|
+
var v = "6.1.17";
|
|
3288
3021
|
var g = "/*!sc*/\n";
|
|
3289
3022
|
var S = "undefined" != typeof window && "HTMLElement" in window;
|
|
3290
3023
|
var w = Boolean("boolean" == typeof SC_DISABLE_SPEEDY ? SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== process.env && void 0 !== process.env.REACT_APP_SC_DISABLE_SPEEDY && "" !== process.env.REACT_APP_SC_DISABLE_SPEEDY ? "false" !== process.env.REACT_APP_SC_DISABLE_SPEEDY && process.env.REACT_APP_SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== process.env && void 0 !== process.env.SC_DISABLE_SPEEDY && "" !== process.env.SC_DISABLE_SPEEDY ? "false" !== process.env.SC_DISABLE_SPEEDY && process.env.SC_DISABLE_SPEEDY : true);
|
|
@@ -3293,13 +3026,13 @@ var E = /invalid hook call/i;
|
|
|
3293
3026
|
var N = /* @__PURE__ */ new Set();
|
|
3294
3027
|
var P = function(t2, n) {
|
|
3295
3028
|
if (true) {
|
|
3296
|
-
var o2 = n ? ' with the id of "'.concat(n, '"') : "", s2 = "The component ".concat(t2).concat(o2, " has been created dynamically.\n") + "You may see this warning because you've called styled inside another component.\nTo resolve this only create new StyledComponents outside of any render method and function component.", i2 = console.error;
|
|
3029
|
+
var o2 = n ? ' with the id of "'.concat(n, '"') : "", s2 = "The component ".concat(t2).concat(o2, " has been created dynamically.\n") + "You may see this warning because you've called styled inside another component.\nTo resolve this only create new StyledComponents outside of any render method and function component.\nSee https://styled-components.com/docs/basics#define-styled-components-outside-of-the-render-method for more info.\n", i2 = console.error;
|
|
3297
3030
|
try {
|
|
3298
3031
|
var a2 = true;
|
|
3299
3032
|
console.error = function(t3) {
|
|
3300
3033
|
for (var n2 = [], o3 = 1; o3 < arguments.length; o3++) n2[o3 - 1] = arguments[o3];
|
|
3301
3034
|
E.test(t3) ? (a2 = false, N.delete(s2)) : i2.apply(void 0, __spreadArray([t3], n2, false));
|
|
3302
|
-
}, (0,
|
|
3035
|
+
}, (0, import_react.useRef)(), a2 && !N.has(s2) && (console.warn(s2), N.add(s2));
|
|
3303
3036
|
} catch (e2) {
|
|
3304
3037
|
E.test(e2.message) && N.delete(s2);
|
|
3305
3038
|
} finally {
|
|
@@ -3637,26 +3370,26 @@ function Fe(e2) {
|
|
|
3637
3370
|
}
|
|
3638
3371
|
var Me = new ke();
|
|
3639
3372
|
var ze = Fe();
|
|
3640
|
-
var $e =
|
|
3373
|
+
var $e = import_react.default.createContext({ shouldForwardProp: void 0, styleSheet: Me, stylis: ze });
|
|
3641
3374
|
var Be = $e.Consumer;
|
|
3642
|
-
var Le =
|
|
3375
|
+
var Le = import_react.default.createContext(void 0);
|
|
3643
3376
|
function Ge() {
|
|
3644
|
-
return (0,
|
|
3377
|
+
return (0, import_react.useContext)($e);
|
|
3645
3378
|
}
|
|
3646
3379
|
function Ye(e2) {
|
|
3647
|
-
var t2 = (0,
|
|
3380
|
+
var t2 = (0, import_react.useState)(e2.stylisPlugins), n = t2[0], r2 = t2[1], c2 = Ge().styleSheet, l2 = (0, import_react.useMemo)(function() {
|
|
3648
3381
|
var t3 = c2;
|
|
3649
3382
|
return e2.sheet ? t3 = e2.sheet : e2.target && (t3 = t3.reconstructWithOptions({ target: e2.target }, false)), e2.disableCSSOMInjection && (t3 = t3.reconstructWithOptions({ useCSSOMInjection: false })), t3;
|
|
3650
|
-
}, [e2.disableCSSOMInjection, e2.sheet, e2.target, c2]), u2 = (0,
|
|
3383
|
+
}, [e2.disableCSSOMInjection, e2.sheet, e2.target, c2]), u2 = (0, import_react.useMemo)(function() {
|
|
3651
3384
|
return Fe({ options: { namespace: e2.namespace, prefix: e2.enableVendorPrefixes }, plugins: n });
|
|
3652
3385
|
}, [e2.enableVendorPrefixes, e2.namespace, n]);
|
|
3653
|
-
(0,
|
|
3386
|
+
(0, import_react.useEffect)(function() {
|
|
3654
3387
|
(0, import_shallowequal.default)(n, e2.stylisPlugins) || r2(e2.stylisPlugins);
|
|
3655
3388
|
}, [e2.stylisPlugins]);
|
|
3656
|
-
var d = (0,
|
|
3389
|
+
var d = (0, import_react.useMemo)(function() {
|
|
3657
3390
|
return { shouldForwardProp: e2.shouldForwardProp, styleSheet: l2, stylis: u2 };
|
|
3658
3391
|
}, [e2.shouldForwardProp, l2, u2]);
|
|
3659
|
-
return
|
|
3392
|
+
return import_react.default.createElement($e.Provider, { value: d }, import_react.default.createElement(Le.Provider, { value: u2 }, e2.children));
|
|
3660
3393
|
}
|
|
3661
3394
|
var We = function() {
|
|
3662
3395
|
function e2(e3, t2) {
|
|
@@ -3748,15 +3481,15 @@ var Qe = function() {
|
|
|
3748
3481
|
return o2;
|
|
3749
3482
|
}, e2;
|
|
3750
3483
|
}();
|
|
3751
|
-
var et =
|
|
3484
|
+
var et = import_react.default.createContext(void 0);
|
|
3752
3485
|
var tt = et.Consumer;
|
|
3753
3486
|
function nt() {
|
|
3754
|
-
var e2 = (0,
|
|
3487
|
+
var e2 = (0, import_react.useContext)(et);
|
|
3755
3488
|
if (!e2) throw he(18);
|
|
3756
3489
|
return e2;
|
|
3757
3490
|
}
|
|
3758
3491
|
function ot(e2) {
|
|
3759
|
-
var n =
|
|
3492
|
+
var n = import_react.default.useContext(et), r2 = (0, import_react.useMemo)(function() {
|
|
3760
3493
|
return function(e3, n2) {
|
|
3761
3494
|
if (!e3) throw he(14);
|
|
3762
3495
|
if (re(e3)) {
|
|
@@ -3768,7 +3501,7 @@ function ot(e2) {
|
|
|
3768
3501
|
return n2 ? __assign(__assign({}, n2), e3) : e3;
|
|
3769
3502
|
}(e2.theme, n);
|
|
3770
3503
|
}, [e2.theme, n]);
|
|
3771
|
-
return e2.children ?
|
|
3504
|
+
return e2.children ? import_react.default.createElement(et.Provider, { value: r2 }, e2.children) : null;
|
|
3772
3505
|
}
|
|
3773
3506
|
var rt = {};
|
|
3774
3507
|
var st = /* @__PURE__ */ new Set();
|
|
@@ -3793,8 +3526,8 @@ function it(e2, r2, s2) {
|
|
|
3793
3526
|
var N2 = new Qe(s2, g2, i2 ? a2.componentStyle : void 0);
|
|
3794
3527
|
function O2(e3, r3) {
|
|
3795
3528
|
return function(e4, r4, s3) {
|
|
3796
|
-
var i3 = e4.attrs, a3 = e4.componentStyle, c3 = e4.defaultProps, p3 = e4.foldedComponentIds, d2 = e4.styledComponentId, h2 = e4.target, f3 =
|
|
3797
|
-
(0,
|
|
3529
|
+
var i3 = e4.attrs, a3 = e4.componentStyle, c3 = e4.defaultProps, p3 = e4.foldedComponentIds, d2 = e4.styledComponentId, h2 = e4.target, f3 = import_react.default.useContext(et), m3 = Ge(), y3 = e4.shouldForwardProp || m3.shouldForwardProp;
|
|
3530
|
+
(0, import_react.useDebugValue)(d2);
|
|
3798
3531
|
var v2 = I(r4, f3, c3) || C, g3 = function(e5, n, o2) {
|
|
3799
3532
|
for (var r5, s4 = __assign(__assign({}, n), { className: void 0, theme: o2 }), i4 = 0; i4 < e5.length; i4 += 1) {
|
|
3800
3533
|
var a4 = re(r5 = e5[i4]) ? r5(s4) : r5;
|
|
@@ -3805,15 +3538,15 @@ function it(e2, r2, s2) {
|
|
|
3805
3538
|
for (var b3 in g3) void 0 === g3[b3] || "$" === b3[0] || "as" === b3 || "theme" === b3 && g3.theme === v2 || ("forwardedAs" === b3 ? w3.as = g3.forwardedAs : y3 && !y3(b3, S3) || (w3[b3] = g3[b3], y3 || false || isPropValid(b3) || st.has(b3) || !A.has(S3) || (st.add(b3), console.warn('styled-components: it looks like an unknown prop "'.concat(b3, '" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));
|
|
3806
3539
|
var E3 = function(e5, t2) {
|
|
3807
3540
|
var n = Ge(), o2 = e5.generateAndInjectStyles(t2, n.styleSheet, n.stylis);
|
|
3808
|
-
return (0,
|
|
3541
|
+
return (0, import_react.useDebugValue)(o2), o2;
|
|
3809
3542
|
}(a3, g3);
|
|
3810
3543
|
e4.warnTooManyClasses && e4.warnTooManyClasses(E3);
|
|
3811
3544
|
var N3 = ie(p3, d2);
|
|
3812
|
-
return E3 && (N3 += " " + E3), g3.className && (N3 += " " + g3.className), w3[L(S3) && !A.has(S3) ? "class" : "className"] = N3, s3 && (w3.ref = s3), (0,
|
|
3545
|
+
return E3 && (N3 += " " + E3), g3.className && (N3 += " " + g3.className), w3[L(S3) && !A.has(S3) ? "class" : "className"] = N3, s3 && (w3.ref = s3), (0, import_react.createElement)(S3, w3);
|
|
3813
3546
|
}(D2, e3, r3);
|
|
3814
3547
|
}
|
|
3815
3548
|
O2.displayName = y2;
|
|
3816
|
-
var D2 =
|
|
3549
|
+
var D2 = import_react.default.forwardRef(O2);
|
|
3817
3550
|
return D2.attrs = S2, D2.componentStyle = N2, D2.displayName = y2, D2.shouldForwardProp = w2, D2.foldedComponentIds = i2 ? ie(a2.foldedComponentIds, a2.styledComponentId) : "", D2.styledComponentId = g2, D2.target = i2 ? a2.target : e2, Object.defineProperty(D2, "defaultProps", { get: function() {
|
|
3818
3551
|
return this._foldedDefaultProps;
|
|
3819
3552
|
}, set: function(e3) {
|
|
@@ -3884,10 +3617,10 @@ function ft(n) {
|
|
|
3884
3617
|
var i2 = lt.apply(void 0, __spreadArray([n], r2, false)), a2 = "sc-global-".concat($(JSON.stringify(i2))), c2 = new ht(i2, a2);
|
|
3885
3618
|
P(a2);
|
|
3886
3619
|
var l2 = function(e2) {
|
|
3887
|
-
var t2 = Ge(), n2 =
|
|
3888
|
-
return
|
|
3620
|
+
var t2 = Ge(), n2 = import_react.default.useContext(et), r3 = import_react.default.useRef(t2.styleSheet.allocateGSInstance(a2)).current;
|
|
3621
|
+
return import_react.default.Children.count(e2.children) && console.warn("The global style component ".concat(a2, " was given child JSX. createGlobalStyle does not render children.")), i2.some(function(e3) {
|
|
3889
3622
|
return "string" == typeof e3 && -1 !== e3.indexOf("@import");
|
|
3890
|
-
}) && console.warn("Please do not use @import CSS syntax in createGlobalStyle at this time, as the CSSOM APIs we use in production do not handle it well. Instead, we recommend using a library such as react-helmet to inject a typical <link> meta tag to the stylesheet, or simply embedding it manually in your index.html <head> section for a simpler app."), t2.styleSheet.server && u2(r3, e2, t2.styleSheet, n2, t2.stylis),
|
|
3623
|
+
}) && console.warn("Please do not use @import CSS syntax in createGlobalStyle at this time, as the CSSOM APIs we use in production do not handle it well. Instead, we recommend using a library such as react-helmet to inject a typical <link> meta tag to the stylesheet, or simply embedding it manually in your index.html <head> section for a simpler app."), t2.styleSheet.server && u2(r3, e2, t2.styleSheet, n2, t2.stylis), import_react.default.useLayoutEffect(function() {
|
|
3891
3624
|
if (!t2.styleSheet.server) return u2(r3, e2, t2.styleSheet, n2, t2.stylis), function() {
|
|
3892
3625
|
return c2.removeStyles(r3, t2.styleSheet);
|
|
3893
3626
|
};
|
|
@@ -3900,7 +3633,7 @@ function ft(n) {
|
|
|
3900
3633
|
c2.renderStyles(e2, i3, o2, s3);
|
|
3901
3634
|
}
|
|
3902
3635
|
}
|
|
3903
|
-
return
|
|
3636
|
+
return import_react.default.memo(l2);
|
|
3904
3637
|
}
|
|
3905
3638
|
function mt(t2) {
|
|
3906
3639
|
for (var n = [], o2 = 1; o2 < arguments.length; o2++) n[o2 - 1] = arguments[o2];
|
|
@@ -3925,14 +3658,14 @@ var vt = function() {
|
|
|
3925
3658
|
var r2 = e3.instance.toString();
|
|
3926
3659
|
if (!r2) return [];
|
|
3927
3660
|
var s2 = ((n = {})[f] = "", n[y] = v, n.dangerouslySetInnerHTML = { __html: r2 }, n), i2 = Ce();
|
|
3928
|
-
return i2 && (s2.nonce = i2), [
|
|
3661
|
+
return i2 && (s2.nonce = i2), [import_react.default.createElement("style", __assign({}, s2, { key: "sc-0-0" }))];
|
|
3929
3662
|
}, this.seal = function() {
|
|
3930
3663
|
e3.sealed = true;
|
|
3931
3664
|
}, this.instance = new ke({ isServer: true }), this.sealed = false;
|
|
3932
3665
|
}
|
|
3933
3666
|
return e2.prototype.collectStyles = function(e3) {
|
|
3934
3667
|
if (this.sealed) throw he(2);
|
|
3935
|
-
return
|
|
3668
|
+
return import_react.default.createElement(Ye, { sheet: this.instance }, e3);
|
|
3936
3669
|
}, e2.prototype.interleaveWithNodeStream = function(e3) {
|
|
3937
3670
|
throw he(3);
|
|
3938
3671
|
}, e2;
|
|
@@ -3950,10 +3683,10 @@ var DEFAULT_CURRENCY = "USD";
|
|
|
3950
3683
|
var MAXIMUM_SIGNIFICANT_DIGITS = 6;
|
|
3951
3684
|
|
|
3952
3685
|
// src/hooks/useAvailablePlans.ts
|
|
3953
|
-
var
|
|
3686
|
+
var import_react2 = require("react");
|
|
3954
3687
|
function useAvailablePlans(activePeriod) {
|
|
3955
3688
|
const { data, mode } = useEmbed();
|
|
3956
|
-
const getAvailablePeriods = (0,
|
|
3689
|
+
const getAvailablePeriods = (0, import_react2.useCallback)(() => {
|
|
3957
3690
|
const periods = [];
|
|
3958
3691
|
if (data.activePlans.some((plan) => plan.monthlyPrice) || data.activeAddOns.some((addOn) => addOn.monthlyPrice)) {
|
|
3959
3692
|
periods.push("month");
|
|
@@ -3963,7 +3696,7 @@ function useAvailablePlans(activePeriod) {
|
|
|
3963
3696
|
}
|
|
3964
3697
|
return periods;
|
|
3965
3698
|
}, [data.activePlans, data.activeAddOns]);
|
|
3966
|
-
const getActivePlans = (0,
|
|
3699
|
+
const getActivePlans = (0, import_react2.useCallback)(
|
|
3967
3700
|
(plans) => {
|
|
3968
3701
|
const customPlanExist = plans.some((plan) => plan.custom);
|
|
3969
3702
|
const plansWithSelected = mode === "edit" ? plans.slice() : plans.filter(
|
|
@@ -3984,7 +3717,7 @@ function useAvailablePlans(activePeriod) {
|
|
|
3984
3717
|
},
|
|
3985
3718
|
[activePeriod, mode]
|
|
3986
3719
|
);
|
|
3987
|
-
return (0,
|
|
3720
|
+
return (0, import_react2.useMemo)(() => {
|
|
3988
3721
|
return {
|
|
3989
3722
|
plans: getActivePlans(data.activePlans),
|
|
3990
3723
|
addOns: getActivePlans(data.activeAddOns),
|
|
@@ -4002,7 +3735,7 @@ function useAvailablePlans(activePeriod) {
|
|
|
4002
3735
|
var import_react12 = require("react");
|
|
4003
3736
|
|
|
4004
3737
|
// node_modules/i18next/dist/esm/i18next.js
|
|
4005
|
-
var
|
|
3738
|
+
var isString = (obj) => typeof obj === "string";
|
|
4006
3739
|
var defer = () => {
|
|
4007
3740
|
let res;
|
|
4008
3741
|
let rej;
|
|
@@ -4025,9 +3758,9 @@ var copy2 = (a2, s2, t2) => {
|
|
|
4025
3758
|
};
|
|
4026
3759
|
var lastOfPathSeparatorRegExp = /###/g;
|
|
4027
3760
|
var cleanKey = (key) => key && key.indexOf("###") > -1 ? key.replace(lastOfPathSeparatorRegExp, ".") : key;
|
|
4028
|
-
var canNotTraverseDeeper = (object) => !object ||
|
|
3761
|
+
var canNotTraverseDeeper = (object) => !object || isString(object);
|
|
4029
3762
|
var getLastOfPath = (object, path, Empty) => {
|
|
4030
|
-
const stack = !
|
|
3763
|
+
const stack = !isString(path) ? path : path.split(".");
|
|
4031
3764
|
let stackIndex = 0;
|
|
4032
3765
|
while (stackIndex < stack.length - 1) {
|
|
4033
3766
|
if (canNotTraverseDeeper(object)) return {};
|
|
@@ -4096,7 +3829,7 @@ var deepExtend = (target, source, overwrite) => {
|
|
|
4096
3829
|
for (const prop in source) {
|
|
4097
3830
|
if (prop !== "__proto__" && prop !== "constructor") {
|
|
4098
3831
|
if (prop in target) {
|
|
4099
|
-
if (
|
|
3832
|
+
if (isString(target[prop]) || target[prop] instanceof String || isString(source[prop]) || source[prop] instanceof String) {
|
|
4100
3833
|
if (overwrite) target[prop] = source[prop];
|
|
4101
3834
|
} else {
|
|
4102
3835
|
deepExtend(target[prop], source[prop], overwrite);
|
|
@@ -4118,7 +3851,7 @@ var _entityMap = {
|
|
|
4118
3851
|
"/": "/"
|
|
4119
3852
|
};
|
|
4120
3853
|
var escape = (data) => {
|
|
4121
|
-
if (
|
|
3854
|
+
if (isString(data)) {
|
|
4122
3855
|
return data.replace(/[&<>"'\/]/g, (s2) => _entityMap[s2]);
|
|
4123
3856
|
}
|
|
4124
3857
|
return data;
|
|
@@ -4247,7 +3980,7 @@ var Logger = class _Logger {
|
|
|
4247
3980
|
}
|
|
4248
3981
|
forward(args, lvl, prefix2, debugOnly) {
|
|
4249
3982
|
if (debugOnly && !this.debug) return null;
|
|
4250
|
-
if (
|
|
3983
|
+
if (isString(args[0])) args[0] = `${prefix2}${this.prefix} ${args[0]}`;
|
|
4251
3984
|
return this.logger[lvl](args);
|
|
4252
3985
|
}
|
|
4253
3986
|
create(moduleName) {
|
|
@@ -4348,7 +4081,7 @@ var ResourceStore = class extends EventEmitter {
|
|
|
4348
4081
|
if (key) {
|
|
4349
4082
|
if (Array.isArray(key)) {
|
|
4350
4083
|
path.push(...key);
|
|
4351
|
-
} else if (
|
|
4084
|
+
} else if (isString(key) && keySeparator) {
|
|
4352
4085
|
path.push(...key.split(keySeparator));
|
|
4353
4086
|
} else {
|
|
4354
4087
|
path.push(key);
|
|
@@ -4361,7 +4094,7 @@ var ResourceStore = class extends EventEmitter {
|
|
|
4361
4094
|
ns = path[1];
|
|
4362
4095
|
key = path.slice(2).join(".");
|
|
4363
4096
|
}
|
|
4364
|
-
if (result || !ignoreJSONStructure || !
|
|
4097
|
+
if (result || !ignoreJSONStructure || !isString(key)) return result;
|
|
4365
4098
|
return deepFind(this.data?.[lng]?.[ns], key, keySeparator);
|
|
4366
4099
|
}
|
|
4367
4100
|
addResource(lng, ns, key, value) {
|
|
@@ -4385,7 +4118,7 @@ var ResourceStore = class extends EventEmitter {
|
|
|
4385
4118
|
silent: false
|
|
4386
4119
|
};
|
|
4387
4120
|
for (const m2 in resources) {
|
|
4388
|
-
if (
|
|
4121
|
+
if (isString(resources[m2]) || Array.isArray(resources[m2])) this.addResource(lng, ns, m2, resources[m2], {
|
|
4389
4122
|
silent: true
|
|
4390
4123
|
});
|
|
4391
4124
|
}
|
|
@@ -4456,7 +4189,7 @@ var postProcessor = {
|
|
|
4456
4189
|
}
|
|
4457
4190
|
};
|
|
4458
4191
|
var checkedLoadedFor = {};
|
|
4459
|
-
var shouldHandleAsObject = (res) => !
|
|
4192
|
+
var shouldHandleAsObject = (res) => !isString(res) && typeof res !== "boolean" && typeof res !== "number";
|
|
4460
4193
|
var Translator = class _Translator extends EventEmitter {
|
|
4461
4194
|
constructor(services) {
|
|
4462
4195
|
let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
@@ -4493,7 +4226,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4493
4226
|
if (m2 && m2.length > 0) {
|
|
4494
4227
|
return {
|
|
4495
4228
|
key,
|
|
4496
|
-
namespaces:
|
|
4229
|
+
namespaces: isString(namespaces) ? [namespaces] : namespaces
|
|
4497
4230
|
};
|
|
4498
4231
|
}
|
|
4499
4232
|
const parts = key.split(nsSeparator);
|
|
@@ -4502,7 +4235,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4502
4235
|
}
|
|
4503
4236
|
return {
|
|
4504
4237
|
key,
|
|
4505
|
-
namespaces:
|
|
4238
|
+
namespaces: isString(namespaces) ? [namespaces] : namespaces
|
|
4506
4239
|
};
|
|
4507
4240
|
}
|
|
4508
4241
|
translate(keys, options, lastKey) {
|
|
@@ -4558,7 +4291,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4558
4291
|
const noObject = ["[object Number]", "[object Function]", "[object RegExp]"];
|
|
4559
4292
|
const joinArrays = options.joinArrays !== void 0 ? options.joinArrays : this.options.joinArrays;
|
|
4560
4293
|
const handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
|
|
4561
|
-
const needsPluralHandling = options.count !== void 0 && !
|
|
4294
|
+
const needsPluralHandling = options.count !== void 0 && !isString(options.count);
|
|
4562
4295
|
const hasDefaultValue = _Translator.hasDefaultValue(options);
|
|
4563
4296
|
const defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, options) : "";
|
|
4564
4297
|
const defaultValueSuffixOrdinalFallback = options.ordinal && needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, {
|
|
@@ -4572,7 +4305,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4572
4305
|
}
|
|
4573
4306
|
const handleAsObject = shouldHandleAsObject(resForObjHndl);
|
|
4574
4307
|
const resType = Object.prototype.toString.apply(resForObjHndl);
|
|
4575
|
-
if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && noObject.indexOf(resType) < 0 && !(
|
|
4308
|
+
if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && noObject.indexOf(resType) < 0 && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {
|
|
4576
4309
|
if (!options.returnObjects && !this.options.returnObjects) {
|
|
4577
4310
|
if (!this.options.returnedObjectHandler) {
|
|
4578
4311
|
this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
@@ -4618,7 +4351,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4618
4351
|
}
|
|
4619
4352
|
res = copy3;
|
|
4620
4353
|
}
|
|
4621
|
-
} else if (handleAsObjectInI18nFormat &&
|
|
4354
|
+
} else if (handleAsObjectInI18nFormat && isString(joinArrays) && Array.isArray(res)) {
|
|
4622
4355
|
res = res.join(joinArrays);
|
|
4623
4356
|
if (res) res = this.extendTranslation(res, keys, options, lastKey);
|
|
4624
4357
|
} else {
|
|
@@ -4712,13 +4445,13 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4712
4445
|
}
|
|
4713
4446
|
}
|
|
4714
4447
|
});
|
|
4715
|
-
const skipOnVariables =
|
|
4448
|
+
const skipOnVariables = isString(res) && (options?.interpolation?.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
|
|
4716
4449
|
let nestBef;
|
|
4717
4450
|
if (skipOnVariables) {
|
|
4718
4451
|
const nb = res.match(this.interpolator.nestingRegexp);
|
|
4719
4452
|
nestBef = nb && nb.length;
|
|
4720
4453
|
}
|
|
4721
|
-
let data = options.replace && !
|
|
4454
|
+
let data = options.replace && !isString(options.replace) ? options.replace : options;
|
|
4722
4455
|
if (this.options.interpolation.defaultVariables) data = {
|
|
4723
4456
|
...this.options.interpolation.defaultVariables,
|
|
4724
4457
|
...data
|
|
@@ -4743,7 +4476,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4743
4476
|
if (options.interpolation) this.interpolator.reset();
|
|
4744
4477
|
}
|
|
4745
4478
|
const postProcess = options.postProcess || this.options.postProcess;
|
|
4746
|
-
const postProcessorNames =
|
|
4479
|
+
const postProcessorNames = isString(postProcess) ? [postProcess] : postProcess;
|
|
4747
4480
|
if (res != null && postProcessorNames?.length && options.applyPostProcessor !== false) {
|
|
4748
4481
|
res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? {
|
|
4749
4482
|
i18nResolved: {
|
|
@@ -4762,7 +4495,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4762
4495
|
let exactUsedKey;
|
|
4763
4496
|
let usedLng;
|
|
4764
4497
|
let usedNS;
|
|
4765
|
-
if (
|
|
4498
|
+
if (isString(keys)) keys = [keys];
|
|
4766
4499
|
keys.forEach((k2) => {
|
|
4767
4500
|
if (this.isValidLookup(found)) return;
|
|
4768
4501
|
const extracted = this.extractFromKey(k2, options);
|
|
@@ -4770,9 +4503,9 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4770
4503
|
usedKey = key;
|
|
4771
4504
|
let namespaces = extracted.namespaces;
|
|
4772
4505
|
if (this.options.fallbackNS) namespaces = namespaces.concat(this.options.fallbackNS);
|
|
4773
|
-
const needsPluralHandling = options.count !== void 0 && !
|
|
4506
|
+
const needsPluralHandling = options.count !== void 0 && !isString(options.count);
|
|
4774
4507
|
const needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0;
|
|
4775
|
-
const needsContextHandling = options.context !== void 0 && (
|
|
4508
|
+
const needsContextHandling = options.context !== void 0 && (isString(options.context) || typeof options.context === "number") && options.context !== "";
|
|
4776
4509
|
const codes = options.lngs ? options.lngs : this.languageUtils.toResolveHierarchy(options.lng || this.language, options.fallbackLng);
|
|
4777
4510
|
namespaces.forEach((ns) => {
|
|
4778
4511
|
if (this.isValidLookup(found)) return;
|
|
@@ -4844,7 +4577,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4844
4577
|
getUsedParamsDetails() {
|
|
4845
4578
|
let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
4846
4579
|
const optionsKeys = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"];
|
|
4847
|
-
const useOptionsReplaceForData = options.replace && !
|
|
4580
|
+
const useOptionsReplaceForData = options.replace && !isString(options.replace);
|
|
4848
4581
|
let data = useOptionsReplaceForData ? options.replace : options;
|
|
4849
4582
|
if (useOptionsReplaceForData && typeof options.count !== "undefined") {
|
|
4850
4583
|
data.count = options.count;
|
|
@@ -4897,7 +4630,7 @@ var LanguageUtil = class {
|
|
|
4897
4630
|
return this.formatLanguageCode(p2[0]);
|
|
4898
4631
|
}
|
|
4899
4632
|
formatLanguageCode(code) {
|
|
4900
|
-
if (
|
|
4633
|
+
if (isString(code) && code.indexOf("-") > -1) {
|
|
4901
4634
|
let formattedCode;
|
|
4902
4635
|
try {
|
|
4903
4636
|
formattedCode = Intl.getCanonicalLocales(code)[0];
|
|
@@ -4947,7 +4680,7 @@ var LanguageUtil = class {
|
|
|
4947
4680
|
getFallbackCodes(fallbacks, code) {
|
|
4948
4681
|
if (!fallbacks) return [];
|
|
4949
4682
|
if (typeof fallbacks === "function") fallbacks = fallbacks(code);
|
|
4950
|
-
if (
|
|
4683
|
+
if (isString(fallbacks)) fallbacks = [fallbacks];
|
|
4951
4684
|
if (Array.isArray(fallbacks)) return fallbacks;
|
|
4952
4685
|
if (!code) return fallbacks.default || [];
|
|
4953
4686
|
let found = fallbacks[code];
|
|
@@ -4968,11 +4701,11 @@ var LanguageUtil = class {
|
|
|
4968
4701
|
this.logger.warn(`rejecting language code not found in supportedLngs: ${c2}`);
|
|
4969
4702
|
}
|
|
4970
4703
|
};
|
|
4971
|
-
if (
|
|
4704
|
+
if (isString(code) && (code.indexOf("-") > -1 || code.indexOf("_") > -1)) {
|
|
4972
4705
|
if (this.options.load !== "languageOnly") addCode(this.formatLanguageCode(code));
|
|
4973
4706
|
if (this.options.load !== "languageOnly" && this.options.load !== "currentOnly") addCode(this.getScriptPartFromCode(code));
|
|
4974
4707
|
if (this.options.load !== "currentOnly") addCode(this.getLanguagePartFromCode(code));
|
|
4975
|
-
} else if (
|
|
4708
|
+
} else if (isString(code)) {
|
|
4976
4709
|
addCode(this.formatLanguageCode(code));
|
|
4977
4710
|
}
|
|
4978
4711
|
fallbackCodes.forEach((fc) => {
|
|
@@ -5068,7 +4801,7 @@ var deepFindWithDefaults = function(data, defaultData, key) {
|
|
|
5068
4801
|
let keySeparator = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".";
|
|
5069
4802
|
let ignoreJSONStructure = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true;
|
|
5070
4803
|
let path = getPathWithDefaults(data, defaultData, key);
|
|
5071
|
-
if (!path && ignoreJSONStructure &&
|
|
4804
|
+
if (!path && ignoreJSONStructure && isString(key)) {
|
|
5072
4805
|
path = deepFind(data, key, keySeparator);
|
|
5073
4806
|
if (path === void 0) path = deepFind(defaultData, key, keySeparator);
|
|
5074
4807
|
}
|
|
@@ -5178,7 +4911,7 @@ var Interpolator = class {
|
|
|
5178
4911
|
if (value === void 0) {
|
|
5179
4912
|
if (typeof missingInterpolationHandler === "function") {
|
|
5180
4913
|
const temp = missingInterpolationHandler(str, match2, options);
|
|
5181
|
-
value =
|
|
4914
|
+
value = isString(temp) ? temp : "";
|
|
5182
4915
|
} else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
|
|
5183
4916
|
value = "";
|
|
5184
4917
|
} else if (skipOnVariables) {
|
|
@@ -5188,7 +4921,7 @@ var Interpolator = class {
|
|
|
5188
4921
|
this.logger.warn(`missed to pass in variable ${matchedVar} for interpolating ${str}`);
|
|
5189
4922
|
value = "";
|
|
5190
4923
|
}
|
|
5191
|
-
} else if (!
|
|
4924
|
+
} else if (!isString(value) && !this.useRawValueToEscape) {
|
|
5192
4925
|
value = makeString(value);
|
|
5193
4926
|
}
|
|
5194
4927
|
const safeValue = todo.safeValue(value);
|
|
@@ -5242,7 +4975,7 @@ var Interpolator = class {
|
|
|
5242
4975
|
clonedOptions = {
|
|
5243
4976
|
...options
|
|
5244
4977
|
};
|
|
5245
|
-
clonedOptions = clonedOptions.replace && !
|
|
4978
|
+
clonedOptions = clonedOptions.replace && !isString(clonedOptions.replace) ? clonedOptions.replace : clonedOptions;
|
|
5246
4979
|
clonedOptions.applyPostProcessor = false;
|
|
5247
4980
|
delete clonedOptions.defaultValue;
|
|
5248
4981
|
let doReduce = false;
|
|
@@ -5253,8 +4986,8 @@ var Interpolator = class {
|
|
|
5253
4986
|
doReduce = true;
|
|
5254
4987
|
}
|
|
5255
4988
|
value = fc(handleHasOptions.call(this, match2[1].trim(), clonedOptions), clonedOptions);
|
|
5256
|
-
if (value && match2[0] === str && !
|
|
5257
|
-
if (!
|
|
4989
|
+
if (value && match2[0] === str && !isString(value)) return value;
|
|
4990
|
+
if (!isString(value)) value = makeString(value);
|
|
5258
4991
|
if (!value) {
|
|
5259
4992
|
this.logger.warn(`missed to resolve ${match2[1]} for nesting ${str}`);
|
|
5260
4993
|
value = "";
|
|
@@ -5564,8 +5297,8 @@ var Connector = class extends EventEmitter {
|
|
|
5564
5297
|
this.logger.warn("No backend was added via i18next.use. Will not load resources.");
|
|
5565
5298
|
return callback && callback();
|
|
5566
5299
|
}
|
|
5567
|
-
if (
|
|
5568
|
-
if (
|
|
5300
|
+
if (isString(languages)) languages = this.languageUtils.toResolveHierarchy(languages);
|
|
5301
|
+
if (isString(namespaces)) namespaces = [namespaces];
|
|
5569
5302
|
const toLoad = this.queueLoad(languages, namespaces, options, callback);
|
|
5570
5303
|
if (!toLoad.toLoad.length) {
|
|
5571
5304
|
if (!toLoad.pending.length) callback();
|
|
@@ -5669,8 +5402,8 @@ var get = () => ({
|
|
|
5669
5402
|
overloadTranslationOptionHandler: (args) => {
|
|
5670
5403
|
let ret = {};
|
|
5671
5404
|
if (typeof args[1] === "object") ret = args[1];
|
|
5672
|
-
if (
|
|
5673
|
-
if (
|
|
5405
|
+
if (isString(args[1])) ret.defaultValue = args[1];
|
|
5406
|
+
if (isString(args[2])) ret.tDescription = args[2];
|
|
5674
5407
|
if (typeof args[2] === "object" || typeof args[3] === "object") {
|
|
5675
5408
|
const options = args[3] || args[2];
|
|
5676
5409
|
Object.keys(options).forEach((key) => {
|
|
@@ -5694,9 +5427,9 @@ var get = () => ({
|
|
|
5694
5427
|
}
|
|
5695
5428
|
});
|
|
5696
5429
|
var transformOptions = (options) => {
|
|
5697
|
-
if (
|
|
5698
|
-
if (
|
|
5699
|
-
if (
|
|
5430
|
+
if (isString(options.ns)) options.ns = [options.ns];
|
|
5431
|
+
if (isString(options.fallbackLng)) options.fallbackLng = [options.fallbackLng];
|
|
5432
|
+
if (isString(options.fallbackNS)) options.fallbackNS = [options.fallbackNS];
|
|
5700
5433
|
if (options.supportedLngs?.indexOf?.("cimode") < 0) {
|
|
5701
5434
|
options.supportedLngs = options.supportedLngs.concat(["cimode"]);
|
|
5702
5435
|
}
|
|
@@ -5745,7 +5478,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
5745
5478
|
options = {};
|
|
5746
5479
|
}
|
|
5747
5480
|
if (options.defaultNS == null && options.ns) {
|
|
5748
|
-
if (
|
|
5481
|
+
if (isString(options.ns)) {
|
|
5749
5482
|
options.defaultNS = options.ns;
|
|
5750
5483
|
} else if (options.ns.indexOf("translation") < 0) {
|
|
5751
5484
|
options.defaultNS = options.ns[0];
|
|
@@ -5875,7 +5608,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
5875
5608
|
loadResources(language) {
|
|
5876
5609
|
let callback = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
5877
5610
|
let usedCallback = callback;
|
|
5878
|
-
const usedLng =
|
|
5611
|
+
const usedLng = isString(language) ? language : this.language;
|
|
5879
5612
|
if (typeof language === "function") usedCallback = language;
|
|
5880
5613
|
if (!this.options.resources || this.options.partialBundledLanguages) {
|
|
5881
5614
|
if (usedLng?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return usedCallback();
|
|
@@ -5991,7 +5724,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
5991
5724
|
};
|
|
5992
5725
|
const setLng = (lngs) => {
|
|
5993
5726
|
if (!lng && !lngs && this.services.languageDetector) lngs = [];
|
|
5994
|
-
const l2 =
|
|
5727
|
+
const l2 = isString(lngs) ? lngs : this.services.languageUtils.getBestMatchFromCodes(lngs);
|
|
5995
5728
|
if (l2) {
|
|
5996
5729
|
if (!this.language) {
|
|
5997
5730
|
setLngProps(l2);
|
|
@@ -6043,7 +5776,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
6043
5776
|
}
|
|
6044
5777
|
return _this3.t(resultKey, options);
|
|
6045
5778
|
};
|
|
6046
|
-
if (
|
|
5779
|
+
if (isString(lng)) {
|
|
6047
5780
|
fixedT.lng = lng;
|
|
6048
5781
|
} else {
|
|
6049
5782
|
fixedT.lngs = lng;
|
|
@@ -6100,7 +5833,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
6100
5833
|
if (callback) callback();
|
|
6101
5834
|
return Promise.resolve();
|
|
6102
5835
|
}
|
|
6103
|
-
if (
|
|
5836
|
+
if (isString(ns)) ns = [ns];
|
|
6104
5837
|
ns.forEach((n) => {
|
|
6105
5838
|
if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n);
|
|
6106
5839
|
});
|
|
@@ -6112,7 +5845,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
6112
5845
|
}
|
|
6113
5846
|
loadLanguages(lngs, callback) {
|
|
6114
5847
|
const deferred = defer();
|
|
6115
|
-
if (
|
|
5848
|
+
if (isString(lngs)) lngs = [lngs];
|
|
6116
5849
|
const preloaded = this.options.preload || [];
|
|
6117
5850
|
const newLngs = lngs.filter((lng) => preloaded.indexOf(lng) < 0 && this.services.languageUtils.isSupportedCode(lng));
|
|
6118
5851
|
if (!newLngs.length) {
|
|
@@ -6216,9 +5949,9 @@ var getFixedT = instance.getFixedT;
|
|
|
6216
5949
|
var t = instance.t;
|
|
6217
5950
|
var exists = instance.exists;
|
|
6218
5951
|
var setDefaultNamespace = instance.setDefaultNamespace;
|
|
6219
|
-
var
|
|
6220
|
-
var
|
|
6221
|
-
var
|
|
5952
|
+
var hasLoadedNamespace = instance.hasLoadedNamespace;
|
|
5953
|
+
var loadNamespaces = instance.loadNamespaces;
|
|
5954
|
+
var loadLanguages = instance.loadLanguages;
|
|
6222
5955
|
|
|
6223
5956
|
// src/context/embed.tsx
|
|
6224
5957
|
var import_merge = __toESM(require_merge());
|
|
@@ -10400,6 +10133,278 @@ var inflate_1 = inflate;
|
|
|
10400
10133
|
// src/context/embed.tsx
|
|
10401
10134
|
var import_react11 = require("react");
|
|
10402
10135
|
|
|
10136
|
+
// node_modules/react-i18next/dist/es/Trans.js
|
|
10137
|
+
var import_react5 = require("react");
|
|
10138
|
+
|
|
10139
|
+
// node_modules/react-i18next/dist/es/TransWithoutContext.js
|
|
10140
|
+
var import_react3 = require("react");
|
|
10141
|
+
|
|
10142
|
+
// node_modules/html-parse-stringify/dist/html-parse-stringify.module.js
|
|
10143
|
+
var import_void_elements = __toESM(require_void_elements());
|
|
10144
|
+
|
|
10145
|
+
// node_modules/react-i18next/dist/es/utils.js
|
|
10146
|
+
var warn = (i18n, code, msg, rest) => {
|
|
10147
|
+
const args = [msg, {
|
|
10148
|
+
code,
|
|
10149
|
+
...rest || {}
|
|
10150
|
+
}];
|
|
10151
|
+
if (i18n?.services?.logger?.forward) {
|
|
10152
|
+
return i18n.services.logger.forward(args, "warn", "react-i18next::", true);
|
|
10153
|
+
}
|
|
10154
|
+
if (isString2(args[0])) args[0] = `react-i18next:: ${args[0]}`;
|
|
10155
|
+
if (i18n?.services?.logger?.warn) {
|
|
10156
|
+
i18n.services.logger.warn(...args);
|
|
10157
|
+
} else if (console?.warn) {
|
|
10158
|
+
console.warn(...args);
|
|
10159
|
+
}
|
|
10160
|
+
};
|
|
10161
|
+
var alreadyWarned = {};
|
|
10162
|
+
var warnOnce = (i18n, code, msg, rest) => {
|
|
10163
|
+
if (isString2(msg) && alreadyWarned[msg]) return;
|
|
10164
|
+
if (isString2(msg)) alreadyWarned[msg] = /* @__PURE__ */ new Date();
|
|
10165
|
+
warn(i18n, code, msg, rest);
|
|
10166
|
+
};
|
|
10167
|
+
var loadedClb = (i18n, cb) => () => {
|
|
10168
|
+
if (i18n.isInitialized) {
|
|
10169
|
+
cb();
|
|
10170
|
+
} else {
|
|
10171
|
+
const initialized = () => {
|
|
10172
|
+
setTimeout(() => {
|
|
10173
|
+
i18n.off("initialized", initialized);
|
|
10174
|
+
}, 0);
|
|
10175
|
+
cb();
|
|
10176
|
+
};
|
|
10177
|
+
i18n.on("initialized", initialized);
|
|
10178
|
+
}
|
|
10179
|
+
};
|
|
10180
|
+
var loadNamespaces2 = (i18n, ns, cb) => {
|
|
10181
|
+
i18n.loadNamespaces(ns, loadedClb(i18n, cb));
|
|
10182
|
+
};
|
|
10183
|
+
var loadLanguages2 = (i18n, lng, ns, cb) => {
|
|
10184
|
+
if (isString2(ns)) ns = [ns];
|
|
10185
|
+
if (i18n.options.preload && i18n.options.preload.indexOf(lng) > -1) return loadNamespaces2(i18n, ns, cb);
|
|
10186
|
+
ns.forEach((n) => {
|
|
10187
|
+
if (i18n.options.ns.indexOf(n) < 0) i18n.options.ns.push(n);
|
|
10188
|
+
});
|
|
10189
|
+
i18n.loadLanguages(lng, loadedClb(i18n, cb));
|
|
10190
|
+
};
|
|
10191
|
+
var hasLoadedNamespace2 = (ns, i18n, options = {}) => {
|
|
10192
|
+
if (!i18n.languages || !i18n.languages.length) {
|
|
10193
|
+
warnOnce(i18n, "NO_LANGUAGES", "i18n.languages were undefined or empty", {
|
|
10194
|
+
languages: i18n.languages
|
|
10195
|
+
});
|
|
10196
|
+
return true;
|
|
10197
|
+
}
|
|
10198
|
+
return i18n.hasLoadedNamespace(ns, {
|
|
10199
|
+
lng: options.lng,
|
|
10200
|
+
precheck: (i18nInstance2, loadNotPending) => {
|
|
10201
|
+
if (options.bindI18n?.indexOf("languageChanging") > -1 && i18nInstance2.services.backendConnector.backend && i18nInstance2.isLanguageChangingTo && !loadNotPending(i18nInstance2.isLanguageChangingTo, ns)) return false;
|
|
10202
|
+
}
|
|
10203
|
+
});
|
|
10204
|
+
};
|
|
10205
|
+
var isString2 = (obj) => typeof obj === "string";
|
|
10206
|
+
var isObject = (obj) => typeof obj === "object" && obj !== null;
|
|
10207
|
+
|
|
10208
|
+
// node_modules/react-i18next/dist/es/unescape.js
|
|
10209
|
+
var matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
|
|
10210
|
+
var htmlEntities = {
|
|
10211
|
+
"&": "&",
|
|
10212
|
+
"&": "&",
|
|
10213
|
+
"<": "<",
|
|
10214
|
+
"<": "<",
|
|
10215
|
+
">": ">",
|
|
10216
|
+
">": ">",
|
|
10217
|
+
"'": "'",
|
|
10218
|
+
"'": "'",
|
|
10219
|
+
""": '"',
|
|
10220
|
+
""": '"',
|
|
10221
|
+
" ": " ",
|
|
10222
|
+
" ": " ",
|
|
10223
|
+
"©": "\xA9",
|
|
10224
|
+
"©": "\xA9",
|
|
10225
|
+
"®": "\xAE",
|
|
10226
|
+
"®": "\xAE",
|
|
10227
|
+
"…": "\u2026",
|
|
10228
|
+
"…": "\u2026",
|
|
10229
|
+
"/": "/",
|
|
10230
|
+
"/": "/"
|
|
10231
|
+
};
|
|
10232
|
+
var unescapeHtmlEntity = (m2) => htmlEntities[m2];
|
|
10233
|
+
var unescape = (text) => text.replace(matchHtmlEntity, unescapeHtmlEntity);
|
|
10234
|
+
|
|
10235
|
+
// node_modules/react-i18next/dist/es/defaults.js
|
|
10236
|
+
var defaultOptions = {
|
|
10237
|
+
bindI18n: "languageChanged",
|
|
10238
|
+
bindI18nStore: "",
|
|
10239
|
+
transEmptyNodeValue: "",
|
|
10240
|
+
transSupportBasicHtmlNodes: true,
|
|
10241
|
+
transWrapTextNodes: "",
|
|
10242
|
+
transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
|
|
10243
|
+
useSuspense: true,
|
|
10244
|
+
unescape
|
|
10245
|
+
};
|
|
10246
|
+
var setDefaults = (options = {}) => {
|
|
10247
|
+
defaultOptions = {
|
|
10248
|
+
...defaultOptions,
|
|
10249
|
+
...options
|
|
10250
|
+
};
|
|
10251
|
+
};
|
|
10252
|
+
var getDefaults = () => defaultOptions;
|
|
10253
|
+
|
|
10254
|
+
// node_modules/react-i18next/dist/es/i18nInstance.js
|
|
10255
|
+
var i18nInstance;
|
|
10256
|
+
var setI18n = (instance2) => {
|
|
10257
|
+
i18nInstance = instance2;
|
|
10258
|
+
};
|
|
10259
|
+
var getI18n = () => i18nInstance;
|
|
10260
|
+
|
|
10261
|
+
// node_modules/react-i18next/dist/es/context.js
|
|
10262
|
+
var import_react4 = require("react");
|
|
10263
|
+
|
|
10264
|
+
// node_modules/react-i18next/dist/es/initReactI18next.js
|
|
10265
|
+
var initReactI18next = {
|
|
10266
|
+
type: "3rdParty",
|
|
10267
|
+
init(instance2) {
|
|
10268
|
+
setDefaults(instance2.options.react);
|
|
10269
|
+
setI18n(instance2);
|
|
10270
|
+
}
|
|
10271
|
+
};
|
|
10272
|
+
|
|
10273
|
+
// node_modules/react-i18next/dist/es/context.js
|
|
10274
|
+
var I18nContext = (0, import_react4.createContext)();
|
|
10275
|
+
var ReportNamespaces = class {
|
|
10276
|
+
constructor() {
|
|
10277
|
+
this.usedNamespaces = {};
|
|
10278
|
+
}
|
|
10279
|
+
addUsedNamespaces(namespaces) {
|
|
10280
|
+
namespaces.forEach((ns) => {
|
|
10281
|
+
if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true;
|
|
10282
|
+
});
|
|
10283
|
+
}
|
|
10284
|
+
getUsedNamespaces() {
|
|
10285
|
+
return Object.keys(this.usedNamespaces);
|
|
10286
|
+
}
|
|
10287
|
+
};
|
|
10288
|
+
|
|
10289
|
+
// node_modules/react-i18next/dist/es/useTranslation.js
|
|
10290
|
+
var import_react6 = require("react");
|
|
10291
|
+
var usePrevious = (value, ignore) => {
|
|
10292
|
+
const ref = (0, import_react6.useRef)();
|
|
10293
|
+
(0, import_react6.useEffect)(() => {
|
|
10294
|
+
ref.current = ignore ? ref.current : value;
|
|
10295
|
+
}, [value, ignore]);
|
|
10296
|
+
return ref.current;
|
|
10297
|
+
};
|
|
10298
|
+
var alwaysNewT = (i18n, language, namespace, keyPrefix) => i18n.getFixedT(language, namespace, keyPrefix);
|
|
10299
|
+
var useMemoizedT = (i18n, language, namespace, keyPrefix) => (0, import_react6.useCallback)(alwaysNewT(i18n, language, namespace, keyPrefix), [i18n, language, namespace, keyPrefix]);
|
|
10300
|
+
var useTranslation = (ns, props = {}) => {
|
|
10301
|
+
const {
|
|
10302
|
+
i18n: i18nFromProps
|
|
10303
|
+
} = props;
|
|
10304
|
+
const {
|
|
10305
|
+
i18n: i18nFromContext,
|
|
10306
|
+
defaultNS: defaultNSFromContext
|
|
10307
|
+
} = (0, import_react6.useContext)(I18nContext) || {};
|
|
10308
|
+
const i18n = i18nFromProps || i18nFromContext || getI18n();
|
|
10309
|
+
if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();
|
|
10310
|
+
if (!i18n) {
|
|
10311
|
+
warnOnce(i18n, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
|
|
10312
|
+
const notReadyT = (k2, optsOrDefaultValue) => {
|
|
10313
|
+
if (isString2(optsOrDefaultValue)) return optsOrDefaultValue;
|
|
10314
|
+
if (isObject(optsOrDefaultValue) && isString2(optsOrDefaultValue.defaultValue)) return optsOrDefaultValue.defaultValue;
|
|
10315
|
+
return Array.isArray(k2) ? k2[k2.length - 1] : k2;
|
|
10316
|
+
};
|
|
10317
|
+
const retNotReady = [notReadyT, {}, false];
|
|
10318
|
+
retNotReady.t = notReadyT;
|
|
10319
|
+
retNotReady.i18n = {};
|
|
10320
|
+
retNotReady.ready = false;
|
|
10321
|
+
return retNotReady;
|
|
10322
|
+
}
|
|
10323
|
+
if (i18n.options.react?.wait) warnOnce(i18n, "DEPRECATED_OPTION", "useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
|
|
10324
|
+
const i18nOptions = {
|
|
10325
|
+
...getDefaults(),
|
|
10326
|
+
...i18n.options.react,
|
|
10327
|
+
...props
|
|
10328
|
+
};
|
|
10329
|
+
const {
|
|
10330
|
+
useSuspense,
|
|
10331
|
+
keyPrefix
|
|
10332
|
+
} = i18nOptions;
|
|
10333
|
+
let namespaces = ns || defaultNSFromContext || i18n.options?.defaultNS;
|
|
10334
|
+
namespaces = isString2(namespaces) ? [namespaces] : namespaces || ["translation"];
|
|
10335
|
+
i18n.reportNamespaces.addUsedNamespaces?.(namespaces);
|
|
10336
|
+
const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every((n) => hasLoadedNamespace2(n, i18n, i18nOptions));
|
|
10337
|
+
const memoGetT = useMemoizedT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
|
|
10338
|
+
const getT = () => memoGetT;
|
|
10339
|
+
const getNewT = () => alwaysNewT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
|
|
10340
|
+
const [t2, setT] = (0, import_react6.useState)(getT);
|
|
10341
|
+
let joinedNS = namespaces.join();
|
|
10342
|
+
if (props.lng) joinedNS = `${props.lng}${joinedNS}`;
|
|
10343
|
+
const previousJoinedNS = usePrevious(joinedNS);
|
|
10344
|
+
const isMounted = (0, import_react6.useRef)(true);
|
|
10345
|
+
(0, import_react6.useEffect)(() => {
|
|
10346
|
+
const {
|
|
10347
|
+
bindI18n,
|
|
10348
|
+
bindI18nStore
|
|
10349
|
+
} = i18nOptions;
|
|
10350
|
+
isMounted.current = true;
|
|
10351
|
+
if (!ready && !useSuspense) {
|
|
10352
|
+
if (props.lng) {
|
|
10353
|
+
loadLanguages2(i18n, props.lng, namespaces, () => {
|
|
10354
|
+
if (isMounted.current) setT(getNewT);
|
|
10355
|
+
});
|
|
10356
|
+
} else {
|
|
10357
|
+
loadNamespaces2(i18n, namespaces, () => {
|
|
10358
|
+
if (isMounted.current) setT(getNewT);
|
|
10359
|
+
});
|
|
10360
|
+
}
|
|
10361
|
+
}
|
|
10362
|
+
if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
|
|
10363
|
+
setT(getNewT);
|
|
10364
|
+
}
|
|
10365
|
+
const boundReset = () => {
|
|
10366
|
+
if (isMounted.current) setT(getNewT);
|
|
10367
|
+
};
|
|
10368
|
+
if (bindI18n) i18n?.on(bindI18n, boundReset);
|
|
10369
|
+
if (bindI18nStore) i18n?.store.on(bindI18nStore, boundReset);
|
|
10370
|
+
return () => {
|
|
10371
|
+
isMounted.current = false;
|
|
10372
|
+
if (i18n) bindI18n?.split(" ").forEach((e2) => i18n.off(e2, boundReset));
|
|
10373
|
+
if (bindI18nStore && i18n) bindI18nStore.split(" ").forEach((e2) => i18n.store.off(e2, boundReset));
|
|
10374
|
+
};
|
|
10375
|
+
}, [i18n, joinedNS]);
|
|
10376
|
+
(0, import_react6.useEffect)(() => {
|
|
10377
|
+
if (isMounted.current && ready) {
|
|
10378
|
+
setT(getT);
|
|
10379
|
+
}
|
|
10380
|
+
}, [i18n, keyPrefix, ready]);
|
|
10381
|
+
const ret = [t2, i18n, ready];
|
|
10382
|
+
ret.t = t2;
|
|
10383
|
+
ret.i18n = i18n;
|
|
10384
|
+
ret.ready = ready;
|
|
10385
|
+
if (ready) return ret;
|
|
10386
|
+
if (!ready && !useSuspense) return ret;
|
|
10387
|
+
throw new Promise((resolve) => {
|
|
10388
|
+
if (props.lng) {
|
|
10389
|
+
loadLanguages2(i18n, props.lng, namespaces, () => resolve());
|
|
10390
|
+
} else {
|
|
10391
|
+
loadNamespaces2(i18n, namespaces, () => resolve());
|
|
10392
|
+
}
|
|
10393
|
+
});
|
|
10394
|
+
};
|
|
10395
|
+
|
|
10396
|
+
// node_modules/react-i18next/dist/es/withTranslation.js
|
|
10397
|
+
var import_react7 = require("react");
|
|
10398
|
+
|
|
10399
|
+
// node_modules/react-i18next/dist/es/I18nextProvider.js
|
|
10400
|
+
var import_react8 = require("react");
|
|
10401
|
+
|
|
10402
|
+
// node_modules/react-i18next/dist/es/withSSR.js
|
|
10403
|
+
var import_react10 = require("react");
|
|
10404
|
+
|
|
10405
|
+
// node_modules/react-i18next/dist/es/useSSR.js
|
|
10406
|
+
var import_react9 = require("react");
|
|
10407
|
+
|
|
10403
10408
|
// node_modules/uuid/dist/esm-browser/stringify.js
|
|
10404
10409
|
var byteToHex = [];
|
|
10405
10410
|
for (let i2 = 0; i2 < 256; ++i2) {
|
|
@@ -10723,7 +10728,24 @@ function BillingPriceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
10723
10728
|
id: json["id"],
|
|
10724
10729
|
interval: json["interval"],
|
|
10725
10730
|
price: json["price"],
|
|
10726
|
-
priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"]
|
|
10731
|
+
priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"],
|
|
10732
|
+
scheme: json["scheme"]
|
|
10733
|
+
};
|
|
10734
|
+
}
|
|
10735
|
+
|
|
10736
|
+
// src/api/models/BillingProductPriceTierResponseData.ts
|
|
10737
|
+
function BillingProductPriceTierResponseDataFromJSON(json) {
|
|
10738
|
+
return BillingProductPriceTierResponseDataFromJSONTyped(json, false);
|
|
10739
|
+
}
|
|
10740
|
+
function BillingProductPriceTierResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
10741
|
+
if (json == null) {
|
|
10742
|
+
return json;
|
|
10743
|
+
}
|
|
10744
|
+
return {
|
|
10745
|
+
flatAmount: json["flat_amount"] == null ? void 0 : json["flat_amount"],
|
|
10746
|
+
perUnitPrice: json["per_unit_price"] == null ? void 0 : json["per_unit_price"],
|
|
10747
|
+
perUnitPriceDecimal: json["per_unit_price_decimal"] == null ? void 0 : json["per_unit_price_decimal"],
|
|
10748
|
+
upTo: json["up_to"] == null ? void 0 : json["up_to"]
|
|
10727
10749
|
};
|
|
10728
10750
|
}
|
|
10729
10751
|
|
|
@@ -10736,6 +10758,7 @@ function BillingPriceViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
10736
10758
|
return json;
|
|
10737
10759
|
}
|
|
10738
10760
|
return {
|
|
10761
|
+
billingScheme: json["billing_scheme"],
|
|
10739
10762
|
createdAt: new Date(json["created_at"]),
|
|
10740
10763
|
currency: json["currency"],
|
|
10741
10764
|
id: json["id"],
|
|
@@ -10746,6 +10769,9 @@ function BillingPriceViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
10746
10769
|
priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"],
|
|
10747
10770
|
priceExternalId: json["price_external_id"],
|
|
10748
10771
|
priceId: json["price_id"],
|
|
10772
|
+
priceTier: json["price_tier"].map(
|
|
10773
|
+
BillingProductPriceTierResponseDataFromJSON
|
|
10774
|
+
),
|
|
10749
10775
|
productExternalId: json["product_external_id"],
|
|
10750
10776
|
productId: json["product_id"],
|
|
10751
10777
|
productName: json["product_name"],
|
|
@@ -10790,6 +10816,7 @@ function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDisc
|
|
|
10790
10816
|
return json;
|
|
10791
10817
|
}
|
|
10792
10818
|
return {
|
|
10819
|
+
billingScheme: json["billing_scheme"],
|
|
10793
10820
|
createdAt: new Date(json["created_at"]),
|
|
10794
10821
|
currency: json["currency"],
|
|
10795
10822
|
environmentId: json["environment_id"],
|
|
@@ -10802,6 +10829,9 @@ function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDisc
|
|
|
10802
10829
|
priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"],
|
|
10803
10830
|
priceExternalId: json["price_external_id"],
|
|
10804
10831
|
priceId: json["price_id"],
|
|
10832
|
+
priceTier: json["price_tier"].map(
|
|
10833
|
+
BillingProductPriceTierResponseDataFromJSON
|
|
10834
|
+
),
|
|
10805
10835
|
quantity: json["quantity"],
|
|
10806
10836
|
subscriptionId: json["subscription_id"],
|
|
10807
10837
|
updatedAt: new Date(json["updated_at"]),
|
|
@@ -10809,6 +10839,29 @@ function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDisc
|
|
|
10809
10839
|
};
|
|
10810
10840
|
}
|
|
10811
10841
|
|
|
10842
|
+
// src/api/models/BillingProductResponseData.ts
|
|
10843
|
+
function BillingProductResponseDataFromJSON(json) {
|
|
10844
|
+
return BillingProductResponseDataFromJSONTyped(json, false);
|
|
10845
|
+
}
|
|
10846
|
+
function BillingProductResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
10847
|
+
if (json == null) {
|
|
10848
|
+
return json;
|
|
10849
|
+
}
|
|
10850
|
+
return {
|
|
10851
|
+
accountId: json["account_id"],
|
|
10852
|
+
createdAt: new Date(json["created_at"]),
|
|
10853
|
+
currency: json["currency"],
|
|
10854
|
+
environmentId: json["environment_id"],
|
|
10855
|
+
externalId: json["external_id"],
|
|
10856
|
+
name: json["name"],
|
|
10857
|
+
price: json["price"],
|
|
10858
|
+
priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"],
|
|
10859
|
+
productId: json["product_id"],
|
|
10860
|
+
quantity: json["quantity"],
|
|
10861
|
+
updatedAt: new Date(json["updated_at"])
|
|
10862
|
+
};
|
|
10863
|
+
}
|
|
10864
|
+
|
|
10812
10865
|
// src/api/models/BillingSubscriptionDiscountView.ts
|
|
10813
10866
|
function BillingSubscriptionDiscountViewFromJSON(json) {
|
|
10814
10867
|
return BillingSubscriptionDiscountViewFromJSONTyped(json, false);
|
|
@@ -11479,6 +11532,7 @@ function PlanEntitlementResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
11479
11532
|
ruleIdUsageExceeded: json["rule_id_usage_exceeded"] == null ? void 0 : json["rule_id_usage_exceeded"],
|
|
11480
11533
|
softLimit: json["soft_limit"] == null ? void 0 : json["soft_limit"],
|
|
11481
11534
|
updatedAt: new Date(json["updated_at"]),
|
|
11535
|
+
usageBasedProduct: json["usage_based_product"] == null ? void 0 : BillingProductResponseDataFromJSON(json["usage_based_product"]),
|
|
11482
11536
|
valueBool: json["value_bool"] == null ? void 0 : json["value_bool"],
|
|
11483
11537
|
valueNumeric: json["value_numeric"] == null ? void 0 : json["value_numeric"],
|
|
11484
11538
|
valueTrait: json["value_trait"] == null ? void 0 : EntityTraitDefinitionResponseDataFromJSON(json["value_trait"]),
|
|
@@ -11827,6 +11881,26 @@ function ListInvoicesResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
11827
11881
|
};
|
|
11828
11882
|
}
|
|
11829
11883
|
|
|
11884
|
+
// src/api/models/PreviewSubscriptionFinanceResponseData.ts
|
|
11885
|
+
function PreviewSubscriptionFinanceResponseDataFromJSON(json) {
|
|
11886
|
+
return PreviewSubscriptionFinanceResponseDataFromJSONTyped(json, false);
|
|
11887
|
+
}
|
|
11888
|
+
function PreviewSubscriptionFinanceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
11889
|
+
if (json == null) {
|
|
11890
|
+
return json;
|
|
11891
|
+
}
|
|
11892
|
+
return {
|
|
11893
|
+
amountOff: json["amount_off"],
|
|
11894
|
+
dueNow: json["due_now"],
|
|
11895
|
+
newCharges: json["new_charges"],
|
|
11896
|
+
percentOff: json["percent_off"],
|
|
11897
|
+
periodStart: new Date(json["period_start"]),
|
|
11898
|
+
promoCodeApplied: json["promo_code_applied"],
|
|
11899
|
+
proration: json["proration"],
|
|
11900
|
+
trialEnd: json["trial_end"] == null ? void 0 : new Date(json["trial_end"])
|
|
11901
|
+
};
|
|
11902
|
+
}
|
|
11903
|
+
|
|
11830
11904
|
// src/api/models/PreviewSubscriptionChangeResponseData.ts
|
|
11831
11905
|
function PreviewSubscriptionChangeResponseDataFromJSON(json) {
|
|
11832
11906
|
return PreviewSubscriptionChangeResponseDataFromJSONTyped(json, false);
|
|
@@ -11838,12 +11912,16 @@ function PreviewSubscriptionChangeResponseDataFromJSONTyped(json, ignoreDiscrimi
|
|
|
11838
11912
|
return {
|
|
11839
11913
|
amountOff: json["amount_off"],
|
|
11840
11914
|
dueNow: json["due_now"],
|
|
11915
|
+
finance: json["finance"] == null ? void 0 : PreviewSubscriptionFinanceResponseDataFromJSON(json["finance"]),
|
|
11841
11916
|
newCharges: json["new_charges"],
|
|
11842
11917
|
percentOff: json["percent_off"],
|
|
11843
11918
|
periodStart: new Date(json["period_start"]),
|
|
11844
11919
|
promoCodeApplied: json["promo_code_applied"],
|
|
11845
11920
|
proration: json["proration"],
|
|
11846
|
-
trialEnd: json["trial_end"] == null ? void 0 : new Date(json["trial_end"])
|
|
11921
|
+
trialEnd: json["trial_end"] == null ? void 0 : new Date(json["trial_end"]),
|
|
11922
|
+
usageViolations: json["usage_violations"].map(
|
|
11923
|
+
FeatureUsageResponseDataFromJSON
|
|
11924
|
+
)
|
|
11847
11925
|
};
|
|
11848
11926
|
}
|
|
11849
11927
|
|
|
@@ -13112,7 +13190,7 @@ var EmbedProvider = ({
|
|
|
13112
13190
|
(0, import_react11.useEffect)(() => {
|
|
13113
13191
|
if (accessToken) {
|
|
13114
13192
|
const { headers = {} } = apiConfig ?? {};
|
|
13115
|
-
headers["X-Schematic-Components-Version"] = "0.7.
|
|
13193
|
+
headers["X-Schematic-Components-Version"] = "0.7.4";
|
|
13116
13194
|
headers["X-Schematic-Session-ID"] = sessionIdRef.current;
|
|
13117
13195
|
const config = new Configuration({
|
|
13118
13196
|
...apiConfig,
|
|
@@ -13451,9 +13529,6 @@ function useWrapChildren(elements) {
|
|
|
13451
13529
|
return shouldWrap.some((wrap) => wrap);
|
|
13452
13530
|
}
|
|
13453
13531
|
|
|
13454
|
-
// src/components/layout/card/Card.tsx
|
|
13455
|
-
var import_react20 = require("react");
|
|
13456
|
-
|
|
13457
13532
|
// src/components/ui/box/styles.ts
|
|
13458
13533
|
var Box = dt.div((props) => {
|
|
13459
13534
|
function reducer(acc, [key, value]) {
|
|
@@ -13668,6 +13743,8 @@ var EmbedButton = dt(Button2)`
|
|
|
13668
13743
|
font-family: "Public Sans", sans-serif;
|
|
13669
13744
|
font-weight: 500;
|
|
13670
13745
|
text-align: center;
|
|
13746
|
+
display: flex;
|
|
13747
|
+
align-items: center;
|
|
13671
13748
|
|
|
13672
13749
|
${({ disabled, $color = "primary", theme }) => {
|
|
13673
13750
|
const { l: l2 } = hexToHSL(theme[$color]);
|
|
@@ -13815,6 +13892,24 @@ var EmbedButton = dt(Button2)`
|
|
|
13815
13892
|
`;
|
|
13816
13893
|
}
|
|
13817
13894
|
}}
|
|
13895
|
+
|
|
13896
|
+
${({ $selfAlignment = "center" }) => {
|
|
13897
|
+
switch ($selfAlignment) {
|
|
13898
|
+
case "start":
|
|
13899
|
+
return lt`
|
|
13900
|
+
align-self: start;
|
|
13901
|
+
`;
|
|
13902
|
+
case "end":
|
|
13903
|
+
return lt`
|
|
13904
|
+
align-self: end;
|
|
13905
|
+
`;
|
|
13906
|
+
case "center":
|
|
13907
|
+
default:
|
|
13908
|
+
return lt`
|
|
13909
|
+
align-self: center;
|
|
13910
|
+
`;
|
|
13911
|
+
}
|
|
13912
|
+
}}
|
|
13818
13913
|
|
|
13819
13914
|
${({ $fullWidth = true }) => {
|
|
13820
13915
|
if ($fullWidth) {
|
|
@@ -14278,14 +14373,6 @@ var ModalHeader = ({
|
|
|
14278
14373
|
);
|
|
14279
14374
|
};
|
|
14280
14375
|
|
|
14281
|
-
// src/components/ui/progress-bar/styles.ts
|
|
14282
|
-
var Container3 = dt.div`
|
|
14283
|
-
position: relative;
|
|
14284
|
-
display: flex;
|
|
14285
|
-
align-items: center;
|
|
14286
|
-
gap: 1rem;
|
|
14287
|
-
`;
|
|
14288
|
-
|
|
14289
14376
|
// src/components/ui/progress-bar/ProgressBar.tsx
|
|
14290
14377
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
14291
14378
|
var progressColorMap = [
|
|
@@ -14302,7 +14389,6 @@ var ProgressBar = ({
|
|
|
14302
14389
|
total = 0,
|
|
14303
14390
|
color = "gray",
|
|
14304
14391
|
bgColor = "#F2F4F7",
|
|
14305
|
-
barWidth = "100%",
|
|
14306
14392
|
...props
|
|
14307
14393
|
}) => {
|
|
14308
14394
|
const theme = nt();
|
|
@@ -14313,18 +14399,18 @@ var ProgressBar = ({
|
|
|
14313
14399
|
orange: "#DB6769",
|
|
14314
14400
|
red: "#EF4444"
|
|
14315
14401
|
};
|
|
14316
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
14317
|
-
|
|
14318
|
-
|
|
14319
|
-
|
|
14320
|
-
|
|
14321
|
-
|
|
14322
|
-
|
|
14323
|
-
|
|
14324
|
-
|
|
14325
|
-
|
|
14402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
14403
|
+
Flex,
|
|
14404
|
+
{
|
|
14405
|
+
$position: "relative",
|
|
14406
|
+
$alignItems: "center",
|
|
14407
|
+
$gap: "1rem",
|
|
14408
|
+
$width: "100%",
|
|
14409
|
+
...props,
|
|
14410
|
+
children: [
|
|
14411
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
14412
|
+
Box,
|
|
14326
14413
|
{
|
|
14327
|
-
$position: "relative",
|
|
14328
14414
|
$overflow: "hidden",
|
|
14329
14415
|
$width: "100%",
|
|
14330
14416
|
$height: `${8 / TEXT_BASE_SIZE}rem`,
|
|
@@ -14335,29 +14421,28 @@ var ProgressBar = ({
|
|
|
14335
14421
|
{
|
|
14336
14422
|
$width: `${Math.min(progress, 100)}%`,
|
|
14337
14423
|
$height: "100%",
|
|
14338
|
-
$backgroundColor: barColorMap[color]
|
|
14339
|
-
$borderRadius: "9999px"
|
|
14424
|
+
$backgroundColor: barColorMap[color]
|
|
14340
14425
|
}
|
|
14341
14426
|
)
|
|
14342
14427
|
}
|
|
14428
|
+
),
|
|
14429
|
+
total && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
14430
|
+
Text,
|
|
14431
|
+
{
|
|
14432
|
+
$font: theme.typography.text.fontFamily,
|
|
14433
|
+
$size: 14,
|
|
14434
|
+
$weight: 500,
|
|
14435
|
+
$color: theme.typography.text.color,
|
|
14436
|
+
children: [
|
|
14437
|
+
value,
|
|
14438
|
+
"/",
|
|
14439
|
+
total
|
|
14440
|
+
]
|
|
14441
|
+
}
|
|
14343
14442
|
)
|
|
14344
|
-
|
|
14345
|
-
|
|
14346
|
-
|
|
14347
|
-
Text,
|
|
14348
|
-
{
|
|
14349
|
-
$font: theme.typography.text.fontFamily,
|
|
14350
|
-
$size: 14,
|
|
14351
|
-
$weight: 500,
|
|
14352
|
-
$color: theme.typography.text.color,
|
|
14353
|
-
children: [
|
|
14354
|
-
value,
|
|
14355
|
-
"/",
|
|
14356
|
-
total
|
|
14357
|
-
]
|
|
14358
|
-
}
|
|
14359
|
-
)
|
|
14360
|
-
] });
|
|
14443
|
+
]
|
|
14444
|
+
}
|
|
14445
|
+
);
|
|
14361
14446
|
};
|
|
14362
14447
|
|
|
14363
14448
|
// src/components/ui/text/styles.ts
|
|
@@ -14406,7 +14491,9 @@ var import_react19 = require("react");
|
|
|
14406
14491
|
var import_react_dom = require("react-dom");
|
|
14407
14492
|
|
|
14408
14493
|
// src/components/ui/tooltip/styles.ts
|
|
14409
|
-
var Trigger = dt.div
|
|
14494
|
+
var Trigger = dt.div`
|
|
14495
|
+
width: 100%;
|
|
14496
|
+
`;
|
|
14410
14497
|
var coords = (position2) => {
|
|
14411
14498
|
let x2 = 0;
|
|
14412
14499
|
let y2 = 0;
|
|
@@ -14562,13 +14649,15 @@ var Tooltip = ({
|
|
|
14562
14649
|
}
|
|
14563
14650
|
}, [position2]);
|
|
14564
14651
|
(0, import_react19.useLayoutEffect)(() => {
|
|
14565
|
-
updateCoords();
|
|
14566
14652
|
const handleResize = (0, import_debounce.default)(updateCoords, DEBOUNCE_TIMEOUT);
|
|
14567
14653
|
window.addEventListener("resize", handleResize);
|
|
14568
14654
|
return () => {
|
|
14569
14655
|
window.removeEventListener("resize", handleResize);
|
|
14570
14656
|
};
|
|
14571
14657
|
}, [updateCoords]);
|
|
14658
|
+
(0, import_react19.useLayoutEffect)(() => {
|
|
14659
|
+
updateCoords();
|
|
14660
|
+
}, [updateCoords, show]);
|
|
14572
14661
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
14573
14662
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
14574
14663
|
Trigger,
|
|
@@ -16283,7 +16372,7 @@ var AddOns = ({ addOns, toggle, isLoading, period }) => {
|
|
|
16283
16372
|
};
|
|
16284
16373
|
|
|
16285
16374
|
// node_modules/@stripe/stripe-js/dist/index.mjs
|
|
16286
|
-
var RELEASE_TRAIN = "
|
|
16375
|
+
var RELEASE_TRAIN = "basil";
|
|
16287
16376
|
var runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion2(version) {
|
|
16288
16377
|
return version === 3 ? "v3" : version;
|
|
16289
16378
|
};
|
|
@@ -16323,7 +16412,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
|
|
|
16323
16412
|
}
|
|
16324
16413
|
stripe._registerWrapper({
|
|
16325
16414
|
name: "stripe-js",
|
|
16326
|
-
version: "
|
|
16415
|
+
version: "7.0.0",
|
|
16327
16416
|
startTime
|
|
16328
16417
|
});
|
|
16329
16418
|
};
|
|
@@ -16398,7 +16487,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
|
|
|
16398
16487
|
var version = runtimeVersionToUrlVersion(maybeStripe.version);
|
|
16399
16488
|
var expectedVersion = RELEASE_TRAIN;
|
|
16400
16489
|
if (isTestKey && version !== expectedVersion) {
|
|
16401
|
-
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("
|
|
16490
|
+
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("7.0.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
|
|
16402
16491
|
}
|
|
16403
16492
|
var stripe = maybeStripe.apply(void 0, args);
|
|
16404
16493
|
registerWrapper(stripe, startTime);
|
|
@@ -17400,7 +17489,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
17400
17489
|
promoCode: updates.promoCode || promoCode
|
|
17401
17490
|
}
|
|
17402
17491
|
});
|
|
17403
|
-
setCharges(data2);
|
|
17492
|
+
setCharges(data2.finance);
|
|
17404
17493
|
} catch (error2) {
|
|
17405
17494
|
if (error2 instanceof ResponseError && error2.response.status === 401) {
|
|
17406
17495
|
const data2 = await error2.response.json();
|
|
@@ -18325,9 +18414,72 @@ var Viewport = (0, import_react30.forwardRef)(
|
|
|
18325
18414
|
);
|
|
18326
18415
|
Viewport.displayName = "Viewport";
|
|
18327
18416
|
|
|
18328
|
-
// src/components/elements/
|
|
18329
|
-
var import_react31 = require("react");
|
|
18417
|
+
// src/components/elements/button/Button.tsx
|
|
18330
18418
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
18419
|
+
var resolveDesignProps = (props) => {
|
|
18420
|
+
return {
|
|
18421
|
+
button: {
|
|
18422
|
+
link: props.button?.link ?? "",
|
|
18423
|
+
openInNewTab: props.button?.openInNewTab ?? true,
|
|
18424
|
+
text: props.button?.text ?? "Button",
|
|
18425
|
+
style: props.button?.style ?? "primary",
|
|
18426
|
+
size: props.button?.size ?? "md",
|
|
18427
|
+
fullWidth: props.button?.fullWidth ?? true,
|
|
18428
|
+
alignment: props.button?.alignment ?? "center",
|
|
18429
|
+
selfAlignment: props.button?.selfAlignment ?? "center"
|
|
18430
|
+
}
|
|
18431
|
+
};
|
|
18432
|
+
};
|
|
18433
|
+
var ButtonElement = (0, import_react31.forwardRef)(({ children, className, ...rest }, ref) => {
|
|
18434
|
+
const props = resolveDesignProps(rest);
|
|
18435
|
+
const buttonStyles = {
|
|
18436
|
+
primary: {
|
|
18437
|
+
color: "primary",
|
|
18438
|
+
variant: "filled"
|
|
18439
|
+
},
|
|
18440
|
+
secondary: {
|
|
18441
|
+
color: "primary",
|
|
18442
|
+
variant: "outline"
|
|
18443
|
+
},
|
|
18444
|
+
tertiary: {
|
|
18445
|
+
color: "primary",
|
|
18446
|
+
variant: "text"
|
|
18447
|
+
}
|
|
18448
|
+
};
|
|
18449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
18450
|
+
Element,
|
|
18451
|
+
{
|
|
18452
|
+
as: Flex,
|
|
18453
|
+
ref,
|
|
18454
|
+
className,
|
|
18455
|
+
$flexDirection: "column",
|
|
18456
|
+
$gap: "2rem",
|
|
18457
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
18458
|
+
EmbedButton,
|
|
18459
|
+
{
|
|
18460
|
+
as: "a",
|
|
18461
|
+
href: props.button.link,
|
|
18462
|
+
target: props.button.openInNewTab ? "_blank" : "_self",
|
|
18463
|
+
$size: props.button.size,
|
|
18464
|
+
$color: buttonStyles[props.button.style].color,
|
|
18465
|
+
$variant: buttonStyles[props.button.style].variant,
|
|
18466
|
+
$alignment: props.button.alignment,
|
|
18467
|
+
$selfAlignment: props.button.selfAlignment,
|
|
18468
|
+
$fullWidth: props.button.fullWidth,
|
|
18469
|
+
children: props.button.text
|
|
18470
|
+
}
|
|
18471
|
+
)
|
|
18472
|
+
}
|
|
18473
|
+
);
|
|
18474
|
+
});
|
|
18475
|
+
ButtonElement.displayName = "Button";
|
|
18476
|
+
|
|
18477
|
+
// src/components/elements/included-features/IncludedFeatures.tsx
|
|
18478
|
+
var import_react33 = require("react");
|
|
18479
|
+
|
|
18480
|
+
// src/components/elements/included-features/Details.tsx
|
|
18481
|
+
var import_react32 = require("react");
|
|
18482
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
18331
18483
|
var Details = ({
|
|
18332
18484
|
shouldWrapChildren,
|
|
18333
18485
|
featureUsage,
|
|
@@ -18345,7 +18497,7 @@ var Details = ({
|
|
|
18345
18497
|
const { t: t2 } = useTranslation();
|
|
18346
18498
|
const theme = nt();
|
|
18347
18499
|
const { data } = useEmbed();
|
|
18348
|
-
const { price, currency } = (0,
|
|
18500
|
+
const { price, currency } = (0, import_react32.useMemo)(() => {
|
|
18349
18501
|
const { price: entitlementPrice, currency: entitlementCurrency } = getBillingPrice(
|
|
18350
18502
|
data.company?.plan?.planPeriod === "year" ? yearlyUsageBasedPrice : monthlyUsageBasedPrice
|
|
18351
18503
|
) || {};
|
|
@@ -18355,7 +18507,7 @@ var Details = ({
|
|
|
18355
18507
|
monthlyUsageBasedPrice,
|
|
18356
18508
|
yearlyUsageBasedPrice
|
|
18357
18509
|
]);
|
|
18358
|
-
const text = (0,
|
|
18510
|
+
const text = (0, import_react32.useMemo)(() => {
|
|
18359
18511
|
if (!feature) {
|
|
18360
18512
|
return;
|
|
18361
18513
|
}
|
|
@@ -18375,7 +18527,7 @@ var Details = ({
|
|
|
18375
18527
|
return t2("Unlimited", { item: getFeatureName(feature) });
|
|
18376
18528
|
}
|
|
18377
18529
|
}, [t2, allocation, feature, price, priceBehavior, currency, softLimit]);
|
|
18378
|
-
const usageText = (0,
|
|
18530
|
+
const usageText = (0, import_react32.useMemo)(() => {
|
|
18379
18531
|
if (!feature) {
|
|
18380
18532
|
return;
|
|
18381
18533
|
}
|
|
@@ -18419,14 +18571,14 @@ var Details = ({
|
|
|
18419
18571
|
if (!text) {
|
|
18420
18572
|
return null;
|
|
18421
18573
|
}
|
|
18422
|
-
return /* @__PURE__ */ (0,
|
|
18574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
18423
18575
|
Box,
|
|
18424
18576
|
{
|
|
18425
18577
|
$flexBasis: "min-content",
|
|
18426
18578
|
$flexGrow: "1",
|
|
18427
18579
|
$textAlign: shouldWrapChildren ? "left" : "right",
|
|
18428
18580
|
children: [
|
|
18429
|
-
props.entitlement.isVisible && /* @__PURE__ */ (0,
|
|
18581
|
+
props.entitlement.isVisible && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
18430
18582
|
Text,
|
|
18431
18583
|
{
|
|
18432
18584
|
$font: theme.typography[props.entitlement.fontStyle].fontFamily,
|
|
@@ -18437,7 +18589,7 @@ var Details = ({
|
|
|
18437
18589
|
children: text
|
|
18438
18590
|
}
|
|
18439
18591
|
) }),
|
|
18440
|
-
props.usage.isVisible && usageText && /* @__PURE__ */ (0,
|
|
18592
|
+
props.usage.isVisible && usageText && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
18441
18593
|
Text,
|
|
18442
18594
|
{
|
|
18443
18595
|
$font: theme.typography[props.usage.fontStyle].fontFamily,
|
|
@@ -18454,8 +18606,8 @@ var Details = ({
|
|
|
18454
18606
|
};
|
|
18455
18607
|
|
|
18456
18608
|
// src/components/elements/included-features/IncludedFeatures.tsx
|
|
18457
|
-
var
|
|
18458
|
-
function
|
|
18609
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
18610
|
+
function resolveDesignProps2(props) {
|
|
18459
18611
|
return {
|
|
18460
18612
|
header: {
|
|
18461
18613
|
isVisible: props.header?.isVisible ?? true,
|
|
@@ -18483,16 +18635,16 @@ function resolveDesignProps(props) {
|
|
|
18483
18635
|
visibleFeatures: props.visibleFeatures
|
|
18484
18636
|
};
|
|
18485
18637
|
}
|
|
18486
|
-
var IncludedFeatures = (0,
|
|
18487
|
-
const props =
|
|
18638
|
+
var IncludedFeatures = (0, import_react33.forwardRef)(({ className, ...rest }, ref) => {
|
|
18639
|
+
const props = resolveDesignProps2(rest);
|
|
18488
18640
|
const { t: t2 } = useTranslation();
|
|
18489
18641
|
const theme = nt();
|
|
18490
18642
|
const { data } = useEmbed();
|
|
18491
|
-
const elements = (0,
|
|
18643
|
+
const elements = (0, import_react33.useRef)([]);
|
|
18492
18644
|
const shouldWrapChildren = useWrapChildren(elements.current);
|
|
18493
18645
|
const isLightBackground = useIsLightBackground();
|
|
18494
|
-
const [showCount, setShowCount] = (0,
|
|
18495
|
-
const featureUsage = (0,
|
|
18646
|
+
const [showCount, setShowCount] = (0, import_react33.useState)(VISIBLE_ENTITLEMENT_COUNT);
|
|
18647
|
+
const featureUsage = (0, import_react33.useMemo)(() => {
|
|
18496
18648
|
const orderedFeatureUsage = props.visibleFeatures?.reduce(
|
|
18497
18649
|
(acc, id) => {
|
|
18498
18650
|
const mappedFeatureUsage = data.featureUsage?.features.find(
|
|
@@ -18519,7 +18671,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
18519
18671
|
}
|
|
18520
18672
|
const shouldShowExpand = featureListSize > VISIBLE_ENTITLEMENT_COUNT;
|
|
18521
18673
|
const isExpanded = showCount > VISIBLE_ENTITLEMENT_COUNT;
|
|
18522
|
-
return /* @__PURE__ */ (0,
|
|
18674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
18523
18675
|
Element,
|
|
18524
18676
|
{
|
|
18525
18677
|
as: Flex,
|
|
@@ -18528,7 +18680,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
18528
18680
|
$flexDirection: "column",
|
|
18529
18681
|
$gap: "1rem",
|
|
18530
18682
|
children: [
|
|
18531
|
-
props.header.isVisible && /* @__PURE__ */ (0,
|
|
18683
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18532
18684
|
Text,
|
|
18533
18685
|
{
|
|
18534
18686
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -18541,7 +18693,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
18541
18693
|
featureUsage.slice(0, showCount).map((usage, index) => {
|
|
18542
18694
|
const feature = usage.feature;
|
|
18543
18695
|
const shouldShowDetails = feature?.name && (feature?.featureType === "event" || feature?.featureType === "trait");
|
|
18544
|
-
return /* @__PURE__ */ (0,
|
|
18696
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
18545
18697
|
Flex,
|
|
18546
18698
|
{
|
|
18547
18699
|
ref: (el) => {
|
|
@@ -18554,7 +18706,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
18554
18706
|
$alignItems: "center",
|
|
18555
18707
|
$gap: "1rem",
|
|
18556
18708
|
children: [
|
|
18557
|
-
/* @__PURE__ */ (0,
|
|
18709
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
18558
18710
|
Flex,
|
|
18559
18711
|
{
|
|
18560
18712
|
$alignItems: "center",
|
|
@@ -18562,7 +18714,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
18562
18714
|
$flexBasis: "min-content",
|
|
18563
18715
|
$gap: "1rem",
|
|
18564
18716
|
children: [
|
|
18565
|
-
props.icons.isVisible && feature?.icon && /* @__PURE__ */ (0,
|
|
18717
|
+
props.icons.isVisible && feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18566
18718
|
IconRound,
|
|
18567
18719
|
{
|
|
18568
18720
|
name: feature.icon,
|
|
@@ -18573,7 +18725,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
18573
18725
|
]
|
|
18574
18726
|
}
|
|
18575
18727
|
),
|
|
18576
|
-
feature?.name && /* @__PURE__ */ (0,
|
|
18728
|
+
feature?.name && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18577
18729
|
Text,
|
|
18578
18730
|
{
|
|
18579
18731
|
$font: theme.typography[props.icons.fontStyle].fontFamily,
|
|
@@ -18583,7 +18735,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
18583
18735
|
children: feature.name
|
|
18584
18736
|
}
|
|
18585
18737
|
),
|
|
18586
|
-
props.entitlementExpiration.isVisible && usage.entitlementExpirationDate && /* @__PURE__ */ (0,
|
|
18738
|
+
props.entitlementExpiration.isVisible && usage.entitlementExpirationDate && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
18587
18739
|
Text,
|
|
18588
18740
|
{
|
|
18589
18741
|
$font: theme.typography[props.entitlementExpiration.fontStyle].fontFamily,
|
|
@@ -18603,7 +18755,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
18603
18755
|
]
|
|
18604
18756
|
}
|
|
18605
18757
|
),
|
|
18606
|
-
shouldShowDetails && /* @__PURE__ */ (0,
|
|
18758
|
+
shouldShowDetails && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18607
18759
|
Details,
|
|
18608
18760
|
{
|
|
18609
18761
|
featureUsage: usage,
|
|
@@ -18616,8 +18768,8 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
18616
18768
|
index
|
|
18617
18769
|
);
|
|
18618
18770
|
}),
|
|
18619
|
-
shouldShowExpand && /* @__PURE__ */ (0,
|
|
18620
|
-
/* @__PURE__ */ (0,
|
|
18771
|
+
shouldShowExpand && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $alignItems: "center", $justifyContent: "start", $marginTop: "1rem", children: [
|
|
18772
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18621
18773
|
Icon2,
|
|
18622
18774
|
{
|
|
18623
18775
|
name: isExpanded ? "chevron-up" : "chevron-down",
|
|
@@ -18629,7 +18781,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
18629
18781
|
}
|
|
18630
18782
|
}
|
|
18631
18783
|
),
|
|
18632
|
-
/* @__PURE__ */ (0,
|
|
18784
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18633
18785
|
Text,
|
|
18634
18786
|
{
|
|
18635
18787
|
onClick: handleToggleShowAll,
|
|
@@ -18650,9 +18802,9 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
18650
18802
|
IncludedFeatures.displayName = "IncludedFeatures";
|
|
18651
18803
|
|
|
18652
18804
|
// src/components/elements/invoices/Invoices.tsx
|
|
18653
|
-
var
|
|
18654
|
-
var
|
|
18655
|
-
function
|
|
18805
|
+
var import_react34 = require("react");
|
|
18806
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
18807
|
+
function resolveDesignProps3(props) {
|
|
18656
18808
|
return {
|
|
18657
18809
|
header: {
|
|
18658
18810
|
isVisible: props.header?.isVisible ?? true,
|
|
@@ -18685,7 +18837,7 @@ function formatInvoices(invoices = []) {
|
|
|
18685
18837
|
}
|
|
18686
18838
|
var InvoiceDate = ({ date, fontStyle, url }) => {
|
|
18687
18839
|
const theme = nt();
|
|
18688
|
-
const dateText = /* @__PURE__ */ (0,
|
|
18840
|
+
const dateText = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18689
18841
|
Text,
|
|
18690
18842
|
{
|
|
18691
18843
|
...url && { onClick: () => {
|
|
@@ -18698,23 +18850,23 @@ var InvoiceDate = ({ date, fontStyle, url }) => {
|
|
|
18698
18850
|
}
|
|
18699
18851
|
);
|
|
18700
18852
|
if (url) {
|
|
18701
|
-
return /* @__PURE__ */ (0,
|
|
18853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("a", { href: url, target: "_blank", rel: "noreferrer", children: dateText });
|
|
18702
18854
|
}
|
|
18703
18855
|
return dateText;
|
|
18704
18856
|
};
|
|
18705
|
-
var Invoices = (0,
|
|
18706
|
-
const props =
|
|
18857
|
+
var Invoices = (0, import_react34.forwardRef)(({ className, data, ...rest }, ref) => {
|
|
18858
|
+
const props = resolveDesignProps3(rest);
|
|
18707
18859
|
const { t: t2 } = useTranslation();
|
|
18708
18860
|
const theme = nt();
|
|
18709
18861
|
const { api } = useEmbed();
|
|
18710
|
-
const [invoices, setInvoices] = (0,
|
|
18711
|
-
const [listSize, setListSize] = (0,
|
|
18862
|
+
const [invoices, setInvoices] = (0, import_react34.useState)(() => formatInvoices(data));
|
|
18863
|
+
const [listSize, setListSize] = (0, import_react34.useState)(props.limit.number);
|
|
18712
18864
|
const toggleListSize = () => {
|
|
18713
18865
|
setListSize(
|
|
18714
18866
|
(prev2) => prev2 !== props.limit.number ? props.limit.number : MAX_VISIBLE_INVOICE_COUNT
|
|
18715
18867
|
);
|
|
18716
18868
|
};
|
|
18717
|
-
(0,
|
|
18869
|
+
(0, import_react34.useEffect)(() => {
|
|
18718
18870
|
api?.listInvoices().then(({ data: data2 }) => {
|
|
18719
18871
|
setInvoices(formatInvoices(data2));
|
|
18720
18872
|
});
|
|
@@ -18722,8 +18874,8 @@ var Invoices = (0, import_react33.forwardRef)(({ className, data, ...rest }, ref
|
|
|
18722
18874
|
if (invoices.length === 0) {
|
|
18723
18875
|
return null;
|
|
18724
18876
|
}
|
|
18725
|
-
return /* @__PURE__ */ (0,
|
|
18726
|
-
props.header.isVisible && /* @__PURE__ */ (0,
|
|
18877
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Element, { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
18878
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18727
18879
|
Text,
|
|
18728
18880
|
{
|
|
18729
18881
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -18733,9 +18885,9 @@ var Invoices = (0, import_react33.forwardRef)(({ className, data, ...rest }, ref
|
|
|
18733
18885
|
children: t2("Invoices")
|
|
18734
18886
|
}
|
|
18735
18887
|
) }),
|
|
18736
|
-
/* @__PURE__ */ (0,
|
|
18737
|
-
return /* @__PURE__ */ (0,
|
|
18738
|
-
props.date.isVisible && date && /* @__PURE__ */ (0,
|
|
18888
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(0, listSize).map(({ date, amount, url }, index) => {
|
|
18889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $justifyContent: "space-between", children: [
|
|
18890
|
+
props.date.isVisible && date && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18739
18891
|
InvoiceDate,
|
|
18740
18892
|
{
|
|
18741
18893
|
date,
|
|
@@ -18743,7 +18895,7 @@ var Invoices = (0, import_react33.forwardRef)(({ className, data, ...rest }, ref
|
|
|
18743
18895
|
url
|
|
18744
18896
|
}
|
|
18745
18897
|
),
|
|
18746
|
-
props.amount.isVisible && /* @__PURE__ */ (0,
|
|
18898
|
+
props.amount.isVisible && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18747
18899
|
Text,
|
|
18748
18900
|
{
|
|
18749
18901
|
$font: theme.typography[props.amount.fontStyle].fontFamily,
|
|
@@ -18755,15 +18907,15 @@ var Invoices = (0, import_react33.forwardRef)(({ className, data, ...rest }, ref
|
|
|
18755
18907
|
)
|
|
18756
18908
|
] }, index);
|
|
18757
18909
|
}) }),
|
|
18758
|
-
props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */ (0,
|
|
18759
|
-
/* @__PURE__ */ (0,
|
|
18910
|
+
props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
|
|
18911
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18760
18912
|
Icon2,
|
|
18761
18913
|
{
|
|
18762
18914
|
name: `chevron-${listSize === props.limit.number ? "down" : "up"}`,
|
|
18763
18915
|
style: { color: "#D0D0D0" }
|
|
18764
18916
|
}
|
|
18765
18917
|
),
|
|
18766
|
-
/* @__PURE__ */ (0,
|
|
18918
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18767
18919
|
Text,
|
|
18768
18920
|
{
|
|
18769
18921
|
onClick: toggleListSize,
|
|
@@ -18780,10 +18932,10 @@ var Invoices = (0, import_react33.forwardRef)(({ className, data, ...rest }, ref
|
|
|
18780
18932
|
Invoices.displayName = "Invoices";
|
|
18781
18933
|
|
|
18782
18934
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
18783
|
-
var
|
|
18935
|
+
var import_react35 = require("react");
|
|
18784
18936
|
|
|
18785
18937
|
// src/components/elements/metered-features/styles.ts
|
|
18786
|
-
var
|
|
18938
|
+
var Container3 = dt.div`
|
|
18787
18939
|
display: flex;
|
|
18788
18940
|
flex-direction: column;
|
|
18789
18941
|
gap: 1rem;
|
|
@@ -18823,8 +18975,8 @@ var Container4 = dt.div`
|
|
|
18823
18975
|
`;
|
|
18824
18976
|
|
|
18825
18977
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
18826
|
-
var
|
|
18827
|
-
function
|
|
18978
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
18979
|
+
function resolveDesignProps4(props) {
|
|
18828
18980
|
return {
|
|
18829
18981
|
isVisible: props.isVisible ?? true,
|
|
18830
18982
|
header: {
|
|
@@ -18849,15 +19001,15 @@ function resolveDesignProps3(props) {
|
|
|
18849
19001
|
visibleFeatures: props.visibleFeatures
|
|
18850
19002
|
};
|
|
18851
19003
|
}
|
|
18852
|
-
var MeteredFeatures = (0,
|
|
18853
|
-
const props =
|
|
18854
|
-
const elements = (0,
|
|
19004
|
+
var MeteredFeatures = (0, import_react35.forwardRef)(({ className, ...rest }, ref) => {
|
|
19005
|
+
const props = resolveDesignProps4(rest);
|
|
19006
|
+
const elements = (0, import_react35.useRef)([]);
|
|
18855
19007
|
const shouldWrapChildren = useWrapChildren(elements.current);
|
|
18856
19008
|
const { t: t2 } = useTranslation();
|
|
18857
19009
|
const theme = nt();
|
|
18858
19010
|
const { data, setLayout, setSelected } = useEmbed();
|
|
18859
19011
|
const isLightBackground = useIsLightBackground();
|
|
18860
|
-
const featureUsage = (0,
|
|
19012
|
+
const featureUsage = (0, import_react35.useMemo)(() => {
|
|
18861
19013
|
const orderedFeatureUsage = props.visibleFeatures?.reduce(
|
|
18862
19014
|
(acc, id) => {
|
|
18863
19015
|
const mappedFeatureUsage = data.featureUsage?.features.find(
|
|
@@ -18879,7 +19031,7 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18879
19031
|
if (!shouldShowFeatures) {
|
|
18880
19032
|
return null;
|
|
18881
19033
|
}
|
|
18882
|
-
return /* @__PURE__ */ (0,
|
|
19034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Container3, { ref, className, children: featureUsage.map(
|
|
18883
19035
|
({
|
|
18884
19036
|
feature,
|
|
18885
19037
|
priceBehavior,
|
|
@@ -18895,7 +19047,7 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18895
19047
|
const { price, currency } = getBillingPrice(
|
|
18896
19048
|
planPeriod === "year" ? yearlyUsageBasedPrice : monthlyUsageBasedPrice
|
|
18897
19049
|
) || {};
|
|
18898
|
-
const progressBar = props.isVisible && typeof usage === "number" && limit > 0 && priceBehavior !== "pay_as_you_go" && /* @__PURE__ */ (0,
|
|
19050
|
+
const progressBar = props.isVisible && typeof usage === "number" && limit > 0 && priceBehavior !== "pay_as_you_go" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18899
19051
|
ProgressBar,
|
|
18900
19052
|
{
|
|
18901
19053
|
progress: (isOverage ? softLimit / usage : usage / limit) * 100,
|
|
@@ -18904,12 +19056,11 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18904
19056
|
color: isOverage ? "blue" : progressColorMap[Math.floor(
|
|
18905
19057
|
Math.min(usage, limit) / limit * (progressColorMap.length - 1)
|
|
18906
19058
|
)],
|
|
18907
|
-
...isOverage && { bgColor: "#EF4444" }
|
|
18908
|
-
$flexGrow: 1
|
|
19059
|
+
...isOverage && { bgColor: "#EF4444" }
|
|
18909
19060
|
}
|
|
18910
19061
|
);
|
|
18911
|
-
return /* @__PURE__ */ (0,
|
|
18912
|
-
priceBehavior === "overage" && typeof price === "number" && /* @__PURE__ */ (0,
|
|
19062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Flex, { $flexDirection: "column-reverse", children: [
|
|
19063
|
+
priceBehavior === "overage" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
18913
19064
|
Flex,
|
|
18914
19065
|
{
|
|
18915
19066
|
$justifyContent: "space-between",
|
|
@@ -18921,7 +19072,7 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18921
19072
|
$borderBottomRightRadius: `${theme.card.borderRadius / TEXT_BASE_SIZE}rem`
|
|
18922
19073
|
},
|
|
18923
19074
|
children: [
|
|
18924
|
-
/* @__PURE__ */ (0,
|
|
19075
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18925
19076
|
Text,
|
|
18926
19077
|
{
|
|
18927
19078
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18929,14 +19080,14 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18929
19080
|
$weight: theme.typography.text.fontWeight,
|
|
18930
19081
|
$color: theme.typography.text.color,
|
|
18931
19082
|
$leading: 1.35,
|
|
18932
|
-
children: /* @__PURE__ */ (0,
|
|
19083
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
18933
19084
|
t2("Overage fee"),
|
|
18934
19085
|
": ",
|
|
18935
19086
|
formatCurrency(price, currency),
|
|
18936
|
-
feature && /* @__PURE__ */ (0,
|
|
19087
|
+
feature && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Box, { as: "sub", $whiteSpace: "nowrap", children: [
|
|
18937
19088
|
"/",
|
|
18938
19089
|
getFeatureName(feature, 1),
|
|
18939
|
-
feature.featureType === "trait" && planPeriod && /* @__PURE__ */ (0,
|
|
19090
|
+
feature.featureType === "trait" && planPeriod && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
18940
19091
|
"/",
|
|
18941
19092
|
shortenPeriod(planPeriod)
|
|
18942
19093
|
] })
|
|
@@ -18944,7 +19095,7 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18944
19095
|
] })
|
|
18945
19096
|
}
|
|
18946
19097
|
),
|
|
18947
|
-
isOverage && /* @__PURE__ */ (0,
|
|
19098
|
+
isOverage && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
18948
19099
|
Text,
|
|
18949
19100
|
{
|
|
18950
19101
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18958,7 +19109,7 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18958
19109
|
}),
|
|
18959
19110
|
" \xB7 ",
|
|
18960
19111
|
formatCurrency(price * (usage - softLimit), currency),
|
|
18961
|
-
feature?.featureType === "trait" && typeof planPeriod === "string" && /* @__PURE__ */ (0,
|
|
19112
|
+
feature?.featureType === "trait" && typeof planPeriod === "string" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Box, { as: "sub", $whiteSpace: "nowrap", children: [
|
|
18962
19113
|
"/",
|
|
18963
19114
|
shortenPeriod(planPeriod)
|
|
18964
19115
|
] })
|
|
@@ -18968,8 +19119,8 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18968
19119
|
]
|
|
18969
19120
|
}
|
|
18970
19121
|
),
|
|
18971
|
-
/* @__PURE__ */ (0,
|
|
18972
|
-
props.icon.isVisible && feature?.icon && /* @__PURE__ */ (0,
|
|
19122
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Element, { as: Flex, $gap: "1.5rem", children: [
|
|
19123
|
+
props.icon.isVisible && feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18973
19124
|
IconRound,
|
|
18974
19125
|
{
|
|
18975
19126
|
name: feature.icon,
|
|
@@ -18980,8 +19131,8 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18980
19131
|
]
|
|
18981
19132
|
}
|
|
18982
19133
|
),
|
|
18983
|
-
/* @__PURE__ */ (0,
|
|
18984
|
-
/* @__PURE__ */ (0,
|
|
19134
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
|
|
19135
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
18985
19136
|
Flex,
|
|
18986
19137
|
{
|
|
18987
19138
|
ref: (el) => {
|
|
@@ -18992,8 +19143,8 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18992
19143
|
$flexWrap: "wrap",
|
|
18993
19144
|
$gap: "1rem",
|
|
18994
19145
|
children: [
|
|
18995
|
-
feature?.name && /* @__PURE__ */ (0,
|
|
18996
|
-
/* @__PURE__ */ (0,
|
|
19146
|
+
feature?.name && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
|
|
19147
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18997
19148
|
Text,
|
|
18998
19149
|
{
|
|
18999
19150
|
as: Box,
|
|
@@ -19002,14 +19153,14 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
19002
19153
|
$weight: theme.typography[props.header.fontStyle].fontWeight,
|
|
19003
19154
|
$color: theme.typography[props.header.fontStyle].color,
|
|
19004
19155
|
$leading: 1.35,
|
|
19005
|
-
children: priceBehavior === "pay_as_you_go" ? typeof usage === "number" && /* @__PURE__ */ (0,
|
|
19156
|
+
children: priceBehavior === "pay_as_you_go" ? typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
19006
19157
|
formatNumber(usage),
|
|
19007
19158
|
" ",
|
|
19008
19159
|
getFeatureName(feature, usage)
|
|
19009
19160
|
] }) : feature.name
|
|
19010
19161
|
}
|
|
19011
19162
|
),
|
|
19012
|
-
props.description.isVisible && /* @__PURE__ */ (0,
|
|
19163
|
+
props.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
19013
19164
|
Text,
|
|
19014
19165
|
{
|
|
19015
19166
|
as: Box,
|
|
@@ -19021,14 +19172,14 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
19021
19172
|
}
|
|
19022
19173
|
)
|
|
19023
19174
|
] }),
|
|
19024
|
-
(feature?.featureType === "event" || feature?.featureType === "trait") && feature?.name && /* @__PURE__ */ (0,
|
|
19175
|
+
(feature?.featureType === "event" || feature?.featureType === "trait") && feature?.name && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
19025
19176
|
Box,
|
|
19026
19177
|
{
|
|
19027
19178
|
$flexBasis: "min-content",
|
|
19028
19179
|
$flexGrow: 1,
|
|
19029
19180
|
$textAlign: shouldWrapChildren ? "left" : "right",
|
|
19030
19181
|
children: [
|
|
19031
|
-
props.usage.isVisible && /* @__PURE__ */ (0,
|
|
19182
|
+
props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
19032
19183
|
Text,
|
|
19033
19184
|
{
|
|
19034
19185
|
as: Box,
|
|
@@ -19037,22 +19188,22 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
19037
19188
|
$weight: theme.typography[props.usage.fontStyle].fontWeight,
|
|
19038
19189
|
$color: theme.typography[props.usage.fontStyle].color,
|
|
19039
19190
|
$leading: 1.35,
|
|
19040
|
-
children: priceBehavior === "pay_in_advance" ? typeof allocation === "number" && /* @__PURE__ */ (0,
|
|
19191
|
+
children: priceBehavior === "pay_in_advance" ? typeof allocation === "number" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
19041
19192
|
formatNumber(allocation),
|
|
19042
19193
|
" ",
|
|
19043
19194
|
getFeatureName(feature, allocation)
|
|
19044
|
-
] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price, currency) : typeof usage === "number" && /* @__PURE__ */ (0,
|
|
19195
|
+
] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price, currency) : typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
19045
19196
|
formatNumber(usage),
|
|
19046
19197
|
" ",
|
|
19047
19198
|
getFeatureName(feature, usage),
|
|
19048
|
-
priceBehavior === "overage" && /* @__PURE__ */ (0,
|
|
19199
|
+
priceBehavior === "overage" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
19049
19200
|
" ",
|
|
19050
19201
|
t2("used")
|
|
19051
19202
|
] })
|
|
19052
19203
|
] })
|
|
19053
19204
|
}
|
|
19054
19205
|
),
|
|
19055
|
-
props.allocation.isVisible && priceBehavior !== "overage" && /* @__PURE__ */ (0,
|
|
19206
|
+
props.allocation.isVisible && priceBehavior !== "overage" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
19056
19207
|
Text,
|
|
19057
19208
|
{
|
|
19058
19209
|
$font: theme.typography[props.allocation.fontStyle].fontFamily,
|
|
@@ -19077,12 +19228,12 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
19077
19228
|
]
|
|
19078
19229
|
}
|
|
19079
19230
|
),
|
|
19080
|
-
props.isVisible && typeof usage === "number" && priceBehavior !== "pay_as_you_go" && /* @__PURE__ */ (0,
|
|
19081
|
-
typeof allocation === "number" ? /* @__PURE__ */ (0,
|
|
19231
|
+
props.isVisible && typeof usage === "number" && priceBehavior !== "pay_as_you_go" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Flex, { $gap: "2rem", children: [
|
|
19232
|
+
typeof allocation === "number" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
19082
19233
|
Tooltip,
|
|
19083
19234
|
{
|
|
19084
19235
|
trigger: progressBar,
|
|
19085
|
-
content: /* @__PURE__ */ (0,
|
|
19236
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
19086
19237
|
Text,
|
|
19087
19238
|
{
|
|
19088
19239
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19099,7 +19250,7 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
19099
19250
|
$flexGrow: 1
|
|
19100
19251
|
}
|
|
19101
19252
|
) : progressBar,
|
|
19102
|
-
priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0,
|
|
19253
|
+
priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
19103
19254
|
EmbedButton,
|
|
19104
19255
|
{
|
|
19105
19256
|
onClick: () => {
|
|
@@ -19123,11 +19274,11 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
19123
19274
|
MeteredFeatures.displayName = "MeteredFeatures";
|
|
19124
19275
|
|
|
19125
19276
|
// src/components/elements/payment-method/PaymentMethod.tsx
|
|
19126
|
-
var
|
|
19277
|
+
var import_react37 = require("react");
|
|
19127
19278
|
|
|
19128
19279
|
// src/components/elements/payment-method/PaymentMethodElement.tsx
|
|
19129
|
-
var
|
|
19130
|
-
var
|
|
19280
|
+
var import_react36 = require("react");
|
|
19281
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
19131
19282
|
var PaymentElement2 = ({
|
|
19132
19283
|
iconName,
|
|
19133
19284
|
iconTitle,
|
|
@@ -19136,17 +19287,17 @@ var PaymentElement2 = ({
|
|
|
19136
19287
|
paymentLast4
|
|
19137
19288
|
}) => {
|
|
19138
19289
|
const theme = nt();
|
|
19139
|
-
return /* @__PURE__ */ (0,
|
|
19140
|
-
iconName && /* @__PURE__ */ (0,
|
|
19141
|
-
/* @__PURE__ */ (0,
|
|
19142
|
-
/* @__PURE__ */ (0,
|
|
19143
|
-
paymentLast4 && /* @__PURE__ */ (0,
|
|
19290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text, { $font: theme.typography.text.fontFamily, $size: 16, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex, { $flexDirection: "row", $alignItems: "center", $gap: "0.5rem", children: [
|
|
19291
|
+
iconName && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Icon2, { name: iconName, title: iconTitle, style: iconStyles }) }),
|
|
19292
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex, { $alignItems: "center", children: [
|
|
19293
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { $lineHeight: "1", $marginRight: "4px", children: t(label) }),
|
|
19294
|
+
paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { $display: "inline-block", $fontWeight: "bold", children: paymentLast4 })
|
|
19144
19295
|
] })
|
|
19145
19296
|
] }) });
|
|
19146
19297
|
};
|
|
19147
19298
|
var EmptyPaymentElement = () => {
|
|
19148
19299
|
const theme = nt();
|
|
19149
|
-
return /* @__PURE__ */ (0,
|
|
19300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text, { $font: theme.typography.text.fontFamily, $size: 16, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Flex, { $flexDirection: "row", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { $lineHeight: "1", $marginRight: "4px", children: t("No payment method selected") }) }) }) });
|
|
19150
19301
|
};
|
|
19151
19302
|
var getPaymentMethodData = ({
|
|
19152
19303
|
accountLast4,
|
|
@@ -19235,9 +19386,9 @@ var PaymentMethodElement = ({
|
|
|
19235
19386
|
if (size === "md") {
|
|
19236
19387
|
sizeFactor = 1;
|
|
19237
19388
|
}
|
|
19238
|
-
return /* @__PURE__ */ (0,
|
|
19239
|
-
props.header.isVisible && /* @__PURE__ */ (0,
|
|
19240
|
-
/* @__PURE__ */ (0,
|
|
19389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
|
|
19390
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
|
|
19391
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19241
19392
|
Text,
|
|
19242
19393
|
{
|
|
19243
19394
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -19247,7 +19398,7 @@ var PaymentMethodElement = ({
|
|
|
19247
19398
|
children: t2("Payment Method")
|
|
19248
19399
|
}
|
|
19249
19400
|
),
|
|
19250
|
-
props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ (0,
|
|
19401
|
+
props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19251
19402
|
Text,
|
|
19252
19403
|
{
|
|
19253
19404
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19258,7 +19409,7 @@ var PaymentMethodElement = ({
|
|
|
19258
19409
|
}
|
|
19259
19410
|
)
|
|
19260
19411
|
] }),
|
|
19261
|
-
/* @__PURE__ */ (0,
|
|
19412
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19262
19413
|
Flex,
|
|
19263
19414
|
{
|
|
19264
19415
|
$justifyContent: "space-between",
|
|
@@ -19267,15 +19418,15 @@ var PaymentMethodElement = ({
|
|
|
19267
19418
|
$padding: `${sizeFactor / 2.2}rem ${sizeFactor}rem`,
|
|
19268
19419
|
$borderRadius: "9999px",
|
|
19269
19420
|
children: [
|
|
19270
|
-
paymentMethod && /* @__PURE__ */ (0,
|
|
19421
|
+
paymentMethod && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19271
19422
|
PaymentElement2,
|
|
19272
19423
|
{
|
|
19273
19424
|
...getPaymentMethodData(paymentMethod),
|
|
19274
19425
|
...getIconStyles({ size, theme })
|
|
19275
19426
|
}
|
|
19276
19427
|
),
|
|
19277
|
-
!paymentMethod && /* @__PURE__ */ (0,
|
|
19278
|
-
props.functions.allowEdit && onEdit && /* @__PURE__ */ (0,
|
|
19428
|
+
!paymentMethod && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(EmptyPaymentElement, {}),
|
|
19429
|
+
props.functions.allowEdit && onEdit && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19279
19430
|
Text,
|
|
19280
19431
|
{
|
|
19281
19432
|
onClick: onEdit,
|
|
@@ -19301,7 +19452,7 @@ var PaymentListElement = ({
|
|
|
19301
19452
|
const isLightBackground = useIsLightBackground();
|
|
19302
19453
|
const { iconName, iconTitle, label, paymentLast4 } = getPaymentMethodData(paymentMethod);
|
|
19303
19454
|
const iconStyles = getIconStyles({ size: "lg", theme });
|
|
19304
|
-
const expirationDate = (0,
|
|
19455
|
+
const expirationDate = (0, import_react36.useMemo)(() => {
|
|
19305
19456
|
const { cardExpMonth, cardExpYear } = paymentMethod;
|
|
19306
19457
|
if (!cardExpMonth && !cardExpYear) {
|
|
19307
19458
|
return "";
|
|
@@ -19315,7 +19466,7 @@ var PaymentListElement = ({
|
|
|
19315
19466
|
}
|
|
19316
19467
|
return `${cardExpMonth}/${formatedYear}`;
|
|
19317
19468
|
}, [paymentMethod]);
|
|
19318
|
-
return /* @__PURE__ */ (0,
|
|
19469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19319
19470
|
Flex,
|
|
19320
19471
|
{
|
|
19321
19472
|
$flexDirection: "row",
|
|
@@ -19329,8 +19480,8 @@ var PaymentListElement = ({
|
|
|
19329
19480
|
$font: theme.typography.text.fontFamily,
|
|
19330
19481
|
$color: theme.typography.text.color,
|
|
19331
19482
|
children: [
|
|
19332
|
-
/* @__PURE__ */ (0,
|
|
19333
|
-
/* @__PURE__ */ (0,
|
|
19483
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { $paddingLeft: "0.5rem", $paddingRight: "0.5rem", children: iconName && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Icon2, { name: iconName, title: iconTitle, style: iconStyles }) }),
|
|
19484
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { $flexGrow: "1", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19334
19485
|
Text,
|
|
19335
19486
|
{
|
|
19336
19487
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19344,12 +19495,12 @@ var PaymentListElement = ({
|
|
|
19344
19495
|
]
|
|
19345
19496
|
}
|
|
19346
19497
|
) }),
|
|
19347
|
-
/* @__PURE__ */ (0,
|
|
19498
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19348
19499
|
Box,
|
|
19349
19500
|
{
|
|
19350
19501
|
$flexGrow: "1",
|
|
19351
19502
|
$color: isLightBackground ? "hsla(0, 0%, 0%, 0.375)" : "hsla(0, 0%, 100%, 0.375)",
|
|
19352
|
-
children: /* @__PURE__ */ (0,
|
|
19503
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19353
19504
|
Text,
|
|
19354
19505
|
{
|
|
19355
19506
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19361,7 +19512,7 @@ var PaymentListElement = ({
|
|
|
19361
19512
|
)
|
|
19362
19513
|
}
|
|
19363
19514
|
),
|
|
19364
|
-
/* @__PURE__ */ (0,
|
|
19515
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19365
19516
|
Text,
|
|
19366
19517
|
{
|
|
19367
19518
|
onClick: () => {
|
|
@@ -19374,7 +19525,7 @@ var PaymentListElement = ({
|
|
|
19374
19525
|
children: t("Set default")
|
|
19375
19526
|
}
|
|
19376
19527
|
) }),
|
|
19377
|
-
/* @__PURE__ */ (0,
|
|
19528
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19378
19529
|
Box,
|
|
19379
19530
|
{
|
|
19380
19531
|
$cursor: "pointer",
|
|
@@ -19382,7 +19533,7 @@ var PaymentListElement = ({
|
|
|
19382
19533
|
onClick: () => {
|
|
19383
19534
|
handleDelete(paymentMethod.id);
|
|
19384
19535
|
},
|
|
19385
|
-
children: /* @__PURE__ */ (0,
|
|
19536
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19386
19537
|
Icon2,
|
|
19387
19538
|
{
|
|
19388
19539
|
name: "close",
|
|
@@ -19400,8 +19551,8 @@ var PaymentListElement = ({
|
|
|
19400
19551
|
};
|
|
19401
19552
|
|
|
19402
19553
|
// src/components/elements/payment-method/PaymentMethod.tsx
|
|
19403
|
-
var
|
|
19404
|
-
var
|
|
19554
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
19555
|
+
var resolveDesignProps5 = (props) => {
|
|
19405
19556
|
return {
|
|
19406
19557
|
header: {
|
|
19407
19558
|
isVisible: props.header?.isVisible ?? true,
|
|
@@ -19413,13 +19564,13 @@ var resolveDesignProps4 = (props) => {
|
|
|
19413
19564
|
}
|
|
19414
19565
|
};
|
|
19415
19566
|
};
|
|
19416
|
-
var PaymentMethod = (0,
|
|
19417
|
-
const props =
|
|
19567
|
+
var PaymentMethod = (0, import_react37.forwardRef)(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
|
|
19568
|
+
const props = resolveDesignProps5(rest);
|
|
19418
19569
|
const { data, setLayout } = useEmbed();
|
|
19419
|
-
const paymentMethod = (0,
|
|
19570
|
+
const paymentMethod = (0, import_react37.useMemo)(() => {
|
|
19420
19571
|
return data.subscription?.paymentMethod;
|
|
19421
19572
|
}, [data.subscription?.paymentMethod]);
|
|
19422
|
-
const monthsToExpiration = (0,
|
|
19573
|
+
const monthsToExpiration = (0, import_react37.useMemo)(() => {
|
|
19423
19574
|
let expiration;
|
|
19424
19575
|
if (typeof paymentMethod?.cardExpYear === "number" && typeof paymentMethod?.cardExpMonth === "number") {
|
|
19425
19576
|
const today = /* @__PURE__ */ new Date();
|
|
@@ -19432,7 +19583,7 @@ var PaymentMethod = (0, import_react36.forwardRef)(({ children, className, porta
|
|
|
19432
19583
|
}
|
|
19433
19584
|
return expiration;
|
|
19434
19585
|
}, [paymentMethod?.cardExpYear, paymentMethod?.cardExpMonth]);
|
|
19435
|
-
return /* @__PURE__ */ (0,
|
|
19586
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Element, { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
19436
19587
|
PaymentMethodElement,
|
|
19437
19588
|
{
|
|
19438
19589
|
paymentMethod,
|
|
@@ -19446,9 +19597,9 @@ PaymentMethod.displayName = "PaymentMethod";
|
|
|
19446
19597
|
|
|
19447
19598
|
// src/components/elements/payment-method/PaymentMethodDetails.tsx
|
|
19448
19599
|
var import_react_stripe_js2 = require("@stripe/react-stripe-js");
|
|
19449
|
-
var
|
|
19450
|
-
var
|
|
19451
|
-
var
|
|
19600
|
+
var import_react38 = require("react");
|
|
19601
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
19602
|
+
var resolveDesignProps6 = () => {
|
|
19452
19603
|
return {
|
|
19453
19604
|
header: {
|
|
19454
19605
|
isVisible: true,
|
|
@@ -19463,24 +19614,24 @@ var resolveDesignProps5 = () => {
|
|
|
19463
19614
|
var PaymentMethodDetails = ({
|
|
19464
19615
|
setPaymentMethodId
|
|
19465
19616
|
}) => {
|
|
19466
|
-
const props =
|
|
19617
|
+
const props = resolveDesignProps6();
|
|
19467
19618
|
const { t: t2 } = useTranslation();
|
|
19468
19619
|
const theme = nt();
|
|
19469
19620
|
const { api, data, setData } = useEmbed();
|
|
19470
19621
|
const isLightBackground = useIsLightBackground();
|
|
19471
|
-
const [isLoading, setIsLoading] = (0,
|
|
19472
|
-
const [error, setError] = (0,
|
|
19473
|
-
const [showPaymentForm, setShowPaymentForm] = (0,
|
|
19474
|
-
const [stripe, setStripe] = (0,
|
|
19475
|
-
const [setupIntent, setSetupIntent] = (0,
|
|
19476
|
-
const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = (0,
|
|
19477
|
-
const [paymentMethod, setPaymentMethod] = (0,
|
|
19478
|
-
(0,
|
|
19622
|
+
const [isLoading, setIsLoading] = (0, import_react38.useState)(false);
|
|
19623
|
+
const [error, setError] = (0, import_react38.useState)();
|
|
19624
|
+
const [showPaymentForm, setShowPaymentForm] = (0, import_react38.useState)(false);
|
|
19625
|
+
const [stripe, setStripe] = (0, import_react38.useState)(null);
|
|
19626
|
+
const [setupIntent, setSetupIntent] = (0, import_react38.useState)();
|
|
19627
|
+
const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = (0, import_react38.useState)(false);
|
|
19628
|
+
const [paymentMethod, setPaymentMethod] = (0, import_react38.useState)(void 0);
|
|
19629
|
+
(0, import_react38.useEffect)(() => {
|
|
19479
19630
|
if (data.subscription?.paymentMethod) {
|
|
19480
19631
|
setPaymentMethod(data.subscription.paymentMethod);
|
|
19481
19632
|
}
|
|
19482
19633
|
}, [data.subscription?.paymentMethod]);
|
|
19483
|
-
const monthsToExpiration = (0,
|
|
19634
|
+
const monthsToExpiration = (0, import_react38.useMemo)(() => {
|
|
19484
19635
|
let expiration;
|
|
19485
19636
|
if (typeof paymentMethod?.cardExpYear === "number" && typeof paymentMethod?.cardExpMonth === "number") {
|
|
19486
19637
|
const today = /* @__PURE__ */ new Date();
|
|
@@ -19493,12 +19644,12 @@ var PaymentMethodDetails = ({
|
|
|
19493
19644
|
}
|
|
19494
19645
|
return expiration;
|
|
19495
19646
|
}, [paymentMethod?.cardExpYear, paymentMethod?.cardExpMonth]);
|
|
19496
|
-
(0,
|
|
19647
|
+
(0, import_react38.useEffect)(() => {
|
|
19497
19648
|
if (!stripe && setupIntent?.publishableKey) {
|
|
19498
19649
|
setStripe(loadStripe(setupIntent.publishableKey));
|
|
19499
19650
|
}
|
|
19500
19651
|
}, [stripe, setupIntent?.publishableKey]);
|
|
19501
|
-
const createSetupIntent = (0,
|
|
19652
|
+
const createSetupIntent = (0, import_react38.useCallback)(async () => {
|
|
19502
19653
|
if (!api || !data.component?.id) {
|
|
19503
19654
|
return;
|
|
19504
19655
|
}
|
|
@@ -19517,10 +19668,10 @@ var PaymentMethodDetails = ({
|
|
|
19517
19668
|
setIsLoading(false);
|
|
19518
19669
|
}
|
|
19519
19670
|
}, [t2, api, data.component?.id]);
|
|
19520
|
-
const dropDownDifferentPaymentMethods = (0,
|
|
19671
|
+
const dropDownDifferentPaymentMethods = (0, import_react38.useCallback)(() => {
|
|
19521
19672
|
setShowDifferentPaymentMethods((state) => !state);
|
|
19522
19673
|
}, []);
|
|
19523
|
-
const updatePaymentMethod = (0,
|
|
19674
|
+
const updatePaymentMethod = (0, import_react38.useCallback)(
|
|
19524
19675
|
async (externalId) => {
|
|
19525
19676
|
if (!api || !externalId) {
|
|
19526
19677
|
return;
|
|
@@ -19553,7 +19704,7 @@ var PaymentMethodDetails = ({
|
|
|
19553
19704
|
},
|
|
19554
19705
|
[api, data, setData, setPaymentMethodId, t2]
|
|
19555
19706
|
);
|
|
19556
|
-
const deletePaymentMethod = (0,
|
|
19707
|
+
const deletePaymentMethod = (0, import_react38.useCallback)(
|
|
19557
19708
|
async (id) => {
|
|
19558
19709
|
if (!api || !id) {
|
|
19559
19710
|
return;
|
|
@@ -19580,8 +19731,8 @@ var PaymentMethodDetails = ({
|
|
|
19580
19731
|
},
|
|
19581
19732
|
[api, data, setData, t2]
|
|
19582
19733
|
);
|
|
19583
|
-
return /* @__PURE__ */ (0,
|
|
19584
|
-
isLoading && /* @__PURE__ */ (0,
|
|
19734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Flex, { $position: "relative", children: [
|
|
19735
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
19585
19736
|
Flex,
|
|
19586
19737
|
{
|
|
19587
19738
|
$position: "absolute",
|
|
@@ -19593,10 +19744,10 @@ var PaymentMethodDetails = ({
|
|
|
19593
19744
|
$zIndex: 1,
|
|
19594
19745
|
$backgroundColor: "black",
|
|
19595
19746
|
$opacity: 0.5,
|
|
19596
|
-
children: /* @__PURE__ */ (0,
|
|
19747
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Loader, { $color: theme.primary, $size: "2xl" })
|
|
19597
19748
|
}
|
|
19598
19749
|
),
|
|
19599
|
-
/* @__PURE__ */ (0,
|
|
19750
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
19600
19751
|
Flex,
|
|
19601
19752
|
{
|
|
19602
19753
|
$flexDirection: "column",
|
|
@@ -19606,7 +19757,7 @@ var PaymentMethodDetails = ({
|
|
|
19606
19757
|
$backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.025)" : "hsla(0, 0%, 100%, 0.025)",
|
|
19607
19758
|
$overflow: "auto",
|
|
19608
19759
|
children: [
|
|
19609
|
-
showPaymentForm ? /* @__PURE__ */ (0,
|
|
19760
|
+
showPaymentForm ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
19610
19761
|
import_react_stripe_js2.Elements,
|
|
19611
19762
|
{
|
|
19612
19763
|
stripe,
|
|
@@ -19635,7 +19786,7 @@ var PaymentMethodDetails = ({
|
|
|
19635
19786
|
},
|
|
19636
19787
|
clientSecret: setupIntent?.setupIntentClientSecret
|
|
19637
19788
|
},
|
|
19638
|
-
children: /* @__PURE__ */ (0,
|
|
19789
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
19639
19790
|
PaymentForm,
|
|
19640
19791
|
{
|
|
19641
19792
|
onConfirm: async (paymentMethodId) => {
|
|
@@ -19646,8 +19797,8 @@ var PaymentMethodDetails = ({
|
|
|
19646
19797
|
}
|
|
19647
19798
|
)
|
|
19648
19799
|
}
|
|
19649
|
-
) : /* @__PURE__ */ (0,
|
|
19650
|
-
/* @__PURE__ */ (0,
|
|
19800
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", children: [
|
|
19801
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
19651
19802
|
PaymentMethodElement,
|
|
19652
19803
|
{
|
|
19653
19804
|
size: "lg",
|
|
@@ -19656,7 +19807,7 @@ var PaymentMethodDetails = ({
|
|
|
19656
19807
|
...props
|
|
19657
19808
|
}
|
|
19658
19809
|
),
|
|
19659
|
-
(data.company?.paymentMethods || []).length > 0 && /* @__PURE__ */ (0,
|
|
19810
|
+
(data.company?.paymentMethods || []).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
19660
19811
|
Text,
|
|
19661
19812
|
{
|
|
19662
19813
|
onClick: dropDownDifferentPaymentMethods,
|
|
@@ -19666,7 +19817,7 @@ var PaymentMethodDetails = ({
|
|
|
19666
19817
|
$color: theme.typography.link.color,
|
|
19667
19818
|
children: [
|
|
19668
19819
|
t2("Choose different payment method"),
|
|
19669
|
-
/* @__PURE__ */ (0,
|
|
19820
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
19670
19821
|
Icon2,
|
|
19671
19822
|
{
|
|
19672
19823
|
name: "chevron-down",
|
|
@@ -19682,9 +19833,9 @@ var PaymentMethodDetails = ({
|
|
|
19682
19833
|
]
|
|
19683
19834
|
}
|
|
19684
19835
|
) }),
|
|
19685
|
-
showDifferentPaymentMethods && /* @__PURE__ */ (0,
|
|
19836
|
+
showDifferentPaymentMethods && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Flex, { $flexDirection: "column", $overflowY: "hidden", $height: "10rem", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Flex, { $flexDirection: "column", $overflowY: "scroll", children: (data.company?.paymentMethods.filter(
|
|
19686
19837
|
(pm) => pm.id !== paymentMethod?.id
|
|
19687
|
-
) || []).map((paymentMethod2) => /* @__PURE__ */ (0,
|
|
19838
|
+
) || []).map((paymentMethod2) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
19688
19839
|
PaymentListElement,
|
|
19689
19840
|
{
|
|
19690
19841
|
paymentMethod: paymentMethod2,
|
|
@@ -19693,9 +19844,9 @@ var PaymentMethodDetails = ({
|
|
|
19693
19844
|
},
|
|
19694
19845
|
paymentMethod2.id
|
|
19695
19846
|
)) }) }),
|
|
19696
|
-
(!paymentMethod || showDifferentPaymentMethods) && /* @__PURE__ */ (0,
|
|
19847
|
+
(!paymentMethod || showDifferentPaymentMethods) && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(EmbedButton, { onClick: createSetupIntent, size: "lg", children: t2("Add new payment method") })
|
|
19697
19848
|
] }),
|
|
19698
|
-
!isLoading && error && /* @__PURE__ */ (0,
|
|
19849
|
+
!isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
19699
19850
|
Text,
|
|
19700
19851
|
{
|
|
19701
19852
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19712,9 +19863,9 @@ var PaymentMethodDetails = ({
|
|
|
19712
19863
|
};
|
|
19713
19864
|
|
|
19714
19865
|
// src/components/elements/plan-manager/PlanManager.tsx
|
|
19715
|
-
var
|
|
19716
|
-
var
|
|
19717
|
-
var
|
|
19866
|
+
var import_react39 = require("react");
|
|
19867
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
19868
|
+
var resolveDesignProps7 = (props) => {
|
|
19718
19869
|
return {
|
|
19719
19870
|
header: {
|
|
19720
19871
|
isVisible: props.header?.isVisible ?? true,
|
|
@@ -19742,8 +19893,8 @@ var resolveDesignProps6 = (props) => {
|
|
|
19742
19893
|
}
|
|
19743
19894
|
};
|
|
19744
19895
|
};
|
|
19745
|
-
var PlanManager = (0,
|
|
19746
|
-
const props =
|
|
19896
|
+
var PlanManager = (0, import_react39.forwardRef)(({ children, className, portal, ...rest }, ref) => {
|
|
19897
|
+
const props = resolveDesignProps7(rest);
|
|
19747
19898
|
const theme = nt();
|
|
19748
19899
|
const { t: t2 } = useTranslation();
|
|
19749
19900
|
const { data, setLayout, setSelected } = useEmbed();
|
|
@@ -19768,7 +19919,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19768
19919
|
[]
|
|
19769
19920
|
);
|
|
19770
19921
|
const billingSubscription = data.company?.billingSubscription;
|
|
19771
|
-
const trialEndDays = (0,
|
|
19922
|
+
const trialEndDays = (0, import_react39.useMemo)(() => {
|
|
19772
19923
|
const trialEnd = billingSubscription?.trialEnd;
|
|
19773
19924
|
const trialEndDate = trialEnd ? new Date(trialEnd * 1e3) : /* @__PURE__ */ new Date();
|
|
19774
19925
|
const todayDate = /* @__PURE__ */ new Date();
|
|
@@ -19781,8 +19932,8 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19781
19932
|
const willSubscriptionCancel = billingSubscription?.cancelAtPeriodEnd;
|
|
19782
19933
|
const isUsageBasedPlan = currentPlan?.planPrice === 0 && usageBasedEntitlements.length > 0;
|
|
19783
19934
|
const headerPriceFontStyle = isUsageBasedPlan ? theme.typography.heading3 : theme.typography[props.header.price.fontStyle];
|
|
19784
|
-
return /* @__PURE__ */ (0,
|
|
19785
|
-
isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ (0,
|
|
19935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
19936
|
+
isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19786
19937
|
Notice,
|
|
19787
19938
|
{
|
|
19788
19939
|
as: Flex,
|
|
@@ -19792,7 +19943,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19792
19943
|
$textAlign: "center",
|
|
19793
19944
|
$backgroundColor: isLightBackground ? darken(theme.card.background, 0.04) : lighten(theme.card.background, 0.04),
|
|
19794
19945
|
children: [
|
|
19795
|
-
/* @__PURE__ */ (0,
|
|
19946
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19796
19947
|
Text,
|
|
19797
19948
|
{
|
|
19798
19949
|
as: "h3",
|
|
@@ -19803,7 +19954,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19803
19954
|
children: t2("Trial ends in", { days: trialEndDays.toString() })
|
|
19804
19955
|
}
|
|
19805
19956
|
),
|
|
19806
|
-
/* @__PURE__ */ (0,
|
|
19957
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19807
19958
|
Text,
|
|
19808
19959
|
{
|
|
19809
19960
|
as: "p",
|
|
@@ -19820,7 +19971,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19820
19971
|
)
|
|
19821
19972
|
]
|
|
19822
19973
|
}
|
|
19823
|
-
) : willSubscriptionCancel && /* @__PURE__ */ (0,
|
|
19974
|
+
) : willSubscriptionCancel && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19824
19975
|
Notice,
|
|
19825
19976
|
{
|
|
19826
19977
|
as: Flex,
|
|
@@ -19830,7 +19981,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19830
19981
|
$textAlign: "center",
|
|
19831
19982
|
$backgroundColor: isLightBackground ? darken(theme.card.background, 0.04) : lighten(theme.card.background, 0.04),
|
|
19832
19983
|
children: [
|
|
19833
|
-
/* @__PURE__ */ (0,
|
|
19984
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19834
19985
|
Text,
|
|
19835
19986
|
{
|
|
19836
19987
|
as: "h3",
|
|
@@ -19841,7 +19992,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19841
19992
|
children: t2("Subscription canceled")
|
|
19842
19993
|
}
|
|
19843
19994
|
),
|
|
19844
|
-
billingSubscription?.cancelAt && /* @__PURE__ */ (0,
|
|
19995
|
+
billingSubscription?.cancelAt && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19845
19996
|
Text,
|
|
19846
19997
|
{
|
|
19847
19998
|
as: "p",
|
|
@@ -19862,7 +20013,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19862
20013
|
]
|
|
19863
20014
|
}
|
|
19864
20015
|
),
|
|
19865
|
-
/* @__PURE__ */ (0,
|
|
20016
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19866
20017
|
Element,
|
|
19867
20018
|
{
|
|
19868
20019
|
as: Flex,
|
|
@@ -19871,7 +20022,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19871
20022
|
$flexDirection: "column",
|
|
19872
20023
|
$gap: "2rem",
|
|
19873
20024
|
children: [
|
|
19874
|
-
props.header.isVisible && currentPlan && /* @__PURE__ */ (0,
|
|
20025
|
+
props.header.isVisible && currentPlan && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19875
20026
|
Flex,
|
|
19876
20027
|
{
|
|
19877
20028
|
$justifyContent: "space-between",
|
|
@@ -19879,8 +20030,8 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19879
20030
|
$flexWrap: "wrap",
|
|
19880
20031
|
$gap: "1rem",
|
|
19881
20032
|
children: [
|
|
19882
|
-
/* @__PURE__ */ (0,
|
|
19883
|
-
/* @__PURE__ */ (0,
|
|
20033
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
20034
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19884
20035
|
Text,
|
|
19885
20036
|
{
|
|
19886
20037
|
as: Box,
|
|
@@ -19892,7 +20043,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19892
20043
|
children: currentPlan.name
|
|
19893
20044
|
}
|
|
19894
20045
|
),
|
|
19895
|
-
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0,
|
|
20046
|
+
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19896
20047
|
Text,
|
|
19897
20048
|
{
|
|
19898
20049
|
as: Box,
|
|
@@ -19904,8 +20055,8 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19904
20055
|
}
|
|
19905
20056
|
)
|
|
19906
20057
|
] }),
|
|
19907
|
-
props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ (0,
|
|
19908
|
-
/* @__PURE__ */ (0,
|
|
20058
|
+
props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Box, { children: [
|
|
20059
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19909
20060
|
Text,
|
|
19910
20061
|
{
|
|
19911
20062
|
$font: headerPriceFontStyle.fontFamily,
|
|
@@ -19918,14 +20069,14 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19918
20069
|
)
|
|
19919
20070
|
}
|
|
19920
20071
|
),
|
|
19921
|
-
!isUsageBasedPlan && /* @__PURE__ */ (0,
|
|
20072
|
+
!isUsageBasedPlan && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19922
20073
|
Text,
|
|
19923
20074
|
{
|
|
19924
20075
|
$font: theme.typography[props.header.price.fontStyle].fontFamily,
|
|
19925
20076
|
$size: theme.typography[props.header.price.fontStyle].fontSize,
|
|
19926
20077
|
$weight: theme.typography[props.header.price.fontStyle].fontWeight,
|
|
19927
20078
|
$color: theme.typography[props.header.price.fontStyle].color,
|
|
19928
|
-
children: /* @__PURE__ */ (0,
|
|
20079
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("sub", { children: [
|
|
19929
20080
|
"/",
|
|
19930
20081
|
shortenPeriod(currentPlan.planPeriod)
|
|
19931
20082
|
] })
|
|
@@ -19935,8 +20086,8 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19935
20086
|
]
|
|
19936
20087
|
}
|
|
19937
20088
|
),
|
|
19938
|
-
props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0,
|
|
19939
|
-
props.addOns.showLabel && /* @__PURE__ */ (0,
|
|
20089
|
+
props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
20090
|
+
props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19940
20091
|
Text,
|
|
19941
20092
|
{
|
|
19942
20093
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19947,7 +20098,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19947
20098
|
children: t2("Add-ons")
|
|
19948
20099
|
}
|
|
19949
20100
|
),
|
|
19950
|
-
addOns.map((addOn, addOnIndex) => /* @__PURE__ */ (0,
|
|
20101
|
+
addOns.map((addOn, addOnIndex) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19951
20102
|
Flex,
|
|
19952
20103
|
{
|
|
19953
20104
|
$justifyContent: "space-between",
|
|
@@ -19955,7 +20106,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19955
20106
|
$flexWrap: "wrap",
|
|
19956
20107
|
$gap: "1rem",
|
|
19957
20108
|
children: [
|
|
19958
|
-
/* @__PURE__ */ (0,
|
|
20109
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19959
20110
|
Text,
|
|
19960
20111
|
{
|
|
19961
20112
|
$font: theme.typography[props.addOns.fontStyle].fontFamily,
|
|
@@ -19965,7 +20116,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19965
20116
|
children: addOn.name
|
|
19966
20117
|
}
|
|
19967
20118
|
),
|
|
19968
|
-
addOn.planPrice && addOn.planPeriod && /* @__PURE__ */ (0,
|
|
20119
|
+
addOn.planPrice && addOn.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19969
20120
|
Text,
|
|
19970
20121
|
{
|
|
19971
20122
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19974,7 +20125,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19974
20125
|
$color: theme.typography.text.color,
|
|
19975
20126
|
children: [
|
|
19976
20127
|
formatCurrency(addOn.planPrice, subscriptionCurrency),
|
|
19977
|
-
/* @__PURE__ */ (0,
|
|
20128
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("sub", { children: [
|
|
19978
20129
|
"/",
|
|
19979
20130
|
shortenPeriod(addOn.planPeriod)
|
|
19980
20131
|
] })
|
|
@@ -19986,8 +20137,8 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19986
20137
|
addOnIndex
|
|
19987
20138
|
))
|
|
19988
20139
|
] }),
|
|
19989
|
-
usageBasedEntitlements.length > 0 && /* @__PURE__ */ (0,
|
|
19990
|
-
/* @__PURE__ */ (0,
|
|
20140
|
+
usageBasedEntitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
20141
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19991
20142
|
Text,
|
|
19992
20143
|
{
|
|
19993
20144
|
$font: theme.typography.text.fontFamily,
|
|
@@ -20005,7 +20156,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
20005
20156
|
const amount = overageAmount || entitlement.allocation || 0;
|
|
20006
20157
|
if (entitlement.feature?.name) {
|
|
20007
20158
|
acc.push(
|
|
20008
|
-
/* @__PURE__ */ (0,
|
|
20159
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
20009
20160
|
Flex,
|
|
20010
20161
|
{
|
|
20011
20162
|
$justifyContent: "space-between",
|
|
@@ -20013,7 +20164,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
20013
20164
|
$flexWrap: "wrap",
|
|
20014
20165
|
$gap: "1rem",
|
|
20015
20166
|
children: [
|
|
20016
|
-
/* @__PURE__ */ (0,
|
|
20167
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
20017
20168
|
Text,
|
|
20018
20169
|
{
|
|
20019
20170
|
$font: theme.typography[props.addOns.fontStyle].fontFamily,
|
|
@@ -20021,20 +20172,20 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
20021
20172
|
$weight: theme.typography[props.addOns.fontStyle].fontWeight,
|
|
20022
20173
|
$color: theme.typography[props.addOns.fontStyle].color,
|
|
20023
20174
|
children: [
|
|
20024
|
-
entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "overage" && limit > 0 ? /* @__PURE__ */ (0,
|
|
20175
|
+
entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "overage" && limit > 0 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
20025
20176
|
limit,
|
|
20026
20177
|
" ",
|
|
20027
20178
|
getFeatureName(entitlement.feature, limit)
|
|
20028
20179
|
] }) : entitlement.feature.name,
|
|
20029
|
-
entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && currentPlan?.planPeriod && /* @__PURE__ */ (0,
|
|
20180
|
+
entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && currentPlan?.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
20030
20181
|
"/",
|
|
20031
20182
|
shortenPeriod(currentPlan.planPeriod)
|
|
20032
20183
|
] })
|
|
20033
20184
|
]
|
|
20034
20185
|
}
|
|
20035
20186
|
),
|
|
20036
|
-
/* @__PURE__ */ (0,
|
|
20037
|
-
entitlement.priceBehavior === "overage" && currentPlan?.planPeriod ? /* @__PURE__ */ (0,
|
|
20187
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Flex, { $alignItems: "center", $gap: "1rem", children: [
|
|
20188
|
+
entitlement.priceBehavior === "overage" && currentPlan?.planPeriod ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
20038
20189
|
Text,
|
|
20039
20190
|
{
|
|
20040
20191
|
$font: theme.typography.text.fontFamily,
|
|
@@ -20043,7 +20194,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
20043
20194
|
$color: hexToHSL(theme.typography.text.color).l > 50 ? darken(theme.typography.text.color, 0.46) : lighten(theme.typography.text.color, 0.46),
|
|
20044
20195
|
children: typeof overageAmount === "number" && overageAmount > 0 ? t2("X over the limit", {
|
|
20045
20196
|
amount: overageAmount
|
|
20046
|
-
}) : /* @__PURE__ */ (0,
|
|
20197
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
20047
20198
|
t2("Overage fee"),
|
|
20048
20199
|
":",
|
|
20049
20200
|
" ",
|
|
@@ -20051,17 +20202,17 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
20051
20202
|
entitlement.price ?? 0,
|
|
20052
20203
|
entitlement.currency
|
|
20053
20204
|
),
|
|
20054
|
-
/* @__PURE__ */ (0,
|
|
20205
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("sub", { children: [
|
|
20055
20206
|
"/",
|
|
20056
20207
|
getFeatureName(entitlement.feature, 1),
|
|
20057
|
-
entitlement.feature.featureType === "trait" && /* @__PURE__ */ (0,
|
|
20208
|
+
entitlement.feature.featureType === "trait" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
20058
20209
|
"/",
|
|
20059
20210
|
shortenPeriod(currentPlan.planPeriod)
|
|
20060
20211
|
] })
|
|
20061
20212
|
] })
|
|
20062
20213
|
] })
|
|
20063
20214
|
}
|
|
20064
|
-
) : entitlement.priceBehavior === "pay_in_advance" && currentPlan?.planPeriod && /* @__PURE__ */ (0,
|
|
20215
|
+
) : entitlement.priceBehavior === "pay_in_advance" && currentPlan?.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
20065
20216
|
Text,
|
|
20066
20217
|
{
|
|
20067
20218
|
$font: theme.typography.text.fontFamily,
|
|
@@ -20073,7 +20224,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
20073
20224
|
entitlement.price ?? 0,
|
|
20074
20225
|
entitlement.currency
|
|
20075
20226
|
),
|
|
20076
|
-
/* @__PURE__ */ (0,
|
|
20227
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("sub", { children: [
|
|
20077
20228
|
"/",
|
|
20078
20229
|
getFeatureName(entitlement.feature, 1),
|
|
20079
20230
|
"/",
|
|
@@ -20082,7 +20233,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
20082
20233
|
]
|
|
20083
20234
|
}
|
|
20084
20235
|
),
|
|
20085
|
-
amount > 0 && /* @__PURE__ */ (0,
|
|
20236
|
+
amount > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
20086
20237
|
Text,
|
|
20087
20238
|
{
|
|
20088
20239
|
$font: theme.typography.text.fontFamily,
|
|
@@ -20094,7 +20245,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
20094
20245
|
(entitlement.price ?? 0) * amount,
|
|
20095
20246
|
entitlement.currency
|
|
20096
20247
|
),
|
|
20097
|
-
(entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior !== "overage") && /* @__PURE__ */ (0,
|
|
20248
|
+
(entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior !== "overage") && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("sub", { children: [
|
|
20098
20249
|
"/",
|
|
20099
20250
|
currentPlan?.planPeriod && entitlement.priceBehavior === "pay_in_advance" ? shortenPeriod(currentPlan.planPeriod) : getFeatureName(entitlement.feature, 1)
|
|
20100
20251
|
] })
|
|
@@ -20113,7 +20264,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
20113
20264
|
[]
|
|
20114
20265
|
)
|
|
20115
20266
|
] }),
|
|
20116
|
-
canCheckout && props.callToAction.isVisible && /* @__PURE__ */ (0,
|
|
20267
|
+
canCheckout && props.callToAction.isVisible && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
20117
20268
|
EmbedButton,
|
|
20118
20269
|
{
|
|
20119
20270
|
type: "button",
|
|
@@ -20138,9 +20289,9 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
20138
20289
|
PlanManager.displayName = "PlanManager";
|
|
20139
20290
|
|
|
20140
20291
|
// src/components/elements/pricing-table/PricingTable.tsx
|
|
20141
|
-
var
|
|
20142
|
-
var
|
|
20143
|
-
var
|
|
20292
|
+
var import_react40 = require("react");
|
|
20293
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
20294
|
+
var resolveDesignProps8 = (props) => {
|
|
20144
20295
|
return {
|
|
20145
20296
|
showPeriodToggle: props.showPeriodToggle ?? true,
|
|
20146
20297
|
showDiscount: props.showDiscount ?? true,
|
|
@@ -20179,18 +20330,18 @@ var resolveDesignProps7 = (props) => {
|
|
|
20179
20330
|
}
|
|
20180
20331
|
};
|
|
20181
20332
|
};
|
|
20182
|
-
var PricingTable = (0,
|
|
20183
|
-
const props =
|
|
20333
|
+
var PricingTable = (0, import_react40.forwardRef)(({ children, className, ...rest }, ref) => {
|
|
20334
|
+
const props = resolveDesignProps8(rest);
|
|
20184
20335
|
const { t: t2 } = useTranslation();
|
|
20185
20336
|
const theme = nt();
|
|
20186
20337
|
const { data, setLayout, setSelected } = useEmbed();
|
|
20187
20338
|
const trialEndDays = useTrialEnd();
|
|
20188
|
-
const [selectedPeriod, setSelectedPeriod] = (0,
|
|
20339
|
+
const [selectedPeriod, setSelectedPeriod] = (0, import_react40.useState)(
|
|
20189
20340
|
() => data.company?.plan?.planPeriod || "month"
|
|
20190
20341
|
);
|
|
20191
20342
|
const { plans, addOns, periods } = useAvailablePlans(selectedPeriod);
|
|
20192
20343
|
const isLightBackground = useIsLightBackground();
|
|
20193
|
-
const [entitlementCounts, setEntitlementCounts] = (0,
|
|
20344
|
+
const [entitlementCounts, setEntitlementCounts] = (0, import_react40.useState)(
|
|
20194
20345
|
() => plans.reduce(
|
|
20195
20346
|
(acc, plan) => {
|
|
20196
20347
|
acc[plan.id] = {
|
|
@@ -20217,7 +20368,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20217
20368
|
};
|
|
20218
20369
|
});
|
|
20219
20370
|
};
|
|
20220
|
-
return /* @__PURE__ */ (0,
|
|
20371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20221
20372
|
FussyChild,
|
|
20222
20373
|
{
|
|
20223
20374
|
ref,
|
|
@@ -20226,8 +20377,8 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20226
20377
|
$flexDirection: "column",
|
|
20227
20378
|
$gap: "2rem",
|
|
20228
20379
|
children: [
|
|
20229
|
-
/* @__PURE__ */ (0,
|
|
20230
|
-
/* @__PURE__ */ (0,
|
|
20380
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Box, { children: [
|
|
20381
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20231
20382
|
Flex,
|
|
20232
20383
|
{
|
|
20233
20384
|
$flexDirection: "column",
|
|
@@ -20242,7 +20393,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20242
20393
|
}
|
|
20243
20394
|
},
|
|
20244
20395
|
children: [
|
|
20245
|
-
/* @__PURE__ */ (0,
|
|
20396
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20246
20397
|
Text,
|
|
20247
20398
|
{
|
|
20248
20399
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -20252,7 +20403,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20252
20403
|
children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && t2("Plans")
|
|
20253
20404
|
}
|
|
20254
20405
|
),
|
|
20255
|
-
props.showPeriodToggle && /* @__PURE__ */ (0,
|
|
20406
|
+
props.showPeriodToggle && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20256
20407
|
PeriodToggle,
|
|
20257
20408
|
{
|
|
20258
20409
|
options: periods,
|
|
@@ -20263,7 +20414,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20263
20414
|
]
|
|
20264
20415
|
}
|
|
20265
20416
|
),
|
|
20266
|
-
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0,
|
|
20417
|
+
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20267
20418
|
Box,
|
|
20268
20419
|
{
|
|
20269
20420
|
$display: "grid",
|
|
@@ -20281,7 +20432,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20281
20432
|
);
|
|
20282
20433
|
const isUsageBasedPlan = planPrice === 0 && hasUsageBasedEntitlements;
|
|
20283
20434
|
const headerPriceFontStyle = plan.custom || isUsageBasedPlan ? theme.typography.heading3 : theme.typography[props.plans.name.fontStyle];
|
|
20284
|
-
return /* @__PURE__ */ (0,
|
|
20435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20285
20436
|
Flex,
|
|
20286
20437
|
{
|
|
20287
20438
|
$position: "relative",
|
|
@@ -20294,7 +20445,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20294
20445
|
$outlineColor: isActivePlan ? theme.primary : "transparent",
|
|
20295
20446
|
...theme.card.hasShadow && { $boxShadow: cardBoxShadow },
|
|
20296
20447
|
children: [
|
|
20297
|
-
/* @__PURE__ */ (0,
|
|
20448
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20298
20449
|
Flex,
|
|
20299
20450
|
{
|
|
20300
20451
|
$flexDirection: "column",
|
|
@@ -20305,7 +20456,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20305
20456
|
$borderStyle: "solid",
|
|
20306
20457
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
|
20307
20458
|
children: [
|
|
20308
|
-
/* @__PURE__ */ (0,
|
|
20459
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20309
20460
|
Text,
|
|
20310
20461
|
{
|
|
20311
20462
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -20315,7 +20466,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20315
20466
|
children: plan.name
|
|
20316
20467
|
}
|
|
20317
20468
|
) }),
|
|
20318
|
-
props.plans.description.isVisible && /* @__PURE__ */ (0,
|
|
20469
|
+
props.plans.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20319
20470
|
Text,
|
|
20320
20471
|
{
|
|
20321
20472
|
$font: theme.typography[props.plans.description.fontStyle].fontFamily,
|
|
@@ -20325,8 +20476,8 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20325
20476
|
children: plan.description
|
|
20326
20477
|
}
|
|
20327
20478
|
) }),
|
|
20328
|
-
/* @__PURE__ */ (0,
|
|
20329
|
-
/* @__PURE__ */ (0,
|
|
20479
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Box, { children: [
|
|
20480
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20330
20481
|
Text,
|
|
20331
20482
|
{
|
|
20332
20483
|
$font: headerPriceFontStyle.fontFamily,
|
|
@@ -20336,7 +20487,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20336
20487
|
children: plan.custom ? plan.customPlanConfig?.priceText ? plan.customPlanConfig.priceText : t2("Custom price") : isUsageBasedPlan ? t2("Usage-based") : formatCurrency(planPrice ?? 0, planCurrency)
|
|
20337
20488
|
}
|
|
20338
20489
|
),
|
|
20339
|
-
!plan.custom && !isUsageBasedPlan && /* @__PURE__ */ (0,
|
|
20490
|
+
!plan.custom && !isUsageBasedPlan && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20340
20491
|
Text,
|
|
20341
20492
|
{
|
|
20342
20493
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -20350,7 +20501,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20350
20501
|
}
|
|
20351
20502
|
)
|
|
20352
20503
|
] }),
|
|
20353
|
-
isActivePlan && /* @__PURE__ */ (0,
|
|
20504
|
+
isActivePlan && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20354
20505
|
Flex,
|
|
20355
20506
|
{
|
|
20356
20507
|
$position: "absolute",
|
|
@@ -20359,7 +20510,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20359
20510
|
$backgroundColor: theme.primary,
|
|
20360
20511
|
$borderRadius: "9999px",
|
|
20361
20512
|
$padding: "0.125rem 0.85rem",
|
|
20362
|
-
children: /* @__PURE__ */ (0,
|
|
20513
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20363
20514
|
Text,
|
|
20364
20515
|
{
|
|
20365
20516
|
$font: theme.typography.text.fontFamily,
|
|
@@ -20374,7 +20525,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20374
20525
|
]
|
|
20375
20526
|
}
|
|
20376
20527
|
),
|
|
20377
|
-
/* @__PURE__ */ (0,
|
|
20528
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20378
20529
|
Flex,
|
|
20379
20530
|
{
|
|
20380
20531
|
$flexDirection: "column",
|
|
@@ -20383,8 +20534,8 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20383
20534
|
$gap: `${cardPadding}rem`,
|
|
20384
20535
|
$padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
|
|
20385
20536
|
children: [
|
|
20386
|
-
props.plans.showEntitlements && /* @__PURE__ */ (0,
|
|
20387
|
-
props.plans.showInclusionText && planIndex > 0 && /* @__PURE__ */ (0,
|
|
20537
|
+
props.plans.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: 1, children: [
|
|
20538
|
+
props.plans.showInclusionText && planIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20388
20539
|
Text,
|
|
20389
20540
|
{
|
|
20390
20541
|
$font: theme.typography.text.fontFamily,
|
|
@@ -20409,8 +20560,8 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20409
20560
|
return acc;
|
|
20410
20561
|
}
|
|
20411
20562
|
acc.push(
|
|
20412
|
-
/* @__PURE__ */ (0,
|
|
20413
|
-
props.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0,
|
|
20563
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Flex, { $gap: "1rem", children: [
|
|
20564
|
+
props.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20414
20565
|
IconRound,
|
|
20415
20566
|
{
|
|
20416
20567
|
name: entitlement.feature.icon,
|
|
@@ -20421,14 +20572,14 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20421
20572
|
]
|
|
20422
20573
|
}
|
|
20423
20574
|
),
|
|
20424
|
-
entitlement.feature?.name && /* @__PURE__ */ (0,
|
|
20575
|
+
entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20425
20576
|
Flex,
|
|
20426
20577
|
{
|
|
20427
20578
|
$flexDirection: "column",
|
|
20428
20579
|
$justifyContent: "center",
|
|
20429
20580
|
$gap: "0.5rem",
|
|
20430
20581
|
children: [
|
|
20431
|
-
/* @__PURE__ */ (0,
|
|
20582
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20432
20583
|
Text,
|
|
20433
20584
|
{
|
|
20434
20585
|
$font: theme.typography.text.fontFamily,
|
|
@@ -20436,7 +20587,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20436
20587
|
$weight: theme.typography.text.fontWeight,
|
|
20437
20588
|
$color: theme.typography.text.color,
|
|
20438
20589
|
$leading: 1.35,
|
|
20439
|
-
children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "pay_as_you_go") ? /* @__PURE__ */ (0,
|
|
20590
|
+
children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "pay_as_you_go") ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
20440
20591
|
formatCurrency(
|
|
20441
20592
|
entitlementPrice,
|
|
20442
20593
|
entitlementCurrency
|
|
@@ -20448,18 +20599,18 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20448
20599
|
entitlement.feature,
|
|
20449
20600
|
1
|
|
20450
20601
|
),
|
|
20451
|
-
entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0,
|
|
20602
|
+
entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
20452
20603
|
" ",
|
|
20453
20604
|
t2("per"),
|
|
20454
20605
|
" ",
|
|
20455
20606
|
selectedPeriod
|
|
20456
20607
|
] })
|
|
20457
|
-
] }) : entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ (0,
|
|
20608
|
+
] }) : entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
20458
20609
|
entitlement.valueType === "unlimited" && !entitlement.priceBehavior ? t2("Unlimited", {
|
|
20459
20610
|
item: getFeatureName(
|
|
20460
20611
|
entitlement.feature
|
|
20461
20612
|
)
|
|
20462
|
-
}) : typeof limit === "number" && /* @__PURE__ */ (0,
|
|
20613
|
+
}) : typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
20463
20614
|
formatNumber(limit),
|
|
20464
20615
|
" ",
|
|
20465
20616
|
getFeatureName(
|
|
@@ -20467,7 +20618,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20467
20618
|
limit
|
|
20468
20619
|
)
|
|
20469
20620
|
] }),
|
|
20470
|
-
entitlement.metricPeriod && entitlement.priceBehavior !== "overage" ? /* @__PURE__ */ (0,
|
|
20621
|
+
entitlement.metricPeriod && entitlement.priceBehavior !== "overage" ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
20471
20622
|
" ",
|
|
20472
20623
|
t2("per"),
|
|
20473
20624
|
" ",
|
|
@@ -20477,7 +20628,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20477
20628
|
current_month: "month",
|
|
20478
20629
|
current_year: "year"
|
|
20479
20630
|
}[entitlement.metricPeriod]
|
|
20480
|
-
] }) : entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && /* @__PURE__ */ (0,
|
|
20631
|
+
] }) : entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
20481
20632
|
"/",
|
|
20482
20633
|
shortenPeriod(
|
|
20483
20634
|
selectedPeriod
|
|
@@ -20486,7 +20637,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20486
20637
|
] }) : entitlement.feature.name
|
|
20487
20638
|
}
|
|
20488
20639
|
),
|
|
20489
|
-
entitlement.priceBehavior === "overage" && typeof entitlementPrice === "number" && /* @__PURE__ */ (0,
|
|
20640
|
+
entitlement.priceBehavior === "overage" && typeof entitlementPrice === "number" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20490
20641
|
Text,
|
|
20491
20642
|
{
|
|
20492
20643
|
$font: theme.typography.text.fontFamily,
|
|
@@ -20512,7 +20663,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20512
20663
|
entitlement.feature,
|
|
20513
20664
|
1
|
|
20514
20665
|
),
|
|
20515
|
-
entitlement.feature.featureType === "trait" && /* @__PURE__ */ (0,
|
|
20666
|
+
entitlement.feature.featureType === "trait" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
20516
20667
|
"/",
|
|
20517
20668
|
shortenPeriod(selectedPeriod)
|
|
20518
20669
|
] }),
|
|
@@ -20530,14 +20681,14 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20530
20681
|
},
|
|
20531
20682
|
[]
|
|
20532
20683
|
).slice(0, count?.limit ?? VISIBLE_ENTITLEMENT_COUNT),
|
|
20533
|
-
(count?.size || plan.entitlements.length) > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ (0,
|
|
20684
|
+
(count?.size || plan.entitlements.length) > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20534
20685
|
Flex,
|
|
20535
20686
|
{
|
|
20536
20687
|
$alignItems: "center",
|
|
20537
20688
|
$justifyContent: "start",
|
|
20538
20689
|
$marginTop: "1rem",
|
|
20539
20690
|
children: [
|
|
20540
|
-
/* @__PURE__ */ (0,
|
|
20691
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20541
20692
|
Icon2,
|
|
20542
20693
|
{
|
|
20543
20694
|
name: isExpanded ? "chevron-up" : "chevron-down",
|
|
@@ -20549,7 +20700,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20549
20700
|
}
|
|
20550
20701
|
}
|
|
20551
20702
|
),
|
|
20552
|
-
/* @__PURE__ */ (0,
|
|
20703
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20553
20704
|
Text,
|
|
20554
20705
|
{
|
|
20555
20706
|
onClick: () => handleToggleShowAll(plan.id),
|
|
@@ -20566,7 +20717,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20566
20717
|
}
|
|
20567
20718
|
)
|
|
20568
20719
|
] }),
|
|
20569
|
-
isActivePlan ? /* @__PURE__ */ (0,
|
|
20720
|
+
isActivePlan ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20570
20721
|
Flex,
|
|
20571
20722
|
{
|
|
20572
20723
|
$justifyContent: "center",
|
|
@@ -20574,7 +20725,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20574
20725
|
$gap: "0.25rem",
|
|
20575
20726
|
$padding: "0.625rem 0",
|
|
20576
20727
|
children: [
|
|
20577
|
-
/* @__PURE__ */ (0,
|
|
20728
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20578
20729
|
Icon2,
|
|
20579
20730
|
{
|
|
20580
20731
|
name: "check-rounded",
|
|
@@ -20585,7 +20736,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20585
20736
|
}
|
|
20586
20737
|
}
|
|
20587
20738
|
),
|
|
20588
|
-
/* @__PURE__ */ (0,
|
|
20739
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20589
20740
|
Text,
|
|
20590
20741
|
{
|
|
20591
20742
|
$font: theme.typography.text.fontFamily,
|
|
@@ -20598,7 +20749,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20598
20749
|
)
|
|
20599
20750
|
]
|
|
20600
20751
|
}
|
|
20601
|
-
) : (props.upgrade.isVisible || props.downgrade.isVisible) && /* @__PURE__ */ (0,
|
|
20752
|
+
) : (props.upgrade.isVisible || props.downgrade.isVisible) && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20602
20753
|
EmbedButton,
|
|
20603
20754
|
{
|
|
20604
20755
|
type: "button",
|
|
@@ -20622,14 +20773,14 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20622
20773
|
$color: props.downgrade.buttonStyle,
|
|
20623
20774
|
$variant: "outline"
|
|
20624
20775
|
},
|
|
20625
|
-
children: plan.custom ? /* @__PURE__ */ (0,
|
|
20776
|
+
children: plan.custom ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20626
20777
|
ButtonLink,
|
|
20627
20778
|
{
|
|
20628
20779
|
href: plan.customPlanConfig?.ctaWebSite ?? "#",
|
|
20629
20780
|
target: "_blank",
|
|
20630
20781
|
children: plan.customPlanConfig?.ctaText ?? t2("Talk to support")
|
|
20631
20782
|
}
|
|
20632
|
-
) : !plan.valid ? /* @__PURE__ */ (0,
|
|
20783
|
+
) : !plan.valid ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20633
20784
|
Tooltip,
|
|
20634
20785
|
{
|
|
20635
20786
|
trigger: t2("Over usage limit"),
|
|
@@ -20651,14 +20802,14 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20651
20802
|
}
|
|
20652
20803
|
)
|
|
20653
20804
|
] }),
|
|
20654
|
-
/* @__PURE__ */ (0,
|
|
20655
|
-
props.header.isVisible && /* @__PURE__ */ (0,
|
|
20805
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
20806
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20656
20807
|
Flex,
|
|
20657
20808
|
{
|
|
20658
20809
|
$justifyContent: "space-between",
|
|
20659
20810
|
$alignItems: "center",
|
|
20660
20811
|
$marginBottom: "1rem",
|
|
20661
|
-
children: /* @__PURE__ */ (0,
|
|
20812
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20662
20813
|
Text,
|
|
20663
20814
|
{
|
|
20664
20815
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -20670,7 +20821,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20670
20821
|
)
|
|
20671
20822
|
}
|
|
20672
20823
|
),
|
|
20673
|
-
/* @__PURE__ */ (0,
|
|
20824
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20674
20825
|
Box,
|
|
20675
20826
|
{
|
|
20676
20827
|
$display: "grid",
|
|
@@ -20681,7 +20832,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20681
20832
|
const { price: addOnPrice, currency: addOnCurrency } = getBillingPrice(
|
|
20682
20833
|
selectedPeriod === "year" ? addOn.yearlyPrice : addOn.monthlyPrice
|
|
20683
20834
|
) || {};
|
|
20684
|
-
return /* @__PURE__ */ (0,
|
|
20835
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20685
20836
|
Flex,
|
|
20686
20837
|
{
|
|
20687
20838
|
$position: "relative",
|
|
@@ -20695,8 +20846,8 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20695
20846
|
$outlineColor: isActiveAddOn ? theme.primary : "transparent",
|
|
20696
20847
|
...theme.card.hasShadow && { $boxShadow: cardBoxShadow },
|
|
20697
20848
|
children: [
|
|
20698
|
-
/* @__PURE__ */ (0,
|
|
20699
|
-
/* @__PURE__ */ (0,
|
|
20849
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
|
|
20850
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20700
20851
|
Text,
|
|
20701
20852
|
{
|
|
20702
20853
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -20706,7 +20857,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20706
20857
|
children: addOn.name
|
|
20707
20858
|
}
|
|
20708
20859
|
) }),
|
|
20709
|
-
props.addOns.showDescription && /* @__PURE__ */ (0,
|
|
20860
|
+
props.addOns.showDescription && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20710
20861
|
Text,
|
|
20711
20862
|
{
|
|
20712
20863
|
$font: theme.typography[props.plans.description.fontStyle].fontFamily,
|
|
@@ -20716,8 +20867,8 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20716
20867
|
children: addOn.description
|
|
20717
20868
|
}
|
|
20718
20869
|
) }),
|
|
20719
|
-
/* @__PURE__ */ (0,
|
|
20720
|
-
/* @__PURE__ */ (0,
|
|
20870
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Box, { children: [
|
|
20871
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20721
20872
|
Text,
|
|
20722
20873
|
{
|
|
20723
20874
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -20727,7 +20878,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20727
20878
|
children: formatCurrency(addOnPrice ?? 0, addOnCurrency)
|
|
20728
20879
|
}
|
|
20729
20880
|
),
|
|
20730
|
-
/* @__PURE__ */ (0,
|
|
20881
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20731
20882
|
Text,
|
|
20732
20883
|
{
|
|
20733
20884
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -20741,7 +20892,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20741
20892
|
}
|
|
20742
20893
|
)
|
|
20743
20894
|
] }),
|
|
20744
|
-
isActiveAddOn && /* @__PURE__ */ (0,
|
|
20895
|
+
isActiveAddOn && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20745
20896
|
Flex,
|
|
20746
20897
|
{
|
|
20747
20898
|
$position: "absolute",
|
|
@@ -20750,7 +20901,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20750
20901
|
$backgroundColor: theme.primary,
|
|
20751
20902
|
$borderRadius: "9999px",
|
|
20752
20903
|
$padding: "0.125rem 0.85rem",
|
|
20753
|
-
children: /* @__PURE__ */ (0,
|
|
20904
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20754
20905
|
Text,
|
|
20755
20906
|
{
|
|
20756
20907
|
$font: theme.typography.text.fontFamily,
|
|
@@ -20763,7 +20914,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20763
20914
|
}
|
|
20764
20915
|
)
|
|
20765
20916
|
] }),
|
|
20766
|
-
/* @__PURE__ */ (0,
|
|
20917
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20767
20918
|
Flex,
|
|
20768
20919
|
{
|
|
20769
20920
|
$flexDirection: "column",
|
|
@@ -20771,7 +20922,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20771
20922
|
$gap: `${cardPadding}rem`,
|
|
20772
20923
|
$flexGrow: 1,
|
|
20773
20924
|
children: [
|
|
20774
|
-
props.addOns.showEntitlements && /* @__PURE__ */ (0,
|
|
20925
|
+
props.addOns.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20775
20926
|
Flex,
|
|
20776
20927
|
{
|
|
20777
20928
|
$flexDirection: "column",
|
|
@@ -20780,15 +20931,15 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20780
20931
|
$flexGrow: 1,
|
|
20781
20932
|
children: addOn.entitlements.map(
|
|
20782
20933
|
(entitlement, entitlementIndex) => {
|
|
20783
|
-
return /* @__PURE__ */ (0,
|
|
20934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20784
20935
|
Flex,
|
|
20785
20936
|
{
|
|
20786
20937
|
$flexWrap: "wrap",
|
|
20787
20938
|
$justifyContent: "space-between",
|
|
20788
20939
|
$alignItems: "center",
|
|
20789
20940
|
$gap: "1rem",
|
|
20790
|
-
children: /* @__PURE__ */ (0,
|
|
20791
|
-
props.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0,
|
|
20941
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Flex, { $gap: "1rem", children: [
|
|
20942
|
+
props.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20792
20943
|
IconRound,
|
|
20793
20944
|
{
|
|
20794
20945
|
name: entitlement.feature.icon,
|
|
@@ -20799,19 +20950,19 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20799
20950
|
]
|
|
20800
20951
|
}
|
|
20801
20952
|
),
|
|
20802
|
-
entitlement.feature?.name && /* @__PURE__ */ (0,
|
|
20953
|
+
entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20803
20954
|
Text,
|
|
20804
20955
|
{
|
|
20805
20956
|
$font: theme.typography.text.fontFamily,
|
|
20806
20957
|
$size: theme.typography.text.fontSize,
|
|
20807
20958
|
$weight: theme.typography.text.fontWeight,
|
|
20808
20959
|
$color: theme.typography.text.color,
|
|
20809
|
-
children: entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ (0,
|
|
20960
|
+
children: entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
20810
20961
|
entitlement.valueType === "unlimited" ? t2("Unlimited", {
|
|
20811
20962
|
item: getFeatureName(
|
|
20812
20963
|
entitlement.feature
|
|
20813
20964
|
)
|
|
20814
|
-
}) : typeof entitlement.valueNumeric === "number" && /* @__PURE__ */ (0,
|
|
20965
|
+
}) : typeof entitlement.valueNumeric === "number" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
20815
20966
|
formatNumber(
|
|
20816
20967
|
entitlement.valueNumeric
|
|
20817
20968
|
),
|
|
@@ -20821,7 +20972,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20821
20972
|
entitlement.valueNumeric
|
|
20822
20973
|
)
|
|
20823
20974
|
] }),
|
|
20824
|
-
entitlement.metricPeriod && /* @__PURE__ */ (0,
|
|
20975
|
+
entitlement.metricPeriod && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
20825
20976
|
" ",
|
|
20826
20977
|
t2("per"),
|
|
20827
20978
|
" ",
|
|
@@ -20843,7 +20994,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20843
20994
|
)
|
|
20844
20995
|
}
|
|
20845
20996
|
),
|
|
20846
|
-
props.upgrade.isVisible && /* @__PURE__ */ (0,
|
|
20997
|
+
props.upgrade.isVisible && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20847
20998
|
EmbedButton,
|
|
20848
20999
|
{
|
|
20849
21000
|
type: "button",
|
|
@@ -20879,10 +21030,39 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20879
21030
|
});
|
|
20880
21031
|
PricingTable.displayName = "PricingTable";
|
|
20881
21032
|
|
|
21033
|
+
// src/components/elements/text/Text.tsx
|
|
21034
|
+
var import_react41 = require("react");
|
|
21035
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
21036
|
+
var resolveDesignProps9 = (props) => {
|
|
21037
|
+
return {
|
|
21038
|
+
text: {
|
|
21039
|
+
fontStyle: props.text?.fontStyle ?? "text",
|
|
21040
|
+
alignment: props.text?.alignment ?? "left",
|
|
21041
|
+
textContent: props.text?.textContent ?? "Text"
|
|
21042
|
+
}
|
|
21043
|
+
};
|
|
21044
|
+
};
|
|
21045
|
+
var TextElement = (0, import_react41.forwardRef)(({ children, className, ...rest }, ref) => {
|
|
21046
|
+
const props = resolveDesignProps9(rest);
|
|
21047
|
+
const theme = nt();
|
|
21048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Element, { as: Flex, ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
21049
|
+
Text,
|
|
21050
|
+
{
|
|
21051
|
+
$font: theme.typography[props.text.fontStyle].fontFamily,
|
|
21052
|
+
$size: theme.typography[props.text.fontStyle].fontSize,
|
|
21053
|
+
$weight: theme.typography[props.text.fontStyle].fontWeight,
|
|
21054
|
+
$color: theme.typography[props.text.fontStyle].color,
|
|
21055
|
+
$align: props.text.alignment,
|
|
21056
|
+
children: props.text.textContent
|
|
21057
|
+
}
|
|
21058
|
+
) });
|
|
21059
|
+
});
|
|
21060
|
+
TextElement.displayName = "Text";
|
|
21061
|
+
|
|
20882
21062
|
// src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
|
|
20883
|
-
var
|
|
20884
|
-
var
|
|
20885
|
-
var
|
|
21063
|
+
var import_react42 = require("react");
|
|
21064
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
21065
|
+
var resolveDesignProps10 = (props) => {
|
|
20886
21066
|
return {
|
|
20887
21067
|
button: {
|
|
20888
21068
|
text: props.button?.text ?? "Unsubscribe",
|
|
@@ -20893,8 +21073,8 @@ var resolveDesignProps8 = (props) => {
|
|
|
20893
21073
|
}
|
|
20894
21074
|
};
|
|
20895
21075
|
};
|
|
20896
|
-
var UnsubscribeButton = (0,
|
|
20897
|
-
const props =
|
|
21076
|
+
var UnsubscribeButton = (0, import_react42.forwardRef)(({ children, className, ...rest }, ref) => {
|
|
21077
|
+
const props = resolveDesignProps10(rest);
|
|
20898
21078
|
const { t: t2 } = useTranslation();
|
|
20899
21079
|
const { data, setLayout } = useEmbed();
|
|
20900
21080
|
const disabled = !data.subscription || data.subscription.status === "cancelled" || data.subscription.cancelAtPeriodEnd;
|
|
@@ -20912,7 +21092,7 @@ var UnsubscribeButton = (0, import_react40.forwardRef)(({ children, className, .
|
|
|
20912
21092
|
variant: "text"
|
|
20913
21093
|
}
|
|
20914
21094
|
};
|
|
20915
|
-
return /* @__PURE__ */ (0,
|
|
21095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
20916
21096
|
Element,
|
|
20917
21097
|
{
|
|
20918
21098
|
as: Flex,
|
|
@@ -20920,7 +21100,7 @@ var UnsubscribeButton = (0, import_react40.forwardRef)(({ children, className, .
|
|
|
20920
21100
|
className,
|
|
20921
21101
|
$flexDirection: "column",
|
|
20922
21102
|
$gap: "2rem",
|
|
20923
|
-
children: /* @__PURE__ */ (0,
|
|
21103
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
20924
21104
|
EmbedButton,
|
|
20925
21105
|
{
|
|
20926
21106
|
$size: props.button.size,
|
|
@@ -20941,9 +21121,9 @@ var UnsubscribeButton = (0, import_react40.forwardRef)(({ children, className, .
|
|
|
20941
21121
|
UnsubscribeButton.displayName = "UnsubscribeButton";
|
|
20942
21122
|
|
|
20943
21123
|
// src/components/elements/upcoming-bill/UpcomingBill.tsx
|
|
20944
|
-
var
|
|
20945
|
-
var
|
|
20946
|
-
function
|
|
21124
|
+
var import_react43 = require("react");
|
|
21125
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
21126
|
+
function resolveDesignProps11(props) {
|
|
20947
21127
|
return {
|
|
20948
21128
|
header: {
|
|
20949
21129
|
isVisible: props.header?.isVisible ?? true,
|
|
@@ -20961,13 +21141,13 @@ function resolveDesignProps9(props) {
|
|
|
20961
21141
|
}
|
|
20962
21142
|
};
|
|
20963
21143
|
}
|
|
20964
|
-
var UpcomingBill = (0,
|
|
20965
|
-
const props =
|
|
21144
|
+
var UpcomingBill = (0, import_react43.forwardRef)(({ className, ...rest }, ref) => {
|
|
21145
|
+
const props = resolveDesignProps11(rest);
|
|
20966
21146
|
const { t: t2 } = useTranslation();
|
|
20967
21147
|
const theme = nt();
|
|
20968
21148
|
const { data } = useEmbed();
|
|
20969
21149
|
const isLightBackground = useIsLightBackground();
|
|
20970
|
-
const { upcomingInvoice, discounts } = (0,
|
|
21150
|
+
const { upcomingInvoice, discounts } = (0, import_react43.useMemo)(() => {
|
|
20971
21151
|
const discounts2 = (data.subscription?.discounts || []).map((discount) => ({
|
|
20972
21152
|
amountOff: discount.amountOff,
|
|
20973
21153
|
couponId: discount.couponId,
|
|
@@ -20994,7 +21174,7 @@ var UpcomingBill = (0, import_react41.forwardRef)(({ className, ...rest }, ref)
|
|
|
20994
21174
|
if (typeof upcomingInvoice.amountDue !== "number" || !upcomingInvoice.dueDate) {
|
|
20995
21175
|
return null;
|
|
20996
21176
|
}
|
|
20997
|
-
return /* @__PURE__ */ (0,
|
|
21177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
20998
21178
|
Element,
|
|
20999
21179
|
{
|
|
21000
21180
|
as: Flex,
|
|
@@ -21003,7 +21183,7 @@ var UpcomingBill = (0, import_react41.forwardRef)(({ className, ...rest }, ref)
|
|
|
21003
21183
|
$flexDirection: "column",
|
|
21004
21184
|
$gap: "1rem",
|
|
21005
21185
|
children: [
|
|
21006
|
-
props.header.isVisible && /* @__PURE__ */ (0,
|
|
21186
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
21007
21187
|
Text,
|
|
21008
21188
|
{
|
|
21009
21189
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -21017,8 +21197,8 @@ var UpcomingBill = (0, import_react41.forwardRef)(({ className, ...rest }, ref)
|
|
|
21017
21197
|
]
|
|
21018
21198
|
}
|
|
21019
21199
|
) }),
|
|
21020
|
-
/* @__PURE__ */ (0,
|
|
21021
|
-
props.price.isVisible && /* @__PURE__ */ (0,
|
|
21200
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "start", $gap: "1rem", children: [
|
|
21201
|
+
props.price.isVisible && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Flex, { $alignItems: "end", $flexGrow: "1", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
21022
21202
|
Text,
|
|
21023
21203
|
{
|
|
21024
21204
|
$font: theme.typography[props.price.fontStyle].fontFamily,
|
|
@@ -21032,7 +21212,7 @@ var UpcomingBill = (0, import_react41.forwardRef)(({ className, ...rest }, ref)
|
|
|
21032
21212
|
)
|
|
21033
21213
|
}
|
|
21034
21214
|
) }),
|
|
21035
|
-
/* @__PURE__ */ (0,
|
|
21215
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { $lineHeight: 1.15, $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
21036
21216
|
Text,
|
|
21037
21217
|
{
|
|
21038
21218
|
$font: theme.typography[props.contractEndDate.fontStyle].fontFamily,
|
|
@@ -21044,8 +21224,8 @@ var UpcomingBill = (0, import_react41.forwardRef)(({ className, ...rest }, ref)
|
|
|
21044
21224
|
}
|
|
21045
21225
|
) })
|
|
21046
21226
|
] }),
|
|
21047
|
-
discounts.length > 0 && /* @__PURE__ */ (0,
|
|
21048
|
-
/* @__PURE__ */ (0,
|
|
21227
|
+
discounts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
|
|
21228
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
21049
21229
|
Text,
|
|
21050
21230
|
{
|
|
21051
21231
|
$font: theme.typography.text.fontFamily,
|
|
@@ -21055,8 +21235,8 @@ var UpcomingBill = (0, import_react41.forwardRef)(({ className, ...rest }, ref)
|
|
|
21055
21235
|
children: t2("Discount")
|
|
21056
21236
|
}
|
|
21057
21237
|
) }),
|
|
21058
|
-
/* @__PURE__ */ (0,
|
|
21059
|
-
/* @__PURE__ */ (0,
|
|
21238
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { children: discounts.map((discount) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
|
|
21239
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
21060
21240
|
Flex,
|
|
21061
21241
|
{
|
|
21062
21242
|
$alignItems: "center",
|
|
@@ -21065,7 +21245,7 @@ var UpcomingBill = (0, import_react41.forwardRef)(({ className, ...rest }, ref)
|
|
|
21065
21245
|
$borderStyle: "solid",
|
|
21066
21246
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
|
|
21067
21247
|
$borderRadius: "0.3125rem",
|
|
21068
|
-
children: /* @__PURE__ */ (0,
|
|
21248
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
21069
21249
|
Text,
|
|
21070
21250
|
{
|
|
21071
21251
|
$font: theme.typography.text.fontFamily,
|
|
@@ -21077,7 +21257,7 @@ var UpcomingBill = (0, import_react41.forwardRef)(({ className, ...rest }, ref)
|
|
|
21077
21257
|
)
|
|
21078
21258
|
}
|
|
21079
21259
|
),
|
|
21080
|
-
/* @__PURE__ */ (0,
|
|
21260
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
21081
21261
|
Text,
|
|
21082
21262
|
{
|
|
21083
21263
|
$font: theme.typography.text.fontFamily,
|
|
@@ -21096,10 +21276,10 @@ var UpcomingBill = (0, import_react41.forwardRef)(({ className, ...rest }, ref)
|
|
|
21096
21276
|
UpcomingBill.displayName = "UpcomingBill";
|
|
21097
21277
|
|
|
21098
21278
|
// src/components/embed/ComponentTree.tsx
|
|
21099
|
-
var
|
|
21279
|
+
var import_react45 = require("react");
|
|
21100
21280
|
|
|
21101
21281
|
// src/components/embed/renderer.ts
|
|
21102
|
-
var
|
|
21282
|
+
var import_react44 = require("react");
|
|
21103
21283
|
var components = {
|
|
21104
21284
|
Root,
|
|
21105
21285
|
Viewport,
|
|
@@ -21112,7 +21292,8 @@ var components = {
|
|
|
21112
21292
|
PaymentMethod,
|
|
21113
21293
|
Invoices,
|
|
21114
21294
|
PricingTable,
|
|
21115
|
-
UnsubscribeButton
|
|
21295
|
+
UnsubscribeButton,
|
|
21296
|
+
ButtonElement
|
|
21116
21297
|
};
|
|
21117
21298
|
function createRenderer(options) {
|
|
21118
21299
|
const { useFallback = false } = options || {};
|
|
@@ -21132,7 +21313,7 @@ function createRenderer(options) {
|
|
|
21132
21313
|
const { className, ...rest } = props;
|
|
21133
21314
|
const resolvedProps = component === "div" ? rest : props;
|
|
21134
21315
|
const resolvedChildren = children.map(renderNode);
|
|
21135
|
-
return (0,
|
|
21316
|
+
return (0, import_react44.createElement)(
|
|
21136
21317
|
component,
|
|
21137
21318
|
{
|
|
21138
21319
|
key: index,
|
|
@@ -21145,10 +21326,10 @@ function createRenderer(options) {
|
|
|
21145
21326
|
}
|
|
21146
21327
|
|
|
21147
21328
|
// src/components/embed/ComponentTree.tsx
|
|
21148
|
-
var
|
|
21329
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
21149
21330
|
var Loading = () => {
|
|
21150
21331
|
const theme = nt();
|
|
21151
|
-
return /* @__PURE__ */ (0,
|
|
21332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
21152
21333
|
Flex,
|
|
21153
21334
|
{
|
|
21154
21335
|
$width: "100%",
|
|
@@ -21156,13 +21337,13 @@ var Loading = () => {
|
|
|
21156
21337
|
$alignItems: "center",
|
|
21157
21338
|
$justifyContent: "center",
|
|
21158
21339
|
$padding: `${theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
21159
|
-
children: /* @__PURE__ */ (0,
|
|
21340
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Loader, { $color: "#194BFB", $size: "2xl" })
|
|
21160
21341
|
}
|
|
21161
21342
|
);
|
|
21162
21343
|
};
|
|
21163
21344
|
var Error2 = ({ message }) => {
|
|
21164
21345
|
const theme = nt();
|
|
21165
|
-
return /* @__PURE__ */ (0,
|
|
21346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
21166
21347
|
Flex,
|
|
21167
21348
|
{
|
|
21168
21349
|
$flexDirection: "column",
|
|
@@ -21173,7 +21354,7 @@ var Error2 = ({ message }) => {
|
|
|
21173
21354
|
$alignItems: "center",
|
|
21174
21355
|
$justifyContent: "center",
|
|
21175
21356
|
children: [
|
|
21176
|
-
/* @__PURE__ */ (0,
|
|
21357
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
21177
21358
|
Box,
|
|
21178
21359
|
{
|
|
21179
21360
|
$marginBottom: `${8 / TEXT_BASE_SIZE}rem`,
|
|
@@ -21184,7 +21365,7 @@ var Error2 = ({ message }) => {
|
|
|
21184
21365
|
children: "Error"
|
|
21185
21366
|
}
|
|
21186
21367
|
),
|
|
21187
|
-
/* @__PURE__ */ (0,
|
|
21368
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
21188
21369
|
Box,
|
|
21189
21370
|
{
|
|
21190
21371
|
$marginBottom: `${8 / TEXT_BASE_SIZE}rem`,
|
|
@@ -21201,23 +21382,23 @@ var Error2 = ({ message }) => {
|
|
|
21201
21382
|
};
|
|
21202
21383
|
var ComponentTree = () => {
|
|
21203
21384
|
const { error, nodes, isPending } = useEmbed();
|
|
21204
|
-
const [children, setChildren] = (0,
|
|
21205
|
-
(0,
|
|
21385
|
+
const [children, setChildren] = (0, import_react45.useState)(/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Loading, {}));
|
|
21386
|
+
(0, import_react45.useEffect)(() => {
|
|
21206
21387
|
const renderer = createRenderer();
|
|
21207
21388
|
setChildren(nodes.map(renderer));
|
|
21208
21389
|
}, [nodes]);
|
|
21209
21390
|
if (error) {
|
|
21210
21391
|
console.error(error);
|
|
21211
|
-
return /* @__PURE__ */ (0,
|
|
21392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Error2, { message: error.message });
|
|
21212
21393
|
}
|
|
21213
21394
|
if (isPending) {
|
|
21214
|
-
return /* @__PURE__ */ (0,
|
|
21395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Loading, {});
|
|
21215
21396
|
}
|
|
21216
|
-
return /* @__PURE__ */ (0,
|
|
21397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, { children });
|
|
21217
21398
|
};
|
|
21218
21399
|
|
|
21219
21400
|
// src/components/embed/Embed.tsx
|
|
21220
|
-
var
|
|
21401
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
21221
21402
|
var SchematicEmbed = ({
|
|
21222
21403
|
id,
|
|
21223
21404
|
accessToken,
|
|
@@ -21225,19 +21406,19 @@ var SchematicEmbed = ({
|
|
|
21225
21406
|
debug
|
|
21226
21407
|
}) => {
|
|
21227
21408
|
if (accessToken?.length === 0) {
|
|
21228
|
-
return /* @__PURE__ */ (0,
|
|
21409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { children: "Please provide an access token." });
|
|
21229
21410
|
}
|
|
21230
21411
|
if (!accessToken?.startsWith("token_")) {
|
|
21231
|
-
return /* @__PURE__ */ (0,
|
|
21412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { children: 'Invalid access token; your temporary access token will start with "token_".' });
|
|
21232
21413
|
}
|
|
21233
|
-
return /* @__PURE__ */ (0,
|
|
21414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
21234
21415
|
EmbedProvider,
|
|
21235
21416
|
{
|
|
21236
21417
|
id,
|
|
21237
21418
|
accessToken,
|
|
21238
21419
|
apiConfig,
|
|
21239
21420
|
debug,
|
|
21240
|
-
children: /* @__PURE__ */ (0,
|
|
21421
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ComponentTree, {})
|
|
21241
21422
|
}
|
|
21242
21423
|
);
|
|
21243
21424
|
};
|