@schematichq/schematic-react 0.2.0-rc.2 → 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 +1100 -328
- package/dist/schematic-react.d.ts +357 -3
- package/dist/schematic-react.esm.js +1100 -328
- package/package.json +4 -2
@@ -67,6 +67,728 @@ var require_shallowequal = __commonJS({
|
|
67
67
|
}
|
68
68
|
});
|
69
69
|
|
70
|
+
// node_modules/lodash.merge/index.js
|
71
|
+
var require_lodash = __commonJS({
|
72
|
+
"node_modules/lodash.merge/index.js"(exports, module2) {
|
73
|
+
var LARGE_ARRAY_SIZE = 200;
|
74
|
+
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
75
|
+
var HOT_COUNT = 800;
|
76
|
+
var HOT_SPAN = 16;
|
77
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
78
|
+
var argsTag = "[object Arguments]";
|
79
|
+
var arrayTag = "[object Array]";
|
80
|
+
var asyncTag = "[object AsyncFunction]";
|
81
|
+
var boolTag = "[object Boolean]";
|
82
|
+
var dateTag = "[object Date]";
|
83
|
+
var errorTag = "[object Error]";
|
84
|
+
var funcTag = "[object Function]";
|
85
|
+
var genTag = "[object GeneratorFunction]";
|
86
|
+
var mapTag = "[object Map]";
|
87
|
+
var numberTag = "[object Number]";
|
88
|
+
var nullTag = "[object Null]";
|
89
|
+
var objectTag = "[object Object]";
|
90
|
+
var proxyTag = "[object Proxy]";
|
91
|
+
var regexpTag = "[object RegExp]";
|
92
|
+
var setTag = "[object Set]";
|
93
|
+
var stringTag = "[object String]";
|
94
|
+
var undefinedTag = "[object Undefined]";
|
95
|
+
var weakMapTag = "[object WeakMap]";
|
96
|
+
var arrayBufferTag = "[object ArrayBuffer]";
|
97
|
+
var dataViewTag = "[object DataView]";
|
98
|
+
var float32Tag = "[object Float32Array]";
|
99
|
+
var float64Tag = "[object Float64Array]";
|
100
|
+
var int8Tag = "[object Int8Array]";
|
101
|
+
var int16Tag = "[object Int16Array]";
|
102
|
+
var int32Tag = "[object Int32Array]";
|
103
|
+
var uint8Tag = "[object Uint8Array]";
|
104
|
+
var uint8ClampedTag = "[object Uint8ClampedArray]";
|
105
|
+
var uint16Tag = "[object Uint16Array]";
|
106
|
+
var uint32Tag = "[object Uint32Array]";
|
107
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
108
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
109
|
+
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
110
|
+
var typedArrayTags = {};
|
111
|
+
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
|
112
|
+
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;
|
113
|
+
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
114
|
+
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
115
|
+
var root = freeGlobal || freeSelf || Function("return this")();
|
116
|
+
var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
|
117
|
+
var freeModule = freeExports && typeof module2 == "object" && module2 && !module2.nodeType && module2;
|
118
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
119
|
+
var freeProcess = moduleExports && freeGlobal.process;
|
120
|
+
var nodeUtil = function() {
|
121
|
+
try {
|
122
|
+
var types = freeModule && freeModule.require && freeModule.require("util").types;
|
123
|
+
if (types) {
|
124
|
+
return types;
|
125
|
+
}
|
126
|
+
return freeProcess && freeProcess.binding && freeProcess.binding("util");
|
127
|
+
} catch (e) {
|
128
|
+
}
|
129
|
+
}();
|
130
|
+
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
131
|
+
function apply(func, thisArg, args) {
|
132
|
+
switch (args.length) {
|
133
|
+
case 0:
|
134
|
+
return func.call(thisArg);
|
135
|
+
case 1:
|
136
|
+
return func.call(thisArg, args[0]);
|
137
|
+
case 2:
|
138
|
+
return func.call(thisArg, args[0], args[1]);
|
139
|
+
case 3:
|
140
|
+
return func.call(thisArg, args[0], args[1], args[2]);
|
141
|
+
}
|
142
|
+
return func.apply(thisArg, args);
|
143
|
+
}
|
144
|
+
function baseTimes(n, iteratee) {
|
145
|
+
var index = -1, result = Array(n);
|
146
|
+
while (++index < n) {
|
147
|
+
result[index] = iteratee(index);
|
148
|
+
}
|
149
|
+
return result;
|
150
|
+
}
|
151
|
+
function baseUnary(func) {
|
152
|
+
return function(value) {
|
153
|
+
return func(value);
|
154
|
+
};
|
155
|
+
}
|
156
|
+
function getValue(object, key) {
|
157
|
+
return object == null ? void 0 : object[key];
|
158
|
+
}
|
159
|
+
function overArg(func, transform) {
|
160
|
+
return function(arg) {
|
161
|
+
return func(transform(arg));
|
162
|
+
};
|
163
|
+
}
|
164
|
+
var arrayProto = Array.prototype;
|
165
|
+
var funcProto = Function.prototype;
|
166
|
+
var objectProto = Object.prototype;
|
167
|
+
var coreJsData = root["__core-js_shared__"];
|
168
|
+
var funcToString = funcProto.toString;
|
169
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
170
|
+
var maskSrcKey = function() {
|
171
|
+
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
|
172
|
+
return uid ? "Symbol(src)_1." + uid : "";
|
173
|
+
}();
|
174
|
+
var nativeObjectToString = objectProto.toString;
|
175
|
+
var objectCtorString = funcToString.call(Object);
|
176
|
+
var reIsNative = RegExp(
|
177
|
+
"^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
178
|
+
);
|
179
|
+
var Buffer2 = moduleExports ? root.Buffer : void 0;
|
180
|
+
var Symbol2 = root.Symbol;
|
181
|
+
var Uint8Array2 = root.Uint8Array;
|
182
|
+
var allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
|
183
|
+
var getPrototype = overArg(Object.getPrototypeOf, Object);
|
184
|
+
var objectCreate = Object.create;
|
185
|
+
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
186
|
+
var splice = arrayProto.splice;
|
187
|
+
var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
|
188
|
+
var defineProperty = function() {
|
189
|
+
try {
|
190
|
+
var func = getNative(Object, "defineProperty");
|
191
|
+
func({}, "", {});
|
192
|
+
return func;
|
193
|
+
} catch (e) {
|
194
|
+
}
|
195
|
+
}();
|
196
|
+
var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
|
197
|
+
var nativeMax = Math.max;
|
198
|
+
var nativeNow = Date.now;
|
199
|
+
var Map2 = getNative(root, "Map");
|
200
|
+
var nativeCreate = getNative(Object, "create");
|
201
|
+
var baseCreate = /* @__PURE__ */ function() {
|
202
|
+
function object() {
|
203
|
+
}
|
204
|
+
return function(proto) {
|
205
|
+
if (!isObject(proto)) {
|
206
|
+
return {};
|
207
|
+
}
|
208
|
+
if (objectCreate) {
|
209
|
+
return objectCreate(proto);
|
210
|
+
}
|
211
|
+
object.prototype = proto;
|
212
|
+
var result = new object();
|
213
|
+
object.prototype = void 0;
|
214
|
+
return result;
|
215
|
+
};
|
216
|
+
}();
|
217
|
+
function Hash(entries) {
|
218
|
+
var index = -1, length2 = entries == null ? 0 : entries.length;
|
219
|
+
this.clear();
|
220
|
+
while (++index < length2) {
|
221
|
+
var entry = entries[index];
|
222
|
+
this.set(entry[0], entry[1]);
|
223
|
+
}
|
224
|
+
}
|
225
|
+
function hashClear() {
|
226
|
+
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
227
|
+
this.size = 0;
|
228
|
+
}
|
229
|
+
function hashDelete(key) {
|
230
|
+
var result = this.has(key) && delete this.__data__[key];
|
231
|
+
this.size -= result ? 1 : 0;
|
232
|
+
return result;
|
233
|
+
}
|
234
|
+
function hashGet(key) {
|
235
|
+
var data = this.__data__;
|
236
|
+
if (nativeCreate) {
|
237
|
+
var result = data[key];
|
238
|
+
return result === HASH_UNDEFINED ? void 0 : result;
|
239
|
+
}
|
240
|
+
return hasOwnProperty.call(data, key) ? data[key] : void 0;
|
241
|
+
}
|
242
|
+
function hashHas(key) {
|
243
|
+
var data = this.__data__;
|
244
|
+
return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
|
245
|
+
}
|
246
|
+
function hashSet(key, value) {
|
247
|
+
var data = this.__data__;
|
248
|
+
this.size += this.has(key) ? 0 : 1;
|
249
|
+
data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
|
250
|
+
return this;
|
251
|
+
}
|
252
|
+
Hash.prototype.clear = hashClear;
|
253
|
+
Hash.prototype["delete"] = hashDelete;
|
254
|
+
Hash.prototype.get = hashGet;
|
255
|
+
Hash.prototype.has = hashHas;
|
256
|
+
Hash.prototype.set = hashSet;
|
257
|
+
function ListCache(entries) {
|
258
|
+
var index = -1, length2 = entries == null ? 0 : entries.length;
|
259
|
+
this.clear();
|
260
|
+
while (++index < length2) {
|
261
|
+
var entry = entries[index];
|
262
|
+
this.set(entry[0], entry[1]);
|
263
|
+
}
|
264
|
+
}
|
265
|
+
function listCacheClear() {
|
266
|
+
this.__data__ = [];
|
267
|
+
this.size = 0;
|
268
|
+
}
|
269
|
+
function listCacheDelete(key) {
|
270
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
271
|
+
if (index < 0) {
|
272
|
+
return false;
|
273
|
+
}
|
274
|
+
var lastIndex = data.length - 1;
|
275
|
+
if (index == lastIndex) {
|
276
|
+
data.pop();
|
277
|
+
} else {
|
278
|
+
splice.call(data, index, 1);
|
279
|
+
}
|
280
|
+
--this.size;
|
281
|
+
return true;
|
282
|
+
}
|
283
|
+
function listCacheGet(key) {
|
284
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
285
|
+
return index < 0 ? void 0 : data[index][1];
|
286
|
+
}
|
287
|
+
function listCacheHas(key) {
|
288
|
+
return assocIndexOf(this.__data__, key) > -1;
|
289
|
+
}
|
290
|
+
function listCacheSet(key, value) {
|
291
|
+
var data = this.__data__, index = assocIndexOf(data, key);
|
292
|
+
if (index < 0) {
|
293
|
+
++this.size;
|
294
|
+
data.push([key, value]);
|
295
|
+
} else {
|
296
|
+
data[index][1] = value;
|
297
|
+
}
|
298
|
+
return this;
|
299
|
+
}
|
300
|
+
ListCache.prototype.clear = listCacheClear;
|
301
|
+
ListCache.prototype["delete"] = listCacheDelete;
|
302
|
+
ListCache.prototype.get = listCacheGet;
|
303
|
+
ListCache.prototype.has = listCacheHas;
|
304
|
+
ListCache.prototype.set = listCacheSet;
|
305
|
+
function MapCache(entries) {
|
306
|
+
var index = -1, length2 = entries == null ? 0 : entries.length;
|
307
|
+
this.clear();
|
308
|
+
while (++index < length2) {
|
309
|
+
var entry = entries[index];
|
310
|
+
this.set(entry[0], entry[1]);
|
311
|
+
}
|
312
|
+
}
|
313
|
+
function mapCacheClear() {
|
314
|
+
this.size = 0;
|
315
|
+
this.__data__ = {
|
316
|
+
"hash": new Hash(),
|
317
|
+
"map": new (Map2 || ListCache)(),
|
318
|
+
"string": new Hash()
|
319
|
+
};
|
320
|
+
}
|
321
|
+
function mapCacheDelete(key) {
|
322
|
+
var result = getMapData(this, key)["delete"](key);
|
323
|
+
this.size -= result ? 1 : 0;
|
324
|
+
return result;
|
325
|
+
}
|
326
|
+
function mapCacheGet(key) {
|
327
|
+
return getMapData(this, key).get(key);
|
328
|
+
}
|
329
|
+
function mapCacheHas(key) {
|
330
|
+
return getMapData(this, key).has(key);
|
331
|
+
}
|
332
|
+
function mapCacheSet(key, value) {
|
333
|
+
var data = getMapData(this, key), size = data.size;
|
334
|
+
data.set(key, value);
|
335
|
+
this.size += data.size == size ? 0 : 1;
|
336
|
+
return this;
|
337
|
+
}
|
338
|
+
MapCache.prototype.clear = mapCacheClear;
|
339
|
+
MapCache.prototype["delete"] = mapCacheDelete;
|
340
|
+
MapCache.prototype.get = mapCacheGet;
|
341
|
+
MapCache.prototype.has = mapCacheHas;
|
342
|
+
MapCache.prototype.set = mapCacheSet;
|
343
|
+
function Stack(entries) {
|
344
|
+
var data = this.__data__ = new ListCache(entries);
|
345
|
+
this.size = data.size;
|
346
|
+
}
|
347
|
+
function stackClear() {
|
348
|
+
this.__data__ = new ListCache();
|
349
|
+
this.size = 0;
|
350
|
+
}
|
351
|
+
function stackDelete(key) {
|
352
|
+
var data = this.__data__, result = data["delete"](key);
|
353
|
+
this.size = data.size;
|
354
|
+
return result;
|
355
|
+
}
|
356
|
+
function stackGet(key) {
|
357
|
+
return this.__data__.get(key);
|
358
|
+
}
|
359
|
+
function stackHas(key) {
|
360
|
+
return this.__data__.has(key);
|
361
|
+
}
|
362
|
+
function stackSet(key, value) {
|
363
|
+
var data = this.__data__;
|
364
|
+
if (data instanceof ListCache) {
|
365
|
+
var pairs = data.__data__;
|
366
|
+
if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
|
367
|
+
pairs.push([key, value]);
|
368
|
+
this.size = ++data.size;
|
369
|
+
return this;
|
370
|
+
}
|
371
|
+
data = this.__data__ = new MapCache(pairs);
|
372
|
+
}
|
373
|
+
data.set(key, value);
|
374
|
+
this.size = data.size;
|
375
|
+
return this;
|
376
|
+
}
|
377
|
+
Stack.prototype.clear = stackClear;
|
378
|
+
Stack.prototype["delete"] = stackDelete;
|
379
|
+
Stack.prototype.get = stackGet;
|
380
|
+
Stack.prototype.has = stackHas;
|
381
|
+
Stack.prototype.set = stackSet;
|
382
|
+
function arrayLikeKeys(value, inherited) {
|
383
|
+
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;
|
384
|
+
for (var key in value) {
|
385
|
+
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
386
|
+
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
387
|
+
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
388
|
+
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
|
389
|
+
isIndex(key, length2)))) {
|
390
|
+
result.push(key);
|
391
|
+
}
|
392
|
+
}
|
393
|
+
return result;
|
394
|
+
}
|
395
|
+
function assignMergeValue(object, key, value) {
|
396
|
+
if (value !== void 0 && !eq(object[key], value) || value === void 0 && !(key in object)) {
|
397
|
+
baseAssignValue(object, key, value);
|
398
|
+
}
|
399
|
+
}
|
400
|
+
function assignValue(object, key, value) {
|
401
|
+
var objValue = object[key];
|
402
|
+
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
|
403
|
+
baseAssignValue(object, key, value);
|
404
|
+
}
|
405
|
+
}
|
406
|
+
function assocIndexOf(array, key) {
|
407
|
+
var length2 = array.length;
|
408
|
+
while (length2--) {
|
409
|
+
if (eq(array[length2][0], key)) {
|
410
|
+
return length2;
|
411
|
+
}
|
412
|
+
}
|
413
|
+
return -1;
|
414
|
+
}
|
415
|
+
function baseAssignValue(object, key, value) {
|
416
|
+
if (key == "__proto__" && defineProperty) {
|
417
|
+
defineProperty(object, key, {
|
418
|
+
"configurable": true,
|
419
|
+
"enumerable": true,
|
420
|
+
"value": value,
|
421
|
+
"writable": true
|
422
|
+
});
|
423
|
+
} else {
|
424
|
+
object[key] = value;
|
425
|
+
}
|
426
|
+
}
|
427
|
+
var baseFor = createBaseFor();
|
428
|
+
function baseGetTag(value) {
|
429
|
+
if (value == null) {
|
430
|
+
return value === void 0 ? undefinedTag : nullTag;
|
431
|
+
}
|
432
|
+
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
|
433
|
+
}
|
434
|
+
function baseIsArguments(value) {
|
435
|
+
return isObjectLike(value) && baseGetTag(value) == argsTag;
|
436
|
+
}
|
437
|
+
function baseIsNative(value) {
|
438
|
+
if (!isObject(value) || isMasked(value)) {
|
439
|
+
return false;
|
440
|
+
}
|
441
|
+
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
442
|
+
return pattern.test(toSource(value));
|
443
|
+
}
|
444
|
+
function baseIsTypedArray(value) {
|
445
|
+
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
446
|
+
}
|
447
|
+
function baseKeysIn(object) {
|
448
|
+
if (!isObject(object)) {
|
449
|
+
return nativeKeysIn(object);
|
450
|
+
}
|
451
|
+
var isProto = isPrototype(object), result = [];
|
452
|
+
for (var key in object) {
|
453
|
+
if (!(key == "constructor" && (isProto || !hasOwnProperty.call(object, key)))) {
|
454
|
+
result.push(key);
|
455
|
+
}
|
456
|
+
}
|
457
|
+
return result;
|
458
|
+
}
|
459
|
+
function baseMerge(object, source, srcIndex, customizer, stack) {
|
460
|
+
if (object === source) {
|
461
|
+
return;
|
462
|
+
}
|
463
|
+
baseFor(source, function(srcValue, key) {
|
464
|
+
stack || (stack = new Stack());
|
465
|
+
if (isObject(srcValue)) {
|
466
|
+
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
467
|
+
} else {
|
468
|
+
var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
|
469
|
+
if (newValue === void 0) {
|
470
|
+
newValue = srcValue;
|
471
|
+
}
|
472
|
+
assignMergeValue(object, key, newValue);
|
473
|
+
}
|
474
|
+
}, keysIn);
|
475
|
+
}
|
476
|
+
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
|
477
|
+
var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
|
478
|
+
if (stacked) {
|
479
|
+
assignMergeValue(object, key, stacked);
|
480
|
+
return;
|
481
|
+
}
|
482
|
+
var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
|
483
|
+
var isCommon = newValue === void 0;
|
484
|
+
if (isCommon) {
|
485
|
+
var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
|
486
|
+
newValue = srcValue;
|
487
|
+
if (isArr || isBuff || isTyped) {
|
488
|
+
if (isArray(objValue)) {
|
489
|
+
newValue = objValue;
|
490
|
+
} else if (isArrayLikeObject(objValue)) {
|
491
|
+
newValue = copyArray(objValue);
|
492
|
+
} else if (isBuff) {
|
493
|
+
isCommon = false;
|
494
|
+
newValue = cloneBuffer(srcValue, true);
|
495
|
+
} else if (isTyped) {
|
496
|
+
isCommon = false;
|
497
|
+
newValue = cloneTypedArray(srcValue, true);
|
498
|
+
} else {
|
499
|
+
newValue = [];
|
500
|
+
}
|
501
|
+
} else if (isPlainObject(srcValue) || isArguments(srcValue)) {
|
502
|
+
newValue = objValue;
|
503
|
+
if (isArguments(objValue)) {
|
504
|
+
newValue = toPlainObject(objValue);
|
505
|
+
} else if (!isObject(objValue) || isFunction(objValue)) {
|
506
|
+
newValue = initCloneObject(srcValue);
|
507
|
+
}
|
508
|
+
} else {
|
509
|
+
isCommon = false;
|
510
|
+
}
|
511
|
+
}
|
512
|
+
if (isCommon) {
|
513
|
+
stack.set(srcValue, newValue);
|
514
|
+
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
|
515
|
+
stack["delete"](srcValue);
|
516
|
+
}
|
517
|
+
assignMergeValue(object, key, newValue);
|
518
|
+
}
|
519
|
+
function baseRest(func, start) {
|
520
|
+
return setToString(overRest(func, start, identity), func + "");
|
521
|
+
}
|
522
|
+
var baseSetToString = !defineProperty ? identity : function(func, string) {
|
523
|
+
return defineProperty(func, "toString", {
|
524
|
+
"configurable": true,
|
525
|
+
"enumerable": false,
|
526
|
+
"value": constant(string),
|
527
|
+
"writable": true
|
528
|
+
});
|
529
|
+
};
|
530
|
+
function cloneBuffer(buffer, isDeep) {
|
531
|
+
if (isDeep) {
|
532
|
+
return buffer.slice();
|
533
|
+
}
|
534
|
+
var length2 = buffer.length, result = allocUnsafe ? allocUnsafe(length2) : new buffer.constructor(length2);
|
535
|
+
buffer.copy(result);
|
536
|
+
return result;
|
537
|
+
}
|
538
|
+
function cloneArrayBuffer(arrayBuffer) {
|
539
|
+
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
540
|
+
new Uint8Array2(result).set(new Uint8Array2(arrayBuffer));
|
541
|
+
return result;
|
542
|
+
}
|
543
|
+
function cloneTypedArray(typedArray, isDeep) {
|
544
|
+
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
545
|
+
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
546
|
+
}
|
547
|
+
function copyArray(source, array) {
|
548
|
+
var index = -1, length2 = source.length;
|
549
|
+
array || (array = Array(length2));
|
550
|
+
while (++index < length2) {
|
551
|
+
array[index] = source[index];
|
552
|
+
}
|
553
|
+
return array;
|
554
|
+
}
|
555
|
+
function copyObject(source, props, object, customizer) {
|
556
|
+
var isNew = !object;
|
557
|
+
object || (object = {});
|
558
|
+
var index = -1, length2 = props.length;
|
559
|
+
while (++index < length2) {
|
560
|
+
var key = props[index];
|
561
|
+
var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
|
562
|
+
if (newValue === void 0) {
|
563
|
+
newValue = source[key];
|
564
|
+
}
|
565
|
+
if (isNew) {
|
566
|
+
baseAssignValue(object, key, newValue);
|
567
|
+
} else {
|
568
|
+
assignValue(object, key, newValue);
|
569
|
+
}
|
570
|
+
}
|
571
|
+
return object;
|
572
|
+
}
|
573
|
+
function createAssigner(assigner) {
|
574
|
+
return baseRest(function(object, sources) {
|
575
|
+
var index = -1, length2 = sources.length, customizer = length2 > 1 ? sources[length2 - 1] : void 0, guard = length2 > 2 ? sources[2] : void 0;
|
576
|
+
customizer = assigner.length > 3 && typeof customizer == "function" ? (length2--, customizer) : void 0;
|
577
|
+
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
578
|
+
customizer = length2 < 3 ? void 0 : customizer;
|
579
|
+
length2 = 1;
|
580
|
+
}
|
581
|
+
object = Object(object);
|
582
|
+
while (++index < length2) {
|
583
|
+
var source = sources[index];
|
584
|
+
if (source) {
|
585
|
+
assigner(object, source, index, customizer);
|
586
|
+
}
|
587
|
+
}
|
588
|
+
return object;
|
589
|
+
});
|
590
|
+
}
|
591
|
+
function createBaseFor(fromRight) {
|
592
|
+
return function(object, iteratee, keysFunc) {
|
593
|
+
var index = -1, iterable = Object(object), props = keysFunc(object), length2 = props.length;
|
594
|
+
while (length2--) {
|
595
|
+
var key = props[fromRight ? length2 : ++index];
|
596
|
+
if (iteratee(iterable[key], key, iterable) === false) {
|
597
|
+
break;
|
598
|
+
}
|
599
|
+
}
|
600
|
+
return object;
|
601
|
+
};
|
602
|
+
}
|
603
|
+
function getMapData(map, key) {
|
604
|
+
var data = map.__data__;
|
605
|
+
return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
|
606
|
+
}
|
607
|
+
function getNative(object, key) {
|
608
|
+
var value = getValue(object, key);
|
609
|
+
return baseIsNative(value) ? value : void 0;
|
610
|
+
}
|
611
|
+
function getRawTag(value) {
|
612
|
+
var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
|
613
|
+
try {
|
614
|
+
value[symToStringTag] = void 0;
|
615
|
+
var unmasked = true;
|
616
|
+
} catch (e) {
|
617
|
+
}
|
618
|
+
var result = nativeObjectToString.call(value);
|
619
|
+
if (unmasked) {
|
620
|
+
if (isOwn) {
|
621
|
+
value[symToStringTag] = tag;
|
622
|
+
} else {
|
623
|
+
delete value[symToStringTag];
|
624
|
+
}
|
625
|
+
}
|
626
|
+
return result;
|
627
|
+
}
|
628
|
+
function initCloneObject(object) {
|
629
|
+
return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
|
630
|
+
}
|
631
|
+
function isIndex(value, length2) {
|
632
|
+
var type = typeof value;
|
633
|
+
length2 = length2 == null ? MAX_SAFE_INTEGER : length2;
|
634
|
+
return !!length2 && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length2);
|
635
|
+
}
|
636
|
+
function isIterateeCall(value, index, object) {
|
637
|
+
if (!isObject(object)) {
|
638
|
+
return false;
|
639
|
+
}
|
640
|
+
var type = typeof index;
|
641
|
+
if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
|
642
|
+
return eq(object[index], value);
|
643
|
+
}
|
644
|
+
return false;
|
645
|
+
}
|
646
|
+
function isKeyable(value) {
|
647
|
+
var type = typeof value;
|
648
|
+
return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
|
649
|
+
}
|
650
|
+
function isMasked(func) {
|
651
|
+
return !!maskSrcKey && maskSrcKey in func;
|
652
|
+
}
|
653
|
+
function isPrototype(value) {
|
654
|
+
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
|
655
|
+
return value === proto;
|
656
|
+
}
|
657
|
+
function nativeKeysIn(object) {
|
658
|
+
var result = [];
|
659
|
+
if (object != null) {
|
660
|
+
for (var key in Object(object)) {
|
661
|
+
result.push(key);
|
662
|
+
}
|
663
|
+
}
|
664
|
+
return result;
|
665
|
+
}
|
666
|
+
function objectToString(value) {
|
667
|
+
return nativeObjectToString.call(value);
|
668
|
+
}
|
669
|
+
function overRest(func, start, transform) {
|
670
|
+
start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
|
671
|
+
return function() {
|
672
|
+
var args = arguments, index = -1, length2 = nativeMax(args.length - start, 0), array = Array(length2);
|
673
|
+
while (++index < length2) {
|
674
|
+
array[index] = args[start + index];
|
675
|
+
}
|
676
|
+
index = -1;
|
677
|
+
var otherArgs = Array(start + 1);
|
678
|
+
while (++index < start) {
|
679
|
+
otherArgs[index] = args[index];
|
680
|
+
}
|
681
|
+
otherArgs[start] = transform(array);
|
682
|
+
return apply(func, this, otherArgs);
|
683
|
+
};
|
684
|
+
}
|
685
|
+
function safeGet(object, key) {
|
686
|
+
if (key === "constructor" && typeof object[key] === "function") {
|
687
|
+
return;
|
688
|
+
}
|
689
|
+
if (key == "__proto__") {
|
690
|
+
return;
|
691
|
+
}
|
692
|
+
return object[key];
|
693
|
+
}
|
694
|
+
var setToString = shortOut(baseSetToString);
|
695
|
+
function shortOut(func) {
|
696
|
+
var count = 0, lastCalled = 0;
|
697
|
+
return function() {
|
698
|
+
var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
|
699
|
+
lastCalled = stamp;
|
700
|
+
if (remaining > 0) {
|
701
|
+
if (++count >= HOT_COUNT) {
|
702
|
+
return arguments[0];
|
703
|
+
}
|
704
|
+
} else {
|
705
|
+
count = 0;
|
706
|
+
}
|
707
|
+
return func.apply(void 0, arguments);
|
708
|
+
};
|
709
|
+
}
|
710
|
+
function toSource(func) {
|
711
|
+
if (func != null) {
|
712
|
+
try {
|
713
|
+
return funcToString.call(func);
|
714
|
+
} catch (e) {
|
715
|
+
}
|
716
|
+
try {
|
717
|
+
return func + "";
|
718
|
+
} catch (e) {
|
719
|
+
}
|
720
|
+
}
|
721
|
+
return "";
|
722
|
+
}
|
723
|
+
function eq(value, other) {
|
724
|
+
return value === other || value !== value && other !== other;
|
725
|
+
}
|
726
|
+
var isArguments = baseIsArguments(/* @__PURE__ */ function() {
|
727
|
+
return arguments;
|
728
|
+
}()) ? baseIsArguments : function(value) {
|
729
|
+
return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
|
730
|
+
};
|
731
|
+
var isArray = Array.isArray;
|
732
|
+
function isArrayLike(value) {
|
733
|
+
return value != null && isLength(value.length) && !isFunction(value);
|
734
|
+
}
|
735
|
+
function isArrayLikeObject(value) {
|
736
|
+
return isObjectLike(value) && isArrayLike(value);
|
737
|
+
}
|
738
|
+
var isBuffer = nativeIsBuffer || stubFalse;
|
739
|
+
function isFunction(value) {
|
740
|
+
if (!isObject(value)) {
|
741
|
+
return false;
|
742
|
+
}
|
743
|
+
var tag = baseGetTag(value);
|
744
|
+
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
745
|
+
}
|
746
|
+
function isLength(value) {
|
747
|
+
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
748
|
+
}
|
749
|
+
function isObject(value) {
|
750
|
+
var type = typeof value;
|
751
|
+
return value != null && (type == "object" || type == "function");
|
752
|
+
}
|
753
|
+
function isObjectLike(value) {
|
754
|
+
return value != null && typeof value == "object";
|
755
|
+
}
|
756
|
+
function isPlainObject(value) {
|
757
|
+
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
|
758
|
+
return false;
|
759
|
+
}
|
760
|
+
var proto = getPrototype(value);
|
761
|
+
if (proto === null) {
|
762
|
+
return true;
|
763
|
+
}
|
764
|
+
var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
765
|
+
return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
|
766
|
+
}
|
767
|
+
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
768
|
+
function toPlainObject(value) {
|
769
|
+
return copyObject(value, keysIn(value));
|
770
|
+
}
|
771
|
+
function keysIn(object) {
|
772
|
+
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
773
|
+
}
|
774
|
+
var merge2 = createAssigner(function(object, source, srcIndex) {
|
775
|
+
baseMerge(object, source, srcIndex);
|
776
|
+
});
|
777
|
+
function constant(value) {
|
778
|
+
return function() {
|
779
|
+
return value;
|
780
|
+
};
|
781
|
+
}
|
782
|
+
function identity(value) {
|
783
|
+
return value;
|
784
|
+
}
|
785
|
+
function stubFalse() {
|
786
|
+
return false;
|
787
|
+
}
|
788
|
+
module2.exports = merge2;
|
789
|
+
}
|
790
|
+
});
|
791
|
+
|
70
792
|
// node_modules/classnames/index.js
|
71
793
|
var require_classnames = __commonJS({
|
72
794
|
"node_modules/classnames/index.js"(exports, module2) {
|
@@ -5658,6 +6380,9 @@ var vt = function() {
|
|
5658
6380
|
var St = "__sc-".concat(f, "__");
|
5659
6381
|
"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);
|
5660
6382
|
|
6383
|
+
// src/context/embed.tsx
|
6384
|
+
var import_lodash = __toESM(require_lodash());
|
6385
|
+
|
5661
6386
|
// node_modules/@stripe/stripe-js/dist/index.mjs
|
5662
6387
|
var V3_URL = "https://js.stripe.com/v3";
|
5663
6388
|
var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
|
@@ -6728,7 +7453,8 @@ function ComponentHydrateResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6728
7453
|
component: json["component"] == null ? void 0 : ComponentResponseDataFromJSON(json["component"]),
|
6729
7454
|
featureUsage: json["feature_usage"] == null ? void 0 : FeatureUsageDetailResponseDataFromJSON(json["feature_usage"]),
|
6730
7455
|
stripeEmbed: json["stripe_embed"] == null ? void 0 : StripeEmbedInfoFromJSON(json["stripe_embed"]),
|
6731
|
-
subscription: json["subscription"] == null ? void 0 : CompanySubscriptionResponseDataFromJSON(json["subscription"])
|
7456
|
+
subscription: json["subscription"] == null ? void 0 : CompanySubscriptionResponseDataFromJSON(json["subscription"]),
|
7457
|
+
upcomingInvoice: json["upcoming_invoice"] == null ? void 0 : InvoiceResponseDataFromJSON(json["upcoming_invoice"])
|
6732
7458
|
};
|
6733
7459
|
}
|
6734
7460
|
|
@@ -6929,11 +7655,9 @@ function parseEditorState(data) {
|
|
6929
7655
|
});
|
6930
7656
|
return arr;
|
6931
7657
|
}
|
6932
|
-
async function fetchComponent(id,
|
7658
|
+
async function fetchComponent(id, api) {
|
6933
7659
|
const settings = { ...defaultSettings };
|
6934
7660
|
const nodes = [];
|
6935
|
-
const config = new Configuration({ ...options, apiKey: accessToken });
|
6936
|
-
const api = new CheckoutApi(config);
|
6937
7661
|
const response = await api.hydrateComponent({ componentId: id });
|
6938
7662
|
const { data } = response;
|
6939
7663
|
if (data.component?.ast) {
|
@@ -6959,7 +7683,10 @@ async function fetchComponent(id, accessToken, options) {
|
|
6959
7683
|
};
|
6960
7684
|
}
|
6961
7685
|
var EmbedContext = (0, import_react2.createContext)({
|
6962
|
-
|
7686
|
+
api: null,
|
7687
|
+
data: {
|
7688
|
+
activePlans: []
|
7689
|
+
},
|
6963
7690
|
nodes: [],
|
6964
7691
|
settings: { ...defaultSettings },
|
6965
7692
|
stripe: null,
|
@@ -6983,7 +7710,10 @@ var EmbedProvider = ({
|
|
6983
7710
|
const styleRef = (0, import_react2.useRef)(null);
|
6984
7711
|
const [state, setState] = (0, import_react2.useState)(() => {
|
6985
7712
|
return {
|
6986
|
-
|
7713
|
+
api: null,
|
7714
|
+
data: {
|
7715
|
+
activePlans: []
|
7716
|
+
},
|
6987
7717
|
nodes: [],
|
6988
7718
|
settings: { ...defaultSettings },
|
6989
7719
|
stripe: null,
|
@@ -7011,13 +7741,21 @@ var EmbedProvider = ({
|
|
7011
7741
|
styleRef.current = style;
|
7012
7742
|
}, []);
|
7013
7743
|
(0, import_react2.useEffect)(() => {
|
7014
|
-
if (!
|
7744
|
+
if (!accessToken) {
|
7015
7745
|
return;
|
7016
7746
|
}
|
7017
|
-
|
7747
|
+
const config = new Configuration({ ...apiConfig, apiKey: accessToken });
|
7748
|
+
const api = new CheckoutApi(config);
|
7749
|
+
setState((prev2) => ({ ...prev2, api }));
|
7750
|
+
}, [accessToken, apiConfig]);
|
7751
|
+
(0, import_react2.useEffect)(() => {
|
7752
|
+
if (!id || !state.api) {
|
7753
|
+
return;
|
7754
|
+
}
|
7755
|
+
fetchComponent(id, state.api).then(async (resolvedData) => {
|
7018
7756
|
setState((prev2) => ({ ...prev2, ...resolvedData }));
|
7019
7757
|
}).catch((error) => setState((prev2) => ({ ...prev2, error })));
|
7020
|
-
}, [id,
|
7758
|
+
}, [id, state.api]);
|
7021
7759
|
(0, import_react2.useEffect)(() => {
|
7022
7760
|
const fontSet = /* @__PURE__ */ new Set([]);
|
7023
7761
|
Object.values(state.settings.theme.typography).forEach(({ fontFamily }) => {
|
@@ -7032,19 +7770,21 @@ var EmbedProvider = ({
|
|
7032
7770
|
}, [state.settings.theme.typography]);
|
7033
7771
|
const setData = (0, import_react2.useCallback)(
|
7034
7772
|
(data) => {
|
7035
|
-
setState((prev2) =>
|
7036
|
-
...prev2
|
7037
|
-
|
7038
|
-
|
7773
|
+
setState((prev2) => {
|
7774
|
+
const updated = { ...prev2 };
|
7775
|
+
(0, import_lodash.default)(updated.data, data);
|
7776
|
+
return updated;
|
7777
|
+
});
|
7039
7778
|
},
|
7040
7779
|
[setState]
|
7041
7780
|
);
|
7042
7781
|
const updateSettings = (0, import_react2.useCallback)(
|
7043
7782
|
(settings) => {
|
7044
|
-
setState((prev2) =>
|
7045
|
-
...prev2
|
7046
|
-
|
7047
|
-
|
7783
|
+
setState((prev2) => {
|
7784
|
+
const updated = { ...prev2 };
|
7785
|
+
(0, import_lodash.default)(updated.settings, settings);
|
7786
|
+
return updated;
|
7787
|
+
});
|
7048
7788
|
},
|
7049
7789
|
[setState]
|
7050
7790
|
);
|
@@ -7097,9 +7837,9 @@ var EmbedProvider = ({
|
|
7097
7837
|
}
|
7098
7838
|
}
|
7099
7839
|
},
|
7100
|
-
...state.data.stripeEmbed?.customerEkey
|
7840
|
+
...state.data.stripeEmbed?.customerEkey ? {
|
7101
7841
|
clientSecret: state.data.stripeEmbed.customerEkey
|
7102
|
-
}
|
7842
|
+
} : { mode: "payment", currency: "usd", amount: 999999 }
|
7103
7843
|
},
|
7104
7844
|
children
|
7105
7845
|
}
|
@@ -7111,6 +7851,7 @@ var EmbedProvider = ({
|
|
7111
7851
|
EmbedContext.Provider,
|
7112
7852
|
{
|
7113
7853
|
value: {
|
7854
|
+
api: state.api,
|
7114
7855
|
data: state.data,
|
7115
7856
|
nodes: state.nodes,
|
7116
7857
|
settings: state.settings,
|
@@ -7157,11 +7898,11 @@ var require_browser_polyfill = __commonJS2({
|
|
7157
7898
|
"node_modules/cross-fetch/dist/browser-polyfill.js"(exports) {
|
7158
7899
|
(function(self2) {
|
7159
7900
|
var irrelevant = function(exports2) {
|
7160
|
-
var
|
7901
|
+
var global2 = typeof globalThis !== "undefined" && globalThis || typeof self2 !== "undefined" && self2 || typeof global2 !== "undefined" && global2;
|
7161
7902
|
var support = {
|
7162
|
-
searchParams: "URLSearchParams" in
|
7163
|
-
iterable: "Symbol" in
|
7164
|
-
blob: "FileReader" in
|
7903
|
+
searchParams: "URLSearchParams" in global2,
|
7904
|
+
iterable: "Symbol" in global2 && "iterator" in Symbol,
|
7905
|
+
blob: "FileReader" in global2 && "Blob" in global2 && function() {
|
7165
7906
|
try {
|
7166
7907
|
new Blob();
|
7167
7908
|
return true;
|
@@ -7169,8 +7910,8 @@ var require_browser_polyfill = __commonJS2({
|
|
7169
7910
|
return false;
|
7170
7911
|
}
|
7171
7912
|
}(),
|
7172
|
-
formData: "FormData" in
|
7173
|
-
arrayBuffer: "ArrayBuffer" in
|
7913
|
+
formData: "FormData" in global2,
|
7914
|
+
arrayBuffer: "ArrayBuffer" in global2
|
7174
7915
|
};
|
7175
7916
|
function isDataView(obj) {
|
7176
7917
|
return obj && DataView.prototype.isPrototypeOf(obj);
|
@@ -7547,7 +8288,7 @@ var require_browser_polyfill = __commonJS2({
|
|
7547
8288
|
}
|
7548
8289
|
return new Response(null, { status, headers: { location: url } });
|
7549
8290
|
};
|
7550
|
-
exports2.DOMException =
|
8291
|
+
exports2.DOMException = global2.DOMException;
|
7551
8292
|
try {
|
7552
8293
|
new exports2.DOMException();
|
7553
8294
|
} catch (err2) {
|
@@ -7599,7 +8340,7 @@ var require_browser_polyfill = __commonJS2({
|
|
7599
8340
|
};
|
7600
8341
|
function fixUrl(url) {
|
7601
8342
|
try {
|
7602
|
-
return url === "" &&
|
8343
|
+
return url === "" && global2.location.href ? global2.location.href : url;
|
7603
8344
|
} catch (e) {
|
7604
8345
|
return url;
|
7605
8346
|
}
|
@@ -7638,11 +8379,11 @@ var require_browser_polyfill = __commonJS2({
|
|
7638
8379
|
});
|
7639
8380
|
}
|
7640
8381
|
fetch2.polyfill = true;
|
7641
|
-
if (!
|
7642
|
-
|
7643
|
-
|
7644
|
-
|
7645
|
-
|
8382
|
+
if (!global2.fetch) {
|
8383
|
+
global2.fetch = fetch2;
|
8384
|
+
global2.Headers = Headers;
|
8385
|
+
global2.Request = Request;
|
8386
|
+
global2.Response = Response;
|
7646
8387
|
}
|
7647
8388
|
exports2.Headers = Headers;
|
7648
8389
|
exports2.Request = Request;
|
@@ -8477,15 +9218,96 @@ var ProgressBar = ({
|
|
8477
9218
|
var import_react6 = require("react");
|
8478
9219
|
var import_react_stripe_js2 = require("@stripe/react-stripe-js");
|
8479
9220
|
var import_react_stripe_js3 = require("@stripe/react-stripe-js");
|
9221
|
+
|
9222
|
+
// src/components/elements/plan-manager/styles.ts
|
9223
|
+
var StyledButton = dt(Button2)`
|
9224
|
+
font-family: "Public Sans", sans-serif;
|
9225
|
+
font-weight: 500;
|
9226
|
+
text-align: center;
|
9227
|
+
width: 100%;
|
9228
|
+
${({ disabled, $color = "primary", theme }) => {
|
9229
|
+
const { l: l2 } = hexToHSL(theme[$color]);
|
9230
|
+
const textColor = disabled ? "#989898" : l2 > 50 ? "#000000" : "#FFFFFF";
|
9231
|
+
return lt`
|
9232
|
+
color: ${textColor};
|
9233
|
+
|
9234
|
+
${Text} {
|
9235
|
+
color: ${textColor};
|
9236
|
+
}
|
9237
|
+
`;
|
9238
|
+
}};
|
9239
|
+
|
9240
|
+
${({ disabled, $color = "primary", theme, $variant = "filled" }) => {
|
9241
|
+
const color = disabled ? "#EEEEEE" : theme[$color];
|
9242
|
+
return $variant === "filled" ? lt`
|
9243
|
+
background-color: ${color};
|
9244
|
+
border-color: ${color};
|
9245
|
+
` : lt`
|
9246
|
+
background-color: transparent;
|
9247
|
+
border-color: #d2d2d2;
|
9248
|
+
color: #194bfb;
|
9249
|
+
${Text} {
|
9250
|
+
color: #194bfb;
|
9251
|
+
}
|
9252
|
+
`;
|
9253
|
+
}}
|
9254
|
+
|
9255
|
+
&:hover {
|
9256
|
+
${({ disabled }) => disabled && "cursor: not-allowed;"}
|
9257
|
+
${({ disabled, $color = "primary", theme, $variant = "filled" }) => {
|
9258
|
+
const specified = theme[$color];
|
9259
|
+
const lightened = lighten(specified, 15);
|
9260
|
+
const color = disabled ? "#EEEEEE" : specified === lightened ? darken(specified, 15) : lightened;
|
9261
|
+
return $variant === "filled" ? lt`
|
9262
|
+
background-color: ${color};
|
9263
|
+
border-color: ${color};
|
9264
|
+
` : lt`
|
9265
|
+
background-color: ${color};
|
9266
|
+
border-color: ${color};
|
9267
|
+
color: #ffffff;
|
9268
|
+
${Text} {
|
9269
|
+
color: #ffffff;
|
9270
|
+
}
|
9271
|
+
`;
|
9272
|
+
}}
|
9273
|
+
}
|
9274
|
+
|
9275
|
+
${({ $size = "md" }) => {
|
9276
|
+
switch ($size) {
|
9277
|
+
case "sm":
|
9278
|
+
return lt`
|
9279
|
+
font-size: ${15 / 16}rem;
|
9280
|
+
padding: ${12 / 16}rem 0;
|
9281
|
+
border-radius: ${6 / 16}rem;
|
9282
|
+
`;
|
9283
|
+
case "md":
|
9284
|
+
return lt`
|
9285
|
+
font-size: ${17 / 16}rem;
|
9286
|
+
padding: ${16 / 16}rem 0;
|
9287
|
+
border-radius: ${8 / 16}rem;
|
9288
|
+
`;
|
9289
|
+
case "lg":
|
9290
|
+
return lt`
|
9291
|
+
font-size: ${19 / 16}rem;
|
9292
|
+
padding: ${20 / 16}rem 0;
|
9293
|
+
border-radius: ${10 / 16}rem;
|
9294
|
+
`;
|
9295
|
+
}
|
9296
|
+
}}
|
9297
|
+
`;
|
9298
|
+
|
9299
|
+
// src/components/elements/plan-manager/CheckoutForm.tsx
|
8480
9300
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
8481
|
-
var CheckoutForm = () => {
|
9301
|
+
var CheckoutForm = ({ plan, period }) => {
|
8482
9302
|
const stripe = (0, import_react_stripe_js3.useStripe)();
|
8483
9303
|
const elements = (0, import_react_stripe_js3.useElements)();
|
9304
|
+
const { api, data } = useEmbed();
|
8484
9305
|
const [message, setMessage] = (0, import_react6.useState)(null);
|
8485
9306
|
const [isLoading, setIsLoading] = (0, import_react6.useState)(false);
|
8486
9307
|
const handleSubmit = async (event) => {
|
8487
9308
|
event.preventDefault();
|
8488
|
-
|
9309
|
+
const priceId = period === "month" ? plan.monthlyPrice?.id : plan.yearlyPrice?.id;
|
9310
|
+
if (!api || !stripe || !elements || !priceId) {
|
8489
9311
|
return;
|
8490
9312
|
}
|
8491
9313
|
setIsLoading(true);
|
@@ -8546,22 +9368,13 @@ var CheckoutForm = () => {
|
|
8546
9368
|
message && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { id: "payment-message", children: message })
|
8547
9369
|
] }),
|
8548
9370
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
8549
|
-
|
9371
|
+
StyledButton,
|
8550
9372
|
{
|
8551
|
-
disabled: isLoading || !stripe || !elements,
|
8552
9373
|
id: "submit",
|
8553
|
-
|
8554
|
-
|
8555
|
-
|
8556
|
-
|
8557
|
-
paddingBottom: ".75rem",
|
8558
|
-
fontSize: "15px",
|
8559
|
-
width: "100%",
|
8560
|
-
borderRadius: ".5rem",
|
8561
|
-
textAlign: "center",
|
8562
|
-
cursor: "pointer"
|
8563
|
-
},
|
8564
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { id: "button-text", style: { marginTop: "2.5rem" }, children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "spinner", id: "spinner" }) : "Save payment method" })
|
9374
|
+
disabled: isLoading || !stripe || !elements || !data.stripeEmbed?.publishableKey || !data.stripeEmbed?.customerEkey,
|
9375
|
+
$size: "md",
|
9376
|
+
$color: "secondary",
|
9377
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { id: "button-text", children: isLoading ? "Loading" : "Save payment method" })
|
8565
9378
|
}
|
8566
9379
|
) })
|
8567
9380
|
]
|
@@ -8569,86 +9382,12 @@ var CheckoutForm = () => {
|
|
8569
9382
|
);
|
8570
9383
|
};
|
8571
9384
|
|
8572
|
-
// src/components/elements/plan-manager/styles.ts
|
8573
|
-
var StyledButton = dt(Button2)`
|
8574
|
-
font-family: "Public Sans", sans-serif;
|
8575
|
-
font-weight: 500;
|
8576
|
-
text-align: center;
|
8577
|
-
width: 100%;
|
8578
|
-
|
8579
|
-
${({ $color = "primary", theme }) => {
|
8580
|
-
const { l: l2 } = hexToHSL(theme[$color]);
|
8581
|
-
const textColor = l2 > 50 ? "#000000" : "#FFFFFF";
|
8582
|
-
return lt`
|
8583
|
-
color: ${textColor};
|
8584
|
-
|
8585
|
-
${Text} {
|
8586
|
-
color: ${textColor};
|
8587
|
-
}
|
8588
|
-
`;
|
8589
|
-
}};
|
8590
|
-
|
8591
|
-
${({ $color = "primary", theme, $variant = "filled" }) => {
|
8592
|
-
const color = theme[$color];
|
8593
|
-
return $variant === "filled" ? lt`
|
8594
|
-
background-color: ${color};
|
8595
|
-
border-color: ${color};
|
8596
|
-
` : lt`
|
8597
|
-
background-color: transparent;
|
8598
|
-
border-color: #d2d2d2;
|
8599
|
-
color: #194bfb;
|
8600
|
-
${Text} {
|
8601
|
-
color: #194bfb;
|
8602
|
-
}
|
8603
|
-
`;
|
8604
|
-
}}
|
8605
|
-
|
8606
|
-
&:hover {
|
8607
|
-
${({ $color = "primary", theme, $variant = "filled" }) => {
|
8608
|
-
const specified = theme[$color];
|
8609
|
-
const lightened = lighten(specified, 15);
|
8610
|
-
const color = specified === lightened ? darken(specified, 15) : lightened;
|
8611
|
-
return $variant === "filled" ? lt`
|
8612
|
-
background-color: ${color};
|
8613
|
-
border-color: ${color};
|
8614
|
-
` : lt`
|
8615
|
-
background-color: ${color};
|
8616
|
-
border-color: ${color};
|
8617
|
-
color: #ffffff;
|
8618
|
-
${Text} {
|
8619
|
-
color: #ffffff;
|
8620
|
-
}
|
8621
|
-
`;
|
8622
|
-
}}
|
8623
|
-
}
|
8624
|
-
|
8625
|
-
${({ $size = "md" }) => {
|
8626
|
-
switch ($size) {
|
8627
|
-
case "sm":
|
8628
|
-
return lt`
|
8629
|
-
font-size: ${15 / 16}rem;
|
8630
|
-
padding: ${12 / 16}rem 0;
|
8631
|
-
border-radius: ${6 / 16}rem;
|
8632
|
-
`;
|
8633
|
-
case "md":
|
8634
|
-
return lt`
|
8635
|
-
font-size: ${17 / 16}rem;
|
8636
|
-
padding: ${16 / 16}rem 0;
|
8637
|
-
border-radius: ${8 / 16}rem;
|
8638
|
-
`;
|
8639
|
-
case "lg":
|
8640
|
-
return lt`
|
8641
|
-
font-size: ${19 / 16}rem;
|
8642
|
-
padding: ${20 / 16}rem 0;
|
8643
|
-
border-radius: ${10 / 16}rem;
|
8644
|
-
`;
|
8645
|
-
}
|
8646
|
-
}}
|
8647
|
-
`;
|
8648
|
-
|
8649
9385
|
// src/components/elements/plan-manager/PlanManager.tsx
|
8650
9386
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
8651
|
-
var OverlayHeader = ({
|
9387
|
+
var OverlayHeader = ({
|
9388
|
+
children,
|
9389
|
+
onClose
|
9390
|
+
}) => {
|
8652
9391
|
const { setLayout } = useEmbed();
|
8653
9392
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
8654
9393
|
Flex,
|
@@ -8671,6 +9410,9 @@ var OverlayHeader = ({ children }) => {
|
|
8671
9410
|
$cursor: "pointer",
|
8672
9411
|
onClick: () => {
|
8673
9412
|
setLayout("portal");
|
9413
|
+
if (onClose) {
|
9414
|
+
onClose();
|
9415
|
+
}
|
8674
9416
|
},
|
8675
9417
|
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon2, { name: "close", style: { fontSize: 36, color: "#B8B8B8" } })
|
8676
9418
|
}
|
@@ -8735,8 +9477,20 @@ var OverlayWrapper = ({
|
|
8735
9477
|
var OverlaySideBar = ({
|
8736
9478
|
pricePeriod,
|
8737
9479
|
setPricePeriod,
|
8738
|
-
|
9480
|
+
checkoutStage,
|
9481
|
+
setCheckoutStage,
|
9482
|
+
currentPlan,
|
9483
|
+
selectedPlan
|
8739
9484
|
}) => {
|
9485
|
+
const { api } = useEmbed();
|
9486
|
+
const savingsPercentage = (0, import_react7.useMemo)(() => {
|
9487
|
+
if (selectedPlan && pricePeriod === "month") {
|
9488
|
+
const monthly = (selectedPlan?.monthlyPrice?.price || 0) * 12;
|
9489
|
+
const yearly = selectedPlan?.yearlyPrice?.price || 0;
|
9490
|
+
return (monthly - yearly) / monthly * 100;
|
9491
|
+
}
|
9492
|
+
return 0;
|
9493
|
+
}, [selectedPlan, pricePeriod]);
|
8740
9494
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
8741
9495
|
Flex,
|
8742
9496
|
{
|
@@ -8758,32 +9512,7 @@ var OverlaySideBar = ({
|
|
8758
9512
|
$padding: "1.5rem",
|
8759
9513
|
$borderBottom: "1px solid #DEDEDE",
|
8760
9514
|
children: [
|
8761
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.
|
8762
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { $size: 20, $weight: 600, children: "Subscription" }),
|
8763
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
8764
|
-
Flex,
|
8765
|
-
{
|
8766
|
-
$border: "1px solid #D9D9D9",
|
8767
|
-
$padding: ".15rem .45rem .15rem .55rem",
|
8768
|
-
$alignItems: "center",
|
8769
|
-
$borderRadius: "5px",
|
8770
|
-
$fontSize: "12px",
|
8771
|
-
children: [
|
8772
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { $display: "inline-block", $marginRight: ".5rem", children: "$ USD" }),
|
8773
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
8774
|
-
Icon2,
|
8775
|
-
{
|
8776
|
-
name: "chevron-down",
|
8777
|
-
style: {
|
8778
|
-
fontSize: "20px",
|
8779
|
-
lineHeight: "1em"
|
8780
|
-
}
|
8781
|
-
}
|
8782
|
-
)
|
8783
|
-
]
|
8784
|
-
}
|
8785
|
-
)
|
8786
|
-
] }),
|
9515
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $flexDirection: "row", $justifyContent: "space-between", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { $size: 20, $weight: 600, children: "Subscription" }) }),
|
8787
9516
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
8788
9517
|
Flex,
|
8789
9518
|
{
|
@@ -8821,7 +9550,11 @@ var OverlaySideBar = ({
|
|
8821
9550
|
]
|
8822
9551
|
}
|
8823
9552
|
),
|
8824
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.
|
9553
|
+
savingsPercentage > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box, { $fontSize: "11px", $color: "#194BFB", children: [
|
9554
|
+
"Save up to ",
|
9555
|
+
savingsPercentage,
|
9556
|
+
"% with yearly billing"
|
9557
|
+
] })
|
8825
9558
|
]
|
8826
9559
|
}
|
8827
9560
|
),
|
@@ -8846,7 +9579,7 @@ var OverlaySideBar = ({
|
|
8846
9579
|
$color: "#5D5D5D",
|
8847
9580
|
$gap: ".5rem",
|
8848
9581
|
children: [
|
8849
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
9582
|
+
currentPlan && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
8850
9583
|
Flex,
|
8851
9584
|
{
|
8852
9585
|
$flexDirection: "row",
|
@@ -8855,50 +9588,56 @@ var OverlaySideBar = ({
|
|
8855
9588
|
$fontSize: "14px",
|
8856
9589
|
$color: "#5D5D5D",
|
8857
9590
|
children: [
|
8858
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $fontSize: "14px", $color: "#5D5D5D", children:
|
9591
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $fontSize: "14px", $color: "#5D5D5D", children: currentPlan.name }),
|
8859
9592
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $fontSize: "12px", $color: "#000000", children: [
|
8860
|
-
"$
|
8861
|
-
|
9593
|
+
"$",
|
9594
|
+
currentPlan.planPrice,
|
9595
|
+
"/",
|
9596
|
+
currentPlan.planPeriod
|
8862
9597
|
] })
|
8863
9598
|
]
|
8864
9599
|
}
|
8865
9600
|
),
|
8866
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.
|
8867
|
-
|
8868
|
-
|
8869
|
-
|
8870
|
-
|
8871
|
-
|
8872
|
-
|
8873
|
-
|
8874
|
-
|
8875
|
-
|
8876
|
-
|
8877
|
-
|
8878
|
-
|
8879
|
-
|
9601
|
+
selectedPlan && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
9602
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
9603
|
+
Box,
|
9604
|
+
{
|
9605
|
+
$width: "100%",
|
9606
|
+
$textAlign: "left",
|
9607
|
+
$opacity: "50%",
|
9608
|
+
$marginBottom: "-.25rem",
|
9609
|
+
$marginTop: "-.25rem",
|
9610
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
9611
|
+
Icon2,
|
9612
|
+
{
|
9613
|
+
name: "arrow-down",
|
9614
|
+
style: {
|
9615
|
+
display: "inline-block"
|
9616
|
+
}
|
8880
9617
|
}
|
8881
|
-
|
8882
|
-
|
8883
|
-
|
8884
|
-
|
8885
|
-
|
8886
|
-
|
8887
|
-
|
8888
|
-
|
8889
|
-
|
8890
|
-
|
8891
|
-
|
8892
|
-
|
8893
|
-
|
8894
|
-
|
8895
|
-
|
8896
|
-
|
8897
|
-
|
8898
|
-
|
8899
|
-
|
8900
|
-
|
8901
|
-
|
9618
|
+
)
|
9619
|
+
}
|
9620
|
+
),
|
9621
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
9622
|
+
Flex,
|
9623
|
+
{
|
9624
|
+
$flexDirection: "row",
|
9625
|
+
$alignItems: "center",
|
9626
|
+
$justifyContent: "space-between",
|
9627
|
+
$fontSize: "14px",
|
9628
|
+
$color: "#5D5D5D",
|
9629
|
+
children: [
|
9630
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $fontSize: "14px", $color: "#000000", $fontWeight: "600", children: selectedPlan.name }),
|
9631
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $fontSize: "12px", $color: "#000000", children: [
|
9632
|
+
"$",
|
9633
|
+
pricePeriod === "month" ? selectedPlan.monthlyPrice?.price : selectedPlan.yearlyPrice?.price,
|
9634
|
+
"/",
|
9635
|
+
pricePeriod
|
9636
|
+
] })
|
9637
|
+
]
|
9638
|
+
}
|
9639
|
+
)
|
9640
|
+
] })
|
8902
9641
|
]
|
8903
9642
|
}
|
8904
9643
|
)
|
@@ -8915,25 +9654,57 @@ var OverlaySideBar = ({
|
|
8915
9654
|
$height: "auto",
|
8916
9655
|
$padding: "1.5rem",
|
8917
9656
|
children: [
|
8918
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
8919
|
-
|
8920
|
-
|
8921
|
-
|
8922
|
-
|
8923
|
-
|
8924
|
-
|
8925
|
-
|
9657
|
+
selectedPlan && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
9658
|
+
Flex,
|
9659
|
+
{
|
9660
|
+
$fontSize: "12px",
|
9661
|
+
$color: "#5D5D5D",
|
9662
|
+
$justifyContent: "space-between",
|
9663
|
+
children: [
|
9664
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box, { $fontSize: "12px", $color: "#5D5D5D", children: [
|
9665
|
+
"Monthly total:",
|
9666
|
+
" "
|
9667
|
+
] }),
|
9668
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box, { $fontSize: "12px", $color: "#000000", children: [
|
9669
|
+
"$",
|
9670
|
+
pricePeriod === "month" ? selectedPlan.monthlyPrice?.price : selectedPlan.yearlyPrice?.price,
|
9671
|
+
"/",
|
9672
|
+
pricePeriod
|
9673
|
+
] })
|
9674
|
+
]
|
9675
|
+
}
|
9676
|
+
),
|
9677
|
+
checkoutStage === "plan" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
8926
9678
|
StyledButton,
|
8927
9679
|
{
|
8928
9680
|
$size: "sm",
|
8929
9681
|
onClick: () => {
|
8930
9682
|
setCheckoutStage("checkout");
|
8931
9683
|
},
|
8932
|
-
|
9684
|
+
...!selectedPlan && { disabled: true },
|
9685
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $gap: "0.5rem", $alignItems: "center", $justifyContent: "center", children: [
|
8933
9686
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "Next: Checkout" }),
|
8934
9687
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon2, { name: "arrow-right" })
|
8935
9688
|
] })
|
8936
9689
|
}
|
9690
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
9691
|
+
StyledButton,
|
9692
|
+
{
|
9693
|
+
disabled: !api || !selectedPlan || selectedPlan?.id === currentPlan?.id,
|
9694
|
+
onClick: async () => {
|
9695
|
+
const priceId = pricePeriod === "month" ? selectedPlan?.monthlyPrice?.id : selectedPlan?.yearlyPrice?.id;
|
9696
|
+
if (!api || !selectedPlan || !priceId)
|
9697
|
+
return;
|
9698
|
+
await api.checkout({
|
9699
|
+
changeSubscriptionRequestBody: {
|
9700
|
+
newPlanId: selectedPlan.id,
|
9701
|
+
newPriceId: priceId
|
9702
|
+
}
|
9703
|
+
});
|
9704
|
+
},
|
9705
|
+
$size: "md",
|
9706
|
+
children: "Pay now"
|
9707
|
+
}
|
8937
9708
|
),
|
8938
9709
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { $fontSize: "12px", $color: "#5D5D5D", children: "Discounts & credits applied at checkout" })
|
8939
9710
|
]
|
@@ -8977,23 +9748,15 @@ var PlanManager = (0, import_react7.forwardRef)(({ children, className, portal,
|
|
8977
9748
|
"plan"
|
8978
9749
|
);
|
8979
9750
|
const [planPeriod, setPlanPeriod] = (0, import_react7.useState)("month");
|
9751
|
+
const [selectedPlan, setSelectedPlan] = (0, import_react7.useState)();
|
8980
9752
|
const { data, settings, layout, stripe, setLayout } = useEmbed();
|
8981
9753
|
const { currentPlan, canChangePlan, availablePlans } = (0, import_react7.useMemo)(() => {
|
8982
|
-
const canChangePlan2 = stripe !== null;
|
8983
|
-
const availablePlans2 = data.activePlans?.map(
|
8984
|
-
({ name, description, current, monthlyPrice, yearlyPrice }) => ({
|
8985
|
-
name,
|
8986
|
-
description,
|
8987
|
-
price: planPeriod === "month" ? monthlyPrice?.price : yearlyPrice?.price,
|
8988
|
-
current
|
8989
|
-
})
|
8990
|
-
);
|
8991
9754
|
return {
|
8992
9755
|
currentPlan: data.company?.plan,
|
8993
|
-
canChangePlan:
|
8994
|
-
availablePlans:
|
9756
|
+
canChangePlan: stripe !== null,
|
9757
|
+
availablePlans: data.activePlans
|
8995
9758
|
};
|
8996
|
-
}, [data.company, data.activePlans, stripe
|
9759
|
+
}, [data.company, data.activePlans, stripe]);
|
8997
9760
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { ref, className, children: [
|
8998
9761
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
8999
9762
|
Flex,
|
@@ -9075,23 +9838,41 @@ var PlanManager = (0, import_react7.forwardRef)(({ children, className, portal,
|
|
9075
9838
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(OverlayWrapper, { children: [
|
9076
9839
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(OverlayHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $gap: "1rem", children: [
|
9077
9840
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Flex, { $flexDirection: "row", $gap: "0.5rem", $alignItems: "center", children: [
|
9078
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
9841
|
+
checkoutStage === "plan" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
9079
9842
|
Box,
|
9080
9843
|
{
|
9081
9844
|
$width: "15px",
|
9082
9845
|
$height: "15px",
|
9846
|
+
$backgroundColor: "white",
|
9083
9847
|
$border: "2px solid #DDDDDD",
|
9084
|
-
$borderRadius: "999px"
|
9085
|
-
|
9848
|
+
$borderRadius: "999px"
|
9849
|
+
}
|
9850
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
9851
|
+
IconRound,
|
9852
|
+
{
|
9853
|
+
name: "check",
|
9854
|
+
style: {
|
9855
|
+
color: "#FFFFFF",
|
9856
|
+
backgroundColor: "#DDDDDD",
|
9857
|
+
fontSize: 16,
|
9858
|
+
width: "1rem",
|
9859
|
+
height: "1rem"
|
9860
|
+
}
|
9086
9861
|
}
|
9087
9862
|
),
|
9088
9863
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
9089
9864
|
"div",
|
9090
9865
|
{
|
9091
|
-
|
9866
|
+
tabIndex: 0,
|
9867
|
+
...checkoutStage === "plan" ? {
|
9092
9868
|
style: {
|
9093
9869
|
fontWeight: "700"
|
9094
9870
|
}
|
9871
|
+
} : {
|
9872
|
+
style: {
|
9873
|
+
cursor: "pointer"
|
9874
|
+
},
|
9875
|
+
onClick: () => setCheckoutStage("plan")
|
9095
9876
|
},
|
9096
9877
|
children: "1. Select plan"
|
9097
9878
|
}
|
@@ -9118,6 +9899,7 @@ var PlanManager = (0, import_react7.forwardRef)(({ children, className, portal,
|
|
9118
9899
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
9119
9900
|
"div",
|
9120
9901
|
{
|
9902
|
+
tabIndex: 0,
|
9121
9903
|
...checkoutStage === "checkout" && {
|
9122
9904
|
style: {
|
9123
9905
|
fontWeight: "700"
|
@@ -9125,13 +9907,6 @@ var PlanManager = (0, import_react7.forwardRef)(({ children, className, portal,
|
|
9125
9907
|
},
|
9126
9908
|
children: "2. Checkout"
|
9127
9909
|
}
|
9128
|
-
),
|
9129
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
9130
|
-
Icon2,
|
9131
|
-
{
|
9132
|
-
name: "chevron-right",
|
9133
|
-
style: { fontSize: 16, color: "#D0D0D0" }
|
9134
|
-
}
|
9135
9910
|
)
|
9136
9911
|
] })
|
9137
9912
|
] }) }),
|
@@ -9192,8 +9967,8 @@ var PlanManager = (0, import_react7.forwardRef)(({ children, className, portal,
|
|
9192
9967
|
$height: "100%",
|
9193
9968
|
$flexDirection: "column",
|
9194
9969
|
$backgroundColor: "white",
|
9195
|
-
$border: plan?.current ? `2px solid #194BFB` : "",
|
9196
9970
|
$flex: "1",
|
9971
|
+
$border: `2px solid ${plan.id === selectedPlan?.id ? "#194BFB" : "transparent"}`,
|
9197
9972
|
$borderRadius: ".5rem",
|
9198
9973
|
$boxShadow: "0px 1px 3px rgba(16, 24, 40, 0.1), 0px 1px 20px rgba(16, 24, 40, 0.06)",
|
9199
9974
|
children: [
|
@@ -9205,26 +9980,26 @@ var PlanManager = (0, import_react7.forwardRef)(({ children, className, portal,
|
|
9205
9980
|
$gap: "1rem",
|
9206
9981
|
$width: "100%",
|
9207
9982
|
$height: "auto",
|
9208
|
-
$padding: "1.5rem",
|
9983
|
+
$padding: "2rem 1.5rem 1.5rem",
|
9209
9984
|
$borderBottom: "1px solid #DEDEDE",
|
9210
9985
|
children: [
|
9211
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { $size: 20, $weight: 600, children: plan
|
9212
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { $size: 14, children: plan
|
9986
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { $size: 20, $weight: 600, children: plan.name }),
|
9987
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { $size: 14, children: plan.description }),
|
9213
9988
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { children: [
|
9214
9989
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { $display: "inline-block", $fontSize: ".90rem", children: "$" }),
|
9215
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { $display: "inline-block", $fontSize: "1.5rem", children:
|
9990
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box, { $display: "inline-block", $fontSize: "1.5rem", children: (planPeriod === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price }),
|
9216
9991
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box, { $display: "inline-block", $fontSize: ".75rem", children: [
|
9217
9992
|
"/",
|
9218
9993
|
planPeriod
|
9219
9994
|
] })
|
9220
9995
|
] }),
|
9221
|
-
plan
|
9996
|
+
(plan.current || plan.id === currentPlan?.id) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
9222
9997
|
Flex,
|
9223
9998
|
{
|
9224
9999
|
$position: "absolute",
|
9225
10000
|
$right: "1rem",
|
9226
10001
|
$top: "1rem",
|
9227
|
-
$fontSize: ".
|
10002
|
+
$fontSize: ".625rem",
|
9228
10003
|
$color: "white",
|
9229
10004
|
$backgroundColor: "#194BFB",
|
9230
10005
|
$borderRadius: "999px",
|
@@ -9245,22 +10020,30 @@ var PlanManager = (0, import_react7.forwardRef)(({ children, className, portal,
|
|
9245
10020
|
$width: "100%",
|
9246
10021
|
$height: "auto",
|
9247
10022
|
$padding: "1.5rem",
|
9248
|
-
children:
|
9249
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
9250
|
-
|
9251
|
-
|
9252
|
-
|
9253
|
-
|
9254
|
-
|
9255
|
-
|
9256
|
-
|
9257
|
-
|
9258
|
-
|
9259
|
-
|
10023
|
+
children: plan.features.map((feature) => {
|
10024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
10025
|
+
Flex,
|
10026
|
+
{
|
10027
|
+
$flexShrink: "0",
|
10028
|
+
$gap: "1rem",
|
10029
|
+
children: [
|
10030
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
10031
|
+
IconRound,
|
10032
|
+
{
|
10033
|
+
name: feature.icon,
|
10034
|
+
size: "tn",
|
10035
|
+
colors: ["#000000", "#F5F5F5"]
|
10036
|
+
}
|
10037
|
+
),
|
10038
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { $size: ".75rem", $color: "#00000", children: feature.name }) })
|
10039
|
+
]
|
10040
|
+
},
|
10041
|
+
feature.id
|
10042
|
+
);
|
9260
10043
|
})
|
9261
10044
|
}
|
9262
10045
|
),
|
9263
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.
|
10046
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
9264
10047
|
Flex,
|
9265
10048
|
{
|
9266
10049
|
$flexDirection: "column",
|
@@ -9269,58 +10052,64 @@ var PlanManager = (0, import_react7.forwardRef)(({ children, className, portal,
|
|
9269
10052
|
$width: "100%",
|
9270
10053
|
$height: "auto",
|
9271
10054
|
$padding: "1.5rem",
|
9272
|
-
children:
|
9273
|
-
|
9274
|
-
|
9275
|
-
|
9276
|
-
|
9277
|
-
|
9278
|
-
|
9279
|
-
|
9280
|
-
|
9281
|
-
|
9282
|
-
|
9283
|
-
|
9284
|
-
|
9285
|
-
|
9286
|
-
|
9287
|
-
|
10055
|
+
children: [
|
10056
|
+
plan.id === selectedPlan?.id && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
10057
|
+
Flex,
|
10058
|
+
{
|
10059
|
+
$justifyContent: "center",
|
10060
|
+
$alignItems: "center",
|
10061
|
+
$gap: "0.25rem",
|
10062
|
+
$fontSize: "0.9375rem",
|
10063
|
+
$padding: "0.625rem 0",
|
10064
|
+
children: [
|
10065
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
10066
|
+
Icon2,
|
10067
|
+
{
|
10068
|
+
name: "check-rounded",
|
10069
|
+
style: {
|
10070
|
+
fontSize: 20,
|
10071
|
+
lineHeight: "1",
|
10072
|
+
color: "#194BFB"
|
10073
|
+
}
|
9288
10074
|
}
|
9289
|
-
|
9290
|
-
|
9291
|
-
|
9292
|
-
|
9293
|
-
|
9294
|
-
|
9295
|
-
|
9296
|
-
|
9297
|
-
|
9298
|
-
|
9299
|
-
|
9300
|
-
|
9301
|
-
|
9302
|
-
|
9303
|
-
|
9304
|
-
|
9305
|
-
|
9306
|
-
|
9307
|
-
|
9308
|
-
|
9309
|
-
|
9310
|
-
|
9311
|
-
|
9312
|
-
|
9313
|
-
|
10075
|
+
),
|
10076
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
10077
|
+
"span",
|
10078
|
+
{
|
10079
|
+
style: {
|
10080
|
+
color: "#7B7B7B",
|
10081
|
+
lineHeight: "1.4"
|
10082
|
+
},
|
10083
|
+
children: "Selected"
|
10084
|
+
}
|
10085
|
+
)
|
10086
|
+
]
|
10087
|
+
}
|
10088
|
+
),
|
10089
|
+
!(plan.current || plan.id === currentPlan?.id) && plan.id !== selectedPlan?.id && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
10090
|
+
StyledButton,
|
10091
|
+
{
|
10092
|
+
$size: "sm",
|
10093
|
+
$color: "secondary",
|
10094
|
+
$variant: "outline",
|
10095
|
+
onClick: () => {
|
10096
|
+
setSelectedPlan(plan);
|
10097
|
+
},
|
10098
|
+
children: "Select"
|
10099
|
+
}
|
10100
|
+
)
|
10101
|
+
]
|
9314
10102
|
}
|
9315
10103
|
)
|
9316
10104
|
]
|
9317
|
-
}
|
10105
|
+
},
|
10106
|
+
plan.id
|
9318
10107
|
);
|
9319
10108
|
})
|
9320
10109
|
}
|
9321
10110
|
)
|
9322
10111
|
] }),
|
9323
|
-
checkoutStage === "checkout" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CheckoutForm, {})
|
10112
|
+
selectedPlan && checkoutStage === "checkout" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CheckoutForm, { plan: selectedPlan, period: planPeriod })
|
9324
10113
|
]
|
9325
10114
|
}
|
9326
10115
|
),
|
@@ -9329,7 +10118,10 @@ var PlanManager = (0, import_react7.forwardRef)(({ children, className, portal,
|
|
9329
10118
|
{
|
9330
10119
|
pricePeriod: planPeriod,
|
9331
10120
|
setPricePeriod: setPlanPeriod,
|
9332
|
-
|
10121
|
+
checkoutStage,
|
10122
|
+
setCheckoutStage,
|
10123
|
+
currentPlan,
|
10124
|
+
selectedPlan
|
9333
10125
|
}
|
9334
10126
|
)
|
9335
10127
|
] })
|
@@ -9640,28 +10432,26 @@ function resolveDesignProps4(props) {
|
|
9640
10432
|
var UpcomingBill = (0, import_react10.forwardRef)(({ className, ...rest }, ref) => {
|
9641
10433
|
const props = resolveDesignProps4(rest);
|
9642
10434
|
const { data, settings, stripe } = useEmbed();
|
9643
|
-
const {
|
10435
|
+
const { upcomingInvoice } = (0, import_react10.useMemo)(() => {
|
9644
10436
|
return {
|
9645
|
-
|
9646
|
-
...data.
|
9647
|
-
amountDue: data.
|
10437
|
+
upcomingInvoice: {
|
10438
|
+
...data.upcomingInvoice?.amountDue && {
|
10439
|
+
amountDue: data.upcomingInvoice.amountDue
|
9648
10440
|
},
|
9649
10441
|
...data.subscription?.interval && {
|
9650
10442
|
interval: data.subscription.interval
|
9651
10443
|
},
|
9652
|
-
...data.
|
9653
|
-
dueDate: toPrettyDate(
|
9654
|
-
new Date(data.subscription.latestInvoice.dueDate)
|
9655
|
-
)
|
10444
|
+
...data.upcomingInvoice?.dueDate && {
|
10445
|
+
dueDate: toPrettyDate(new Date(data.upcomingInvoice.dueDate))
|
9656
10446
|
}
|
9657
10447
|
}
|
9658
10448
|
};
|
9659
|
-
}, [data.subscription]);
|
9660
|
-
if (!stripe || !data.
|
10449
|
+
}, [data.subscription, data.upcomingInvoice]);
|
10450
|
+
if (!stripe || !data.upcomingInvoice) {
|
9661
10451
|
return null;
|
9662
10452
|
}
|
9663
10453
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { ref, className, children: [
|
9664
|
-
props.header.isVisible &&
|
10454
|
+
props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
9665
10455
|
Flex,
|
9666
10456
|
{
|
9667
10457
|
$justifyContent: "space-between",
|
@@ -9677,13 +10467,13 @@ var UpcomingBill = (0, import_react10.forwardRef)(({ className, ...rest }, ref)
|
|
9677
10467
|
children: [
|
9678
10468
|
props.header.prefix,
|
9679
10469
|
" ",
|
9680
|
-
|
10470
|
+
upcomingInvoice.dueDate
|
9681
10471
|
]
|
9682
10472
|
}
|
9683
10473
|
)
|
9684
10474
|
}
|
9685
10475
|
),
|
9686
|
-
|
10476
|
+
upcomingInvoice.amountDue && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "start", $gap: "1rem", children: [
|
9687
10477
|
props.price.isVisible && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Flex, { $alignItems: "end", $flexGrow: "1", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
9688
10478
|
Text,
|
9689
10479
|
{
|
@@ -9701,7 +10491,7 @@ var UpcomingBill = (0, import_react10.forwardRef)(({ className, ...rest }, ref)
|
|
9701
10491
|
children: "$"
|
9702
10492
|
}
|
9703
10493
|
),
|
9704
|
-
|
10494
|
+
upcomingInvoice.amountDue
|
9705
10495
|
]
|
9706
10496
|
}
|
9707
10497
|
) }),
|
@@ -9736,7 +10526,7 @@ var resolveDesignProps5 = (props) => {
|
|
9736
10526
|
};
|
9737
10527
|
var PaymentMethod = (0, import_react11.forwardRef)(({ children, className, portal, ...rest }, ref) => {
|
9738
10528
|
const props = resolveDesignProps5(rest);
|
9739
|
-
const { data, settings, stripe, layout
|
10529
|
+
const { data, settings, stripe, layout } = useEmbed();
|
9740
10530
|
const paymentMethod = (0, import_react11.useMemo)(() => {
|
9741
10531
|
const { cardLast4, cardExpMonth, cardExpYear } = data.subscription?.paymentMethod || {};
|
9742
10532
|
let monthsToExpiration;
|
@@ -9786,7 +10576,7 @@ var PaymentMethod = (0, import_react11.forwardRef)(({ children, className, porta
|
|
9786
10576
|
]
|
9787
10577
|
}
|
9788
10578
|
),
|
9789
|
-
paymentMethod.cardLast4 && /* @__PURE__ */ (0, import_jsx_runtime12.
|
10579
|
+
paymentMethod.cardLast4 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
9790
10580
|
Flex,
|
9791
10581
|
{
|
9792
10582
|
$justifyContent: "space-between",
|
@@ -9795,28 +10585,10 @@ var PaymentMethod = (0, import_react11.forwardRef)(({ children, className, porta
|
|
9795
10585
|
$background: `${hexToHSL(settings.theme.card.background).l > 50 ? darken(settings.theme.card.background, 10) : lighten(settings.theme.card.background, 20)}`,
|
9796
10586
|
$padding: "0.375rem 1rem",
|
9797
10587
|
$borderRadius: "9999px",
|
9798
|
-
children: [
|
9799
|
-
|
9800
|
-
|
9801
|
-
|
9802
|
-
] }),
|
9803
|
-
props.functions.allowEdit && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
9804
|
-
Text,
|
9805
|
-
{
|
9806
|
-
tabIndex: 0,
|
9807
|
-
onClick: () => {
|
9808
|
-
if (layout !== "payment")
|
9809
|
-
return;
|
9810
|
-
setLayout("payment");
|
9811
|
-
},
|
9812
|
-
$font: settings.theme.typography.link.fontFamily,
|
9813
|
-
$size: settings.theme.typography.link.fontSize,
|
9814
|
-
$weight: settings.theme.typography.link.fontWeight,
|
9815
|
-
$color: settings.theme.typography.link.color,
|
9816
|
-
children: "Edit"
|
9817
|
-
}
|
9818
|
-
)
|
9819
|
-
]
|
10588
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { $font: settings.theme.typography.text.fontFamily, $size: 14, children: [
|
10589
|
+
"\u{1F4B3} Card ending in ",
|
10590
|
+
paymentMethod.cardLast4
|
10591
|
+
] })
|
9820
10592
|
}
|
9821
10593
|
),
|
9822
10594
|
layout === "payment" && (0, import_react_dom2.createPortal)(
|
@@ -10340,7 +11112,7 @@ function createRenderer(options) {
|
|
10340
11112
|
component,
|
10341
11113
|
{
|
10342
11114
|
className,
|
10343
|
-
...component !== "div" && { resolvedProps },
|
11115
|
+
...component !== "div" && { ...resolvedProps },
|
10344
11116
|
...component !== "div" && Object.keys(custom).length > 0 && { custom },
|
10345
11117
|
key: index
|
10346
11118
|
},
|