@schematichq/schematic-react 0.2.0-rc.2 → 0.2.0-rc.3
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -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) {
|
@@ -5614,6 +6336,9 @@ 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
|
+
|
5617
6342
|
// node_modules/@stripe/stripe-js/dist/index.mjs
|
5618
6343
|
var V3_URL = "https://js.stripe.com/v3";
|
5619
6344
|
var V3_URL_REGEX = /^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;
|
@@ -6684,7 +7409,8 @@ function ComponentHydrateResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6684
7409
|
component: json["component"] == null ? void 0 : ComponentResponseDataFromJSON(json["component"]),
|
6685
7410
|
featureUsage: json["feature_usage"] == null ? void 0 : FeatureUsageDetailResponseDataFromJSON(json["feature_usage"]),
|
6686
7411
|
stripeEmbed: json["stripe_embed"] == null ? void 0 : StripeEmbedInfoFromJSON(json["stripe_embed"]),
|
6687
|
-
subscription: json["subscription"] == null ? void 0 : CompanySubscriptionResponseDataFromJSON(json["subscription"])
|
7412
|
+
subscription: json["subscription"] == null ? void 0 : CompanySubscriptionResponseDataFromJSON(json["subscription"]),
|
7413
|
+
upcomingInvoice: json["upcoming_invoice"] == null ? void 0 : InvoiceResponseDataFromJSON(json["upcoming_invoice"])
|
6688
7414
|
};
|
6689
7415
|
}
|
6690
7416
|
|
@@ -6885,11 +7611,9 @@ function parseEditorState(data) {
|
|
6885
7611
|
});
|
6886
7612
|
return arr;
|
6887
7613
|
}
|
6888
|
-
async function fetchComponent(id,
|
7614
|
+
async function fetchComponent(id, api) {
|
6889
7615
|
const settings = { ...defaultSettings };
|
6890
7616
|
const nodes = [];
|
6891
|
-
const config = new Configuration({ ...options, apiKey: accessToken });
|
6892
|
-
const api = new CheckoutApi(config);
|
6893
7617
|
const response = await api.hydrateComponent({ componentId: id });
|
6894
7618
|
const { data } = response;
|
6895
7619
|
if (data.component?.ast) {
|
@@ -6915,7 +7639,10 @@ async function fetchComponent(id, accessToken, options) {
|
|
6915
7639
|
};
|
6916
7640
|
}
|
6917
7641
|
var EmbedContext = createContext({
|
6918
|
-
|
7642
|
+
api: null,
|
7643
|
+
data: {
|
7644
|
+
activePlans: []
|
7645
|
+
},
|
6919
7646
|
nodes: [],
|
6920
7647
|
settings: { ...defaultSettings },
|
6921
7648
|
stripe: null,
|
@@ -6939,7 +7666,10 @@ var EmbedProvider = ({
|
|
6939
7666
|
const styleRef = useRef(null);
|
6940
7667
|
const [state, setState] = useState(() => {
|
6941
7668
|
return {
|
6942
|
-
|
7669
|
+
api: null,
|
7670
|
+
data: {
|
7671
|
+
activePlans: []
|
7672
|
+
},
|
6943
7673
|
nodes: [],
|
6944
7674
|
settings: { ...defaultSettings },
|
6945
7675
|
stripe: null,
|
@@ -6967,13 +7697,21 @@ var EmbedProvider = ({
|
|
6967
7697
|
styleRef.current = style;
|
6968
7698
|
}, []);
|
6969
7699
|
useEffect(() => {
|
6970
|
-
if (!
|
7700
|
+
if (!accessToken) {
|
6971
7701
|
return;
|
6972
7702
|
}
|
6973
|
-
|
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) {
|
7709
|
+
return;
|
7710
|
+
}
|
7711
|
+
fetchComponent(id, state.api).then(async (resolvedData) => {
|
6974
7712
|
setState((prev2) => ({ ...prev2, ...resolvedData }));
|
6975
7713
|
}).catch((error) => setState((prev2) => ({ ...prev2, error })));
|
6976
|
-
}, [id,
|
7714
|
+
}, [id, state.api]);
|
6977
7715
|
useEffect(() => {
|
6978
7716
|
const fontSet = /* @__PURE__ */ new Set([]);
|
6979
7717
|
Object.values(state.settings.theme.typography).forEach(({ fontFamily }) => {
|
@@ -6988,19 +7726,21 @@ var EmbedProvider = ({
|
|
6988
7726
|
}, [state.settings.theme.typography]);
|
6989
7727
|
const setData = useCallback(
|
6990
7728
|
(data) => {
|
6991
|
-
setState((prev2) =>
|
6992
|
-
...prev2
|
6993
|
-
|
6994
|
-
|
7729
|
+
setState((prev2) => {
|
7730
|
+
const updated = { ...prev2 };
|
7731
|
+
(0, import_lodash.default)(updated.data, data);
|
7732
|
+
return updated;
|
7733
|
+
});
|
6995
7734
|
},
|
6996
7735
|
[setState]
|
6997
7736
|
);
|
6998
7737
|
const updateSettings = useCallback(
|
6999
7738
|
(settings) => {
|
7000
|
-
setState((prev2) =>
|
7001
|
-
...prev2
|
7002
|
-
|
7003
|
-
|
7739
|
+
setState((prev2) => {
|
7740
|
+
const updated = { ...prev2 };
|
7741
|
+
(0, import_lodash.default)(updated.settings, settings);
|
7742
|
+
return updated;
|
7743
|
+
});
|
7004
7744
|
},
|
7005
7745
|
[setState]
|
7006
7746
|
);
|
@@ -7053,9 +7793,9 @@ var EmbedProvider = ({
|
|
7053
7793
|
}
|
7054
7794
|
}
|
7055
7795
|
},
|
7056
|
-
...state.data.stripeEmbed?.customerEkey
|
7796
|
+
...state.data.stripeEmbed?.customerEkey ? {
|
7057
7797
|
clientSecret: state.data.stripeEmbed.customerEkey
|
7058
|
-
}
|
7798
|
+
} : { mode: "payment", currency: "usd", amount: 999999 }
|
7059
7799
|
},
|
7060
7800
|
children
|
7061
7801
|
}
|
@@ -7067,6 +7807,7 @@ var EmbedProvider = ({
|
|
7067
7807
|
EmbedContext.Provider,
|
7068
7808
|
{
|
7069
7809
|
value: {
|
7810
|
+
api: state.api,
|
7070
7811
|
data: state.data,
|
7071
7812
|
nodes: state.nodes,
|
7072
7813
|
settings: state.settings,
|
@@ -7113,11 +7854,11 @@ var require_browser_polyfill = __commonJS2({
|
|
7113
7854
|
"node_modules/cross-fetch/dist/browser-polyfill.js"(exports) {
|
7114
7855
|
(function(self2) {
|
7115
7856
|
var irrelevant = function(exports2) {
|
7116
|
-
var
|
7857
|
+
var global2 = typeof globalThis !== "undefined" && globalThis || typeof self2 !== "undefined" && self2 || typeof global2 !== "undefined" && global2;
|
7117
7858
|
var support = {
|
7118
|
-
searchParams: "URLSearchParams" in
|
7119
|
-
iterable: "Symbol" in
|
7120
|
-
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() {
|
7121
7862
|
try {
|
7122
7863
|
new Blob();
|
7123
7864
|
return true;
|
@@ -7125,8 +7866,8 @@ var require_browser_polyfill = __commonJS2({
|
|
7125
7866
|
return false;
|
7126
7867
|
}
|
7127
7868
|
}(),
|
7128
|
-
formData: "FormData" in
|
7129
|
-
arrayBuffer: "ArrayBuffer" in
|
7869
|
+
formData: "FormData" in global2,
|
7870
|
+
arrayBuffer: "ArrayBuffer" in global2
|
7130
7871
|
};
|
7131
7872
|
function isDataView(obj) {
|
7132
7873
|
return obj && DataView.prototype.isPrototypeOf(obj);
|
@@ -7503,7 +8244,7 @@ var require_browser_polyfill = __commonJS2({
|
|
7503
8244
|
}
|
7504
8245
|
return new Response(null, { status, headers: { location: url } });
|
7505
8246
|
};
|
7506
|
-
exports2.DOMException =
|
8247
|
+
exports2.DOMException = global2.DOMException;
|
7507
8248
|
try {
|
7508
8249
|
new exports2.DOMException();
|
7509
8250
|
} catch (err2) {
|
@@ -7555,7 +8296,7 @@ var require_browser_polyfill = __commonJS2({
|
|
7555
8296
|
};
|
7556
8297
|
function fixUrl(url) {
|
7557
8298
|
try {
|
7558
|
-
return url === "" &&
|
8299
|
+
return url === "" && global2.location.href ? global2.location.href : url;
|
7559
8300
|
} catch (e) {
|
7560
8301
|
return url;
|
7561
8302
|
}
|
@@ -7594,11 +8335,11 @@ var require_browser_polyfill = __commonJS2({
|
|
7594
8335
|
});
|
7595
8336
|
}
|
7596
8337
|
fetch2.polyfill = true;
|
7597
|
-
if (!
|
7598
|
-
|
7599
|
-
|
7600
|
-
|
7601
|
-
|
8338
|
+
if (!global2.fetch) {
|
8339
|
+
global2.fetch = fetch2;
|
8340
|
+
global2.Headers = Headers;
|
8341
|
+
global2.Request = Request;
|
8342
|
+
global2.Response = Response;
|
7602
8343
|
}
|
7603
8344
|
exports2.Headers = Headers;
|
7604
8345
|
exports2.Request = Request;
|
@@ -8440,15 +9181,96 @@ import {
|
|
8440
9181
|
PaymentElement
|
8441
9182
|
} from "@stripe/react-stripe-js";
|
8442
9183
|
import { useStripe, useElements } from "@stripe/react-stripe-js";
|
9184
|
+
|
9185
|
+
// src/components/elements/plan-manager/styles.ts
|
9186
|
+
var StyledButton = dt(Button2)`
|
9187
|
+
font-family: "Public Sans", sans-serif;
|
9188
|
+
font-weight: 500;
|
9189
|
+
text-align: center;
|
9190
|
+
width: 100%;
|
9191
|
+
${({ disabled, $color = "primary", theme }) => {
|
9192
|
+
const { l: l2 } = hexToHSL(theme[$color]);
|
9193
|
+
const textColor = disabled ? "#989898" : l2 > 50 ? "#000000" : "#FFFFFF";
|
9194
|
+
return lt`
|
9195
|
+
color: ${textColor};
|
9196
|
+
|
9197
|
+
${Text} {
|
9198
|
+
color: ${textColor};
|
9199
|
+
}
|
9200
|
+
`;
|
9201
|
+
}};
|
9202
|
+
|
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
|
+
`;
|
9216
|
+
}}
|
9217
|
+
|
9218
|
+
&:hover {
|
9219
|
+
${({ disabled }) => disabled && "cursor: not-allowed;"}
|
9220
|
+
${({ disabled, $color = "primary", theme, $variant = "filled" }) => {
|
9221
|
+
const specified = theme[$color];
|
9222
|
+
const lightened = lighten(specified, 15);
|
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
|
+
`;
|
9235
|
+
}}
|
9236
|
+
}
|
9237
|
+
|
9238
|
+
${({ $size = "md" }) => {
|
9239
|
+
switch ($size) {
|
9240
|
+
case "sm":
|
9241
|
+
return lt`
|
9242
|
+
font-size: ${15 / 16}rem;
|
9243
|
+
padding: ${12 / 16}rem 0;
|
9244
|
+
border-radius: ${6 / 16}rem;
|
9245
|
+
`;
|
9246
|
+
case "md":
|
9247
|
+
return lt`
|
9248
|
+
font-size: ${17 / 16}rem;
|
9249
|
+
padding: ${16 / 16}rem 0;
|
9250
|
+
border-radius: ${8 / 16}rem;
|
9251
|
+
`;
|
9252
|
+
case "lg":
|
9253
|
+
return lt`
|
9254
|
+
font-size: ${19 / 16}rem;
|
9255
|
+
padding: ${20 / 16}rem 0;
|
9256
|
+
border-radius: ${10 / 16}rem;
|
9257
|
+
`;
|
9258
|
+
}
|
9259
|
+
}}
|
9260
|
+
`;
|
9261
|
+
|
9262
|
+
// src/components/elements/plan-manager/CheckoutForm.tsx
|
8443
9263
|
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
8444
|
-
var CheckoutForm = () => {
|
9264
|
+
var CheckoutForm = ({ plan, period }) => {
|
8445
9265
|
const stripe = useStripe();
|
8446
9266
|
const elements = useElements();
|
9267
|
+
const { api, data } = useEmbed();
|
8447
9268
|
const [message, setMessage] = useState4(null);
|
8448
9269
|
const [isLoading, setIsLoading] = useState4(false);
|
8449
9270
|
const handleSubmit = async (event) => {
|
8450
9271
|
event.preventDefault();
|
8451
|
-
|
9272
|
+
const priceId = period === "month" ? plan.monthlyPrice?.id : plan.yearlyPrice?.id;
|
9273
|
+
if (!api || !stripe || !elements || !priceId) {
|
8452
9274
|
return;
|
8453
9275
|
}
|
8454
9276
|
setIsLoading(true);
|
@@ -8509,22 +9331,13 @@ var CheckoutForm = () => {
|
|
8509
9331
|
message && /* @__PURE__ */ jsx7("div", { id: "payment-message", children: message })
|
8510
9332
|
] }),
|
8511
9333
|
/* @__PURE__ */ jsx7("div", { children: /* @__PURE__ */ jsx7(
|
8512
|
-
|
9334
|
+
StyledButton,
|
8513
9335
|
{
|
8514
|
-
disabled: isLoading || !stripe || !elements,
|
8515
9336
|
id: "submit",
|
8516
|
-
|
8517
|
-
|
8518
|
-
|
8519
|
-
|
8520
|
-
paddingBottom: ".75rem",
|
8521
|
-
fontSize: "15px",
|
8522
|
-
width: "100%",
|
8523
|
-
borderRadius: ".5rem",
|
8524
|
-
textAlign: "center",
|
8525
|
-
cursor: "pointer"
|
8526
|
-
},
|
8527
|
-
children: /* @__PURE__ */ jsx7("span", { id: "button-text", style: { marginTop: "2.5rem" }, children: isLoading ? /* @__PURE__ */ jsx7("div", { className: "spinner", id: "spinner" }) : "Save payment method" })
|
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" })
|
8528
9341
|
}
|
8529
9342
|
) })
|
8530
9343
|
]
|
@@ -8532,86 +9345,12 @@ var CheckoutForm = () => {
|
|
8532
9345
|
);
|
8533
9346
|
};
|
8534
9347
|
|
8535
|
-
// src/components/elements/plan-manager/styles.ts
|
8536
|
-
var StyledButton = dt(Button2)`
|
8537
|
-
font-family: "Public Sans", sans-serif;
|
8538
|
-
font-weight: 500;
|
8539
|
-
text-align: center;
|
8540
|
-
width: 100%;
|
8541
|
-
|
8542
|
-
${({ $color = "primary", theme }) => {
|
8543
|
-
const { l: l2 } = hexToHSL(theme[$color]);
|
8544
|
-
const textColor = l2 > 50 ? "#000000" : "#FFFFFF";
|
8545
|
-
return lt`
|
8546
|
-
color: ${textColor};
|
8547
|
-
|
8548
|
-
${Text} {
|
8549
|
-
color: ${textColor};
|
8550
|
-
}
|
8551
|
-
`;
|
8552
|
-
}};
|
8553
|
-
|
8554
|
-
${({ $color = "primary", theme, $variant = "filled" }) => {
|
8555
|
-
const color = theme[$color];
|
8556
|
-
return $variant === "filled" ? lt`
|
8557
|
-
background-color: ${color};
|
8558
|
-
border-color: ${color};
|
8559
|
-
` : lt`
|
8560
|
-
background-color: transparent;
|
8561
|
-
border-color: #d2d2d2;
|
8562
|
-
color: #194bfb;
|
8563
|
-
${Text} {
|
8564
|
-
color: #194bfb;
|
8565
|
-
}
|
8566
|
-
`;
|
8567
|
-
}}
|
8568
|
-
|
8569
|
-
&:hover {
|
8570
|
-
${({ $color = "primary", theme, $variant = "filled" }) => {
|
8571
|
-
const specified = theme[$color];
|
8572
|
-
const lightened = lighten(specified, 15);
|
8573
|
-
const color = specified === lightened ? darken(specified, 15) : lightened;
|
8574
|
-
return $variant === "filled" ? lt`
|
8575
|
-
background-color: ${color};
|
8576
|
-
border-color: ${color};
|
8577
|
-
` : lt`
|
8578
|
-
background-color: ${color};
|
8579
|
-
border-color: ${color};
|
8580
|
-
color: #ffffff;
|
8581
|
-
${Text} {
|
8582
|
-
color: #ffffff;
|
8583
|
-
}
|
8584
|
-
`;
|
8585
|
-
}}
|
8586
|
-
}
|
8587
|
-
|
8588
|
-
${({ $size = "md" }) => {
|
8589
|
-
switch ($size) {
|
8590
|
-
case "sm":
|
8591
|
-
return lt`
|
8592
|
-
font-size: ${15 / 16}rem;
|
8593
|
-
padding: ${12 / 16}rem 0;
|
8594
|
-
border-radius: ${6 / 16}rem;
|
8595
|
-
`;
|
8596
|
-
case "md":
|
8597
|
-
return lt`
|
8598
|
-
font-size: ${17 / 16}rem;
|
8599
|
-
padding: ${16 / 16}rem 0;
|
8600
|
-
border-radius: ${8 / 16}rem;
|
8601
|
-
`;
|
8602
|
-
case "lg":
|
8603
|
-
return lt`
|
8604
|
-
font-size: ${19 / 16}rem;
|
8605
|
-
padding: ${20 / 16}rem 0;
|
8606
|
-
border-radius: ${10 / 16}rem;
|
8607
|
-
`;
|
8608
|
-
}
|
8609
|
-
}}
|
8610
|
-
`;
|
8611
|
-
|
8612
9348
|
// src/components/elements/plan-manager/PlanManager.tsx
|
8613
9349
|
import { Fragment, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
8614
|
-
var OverlayHeader = ({
|
9350
|
+
var OverlayHeader = ({
|
9351
|
+
children,
|
9352
|
+
onClose
|
9353
|
+
}) => {
|
8615
9354
|
const { setLayout } = useEmbed();
|
8616
9355
|
return /* @__PURE__ */ jsxs3(
|
8617
9356
|
Flex,
|
@@ -8634,6 +9373,9 @@ var OverlayHeader = ({ children }) => {
|
|
8634
9373
|
$cursor: "pointer",
|
8635
9374
|
onClick: () => {
|
8636
9375
|
setLayout("portal");
|
9376
|
+
if (onClose) {
|
9377
|
+
onClose();
|
9378
|
+
}
|
8637
9379
|
},
|
8638
9380
|
children: /* @__PURE__ */ jsx8(Icon2, { name: "close", style: { fontSize: 36, color: "#B8B8B8" } })
|
8639
9381
|
}
|
@@ -8698,8 +9440,20 @@ var OverlayWrapper = ({
|
|
8698
9440
|
var OverlaySideBar = ({
|
8699
9441
|
pricePeriod,
|
8700
9442
|
setPricePeriod,
|
8701
|
-
|
9443
|
+
checkoutStage,
|
9444
|
+
setCheckoutStage,
|
9445
|
+
currentPlan,
|
9446
|
+
selectedPlan
|
8702
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]);
|
8703
9457
|
return /* @__PURE__ */ jsxs3(
|
8704
9458
|
Flex,
|
8705
9459
|
{
|
@@ -8721,32 +9475,7 @@ var OverlaySideBar = ({
|
|
8721
9475
|
$padding: "1.5rem",
|
8722
9476
|
$borderBottom: "1px solid #DEDEDE",
|
8723
9477
|
children: [
|
8724
|
-
/* @__PURE__ */
|
8725
|
-
/* @__PURE__ */ jsx8(Text, { $size: 20, $weight: 600, children: "Subscription" }),
|
8726
|
-
/* @__PURE__ */ jsxs3(
|
8727
|
-
Flex,
|
8728
|
-
{
|
8729
|
-
$border: "1px solid #D9D9D9",
|
8730
|
-
$padding: ".15rem .45rem .15rem .55rem",
|
8731
|
-
$alignItems: "center",
|
8732
|
-
$borderRadius: "5px",
|
8733
|
-
$fontSize: "12px",
|
8734
|
-
children: [
|
8735
|
-
/* @__PURE__ */ jsx8(Box, { $display: "inline-block", $marginRight: ".5rem", children: "$ USD" }),
|
8736
|
-
/* @__PURE__ */ jsx8(
|
8737
|
-
Icon2,
|
8738
|
-
{
|
8739
|
-
name: "chevron-down",
|
8740
|
-
style: {
|
8741
|
-
fontSize: "20px",
|
8742
|
-
lineHeight: "1em"
|
8743
|
-
}
|
8744
|
-
}
|
8745
|
-
)
|
8746
|
-
]
|
8747
|
-
}
|
8748
|
-
)
|
8749
|
-
] }),
|
9478
|
+
/* @__PURE__ */ jsx8(Flex, { $flexDirection: "row", $justifyContent: "space-between", children: /* @__PURE__ */ jsx8(Text, { $size: 20, $weight: 600, children: "Subscription" }) }),
|
8750
9479
|
/* @__PURE__ */ jsxs3(
|
8751
9480
|
Flex,
|
8752
9481
|
{
|
@@ -8784,7 +9513,11 @@ var OverlaySideBar = ({
|
|
8784
9513
|
]
|
8785
9514
|
}
|
8786
9515
|
),
|
8787
|
-
/* @__PURE__ */
|
9516
|
+
savingsPercentage > 0 && /* @__PURE__ */ jsxs3(Box, { $fontSize: "11px", $color: "#194BFB", children: [
|
9517
|
+
"Save up to ",
|
9518
|
+
savingsPercentage,
|
9519
|
+
"% with yearly billing"
|
9520
|
+
] })
|
8788
9521
|
]
|
8789
9522
|
}
|
8790
9523
|
),
|
@@ -8809,7 +9542,7 @@ var OverlaySideBar = ({
|
|
8809
9542
|
$color: "#5D5D5D",
|
8810
9543
|
$gap: ".5rem",
|
8811
9544
|
children: [
|
8812
|
-
/* @__PURE__ */ jsxs3(
|
9545
|
+
currentPlan && /* @__PURE__ */ jsxs3(
|
8813
9546
|
Flex,
|
8814
9547
|
{
|
8815
9548
|
$flexDirection: "row",
|
@@ -8818,50 +9551,56 @@ var OverlaySideBar = ({
|
|
8818
9551
|
$fontSize: "14px",
|
8819
9552
|
$color: "#5D5D5D",
|
8820
9553
|
children: [
|
8821
|
-
/* @__PURE__ */ jsx8(Flex, { $fontSize: "14px", $color: "#5D5D5D", children:
|
9554
|
+
/* @__PURE__ */ jsx8(Flex, { $fontSize: "14px", $color: "#5D5D5D", children: currentPlan.name }),
|
8822
9555
|
/* @__PURE__ */ jsxs3(Flex, { $fontSize: "12px", $color: "#000000", children: [
|
8823
|
-
"$
|
8824
|
-
|
9556
|
+
"$",
|
9557
|
+
currentPlan.planPrice,
|
9558
|
+
"/",
|
9559
|
+
currentPlan.planPeriod
|
8825
9560
|
] })
|
8826
9561
|
]
|
8827
9562
|
}
|
8828
9563
|
),
|
8829
|
-
/* @__PURE__ */
|
8830
|
-
|
8831
|
-
|
8832
|
-
|
8833
|
-
|
8834
|
-
|
8835
|
-
|
8836
|
-
|
8837
|
-
|
8838
|
-
|
8839
|
-
|
8840
|
-
|
8841
|
-
|
8842
|
-
|
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
|
+
}
|
8843
9580
|
}
|
8844
|
-
|
8845
|
-
|
8846
|
-
|
8847
|
-
|
8848
|
-
|
8849
|
-
|
8850
|
-
|
8851
|
-
|
8852
|
-
|
8853
|
-
|
8854
|
-
|
8855
|
-
|
8856
|
-
|
8857
|
-
|
8858
|
-
|
8859
|
-
|
8860
|
-
|
8861
|
-
|
8862
|
-
|
8863
|
-
|
8864
|
-
|
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
|
+
] })
|
8865
9604
|
]
|
8866
9605
|
}
|
8867
9606
|
)
|
@@ -8878,25 +9617,57 @@ var OverlaySideBar = ({
|
|
8878
9617
|
$height: "auto",
|
8879
9618
|
$padding: "1.5rem",
|
8880
9619
|
children: [
|
8881
|
-
/* @__PURE__ */ jsxs3(
|
8882
|
-
|
8883
|
-
|
8884
|
-
|
8885
|
-
|
8886
|
-
|
8887
|
-
|
8888
|
-
|
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(
|
8889
9641
|
StyledButton,
|
8890
9642
|
{
|
8891
9643
|
$size: "sm",
|
8892
9644
|
onClick: () => {
|
8893
9645
|
setCheckoutStage("checkout");
|
8894
9646
|
},
|
8895
|
-
|
9647
|
+
...!selectedPlan && { disabled: true },
|
9648
|
+
children: /* @__PURE__ */ jsxs3(Flex, { $gap: "0.5rem", $alignItems: "center", $justifyContent: "center", children: [
|
8896
9649
|
/* @__PURE__ */ jsx8("span", { children: "Next: Checkout" }),
|
8897
9650
|
/* @__PURE__ */ jsx8(Icon2, { name: "arrow-right" })
|
8898
9651
|
] })
|
8899
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
|
+
}
|
8900
9671
|
),
|
8901
9672
|
/* @__PURE__ */ jsx8(Box, { $fontSize: "12px", $color: "#5D5D5D", children: "Discounts & credits applied at checkout" })
|
8902
9673
|
]
|
@@ -8940,23 +9711,15 @@ var PlanManager = forwardRef(({ children, className, portal, ...rest }, ref) =>
|
|
8940
9711
|
"plan"
|
8941
9712
|
);
|
8942
9713
|
const [planPeriod, setPlanPeriod] = useState5("month");
|
9714
|
+
const [selectedPlan, setSelectedPlan] = useState5();
|
8943
9715
|
const { data, settings, layout, stripe, setLayout } = useEmbed();
|
8944
9716
|
const { currentPlan, canChangePlan, availablePlans } = useMemo2(() => {
|
8945
|
-
const canChangePlan2 = stripe !== null;
|
8946
|
-
const availablePlans2 = data.activePlans?.map(
|
8947
|
-
({ name, description, current, monthlyPrice, yearlyPrice }) => ({
|
8948
|
-
name,
|
8949
|
-
description,
|
8950
|
-
price: planPeriod === "month" ? monthlyPrice?.price : yearlyPrice?.price,
|
8951
|
-
current
|
8952
|
-
})
|
8953
|
-
);
|
8954
9717
|
return {
|
8955
9718
|
currentPlan: data.company?.plan,
|
8956
|
-
canChangePlan:
|
8957
|
-
availablePlans:
|
9719
|
+
canChangePlan: stripe !== null,
|
9720
|
+
availablePlans: data.activePlans
|
8958
9721
|
};
|
8959
|
-
}, [data.company, data.activePlans, stripe
|
9722
|
+
}, [data.company, data.activePlans, stripe]);
|
8960
9723
|
return /* @__PURE__ */ jsxs3("div", { ref, className, children: [
|
8961
9724
|
/* @__PURE__ */ jsx8(
|
8962
9725
|
Flex,
|
@@ -9038,23 +9801,41 @@ var PlanManager = forwardRef(({ children, className, portal, ...rest }, ref) =>
|
|
9038
9801
|
/* @__PURE__ */ jsxs3(OverlayWrapper, { children: [
|
9039
9802
|
/* @__PURE__ */ jsx8(OverlayHeader, { children: /* @__PURE__ */ jsxs3(Flex, { $gap: "1rem", children: [
|
9040
9803
|
/* @__PURE__ */ jsxs3(Flex, { $flexDirection: "row", $gap: "0.5rem", $alignItems: "center", children: [
|
9041
|
-
/* @__PURE__ */ jsx8(
|
9804
|
+
checkoutStage === "plan" ? /* @__PURE__ */ jsx8(
|
9042
9805
|
Box,
|
9043
9806
|
{
|
9044
9807
|
$width: "15px",
|
9045
9808
|
$height: "15px",
|
9809
|
+
$backgroundColor: "white",
|
9046
9810
|
$border: "2px solid #DDDDDD",
|
9047
|
-
$borderRadius: "999px"
|
9048
|
-
|
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
|
+
}
|
9049
9824
|
}
|
9050
9825
|
),
|
9051
9826
|
/* @__PURE__ */ jsx8(
|
9052
9827
|
"div",
|
9053
9828
|
{
|
9054
|
-
|
9829
|
+
tabIndex: 0,
|
9830
|
+
...checkoutStage === "plan" ? {
|
9055
9831
|
style: {
|
9056
9832
|
fontWeight: "700"
|
9057
9833
|
}
|
9834
|
+
} : {
|
9835
|
+
style: {
|
9836
|
+
cursor: "pointer"
|
9837
|
+
},
|
9838
|
+
onClick: () => setCheckoutStage("plan")
|
9058
9839
|
},
|
9059
9840
|
children: "1. Select plan"
|
9060
9841
|
}
|
@@ -9081,6 +9862,7 @@ var PlanManager = forwardRef(({ children, className, portal, ...rest }, ref) =>
|
|
9081
9862
|
/* @__PURE__ */ jsx8(
|
9082
9863
|
"div",
|
9083
9864
|
{
|
9865
|
+
tabIndex: 0,
|
9084
9866
|
...checkoutStage === "checkout" && {
|
9085
9867
|
style: {
|
9086
9868
|
fontWeight: "700"
|
@@ -9088,13 +9870,6 @@ var PlanManager = forwardRef(({ children, className, portal, ...rest }, ref) =>
|
|
9088
9870
|
},
|
9089
9871
|
children: "2. Checkout"
|
9090
9872
|
}
|
9091
|
-
),
|
9092
|
-
/* @__PURE__ */ jsx8(
|
9093
|
-
Icon2,
|
9094
|
-
{
|
9095
|
-
name: "chevron-right",
|
9096
|
-
style: { fontSize: 16, color: "#D0D0D0" }
|
9097
|
-
}
|
9098
9873
|
)
|
9099
9874
|
] })
|
9100
9875
|
] }) }),
|
@@ -9155,8 +9930,8 @@ var PlanManager = forwardRef(({ children, className, portal, ...rest }, ref) =>
|
|
9155
9930
|
$height: "100%",
|
9156
9931
|
$flexDirection: "column",
|
9157
9932
|
$backgroundColor: "white",
|
9158
|
-
$border: plan?.current ? `2px solid #194BFB` : "",
|
9159
9933
|
$flex: "1",
|
9934
|
+
$border: `2px solid ${plan.id === selectedPlan?.id ? "#194BFB" : "transparent"}`,
|
9160
9935
|
$borderRadius: ".5rem",
|
9161
9936
|
$boxShadow: "0px 1px 3px rgba(16, 24, 40, 0.1), 0px 1px 20px rgba(16, 24, 40, 0.06)",
|
9162
9937
|
children: [
|
@@ -9168,26 +9943,26 @@ var PlanManager = forwardRef(({ children, className, portal, ...rest }, ref) =>
|
|
9168
9943
|
$gap: "1rem",
|
9169
9944
|
$width: "100%",
|
9170
9945
|
$height: "auto",
|
9171
|
-
$padding: "1.5rem",
|
9946
|
+
$padding: "2rem 1.5rem 1.5rem",
|
9172
9947
|
$borderBottom: "1px solid #DEDEDE",
|
9173
9948
|
children: [
|
9174
|
-
/* @__PURE__ */ jsx8(Text, { $size: 20, $weight: 600, children: plan
|
9175
|
-
/* @__PURE__ */ jsx8(Text, { $size: 14, children: plan
|
9949
|
+
/* @__PURE__ */ jsx8(Text, { $size: 20, $weight: 600, children: plan.name }),
|
9950
|
+
/* @__PURE__ */ jsx8(Text, { $size: 14, children: plan.description }),
|
9176
9951
|
/* @__PURE__ */ jsxs3(Text, { children: [
|
9177
9952
|
/* @__PURE__ */ jsx8(Box, { $display: "inline-block", $fontSize: ".90rem", children: "$" }),
|
9178
|
-
/* @__PURE__ */ jsx8(Box, { $display: "inline-block", $fontSize: "1.5rem", children:
|
9953
|
+
/* @__PURE__ */ jsx8(Box, { $display: "inline-block", $fontSize: "1.5rem", children: (planPeriod === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price }),
|
9179
9954
|
/* @__PURE__ */ jsxs3(Box, { $display: "inline-block", $fontSize: ".75rem", children: [
|
9180
9955
|
"/",
|
9181
9956
|
planPeriod
|
9182
9957
|
] })
|
9183
9958
|
] }),
|
9184
|
-
plan
|
9959
|
+
(plan.current || plan.id === currentPlan?.id) && /* @__PURE__ */ jsx8(
|
9185
9960
|
Flex,
|
9186
9961
|
{
|
9187
9962
|
$position: "absolute",
|
9188
9963
|
$right: "1rem",
|
9189
9964
|
$top: "1rem",
|
9190
|
-
$fontSize: ".
|
9965
|
+
$fontSize: ".625rem",
|
9191
9966
|
$color: "white",
|
9192
9967
|
$backgroundColor: "#194BFB",
|
9193
9968
|
$borderRadius: "999px",
|
@@ -9208,22 +9983,30 @@ var PlanManager = forwardRef(({ children, className, portal, ...rest }, ref) =>
|
|
9208
9983
|
$width: "100%",
|
9209
9984
|
$height: "auto",
|
9210
9985
|
$padding: "1.5rem",
|
9211
|
-
children:
|
9212
|
-
return /* @__PURE__ */ jsxs3(
|
9213
|
-
|
9214
|
-
|
9215
|
-
|
9216
|
-
|
9217
|
-
|
9218
|
-
|
9219
|
-
|
9220
|
-
|
9221
|
-
|
9222
|
-
|
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
|
+
);
|
9223
10006
|
})
|
9224
10007
|
}
|
9225
10008
|
),
|
9226
|
-
/* @__PURE__ */
|
10009
|
+
/* @__PURE__ */ jsxs3(
|
9227
10010
|
Flex,
|
9228
10011
|
{
|
9229
10012
|
$flexDirection: "column",
|
@@ -9232,58 +10015,64 @@ var PlanManager = forwardRef(({ children, className, portal, ...rest }, ref) =>
|
|
9232
10015
|
$width: "100%",
|
9233
10016
|
$height: "auto",
|
9234
10017
|
$padding: "1.5rem",
|
9235
|
-
children:
|
9236
|
-
|
9237
|
-
|
9238
|
-
|
9239
|
-
|
9240
|
-
|
9241
|
-
|
9242
|
-
|
9243
|
-
|
9244
|
-
|
9245
|
-
|
9246
|
-
|
9247
|
-
|
9248
|
-
|
9249
|
-
|
9250
|
-
|
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
|
+
}
|
9251
10037
|
}
|
9252
|
-
|
9253
|
-
|
9254
|
-
|
9255
|
-
|
9256
|
-
|
9257
|
-
|
9258
|
-
|
9259
|
-
|
9260
|
-
|
9261
|
-
|
9262
|
-
|
9263
|
-
|
9264
|
-
|
9265
|
-
|
9266
|
-
|
9267
|
-
|
9268
|
-
|
9269
|
-
|
9270
|
-
|
9271
|
-
|
9272
|
-
|
9273
|
-
|
9274
|
-
|
9275
|
-
|
9276
|
-
|
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
|
+
]
|
9277
10065
|
}
|
9278
10066
|
)
|
9279
10067
|
]
|
9280
|
-
}
|
10068
|
+
},
|
10069
|
+
plan.id
|
9281
10070
|
);
|
9282
10071
|
})
|
9283
10072
|
}
|
9284
10073
|
)
|
9285
10074
|
] }),
|
9286
|
-
checkoutStage === "checkout" && /* @__PURE__ */ jsx8(CheckoutForm, {})
|
10075
|
+
selectedPlan && checkoutStage === "checkout" && /* @__PURE__ */ jsx8(CheckoutForm, { plan: selectedPlan, period: planPeriod })
|
9287
10076
|
]
|
9288
10077
|
}
|
9289
10078
|
),
|
@@ -9292,7 +10081,10 @@ var PlanManager = forwardRef(({ children, className, portal, ...rest }, ref) =>
|
|
9292
10081
|
{
|
9293
10082
|
pricePeriod: planPeriod,
|
9294
10083
|
setPricePeriod: setPlanPeriod,
|
9295
|
-
|
10084
|
+
checkoutStage,
|
10085
|
+
setCheckoutStage,
|
10086
|
+
currentPlan,
|
10087
|
+
selectedPlan
|
9296
10088
|
}
|
9297
10089
|
)
|
9298
10090
|
] })
|
@@ -9603,28 +10395,26 @@ function resolveDesignProps4(props) {
|
|
9603
10395
|
var UpcomingBill = forwardRef4(({ className, ...rest }, ref) => {
|
9604
10396
|
const props = resolveDesignProps4(rest);
|
9605
10397
|
const { data, settings, stripe } = useEmbed();
|
9606
|
-
const {
|
10398
|
+
const { upcomingInvoice } = useMemo5(() => {
|
9607
10399
|
return {
|
9608
|
-
|
9609
|
-
...data.
|
9610
|
-
amountDue: data.
|
10400
|
+
upcomingInvoice: {
|
10401
|
+
...data.upcomingInvoice?.amountDue && {
|
10402
|
+
amountDue: data.upcomingInvoice.amountDue
|
9611
10403
|
},
|
9612
10404
|
...data.subscription?.interval && {
|
9613
10405
|
interval: data.subscription.interval
|
9614
10406
|
},
|
9615
|
-
...data.
|
9616
|
-
dueDate: toPrettyDate(
|
9617
|
-
new Date(data.subscription.latestInvoice.dueDate)
|
9618
|
-
)
|
10407
|
+
...data.upcomingInvoice?.dueDate && {
|
10408
|
+
dueDate: toPrettyDate(new Date(data.upcomingInvoice.dueDate))
|
9619
10409
|
}
|
9620
10410
|
}
|
9621
10411
|
};
|
9622
|
-
}, [data.subscription]);
|
9623
|
-
if (!stripe || !data.
|
10412
|
+
}, [data.subscription, data.upcomingInvoice]);
|
10413
|
+
if (!stripe || !data.upcomingInvoice) {
|
9624
10414
|
return null;
|
9625
10415
|
}
|
9626
10416
|
return /* @__PURE__ */ jsxs6("div", { ref, className, children: [
|
9627
|
-
props.header.isVisible &&
|
10417
|
+
props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ jsx11(
|
9628
10418
|
Flex,
|
9629
10419
|
{
|
9630
10420
|
$justifyContent: "space-between",
|
@@ -9640,13 +10430,13 @@ var UpcomingBill = forwardRef4(({ className, ...rest }, ref) => {
|
|
9640
10430
|
children: [
|
9641
10431
|
props.header.prefix,
|
9642
10432
|
" ",
|
9643
|
-
|
10433
|
+
upcomingInvoice.dueDate
|
9644
10434
|
]
|
9645
10435
|
}
|
9646
10436
|
)
|
9647
10437
|
}
|
9648
10438
|
),
|
9649
|
-
|
10439
|
+
upcomingInvoice.amountDue && /* @__PURE__ */ jsxs6(Flex, { $justifyContent: "space-between", $alignItems: "start", $gap: "1rem", children: [
|
9650
10440
|
props.price.isVisible && /* @__PURE__ */ jsx11(Flex, { $alignItems: "end", $flexGrow: "1", children: /* @__PURE__ */ jsxs6(
|
9651
10441
|
Text,
|
9652
10442
|
{
|
@@ -9664,7 +10454,7 @@ var UpcomingBill = forwardRef4(({ className, ...rest }, ref) => {
|
|
9664
10454
|
children: "$"
|
9665
10455
|
}
|
9666
10456
|
),
|
9667
|
-
|
10457
|
+
upcomingInvoice.amountDue
|
9668
10458
|
]
|
9669
10459
|
}
|
9670
10460
|
) }),
|
@@ -9699,7 +10489,7 @@ var resolveDesignProps5 = (props) => {
|
|
9699
10489
|
};
|
9700
10490
|
var PaymentMethod = forwardRef5(({ children, className, portal, ...rest }, ref) => {
|
9701
10491
|
const props = resolveDesignProps5(rest);
|
9702
|
-
const { data, settings, stripe, layout
|
10492
|
+
const { data, settings, stripe, layout } = useEmbed();
|
9703
10493
|
const paymentMethod = useMemo6(() => {
|
9704
10494
|
const { cardLast4, cardExpMonth, cardExpYear } = data.subscription?.paymentMethod || {};
|
9705
10495
|
let monthsToExpiration;
|
@@ -9749,7 +10539,7 @@ var PaymentMethod = forwardRef5(({ children, className, portal, ...rest }, ref)
|
|
9749
10539
|
]
|
9750
10540
|
}
|
9751
10541
|
),
|
9752
|
-
paymentMethod.cardLast4 && /* @__PURE__ */
|
10542
|
+
paymentMethod.cardLast4 && /* @__PURE__ */ jsx12(
|
9753
10543
|
Flex,
|
9754
10544
|
{
|
9755
10545
|
$justifyContent: "space-between",
|
@@ -9758,28 +10548,10 @@ var PaymentMethod = forwardRef5(({ children, className, portal, ...rest }, ref)
|
|
9758
10548
|
$background: `${hexToHSL(settings.theme.card.background).l > 50 ? darken(settings.theme.card.background, 10) : lighten(settings.theme.card.background, 20)}`,
|
9759
10549
|
$padding: "0.375rem 1rem",
|
9760
10550
|
$borderRadius: "9999px",
|
9761
|
-
children: [
|
9762
|
-
|
9763
|
-
|
9764
|
-
|
9765
|
-
] }),
|
9766
|
-
props.functions.allowEdit && /* @__PURE__ */ jsx12(
|
9767
|
-
Text,
|
9768
|
-
{
|
9769
|
-
tabIndex: 0,
|
9770
|
-
onClick: () => {
|
9771
|
-
if (layout !== "payment")
|
9772
|
-
return;
|
9773
|
-
setLayout("payment");
|
9774
|
-
},
|
9775
|
-
$font: settings.theme.typography.link.fontFamily,
|
9776
|
-
$size: settings.theme.typography.link.fontSize,
|
9777
|
-
$weight: settings.theme.typography.link.fontWeight,
|
9778
|
-
$color: settings.theme.typography.link.color,
|
9779
|
-
children: "Edit"
|
9780
|
-
}
|
9781
|
-
)
|
9782
|
-
]
|
10551
|
+
children: /* @__PURE__ */ jsxs7(Text, { $font: settings.theme.typography.text.fontFamily, $size: 14, children: [
|
10552
|
+
"\u{1F4B3} Card ending in ",
|
10553
|
+
paymentMethod.cardLast4
|
10554
|
+
] })
|
9783
10555
|
}
|
9784
10556
|
),
|
9785
10557
|
layout === "payment" && createPortal2(
|
@@ -10303,7 +11075,7 @@ function createRenderer(options) {
|
|
10303
11075
|
component,
|
10304
11076
|
{
|
10305
11077
|
className,
|
10306
|
-
...component !== "div" && { resolvedProps },
|
11078
|
+
...component !== "div" && { ...resolvedProps },
|
10307
11079
|
...component !== "div" && Object.keys(custom).length > 0 && { custom },
|
10308
11080
|
key: index
|
10309
11081
|
},
|