@schematichq/schematic-react 0.2.0-rc.1 → 0.2.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/schematic-react.cjs.js +2380 -492
- package/dist/schematic-react.d.ts +758 -5
- package/dist/schematic-react.esm.js +2418 -528
- package/package.json +9 -3
@@ -61,6 +61,728 @@ var require_shallowequal = __commonJS({
|
|
61
61
|
}
|
62
62
|
});
|
63
63
|
|
64
|
+
// node_modules/lodash.merge/index.js
|
65
|
+
var require_lodash = __commonJS({
|
66
|
+
"node_modules/lodash.merge/index.js"(exports, module) {
|
67
|
+
var LARGE_ARRAY_SIZE = 200;
|
68
|
+
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
69
|
+
var HOT_COUNT = 800;
|
70
|
+
var HOT_SPAN = 16;
|
71
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
72
|
+
var argsTag = "[object Arguments]";
|
73
|
+
var arrayTag = "[object Array]";
|
74
|
+
var asyncTag = "[object AsyncFunction]";
|
75
|
+
var boolTag = "[object Boolean]";
|
76
|
+
var dateTag = "[object Date]";
|
77
|
+
var errorTag = "[object Error]";
|
78
|
+
var funcTag = "[object Function]";
|
79
|
+
var genTag = "[object GeneratorFunction]";
|
80
|
+
var mapTag = "[object Map]";
|
81
|
+
var numberTag = "[object Number]";
|
82
|
+
var nullTag = "[object Null]";
|
83
|
+
var objectTag = "[object Object]";
|
84
|
+
var proxyTag = "[object Proxy]";
|
85
|
+
var regexpTag = "[object RegExp]";
|
86
|
+
var setTag = "[object Set]";
|
87
|
+
var stringTag = "[object String]";
|
88
|
+
var undefinedTag = "[object Undefined]";
|
89
|
+
var weakMapTag = "[object WeakMap]";
|
90
|
+
var arrayBufferTag = "[object ArrayBuffer]";
|
91
|
+
var dataViewTag = "[object DataView]";
|
92
|
+
var float32Tag = "[object Float32Array]";
|
93
|
+
var float64Tag = "[object Float64Array]";
|
94
|
+
var int8Tag = "[object Int8Array]";
|
95
|
+
var int16Tag = "[object Int16Array]";
|
96
|
+
var int32Tag = "[object Int32Array]";
|
97
|
+
var uint8Tag = "[object Uint8Array]";
|
98
|
+
var uint8ClampedTag = "[object Uint8ClampedArray]";
|
99
|
+
var uint16Tag = "[object Uint16Array]";
|
100
|
+
var uint32Tag = "[object Uint32Array]";
|
101
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
102
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
103
|
+
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
104
|
+
var typedArrayTags = {};
|
105
|
+
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
|
106
|
+
typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
|
107
|
+
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
108
|
+
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
109
|
+
var root = freeGlobal || freeSelf || Function("return this")();
|
110
|
+
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
|
111
|
+
var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
|
112
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
113
|
+
var freeProcess = moduleExports && freeGlobal.process;
|
114
|
+
var nodeUtil = function() {
|
115
|
+
try {
|
116
|
+
var types = freeModule && freeModule.require && freeModule.require("util").types;
|
117
|
+
if (types) {
|
118
|
+
return types;
|
119
|
+
}
|
120
|
+
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
121
|
+
} catch (e) {
|
122
|
+
}
|
123
|
+
}();
|
124
|
+
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
125
|
+
function apply(func, thisArg, args) {
|
126
|
+
switch (args.length) {
|
127
|
+
case 0:
|
128
|
+
return func.call(thisArg);
|
129
|
+
case 1:
|
130
|
+
return func.call(thisArg, args[0]);
|
131
|
+
case 2:
|
132
|
+
return func.call(thisArg, args[0], args[1]);
|
133
|
+
case 3:
|
134
|
+
return func.call(thisArg, args[0], args[1], args[2]);
|
135
|
+
}
|
136
|
+
return func.apply(thisArg, args);
|
137
|
+
}
|
138
|
+
function baseTimes(n, iteratee) {
|
139
|
+
var index = -1, result = Array(n);
|
140
|
+
while (++index < n) {
|
141
|
+
result[index] = iteratee(index);
|
142
|
+
}
|
143
|
+
return result;
|
144
|
+
}
|
145
|
+
function baseUnary(func) {
|
146
|
+
return function(value) {
|
147
|
+
return func(value);
|
148
|
+
};
|
149
|
+
}
|
150
|
+
function getValue(object, key) {
|
151
|
+
return object == null ? void 0 : object[key];
|
152
|
+
}
|
153
|
+
function overArg(func, transform) {
|
154
|
+
return function(arg) {
|
155
|
+
return func(transform(arg));
|
156
|
+
};
|
157
|
+
}
|
158
|
+
var arrayProto = Array.prototype;
|
159
|
+
var funcProto = Function.prototype;
|
160
|
+
var objectProto = Object.prototype;
|
161
|
+
var coreJsData = root["__core-js_shared__"];
|
162
|
+
var funcToString = funcProto.toString;
|
163
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
164
|
+
var maskSrcKey = function() {
|
165
|
+
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
|
166
|
+
return uid ? "Symbol(src)_1." + uid : "";
|
167
|
+
}();
|
168
|
+
var nativeObjectToString = objectProto.toString;
|
169
|
+
var objectCtorString = funcToString.call(Object);
|
170
|
+
var reIsNative = RegExp(
|
171
|
+
"^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
172
|
+
);
|
173
|
+
var Buffer2 = moduleExports ? root.Buffer : void 0;
|
174
|
+
var Symbol2 = root.Symbol;
|
175
|
+
var Uint8Array2 = root.Uint8Array;
|
176
|
+
var allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
|
177
|
+
var getPrototype = overArg(Object.getPrototypeOf, Object);
|
178
|
+
var objectCreate = Object.create;
|
179
|
+
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
180
|
+
var splice = arrayProto.splice;
|
181
|
+
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
|
182
|
+
var defineProperty = function() {
|
183
|
+
try {
|
184
|
+
var func = getNative(Object, "defineProperty");
|
185
|
+
func({}, "", {});
|
186
|
+
return func;
|
187
|
+
} catch (e) {
|
188
|
+
}
|
189
|
+
}();
|
190
|
+
var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
|
191
|
+
var nativeMax = Math.max;
|
192
|
+
var nativeNow = Date.now;
|
193
|
+
var Map2 = getNative(root, "Map");
|
194
|
+
var nativeCreate = getNative(Object, "create");
|
195
|
+
var baseCreate = /* @__PURE__ */ function() {
|
196
|
+
function object() {
|
197
|
+
}
|
198
|
+
return function(proto) {
|
199
|
+
if (!isObject(proto)) {
|
200
|
+
return {};
|
201
|
+
}
|
202
|
+
if (objectCreate) {
|
203
|
+
return objectCreate(proto);
|
204
|
+
}
|
205
|
+
object.prototype = proto;
|
206
|
+
var result = new object();
|
207
|
+
object.prototype = void 0;
|
208
|
+
return result;
|
209
|
+
};
|
210
|
+
}();
|
211
|
+
function Hash(entries) {
|
212
|
+
var index = -1, length2 = entries == null ? 0 : entries.length;
|
213
|
+
this.clear();
|
214
|
+
while (++index < length2) {
|
215
|
+
var entry = entries[index];
|
216
|
+
this.set(entry[0], entry[1]);
|
217
|
+
}
|
218
|
+
}
|
219
|
+
function hashClear() {
|
220
|
+
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
221
|
+
this.size = 0;
|
222
|
+
}
|
223
|
+
function hashDelete(key) {
|
224
|
+
var result = this.has(key) && delete this.__data__[key];
|
225
|
+
this.size -= result ? 1 : 0;
|
226
|
+
return result;
|
227
|
+
}
|
228
|
+
function hashGet(key) {
|
229
|
+
var data = this.__data__;
|
230
|
+
if (nativeCreate) {
|
231
|
+
var result = data[key];
|
232
|
+
return result === HASH_UNDEFINED ? void 0 : result;
|
233
|
+
}
|
234
|
+
return hasOwnProperty.call(data, key) ? data[key] : void 0;
|
235
|
+
}
|
236
|
+
function hashHas(key) {
|
237
|
+
var data = this.__data__;
|
238
|
+
return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
|
239
|
+
}
|
240
|
+
function hashSet(key, value) {
|
241
|
+
var data = this.__data__;
|
242
|
+
this.size += this.has(key) ? 0 : 1;
|
243
|
+
data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
|
244
|
+
return this;
|
245
|
+
}
|
246
|
+
Hash.prototype.clear = hashClear;
|
247
|
+
Hash.prototype["delete"] = hashDelete;
|
248
|
+
Hash.prototype.get = hashGet;
|
249
|
+
Hash.prototype.has = hashHas;
|
250
|
+
Hash.prototype.set = hashSet;
|
251
|
+
function ListCache(entries) {
|
252
|
+
var index = -1, length2 = entries == null ? 0 : entries.length;
|
253
|
+
this.clear();
|
254
|
+
while (++index < length2) {
|
255
|
+
var entry = entries[index];
|
256
|
+
this.set(entry[0], entry[1]);
|
257
|
+
}
|
258
|
+
}
|
259
|
+
function listCacheClear() {
|
260
|
+
this.__data__ = [];
|
261
|
+
this.size = 0;
|
262
|
+
}
|
263
|
+
function listCacheDelete(key) {
|
264
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
265
|
+
if (index < 0) {
|
266
|
+
return false;
|
267
|
+
}
|
268
|
+
var lastIndex = data.length - 1;
|
269
|
+
if (index == lastIndex) {
|
270
|
+
data.pop();
|
271
|
+
} else {
|
272
|
+
splice.call(data, index, 1);
|
273
|
+
}
|
274
|
+
--this.size;
|
275
|
+
return true;
|
276
|
+
}
|
277
|
+
function listCacheGet(key) {
|
278
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
279
|
+
return index < 0 ? void 0 : data[index][1];
|
280
|
+
}
|
281
|
+
function listCacheHas(key) {
|
282
|
+
return assocIndexOf(this.__data__, key) > -1;
|
283
|
+
}
|
284
|
+
function listCacheSet(key, value) {
|
285
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
286
|
+
if (index < 0) {
|
287
|
+
++this.size;
|
288
|
+
data.push([key, value]);
|
289
|
+
} else {
|
290
|
+
data[index][1] = value;
|
291
|
+
}
|
292
|
+
return this;
|
293
|
+
}
|
294
|
+
ListCache.prototype.clear = listCacheClear;
|
295
|
+
ListCache.prototype["delete"] = listCacheDelete;
|
296
|
+
ListCache.prototype.get = listCacheGet;
|
297
|
+
ListCache.prototype.has = listCacheHas;
|
298
|
+
ListCache.prototype.set = listCacheSet;
|
299
|
+
function MapCache(entries) {
|
300
|
+
var index = -1, length2 = entries == null ? 0 : entries.length;
|
301
|
+
this.clear();
|
302
|
+
while (++index < length2) {
|
303
|
+
var entry = entries[index];
|
304
|
+
this.set(entry[0], entry[1]);
|
305
|
+
}
|
306
|
+
}
|
307
|
+
function mapCacheClear() {
|
308
|
+
this.size = 0;
|
309
|
+
this.__data__ = {
|
310
|
+
"hash": new Hash(),
|
311
|
+
"map": new (Map2 || ListCache)(),
|
312
|
+
"string": new Hash()
|
313
|
+
};
|
314
|
+
}
|
315
|
+
function mapCacheDelete(key) {
|
316
|
+
var result = getMapData(this, key)["delete"](key);
|
317
|
+
this.size -= result ? 1 : 0;
|
318
|
+
return result;
|
319
|
+
}
|
320
|
+
function mapCacheGet(key) {
|
321
|
+
return getMapData(this, key).get(key);
|
322
|
+
}
|
323
|
+
function mapCacheHas(key) {
|
324
|
+
return getMapData(this, key).has(key);
|
325
|
+
}
|
326
|
+
function mapCacheSet(key, value) {
|
327
|
+
var data = getMapData(this, key), size = data.size;
|
328
|
+
data.set(key, value);
|
329
|
+
this.size += data.size == size ? 0 : 1;
|
330
|
+
return this;
|
331
|
+
}
|
332
|
+
MapCache.prototype.clear = mapCacheClear;
|
333
|
+
MapCache.prototype["delete"] = mapCacheDelete;
|
334
|
+
MapCache.prototype.get = mapCacheGet;
|
335
|
+
MapCache.prototype.has = mapCacheHas;
|
336
|
+
MapCache.prototype.set = mapCacheSet;
|
337
|
+
function Stack(entries) {
|
338
|
+
var data = this.__data__ = new ListCache(entries);
|
339
|
+
this.size = data.size;
|
340
|
+
}
|
341
|
+
function stackClear() {
|
342
|
+
this.__data__ = new ListCache();
|
343
|
+
this.size = 0;
|
344
|
+
}
|
345
|
+
function stackDelete(key) {
|
346
|
+
var data = this.__data__, result = data["delete"](key);
|
347
|
+
this.size = data.size;
|
348
|
+
return result;
|
349
|
+
}
|
350
|
+
function stackGet(key) {
|
351
|
+
return this.__data__.get(key);
|
352
|
+
}
|
353
|
+
function stackHas(key) {
|
354
|
+
return this.__data__.has(key);
|
355
|
+
}
|
356
|
+
function stackSet(key, value) {
|
357
|
+
var data = this.__data__;
|
358
|
+
if (data instanceof ListCache) {
|
359
|
+
var pairs = data.__data__;
|
360
|
+
if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
361
|
+
pairs.push([key, value]);
|
362
|
+
this.size = ++data.size;
|
363
|
+
return this;
|
364
|
+
}
|
365
|
+
data = this.__data__ = new MapCache(pairs);
|
366
|
+
}
|
367
|
+
data.set(key, value);
|
368
|
+
this.size = data.size;
|
369
|
+
return this;
|
370
|
+
}
|
371
|
+
Stack.prototype.clear = stackClear;
|
372
|
+
Stack.prototype["delete"] = stackDelete;
|
373
|
+
Stack.prototype.get = stackGet;
|
374
|
+
Stack.prototype.has = stackHas;
|
375
|
+
Stack.prototype.set = stackSet;
|
376
|
+
function arrayLikeKeys(value, inherited) {
|
377
|
+
var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length2 = result.length;
|
378
|
+
for (var key in value) {
|
379
|
+
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
380
|
+
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
381
|
+
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
382
|
+
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
|
383
|
+
isIndex(key, length2)))) {
|
384
|
+
result.push(key);
|
385
|
+
}
|
386
|
+
}
|
387
|
+
return result;
|
388
|
+
}
|
389
|
+
function assignMergeValue(object, key, value) {
|
390
|
+
if (value !== void 0 && !eq(object[key], value) || value === void 0 && !(key in object)) {
|
391
|
+
baseAssignValue(object, key, value);
|
392
|
+
}
|
393
|
+
}
|
394
|
+
function assignValue(object, key, value) {
|
395
|
+
var objValue = object[key];
|
396
|
+
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
|
397
|
+
baseAssignValue(object, key, value);
|
398
|
+
}
|
399
|
+
}
|
400
|
+
function assocIndexOf(array, key) {
|
401
|
+
var length2 = array.length;
|
402
|
+
while (length2--) {
|
403
|
+
if (eq(array[length2][0], key)) {
|
404
|
+
return length2;
|
405
|
+
}
|
406
|
+
}
|
407
|
+
return -1;
|
408
|
+
}
|
409
|
+
function baseAssignValue(object, key, value) {
|
410
|
+
if (key == "__proto__" && defineProperty) {
|
411
|
+
defineProperty(object, key, {
|
412
|
+
"configurable": true,
|
413
|
+
"enumerable": true,
|
414
|
+
"value": value,
|
415
|
+
"writable": true
|
416
|
+
});
|
417
|
+
} else {
|
418
|
+
object[key] = value;
|
419
|
+
}
|
420
|
+
}
|
421
|
+
var baseFor = createBaseFor();
|
422
|
+
function baseGetTag(value) {
|
423
|
+
if (value == null) {
|
424
|
+
return value === void 0 ? undefinedTag : nullTag;
|
425
|
+
}
|
426
|
+
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
427
|
+
}
|
428
|
+
function baseIsArguments(value) {
|
429
|
+
return isObjectLike(value) && baseGetTag(value) == argsTag;
|
430
|
+
}
|
431
|
+
function baseIsNative(value) {
|
432
|
+
if (!isObject(value) || isMasked(value)) {
|
433
|
+
return false;
|
434
|
+
}
|
435
|
+
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
436
|
+
return pattern.test(toSource(value));
|
437
|
+
}
|
438
|
+
function baseIsTypedArray(value) {
|
439
|
+
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
440
|
+
}
|
441
|
+
function baseKeysIn(object) {
|
442
|
+
if (!isObject(object)) {
|
443
|
+
return nativeKeysIn(object);
|
444
|
+
}
|
445
|
+
var isProto = isPrototype(object), result = [];
|
446
|
+
for (var key in object) {
|
447
|
+
if (!(key == "constructor" && (isProto || !hasOwnProperty.call(object, key)))) {
|
448
|
+
result.push(key);
|
449
|
+
}
|
450
|
+
}
|
451
|
+
return result;
|
452
|
+
}
|
453
|
+
function baseMerge(object, source, srcIndex, customizer, stack) {
|
454
|
+
if (object === source) {
|
455
|
+
return;
|
456
|
+
}
|
457
|
+
baseFor(source, function(srcValue, key) {
|
458
|
+
stack || (stack = new Stack());
|
459
|
+
if (isObject(srcValue)) {
|
460
|
+
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
461
|
+
} else {
|
462
|
+
var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
|
463
|
+
if (newValue === void 0) {
|
464
|
+
newValue = srcValue;
|
465
|
+
}
|
466
|
+
assignMergeValue(object, key, newValue);
|
467
|
+
}
|
468
|
+
}, keysIn);
|
469
|
+
}
|
470
|
+
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
|
471
|
+
var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
|
472
|
+
if (stacked) {
|
473
|
+
assignMergeValue(object, key, stacked);
|
474
|
+
return;
|
475
|
+
}
|
476
|
+
var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
|
477
|
+
var isCommon = newValue === void 0;
|
478
|
+
if (isCommon) {
|
479
|
+
var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
|
480
|
+
newValue = srcValue;
|
481
|
+
if (isArr || isBuff || isTyped) {
|
482
|
+
if (isArray(objValue)) {
|
483
|
+
newValue = objValue;
|
484
|
+
} else if (isArrayLikeObject(objValue)) {
|
485
|
+
newValue = copyArray(objValue);
|
486
|
+
} else if (isBuff) {
|
487
|
+
isCommon = false;
|
488
|
+
newValue = cloneBuffer(srcValue, true);
|
489
|
+
} else if (isTyped) {
|
490
|
+
isCommon = false;
|
491
|
+
newValue = cloneTypedArray(srcValue, true);
|
492
|
+
} else {
|
493
|
+
newValue = [];
|
494
|
+
}
|
495
|
+
} else if (isPlainObject(srcValue) || isArguments(srcValue)) {
|
496
|
+
newValue = objValue;
|
497
|
+
if (isArguments(objValue)) {
|
498
|
+
newValue = toPlainObject(objValue);
|
499
|
+
} else if (!isObject(objValue) || isFunction(objValue)) {
|
500
|
+
newValue = initCloneObject(srcValue);
|
501
|
+
}
|
502
|
+
} else {
|
503
|
+
isCommon = false;
|
504
|
+
}
|
505
|
+
}
|
506
|
+
if (isCommon) {
|
507
|
+
stack.set(srcValue, newValue);
|
508
|
+
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
|
509
|
+
stack["delete"](srcValue);
|
510
|
+
}
|
511
|
+
assignMergeValue(object, key, newValue);
|
512
|
+
}
|
513
|
+
function baseRest(func, start) {
|
514
|
+
return setToString(overRest(func, start, identity), func + "");
|
515
|
+
}
|
516
|
+
var baseSetToString = !defineProperty ? identity : function(func, string) {
|
517
|
+
return defineProperty(func, "toString", {
|
518
|
+
"configurable": true,
|
519
|
+
"enumerable": false,
|
520
|
+
"value": constant(string),
|
521
|
+
"writable": true
|
522
|
+
});
|
523
|
+
};
|
524
|
+
function cloneBuffer(buffer, isDeep) {
|
525
|
+
if (isDeep) {
|
526
|
+
return buffer.slice();
|
527
|
+
}
|
528
|
+
var length2 = buffer.length, result = allocUnsafe ? allocUnsafe(length2) : new buffer.constructor(length2);
|
529
|
+
buffer.copy(result);
|
530
|
+
return result;
|
531
|
+
}
|
532
|
+
function cloneArrayBuffer(arrayBuffer) {
|
533
|
+
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
534
|
+
new Uint8Array2(result).set(new Uint8Array2(arrayBuffer));
|
535
|
+
return result;
|
536
|
+
}
|
537
|
+
function cloneTypedArray(typedArray, isDeep) {
|
538
|
+
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
539
|
+
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
540
|
+
}
|
541
|
+
function copyArray(source, array) {
|
542
|
+
var index = -1, length2 = source.length;
|
543
|
+
array || (array = Array(length2));
|
544
|
+
while (++index < length2) {
|
545
|
+
array[index] = source[index];
|
546
|
+
}
|
547
|
+
return array;
|
548
|
+
}
|
549
|
+
function copyObject(source, props, object, customizer) {
|
550
|
+
var isNew = !object;
|
551
|
+
object || (object = {});
|
552
|
+
var index = -1, length2 = props.length;
|
553
|
+
while (++index < length2) {
|
554
|
+
var key = props[index];
|
555
|
+
var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
|
556
|
+
if (newValue === void 0) {
|
557
|
+
newValue = source[key];
|
558
|
+
}
|
559
|
+
if (isNew) {
|
560
|
+
baseAssignValue(object, key, newValue);
|
561
|
+
} else {
|
562
|
+
assignValue(object, key, newValue);
|
563
|
+
}
|
564
|
+
}
|
565
|
+
return object;
|
566
|
+
}
|
567
|
+
function createAssigner(assigner) {
|
568
|
+
return baseRest(function(object, sources) {
|
569
|
+
var index = -1, length2 = sources.length, customizer = length2 > 1 ? sources[length2 - 1] : void 0, guard = length2 > 2 ? sources[2] : void 0;
|
570
|
+
customizer = assigner.length > 3 && typeof customizer == "function" ? (length2--, customizer) : void 0;
|
571
|
+
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
572
|
+
customizer = length2 < 3 ? void 0 : customizer;
|
573
|
+
length2 = 1;
|
574
|
+
}
|
575
|
+
object = Object(object);
|
576
|
+
while (++index < length2) {
|
577
|
+
var source = sources[index];
|
578
|
+
if (source) {
|
579
|
+
assigner(object, source, index, customizer);
|
580
|
+
}
|
581
|
+
}
|
582
|
+
return object;
|
583
|
+
});
|
584
|
+
}
|
585
|
+
function createBaseFor(fromRight) {
|
586
|
+
return function(object, iteratee, keysFunc) {
|
587
|
+
var index = -1, iterable = Object(object), props = keysFunc(object), length2 = props.length;
|
588
|
+
while (length2--) {
|
589
|
+
var key = props[fromRight ? length2 : ++index];
|
590
|
+
if (iteratee(iterable[key], key, iterable) === false) {
|
591
|
+
break;
|
592
|
+
}
|
593
|
+
}
|
594
|
+
return object;
|
595
|
+
};
|
596
|
+
}
|
597
|
+
function getMapData(map, key) {
|
598
|
+
var data = map.__data__;
|
599
|
+
return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
|
600
|
+
}
|
601
|
+
function getNative(object, key) {
|
602
|
+
var value = getValue(object, key);
|
603
|
+
return baseIsNative(value) ? value : void 0;
|
604
|
+
}
|
605
|
+
function getRawTag(value) {
|
606
|
+
var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
|
607
|
+
try {
|
608
|
+
value[symToStringTag] = void 0;
|
609
|
+
var unmasked = true;
|
610
|
+
} catch (e) {
|
611
|
+
}
|
612
|
+
var result = nativeObjectToString.call(value);
|
613
|
+
if (unmasked) {
|
614
|
+
if (isOwn) {
|
615
|
+
value[symToStringTag] = tag;
|
616
|
+
} else {
|
617
|
+
delete value[symToStringTag];
|
618
|
+
}
|
619
|
+
}
|
620
|
+
return result;
|
621
|
+
}
|
622
|
+
function initCloneObject(object) {
|
623
|
+
return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
|
624
|
+
}
|
625
|
+
function isIndex(value, length2) {
|
626
|
+
var type = typeof value;
|
627
|
+
length2 = length2 == null ? MAX_SAFE_INTEGER : length2;
|
628
|
+
return !!length2 && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length2);
|
629
|
+
}
|
630
|
+
function isIterateeCall(value, index, object) {
|
631
|
+
if (!isObject(object)) {
|
632
|
+
return false;
|
633
|
+
}
|
634
|
+
var type = typeof index;
|
635
|
+
if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
|
636
|
+
return eq(object[index], value);
|
637
|
+
}
|
638
|
+
return false;
|
639
|
+
}
|
640
|
+
function isKeyable(value) {
|
641
|
+
var type = typeof value;
|
642
|
+
return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
|
643
|
+
}
|
644
|
+
function isMasked(func) {
|
645
|
+
return !!maskSrcKey && maskSrcKey in func;
|
646
|
+
}
|
647
|
+
function isPrototype(value) {
|
648
|
+
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
|
649
|
+
return value === proto;
|
650
|
+
}
|
651
|
+
function nativeKeysIn(object) {
|
652
|
+
var result = [];
|
653
|
+
if (object != null) {
|
654
|
+
for (var key in Object(object)) {
|
655
|
+
result.push(key);
|
656
|
+
}
|
657
|
+
}
|
658
|
+
return result;
|
659
|
+
}
|
660
|
+
function objectToString(value) {
|
661
|
+
return nativeObjectToString.call(value);
|
662
|
+
}
|
663
|
+
function overRest(func, start, transform) {
|
664
|
+
start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
|
665
|
+
return function() {
|
666
|
+
var args = arguments, index = -1, length2 = nativeMax(args.length - start, 0), array = Array(length2);
|
667
|
+
while (++index < length2) {
|
668
|
+
array[index] = args[start + index];
|
669
|
+
}
|
670
|
+
index = -1;
|
671
|
+
var otherArgs = Array(start + 1);
|
672
|
+
while (++index < start) {
|
673
|
+
otherArgs[index] = args[index];
|
674
|
+
}
|
675
|
+
otherArgs[start] = transform(array);
|
676
|
+
return apply(func, this, otherArgs);
|
677
|
+
};
|
678
|
+
}
|
679
|
+
function safeGet(object, key) {
|
680
|
+
if (key === "constructor" && typeof object[key] === "function") {
|
681
|
+
return;
|
682
|
+
}
|
683
|
+
if (key == "__proto__") {
|
684
|
+
return;
|
685
|
+
}
|
686
|
+
return object[key];
|
687
|
+
}
|
688
|
+
var setToString = shortOut(baseSetToString);
|
689
|
+
function shortOut(func) {
|
690
|
+
var count = 0, lastCalled = 0;
|
691
|
+
return function() {
|
692
|
+
var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
|
693
|
+
lastCalled = stamp;
|
694
|
+
if (remaining > 0) {
|
695
|
+
if (++count >= HOT_COUNT) {
|
696
|
+
return arguments[0];
|
697
|
+
}
|
698
|
+
} else {
|
699
|
+
count = 0;
|
700
|
+
}
|
701
|
+
return func.apply(void 0, arguments);
|
702
|
+
};
|
703
|
+
}
|
704
|
+
function toSource(func) {
|
705
|
+
if (func != null) {
|
706
|
+
try {
|
707
|
+
return funcToString.call(func);
|
708
|
+
} catch (e) {
|
709
|
+
}
|
710
|
+
try {
|
711
|
+
return func + "";
|
712
|
+
} catch (e) {
|
713
|
+
}
|
714
|
+
}
|
715
|
+
return "";
|
716
|
+
}
|
717
|
+
function eq(value, other) {
|
718
|
+
return value === other || value !== value && other !== other;
|
719
|
+
}
|
720
|
+
var isArguments = baseIsArguments(/* @__PURE__ */ function() {
|
721
|
+
return arguments;
|
722
|
+
}()) ? baseIsArguments : function(value) {
|
723
|
+
return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
|
724
|
+
};
|
725
|
+
var isArray = Array.isArray;
|
726
|
+
function isArrayLike(value) {
|
727
|
+
return value != null && isLength(value.length) && !isFunction(value);
|
728
|
+
}
|
729
|
+
function isArrayLikeObject(value) {
|
730
|
+
return isObjectLike(value) && isArrayLike(value);
|
731
|
+
}
|
732
|
+
var isBuffer = nativeIsBuffer || stubFalse;
|
733
|
+
function isFunction(value) {
|
734
|
+
if (!isObject(value)) {
|
735
|
+
return false;
|
736
|
+
}
|
737
|
+
var tag = baseGetTag(value);
|
738
|
+
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
739
|
+
}
|
740
|
+
function isLength(value) {
|
741
|
+
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
742
|
+
}
|
743
|
+
function isObject(value) {
|
744
|
+
var type = typeof value;
|
745
|
+
return value != null && (type == "object" || type == "function");
|
746
|
+
}
|
747
|
+
function isObjectLike(value) {
|
748
|
+
return value != null && typeof value == "object";
|
749
|
+
}
|
750
|
+
function isPlainObject(value) {
|
751
|
+
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
|
752
|
+
return false;
|
753
|
+
}
|
754
|
+
var proto = getPrototype(value);
|
755
|
+
if (proto === null) {
|
756
|
+
return true;
|
757
|
+
}
|
758
|
+
var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
759
|
+
return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
|
760
|
+
}
|
761
|
+
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
762
|
+
function toPlainObject(value) {
|
763
|
+
return copyObject(value, keysIn(value));
|
764
|
+
}
|
765
|
+
function keysIn(object) {
|
766
|
+
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
767
|
+
}
|
768
|
+
var merge2 = createAssigner(function(object, source, srcIndex) {
|
769
|
+
baseMerge(object, source, srcIndex);
|
770
|
+
});
|
771
|
+
function constant(value) {
|
772
|
+
return function() {
|
773
|
+
return value;
|
774
|
+
};
|
775
|
+
}
|
776
|
+
function identity(value) {
|
777
|
+
return value;
|
778
|
+
}
|
779
|
+
function stubFalse() {
|
780
|
+
return false;
|
781
|
+
}
|
782
|
+
module.exports = merge2;
|
783
|
+
}
|
784
|
+
});
|
785
|
+
|
64
786
|
// node_modules/classnames/index.js
|
65
787
|
var require_classnames = __commonJS({
|
66
788
|
"node_modules/classnames/index.js"(exports, module) {
|
@@ -4934,7 +5656,7 @@ var unitlessKeys = {
|
|
4934
5656
|
var f = "undefined" != typeof process && void 0 !== process.env && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || "data-styled";
|
4935
5657
|
var m = "active";
|
4936
5658
|
var y = "data-styled-version";
|
4937
|
-
var v = "6.1.
|
5659
|
+
var v = "6.1.13";
|
4938
5660
|
var g = "/*!sc*/\n";
|
4939
5661
|
var S = "undefined" != typeof window && "HTMLElement" in window;
|
4940
5662
|
var w = Boolean("boolean" == typeof SC_DISABLE_SPEEDY ? SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== process.env && void 0 !== process.env.REACT_APP_SC_DISABLE_SPEEDY && "" !== process.env.REACT_APP_SC_DISABLE_SPEEDY ? "false" !== process.env.REACT_APP_SC_DISABLE_SPEEDY && process.env.REACT_APP_SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== process.env && void 0 !== process.env.SC_DISABLE_SPEEDY && "" !== process.env.SC_DISABLE_SPEEDY ? "false" !== process.env.SC_DISABLE_SPEEDY && process.env.SC_DISABLE_SPEEDY : true);
|
@@ -5614,6 +6336,146 @@ var vt = function() {
|
|
5614
6336
|
var St = "__sc-".concat(f, "__");
|
5615
6337
|
"undefined" != typeof window && (window[St] || (window[St] = 0), 1 === window[St] && console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://s-c.sh/2BAXzed for more info."), window[St] += 1);
|
5616
6338
|
|
6339
|
+
// src/context/embed.tsx
|
6340
|
+
var import_lodash = __toESM(require_lodash());
|
6341
|
+
|
6342
|
+
// node_modules/@stripe/stripe-js/dist/index.mjs
|
6343
|
+
var V3_URL = "https://js.stripe.com/v3";
|
6344
|
+
var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
|
6345
|
+
var EXISTING_SCRIPT_MESSAGE = "loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";
|
6346
|
+
var findScript = function findScript2() {
|
6347
|
+
var scripts = document.querySelectorAll('script[src^="'.concat(V3_URL, '"]'));
|
6348
|
+
for (var i2 = 0; i2 < scripts.length; i2++) {
|
6349
|
+
var script = scripts[i2];
|
6350
|
+
if (!V3_URL_REGEX.test(script.src)) {
|
6351
|
+
continue;
|
6352
|
+
}
|
6353
|
+
return script;
|
6354
|
+
}
|
6355
|
+
return null;
|
6356
|
+
};
|
6357
|
+
var injectScript = function injectScript2(params) {
|
6358
|
+
var queryString = params && !params.advancedFraudSignals ? "?advancedFraudSignals=false" : "";
|
6359
|
+
var script = document.createElement("script");
|
6360
|
+
script.src = "".concat(V3_URL).concat(queryString);
|
6361
|
+
var headOrBody = document.head || document.body;
|
6362
|
+
if (!headOrBody) {
|
6363
|
+
throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");
|
6364
|
+
}
|
6365
|
+
headOrBody.appendChild(script);
|
6366
|
+
return script;
|
6367
|
+
};
|
6368
|
+
var registerWrapper = function registerWrapper2(stripe, startTime) {
|
6369
|
+
if (!stripe || !stripe._registerWrapper) {
|
6370
|
+
return;
|
6371
|
+
}
|
6372
|
+
stripe._registerWrapper({
|
6373
|
+
name: "stripe-js",
|
6374
|
+
version: "4.3.0",
|
6375
|
+
startTime
|
6376
|
+
});
|
6377
|
+
};
|
6378
|
+
var stripePromise = null;
|
6379
|
+
var onErrorListener = null;
|
6380
|
+
var onLoadListener = null;
|
6381
|
+
var onError = function onError2(reject) {
|
6382
|
+
return function() {
|
6383
|
+
reject(new Error("Failed to load Stripe.js"));
|
6384
|
+
};
|
6385
|
+
};
|
6386
|
+
var onLoad = function onLoad2(resolve, reject) {
|
6387
|
+
return function() {
|
6388
|
+
if (window.Stripe) {
|
6389
|
+
resolve(window.Stripe);
|
6390
|
+
} else {
|
6391
|
+
reject(new Error("Stripe.js not available"));
|
6392
|
+
}
|
6393
|
+
};
|
6394
|
+
};
|
6395
|
+
var loadScript = function loadScript2(params) {
|
6396
|
+
if (stripePromise !== null) {
|
6397
|
+
return stripePromise;
|
6398
|
+
}
|
6399
|
+
stripePromise = new Promise(function(resolve, reject) {
|
6400
|
+
if (typeof window === "undefined" || typeof document === "undefined") {
|
6401
|
+
resolve(null);
|
6402
|
+
return;
|
6403
|
+
}
|
6404
|
+
if (window.Stripe && params) {
|
6405
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
6406
|
+
}
|
6407
|
+
if (window.Stripe) {
|
6408
|
+
resolve(window.Stripe);
|
6409
|
+
return;
|
6410
|
+
}
|
6411
|
+
try {
|
6412
|
+
var script = findScript();
|
6413
|
+
if (script && params) {
|
6414
|
+
console.warn(EXISTING_SCRIPT_MESSAGE);
|
6415
|
+
} else if (!script) {
|
6416
|
+
script = injectScript(params);
|
6417
|
+
} else if (script && onLoadListener !== null && onErrorListener !== null) {
|
6418
|
+
var _script$parentNode;
|
6419
|
+
script.removeEventListener("load", onLoadListener);
|
6420
|
+
script.removeEventListener("error", onErrorListener);
|
6421
|
+
(_script$parentNode = script.parentNode) === null || _script$parentNode === void 0 ? void 0 : _script$parentNode.removeChild(script);
|
6422
|
+
script = injectScript(params);
|
6423
|
+
}
|
6424
|
+
onLoadListener = onLoad(resolve, reject);
|
6425
|
+
onErrorListener = onError(reject);
|
6426
|
+
script.addEventListener("load", onLoadListener);
|
6427
|
+
script.addEventListener("error", onErrorListener);
|
6428
|
+
} catch (error) {
|
6429
|
+
reject(error);
|
6430
|
+
return;
|
6431
|
+
}
|
6432
|
+
});
|
6433
|
+
return stripePromise["catch"](function(error) {
|
6434
|
+
stripePromise = null;
|
6435
|
+
return Promise.reject(error);
|
6436
|
+
});
|
6437
|
+
};
|
6438
|
+
var initStripe = function initStripe2(maybeStripe, args, startTime) {
|
6439
|
+
if (maybeStripe === null) {
|
6440
|
+
return null;
|
6441
|
+
}
|
6442
|
+
var stripe = maybeStripe.apply(void 0, args);
|
6443
|
+
registerWrapper(stripe, startTime);
|
6444
|
+
return stripe;
|
6445
|
+
};
|
6446
|
+
var stripePromise$1;
|
6447
|
+
var loadCalled = false;
|
6448
|
+
var getStripePromise = function getStripePromise2() {
|
6449
|
+
if (stripePromise$1) {
|
6450
|
+
return stripePromise$1;
|
6451
|
+
}
|
6452
|
+
stripePromise$1 = loadScript(null)["catch"](function(error) {
|
6453
|
+
stripePromise$1 = null;
|
6454
|
+
return Promise.reject(error);
|
6455
|
+
});
|
6456
|
+
return stripePromise$1;
|
6457
|
+
};
|
6458
|
+
Promise.resolve().then(function() {
|
6459
|
+
return getStripePromise();
|
6460
|
+
})["catch"](function(error) {
|
6461
|
+
if (!loadCalled) {
|
6462
|
+
console.warn(error);
|
6463
|
+
}
|
6464
|
+
});
|
6465
|
+
var loadStripe = function loadStripe2() {
|
6466
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
6467
|
+
args[_key] = arguments[_key];
|
6468
|
+
}
|
6469
|
+
loadCalled = true;
|
6470
|
+
var startTime = Date.now();
|
6471
|
+
return getStripePromise().then(function(maybeStripe) {
|
6472
|
+
return initStripe(maybeStripe, args, startTime);
|
6473
|
+
});
|
6474
|
+
};
|
6475
|
+
|
6476
|
+
// src/context/embed.tsx
|
6477
|
+
import { Elements } from "@stripe/react-stripe-js";
|
6478
|
+
|
5617
6479
|
// src/api/runtime.ts
|
5618
6480
|
var BASE_PATH = "https://api.schematichq.com".replace(/\/+$/, "");
|
5619
6481
|
var Configuration = class {
|
@@ -5930,6 +6792,30 @@ function BillingProductDetailResponseDataFromJSONTyped(json, ignoreDiscriminator
|
|
5930
6792
|
};
|
5931
6793
|
}
|
5932
6794
|
|
6795
|
+
// src/api/models/BillingProductForSubscriptionResponseData.ts
|
6796
|
+
function BillingProductForSubscriptionResponseDataFromJSON(json) {
|
6797
|
+
return BillingProductForSubscriptionResponseDataFromJSONTyped(json, false);
|
6798
|
+
}
|
6799
|
+
function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
6800
|
+
if (json == null) {
|
6801
|
+
return json;
|
6802
|
+
}
|
6803
|
+
return {
|
6804
|
+
accountId: json["account_id"],
|
6805
|
+
createdAt: new Date(json["created_at"]),
|
6806
|
+
currency: json["currency"],
|
6807
|
+
environmentId: json["environment_id"],
|
6808
|
+
externalId: json["external_id"],
|
6809
|
+
id: json["id"],
|
6810
|
+
interval: json["interval"] == null ? void 0 : json["interval"],
|
6811
|
+
name: json["name"],
|
6812
|
+
price: json["price"],
|
6813
|
+
quantity: json["quantity"],
|
6814
|
+
subscriptionId: json["subscription_id"],
|
6815
|
+
updatedAt: new Date(json["updated_at"])
|
6816
|
+
};
|
6817
|
+
}
|
6818
|
+
|
5933
6819
|
// src/api/models/BillingSubscriptionResponseData.ts
|
5934
6820
|
function BillingSubscriptionResponseDataFromJSON(json) {
|
5935
6821
|
return BillingSubscriptionResponseDataFromJSONTyped(json, false);
|
@@ -5952,7 +6838,6 @@ function ChangeSubscriptionRequestBodyToJSON(value) {
|
|
5952
6838
|
return value;
|
5953
6839
|
}
|
5954
6840
|
return {
|
5955
|
-
action: value["action"],
|
5956
6841
|
new_plan_id: value["newPlanId"],
|
5957
6842
|
new_price_id: value["newPriceId"]
|
5958
6843
|
};
|
@@ -6364,40 +7249,115 @@ function CompanyPlanDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6364
7249
|
};
|
6365
7250
|
}
|
6366
7251
|
|
6367
|
-
// src/api/models/
|
6368
|
-
function
|
6369
|
-
return
|
7252
|
+
// src/api/models/InvoiceResponseData.ts
|
7253
|
+
function InvoiceResponseDataFromJSON(json) {
|
7254
|
+
return InvoiceResponseDataFromJSONTyped(json, false);
|
6370
7255
|
}
|
6371
|
-
function
|
7256
|
+
function InvoiceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
6372
7257
|
if (json == null) {
|
6373
7258
|
return json;
|
6374
7259
|
}
|
6375
7260
|
return {
|
6376
|
-
|
7261
|
+
amountDue: json["amount_due"],
|
7262
|
+
amountPaid: json["amount_paid"],
|
7263
|
+
amountRemaining: json["amount_remaining"],
|
7264
|
+
collectionMethod: json["collection_method"],
|
7265
|
+
companyId: json["company_id"] == null ? void 0 : json["company_id"],
|
6377
7266
|
createdAt: new Date(json["created_at"]),
|
7267
|
+
currency: json["currency"],
|
7268
|
+
customerExternalId: json["customer_external_id"],
|
7269
|
+
dueDate: json["due_date"] == null ? void 0 : new Date(json["due_date"]),
|
7270
|
+
environmentId: json["environment_id"],
|
7271
|
+
externalId: json["external_id"],
|
6378
7272
|
id: json["id"],
|
6379
|
-
|
6380
|
-
|
6381
|
-
type: json["type"],
|
7273
|
+
subscriptionExternalId: json["subscription_external_id"] == null ? void 0 : json["subscription_external_id"],
|
7274
|
+
subtotal: json["subtotal"],
|
6382
7275
|
updatedAt: new Date(json["updated_at"])
|
6383
7276
|
};
|
6384
7277
|
}
|
6385
7278
|
|
6386
|
-
// src/api/models/
|
6387
|
-
function
|
6388
|
-
return
|
7279
|
+
// src/api/models/PaymentMethodResponseData.ts
|
7280
|
+
function PaymentMethodResponseDataFromJSON(json) {
|
7281
|
+
return PaymentMethodResponseDataFromJSONTyped(json, false);
|
6389
7282
|
}
|
6390
|
-
function
|
7283
|
+
function PaymentMethodResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
6391
7284
|
if (json == null) {
|
6392
7285
|
return json;
|
6393
7286
|
}
|
6394
7287
|
return {
|
6395
|
-
|
6396
|
-
|
6397
|
-
|
6398
|
-
|
6399
|
-
|
6400
|
-
|
7288
|
+
cardBrand: json["card_brand"] == null ? void 0 : json["card_brand"],
|
7289
|
+
cardExpMonth: json["card_exp_month"] == null ? void 0 : json["card_exp_month"],
|
7290
|
+
cardExpYear: json["card_exp_year"] == null ? void 0 : json["card_exp_year"],
|
7291
|
+
cardLast4: json["card_last4"] == null ? void 0 : json["card_last4"],
|
7292
|
+
companyId: json["company_id"] == null ? void 0 : json["company_id"],
|
7293
|
+
createdAt: new Date(json["created_at"]),
|
7294
|
+
customerExternalId: json["customer_external_id"],
|
7295
|
+
environmentId: json["environment_id"],
|
7296
|
+
externalId: json["external_id"],
|
7297
|
+
id: json["id"],
|
7298
|
+
invoiceExternalId: json["invoice_external_id"] == null ? void 0 : json["invoice_external_id"],
|
7299
|
+
paymentMethodType: json["payment_method_type"],
|
7300
|
+
subscriptionExternalId: json["subscription_external_id"] == null ? void 0 : json["subscription_external_id"],
|
7301
|
+
updatedAt: new Date(json["updated_at"])
|
7302
|
+
};
|
7303
|
+
}
|
7304
|
+
|
7305
|
+
// src/api/models/CompanySubscriptionResponseData.ts
|
7306
|
+
function CompanySubscriptionResponseDataFromJSON(json) {
|
7307
|
+
return CompanySubscriptionResponseDataFromJSONTyped(json, false);
|
7308
|
+
}
|
7309
|
+
function CompanySubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
7310
|
+
if (json == null) {
|
7311
|
+
return json;
|
7312
|
+
}
|
7313
|
+
return {
|
7314
|
+
customerExternalId: json["customer_external_id"],
|
7315
|
+
expiredAt: json["expired_at"] == null ? void 0 : new Date(json["expired_at"]),
|
7316
|
+
interval: json["interval"],
|
7317
|
+
latestInvoice: json["latest_invoice"] == null ? void 0 : InvoiceResponseDataFromJSON(json["latest_invoice"]),
|
7318
|
+
paymentMethod: json["payment_method"] == null ? void 0 : PaymentMethodResponseDataFromJSON(json["payment_method"]),
|
7319
|
+
products: json["products"].map(
|
7320
|
+
BillingProductForSubscriptionResponseDataFromJSON
|
7321
|
+
),
|
7322
|
+
subscriptionExternalId: json["subscription_external_id"],
|
7323
|
+
totalPrice: json["total_price"]
|
7324
|
+
};
|
7325
|
+
}
|
7326
|
+
|
7327
|
+
// src/api/models/ComponentResponseData.ts
|
7328
|
+
function ComponentResponseDataFromJSON(json) {
|
7329
|
+
return ComponentResponseDataFromJSONTyped(json, false);
|
7330
|
+
}
|
7331
|
+
function ComponentResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
7332
|
+
if (json == null) {
|
7333
|
+
return json;
|
7334
|
+
}
|
7335
|
+
return {
|
7336
|
+
ast: json["ast"] == null ? void 0 : json["ast"],
|
7337
|
+
createdAt: new Date(json["created_at"]),
|
7338
|
+
id: json["id"],
|
7339
|
+
name: json["name"],
|
7340
|
+
state: json["state"],
|
7341
|
+
type: json["type"],
|
7342
|
+
updatedAt: new Date(json["updated_at"])
|
7343
|
+
};
|
7344
|
+
}
|
7345
|
+
|
7346
|
+
// src/api/models/FeatureUsageResponseData.ts
|
7347
|
+
function FeatureUsageResponseDataFromJSON(json) {
|
7348
|
+
return FeatureUsageResponseDataFromJSONTyped(json, false);
|
7349
|
+
}
|
7350
|
+
function FeatureUsageResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
7351
|
+
if (json == null) {
|
7352
|
+
return json;
|
7353
|
+
}
|
7354
|
+
return {
|
7355
|
+
access: json["access"],
|
7356
|
+
allocation: json["allocation"] == null ? void 0 : json["allocation"],
|
7357
|
+
allocationType: json["allocation_type"],
|
7358
|
+
entitlementId: json["entitlement_id"],
|
7359
|
+
entitlementType: json["entitlement_type"],
|
7360
|
+
feature: json["feature"] == null ? void 0 : FeatureDetailResponseDataFromJSON(json["feature"]),
|
6401
7361
|
period: json["period"] == null ? void 0 : json["period"],
|
6402
7362
|
plan: json["plan"] == null ? void 0 : PlanResponseDataFromJSON(json["plan"]),
|
6403
7363
|
usage: json["usage"] == null ? void 0 : json["usage"]
|
@@ -6428,7 +7388,7 @@ function StripeEmbedInfoFromJSONTyped(json, ignoreDiscriminator) {
|
|
6428
7388
|
return json;
|
6429
7389
|
}
|
6430
7390
|
return {
|
6431
|
-
customerEkey: json["customer_ekey"],
|
7391
|
+
customerEkey: json["customer_ekey"] == null ? void 0 : json["customer_ekey"],
|
6432
7392
|
publishableKey: json["publishable_key"]
|
6433
7393
|
};
|
6434
7394
|
}
|
@@ -6448,7 +7408,9 @@ function ComponentHydrateResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6448
7408
|
company: json["company"] == null ? void 0 : CompanyDetailResponseDataFromJSON(json["company"]),
|
6449
7409
|
component: json["component"] == null ? void 0 : ComponentResponseDataFromJSON(json["component"]),
|
6450
7410
|
featureUsage: json["feature_usage"] == null ? void 0 : FeatureUsageDetailResponseDataFromJSON(json["feature_usage"]),
|
6451
|
-
stripeEmbed: json["stripe_embed"] == null ? void 0 : StripeEmbedInfoFromJSON(json["stripe_embed"])
|
7411
|
+
stripeEmbed: json["stripe_embed"] == null ? void 0 : StripeEmbedInfoFromJSON(json["stripe_embed"]),
|
7412
|
+
subscription: json["subscription"] == null ? void 0 : CompanySubscriptionResponseDataFromJSON(json["subscription"]),
|
7413
|
+
upcomingInvoice: json["upcoming_invoice"] == null ? void 0 : InvoiceResponseDataFromJSON(json["upcoming_invoice"])
|
6452
7414
|
};
|
6453
7415
|
}
|
6454
7416
|
|
@@ -6649,11 +7611,9 @@ function parseEditorState(data) {
|
|
6649
7611
|
});
|
6650
7612
|
return arr;
|
6651
7613
|
}
|
6652
|
-
async function fetchComponent(id,
|
7614
|
+
async function fetchComponent(id, api) {
|
6653
7615
|
const settings = { ...defaultSettings };
|
6654
7616
|
const nodes = [];
|
6655
|
-
const config = new Configuration({ ...options, apiKey: accessToken });
|
6656
|
-
const api = new CheckoutApi(config);
|
6657
7617
|
const response = await api.hydrateComponent({ componentId: id });
|
6658
7618
|
const { data } = response;
|
6659
7619
|
if (data.component?.ast) {
|
@@ -6661,28 +7621,39 @@ async function fetchComponent(id, accessToken, options) {
|
|
6661
7621
|
const json = inflate_1(Uint8Array.from(Object.values(compressed)), {
|
6662
7622
|
to: "string"
|
6663
7623
|
});
|
6664
|
-
const ast = getEditorState(
|
7624
|
+
const ast = getEditorState(json);
|
6665
7625
|
if (ast) {
|
6666
7626
|
Object.assign(settings, ast.ROOT.props);
|
6667
7627
|
nodes.push(...parseEditorState(ast));
|
6668
7628
|
}
|
6669
7629
|
}
|
7630
|
+
let stripe = null;
|
7631
|
+
if (data.stripeEmbed?.publishableKey) {
|
7632
|
+
stripe = loadStripe(data.stripeEmbed.publishableKey);
|
7633
|
+
}
|
6670
7634
|
return {
|
6671
7635
|
data,
|
6672
7636
|
nodes,
|
6673
|
-
settings
|
7637
|
+
settings,
|
7638
|
+
stripe
|
6674
7639
|
};
|
6675
7640
|
}
|
6676
7641
|
var EmbedContext = createContext({
|
6677
|
-
|
7642
|
+
api: null,
|
7643
|
+
data: {
|
7644
|
+
activePlans: []
|
7645
|
+
},
|
6678
7646
|
nodes: [],
|
6679
7647
|
settings: { ...defaultSettings },
|
7648
|
+
stripe: null,
|
6680
7649
|
layout: "portal",
|
6681
7650
|
error: void 0,
|
6682
7651
|
setData: () => {
|
6683
7652
|
},
|
6684
7653
|
updateSettings: () => {
|
6685
7654
|
},
|
7655
|
+
setStripe: () => {
|
7656
|
+
},
|
6686
7657
|
setLayout: () => {
|
6687
7658
|
}
|
6688
7659
|
});
|
@@ -6695,15 +7666,21 @@ var EmbedProvider = ({
|
|
6695
7666
|
const styleRef = useRef(null);
|
6696
7667
|
const [state, setState] = useState(() => {
|
6697
7668
|
return {
|
6698
|
-
|
7669
|
+
api: null,
|
7670
|
+
data: {
|
7671
|
+
activePlans: []
|
7672
|
+
},
|
6699
7673
|
nodes: [],
|
6700
7674
|
settings: { ...defaultSettings },
|
7675
|
+
stripe: null,
|
6701
7676
|
layout: "portal",
|
6702
7677
|
error: void 0,
|
6703
7678
|
setData: () => {
|
6704
7679
|
},
|
6705
7680
|
updateSettings: () => {
|
6706
7681
|
},
|
7682
|
+
setStripe: () => {
|
7683
|
+
},
|
6707
7684
|
setLayout: () => {
|
6708
7685
|
}
|
6709
7686
|
};
|
@@ -6720,13 +7697,21 @@ var EmbedProvider = ({
|
|
6720
7697
|
styleRef.current = style;
|
6721
7698
|
}, []);
|
6722
7699
|
useEffect(() => {
|
6723
|
-
if (!
|
7700
|
+
if (!accessToken) {
|
7701
|
+
return;
|
7702
|
+
}
|
7703
|
+
const config = new Configuration({ ...apiConfig, apiKey: accessToken });
|
7704
|
+
const api = new CheckoutApi(config);
|
7705
|
+
setState((prev2) => ({ ...prev2, api }));
|
7706
|
+
}, [accessToken, apiConfig]);
|
7707
|
+
useEffect(() => {
|
7708
|
+
if (!id || !state.api) {
|
6724
7709
|
return;
|
6725
7710
|
}
|
6726
|
-
fetchComponent(id,
|
7711
|
+
fetchComponent(id, state.api).then(async (resolvedData) => {
|
6727
7712
|
setState((prev2) => ({ ...prev2, ...resolvedData }));
|
6728
7713
|
}).catch((error) => setState((prev2) => ({ ...prev2, error })));
|
6729
|
-
}, [id,
|
7714
|
+
}, [id, state.api]);
|
6730
7715
|
useEffect(() => {
|
6731
7716
|
const fontSet = /* @__PURE__ */ new Set([]);
|
6732
7717
|
Object.values(state.settings.theme.typography).forEach(({ fontFamily }) => {
|
@@ -6741,18 +7726,29 @@ var EmbedProvider = ({
|
|
6741
7726
|
}, [state.settings.theme.typography]);
|
6742
7727
|
const setData = useCallback(
|
6743
7728
|
(data) => {
|
6744
|
-
setState((prev2) =>
|
6745
|
-
...prev2
|
6746
|
-
|
6747
|
-
|
7729
|
+
setState((prev2) => {
|
7730
|
+
const updated = { ...prev2 };
|
7731
|
+
(0, import_lodash.default)(updated.data, data);
|
7732
|
+
return updated;
|
7733
|
+
});
|
6748
7734
|
},
|
6749
7735
|
[setState]
|
6750
7736
|
);
|
6751
7737
|
const updateSettings = useCallback(
|
6752
7738
|
(settings) => {
|
7739
|
+
setState((prev2) => {
|
7740
|
+
const updated = { ...prev2 };
|
7741
|
+
(0, import_lodash.default)(updated.settings, settings);
|
7742
|
+
return updated;
|
7743
|
+
});
|
7744
|
+
},
|
7745
|
+
[setState]
|
7746
|
+
);
|
7747
|
+
const setStripe = useCallback(
|
7748
|
+
(stripe) => {
|
6753
7749
|
setState((prev2) => ({
|
6754
7750
|
...prev2,
|
6755
|
-
|
7751
|
+
stripe
|
6756
7752
|
}));
|
6757
7753
|
},
|
6758
7754
|
[setState]
|
@@ -6766,20 +7762,64 @@ var EmbedProvider = ({
|
|
6766
7762
|
},
|
6767
7763
|
[setState]
|
6768
7764
|
);
|
7765
|
+
const renderChildren = () => {
|
7766
|
+
if (state.stripe) {
|
7767
|
+
return /* @__PURE__ */ jsx(
|
7768
|
+
Elements,
|
7769
|
+
{
|
7770
|
+
stripe: state.stripe,
|
7771
|
+
options: {
|
7772
|
+
appearance: {
|
7773
|
+
theme: "stripe",
|
7774
|
+
variables: {
|
7775
|
+
// Base
|
7776
|
+
spacingUnit: ".25rem",
|
7777
|
+
colorPrimary: "#0570de",
|
7778
|
+
colorBackground: "#FFFFFF",
|
7779
|
+
colorText: "#30313d",
|
7780
|
+
colorDanger: "#df1b41",
|
7781
|
+
fontFamily: "Public Sans, system-ui, sans-serif",
|
7782
|
+
borderRadius: ".5rem",
|
7783
|
+
// Layout
|
7784
|
+
gridRowSpacing: "1.5rem",
|
7785
|
+
gridColumnSpacing: "1.5rem"
|
7786
|
+
},
|
7787
|
+
rules: {
|
7788
|
+
".Label": {
|
7789
|
+
color: "#020202",
|
7790
|
+
fontWeight: "400",
|
7791
|
+
fontSize: "16px",
|
7792
|
+
marginBottom: "12px"
|
7793
|
+
}
|
7794
|
+
}
|
7795
|
+
},
|
7796
|
+
...state.data.stripeEmbed?.customerEkey ? {
|
7797
|
+
clientSecret: state.data.stripeEmbed.customerEkey
|
7798
|
+
} : { mode: "payment", currency: "usd", amount: 999999 }
|
7799
|
+
},
|
7800
|
+
children
|
7801
|
+
}
|
7802
|
+
);
|
7803
|
+
}
|
7804
|
+
return children;
|
7805
|
+
};
|
6769
7806
|
return /* @__PURE__ */ jsx(
|
6770
7807
|
EmbedContext.Provider,
|
6771
7808
|
{
|
6772
7809
|
value: {
|
7810
|
+
api: state.api,
|
6773
7811
|
data: state.data,
|
6774
7812
|
nodes: state.nodes,
|
6775
7813
|
settings: state.settings,
|
7814
|
+
stripe: state.stripe,
|
6776
7815
|
layout: state.layout,
|
6777
7816
|
error: state.error,
|
6778
7817
|
setData,
|
6779
7818
|
updateSettings,
|
7819
|
+
setStripe,
|
6780
7820
|
setLayout
|
6781
7821
|
},
|
6782
|
-
children: /* @__PURE__ */ jsx(ot, { theme: state.settings.theme, children })
|
7822
|
+
children: /* @__PURE__ */ jsx(ot, { theme: state.settings.theme, children: renderChildren() })
|
6783
7823
|
}
|
6784
7824
|
);
|
6785
7825
|
};
|
@@ -6814,11 +7854,11 @@ var require_browser_polyfill = __commonJS2({
|
|
6814
7854
|
"node_modules/cross-fetch/dist/browser-polyfill.js"(exports) {
|
6815
7855
|
(function(self2) {
|
6816
7856
|
var irrelevant = function(exports2) {
|
6817
|
-
var
|
7857
|
+
var global2 = typeof globalThis !== "undefined" && globalThis || typeof self2 !== "undefined" && self2 || typeof global2 !== "undefined" && global2;
|
6818
7858
|
var support = {
|
6819
|
-
searchParams: "URLSearchParams" in
|
6820
|
-
iterable: "Symbol" in
|
6821
|
-
blob: "FileReader" in
|
7859
|
+
searchParams: "URLSearchParams" in global2,
|
7860
|
+
iterable: "Symbol" in global2 && "iterator" in Symbol,
|
7861
|
+
blob: "FileReader" in global2 && "Blob" in global2 && function() {
|
6822
7862
|
try {
|
6823
7863
|
new Blob();
|
6824
7864
|
return true;
|
@@ -6826,8 +7866,8 @@ var require_browser_polyfill = __commonJS2({
|
|
6826
7866
|
return false;
|
6827
7867
|
}
|
6828
7868
|
}(),
|
6829
|
-
formData: "FormData" in
|
6830
|
-
arrayBuffer: "ArrayBuffer" in
|
7869
|
+
formData: "FormData" in global2,
|
7870
|
+
arrayBuffer: "ArrayBuffer" in global2
|
6831
7871
|
};
|
6832
7872
|
function isDataView(obj) {
|
6833
7873
|
return obj && DataView.prototype.isPrototypeOf(obj);
|
@@ -7204,7 +8244,7 @@ var require_browser_polyfill = __commonJS2({
|
|
7204
8244
|
}
|
7205
8245
|
return new Response(null, { status, headers: { location: url } });
|
7206
8246
|
};
|
7207
|
-
exports2.DOMException =
|
8247
|
+
exports2.DOMException = global2.DOMException;
|
7208
8248
|
try {
|
7209
8249
|
new exports2.DOMException();
|
7210
8250
|
} catch (err2) {
|
@@ -7256,7 +8296,7 @@ var require_browser_polyfill = __commonJS2({
|
|
7256
8296
|
};
|
7257
8297
|
function fixUrl(url) {
|
7258
8298
|
try {
|
7259
|
-
return url === "" &&
|
8299
|
+
return url === "" && global2.location.href ? global2.location.href : url;
|
7260
8300
|
} catch (e) {
|
7261
8301
|
return url;
|
7262
8302
|
}
|
@@ -7295,11 +8335,11 @@ var require_browser_polyfill = __commonJS2({
|
|
7295
8335
|
});
|
7296
8336
|
}
|
7297
8337
|
fetch2.polyfill = true;
|
7298
|
-
if (!
|
7299
|
-
|
7300
|
-
|
7301
|
-
|
7302
|
-
|
8338
|
+
if (!global2.fetch) {
|
8339
|
+
global2.fetch = fetch2;
|
8340
|
+
global2.Headers = Headers;
|
8341
|
+
global2.Request = Request;
|
8342
|
+
global2.Response = Response;
|
7303
8343
|
}
|
7304
8344
|
exports2.Headers = Headers;
|
7305
8345
|
exports2.Request = Request;
|
@@ -7624,12 +8664,7 @@ function contextString(context) {
|
|
7624
8664
|
}
|
7625
8665
|
|
7626
8666
|
// src/context/schematic.tsx
|
7627
|
-
import {
|
7628
|
-
createContext as createContext2,
|
7629
|
-
useEffect as useEffect2,
|
7630
|
-
useMemo,
|
7631
|
-
useState as useState2
|
7632
|
-
} from "react";
|
8667
|
+
import { createContext as createContext2, useEffect as useEffect2, useMemo, useState as useState2 } from "react";
|
7633
8668
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
7634
8669
|
var SchematicContext = createContext2({
|
7635
8670
|
flagValues: {}
|
@@ -7722,11 +8757,13 @@ var useSchematicFlag = (key, opts) => {
|
|
7722
8757
|
return value;
|
7723
8758
|
};
|
7724
8759
|
|
7725
|
-
// src/components/elements/
|
7726
|
-
import {
|
7727
|
-
|
7728
|
-
|
7729
|
-
|
8760
|
+
// src/components/elements/plan-manager/PlanManager.tsx
|
8761
|
+
import {
|
8762
|
+
forwardRef,
|
8763
|
+
useMemo as useMemo2,
|
8764
|
+
useState as useState5
|
8765
|
+
} from "react";
|
8766
|
+
import { createPortal } from "react-dom";
|
7730
8767
|
|
7731
8768
|
// src/utils/color.ts
|
7732
8769
|
function hexToHSL(color) {
|
@@ -7838,6 +8875,9 @@ function camelToHyphen(str) {
|
|
7838
8875
|
return str.replace(/([a-z][A-Z])/g, (g2) => `${g2[0]}-${g2[1].toLowerCase()}`);
|
7839
8876
|
}
|
7840
8877
|
|
8878
|
+
// src/const/index.ts
|
8879
|
+
var TEXT_BASE_SIZE = 16;
|
8880
|
+
|
7841
8881
|
// src/utils/style.ts
|
7842
8882
|
function attr(key, value) {
|
7843
8883
|
return typeof value !== "undefined" && lt`
|
@@ -7855,88 +8895,6 @@ attr.rem = function propAsRem(key, value) {
|
|
7855
8895
|
`;
|
7856
8896
|
};
|
7857
8897
|
|
7858
|
-
// src/components/elements/card/styles.ts
|
7859
|
-
var StyledCard = dt.div(
|
7860
|
-
({
|
7861
|
-
theme,
|
7862
|
-
$sectionLayout = "merged",
|
7863
|
-
$borderRadius = 8,
|
7864
|
-
$padding = 48,
|
7865
|
-
$shadow = true
|
7866
|
-
}) => {
|
7867
|
-
return lt`
|
7868
|
-
box-sizing: border-box;
|
7869
|
-
font-size: ${TEXT_BASE_SIZE}px;
|
7870
|
-
|
7871
|
-
*,
|
7872
|
-
*::before,
|
7873
|
-
*::after {
|
7874
|
-
box-sizing: inherit;
|
7875
|
-
}
|
7876
|
-
|
7877
|
-
> * {
|
7878
|
-
padding: ${$padding * 0.75 / TEXT_BASE_SIZE}rem
|
7879
|
-
${$padding / TEXT_BASE_SIZE}rem;
|
7880
|
-
color: ${theme.typography.text.color};
|
7881
|
-
}
|
7882
|
-
|
7883
|
-
${() => {
|
7884
|
-
const { l: l2 } = hexToHSL(theme.card.background);
|
7885
|
-
const borderColor = l2 > 50 ? darken(theme.card.background, 10) : lighten(theme.card.background, 30);
|
7886
|
-
const borderRadius = `${$borderRadius / TEXT_BASE_SIZE}rem`;
|
7887
|
-
const boxShadow = "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A";
|
7888
|
-
if ($sectionLayout === "merged") {
|
7889
|
-
return lt`
|
7890
|
-
background: ${({ theme: theme2 }) => theme2.card.background};
|
7891
|
-
border-radius: ${borderRadius};
|
7892
|
-
|
7893
|
-
${$shadow && `box-shadow: ${boxShadow};`}
|
7894
|
-
|
7895
|
-
> :not(:last-child) {
|
7896
|
-
border-bottom: 1px solid ${borderColor};
|
7897
|
-
}
|
7898
|
-
`;
|
7899
|
-
}
|
7900
|
-
return lt`
|
7901
|
-
> :not(:last-child) {
|
7902
|
-
margin-bottom: 1rem;
|
7903
|
-
}
|
7904
|
-
|
7905
|
-
> * {
|
7906
|
-
background: ${theme.card.background};
|
7907
|
-
border-radius: ${borderRadius};
|
7908
|
-
${$shadow && `box-shadow: ${boxShadow};`}
|
7909
|
-
}
|
7910
|
-
`;
|
7911
|
-
}}
|
7912
|
-
`;
|
7913
|
-
}
|
7914
|
-
);
|
7915
|
-
|
7916
|
-
// src/components/elements/card/Card.tsx
|
7917
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
7918
|
-
var Card = forwardRef(
|
7919
|
-
({ children, className }, ref) => {
|
7920
|
-
const { settings } = useEmbed();
|
7921
|
-
return /* @__PURE__ */ jsx3(
|
7922
|
-
StyledCard,
|
7923
|
-
{
|
7924
|
-
ref,
|
7925
|
-
className,
|
7926
|
-
$sectionLayout: settings.theme?.sectionLayout,
|
7927
|
-
$borderRadius: settings.theme?.card?.borderRadius,
|
7928
|
-
$padding: settings.theme?.card?.padding,
|
7929
|
-
$shadow: settings.theme?.card?.hasShadow,
|
7930
|
-
children
|
7931
|
-
}
|
7932
|
-
);
|
7933
|
-
}
|
7934
|
-
);
|
7935
|
-
|
7936
|
-
// src/components/elements/plan-manager/PlanManager.tsx
|
7937
|
-
import { forwardRef as forwardRef2, useMemo as useMemo2 } from "react";
|
7938
|
-
import { createPortal } from "react-dom";
|
7939
|
-
|
7940
8898
|
// src/components/ui/box/styles.ts
|
7941
8899
|
var Box = dt.div((props) => {
|
7942
8900
|
const initialStyles = [];
|
@@ -8054,7 +9012,7 @@ var Button = dt.button`
|
|
8054
9012
|
`;
|
8055
9013
|
|
8056
9014
|
// src/components/ui/button/Button.tsx
|
8057
|
-
import { jsx as
|
9015
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
8058
9016
|
var Button2 = ({
|
8059
9017
|
color = "white",
|
8060
9018
|
size = "md",
|
@@ -8063,7 +9021,7 @@ var Button2 = ({
|
|
8063
9021
|
children,
|
8064
9022
|
...props
|
8065
9023
|
}) => {
|
8066
|
-
return /* @__PURE__ */
|
9024
|
+
return /* @__PURE__ */ jsx3(
|
8067
9025
|
Button,
|
8068
9026
|
{
|
8069
9027
|
$color: color,
|
@@ -8094,6 +9052,7 @@ var Container = dt.div`
|
|
8094
9052
|
display: flex;
|
8095
9053
|
justify-content: center;
|
8096
9054
|
align-items: center;
|
9055
|
+
flex-shrink: 0;
|
8097
9056
|
border-radius: 9999px;
|
8098
9057
|
${({ $size }) => {
|
8099
9058
|
const base = 24;
|
@@ -8130,13 +9089,13 @@ var Container = dt.div`
|
|
8130
9089
|
`;
|
8131
9090
|
|
8132
9091
|
// src/components/ui/icon/Icon.tsx
|
8133
|
-
import { jsx as
|
9092
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
8134
9093
|
var Icon2 = ({ name, className, ...props }) => {
|
8135
|
-
return /* @__PURE__ */
|
9094
|
+
return /* @__PURE__ */ jsx4(Icon, { className: (0, import_classnames.default)("i", `i-${name}`, className), ...props });
|
8136
9095
|
};
|
8137
9096
|
|
8138
9097
|
// src/components/ui/icon/IconRound.tsx
|
8139
|
-
import { jsx as
|
9098
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
8140
9099
|
var IconRound = ({
|
8141
9100
|
name,
|
8142
9101
|
variant = "filled",
|
@@ -8144,7 +9103,7 @@ var IconRound = ({
|
|
8144
9103
|
colors = ["white", "#e5e7eb"],
|
8145
9104
|
...props
|
8146
9105
|
}) => {
|
8147
|
-
return /* @__PURE__ */
|
9106
|
+
return /* @__PURE__ */ jsx5(Container, { $size: size, $variant: variant, $colors: colors, ...props, children: /* @__PURE__ */ jsx5(Icon2, { name }) });
|
8148
9107
|
};
|
8149
9108
|
|
8150
9109
|
// src/components/ui/progress-bar/styles.ts
|
@@ -8153,7 +9112,7 @@ var Container2 = dt(Flex)`
|
|
8153
9112
|
`;
|
8154
9113
|
|
8155
9114
|
// src/components/ui/progress-bar/ProgressBar.tsx
|
8156
|
-
import { jsx as
|
9115
|
+
import { jsx as jsx6, jsxs } from "react/jsx-runtime";
|
8157
9116
|
var ProgressBar = ({
|
8158
9117
|
progress,
|
8159
9118
|
value,
|
@@ -8176,14 +9135,14 @@ var ProgressBar = ({
|
|
8176
9135
|
$gap: `${16 / TEXT_BASE_SIZE}rem`,
|
8177
9136
|
...props,
|
8178
9137
|
children: [
|
8179
|
-
/* @__PURE__ */
|
9138
|
+
/* @__PURE__ */ jsx6(
|
8180
9139
|
Flex,
|
8181
9140
|
{
|
8182
9141
|
$position: "relative",
|
8183
9142
|
$alignItems: "center",
|
8184
9143
|
$width: `${barWidth}`,
|
8185
9144
|
$maxWidth: "100%",
|
8186
|
-
children: /* @__PURE__ */
|
9145
|
+
children: /* @__PURE__ */ jsx6(
|
8187
9146
|
Flex,
|
8188
9147
|
{
|
8189
9148
|
$position: "relative",
|
@@ -8192,7 +9151,7 @@ var ProgressBar = ({
|
|
8192
9151
|
$height: `${8 / TEXT_BASE_SIZE}rem`,
|
8193
9152
|
$background: "#F2F4F7",
|
8194
9153
|
$borderRadius: "9999px",
|
8195
|
-
children: /* @__PURE__ */
|
9154
|
+
children: /* @__PURE__ */ jsx6(
|
8196
9155
|
Box,
|
8197
9156
|
{
|
8198
9157
|
$width: `${Math.min(progress, 100)}%`,
|
@@ -8215,41 +9174,64 @@ var ProgressBar = ({
|
|
8215
9174
|
);
|
8216
9175
|
};
|
8217
9176
|
|
9177
|
+
// src/components/elements/plan-manager/CheckoutForm.tsx
|
9178
|
+
import { useState as useState4 } from "react";
|
9179
|
+
import {
|
9180
|
+
LinkAuthenticationElement,
|
9181
|
+
PaymentElement
|
9182
|
+
} from "@stripe/react-stripe-js";
|
9183
|
+
import { useStripe, useElements } from "@stripe/react-stripe-js";
|
9184
|
+
|
8218
9185
|
// src/components/elements/plan-manager/styles.ts
|
8219
9186
|
var StyledButton = dt(Button2)`
|
8220
9187
|
font-family: "Public Sans", sans-serif;
|
8221
9188
|
font-weight: 500;
|
8222
9189
|
text-align: center;
|
8223
9190
|
width: 100%;
|
8224
|
-
${({ $color = "primary", theme }) => {
|
9191
|
+
${({ disabled, $color = "primary", theme }) => {
|
8225
9192
|
const { l: l2 } = hexToHSL(theme[$color]);
|
8226
|
-
const
|
9193
|
+
const textColor = disabled ? "#989898" : l2 > 50 ? "#000000" : "#FFFFFF";
|
8227
9194
|
return lt`
|
8228
|
-
color: ${
|
9195
|
+
color: ${textColor};
|
8229
9196
|
|
8230
9197
|
${Text} {
|
8231
|
-
color: ${
|
9198
|
+
color: ${textColor};
|
8232
9199
|
}
|
8233
9200
|
`;
|
8234
9201
|
}};
|
8235
9202
|
|
8236
|
-
${({ $color = "primary", theme }) => {
|
8237
|
-
const color = theme[$color];
|
8238
|
-
return lt`
|
8239
|
-
|
8240
|
-
|
8241
|
-
|
9203
|
+
${({ disabled, $color = "primary", theme, $variant = "filled" }) => {
|
9204
|
+
const color = disabled ? "#EEEEEE" : theme[$color];
|
9205
|
+
return $variant === "filled" ? lt`
|
9206
|
+
background-color: ${color};
|
9207
|
+
border-color: ${color};
|
9208
|
+
` : lt`
|
9209
|
+
background-color: transparent;
|
9210
|
+
border-color: #d2d2d2;
|
9211
|
+
color: #194bfb;
|
9212
|
+
${Text} {
|
9213
|
+
color: #194bfb;
|
9214
|
+
}
|
9215
|
+
`;
|
8242
9216
|
}}
|
8243
9217
|
|
8244
9218
|
&:hover {
|
8245
|
-
${({
|
9219
|
+
${({ disabled }) => disabled && "cursor: not-allowed;"}
|
9220
|
+
${({ disabled, $color = "primary", theme, $variant = "filled" }) => {
|
8246
9221
|
const specified = theme[$color];
|
8247
9222
|
const lightened = lighten(specified, 15);
|
8248
|
-
const color = specified === lightened ? darken(specified, 15) : lightened;
|
8249
|
-
return lt`
|
8250
|
-
|
8251
|
-
|
8252
|
-
|
9223
|
+
const color = disabled ? "#EEEEEE" : specified === lightened ? darken(specified, 15) : lightened;
|
9224
|
+
return $variant === "filled" ? lt`
|
9225
|
+
background-color: ${color};
|
9226
|
+
border-color: ${color};
|
9227
|
+
` : lt`
|
9228
|
+
background-color: ${color};
|
9229
|
+
border-color: ${color};
|
9230
|
+
color: #ffffff;
|
9231
|
+
${Text} {
|
9232
|
+
color: #ffffff;
|
9233
|
+
}
|
9234
|
+
`;
|
8253
9235
|
}}
|
8254
9236
|
}
|
8255
9237
|
|
@@ -8259,168 +9241,547 @@ var StyledButton = dt(Button2)`
|
|
8259
9241
|
return lt`
|
8260
9242
|
font-size: ${15 / 16}rem;
|
8261
9243
|
padding: ${12 / 16}rem 0;
|
8262
|
-
border-radius: ${
|
9244
|
+
border-radius: ${6 / 16}rem;
|
8263
9245
|
`;
|
8264
9246
|
case "md":
|
8265
9247
|
return lt`
|
8266
9248
|
font-size: ${17 / 16}rem;
|
8267
9249
|
padding: ${16 / 16}rem 0;
|
8268
|
-
border-radius: ${
|
9250
|
+
border-radius: ${8 / 16}rem;
|
8269
9251
|
`;
|
8270
9252
|
case "lg":
|
8271
9253
|
return lt`
|
8272
9254
|
font-size: ${19 / 16}rem;
|
8273
9255
|
padding: ${20 / 16}rem 0;
|
8274
|
-
border-radius: ${
|
9256
|
+
border-radius: ${10 / 16}rem;
|
8275
9257
|
`;
|
8276
9258
|
}
|
8277
9259
|
}}
|
8278
9260
|
`;
|
8279
9261
|
|
8280
|
-
// src/components/elements/plan-manager/
|
8281
|
-
import {
|
8282
|
-
var
|
8283
|
-
|
8284
|
-
|
8285
|
-
|
8286
|
-
|
8287
|
-
|
8288
|
-
|
8289
|
-
|
8290
|
-
|
8291
|
-
|
8292
|
-
|
8293
|
-
|
8294
|
-
|
8295
|
-
|
9262
|
+
// src/components/elements/plan-manager/CheckoutForm.tsx
|
9263
|
+
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
9264
|
+
var CheckoutForm = ({ plan, period }) => {
|
9265
|
+
const stripe = useStripe();
|
9266
|
+
const elements = useElements();
|
9267
|
+
const { api, data } = useEmbed();
|
9268
|
+
const [message, setMessage] = useState4(null);
|
9269
|
+
const [isLoading, setIsLoading] = useState4(false);
|
9270
|
+
const handleSubmit = async (event) => {
|
9271
|
+
event.preventDefault();
|
9272
|
+
const priceId = period === "month" ? plan.monthlyPrice?.id : plan.yearlyPrice?.id;
|
9273
|
+
if (!api || !stripe || !elements || !priceId) {
|
9274
|
+
return;
|
9275
|
+
}
|
9276
|
+
setIsLoading(true);
|
9277
|
+
const { error } = await stripe.confirmPayment({
|
9278
|
+
elements,
|
9279
|
+
confirmParams: {
|
9280
|
+
return_url: window.location.href
|
8296
9281
|
}
|
8297
|
-
}
|
8298
|
-
|
8299
|
-
|
8300
|
-
|
8301
|
-
|
8302
|
-
},
|
8303
|
-
callToAction: {
|
8304
|
-
isVisible: props.callToAction?.isVisible ?? true,
|
8305
|
-
buttonSize: props.callToAction?.buttonSize ?? "md",
|
8306
|
-
buttonStyle: props.callToAction?.buttonStyle ?? "secondary"
|
9282
|
+
});
|
9283
|
+
if (error.type === "card_error" || error.type === "validation_error") {
|
9284
|
+
setMessage(error.message);
|
9285
|
+
} else {
|
9286
|
+
setMessage("An unexpected error occured.");
|
8307
9287
|
}
|
9288
|
+
setIsLoading(false);
|
8308
9289
|
};
|
8309
|
-
|
8310
|
-
|
8311
|
-
|
8312
|
-
|
8313
|
-
|
8314
|
-
|
8315
|
-
|
8316
|
-
|
8317
|
-
|
8318
|
-
|
8319
|
-
|
8320
|
-
|
8321
|
-
|
8322
|
-
name,
|
8323
|
-
description,
|
8324
|
-
price: void 0
|
8325
|
-
})) || []
|
8326
|
-
};
|
8327
|
-
}, [data.company]);
|
8328
|
-
return /* @__PURE__ */ jsxs2("div", { ref, className, children: [
|
8329
|
-
/* @__PURE__ */ jsxs2(Flex, { $flexDirection: "column", $gap: "0.75rem", $margin: "0 0 3rem", children: [
|
8330
|
-
props.header.isVisible && plan && /* @__PURE__ */ jsxs2(
|
8331
|
-
Flex,
|
8332
|
-
{
|
8333
|
-
$justifyContent: "space-between",
|
8334
|
-
$alignItems: "center",
|
8335
|
-
$width: "100%",
|
8336
|
-
$margin: "0 0 1.5rem",
|
8337
|
-
children: [
|
8338
|
-
/* @__PURE__ */ jsxs2("div", { children: [
|
8339
|
-
/* @__PURE__ */ jsx8(Box, { $margin: "0 0 0.75rem", children: /* @__PURE__ */ jsx8(
|
8340
|
-
Text,
|
8341
|
-
{
|
8342
|
-
$font: settings.theme.typography[props.header.title.fontStyle].fontFamily,
|
8343
|
-
$size: settings.theme.typography[props.header.title.fontStyle].fontSize,
|
8344
|
-
$weight: settings.theme.typography[props.header.title.fontStyle].fontWeight,
|
8345
|
-
$color: settings.theme.typography[props.header.title.fontStyle].color,
|
8346
|
-
$lineHeight: 1,
|
8347
|
-
children: plan.name
|
8348
|
-
}
|
8349
|
-
) }),
|
8350
|
-
props.header.description.isVisible && plan.description && /* @__PURE__ */ jsx8(
|
8351
|
-
Text,
|
8352
|
-
{
|
8353
|
-
$font: settings.theme.typography[props.header.description.fontStyle].fontFamily,
|
8354
|
-
$size: settings.theme.typography[props.header.description.fontStyle].fontSize,
|
8355
|
-
$weight: settings.theme.typography[props.header.description.fontStyle].fontWeight,
|
8356
|
-
$color: settings.theme.typography[props.header.description.fontStyle].color,
|
8357
|
-
children: plan.description
|
8358
|
-
}
|
8359
|
-
)
|
8360
|
-
] }),
|
8361
|
-
props.header.price.isVisible && plan.planPrice >= 0 && /* @__PURE__ */ jsxs2(
|
8362
|
-
Text,
|
8363
|
-
{
|
8364
|
-
$font: settings.theme.typography[props.header.price.fontStyle].fontFamily,
|
8365
|
-
$size: settings.theme.typography[props.header.price.fontStyle].fontSize,
|
8366
|
-
$weight: settings.theme.typography[props.header.price.fontStyle].fontWeight,
|
8367
|
-
$color: settings.theme.typography[props.header.price.fontStyle].color,
|
8368
|
-
children: [
|
8369
|
-
"$",
|
8370
|
-
plan.planPrice,
|
8371
|
-
"/",
|
8372
|
-
plan.planPeriod
|
8373
|
-
]
|
8374
|
-
}
|
8375
|
-
)
|
8376
|
-
]
|
8377
|
-
}
|
8378
|
-
),
|
8379
|
-
props.addOns.isVisible && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
8380
|
-
props.addOns.showLabel && /* @__PURE__ */ jsx8(
|
8381
|
-
Text,
|
9290
|
+
return /* @__PURE__ */ jsxs2(
|
9291
|
+
"form",
|
9292
|
+
{
|
9293
|
+
id: "payment-form",
|
9294
|
+
onSubmit: handleSubmit,
|
9295
|
+
style: {
|
9296
|
+
display: "flex",
|
9297
|
+
flexDirection: "column",
|
9298
|
+
height: "100%"
|
9299
|
+
},
|
9300
|
+
children: [
|
9301
|
+
/* @__PURE__ */ jsxs2(
|
9302
|
+
Box,
|
8382
9303
|
{
|
8383
|
-
$
|
8384
|
-
$
|
8385
|
-
$
|
8386
|
-
$
|
8387
|
-
children:
|
9304
|
+
$fontSize: "18px",
|
9305
|
+
$marginBottom: "1.5rem",
|
9306
|
+
$display: "inline-block",
|
9307
|
+
$width: "100%",
|
9308
|
+
children: [
|
9309
|
+
"Add payment method",
|
9310
|
+
" "
|
9311
|
+
]
|
8388
9312
|
}
|
8389
9313
|
),
|
8390
|
-
/* @__PURE__ */
|
9314
|
+
/* @__PURE__ */ jsx7(
|
8391
9315
|
Flex,
|
8392
9316
|
{
|
8393
|
-
$
|
8394
|
-
$
|
9317
|
+
$flexDirection: "column",
|
9318
|
+
$gap: "1.5rem",
|
9319
|
+
$marginBottom: "1.5rem",
|
8395
9320
|
$width: "100%",
|
8396
|
-
children:
|
8397
|
-
|
8398
|
-
|
9321
|
+
children: /* @__PURE__ */ jsx7(
|
9322
|
+
LinkAuthenticationElement,
|
9323
|
+
{
|
9324
|
+
id: "link-authentication-element"
|
9325
|
+
}
|
9326
|
+
)
|
9327
|
+
}
|
9328
|
+
),
|
9329
|
+
/* @__PURE__ */ jsxs2(Flex, { $flexDirection: "column", $width: "100%", $flex: "1", $height: "100%", children: [
|
9330
|
+
/* @__PURE__ */ jsx7(PaymentElement, { id: "payment-element" }),
|
9331
|
+
message && /* @__PURE__ */ jsx7("div", { id: "payment-message", children: message })
|
9332
|
+
] }),
|
9333
|
+
/* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(
|
9334
|
+
StyledButton,
|
9335
|
+
{
|
9336
|
+
id: "submit",
|
9337
|
+
disabled: isLoading || !stripe || !elements || !data.stripeEmbed?.publishableKey || !data.stripeEmbed?.customerEkey,
|
9338
|
+
$size: "md",
|
9339
|
+
$color: "secondary",
|
9340
|
+
children: /* @__PURE__ */ jsx7("span", { id: "button-text", children: isLoading ? "Loading" : "Save payment method" })
|
9341
|
+
}
|
9342
|
+
) })
|
9343
|
+
]
|
9344
|
+
}
|
9345
|
+
);
|
9346
|
+
};
|
9347
|
+
|
9348
|
+
// src/components/elements/plan-manager/PlanManager.tsx
|
9349
|
+
import { Fragment, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
9350
|
+
var OverlayHeader = ({
|
9351
|
+
children,
|
9352
|
+
onClose
|
9353
|
+
}) => {
|
9354
|
+
const { setLayout } = useEmbed();
|
9355
|
+
return /* @__PURE__ */ jsxs3(
|
9356
|
+
Flex,
|
9357
|
+
{
|
9358
|
+
$paddingLeft: "2.5rem",
|
9359
|
+
$paddingRight: "2.5rem",
|
9360
|
+
$padding: ".75rem 2.5rem",
|
9361
|
+
$flexDirection: "row",
|
9362
|
+
$justifyContent: "space-between",
|
9363
|
+
$alignItems: "center",
|
9364
|
+
$borderBottom: "1px solid #DEDEDE",
|
9365
|
+
$gap: "1rem",
|
9366
|
+
$backgroundColor: "#FFFFFF",
|
9367
|
+
$borderRadius: ".5rem .5rem 0 0",
|
9368
|
+
children: [
|
9369
|
+
children,
|
9370
|
+
/* @__PURE__ */ jsx8("div", { children: /* @__PURE__ */ jsx8(
|
9371
|
+
Box,
|
9372
|
+
{
|
9373
|
+
$cursor: "pointer",
|
9374
|
+
onClick: () => {
|
9375
|
+
setLayout("portal");
|
9376
|
+
if (onClose) {
|
9377
|
+
onClose();
|
9378
|
+
}
|
9379
|
+
},
|
9380
|
+
children: /* @__PURE__ */ jsx8(Icon2, { name: "close", style: { fontSize: 36, color: "#B8B8B8" } })
|
9381
|
+
}
|
9382
|
+
) })
|
9383
|
+
]
|
9384
|
+
}
|
9385
|
+
);
|
9386
|
+
};
|
9387
|
+
var OverlayWrapper = ({
|
9388
|
+
children,
|
9389
|
+
size = "lg"
|
9390
|
+
}) => {
|
9391
|
+
const sizeWidthMap = {
|
9392
|
+
md: "700px",
|
9393
|
+
lg: "75%"
|
9394
|
+
};
|
9395
|
+
const sizeHeighthMap = {
|
9396
|
+
md: "auto",
|
9397
|
+
lg: "75%"
|
9398
|
+
};
|
9399
|
+
const sizeMaxWidthMap = {
|
9400
|
+
md: "auto",
|
9401
|
+
lg: "1140px"
|
9402
|
+
};
|
9403
|
+
return /* @__PURE__ */ jsx8(
|
9404
|
+
Box,
|
9405
|
+
{
|
9406
|
+
$position: "absolute",
|
9407
|
+
$top: "50%",
|
9408
|
+
$left: "50%",
|
9409
|
+
$zIndex: "999999",
|
9410
|
+
$transform: "translate(-50%, -50%)",
|
9411
|
+
$width: "100%",
|
9412
|
+
$height: "100%",
|
9413
|
+
$backgroundColor: "#D9D9D9",
|
9414
|
+
$overflow: "hidden",
|
9415
|
+
children: /* @__PURE__ */ jsx8(
|
9416
|
+
Flex,
|
9417
|
+
{
|
9418
|
+
$position: "relative",
|
9419
|
+
$top: "50%",
|
9420
|
+
$left: "50%",
|
9421
|
+
$transform: "translate(-50%, -50%)",
|
9422
|
+
$flexDirection: "column",
|
9423
|
+
$maxWidth: sizeMaxWidthMap[size],
|
9424
|
+
$width: sizeWidthMap[size],
|
9425
|
+
$height: sizeHeighthMap[size],
|
9426
|
+
$backgroundColor: "#FBFBFB",
|
9427
|
+
$borderBottom: "1px solid #DEDEDE",
|
9428
|
+
$borderRadius: "8px",
|
9429
|
+
$boxShadow: "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A;",
|
9430
|
+
id: "select-plan-dialog",
|
9431
|
+
role: "dialog",
|
9432
|
+
"aria-labelledby": "select-plan-dialog-label",
|
9433
|
+
"aria-modal": "true",
|
9434
|
+
children
|
9435
|
+
}
|
9436
|
+
)
|
9437
|
+
}
|
9438
|
+
);
|
9439
|
+
};
|
9440
|
+
var OverlaySideBar = ({
|
9441
|
+
pricePeriod,
|
9442
|
+
setPricePeriod,
|
9443
|
+
checkoutStage,
|
9444
|
+
setCheckoutStage,
|
9445
|
+
currentPlan,
|
9446
|
+
selectedPlan
|
9447
|
+
}) => {
|
9448
|
+
const { api } = useEmbed();
|
9449
|
+
const savingsPercentage = useMemo2(() => {
|
9450
|
+
if (selectedPlan && pricePeriod === "month") {
|
9451
|
+
const monthly = (selectedPlan?.monthlyPrice?.price || 0) * 12;
|
9452
|
+
const yearly = selectedPlan?.yearlyPrice?.price || 0;
|
9453
|
+
return (monthly - yearly) / monthly * 100;
|
9454
|
+
}
|
9455
|
+
return 0;
|
9456
|
+
}, [selectedPlan, pricePeriod]);
|
9457
|
+
return /* @__PURE__ */ jsxs3(
|
9458
|
+
Flex,
|
9459
|
+
{
|
9460
|
+
$flexDirection: "column",
|
9461
|
+
$background: "white",
|
9462
|
+
$borderRadius: "0 0 0.5rem",
|
9463
|
+
$maxWidth: "275px",
|
9464
|
+
$height: "100%",
|
9465
|
+
$boxShadow: "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A;",
|
9466
|
+
children: [
|
9467
|
+
/* @__PURE__ */ jsxs3(
|
9468
|
+
Flex,
|
9469
|
+
{
|
9470
|
+
$flexDirection: "column",
|
9471
|
+
$position: "relative",
|
9472
|
+
$gap: "1rem",
|
9473
|
+
$width: "100%",
|
9474
|
+
$height: "auto",
|
9475
|
+
$padding: "1.5rem",
|
9476
|
+
$borderBottom: "1px solid #DEDEDE",
|
9477
|
+
children: [
|
9478
|
+
/* @__PURE__ */ jsx8(Flex, { $flexDirection: "row", $justifyContent: "space-between", children: /* @__PURE__ */ jsx8(Text, { $size: 20, $weight: 600, children: "Subscription" }) }),
|
9479
|
+
/* @__PURE__ */ jsxs3(
|
9480
|
+
Flex,
|
8399
9481
|
{
|
8400
|
-
$
|
8401
|
-
$
|
8402
|
-
$
|
8403
|
-
$
|
8404
|
-
|
9482
|
+
$flexDirection: "row",
|
9483
|
+
$border: "1px solid #D9D9D9",
|
9484
|
+
$borderRadius: "40px",
|
9485
|
+
$fontSize: "12px",
|
9486
|
+
$textAlign: "center",
|
9487
|
+
$cursor: "pointer",
|
9488
|
+
children: [
|
9489
|
+
/* @__PURE__ */ jsx8(
|
9490
|
+
Box,
|
9491
|
+
{
|
9492
|
+
onClick: () => setPricePeriod("month"),
|
9493
|
+
$padding: ".25rem .5rem",
|
9494
|
+
$flex: "1",
|
9495
|
+
$fontWeight: pricePeriod === "month" ? "600" : "400",
|
9496
|
+
$backgroundColor: pricePeriod === "month" ? "#DDDDDD" : "white",
|
9497
|
+
$borderRadius: "40px",
|
9498
|
+
children: "Billed monthly"
|
9499
|
+
}
|
9500
|
+
),
|
9501
|
+
/* @__PURE__ */ jsx8(
|
9502
|
+
Box,
|
9503
|
+
{
|
9504
|
+
onClick: () => setPricePeriod("year"),
|
9505
|
+
$padding: ".25rem .5rem",
|
9506
|
+
$flex: "1",
|
9507
|
+
$fontWeight: pricePeriod === "year" ? "600" : "400",
|
9508
|
+
$backgroundColor: pricePeriod === "year" ? "#DDDDDD" : "white",
|
9509
|
+
$borderRadius: "40px",
|
9510
|
+
children: "Billed yearly"
|
9511
|
+
}
|
9512
|
+
)
|
9513
|
+
]
|
8405
9514
|
}
|
8406
9515
|
),
|
8407
|
-
|
8408
|
-
"
|
8409
|
-
|
8410
|
-
"
|
9516
|
+
savingsPercentage > 0 && /* @__PURE__ */ jsxs3(Box, { $fontSize: "11px", $color: "#194BFB", children: [
|
9517
|
+
"Save up to ",
|
9518
|
+
savingsPercentage,
|
9519
|
+
"% with yearly billing"
|
8411
9520
|
] })
|
8412
9521
|
]
|
8413
|
-
}
|
8414
|
-
|
8415
|
-
|
8416
|
-
|
8417
|
-
|
8418
|
-
|
9522
|
+
}
|
9523
|
+
),
|
9524
|
+
/* @__PURE__ */ jsxs3(
|
9525
|
+
Flex,
|
9526
|
+
{
|
9527
|
+
$flexDirection: "column",
|
9528
|
+
$position: "relative",
|
9529
|
+
$gap: "1rem",
|
9530
|
+
$width: "100%",
|
9531
|
+
$height: "auto",
|
9532
|
+
$padding: "1.5rem",
|
9533
|
+
$flex: "1",
|
9534
|
+
$borderBottom: "1px solid #DEDEDE",
|
9535
|
+
children: [
|
9536
|
+
/* @__PURE__ */ jsx8(Box, { $fontSize: "14px", $color: "#5D5D5D", children: "Plan" }),
|
9537
|
+
/* @__PURE__ */ jsxs3(
|
9538
|
+
Flex,
|
9539
|
+
{
|
9540
|
+
$flexDirection: "column",
|
9541
|
+
$fontSize: "14px",
|
9542
|
+
$color: "#5D5D5D",
|
9543
|
+
$gap: ".5rem",
|
9544
|
+
children: [
|
9545
|
+
currentPlan && /* @__PURE__ */ jsxs3(
|
9546
|
+
Flex,
|
9547
|
+
{
|
9548
|
+
$flexDirection: "row",
|
9549
|
+
$alignItems: "center",
|
9550
|
+
$justifyContent: "space-between",
|
9551
|
+
$fontSize: "14px",
|
9552
|
+
$color: "#5D5D5D",
|
9553
|
+
children: [
|
9554
|
+
/* @__PURE__ */ jsx8(Flex, { $fontSize: "14px", $color: "#5D5D5D", children: currentPlan.name }),
|
9555
|
+
/* @__PURE__ */ jsxs3(Flex, { $fontSize: "12px", $color: "#000000", children: [
|
9556
|
+
"$",
|
9557
|
+
currentPlan.planPrice,
|
9558
|
+
"/",
|
9559
|
+
currentPlan.planPeriod
|
9560
|
+
] })
|
9561
|
+
]
|
9562
|
+
}
|
9563
|
+
),
|
9564
|
+
selectedPlan && /* @__PURE__ */ jsxs3(Fragment, { children: [
|
9565
|
+
/* @__PURE__ */ jsx8(
|
9566
|
+
Box,
|
9567
|
+
{
|
9568
|
+
$width: "100%",
|
9569
|
+
$textAlign: "left",
|
9570
|
+
$opacity: "50%",
|
9571
|
+
$marginBottom: "-.25rem",
|
9572
|
+
$marginTop: "-.25rem",
|
9573
|
+
children: /* @__PURE__ */ jsx8(
|
9574
|
+
Icon2,
|
9575
|
+
{
|
9576
|
+
name: "arrow-down",
|
9577
|
+
style: {
|
9578
|
+
display: "inline-block"
|
9579
|
+
}
|
9580
|
+
}
|
9581
|
+
)
|
9582
|
+
}
|
9583
|
+
),
|
9584
|
+
/* @__PURE__ */ jsxs3(
|
9585
|
+
Flex,
|
9586
|
+
{
|
9587
|
+
$flexDirection: "row",
|
9588
|
+
$alignItems: "center",
|
9589
|
+
$justifyContent: "space-between",
|
9590
|
+
$fontSize: "14px",
|
9591
|
+
$color: "#5D5D5D",
|
9592
|
+
children: [
|
9593
|
+
/* @__PURE__ */ jsx8(Flex, { $fontSize: "14px", $color: "#000000", $fontWeight: "600", children: selectedPlan.name }),
|
9594
|
+
/* @__PURE__ */ jsxs3(Flex, { $fontSize: "12px", $color: "#000000", children: [
|
9595
|
+
"$",
|
9596
|
+
pricePeriod === "month" ? selectedPlan.monthlyPrice?.price : selectedPlan.yearlyPrice?.price,
|
9597
|
+
"/",
|
9598
|
+
pricePeriod
|
9599
|
+
] })
|
9600
|
+
]
|
9601
|
+
}
|
9602
|
+
)
|
9603
|
+
] })
|
9604
|
+
]
|
9605
|
+
}
|
9606
|
+
)
|
9607
|
+
]
|
9608
|
+
}
|
9609
|
+
),
|
9610
|
+
/* @__PURE__ */ jsxs3(
|
9611
|
+
Flex,
|
9612
|
+
{
|
9613
|
+
$flexDirection: "column",
|
9614
|
+
$position: "relative",
|
9615
|
+
$gap: ".75rem",
|
9616
|
+
$width: "100%",
|
9617
|
+
$height: "auto",
|
9618
|
+
$padding: "1.5rem",
|
9619
|
+
children: [
|
9620
|
+
selectedPlan && /* @__PURE__ */ jsxs3(
|
9621
|
+
Flex,
|
9622
|
+
{
|
9623
|
+
$fontSize: "12px",
|
9624
|
+
$color: "#5D5D5D",
|
9625
|
+
$justifyContent: "space-between",
|
9626
|
+
children: [
|
9627
|
+
/* @__PURE__ */ jsxs3(Box, { $fontSize: "12px", $color: "#5D5D5D", children: [
|
9628
|
+
"Monthly total:",
|
9629
|
+
" "
|
9630
|
+
] }),
|
9631
|
+
/* @__PURE__ */ jsxs3(Box, { $fontSize: "12px", $color: "#000000", children: [
|
9632
|
+
"$",
|
9633
|
+
pricePeriod === "month" ? selectedPlan.monthlyPrice?.price : selectedPlan.yearlyPrice?.price,
|
9634
|
+
"/",
|
9635
|
+
pricePeriod
|
9636
|
+
] })
|
9637
|
+
]
|
9638
|
+
}
|
9639
|
+
),
|
9640
|
+
checkoutStage === "plan" ? /* @__PURE__ */ jsx8(
|
9641
|
+
StyledButton,
|
9642
|
+
{
|
9643
|
+
$size: "sm",
|
9644
|
+
onClick: () => {
|
9645
|
+
setCheckoutStage("checkout");
|
9646
|
+
},
|
9647
|
+
...!selectedPlan && { disabled: true },
|
9648
|
+
children: /* @__PURE__ */ jsxs3(Flex, { $gap: "0.5rem", $alignItems: "center", $justifyContent: "center", children: [
|
9649
|
+
/* @__PURE__ */ jsx8("span", { children: "Next: Checkout" }),
|
9650
|
+
/* @__PURE__ */ jsx8(Icon2, { name: "arrow-right" })
|
9651
|
+
] })
|
9652
|
+
}
|
9653
|
+
) : /* @__PURE__ */ jsx8(
|
9654
|
+
StyledButton,
|
9655
|
+
{
|
9656
|
+
disabled: !api || !selectedPlan || selectedPlan?.id === currentPlan?.id,
|
9657
|
+
onClick: async () => {
|
9658
|
+
const priceId = pricePeriod === "month" ? selectedPlan?.monthlyPrice?.id : selectedPlan?.yearlyPrice?.id;
|
9659
|
+
if (!api || !selectedPlan || !priceId)
|
9660
|
+
return;
|
9661
|
+
await api.checkout({
|
9662
|
+
changeSubscriptionRequestBody: {
|
9663
|
+
newPlanId: selectedPlan.id,
|
9664
|
+
newPriceId: priceId
|
9665
|
+
}
|
9666
|
+
});
|
9667
|
+
},
|
9668
|
+
$size: "md",
|
9669
|
+
children: "Pay now"
|
9670
|
+
}
|
9671
|
+
),
|
9672
|
+
/* @__PURE__ */ jsx8(Box, { $fontSize: "12px", $color: "#5D5D5D", children: "Discounts & credits applied at checkout" })
|
9673
|
+
]
|
9674
|
+
}
|
9675
|
+
)
|
9676
|
+
]
|
9677
|
+
}
|
9678
|
+
);
|
9679
|
+
};
|
9680
|
+
var resolveDesignProps = (props) => {
|
9681
|
+
return {
|
9682
|
+
header: {
|
9683
|
+
isVisible: props.header?.isVisible ?? true,
|
9684
|
+
title: {
|
9685
|
+
fontStyle: props.header?.title?.fontStyle ?? "heading1"
|
9686
|
+
},
|
9687
|
+
description: {
|
9688
|
+
isVisible: props.header?.description?.isVisible ?? true,
|
9689
|
+
fontStyle: props.header?.description?.fontStyle ?? "text"
|
9690
|
+
},
|
9691
|
+
price: {
|
9692
|
+
isVisible: props.header?.price?.isVisible ?? true,
|
9693
|
+
fontStyle: props.header?.price?.fontStyle ?? "text"
|
9694
|
+
}
|
9695
|
+
},
|
9696
|
+
addOns: {
|
9697
|
+
isVisible: props.addOns?.isVisible ?? true,
|
9698
|
+
fontStyle: props.addOns?.fontStyle ?? "heading4",
|
9699
|
+
showLabel: props.addOns?.showLabel ?? true
|
9700
|
+
},
|
9701
|
+
callToAction: {
|
9702
|
+
isVisible: props.callToAction?.isVisible ?? true,
|
9703
|
+
buttonSize: props.callToAction?.buttonSize ?? "md",
|
9704
|
+
buttonStyle: props.callToAction?.buttonStyle ?? "secondary"
|
9705
|
+
}
|
9706
|
+
};
|
9707
|
+
};
|
9708
|
+
var PlanManager = forwardRef(({ children, className, portal, ...rest }, ref) => {
|
9709
|
+
const props = resolveDesignProps(rest);
|
9710
|
+
const [checkoutStage, setCheckoutStage] = useState5(
|
9711
|
+
"plan"
|
9712
|
+
);
|
9713
|
+
const [planPeriod, setPlanPeriod] = useState5("month");
|
9714
|
+
const [selectedPlan, setSelectedPlan] = useState5();
|
9715
|
+
const { data, settings, layout, stripe, setLayout } = useEmbed();
|
9716
|
+
const { currentPlan, canChangePlan, availablePlans } = useMemo2(() => {
|
9717
|
+
return {
|
9718
|
+
currentPlan: data.company?.plan,
|
9719
|
+
canChangePlan: stripe !== null,
|
9720
|
+
availablePlans: data.activePlans
|
9721
|
+
};
|
9722
|
+
}, [data.company, data.activePlans, stripe]);
|
9723
|
+
return /* @__PURE__ */ jsxs3("div", { ref, className, children: [
|
9724
|
+
/* @__PURE__ */ jsx8(
|
9725
|
+
Flex,
|
9726
|
+
{
|
9727
|
+
$flexDirection: "column",
|
9728
|
+
$gap: "0.75rem",
|
9729
|
+
...canChangePlan && { $margin: "0 0 0.5rem" },
|
9730
|
+
children: props.header.isVisible && currentPlan && /* @__PURE__ */ jsxs3(
|
9731
|
+
Flex,
|
9732
|
+
{
|
9733
|
+
$justifyContent: "space-between",
|
9734
|
+
$alignItems: "center",
|
9735
|
+
$width: "100%",
|
9736
|
+
...canChangePlan && { $margin: "0 0 1.5rem" },
|
9737
|
+
children: [
|
9738
|
+
/* @__PURE__ */ jsxs3("div", { children: [
|
9739
|
+
/* @__PURE__ */ jsx8(Box, { $margin: "0 0 0.75rem", children: /* @__PURE__ */ jsx8(
|
9740
|
+
Text,
|
9741
|
+
{
|
9742
|
+
$font: settings.theme.typography[props.header.title.fontStyle].fontFamily,
|
9743
|
+
$size: settings.theme.typography[props.header.title.fontStyle].fontSize,
|
9744
|
+
$weight: settings.theme.typography[props.header.title.fontStyle].fontWeight,
|
9745
|
+
$color: settings.theme.typography[props.header.title.fontStyle].color,
|
9746
|
+
$lineHeight: 1,
|
9747
|
+
children: currentPlan.name
|
9748
|
+
}
|
9749
|
+
) }),
|
9750
|
+
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ jsx8(
|
9751
|
+
Text,
|
9752
|
+
{
|
9753
|
+
$font: settings.theme.typography[props.header.description.fontStyle].fontFamily,
|
9754
|
+
$size: settings.theme.typography[props.header.description.fontStyle].fontSize,
|
9755
|
+
$weight: settings.theme.typography[props.header.description.fontStyle].fontWeight,
|
9756
|
+
$color: settings.theme.typography[props.header.description.fontStyle].color,
|
9757
|
+
children: currentPlan.description
|
9758
|
+
}
|
9759
|
+
)
|
9760
|
+
] }),
|
9761
|
+
props.header.price.isVisible && currentPlan.planPrice >= 0 && currentPlan.planPeriod && /* @__PURE__ */ jsxs3(
|
9762
|
+
Text,
|
9763
|
+
{
|
9764
|
+
$font: settings.theme.typography[props.header.price.fontStyle].fontFamily,
|
9765
|
+
$size: settings.theme.typography[props.header.price.fontStyle].fontSize,
|
9766
|
+
$weight: settings.theme.typography[props.header.price.fontStyle].fontWeight,
|
9767
|
+
$color: settings.theme.typography[props.header.price.fontStyle].color,
|
9768
|
+
children: [
|
9769
|
+
"$",
|
9770
|
+
currentPlan.planPrice,
|
9771
|
+
"/",
|
9772
|
+
currentPlan.planPeriod
|
9773
|
+
]
|
9774
|
+
}
|
9775
|
+
)
|
9776
|
+
]
|
9777
|
+
}
|
9778
|
+
)
|
9779
|
+
}
|
9780
|
+
),
|
9781
|
+
canChangePlan && props.callToAction.isVisible && /* @__PURE__ */ jsx8(
|
8419
9782
|
StyledButton,
|
8420
9783
|
{
|
8421
9784
|
onClick: () => {
|
8422
|
-
if (layout !== "checkout")
|
8423
|
-
return;
|
8424
9785
|
setLayout("checkout");
|
8425
9786
|
},
|
8426
9787
|
$size: props.callToAction.buttonSize,
|
@@ -8436,91 +9797,306 @@ var PlanManager = forwardRef2(({ children, className, portal, ...rest }, ref) =>
|
|
8436
9797
|
)
|
8437
9798
|
}
|
8438
9799
|
),
|
8439
|
-
|
8440
|
-
|
8441
|
-
|
8442
|
-
|
8443
|
-
|
8444
|
-
|
8445
|
-
|
8446
|
-
|
8447
|
-
|
8448
|
-
|
8449
|
-
|
8450
|
-
|
8451
|
-
|
8452
|
-
|
9800
|
+
canChangePlan && layout === "checkout" && createPortal(
|
9801
|
+
/* @__PURE__ */ jsxs3(OverlayWrapper, { children: [
|
9802
|
+
/* @__PURE__ */ jsx8(OverlayHeader, { children: /* @__PURE__ */ jsxs3(Flex, { $gap: "1rem", children: [
|
9803
|
+
/* @__PURE__ */ jsxs3(Flex, { $flexDirection: "row", $gap: "0.5rem", $alignItems: "center", children: [
|
9804
|
+
checkoutStage === "plan" ? /* @__PURE__ */ jsx8(
|
9805
|
+
Box,
|
9806
|
+
{
|
9807
|
+
$width: "15px",
|
9808
|
+
$height: "15px",
|
9809
|
+
$backgroundColor: "white",
|
9810
|
+
$border: "2px solid #DDDDDD",
|
9811
|
+
$borderRadius: "999px"
|
9812
|
+
}
|
9813
|
+
) : /* @__PURE__ */ jsx8(
|
9814
|
+
IconRound,
|
9815
|
+
{
|
9816
|
+
name: "check",
|
9817
|
+
style: {
|
9818
|
+
color: "#FFFFFF",
|
9819
|
+
backgroundColor: "#DDDDDD",
|
9820
|
+
fontSize: 16,
|
9821
|
+
width: "1rem",
|
9822
|
+
height: "1rem"
|
9823
|
+
}
|
9824
|
+
}
|
9825
|
+
),
|
9826
|
+
/* @__PURE__ */ jsx8(
|
9827
|
+
"div",
|
9828
|
+
{
|
9829
|
+
tabIndex: 0,
|
9830
|
+
...checkoutStage === "plan" ? {
|
9831
|
+
style: {
|
9832
|
+
fontWeight: "700"
|
9833
|
+
}
|
9834
|
+
} : {
|
9835
|
+
style: {
|
9836
|
+
cursor: "pointer"
|
9837
|
+
},
|
9838
|
+
onClick: () => setCheckoutStage("plan")
|
9839
|
+
},
|
9840
|
+
children: "1. Select plan"
|
9841
|
+
}
|
9842
|
+
),
|
9843
|
+
/* @__PURE__ */ jsx8(
|
9844
|
+
Icon2,
|
9845
|
+
{
|
9846
|
+
name: "chevron-right",
|
9847
|
+
style: { fontSize: 16, color: "#D0D0D0" }
|
9848
|
+
}
|
9849
|
+
)
|
9850
|
+
] }),
|
9851
|
+
/* @__PURE__ */ jsxs3(Flex, { $flexDirection: "row", $gap: "0.5rem", $alignItems: "center", children: [
|
9852
|
+
/* @__PURE__ */ jsx8(
|
9853
|
+
Box,
|
9854
|
+
{
|
9855
|
+
$width: "15px",
|
9856
|
+
$height: "15px",
|
9857
|
+
$border: "2px solid #DDDDDD",
|
9858
|
+
$borderRadius: "999px",
|
9859
|
+
$backgroundColor: "white"
|
9860
|
+
}
|
9861
|
+
),
|
9862
|
+
/* @__PURE__ */ jsx8(
|
9863
|
+
"div",
|
9864
|
+
{
|
9865
|
+
tabIndex: 0,
|
9866
|
+
...checkoutStage === "checkout" && {
|
9867
|
+
style: {
|
9868
|
+
fontWeight: "700"
|
9869
|
+
}
|
9870
|
+
},
|
9871
|
+
children: "2. Checkout"
|
9872
|
+
}
|
9873
|
+
)
|
9874
|
+
] })
|
9875
|
+
] }) }),
|
9876
|
+
/* @__PURE__ */ jsxs3(Flex, { $flexDirection: "row", $height: "100%", children: [
|
9877
|
+
/* @__PURE__ */ jsxs3(
|
8453
9878
|
Flex,
|
8454
9879
|
{
|
8455
|
-
$
|
8456
|
-
$
|
8457
|
-
$
|
8458
|
-
$transform: "translate(-50%, -50%)",
|
8459
|
-
$width: "956px",
|
8460
|
-
$height: "700px",
|
9880
|
+
$flexDirection: "column",
|
9881
|
+
$gap: "1rem",
|
9882
|
+
$padding: "2rem 2.5rem 2rem 2.5rem",
|
8461
9883
|
$backgroundColor: "#FBFBFB",
|
8462
|
-
$borderRadius: "
|
8463
|
-
$
|
8464
|
-
|
8465
|
-
role: "dialog",
|
8466
|
-
"aria-labelledby": "select-plan-dialog-label",
|
8467
|
-
"aria-modal": "true",
|
9884
|
+
$borderRadius: "0 0.5rem 0",
|
9885
|
+
$flex: "1",
|
9886
|
+
$height: "100%",
|
8468
9887
|
children: [
|
8469
|
-
/* @__PURE__ */
|
8470
|
-
|
8471
|
-
|
8472
|
-
$position: "absolute",
|
8473
|
-
$top: "0.25rem",
|
8474
|
-
$right: "0.75rem",
|
8475
|
-
$cursor: "pointer",
|
8476
|
-
onClick: () => {
|
8477
|
-
setLayout("portal");
|
8478
|
-
},
|
8479
|
-
children: /* @__PURE__ */ jsx8(Icon2, { name: "close", style: { fontSize: 36, color: "#B8B8B8" } })
|
8480
|
-
}
|
8481
|
-
),
|
8482
|
-
/* @__PURE__ */ jsxs2(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
8483
|
-
/* @__PURE__ */ jsx8(
|
8484
|
-
Text,
|
9888
|
+
checkoutStage === "plan" && /* @__PURE__ */ jsxs3(Fragment, { children: [
|
9889
|
+
/* @__PURE__ */ jsxs3(
|
9890
|
+
Flex,
|
8485
9891
|
{
|
8486
|
-
|
8487
|
-
|
8488
|
-
$
|
8489
|
-
|
8490
|
-
|
9892
|
+
$flexDirection: "column",
|
9893
|
+
$gap: "1rem",
|
9894
|
+
$marginBottom: "1rem",
|
9895
|
+
children: [
|
9896
|
+
/* @__PURE__ */ jsx8(
|
9897
|
+
Text,
|
9898
|
+
{
|
9899
|
+
as: "h1",
|
9900
|
+
id: "select-plan-dialog-label",
|
9901
|
+
$size: 18,
|
9902
|
+
$marginBottom: ".5rem",
|
9903
|
+
children: "Select plan"
|
9904
|
+
}
|
9905
|
+
),
|
9906
|
+
/* @__PURE__ */ jsx8(
|
9907
|
+
Text,
|
9908
|
+
{
|
9909
|
+
as: "p",
|
9910
|
+
id: "select-plan-dialog-description",
|
9911
|
+
$size: 14,
|
9912
|
+
$weight: 400,
|
9913
|
+
children: "Choose your base plan"
|
9914
|
+
}
|
9915
|
+
)
|
9916
|
+
]
|
8491
9917
|
}
|
8492
9918
|
),
|
8493
|
-
/* @__PURE__ */ jsx8(
|
9919
|
+
/* @__PURE__ */ jsx8(
|
8494
9920
|
Flex,
|
8495
9921
|
{
|
8496
|
-
$
|
8497
|
-
$
|
8498
|
-
$
|
8499
|
-
|
8500
|
-
|
8501
|
-
|
8502
|
-
|
8503
|
-
|
8504
|
-
|
8505
|
-
|
8506
|
-
|
8507
|
-
|
8508
|
-
|
8509
|
-
|
8510
|
-
|
9922
|
+
$flexDirection: "row",
|
9923
|
+
$gap: "1rem",
|
9924
|
+
$flex: "1",
|
9925
|
+
$height: "100%",
|
9926
|
+
children: availablePlans?.map((plan) => {
|
9927
|
+
return /* @__PURE__ */ jsxs3(
|
9928
|
+
Flex,
|
9929
|
+
{
|
9930
|
+
$height: "100%",
|
9931
|
+
$flexDirection: "column",
|
9932
|
+
$backgroundColor: "white",
|
9933
|
+
$flex: "1",
|
9934
|
+
$border: `2px solid ${plan.id === selectedPlan?.id ? "#194BFB" : "transparent"}`,
|
9935
|
+
$borderRadius: ".5rem",
|
9936
|
+
$boxShadow: "0px 1px 3px rgba(16, 24, 40, 0.1), 0px 1px 20px rgba(16, 24, 40, 0.06)",
|
9937
|
+
children: [
|
9938
|
+
/* @__PURE__ */ jsxs3(
|
9939
|
+
Flex,
|
9940
|
+
{
|
9941
|
+
$flexDirection: "column",
|
9942
|
+
$position: "relative",
|
9943
|
+
$gap: "1rem",
|
9944
|
+
$width: "100%",
|
9945
|
+
$height: "auto",
|
9946
|
+
$padding: "2rem 1.5rem 1.5rem",
|
9947
|
+
$borderBottom: "1px solid #DEDEDE",
|
9948
|
+
children: [
|
9949
|
+
/* @__PURE__ */ jsx8(Text, { $size: 20, $weight: 600, children: plan.name }),
|
9950
|
+
/* @__PURE__ */ jsx8(Text, { $size: 14, children: plan.description }),
|
9951
|
+
/* @__PURE__ */ jsxs3(Text, { children: [
|
9952
|
+
/* @__PURE__ */ jsx8(Box, { $display: "inline-block", $fontSize: ".90rem", children: "$" }),
|
9953
|
+
/* @__PURE__ */ jsx8(Box, { $display: "inline-block", $fontSize: "1.5rem", children: (planPeriod === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price }),
|
9954
|
+
/* @__PURE__ */ jsxs3(Box, { $display: "inline-block", $fontSize: ".75rem", children: [
|
9955
|
+
"/",
|
9956
|
+
planPeriod
|
9957
|
+
] })
|
9958
|
+
] }),
|
9959
|
+
(plan.current || plan.id === currentPlan?.id) && /* @__PURE__ */ jsx8(
|
9960
|
+
Flex,
|
9961
|
+
{
|
9962
|
+
$position: "absolute",
|
9963
|
+
$right: "1rem",
|
9964
|
+
$top: "1rem",
|
9965
|
+
$fontSize: ".625rem",
|
9966
|
+
$color: "white",
|
9967
|
+
$backgroundColor: "#194BFB",
|
9968
|
+
$borderRadius: "999px",
|
9969
|
+
$padding: ".125rem .85rem",
|
9970
|
+
children: "Current plan"
|
9971
|
+
}
|
9972
|
+
)
|
9973
|
+
]
|
9974
|
+
}
|
9975
|
+
),
|
9976
|
+
/* @__PURE__ */ jsx8(
|
9977
|
+
Flex,
|
9978
|
+
{
|
9979
|
+
$flexDirection: "column",
|
9980
|
+
$position: "relative",
|
9981
|
+
$gap: "0.5rem",
|
9982
|
+
$flex: "1",
|
9983
|
+
$width: "100%",
|
9984
|
+
$height: "auto",
|
9985
|
+
$padding: "1.5rem",
|
9986
|
+
children: plan.features.map((feature) => {
|
9987
|
+
return /* @__PURE__ */ jsxs3(
|
9988
|
+
Flex,
|
9989
|
+
{
|
9990
|
+
$flexShrink: "0",
|
9991
|
+
$gap: "1rem",
|
9992
|
+
children: [
|
9993
|
+
/* @__PURE__ */ jsx8(
|
9994
|
+
IconRound,
|
9995
|
+
{
|
9996
|
+
name: feature.icon,
|
9997
|
+
size: "tn",
|
9998
|
+
colors: ["#000000", "#F5F5F5"]
|
9999
|
+
}
|
10000
|
+
),
|
10001
|
+
/* @__PURE__ */ jsx8(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx8(Text, { $size: ".75rem", $color: "#00000", children: feature.name }) })
|
10002
|
+
]
|
10003
|
+
},
|
10004
|
+
feature.id
|
10005
|
+
);
|
10006
|
+
})
|
10007
|
+
}
|
10008
|
+
),
|
10009
|
+
/* @__PURE__ */ jsxs3(
|
10010
|
+
Flex,
|
10011
|
+
{
|
10012
|
+
$flexDirection: "column",
|
10013
|
+
$position: "relative",
|
10014
|
+
$gap: "1rem",
|
10015
|
+
$width: "100%",
|
10016
|
+
$height: "auto",
|
10017
|
+
$padding: "1.5rem",
|
10018
|
+
children: [
|
10019
|
+
plan.id === selectedPlan?.id && /* @__PURE__ */ jsxs3(
|
10020
|
+
Flex,
|
10021
|
+
{
|
10022
|
+
$justifyContent: "center",
|
10023
|
+
$alignItems: "center",
|
10024
|
+
$gap: "0.25rem",
|
10025
|
+
$fontSize: "0.9375rem",
|
10026
|
+
$padding: "0.625rem 0",
|
10027
|
+
children: [
|
10028
|
+
/* @__PURE__ */ jsx8(
|
10029
|
+
Icon2,
|
10030
|
+
{
|
10031
|
+
name: "check-rounded",
|
10032
|
+
style: {
|
10033
|
+
fontSize: 20,
|
10034
|
+
lineHeight: "1",
|
10035
|
+
color: "#194BFB"
|
10036
|
+
}
|
10037
|
+
}
|
10038
|
+
),
|
10039
|
+
/* @__PURE__ */ jsx8(
|
10040
|
+
"span",
|
10041
|
+
{
|
10042
|
+
style: {
|
10043
|
+
color: "#7B7B7B",
|
10044
|
+
lineHeight: "1.4"
|
10045
|
+
},
|
10046
|
+
children: "Selected"
|
10047
|
+
}
|
10048
|
+
)
|
10049
|
+
]
|
10050
|
+
}
|
10051
|
+
),
|
10052
|
+
!(plan.current || plan.id === currentPlan?.id) && plan.id !== selectedPlan?.id && /* @__PURE__ */ jsx8(
|
10053
|
+
StyledButton,
|
10054
|
+
{
|
10055
|
+
$size: "sm",
|
10056
|
+
$color: "secondary",
|
10057
|
+
$variant: "outline",
|
10058
|
+
onClick: () => {
|
10059
|
+
setSelectedPlan(plan);
|
10060
|
+
},
|
10061
|
+
children: "Select"
|
10062
|
+
}
|
10063
|
+
)
|
10064
|
+
]
|
10065
|
+
}
|
10066
|
+
)
|
10067
|
+
]
|
10068
|
+
},
|
10069
|
+
plan.id
|
10070
|
+
);
|
10071
|
+
})
|
10072
|
+
}
|
10073
|
+
)
|
10074
|
+
] }),
|
10075
|
+
selectedPlan && checkoutStage === "checkout" && /* @__PURE__ */ jsx8(CheckoutForm, { plan: selectedPlan, period: planPeriod })
|
8511
10076
|
]
|
8512
10077
|
}
|
10078
|
+
),
|
10079
|
+
/* @__PURE__ */ jsx8(
|
10080
|
+
OverlaySideBar,
|
10081
|
+
{
|
10082
|
+
pricePeriod: planPeriod,
|
10083
|
+
setPricePeriod: setPlanPeriod,
|
10084
|
+
checkoutStage,
|
10085
|
+
setCheckoutStage,
|
10086
|
+
currentPlan,
|
10087
|
+
selectedPlan
|
10088
|
+
}
|
8513
10089
|
)
|
8514
|
-
}
|
8515
|
-
),
|
10090
|
+
] })
|
10091
|
+
] }),
|
8516
10092
|
portal || document.body
|
8517
10093
|
)
|
8518
10094
|
] });
|
8519
10095
|
});
|
8520
10096
|
|
8521
10097
|
// src/components/elements/included-features/IncludedFeatures.tsx
|
8522
|
-
import { forwardRef as
|
8523
|
-
import { jsx as jsx9, jsxs as
|
10098
|
+
import { forwardRef as forwardRef2, useMemo as useMemo3 } from "react";
|
10099
|
+
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
8524
10100
|
function resolveDesignProps2(props) {
|
8525
10101
|
return {
|
8526
10102
|
header: {
|
@@ -8543,7 +10119,7 @@ function resolveDesignProps2(props) {
|
|
8543
10119
|
}
|
8544
10120
|
};
|
8545
10121
|
}
|
8546
|
-
var IncludedFeatures =
|
10122
|
+
var IncludedFeatures = forwardRef2(({ className, ...rest }, ref) => {
|
8547
10123
|
const props = resolveDesignProps2(rest);
|
8548
10124
|
const { data, settings } = useEmbed();
|
8549
10125
|
const features = useMemo3(() => {
|
@@ -8554,7 +10130,7 @@ var IncludedFeatures = forwardRef3(({ className, ...rest }, ref) => {
|
|
8554
10130
|
allocationType,
|
8555
10131
|
feature,
|
8556
10132
|
period,
|
8557
|
-
usage,
|
10133
|
+
usage = 0,
|
8558
10134
|
...props2
|
8559
10135
|
}) => {
|
8560
10136
|
return {
|
@@ -8573,7 +10149,7 @@ var IncludedFeatures = forwardRef3(({ className, ...rest }, ref) => {
|
|
8573
10149
|
}
|
8574
10150
|
);
|
8575
10151
|
}, [data.featureUsage]);
|
8576
|
-
return /* @__PURE__ */
|
10152
|
+
return /* @__PURE__ */ jsxs4(Flex, { ref, className, $flexDirection: "column", $gap: "1.5rem", children: [
|
8577
10153
|
props.header.isVisible && /* @__PURE__ */ jsx9(Box, { children: /* @__PURE__ */ jsx9(
|
8578
10154
|
Text,
|
8579
10155
|
{
|
@@ -8591,7 +10167,7 @@ var IncludedFeatures = forwardRef3(({ className, ...rest }, ref) => {
|
|
8591
10167
|
}
|
8592
10168
|
return [
|
8593
10169
|
...acc,
|
8594
|
-
/* @__PURE__ */
|
10170
|
+
/* @__PURE__ */ jsxs4(
|
8595
10171
|
Flex,
|
8596
10172
|
{
|
8597
10173
|
$flexWrap: "wrap",
|
@@ -8599,7 +10175,7 @@ var IncludedFeatures = forwardRef3(({ className, ...rest }, ref) => {
|
|
8599
10175
|
$alignItems: "center",
|
8600
10176
|
$gap: "1rem",
|
8601
10177
|
children: [
|
8602
|
-
/* @__PURE__ */
|
10178
|
+
/* @__PURE__ */ jsxs4(Flex, { $gap: "1rem", children: [
|
8603
10179
|
props.icons.isVisible && feature?.icon && /* @__PURE__ */ jsx9(
|
8604
10180
|
IconRound,
|
8605
10181
|
{
|
@@ -8618,12 +10194,11 @@ var IncludedFeatures = forwardRef3(({ className, ...rest }, ref) => {
|
|
8618
10194
|
$size: settings.theme.typography[props.icons.fontStyle].fontSize,
|
8619
10195
|
$weight: settings.theme.typography[props.icons.fontStyle].fontWeight,
|
8620
10196
|
$color: settings.theme.typography[props.icons.fontStyle].color,
|
8621
|
-
$align: "center",
|
8622
10197
|
children: feature.name
|
8623
10198
|
}
|
8624
10199
|
) })
|
8625
10200
|
] }),
|
8626
|
-
allocationType === "numeric" && feature?.name && /* @__PURE__ */
|
10201
|
+
allocationType === "numeric" && feature?.name && /* @__PURE__ */ jsxs4(Box, { $textAlign: "right", children: [
|
8627
10202
|
props.entitlement.isVisible && /* @__PURE__ */ jsx9(
|
8628
10203
|
Text,
|
8629
10204
|
{
|
@@ -8659,8 +10234,8 @@ var IncludedFeatures = forwardRef3(({ className, ...rest }, ref) => {
|
|
8659
10234
|
});
|
8660
10235
|
|
8661
10236
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
8662
|
-
import { forwardRef as
|
8663
|
-
import { jsx as jsx10, jsxs as
|
10237
|
+
import { forwardRef as forwardRef3, useMemo as useMemo4 } from "react";
|
10238
|
+
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
8664
10239
|
function resolveDesignProps3(props) {
|
8665
10240
|
return {
|
8666
10241
|
isVisible: props.isVisible ?? true,
|
@@ -8689,7 +10264,7 @@ function resolveDesignProps3(props) {
|
|
8689
10264
|
}
|
8690
10265
|
};
|
8691
10266
|
}
|
8692
|
-
var MeteredFeatures =
|
10267
|
+
var MeteredFeatures = forwardRef3(({ className, ...rest }, ref) => {
|
8693
10268
|
const props = resolveDesignProps3(rest);
|
8694
10269
|
const { data, settings } = useEmbed();
|
8695
10270
|
const features = useMemo4(() => {
|
@@ -8726,11 +10301,11 @@ var MeteredFeatures = forwardRef4(({ className, ...rest }, ref) => {
|
|
8726
10301
|
}
|
8727
10302
|
return [
|
8728
10303
|
...acc,
|
8729
|
-
/* @__PURE__ */
|
10304
|
+
/* @__PURE__ */ jsxs5(Flex, { $gap: "1.5rem", children: [
|
8730
10305
|
props.icon.isVisible && feature?.icon && /* @__PURE__ */ jsx10(Box, { $flexShrink: "0", children: /* @__PURE__ */ jsx10(IconRound, { name: feature.icon, size: "sm" }) }),
|
8731
|
-
/* @__PURE__ */
|
8732
|
-
/* @__PURE__ */
|
8733
|
-
feature?.name && /* @__PURE__ */
|
10306
|
+
/* @__PURE__ */ jsxs5(Box, { $flexGrow: "1", children: [
|
10307
|
+
/* @__PURE__ */ jsxs5(Flex, { children: [
|
10308
|
+
feature?.name && /* @__PURE__ */ jsxs5(Box, { $flexGrow: "1", children: [
|
8734
10309
|
/* @__PURE__ */ jsx10(
|
8735
10310
|
Text,
|
8736
10311
|
{
|
@@ -8754,7 +10329,7 @@ var MeteredFeatures = forwardRef4(({ className, ...rest }, ref) => {
|
|
8754
10329
|
}
|
8755
10330
|
)
|
8756
10331
|
] }),
|
8757
|
-
allocationType === "numeric" && feature?.name && /* @__PURE__ */
|
10332
|
+
allocationType === "numeric" && feature?.name && /* @__PURE__ */ jsxs5(Box, { $textAlign: "right", children: [
|
8758
10333
|
props.allocation.isVisible && /* @__PURE__ */ jsx10(
|
8759
10334
|
Text,
|
8760
10335
|
{
|
@@ -8797,8 +10372,8 @@ var MeteredFeatures = forwardRef4(({ className, ...rest }, ref) => {
|
|
8797
10372
|
});
|
8798
10373
|
|
8799
10374
|
// src/components/elements/upcoming-bill/UpcomingBill.tsx
|
8800
|
-
import { forwardRef as
|
8801
|
-
import {
|
10375
|
+
import { forwardRef as forwardRef4, useMemo as useMemo5 } from "react";
|
10376
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
8802
10377
|
function resolveDesignProps4(props) {
|
8803
10378
|
return {
|
8804
10379
|
header: {
|
@@ -8817,27 +10392,35 @@ function resolveDesignProps4(props) {
|
|
8817
10392
|
}
|
8818
10393
|
};
|
8819
10394
|
}
|
8820
|
-
var UpcomingBill =
|
10395
|
+
var UpcomingBill = forwardRef4(({ className, ...rest }, ref) => {
|
8821
10396
|
const props = resolveDesignProps4(rest);
|
8822
|
-
const { settings } = useEmbed();
|
8823
|
-
const {
|
10397
|
+
const { data, settings, stripe } = useEmbed();
|
10398
|
+
const { upcomingInvoice } = useMemo5(() => {
|
8824
10399
|
return {
|
8825
|
-
|
8826
|
-
|
8827
|
-
|
8828
|
-
|
8829
|
-
|
10400
|
+
upcomingInvoice: {
|
10401
|
+
...data.upcomingInvoice?.amountDue && {
|
10402
|
+
amountDue: data.upcomingInvoice.amountDue
|
10403
|
+
},
|
10404
|
+
...data.subscription?.interval && {
|
10405
|
+
interval: data.subscription.interval
|
10406
|
+
},
|
10407
|
+
...data.upcomingInvoice?.dueDate && {
|
10408
|
+
dueDate: toPrettyDate(new Date(data.upcomingInvoice.dueDate))
|
10409
|
+
}
|
8830
10410
|
}
|
8831
10411
|
};
|
8832
|
-
}, []);
|
8833
|
-
|
8834
|
-
|
10412
|
+
}, [data.subscription, data.upcomingInvoice]);
|
10413
|
+
if (!stripe || !data.upcomingInvoice) {
|
10414
|
+
return null;
|
10415
|
+
}
|
10416
|
+
return /* @__PURE__ */ jsxs6("div", { ref, className, children: [
|
10417
|
+
props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ jsx11(
|
8835
10418
|
Flex,
|
8836
10419
|
{
|
8837
10420
|
$justifyContent: "space-between",
|
8838
10421
|
$alignItems: "center",
|
8839
10422
|
$margin: "0 0 0.75rem",
|
8840
|
-
children: /* @__PURE__ */
|
10423
|
+
children: /* @__PURE__ */ jsxs6(
|
8841
10424
|
Text,
|
8842
10425
|
{
|
8843
10426
|
$font: settings.theme.typography[props.header.fontStyle].fontFamily,
|
@@ -8847,14 +10430,14 @@ var UpcomingBill = forwardRef5(({ className, ...rest }, ref) => {
|
|
8847
10430
|
children: [
|
8848
10431
|
props.header.prefix,
|
8849
10432
|
" ",
|
8850
|
-
|
10433
|
+
upcomingInvoice.dueDate
|
8851
10434
|
]
|
8852
10435
|
}
|
8853
10436
|
)
|
8854
10437
|
}
|
8855
10438
|
),
|
8856
|
-
/* @__PURE__ */
|
8857
|
-
props.price.isVisible && /* @__PURE__ */ jsx11(Flex, { $alignItems: "end", $flexGrow: "1", children: /* @__PURE__ */
|
10439
|
+
upcomingInvoice.amountDue && /* @__PURE__ */ jsxs6(Flex, { $justifyContent: "space-between", $alignItems: "start", $gap: "1rem", children: [
|
10440
|
+
props.price.isVisible && /* @__PURE__ */ jsx11(Flex, { $alignItems: "end", $flexGrow: "1", children: /* @__PURE__ */ jsxs6(
|
8858
10441
|
Text,
|
8859
10442
|
{
|
8860
10443
|
$font: settings.theme.typography[props.price.fontStyle].fontFamily,
|
@@ -8871,27 +10454,18 @@ var UpcomingBill = forwardRef5(({ className, ...rest }, ref) => {
|
|
8871
10454
|
children: "$"
|
8872
10455
|
}
|
8873
10456
|
),
|
8874
|
-
|
10457
|
+
upcomingInvoice.amountDue
|
8875
10458
|
]
|
8876
10459
|
}
|
8877
10460
|
) }),
|
8878
|
-
/* @__PURE__ */ jsx11(Box, { $maxWidth: "
|
10461
|
+
/* @__PURE__ */ jsx11(Box, { $maxWidth: "10rem", $lineHeight: "1", $textAlign: "right", children: /* @__PURE__ */ jsx11(
|
8879
10462
|
Text,
|
8880
10463
|
{
|
8881
10464
|
$font: settings.theme.typography[props.contractEndDate.fontStyle].fontFamily,
|
8882
10465
|
$size: settings.theme.typography[props.contractEndDate.fontStyle].fontSize,
|
8883
10466
|
$weight: settings.theme.typography[props.contractEndDate.fontStyle].fontWeight,
|
8884
10467
|
$color: settings.theme.typography[props.contractEndDate.fontStyle].color,
|
8885
|
-
children:
|
8886
|
-
"Estimated monthly bill.",
|
8887
|
-
props.contractEndDate.isVisible && /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
8888
|
-
"\xA0",
|
8889
|
-
props.contractEndDate.prefix,
|
8890
|
-
" ",
|
8891
|
-
bill.endDate,
|
8892
|
-
"."
|
8893
|
-
] })
|
8894
|
-
]
|
10468
|
+
children: "Estimated monthly bill."
|
8895
10469
|
}
|
8896
10470
|
) })
|
8897
10471
|
] })
|
@@ -8899,9 +10473,9 @@ var UpcomingBill = forwardRef5(({ className, ...rest }, ref) => {
|
|
8899
10473
|
});
|
8900
10474
|
|
8901
10475
|
// src/components/elements/payment-method/PaymentMethod.tsx
|
8902
|
-
import { forwardRef as
|
10476
|
+
import { forwardRef as forwardRef5, useMemo as useMemo6 } from "react";
|
8903
10477
|
import { createPortal as createPortal2 } from "react-dom";
|
8904
|
-
import { jsx as jsx12, jsxs as
|
10478
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
8905
10479
|
var resolveDesignProps5 = (props) => {
|
8906
10480
|
return {
|
8907
10481
|
header: {
|
@@ -8913,25 +10487,30 @@ var resolveDesignProps5 = (props) => {
|
|
8913
10487
|
}
|
8914
10488
|
};
|
8915
10489
|
};
|
8916
|
-
var PaymentMethod =
|
10490
|
+
var PaymentMethod = forwardRef5(({ children, className, portal, ...rest }, ref) => {
|
8917
10491
|
const props = resolveDesignProps5(rest);
|
8918
|
-
const { settings,
|
10492
|
+
const { data, settings, stripe, layout } = useEmbed();
|
8919
10493
|
const paymentMethod = useMemo6(() => {
|
8920
|
-
const
|
8921
|
-
|
8922
|
-
|
8923
|
-
|
8924
|
-
|
8925
|
-
|
8926
|
-
|
8927
|
-
|
10494
|
+
const { cardLast4, cardExpMonth, cardExpYear } = data.subscription?.paymentMethod || {};
|
10495
|
+
let monthsToExpiration;
|
10496
|
+
if (typeof cardExpYear === "number" && typeof cardExpMonth === "number") {
|
10497
|
+
const timeToExpiration = Math.round(
|
10498
|
+
+new Date(cardExpYear, cardExpMonth - 1) - +/* @__PURE__ */ new Date()
|
10499
|
+
);
|
10500
|
+
monthsToExpiration = Math.round(
|
10501
|
+
timeToExpiration / (1e3 * 60 * 60 * 24 * 30)
|
10502
|
+
);
|
10503
|
+
}
|
8928
10504
|
return {
|
8929
|
-
|
10505
|
+
cardLast4,
|
8930
10506
|
monthsToExpiration
|
8931
10507
|
};
|
8932
|
-
}, []);
|
8933
|
-
|
8934
|
-
|
10508
|
+
}, [data.subscription?.paymentMethod]);
|
10509
|
+
if (!stripe || !data.subscription?.paymentMethod) {
|
10510
|
+
return null;
|
10511
|
+
}
|
10512
|
+
return /* @__PURE__ */ jsxs7("div", { ref, className, children: [
|
10513
|
+
props.header.isVisible && /* @__PURE__ */ jsxs7(
|
8935
10514
|
Flex,
|
8936
10515
|
{
|
8937
10516
|
$justifyContent: "space-between",
|
@@ -8948,7 +10527,7 @@ var PaymentMethod = forwardRef6(({ children, className, portal, ...rest }, ref)
|
|
8948
10527
|
children: "Payment Method"
|
8949
10528
|
}
|
8950
10529
|
),
|
8951
|
-
Math.abs(paymentMethod.monthsToExpiration) < 4 && /* @__PURE__ */ jsx12(
|
10530
|
+
typeof paymentMethod.monthsToExpiration === "number" && Math.abs(paymentMethod.monthsToExpiration) < 4 && /* @__PURE__ */ jsx12(
|
8952
10531
|
Text,
|
8953
10532
|
{
|
8954
10533
|
$font: settings.theme.typography.text.fontFamily,
|
@@ -8960,7 +10539,7 @@ var PaymentMethod = forwardRef6(({ children, className, portal, ...rest }, ref)
|
|
8960
10539
|
]
|
8961
10540
|
}
|
8962
10541
|
),
|
8963
|
-
/* @__PURE__ */
|
10542
|
+
paymentMethod.cardLast4 && /* @__PURE__ */ jsx12(
|
8964
10543
|
Flex,
|
8965
10544
|
{
|
8966
10545
|
$justifyContent: "space-between",
|
@@ -8969,95 +10548,261 @@ var PaymentMethod = forwardRef6(({ children, className, portal, ...rest }, ref)
|
|
8969
10548
|
$background: `${hexToHSL(settings.theme.card.background).l > 50 ? darken(settings.theme.card.background, 10) : lighten(settings.theme.card.background, 20)}`,
|
8970
10549
|
$padding: "0.375rem 1rem",
|
8971
10550
|
$borderRadius: "9999px",
|
8972
|
-
children: [
|
8973
|
-
|
8974
|
-
|
8975
|
-
|
8976
|
-
] }),
|
8977
|
-
props.functions.allowEdit && /* @__PURE__ */ jsx12(
|
8978
|
-
Text,
|
8979
|
-
{
|
8980
|
-
tabIndex: 0,
|
8981
|
-
onClick: () => {
|
8982
|
-
if (layout !== "payment")
|
8983
|
-
return;
|
8984
|
-
setLayout("payment");
|
8985
|
-
},
|
8986
|
-
$font: settings.theme.typography.link.fontFamily,
|
8987
|
-
$size: settings.theme.typography.link.fontSize,
|
8988
|
-
$weight: settings.theme.typography.link.fontWeight,
|
8989
|
-
$color: settings.theme.typography.link.color,
|
8990
|
-
children: "Edit"
|
8991
|
-
}
|
8992
|
-
)
|
8993
|
-
]
|
10551
|
+
children: /* @__PURE__ */ jsxs7(Text, { $font: settings.theme.typography.text.fontFamily, $size: 14, children: [
|
10552
|
+
"\u{1F4B3} Card ending in ",
|
10553
|
+
paymentMethod.cardLast4
|
10554
|
+
] })
|
8994
10555
|
}
|
8995
10556
|
),
|
8996
10557
|
layout === "payment" && createPortal2(
|
8997
|
-
/* @__PURE__ */
|
8998
|
-
Box,
|
8999
|
-
|
9000
|
-
|
9001
|
-
|
9002
|
-
|
9003
|
-
|
9004
|
-
|
9005
|
-
|
9006
|
-
|
9007
|
-
|
9008
|
-
|
9009
|
-
|
9010
|
-
|
9011
|
-
|
9012
|
-
|
9013
|
-
|
9014
|
-
|
9015
|
-
|
9016
|
-
|
9017
|
-
|
9018
|
-
|
9019
|
-
|
9020
|
-
|
9021
|
-
|
9022
|
-
|
9023
|
-
|
9024
|
-
|
9025
|
-
|
9026
|
-
|
9027
|
-
|
9028
|
-
|
9029
|
-
|
9030
|
-
|
9031
|
-
|
9032
|
-
|
9033
|
-
|
9034
|
-
|
9035
|
-
|
9036
|
-
|
9037
|
-
|
9038
|
-
|
9039
|
-
|
9040
|
-
|
9041
|
-
|
9042
|
-
|
9043
|
-
|
9044
|
-
|
9045
|
-
|
9046
|
-
|
9047
|
-
|
9048
|
-
|
9049
|
-
|
9050
|
-
|
9051
|
-
|
9052
|
-
|
10558
|
+
/* @__PURE__ */ jsxs7(OverlayWrapper, { size: "md", children: [
|
10559
|
+
/* @__PURE__ */ jsx12(OverlayHeader, { children: /* @__PURE__ */ jsx12(Box, { $fontWeight: "600", children: "Edit payment method" }) }),
|
10560
|
+
/* @__PURE__ */ jsxs7(
|
10561
|
+
Flex,
|
10562
|
+
{
|
10563
|
+
$flexDirection: "column",
|
10564
|
+
$padding: "2.5rem",
|
10565
|
+
$height: "100%",
|
10566
|
+
$gap: "1.5rem",
|
10567
|
+
children: [
|
10568
|
+
/* @__PURE__ */ jsx12(
|
10569
|
+
Flex,
|
10570
|
+
{
|
10571
|
+
$flexDirection: "column",
|
10572
|
+
$gap: "1rem",
|
10573
|
+
$backgroundColor: "#FBFBFB",
|
10574
|
+
$borderRadius: "0 0 0.5rem 0.5rem",
|
10575
|
+
$flex: "1",
|
10576
|
+
$height: "100%",
|
10577
|
+
children: /* @__PURE__ */ jsxs7(Flex, { $flexDirection: "column", $height: "100%", children: [
|
10578
|
+
/* @__PURE__ */ jsx12(
|
10579
|
+
Box,
|
10580
|
+
{
|
10581
|
+
$fontSize: "18px",
|
10582
|
+
$marginBottom: "1.5rem",
|
10583
|
+
$display: "inline-block",
|
10584
|
+
$width: "100%",
|
10585
|
+
children: "Default"
|
10586
|
+
}
|
10587
|
+
),
|
10588
|
+
/* @__PURE__ */ jsxs7(Flex, { $gap: "1rem", children: [
|
10589
|
+
/* @__PURE__ */ jsx12(
|
10590
|
+
Flex,
|
10591
|
+
{
|
10592
|
+
$alignItems: "center",
|
10593
|
+
$padding: ".5rem 1rem",
|
10594
|
+
$border: "1px solid #E2E5E9",
|
10595
|
+
$borderRadius: ".5rem",
|
10596
|
+
$backgroundColor: "#ffffff",
|
10597
|
+
$flexDirection: "row",
|
10598
|
+
$gap: "1rem",
|
10599
|
+
$width: "100%",
|
10600
|
+
children: /* @__PURE__ */ jsxs7(
|
10601
|
+
Flex,
|
10602
|
+
{
|
10603
|
+
$flexDirection: "row",
|
10604
|
+
$justifyContent: "space-between",
|
10605
|
+
$flex: "1",
|
10606
|
+
children: [
|
10607
|
+
/* @__PURE__ */ jsxs7(
|
10608
|
+
Flex,
|
10609
|
+
{
|
10610
|
+
$flexDirection: "row",
|
10611
|
+
$alignItems: "center",
|
10612
|
+
$gap: "1rem",
|
10613
|
+
children: [
|
10614
|
+
/* @__PURE__ */ jsx12(Box, { $display: "inline-block", children: /* @__PURE__ */ jsx12(
|
10615
|
+
"svg",
|
10616
|
+
{
|
10617
|
+
viewBox: "0 0 24 16",
|
10618
|
+
fill: "none",
|
10619
|
+
xmlns: "http://www.w3.org/2000/svg",
|
10620
|
+
width: "26px",
|
10621
|
+
height: "auto",
|
10622
|
+
children: /* @__PURE__ */ jsxs7("g", { children: [
|
10623
|
+
/* @__PURE__ */ jsx12(
|
10624
|
+
"rect",
|
10625
|
+
{
|
10626
|
+
stroke: "#DDD",
|
10627
|
+
fill: "#FFF",
|
10628
|
+
x: ".25",
|
10629
|
+
y: ".25",
|
10630
|
+
width: "23",
|
10631
|
+
height: "15.5",
|
10632
|
+
rx: "2"
|
10633
|
+
}
|
10634
|
+
),
|
10635
|
+
/* @__PURE__ */ jsx12(
|
10636
|
+
"path",
|
10637
|
+
{
|
10638
|
+
d: "M2.788 5.914A7.201 7.201 0 0 0 1 5.237l.028-.125h2.737c.371.013.672.125.77.519l.595 2.836.182.854 1.666-4.21h1.799l-2.674 6.167H4.304L2.788 5.914Zm7.312 5.37H8.399l1.064-6.172h1.7L10.1 11.284Zm6.167-6.021-.232 1.333-.153-.066a3.054 3.054 0 0 0-1.268-.236c-.671 0-.972.269-.98.531 0 .29.365.48.96.762.98.44 1.435.979 1.428 1.681-.014 1.28-1.176 2.108-2.96 2.108-.764-.007-1.5-.158-1.898-.328l.238-1.386.224.099c.553.23.917.328 1.596.328.49 0 1.015-.19 1.022-.604 0-.27-.224-.466-.882-.769-.644-.295-1.505-.788-1.491-1.674C11.878 5.84 13.06 5 14.74 5c.658 0 1.19.138 1.526.263Zm2.26 3.834h1.415c-.07-.308-.392-1.786-.392-1.786l-.12-.531c-.083.23-.23.604-.223.59l-.68 1.727Zm2.1-3.985L22 11.284h-1.575s-.154-.71-.203-.926h-2.184l-.357.926h-1.785l2.527-5.66c.175-.4.483-.512.889-.512h1.316Z",
|
10639
|
+
fill: "#1434CB"
|
10640
|
+
}
|
10641
|
+
)
|
10642
|
+
] })
|
10643
|
+
}
|
10644
|
+
) }),
|
10645
|
+
/* @__PURE__ */ jsx12(Box, { $whiteSpace: "nowrap", children: "Visa **** 4242" })
|
10646
|
+
]
|
10647
|
+
}
|
10648
|
+
),
|
10649
|
+
/* @__PURE__ */ jsx12(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx12(Box, { $fontSize: "12px", $color: "#5D5D5D", children: "Expires: 3/30" }) })
|
10650
|
+
]
|
10651
|
+
}
|
10652
|
+
)
|
10653
|
+
}
|
10654
|
+
),
|
10655
|
+
/* @__PURE__ */ jsx12(Flex, { children: /* @__PURE__ */ jsx12(
|
10656
|
+
StyledButton,
|
10657
|
+
{
|
10658
|
+
$size: "sm",
|
10659
|
+
$color: "secondary",
|
10660
|
+
$variant: "outline",
|
10661
|
+
style: {
|
10662
|
+
whiteSpace: "nowrap",
|
10663
|
+
paddingLeft: "1rem",
|
10664
|
+
paddingRight: "1rem"
|
10665
|
+
},
|
10666
|
+
children: "Edit"
|
10667
|
+
}
|
10668
|
+
) })
|
10669
|
+
] })
|
10670
|
+
] })
|
10671
|
+
}
|
10672
|
+
),
|
10673
|
+
/* @__PURE__ */ jsx12(
|
10674
|
+
Flex,
|
10675
|
+
{
|
10676
|
+
$flexDirection: "column",
|
10677
|
+
$gap: "1rem",
|
10678
|
+
$backgroundColor: "#FBFBFB",
|
10679
|
+
$borderRadius: "0 0 0.5rem 0.5rem",
|
10680
|
+
$flex: "1",
|
10681
|
+
$height: "100%",
|
10682
|
+
children: /* @__PURE__ */ jsxs7(Flex, { $flexDirection: "column", $height: "100%", children: [
|
10683
|
+
/* @__PURE__ */ jsx12(
|
10684
|
+
Box,
|
10685
|
+
{
|
10686
|
+
$fontSize: "18px",
|
10687
|
+
$marginBottom: "1.5rem",
|
10688
|
+
$display: "inline-block",
|
10689
|
+
$width: "100%",
|
10690
|
+
children: "Others"
|
10691
|
+
}
|
10692
|
+
),
|
10693
|
+
/* @__PURE__ */ jsxs7(Flex, { $gap: "1rem", children: [
|
10694
|
+
/* @__PURE__ */ jsx12(
|
10695
|
+
Flex,
|
10696
|
+
{
|
10697
|
+
$alignItems: "center",
|
10698
|
+
$padding: ".5rem 1rem",
|
10699
|
+
$border: "1px solid #E2E5E9",
|
10700
|
+
$borderRadius: ".5rem",
|
10701
|
+
$backgroundColor: "#ffffff",
|
10702
|
+
$flexDirection: "row",
|
10703
|
+
$gap: "1rem",
|
10704
|
+
$width: "100%",
|
10705
|
+
children: /* @__PURE__ */ jsxs7(
|
10706
|
+
Flex,
|
10707
|
+
{
|
10708
|
+
$flexDirection: "row",
|
10709
|
+
$justifyContent: "space-between",
|
10710
|
+
$flex: "1",
|
10711
|
+
children: [
|
10712
|
+
/* @__PURE__ */ jsxs7(
|
10713
|
+
Flex,
|
10714
|
+
{
|
10715
|
+
$flexDirection: "row",
|
10716
|
+
$alignItems: "center",
|
10717
|
+
$gap: "1rem",
|
10718
|
+
children: [
|
10719
|
+
/* @__PURE__ */ jsx12(Box, { $display: "inline-block", children: /* @__PURE__ */ jsx12(
|
10720
|
+
"svg",
|
10721
|
+
{
|
10722
|
+
viewBox: "0 0 24 16",
|
10723
|
+
fill: "none",
|
10724
|
+
xmlns: "http://www.w3.org/2000/svg",
|
10725
|
+
width: "26px",
|
10726
|
+
height: "auto",
|
10727
|
+
children: /* @__PURE__ */ jsxs7("g", { children: [
|
10728
|
+
/* @__PURE__ */ jsx12(
|
10729
|
+
"rect",
|
10730
|
+
{
|
10731
|
+
stroke: "#DDD",
|
10732
|
+
fill: "#FFF",
|
10733
|
+
x: ".25",
|
10734
|
+
y: ".25",
|
10735
|
+
width: "23",
|
10736
|
+
height: "15.5",
|
10737
|
+
rx: "2"
|
10738
|
+
}
|
10739
|
+
),
|
10740
|
+
/* @__PURE__ */ jsx12(
|
10741
|
+
"path",
|
10742
|
+
{
|
10743
|
+
d: "M2.788 5.914A7.201 7.201 0 0 0 1 5.237l.028-.125h2.737c.371.013.672.125.77.519l.595 2.836.182.854 1.666-4.21h1.799l-2.674 6.167H4.304L2.788 5.914Zm7.312 5.37H8.399l1.064-6.172h1.7L10.1 11.284Zm6.167-6.021-.232 1.333-.153-.066a3.054 3.054 0 0 0-1.268-.236c-.671 0-.972.269-.98.531 0 .29.365.48.96.762.98.44 1.435.979 1.428 1.681-.014 1.28-1.176 2.108-2.96 2.108-.764-.007-1.5-.158-1.898-.328l.238-1.386.224.099c.553.23.917.328 1.596.328.49 0 1.015-.19 1.022-.604 0-.27-.224-.466-.882-.769-.644-.295-1.505-.788-1.491-1.674C11.878 5.84 13.06 5 14.74 5c.658 0 1.19.138 1.526.263Zm2.26 3.834h1.415c-.07-.308-.392-1.786-.392-1.786l-.12-.531c-.083.23-.23.604-.223.59l-.68 1.727Zm2.1-3.985L22 11.284h-1.575s-.154-.71-.203-.926h-2.184l-.357.926h-1.785l2.527-5.66c.175-.4.483-.512.889-.512h1.316Z",
|
10744
|
+
fill: "#1434CB"
|
10745
|
+
}
|
10746
|
+
)
|
10747
|
+
] })
|
10748
|
+
}
|
10749
|
+
) }),
|
10750
|
+
/* @__PURE__ */ jsx12(Box, { $whiteSpace: "nowrap", children: "Visa **** 2929" })
|
10751
|
+
]
|
10752
|
+
}
|
10753
|
+
),
|
10754
|
+
/* @__PURE__ */ jsx12(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx12(Box, { $fontSize: "12px", $color: "#5D5D5D", children: "Expires: 3/30" }) })
|
10755
|
+
]
|
10756
|
+
}
|
10757
|
+
)
|
10758
|
+
}
|
10759
|
+
),
|
10760
|
+
/* @__PURE__ */ jsxs7(Flex, { $gap: "1rem", children: [
|
10761
|
+
/* @__PURE__ */ jsx12(
|
10762
|
+
StyledButton,
|
10763
|
+
{
|
10764
|
+
$size: "sm",
|
10765
|
+
$color: "secondary",
|
10766
|
+
$variant: "outline",
|
10767
|
+
style: {
|
10768
|
+
whiteSpace: "nowrap",
|
10769
|
+
paddingLeft: "1rem",
|
10770
|
+
paddingRight: "1rem"
|
10771
|
+
},
|
10772
|
+
children: "Make Default"
|
10773
|
+
}
|
10774
|
+
),
|
10775
|
+
/* @__PURE__ */ jsx12(
|
10776
|
+
StyledButton,
|
10777
|
+
{
|
10778
|
+
$size: "sm",
|
10779
|
+
$color: "secondary",
|
10780
|
+
$variant: "outline",
|
10781
|
+
style: {
|
10782
|
+
whiteSpace: "nowrap",
|
10783
|
+
paddingLeft: "1rem",
|
10784
|
+
paddingRight: "1rem"
|
10785
|
+
},
|
10786
|
+
children: "Edit"
|
10787
|
+
}
|
10788
|
+
)
|
10789
|
+
] })
|
10790
|
+
] })
|
10791
|
+
] })
|
10792
|
+
}
|
10793
|
+
)
|
10794
|
+
]
|
10795
|
+
}
|
10796
|
+
)
|
10797
|
+
] }),
|
9053
10798
|
portal || document.body
|
9054
10799
|
)
|
9055
10800
|
] });
|
9056
10801
|
});
|
9057
10802
|
|
9058
10803
|
// src/components/elements/invoices/Invoices.tsx
|
9059
|
-
import { forwardRef as
|
9060
|
-
import { jsx as jsx13, jsxs as
|
10804
|
+
import { forwardRef as forwardRef6, useMemo as useMemo7 } from "react";
|
10805
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
9061
10806
|
function resolveDesignProps6(props) {
|
9062
10807
|
return {
|
9063
10808
|
header: {
|
@@ -9082,7 +10827,7 @@ function resolveDesignProps6(props) {
|
|
9082
10827
|
}
|
9083
10828
|
};
|
9084
10829
|
}
|
9085
|
-
var Invoices =
|
10830
|
+
var Invoices = forwardRef6(({ className, ...rest }, ref) => {
|
9086
10831
|
const props = resolveDesignProps6(rest);
|
9087
10832
|
const { settings } = useEmbed();
|
9088
10833
|
const { invoices } = useMemo7(() => {
|
@@ -9099,7 +10844,7 @@ var Invoices = forwardRef7(({ className, ...rest }, ref) => {
|
|
9099
10844
|
]
|
9100
10845
|
};
|
9101
10846
|
}, []);
|
9102
|
-
return /* @__PURE__ */ jsx13("div", { ref, className, children: /* @__PURE__ */
|
10847
|
+
return /* @__PURE__ */ jsx13("div", { ref, className, children: /* @__PURE__ */ jsxs8(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
9103
10848
|
props.header.isVisible && /* @__PURE__ */ jsx13(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ jsx13(
|
9104
10849
|
Text,
|
9105
10850
|
{
|
@@ -9114,7 +10859,7 @@ var Invoices = forwardRef7(({ className, ...rest }, ref) => {
|
|
9114
10859
|
0,
|
9115
10860
|
props.limit.isVisible && props.limit.number || invoices.length
|
9116
10861
|
).map(({ date, amount }, index) => {
|
9117
|
-
return /* @__PURE__ */
|
10862
|
+
return /* @__PURE__ */ jsxs8(Flex, { $justifyContent: "space-between", children: [
|
9118
10863
|
props.date.isVisible && /* @__PURE__ */ jsx13(
|
9119
10864
|
Text,
|
9120
10865
|
{
|
@@ -9125,7 +10870,7 @@ var Invoices = forwardRef7(({ className, ...rest }, ref) => {
|
|
9125
10870
|
children: toPrettyDate(date)
|
9126
10871
|
}
|
9127
10872
|
),
|
9128
|
-
props.amount.isVisible && /* @__PURE__ */
|
10873
|
+
props.amount.isVisible && /* @__PURE__ */ jsxs8(
|
9129
10874
|
Text,
|
9130
10875
|
{
|
9131
10876
|
$font: settings.theme.typography[props.amount.fontStyle].fontFamily,
|
@@ -9140,7 +10885,7 @@ var Invoices = forwardRef7(({ className, ...rest }, ref) => {
|
|
9140
10885
|
)
|
9141
10886
|
] }, index);
|
9142
10887
|
}) }),
|
9143
|
-
props.collapse.isVisible && /* @__PURE__ */
|
10888
|
+
props.collapse.isVisible && /* @__PURE__ */ jsxs8(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
|
9144
10889
|
/* @__PURE__ */ jsx13(Icon2, { name: "chevron-down", style: { color: "#D0D0D0" } }),
|
9145
10890
|
/* @__PURE__ */ jsx13(
|
9146
10891
|
Text,
|
@@ -9157,20 +10902,159 @@ var Invoices = forwardRef7(({ className, ...rest }, ref) => {
|
|
9157
10902
|
});
|
9158
10903
|
|
9159
10904
|
// src/components/embed/ComponentTree.tsx
|
9160
|
-
import { useEffect as useEffect4, useState as
|
10905
|
+
import { useEffect as useEffect4, useState as useState6 } from "react";
|
9161
10906
|
|
9162
10907
|
// src/components/embed/renderer.ts
|
9163
10908
|
import { createElement } from "react";
|
10909
|
+
|
10910
|
+
// src/components/layout/root/Root.tsx
|
10911
|
+
import { forwardRef as forwardRef7 } from "react";
|
10912
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
10913
|
+
var Root = forwardRef7(
|
10914
|
+
(props, ref) => {
|
10915
|
+
return /* @__PURE__ */ jsx14("div", { ref, ...props });
|
10916
|
+
}
|
10917
|
+
);
|
10918
|
+
|
10919
|
+
// src/components/layout/viewport/Viewport.tsx
|
10920
|
+
import { forwardRef as forwardRef8 } from "react";
|
10921
|
+
|
10922
|
+
// src/components/layout/viewport/styles.ts
|
10923
|
+
var StyledViewport = dt.div`
|
10924
|
+
display: flex;
|
10925
|
+
flex-wrap: wrap;
|
10926
|
+
margin-left: auto;
|
10927
|
+
margin-right: auto;
|
10928
|
+
`;
|
10929
|
+
|
10930
|
+
// src/components/layout/viewport/Viewport.tsx
|
10931
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
10932
|
+
var Viewport = forwardRef8(
|
10933
|
+
({ children, ...props }, ref) => {
|
10934
|
+
const { settings, layout } = useEmbed();
|
10935
|
+
return /* @__PURE__ */ jsx15(
|
10936
|
+
StyledViewport,
|
10937
|
+
{
|
10938
|
+
ref,
|
10939
|
+
$numberOfColumns: settings.theme.numberOfColumns,
|
10940
|
+
...props,
|
10941
|
+
children: layout === "disabled" ? /* @__PURE__ */ jsx15("div", { className: "", children: "DISABLED" }) : children
|
10942
|
+
}
|
10943
|
+
);
|
10944
|
+
}
|
10945
|
+
);
|
10946
|
+
|
10947
|
+
// src/components/layout/column/Column.tsx
|
10948
|
+
import { forwardRef as forwardRef10 } from "react";
|
10949
|
+
|
10950
|
+
// src/components/layout/card/Card.tsx
|
10951
|
+
import { forwardRef as forwardRef9 } from "react";
|
10952
|
+
|
10953
|
+
// src/components/layout/card/styles.ts
|
10954
|
+
var StyledCard = dt.div(
|
10955
|
+
({
|
10956
|
+
theme,
|
10957
|
+
$sectionLayout = "merged",
|
10958
|
+
$borderRadius = 8,
|
10959
|
+
$padding = 48,
|
10960
|
+
$shadow = true
|
10961
|
+
}) => {
|
10962
|
+
return lt`
|
10963
|
+
box-sizing: border-box;
|
10964
|
+
font-size: ${TEXT_BASE_SIZE}px;
|
10965
|
+
|
10966
|
+
*,
|
10967
|
+
*::before,
|
10968
|
+
*::after {
|
10969
|
+
box-sizing: inherit;
|
10970
|
+
}
|
10971
|
+
|
10972
|
+
> * {
|
10973
|
+
padding: ${$padding * 0.75 / TEXT_BASE_SIZE}rem
|
10974
|
+
${$padding / TEXT_BASE_SIZE}rem;
|
10975
|
+
color: ${theme.typography.text.color};
|
10976
|
+
}
|
10977
|
+
|
10978
|
+
${() => {
|
10979
|
+
const { l: l2 } = hexToHSL(theme.card.background);
|
10980
|
+
const borderColor = l2 > 50 ? darken(theme.card.background, 10) : lighten(theme.card.background, 30);
|
10981
|
+
const borderRadius = `${$borderRadius / TEXT_BASE_SIZE}rem`;
|
10982
|
+
const boxShadow = "0px 1px 20px 0px #1018280F, 0px 1px 3px 0px #1018281A";
|
10983
|
+
if ($sectionLayout === "merged") {
|
10984
|
+
return lt`
|
10985
|
+
background: ${({ theme: theme2 }) => theme2.card.background};
|
10986
|
+
border-radius: ${borderRadius};
|
10987
|
+
|
10988
|
+
${$shadow && `box-shadow: ${boxShadow};`}
|
10989
|
+
|
10990
|
+
> :not(:last-child) {
|
10991
|
+
border-bottom: 1px solid ${borderColor};
|
10992
|
+
}
|
10993
|
+
`;
|
10994
|
+
}
|
10995
|
+
return lt`
|
10996
|
+
> :not(:last-child) {
|
10997
|
+
margin-bottom: 1rem;
|
10998
|
+
}
|
10999
|
+
|
11000
|
+
> * {
|
11001
|
+
background: ${theme.card.background};
|
11002
|
+
border-radius: ${borderRadius};
|
11003
|
+
${$shadow && `box-shadow: ${boxShadow};`}
|
11004
|
+
}
|
11005
|
+
`;
|
11006
|
+
}}
|
11007
|
+
`;
|
11008
|
+
}
|
11009
|
+
);
|
11010
|
+
|
11011
|
+
// src/components/layout/card/Card.tsx
|
11012
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
11013
|
+
var Card = forwardRef9(
|
11014
|
+
({ children, className }, ref) => {
|
11015
|
+
const { settings } = useEmbed();
|
11016
|
+
return /* @__PURE__ */ jsx16(
|
11017
|
+
StyledCard,
|
11018
|
+
{
|
11019
|
+
ref,
|
11020
|
+
className,
|
11021
|
+
$sectionLayout: settings.theme?.sectionLayout,
|
11022
|
+
$borderRadius: settings.theme?.card?.borderRadius,
|
11023
|
+
$padding: settings.theme?.card?.padding,
|
11024
|
+
$shadow: settings.theme?.card?.hasShadow,
|
11025
|
+
children
|
11026
|
+
}
|
11027
|
+
);
|
11028
|
+
}
|
11029
|
+
);
|
11030
|
+
|
11031
|
+
// src/components/layout/column/styles.ts
|
11032
|
+
var StyledColumn = dt.div`
|
11033
|
+
flex-grow: 1;
|
11034
|
+
padding: 0.75rem;
|
11035
|
+
`;
|
11036
|
+
|
11037
|
+
// src/components/layout/column/Column.tsx
|
11038
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
11039
|
+
var Column = forwardRef10(
|
11040
|
+
({ children, ...props }, ref) => {
|
11041
|
+
return /* @__PURE__ */ jsx17(StyledColumn, { ref, ...props, children: /* @__PURE__ */ jsx17(Card, { children }) });
|
11042
|
+
}
|
11043
|
+
);
|
11044
|
+
|
11045
|
+
// src/components/embed/renderer.ts
|
9164
11046
|
var components = {
|
11047
|
+
Root,
|
11048
|
+
Viewport,
|
11049
|
+
Column,
|
9165
11050
|
Card,
|
9166
11051
|
PlanManager,
|
9167
11052
|
IncludedFeatures,
|
9168
11053
|
UpcomingBill,
|
9169
|
-
PaymentMethod
|
9170
|
-
MeteredFeatures
|
11054
|
+
PaymentMethod
|
9171
11055
|
};
|
9172
11056
|
function createRenderer(options) {
|
9173
|
-
const { useFallback =
|
11057
|
+
const { useFallback = false } = options || {};
|
9174
11058
|
return function renderNode(node2, index) {
|
9175
11059
|
const { type, props = {}, custom = {}, children } = node2;
|
9176
11060
|
const name = typeof type !== "string" ? type.resolvedName : type;
|
@@ -9191,8 +11075,8 @@ function createRenderer(options) {
|
|
9191
11075
|
component,
|
9192
11076
|
{
|
9193
11077
|
className,
|
9194
|
-
...component !== "div" && { resolvedProps },
|
9195
|
-
...Object.keys(custom).length > 0 && { custom },
|
11078
|
+
...component !== "div" && { ...resolvedProps },
|
11079
|
+
...component !== "div" && Object.keys(custom).length > 0 && { custom },
|
9196
11080
|
key: index
|
9197
11081
|
},
|
9198
11082
|
resolvedChildren
|
@@ -9201,35 +11085,36 @@ function createRenderer(options) {
|
|
9201
11085
|
}
|
9202
11086
|
|
9203
11087
|
// src/components/embed/ComponentTree.tsx
|
9204
|
-
import { Fragment as
|
11088
|
+
import { Fragment as Fragment2, jsx as jsx18 } from "react/jsx-runtime";
|
9205
11089
|
var ComponentTree = () => {
|
9206
|
-
const [children, setChildren] =
|
11090
|
+
const [children, setChildren] = useState6("Loading");
|
9207
11091
|
const { error, nodes } = useEmbed();
|
9208
11092
|
useEffect4(() => {
|
9209
11093
|
const renderer = createRenderer();
|
9210
11094
|
setChildren(nodes.map(renderer));
|
9211
11095
|
}, [nodes]);
|
9212
11096
|
if (error) {
|
9213
|
-
return /* @__PURE__ */
|
11097
|
+
return /* @__PURE__ */ jsx18("div", { children: error.message });
|
9214
11098
|
}
|
9215
|
-
return /* @__PURE__ */
|
11099
|
+
return /* @__PURE__ */ jsx18(Fragment2, { children });
|
9216
11100
|
};
|
9217
11101
|
|
9218
11102
|
// src/components/embed/Embed.tsx
|
9219
|
-
import { jsx as
|
11103
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
9220
11104
|
var SchematicEmbed = ({ id, accessToken, apiConfig }) => {
|
9221
11105
|
if (accessToken?.length === 0) {
|
9222
|
-
return /* @__PURE__ */
|
11106
|
+
return /* @__PURE__ */ jsx19("div", { children: "Please provide an access token." });
|
9223
11107
|
}
|
9224
11108
|
if (!accessToken?.startsWith("token_")) {
|
9225
|
-
return /* @__PURE__ */
|
11109
|
+
return /* @__PURE__ */ jsx19("div", { children: 'Invalid access token; your temporary access token will start with "token_".' });
|
9226
11110
|
}
|
9227
|
-
return /* @__PURE__ */
|
11111
|
+
return /* @__PURE__ */ jsx19(EmbedProvider, { id, accessToken, apiConfig, children: /* @__PURE__ */ jsx19(ComponentTree, {}) });
|
9228
11112
|
};
|
9229
11113
|
export {
|
9230
11114
|
Box,
|
9231
11115
|
Button2 as Button,
|
9232
11116
|
Card,
|
11117
|
+
Column,
|
9233
11118
|
EmbedContext,
|
9234
11119
|
EmbedProvider,
|
9235
11120
|
Flex,
|
@@ -9238,14 +11123,19 @@ export {
|
|
9238
11123
|
IncludedFeatures,
|
9239
11124
|
Invoices,
|
9240
11125
|
MeteredFeatures,
|
11126
|
+
OverlayHeader,
|
11127
|
+
OverlaySideBar,
|
11128
|
+
OverlayWrapper,
|
9241
11129
|
PaymentMethod,
|
9242
11130
|
PlanManager,
|
9243
11131
|
ProgressBar,
|
11132
|
+
Root,
|
9244
11133
|
Schematic,
|
9245
11134
|
SchematicEmbed,
|
9246
11135
|
SchematicProvider,
|
9247
11136
|
Text,
|
9248
11137
|
UpcomingBill,
|
11138
|
+
Viewport,
|
9249
11139
|
defaultSettings,
|
9250
11140
|
defaultTheme,
|
9251
11141
|
useEmbed,
|