@schematichq/schematic-components 0.7.0 → 0.7.3
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 +1195 -990
- package/dist/schematic-components.d.ts +328 -914
- package/dist/schematic-components.esm.js +996 -791
- package/package.json +4 -4
|
@@ -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,
|
|
@@ -2275,6 +2276,7 @@ __export(index_exports, {
|
|
|
2275
2276
|
MeteredFeatures: () => MeteredFeatures,
|
|
2276
2277
|
Modal: () => Modal,
|
|
2277
2278
|
ModalHeader: () => ModalHeader,
|
|
2279
|
+
Notice: () => Notice,
|
|
2278
2280
|
PaymentMethod: () => PaymentMethod,
|
|
2279
2281
|
PaymentMethodDetails: () => PaymentMethodDetails,
|
|
2280
2282
|
PlanManager: () => PlanManager,
|
|
@@ -2284,6 +2286,7 @@ __export(index_exports, {
|
|
|
2284
2286
|
SchematicEmbed: () => SchematicEmbed,
|
|
2285
2287
|
StyledCard: () => StyledCard,
|
|
2286
2288
|
Text: () => Text,
|
|
2289
|
+
TextElement: () => TextElement,
|
|
2287
2290
|
TextPropNames: () => TextPropNames,
|
|
2288
2291
|
Tooltip: () => Tooltip,
|
|
2289
2292
|
UnsubscribeButton: () => UnsubscribeButton,
|
|
@@ -2302,280 +2305,11 @@ __export(index_exports, {
|
|
|
2302
2305
|
});
|
|
2303
2306
|
module.exports = __toCommonJS(index_exports);
|
|
2304
2307
|
|
|
2305
|
-
// src/components/elements/
|
|
2306
|
-
var
|
|
2307
|
-
|
|
2308
|
-
// node_modules/react-i18next/dist/es/Trans.js
|
|
2309
|
-
var import_react3 = require("react");
|
|
2310
|
-
|
|
2311
|
-
// node_modules/react-i18next/dist/es/TransWithoutContext.js
|
|
2312
|
-
var import_react = require("react");
|
|
2313
|
-
|
|
2314
|
-
// node_modules/html-parse-stringify/dist/html-parse-stringify.module.js
|
|
2315
|
-
var import_void_elements = __toESM(require_void_elements());
|
|
2316
|
-
|
|
2317
|
-
// node_modules/react-i18next/dist/es/utils.js
|
|
2318
|
-
var warn = (i18n, code, msg, rest) => {
|
|
2319
|
-
const args = [msg, {
|
|
2320
|
-
code,
|
|
2321
|
-
...rest || {}
|
|
2322
|
-
}];
|
|
2323
|
-
if (i18n?.services?.logger?.forward) {
|
|
2324
|
-
return i18n.services.logger.forward(args, "warn", "react-i18next::", true);
|
|
2325
|
-
}
|
|
2326
|
-
if (isString(args[0])) args[0] = `react-i18next:: ${args[0]}`;
|
|
2327
|
-
if (i18n?.services?.logger?.warn) {
|
|
2328
|
-
i18n.services.logger.warn(...args);
|
|
2329
|
-
} else if (console?.warn) {
|
|
2330
|
-
console.warn(...args);
|
|
2331
|
-
}
|
|
2332
|
-
};
|
|
2333
|
-
var alreadyWarned = {};
|
|
2334
|
-
var warnOnce = (i18n, code, msg, rest) => {
|
|
2335
|
-
if (isString(msg) && alreadyWarned[msg]) return;
|
|
2336
|
-
if (isString(msg)) alreadyWarned[msg] = /* @__PURE__ */ new Date();
|
|
2337
|
-
warn(i18n, code, msg, rest);
|
|
2338
|
-
};
|
|
2339
|
-
var loadedClb = (i18n, cb) => () => {
|
|
2340
|
-
if (i18n.isInitialized) {
|
|
2341
|
-
cb();
|
|
2342
|
-
} else {
|
|
2343
|
-
const initialized = () => {
|
|
2344
|
-
setTimeout(() => {
|
|
2345
|
-
i18n.off("initialized", initialized);
|
|
2346
|
-
}, 0);
|
|
2347
|
-
cb();
|
|
2348
|
-
};
|
|
2349
|
-
i18n.on("initialized", initialized);
|
|
2350
|
-
}
|
|
2351
|
-
};
|
|
2352
|
-
var loadNamespaces = (i18n, ns, cb) => {
|
|
2353
|
-
i18n.loadNamespaces(ns, loadedClb(i18n, cb));
|
|
2354
|
-
};
|
|
2355
|
-
var loadLanguages = (i18n, lng, ns, cb) => {
|
|
2356
|
-
if (isString(ns)) ns = [ns];
|
|
2357
|
-
if (i18n.options.preload && i18n.options.preload.indexOf(lng) > -1) return loadNamespaces(i18n, ns, cb);
|
|
2358
|
-
ns.forEach((n) => {
|
|
2359
|
-
if (i18n.options.ns.indexOf(n) < 0) i18n.options.ns.push(n);
|
|
2360
|
-
});
|
|
2361
|
-
i18n.loadLanguages(lng, loadedClb(i18n, cb));
|
|
2362
|
-
};
|
|
2363
|
-
var hasLoadedNamespace = (ns, i18n, options = {}) => {
|
|
2364
|
-
if (!i18n.languages || !i18n.languages.length) {
|
|
2365
|
-
warnOnce(i18n, "NO_LANGUAGES", "i18n.languages were undefined or empty", {
|
|
2366
|
-
languages: i18n.languages
|
|
2367
|
-
});
|
|
2368
|
-
return true;
|
|
2369
|
-
}
|
|
2370
|
-
return i18n.hasLoadedNamespace(ns, {
|
|
2371
|
-
lng: options.lng,
|
|
2372
|
-
precheck: (i18nInstance2, loadNotPending) => {
|
|
2373
|
-
if (options.bindI18n?.indexOf("languageChanging") > -1 && i18nInstance2.services.backendConnector.backend && i18nInstance2.isLanguageChangingTo && !loadNotPending(i18nInstance2.isLanguageChangingTo, ns)) return false;
|
|
2374
|
-
}
|
|
2375
|
-
});
|
|
2376
|
-
};
|
|
2377
|
-
var isString = (obj) => typeof obj === "string";
|
|
2378
|
-
var isObject = (obj) => typeof obj === "object" && obj !== null;
|
|
2379
|
-
|
|
2380
|
-
// node_modules/react-i18next/dist/es/unescape.js
|
|
2381
|
-
var matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
|
|
2382
|
-
var htmlEntities = {
|
|
2383
|
-
"&": "&",
|
|
2384
|
-
"&": "&",
|
|
2385
|
-
"<": "<",
|
|
2386
|
-
"<": "<",
|
|
2387
|
-
">": ">",
|
|
2388
|
-
">": ">",
|
|
2389
|
-
"'": "'",
|
|
2390
|
-
"'": "'",
|
|
2391
|
-
""": '"',
|
|
2392
|
-
""": '"',
|
|
2393
|
-
" ": " ",
|
|
2394
|
-
" ": " ",
|
|
2395
|
-
"©": "\xA9",
|
|
2396
|
-
"©": "\xA9",
|
|
2397
|
-
"®": "\xAE",
|
|
2398
|
-
"®": "\xAE",
|
|
2399
|
-
"…": "\u2026",
|
|
2400
|
-
"…": "\u2026",
|
|
2401
|
-
"/": "/",
|
|
2402
|
-
"/": "/"
|
|
2403
|
-
};
|
|
2404
|
-
var unescapeHtmlEntity = (m2) => htmlEntities[m2];
|
|
2405
|
-
var unescape = (text) => text.replace(matchHtmlEntity, unescapeHtmlEntity);
|
|
2406
|
-
|
|
2407
|
-
// node_modules/react-i18next/dist/es/defaults.js
|
|
2408
|
-
var defaultOptions = {
|
|
2409
|
-
bindI18n: "languageChanged",
|
|
2410
|
-
bindI18nStore: "",
|
|
2411
|
-
transEmptyNodeValue: "",
|
|
2412
|
-
transSupportBasicHtmlNodes: true,
|
|
2413
|
-
transWrapTextNodes: "",
|
|
2414
|
-
transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
|
|
2415
|
-
useSuspense: true,
|
|
2416
|
-
unescape
|
|
2417
|
-
};
|
|
2418
|
-
var setDefaults = (options = {}) => {
|
|
2419
|
-
defaultOptions = {
|
|
2420
|
-
...defaultOptions,
|
|
2421
|
-
...options
|
|
2422
|
-
};
|
|
2423
|
-
};
|
|
2424
|
-
var getDefaults = () => defaultOptions;
|
|
2425
|
-
|
|
2426
|
-
// node_modules/react-i18next/dist/es/i18nInstance.js
|
|
2427
|
-
var i18nInstance;
|
|
2428
|
-
var setI18n = (instance2) => {
|
|
2429
|
-
i18nInstance = instance2;
|
|
2430
|
-
};
|
|
2431
|
-
var getI18n = () => i18nInstance;
|
|
2432
|
-
|
|
2433
|
-
// node_modules/react-i18next/dist/es/context.js
|
|
2434
|
-
var import_react2 = require("react");
|
|
2435
|
-
|
|
2436
|
-
// node_modules/react-i18next/dist/es/initReactI18next.js
|
|
2437
|
-
var initReactI18next = {
|
|
2438
|
-
type: "3rdParty",
|
|
2439
|
-
init(instance2) {
|
|
2440
|
-
setDefaults(instance2.options.react);
|
|
2441
|
-
setI18n(instance2);
|
|
2442
|
-
}
|
|
2443
|
-
};
|
|
2444
|
-
|
|
2445
|
-
// node_modules/react-i18next/dist/es/context.js
|
|
2446
|
-
var I18nContext = (0, import_react2.createContext)();
|
|
2447
|
-
var ReportNamespaces = class {
|
|
2448
|
-
constructor() {
|
|
2449
|
-
this.usedNamespaces = {};
|
|
2450
|
-
}
|
|
2451
|
-
addUsedNamespaces(namespaces) {
|
|
2452
|
-
namespaces.forEach((ns) => {
|
|
2453
|
-
if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true;
|
|
2454
|
-
});
|
|
2455
|
-
}
|
|
2456
|
-
getUsedNamespaces() {
|
|
2457
|
-
return Object.keys(this.usedNamespaces);
|
|
2458
|
-
}
|
|
2459
|
-
};
|
|
2460
|
-
|
|
2461
|
-
// node_modules/react-i18next/dist/es/useTranslation.js
|
|
2462
|
-
var import_react4 = require("react");
|
|
2463
|
-
var usePrevious = (value, ignore) => {
|
|
2464
|
-
const ref = (0, import_react4.useRef)();
|
|
2465
|
-
(0, import_react4.useEffect)(() => {
|
|
2466
|
-
ref.current = ignore ? ref.current : value;
|
|
2467
|
-
}, [value, ignore]);
|
|
2468
|
-
return ref.current;
|
|
2469
|
-
};
|
|
2470
|
-
var alwaysNewT = (i18n, language, namespace, keyPrefix) => i18n.getFixedT(language, namespace, keyPrefix);
|
|
2471
|
-
var useMemoizedT = (i18n, language, namespace, keyPrefix) => (0, import_react4.useCallback)(alwaysNewT(i18n, language, namespace, keyPrefix), [i18n, language, namespace, keyPrefix]);
|
|
2472
|
-
var useTranslation = (ns, props = {}) => {
|
|
2473
|
-
const {
|
|
2474
|
-
i18n: i18nFromProps
|
|
2475
|
-
} = props;
|
|
2476
|
-
const {
|
|
2477
|
-
i18n: i18nFromContext,
|
|
2478
|
-
defaultNS: defaultNSFromContext
|
|
2479
|
-
} = (0, import_react4.useContext)(I18nContext) || {};
|
|
2480
|
-
const i18n = i18nFromProps || i18nFromContext || getI18n();
|
|
2481
|
-
if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new ReportNamespaces();
|
|
2482
|
-
if (!i18n) {
|
|
2483
|
-
warnOnce(i18n, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
|
|
2484
|
-
const notReadyT = (k2, optsOrDefaultValue) => {
|
|
2485
|
-
if (isString(optsOrDefaultValue)) return optsOrDefaultValue;
|
|
2486
|
-
if (isObject(optsOrDefaultValue) && isString(optsOrDefaultValue.defaultValue)) return optsOrDefaultValue.defaultValue;
|
|
2487
|
-
return Array.isArray(k2) ? k2[k2.length - 1] : k2;
|
|
2488
|
-
};
|
|
2489
|
-
const retNotReady = [notReadyT, {}, false];
|
|
2490
|
-
retNotReady.t = notReadyT;
|
|
2491
|
-
retNotReady.i18n = {};
|
|
2492
|
-
retNotReady.ready = false;
|
|
2493
|
-
return retNotReady;
|
|
2494
|
-
}
|
|
2495
|
-
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.");
|
|
2496
|
-
const i18nOptions = {
|
|
2497
|
-
...getDefaults(),
|
|
2498
|
-
...i18n.options.react,
|
|
2499
|
-
...props
|
|
2500
|
-
};
|
|
2501
|
-
const {
|
|
2502
|
-
useSuspense,
|
|
2503
|
-
keyPrefix
|
|
2504
|
-
} = i18nOptions;
|
|
2505
|
-
let namespaces = ns || defaultNSFromContext || i18n.options?.defaultNS;
|
|
2506
|
-
namespaces = isString(namespaces) ? [namespaces] : namespaces || ["translation"];
|
|
2507
|
-
i18n.reportNamespaces.addUsedNamespaces?.(namespaces);
|
|
2508
|
-
const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every((n) => hasLoadedNamespace(n, i18n, i18nOptions));
|
|
2509
|
-
const memoGetT = useMemoizedT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
|
|
2510
|
-
const getT = () => memoGetT;
|
|
2511
|
-
const getNewT = () => alwaysNewT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
|
|
2512
|
-
const [t2, setT] = (0, import_react4.useState)(getT);
|
|
2513
|
-
let joinedNS = namespaces.join();
|
|
2514
|
-
if (props.lng) joinedNS = `${props.lng}${joinedNS}`;
|
|
2515
|
-
const previousJoinedNS = usePrevious(joinedNS);
|
|
2516
|
-
const isMounted = (0, import_react4.useRef)(true);
|
|
2517
|
-
(0, import_react4.useEffect)(() => {
|
|
2518
|
-
const {
|
|
2519
|
-
bindI18n,
|
|
2520
|
-
bindI18nStore
|
|
2521
|
-
} = i18nOptions;
|
|
2522
|
-
isMounted.current = true;
|
|
2523
|
-
if (!ready && !useSuspense) {
|
|
2524
|
-
if (props.lng) {
|
|
2525
|
-
loadLanguages(i18n, props.lng, namespaces, () => {
|
|
2526
|
-
if (isMounted.current) setT(getNewT);
|
|
2527
|
-
});
|
|
2528
|
-
} else {
|
|
2529
|
-
loadNamespaces(i18n, namespaces, () => {
|
|
2530
|
-
if (isMounted.current) setT(getNewT);
|
|
2531
|
-
});
|
|
2532
|
-
}
|
|
2533
|
-
}
|
|
2534
|
-
if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
|
|
2535
|
-
setT(getNewT);
|
|
2536
|
-
}
|
|
2537
|
-
const boundReset = () => {
|
|
2538
|
-
if (isMounted.current) setT(getNewT);
|
|
2539
|
-
};
|
|
2540
|
-
if (bindI18n) i18n?.on(bindI18n, boundReset);
|
|
2541
|
-
if (bindI18nStore) i18n?.store.on(bindI18nStore, boundReset);
|
|
2542
|
-
return () => {
|
|
2543
|
-
isMounted.current = false;
|
|
2544
|
-
if (i18n) bindI18n?.split(" ").forEach((e2) => i18n.off(e2, boundReset));
|
|
2545
|
-
if (bindI18nStore && i18n) bindI18nStore.split(" ").forEach((e2) => i18n.store.off(e2, boundReset));
|
|
2546
|
-
};
|
|
2547
|
-
}, [i18n, joinedNS]);
|
|
2548
|
-
(0, import_react4.useEffect)(() => {
|
|
2549
|
-
if (isMounted.current && ready) {
|
|
2550
|
-
setT(getT);
|
|
2551
|
-
}
|
|
2552
|
-
}, [i18n, keyPrefix, ready]);
|
|
2553
|
-
const ret = [t2, i18n, ready];
|
|
2554
|
-
ret.t = t2;
|
|
2555
|
-
ret.i18n = i18n;
|
|
2556
|
-
ret.ready = ready;
|
|
2557
|
-
if (ready) return ret;
|
|
2558
|
-
if (!ready && !useSuspense) return ret;
|
|
2559
|
-
throw new Promise((resolve) => {
|
|
2560
|
-
if (props.lng) {
|
|
2561
|
-
loadLanguages(i18n, props.lng, namespaces, () => resolve());
|
|
2562
|
-
} else {
|
|
2563
|
-
loadNamespaces(i18n, namespaces, () => resolve());
|
|
2564
|
-
}
|
|
2565
|
-
});
|
|
2566
|
-
};
|
|
2567
|
-
|
|
2568
|
-
// node_modules/react-i18next/dist/es/withTranslation.js
|
|
2569
|
-
var import_react5 = require("react");
|
|
2570
|
-
|
|
2571
|
-
// node_modules/react-i18next/dist/es/I18nextProvider.js
|
|
2572
|
-
var import_react6 = require("react");
|
|
2573
|
-
|
|
2574
|
-
// node_modules/react-i18next/dist/es/withSSR.js
|
|
2575
|
-
var import_react8 = require("react");
|
|
2308
|
+
// src/components/elements/button/Button.tsx
|
|
2309
|
+
var import_react31 = require("react");
|
|
2576
2310
|
|
|
2577
|
-
//
|
|
2578
|
-
var
|
|
2311
|
+
// src/components/layout/card/Card.tsx
|
|
2312
|
+
var import_react20 = require("react");
|
|
2579
2313
|
|
|
2580
2314
|
// node_modules/styled-components/node_modules/tslib/tslib.es6.mjs
|
|
2581
2315
|
var __assign = function() {
|
|
@@ -2617,7 +2351,7 @@ var isPropValid = /* @__PURE__ */ memoize(
|
|
|
2617
2351
|
);
|
|
2618
2352
|
|
|
2619
2353
|
// node_modules/styled-components/dist/styled-components.browser.esm.js
|
|
2620
|
-
var
|
|
2354
|
+
var import_react = __toESM(require("react"));
|
|
2621
2355
|
var import_shallowequal = __toESM(require_shallowequal());
|
|
2622
2356
|
|
|
2623
2357
|
// node_modules/stylis/src/Enum.js
|
|
@@ -3298,7 +3032,7 @@ var P = function(t2, n) {
|
|
|
3298
3032
|
console.error = function(t3) {
|
|
3299
3033
|
for (var n2 = [], o3 = 1; o3 < arguments.length; o3++) n2[o3 - 1] = arguments[o3];
|
|
3300
3034
|
E.test(t3) ? (a2 = false, N.delete(s2)) : i2.apply(void 0, __spreadArray([t3], n2, false));
|
|
3301
|
-
}, (0,
|
|
3035
|
+
}, (0, import_react.useRef)(), a2 && !N.has(s2) && (console.warn(s2), N.add(s2));
|
|
3302
3036
|
} catch (e2) {
|
|
3303
3037
|
E.test(e2.message) && N.delete(s2);
|
|
3304
3038
|
} finally {
|
|
@@ -3636,26 +3370,26 @@ function Fe(e2) {
|
|
|
3636
3370
|
}
|
|
3637
3371
|
var Me = new ke();
|
|
3638
3372
|
var ze = Fe();
|
|
3639
|
-
var $e =
|
|
3373
|
+
var $e = import_react.default.createContext({ shouldForwardProp: void 0, styleSheet: Me, stylis: ze });
|
|
3640
3374
|
var Be = $e.Consumer;
|
|
3641
|
-
var Le =
|
|
3375
|
+
var Le = import_react.default.createContext(void 0);
|
|
3642
3376
|
function Ge() {
|
|
3643
|
-
return (0,
|
|
3377
|
+
return (0, import_react.useContext)($e);
|
|
3644
3378
|
}
|
|
3645
3379
|
function Ye(e2) {
|
|
3646
|
-
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() {
|
|
3647
3381
|
var t3 = c2;
|
|
3648
3382
|
return e2.sheet ? t3 = e2.sheet : e2.target && (t3 = t3.reconstructWithOptions({ target: e2.target }, false)), e2.disableCSSOMInjection && (t3 = t3.reconstructWithOptions({ useCSSOMInjection: false })), t3;
|
|
3649
|
-
}, [e2.disableCSSOMInjection, e2.sheet, e2.target, c2]), u2 = (0,
|
|
3383
|
+
}, [e2.disableCSSOMInjection, e2.sheet, e2.target, c2]), u2 = (0, import_react.useMemo)(function() {
|
|
3650
3384
|
return Fe({ options: { namespace: e2.namespace, prefix: e2.enableVendorPrefixes }, plugins: n });
|
|
3651
3385
|
}, [e2.enableVendorPrefixes, e2.namespace, n]);
|
|
3652
|
-
(0,
|
|
3386
|
+
(0, import_react.useEffect)(function() {
|
|
3653
3387
|
(0, import_shallowequal.default)(n, e2.stylisPlugins) || r2(e2.stylisPlugins);
|
|
3654
3388
|
}, [e2.stylisPlugins]);
|
|
3655
|
-
var d = (0,
|
|
3389
|
+
var d = (0, import_react.useMemo)(function() {
|
|
3656
3390
|
return { shouldForwardProp: e2.shouldForwardProp, styleSheet: l2, stylis: u2 };
|
|
3657
3391
|
}, [e2.shouldForwardProp, l2, u2]);
|
|
3658
|
-
return
|
|
3392
|
+
return import_react.default.createElement($e.Provider, { value: d }, import_react.default.createElement(Le.Provider, { value: u2 }, e2.children));
|
|
3659
3393
|
}
|
|
3660
3394
|
var We = function() {
|
|
3661
3395
|
function e2(e3, t2) {
|
|
@@ -3747,15 +3481,15 @@ var Qe = function() {
|
|
|
3747
3481
|
return o2;
|
|
3748
3482
|
}, e2;
|
|
3749
3483
|
}();
|
|
3750
|
-
var et =
|
|
3484
|
+
var et = import_react.default.createContext(void 0);
|
|
3751
3485
|
var tt = et.Consumer;
|
|
3752
3486
|
function nt() {
|
|
3753
|
-
var e2 = (0,
|
|
3487
|
+
var e2 = (0, import_react.useContext)(et);
|
|
3754
3488
|
if (!e2) throw he(18);
|
|
3755
3489
|
return e2;
|
|
3756
3490
|
}
|
|
3757
3491
|
function ot(e2) {
|
|
3758
|
-
var n =
|
|
3492
|
+
var n = import_react.default.useContext(et), r2 = (0, import_react.useMemo)(function() {
|
|
3759
3493
|
return function(e3, n2) {
|
|
3760
3494
|
if (!e3) throw he(14);
|
|
3761
3495
|
if (re(e3)) {
|
|
@@ -3767,7 +3501,7 @@ function ot(e2) {
|
|
|
3767
3501
|
return n2 ? __assign(__assign({}, n2), e3) : e3;
|
|
3768
3502
|
}(e2.theme, n);
|
|
3769
3503
|
}, [e2.theme, n]);
|
|
3770
|
-
return e2.children ?
|
|
3504
|
+
return e2.children ? import_react.default.createElement(et.Provider, { value: r2 }, e2.children) : null;
|
|
3771
3505
|
}
|
|
3772
3506
|
var rt = {};
|
|
3773
3507
|
var st = /* @__PURE__ */ new Set();
|
|
@@ -3792,8 +3526,8 @@ function it(e2, r2, s2) {
|
|
|
3792
3526
|
var N2 = new Qe(s2, g2, i2 ? a2.componentStyle : void 0);
|
|
3793
3527
|
function O2(e3, r3) {
|
|
3794
3528
|
return function(e4, r4, s3) {
|
|
3795
|
-
var i3 = e4.attrs, a3 = e4.componentStyle, c3 = e4.defaultProps, p3 = e4.foldedComponentIds, d2 = e4.styledComponentId, h2 = e4.target, f3 =
|
|
3796
|
-
(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);
|
|
3797
3531
|
var v2 = I(r4, f3, c3) || C, g3 = function(e5, n, o2) {
|
|
3798
3532
|
for (var r5, s4 = __assign(__assign({}, n), { className: void 0, theme: o2 }), i4 = 0; i4 < e5.length; i4 += 1) {
|
|
3799
3533
|
var a4 = re(r5 = e5[i4]) ? r5(s4) : r5;
|
|
@@ -3804,15 +3538,15 @@ function it(e2, r2, s2) {
|
|
|
3804
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.)')))));
|
|
3805
3539
|
var E3 = function(e5, t2) {
|
|
3806
3540
|
var n = Ge(), o2 = e5.generateAndInjectStyles(t2, n.styleSheet, n.stylis);
|
|
3807
|
-
return (0,
|
|
3541
|
+
return (0, import_react.useDebugValue)(o2), o2;
|
|
3808
3542
|
}(a3, g3);
|
|
3809
3543
|
e4.warnTooManyClasses && e4.warnTooManyClasses(E3);
|
|
3810
3544
|
var N3 = ie(p3, d2);
|
|
3811
|
-
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);
|
|
3812
3546
|
}(D2, e3, r3);
|
|
3813
3547
|
}
|
|
3814
3548
|
O2.displayName = y2;
|
|
3815
|
-
var D2 =
|
|
3549
|
+
var D2 = import_react.default.forwardRef(O2);
|
|
3816
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() {
|
|
3817
3551
|
return this._foldedDefaultProps;
|
|
3818
3552
|
}, set: function(e3) {
|
|
@@ -3883,10 +3617,10 @@ function ft(n) {
|
|
|
3883
3617
|
var i2 = lt.apply(void 0, __spreadArray([n], r2, false)), a2 = "sc-global-".concat($(JSON.stringify(i2))), c2 = new ht(i2, a2);
|
|
3884
3618
|
P(a2);
|
|
3885
3619
|
var l2 = function(e2) {
|
|
3886
|
-
var t2 = Ge(), n2 =
|
|
3887
|
-
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) {
|
|
3888
3622
|
return "string" == typeof e3 && -1 !== e3.indexOf("@import");
|
|
3889
|
-
}) && 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() {
|
|
3890
3624
|
if (!t2.styleSheet.server) return u2(r3, e2, t2.styleSheet, n2, t2.stylis), function() {
|
|
3891
3625
|
return c2.removeStyles(r3, t2.styleSheet);
|
|
3892
3626
|
};
|
|
@@ -3899,7 +3633,7 @@ function ft(n) {
|
|
|
3899
3633
|
c2.renderStyles(e2, i3, o2, s3);
|
|
3900
3634
|
}
|
|
3901
3635
|
}
|
|
3902
|
-
return
|
|
3636
|
+
return import_react.default.memo(l2);
|
|
3903
3637
|
}
|
|
3904
3638
|
function mt(t2) {
|
|
3905
3639
|
for (var n = [], o2 = 1; o2 < arguments.length; o2++) n[o2 - 1] = arguments[o2];
|
|
@@ -3924,14 +3658,14 @@ var vt = function() {
|
|
|
3924
3658
|
var r2 = e3.instance.toString();
|
|
3925
3659
|
if (!r2) return [];
|
|
3926
3660
|
var s2 = ((n = {})[f] = "", n[y] = v, n.dangerouslySetInnerHTML = { __html: r2 }, n), i2 = Ce();
|
|
3927
|
-
return i2 && (s2.nonce = i2), [
|
|
3661
|
+
return i2 && (s2.nonce = i2), [import_react.default.createElement("style", __assign({}, s2, { key: "sc-0-0" }))];
|
|
3928
3662
|
}, this.seal = function() {
|
|
3929
3663
|
e3.sealed = true;
|
|
3930
3664
|
}, this.instance = new ke({ isServer: true }), this.sealed = false;
|
|
3931
3665
|
}
|
|
3932
3666
|
return e2.prototype.collectStyles = function(e3) {
|
|
3933
3667
|
if (this.sealed) throw he(2);
|
|
3934
|
-
return
|
|
3668
|
+
return import_react.default.createElement(Ye, { sheet: this.instance }, e3);
|
|
3935
3669
|
}, e2.prototype.interleaveWithNodeStream = function(e3) {
|
|
3936
3670
|
throw he(3);
|
|
3937
3671
|
}, e2;
|
|
@@ -3949,10 +3683,10 @@ var DEFAULT_CURRENCY = "USD";
|
|
|
3949
3683
|
var MAXIMUM_SIGNIFICANT_DIGITS = 6;
|
|
3950
3684
|
|
|
3951
3685
|
// src/hooks/useAvailablePlans.ts
|
|
3952
|
-
var
|
|
3686
|
+
var import_react2 = require("react");
|
|
3953
3687
|
function useAvailablePlans(activePeriod) {
|
|
3954
3688
|
const { data, mode } = useEmbed();
|
|
3955
|
-
const getAvailablePeriods = (0,
|
|
3689
|
+
const getAvailablePeriods = (0, import_react2.useCallback)(() => {
|
|
3956
3690
|
const periods = [];
|
|
3957
3691
|
if (data.activePlans.some((plan) => plan.monthlyPrice) || data.activeAddOns.some((addOn) => addOn.monthlyPrice)) {
|
|
3958
3692
|
periods.push("month");
|
|
@@ -3962,7 +3696,7 @@ function useAvailablePlans(activePeriod) {
|
|
|
3962
3696
|
}
|
|
3963
3697
|
return periods;
|
|
3964
3698
|
}, [data.activePlans, data.activeAddOns]);
|
|
3965
|
-
const getActivePlans = (0,
|
|
3699
|
+
const getActivePlans = (0, import_react2.useCallback)(
|
|
3966
3700
|
(plans) => {
|
|
3967
3701
|
const customPlanExist = plans.some((plan) => plan.custom);
|
|
3968
3702
|
const plansWithSelected = mode === "edit" ? plans.slice() : plans.filter(
|
|
@@ -3983,7 +3717,7 @@ function useAvailablePlans(activePeriod) {
|
|
|
3983
3717
|
},
|
|
3984
3718
|
[activePeriod, mode]
|
|
3985
3719
|
);
|
|
3986
|
-
return (0,
|
|
3720
|
+
return (0, import_react2.useMemo)(() => {
|
|
3987
3721
|
return {
|
|
3988
3722
|
plans: getActivePlans(data.activePlans),
|
|
3989
3723
|
addOns: getActivePlans(data.activeAddOns),
|
|
@@ -4001,7 +3735,7 @@ function useAvailablePlans(activePeriod) {
|
|
|
4001
3735
|
var import_react12 = require("react");
|
|
4002
3736
|
|
|
4003
3737
|
// node_modules/i18next/dist/esm/i18next.js
|
|
4004
|
-
var
|
|
3738
|
+
var isString = (obj) => typeof obj === "string";
|
|
4005
3739
|
var defer = () => {
|
|
4006
3740
|
let res;
|
|
4007
3741
|
let rej;
|
|
@@ -4024,9 +3758,9 @@ var copy2 = (a2, s2, t2) => {
|
|
|
4024
3758
|
};
|
|
4025
3759
|
var lastOfPathSeparatorRegExp = /###/g;
|
|
4026
3760
|
var cleanKey = (key) => key && key.indexOf("###") > -1 ? key.replace(lastOfPathSeparatorRegExp, ".") : key;
|
|
4027
|
-
var canNotTraverseDeeper = (object) => !object ||
|
|
3761
|
+
var canNotTraverseDeeper = (object) => !object || isString(object);
|
|
4028
3762
|
var getLastOfPath = (object, path, Empty) => {
|
|
4029
|
-
const stack = !
|
|
3763
|
+
const stack = !isString(path) ? path : path.split(".");
|
|
4030
3764
|
let stackIndex = 0;
|
|
4031
3765
|
while (stackIndex < stack.length - 1) {
|
|
4032
3766
|
if (canNotTraverseDeeper(object)) return {};
|
|
@@ -4095,7 +3829,7 @@ var deepExtend = (target, source, overwrite) => {
|
|
|
4095
3829
|
for (const prop in source) {
|
|
4096
3830
|
if (prop !== "__proto__" && prop !== "constructor") {
|
|
4097
3831
|
if (prop in target) {
|
|
4098
|
-
if (
|
|
3832
|
+
if (isString(target[prop]) || target[prop] instanceof String || isString(source[prop]) || source[prop] instanceof String) {
|
|
4099
3833
|
if (overwrite) target[prop] = source[prop];
|
|
4100
3834
|
} else {
|
|
4101
3835
|
deepExtend(target[prop], source[prop], overwrite);
|
|
@@ -4117,7 +3851,7 @@ var _entityMap = {
|
|
|
4117
3851
|
"/": "/"
|
|
4118
3852
|
};
|
|
4119
3853
|
var escape = (data) => {
|
|
4120
|
-
if (
|
|
3854
|
+
if (isString(data)) {
|
|
4121
3855
|
return data.replace(/[&<>"'\/]/g, (s2) => _entityMap[s2]);
|
|
4122
3856
|
}
|
|
4123
3857
|
return data;
|
|
@@ -4246,7 +3980,7 @@ var Logger = class _Logger {
|
|
|
4246
3980
|
}
|
|
4247
3981
|
forward(args, lvl, prefix2, debugOnly) {
|
|
4248
3982
|
if (debugOnly && !this.debug) return null;
|
|
4249
|
-
if (
|
|
3983
|
+
if (isString(args[0])) args[0] = `${prefix2}${this.prefix} ${args[0]}`;
|
|
4250
3984
|
return this.logger[lvl](args);
|
|
4251
3985
|
}
|
|
4252
3986
|
create(moduleName) {
|
|
@@ -4347,7 +4081,7 @@ var ResourceStore = class extends EventEmitter {
|
|
|
4347
4081
|
if (key) {
|
|
4348
4082
|
if (Array.isArray(key)) {
|
|
4349
4083
|
path.push(...key);
|
|
4350
|
-
} else if (
|
|
4084
|
+
} else if (isString(key) && keySeparator) {
|
|
4351
4085
|
path.push(...key.split(keySeparator));
|
|
4352
4086
|
} else {
|
|
4353
4087
|
path.push(key);
|
|
@@ -4360,7 +4094,7 @@ var ResourceStore = class extends EventEmitter {
|
|
|
4360
4094
|
ns = path[1];
|
|
4361
4095
|
key = path.slice(2).join(".");
|
|
4362
4096
|
}
|
|
4363
|
-
if (result || !ignoreJSONStructure || !
|
|
4097
|
+
if (result || !ignoreJSONStructure || !isString(key)) return result;
|
|
4364
4098
|
return deepFind(this.data?.[lng]?.[ns], key, keySeparator);
|
|
4365
4099
|
}
|
|
4366
4100
|
addResource(lng, ns, key, value) {
|
|
@@ -4384,7 +4118,7 @@ var ResourceStore = class extends EventEmitter {
|
|
|
4384
4118
|
silent: false
|
|
4385
4119
|
};
|
|
4386
4120
|
for (const m2 in resources) {
|
|
4387
|
-
if (
|
|
4121
|
+
if (isString(resources[m2]) || Array.isArray(resources[m2])) this.addResource(lng, ns, m2, resources[m2], {
|
|
4388
4122
|
silent: true
|
|
4389
4123
|
});
|
|
4390
4124
|
}
|
|
@@ -4455,7 +4189,7 @@ var postProcessor = {
|
|
|
4455
4189
|
}
|
|
4456
4190
|
};
|
|
4457
4191
|
var checkedLoadedFor = {};
|
|
4458
|
-
var shouldHandleAsObject = (res) => !
|
|
4192
|
+
var shouldHandleAsObject = (res) => !isString(res) && typeof res !== "boolean" && typeof res !== "number";
|
|
4459
4193
|
var Translator = class _Translator extends EventEmitter {
|
|
4460
4194
|
constructor(services) {
|
|
4461
4195
|
let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
@@ -4492,7 +4226,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4492
4226
|
if (m2 && m2.length > 0) {
|
|
4493
4227
|
return {
|
|
4494
4228
|
key,
|
|
4495
|
-
namespaces:
|
|
4229
|
+
namespaces: isString(namespaces) ? [namespaces] : namespaces
|
|
4496
4230
|
};
|
|
4497
4231
|
}
|
|
4498
4232
|
const parts = key.split(nsSeparator);
|
|
@@ -4501,7 +4235,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4501
4235
|
}
|
|
4502
4236
|
return {
|
|
4503
4237
|
key,
|
|
4504
|
-
namespaces:
|
|
4238
|
+
namespaces: isString(namespaces) ? [namespaces] : namespaces
|
|
4505
4239
|
};
|
|
4506
4240
|
}
|
|
4507
4241
|
translate(keys, options, lastKey) {
|
|
@@ -4557,7 +4291,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4557
4291
|
const noObject = ["[object Number]", "[object Function]", "[object RegExp]"];
|
|
4558
4292
|
const joinArrays = options.joinArrays !== void 0 ? options.joinArrays : this.options.joinArrays;
|
|
4559
4293
|
const handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
|
|
4560
|
-
const needsPluralHandling = options.count !== void 0 && !
|
|
4294
|
+
const needsPluralHandling = options.count !== void 0 && !isString(options.count);
|
|
4561
4295
|
const hasDefaultValue = _Translator.hasDefaultValue(options);
|
|
4562
4296
|
const defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, options) : "";
|
|
4563
4297
|
const defaultValueSuffixOrdinalFallback = options.ordinal && needsPluralHandling ? this.pluralResolver.getSuffix(lng, options.count, {
|
|
@@ -4571,7 +4305,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4571
4305
|
}
|
|
4572
4306
|
const handleAsObject = shouldHandleAsObject(resForObjHndl);
|
|
4573
4307
|
const resType = Object.prototype.toString.apply(resForObjHndl);
|
|
4574
|
-
if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && noObject.indexOf(resType) < 0 && !(
|
|
4308
|
+
if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && noObject.indexOf(resType) < 0 && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {
|
|
4575
4309
|
if (!options.returnObjects && !this.options.returnObjects) {
|
|
4576
4310
|
if (!this.options.returnedObjectHandler) {
|
|
4577
4311
|
this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
@@ -4617,7 +4351,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4617
4351
|
}
|
|
4618
4352
|
res = copy3;
|
|
4619
4353
|
}
|
|
4620
|
-
} else if (handleAsObjectInI18nFormat &&
|
|
4354
|
+
} else if (handleAsObjectInI18nFormat && isString(joinArrays) && Array.isArray(res)) {
|
|
4621
4355
|
res = res.join(joinArrays);
|
|
4622
4356
|
if (res) res = this.extendTranslation(res, keys, options, lastKey);
|
|
4623
4357
|
} else {
|
|
@@ -4711,13 +4445,13 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4711
4445
|
}
|
|
4712
4446
|
}
|
|
4713
4447
|
});
|
|
4714
|
-
const skipOnVariables =
|
|
4448
|
+
const skipOnVariables = isString(res) && (options?.interpolation?.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
|
|
4715
4449
|
let nestBef;
|
|
4716
4450
|
if (skipOnVariables) {
|
|
4717
4451
|
const nb = res.match(this.interpolator.nestingRegexp);
|
|
4718
4452
|
nestBef = nb && nb.length;
|
|
4719
4453
|
}
|
|
4720
|
-
let data = options.replace && !
|
|
4454
|
+
let data = options.replace && !isString(options.replace) ? options.replace : options;
|
|
4721
4455
|
if (this.options.interpolation.defaultVariables) data = {
|
|
4722
4456
|
...this.options.interpolation.defaultVariables,
|
|
4723
4457
|
...data
|
|
@@ -4742,7 +4476,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4742
4476
|
if (options.interpolation) this.interpolator.reset();
|
|
4743
4477
|
}
|
|
4744
4478
|
const postProcess = options.postProcess || this.options.postProcess;
|
|
4745
|
-
const postProcessorNames =
|
|
4479
|
+
const postProcessorNames = isString(postProcess) ? [postProcess] : postProcess;
|
|
4746
4480
|
if (res != null && postProcessorNames?.length && options.applyPostProcessor !== false) {
|
|
4747
4481
|
res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? {
|
|
4748
4482
|
i18nResolved: {
|
|
@@ -4761,7 +4495,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4761
4495
|
let exactUsedKey;
|
|
4762
4496
|
let usedLng;
|
|
4763
4497
|
let usedNS;
|
|
4764
|
-
if (
|
|
4498
|
+
if (isString(keys)) keys = [keys];
|
|
4765
4499
|
keys.forEach((k2) => {
|
|
4766
4500
|
if (this.isValidLookup(found)) return;
|
|
4767
4501
|
const extracted = this.extractFromKey(k2, options);
|
|
@@ -4769,9 +4503,9 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4769
4503
|
usedKey = key;
|
|
4770
4504
|
let namespaces = extracted.namespaces;
|
|
4771
4505
|
if (this.options.fallbackNS) namespaces = namespaces.concat(this.options.fallbackNS);
|
|
4772
|
-
const needsPluralHandling = options.count !== void 0 && !
|
|
4506
|
+
const needsPluralHandling = options.count !== void 0 && !isString(options.count);
|
|
4773
4507
|
const needsZeroSuffixLookup = needsPluralHandling && !options.ordinal && options.count === 0;
|
|
4774
|
-
const needsContextHandling = options.context !== void 0 && (
|
|
4508
|
+
const needsContextHandling = options.context !== void 0 && (isString(options.context) || typeof options.context === "number") && options.context !== "";
|
|
4775
4509
|
const codes = options.lngs ? options.lngs : this.languageUtils.toResolveHierarchy(options.lng || this.language, options.fallbackLng);
|
|
4776
4510
|
namespaces.forEach((ns) => {
|
|
4777
4511
|
if (this.isValidLookup(found)) return;
|
|
@@ -4843,7 +4577,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
4843
4577
|
getUsedParamsDetails() {
|
|
4844
4578
|
let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
4845
4579
|
const optionsKeys = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"];
|
|
4846
|
-
const useOptionsReplaceForData = options.replace && !
|
|
4580
|
+
const useOptionsReplaceForData = options.replace && !isString(options.replace);
|
|
4847
4581
|
let data = useOptionsReplaceForData ? options.replace : options;
|
|
4848
4582
|
if (useOptionsReplaceForData && typeof options.count !== "undefined") {
|
|
4849
4583
|
data.count = options.count;
|
|
@@ -4896,7 +4630,7 @@ var LanguageUtil = class {
|
|
|
4896
4630
|
return this.formatLanguageCode(p2[0]);
|
|
4897
4631
|
}
|
|
4898
4632
|
formatLanguageCode(code) {
|
|
4899
|
-
if (
|
|
4633
|
+
if (isString(code) && code.indexOf("-") > -1) {
|
|
4900
4634
|
let formattedCode;
|
|
4901
4635
|
try {
|
|
4902
4636
|
formattedCode = Intl.getCanonicalLocales(code)[0];
|
|
@@ -4946,7 +4680,7 @@ var LanguageUtil = class {
|
|
|
4946
4680
|
getFallbackCodes(fallbacks, code) {
|
|
4947
4681
|
if (!fallbacks) return [];
|
|
4948
4682
|
if (typeof fallbacks === "function") fallbacks = fallbacks(code);
|
|
4949
|
-
if (
|
|
4683
|
+
if (isString(fallbacks)) fallbacks = [fallbacks];
|
|
4950
4684
|
if (Array.isArray(fallbacks)) return fallbacks;
|
|
4951
4685
|
if (!code) return fallbacks.default || [];
|
|
4952
4686
|
let found = fallbacks[code];
|
|
@@ -4967,11 +4701,11 @@ var LanguageUtil = class {
|
|
|
4967
4701
|
this.logger.warn(`rejecting language code not found in supportedLngs: ${c2}`);
|
|
4968
4702
|
}
|
|
4969
4703
|
};
|
|
4970
|
-
if (
|
|
4704
|
+
if (isString(code) && (code.indexOf("-") > -1 || code.indexOf("_") > -1)) {
|
|
4971
4705
|
if (this.options.load !== "languageOnly") addCode(this.formatLanguageCode(code));
|
|
4972
4706
|
if (this.options.load !== "languageOnly" && this.options.load !== "currentOnly") addCode(this.getScriptPartFromCode(code));
|
|
4973
4707
|
if (this.options.load !== "currentOnly") addCode(this.getLanguagePartFromCode(code));
|
|
4974
|
-
} else if (
|
|
4708
|
+
} else if (isString(code)) {
|
|
4975
4709
|
addCode(this.formatLanguageCode(code));
|
|
4976
4710
|
}
|
|
4977
4711
|
fallbackCodes.forEach((fc) => {
|
|
@@ -5067,7 +4801,7 @@ var deepFindWithDefaults = function(data, defaultData, key) {
|
|
|
5067
4801
|
let keySeparator = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".";
|
|
5068
4802
|
let ignoreJSONStructure = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true;
|
|
5069
4803
|
let path = getPathWithDefaults(data, defaultData, key);
|
|
5070
|
-
if (!path && ignoreJSONStructure &&
|
|
4804
|
+
if (!path && ignoreJSONStructure && isString(key)) {
|
|
5071
4805
|
path = deepFind(data, key, keySeparator);
|
|
5072
4806
|
if (path === void 0) path = deepFind(defaultData, key, keySeparator);
|
|
5073
4807
|
}
|
|
@@ -5177,7 +4911,7 @@ var Interpolator = class {
|
|
|
5177
4911
|
if (value === void 0) {
|
|
5178
4912
|
if (typeof missingInterpolationHandler === "function") {
|
|
5179
4913
|
const temp = missingInterpolationHandler(str, match2, options);
|
|
5180
|
-
value =
|
|
4914
|
+
value = isString(temp) ? temp : "";
|
|
5181
4915
|
} else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
|
|
5182
4916
|
value = "";
|
|
5183
4917
|
} else if (skipOnVariables) {
|
|
@@ -5187,7 +4921,7 @@ var Interpolator = class {
|
|
|
5187
4921
|
this.logger.warn(`missed to pass in variable ${matchedVar} for interpolating ${str}`);
|
|
5188
4922
|
value = "";
|
|
5189
4923
|
}
|
|
5190
|
-
} else if (!
|
|
4924
|
+
} else if (!isString(value) && !this.useRawValueToEscape) {
|
|
5191
4925
|
value = makeString(value);
|
|
5192
4926
|
}
|
|
5193
4927
|
const safeValue = todo.safeValue(value);
|
|
@@ -5241,7 +4975,7 @@ var Interpolator = class {
|
|
|
5241
4975
|
clonedOptions = {
|
|
5242
4976
|
...options
|
|
5243
4977
|
};
|
|
5244
|
-
clonedOptions = clonedOptions.replace && !
|
|
4978
|
+
clonedOptions = clonedOptions.replace && !isString(clonedOptions.replace) ? clonedOptions.replace : clonedOptions;
|
|
5245
4979
|
clonedOptions.applyPostProcessor = false;
|
|
5246
4980
|
delete clonedOptions.defaultValue;
|
|
5247
4981
|
let doReduce = false;
|
|
@@ -5252,8 +4986,8 @@ var Interpolator = class {
|
|
|
5252
4986
|
doReduce = true;
|
|
5253
4987
|
}
|
|
5254
4988
|
value = fc(handleHasOptions.call(this, match2[1].trim(), clonedOptions), clonedOptions);
|
|
5255
|
-
if (value && match2[0] === str && !
|
|
5256
|
-
if (!
|
|
4989
|
+
if (value && match2[0] === str && !isString(value)) return value;
|
|
4990
|
+
if (!isString(value)) value = makeString(value);
|
|
5257
4991
|
if (!value) {
|
|
5258
4992
|
this.logger.warn(`missed to resolve ${match2[1]} for nesting ${str}`);
|
|
5259
4993
|
value = "";
|
|
@@ -5563,8 +5297,8 @@ var Connector = class extends EventEmitter {
|
|
|
5563
5297
|
this.logger.warn("No backend was added via i18next.use. Will not load resources.");
|
|
5564
5298
|
return callback && callback();
|
|
5565
5299
|
}
|
|
5566
|
-
if (
|
|
5567
|
-
if (
|
|
5300
|
+
if (isString(languages)) languages = this.languageUtils.toResolveHierarchy(languages);
|
|
5301
|
+
if (isString(namespaces)) namespaces = [namespaces];
|
|
5568
5302
|
const toLoad = this.queueLoad(languages, namespaces, options, callback);
|
|
5569
5303
|
if (!toLoad.toLoad.length) {
|
|
5570
5304
|
if (!toLoad.pending.length) callback();
|
|
@@ -5668,8 +5402,8 @@ var get = () => ({
|
|
|
5668
5402
|
overloadTranslationOptionHandler: (args) => {
|
|
5669
5403
|
let ret = {};
|
|
5670
5404
|
if (typeof args[1] === "object") ret = args[1];
|
|
5671
|
-
if (
|
|
5672
|
-
if (
|
|
5405
|
+
if (isString(args[1])) ret.defaultValue = args[1];
|
|
5406
|
+
if (isString(args[2])) ret.tDescription = args[2];
|
|
5673
5407
|
if (typeof args[2] === "object" || typeof args[3] === "object") {
|
|
5674
5408
|
const options = args[3] || args[2];
|
|
5675
5409
|
Object.keys(options).forEach((key) => {
|
|
@@ -5693,9 +5427,9 @@ var get = () => ({
|
|
|
5693
5427
|
}
|
|
5694
5428
|
});
|
|
5695
5429
|
var transformOptions = (options) => {
|
|
5696
|
-
if (
|
|
5697
|
-
if (
|
|
5698
|
-
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];
|
|
5699
5433
|
if (options.supportedLngs?.indexOf?.("cimode") < 0) {
|
|
5700
5434
|
options.supportedLngs = options.supportedLngs.concat(["cimode"]);
|
|
5701
5435
|
}
|
|
@@ -5744,7 +5478,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
5744
5478
|
options = {};
|
|
5745
5479
|
}
|
|
5746
5480
|
if (options.defaultNS == null && options.ns) {
|
|
5747
|
-
if (
|
|
5481
|
+
if (isString(options.ns)) {
|
|
5748
5482
|
options.defaultNS = options.ns;
|
|
5749
5483
|
} else if (options.ns.indexOf("translation") < 0) {
|
|
5750
5484
|
options.defaultNS = options.ns[0];
|
|
@@ -5874,7 +5608,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
5874
5608
|
loadResources(language) {
|
|
5875
5609
|
let callback = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : noop;
|
|
5876
5610
|
let usedCallback = callback;
|
|
5877
|
-
const usedLng =
|
|
5611
|
+
const usedLng = isString(language) ? language : this.language;
|
|
5878
5612
|
if (typeof language === "function") usedCallback = language;
|
|
5879
5613
|
if (!this.options.resources || this.options.partialBundledLanguages) {
|
|
5880
5614
|
if (usedLng?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return usedCallback();
|
|
@@ -5990,7 +5724,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
5990
5724
|
};
|
|
5991
5725
|
const setLng = (lngs) => {
|
|
5992
5726
|
if (!lng && !lngs && this.services.languageDetector) lngs = [];
|
|
5993
|
-
const l2 =
|
|
5727
|
+
const l2 = isString(lngs) ? lngs : this.services.languageUtils.getBestMatchFromCodes(lngs);
|
|
5994
5728
|
if (l2) {
|
|
5995
5729
|
if (!this.language) {
|
|
5996
5730
|
setLngProps(l2);
|
|
@@ -6042,7 +5776,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
6042
5776
|
}
|
|
6043
5777
|
return _this3.t(resultKey, options);
|
|
6044
5778
|
};
|
|
6045
|
-
if (
|
|
5779
|
+
if (isString(lng)) {
|
|
6046
5780
|
fixedT.lng = lng;
|
|
6047
5781
|
} else {
|
|
6048
5782
|
fixedT.lngs = lng;
|
|
@@ -6099,7 +5833,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
6099
5833
|
if (callback) callback();
|
|
6100
5834
|
return Promise.resolve();
|
|
6101
5835
|
}
|
|
6102
|
-
if (
|
|
5836
|
+
if (isString(ns)) ns = [ns];
|
|
6103
5837
|
ns.forEach((n) => {
|
|
6104
5838
|
if (this.options.ns.indexOf(n) < 0) this.options.ns.push(n);
|
|
6105
5839
|
});
|
|
@@ -6111,7 +5845,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
6111
5845
|
}
|
|
6112
5846
|
loadLanguages(lngs, callback) {
|
|
6113
5847
|
const deferred = defer();
|
|
6114
|
-
if (
|
|
5848
|
+
if (isString(lngs)) lngs = [lngs];
|
|
6115
5849
|
const preloaded = this.options.preload || [];
|
|
6116
5850
|
const newLngs = lngs.filter((lng) => preloaded.indexOf(lng) < 0 && this.services.languageUtils.isSupportedCode(lng));
|
|
6117
5851
|
if (!newLngs.length) {
|
|
@@ -6215,9 +5949,9 @@ var getFixedT = instance.getFixedT;
|
|
|
6215
5949
|
var t = instance.t;
|
|
6216
5950
|
var exists = instance.exists;
|
|
6217
5951
|
var setDefaultNamespace = instance.setDefaultNamespace;
|
|
6218
|
-
var
|
|
6219
|
-
var
|
|
6220
|
-
var
|
|
5952
|
+
var hasLoadedNamespace = instance.hasLoadedNamespace;
|
|
5953
|
+
var loadNamespaces = instance.loadNamespaces;
|
|
5954
|
+
var loadLanguages = instance.loadLanguages;
|
|
6221
5955
|
|
|
6222
5956
|
// src/context/embed.tsx
|
|
6223
5957
|
var import_merge = __toESM(require_merge());
|
|
@@ -10314,90 +10048,362 @@ Inflate$1.prototype.push = function(data, flush_mode) {
|
|
|
10314
10048
|
status = Z_NEED_DICT;
|
|
10315
10049
|
}
|
|
10316
10050
|
}
|
|
10317
|
-
while (strm.avail_in > 0 && status === Z_STREAM_END && strm.state.wrap > 0 && data[strm.next_in] !== 0) {
|
|
10318
|
-
inflate_1$2.inflateReset(strm);
|
|
10319
|
-
status = inflate_1$2.inflate(strm, _flush_mode);
|
|
10320
|
-
}
|
|
10321
|
-
switch (status) {
|
|
10322
|
-
case Z_STREAM_ERROR:
|
|
10323
|
-
case Z_DATA_ERROR:
|
|
10324
|
-
case Z_NEED_DICT:
|
|
10325
|
-
case Z_MEM_ERROR:
|
|
10326
|
-
this.onEnd(status);
|
|
10327
|
-
this.ended = true;
|
|
10328
|
-
return false;
|
|
10329
|
-
}
|
|
10330
|
-
last_avail_out = strm.avail_out;
|
|
10331
|
-
if (strm.next_out) {
|
|
10332
|
-
if (strm.avail_out === 0 || status === Z_STREAM_END) {
|
|
10333
|
-
if (this.options.to === "string") {
|
|
10334
|
-
let next_out_utf8 = strings.utf8border(strm.output, strm.next_out);
|
|
10335
|
-
let tail = strm.next_out - next_out_utf8;
|
|
10336
|
-
let utf8str = strings.buf2string(strm.output, next_out_utf8);
|
|
10337
|
-
strm.next_out = tail;
|
|
10338
|
-
strm.avail_out = chunkSize - tail;
|
|
10339
|
-
if (tail) strm.output.set(strm.output.subarray(next_out_utf8, next_out_utf8 + tail), 0);
|
|
10340
|
-
this.onData(utf8str);
|
|
10341
|
-
} else {
|
|
10342
|
-
this.onData(strm.output.length === strm.next_out ? strm.output : strm.output.subarray(0, strm.next_out));
|
|
10343
|
-
}
|
|
10344
|
-
}
|
|
10051
|
+
while (strm.avail_in > 0 && status === Z_STREAM_END && strm.state.wrap > 0 && data[strm.next_in] !== 0) {
|
|
10052
|
+
inflate_1$2.inflateReset(strm);
|
|
10053
|
+
status = inflate_1$2.inflate(strm, _flush_mode);
|
|
10054
|
+
}
|
|
10055
|
+
switch (status) {
|
|
10056
|
+
case Z_STREAM_ERROR:
|
|
10057
|
+
case Z_DATA_ERROR:
|
|
10058
|
+
case Z_NEED_DICT:
|
|
10059
|
+
case Z_MEM_ERROR:
|
|
10060
|
+
this.onEnd(status);
|
|
10061
|
+
this.ended = true;
|
|
10062
|
+
return false;
|
|
10063
|
+
}
|
|
10064
|
+
last_avail_out = strm.avail_out;
|
|
10065
|
+
if (strm.next_out) {
|
|
10066
|
+
if (strm.avail_out === 0 || status === Z_STREAM_END) {
|
|
10067
|
+
if (this.options.to === "string") {
|
|
10068
|
+
let next_out_utf8 = strings.utf8border(strm.output, strm.next_out);
|
|
10069
|
+
let tail = strm.next_out - next_out_utf8;
|
|
10070
|
+
let utf8str = strings.buf2string(strm.output, next_out_utf8);
|
|
10071
|
+
strm.next_out = tail;
|
|
10072
|
+
strm.avail_out = chunkSize - tail;
|
|
10073
|
+
if (tail) strm.output.set(strm.output.subarray(next_out_utf8, next_out_utf8 + tail), 0);
|
|
10074
|
+
this.onData(utf8str);
|
|
10075
|
+
} else {
|
|
10076
|
+
this.onData(strm.output.length === strm.next_out ? strm.output : strm.output.subarray(0, strm.next_out));
|
|
10077
|
+
}
|
|
10078
|
+
}
|
|
10079
|
+
}
|
|
10080
|
+
if (status === Z_OK && last_avail_out === 0) continue;
|
|
10081
|
+
if (status === Z_STREAM_END) {
|
|
10082
|
+
status = inflate_1$2.inflateEnd(this.strm);
|
|
10083
|
+
this.onEnd(status);
|
|
10084
|
+
this.ended = true;
|
|
10085
|
+
return true;
|
|
10086
|
+
}
|
|
10087
|
+
if (strm.avail_in === 0) break;
|
|
10088
|
+
}
|
|
10089
|
+
return true;
|
|
10090
|
+
};
|
|
10091
|
+
Inflate$1.prototype.onData = function(chunk) {
|
|
10092
|
+
this.chunks.push(chunk);
|
|
10093
|
+
};
|
|
10094
|
+
Inflate$1.prototype.onEnd = function(status) {
|
|
10095
|
+
if (status === Z_OK) {
|
|
10096
|
+
if (this.options.to === "string") {
|
|
10097
|
+
this.result = this.chunks.join("");
|
|
10098
|
+
} else {
|
|
10099
|
+
this.result = common.flattenChunks(this.chunks);
|
|
10100
|
+
}
|
|
10101
|
+
}
|
|
10102
|
+
this.chunks = [];
|
|
10103
|
+
this.err = status;
|
|
10104
|
+
this.msg = this.strm.msg;
|
|
10105
|
+
};
|
|
10106
|
+
function inflate$1(input, options) {
|
|
10107
|
+
const inflator = new Inflate$1(options);
|
|
10108
|
+
inflator.push(input);
|
|
10109
|
+
if (inflator.err) throw inflator.msg || messages[inflator.err];
|
|
10110
|
+
return inflator.result;
|
|
10111
|
+
}
|
|
10112
|
+
function inflateRaw$1(input, options) {
|
|
10113
|
+
options = options || {};
|
|
10114
|
+
options.raw = true;
|
|
10115
|
+
return inflate$1(input, options);
|
|
10116
|
+
}
|
|
10117
|
+
var Inflate_1$1 = Inflate$1;
|
|
10118
|
+
var inflate_2 = inflate$1;
|
|
10119
|
+
var inflateRaw_1$1 = inflateRaw$1;
|
|
10120
|
+
var ungzip$1 = inflate$1;
|
|
10121
|
+
var constants = constants$2;
|
|
10122
|
+
var inflate_1$1 = {
|
|
10123
|
+
Inflate: Inflate_1$1,
|
|
10124
|
+
inflate: inflate_2,
|
|
10125
|
+
inflateRaw: inflateRaw_1$1,
|
|
10126
|
+
ungzip: ungzip$1,
|
|
10127
|
+
constants
|
|
10128
|
+
};
|
|
10129
|
+
var { Deflate, deflate, deflateRaw, gzip } = deflate_1$1;
|
|
10130
|
+
var { Inflate, inflate, inflateRaw, ungzip } = inflate_1$1;
|
|
10131
|
+
var inflate_1 = inflate;
|
|
10132
|
+
|
|
10133
|
+
// src/context/embed.tsx
|
|
10134
|
+
var import_react11 = require("react");
|
|
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);
|
|
10345
10364
|
}
|
|
10346
|
-
|
|
10347
|
-
|
|
10348
|
-
|
|
10349
|
-
|
|
10350
|
-
|
|
10351
|
-
|
|
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);
|
|
10352
10379
|
}
|
|
10353
|
-
|
|
10354
|
-
|
|
10355
|
-
|
|
10356
|
-
|
|
10357
|
-
|
|
10358
|
-
|
|
10359
|
-
|
|
10360
|
-
|
|
10361
|
-
|
|
10362
|
-
|
|
10363
|
-
this.result = this.chunks.join("");
|
|
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());
|
|
10364
10390
|
} else {
|
|
10365
|
-
|
|
10391
|
+
loadNamespaces2(i18n, namespaces, () => resolve());
|
|
10366
10392
|
}
|
|
10367
|
-
}
|
|
10368
|
-
this.chunks = [];
|
|
10369
|
-
this.err = status;
|
|
10370
|
-
this.msg = this.strm.msg;
|
|
10371
|
-
};
|
|
10372
|
-
function inflate$1(input, options) {
|
|
10373
|
-
const inflator = new Inflate$1(options);
|
|
10374
|
-
inflator.push(input);
|
|
10375
|
-
if (inflator.err) throw inflator.msg || messages[inflator.err];
|
|
10376
|
-
return inflator.result;
|
|
10377
|
-
}
|
|
10378
|
-
function inflateRaw$1(input, options) {
|
|
10379
|
-
options = options || {};
|
|
10380
|
-
options.raw = true;
|
|
10381
|
-
return inflate$1(input, options);
|
|
10382
|
-
}
|
|
10383
|
-
var Inflate_1$1 = Inflate$1;
|
|
10384
|
-
var inflate_2 = inflate$1;
|
|
10385
|
-
var inflateRaw_1$1 = inflateRaw$1;
|
|
10386
|
-
var ungzip$1 = inflate$1;
|
|
10387
|
-
var constants = constants$2;
|
|
10388
|
-
var inflate_1$1 = {
|
|
10389
|
-
Inflate: Inflate_1$1,
|
|
10390
|
-
inflate: inflate_2,
|
|
10391
|
-
inflateRaw: inflateRaw_1$1,
|
|
10392
|
-
ungzip: ungzip$1,
|
|
10393
|
-
constants
|
|
10393
|
+
});
|
|
10394
10394
|
};
|
|
10395
|
-
var { Deflate, deflate, deflateRaw, gzip } = deflate_1$1;
|
|
10396
|
-
var { Inflate, inflate, inflateRaw, ungzip } = inflate_1$1;
|
|
10397
|
-
var inflate_1 = inflate;
|
|
10398
10395
|
|
|
10399
|
-
//
|
|
10400
|
-
var
|
|
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");
|
|
10401
10407
|
|
|
10402
10408
|
// node_modules/uuid/dist/esm-browser/stringify.js
|
|
10403
10409
|
var byteToHex = [];
|
|
@@ -10722,7 +10728,23 @@ function BillingPriceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
10722
10728
|
id: json["id"],
|
|
10723
10729
|
interval: json["interval"],
|
|
10724
10730
|
price: json["price"],
|
|
10725
|
-
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"],
|
|
10747
|
+
upTo: json["up_to"] == null ? void 0 : json["up_to"]
|
|
10726
10748
|
};
|
|
10727
10749
|
}
|
|
10728
10750
|
|
|
@@ -10735,6 +10757,7 @@ function BillingPriceViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
10735
10757
|
return json;
|
|
10736
10758
|
}
|
|
10737
10759
|
return {
|
|
10760
|
+
billingScheme: json["billing_scheme"],
|
|
10738
10761
|
createdAt: new Date(json["created_at"]),
|
|
10739
10762
|
currency: json["currency"],
|
|
10740
10763
|
id: json["id"],
|
|
@@ -10745,6 +10768,9 @@ function BillingPriceViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
10745
10768
|
priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"],
|
|
10746
10769
|
priceExternalId: json["price_external_id"],
|
|
10747
10770
|
priceId: json["price_id"],
|
|
10771
|
+
priceTier: json["price_tier"].map(
|
|
10772
|
+
BillingProductPriceTierResponseDataFromJSON
|
|
10773
|
+
),
|
|
10748
10774
|
productExternalId: json["product_external_id"],
|
|
10749
10775
|
productId: json["product_id"],
|
|
10750
10776
|
productName: json["product_name"],
|
|
@@ -10789,6 +10815,7 @@ function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDisc
|
|
|
10789
10815
|
return json;
|
|
10790
10816
|
}
|
|
10791
10817
|
return {
|
|
10818
|
+
billingScheme: json["billing_scheme"],
|
|
10792
10819
|
createdAt: new Date(json["created_at"]),
|
|
10793
10820
|
currency: json["currency"],
|
|
10794
10821
|
environmentId: json["environment_id"],
|
|
@@ -10801,6 +10828,9 @@ function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDisc
|
|
|
10801
10828
|
priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"],
|
|
10802
10829
|
priceExternalId: json["price_external_id"],
|
|
10803
10830
|
priceId: json["price_id"],
|
|
10831
|
+
priceTier: json["price_tier"].map(
|
|
10832
|
+
BillingProductPriceTierResponseDataFromJSON
|
|
10833
|
+
),
|
|
10804
10834
|
quantity: json["quantity"],
|
|
10805
10835
|
subscriptionId: json["subscription_id"],
|
|
10806
10836
|
updatedAt: new Date(json["updated_at"]),
|
|
@@ -10808,6 +10838,29 @@ function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDisc
|
|
|
10808
10838
|
};
|
|
10809
10839
|
}
|
|
10810
10840
|
|
|
10841
|
+
// src/api/models/BillingProductResponseData.ts
|
|
10842
|
+
function BillingProductResponseDataFromJSON(json) {
|
|
10843
|
+
return BillingProductResponseDataFromJSONTyped(json, false);
|
|
10844
|
+
}
|
|
10845
|
+
function BillingProductResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
10846
|
+
if (json == null) {
|
|
10847
|
+
return json;
|
|
10848
|
+
}
|
|
10849
|
+
return {
|
|
10850
|
+
accountId: json["account_id"],
|
|
10851
|
+
createdAt: new Date(json["created_at"]),
|
|
10852
|
+
currency: json["currency"],
|
|
10853
|
+
environmentId: json["environment_id"],
|
|
10854
|
+
externalId: json["external_id"],
|
|
10855
|
+
name: json["name"],
|
|
10856
|
+
price: json["price"],
|
|
10857
|
+
priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"],
|
|
10858
|
+
productId: json["product_id"],
|
|
10859
|
+
quantity: json["quantity"],
|
|
10860
|
+
updatedAt: new Date(json["updated_at"])
|
|
10861
|
+
};
|
|
10862
|
+
}
|
|
10863
|
+
|
|
10811
10864
|
// src/api/models/BillingSubscriptionDiscountView.ts
|
|
10812
10865
|
function BillingSubscriptionDiscountViewFromJSON(json) {
|
|
10813
10866
|
return BillingSubscriptionDiscountViewFromJSONTyped(json, false);
|
|
@@ -11478,6 +11531,7 @@ function PlanEntitlementResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
11478
11531
|
ruleIdUsageExceeded: json["rule_id_usage_exceeded"] == null ? void 0 : json["rule_id_usage_exceeded"],
|
|
11479
11532
|
softLimit: json["soft_limit"] == null ? void 0 : json["soft_limit"],
|
|
11480
11533
|
updatedAt: new Date(json["updated_at"]),
|
|
11534
|
+
usageBasedProduct: json["usage_based_product"] == null ? void 0 : BillingProductResponseDataFromJSON(json["usage_based_product"]),
|
|
11481
11535
|
valueBool: json["value_bool"] == null ? void 0 : json["value_bool"],
|
|
11482
11536
|
valueNumeric: json["value_numeric"] == null ? void 0 : json["value_numeric"],
|
|
11483
11537
|
valueTrait: json["value_trait"] == null ? void 0 : EntityTraitDefinitionResponseDataFromJSON(json["value_trait"]),
|
|
@@ -11826,6 +11880,26 @@ function ListInvoicesResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
11826
11880
|
};
|
|
11827
11881
|
}
|
|
11828
11882
|
|
|
11883
|
+
// src/api/models/PreviewSubscriptionFinanceResponseData.ts
|
|
11884
|
+
function PreviewSubscriptionFinanceResponseDataFromJSON(json) {
|
|
11885
|
+
return PreviewSubscriptionFinanceResponseDataFromJSONTyped(json, false);
|
|
11886
|
+
}
|
|
11887
|
+
function PreviewSubscriptionFinanceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
11888
|
+
if (json == null) {
|
|
11889
|
+
return json;
|
|
11890
|
+
}
|
|
11891
|
+
return {
|
|
11892
|
+
amountOff: json["amount_off"],
|
|
11893
|
+
dueNow: json["due_now"],
|
|
11894
|
+
newCharges: json["new_charges"],
|
|
11895
|
+
percentOff: json["percent_off"],
|
|
11896
|
+
periodStart: new Date(json["period_start"]),
|
|
11897
|
+
promoCodeApplied: json["promo_code_applied"],
|
|
11898
|
+
proration: json["proration"],
|
|
11899
|
+
trialEnd: json["trial_end"] == null ? void 0 : new Date(json["trial_end"])
|
|
11900
|
+
};
|
|
11901
|
+
}
|
|
11902
|
+
|
|
11829
11903
|
// src/api/models/PreviewSubscriptionChangeResponseData.ts
|
|
11830
11904
|
function PreviewSubscriptionChangeResponseDataFromJSON(json) {
|
|
11831
11905
|
return PreviewSubscriptionChangeResponseDataFromJSONTyped(json, false);
|
|
@@ -11837,12 +11911,16 @@ function PreviewSubscriptionChangeResponseDataFromJSONTyped(json, ignoreDiscrimi
|
|
|
11837
11911
|
return {
|
|
11838
11912
|
amountOff: json["amount_off"],
|
|
11839
11913
|
dueNow: json["due_now"],
|
|
11914
|
+
finance: json["finance"] == null ? void 0 : PreviewSubscriptionFinanceResponseDataFromJSON(json["finance"]),
|
|
11840
11915
|
newCharges: json["new_charges"],
|
|
11841
11916
|
percentOff: json["percent_off"],
|
|
11842
11917
|
periodStart: new Date(json["period_start"]),
|
|
11843
11918
|
promoCodeApplied: json["promo_code_applied"],
|
|
11844
11919
|
proration: json["proration"],
|
|
11845
|
-
trialEnd: json["trial_end"] == null ? void 0 : new Date(json["trial_end"])
|
|
11920
|
+
trialEnd: json["trial_end"] == null ? void 0 : new Date(json["trial_end"]),
|
|
11921
|
+
usageViolations: json["usage_violations"].map(
|
|
11922
|
+
FeatureUsageResponseDataFromJSON
|
|
11923
|
+
)
|
|
11846
11924
|
};
|
|
11847
11925
|
}
|
|
11848
11926
|
|
|
@@ -13111,7 +13189,7 @@ var EmbedProvider = ({
|
|
|
13111
13189
|
(0, import_react11.useEffect)(() => {
|
|
13112
13190
|
if (accessToken) {
|
|
13113
13191
|
const { headers = {} } = apiConfig ?? {};
|
|
13114
|
-
headers["X-Schematic-Components-Version"] = "0.7.
|
|
13192
|
+
headers["X-Schematic-Components-Version"] = "0.7.3";
|
|
13115
13193
|
headers["X-Schematic-Session-ID"] = sessionIdRef.current;
|
|
13116
13194
|
const config = new Configuration({
|
|
13117
13195
|
...apiConfig,
|
|
@@ -13450,16 +13528,10 @@ function useWrapChildren(elements) {
|
|
|
13450
13528
|
return shouldWrap.some((wrap) => wrap);
|
|
13451
13529
|
}
|
|
13452
13530
|
|
|
13453
|
-
// src/components/layout/card/Card.tsx
|
|
13454
|
-
var import_react20 = require("react");
|
|
13455
|
-
|
|
13456
13531
|
// src/components/ui/box/styles.ts
|
|
13457
13532
|
var Box = dt.div((props) => {
|
|
13458
13533
|
function reducer(acc, [key, value]) {
|
|
13459
|
-
if (key.startsWith("$") && ![
|
|
13460
|
-
"$viewport",
|
|
13461
|
-
...Object.values(TextPropNames).filter((prop) => prop !== "$color")
|
|
13462
|
-
].includes(key)) {
|
|
13534
|
+
if (key.startsWith("$") && !["$viewport"].includes(key)) {
|
|
13463
13535
|
acc.push(
|
|
13464
13536
|
// keys will always be CSS properties
|
|
13465
13537
|
attr(camelToHyphen(key.slice(1)), value)
|
|
@@ -13582,6 +13654,7 @@ var Button2 = (0, import_react16.forwardRef)(
|
|
|
13582
13654
|
children,
|
|
13583
13655
|
...props
|
|
13584
13656
|
}, ref) => {
|
|
13657
|
+
const theme = nt();
|
|
13585
13658
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
13586
13659
|
Button,
|
|
13587
13660
|
{
|
|
@@ -13592,7 +13665,7 @@ var Button2 = (0, import_react16.forwardRef)(
|
|
|
13592
13665
|
disabled,
|
|
13593
13666
|
...props,
|
|
13594
13667
|
children: [
|
|
13595
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Loader, { $size: "sm", $isLoading: isLoading }),
|
|
13668
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Loader, { $color: theme.primary, $size: "sm", $isLoading: isLoading }),
|
|
13596
13669
|
children
|
|
13597
13670
|
]
|
|
13598
13671
|
}
|
|
@@ -13669,6 +13742,8 @@ var EmbedButton = dt(Button2)`
|
|
|
13669
13742
|
font-family: "Public Sans", sans-serif;
|
|
13670
13743
|
font-weight: 500;
|
|
13671
13744
|
text-align: center;
|
|
13745
|
+
display: flex;
|
|
13746
|
+
align-items: center;
|
|
13672
13747
|
|
|
13673
13748
|
${({ disabled, $color = "primary", theme }) => {
|
|
13674
13749
|
const { l: l2 } = hexToHSL(theme[$color]);
|
|
@@ -13816,6 +13891,24 @@ var EmbedButton = dt(Button2)`
|
|
|
13816
13891
|
`;
|
|
13817
13892
|
}
|
|
13818
13893
|
}}
|
|
13894
|
+
|
|
13895
|
+
${({ $selfAlignment = "center" }) => {
|
|
13896
|
+
switch ($selfAlignment) {
|
|
13897
|
+
case "start":
|
|
13898
|
+
return lt`
|
|
13899
|
+
align-self: start;
|
|
13900
|
+
`;
|
|
13901
|
+
case "end":
|
|
13902
|
+
return lt`
|
|
13903
|
+
align-self: end;
|
|
13904
|
+
`;
|
|
13905
|
+
case "center":
|
|
13906
|
+
default:
|
|
13907
|
+
return lt`
|
|
13908
|
+
align-self: center;
|
|
13909
|
+
`;
|
|
13910
|
+
}
|
|
13911
|
+
}}
|
|
13819
13912
|
|
|
13820
13913
|
${({ $fullWidth = true }) => {
|
|
13821
13914
|
if ($fullWidth) {
|
|
@@ -14100,7 +14193,7 @@ var Loader = dt.div`
|
|
|
14100
14193
|
}
|
|
14101
14194
|
return lt`
|
|
14102
14195
|
border-color: ${color};
|
|
14103
|
-
border-top-color: ${colorFn(color,
|
|
14196
|
+
border-top-color: ${colorFn(color, 0.425)};
|
|
14104
14197
|
`;
|
|
14105
14198
|
}}
|
|
14106
14199
|
|
|
@@ -14280,8 +14373,11 @@ var ModalHeader = ({
|
|
|
14280
14373
|
};
|
|
14281
14374
|
|
|
14282
14375
|
// src/components/ui/progress-bar/styles.ts
|
|
14283
|
-
var Container3 = dt
|
|
14376
|
+
var Container3 = dt.div`
|
|
14284
14377
|
position: relative;
|
|
14378
|
+
display: flex;
|
|
14379
|
+
align-items: center;
|
|
14380
|
+
gap: 1rem;
|
|
14285
14381
|
`;
|
|
14286
14382
|
|
|
14287
14383
|
// src/components/ui/progress-bar/ProgressBar.tsx
|
|
@@ -14311,59 +14407,51 @@ var ProgressBar = ({
|
|
|
14311
14407
|
orange: "#DB6769",
|
|
14312
14408
|
red: "#EF4444"
|
|
14313
14409
|
};
|
|
14314
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
14315
|
-
|
|
14316
|
-
|
|
14317
|
-
|
|
14318
|
-
|
|
14319
|
-
|
|
14320
|
-
|
|
14321
|
-
|
|
14410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Container3, { ...props, children: [
|
|
14411
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
14412
|
+
Flex,
|
|
14413
|
+
{
|
|
14414
|
+
$position: "relative",
|
|
14415
|
+
$alignItems: "center",
|
|
14416
|
+
$width: `${barWidth}`,
|
|
14417
|
+
$maxWidth: "100%",
|
|
14418
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
14322
14419
|
Flex,
|
|
14323
14420
|
{
|
|
14324
14421
|
$position: "relative",
|
|
14325
|
-
$
|
|
14326
|
-
$width:
|
|
14327
|
-
$
|
|
14422
|
+
$overflow: "hidden",
|
|
14423
|
+
$width: "100%",
|
|
14424
|
+
$height: `${8 / TEXT_BASE_SIZE}rem`,
|
|
14425
|
+
$backgroundColor: bgColor,
|
|
14426
|
+
$borderRadius: "9999px",
|
|
14328
14427
|
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
14329
|
-
|
|
14428
|
+
Box,
|
|
14330
14429
|
{
|
|
14331
|
-
$
|
|
14332
|
-
$
|
|
14333
|
-
$
|
|
14334
|
-
$
|
|
14335
|
-
$backgroundColor: bgColor,
|
|
14336
|
-
$borderRadius: "9999px",
|
|
14337
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
14338
|
-
Box,
|
|
14339
|
-
{
|
|
14340
|
-
$width: `${Math.min(progress, 100)}%`,
|
|
14341
|
-
$height: "100%",
|
|
14342
|
-
$backgroundColor: barColorMap[color],
|
|
14343
|
-
$borderRadius: "9999px"
|
|
14344
|
-
}
|
|
14345
|
-
)
|
|
14430
|
+
$width: `${Math.min(progress, 100)}%`,
|
|
14431
|
+
$height: "100%",
|
|
14432
|
+
$backgroundColor: barColorMap[color],
|
|
14433
|
+
$borderRadius: "9999px"
|
|
14346
14434
|
}
|
|
14347
14435
|
)
|
|
14348
14436
|
}
|
|
14349
|
-
),
|
|
14350
|
-
total !== 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
14351
|
-
Text,
|
|
14352
|
-
{
|
|
14353
|
-
$font: theme.typography.text.fontFamily,
|
|
14354
|
-
$size: 14,
|
|
14355
|
-
$weight: 500,
|
|
14356
|
-
$color: theme.typography.text.color,
|
|
14357
|
-
children: [
|
|
14358
|
-
value,
|
|
14359
|
-
"/",
|
|
14360
|
-
total
|
|
14361
|
-
]
|
|
14362
|
-
}
|
|
14363
14437
|
)
|
|
14364
|
-
|
|
14365
|
-
|
|
14366
|
-
|
|
14438
|
+
}
|
|
14439
|
+
),
|
|
14440
|
+
total !== 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
14441
|
+
Text,
|
|
14442
|
+
{
|
|
14443
|
+
$font: theme.typography.text.fontFamily,
|
|
14444
|
+
$size: 14,
|
|
14445
|
+
$weight: 500,
|
|
14446
|
+
$color: theme.typography.text.color,
|
|
14447
|
+
children: [
|
|
14448
|
+
value,
|
|
14449
|
+
"/",
|
|
14450
|
+
total
|
|
14451
|
+
]
|
|
14452
|
+
}
|
|
14453
|
+
)
|
|
14454
|
+
] });
|
|
14367
14455
|
};
|
|
14368
14456
|
|
|
14369
14457
|
// src/components/ui/text/styles.ts
|
|
@@ -14376,8 +14464,7 @@ var TextPropNames = /* @__PURE__ */ ((TextPropNames2) => {
|
|
|
14376
14464
|
TextPropNames2["Leading"] = "$leading";
|
|
14377
14465
|
return TextPropNames2;
|
|
14378
14466
|
})(TextPropNames || {});
|
|
14379
|
-
var Text = dt
|
|
14380
|
-
as,
|
|
14467
|
+
var Text = dt.span.attrs(({ onClick }) => ({
|
|
14381
14468
|
...onClick && { tabIndex: 0 }
|
|
14382
14469
|
}))`
|
|
14383
14470
|
${({ $font }) => $font && lt`
|
|
@@ -14413,7 +14500,7 @@ var import_react19 = require("react");
|
|
|
14413
14500
|
var import_react_dom = require("react-dom");
|
|
14414
14501
|
|
|
14415
14502
|
// src/components/ui/tooltip/styles.ts
|
|
14416
|
-
var Trigger = dt
|
|
14503
|
+
var Trigger = dt.div``;
|
|
14417
14504
|
var coords = (position2) => {
|
|
14418
14505
|
let x2 = 0;
|
|
14419
14506
|
let y2 = 0;
|
|
@@ -14480,7 +14567,7 @@ var grow = (translate) => {
|
|
|
14480
14567
|
}
|
|
14481
14568
|
`;
|
|
14482
14569
|
};
|
|
14483
|
-
var Content = dt
|
|
14570
|
+
var Content = dt.div.withConfig({
|
|
14484
14571
|
shouldForwardProp: (prop) => !["x", "y", "position", "zIndex"].includes(prop)
|
|
14485
14572
|
})(({ x: x2, y: y2, position: position2, zIndex }) => {
|
|
14486
14573
|
const translate = coords(position2);
|
|
@@ -14597,6 +14684,7 @@ var Tooltip = ({
|
|
|
14597
14684
|
// src/components/layout/card/styles.ts
|
|
14598
14685
|
var Element = dt(Box)``;
|
|
14599
14686
|
var FussyChild = dt(Element)``;
|
|
14687
|
+
var Notice = dt(Box)``;
|
|
14600
14688
|
var cardBoxShadow = "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A";
|
|
14601
14689
|
var StyledCard = dt.div(({ theme }) => {
|
|
14602
14690
|
const { l: l2 } = hexToHSL(theme.card.background);
|
|
@@ -14624,6 +14712,11 @@ var StyledCard = dt.div(({ theme }) => {
|
|
|
14624
14712
|
`}
|
|
14625
14713
|
}
|
|
14626
14714
|
}
|
|
14715
|
+
|
|
14716
|
+
${Notice}:first-child {
|
|
14717
|
+
border-top-left-radius: ${borderRadius};
|
|
14718
|
+
border-top-right-radius: ${borderRadius};
|
|
14719
|
+
}
|
|
14627
14720
|
`;
|
|
14628
14721
|
});
|
|
14629
14722
|
|
|
@@ -14678,11 +14771,12 @@ Column.displayName = "Column";
|
|
|
14678
14771
|
var import_react22 = require("react");
|
|
14679
14772
|
|
|
14680
14773
|
// src/components/layout/root/styles.ts
|
|
14681
|
-
var Container2 = dt
|
|
14774
|
+
var Container2 = dt.div`
|
|
14682
14775
|
all: initial;
|
|
14683
14776
|
box-sizing: border-box;
|
|
14684
14777
|
display: block;
|
|
14685
14778
|
font-size: ${TEXT_BASE_SIZE}px;
|
|
14779
|
+
line-height: 1.35;
|
|
14686
14780
|
width: 100%;
|
|
14687
14781
|
height: 100%;
|
|
14688
14782
|
|
|
@@ -14953,29 +15047,36 @@ var Sidebar = ({
|
|
|
14953
15047
|
const isLightBackground = useIsLightBackground();
|
|
14954
15048
|
const currentPlan = data.company?.plan;
|
|
14955
15049
|
const currentAddOns = data.company?.addOns || [];
|
|
14956
|
-
const currentUsageBasedEntitlements =
|
|
14957
|
-
(
|
|
14958
|
-
|
|
14959
|
-
(
|
|
14960
|
-
|
|
14961
|
-
|
|
14962
|
-
|
|
14963
|
-
|
|
14964
|
-
|
|
14965
|
-
|
|
14966
|
-
|
|
14967
|
-
|
|
14968
|
-
|
|
14969
|
-
|
|
14970
|
-
|
|
14971
|
-
|
|
14972
|
-
|
|
14973
|
-
|
|
14974
|
-
|
|
14975
|
-
|
|
14976
|
-
|
|
14977
|
-
|
|
14978
|
-
|
|
15050
|
+
const currentUsageBasedEntitlements = (0, import_react23.useMemo)(() => {
|
|
15051
|
+
return (data.featureUsage?.features || []).reduce(
|
|
15052
|
+
(acc, entitlement) => {
|
|
15053
|
+
if (entitlement.priceBehavior && (planPeriod === "month" && entitlement.monthlyUsageBasedPrice || planPeriod === "year" && entitlement.yearlyUsageBasedPrice)) {
|
|
15054
|
+
const allocation = entitlement.allocation || 0;
|
|
15055
|
+
const usage = entitlement.usage || 0;
|
|
15056
|
+
acc.push({
|
|
15057
|
+
...entitlement,
|
|
15058
|
+
allocation,
|
|
15059
|
+
usage,
|
|
15060
|
+
quantity: allocation ?? usage
|
|
15061
|
+
});
|
|
15062
|
+
}
|
|
15063
|
+
return acc;
|
|
15064
|
+
},
|
|
15065
|
+
[]
|
|
15066
|
+
);
|
|
15067
|
+
}, [data.featureUsage?.features, planPeriod]);
|
|
15068
|
+
const { payAsYouGoEntitlements, payInAdvanceEntitlements } = (0, import_react23.useMemo)(() => {
|
|
15069
|
+
const payAsYouGoEntitlements2 = [];
|
|
15070
|
+
const payInAdvanceEntitlements2 = usageBasedEntitlements.filter(
|
|
15071
|
+
(entitlement) => {
|
|
15072
|
+
if (entitlement.priceBehavior === "pay_as_you_go") {
|
|
15073
|
+
payAsYouGoEntitlements2.push(entitlement);
|
|
15074
|
+
}
|
|
15075
|
+
return entitlement.priceBehavior === "pay_in_advance";
|
|
15076
|
+
}
|
|
15077
|
+
);
|
|
15078
|
+
return { payAsYouGoEntitlements: payAsYouGoEntitlements2, payInAdvanceEntitlements: payInAdvanceEntitlements2 };
|
|
15079
|
+
}, [usageBasedEntitlements]);
|
|
14979
15080
|
const subscriptionPrice = (0, import_react23.useMemo)(() => {
|
|
14980
15081
|
let planPrice;
|
|
14981
15082
|
let currency;
|
|
@@ -14992,15 +15093,17 @@ var Sidebar = ({
|
|
|
14992
15093
|
if (planPrice) {
|
|
14993
15094
|
total += planPrice;
|
|
14994
15095
|
}
|
|
14995
|
-
const addOnCost = addOns.reduce(
|
|
14996
|
-
(
|
|
14997
|
-
|
|
14998
|
-
|
|
14999
|
-
|
|
15000
|
-
|
|
15096
|
+
const addOnCost = addOns.reduce((sum, addOn) => {
|
|
15097
|
+
if (addOn.isSelected) {
|
|
15098
|
+
sum += getBillingPrice(
|
|
15099
|
+
planPeriod === "year" ? addOn.yearlyPrice : addOn.monthlyPrice
|
|
15100
|
+
)?.price ?? 0;
|
|
15101
|
+
}
|
|
15102
|
+
return sum;
|
|
15103
|
+
}, 0);
|
|
15001
15104
|
total += addOnCost;
|
|
15002
15105
|
const payInAdvanceCost = payInAdvanceEntitlements.reduce(
|
|
15003
|
-
(sum,
|
|
15106
|
+
(sum, entitlement) => sum + entitlement.quantity * (getBillingPrice(
|
|
15004
15107
|
planPeriod === "year" ? entitlement.meteredYearlyPrice : entitlement.meteredMonthlyPrice
|
|
15005
15108
|
)?.price ?? 0),
|
|
15006
15109
|
0
|
|
@@ -15050,8 +15153,8 @@ var Sidebar = ({
|
|
|
15050
15153
|
return acc;
|
|
15051
15154
|
}, []),
|
|
15052
15155
|
payInAdvance: payInAdvanceEntitlements.reduce(
|
|
15053
|
-
(acc, {
|
|
15054
|
-
const priceId2 = (planPeriod === "year" ?
|
|
15156
|
+
(acc, { meteredMonthlyPrice, meteredYearlyPrice, quantity }) => {
|
|
15157
|
+
const priceId2 = (planPeriod === "year" ? meteredYearlyPrice : meteredMonthlyPrice)?.priceId;
|
|
15055
15158
|
if (priceId2) {
|
|
15056
15159
|
acc.push({
|
|
15057
15160
|
priceId: priceId2,
|
|
@@ -15119,48 +15222,62 @@ var Sidebar = ({
|
|
|
15119
15222
|
({ quantity, usage }) => quantity >= usage
|
|
15120
15223
|
)) && !isLoading;
|
|
15121
15224
|
const canCheckout = canUpdateSubscription && (!!data.subscription?.paymentMethod || typeof paymentMethodId === "string");
|
|
15122
|
-
const
|
|
15123
|
-
|
|
15124
|
-
|
|
15125
|
-
|
|
15126
|
-
|
|
15127
|
-
|
|
15128
|
-
|
|
15129
|
-
|
|
15130
|
-
|
|
15131
|
-
|
|
15132
|
-
|
|
15133
|
-
|
|
15134
|
-
|
|
15135
|
-
|
|
15136
|
-
|
|
15137
|
-
|
|
15138
|
-
|
|
15139
|
-
|
|
15140
|
-
|
|
15141
|
-
|
|
15142
|
-
|
|
15143
|
-
|
|
15144
|
-
|
|
15145
|
-
|
|
15146
|
-
|
|
15147
|
-
|
|
15148
|
-
|
|
15149
|
-
|
|
15150
|
-
|
|
15151
|
-
|
|
15152
|
-
|
|
15153
|
-
|
|
15154
|
-
|
|
15155
|
-
|
|
15156
|
-
|
|
15157
|
-
|
|
15158
|
-
|
|
15159
|
-
|
|
15160
|
-
|
|
15161
|
-
|
|
15162
|
-
|
|
15163
|
-
|
|
15225
|
+
const {
|
|
15226
|
+
changedUsageBasedEntitlements,
|
|
15227
|
+
addedUsageBasedEntitlements,
|
|
15228
|
+
removedUsageBasedEntitlements,
|
|
15229
|
+
willUsageBasedEntitlementsChange
|
|
15230
|
+
} = (0, import_react23.useMemo)(() => {
|
|
15231
|
+
const changedUsageBasedEntitlements2 = [];
|
|
15232
|
+
const addedUsageBasedEntitlements2 = selectedPlan ? usageBasedEntitlements.reduce(
|
|
15233
|
+
(acc, selected) => {
|
|
15234
|
+
const changed = currentUsageBasedEntitlements.find(
|
|
15235
|
+
(current) => current.entitlementId === selected.id && current.quantity !== selected.quantity
|
|
15236
|
+
);
|
|
15237
|
+
if (changed) {
|
|
15238
|
+
changedUsageBasedEntitlements2.push({
|
|
15239
|
+
previous: changed,
|
|
15240
|
+
next: selected
|
|
15241
|
+
});
|
|
15242
|
+
} else {
|
|
15243
|
+
acc.push(selected);
|
|
15244
|
+
}
|
|
15245
|
+
return acc;
|
|
15246
|
+
},
|
|
15247
|
+
[]
|
|
15248
|
+
) : [];
|
|
15249
|
+
const removedUsageBasedEntitlements2 = selectedPlan ? currentUsageBasedEntitlements.reduce(
|
|
15250
|
+
(acc, current) => {
|
|
15251
|
+
const match2 = usageBasedEntitlements.every(
|
|
15252
|
+
(entitlement) => entitlement.id !== current.entitlementId
|
|
15253
|
+
) && data.featureUsage?.features.find(
|
|
15254
|
+
(usage) => usage.entitlementId === current.entitlementId
|
|
15255
|
+
);
|
|
15256
|
+
if (match2) {
|
|
15257
|
+
acc.push({
|
|
15258
|
+
...match2,
|
|
15259
|
+
allocation: current.allocation,
|
|
15260
|
+
usage: current.usage,
|
|
15261
|
+
quantity: current.quantity
|
|
15262
|
+
});
|
|
15263
|
+
}
|
|
15264
|
+
return acc;
|
|
15265
|
+
},
|
|
15266
|
+
[]
|
|
15267
|
+
) : [];
|
|
15268
|
+
const willUsageBasedEntitlementsChange2 = changedUsageBasedEntitlements2.length > 0 || addedUsageBasedEntitlements2.length > 0 || removedUsageBasedEntitlements2.length > 0;
|
|
15269
|
+
return {
|
|
15270
|
+
changedUsageBasedEntitlements: changedUsageBasedEntitlements2,
|
|
15271
|
+
addedUsageBasedEntitlements: addedUsageBasedEntitlements2,
|
|
15272
|
+
removedUsageBasedEntitlements: removedUsageBasedEntitlements2,
|
|
15273
|
+
willUsageBasedEntitlementsChange: willUsageBasedEntitlementsChange2
|
|
15274
|
+
};
|
|
15275
|
+
}, [
|
|
15276
|
+
selectedPlan,
|
|
15277
|
+
data.featureUsage?.features,
|
|
15278
|
+
currentUsageBasedEntitlements,
|
|
15279
|
+
usageBasedEntitlements
|
|
15280
|
+
]);
|
|
15164
15281
|
const removedAddOns = currentAddOns.filter(
|
|
15165
15282
|
(current) => !selectedAddOns.some((selected) => current.id === selected.id)
|
|
15166
15283
|
);
|
|
@@ -15364,13 +15481,13 @@ var Sidebar = ({
|
|
|
15364
15481
|
}
|
|
15365
15482
|
) }),
|
|
15366
15483
|
removedUsageBasedEntitlements.reduce(
|
|
15367
|
-
(acc,
|
|
15368
|
-
if (typeof allocation === "number" &&
|
|
15484
|
+
(acc, entitlement, index) => {
|
|
15485
|
+
if (typeof entitlement.allocation === "number" && entitlement.feature?.name) {
|
|
15369
15486
|
const {
|
|
15370
15487
|
price: entitlementPrice,
|
|
15371
15488
|
currency: entitlementCurrency
|
|
15372
15489
|
} = getBillingPrice(
|
|
15373
|
-
planPeriod === "year" ?
|
|
15490
|
+
planPeriod === "year" ? entitlement.yearlyUsageBasedPrice : entitlement.monthlyUsageBasedPrice
|
|
15374
15491
|
) || {};
|
|
15375
15492
|
acc.push(
|
|
15376
15493
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
@@ -15390,11 +15507,14 @@ var Sidebar = ({
|
|
|
15390
15507
|
$size: theme.typography.heading4.fontSize,
|
|
15391
15508
|
$weight: theme.typography.heading4.fontWeight,
|
|
15392
15509
|
$color: theme.typography.heading4.color,
|
|
15393
|
-
children:
|
|
15394
|
-
quantity,
|
|
15510
|
+
children: entitlement.priceBehavior === "pay_in_advance" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
15511
|
+
entitlement.quantity,
|
|
15395
15512
|
" ",
|
|
15396
|
-
getFeatureName(
|
|
15397
|
-
|
|
15513
|
+
getFeatureName(
|
|
15514
|
+
entitlement.feature,
|
|
15515
|
+
entitlement.quantity
|
|
15516
|
+
)
|
|
15517
|
+
] }) : entitlement.feature.name
|
|
15398
15518
|
}
|
|
15399
15519
|
) }),
|
|
15400
15520
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
@@ -15405,9 +15525,9 @@ var Sidebar = ({
|
|
|
15405
15525
|
$weight: theme.typography.text.fontWeight,
|
|
15406
15526
|
$color: theme.typography.text.color,
|
|
15407
15527
|
children: [
|
|
15408
|
-
|
|
15528
|
+
entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
15409
15529
|
formatCurrency(
|
|
15410
|
-
(entitlementPrice ?? 0) * quantity,
|
|
15530
|
+
(entitlementPrice ?? 0) * entitlement.quantity,
|
|
15411
15531
|
entitlementCurrency
|
|
15412
15532
|
),
|
|
15413
15533
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("sub", { children: [
|
|
@@ -15415,14 +15535,14 @@ var Sidebar = ({
|
|
|
15415
15535
|
shortenPeriod(planPeriod)
|
|
15416
15536
|
] })
|
|
15417
15537
|
] }),
|
|
15418
|
-
|
|
15538
|
+
entitlement.priceBehavior === "pay_as_you_go" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
15419
15539
|
formatCurrency(
|
|
15420
15540
|
entitlementPrice ?? 0,
|
|
15421
15541
|
entitlementCurrency
|
|
15422
15542
|
),
|
|
15423
15543
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("sub", { children: [
|
|
15424
15544
|
"/",
|
|
15425
|
-
getFeatureName(
|
|
15545
|
+
getFeatureName(entitlement.feature, 1)
|
|
15426
15546
|
] })
|
|
15427
15547
|
] })
|
|
15428
15548
|
]
|
|
@@ -15439,13 +15559,13 @@ var Sidebar = ({
|
|
|
15439
15559
|
[]
|
|
15440
15560
|
),
|
|
15441
15561
|
changedUsageBasedEntitlements.reduce(
|
|
15442
|
-
(acc, {
|
|
15443
|
-
if (
|
|
15562
|
+
(acc, { previous, next: next2 }, index) => {
|
|
15563
|
+
if (next2.feature?.name) {
|
|
15444
15564
|
const {
|
|
15445
15565
|
price: entitlementPrice,
|
|
15446
15566
|
currency: entitlementCurrency
|
|
15447
15567
|
} = getBillingPrice(
|
|
15448
|
-
planPeriod === "year" ?
|
|
15568
|
+
planPeriod === "year" ? next2.meteredYearlyPrice : next2.meteredMonthlyPrice
|
|
15449
15569
|
) || {};
|
|
15450
15570
|
acc.push(
|
|
15451
15571
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Box, { children: [
|
|
@@ -15469,7 +15589,7 @@ var Sidebar = ({
|
|
|
15469
15589
|
children: [
|
|
15470
15590
|
previous.quantity,
|
|
15471
15591
|
" ",
|
|
15472
|
-
getFeatureName(
|
|
15592
|
+
getFeatureName(next2.feature)
|
|
15473
15593
|
]
|
|
15474
15594
|
}
|
|
15475
15595
|
) }),
|
|
@@ -15512,7 +15632,7 @@ var Sidebar = ({
|
|
|
15512
15632
|
children: [
|
|
15513
15633
|
next2.quantity,
|
|
15514
15634
|
" ",
|
|
15515
|
-
getFeatureName(
|
|
15635
|
+
getFeatureName(next2.feature)
|
|
15516
15636
|
]
|
|
15517
15637
|
}
|
|
15518
15638
|
) }),
|
|
@@ -15546,7 +15666,7 @@ var Sidebar = ({
|
|
|
15546
15666
|
[]
|
|
15547
15667
|
),
|
|
15548
15668
|
addedUsageBasedEntitlements.reduce(
|
|
15549
|
-
(acc,
|
|
15669
|
+
(acc, entitlement, index) => {
|
|
15550
15670
|
if (entitlement.feature?.name) {
|
|
15551
15671
|
const {
|
|
15552
15672
|
price: entitlementPrice,
|
|
@@ -15570,9 +15690,12 @@ var Sidebar = ({
|
|
|
15570
15690
|
$weight: theme.typography.heading4.fontWeight,
|
|
15571
15691
|
$color: theme.typography.heading4.color,
|
|
15572
15692
|
children: entitlement.priceBehavior === "pay_in_advance" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
15573
|
-
quantity,
|
|
15693
|
+
entitlement.quantity,
|
|
15574
15694
|
" ",
|
|
15575
|
-
getFeatureName(
|
|
15695
|
+
getFeatureName(
|
|
15696
|
+
entitlement.feature,
|
|
15697
|
+
entitlement.quantity
|
|
15698
|
+
)
|
|
15576
15699
|
] }) : entitlement.feature.name
|
|
15577
15700
|
}
|
|
15578
15701
|
) }),
|
|
@@ -15586,7 +15709,7 @@ var Sidebar = ({
|
|
|
15586
15709
|
children: [
|
|
15587
15710
|
entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
15588
15711
|
formatCurrency(
|
|
15589
|
-
(entitlementPrice ?? 0) * quantity,
|
|
15712
|
+
(entitlementPrice ?? 0) * entitlement.quantity,
|
|
15590
15713
|
entitlementCurrency
|
|
15591
15714
|
),
|
|
15592
15715
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("sub", { children: [
|
|
@@ -16441,7 +16564,7 @@ var Checkout = ({
|
|
|
16441
16564
|
$alignItems: "center",
|
|
16442
16565
|
$flexGrow: 1,
|
|
16443
16566
|
$marginTop: "-3.5rem",
|
|
16444
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Loader, { $size: "3xl" })
|
|
16567
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Loader, { $color: theme.primary, $size: "3xl" })
|
|
16445
16568
|
}
|
|
16446
16569
|
);
|
|
16447
16570
|
}
|
|
@@ -17047,7 +17170,7 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
|
|
|
17047
17170
|
const unitPriceFontSize = 0.875 * theme.typography.text.fontSize;
|
|
17048
17171
|
const unitPriceColor = hexToHSL(theme.typography.text.color).l > 50 ? darken(theme.typography.text.color, 0.46) : lighten(theme.typography.text.color, 0.46);
|
|
17049
17172
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: entitlements.reduce(
|
|
17050
|
-
(acc,
|
|
17173
|
+
(acc, entitlement, index) => {
|
|
17051
17174
|
if (entitlement.priceBehavior === "pay_in_advance" && entitlement.feature) {
|
|
17052
17175
|
const { price, currency } = getBillingPrice(
|
|
17053
17176
|
period === "year" ? entitlement.meteredYearlyPrice : entitlement.meteredMonthlyPrice
|
|
@@ -17106,8 +17229,8 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
|
|
|
17106
17229
|
{
|
|
17107
17230
|
$size: "lg",
|
|
17108
17231
|
type: "number",
|
|
17109
|
-
value: quantity,
|
|
17110
|
-
min: usage,
|
|
17232
|
+
value: entitlement.quantity,
|
|
17233
|
+
min: entitlement.usage,
|
|
17111
17234
|
autoFocus: true,
|
|
17112
17235
|
onFocus: (event) => event.target.select(),
|
|
17113
17236
|
onChange: (event) => {
|
|
@@ -17127,12 +17250,12 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
|
|
|
17127
17250
|
$weight: theme.typography.text.fontWeight,
|
|
17128
17251
|
$color: unitPriceColor,
|
|
17129
17252
|
children: [
|
|
17130
|
-
quantity < usage && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { style: { color: "#DB6669" }, children: [
|
|
17253
|
+
entitlement.quantity < entitlement.usage && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { style: { color: "#DB6669" }, children: [
|
|
17131
17254
|
t2("Cannot downgrade entitlement"),
|
|
17132
17255
|
" "
|
|
17133
17256
|
] }),
|
|
17134
17257
|
t2("Currently using", {
|
|
17135
|
-
quantity: usage,
|
|
17258
|
+
quantity: entitlement.usage,
|
|
17136
17259
|
unit: getFeatureName(entitlement.feature)
|
|
17137
17260
|
})
|
|
17138
17261
|
]
|
|
@@ -17155,7 +17278,10 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
|
|
|
17155
17278
|
$weight: theme.typography.text.fontWeight,
|
|
17156
17279
|
$color: theme.typography.text.color,
|
|
17157
17280
|
children: [
|
|
17158
|
-
formatCurrency(
|
|
17281
|
+
formatCurrency(
|
|
17282
|
+
(price ?? 0) * entitlement.quantity,
|
|
17283
|
+
currency
|
|
17284
|
+
),
|
|
17159
17285
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("sub", { children: [
|
|
17160
17286
|
"/",
|
|
17161
17287
|
shortenPeriod(period)
|
|
@@ -17198,6 +17324,22 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
|
|
|
17198
17324
|
|
|
17199
17325
|
// src/components/shared/checkout-dialog/CheckoutDialog.tsx
|
|
17200
17326
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
17327
|
+
var createActiveUsageBasedEntitlementsReducer = (entitlements, period) => (acc, entitlement) => {
|
|
17328
|
+
if (entitlement.priceBehavior && (period === "month" && entitlement.meteredMonthlyPrice || period === "year" && entitlement.meteredYearlyPrice)) {
|
|
17329
|
+
const featureUsage = entitlements.find(
|
|
17330
|
+
(usage2) => usage2.feature?.id === entitlement.feature?.id
|
|
17331
|
+
);
|
|
17332
|
+
const allocation = featureUsage?.allocation || 0;
|
|
17333
|
+
const usage = featureUsage?.usage || 0;
|
|
17334
|
+
acc.push({
|
|
17335
|
+
...entitlement,
|
|
17336
|
+
allocation,
|
|
17337
|
+
usage,
|
|
17338
|
+
quantity: allocation
|
|
17339
|
+
});
|
|
17340
|
+
}
|
|
17341
|
+
return acc;
|
|
17342
|
+
};
|
|
17201
17343
|
var CheckoutDialog = ({ top = 0 }) => {
|
|
17202
17344
|
const { t: t2 } = useTranslation();
|
|
17203
17345
|
const theme = nt();
|
|
@@ -17231,34 +17373,21 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
17231
17373
|
)
|
|
17232
17374
|
}))
|
|
17233
17375
|
);
|
|
17234
|
-
const
|
|
17235
|
-
|
|
17236
|
-
|
|
17237
|
-
const featureUsage = data.featureUsage?.features.find(
|
|
17238
|
-
(usage2) => usage2.feature?.id === entitlement.feature?.id
|
|
17239
|
-
);
|
|
17240
|
-
const allocation = featureUsage?.allocation ?? 0;
|
|
17241
|
-
const usage = featureUsage?.usage ?? 0;
|
|
17242
|
-
acc.push({
|
|
17243
|
-
entitlement,
|
|
17244
|
-
allocation,
|
|
17245
|
-
quantity: allocation,
|
|
17246
|
-
usage
|
|
17247
|
-
});
|
|
17248
|
-
}
|
|
17249
|
-
return acc;
|
|
17250
|
-
},
|
|
17251
|
-
[planPeriod, data.featureUsage?.features]
|
|
17252
|
-
);
|
|
17376
|
+
const currentEntitlements = (0, import_react26.useMemo)(() => {
|
|
17377
|
+
return data.featureUsage?.features || [];
|
|
17378
|
+
}, [data.featureUsage?.features]);
|
|
17253
17379
|
const [usageBasedEntitlements, setUsageBasedEntitlements] = (0, import_react26.useState)(
|
|
17254
17380
|
() => (selectedPlan?.entitlements || []).reduce(
|
|
17255
|
-
createActiveUsageBasedEntitlementsReducer(
|
|
17381
|
+
createActiveUsageBasedEntitlementsReducer(
|
|
17382
|
+
currentEntitlements,
|
|
17383
|
+
planPeriod
|
|
17384
|
+
),
|
|
17256
17385
|
[]
|
|
17257
17386
|
)
|
|
17258
17387
|
);
|
|
17259
17388
|
const payInAdvanceEntitlements = (0, import_react26.useMemo)(
|
|
17260
17389
|
() => usageBasedEntitlements.filter(
|
|
17261
|
-
(
|
|
17390
|
+
(entitlement) => entitlement.priceBehavior === "pay_in_advance"
|
|
17262
17391
|
),
|
|
17263
17392
|
[usageBasedEntitlements]
|
|
17264
17393
|
);
|
|
@@ -17350,8 +17479,8 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
17350
17479
|
[]
|
|
17351
17480
|
),
|
|
17352
17481
|
payInAdvance: (updates.payInAdvanceEntitlements || payInAdvanceEntitlements).reduce(
|
|
17353
|
-
(acc, {
|
|
17354
|
-
const priceId = (period === "year" ?
|
|
17482
|
+
(acc, { meteredMonthlyPrice, meteredYearlyPrice, quantity }) => {
|
|
17483
|
+
const priceId = (period === "year" ? meteredYearlyPrice : meteredMonthlyPrice)?.priceId;
|
|
17355
17484
|
if (priceId) {
|
|
17356
17485
|
acc.push({
|
|
17357
17486
|
priceId,
|
|
@@ -17365,7 +17494,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
17365
17494
|
promoCode: updates.promoCode || promoCode
|
|
17366
17495
|
}
|
|
17367
17496
|
});
|
|
17368
|
-
setCharges(data2);
|
|
17497
|
+
setCharges(data2.finance);
|
|
17369
17498
|
} catch (error2) {
|
|
17370
17499
|
if (error2 instanceof ResponseError && error2.response.status === 401) {
|
|
17371
17500
|
const data2 = await error2.response.json();
|
|
@@ -17400,7 +17529,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
17400
17529
|
}
|
|
17401
17530
|
const period = updates.period || planPeriod;
|
|
17402
17531
|
const entitlements = plan.entitlements.reduce(
|
|
17403
|
-
createActiveUsageBasedEntitlementsReducer(period),
|
|
17532
|
+
createActiveUsageBasedEntitlementsReducer(currentEntitlements, period),
|
|
17404
17533
|
[]
|
|
17405
17534
|
);
|
|
17406
17535
|
if (updates.plan) {
|
|
@@ -17411,16 +17540,11 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
17411
17540
|
period,
|
|
17412
17541
|
plan: updates.plan,
|
|
17413
17542
|
payInAdvanceEntitlements: entitlements.filter(
|
|
17414
|
-
({
|
|
17543
|
+
({ priceBehavior }) => priceBehavior === "pay_in_advance"
|
|
17415
17544
|
)
|
|
17416
17545
|
});
|
|
17417
17546
|
},
|
|
17418
|
-
[
|
|
17419
|
-
planPeriod,
|
|
17420
|
-
selectedPlan,
|
|
17421
|
-
createActiveUsageBasedEntitlementsReducer,
|
|
17422
|
-
previewCheckout
|
|
17423
|
-
]
|
|
17547
|
+
[planPeriod, selectedPlan, currentEntitlements, previewCheckout]
|
|
17424
17548
|
);
|
|
17425
17549
|
const changePlanPeriod = (0, import_react26.useCallback)(
|
|
17426
17550
|
(period) => {
|
|
@@ -17443,16 +17567,14 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
17443
17567
|
(id, updatedQuantity) => {
|
|
17444
17568
|
setUsageBasedEntitlements((prev2) => {
|
|
17445
17569
|
const updated = prev2.map(
|
|
17446
|
-
(
|
|
17447
|
-
entitlement,
|
|
17448
|
-
|
|
17449
|
-
|
|
17450
|
-
usage
|
|
17451
|
-
} : { entitlement, allocation, quantity, usage }
|
|
17570
|
+
(entitlement) => entitlement.id === id ? {
|
|
17571
|
+
...entitlement,
|
|
17572
|
+
quantity: updatedQuantity
|
|
17573
|
+
} : entitlement
|
|
17452
17574
|
);
|
|
17453
17575
|
previewCheckout({
|
|
17454
17576
|
payInAdvanceEntitlements: updated.filter(
|
|
17455
|
-
({
|
|
17577
|
+
({ priceBehavior }) => priceBehavior === "pay_in_advance"
|
|
17456
17578
|
)
|
|
17457
17579
|
});
|
|
17458
17580
|
return updated;
|
|
@@ -17581,7 +17703,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
17581
17703
|
$size: theme.typography.heading3.fontSize,
|
|
17582
17704
|
$weight: theme.typography.heading3.fontWeight,
|
|
17583
17705
|
$color: theme.typography.heading3.color,
|
|
17584
|
-
|
|
17706
|
+
style: { marginBottom: "0.5rem" },
|
|
17585
17707
|
children: activeCheckoutStage.label
|
|
17586
17708
|
}
|
|
17587
17709
|
),
|
|
@@ -17856,11 +17978,11 @@ var PeriodToggle = ({
|
|
|
17856
17978
|
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
17857
17979
|
Text,
|
|
17858
17980
|
{
|
|
17859
|
-
$flexShrink: 0,
|
|
17860
17981
|
$font: theme.typography.text.fontFamily,
|
|
17861
17982
|
$size: 15,
|
|
17862
17983
|
$weight: option === selectedOption ? 600 : 400,
|
|
17863
17984
|
$color: theme.typography.text.color,
|
|
17985
|
+
style: { flexShrink: 0 },
|
|
17864
17986
|
children: t2("Billed", { period: adjectify(option) })
|
|
17865
17987
|
}
|
|
17866
17988
|
)
|
|
@@ -17920,23 +18042,9 @@ var UnsubscribeDialog = ({ top = 0 }) => {
|
|
|
17920
18042
|
),
|
|
17921
18043
|
[data.company?.plan, planPeriod, availablePlans]
|
|
17922
18044
|
);
|
|
18045
|
+
const currentEntitlements = data.featureUsage?.features || [];
|
|
17923
18046
|
const usageBasedEntitlements = (selectedPlan?.entitlements || []).reduce(
|
|
17924
|
-
(
|
|
17925
|
-
if (entitlement.priceBehavior && (planPeriod === "month" && entitlement.meteredMonthlyPrice || planPeriod === "year" && entitlement.meteredYearlyPrice)) {
|
|
17926
|
-
const featureUsage = data.featureUsage?.features.find(
|
|
17927
|
-
(usage2) => usage2.feature?.id === entitlement.feature?.id
|
|
17928
|
-
);
|
|
17929
|
-
const allocation = featureUsage?.allocation ?? 0;
|
|
17930
|
-
const usage = featureUsage?.usage ?? 0;
|
|
17931
|
-
acc.push({
|
|
17932
|
-
entitlement,
|
|
17933
|
-
allocation,
|
|
17934
|
-
quantity: allocation,
|
|
17935
|
-
usage
|
|
17936
|
-
});
|
|
17937
|
-
}
|
|
17938
|
-
return acc;
|
|
17939
|
-
},
|
|
18047
|
+
createActiveUsageBasedEntitlementsReducer(currentEntitlements, planPeriod),
|
|
17940
18048
|
[]
|
|
17941
18049
|
);
|
|
17942
18050
|
const addOns = (0, import_react29.useMemo)(
|
|
@@ -18259,21 +18367,18 @@ var RenderLayout = ({ children }) => {
|
|
|
18259
18367
|
};
|
|
18260
18368
|
|
|
18261
18369
|
// src/components/layout/viewport/styles.ts
|
|
18262
|
-
var StyledViewport = dt
|
|
18263
|
-
$gridTemplateColumns: "repeat(1, minmax(300px, 1fr))",
|
|
18264
|
-
$viewport: {
|
|
18265
|
-
md: {
|
|
18266
|
-
$gridTemplateColumns: `repeat(${theme.numberOfColumns}, minmax(300px, 1fr))`
|
|
18267
|
-
}
|
|
18268
|
-
}
|
|
18269
|
-
})).withConfig({
|
|
18370
|
+
var StyledViewport = dt.div.withConfig({
|
|
18270
18371
|
shouldForwardProp: (prop) => !["$numberOfColumns", "numberOfColumns"].includes(prop)
|
|
18271
18372
|
})`
|
|
18272
18373
|
display: grid;
|
|
18273
|
-
|
|
18374
|
+
grid-template-columns: repeat(1, minmax(300px, 1fr));
|
|
18274
18375
|
margin-left: auto;
|
|
18275
18376
|
margin-right: auto;
|
|
18276
18377
|
gap: 1rem;
|
|
18378
|
+
|
|
18379
|
+
@media (min-width: 768px) {
|
|
18380
|
+
grid-template-columns: ${({ theme }) => lt`repeat(${theme.numberOfColumns}, minmax(300px, 1fr))`};
|
|
18381
|
+
}
|
|
18277
18382
|
`;
|
|
18278
18383
|
|
|
18279
18384
|
// src/components/layout/viewport/Viewport.tsx
|
|
@@ -18314,9 +18419,72 @@ var Viewport = (0, import_react30.forwardRef)(
|
|
|
18314
18419
|
);
|
|
18315
18420
|
Viewport.displayName = "Viewport";
|
|
18316
18421
|
|
|
18317
|
-
// src/components/elements/
|
|
18318
|
-
var import_react31 = require("react");
|
|
18422
|
+
// src/components/elements/button/Button.tsx
|
|
18319
18423
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
18424
|
+
var resolveDesignProps = (props) => {
|
|
18425
|
+
return {
|
|
18426
|
+
button: {
|
|
18427
|
+
link: props.button?.link ?? "",
|
|
18428
|
+
openInNewTab: props.button?.openInNewTab ?? true,
|
|
18429
|
+
text: props.button?.text ?? "Button",
|
|
18430
|
+
style: props.button?.style ?? "primary",
|
|
18431
|
+
size: props.button?.size ?? "md",
|
|
18432
|
+
fullWidth: props.button?.fullWidth ?? true,
|
|
18433
|
+
alignment: props.button?.alignment ?? "center",
|
|
18434
|
+
selfAlignment: props.button?.selfAlignment ?? "center"
|
|
18435
|
+
}
|
|
18436
|
+
};
|
|
18437
|
+
};
|
|
18438
|
+
var ButtonElement = (0, import_react31.forwardRef)(({ children, className, ...rest }, ref) => {
|
|
18439
|
+
const props = resolveDesignProps(rest);
|
|
18440
|
+
const buttonStyles = {
|
|
18441
|
+
primary: {
|
|
18442
|
+
color: "primary",
|
|
18443
|
+
variant: "filled"
|
|
18444
|
+
},
|
|
18445
|
+
secondary: {
|
|
18446
|
+
color: "primary",
|
|
18447
|
+
variant: "outline"
|
|
18448
|
+
},
|
|
18449
|
+
tertiary: {
|
|
18450
|
+
color: "primary",
|
|
18451
|
+
variant: "text"
|
|
18452
|
+
}
|
|
18453
|
+
};
|
|
18454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
18455
|
+
Element,
|
|
18456
|
+
{
|
|
18457
|
+
as: Flex,
|
|
18458
|
+
ref,
|
|
18459
|
+
className,
|
|
18460
|
+
$flexDirection: "column",
|
|
18461
|
+
$gap: "2rem",
|
|
18462
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
18463
|
+
EmbedButton,
|
|
18464
|
+
{
|
|
18465
|
+
as: "a",
|
|
18466
|
+
href: props.button.link,
|
|
18467
|
+
target: props.button.openInNewTab ? "_blank" : "_self",
|
|
18468
|
+
$size: props.button.size,
|
|
18469
|
+
$color: buttonStyles[props.button.style].color,
|
|
18470
|
+
$variant: buttonStyles[props.button.style].variant,
|
|
18471
|
+
$alignment: props.button.alignment,
|
|
18472
|
+
$selfAlignment: props.button.selfAlignment,
|
|
18473
|
+
$fullWidth: props.button.fullWidth,
|
|
18474
|
+
children: props.button.text
|
|
18475
|
+
}
|
|
18476
|
+
)
|
|
18477
|
+
}
|
|
18478
|
+
);
|
|
18479
|
+
});
|
|
18480
|
+
ButtonElement.displayName = "Button";
|
|
18481
|
+
|
|
18482
|
+
// src/components/elements/included-features/IncludedFeatures.tsx
|
|
18483
|
+
var import_react33 = require("react");
|
|
18484
|
+
|
|
18485
|
+
// src/components/elements/included-features/Details.tsx
|
|
18486
|
+
var import_react32 = require("react");
|
|
18487
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
18320
18488
|
var Details = ({
|
|
18321
18489
|
shouldWrapChildren,
|
|
18322
18490
|
featureUsage,
|
|
@@ -18334,7 +18502,7 @@ var Details = ({
|
|
|
18334
18502
|
const { t: t2 } = useTranslation();
|
|
18335
18503
|
const theme = nt();
|
|
18336
18504
|
const { data } = useEmbed();
|
|
18337
|
-
const { price, currency } = (0,
|
|
18505
|
+
const { price, currency } = (0, import_react32.useMemo)(() => {
|
|
18338
18506
|
const { price: entitlementPrice, currency: entitlementCurrency } = getBillingPrice(
|
|
18339
18507
|
data.company?.plan?.planPeriod === "year" ? yearlyUsageBasedPrice : monthlyUsageBasedPrice
|
|
18340
18508
|
) || {};
|
|
@@ -18344,7 +18512,7 @@ var Details = ({
|
|
|
18344
18512
|
monthlyUsageBasedPrice,
|
|
18345
18513
|
yearlyUsageBasedPrice
|
|
18346
18514
|
]);
|
|
18347
|
-
const text = (0,
|
|
18515
|
+
const text = (0, import_react32.useMemo)(() => {
|
|
18348
18516
|
if (!feature) {
|
|
18349
18517
|
return;
|
|
18350
18518
|
}
|
|
@@ -18364,7 +18532,7 @@ var Details = ({
|
|
|
18364
18532
|
return t2("Unlimited", { item: getFeatureName(feature) });
|
|
18365
18533
|
}
|
|
18366
18534
|
}, [t2, allocation, feature, price, priceBehavior, currency, softLimit]);
|
|
18367
|
-
const usageText = (0,
|
|
18535
|
+
const usageText = (0, import_react32.useMemo)(() => {
|
|
18368
18536
|
if (!feature) {
|
|
18369
18537
|
return;
|
|
18370
18538
|
}
|
|
@@ -18408,14 +18576,14 @@ var Details = ({
|
|
|
18408
18576
|
if (!text) {
|
|
18409
18577
|
return null;
|
|
18410
18578
|
}
|
|
18411
|
-
return /* @__PURE__ */ (0,
|
|
18579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
18412
18580
|
Box,
|
|
18413
18581
|
{
|
|
18414
18582
|
$flexBasis: "min-content",
|
|
18415
18583
|
$flexGrow: "1",
|
|
18416
18584
|
$textAlign: shouldWrapChildren ? "left" : "right",
|
|
18417
18585
|
children: [
|
|
18418
|
-
props.entitlement.isVisible && /* @__PURE__ */ (0,
|
|
18586
|
+
props.entitlement.isVisible && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
18419
18587
|
Text,
|
|
18420
18588
|
{
|
|
18421
18589
|
$font: theme.typography[props.entitlement.fontStyle].fontFamily,
|
|
@@ -18426,7 +18594,7 @@ var Details = ({
|
|
|
18426
18594
|
children: text
|
|
18427
18595
|
}
|
|
18428
18596
|
) }),
|
|
18429
|
-
props.usage.isVisible && usageText && /* @__PURE__ */ (0,
|
|
18597
|
+
props.usage.isVisible && usageText && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
18430
18598
|
Text,
|
|
18431
18599
|
{
|
|
18432
18600
|
$font: theme.typography[props.usage.fontStyle].fontFamily,
|
|
@@ -18443,8 +18611,8 @@ var Details = ({
|
|
|
18443
18611
|
};
|
|
18444
18612
|
|
|
18445
18613
|
// src/components/elements/included-features/IncludedFeatures.tsx
|
|
18446
|
-
var
|
|
18447
|
-
function
|
|
18614
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
18615
|
+
function resolveDesignProps2(props) {
|
|
18448
18616
|
return {
|
|
18449
18617
|
header: {
|
|
18450
18618
|
isVisible: props.header?.isVisible ?? true,
|
|
@@ -18472,16 +18640,16 @@ function resolveDesignProps(props) {
|
|
|
18472
18640
|
visibleFeatures: props.visibleFeatures
|
|
18473
18641
|
};
|
|
18474
18642
|
}
|
|
18475
|
-
var IncludedFeatures = (0,
|
|
18476
|
-
const props =
|
|
18643
|
+
var IncludedFeatures = (0, import_react33.forwardRef)(({ className, ...rest }, ref) => {
|
|
18644
|
+
const props = resolveDesignProps2(rest);
|
|
18477
18645
|
const { t: t2 } = useTranslation();
|
|
18478
18646
|
const theme = nt();
|
|
18479
18647
|
const { data } = useEmbed();
|
|
18480
|
-
const elements = (0,
|
|
18648
|
+
const elements = (0, import_react33.useRef)([]);
|
|
18481
18649
|
const shouldWrapChildren = useWrapChildren(elements.current);
|
|
18482
18650
|
const isLightBackground = useIsLightBackground();
|
|
18483
|
-
const [showCount, setShowCount] = (0,
|
|
18484
|
-
const featureUsage = (0,
|
|
18651
|
+
const [showCount, setShowCount] = (0, import_react33.useState)(VISIBLE_ENTITLEMENT_COUNT);
|
|
18652
|
+
const featureUsage = (0, import_react33.useMemo)(() => {
|
|
18485
18653
|
const orderedFeatureUsage = props.visibleFeatures?.reduce(
|
|
18486
18654
|
(acc, id) => {
|
|
18487
18655
|
const mappedFeatureUsage = data.featureUsage?.features.find(
|
|
@@ -18508,7 +18676,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
18508
18676
|
}
|
|
18509
18677
|
const shouldShowExpand = featureListSize > VISIBLE_ENTITLEMENT_COUNT;
|
|
18510
18678
|
const isExpanded = showCount > VISIBLE_ENTITLEMENT_COUNT;
|
|
18511
|
-
return /* @__PURE__ */ (0,
|
|
18679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
18512
18680
|
Element,
|
|
18513
18681
|
{
|
|
18514
18682
|
as: Flex,
|
|
@@ -18517,7 +18685,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
18517
18685
|
$flexDirection: "column",
|
|
18518
18686
|
$gap: "1rem",
|
|
18519
18687
|
children: [
|
|
18520
|
-
props.header.isVisible && /* @__PURE__ */ (0,
|
|
18688
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18521
18689
|
Text,
|
|
18522
18690
|
{
|
|
18523
18691
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -18530,7 +18698,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
18530
18698
|
featureUsage.slice(0, showCount).map((usage, index) => {
|
|
18531
18699
|
const feature = usage.feature;
|
|
18532
18700
|
const shouldShowDetails = feature?.name && (feature?.featureType === "event" || feature?.featureType === "trait");
|
|
18533
|
-
return /* @__PURE__ */ (0,
|
|
18701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
18534
18702
|
Flex,
|
|
18535
18703
|
{
|
|
18536
18704
|
ref: (el) => {
|
|
@@ -18543,7 +18711,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
18543
18711
|
$alignItems: "center",
|
|
18544
18712
|
$gap: "1rem",
|
|
18545
18713
|
children: [
|
|
18546
|
-
/* @__PURE__ */ (0,
|
|
18714
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
18547
18715
|
Flex,
|
|
18548
18716
|
{
|
|
18549
18717
|
$alignItems: "center",
|
|
@@ -18551,7 +18719,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
18551
18719
|
$flexBasis: "min-content",
|
|
18552
18720
|
$gap: "1rem",
|
|
18553
18721
|
children: [
|
|
18554
|
-
props.icons.isVisible && feature?.icon && /* @__PURE__ */ (0,
|
|
18722
|
+
props.icons.isVisible && feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18555
18723
|
IconRound,
|
|
18556
18724
|
{
|
|
18557
18725
|
name: feature.icon,
|
|
@@ -18562,7 +18730,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
18562
18730
|
]
|
|
18563
18731
|
}
|
|
18564
18732
|
),
|
|
18565
|
-
feature?.name && /* @__PURE__ */ (0,
|
|
18733
|
+
feature?.name && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18566
18734
|
Text,
|
|
18567
18735
|
{
|
|
18568
18736
|
$font: theme.typography[props.icons.fontStyle].fontFamily,
|
|
@@ -18572,7 +18740,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
18572
18740
|
children: feature.name
|
|
18573
18741
|
}
|
|
18574
18742
|
),
|
|
18575
|
-
props.entitlementExpiration.isVisible && usage.entitlementExpirationDate && /* @__PURE__ */ (0,
|
|
18743
|
+
props.entitlementExpiration.isVisible && usage.entitlementExpirationDate && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
18576
18744
|
Text,
|
|
18577
18745
|
{
|
|
18578
18746
|
$font: theme.typography[props.entitlementExpiration.fontStyle].fontFamily,
|
|
@@ -18592,7 +18760,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
18592
18760
|
]
|
|
18593
18761
|
}
|
|
18594
18762
|
),
|
|
18595
|
-
shouldShowDetails && /* @__PURE__ */ (0,
|
|
18763
|
+
shouldShowDetails && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18596
18764
|
Details,
|
|
18597
18765
|
{
|
|
18598
18766
|
featureUsage: usage,
|
|
@@ -18605,8 +18773,8 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
18605
18773
|
index
|
|
18606
18774
|
);
|
|
18607
18775
|
}),
|
|
18608
|
-
shouldShowExpand && /* @__PURE__ */ (0,
|
|
18609
|
-
/* @__PURE__ */ (0,
|
|
18776
|
+
shouldShowExpand && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $alignItems: "center", $justifyContent: "start", $marginTop: "1rem", children: [
|
|
18777
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18610
18778
|
Icon2,
|
|
18611
18779
|
{
|
|
18612
18780
|
name: isExpanded ? "chevron-up" : "chevron-down",
|
|
@@ -18618,7 +18786,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
18618
18786
|
}
|
|
18619
18787
|
}
|
|
18620
18788
|
),
|
|
18621
|
-
/* @__PURE__ */ (0,
|
|
18789
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18622
18790
|
Text,
|
|
18623
18791
|
{
|
|
18624
18792
|
onClick: handleToggleShowAll,
|
|
@@ -18639,9 +18807,9 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
18639
18807
|
IncludedFeatures.displayName = "IncludedFeatures";
|
|
18640
18808
|
|
|
18641
18809
|
// src/components/elements/invoices/Invoices.tsx
|
|
18642
|
-
var
|
|
18643
|
-
var
|
|
18644
|
-
function
|
|
18810
|
+
var import_react34 = require("react");
|
|
18811
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
18812
|
+
function resolveDesignProps3(props) {
|
|
18645
18813
|
return {
|
|
18646
18814
|
header: {
|
|
18647
18815
|
isVisible: props.header?.isVisible ?? true,
|
|
@@ -18674,7 +18842,7 @@ function formatInvoices(invoices = []) {
|
|
|
18674
18842
|
}
|
|
18675
18843
|
var InvoiceDate = ({ date, fontStyle, url }) => {
|
|
18676
18844
|
const theme = nt();
|
|
18677
|
-
const dateText = /* @__PURE__ */ (0,
|
|
18845
|
+
const dateText = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18678
18846
|
Text,
|
|
18679
18847
|
{
|
|
18680
18848
|
...url && { onClick: () => {
|
|
@@ -18687,23 +18855,23 @@ var InvoiceDate = ({ date, fontStyle, url }) => {
|
|
|
18687
18855
|
}
|
|
18688
18856
|
);
|
|
18689
18857
|
if (url) {
|
|
18690
|
-
return /* @__PURE__ */ (0,
|
|
18858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("a", { href: url, target: "_blank", rel: "noreferrer", children: dateText });
|
|
18691
18859
|
}
|
|
18692
18860
|
return dateText;
|
|
18693
18861
|
};
|
|
18694
|
-
var Invoices = (0,
|
|
18695
|
-
const props =
|
|
18862
|
+
var Invoices = (0, import_react34.forwardRef)(({ className, data, ...rest }, ref) => {
|
|
18863
|
+
const props = resolveDesignProps3(rest);
|
|
18696
18864
|
const { t: t2 } = useTranslation();
|
|
18697
18865
|
const theme = nt();
|
|
18698
18866
|
const { api } = useEmbed();
|
|
18699
|
-
const [invoices, setInvoices] = (0,
|
|
18700
|
-
const [listSize, setListSize] = (0,
|
|
18867
|
+
const [invoices, setInvoices] = (0, import_react34.useState)(() => formatInvoices(data));
|
|
18868
|
+
const [listSize, setListSize] = (0, import_react34.useState)(props.limit.number);
|
|
18701
18869
|
const toggleListSize = () => {
|
|
18702
18870
|
setListSize(
|
|
18703
18871
|
(prev2) => prev2 !== props.limit.number ? props.limit.number : MAX_VISIBLE_INVOICE_COUNT
|
|
18704
18872
|
);
|
|
18705
18873
|
};
|
|
18706
|
-
(0,
|
|
18874
|
+
(0, import_react34.useEffect)(() => {
|
|
18707
18875
|
api?.listInvoices().then(({ data: data2 }) => {
|
|
18708
18876
|
setInvoices(formatInvoices(data2));
|
|
18709
18877
|
});
|
|
@@ -18711,8 +18879,8 @@ var Invoices = (0, import_react33.forwardRef)(({ className, data, ...rest }, ref
|
|
|
18711
18879
|
if (invoices.length === 0) {
|
|
18712
18880
|
return null;
|
|
18713
18881
|
}
|
|
18714
|
-
return /* @__PURE__ */ (0,
|
|
18715
|
-
props.header.isVisible && /* @__PURE__ */ (0,
|
|
18882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Element, { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
18883
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18716
18884
|
Text,
|
|
18717
18885
|
{
|
|
18718
18886
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -18722,9 +18890,9 @@ var Invoices = (0, import_react33.forwardRef)(({ className, data, ...rest }, ref
|
|
|
18722
18890
|
children: t2("Invoices")
|
|
18723
18891
|
}
|
|
18724
18892
|
) }),
|
|
18725
|
-
/* @__PURE__ */ (0,
|
|
18726
|
-
return /* @__PURE__ */ (0,
|
|
18727
|
-
props.date.isVisible && date && /* @__PURE__ */ (0,
|
|
18893
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(0, listSize).map(({ date, amount, url }, index) => {
|
|
18894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $justifyContent: "space-between", children: [
|
|
18895
|
+
props.date.isVisible && date && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18728
18896
|
InvoiceDate,
|
|
18729
18897
|
{
|
|
18730
18898
|
date,
|
|
@@ -18732,7 +18900,7 @@ var Invoices = (0, import_react33.forwardRef)(({ className, data, ...rest }, ref
|
|
|
18732
18900
|
url
|
|
18733
18901
|
}
|
|
18734
18902
|
),
|
|
18735
|
-
props.amount.isVisible && /* @__PURE__ */ (0,
|
|
18903
|
+
props.amount.isVisible && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18736
18904
|
Text,
|
|
18737
18905
|
{
|
|
18738
18906
|
$font: theme.typography[props.amount.fontStyle].fontFamily,
|
|
@@ -18744,15 +18912,15 @@ var Invoices = (0, import_react33.forwardRef)(({ className, data, ...rest }, ref
|
|
|
18744
18912
|
)
|
|
18745
18913
|
] }, index);
|
|
18746
18914
|
}) }),
|
|
18747
|
-
props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */ (0,
|
|
18748
|
-
/* @__PURE__ */ (0,
|
|
18915
|
+
props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
|
|
18916
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18749
18917
|
Icon2,
|
|
18750
18918
|
{
|
|
18751
18919
|
name: `chevron-${listSize === props.limit.number ? "down" : "up"}`,
|
|
18752
18920
|
style: { color: "#D0D0D0" }
|
|
18753
18921
|
}
|
|
18754
18922
|
),
|
|
18755
|
-
/* @__PURE__ */ (0,
|
|
18923
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18756
18924
|
Text,
|
|
18757
18925
|
{
|
|
18758
18926
|
onClick: toggleListSize,
|
|
@@ -18769,10 +18937,11 @@ var Invoices = (0, import_react33.forwardRef)(({ className, data, ...rest }, ref
|
|
|
18769
18937
|
Invoices.displayName = "Invoices";
|
|
18770
18938
|
|
|
18771
18939
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
18772
|
-
var
|
|
18940
|
+
var import_react35 = require("react");
|
|
18773
18941
|
|
|
18774
18942
|
// src/components/elements/metered-features/styles.ts
|
|
18775
|
-
var Container4 = dt
|
|
18943
|
+
var Container4 = dt.div`
|
|
18944
|
+
display: flex;
|
|
18776
18945
|
flex-direction: column;
|
|
18777
18946
|
gap: 1rem;
|
|
18778
18947
|
|
|
@@ -18811,8 +18980,8 @@ var Container4 = dt(Flex)`
|
|
|
18811
18980
|
`;
|
|
18812
18981
|
|
|
18813
18982
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
18814
|
-
var
|
|
18815
|
-
function
|
|
18983
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
18984
|
+
function resolveDesignProps4(props) {
|
|
18816
18985
|
return {
|
|
18817
18986
|
isVisible: props.isVisible ?? true,
|
|
18818
18987
|
header: {
|
|
@@ -18837,15 +19006,15 @@ function resolveDesignProps3(props) {
|
|
|
18837
19006
|
visibleFeatures: props.visibleFeatures
|
|
18838
19007
|
};
|
|
18839
19008
|
}
|
|
18840
|
-
var MeteredFeatures = (0,
|
|
18841
|
-
const props =
|
|
18842
|
-
const elements = (0,
|
|
19009
|
+
var MeteredFeatures = (0, import_react35.forwardRef)(({ className, ...rest }, ref) => {
|
|
19010
|
+
const props = resolveDesignProps4(rest);
|
|
19011
|
+
const elements = (0, import_react35.useRef)([]);
|
|
18843
19012
|
const shouldWrapChildren = useWrapChildren(elements.current);
|
|
18844
19013
|
const { t: t2 } = useTranslation();
|
|
18845
19014
|
const theme = nt();
|
|
18846
19015
|
const { data, setLayout, setSelected } = useEmbed();
|
|
18847
19016
|
const isLightBackground = useIsLightBackground();
|
|
18848
|
-
const featureUsage = (0,
|
|
19017
|
+
const featureUsage = (0, import_react35.useMemo)(() => {
|
|
18849
19018
|
const orderedFeatureUsage = props.visibleFeatures?.reduce(
|
|
18850
19019
|
(acc, id) => {
|
|
18851
19020
|
const mappedFeatureUsage = data.featureUsage?.features.find(
|
|
@@ -18867,7 +19036,7 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18867
19036
|
if (!shouldShowFeatures) {
|
|
18868
19037
|
return null;
|
|
18869
19038
|
}
|
|
18870
|
-
return /* @__PURE__ */ (0,
|
|
19039
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Container4, { ref, className, children: featureUsage.map(
|
|
18871
19040
|
({
|
|
18872
19041
|
feature,
|
|
18873
19042
|
priceBehavior,
|
|
@@ -18883,7 +19052,7 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18883
19052
|
const { price, currency } = getBillingPrice(
|
|
18884
19053
|
planPeriod === "year" ? yearlyUsageBasedPrice : monthlyUsageBasedPrice
|
|
18885
19054
|
) || {};
|
|
18886
|
-
const progressBar = props.isVisible && typeof usage === "number" && limit > 0 && priceBehavior !== "pay_as_you_go" && /* @__PURE__ */ (0,
|
|
19055
|
+
const progressBar = props.isVisible && typeof usage === "number" && limit > 0 && priceBehavior !== "pay_as_you_go" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18887
19056
|
ProgressBar,
|
|
18888
19057
|
{
|
|
18889
19058
|
progress: (isOverage ? softLimit / usage : usage / limit) * 100,
|
|
@@ -18896,8 +19065,8 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18896
19065
|
$flexGrow: 1
|
|
18897
19066
|
}
|
|
18898
19067
|
);
|
|
18899
|
-
return /* @__PURE__ */ (0,
|
|
18900
|
-
priceBehavior === "overage" && typeof price === "number" && /* @__PURE__ */ (0,
|
|
19068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Flex, { $flexDirection: "column-reverse", children: [
|
|
19069
|
+
priceBehavior === "overage" && typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
18901
19070
|
Flex,
|
|
18902
19071
|
{
|
|
18903
19072
|
$justifyContent: "space-between",
|
|
@@ -18909,7 +19078,7 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18909
19078
|
$borderBottomRightRadius: `${theme.card.borderRadius / TEXT_BASE_SIZE}rem`
|
|
18910
19079
|
},
|
|
18911
19080
|
children: [
|
|
18912
|
-
/* @__PURE__ */ (0,
|
|
19081
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18913
19082
|
Text,
|
|
18914
19083
|
{
|
|
18915
19084
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18917,14 +19086,14 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18917
19086
|
$weight: theme.typography.text.fontWeight,
|
|
18918
19087
|
$color: theme.typography.text.color,
|
|
18919
19088
|
$leading: 1.35,
|
|
18920
|
-
children: /* @__PURE__ */ (0,
|
|
19089
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
18921
19090
|
t2("Overage fee"),
|
|
18922
19091
|
": ",
|
|
18923
19092
|
formatCurrency(price, currency),
|
|
18924
|
-
feature && /* @__PURE__ */ (0,
|
|
19093
|
+
feature && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Box, { as: "sub", $whiteSpace: "nowrap", children: [
|
|
18925
19094
|
"/",
|
|
18926
19095
|
getFeatureName(feature, 1),
|
|
18927
|
-
feature.featureType === "trait" && planPeriod && /* @__PURE__ */ (0,
|
|
19096
|
+
feature.featureType === "trait" && planPeriod && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
18928
19097
|
"/",
|
|
18929
19098
|
shortenPeriod(planPeriod)
|
|
18930
19099
|
] })
|
|
@@ -18932,7 +19101,7 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18932
19101
|
] })
|
|
18933
19102
|
}
|
|
18934
19103
|
),
|
|
18935
|
-
isOverage && /* @__PURE__ */ (0,
|
|
19104
|
+
isOverage && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
18936
19105
|
Text,
|
|
18937
19106
|
{
|
|
18938
19107
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18946,7 +19115,7 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18946
19115
|
}),
|
|
18947
19116
|
" \xB7 ",
|
|
18948
19117
|
formatCurrency(price * (usage - softLimit), currency),
|
|
18949
|
-
feature?.featureType === "trait" && typeof planPeriod === "string" && /* @__PURE__ */ (0,
|
|
19118
|
+
feature?.featureType === "trait" && typeof planPeriod === "string" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Box, { as: "sub", $whiteSpace: "nowrap", children: [
|
|
18950
19119
|
"/",
|
|
18951
19120
|
shortenPeriod(planPeriod)
|
|
18952
19121
|
] })
|
|
@@ -18956,8 +19125,8 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18956
19125
|
]
|
|
18957
19126
|
}
|
|
18958
19127
|
),
|
|
18959
|
-
/* @__PURE__ */ (0,
|
|
18960
|
-
props.icon.isVisible && feature?.icon && /* @__PURE__ */ (0,
|
|
19128
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Element, { as: Flex, $gap: "1.5rem", children: [
|
|
19129
|
+
props.icon.isVisible && feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18961
19130
|
IconRound,
|
|
18962
19131
|
{
|
|
18963
19132
|
name: feature.icon,
|
|
@@ -18968,8 +19137,8 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18968
19137
|
]
|
|
18969
19138
|
}
|
|
18970
19139
|
),
|
|
18971
|
-
/* @__PURE__ */ (0,
|
|
18972
|
-
/* @__PURE__ */ (0,
|
|
19140
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
|
|
19141
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
18973
19142
|
Flex,
|
|
18974
19143
|
{
|
|
18975
19144
|
ref: (el) => {
|
|
@@ -18980,8 +19149,8 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18980
19149
|
$flexWrap: "wrap",
|
|
18981
19150
|
$gap: "1rem",
|
|
18982
19151
|
children: [
|
|
18983
|
-
feature?.name && /* @__PURE__ */ (0,
|
|
18984
|
-
/* @__PURE__ */ (0,
|
|
19152
|
+
feature?.name && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
|
|
19153
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18985
19154
|
Text,
|
|
18986
19155
|
{
|
|
18987
19156
|
as: Box,
|
|
@@ -18990,14 +19159,14 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18990
19159
|
$weight: theme.typography[props.header.fontStyle].fontWeight,
|
|
18991
19160
|
$color: theme.typography[props.header.fontStyle].color,
|
|
18992
19161
|
$leading: 1.35,
|
|
18993
|
-
children: priceBehavior === "pay_as_you_go" ? typeof usage === "number" && /* @__PURE__ */ (0,
|
|
19162
|
+
children: priceBehavior === "pay_as_you_go" ? typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
18994
19163
|
formatNumber(usage),
|
|
18995
19164
|
" ",
|
|
18996
19165
|
getFeatureName(feature, usage)
|
|
18997
19166
|
] }) : feature.name
|
|
18998
19167
|
}
|
|
18999
19168
|
),
|
|
19000
|
-
props.description.isVisible && /* @__PURE__ */ (0,
|
|
19169
|
+
props.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
19001
19170
|
Text,
|
|
19002
19171
|
{
|
|
19003
19172
|
as: Box,
|
|
@@ -19009,14 +19178,14 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
19009
19178
|
}
|
|
19010
19179
|
)
|
|
19011
19180
|
] }),
|
|
19012
|
-
(feature?.featureType === "event" || feature?.featureType === "trait") && feature?.name && /* @__PURE__ */ (0,
|
|
19181
|
+
(feature?.featureType === "event" || feature?.featureType === "trait") && feature?.name && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
19013
19182
|
Box,
|
|
19014
19183
|
{
|
|
19015
19184
|
$flexBasis: "min-content",
|
|
19016
19185
|
$flexGrow: 1,
|
|
19017
19186
|
$textAlign: shouldWrapChildren ? "left" : "right",
|
|
19018
19187
|
children: [
|
|
19019
|
-
props.usage.isVisible && /* @__PURE__ */ (0,
|
|
19188
|
+
props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
19020
19189
|
Text,
|
|
19021
19190
|
{
|
|
19022
19191
|
as: Box,
|
|
@@ -19025,22 +19194,22 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
19025
19194
|
$weight: theme.typography[props.usage.fontStyle].fontWeight,
|
|
19026
19195
|
$color: theme.typography[props.usage.fontStyle].color,
|
|
19027
19196
|
$leading: 1.35,
|
|
19028
|
-
children: priceBehavior === "pay_in_advance" ? typeof allocation === "number" && /* @__PURE__ */ (0,
|
|
19197
|
+
children: priceBehavior === "pay_in_advance" ? typeof allocation === "number" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
19029
19198
|
formatNumber(allocation),
|
|
19030
19199
|
" ",
|
|
19031
19200
|
getFeatureName(feature, allocation)
|
|
19032
|
-
] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price, currency) : typeof usage === "number" && /* @__PURE__ */ (0,
|
|
19201
|
+
] }) : 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: [
|
|
19033
19202
|
formatNumber(usage),
|
|
19034
19203
|
" ",
|
|
19035
19204
|
getFeatureName(feature, usage),
|
|
19036
|
-
priceBehavior === "overage" && /* @__PURE__ */ (0,
|
|
19205
|
+
priceBehavior === "overage" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
19037
19206
|
" ",
|
|
19038
19207
|
t2("used")
|
|
19039
19208
|
] })
|
|
19040
19209
|
] })
|
|
19041
19210
|
}
|
|
19042
19211
|
),
|
|
19043
|
-
props.allocation.isVisible && priceBehavior !== "overage" && /* @__PURE__ */ (0,
|
|
19212
|
+
props.allocation.isVisible && priceBehavior !== "overage" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
19044
19213
|
Text,
|
|
19045
19214
|
{
|
|
19046
19215
|
$font: theme.typography[props.allocation.fontStyle].fontFamily,
|
|
@@ -19065,12 +19234,12 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
19065
19234
|
]
|
|
19066
19235
|
}
|
|
19067
19236
|
),
|
|
19068
|
-
props.isVisible && typeof usage === "number" && priceBehavior !== "pay_as_you_go" && /* @__PURE__ */ (0,
|
|
19069
|
-
typeof allocation === "number" ? /* @__PURE__ */ (0,
|
|
19237
|
+
props.isVisible && typeof usage === "number" && priceBehavior !== "pay_as_you_go" && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Flex, { $gap: "2rem", children: [
|
|
19238
|
+
typeof allocation === "number" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
19070
19239
|
Tooltip,
|
|
19071
19240
|
{
|
|
19072
19241
|
trigger: progressBar,
|
|
19073
|
-
content: /* @__PURE__ */ (0,
|
|
19242
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
19074
19243
|
Text,
|
|
19075
19244
|
{
|
|
19076
19245
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19087,7 +19256,7 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
19087
19256
|
$flexGrow: 1
|
|
19088
19257
|
}
|
|
19089
19258
|
) : progressBar,
|
|
19090
|
-
priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0,
|
|
19259
|
+
priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
19091
19260
|
EmbedButton,
|
|
19092
19261
|
{
|
|
19093
19262
|
onClick: () => {
|
|
@@ -19111,11 +19280,11 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
19111
19280
|
MeteredFeatures.displayName = "MeteredFeatures";
|
|
19112
19281
|
|
|
19113
19282
|
// src/components/elements/payment-method/PaymentMethod.tsx
|
|
19114
|
-
var
|
|
19283
|
+
var import_react37 = require("react");
|
|
19115
19284
|
|
|
19116
19285
|
// src/components/elements/payment-method/PaymentMethodElement.tsx
|
|
19117
|
-
var
|
|
19118
|
-
var
|
|
19286
|
+
var import_react36 = require("react");
|
|
19287
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
19119
19288
|
var PaymentElement2 = ({
|
|
19120
19289
|
iconName,
|
|
19121
19290
|
iconTitle,
|
|
@@ -19124,17 +19293,17 @@ var PaymentElement2 = ({
|
|
|
19124
19293
|
paymentLast4
|
|
19125
19294
|
}) => {
|
|
19126
19295
|
const theme = nt();
|
|
19127
|
-
return /* @__PURE__ */ (0,
|
|
19128
|
-
iconName && /* @__PURE__ */ (0,
|
|
19129
|
-
/* @__PURE__ */ (0,
|
|
19130
|
-
/* @__PURE__ */ (0,
|
|
19131
|
-
paymentLast4 && /* @__PURE__ */ (0,
|
|
19296
|
+
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: [
|
|
19297
|
+
iconName && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Icon2, { name: iconName, title: iconTitle, style: iconStyles }) }),
|
|
19298
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex, { $alignItems: "center", children: [
|
|
19299
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { $lineHeight: "1", $marginRight: "4px", children: t(label) }),
|
|
19300
|
+
paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { $display: "inline-block", $fontWeight: "bold", children: paymentLast4 })
|
|
19132
19301
|
] })
|
|
19133
19302
|
] }) });
|
|
19134
19303
|
};
|
|
19135
19304
|
var EmptyPaymentElement = () => {
|
|
19136
19305
|
const theme = nt();
|
|
19137
|
-
return /* @__PURE__ */ (0,
|
|
19306
|
+
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") }) }) }) });
|
|
19138
19307
|
};
|
|
19139
19308
|
var getPaymentMethodData = ({
|
|
19140
19309
|
accountLast4,
|
|
@@ -19223,9 +19392,9 @@ var PaymentMethodElement = ({
|
|
|
19223
19392
|
if (size === "md") {
|
|
19224
19393
|
sizeFactor = 1;
|
|
19225
19394
|
}
|
|
19226
|
-
return /* @__PURE__ */ (0,
|
|
19227
|
-
props.header.isVisible && /* @__PURE__ */ (0,
|
|
19228
|
-
/* @__PURE__ */ (0,
|
|
19395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
|
|
19396
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
|
|
19397
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19229
19398
|
Text,
|
|
19230
19399
|
{
|
|
19231
19400
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -19235,7 +19404,7 @@ var PaymentMethodElement = ({
|
|
|
19235
19404
|
children: t2("Payment Method")
|
|
19236
19405
|
}
|
|
19237
19406
|
),
|
|
19238
|
-
props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ (0,
|
|
19407
|
+
props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19239
19408
|
Text,
|
|
19240
19409
|
{
|
|
19241
19410
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19246,7 +19415,7 @@ var PaymentMethodElement = ({
|
|
|
19246
19415
|
}
|
|
19247
19416
|
)
|
|
19248
19417
|
] }),
|
|
19249
|
-
/* @__PURE__ */ (0,
|
|
19418
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19250
19419
|
Flex,
|
|
19251
19420
|
{
|
|
19252
19421
|
$justifyContent: "space-between",
|
|
@@ -19255,15 +19424,15 @@ var PaymentMethodElement = ({
|
|
|
19255
19424
|
$padding: `${sizeFactor / 2.2}rem ${sizeFactor}rem`,
|
|
19256
19425
|
$borderRadius: "9999px",
|
|
19257
19426
|
children: [
|
|
19258
|
-
paymentMethod && /* @__PURE__ */ (0,
|
|
19427
|
+
paymentMethod && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19259
19428
|
PaymentElement2,
|
|
19260
19429
|
{
|
|
19261
19430
|
...getPaymentMethodData(paymentMethod),
|
|
19262
19431
|
...getIconStyles({ size, theme })
|
|
19263
19432
|
}
|
|
19264
19433
|
),
|
|
19265
|
-
!paymentMethod && /* @__PURE__ */ (0,
|
|
19266
|
-
props.functions.allowEdit && onEdit && /* @__PURE__ */ (0,
|
|
19434
|
+
!paymentMethod && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(EmptyPaymentElement, {}),
|
|
19435
|
+
props.functions.allowEdit && onEdit && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19267
19436
|
Text,
|
|
19268
19437
|
{
|
|
19269
19438
|
onClick: onEdit,
|
|
@@ -19289,7 +19458,7 @@ var PaymentListElement = ({
|
|
|
19289
19458
|
const isLightBackground = useIsLightBackground();
|
|
19290
19459
|
const { iconName, iconTitle, label, paymentLast4 } = getPaymentMethodData(paymentMethod);
|
|
19291
19460
|
const iconStyles = getIconStyles({ size: "lg", theme });
|
|
19292
|
-
const expirationDate = (0,
|
|
19461
|
+
const expirationDate = (0, import_react36.useMemo)(() => {
|
|
19293
19462
|
const { cardExpMonth, cardExpYear } = paymentMethod;
|
|
19294
19463
|
if (!cardExpMonth && !cardExpYear) {
|
|
19295
19464
|
return "";
|
|
@@ -19303,7 +19472,7 @@ var PaymentListElement = ({
|
|
|
19303
19472
|
}
|
|
19304
19473
|
return `${cardExpMonth}/${formatedYear}`;
|
|
19305
19474
|
}, [paymentMethod]);
|
|
19306
|
-
return /* @__PURE__ */ (0,
|
|
19475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19307
19476
|
Flex,
|
|
19308
19477
|
{
|
|
19309
19478
|
$flexDirection: "row",
|
|
@@ -19317,8 +19486,8 @@ var PaymentListElement = ({
|
|
|
19317
19486
|
$font: theme.typography.text.fontFamily,
|
|
19318
19487
|
$color: theme.typography.text.color,
|
|
19319
19488
|
children: [
|
|
19320
|
-
/* @__PURE__ */ (0,
|
|
19321
|
-
/* @__PURE__ */ (0,
|
|
19489
|
+
/* @__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 }) }),
|
|
19490
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { $flexGrow: "1", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19322
19491
|
Text,
|
|
19323
19492
|
{
|
|
19324
19493
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19332,12 +19501,12 @@ var PaymentListElement = ({
|
|
|
19332
19501
|
]
|
|
19333
19502
|
}
|
|
19334
19503
|
) }),
|
|
19335
|
-
/* @__PURE__ */ (0,
|
|
19504
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19336
19505
|
Box,
|
|
19337
19506
|
{
|
|
19338
19507
|
$flexGrow: "1",
|
|
19339
19508
|
$color: isLightBackground ? "hsla(0, 0%, 0%, 0.375)" : "hsla(0, 0%, 100%, 0.375)",
|
|
19340
|
-
children: /* @__PURE__ */ (0,
|
|
19509
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19341
19510
|
Text,
|
|
19342
19511
|
{
|
|
19343
19512
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19349,7 +19518,7 @@ var PaymentListElement = ({
|
|
|
19349
19518
|
)
|
|
19350
19519
|
}
|
|
19351
19520
|
),
|
|
19352
|
-
/* @__PURE__ */ (0,
|
|
19521
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19353
19522
|
Text,
|
|
19354
19523
|
{
|
|
19355
19524
|
onClick: () => {
|
|
@@ -19362,7 +19531,7 @@ var PaymentListElement = ({
|
|
|
19362
19531
|
children: t("Set default")
|
|
19363
19532
|
}
|
|
19364
19533
|
) }),
|
|
19365
|
-
/* @__PURE__ */ (0,
|
|
19534
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19366
19535
|
Box,
|
|
19367
19536
|
{
|
|
19368
19537
|
$cursor: "pointer",
|
|
@@ -19370,7 +19539,7 @@ var PaymentListElement = ({
|
|
|
19370
19539
|
onClick: () => {
|
|
19371
19540
|
handleDelete(paymentMethod.id);
|
|
19372
19541
|
},
|
|
19373
|
-
children: /* @__PURE__ */ (0,
|
|
19542
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19374
19543
|
Icon2,
|
|
19375
19544
|
{
|
|
19376
19545
|
name: "close",
|
|
@@ -19388,8 +19557,8 @@ var PaymentListElement = ({
|
|
|
19388
19557
|
};
|
|
19389
19558
|
|
|
19390
19559
|
// src/components/elements/payment-method/PaymentMethod.tsx
|
|
19391
|
-
var
|
|
19392
|
-
var
|
|
19560
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
19561
|
+
var resolveDesignProps5 = (props) => {
|
|
19393
19562
|
return {
|
|
19394
19563
|
header: {
|
|
19395
19564
|
isVisible: props.header?.isVisible ?? true,
|
|
@@ -19401,13 +19570,13 @@ var resolveDesignProps4 = (props) => {
|
|
|
19401
19570
|
}
|
|
19402
19571
|
};
|
|
19403
19572
|
};
|
|
19404
|
-
var PaymentMethod = (0,
|
|
19405
|
-
const props =
|
|
19573
|
+
var PaymentMethod = (0, import_react37.forwardRef)(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
|
|
19574
|
+
const props = resolveDesignProps5(rest);
|
|
19406
19575
|
const { data, setLayout } = useEmbed();
|
|
19407
|
-
const paymentMethod = (0,
|
|
19576
|
+
const paymentMethod = (0, import_react37.useMemo)(() => {
|
|
19408
19577
|
return data.subscription?.paymentMethod;
|
|
19409
19578
|
}, [data.subscription?.paymentMethod]);
|
|
19410
|
-
const monthsToExpiration = (0,
|
|
19579
|
+
const monthsToExpiration = (0, import_react37.useMemo)(() => {
|
|
19411
19580
|
let expiration;
|
|
19412
19581
|
if (typeof paymentMethod?.cardExpYear === "number" && typeof paymentMethod?.cardExpMonth === "number") {
|
|
19413
19582
|
const today = /* @__PURE__ */ new Date();
|
|
@@ -19420,7 +19589,7 @@ var PaymentMethod = (0, import_react36.forwardRef)(({ children, className, porta
|
|
|
19420
19589
|
}
|
|
19421
19590
|
return expiration;
|
|
19422
19591
|
}, [paymentMethod?.cardExpYear, paymentMethod?.cardExpMonth]);
|
|
19423
|
-
return /* @__PURE__ */ (0,
|
|
19592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Element, { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
19424
19593
|
PaymentMethodElement,
|
|
19425
19594
|
{
|
|
19426
19595
|
paymentMethod,
|
|
@@ -19434,9 +19603,9 @@ PaymentMethod.displayName = "PaymentMethod";
|
|
|
19434
19603
|
|
|
19435
19604
|
// src/components/elements/payment-method/PaymentMethodDetails.tsx
|
|
19436
19605
|
var import_react_stripe_js2 = require("@stripe/react-stripe-js");
|
|
19437
|
-
var
|
|
19438
|
-
var
|
|
19439
|
-
var
|
|
19606
|
+
var import_react38 = require("react");
|
|
19607
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
19608
|
+
var resolveDesignProps6 = () => {
|
|
19440
19609
|
return {
|
|
19441
19610
|
header: {
|
|
19442
19611
|
isVisible: true,
|
|
@@ -19451,24 +19620,24 @@ var resolveDesignProps5 = () => {
|
|
|
19451
19620
|
var PaymentMethodDetails = ({
|
|
19452
19621
|
setPaymentMethodId
|
|
19453
19622
|
}) => {
|
|
19454
|
-
const props =
|
|
19623
|
+
const props = resolveDesignProps6();
|
|
19455
19624
|
const { t: t2 } = useTranslation();
|
|
19456
19625
|
const theme = nt();
|
|
19457
19626
|
const { api, data, setData } = useEmbed();
|
|
19458
19627
|
const isLightBackground = useIsLightBackground();
|
|
19459
|
-
const [isLoading, setIsLoading] = (0,
|
|
19460
|
-
const [error, setError] = (0,
|
|
19461
|
-
const [showPaymentForm, setShowPaymentForm] = (0,
|
|
19462
|
-
const [stripe, setStripe] = (0,
|
|
19463
|
-
const [setupIntent, setSetupIntent] = (0,
|
|
19464
|
-
const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = (0,
|
|
19465
|
-
const [paymentMethod, setPaymentMethod] = (0,
|
|
19466
|
-
(0,
|
|
19628
|
+
const [isLoading, setIsLoading] = (0, import_react38.useState)(false);
|
|
19629
|
+
const [error, setError] = (0, import_react38.useState)();
|
|
19630
|
+
const [showPaymentForm, setShowPaymentForm] = (0, import_react38.useState)(false);
|
|
19631
|
+
const [stripe, setStripe] = (0, import_react38.useState)(null);
|
|
19632
|
+
const [setupIntent, setSetupIntent] = (0, import_react38.useState)();
|
|
19633
|
+
const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = (0, import_react38.useState)(false);
|
|
19634
|
+
const [paymentMethod, setPaymentMethod] = (0, import_react38.useState)(void 0);
|
|
19635
|
+
(0, import_react38.useEffect)(() => {
|
|
19467
19636
|
if (data.subscription?.paymentMethod) {
|
|
19468
19637
|
setPaymentMethod(data.subscription.paymentMethod);
|
|
19469
19638
|
}
|
|
19470
19639
|
}, [data.subscription?.paymentMethod]);
|
|
19471
|
-
const monthsToExpiration = (0,
|
|
19640
|
+
const monthsToExpiration = (0, import_react38.useMemo)(() => {
|
|
19472
19641
|
let expiration;
|
|
19473
19642
|
if (typeof paymentMethod?.cardExpYear === "number" && typeof paymentMethod?.cardExpMonth === "number") {
|
|
19474
19643
|
const today = /* @__PURE__ */ new Date();
|
|
@@ -19481,12 +19650,12 @@ var PaymentMethodDetails = ({
|
|
|
19481
19650
|
}
|
|
19482
19651
|
return expiration;
|
|
19483
19652
|
}, [paymentMethod?.cardExpYear, paymentMethod?.cardExpMonth]);
|
|
19484
|
-
(0,
|
|
19653
|
+
(0, import_react38.useEffect)(() => {
|
|
19485
19654
|
if (!stripe && setupIntent?.publishableKey) {
|
|
19486
19655
|
setStripe(loadStripe(setupIntent.publishableKey));
|
|
19487
19656
|
}
|
|
19488
19657
|
}, [stripe, setupIntent?.publishableKey]);
|
|
19489
|
-
const createSetupIntent = (0,
|
|
19658
|
+
const createSetupIntent = (0, import_react38.useCallback)(async () => {
|
|
19490
19659
|
if (!api || !data.component?.id) {
|
|
19491
19660
|
return;
|
|
19492
19661
|
}
|
|
@@ -19505,10 +19674,10 @@ var PaymentMethodDetails = ({
|
|
|
19505
19674
|
setIsLoading(false);
|
|
19506
19675
|
}
|
|
19507
19676
|
}, [t2, api, data.component?.id]);
|
|
19508
|
-
const dropDownDifferentPaymentMethods = (0,
|
|
19677
|
+
const dropDownDifferentPaymentMethods = (0, import_react38.useCallback)(() => {
|
|
19509
19678
|
setShowDifferentPaymentMethods((state) => !state);
|
|
19510
19679
|
}, []);
|
|
19511
|
-
const updatePaymentMethod = (0,
|
|
19680
|
+
const updatePaymentMethod = (0, import_react38.useCallback)(
|
|
19512
19681
|
async (externalId) => {
|
|
19513
19682
|
if (!api || !externalId) {
|
|
19514
19683
|
return;
|
|
@@ -19541,7 +19710,7 @@ var PaymentMethodDetails = ({
|
|
|
19541
19710
|
},
|
|
19542
19711
|
[api, data, setData, setPaymentMethodId, t2]
|
|
19543
19712
|
);
|
|
19544
|
-
const deletePaymentMethod = (0,
|
|
19713
|
+
const deletePaymentMethod = (0, import_react38.useCallback)(
|
|
19545
19714
|
async (id) => {
|
|
19546
19715
|
if (!api || !id) {
|
|
19547
19716
|
return;
|
|
@@ -19568,8 +19737,8 @@ var PaymentMethodDetails = ({
|
|
|
19568
19737
|
},
|
|
19569
19738
|
[api, data, setData, t2]
|
|
19570
19739
|
);
|
|
19571
|
-
return /* @__PURE__ */ (0,
|
|
19572
|
-
isLoading && /* @__PURE__ */ (0,
|
|
19740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Flex, { $position: "relative", children: [
|
|
19741
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
19573
19742
|
Flex,
|
|
19574
19743
|
{
|
|
19575
19744
|
$position: "absolute",
|
|
@@ -19581,10 +19750,10 @@ var PaymentMethodDetails = ({
|
|
|
19581
19750
|
$zIndex: 1,
|
|
19582
19751
|
$backgroundColor: "black",
|
|
19583
19752
|
$opacity: 0.5,
|
|
19584
|
-
children: /* @__PURE__ */ (0,
|
|
19753
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Loader, { $color: theme.primary, $size: "2xl" })
|
|
19585
19754
|
}
|
|
19586
19755
|
),
|
|
19587
|
-
/* @__PURE__ */ (0,
|
|
19756
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
19588
19757
|
Flex,
|
|
19589
19758
|
{
|
|
19590
19759
|
$flexDirection: "column",
|
|
@@ -19594,7 +19763,7 @@ var PaymentMethodDetails = ({
|
|
|
19594
19763
|
$backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.025)" : "hsla(0, 0%, 100%, 0.025)",
|
|
19595
19764
|
$overflow: "auto",
|
|
19596
19765
|
children: [
|
|
19597
|
-
showPaymentForm ? /* @__PURE__ */ (0,
|
|
19766
|
+
showPaymentForm ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
19598
19767
|
import_react_stripe_js2.Elements,
|
|
19599
19768
|
{
|
|
19600
19769
|
stripe,
|
|
@@ -19623,7 +19792,7 @@ var PaymentMethodDetails = ({
|
|
|
19623
19792
|
},
|
|
19624
19793
|
clientSecret: setupIntent?.setupIntentClientSecret
|
|
19625
19794
|
},
|
|
19626
|
-
children: /* @__PURE__ */ (0,
|
|
19795
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
19627
19796
|
PaymentForm,
|
|
19628
19797
|
{
|
|
19629
19798
|
onConfirm: async (paymentMethodId) => {
|
|
@@ -19634,8 +19803,8 @@ var PaymentMethodDetails = ({
|
|
|
19634
19803
|
}
|
|
19635
19804
|
)
|
|
19636
19805
|
}
|
|
19637
|
-
) : /* @__PURE__ */ (0,
|
|
19638
|
-
/* @__PURE__ */ (0,
|
|
19806
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", children: [
|
|
19807
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
19639
19808
|
PaymentMethodElement,
|
|
19640
19809
|
{
|
|
19641
19810
|
size: "lg",
|
|
@@ -19644,7 +19813,7 @@ var PaymentMethodDetails = ({
|
|
|
19644
19813
|
...props
|
|
19645
19814
|
}
|
|
19646
19815
|
),
|
|
19647
|
-
(data.company?.paymentMethods || []).length > 0 && /* @__PURE__ */ (0,
|
|
19816
|
+
(data.company?.paymentMethods || []).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
19648
19817
|
Text,
|
|
19649
19818
|
{
|
|
19650
19819
|
onClick: dropDownDifferentPaymentMethods,
|
|
@@ -19654,7 +19823,7 @@ var PaymentMethodDetails = ({
|
|
|
19654
19823
|
$color: theme.typography.link.color,
|
|
19655
19824
|
children: [
|
|
19656
19825
|
t2("Choose different payment method"),
|
|
19657
|
-
/* @__PURE__ */ (0,
|
|
19826
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
19658
19827
|
Icon2,
|
|
19659
19828
|
{
|
|
19660
19829
|
name: "chevron-down",
|
|
@@ -19670,9 +19839,9 @@ var PaymentMethodDetails = ({
|
|
|
19670
19839
|
]
|
|
19671
19840
|
}
|
|
19672
19841
|
) }),
|
|
19673
|
-
showDifferentPaymentMethods && /* @__PURE__ */ (0,
|
|
19842
|
+
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(
|
|
19674
19843
|
(pm) => pm.id !== paymentMethod?.id
|
|
19675
|
-
) || []).map((paymentMethod2) => /* @__PURE__ */ (0,
|
|
19844
|
+
) || []).map((paymentMethod2) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
19676
19845
|
PaymentListElement,
|
|
19677
19846
|
{
|
|
19678
19847
|
paymentMethod: paymentMethod2,
|
|
@@ -19681,9 +19850,9 @@ var PaymentMethodDetails = ({
|
|
|
19681
19850
|
},
|
|
19682
19851
|
paymentMethod2.id
|
|
19683
19852
|
)) }) }),
|
|
19684
|
-
(!paymentMethod || showDifferentPaymentMethods) && /* @__PURE__ */ (0,
|
|
19853
|
+
(!paymentMethod || showDifferentPaymentMethods) && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(EmbedButton, { onClick: createSetupIntent, size: "lg", children: t2("Add new payment method") })
|
|
19685
19854
|
] }),
|
|
19686
|
-
!isLoading && error && /* @__PURE__ */ (0,
|
|
19855
|
+
!isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
19687
19856
|
Text,
|
|
19688
19857
|
{
|
|
19689
19858
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19700,9 +19869,9 @@ var PaymentMethodDetails = ({
|
|
|
19700
19869
|
};
|
|
19701
19870
|
|
|
19702
19871
|
// src/components/elements/plan-manager/PlanManager.tsx
|
|
19703
|
-
var
|
|
19704
|
-
var
|
|
19705
|
-
var
|
|
19872
|
+
var import_react39 = require("react");
|
|
19873
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
19874
|
+
var resolveDesignProps7 = (props) => {
|
|
19706
19875
|
return {
|
|
19707
19876
|
header: {
|
|
19708
19877
|
isVisible: props.header?.isVisible ?? true,
|
|
@@ -19730,8 +19899,8 @@ var resolveDesignProps6 = (props) => {
|
|
|
19730
19899
|
}
|
|
19731
19900
|
};
|
|
19732
19901
|
};
|
|
19733
|
-
var PlanManager = (0,
|
|
19734
|
-
const props =
|
|
19902
|
+
var PlanManager = (0, import_react39.forwardRef)(({ children, className, portal, ...rest }, ref) => {
|
|
19903
|
+
const props = resolveDesignProps7(rest);
|
|
19735
19904
|
const theme = nt();
|
|
19736
19905
|
const { t: t2 } = useTranslation();
|
|
19737
19906
|
const { data, setLayout, setSelected } = useEmbed();
|
|
@@ -19756,7 +19925,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19756
19925
|
[]
|
|
19757
19926
|
);
|
|
19758
19927
|
const billingSubscription = data.company?.billingSubscription;
|
|
19759
|
-
const trialEndDays = (0,
|
|
19928
|
+
const trialEndDays = (0, import_react39.useMemo)(() => {
|
|
19760
19929
|
const trialEnd = billingSubscription?.trialEnd;
|
|
19761
19930
|
const trialEndDate = trialEnd ? new Date(trialEnd * 1e3) : /* @__PURE__ */ new Date();
|
|
19762
19931
|
const todayDate = /* @__PURE__ */ new Date();
|
|
@@ -19769,15 +19938,18 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19769
19938
|
const willSubscriptionCancel = billingSubscription?.cancelAtPeriodEnd;
|
|
19770
19939
|
const isUsageBasedPlan = currentPlan?.planPrice === 0 && usageBasedEntitlements.length > 0;
|
|
19771
19940
|
const headerPriceFontStyle = isUsageBasedPlan ? theme.typography.heading3 : theme.typography[props.header.price.fontStyle];
|
|
19772
|
-
return /* @__PURE__ */ (0,
|
|
19773
|
-
isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ (0,
|
|
19774
|
-
|
|
19941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
19942
|
+
isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19943
|
+
Notice,
|
|
19775
19944
|
{
|
|
19776
|
-
|
|
19945
|
+
as: Flex,
|
|
19946
|
+
$flexDirection: "column",
|
|
19947
|
+
$gap: "0.5rem",
|
|
19948
|
+
$padding: "1.5rem",
|
|
19777
19949
|
$textAlign: "center",
|
|
19778
|
-
$
|
|
19950
|
+
$backgroundColor: isLightBackground ? darken(theme.card.background, 0.04) : lighten(theme.card.background, 0.04),
|
|
19779
19951
|
children: [
|
|
19780
|
-
/* @__PURE__ */ (0,
|
|
19952
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19781
19953
|
Text,
|
|
19782
19954
|
{
|
|
19783
19955
|
as: "h3",
|
|
@@ -19788,7 +19960,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19788
19960
|
children: t2("Trial ends in", { days: trialEndDays.toString() })
|
|
19789
19961
|
}
|
|
19790
19962
|
),
|
|
19791
|
-
/* @__PURE__ */ (0,
|
|
19963
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19792
19964
|
Text,
|
|
19793
19965
|
{
|
|
19794
19966
|
as: "p",
|
|
@@ -19805,14 +19977,17 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19805
19977
|
)
|
|
19806
19978
|
]
|
|
19807
19979
|
}
|
|
19808
|
-
) : willSubscriptionCancel && /* @__PURE__ */ (0,
|
|
19809
|
-
|
|
19980
|
+
) : willSubscriptionCancel && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19981
|
+
Notice,
|
|
19810
19982
|
{
|
|
19811
|
-
|
|
19983
|
+
as: Flex,
|
|
19984
|
+
$flexDirection: "column",
|
|
19985
|
+
$gap: "0.5rem",
|
|
19986
|
+
$padding: "1.5rem",
|
|
19812
19987
|
$textAlign: "center",
|
|
19813
|
-
$
|
|
19988
|
+
$backgroundColor: isLightBackground ? darken(theme.card.background, 0.04) : lighten(theme.card.background, 0.04),
|
|
19814
19989
|
children: [
|
|
19815
|
-
/* @__PURE__ */ (0,
|
|
19990
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19816
19991
|
Text,
|
|
19817
19992
|
{
|
|
19818
19993
|
as: "h3",
|
|
@@ -19823,7 +19998,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19823
19998
|
children: t2("Subscription canceled")
|
|
19824
19999
|
}
|
|
19825
20000
|
),
|
|
19826
|
-
/* @__PURE__ */ (0,
|
|
20001
|
+
billingSubscription?.cancelAt && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19827
20002
|
Text,
|
|
19828
20003
|
{
|
|
19829
20004
|
as: "p",
|
|
@@ -19831,20 +20006,20 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19831
20006
|
$size: 0.8125 * theme.typography.text.fontSize,
|
|
19832
20007
|
$weight: theme.typography.text.fontWeight,
|
|
19833
20008
|
$color: theme.typography.text.color,
|
|
19834
|
-
children:
|
|
20009
|
+
children: t2("Access to plan will end on", {
|
|
19835
20010
|
date: toPrettyDate(
|
|
19836
20011
|
new Date(billingSubscription.cancelAt * 1e3),
|
|
19837
20012
|
{
|
|
19838
20013
|
month: "numeric"
|
|
19839
20014
|
}
|
|
19840
20015
|
)
|
|
19841
|
-
})
|
|
20016
|
+
})
|
|
19842
20017
|
}
|
|
19843
20018
|
)
|
|
19844
20019
|
]
|
|
19845
20020
|
}
|
|
19846
20021
|
),
|
|
19847
|
-
/* @__PURE__ */ (0,
|
|
20022
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19848
20023
|
Element,
|
|
19849
20024
|
{
|
|
19850
20025
|
as: Flex,
|
|
@@ -19853,7 +20028,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19853
20028
|
$flexDirection: "column",
|
|
19854
20029
|
$gap: "2rem",
|
|
19855
20030
|
children: [
|
|
19856
|
-
props.header.isVisible && currentPlan && /* @__PURE__ */ (0,
|
|
20031
|
+
props.header.isVisible && currentPlan && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19857
20032
|
Flex,
|
|
19858
20033
|
{
|
|
19859
20034
|
$justifyContent: "space-between",
|
|
@@ -19861,8 +20036,8 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19861
20036
|
$flexWrap: "wrap",
|
|
19862
20037
|
$gap: "1rem",
|
|
19863
20038
|
children: [
|
|
19864
|
-
/* @__PURE__ */ (0,
|
|
19865
|
-
/* @__PURE__ */ (0,
|
|
20039
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
20040
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19866
20041
|
Text,
|
|
19867
20042
|
{
|
|
19868
20043
|
as: Box,
|
|
@@ -19874,7 +20049,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19874
20049
|
children: currentPlan.name
|
|
19875
20050
|
}
|
|
19876
20051
|
),
|
|
19877
|
-
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0,
|
|
20052
|
+
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19878
20053
|
Text,
|
|
19879
20054
|
{
|
|
19880
20055
|
as: Box,
|
|
@@ -19886,8 +20061,8 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19886
20061
|
}
|
|
19887
20062
|
)
|
|
19888
20063
|
] }),
|
|
19889
|
-
props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ (0,
|
|
19890
|
-
/* @__PURE__ */ (0,
|
|
20064
|
+
props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Box, { children: [
|
|
20065
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19891
20066
|
Text,
|
|
19892
20067
|
{
|
|
19893
20068
|
$font: headerPriceFontStyle.fontFamily,
|
|
@@ -19900,14 +20075,14 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19900
20075
|
)
|
|
19901
20076
|
}
|
|
19902
20077
|
),
|
|
19903
|
-
!isUsageBasedPlan && /* @__PURE__ */ (0,
|
|
20078
|
+
!isUsageBasedPlan && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19904
20079
|
Text,
|
|
19905
20080
|
{
|
|
19906
20081
|
$font: theme.typography[props.header.price.fontStyle].fontFamily,
|
|
19907
20082
|
$size: theme.typography[props.header.price.fontStyle].fontSize,
|
|
19908
20083
|
$weight: theme.typography[props.header.price.fontStyle].fontWeight,
|
|
19909
20084
|
$color: theme.typography[props.header.price.fontStyle].color,
|
|
19910
|
-
children: /* @__PURE__ */ (0,
|
|
20085
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("sub", { children: [
|
|
19911
20086
|
"/",
|
|
19912
20087
|
shortenPeriod(currentPlan.planPeriod)
|
|
19913
20088
|
] })
|
|
@@ -19917,8 +20092,8 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19917
20092
|
]
|
|
19918
20093
|
}
|
|
19919
20094
|
),
|
|
19920
|
-
props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0,
|
|
19921
|
-
props.addOns.showLabel && /* @__PURE__ */ (0,
|
|
20095
|
+
props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
20096
|
+
props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19922
20097
|
Text,
|
|
19923
20098
|
{
|
|
19924
20099
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19929,7 +20104,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19929
20104
|
children: t2("Add-ons")
|
|
19930
20105
|
}
|
|
19931
20106
|
),
|
|
19932
|
-
addOns.map((addOn, addOnIndex) => /* @__PURE__ */ (0,
|
|
20107
|
+
addOns.map((addOn, addOnIndex) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19933
20108
|
Flex,
|
|
19934
20109
|
{
|
|
19935
20110
|
$justifyContent: "space-between",
|
|
@@ -19937,7 +20112,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19937
20112
|
$flexWrap: "wrap",
|
|
19938
20113
|
$gap: "1rem",
|
|
19939
20114
|
children: [
|
|
19940
|
-
/* @__PURE__ */ (0,
|
|
20115
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19941
20116
|
Text,
|
|
19942
20117
|
{
|
|
19943
20118
|
$font: theme.typography[props.addOns.fontStyle].fontFamily,
|
|
@@ -19947,7 +20122,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19947
20122
|
children: addOn.name
|
|
19948
20123
|
}
|
|
19949
20124
|
),
|
|
19950
|
-
addOn.planPrice && addOn.planPeriod && /* @__PURE__ */ (0,
|
|
20125
|
+
addOn.planPrice && addOn.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19951
20126
|
Text,
|
|
19952
20127
|
{
|
|
19953
20128
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19956,7 +20131,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19956
20131
|
$color: theme.typography.text.color,
|
|
19957
20132
|
children: [
|
|
19958
20133
|
formatCurrency(addOn.planPrice, subscriptionCurrency),
|
|
19959
|
-
/* @__PURE__ */ (0,
|
|
20134
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("sub", { children: [
|
|
19960
20135
|
"/",
|
|
19961
20136
|
shortenPeriod(addOn.planPeriod)
|
|
19962
20137
|
] })
|
|
@@ -19968,8 +20143,8 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19968
20143
|
addOnIndex
|
|
19969
20144
|
))
|
|
19970
20145
|
] }),
|
|
19971
|
-
usageBasedEntitlements.length > 0 && /* @__PURE__ */ (0,
|
|
19972
|
-
/* @__PURE__ */ (0,
|
|
20146
|
+
usageBasedEntitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
20147
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19973
20148
|
Text,
|
|
19974
20149
|
{
|
|
19975
20150
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19987,7 +20162,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19987
20162
|
const amount = overageAmount || entitlement.allocation || 0;
|
|
19988
20163
|
if (entitlement.feature?.name) {
|
|
19989
20164
|
acc.push(
|
|
19990
|
-
/* @__PURE__ */ (0,
|
|
20165
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19991
20166
|
Flex,
|
|
19992
20167
|
{
|
|
19993
20168
|
$justifyContent: "space-between",
|
|
@@ -19995,7 +20170,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
19995
20170
|
$flexWrap: "wrap",
|
|
19996
20171
|
$gap: "1rem",
|
|
19997
20172
|
children: [
|
|
19998
|
-
/* @__PURE__ */ (0,
|
|
20173
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19999
20174
|
Text,
|
|
20000
20175
|
{
|
|
20001
20176
|
$font: theme.typography[props.addOns.fontStyle].fontFamily,
|
|
@@ -20003,20 +20178,20 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
20003
20178
|
$weight: theme.typography[props.addOns.fontStyle].fontWeight,
|
|
20004
20179
|
$color: theme.typography[props.addOns.fontStyle].color,
|
|
20005
20180
|
children: [
|
|
20006
|
-
entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "overage" && limit > 0 ? /* @__PURE__ */ (0,
|
|
20181
|
+
entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "overage" && limit > 0 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
20007
20182
|
limit,
|
|
20008
20183
|
" ",
|
|
20009
20184
|
getFeatureName(entitlement.feature, limit)
|
|
20010
20185
|
] }) : entitlement.feature.name,
|
|
20011
|
-
entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && currentPlan?.planPeriod && /* @__PURE__ */ (0,
|
|
20186
|
+
entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && currentPlan?.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
20012
20187
|
"/",
|
|
20013
20188
|
shortenPeriod(currentPlan.planPeriod)
|
|
20014
20189
|
] })
|
|
20015
20190
|
]
|
|
20016
20191
|
}
|
|
20017
20192
|
),
|
|
20018
|
-
/* @__PURE__ */ (0,
|
|
20019
|
-
entitlement.priceBehavior === "overage" && currentPlan?.planPeriod ? /* @__PURE__ */ (0,
|
|
20193
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Flex, { $alignItems: "center", $gap: "1rem", children: [
|
|
20194
|
+
entitlement.priceBehavior === "overage" && currentPlan?.planPeriod ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
20020
20195
|
Text,
|
|
20021
20196
|
{
|
|
20022
20197
|
$font: theme.typography.text.fontFamily,
|
|
@@ -20025,7 +20200,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
20025
20200
|
$color: hexToHSL(theme.typography.text.color).l > 50 ? darken(theme.typography.text.color, 0.46) : lighten(theme.typography.text.color, 0.46),
|
|
20026
20201
|
children: typeof overageAmount === "number" && overageAmount > 0 ? t2("X over the limit", {
|
|
20027
20202
|
amount: overageAmount
|
|
20028
|
-
}) : /* @__PURE__ */ (0,
|
|
20203
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
20029
20204
|
t2("Overage fee"),
|
|
20030
20205
|
":",
|
|
20031
20206
|
" ",
|
|
@@ -20033,17 +20208,17 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
20033
20208
|
entitlement.price ?? 0,
|
|
20034
20209
|
entitlement.currency
|
|
20035
20210
|
),
|
|
20036
|
-
/* @__PURE__ */ (0,
|
|
20211
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("sub", { children: [
|
|
20037
20212
|
"/",
|
|
20038
20213
|
getFeatureName(entitlement.feature, 1),
|
|
20039
|
-
entitlement.feature.featureType === "trait" && /* @__PURE__ */ (0,
|
|
20214
|
+
entitlement.feature.featureType === "trait" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
20040
20215
|
"/",
|
|
20041
20216
|
shortenPeriod(currentPlan.planPeriod)
|
|
20042
20217
|
] })
|
|
20043
20218
|
] })
|
|
20044
20219
|
] })
|
|
20045
20220
|
}
|
|
20046
|
-
) : entitlement.priceBehavior === "pay_in_advance" && currentPlan?.planPeriod && /* @__PURE__ */ (0,
|
|
20221
|
+
) : entitlement.priceBehavior === "pay_in_advance" && currentPlan?.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
20047
20222
|
Text,
|
|
20048
20223
|
{
|
|
20049
20224
|
$font: theme.typography.text.fontFamily,
|
|
@@ -20055,7 +20230,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
20055
20230
|
entitlement.price ?? 0,
|
|
20056
20231
|
entitlement.currency
|
|
20057
20232
|
),
|
|
20058
|
-
/* @__PURE__ */ (0,
|
|
20233
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("sub", { children: [
|
|
20059
20234
|
"/",
|
|
20060
20235
|
getFeatureName(entitlement.feature, 1),
|
|
20061
20236
|
"/",
|
|
@@ -20064,7 +20239,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
20064
20239
|
]
|
|
20065
20240
|
}
|
|
20066
20241
|
),
|
|
20067
|
-
amount > 0 && /* @__PURE__ */ (0,
|
|
20242
|
+
amount > 0 && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
20068
20243
|
Text,
|
|
20069
20244
|
{
|
|
20070
20245
|
$font: theme.typography.text.fontFamily,
|
|
@@ -20076,7 +20251,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
20076
20251
|
(entitlement.price ?? 0) * amount,
|
|
20077
20252
|
entitlement.currency
|
|
20078
20253
|
),
|
|
20079
|
-
(entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior !== "overage") && /* @__PURE__ */ (0,
|
|
20254
|
+
(entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior !== "overage") && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("sub", { children: [
|
|
20080
20255
|
"/",
|
|
20081
20256
|
currentPlan?.planPeriod && entitlement.priceBehavior === "pay_in_advance" ? shortenPeriod(currentPlan.planPeriod) : getFeatureName(entitlement.feature, 1)
|
|
20082
20257
|
] })
|
|
@@ -20095,7 +20270,7 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
20095
20270
|
[]
|
|
20096
20271
|
)
|
|
20097
20272
|
] }),
|
|
20098
|
-
canCheckout && props.callToAction.isVisible && /* @__PURE__ */ (0,
|
|
20273
|
+
canCheckout && props.callToAction.isVisible && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
20099
20274
|
EmbedButton,
|
|
20100
20275
|
{
|
|
20101
20276
|
type: "button",
|
|
@@ -20120,9 +20295,9 @@ var PlanManager = (0, import_react38.forwardRef)(({ children, className, portal,
|
|
|
20120
20295
|
PlanManager.displayName = "PlanManager";
|
|
20121
20296
|
|
|
20122
20297
|
// src/components/elements/pricing-table/PricingTable.tsx
|
|
20123
|
-
var
|
|
20124
|
-
var
|
|
20125
|
-
var
|
|
20298
|
+
var import_react40 = require("react");
|
|
20299
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
20300
|
+
var resolveDesignProps8 = (props) => {
|
|
20126
20301
|
return {
|
|
20127
20302
|
showPeriodToggle: props.showPeriodToggle ?? true,
|
|
20128
20303
|
showDiscount: props.showDiscount ?? true,
|
|
@@ -20161,18 +20336,18 @@ var resolveDesignProps7 = (props) => {
|
|
|
20161
20336
|
}
|
|
20162
20337
|
};
|
|
20163
20338
|
};
|
|
20164
|
-
var PricingTable = (0,
|
|
20165
|
-
const props =
|
|
20339
|
+
var PricingTable = (0, import_react40.forwardRef)(({ children, className, ...rest }, ref) => {
|
|
20340
|
+
const props = resolveDesignProps8(rest);
|
|
20166
20341
|
const { t: t2 } = useTranslation();
|
|
20167
20342
|
const theme = nt();
|
|
20168
20343
|
const { data, setLayout, setSelected } = useEmbed();
|
|
20169
20344
|
const trialEndDays = useTrialEnd();
|
|
20170
|
-
const [selectedPeriod, setSelectedPeriod] = (0,
|
|
20345
|
+
const [selectedPeriod, setSelectedPeriod] = (0, import_react40.useState)(
|
|
20171
20346
|
() => data.company?.plan?.planPeriod || "month"
|
|
20172
20347
|
);
|
|
20173
20348
|
const { plans, addOns, periods } = useAvailablePlans(selectedPeriod);
|
|
20174
20349
|
const isLightBackground = useIsLightBackground();
|
|
20175
|
-
const [entitlementCounts, setEntitlementCounts] = (0,
|
|
20350
|
+
const [entitlementCounts, setEntitlementCounts] = (0, import_react40.useState)(
|
|
20176
20351
|
() => plans.reduce(
|
|
20177
20352
|
(acc, plan) => {
|
|
20178
20353
|
acc[plan.id] = {
|
|
@@ -20199,7 +20374,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20199
20374
|
};
|
|
20200
20375
|
});
|
|
20201
20376
|
};
|
|
20202
|
-
return /* @__PURE__ */ (0,
|
|
20377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20203
20378
|
FussyChild,
|
|
20204
20379
|
{
|
|
20205
20380
|
ref,
|
|
@@ -20208,8 +20383,8 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20208
20383
|
$flexDirection: "column",
|
|
20209
20384
|
$gap: "2rem",
|
|
20210
20385
|
children: [
|
|
20211
|
-
/* @__PURE__ */ (0,
|
|
20212
|
-
/* @__PURE__ */ (0,
|
|
20386
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Box, { children: [
|
|
20387
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20213
20388
|
Flex,
|
|
20214
20389
|
{
|
|
20215
20390
|
$flexDirection: "column",
|
|
@@ -20224,7 +20399,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20224
20399
|
}
|
|
20225
20400
|
},
|
|
20226
20401
|
children: [
|
|
20227
|
-
/* @__PURE__ */ (0,
|
|
20402
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20228
20403
|
Text,
|
|
20229
20404
|
{
|
|
20230
20405
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -20234,7 +20409,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20234
20409
|
children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && t2("Plans")
|
|
20235
20410
|
}
|
|
20236
20411
|
),
|
|
20237
|
-
props.showPeriodToggle && /* @__PURE__ */ (0,
|
|
20412
|
+
props.showPeriodToggle && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20238
20413
|
PeriodToggle,
|
|
20239
20414
|
{
|
|
20240
20415
|
options: periods,
|
|
@@ -20245,7 +20420,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20245
20420
|
]
|
|
20246
20421
|
}
|
|
20247
20422
|
),
|
|
20248
|
-
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0,
|
|
20423
|
+
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20249
20424
|
Box,
|
|
20250
20425
|
{
|
|
20251
20426
|
$display: "grid",
|
|
@@ -20263,7 +20438,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20263
20438
|
);
|
|
20264
20439
|
const isUsageBasedPlan = planPrice === 0 && hasUsageBasedEntitlements;
|
|
20265
20440
|
const headerPriceFontStyle = plan.custom || isUsageBasedPlan ? theme.typography.heading3 : theme.typography[props.plans.name.fontStyle];
|
|
20266
|
-
return /* @__PURE__ */ (0,
|
|
20441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20267
20442
|
Flex,
|
|
20268
20443
|
{
|
|
20269
20444
|
$position: "relative",
|
|
@@ -20276,7 +20451,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20276
20451
|
$outlineColor: isActivePlan ? theme.primary : "transparent",
|
|
20277
20452
|
...theme.card.hasShadow && { $boxShadow: cardBoxShadow },
|
|
20278
20453
|
children: [
|
|
20279
|
-
/* @__PURE__ */ (0,
|
|
20454
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20280
20455
|
Flex,
|
|
20281
20456
|
{
|
|
20282
20457
|
$flexDirection: "column",
|
|
@@ -20287,7 +20462,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20287
20462
|
$borderStyle: "solid",
|
|
20288
20463
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
|
20289
20464
|
children: [
|
|
20290
|
-
/* @__PURE__ */ (0,
|
|
20465
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20291
20466
|
Text,
|
|
20292
20467
|
{
|
|
20293
20468
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -20297,7 +20472,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20297
20472
|
children: plan.name
|
|
20298
20473
|
}
|
|
20299
20474
|
) }),
|
|
20300
|
-
props.plans.description.isVisible && /* @__PURE__ */ (0,
|
|
20475
|
+
props.plans.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20301
20476
|
Text,
|
|
20302
20477
|
{
|
|
20303
20478
|
$font: theme.typography[props.plans.description.fontStyle].fontFamily,
|
|
@@ -20307,8 +20482,8 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20307
20482
|
children: plan.description
|
|
20308
20483
|
}
|
|
20309
20484
|
) }),
|
|
20310
|
-
/* @__PURE__ */ (0,
|
|
20311
|
-
/* @__PURE__ */ (0,
|
|
20485
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Box, { children: [
|
|
20486
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20312
20487
|
Text,
|
|
20313
20488
|
{
|
|
20314
20489
|
$font: headerPriceFontStyle.fontFamily,
|
|
@@ -20318,7 +20493,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20318
20493
|
children: plan.custom ? plan.customPlanConfig?.priceText ? plan.customPlanConfig.priceText : t2("Custom price") : isUsageBasedPlan ? t2("Usage-based") : formatCurrency(planPrice ?? 0, planCurrency)
|
|
20319
20494
|
}
|
|
20320
20495
|
),
|
|
20321
|
-
!plan.custom && !isUsageBasedPlan && /* @__PURE__ */ (0,
|
|
20496
|
+
!plan.custom && !isUsageBasedPlan && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20322
20497
|
Text,
|
|
20323
20498
|
{
|
|
20324
20499
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -20332,7 +20507,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20332
20507
|
}
|
|
20333
20508
|
)
|
|
20334
20509
|
] }),
|
|
20335
|
-
isActivePlan && /* @__PURE__ */ (0,
|
|
20510
|
+
isActivePlan && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20336
20511
|
Flex,
|
|
20337
20512
|
{
|
|
20338
20513
|
$position: "absolute",
|
|
@@ -20341,7 +20516,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20341
20516
|
$backgroundColor: theme.primary,
|
|
20342
20517
|
$borderRadius: "9999px",
|
|
20343
20518
|
$padding: "0.125rem 0.85rem",
|
|
20344
|
-
children: /* @__PURE__ */ (0,
|
|
20519
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20345
20520
|
Text,
|
|
20346
20521
|
{
|
|
20347
20522
|
$font: theme.typography.text.fontFamily,
|
|
@@ -20356,7 +20531,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20356
20531
|
]
|
|
20357
20532
|
}
|
|
20358
20533
|
),
|
|
20359
|
-
/* @__PURE__ */ (0,
|
|
20534
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20360
20535
|
Flex,
|
|
20361
20536
|
{
|
|
20362
20537
|
$flexDirection: "column",
|
|
@@ -20365,8 +20540,8 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20365
20540
|
$gap: `${cardPadding}rem`,
|
|
20366
20541
|
$padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
|
|
20367
20542
|
children: [
|
|
20368
|
-
props.plans.showEntitlements && /* @__PURE__ */ (0,
|
|
20369
|
-
props.plans.showInclusionText && planIndex > 0 && /* @__PURE__ */ (0,
|
|
20543
|
+
props.plans.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: 1, children: [
|
|
20544
|
+
props.plans.showInclusionText && planIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20370
20545
|
Text,
|
|
20371
20546
|
{
|
|
20372
20547
|
$font: theme.typography.text.fontFamily,
|
|
@@ -20391,8 +20566,8 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20391
20566
|
return acc;
|
|
20392
20567
|
}
|
|
20393
20568
|
acc.push(
|
|
20394
|
-
/* @__PURE__ */ (0,
|
|
20395
|
-
props.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0,
|
|
20569
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Flex, { $gap: "1rem", children: [
|
|
20570
|
+
props.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20396
20571
|
IconRound,
|
|
20397
20572
|
{
|
|
20398
20573
|
name: entitlement.feature.icon,
|
|
@@ -20403,14 +20578,14 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20403
20578
|
]
|
|
20404
20579
|
}
|
|
20405
20580
|
),
|
|
20406
|
-
entitlement.feature?.name && /* @__PURE__ */ (0,
|
|
20581
|
+
entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20407
20582
|
Flex,
|
|
20408
20583
|
{
|
|
20409
20584
|
$flexDirection: "column",
|
|
20410
20585
|
$justifyContent: "center",
|
|
20411
20586
|
$gap: "0.5rem",
|
|
20412
20587
|
children: [
|
|
20413
|
-
/* @__PURE__ */ (0,
|
|
20588
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20414
20589
|
Text,
|
|
20415
20590
|
{
|
|
20416
20591
|
$font: theme.typography.text.fontFamily,
|
|
@@ -20418,7 +20593,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20418
20593
|
$weight: theme.typography.text.fontWeight,
|
|
20419
20594
|
$color: theme.typography.text.color,
|
|
20420
20595
|
$leading: 1.35,
|
|
20421
|
-
children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" || entitlement.priceBehavior === "pay_as_you_go") ? /* @__PURE__ */ (0,
|
|
20596
|
+
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: [
|
|
20422
20597
|
formatCurrency(
|
|
20423
20598
|
entitlementPrice,
|
|
20424
20599
|
entitlementCurrency
|
|
@@ -20430,18 +20605,18 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20430
20605
|
entitlement.feature,
|
|
20431
20606
|
1
|
|
20432
20607
|
),
|
|
20433
|
-
entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0,
|
|
20608
|
+
entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
20434
20609
|
" ",
|
|
20435
20610
|
t2("per"),
|
|
20436
20611
|
" ",
|
|
20437
20612
|
selectedPeriod
|
|
20438
20613
|
] })
|
|
20439
|
-
] }) : entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ (0,
|
|
20614
|
+
] }) : entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
20440
20615
|
entitlement.valueType === "unlimited" && !entitlement.priceBehavior ? t2("Unlimited", {
|
|
20441
20616
|
item: getFeatureName(
|
|
20442
20617
|
entitlement.feature
|
|
20443
20618
|
)
|
|
20444
|
-
}) : typeof limit === "number" && /* @__PURE__ */ (0,
|
|
20619
|
+
}) : typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
20445
20620
|
formatNumber(limit),
|
|
20446
20621
|
" ",
|
|
20447
20622
|
getFeatureName(
|
|
@@ -20449,7 +20624,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20449
20624
|
limit
|
|
20450
20625
|
)
|
|
20451
20626
|
] }),
|
|
20452
|
-
entitlement.metricPeriod && entitlement.priceBehavior !== "overage" ? /* @__PURE__ */ (0,
|
|
20627
|
+
entitlement.metricPeriod && entitlement.priceBehavior !== "overage" ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
20453
20628
|
" ",
|
|
20454
20629
|
t2("per"),
|
|
20455
20630
|
" ",
|
|
@@ -20459,7 +20634,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20459
20634
|
current_month: "month",
|
|
20460
20635
|
current_year: "year"
|
|
20461
20636
|
}[entitlement.metricPeriod]
|
|
20462
|
-
] }) : entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && /* @__PURE__ */ (0,
|
|
20637
|
+
] }) : entitlement.priceBehavior === "overage" && entitlement.feature.featureType === "event" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
20463
20638
|
"/",
|
|
20464
20639
|
shortenPeriod(
|
|
20465
20640
|
selectedPeriod
|
|
@@ -20468,7 +20643,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20468
20643
|
] }) : entitlement.feature.name
|
|
20469
20644
|
}
|
|
20470
20645
|
),
|
|
20471
|
-
entitlement.priceBehavior === "overage" && typeof entitlementPrice === "number" && /* @__PURE__ */ (0,
|
|
20646
|
+
entitlement.priceBehavior === "overage" && typeof entitlementPrice === "number" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20472
20647
|
Text,
|
|
20473
20648
|
{
|
|
20474
20649
|
$font: theme.typography.text.fontFamily,
|
|
@@ -20494,7 +20669,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20494
20669
|
entitlement.feature,
|
|
20495
20670
|
1
|
|
20496
20671
|
),
|
|
20497
|
-
entitlement.feature.featureType === "trait" && /* @__PURE__ */ (0,
|
|
20672
|
+
entitlement.feature.featureType === "trait" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
20498
20673
|
"/",
|
|
20499
20674
|
shortenPeriod(selectedPeriod)
|
|
20500
20675
|
] }),
|
|
@@ -20512,14 +20687,14 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20512
20687
|
},
|
|
20513
20688
|
[]
|
|
20514
20689
|
).slice(0, count?.limit ?? VISIBLE_ENTITLEMENT_COUNT),
|
|
20515
|
-
(count?.size || plan.entitlements.length) > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ (0,
|
|
20690
|
+
(count?.size || plan.entitlements.length) > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20516
20691
|
Flex,
|
|
20517
20692
|
{
|
|
20518
20693
|
$alignItems: "center",
|
|
20519
20694
|
$justifyContent: "start",
|
|
20520
20695
|
$marginTop: "1rem",
|
|
20521
20696
|
children: [
|
|
20522
|
-
/* @__PURE__ */ (0,
|
|
20697
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20523
20698
|
Icon2,
|
|
20524
20699
|
{
|
|
20525
20700
|
name: isExpanded ? "chevron-up" : "chevron-down",
|
|
@@ -20531,7 +20706,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20531
20706
|
}
|
|
20532
20707
|
}
|
|
20533
20708
|
),
|
|
20534
|
-
/* @__PURE__ */ (0,
|
|
20709
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20535
20710
|
Text,
|
|
20536
20711
|
{
|
|
20537
20712
|
onClick: () => handleToggleShowAll(plan.id),
|
|
@@ -20548,7 +20723,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20548
20723
|
}
|
|
20549
20724
|
)
|
|
20550
20725
|
] }),
|
|
20551
|
-
isActivePlan ? /* @__PURE__ */ (0,
|
|
20726
|
+
isActivePlan ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20552
20727
|
Flex,
|
|
20553
20728
|
{
|
|
20554
20729
|
$justifyContent: "center",
|
|
@@ -20556,7 +20731,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20556
20731
|
$gap: "0.25rem",
|
|
20557
20732
|
$padding: "0.625rem 0",
|
|
20558
20733
|
children: [
|
|
20559
|
-
/* @__PURE__ */ (0,
|
|
20734
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20560
20735
|
Icon2,
|
|
20561
20736
|
{
|
|
20562
20737
|
name: "check-rounded",
|
|
@@ -20567,7 +20742,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20567
20742
|
}
|
|
20568
20743
|
}
|
|
20569
20744
|
),
|
|
20570
|
-
/* @__PURE__ */ (0,
|
|
20745
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20571
20746
|
Text,
|
|
20572
20747
|
{
|
|
20573
20748
|
$font: theme.typography.text.fontFamily,
|
|
@@ -20580,7 +20755,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20580
20755
|
)
|
|
20581
20756
|
]
|
|
20582
20757
|
}
|
|
20583
|
-
) : (props.upgrade.isVisible || props.downgrade.isVisible) && /* @__PURE__ */ (0,
|
|
20758
|
+
) : (props.upgrade.isVisible || props.downgrade.isVisible) && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20584
20759
|
EmbedButton,
|
|
20585
20760
|
{
|
|
20586
20761
|
type: "button",
|
|
@@ -20604,14 +20779,14 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20604
20779
|
$color: props.downgrade.buttonStyle,
|
|
20605
20780
|
$variant: "outline"
|
|
20606
20781
|
},
|
|
20607
|
-
children: plan.custom ? /* @__PURE__ */ (0,
|
|
20782
|
+
children: plan.custom ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20608
20783
|
ButtonLink,
|
|
20609
20784
|
{
|
|
20610
20785
|
href: plan.customPlanConfig?.ctaWebSite ?? "#",
|
|
20611
20786
|
target: "_blank",
|
|
20612
20787
|
children: plan.customPlanConfig?.ctaText ?? t2("Talk to support")
|
|
20613
20788
|
}
|
|
20614
|
-
) : !plan.valid ? /* @__PURE__ */ (0,
|
|
20789
|
+
) : !plan.valid ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20615
20790
|
Tooltip,
|
|
20616
20791
|
{
|
|
20617
20792
|
trigger: t2("Over usage limit"),
|
|
@@ -20633,14 +20808,14 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20633
20808
|
}
|
|
20634
20809
|
)
|
|
20635
20810
|
] }),
|
|
20636
|
-
/* @__PURE__ */ (0,
|
|
20637
|
-
props.header.isVisible && /* @__PURE__ */ (0,
|
|
20811
|
+
/* @__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: [
|
|
20812
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20638
20813
|
Flex,
|
|
20639
20814
|
{
|
|
20640
20815
|
$justifyContent: "space-between",
|
|
20641
20816
|
$alignItems: "center",
|
|
20642
20817
|
$marginBottom: "1rem",
|
|
20643
|
-
children: /* @__PURE__ */ (0,
|
|
20818
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20644
20819
|
Text,
|
|
20645
20820
|
{
|
|
20646
20821
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -20652,7 +20827,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20652
20827
|
)
|
|
20653
20828
|
}
|
|
20654
20829
|
),
|
|
20655
|
-
/* @__PURE__ */ (0,
|
|
20830
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20656
20831
|
Box,
|
|
20657
20832
|
{
|
|
20658
20833
|
$display: "grid",
|
|
@@ -20663,7 +20838,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20663
20838
|
const { price: addOnPrice, currency: addOnCurrency } = getBillingPrice(
|
|
20664
20839
|
selectedPeriod === "year" ? addOn.yearlyPrice : addOn.monthlyPrice
|
|
20665
20840
|
) || {};
|
|
20666
|
-
return /* @__PURE__ */ (0,
|
|
20841
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20667
20842
|
Flex,
|
|
20668
20843
|
{
|
|
20669
20844
|
$position: "relative",
|
|
@@ -20677,8 +20852,8 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20677
20852
|
$outlineColor: isActiveAddOn ? theme.primary : "transparent",
|
|
20678
20853
|
...theme.card.hasShadow && { $boxShadow: cardBoxShadow },
|
|
20679
20854
|
children: [
|
|
20680
|
-
/* @__PURE__ */ (0,
|
|
20681
|
-
/* @__PURE__ */ (0,
|
|
20855
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
|
|
20856
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20682
20857
|
Text,
|
|
20683
20858
|
{
|
|
20684
20859
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -20688,7 +20863,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20688
20863
|
children: addOn.name
|
|
20689
20864
|
}
|
|
20690
20865
|
) }),
|
|
20691
|
-
props.addOns.showDescription && /* @__PURE__ */ (0,
|
|
20866
|
+
props.addOns.showDescription && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20692
20867
|
Text,
|
|
20693
20868
|
{
|
|
20694
20869
|
$font: theme.typography[props.plans.description.fontStyle].fontFamily,
|
|
@@ -20698,8 +20873,8 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20698
20873
|
children: addOn.description
|
|
20699
20874
|
}
|
|
20700
20875
|
) }),
|
|
20701
|
-
/* @__PURE__ */ (0,
|
|
20702
|
-
/* @__PURE__ */ (0,
|
|
20876
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Box, { children: [
|
|
20877
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20703
20878
|
Text,
|
|
20704
20879
|
{
|
|
20705
20880
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -20709,7 +20884,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20709
20884
|
children: formatCurrency(addOnPrice ?? 0, addOnCurrency)
|
|
20710
20885
|
}
|
|
20711
20886
|
),
|
|
20712
|
-
/* @__PURE__ */ (0,
|
|
20887
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20713
20888
|
Text,
|
|
20714
20889
|
{
|
|
20715
20890
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -20723,7 +20898,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20723
20898
|
}
|
|
20724
20899
|
)
|
|
20725
20900
|
] }),
|
|
20726
|
-
isActiveAddOn && /* @__PURE__ */ (0,
|
|
20901
|
+
isActiveAddOn && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20727
20902
|
Flex,
|
|
20728
20903
|
{
|
|
20729
20904
|
$position: "absolute",
|
|
@@ -20732,7 +20907,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20732
20907
|
$backgroundColor: theme.primary,
|
|
20733
20908
|
$borderRadius: "9999px",
|
|
20734
20909
|
$padding: "0.125rem 0.85rem",
|
|
20735
|
-
children: /* @__PURE__ */ (0,
|
|
20910
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20736
20911
|
Text,
|
|
20737
20912
|
{
|
|
20738
20913
|
$font: theme.typography.text.fontFamily,
|
|
@@ -20745,7 +20920,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20745
20920
|
}
|
|
20746
20921
|
)
|
|
20747
20922
|
] }),
|
|
20748
|
-
/* @__PURE__ */ (0,
|
|
20923
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
20749
20924
|
Flex,
|
|
20750
20925
|
{
|
|
20751
20926
|
$flexDirection: "column",
|
|
@@ -20753,7 +20928,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20753
20928
|
$gap: `${cardPadding}rem`,
|
|
20754
20929
|
$flexGrow: 1,
|
|
20755
20930
|
children: [
|
|
20756
|
-
props.addOns.showEntitlements && /* @__PURE__ */ (0,
|
|
20931
|
+
props.addOns.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20757
20932
|
Flex,
|
|
20758
20933
|
{
|
|
20759
20934
|
$flexDirection: "column",
|
|
@@ -20762,15 +20937,15 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20762
20937
|
$flexGrow: 1,
|
|
20763
20938
|
children: addOn.entitlements.map(
|
|
20764
20939
|
(entitlement, entitlementIndex) => {
|
|
20765
|
-
return /* @__PURE__ */ (0,
|
|
20940
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20766
20941
|
Flex,
|
|
20767
20942
|
{
|
|
20768
20943
|
$flexWrap: "wrap",
|
|
20769
20944
|
$justifyContent: "space-between",
|
|
20770
20945
|
$alignItems: "center",
|
|
20771
20946
|
$gap: "1rem",
|
|
20772
|
-
children: /* @__PURE__ */ (0,
|
|
20773
|
-
props.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0,
|
|
20947
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Flex, { $gap: "1rem", children: [
|
|
20948
|
+
props.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20774
20949
|
IconRound,
|
|
20775
20950
|
{
|
|
20776
20951
|
name: entitlement.feature.icon,
|
|
@@ -20781,19 +20956,19 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20781
20956
|
]
|
|
20782
20957
|
}
|
|
20783
20958
|
),
|
|
20784
|
-
entitlement.feature?.name && /* @__PURE__ */ (0,
|
|
20959
|
+
entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20785
20960
|
Text,
|
|
20786
20961
|
{
|
|
20787
20962
|
$font: theme.typography.text.fontFamily,
|
|
20788
20963
|
$size: theme.typography.text.fontSize,
|
|
20789
20964
|
$weight: theme.typography.text.fontWeight,
|
|
20790
20965
|
$color: theme.typography.text.color,
|
|
20791
|
-
children: entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ (0,
|
|
20966
|
+
children: entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
20792
20967
|
entitlement.valueType === "unlimited" ? t2("Unlimited", {
|
|
20793
20968
|
item: getFeatureName(
|
|
20794
20969
|
entitlement.feature
|
|
20795
20970
|
)
|
|
20796
|
-
}) : typeof entitlement.valueNumeric === "number" && /* @__PURE__ */ (0,
|
|
20971
|
+
}) : typeof entitlement.valueNumeric === "number" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
20797
20972
|
formatNumber(
|
|
20798
20973
|
entitlement.valueNumeric
|
|
20799
20974
|
),
|
|
@@ -20803,7 +20978,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20803
20978
|
entitlement.valueNumeric
|
|
20804
20979
|
)
|
|
20805
20980
|
] }),
|
|
20806
|
-
entitlement.metricPeriod && /* @__PURE__ */ (0,
|
|
20981
|
+
entitlement.metricPeriod && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
20807
20982
|
" ",
|
|
20808
20983
|
t2("per"),
|
|
20809
20984
|
" ",
|
|
@@ -20825,7 +21000,7 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20825
21000
|
)
|
|
20826
21001
|
}
|
|
20827
21002
|
),
|
|
20828
|
-
props.upgrade.isVisible && /* @__PURE__ */ (0,
|
|
21003
|
+
props.upgrade.isVisible && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
20829
21004
|
EmbedButton,
|
|
20830
21005
|
{
|
|
20831
21006
|
type: "button",
|
|
@@ -20861,10 +21036,39 @@ var PricingTable = (0, import_react39.forwardRef)(({ children, className, ...res
|
|
|
20861
21036
|
});
|
|
20862
21037
|
PricingTable.displayName = "PricingTable";
|
|
20863
21038
|
|
|
21039
|
+
// src/components/elements/text/Text.tsx
|
|
21040
|
+
var import_react41 = require("react");
|
|
21041
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
21042
|
+
var resolveDesignProps9 = (props) => {
|
|
21043
|
+
return {
|
|
21044
|
+
text: {
|
|
21045
|
+
fontStyle: props.text?.fontStyle ?? "text",
|
|
21046
|
+
alignment: props.text?.alignment ?? "left",
|
|
21047
|
+
textContent: props.text?.textContent ?? "Text"
|
|
21048
|
+
}
|
|
21049
|
+
};
|
|
21050
|
+
};
|
|
21051
|
+
var TextElement = (0, import_react41.forwardRef)(({ children, className, ...rest }, ref) => {
|
|
21052
|
+
const props = resolveDesignProps9(rest);
|
|
21053
|
+
const theme = nt();
|
|
21054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Element, { as: Flex, ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
21055
|
+
Text,
|
|
21056
|
+
{
|
|
21057
|
+
$font: theme.typography[props.text.fontStyle].fontFamily,
|
|
21058
|
+
$size: theme.typography[props.text.fontStyle].fontSize,
|
|
21059
|
+
$weight: theme.typography[props.text.fontStyle].fontWeight,
|
|
21060
|
+
$color: theme.typography[props.text.fontStyle].color,
|
|
21061
|
+
$align: props.text.alignment,
|
|
21062
|
+
children: props.text.textContent
|
|
21063
|
+
}
|
|
21064
|
+
) });
|
|
21065
|
+
});
|
|
21066
|
+
TextElement.displayName = "Text";
|
|
21067
|
+
|
|
20864
21068
|
// src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
|
|
20865
|
-
var
|
|
20866
|
-
var
|
|
20867
|
-
var
|
|
21069
|
+
var import_react42 = require("react");
|
|
21070
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
21071
|
+
var resolveDesignProps10 = (props) => {
|
|
20868
21072
|
return {
|
|
20869
21073
|
button: {
|
|
20870
21074
|
text: props.button?.text ?? "Unsubscribe",
|
|
@@ -20875,8 +21079,8 @@ var resolveDesignProps8 = (props) => {
|
|
|
20875
21079
|
}
|
|
20876
21080
|
};
|
|
20877
21081
|
};
|
|
20878
|
-
var UnsubscribeButton = (0,
|
|
20879
|
-
const props =
|
|
21082
|
+
var UnsubscribeButton = (0, import_react42.forwardRef)(({ children, className, ...rest }, ref) => {
|
|
21083
|
+
const props = resolveDesignProps10(rest);
|
|
20880
21084
|
const { t: t2 } = useTranslation();
|
|
20881
21085
|
const { data, setLayout } = useEmbed();
|
|
20882
21086
|
const disabled = !data.subscription || data.subscription.status === "cancelled" || data.subscription.cancelAtPeriodEnd;
|
|
@@ -20894,7 +21098,7 @@ var UnsubscribeButton = (0, import_react40.forwardRef)(({ children, className, .
|
|
|
20894
21098
|
variant: "text"
|
|
20895
21099
|
}
|
|
20896
21100
|
};
|
|
20897
|
-
return /* @__PURE__ */ (0,
|
|
21101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
20898
21102
|
Element,
|
|
20899
21103
|
{
|
|
20900
21104
|
as: Flex,
|
|
@@ -20902,7 +21106,7 @@ var UnsubscribeButton = (0, import_react40.forwardRef)(({ children, className, .
|
|
|
20902
21106
|
className,
|
|
20903
21107
|
$flexDirection: "column",
|
|
20904
21108
|
$gap: "2rem",
|
|
20905
|
-
children: /* @__PURE__ */ (0,
|
|
21109
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
20906
21110
|
EmbedButton,
|
|
20907
21111
|
{
|
|
20908
21112
|
$size: props.button.size,
|
|
@@ -20923,9 +21127,9 @@ var UnsubscribeButton = (0, import_react40.forwardRef)(({ children, className, .
|
|
|
20923
21127
|
UnsubscribeButton.displayName = "UnsubscribeButton";
|
|
20924
21128
|
|
|
20925
21129
|
// src/components/elements/upcoming-bill/UpcomingBill.tsx
|
|
20926
|
-
var
|
|
20927
|
-
var
|
|
20928
|
-
function
|
|
21130
|
+
var import_react43 = require("react");
|
|
21131
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
21132
|
+
function resolveDesignProps11(props) {
|
|
20929
21133
|
return {
|
|
20930
21134
|
header: {
|
|
20931
21135
|
isVisible: props.header?.isVisible ?? true,
|
|
@@ -20943,13 +21147,13 @@ function resolveDesignProps9(props) {
|
|
|
20943
21147
|
}
|
|
20944
21148
|
};
|
|
20945
21149
|
}
|
|
20946
|
-
var UpcomingBill = (0,
|
|
20947
|
-
const props =
|
|
21150
|
+
var UpcomingBill = (0, import_react43.forwardRef)(({ className, ...rest }, ref) => {
|
|
21151
|
+
const props = resolveDesignProps11(rest);
|
|
20948
21152
|
const { t: t2 } = useTranslation();
|
|
20949
21153
|
const theme = nt();
|
|
20950
21154
|
const { data } = useEmbed();
|
|
20951
21155
|
const isLightBackground = useIsLightBackground();
|
|
20952
|
-
const { upcomingInvoice, discounts } = (0,
|
|
21156
|
+
const { upcomingInvoice, discounts } = (0, import_react43.useMemo)(() => {
|
|
20953
21157
|
const discounts2 = (data.subscription?.discounts || []).map((discount) => ({
|
|
20954
21158
|
amountOff: discount.amountOff,
|
|
20955
21159
|
couponId: discount.couponId,
|
|
@@ -20976,7 +21180,7 @@ var UpcomingBill = (0, import_react41.forwardRef)(({ className, ...rest }, ref)
|
|
|
20976
21180
|
if (typeof upcomingInvoice.amountDue !== "number" || !upcomingInvoice.dueDate) {
|
|
20977
21181
|
return null;
|
|
20978
21182
|
}
|
|
20979
|
-
return /* @__PURE__ */ (0,
|
|
21183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
20980
21184
|
Element,
|
|
20981
21185
|
{
|
|
20982
21186
|
as: Flex,
|
|
@@ -20985,7 +21189,7 @@ var UpcomingBill = (0, import_react41.forwardRef)(({ className, ...rest }, ref)
|
|
|
20985
21189
|
$flexDirection: "column",
|
|
20986
21190
|
$gap: "1rem",
|
|
20987
21191
|
children: [
|
|
20988
|
-
props.header.isVisible && /* @__PURE__ */ (0,
|
|
21192
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
20989
21193
|
Text,
|
|
20990
21194
|
{
|
|
20991
21195
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -20999,8 +21203,8 @@ var UpcomingBill = (0, import_react41.forwardRef)(({ className, ...rest }, ref)
|
|
|
20999
21203
|
]
|
|
21000
21204
|
}
|
|
21001
21205
|
) }),
|
|
21002
|
-
/* @__PURE__ */ (0,
|
|
21003
|
-
props.price.isVisible && /* @__PURE__ */ (0,
|
|
21206
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "start", $gap: "1rem", children: [
|
|
21207
|
+
props.price.isVisible && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Flex, { $alignItems: "end", $flexGrow: "1", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
21004
21208
|
Text,
|
|
21005
21209
|
{
|
|
21006
21210
|
$font: theme.typography[props.price.fontStyle].fontFamily,
|
|
@@ -21014,7 +21218,7 @@ var UpcomingBill = (0, import_react41.forwardRef)(({ className, ...rest }, ref)
|
|
|
21014
21218
|
)
|
|
21015
21219
|
}
|
|
21016
21220
|
) }),
|
|
21017
|
-
/* @__PURE__ */ (0,
|
|
21221
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { $lineHeight: 1.15, $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
21018
21222
|
Text,
|
|
21019
21223
|
{
|
|
21020
21224
|
$font: theme.typography[props.contractEndDate.fontStyle].fontFamily,
|
|
@@ -21026,8 +21230,8 @@ var UpcomingBill = (0, import_react41.forwardRef)(({ className, ...rest }, ref)
|
|
|
21026
21230
|
}
|
|
21027
21231
|
) })
|
|
21028
21232
|
] }),
|
|
21029
|
-
discounts.length > 0 && /* @__PURE__ */ (0,
|
|
21030
|
-
/* @__PURE__ */ (0,
|
|
21233
|
+
discounts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
|
|
21234
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
21031
21235
|
Text,
|
|
21032
21236
|
{
|
|
21033
21237
|
$font: theme.typography.text.fontFamily,
|
|
@@ -21037,8 +21241,8 @@ var UpcomingBill = (0, import_react41.forwardRef)(({ className, ...rest }, ref)
|
|
|
21037
21241
|
children: t2("Discount")
|
|
21038
21242
|
}
|
|
21039
21243
|
) }),
|
|
21040
|
-
/* @__PURE__ */ (0,
|
|
21041
|
-
/* @__PURE__ */ (0,
|
|
21244
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { children: discounts.map((discount) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
|
|
21245
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
21042
21246
|
Flex,
|
|
21043
21247
|
{
|
|
21044
21248
|
$alignItems: "center",
|
|
@@ -21047,7 +21251,7 @@ var UpcomingBill = (0, import_react41.forwardRef)(({ className, ...rest }, ref)
|
|
|
21047
21251
|
$borderStyle: "solid",
|
|
21048
21252
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
|
|
21049
21253
|
$borderRadius: "0.3125rem",
|
|
21050
|
-
children: /* @__PURE__ */ (0,
|
|
21254
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
21051
21255
|
Text,
|
|
21052
21256
|
{
|
|
21053
21257
|
$font: theme.typography.text.fontFamily,
|
|
@@ -21059,7 +21263,7 @@ var UpcomingBill = (0, import_react41.forwardRef)(({ className, ...rest }, ref)
|
|
|
21059
21263
|
)
|
|
21060
21264
|
}
|
|
21061
21265
|
),
|
|
21062
|
-
/* @__PURE__ */ (0,
|
|
21266
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
21063
21267
|
Text,
|
|
21064
21268
|
{
|
|
21065
21269
|
$font: theme.typography.text.fontFamily,
|
|
@@ -21078,10 +21282,10 @@ var UpcomingBill = (0, import_react41.forwardRef)(({ className, ...rest }, ref)
|
|
|
21078
21282
|
UpcomingBill.displayName = "UpcomingBill";
|
|
21079
21283
|
|
|
21080
21284
|
// src/components/embed/ComponentTree.tsx
|
|
21081
|
-
var
|
|
21285
|
+
var import_react45 = require("react");
|
|
21082
21286
|
|
|
21083
21287
|
// src/components/embed/renderer.ts
|
|
21084
|
-
var
|
|
21288
|
+
var import_react44 = require("react");
|
|
21085
21289
|
var components = {
|
|
21086
21290
|
Root,
|
|
21087
21291
|
Viewport,
|
|
@@ -21094,7 +21298,8 @@ var components = {
|
|
|
21094
21298
|
PaymentMethod,
|
|
21095
21299
|
Invoices,
|
|
21096
21300
|
PricingTable,
|
|
21097
|
-
UnsubscribeButton
|
|
21301
|
+
UnsubscribeButton,
|
|
21302
|
+
ButtonElement
|
|
21098
21303
|
};
|
|
21099
21304
|
function createRenderer(options) {
|
|
21100
21305
|
const { useFallback = false } = options || {};
|
|
@@ -21114,7 +21319,7 @@ function createRenderer(options) {
|
|
|
21114
21319
|
const { className, ...rest } = props;
|
|
21115
21320
|
const resolvedProps = component === "div" ? rest : props;
|
|
21116
21321
|
const resolvedChildren = children.map(renderNode);
|
|
21117
|
-
return (0,
|
|
21322
|
+
return (0, import_react44.createElement)(
|
|
21118
21323
|
component,
|
|
21119
21324
|
{
|
|
21120
21325
|
key: index,
|
|
@@ -21127,10 +21332,10 @@ function createRenderer(options) {
|
|
|
21127
21332
|
}
|
|
21128
21333
|
|
|
21129
21334
|
// src/components/embed/ComponentTree.tsx
|
|
21130
|
-
var
|
|
21335
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
21131
21336
|
var Loading = () => {
|
|
21132
21337
|
const theme = nt();
|
|
21133
|
-
return /* @__PURE__ */ (0,
|
|
21338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
21134
21339
|
Flex,
|
|
21135
21340
|
{
|
|
21136
21341
|
$width: "100%",
|
|
@@ -21138,13 +21343,13 @@ var Loading = () => {
|
|
|
21138
21343
|
$alignItems: "center",
|
|
21139
21344
|
$justifyContent: "center",
|
|
21140
21345
|
$padding: `${theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
21141
|
-
children: /* @__PURE__ */ (0,
|
|
21346
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Loader, { $color: "#194BFB", $size: "2xl" })
|
|
21142
21347
|
}
|
|
21143
21348
|
);
|
|
21144
21349
|
};
|
|
21145
21350
|
var Error2 = ({ message }) => {
|
|
21146
21351
|
const theme = nt();
|
|
21147
|
-
return /* @__PURE__ */ (0,
|
|
21352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
21148
21353
|
Flex,
|
|
21149
21354
|
{
|
|
21150
21355
|
$flexDirection: "column",
|
|
@@ -21155,7 +21360,7 @@ var Error2 = ({ message }) => {
|
|
|
21155
21360
|
$alignItems: "center",
|
|
21156
21361
|
$justifyContent: "center",
|
|
21157
21362
|
children: [
|
|
21158
|
-
/* @__PURE__ */ (0,
|
|
21363
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
21159
21364
|
Box,
|
|
21160
21365
|
{
|
|
21161
21366
|
$marginBottom: `${8 / TEXT_BASE_SIZE}rem`,
|
|
@@ -21166,7 +21371,7 @@ var Error2 = ({ message }) => {
|
|
|
21166
21371
|
children: "Error"
|
|
21167
21372
|
}
|
|
21168
21373
|
),
|
|
21169
|
-
/* @__PURE__ */ (0,
|
|
21374
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
21170
21375
|
Box,
|
|
21171
21376
|
{
|
|
21172
21377
|
$marginBottom: `${8 / TEXT_BASE_SIZE}rem`,
|
|
@@ -21183,23 +21388,23 @@ var Error2 = ({ message }) => {
|
|
|
21183
21388
|
};
|
|
21184
21389
|
var ComponentTree = () => {
|
|
21185
21390
|
const { error, nodes, isPending } = useEmbed();
|
|
21186
|
-
const [children, setChildren] = (0,
|
|
21187
|
-
(0,
|
|
21391
|
+
const [children, setChildren] = (0, import_react45.useState)(/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Loading, {}));
|
|
21392
|
+
(0, import_react45.useEffect)(() => {
|
|
21188
21393
|
const renderer = createRenderer();
|
|
21189
21394
|
setChildren(nodes.map(renderer));
|
|
21190
21395
|
}, [nodes]);
|
|
21191
21396
|
if (error) {
|
|
21192
21397
|
console.error(error);
|
|
21193
|
-
return /* @__PURE__ */ (0,
|
|
21398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Error2, { message: error.message });
|
|
21194
21399
|
}
|
|
21195
21400
|
if (isPending) {
|
|
21196
|
-
return /* @__PURE__ */ (0,
|
|
21401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Loading, {});
|
|
21197
21402
|
}
|
|
21198
|
-
return /* @__PURE__ */ (0,
|
|
21403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, { children });
|
|
21199
21404
|
};
|
|
21200
21405
|
|
|
21201
21406
|
// src/components/embed/Embed.tsx
|
|
21202
|
-
var
|
|
21407
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
21203
21408
|
var SchematicEmbed = ({
|
|
21204
21409
|
id,
|
|
21205
21410
|
accessToken,
|
|
@@ -21207,19 +21412,19 @@ var SchematicEmbed = ({
|
|
|
21207
21412
|
debug
|
|
21208
21413
|
}) => {
|
|
21209
21414
|
if (accessToken?.length === 0) {
|
|
21210
|
-
return /* @__PURE__ */ (0,
|
|
21415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { children: "Please provide an access token." });
|
|
21211
21416
|
}
|
|
21212
21417
|
if (!accessToken?.startsWith("token_")) {
|
|
21213
|
-
return /* @__PURE__ */ (0,
|
|
21418
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { children: 'Invalid access token; your temporary access token will start with "token_".' });
|
|
21214
21419
|
}
|
|
21215
|
-
return /* @__PURE__ */ (0,
|
|
21420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
21216
21421
|
EmbedProvider,
|
|
21217
21422
|
{
|
|
21218
21423
|
id,
|
|
21219
21424
|
accessToken,
|
|
21220
21425
|
apiConfig,
|
|
21221
21426
|
debug,
|
|
21222
|
-
children: /* @__PURE__ */ (0,
|
|
21427
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ComponentTree, {})
|
|
21223
21428
|
}
|
|
21224
21429
|
);
|
|
21225
21430
|
};
|