@schematichq/schematic-react 0.2.0-rc.5 → 0.2.0-rc.6
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/schematic-react.cjs.js +845 -577
- package/dist/schematic-react.d.ts +16 -17
- package/dist/schematic-react.esm.js +877 -609
- package/package.json +2 -2
@@ -6418,7 +6418,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
|
|
6418
6418
|
}
|
6419
6419
|
stripe._registerWrapper({
|
6420
6420
|
name: "stripe-js",
|
6421
|
-
version: "4.
|
6421
|
+
version: "4.4.0",
|
6422
6422
|
startTime
|
6423
6423
|
});
|
6424
6424
|
};
|
@@ -7344,7 +7344,6 @@ function PaymentMethodResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
7344
7344
|
environmentId: json["environment_id"],
|
7345
7345
|
externalId: json["external_id"],
|
7346
7346
|
id: json["id"],
|
7347
|
-
invoiceExternalId: json["invoice_external_id"] == null ? void 0 : json["invoice_external_id"],
|
7348
7347
|
paymentMethodType: json["payment_method_type"],
|
7349
7348
|
subscriptionExternalId: json["subscription_external_id"] == null ? void 0 : json["subscription_external_id"],
|
7350
7349
|
updatedAt: new Date(json["updated_at"])
|
@@ -7969,33 +7968,6 @@ function parseEditorState(data) {
|
|
7969
7968
|
});
|
7970
7969
|
return arr;
|
7971
7970
|
}
|
7972
|
-
async function fetchComponent(id, api) {
|
7973
|
-
const nodes = [];
|
7974
|
-
const settings = { ...defaultSettings };
|
7975
|
-
const response = await api.hydrateComponent({ componentId: id });
|
7976
|
-
const { data } = response;
|
7977
|
-
if (data.component?.ast) {
|
7978
|
-
const compressed = data.component.ast;
|
7979
|
-
const json = inflate_1(Uint8Array.from(Object.values(compressed)), {
|
7980
|
-
to: "string"
|
7981
|
-
});
|
7982
|
-
const ast = getEditorState(json);
|
7983
|
-
if (ast) {
|
7984
|
-
(0, import_lodash.default)(settings, ast.ROOT.props.settings);
|
7985
|
-
nodes.push(...parseEditorState(ast));
|
7986
|
-
}
|
7987
|
-
}
|
7988
|
-
let stripe = null;
|
7989
|
-
if (data.stripeEmbed?.publishableKey) {
|
7990
|
-
stripe = loadStripe(data.stripeEmbed.publishableKey);
|
7991
|
-
}
|
7992
|
-
return {
|
7993
|
-
data,
|
7994
|
-
nodes,
|
7995
|
-
settings,
|
7996
|
-
stripe
|
7997
|
-
};
|
7998
|
-
}
|
7999
7971
|
var EmbedContext = createContext({
|
8000
7972
|
api: null,
|
8001
7973
|
data: {
|
@@ -8006,6 +7978,9 @@ var EmbedContext = createContext({
|
|
8006
7978
|
stripe: null,
|
8007
7979
|
layout: "portal",
|
8008
7980
|
error: void 0,
|
7981
|
+
isPending: false,
|
7982
|
+
hydrate: () => {
|
7983
|
+
},
|
8009
7984
|
setData: () => {
|
8010
7985
|
},
|
8011
7986
|
updateSettings: () => {
|
@@ -8032,7 +8007,10 @@ var EmbedProvider = ({
|
|
8032
8007
|
settings: { ...defaultSettings },
|
8033
8008
|
stripe: null,
|
8034
8009
|
layout: "portal",
|
8010
|
+
isPending: false,
|
8035
8011
|
error: void 0,
|
8012
|
+
hydrate: () => {
|
8013
|
+
},
|
8036
8014
|
setData: () => {
|
8037
8015
|
},
|
8038
8016
|
updateSettings: () => {
|
@@ -8043,45 +8021,47 @@ var EmbedProvider = ({
|
|
8043
8021
|
}
|
8044
8022
|
};
|
8045
8023
|
});
|
8046
|
-
|
8047
|
-
|
8048
|
-
|
8049
|
-
|
8050
|
-
|
8051
|
-
|
8052
|
-
|
8053
|
-
|
8054
|
-
|
8055
|
-
|
8056
|
-
|
8057
|
-
|
8058
|
-
|
8059
|
-
|
8060
|
-
|
8061
|
-
|
8062
|
-
|
8063
|
-
|
8064
|
-
|
8065
|
-
|
8066
|
-
if (!id || !state.api) {
|
8067
|
-
return;
|
8068
|
-
}
|
8069
|
-
fetchComponent(id, state.api).then(async (resolvedData) => {
|
8070
|
-
setState((prev2) => ({ ...prev2, ...resolvedData }));
|
8071
|
-
}).catch((error) => setState((prev2) => ({ ...prev2, error })));
|
8072
|
-
}, [id, state.api]);
|
8073
|
-
useEffect(() => {
|
8074
|
-
const fontSet = /* @__PURE__ */ new Set([]);
|
8075
|
-
Object.values(state.settings.theme.typography).forEach(({ fontFamily }) => {
|
8076
|
-
fontSet.add(fontFamily);
|
8077
|
-
});
|
8078
|
-
if (fontSet.size > 0) {
|
8079
|
-
const src = `https://fonts.googleapis.com/css2?${[...fontSet].map((fontFamily) => `family=${fontFamily}&display=swap`).join("&")}`;
|
8080
|
-
if (styleRef.current) {
|
8081
|
-
styleRef.current.href = src;
|
8024
|
+
const hydrate = useCallback(async () => {
|
8025
|
+
setState((prev2) => ({ ...prev2, isPending: true, error: void 0 }));
|
8026
|
+
try {
|
8027
|
+
const nodes = [];
|
8028
|
+
const settings = { ...defaultSettings };
|
8029
|
+
if (!id || !state.api) {
|
8030
|
+
throw new Error("Invalid component id or api instance.");
|
8031
|
+
}
|
8032
|
+
const response = await state.api.hydrateComponent({ componentId: id });
|
8033
|
+
const { data } = response;
|
8034
|
+
if (data.component?.ast) {
|
8035
|
+
const compressed = data.component.ast;
|
8036
|
+
const json = inflate_1(Uint8Array.from(Object.values(compressed)), {
|
8037
|
+
to: "string"
|
8038
|
+
});
|
8039
|
+
const ast = getEditorState(json);
|
8040
|
+
if (ast) {
|
8041
|
+
(0, import_lodash.default)(settings, ast.ROOT.props.settings);
|
8042
|
+
nodes.push(...parseEditorState(ast));
|
8043
|
+
}
|
8082
8044
|
}
|
8045
|
+
let stripe = null;
|
8046
|
+
if (data.stripeEmbed?.publishableKey) {
|
8047
|
+
stripe = loadStripe(data.stripeEmbed.publishableKey);
|
8048
|
+
}
|
8049
|
+
setState((prev2) => ({
|
8050
|
+
...prev2,
|
8051
|
+
data,
|
8052
|
+
nodes,
|
8053
|
+
settings,
|
8054
|
+
stripe,
|
8055
|
+
isPending: false
|
8056
|
+
}));
|
8057
|
+
} catch (error) {
|
8058
|
+
setState((prev2) => ({
|
8059
|
+
...prev2,
|
8060
|
+
isPending: false,
|
8061
|
+
error: error instanceof Error ? error : new Error("An unknown error occurred.")
|
8062
|
+
}));
|
8083
8063
|
}
|
8084
|
-
}, [state.
|
8064
|
+
}, [id, state.api]);
|
8085
8065
|
const setData = useCallback(
|
8086
8066
|
(data) => {
|
8087
8067
|
setState((prev2) => {
|
@@ -8124,6 +8104,40 @@ var EmbedProvider = ({
|
|
8124
8104
|
},
|
8125
8105
|
[setState]
|
8126
8106
|
);
|
8107
|
+
useEffect(() => {
|
8108
|
+
const element = document.getElementById("schematic-fonts");
|
8109
|
+
if (element) {
|
8110
|
+
return void (styleRef.current = element);
|
8111
|
+
}
|
8112
|
+
const style = document.createElement("link");
|
8113
|
+
style.id = "schematic-fonts";
|
8114
|
+
style.rel = "stylesheet";
|
8115
|
+
document.head.appendChild(style);
|
8116
|
+
styleRef.current = style;
|
8117
|
+
}, []);
|
8118
|
+
useEffect(() => {
|
8119
|
+
if (!accessToken) {
|
8120
|
+
return;
|
8121
|
+
}
|
8122
|
+
const config = new Configuration({ ...apiConfig, apiKey: accessToken });
|
8123
|
+
const api = new CheckoutApi(config);
|
8124
|
+
setState((prev2) => ({ ...prev2, api }));
|
8125
|
+
}, [accessToken, apiConfig]);
|
8126
|
+
useEffect(() => {
|
8127
|
+
hydrate();
|
8128
|
+
}, [hydrate]);
|
8129
|
+
useEffect(() => {
|
8130
|
+
const fontSet = /* @__PURE__ */ new Set([]);
|
8131
|
+
Object.values(state.settings.theme.typography).forEach(({ fontFamily }) => {
|
8132
|
+
fontSet.add(fontFamily);
|
8133
|
+
});
|
8134
|
+
if (fontSet.size > 0) {
|
8135
|
+
const src = `https://fonts.googleapis.com/css2?${[...fontSet].map((fontFamily) => `family=${fontFamily}&display=swap`).join("&")}`;
|
8136
|
+
if (styleRef.current) {
|
8137
|
+
styleRef.current.href = src;
|
8138
|
+
}
|
8139
|
+
}
|
8140
|
+
}, [state.settings.theme.typography]);
|
8127
8141
|
const renderChildren = () => {
|
8128
8142
|
if (state.stripe) {
|
8129
8143
|
return /* @__PURE__ */ jsx(
|
@@ -8176,6 +8190,8 @@ var EmbedProvider = ({
|
|
8176
8190
|
stripe: state.stripe,
|
8177
8191
|
layout: state.layout,
|
8178
8192
|
error: state.error,
|
8193
|
+
isPending: state.isPending,
|
8194
|
+
hydrate,
|
8179
8195
|
setData,
|
8180
8196
|
updateSettings,
|
8181
8197
|
setStripe,
|
@@ -8756,19 +8772,36 @@ function v4(options, buf, offset) {
|
|
8756
8772
|
}
|
8757
8773
|
var v4_default = v4;
|
8758
8774
|
var import_polyfill = __toESM2(require_browser_polyfill());
|
8775
|
+
function contextString(context) {
|
8776
|
+
const sortedContext = Object.keys(context).reduce((acc, key) => {
|
8777
|
+
const sortedKeys = Object.keys(
|
8778
|
+
context[key] || {}
|
8779
|
+
).sort();
|
8780
|
+
const sortedObj = sortedKeys.reduce((obj, sortedKey) => {
|
8781
|
+
obj[sortedKey] = context[key][sortedKey];
|
8782
|
+
return obj;
|
8783
|
+
}, {});
|
8784
|
+
acc[key] = sortedObj;
|
8785
|
+
return acc;
|
8786
|
+
}, {});
|
8787
|
+
return JSON.stringify(sortedContext);
|
8788
|
+
}
|
8759
8789
|
var anonymousIdKey = "schematicId";
|
8760
8790
|
var Schematic = class {
|
8761
8791
|
apiKey;
|
8762
8792
|
apiUrl = "https://api.schematichq.com";
|
8763
|
-
webSocketUrl = "wss://api.schematichq.com";
|
8764
|
-
eventUrl = "https://c.schematichq.com";
|
8765
8793
|
conn = null;
|
8766
8794
|
context = {};
|
8767
8795
|
eventQueue;
|
8796
|
+
eventUrl = "https://c.schematichq.com";
|
8797
|
+
flagListener;
|
8798
|
+
flagValueListeners = {};
|
8799
|
+
isPending = true;
|
8800
|
+
isPendingListeners = /* @__PURE__ */ new Set();
|
8768
8801
|
storage;
|
8769
8802
|
useWebSocket = false;
|
8770
8803
|
values = {};
|
8771
|
-
|
8804
|
+
webSocketUrl = "wss://api.schematichq.com";
|
8772
8805
|
constructor(apiKey, options) {
|
8773
8806
|
this.apiKey = apiKey;
|
8774
8807
|
this.eventQueue = [];
|
@@ -8788,12 +8821,14 @@ var Schematic = class {
|
|
8788
8821
|
if (options?.webSocketUrl !== void 0) {
|
8789
8822
|
this.webSocketUrl = options.webSocketUrl;
|
8790
8823
|
}
|
8791
|
-
if (window?.addEventListener) {
|
8824
|
+
if (typeof window !== "undefined" && window?.addEventListener) {
|
8792
8825
|
window.addEventListener("beforeunload", () => {
|
8793
8826
|
this.flushEventQueue();
|
8794
8827
|
});
|
8795
8828
|
}
|
8796
8829
|
}
|
8830
|
+
// Get value for a single flag
|
8831
|
+
// If in websocket mode, return the local value, otherwise make an API call
|
8797
8832
|
async checkFlag(options) {
|
8798
8833
|
const { fallback = false, key } = options;
|
8799
8834
|
const context = options.context || this.context;
|
@@ -8821,7 +8856,7 @@ var Schematic = class {
|
|
8821
8856
|
return fallback;
|
8822
8857
|
});
|
8823
8858
|
}
|
8824
|
-
// Make
|
8859
|
+
// Make an API call to fetch all flag values for a given context (use if not in websocket mode)
|
8825
8860
|
checkFlags = async (context) => {
|
8826
8861
|
context = context || this.context;
|
8827
8862
|
const requestUrl = `${this.apiUrl}/flags/check`;
|
@@ -8851,18 +8886,6 @@ var Schematic = class {
|
|
8851
8886
|
return false;
|
8852
8887
|
});
|
8853
8888
|
};
|
8854
|
-
cleanup = async () => {
|
8855
|
-
if (this.conn) {
|
8856
|
-
try {
|
8857
|
-
const socket = await this.conn;
|
8858
|
-
socket.close();
|
8859
|
-
} catch (error) {
|
8860
|
-
console.error("Error during cleanup:", error);
|
8861
|
-
} finally {
|
8862
|
-
this.conn = null;
|
8863
|
-
}
|
8864
|
-
}
|
8865
|
-
};
|
8866
8889
|
// Send an identify event
|
8867
8890
|
identify = (body) => {
|
8868
8891
|
this.setContext({
|
@@ -8880,12 +8903,16 @@ var Schematic = class {
|
|
8880
8903
|
this.context = context;
|
8881
8904
|
return Promise.resolve();
|
8882
8905
|
}
|
8883
|
-
|
8884
|
-
this.
|
8906
|
+
try {
|
8907
|
+
this.setIsPending(true);
|
8908
|
+
if (!this.conn) {
|
8909
|
+
this.conn = this.wsConnect();
|
8910
|
+
}
|
8911
|
+
const socket = await this.conn;
|
8912
|
+
await this.wsSendMessage(socket, context);
|
8913
|
+
} catch (error) {
|
8914
|
+
console.error("Error setting Schematic context:", error);
|
8885
8915
|
}
|
8886
|
-
return this.conn.then((socket) => {
|
8887
|
-
return this.wsSendMessage(socket, context);
|
8888
|
-
});
|
8889
8916
|
};
|
8890
8917
|
// Send track event
|
8891
8918
|
track = (body) => {
|
@@ -8897,6 +8924,9 @@ var Schematic = class {
|
|
8897
8924
|
user: user ?? this.context.user
|
8898
8925
|
});
|
8899
8926
|
};
|
8927
|
+
/**
|
8928
|
+
* Event processing
|
8929
|
+
*/
|
8900
8930
|
flushEventQueue = () => {
|
8901
8931
|
while (this.eventQueue.length > 0) {
|
8902
8932
|
const event = this.eventQueue.shift();
|
@@ -8952,6 +8982,22 @@ var Schematic = class {
|
|
8952
8982
|
this.eventQueue.push(event);
|
8953
8983
|
return Promise.resolve();
|
8954
8984
|
};
|
8985
|
+
/**
|
8986
|
+
* Websocket management
|
8987
|
+
*/
|
8988
|
+
cleanup = async () => {
|
8989
|
+
if (this.conn) {
|
8990
|
+
try {
|
8991
|
+
const socket = await this.conn;
|
8992
|
+
socket.close();
|
8993
|
+
} catch (error) {
|
8994
|
+
console.error("Error during cleanup:", error);
|
8995
|
+
} finally {
|
8996
|
+
this.conn = null;
|
8997
|
+
}
|
8998
|
+
}
|
8999
|
+
};
|
9000
|
+
// Open a websocket connection
|
8955
9001
|
wsConnect = () => {
|
8956
9002
|
return new Promise((resolve, reject) => {
|
8957
9003
|
const wsUrl = `${this.webSocketUrl}/flags/bootstrap`;
|
@@ -8967,6 +9013,8 @@ var Schematic = class {
|
|
8967
9013
|
};
|
8968
9014
|
});
|
8969
9015
|
};
|
9016
|
+
// Send a message on the websocket indicating interest in a particular evaluation context
|
9017
|
+
// and wait for the initial set of flag values to be returned
|
8970
9018
|
wsSendMessage = (socket, context) => {
|
8971
9019
|
return new Promise((resolve, reject) => {
|
8972
9020
|
if (contextString(context) == contextString(this.context)) {
|
@@ -8984,16 +9032,17 @@ var Schematic = class {
|
|
8984
9032
|
(message.flags ?? []).forEach(
|
8985
9033
|
(flag) => {
|
8986
9034
|
this.values[contextString(context)][flag.flag] = flag.value;
|
9035
|
+
this.notifyFlagValueListeners(flag.flag);
|
8987
9036
|
}
|
8988
9037
|
);
|
8989
9038
|
if (this.flagListener) {
|
8990
|
-
this.flagListener(this.
|
9039
|
+
this.flagListener(this.getFlagValues());
|
8991
9040
|
}
|
9041
|
+
this.setIsPending(false);
|
8992
9042
|
if (!resolved) {
|
8993
9043
|
resolved = true;
|
8994
9044
|
resolve();
|
8995
9045
|
}
|
8996
|
-
socket.removeEventListener("message", messageHandler);
|
8997
9046
|
};
|
8998
9047
|
socket.addEventListener("message", messageHandler);
|
8999
9048
|
socket.send(
|
@@ -9012,118 +9061,156 @@ var Schematic = class {
|
|
9012
9061
|
}
|
9013
9062
|
});
|
9014
9063
|
};
|
9064
|
+
/**
|
9065
|
+
* State management
|
9066
|
+
*/
|
9067
|
+
// isPending state
|
9068
|
+
getIsPending = () => {
|
9069
|
+
return this.isPending;
|
9070
|
+
};
|
9071
|
+
addIsPendingListener = (listener) => {
|
9072
|
+
this.isPendingListeners.add(listener);
|
9073
|
+
return () => {
|
9074
|
+
this.isPendingListeners.delete(listener);
|
9075
|
+
};
|
9076
|
+
};
|
9077
|
+
setIsPending = (isPending) => {
|
9078
|
+
this.isPending = isPending;
|
9079
|
+
this.isPendingListeners.forEach((listener) => listener());
|
9080
|
+
};
|
9081
|
+
// flagValues state
|
9082
|
+
getFlagValue = (flagKey) => {
|
9083
|
+
const values = this.getFlagValues();
|
9084
|
+
return values[flagKey];
|
9085
|
+
};
|
9086
|
+
getFlagValues = () => {
|
9087
|
+
const contextStr = contextString(this.context);
|
9088
|
+
return this.values[contextStr] ?? {};
|
9089
|
+
};
|
9090
|
+
addFlagValueListener = (flagKey, listener) => {
|
9091
|
+
if (!(flagKey in this.flagValueListeners)) {
|
9092
|
+
this.flagValueListeners[flagKey] = /* @__PURE__ */ new Set();
|
9093
|
+
}
|
9094
|
+
this.flagValueListeners[flagKey].add(listener);
|
9095
|
+
return () => {
|
9096
|
+
this.flagValueListeners[flagKey].delete(listener);
|
9097
|
+
};
|
9098
|
+
};
|
9099
|
+
notifyFlagValueListeners = (flagKey) => {
|
9100
|
+
const listeners = this.flagValueListeners?.[flagKey] ?? [];
|
9101
|
+
listeners.forEach((listener) => listener());
|
9102
|
+
};
|
9015
9103
|
};
|
9016
|
-
function contextString(context) {
|
9017
|
-
const sortedContext = Object.keys(context).reduce((acc, key) => {
|
9018
|
-
const sortedKeys = Object.keys(
|
9019
|
-
context[key] || {}
|
9020
|
-
).sort();
|
9021
|
-
const sortedObj = sortedKeys.reduce((obj, sortedKey) => {
|
9022
|
-
obj[sortedKey] = context[key][sortedKey];
|
9023
|
-
return obj;
|
9024
|
-
}, {});
|
9025
|
-
acc[key] = sortedObj;
|
9026
|
-
return acc;
|
9027
|
-
}, {});
|
9028
|
-
return JSON.stringify(sortedContext);
|
9029
|
-
}
|
9030
9104
|
|
9031
9105
|
// src/context/schematic.tsx
|
9032
|
-
import { createContext as createContext2, useEffect as useEffect2, useMemo
|
9106
|
+
import React, { createContext as createContext2, useEffect as useEffect2, useMemo } from "react";
|
9033
9107
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
9034
|
-
var SchematicContext = createContext2(
|
9035
|
-
|
9036
|
-
|
9108
|
+
var SchematicContext = createContext2(
|
9109
|
+
null
|
9110
|
+
);
|
9037
9111
|
var SchematicProvider = ({
|
9038
9112
|
children,
|
9039
9113
|
client: providedClient,
|
9040
9114
|
publishableKey,
|
9041
9115
|
...clientOpts
|
9042
9116
|
}) => {
|
9043
|
-
const
|
9044
|
-
|
9045
|
-
const memoizedClientOpts = useMemo(
|
9046
|
-
() => clientOpts,
|
9047
|
-
/* eslint-disable-next-line react-hooks/exhaustive-deps */
|
9048
|
-
[JSON.stringify(clientOpts)]
|
9049
|
-
);
|
9050
|
-
const { useWebSocket = true } = clientOpts;
|
9051
|
-
useEffect2(() => {
|
9052
|
-
let cleanupFunction;
|
9117
|
+
const client = useMemo(() => {
|
9118
|
+
const { useWebSocket = true } = clientOpts;
|
9053
9119
|
if (providedClient) {
|
9054
|
-
|
9055
|
-
|
9056
|
-
|
9057
|
-
|
9058
|
-
|
9059
|
-
|
9060
|
-
|
9061
|
-
|
9062
|
-
|
9063
|
-
|
9064
|
-
|
9065
|
-
});
|
9066
|
-
setClient(newClient);
|
9067
|
-
cleanupFunction = () => {
|
9068
|
-
newClient.cleanup().catch((error) => {
|
9120
|
+
return providedClient;
|
9121
|
+
}
|
9122
|
+
return new Schematic(publishableKey, {
|
9123
|
+
useWebSocket,
|
9124
|
+
...clientOpts
|
9125
|
+
});
|
9126
|
+
}, [providedClient, publishableKey, clientOpts]);
|
9127
|
+
useEffect2(() => {
|
9128
|
+
return () => {
|
9129
|
+
if (!providedClient) {
|
9130
|
+
client.cleanup().catch((error) => {
|
9069
9131
|
console.error("Error during cleanup:", error);
|
9070
9132
|
});
|
9071
|
-
}
|
9072
|
-
}
|
9073
|
-
|
9074
|
-
|
9075
|
-
|
9076
|
-
|
9077
|
-
|
9078
|
-
|
9133
|
+
}
|
9134
|
+
};
|
9135
|
+
}, [client, providedClient]);
|
9136
|
+
const contextValue = useMemo(
|
9137
|
+
() => ({
|
9138
|
+
client
|
9139
|
+
}),
|
9140
|
+
[client]
|
9141
|
+
);
|
9079
9142
|
return /* @__PURE__ */ jsx2(SchematicContext.Provider, { value: contextValue, children });
|
9080
9143
|
};
|
9144
|
+
var useSchematic = () => {
|
9145
|
+
const context = React.useContext(SchematicContext);
|
9146
|
+
if (context === null) {
|
9147
|
+
throw new Error("useSchematic must be used within a SchematicProvider");
|
9148
|
+
}
|
9149
|
+
return context;
|
9150
|
+
};
|
9081
9151
|
|
9082
9152
|
// src/hooks/embed.ts
|
9083
9153
|
import { useContext } from "react";
|
9084
9154
|
var useEmbed = () => useContext(EmbedContext);
|
9085
9155
|
|
9086
9156
|
// src/hooks/schematic.ts
|
9087
|
-
import {
|
9088
|
-
var useSchematic = () => useContext2(SchematicContext);
|
9157
|
+
import { useMemo as useMemo2, useSyncExternalStore, useCallback as useCallback2 } from "react";
|
9089
9158
|
var useSchematicClient = (opts) => {
|
9090
9159
|
const schematic = useSchematic();
|
9091
9160
|
const { client } = opts ?? {};
|
9092
|
-
|
9093
|
-
|
9094
|
-
|
9095
|
-
|
9161
|
+
return useMemo2(() => {
|
9162
|
+
if (client) {
|
9163
|
+
return client;
|
9164
|
+
}
|
9165
|
+
return schematic.client;
|
9166
|
+
}, [client, schematic.client]);
|
9096
9167
|
};
|
9097
9168
|
var useSchematicContext = (opts) => {
|
9098
9169
|
const client = useSchematicClient(opts);
|
9099
|
-
|
9100
|
-
|
9170
|
+
return useMemo2(
|
9171
|
+
() => ({
|
9172
|
+
setContext: client.setContext.bind(client)
|
9173
|
+
}),
|
9174
|
+
[client]
|
9175
|
+
);
|
9101
9176
|
};
|
9102
9177
|
var useSchematicEvents = (opts) => {
|
9103
9178
|
const client = useSchematicClient(opts);
|
9104
|
-
const
|
9105
|
-
|
9179
|
+
const track = useCallback2(
|
9180
|
+
(...args) => client.track(...args),
|
9181
|
+
[client]
|
9182
|
+
);
|
9183
|
+
const identify = useCallback2(
|
9184
|
+
(...args) => client.identify(...args),
|
9185
|
+
[client]
|
9186
|
+
);
|
9187
|
+
return useMemo2(() => ({ track, identify }), [track, identify]);
|
9106
9188
|
};
|
9107
9189
|
var useSchematicFlag = (key, opts) => {
|
9108
|
-
const
|
9109
|
-
const
|
9110
|
-
const
|
9111
|
-
|
9112
|
-
|
9113
|
-
|
9114
|
-
|
9115
|
-
|
9116
|
-
|
9117
|
-
|
9118
|
-
|
9119
|
-
|
9120
|
-
|
9121
|
-
|
9122
|
-
|
9190
|
+
const client = useSchematicClient(opts);
|
9191
|
+
const fallback = opts?.fallback ?? false;
|
9192
|
+
const subscribe = useCallback2(
|
9193
|
+
(callback) => client.addFlagValueListener(key, callback),
|
9194
|
+
[client, key]
|
9195
|
+
);
|
9196
|
+
const getSnapshot = useCallback2(() => {
|
9197
|
+
const value = client.getFlagValue(key);
|
9198
|
+
return typeof value === "undefined" ? fallback : value;
|
9199
|
+
}, [client, key, fallback]);
|
9200
|
+
return useSyncExternalStore(subscribe, getSnapshot);
|
9201
|
+
};
|
9202
|
+
var useSchematicIsPending = (opts) => {
|
9203
|
+
const client = useSchematicClient(opts);
|
9204
|
+
const subscribe = useCallback2(
|
9205
|
+
(callback) => client.addIsPendingListener(callback),
|
9206
|
+
[client]
|
9207
|
+
);
|
9208
|
+
const getSnapshot = useCallback2(() => client.getIsPending(), [client]);
|
9209
|
+
return useSyncExternalStore(subscribe, getSnapshot);
|
9123
9210
|
};
|
9124
9211
|
|
9125
9212
|
// src/components/elements/plan-manager/PlanManager.tsx
|
9126
|
-
import { forwardRef, useMemo as
|
9213
|
+
import { forwardRef, useMemo as useMemo6 } from "react";
|
9127
9214
|
import { createPortal } from "react-dom";
|
9128
9215
|
|
9129
9216
|
// src/utils/color.ts
|
@@ -9205,7 +9292,7 @@ function hslToHex({ h, s: s2, l: l2 }) {
|
|
9205
9292
|
}
|
9206
9293
|
function adjustLightness(color, amount) {
|
9207
9294
|
const { h, s: s2, l: l2 } = hexToHSL(color);
|
9208
|
-
return hslToHex({ h, s: s2, l: Math.max(Math.min(l2 + amount, 100), 0) });
|
9295
|
+
return hslToHex({ h, s: s2, l: Math.max(Math.min(l2 + amount * 100, 100), 0) });
|
9209
9296
|
}
|
9210
9297
|
function lighten(color, amount) {
|
9211
9298
|
return adjustLightness(color, amount);
|
@@ -9435,6 +9522,7 @@ var Container = dt.div`
|
|
9435
9522
|
align-items: center;
|
9436
9523
|
flex-shrink: 0;
|
9437
9524
|
border-radius: 9999px;
|
9525
|
+
|
9438
9526
|
${({ $size }) => {
|
9439
9527
|
const base = 24;
|
9440
9528
|
let scale = 1;
|
@@ -9452,6 +9540,15 @@ var Container = dt.div`
|
|
9452
9540
|
case "lg":
|
9453
9541
|
scale *= 1.75;
|
9454
9542
|
break;
|
9543
|
+
case "xl":
|
9544
|
+
scale *= 2;
|
9545
|
+
break;
|
9546
|
+
case "2xl":
|
9547
|
+
scale *= 2.5;
|
9548
|
+
break;
|
9549
|
+
case "3xl":
|
9550
|
+
scale *= 3;
|
9551
|
+
break;
|
9455
9552
|
}
|
9456
9553
|
return lt`
|
9457
9554
|
font-size: ${base * scale / TEXT_BASE_SIZE}rem;
|
@@ -9460,12 +9557,19 @@ var Container = dt.div`
|
|
9460
9557
|
height: ${(base + 8) * scale / TEXT_BASE_SIZE}rem;
|
9461
9558
|
`;
|
9462
9559
|
}}
|
9560
|
+
|
9463
9561
|
${({ $variant, $colors }) => $variant === "outline" ? lt`
|
9464
|
-
color: ${$colors[0]};
|
9465
9562
|
background-color: transparent;
|
9563
|
+
|
9564
|
+
${Icon} {
|
9565
|
+
color: ${$colors[0]};
|
9566
|
+
}
|
9466
9567
|
` : lt`
|
9467
|
-
color: ${$colors[0]};
|
9468
9568
|
background-color: ${$colors[1]};
|
9569
|
+
|
9570
|
+
${Icon} {
|
9571
|
+
color: ${$colors[0]};
|
9572
|
+
}
|
9469
9573
|
`}
|
9470
9574
|
`;
|
9471
9575
|
|
@@ -9488,17 +9592,20 @@ var IconRound = ({
|
|
9488
9592
|
};
|
9489
9593
|
|
9490
9594
|
// src/components/ui/modal/Modal.tsx
|
9491
|
-
import { useCallback as
|
9595
|
+
import { useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo3, useRef as useRef2 } from "react";
|
9492
9596
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
9493
|
-
var Modal = ({ children, onClose }) => {
|
9597
|
+
var Modal = ({ children, size = "auto", onClose }) => {
|
9494
9598
|
const theme = nt();
|
9495
9599
|
const { setLayout } = useEmbed();
|
9496
9600
|
const ref = useRef2(null);
|
9497
|
-
const
|
9601
|
+
const isLightBackground = useMemo3(() => {
|
9602
|
+
return hexToHSL(theme.card.background).l > 50;
|
9603
|
+
}, [theme.card.background]);
|
9604
|
+
const handleClose = useCallback3(() => {
|
9498
9605
|
setLayout("portal");
|
9499
9606
|
onClose?.();
|
9500
9607
|
}, [setLayout, onClose]);
|
9501
|
-
|
9608
|
+
useEffect3(() => {
|
9502
9609
|
ref.current?.focus();
|
9503
9610
|
}, []);
|
9504
9611
|
return /* @__PURE__ */ jsx6(
|
@@ -9523,7 +9630,7 @@ var Modal = ({ children, onClose }) => {
|
|
9523
9630
|
$transform: "translate(-50%, -50%)",
|
9524
9631
|
$width: "100%",
|
9525
9632
|
$height: "100%",
|
9526
|
-
$backgroundColor:
|
9633
|
+
$backgroundColor: isLightBackground ? "hsl(0, 0%, 85%)" : "hsl(0, 0%, 15%)",
|
9527
9634
|
$overflow: "hidden",
|
9528
9635
|
children: /* @__PURE__ */ jsx6(
|
9529
9636
|
Flex,
|
@@ -9534,9 +9641,13 @@ var Modal = ({ children, onClose }) => {
|
|
9534
9641
|
$transform: "translate(-50%, -50%)",
|
9535
9642
|
$flexDirection: "column",
|
9536
9643
|
$overflow: "hidden",
|
9537
|
-
$width: "
|
9538
|
-
|
9539
|
-
|
9644
|
+
...size === "auto" ? { $width: "min-content", $height: "min-content" } : {
|
9645
|
+
$width: "100%",
|
9646
|
+
$height: "100%",
|
9647
|
+
$maxWidth: "1366px",
|
9648
|
+
$maxHeight: "768px"
|
9649
|
+
},
|
9650
|
+
$backgroundColor: theme.card.background,
|
9540
9651
|
$borderRadius: "0.5rem",
|
9541
9652
|
$boxShadow: "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A;",
|
9542
9653
|
id: "select-plan-dialog",
|
@@ -9551,12 +9662,19 @@ var Modal = ({ children, onClose }) => {
|
|
9551
9662
|
};
|
9552
9663
|
|
9553
9664
|
// src/components/ui/modal/ModalHeader.tsx
|
9554
|
-
import { useCallback as
|
9665
|
+
import { useCallback as useCallback4, useMemo as useMemo4 } from "react";
|
9555
9666
|
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
9556
|
-
var ModalHeader = ({
|
9667
|
+
var ModalHeader = ({
|
9668
|
+
children,
|
9669
|
+
bordered = false,
|
9670
|
+
onClose
|
9671
|
+
}) => {
|
9557
9672
|
const theme = nt();
|
9558
9673
|
const { setLayout } = useEmbed();
|
9559
|
-
const
|
9674
|
+
const isLightBackground = useMemo4(() => {
|
9675
|
+
return hexToHSL(theme.card.background).l > 50;
|
9676
|
+
}, [theme.card.background]);
|
9677
|
+
const handleClose = useCallback4(() => {
|
9560
9678
|
setLayout("portal");
|
9561
9679
|
onClose?.();
|
9562
9680
|
}, [setLayout, onClose]);
|
@@ -9565,13 +9683,15 @@ var ModalHeader = ({ children, onClose }) => {
|
|
9565
9683
|
{
|
9566
9684
|
$justifyContent: "space-between",
|
9567
9685
|
$alignItems: "center",
|
9686
|
+
$flexShrink: "0",
|
9568
9687
|
$gap: "1rem",
|
9569
|
-
$height: "
|
9570
|
-
$padding: "0
|
9571
|
-
|
9572
|
-
|
9573
|
-
|
9574
|
-
|
9688
|
+
$height: "5rem",
|
9689
|
+
$padding: "0 1.5rem 0 3rem",
|
9690
|
+
...bordered && {
|
9691
|
+
$borderBottomWidth: "1px",
|
9692
|
+
$borderBottomStyle: "solid",
|
9693
|
+
$borderBottomColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)"
|
9694
|
+
},
|
9575
9695
|
children: [
|
9576
9696
|
children,
|
9577
9697
|
/* @__PURE__ */ jsx7(Box, { $cursor: "pointer", onClick: handleClose, children: /* @__PURE__ */ jsx7(
|
@@ -9580,7 +9700,7 @@ var ModalHeader = ({ children, onClose }) => {
|
|
9580
9700
|
name: "close",
|
9581
9701
|
style: {
|
9582
9702
|
fontSize: 36,
|
9583
|
-
color:
|
9703
|
+
color: isLightBackground ? "hsla(0, 0%, 0%, 0.275)" : "hsla(0, 0%, 100%, 0.275)"
|
9584
9704
|
}
|
9585
9705
|
}
|
9586
9706
|
) })
|
@@ -9632,14 +9752,14 @@ var ProgressBar = ({
|
|
9632
9752
|
$overflow: "hidden",
|
9633
9753
|
$width: "100%",
|
9634
9754
|
$height: `${8 / TEXT_BASE_SIZE}rem`,
|
9635
|
-
$
|
9755
|
+
$backgroundColor: "#F2F4F7",
|
9636
9756
|
$borderRadius: "9999px",
|
9637
9757
|
children: /* @__PURE__ */ jsx8(
|
9638
9758
|
Box,
|
9639
9759
|
{
|
9640
9760
|
$width: `${Math.min(progress, 100)}%`,
|
9641
9761
|
$height: "100%",
|
9642
|
-
$
|
9762
|
+
$backgroundColor: barColorMap[color],
|
9643
9763
|
$borderRadius: "9999px"
|
9644
9764
|
}
|
9645
9765
|
)
|
@@ -9658,10 +9778,10 @@ var ProgressBar = ({
|
|
9658
9778
|
};
|
9659
9779
|
|
9660
9780
|
// src/components/elements/plan-manager/CheckoutDialog.tsx
|
9661
|
-
import { useMemo as
|
9781
|
+
import { useEffect as useEffect4, useMemo as useMemo5, useState as useState3 } from "react";
|
9662
9782
|
|
9663
9783
|
// src/components/elements/plan-manager/PaymentForm.tsx
|
9664
|
-
import { useState as
|
9784
|
+
import { useState as useState2 } from "react";
|
9665
9785
|
import {
|
9666
9786
|
LinkAuthenticationElement,
|
9667
9787
|
PaymentElement
|
@@ -9702,7 +9822,7 @@ var StyledButton = dt(Button2)`
|
|
9702
9822
|
if (disabled) {
|
9703
9823
|
const { l: l2 } = hexToHSL(theme.card.background);
|
9704
9824
|
color = hslToHex({ h: 0, s: 0, l: l2 });
|
9705
|
-
color = l2 > 50 ? darken(color,
|
9825
|
+
color = l2 > 50 ? darken(color, 0.075) : lighten(color, 0.15);
|
9706
9826
|
}
|
9707
9827
|
return $variant === "filled" ? lt`
|
9708
9828
|
background-color: ${color};
|
@@ -9725,8 +9845,8 @@ var StyledButton = dt(Button2)`
|
|
9725
9845
|
&:not(:disabled):hover {
|
9726
9846
|
${({ $color = "primary", theme, $variant = "filled" }) => {
|
9727
9847
|
const specified = theme[$color];
|
9728
|
-
const lightened = lighten(specified, 15);
|
9729
|
-
const color = specified === lightened ? darken(specified, 15) : lightened;
|
9848
|
+
const lightened = lighten(specified, 0.15);
|
9849
|
+
const color = specified === lightened ? darken(specified, 0.15) : lightened;
|
9730
9850
|
const { l: l2 } = hexToHSL(theme[$color]);
|
9731
9851
|
const textColor = l2 > 50 ? "#000000" : "#FFFFFF";
|
9732
9852
|
return $variant === "filled" ? lt`
|
@@ -9748,21 +9868,21 @@ var StyledButton = dt(Button2)`
|
|
9748
9868
|
switch ($size) {
|
9749
9869
|
case "sm":
|
9750
9870
|
return lt`
|
9751
|
-
font-size: ${15 /
|
9752
|
-
padding: ${12 /
|
9753
|
-
border-radius: ${6 /
|
9871
|
+
font-size: ${15 / TEXT_BASE_SIZE}rem;
|
9872
|
+
padding: ${12 / TEXT_BASE_SIZE}rem 0;
|
9873
|
+
border-radius: ${6 / TEXT_BASE_SIZE}rem;
|
9754
9874
|
`;
|
9755
9875
|
case "md":
|
9756
9876
|
return lt`
|
9757
|
-
font-size: ${17 /
|
9758
|
-
padding: ${16 /
|
9759
|
-
border-radius: ${8 /
|
9877
|
+
font-size: ${17 / TEXT_BASE_SIZE}rem;
|
9878
|
+
padding: ${16 / TEXT_BASE_SIZE}rem 0;
|
9879
|
+
border-radius: ${8 / TEXT_BASE_SIZE}rem;
|
9760
9880
|
`;
|
9761
9881
|
case "lg":
|
9762
9882
|
return lt`
|
9763
|
-
font-size: ${19 /
|
9764
|
-
padding: ${20 /
|
9765
|
-
border-radius: ${10 /
|
9883
|
+
font-size: ${19 / TEXT_BASE_SIZE}rem;
|
9884
|
+
padding: ${20 / TEXT_BASE_SIZE}rem 0;
|
9885
|
+
border-radius: ${10 / TEXT_BASE_SIZE}rem;
|
9766
9886
|
`;
|
9767
9887
|
}
|
9768
9888
|
}}
|
@@ -9774,9 +9894,9 @@ var PaymentForm = ({ plan, period, onConfirm }) => {
|
|
9774
9894
|
const stripe = useStripe();
|
9775
9895
|
const elements = useElements();
|
9776
9896
|
const { api, data } = useEmbed();
|
9777
|
-
const [message, setMessage] =
|
9778
|
-
const [isLoading, setIsLoading] =
|
9779
|
-
const [isConfirmed, setIsConfirmed] =
|
9897
|
+
const [message, setMessage] = useState2(null);
|
9898
|
+
const [isLoading, setIsLoading] = useState2(false);
|
9899
|
+
const [isConfirmed, setIsConfirmed] = useState2(false);
|
9780
9900
|
const handleSubmit = async (event) => {
|
9781
9901
|
event.preventDefault();
|
9782
9902
|
const priceId = period === "month" ? plan.monthlyPrice?.id : plan.yearlyPrice?.id;
|
@@ -9785,6 +9905,7 @@ var PaymentForm = ({ plan, period, onConfirm }) => {
|
|
9785
9905
|
}
|
9786
9906
|
setIsLoading(true);
|
9787
9907
|
setIsConfirmed(false);
|
9908
|
+
setMessage(null);
|
9788
9909
|
try {
|
9789
9910
|
const { setupIntent, error } = await stripe.confirmSetup({
|
9790
9911
|
elements,
|
@@ -9801,13 +9922,9 @@ var PaymentForm = ({ plan, period, onConfirm }) => {
|
|
9801
9922
|
if (error?.type === "card_error" || error?.type === "validation_error") {
|
9802
9923
|
setMessage(error.message);
|
9803
9924
|
}
|
9804
|
-
setIsLoading(false);
|
9805
9925
|
} catch (error) {
|
9806
|
-
|
9807
|
-
|
9808
|
-
} else {
|
9809
|
-
setMessage("An unexpected error occured.");
|
9810
|
-
}
|
9926
|
+
setMessage("A problem occurred while saving your payment method.");
|
9927
|
+
} finally {
|
9811
9928
|
setIsLoading(false);
|
9812
9929
|
}
|
9813
9930
|
};
|
@@ -9830,8 +9947,8 @@ var PaymentForm = ({ plan, period, onConfirm }) => {
|
|
9830
9947
|
{
|
9831
9948
|
$flexDirection: "column",
|
9832
9949
|
$gap: "1.5rem",
|
9833
|
-
$marginBottom: "1.5rem",
|
9834
9950
|
$width: "100%",
|
9951
|
+
$marginBottom: "1.5rem",
|
9835
9952
|
children: /* @__PURE__ */ jsx9(
|
9836
9953
|
LinkAuthenticationElement,
|
9837
9954
|
{
|
@@ -9840,20 +9957,18 @@ var PaymentForm = ({ plan, period, onConfirm }) => {
|
|
9840
9957
|
)
|
9841
9958
|
}
|
9842
9959
|
),
|
9843
|
-
/* @__PURE__ */
|
9844
|
-
|
9845
|
-
message && /* @__PURE__ */ jsx9(Text, { id: "payment-message", children: message })
|
9846
|
-
] }),
|
9847
|
-
/* @__PURE__ */ jsx9("div", { children: /* @__PURE__ */ jsx9(
|
9960
|
+
/* @__PURE__ */ jsx9(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ jsx9(PaymentElement, { id: "payment-element" }) }),
|
9961
|
+
/* @__PURE__ */ jsx9(
|
9848
9962
|
StyledButton,
|
9849
9963
|
{
|
9850
9964
|
id: "submit",
|
9851
9965
|
disabled: isLoading || !stripe || !elements || !data.stripeEmbed?.publishableKey || !data.stripeEmbed?.setupIntentClientSecret || isConfirmed,
|
9852
9966
|
$size: "md",
|
9853
9967
|
$color: "primary",
|
9854
|
-
children: /* @__PURE__ */ jsx9(Text, { id: "button-text", children:
|
9968
|
+
children: /* @__PURE__ */ jsx9(Text, { id: "button-text", children: isLoading ? "Loading" : "Save payment method" })
|
9855
9969
|
}
|
9856
|
-
)
|
9970
|
+
),
|
9971
|
+
message && /* @__PURE__ */ jsx9(Box, { $margin: "1rem 0", children: /* @__PURE__ */ jsx9(Text, { id: "payment-message", $size: 15, $weight: 500, $color: "#DB6669", children: message }) })
|
9857
9972
|
]
|
9858
9973
|
}
|
9859
9974
|
);
|
@@ -9862,23 +9977,24 @@ var PaymentForm = ({ plan, period, onConfirm }) => {
|
|
9862
9977
|
// src/components/elements/plan-manager/CheckoutDialog.tsx
|
9863
9978
|
import { Fragment, jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
9864
9979
|
var CheckoutDialog = () => {
|
9865
|
-
const [checkoutStage, setCheckoutStage] =
|
9980
|
+
const [checkoutStage, setCheckoutStage] = useState3(
|
9866
9981
|
"plan"
|
9867
9982
|
);
|
9868
|
-
const [planPeriod, setPlanPeriod] =
|
9869
|
-
const [selectedPlan, setSelectedPlan] =
|
9870
|
-
const [paymentMethodId, setPaymentMethodId] =
|
9871
|
-
const [isLoading, setIsLoading] =
|
9872
|
-
const [isCheckoutComplete, setIsCheckoutComplete] =
|
9983
|
+
const [planPeriod, setPlanPeriod] = useState3("month");
|
9984
|
+
const [selectedPlan, setSelectedPlan] = useState3();
|
9985
|
+
const [paymentMethodId, setPaymentMethodId] = useState3();
|
9986
|
+
const [isLoading, setIsLoading] = useState3(false);
|
9987
|
+
const [isCheckoutComplete, setIsCheckoutComplete] = useState3(false);
|
9988
|
+
const [error, setError] = useState3();
|
9873
9989
|
const theme = nt();
|
9874
|
-
const { api, data,
|
9875
|
-
const { currentPlan, availablePlans } =
|
9990
|
+
const { api, data, hydrate, setLayout } = useEmbed();
|
9991
|
+
const { currentPlan, availablePlans } = useMemo5(() => {
|
9876
9992
|
return {
|
9877
9993
|
currentPlan: data.company?.plan,
|
9878
9994
|
availablePlans: data.activePlans
|
9879
9995
|
};
|
9880
9996
|
}, [data.company, data.activePlans]);
|
9881
|
-
const savingsPercentage =
|
9997
|
+
const savingsPercentage = useMemo5(() => {
|
9882
9998
|
if (selectedPlan) {
|
9883
9999
|
const monthly = (selectedPlan?.monthlyPrice?.price || 0) * 12;
|
9884
10000
|
const yearly = selectedPlan?.yearlyPrice?.price || 0;
|
@@ -9886,29 +10002,39 @@ var CheckoutDialog = () => {
|
|
9886
10002
|
}
|
9887
10003
|
return 0;
|
9888
10004
|
}, [selectedPlan]);
|
9889
|
-
|
9890
|
-
|
10005
|
+
const isLightBackground = useMemo5(() => {
|
10006
|
+
return hexToHSL(theme.card.background).l > 50;
|
10007
|
+
}, [theme.card.background]);
|
10008
|
+
useEffect4(() => {
|
10009
|
+
if (isCheckoutComplete && api && data.component?.id) {
|
10010
|
+
hydrate();
|
10011
|
+
}
|
10012
|
+
}, [isCheckoutComplete, api, data.component?.id, hydrate]);
|
10013
|
+
return /* @__PURE__ */ jsxs5(Modal, { size: isCheckoutComplete ? "auto" : "lg", children: [
|
10014
|
+
/* @__PURE__ */ jsx10(ModalHeader, { bordered: !isCheckoutComplete, children: /* @__PURE__ */ jsx10(Flex, { $gap: "1rem", children: !isCheckoutComplete && /* @__PURE__ */ jsxs5(Fragment, { children: [
|
9891
10015
|
/* @__PURE__ */ jsxs5(Flex, { $gap: "0.5rem", $alignItems: "center", children: [
|
9892
10016
|
checkoutStage === "plan" ? /* @__PURE__ */ jsx10(
|
9893
10017
|
Box,
|
9894
10018
|
{
|
9895
|
-
$width:
|
9896
|
-
$height:
|
10019
|
+
$width: `${20 / TEXT_BASE_SIZE}rem`,
|
10020
|
+
$height: `${20 / TEXT_BASE_SIZE}rem`,
|
9897
10021
|
$borderWidth: "2px",
|
9898
10022
|
$borderStyle: "solid",
|
9899
|
-
$borderColor:
|
10023
|
+
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.125)" : "hsla(0, 0%, 100%, 0.25)",
|
9900
10024
|
$borderRadius: "9999px"
|
9901
10025
|
}
|
9902
10026
|
) : /* @__PURE__ */ jsx10(
|
9903
10027
|
IconRound,
|
9904
10028
|
{
|
9905
10029
|
name: "check",
|
10030
|
+
colors: [
|
10031
|
+
theme.card.background,
|
10032
|
+
isLightBackground ? "hsla(0, 0%, 0%, 0.125)" : "hsla(0, 0%, 100%, 0.25)"
|
10033
|
+
],
|
9906
10034
|
style: {
|
9907
|
-
|
9908
|
-
|
9909
|
-
|
9910
|
-
width: "1rem",
|
9911
|
-
height: "1rem"
|
10035
|
+
fontSize: `${16 / TEXT_BASE_SIZE}rem`,
|
10036
|
+
width: `${20 / TEXT_BASE_SIZE}rem`,
|
10037
|
+
height: `${20 / TEXT_BASE_SIZE}rem`
|
9912
10038
|
}
|
9913
10039
|
}
|
9914
10040
|
),
|
@@ -9916,39 +10042,43 @@ var CheckoutDialog = () => {
|
|
9916
10042
|
Box,
|
9917
10043
|
{
|
9918
10044
|
tabIndex: 0,
|
9919
|
-
...checkoutStage
|
9920
|
-
|
9921
|
-
|
9922
|
-
|
9923
|
-
} : {
|
9924
|
-
style: {
|
9925
|
-
cursor: "pointer"
|
9926
|
-
},
|
9927
|
-
onClick: () => setCheckoutStage("plan")
|
10045
|
+
...checkoutStage !== "plan" && {
|
10046
|
+
onClick: () => setCheckoutStage("plan"),
|
10047
|
+
$opacity: "0.6375",
|
10048
|
+
$cursor: "pointer"
|
9928
10049
|
},
|
9929
|
-
children: /* @__PURE__ */ jsx10(
|
9930
|
-
|
9931
|
-
|
9932
|
-
|
9933
|
-
|
9934
|
-
|
9935
|
-
|
9936
|
-
|
9937
|
-
|
9938
|
-
|
9939
|
-
}
|
10050
|
+
children: /* @__PURE__ */ jsx10(
|
10051
|
+
Text,
|
10052
|
+
{
|
10053
|
+
$font: theme.typography.text.fontFamily,
|
10054
|
+
$size: 19,
|
10055
|
+
$weight: checkoutStage === "plan" ? 600 : 400,
|
10056
|
+
$color: theme.typography.text.color,
|
10057
|
+
children: "1. Select plan"
|
10058
|
+
}
|
10059
|
+
)
|
9940
10060
|
}
|
9941
10061
|
)
|
9942
10062
|
] }),
|
10063
|
+
/* @__PURE__ */ jsx10(
|
10064
|
+
Icon2,
|
10065
|
+
{
|
10066
|
+
name: "chevron-right",
|
10067
|
+
style: {
|
10068
|
+
fontSize: 16,
|
10069
|
+
color: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.35)"
|
10070
|
+
}
|
10071
|
+
}
|
10072
|
+
),
|
9943
10073
|
/* @__PURE__ */ jsxs5(Flex, { $gap: "0.5rem", $alignItems: "center", children: [
|
9944
10074
|
/* @__PURE__ */ jsx10(
|
9945
10075
|
Box,
|
9946
10076
|
{
|
9947
|
-
$width:
|
9948
|
-
$height:
|
10077
|
+
$width: `${20 / TEXT_BASE_SIZE}rem`,
|
10078
|
+
$height: `${20 / TEXT_BASE_SIZE}rem`,
|
9949
10079
|
$borderWidth: "2px",
|
9950
10080
|
$borderStyle: "solid",
|
9951
|
-
$borderColor:
|
10081
|
+
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.125)" : "hsla(0, 0%, 100%, 0.25)",
|
9952
10082
|
$borderRadius: "9999px"
|
9953
10083
|
}
|
9954
10084
|
),
|
@@ -9956,41 +10086,70 @@ var CheckoutDialog = () => {
|
|
9956
10086
|
Box,
|
9957
10087
|
{
|
9958
10088
|
tabIndex: 0,
|
9959
|
-
...checkoutStage
|
9960
|
-
|
9961
|
-
fontWeight: "700"
|
9962
|
-
}
|
10089
|
+
...checkoutStage !== "checkout" && {
|
10090
|
+
$opacity: "0.6375"
|
9963
10091
|
},
|
9964
|
-
children: /* @__PURE__ */ jsx10(
|
10092
|
+
children: /* @__PURE__ */ jsx10(
|
10093
|
+
Text,
|
10094
|
+
{
|
10095
|
+
$font: theme.typography.text.fontFamily,
|
10096
|
+
$size: 19,
|
10097
|
+
$weight: checkoutStage === "plan" ? 600 : 400,
|
10098
|
+
$color: theme.typography.text.color,
|
10099
|
+
children: "2. Checkout"
|
10100
|
+
}
|
10101
|
+
)
|
9965
10102
|
}
|
9966
10103
|
)
|
9967
10104
|
] })
|
9968
10105
|
] }) }) }),
|
9969
|
-
isCheckoutComplete && /* @__PURE__ */
|
9970
|
-
|
10106
|
+
isCheckoutComplete && /* @__PURE__ */ jsxs5(
|
10107
|
+
Flex,
|
9971
10108
|
{
|
9972
|
-
|
9973
|
-
$
|
9974
|
-
$
|
9975
|
-
$
|
9976
|
-
$
|
9977
|
-
|
10109
|
+
$flexDirection: "column",
|
10110
|
+
$justifyContent: "center",
|
10111
|
+
$alignItems: "center",
|
10112
|
+
$flexGrow: "1",
|
10113
|
+
$gap: `${32 / TEXT_BASE_SIZE}rem`,
|
10114
|
+
$padding: `${32 / TEXT_BASE_SIZE}rem ${40 / TEXT_BASE_SIZE}rem`,
|
10115
|
+
$whiteSpace: "nowrap",
|
10116
|
+
children: [
|
10117
|
+
/* @__PURE__ */ jsx10(
|
10118
|
+
IconRound,
|
10119
|
+
{
|
10120
|
+
name: "check",
|
10121
|
+
size: "3xl",
|
10122
|
+
colors: [
|
10123
|
+
theme.card.background,
|
10124
|
+
isLightBackground ? "hsla(0, 0%, 0%, 0.125)" : "hsla(0, 0%, 100%, 0.125)"
|
10125
|
+
]
|
10126
|
+
}
|
10127
|
+
),
|
10128
|
+
/* @__PURE__ */ jsx10(
|
10129
|
+
Text,
|
10130
|
+
{
|
10131
|
+
as: "h1",
|
10132
|
+
$font: theme.typography.heading1.fontFamily,
|
10133
|
+
$size: theme.typography.heading1.fontSize,
|
10134
|
+
$weight: theme.typography.heading1.fontWeight,
|
10135
|
+
$color: theme.typography.heading1.color,
|
10136
|
+
children: "Subscription updated!"
|
10137
|
+
}
|
10138
|
+
),
|
10139
|
+
/* @__PURE__ */ jsx10(StyledButton, { onClick: () => setLayout("portal"), children: "Close" })
|
10140
|
+
]
|
9978
10141
|
}
|
9979
|
-
)
|
9980
|
-
!isCheckoutComplete && /* @__PURE__ */ jsxs5(Flex, { $position: "relative", $
|
10142
|
+
),
|
10143
|
+
!isCheckoutComplete && /* @__PURE__ */ jsxs5(Flex, { $position: "relative", $height: "calc(100% - 5rem)", children: [
|
9981
10144
|
/* @__PURE__ */ jsxs5(
|
9982
10145
|
Flex,
|
9983
10146
|
{
|
9984
|
-
$position: "absolute",
|
9985
|
-
$top: "0",
|
9986
|
-
$left: "0",
|
9987
10147
|
$flexDirection: "column",
|
10148
|
+
$flexGrow: "1",
|
9988
10149
|
$gap: "1rem",
|
9989
10150
|
$padding: "2rem 2.5rem 2rem 2.5rem",
|
9990
|
-
$backgroundColor:
|
10151
|
+
$backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.025)" : "hsla(0, 0%, 100%, 0.025)",
|
9991
10152
|
$flex: "1",
|
9992
|
-
$width: "72.5%",
|
9993
|
-
$height: "100%",
|
9994
10153
|
$overflow: "auto",
|
9995
10154
|
children: [
|
9996
10155
|
checkoutStage === "plan" && /* @__PURE__ */ jsxs5(Fragment, { children: [
|
@@ -9998,9 +10157,12 @@ var CheckoutDialog = () => {
|
|
9998
10157
|
/* @__PURE__ */ jsx10(
|
9999
10158
|
Text,
|
10000
10159
|
{
|
10001
|
-
as: "
|
10160
|
+
as: "h3",
|
10002
10161
|
id: "select-plan-dialog-label",
|
10003
|
-
$
|
10162
|
+
$font: theme.typography.heading3.fontFamily,
|
10163
|
+
$size: theme.typography.heading3.fontSize,
|
10164
|
+
$weight: theme.typography.heading3.fontWeight,
|
10165
|
+
$color: theme.typography.heading3.color,
|
10004
10166
|
$marginBottom: "0.5rem",
|
10005
10167
|
children: "Select plan"
|
10006
10168
|
}
|
@@ -10010,25 +10172,28 @@ var CheckoutDialog = () => {
|
|
10010
10172
|
{
|
10011
10173
|
as: "p",
|
10012
10174
|
id: "select-plan-dialog-description",
|
10013
|
-
$
|
10014
|
-
$
|
10175
|
+
$font: theme.typography.text.fontFamily,
|
10176
|
+
$size: theme.typography.text.fontSize,
|
10177
|
+
$weight: theme.typography.text.fontWeight,
|
10178
|
+
$color: theme.typography.text.color,
|
10015
10179
|
children: "Choose your base plan"
|
10016
10180
|
}
|
10017
10181
|
)
|
10018
10182
|
] }),
|
10019
|
-
/* @__PURE__ */ jsx10(Flex, { $gap: "1rem", $flexGrow: "1", children: availablePlans?.map((plan) => {
|
10183
|
+
/* @__PURE__ */ jsx10(Flex, { $flexWrap: "wrap", $gap: "1rem", $flexGrow: "1", children: availablePlans?.map((plan) => {
|
10020
10184
|
return /* @__PURE__ */ jsxs5(
|
10021
10185
|
Flex,
|
10022
10186
|
{
|
10023
|
-
$height: "100%",
|
10024
10187
|
$flexDirection: "column",
|
10025
|
-
$
|
10026
|
-
$
|
10188
|
+
$width: "100%",
|
10189
|
+
$minWidth: "280px",
|
10190
|
+
$maxWidth: `calc(${100 / 3}% - 1rem)`,
|
10191
|
+
$backgroundColor: theme.card.background,
|
10027
10192
|
$outlineWidth: "2px",
|
10028
10193
|
$outlineStyle: "solid",
|
10029
10194
|
$outlineColor: plan.id === selectedPlan?.id ? theme.primary : "transparent",
|
10030
|
-
$borderRadius: `${
|
10031
|
-
...
|
10195
|
+
$borderRadius: `${theme.card.borderRadius / TEXT_BASE_SIZE}rem`,
|
10196
|
+
...theme.card.hasShadow && {
|
10032
10197
|
$boxShadow: "0px 1px 3px rgba(16, 24, 40, 0.1), 0px 1px 20px rgba(16, 24, 40, 0.06)"
|
10033
10198
|
},
|
10034
10199
|
children: [
|
@@ -10040,10 +10205,10 @@ var CheckoutDialog = () => {
|
|
10040
10205
|
$gap: "1rem",
|
10041
10206
|
$width: "100%",
|
10042
10207
|
$height: "auto",
|
10043
|
-
$padding: `${
|
10208
|
+
$padding: `${theme.card.padding / TEXT_BASE_SIZE}rem`,
|
10044
10209
|
$borderBottomWidth: "1px",
|
10045
10210
|
$borderStyle: "solid",
|
10046
|
-
$borderColor:
|
10211
|
+
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
10047
10212
|
children: [
|
10048
10213
|
/* @__PURE__ */ jsx10(Text, { $size: 20, $weight: 600, children: plan.name }),
|
10049
10214
|
/* @__PURE__ */ jsx10(Text, { $size: 14, children: plan.description }),
|
@@ -10096,8 +10261,8 @@ var CheckoutDialog = () => {
|
|
10096
10261
|
name: feature.icon,
|
10097
10262
|
size: "tn",
|
10098
10263
|
colors: [
|
10099
|
-
|
10100
|
-
|
10264
|
+
theme.primary,
|
10265
|
+
isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.0625)"
|
10101
10266
|
]
|
10102
10267
|
}
|
10103
10268
|
),
|
@@ -10142,10 +10307,8 @@ var CheckoutDialog = () => {
|
|
10142
10307
|
/* @__PURE__ */ jsx10(
|
10143
10308
|
Text,
|
10144
10309
|
{
|
10145
|
-
|
10146
|
-
|
10147
|
-
lineHeight: "1.4"
|
10148
|
-
},
|
10310
|
+
$lineHeight: "1.4",
|
10311
|
+
$color: theme.typography.text.color,
|
10149
10312
|
children: "Selected"
|
10150
10313
|
}
|
10151
10314
|
)
|
@@ -10156,12 +10319,12 @@ var CheckoutDialog = () => {
|
|
10156
10319
|
StyledButton,
|
10157
10320
|
{
|
10158
10321
|
disabled: plan.valid === false,
|
10322
|
+
...plan.valid === true && {
|
10323
|
+
onClick: () => setSelectedPlan(plan)
|
10324
|
+
},
|
10159
10325
|
$size: "sm",
|
10160
10326
|
$color: "primary",
|
10161
10327
|
$variant: "outline",
|
10162
|
-
onClick: () => {
|
10163
|
-
setSelectedPlan(plan);
|
10164
|
-
},
|
10165
10328
|
children: "Select"
|
10166
10329
|
}
|
10167
10330
|
)
|
@@ -10190,14 +10353,10 @@ var CheckoutDialog = () => {
|
|
10190
10353
|
/* @__PURE__ */ jsxs5(
|
10191
10354
|
Flex,
|
10192
10355
|
{
|
10193
|
-
$position: "absolute",
|
10194
|
-
$top: "0",
|
10195
|
-
$right: "0",
|
10196
10356
|
$flexDirection: "column",
|
10197
|
-
$
|
10357
|
+
$backgroundColor: theme.card.background,
|
10198
10358
|
$borderRadius: "0 0 0.5rem",
|
10199
|
-
$width: "
|
10200
|
-
$height: "100%",
|
10359
|
+
$width: "21.5rem",
|
10201
10360
|
$boxShadow: "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A;",
|
10202
10361
|
children: [
|
10203
10362
|
/* @__PURE__ */ jsxs5(
|
@@ -10209,13 +10368,27 @@ var CheckoutDialog = () => {
|
|
10209
10368
|
$width: "100%",
|
10210
10369
|
$height: "auto",
|
10211
10370
|
$padding: "1.5rem",
|
10212
|
-
$
|
10371
|
+
$borderBottomWidth: "1px",
|
10372
|
+
$borderStyle: "solid",
|
10373
|
+
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.1)" : "hsla(0, 0%, 100%, 0.2)",
|
10213
10374
|
children: [
|
10214
|
-
/* @__PURE__ */ jsx10(Flex, { $justifyContent: "space-between", children: /* @__PURE__ */ jsx10(
|
10375
|
+
/* @__PURE__ */ jsx10(Flex, { $justifyContent: "space-between", children: /* @__PURE__ */ jsx10(
|
10376
|
+
Text,
|
10377
|
+
{
|
10378
|
+
as: "h3",
|
10379
|
+
$font: theme.typography.heading3.fontFamily,
|
10380
|
+
$size: theme.typography.heading3.fontSize,
|
10381
|
+
$weight: theme.typography.heading3.fontWeight,
|
10382
|
+
$color: theme.typography.heading3.color,
|
10383
|
+
children: "Subscription"
|
10384
|
+
}
|
10385
|
+
) }),
|
10215
10386
|
/* @__PURE__ */ jsxs5(
|
10216
10387
|
Flex,
|
10217
10388
|
{
|
10218
|
-
$
|
10389
|
+
$borderWidth: "1px",
|
10390
|
+
$borderStyle: "solid",
|
10391
|
+
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.1)" : "hsla(0, 0%, 100%, 0.2)",
|
10219
10392
|
$borderRadius: "2.5rem",
|
10220
10393
|
$cursor: "pointer",
|
10221
10394
|
children: [
|
@@ -10227,9 +10400,20 @@ var CheckoutDialog = () => {
|
|
10227
10400
|
$alignItems: "center",
|
10228
10401
|
$padding: "0.25rem 0.5rem",
|
10229
10402
|
$flex: "1",
|
10230
|
-
|
10403
|
+
...planPeriod === "month" && {
|
10404
|
+
$backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.075)" : "hsla(0, 0%, 100%, 0.15)"
|
10405
|
+
},
|
10231
10406
|
$borderRadius: "2.5rem",
|
10232
|
-
children: /* @__PURE__ */ jsx10(
|
10407
|
+
children: /* @__PURE__ */ jsx10(
|
10408
|
+
Text,
|
10409
|
+
{
|
10410
|
+
$font: theme.typography.text.fontFamily,
|
10411
|
+
$size: 14,
|
10412
|
+
$weight: planPeriod === "month" ? 600 : 400,
|
10413
|
+
$color: theme.typography.text.color,
|
10414
|
+
children: "Billed monthly"
|
10415
|
+
}
|
10416
|
+
)
|
10233
10417
|
}
|
10234
10418
|
),
|
10235
10419
|
/* @__PURE__ */ jsx10(
|
@@ -10240,15 +10424,35 @@ var CheckoutDialog = () => {
|
|
10240
10424
|
$alignItems: "center",
|
10241
10425
|
$padding: "0.25rem 0.5rem",
|
10242
10426
|
$flex: "1",
|
10243
|
-
|
10427
|
+
...planPeriod === "year" && {
|
10428
|
+
$backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.075)" : "hsla(0, 0%, 100%, 0.15)"
|
10429
|
+
},
|
10244
10430
|
$borderRadius: "2.5rem",
|
10245
|
-
children: /* @__PURE__ */ jsx10(
|
10431
|
+
children: /* @__PURE__ */ jsx10(
|
10432
|
+
Text,
|
10433
|
+
{
|
10434
|
+
$font: theme.typography.text.fontFamily,
|
10435
|
+
$size: 14,
|
10436
|
+
$weight: planPeriod === "year" ? 600 : 400,
|
10437
|
+
$color: theme.typography.text.color,
|
10438
|
+
children: "Billed yearly"
|
10439
|
+
}
|
10440
|
+
)
|
10246
10441
|
}
|
10247
10442
|
)
|
10248
10443
|
]
|
10249
10444
|
}
|
10250
10445
|
),
|
10251
|
-
savingsPercentage > 0 && /* @__PURE__ */ jsx10(Box, { children: /* @__PURE__ */ jsx10(
|
10446
|
+
savingsPercentage > 0 && /* @__PURE__ */ jsx10(Box, { children: /* @__PURE__ */ jsx10(
|
10447
|
+
Text,
|
10448
|
+
{
|
10449
|
+
$font: theme.typography.text.fontFamily,
|
10450
|
+
$size: 11,
|
10451
|
+
$weight: theme.typography.text.fontWeight,
|
10452
|
+
$color: theme.primary,
|
10453
|
+
children: planPeriod === "month" ? `Save up to ${savingsPercentage}% with yearly billing` : `You are saving ${savingsPercentage}% with yearly billing`
|
10454
|
+
}
|
10455
|
+
) })
|
10252
10456
|
]
|
10253
10457
|
}
|
10254
10458
|
),
|
@@ -10262,85 +10466,106 @@ var CheckoutDialog = () => {
|
|
10262
10466
|
$height: "auto",
|
10263
10467
|
$padding: "1.5rem",
|
10264
10468
|
$flex: "1",
|
10265
|
-
$
|
10469
|
+
$borderBottomWidth: "1px",
|
10470
|
+
$borderStyle: "solid",
|
10471
|
+
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.1)" : "hsla(0, 0%, 100%, 0.2)",
|
10266
10472
|
children: [
|
10267
|
-
/* @__PURE__ */ jsx10(Box, { children: /* @__PURE__ */ jsx10(
|
10268
|
-
|
10269
|
-
Flex,
|
10473
|
+
/* @__PURE__ */ jsx10(Box, { $opacity: "0.625", children: /* @__PURE__ */ jsx10(
|
10474
|
+
Text,
|
10270
10475
|
{
|
10271
|
-
$
|
10272
|
-
$
|
10273
|
-
$
|
10274
|
-
$
|
10275
|
-
children:
|
10276
|
-
|
10277
|
-
|
10278
|
-
|
10279
|
-
|
10280
|
-
|
10281
|
-
|
10282
|
-
|
10283
|
-
|
10284
|
-
|
10285
|
-
|
10286
|
-
|
10287
|
-
|
10288
|
-
|
10289
|
-
] })
|
10290
|
-
]
|
10291
|
-
}
|
10292
|
-
),
|
10293
|
-
selectedPlan && /* @__PURE__ */ jsxs5(Fragment, { children: [
|
10294
|
-
/* @__PURE__ */ jsx10(
|
10295
|
-
Box,
|
10476
|
+
$font: theme.typography.text.fontFamily,
|
10477
|
+
$size: 14,
|
10478
|
+
$weight: theme.typography.text.fontWeight,
|
10479
|
+
$color: theme.typography.text.color,
|
10480
|
+
children: "Plan"
|
10481
|
+
}
|
10482
|
+
) }),
|
10483
|
+
/* @__PURE__ */ jsxs5(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
10484
|
+
currentPlan && /* @__PURE__ */ jsxs5(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
|
10485
|
+
/* @__PURE__ */ jsx10(
|
10486
|
+
Flex,
|
10487
|
+
{
|
10488
|
+
...selectedPlan && {
|
10489
|
+
$opacity: "0.625",
|
10490
|
+
$textDecoration: "line-through"
|
10491
|
+
},
|
10492
|
+
children: /* @__PURE__ */ jsx10(
|
10493
|
+
Text,
|
10296
10494
|
{
|
10297
|
-
$
|
10298
|
-
$
|
10299
|
-
$
|
10300
|
-
$
|
10301
|
-
|
10302
|
-
children: /* @__PURE__ */ jsx10(
|
10303
|
-
Icon2,
|
10304
|
-
{
|
10305
|
-
name: "arrow-down",
|
10306
|
-
style: {
|
10307
|
-
display: "inline-block"
|
10308
|
-
}
|
10309
|
-
}
|
10310
|
-
)
|
10495
|
+
$font: theme.typography.heading4.fontFamily,
|
10496
|
+
$size: theme.typography.heading4.fontSize,
|
10497
|
+
$weight: theme.typography.heading4.fontWeight,
|
10498
|
+
$color: theme.typography.heading4.color,
|
10499
|
+
children: currentPlan.name
|
10311
10500
|
}
|
10312
|
-
)
|
10313
|
-
|
10314
|
-
|
10501
|
+
)
|
10502
|
+
}
|
10503
|
+
),
|
10504
|
+
typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ jsx10(Flex, { children: /* @__PURE__ */ jsxs5(
|
10505
|
+
Text,
|
10506
|
+
{
|
10507
|
+
$font: theme.typography.text.fontFamily,
|
10508
|
+
$size: theme.typography.text.fontSize,
|
10509
|
+
$weight: theme.typography.text.fontWeight,
|
10510
|
+
$color: theme.typography.text.color,
|
10511
|
+
children: [
|
10512
|
+
formatCurrency(currentPlan.planPrice),
|
10513
|
+
"/",
|
10514
|
+
currentPlan.planPeriod
|
10515
|
+
]
|
10516
|
+
}
|
10517
|
+
) })
|
10518
|
+
] }),
|
10519
|
+
selectedPlan && /* @__PURE__ */ jsxs5(Fragment, { children: [
|
10520
|
+
/* @__PURE__ */ jsx10(
|
10521
|
+
Box,
|
10522
|
+
{
|
10523
|
+
$width: "100%",
|
10524
|
+
$textAlign: "left",
|
10525
|
+
$opacity: "50%",
|
10526
|
+
$marginBottom: "-0.25rem",
|
10527
|
+
$marginTop: "-0.25rem",
|
10528
|
+
children: /* @__PURE__ */ jsx10(
|
10529
|
+
Icon2,
|
10315
10530
|
{
|
10316
|
-
|
10317
|
-
|
10318
|
-
|
10319
|
-
|
10320
|
-
children: [
|
10321
|
-
/* @__PURE__ */ jsx10(
|
10322
|
-
Flex,
|
10323
|
-
{
|
10324
|
-
$fontSize: "0.875rem",
|
10325
|
-
$color: "#000000",
|
10326
|
-
$fontWeight: "600",
|
10327
|
-
children: selectedPlan.name
|
10328
|
-
}
|
10329
|
-
),
|
10330
|
-
/* @__PURE__ */ jsxs5(Flex, { $fontSize: "0.75rem", $color: "#000000", children: [
|
10331
|
-
formatCurrency(
|
10332
|
-
(planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0
|
10333
|
-
),
|
10334
|
-
"/",
|
10335
|
-
planPeriod
|
10336
|
-
] })
|
10337
|
-
]
|
10531
|
+
name: "arrow-down",
|
10532
|
+
style: {
|
10533
|
+
display: "inline-block"
|
10534
|
+
}
|
10338
10535
|
}
|
10339
10536
|
)
|
10340
|
-
|
10341
|
-
|
10342
|
-
|
10343
|
-
|
10537
|
+
}
|
10538
|
+
),
|
10539
|
+
/* @__PURE__ */ jsxs5(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
|
10540
|
+
/* @__PURE__ */ jsx10(Flex, { children: /* @__PURE__ */ jsx10(
|
10541
|
+
Text,
|
10542
|
+
{
|
10543
|
+
$font: theme.typography.heading4.fontFamily,
|
10544
|
+
$size: theme.typography.heading4.fontSize,
|
10545
|
+
$weight: theme.typography.heading4.fontWeight,
|
10546
|
+
$color: theme.typography.heading4.color,
|
10547
|
+
children: selectedPlan.name
|
10548
|
+
}
|
10549
|
+
) }),
|
10550
|
+
/* @__PURE__ */ jsx10(Flex, { children: /* @__PURE__ */ jsxs5(
|
10551
|
+
Text,
|
10552
|
+
{
|
10553
|
+
$font: theme.typography.text.fontFamily,
|
10554
|
+
$size: theme.typography.text.fontSize,
|
10555
|
+
$weight: theme.typography.text.fontWeight,
|
10556
|
+
$color: theme.typography.text.color,
|
10557
|
+
children: [
|
10558
|
+
formatCurrency(
|
10559
|
+
(planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0
|
10560
|
+
),
|
10561
|
+
"/",
|
10562
|
+
planPeriod
|
10563
|
+
]
|
10564
|
+
}
|
10565
|
+
) })
|
10566
|
+
] })
|
10567
|
+
] })
|
10568
|
+
] })
|
10344
10569
|
]
|
10345
10570
|
}
|
10346
10571
|
),
|
@@ -10349,47 +10574,57 @@ var CheckoutDialog = () => {
|
|
10349
10574
|
{
|
10350
10575
|
$flexDirection: "column",
|
10351
10576
|
$position: "relative",
|
10352
|
-
$gap: "
|
10577
|
+
$gap: "1rem",
|
10353
10578
|
$width: "100%",
|
10354
10579
|
$height: "auto",
|
10355
10580
|
$padding: "1.5rem",
|
10356
10581
|
children: [
|
10357
|
-
selectedPlan && /* @__PURE__ */ jsxs5(
|
10358
|
-
|
10359
|
-
|
10360
|
-
|
10361
|
-
|
10362
|
-
|
10363
|
-
|
10364
|
-
|
10582
|
+
selectedPlan && /* @__PURE__ */ jsxs5(Flex, { $justifyContent: "space-between", children: [
|
10583
|
+
/* @__PURE__ */ jsx10(Box, { $opacity: "0.625", children: /* @__PURE__ */ jsxs5(
|
10584
|
+
Text,
|
10585
|
+
{
|
10586
|
+
$font: theme.typography.text.fontFamily,
|
10587
|
+
$size: theme.typography.text.fontSize,
|
10588
|
+
$weight: theme.typography.text.fontWeight,
|
10589
|
+
$color: theme.typography.text.color,
|
10590
|
+
children: [
|
10365
10591
|
planPeriod === "month" ? "Monthly" : "Yearly",
|
10366
10592
|
" total:",
|
10367
10593
|
" "
|
10368
|
-
]
|
10369
|
-
|
10594
|
+
]
|
10595
|
+
}
|
10596
|
+
) }),
|
10597
|
+
/* @__PURE__ */ jsx10(Box, { children: /* @__PURE__ */ jsxs5(
|
10598
|
+
Text,
|
10599
|
+
{
|
10600
|
+
$font: theme.typography.text.fontFamily,
|
10601
|
+
$size: theme.typography.text.fontSize,
|
10602
|
+
$weight: theme.typography.text.fontWeight,
|
10603
|
+
$color: theme.typography.text.color,
|
10604
|
+
children: [
|
10370
10605
|
formatCurrency(
|
10371
10606
|
(planPeriod === "month" ? selectedPlan.monthlyPrice : selectedPlan.yearlyPrice)?.price ?? 0
|
10372
10607
|
),
|
10373
10608
|
"/",
|
10374
10609
|
planPeriod
|
10375
|
-
]
|
10376
|
-
|
10377
|
-
}
|
10378
|
-
),
|
10610
|
+
]
|
10611
|
+
}
|
10612
|
+
) })
|
10613
|
+
] }),
|
10379
10614
|
checkoutStage === "plan" ? /* @__PURE__ */ jsx10(
|
10380
10615
|
StyledButton,
|
10381
10616
|
{
|
10382
10617
|
disabled: !selectedPlan,
|
10383
|
-
|
10384
|
-
setCheckoutStage("checkout")
|
10618
|
+
...selectedPlan && {
|
10619
|
+
onClick: () => setCheckoutStage("checkout")
|
10385
10620
|
},
|
10386
10621
|
$size: "sm",
|
10387
10622
|
children: /* @__PURE__ */ jsxs5(
|
10388
10623
|
Flex,
|
10389
10624
|
{
|
10390
10625
|
$gap: "0.5rem",
|
10391
|
-
$alignItems: "center",
|
10392
10626
|
$justifyContent: "center",
|
10627
|
+
$alignItems: "center",
|
10393
10628
|
$padding: "0 1rem",
|
10394
10629
|
children: [
|
10395
10630
|
/* @__PURE__ */ jsx10(Text, { $align: "left", children: "Next: Checkout" }),
|
@@ -10418,10 +10653,11 @@ var CheckoutDialog = () => {
|
|
10418
10653
|
}
|
10419
10654
|
});
|
10420
10655
|
setIsCheckoutComplete(true);
|
10421
|
-
} catch
|
10422
|
-
|
10656
|
+
} catch {
|
10657
|
+
setError(
|
10658
|
+
"Error processing payment. Please try a different payment method."
|
10659
|
+
);
|
10423
10660
|
} finally {
|
10424
|
-
setIsCheckoutComplete(true);
|
10425
10661
|
setIsLoading(false);
|
10426
10662
|
}
|
10427
10663
|
},
|
@@ -10429,7 +10665,26 @@ var CheckoutDialog = () => {
|
|
10429
10665
|
children: "Pay now"
|
10430
10666
|
}
|
10431
10667
|
),
|
10432
|
-
/* @__PURE__ */ jsx10(Box, { $
|
10668
|
+
/* @__PURE__ */ jsx10(Box, { $opacity: "0.625", children: /* @__PURE__ */ jsx10(
|
10669
|
+
Text,
|
10670
|
+
{
|
10671
|
+
$font: theme.typography.text.fontFamily,
|
10672
|
+
$size: theme.typography.text.fontSize,
|
10673
|
+
$weight: theme.typography.text.fontWeight,
|
10674
|
+
$color: theme.typography.text.color,
|
10675
|
+
children: "Discounts & credits applied at checkout"
|
10676
|
+
}
|
10677
|
+
) }),
|
10678
|
+
error && /* @__PURE__ */ jsx10(Box, { children: /* @__PURE__ */ jsx10(
|
10679
|
+
Text,
|
10680
|
+
{
|
10681
|
+
$font: theme.typography.text.fontFamily,
|
10682
|
+
$size: theme.typography.text.fontSize,
|
10683
|
+
$weight: 500,
|
10684
|
+
$color: "#DB6669",
|
10685
|
+
children: error
|
10686
|
+
}
|
10687
|
+
) })
|
10433
10688
|
]
|
10434
10689
|
}
|
10435
10690
|
)
|
@@ -10465,15 +10720,16 @@ var resolveDesignProps = (props) => {
|
|
10465
10720
|
},
|
10466
10721
|
callToAction: {
|
10467
10722
|
isVisible: props.callToAction?.isVisible ?? true,
|
10468
|
-
buttonSize: props.callToAction?.buttonSize ?? "
|
10723
|
+
buttonSize: props.callToAction?.buttonSize ?? "lg",
|
10469
10724
|
buttonStyle: props.callToAction?.buttonStyle ?? "primary"
|
10470
10725
|
}
|
10471
10726
|
};
|
10472
10727
|
};
|
10473
10728
|
var PlanManager = forwardRef(({ children, className, portal, ...rest }, ref) => {
|
10474
10729
|
const props = resolveDesignProps(rest);
|
10475
|
-
const
|
10476
|
-
const {
|
10730
|
+
const theme = nt();
|
10731
|
+
const { data, layout, stripe, setLayout } = useEmbed();
|
10732
|
+
const { currentPlan, canChangePlan } = useMemo6(() => {
|
10477
10733
|
return {
|
10478
10734
|
currentPlan: data.company?.plan,
|
10479
10735
|
canChangePlan: stripe !== null
|
@@ -10498,10 +10754,10 @@ var PlanManager = forwardRef(({ children, className, portal, ...rest }, ref) =>
|
|
10498
10754
|
/* @__PURE__ */ jsx11(Box, { $margin: "0 0 0.75rem", children: /* @__PURE__ */ jsx11(
|
10499
10755
|
Text,
|
10500
10756
|
{
|
10501
|
-
$font:
|
10502
|
-
$size:
|
10503
|
-
$weight:
|
10504
|
-
$color:
|
10757
|
+
$font: theme.typography[props.header.title.fontStyle].fontFamily,
|
10758
|
+
$size: theme.typography[props.header.title.fontStyle].fontSize,
|
10759
|
+
$weight: theme.typography[props.header.title.fontStyle].fontWeight,
|
10760
|
+
$color: theme.typography[props.header.title.fontStyle].color,
|
10505
10761
|
$lineHeight: 1,
|
10506
10762
|
children: currentPlan.name
|
10507
10763
|
}
|
@@ -10509,10 +10765,10 @@ var PlanManager = forwardRef(({ children, className, portal, ...rest }, ref) =>
|
|
10509
10765
|
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ jsx11(
|
10510
10766
|
Text,
|
10511
10767
|
{
|
10512
|
-
$font:
|
10513
|
-
$size:
|
10514
|
-
$weight:
|
10515
|
-
$color:
|
10768
|
+
$font: theme.typography[props.header.description.fontStyle].fontFamily,
|
10769
|
+
$size: theme.typography[props.header.description.fontStyle].fontSize,
|
10770
|
+
$weight: theme.typography[props.header.description.fontStyle].fontWeight,
|
10771
|
+
$color: theme.typography[props.header.description.fontStyle].color,
|
10516
10772
|
children: currentPlan.description
|
10517
10773
|
}
|
10518
10774
|
)
|
@@ -10520,10 +10776,10 @@ var PlanManager = forwardRef(({ children, className, portal, ...rest }, ref) =>
|
|
10520
10776
|
props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ jsxs6(
|
10521
10777
|
Text,
|
10522
10778
|
{
|
10523
|
-
$font:
|
10524
|
-
$size:
|
10525
|
-
$weight:
|
10526
|
-
$color:
|
10779
|
+
$font: theme.typography[props.header.price.fontStyle].fontFamily,
|
10780
|
+
$size: theme.typography[props.header.price.fontStyle].fontSize,
|
10781
|
+
$weight: theme.typography[props.header.price.fontStyle].fontWeight,
|
10782
|
+
$color: theme.typography[props.header.price.fontStyle].color,
|
10527
10783
|
children: [
|
10528
10784
|
formatCurrency(currentPlan.planPrice),
|
10529
10785
|
"/",
|
@@ -10544,15 +10800,7 @@ var PlanManager = forwardRef(({ children, className, portal, ...rest }, ref) =>
|
|
10544
10800
|
},
|
10545
10801
|
$size: props.callToAction.buttonSize,
|
10546
10802
|
$color: props.callToAction.buttonStyle,
|
10547
|
-
children:
|
10548
|
-
Text,
|
10549
|
-
{
|
10550
|
-
$font: settings.theme.typography.text.fontFamily,
|
10551
|
-
$size: settings.theme.typography.text.fontSize,
|
10552
|
-
$weight: settings.theme.typography.text.fontWeight,
|
10553
|
-
children: "Change Plan"
|
10554
|
-
}
|
10555
|
-
)
|
10803
|
+
children: "Change Plan"
|
10556
10804
|
}
|
10557
10805
|
),
|
10558
10806
|
canChangePlan && layout === "checkout" && createPortal(/* @__PURE__ */ jsx11(CheckoutDialog, {}), portal || document.body)
|
@@ -10560,7 +10808,7 @@ var PlanManager = forwardRef(({ children, className, portal, ...rest }, ref) =>
|
|
10560
10808
|
});
|
10561
10809
|
|
10562
10810
|
// src/components/elements/included-features/IncludedFeatures.tsx
|
10563
|
-
import { forwardRef as forwardRef2, useMemo as
|
10811
|
+
import { forwardRef as forwardRef2, useMemo as useMemo7 } from "react";
|
10564
10812
|
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
10565
10813
|
function resolveDesignProps2(props) {
|
10566
10814
|
return {
|
@@ -10571,12 +10819,12 @@ function resolveDesignProps2(props) {
|
|
10571
10819
|
},
|
10572
10820
|
icons: {
|
10573
10821
|
isVisible: props.icons?.isVisible ?? true,
|
10574
|
-
fontStyle: props.icons?.fontStyle ?? "
|
10822
|
+
fontStyle: props.icons?.fontStyle ?? "heading5",
|
10575
10823
|
style: props.icons?.style ?? "light"
|
10576
10824
|
},
|
10577
10825
|
entitlement: {
|
10578
10826
|
isVisible: props.entitlement?.isVisible ?? true,
|
10579
|
-
fontStyle: props.entitlement?.fontStyle ?? "
|
10827
|
+
fontStyle: props.entitlement?.fontStyle ?? "text"
|
10580
10828
|
},
|
10581
10829
|
usage: {
|
10582
10830
|
isVisible: props.usage?.isVisible ?? true,
|
@@ -10586,8 +10834,9 @@ function resolveDesignProps2(props) {
|
|
10586
10834
|
}
|
10587
10835
|
var IncludedFeatures = forwardRef2(({ className, ...rest }, ref) => {
|
10588
10836
|
const props = resolveDesignProps2(rest);
|
10589
|
-
const
|
10590
|
-
const
|
10837
|
+
const theme = nt();
|
10838
|
+
const { data } = useEmbed();
|
10839
|
+
const features = useMemo7(() => {
|
10591
10840
|
return (data.featureUsage?.features || []).map(
|
10592
10841
|
({
|
10593
10842
|
access,
|
@@ -10614,14 +10863,17 @@ var IncludedFeatures = forwardRef2(({ className, ...rest }, ref) => {
|
|
10614
10863
|
}
|
10615
10864
|
);
|
10616
10865
|
}, [data.featureUsage]);
|
10866
|
+
const isLightBackground = useMemo7(() => {
|
10867
|
+
return hexToHSL(theme.card.background).l > 50;
|
10868
|
+
}, [theme.card.background]);
|
10617
10869
|
return /* @__PURE__ */ jsxs7(Flex, { ref, className, $flexDirection: "column", $gap: "1.5rem", children: [
|
10618
10870
|
props.header.isVisible && /* @__PURE__ */ jsx12(Box, { children: /* @__PURE__ */ jsx12(
|
10619
10871
|
Text,
|
10620
10872
|
{
|
10621
|
-
$font:
|
10622
|
-
$size:
|
10623
|
-
$weight:
|
10624
|
-
$color:
|
10873
|
+
$font: theme.typography[props.header.fontStyle].fontFamily,
|
10874
|
+
$size: theme.typography[props.header.fontStyle].fontSize,
|
10875
|
+
$weight: theme.typography[props.header.fontStyle].fontWeight,
|
10876
|
+
$color: theme.typography[props.header.fontStyle].color,
|
10625
10877
|
children: props.header.text
|
10626
10878
|
}
|
10627
10879
|
) }),
|
@@ -10647,18 +10899,18 @@ var IncludedFeatures = forwardRef2(({ className, ...rest }, ref) => {
|
|
10647
10899
|
name: feature.icon,
|
10648
10900
|
size: "sm",
|
10649
10901
|
colors: [
|
10650
|
-
|
10651
|
-
|
10902
|
+
theme.primary,
|
10903
|
+
isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)"
|
10652
10904
|
]
|
10653
10905
|
}
|
10654
10906
|
),
|
10655
10907
|
feature?.name && /* @__PURE__ */ jsx12(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx12(
|
10656
10908
|
Text,
|
10657
10909
|
{
|
10658
|
-
$font:
|
10659
|
-
$size:
|
10660
|
-
$weight:
|
10661
|
-
$color:
|
10910
|
+
$font: theme.typography[props.icons.fontStyle].fontFamily,
|
10911
|
+
$size: theme.typography[props.icons.fontStyle].fontSize,
|
10912
|
+
$weight: theme.typography[props.icons.fontStyle].fontWeight,
|
10913
|
+
$color: theme.typography[props.icons.fontStyle].color,
|
10662
10914
|
children: feature.name
|
10663
10915
|
}
|
10664
10916
|
) })
|
@@ -10668,10 +10920,11 @@ var IncludedFeatures = forwardRef2(({ className, ...rest }, ref) => {
|
|
10668
10920
|
Text,
|
10669
10921
|
{
|
10670
10922
|
as: Box,
|
10671
|
-
$font:
|
10672
|
-
$size:
|
10673
|
-
$weight:
|
10674
|
-
$
|
10923
|
+
$font: theme.typography[props.entitlement.fontStyle].fontFamily,
|
10924
|
+
$size: theme.typography[props.entitlement.fontStyle].fontSize,
|
10925
|
+
$weight: theme.typography[props.entitlement.fontStyle].fontWeight,
|
10926
|
+
$lineHeight: 1.5,
|
10927
|
+
$color: theme.typography[props.entitlement.fontStyle].color,
|
10675
10928
|
children: typeof allocation === "number" ? `${allocation} ${feature.name}` : `Unlimited ${feature.name}`
|
10676
10929
|
}
|
10677
10930
|
),
|
@@ -10679,10 +10932,11 @@ var IncludedFeatures = forwardRef2(({ className, ...rest }, ref) => {
|
|
10679
10932
|
Text,
|
10680
10933
|
{
|
10681
10934
|
as: Box,
|
10682
|
-
$font:
|
10683
|
-
$size:
|
10684
|
-
$weight:
|
10685
|
-
$
|
10935
|
+
$font: theme.typography[props.usage.fontStyle].fontFamily,
|
10936
|
+
$size: theme.typography[props.usage.fontStyle].fontSize,
|
10937
|
+
$weight: theme.typography[props.usage.fontStyle].fontWeight,
|
10938
|
+
$lineHeight: 1.5,
|
10939
|
+
$color: theme.typography[props.usage.fontStyle].color,
|
10686
10940
|
children: typeof allocation === "number" ? `${usage} of ${allocation} used` : `${usage} used`
|
10687
10941
|
}
|
10688
10942
|
)
|
@@ -10699,7 +10953,7 @@ var IncludedFeatures = forwardRef2(({ className, ...rest }, ref) => {
|
|
10699
10953
|
});
|
10700
10954
|
|
10701
10955
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
10702
|
-
import { forwardRef as forwardRef3, useMemo as
|
10956
|
+
import { forwardRef as forwardRef3, useMemo as useMemo8 } from "react";
|
10703
10957
|
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
10704
10958
|
function resolveDesignProps3(props) {
|
10705
10959
|
return {
|
@@ -10731,8 +10985,9 @@ function resolveDesignProps3(props) {
|
|
10731
10985
|
}
|
10732
10986
|
var MeteredFeatures = forwardRef3(({ className, ...rest }, ref) => {
|
10733
10987
|
const props = resolveDesignProps3(rest);
|
10734
|
-
const
|
10735
|
-
const
|
10988
|
+
const theme = nt();
|
10989
|
+
const { data } = useEmbed();
|
10990
|
+
const features = useMemo8(() => {
|
10736
10991
|
return (data.featureUsage?.features || []).map(
|
10737
10992
|
({
|
10738
10993
|
access,
|
@@ -10775,10 +11030,10 @@ var MeteredFeatures = forwardRef3(({ className, ...rest }, ref) => {
|
|
10775
11030
|
Text,
|
10776
11031
|
{
|
10777
11032
|
as: Box,
|
10778
|
-
$font:
|
10779
|
-
$size:
|
10780
|
-
$weight:
|
10781
|
-
$color:
|
11033
|
+
$font: theme.typography[props.header.fontStyle].fontFamily,
|
11034
|
+
$size: theme.typography[props.header.fontStyle].fontSize,
|
11035
|
+
$weight: theme.typography[props.header.fontStyle].fontWeight,
|
11036
|
+
$color: theme.typography[props.header.fontStyle].color,
|
10782
11037
|
children: feature.name
|
10783
11038
|
}
|
10784
11039
|
),
|
@@ -10786,10 +11041,10 @@ var MeteredFeatures = forwardRef3(({ className, ...rest }, ref) => {
|
|
10786
11041
|
Text,
|
10787
11042
|
{
|
10788
11043
|
as: Box,
|
10789
|
-
$font:
|
10790
|
-
$size:
|
10791
|
-
$weight:
|
10792
|
-
$color:
|
11044
|
+
$font: theme.typography[props.description.fontStyle].fontFamily,
|
11045
|
+
$size: theme.typography[props.description.fontStyle].fontSize,
|
11046
|
+
$weight: theme.typography[props.description.fontStyle].fontWeight,
|
11047
|
+
$color: theme.typography[props.description.fontStyle].color,
|
10793
11048
|
children: feature.description
|
10794
11049
|
}
|
10795
11050
|
)
|
@@ -10799,10 +11054,10 @@ var MeteredFeatures = forwardRef3(({ className, ...rest }, ref) => {
|
|
10799
11054
|
Text,
|
10800
11055
|
{
|
10801
11056
|
as: Box,
|
10802
|
-
$font:
|
10803
|
-
$size:
|
10804
|
-
$weight:
|
10805
|
-
$color:
|
11057
|
+
$font: theme.typography[props.allocation.fontStyle].fontFamily,
|
11058
|
+
$size: theme.typography[props.allocation.fontStyle].fontSize,
|
11059
|
+
$weight: theme.typography[props.allocation.fontStyle].fontWeight,
|
11060
|
+
$color: theme.typography[props.allocation.fontStyle].color,
|
10806
11061
|
children: typeof allocation === "number" ? `${allocation} ${feature.name}` : `Unlimited ${feature.name}`
|
10807
11062
|
}
|
10808
11063
|
),
|
@@ -10810,10 +11065,10 @@ var MeteredFeatures = forwardRef3(({ className, ...rest }, ref) => {
|
|
10810
11065
|
Text,
|
10811
11066
|
{
|
10812
11067
|
as: Box,
|
10813
|
-
$font:
|
10814
|
-
$size:
|
10815
|
-
$weight:
|
10816
|
-
$color:
|
11068
|
+
$font: theme.typography[props.usage.fontStyle].fontFamily,
|
11069
|
+
$size: theme.typography[props.usage.fontStyle].fontSize,
|
11070
|
+
$weight: theme.typography[props.usage.fontStyle].fontWeight,
|
11071
|
+
$color: theme.typography[props.usage.fontStyle].color,
|
10817
11072
|
children: typeof allocation === "number" ? `${usage} of ${allocation} used` : `${usage} used`
|
10818
11073
|
}
|
10819
11074
|
)
|
@@ -10837,7 +11092,7 @@ var MeteredFeatures = forwardRef3(({ className, ...rest }, ref) => {
|
|
10837
11092
|
});
|
10838
11093
|
|
10839
11094
|
// src/components/elements/upcoming-bill/UpcomingBill.tsx
|
10840
|
-
import { forwardRef as forwardRef4, useMemo as
|
11095
|
+
import { forwardRef as forwardRef4, useMemo as useMemo9 } from "react";
|
10841
11096
|
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
10842
11097
|
function resolveDesignProps4(props) {
|
10843
11098
|
return {
|
@@ -10859,8 +11114,9 @@ function resolveDesignProps4(props) {
|
|
10859
11114
|
}
|
10860
11115
|
var UpcomingBill = forwardRef4(({ className, ...rest }, ref) => {
|
10861
11116
|
const props = resolveDesignProps4(rest);
|
10862
|
-
const
|
10863
|
-
const {
|
11117
|
+
const theme = nt();
|
11118
|
+
const { data, stripe } = useEmbed();
|
11119
|
+
const { upcomingInvoice } = useMemo9(() => {
|
10864
11120
|
return {
|
10865
11121
|
upcomingInvoice: {
|
10866
11122
|
...data.upcomingInvoice?.amountDue && {
|
@@ -10875,7 +11131,7 @@ var UpcomingBill = forwardRef4(({ className, ...rest }, ref) => {
|
|
10875
11131
|
}
|
10876
11132
|
};
|
10877
11133
|
}, [data.subscription, data.upcomingInvoice]);
|
10878
|
-
if (!stripe || !
|
11134
|
+
if (!stripe || !upcomingInvoice.amountDue || !upcomingInvoice.dueDate) {
|
10879
11135
|
return null;
|
10880
11136
|
}
|
10881
11137
|
return /* @__PURE__ */ jsxs9("div", { ref, className, children: [
|
@@ -10888,10 +11144,10 @@ var UpcomingBill = forwardRef4(({ className, ...rest }, ref) => {
|
|
10888
11144
|
children: /* @__PURE__ */ jsxs9(
|
10889
11145
|
Text,
|
10890
11146
|
{
|
10891
|
-
$font:
|
10892
|
-
$size:
|
10893
|
-
$weight:
|
10894
|
-
$color:
|
11147
|
+
$font: theme.typography[props.header.fontStyle].fontFamily,
|
11148
|
+
$size: theme.typography[props.header.fontStyle].fontSize,
|
11149
|
+
$weight: theme.typography[props.header.fontStyle].fontWeight,
|
11150
|
+
$color: theme.typography[props.header.fontStyle].color,
|
10895
11151
|
children: [
|
10896
11152
|
props.header.prefix,
|
10897
11153
|
" ",
|
@@ -10905,10 +11161,10 @@ var UpcomingBill = forwardRef4(({ className, ...rest }, ref) => {
|
|
10905
11161
|
props.price.isVisible && /* @__PURE__ */ jsx14(Flex, { $alignItems: "end", $flexGrow: "1", children: /* @__PURE__ */ jsx14(
|
10906
11162
|
Text,
|
10907
11163
|
{
|
10908
|
-
$font:
|
10909
|
-
$size:
|
10910
|
-
$weight:
|
10911
|
-
$color:
|
11164
|
+
$font: theme.typography[props.price.fontStyle].fontFamily,
|
11165
|
+
$size: theme.typography[props.price.fontStyle].fontSize,
|
11166
|
+
$weight: theme.typography[props.price.fontStyle].fontWeight,
|
11167
|
+
$color: theme.typography[props.price.fontStyle].color,
|
10912
11168
|
$lineHeight: 1,
|
10913
11169
|
children: formatCurrency(upcomingInvoice.amountDue)
|
10914
11170
|
}
|
@@ -10916,10 +11172,10 @@ var UpcomingBill = forwardRef4(({ className, ...rest }, ref) => {
|
|
10916
11172
|
/* @__PURE__ */ jsx14(Box, { $maxWidth: "10rem", $lineHeight: "1", $textAlign: "right", children: /* @__PURE__ */ jsx14(
|
10917
11173
|
Text,
|
10918
11174
|
{
|
10919
|
-
$font:
|
10920
|
-
$size:
|
10921
|
-
$weight:
|
10922
|
-
$color:
|
11175
|
+
$font: theme.typography[props.contractEndDate.fontStyle].fontFamily,
|
11176
|
+
$size: theme.typography[props.contractEndDate.fontStyle].fontSize,
|
11177
|
+
$weight: theme.typography[props.contractEndDate.fontStyle].fontWeight,
|
11178
|
+
$color: theme.typography[props.contractEndDate.fontStyle].color,
|
10923
11179
|
children: "Estimated monthly bill."
|
10924
11180
|
}
|
10925
11181
|
) })
|
@@ -10928,7 +11184,7 @@ var UpcomingBill = forwardRef4(({ className, ...rest }, ref) => {
|
|
10928
11184
|
});
|
10929
11185
|
|
10930
11186
|
// src/components/elements/payment-method/PaymentMethod.tsx
|
10931
|
-
import { forwardRef as forwardRef5, useMemo as
|
11187
|
+
import { forwardRef as forwardRef5, useMemo as useMemo10 } from "react";
|
10932
11188
|
import { createPortal as createPortal2 } from "react-dom";
|
10933
11189
|
import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
|
10934
11190
|
var resolveDesignProps5 = (props) => {
|
@@ -10944,8 +11200,9 @@ var resolveDesignProps5 = (props) => {
|
|
10944
11200
|
};
|
10945
11201
|
var PaymentMethod = forwardRef5(({ children, className, portal, ...rest }, ref) => {
|
10946
11202
|
const props = resolveDesignProps5(rest);
|
10947
|
-
const
|
10948
|
-
const
|
11203
|
+
const theme = nt();
|
11204
|
+
const { data, stripe, layout } = useEmbed();
|
11205
|
+
const paymentMethod = useMemo10(() => {
|
10949
11206
|
const { cardLast4, cardExpMonth, cardExpYear } = data.subscription?.paymentMethod || {};
|
10950
11207
|
let monthsToExpiration;
|
10951
11208
|
if (typeof cardExpYear === "number" && typeof cardExpMonth === "number") {
|
@@ -10961,7 +11218,10 @@ var PaymentMethod = forwardRef5(({ children, className, portal, ...rest }, ref)
|
|
10961
11218
|
monthsToExpiration
|
10962
11219
|
};
|
10963
11220
|
}, [data.subscription?.paymentMethod]);
|
10964
|
-
|
11221
|
+
const isLightBackground = useMemo10(() => {
|
11222
|
+
return hexToHSL(theme.card.background).l > 50;
|
11223
|
+
}, [theme.card.background]);
|
11224
|
+
if (!stripe || !paymentMethod.cardLast4) {
|
10965
11225
|
return null;
|
10966
11226
|
}
|
10967
11227
|
return /* @__PURE__ */ jsxs10("div", { ref, className, children: [
|
@@ -10975,17 +11235,17 @@ var PaymentMethod = forwardRef5(({ children, className, portal, ...rest }, ref)
|
|
10975
11235
|
/* @__PURE__ */ jsx15(
|
10976
11236
|
Text,
|
10977
11237
|
{
|
10978
|
-
$font:
|
10979
|
-
$size:
|
10980
|
-
$weight:
|
10981
|
-
$color:
|
11238
|
+
$font: theme.typography[props.header.fontStyle].fontFamily,
|
11239
|
+
$size: theme.typography[props.header.fontStyle].fontSize,
|
11240
|
+
$weight: theme.typography[props.header.fontStyle].fontWeight,
|
11241
|
+
$color: theme.typography[props.header.fontStyle].color,
|
10982
11242
|
children: "Payment Method"
|
10983
11243
|
}
|
10984
11244
|
),
|
10985
11245
|
typeof paymentMethod.monthsToExpiration === "number" && Math.abs(paymentMethod.monthsToExpiration) < 4 && /* @__PURE__ */ jsx15(
|
10986
11246
|
Text,
|
10987
11247
|
{
|
10988
|
-
$font:
|
11248
|
+
$font: theme.typography.text.fontFamily,
|
10989
11249
|
$size: 14,
|
10990
11250
|
$color: "#DB6769",
|
10991
11251
|
children: paymentMethod.monthsToExpiration > 0 ? `Expires in ${paymentMethod.monthsToExpiration} mo` : "Expired"
|
@@ -11000,10 +11260,10 @@ var PaymentMethod = forwardRef5(({ children, className, portal, ...rest }, ref)
|
|
11000
11260
|
$justifyContent: "space-between",
|
11001
11261
|
$alignItems: "center",
|
11002
11262
|
$margin: "0 0 1rem",
|
11003
|
-
$
|
11263
|
+
$backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.125)",
|
11004
11264
|
$padding: "0.375rem 1rem",
|
11005
11265
|
$borderRadius: "9999px",
|
11006
|
-
children: /* @__PURE__ */ jsxs10(Text, { $font:
|
11266
|
+
children: /* @__PURE__ */ jsxs10(Text, { $font: theme.typography.text.fontFamily, $size: 14, children: [
|
11007
11267
|
"\u{1F4B3} Card ending in ",
|
11008
11268
|
paymentMethod.cardLast4
|
11009
11269
|
] })
|
@@ -11222,7 +11482,7 @@ var PaymentMethod = forwardRef5(({ children, className, portal, ...rest }, ref)
|
|
11222
11482
|
});
|
11223
11483
|
|
11224
11484
|
// src/components/elements/invoices/Invoices.tsx
|
11225
|
-
import { forwardRef as forwardRef6, useMemo as
|
11485
|
+
import { forwardRef as forwardRef6, useMemo as useMemo11 } from "react";
|
11226
11486
|
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
11227
11487
|
function resolveDesignProps6(props) {
|
11228
11488
|
return {
|
@@ -11250,8 +11510,8 @@ function resolveDesignProps6(props) {
|
|
11250
11510
|
}
|
11251
11511
|
var Invoices = forwardRef6(({ className, ...rest }, ref) => {
|
11252
11512
|
const props = resolveDesignProps6(rest);
|
11253
|
-
const
|
11254
|
-
const { invoices } =
|
11513
|
+
const theme = nt();
|
11514
|
+
const { invoices } = useMemo11(() => {
|
11255
11515
|
return {
|
11256
11516
|
invoices: [
|
11257
11517
|
{
|
@@ -11269,10 +11529,10 @@ var Invoices = forwardRef6(({ className, ...rest }, ref) => {
|
|
11269
11529
|
props.header.isVisible && /* @__PURE__ */ jsx16(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ jsx16(
|
11270
11530
|
Text,
|
11271
11531
|
{
|
11272
|
-
$font:
|
11273
|
-
$size:
|
11274
|
-
$weight:
|
11275
|
-
$color:
|
11532
|
+
$font: theme.typography[props.header.fontStyle].fontFamily,
|
11533
|
+
$size: theme.typography[props.header.fontStyle].fontSize,
|
11534
|
+
$weight: theme.typography[props.header.fontStyle].fontWeight,
|
11535
|
+
$color: theme.typography[props.header.fontStyle].color,
|
11276
11536
|
children: "Invoices"
|
11277
11537
|
}
|
11278
11538
|
) }),
|
@@ -11284,20 +11544,20 @@ var Invoices = forwardRef6(({ className, ...rest }, ref) => {
|
|
11284
11544
|
props.date.isVisible && /* @__PURE__ */ jsx16(
|
11285
11545
|
Text,
|
11286
11546
|
{
|
11287
|
-
$font:
|
11288
|
-
$size:
|
11289
|
-
$weight:
|
11290
|
-
$color:
|
11547
|
+
$font: theme.typography[props.date.fontStyle].fontFamily,
|
11548
|
+
$size: theme.typography[props.date.fontStyle].fontSize,
|
11549
|
+
$weight: theme.typography[props.date.fontStyle].fontWeight,
|
11550
|
+
$color: theme.typography[props.date.fontStyle].color,
|
11291
11551
|
children: toPrettyDate(date)
|
11292
11552
|
}
|
11293
11553
|
),
|
11294
11554
|
props.amount.isVisible && /* @__PURE__ */ jsxs11(
|
11295
11555
|
Text,
|
11296
11556
|
{
|
11297
|
-
$font:
|
11298
|
-
$size:
|
11299
|
-
$weight:
|
11300
|
-
$color:
|
11557
|
+
$font: theme.typography[props.amount.fontStyle].fontFamily,
|
11558
|
+
$size: theme.typography[props.amount.fontStyle].fontSize,
|
11559
|
+
$weight: theme.typography[props.amount.fontStyle].fontWeight,
|
11560
|
+
$color: theme.typography[props.amount.fontStyle].color,
|
11301
11561
|
children: [
|
11302
11562
|
"$",
|
11303
11563
|
amount
|
@@ -11311,10 +11571,10 @@ var Invoices = forwardRef6(({ className, ...rest }, ref) => {
|
|
11311
11571
|
/* @__PURE__ */ jsx16(
|
11312
11572
|
Text,
|
11313
11573
|
{
|
11314
|
-
$font:
|
11315
|
-
$size:
|
11316
|
-
$weight:
|
11317
|
-
$color:
|
11574
|
+
$font: theme.typography[props.collapse.fontStyle].fontFamily,
|
11575
|
+
$size: theme.typography[props.collapse.fontStyle].fontSize,
|
11576
|
+
$weight: theme.typography[props.collapse.fontStyle].fontWeight,
|
11577
|
+
$color: theme.typography[props.collapse.fontStyle].color,
|
11318
11578
|
children: "See all"
|
11319
11579
|
}
|
11320
11580
|
)
|
@@ -11323,7 +11583,7 @@ var Invoices = forwardRef6(({ className, ...rest }, ref) => {
|
|
11323
11583
|
});
|
11324
11584
|
|
11325
11585
|
// src/components/embed/ComponentTree.tsx
|
11326
|
-
import { useEffect as useEffect5, useState as
|
11586
|
+
import { useEffect as useEffect5, useState as useState4, Children } from "react";
|
11327
11587
|
|
11328
11588
|
// src/components/embed/renderer.ts
|
11329
11589
|
import { createElement } from "react";
|
@@ -11352,22 +11612,23 @@ var StyledViewport = dt.div`
|
|
11352
11612
|
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
11353
11613
|
var Viewport = forwardRef8(
|
11354
11614
|
({ children, ...props }, ref) => {
|
11355
|
-
const
|
11615
|
+
const theme = nt();
|
11616
|
+
const { layout } = useEmbed();
|
11356
11617
|
return /* @__PURE__ */ jsx18(
|
11357
11618
|
StyledViewport,
|
11358
11619
|
{
|
11359
11620
|
ref,
|
11360
|
-
$numberOfColumns:
|
11621
|
+
$numberOfColumns: theme.numberOfColumns,
|
11361
11622
|
...props,
|
11362
11623
|
children: layout === "disabled" ? /* @__PURE__ */ jsx18(Box, { $width: "100%", children: /* @__PURE__ */ jsxs12(
|
11363
11624
|
Flex,
|
11364
11625
|
{
|
11365
11626
|
$flexDirection: "column",
|
11366
|
-
$padding: `${
|
11627
|
+
$padding: `${theme.card.padding / TEXT_BASE_SIZE}rem`,
|
11367
11628
|
$width: "100%",
|
11368
11629
|
$height: "auto",
|
11369
|
-
$borderRadius: `${
|
11370
|
-
$backgroundColor:
|
11630
|
+
$borderRadius: `${theme.card.borderRadius / TEXT_BASE_SIZE}rem`,
|
11631
|
+
$backgroundColor: theme.card.background,
|
11371
11632
|
$alignItems: "center",
|
11372
11633
|
$justifyContent: "center",
|
11373
11634
|
children: [
|
@@ -11375,10 +11636,10 @@ var Viewport = forwardRef8(
|
|
11375
11636
|
Box,
|
11376
11637
|
{
|
11377
11638
|
$marginBottom: "8px",
|
11378
|
-
$fontSize: `${
|
11379
|
-
$fontFamily:
|
11380
|
-
$fontWeight:
|
11381
|
-
$color:
|
11639
|
+
$fontSize: `${theme.typography.heading1.fontSize / TEXT_BASE_SIZE}rem`,
|
11640
|
+
$fontFamily: theme.typography.heading1.fontFamily,
|
11641
|
+
$fontWeight: theme.typography.heading1.fontWeight,
|
11642
|
+
$color: theme.typography.heading1.color,
|
11382
11643
|
children: "Coming soon"
|
11383
11644
|
}
|
11384
11645
|
),
|
@@ -11386,10 +11647,10 @@ var Viewport = forwardRef8(
|
|
11386
11647
|
Box,
|
11387
11648
|
{
|
11388
11649
|
$marginBottom: "8px",
|
11389
|
-
$fontSize: `${
|
11390
|
-
$fontFamily:
|
11391
|
-
$fontWeight:
|
11392
|
-
$color:
|
11650
|
+
$fontSize: `${theme.typography.text.fontSize / TEXT_BASE_SIZE}rem`,
|
11651
|
+
$fontFamily: theme.typography.text.fontFamily,
|
11652
|
+
$fontWeight: theme.typography.text.fontWeight,
|
11653
|
+
$color: theme.typography.text.color,
|
11393
11654
|
children: "The plan manager will be back very soon."
|
11394
11655
|
}
|
11395
11656
|
)
|
@@ -11434,7 +11695,7 @@ var StyledCard = dt.div(
|
|
11434
11695
|
|
11435
11696
|
${() => {
|
11436
11697
|
const { l: l2 } = hexToHSL(theme.card.background);
|
11437
|
-
const borderColor = l2 > 50 ?
|
11698
|
+
const borderColor = l2 > 50 ? "hsla(0, 0%, 0%, 0.1)" : "hsla(0, 0%, 100%, 0.2)";
|
11438
11699
|
const borderRadius = `${$borderRadius / TEXT_BASE_SIZE}rem`;
|
11439
11700
|
const boxShadow = "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A";
|
11440
11701
|
if ($sectionLayout === "merged") {
|
@@ -11469,16 +11730,16 @@ var StyledCard = dt.div(
|
|
11469
11730
|
import { jsx as jsx19 } from "react/jsx-runtime";
|
11470
11731
|
var Card = forwardRef9(
|
11471
11732
|
({ children, className }, ref) => {
|
11472
|
-
const
|
11733
|
+
const theme = nt();
|
11473
11734
|
return /* @__PURE__ */ jsx19(
|
11474
11735
|
StyledCard,
|
11475
11736
|
{
|
11476
11737
|
ref,
|
11477
11738
|
className,
|
11478
|
-
$sectionLayout:
|
11479
|
-
$borderRadius:
|
11480
|
-
$padding:
|
11481
|
-
$shadow:
|
11739
|
+
$sectionLayout: theme?.sectionLayout,
|
11740
|
+
$borderRadius: theme?.card?.borderRadius,
|
11741
|
+
$padding: theme?.card?.padding,
|
11742
|
+
$shadow: theme?.card?.hasShadow,
|
11482
11743
|
children
|
11483
11744
|
}
|
11484
11745
|
);
|
@@ -11550,78 +11811,84 @@ var spin = mt`
|
|
11550
11811
|
transform: rotate(360deg);
|
11551
11812
|
}
|
11552
11813
|
`;
|
11553
|
-
var Loader = dt.div
|
11554
|
-
|
11555
|
-
|
11556
|
-
|
11557
|
-
|
11558
|
-
|
11559
|
-
|
11560
|
-
|
11561
|
-
|
11562
|
-
display: inline-block;
|
11563
|
-
`;
|
11564
|
-
});
|
11814
|
+
var Loader = dt.div`
|
11815
|
+
border: ${({ theme }) => `${4 / TEXT_BASE_SIZE}rem solid hsla(0, 0%, ${hexToHSL(theme.card.background).l > 50 ? 0 : 100}%, 0.1)`};
|
11816
|
+
border-top: ${4 / TEXT_BASE_SIZE}rem solid ${({ theme }) => theme.primary};
|
11817
|
+
border-radius: 50%;
|
11818
|
+
width: ${40 / TEXT_BASE_SIZE}rem;
|
11819
|
+
height: ${40 / TEXT_BASE_SIZE}rem;
|
11820
|
+
animation: ${spin} 1.5s linear infinite;
|
11821
|
+
display: inline-block;
|
11822
|
+
`;
|
11565
11823
|
|
11566
11824
|
// src/components/embed/ComponentTree.tsx
|
11567
11825
|
import { Fragment as Fragment2, jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
|
11568
|
-
var
|
11569
|
-
const
|
11570
|
-
|
11571
|
-
|
11572
|
-
|
11573
|
-
|
11574
|
-
|
11575
|
-
|
11576
|
-
|
11577
|
-
|
11578
|
-
|
11579
|
-
|
11580
|
-
|
11581
|
-
|
11826
|
+
var Loading = () => {
|
11827
|
+
const theme = nt();
|
11828
|
+
return /* @__PURE__ */ jsx21(
|
11829
|
+
Flex,
|
11830
|
+
{
|
11831
|
+
$width: "100%",
|
11832
|
+
$height: "100%",
|
11833
|
+
$alignItems: "center",
|
11834
|
+
$justifyContent: "center",
|
11835
|
+
$padding: `${theme.card.padding / TEXT_BASE_SIZE}rem`,
|
11836
|
+
children: /* @__PURE__ */ jsx21(Loader, {})
|
11837
|
+
}
|
11838
|
+
);
|
11839
|
+
};
|
11840
|
+
var Error2 = ({ message }) => {
|
11841
|
+
const theme = nt();
|
11842
|
+
return /* @__PURE__ */ jsxs13(
|
11843
|
+
Flex,
|
11844
|
+
{
|
11845
|
+
$flexDirection: "column",
|
11846
|
+
$padding: `${theme.card.padding / TEXT_BASE_SIZE}rem`,
|
11847
|
+
$width: "100%",
|
11848
|
+
$height: "auto",
|
11849
|
+
$borderRadius: `${theme.card.borderRadius / TEXT_BASE_SIZE}rem`,
|
11850
|
+
$backgroundColor: theme.card.background,
|
11851
|
+
$alignItems: "center",
|
11852
|
+
$justifyContent: "center",
|
11853
|
+
children: [
|
11854
|
+
/* @__PURE__ */ jsx21(
|
11855
|
+
Box,
|
11856
|
+
{
|
11857
|
+
$marginBottom: `${8 / TEXT_BASE_SIZE}rem`,
|
11858
|
+
$fontSize: `${theme.typography.heading1.fontSize / TEXT_BASE_SIZE}rem`,
|
11859
|
+
$fontFamily: theme.typography.heading1.fontFamily,
|
11860
|
+
$fontWeight: theme.typography.heading1.fontWeight,
|
11861
|
+
$color: theme.typography.heading1.color,
|
11862
|
+
children: "404 Error"
|
11863
|
+
}
|
11864
|
+
),
|
11865
|
+
/* @__PURE__ */ jsx21(
|
11866
|
+
Box,
|
11867
|
+
{
|
11868
|
+
$marginBottom: `${8 / TEXT_BASE_SIZE}rem`,
|
11869
|
+
$fontSize: `${theme.typography.text.fontSize / TEXT_BASE_SIZE}rem`,
|
11870
|
+
$fontFamily: theme.typography.text.fontFamily,
|
11871
|
+
$fontWeight: theme.typography.text.fontWeight,
|
11872
|
+
$color: theme.typography.text.color,
|
11873
|
+
children: message
|
11874
|
+
}
|
11875
|
+
)
|
11876
|
+
]
|
11877
|
+
}
|
11582
11878
|
);
|
11879
|
+
};
|
11880
|
+
var ComponentTree = () => {
|
11881
|
+
const { error, nodes } = useEmbed();
|
11882
|
+
const [children, setChildren] = useState4(/* @__PURE__ */ jsx21(Loading, {}));
|
11583
11883
|
useEffect5(() => {
|
11584
11884
|
const renderer = createRenderer();
|
11585
11885
|
setChildren(nodes.map(renderer));
|
11586
11886
|
}, [nodes]);
|
11587
11887
|
if (error) {
|
11588
|
-
return /* @__PURE__ */
|
11589
|
-
|
11590
|
-
|
11591
|
-
|
11592
|
-
$padding: `${settings.theme.card.padding / 16}rem`,
|
11593
|
-
$width: "100%",
|
11594
|
-
$height: "auto",
|
11595
|
-
$borderRadius: `${settings.theme.card.borderRadius / 16}rem`,
|
11596
|
-
$backgroundColor: settings.theme.card.background,
|
11597
|
-
$alignItems: "center",
|
11598
|
-
$justifyContent: "center",
|
11599
|
-
children: [
|
11600
|
-
/* @__PURE__ */ jsx21(
|
11601
|
-
Box,
|
11602
|
-
{
|
11603
|
-
$marginBottom: "8px",
|
11604
|
-
$fontSize: `${settings.theme.typography.heading1.fontSize / 16}rem`,
|
11605
|
-
$fontFamily: settings.theme.typography.heading1.fontFamily,
|
11606
|
-
$fontWeight: settings.theme.typography.heading1.fontWeight,
|
11607
|
-
$color: settings.theme.typography.heading1.color,
|
11608
|
-
children: "404 Error"
|
11609
|
-
}
|
11610
|
-
),
|
11611
|
-
/* @__PURE__ */ jsx21(
|
11612
|
-
Box,
|
11613
|
-
{
|
11614
|
-
$marginBottom: "8px",
|
11615
|
-
$fontSize: `${settings.theme.typography.text.fontSize / 16}rem`,
|
11616
|
-
$fontFamily: settings.theme.typography.text.fontFamily,
|
11617
|
-
$fontWeight: settings.theme.typography.text.fontWeight,
|
11618
|
-
$color: settings.theme.typography.text.color,
|
11619
|
-
children: error.message
|
11620
|
-
}
|
11621
|
-
)
|
11622
|
-
]
|
11623
|
-
}
|
11624
|
-
);
|
11888
|
+
return /* @__PURE__ */ jsx21(Error2, { message: error.message });
|
11889
|
+
}
|
11890
|
+
if (Children.count(children) === 0) {
|
11891
|
+
return /* @__PURE__ */ jsx21(Loading, {});
|
11625
11892
|
}
|
11626
11893
|
return /* @__PURE__ */ jsx21(Fragment2, { children });
|
11627
11894
|
};
|
@@ -11668,7 +11935,8 @@ export {
|
|
11668
11935
|
useSchematic,
|
11669
11936
|
useSchematicContext,
|
11670
11937
|
useSchematicEvents,
|
11671
|
-
useSchematicFlag
|
11938
|
+
useSchematicFlag,
|
11939
|
+
useSchematicIsPending
|
11672
11940
|
};
|
11673
11941
|
/*! Bundled license information:
|
11674
11942
|
|